cx88-dvb.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623
  1. /*
  2. *
  3. * device driver for Conexant 2388x based TV cards
  4. * MPEG Transport Stream (DVB) routines
  5. *
  6. * (c) 2004 Chris Pascoe <c.pascoe@itee.uq.edu.au>
  7. * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22. */
  23. #include <linux/module.h>
  24. #include <linux/init.h>
  25. #include <linux/device.h>
  26. #include <linux/fs.h>
  27. #include <linux/kthread.h>
  28. #include <linux/file.h>
  29. #include <linux/suspend.h>
  30. #include "cx88.h"
  31. #include "dvb-pll.h"
  32. #ifdef HAVE_MT352
  33. # include "mt352.h"
  34. # include "mt352_priv.h"
  35. #endif
  36. #ifdef HAVE_CX22702
  37. # include "cx22702.h"
  38. #endif
  39. #ifdef HAVE_OR51132
  40. # include "or51132.h"
  41. #endif
  42. #ifdef HAVE_LGDT330X
  43. # include "lgdt330x.h"
  44. #endif
  45. #ifdef HAVE_NXT200X
  46. # include "nxt200x.h"
  47. #endif
  48. #ifdef HAVE_CX24123
  49. # include "cx24123.h"
  50. #endif
  51. MODULE_DESCRIPTION("driver for cx2388x based DVB cards");
  52. MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
  53. MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
  54. MODULE_LICENSE("GPL");
  55. static unsigned int debug = 0;
  56. module_param(debug, int, 0644);
  57. MODULE_PARM_DESC(debug,"enable debug messages [dvb]");
  58. #define dprintk(level,fmt, arg...) if (debug >= level) \
  59. printk(KERN_DEBUG "%s/2-dvb: " fmt, dev->core->name , ## arg)
  60. /* ------------------------------------------------------------------ */
  61. static int dvb_buf_setup(struct videobuf_queue *q,
  62. unsigned int *count, unsigned int *size)
  63. {
  64. struct cx8802_dev *dev = q->priv_data;
  65. dev->ts_packet_size = 188 * 4;
  66. dev->ts_packet_count = 32;
  67. *size = dev->ts_packet_size * dev->ts_packet_count;
  68. *count = 32;
  69. return 0;
  70. }
  71. static int dvb_buf_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
  72. enum v4l2_field field)
  73. {
  74. struct cx8802_dev *dev = q->priv_data;
  75. return cx8802_buf_prepare(dev, (struct cx88_buffer*)vb,field);
  76. }
  77. static void dvb_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb)
  78. {
  79. struct cx8802_dev *dev = q->priv_data;
  80. cx8802_buf_queue(dev, (struct cx88_buffer*)vb);
  81. }
  82. static void dvb_buf_release(struct videobuf_queue *q, struct videobuf_buffer *vb)
  83. {
  84. struct cx8802_dev *dev = q->priv_data;
  85. cx88_free_buffer(dev->pci, (struct cx88_buffer*)vb);
  86. }
  87. static struct videobuf_queue_ops dvb_qops = {
  88. .buf_setup = dvb_buf_setup,
  89. .buf_prepare = dvb_buf_prepare,
  90. .buf_queue = dvb_buf_queue,
  91. .buf_release = dvb_buf_release,
  92. };
  93. /* ------------------------------------------------------------------ */
  94. #ifdef HAVE_MT352
  95. static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe)
  96. {
  97. static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 };
  98. static u8 reset [] = { RESET, 0x80 };
  99. static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
  100. static u8 agc_cfg [] = { AGC_TARGET, 0x24, 0x20 };
  101. static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 };
  102. static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
  103. mt352_write(fe, clock_config, sizeof(clock_config));
  104. udelay(200);
  105. mt352_write(fe, reset, sizeof(reset));
  106. mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
  107. mt352_write(fe, agc_cfg, sizeof(agc_cfg));
  108. mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg));
  109. mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
  110. return 0;
  111. }
  112. static int dntv_live_dvbt_demod_init(struct dvb_frontend* fe)
  113. {
  114. static u8 clock_config [] = { 0x89, 0x38, 0x39 };
  115. static u8 reset [] = { 0x50, 0x80 };
  116. static u8 adc_ctl_1_cfg [] = { 0x8E, 0x40 };
  117. static u8 agc_cfg [] = { 0x67, 0x10, 0x23, 0x00, 0xFF, 0xFF,
  118. 0x00, 0xFF, 0x00, 0x40, 0x40 };
  119. static u8 dntv_extra[] = { 0xB5, 0x7A };
  120. static u8 capt_range_cfg[] = { 0x75, 0x32 };
  121. mt352_write(fe, clock_config, sizeof(clock_config));
  122. udelay(2000);
  123. mt352_write(fe, reset, sizeof(reset));
  124. mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
  125. mt352_write(fe, agc_cfg, sizeof(agc_cfg));
  126. udelay(2000);
  127. mt352_write(fe, dntv_extra, sizeof(dntv_extra));
  128. mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
  129. return 0;
  130. }
  131. static int mt352_pll_set(struct dvb_frontend* fe,
  132. struct dvb_frontend_parameters* params,
  133. u8* pllbuf)
  134. {
  135. struct cx8802_dev *dev= fe->dvb->priv;
  136. pllbuf[0] = dev->core->pll_addr << 1;
  137. dvb_pll_configure(dev->core->pll_desc, pllbuf+1,
  138. params->frequency,
  139. params->u.ofdm.bandwidth);
  140. return 0;
  141. }
  142. static struct mt352_config dvico_fusionhdtv = {
  143. .demod_address = 0x0F,
  144. .demod_init = dvico_fusionhdtv_demod_init,
  145. .pll_set = mt352_pll_set,
  146. };
  147. static struct mt352_config dntv_live_dvbt_config = {
  148. .demod_address = 0x0f,
  149. .demod_init = dntv_live_dvbt_demod_init,
  150. .pll_set = mt352_pll_set,
  151. };
  152. #endif
  153. #ifdef HAVE_CX22702
  154. static struct cx22702_config connexant_refboard_config = {
  155. .demod_address = 0x43,
  156. .output_mode = CX22702_SERIAL_OUTPUT,
  157. .pll_address = 0x60,
  158. .pll_desc = &dvb_pll_thomson_dtt7579,
  159. };
  160. static struct cx22702_config hauppauge_novat_config = {
  161. .demod_address = 0x43,
  162. .output_mode = CX22702_SERIAL_OUTPUT,
  163. .pll_address = 0x61,
  164. .pll_desc = &dvb_pll_thomson_dtt759x,
  165. };
  166. static struct cx22702_config hauppauge_hvr1100_config = {
  167. .demod_address = 0x63,
  168. .output_mode = CX22702_SERIAL_OUTPUT,
  169. .pll_address = 0x61,
  170. .pll_desc = &dvb_pll_fmd1216me,
  171. };
  172. #endif
  173. #ifdef HAVE_OR51132
  174. static int or51132_set_ts_param(struct dvb_frontend* fe,
  175. int is_punctured)
  176. {
  177. struct cx8802_dev *dev= fe->dvb->priv;
  178. dev->ts_gen_cntrl = is_punctured ? 0x04 : 0x00;
  179. return 0;
  180. }
  181. static struct or51132_config pchdtv_hd3000 = {
  182. .demod_address = 0x15,
  183. .pll_address = 0x61,
  184. .pll_desc = &dvb_pll_thomson_dtt7610,
  185. .set_ts_params = or51132_set_ts_param,
  186. };
  187. #endif
  188. #ifdef HAVE_LGDT330X
  189. static int lgdt330x_pll_set(struct dvb_frontend* fe,
  190. struct dvb_frontend_parameters* params)
  191. {
  192. /* FIXME make this routine use the tuner-simple code.
  193. * It could probably be shared with a number of ATSC
  194. * frontends. Many share the same tuner with analog TV. */
  195. struct cx8802_dev *dev= fe->dvb->priv;
  196. struct cx88_core *core = dev->core;
  197. u8 buf[4];
  198. struct i2c_msg msg =
  199. { .addr = dev->core->pll_addr, .flags = 0, .buf = buf, .len = 4 };
  200. int err;
  201. /* Put the analog decoder in standby to keep it quiet */
  202. cx88_call_i2c_clients (dev->core, TUNER_SET_STANDBY, NULL);
  203. dvb_pll_configure(core->pll_desc, buf, params->frequency, 0);
  204. dprintk(1, "%s: tuner at 0x%02x bytes: 0x%02x 0x%02x 0x%02x 0x%02x\n",
  205. __FUNCTION__, msg.addr, buf[0],buf[1],buf[2],buf[3]);
  206. if ((err = i2c_transfer(&core->i2c_adap, &msg, 1)) != 1) {
  207. printk(KERN_WARNING "cx88-dvb: %s error "
  208. "(addr %02x <- %02x, err = %i)\n",
  209. __FUNCTION__, buf[0], buf[1], err);
  210. if (err < 0)
  211. return err;
  212. else
  213. return -EREMOTEIO;
  214. }
  215. if (core->tuner_type == TUNER_LG_TDVS_H062F) {
  216. /* Set the Auxiliary Byte. */
  217. buf[2] &= ~0x20;
  218. buf[2] |= 0x18;
  219. buf[3] = 0x50;
  220. i2c_transfer(&core->i2c_adap, &msg, 1);
  221. }
  222. return 0;
  223. }
  224. static int lgdt330x_pll_rf_set(struct dvb_frontend* fe, int index)
  225. {
  226. struct cx8802_dev *dev= fe->dvb->priv;
  227. struct cx88_core *core = dev->core;
  228. dprintk(1, "%s: index = %d\n", __FUNCTION__, index);
  229. if (index == 0)
  230. cx_clear(MO_GP0_IO, 8);
  231. else
  232. cx_set(MO_GP0_IO, 8);
  233. return 0;
  234. }
  235. static int lgdt330x_set_ts_param(struct dvb_frontend* fe, int is_punctured)
  236. {
  237. struct cx8802_dev *dev= fe->dvb->priv;
  238. if (is_punctured)
  239. dev->ts_gen_cntrl |= 0x04;
  240. else
  241. dev->ts_gen_cntrl &= ~0x04;
  242. return 0;
  243. }
  244. static struct lgdt330x_config fusionhdtv_3_gold = {
  245. .demod_address = 0x0e,
  246. .demod_chip = LGDT3302,
  247. .serial_mpeg = 0x04, /* TPSERIAL for 3302 in TOP_CONTROL */
  248. .pll_set = lgdt330x_pll_set,
  249. .set_ts_params = lgdt330x_set_ts_param,
  250. };
  251. static struct lgdt330x_config fusionhdtv_5_gold = {
  252. .demod_address = 0x0e,
  253. .demod_chip = LGDT3303,
  254. .serial_mpeg = 0x40, /* TPSERIAL for 3303 in TOP_CONTROL */
  255. .pll_set = lgdt330x_pll_set,
  256. .set_ts_params = lgdt330x_set_ts_param,
  257. };
  258. #endif
  259. #ifdef HAVE_NXT200X
  260. static int nxt200x_set_ts_param(struct dvb_frontend* fe,
  261. int is_punctured)
  262. {
  263. struct cx8802_dev *dev= fe->dvb->priv;
  264. dev->ts_gen_cntrl = is_punctured ? 0x04 : 0x00;
  265. return 0;
  266. }
  267. static int nxt200x_set_pll_input(u8* buf, int input)
  268. {
  269. if (input)
  270. buf[3] |= 0x08;
  271. else
  272. buf[3] &= ~0x08;
  273. return 0;
  274. }
  275. static struct nxt200x_config ati_hdtvwonder = {
  276. .demod_address = 0x0a,
  277. .pll_address = 0x61,
  278. .pll_desc = &dvb_pll_tuv1236d,
  279. .set_pll_input = nxt200x_set_pll_input,
  280. .set_ts_params = nxt200x_set_ts_param,
  281. };
  282. #endif
  283. #ifdef HAVE_CX24123
  284. static int cx24123_set_ts_param(struct dvb_frontend* fe,
  285. int is_punctured)
  286. {
  287. struct cx8802_dev *dev= fe->dvb->priv;
  288. dev->ts_gen_cntrl = 0x2;
  289. return 0;
  290. }
  291. static void cx24123_enable_lnb_voltage(struct dvb_frontend* fe, int on)
  292. {
  293. struct cx8802_dev *dev= fe->dvb->priv;
  294. struct cx88_core *core = dev->core;
  295. if (on)
  296. cx_write(MO_GP0_IO, 0x000006f9);
  297. else
  298. cx_write(MO_GP0_IO, 0x000006fB);
  299. }
  300. static struct cx24123_config hauppauge_novas_config = {
  301. .demod_address = 0x55,
  302. .use_isl6421 = 1,
  303. .set_ts_params = cx24123_set_ts_param,
  304. };
  305. static struct cx24123_config kworld_dvbs_100_config = {
  306. .demod_address = 0x15,
  307. .use_isl6421 = 0,
  308. .set_ts_params = cx24123_set_ts_param,
  309. .enable_lnb_voltage = cx24123_enable_lnb_voltage,
  310. };
  311. #endif
  312. static int dvb_register(struct cx8802_dev *dev)
  313. {
  314. /* init struct videobuf_dvb */
  315. dev->dvb.name = dev->core->name;
  316. dev->ts_gen_cntrl = 0x0c;
  317. /* init frontend */
  318. switch (dev->core->board) {
  319. #ifdef HAVE_CX22702
  320. case CX88_BOARD_HAUPPAUGE_DVB_T1:
  321. dev->dvb.frontend = cx22702_attach(&hauppauge_novat_config,
  322. &dev->core->i2c_adap);
  323. break;
  324. case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1:
  325. case CX88_BOARD_CONEXANT_DVB_T1:
  326. case CX88_BOARD_WINFAST_DTV1000:
  327. dev->dvb.frontend = cx22702_attach(&connexant_refboard_config,
  328. &dev->core->i2c_adap);
  329. break;
  330. case CX88_BOARD_HAUPPAUGE_HVR1100:
  331. case CX88_BOARD_HAUPPAUGE_HVR1100LP:
  332. dev->dvb.frontend = cx22702_attach(&hauppauge_hvr1100_config,
  333. &dev->core->i2c_adap);
  334. break;
  335. #endif
  336. #ifdef HAVE_MT352
  337. case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1:
  338. dev->core->pll_addr = 0x61;
  339. dev->core->pll_desc = &dvb_pll_lg_z201;
  340. dev->dvb.frontend = mt352_attach(&dvico_fusionhdtv,
  341. &dev->core->i2c_adap);
  342. break;
  343. case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS:
  344. dev->core->pll_addr = 0x60;
  345. dev->core->pll_desc = &dvb_pll_thomson_dtt7579;
  346. dev->dvb.frontend = mt352_attach(&dvico_fusionhdtv,
  347. &dev->core->i2c_adap);
  348. break;
  349. case CX88_BOARD_KWORLD_DVB_T:
  350. case CX88_BOARD_DNTV_LIVE_DVB_T:
  351. case CX88_BOARD_ADSTECH_DVB_T_PCI:
  352. dev->core->pll_addr = 0x61;
  353. dev->core->pll_desc = &dvb_pll_unknown_1;
  354. dev->dvb.frontend = mt352_attach(&dntv_live_dvbt_config,
  355. &dev->core->i2c_adap);
  356. break;
  357. #endif
  358. #ifdef HAVE_OR51132
  359. case CX88_BOARD_PCHDTV_HD3000:
  360. dev->dvb.frontend = or51132_attach(&pchdtv_hd3000,
  361. &dev->core->i2c_adap);
  362. break;
  363. #endif
  364. #ifdef HAVE_LGDT330X
  365. case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q:
  366. dev->ts_gen_cntrl = 0x08;
  367. {
  368. /* Do a hardware reset of chip before using it. */
  369. struct cx88_core *core = dev->core;
  370. cx_clear(MO_GP0_IO, 1);
  371. mdelay(100);
  372. cx_set(MO_GP0_IO, 1);
  373. mdelay(200);
  374. /* Select RF connector callback */
  375. fusionhdtv_3_gold.pll_rf_set = lgdt330x_pll_rf_set;
  376. dev->core->pll_addr = 0x61;
  377. dev->core->pll_desc = &dvb_pll_microtune_4042;
  378. dev->dvb.frontend = lgdt330x_attach(&fusionhdtv_3_gold,
  379. &dev->core->i2c_adap);
  380. }
  381. break;
  382. case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T:
  383. dev->ts_gen_cntrl = 0x08;
  384. {
  385. /* Do a hardware reset of chip before using it. */
  386. struct cx88_core *core = dev->core;
  387. cx_clear(MO_GP0_IO, 1);
  388. mdelay(100);
  389. cx_set(MO_GP0_IO, 9);
  390. mdelay(200);
  391. dev->core->pll_addr = 0x61;
  392. dev->core->pll_desc = &dvb_pll_thomson_dtt7611;
  393. dev->dvb.frontend = lgdt330x_attach(&fusionhdtv_3_gold,
  394. &dev->core->i2c_adap);
  395. }
  396. break;
  397. case CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD:
  398. dev->ts_gen_cntrl = 0x08;
  399. {
  400. /* Do a hardware reset of chip before using it. */
  401. struct cx88_core *core = dev->core;
  402. cx_clear(MO_GP0_IO, 1);
  403. mdelay(100);
  404. cx_set(MO_GP0_IO, 1);
  405. mdelay(200);
  406. dev->core->pll_addr = 0x61;
  407. dev->core->pll_desc = &dvb_pll_tdvs_tua6034;
  408. dev->dvb.frontend = lgdt330x_attach(&fusionhdtv_5_gold,
  409. &dev->core->i2c_adap);
  410. }
  411. break;
  412. #endif
  413. #ifdef HAVE_NXT200X
  414. case CX88_BOARD_ATI_HDTVWONDER:
  415. dev->dvb.frontend = nxt200x_attach(&ati_hdtvwonder,
  416. &dev->core->i2c_adap);
  417. break;
  418. #endif
  419. #ifdef HAVE_CX24123
  420. case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1:
  421. case CX88_BOARD_HAUPPAUGE_NOVASE2_S1:
  422. dev->dvb.frontend = cx24123_attach(&hauppauge_novas_config,
  423. &dev->core->i2c_adap);
  424. break;
  425. case CX88_BOARD_KWORLD_DVBS_100:
  426. dev->dvb.frontend = cx24123_attach(&kworld_dvbs_100_config,
  427. &dev->core->i2c_adap);
  428. break;
  429. #endif
  430. default:
  431. printk("%s: The frontend of your DVB/ATSC card isn't supported yet\n",
  432. dev->core->name);
  433. break;
  434. }
  435. if (NULL == dev->dvb.frontend) {
  436. printk("%s: frontend initialization failed\n",dev->core->name);
  437. return -1;
  438. }
  439. if (dev->core->pll_desc) {
  440. dev->dvb.frontend->ops->info.frequency_min = dev->core->pll_desc->min;
  441. dev->dvb.frontend->ops->info.frequency_max = dev->core->pll_desc->max;
  442. }
  443. /* Put the analog decoder in standby to keep it quiet */
  444. cx88_call_i2c_clients (dev->core, TUNER_SET_STANDBY, NULL);
  445. /* register everything */
  446. return videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev);
  447. }
  448. /* ----------------------------------------------------------- */
  449. static int __devinit dvb_probe(struct pci_dev *pci_dev,
  450. const struct pci_device_id *pci_id)
  451. {
  452. struct cx8802_dev *dev;
  453. struct cx88_core *core;
  454. int err;
  455. /* general setup */
  456. core = cx88_core_get(pci_dev);
  457. if (NULL == core)
  458. return -EINVAL;
  459. err = -ENODEV;
  460. if (!cx88_boards[core->board].dvb)
  461. goto fail_core;
  462. err = -ENOMEM;
  463. dev = kmalloc(sizeof(*dev),GFP_KERNEL);
  464. if (NULL == dev)
  465. goto fail_core;
  466. memset(dev,0,sizeof(*dev));
  467. dev->pci = pci_dev;
  468. dev->core = core;
  469. err = cx8802_init_common(dev);
  470. if (0 != err)
  471. goto fail_free;
  472. /* dvb stuff */
  473. printk("%s/2: cx2388x based dvb card\n", core->name);
  474. videobuf_queue_init(&dev->dvb.dvbq, &dvb_qops,
  475. dev->pci, &dev->slock,
  476. V4L2_BUF_TYPE_VIDEO_CAPTURE,
  477. V4L2_FIELD_TOP,
  478. sizeof(struct cx88_buffer),
  479. dev);
  480. err = dvb_register(dev);
  481. if (0 != err)
  482. goto fail_fini;
  483. /* Maintain a reference to cx88-video can query the 8802 device. */
  484. core->dvbdev = dev;
  485. return 0;
  486. fail_fini:
  487. cx8802_fini_common(dev);
  488. fail_free:
  489. kfree(dev);
  490. fail_core:
  491. cx88_core_put(core,pci_dev);
  492. return err;
  493. }
  494. static void __devexit dvb_remove(struct pci_dev *pci_dev)
  495. {
  496. struct cx8802_dev *dev = pci_get_drvdata(pci_dev);
  497. /* Destroy any 8802 reference. */
  498. dev->core->dvbdev = NULL;
  499. /* dvb */
  500. videobuf_dvb_unregister(&dev->dvb);
  501. /* common */
  502. cx8802_fini_common(dev);
  503. cx88_core_put(dev->core,dev->pci);
  504. kfree(dev);
  505. }
  506. static struct pci_device_id cx8802_pci_tbl[] = {
  507. {
  508. .vendor = 0x14f1,
  509. .device = 0x8802,
  510. .subvendor = PCI_ANY_ID,
  511. .subdevice = PCI_ANY_ID,
  512. },{
  513. /* --- end of list --- */
  514. }
  515. };
  516. MODULE_DEVICE_TABLE(pci, cx8802_pci_tbl);
  517. static struct pci_driver dvb_pci_driver = {
  518. .name = "cx88-dvb",
  519. .id_table = cx8802_pci_tbl,
  520. .probe = dvb_probe,
  521. .remove = __devexit_p(dvb_remove),
  522. .suspend = cx8802_suspend_common,
  523. .resume = cx8802_resume_common,
  524. };
  525. static int dvb_init(void)
  526. {
  527. printk(KERN_INFO "cx2388x dvb driver version %d.%d.%d loaded\n",
  528. (CX88_VERSION_CODE >> 16) & 0xff,
  529. (CX88_VERSION_CODE >> 8) & 0xff,
  530. CX88_VERSION_CODE & 0xff);
  531. #ifdef SNAPSHOT
  532. printk(KERN_INFO "cx2388x: snapshot date %04d-%02d-%02d\n",
  533. SNAPSHOT/10000, (SNAPSHOT/100)%100, SNAPSHOT%100);
  534. #endif
  535. return pci_register_driver(&dvb_pci_driver);
  536. }
  537. static void dvb_fini(void)
  538. {
  539. pci_unregister_driver(&dvb_pci_driver);
  540. }
  541. module_init(dvb_init);
  542. module_exit(dvb_fini);
  543. /*
  544. * Local variables:
  545. * c-basic-offset: 8
  546. * compile-command: "make DVB=1"
  547. * End:
  548. */