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
This commit is contained in:
Simon Glass
2012-04-07 22:09:08 -07:00
parent e581c9e4ca
commit c7f8239afd
2 changed files with 24 additions and 0 deletions

View File

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

View File

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