summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-06-26 14:53:03 -0700
committerGerrit <chrome-bot@google.com>2012-06-26 17:01:52 -0700
commit7b155fb8aca5784c3e85f0853869d4add2a099f0 (patch)
tree32c71e36f982ad0814ade2a4e20af02458172d94 /include
parentfb123b48384cdf2eb1c5008324fac6f8d2811e16 (diff)
downloadchrome-ec-7b155fb8aca5784c3e85f0853869d4add2a099f0.tar.gz
Refactor boot key detection
Keyboard scan module now owns the recovery key state on all platforms. And clean up a few comments to linux kernel style BUG=chrome-os-partner:10890 TEST=manual - Power on system. Should boot normally. - Power+Refresh+D. Should turn dev switch on. - Power+Refresh+F. Should turn dev switch off. - Power+Esc. Should reboot system. Power button should power on normally. - Power+Refresh+Esc. Should power on into recovery mode. - Then press power to shut system down. - Power button should power on normally (not back into recovery mode). Change-Id: I4d16e1e8b039efeacbd41e8acec115844bc8457d Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/26147 Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/keyboard_scan.h26
-rw-r--r--include/power_button.h19
2 files changed, 31 insertions, 14 deletions
diff --git a/include/keyboard_scan.h b/include/keyboard_scan.h
index 590f482317..98ff5db826 100644
--- a/include/keyboard_scan.h
+++ b/include/keyboard_scan.h
@@ -13,11 +13,31 @@
/* Initializes the module. */
int keyboard_scan_init(void);
-/* Returns non-zero if recovery key was pressed at boot. Used by st32m-based
- * boards only; lm4-based boards use power_recovery_pressed(). */
+/* Key held down at keyboard-controlled reset boot time. */
+enum boot_key {
+ BOOT_KEY_NONE, /* No keys other than keyboard-controlled reset keys */
+ BOOT_KEY_ESC,
+ BOOT_KEY_D,
+ BOOT_KEY_F,
+ BOOT_KEY_DOWN_ARROW,
+ 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
+ * the state has been cleared by keyboard_scan_clear_boot_key().
+ */
+enum boot_key keyboard_scan_get_boot_key(void);
+
+/* Clear the boot key state. */
+void keyboard_scan_clear_boot_key(void);
+
+/* 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. */
diff --git a/include/power_button.h b/include/power_button.h
index a0bb85635e..7e99690185 100644
--- a/include/power_button.h
+++ b/include/power_button.h
@@ -11,8 +11,10 @@
#include "common.h"
#include "gpio.h"
-/* Interrupt handler for the power button and lid switch. Passed the signal
- * which triggered the interrupt. */
+/*
+ * Interrupt handler for the power button and lid switch. Passed the signal
+ * which triggered the interrupt.
+ */
void power_button_interrupt(enum gpio_signal signal);
/* Power button task */
@@ -21,15 +23,10 @@ void power_button_task(void);
/* Return non-zero if AC power is present. */
int power_ac_present(void);
-/* Return non-zero if lid is open. Uses the debounced lid state, not the raw
- * signal from the GPIO. */
+/*
+ * Return non-zero if lid is open. Uses the debounced lid state, not the raw
+ * signal from the GPIO.
+ */
int power_lid_open_debounced(void);
-/* Return non-zero if the recovery button is pressed. */
-int power_recovery_pressed(void);
-
-/* Set the state of the recovery button. Called by the keyboard scanner at
- * init if the keyboard recovery combo was pressed. */
-void power_set_recovery_pressed(int pressed);
-
#endif /* __CROS_EC_POWER_BUTTON_H */