Lines Matching refs:budget_ci

92 struct budget_ci {  struct
105 struct budget_ci *budget_ci = container_of(ir, typeof(*budget_ci), ir); in msp430_ir_interrupt() argument
106 struct rc_dev *dev = budget_ci->ir.dev; in msp430_ir_interrupt()
107 u32 command = ttpci_budget_debiread(&budget_ci->budget, DEBINOSWAP, DEBIADDR_IR, 2, 1, 0) >> 8; in msp430_ir_interrupt()
133 budget_ci->ir.have_command = true; in msp430_ir_interrupt()
134 budget_ci->ir.ir_key = command & 0x3f; in msp430_ir_interrupt()
139 if (!budget_ci->ir.have_command) in msp430_ir_interrupt()
141 budget_ci->ir.have_command = false; in msp430_ir_interrupt()
143 if (budget_ci->ir.rc5_device != IR_DEVICE_ANY && in msp430_ir_interrupt()
144 budget_ci->ir.rc5_device != (command & 0x1f)) in msp430_ir_interrupt()
147 if (budget_ci->ir.full_rc5) { in msp430_ir_interrupt()
149 RC_SCANCODE_RC5(budget_ci->ir.rc5_device, budget_ci->ir.ir_key), in msp430_ir_interrupt()
155 rc_keydown(dev, RC_PROTO_UNKNOWN, budget_ci->ir.ir_key, in msp430_ir_interrupt()
159 static int msp430_ir_init(struct budget_ci *budget_ci) in msp430_ir_init() argument
161 struct saa7146_dev *saa = budget_ci->budget.dev; in msp430_ir_init()
171 snprintf(budget_ci->ir.name, sizeof(budget_ci->ir.name), in msp430_ir_init()
173 snprintf(budget_ci->ir.phys, sizeof(budget_ci->ir.phys), in msp430_ir_init()
177 dev->device_name = budget_ci->ir.name; in msp430_ir_init()
178 dev->input_phys = budget_ci->ir.phys; in msp430_ir_init()
191 budget_ci->ir.rc5_device = IR_DEVICE_ANY; in msp430_ir_init()
193 budget_ci->ir.rc5_device = rc5_device; in msp430_ir_init()
196 switch (budget_ci->budget.dev->pci->subsystem_device) { in msp430_ir_init()
203 budget_ci->ir.full_rc5 = true; in msp430_ir_init()
206 budget_ci->ir.rc5_device = 0x1f; in msp430_ir_init()
221 if (!budget_ci->ir.full_rc5) in msp430_ir_init()
231 budget_ci->ir.dev = dev; in msp430_ir_init()
233 tasklet_setup(&budget_ci->ir.msp430_irq_tasklet, msp430_ir_interrupt); in msp430_ir_init()
241 static void msp430_ir_deinit(struct budget_ci *budget_ci) in msp430_ir_deinit() argument
243 struct saa7146_dev *saa = budget_ci->budget.dev; in msp430_ir_deinit()
247 tasklet_kill(&budget_ci->ir.msp430_irq_tasklet); in msp430_ir_deinit()
249 rc_unregister_device(budget_ci->ir.dev); in msp430_ir_deinit()
254 struct budget_ci *budget_ci = ca->data; in ciintf_read_attribute_mem() local
259 return ttpci_budget_debiread(&budget_ci->budget, DEBICICAM, in ciintf_read_attribute_mem()
265 struct budget_ci *budget_ci = ca->data; in ciintf_write_attribute_mem() local
270 return ttpci_budget_debiwrite(&budget_ci->budget, DEBICICAM, in ciintf_write_attribute_mem()
276 struct budget_ci *budget_ci = ca->data; in ciintf_read_cam_control() local
281 return ttpci_budget_debiread(&budget_ci->budget, DEBICICAM, in ciintf_read_cam_control()
287 struct budget_ci *budget_ci = ca->data; in ciintf_write_cam_control() local
292 return ttpci_budget_debiwrite(&budget_ci->budget, DEBICICAM, in ciintf_write_cam_control()
298 struct budget_ci *budget_ci = ca->data; in ciintf_slot_reset() local
299 struct saa7146_dev *saa = budget_ci->budget.dev; in ciintf_slot_reset()
304 if (budget_ci->ci_irq) { in ciintf_slot_reset()
308 budget_ci->slot_status = SLOTSTATUS_RESET; in ciintf_slot_reset()
309 ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, 0, 1, 0); in ciintf_slot_reset()
311 ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, in ciintf_slot_reset()
321 struct budget_ci *budget_ci = ca->data; in ciintf_slot_shutdown() local
322 struct saa7146_dev *saa = budget_ci->budget.dev; in ciintf_slot_shutdown()
334 struct budget_ci *budget_ci = ca->data; in ciintf_slot_ts_enable() local
335 struct saa7146_dev *saa = budget_ci->budget.dev; in ciintf_slot_ts_enable()
343 tmp = ttpci_budget_debiread(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, 1, 0); in ciintf_slot_ts_enable()
344 ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, in ciintf_slot_ts_enable()
353 struct budget_ci *budget_ci = from_tasklet(budget_ci, t, in ciintf_interrupt() local
355 struct saa7146_dev *saa = budget_ci->budget.dev; in ciintf_interrupt()
359 if (!budget_ci->budget.ci_present) in ciintf_interrupt()
363 flags = ttpci_budget_debiread(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, 1, 0); in ciintf_interrupt()
369 if (budget_ci->slot_status & SLOTSTATUS_NONE) { in ciintf_interrupt()
371 budget_ci->slot_status = SLOTSTATUS_PRESENT; in ciintf_interrupt()
372 dvb_ca_en50221_camchange_irq(&budget_ci->ca, 0, in ciintf_interrupt()
375 } else if (budget_ci->slot_status & SLOTSTATUS_RESET) { in ciintf_interrupt()
377 budget_ci->slot_status = SLOTSTATUS_READY; in ciintf_interrupt()
378 dvb_ca_en50221_camready_irq(&budget_ci->ca, 0); in ciintf_interrupt()
380 } else if (budget_ci->slot_status & SLOTSTATUS_READY) { in ciintf_interrupt()
382 dvb_ca_en50221_frda_irq(&budget_ci->ca, 0); in ciintf_interrupt()
392 if (budget_ci->slot_status & SLOTSTATUS_OCCUPIED) { in ciintf_interrupt()
394 budget_ci->slot_status = SLOTSTATUS_NONE; in ciintf_interrupt()
395 dvb_ca_en50221_camchange_irq(&budget_ci->ca, 0, in ciintf_interrupt()
403 struct budget_ci *budget_ci = ca->data; in ciintf_poll_slot_status() local
407 if (!budget_ci->budget.ci_present) in ciintf_poll_slot_status()
411 flags = ttpci_budget_debiread(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, 1, 0); in ciintf_poll_slot_status()
414 if (budget_ci->slot_status & SLOTSTATUS_NONE) { in ciintf_poll_slot_status()
415 budget_ci->slot_status = SLOTSTATUS_PRESENT; in ciintf_poll_slot_status()
419 if (budget_ci->slot_status & SLOTSTATUS_RESET) { in ciintf_poll_slot_status()
421 budget_ci->slot_status = SLOTSTATUS_READY; in ciintf_poll_slot_status()
425 budget_ci->slot_status = SLOTSTATUS_NONE; in ciintf_poll_slot_status()
428 if (budget_ci->slot_status != SLOTSTATUS_NONE) { in ciintf_poll_slot_status()
429 if (budget_ci->slot_status & SLOTSTATUS_READY) { in ciintf_poll_slot_status()
438 static int ciintf_init(struct budget_ci *budget_ci) in ciintf_init() argument
440 struct saa7146_dev *saa = budget_ci->budget.dev; in ciintf_init()
446 memset(&budget_ci->ca, 0, sizeof(struct dvb_ca_en50221)); in ciintf_init()
452 ci_version = ttpci_budget_debiread(&budget_ci->budget, DEBICICTL, DEBIADDR_CIVERSION, 1, 1, 0); in ciintf_init()
459 flags = ttpci_budget_debiread(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, 1, 0); in ciintf_init()
460 budget_ci->slot_status = SLOTSTATUS_NONE; in ciintf_init()
462 budget_ci->slot_status = SLOTSTATUS_PRESENT; in ciintf_init()
467 budget_ci->ci_irq = 0; in ciintf_init()
472 budget_ci->ci_irq = 1; in ciintf_init()
476 budget_ci->ca.owner = THIS_MODULE; in ciintf_init()
477 budget_ci->ca.read_attribute_mem = ciintf_read_attribute_mem; in ciintf_init()
478 budget_ci->ca.write_attribute_mem = ciintf_write_attribute_mem; in ciintf_init()
479 budget_ci->ca.read_cam_control = ciintf_read_cam_control; in ciintf_init()
480 budget_ci->ca.write_cam_control = ciintf_write_cam_control; in ciintf_init()
481 budget_ci->ca.slot_reset = ciintf_slot_reset; in ciintf_init()
482 budget_ci->ca.slot_shutdown = ciintf_slot_shutdown; in ciintf_init()
483 budget_ci->ca.slot_ts_enable = ciintf_slot_ts_enable; in ciintf_init()
484 budget_ci->ca.poll_slot_status = ciintf_poll_slot_status; in ciintf_init()
485 budget_ci->ca.data = budget_ci; in ciintf_init()
486 if ((result = dvb_ca_en50221_init(&budget_ci->budget.dvb_adapter, in ciintf_init()
487 &budget_ci->ca, in ciintf_init()
494 if (budget_ci->ci_irq) { in ciintf_init()
495 tasklet_setup(&budget_ci->ciintf_irq_tasklet, ciintf_interrupt); in ciintf_init()
496 if (budget_ci->slot_status != SLOTSTATUS_NONE) { in ciintf_init()
505 ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, in ciintf_init()
510 budget_ci->budget.ci_present = 1; in ciintf_init()
513 if (budget_ci->ci_irq) { in ciintf_init()
515 if (budget_ci->slot_status != SLOTSTATUS_NONE) in ciintf_init()
517 dvb_ca_en50221_camchange_irq(&budget_ci->ca, 0, flags); in ciintf_init()
527 static void ciintf_deinit(struct budget_ci *budget_ci) in ciintf_deinit() argument
529 struct saa7146_dev *saa = budget_ci->budget.dev; in ciintf_deinit()
532 if (budget_ci->ci_irq) { in ciintf_deinit()
535 tasklet_kill(&budget_ci->ciintf_irq_tasklet); in ciintf_deinit()
539 ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, 0, 1, 0); in ciintf_deinit()
541 ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, in ciintf_deinit()
548 dvb_ca_en50221_release(&budget_ci->ca); in ciintf_deinit()
556 struct budget_ci *budget_ci = dev->ext_priv; in budget_ci_irq() local
558 dprintk(8, "dev: %p, budget_ci: %p\n", dev, budget_ci); in budget_ci_irq()
561 tasklet_schedule(&budget_ci->ir.msp430_irq_tasklet); in budget_ci_irq()
566 if ((*isr & MASK_03) && (budget_ci->budget.ci_present) && (budget_ci->ci_irq)) in budget_ci_irq()
567 tasklet_schedule(&budget_ci->ciintf_irq_tasklet); in budget_ci_irq()
651 struct budget_ci *budget_ci = fe->dvb->priv; in philips_su1278_tt_tuner_set_params() local
679 if (i2c_transfer(&budget_ci->budget.i2c_adap, &msg, 1) != 1) in philips_su1278_tt_tuner_set_params()
701 struct budget_ci *budget_ci = fe->dvb->priv; in philips_tdm1316l_tuner_init() local
704 …struct i2c_msg tuner_msg = {.addr = budget_ci->tuner_pll_address,.flags = 0,.buf = td1316_init,.le… in philips_tdm1316l_tuner_init()
710 if (i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1) != 1) in philips_tdm1316l_tuner_init()
720 if (i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1) != 1) { in philips_tdm1316l_tuner_init()
723 i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1); in philips_tdm1316l_tuner_init()
732 struct budget_ci *budget_ci = fe->dvb->priv; in philips_tdm1316l_tuner_set_params() local
734 …struct i2c_msg tuner_msg = {.addr = budget_ci->tuner_pll_address,.flags = 0,.buf = tuner_buf,.len … in philips_tdm1316l_tuner_set_params()
808 if (i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1) != 1) in philips_tdm1316l_tuner_set_params()
818 struct budget_ci *budget_ci = fe->dvb->priv; in philips_tdm1316l_request_firmware() local
820 return request_firmware(fw, name, &budget_ci->budget.dev->pci->dev); in philips_tdm1316l_request_firmware()
848 struct budget_ci *budget_ci = fe->dvb->priv; in dvbc_philips_tdm1316l_tuner_set_params() local
850 struct i2c_msg tuner_msg = {.addr = budget_ci->tuner_pll_address, in dvbc_philips_tdm1316l_tuner_set_params()
906 if (i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1) != 1) in dvbc_philips_tdm1316l_tuner_set_params()
913 if (i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1) != 1) in dvbc_philips_tdm1316l_tuner_set_params()
1300 static void frontend_init(struct budget_ci *budget_ci) in frontend_init() argument
1302 switch (budget_ci->budget.dev->pci->subsystem_device) { in frontend_init()
1304 budget_ci->budget.dvb_frontend = in frontend_init()
1305 dvb_attach(stv0299_attach, &alps_bsru6_config, &budget_ci->budget.i2c_adap); in frontend_init()
1306 if (budget_ci->budget.dvb_frontend) { in frontend_init()
1307 budget_ci->budget.dvb_frontend->ops.tuner_ops.set_params = alps_bsru6_tuner_set_params; in frontend_init()
1308 budget_ci->budget.dvb_frontend->tuner_priv = &budget_ci->budget.i2c_adap; in frontend_init()
1314 budget_ci->budget.dvb_frontend = in frontend_init()
1315 dvb_attach(stv0299_attach, &philips_su1278_tt_config, &budget_ci->budget.i2c_adap); in frontend_init()
1316 if (budget_ci->budget.dvb_frontend) { in frontend_init()
1317 budget_ci->budget.dvb_frontend->ops.tuner_ops.set_params = philips_su1278_tt_tuner_set_params; in frontend_init()
1323 budget_ci->tuner_pll_address = 0x61; in frontend_init()
1324 budget_ci->budget.dvb_frontend = in frontend_init()
1325 dvb_attach(stv0297_attach, &dvbc_philips_tdm1316l_config, &budget_ci->budget.i2c_adap); in frontend_init()
1326 if (budget_ci->budget.dvb_frontend) { in frontend_init()
1327budget_ci->budget.dvb_frontend->ops.tuner_ops.set_params = dvbc_philips_tdm1316l_tuner_set_params; in frontend_init()
1333 budget_ci->tuner_pll_address = 0x63; in frontend_init()
1334 budget_ci->budget.dvb_frontend = in frontend_init()
1335 dvb_attach(tda10045_attach, &philips_tdm1316l_config, &budget_ci->budget.i2c_adap); in frontend_init()
1336 if (budget_ci->budget.dvb_frontend) { in frontend_init()
1337 budget_ci->budget.dvb_frontend->ops.tuner_ops.init = philips_tdm1316l_tuner_init; in frontend_init()
1338 budget_ci->budget.dvb_frontend->ops.tuner_ops.set_params = philips_tdm1316l_tuner_set_params; in frontend_init()
1344 budget_ci->tuner_pll_address = 0x60; in frontend_init()
1345 budget_ci->budget.dvb_frontend = in frontend_init()
1346 dvb_attach(tda10046_attach, &philips_tdm1316l_config_invert, &budget_ci->budget.i2c_adap); in frontend_init()
1347 if (budget_ci->budget.dvb_frontend) { in frontend_init()
1348 budget_ci->budget.dvb_frontend->ops.tuner_ops.init = philips_tdm1316l_tuner_init; in frontend_init()
1349 budget_ci->budget.dvb_frontend->ops.tuner_ops.set_params = philips_tdm1316l_tuner_set_params; in frontend_init()
1355budget_ci->budget.dvb_frontend = dvb_attach(stv0299_attach, &alps_bsbe1_config, &budget_ci->budget… in frontend_init()
1356 if (budget_ci->budget.dvb_frontend) { in frontend_init()
1357 budget_ci->budget.dvb_frontend->ops.tuner_ops.set_params = alps_bsbe1_tuner_set_params; in frontend_init()
1358 budget_ci->budget.dvb_frontend->tuner_priv = &budget_ci->budget.i2c_adap; in frontend_init()
1360 budget_ci->budget.dvb_frontend->ops.dishnetwork_send_legacy_command = NULL; in frontend_init()
1361 …if (dvb_attach(lnbp21_attach, budget_ci->budget.dvb_frontend, &budget_ci->budget.i2c_adap, LNBP21_… in frontend_init()
1363 dvb_frontend_detach(budget_ci->budget.dvb_frontend); in frontend_init()
1364 budget_ci->budget.dvb_frontend = NULL; in frontend_init()
1370budget_ci->budget.dvb_frontend = dvb_attach(tda10023_attach, &tda10023_config, &budget_ci->budget.… in frontend_init()
1371 if (budget_ci->budget.dvb_frontend) { in frontend_init()
1372 …if (dvb_attach(tda827x_attach, budget_ci->budget.dvb_frontend, 0x61, &budget_ci->budget.i2c_adap, … in frontend_init()
1374 dvb_frontend_detach(budget_ci->budget.dvb_frontend); in frontend_init()
1375 budget_ci->budget.dvb_frontend = NULL; in frontend_init()
1381budget_ci->budget.dvb_frontend = dvb_attach(stv0288_attach, &stv0288_bsbe1_d01a_config, &budget_ci in frontend_init()
1382 if (budget_ci->budget.dvb_frontend) { in frontend_init()
1383 …if (dvb_attach(stb6000_attach, budget_ci->budget.dvb_frontend, 0x63, &budget_ci->budget.i2c_adap))… in frontend_init()
1384 …if (!dvb_attach(lnbp21_attach, budget_ci->budget.dvb_frontend, &budget_ci->budget.i2c_adap, 0, 0))… in frontend_init()
1386 dvb_frontend_detach(budget_ci->budget.dvb_frontend); in frontend_init()
1387 budget_ci->budget.dvb_frontend = NULL; in frontend_init()
1391 dvb_frontend_detach(budget_ci->budget.dvb_frontend); in frontend_init()
1392 budget_ci->budget.dvb_frontend = NULL; in frontend_init()
1410 saa7146_setgpio(budget_ci->budget.dev, 2, SAA7146_GPIO_OUTLO); in frontend_init()
1414 saa7146_setgpio(budget_ci->budget.dev, 2, SAA7146_GPIO_OUTHI); in frontend_init()
1421budget_ci->budget.dvb_frontend = dvb_attach(stb0899_attach, &tt3200_config, &budget_ci->budget.i2c… in frontend_init()
1422 if (budget_ci->budget.dvb_frontend) { in frontend_init()
1423 …if (dvb_attach(stb6100_attach, budget_ci->budget.dvb_frontend, &tt3200_stb6100_config, &budget_ci-… in frontend_init()
1424 …if (!dvb_attach(lnbp21_attach, budget_ci->budget.dvb_frontend, &budget_ci->budget.i2c_adap, 0, 0))… in frontend_init()
1426 dvb_frontend_detach(budget_ci->budget.dvb_frontend); in frontend_init()
1427 budget_ci->budget.dvb_frontend = NULL; in frontend_init()
1430 dvb_frontend_detach(budget_ci->budget.dvb_frontend); in frontend_init()
1431 budget_ci->budget.dvb_frontend = NULL; in frontend_init()
1438 if (budget_ci->budget.dvb_frontend == NULL) { in frontend_init()
1440 budget_ci->budget.dev->pci->vendor, in frontend_init()
1441 budget_ci->budget.dev->pci->device, in frontend_init()
1442 budget_ci->budget.dev->pci->subsystem_vendor, in frontend_init()
1443 budget_ci->budget.dev->pci->subsystem_device); in frontend_init()
1446 (&budget_ci->budget.dvb_adapter, budget_ci->budget.dvb_frontend)) { in frontend_init()
1448 dvb_frontend_detach(budget_ci->budget.dvb_frontend); in frontend_init()
1449 budget_ci->budget.dvb_frontend = NULL; in frontend_init()
1456 struct budget_ci *budget_ci; in budget_ci_attach() local
1459 budget_ci = kzalloc(sizeof(struct budget_ci), GFP_KERNEL); in budget_ci_attach()
1460 if (!budget_ci) { in budget_ci_attach()
1465 dprintk(2, "budget_ci: %p\n", budget_ci); in budget_ci_attach()
1467 dev->ext_priv = budget_ci; in budget_ci_attach()
1469 err = ttpci_budget_init(&budget_ci->budget, dev, info, THIS_MODULE, in budget_ci_attach()
1474 err = msp430_ir_init(budget_ci); in budget_ci_attach()
1478 ciintf_init(budget_ci); in budget_ci_attach()
1480 budget_ci->budget.dvb_adapter.priv = budget_ci; in budget_ci_attach()
1481 frontend_init(budget_ci); in budget_ci_attach()
1483 ttpci_budget_init_hooks(&budget_ci->budget); in budget_ci_attach()
1488 ttpci_budget_deinit(&budget_ci->budget); in budget_ci_attach()
1490 kfree(budget_ci); in budget_ci_attach()
1497 struct budget_ci *budget_ci = dev->ext_priv; in budget_ci_detach() local
1498 struct saa7146_dev *saa = budget_ci->budget.dev; in budget_ci_detach()
1501 if (budget_ci->budget.ci_present) in budget_ci_detach()
1502 ciintf_deinit(budget_ci); in budget_ci_detach()
1503 msp430_ir_deinit(budget_ci); in budget_ci_detach()
1504 if (budget_ci->budget.dvb_frontend) { in budget_ci_detach()
1505 dvb_unregister_frontend(budget_ci->budget.dvb_frontend); in budget_ci_detach()
1506 dvb_frontend_detach(budget_ci->budget.dvb_frontend); in budget_ci_detach()
1508 err = ttpci_budget_deinit(&budget_ci->budget); in budget_ci_detach()
1513 kfree(budget_ci); in budget_ci_detach()