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},
568 {-1, 0, 0, 0, 0},
584 {-1, 0, 0, 0, 0},
603 {-1, 0, 0, 0},
613 {-1, 0, 0, 0},
623 {-1, 0, 0, 0},
633 {-1, 0, 0, 0},
649 {-1, 0, 0, 0},
665 {-1, 0, 0, 0},
717 .name = "Huaqi DLCW-130",
823 .name = "D-Link DUB-T210 TV Tuner",
1134 .name = "Plextor ConvertX PX-TV100U",
1177 .name = "Kworld 350 U DVB-T",
1183 .name = "Kworld 355 U DVB-T",
1191 .name = "Pinnacle PCTV DVB-T",
1194 /* djh - I have serious doubts this is right... */
1277 .name = "C3 Tech Digital Duo HDTV/SDTV USB",
1279 /* FIXME: Add analog support - need a saa7136 driver */
1280 .tuner_type = TUNER_ABSENT, /* Digital-only TDA18271HD */
1576 .tuner_type = TUNER_ABSENT, /* Capture-only board */
1631 …90/100/101/107 / Kaiser Baas Video to DVD maker / Kworld DVD Maker 2 / Plextor ConvertX PX-AV100U",
1645 .name = "V-Gear PocketTV",
1686 .name = "SIIG AVTuner-PVR / Pixelview Prolink PlayTV USB 2.0",
1781 .name = "KWorld DVB-T 305U",
1800 .name = "KWorld DVB-T 310U",
1817 }, { /* S-video has not been tested yet */
1837 /* FIXME: Analog mode - still not ready */
1958 .name = "Kworld VS-DVB-T 323UR",
2103 .name = "Easy Cap Capture DC-60",
2118 .name = "IO-DATA GV-MVP/SZ",
2131 }, { /* S-video has not been tested yet */
2223 .name = "Reddo DVB-C USB TV Box",
2229 * 1b80:a340 - Empia EM2870, NXP TDA18271HD and LG DT3304, sold
2230 * initially as the KWorld PlusTV 340U, then as the UB435-Q.
2234 .name = "KWorld PlusTV 340U or UB435-Q (ATSC)",
2235 .tuner_type = TUNER_ABSENT, /* Digital-only TDA18271HD */
2255 * 2013:024f PCTV DVB-S2 Stick 460e
2262 .name = "PCTV DVB-S2 Stick (460e)",
2282 .vmux = SAA7115_SVIDEO3, /* S-VIDEO needs check */
2287 * 1b80:e425 MaxMedia UB425-TC
2291 .name = "MaxMedia UB425-TC",
2340 * mostly the same as MaxMedia UB-425-TC but different remote
2353 * 1b80:e346 KWorld USB ATSC TV Stick UB435-Q V2
2357 .name = "KWorld USB ATSC TV Stick UB435-Q V2",
2365 * 1b80:e34c KWorld USB ATSC TV Stick UB435-Q V3
2369 .name = "KWorld USB ATSC TV Stick UB435-Q V3",
2408 * 2013:0258 PCTV DVB-S2 Stick (461e)
2415 .name = "PCTV DVB-S2 Stick (461e)",
2422 * 2013:0259 PCTV DVB-S2 Stick (461e_v2)
2429 .name = "PCTV DVB-S2 Stick (461e v2)",
2479 * 3275:0085 PLEX PX-BCUD.
2483 .name = "PLEX PX-BCUD",
2492 * 2040:0265 Hauppauge WinTV-dualHD (DVB version) Isoc.
2493 * 2040:8265 Hauppauge WinTV-dualHD (DVB version) Bulk.
2497 .name = "Hauppauge WinTV-dualHD DVB",
2514 * 2040:026d Hauppauge WinTV-dualHD (model 01595 - ATSC/QAM) Isoc.
2515 * 2040:826d Hauppauge WinTV-dualHD (model 01595 - ATSC/QAM) Bulk.
2519 .name = "Hauppauge WinTV-dualHD 01595 ATSC/QAM",
2531 * 1b80:e349 Magix USB Videowandler-2
2536 .name = "Magix USB Videowandler-2",
2698 { USB_DEVICE(0x2040, 0x6513), /* HCW HVR-980 */
2700 { USB_DEVICE(0x2040, 0x6517), /* HP HVR-950 */
2702 { USB_DEVICE(0x2040, 0x651b), /* RP HVR-950 */
2786 { USB_DEVICE(0x2013, 0x0264), /* Hauppauge WinTV-soloHD 292e SE */
2788 { USB_DEVICE(0x2040, 0x0264), /* Hauppauge WinTV-soloHD Isoc */
2790 { USB_DEVICE(0x2040, 0x8264), /* Hauppauge OEM Generic WinTV-soloHD Bulk */
2792 { USB_DEVICE(0x2040, 0x8268), /* Hauppauge Retail WinTV-soloHD Bulk */
2800 { USB_DEVICE(0xeb1a, 0x5051), /* Ion Video 2 PC MKII / Startech svid2usb23 / Raygo R12-41373 */
2802 { USB_DEVICE(0x1b80, 0xe349), /* Magix USB Videowandler-2 */
2812 /* P/N: SA 60002070465 Tuner: TVF7533-MF */
2841 struct em28xx *dev = i2c_bus->dev; in em28xx_tuner_callback()
2844 if (dev->tuner_type != TUNER_XC2028 && dev->tuner_type != TUNER_XC5000) in em28xx_tuner_callback()
2850 rc = em28xx_gpio_set(dev, dev->board.tuner_gpio); in em28xx_tuner_callback()
2858 const struct em28xx_board *board = &em28xx_boards[dev->model]; in em28xx_set_xclk_i2c_speed()
2859 u8 xclk = board->xclk, i2c_speed = board->i2c_speed; in em28xx_set_xclk_i2c_speed()
2875 dev->i2c_speed = i2c_speed & 0x03; in em28xx_set_xclk_i2c_speed()
2877 if (!dev->board.is_em2800) in em28xx_set_xclk_i2c_speed()
2884 dev->board = em28xx_boards[dev->model]; in em28xx_set_model()
2885 dev->has_msp34xx = dev->board.has_msp34xx; in em28xx_set_model()
2886 dev->is_webcam = dev->board.is_webcam; in em28xx_set_model()
2891 dev->def_i2c_bus = dev->board.def_i2c_bus; in em28xx_set_model()
2921 dev_warn(&dev->intf->dev, "AC97 registers access is not reliable !\n"); in em28xx_wait_until_ac97_features_equals()
2922 return -ETIMEDOUT; in em28xx_wait_until_ac97_features_equals()
2926 * Since em28xx_pre_card_setup() requires a proper dev->model,
2938 switch (dev->model) { in em28xx_pre_card_setup()
2941 dev->i2s_speed = 2048000; in em28xx_pre_card_setup()
2970 * this device needs some gpio writes to get the DVB-T in em28xx_pre_card_setup()
2983 * DVB-T demod work in em28xx_pre_card_setup()
3046 em28xx_gpio_set(dev, dev->board.tuner_gpio); in em28xx_pre_card_setup()
3057 if (dev->is_webcam) { in em28xx_hint_board()
3058 if (dev->em28xx_sensor == EM28XX_MT9V011) { in em28xx_hint_board()
3059 dev->model = EM2820_BOARD_SILVERCREST_WEBCAM; in em28xx_hint_board()
3060 } else if (dev->em28xx_sensor == EM28XX_MT9M001 || in em28xx_hint_board()
3061 dev->em28xx_sensor == EM28XX_MT9M111) { in em28xx_hint_board()
3062 dev->model = EM2750_BOARD_UNKNOWN; in em28xx_hint_board()
3076 * video standards produce different hashes. in em28xx_hint_board()
3079 if (dev->hash == em28xx_eeprom_hash[i].hash) { in em28xx_hint_board()
3080 dev->model = em28xx_eeprom_hash[i].model; in em28xx_hint_board()
3081 dev->tuner_type = em28xx_eeprom_hash[i].tuner; in em28xx_hint_board()
3083 dev_err(&dev->intf->dev, in em28xx_hint_board()
3088 "\tV4L Mailing List <linux-media@vger.kernel.org>\n" in em28xx_hint_board()
3090 em28xx_boards[dev->model].name); in em28xx_hint_board()
3107 if (!dev->i2c_hash) in em28xx_hint_board()
3108 em28xx_do_i2c_scan(dev, dev->def_i2c_bus); in em28xx_hint_board()
3111 if (dev->i2c_hash == em28xx_i2c_hash[i].hash) { in em28xx_hint_board()
3112 dev->model = em28xx_i2c_hash[i].model; in em28xx_hint_board()
3113 dev->tuner_type = em28xx_i2c_hash[i].tuner; in em28xx_hint_board()
3114 dev_err(&dev->intf->dev, in em28xx_hint_board()
3119 "\tV4L Mailing List <linux-media@vger.kernel.org>\n" in em28xx_hint_board()
3121 em28xx_boards[dev->model].name); in em28xx_hint_board()
3127 dev_err(&dev->intf->dev, in em28xx_hint_board()
3131 "\tV4L Mailing List <linux-media@vger.kernel.org>\n" in em28xx_hint_board()
3134 dev->hash, dev->i2c_hash); in em28xx_hint_board()
3136 dev_err(&dev->intf->dev, in em28xx_hint_board()
3139 dev_err(&dev->intf->dev, in em28xx_hint_board()
3140 " card=%d -> %s\n", i, em28xx_boards[i].name); in em28xx_hint_board()
3142 return -1; in em28xx_hint_board()
3154 if (dev->is_webcam) { in em28xx_card_setup()
3156 if (dev->em28xx_sensor == EM28XX_NOSENSOR) in em28xx_card_setup()
3158 dev->is_webcam = 0; in em28xx_card_setup()
3161 switch (dev->model) { in em28xx_card_setup()
3166 * The K-WORLD DVB-T 310U is detected as an MSI Digivox AD. in em28xx_card_setup()
3171 * What we do here is look up the EEPROM hash of the K-WORLD in em28xx_card_setup()
3173 * a DIGIVOX and reset the device to the K-WORLD instead. in em28xx_card_setup()
3179 dev_err(&dev->intf->dev, "Board not discovered\n"); in em28xx_card_setup()
3189 dev_info(&dev->intf->dev, "Identified as %s (card=%d)\n", in em28xx_card_setup()
3190 dev->board.name, dev->model); in em28xx_card_setup()
3192 dev->tuner_type = em28xx_boards[dev->model].tuner_type; in em28xx_card_setup()
3195 switch (dev->model) { in em28xx_card_setup()
3207 if (!dev->eedata) in em28xx_card_setup()
3214 tveeprom_hauppauge_analog(&tv, dev->eedata); in em28xx_card_setup()
3216 dev->tuner_type = tv.tuner_type; in em28xx_card_setup()
3219 dev->i2s_speed = 2048000; in em28xx_card_setup()
3220 dev->has_msp34xx = 1; in em28xx_card_setup()
3237 * The K-WORLD DVB-T 310U is detected as an MSI Digivox AD. in em28xx_card_setup()
3242 * What we do here is look up the EEPROM hash of the K-WORLD in em28xx_card_setup()
3244 * a DIGIVOX and reset the device to the K-WORLD instead. in em28xx_card_setup()
3255 * em28xx_set_mode() in em28xx_pre_card_setup() was a no-op, in em28xx_card_setup()
3259 em28xx_gpio_set(dev, dev->board.tuner_gpio); in em28xx_card_setup()
3264 * The Dikom DK300 is detected as an Kworld VS-DVB-T 323UR. in em28xx_card_setup()
3282 * em28xx_set_mode() in em28xx_pre_card_setup() was a no-op, in em28xx_card_setup()
3286 em28xx_gpio_set(dev, dev->board.tuner_gpio); in em28xx_card_setup()
3291 if (dev->board.valid == EM28XX_BOARD_NOT_VALIDATED) { in em28xx_card_setup()
3292 dev_err(&dev->intf->dev, in em28xx_card_setup()
3300 kfree(dev->eedata); in em28xx_card_setup()
3301 dev->eedata = NULL; in em28xx_card_setup()
3305 dev->tuner_type = tuner; in em28xx_card_setup()
3314 if (!INPUT(i)->type) in em28xx_card_setup()
3320 if (INPUT(i)->amux == dev->amux_map[j]) { in em28xx_card_setup()
3328 dev->amux_map[idx++] = INPUT(i)->amux; in em28xx_card_setup()
3331 dev->amux_map[idx] = EM28XX_AMUX_UNUSED; in em28xx_card_setup()
3338 ctl->fname = XC2028_DEFAULT_FIRMWARE; in em28xx_setup_xc3028()
3339 ctl->max_len = 64; in em28xx_setup_xc3028()
3340 ctl->mts = em28xx_boards[dev->model].mts_firmware; in em28xx_setup_xc3028()
3342 switch (dev->model) { in em28xx_setup_xc3028()
3350 ctl->demod = XC3028_FE_ZARLINK456; in em28xx_setup_xc3028()
3354 ctl->demod = XC3028_FE_DEFAULT; in em28xx_setup_xc3028()
3357 ctl->demod = XC3028_FE_DEFAULT; in em28xx_setup_xc3028()
3358 ctl->fname = XC3028L_DEFAULT_FIRMWARE; in em28xx_setup_xc3028()
3364 ctl->demod = XC3028_FE_DEFAULT; in em28xx_setup_xc3028()
3369 ctl->demod = XC3028_FE_CHINA; in em28xx_setup_xc3028()
3370 ctl->fname = XC2028_DEFAULT_FIRMWARE; in em28xx_setup_xc3028()
3373 ctl->demod = XC3028_FE_CHINA; in em28xx_setup_xc3028()
3374 ctl->fname = XC3028L_DEFAULT_FIRMWARE; in em28xx_setup_xc3028()
3377 ctl->demod = XC3028_FE_OREN538; in em28xx_setup_xc3028()
3395 * Devices with an audio-only intf also have a V4L/DVB/RC in request_module_async()
3398 if (dev->is_audio_only) { in request_module_async()
3400 request_module("em28xx-alsa"); in request_module_async()
3408 if (dev->has_video) in request_module_async()
3409 request_module("em28xx-v4l"); in request_module_async()
3410 if (dev->usb_audio_type == EM28XX_USB_AUDIO_CLASS) in request_module_async()
3411 request_module("snd-usb-audio"); in request_module_async()
3412 else if (dev->usb_audio_type == EM28XX_USB_AUDIO_VENDOR) in request_module_async()
3413 request_module("em28xx-alsa"); in request_module_async()
3414 if (dev->board.has_dvb) in request_module_async()
3415 request_module("em28xx-dvb"); in request_module_async()
3416 if (dev->board.buttons || in request_module_async()
3417 ((dev->board.ir_codes || dev->board.has_ir_i2c) && !disable_ir)) in request_module_async()
3418 request_module("em28xx-rc"); in request_module_async()
3424 INIT_WORK(&dev->request_module_wk, request_module_async); in request_modules()
3425 schedule_work(&dev->request_module_wk); in request_modules()
3430 flush_work(&dev->request_module_wk); in flush_request_modules()
3441 return -ENOMEM; in em28xx_media_device_init()
3443 if (udev->product) in em28xx_media_device_init()
3444 media_device_usb_init(mdev, udev, udev->product); in em28xx_media_device_init()
3445 else if (udev->manufacturer) in em28xx_media_device_init()
3446 media_device_usb_init(mdev, udev, udev->manufacturer); in em28xx_media_device_init()
3448 media_device_usb_init(mdev, udev, dev_name(&dev->intf->dev)); in em28xx_media_device_init()
3450 dev->media_dev = mdev; in em28xx_media_device_init()
3458 if (dev->media_dev) { in em28xx_unregister_media_device()
3459 media_device_unregister(dev->media_dev); in em28xx_unregister_media_device()
3460 media_device_cleanup(dev->media_dev); in em28xx_unregister_media_device()
3461 kfree(dev->media_dev); in em28xx_unregister_media_device()
3462 dev->media_dev = NULL; in em28xx_unregister_media_device()
3474 struct usb_device *udev = interface_to_usbdev(dev->intf); in em28xx_release_resources()
3478 mutex_lock(&dev->lock); in em28xx_release_resources()
3482 if (dev->def_i2c_bus) in em28xx_release_resources()
3486 if (dev->ts == PRIMARY_TS) in em28xx_release_resources()
3490 clear_bit(dev->devno, em28xx_devused); in em28xx_release_resources()
3492 mutex_unlock(&dev->lock); in em28xx_release_resources()
3496 * em28xx_free_device() - Free em28xx device
3506 dev_info(&dev->intf->dev, "Freeing device\n"); in em28xx_free_device()
3508 if (!dev->disconnected) in em28xx_free_device()
3511 if (dev->ts == PRIMARY_TS) in em28xx_free_device()
3512 kfree(dev->alt_max_pkt_size_isoc); in em28xx_free_device()
3529 dev->intf = intf; in em28xx_init_dev()
3530 mutex_init(&dev->ctrl_urb_lock); in em28xx_init_dev()
3531 spin_lock_init(&dev->slock); in em28xx_init_dev()
3533 dev->em28xx_write_regs = em28xx_write_regs; in em28xx_init_dev()
3534 dev->em28xx_read_reg = em28xx_read_reg; in em28xx_init_dev()
3535 dev->em28xx_read_reg_req_len = em28xx_read_reg_req_len; in em28xx_init_dev()
3536 dev->em28xx_write_regs_req = em28xx_write_regs_req; in em28xx_init_dev()
3537 dev->em28xx_read_reg_req = em28xx_read_reg_req; in em28xx_init_dev()
3538 dev->board.is_em2800 = em28xx_boards[dev->model].is_em2800; in em28xx_init_dev()
3542 dev->wait_after_write = 5; in em28xx_init_dev()
3547 dev->chip_id = retval; in em28xx_init_dev()
3549 switch (dev->chip_id) { in em28xx_init_dev()
3561 dev->wait_after_write = 0; in em28xx_init_dev()
3562 dev->is_em25xx = 1; in em28xx_init_dev()
3563 dev->eeprom_addrwidth_16bit = 1; in em28xx_init_dev()
3567 if (le16_to_cpu(udev->descriptor.idVendor) == 0xeb1a) { in em28xx_init_dev()
3568 __le16 idProd = udev->descriptor.idProduct; in em28xx_init_dev()
3585 dev->wait_after_write = 0; in em28xx_init_dev()
3589 dev->wait_after_write = 0; in em28xx_init_dev()
3590 dev->eeprom_addrwidth_16bit = 1; in em28xx_init_dev()
3594 dev->wait_after_write = 0; in em28xx_init_dev()
3595 dev->eeprom_addrwidth_16bit = 1; in em28xx_init_dev()
3599 dev->wait_after_write = 0; in em28xx_init_dev()
3600 dev->eeprom_addrwidth_16bit = 1; in em28xx_init_dev()
3604 dev->wait_after_write = 0; in em28xx_init_dev()
3608 dev->wait_after_write = 0; in em28xx_init_dev()
3609 dev->eeprom_addrwidth_16bit = 1; in em28xx_init_dev()
3614 dev_info(&dev->intf->dev, in em28xx_init_dev()
3615 "unknown em28xx chip ID (%d)\n", dev->chip_id); in em28xx_init_dev()
3617 dev_info(&dev->intf->dev, "chip ID is %s\n", chip_name); in em28xx_init_dev()
3621 if (dev->is_audio_only) { in em28xx_init_dev()
3624 retval = -ENODEV; in em28xx_init_dev()
3634 rt_mutex_init(&dev->i2c_bus_lock); in em28xx_init_dev()
3637 if (dev->board.is_em2800) in em28xx_init_dev()
3642 dev_err(&dev->intf->dev, in em28xx_init_dev()
3643 "%s: em28xx_i2c_register bus 0 - error [%d]!\n", in em28xx_init_dev()
3649 if (dev->def_i2c_bus) { in em28xx_init_dev()
3650 if (dev->is_em25xx) in em28xx_init_dev()
3657 dev_err(&dev->intf->dev, in em28xx_init_dev()
3658 "%s: em28xx_i2c_register bus 1 - error [%d]!\n", in em28xx_init_dev()
3683 dev->dev_next = NULL; in em28xx_duplicate_dev()
3684 return -ENOMEM; in em28xx_duplicate_dev()
3691 dev_warn(&dev->intf->dev, ": Supports only %i em28xx boards.\n", in em28xx_duplicate_dev()
3694 dev->dev_next = NULL; in em28xx_duplicate_dev()
3695 return -ENOMEM; in em28xx_duplicate_dev()
3698 sec_dev->devno = nr; in em28xx_duplicate_dev()
3699 snprintf(sec_dev->name, 28, "em28xx #%d", nr); in em28xx_duplicate_dev()
3700 sec_dev->dev_next = NULL; in em28xx_duplicate_dev()
3701 dev->dev_next = sec_dev; in em28xx_duplicate_dev()
3744 e = &intf->altsetting[alt].endpoint[ep].desc; in em28xx_check_usb_descriptor()
3749 sizedescr = le16_to_cpu(e->wMaxPacketSize); in em28xx_check_usb_descriptor()
3752 if (udev->speed == USB_SPEED_HIGH) in em28xx_check_usb_descriptor()
3757 switch (e->bEndpointAddress) { in em28xx_check_usb_descriptor()
3761 dev->analog_ep_isoc = e->bEndpointAddress; in em28xx_check_usb_descriptor()
3762 dev->alt_max_pkt_size_isoc[alt] = size; in em28xx_check_usb_descriptor()
3764 dev->analog_ep_bulk = e->bEndpointAddress; in em28xx_check_usb_descriptor()
3771 dev_err(&intf->dev, in em28xx_check_usb_descriptor()
3776 dev->analog_ep_bulk = e->bEndpointAddress; in em28xx_check_usb_descriptor()
3779 if (size > dev->dvb_max_pkt_size_isoc) { in em28xx_check_usb_descriptor()
3788 dev->dvb_ep_isoc = e->bEndpointAddress; in em28xx_check_usb_descriptor()
3789 dev->dvb_max_pkt_size_isoc = size; in em28xx_check_usb_descriptor()
3790 dev->dvb_alt_isoc = alt; in em28xx_check_usb_descriptor()
3794 dev->dvb_ep_bulk = e->bEndpointAddress; in em28xx_check_usb_descriptor()
3800 if (size > dev->dvb_max_pkt_size_isoc_ts2) { in em28xx_check_usb_descriptor()
3801 dev->dvb_ep_isoc_ts2 = e->bEndpointAddress; in em28xx_check_usb_descriptor()
3802 dev->dvb_max_pkt_size_isoc_ts2 = size; in em28xx_check_usb_descriptor()
3803 dev->dvb_alt_isoc = alt; in em28xx_check_usb_descriptor()
3806 dev->dvb_ep_bulk_ts2 = e->bEndpointAddress; in em28xx_check_usb_descriptor()
3824 const int ifnum = intf->altsetting[0].desc.bInterfaceNumber; in em28xx_usb_probe()
3834 dev_err(&intf->dev, in em28xx_usb_probe()
3837 retval = -ENOMEM; in em28xx_usb_probe()
3843 if (intf->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) { in em28xx_usb_probe()
3844 dev_info(&intf->dev, in em28xx_usb_probe()
3846 le16_to_cpu(udev->descriptor.idVendor), in em28xx_usb_probe()
3847 le16_to_cpu(udev->descriptor.idProduct), in em28xx_usb_probe()
3849 intf->altsetting[0].desc.bInterfaceClass); in em28xx_usb_probe()
3851 retval = -ENODEV; in em28xx_usb_probe()
3858 retval = -ENOMEM; in em28xx_usb_probe()
3863 dev->alt_max_pkt_size_isoc = kcalloc(intf->num_altsetting, in em28xx_usb_probe()
3864 sizeof(dev->alt_max_pkt_size_isoc[0]), in em28xx_usb_probe()
3866 if (!dev->alt_max_pkt_size_isoc) { in em28xx_usb_probe()
3868 retval = -ENOMEM; in em28xx_usb_probe()
3873 for (i = 0; i < intf->num_altsetting; i++) { in em28xx_usb_probe()
3877 ep < intf->altsetting[i].desc.bNumEndpoints; in em28xx_usb_probe()
3887 retval = -ENODEV; in em28xx_usb_probe()
3891 switch (udev->speed) { in em28xx_usb_probe()
3906 dev_info(&intf->dev, in em28xx_usb_probe()
3908 udev->manufacturer ? udev->manufacturer : "", in em28xx_usb_probe()
3909 udev->product ? udev->product : "", in em28xx_usb_probe()
3911 le16_to_cpu(udev->descriptor.idVendor), in em28xx_usb_probe()
3912 le16_to_cpu(udev->descriptor.idProduct), in em28xx_usb_probe()
3914 intf->altsetting->desc.bInterfaceNumber); in em28xx_usb_probe()
3921 if (udev->speed != USB_SPEED_HIGH && disable_usb_speed_check == 0) { in em28xx_usb_probe()
3922 dev_err(&intf->dev, "Device initialization failed.\n"); in em28xx_usb_probe()
3923 dev_err(&intf->dev, in em28xx_usb_probe()
3924 "Device must be connected to a high-speed USB 2.0 port.\n"); in em28xx_usb_probe()
3925 retval = -ENODEV; in em28xx_usb_probe()
3929 kref_init(&dev->ref); in em28xx_usb_probe()
3931 dev->devno = nr; in em28xx_usb_probe()
3932 dev->model = id->driver_info; in em28xx_usb_probe()
3933 dev->alt = -1; in em28xx_usb_probe()
3934 dev->is_audio_only = has_vendor_audio && !(has_video || has_dvb); in em28xx_usb_probe()
3935 dev->has_video = has_video; in em28xx_usb_probe()
3936 dev->ifnum = ifnum; in em28xx_usb_probe()
3938 dev->ts = PRIMARY_TS; in em28xx_usb_probe()
3939 snprintf(dev->name, 28, "em28xx"); in em28xx_usb_probe()
3940 dev->dev_next = NULL; in em28xx_usb_probe()
3943 dev_info(&intf->dev, in em28xx_usb_probe()
3945 dev->usb_audio_type = EM28XX_USB_AUDIO_VENDOR; in em28xx_usb_probe()
3948 for (i = 0; i < udev->config->desc.bNumInterfaces; i++) { in em28xx_usb_probe()
3949 struct usb_interface *uif = udev->config->interface[i]; in em28xx_usb_probe()
3951 if (uif->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) { in em28xx_usb_probe()
3953 dev_err(&intf->dev, in em28xx_usb_probe()
3955 …"\t\tThe vendor interface will be ignored. Please contact the developers <linux-media@vger.kernel.… in em28xx_usb_probe()
3956 dev->usb_audio_type = EM28XX_USB_AUDIO_CLASS; in em28xx_usb_probe()
3962 dev_info(&intf->dev, "Video interface %i found:%s%s\n", in em28xx_usb_probe()
3964 dev->analog_ep_bulk ? " bulk" : "", in em28xx_usb_probe()
3965 dev->analog_ep_isoc ? " isoc" : ""); in em28xx_usb_probe()
3967 dev_info(&intf->dev, "DVB interface %i found:%s%s\n", in em28xx_usb_probe()
3969 dev->dvb_ep_bulk ? " bulk" : "", in em28xx_usb_probe()
3970 dev->dvb_ep_isoc ? " isoc" : ""); in em28xx_usb_probe()
3972 dev->num_alt = intf->num_altsetting; in em28xx_usb_probe()
3975 dev->model = card[nr]; in em28xx_usb_probe()
3981 mutex_init(&dev->lock); in em28xx_usb_probe()
3987 if (dev->is_webcam) in em28xx_usb_probe()
3997 dev->board.decoder == EM28XX_NODECODER && in em28xx_usb_probe()
3998 dev->em28xx_sensor == EM28XX_NOSENSOR) { in em28xx_usb_probe()
3999 dev_err(&intf->dev, in em28xx_usb_probe()
4002 dev->has_video = false; in em28xx_usb_probe()
4005 if (dev->board.has_dual_ts && in em28xx_usb_probe()
4006 (dev->tuner_type != TUNER_ABSENT || INPUT(0)->type)) { in em28xx_usb_probe()
4008 * The logic with sets alternate is not ready for dual-tuners in em28xx_usb_probe()
4011 dev_err(&intf->dev, in em28xx_usb_probe()
4018 if (!dev->analog_ep_isoc || (try_bulk && dev->analog_ep_bulk)) in em28xx_usb_probe()
4019 dev->analog_xfer_bulk = 1; in em28xx_usb_probe()
4020 dev_info(&intf->dev, "analog set to %s mode.\n", in em28xx_usb_probe()
4021 dev->analog_xfer_bulk ? "bulk" : "isoc"); in em28xx_usb_probe()
4024 if (!dev->dvb_ep_isoc || (try_bulk && dev->dvb_ep_bulk)) in em28xx_usb_probe()
4025 dev->dvb_xfer_bulk = 1; in em28xx_usb_probe()
4026 dev_info(&intf->dev, "dvb set to %s mode.\n", in em28xx_usb_probe()
4027 dev->dvb_xfer_bulk ? "bulk" : "isoc"); in em28xx_usb_probe()
4030 if (dev->board.has_dual_ts && em28xx_duplicate_dev(dev) == 0) { in em28xx_usb_probe()
4031 kref_init(&dev->dev_next->ref); in em28xx_usb_probe()
4033 dev->dev_next->ts = SECONDARY_TS; in em28xx_usb_probe()
4034 dev->dev_next->alt = -1; in em28xx_usb_probe()
4035 dev->dev_next->is_audio_only = has_vendor_audio && in em28xx_usb_probe()
4037 dev->dev_next->has_video = false; in em28xx_usb_probe()
4038 dev->dev_next->ifnum = ifnum; in em28xx_usb_probe()
4039 dev->dev_next->model = id->driver_info; in em28xx_usb_probe()
4041 mutex_init(&dev->dev_next->lock); in em28xx_usb_probe()
4042 retval = em28xx_init_dev(dev->dev_next, udev, intf, in em28xx_usb_probe()
4043 dev->dev_next->devno); in em28xx_usb_probe()
4047 dev->dev_next->board.ir_codes = NULL; /* No IR for 2nd tuner */ in em28xx_usb_probe()
4048 dev->dev_next->board.has_ir_i2c = 0; /* No IR for 2nd tuner */ in em28xx_usb_probe()
4051 if (dev->dev_next->is_webcam) in em28xx_usb_probe()
4061 if (!dev->dvb_ep_isoc_ts2 || in em28xx_usb_probe()
4062 (try_bulk && dev->dvb_ep_bulk_ts2)) in em28xx_usb_probe()
4063 dev->dev_next->dvb_xfer_bulk = 1; in em28xx_usb_probe()
4064 dev_info(&dev->intf->dev, "dvb ts2 set to %s mode.\n", in em28xx_usb_probe()
4065 dev->dev_next->dvb_xfer_bulk ? "bulk" : "isoc"); in em28xx_usb_probe()
4068 dev->dev_next->dvb_ep_isoc = dev->dvb_ep_isoc_ts2; in em28xx_usb_probe()
4069 dev->dev_next->dvb_ep_bulk = dev->dvb_ep_bulk_ts2; in em28xx_usb_probe()
4070 dev->dev_next->dvb_max_pkt_size_isoc = dev->dvb_max_pkt_size_isoc_ts2; in em28xx_usb_probe()
4071 dev->dev_next->dvb_alt_isoc = dev->dvb_alt_isoc; in em28xx_usb_probe()
4074 if (dev->dvb_xfer_bulk) { in em28xx_usb_probe()
4101 retval = media_device_register(dev->media_dev); in em28xx_usb_probe()
4107 kfree(dev->alt_max_pkt_size_isoc); in em28xx_usb_probe()
4133 if (dev->dev_next) { in em28xx_usb_disconnect()
4134 dev->dev_next->disconnected = 1; in em28xx_usb_disconnect()
4135 dev_info(&dev->intf->dev, "Disconnecting %s\n", in em28xx_usb_disconnect()
4136 dev->dev_next->name); in em28xx_usb_disconnect()
4139 dev->disconnected = 1; in em28xx_usb_disconnect()
4141 dev_info(&dev->intf->dev, "Disconnecting %s\n", dev->name); in em28xx_usb_disconnect()
4147 if (dev->dev_next) in em28xx_usb_disconnect()
4148 em28xx_release_resources(dev->dev_next); in em28xx_usb_disconnect()
4151 if (dev->dev_next) { in em28xx_usb_disconnect()
4152 kref_put(&dev->dev_next->ref, em28xx_free_device); in em28xx_usb_disconnect()
4153 dev->dev_next = NULL; in em28xx_usb_disconnect()
4155 kref_put(&dev->ref, em28xx_free_device); in em28xx_usb_disconnect()