diff options
-rw-r--r-- | board/daisy/board.h | 1 | ||||
-rw-r--r-- | board/snow/board.h | 1 | ||||
-rw-r--r-- | board/spring/board.h | 1 | ||||
-rw-r--r-- | chip/stm32/keyboard_scan.c | 12 |
4 files changed, 7 insertions, 8 deletions
diff --git a/board/daisy/board.h b/board/daisy/board.h index 3194a2de70..0f7f2169a4 100644 --- a/board/daisy/board.h +++ b/board/daisy/board.h @@ -38,6 +38,7 @@ /* EC drives 13 outputs to the keyboard matrix and reads 8 inputs/interrupts */ #define KB_INPUTS 8 #define KB_OUTPUTS 13 +#define KB_OUT_PORT_LIST GPIO_B, GPIO_C /* Charging */ #define CONFIG_SMART_BATTERY diff --git a/board/snow/board.h b/board/snow/board.h index 27837b665a..f7f3683322 100644 --- a/board/snow/board.h +++ b/board/snow/board.h @@ -41,6 +41,7 @@ /* EC drives 13 outputs to the keyboard matrix and reads 8 inputs/interrupts */ #define KB_INPUTS 8 #define KB_OUTPUTS 13 +#define KB_OUT_PORT_LIST GPIO_B, GPIO_C /* Charging */ #define CONFIG_SMART_BATTERY diff --git a/board/spring/board.h b/board/spring/board.h index cc1b675141..1132f759c5 100644 --- a/board/spring/board.h +++ b/board/spring/board.h @@ -44,6 +44,7 @@ /* EC drives 13 outputs to the keyboard matrix and reads 8 inputs/interrupts */ #define KB_INPUTS 8 #define KB_OUTPUTS 13 +#define KB_OUT_PORT_LIST GPIO_B, GPIO_C /* Charging */ #define CONFIG_SMART_BATTERY diff --git a/chip/stm32/keyboard_scan.c b/chip/stm32/keyboard_scan.c index d1e46628ea..f1532f6ec5 100644 --- a/chip/stm32/keyboard_scan.c +++ b/chip/stm32/keyboard_scan.c @@ -69,11 +69,7 @@ struct kbc_gpio { int pin; }; -#if defined(BOARD_daisy) || defined(BOARD_snow) || defined(BOARD_spring) -static const uint32_t ports[] = { GPIO_B, GPIO_C, GPIO_D }; -#else -#error "Need to specify GPIO ports used by keyboard" -#endif +static const uint32_t kb_out_ports[] = { KB_OUT_PORT_LIST }; /* Provide a default function in case the board doesn't have one */ void __board_keyboard_suppress_noise(void) @@ -179,12 +175,12 @@ static void assert_output(int out) { int i, done = 0; - for (i = 0; i < ARRAY_SIZE(ports); i++) { + for (i = 0; i < ARRAY_SIZE(kb_out_ports); i++) { uint32_t bsrr = 0; int j; for (j = GPIO_KB_OUT00; j <= GPIO_KB_OUT12; j++) { - if (gpio_list[j].port != ports[i]) + if (gpio_list[j].port != kb_out_ports[i]) continue; if (out == OUTPUT_ASSERT_ALL) { @@ -207,7 +203,7 @@ static void assert_output(int out) } if (bsrr) - STM32_GPIO_BSRR_OFF(ports[i]) = bsrr; + STM32_GPIO_BSRR_OFF(kb_out_ports[i]) = bsrr; if (done) break; |