aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx231xx/cx231xx-cards.c
diff options
context:
space:
mode:
authorPalash Bandyopadhyay <palash.bandyopadhyay@conexant.com>2010-07-06 17:12:25 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-10-20 23:17:10 -0400
commit64fbf44455260684fa5bfdd3121af3d0ef0b48dd (patch)
tree3e823c84d187b8de0731cd0b703b341abd92350e /drivers/media/video/cx231xx/cx231xx-cards.c
parent47b75ec14653f12f9fd6fd76bfd5891ba35e1e79 (diff)
[media] cx231xx: Added support for Carraera, Shelby, RDx_253S and VIDEO_GRABBER
Added support for new cx231xx boards - Carraera, Shelby, RDx_253S and VIDEO_GRABBER. [mchehab@redhat.com: Fix a merge conflict with BKL removal patches] Signed-off-by: Palash Bandyopadhyay <palash.bandyopadhyay@conexant.com> Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx231xx/cx231xx-cards.c')
-rw-r--r--drivers/media/video/cx231xx/cx231xx-cards.c328
1 files changed, 304 insertions, 24 deletions
diff --git a/drivers/media/video/cx231xx/cx231xx-cards.c b/drivers/media/video/cx231xx/cx231xx-cards.c
index f2a4900014bc..59e273324f5a 100644
--- a/drivers/media/video/cx231xx/cx231xx-cards.c
+++ b/drivers/media/video/cx231xx/cx231xx-cards.c
@@ -41,6 +41,10 @@ static int tuner = -1;
41module_param(tuner, int, 0444); 41module_param(tuner, int, 0444);
42MODULE_PARM_DESC(tuner, "tuner type"); 42MODULE_PARM_DESC(tuner, "tuner type");
43 43
44static int transfer_mode = 1;
45module_param(transfer_mode, int, 0444);
46MODULE_PARM_DESC(transfer_mode, "transfer mode (1-ISO or 0-BULK)");
47
44static unsigned int disable_ir; 48static unsigned int disable_ir;
45module_param(disable_ir, int, 0444); 49module_param(disable_ir, int, 0444);
46MODULE_PARM_DESC(disable_ir, "disable infrared remote support"); 50MODULE_PARM_DESC(disable_ir, "disable infrared remote support");
@@ -86,8 +90,8 @@ struct cx231xx_board cx231xx_boards[] = {
86 } 90 }
87 }, 91 },
88 }, 92 },
89 [CX231XX_BOARD_CNXT_RDE_250] = { 93 [CX231XX_BOARD_CNXT_CARRAERA] = {
90 .name = "Conexant Hybrid TV - RDE250", 94 .name = "Conexant Hybrid TV - CARRAERA",
91 .tuner_type = TUNER_XC5000, 95 .tuner_type = TUNER_XC5000,
92 .tuner_addr = 0x61, 96 .tuner_addr = 0x61,
93 .tuner_gpio = RDE250_XCV_TUNER, 97 .tuner_gpio = RDE250_XCV_TUNER,
@@ -125,9 +129,8 @@ struct cx231xx_board cx231xx_boards[] = {
125 } 129 }
126 }, 130 },
127 }, 131 },
128 132 [CX231XX_BOARD_CNXT_SHELBY] = {
129 [CX231XX_BOARD_CNXT_RDU_250] = { 133 .name = "Conexant Hybrid TV - SHELBY",
130 .name = "Conexant Hybrid TV - RDU250",
131 .tuner_type = TUNER_XC5000, 134 .tuner_type = TUNER_XC5000,
132 .tuner_addr = 0x61, 135 .tuner_addr = 0x61,
133 .tuner_gpio = RDE250_XCV_TUNER, 136 .tuner_gpio = RDE250_XCV_TUNER,
@@ -165,6 +168,183 @@ struct cx231xx_board cx231xx_boards[] = {
165 } 168 }
166 }, 169 },
167 }, 170 },
171 [CX231XX_BOARD_CNXT_RDE_253S] = {
172 .name = "Conexant Hybrid TV - RDE253S",
173 .tuner_type = TUNER_NXP_TDA18271,
174 .tuner_addr = 0x60,
175 .tuner_gpio = RDE250_XCV_TUNER,
176 .tuner_sif_gpio = 0x05,
177 .tuner_scl_gpio = 0x1a,
178 .tuner_sda_gpio = 0x1b,
179 .decoder = CX231XX_AVDECODER,
180 .demod_xfer_mode = 0,
181 .ctl_pin_status_mask = 0xFFFFFFC4,
182 .agc_analog_digital_select_gpio = 0x1c,
183 .gpio_pin_status_mask = 0x4001000,
184 .tuner_i2c_master = 1,
185 .demod_i2c_master = 2,
186 .has_dvb = 1,
187 .demod_addr = 0x02,
188 .norm = V4L2_STD_PAL,
189
190 .input = {{
191 .type = CX231XX_VMUX_TELEVISION,
192 .vmux = CX231XX_VIN_3_1,
193 .amux = CX231XX_AMUX_VIDEO,
194 .gpio = NULL,
195 }, {
196 .type = CX231XX_VMUX_COMPOSITE1,
197 .vmux = CX231XX_VIN_2_1,
198 .amux = CX231XX_AMUX_LINE_IN,
199 .gpio = NULL,
200 }, {
201 .type = CX231XX_VMUX_SVIDEO,
202 .vmux = CX231XX_VIN_1_1 |
203 (CX231XX_VIN_1_2 << 8) |
204 CX25840_SVIDEO_ON,
205 .amux = CX231XX_AMUX_LINE_IN,
206 .gpio = NULL,
207 }
208 },
209 },
210
211 [CX231XX_BOARD_CNXT_RDU_253S] = {
212 .name = "Conexant Hybrid TV - RDU253S",
213 .tuner_type = TUNER_NXP_TDA18271,
214 .tuner_addr = 0x60,
215 .tuner_gpio = RDE250_XCV_TUNER,
216 .tuner_sif_gpio = 0x05,
217 .tuner_scl_gpio = 0x1a,
218 .tuner_sda_gpio = 0x1b,
219 .decoder = CX231XX_AVDECODER,
220 .demod_xfer_mode = 0,
221 .ctl_pin_status_mask = 0xFFFFFFC4,
222 .agc_analog_digital_select_gpio = 0x1c,
223 .gpio_pin_status_mask = 0x4001000,
224 .tuner_i2c_master = 1,
225 .demod_i2c_master = 2,
226 .has_dvb = 1,
227 .demod_addr = 0x02,
228 .norm = V4L2_STD_PAL,
229
230 .input = {{
231 .type = CX231XX_VMUX_TELEVISION,
232 .vmux = CX231XX_VIN_3_1,
233 .amux = CX231XX_AMUX_VIDEO,
234 .gpio = NULL,
235 }, {
236 .type = CX231XX_VMUX_COMPOSITE1,
237 .vmux = CX231XX_VIN_2_1,
238 .amux = CX231XX_AMUX_LINE_IN,
239 .gpio = NULL,
240 }, {
241 .type = CX231XX_VMUX_SVIDEO,
242 .vmux = CX231XX_VIN_1_1 |
243 (CX231XX_VIN_1_2 << 8) |
244 CX25840_SVIDEO_ON,
245 .amux = CX231XX_AMUX_LINE_IN,
246 .gpio = NULL,
247 }
248 },
249 },
250 [CX231XX_BOARD_CNXT_VIDEO_GRABBER] = {
251 .name = "Conexant VIDEO GRABBER",
252 .tuner_type = TUNER_NXP_TDA18271,
253 .tuner_addr = 0x60,
254 .tuner_gpio = RDE250_XCV_TUNER,
255 .tuner_sif_gpio = 0x05,
256 .tuner_scl_gpio = 0x1a,
257 .tuner_sda_gpio = 0x1b,
258 .decoder = CX231XX_AVDECODER,
259 .demod_xfer_mode = 0,
260 .ctl_pin_status_mask = 0xFFFFFFC4,
261 .agc_analog_digital_select_gpio = 0x1c,
262 .gpio_pin_status_mask = 0x4001000,
263 .tuner_i2c_master = 1,
264 .demod_i2c_master = 2,
265 .has_dvb = 0,
266 .demod_addr = 0x02,
267 .norm = V4L2_STD_PAL,
268
269 .input = {{
270 .type = CX231XX_VMUX_COMPOSITE1,
271 .vmux = CX231XX_VIN_2_1,
272 .amux = CX231XX_AMUX_LINE_IN,
273 .gpio = NULL,
274 }, {
275 .type = CX231XX_VMUX_SVIDEO,
276 .vmux = CX231XX_VIN_1_1 |
277 (CX231XX_VIN_1_2 << 8) |
278 CX25840_SVIDEO_ON,
279 .amux = CX231XX_AMUX_LINE_IN,
280 .gpio = NULL,
281 }, {
282 .type = CX231XX_VMUX_TELEVISION,
283 .vmux = CX231XX_VIN_3_1,
284 .amux = CX231XX_AMUX_VIDEO,
285 .gpio = NULL,
286 }
287 },
288 },
289 [CX231XX_BOARD_CNXT_RDE_250] = {
290 .name = "Conexant Hybrid TV - rde 250",
291 .tuner_type = TUNER_XC5000,
292 .tuner_addr = 0x61,
293 .tuner_gpio = RDE250_XCV_TUNER,
294 .tuner_sif_gpio = 0x05,
295 .tuner_scl_gpio = 0x1a,
296 .tuner_sda_gpio = 0x1b,
297 .decoder = CX231XX_AVDECODER,
298 .demod_xfer_mode = 0,
299 .ctl_pin_status_mask = 0xFFFFFFC4,
300 .agc_analog_digital_select_gpio = 0x0c,
301 .gpio_pin_status_mask = 0x4001000,
302 .tuner_i2c_master = 1,
303 .demod_i2c_master = 2,
304 .has_dvb = 1,
305 .demod_addr = 0x02,
306 .norm = V4L2_STD_PAL,
307
308 .input = {{
309 .type = CX231XX_VMUX_TELEVISION,
310 .vmux = CX231XX_VIN_2_1,
311 .amux = CX231XX_AMUX_VIDEO,
312 .gpio = NULL,
313 }
314 },
315 },
316 [CX231XX_BOARD_CNXT_RDU_250] = {
317 .name = "Conexant Hybrid TV - RDU 250",
318 .tuner_type = TUNER_XC5000,
319 .tuner_addr = 0x61,
320 .tuner_gpio = RDE250_XCV_TUNER,
321 .tuner_sif_gpio = 0x05,
322 .tuner_scl_gpio = 0x1a,
323 .tuner_sda_gpio = 0x1b,
324 .decoder = CX231XX_AVDECODER,
325 .demod_xfer_mode = 0,
326 .ctl_pin_status_mask = 0xFFFFFFC4,
327 .agc_analog_digital_select_gpio = 0x0c,
328 .gpio_pin_status_mask = 0x4001000,
329 .tuner_i2c_master = 1,
330 .demod_i2c_master = 2,
331 .has_dvb = 1,
332 .demod_addr = 0x32,
333 .norm = V4L2_STD_NTSC,
334
335 .input = {{
336 .type = CX231XX_VMUX_TELEVISION,
337 .vmux = CX231XX_VIN_2_1,
338 .amux = CX231XX_AMUX_VIDEO,
339 .gpio = NULL,
340 }
341 },
342 },
343
344
345
346
347
168}; 348};
169const unsigned int cx231xx_bcount = ARRAY_SIZE(cx231xx_boards); 349const unsigned int cx231xx_bcount = ARRAY_SIZE(cx231xx_boards);
170 350
@@ -173,8 +353,18 @@ struct usb_device_id cx231xx_id_table[] = {
173 {USB_DEVICE(0x0572, 0x5A3C), 353 {USB_DEVICE(0x0572, 0x5A3C),
174 .driver_info = CX231XX_BOARD_UNKNOWN}, 354 .driver_info = CX231XX_BOARD_UNKNOWN},
175 {USB_DEVICE(0x0572, 0x58A2), 355 {USB_DEVICE(0x0572, 0x58A2),
176 .driver_info = CX231XX_BOARD_CNXT_RDE_250}, 356 .driver_info = CX231XX_BOARD_CNXT_CARRAERA},
177 {USB_DEVICE(0x0572, 0x58A1), 357 {USB_DEVICE(0x0572, 0x58A1),
358 .driver_info = CX231XX_BOARD_CNXT_SHELBY},
359 {USB_DEVICE(0x0572, 0x58A4),
360 .driver_info = CX231XX_BOARD_CNXT_RDE_253S},
361 {USB_DEVICE(0x0572, 0x58A5),
362 .driver_info = CX231XX_BOARD_CNXT_RDU_253S},
363 {USB_DEVICE(0x0572, 0x58A6),
364 .driver_info = CX231XX_BOARD_CNXT_VIDEO_GRABBER},
365 {USB_DEVICE(0x0572, 0x589E),
366 .driver_info = CX231XX_BOARD_CNXT_RDE_250},
367 {USB_DEVICE(0x0572, 0x58A0),
178 .driver_info = CX231XX_BOARD_CNXT_RDU_250}, 368 .driver_info = CX231XX_BOARD_CNXT_RDU_250},
179 {USB_DEVICE_VER(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD, 0x4000,0x4fff), 369 {USB_DEVICE_VER(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD, 0x4000,0x4fff),
180 .driver_info = CX231XX_BOARD_UNKNOWN}, 370 .driver_info = CX231XX_BOARD_UNKNOWN},
@@ -212,6 +402,23 @@ int cx231xx_tuner_callback(void *ptr, int component, int command, int arg)
212} 402}
213EXPORT_SYMBOL_GPL(cx231xx_tuner_callback); 403EXPORT_SYMBOL_GPL(cx231xx_tuner_callback);
214 404
405void cx231xx_reset_out(struct cx231xx *dev)
406{
407 cx231xx_set_gpio_value(dev, CX23417_RESET, 1);
408 msleep(200);
409 cx231xx_set_gpio_value(dev, CX23417_RESET, 0);
410 msleep(200);
411 cx231xx_set_gpio_value(dev, CX23417_RESET, 1);
412}
413void cx231xx_enable_OSC(struct cx231xx *dev)
414{
415 cx231xx_set_gpio_value(dev, CX23417_OSC_EN, 1);
416}
417void cx231xx_sleep_s5h1432(struct cx231xx *dev)
418{
419 cx231xx_set_gpio_value(dev, SLEEP_S5H1432, 0);
420}
421
215static inline void cx231xx_set_model(struct cx231xx *dev) 422static inline void cx231xx_set_model(struct cx231xx *dev)
216{ 423{
217 memcpy(&dev->board, &cx231xx_boards[dev->model], sizeof(dev->board)); 424 memcpy(&dev->board, &cx231xx_boards[dev->model], sizeof(dev->board));
@@ -235,9 +442,6 @@ void cx231xx_pre_card_setup(struct cx231xx *dev)
235 cx231xx_set_gpio_direction(dev, dev->board.tuner_sif_gpio, 1); 442 cx231xx_set_gpio_direction(dev, dev->board.tuner_sif_gpio, 1);
236 443
237 /* request some modules if any required */ 444 /* request some modules if any required */
238
239 /* reset the Tuner */
240 cx231xx_gpio_set(dev, dev->board.tuner_gpio);
241 } 445 }
242 446
243 /* set the mode to Analog mode initially */ 447 /* set the mode to Analog mode initially */
@@ -297,10 +501,20 @@ void cx231xx_register_i2c_ir(struct cx231xx *dev)
297 /* detect & configure */ 501 /* detect & configure */
298 switch (dev->model) { 502 switch (dev->model) {
299 503
504 case CX231XX_BOARD_CNXT_CARRAERA:
505 break;
300 case CX231XX_BOARD_CNXT_RDE_250: 506 case CX231XX_BOARD_CNXT_RDE_250:
301 break; 507 break;
508 case CX231XX_BOARD_CNXT_SHELBY:
509 break;
302 case CX231XX_BOARD_CNXT_RDU_250: 510 case CX231XX_BOARD_CNXT_RDU_250:
303 break; 511 break;
512 case CX231XX_BOARD_CNXT_RDE_253S:
513 break;
514 case CX231XX_BOARD_CNXT_RDU_253S:
515 break;
516 case CX231XX_BOARD_CNXT_VIDEO_GRABBER:
517 break;
304 default: 518 default:
305 break; 519 break;
306 } 520 }
@@ -326,14 +540,38 @@ void cx231xx_card_setup(struct cx231xx *dev)
326 540
327 } 541 }
328 542
329 if (dev->board.tuner_type != TUNER_ABSENT) { 543 switch (dev->model) {
330 dev->sd_tuner = v4l2_i2c_new_subdev(&dev->v4l2_dev, 544 case CX231XX_BOARD_CNXT_CARRAERA:
331 &dev->i2c_bus[1].i2c_adap, 545 case CX231XX_BOARD_CNXT_RDE_250:
332 "tuner", "tuner", 0xc2 >> 1, NULL); 546 case CX231XX_BOARD_CNXT_SHELBY:
333 if (dev->sd_tuner == NULL) 547 case CX231XX_BOARD_CNXT_RDU_250:
334 cx231xx_info("tuner subdev registration failure\n"); 548 if (dev->board.tuner_type != TUNER_ABSENT) {
335 549 dev->sd_tuner = v4l2_i2c_new_subdev(&dev->v4l2_dev,
336 cx231xx_config_tuner(dev); 550 &dev->i2c_bus[1].i2c_adap,
551 "tuner", "tuner", 0xc2 >> 1, NULL);
552 if (dev->sd_tuner == NULL)
553 cx231xx_info(
554 "tuner subdev registration failure\n");
555
556 cx231xx_config_tuner(dev);
557 }
558 break;
559 case CX231XX_BOARD_CNXT_RDE_253S:
560 case CX231XX_BOARD_CNXT_RDU_253S:
561 case CX231XX_BOARD_CNXT_VIDEO_GRABBER:
562 if (dev->board.tuner_type != TUNER_ABSENT) {
563 dev->sd_tuner = v4l2_i2c_new_subdev(&dev->v4l2_dev,
564 &dev->i2c_bus[1].i2c_adap,
565 "tuner", "tuner", 0xc0 >> 1, NULL);
566 if (dev->sd_tuner == NULL)
567 cx231xx_info(
568 "tuner subdev registration failure\n");
569
570 cx231xx_config_tuner(dev);
571 }
572 break;
573 default:
574 break;
337 } 575 }
338 576
339 cx231xx_config_tuner(dev); 577 cx231xx_config_tuner(dev);
@@ -409,6 +647,7 @@ static int cx231xx_init_dev(struct cx231xx **devhandle, struct usb_device *udev,
409 mutex_init(&dev->lock); 647 mutex_init(&dev->lock);
410 mutex_init(&dev->ctrl_urb_lock); 648 mutex_init(&dev->ctrl_urb_lock);
411 mutex_init(&dev->gpio_i2c_lock); 649 mutex_init(&dev->gpio_i2c_lock);
650 mutex_init(&dev->i2c_lock);
412 651
413 spin_lock_init(&dev->video_mode.slock); 652 spin_lock_init(&dev->video_mode.slock);
414 spin_lock_init(&dev->vbi_mode.slock); 653 spin_lock_init(&dev->vbi_mode.slock);
@@ -427,6 +666,12 @@ static int cx231xx_init_dev(struct cx231xx **devhandle, struct usb_device *udev,
427 /* Query cx231xx to find what pcb config it is related to */ 666 /* Query cx231xx to find what pcb config it is related to */
428 initialize_cx231xx(dev); 667 initialize_cx231xx(dev);
429 668
669 /*To workaround error number=-71 on EP0 for VideoGrabber,
670 need set alt here.*/
671 if (dev->model == CX231XX_BOARD_CNXT_VIDEO_GRABBER) {
672 cx231xx_set_alt_setting(dev, INDEX_VIDEO, 3);
673 cx231xx_set_alt_setting(dev, INDEX_VANC, 1);
674 }
430 /* Cx231xx pre card setup */ 675 /* Cx231xx pre card setup */
431 cx231xx_pre_card_setup(dev); 676 cx231xx_pre_card_setup(dev);
432 677
@@ -442,6 +687,7 @@ static int cx231xx_init_dev(struct cx231xx **devhandle, struct usb_device *udev,
442 /* register i2c bus */ 687 /* register i2c bus */
443 errCode = cx231xx_dev_init(dev); 688 errCode = cx231xx_dev_init(dev);
444 if (errCode < 0) { 689 if (errCode < 0) {
690 cx231xx_dev_uninit(dev);
445 cx231xx_errdev("%s: cx231xx_i2c_register - errCode [%d]!\n", 691 cx231xx_errdev("%s: cx231xx_i2c_register - errCode [%d]!\n",
446 __func__, errCode); 692 __func__, errCode);
447 return errCode; 693 return errCode;
@@ -480,9 +726,17 @@ static int cx231xx_init_dev(struct cx231xx **devhandle, struct usb_device *udev,
480 INIT_LIST_HEAD(&dev->vbi_mode.vidq.queued); 726 INIT_LIST_HEAD(&dev->vbi_mode.vidq.queued);
481 727
482 /* Reset other chips required if they are tied up with GPIO pins */ 728 /* Reset other chips required if they are tied up with GPIO pins */
483
484 cx231xx_add_into_devlist(dev); 729 cx231xx_add_into_devlist(dev);
485 730
731 printk(KERN_INFO "attach 417 %d\n", dev->model);
732 if (dev->model == CX231XX_BOARD_CNXT_VIDEO_GRABBER) {
733 if (cx231xx_417_register(dev) < 0) {
734 printk(KERN_ERR
735 "%s() Failed to register 417 on VID_B\n",
736 __func__);
737 }
738 }
739
486 retval = cx231xx_register_analog_devices(dev); 740 retval = cx231xx_register_analog_devices(dev);
487 if (retval < 0) { 741 if (retval < 0) {
488 cx231xx_release_resources(dev); 742 cx231xx_release_resources(dev);
@@ -552,8 +806,8 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
552 cx231xx_devused |= 1 << nr; 806 cx231xx_devused |= 1 << nr;
553 807
554 if (nr >= CX231XX_MAXBOARDS) { 808 if (nr >= CX231XX_MAXBOARDS) {
555 cx231xx_err(DRIVER_NAME ": Supports only %i cx231xx boards.\n", 809 cx231xx_err(DRIVER_NAME
556 CX231XX_MAXBOARDS); 810 ": Supports only %i cx231xx boards.\n", CX231XX_MAXBOARDS);
557 cx231xx_devused &= ~(1 << nr); 811 cx231xx_devused &= ~(1 << nr);
558 return -ENOMEM; 812 return -ENOMEM;
559 } 813 }
@@ -578,6 +832,7 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
578 dev->xc_fw_load_done = 0; 832 dev->xc_fw_load_done = 0;
579 dev->has_alsa_audio = 1; 833 dev->has_alsa_audio = 1;
580 dev->power_mode = -1; 834 dev->power_mode = -1;
835 atomic_set(&dev->devlist_count, 0);
581 836
582 /* 0 - vbi ; 1 -sliced cc mode */ 837 /* 0 - vbi ; 1 -sliced cc mode */
583 dev->vbi_or_sliced_cc_mode = 0; 838 dev->vbi_or_sliced_cc_mode = 0;
@@ -591,6 +846,11 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
591 /* store the current interface */ 846 /* store the current interface */
592 lif = interface; 847 lif = interface;
593 848
849 /*mode_tv: digital=1 or analog=0*/
850 dev->mode_tv = 0;
851
852 dev->USE_ISO = transfer_mode;
853
594 switch (udev->speed) { 854 switch (udev->speed) {
595 case USB_SPEED_LOW: 855 case USB_SPEED_LOW:
596 speed = "1.5"; 856 speed = "1.5";
@@ -645,7 +905,7 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
645 * set skip interface, for all interfaces but 905 * set skip interface, for all interfaces but
646 * interface 1 and the last one 906 * interface 1 and the last one
647 */ 907 */
648 if ((ifnum != 1) && ((dev->interface_count - 1) 908 if ((ifnum != 1) && ((ifnum)
649 != dev->max_iad_interface_count)) 909 != dev->max_iad_interface_count))
650 skip_interface = 1; 910 skip_interface = 1;
651 911
@@ -667,7 +927,7 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
667 /* save our data pointer in this interface device */ 927 /* save our data pointer in this interface device */
668 usb_set_intfdata(lif, dev); 928 usb_set_intfdata(lif, dev);
669 929
670 if ((dev->interface_count - 1) != dev->max_iad_interface_count) 930 if ((ifnum) != dev->max_iad_interface_count)
671 return 0; 931 return 0;
672 932
673 /* 933 /*
@@ -680,15 +940,18 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
680 cx231xx_errdev("v4l2_device_register failed\n"); 940 cx231xx_errdev("v4l2_device_register failed\n");
681 cx231xx_devused &= ~(1 << nr); 941 cx231xx_devused &= ~(1 << nr);
682 kfree(dev); 942 kfree(dev);
943 dev = NULL;
683 return -EIO; 944 return -EIO;
684 } 945 }
685
686 /* allocate device struct */ 946 /* allocate device struct */
687 retval = cx231xx_init_dev(&dev, udev, nr); 947 retval = cx231xx_init_dev(&dev, udev, nr);
688 if (retval) { 948 if (retval) {
689 cx231xx_devused &= ~(1 << dev->devno); 949 cx231xx_devused &= ~(1 << dev->devno);
690 v4l2_device_unregister(&dev->v4l2_dev); 950 v4l2_device_unregister(&dev->v4l2_dev);
691 kfree(dev); 951 kfree(dev);
952 dev = NULL;
953 usb_set_intfdata(lif, NULL);
954
692 return retval; 955 return retval;
693 } 956 }
694 957
@@ -711,6 +974,7 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
711 cx231xx_devused &= ~(1 << nr); 974 cx231xx_devused &= ~(1 << nr);
712 v4l2_device_unregister(&dev->v4l2_dev); 975 v4l2_device_unregister(&dev->v4l2_dev);
713 kfree(dev); 976 kfree(dev);
977 dev = NULL;
714 return -ENOMEM; 978 return -ENOMEM;
715 } 979 }
716 980
@@ -744,6 +1008,7 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
744 cx231xx_devused &= ~(1 << nr); 1008 cx231xx_devused &= ~(1 << nr);
745 v4l2_device_unregister(&dev->v4l2_dev); 1009 v4l2_device_unregister(&dev->v4l2_dev);
746 kfree(dev); 1010 kfree(dev);
1011 dev = NULL;
747 return -ENOMEM; 1012 return -ENOMEM;
748 } 1013 }
749 1014
@@ -778,6 +1043,7 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
778 cx231xx_devused &= ~(1 << nr); 1043 cx231xx_devused &= ~(1 << nr);
779 v4l2_device_unregister(&dev->v4l2_dev); 1044 v4l2_device_unregister(&dev->v4l2_dev);
780 kfree(dev); 1045 kfree(dev);
1046 dev = NULL;
781 return -ENOMEM; 1047 return -ENOMEM;
782 } 1048 }
783 1049
@@ -813,6 +1079,7 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
813 cx231xx_devused &= ~(1 << nr); 1079 cx231xx_devused &= ~(1 << nr);
814 v4l2_device_unregister(&dev->v4l2_dev); 1080 v4l2_device_unregister(&dev->v4l2_dev);
815 kfree(dev); 1081 kfree(dev);
1082 dev = NULL;
816 return -ENOMEM; 1083 return -ENOMEM;
817 } 1084 }
818 1085
@@ -827,6 +1094,15 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
827 } 1094 }
828 } 1095 }
829 1096
1097 if (dev->model == CX231XX_BOARD_CNXT_VIDEO_GRABBER) {
1098 cx231xx_enable_OSC(dev);
1099 cx231xx_reset_out(dev);
1100 cx231xx_set_alt_setting(dev, INDEX_VIDEO, 3);
1101 }
1102
1103 if (dev->model == CX231XX_BOARD_CNXT_RDE_253S)
1104 cx231xx_sleep_s5h1432(dev);
1105
830 /* load other modules required */ 1106 /* load other modules required */
831 request_modules(dev); 1107 request_modules(dev);
832 1108
@@ -867,7 +1143,10 @@ static void cx231xx_usb_disconnect(struct usb_interface *interface)
867 video_device_node_name(dev->vdev)); 1143 video_device_node_name(dev->vdev));
868 1144
869 dev->state |= DEV_MISCONFIGURED; 1145 dev->state |= DEV_MISCONFIGURED;
870 cx231xx_uninit_isoc(dev); 1146 if (dev->USE_ISO)
1147 cx231xx_uninit_isoc(dev);
1148 else
1149 cx231xx_uninit_bulk(dev);
871 dev->state |= DEV_DISCONNECTED; 1150 dev->state |= DEV_DISCONNECTED;
872 wake_up_interruptible(&dev->wait_frame); 1151 wake_up_interruptible(&dev->wait_frame);
873 wake_up_interruptible(&dev->wait_stream); 1152 wake_up_interruptible(&dev->wait_stream);
@@ -886,6 +1165,7 @@ static void cx231xx_usb_disconnect(struct usb_interface *interface)
886 kfree(dev->sliced_cc_mode.alt_max_pkt_size); 1165 kfree(dev->sliced_cc_mode.alt_max_pkt_size);
887 kfree(dev->ts1_mode.alt_max_pkt_size); 1166 kfree(dev->ts1_mode.alt_max_pkt_size);
888 kfree(dev); 1167 kfree(dev);
1168 dev = NULL;
889 } 1169 }
890} 1170}
891 1171