mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 17:08:10 +00:00
[media] rc: add feedback led trigger for rc keypresses
Many devices with an ir receiver also have a feedback led. Add the led trigger to support this. Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
This commit is contained in:
parent
38e35a8528
commit
153a60bb0f
1 changed files with 6 additions and 0 deletions
|
@ -16,6 +16,7 @@
|
||||||
#include <linux/spinlock.h>
|
#include <linux/spinlock.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
|
#include <linux/leds.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
|
@ -31,6 +32,7 @@
|
||||||
/* Used to keep track of known keymaps */
|
/* Used to keep track of known keymaps */
|
||||||
static LIST_HEAD(rc_map_list);
|
static LIST_HEAD(rc_map_list);
|
||||||
static DEFINE_SPINLOCK(rc_map_lock);
|
static DEFINE_SPINLOCK(rc_map_lock);
|
||||||
|
static struct led_trigger *led_feedback;
|
||||||
|
|
||||||
static struct rc_map_list *seek_rc_map(const char *name)
|
static struct rc_map_list *seek_rc_map(const char *name)
|
||||||
{
|
{
|
||||||
|
@ -535,6 +537,7 @@ static void ir_do_keyup(struct rc_dev *dev, bool sync)
|
||||||
|
|
||||||
IR_dprintk(1, "keyup key 0x%04x\n", dev->last_keycode);
|
IR_dprintk(1, "keyup key 0x%04x\n", dev->last_keycode);
|
||||||
input_report_key(dev->input_dev, dev->last_keycode, 0);
|
input_report_key(dev->input_dev, dev->last_keycode, 0);
|
||||||
|
led_trigger_event(led_feedback, LED_OFF);
|
||||||
if (sync)
|
if (sync)
|
||||||
input_sync(dev->input_dev);
|
input_sync(dev->input_dev);
|
||||||
dev->keypressed = false;
|
dev->keypressed = false;
|
||||||
|
@ -648,6 +651,7 @@ static void ir_do_keydown(struct rc_dev *dev, int scancode,
|
||||||
input_report_key(dev->input_dev, keycode, 1);
|
input_report_key(dev->input_dev, keycode, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
led_trigger_event(led_feedback, LED_FULL);
|
||||||
input_sync(dev->input_dev);
|
input_sync(dev->input_dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1222,6 +1226,7 @@ static int __init rc_core_init(void)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
led_trigger_register_simple("rc-feedback", &led_feedback);
|
||||||
rc_map_register(&empty_map);
|
rc_map_register(&empty_map);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1230,6 +1235,7 @@ static int __init rc_core_init(void)
|
||||||
static void __exit rc_core_exit(void)
|
static void __exit rc_core_exit(void)
|
||||||
{
|
{
|
||||||
class_unregister(&rc_class);
|
class_unregister(&rc_class);
|
||||||
|
led_trigger_unregister_simple(led_feedback);
|
||||||
rc_map_unregister(&empty_map);
|
rc_map_unregister(&empty_map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue