Move asserting host keyboard interrupt signal to keyboard_scan

The implementation is identical on all stm32 hardware, so remove all
the duplicate copies from board.c files.  mccrosskey doesn't have
GPIO_EC_INT so stub it out like we do on bds.

No functional change, just moving code.

BUG=none
BRANCH=none
TEST=build mccrosskey,daisy,snow,spring

Change-Id: I7d4378650d7b4c640c15180c41459a41620f5bd3
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45920
This commit is contained in:
Randall Spangler
2013-03-19 16:40:23 -07:00
committed by ChromeBot
parent 22ff9df913
commit 447b05b828
10 changed files with 25 additions and 37 deletions

View File

@@ -181,12 +181,6 @@ void configure_board(void)
gpio_set_level(GPIO_EC_INT, 1);
}
void board_interrupt_host(int active)
{
/* interrupt host by using active low EC_INT signal */
gpio_set_level(GPIO_EC_INT, !active);
}
void board_keyboard_suppress_noise(void)
{
/* notify audio codec of keypress for noise suppression */

View File

@@ -113,9 +113,6 @@ void configure_board(void);
/* Signal to the AP that keyboard scan data is available */
void board_keyboard_suppress_noise(void);
/* Signal to AP that data is waiting */
void board_interrupt_host(int active);
/* Auto detect EC i2c host port */
int board_i2c_host_port(void);

View File

@@ -81,6 +81,10 @@ const struct gpio_info gpio_list[GPIO_COUNT] = {
/* FIXME: make this alt. function */
{"BL_PWM", GPIO_A, (1<<1), GPIO_OUTPUT, NULL},
/* Unimplemented signals which we need to emulate for now */
GPIO_SIGNAL_NOT_IMPLEMENTED("EC_INT"),
#if 0
/* Other GPIOs (probably need to be set up below as alt. function) */
{"STM_USBDM", GPIO_A, (1<<11), GPIO_DEFAULT, NULL},
@@ -165,6 +169,3 @@ void kbd_power_on(enum gpio_signal signal)
{
/* FIXME: this is just a stub for now... */
}
/* FIXME: this should not be needed on mccroskey. */
void board_interrupt_host(int active) { }

View File

@@ -100,6 +100,10 @@ enum gpio_signal {
/* FIXME: this will be an alt. function GPIO, so remove it from here */
GPIO_BL_PWM,
/* Unimplemented GPIOs */
GPIO_EC_INT,
#if 0
GPIO_STM_USBDM,
GPIO_STM_USBDP,
@@ -115,9 +119,6 @@ enum gpio_signal {
void configure_board(void);
/* FIXME: this should not be needed on mccroskey. */
void board_interrupt_host(int active);
#endif /* !__ASSEMBLER__ */
#endif /* __BOARD_H */

View File

@@ -177,12 +177,6 @@ void configure_board_late(void)
#endif
}
void board_interrupt_host(int active)
{
/* interrupt host by using active low EC_INT signal */
gpio_set_level(GPIO_EC_INT, !active);
}
void board_keyboard_suppress_noise(void)
{
/* notify audio codec of keypress for noise suppression */

View File

@@ -124,9 +124,6 @@ void configure_board(void);
void configure_board_late(void);
/* Signal to AP that data is waiting */
void board_interrupt_host(int active);
/* Initialize PMU registers using board settings */
int board_pmu_init(void);

View File

@@ -179,12 +179,6 @@ void board_i2c_post_init(int port)
}
}
void board_interrupt_host(int active)
{
/* interrupt host by using active low EC_INT signal */
gpio_set_level(GPIO_EC_INT, !active);
}
static void board_startup_hook(void)
{
gpio_set_flags(GPIO_SUSPEND_L, INT_BOTH_PULL_UP);

View File

@@ -146,9 +146,6 @@ enum charging_state;
void configure_board(void);
/* Signal to AP that data is waiting */
void board_interrupt_host(int active);
/* Initialize PMU registers using board settings */
int board_pmu_init(void);

View File

@@ -210,6 +210,15 @@ static void assert_output(int out)
}
}
/**
* Assert host keyboard interrupt line.
*/
static void set_host_interrupt(int active)
{
/* interrupt host by using active low EC_INT signal */
gpio_set_level(GPIO_EC_INT, !active);
}
/* Set up outputs so that we will get an interrupt when any key changed */
void setup_interrupts(void)
{
@@ -441,7 +450,7 @@ static int check_keys_changed(uint8_t *state)
if (check_runtime_keys(state))
return 0;
else if (kb_fifo_add(state) == EC_SUCCESS)
board_interrupt_host(1);
set_host_interrupt(1);
else
CPRINTF("dropped keystroke\n");
}
@@ -619,7 +628,7 @@ static int keyboard_get_scan(struct host_cmd_handler_args *args)
{
kb_fifo_remove(args->response);
if (!kb_fifo_entries)
board_interrupt_host(0);
set_host_interrupt(0);
args->response_size = KB_OUTPUTS;
@@ -668,7 +677,7 @@ void keyboard_send_battery_key()
mutex_lock(&scanning_enabled);
debounced_state[BATTERY_KEY_COL] ^= BATTERY_KEY_ROW_MASK;
if (kb_fifo_add(debounced_state) == EC_SUCCESS)
board_interrupt_host(1);
set_host_interrupt(1);
else
CPRINTF("dropped battery keystroke\n");
mutex_unlock(&scanning_enabled);
@@ -704,7 +713,7 @@ static int command_keyboard_press(int argc, char **argv)
debounced_state[c] &= ~(1 << r);
if (kb_fifo_add(debounced_state) == EC_SUCCESS)
board_interrupt_host(1);
set_host_interrupt(1);
else
ccprintf("dropped keystroke\n");

View File

@@ -55,7 +55,11 @@ struct gpio_info {
extern const struct gpio_info gpio_list[GPIO_COUNT];
/* Macro for signals which don't exist */
#ifdef CHIP_lm4
#define GPIO_SIGNAL_NOT_IMPLEMENTED(name) {name, LM4_GPIO_A, 0, 0, NULL}
#else
#define GPIO_SIGNAL_NOT_IMPLEMENTED(name) {name, GPIO_A, 0, 0, NULL}
#endif
/**
* Pre-initialize GPIOs.