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;