diff options
author | Devin Heitmueller <devin.heitmueller@gmail.com> | 2008-04-17 21:38:27 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-24 14:09:41 -0300 |
commit | bdfbf9520372daf2b4d6941474c92310848ccb27 (patch) | |
tree | ae30d3b5f222955cbf8eb7203b1ce9b3a106299f | |
parent | 3ca9c09379e8f3be0744c47f72769457fa46e9f3 (diff) |
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>
-rw-r--r-- | drivers/media/video/em28xx/em28xx-cards.c | 61 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx-dvb.c | 5 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx.h | 4 |
3 files changed, 43 insertions, 27 deletions
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index f4883b4a6b7a..2e7fd1911154 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -197,8 +197,8 @@ struct em28xx_board em28xx_boards[] = { .analog_gpio = { { /* xc3028 reset seq */ .reg = 0x08, - .val = 0x3d, - .rst = 0x2d, + .val = 0x2d, + .rst = 0x3d, .t1 = 5, .t2 = 10, .t3 = 5, @@ -207,15 +207,15 @@ struct em28xx_board em28xx_boards[] = { .digital_gpio = { { /* xc3028 reset seq */ .reg = 0x08, - .val = 0x3e, - .rst = 0x2e, + .val = 0x2e, + .rst = 0x3e, .t1 = 6, .t2 = 6, .t3 = 6, }, { /* demod reset seq */ .reg = 0x04, - .val = 0x0c, - .rst = 0x04, + .val = 0x04, + .rst = 0x0c, .t2 = 10, .t3 = 10, } @@ -472,7 +472,7 @@ int em28xx_tuner_callback(void *ptr, int command, int arg) { int rc = 0, i; struct em28xx *dev = ptr; - struct gpio_ctl (*gpio_ctl)[MAX_GPIO]; + struct gpio_ctl *gpio_ctl; if (dev->tuner_type != TUNER_XC2028) return 0; @@ -485,30 +485,40 @@ int em28xx_tuner_callback(void *ptr, int command, int arg) else 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 */ for (i = 0; i < MAX_GPIO; i++) { - if (!gpio_ctl[i]->val) + if (!gpio_ctl->val) break; dev->em28xx_write_regs(dev, - gpio_ctl[i]->reg, - &gpio_ctl[i]->val, 1); - if (gpio_ctl[i]->t1) - msleep(gpio_ctl[i]->t1); + gpio_ctl->reg, + &gpio_ctl->val, 1); + if (gpio_ctl->t1) + msleep(gpio_ctl->t1); - if (!gpio_ctl[i]->rst) + if (!gpio_ctl->rst) { + gpio_ctl++; 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, - gpio_ctl[i]->reg, - &gpio_ctl[i]->val, 1); - if (gpio_ctl[i]->t3) - msleep(gpio_ctl[i]->t3); + gpio_ctl->reg, + &gpio_ctl->rst, 1); + if (gpio_ctl->t2) + msleep(gpio_ctl->t2); + + gpio_ctl++; } 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->max_range_640_480 = em28xx_boards[dev->model].max_range_640_480; dev->has_dvb = em28xx_boards[dev->model].has_dvb; - dev->analog_gpio = &em28xx_boards[dev->model].analog_gpio; - dev->digital_gpio = &em28xx_boards[dev->model].digital_gpio; + dev->analog_gpio = em28xx_boards[dev->model].analog_gpio; + dev->digital_gpio = em28xx_boards[dev->model].digital_gpio; } /* 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) { /* Add card-specific parameters for xc3028 here */ + case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950: + ctl->demod = XC3028_FE_DEFAULT; + break; default: ctl->demod = XC3028_FE_OREN538; } diff --git a/drivers/media/video/em28xx/em28xx-dvb.c b/drivers/media/video/em28xx/em28xx-dvb.c index 1ceabeac4f7b..cbc155d302c8 100644 --- a/drivers/media/video/em28xx/em28xx-dvb.c +++ b/drivers/media/video/em28xx/em28xx-dvb.c @@ -3,6 +3,9 @@ (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: (c) 2004, 2005 Chris Pascoe <c.pascoe@itee.uq.edu.au> (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] @@ -116,7 +119,7 @@ static int dvb_init(struct em28xx *dev) switch (dev->model) { case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950: /* Enable lgdt330x */ - dev->mode = EM28XX_ANALOG_MODE; + dev->mode = EM28XX_DIGITAL_MODE; em28xx_tuner_callback(dev, XC2028_TUNER_RESET, 0); dev->dvb.frontend = dvb_attach(lgdt330x_attach, diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index fa1c74217a52..10f64652c04f 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h @@ -319,8 +319,8 @@ struct em28xx { unsigned int max_range_640_480:1; unsigned int has_dvb:1; - struct gpio_ctl (*analog_gpio)[MAX_GPIO]; - struct gpio_ctl (*digital_gpio)[MAX_GPIO]; + struct gpio_ctl *analog_gpio; + struct gpio_ctl *digital_gpio; int video_inputs; /* number of video inputs */ struct list_head devlist; |