summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-10-08 12:31:05 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-10-11 03:58:05 +0000
commita1191b92d2f5784e2f4e1c5f40d4af1a41e55fda (patch)
tree1d37faaa2c4636eb414c7b1a382f30cf866d63ec
parent27e063ea100086a913ed655b611c88e077de5b00 (diff)
downloadchrome-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>
-rw-r--r--board/rambi/board.h1
-rw-r--r--chip/lm4/keyboard_raw.c33
-rw-r--r--include/config.h8
3 files changed, 25 insertions, 17 deletions
diff --git a/board/rambi/board.h b/board/rambi/board.h
index 2fdb718013..deb00abc15 100644
--- a/board/rambi/board.h
+++ b/board/rambi/board.h
@@ -13,6 +13,7 @@
#define CONFIG_BOARD_VERSION
#define CONFIG_CMD_GSV
#define CONFIG_EXTPOWER_GPIO
+#define CONFIG_KEYBOARD_COL2_INVERTED
#define CONFIG_KEYBOARD_PROTOCOL_8042
#define CONFIG_LED_COMMON
#undef CONFIG_PECI
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)
diff --git a/include/config.h b/include/config.h
index 09478a1557..21821100a7 100644
--- a/include/config.h
+++ b/include/config.h
@@ -426,6 +426,14 @@
/*****************************************************************************/
/* Keyboard config */
+/*
+ * The Silego reset chip sits in between the EC and the physical keyboard on
+ * column 2. To save power in low-power modes, some Silego variants require
+ * the signal to be inverted so that the open-drain output from the EC isn't
+ * costing power due to the pull-up resistor in the Silego.
+ */
+#undef CONFIG_KEYBOARD_COL2_INVERTED
+
/* Enable extra debugging output from keyboard modules */
#undef CONFIG_KEYBOARD_DEBUG