blob: cc6577c4c12bb7bb64012d6b6908118ad3d8dd64 [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"
Igor M. Liplianinb4a0e812010-01-17 10:32:26 -030046#include "ds3000.h"
Igor M. Liplianina611d0c2008-09-13 10:10:53 -030047
Igor M. Liplianind8300df2009-07-22 17:30:25 -030048#define UNSET (-1U)
49
50#define DM1105_BOARD_NOAUTO UNSET
51#define DM1105_BOARD_UNKNOWN 0
52#define DM1105_BOARD_DVBWORLD_2002 1
53#define DM1105_BOARD_DVBWORLD_2004 2
54#define DM1105_BOARD_AXESS_DM05 3
55
Igor M. Liplianina611d0c2008-09-13 10:10:53 -030056/* ----------------------------------------------- */
57/*
58 * PCI ID's
59 */
60#ifndef PCI_VENDOR_ID_TRIGEM
61#define PCI_VENDOR_ID_TRIGEM 0x109f
62#endif
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -030063#ifndef PCI_VENDOR_ID_AXESS
64#define PCI_VENDOR_ID_AXESS 0x195d
65#endif
Igor M. Liplianina611d0c2008-09-13 10:10:53 -030066#ifndef PCI_DEVICE_ID_DM1105
67#define PCI_DEVICE_ID_DM1105 0x036f
68#endif
69#ifndef PCI_DEVICE_ID_DW2002
70#define PCI_DEVICE_ID_DW2002 0x2002
71#endif
72#ifndef PCI_DEVICE_ID_DW2004
73#define PCI_DEVICE_ID_DW2004 0x2004
74#endif
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -030075#ifndef PCI_DEVICE_ID_DM05
76#define PCI_DEVICE_ID_DM05 0x1105
77#endif
Igor M. Liplianina611d0c2008-09-13 10:10:53 -030078/* ----------------------------------------------- */
79/* sdmc dm1105 registers */
80
81/* TS Control */
82#define DM1105_TSCTR 0x00
83#define DM1105_DTALENTH 0x04
84
85/* GPIO Interface */
86#define DM1105_GPIOVAL 0x08
87#define DM1105_GPIOCTR 0x0c
88
89/* PID serial number */
90#define DM1105_PIDN 0x10
91
92/* Odd-even secret key select */
93#define DM1105_CWSEL 0x14
94
95/* Host Command Interface */
96#define DM1105_HOST_CTR 0x18
97#define DM1105_HOST_AD 0x1c
98
99/* PCI Interface */
100#define DM1105_CR 0x30
101#define DM1105_RST 0x34
102#define DM1105_STADR 0x38
103#define DM1105_RLEN 0x3c
104#define DM1105_WRP 0x40
105#define DM1105_INTCNT 0x44
106#define DM1105_INTMAK 0x48
107#define DM1105_INTSTS 0x4c
108
109/* CW Value */
110#define DM1105_ODD 0x50
111#define DM1105_EVEN 0x58
112
113/* PID Value */
114#define DM1105_PID 0x60
115
116/* IR Control */
117#define DM1105_IRCTR 0x64
118#define DM1105_IRMODE 0x68
119#define DM1105_SYSTEMCODE 0x6c
120#define DM1105_IRCODE 0x70
121
122/* Unknown Values */
123#define DM1105_ENCRYPT 0x74
124#define DM1105_VER 0x7c
125
126/* I2C Interface */
127#define DM1105_I2CCTR 0x80
128#define DM1105_I2CSTS 0x81
129#define DM1105_I2CDAT 0x82
130#define DM1105_I2C_RA 0x83
131/* ----------------------------------------------- */
132/* Interrupt Mask Bits */
133
134#define INTMAK_TSIRQM 0x01
135#define INTMAK_HIRQM 0x04
136#define INTMAK_IRM 0x08
137#define INTMAK_ALLMASK (INTMAK_TSIRQM | \
138 INTMAK_HIRQM | \
139 INTMAK_IRM)
140#define INTMAK_NONEMASK 0x00
141
142/* Interrupt Status Bits */
143#define INTSTS_TSIRQ 0x01
144#define INTSTS_HIRQ 0x04
145#define INTSTS_IR 0x08
146
147/* IR Control Bits */
148#define DM1105_IR_EN 0x01
149#define DM1105_SYS_CHK 0x02
150#define DM1105_REP_FLG 0x08
151
152/* EEPROM addr */
153#define IIC_24C01_addr 0xa0
154/* Max board count */
155#define DM1105_MAX 0x04
156
157#define DRIVER_NAME "dm1105"
158
159#define DM1105_DMA_PACKETS 47
160#define DM1105_DMA_PACKET_LENGTH (128*4)
161#define DM1105_DMA_BYTES (128 * 4 * DM1105_DMA_PACKETS)
162
163/* GPIO's for LNB power control */
164#define DM1105_LNB_MASK 0x00000000
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300165#define DM1105_LNB_OFF 0x00020000
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300166#define DM1105_LNB_13V 0x00010100
167#define DM1105_LNB_18V 0x00000100
168
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300169/* GPIO's for LNB power control for Axess DM05 */
170#define DM05_LNB_MASK 0x00000000
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300171#define DM05_LNB_OFF 0x00020000/* actually 13v */
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300172#define DM05_LNB_13V 0x00020000
173#define DM05_LNB_18V 0x00030000
174
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300175static unsigned int card[] = {[0 ... 3] = UNSET };
176module_param_array(card, int, NULL, 0444);
177MODULE_PARM_DESC(card, "card type");
178
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300179static int ir_debug;
180module_param(ir_debug, int, 0644);
181MODULE_PARM_DESC(ir_debug, "enable debugging information for IR decoding");
182
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300183static unsigned int dm1105_devcount;
184
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300185DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
186
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300187struct dm1105_board {
188 char *name;
189};
190
191struct dm1105_subid {
192 u16 subvendor;
193 u16 subdevice;
194 u32 card;
195};
196
197static const struct dm1105_board dm1105_boards[] = {
198 [DM1105_BOARD_UNKNOWN] = {
199 .name = "UNKNOWN/GENERIC",
200 },
201 [DM1105_BOARD_DVBWORLD_2002] = {
202 .name = "DVBWorld PCI 2002",
203 },
204 [DM1105_BOARD_DVBWORLD_2004] = {
205 .name = "DVBWorld PCI 2004",
206 },
207 [DM1105_BOARD_AXESS_DM05] = {
208 .name = "Axess/EasyTv DM05",
209 },
210};
211
212static const struct dm1105_subid dm1105_subids[] = {
213 {
214 .subvendor = 0x0000,
215 .subdevice = 0x2002,
216 .card = DM1105_BOARD_DVBWORLD_2002,
217 }, {
218 .subvendor = 0x0001,
219 .subdevice = 0x2002,
220 .card = DM1105_BOARD_DVBWORLD_2002,
221 }, {
222 .subvendor = 0x0000,
223 .subdevice = 0x2004,
224 .card = DM1105_BOARD_DVBWORLD_2004,
225 }, {
226 .subvendor = 0x0001,
227 .subdevice = 0x2004,
228 .card = DM1105_BOARD_DVBWORLD_2004,
229 }, {
230 .subvendor = 0x195d,
231 .subdevice = 0x1105,
232 .card = DM1105_BOARD_AXESS_DM05,
233 },
234};
235
236static void dm1105_card_list(struct pci_dev *pci)
237{
238 int i;
239
240 if (0 == pci->subsystem_vendor &&
241 0 == pci->subsystem_device) {
242 printk(KERN_ERR
243 "dm1105: Your board has no valid PCI Subsystem ID\n"
244 "dm1105: and thus can't be autodetected\n"
245 "dm1105: Please pass card=<n> insmod option to\n"
246 "dm1105: workaround that. Redirect complaints to\n"
247 "dm1105: the vendor of the TV card. Best regards,\n"
248 "dm1105: -- tux\n");
249 } else {
250 printk(KERN_ERR
251 "dm1105: Your board isn't known (yet) to the driver.\n"
252 "dm1105: You can try to pick one of the existing\n"
253 "dm1105: card configs via card=<n> insmod option.\n"
254 "dm1105: Updating to the latest version might help\n"
255 "dm1105: as well.\n");
256 }
257 printk(KERN_ERR "Here is a list of valid choices for the card=<n> "
258 "insmod option:\n");
259 for (i = 0; i < ARRAY_SIZE(dm1105_boards); i++)
260 printk(KERN_ERR "dm1105: card=%d -> %s\n",
261 i, dm1105_boards[i].name);
262}
263
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300264/* infrared remote control */
265struct infrared {
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300266 struct input_dev *input_dev;
Igor M. Liplianinb72857d2009-02-26 03:49:44 -0300267 struct ir_input_state ir;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300268 char input_phys[32];
Igor M. Liplianinb72857d2009-02-26 03:49:44 -0300269 struct work_struct work;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300270 u32 ir_command;
271};
272
273struct dm1105dvb {
274 /* pci */
275 struct pci_dev *pdev;
276 u8 __iomem *io_mem;
277
278 /* ir */
279 struct infrared ir;
280
281 /* dvb */
282 struct dmx_frontend hw_frontend;
283 struct dmx_frontend mem_frontend;
284 struct dmxdev dmxdev;
285 struct dvb_adapter dvb_adapter;
286 struct dvb_demux demux;
287 struct dvb_frontend *fe;
288 struct dvb_net dvbnet;
289 unsigned int full_ts_users;
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300290 unsigned int boardnr;
291 int nr;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300292
293 /* i2c */
294 struct i2c_adapter i2c_adap;
295
Igor M. Liplianind1498ff2009-02-26 03:40:41 -0300296 /* irq */
297 struct work_struct work;
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300298 struct workqueue_struct *wq;
299 char wqn[16];
Igor M. Liplianind1498ff2009-02-26 03:40:41 -0300300
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300301 /* dma */
302 dma_addr_t dma_addr;
303 unsigned char *ts_buf;
304 u32 wrp;
Igor M. Liplianind1498ff2009-02-26 03:40:41 -0300305 u32 nextwrp;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300306 u32 buffer_size;
307 unsigned int PacketErrorCount;
308 unsigned int dmarst;
309 spinlock_t lock;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300310};
311
312#define dm_io_mem(reg) ((unsigned long)(&dm1105dvb->io_mem[reg]))
313
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300314static int dm1105_i2c_xfer(struct i2c_adapter *i2c_adap,
315 struct i2c_msg *msgs, int num)
316{
317 struct dm1105dvb *dm1105dvb ;
318
319 int addr, rc, i, j, k, len, byte, data;
320 u8 status;
321
322 dm1105dvb = i2c_adap->algo_data;
323 for (i = 0; i < num; i++) {
324 outb(0x00, dm_io_mem(DM1105_I2CCTR));
325 if (msgs[i].flags & I2C_M_RD) {
326 /* read bytes */
327 addr = msgs[i].addr << 1;
328 addr |= 1;
329 outb(addr, dm_io_mem(DM1105_I2CDAT));
330 for (byte = 0; byte < msgs[i].len; byte++)
331 outb(0, dm_io_mem(DM1105_I2CDAT + byte + 1));
332
333 outb(0x81 + msgs[i].len, dm_io_mem(DM1105_I2CCTR));
334 for (j = 0; j < 55; j++) {
335 mdelay(10);
336 status = inb(dm_io_mem(DM1105_I2CSTS));
337 if ((status & 0xc0) == 0x40)
338 break;
339 }
340 if (j >= 55)
341 return -1;
342
343 for (byte = 0; byte < msgs[i].len; byte++) {
344 rc = inb(dm_io_mem(DM1105_I2CDAT + byte + 1));
345 if (rc < 0)
346 goto err;
347 msgs[i].buf[byte] = rc;
348 }
Igor M. Liplianined7c8472010-01-17 11:15:06 -0300349 } else 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));
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300360 }
Igor M. Liplianined7c8472010-01-17 11:15:06 -0300361 outb(0x82 + (len > 48 ? 48 : len), dm_io_mem(DM1105_I2CCTR));
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300362 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;
Igor M. Liplianined7c8472010-01-17 11:15:06 -0300371
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));
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300381 }
Igor M. Liplianined7c8472010-01-17 11:15:06 -0300382 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;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300392 }
393 }
394 return num;
395 err:
396 return rc;
397}
398
399static u32 functionality(struct i2c_adapter *adap)
400{
401 return I2C_FUNC_I2C;
402}
403
404static struct i2c_algorithm dm1105_algo = {
405 .master_xfer = dm1105_i2c_xfer,
406 .functionality = functionality,
407};
408
409static inline struct dm1105dvb *feed_to_dm1105dvb(struct dvb_demux_feed *feed)
410{
411 return container_of(feed->demux, struct dm1105dvb, demux);
412}
413
414static inline struct dm1105dvb *frontend_to_dm1105dvb(struct dvb_frontend *fe)
415{
416 return container_of(fe->dvb, struct dm1105dvb, dvb_adapter);
417}
418
419static int dm1105dvb_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
420{
421 struct dm1105dvb *dm1105dvb = frontend_to_dm1105dvb(fe);
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300422 u32 lnb_mask, lnb_13v, lnb_18v, lnb_off;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300423
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300424 switch (dm1105dvb->boardnr) {
425 case DM1105_BOARD_AXESS_DM05:
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300426 lnb_mask = DM05_LNB_MASK;
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300427 lnb_off = DM05_LNB_OFF;
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300428 lnb_13v = DM05_LNB_13V;
429 lnb_18v = DM05_LNB_18V;
430 break;
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300431 case DM1105_BOARD_DVBWORLD_2002:
432 case DM1105_BOARD_DVBWORLD_2004:
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300433 default:
434 lnb_mask = DM1105_LNB_MASK;
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300435 lnb_off = DM1105_LNB_OFF;
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300436 lnb_13v = DM1105_LNB_13V;
437 lnb_18v = DM1105_LNB_18V;
438 }
439
440 outl(lnb_mask, dm_io_mem(DM1105_GPIOCTR));
441 if (voltage == SEC_VOLTAGE_18)
442 outl(lnb_18v , dm_io_mem(DM1105_GPIOVAL));
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300443 else if (voltage == SEC_VOLTAGE_13)
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300444 outl(lnb_13v, dm_io_mem(DM1105_GPIOVAL));
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300445 else
446 outl(lnb_off, dm_io_mem(DM1105_GPIOVAL));
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300447
448 return 0;
449}
450
451static void dm1105dvb_set_dma_addr(struct dm1105dvb *dm1105dvb)
452{
453 outl(cpu_to_le32(dm1105dvb->dma_addr), dm_io_mem(DM1105_STADR));
454}
455
456static int __devinit dm1105dvb_dma_map(struct dm1105dvb *dm1105dvb)
457{
458 dm1105dvb->ts_buf = pci_alloc_consistent(dm1105dvb->pdev, 6*DM1105_DMA_BYTES, &dm1105dvb->dma_addr);
459
FUJITA Tomonori7b51a702008-10-24 06:13:23 -0300460 return !dm1105dvb->ts_buf;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300461}
462
463static void dm1105dvb_dma_unmap(struct dm1105dvb *dm1105dvb)
464{
465 pci_free_consistent(dm1105dvb->pdev, 6*DM1105_DMA_BYTES, dm1105dvb->ts_buf, dm1105dvb->dma_addr);
466}
467
Igor M. Liplianindf4533a2008-11-11 18:09:28 -0300468static void dm1105dvb_enable_irqs(struct dm1105dvb *dm1105dvb)
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300469{
470 outb(INTMAK_ALLMASK, dm_io_mem(DM1105_INTMAK));
471 outb(1, dm_io_mem(DM1105_CR));
472}
473
474static void dm1105dvb_disable_irqs(struct dm1105dvb *dm1105dvb)
475{
476 outb(INTMAK_IRM, dm_io_mem(DM1105_INTMAK));
477 outb(0, dm_io_mem(DM1105_CR));
478}
479
480static int dm1105dvb_start_feed(struct dvb_demux_feed *f)
481{
482 struct dm1105dvb *dm1105dvb = feed_to_dm1105dvb(f);
483
484 if (dm1105dvb->full_ts_users++ == 0)
485 dm1105dvb_enable_irqs(dm1105dvb);
486
487 return 0;
488}
489
490static int dm1105dvb_stop_feed(struct dvb_demux_feed *f)
491{
492 struct dm1105dvb *dm1105dvb = feed_to_dm1105dvb(f);
493
494 if (--dm1105dvb->full_ts_users == 0)
495 dm1105dvb_disable_irqs(dm1105dvb);
496
497 return 0;
498}
499
Igor M. Liplianinb72857d2009-02-26 03:49:44 -0300500/* ir work handler */
501static void dm1105_emit_key(struct work_struct *work)
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300502{
Igor M. Liplianinb72857d2009-02-26 03:49:44 -0300503 struct infrared *ir = container_of(work, struct infrared, work);
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300504 u32 ircom = ir->ir_command;
505 u8 data;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300506
Igor M. Liplianind1498ff2009-02-26 03:40:41 -0300507 if (ir_debug)
508 printk(KERN_INFO "%s: received byte 0x%04x\n", __func__, ircom);
509
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300510 data = (ircom >> 8) & 0x7f;
511
Mauro Carvalho Chehab8573b742009-11-27 22:40:22 -0300512 ir_input_keydown(ir->input_dev, &ir->ir, data);
Igor M. Liplianinb72857d2009-02-26 03:49:44 -0300513 ir_input_nokey(ir->input_dev, &ir->ir);
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300514}
515
Igor M. Liplianind1498ff2009-02-26 03:40:41 -0300516/* work handler */
517static void dm1105_dmx_buffer(struct work_struct *work)
518{
519 struct dm1105dvb *dm1105dvb =
520 container_of(work, struct dm1105dvb, work);
521 unsigned int nbpackets;
522 u32 oldwrp = dm1105dvb->wrp;
523 u32 nextwrp = dm1105dvb->nextwrp;
524
525 if (!((dm1105dvb->ts_buf[oldwrp] == 0x47) &&
526 (dm1105dvb->ts_buf[oldwrp + 188] == 0x47) &&
527 (dm1105dvb->ts_buf[oldwrp + 188 * 2] == 0x47))) {
528 dm1105dvb->PacketErrorCount++;
529 /* bad packet found */
530 if ((dm1105dvb->PacketErrorCount >= 2) &&
531 (dm1105dvb->dmarst == 0)) {
532 outb(1, dm_io_mem(DM1105_RST));
533 dm1105dvb->wrp = 0;
534 dm1105dvb->PacketErrorCount = 0;
535 dm1105dvb->dmarst = 0;
536 return;
537 }
538 }
539
540 if (nextwrp < oldwrp) {
541 memcpy(dm1105dvb->ts_buf + dm1105dvb->buffer_size,
542 dm1105dvb->ts_buf, nextwrp);
543 nbpackets = ((dm1105dvb->buffer_size - oldwrp) + nextwrp) / 188;
544 } else
545 nbpackets = (nextwrp - oldwrp) / 188;
546
547 dm1105dvb->wrp = nextwrp;
548 dvb_dmx_swfilter_packets(&dm1105dvb->demux,
549 &dm1105dvb->ts_buf[oldwrp], nbpackets);
550}
551
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300552static irqreturn_t dm1105dvb_irq(int irq, void *dev_id)
553{
554 struct dm1105dvb *dm1105dvb = dev_id;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300555
556 /* Read-Write INSTS Ack's Interrupt for DM1105 chip 16.03.2008 */
557 unsigned int intsts = inb(dm_io_mem(DM1105_INTSTS));
558 outb(intsts, dm_io_mem(DM1105_INTSTS));
559
560 switch (intsts) {
561 case INTSTS_TSIRQ:
562 case (INTSTS_TSIRQ | INTSTS_IR):
Igor M. Liplianind1498ff2009-02-26 03:40:41 -0300563 dm1105dvb->nextwrp = inl(dm_io_mem(DM1105_WRP)) -
564 inl(dm_io_mem(DM1105_STADR));
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300565 queue_work(dm1105dvb->wq, &dm1105dvb->work);
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300566 break;
567 case INTSTS_IR:
Igor M. Liplianind1498ff2009-02-26 03:40:41 -0300568 dm1105dvb->ir.ir_command = inl(dm_io_mem(DM1105_IRCODE));
Igor M. Liplianinb72857d2009-02-26 03:49:44 -0300569 schedule_work(&dm1105dvb->ir.work);
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300570 break;
571 }
Igor M. Liplianind1498ff2009-02-26 03:40:41 -0300572
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300573 return IRQ_HANDLED;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300574}
575
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300576int __devinit dm1105_ir_init(struct dm1105dvb *dm1105)
577{
578 struct input_dev *input_dev;
Mauro Carvalho Chehab715a2232009-08-29 14:15:55 -0300579 struct ir_scancode_table *ir_codes = &ir_codes_dm1105_nec_table;
Mauro Carvalho Chehab971e8292009-12-14 13:53:37 -0300580 u64 ir_type = IR_TYPE_OTHER;
Igor M. Liplianinb72857d2009-02-26 03:49:44 -0300581 int err = -ENOMEM;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300582
583 input_dev = input_allocate_device();
584 if (!input_dev)
585 return -ENOMEM;
586
587 dm1105->ir.input_dev = input_dev;
588 snprintf(dm1105->ir.input_phys, sizeof(dm1105->ir.input_phys),
589 "pci-%s/ir0", pci_name(dm1105->pdev));
590
Mauro Carvalho Chehab579e7d62009-12-11 11:20:59 -0300591 err = ir_input_init(input_dev, &dm1105->ir.ir, ir_type);
Mauro Carvalho Chehab055cd552009-11-29 08:19:59 -0300592 if (err < 0) {
593 input_free_device(input_dev);
594 return err;
595 }
596
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300597 input_dev->name = "DVB on-card IR receiver";
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300598 input_dev->phys = dm1105->ir.input_phys;
599 input_dev->id.bustype = BUS_PCI;
Igor M. Liplianinb72857d2009-02-26 03:49:44 -0300600 input_dev->id.version = 1;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300601 if (dm1105->pdev->subsystem_vendor) {
602 input_dev->id.vendor = dm1105->pdev->subsystem_vendor;
603 input_dev->id.product = dm1105->pdev->subsystem_device;
604 } else {
605 input_dev->id.vendor = dm1105->pdev->vendor;
606 input_dev->id.product = dm1105->pdev->device;
607 }
Igor M. Liplianinb72857d2009-02-26 03:49:44 -0300608
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300609 input_dev->dev.parent = &dm1105->pdev->dev;
Igor M. Liplianinb72857d2009-02-26 03:49:44 -0300610
611 INIT_WORK(&dm1105->ir.work, dm1105_emit_key);
612
Mauro Carvalho Chehabe93854d2009-12-14 00:16:55 -0300613 err = ir_input_register(input_dev, ir_codes, NULL);
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300614
Mauro Carvalho Chehab579e7d62009-12-11 11:20:59 -0300615 return err;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300616}
617
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300618void __devexit dm1105_ir_exit(struct dm1105dvb *dm1105)
619{
Mauro Carvalho Chehab38ef6aa2009-12-11 09:47:42 -0300620 ir_input_unregister(dm1105->ir.input_dev);
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300621}
622
623static int __devinit dm1105dvb_hw_init(struct dm1105dvb *dm1105dvb)
624{
625 dm1105dvb_disable_irqs(dm1105dvb);
626
627 outb(0, dm_io_mem(DM1105_HOST_CTR));
628
629 /*DATALEN 188,*/
630 outb(188, dm_io_mem(DM1105_DTALENTH));
631 /*TS_STRT TS_VALP MSBFIRST TS_MODE ALPAS TSPES*/
632 outw(0xc10a, dm_io_mem(DM1105_TSCTR));
633
634 /* map DMA and set address */
635 dm1105dvb_dma_map(dm1105dvb);
636 dm1105dvb_set_dma_addr(dm1105dvb);
637 /* big buffer */
638 outl(5*DM1105_DMA_BYTES, dm_io_mem(DM1105_RLEN));
639 outb(47, dm_io_mem(DM1105_INTCNT));
640
641 /* IR NEC mode enable */
642 outb((DM1105_IR_EN | DM1105_SYS_CHK), dm_io_mem(DM1105_IRCTR));
643 outb(0, dm_io_mem(DM1105_IRMODE));
644 outw(0, dm_io_mem(DM1105_SYSTEMCODE));
645
646 return 0;
647}
648
649static void dm1105dvb_hw_exit(struct dm1105dvb *dm1105dvb)
650{
651 dm1105dvb_disable_irqs(dm1105dvb);
652
653 /* IR disable */
654 outb(0, dm_io_mem(DM1105_IRCTR));
655 outb(INTMAK_NONEMASK, dm_io_mem(DM1105_INTMAK));
656
657 dm1105dvb_dma_unmap(dm1105dvb);
658}
Igor M. Liplianine4aab642008-09-23 15:43:57 -0300659
Igor M. Liplianind4305c62008-10-17 13:45:55 -0300660static struct stv0299_config sharp_z0194a_config = {
661 .demod_address = 0x68,
662 .inittab = sharp_z0194a_inittab,
663 .mclk = 88000000UL,
664 .invert = 1,
665 .skip_reinit = 0,
666 .lock_output = STV0299_LOCKOUTPUT_1,
667 .volt13_op0_op1 = STV0299_VOLT13_OP1,
668 .min_delay_ms = 100,
669 .set_symbol_rate = sharp_z0194a_set_symbol_rate,
670};
671
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300672static struct stv0288_config earda_config = {
673 .demod_address = 0x68,
674 .min_delay_ms = 100,
675};
676
677static struct si21xx_config serit_config = {
678 .demod_address = 0x68,
679 .min_delay_ms = 100,
680
681};
682
683static struct cx24116_config serit_sp2633_config = {
684 .demod_address = 0x55,
685};
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300686
Igor M. Liplianinb4a0e812010-01-17 10:32:26 -0300687static struct ds3000_config dvbworld_ds3000_config = {
688 .demod_address = 0x68,
689};
690
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300691static int __devinit frontend_init(struct dm1105dvb *dm1105dvb)
692{
693 int ret;
694
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300695 switch (dm1105dvb->boardnr) {
696 case DM1105_BOARD_DVBWORLD_2004:
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300697 dm1105dvb->fe = dvb_attach(
698 cx24116_attach, &serit_sp2633_config,
699 &dm1105dvb->i2c_adap);
Igor M. Liplianinb4a0e812010-01-17 10:32:26 -0300700 if (dm1105dvb->fe) {
701 dm1105dvb->fe->ops.set_voltage = dm1105dvb_set_voltage;
702 break;
703 }
704
705 dm1105dvb->fe = dvb_attach(
706 ds3000_attach, &dvbworld_ds3000_config,
707 &dm1105dvb->i2c_adap);
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300708 if (dm1105dvb->fe)
709 dm1105dvb->fe->ops.set_voltage = dm1105dvb_set_voltage;
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300710
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300711 break;
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300712 case DM1105_BOARD_DVBWORLD_2002:
713 case DM1105_BOARD_AXESS_DM05:
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300714 default:
715 dm1105dvb->fe = dvb_attach(
716 stv0299_attach, &sharp_z0194a_config,
717 &dm1105dvb->i2c_adap);
718 if (dm1105dvb->fe) {
719 dm1105dvb->fe->ops.set_voltage =
720 dm1105dvb_set_voltage;
721 dvb_attach(dvb_pll_attach, dm1105dvb->fe, 0x60,
722 &dm1105dvb->i2c_adap, DVB_PLL_OPERA1);
723 break;
724 }
725
726 dm1105dvb->fe = dvb_attach(
727 stv0288_attach, &earda_config,
728 &dm1105dvb->i2c_adap);
729 if (dm1105dvb->fe) {
730 dm1105dvb->fe->ops.set_voltage =
731 dm1105dvb_set_voltage;
732 dvb_attach(stb6000_attach, dm1105dvb->fe, 0x61,
733 &dm1105dvb->i2c_adap);
734 break;
735 }
736
737 dm1105dvb->fe = dvb_attach(
738 si21xx_attach, &serit_config,
739 &dm1105dvb->i2c_adap);
740 if (dm1105dvb->fe)
741 dm1105dvb->fe->ops.set_voltage =
742 dm1105dvb_set_voltage;
743
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300744 }
745
746 if (!dm1105dvb->fe) {
747 dev_err(&dm1105dvb->pdev->dev, "could not attach frontend\n");
748 return -ENODEV;
749 }
750
751 ret = dvb_register_frontend(&dm1105dvb->dvb_adapter, dm1105dvb->fe);
752 if (ret < 0) {
753 if (dm1105dvb->fe->ops.release)
754 dm1105dvb->fe->ops.release(dm1105dvb->fe);
755 dm1105dvb->fe = NULL;
756 return ret;
757 }
758
759 return 0;
760}
761
762static void __devinit dm1105dvb_read_mac(struct dm1105dvb *dm1105dvb, u8 *mac)
763{
764 static u8 command[1] = { 0x28 };
765
766 struct i2c_msg msg[] = {
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300767 {
768 .addr = IIC_24C01_addr >> 1,
769 .flags = 0,
770 .buf = command,
771 .len = 1
772 }, {
773 .addr = IIC_24C01_addr >> 1,
774 .flags = I2C_M_RD,
775 .buf = mac,
776 .len = 6
777 },
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300778 };
779
780 dm1105_i2c_xfer(&dm1105dvb->i2c_adap, msg , 2);
Johannes Berg7c510e42008-10-27 17:47:26 -0700781 dev_info(&dm1105dvb->pdev->dev, "MAC %pM\n", mac);
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300782}
783
784static int __devinit dm1105_probe(struct pci_dev *pdev,
785 const struct pci_device_id *ent)
786{
787 struct dm1105dvb *dm1105dvb;
788 struct dvb_adapter *dvb_adapter;
789 struct dvb_demux *dvbdemux;
790 struct dmx_demux *dmx;
791 int ret = -ENOMEM;
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300792 int i;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300793
794 dm1105dvb = kzalloc(sizeof(struct dm1105dvb), GFP_KERNEL);
795 if (!dm1105dvb)
Igor M. Liplianind1498ff2009-02-26 03:40:41 -0300796 return -ENOMEM;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300797
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300798 /* board config */
799 dm1105dvb->nr = dm1105_devcount;
800 dm1105dvb->boardnr = UNSET;
801 if (card[dm1105dvb->nr] < ARRAY_SIZE(dm1105_boards))
802 dm1105dvb->boardnr = card[dm1105dvb->nr];
803 for (i = 0; UNSET == dm1105dvb->boardnr &&
804 i < ARRAY_SIZE(dm1105_subids); i++)
805 if (pdev->subsystem_vendor ==
806 dm1105_subids[i].subvendor &&
807 pdev->subsystem_device ==
808 dm1105_subids[i].subdevice)
809 dm1105dvb->boardnr = dm1105_subids[i].card;
810
811 if (UNSET == dm1105dvb->boardnr) {
812 dm1105dvb->boardnr = DM1105_BOARD_UNKNOWN;
813 dm1105_card_list(pdev);
814 }
815
816 dm1105_devcount++;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300817 dm1105dvb->pdev = pdev;
818 dm1105dvb->buffer_size = 5 * DM1105_DMA_BYTES;
819 dm1105dvb->PacketErrorCount = 0;
820 dm1105dvb->dmarst = 0;
821
822 ret = pci_enable_device(pdev);
823 if (ret < 0)
824 goto err_kfree;
825
Yang Hongyang284901a2009-04-06 19:01:15 -0700826 ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300827 if (ret < 0)
828 goto err_pci_disable_device;
829
830 pci_set_master(pdev);
831
832 ret = pci_request_regions(pdev, DRIVER_NAME);
833 if (ret < 0)
834 goto err_pci_disable_device;
835
836 dm1105dvb->io_mem = pci_iomap(pdev, 0, pci_resource_len(pdev, 0));
837 if (!dm1105dvb->io_mem) {
838 ret = -EIO;
839 goto err_pci_release_regions;
840 }
841
842 spin_lock_init(&dm1105dvb->lock);
843 pci_set_drvdata(pdev, dm1105dvb);
844
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300845 ret = dm1105dvb_hw_init(dm1105dvb);
846 if (ret < 0)
Igor M. Liplianind1498ff2009-02-26 03:40:41 -0300847 goto err_pci_iounmap;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300848
849 /* i2c */
850 i2c_set_adapdata(&dm1105dvb->i2c_adap, dm1105dvb);
851 strcpy(dm1105dvb->i2c_adap.name, DRIVER_NAME);
852 dm1105dvb->i2c_adap.owner = THIS_MODULE;
853 dm1105dvb->i2c_adap.class = I2C_CLASS_TV_DIGITAL;
854 dm1105dvb->i2c_adap.dev.parent = &pdev->dev;
855 dm1105dvb->i2c_adap.algo = &dm1105_algo;
856 dm1105dvb->i2c_adap.algo_data = dm1105dvb;
857 ret = i2c_add_adapter(&dm1105dvb->i2c_adap);
858
859 if (ret < 0)
860 goto err_dm1105dvb_hw_exit;
861
862 /* dvb */
863 ret = dvb_register_adapter(&dm1105dvb->dvb_adapter, DRIVER_NAME,
864 THIS_MODULE, &pdev->dev, adapter_nr);
865 if (ret < 0)
866 goto err_i2c_del_adapter;
867
868 dvb_adapter = &dm1105dvb->dvb_adapter;
869
870 dm1105dvb_read_mac(dm1105dvb, dvb_adapter->proposed_mac);
871
872 dvbdemux = &dm1105dvb->demux;
873 dvbdemux->filternum = 256;
874 dvbdemux->feednum = 256;
875 dvbdemux->start_feed = dm1105dvb_start_feed;
876 dvbdemux->stop_feed = dm1105dvb_stop_feed;
877 dvbdemux->dmx.capabilities = (DMX_TS_FILTERING |
878 DMX_SECTION_FILTERING | DMX_MEMORY_BASED_FILTERING);
879 ret = dvb_dmx_init(dvbdemux);
880 if (ret < 0)
881 goto err_dvb_unregister_adapter;
882
883 dmx = &dvbdemux->dmx;
884 dm1105dvb->dmxdev.filternum = 256;
885 dm1105dvb->dmxdev.demux = dmx;
886 dm1105dvb->dmxdev.capabilities = 0;
887
888 ret = dvb_dmxdev_init(&dm1105dvb->dmxdev, dvb_adapter);
889 if (ret < 0)
890 goto err_dvb_dmx_release;
891
892 dm1105dvb->hw_frontend.source = DMX_FRONTEND_0;
893
894 ret = dmx->add_frontend(dmx, &dm1105dvb->hw_frontend);
895 if (ret < 0)
896 goto err_dvb_dmxdev_release;
897
898 dm1105dvb->mem_frontend.source = DMX_MEMORY_FE;
899
900 ret = dmx->add_frontend(dmx, &dm1105dvb->mem_frontend);
901 if (ret < 0)
902 goto err_remove_hw_frontend;
903
904 ret = dmx->connect_frontend(dmx, &dm1105dvb->hw_frontend);
905 if (ret < 0)
906 goto err_remove_mem_frontend;
907
908 ret = frontend_init(dm1105dvb);
909 if (ret < 0)
910 goto err_disconnect_frontend;
911
912 dvb_net_init(dvb_adapter, &dm1105dvb->dvbnet, dmx);
913 dm1105_ir_init(dm1105dvb);
Igor M. Liplianind1498ff2009-02-26 03:40:41 -0300914
915 INIT_WORK(&dm1105dvb->work, dm1105_dmx_buffer);
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300916 sprintf(dm1105dvb->wqn, "%s/%d", dvb_adapter->name, dvb_adapter->num);
917 dm1105dvb->wq = create_singlethread_workqueue(dm1105dvb->wqn);
918 if (!dm1105dvb->wq)
919 goto err_dvb_net;
Igor M. Liplianind1498ff2009-02-26 03:40:41 -0300920
921 ret = request_irq(pdev->irq, dm1105dvb_irq, IRQF_SHARED,
922 DRIVER_NAME, dm1105dvb);
923 if (ret < 0)
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300924 goto err_workqueue;
Igor M. Liplianind1498ff2009-02-26 03:40:41 -0300925
926 return 0;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300927
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -0300928err_workqueue:
929 destroy_workqueue(dm1105dvb->wq);
930err_dvb_net:
931 dvb_net_release(&dm1105dvb->dvbnet);
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300932err_disconnect_frontend:
933 dmx->disconnect_frontend(dmx);
934err_remove_mem_frontend:
935 dmx->remove_frontend(dmx, &dm1105dvb->mem_frontend);
936err_remove_hw_frontend:
937 dmx->remove_frontend(dmx, &dm1105dvb->hw_frontend);
938err_dvb_dmxdev_release:
939 dvb_dmxdev_release(&dm1105dvb->dmxdev);
940err_dvb_dmx_release:
941 dvb_dmx_release(dvbdemux);
942err_dvb_unregister_adapter:
943 dvb_unregister_adapter(dvb_adapter);
944err_i2c_del_adapter:
945 i2c_del_adapter(&dm1105dvb->i2c_adap);
946err_dm1105dvb_hw_exit:
947 dm1105dvb_hw_exit(dm1105dvb);
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300948err_pci_iounmap:
949 pci_iounmap(pdev, dm1105dvb->io_mem);
950err_pci_release_regions:
951 pci_release_regions(pdev);
952err_pci_disable_device:
953 pci_disable_device(pdev);
954err_kfree:
955 pci_set_drvdata(pdev, NULL);
956 kfree(dm1105dvb);
Igor M. Liplianind1498ff2009-02-26 03:40:41 -0300957 return ret;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300958}
959
960static void __devexit dm1105_remove(struct pci_dev *pdev)
961{
962 struct dm1105dvb *dm1105dvb = pci_get_drvdata(pdev);
963 struct dvb_adapter *dvb_adapter = &dm1105dvb->dvb_adapter;
964 struct dvb_demux *dvbdemux = &dm1105dvb->demux;
965 struct dmx_demux *dmx = &dvbdemux->dmx;
966
967 dm1105_ir_exit(dm1105dvb);
968 dmx->close(dmx);
969 dvb_net_release(&dm1105dvb->dvbnet);
970 if (dm1105dvb->fe)
971 dvb_unregister_frontend(dm1105dvb->fe);
972
973 dmx->disconnect_frontend(dmx);
974 dmx->remove_frontend(dmx, &dm1105dvb->mem_frontend);
975 dmx->remove_frontend(dmx, &dm1105dvb->hw_frontend);
976 dvb_dmxdev_release(&dm1105dvb->dmxdev);
977 dvb_dmx_release(dvbdemux);
978 dvb_unregister_adapter(dvb_adapter);
979 if (&dm1105dvb->i2c_adap)
980 i2c_del_adapter(&dm1105dvb->i2c_adap);
981
982 dm1105dvb_hw_exit(dm1105dvb);
983 synchronize_irq(pdev->irq);
984 free_irq(pdev->irq, dm1105dvb);
985 pci_iounmap(pdev, dm1105dvb->io_mem);
986 pci_release_regions(pdev);
987 pci_disable_device(pdev);
988 pci_set_drvdata(pdev, NULL);
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300989 dm1105_devcount--;
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300990 kfree(dm1105dvb);
991}
992
993static struct pci_device_id dm1105_id_table[] __devinitdata = {
994 {
995 .vendor = PCI_VENDOR_ID_TRIGEM,
996 .device = PCI_DEVICE_ID_DM1105,
997 .subvendor = PCI_ANY_ID,
Igor M. Liplianind8300df2009-07-22 17:30:25 -0300998 .subdevice = PCI_ANY_ID,
Igor M. Liplianina611d0c2008-09-13 10:10:53 -0300999 }, {
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -03001000 .vendor = PCI_VENDOR_ID_AXESS,
1001 .device = PCI_DEVICE_ID_DM05,
Igor M. Liplianind8300df2009-07-22 17:30:25 -03001002 .subvendor = PCI_ANY_ID,
1003 .subdevice = PCI_ANY_ID,
Igor M. Liplianin519a4bd2009-06-14 21:34:12 -03001004 }, {
Igor M. Liplianina611d0c2008-09-13 10:10:53 -03001005 /* empty */
1006 },
1007};
1008
1009MODULE_DEVICE_TABLE(pci, dm1105_id_table);
1010
1011static struct pci_driver dm1105_driver = {
1012 .name = DRIVER_NAME,
1013 .id_table = dm1105_id_table,
1014 .probe = dm1105_probe,
1015 .remove = __devexit_p(dm1105_remove),
1016};
1017
1018static int __init dm1105_init(void)
1019{
1020 return pci_register_driver(&dm1105_driver);
1021}
1022
1023static void __exit dm1105_exit(void)
1024{
1025 pci_unregister_driver(&dm1105_driver);
1026}
1027
1028module_init(dm1105_init);
1029module_exit(dm1105_exit);
1030
1031MODULE_AUTHOR("Igor M. Liplianin <liplianin@me.by>");
1032MODULE_DESCRIPTION("SDMC DM1105 DVB driver");
1033MODULE_LICENSE("GPL");