ttusb2.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /* DVB USB compliant linux driver for Technotrend DVB USB boxes and clones
  3. * (e.g. Pinnacle 400e DVB-S USB2.0).
  4. *
  5. * The Pinnacle 400e uses the same protocol as the Technotrend USB1.1 boxes.
  6. *
  7. * TDA8263 + TDA10086
  8. *
  9. * I2C addresses:
  10. * 0x08 - LNBP21PD - LNB power supply
  11. * 0x0e - TDA10086 - Demodulator
  12. * 0x50 - FX2 eeprom
  13. * 0x60 - TDA8263 - Tuner
  14. * 0x78 ???
  15. *
  16. * Copyright (c) 2002 Holger Waechtler <[email protected]>
  17. * Copyright (c) 2003 Felix Domke <[email protected]>
  18. * Copyright (C) 2005-6 Patrick Boettcher <[email protected]>
  19. *
  20. * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information
  21. */
  22. #define DVB_USB_LOG_PREFIX "ttusb2"
  23. #include "dvb-usb.h"
  24. #include "ttusb2.h"
  25. #include "tda826x.h"
  26. #include "tda10086.h"
  27. #include "tda1002x.h"
  28. #include "tda10048.h"
  29. #include "tda827x.h"
  30. #include "lnbp21.h"
  31. /* CA */
  32. #include <media/dvb_ca_en50221.h>
  33. /* debug */
  34. static int dvb_usb_ttusb2_debug;
  35. #define deb_info(args...) dprintk(dvb_usb_ttusb2_debug,0x01,args)
  36. module_param_named(debug,dvb_usb_ttusb2_debug, int, 0644);
  37. MODULE_PARM_DESC(debug, "set debugging level (1=info (or-able))." DVB_USB_DEBUG_STATUS);
  38. static int dvb_usb_ttusb2_debug_ci;
  39. module_param_named(debug_ci,dvb_usb_ttusb2_debug_ci, int, 0644);
  40. MODULE_PARM_DESC(debug_ci, "set debugging ci." DVB_USB_DEBUG_STATUS);
  41. DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
  42. #define ci_dbg(format, arg...) \
  43. do { \
  44. if (dvb_usb_ttusb2_debug_ci) \
  45. printk(KERN_DEBUG DVB_USB_LOG_PREFIX \
  46. ": %s " format "\n" , __func__, ## arg); \
  47. } while (0)
  48. enum {
  49. TT3650_CMD_CI_TEST = 0x40,
  50. TT3650_CMD_CI_RD_CTRL,
  51. TT3650_CMD_CI_WR_CTRL,
  52. TT3650_CMD_CI_RD_ATTR,
  53. TT3650_CMD_CI_WR_ATTR,
  54. TT3650_CMD_CI_RESET,
  55. TT3650_CMD_CI_SET_VIDEO_PORT
  56. };
  57. struct ttusb2_state {
  58. struct dvb_ca_en50221 ca;
  59. struct mutex ca_mutex;
  60. u8 id;
  61. u16 last_rc_key;
  62. };
  63. static int ttusb2_msg(struct dvb_usb_device *d, u8 cmd,
  64. u8 *wbuf, int wlen, u8 *rbuf, int rlen)
  65. {
  66. struct ttusb2_state *st = d->priv;
  67. u8 *s, *r = NULL;
  68. int ret = 0;
  69. if (4 + rlen > 64)
  70. return -EIO;
  71. s = kzalloc(wlen+4, GFP_KERNEL);
  72. if (!s)
  73. return -ENOMEM;
  74. r = kzalloc(64, GFP_KERNEL);
  75. if (!r) {
  76. kfree(s);
  77. return -ENOMEM;
  78. }
  79. s[0] = 0xaa;
  80. s[1] = ++st->id;
  81. s[2] = cmd;
  82. s[3] = wlen;
  83. memcpy(&s[4],wbuf,wlen);
  84. ret = dvb_usb_generic_rw(d, s, wlen+4, r, 64, 0);
  85. if (ret != 0 ||
  86. r[0] != 0x55 ||
  87. r[1] != s[1] ||
  88. r[2] != cmd ||
  89. (rlen > 0 && r[3] != rlen)) {
  90. warn("there might have been an error during control message transfer. (rlen = %d, was %d)",rlen,r[3]);
  91. kfree(s);
  92. kfree(r);
  93. return -EIO;
  94. }
  95. if (rlen > 0)
  96. memcpy(rbuf, &r[4], rlen);
  97. kfree(s);
  98. kfree(r);
  99. return 0;
  100. }
  101. /* ci */
  102. static int tt3650_ci_msg(struct dvb_usb_device *d, u8 cmd, u8 *data, unsigned int write_len, unsigned int read_len)
  103. {
  104. int ret;
  105. u8 rx[60];/* (64 -4) */
  106. ret = ttusb2_msg(d, cmd, data, write_len, rx, read_len);
  107. if (!ret)
  108. memcpy(data, rx, read_len);
  109. return ret;
  110. }
  111. static int tt3650_ci_msg_locked(struct dvb_ca_en50221 *ca, u8 cmd, u8 *data, unsigned int write_len, unsigned int read_len)
  112. {
  113. struct dvb_usb_device *d = ca->data;
  114. struct ttusb2_state *state = d->priv;
  115. int ret;
  116. mutex_lock(&state->ca_mutex);
  117. ret = tt3650_ci_msg(d, cmd, data, write_len, read_len);
  118. mutex_unlock(&state->ca_mutex);
  119. return ret;
  120. }
  121. static int tt3650_ci_read_attribute_mem(struct dvb_ca_en50221 *ca, int slot, int address)
  122. {
  123. u8 buf[3];
  124. int ret = 0;
  125. if (slot)
  126. return -EINVAL;
  127. buf[0] = (address >> 8) & 0x0F;
  128. buf[1] = address;
  129. ret = tt3650_ci_msg_locked(ca, TT3650_CMD_CI_RD_ATTR, buf, 2, 3);
  130. ci_dbg("%04x -> %d 0x%02x", address, ret, buf[2]);
  131. if (ret < 0)
  132. return ret;
  133. return buf[2];
  134. }
  135. static int tt3650_ci_write_attribute_mem(struct dvb_ca_en50221 *ca, int slot, int address, u8 value)
  136. {
  137. u8 buf[3];
  138. ci_dbg("%d 0x%04x 0x%02x", slot, address, value);
  139. if (slot)
  140. return -EINVAL;
  141. buf[0] = (address >> 8) & 0x0F;
  142. buf[1] = address;
  143. buf[2] = value;
  144. return tt3650_ci_msg_locked(ca, TT3650_CMD_CI_WR_ATTR, buf, 3, 3);
  145. }
  146. static int tt3650_ci_read_cam_control(struct dvb_ca_en50221 *ca, int slot, u8 address)
  147. {
  148. u8 buf[2];
  149. int ret;
  150. if (slot)
  151. return -EINVAL;
  152. buf[0] = address & 3;
  153. ret = tt3650_ci_msg_locked(ca, TT3650_CMD_CI_RD_CTRL, buf, 1, 2);
  154. ci_dbg("0x%02x -> %d 0x%02x", address, ret, buf[1]);
  155. if (ret < 0)
  156. return ret;
  157. return buf[1];
  158. }
  159. static int tt3650_ci_write_cam_control(struct dvb_ca_en50221 *ca, int slot, u8 address, u8 value)
  160. {
  161. u8 buf[2];
  162. ci_dbg("%d 0x%02x 0x%02x", slot, address, value);
  163. if (slot)
  164. return -EINVAL;
  165. buf[0] = address;
  166. buf[1] = value;
  167. return tt3650_ci_msg_locked(ca, TT3650_CMD_CI_WR_CTRL, buf, 2, 2);
  168. }
  169. static int tt3650_ci_set_video_port(struct dvb_ca_en50221 *ca, int slot, int enable)
  170. {
  171. u8 buf[1];
  172. int ret;
  173. ci_dbg("%d %d", slot, enable);
  174. if (slot)
  175. return -EINVAL;
  176. buf[0] = enable;
  177. ret = tt3650_ci_msg_locked(ca, TT3650_CMD_CI_SET_VIDEO_PORT, buf, 1, 1);
  178. if (ret < 0)
  179. return ret;
  180. if (enable != buf[0]) {
  181. err("CI not %sabled.", enable ? "en" : "dis");
  182. return -EIO;
  183. }
  184. return 0;
  185. }
  186. static int tt3650_ci_slot_shutdown(struct dvb_ca_en50221 *ca, int slot)
  187. {
  188. return tt3650_ci_set_video_port(ca, slot, 0);
  189. }
  190. static int tt3650_ci_slot_ts_enable(struct dvb_ca_en50221 *ca, int slot)
  191. {
  192. return tt3650_ci_set_video_port(ca, slot, 1);
  193. }
  194. static int tt3650_ci_slot_reset(struct dvb_ca_en50221 *ca, int slot)
  195. {
  196. struct dvb_usb_device *d = ca->data;
  197. struct ttusb2_state *state = d->priv;
  198. u8 buf[1];
  199. int ret;
  200. ci_dbg("%d", slot);
  201. if (slot)
  202. return -EINVAL;
  203. buf[0] = 0;
  204. mutex_lock(&state->ca_mutex);
  205. ret = tt3650_ci_msg(d, TT3650_CMD_CI_RESET, buf, 1, 1);
  206. if (ret)
  207. goto failed;
  208. msleep(500);
  209. buf[0] = 1;
  210. ret = tt3650_ci_msg(d, TT3650_CMD_CI_RESET, buf, 1, 1);
  211. if (ret)
  212. goto failed;
  213. msleep(500);
  214. buf[0] = 0; /* FTA */
  215. ret = tt3650_ci_msg(d, TT3650_CMD_CI_SET_VIDEO_PORT, buf, 1, 1);
  216. msleep(1100);
  217. failed:
  218. mutex_unlock(&state->ca_mutex);
  219. return ret;
  220. }
  221. static int tt3650_ci_poll_slot_status(struct dvb_ca_en50221 *ca, int slot, int open)
  222. {
  223. u8 buf[1];
  224. int ret;
  225. if (slot)
  226. return -EINVAL;
  227. ret = tt3650_ci_msg_locked(ca, TT3650_CMD_CI_TEST, buf, 0, 1);
  228. if (ret)
  229. return ret;
  230. if (1 == buf[0]) {
  231. return DVB_CA_EN50221_POLL_CAM_PRESENT |
  232. DVB_CA_EN50221_POLL_CAM_READY;
  233. }
  234. return 0;
  235. }
  236. static void tt3650_ci_uninit(struct dvb_usb_device *d)
  237. {
  238. struct ttusb2_state *state;
  239. ci_dbg("");
  240. if (NULL == d)
  241. return;
  242. state = d->priv;
  243. if (NULL == state)
  244. return;
  245. if (NULL == state->ca.data)
  246. return;
  247. dvb_ca_en50221_release(&state->ca);
  248. memset(&state->ca, 0, sizeof(state->ca));
  249. }
  250. static int tt3650_ci_init(struct dvb_usb_adapter *a)
  251. {
  252. struct dvb_usb_device *d = a->dev;
  253. struct ttusb2_state *state = d->priv;
  254. int ret;
  255. ci_dbg("");
  256. mutex_init(&state->ca_mutex);
  257. state->ca.owner = THIS_MODULE;
  258. state->ca.read_attribute_mem = tt3650_ci_read_attribute_mem;
  259. state->ca.write_attribute_mem = tt3650_ci_write_attribute_mem;
  260. state->ca.read_cam_control = tt3650_ci_read_cam_control;
  261. state->ca.write_cam_control = tt3650_ci_write_cam_control;
  262. state->ca.slot_reset = tt3650_ci_slot_reset;
  263. state->ca.slot_shutdown = tt3650_ci_slot_shutdown;
  264. state->ca.slot_ts_enable = tt3650_ci_slot_ts_enable;
  265. state->ca.poll_slot_status = tt3650_ci_poll_slot_status;
  266. state->ca.data = d;
  267. ret = dvb_ca_en50221_init(&a->dvb_adap,
  268. &state->ca,
  269. /* flags */ 0,
  270. /* n_slots */ 1);
  271. if (ret) {
  272. err("Cannot initialize CI: Error %d.", ret);
  273. memset(&state->ca, 0, sizeof(state->ca));
  274. return ret;
  275. }
  276. info("CI initialized.");
  277. return 0;
  278. }
  279. static int ttusb2_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num)
  280. {
  281. struct dvb_usb_device *d = i2c_get_adapdata(adap);
  282. static u8 obuf[60], ibuf[60];
  283. int i, write_read, read;
  284. if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
  285. return -EAGAIN;
  286. if (num > 2)
  287. warn("more than 2 i2c messages at a time is not handled yet. TODO.");
  288. for (i = 0; i < num; i++) {
  289. write_read = i+1 < num && (msg[i+1].flags & I2C_M_RD);
  290. read = msg[i].flags & I2C_M_RD;
  291. if (3 + msg[i].len > sizeof(obuf)) {
  292. err("i2c wr len=%d too high", msg[i].len);
  293. break;
  294. }
  295. if (write_read) {
  296. if (3 + msg[i+1].len > sizeof(ibuf)) {
  297. err("i2c rd len=%d too high", msg[i+1].len);
  298. break;
  299. }
  300. } else if (read) {
  301. if (3 + msg[i].len > sizeof(ibuf)) {
  302. err("i2c rd len=%d too high", msg[i].len);
  303. break;
  304. }
  305. }
  306. obuf[0] = (msg[i].addr << 1) | (write_read | read);
  307. if (read)
  308. obuf[1] = 0;
  309. else
  310. obuf[1] = msg[i].len;
  311. /* read request */
  312. if (write_read)
  313. obuf[2] = msg[i+1].len;
  314. else if (read)
  315. obuf[2] = msg[i].len;
  316. else
  317. obuf[2] = 0;
  318. memcpy(&obuf[3], msg[i].buf, msg[i].len);
  319. if (ttusb2_msg(d, CMD_I2C_XFER, obuf, obuf[1]+3, ibuf, obuf[2] + 3) < 0) {
  320. err("i2c transfer failed.");
  321. break;
  322. }
  323. if (write_read) {
  324. memcpy(msg[i+1].buf, &ibuf[3], msg[i+1].len);
  325. i++;
  326. } else if (read)
  327. memcpy(msg[i].buf, &ibuf[3], msg[i].len);
  328. }
  329. mutex_unlock(&d->i2c_mutex);
  330. return i;
  331. }
  332. static u32 ttusb2_i2c_func(struct i2c_adapter *adapter)
  333. {
  334. return I2C_FUNC_I2C;
  335. }
  336. static struct i2c_algorithm ttusb2_i2c_algo = {
  337. .master_xfer = ttusb2_i2c_xfer,
  338. .functionality = ttusb2_i2c_func,
  339. };
  340. /* command to poll IR receiver (copied from pctv452e.c) */
  341. #define CMD_GET_IR_CODE 0x1b
  342. /* IR */
  343. static int tt3650_rc_query(struct dvb_usb_device *d)
  344. {
  345. int ret;
  346. u8 rx[9]; /* A CMD_GET_IR_CODE reply is 9 bytes long */
  347. struct ttusb2_state *st = d->priv;
  348. ret = ttusb2_msg(d, CMD_GET_IR_CODE, NULL, 0, rx, sizeof(rx));
  349. if (ret != 0)
  350. return ret;
  351. if (rx[8] & 0x01) {
  352. /* got a "press" event */
  353. st->last_rc_key = RC_SCANCODE_RC5(rx[3], rx[2]);
  354. deb_info("%s: cmd=0x%02x sys=0x%02x\n", __func__, rx[2], rx[3]);
  355. rc_keydown(d->rc_dev, RC_PROTO_RC5, st->last_rc_key, rx[1]);
  356. } else if (st->last_rc_key) {
  357. rc_keyup(d->rc_dev);
  358. st->last_rc_key = 0;
  359. }
  360. return 0;
  361. }
  362. /* Callbacks for DVB USB */
  363. static int ttusb2_identify_state(struct usb_device *udev,
  364. const struct dvb_usb_device_properties *props,
  365. const struct dvb_usb_device_description **desc,
  366. int *cold)
  367. {
  368. *cold = udev->descriptor.iManufacturer == 0 && udev->descriptor.iProduct == 0;
  369. return 0;
  370. }
  371. static int ttusb2_power_ctrl(struct dvb_usb_device *d, int onoff)
  372. {
  373. u8 b = onoff;
  374. ttusb2_msg(d, CMD_POWER, &b, 0, NULL, 0);
  375. return ttusb2_msg(d, CMD_POWER, &b, 1, NULL, 0);
  376. }
  377. static struct tda10086_config tda10086_config = {
  378. .demod_address = 0x0e,
  379. .invert = 0,
  380. .diseqc_tone = 1,
  381. .xtal_freq = TDA10086_XTAL_16M,
  382. };
  383. static struct tda10023_config tda10023_config = {
  384. .demod_address = 0x0c,
  385. .invert = 0,
  386. .xtal = 16000000,
  387. .pll_m = 11,
  388. .pll_p = 3,
  389. .pll_n = 1,
  390. .deltaf = 0xa511,
  391. };
  392. static struct tda10048_config tda10048_config = {
  393. .demod_address = 0x10 >> 1,
  394. .output_mode = TDA10048_PARALLEL_OUTPUT,
  395. .inversion = TDA10048_INVERSION_ON,
  396. .dtv6_if_freq_khz = TDA10048_IF_4000,
  397. .dtv7_if_freq_khz = TDA10048_IF_4500,
  398. .dtv8_if_freq_khz = TDA10048_IF_5000,
  399. .clk_freq_khz = TDA10048_CLK_16000,
  400. .no_firmware = 1,
  401. .set_pll = true ,
  402. .pll_m = 5,
  403. .pll_n = 3,
  404. .pll_p = 0,
  405. };
  406. static struct tda827x_config tda827x_config = {
  407. .config = 0,
  408. };
  409. static int ttusb2_frontend_tda10086_attach(struct dvb_usb_adapter *adap)
  410. {
  411. if (usb_set_interface(adap->dev->udev,0,3) < 0)
  412. err("set interface to alts=3 failed");
  413. if ((adap->fe_adap[0].fe = dvb_attach(tda10086_attach, &tda10086_config, &adap->dev->i2c_adap)) == NULL) {
  414. deb_info("TDA10086 attach failed\n");
  415. return -ENODEV;
  416. }
  417. return 0;
  418. }
  419. static int ttusb2_ct3650_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
  420. {
  421. struct dvb_usb_adapter *adap = fe->dvb->priv;
  422. return adap->fe_adap[0].fe->ops.i2c_gate_ctrl(adap->fe_adap[0].fe, enable);
  423. }
  424. static int ttusb2_frontend_tda10023_attach(struct dvb_usb_adapter *adap)
  425. {
  426. if (usb_set_interface(adap->dev->udev, 0, 3) < 0)
  427. err("set interface to alts=3 failed");
  428. if (adap->fe_adap[0].fe == NULL) {
  429. /* FE 0 DVB-C */
  430. adap->fe_adap[0].fe = dvb_attach(tda10023_attach,
  431. &tda10023_config, &adap->dev->i2c_adap, 0x48);
  432. if (adap->fe_adap[0].fe == NULL) {
  433. deb_info("TDA10023 attach failed\n");
  434. return -ENODEV;
  435. }
  436. tt3650_ci_init(adap);
  437. } else {
  438. adap->fe_adap[1].fe = dvb_attach(tda10048_attach,
  439. &tda10048_config, &adap->dev->i2c_adap);
  440. if (adap->fe_adap[1].fe == NULL) {
  441. deb_info("TDA10048 attach failed\n");
  442. return -ENODEV;
  443. }
  444. /* tuner is behind TDA10023 I2C-gate */
  445. adap->fe_adap[1].fe->ops.i2c_gate_ctrl = ttusb2_ct3650_i2c_gate_ctrl;
  446. }
  447. return 0;
  448. }
  449. static int ttusb2_tuner_tda827x_attach(struct dvb_usb_adapter *adap)
  450. {
  451. struct dvb_frontend *fe;
  452. /* MFE: select correct FE to attach tuner since that's called twice */
  453. if (adap->fe_adap[1].fe == NULL)
  454. fe = adap->fe_adap[0].fe;
  455. else
  456. fe = adap->fe_adap[1].fe;
  457. /* attach tuner */
  458. if (dvb_attach(tda827x_attach, fe, 0x61, &adap->dev->i2c_adap, &tda827x_config) == NULL) {
  459. printk(KERN_ERR "%s: No tda827x found!\n", __func__);
  460. return -ENODEV;
  461. }
  462. return 0;
  463. }
  464. static int ttusb2_tuner_tda826x_attach(struct dvb_usb_adapter *adap)
  465. {
  466. if (dvb_attach(tda826x_attach, adap->fe_adap[0].fe, 0x60, &adap->dev->i2c_adap, 0) == NULL) {
  467. deb_info("TDA8263 attach failed\n");
  468. return -ENODEV;
  469. }
  470. if (dvb_attach(lnbp21_attach, adap->fe_adap[0].fe, &adap->dev->i2c_adap, 0, 0) == NULL) {
  471. deb_info("LNBP21 attach failed\n");
  472. return -ENODEV;
  473. }
  474. return 0;
  475. }
  476. /* DVB USB Driver stuff */
  477. static struct dvb_usb_device_properties ttusb2_properties;
  478. static struct dvb_usb_device_properties ttusb2_properties_s2400;
  479. static struct dvb_usb_device_properties ttusb2_properties_ct3650;
  480. static void ttusb2_usb_disconnect(struct usb_interface *intf)
  481. {
  482. struct dvb_usb_device *d = usb_get_intfdata(intf);
  483. tt3650_ci_uninit(d);
  484. dvb_usb_device_exit(intf);
  485. }
  486. static int ttusb2_probe(struct usb_interface *intf,
  487. const struct usb_device_id *id)
  488. {
  489. if (0 == dvb_usb_device_init(intf, &ttusb2_properties,
  490. THIS_MODULE, NULL, adapter_nr) ||
  491. 0 == dvb_usb_device_init(intf, &ttusb2_properties_s2400,
  492. THIS_MODULE, NULL, adapter_nr) ||
  493. 0 == dvb_usb_device_init(intf, &ttusb2_properties_ct3650,
  494. THIS_MODULE, NULL, adapter_nr))
  495. return 0;
  496. return -ENODEV;
  497. }
  498. enum {
  499. PINNACLE_PCTV_400E,
  500. PINNACLE_PCTV_450E,
  501. TECHNOTREND_CONNECT_S2400,
  502. TECHNOTREND_CONNECT_CT3650,
  503. TECHNOTREND_CONNECT_S2400_8KEEPROM,
  504. };
  505. static struct usb_device_id ttusb2_table[] = {
  506. DVB_USB_DEV(PINNACLE, PINNACLE_PCTV_400E),
  507. DVB_USB_DEV(PINNACLE, PINNACLE_PCTV_450E),
  508. DVB_USB_DEV(TECHNOTREND, TECHNOTREND_CONNECT_S2400),
  509. DVB_USB_DEV(TECHNOTREND, TECHNOTREND_CONNECT_CT3650),
  510. DVB_USB_DEV(TECHNOTREND, TECHNOTREND_CONNECT_S2400_8KEEPROM),
  511. { }
  512. };
  513. MODULE_DEVICE_TABLE (usb, ttusb2_table);
  514. static struct dvb_usb_device_properties ttusb2_properties = {
  515. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  516. .usb_ctrl = CYPRESS_FX2,
  517. .firmware = "dvb-usb-pctv-400e-01.fw",
  518. .size_of_priv = sizeof(struct ttusb2_state),
  519. .num_adapters = 1,
  520. .adapter = {
  521. {
  522. .num_frontends = 1,
  523. .fe = {{
  524. .streaming_ctrl = NULL, // ttusb2_streaming_ctrl,
  525. .frontend_attach = ttusb2_frontend_tda10086_attach,
  526. .tuner_attach = ttusb2_tuner_tda826x_attach,
  527. /* parameter for the MPEG2-data transfer */
  528. .stream = {
  529. .type = USB_ISOC,
  530. .count = 5,
  531. .endpoint = 0x02,
  532. .u = {
  533. .isoc = {
  534. .framesperurb = 4,
  535. .framesize = 940,
  536. .interval = 1,
  537. }
  538. }
  539. }
  540. }},
  541. }
  542. },
  543. .power_ctrl = ttusb2_power_ctrl,
  544. .identify_state = ttusb2_identify_state,
  545. .i2c_algo = &ttusb2_i2c_algo,
  546. .generic_bulk_ctrl_endpoint = 0x01,
  547. .num_device_descs = 2,
  548. .devices = {
  549. { "Pinnacle 400e DVB-S USB2.0",
  550. { &ttusb2_table[PINNACLE_PCTV_400E], NULL },
  551. { NULL },
  552. },
  553. { "Pinnacle 450e DVB-S USB2.0",
  554. { &ttusb2_table[PINNACLE_PCTV_450E], NULL },
  555. { NULL },
  556. },
  557. }
  558. };
  559. static struct dvb_usb_device_properties ttusb2_properties_s2400 = {
  560. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  561. .usb_ctrl = CYPRESS_FX2,
  562. .firmware = "dvb-usb-tt-s2400-01.fw",
  563. .size_of_priv = sizeof(struct ttusb2_state),
  564. .num_adapters = 1,
  565. .adapter = {
  566. {
  567. .num_frontends = 1,
  568. .fe = {{
  569. .streaming_ctrl = NULL,
  570. .frontend_attach = ttusb2_frontend_tda10086_attach,
  571. .tuner_attach = ttusb2_tuner_tda826x_attach,
  572. /* parameter for the MPEG2-data transfer */
  573. .stream = {
  574. .type = USB_ISOC,
  575. .count = 5,
  576. .endpoint = 0x02,
  577. .u = {
  578. .isoc = {
  579. .framesperurb = 4,
  580. .framesize = 940,
  581. .interval = 1,
  582. }
  583. }
  584. }
  585. }},
  586. }
  587. },
  588. .power_ctrl = ttusb2_power_ctrl,
  589. .identify_state = ttusb2_identify_state,
  590. .i2c_algo = &ttusb2_i2c_algo,
  591. .generic_bulk_ctrl_endpoint = 0x01,
  592. .num_device_descs = 2,
  593. .devices = {
  594. { "Technotrend TT-connect S-2400",
  595. { &ttusb2_table[TECHNOTREND_CONNECT_S2400], NULL },
  596. { NULL },
  597. },
  598. { "Technotrend TT-connect S-2400 (8kB EEPROM)",
  599. { &ttusb2_table[TECHNOTREND_CONNECT_S2400_8KEEPROM], NULL },
  600. { NULL },
  601. },
  602. }
  603. };
  604. static struct dvb_usb_device_properties ttusb2_properties_ct3650 = {
  605. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  606. .usb_ctrl = CYPRESS_FX2,
  607. .size_of_priv = sizeof(struct ttusb2_state),
  608. .rc.core = {
  609. .rc_interval = 150, /* Less than IR_KEYPRESS_TIMEOUT */
  610. .rc_codes = RC_MAP_TT_1500,
  611. .rc_query = tt3650_rc_query,
  612. .allowed_protos = RC_PROTO_BIT_RC5,
  613. },
  614. .num_adapters = 1,
  615. .adapter = {
  616. {
  617. .num_frontends = 2,
  618. .fe = {{
  619. .streaming_ctrl = NULL,
  620. .frontend_attach = ttusb2_frontend_tda10023_attach,
  621. .tuner_attach = ttusb2_tuner_tda827x_attach,
  622. /* parameter for the MPEG2-data transfer */
  623. .stream = {
  624. .type = USB_ISOC,
  625. .count = 5,
  626. .endpoint = 0x02,
  627. .u = {
  628. .isoc = {
  629. .framesperurb = 4,
  630. .framesize = 940,
  631. .interval = 1,
  632. }
  633. }
  634. }
  635. }, {
  636. .streaming_ctrl = NULL,
  637. .frontend_attach = ttusb2_frontend_tda10023_attach,
  638. .tuner_attach = ttusb2_tuner_tda827x_attach,
  639. /* parameter for the MPEG2-data transfer */
  640. .stream = {
  641. .type = USB_ISOC,
  642. .count = 5,
  643. .endpoint = 0x02,
  644. .u = {
  645. .isoc = {
  646. .framesperurb = 4,
  647. .framesize = 940,
  648. .interval = 1,
  649. }
  650. }
  651. }
  652. }},
  653. },
  654. },
  655. .power_ctrl = ttusb2_power_ctrl,
  656. .identify_state = ttusb2_identify_state,
  657. .i2c_algo = &ttusb2_i2c_algo,
  658. .generic_bulk_ctrl_endpoint = 0x01,
  659. .num_device_descs = 1,
  660. .devices = {
  661. { "Technotrend TT-connect CT-3650",
  662. .warm_ids = { &ttusb2_table[TECHNOTREND_CONNECT_CT3650], NULL },
  663. },
  664. }
  665. };
  666. static struct usb_driver ttusb2_driver = {
  667. .name = "dvb_usb_ttusb2",
  668. .probe = ttusb2_probe,
  669. .disconnect = ttusb2_usb_disconnect,
  670. .id_table = ttusb2_table,
  671. };
  672. module_usb_driver(ttusb2_driver);
  673. MODULE_AUTHOR("Patrick Boettcher <[email protected]>");
  674. MODULE_DESCRIPTION("Driver for Pinnacle PCTV 400e DVB-S USB2.0");
  675. MODULE_VERSION("1.0");
  676. MODULE_LICENSE("GPL");