summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Hendricks <dhendrix@chromium.org>2013-03-12 18:35:25 -0700
committerChromeBot <chrome-bot@google.com>2013-03-13 12:12:01 -0700
commitcdfbe88e9264cf6eb9de687f83cf0dd0b908f76e (patch)
tree0f9214269382fc09da6a9b1c50648cfde81db1a4
parent2823e7e13208a70c7c1b0fce56758f17049a1658 (diff)
downloadchrome-ec-cdfbe88e9264cf6eb9de687f83cf0dd0b908f76e.tar.gz
stm32: list keyboard output ports on a per-board basis
This CL moves the keyboard port listing to board.h for each mainboard to reduce board-specific clutter in keyboard_scan.c. Since the info is now exposed outside of keyboard_scan.c, a more descriptive name was chosen. Note: GPIO_D does not need to be included in this list for any current platform. BUG=none BRANCH=none Test=tested on Snow by pressing all number and letter keys Signed-off-by: David Hendricks <dhendrix@chromium.org> Change-Id: I1ce924a41cafae557467997ecba9c5abeed86211 Reviewed-on: https://gerrit.chromium.org/gerrit/45284 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: David Hendricks <dhendrix@chromium.org> Tested-by: David Hendricks <dhendrix@chromium.org>
-rw-r--r--board/daisy/board.h1
-rw-r--r--board/snow/board.h1
-rw-r--r--board/spring/board.h1
-rw-r--r--chip/stm32/keyboard_scan.c12
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;