summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2012-05-30 20:56:21 +0000
committerVincent Palatin <vpalatin@chromium.org>2012-05-30 20:59:59 +0000
commit288cae699bdd4437caa583c85dd925678e2d43c8 (patch)
treec88d61213651cf55b7e4ae89c3f3849bf39da89f
parentaad3f858a436bc6c763d4ddf8a49fad6465302da (diff)
downloadchrome-ec-288cae699bdd4437caa583c85dd925678e2d43c8.tar.gz
stm32: use level interrupt instead of edge
Using low level trigger interrupt rather than falling edge is more robust since we avoid detecting glitches or missing interrupts. This is backward compatible with the AP software expecting falling edge. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=chrome-os-partner:8869 TEST=On Daisy, check we can still enter text in U-Boot console and Chrome browser (and check interrupt count increase as expected). Change-Id: Ide2b27f9129173530d137b5d70d998ebd8f8e669
-rw-r--r--board/daisy/board.c7
-rw-r--r--board/daisy/board.h2
-rw-r--r--board/snow/board.c7
-rw-r--r--board/snow/board.h2
-rw-r--r--chip/stm32/keyboard_scan.c4
5 files changed, 11 insertions, 11 deletions
diff --git a/board/daisy/board.c b/board/daisy/board.c
index 56dbef212f..de50e06886 100644
--- a/board/daisy/board.c
+++ b/board/daisy/board.c
@@ -135,11 +135,10 @@ void configure_board(void)
gpio_set_level(GPIO_EC_INT, 1);
}
-void board_interrupt_host(void)
+void board_interrupt_host(int active)
{
- /* interrupt host by toggling EC_INT */
- gpio_set_level(GPIO_EC_INT, 0);
- gpio_set_level(GPIO_EC_INT, 1);
+ /* interrupt host by using active low EC_INT signal */
+ gpio_set_level(GPIO_EC_INT, !active);
}
void board_keyboard_suppress_noise(void)
diff --git a/board/daisy/board.h b/board/daisy/board.h
index 14270d8906..f93355ce21 100644
--- a/board/daisy/board.h
+++ b/board/daisy/board.h
@@ -85,6 +85,6 @@ void matrix_interrupt(enum gpio_signal signal);
void board_keyboard_suppress_noise(void);
/* Signal to AP that data is waiting */
-void board_interrupt_host(void);
+void board_interrupt_host(int active);
#endif /* __BOARD_H */
diff --git a/board/snow/board.c b/board/snow/board.c
index a602fe2ca5..783303cb58 100644
--- a/board/snow/board.c
+++ b/board/snow/board.c
@@ -107,9 +107,8 @@ void configure_board(void)
gpio_set_level(GPIO_EC_INT, 1);
}
-void board_interrupt_host(void)
+void board_interrupt_host(int active)
{
- /* interrupt host by toggling EC_INT */
- gpio_set_level(GPIO_EC_INT, 0);
- gpio_set_level(GPIO_EC_INT, 1);
+ /* interrupt host by using active low EC_INT signal */
+ gpio_set_level(GPIO_EC_INT, !active);
}
diff --git a/board/snow/board.h b/board/snow/board.h
index 0c6d301b9d..0688c74b44 100644
--- a/board/snow/board.h
+++ b/board/snow/board.h
@@ -80,6 +80,6 @@ void configure_board(void);
void matrix_interrupt(enum gpio_signal signal);
/* Signal to AP that data is waiting */
-void board_interrupt_host(void);
+void board_interrupt_host(int active);
#endif /* __BOARD_H */
diff --git a/chip/stm32/keyboard_scan.c b/chip/stm32/keyboard_scan.c
index 3a302969e0..b8051539d5 100644
--- a/chip/stm32/keyboard_scan.c
+++ b/chip/stm32/keyboard_scan.c
@@ -307,7 +307,7 @@ static int check_keys_changed(void)
CPUTS("]\n");
if (kb_fifo_add(raw_state) == EC_SUCCESS)
- board_interrupt_host();
+ board_interrupt_host(1);
else
CPRINTF("dropped keystroke\n");
}
@@ -383,6 +383,8 @@ int keyboard_scan_recovery_pressed(void)
static int keyboard_get_scan(uint8_t *data, int *resp_size)
{
kb_fifo_remove(data);
+ if (!kb_fifo_entries)
+ board_interrupt_host(0);
*resp_size = KB_OUTPUTS;
return EC_RES_SUCCESS;