diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-21 12:11:44 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-21 12:11:44 -0800 |
commit | b5c78e04dd061b776978dad61dd85357081147b0 (patch) | |
tree | 2416b2dc61c452c3aeb2a32bcedf15e6257be638 /drivers/staging/nvec/nvec_kbd.c | |
parent | 06991c28f37ad68e5c03777f5c3b679b56e3dac1 (diff) | |
parent | 951348b377385475aa256c27e1c9e2564c9ec160 (diff) | |
download | op-kernel-dev-b5c78e04dd061b776978dad61dd85357081147b0.zip op-kernel-dev-b5c78e04dd061b776978dad61dd85357081147b0.tar.gz |
Merge tag 'staging-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging tree update from Greg Kroah-Hartman:
"Here's the big staging tree merge for 3.9-rc1
Lots of cleanups and updates for drivers all through the staging tree.
We are pretty much "code neutral" here, adding just about as many
lines as we removed.
All of these have been in linux-next for a while."
* tag 'staging-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (804 commits)
staging: comedi: vmk80xx: wait for URBs to complete
staging: comedi: drivers: addi-data: hwdrv_apci3200.c: Add a missing semicolon
staging: et131x: Update TODO list
staging: et131x: Remove assignment of skb->dev
staging: wlan-ng: hfa384x.h: fix for error reported by smatch
staging/zache checkpatch ERROR: spaces prohibited around that
staging/ozwpan: Mark read only parameters and structs as const
staging/ozwpan: Remove empty and unused function oz_cdev_heartbeat
staging/ozwpan: Mark local functions as static (fix sparse warnings)
staging/ozwpan: Add missing header includes
staging/usbip: Mark local functions as static (fix sparse warnings)
staging/xgifb: Remove duplicated code in loops.
staging/xgifb: Consolidate return paths
staging/xgifb: Remove code without effect
staging/xgifb: Remove unnecessary casts
staging/xgifb: Consolidate if/else if with identical code branches
staging: vt6656: replaced custom TRUE definition with true
staging: vt6656: replaced custom FALSE definition with false
staging: vt6656: replace custom BOOL definition with bool
staging/rtl8187se: Mark functions as static to silence sparse
...
Diffstat (limited to 'drivers/staging/nvec/nvec_kbd.c')
-rw-r--r-- | drivers/staging/nvec/nvec_kbd.c | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/drivers/staging/nvec/nvec_kbd.c b/drivers/staging/nvec/nvec_kbd.c index 7cb149b..7445ce6 100644 --- a/drivers/staging/nvec/nvec_kbd.c +++ b/drivers/staging/nvec/nvec_kbd.c @@ -21,10 +21,14 @@ #include "nvec-keytable.h" #include "nvec.h" -#define ACK_KBD_EVENT {'\x05', '\xed', '\x01'} +enum kbd_subcmds { + CNFG_WAKE = 3, + CNFG_WAKE_KEY_REPORTING, + SET_LEDS = 0xed, + ENABLE_KBD = 0xf4, + DISABLE_KBD, +}; -static const char led_on[3] = "\x05\xed\x07"; -static const char led_off[3] = "\x05\xed\x00"; static unsigned char keycodes[ARRAY_SIZE(code_tab_102us) + ARRAY_SIZE(extcode_tab_us102)]; @@ -39,12 +43,15 @@ static struct nvec_keys keys_dev; static void nvec_kbd_toggle_led(void) { + char buf[] = { NVEC_KBD, SET_LEDS, 0 }; + keys_dev.caps_lock = !keys_dev.caps_lock; if (keys_dev.caps_lock) - nvec_write_async(keys_dev.nvec, led_on, sizeof(led_on)); - else - nvec_write_async(keys_dev.nvec, led_off, sizeof(led_off)); + /* should be BIT(0) only, firmware bug? */ + buf[2] = BIT(0) | BIT(1) | BIT(2); + + nvec_write_async(keys_dev.nvec, buf, sizeof(buf)); } static int nvec_keys_notifier(struct notifier_block *nb, @@ -82,8 +89,8 @@ static int nvec_keys_notifier(struct notifier_block *nb, static int nvec_kbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) { - unsigned char buf[] = ACK_KBD_EVENT; struct nvec_chip *nvec = keys_dev.nvec; + char buf[] = { NVEC_KBD, SET_LEDS, 0 }; if (type == EV_REP) return 0; @@ -105,6 +112,11 @@ static int nvec_kbd_probe(struct platform_device *pdev) struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent); int i, j, err; struct input_dev *idev; + char clear_leds[] = { NVEC_KBD, SET_LEDS, 0 }, + enable_kbd[] = { NVEC_KBD, ENABLE_KBD }, + cnfg_wake[] = { NVEC_KBD, CNFG_WAKE, true, true }, + cnfg_wake_key_reporting[] = { NVEC_KBD, CNFG_WAKE_KEY_REPORTING, + true }; j = 0; @@ -138,19 +150,15 @@ static int nvec_kbd_probe(struct platform_device *pdev) nvec_register_notifier(nvec, &keys_dev.notifier, 0); /* Enable keyboard */ - nvec_write_async(nvec, "\x05\xf4", 2); + nvec_write_async(nvec, enable_kbd, 2); - /* keyboard reset? */ - nvec_write_async(nvec, "\x05\x03\x01\x01", 4); - nvec_write_async(nvec, "\x05\x04\x01", 3); - nvec_write_async(nvec, "\x06\x01\xff\x03", 4); -/* FIXME - wait until keyboard reset is finished - or until we have a sync write */ - mdelay(1000); + /* configures wake on special keys */ + nvec_write_async(nvec, cnfg_wake, 4); + /* enable wake key reporting */ + nvec_write_async(nvec, cnfg_wake_key_reporting, 3); /* Disable caps lock LED */ - nvec_write_async(nvec, led_off, sizeof(led_off)); + nvec_write_async(nvec, clear_leds, sizeof(clear_leds)); return 0; |