44 #define budget_patch budget
67 dprintk(2,
"budget: %p\n", budget);
75 static void DiseqcSendBit (
struct budget *budget,
int data)
78 dprintk(2,
"budget: %p\n", budget);
86 static void DiseqcSendByte (
struct budget *budget,
int data)
90 dprintk(2,
"budget: %p\n", budget);
92 for (i=7; i>=0; i--) {
95 DiseqcSendBit(budget,
d);
98 DiseqcSendBit(budget, par);
101 static int SendDiSEqCMsg (
struct budget *budget,
int len,
u8 *
msg,
unsigned long burst)
106 dprintk(2,
"budget: %p\n", budget);
111 for (i=0; i<len; i++)
112 DiseqcSendByte(budget, msg[i]);
118 DiseqcSendByte(budget, 0xff);
135 struct budget* budget = (
struct budget*) fe->
dvb->priv;
139 gpio_Set22K (budget, 1);
143 gpio_Set22K (budget, 0);
155 struct budget* budget = (
struct budget*) fe->
dvb->priv;
157 SendDiSEqCMsg (budget, cmd->
msg_len, cmd->
msg, 0);
164 struct budget* budget = (
struct budget*) fe->
dvb->priv;
166 SendDiSEqCMsg (budget, 0,
NULL, minicmd);
175 dprintk(2,
"budget: %p\n", budget);
177 for (i = 2; i <
length; i++)
192 static void av7110_set22k(
struct budget_patch *budget,
int state)
196 dprintk(2,
"budget: %p\n", budget);
197 budget_av7110_send_fw_cmd(budget, buf, 2);
200 static int av7110_send_diseqc_msg(
struct budget_patch *budget,
int len,
u8 *msg,
int burst)
204 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
206 dprintk(2,
"budget: %p\n", budget);
215 buf[3]=burst ? 0x01 : 0x00;
219 for (i=0; i<len; i++)
222 budget_av7110_send_fw_cmd(budget, buf, 18);
232 av7110_set22k (budget, 1);
236 av7110_set22k (budget, 0);
250 av7110_send_diseqc_msg (budget, cmd->
msg_len, cmd->
msg, 0);
259 av7110_send_diseqc_msg (budget, 0,
NULL, minicmd);
264 static int alps_bsrv2_tuner_set_params(
struct dvb_frontend *fe)
270 struct i2c_msg msg = { .
addr = 0x61, .flags = 0, .buf = buf, .len =
sizeof(buf) };
271 u32 div = (
p->frequency + 479500) / 125;
273 if (
p->frequency > 2000000)
275 else if (
p->frequency > 1800000)
277 else if (
p->frequency > 1600000)
279 else if (
p->frequency > 1200000)
281 else if (
p->frequency >= 1100000)
285 buf[0] = (div >> 8) & 0x7f;
287 buf[2] = ((div & 0x18000) >> 10) | 0x95;
288 buf[3] = (pwr << 6) | 0x30;
293 if (fe->
ops.i2c_gate_ctrl)
294 fe->
ops.i2c_gate_ctrl(fe, 1);
301 .demod_address = 0x08,
306 static int grundig_29504_451_tuner_set_params(
struct dvb_frontend *fe)
312 struct i2c_msg msg = { .
addr = 0x61, .flags = 0, .buf = data, .len =
sizeof(data) };
314 div =
p->frequency / 125;
315 data[0] = (div >> 8) & 0x7f;
316 data[1] = div & 0xff;
320 if (fe->
ops.i2c_gate_ctrl)
321 fe->
ops.i2c_gate_ctrl(fe, 1);
328 .demod_address = 0x68,
333 switch(budget->dev->pci->subsystem_device) {
339 if (budget->dvb_frontend) {
340 budget->dvb_frontend->ops.tuner_ops.set_params = alps_bsrv2_tuner_set_params;
341 budget->dvb_frontend->ops.diseqc_send_master_cmd = budget_patch_diseqc_send_master_cmd;
342 budget->dvb_frontend->ops.diseqc_send_burst = budget_patch_diseqc_send_burst;
343 budget->dvb_frontend->ops.set_tone = budget_patch_set_tone;
349 if (budget->dvb_frontend) {
350 budget->dvb_frontend->ops.tuner_ops.set_params = alps_bsru6_tuner_set_params;
351 budget->dvb_frontend->tuner_priv = &budget->i2c_adap;
353 budget->dvb_frontend->ops.diseqc_send_master_cmd = budget_diseqc_send_master_cmd;
354 budget->dvb_frontend->ops.diseqc_send_burst = budget_diseqc_send_burst;
355 budget->dvb_frontend->ops.set_tone = budget_set_tone;
361 if (budget->dvb_frontend) {
362 budget->dvb_frontend->ops.tuner_ops.set_params = grundig_29504_451_tuner_set_params;
363 budget->dvb_frontend->ops.diseqc_send_master_cmd = budget_diseqc_send_master_cmd;
364 budget->dvb_frontend->ops.diseqc_send_burst = budget_diseqc_send_burst;
365 budget->dvb_frontend->ops.set_tone = budget_set_tone;
371 if (budget->dvb_frontend ==
NULL) {
372 printk(
"dvb-ttpci: A frontend driver was not found for device [%04x:%04x] subsystem [%04x:%04x]\n",
373 budget->dev->pci->vendor,
374 budget->dev->pci->device,
375 budget->dev->pci->subsystem_vendor,
376 budget->dev->pci->subsystem_device);
379 printk(
"budget-av: Frontend registration failed!\n");
381 budget->dvb_frontend =
NULL;
394 #define PATCH_RESET 0
492 printk(
"budget-patch not detected or saa7146 in non-default state.\n"
493 "try enabling ressetting of 7146 with MASK_31 in MC1 register\n");
496 printk(
"BUDGET-PATCH DETECTED.\n");
602 dprintk(2,
"budget: %p\n", budget);
627 budget->dvb_adapter.priv = budget;
628 frontend_init(budget);
635 static int budget_patch_detach (
struct saa7146_dev* dev)
640 if (budget->dvb_frontend) {
651 static int __init budget_patch_init(
void)
656 static void __exit budget_patch_exit(
void)
662 .name =
"budget_patch dvb",
667 .attach = budget_patch_attach,
668 .detach = budget_patch_detach,
678 MODULE_AUTHOR(
"Emard, Roberto Deza, Holger Waechtler, Michael Hunold, others");
680 "based so-called Budget Patch cards");