dw2102.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. /* DVB USB framework compliant Linux driver for the
  2. * DVBWorld DVB-S 2101, 2102, DVB-S2 2104 Card
  3. *
  4. * Copyright (C) 2008 Igor M. Liplianin (liplianin@me.by)
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation, version 2.
  9. *
  10. * see Documentation/dvb/README.dvb-usb for more information
  11. */
  12. #include <linux/version.h>
  13. #include "dw2102.h"
  14. #include "stv0299.h"
  15. #include "z0194a.h"
  16. #include "cx24116.h"
  17. #ifndef USB_PID_DW2102
  18. #define USB_PID_DW2102 0x2102
  19. #endif
  20. #ifndef USB_PID_DW2104
  21. #define USB_PID_DW2104 0x2104
  22. #endif
  23. #define DW2102_READ_MSG 0
  24. #define DW2102_WRITE_MSG 1
  25. #define REG_1F_SYMBOLRATE_BYTE0 0x1f
  26. #define REG_20_SYMBOLRATE_BYTE1 0x20
  27. #define REG_21_SYMBOLRATE_BYTE2 0x21
  28. /* on my own*/
  29. #define DW2102_VOLTAGE_CTRL (0x1800)
  30. #define DW2102_RC_QUERY (0x1a00)
  31. struct dw2102_state {
  32. u32 last_key_pressed;
  33. };
  34. struct dw2102_rc_keys {
  35. u32 keycode;
  36. u32 event;
  37. };
  38. /* debug */
  39. static int dvb_usb_dw2102_debug;
  40. module_param_named(debug, dvb_usb_dw2102_debug, int, 0644);
  41. MODULE_PARM_DESC(debug, "set debugging level (1=info 2=xfer (or-able))." DVB_USB_DEBUG_STATUS);
  42. DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
  43. static int dw2102_op_rw(struct usb_device *dev, u8 request, u16 value,
  44. u16 index, u8 * data, u16 len, int flags)
  45. {
  46. int ret;
  47. u8 u8buf[len];
  48. unsigned int pipe = (flags == DW2102_READ_MSG) ?
  49. usb_rcvctrlpipe(dev, 0) : usb_sndctrlpipe(dev, 0);
  50. u8 request_type = (flags == DW2102_READ_MSG) ? USB_DIR_IN : USB_DIR_OUT;
  51. if (flags == DW2102_WRITE_MSG)
  52. memcpy(u8buf, data, len);
  53. ret = usb_control_msg(dev, pipe, request, request_type | USB_TYPE_VENDOR,
  54. value, index , u8buf, len, 2000);
  55. if (flags == DW2102_READ_MSG)
  56. memcpy(data, u8buf, len);
  57. return ret;
  58. }
  59. /* I2C */
  60. static int dw2102_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],
  61. int num)
  62. {
  63. struct dvb_usb_device *d = i2c_get_adapdata(adap);
  64. int i = 0, ret = 0;
  65. u8 buf6[] = {0x2c, 0x05, 0xc0, 0, 0, 0, 0};
  66. u16 value;
  67. if (!d)
  68. return -ENODEV;
  69. if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
  70. return -EAGAIN;
  71. switch (num) {
  72. case 2:
  73. /* read stv0299 register */
  74. value = msg[0].buf[0];/* register */
  75. for (i = 0; i < msg[1].len; i++) {
  76. value = value + i;
  77. ret = dw2102_op_rw(d->udev, 0xb5, value, 0,
  78. buf6, 2, DW2102_READ_MSG);
  79. msg[1].buf[i] = buf6[0];
  80. }
  81. break;
  82. case 1:
  83. switch (msg[0].addr) {
  84. case 0x68:
  85. /* write to stv0299 register */
  86. buf6[0] = 0x2a;
  87. buf6[1] = msg[0].buf[0];
  88. buf6[2] = msg[0].buf[1];
  89. ret = dw2102_op_rw(d->udev, 0xb2, 0, 0,
  90. buf6, 3, DW2102_WRITE_MSG);
  91. break;
  92. case 0x60:
  93. if (msg[0].flags == 0) {
  94. /* write to tuner pll */
  95. buf6[0] = 0x2c;
  96. buf6[1] = 5;
  97. buf6[2] = 0xc0;
  98. buf6[3] = msg[0].buf[0];
  99. buf6[4] = msg[0].buf[1];
  100. buf6[5] = msg[0].buf[2];
  101. buf6[6] = msg[0].buf[3];
  102. ret = dw2102_op_rw(d->udev, 0xb2, 0, 0,
  103. buf6, 7, DW2102_WRITE_MSG);
  104. } else {
  105. /* read from tuner */
  106. ret = dw2102_op_rw(d->udev, 0xb5, 0,0,
  107. buf6, 1, DW2102_READ_MSG);
  108. msg[0].buf[0] = buf6[0];
  109. }
  110. break;
  111. case (DW2102_RC_QUERY):
  112. ret = dw2102_op_rw(d->udev, 0xb8, 0, 0,
  113. buf6, 2, DW2102_READ_MSG);
  114. msg[0].buf[0] = buf6[0];
  115. msg[0].buf[1] = buf6[1];
  116. break;
  117. case (DW2102_VOLTAGE_CTRL):
  118. buf6[0] = 0x30;
  119. buf6[1] = msg[0].buf[0];
  120. ret = dw2102_op_rw(d->udev, 0xb2, 0, 0,
  121. buf6, 2, DW2102_WRITE_MSG);
  122. break;
  123. }
  124. break;
  125. }
  126. mutex_unlock(&d->i2c_mutex);
  127. return num;
  128. }
  129. static int dw2104_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num)
  130. {
  131. struct dvb_usb_device *d = i2c_get_adapdata(adap);
  132. int ret = 0;
  133. int len, i;
  134. if (!d)
  135. return -ENODEV;
  136. if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
  137. return -EAGAIN;
  138. switch (num) {
  139. case 2: {
  140. /* read */
  141. /* first write first register number */
  142. u8 ibuf [msg[1].len + 2], obuf[3];
  143. obuf[0] = 0xaa;
  144. obuf[1] = msg[0].len;
  145. obuf[2] = msg[0].buf[0];
  146. ret = dw2102_op_rw(d->udev, 0xc2, 0, 0,
  147. obuf, msg[0].len + 2, DW2102_WRITE_MSG);
  148. /* second read registers */
  149. ret = dw2102_op_rw(d->udev, 0xc3, 0xab , 0,
  150. ibuf, msg[1].len + 2, DW2102_READ_MSG);
  151. memcpy(msg[1].buf, ibuf + 2, msg[1].len);
  152. break;
  153. }
  154. case 1:
  155. switch (msg[0].addr) {
  156. case 0x55: {
  157. if (msg[0].buf[0] == 0xf7) {
  158. /* firmware */
  159. /* Write in small blocks */
  160. u8 obuf[19];
  161. obuf[0] = 0xaa;
  162. obuf[1] = 0x11;
  163. obuf[2] = 0xf7;
  164. len = msg[0].len - 1;
  165. i = 1;
  166. do {
  167. memcpy(obuf + 3, msg[0].buf + i, (len > 16 ? 16 : len));
  168. ret = dw2102_op_rw(d->udev, 0xc2, 0, 0,
  169. obuf, (len > 16 ? 16 : len) + 3, DW2102_WRITE_MSG);
  170. i += 16;
  171. len -= 16;
  172. } while (len > 0);
  173. } else {
  174. /* write to register */
  175. u8 obuf[msg[0].len + 2];
  176. obuf[0] = 0xaa;
  177. obuf[1] = msg[0].len;
  178. memcpy(obuf + 2, msg[0].buf, msg[0].len);
  179. ret = dw2102_op_rw(d->udev, 0xc2, 0, 0,
  180. obuf, msg[0].len + 2, DW2102_WRITE_MSG);
  181. }
  182. break;
  183. }
  184. case(DW2102_RC_QUERY): {
  185. u8 ibuf[2];
  186. ret = dw2102_op_rw(d->udev, 0xb8, 0, 0,
  187. ibuf, 2, DW2102_READ_MSG);
  188. memcpy(msg[0].buf, ibuf , 2);
  189. break;
  190. }
  191. case(DW2102_VOLTAGE_CTRL): {
  192. u8 obuf[2];
  193. obuf[0] = 0x30;
  194. obuf[1] = msg[0].buf[0];
  195. ret = dw2102_op_rw(d->udev, 0xb2, 0, 0,
  196. obuf, 2, DW2102_WRITE_MSG);
  197. break;
  198. }
  199. }
  200. break;
  201. }
  202. mutex_unlock(&d->i2c_mutex);
  203. return num;
  204. }
  205. static u32 dw2102_i2c_func(struct i2c_adapter *adapter)
  206. {
  207. return I2C_FUNC_I2C;
  208. }
  209. static struct i2c_algorithm dw2102_i2c_algo = {
  210. .master_xfer = dw2102_i2c_transfer,
  211. .functionality = dw2102_i2c_func,
  212. };
  213. static struct i2c_algorithm dw2104_i2c_algo = {
  214. .master_xfer = dw2104_i2c_transfer,
  215. .functionality = dw2102_i2c_func,
  216. };
  217. static int dw2102_read_mac_address(struct dvb_usb_device *d, u8 mac[6])
  218. {
  219. int i;
  220. u8 ibuf[] = {0, 0};
  221. u8 eeprom[256], eepromline[16];
  222. for (i = 0; i < 256; i++) {
  223. if (dw2102_op_rw(d->udev, 0xb6, 0xa0 , i, ibuf, 2, DW2102_READ_MSG) < 0) {
  224. err("read eeprom failed.");
  225. return -1;
  226. } else {
  227. eepromline[i%16] = ibuf[0];
  228. eeprom[i] = ibuf[0];
  229. }
  230. if ((i % 16) == 15) {
  231. deb_xfer("%02x: ", i - 15);
  232. debug_dump(eepromline, 16, deb_xfer);
  233. }
  234. }
  235. memcpy(mac, eeprom + 8, 6);
  236. return 0;
  237. };
  238. static int dw2102_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
  239. {
  240. static u8 command_13v[1] = {0x00};
  241. static u8 command_18v[1] = {0x01};
  242. struct i2c_msg msg[] = {
  243. {.addr = DW2102_VOLTAGE_CTRL, .flags = 0,
  244. .buf = command_13v, .len = 1},
  245. };
  246. struct dvb_usb_adapter *udev_adap =
  247. (struct dvb_usb_adapter *)(fe->dvb->priv);
  248. if (voltage == SEC_VOLTAGE_18)
  249. msg[0].buf = command_18v;
  250. i2c_transfer(&udev_adap->dev->i2c_adap, msg, 1);
  251. return 0;
  252. }
  253. static struct cx24116_config dw2104_config = {
  254. .demod_address = 0x55,
  255. /*.mpg_clk_pos_pol = 0x01,*/
  256. };
  257. static int dw2104_frontend_attach(struct dvb_usb_adapter *d)
  258. {
  259. if ((d->fe = dvb_attach(cx24116_attach, &dw2104_config,
  260. &d->dev->i2c_adap)) != NULL) {
  261. d->fe->ops.set_voltage = dw2102_set_voltage;
  262. info("Attached cx24116!\n");
  263. return 0;
  264. }
  265. return -EIO;
  266. }
  267. static int dw2102_frontend_attach(struct dvb_usb_adapter *d)
  268. {
  269. d->fe = dvb_attach(stv0299_attach, &sharp_z0194a_config,
  270. &d->dev->i2c_adap);
  271. if (d->fe != NULL) {
  272. d->fe->ops.set_voltage = dw2102_set_voltage;
  273. info("Attached stv0299!\n");
  274. return 0;
  275. }
  276. return -EIO;
  277. }
  278. static int dw2102_tuner_attach(struct dvb_usb_adapter *adap)
  279. {
  280. dvb_attach(dvb_pll_attach, adap->fe, 0x60,
  281. &adap->dev->i2c_adap, DVB_PLL_OPERA1);
  282. return 0;
  283. }
  284. static struct dvb_usb_rc_key dw2102_rc_keys[] = {
  285. { 0xf8, 0x0a, KEY_Q }, /*power*/
  286. { 0xf8, 0x0c, KEY_M }, /*mute*/
  287. { 0xf8, 0x11, KEY_1 },
  288. { 0xf8, 0x12, KEY_2 },
  289. { 0xf8, 0x13, KEY_3 },
  290. { 0xf8, 0x14, KEY_4 },
  291. { 0xf8, 0x15, KEY_5 },
  292. { 0xf8, 0x16, KEY_6 },
  293. { 0xf8, 0x17, KEY_7 },
  294. { 0xf8, 0x18, KEY_8 },
  295. { 0xf8, 0x19, KEY_9 },
  296. { 0xf8, 0x10, KEY_0 },
  297. { 0xf8, 0x1c, KEY_PAGEUP }, /*ch+*/
  298. { 0xf8, 0x0f, KEY_PAGEDOWN }, /*ch-*/
  299. { 0xf8, 0x1a, KEY_O }, /*vol+*/
  300. { 0xf8, 0x0e, KEY_Z }, /*vol-*/
  301. { 0xf8, 0x04, KEY_R }, /*rec*/
  302. { 0xf8, 0x09, KEY_D }, /*fav*/
  303. { 0xf8, 0x08, KEY_BACKSPACE }, /*rewind*/
  304. { 0xf8, 0x07, KEY_A }, /*fast*/
  305. { 0xf8, 0x0b, KEY_P }, /*pause*/
  306. { 0xf8, 0x02, KEY_ESC }, /*cancel*/
  307. { 0xf8, 0x03, KEY_G }, /*tab*/
  308. { 0xf8, 0x00, KEY_UP }, /*up*/
  309. { 0xf8, 0x1f, KEY_ENTER }, /*ok*/
  310. { 0xf8, 0x01, KEY_DOWN }, /*down*/
  311. { 0xf8, 0x05, KEY_C }, /*cap*/
  312. { 0xf8, 0x06, KEY_S }, /*stop*/
  313. { 0xf8, 0x40, KEY_F }, /*full*/
  314. { 0xf8, 0x1e, KEY_W }, /*tvmode*/
  315. { 0xf8, 0x1b, KEY_B }, /*recall*/
  316. };
  317. static int dw2102_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
  318. {
  319. struct dw2102_state *st = d->priv;
  320. u8 key[2];
  321. struct i2c_msg msg[] = {
  322. {.addr = DW2102_RC_QUERY, .flags = I2C_M_RD, .buf = key,
  323. .len = 2},
  324. };
  325. int i;
  326. *state = REMOTE_NO_KEY_PRESSED;
  327. if (dw2102_i2c_transfer(&d->i2c_adap, msg, 1) == 1) {
  328. for (i = 0; i < ARRAY_SIZE(dw2102_rc_keys); i++) {
  329. if (dw2102_rc_keys[i].data == msg[0].buf[0]) {
  330. *state = REMOTE_KEY_PRESSED;
  331. *event = dw2102_rc_keys[i].event;
  332. st->last_key_pressed =
  333. dw2102_rc_keys[i].event;
  334. break;
  335. }
  336. st->last_key_pressed = 0;
  337. }
  338. }
  339. /* info("key: %x %x\n",key[0],key[1]); */
  340. return 0;
  341. }
  342. static struct usb_device_id dw2102_table[] = {
  343. {USB_DEVICE(USB_VID_CYPRESS, USB_PID_DW2102)},
  344. {USB_DEVICE(USB_VID_CYPRESS, 0x2101)},
  345. {USB_DEVICE(USB_VID_CYPRESS, 0x2104)},
  346. {USB_DEVICE(0x9022, 0xd650)},
  347. { }
  348. };
  349. MODULE_DEVICE_TABLE(usb, dw2102_table);
  350. static int dw2102_load_firmware(struct usb_device *dev,
  351. const struct firmware *frmwr)
  352. {
  353. u8 *b, *p;
  354. int ret = 0, i;
  355. u8 reset;
  356. u8 reset16 [] = {0, 0, 0, 0, 0, 0, 0};
  357. const struct firmware *fw;
  358. const char *filename = "dvb-usb-dw2101.fw";
  359. switch (dev->descriptor.idProduct) {
  360. case 0x2101:
  361. ret = request_firmware(&fw, filename, &dev->dev);
  362. if (ret != 0) {
  363. err("did not find the firmware file. (%s) "
  364. "Please see linux/Documentation/dvb/ for more details "
  365. "on firmware-problems.", filename);
  366. return ret;
  367. }
  368. break;
  369. default:
  370. fw = frmwr;
  371. break;
  372. }
  373. info("start downloading DW210X firmware");
  374. p = kmalloc(fw->size, GFP_KERNEL);
  375. reset = 1;
  376. /*stop the CPU*/
  377. dw2102_op_rw(dev, 0xa0, 0x7f92, 0, &reset, 1, DW2102_WRITE_MSG);
  378. dw2102_op_rw(dev, 0xa0, 0xe600, 0, &reset, 1, DW2102_WRITE_MSG);
  379. if (p != NULL) {
  380. memcpy(p, fw->data, fw->size);
  381. for (i = 0; i < fw->size; i += 0x40) {
  382. b = (u8 *) p + i;
  383. if (dw2102_op_rw(dev, 0xa0, i, 0, b , 0x40,
  384. DW2102_WRITE_MSG) != 0x40) {
  385. err("error while transferring firmware");
  386. ret = -EINVAL;
  387. break;
  388. }
  389. }
  390. /* restart the CPU */
  391. reset = 0;
  392. if (ret || dw2102_op_rw(dev, 0xa0, 0x7f92, 0, &reset, 1,
  393. DW2102_WRITE_MSG) != 1) {
  394. err("could not restart the USB controller CPU.");
  395. ret = -EINVAL;
  396. }
  397. if (ret || dw2102_op_rw(dev, 0xa0, 0xe600, 0, &reset, 1,
  398. DW2102_WRITE_MSG) != 1) {
  399. err("could not restart the USB controller CPU.");
  400. ret = -EINVAL;
  401. }
  402. /* init registers */
  403. switch (dev->descriptor.idProduct) {
  404. case USB_PID_DW2104:
  405. case 0xd650:
  406. reset = 1;
  407. dw2102_op_rw(dev, 0xc4, 0x0000, 0, &reset, 1,
  408. DW2102_WRITE_MSG);
  409. reset = 0;
  410. dw2102_op_rw(dev, 0xbf, 0x0040, 0, &reset, 0,
  411. DW2102_WRITE_MSG);
  412. break;
  413. case USB_PID_DW2102:
  414. dw2102_op_rw(dev, 0xbf, 0x0040, 0, &reset, 0,
  415. DW2102_WRITE_MSG);
  416. dw2102_op_rw(dev, 0xb9, 0x0000, 0, &reset16[0], 2,
  417. DW2102_READ_MSG);
  418. break;
  419. case 0x2101:
  420. dw2102_op_rw(dev, 0xbc, 0x0030, 0, &reset16[0], 2,
  421. DW2102_READ_MSG);
  422. dw2102_op_rw(dev, 0xba, 0x0000, 0, &reset16[0], 7,
  423. DW2102_READ_MSG);
  424. dw2102_op_rw(dev, 0xba, 0x0000, 0, &reset16[0], 7,
  425. DW2102_READ_MSG);
  426. dw2102_op_rw(dev, 0xb9, 0x0000, 0, &reset16[0], 2,
  427. DW2102_READ_MSG);
  428. break;
  429. }
  430. msleep(100);
  431. kfree(p);
  432. }
  433. return ret;
  434. }
  435. static struct dvb_usb_device_properties dw2102_properties = {
  436. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  437. .usb_ctrl = DEVICE_SPECIFIC,
  438. .firmware = "dvb-usb-dw2102.fw",
  439. .size_of_priv = sizeof(struct dw2102_state),
  440. .no_reconnect = 1,
  441. .i2c_algo = &dw2102_i2c_algo,
  442. .rc_key_map = dw2102_rc_keys,
  443. .rc_key_map_size = ARRAY_SIZE(dw2102_rc_keys),
  444. .rc_interval = 150,
  445. .rc_query = dw2102_rc_query,
  446. .generic_bulk_ctrl_endpoint = 0x81,
  447. /* parameter for the MPEG2-data transfer */
  448. .num_adapters = 1,
  449. .download_firmware = dw2102_load_firmware,
  450. .read_mac_address = dw2102_read_mac_address,
  451. .adapter = {
  452. {
  453. .frontend_attach = dw2102_frontend_attach,
  454. .streaming_ctrl = NULL,
  455. .tuner_attach = dw2102_tuner_attach,
  456. .stream = {
  457. .type = USB_BULK,
  458. .count = 8,
  459. .endpoint = 0x82,
  460. .u = {
  461. .bulk = {
  462. .buffersize = 4096,
  463. }
  464. }
  465. },
  466. }
  467. },
  468. .num_device_descs = 2,
  469. .devices = {
  470. {"DVBWorld DVB-S 2102 USB2.0",
  471. {&dw2102_table[0], NULL},
  472. {NULL},
  473. },
  474. {"DVBWorld DVB-S 2101 USB2.0",
  475. {&dw2102_table[1], NULL},
  476. {NULL},
  477. },
  478. }
  479. };
  480. static struct dvb_usb_device_properties dw2104_properties = {
  481. .caps = DVB_USB_IS_AN_I2C_ADAPTER,
  482. .usb_ctrl = DEVICE_SPECIFIC,
  483. .firmware = "dvb-usb-dw2104.fw",
  484. .size_of_priv = sizeof(struct dw2102_state),
  485. .no_reconnect = 1,
  486. .i2c_algo = &dw2104_i2c_algo,
  487. .rc_key_map = dw2102_rc_keys,
  488. .rc_key_map_size = ARRAY_SIZE(dw2102_rc_keys),
  489. .rc_interval = 150,
  490. .rc_query = dw2102_rc_query,
  491. .generic_bulk_ctrl_endpoint = 0x81,
  492. /* parameter for the MPEG2-data transfer */
  493. .num_adapters = 1,
  494. .download_firmware = dw2102_load_firmware,
  495. .read_mac_address = dw2102_read_mac_address,
  496. .adapter = {
  497. {
  498. .frontend_attach = dw2104_frontend_attach,
  499. .streaming_ctrl = NULL,
  500. /*.tuner_attach = dw2104_tuner_attach,*/
  501. .stream = {
  502. .type = USB_BULK,
  503. .count = 8,
  504. .endpoint = 0x82,
  505. .u = {
  506. .bulk = {
  507. .buffersize = 4096,
  508. }
  509. }
  510. },
  511. }
  512. },
  513. .num_device_descs = 2,
  514. .devices = {
  515. { "DVBWorld DW2104 USB2.0",
  516. {&dw2102_table[2], NULL},
  517. {NULL},
  518. },
  519. { "TeVii S650 USB2.0",
  520. {&dw2102_table[3], NULL},
  521. {NULL},
  522. },
  523. }
  524. };
  525. static int dw2102_probe(struct usb_interface *intf,
  526. const struct usb_device_id *id)
  527. {
  528. if (0 == dvb_usb_device_init(intf, &dw2102_properties,
  529. THIS_MODULE, NULL, adapter_nr) ||
  530. 0 == dvb_usb_device_init(intf, &dw2104_properties,
  531. THIS_MODULE, NULL, adapter_nr)) {
  532. return 0;
  533. }
  534. return -ENODEV;
  535. }
  536. static struct usb_driver dw2102_driver = {
  537. .name = "dw2102",
  538. .probe = dw2102_probe,
  539. .disconnect = dvb_usb_device_exit,
  540. .id_table = dw2102_table,
  541. };
  542. static int __init dw2102_module_init(void)
  543. {
  544. int ret = usb_register(&dw2102_driver);
  545. if (ret)
  546. err("usb_register failed. Error number %d", ret);
  547. return ret;
  548. }
  549. static void __exit dw2102_module_exit(void)
  550. {
  551. usb_deregister(&dw2102_driver);
  552. }
  553. module_init(dw2102_module_init);
  554. module_exit(dw2102_module_exit);
  555. MODULE_AUTHOR("Igor M. Liplianin (c) liplianin@me.by");
  556. MODULE_DESCRIPTION("Driver for DVBWorld DVB-S 2101, 2102, DVB-S2 2104 USB2.0 device");
  557. MODULE_VERSION("0.1");
  558. MODULE_LICENSE("GPL");