V4L/DVB (7598): em28xx: several fixes on gpio programming

em28xx-cards.c:
 - Fix reversed val/rst values in both analog_gpio and digital_gpio
   vectors
 - Fix crash that would was occurring during every analog startup
   while looping over gpio_ctl
 - Remove what appears to be a redundant setting of gpio_ctl->val
 - Don't use OREN538 demodulation for the HVR-950 (prevents ATSC
   scanning from working)

em28xx-dvb.c:
 - Tuner should be in digital mode when issuing the reset
 - Add copyright
 - Change struct definition (corresponds to fix in em28xx-cards.c for
   gpio_ctl looping)

Signed-off-by: Devin Heitmueller <devin.heitmueller@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
This commit is contained in:
Devin Heitmueller 2008-04-17 21:38:27 -03:00 committed by Mauro Carvalho Chehab
parent 3ca9c09379
commit bdfbf95203
3 changed files with 43 additions and 27 deletions

View File

@ -197,8 +197,8 @@ struct em28xx_board em28xx_boards[] = {
.analog_gpio = { .analog_gpio = {
{ /* xc3028 reset seq */ { /* xc3028 reset seq */
.reg = 0x08, .reg = 0x08,
.val = 0x3d, .val = 0x2d,
.rst = 0x2d, .rst = 0x3d,
.t1 = 5, .t1 = 5,
.t2 = 10, .t2 = 10,
.t3 = 5, .t3 = 5,
@ -207,15 +207,15 @@ struct em28xx_board em28xx_boards[] = {
.digital_gpio = { .digital_gpio = {
{ /* xc3028 reset seq */ { /* xc3028 reset seq */
.reg = 0x08, .reg = 0x08,
.val = 0x3e, .val = 0x2e,
.rst = 0x2e, .rst = 0x3e,
.t1 = 6, .t1 = 6,
.t2 = 6, .t2 = 6,
.t3 = 6, .t3 = 6,
}, { /* demod reset seq */ }, { /* demod reset seq */
.reg = 0x04, .reg = 0x04,
.val = 0x0c, .val = 0x04,
.rst = 0x04, .rst = 0x0c,
.t2 = 10, .t2 = 10,
.t3 = 10, .t3 = 10,
} }
@ -472,7 +472,7 @@ int em28xx_tuner_callback(void *ptr, int command, int arg)
{ {
int rc = 0, i; int rc = 0, i;
struct em28xx *dev = ptr; struct em28xx *dev = ptr;
struct gpio_ctl (*gpio_ctl)[MAX_GPIO]; struct gpio_ctl *gpio_ctl;
if (dev->tuner_type != TUNER_XC2028) if (dev->tuner_type != TUNER_XC2028)
return 0; return 0;
@ -485,30 +485,40 @@ int em28xx_tuner_callback(void *ptr, int command, int arg)
else else
gpio_ctl = dev->digital_gpio; gpio_ctl = dev->digital_gpio;
/* djh - Not sure if these are still required */
if (dev->mode == EM28XX_ANALOG_MODE) {
dev->em28xx_write_regs_req(dev, 0x00, 0x48, "\x00", 1);
dev->em28xx_write_regs_req(dev, 0x00, 0x12, "\x67", 1);
msleep(6);
} else {
dev->em28xx_write_regs_req(dev, 0x00, 0x48, "\x00", 1);
dev->em28xx_write_regs_req(dev, 0x00, 0x12, "\x37", 1);
msleep(6);
}
/* Send GPIO reset sequences specified at board entry */ /* Send GPIO reset sequences specified at board entry */
for (i = 0; i < MAX_GPIO; i++) { for (i = 0; i < MAX_GPIO; i++) {
if (!gpio_ctl[i]->val) if (!gpio_ctl->val)
break; break;
dev->em28xx_write_regs(dev, dev->em28xx_write_regs(dev,
gpio_ctl[i]->reg, gpio_ctl->reg,
&gpio_ctl[i]->val, 1); &gpio_ctl->val, 1);
if (gpio_ctl[i]->t1) if (gpio_ctl->t1)
msleep(gpio_ctl[i]->t1); msleep(gpio_ctl->t1);
if (!gpio_ctl[i]->rst) if (!gpio_ctl->rst) {
gpio_ctl++;
continue; continue;
dev->em28xx_write_regs(dev, }
gpio_ctl[i]->reg,
&gpio_ctl[i]->rst, 1);
if (gpio_ctl[i]->t2)
msleep(gpio_ctl[i]->t2);
dev->em28xx_write_regs(dev, dev->em28xx_write_regs(dev,
gpio_ctl[i]->reg, gpio_ctl->reg,
&gpio_ctl[i]->val, 1); &gpio_ctl->rst, 1);
if (gpio_ctl[i]->t3) if (gpio_ctl->t2)
msleep(gpio_ctl[i]->t3); msleep(gpio_ctl->t2);
gpio_ctl++;
} }
return rc; return rc;
} }
@ -524,8 +534,8 @@ static void em28xx_set_model(struct em28xx *dev)
dev->has_12mhz_i2s = em28xx_boards[dev->model].has_12mhz_i2s; dev->has_12mhz_i2s = em28xx_boards[dev->model].has_12mhz_i2s;
dev->max_range_640_480 = em28xx_boards[dev->model].max_range_640_480; dev->max_range_640_480 = em28xx_boards[dev->model].max_range_640_480;
dev->has_dvb = em28xx_boards[dev->model].has_dvb; dev->has_dvb = em28xx_boards[dev->model].has_dvb;
dev->analog_gpio = &em28xx_boards[dev->model].analog_gpio; dev->analog_gpio = em28xx_boards[dev->model].analog_gpio;
dev->digital_gpio = &em28xx_boards[dev->model].digital_gpio; dev->digital_gpio = em28xx_boards[dev->model].digital_gpio;
} }
/* Since em28xx_pre_card_setup() requires a proper dev->model, /* Since em28xx_pre_card_setup() requires a proper dev->model,
@ -562,6 +572,9 @@ void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl)
switch (dev->model) { switch (dev->model) {
/* Add card-specific parameters for xc3028 here */ /* Add card-specific parameters for xc3028 here */
case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950:
ctl->demod = XC3028_FE_DEFAULT;
break;
default: default:
ctl->demod = XC3028_FE_OREN538; ctl->demod = XC3028_FE_OREN538;
} }

View File

@ -3,6 +3,9 @@
(c) 2008 Mauro Carvalho Chehab <mchehab@infradead.org> (c) 2008 Mauro Carvalho Chehab <mchehab@infradead.org>
(c) 2008 Devin Heitmueller <devin.heitmueller@gmail.com>
- Fixes for the driver to properly work with HVR-950
Based on cx88-dvb and saa7134-dvb originally written by: Based on cx88-dvb and saa7134-dvb originally written by:
(c) 2004, 2005 Chris Pascoe <c.pascoe@itee.uq.edu.au> (c) 2004, 2005 Chris Pascoe <c.pascoe@itee.uq.edu.au>
(c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
@ -116,7 +119,7 @@ static int dvb_init(struct em28xx *dev)
switch (dev->model) { switch (dev->model) {
case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950: case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950:
/* Enable lgdt330x */ /* Enable lgdt330x */
dev->mode = EM28XX_ANALOG_MODE; dev->mode = EM28XX_DIGITAL_MODE;
em28xx_tuner_callback(dev, XC2028_TUNER_RESET, 0); em28xx_tuner_callback(dev, XC2028_TUNER_RESET, 0);
dev->dvb.frontend = dvb_attach(lgdt330x_attach, dev->dvb.frontend = dvb_attach(lgdt330x_attach,

View File

@ -319,8 +319,8 @@ struct em28xx {
unsigned int max_range_640_480:1; unsigned int max_range_640_480:1;
unsigned int has_dvb:1; unsigned int has_dvb:1;
struct gpio_ctl (*analog_gpio)[MAX_GPIO]; struct gpio_ctl *analog_gpio;
struct gpio_ctl (*digital_gpio)[MAX_GPIO]; struct gpio_ctl *digital_gpio;
int video_inputs; /* number of video inputs */ int video_inputs; /* number of video inputs */
struct list_head devlist; struct list_head devlist;