summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-03-19 13:11:17 -0700
committerChromeBot <chrome-bot@google.com>2013-03-19 14:59:32 -0700
commit24f0d888dd8110f7f0448b9dbeb47c13f5b1e298 (patch)
treec981f177484f8c80cb37b5c2798178d5449b01a8
parenta3c2a73226dd558d4c9f0b5827b7db946885f395 (diff)
downloadchrome-ec-24f0d888dd8110f7f0448b9dbeb47c13f5b1e298.tar.gz
Use common declaration of keyboard_scan_interrupt()
Code cleanup: declare keyboard_scan_interrupt() once, not per board; the implementation is common anyway. No functional changes; just renaming. BUG=none BRANCH=none TEST=build daisy,snow,spring,mccrosskey Change-Id: I1e33cbe2c868bc47b641d36d26f07c3b5a7ba3c7 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/45874 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r--board/daisy/board.c28
-rw-r--r--board/daisy/board.h2
-rw-r--r--board/mccroskey/board.c27
-rw-r--r--board/mccroskey/board.h2
-rw-r--r--board/snow/board.c29
-rw-r--r--board/snow/board.h2
-rw-r--r--board/spring/board.c29
-rw-r--r--board/spring/board.h2
-rw-r--r--chip/stm32/keyboard_scan.c2
-rw-r--r--include/keyboard_scan.h36
10 files changed, 99 insertions, 60 deletions
diff --git a/board/daisy/board.c b/board/daisy/board.c
index f66f276b92..5bf79de277 100644
--- a/board/daisy/board.c
+++ b/board/daisy/board.c
@@ -9,6 +9,7 @@
#include "extpower.h"
#include "gpio.h"
#include "i2c.h"
+#include "keyboard_scan.h"
#include "pmu_tpschrome.h"
#include "registers.h"
#include "spi.h"
@@ -42,9 +43,6 @@ void gaia_lid_event(enum gpio_signal signal);
#define gaia_suspend_event NULL
#define gaia_lid_event NULL
#endif
-#ifndef CONFIG_TASK_KEYSCAN
-#define matrix_interrupt NULL
-#endif
/* GPIO signal list. Must match order from enum gpio_signal. */
const struct gpio_info gpio_list[GPIO_COUNT] = {
@@ -55,14 +53,22 @@ const struct gpio_info gpio_list[GPIO_COUNT] = {
{"CHARGER_INT", GPIO_C, (1<<4), GPIO_INT_RISING, NULL},
{"LID_OPEN", GPIO_C, (1<<13), GPIO_INT_RISING, gaia_lid_event},
{"SUSPEND_L", GPIO_A, (1<<7), GPIO_INT_BOTH, gaia_suspend_event},
- {"KB_IN00", GPIO_C, (1<<8), GPIO_KB_INPUT, matrix_interrupt},
- {"KB_IN01", GPIO_C, (1<<9), GPIO_KB_INPUT, matrix_interrupt},
- {"KB_IN02", GPIO_C, (1<<10), GPIO_KB_INPUT, matrix_interrupt},
- {"KB_IN03", GPIO_C, (1<<11), GPIO_KB_INPUT, matrix_interrupt},
- {"KB_IN04", GPIO_C, (1<<12), GPIO_KB_INPUT, matrix_interrupt},
- {"KB_IN05", GPIO_C, (1<<14), GPIO_KB_INPUT, matrix_interrupt},
- {"KB_IN06", GPIO_C, (1<<15), GPIO_KB_INPUT, matrix_interrupt},
- {"KB_IN07", GPIO_D, (1<<2), GPIO_KB_INPUT, matrix_interrupt},
+ {"KB_IN00", GPIO_C, (1<<8), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
+ {"KB_IN01", GPIO_C, (1<<9), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
+ {"KB_IN02", GPIO_C, (1<<10), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
+ {"KB_IN03", GPIO_C, (1<<11), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
+ {"KB_IN04", GPIO_C, (1<<12), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
+ {"KB_IN05", GPIO_C, (1<<14), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
+ {"KB_IN06", GPIO_C, (1<<15), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
+ {"KB_IN07", GPIO_D, (1<<2), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
/* Other inputs */
{"AC_PWRBTN_L", GPIO_A, (1<<0), GPIO_INT_BOTH, NULL},
{"SPI1_NSS", GPIO_A, (1<<4), GPIO_PULL_UP, NULL},
diff --git a/board/daisy/board.h b/board/daisy/board.h
index 0e342b19b9..1007a85b35 100644
--- a/board/daisy/board.h
+++ b/board/daisy/board.h
@@ -110,8 +110,6 @@ enum gpio_signal {
void configure_board(void);
-void matrix_interrupt(enum gpio_signal signal);
-
/* Signal to the AP that keyboard scan data is available */
void board_keyboard_suppress_noise(void);
diff --git a/board/mccroskey/board.c b/board/mccroskey/board.c
index b6d7de815a..84503799ca 100644
--- a/board/mccroskey/board.c
+++ b/board/mccroskey/board.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,6 +11,7 @@
#include "gpio.h"
#include "hooks.h"
#include "i2c.h"
+#include "keyboard_scan.h"
#include "registers.h"
#include "spi.h"
#include "task.h"
@@ -28,14 +29,22 @@ static void kbd_power_on(enum gpio_signal signal);
/* GPIO signal list. Must match order from enum gpio_signal. */
const struct gpio_info gpio_list[GPIO_COUNT] = {
/* Inputs with interrupt handlers are first for efficiency */
- {"KB_IN00", GPIO_B, (1<<8), GPIO_KB_INPUT, matrix_interrupt},
- {"KB_IN01", GPIO_B, (1<<9), GPIO_KB_INPUT, matrix_interrupt},
- {"KB_IN02", GPIO_B, (1<<10), GPIO_KB_INPUT, matrix_interrupt},
- {"KB_IN03", GPIO_B, (1<<11), GPIO_KB_INPUT, matrix_interrupt},
- {"KB_IN04", GPIO_B, (1<<12), GPIO_KB_INPUT, matrix_interrupt},
- {"KB_IN05", GPIO_B, (1<<13), GPIO_KB_INPUT, matrix_interrupt},
- {"KB_IN06", GPIO_B, (1<<14), GPIO_KB_INPUT, matrix_interrupt},
- {"KB_IN07", GPIO_B, (1<<15), GPIO_KB_INPUT, matrix_interrupt},
+ {"KB_IN00", GPIO_B, (1<<8), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
+ {"KB_IN01", GPIO_B, (1<<9), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
+ {"KB_IN02", GPIO_B, (1<<10), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
+ {"KB_IN03", GPIO_B, (1<<11), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
+ {"KB_IN04", GPIO_B, (1<<12), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
+ {"KB_IN05", GPIO_B, (1<<13), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
+ {"KB_IN06", GPIO_B, (1<<14), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
+ {"KB_IN07", GPIO_B, (1<<15), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
{"KBD_PWR_BUTTON", GPIO_B, (1<<2), GPIO_INPUT, kbd_power_on},
{"OMZO_RDY_L", GPIO_A, (1<<0), GPIO_INPUT, NULL}, /* PA0_WKUP */
diff --git a/board/mccroskey/board.h b/board/mccroskey/board.h
index 28ce13444e..239c6f9ba9 100644
--- a/board/mccroskey/board.h
+++ b/board/mccroskey/board.h
@@ -115,8 +115,6 @@ enum gpio_signal {
void configure_board(void);
-void matrix_interrupt(enum gpio_signal signal);
-
/* FIXME: this should not be needed on mccroskey. */
void board_interrupt_host(int active);
diff --git a/board/snow/board.c b/board/snow/board.c
index 03867296c4..3964f15f3a 100644
--- a/board/snow/board.c
+++ b/board/snow/board.c
@@ -12,6 +12,7 @@
#include "gpio.h"
#include "hooks.h"
#include "i2c.h"
+#include "keyboard_scan.h"
#include "pmu_tpschrome.h"
#include "power_led.h"
#include "registers.h"
@@ -39,10 +40,6 @@ void gaia_lid_event(enum gpio_signal signal);
#define gaia_lid_event NULL
#endif
-#ifndef CONFIG_TASK_KEYSCAN
-#define matrix_interrupt NULL
-#endif
-
/* GPIO signal list. Must match order from enum gpio_signal. */
const struct gpio_info gpio_list[GPIO_COUNT] = {
/* Inputs with interrupt handlers are first for efficiency */
@@ -53,14 +50,22 @@ const struct gpio_info gpio_list[GPIO_COUNT] = {
{"LID_OPEN", GPIO_C, (1<<13), GPIO_INT_RISING, gaia_lid_event},
{"SUSPEND_L", GPIO_A, (1<<7), INT_BOTH_FLOATING, gaia_suspend_event},
{"WP_L", GPIO_B, (1<<4), GPIO_INPUT, NULL},
- {"KB_IN00", GPIO_C, (1<<8), GPIO_KB_INPUT, matrix_interrupt},
- {"KB_IN01", GPIO_C, (1<<9), GPIO_KB_INPUT, matrix_interrupt},
- {"KB_IN02", GPIO_C, (1<<10), GPIO_KB_INPUT, matrix_interrupt},
- {"KB_IN03", GPIO_C, (1<<11), GPIO_KB_INPUT, matrix_interrupt},
- {"KB_IN04", GPIO_C, (1<<12), GPIO_KB_INPUT, matrix_interrupt},
- {"KB_IN05", GPIO_C, (1<<14), GPIO_KB_INPUT, matrix_interrupt},
- {"KB_IN06", GPIO_C, (1<<15), GPIO_KB_INPUT, matrix_interrupt},
- {"KB_IN07", GPIO_D, (1<<2), GPIO_KB_INPUT, matrix_interrupt},
+ {"KB_IN00", GPIO_C, (1<<8), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
+ {"KB_IN01", GPIO_C, (1<<9), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
+ {"KB_IN02", GPIO_C, (1<<10), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
+ {"KB_IN03", GPIO_C, (1<<11), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
+ {"KB_IN04", GPIO_C, (1<<12), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
+ {"KB_IN05", GPIO_C, (1<<14), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
+ {"KB_IN06", GPIO_C, (1<<15), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
+ {"KB_IN07", GPIO_D, (1<<2), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
/* Other inputs */
{"AC_PWRBTN_L", GPIO_A, (1<<0), GPIO_INT_BOTH, NULL},
{"SPI1_NSS", GPIO_A, (1<<4), GPIO_DEFAULT, spi_event},
diff --git a/board/snow/board.h b/board/snow/board.h
index 448b3bb17b..89e77e4f0c 100644
--- a/board/snow/board.h
+++ b/board/snow/board.h
@@ -124,8 +124,6 @@ void configure_board(void);
void configure_board_late(void);
-void matrix_interrupt(enum gpio_signal signal);
-
/* Signal to AP that data is waiting */
void board_interrupt_host(int active);
diff --git a/board/spring/board.c b/board/spring/board.c
index 963ed5492b..227fc10f10 100644
--- a/board/spring/board.c
+++ b/board/spring/board.c
@@ -14,6 +14,7 @@
#include "hooks.h"
#include "host_command.h"
#include "i2c.h"
+#include "keyboard_scan.h"
#include "lp5562.h"
#include "pmu_tpschrome.h"
#include "registers.h"
@@ -56,10 +57,6 @@ void gaia_lid_event(enum gpio_signal signal);
#define gaia_lid_event NULL
#endif
-#ifndef CONFIG_TASK_KEYSCAN
-#define matrix_interrupt NULL
-#endif
-
void usb_charge_interrupt(enum gpio_signal signal);
/* GPIO signal list. Must match order from enum gpio_signal. */
@@ -72,14 +69,22 @@ const struct gpio_info gpio_list[GPIO_COUNT] = {
{"LID_OPEN", GPIO_C, (1<<13), GPIO_INT_RISING, gaia_lid_event},
{"SUSPEND_L", GPIO_A, (1<<7), INT_BOTH_FLOATING, gaia_suspend_event},
{"WP_L", GPIO_A, (1<<13), GPIO_INPUT, NULL},
- {"KB_IN00", GPIO_C, (1<<8), GPIO_KB_INPUT, matrix_interrupt},
- {"KB_IN01", GPIO_C, (1<<9), GPIO_KB_INPUT, matrix_interrupt},
- {"KB_IN02", GPIO_C, (1<<10), GPIO_KB_INPUT, matrix_interrupt},
- {"KB_IN03", GPIO_C, (1<<11), GPIO_KB_INPUT, matrix_interrupt},
- {"KB_IN04", GPIO_C, (1<<12), GPIO_KB_INPUT, matrix_interrupt},
- {"KB_IN05", GPIO_C, (1<<14), GPIO_KB_INPUT, matrix_interrupt},
- {"KB_IN06", GPIO_C, (1<<15), GPIO_KB_INPUT, matrix_interrupt},
- {"KB_IN07", GPIO_D, (1<<2), GPIO_KB_INPUT, matrix_interrupt},
+ {"KB_IN00", GPIO_C, (1<<8), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
+ {"KB_IN01", GPIO_C, (1<<9), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
+ {"KB_IN02", GPIO_C, (1<<10), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
+ {"KB_IN03", GPIO_C, (1<<11), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
+ {"KB_IN04", GPIO_C, (1<<12), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
+ {"KB_IN05", GPIO_C, (1<<14), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
+ {"KB_IN06", GPIO_C, (1<<15), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
+ {"KB_IN07", GPIO_D, (1<<2), GPIO_KB_INPUT,
+ keyboard_scan_interrupt},
{"USB_CHG_INT", GPIO_A, (1<<6), GPIO_INT_FALLING,
usb_charge_interrupt},
/* Other inputs */
diff --git a/board/spring/board.h b/board/spring/board.h
index 7c39ac54e4..7a6d4c8f05 100644
--- a/board/spring/board.h
+++ b/board/spring/board.h
@@ -146,8 +146,6 @@ enum charging_state;
void configure_board(void);
-void matrix_interrupt(enum gpio_signal signal);
-
/* Signal to AP that data is waiting */
void board_interrupt_host(int active);
diff --git a/chip/stm32/keyboard_scan.c b/chip/stm32/keyboard_scan.c
index 30b522ee5b..6a9f6cd84c 100644
--- a/chip/stm32/keyboard_scan.c
+++ b/chip/stm32/keyboard_scan.c
@@ -593,7 +593,7 @@ void keyboard_scan_task(void)
}
-void matrix_interrupt(enum gpio_signal signal)
+void keyboard_scan_interrupt(enum gpio_signal signal)
{
task_wake(TASK_ID_KEYSCAN);
}
diff --git a/include/keyboard_scan.h b/include/keyboard_scan.h
index 8bdbd6905c..54e7259c21 100644
--- a/include/keyboard_scan.h
+++ b/include/keyboard_scan.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,8 +9,11 @@
#define __CROS_EC_KEYBOARD_SCAN_H
#include "common.h"
+#include "gpio.h"
-/* Initializes the module. */
+/**
+ * Initializes the module.
+ */
void keyboard_scan_init(void);
/* Key held down at keyboard-controlled reset boot time. */
@@ -21,7 +24,7 @@ enum boot_key {
BOOT_KEY_OTHER = -1, /* None of the above */
};
-/*
+/**
* Return the key held down at boot time in addition to the keyboard-controlled
* reset keys. Returns BOOT_KEY_OTHER if none of the keys specifically checked
* was pressed, or reset was not caused by a keyboard-controlled reset, or if
@@ -29,16 +32,35 @@ enum boot_key {
*/
enum boot_key keyboard_scan_get_boot_key(void);
-/* Return non-zero if recovery key was pressed at boot. */
+/**
+ * Return non-zero if recovery key was pressed at boot.
+ */
int keyboard_scan_recovery_pressed(void);
-/* Clear any saved keyboard state (empty FIFO, etc) */
+/**
+ * Clear any saved keyboard state (empty FIFO, etc).
+ */
void keyboard_clear_state(void);
-/* Enables/disables keyboard matrix scan. */
+/**
+ * Enables/disables keyboard matrix scan.
+ */
void keyboard_enable_scanning(int enable);
-/* Sends KEY_BATTERY keystroke */
+/**
+ * Sends KEY_BATTERY keystroke.
+ */
void keyboard_send_battery_key(void);
+#ifdef CONFIG_TASK_KEYSCAN
+
+/**
+ * Keyboard scan GPIO interrupt.
+ */
+void keyboard_scan_interrupt(enum gpio_signal signal);
+
+#else
+#define keyboard_scan_interrupt NULL
+#endif
+
#endif /* __CROS_EC_KEYBOARD_SCAN_H */