diff options
author | Julian Andres Klode <jak@jak-linux.org> | 2011-09-27 13:00:54 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-09-29 20:41:34 -0400 |
commit | ff169c1487381aa522b92b9f0c87bd92577bfc80 (patch) | |
tree | 3a8e4e9ab738756c245f0df172eb7a7043db2e63 /drivers/staging/nvec/nvec_kbd.c | |
parent | 791c4a642721552204d8defdbd6a3e93cd411f79 (diff) |
staging: nvec: Enable the capslock LED in the keyboard driver
When the caps lock key is pressed, toggle the associated
LED. According to Nvidia code, we should send 0x01 where
we sent 0x07, but this does not appear to work correctly
on the AC100.
Signed-off-by: Julian Andres Klode <jak@jak-linux.org>
Acked-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/nvec/nvec_kbd.c')
-rw-r--r-- | drivers/staging/nvec/nvec_kbd.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/staging/nvec/nvec_kbd.c b/drivers/staging/nvec/nvec_kbd.c index 167eac09809..a4ce5a740e2 100644 --- a/drivers/staging/nvec/nvec_kbd.c +++ b/drivers/staging/nvec/nvec_kbd.c | |||
@@ -23,6 +23,8 @@ | |||
23 | 23 | ||
24 | #define ACK_KBD_EVENT {'\x05', '\xed', '\x01'} | 24 | #define ACK_KBD_EVENT {'\x05', '\xed', '\x01'} |
25 | 25 | ||
26 | static const char led_on[3] = "\x05\xed\x07"; | ||
27 | static const char led_off[3] = "\x05\xed\x00"; | ||
26 | static unsigned char keycodes[ARRAY_SIZE(code_tab_102us) | 28 | static unsigned char keycodes[ARRAY_SIZE(code_tab_102us) |
27 | + ARRAY_SIZE(extcode_tab_us102)]; | 29 | + ARRAY_SIZE(extcode_tab_us102)]; |
28 | 30 | ||
@@ -30,10 +32,21 @@ struct nvec_keys { | |||
30 | struct input_dev *input; | 32 | struct input_dev *input; |
31 | struct notifier_block notifier; | 33 | struct notifier_block notifier; |
32 | struct nvec_chip *nvec; | 34 | struct nvec_chip *nvec; |
35 | bool caps_lock; | ||
33 | }; | 36 | }; |
34 | 37 | ||
35 | static struct nvec_keys keys_dev; | 38 | static struct nvec_keys keys_dev; |
36 | 39 | ||
40 | static void nvec_kbd_toggle_led(void) | ||
41 | { | ||
42 | keys_dev.caps_lock = !keys_dev.caps_lock; | ||
43 | |||
44 | if (keys_dev.caps_lock) | ||
45 | nvec_write_async(keys_dev.nvec, led_on, sizeof(led_on)); | ||
46 | else | ||
47 | nvec_write_async(keys_dev.nvec, led_off, sizeof(led_off)); | ||
48 | } | ||
49 | |||
37 | static int nvec_keys_notifier(struct notifier_block *nb, | 50 | static int nvec_keys_notifier(struct notifier_block *nb, |
38 | unsigned long event_type, void *data) | 51 | unsigned long event_type, void *data) |
39 | { | 52 | { |
@@ -53,6 +66,9 @@ static int nvec_keys_notifier(struct notifier_block *nb, | |||
53 | code = msg[1] & 0x7f; | 66 | code = msg[1] & 0x7f; |
54 | state = msg[1] & 0x80; | 67 | state = msg[1] & 0x80; |
55 | 68 | ||
69 | if (code_tabs[_size][code] == KEY_CAPSLOCK && state) | ||
70 | nvec_kbd_toggle_led(); | ||
71 | |||
56 | input_report_key(keys_dev.input, code_tabs[_size][code], | 72 | input_report_key(keys_dev.input, code_tabs[_size][code], |
57 | !state); | 73 | !state); |
58 | input_sync(keys_dev.input); | 74 | input_sync(keys_dev.input); |
@@ -133,6 +149,9 @@ static int __devinit nvec_kbd_probe(struct platform_device *pdev) | |||
133 | or until we have a sync write */ | 149 | or until we have a sync write */ |
134 | mdelay(1000); | 150 | mdelay(1000); |
135 | 151 | ||
152 | /* Disable caps lock LED */ | ||
153 | nvec_write_async(nvec, led_off, sizeof(led_off)); | ||
154 | |||
136 | return 0; | 155 | return 0; |
137 | 156 | ||
138 | fail: | 157 | fail: |