diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-01-31 20:12:15 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-03-21 19:31:59 -0400 |
commit | 2f86138706d3b5c85a69e72ca2959717372386dd (patch) | |
tree | df6e5b3a01bb85b20df795db7128ad2ed431f11c /drivers/media/video/cx231xx | |
parent | 3f25ffa2cd946333d29a668993f5aa78e9b56a02 (diff) |
[media] cx231xx: Use parameters to describe some board variants
Instead of per-model tests all over the code, use some parameters
at the board entries to describe the model variants for:
- devices with 417 MPEG encoder;
- devices that use external AV;
- devices where vbi VANC endpoint doesn't work;
- devices with xc5000 that require different IF
initialization (and probably will cover also
xc3028).
- devices with xceive tuner that require a reset
during init.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx231xx')
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-avcore.c | 12 | ||||
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-cards.c | 7 | ||||
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-core.c | 16 | ||||
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-video.c | 20 | ||||
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx.h | 3 |
5 files changed, 30 insertions, 28 deletions
diff --git a/drivers/media/video/cx231xx/cx231xx-avcore.c b/drivers/media/video/cx231xx/cx231xx-avcore.c index c53e97295a0d..b80bccfa9b2d 100644 --- a/drivers/media/video/cx231xx/cx231xx-avcore.c +++ b/drivers/media/video/cx231xx/cx231xx-avcore.c | |||
@@ -759,11 +759,8 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev, | |||
759 | case CX231XX_VMUX_TELEVISION: | 759 | case CX231XX_VMUX_TELEVISION: |
760 | case CX231XX_VMUX_CABLE: | 760 | case CX231XX_VMUX_CABLE: |
761 | default: | 761 | default: |
762 | switch (dev->model) { | 762 | /* TODO: Test if this is also needed for xc2028/xc3028 */ |
763 | case CX231XX_BOARD_CNXT_CARRAERA: | 763 | if (dev->board.tuner_type == TUNER_XC5000) { |
764 | case CX231XX_BOARD_CNXT_RDE_250: | ||
765 | case CX231XX_BOARD_CNXT_SHELBY: | ||
766 | case CX231XX_BOARD_CNXT_RDU_250: | ||
767 | /* Disable the use of DIF */ | 764 | /* Disable the use of DIF */ |
768 | 765 | ||
769 | status = vid_blk_read_word(dev, AFE_CTRL, &value); | 766 | status = vid_blk_read_word(dev, AFE_CTRL, &value); |
@@ -820,8 +817,7 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev, | |||
820 | MODE_CTRL, FLD_INPUT_MODE, | 817 | MODE_CTRL, FLD_INPUT_MODE, |
821 | cx231xx_set_field(FLD_INPUT_MODE, | 818 | cx231xx_set_field(FLD_INPUT_MODE, |
822 | INPUT_MODE_CVBS_0)); | 819 | INPUT_MODE_CVBS_0)); |
823 | break; | 820 | } else { |
824 | default: | ||
825 | /* Enable the DIF for the tuner */ | 821 | /* Enable the DIF for the tuner */ |
826 | 822 | ||
827 | /* Reinitialize the DIF */ | 823 | /* Reinitialize the DIF */ |
@@ -2550,7 +2546,7 @@ int cx231xx_initialize_stream_xfer(struct cx231xx *dev, u32 media_type) | |||
2550 | case 4: /* ts1 */ | 2546 | case 4: /* ts1 */ |
2551 | cx231xx_info("%s: set ts1 registers", __func__); | 2547 | cx231xx_info("%s: set ts1 registers", __func__); |
2552 | 2548 | ||
2553 | if (dev->model == CX231XX_BOARD_CNXT_VIDEO_GRABBER) { | 2549 | if (dev->board.has_417) { |
2554 | cx231xx_info(" MPEG\n"); | 2550 | cx231xx_info(" MPEG\n"); |
2555 | value &= 0xFFFFFFFC; | 2551 | value &= 0xFFFFFFFC; |
2556 | value |= 0x3; | 2552 | value |= 0x3; |
diff --git a/drivers/media/video/cx231xx/cx231xx-cards.c b/drivers/media/video/cx231xx/cx231xx-cards.c index ca2b24b0b166..e04c955bd2f1 100644 --- a/drivers/media/video/cx231xx/cx231xx-cards.c +++ b/drivers/media/video/cx231xx/cx231xx-cards.c | |||
@@ -261,6 +261,9 @@ struct cx231xx_board cx231xx_boards[] = { | |||
261 | .agc_analog_digital_select_gpio = 0x1c, | 261 | .agc_analog_digital_select_gpio = 0x1c, |
262 | .gpio_pin_status_mask = 0x4001000, | 262 | .gpio_pin_status_mask = 0x4001000, |
263 | .norm = V4L2_STD_PAL, | 263 | .norm = V4L2_STD_PAL, |
264 | .no_alt_vanc = 1, | ||
265 | .external_av = 1, | ||
266 | .has_417 = 1, | ||
264 | 267 | ||
265 | .input = {{ | 268 | .input = {{ |
266 | .type = CX231XX_VMUX_COMPOSITE1, | 269 | .type = CX231XX_VMUX_COMPOSITE1, |
@@ -382,6 +385,8 @@ struct cx231xx_board cx231xx_boards[] = { | |||
382 | .agc_analog_digital_select_gpio = 0x0c, | 385 | .agc_analog_digital_select_gpio = 0x0c, |
383 | .gpio_pin_status_mask = 0x4001000, | 386 | .gpio_pin_status_mask = 0x4001000, |
384 | .norm = V4L2_STD_NTSC, | 387 | .norm = V4L2_STD_NTSC, |
388 | .no_alt_vanc = 1, | ||
389 | .external_av = 1, | ||
385 | .input = {{ | 390 | .input = {{ |
386 | .type = CX231XX_VMUX_COMPOSITE1, | 391 | .type = CX231XX_VMUX_COMPOSITE1, |
387 | .vmux = CX231XX_VIN_2_1, | 392 | .vmux = CX231XX_VIN_2_1, |
@@ -772,7 +777,7 @@ static int cx231xx_init_dev(struct cx231xx **devhandle, struct usb_device *udev, | |||
772 | /* Reset other chips required if they are tied up with GPIO pins */ | 777 | /* Reset other chips required if they are tied up with GPIO pins */ |
773 | cx231xx_add_into_devlist(dev); | 778 | cx231xx_add_into_devlist(dev); |
774 | 779 | ||
775 | if (dev->model == CX231XX_BOARD_CNXT_VIDEO_GRABBER) { | 780 | if (dev->board.has_417) { |
776 | printk(KERN_INFO "attach 417 %d\n", dev->model); | 781 | printk(KERN_INFO "attach 417 %d\n", dev->model); |
777 | if (cx231xx_417_register(dev) < 0) { | 782 | if (cx231xx_417_register(dev) < 0) { |
778 | printk(KERN_ERR | 783 | printk(KERN_ERR |
diff --git a/drivers/media/video/cx231xx/cx231xx-core.c b/drivers/media/video/cx231xx/cx231xx-core.c index 7d62d58617f5..abe500feb7dd 100644 --- a/drivers/media/video/cx231xx/cx231xx-core.c +++ b/drivers/media/video/cx231xx/cx231xx-core.c | |||
@@ -571,6 +571,8 @@ int cx231xx_set_alt_setting(struct cx231xx *dev, u8 index, u8 alt) | |||
571 | alt]; | 571 | alt]; |
572 | break; | 572 | break; |
573 | case INDEX_VANC: | 573 | case INDEX_VANC: |
574 | if (dev->board.no_alt_vanc) | ||
575 | return 0; | ||
574 | usb_interface_index = | 576 | usb_interface_index = |
575 | dev->current_pcb_config.hs_config_info[0].interface_info. | 577 | dev->current_pcb_config.hs_config_info[0].interface_info. |
576 | vanc_index + 1; | 578 | vanc_index + 1; |
@@ -600,8 +602,7 @@ int cx231xx_set_alt_setting(struct cx231xx *dev, u8 index, u8 alt) | |||
600 | usb_interface_index, alt); | 602 | usb_interface_index, alt); |
601 | /*To workaround error number=-71 on EP0 for videograbber, | 603 | /*To workaround error number=-71 on EP0 for videograbber, |
602 | need add following codes.*/ | 604 | need add following codes.*/ |
603 | if (dev->model != CX231XX_BOARD_CNXT_VIDEO_GRABBER && | 605 | if (dev->board.no_alt_vanc) |
604 | dev->model != CX231XX_BOARD_HAUPPAUGE_USBLIVE2) | ||
605 | return -1; | 606 | return -1; |
606 | } | 607 | } |
607 | 608 | ||
@@ -1301,8 +1302,7 @@ int cx231xx_dev_init(struct cx231xx *dev) | |||
1301 | /* init hardware */ | 1302 | /* init hardware */ |
1302 | /* Note : with out calling set power mode function, | 1303 | /* Note : with out calling set power mode function, |
1303 | afe can not be set up correctly */ | 1304 | afe can not be set up correctly */ |
1304 | if (dev->model == CX231XX_BOARD_CNXT_VIDEO_GRABBER || | 1305 | if (dev->board.external_av) { |
1305 | dev->model == CX231XX_BOARD_HAUPPAUGE_USBLIVE2) { | ||
1306 | errCode = cx231xx_set_power_mode(dev, | 1306 | errCode = cx231xx_set_power_mode(dev, |
1307 | POLARIS_AVMODE_ENXTERNAL_AV); | 1307 | POLARIS_AVMODE_ENXTERNAL_AV); |
1308 | if (errCode < 0) { | 1308 | if (errCode < 0) { |
@@ -1322,11 +1322,9 @@ int cx231xx_dev_init(struct cx231xx *dev) | |||
1322 | } | 1322 | } |
1323 | } | 1323 | } |
1324 | 1324 | ||
1325 | /* reset the Tuner */ | 1325 | /* reset the Tuner, if it is a Xceive tuner */ |
1326 | if ((dev->model == CX231XX_BOARD_CNXT_CARRAERA) || | 1326 | if ((dev->board.tuner_type == TUNER_XC5000) || |
1327 | (dev->model == CX231XX_BOARD_CNXT_RDE_250) || | 1327 | (dev->board.tuner_type == TUNER_XC2028)) |
1328 | (dev->model == CX231XX_BOARD_CNXT_SHELBY) || | ||
1329 | (dev->model == CX231XX_BOARD_CNXT_RDU_250)) | ||
1330 | cx231xx_gpio_set(dev, dev->board.tuner_gpio); | 1328 | cx231xx_gpio_set(dev, dev->board.tuner_gpio); |
1331 | 1329 | ||
1332 | /* initialize Colibri block */ | 1330 | /* initialize Colibri block */ |
diff --git a/drivers/media/video/cx231xx/cx231xx-video.c b/drivers/media/video/cx231xx/cx231xx-video.c index 7e3e8c4f19b7..ffd5af914c44 100644 --- a/drivers/media/video/cx231xx/cx231xx-video.c +++ b/drivers/media/video/cx231xx/cx231xx-video.c | |||
@@ -2190,8 +2190,7 @@ static int cx231xx_v4l2_open(struct file *filp) | |||
2190 | dev->height = norm_maxh(dev); | 2190 | dev->height = norm_maxh(dev); |
2191 | 2191 | ||
2192 | /* Power up in Analog TV mode */ | 2192 | /* Power up in Analog TV mode */ |
2193 | if (dev->model == CX231XX_BOARD_CNXT_VIDEO_GRABBER || | 2193 | if (dev->board.external_av) |
2194 | dev->model == CX231XX_BOARD_HAUPPAUGE_USBLIVE2) | ||
2195 | cx231xx_set_power_mode(dev, | 2194 | cx231xx_set_power_mode(dev, |
2196 | POLARIS_AVMODE_ENXTERNAL_AV); | 2195 | POLARIS_AVMODE_ENXTERNAL_AV); |
2197 | else | 2196 | else |
@@ -2231,9 +2230,7 @@ static int cx231xx_v4l2_open(struct file *filp) | |||
2231 | if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) { | 2230 | if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) { |
2232 | /* Set the required alternate setting VBI interface works in | 2231 | /* Set the required alternate setting VBI interface works in |
2233 | Bulk mode only */ | 2232 | Bulk mode only */ |
2234 | if (dev->model != CX231XX_BOARD_CNXT_VIDEO_GRABBER && | 2233 | cx231xx_set_alt_setting(dev, INDEX_VANC, 0); |
2235 | dev->model != CX231XX_BOARD_HAUPPAUGE_USBLIVE2) | ||
2236 | cx231xx_set_alt_setting(dev, INDEX_VANC, 0); | ||
2237 | 2234 | ||
2238 | videobuf_queue_vmalloc_init(&fh->vb_vidq, &cx231xx_vbi_qops, | 2235 | videobuf_queue_vmalloc_init(&fh->vb_vidq, &cx231xx_vbi_qops, |
2239 | NULL, &dev->vbi_mode.slock, | 2236 | NULL, &dev->vbi_mode.slock, |
@@ -2275,7 +2272,7 @@ void cx231xx_release_analog_resources(struct cx231xx *dev) | |||
2275 | cx231xx_info("V4L2 device %s deregistered\n", | 2272 | cx231xx_info("V4L2 device %s deregistered\n", |
2276 | video_device_node_name(dev->vdev)); | 2273 | video_device_node_name(dev->vdev)); |
2277 | 2274 | ||
2278 | if (dev->model == CX231XX_BOARD_CNXT_VIDEO_GRABBER) | 2275 | if (dev->board.has_417) |
2279 | cx231xx_417_unregister(dev); | 2276 | cx231xx_417_unregister(dev); |
2280 | 2277 | ||
2281 | if (video_is_registered(dev->vdev)) | 2278 | if (video_is_registered(dev->vdev)) |
@@ -2302,10 +2299,13 @@ static int cx231xx_v4l2_close(struct file *filp) | |||
2302 | if (res_check(fh)) | 2299 | if (res_check(fh)) |
2303 | res_free(fh); | 2300 | res_free(fh); |
2304 | 2301 | ||
2305 | /*To workaround error number=-71 on EP0 for VideoGrabber, | 2302 | /* |
2306 | need exclude following.*/ | 2303 | * To workaround error number=-71 on EP0 for VideoGrabber, |
2307 | if (dev->model != CX231XX_BOARD_CNXT_VIDEO_GRABBER && | 2304 | * need exclude following. |
2308 | dev->model != CX231XX_BOARD_HAUPPAUGE_USBLIVE2) | 2305 | * FIXME: It is probably safe to remove most of these, as we're |
2306 | * now avoiding the alternate setting for INDEX_VANC | ||
2307 | */ | ||
2308 | if (!dev->board.no_alt_vanc) | ||
2309 | if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) { | 2309 | if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) { |
2310 | videobuf_stop(&fh->vb_vidq); | 2310 | videobuf_stop(&fh->vb_vidq); |
2311 | videobuf_mmap_free(&fh->vb_vidq); | 2311 | videobuf_mmap_free(&fh->vb_vidq); |
diff --git a/drivers/media/video/cx231xx/cx231xx.h b/drivers/media/video/cx231xx/cx231xx.h index 72bbea2bcd56..b72503d625b5 100644 --- a/drivers/media/video/cx231xx/cx231xx.h +++ b/drivers/media/video/cx231xx/cx231xx.h | |||
@@ -353,7 +353,10 @@ struct cx231xx_board { | |||
353 | 353 | ||
354 | unsigned int max_range_640_480:1; | 354 | unsigned int max_range_640_480:1; |
355 | unsigned int has_dvb:1; | 355 | unsigned int has_dvb:1; |
356 | unsigned int has_417:1; | ||
356 | unsigned int valid:1; | 357 | unsigned int valid:1; |
358 | unsigned int no_alt_vanc:1; | ||
359 | unsigned int external_av:1; | ||
357 | 360 | ||
358 | unsigned char xclk, i2c_speed; | 361 | unsigned char xclk, i2c_speed; |
359 | 362 | ||