diff options
author | David Härdeman <david@hardeman.nu> | 2010-10-29 16:08:23 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-12-29 08:16:37 -0200 |
commit | d8b4b5822f51e2142b731b42c81e3f03eec475b2 (patch) | |
tree | fce9a9b7ca5031adc95fbd6be118352fb2527da5 /drivers/media/dvb/ttpci | |
parent | 4c7b355df6e7f05304e05f6b7a286e59a5f1cc54 (diff) | |
download | blackbird-op-linux-d8b4b5822f51e2142b731b42c81e3f03eec475b2.tar.gz blackbird-op-linux-d8b4b5822f51e2142b731b42c81e3f03eec475b2.zip |
[media] ir-core: make struct rc_dev the primary interface
This patch merges the ir_input_dev and ir_dev_props structs into a single
struct called rc_dev. The drivers and various functions in rc-core used
by the drivers are also changed to use rc_dev as the primary interface
when dealing with rc-core.
This means that the input_dev is abstracted away from the drivers which
is necessary if we ever want to support multiple input devs per rc device.
The new API is similar to what the input subsystem uses, i.e:
rc_device_alloc()
rc_device_free()
rc_device_register()
rc_device_unregister()
[mchehab@redhat.com: Fix compilation on mceusb and cx231xx, due to merge conflicts]
Signed-off-by: David Härdeman <david@hardeman.nu>
Acked-by: Jarod Wilson <jarod@redhat.com>
Tested-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/ttpci')
-rw-r--r-- | drivers/media/dvb/ttpci/budget-ci.c | 49 |
1 files changed, 22 insertions, 27 deletions
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index a9c2c326df4b..9aca0f37993b 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c @@ -33,7 +33,6 @@ #include <linux/errno.h> #include <linux/slab.h> #include <linux/interrupt.h> -#include <linux/input.h> #include <linux/spinlock.h> #include <media/ir-core.h> @@ -96,7 +95,7 @@ MODULE_PARM_DESC(ir_debug, "enable debugging information for IR decoding"); DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); struct budget_ci_ir { - struct input_dev *dev; + struct rc_dev *dev; struct tasklet_struct msp430_irq_tasklet; char name[72]; /* 40 + 32 for (struct saa7146_dev).name */ char phys[32]; @@ -118,7 +117,7 @@ struct budget_ci { static void msp430_ir_interrupt(unsigned long data) { struct budget_ci *budget_ci = (struct budget_ci *) data; - struct input_dev *dev = budget_ci->ir.dev; + struct rc_dev *dev = budget_ci->ir.dev; u32 command = ttpci_budget_debiread(&budget_ci->budget, DEBINOSWAP, DEBIADDR_IR, 2, 1, 0) >> 8; /* @@ -166,13 +165,11 @@ static void msp430_ir_interrupt(unsigned long data) static int msp430_ir_init(struct budget_ci *budget_ci) { struct saa7146_dev *saa = budget_ci->budget.dev; - struct input_dev *input_dev = budget_ci->ir.dev; + struct rc_dev *dev; int error; - char *ir_codes = NULL; - - budget_ci->ir.dev = input_dev = input_allocate_device(); - if (!input_dev) { + dev = rc_allocate_device(); + if (!dev) { printk(KERN_ERR "budget_ci: IR interface initialisation failed\n"); return -ENOMEM; } @@ -182,19 +179,19 @@ static int msp430_ir_init(struct budget_ci *budget_ci) snprintf(budget_ci->ir.phys, sizeof(budget_ci->ir.phys), "pci-%s/ir0", pci_name(saa->pci)); - input_dev->name = budget_ci->ir.name; - - input_dev->phys = budget_ci->ir.phys; - input_dev->id.bustype = BUS_PCI; - input_dev->id.version = 1; + dev->driver_name = MODULE_NAME; + dev->input_name = budget_ci->ir.name; + dev->input_phys = budget_ci->ir.phys; + dev->input_id.bustype = BUS_PCI; + dev->input_id.version = 1; if (saa->pci->subsystem_vendor) { - input_dev->id.vendor = saa->pci->subsystem_vendor; - input_dev->id.product = saa->pci->subsystem_device; + dev->input_id.vendor = saa->pci->subsystem_vendor; + dev->input_id.product = saa->pci->subsystem_device; } else { - input_dev->id.vendor = saa->pci->vendor; - input_dev->id.product = saa->pci->device; + dev->input_id.vendor = saa->pci->vendor; + dev->input_id.product = saa->pci->device; } - input_dev->dev.parent = &saa->pci->dev; + dev->dev.parent = &saa->pci->dev; if (rc5_device < 0) budget_ci->ir.rc5_device = IR_DEVICE_ANY; @@ -208,7 +205,7 @@ static int msp430_ir_init(struct budget_ci *budget_ci) case 0x1011: case 0x1012: /* The hauppauge keymap is a superset of these remotes */ - ir_codes = RC_MAP_HAUPPAUGE_NEW; + dev->map_name = RC_MAP_HAUPPAUGE_NEW; if (rc5_device < 0) budget_ci->ir.rc5_device = 0x1f; @@ -218,23 +215,22 @@ static int msp430_ir_init(struct budget_ci *budget_ci) case 0x1019: case 0x101a: /* for the Technotrend 1500 bundled remote */ - ir_codes = RC_MAP_TT_1500; + dev->map_name = RC_MAP_TT_1500; break; default: /* unknown remote */ - ir_codes = RC_MAP_BUDGET_CI_OLD; + dev->map_name = RC_MAP_BUDGET_CI_OLD; break; } - error = ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME); + error = rc_register_device(dev); if (error) { printk(KERN_ERR "budget_ci: could not init driver for IR device (code %d)\n", error); + rc_free_device(dev); return error; } - /* note: these must be after input_register_device */ - input_dev->rep[REP_DELAY] = 400; - input_dev->rep[REP_PERIOD] = 250; + budget_ci->ir.dev = dev; tasklet_init(&budget_ci->ir.msp430_irq_tasklet, msp430_ir_interrupt, (unsigned long) budget_ci); @@ -248,13 +244,12 @@ static int msp430_ir_init(struct budget_ci *budget_ci) static void msp430_ir_deinit(struct budget_ci *budget_ci) { struct saa7146_dev *saa = budget_ci->budget.dev; - struct input_dev *dev = budget_ci->ir.dev; SAA7146_IER_DISABLE(saa, MASK_06); saa7146_setgpio(saa, 3, SAA7146_GPIO_INPUT); tasklet_kill(&budget_ci->ir.msp430_irq_tasklet); - ir_input_unregister(dev); + rc_unregister_device(budget_ci->ir.dev); } static int ciintf_read_attribute_mem(struct dvb_ca_en50221 *ca, int slot, int address) |