diff options
Diffstat (limited to 'drivers/media/dvb/ttpci/budget-ci.c')
-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 @@ | |||
33 | #include <linux/errno.h> | 33 | #include <linux/errno.h> |
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | #include <linux/interrupt.h> | 35 | #include <linux/interrupt.h> |
36 | #include <linux/input.h> | ||
37 | #include <linux/spinlock.h> | 36 | #include <linux/spinlock.h> |
38 | #include <media/ir-core.h> | 37 | #include <media/ir-core.h> |
39 | 38 | ||
@@ -96,7 +95,7 @@ MODULE_PARM_DESC(ir_debug, "enable debugging information for IR decoding"); | |||
96 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | 95 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
97 | 96 | ||
98 | struct budget_ci_ir { | 97 | struct budget_ci_ir { |
99 | struct input_dev *dev; | 98 | struct rc_dev *dev; |
100 | struct tasklet_struct msp430_irq_tasklet; | 99 | struct tasklet_struct msp430_irq_tasklet; |
101 | char name[72]; /* 40 + 32 for (struct saa7146_dev).name */ | 100 | char name[72]; /* 40 + 32 for (struct saa7146_dev).name */ |
102 | char phys[32]; | 101 | char phys[32]; |
@@ -118,7 +117,7 @@ struct budget_ci { | |||
118 | static void msp430_ir_interrupt(unsigned long data) | 117 | static void msp430_ir_interrupt(unsigned long data) |
119 | { | 118 | { |
120 | struct budget_ci *budget_ci = (struct budget_ci *) data; | 119 | struct budget_ci *budget_ci = (struct budget_ci *) data; |
121 | struct input_dev *dev = budget_ci->ir.dev; | 120 | struct rc_dev *dev = budget_ci->ir.dev; |
122 | u32 command = ttpci_budget_debiread(&budget_ci->budget, DEBINOSWAP, DEBIADDR_IR, 2, 1, 0) >> 8; | 121 | u32 command = ttpci_budget_debiread(&budget_ci->budget, DEBINOSWAP, DEBIADDR_IR, 2, 1, 0) >> 8; |
123 | 122 | ||
124 | /* | 123 | /* |
@@ -166,13 +165,11 @@ static void msp430_ir_interrupt(unsigned long data) | |||
166 | static int msp430_ir_init(struct budget_ci *budget_ci) | 165 | static int msp430_ir_init(struct budget_ci *budget_ci) |
167 | { | 166 | { |
168 | struct saa7146_dev *saa = budget_ci->budget.dev; | 167 | struct saa7146_dev *saa = budget_ci->budget.dev; |
169 | struct input_dev *input_dev = budget_ci->ir.dev; | 168 | struct rc_dev *dev; |
170 | int error; | 169 | int error; |
171 | char *ir_codes = NULL; | ||
172 | 170 | ||
173 | 171 | dev = rc_allocate_device(); | |
174 | budget_ci->ir.dev = input_dev = input_allocate_device(); | 172 | if (!dev) { |
175 | if (!input_dev) { | ||
176 | printk(KERN_ERR "budget_ci: IR interface initialisation failed\n"); | 173 | printk(KERN_ERR "budget_ci: IR interface initialisation failed\n"); |
177 | return -ENOMEM; | 174 | return -ENOMEM; |
178 | } | 175 | } |
@@ -182,19 +179,19 @@ static int msp430_ir_init(struct budget_ci *budget_ci) | |||
182 | snprintf(budget_ci->ir.phys, sizeof(budget_ci->ir.phys), | 179 | snprintf(budget_ci->ir.phys, sizeof(budget_ci->ir.phys), |
183 | "pci-%s/ir0", pci_name(saa->pci)); | 180 | "pci-%s/ir0", pci_name(saa->pci)); |
184 | 181 | ||
185 | input_dev->name = budget_ci->ir.name; | 182 | dev->driver_name = MODULE_NAME; |
186 | 183 | dev->input_name = budget_ci->ir.name; | |
187 | input_dev->phys = budget_ci->ir.phys; | 184 | dev->input_phys = budget_ci->ir.phys; |
188 | input_dev->id.bustype = BUS_PCI; | 185 | dev->input_id.bustype = BUS_PCI; |
189 | input_dev->id.version = 1; | 186 | dev->input_id.version = 1; |
190 | if (saa->pci->subsystem_vendor) { | 187 | if (saa->pci->subsystem_vendor) { |
191 | input_dev->id.vendor = saa->pci->subsystem_vendor; | 188 | dev->input_id.vendor = saa->pci->subsystem_vendor; |
192 | input_dev->id.product = saa->pci->subsystem_device; | 189 | dev->input_id.product = saa->pci->subsystem_device; |
193 | } else { | 190 | } else { |
194 | input_dev->id.vendor = saa->pci->vendor; | 191 | dev->input_id.vendor = saa->pci->vendor; |
195 | input_dev->id.product = saa->pci->device; | 192 | dev->input_id.product = saa->pci->device; |
196 | } | 193 | } |
197 | input_dev->dev.parent = &saa->pci->dev; | 194 | dev->dev.parent = &saa->pci->dev; |
198 | 195 | ||
199 | if (rc5_device < 0) | 196 | if (rc5_device < 0) |
200 | budget_ci->ir.rc5_device = IR_DEVICE_ANY; | 197 | budget_ci->ir.rc5_device = IR_DEVICE_ANY; |
@@ -208,7 +205,7 @@ static int msp430_ir_init(struct budget_ci *budget_ci) | |||
208 | case 0x1011: | 205 | case 0x1011: |
209 | case 0x1012: | 206 | case 0x1012: |
210 | /* The hauppauge keymap is a superset of these remotes */ | 207 | /* The hauppauge keymap is a superset of these remotes */ |
211 | ir_codes = RC_MAP_HAUPPAUGE_NEW; | 208 | dev->map_name = RC_MAP_HAUPPAUGE_NEW; |
212 | 209 | ||
213 | if (rc5_device < 0) | 210 | if (rc5_device < 0) |
214 | budget_ci->ir.rc5_device = 0x1f; | 211 | budget_ci->ir.rc5_device = 0x1f; |
@@ -218,23 +215,22 @@ static int msp430_ir_init(struct budget_ci *budget_ci) | |||
218 | case 0x1019: | 215 | case 0x1019: |
219 | case 0x101a: | 216 | case 0x101a: |
220 | /* for the Technotrend 1500 bundled remote */ | 217 | /* for the Technotrend 1500 bundled remote */ |
221 | ir_codes = RC_MAP_TT_1500; | 218 | dev->map_name = RC_MAP_TT_1500; |
222 | break; | 219 | break; |
223 | default: | 220 | default: |
224 | /* unknown remote */ | 221 | /* unknown remote */ |
225 | ir_codes = RC_MAP_BUDGET_CI_OLD; | 222 | dev->map_name = RC_MAP_BUDGET_CI_OLD; |
226 | break; | 223 | break; |
227 | } | 224 | } |
228 | 225 | ||
229 | error = ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME); | 226 | error = rc_register_device(dev); |
230 | if (error) { | 227 | if (error) { |
231 | printk(KERN_ERR "budget_ci: could not init driver for IR device (code %d)\n", error); | 228 | printk(KERN_ERR "budget_ci: could not init driver for IR device (code %d)\n", error); |
229 | rc_free_device(dev); | ||
232 | return error; | 230 | return error; |
233 | } | 231 | } |
234 | 232 | ||
235 | /* note: these must be after input_register_device */ | 233 | budget_ci->ir.dev = dev; |
236 | input_dev->rep[REP_DELAY] = 400; | ||
237 | input_dev->rep[REP_PERIOD] = 250; | ||
238 | 234 | ||
239 | tasklet_init(&budget_ci->ir.msp430_irq_tasklet, msp430_ir_interrupt, | 235 | tasklet_init(&budget_ci->ir.msp430_irq_tasklet, msp430_ir_interrupt, |
240 | (unsigned long) budget_ci); | 236 | (unsigned long) budget_ci); |
@@ -248,13 +244,12 @@ static int msp430_ir_init(struct budget_ci *budget_ci) | |||
248 | static void msp430_ir_deinit(struct budget_ci *budget_ci) | 244 | static void msp430_ir_deinit(struct budget_ci *budget_ci) |
249 | { | 245 | { |
250 | struct saa7146_dev *saa = budget_ci->budget.dev; | 246 | struct saa7146_dev *saa = budget_ci->budget.dev; |
251 | struct input_dev *dev = budget_ci->ir.dev; | ||
252 | 247 | ||
253 | SAA7146_IER_DISABLE(saa, MASK_06); | 248 | SAA7146_IER_DISABLE(saa, MASK_06); |
254 | saa7146_setgpio(saa, 3, SAA7146_GPIO_INPUT); | 249 | saa7146_setgpio(saa, 3, SAA7146_GPIO_INPUT); |
255 | tasklet_kill(&budget_ci->ir.msp430_irq_tasklet); | 250 | tasklet_kill(&budget_ci->ir.msp430_irq_tasklet); |
256 | 251 | ||
257 | ir_input_unregister(dev); | 252 | rc_unregister_device(budget_ci->ir.dev); |
258 | } | 253 | } |
259 | 254 | ||
260 | static int ciintf_read_attribute_mem(struct dvb_ca_en50221 *ca, int slot, int address) | 255 | static int ciintf_read_attribute_mem(struct dvb_ca_en50221 *ca, int slot, int address) |