Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] dw2102: Geniatech T220 support

Support for Geniatech T220 DVB-T/T2/C USB stick.

Signed-off-by: Evgeny Plehov <EvgenyPlehov@ukr.net>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>

authored by

Evgeny Plehov and committed by
Mauro Carvalho Chehab
51d882ed cc58f4db

+110 -3
+110 -3
drivers/media/usb/dvb-usb/dw2102.c
··· 2 2 * DVBWorld DVB-S 2101, 2102, DVB-S2 2104, DVB-C 3101, 3 3 * TeVii S600, S630, S650, S660, S480, S421, S632 4 4 * Prof 1100, 7500, 5 - * Geniatech SU3000 Cards 5 + * Geniatech SU3000, T220 Cards 6 6 * Copyright (C) 2008-2012 Igor M. Liplianin (liplianin@me.by) 7 7 * 8 8 * This program is free software; you can redistribute it and/or modify it ··· 29 29 #include "stb6100.h" 30 30 #include "stb6100_proc.h" 31 31 #include "m88rs2000.h" 32 + #include "tda18271.h" 33 + #include "cxd2820r.h" 32 34 33 35 /* Max transfer size done by I2C transfer functions */ 34 36 #define MAX_XFER_SIZE 64 ··· 1097 1095 .set_lock_led = dw210x_led_ctrl, 1098 1096 }; 1099 1097 1098 + static struct cxd2820r_config cxd2820r_config = { 1099 + .i2c_address = 0x6c, /* (0xd8 >> 1) */ 1100 + .ts_mode = 0x38, 1101 + }; 1102 + 1103 + static struct tda18271_config tda18271_config = { 1104 + .output_opt = TDA18271_OUTPUT_LT_OFF, 1105 + .gate = TDA18271_GATE_DIGITAL, 1106 + }; 1107 + 1100 1108 static u8 m88rs2000_inittab[] = { 1101 1109 DEMOD_WRITE, 0x9a, 0x30, 1102 1110 DEMOD_WRITE, 0x00, 0x01, ··· 1376 1364 return -EIO; 1377 1365 } 1378 1366 1367 + static int t220_frontend_attach(struct dvb_usb_adapter *d) 1368 + { 1369 + u8 obuf[3] = { 0xe, 0x80, 0 }; 1370 + u8 ibuf[] = { 0 }; 1371 + 1372 + if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0) 1373 + err("command 0x0e transfer failed."); 1374 + 1375 + obuf[0] = 0xe; 1376 + obuf[1] = 0x83; 1377 + obuf[2] = 0; 1378 + 1379 + if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0) 1380 + err("command 0x0e transfer failed."); 1381 + 1382 + msleep(100); 1383 + 1384 + obuf[0] = 0xe; 1385 + obuf[1] = 0x80; 1386 + obuf[2] = 1; 1387 + 1388 + if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0) 1389 + err("command 0x0e transfer failed."); 1390 + 1391 + obuf[0] = 0x51; 1392 + 1393 + if (dvb_usb_generic_rw(d->dev, obuf, 1, ibuf, 1, 0) < 0) 1394 + err("command 0x51 transfer failed."); 1395 + 1396 + d->fe_adap[0].fe = dvb_attach(cxd2820r_attach, &cxd2820r_config, 1397 + &d->dev->i2c_adap, NULL); 1398 + if (d->fe_adap[0].fe != NULL) { 1399 + if (dvb_attach(tda18271_attach, d->fe_adap[0].fe, 0x60, 1400 + &d->dev->i2c_adap, &tda18271_config)) { 1401 + info("Attached TDA18271HD/CXD2820R!\n"); 1402 + return 0; 1403 + } 1404 + } 1405 + 1406 + info("Failed to attach TDA18271HD/CXD2820R!\n"); 1407 + return -EIO; 1408 + } 1409 + 1379 1410 static int m88rs2000_frontend_attach(struct dvb_usb_adapter *d) 1380 1411 { 1381 1412 u8 obuf[] = { 0x51 }; ··· 1685 1630 TEVII_S632, 1686 1631 TERRATEC_CINERGY_S2_R2, 1687 1632 GOTVIEW_SAT_HD, 1633 + GENIATECH_T220, 1688 1634 }; 1689 1635 1690 1636 static struct usb_device_id dw2102_table[] = { ··· 1708 1652 [TEVII_S632] = {USB_DEVICE(0x9022, USB_PID_TEVII_S632)}, 1709 1653 [TERRATEC_CINERGY_S2_R2] = {USB_DEVICE(USB_VID_TERRATEC, 0x00b0)}, 1710 1654 [GOTVIEW_SAT_HD] = {USB_DEVICE(0x1FE1, USB_PID_GOTVIEW_SAT_HD)}, 1655 + [GENIATECH_T220] = {USB_DEVICE(0x1f4d, 0xD220)}, 1711 1656 { } 1712 1657 }; 1713 1658 ··· 2134 2077 } 2135 2078 }; 2136 2079 2080 + static struct dvb_usb_device_properties t220_properties = { 2081 + .caps = DVB_USB_IS_AN_I2C_ADAPTER, 2082 + .usb_ctrl = DEVICE_SPECIFIC, 2083 + .size_of_priv = sizeof(struct su3000_state), 2084 + .power_ctrl = su3000_power_ctrl, 2085 + .num_adapters = 1, 2086 + .identify_state = su3000_identify_state, 2087 + .i2c_algo = &su3000_i2c_algo, 2088 + 2089 + .rc.legacy = { 2090 + .rc_map_table = rc_map_su3000_table, 2091 + .rc_map_size = ARRAY_SIZE(rc_map_su3000_table), 2092 + .rc_interval = 150, 2093 + .rc_query = dw2102_rc_query, 2094 + }, 2095 + 2096 + .read_mac_address = su3000_read_mac_address, 2097 + 2098 + .generic_bulk_ctrl_endpoint = 0x01, 2099 + 2100 + .adapter = { 2101 + { 2102 + .num_frontends = 1, 2103 + .fe = { { 2104 + .streaming_ctrl = su3000_streaming_ctrl, 2105 + .frontend_attach = t220_frontend_attach, 2106 + .stream = { 2107 + .type = USB_BULK, 2108 + .count = 8, 2109 + .endpoint = 0x82, 2110 + .u = { 2111 + .bulk = { 2112 + .buffersize = 4096, 2113 + } 2114 + } 2115 + } 2116 + } }, 2117 + } 2118 + }, 2119 + .num_device_descs = 1, 2120 + .devices = { 2121 + { "Geniatech T220 DVB-T/T2 USB2.0", 2122 + { &dw2102_table[GENIATECH_T220], NULL }, 2123 + { NULL }, 2124 + }, 2125 + } 2126 + }; 2127 + 2137 2128 static int dw2102_probe(struct usb_interface *intf, 2138 2129 const struct usb_device_id *id) 2139 2130 { ··· 2254 2149 0 == dvb_usb_device_init(intf, s421, 2255 2150 THIS_MODULE, NULL, adapter_nr) || 2256 2151 0 == dvb_usb_device_init(intf, &su3000_properties, 2257 - THIS_MODULE, NULL, adapter_nr)) 2152 + THIS_MODULE, NULL, adapter_nr) || 2153 + 0 == dvb_usb_device_init(intf, &t220_properties, 2154 + THIS_MODULE, NULL, adapter_nr)) 2258 2155 return 0; 2259 2156 2260 2157 return -ENODEV; ··· 2276 2169 " DVB-C 3101 USB2.0," 2277 2170 " TeVii S600, S630, S650, S660, S480, S421, S632" 2278 2171 " Prof 1100, 7500 USB2.0," 2279 - " Geniatech SU3000 devices"); 2172 + " Geniatech SU3000, T220 devices"); 2280 2173 MODULE_VERSION("0.1"); 2281 2174 MODULE_LICENSE("GPL"); 2282 2175 MODULE_FIRMWARE(DW2101_FIRMWARE);