]>
Commit | Line | Data |
---|---|---|
cbddcba6 DH |
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" | |
9143a437 | 43 | #include "tda18271c2dd.h" |
9ca9efb0 | 44 | #include "drxk.h" |
cbddcba6 DH |
45 | |
46 | ||
47 | /****************************************************************************/ | |
48 | /* Demod/tuner attachment ***************************************************/ | |
49 | /****************************************************************************/ | |
50 | ||
51 | static int tuner_attach_stv6110(struct ngene_channel *chan) | |
52 | { | |
5fec1857 | 53 | struct i2c_adapter *i2c; |
cbddcba6 DH |
54 | struct stv090x_config *feconf = (struct stv090x_config *) |
55 | chan->dev->card_info->fe_config[chan->number]; | |
56 | struct stv6110x_config *tunerconf = (struct stv6110x_config *) | |
57 | chan->dev->card_info->tuner_config[chan->number]; | |
58 | struct stv6110x_devctl *ctl; | |
59 | ||
5fec1857 OE |
60 | /* tuner 1+2: i2c adapter #0, tuner 3+4: i2c adapter #1 */ |
61 | if (chan->number < 2) | |
62 | i2c = &chan->dev->channel[0].i2c_adapter; | |
63 | else | |
64 | i2c = &chan->dev->channel[1].i2c_adapter; | |
65 | ||
66 | ctl = dvb_attach(stv6110x_attach, chan->fe, tunerconf, i2c); | |
cbddcba6 DH |
67 | if (ctl == NULL) { |
68 | printk(KERN_ERR DEVICE_NAME ": No STV6110X found!\n"); | |
69 | return -ENODEV; | |
70 | } | |
71 | ||
72 | feconf->tuner_init = ctl->tuner_init; | |
5fec1857 | 73 | feconf->tuner_sleep = ctl->tuner_sleep; |
cbddcba6 DH |
74 | feconf->tuner_set_mode = ctl->tuner_set_mode; |
75 | feconf->tuner_set_frequency = ctl->tuner_set_frequency; | |
76 | feconf->tuner_get_frequency = ctl->tuner_get_frequency; | |
77 | feconf->tuner_set_bandwidth = ctl->tuner_set_bandwidth; | |
78 | feconf->tuner_get_bandwidth = ctl->tuner_get_bandwidth; | |
79 | feconf->tuner_set_bbgain = ctl->tuner_set_bbgain; | |
80 | feconf->tuner_get_bbgain = ctl->tuner_get_bbgain; | |
81 | feconf->tuner_set_refclk = ctl->tuner_set_refclk; | |
82 | feconf->tuner_get_status = ctl->tuner_get_status; | |
83 | ||
84 | return 0; | |
85 | } | |
86 | ||
87 | ||
9ca9efb0 RM |
88 | static int drxk_gate_ctrl(struct dvb_frontend *fe, int enable) |
89 | { | |
90 | struct ngene_channel *chan = fe->sec_priv; | |
91 | int status; | |
92 | ||
93 | if (enable) { | |
94 | down(&chan->dev->pll_mutex); | |
95 | status = chan->gate_ctrl(fe, 1); | |
96 | } else { | |
97 | status = chan->gate_ctrl(fe, 0); | |
98 | up(&chan->dev->pll_mutex); | |
99 | } | |
100 | return status; | |
101 | } | |
102 | ||
9ca9efb0 RM |
103 | static int tuner_attach_tda18271(struct ngene_channel *chan) |
104 | { | |
105 | struct i2c_adapter *i2c; | |
106 | struct dvb_frontend *fe; | |
107 | ||
108 | i2c = &chan->dev->channel[0].i2c_adapter; | |
109 | if (chan->fe->ops.i2c_gate_ctrl) | |
110 | chan->fe->ops.i2c_gate_ctrl(chan->fe, 1); | |
111 | fe = dvb_attach(tda18271c2dd_attach, chan->fe, i2c, 0x60); | |
112 | if (chan->fe->ops.i2c_gate_ctrl) | |
113 | chan->fe->ops.i2c_gate_ctrl(chan->fe, 0); | |
114 | if (!fe) { | |
9143a437 | 115 | printk(KERN_ERR "No TDA18271 found!\n"); |
9ca9efb0 RM |
116 | return -ENODEV; |
117 | } | |
118 | ||
119 | return 0; | |
120 | } | |
121 | ||
122 | static int tuner_attach_probe(struct ngene_channel *chan) | |
123 | { | |
124 | if (chan->demod_type == 0) | |
125 | return tuner_attach_stv6110(chan); | |
126 | if (chan->demod_type == 1) | |
127 | return tuner_attach_tda18271(chan); | |
128 | return -EINVAL; | |
129 | } | |
130 | ||
cbddcba6 DH |
131 | static int demod_attach_stv0900(struct ngene_channel *chan) |
132 | { | |
5fec1857 | 133 | struct i2c_adapter *i2c; |
cbddcba6 DH |
134 | struct stv090x_config *feconf = (struct stv090x_config *) |
135 | chan->dev->card_info->fe_config[chan->number]; | |
136 | ||
5fec1857 OE |
137 | /* tuner 1+2: i2c adapter #0, tuner 3+4: i2c adapter #1 */ |
138 | /* Note: Both adapters share the same i2c bus, but the demod */ | |
139 | /* driver requires that each demod has its own i2c adapter */ | |
140 | if (chan->number < 2) | |
141 | i2c = &chan->dev->channel[0].i2c_adapter; | |
142 | else | |
143 | i2c = &chan->dev->channel[1].i2c_adapter; | |
144 | ||
145 | chan->fe = dvb_attach(stv090x_attach, feconf, i2c, | |
146 | (chan->number & 1) == 0 ? STV090x_DEMODULATOR_0 | |
147 | : STV090x_DEMODULATOR_1); | |
cbddcba6 DH |
148 | if (chan->fe == NULL) { |
149 | printk(KERN_ERR DEVICE_NAME ": No STV0900 found!\n"); | |
150 | return -ENODEV; | |
151 | } | |
152 | ||
5fec1857 OE |
153 | /* store channel info */ |
154 | if (feconf->tuner_i2c_lock) | |
155 | chan->fe->analog_demod_priv = chan; | |
156 | ||
157 | if (!dvb_attach(lnbh24_attach, chan->fe, i2c, 0, | |
cbddcba6 DH |
158 | 0, chan->dev->card_info->lnb[chan->number])) { |
159 | printk(KERN_ERR DEVICE_NAME ": No LNBH24 found!\n"); | |
160 | dvb_frontend_detach(chan->fe); | |
8a484719 | 161 | chan->fe = NULL; |
cbddcba6 DH |
162 | return -ENODEV; |
163 | } | |
164 | ||
165 | return 0; | |
166 | } | |
167 | ||
5fec1857 OE |
168 | static void cineS2_tuner_i2c_lock(struct dvb_frontend *fe, int lock) |
169 | { | |
170 | struct ngene_channel *chan = fe->analog_demod_priv; | |
171 | ||
172 | if (lock) | |
173 | down(&chan->dev->pll_mutex); | |
174 | else | |
175 | up(&chan->dev->pll_mutex); | |
176 | } | |
177 | ||
9ca9efb0 RM |
178 | static int i2c_read(struct i2c_adapter *adapter, u8 adr, u8 *val) |
179 | { | |
180 | struct i2c_msg msgs[1] = {{.addr = adr, .flags = I2C_M_RD, | |
9143a437 | 181 | .buf = val, .len = 1 } }; |
9ca9efb0 RM |
182 | return (i2c_transfer(adapter, msgs, 1) == 1) ? 0 : -1; |
183 | } | |
184 | ||
185 | static int i2c_read_reg16(struct i2c_adapter *adapter, u8 adr, | |
186 | u16 reg, u8 *val) | |
187 | { | |
188 | u8 msg[2] = {reg>>8, reg&0xff}; | |
189 | struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0, | |
190 | .buf = msg, .len = 2}, | |
191 | {.addr = adr, .flags = I2C_M_RD, | |
9143a437 | 192 | .buf = val, .len = 1} }; |
9ca9efb0 RM |
193 | return (i2c_transfer(adapter, msgs, 2) == 2) ? 0 : -1; |
194 | } | |
195 | ||
196 | static int port_has_stv0900(struct i2c_adapter *i2c, int port) | |
197 | { | |
198 | u8 val; | |
199 | if (i2c_read_reg16(i2c, 0x68+port/2, 0xf100, &val) < 0) | |
200 | return 0; | |
201 | return 1; | |
202 | } | |
203 | ||
204 | static int port_has_drxk(struct i2c_adapter *i2c, int port) | |
205 | { | |
206 | u8 val; | |
207 | ||
208 | if (i2c_read(i2c, 0x29+port, &val) < 0) | |
209 | return 0; | |
9ca9efb0 RM |
210 | return 1; |
211 | } | |
212 | ||
213 | static int demod_attach_drxk(struct ngene_channel *chan, | |
214 | struct i2c_adapter *i2c) | |
215 | { | |
9143a437 | 216 | chan->fe = dvb_attach(drxk_attach, |
9ca9efb0 RM |
217 | i2c, 0x29 + (chan->number^2), |
218 | &chan->fe2); | |
219 | if (!chan->fe) { | |
9143a437 | 220 | printk(KERN_ERR "No DRXK found!\n"); |
9ca9efb0 RM |
221 | return -ENODEV; |
222 | } | |
9143a437 OE |
223 | chan->fe->sec_priv = chan; |
224 | chan->gate_ctrl = chan->fe->ops.i2c_gate_ctrl; | |
225 | chan->fe->ops.i2c_gate_ctrl = drxk_gate_ctrl; | |
9ca9efb0 RM |
226 | return 0; |
227 | } | |
228 | ||
5fec1857 OE |
229 | static int cineS2_probe(struct ngene_channel *chan) |
230 | { | |
231 | struct i2c_adapter *i2c; | |
232 | struct stv090x_config *fe_conf; | |
233 | u8 buf[3]; | |
234 | struct i2c_msg i2c_msg = { .flags = 0, .buf = buf }; | |
235 | int rc; | |
236 | ||
237 | /* tuner 1+2: i2c adapter #0, tuner 3+4: i2c adapter #1 */ | |
238 | if (chan->number < 2) | |
239 | i2c = &chan->dev->channel[0].i2c_adapter; | |
240 | else | |
241 | i2c = &chan->dev->channel[1].i2c_adapter; | |
242 | ||
9ca9efb0 | 243 | if (port_has_stv0900(i2c, chan->number)) { |
9143a437 | 244 | chan->demod_type = 0; |
9ca9efb0 RM |
245 | fe_conf = chan->dev->card_info->fe_config[chan->number]; |
246 | /* demod found, attach it */ | |
247 | rc = demod_attach_stv0900(chan); | |
248 | if (rc < 0 || chan->number < 2) | |
249 | return rc; | |
9143a437 | 250 | |
9ca9efb0 RM |
251 | /* demod #2: reprogram outputs DPN1 & DPN2 */ |
252 | i2c_msg.addr = fe_conf->address; | |
253 | i2c_msg.len = 3; | |
254 | buf[0] = 0xf1; | |
9143a437 | 255 | switch (chan->number) { |
9ca9efb0 RM |
256 | case 2: |
257 | buf[1] = 0x5c; | |
258 | buf[2] = 0xc2; | |
259 | break; | |
260 | case 3: | |
261 | buf[1] = 0x61; | |
262 | buf[2] = 0xcc; | |
263 | break; | |
264 | default: | |
265 | return -ENODEV; | |
266 | } | |
267 | rc = i2c_transfer(i2c, &i2c_msg, 1); | |
268 | if (rc != 1) { | |
269 | printk(KERN_ERR DEVICE_NAME ": could not setup DPNx\n"); | |
270 | return -EIO; | |
271 | } | |
272 | } else if (port_has_drxk(i2c, chan->number^2)) { | |
9143a437 | 273 | chan->demod_type = 1; |
9ca9efb0 RM |
274 | demod_attach_drxk(chan, i2c); |
275 | } else { | |
9143a437 | 276 | printk(KERN_ERR "No demod found on chan %d\n", chan->number); |
d9396b84 | 277 | return -ENODEV; |
5fec1857 | 278 | } |
5fec1857 OE |
279 | return 0; |
280 | } | |
281 | ||
282 | ||
cbddcba6 DH |
283 | static struct lgdt330x_config aver_m780 = { |
284 | .demod_address = 0xb2 >> 1, | |
285 | .demod_chip = LGDT3303, | |
286 | .serial_mpeg = 0x00, /* PARALLEL */ | |
287 | .clock_polarity_flip = 1, | |
288 | }; | |
289 | ||
290 | static struct mt2131_config m780_tunerconfig = { | |
291 | 0xc0 >> 1 | |
292 | }; | |
293 | ||
294 | /* A single func to attach the demo and tuner, rather than | |
295 | * use two sep funcs like the current design mandates. | |
296 | */ | |
297 | static int demod_attach_lg330x(struct ngene_channel *chan) | |
298 | { | |
299 | chan->fe = dvb_attach(lgdt330x_attach, &aver_m780, &chan->i2c_adapter); | |
300 | if (chan->fe == NULL) { | |
301 | printk(KERN_ERR DEVICE_NAME ": No LGDT330x found!\n"); | |
302 | return -ENODEV; | |
303 | } | |
304 | ||
305 | dvb_attach(mt2131_attach, chan->fe, &chan->i2c_adapter, | |
306 | &m780_tunerconfig, 0); | |
307 | ||
308 | return (chan->fe) ? 0 : -ENODEV; | |
309 | } | |
310 | ||
311 | /****************************************************************************/ | |
312 | /* Switch control (I2C gates, etc.) *****************************************/ | |
313 | /****************************************************************************/ | |
314 | ||
315 | ||
316 | static struct stv090x_config fe_cineS2 = { | |
317 | .device = STV0900, | |
318 | .demod_mode = STV090x_DUAL, | |
319 | .clk_mode = STV090x_CLK_EXT, | |
320 | ||
321 | .xtal = 27000000, | |
322 | .address = 0x68, | |
323 | ||
324 | .ts1_mode = STV090x_TSMODE_SERIAL_PUNCTURED, | |
325 | .ts2_mode = STV090x_TSMODE_SERIAL_PUNCTURED, | |
326 | ||
327 | .repeater_level = STV090x_RPTLEVEL_16, | |
328 | ||
329 | .adc1_range = STV090x_ADC_1Vpp, | |
330 | .adc2_range = STV090x_ADC_1Vpp, | |
331 | ||
332 | .diseqc_envelope_mode = true, | |
5fec1857 OE |
333 | |
334 | .tuner_i2c_lock = cineS2_tuner_i2c_lock, | |
335 | }; | |
336 | ||
337 | static struct stv090x_config fe_cineS2_2 = { | |
338 | .device = STV0900, | |
339 | .demod_mode = STV090x_DUAL, | |
340 | .clk_mode = STV090x_CLK_EXT, | |
341 | ||
342 | .xtal = 27000000, | |
343 | .address = 0x69, | |
344 | ||
345 | .ts1_mode = STV090x_TSMODE_SERIAL_PUNCTURED, | |
346 | .ts2_mode = STV090x_TSMODE_SERIAL_PUNCTURED, | |
347 | ||
348 | .repeater_level = STV090x_RPTLEVEL_16, | |
349 | ||
350 | .adc1_range = STV090x_ADC_1Vpp, | |
351 | .adc2_range = STV090x_ADC_1Vpp, | |
352 | ||
353 | .diseqc_envelope_mode = true, | |
354 | ||
355 | .tuner_i2c_lock = cineS2_tuner_i2c_lock, | |
cbddcba6 DH |
356 | }; |
357 | ||
358 | static struct stv6110x_config tuner_cineS2_0 = { | |
359 | .addr = 0x60, | |
360 | .refclk = 27000000, | |
361 | .clk_div = 1, | |
362 | }; | |
363 | ||
364 | static struct stv6110x_config tuner_cineS2_1 = { | |
365 | .addr = 0x63, | |
366 | .refclk = 27000000, | |
367 | .clk_div = 1, | |
368 | }; | |
369 | ||
370 | static struct ngene_info ngene_info_cineS2 = { | |
371 | .type = NGENE_SIDEWINDER, | |
372 | .name = "Linux4Media cineS2 DVB-S2 Twin Tuner", | |
373 | .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN}, | |
374 | .demod_attach = {demod_attach_stv0900, demod_attach_stv0900}, | |
375 | .tuner_attach = {tuner_attach_stv6110, tuner_attach_stv6110}, | |
376 | .fe_config = {&fe_cineS2, &fe_cineS2}, | |
377 | .tuner_config = {&tuner_cineS2_0, &tuner_cineS2_1}, | |
378 | .lnb = {0x0b, 0x08}, | |
379 | .tsf = {3, 3}, | |
5fec1857 OE |
380 | .fw_version = 18, |
381 | .msi_supported = true, | |
cbddcba6 DH |
382 | }; |
383 | ||
384 | static struct ngene_info ngene_info_satixS2 = { | |
385 | .type = NGENE_SIDEWINDER, | |
386 | .name = "Mystique SaTiX-S2 Dual", | |
387 | .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN}, | |
388 | .demod_attach = {demod_attach_stv0900, demod_attach_stv0900}, | |
389 | .tuner_attach = {tuner_attach_stv6110, tuner_attach_stv6110}, | |
390 | .fe_config = {&fe_cineS2, &fe_cineS2}, | |
391 | .tuner_config = {&tuner_cineS2_0, &tuner_cineS2_1}, | |
392 | .lnb = {0x0b, 0x08}, | |
393 | .tsf = {3, 3}, | |
5fec1857 OE |
394 | .fw_version = 18, |
395 | .msi_supported = true, | |
cbddcba6 DH |
396 | }; |
397 | ||
398 | static struct ngene_info ngene_info_satixS2v2 = { | |
399 | .type = NGENE_SIDEWINDER, | |
400 | .name = "Mystique SaTiX-S2 Dual (v2)", | |
f164396f OE |
401 | .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN, NGENE_IO_TSIN, NGENE_IO_TSIN, |
402 | NGENE_IO_TSOUT}, | |
5fec1857 OE |
403 | .demod_attach = {demod_attach_stv0900, demod_attach_stv0900, cineS2_probe, cineS2_probe}, |
404 | .tuner_attach = {tuner_attach_stv6110, tuner_attach_stv6110, tuner_attach_stv6110, tuner_attach_stv6110}, | |
405 | .fe_config = {&fe_cineS2, &fe_cineS2, &fe_cineS2_2, &fe_cineS2_2}, | |
406 | .tuner_config = {&tuner_cineS2_0, &tuner_cineS2_1, &tuner_cineS2_0, &tuner_cineS2_1}, | |
407 | .lnb = {0x0a, 0x08, 0x0b, 0x09}, | |
cbddcba6 | 408 | .tsf = {3, 3}, |
5fec1857 OE |
409 | .fw_version = 18, |
410 | .msi_supported = true, | |
cbddcba6 DH |
411 | }; |
412 | ||
413 | static struct ngene_info ngene_info_cineS2v5 = { | |
414 | .type = NGENE_SIDEWINDER, | |
415 | .name = "Linux4Media cineS2 DVB-S2 Twin Tuner (v5)", | |
0f0b270f RM |
416 | .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN, NGENE_IO_TSIN, NGENE_IO_TSIN, |
417 | NGENE_IO_TSOUT}, | |
5fec1857 OE |
418 | .demod_attach = {demod_attach_stv0900, demod_attach_stv0900, cineS2_probe, cineS2_probe}, |
419 | .tuner_attach = {tuner_attach_stv6110, tuner_attach_stv6110, tuner_attach_stv6110, tuner_attach_stv6110}, | |
420 | .fe_config = {&fe_cineS2, &fe_cineS2, &fe_cineS2_2, &fe_cineS2_2}, | |
421 | .tuner_config = {&tuner_cineS2_0, &tuner_cineS2_1, &tuner_cineS2_0, &tuner_cineS2_1}, | |
422 | .lnb = {0x0a, 0x08, 0x0b, 0x09}, | |
cbddcba6 | 423 | .tsf = {3, 3}, |
5fec1857 OE |
424 | .fw_version = 18, |
425 | .msi_supported = true, | |
cbddcba6 DH |
426 | }; |
427 | ||
5fec1857 | 428 | |
6c50b666 | 429 | static struct ngene_info ngene_info_duoFlex = { |
9d78f460 | 430 | .type = NGENE_SIDEWINDER, |
6c50b666 | 431 | .name = "Digital Devices DuoFlex PCIe or miniPCIe", |
0f0b270f RM |
432 | .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN, NGENE_IO_TSIN, NGENE_IO_TSIN, |
433 | NGENE_IO_TSOUT}, | |
5fec1857 | 434 | .demod_attach = {cineS2_probe, cineS2_probe, cineS2_probe, cineS2_probe}, |
9ca9efb0 | 435 | .tuner_attach = {tuner_attach_probe, tuner_attach_probe, tuner_attach_probe, tuner_attach_probe}, |
5fec1857 OE |
436 | .fe_config = {&fe_cineS2, &fe_cineS2, &fe_cineS2_2, &fe_cineS2_2}, |
437 | .tuner_config = {&tuner_cineS2_0, &tuner_cineS2_1, &tuner_cineS2_0, &tuner_cineS2_1}, | |
438 | .lnb = {0x0a, 0x08, 0x0b, 0x09}, | |
9d78f460 | 439 | .tsf = {3, 3}, |
5fec1857 OE |
440 | .fw_version = 18, |
441 | .msi_supported = true, | |
9d78f460 OE |
442 | }; |
443 | ||
cbddcba6 DH |
444 | static struct ngene_info ngene_info_m780 = { |
445 | .type = NGENE_APP, | |
446 | .name = "Aver M780 ATSC/QAM-B", | |
447 | ||
448 | /* Channel 0 is analog, which is currently unsupported */ | |
449 | .io_type = { NGENE_IO_NONE, NGENE_IO_TSIN }, | |
450 | .demod_attach = { NULL, demod_attach_lg330x }, | |
451 | ||
452 | /* Ensure these are NULL else the frame will call them (as funcs) */ | |
453 | .tuner_attach = { 0, 0, 0, 0 }, | |
454 | .fe_config = { NULL, &aver_m780 }, | |
455 | .avf = { 0 }, | |
456 | ||
457 | /* A custom electrical interface config for the demod to bridge */ | |
458 | .tsf = { 4, 4 }, | |
459 | .fw_version = 15, | |
460 | }; | |
461 | ||
462 | /****************************************************************************/ | |
463 | ||
464 | ||
465 | ||
466 | /****************************************************************************/ | |
467 | /* PCI Subsystem ID *********************************************************/ | |
468 | /****************************************************************************/ | |
469 | ||
470 | #define NGENE_ID(_subvend, _subdev, _driverdata) { \ | |
471 | .vendor = NGENE_VID, .device = NGENE_PID, \ | |
472 | .subvendor = _subvend, .subdevice = _subdev, \ | |
473 | .driver_data = (unsigned long) &_driverdata } | |
474 | ||
475 | /****************************************************************************/ | |
476 | ||
477 | static const struct pci_device_id ngene_id_tbl[] __devinitdata = { | |
478 | NGENE_ID(0x18c3, 0xabc3, ngene_info_cineS2), | |
479 | NGENE_ID(0x18c3, 0xabc4, ngene_info_cineS2), | |
480 | NGENE_ID(0x18c3, 0xdb01, ngene_info_satixS2), | |
481 | NGENE_ID(0x18c3, 0xdb02, ngene_info_satixS2v2), | |
482 | NGENE_ID(0x18c3, 0xdd00, ngene_info_cineS2v5), | |
6c50b666 OE |
483 | NGENE_ID(0x18c3, 0xdd10, ngene_info_duoFlex), |
484 | NGENE_ID(0x18c3, 0xdd20, ngene_info_duoFlex), | |
cbddcba6 DH |
485 | NGENE_ID(0x1461, 0x062e, ngene_info_m780), |
486 | {0} | |
487 | }; | |
488 | MODULE_DEVICE_TABLE(pci, ngene_id_tbl); | |
489 | ||
490 | /****************************************************************************/ | |
491 | /* Init/Exit ****************************************************************/ | |
492 | /****************************************************************************/ | |
493 | ||
494 | static pci_ers_result_t ngene_error_detected(struct pci_dev *dev, | |
9143a437 | 495 | enum pci_channel_state state) |
cbddcba6 DH |
496 | { |
497 | printk(KERN_ERR DEVICE_NAME ": PCI error\n"); | |
498 | if (state == pci_channel_io_perm_failure) | |
499 | return PCI_ERS_RESULT_DISCONNECT; | |
500 | if (state == pci_channel_io_frozen) | |
501 | return PCI_ERS_RESULT_NEED_RESET; | |
502 | return PCI_ERS_RESULT_CAN_RECOVER; | |
503 | } | |
504 | ||
505 | static pci_ers_result_t ngene_link_reset(struct pci_dev *dev) | |
506 | { | |
507 | printk(KERN_INFO DEVICE_NAME ": link reset\n"); | |
508 | return 0; | |
509 | } | |
510 | ||
511 | static pci_ers_result_t ngene_slot_reset(struct pci_dev *dev) | |
512 | { | |
513 | printk(KERN_INFO DEVICE_NAME ": slot reset\n"); | |
514 | return 0; | |
515 | } | |
516 | ||
517 | static void ngene_resume(struct pci_dev *dev) | |
518 | { | |
519 | printk(KERN_INFO DEVICE_NAME ": resume\n"); | |
520 | } | |
521 | ||
522 | static struct pci_error_handlers ngene_errors = { | |
523 | .error_detected = ngene_error_detected, | |
524 | .link_reset = ngene_link_reset, | |
525 | .slot_reset = ngene_slot_reset, | |
526 | .resume = ngene_resume, | |
527 | }; | |
528 | ||
529 | static struct pci_driver ngene_pci_driver = { | |
530 | .name = "ngene", | |
531 | .id_table = ngene_id_tbl, | |
532 | .probe = ngene_probe, | |
533 | .remove = __devexit_p(ngene_remove), | |
534 | .err_handler = &ngene_errors, | |
1b7c41ef | 535 | .shutdown = ngene_shutdown, |
cbddcba6 DH |
536 | }; |
537 | ||
538 | static __init int module_init_ngene(void) | |
539 | { | |
540 | printk(KERN_INFO | |
541 | "nGene PCIE bridge driver, Copyright (C) 2005-2007 Micronas\n"); | |
542 | return pci_register_driver(&ngene_pci_driver); | |
543 | } | |
544 | ||
545 | static __exit void module_exit_ngene(void) | |
546 | { | |
547 | pci_unregister_driver(&ngene_pci_driver); | |
548 | } | |
549 | ||
550 | module_init(module_init_ngene); | |
551 | module_exit(module_exit_ngene); | |
552 | ||
553 | MODULE_DESCRIPTION("nGene"); | |
554 | MODULE_AUTHOR("Micronas, Ralph Metzler, Manfred Voelkel"); | |
555 | MODULE_LICENSE("GPL"); |