From 4be45e962cba218c07944dd97935361be9017224 Mon Sep 17 00:00:00 2001 From: Chris Zhong Date: Tue, 30 Sep 2014 16:22:45 +0800 Subject: [PATCH] stm32: invert keyboard col2 option Silego variant in pinky rev2 require the signal to be inverted. BUG=None TEST=on pinky-rev2: all keys from col2 work correctly BRANCH=None Change-Id: I83a029b4e9c6b4770e83f30b170595d45ea40cca Signed-off-by: Chris Zhong Signed-off-by: Alexandru M Stan Reviewed-on: https://chromium-review.googlesource.com/220314 --- board/veyron/board.h | 1 + board/veyron/gpio.inc | 4 ++-- chip/stm32/keyboard_raw.c | 7 +++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/board/veyron/board.h b/board/veyron/board.h index 707fef99ac..398a56b62a 100644 --- a/board/veyron/board.h +++ b/board/veyron/board.h @@ -22,6 +22,7 @@ #define CONFIG_FORCE_CONSOLE_RESUME #define CONFIG_HOST_COMMAND_STATUS #define CONFIG_I2C +#define CONFIG_KEYBOARD_COL2_INVERTED #define CONFIG_KEYBOARD_PROTOCOL_MKBP #define CONFIG_LED_COMMON #define CONFIG_LOW_POWER_IDLE diff --git a/board/veyron/gpio.inc b/board/veyron/gpio.inc index e38ac5aea7..b02e0a2015 100644 --- a/board/veyron/gpio.inc +++ b/board/veyron/gpio.inc @@ -31,13 +31,13 @@ GPIO(5V_DRV, A, 8, GPIO_OUT_LOW, NULL) GPIO(BAT_LED0, B, 11, GPIO_OUT_LOW, NULL) GPIO(BAT_LED1, A, 11, GPIO_OUT_LOW, NULL) GPIO(EC_BL_OVERRIDE, F, 1, GPIO_OUT_LOW, NULL) -GPIO(EC_INT, B, 9, GPIO_OUT_LOW, NULL) +GPIO(EC_INT, B, 9, GPIO_OUT_LOW, NULL) GPIO(ENTERING_RW, F, 0, GPIO_OUT_LOW, NULL) GPIO(I2C1_SCL, B, 6, GPIO_ODR_HIGH, NULL) GPIO(I2C1_SDA, B, 7, GPIO_ODR_HIGH, NULL) GPIO(KB_OUT00, B, 0, GPIO_KB_OUTPUT, NULL) GPIO(KB_OUT01, B, 8, GPIO_KB_OUTPUT, NULL) -GPIO(KB_OUT02, B, 12, GPIO_KB_OUTPUT, NULL) +GPIO(KB_OUT02, B, 12, GPIO_OUT_LOW, NULL) /* Inverted from silegro */ GPIO(KB_OUT03, B, 13, GPIO_KB_OUTPUT, NULL) GPIO(KB_OUT04, B, 14, GPIO_KB_OUTPUT, NULL) GPIO(KB_OUT05, B, 15, GPIO_KB_OUTPUT, NULL) diff --git a/chip/stm32/keyboard_raw.c b/chip/stm32/keyboard_raw.c index bc810e2a04..4ac7f2dcb2 100644 --- a/chip/stm32/keyboard_raw.c +++ b/chip/stm32/keyboard_raw.c @@ -86,6 +86,13 @@ test_mockable void keyboard_raw_drive_column(int out) } } + #ifdef CONFIG_KEYBOARD_COL2_INVERTED + if (bsrr & (gpio_list[GPIO_KB_OUT02].mask << 16 | + gpio_list[GPIO_KB_OUT02].mask)) + bsrr ^= (gpio_list[GPIO_KB_OUT02].mask << 16 | + gpio_list[GPIO_KB_OUT02].mask); + #endif + if (bsrr) STM32_GPIO_BSRR(kb_out_ports[i]) = bsrr;