Lines Matching refs:budget_ci
57 #define MODULE_NAME "budget_ci"
108 struct budget_ci {
120 struct budget_ci *budget_ci = (struct budget_ci *) data;
121 struct input_dev *dev = budget_ci->ir.dev;
122 u32 command = ttpci_budget_debiread(&budget_ci->budget, DEBINOSWAP, DEBIADDR_IR, 2, 1, 0) >> 8;
141 printk("budget_ci: received byte 0x%02x\n", command);
148 budget_ci->ir.have_command = true;
149 budget_ci->ir.ir_key = command & 0x3f;
154 if (!budget_ci->ir.have_command)
156 budget_ci->ir.have_command = false;
158 if (budget_ci->ir.rc5_device != IR_DEVICE_ANY &&
159 budget_ci->ir.rc5_device != (command & 0x1f))
162 ir_keydown(dev, budget_ci->ir.ir_key, (command & 0x20) ? 1 : 0);
165 static int msp430_ir_init(struct budget_ci *budget_ci)
167 struct saa7146_dev *saa = budget_ci->budget.dev;
168 struct input_dev *input_dev = budget_ci->ir.dev;
173 budget_ci->ir.dev = input_dev = input_allocate_device();
175 printk(KERN_ERR "budget_ci: IR interface initialisation failed\n");
179 snprintf(budget_ci->ir.name, sizeof(budget_ci->ir.name),
181 snprintf(budget_ci->ir.phys, sizeof(budget_ci->ir.phys),
184 input_dev->name = budget_ci->ir.name;
186 input_dev->phys = budget_ci->ir.phys;
199 budget_ci->ir.rc5_device = IR_DEVICE_ANY;
201 budget_ci->ir.rc5_device = rc5_device;
204 switch (budget_ci->budget.dev->pci->subsystem_device) {
213 budget_ci->ir.rc5_device = 0x1f;
230 printk(KERN_ERR "budget_ci: could not init driver for IR device (code %d)\n", error);
238 tasklet_init(&budget_ci->ir.msp430_irq_tasklet, msp430_ir_interrupt,
239 (unsigned long) budget_ci);
247 static void msp430_ir_deinit(struct budget_ci *budget_ci)
249 struct saa7146_dev *saa = budget_ci->budget.dev;
250 struct input_dev *dev = budget_ci->ir.dev;
254 tasklet_kill(&budget_ci->ir.msp430_irq_tasklet);
261 struct budget_ci *budget_ci = (struct budget_ci *) ca->data;
266 return ttpci_budget_debiread(&budget_ci->budget, DEBICICAM,
272 struct budget_ci *budget_ci = (struct budget_ci *) ca->data;
277 return ttpci_budget_debiwrite(&budget_ci->budget, DEBICICAM,
283 struct budget_ci *budget_ci = (struct budget_ci *) ca->data;
288 return ttpci_budget_debiread(&budget_ci->budget, DEBICICAM,
294 struct budget_ci *budget_ci = (struct budget_ci *) ca->data;
299 return ttpci_budget_debiwrite(&budget_ci->budget, DEBICICAM,
305 struct budget_ci *budget_ci = (struct budget_ci *) ca->data;
306 struct saa7146_dev *saa = budget_ci->budget.dev;
311 if (budget_ci->ci_irq) {
315 budget_ci->slot_status = SLOTSTATUS_RESET;
316 ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, 0, 1, 0);
318 ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1,
328 struct budget_ci *budget_ci = (struct budget_ci *) ca->data;
329 struct saa7146_dev *saa = budget_ci->budget.dev;
341 struct budget_ci *budget_ci = (struct budget_ci *) ca->data;
342 struct saa7146_dev *saa = budget_ci->budget.dev;
350 tmp = ttpci_budget_debiread(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, 1, 0);
351 ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1,
360 struct budget_ci *budget_ci = (struct budget_ci *) data;
361 struct saa7146_dev *saa = budget_ci->budget.dev;
365 if (!budget_ci->budget.ci_present)
369 flags = ttpci_budget_debiread(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, 1, 0);
375 if (budget_ci->slot_status & SLOTSTATUS_NONE) {
377 budget_ci->slot_status = SLOTSTATUS_PRESENT;
378 dvb_ca_en50221_camchange_irq(&budget_ci->ca, 0,
381 } else if (budget_ci->slot_status & SLOTSTATUS_RESET) {
383 budget_ci->slot_status = SLOTSTATUS_READY;
384 dvb_ca_en50221_camready_irq(&budget_ci->ca, 0);
386 } else if (budget_ci->slot_status & SLOTSTATUS_READY) {
388 dvb_ca_en50221_frda_irq(&budget_ci->ca, 0);
398 if (budget_ci->slot_status & SLOTSTATUS_OCCUPIED) {
400 budget_ci->slot_status = SLOTSTATUS_NONE;
401 dvb_ca_en50221_camchange_irq(&budget_ci->ca, 0,
409 struct budget_ci *budget_ci = (struct budget_ci *) ca->data;
413 if (!budget_ci->budget.ci_present)
417 flags = ttpci_budget_debiread(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, 1, 0);
420 if (budget_ci->slot_status & SLOTSTATUS_NONE) {
421 budget_ci->slot_status = SLOTSTATUS_PRESENT;
425 if (budget_ci->slot_status & SLOTSTATUS_RESET) {
427 budget_ci->slot_status = SLOTSTATUS_READY;
431 budget_ci->slot_status = SLOTSTATUS_NONE;
434 if (budget_ci->slot_status != SLOTSTATUS_NONE) {
435 if (budget_ci->slot_status & SLOTSTATUS_READY) {
444 static int ciintf_init(struct budget_ci *budget_ci)
446 struct saa7146_dev *saa = budget_ci->budget.dev;
452 memset(&budget_ci->ca, 0, sizeof(struct dvb_ca_en50221));
458 ci_version = ttpci_budget_debiread(&budget_ci->budget, DEBICICTL, DEBIADDR_CIVERSION, 1, 1, 0);
465 flags = ttpci_budget_debiread(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, 1, 0);
466 budget_ci->slot_status = SLOTSTATUS_NONE;
468 budget_ci->slot_status = SLOTSTATUS_PRESENT;
473 budget_ci->ci_irq = 0;
478 budget_ci->ci_irq = 1;
482 budget_ci->ca.owner = THIS_MODULE;
483 budget_ci->ca.read_attribute_mem = ciintf_read_attribute_mem;
484 budget_ci->ca.write_attribute_mem = ciintf_write_attribute_mem;
485 budget_ci->ca.read_cam_control = ciintf_read_cam_control;
486 budget_ci->ca.write_cam_control = ciintf_write_cam_control;
487 budget_ci->ca.slot_reset = ciintf_slot_reset;
488 budget_ci->ca.slot_shutdown = ciintf_slot_shutdown;
489 budget_ci->ca.slot_ts_enable = ciintf_slot_ts_enable;
490 budget_ci->ca.poll_slot_status = ciintf_poll_slot_status;
491 budget_ci->ca.data = budget_ci;
492 if ((result = dvb_ca_en50221_init(&budget_ci->budget.dvb_adapter,
493 &budget_ci->ca,
495 printk("budget_ci: CI interface detected, but initialisation failed.\n");
500 if (budget_ci->ci_irq) {
501 tasklet_init(&budget_ci->ciintf_irq_tasklet, ciintf_interrupt, (unsigned long) budget_ci);
502 if (budget_ci->slot_status != SLOTSTATUS_NONE) {
511 ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1,
515 printk("budget_ci: CI interface initialised\n");
516 budget_ci->budget.ci_present = 1;
519 if (budget_ci->ci_irq) {
521 if (budget_ci->slot_status != SLOTSTATUS_NONE)
523 dvb_ca_en50221_camchange_irq(&budget_ci->ca, 0, flags);
533 static void ciintf_deinit(struct budget_ci *budget_ci)
535 struct saa7146_dev *saa = budget_ci->budget.dev;
538 if (budget_ci->ci_irq) {
541 tasklet_kill(&budget_ci->ciintf_irq_tasklet);
545 ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, 0, 1, 0);
547 ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1,
554 dvb_ca_en50221_release(&budget_ci->ca);
562 struct budget_ci *budget_ci = (struct budget_ci *) dev->ext_priv;
564 dprintk(8, "dev: %p, budget_ci: %p\n", dev, budget_ci);
567 tasklet_schedule(&budget_ci->ir.msp430_irq_tasklet);
572 if ((*isr & MASK_03) && (budget_ci->budget.ci_present) && (budget_ci->ci_irq))
573 tasklet_schedule(&budget_ci->ciintf_irq_tasklet);
657 struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv;
685 if (i2c_transfer(&budget_ci->budget.i2c_adap, &msg, 1) != 1)
707 struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv;
710 struct i2c_msg tuner_msg = {.addr = budget_ci->tuner_pll_address,.flags = 0,.buf = td1316_init,.len =
716 if (i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1) != 1)
726 if (i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1) != 1) {
729 i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1);
737 struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv;
739 struct i2c_msg tuner_msg = {.addr = budget_ci->tuner_pll_address,.flags = 0,.buf = tuner_buf,.len = sizeof(tuner_buf) };
813 if (i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1) != 1)
823 struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv;
825 return request_firmware(fw, name, &budget_ci->budget.dev->pci->dev);
852 struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv;
854 struct i2c_msg tuner_msg = {.addr = budget_ci->tuner_pll_address,
910 if (i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1) != 1)
917 if (i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1) != 1)
1305 static void frontend_init(struct budget_ci *budget_ci)
1307 switch (budget_ci->budget.dev->pci->subsystem_device) {
1309 budget_ci->budget.dvb_frontend =
1310 dvb_attach(stv0299_attach, &alps_bsru6_config, &budget_ci->budget.i2c_adap);
1311 if (budget_ci->budget.dvb_frontend) {
1312 budget_ci->budget.dvb_frontend->ops.tuner_ops.set_params = alps_bsru6_tuner_set_params;
1313 budget_ci->budget.dvb_frontend->tuner_priv = &budget_ci->budget.i2c_adap;
1319 budget_ci->budget.dvb_frontend =
1320 dvb_attach(stv0299_attach, &philips_su1278_tt_config, &budget_ci->budget.i2c_adap);
1321 if (budget_ci->budget.dvb_frontend) {
1322 budget_ci->budget.dvb_frontend->ops.tuner_ops.set_params = philips_su1278_tt_tuner_set_params;
1328 budget_ci->tuner_pll_address = 0x61;
1329 budget_ci->budget.dvb_frontend =
1330 dvb_attach(stv0297_attach, &dvbc_philips_tdm1316l_config, &budget_ci->budget.i2c_adap);
1331 if (budget_ci->budget.dvb_frontend) {
1332 budget_ci->budget.dvb_frontend->ops.tuner_ops.set_params = dvbc_philips_tdm1316l_tuner_set_params;
1338 budget_ci->tuner_pll_address = 0x63;
1339 budget_ci->budget.dvb_frontend =
1340 dvb_attach(tda10045_attach, &philips_tdm1316l_config, &budget_ci->budget.i2c_adap);
1341 if (budget_ci->budget.dvb_frontend) {
1342 budget_ci->budget.dvb_frontend->ops.tuner_ops.init = philips_tdm1316l_tuner_init;
1343 budget_ci->budget.dvb_frontend->ops.tuner_ops.set_params = philips_tdm1316l_tuner_set_params;
1349 budget_ci->tuner_pll_address = 0x60;
1350 budget_ci->budget.dvb_frontend =
1351 dvb_attach(tda10046_attach, &philips_tdm1316l_config_invert, &budget_ci->budget.i2c_adap);
1352 if (budget_ci->budget.dvb_frontend) {
1353 budget_ci->budget.dvb_frontend->ops.tuner_ops.init = philips_tdm1316l_tuner_init;
1354 budget_ci->budget.dvb_frontend->ops.tuner_ops.set_params = philips_tdm1316l_tuner_set_params;
1360 budget_ci->budget.dvb_frontend = dvb_attach(stv0299_attach, &alps_bsbe1_config, &budget_ci->budget.i2c_adap);
1361 if (budget_ci->budget.dvb_frontend) {
1362 budget_ci->budget.dvb_frontend->ops.tuner_ops.set_params = alps_bsbe1_tuner_set_params;
1363 budget_ci->budget.dvb_frontend->tuner_priv = &budget_ci->budget.i2c_adap;
1365 budget_ci->budget.dvb_frontend->ops.dishnetwork_send_legacy_command = NULL;
1366 if (dvb_attach(lnbp21_attach, budget_ci->budget.dvb_frontend, &budget_ci->budget.i2c_adap, LNBP21_LLC, 0) == NULL) {
1368 dvb_frontend_detach(budget_ci->budget.dvb_frontend);
1369 budget_ci->budget.dvb_frontend = NULL;
1375 budget_ci->budget.dvb_frontend = dvb_attach(tda10023_attach, &tda10023_config, &budget_ci->budget.i2c_adap, 0x48);
1376 if (budget_ci->budget.dvb_frontend) {
1377 if (dvb_attach(tda827x_attach, budget_ci->budget.dvb_frontend, 0x61, &budget_ci->budget.i2c_adap, &tda827x_config) == NULL) {
1379 dvb_frontend_detach(budget_ci->budget.dvb_frontend);
1380 budget_ci->budget.dvb_frontend = NULL;
1398 saa7146_setgpio(budget_ci->budget.dev, 2, SAA7146_GPIO_OUTLO);
1402 saa7146_setgpio(budget_ci->budget.dev, 2, SAA7146_GPIO_OUTHI);
1409 budget_ci->budget.dvb_frontend = dvb_attach(stb0899_attach, &tt3200_config, &budget_ci->budget.i2c_adap);
1410 if (budget_ci->budget.dvb_frontend) {
1411 if (dvb_attach(stb6100_attach, budget_ci->budget.dvb_frontend, &tt3200_stb6100_config, &budget_ci->budget.i2c_adap)) {
1412 if (!dvb_attach(lnbp21_attach, budget_ci->budget.dvb_frontend, &budget_ci->budget.i2c_adap, 0, 0)) {
1414 dvb_frontend_detach(budget_ci->budget.dvb_frontend);
1415 budget_ci->budget.dvb_frontend = NULL;
1418 dvb_frontend_detach(budget_ci->budget.dvb_frontend);
1419 budget_ci->budget.dvb_frontend = NULL;
1426 if (budget_ci->budget.dvb_frontend == NULL) {
1428 budget_ci->budget.dev->pci->vendor,
1429 budget_ci->budget.dev->pci->device,
1430 budget_ci->budget.dev->pci->subsystem_vendor,
1431 budget_ci->budget.dev->pci->subsystem_device);
1434 (&budget_ci->budget.dvb_adapter, budget_ci->budget.dvb_frontend)) {
1436 dvb_frontend_detach(budget_ci->budget.dvb_frontend);
1437 budget_ci->budget.dvb_frontend = NULL;
1444 struct budget_ci *budget_ci;
1447 budget_ci = kzalloc(sizeof(struct budget_ci), GFP_KERNEL);
1448 if (!budget_ci) {
1453 dprintk(2, "budget_ci: %p\n", budget_ci);
1455 dev->ext_priv = budget_ci;
1457 err = ttpci_budget_init(&budget_ci->budget, dev, info, THIS_MODULE,
1462 err = msp430_ir_init(budget_ci);
1466 ciintf_init(budget_ci);
1468 budget_ci->budget.dvb_adapter.priv = budget_ci;
1469 frontend_init(budget_ci);
1471 ttpci_budget_init_hooks(&budget_ci->budget);
1476 ttpci_budget_deinit(&budget_ci->budget);
1478 kfree(budget_ci);
1485 struct budget_ci *budget_ci = (struct budget_ci *) dev->ext_priv;
1486 struct saa7146_dev *saa = budget_ci->budget.dev;
1489 if (budget_ci->budget.ci_present)
1490 ciintf_deinit(budget_ci);
1491 msp430_ir_deinit(budget_ci);
1492 if (budget_ci->budget.dvb_frontend) {
1493 dvb_unregister_frontend(budget_ci->budget.dvb_frontend);
1494 dvb_frontend_detach(budget_ci->budget.dvb_frontend);
1496 err = ttpci_budget_deinit(&budget_ci->budget);
1501 kfree(budget_ci);
1533 .name = "budget_ci dvb",