diff options
author | Simon Glass <sjg@chromium.org> | 2012-04-07 22:09:08 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2012-04-12 09:13:56 -0700 |
commit | c7f8239afda4798d9e435be2ffb11511b19a43fa (patch) | |
tree | e436c202e0a75403ea93626630a0ed24551bdb24 /board | |
parent | e581c9e4caa2d6a5190a4542e8f8541f2eeb9d9a (diff) | |
download | chrome-ec-c7f8239afda4798d9e435be2ffb11511b19a43fa.tar.gz |
daisy: Provide an interrupt function for keyboard scan
Provide a function which is called when keyboard scan data is ready,
and make it do the right thing.
BUG=chromium-os:28925
TEST=build on daisy and discovery; run on daisy
Signed-off-by: Simon Glass <sjg@chromium.org>
Change-Id: I0089a7ff78ba035ba6648220ae2e03a958d444d8
Diffstat (limited to 'board')
-rw-r--r-- | board/daisy/board.c | 21 | ||||
-rw-r--r-- | board/daisy/board.h | 3 |
2 files changed, 24 insertions, 0 deletions
diff --git a/board/daisy/board.c b/board/daisy/board.c index 3792139276..a30913fc1a 100644 --- a/board/daisy/board.c +++ b/board/daisy/board.c @@ -11,6 +11,20 @@ #include "registers.h" #include "util.h" +/* + * Daisy keyboard summary: + * 1. KEYSCAN task woken up via GPIO external interrupt when a key is pressed. + * 2. The task scans the keyboard matrix for changes. If key state has + * changed, the board-specific kb_send() function is called. + * 3. For Daisy, the EC is connected via I2C and acts as a slave, so the AP + * must initiate all transactions. EC_INT is driven low to interrupt AP when + * new data becomes available. + * 4. When the AP is interrupted, it initiates two i2c transactions: + * 1. 1-byte write: AP writes 0x01 to make EC send keyboard state. + * 2. 14-byte read: AP reads 1 keyboard packet (13 byte keyboard state + + * 1-byte checksum). + */ + /* GPIO interrupt handlers prototypes */ void gaia_power_event(enum gpio_signal signal); @@ -53,3 +67,10 @@ void configure_board(void) /* Select Alternate function for USART1 on pins PA9/PA10 */ gpio_set_alternate_function(GPIO_A, (1<<9) | (1<<10), GPIO_ALT_USART); } + +void board_keyboard_scan_ready(void) +{ + /* interrupt host by toggling EC_INT */ + gpio_set_level(GPIO_EC_INT, 0); + gpio_set_level(GPIO_EC_INT, 1); +} diff --git a/board/daisy/board.h b/board/daisy/board.h index 8af5e01398..284644a435 100644 --- a/board/daisy/board.h +++ b/board/daisy/board.h @@ -51,4 +51,7 @@ void configure_board(void); void matrix_interrupt(enum gpio_signal signal); +/* Signal to the AP that keyboard scan data is available */ +void board_keyboard_scan_ready(void); + #endif /* __BOARD_H */ |