Lines Matching +full:sdtv +full:- +full:standards

1 // SPDX-License-Identifier: GPL-2.0+
3 // em28xx-cards.c - driver for Empia EM2800/EM2820/2840 USB
21 #include <media/drv-intf/msp3400.h>
23 #include <dt-bindings/media/tvp5150.h>
26 #include <media/v4l2-common.h>
31 static int tuner = -1;
44 static unsigned int card[] = {[0 ... (EM28XX_MAXBOARDS - 1)] = -1U };
48 static int usb_xfer_mode = -1;
51 "USB transfer mode for frame data (-1 = auto, 0 = prefer isoc, 1 = prefer bulk)");
53 /* Bitmask marking allocated devices from 0 to EM28XX_MAXBOARDS - 1 */
71 { -1, -1, -1, -1},
77 { -1, -1, -1, -1},
84 { -1, -1, -1, -1},
92 { -1, -1, -1, -1},
99 { -1, -1, -1, -1},
107 { -1, -1, -1, -1},
114 { -1, -1, -1, -1},
117 /* Boards - EM2880 MSI DIGIVOX AD and EM2880_BOARD_MSI_DIGIVOX_AD_II */
120 { -1, -1, -1, -1},
123 /* Board - EM2882 Kworld 315U digital */
130 { -1, -1, -1, -1},
138 { -1, -1, -1, -1},
144 { -1, -1, -1, -1},
150 { -1, -1, -1, -1},
155 * GPIO0 - Enable digital power (s5h1409) - low to enable
156 * GPIO1 - Enable analog power (tvp5150/emp202) - low to enable
157 * GPIO4 - xc3028 reset
158 * GOP3 - s5h1409 reset
162 { -1, -1, -1, -1},
169 { -1, -1, -1, -1},
173 * KWorld PlusTV 340U, UB435-Q and UB435-Q V2 (ATSC) GPIOs map:
174 * EM_GPIO_0 - currently unknown
175 * EM_GPIO_1 - LED disable/enable (1 = off, 0 = on)
176 * EM_GPIO_2 - currently unknown
177 * EM_GPIO_3 - currently unknown
178 * EM_GPIO_4 - TDA18271HD/C1 tuner (1 = active, 0 = in reset)
179 * EM_GPIO_5 - LGDT3304 ATSC/QAM demod (1 = active, 0 = in reset)
180 * EM_GPIO_6 - currently unknown
181 * EM_GPIO_7 - currently unknown
185 { -1, -1, -1, -1},
193 { -1, -1, -1, -1},
199 { -1, -1, -1, -1},
206 { -1, -1, -1, -1},
212 { -1, -1, -1, -1},
218 { -1, -1, -1, -1},
223 * 0-5: not used
231 { -1, -1, -1, -1},
235 * eb1a:2868 Reddo DVB-C USB TV Box
236 * GPIO4 - CU1216L NIM
247 { -1, -1, -1, -1},
255 { -1, -1, -1, -1},
261 { -1, -1, -1, -1},
266 { -1, -1, -1, -1},
271 { -1, -1, -1, -1},
277 { -1, -1, -1, -1},
282 { -1, -1, -1, -1},
288 { -1, -1, -1, -1},
295 { -1, -1, -1, -1},
301 { -1, -1, -1, -1},
307 { -1, -1, -1, -1},
314 { -1, -1, -1, -1},
319 * GPIO_6 - demod reset
320 * GPIO_7 - LED
326 { -1, -1, -1, -1},
335 { -1, -1, -1, -1},
342 { -1, -1, -1, -1},
347 * 2013:024f PCTV DVB-S2 Stick 460e
348 * GPIO_0 - POWER_ON
349 * GPIO_1 - BOOST
350 * GPIO_2 - VUV_LNB (red LED)
351 * GPIO_3 - EXT_12V
352 * GPIO_4 - INT_DEM (DEMOD GPIO_0)
353 * GPIO_5 - INT_LNB
354 * GPIO_6 - RESET_DEM
355 * GPIO_7 - LED (green LED)
363 { -1, -1, -1, -1},
375 { -1, -1, -1, -1},
379 * 2013:0258 PCTV DVB-S2 Stick (461e)
397 { -1, -1, -1, -1},
406 { -1, -1, -1, -1},
413 { -1, -1, -1, -1},
418 * 1b80:e425 MaxMedia UB425-TC
420 * GPIO_6 - demod reset, 0=active
421 * GPIO_7 - LED, 0=active
427 { -1, -1, -1, -1},
441 { -1, -1, -1, -1},
456 { -1, -1, -1, -1},
472 { -1, -1, -1, -1},
484 {-1, -1, -1, -1},
498 {-1, -1, -1, -1},
512 {-1, -1, -1, -1},
516 * 2040:0265 Hauppauge WinTV-dualHD DVB Isoc
517 * 2040:8265 Hauppauge WinTV-dualHD DVB Bulk
518 * 2040:026d Hauppauge WinTV-dualHD ATSC/QAM Isoc
519 * 2040:826d Hauppauge WinTV-dualHD ATSC/QAM Bulk
539 {-1, -1, -1, -1},
554 {-1, -1, -1, -1},
563 * GPIO_2-6: Unused
568 { -1, -1, -1, -1},
573 { -1, -1, -1, -1},
578 { -1, -1, -1, -1},
592 {-1, 0, 0, 0, 0},
608 {-1, 0, 0, 0, 0},
627 {-1, 0, 0, 0},
637 {-1, 0, 0, 0},
647 {-1, 0, 0, 0},
657 {-1, 0, 0, 0},
673 {-1, 0, 0, 0},
689 {-1, 0, 0, 0},
741 .name = "Huaqi DLCW-130",
847 .name = "D-Link DUB-T210 TV Tuner",
1158 .name = "Plextor ConvertX PX-TV100U",
1201 .name = "Kworld 350 U DVB-T",
1207 .name = "Kworld 355 U DVB-T",
1215 .name = "Pinnacle PCTV DVB-T",
1218 /* djh - I have serious doubts this is right... */
1301 .name = "C3 Tech Digital Duo HDTV/SDTV USB",
1303 /* FIXME: Add analog support - need a saa7136 driver */
1304 .tuner_type = TUNER_ABSENT, /* Digital-only TDA18271HD */
1600 .tuner_type = TUNER_ABSENT, /* Capture-only board */
1655 …90/100/101/107 / Kaiser Baas Video to DVD maker / Kworld DVD Maker 2 / Plextor ConvertX PX-AV100U",
1669 .name = "V-Gear PocketTV",
1710 .name = "SIIG AVTuner-PVR / Pixelview Prolink PlayTV USB 2.0",
1805 .name = "KWorld DVB-T 305U",
1824 .name = "KWorld DVB-T 310U",
1841 }, { /* S-video has not been tested yet */
1861 /* FIXME: Analog mode - still not ready */
1982 .name = "Kworld VS-DVB-T 323UR",
2127 .name = "Easy Cap Capture DC-60",
2142 .name = "IO-DATA GV-MVP/SZ",
2155 }, { /* S-video has not been tested yet */
2247 .name = "Reddo DVB-C USB TV Box",
2253 * 1b80:a340 - Empia EM2870, NXP TDA18271HD and LG DT3304, sold
2254 * initially as the KWorld PlusTV 340U, then as the UB435-Q.
2258 .name = "KWorld PlusTV 340U or UB435-Q (ATSC)",
2259 .tuner_type = TUNER_ABSENT, /* Digital-only TDA18271HD */
2279 * 2013:024f PCTV DVB-S2 Stick 460e
2286 .name = "PCTV DVB-S2 Stick (460e)",
2306 .vmux = SAA7115_SVIDEO3, /* S-VIDEO needs check */
2311 * 1b80:e425 MaxMedia UB425-TC
2315 .name = "MaxMedia UB425-TC",
2364 * mostly the same as MaxMedia UB-425-TC but different remote
2377 * 1b80:e346 KWorld USB ATSC TV Stick UB435-Q V2
2381 .name = "KWorld USB ATSC TV Stick UB435-Q V2",
2389 * 1b80:e34c KWorld USB ATSC TV Stick UB435-Q V3
2393 .name = "KWorld USB ATSC TV Stick UB435-Q V3",
2432 * 2013:0258 PCTV DVB-S2 Stick (461e)
2439 .name = "PCTV DVB-S2 Stick (461e)",
2446 * 2013:0259 PCTV DVB-S2 Stick (461e_v2)
2453 .name = "PCTV DVB-S2 Stick (461e v2)",
2503 * 3275:0085 PLEX PX-BCUD.
2507 .name = "PLEX PX-BCUD",
2516 * 2040:0265 Hauppauge WinTV-dualHD (DVB version) Isoc.
2517 * 2040:8265 Hauppauge WinTV-dualHD (DVB version) Bulk.
2521 .name = "Hauppauge WinTV-dualHD DVB",
2538 * 2040:026d Hauppauge WinTV-dualHD (model 01595 - ATSC/QAM) Isoc.
2539 * 2040:826d Hauppauge WinTV-dualHD (model 01595 - ATSC/QAM) Bulk.
2543 .name = "Hauppauge WinTV-dualHD 01595 ATSC/QAM",
2555 * 1b80:e349 Magix USB Videowandler-2
2560 .name = "Magix USB Videowandler-2",
2608 * Tena TNF931D-DFDR1 tuner (contains NXP TDA6509A),
2748 { USB_DEVICE(0x2040, 0x6513), /* HCW HVR-980 */
2750 { USB_DEVICE(0x2040, 0x6517), /* HP HVR-950 */
2752 { USB_DEVICE(0x2040, 0x651b), /* RP HVR-950 */
2836 { USB_DEVICE(0x2013, 0x0264), /* Hauppauge WinTV-soloHD 292e SE */
2838 { USB_DEVICE(0x2040, 0x0264), /* Hauppauge WinTV-soloHD Isoc */
2840 { USB_DEVICE(0x2040, 0x8264), /* Hauppauge OEM Generic WinTV-soloHD Bulk */
2842 { USB_DEVICE(0x2040, 0x8268), /* Hauppauge Retail WinTV-soloHD Bulk */
2850 { USB_DEVICE(0xeb1a, 0x5051), /* Ion Video 2 PC MKII / Startech svid2usb23 / Raygo R12-41373 */
2852 { USB_DEVICE(0x1b80, 0xe349), /* Magix USB Videowandler-2 */
2862 /* P/N: SA 60002070465 Tuner: TVF7533-MF */
2893 struct em28xx *dev = i2c_bus->dev; in em28xx_tuner_callback()
2896 if (dev->tuner_type != TUNER_XC2028 && dev->tuner_type != TUNER_XC5000) in em28xx_tuner_callback()
2902 rc = em28xx_gpio_set(dev, dev->board.tuner_gpio); in em28xx_tuner_callback()
2910 const struct em28xx_board *board = &em28xx_boards[dev->model]; in em28xx_set_xclk_i2c_speed()
2911 u8 xclk = board->xclk, i2c_speed = board->i2c_speed; in em28xx_set_xclk_i2c_speed()
2927 dev->i2c_speed = i2c_speed & 0x03; in em28xx_set_xclk_i2c_speed()
2929 if (!dev->board.is_em2800) in em28xx_set_xclk_i2c_speed()
2936 dev->board = em28xx_boards[dev->model]; in em28xx_set_model()
2937 dev->has_msp34xx = dev->board.has_msp34xx; in em28xx_set_model()
2938 dev->is_webcam = dev->board.is_webcam; in em28xx_set_model()
2943 dev->def_i2c_bus = dev->board.def_i2c_bus; in em28xx_set_model()
2973 dev_warn(&dev->intf->dev, "AC97 registers access is not reliable !\n"); in em28xx_wait_until_ac97_features_equals()
2974 return -ETIMEDOUT; in em28xx_wait_until_ac97_features_equals()
2978 * Since em28xx_pre_card_setup() requires a proper dev->model,
2990 switch (dev->model) { in em28xx_pre_card_setup()
2993 dev->i2s_speed = 2048000; in em28xx_pre_card_setup()
3022 * this device needs some gpio writes to get the DVB-T in em28xx_pre_card_setup()
3035 * DVB-T demod work in em28xx_pre_card_setup()
3098 em28xx_gpio_set(dev, dev->board.tuner_gpio); in em28xx_pre_card_setup()
3109 if (dev->is_webcam) { in em28xx_hint_board()
3110 if (dev->em28xx_sensor == EM28XX_MT9V011) { in em28xx_hint_board()
3111 dev->model = EM2820_BOARD_SILVERCREST_WEBCAM; in em28xx_hint_board()
3112 } else if (dev->em28xx_sensor == EM28XX_MT9M001 || in em28xx_hint_board()
3113 dev->em28xx_sensor == EM28XX_MT9M111) { in em28xx_hint_board()
3114 dev->model = EM2750_BOARD_UNKNOWN; in em28xx_hint_board()
3128 * video standards produce different hashes. in em28xx_hint_board()
3131 if (dev->hash == em28xx_eeprom_hash[i].hash) { in em28xx_hint_board()
3132 dev->model = em28xx_eeprom_hash[i].model; in em28xx_hint_board()
3133 dev->tuner_type = em28xx_eeprom_hash[i].tuner; in em28xx_hint_board()
3135 dev_err(&dev->intf->dev, in em28xx_hint_board()
3140 "\tV4L Mailing List <linux-media@vger.kernel.org>\n" in em28xx_hint_board()
3142 em28xx_boards[dev->model].name); in em28xx_hint_board()
3159 if (!dev->i2c_hash) in em28xx_hint_board()
3160 em28xx_do_i2c_scan(dev, dev->def_i2c_bus); in em28xx_hint_board()
3163 if (dev->i2c_hash == em28xx_i2c_hash[i].hash) { in em28xx_hint_board()
3164 dev->model = em28xx_i2c_hash[i].model; in em28xx_hint_board()
3165 dev->tuner_type = em28xx_i2c_hash[i].tuner; in em28xx_hint_board()
3166 dev_err(&dev->intf->dev, in em28xx_hint_board()
3171 "\tV4L Mailing List <linux-media@vger.kernel.org>\n" in em28xx_hint_board()
3173 em28xx_boards[dev->model].name); in em28xx_hint_board()
3179 dev_err(&dev->intf->dev, in em28xx_hint_board()
3183 "\tV4L Mailing List <linux-media@vger.kernel.org>\n" in em28xx_hint_board()
3186 dev->hash, dev->i2c_hash); in em28xx_hint_board()
3188 dev_err(&dev->intf->dev, in em28xx_hint_board()
3191 dev_err(&dev->intf->dev, in em28xx_hint_board()
3192 " card=%d -> %s\n", i, em28xx_boards[i].name); in em28xx_hint_board()
3194 return -1; in em28xx_hint_board()
3206 if (dev->is_webcam) { in em28xx_card_setup()
3208 if (dev->em28xx_sensor == EM28XX_NOSENSOR) in em28xx_card_setup()
3210 dev->is_webcam = 0; in em28xx_card_setup()
3213 switch (dev->model) { in em28xx_card_setup()
3218 * The K-WORLD DVB-T 310U is detected as an MSI Digivox AD. in em28xx_card_setup()
3223 * What we do here is look up the EEPROM hash of the K-WORLD in em28xx_card_setup()
3225 * a DIGIVOX and reset the device to the K-WORLD instead. in em28xx_card_setup()
3231 dev_err(&dev->intf->dev, "Board not discovered\n"); in em28xx_card_setup()
3241 dev_info(&dev->intf->dev, "Identified as %s (card=%d)\n", in em28xx_card_setup()
3242 dev->board.name, dev->model); in em28xx_card_setup()
3244 dev->tuner_type = em28xx_boards[dev->model].tuner_type; in em28xx_card_setup()
3247 switch (dev->model) { in em28xx_card_setup()
3259 if (!dev->eedata) in em28xx_card_setup()
3266 tveeprom_hauppauge_analog(&tv, dev->eedata); in em28xx_card_setup()
3268 dev->tuner_type = tv.tuner_type; in em28xx_card_setup()
3271 dev->i2s_speed = 2048000; in em28xx_card_setup()
3272 dev->has_msp34xx = 1; in em28xx_card_setup()
3289 * The K-WORLD DVB-T 310U is detected as an MSI Digivox AD. in em28xx_card_setup()
3294 * What we do here is look up the EEPROM hash of the K-WORLD in em28xx_card_setup()
3296 * a DIGIVOX and reset the device to the K-WORLD instead. in em28xx_card_setup()
3307 * em28xx_set_mode() in em28xx_pre_card_setup() was a no-op, in em28xx_card_setup()
3311 em28xx_gpio_set(dev, dev->board.tuner_gpio); in em28xx_card_setup()
3316 * The Dikom DK300 is detected as an Kworld VS-DVB-T 323UR. in em28xx_card_setup()
3334 * em28xx_set_mode() in em28xx_pre_card_setup() was a no-op, in em28xx_card_setup()
3338 em28xx_gpio_set(dev, dev->board.tuner_gpio); in em28xx_card_setup()
3343 if (dev->board.valid == EM28XX_BOARD_NOT_VALIDATED) { in em28xx_card_setup()
3344 dev_err(&dev->intf->dev, in em28xx_card_setup()
3352 kfree(dev->eedata); in em28xx_card_setup()
3353 dev->eedata = NULL; in em28xx_card_setup()
3357 dev->tuner_type = tuner; in em28xx_card_setup()
3366 if (!INPUT(i)->type) in em28xx_card_setup()
3372 if (INPUT(i)->amux == dev->amux_map[j]) { in em28xx_card_setup()
3380 dev->amux_map[idx++] = INPUT(i)->amux; in em28xx_card_setup()
3383 dev->amux_map[idx] = EM28XX_AMUX_UNUSED; in em28xx_card_setup()
3390 ctl->fname = XC2028_DEFAULT_FIRMWARE; in em28xx_setup_xc3028()
3391 ctl->max_len = 64; in em28xx_setup_xc3028()
3392 ctl->mts = em28xx_boards[dev->model].mts_firmware; in em28xx_setup_xc3028()
3394 switch (dev->model) { in em28xx_setup_xc3028()
3402 ctl->demod = XC3028_FE_ZARLINK456; in em28xx_setup_xc3028()
3406 ctl->demod = XC3028_FE_DEFAULT; in em28xx_setup_xc3028()
3409 ctl->demod = XC3028_FE_DEFAULT; in em28xx_setup_xc3028()
3410 ctl->fname = XC3028L_DEFAULT_FIRMWARE; in em28xx_setup_xc3028()
3416 ctl->demod = XC3028_FE_DEFAULT; in em28xx_setup_xc3028()
3421 ctl->demod = XC3028_FE_CHINA; in em28xx_setup_xc3028()
3422 ctl->fname = XC2028_DEFAULT_FIRMWARE; in em28xx_setup_xc3028()
3425 ctl->demod = XC3028_FE_CHINA; in em28xx_setup_xc3028()
3426 ctl->fname = XC3028L_DEFAULT_FIRMWARE; in em28xx_setup_xc3028()
3429 ctl->demod = XC3028_FE_OREN538; in em28xx_setup_xc3028()
3447 * Devices with an audio-only intf also have a V4L/DVB/RC in request_module_async()
3450 if (dev->is_audio_only) { in request_module_async()
3452 request_module("em28xx-alsa"); in request_module_async()
3460 if (dev->has_video) in request_module_async()
3461 request_module("em28xx-v4l"); in request_module_async()
3462 if (dev->usb_audio_type == EM28XX_USB_AUDIO_CLASS) in request_module_async()
3463 request_module("snd-usb-audio"); in request_module_async()
3464 else if (dev->usb_audio_type == EM28XX_USB_AUDIO_VENDOR) in request_module_async()
3465 request_module("em28xx-alsa"); in request_module_async()
3466 if (dev->board.has_dvb) in request_module_async()
3467 request_module("em28xx-dvb"); in request_module_async()
3468 if (dev->board.buttons || in request_module_async()
3469 ((dev->board.ir_codes || dev->board.has_ir_i2c) && !disable_ir)) in request_module_async()
3470 request_module("em28xx-rc"); in request_module_async()
3476 INIT_WORK(&dev->request_module_wk, request_module_async); in request_modules()
3477 schedule_work(&dev->request_module_wk); in request_modules()
3482 flush_work(&dev->request_module_wk); in flush_request_modules()
3493 return -ENOMEM; in em28xx_media_device_init()
3495 if (udev->product) in em28xx_media_device_init()
3496 media_device_usb_init(mdev, udev, udev->product); in em28xx_media_device_init()
3497 else if (udev->manufacturer) in em28xx_media_device_init()
3498 media_device_usb_init(mdev, udev, udev->manufacturer); in em28xx_media_device_init()
3500 media_device_usb_init(mdev, udev, dev_name(&dev->intf->dev)); in em28xx_media_device_init()
3502 dev->media_dev = mdev; in em28xx_media_device_init()
3510 if (dev->media_dev) { in em28xx_unregister_media_device()
3511 media_device_unregister(dev->media_dev); in em28xx_unregister_media_device()
3512 media_device_cleanup(dev->media_dev); in em28xx_unregister_media_device()
3513 kfree(dev->media_dev); in em28xx_unregister_media_device()
3514 dev->media_dev = NULL; in em28xx_unregister_media_device()
3526 struct usb_device *udev = interface_to_usbdev(dev->intf); in em28xx_release_resources()
3530 mutex_lock(&dev->lock); in em28xx_release_resources()
3534 if (dev->def_i2c_bus) in em28xx_release_resources()
3538 if (dev->ts == PRIMARY_TS) in em28xx_release_resources()
3542 clear_bit(dev->devno, em28xx_devused); in em28xx_release_resources()
3544 mutex_unlock(&dev->lock); in em28xx_release_resources()
3548 * em28xx_free_device() - Free em28xx device
3558 dev_info(&dev->intf->dev, "Freeing device\n"); in em28xx_free_device()
3560 if (!dev->disconnected) in em28xx_free_device()
3563 if (dev->ts == PRIMARY_TS) in em28xx_free_device()
3564 kfree(dev->alt_max_pkt_size_isoc); in em28xx_free_device()
3581 dev->intf = intf; in em28xx_init_dev()
3582 mutex_init(&dev->ctrl_urb_lock); in em28xx_init_dev()
3583 spin_lock_init(&dev->slock); in em28xx_init_dev()
3585 dev->em28xx_write_regs = em28xx_write_regs; in em28xx_init_dev()
3586 dev->em28xx_read_reg = em28xx_read_reg; in em28xx_init_dev()
3587 dev->em28xx_read_reg_req_len = em28xx_read_reg_req_len; in em28xx_init_dev()
3588 dev->em28xx_write_regs_req = em28xx_write_regs_req; in em28xx_init_dev()
3589 dev->em28xx_read_reg_req = em28xx_read_reg_req; in em28xx_init_dev()
3590 dev->board.is_em2800 = em28xx_boards[dev->model].is_em2800; in em28xx_init_dev()
3594 dev->wait_after_write = 5; in em28xx_init_dev()
3599 dev->chip_id = retval; in em28xx_init_dev()
3601 switch (dev->chip_id) { in em28xx_init_dev()
3613 dev->wait_after_write = 0; in em28xx_init_dev()
3614 dev->is_em25xx = 1; in em28xx_init_dev()
3615 dev->eeprom_addrwidth_16bit = 1; in em28xx_init_dev()
3619 if (le16_to_cpu(udev->descriptor.idVendor) == 0xeb1a) { in em28xx_init_dev()
3620 __le16 idProd = udev->descriptor.idProduct; in em28xx_init_dev()
3637 dev->wait_after_write = 0; in em28xx_init_dev()
3641 dev->wait_after_write = 0; in em28xx_init_dev()
3642 dev->eeprom_addrwidth_16bit = 1; in em28xx_init_dev()
3646 dev->wait_after_write = 0; in em28xx_init_dev()
3647 dev->eeprom_addrwidth_16bit = 1; in em28xx_init_dev()
3651 dev->wait_after_write = 0; in em28xx_init_dev()
3652 dev->eeprom_addrwidth_16bit = 1; in em28xx_init_dev()
3656 dev->wait_after_write = 0; in em28xx_init_dev()
3660 dev->wait_after_write = 0; in em28xx_init_dev()
3661 dev->eeprom_addrwidth_16bit = 1; in em28xx_init_dev()
3666 dev_info(&dev->intf->dev, in em28xx_init_dev()
3667 "unknown em28xx chip ID (%d)\n", dev->chip_id); in em28xx_init_dev()
3669 dev_info(&dev->intf->dev, "chip ID is %s\n", chip_name); in em28xx_init_dev()
3673 if (dev->is_audio_only) { in em28xx_init_dev()
3676 retval = -ENODEV; in em28xx_init_dev()
3686 rt_mutex_init(&dev->i2c_bus_lock); in em28xx_init_dev()
3689 if (dev->board.is_em2800) in em28xx_init_dev()
3694 dev_err(&dev->intf->dev, in em28xx_init_dev()
3695 "%s: em28xx_i2c_register bus 0 - error [%d]!\n", in em28xx_init_dev()
3701 if (dev->def_i2c_bus) { in em28xx_init_dev()
3702 if (dev->is_em25xx) in em28xx_init_dev()
3709 dev_err(&dev->intf->dev, in em28xx_init_dev()
3710 "%s: em28xx_i2c_register bus 1 - error [%d]!\n", in em28xx_init_dev()
3735 dev->dev_next = NULL; in em28xx_duplicate_dev()
3736 return -ENOMEM; in em28xx_duplicate_dev()
3743 dev_warn(&dev->intf->dev, ": Supports only %i em28xx boards.\n", in em28xx_duplicate_dev()
3746 dev->dev_next = NULL; in em28xx_duplicate_dev()
3747 return -ENOMEM; in em28xx_duplicate_dev()
3750 sec_dev->devno = nr; in em28xx_duplicate_dev()
3751 snprintf(sec_dev->name, 28, "em28xx #%d", nr); in em28xx_duplicate_dev()
3752 sec_dev->dev_next = NULL; in em28xx_duplicate_dev()
3753 dev->dev_next = sec_dev; in em28xx_duplicate_dev()
3796 e = &intf->altsetting[alt].endpoint[ep].desc; in em28xx_check_usb_descriptor()
3801 sizedescr = le16_to_cpu(e->wMaxPacketSize); in em28xx_check_usb_descriptor()
3804 if (udev->speed == USB_SPEED_HIGH) in em28xx_check_usb_descriptor()
3809 switch (e->bEndpointAddress) { in em28xx_check_usb_descriptor()
3813 dev->analog_ep_isoc = e->bEndpointAddress; in em28xx_check_usb_descriptor()
3814 dev->alt_max_pkt_size_isoc[alt] = size; in em28xx_check_usb_descriptor()
3816 dev->analog_ep_bulk = e->bEndpointAddress; in em28xx_check_usb_descriptor()
3823 dev_err(&intf->dev, in em28xx_check_usb_descriptor()
3828 dev->analog_ep_bulk = e->bEndpointAddress; in em28xx_check_usb_descriptor()
3831 if (size > dev->dvb_max_pkt_size_isoc) { in em28xx_check_usb_descriptor()
3840 dev->dvb_ep_isoc = e->bEndpointAddress; in em28xx_check_usb_descriptor()
3841 dev->dvb_max_pkt_size_isoc = size; in em28xx_check_usb_descriptor()
3842 dev->dvb_alt_isoc = alt; in em28xx_check_usb_descriptor()
3846 dev->dvb_ep_bulk = e->bEndpointAddress; in em28xx_check_usb_descriptor()
3852 if (size > dev->dvb_max_pkt_size_isoc_ts2) { in em28xx_check_usb_descriptor()
3853 dev->dvb_ep_isoc_ts2 = e->bEndpointAddress; in em28xx_check_usb_descriptor()
3854 dev->dvb_max_pkt_size_isoc_ts2 = size; in em28xx_check_usb_descriptor()
3855 dev->dvb_alt_isoc = alt; in em28xx_check_usb_descriptor()
3858 dev->dvb_ep_bulk_ts2 = e->bEndpointAddress; in em28xx_check_usb_descriptor()
3876 const int ifnum = intf->altsetting[0].desc.bInterfaceNumber; in em28xx_usb_probe()
3886 dev_err(&intf->dev, in em28xx_usb_probe()
3889 retval = -ENOMEM; in em28xx_usb_probe()
3895 if (intf->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) { in em28xx_usb_probe()
3896 dev_info(&intf->dev, in em28xx_usb_probe()
3898 le16_to_cpu(udev->descriptor.idVendor), in em28xx_usb_probe()
3899 le16_to_cpu(udev->descriptor.idProduct), in em28xx_usb_probe()
3901 intf->altsetting[0].desc.bInterfaceClass); in em28xx_usb_probe()
3903 retval = -ENODEV; in em28xx_usb_probe()
3910 retval = -ENOMEM; in em28xx_usb_probe()
3915 dev->alt_max_pkt_size_isoc = kcalloc(intf->num_altsetting, in em28xx_usb_probe()
3916 sizeof(dev->alt_max_pkt_size_isoc[0]), in em28xx_usb_probe()
3918 if (!dev->alt_max_pkt_size_isoc) { in em28xx_usb_probe()
3920 retval = -ENOMEM; in em28xx_usb_probe()
3925 for (i = 0; i < intf->num_altsetting; i++) { in em28xx_usb_probe()
3929 ep < intf->altsetting[i].desc.bNumEndpoints; in em28xx_usb_probe()
3939 retval = -ENODEV; in em28xx_usb_probe()
3943 switch (udev->speed) { in em28xx_usb_probe()
3958 dev_info(&intf->dev, in em28xx_usb_probe()
3960 udev->manufacturer ? udev->manufacturer : "", in em28xx_usb_probe()
3961 udev->product ? udev->product : "", in em28xx_usb_probe()
3963 le16_to_cpu(udev->descriptor.idVendor), in em28xx_usb_probe()
3964 le16_to_cpu(udev->descriptor.idProduct), in em28xx_usb_probe()
3966 intf->altsetting->desc.bInterfaceNumber); in em28xx_usb_probe()
3973 if (udev->speed != USB_SPEED_HIGH && disable_usb_speed_check == 0) { in em28xx_usb_probe()
3974 dev_err(&intf->dev, "Device initialization failed.\n"); in em28xx_usb_probe()
3975 dev_err(&intf->dev, in em28xx_usb_probe()
3976 "Device must be connected to a high-speed USB 2.0 port.\n"); in em28xx_usb_probe()
3977 retval = -ENODEV; in em28xx_usb_probe()
3981 kref_init(&dev->ref); in em28xx_usb_probe()
3983 dev->devno = nr; in em28xx_usb_probe()
3984 dev->model = id->driver_info; in em28xx_usb_probe()
3985 dev->alt = -1; in em28xx_usb_probe()
3986 dev->is_audio_only = has_vendor_audio && !(has_video || has_dvb); in em28xx_usb_probe()
3987 dev->has_video = has_video; in em28xx_usb_probe()
3988 dev->ifnum = ifnum; in em28xx_usb_probe()
3990 dev->ts = PRIMARY_TS; in em28xx_usb_probe()
3991 snprintf(dev->name, 28, "em28xx"); in em28xx_usb_probe()
3992 dev->dev_next = NULL; in em28xx_usb_probe()
3995 dev_info(&intf->dev, in em28xx_usb_probe()
3997 dev->usb_audio_type = EM28XX_USB_AUDIO_VENDOR; in em28xx_usb_probe()
4000 for (i = 0; i < udev->config->desc.bNumInterfaces; i++) { in em28xx_usb_probe()
4001 struct usb_interface *uif = udev->config->interface[i]; in em28xx_usb_probe()
4003 if (uif->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) { in em28xx_usb_probe()
4005 dev_err(&intf->dev, in em28xx_usb_probe()
4007 …"\t\tThe vendor interface will be ignored. Please contact the developers <linux-media@vger.kernel.… in em28xx_usb_probe()
4008 dev->usb_audio_type = EM28XX_USB_AUDIO_CLASS; in em28xx_usb_probe()
4014 dev_info(&intf->dev, "Video interface %i found:%s%s\n", in em28xx_usb_probe()
4016 dev->analog_ep_bulk ? " bulk" : "", in em28xx_usb_probe()
4017 dev->analog_ep_isoc ? " isoc" : ""); in em28xx_usb_probe()
4019 dev_info(&intf->dev, "DVB interface %i found:%s%s\n", in em28xx_usb_probe()
4021 dev->dvb_ep_bulk ? " bulk" : "", in em28xx_usb_probe()
4022 dev->dvb_ep_isoc ? " isoc" : ""); in em28xx_usb_probe()
4024 dev->num_alt = intf->num_altsetting; in em28xx_usb_probe()
4027 dev->model = card[nr]; in em28xx_usb_probe()
4033 mutex_init(&dev->lock); in em28xx_usb_probe()
4039 if (dev->is_webcam) in em28xx_usb_probe()
4049 dev->board.decoder == EM28XX_NODECODER && in em28xx_usb_probe()
4050 dev->em28xx_sensor == EM28XX_NOSENSOR) { in em28xx_usb_probe()
4051 dev_err(&intf->dev, in em28xx_usb_probe()
4054 dev->has_video = false; in em28xx_usb_probe()
4057 if (dev->board.has_dual_ts && in em28xx_usb_probe()
4058 (dev->tuner_type != TUNER_ABSENT || INPUT(0)->type)) { in em28xx_usb_probe()
4060 * The logic with sets alternate is not ready for dual-tuners in em28xx_usb_probe()
4063 dev_err(&intf->dev, in em28xx_usb_probe()
4070 if (!dev->analog_ep_isoc || (try_bulk && dev->analog_ep_bulk)) in em28xx_usb_probe()
4071 dev->analog_xfer_bulk = 1; in em28xx_usb_probe()
4072 dev_info(&intf->dev, "analog set to %s mode.\n", in em28xx_usb_probe()
4073 dev->analog_xfer_bulk ? "bulk" : "isoc"); in em28xx_usb_probe()
4076 if (!dev->dvb_ep_isoc || (try_bulk && dev->dvb_ep_bulk)) in em28xx_usb_probe()
4077 dev->dvb_xfer_bulk = 1; in em28xx_usb_probe()
4078 dev_info(&intf->dev, "dvb set to %s mode.\n", in em28xx_usb_probe()
4079 dev->dvb_xfer_bulk ? "bulk" : "isoc"); in em28xx_usb_probe()
4082 if (dev->board.has_dual_ts && em28xx_duplicate_dev(dev) == 0) { in em28xx_usb_probe()
4083 kref_init(&dev->dev_next->ref); in em28xx_usb_probe()
4085 dev->dev_next->ts = SECONDARY_TS; in em28xx_usb_probe()
4086 dev->dev_next->alt = -1; in em28xx_usb_probe()
4087 dev->dev_next->is_audio_only = has_vendor_audio && in em28xx_usb_probe()
4089 dev->dev_next->has_video = false; in em28xx_usb_probe()
4090 dev->dev_next->ifnum = ifnum; in em28xx_usb_probe()
4091 dev->dev_next->model = id->driver_info; in em28xx_usb_probe()
4093 mutex_init(&dev->dev_next->lock); in em28xx_usb_probe()
4094 retval = em28xx_init_dev(dev->dev_next, udev, intf, in em28xx_usb_probe()
4095 dev->dev_next->devno); in em28xx_usb_probe()
4099 dev->dev_next->board.ir_codes = NULL; /* No IR for 2nd tuner */ in em28xx_usb_probe()
4100 dev->dev_next->board.has_ir_i2c = 0; /* No IR for 2nd tuner */ in em28xx_usb_probe()
4103 if (dev->dev_next->is_webcam) in em28xx_usb_probe()
4113 if (!dev->dvb_ep_isoc_ts2 || in em28xx_usb_probe()
4114 (try_bulk && dev->dvb_ep_bulk_ts2)) in em28xx_usb_probe()
4115 dev->dev_next->dvb_xfer_bulk = 1; in em28xx_usb_probe()
4116 dev_info(&dev->intf->dev, "dvb ts2 set to %s mode.\n", in em28xx_usb_probe()
4117 dev->dev_next->dvb_xfer_bulk ? "bulk" : "isoc"); in em28xx_usb_probe()
4120 dev->dev_next->dvb_ep_isoc = dev->dvb_ep_isoc_ts2; in em28xx_usb_probe()
4121 dev->dev_next->dvb_ep_bulk = dev->dvb_ep_bulk_ts2; in em28xx_usb_probe()
4122 dev->dev_next->dvb_max_pkt_size_isoc = dev->dvb_max_pkt_size_isoc_ts2; in em28xx_usb_probe()
4123 dev->dev_next->dvb_alt_isoc = dev->dvb_alt_isoc; in em28xx_usb_probe()
4126 if (dev->dvb_xfer_bulk) { in em28xx_usb_probe()
4153 retval = media_device_register(dev->media_dev); in em28xx_usb_probe()
4159 kfree(dev->alt_max_pkt_size_isoc); in em28xx_usb_probe()
4185 if (dev->dev_next) { in em28xx_usb_disconnect()
4186 dev->dev_next->disconnected = 1; in em28xx_usb_disconnect()
4187 dev_info(&dev->intf->dev, "Disconnecting %s\n", in em28xx_usb_disconnect()
4188 dev->dev_next->name); in em28xx_usb_disconnect()
4191 dev->disconnected = 1; in em28xx_usb_disconnect()
4193 dev_info(&dev->intf->dev, "Disconnecting %s\n", dev->name); in em28xx_usb_disconnect()
4199 if (dev->dev_next) in em28xx_usb_disconnect()
4200 em28xx_release_resources(dev->dev_next); in em28xx_usb_disconnect()
4203 if (dev->dev_next) { in em28xx_usb_disconnect()
4204 kref_put(&dev->dev_next->ref, em28xx_free_device); in em28xx_usb_disconnect()
4205 dev->dev_next = NULL; in em28xx_usb_disconnect()
4207 kref_put(&dev->ref, em28xx_free_device); in em28xx_usb_disconnect()