diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/media/dvb/mantis/mantis_input.c | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'drivers/media/dvb/mantis/mantis_input.c')
-rw-r--r-- | drivers/media/dvb/mantis/mantis_input.c | 76 |
1 files changed, 44 insertions, 32 deletions
diff --git a/drivers/media/dvb/mantis/mantis_input.c b/drivers/media/dvb/mantis/mantis_input.c index a99489b8418b..db6d54d3fec0 100644 --- a/drivers/media/dvb/mantis/mantis_input.c +++ b/drivers/media/dvb/mantis/mantis_input.c | |||
@@ -18,8 +18,7 @@ | |||
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/input.h> | 21 | #include <media/rc-core.h> |
22 | #include <media/ir-core.h> | ||
23 | #include <linux/pci.h> | 22 | #include <linux/pci.h> |
24 | 23 | ||
25 | #include "dmxdev.h" | 24 | #include "dmxdev.h" |
@@ -33,8 +32,9 @@ | |||
33 | #include "mantis_uart.h" | 32 | #include "mantis_uart.h" |
34 | 33 | ||
35 | #define MODULE_NAME "mantis_core" | 34 | #define MODULE_NAME "mantis_core" |
35 | #define RC_MAP_MANTIS "rc-mantis" | ||
36 | 36 | ||
37 | static struct ir_scancode mantis_ir_table[] = { | 37 | static struct rc_map_table mantis_ir_table[] = { |
38 | { 0x29, KEY_POWER }, | 38 | { 0x29, KEY_POWER }, |
39 | { 0x28, KEY_FAVORITES }, | 39 | { 0x28, KEY_FAVORITES }, |
40 | { 0x30, KEY_TEXT }, | 40 | { 0x30, KEY_TEXT }, |
@@ -95,53 +95,65 @@ static struct ir_scancode mantis_ir_table[] = { | |||
95 | { 0x00, KEY_BLUE }, | 95 | { 0x00, KEY_BLUE }, |
96 | }; | 96 | }; |
97 | 97 | ||
98 | struct ir_scancode_table ir_mantis = { | 98 | static struct rc_map_list ir_mantis_map = { |
99 | .scan = mantis_ir_table, | 99 | .map = { |
100 | .size = ARRAY_SIZE(mantis_ir_table), | 100 | .scan = mantis_ir_table, |
101 | .size = ARRAY_SIZE(mantis_ir_table), | ||
102 | .rc_type = RC_TYPE_UNKNOWN, | ||
103 | .name = RC_MAP_MANTIS, | ||
104 | } | ||
101 | }; | 105 | }; |
102 | EXPORT_SYMBOL_GPL(ir_mantis); | ||
103 | 106 | ||
104 | int mantis_input_init(struct mantis_pci *mantis) | 107 | int mantis_input_init(struct mantis_pci *mantis) |
105 | { | 108 | { |
106 | struct input_dev *rc; | 109 | struct rc_dev *dev; |
107 | char name[80], dev[80]; | ||
108 | int err; | 110 | int err; |
109 | 111 | ||
110 | rc = input_allocate_device(); | 112 | err = rc_map_register(&ir_mantis_map); |
111 | if (!rc) { | 113 | if (err) |
112 | dprintk(MANTIS_ERROR, 1, "Input device allocate failed"); | 114 | goto out; |
113 | return -ENOMEM; | ||
114 | } | ||
115 | 115 | ||
116 | sprintf(name, "Mantis %s IR receiver", mantis->hwconfig->model_name); | 116 | dev = rc_allocate_device(); |
117 | sprintf(dev, "pci-%s/ir0", pci_name(mantis->pdev)); | 117 | if (!dev) { |
118 | dprintk(MANTIS_ERROR, 1, "Remote device allocation failed"); | ||
119 | err = -ENOMEM; | ||
120 | goto out_map; | ||
121 | } | ||
118 | 122 | ||
119 | rc->name = name; | 123 | sprintf(mantis->input_name, "Mantis %s IR receiver", mantis->hwconfig->model_name); |
120 | rc->phys = dev; | 124 | sprintf(mantis->input_phys, "pci-%s/ir0", pci_name(mantis->pdev)); |
121 | 125 | ||
122 | rc->id.bustype = BUS_PCI; | 126 | dev->input_name = mantis->input_name; |
123 | rc->id.vendor = mantis->vendor_id; | 127 | dev->input_phys = mantis->input_phys; |
124 | rc->id.product = mantis->device_id; | 128 | dev->input_id.bustype = BUS_PCI; |
125 | rc->id.version = 1; | 129 | dev->input_id.vendor = mantis->vendor_id; |
126 | rc->dev = mantis->pdev->dev; | 130 | dev->input_id.product = mantis->device_id; |
131 | dev->input_id.version = 1; | ||
132 | dev->driver_name = MODULE_NAME; | ||
133 | dev->map_name = RC_MAP_MANTIS; | ||
134 | dev->dev.parent = &mantis->pdev->dev; | ||
127 | 135 | ||
128 | err = __ir_input_register(rc, &ir_mantis, NULL, MODULE_NAME); | 136 | err = rc_register_device(dev); |
129 | if (err) { | 137 | if (err) { |
130 | dprintk(MANTIS_ERROR, 1, "IR device registration failed, ret = %d", err); | 138 | dprintk(MANTIS_ERROR, 1, "IR device registration failed, ret = %d", err); |
131 | input_free_device(rc); | 139 | goto out_dev; |
132 | return -ENODEV; | ||
133 | } | 140 | } |
134 | 141 | ||
135 | mantis->rc = rc; | 142 | mantis->rc = dev; |
136 | |||
137 | return 0; | 143 | return 0; |
144 | |||
145 | out_dev: | ||
146 | rc_free_device(dev); | ||
147 | out_map: | ||
148 | rc_map_unregister(&ir_mantis_map); | ||
149 | out: | ||
150 | return err; | ||
138 | } | 151 | } |
139 | 152 | ||
140 | int mantis_exit(struct mantis_pci *mantis) | 153 | int mantis_exit(struct mantis_pci *mantis) |
141 | { | 154 | { |
142 | struct input_dev *rc = mantis->rc; | 155 | rc_unregister_device(mantis->rc); |
143 | 156 | rc_map_unregister(&ir_mantis_map); | |
144 | ir_input_unregister(rc); | ||
145 | |||
146 | return 0; | 157 | return 0; |
147 | } | 158 | } |
159 | |||