diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-21 10:01:27 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-21 10:01:27 -0700 |
commit | 0c8027d50c070859314a88aaff42453ff4f71819 (patch) | |
tree | 440ecaefad24571853796df50eb2f238052dd3f2 /drivers/media/usb/dvb-usb | |
parent | 1fc149933fd49a5b0e7738dc0853dbfbac4ae0e1 (diff) | |
parent | 64131a87f2aae2ed9e05d8227c5b009ca6c50d98 (diff) |
Merge tag 'media/v4.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media updates from Mauro Carvalho Chehab:
- a new frontend driver for new ATSC devices: lgdt3306a
- a new sensor driver: ov2659
- a new platform driver: xilinx
- the m88ts2022 tuner driver was merged at ts2020 driver
- the media controller gained experimental support for DVB and hybrid
devices
- lots of random cleanups, fixes and improvements on media drivers
* tag 'media/v4.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (404 commits)
[media] uvcvideo: add support for VIDIOC_QUERY_EXT_CTRL
[media] uvcvideo: fix cropcap v4l2-compliance failure
[media] media: omap3isp: remove unused clkdev
[media] coda: Add tracing support
[media] coda: drop dma_sync_single_for_device in coda_bitstream_queue
[media] coda: fix fill bitstream errors in nonstreaming case
[media] coda: call SEQ_END when the first queue is stopped
[media] coda: fail to start streaming if userspace set invalid formats
[media] coda: remove duplicate error messages for buffer allocations
[media] coda: move parameter buffer in together with context buffer allocation
[media] coda: allocate bitstream buffer from REQBUFS, size depends on the format
[media] coda: allocate per-context buffers from REQBUFS
[media] coda: use strlcpy instead of snprintf
[media] coda: bitstream payload is unsigned
[media] coda: fix double call to debugfs_remove
[media] coda: check kasprintf return value in coda_open
[media] coda: bitrate can only be set in kbps steps
[media] v4l2-mem2mem: no need to initialize b in v4l2_m2m_next_buf and v4l2_m2m_buf_remove
[media] s5p-mfc: set allow_zero_bytesused flag for vb2_queue_init
[media] coda: set allow_zero_bytesused flag for vb2_queue_init
...
Diffstat (limited to 'drivers/media/usb/dvb-usb')
-rw-r--r-- | drivers/media/usb/dvb-usb/Kconfig | 5 | ||||
-rw-r--r-- | drivers/media/usb/dvb-usb/cxusb.c | 155 | ||||
-rw-r--r-- | drivers/media/usb/dvb-usb/dib0700_core.c | 3 | ||||
-rw-r--r-- | drivers/media/usb/dvb-usb/dib0700_devices.c | 3 | ||||
-rw-r--r-- | drivers/media/usb/dvb-usb/dvb-usb-dvb.c | 69 | ||||
-rw-r--r-- | drivers/media/usb/dvb-usb/dw2102.c | 192 |
6 files changed, 354 insertions, 73 deletions
diff --git a/drivers/media/usb/dvb-usb/Kconfig b/drivers/media/usb/dvb-usb/Kconfig index 3364200db093..128eee61570d 100644 --- a/drivers/media/usb/dvb-usb/Kconfig +++ b/drivers/media/usb/dvb-usb/Kconfig @@ -278,9 +278,10 @@ config DVB_USB_DW2102 select DVB_STV6110 if MEDIA_SUBDRV_AUTOSELECT select DVB_STV0900 if MEDIA_SUBDRV_AUTOSELECT select DVB_M88RS2000 if MEDIA_SUBDRV_AUTOSELECT + select DVB_M88DS3103 if MEDIA_SUBDRV_AUTOSELECT help - Say Y here to support the DvbWorld, TeVii, Prof DVB-S/S2 USB2.0 - receivers. + Say Y here to support the DvbWorld, TeVii, Prof, TechnoTrend + DVB-S/S2 USB2.0 receivers. config DVB_USB_CINERGY_T2 tristate "Terratec CinergyT2/qanu USB 2.0 DVB-T receiver" diff --git a/drivers/media/usb/dvb-usb/cxusb.c b/drivers/media/usb/dvb-usb/cxusb.c index f327c49d7e09..ffc3704abded 100644 --- a/drivers/media/usb/dvb-usb/cxusb.c +++ b/drivers/media/usb/dvb-usb/cxusb.c @@ -1516,28 +1516,95 @@ static void cxusb_disconnect(struct usb_interface *intf) dvb_usb_device_exit(intf); } -static struct usb_device_id cxusb_table [] = { - { USB_DEVICE(USB_VID_MEDION, USB_PID_MEDION_MD95700) }, - { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_COLD) }, - { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_WARM) }, - { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_COLD) }, - { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_WARM) }, - { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_COLD) }, - { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_WARM) }, - { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_COLD) }, - { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_WARM) }, - { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_COLD) }, - { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM) }, - { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_COLD) }, - { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_WARM) }, - { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4) }, - { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2) }, - { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM) }, - { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_A868R) }, - { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4_REV_2) }, - { USB_DEVICE(USB_VID_CONEXANT, USB_PID_CONEXANT_D680_DMB) }, - { USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_D689) }, - { USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_T230) }, +enum cxusb_table_index { + MEDION_MD95700, + DVICO_BLUEBIRD_LG064F_COLD, + DVICO_BLUEBIRD_LG064F_WARM, + DVICO_BLUEBIRD_DUAL_1_COLD, + DVICO_BLUEBIRD_DUAL_1_WARM, + DVICO_BLUEBIRD_LGZ201_COLD, + DVICO_BLUEBIRD_LGZ201_WARM, + DVICO_BLUEBIRD_TH7579_COLD, + DVICO_BLUEBIRD_TH7579_WARM, + DIGITALNOW_BLUEBIRD_DUAL_1_COLD, + DIGITALNOW_BLUEBIRD_DUAL_1_WARM, + DVICO_BLUEBIRD_DUAL_2_COLD, + DVICO_BLUEBIRD_DUAL_2_WARM, + DVICO_BLUEBIRD_DUAL_4, + DVICO_BLUEBIRD_DVB_T_NANO_2, + DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM, + AVERMEDIA_VOLAR_A868R, + DVICO_BLUEBIRD_DUAL_4_REV_2, + CONEXANT_D680_DMB, + MYGICA_D689, + MYGICA_T230, + NR__cxusb_table_index +}; + +static struct usb_device_id cxusb_table[NR__cxusb_table_index + 1] = { + [MEDION_MD95700] = { + USB_DEVICE(USB_VID_MEDION, USB_PID_MEDION_MD95700) + }, + [DVICO_BLUEBIRD_LG064F_COLD] = { + USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_COLD) + }, + [DVICO_BLUEBIRD_LG064F_WARM] = { + USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_WARM) + }, + [DVICO_BLUEBIRD_DUAL_1_COLD] = { + USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_COLD) + }, + [DVICO_BLUEBIRD_DUAL_1_WARM] = { + USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_WARM) + }, + [DVICO_BLUEBIRD_LGZ201_COLD] = { + USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_COLD) + }, + [DVICO_BLUEBIRD_LGZ201_WARM] = { + USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_WARM) + }, + [DVICO_BLUEBIRD_TH7579_COLD] = { + USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_COLD) + }, + [DVICO_BLUEBIRD_TH7579_WARM] = { + USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_WARM) + }, + [DIGITALNOW_BLUEBIRD_DUAL_1_COLD] = { + USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_COLD) + }, + [DIGITALNOW_BLUEBIRD_DUAL_1_WARM] = { + USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM) + }, + [DVICO_BLUEBIRD_DUAL_2_COLD] = { + USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_COLD) + }, + [DVICO_BLUEBIRD_DUAL_2_WARM] = { + USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_WARM) + }, + [DVICO_BLUEBIRD_DUAL_4] = { + USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4) + }, + [DVICO_BLUEBIRD_DVB_T_NANO_2] = { + USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2) + }, + [DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM] = { + USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM) + }, + [AVERMEDIA_VOLAR_A868R] = { + USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_A868R) + }, + [DVICO_BLUEBIRD_DUAL_4_REV_2] = { + USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4_REV_2) + }, + [CONEXANT_D680_DMB] = { + USB_DEVICE(USB_VID_CONEXANT, USB_PID_CONEXANT_D680_DMB) + }, + [MYGICA_D689] = { + USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_D689) + }, + [MYGICA_T230] = { + USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_T230) + }, {} /* Terminating entry */ }; MODULE_DEVICE_TABLE (usb, cxusb_table); @@ -1581,7 +1648,7 @@ static struct dvb_usb_device_properties cxusb_medion_properties = { .devices = { { "Medion MD95700 (MDUSBTV-HYBRID)", { NULL }, - { &cxusb_table[0], NULL }, + { &cxusb_table[MEDION_MD95700], NULL }, }, } }; @@ -1637,8 +1704,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties = { .num_device_descs = 1, .devices = { { "DViCO FusionHDTV5 USB Gold", - { &cxusb_table[1], NULL }, - { &cxusb_table[2], NULL }, + { &cxusb_table[DVICO_BLUEBIRD_LG064F_COLD], NULL }, + { &cxusb_table[DVICO_BLUEBIRD_LG064F_WARM], NULL }, }, } }; @@ -1693,16 +1760,16 @@ static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties = { .num_device_descs = 3, .devices = { { "DViCO FusionHDTV DVB-T Dual USB", - { &cxusb_table[3], NULL }, - { &cxusb_table[4], NULL }, + { &cxusb_table[DVICO_BLUEBIRD_DUAL_1_COLD], NULL }, + { &cxusb_table[DVICO_BLUEBIRD_DUAL_1_WARM], NULL }, }, { "DigitalNow DVB-T Dual USB", - { &cxusb_table[9], NULL }, - { &cxusb_table[10], NULL }, + { &cxusb_table[DIGITALNOW_BLUEBIRD_DUAL_1_COLD], NULL }, + { &cxusb_table[DIGITALNOW_BLUEBIRD_DUAL_1_WARM], NULL }, }, { "DViCO FusionHDTV DVB-T Dual Digital 2", - { &cxusb_table[11], NULL }, - { &cxusb_table[12], NULL }, + { &cxusb_table[DVICO_BLUEBIRD_DUAL_2_COLD], NULL }, + { &cxusb_table[DVICO_BLUEBIRD_DUAL_2_WARM], NULL }, }, } }; @@ -1756,8 +1823,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties = { .num_device_descs = 1, .devices = { { "DViCO FusionHDTV DVB-T USB (LGZ201)", - { &cxusb_table[5], NULL }, - { &cxusb_table[6], NULL }, + { &cxusb_table[DVICO_BLUEBIRD_LGZ201_COLD], NULL }, + { &cxusb_table[DVICO_BLUEBIRD_LGZ201_WARM], NULL }, }, } }; @@ -1812,8 +1879,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties = { .num_device_descs = 1, .devices = { { "DViCO FusionHDTV DVB-T USB (TH7579)", - { &cxusb_table[7], NULL }, - { &cxusb_table[8], NULL }, + { &cxusb_table[DVICO_BLUEBIRD_TH7579_COLD], NULL }, + { &cxusb_table[DVICO_BLUEBIRD_TH7579_WARM], NULL }, }, } }; @@ -1865,7 +1932,7 @@ static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties = { .devices = { { "DViCO FusionHDTV DVB-T Dual Digital 4", { NULL }, - { &cxusb_table[13], NULL }, + { &cxusb_table[DVICO_BLUEBIRD_DUAL_4], NULL }, }, } }; @@ -1918,7 +1985,7 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties = { .devices = { { "DViCO FusionHDTV DVB-T NANO2", { NULL }, - { &cxusb_table[14], NULL }, + { &cxusb_table[DVICO_BLUEBIRD_DVB_T_NANO_2], NULL }, }, } }; @@ -1972,8 +2039,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_prope .num_device_descs = 1, .devices = { { "DViCO FusionHDTV DVB-T NANO2 w/o firmware", - { &cxusb_table[14], NULL }, - { &cxusb_table[15], NULL }, + { &cxusb_table[DVICO_BLUEBIRD_DVB_T_NANO_2], NULL }, + { &cxusb_table[DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM], NULL }, }, } }; @@ -2017,7 +2084,7 @@ static struct dvb_usb_device_properties cxusb_aver_a868r_properties = { .devices = { { "AVerMedia AVerTVHD Volar (A868R)", { NULL }, - { &cxusb_table[16], NULL }, + { &cxusb_table[AVERMEDIA_VOLAR_A868R], NULL }, }, } }; @@ -2071,7 +2138,7 @@ struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties = { .devices = { { "DViCO FusionHDTV DVB-T Dual Digital 4 (rev 2)", { NULL }, - { &cxusb_table[17], NULL }, + { &cxusb_table[DVICO_BLUEBIRD_DUAL_4_REV_2], NULL }, }, } }; @@ -2125,7 +2192,7 @@ static struct dvb_usb_device_properties cxusb_d680_dmb_properties = { { "Conexant DMB-TH Stick", { NULL }, - { &cxusb_table[18], NULL }, + { &cxusb_table[CONEXANT_D680_DMB], NULL }, }, } }; @@ -2179,7 +2246,7 @@ static struct dvb_usb_device_properties cxusb_mygica_d689_properties = { { "Mygica D689 DMB-TH", { NULL }, - { &cxusb_table[19], NULL }, + { &cxusb_table[MYGICA_D689], NULL }, }, } }; @@ -2232,7 +2299,7 @@ static struct dvb_usb_device_properties cxusb_mygica_t230_properties = { { "Mygica T230 DVB-T/T2/C", { NULL }, - { &cxusb_table[20], NULL }, + { &cxusb_table[MYGICA_T230], NULL }, }, } }; diff --git a/drivers/media/usb/dvb-usb/dib0700_core.c b/drivers/media/usb/dvb-usb/dib0700_core.c index 50856dbf5496..2b40393836ff 100644 --- a/drivers/media/usb/dvb-usb/dib0700_core.c +++ b/drivers/media/usb/dvb-usb/dib0700_core.c @@ -651,9 +651,6 @@ out: return ret; } -/* Number of keypresses to ignore before start repeating */ -#define RC_REPEAT_DELAY_V1_20 10 - /* This is the structure of the RC response packet starting in firmware 1.20 */ struct dib0700_rc_response { u8 report_id; diff --git a/drivers/media/usb/dvb-usb/dib0700_devices.c b/drivers/media/usb/dvb-usb/dib0700_devices.c index e1757b8f5f5d..d7d55a20e959 100644 --- a/drivers/media/usb/dvb-usb/dib0700_devices.c +++ b/drivers/media/usb/dvb-usb/dib0700_devices.c @@ -510,9 +510,6 @@ static int stk7700ph_tuner_attach(struct dvb_usb_adapter *adap) static u8 rc_request[] = { REQUEST_POLL_RC, 0 }; -/* Number of keypresses to ignore before start repeating */ -#define RC_REPEAT_DELAY 6 - /* * This function is used only when firmware is < 1.20 version. Newer * firmwares use bulk mode, with functions implemented at dib0700_core, diff --git a/drivers/media/usb/dvb-usb/dvb-usb-dvb.c b/drivers/media/usb/dvb-usb/dvb-usb-dvb.c index 719413b15f20..8a260c854653 100644 --- a/drivers/media/usb/dvb-usb/dvb-usb-dvb.c +++ b/drivers/media/usb/dvb-usb/dvb-usb-dvb.c @@ -84,14 +84,61 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff) static int dvb_usb_start_feed(struct dvb_demux_feed *dvbdmxfeed) { - deb_ts("start pid: 0x%04x, feedtype: %d\n", dvbdmxfeed->pid,dvbdmxfeed->type); - return dvb_usb_ctrl_feed(dvbdmxfeed,1); + deb_ts("start pid: 0x%04x, feedtype: %d\n", dvbdmxfeed->pid, + dvbdmxfeed->type); + return dvb_usb_ctrl_feed(dvbdmxfeed, 1); } static int dvb_usb_stop_feed(struct dvb_demux_feed *dvbdmxfeed) { deb_ts("stop pid: 0x%04x, feedtype: %d\n", dvbdmxfeed->pid, dvbdmxfeed->type); - return dvb_usb_ctrl_feed(dvbdmxfeed,0); + return dvb_usb_ctrl_feed(dvbdmxfeed, 0); +} + +static void dvb_usb_media_device_register(struct dvb_usb_adapter *adap) +{ +#ifdef CONFIG_MEDIA_CONTROLLER_DVB + struct media_device *mdev; + struct dvb_usb_device *d = adap->dev; + struct usb_device *udev = d->udev; + int ret; + + mdev = kzalloc(sizeof(*mdev), GFP_KERNEL); + if (!mdev) + return; + + mdev->dev = &udev->dev; + strlcpy(mdev->model, d->desc->name, sizeof(mdev->model)); + if (udev->serial) + strlcpy(mdev->serial, udev->serial, sizeof(mdev->serial)); + strcpy(mdev->bus_info, udev->devpath); + mdev->hw_revision = le16_to_cpu(udev->descriptor.bcdDevice); + mdev->driver_version = LINUX_VERSION_CODE; + + ret = media_device_register(mdev); + if (ret) { + dev_err(&d->udev->dev, + "Couldn't create a media device. Error: %d\n", + ret); + kfree(mdev); + return; + } + dvb_register_media_controller(&adap->dvb_adap, mdev); + + dev_info(&d->udev->dev, "media controller created\n"); +#endif +} + +static void dvb_usb_media_device_unregister(struct dvb_usb_adapter *adap) +{ +#ifdef CONFIG_MEDIA_CONTROLLER_DVB + if (!adap->dvb_adap.mdev) + return; + + media_device_unregister(adap->dvb_adap.mdev); + kfree(adap->dvb_adap.mdev); + adap->dvb_adap.mdev = NULL; +#endif } int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap, short *adapter_nums) @@ -107,9 +154,11 @@ int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap, short *adapter_nums) } adap->dvb_adap.priv = adap; + dvb_usb_media_device_register(adap); + if (adap->dev->props.read_mac_address) { - if (adap->dev->props.read_mac_address(adap->dev,adap->dvb_adap.proposed_mac) == 0) - info("MAC address: %pM",adap->dvb_adap.proposed_mac); + if (adap->dev->props.read_mac_address(adap->dev, adap->dvb_adap.proposed_mac) == 0) + info("MAC address: %pM", adap->dvb_adap.proposed_mac); else err("MAC address reading failed."); } @@ -128,7 +177,7 @@ int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap, short *adapter_nums) adap->demux.stop_feed = dvb_usb_stop_feed; adap->demux.write_to_decoder = NULL; if ((ret = dvb_dmx_init(&adap->demux)) < 0) { - err("dvb_dmx_init failed: error %d",ret); + err("dvb_dmx_init failed: error %d", ret); goto err_dmx; } @@ -136,13 +185,13 @@ int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap, short *adapter_nums) adap->dmxdev.demux = &adap->demux.dmx; adap->dmxdev.capabilities = 0; if ((ret = dvb_dmxdev_init(&adap->dmxdev, &adap->dvb_adap)) < 0) { - err("dvb_dmxdev_init failed: error %d",ret); + err("dvb_dmxdev_init failed: error %d", ret); goto err_dmx_dev; } if ((ret = dvb_net_init(&adap->dvb_adap, &adap->dvb_net, &adap->demux.dmx)) < 0) { - err("dvb_net_init failed: error %d",ret); + err("dvb_net_init failed: error %d", ret); goto err_net_init; } @@ -154,6 +203,7 @@ err_net_init: err_dmx_dev: dvb_dmx_release(&adap->demux); err_dmx: + dvb_usb_media_device_unregister(adap); dvb_unregister_adapter(&adap->dvb_adap); err: return ret; @@ -167,6 +217,7 @@ int dvb_usb_adapter_dvb_exit(struct dvb_usb_adapter *adap) adap->demux.dmx.close(&adap->demux.dmx); dvb_dmxdev_release(&adap->dmxdev); dvb_dmx_release(&adap->demux); + dvb_usb_media_device_unregister(adap); dvb_unregister_adapter(&adap->dvb_adap); adap->state &= ~DVB_USB_ADAP_STATE_DVB; } @@ -268,6 +319,8 @@ int dvb_usb_adapter_frontend_init(struct dvb_usb_adapter *adap) adap->num_frontends_initialized++; } + dvb_create_media_graph(&adap->dvb_adap); + return 0; } diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c index 1a3df10d6bad..f1f357f43ff0 100644 --- a/drivers/media/usb/dvb-usb/dw2102.c +++ b/drivers/media/usb/dvb-usb/dw2102.c @@ -2,7 +2,8 @@ * DVBWorld DVB-S 2101, 2102, DVB-S2 2104, DVB-C 3101, * TeVii S600, S630, S650, S660, S480, S421, S632 * Prof 1100, 7500, - * Geniatech SU3000, T220 Cards + * Geniatech SU3000, T220, + * TechnoTrend S2-4600 Cards * Copyright (C) 2008-2012 Igor M. Liplianin (liplianin@me.by) * * This program is free software; you can redistribute it and/or modify it @@ -31,6 +32,8 @@ #include "m88rs2000.h" #include "tda18271.h" #include "cxd2820r.h" +#include "m88ds3103.h" +#include "ts2020.h" /* Max transfer size done by I2C transfer functions */ #define MAX_XFER_SIZE 64 @@ -112,11 +115,9 @@ "Please see linux/Documentation/dvb/ for more details " \ "on firmware-problems." -struct su3000_state { +struct dw2102_state { u8 initialized; -}; - -struct s6x0_state { + struct i2c_client *i2c_client_tuner; int (*old_set_voltage)(struct dvb_frontend *f, fe_sec_voltage_t v); }; @@ -887,7 +888,7 @@ static int su3000_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) static int su3000_power_ctrl(struct dvb_usb_device *d, int i) { - struct su3000_state *state = (struct su3000_state *)d->priv; + struct dw2102_state *state = (struct dw2102_state *)d->priv; u8 obuf[] = {0xde, 0}; info("%s: %d, initialized %d\n", __func__, i, state->initialized); @@ -973,7 +974,7 @@ static int s660_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) { struct dvb_usb_adapter *d = (struct dvb_usb_adapter *)(fe->dvb->priv); - struct s6x0_state *st = (struct s6x0_state *)d->dev->priv; + struct dw2102_state *st = (struct dw2102_state *)d->dev->priv; dw210x_set_voltage(fe, voltage); if (st->old_set_voltage) @@ -1117,6 +1118,22 @@ static struct tda18271_config tda18271_config = { .gate = TDA18271_GATE_DIGITAL, }; +static const struct m88ds3103_config tt_s2_4600_m88ds3103_config = { + .i2c_addr = 0x68, + .clock = 27000000, + .i2c_wr_max = 33, + .ts_mode = M88DS3103_TS_CI, + .ts_clk = 16000, + .ts_clk_pol = 0, + .spec_inv = 0, + .agc_inv = 0, + .clock_out = M88DS3103_CLOCK_OUT_ENABLED, + .envelope_mode = 0, + .agc = 0x99, + .lnb_hv_pol = 1, + .lnb_en_pol = 0, +}; + static u8 m88rs2000_inittab[] = { DEMOD_WRITE, 0x9a, 0x30, DEMOD_WRITE, 0x00, 0x01, @@ -1295,7 +1312,7 @@ static int stv0288_frontend_attach(struct dvb_usb_adapter *d) static int ds3000_frontend_attach(struct dvb_usb_adapter *d) { - struct s6x0_state *st = (struct s6x0_state *)d->dev->priv; + struct dw2102_state *st = d->dev->priv; u8 obuf[] = {7, 1}; d->fe_adap[0].fe = dvb_attach(ds3000_attach, &s660_ds3000_config, @@ -1461,6 +1478,84 @@ static int m88rs2000_frontend_attach(struct dvb_usb_adapter *d) return -EIO; } +static int tt_s2_4600_frontend_attach(struct dvb_usb_adapter *adap) +{ + struct dvb_usb_device *d = adap->dev; + struct dw2102_state *state = d->priv; + u8 obuf[3] = { 0xe, 0x80, 0 }; + u8 ibuf[] = { 0 }; + struct i2c_adapter *i2c_adapter; + struct i2c_client *client; + struct i2c_board_info info; + struct ts2020_config ts2020_config = {}; + + if (dvb_usb_generic_rw(d, obuf, 3, ibuf, 1, 0) < 0) + err("command 0x0e transfer failed."); + + obuf[0] = 0xe; + obuf[1] = 0x02; + obuf[2] = 1; + + if (dvb_usb_generic_rw(d, obuf, 3, ibuf, 1, 0) < 0) + err("command 0x0e transfer failed."); + msleep(300); + + obuf[0] = 0xe; + obuf[1] = 0x83; + obuf[2] = 0; + + if (dvb_usb_generic_rw(d, obuf, 3, ibuf, 1, 0) < 0) + err("command 0x0e transfer failed."); + + obuf[0] = 0xe; + obuf[1] = 0x83; + obuf[2] = 1; + + if (dvb_usb_generic_rw(d, obuf, 3, ibuf, 1, 0) < 0) + err("command 0x0e transfer failed."); + + obuf[0] = 0x51; + + if (dvb_usb_generic_rw(d, obuf, 1, ibuf, 1, 0) < 0) + err("command 0x51 transfer failed."); + + memset(&info, 0, sizeof(struct i2c_board_info)); + + adap->fe_adap[0].fe = dvb_attach(m88ds3103_attach, + &tt_s2_4600_m88ds3103_config, + &d->i2c_adap, + &i2c_adapter); + if (adap->fe_adap[0].fe == NULL) + return -ENODEV; + + /* attach tuner */ + ts2020_config.fe = adap->fe_adap[0].fe; + strlcpy(info.type, "ts2022", I2C_NAME_SIZE); + info.addr = 0x60; + info.platform_data = &ts2020_config; + request_module("ts2020"); + client = i2c_new_device(i2c_adapter, &info); + + if (client == NULL || client->dev.driver == NULL) { + dvb_frontend_detach(adap->fe_adap[0].fe); + return -ENODEV; + } + + if (!try_module_get(client->dev.driver->owner)) { + i2c_unregister_device(client); + dvb_frontend_detach(adap->fe_adap[0].fe); + return -ENODEV; + } + + /* delegate signal strength measurement to tuner */ + adap->fe_adap[0].fe->ops.read_signal_strength = + adap->fe_adap[0].fe->ops.tuner_ops.get_rf_strength; + + state->i2c_client_tuner = client; + + return 0; +} + static int dw2102_tuner_attach(struct dvb_usb_adapter *adap) { dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x60, @@ -1561,6 +1656,7 @@ enum dw2102_table_entry { TERRATEC_CINERGY_S2_R2, GOTVIEW_SAT_HD, GENIATECH_T220, + TECHNOTREND_S2_4600, }; static struct usb_device_id dw2102_table[] = { @@ -1584,6 +1680,8 @@ static struct usb_device_id dw2102_table[] = { [TERRATEC_CINERGY_S2_R2] = {USB_DEVICE(USB_VID_TERRATEC, 0x00b0)}, [GOTVIEW_SAT_HD] = {USB_DEVICE(0x1FE1, USB_PID_GOTVIEW_SAT_HD)}, [GENIATECH_T220] = {USB_DEVICE(0x1f4d, 0xD220)}, + [TECHNOTREND_S2_4600] = {USB_DEVICE(USB_VID_TECHNOTREND, + USB_PID_TECHNOTREND_CONNECT_S2_4600)}, { } }; @@ -1857,7 +1955,7 @@ static struct dvb_usb_device_properties dw3101_properties = { static struct dvb_usb_device_properties s6x0_properties = { .caps = DVB_USB_IS_AN_I2C_ADAPTER, .usb_ctrl = DEVICE_SPECIFIC, - .size_of_priv = sizeof(struct s6x0_state), + .size_of_priv = sizeof(struct dw2102_state), .firmware = S630_FIRMWARE, .no_reconnect = 1, @@ -1950,7 +2048,7 @@ static struct dvb_usb_device_description d632 = { static struct dvb_usb_device_properties su3000_properties = { .caps = DVB_USB_IS_AN_I2C_ADAPTER, .usb_ctrl = DEVICE_SPECIFIC, - .size_of_priv = sizeof(struct su3000_state), + .size_of_priv = sizeof(struct dw2102_state), .power_ctrl = su3000_power_ctrl, .num_adapters = 1, .identify_state = su3000_identify_state, @@ -2015,7 +2113,7 @@ static struct dvb_usb_device_properties su3000_properties = { static struct dvb_usb_device_properties t220_properties = { .caps = DVB_USB_IS_AN_I2C_ADAPTER, .usb_ctrl = DEVICE_SPECIFIC, - .size_of_priv = sizeof(struct su3000_state), + .size_of_priv = sizeof(struct dw2102_state), .power_ctrl = su3000_power_ctrl, .num_adapters = 1, .identify_state = su3000_identify_state, @@ -2061,6 +2159,55 @@ static struct dvb_usb_device_properties t220_properties = { } }; +static struct dvb_usb_device_properties tt_s2_4600_properties = { + .caps = DVB_USB_IS_AN_I2C_ADAPTER, + .usb_ctrl = DEVICE_SPECIFIC, + .size_of_priv = sizeof(struct dw2102_state), + .power_ctrl = su3000_power_ctrl, + .num_adapters = 1, + .identify_state = su3000_identify_state, + .i2c_algo = &su3000_i2c_algo, + + .rc.core = { + .rc_interval = 250, + .rc_codes = RC_MAP_TT_1500, + .module_name = "dw2102", + .allowed_protos = RC_BIT_RC5, + .rc_query = su3000_rc_query, + }, + + .read_mac_address = su3000_read_mac_address, + + .generic_bulk_ctrl_endpoint = 0x01, + + .adapter = { + { + .num_frontends = 1, + .fe = {{ + .streaming_ctrl = su3000_streaming_ctrl, + .frontend_attach = tt_s2_4600_frontend_attach, + .stream = { + .type = USB_BULK, + .count = 8, + .endpoint = 0x82, + .u = { + .bulk = { + .buffersize = 4096, + } + } + } + } }, + } + }, + .num_device_descs = 1, + .devices = { + { "TechnoTrend TT-connect S2-4600", + { &dw2102_table[TECHNOTREND_S2_4600], NULL }, + { NULL }, + }, + } +}; + static int dw2102_probe(struct usb_interface *intf, const struct usb_device_id *id) { @@ -2135,16 +2282,34 @@ static int dw2102_probe(struct usb_interface *intf, 0 == dvb_usb_device_init(intf, &su3000_properties, THIS_MODULE, NULL, adapter_nr) || 0 == dvb_usb_device_init(intf, &t220_properties, + THIS_MODULE, NULL, adapter_nr) || + 0 == dvb_usb_device_init(intf, &tt_s2_4600_properties, THIS_MODULE, NULL, adapter_nr)) return 0; return -ENODEV; } +static void dw2102_disconnect(struct usb_interface *intf) +{ + struct dvb_usb_device *d = usb_get_intfdata(intf); + struct dw2102_state *st = (struct dw2102_state *)d->priv; + struct i2c_client *client; + + /* remove I2C client for tuner */ + client = st->i2c_client_tuner; + if (client) { + module_put(client->dev.driver->owner); + i2c_unregister_device(client); + } + + dvb_usb_device_exit(intf); +} + static struct usb_driver dw2102_driver = { .name = "dw2102", .probe = dw2102_probe, - .disconnect = dvb_usb_device_exit, + .disconnect = dw2102_disconnect, .id_table = dw2102_table, }; @@ -2155,7 +2320,8 @@ MODULE_DESCRIPTION("Driver for DVBWorld DVB-S 2101, 2102, DVB-S2 2104," " DVB-C 3101 USB2.0," " TeVii S600, S630, S650, S660, S480, S421, S632" " Prof 1100, 7500 USB2.0," - " Geniatech SU3000, T220 devices"); + " Geniatech SU3000, T220," + " TechnoTrend S2-4600 devices"); MODULE_VERSION("0.1"); MODULE_LICENSE("GPL"); MODULE_FIRMWARE(DW2101_FIRMWARE); |