blob: 53e3f2a7d31aa0f9ed8c4a50f98451920033784f [file] [log] [blame]
Igor M. Liplianina611d0c2008-09-13 10:10:53 -03001/*
2 * dm1105.c - driver for DVB cards based on SDMC DM1105 PCI chip
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
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *
20 */
21
Igor M. Liplianina611d0c2008-09-13 10:10:53 -030022#include <linux/i2c.h>
23#include <linux/init.h>
24#include <linux/kernel.h>
25#include <linux/module.h>
26#include <linux/proc_fs.h>
27#include <linux/pci.h>
28#include <linux/dma-mapping.h>
29#include <linux/input.h>
30#include <media/ir-common.h>
31
32#include "demux.h"
33#include "dmxdev.h"
34#include "dvb_demux.h"
35#include "dvb_frontend.h"
36#include "dvb_net.h"
37#include "dvbdev.h"
38#include "dvb-pll.h"
39
40#include "stv0299.h"
Igor M. Liplianine4aab642008-09-23 15:43:57 -030041#include "stv0288.h"
42#include "stb6000.h"
Igor M. Liplianin04ad28c2008-09-16 18:21:11 -030043#include "si21xx.h"
Igor M. Liplianin35d9c422008-09-13 20:56:59 -030044#include "cx24116.h"
Igor M. Liplianina611d0c2008-09-13 10:10:53 -030045#include "z0194a.h"
46
Igor M. Liplianind8300df2009-07-22 17:30:25 -030047#define UNSET (-1U)
48
49#define DM1105_BOARD_NOAUTO UNSET
50#define DM1105_BOARD_UNKNOWN 0
51#define DM1105_BOARD_DVBWORLD_2002 1
52#define DM1105_BOARD_DVBWORLD_2004 2
53#define DM1105_BOARD_AXESS_DM05 3
54
Igor M. Liplianina611d0c2008-09-13 10:10:53 -030055/* ----------------------------------------------- */
56/*
57 * PCI ID's
58 */
59#ifndef PCI_VENDOR_ID_TRIGEM
60#define PCI_VENDOR_ID_TRIGEM 0x109f
61#endif
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -030062#ifndef PCI_VENDOR_ID_AXESS
63#define PCI_VENDOR_ID_AXESS 0x195d
64#endif
Igor M. Liplianina611d0c2008-09-13 10:10:53 -030065#ifndef PCI_DEVICE_ID_DM1105
66#define PCI_DEVICE_ID_DM1105 0x036f
67#endif
68#ifndef PCI_DEVICE_ID_DW2002
69#define PCI_DEVICE_ID_DW2002 0x2002
70#endif
71#ifndef PCI_DEVICE_ID_DW2004
72#define PCI_DEVICE_ID_DW2004 0x2004
73#endif
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -030074#ifndef PCI_DEVICE_ID_DM05
75#define PCI_DEVICE_ID_DM05 0x1105
76#endif
Igor M. Liplianina611d0c2008-09-13 10:10:53 -030077/* ----------------------------------------------- */
78/* sdmc dm1105 registers */
79
80/* TS Control */
81#define DM1105_TSCTR 0x00
82#define DM1105_DTALENTH 0x04
83
84/* GPIO Interface */
85#define DM1105_GPIOVAL 0x08
86#define DM1105_GPIOCTR 0x0c
87
88/* PID serial number */
89#define DM1105_PIDN 0x10
90
91/* Odd-even secret key select */
92#define DM1105_CWSEL 0x14
93
94/* Host Command Interface */
95#define DM1105_HOST_CTR 0x18
96#define DM1105_HOST_AD 0x1c
97
98/* PCI Interface */
99#define DM1105_CR 0x30
100#define DM1105_RST 0x34
101#define DM1105_STADR 0x38
102#define DM1105_RLEN 0x3c
103#define DM1105_WRP 0x40
104#define DM1105_INTCNT 0x44
105#define DM1105_INTMAK 0x48
106#define DM1105_INTSTS 0x4c
107
108/* CW Value */
109#define DM1105_ODD 0x50
110#define DM1105_EVEN 0x58
111
112/* PID Value */
113#define DM1105_PID 0x60
114
115/* IR Control */
116#define DM1105_IRCTR 0x64
117#define DM1105_IRMODE 0x68
118#define DM1105_SYSTEMCODE 0x6c
119#define DM1105_IRCODE 0x70
120
121/* Unknown Values */
122#define DM1105_ENCRYPT 0x74
123#define DM1105_VER 0x7c
124
125/* I2C Interface */
126#define DM1105_I2CCTR 0x80
127#define DM1105_I2CSTS 0x81
128#define DM1105_I2CDAT 0x82
129#define DM1105_I2C_RA 0x83
130/* ----------------------------------------------- */
131/* Interrupt Mask Bits */
132
133#define INTMAK_TSIRQM 0x01
134#define INTMAK_HIRQM 0x04
135#define INTMAK_IRM 0x08
136#define INTMAK_ALLMASK (INTMAK_TSIRQM | \
137 INTMAK_HIRQM | \
138 INTMAK_IRM)
139#define INTMAK_NONEMASK 0x00
140
141/* Interrupt Status Bits */
142#define INTSTS_TSIRQ 0x01
143#define INTSTS_HIRQ 0x04
144#define INTSTS_IR 0x08
145
146/* IR Control Bits */
147#define DM1105_IR_EN 0x01
148#define DM1105_SYS_CHK 0x02
149#define DM1105_REP_FLG 0x08
150
151/* EEPROM addr */
152#define IIC_24C01_addr 0xa0
153/* Max board count */
154#define DM1105_MAX 0x04
155
156#define DRIVER_NAME "dm1105"
157
158#define DM1105_DMA_PACKETS 47
159#define DM1105_DMA_PACKET_LENGTH (128*4)
160#define DM1105_DMA_BYTES (128 * 4 * DM1105_DMA_PACKETS)
161
162/* GPIO's for LNB power control */
163#define DM1105_LNB_MASK 0x00000000
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300164#define DM1105_LNB_OFF 0x00020000
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300165#define DM1105_LNB_13V 0x00010100
166#define DM1105_LNB_18V 0x00000100
167
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300168/* GPIO's for LNB power control for Axess DM05 */
169#define DM05_LNB_MASK 0x00000000
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300170#define DM05_LNB_OFF 0x00020000/* actually 13v */
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300171#define DM05_LNB_13V 0x00020000
172#define DM05_LNB_18V 0x00030000
173
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300174static unsigned int card[] = {[0 ... 3] = UNSET };
175module_param_array(card, int, NULL, 0444);
176MODULE_PARM_DESC(card, "card type");
177
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300178static int ir_debug;
179module_param(ir_debug, int, 0644);
180MODULE_PARM_DESC(ir_debug, "enable debugging information for IR decoding");
181
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300182static unsigned int dm1105_devcount;
183
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300184DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
185
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300186struct dm1105_board {
187 char *name;
188};
189
190struct dm1105_subid {
191 u16 subvendor;
192 u16 subdevice;
193 u32 card;
194};
195
196static const struct dm1105_board dm1105_boards[] = {
197 [DM1105_BOARD_UNKNOWN] = {
198 .name = "UNKNOWN/GENERIC",
199 },
200 [DM1105_BOARD_DVBWORLD_2002] = {
201 .name = "DVBWorld PCI 2002",
202 },
203 [DM1105_BOARD_DVBWORLD_2004] = {
204 .name = "DVBWorld PCI 2004",
205 },
206 [DM1105_BOARD_AXESS_DM05] = {
207 .name = "Axess/EasyTv DM05",
208 },
209};
210
211static const struct dm1105_subid dm1105_subids[] = {
212 {
213 .subvendor = 0x0000,
214 .subdevice = 0x2002,
215 .card = DM1105_BOARD_DVBWORLD_2002,
216 }, {
217 .subvendor = 0x0001,
218 .subdevice = 0x2002,
219 .card = DM1105_BOARD_DVBWORLD_2002,
220 }, {
221 .subvendor = 0x0000,
222 .subdevice = 0x2004,
223 .card = DM1105_BOARD_DVBWORLD_2004,
224 }, {
225 .subvendor = 0x0001,
226 .subdevice = 0x2004,
227 .card = DM1105_BOARD_DVBWORLD_2004,
228 }, {
229 .subvendor = 0x195d,
230 .subdevice = 0x1105,
231 .card = DM1105_BOARD_AXESS_DM05,
232 },
233};
234
235static void dm1105_card_list(struct pci_dev *pci)
236{
237 int i;
238
239 if (0 == pci->subsystem_vendor &&
240 0 == pci->subsystem_device) {
241 printk(KERN_ERR
242 "dm1105: Your board has no valid PCI Subsystem ID\n"
243 "dm1105: and thus can't be autodetected\n"
244 "dm1105: Please pass card=<n> insmod option to\n"
245 "dm1105: workaround that. Redirect complaints to\n"
246 "dm1105: the vendor of the TV card. Best regards,\n"
247 "dm1105: -- tux\n");
248 } else {
249 printk(KERN_ERR
250 "dm1105: Your board isn't known (yet) to the driver.\n"
251 "dm1105: You can try to pick one of the existing\n"
252 "dm1105: card configs via card=<n> insmod option.\n"
253 "dm1105: Updating to the latest version might help\n"
254 "dm1105: as well.\n");
255 }
256 printk(KERN_ERR "Here is a list of valid choices for the card=<n> "
257 "insmod option:\n");
258 for (i = 0; i < ARRAY_SIZE(dm1105_boards); i++)
259 printk(KERN_ERR "dm1105: card=%d -> %s\n",
260 i, dm1105_boards[i].name);
261}
262
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300263/* infrared remote control */
264struct infrared {
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300265 struct input_dev *input_dev;
Igor M. Liplianinb72857d2009-02-26 03:49:44 -0300266 struct ir_input_state ir;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300267 char input_phys[32];
Igor M. Liplianinb72857d2009-02-26 03:49:44 -0300268 struct work_struct work;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300269 u32 ir_command;
270};
271
272struct dm1105dvb {
273 /* pci */
274 struct pci_dev *pdev;
275 u8 __iomem *io_mem;
276
277 /* ir */
278 struct infrared ir;
279
280 /* dvb */
281 struct dmx_frontend hw_frontend;
282 struct dmx_frontend mem_frontend;
283 struct dmxdev dmxdev;
284 struct dvb_adapter dvb_adapter;
285 struct dvb_demux demux;
286 struct dvb_frontend *fe;
287 struct dvb_net dvbnet;
288 unsigned int full_ts_users;
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300289 unsigned int boardnr;
290 int nr;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300291
292 /* i2c */
293 struct i2c_adapter i2c_adap;
294
Igor M. Liplianind1498ff2009-02-26 03:40:41 -0300295 /* irq */
296 struct work_struct work;
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300297 struct workqueue_struct *wq;
298 char wqn[16];
Igor M. Liplianind1498ff2009-02-26 03:40:41 -0300299
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300300 /* dma */
301 dma_addr_t dma_addr;
302 unsigned char *ts_buf;
303 u32 wrp;
Igor M. Liplianind1498ff2009-02-26 03:40:41 -0300304 u32 nextwrp;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300305 u32 buffer_size;
306 unsigned int PacketErrorCount;
307 unsigned int dmarst;
308 spinlock_t lock;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300309};
310
311#define dm_io_mem(reg) ((unsigned long)(&dm1105dvb->io_mem[reg]))
312
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300313static int dm1105_i2c_xfer(struct i2c_adapter *i2c_adap,
314 struct i2c_msg *msgs, int num)
315{
316 struct dm1105dvb *dm1105dvb ;
317
318 int addr, rc, i, j, k, len, byte, data;
319 u8 status;
320
321 dm1105dvb = i2c_adap->algo_data;
322 for (i = 0; i < num; i++) {
323 outb(0x00, dm_io_mem(DM1105_I2CCTR));
324 if (msgs[i].flags & I2C_M_RD) {
325 /* read bytes */
326 addr = msgs[i].addr << 1;
327 addr |= 1;
328 outb(addr, dm_io_mem(DM1105_I2CDAT));
329 for (byte = 0; byte < msgs[i].len; byte++)
330 outb(0, dm_io_mem(DM1105_I2CDAT + byte + 1));
331
332 outb(0x81 + msgs[i].len, dm_io_mem(DM1105_I2CCTR));
333 for (j = 0; j < 55; j++) {
334 mdelay(10);
335 status = inb(dm_io_mem(DM1105_I2CSTS));
336 if ((status & 0xc0) == 0x40)
337 break;
338 }
339 if (j >= 55)
340 return -1;
341
342 for (byte = 0; byte < msgs[i].len; byte++) {
343 rc = inb(dm_io_mem(DM1105_I2CDAT + byte + 1));
344 if (rc < 0)
345 goto err;
346 msgs[i].buf[byte] = rc;
347 }
348 } else {
349 if ((msgs[i].buf[0] == 0xf7) && (msgs[i].addr == 0x55)) {
350 /* prepaired for cx24116 firmware */
351 /* Write in small blocks */
352 len = msgs[i].len - 1;
353 k = 1;
354 do {
355 outb(msgs[i].addr << 1, dm_io_mem(DM1105_I2CDAT));
356 outb(0xf7, dm_io_mem(DM1105_I2CDAT + 1));
357 for (byte = 0; byte < (len > 48 ? 48 : len); byte++) {
358 data = msgs[i].buf[k+byte];
359 outb(data, dm_io_mem(DM1105_I2CDAT + byte + 2));
360 }
361 outb(0x82 + (len > 48 ? 48 : len), dm_io_mem(DM1105_I2CCTR));
362 for (j = 0; j < 25; j++) {
363 mdelay(10);
364 status = inb(dm_io_mem(DM1105_I2CSTS));
365 if ((status & 0xc0) == 0x40)
366 break;
367 }
368
369 if (j >= 25)
370 return -1;
371
372 k += 48;
373 len -= 48;
374 } while (len > 0);
375 } else {
376 /* write bytes */
377 outb(msgs[i].addr<<1, dm_io_mem(DM1105_I2CDAT));
378 for (byte = 0; byte < msgs[i].len; byte++) {
379 data = msgs[i].buf[byte];
380 outb(data, dm_io_mem(DM1105_I2CDAT + byte + 1));
381 }
382 outb(0x81 + msgs[i].len, dm_io_mem(DM1105_I2CCTR));
383 for (j = 0; j < 25; j++) {
384 mdelay(10);
385 status = inb(dm_io_mem(DM1105_I2CSTS));
386 if ((status & 0xc0) == 0x40)
387 break;
388 }
389
390 if (j >= 25)
391 return -1;
392 }
393 }
394 }
395 return num;
396 err:
397 return rc;
398}
399
400static u32 functionality(struct i2c_adapter *adap)
401{
402 return I2C_FUNC_I2C;
403}
404
405static struct i2c_algorithm dm1105_algo = {
406 .master_xfer = dm1105_i2c_xfer,
407 .functionality = functionality,
408};
409
410static inline struct dm1105dvb *feed_to_dm1105dvb(struct dvb_demux_feed *feed)
411{
412 return container_of(feed->demux, struct dm1105dvb, demux);
413}
414
415static inline struct dm1105dvb *frontend_to_dm1105dvb(struct dvb_frontend *fe)
416{
417 return container_of(fe->dvb, struct dm1105dvb, dvb_adapter);
418}
419
420static int dm1105dvb_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
421{
422 struct dm1105dvb *dm1105dvb = frontend_to_dm1105dvb(fe);
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300423 u32 lnb_mask, lnb_13v, lnb_18v, lnb_off;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300424
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300425 switch (dm1105dvb->boardnr) {
426 case DM1105_BOARD_AXESS_DM05:
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300427 lnb_mask = DM05_LNB_MASK;
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300428 lnb_off = DM05_LNB_OFF;
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300429 lnb_13v = DM05_LNB_13V;
430 lnb_18v = DM05_LNB_18V;
431 break;
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300432 case DM1105_BOARD_DVBWORLD_2002:
433 case DM1105_BOARD_DVBWORLD_2004:
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300434 default:
435 lnb_mask = DM1105_LNB_MASK;
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300436 lnb_off = DM1105_LNB_OFF;
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300437 lnb_13v = DM1105_LNB_13V;
438 lnb_18v = DM1105_LNB_18V;
439 }
440
441 outl(lnb_mask, dm_io_mem(DM1105_GPIOCTR));
442 if (voltage == SEC_VOLTAGE_18)
443 outl(lnb_18v , dm_io_mem(DM1105_GPIOVAL));
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300444 else if (voltage == SEC_VOLTAGE_13)
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300445 outl(lnb_13v, dm_io_mem(DM1105_GPIOVAL));
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300446 else
447 outl(lnb_off, dm_io_mem(DM1105_GPIOVAL));
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300448
449 return 0;
450}
451
452static void dm1105dvb_set_dma_addr(struct dm1105dvb *dm1105dvb)
453{
454 outl(cpu_to_le32(dm1105dvb->dma_addr), dm_io_mem(DM1105_STADR));
455}
456
457static int __devinit dm1105dvb_dma_map(struct dm1105dvb *dm1105dvb)
458{
459 dm1105dvb->ts_buf = pci_alloc_consistent(dm1105dvb->pdev, 6*DM1105_DMA_BYTES, &dm1105dvb->dma_addr);
460
FUJITA Tomonori7b51a702008-10-24 06:13:23 -0300461 return !dm1105dvb->ts_buf;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300462}
463
464static void dm1105dvb_dma_unmap(struct dm1105dvb *dm1105dvb)
465{
466 pci_free_consistent(dm1105dvb->pdev, 6*DM1105_DMA_BYTES, dm1105dvb->ts_buf, dm1105dvb->dma_addr);
467}
468
Igor M. Liplianindf4533a2008-11-11 18:09:28 -0300469static void dm1105dvb_enable_irqs(struct dm1105dvb *dm1105dvb)
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300470{
471 outb(INTMAK_ALLMASK, dm_io_mem(DM1105_INTMAK));
472 outb(1, dm_io_mem(DM1105_CR));
473}
474
475static void dm1105dvb_disable_irqs(struct dm1105dvb *dm1105dvb)
476{
477 outb(INTMAK_IRM, dm_io_mem(DM1105_INTMAK));
478 outb(0, dm_io_mem(DM1105_CR));
479}
480
481static int dm1105dvb_start_feed(struct dvb_demux_feed *f)
482{
483 struct dm1105dvb *dm1105dvb = feed_to_dm1105dvb(f);
484
485 if (dm1105dvb->full_ts_users++ == 0)
486 dm1105dvb_enable_irqs(dm1105dvb);
487
488 return 0;
489}
490
491static int dm1105dvb_stop_feed(struct dvb_demux_feed *f)
492{
493 struct dm1105dvb *dm1105dvb = feed_to_dm1105dvb(f);
494
495 if (--dm1105dvb->full_ts_users == 0)
496 dm1105dvb_disable_irqs(dm1105dvb);
497
498 return 0;
499}
500
Igor M. Liplianinb72857d2009-02-26 03:49:44 -0300501/* ir work handler */
502static void dm1105_emit_key(struct work_struct *work)
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300503{
Igor M. Liplianinb72857d2009-02-26 03:49:44 -0300504 struct infrared *ir = container_of(work, struct infrared, work);
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300505 u32 ircom = ir->ir_command;
506 u8 data;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300507
Igor M. Liplianind1498ff2009-02-26 03:40:41 -0300508 if (ir_debug)
509 printk(KERN_INFO "%s: received byte 0x%04x\n", __func__, ircom);
510
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300511 data = (ircom >> 8) & 0x7f;
512
Mauro Carvalho Chehab8573b742009-11-27 22:40:22 -0300513 ir_input_keydown(ir->input_dev, &ir->ir, data);
Igor M. Liplianinb72857d2009-02-26 03:49:44 -0300514 ir_input_nokey(ir->input_dev, &ir->ir);
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300515}
516
Igor M. Liplianind1498ff2009-02-26 03:40:41 -0300517/* work handler */
518static void dm1105_dmx_buffer(struct work_struct *work)
519{
520 struct dm1105dvb *dm1105dvb =
521 container_of(work, struct dm1105dvb, work);
522 unsigned int nbpackets;
523 u32 oldwrp = dm1105dvb->wrp;
524 u32 nextwrp = dm1105dvb->nextwrp;
525
526 if (!((dm1105dvb->ts_buf[oldwrp] == 0x47) &&
527 (dm1105dvb->ts_buf[oldwrp + 188] == 0x47) &&
528 (dm1105dvb->ts_buf[oldwrp + 188 * 2] == 0x47))) {
529 dm1105dvb->PacketErrorCount++;
530 /* bad packet found */
531 if ((dm1105dvb->PacketErrorCount >= 2) &&
532 (dm1105dvb->dmarst == 0)) {
533 outb(1, dm_io_mem(DM1105_RST));
534 dm1105dvb->wrp = 0;
535 dm1105dvb->PacketErrorCount = 0;
536 dm1105dvb->dmarst = 0;
537 return;
538 }
539 }
540
541 if (nextwrp < oldwrp) {
542 memcpy(dm1105dvb->ts_buf + dm1105dvb->buffer_size,
543 dm1105dvb->ts_buf, nextwrp);
544 nbpackets = ((dm1105dvb->buffer_size - oldwrp) + nextwrp) / 188;
545 } else
546 nbpackets = (nextwrp - oldwrp) / 188;
547
548 dm1105dvb->wrp = nextwrp;
549 dvb_dmx_swfilter_packets(&dm1105dvb->demux,
550 &dm1105dvb->ts_buf[oldwrp], nbpackets);
551}
552
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300553static irqreturn_t dm1105dvb_irq(int irq, void *dev_id)
554{
555 struct dm1105dvb *dm1105dvb = dev_id;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300556
557 /* Read-Write INSTS Ack's Interrupt for DM1105 chip 16.03.2008 */
558 unsigned int intsts = inb(dm_io_mem(DM1105_INTSTS));
559 outb(intsts, dm_io_mem(DM1105_INTSTS));
560
561 switch (intsts) {
562 case INTSTS_TSIRQ:
563 case (INTSTS_TSIRQ | INTSTS_IR):
Igor M. Liplianind1498ff2009-02-26 03:40:41 -0300564 dm1105dvb->nextwrp = inl(dm_io_mem(DM1105_WRP)) -
565 inl(dm_io_mem(DM1105_STADR));
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300566 queue_work(dm1105dvb->wq, &dm1105dvb->work);
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300567 break;
568 case INTSTS_IR:
Igor M. Liplianind1498ff2009-02-26 03:40:41 -0300569 dm1105dvb->ir.ir_command = inl(dm_io_mem(DM1105_IRCODE));
Igor M. Liplianinb72857d2009-02-26 03:49:44 -0300570 schedule_work(&dm1105dvb->ir.work);
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300571 break;
572 }
Igor M. Liplianind1498ff2009-02-26 03:40:41 -0300573
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300574 return IRQ_HANDLED;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300575}
576
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300577int __devinit dm1105_ir_init(struct dm1105dvb *dm1105)
578{
579 struct input_dev *input_dev;
Mauro Carvalho Chehab715a2232009-08-29 14:15:55 -0300580 struct ir_scancode_table *ir_codes = &ir_codes_dm1105_nec_table;
Igor M. Liplianinb72857d2009-02-26 03:49:44 -0300581 int ir_type = IR_TYPE_OTHER;
582 int err = -ENOMEM;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300583
584 input_dev = input_allocate_device();
585 if (!input_dev)
586 return -ENOMEM;
587
588 dm1105->ir.input_dev = input_dev;
589 snprintf(dm1105->ir.input_phys, sizeof(dm1105->ir.input_phys),
590 "pci-%s/ir0", pci_name(dm1105->pdev));
591
Mauro Carvalho Chehab055cd552009-11-29 08:19:59 -0300592 err = ir_input_init(input_dev, &dm1105->ir.ir, ir_type, ir_codes);
593 if (err < 0) {
594 input_free_device(input_dev);
595 return err;
596 }
597
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300598 input_dev->name = "DVB on-card IR receiver";
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300599 input_dev->phys = dm1105->ir.input_phys;
600 input_dev->id.bustype = BUS_PCI;
Igor M. Liplianinb72857d2009-02-26 03:49:44 -0300601 input_dev->id.version = 1;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300602 if (dm1105->pdev->subsystem_vendor) {
603 input_dev->id.vendor = dm1105->pdev->subsystem_vendor;
604 input_dev->id.product = dm1105->pdev->subsystem_device;
605 } else {
606 input_dev->id.vendor = dm1105->pdev->vendor;
607 input_dev->id.product = dm1105->pdev->device;
608 }
Igor M. Liplianinb72857d2009-02-26 03:49:44 -0300609
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300610 input_dev->dev.parent = &dm1105->pdev->dev;
Igor M. Liplianinb72857d2009-02-26 03:49:44 -0300611
612 INIT_WORK(&dm1105->ir.work, dm1105_emit_key);
613
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300614 err = input_register_device(input_dev);
615 if (err) {
Mauro Carvalho Chehab055cd552009-11-29 08:19:59 -0300616 ir_input_free(input_dev);
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300617 input_free_device(input_dev);
618 return err;
619 }
620
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300621 return 0;
622}
623
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300624void __devexit dm1105_ir_exit(struct dm1105dvb *dm1105)
625{
Mauro Carvalho Chehab055cd552009-11-29 08:19:59 -0300626 ir_input_free(dm1105->ir.input_dev);
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300627 input_unregister_device(dm1105->ir.input_dev);
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300628}
629
630static int __devinit dm1105dvb_hw_init(struct dm1105dvb *dm1105dvb)
631{
632 dm1105dvb_disable_irqs(dm1105dvb);
633
634 outb(0, dm_io_mem(DM1105_HOST_CTR));
635
636 /*DATALEN 188,*/
637 outb(188, dm_io_mem(DM1105_DTALENTH));
638 /*TS_STRT TS_VALP MSBFIRST TS_MODE ALPAS TSPES*/
639 outw(0xc10a, dm_io_mem(DM1105_TSCTR));
640
641 /* map DMA and set address */
642 dm1105dvb_dma_map(dm1105dvb);
643 dm1105dvb_set_dma_addr(dm1105dvb);
644 /* big buffer */
645 outl(5*DM1105_DMA_BYTES, dm_io_mem(DM1105_RLEN));
646 outb(47, dm_io_mem(DM1105_INTCNT));
647
648 /* IR NEC mode enable */
649 outb((DM1105_IR_EN | DM1105_SYS_CHK), dm_io_mem(DM1105_IRCTR));
650 outb(0, dm_io_mem(DM1105_IRMODE));
651 outw(0, dm_io_mem(DM1105_SYSTEMCODE));
652
653 return 0;
654}
655
656static void dm1105dvb_hw_exit(struct dm1105dvb *dm1105dvb)
657{
658 dm1105dvb_disable_irqs(dm1105dvb);
659
660 /* IR disable */
661 outb(0, dm_io_mem(DM1105_IRCTR));
662 outb(INTMAK_NONEMASK, dm_io_mem(DM1105_INTMAK));
663
664 dm1105dvb_dma_unmap(dm1105dvb);
665}
Igor M. Liplianine4aab642008-09-23 15:43:57 -0300666
Igor M. Liplianind4305c62008-10-17 13:45:55 -0300667static struct stv0299_config sharp_z0194a_config = {
668 .demod_address = 0x68,
669 .inittab = sharp_z0194a_inittab,
670 .mclk = 88000000UL,
671 .invert = 1,
672 .skip_reinit = 0,
673 .lock_output = STV0299_LOCKOUTPUT_1,
674 .volt13_op0_op1 = STV0299_VOLT13_OP1,
675 .min_delay_ms = 100,
676 .set_symbol_rate = sharp_z0194a_set_symbol_rate,
677};
678
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300679static struct stv0288_config earda_config = {
680 .demod_address = 0x68,
681 .min_delay_ms = 100,
682};
683
684static struct si21xx_config serit_config = {
685 .demod_address = 0x68,
686 .min_delay_ms = 100,
687
688};
689
690static struct cx24116_config serit_sp2633_config = {
691 .demod_address = 0x55,
692};
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300693
694static int __devinit frontend_init(struct dm1105dvb *dm1105dvb)
695{
696 int ret;
697
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300698 switch (dm1105dvb->boardnr) {
699 case DM1105_BOARD_DVBWORLD_2004:
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300700 dm1105dvb->fe = dvb_attach(
701 cx24116_attach, &serit_sp2633_config,
702 &dm1105dvb->i2c_adap);
703 if (dm1105dvb->fe)
704 dm1105dvb->fe->ops.set_voltage = dm1105dvb_set_voltage;
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300705
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300706 break;
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300707 case DM1105_BOARD_DVBWORLD_2002:
708 case DM1105_BOARD_AXESS_DM05:
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300709 default:
710 dm1105dvb->fe = dvb_attach(
711 stv0299_attach, &sharp_z0194a_config,
712 &dm1105dvb->i2c_adap);
713 if (dm1105dvb->fe) {
714 dm1105dvb->fe->ops.set_voltage =
715 dm1105dvb_set_voltage;
716 dvb_attach(dvb_pll_attach, dm1105dvb->fe, 0x60,
717 &dm1105dvb->i2c_adap, DVB_PLL_OPERA1);
718 break;
719 }
720
721 dm1105dvb->fe = dvb_attach(
722 stv0288_attach, &earda_config,
723 &dm1105dvb->i2c_adap);
724 if (dm1105dvb->fe) {
725 dm1105dvb->fe->ops.set_voltage =
726 dm1105dvb_set_voltage;
727 dvb_attach(stb6000_attach, dm1105dvb->fe, 0x61,
728 &dm1105dvb->i2c_adap);
729 break;
730 }
731
732 dm1105dvb->fe = dvb_attach(
733 si21xx_attach, &serit_config,
734 &dm1105dvb->i2c_adap);
735 if (dm1105dvb->fe)
736 dm1105dvb->fe->ops.set_voltage =
737 dm1105dvb_set_voltage;
738
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300739 }
740
741 if (!dm1105dvb->fe) {
742 dev_err(&dm1105dvb->pdev->dev, "could not attach frontend\n");
743 return -ENODEV;
744 }
745
746 ret = dvb_register_frontend(&dm1105dvb->dvb_adapter, dm1105dvb->fe);
747 if (ret < 0) {
748 if (dm1105dvb->fe->ops.release)
749 dm1105dvb->fe->ops.release(dm1105dvb->fe);
750 dm1105dvb->fe = NULL;
751 return ret;
752 }
753
754 return 0;
755}
756
757static void __devinit dm1105dvb_read_mac(struct dm1105dvb *dm1105dvb, u8 *mac)
758{
759 static u8 command[1] = { 0x28 };
760
761 struct i2c_msg msg[] = {
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300762 {
763 .addr = IIC_24C01_addr >> 1,
764 .flags = 0,
765 .buf = command,
766 .len = 1
767 }, {
768 .addr = IIC_24C01_addr >> 1,
769 .flags = I2C_M_RD,
770 .buf = mac,
771 .len = 6
772 },
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300773 };
774
775 dm1105_i2c_xfer(&dm1105dvb->i2c_adap, msg , 2);
Johannes Berg7c510e42008-10-27 17:47:26 -0700776 dev_info(&dm1105dvb->pdev->dev, "MAC %pM\n", mac);
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300777}
778
779static int __devinit dm1105_probe(struct pci_dev *pdev,
780 const struct pci_device_id *ent)
781{
782 struct dm1105dvb *dm1105dvb;
783 struct dvb_adapter *dvb_adapter;
784 struct dvb_demux *dvbdemux;
785 struct dmx_demux *dmx;
786 int ret = -ENOMEM;
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300787 int i;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300788
789 dm1105dvb = kzalloc(sizeof(struct dm1105dvb), GFP_KERNEL);
790 if (!dm1105dvb)
Igor M. Liplianind1498ff2009-02-26 03:40:41 -0300791 return -ENOMEM;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300792
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300793 /* board config */
794 dm1105dvb->nr = dm1105_devcount;
795 dm1105dvb->boardnr = UNSET;
796 if (card[dm1105dvb->nr] < ARRAY_SIZE(dm1105_boards))
797 dm1105dvb->boardnr = card[dm1105dvb->nr];
798 for (i = 0; UNSET == dm1105dvb->boardnr &&
799 i < ARRAY_SIZE(dm1105_subids); i++)
800 if (pdev->subsystem_vendor ==
801 dm1105_subids[i].subvendor &&
802 pdev->subsystem_device ==
803 dm1105_subids[i].subdevice)
804 dm1105dvb->boardnr = dm1105_subids[i].card;
805
806 if (UNSET == dm1105dvb->boardnr) {
807 dm1105dvb->boardnr = DM1105_BOARD_UNKNOWN;
808 dm1105_card_list(pdev);
809 }
810
811 dm1105_devcount++;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300812 dm1105dvb->pdev = pdev;
813 dm1105dvb->buffer_size = 5 * DM1105_DMA_BYTES;
814 dm1105dvb->PacketErrorCount = 0;
815 dm1105dvb->dmarst = 0;
816
817 ret = pci_enable_device(pdev);
818 if (ret < 0)
819 goto err_kfree;
820
Yang Hongyang284901a2009-04-06 19:01:15 -0700821 ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300822 if (ret < 0)
823 goto err_pci_disable_device;
824
825 pci_set_master(pdev);
826
827 ret = pci_request_regions(pdev, DRIVER_NAME);
828 if (ret < 0)
829 goto err_pci_disable_device;
830
831 dm1105dvb->io_mem = pci_iomap(pdev, 0, pci_resource_len(pdev, 0));
832 if (!dm1105dvb->io_mem) {
833 ret = -EIO;
834 goto err_pci_release_regions;
835 }
836
837 spin_lock_init(&dm1105dvb->lock);
838 pci_set_drvdata(pdev, dm1105dvb);
839
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300840 ret = dm1105dvb_hw_init(dm1105dvb);
841 if (ret < 0)
Igor M. Liplianind1498ff2009-02-26 03:40:41 -0300842 goto err_pci_iounmap;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300843
844 /* i2c */
845 i2c_set_adapdata(&dm1105dvb->i2c_adap, dm1105dvb);
846 strcpy(dm1105dvb->i2c_adap.name, DRIVER_NAME);
847 dm1105dvb->i2c_adap.owner = THIS_MODULE;
848 dm1105dvb->i2c_adap.class = I2C_CLASS_TV_DIGITAL;
849 dm1105dvb->i2c_adap.dev.parent = &pdev->dev;
850 dm1105dvb->i2c_adap.algo = &dm1105_algo;
851 dm1105dvb->i2c_adap.algo_data = dm1105dvb;
852 ret = i2c_add_adapter(&dm1105dvb->i2c_adap);
853
854 if (ret < 0)
855 goto err_dm1105dvb_hw_exit;
856
857 /* dvb */
858 ret = dvb_register_adapter(&dm1105dvb->dvb_adapter, DRIVER_NAME,
859 THIS_MODULE, &pdev->dev, adapter_nr);
860 if (ret < 0)
861 goto err_i2c_del_adapter;
862
863 dvb_adapter = &dm1105dvb->dvb_adapter;
864
865 dm1105dvb_read_mac(dm1105dvb, dvb_adapter->proposed_mac);
866
867 dvbdemux = &dm1105dvb->demux;
868 dvbdemux->filternum = 256;
869 dvbdemux->feednum = 256;
870 dvbdemux->start_feed = dm1105dvb_start_feed;
871 dvbdemux->stop_feed = dm1105dvb_stop_feed;
872 dvbdemux->dmx.capabilities = (DMX_TS_FILTERING |
873 DMX_SECTION_FILTERING | DMX_MEMORY_BASED_FILTERING);
874 ret = dvb_dmx_init(dvbdemux);
875 if (ret < 0)
876 goto err_dvb_unregister_adapter;
877
878 dmx = &dvbdemux->dmx;
879 dm1105dvb->dmxdev.filternum = 256;
880 dm1105dvb->dmxdev.demux = dmx;
881 dm1105dvb->dmxdev.capabilities = 0;
882
883 ret = dvb_dmxdev_init(&dm1105dvb->dmxdev, dvb_adapter);
884 if (ret < 0)
885 goto err_dvb_dmx_release;
886
887 dm1105dvb->hw_frontend.source = DMX_FRONTEND_0;
888
889 ret = dmx->add_frontend(dmx, &dm1105dvb->hw_frontend);
890 if (ret < 0)
891 goto err_dvb_dmxdev_release;
892
893 dm1105dvb->mem_frontend.source = DMX_MEMORY_FE;
894
895 ret = dmx->add_frontend(dmx, &dm1105dvb->mem_frontend);
896 if (ret < 0)
897 goto err_remove_hw_frontend;
898
899 ret = dmx->connect_frontend(dmx, &dm1105dvb->hw_frontend);
900 if (ret < 0)
901 goto err_remove_mem_frontend;
902
903 ret = frontend_init(dm1105dvb);
904 if (ret < 0)
905 goto err_disconnect_frontend;
906
907 dvb_net_init(dvb_adapter, &dm1105dvb->dvbnet, dmx);
908 dm1105_ir_init(dm1105dvb);
Igor M. Liplianind1498ff2009-02-26 03:40:41 -0300909
910 INIT_WORK(&dm1105dvb->work, dm1105_dmx_buffer);
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300911 sprintf(dm1105dvb->wqn, "%s/%d", dvb_adapter->name, dvb_adapter->num);
912 dm1105dvb->wq = create_singlethread_workqueue(dm1105dvb->wqn);
913 if (!dm1105dvb->wq)
914 goto err_dvb_net;
Igor M. Liplianind1498ff2009-02-26 03:40:41 -0300915
916 ret = request_irq(pdev->irq, dm1105dvb_irq, IRQF_SHARED,
917 DRIVER_NAME, dm1105dvb);
918 if (ret < 0)
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300919 goto err_workqueue;
Igor M. Liplianind1498ff2009-02-26 03:40:41 -0300920
921 return 0;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300922
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300923err_workqueue:
924 destroy_workqueue(dm1105dvb->wq);
925err_dvb_net:
926 dvb_net_release(&dm1105dvb->dvbnet);
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300927err_disconnect_frontend:
928 dmx->disconnect_frontend(dmx);
929err_remove_mem_frontend:
930 dmx->remove_frontend(dmx, &dm1105dvb->mem_frontend);
931err_remove_hw_frontend:
932 dmx->remove_frontend(dmx, &dm1105dvb->hw_frontend);
933err_dvb_dmxdev_release:
934 dvb_dmxdev_release(&dm1105dvb->dmxdev);
935err_dvb_dmx_release:
936 dvb_dmx_release(dvbdemux);
937err_dvb_unregister_adapter:
938 dvb_unregister_adapter(dvb_adapter);
939err_i2c_del_adapter:
940 i2c_del_adapter(&dm1105dvb->i2c_adap);
941err_dm1105dvb_hw_exit:
942 dm1105dvb_hw_exit(dm1105dvb);
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300943err_pci_iounmap:
944 pci_iounmap(pdev, dm1105dvb->io_mem);
945err_pci_release_regions:
946 pci_release_regions(pdev);
947err_pci_disable_device:
948 pci_disable_device(pdev);
949err_kfree:
950 pci_set_drvdata(pdev, NULL);
951 kfree(dm1105dvb);
Igor M. Liplianind1498ff2009-02-26 03:40:41 -0300952 return ret;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300953}
954
955static void __devexit dm1105_remove(struct pci_dev *pdev)
956{
957 struct dm1105dvb *dm1105dvb = pci_get_drvdata(pdev);
958 struct dvb_adapter *dvb_adapter = &dm1105dvb->dvb_adapter;
959 struct dvb_demux *dvbdemux = &dm1105dvb->demux;
960 struct dmx_demux *dmx = &dvbdemux->dmx;
961
962 dm1105_ir_exit(dm1105dvb);
963 dmx->close(dmx);
964 dvb_net_release(&dm1105dvb->dvbnet);
965 if (dm1105dvb->fe)
966 dvb_unregister_frontend(dm1105dvb->fe);
967
968 dmx->disconnect_frontend(dmx);
969 dmx->remove_frontend(dmx, &dm1105dvb->mem_frontend);
970 dmx->remove_frontend(dmx, &dm1105dvb->hw_frontend);
971 dvb_dmxdev_release(&dm1105dvb->dmxdev);
972 dvb_dmx_release(dvbdemux);
973 dvb_unregister_adapter(dvb_adapter);
974 if (&dm1105dvb->i2c_adap)
975 i2c_del_adapter(&dm1105dvb->i2c_adap);
976
977 dm1105dvb_hw_exit(dm1105dvb);
978 synchronize_irq(pdev->irq);
979 free_irq(pdev->irq, dm1105dvb);
980 pci_iounmap(pdev, dm1105dvb->io_mem);
981 pci_release_regions(pdev);
982 pci_disable_device(pdev);
983 pci_set_drvdata(pdev, NULL);
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300984 dm1105_devcount--;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300985 kfree(dm1105dvb);
986}
987
988static struct pci_device_id dm1105_id_table[] __devinitdata = {
989 {
990 .vendor = PCI_VENDOR_ID_TRIGEM,
991 .device = PCI_DEVICE_ID_DM1105,
992 .subvendor = PCI_ANY_ID,
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300993 .subdevice = PCI_ANY_ID,
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300994 }, {
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300995 .vendor = PCI_VENDOR_ID_AXESS,
996 .device = PCI_DEVICE_ID_DM05,
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300997 .subvendor = PCI_ANY_ID,
998 .subdevice = PCI_ANY_ID,
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300999 }, {
Igor M. Liplianina611d0c2008-09-13 10:10:53 -03001000 /* empty */
1001 },
1002};
1003
1004MODULE_DEVICE_TABLE(pci, dm1105_id_table);
1005
1006static struct pci_driver dm1105_driver = {
1007 .name = DRIVER_NAME,
1008 .id_table = dm1105_id_table,
1009 .probe = dm1105_probe,
1010 .remove = __devexit_p(dm1105_remove),
1011};
1012
1013static int __init dm1105_init(void)
1014{
1015 return pci_register_driver(&dm1105_driver);
1016}
1017
1018static void __exit dm1105_exit(void)
1019{
1020 pci_unregister_driver(&dm1105_driver);
1021}
1022
1023module_init(dm1105_init);
1024module_exit(dm1105_exit);
1025
1026MODULE_AUTHOR("Igor M. Liplianin <liplianin@me.by>");
1027MODULE_DESCRIPTION("SDMC DM1105 DVB driver");
1028MODULE_LICENSE("GPL");