2 * ngene-cards.c: nGene PCIe bridge driver - card specific info
4 * Copyright (C) 2005-2007 Micronas
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
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.
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.
22 * To obtain the license, point your browser to
23 * http://www.gnu.org/copyleft/gpl.html
26 #include <linux/module.h>
27 #include <linux/init.h>
28 #include <linux/pci.h>
29 #include <linux/pci_ids.h>
39 #include "tda18271c2dd.h"
45 /****************************************************************************/
46 /* Demod/tuner attachment ***************************************************/
47 /****************************************************************************/
49 static int tuner_attach_stv6110(struct ngene_channel
*chan
)
51 struct i2c_adapter
*i2c
;
52 struct stv090x_config
*feconf
= (struct stv090x_config
*)
53 chan
->dev
->card_info
->fe_config
[chan
->number
];
54 struct stv6110x_config
*tunerconf
= (struct stv6110x_config
*)
55 chan
->dev
->card_info
->tuner_config
[chan
->number
];
56 const struct stv6110x_devctl
*ctl
;
58 /* tuner 1+2: i2c adapter #0, tuner 3+4: i2c adapter #1 */
60 i2c
= &chan
->dev
->channel
[0].i2c_adapter
;
62 i2c
= &chan
->dev
->channel
[1].i2c_adapter
;
64 ctl
= dvb_attach(stv6110x_attach
, chan
->fe
, tunerconf
, i2c
);
66 printk(KERN_ERR DEVICE_NAME
": No STV6110X found!\n");
70 feconf
->tuner_init
= ctl
->tuner_init
;
71 feconf
->tuner_sleep
= ctl
->tuner_sleep
;
72 feconf
->tuner_set_mode
= ctl
->tuner_set_mode
;
73 feconf
->tuner_set_frequency
= ctl
->tuner_set_frequency
;
74 feconf
->tuner_get_frequency
= ctl
->tuner_get_frequency
;
75 feconf
->tuner_set_bandwidth
= ctl
->tuner_set_bandwidth
;
76 feconf
->tuner_get_bandwidth
= ctl
->tuner_get_bandwidth
;
77 feconf
->tuner_set_bbgain
= ctl
->tuner_set_bbgain
;
78 feconf
->tuner_get_bbgain
= ctl
->tuner_get_bbgain
;
79 feconf
->tuner_set_refclk
= ctl
->tuner_set_refclk
;
80 feconf
->tuner_get_status
= ctl
->tuner_get_status
;
86 static int drxk_gate_ctrl(struct dvb_frontend
*fe
, int enable
)
88 struct ngene_channel
*chan
= fe
->sec_priv
;
92 down(&chan
->dev
->pll_mutex
);
93 status
= chan
->gate_ctrl(fe
, 1);
95 status
= chan
->gate_ctrl(fe
, 0);
96 up(&chan
->dev
->pll_mutex
);
101 static int tuner_attach_tda18271(struct ngene_channel
*chan
)
103 struct i2c_adapter
*i2c
;
104 struct dvb_frontend
*fe
;
106 i2c
= &chan
->dev
->channel
[0].i2c_adapter
;
107 if (chan
->fe
->ops
.i2c_gate_ctrl
)
108 chan
->fe
->ops
.i2c_gate_ctrl(chan
->fe
, 1);
109 fe
= dvb_attach(tda18271c2dd_attach
, chan
->fe
, i2c
, 0x60);
110 if (chan
->fe
->ops
.i2c_gate_ctrl
)
111 chan
->fe
->ops
.i2c_gate_ctrl(chan
->fe
, 0);
113 printk(KERN_ERR
"No TDA18271 found!\n");
120 static int tuner_attach_probe(struct ngene_channel
*chan
)
122 if (chan
->demod_type
== 0)
123 return tuner_attach_stv6110(chan
);
124 if (chan
->demod_type
== 1)
125 return tuner_attach_tda18271(chan
);
129 static int demod_attach_stv0900(struct ngene_channel
*chan
)
131 struct i2c_adapter
*i2c
;
132 struct stv090x_config
*feconf
= (struct stv090x_config
*)
133 chan
->dev
->card_info
->fe_config
[chan
->number
];
135 /* tuner 1+2: i2c adapter #0, tuner 3+4: i2c adapter #1 */
136 /* Note: Both adapters share the same i2c bus, but the demod */
137 /* driver requires that each demod has its own i2c adapter */
138 if (chan
->number
< 2)
139 i2c
= &chan
->dev
->channel
[0].i2c_adapter
;
141 i2c
= &chan
->dev
->channel
[1].i2c_adapter
;
143 chan
->fe
= dvb_attach(stv090x_attach
, feconf
, i2c
,
144 (chan
->number
& 1) == 0 ? STV090x_DEMODULATOR_0
145 : STV090x_DEMODULATOR_1
);
146 if (chan
->fe
== NULL
) {
147 printk(KERN_ERR DEVICE_NAME
": No STV0900 found!\n");
151 /* store channel info */
152 if (feconf
->tuner_i2c_lock
)
153 chan
->fe
->analog_demod_priv
= chan
;
155 if (!dvb_attach(lnbh24_attach
, chan
->fe
, i2c
, 0,
156 0, chan
->dev
->card_info
->lnb
[chan
->number
])) {
157 printk(KERN_ERR DEVICE_NAME
": No LNBH24 found!\n");
158 dvb_frontend_detach(chan
->fe
);
166 static void cineS2_tuner_i2c_lock(struct dvb_frontend
*fe
, int lock
)
168 struct ngene_channel
*chan
= fe
->analog_demod_priv
;
171 down(&chan
->dev
->pll_mutex
);
173 up(&chan
->dev
->pll_mutex
);
176 static int i2c_read(struct i2c_adapter
*adapter
, u8 adr
, u8
*val
)
178 struct i2c_msg msgs
[1] = {{.addr
= adr
, .flags
= I2C_M_RD
,
179 .buf
= val
, .len
= 1 } };
180 return (i2c_transfer(adapter
, msgs
, 1) == 1) ? 0 : -1;
183 static int i2c_read_reg16(struct i2c_adapter
*adapter
, u8 adr
,
186 u8 msg
[2] = {reg
>>8, reg
&0xff};
187 struct i2c_msg msgs
[2] = {{.addr
= adr
, .flags
= 0,
188 .buf
= msg
, .len
= 2},
189 {.addr
= adr
, .flags
= I2C_M_RD
,
190 .buf
= val
, .len
= 1} };
191 return (i2c_transfer(adapter
, msgs
, 2) == 2) ? 0 : -1;
194 static int port_has_stv0900(struct i2c_adapter
*i2c
, int port
)
197 if (i2c_read_reg16(i2c
, 0x68+port
/2, 0xf100, &val
) < 0)
202 static int port_has_drxk(struct i2c_adapter
*i2c
, int port
)
206 if (i2c_read(i2c
, 0x29+port
, &val
) < 0)
211 static int demod_attach_drxk(struct ngene_channel
*chan
,
212 struct i2c_adapter
*i2c
)
214 struct drxk_config config
;
216 memset(&config
, 0, sizeof(config
));
217 config
.microcode_name
= "drxk_a3.mc";
218 config
.qam_demod_parameter_count
= 4;
219 config
.adr
= 0x29 + (chan
->number
^ 2);
221 chan
->fe
= dvb_attach(drxk_attach
, &config
, i2c
);
223 printk(KERN_ERR
"No DRXK found!\n");
226 chan
->fe
->sec_priv
= chan
;
227 chan
->gate_ctrl
= chan
->fe
->ops
.i2c_gate_ctrl
;
228 chan
->fe
->ops
.i2c_gate_ctrl
= drxk_gate_ctrl
;
232 static int cineS2_probe(struct ngene_channel
*chan
)
234 struct i2c_adapter
*i2c
;
235 struct stv090x_config
*fe_conf
;
237 struct i2c_msg i2c_msg
= { .flags
= 0, .buf
= buf
};
240 /* tuner 1+2: i2c adapter #0, tuner 3+4: i2c adapter #1 */
241 if (chan
->number
< 2)
242 i2c
= &chan
->dev
->channel
[0].i2c_adapter
;
244 i2c
= &chan
->dev
->channel
[1].i2c_adapter
;
246 if (port_has_stv0900(i2c
, chan
->number
)) {
247 chan
->demod_type
= 0;
248 fe_conf
= chan
->dev
->card_info
->fe_config
[chan
->number
];
249 /* demod found, attach it */
250 rc
= demod_attach_stv0900(chan
);
251 if (rc
< 0 || chan
->number
< 2)
254 /* demod #2: reprogram outputs DPN1 & DPN2 */
255 i2c_msg
.addr
= fe_conf
->address
;
258 switch (chan
->number
) {
270 rc
= i2c_transfer(i2c
, &i2c_msg
, 1);
272 printk(KERN_ERR DEVICE_NAME
": could not setup DPNx\n");
275 } else if (port_has_drxk(i2c
, chan
->number
^2)) {
276 chan
->demod_type
= 1;
277 demod_attach_drxk(chan
, i2c
);
279 printk(KERN_ERR
"No demod found on chan %d\n", chan
->number
);
286 static struct lgdt330x_config aver_m780
= {
287 .demod_address
= 0xb2 >> 1,
288 .demod_chip
= LGDT3303
,
289 .serial_mpeg
= 0x00, /* PARALLEL */
290 .clock_polarity_flip
= 1,
293 static struct mt2131_config m780_tunerconfig
= {
297 /* A single func to attach the demo and tuner, rather than
298 * use two sep funcs like the current design mandates.
300 static int demod_attach_lg330x(struct ngene_channel
*chan
)
302 chan
->fe
= dvb_attach(lgdt330x_attach
, &aver_m780
, &chan
->i2c_adapter
);
303 if (chan
->fe
== NULL
) {
304 printk(KERN_ERR DEVICE_NAME
": No LGDT330x found!\n");
308 dvb_attach(mt2131_attach
, chan
->fe
, &chan
->i2c_adapter
,
309 &m780_tunerconfig
, 0);
311 return (chan
->fe
) ? 0 : -ENODEV
;
314 static int demod_attach_drxd(struct ngene_channel
*chan
)
316 struct drxd_config
*feconf
;
318 feconf
= chan
->dev
->card_info
->fe_config
[chan
->number
];
320 chan
->fe
= dvb_attach(drxd_attach
, feconf
, chan
,
321 &chan
->i2c_adapter
, &chan
->dev
->pci_dev
->dev
);
323 pr_err("No DRXD found!\n");
329 static int tuner_attach_dtt7520x(struct ngene_channel
*chan
)
331 struct drxd_config
*feconf
;
333 feconf
= chan
->dev
->card_info
->fe_config
[chan
->number
];
335 if (!dvb_attach(dvb_pll_attach
, chan
->fe
, feconf
->pll_address
,
338 pr_err("No pll(%d) found!\n", feconf
->pll_type
);
344 /****************************************************************************/
345 /* EEPROM TAGS **************************************************************/
346 /****************************************************************************/
348 #define MICNG_EE_START 0x0100
349 #define MICNG_EE_END 0x0FF0
351 #define MICNG_EETAG_END0 0x0000
352 #define MICNG_EETAG_END1 0xFFFF
354 /* 0x0001 - 0x000F reserved for housekeeping */
355 /* 0xFFFF - 0xFFFE reserved for housekeeping */
357 /* Micronas assigned tags
358 EEProm tags for hardware support */
360 #define MICNG_EETAG_DRXD1_OSCDEVIATION 0x1000 /* 2 Bytes data */
361 #define MICNG_EETAG_DRXD2_OSCDEVIATION 0x1001 /* 2 Bytes data */
363 #define MICNG_EETAG_MT2060_1_1STIF 0x1100 /* 2 Bytes data */
364 #define MICNG_EETAG_MT2060_2_1STIF 0x1101 /* 2 Bytes data */
366 /* Tag range for OEMs */
368 #define MICNG_EETAG_OEM_FIRST 0xC000
369 #define MICNG_EETAG_OEM_LAST 0xFFEF
371 static int i2c_write_eeprom(struct i2c_adapter
*adapter
,
372 u8 adr
, u16 reg
, u8 data
)
374 u8 m
[3] = {(reg
>> 8), (reg
& 0xff), data
};
375 struct i2c_msg msg
= {.addr
= adr
, .flags
= 0, .buf
= m
,
378 if (i2c_transfer(adapter
, &msg
, 1) != 1) {
379 pr_err(DEVICE_NAME
": Error writing EEPROM!\n");
385 static int i2c_read_eeprom(struct i2c_adapter
*adapter
,
386 u8 adr
, u16 reg
, u8
*data
, int len
)
388 u8 msg
[2] = {(reg
>> 8), (reg
& 0xff)};
389 struct i2c_msg msgs
[2] = {{.addr
= adr
, .flags
= 0,
390 .buf
= msg
, .len
= 2 },
391 {.addr
= adr
, .flags
= I2C_M_RD
,
392 .buf
= data
, .len
= len
} };
394 if (i2c_transfer(adapter
, msgs
, 2) != 2) {
395 pr_err(DEVICE_NAME
": Error reading EEPROM\n");
401 static int ReadEEProm(struct i2c_adapter
*adapter
,
402 u16 Tag
, u32 MaxLen
, u8
*data
, u32
*pLength
)
405 u16 Addr
= MICNG_EE_START
, Length
, tag
= 0;
408 while (Addr
+ sizeof(u16
) + 1 < MICNG_EE_END
) {
409 if (i2c_read_eeprom(adapter
, 0x50, Addr
, EETag
, sizeof(EETag
)))
411 tag
= (EETag
[0] << 8) | EETag
[1];
412 if (tag
== MICNG_EETAG_END0
|| tag
== MICNG_EETAG_END1
)
416 Addr
+= sizeof(u16
) + 1 + EETag
[2];
418 if (Addr
+ sizeof(u16
) + 1 + EETag
[2] > MICNG_EE_END
) {
420 ": Reached EOEE @ Tag = %04x Length = %3d\n",
426 Length
= (u16
) MaxLen
;
428 Addr
+= sizeof(u16
) + 1;
429 status
= i2c_read_eeprom(adapter
, 0x50, Addr
, data
, Length
);
433 if (Length
< EETag
[2])
434 status
= STATUS_BUFFER_OVERFLOW
;
441 static int WriteEEProm(struct i2c_adapter
*adapter
,
442 u16 Tag
, u32 Length
, u8
*data
)
445 u16 Addr
= MICNG_EE_START
;
450 while (Addr
+ sizeof(u16
) + 1 < MICNG_EE_END
) {
451 if (i2c_read_eeprom(adapter
, 0x50, Addr
, EETag
, sizeof(EETag
)))
453 tag
= (EETag
[0] << 8) | EETag
[1];
454 if (tag
== MICNG_EETAG_END0
|| tag
== MICNG_EETAG_END1
)
458 Addr
+= sizeof(u16
) + 1 + EETag
[2];
460 if (Addr
+ sizeof(u16
) + 1 + EETag
[2] > MICNG_EE_END
) {
462 ": Reached EOEE @ Tag = %04x Length = %3d\n",
467 if (Length
> EETag
[2])
469 /* Note: We write the data one byte at a time to avoid
470 issues with page sizes. (which are different for
471 each manufacture and eeprom size)
473 Addr
+= sizeof(u16
) + 1;
474 for (i
= 0; i
< Length
; i
++, Addr
++) {
475 status
= i2c_write_eeprom(adapter
, 0x50, Addr
, data
[i
]);
480 /* Poll for finishing write cycle */
486 status
= i2c_read_eeprom(adapter
, 0x50, Addr
, &Tmp
, 1);
491 "eeprom write error\n");
496 ": Timeout polling eeprom\n");
503 static int eeprom_read_ushort(struct i2c_adapter
*adapter
, u16 tag
, u16
*data
)
509 stat
= ReadEEProm(adapter
, tag
, 2, buf
, &len
);
515 *data
= (buf
[0] << 8) | buf
[1];
519 static int eeprom_write_ushort(struct i2c_adapter
*adapter
, u16 tag
, u16 data
)
525 buf
[1] = data
& 0xff;
526 stat
= WriteEEProm(adapter
, tag
, 2, buf
);
532 static s16
osc_deviation(void *priv
, s16 deviation
, int flag
)
534 struct ngene_channel
*chan
= priv
;
535 struct i2c_adapter
*adap
= &chan
->i2c_adapter
;
539 data
= (u16
) deviation
;
540 pr_info(DEVICE_NAME
": write deviation %d\n",
542 eeprom_write_ushort(adap
, 0x1000 + chan
->number
, data
);
544 if (eeprom_read_ushort(adap
, 0x1000 + chan
->number
, &data
))
546 pr_info(DEVICE_NAME
": read deviation %d\n",
553 /****************************************************************************/
554 /* Switch control (I2C gates, etc.) *****************************************/
555 /****************************************************************************/
558 static struct stv090x_config fe_cineS2
= {
560 .demod_mode
= STV090x_DUAL
,
561 .clk_mode
= STV090x_CLK_EXT
,
566 .ts1_mode
= STV090x_TSMODE_SERIAL_PUNCTURED
,
567 .ts2_mode
= STV090x_TSMODE_SERIAL_PUNCTURED
,
569 .repeater_level
= STV090x_RPTLEVEL_16
,
571 .adc1_range
= STV090x_ADC_1Vpp
,
572 .adc2_range
= STV090x_ADC_1Vpp
,
574 .diseqc_envelope_mode
= true,
576 .tuner_i2c_lock
= cineS2_tuner_i2c_lock
,
579 static struct stv090x_config fe_cineS2_2
= {
581 .demod_mode
= STV090x_DUAL
,
582 .clk_mode
= STV090x_CLK_EXT
,
587 .ts1_mode
= STV090x_TSMODE_SERIAL_PUNCTURED
,
588 .ts2_mode
= STV090x_TSMODE_SERIAL_PUNCTURED
,
590 .repeater_level
= STV090x_RPTLEVEL_16
,
592 .adc1_range
= STV090x_ADC_1Vpp
,
593 .adc2_range
= STV090x_ADC_1Vpp
,
595 .diseqc_envelope_mode
= true,
597 .tuner_i2c_lock
= cineS2_tuner_i2c_lock
,
600 static struct stv6110x_config tuner_cineS2_0
= {
606 static struct stv6110x_config tuner_cineS2_1
= {
612 static const struct ngene_info ngene_info_cineS2
= {
613 .type
= NGENE_SIDEWINDER
,
614 .name
= "Linux4Media cineS2 DVB-S2 Twin Tuner",
615 .io_type
= {NGENE_IO_TSIN
, NGENE_IO_TSIN
},
616 .demod_attach
= {demod_attach_stv0900
, demod_attach_stv0900
},
617 .tuner_attach
= {tuner_attach_stv6110
, tuner_attach_stv6110
},
618 .fe_config
= {&fe_cineS2
, &fe_cineS2
},
619 .tuner_config
= {&tuner_cineS2_0
, &tuner_cineS2_1
},
623 .msi_supported
= true,
626 static const struct ngene_info ngene_info_satixS2
= {
627 .type
= NGENE_SIDEWINDER
,
628 .name
= "Mystique SaTiX-S2 Dual",
629 .io_type
= {NGENE_IO_TSIN
, NGENE_IO_TSIN
},
630 .demod_attach
= {demod_attach_stv0900
, demod_attach_stv0900
},
631 .tuner_attach
= {tuner_attach_stv6110
, tuner_attach_stv6110
},
632 .fe_config
= {&fe_cineS2
, &fe_cineS2
},
633 .tuner_config
= {&tuner_cineS2_0
, &tuner_cineS2_1
},
637 .msi_supported
= true,
640 static const struct ngene_info ngene_info_satixS2v2
= {
641 .type
= NGENE_SIDEWINDER
,
642 .name
= "Mystique SaTiX-S2 Dual (v2)",
643 .io_type
= {NGENE_IO_TSIN
, NGENE_IO_TSIN
, NGENE_IO_TSIN
, NGENE_IO_TSIN
,
645 .demod_attach
= {demod_attach_stv0900
, demod_attach_stv0900
, cineS2_probe
, cineS2_probe
},
646 .tuner_attach
= {tuner_attach_stv6110
, tuner_attach_stv6110
, tuner_attach_probe
, tuner_attach_probe
},
647 .fe_config
= {&fe_cineS2
, &fe_cineS2
, &fe_cineS2_2
, &fe_cineS2_2
},
648 .tuner_config
= {&tuner_cineS2_0
, &tuner_cineS2_1
, &tuner_cineS2_0
, &tuner_cineS2_1
},
649 .lnb
= {0x0a, 0x08, 0x0b, 0x09},
652 .msi_supported
= true,
655 static const struct ngene_info ngene_info_cineS2v5
= {
656 .type
= NGENE_SIDEWINDER
,
657 .name
= "Linux4Media cineS2 DVB-S2 Twin Tuner (v5)",
658 .io_type
= {NGENE_IO_TSIN
, NGENE_IO_TSIN
, NGENE_IO_TSIN
, NGENE_IO_TSIN
,
660 .demod_attach
= {demod_attach_stv0900
, demod_attach_stv0900
, cineS2_probe
, cineS2_probe
},
661 .tuner_attach
= {tuner_attach_stv6110
, tuner_attach_stv6110
, tuner_attach_probe
, tuner_attach_probe
},
662 .fe_config
= {&fe_cineS2
, &fe_cineS2
, &fe_cineS2_2
, &fe_cineS2_2
},
663 .tuner_config
= {&tuner_cineS2_0
, &tuner_cineS2_1
, &tuner_cineS2_0
, &tuner_cineS2_1
},
664 .lnb
= {0x0a, 0x08, 0x0b, 0x09},
667 .msi_supported
= true,
671 static const struct ngene_info ngene_info_duoFlex
= {
672 .type
= NGENE_SIDEWINDER
,
673 .name
= "Digital Devices DuoFlex PCIe or miniPCIe",
674 .io_type
= {NGENE_IO_TSIN
, NGENE_IO_TSIN
, NGENE_IO_TSIN
, NGENE_IO_TSIN
,
676 .demod_attach
= {cineS2_probe
, cineS2_probe
, cineS2_probe
, cineS2_probe
},
677 .tuner_attach
= {tuner_attach_probe
, tuner_attach_probe
, tuner_attach_probe
, tuner_attach_probe
},
678 .fe_config
= {&fe_cineS2
, &fe_cineS2
, &fe_cineS2_2
, &fe_cineS2_2
},
679 .tuner_config
= {&tuner_cineS2_0
, &tuner_cineS2_1
, &tuner_cineS2_0
, &tuner_cineS2_1
},
680 .lnb
= {0x0a, 0x08, 0x0b, 0x09},
683 .msi_supported
= true,
686 static const struct ngene_info ngene_info_m780
= {
688 .name
= "Aver M780 ATSC/QAM-B",
690 /* Channel 0 is analog, which is currently unsupported */
691 .io_type
= { NGENE_IO_NONE
, NGENE_IO_TSIN
},
692 .demod_attach
= { NULL
, demod_attach_lg330x
},
694 /* Ensure these are NULL else the frame will call them (as funcs) */
695 .tuner_attach
= { NULL
, NULL
, NULL
, NULL
},
696 .fe_config
= { NULL
, &aver_m780
},
699 /* A custom electrical interface config for the demod to bridge */
704 static struct drxd_config fe_terratec_dvbt_0
= {
706 .demod_address
= 0x70,
707 .demod_revision
= 0xa2,
708 .demoda_address
= 0x00,
710 .pll_type
= DVB_PLL_THOMSON_DTT7520X
,
712 .osc_deviation
= osc_deviation
,
715 static struct drxd_config fe_terratec_dvbt_1
= {
717 .demod_address
= 0x71,
718 .demod_revision
= 0xa2,
719 .demoda_address
= 0x00,
721 .pll_type
= DVB_PLL_THOMSON_DTT7520X
,
723 .osc_deviation
= osc_deviation
,
726 static const struct ngene_info ngene_info_terratec
= {
727 .type
= NGENE_TERRATEC
,
728 .name
= "Terratec Integra/Cinergy2400i Dual DVB-T",
729 .io_type
= {NGENE_IO_TSIN
, NGENE_IO_TSIN
},
730 .demod_attach
= {demod_attach_drxd
, demod_attach_drxd
},
731 .tuner_attach
= {tuner_attach_dtt7520x
, tuner_attach_dtt7520x
},
732 .fe_config
= {&fe_terratec_dvbt_0
, &fe_terratec_dvbt_1
},
736 /****************************************************************************/
740 /****************************************************************************/
741 /* PCI Subsystem ID *********************************************************/
742 /****************************************************************************/
744 #define NGENE_ID(_subvend, _subdev, _driverdata) { \
745 .vendor = NGENE_VID, .device = NGENE_PID, \
746 .subvendor = _subvend, .subdevice = _subdev, \
747 .driver_data = (unsigned long) &_driverdata }
749 /****************************************************************************/
751 static const struct pci_device_id ngene_id_tbl
[] = {
752 NGENE_ID(0x18c3, 0xabc3, ngene_info_cineS2
),
753 NGENE_ID(0x18c3, 0xabc4, ngene_info_cineS2
),
754 NGENE_ID(0x18c3, 0xdb01, ngene_info_satixS2
),
755 NGENE_ID(0x18c3, 0xdb02, ngene_info_satixS2v2
),
756 NGENE_ID(0x18c3, 0xdd00, ngene_info_cineS2v5
),
757 NGENE_ID(0x18c3, 0xdd10, ngene_info_duoFlex
),
758 NGENE_ID(0x18c3, 0xdd20, ngene_info_duoFlex
),
759 NGENE_ID(0x1461, 0x062e, ngene_info_m780
),
760 NGENE_ID(0x153b, 0x1167, ngene_info_terratec
),
763 MODULE_DEVICE_TABLE(pci
, ngene_id_tbl
);
765 /****************************************************************************/
766 /* Init/Exit ****************************************************************/
767 /****************************************************************************/
769 static pci_ers_result_t
ngene_error_detected(struct pci_dev
*dev
,
770 enum pci_channel_state state
)
772 printk(KERN_ERR DEVICE_NAME
": PCI error\n");
773 if (state
== pci_channel_io_perm_failure
)
774 return PCI_ERS_RESULT_DISCONNECT
;
775 if (state
== pci_channel_io_frozen
)
776 return PCI_ERS_RESULT_NEED_RESET
;
777 return PCI_ERS_RESULT_CAN_RECOVER
;
780 static pci_ers_result_t
ngene_slot_reset(struct pci_dev
*dev
)
782 printk(KERN_INFO DEVICE_NAME
": slot reset\n");
786 static void ngene_resume(struct pci_dev
*dev
)
788 printk(KERN_INFO DEVICE_NAME
": resume\n");
791 static const struct pci_error_handlers ngene_errors
= {
792 .error_detected
= ngene_error_detected
,
793 .slot_reset
= ngene_slot_reset
,
794 .resume
= ngene_resume
,
797 static struct pci_driver ngene_pci_driver
= {
799 .id_table
= ngene_id_tbl
,
800 .probe
= ngene_probe
,
801 .remove
= ngene_remove
,
802 .err_handler
= &ngene_errors
,
803 .shutdown
= ngene_shutdown
,
806 static __init
int module_init_ngene(void)
809 "nGene PCIE bridge driver, Copyright (C) 2005-2007 Micronas\n");
810 return pci_register_driver(&ngene_pci_driver
);
813 static __exit
void module_exit_ngene(void)
815 pci_unregister_driver(&ngene_pci_driver
);
818 module_init(module_init_ngene
);
819 module_exit(module_exit_ngene
);
821 MODULE_DESCRIPTION("nGene");
822 MODULE_AUTHOR("Micronas, Ralph Metzler, Manfred Voelkel");
823 MODULE_LICENSE("GPL");