aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/IR
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2010-03-31 13:40:35 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-05-17 23:53:03 -0400
commit716aab44df8bb9bdf16abea9013890274329b61f (patch)
treeb83baf34bf18d35d51318044d8ea1ae80a275304 /drivers/media/IR
parente202c15b4209f05fe109dd396463a524f4c2d3d8 (diff)
V4L/DVB: ir-core: Add callbacks for input/evdev open/close on IR core
Especially when IR needs to do polling, it generates lots of wakeups per second. This makes no sense, if the input event device is closed. Adds a callback handler to the IR hardware driver, to allow registering an open/close ops. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/IR')
-rw-r--r--drivers/media/IR/ir-keytable.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c
index fcb0f0cb1fe1..99cad829a18a 100644
--- a/drivers/media/IR/ir-keytable.c
+++ b/drivers/media/IR/ir-keytable.c
@@ -446,6 +446,19 @@ void ir_keydown(struct input_dev *dev, int scancode)
446} 446}
447EXPORT_SYMBOL_GPL(ir_keydown); 447EXPORT_SYMBOL_GPL(ir_keydown);
448 448
449static int ir_open(struct input_dev *input_dev)
450{
451 struct ir_input_dev *ir_dev = input_get_drvdata(input_dev);
452
453 return ir_dev->props->open(ir_dev->props->priv);
454}
455
456static void ir_close(struct input_dev *input_dev)
457{
458 struct ir_input_dev *ir_dev = input_get_drvdata(input_dev);
459
460 ir_dev->props->close(ir_dev->props->priv);
461}
449 462
450/** 463/**
451 * ir_input_register() - sets the IR keycode table and add the handlers 464 * ir_input_register() - sets the IR keycode table and add the handlers
@@ -495,6 +508,10 @@ int ir_input_register(struct input_dev *input_dev,
495 508
496 ir_copy_table(&ir_dev->rc_tab, rc_tab); 509 ir_copy_table(&ir_dev->rc_tab, rc_tab);
497 ir_dev->props = props; 510 ir_dev->props = props;
511 if (props && props->open)
512 input_dev->open = ir_open;
513 if (props && props->close)
514 input_dev->close = ir_close;
498 515
499 /* set the bits for the keys */ 516 /* set the bits for the keys */
500 IR_dprintk(1, "key map size: %d\n", rc_tab->size); 517 IR_dprintk(1, "key map size: %d\n", rc_tab->size);