summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/daisy/board.c21
-rw-r--r--board/daisy/board.h3
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 */