CHROMIUM: mkbp: Optimize ghosting algorithm.
authorTodd Broch <tbroch@chromium.org>
Fri, 19 Apr 2013 23:48:03 +0000 (16:48 -0700)
committerChromeBot <chrome-bot@google.com>
Mon, 22 Apr 2013 18:54:53 +0000 (11:54 -0700)
commited9cf9b07c960582178ac75dee407e801739725a
tree29d862f449e4f8c7de0a8c702abd3a9094c402ea
parentd70a5c08d89e76dda02fbe0c3d169a95ecd7a546
CHROMIUM: mkbp: Optimize ghosting algorithm.

Previous algorithm was a bit conservative and complicating with
respect to identifying key ghosting.  This CL uses the bitops hamming
weight function (hweight8) to count the number of matching rows for
colM & colN.  If that number is > 1 ghosting is present.

Additionally it removes NULL keys and our one virtual keypress
KEY_BATTERY from consideration as these inputs are never physical
keypresses.

Signed-off-by: Todd Broch <tbroch@chromium.org>
BUG=chrome-os-partner:18354
TEST=manual
1. using evtest I now see ctrl-U
2. escape sequence ctrl-U correctly display 'webpage source'
3. w/ #define DEBUG in mkbp.c no longer see below when ctrl-U pressed
   chromeos-ec-i2c 4-001e: ghost found ...

Change-Id: Ifc98b527c3ee4daffa9d8c726429fdd1b35970fa
Reviewed-on: https://gerrit.chromium.org/gerrit/48789
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
drivers/input/keyboard/mkbp.c