2 * budget.c: driver for the SAA7146 based Budget DVB cards
4 * Compiled from various sources by Michael Hunold <michael@mihu.de>
6 * Copyright (C) 2002 Ralph Metzler <rjkm@metzlerbros.de>
8 * Copyright (C) 1999-2002 Ralph Metzler
9 * & Marcus Metzler for convergence integrated media GmbH
11 * 26feb2004 Support for FS Activy Card (Grundig tuner) by
12 * Michael Dreher <michael@5dot1.de>,
13 * Oliver Endriss <o.endriss@gmx.de> and
14 * Andreas 'randy' Weinberger
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
34 * the project's page is at http://www.linuxtv.org/
56 static int diseqc_method
;
57 module_param(diseqc_method
, int, 0444);
58 MODULE_PARM_DESC(diseqc_method
, "Select DiSEqC method for subsystem id 13c2:1003, 0: default, 1: more reliable (for newer revisions only)");
60 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr
);
62 static void Set22K (struct budget
*budget
, int state
)
64 struct saa7146_dev
*dev
=budget
->dev
;
65 dprintk(2, "budget: %p\n", budget
);
66 saa7146_setgpio(dev
, 3, (state
? SAA7146_GPIO_OUTHI
: SAA7146_GPIO_OUTLO
));
69 /* Diseqc functions only for TT Budget card */
70 /* taken from the Skyvision DVB driver by
71 Ralph Metzler <rjkm@metzlerbros.de> */
73 static void DiseqcSendBit (struct budget
*budget
, int data
)
75 struct saa7146_dev
*dev
=budget
->dev
;
76 dprintk(2, "budget: %p\n", budget
);
78 saa7146_setgpio(dev
, 3, SAA7146_GPIO_OUTHI
);
79 udelay(data
? 500 : 1000);
80 saa7146_setgpio(dev
, 3, SAA7146_GPIO_OUTLO
);
81 udelay(data
? 1000 : 500);
84 static void DiseqcSendByte (struct budget
*budget
, int data
)
88 dprintk(2, "budget: %p\n", budget
);
90 for (i
=7; i
>=0; i
--) {
93 DiseqcSendBit(budget
, d
);
96 DiseqcSendBit(budget
, par
);
99 static int SendDiSEqCMsg (struct budget
*budget
, int len
, u8
*msg
, unsigned long burst
)
101 struct saa7146_dev
*dev
=budget
->dev
;
104 dprintk(2, "budget: %p\n", budget
);
106 saa7146_setgpio(dev
, 3, SAA7146_GPIO_OUTLO
);
109 for (i
=0; i
<len
; i
++)
110 DiseqcSendByte(budget
, msg
[i
]);
116 DiseqcSendByte(budget
, 0xff);
118 saa7146_setgpio(dev
, 3, SAA7146_GPIO_OUTHI
);
121 saa7146_setgpio(dev
, 3, SAA7146_GPIO_OUTLO
);
130 * Routines for the Fujitsu Siemens Activy budget card
131 * 22 kHz tone and DiSEqC are handled by the frontend.
132 * Voltage must be set here.
133 * GPIO 1: LNBP EN, GPIO 2: LNBP VSEL
135 static int SetVoltage_Activy (struct budget
*budget
, fe_sec_voltage_t voltage
)
137 struct saa7146_dev
*dev
=budget
->dev
;
139 dprintk(2, "budget: %p\n", budget
);
143 saa7146_setgpio(dev
, 1, SAA7146_GPIO_OUTHI
);
144 saa7146_setgpio(dev
, 2, SAA7146_GPIO_OUTLO
);
147 saa7146_setgpio(dev
, 1, SAA7146_GPIO_OUTHI
);
148 saa7146_setgpio(dev
, 2, SAA7146_GPIO_OUTHI
);
150 case SEC_VOLTAGE_OFF
:
151 saa7146_setgpio(dev
, 1, SAA7146_GPIO_OUTLO
);
160 static int siemens_budget_set_voltage(struct dvb_frontend
* fe
, fe_sec_voltage_t voltage
)
162 struct budget
* budget
= (struct budget
*) fe
->dvb
->priv
;
164 return SetVoltage_Activy (budget
, voltage
);
167 static int budget_set_tone(struct dvb_frontend
* fe
, fe_sec_tone_mode_t tone
)
169 struct budget
* budget
= (struct budget
*) fe
->dvb
->priv
;
187 static int budget_diseqc_send_master_cmd(struct dvb_frontend
* fe
, struct dvb_diseqc_master_cmd
* cmd
)
189 struct budget
* budget
= (struct budget
*) fe
->dvb
->priv
;
191 SendDiSEqCMsg (budget
, cmd
->msg_len
, cmd
->msg
, 0);
196 static int budget_diseqc_send_burst(struct dvb_frontend
* fe
, fe_sec_mini_cmd_t minicmd
)
198 struct budget
* budget
= (struct budget
*) fe
->dvb
->priv
;
200 SendDiSEqCMsg (budget
, 0, NULL
, minicmd
);
205 static int alps_bsrv2_tuner_set_params(struct dvb_frontend
*fe
)
207 struct dtv_frontend_properties
*c
= &fe
->dtv_property_cache
;
208 struct budget
* budget
= (struct budget
*) fe
->dvb
->priv
;
211 struct i2c_msg msg
= { .addr
= 0x61, .flags
= 0, .buf
= buf
, .len
= sizeof(buf
) };
212 u32 div
= (c
->frequency
+ 479500) / 125;
214 if (c
->frequency
> 2000000)
216 else if (c
->frequency
> 1800000)
218 else if (c
->frequency
> 1600000)
220 else if (c
->frequency
> 1200000)
222 else if (c
->frequency
>= 1100000)
226 buf
[0] = (div
>> 8) & 0x7f;
228 buf
[2] = ((div
& 0x18000) >> 10) | 0x95;
229 buf
[3] = (pwr
<< 6) | 0x30;
231 // NOTE: since we're using a prescaler of 2, we set the
232 // divisor frequency to 62.5kHz and divide by 125 above
234 if (fe
->ops
.i2c_gate_ctrl
)
235 fe
->ops
.i2c_gate_ctrl(fe
, 1);
236 if (i2c_transfer (&budget
->i2c_adap
, &msg
, 1) != 1) return -EIO
;
240 static struct ves1x93_config alps_bsrv2_config
=
242 .demod_address
= 0x08,
247 static int alps_tdbe2_tuner_set_params(struct dvb_frontend
*fe
)
249 struct dtv_frontend_properties
*c
= &fe
->dtv_property_cache
;
250 struct budget
* budget
= (struct budget
*) fe
->dvb
->priv
;
253 struct i2c_msg msg
= { .addr
= 0x62, .flags
= 0, .buf
= data
, .len
= sizeof(data
) };
255 div
= (c
->frequency
+ 35937500 + 31250) / 62500;
257 data
[0] = (div
>> 8) & 0x7f;
258 data
[1] = div
& 0xff;
259 data
[2] = 0x85 | ((div
>> 10) & 0x60);
260 data
[3] = (c
->frequency
< 174000000 ? 0x88 : c
->frequency
< 470000000 ? 0x84 : 0x81);
262 if (fe
->ops
.i2c_gate_ctrl
)
263 fe
->ops
.i2c_gate_ctrl(fe
, 1);
264 if (i2c_transfer (&budget
->i2c_adap
, &msg
, 1) != 1) return -EIO
;
268 static struct ves1820_config alps_tdbe2_config
= {
269 .demod_address
= 0x09,
272 .selagc
= VES1820_SELAGC_SIGNAMPERR
,
275 static int grundig_29504_401_tuner_set_params(struct dvb_frontend
*fe
)
277 struct dtv_frontend_properties
*c
= &fe
->dtv_property_cache
;
278 struct budget
*budget
= fe
->dvb
->priv
;
279 u8
*tuner_addr
= fe
->tuner_priv
;
281 u8 cfg
, cpump
, band_select
;
283 struct i2c_msg msg
= { .flags
= 0, .buf
= data
, .len
= sizeof(data
) };
286 msg
.addr
= *tuner_addr
;
290 div
= (36125000 + c
->frequency
) / 166666;
294 if (c
->frequency
< 175000000)
296 else if (c
->frequency
< 390000000)
298 else if (c
->frequency
< 470000000)
300 else if (c
->frequency
< 750000000)
305 if (c
->frequency
< 175000000)
307 else if (c
->frequency
< 470000000)
312 data
[0] = (div
>> 8) & 0x7f;
313 data
[1] = div
& 0xff;
314 data
[2] = ((div
>> 10) & 0x60) | cfg
;
315 data
[3] = (cpump
<< 6) | band_select
;
317 if (fe
->ops
.i2c_gate_ctrl
)
318 fe
->ops
.i2c_gate_ctrl(fe
, 1);
319 if (i2c_transfer (&budget
->i2c_adap
, &msg
, 1) != 1) return -EIO
;
323 static struct l64781_config grundig_29504_401_config
= {
324 .demod_address
= 0x55,
327 static struct l64781_config grundig_29504_401_config_activy
= {
328 .demod_address
= 0x54,
331 static u8 tuner_address_grundig_29504_401_activy
= 0x60;
333 static int grundig_29504_451_tuner_set_params(struct dvb_frontend
*fe
)
335 struct dtv_frontend_properties
*c
= &fe
->dtv_property_cache
;
336 struct budget
* budget
= (struct budget
*) fe
->dvb
->priv
;
339 struct i2c_msg msg
= { .addr
= 0x61, .flags
= 0, .buf
= data
, .len
= sizeof(data
) };
341 div
= c
->frequency
/ 125;
342 data
[0] = (div
>> 8) & 0x7f;
343 data
[1] = div
& 0xff;
347 if (fe
->ops
.i2c_gate_ctrl
)
348 fe
->ops
.i2c_gate_ctrl(fe
, 1);
349 if (i2c_transfer (&budget
->i2c_adap
, &msg
, 1) != 1) return -EIO
;
353 static struct tda8083_config grundig_29504_451_config
= {
354 .demod_address
= 0x68,
357 static int s5h1420_tuner_set_params(struct dvb_frontend
*fe
)
359 struct dtv_frontend_properties
*c
= &fe
->dtv_property_cache
;
360 struct budget
* budget
= (struct budget
*) fe
->dvb
->priv
;
363 struct i2c_msg msg
= { .addr
= 0x61, .flags
= 0, .buf
= data
, .len
= sizeof(data
) };
365 div
= c
->frequency
/ 1000;
366 data
[0] = (div
>> 8) & 0x7f;
367 data
[1] = div
& 0xff;
379 if (fe
->ops
.i2c_gate_ctrl
)
380 fe
->ops
.i2c_gate_ctrl(fe
, 1);
381 if (i2c_transfer (&budget
->i2c_adap
, &msg
, 1) != 1) return -EIO
;
386 static struct s5h1420_config s5h1420_config
= {
387 .demod_address
= 0x53,
392 static struct tda10086_config tda10086_config
= {
393 .demod_address
= 0x0e,
396 .xtal_freq
= TDA10086_XTAL_16M
,
399 static struct stv0299_config alps_bsru6_config_activy
= {
400 .demod_address
= 0x68,
401 .inittab
= alps_bsru6_inittab
,
406 .set_symbol_rate
= alps_bsru6_set_symbol_rate
,
409 static struct stv0299_config alps_bsbe1_config_activy
= {
410 .demod_address
= 0x68,
411 .inittab
= alps_bsbe1_inittab
,
416 .set_symbol_rate
= alps_bsbe1_set_symbol_rate
,
419 static int alps_tdhd1_204_request_firmware(struct dvb_frontend
*fe
, const struct firmware
**fw
, char *name
)
421 struct budget
*budget
= (struct budget
*)fe
->dvb
->priv
;
423 return request_firmware(fw
, name
, &budget
->dev
->pci
->dev
);
427 static int i2c_readreg(struct i2c_adapter
*i2c
, u8 adr
, u8 reg
)
430 struct i2c_msg msg
[] = {
431 { .addr
= adr
, .flags
= 0, .buf
= ®
, .len
= 1 },
432 { .addr
= adr
, .flags
= I2C_M_RD
, .buf
= &val
, .len
= 1 }
435 return (i2c_transfer(i2c
, msg
, 2) != 2) ? -EIO
: val
;
438 static u8
read_pwm(struct budget
* budget
)
442 struct i2c_msg msg
[] = { { .addr
= 0x50,.flags
= 0,.buf
= &b
,.len
= 1 },
443 { .addr
= 0x50,.flags
= I2C_M_RD
,.buf
= &pwm
,.len
= 1} };
445 if ((i2c_transfer(&budget
->i2c_adap
, msg
, 2) != 2) || (pwm
== 0xff))
451 static struct stv090x_config tt1600_stv090x_config
= {
453 .demod_mode
= STV090x_SINGLE
,
454 .clk_mode
= STV090x_CLK_EXT
,
459 .ts1_mode
= STV090x_TSMODE_DVBCI
,
460 .ts2_mode
= STV090x_TSMODE_SERIAL_CONTINUOUS
,
462 .repeater_level
= STV090x_RPTLEVEL_16
,
466 .tuner_set_mode
= NULL
,
467 .tuner_set_frequency
= NULL
,
468 .tuner_get_frequency
= NULL
,
469 .tuner_set_bandwidth
= NULL
,
470 .tuner_get_bandwidth
= NULL
,
471 .tuner_set_bbgain
= NULL
,
472 .tuner_get_bbgain
= NULL
,
473 .tuner_set_refclk
= NULL
,
474 .tuner_get_status
= NULL
,
477 static struct stv6110x_config tt1600_stv6110x_config
= {
483 static struct isl6423_config tt1600_isl6423_config
= {
484 .current_max
= SEC_CURRENT_515m
,
485 .curlim
= SEC_CURRENT_LIM_ON
,
490 static void frontend_init(struct budget
*budget
)
492 (void)alps_bsbe1_config
; /* avoid warning */
494 switch(budget
->dev
->pci
->subsystem_device
) {
495 case 0x1003: // Hauppauge/TT Nova budget (stv0299/ALPS BSRU6(tsa5059) OR ves1893/ALPS BSRV2(sp5659))
497 // try the ALPS BSRV2 first of all
498 budget
->dvb_frontend
= dvb_attach(ves1x93_attach
, &alps_bsrv2_config
, &budget
->i2c_adap
);
499 if (budget
->dvb_frontend
) {
500 budget
->dvb_frontend
->ops
.tuner_ops
.set_params
= alps_bsrv2_tuner_set_params
;
501 budget
->dvb_frontend
->ops
.diseqc_send_master_cmd
= budget_diseqc_send_master_cmd
;
502 budget
->dvb_frontend
->ops
.diseqc_send_burst
= budget_diseqc_send_burst
;
503 budget
->dvb_frontend
->ops
.set_tone
= budget_set_tone
;
507 // try the ALPS BSRU6 now
508 budget
->dvb_frontend
= dvb_attach(stv0299_attach
, &alps_bsru6_config
, &budget
->i2c_adap
);
509 if (budget
->dvb_frontend
) {
510 budget
->dvb_frontend
->ops
.tuner_ops
.set_params
= alps_bsru6_tuner_set_params
;
511 budget
->dvb_frontend
->tuner_priv
= &budget
->i2c_adap
;
512 if (budget
->dev
->pci
->subsystem_device
== 0x1003 && diseqc_method
== 0) {
513 budget
->dvb_frontend
->ops
.diseqc_send_master_cmd
= budget_diseqc_send_master_cmd
;
514 budget
->dvb_frontend
->ops
.diseqc_send_burst
= budget_diseqc_send_burst
;
515 budget
->dvb_frontend
->ops
.set_tone
= budget_set_tone
;
521 case 0x1004: // Hauppauge/TT DVB-C budget (ves1820/ALPS TDBE2(sp5659))
523 budget
->dvb_frontend
= dvb_attach(ves1820_attach
, &alps_tdbe2_config
, &budget
->i2c_adap
, read_pwm(budget
));
524 if (budget
->dvb_frontend
) {
525 budget
->dvb_frontend
->ops
.tuner_ops
.set_params
= alps_tdbe2_tuner_set_params
;
530 case 0x1005: // Hauppauge/TT Nova-T budget (L64781/Grundig 29504-401(tsa5060))
532 budget
->dvb_frontend
= dvb_attach(l64781_attach
, &grundig_29504_401_config
, &budget
->i2c_adap
);
533 if (budget
->dvb_frontend
) {
534 budget
->dvb_frontend
->ops
.tuner_ops
.set_params
= grundig_29504_401_tuner_set_params
;
535 budget
->dvb_frontend
->tuner_priv
= NULL
;
540 case 0x4f52: /* Cards based on Philips Semi Sylt PCI ref. design */
541 budget
->dvb_frontend
= dvb_attach(stv0299_attach
, &alps_bsru6_config
, &budget
->i2c_adap
);
542 if (budget
->dvb_frontend
) {
543 printk(KERN_INFO
"budget: tuner ALPS BSRU6 in Philips Semi. Sylt detected\n");
544 budget
->dvb_frontend
->ops
.tuner_ops
.set_params
= alps_bsru6_tuner_set_params
;
545 budget
->dvb_frontend
->tuner_priv
= &budget
->i2c_adap
;
550 case 0x4f60: /* Fujitsu Siemens Activy Budget-S PCI rev AL (stv0299/tsa5059) */
552 int subtype
= i2c_readreg(&budget
->i2c_adap
, 0x50, 0x67);
556 /* fixme: find a better way to identify the card */
557 if (subtype
< 0x36) {
558 /* assume ALPS BSRU6 */
559 budget
->dvb_frontend
= dvb_attach(stv0299_attach
, &alps_bsru6_config_activy
, &budget
->i2c_adap
);
560 if (budget
->dvb_frontend
) {
561 printk(KERN_INFO
"budget: tuner ALPS BSRU6 detected\n");
562 budget
->dvb_frontend
->ops
.tuner_ops
.set_params
= alps_bsru6_tuner_set_params
;
563 budget
->dvb_frontend
->tuner_priv
= &budget
->i2c_adap
;
564 budget
->dvb_frontend
->ops
.set_voltage
= siemens_budget_set_voltage
;
565 budget
->dvb_frontend
->ops
.dishnetwork_send_legacy_command
= NULL
;
569 /* assume ALPS BSBE1 */
571 saa7146_setgpio(budget
->dev
, 3, SAA7146_GPIO_OUTLO
);
573 saa7146_setgpio(budget
->dev
, 3, SAA7146_GPIO_OUTHI
);
575 budget
->dvb_frontend
= dvb_attach(stv0299_attach
, &alps_bsbe1_config_activy
, &budget
->i2c_adap
);
576 if (budget
->dvb_frontend
) {
577 printk(KERN_INFO
"budget: tuner ALPS BSBE1 detected\n");
578 budget
->dvb_frontend
->ops
.tuner_ops
.set_params
= alps_bsbe1_tuner_set_params
;
579 budget
->dvb_frontend
->tuner_priv
= &budget
->i2c_adap
;
580 budget
->dvb_frontend
->ops
.set_voltage
= siemens_budget_set_voltage
;
581 budget
->dvb_frontend
->ops
.dishnetwork_send_legacy_command
= NULL
;
588 case 0x4f61: // Fujitsu Siemens Activy Budget-S PCI rev GR (tda8083/Grundig 29504-451(tsa5522))
589 budget
->dvb_frontend
= dvb_attach(tda8083_attach
, &grundig_29504_451_config
, &budget
->i2c_adap
);
590 if (budget
->dvb_frontend
) {
591 budget
->dvb_frontend
->ops
.tuner_ops
.set_params
= grundig_29504_451_tuner_set_params
;
592 budget
->dvb_frontend
->ops
.set_voltage
= siemens_budget_set_voltage
;
593 budget
->dvb_frontend
->ops
.dishnetwork_send_legacy_command
= NULL
;
597 case 0x5f60: /* Fujitsu Siemens Activy Budget-T PCI rev AL (tda10046/ALPS TDHD1-204A) */
598 budget
->dvb_frontend
= dvb_attach(tda10046_attach
, &alps_tdhd1_204a_config
, &budget
->i2c_adap
);
599 if (budget
->dvb_frontend
) {
600 budget
->dvb_frontend
->ops
.tuner_ops
.set_params
= alps_tdhd1_204a_tuner_set_params
;
601 budget
->dvb_frontend
->tuner_priv
= &budget
->i2c_adap
;
605 case 0x5f61: /* Fujitsu Siemens Activy Budget-T PCI rev GR (L64781/Grundig 29504-401(tsa5060)) */
606 budget
->dvb_frontend
= dvb_attach(l64781_attach
, &grundig_29504_401_config_activy
, &budget
->i2c_adap
);
607 if (budget
->dvb_frontend
) {
608 budget
->dvb_frontend
->tuner_priv
= &tuner_address_grundig_29504_401_activy
;
609 budget
->dvb_frontend
->ops
.tuner_ops
.set_params
= grundig_29504_401_tuner_set_params
;
613 case 0x1016: // Hauppauge/TT Nova-S SE (samsung s5h1420/????(tda8260))
614 budget
->dvb_frontend
= dvb_attach(s5h1420_attach
, &s5h1420_config
, &budget
->i2c_adap
);
615 if (budget
->dvb_frontend
) {
616 budget
->dvb_frontend
->ops
.tuner_ops
.set_params
= s5h1420_tuner_set_params
;
617 if (dvb_attach(lnbp21_attach
, budget
->dvb_frontend
, &budget
->i2c_adap
, 0, 0) == NULL
) {
618 printk("%s: No LNBP21 found!\n", __func__
);
624 case 0x1018: // TT Budget-S-1401 (philips tda10086/philips tda8262)
625 // gpio2 is connected to CLB - reset it + leave it high
626 saa7146_setgpio(budget
->dev
, 2, SAA7146_GPIO_OUTLO
);
628 saa7146_setgpio(budget
->dev
, 2, SAA7146_GPIO_OUTHI
);
631 budget
->dvb_frontend
= dvb_attach(tda10086_attach
, &tda10086_config
, &budget
->i2c_adap
);
632 if (budget
->dvb_frontend
) {
633 if (dvb_attach(tda826x_attach
, budget
->dvb_frontend
, 0x60, &budget
->i2c_adap
, 0) == NULL
)
634 printk("%s: No tda826x found!\n", __func__
);
635 if (dvb_attach(lnbp21_attach
, budget
->dvb_frontend
, &budget
->i2c_adap
, 0, 0) == NULL
) {
636 printk("%s: No LNBP21 found!\n", __func__
);
642 case 0x101c: { /* TT S2-1600 */
643 struct stv6110x_devctl
*ctl
;
644 saa7146_setgpio(budget
->dev
, 2, SAA7146_GPIO_OUTLO
);
646 saa7146_setgpio(budget
->dev
, 2, SAA7146_GPIO_OUTHI
);
649 budget
->dvb_frontend
= dvb_attach(stv090x_attach
,
650 &tt1600_stv090x_config
,
652 STV090x_DEMODULATOR_0
);
654 if (budget
->dvb_frontend
) {
656 ctl
= dvb_attach(stv6110x_attach
,
657 budget
->dvb_frontend
,
658 &tt1600_stv6110x_config
,
662 tt1600_stv090x_config
.tuner_init
= ctl
->tuner_init
;
663 tt1600_stv090x_config
.tuner_sleep
= ctl
->tuner_sleep
;
664 tt1600_stv090x_config
.tuner_set_mode
= ctl
->tuner_set_mode
;
665 tt1600_stv090x_config
.tuner_set_frequency
= ctl
->tuner_set_frequency
;
666 tt1600_stv090x_config
.tuner_get_frequency
= ctl
->tuner_get_frequency
;
667 tt1600_stv090x_config
.tuner_set_bandwidth
= ctl
->tuner_set_bandwidth
;
668 tt1600_stv090x_config
.tuner_get_bandwidth
= ctl
->tuner_get_bandwidth
;
669 tt1600_stv090x_config
.tuner_set_bbgain
= ctl
->tuner_set_bbgain
;
670 tt1600_stv090x_config
.tuner_get_bbgain
= ctl
->tuner_get_bbgain
;
671 tt1600_stv090x_config
.tuner_set_refclk
= ctl
->tuner_set_refclk
;
672 tt1600_stv090x_config
.tuner_get_status
= ctl
->tuner_get_status
;
674 /* call the init function once to initialize
675 tuner's clock output divider and demod's
677 if (budget
->dvb_frontend
->ops
.init
)
678 budget
->dvb_frontend
->ops
.init(budget
->dvb_frontend
);
680 if (dvb_attach(isl6423_attach
,
681 budget
->dvb_frontend
,
683 &tt1600_isl6423_config
) == NULL
) {
684 printk(KERN_ERR
"%s: No Intersil ISL6423 found!\n", __func__
);
688 printk(KERN_ERR
"%s: No STV6110(A) Silicon Tuner found!\n", __func__
);
695 case 0x1020: { /* Omicom S2 */
696 struct stv6110x_devctl
*ctl
;
697 saa7146_setgpio(budget
->dev
, 2, SAA7146_GPIO_OUTLO
);
699 saa7146_setgpio(budget
->dev
, 2, SAA7146_GPIO_OUTHI
);
702 budget
->dvb_frontend
= dvb_attach(stv090x_attach
,
703 &tt1600_stv090x_config
,
705 STV090x_DEMODULATOR_0
);
707 if (budget
->dvb_frontend
) {
708 printk(KERN_INFO
"budget: Omicom S2 detected\n");
710 ctl
= dvb_attach(stv6110x_attach
,
711 budget
->dvb_frontend
,
712 &tt1600_stv6110x_config
,
716 tt1600_stv090x_config
.tuner_init
= ctl
->tuner_init
;
717 tt1600_stv090x_config
.tuner_sleep
= ctl
->tuner_sleep
;
718 tt1600_stv090x_config
.tuner_set_mode
= ctl
->tuner_set_mode
;
719 tt1600_stv090x_config
.tuner_set_frequency
= ctl
->tuner_set_frequency
;
720 tt1600_stv090x_config
.tuner_get_frequency
= ctl
->tuner_get_frequency
;
721 tt1600_stv090x_config
.tuner_set_bandwidth
= ctl
->tuner_set_bandwidth
;
722 tt1600_stv090x_config
.tuner_get_bandwidth
= ctl
->tuner_get_bandwidth
;
723 tt1600_stv090x_config
.tuner_set_bbgain
= ctl
->tuner_set_bbgain
;
724 tt1600_stv090x_config
.tuner_get_bbgain
= ctl
->tuner_get_bbgain
;
725 tt1600_stv090x_config
.tuner_set_refclk
= ctl
->tuner_set_refclk
;
726 tt1600_stv090x_config
.tuner_get_status
= ctl
->tuner_get_status
;
728 /* call the init function once to initialize
729 tuner's clock output divider and demod's
731 if (budget
->dvb_frontend
->ops
.init
)
732 budget
->dvb_frontend
->ops
.init(budget
->dvb_frontend
);
734 if (dvb_attach(lnbh24_attach
,
735 budget
->dvb_frontend
,
737 LNBH24_PCL
| LNBH24_TTX
,
738 LNBH24_TEN
, 0x14>>1) == NULL
) {
740 "No LNBH24 found!\n");
744 printk(KERN_ERR
"%s: No STV6110(A) Silicon Tuner found!\n", __func__
);
752 if (budget
->dvb_frontend
== NULL
) {
753 printk("budget: A frontend driver was not found for device [%04x:%04x] subsystem [%04x:%04x]\n",
754 budget
->dev
->pci
->vendor
,
755 budget
->dev
->pci
->device
,
756 budget
->dev
->pci
->subsystem_vendor
,
757 budget
->dev
->pci
->subsystem_device
);
759 if (dvb_register_frontend(&budget
->dvb_adapter
, budget
->dvb_frontend
))
765 printk("budget: Frontend registration failed!\n");
766 dvb_frontend_detach(budget
->dvb_frontend
);
767 budget
->dvb_frontend
= NULL
;
771 static int budget_attach (struct saa7146_dev
* dev
, struct saa7146_pci_extension_data
*info
)
773 struct budget
*budget
= NULL
;
776 budget
= kmalloc(sizeof(struct budget
), GFP_KERNEL
);
777 if( NULL
== budget
) {
781 dprintk(2, "dev:%p, info:%p, budget:%p\n", dev
, info
, budget
);
783 dev
->ext_priv
= budget
;
785 err
= ttpci_budget_init(budget
, dev
, info
, THIS_MODULE
, adapter_nr
);
787 printk("==> failed\n");
792 budget
->dvb_adapter
.priv
= budget
;
793 frontend_init(budget
);
795 ttpci_budget_init_hooks(budget
);
800 static int budget_detach (struct saa7146_dev
* dev
)
802 struct budget
*budget
= (struct budget
*) dev
->ext_priv
;
805 if (budget
->dvb_frontend
) {
806 dvb_unregister_frontend(budget
->dvb_frontend
);
807 dvb_frontend_detach(budget
->dvb_frontend
);
810 err
= ttpci_budget_deinit (budget
);
813 dev
->ext_priv
= NULL
;
818 static struct saa7146_extension budget_extension
;
820 MAKE_BUDGET_INFO(ttbs
, "TT-Budget/WinTV-NOVA-S PCI", BUDGET_TT
);
821 MAKE_BUDGET_INFO(ttbc
, "TT-Budget/WinTV-NOVA-C PCI", BUDGET_TT
);
822 MAKE_BUDGET_INFO(ttbt
, "TT-Budget/WinTV-NOVA-T PCI", BUDGET_TT
);
823 MAKE_BUDGET_INFO(satel
, "SATELCO Multimedia PCI", BUDGET_TT_HW_DISEQC
);
824 MAKE_BUDGET_INFO(ttbs1401
, "TT-Budget-S-1401 PCI", BUDGET_TT
);
825 MAKE_BUDGET_INFO(tt1600
, "TT-Budget S2-1600 PCI", BUDGET_TT
);
826 MAKE_BUDGET_INFO(fsacs0
, "Fujitsu Siemens Activy Budget-S PCI (rev GR/grundig frontend)", BUDGET_FS_ACTIVY
);
827 MAKE_BUDGET_INFO(fsacs1
, "Fujitsu Siemens Activy Budget-S PCI (rev AL/alps frontend)", BUDGET_FS_ACTIVY
);
828 MAKE_BUDGET_INFO(fsact
, "Fujitsu Siemens Activy Budget-T PCI (rev GR/Grundig frontend)", BUDGET_FS_ACTIVY
);
829 MAKE_BUDGET_INFO(fsact1
, "Fujitsu Siemens Activy Budget-T PCI (rev AL/ALPS TDHD1-204A)", BUDGET_FS_ACTIVY
);
830 MAKE_BUDGET_INFO(omicom
, "Omicom S2 PCI", BUDGET_TT
);
831 MAKE_BUDGET_INFO(sylt
, "Philips Semi Sylt PCI", BUDGET_TT_HW_DISEQC
);
833 static struct pci_device_id pci_tbl
[] = {
834 MAKE_EXTENSION_PCI(ttbs
, 0x13c2, 0x1003),
835 MAKE_EXTENSION_PCI(ttbc
, 0x13c2, 0x1004),
836 MAKE_EXTENSION_PCI(ttbt
, 0x13c2, 0x1005),
837 MAKE_EXTENSION_PCI(satel
, 0x13c2, 0x1013),
838 MAKE_EXTENSION_PCI(ttbs
, 0x13c2, 0x1016),
839 MAKE_EXTENSION_PCI(ttbs1401
, 0x13c2, 0x1018),
840 MAKE_EXTENSION_PCI(tt1600
, 0x13c2, 0x101c),
841 MAKE_EXTENSION_PCI(fsacs1
,0x1131, 0x4f60),
842 MAKE_EXTENSION_PCI(fsacs0
,0x1131, 0x4f61),
843 MAKE_EXTENSION_PCI(fsact1
, 0x1131, 0x5f60),
844 MAKE_EXTENSION_PCI(fsact
, 0x1131, 0x5f61),
845 MAKE_EXTENSION_PCI(omicom
, 0x14c4, 0x1020),
846 MAKE_EXTENSION_PCI(sylt
, 0x1131, 0x4f52),
852 MODULE_DEVICE_TABLE(pci
, pci_tbl
);
854 static struct saa7146_extension budget_extension
= {
855 .name
= "budget dvb",
856 .flags
= SAA7146_USE_I2C_IRQ
,
858 .module
= THIS_MODULE
,
860 .attach
= budget_attach
,
861 .detach
= budget_detach
,
864 .irq_func
= ttpci_budget_irq10_handler
,
867 static int __init
budget_init(void)
869 return saa7146_register_extension(&budget_extension
);
872 static void __exit
budget_exit(void)
874 saa7146_unregister_extension(&budget_extension
);
877 module_init(budget_init
);
878 module_exit(budget_exit
);
880 MODULE_LICENSE("GPL");
881 MODULE_AUTHOR("Ralph Metzler, Marcus Metzler, Michael Hunold, others");
882 MODULE_DESCRIPTION("driver for the SAA7146 based so-called "
883 "budget PCI DVB cards by Siemens, Technotrend, Hauppauge");