diff options
author | Randall Spangler <rspangler@chromium.org> | 2013-10-08 12:31:05 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2013-10-11 03:58:05 +0000 |
commit | a1191b92d2f5784e2f4e1c5f40d4af1a41e55fda (patch) | |
tree | 1d37faaa2c4636eb414c7b1a382f30cf866d63ec /chip/lm4/keyboard_raw.c | |
parent | 27e063ea100086a913ed655b611c88e077de5b00 (diff) | |
download | chrome-ec-a1191b92d2f5784e2f4e1c5f40d4af1a41e55fda.tar.gz |
rambi: Keyboard output column 2 must be inverted
The Silego chip used on Rambi inverts column 2. So the EC should pull the signal low when NOT scanning column 2, and release it at all other times.
BUG=chrome-os-partner:23198
BRANCH=none
TEST=not yet; need to probe on scope
Change-Id: If6a784493533f11ae54d18f27591697e69aa2282
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/172674
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'chip/lm4/keyboard_raw.c')
-rw-r--r-- | chip/lm4/keyboard_raw.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/chip/lm4/keyboard_raw.c b/chip/lm4/keyboard_raw.c index 2104bd08a9..2a158769a4 100644 --- a/chip/lm4/keyboard_raw.c +++ b/chip/lm4/keyboard_raw.c @@ -53,23 +53,22 @@ void keyboard_raw_task_start(void) test_mockable void keyboard_raw_drive_column(int col) { - if (col == KEYBOARD_COLUMN_NONE) { - /* Tri-state all outputs */ - LM4_GPIO_DATA(LM4_GPIO_P, 0xff) = 0xff; - LM4_GPIO_DATA(LM4_GPIO_Q, 0x1f) = 0x1f; - } else if (col == KEYBOARD_COLUMN_ALL) { - /* Assert all outputs */ - LM4_GPIO_DATA(LM4_GPIO_P, 0xff) = 0; - LM4_GPIO_DATA(LM4_GPIO_Q, 0x1f) = 0; - } else { - /* Assert a single output */ - LM4_GPIO_DATA(LM4_GPIO_P, 0xff) = 0xff; - LM4_GPIO_DATA(LM4_GPIO_Q, 0x1f) = 0x1f; - if (col < 8) - LM4_GPIO_DATA(LM4_GPIO_P, 1 << col) = 0; - else - LM4_GPIO_DATA(LM4_GPIO_Q, 1 << (col - 8)) = 0; - } + int mask; + + if (col == KEYBOARD_COLUMN_NONE) + mask = 0x1fff; /* Tri-state all outputs */ + else if (col == KEYBOARD_COLUMN_ALL) + mask = 0; /* Assert all outputs */ + else + mask = 0x1fff ^ (1 << col); /* Assert a single output */ + +#ifdef CONFIG_KEYBOARD_COL2_INVERTED + /* Invert column 2 output */ + mask ^= (1 << 2); +#endif + + LM4_GPIO_DATA(LM4_GPIO_P, 0xff) = mask & 0xff; + LM4_GPIO_DATA(LM4_GPIO_Q, 0x1f) = (mask >> 8) & 0x1f; } test_mockable int keyboard_raw_read_rows(void) |