ttusb2.c 18 KB

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