aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorDevin Heitmueller <dheitmueller@kernellabs.com>2010-03-13 15:53:58 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-05-19 11:59:08 -0400
commitcbddcba695563ba6c0cba35b647b6bf53ec54333 (patch)
tree1b5e74f17e02885818911e06f312ce7f2093f79d /drivers/media
parentcb1c0f8e7099ef5ba20c046df3a3790b5683c573 (diff)
V4L/DVB: ngene: split out card specific code into a separate file
Split out the card profiles into a new file called ngene-cards.c. This is part of a larger refactoring of the driver in preparation for adding analog support. Note that this patch makes *no* functional change - all I did was cut/paste the code and add the function prototypes to ngene.h as needed. Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/ngene/Makefile2
-rw-r--r--drivers/media/dvb/ngene/ngene-cards.c328
-rw-r--r--drivers/media/dvb/ngene/ngene-core.c305
-rw-r--r--drivers/media/dvb/ngene/ngene.h5
4 files changed, 337 insertions, 303 deletions
diff --git a/drivers/media/dvb/ngene/Makefile b/drivers/media/dvb/ngene/Makefile
index 5e7d310c6edb..f01c4a1627d3 100644
--- a/drivers/media/dvb/ngene/Makefile
+++ b/drivers/media/dvb/ngene/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the nGene device driver 2# Makefile for the nGene device driver
3# 3#
4 4
5ngene-objs := ngene-core.o ngene-i2c.o 5ngene-objs := ngene-core.o ngene-i2c.o ngene-cards.o
6 6
7obj-$(CONFIG_DVB_NGENE) += ngene.o 7obj-$(CONFIG_DVB_NGENE) += ngene.o
8 8
diff --git a/drivers/media/dvb/ngene/ngene-cards.c b/drivers/media/dvb/ngene/ngene-cards.c
new file mode 100644
index 000000000000..692c3e226e83
--- /dev/null
+++ b/drivers/media/dvb/ngene/ngene-cards.c
@@ -0,0 +1,328 @@
1/*
2 * ngene-cards.c: nGene PCIe bridge driver - card specific info
3 *
4 * Copyright (C) 2005-2007 Micronas
5 *
6 * Copyright (C) 2008-2009 Ralph Metzler <rjkm@metzlerbros.de>
7 * Modifications for new nGene firmware,
8 * support for EEPROM-copying,
9 * support for new dual DVB-S2 card prototype
10 *
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * version 2 only, as published by the Free Software Foundation.
15 *
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26 * 02110-1301, USA
27 * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
28 */
29
30#include <linux/module.h>
31#include <linux/init.h>
32#include <linux/pci.h>
33#include <linux/pci_ids.h>
34
35#include "ngene.h"
36
37/* demods/tuners */
38#include "stv6110x.h"
39#include "stv090x.h"
40#include "lnbh24.h"
41#include "lgdt330x.h"
42#include "mt2131.h"
43
44
45/****************************************************************************/
46/* Demod/tuner attachment ***************************************************/
47/****************************************************************************/
48
49static int tuner_attach_stv6110(struct ngene_channel *chan)
50{
51 struct stv090x_config *feconf = (struct stv090x_config *)
52 chan->dev->card_info->fe_config[chan->number];
53 struct stv6110x_config *tunerconf = (struct stv6110x_config *)
54 chan->dev->card_info->tuner_config[chan->number];
55 struct stv6110x_devctl *ctl;
56
57 ctl = dvb_attach(stv6110x_attach, chan->fe, tunerconf,
58 &chan->i2c_adapter);
59 if (ctl == NULL) {
60 printk(KERN_ERR DEVICE_NAME ": No STV6110X found!\n");
61 return -ENODEV;
62 }
63
64 feconf->tuner_init = ctl->tuner_init;
65 feconf->tuner_set_mode = ctl->tuner_set_mode;
66 feconf->tuner_set_frequency = ctl->tuner_set_frequency;
67 feconf->tuner_get_frequency = ctl->tuner_get_frequency;
68 feconf->tuner_set_bandwidth = ctl->tuner_set_bandwidth;
69 feconf->tuner_get_bandwidth = ctl->tuner_get_bandwidth;
70 feconf->tuner_set_bbgain = ctl->tuner_set_bbgain;
71 feconf->tuner_get_bbgain = ctl->tuner_get_bbgain;
72 feconf->tuner_set_refclk = ctl->tuner_set_refclk;
73 feconf->tuner_get_status = ctl->tuner_get_status;
74
75 return 0;
76}
77
78
79static int demod_attach_stv0900(struct ngene_channel *chan)
80{
81 struct stv090x_config *feconf = (struct stv090x_config *)
82 chan->dev->card_info->fe_config[chan->number];
83
84 chan->fe = dvb_attach(stv090x_attach,
85 feconf,
86 &chan->i2c_adapter,
87 chan->number == 0 ? STV090x_DEMODULATOR_0 :
88 STV090x_DEMODULATOR_1);
89 if (chan->fe == NULL) {
90 printk(KERN_ERR DEVICE_NAME ": No STV0900 found!\n");
91 return -ENODEV;
92 }
93
94 if (!dvb_attach(lnbh24_attach, chan->fe, &chan->i2c_adapter, 0,
95 0, chan->dev->card_info->lnb[chan->number])) {
96 printk(KERN_ERR DEVICE_NAME ": No LNBH24 found!\n");
97 dvb_frontend_detach(chan->fe);
98 return -ENODEV;
99 }
100
101 return 0;
102}
103
104static struct lgdt330x_config aver_m780 = {
105 .demod_address = 0xb2 >> 1,
106 .demod_chip = LGDT3303,
107 .serial_mpeg = 0x00, /* PARALLEL */
108 .clock_polarity_flip = 1,
109};
110
111static struct mt2131_config m780_tunerconfig = {
112 0xc0 >> 1
113};
114
115/* A single func to attach the demo and tuner, rather than
116 * use two sep funcs like the current design mandates.
117 */
118static int demod_attach_lg330x(struct ngene_channel *chan)
119{
120 chan->fe = dvb_attach(lgdt330x_attach, &aver_m780, &chan->i2c_adapter);
121 if (chan->fe == NULL) {
122 printk(KERN_ERR DEVICE_NAME ": No LGDT330x found!\n");
123 return -ENODEV;
124 }
125
126 dvb_attach(mt2131_attach, chan->fe, &chan->i2c_adapter,
127 &m780_tunerconfig, 0);
128
129 return (chan->fe) ? 0 : -ENODEV;
130}
131
132/****************************************************************************/
133/* Switch control (I2C gates, etc.) *****************************************/
134/****************************************************************************/
135
136
137static struct stv090x_config fe_cineS2 = {
138 .device = STV0900,
139 .demod_mode = STV090x_DUAL,
140 .clk_mode = STV090x_CLK_EXT,
141
142 .xtal = 27000000,
143 .address = 0x68,
144
145 .ts1_mode = STV090x_TSMODE_SERIAL_PUNCTURED,
146 .ts2_mode = STV090x_TSMODE_SERIAL_PUNCTURED,
147
148 .repeater_level = STV090x_RPTLEVEL_16,
149
150 .adc1_range = STV090x_ADC_1Vpp,
151 .adc2_range = STV090x_ADC_1Vpp,
152
153 .diseqc_envelope_mode = true,
154};
155
156static struct stv6110x_config tuner_cineS2_0 = {
157 .addr = 0x60,
158 .refclk = 27000000,
159 .clk_div = 1,
160};
161
162static struct stv6110x_config tuner_cineS2_1 = {
163 .addr = 0x63,
164 .refclk = 27000000,
165 .clk_div = 1,
166};
167
168static struct ngene_info ngene_info_cineS2 = {
169 .type = NGENE_SIDEWINDER,
170 .name = "Linux4Media cineS2 DVB-S2 Twin Tuner",
171 .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN},
172 .demod_attach = {demod_attach_stv0900, demod_attach_stv0900},
173 .tuner_attach = {tuner_attach_stv6110, tuner_attach_stv6110},
174 .fe_config = {&fe_cineS2, &fe_cineS2},
175 .tuner_config = {&tuner_cineS2_0, &tuner_cineS2_1},
176 .lnb = {0x0b, 0x08},
177 .tsf = {3, 3},
178 .fw_version = 15,
179};
180
181static struct ngene_info ngene_info_satixS2 = {
182 .type = NGENE_SIDEWINDER,
183 .name = "Mystique SaTiX-S2 Dual",
184 .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN},
185 .demod_attach = {demod_attach_stv0900, demod_attach_stv0900},
186 .tuner_attach = {tuner_attach_stv6110, tuner_attach_stv6110},
187 .fe_config = {&fe_cineS2, &fe_cineS2},
188 .tuner_config = {&tuner_cineS2_0, &tuner_cineS2_1},
189 .lnb = {0x0b, 0x08},
190 .tsf = {3, 3},
191 .fw_version = 15,
192};
193
194static struct ngene_info ngene_info_satixS2v2 = {
195 .type = NGENE_SIDEWINDER,
196 .name = "Mystique SaTiX-S2 Dual (v2)",
197 .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN},
198 .demod_attach = {demod_attach_stv0900, demod_attach_stv0900},
199 .tuner_attach = {tuner_attach_stv6110, tuner_attach_stv6110},
200 .fe_config = {&fe_cineS2, &fe_cineS2},
201 .tuner_config = {&tuner_cineS2_0, &tuner_cineS2_1},
202 .lnb = {0x0a, 0x08},
203 .tsf = {3, 3},
204 .fw_version = 15,
205};
206
207static struct ngene_info ngene_info_cineS2v5 = {
208 .type = NGENE_SIDEWINDER,
209 .name = "Linux4Media cineS2 DVB-S2 Twin Tuner (v5)",
210 .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN},
211 .demod_attach = {demod_attach_stv0900, demod_attach_stv0900},
212 .tuner_attach = {tuner_attach_stv6110, tuner_attach_stv6110},
213 .fe_config = {&fe_cineS2, &fe_cineS2},
214 .tuner_config = {&tuner_cineS2_0, &tuner_cineS2_1},
215 .lnb = {0x0a, 0x08},
216 .tsf = {3, 3},
217 .fw_version = 15,
218};
219
220static struct ngene_info ngene_info_m780 = {
221 .type = NGENE_APP,
222 .name = "Aver M780 ATSC/QAM-B",
223
224 /* Channel 0 is analog, which is currently unsupported */
225 .io_type = { NGENE_IO_NONE, NGENE_IO_TSIN },
226 .demod_attach = { NULL, demod_attach_lg330x },
227
228 /* Ensure these are NULL else the frame will call them (as funcs) */
229 .tuner_attach = { 0, 0, 0, 0 },
230 .fe_config = { NULL, &aver_m780 },
231 .avf = { 0 },
232
233 /* A custom electrical interface config for the demod to bridge */
234 .tsf = { 4, 4 },
235 .fw_version = 15,
236};
237
238/****************************************************************************/
239
240
241
242/****************************************************************************/
243/* PCI Subsystem ID *********************************************************/
244/****************************************************************************/
245
246#define NGENE_ID(_subvend, _subdev, _driverdata) { \
247 .vendor = NGENE_VID, .device = NGENE_PID, \
248 .subvendor = _subvend, .subdevice = _subdev, \
249 .driver_data = (unsigned long) &_driverdata }
250
251/****************************************************************************/
252
253static const struct pci_device_id ngene_id_tbl[] __devinitdata = {
254 NGENE_ID(0x18c3, 0xabc3, ngene_info_cineS2),
255 NGENE_ID(0x18c3, 0xabc4, ngene_info_cineS2),
256 NGENE_ID(0x18c3, 0xdb01, ngene_info_satixS2),
257 NGENE_ID(0x18c3, 0xdb02, ngene_info_satixS2v2),
258 NGENE_ID(0x18c3, 0xdd00, ngene_info_cineS2v5),
259 NGENE_ID(0x1461, 0x062e, ngene_info_m780),
260 {0}
261};
262MODULE_DEVICE_TABLE(pci, ngene_id_tbl);
263
264/****************************************************************************/
265/* Init/Exit ****************************************************************/
266/****************************************************************************/
267
268static pci_ers_result_t ngene_error_detected(struct pci_dev *dev,
269 enum pci_channel_state state)
270{
271 printk(KERN_ERR DEVICE_NAME ": PCI error\n");
272 if (state == pci_channel_io_perm_failure)
273 return PCI_ERS_RESULT_DISCONNECT;
274 if (state == pci_channel_io_frozen)
275 return PCI_ERS_RESULT_NEED_RESET;
276 return PCI_ERS_RESULT_CAN_RECOVER;
277}
278
279static pci_ers_result_t ngene_link_reset(struct pci_dev *dev)
280{
281 printk(KERN_INFO DEVICE_NAME ": link reset\n");
282 return 0;
283}
284
285static pci_ers_result_t ngene_slot_reset(struct pci_dev *dev)
286{
287 printk(KERN_INFO DEVICE_NAME ": slot reset\n");
288 return 0;
289}
290
291static void ngene_resume(struct pci_dev *dev)
292{
293 printk(KERN_INFO DEVICE_NAME ": resume\n");
294}
295
296static struct pci_error_handlers ngene_errors = {
297 .error_detected = ngene_error_detected,
298 .link_reset = ngene_link_reset,
299 .slot_reset = ngene_slot_reset,
300 .resume = ngene_resume,
301};
302
303static struct pci_driver ngene_pci_driver = {
304 .name = "ngene",
305 .id_table = ngene_id_tbl,
306 .probe = ngene_probe,
307 .remove = __devexit_p(ngene_remove),
308 .err_handler = &ngene_errors,
309};
310
311static __init int module_init_ngene(void)
312{
313 printk(KERN_INFO
314 "nGene PCIE bridge driver, Copyright (C) 2005-2007 Micronas\n");
315 return pci_register_driver(&ngene_pci_driver);
316}
317
318static __exit void module_exit_ngene(void)
319{
320 pci_unregister_driver(&ngene_pci_driver);
321}
322
323module_init(module_init_ngene);
324module_exit(module_exit_ngene);
325
326MODULE_DESCRIPTION("nGene");
327MODULE_AUTHOR("Micronas, Ralph Metzler, Manfred Voelkel");
328MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/ngene/ngene-core.c b/drivers/media/dvb/ngene/ngene-core.c
index fedd341eb015..8a64f644192a 100644
--- a/drivers/media/dvb/ngene/ngene-core.c
+++ b/drivers/media/dvb/ngene/ngene-core.c
@@ -34,7 +34,6 @@
34#include <linux/io.h> 34#include <linux/io.h>
35#include <asm/div64.h> 35#include <asm/div64.h>
36#include <linux/pci.h> 36#include <linux/pci.h>
37#include <linux/pci_ids.h>
38#include <linux/smp_lock.h> 37#include <linux/smp_lock.h>
39#include <linux/timer.h> 38#include <linux/timer.h>
40#include <linux/byteorder/generic.h> 39#include <linux/byteorder/generic.h>
@@ -43,12 +42,6 @@
43 42
44#include "ngene.h" 43#include "ngene.h"
45 44
46#include "stv6110x.h"
47#include "stv090x.h"
48#include "lnbh24.h"
49#include "lgdt330x.h"
50#include "mt2131.h"
51
52static int one_adapter = 1; 45static int one_adapter = 1;
53module_param(one_adapter, int, 0444); 46module_param(one_adapter, int, 0444);
54MODULE_PARM_DESC(one_adapter, "Use only one adapter."); 47MODULE_PARM_DESC(one_adapter, "Use only one adapter.");
@@ -64,8 +57,6 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
64 57
65#define dprintk if (debug) printk 58#define dprintk if (debug) printk
66 59
67#define DEVICE_NAME "ngene"
68
69#define ngwriteb(dat, adr) writeb((dat), (char *)(dev->iomem + (adr))) 60#define ngwriteb(dat, adr) writeb((dat), (char *)(dev->iomem + (adr)))
70#define ngwritel(dat, adr) writel((dat), (char *)(dev->iomem + (adr))) 61#define ngwritel(dat, adr) writel((dat), (char *)(dev->iomem + (adr)))
71#define ngwriteb(dat, adr) writeb((dat), (char *)(dev->iomem + (adr))) 62#define ngwriteb(dat, adr) writeb((dat), (char *)(dev->iomem + (adr)))
@@ -878,8 +869,6 @@ static int ngene_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
878 return 0; 869 return 0;
879} 870}
880 871
881
882
883static int my_dvb_dmx_ts_card_init(struct dvb_demux *dvbdemux, char *id, 872static int my_dvb_dmx_ts_card_init(struct dvb_demux *dvbdemux, char *id,
884 int (*start_feed)(struct dvb_demux_feed *), 873 int (*start_feed)(struct dvb_demux_feed *),
885 int (*stop_feed)(struct dvb_demux_feed *), 874 int (*stop_feed)(struct dvb_demux_feed *),
@@ -1504,97 +1493,6 @@ fail:
1504 1493
1505 1494
1506 1495
1507/****************************************************************************/
1508/* Switch control (I2C gates, etc.) *****************************************/
1509/****************************************************************************/
1510
1511
1512/****************************************************************************/
1513/* Demod/tuner attachment ***************************************************/
1514/****************************************************************************/
1515
1516static int tuner_attach_stv6110(struct ngene_channel *chan)
1517{
1518 struct stv090x_config *feconf = (struct stv090x_config *)
1519 chan->dev->card_info->fe_config[chan->number];
1520 struct stv6110x_config *tunerconf = (struct stv6110x_config *)
1521 chan->dev->card_info->tuner_config[chan->number];
1522 struct stv6110x_devctl *ctl;
1523
1524 ctl = dvb_attach(stv6110x_attach, chan->fe, tunerconf,
1525 &chan->i2c_adapter);
1526 if (ctl == NULL) {
1527 printk(KERN_ERR DEVICE_NAME ": No STV6110X found!\n");
1528 return -ENODEV;
1529 }
1530
1531 feconf->tuner_init = ctl->tuner_init;
1532 feconf->tuner_set_mode = ctl->tuner_set_mode;
1533 feconf->tuner_set_frequency = ctl->tuner_set_frequency;
1534 feconf->tuner_get_frequency = ctl->tuner_get_frequency;
1535 feconf->tuner_set_bandwidth = ctl->tuner_set_bandwidth;
1536 feconf->tuner_get_bandwidth = ctl->tuner_get_bandwidth;
1537 feconf->tuner_set_bbgain = ctl->tuner_set_bbgain;
1538 feconf->tuner_get_bbgain = ctl->tuner_get_bbgain;
1539 feconf->tuner_set_refclk = ctl->tuner_set_refclk;
1540 feconf->tuner_get_status = ctl->tuner_get_status;
1541
1542 return 0;
1543}
1544
1545
1546static int demod_attach_stv0900(struct ngene_channel *chan)
1547{
1548 struct stv090x_config *feconf = (struct stv090x_config *)
1549 chan->dev->card_info->fe_config[chan->number];
1550
1551 chan->fe = dvb_attach(stv090x_attach,
1552 feconf,
1553 &chan->i2c_adapter,
1554 chan->number == 0 ? STV090x_DEMODULATOR_0 :
1555 STV090x_DEMODULATOR_1);
1556 if (chan->fe == NULL) {
1557 printk(KERN_ERR DEVICE_NAME ": No STV0900 found!\n");
1558 return -ENODEV;
1559 }
1560
1561 if (!dvb_attach(lnbh24_attach, chan->fe, &chan->i2c_adapter, 0,
1562 0, chan->dev->card_info->lnb[chan->number])) {
1563 printk(KERN_ERR DEVICE_NAME ": No LNBH24 found!\n");
1564 dvb_frontend_detach(chan->fe);
1565 return -ENODEV;
1566 }
1567
1568 return 0;
1569}
1570
1571static struct lgdt330x_config aver_m780 = {
1572 .demod_address = 0xb2 >> 1,
1573 .demod_chip = LGDT3303,
1574 .serial_mpeg = 0x00, /* PARALLEL */
1575 .clock_polarity_flip = 1,
1576};
1577
1578static struct mt2131_config m780_tunerconfig = {
1579 0xc0 >> 1
1580};
1581
1582/* A single func to attach the demo and tuner, rather than
1583 * use two sep funcs like the current design mandates.
1584 */
1585static int demod_attach_lg330x(struct ngene_channel *chan)
1586{
1587 chan->fe = dvb_attach(lgdt330x_attach, &aver_m780, &chan->i2c_adapter);
1588 if (chan->fe == NULL) {
1589 printk(KERN_ERR DEVICE_NAME ": No LGDT330x found!\n");
1590 return -ENODEV;
1591 }
1592
1593 dvb_attach(mt2131_attach, chan->fe, &chan->i2c_adapter,
1594 &m780_tunerconfig, 0);
1595
1596 return (chan->fe) ? 0 : -ENODEV;
1597}
1598 1496
1599/****************************************************************************/ 1497/****************************************************************************/
1600/****************************************************************************/ 1498/****************************************************************************/
@@ -1712,7 +1610,7 @@ static int init_channels(struct ngene *dev)
1712/* device probe/remove calls ************************************************/ 1610/* device probe/remove calls ************************************************/
1713/****************************************************************************/ 1611/****************************************************************************/
1714 1612
1715static void __devexit ngene_remove(struct pci_dev *pdev) 1613void __devexit ngene_remove(struct pci_dev *pdev)
1716{ 1614{
1717 struct ngene *dev = (struct ngene *)pci_get_drvdata(pdev); 1615 struct ngene *dev = (struct ngene *)pci_get_drvdata(pdev);
1718 int i; 1616 int i;
@@ -1726,8 +1624,8 @@ static void __devexit ngene_remove(struct pci_dev *pdev)
1726 pci_disable_device(pdev); 1624 pci_disable_device(pdev);
1727} 1625}
1728 1626
1729static int __devinit ngene_probe(struct pci_dev *pci_dev, 1627int __devinit ngene_probe(struct pci_dev *pci_dev,
1730 const struct pci_device_id *id) 1628 const struct pci_device_id *id)
1731{ 1629{
1732 struct ngene *dev; 1630 struct ngene *dev;
1733 int stat = 0; 1631 int stat = 0;
@@ -1773,200 +1671,3 @@ fail0:
1773 pci_set_drvdata(pci_dev, NULL); 1671 pci_set_drvdata(pci_dev, NULL);
1774 return stat; 1672 return stat;
1775} 1673}
1776
1777/****************************************************************************/
1778/* Card configs *************************************************************/
1779/****************************************************************************/
1780
1781static struct stv090x_config fe_cineS2 = {
1782 .device = STV0900,
1783 .demod_mode = STV090x_DUAL,
1784 .clk_mode = STV090x_CLK_EXT,
1785
1786 .xtal = 27000000,
1787 .address = 0x68,
1788
1789 .ts1_mode = STV090x_TSMODE_SERIAL_PUNCTURED,
1790 .ts2_mode = STV090x_TSMODE_SERIAL_PUNCTURED,
1791
1792 .repeater_level = STV090x_RPTLEVEL_16,
1793
1794 .adc1_range = STV090x_ADC_1Vpp,
1795 .adc2_range = STV090x_ADC_1Vpp,
1796
1797 .diseqc_envelope_mode = true,
1798};
1799
1800static struct stv6110x_config tuner_cineS2_0 = {
1801 .addr = 0x60,
1802 .refclk = 27000000,
1803 .clk_div = 1,
1804};
1805
1806static struct stv6110x_config tuner_cineS2_1 = {
1807 .addr = 0x63,
1808 .refclk = 27000000,
1809 .clk_div = 1,
1810};
1811
1812static struct ngene_info ngene_info_cineS2 = {
1813 .type = NGENE_SIDEWINDER,
1814 .name = "Linux4Media cineS2 DVB-S2 Twin Tuner",
1815 .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN},
1816 .demod_attach = {demod_attach_stv0900, demod_attach_stv0900},
1817 .tuner_attach = {tuner_attach_stv6110, tuner_attach_stv6110},
1818 .fe_config = {&fe_cineS2, &fe_cineS2},
1819 .tuner_config = {&tuner_cineS2_0, &tuner_cineS2_1},
1820 .lnb = {0x0b, 0x08},
1821 .tsf = {3, 3},
1822 .fw_version = 15,
1823};
1824
1825static struct ngene_info ngene_info_satixS2 = {
1826 .type = NGENE_SIDEWINDER,
1827 .name = "Mystique SaTiX-S2 Dual",
1828 .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN},
1829 .demod_attach = {demod_attach_stv0900, demod_attach_stv0900},
1830 .tuner_attach = {tuner_attach_stv6110, tuner_attach_stv6110},
1831 .fe_config = {&fe_cineS2, &fe_cineS2},
1832 .tuner_config = {&tuner_cineS2_0, &tuner_cineS2_1},
1833 .lnb = {0x0b, 0x08},
1834 .tsf = {3, 3},
1835 .fw_version = 15,
1836};
1837
1838static struct ngene_info ngene_info_satixS2v2 = {
1839 .type = NGENE_SIDEWINDER,
1840 .name = "Mystique SaTiX-S2 Dual (v2)",
1841 .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN},
1842 .demod_attach = {demod_attach_stv0900, demod_attach_stv0900},
1843 .tuner_attach = {tuner_attach_stv6110, tuner_attach_stv6110},
1844 .fe_config = {&fe_cineS2, &fe_cineS2},
1845 .tuner_config = {&tuner_cineS2_0, &tuner_cineS2_1},
1846 .lnb = {0x0a, 0x08},
1847 .tsf = {3, 3},
1848 .fw_version = 15,
1849};
1850
1851static struct ngene_info ngene_info_cineS2v5 = {
1852 .type = NGENE_SIDEWINDER,
1853 .name = "Linux4Media cineS2 DVB-S2 Twin Tuner (v5)",
1854 .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN},
1855 .demod_attach = {demod_attach_stv0900, demod_attach_stv0900},
1856 .tuner_attach = {tuner_attach_stv6110, tuner_attach_stv6110},
1857 .fe_config = {&fe_cineS2, &fe_cineS2},
1858 .tuner_config = {&tuner_cineS2_0, &tuner_cineS2_1},
1859 .lnb = {0x0a, 0x08},
1860 .tsf = {3, 3},
1861 .fw_version = 15,
1862};
1863
1864static struct ngene_info ngene_info_m780 = {
1865 .type = NGENE_APP,
1866 .name = "Aver M780 ATSC/QAM-B",
1867
1868 /* Channel 0 is analog, which is currently unsupported */
1869 .io_type = { NGENE_IO_NONE, NGENE_IO_TSIN },
1870 .demod_attach = { NULL, demod_attach_lg330x },
1871
1872 /* Ensure these are NULL else the frame will call them (as funcs) */
1873 .tuner_attach = { 0, 0, 0, 0 },
1874 .fe_config = { NULL, &aver_m780 },
1875 .avf = { 0 },
1876
1877 /* A custom electrical interface config for the demod to bridge */
1878 .tsf = { 4, 4 },
1879 .fw_version = 15,
1880};
1881
1882/****************************************************************************/
1883
1884
1885
1886/****************************************************************************/
1887/* PCI Subsystem ID *********************************************************/
1888/****************************************************************************/
1889
1890#define NGENE_ID(_subvend, _subdev, _driverdata) { \
1891 .vendor = NGENE_VID, .device = NGENE_PID, \
1892 .subvendor = _subvend, .subdevice = _subdev, \
1893 .driver_data = (unsigned long) &_driverdata }
1894
1895/****************************************************************************/
1896
1897static const struct pci_device_id ngene_id_tbl[] __devinitdata = {
1898 NGENE_ID(0x18c3, 0xabc3, ngene_info_cineS2),
1899 NGENE_ID(0x18c3, 0xabc4, ngene_info_cineS2),
1900 NGENE_ID(0x18c3, 0xdb01, ngene_info_satixS2),
1901 NGENE_ID(0x18c3, 0xdb02, ngene_info_satixS2v2),
1902 NGENE_ID(0x18c3, 0xdd00, ngene_info_cineS2v5),
1903 NGENE_ID(0x1461, 0x062e, ngene_info_m780),
1904 {0}
1905};
1906MODULE_DEVICE_TABLE(pci, ngene_id_tbl);
1907
1908/****************************************************************************/
1909/* Init/Exit ****************************************************************/
1910/****************************************************************************/
1911
1912static pci_ers_result_t ngene_error_detected(struct pci_dev *dev,
1913 enum pci_channel_state state)
1914{
1915 printk(KERN_ERR DEVICE_NAME ": PCI error\n");
1916 if (state == pci_channel_io_perm_failure)
1917 return PCI_ERS_RESULT_DISCONNECT;
1918 if (state == pci_channel_io_frozen)
1919 return PCI_ERS_RESULT_NEED_RESET;
1920 return PCI_ERS_RESULT_CAN_RECOVER;
1921}
1922
1923static pci_ers_result_t ngene_link_reset(struct pci_dev *dev)
1924{
1925 printk(KERN_INFO DEVICE_NAME ": link reset\n");
1926 return 0;
1927}
1928
1929static pci_ers_result_t ngene_slot_reset(struct pci_dev *dev)
1930{
1931 printk(KERN_INFO DEVICE_NAME ": slot reset\n");
1932 return 0;
1933}
1934
1935static void ngene_resume(struct pci_dev *dev)
1936{
1937 printk(KERN_INFO DEVICE_NAME ": resume\n");
1938}
1939
1940static struct pci_error_handlers ngene_errors = {
1941 .error_detected = ngene_error_detected,
1942 .link_reset = ngene_link_reset,
1943 .slot_reset = ngene_slot_reset,
1944 .resume = ngene_resume,
1945};
1946
1947static struct pci_driver ngene_pci_driver = {
1948 .name = "ngene",
1949 .id_table = ngene_id_tbl,
1950 .probe = ngene_probe,
1951 .remove = __devexit_p(ngene_remove),
1952 .err_handler = &ngene_errors,
1953};
1954
1955static __init int module_init_ngene(void)
1956{
1957 printk(KERN_INFO
1958 "nGene PCIE bridge driver, Copyright (C) 2005-2007 Micronas\n");
1959 return pci_register_driver(&ngene_pci_driver);
1960}
1961
1962static __exit void module_exit_ngene(void)
1963{
1964 pci_unregister_driver(&ngene_pci_driver);
1965}
1966
1967module_init(module_init_ngene);
1968module_exit(module_exit_ngene);
1969
1970MODULE_DESCRIPTION("nGene");
1971MODULE_AUTHOR("Micronas, Ralph Metzler, Manfred Voelkel");
1972MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/ngene/ngene.h b/drivers/media/dvb/ngene/ngene.h
index 0c2d5a7d183a..c2dc8516cb20 100644
--- a/drivers/media/dvb/ngene/ngene.h
+++ b/drivers/media/dvb/ngene/ngene.h
@@ -39,6 +39,8 @@
39#include "dvb_frontend.h" 39#include "dvb_frontend.h"
40#include "dvb_ringbuffer.h" 40#include "dvb_ringbuffer.h"
41 41
42#define DEVICE_NAME "ngene"
43
42#define NGENE_VID 0x18c3 44#define NGENE_VID 0x18c3
43#define NGENE_PID 0x0720 45#define NGENE_PID 0x0720
44 46
@@ -855,6 +857,9 @@ struct ngene_buffer {
855 857
856 858
857/* Provided by ngene-core.c */ 859/* Provided by ngene-core.c */
860int __devinit ngene_probe(struct pci_dev *pci_dev,
861 const struct pci_device_id *id);
862void __devexit ngene_remove(struct pci_dev *pdev);
858int ngene_command(struct ngene *dev, struct ngene_command *com); 863int ngene_command(struct ngene *dev, struct ngene_command *com);
859int ngene_command_gpio_set(struct ngene *dev, u8 select, u8 level); 864int ngene_command_gpio_set(struct ngene *dev, u8 select, u8 level);
860 865