aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2009-12-13 22:16:55 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-02-26 13:10:23 -0500
commite93854da880d6dc357c00625d8371b6a926fd19b (patch)
tree8bf87df8cf639fe7af7e35fb5cbc42792742a31b /drivers
parent4714eda87748f226833c32400ab60dd6a3b80766 (diff)
V4L/DVB (13634): ir-core: allow passing IR device parameters to ir-core
Adds an structure to ir_input_register to contain IR device characteristics, like supported protocols and a callback to handle protocol event changes. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/IR/ir-functions.c2
-rw-r--r--drivers/media/IR/ir-keytable.c9
-rw-r--r--drivers/media/dvb/dm1105/dm1105.c4
-rw-r--r--drivers/media/dvb/mantis/mantis_input.c2
-rw-r--r--drivers/media/dvb/ttpci/budget-ci.c2
-rw-r--r--drivers/media/video/bt8xx/bttv-input.c4
-rw-r--r--drivers/media/video/cx231xx/cx231xx-input.c2
-rw-r--r--drivers/media/video/cx23885/cx23885-input.c2
-rw-r--r--drivers/media/video/cx88/cx88-input.c4
-rw-r--r--drivers/media/video/em28xx/em28xx-input.c2
-rw-r--r--drivers/media/video/ir-kbd-i2c.c4
-rw-r--r--drivers/media/video/saa7134/saa7134-input.c4
12 files changed, 23 insertions, 18 deletions
diff --git a/drivers/media/IR/ir-functions.c b/drivers/media/IR/ir-functions.c
index 776a136616d6..b501ac9d401d 100644
--- a/drivers/media/IR/ir-functions.c
+++ b/drivers/media/IR/ir-functions.c
@@ -52,7 +52,7 @@ static void ir_input_key_event(struct input_dev *dev, struct ir_input_state *ir)
52/* -------------------------------------------------------------------------- */ 52/* -------------------------------------------------------------------------- */
53 53
54int ir_input_init(struct input_dev *dev, struct ir_input_state *ir, 54int ir_input_init(struct input_dev *dev, struct ir_input_state *ir,
55 int ir_type) 55 const enum ir_type ir_type)
56{ 56{
57 ir->ir_type = ir_type; 57 ir->ir_type = ir_type;
58 58
diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c
index 8097561ec66f..b2d498c3183a 100644
--- a/drivers/media/IR/ir-keytable.c
+++ b/drivers/media/IR/ir-keytable.c
@@ -89,6 +89,8 @@ EXPORT_SYMBOL_GPL(ir_roundup_tablesize);
89 * @origin: origin table 89 * @origin: origin table
90 * 90 *
91 * Copies all entries where the keycode is not KEY_UNKNOWN/KEY_RESERVED 91 * Copies all entries where the keycode is not KEY_UNKNOWN/KEY_RESERVED
92 * Also copies table size and table protocol.
93 * NOTE: It shouldn't copy the lock field
92 */ 94 */
93 95
94int ir_copy_table(struct ir_scancode_table *destin, 96int ir_copy_table(struct ir_scancode_table *destin,
@@ -105,6 +107,7 @@ int ir_copy_table(struct ir_scancode_table *destin,
105 j++; 107 j++;
106 } 108 }
107 destin->size = j; 109 destin->size = j;
110 destin->ir_type = origin->ir_type;
108 111
109 IR_dprintk(1, "Copied %d scancodes to the new keycode table\n", destin->size); 112 IR_dprintk(1, "Copied %d scancodes to the new keycode table\n", destin->size);
110 113
@@ -404,7 +407,8 @@ EXPORT_SYMBOL_GPL(ir_g_keycode_from_table);
404 * It should be called before registering the IR device. 407 * It should be called before registering the IR device.
405 */ 408 */
406int ir_input_register(struct input_dev *input_dev, 409int ir_input_register(struct input_dev *input_dev,
407 struct ir_scancode_table *rc_tab) 410 const struct ir_scancode_table *rc_tab,
411 const struct ir_dev_props *props)
408{ 412{
409 struct ir_input_dev *ir_dev; 413 struct ir_input_dev *ir_dev;
410 struct ir_scancode *keymap = rc_tab->scan; 414 struct ir_scancode *keymap = rc_tab->scan;
@@ -417,7 +421,7 @@ int ir_input_register(struct input_dev *input_dev,
417 if (!ir_dev) 421 if (!ir_dev)
418 return -ENOMEM; 422 return -ENOMEM;
419 423
420 spin_lock_init(&rc_tab->lock); 424 spin_lock_init(&ir_dev->rc_tab.lock);
421 425
422 ir_dev->rc_tab.size = ir_roundup_tablesize(rc_tab->size); 426 ir_dev->rc_tab.size = ir_roundup_tablesize(rc_tab->size);
423 ir_dev->rc_tab.scan = kzalloc(ir_dev->rc_tab.size * 427 ir_dev->rc_tab.scan = kzalloc(ir_dev->rc_tab.size *
@@ -430,6 +434,7 @@ int ir_input_register(struct input_dev *input_dev,
430 ir_dev->rc_tab.size * sizeof(ir_dev->rc_tab.scan)); 434 ir_dev->rc_tab.size * sizeof(ir_dev->rc_tab.scan));
431 435
432 ir_copy_table(&ir_dev->rc_tab, rc_tab); 436 ir_copy_table(&ir_dev->rc_tab, rc_tab);
437 ir_dev->props = props;
433 438
434 /* set the bits for the keys */ 439 /* set the bits for the keys */
435 IR_dprintk(1, "key map size: %d\n", rc_tab->size); 440 IR_dprintk(1, "key map size: %d\n", rc_tab->size);
diff --git a/drivers/media/dvb/dm1105/dm1105.c b/drivers/media/dvb/dm1105/dm1105.c
index f0f483ac8b89..414d3b2444a2 100644
--- a/drivers/media/dvb/dm1105/dm1105.c
+++ b/drivers/media/dvb/dm1105/dm1105.c
@@ -578,7 +578,7 @@ int __devinit dm1105_ir_init(struct dm1105dvb *dm1105)
578{ 578{
579 struct input_dev *input_dev; 579 struct input_dev *input_dev;
580 struct ir_scancode_table *ir_codes = &ir_codes_dm1105_nec_table; 580 struct ir_scancode_table *ir_codes = &ir_codes_dm1105_nec_table;
581 int ir_type = IR_TYPE_OTHER; 581 enum ir_type ir_type = IR_TYPE_OTHER;
582 int err = -ENOMEM; 582 int err = -ENOMEM;
583 583
584 input_dev = input_allocate_device(); 584 input_dev = input_allocate_device();
@@ -611,7 +611,7 @@ int __devinit dm1105_ir_init(struct dm1105dvb *dm1105)
611 611
612 INIT_WORK(&dm1105->ir.work, dm1105_emit_key); 612 INIT_WORK(&dm1105->ir.work, dm1105_emit_key);
613 613
614 err = ir_input_register(input_dev, ir_codes); 614 err = ir_input_register(input_dev, ir_codes, NULL);
615 615
616 return err; 616 return err;
617} 617}
diff --git a/drivers/media/dvb/mantis/mantis_input.c b/drivers/media/dvb/mantis/mantis_input.c
index 6a9df779441f..4675a3b53c7d 100644
--- a/drivers/media/dvb/mantis/mantis_input.c
+++ b/drivers/media/dvb/mantis/mantis_input.c
@@ -126,7 +126,7 @@ int mantis_input_init(struct mantis_pci *mantis)
126 rc->id.version = 1; 126 rc->id.version = 1;
127 rc->dev = mantis->pdev->dev; 127 rc->dev = mantis->pdev->dev;
128 128
129 err = ir_input_register(rc, &ir_mantis); 129 err = ir_input_register(rc, &ir_mantis, NULL);
130 if (err) { 130 if (err) {
131 dprintk(MANTIS_ERROR, 1, "IR device registration failed, ret = %d", err); 131 dprintk(MANTIS_ERROR, 1, "IR device registration failed, ret = %d", err);
132 input_free_device(rc); 132 input_free_device(rc);
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c
index 9782e0593733..49c2a817a06f 100644
--- a/drivers/media/dvb/ttpci/budget-ci.c
+++ b/drivers/media/dvb/ttpci/budget-ci.c
@@ -254,7 +254,7 @@ static int msp430_ir_init(struct budget_ci *budget_ci)
254 budget_ci->ir.timer_keyup.function = msp430_ir_keyup; 254 budget_ci->ir.timer_keyup.function = msp430_ir_keyup;
255 budget_ci->ir.timer_keyup.data = (unsigned long) &budget_ci->ir; 255 budget_ci->ir.timer_keyup.data = (unsigned long) &budget_ci->ir;
256 budget_ci->ir.last_raw = 0xffff; /* An impossible value */ 256 budget_ci->ir.last_raw = 0xffff; /* An impossible value */
257 error = ir_input_register(input_dev, ir_codes); 257 error = ir_input_register(input_dev, ir_codes, NULL);
258 if (error) { 258 if (error) {
259 printk(KERN_ERR "budget_ci: could not init driver for IR device (code %d)\n", error); 259 printk(KERN_ERR "budget_ci: could not init driver for IR device (code %d)\n", error);
260 return error; 260 return error;
diff --git a/drivers/media/video/bt8xx/bttv-input.c b/drivers/media/video/bt8xx/bttv-input.c
index 277a092e1214..f8053fd88346 100644
--- a/drivers/media/video/bt8xx/bttv-input.c
+++ b/drivers/media/video/bt8xx/bttv-input.c
@@ -247,7 +247,7 @@ int bttv_input_init(struct bttv *btv)
247 struct card_ir *ir; 247 struct card_ir *ir;
248 struct ir_scancode_table *ir_codes = NULL; 248 struct ir_scancode_table *ir_codes = NULL;
249 struct input_dev *input_dev; 249 struct input_dev *input_dev;
250 int ir_type = IR_TYPE_OTHER; 250 enum ir_type ir_type = IR_TYPE_OTHER;
251 int err = -ENOMEM; 251 int err = -ENOMEM;
252 252
253 if (!btv->has_remote) 253 if (!btv->has_remote)
@@ -389,7 +389,7 @@ int bttv_input_init(struct bttv *btv)
389 bttv_ir_start(btv, ir); 389 bttv_ir_start(btv, ir);
390 390
391 /* all done */ 391 /* all done */
392 err = ir_input_register(btv->remote->dev, ir_codes); 392 err = ir_input_register(btv->remote->dev, ir_codes, NULL);
393 if (err) 393 if (err)
394 goto err_out_stop; 394 goto err_out_stop;
395 395
diff --git a/drivers/media/video/cx231xx/cx231xx-input.c b/drivers/media/video/cx231xx/cx231xx-input.c
index 15826f98b688..c5771db3bfce 100644
--- a/drivers/media/video/cx231xx/cx231xx-input.c
+++ b/drivers/media/video/cx231xx/cx231xx-input.c
@@ -216,7 +216,7 @@ int cx231xx_ir_init(struct cx231xx *dev)
216 cx231xx_ir_start(ir); 216 cx231xx_ir_start(ir);
217 217
218 /* all done */ 218 /* all done */
219 err = ir_input_register(ir->input, dev->board.ir_codes); 219 err = ir_input_register(ir->input, dev->board.ir_codes, NULL);
220 if (err) 220 if (err)
221 goto err_out_stop; 221 goto err_out_stop;
222 222
diff --git a/drivers/media/video/cx23885/cx23885-input.c b/drivers/media/video/cx23885/cx23885-input.c
index 768eec92ccf9..9c6620f86dca 100644
--- a/drivers/media/video/cx23885/cx23885-input.c
+++ b/drivers/media/video/cx23885/cx23885-input.c
@@ -397,7 +397,7 @@ int cx23885_input_init(struct cx23885_dev *dev)
397 dev->ir_input = ir; 397 dev->ir_input = ir;
398 cx23885_input_ir_start(dev); 398 cx23885_input_ir_start(dev);
399 399
400 ret = ir_input_register(ir->dev, ir_codes); 400 ret = ir_input_register(ir->dev, ir_codes, NULL);
401 if (ret) 401 if (ret)
402 goto err_out_stop; 402 goto err_out_stop;
403 403
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c
index f9fda18b410c..49c07535e754 100644
--- a/drivers/media/video/cx88/cx88-input.c
+++ b/drivers/media/video/cx88/cx88-input.c
@@ -192,7 +192,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
192 struct cx88_IR *ir; 192 struct cx88_IR *ir;
193 struct input_dev *input_dev; 193 struct input_dev *input_dev;
194 struct ir_scancode_table *ir_codes = NULL; 194 struct ir_scancode_table *ir_codes = NULL;
195 int ir_type = IR_TYPE_OTHER; 195 enum ir_type ir_type = IR_TYPE_OTHER;
196 int err = -ENOMEM; 196 int err = -ENOMEM;
197 197
198 ir = kzalloc(sizeof(*ir), GFP_KERNEL); 198 ir = kzalloc(sizeof(*ir), GFP_KERNEL);
@@ -383,7 +383,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
383 cx88_ir_start(core, ir); 383 cx88_ir_start(core, ir);
384 384
385 /* all done */ 385 /* all done */
386 err = ir_input_register(ir->input, ir_codes); 386 err = ir_input_register(ir->input, ir_codes, NULL);
387 if (err) 387 if (err)
388 goto err_out_stop; 388 goto err_out_stop;
389 389
diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c
index af0d935c29be..fbfbab6841cd 100644
--- a/drivers/media/video/em28xx/em28xx-input.c
+++ b/drivers/media/video/em28xx/em28xx-input.c
@@ -412,7 +412,7 @@ int em28xx_ir_init(struct em28xx *dev)
412 em28xx_ir_start(ir); 412 em28xx_ir_start(ir);
413 413
414 /* all done */ 414 /* all done */
415 err = ir_input_register(ir->input, dev->board.ir_codes); 415 err = ir_input_register(ir->input, dev->board.ir_codes, NULL);
416 if (err) 416 if (err)
417 goto err_out_stop; 417 goto err_out_stop;
418 418
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c
index b86e35386cee..4cd75a3c47d1 100644
--- a/drivers/media/video/ir-kbd-i2c.c
+++ b/drivers/media/video/ir-kbd-i2c.c
@@ -299,7 +299,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
299{ 299{
300 struct ir_scancode_table *ir_codes = NULL; 300 struct ir_scancode_table *ir_codes = NULL;
301 const char *name = NULL; 301 const char *name = NULL;
302 int ir_type = 0; 302 enum ir_type ir_type = 0;
303 struct IR_i2c *ir; 303 struct IR_i2c *ir;
304 struct input_dev *input_dev; 304 struct input_dev *input_dev;
305 struct i2c_adapter *adap = client->adapter; 305 struct i2c_adapter *adap = client->adapter;
@@ -446,7 +446,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
446 input_dev->name = ir->name; 446 input_dev->name = ir->name;
447 input_dev->phys = ir->phys; 447 input_dev->phys = ir->phys;
448 448
449 err = ir_input_register(ir->input, ir->ir_codes); 449 err = ir_input_register(ir->input, ir->ir_codes, NULL);
450 if (err) 450 if (err)
451 goto err_out_free; 451 goto err_out_free;
452 452
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c
index f8e985989ca0..71b4b01824ac 100644
--- a/drivers/media/video/saa7134/saa7134-input.c
+++ b/drivers/media/video/saa7134/saa7134-input.c
@@ -460,7 +460,7 @@ int saa7134_input_init1(struct saa7134_dev *dev)
460 int polling = 0; 460 int polling = 0;
461 int rc5_gpio = 0; 461 int rc5_gpio = 0;
462 int nec_gpio = 0; 462 int nec_gpio = 0;
463 int ir_type = IR_TYPE_OTHER; 463 enum ir_type ir_type = IR_TYPE_OTHER;
464 int err; 464 int err;
465 465
466 if (dev->has_remote != SAA7134_REMOTE_GPIO) 466 if (dev->has_remote != SAA7134_REMOTE_GPIO)
@@ -728,7 +728,7 @@ int saa7134_input_init1(struct saa7134_dev *dev)
728 dev->remote = ir; 728 dev->remote = ir;
729 saa7134_ir_start(dev, ir); 729 saa7134_ir_start(dev, ir);
730 730
731 err = ir_input_register(ir->dev, ir_codes); 731 err = ir_input_register(ir->dev, ir_codes, NULL);
732 if (err) 732 if (err)
733 goto err_out_stop; 733 goto err_out_stop;
734 734