ttusb2.c 18 KB

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