diff options
author | Sean Young <sean@mess.org> | 2013-07-30 18:00:01 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2013-08-22 10:46:46 -0400 |
commit | 153a60bb0faca59bfde313d4c713d9420e475b75 (patch) | |
tree | 73f680efd324624e584037c30816b311618d282d /drivers/media/rc/rc-main.c | |
parent | 38e35a85284b9cce271ff43a849d3676a46f8512 (diff) |
[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>
Diffstat (limited to 'drivers/media/rc/rc-main.c')
-rw-r--r-- | drivers/media/rc/rc-main.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index 1dedebda1cef..aa5d8e724622 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/spinlock.h> | 16 | #include <linux/spinlock.h> |
17 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
18 | #include <linux/input.h> | 18 | #include <linux/input.h> |
19 | #include <linux/leds.h> | ||
19 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
20 | #include <linux/device.h> | 21 | #include <linux/device.h> |
21 | #include <linux/module.h> | 22 | #include <linux/module.h> |
@@ -31,6 +32,7 @@ | |||
31 | /* Used to keep track of known keymaps */ | 32 | /* Used to keep track of known keymaps */ |
32 | static LIST_HEAD(rc_map_list); | 33 | static LIST_HEAD(rc_map_list); |
33 | static DEFINE_SPINLOCK(rc_map_lock); | 34 | static DEFINE_SPINLOCK(rc_map_lock); |
35 | static struct led_trigger *led_feedback; | ||
34 | 36 | ||
35 | static struct rc_map_list *seek_rc_map(const char *name) | 37 | static struct rc_map_list *seek_rc_map(const char *name) |
36 | { | 38 | { |
@@ -535,6 +537,7 @@ static void ir_do_keyup(struct rc_dev *dev, bool sync) | |||
535 | 537 | ||
536 | IR_dprintk(1, "keyup key 0x%04x\n", dev->last_keycode); | 538 | IR_dprintk(1, "keyup key 0x%04x\n", dev->last_keycode); |
537 | input_report_key(dev->input_dev, dev->last_keycode, 0); | 539 | input_report_key(dev->input_dev, dev->last_keycode, 0); |
540 | led_trigger_event(led_feedback, LED_OFF); | ||
538 | if (sync) | 541 | if (sync) |
539 | input_sync(dev->input_dev); | 542 | input_sync(dev->input_dev); |
540 | dev->keypressed = false; | 543 | dev->keypressed = false; |
@@ -648,6 +651,7 @@ static void ir_do_keydown(struct rc_dev *dev, int scancode, | |||
648 | input_report_key(dev->input_dev, keycode, 1); | 651 | input_report_key(dev->input_dev, keycode, 1); |
649 | } | 652 | } |
650 | 653 | ||
654 | led_trigger_event(led_feedback, LED_FULL); | ||
651 | input_sync(dev->input_dev); | 655 | input_sync(dev->input_dev); |
652 | } | 656 | } |
653 | 657 | ||
@@ -1222,6 +1226,7 @@ static int __init rc_core_init(void) | |||
1222 | return rc; | 1226 | return rc; |
1223 | } | 1227 | } |
1224 | 1228 | ||
1229 | led_trigger_register_simple("rc-feedback", &led_feedback); | ||
1225 | rc_map_register(&empty_map); | 1230 | rc_map_register(&empty_map); |
1226 | 1231 | ||
1227 | return 0; | 1232 | return 0; |
@@ -1230,6 +1235,7 @@ static int __init rc_core_init(void) | |||
1230 | static void __exit rc_core_exit(void) | 1235 | static void __exit rc_core_exit(void) |
1231 | { | 1236 | { |
1232 | class_unregister(&rc_class); | 1237 | class_unregister(&rc_class); |
1238 | led_trigger_unregister_simple(led_feedback); | ||
1233 | rc_map_unregister(&empty_map); | 1239 | rc_map_unregister(&empty_map); |
1234 | } | 1240 | } |
1235 | 1241 | ||