diff options
author | Devin Heitmueller <devin.heitmueller@gmail.com> | 2008-04-17 20:38:27 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-24 13:09:41 -0400 |
commit | bdfbf9520372daf2b4d6941474c92310848ccb27 (patch) | |
tree | ae30d3b5f222955cbf8eb7203b1ce9b3a106299f /drivers/media/video/em28xx/em28xx-cards.c | |
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>
Diffstat (limited to 'drivers/media/video/em28xx/em28xx-cards.c')
-rw-r--r-- | drivers/media/video/em28xx/em28xx-cards.c | 61 |
1 files changed, 37 insertions, 24 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[] = { | |||
197 | .analog_gpio = { | 197 | .analog_gpio = { |
198 | { /* xc3028 reset seq */ | 198 | { /* xc3028 reset seq */ |
199 | .reg = 0x08, | 199 | .reg = 0x08, |
200 | .val = 0x3d, | 200 | .val = 0x2d, |
201 | .rst = 0x2d, | 201 | .rst = 0x3d, |
202 | .t1 = 5, | 202 | .t1 = 5, |
203 | .t2 = 10, | 203 | .t2 = 10, |
204 | .t3 = 5, | 204 | .t3 = 5, |
@@ -207,15 +207,15 @@ struct em28xx_board em28xx_boards[] = { | |||
207 | .digital_gpio = { | 207 | .digital_gpio = { |
208 | { /* xc3028 reset seq */ | 208 | { /* xc3028 reset seq */ |
209 | .reg = 0x08, | 209 | .reg = 0x08, |
210 | .val = 0x3e, | 210 | .val = 0x2e, |
211 | .rst = 0x2e, | 211 | .rst = 0x3e, |
212 | .t1 = 6, | 212 | .t1 = 6, |
213 | .t2 = 6, | 213 | .t2 = 6, |
214 | .t3 = 6, | 214 | .t3 = 6, |
215 | }, { /* demod reset seq */ | 215 | }, { /* demod reset seq */ |
216 | .reg = 0x04, | 216 | .reg = 0x04, |
217 | .val = 0x0c, | 217 | .val = 0x04, |
218 | .rst = 0x04, | 218 | .rst = 0x0c, |
219 | .t2 = 10, | 219 | .t2 = 10, |
220 | .t3 = 10, | 220 | .t3 = 10, |
221 | } | 221 | } |
@@ -472,7 +472,7 @@ int em28xx_tuner_callback(void *ptr, int command, int arg) | |||
472 | { | 472 | { |
473 | int rc = 0, i; | 473 | int rc = 0, i; |
474 | struct em28xx *dev = ptr; | 474 | struct em28xx *dev = ptr; |
475 | struct gpio_ctl (*gpio_ctl)[MAX_GPIO]; | 475 | struct gpio_ctl *gpio_ctl; |
476 | 476 | ||
477 | if (dev->tuner_type != TUNER_XC2028) | 477 | if (dev->tuner_type != TUNER_XC2028) |
478 | return 0; | 478 | return 0; |
@@ -485,30 +485,40 @@ int em28xx_tuner_callback(void *ptr, int command, int arg) | |||
485 | else | 485 | else |
486 | gpio_ctl = dev->digital_gpio; | 486 | gpio_ctl = dev->digital_gpio; |
487 | 487 | ||
488 | /* djh - Not sure if these are still required */ | ||
489 | if (dev->mode == EM28XX_ANALOG_MODE) { | ||
490 | dev->em28xx_write_regs_req(dev, 0x00, 0x48, "\x00", 1); | ||
491 | dev->em28xx_write_regs_req(dev, 0x00, 0x12, "\x67", 1); | ||
492 | msleep(6); | ||
493 | } else { | ||
494 | dev->em28xx_write_regs_req(dev, 0x00, 0x48, "\x00", 1); | ||
495 | dev->em28xx_write_regs_req(dev, 0x00, 0x12, "\x37", 1); | ||
496 | msleep(6); | ||
497 | } | ||
498 | |||
488 | /* Send GPIO reset sequences specified at board entry */ | 499 | /* Send GPIO reset sequences specified at board entry */ |
489 | for (i = 0; i < MAX_GPIO; i++) { | 500 | for (i = 0; i < MAX_GPIO; i++) { |
490 | if (!gpio_ctl[i]->val) | 501 | if (!gpio_ctl->val) |
491 | break; | 502 | break; |
492 | 503 | ||
493 | dev->em28xx_write_regs(dev, | 504 | dev->em28xx_write_regs(dev, |
494 | gpio_ctl[i]->reg, | 505 | gpio_ctl->reg, |
495 | &gpio_ctl[i]->val, 1); | 506 | &gpio_ctl->val, 1); |
496 | if (gpio_ctl[i]->t1) | 507 | if (gpio_ctl->t1) |
497 | msleep(gpio_ctl[i]->t1); | 508 | msleep(gpio_ctl->t1); |
498 | 509 | ||
499 | if (!gpio_ctl[i]->rst) | 510 | if (!gpio_ctl->rst) { |
511 | gpio_ctl++; | ||
500 | continue; | 512 | continue; |
501 | dev->em28xx_write_regs(dev, | 513 | } |
502 | gpio_ctl[i]->reg, | ||
503 | &gpio_ctl[i]->rst, 1); | ||
504 | if (gpio_ctl[i]->t2) | ||
505 | msleep(gpio_ctl[i]->t2); | ||
506 | 514 | ||
507 | dev->em28xx_write_regs(dev, | 515 | dev->em28xx_write_regs(dev, |
508 | gpio_ctl[i]->reg, | 516 | gpio_ctl->reg, |
509 | &gpio_ctl[i]->val, 1); | 517 | &gpio_ctl->rst, 1); |
510 | if (gpio_ctl[i]->t3) | 518 | if (gpio_ctl->t2) |
511 | msleep(gpio_ctl[i]->t3); | 519 | msleep(gpio_ctl->t2); |
520 | |||
521 | gpio_ctl++; | ||
512 | } | 522 | } |
513 | return rc; | 523 | return rc; |
514 | } | 524 | } |
@@ -524,8 +534,8 @@ static void em28xx_set_model(struct em28xx *dev) | |||
524 | dev->has_12mhz_i2s = em28xx_boards[dev->model].has_12mhz_i2s; | 534 | dev->has_12mhz_i2s = em28xx_boards[dev->model].has_12mhz_i2s; |
525 | dev->max_range_640_480 = em28xx_boards[dev->model].max_range_640_480; | 535 | dev->max_range_640_480 = em28xx_boards[dev->model].max_range_640_480; |
526 | dev->has_dvb = em28xx_boards[dev->model].has_dvb; | 536 | dev->has_dvb = em28xx_boards[dev->model].has_dvb; |
527 | dev->analog_gpio = &em28xx_boards[dev->model].analog_gpio; | 537 | dev->analog_gpio = em28xx_boards[dev->model].analog_gpio; |
528 | dev->digital_gpio = &em28xx_boards[dev->model].digital_gpio; | 538 | dev->digital_gpio = em28xx_boards[dev->model].digital_gpio; |
529 | } | 539 | } |
530 | 540 | ||
531 | /* Since em28xx_pre_card_setup() requires a proper dev->model, | 541 | /* 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) | |||
562 | 572 | ||
563 | switch (dev->model) { | 573 | switch (dev->model) { |
564 | /* Add card-specific parameters for xc3028 here */ | 574 | /* Add card-specific parameters for xc3028 here */ |
575 | case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950: | ||
576 | ctl->demod = XC3028_FE_DEFAULT; | ||
577 | break; | ||
565 | default: | 578 | default: |
566 | ctl->demod = XC3028_FE_OREN538; | 579 | ctl->demod = XC3028_FE_OREN538; |
567 | } | 580 | } |