2 * pluto2.c - Satelco Easywatch Mobile Terrestrial Receiver [DVB-T]
4 * Copyright (C) 2005 Andreas Oberritter <obi@linuxtv.org>
6 * based on pluto2.c 1.10 - http://instinct-wp8.no-ip.org/pluto/
7 * by Dany Salman <salmandany@yahoo.fr>
8 * Copyright (c) 2004 TDF
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #include <linux/i2c.h>
27 #include <linux/i2c-algo-bit.h>
28 #include <linux/init.h>
29 #include <linux/kernel.h>
30 #include <linux/module.h>
31 #include <linux/pci.h>
32 #include <linux/dma-mapping.h>
33 #include <linux/slab.h>
37 #include "dvb_demux.h"
38 #include "dvb_frontend.h"
43 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr
);
45 #define DRIVER_NAME "pluto2"
47 #define REG_PIDn(n) ((n) << 2) /* PID n pattern registers */
48 #define REG_PCAR 0x0020 /* PC address register */
49 #define REG_TSCR 0x0024 /* TS ctrl & status */
50 #define REG_MISC 0x0028 /* miscellaneous */
51 #define REG_MMAC 0x002c /* MSB MAC address */
52 #define REG_IMAC 0x0030 /* ISB MAC address */
53 #define REG_LMAC 0x0034 /* LSB MAC address */
54 #define REG_SPID 0x0038 /* SPI data */
55 #define REG_SLCS 0x003c /* serial links ctrl/status */
57 #define PID0_NOFIL (0x0001 << 16)
58 #define PIDn_ENP (0x0001 << 15)
59 #define PID0_END (0x0001 << 14)
60 #define PID0_AFIL (0x0001 << 13)
61 #define PIDn_PID (0x1fff << 0)
63 #define TSCR_NBPACKETS (0x00ff << 24)
64 #define TSCR_DEM (0x0001 << 17)
65 #define TSCR_DE (0x0001 << 16)
66 #define TSCR_RSTN (0x0001 << 15)
67 #define TSCR_MSKO (0x0001 << 14)
68 #define TSCR_MSKA (0x0001 << 13)
69 #define TSCR_MSKL (0x0001 << 12)
70 #define TSCR_OVR (0x0001 << 11)
71 #define TSCR_AFUL (0x0001 << 10)
72 #define TSCR_LOCK (0x0001 << 9)
73 #define TSCR_IACK (0x0001 << 8)
74 #define TSCR_ADEF (0x007f << 0)
76 #define MISC_DVR (0x0fff << 4)
77 #define MISC_ALED (0x0001 << 3)
78 #define MISC_FRST (0x0001 << 2)
79 #define MISC_LED1 (0x0001 << 1)
80 #define MISC_LED0 (0x0001 << 0)
82 #define SPID_SPIDR (0x00ff << 0)
84 #define SLCS_SCL (0x0001 << 7)
85 #define SLCS_SDA (0x0001 << 6)
86 #define SLCS_CSN (0x0001 << 2)
87 #define SLCS_OVR (0x0001 << 1)
88 #define SLCS_SWC (0x0001 << 0)
90 #define TS_DMA_PACKETS (8)
91 #define TS_DMA_BYTES (188 * TS_DMA_PACKETS)
93 #define I2C_ADDR_TDA10046 0x10
94 #define I2C_ADDR_TUA6034 0xc2
103 struct dmx_frontend hw_frontend
;
104 struct dmx_frontend mem_frontend
;
105 struct dmxdev dmxdev
;
106 struct dvb_adapter dvb_adapter
;
107 struct dvb_demux demux
;
108 struct dvb_frontend
*fe
;
109 struct dvb_net dvbnet
;
110 unsigned int full_ts_users
;
114 struct i2c_algo_bit_data i2c_bit
;
115 struct i2c_adapter i2c_adap
;
119 unsigned int overflow
;
124 u8 dma_buf
[TS_DMA_BYTES
];
128 static inline struct pluto
*feed_to_pluto(struct dvb_demux_feed
*feed
)
130 return container_of(feed
->demux
, struct pluto
, demux
);
133 static inline struct pluto
*frontend_to_pluto(struct dvb_frontend
*fe
)
135 return container_of(fe
->dvb
, struct pluto
, dvb_adapter
);
138 static inline u32
pluto_readreg(struct pluto
*pluto
, u32 reg
)
140 return readl(&pluto
->io_mem
[reg
]);
143 static inline void pluto_writereg(struct pluto
*pluto
, u32 reg
, u32 val
)
145 writel(val
, &pluto
->io_mem
[reg
]);
148 static inline void pluto_rw(struct pluto
*pluto
, u32 reg
, u32 mask
, u32 bits
)
150 u32 val
= readl(&pluto
->io_mem
[reg
]);
153 writel(val
, &pluto
->io_mem
[reg
]);
156 static void pluto_write_tscr(struct pluto
*pluto
, u32 val
)
158 /* set the number of packets */
160 val
|= TS_DMA_PACKETS
/ 2;
162 pluto_writereg(pluto
, REG_TSCR
, val
);
165 static void pluto_setsda(void *data
, int state
)
167 struct pluto
*pluto
= data
;
170 pluto_rw(pluto
, REG_SLCS
, SLCS_SDA
, SLCS_SDA
);
172 pluto_rw(pluto
, REG_SLCS
, SLCS_SDA
, 0);
175 static void pluto_setscl(void *data
, int state
)
177 struct pluto
*pluto
= data
;
180 pluto_rw(pluto
, REG_SLCS
, SLCS_SCL
, SLCS_SCL
);
182 pluto_rw(pluto
, REG_SLCS
, SLCS_SCL
, 0);
184 /* try to detect i2c_inb() to workaround hardware bug:
185 * reset SDA to high after SCL has been set to low */
186 if ((state
) && (pluto
->i2cbug
== 0)) {
189 if ((!state
) && (pluto
->i2cbug
== 1))
190 pluto_setsda(pluto
, 1);
195 static int pluto_getsda(void *data
)
197 struct pluto
*pluto
= data
;
199 return pluto_readreg(pluto
, REG_SLCS
) & SLCS_SDA
;
202 static int pluto_getscl(void *data
)
204 struct pluto
*pluto
= data
;
206 return pluto_readreg(pluto
, REG_SLCS
) & SLCS_SCL
;
209 static void pluto_reset_frontend(struct pluto
*pluto
, int reenable
)
211 u32 val
= pluto_readreg(pluto
, REG_MISC
);
213 if (val
& MISC_FRST
) {
215 pluto_writereg(pluto
, REG_MISC
, val
);
219 pluto_writereg(pluto
, REG_MISC
, val
);
223 static void pluto_reset_ts(struct pluto
*pluto
, int reenable
)
225 u32 val
= pluto_readreg(pluto
, REG_TSCR
);
227 if (val
& TSCR_RSTN
) {
229 pluto_write_tscr(pluto
, val
);
233 pluto_write_tscr(pluto
, val
);
237 static void pluto_set_dma_addr(struct pluto
*pluto
)
239 pluto_writereg(pluto
, REG_PCAR
, pluto
->dma_addr
);
242 static int __devinit
pluto_dma_map(struct pluto
*pluto
)
244 pluto
->dma_addr
= pci_map_single(pluto
->pdev
, pluto
->dma_buf
,
245 TS_DMA_BYTES
, PCI_DMA_FROMDEVICE
);
247 return pci_dma_mapping_error(pluto
->pdev
, pluto
->dma_addr
);
250 static void pluto_dma_unmap(struct pluto
*pluto
)
252 pci_unmap_single(pluto
->pdev
, pluto
->dma_addr
,
253 TS_DMA_BYTES
, PCI_DMA_FROMDEVICE
);
256 static int pluto_start_feed(struct dvb_demux_feed
*f
)
258 struct pluto
*pluto
= feed_to_pluto(f
);
260 /* enable PID filtering */
261 if (pluto
->users
++ == 0)
262 pluto_rw(pluto
, REG_PIDn(0), PID0_AFIL
| PID0_NOFIL
, 0);
264 if ((f
->pid
< 0x2000) && (f
->index
< NHWFILTERS
))
265 pluto_rw(pluto
, REG_PIDn(f
->index
), PIDn_ENP
| PIDn_PID
, PIDn_ENP
| f
->pid
);
266 else if (pluto
->full_ts_users
++ == 0)
267 pluto_rw(pluto
, REG_PIDn(0), PID0_NOFIL
, PID0_NOFIL
);
272 static int pluto_stop_feed(struct dvb_demux_feed
*f
)
274 struct pluto
*pluto
= feed_to_pluto(f
);
276 /* disable PID filtering */
277 if (--pluto
->users
== 0)
278 pluto_rw(pluto
, REG_PIDn(0), PID0_AFIL
, PID0_AFIL
);
280 if ((f
->pid
< 0x2000) && (f
->index
< NHWFILTERS
))
281 pluto_rw(pluto
, REG_PIDn(f
->index
), PIDn_ENP
| PIDn_PID
, 0x1fff);
282 else if (--pluto
->full_ts_users
== 0)
283 pluto_rw(pluto
, REG_PIDn(0), PID0_NOFIL
, 0);
288 static void pluto_dma_end(struct pluto
*pluto
, unsigned int nbpackets
)
290 /* synchronize the DMA transfer with the CPU
291 * first so that we see updated contents. */
292 pci_dma_sync_single_for_cpu(pluto
->pdev
, pluto
->dma_addr
,
293 TS_DMA_BYTES
, PCI_DMA_FROMDEVICE
);
295 /* Workaround for broken hardware:
296 * [1] On startup NBPACKETS seems to contain an uninitialized value,
297 * but no packets have been transfered.
298 * [2] Sometimes (actually very often) NBPACKETS stays at zero
299 * although one packet has been transfered.
300 * [3] Sometimes (actually rarely), the card gets into an erroneous
301 * mode where it continuously generates interrupts, claiming it
302 * has recieved nbpackets>TS_DMA_PACKETS packets, but no packet
303 * has been transfered. Only a reset seems to solve this
305 if ((nbpackets
== 0) || (nbpackets
> TS_DMA_PACKETS
)) {
307 while (pluto
->dma_buf
[i
] == 0x47)
311 pluto_reset_ts(pluto
, 1);
312 dev_printk(KERN_DEBUG
, &pluto
->pdev
->dev
, "resetting TS because of invalid packet counter\n");
316 dvb_dmx_swfilter_packets(&pluto
->demux
, pluto
->dma_buf
, nbpackets
);
318 /* clear the dma buffer. this is needed to be able to identify
319 * new valid ts packets above */
320 memset(pluto
->dma_buf
, 0, nbpackets
* 188);
322 /* reset the dma address */
323 pluto_set_dma_addr(pluto
);
325 /* sync the buffer and give it back to the card */
326 pci_dma_sync_single_for_device(pluto
->pdev
, pluto
->dma_addr
,
327 TS_DMA_BYTES
, PCI_DMA_FROMDEVICE
);
330 static irqreturn_t
pluto_irq(int irq
, void *dev_id
)
332 struct pluto
*pluto
= dev_id
;
335 /* check whether an interrupt occured on this device */
336 tscr
= pluto_readreg(pluto
, REG_TSCR
);
337 if (!(tscr
& (TSCR_DE
| TSCR_OVR
)))
340 if (tscr
== 0xffffffff) {
341 if (pluto
->dead
== 0)
342 dev_err(&pluto
->pdev
->dev
, "card has hung or been ejected.\n");
348 /* dma end interrupt */
349 if (tscr
& TSCR_DE
) {
350 pluto_dma_end(pluto
, (tscr
& TSCR_NBPACKETS
) >> 24);
351 /* overflow interrupt */
354 if (pluto
->overflow
) {
355 dev_err(&pluto
->pdev
->dev
, "overflow irq (%d)\n",
357 pluto_reset_ts(pluto
, 1);
360 } else if (tscr
& TSCR_OVR
) {
364 /* ACK the interrupt */
365 pluto_write_tscr(pluto
, tscr
| TSCR_IACK
);
370 static void __devinit
pluto_enable_irqs(struct pluto
*pluto
)
372 u32 val
= pluto_readreg(pluto
, REG_TSCR
);
374 /* disable AFUL and LOCK interrupts */
375 val
|= (TSCR_MSKA
| TSCR_MSKL
);
376 /* enable DMA and OVERFLOW interrupts */
377 val
&= ~(TSCR_DEM
| TSCR_MSKO
);
378 /* clear pending interrupts */
381 pluto_write_tscr(pluto
, val
);
384 static void pluto_disable_irqs(struct pluto
*pluto
)
386 u32 val
= pluto_readreg(pluto
, REG_TSCR
);
388 /* disable all interrupts */
389 val
|= (TSCR_DEM
| TSCR_MSKO
| TSCR_MSKA
| TSCR_MSKL
);
390 /* clear pending interrupts */
393 pluto_write_tscr(pluto
, val
);
396 static int __devinit
pluto_hw_init(struct pluto
*pluto
)
398 pluto_reset_frontend(pluto
, 1);
400 /* set automatic LED control by FPGA */
401 pluto_rw(pluto
, REG_MISC
, MISC_ALED
, MISC_ALED
);
403 /* set data endianess */
404 #ifdef __LITTLE_ENDIAN
405 pluto_rw(pluto
, REG_PIDn(0), PID0_END
, PID0_END
);
407 pluto_rw(pluto
, REG_PIDn(0), PID0_END
, 0);
409 /* map DMA and set address */
410 pluto_dma_map(pluto
);
411 pluto_set_dma_addr(pluto
);
413 /* enable interrupts */
414 pluto_enable_irqs(pluto
);
417 pluto_reset_ts(pluto
, 1);
422 static void pluto_hw_exit(struct pluto
*pluto
)
424 /* disable interrupts */
425 pluto_disable_irqs(pluto
);
427 pluto_reset_ts(pluto
, 0);
429 /* LED: disable automatic control, enable yellow, disable green */
430 pluto_rw(pluto
, REG_MISC
, MISC_ALED
| MISC_LED1
| MISC_LED0
, MISC_LED1
);
433 pluto_dma_unmap(pluto
);
435 pluto_reset_frontend(pluto
, 0);
438 static inline u32
divide(u32 numerator
, u32 denominator
)
440 if (denominator
== 0)
443 return DIV_ROUND_CLOSEST(numerator
, denominator
);
446 /* LG Innotek TDTE-E001P (Infineon TUA6034) */
447 static int lg_tdtpe001p_tuner_set_params(struct dvb_frontend
*fe
,
448 struct dvb_frontend_parameters
*p
)
450 struct pluto
*pluto
= frontend_to_pluto(fe
);
457 // Fref * 3 = 500.000 Hz
460 //div = divide(p->frequency + 36166667, 166667);
461 div
= divide(p
->frequency
* 3, 500000) + 217;
462 buf
[0] = (div
>> 8) & 0x7f;
463 buf
[1] = (div
>> 0) & 0xff;
465 if (p
->frequency
< 611000000)
467 else if (p
->frequency
< 811000000)
475 if (p
->frequency
< 350000000)
480 if (p
->u
.ofdm
.bandwidth
== BANDWIDTH_8_MHZ
)
483 if (sizeof(buf
) == 6) {
488 buf
[5] = (0 << 7) | (2 << 4);
491 msg
.addr
= I2C_ADDR_TUA6034
>> 1;
494 msg
.len
= sizeof(buf
);
496 if (fe
->ops
.i2c_gate_ctrl
)
497 fe
->ops
.i2c_gate_ctrl(fe
, 1);
498 ret
= i2c_transfer(&pluto
->i2c_adap
, &msg
, 1);
507 static int pluto2_request_firmware(struct dvb_frontend
*fe
,
508 const struct firmware
**fw
, char *name
)
510 struct pluto
*pluto
= frontend_to_pluto(fe
);
512 return request_firmware(fw
, name
, &pluto
->pdev
->dev
);
515 static struct tda1004x_config pluto2_fe_config __devinitdata
= {
516 .demod_address
= I2C_ADDR_TDA10046
>> 1,
519 .xtal_freq
= TDA10046_XTAL_16M
,
520 .agc_config
= TDA10046_AGC_DEFAULT
,
521 .if_freq
= TDA10046_FREQ_3617
,
522 .request_firmware
= pluto2_request_firmware
,
525 static int __devinit
frontend_init(struct pluto
*pluto
)
529 pluto
->fe
= tda10046_attach(&pluto2_fe_config
, &pluto
->i2c_adap
);
531 dev_err(&pluto
->pdev
->dev
, "could not attach frontend\n");
534 pluto
->fe
->ops
.tuner_ops
.set_params
= lg_tdtpe001p_tuner_set_params
;
536 ret
= dvb_register_frontend(&pluto
->dvb_adapter
, pluto
->fe
);
538 if (pluto
->fe
->ops
.release
)
539 pluto
->fe
->ops
.release(pluto
->fe
);
546 static void __devinit
pluto_read_rev(struct pluto
*pluto
)
548 u32 val
= pluto_readreg(pluto
, REG_MISC
) & MISC_DVR
;
549 dev_info(&pluto
->pdev
->dev
, "board revision %d.%d\n",
550 (val
>> 12) & 0x0f, (val
>> 4) & 0xff);
553 static void __devinit
pluto_read_mac(struct pluto
*pluto
, u8
*mac
)
555 u32 val
= pluto_readreg(pluto
, REG_MMAC
);
556 mac
[0] = (val
>> 8) & 0xff;
557 mac
[1] = (val
>> 0) & 0xff;
559 val
= pluto_readreg(pluto
, REG_IMAC
);
560 mac
[2] = (val
>> 8) & 0xff;
561 mac
[3] = (val
>> 0) & 0xff;
563 val
= pluto_readreg(pluto
, REG_LMAC
);
564 mac
[4] = (val
>> 8) & 0xff;
565 mac
[5] = (val
>> 0) & 0xff;
567 dev_info(&pluto
->pdev
->dev
, "MAC %pM\n", mac
);
570 static int __devinit
pluto_read_serial(struct pluto
*pluto
)
572 struct pci_dev
*pdev
= pluto
->pdev
;
576 cis
= pci_iomap(pdev
, 1, 0);
580 dev_info(&pdev
->dev
, "S/N ");
582 for (i
= 0xe0; i
< 0x100; i
+= 4) {
583 u32 val
= readl(&cis
[i
]);
584 for (j
= 0; j
< 32; j
+= 8) {
585 if ((val
& 0xff) == 0xff)
587 printk("%c", val
& 0xff);
593 pci_iounmap(pdev
, cis
);
598 static int __devinit
pluto2_probe(struct pci_dev
*pdev
,
599 const struct pci_device_id
*ent
)
602 struct dvb_adapter
*dvb_adapter
;
603 struct dvb_demux
*dvbdemux
;
604 struct dmx_demux
*dmx
;
607 pluto
= kzalloc(sizeof(struct pluto
), GFP_KERNEL
);
613 ret
= pci_enable_device(pdev
);
617 /* enable interrupts */
618 pci_write_config_dword(pdev
, 0x6c, 0x8000);
620 ret
= pci_set_dma_mask(pdev
, DMA_BIT_MASK(32));
622 goto err_pci_disable_device
;
624 pci_set_master(pdev
);
626 ret
= pci_request_regions(pdev
, DRIVER_NAME
);
628 goto err_pci_disable_device
;
630 pluto
->io_mem
= pci_iomap(pdev
, 0, 0x40);
631 if (!pluto
->io_mem
) {
633 goto err_pci_release_regions
;
636 pci_set_drvdata(pdev
, pluto
);
638 ret
= request_irq(pdev
->irq
, pluto_irq
, IRQF_SHARED
, DRIVER_NAME
, pluto
);
640 goto err_pci_iounmap
;
642 ret
= pluto_hw_init(pluto
);
647 i2c_set_adapdata(&pluto
->i2c_adap
, pluto
);
648 strcpy(pluto
->i2c_adap
.name
, DRIVER_NAME
);
649 pluto
->i2c_adap
.owner
= THIS_MODULE
;
650 pluto
->i2c_adap
.class = I2C_CLASS_TV_DIGITAL
;
651 pluto
->i2c_adap
.dev
.parent
= &pdev
->dev
;
652 pluto
->i2c_adap
.algo_data
= &pluto
->i2c_bit
;
653 pluto
->i2c_bit
.data
= pluto
;
654 pluto
->i2c_bit
.setsda
= pluto_setsda
;
655 pluto
->i2c_bit
.setscl
= pluto_setscl
;
656 pluto
->i2c_bit
.getsda
= pluto_getsda
;
657 pluto
->i2c_bit
.getscl
= pluto_getscl
;
658 pluto
->i2c_bit
.udelay
= 10;
659 pluto
->i2c_bit
.timeout
= 10;
661 /* Raise SCL and SDA */
662 pluto_setsda(pluto
, 1);
663 pluto_setscl(pluto
, 1);
665 ret
= i2c_bit_add_bus(&pluto
->i2c_adap
);
667 goto err_pluto_hw_exit
;
670 ret
= dvb_register_adapter(&pluto
->dvb_adapter
, DRIVER_NAME
,
671 THIS_MODULE
, &pdev
->dev
, adapter_nr
);
673 goto err_i2c_del_adapter
;
675 dvb_adapter
= &pluto
->dvb_adapter
;
677 pluto_read_rev(pluto
);
678 pluto_read_serial(pluto
);
679 pluto_read_mac(pluto
, dvb_adapter
->proposed_mac
);
681 dvbdemux
= &pluto
->demux
;
682 dvbdemux
->filternum
= 256;
683 dvbdemux
->feednum
= 256;
684 dvbdemux
->start_feed
= pluto_start_feed
;
685 dvbdemux
->stop_feed
= pluto_stop_feed
;
686 dvbdemux
->dmx
.capabilities
= (DMX_TS_FILTERING
|
687 DMX_SECTION_FILTERING
| DMX_MEMORY_BASED_FILTERING
);
688 ret
= dvb_dmx_init(dvbdemux
);
690 goto err_dvb_unregister_adapter
;
692 dmx
= &dvbdemux
->dmx
;
694 pluto
->hw_frontend
.source
= DMX_FRONTEND_0
;
695 pluto
->mem_frontend
.source
= DMX_MEMORY_FE
;
696 pluto
->dmxdev
.filternum
= NHWFILTERS
;
697 pluto
->dmxdev
.demux
= dmx
;
699 ret
= dvb_dmxdev_init(&pluto
->dmxdev
, dvb_adapter
);
701 goto err_dvb_dmx_release
;
703 ret
= dmx
->add_frontend(dmx
, &pluto
->hw_frontend
);
705 goto err_dvb_dmxdev_release
;
707 ret
= dmx
->add_frontend(dmx
, &pluto
->mem_frontend
);
709 goto err_remove_hw_frontend
;
711 ret
= dmx
->connect_frontend(dmx
, &pluto
->hw_frontend
);
713 goto err_remove_mem_frontend
;
715 ret
= frontend_init(pluto
);
717 goto err_disconnect_frontend
;
719 dvb_net_init(dvb_adapter
, &pluto
->dvbnet
, dmx
);
723 err_disconnect_frontend
:
724 dmx
->disconnect_frontend(dmx
);
725 err_remove_mem_frontend
:
726 dmx
->remove_frontend(dmx
, &pluto
->mem_frontend
);
727 err_remove_hw_frontend
:
728 dmx
->remove_frontend(dmx
, &pluto
->hw_frontend
);
729 err_dvb_dmxdev_release
:
730 dvb_dmxdev_release(&pluto
->dmxdev
);
732 dvb_dmx_release(dvbdemux
);
733 err_dvb_unregister_adapter
:
734 dvb_unregister_adapter(dvb_adapter
);
736 i2c_del_adapter(&pluto
->i2c_adap
);
738 pluto_hw_exit(pluto
);
740 free_irq(pdev
->irq
, pluto
);
742 pci_iounmap(pdev
, pluto
->io_mem
);
743 err_pci_release_regions
:
744 pci_release_regions(pdev
);
745 err_pci_disable_device
:
746 pci_disable_device(pdev
);
748 pci_set_drvdata(pdev
, NULL
);
753 static void __devexit
pluto2_remove(struct pci_dev
*pdev
)
755 struct pluto
*pluto
= pci_get_drvdata(pdev
);
756 struct dvb_adapter
*dvb_adapter
= &pluto
->dvb_adapter
;
757 struct dvb_demux
*dvbdemux
= &pluto
->demux
;
758 struct dmx_demux
*dmx
= &dvbdemux
->dmx
;
761 dvb_net_release(&pluto
->dvbnet
);
763 dvb_unregister_frontend(pluto
->fe
);
765 dmx
->disconnect_frontend(dmx
);
766 dmx
->remove_frontend(dmx
, &pluto
->mem_frontend
);
767 dmx
->remove_frontend(dmx
, &pluto
->hw_frontend
);
768 dvb_dmxdev_release(&pluto
->dmxdev
);
769 dvb_dmx_release(dvbdemux
);
770 dvb_unregister_adapter(dvb_adapter
);
771 i2c_del_adapter(&pluto
->i2c_adap
);
772 pluto_hw_exit(pluto
);
773 free_irq(pdev
->irq
, pluto
);
774 pci_iounmap(pdev
, pluto
->io_mem
);
775 pci_release_regions(pdev
);
776 pci_disable_device(pdev
);
777 pci_set_drvdata(pdev
, NULL
);
781 #ifndef PCI_VENDOR_ID_SCM
782 #define PCI_VENDOR_ID_SCM 0x0432
784 #ifndef PCI_DEVICE_ID_PLUTO2
785 #define PCI_DEVICE_ID_PLUTO2 0x0001
788 static struct pci_device_id pluto2_id_table
[] __devinitdata
= {
790 .vendor
= PCI_VENDOR_ID_SCM
,
791 .device
= PCI_DEVICE_ID_PLUTO2
,
792 .subvendor
= PCI_ANY_ID
,
793 .subdevice
= PCI_ANY_ID
,
799 MODULE_DEVICE_TABLE(pci
, pluto2_id_table
);
801 static struct pci_driver pluto2_driver
= {
803 .id_table
= pluto2_id_table
,
804 .probe
= pluto2_probe
,
805 .remove
= __devexit_p(pluto2_remove
),
808 static int __init
pluto2_init(void)
810 return pci_register_driver(&pluto2_driver
);
813 static void __exit
pluto2_exit(void)
815 pci_unregister_driver(&pluto2_driver
);
818 module_init(pluto2_init
);
819 module_exit(pluto2_exit
);
821 MODULE_AUTHOR("Andreas Oberritter <obi@linuxtv.org>");
822 MODULE_DESCRIPTION("Pluto2 driver");
823 MODULE_LICENSE("GPL");