diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-24 17:17:30 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-24 17:17:30 -0800 |
commit | 1b59bab55e36082b1db3dc81bb32475616487a98 (patch) | |
tree | 0cf4af345f159b7056465053c28b5d5089566650 /drivers/input/keyboard/cros_ec_keyb.c | |
parent | b788769e0641daf90a8d7e800081285f8ca80bd9 (diff) | |
parent | 55df811f2066fcaec2548248f0a1a6a0c12dc6b8 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input subsystem updates from Dmitry Torokhov:
"Just a swath of driver fixes and cleanups, no new drivers this time
(although ALPS now supports one of the newer protocols, more to come)"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (57 commits)
Input: wacom - add support for DTU-1031
Input: wacom - fix wacom->shared guards for dual input devices
Input: edt_ft5x06 - use devm_* functions where appropriate
Input: hyperv-keyboard - pass through 0xE1 prefix
Input: logips2pp - fix spelling s/reciver/receiver/
Input: delete non-required instances of include <linux/init.h>
Input: twl4030-keypad - convert to using managed resources
Input: twl6040-vibra - remove unneeded check for CONFIG_OF
Input: twl4030-keypad - add device tree support
Input: twl6040-vibra - add missing of_node_put
Input: twl4030-vibra - add missing of_node_put
Input: i8042 - cleanup SERIO_I8042 dependencies
Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO on x86
Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO on unicore32
Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO on sparc
Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO for SH_CAYMAN
Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO on powerpc
Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO on mips
Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO on IA64
Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO on ARM/Footbridge
...
Diffstat (limited to 'drivers/input/keyboard/cros_ec_keyb.c')
-rw-r--r-- | drivers/input/keyboard/cros_ec_keyb.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c index 7e8b0a52af2..408379669d3 100644 --- a/drivers/input/keyboard/cros_ec_keyb.c +++ b/drivers/input/keyboard/cros_ec_keyb.c @@ -38,6 +38,7 @@ * @row_shift: log2 or number of rows, rounded up * @keymap_data: Matrix keymap data used to convert to keyscan values * @ghost_filter: true to enable the matrix key-ghosting filter + * @old_kb_state: bitmap of keys pressed last scan * @dev: Device pointer * @idev: Input device * @ec: Top level ChromeOS device to use to talk to EC @@ -49,6 +50,7 @@ struct cros_ec_keyb { int row_shift; const struct matrix_keymap_data *keymap_data; bool ghost_filter; + uint8_t *old_kb_state; struct device *dev; struct input_dev *idev; @@ -135,6 +137,7 @@ static void cros_ec_keyb_process(struct cros_ec_keyb *ckdev, struct input_dev *idev = ckdev->idev; int col, row; int new_state; + int old_state; int num_cols; num_cols = len; @@ -153,18 +156,19 @@ static void cros_ec_keyb_process(struct cros_ec_keyb *ckdev, for (row = 0; row < ckdev->rows; row++) { int pos = MATRIX_SCAN_CODE(row, col, ckdev->row_shift); const unsigned short *keycodes = idev->keycode; - int code; - code = keycodes[pos]; new_state = kb_state[col] & (1 << row); - if (!!new_state != test_bit(code, idev->key)) { + old_state = ckdev->old_kb_state[col] & (1 << row); + if (new_state != old_state) { dev_dbg(ckdev->dev, "changed: [r%d c%d]: byte %02x\n", row, col, new_state); - input_report_key(idev, code, new_state); + input_report_key(idev, keycodes[pos], + new_state); } } + ckdev->old_kb_state[col] = kb_state[col]; } input_sync(ckdev->idev); } @@ -226,6 +230,9 @@ static int cros_ec_keyb_probe(struct platform_device *pdev) &ckdev->cols); if (err) return err; + ckdev->old_kb_state = devm_kzalloc(&pdev->dev, ckdev->cols, GFP_KERNEL); + if (!ckdev->old_kb_state) + return -ENOMEM; idev = devm_input_allocate_device(&pdev->dev); if (!idev) |