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>
This commit is contained in:
David Hendricks
2013-03-12 18:35:25 -07:00
committed by ChromeBot
parent 2823e7e132
commit cdfbe88e92
4 changed files with 7 additions and 8 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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;