From 24a87181f02f8128a3a653e1fe483d49ab111750 Mon Sep 17 00:00:00 2001 From: CrazyCat Date: Tue, 5 May 2015 20:59:40 +0300 Subject: [PATCH 2/2] Geniatech T220A support. Cc: Linux Media Mailing List Signed-off-by: CrazyCat --- drivers/media/usb/dvb-usb/dw2102.c | 108 ++++++++++++++++++++++++++++++++++++- 1 file changed, 106 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c index f1f357f..b93442e 100644 --- a/drivers/media/usb/dvb-usb/dw2102.c +++ b/drivers/media/usb/dvb-usb/dw2102.c @@ -2,7 +2,7 @@ * 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, + * Geniatech SU3000, T220, T220A, * TechnoTrend S2-4600 Cards * Copyright (C) 2008-2012 Igor M. Liplianin (liplianin@me.by) * @@ -31,6 +31,7 @@ #include "stb6100_proc.h" #include "m88rs2000.h" #include "tda18271.h" +#include "tda18273.h" #include "cxd2820r.h" #include "m88ds3103.h" #include "ts2020.h" @@ -1453,6 +1454,56 @@ static int t220_frontend_attach(struct dvb_usb_adapter *d) return -EIO; } +static int t220a_frontend_attach(struct dvb_usb_adapter *d) +{ + u8 obuf[3] = { 0xe, 0x87, 0 }; + u8 ibuf[] = { 0 }; + + if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0) + err("command 0x0e transfer failed."); + + obuf[0] = 0xe; + obuf[1] = 0x86; + obuf[2] = 1; + + if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0) + err("command 0x0e transfer failed."); + + obuf[0] = 0xe; + obuf[1] = 0x80; + obuf[2] = 0; + + if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0) + err("command 0x0e transfer failed."); + + msleep(50); + + obuf[0] = 0xe; + obuf[1] = 0x80; + obuf[2] = 1; + + if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0) + err("command 0x0e transfer failed."); + + obuf[0] = 0x51; + + if (dvb_usb_generic_rw(d->dev, obuf, 1, ibuf, 1, 0) < 0) + err("command 0x51 transfer failed."); + + d->fe_adap[0].fe = dvb_attach(cxd2820r_attach, &cxd2820r_config, + &d->dev->i2c_adap, NULL); + if (d->fe_adap[0].fe != NULL) { + if (dvb_attach(tda18273_attach, d->fe_adap[0].fe, + &d->dev->i2c_adap, 0x60)) { + info("Attached TDA18273/CXD2820R!\n"); + return 0; + } + } + + info("Failed to attach TDA18273/CXD2820R!\n"); + return -EIO; +} + static int m88rs2000_frontend_attach(struct dvb_usb_adapter *d) { u8 obuf[] = { 0x51 }; @@ -1656,6 +1707,7 @@ enum dw2102_table_entry { TERRATEC_CINERGY_S2_R2, GOTVIEW_SAT_HD, GENIATECH_T220, + GENIATECH_T220A, TECHNOTREND_S2_4600, }; @@ -1680,6 +1732,7 @@ 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)}, + [GENIATECH_T220A] = {USB_DEVICE(0x0572, 0xC686)}, [TECHNOTREND_S2_4600] = {USB_DEVICE(USB_VID_TECHNOTREND, USB_PID_TECHNOTREND_CONNECT_S2_4600)}, { } @@ -2159,6 +2212,55 @@ static struct dvb_usb_device_properties t220_properties = { } }; +static struct dvb_usb_device_properties t220a_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 = 150, + .rc_codes = RC_MAP_SU3000, + .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 = t220a_frontend_attach, + .stream = { + .type = USB_BULK, + .count = 8, + .endpoint = 0x82, + .u = { + .bulk = { + .buffersize = 4096, + } + } + } + } }, + } + }, + .num_device_descs = 1, + .devices = { + { "Geniatech T220A DVB-T/T2 USB2.0", + { &dw2102_table[GENIATECH_T220A], NULL }, + { NULL }, + }, + } +}; + static struct dvb_usb_device_properties tt_s2_4600_properties = { .caps = DVB_USB_IS_AN_I2C_ADAPTER, .usb_ctrl = DEVICE_SPECIFIC, @@ -2283,6 +2385,8 @@ static int dw2102_probe(struct usb_interface *intf, THIS_MODULE, NULL, adapter_nr) || 0 == dvb_usb_device_init(intf, &t220_properties, THIS_MODULE, NULL, adapter_nr) || + 0 == dvb_usb_device_init(intf, &t220a_properties, + THIS_MODULE, NULL, adapter_nr) || 0 == dvb_usb_device_init(intf, &tt_s2_4600_properties, THIS_MODULE, NULL, adapter_nr)) return 0; @@ -2320,7 +2424,7 @@ 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," + " Geniatech SU3000, T220, T220A," " TechnoTrend S2-4600 devices"); MODULE_VERSION("0.1"); MODULE_LICENSE("GPL"); -- 1.9.1