summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2014-08-20 15:36:27 -0500
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-08-21 08:02:00 +0000
commit97a4fd2751a47189aeb181da9e5a42ed651e5c33 (patch)
treeb75783818bfa276373b61247aa06aa03ac4aa76d
parentf883354bbad138390142fdeaa554f55ee51551ef (diff)
downloadchrome-ec-97a4fd2751a47189aeb181da9e5a42ed651e5c33.tar.gz
power_button: expose raw signal assertion
It's useful to expose the logic of the power button assertion according to the CONFIG active level at the hardware input. Therefore, provide power_button_signal_asserted(). BUG=chrome-os-partner:31481 BRANCH=None TEST=Benson tested this on ryu since has the button cables. Change-Id: Ica48bfe981550700a067406cb72908e14dbccba9 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/213298 Reviewed-by: Alec Berg <alecaberg@chromium.org>
-rw-r--r--common/power_button.c13
-rw-r--r--include/power_button.h6
2 files changed, 17 insertions, 2 deletions
diff --git a/common/power_button.c b/common/power_button.c
index 7d7e90b86d..ffa93d1027 100644
--- a/common/power_button.c
+++ b/common/power_button.c
@@ -31,6 +31,16 @@ static int debounced_power_pressed; /* Debounced power button state */
static int simulate_power_pressed;
/**
+ * Return non-zero if power button signal asserted at hardware input.
+ *
+ */
+int power_button_signal_asserted(void)
+{
+ return !!(gpio_get_level(GPIO_POWER_BUTTON_L)
+ == CONFIG_POWER_BUTTON_ACTIVE_STATE);
+}
+
+/**
* Get raw power button signal state.
*
* @return 1 if power button is pressed, 0 if not pressed.
@@ -50,8 +60,7 @@ static int raw_power_button_pressed(void)
return 0;
#endif
- return !!(gpio_get_level(GPIO_POWER_BUTTON_L)
- == CONFIG_POWER_BUTTON_ACTIVE_STATE);
+ return power_button_signal_asserted();
}
int power_button_is_pressed(void)
diff --git a/include/power_button.h b/include/power_button.h
index 190073812e..ce9f63e216 100644
--- a/include/power_button.h
+++ b/include/power_button.h
@@ -18,6 +18,12 @@
int power_button_is_pressed(void);
/**
+ * Return non-zero if power button signal asserted at hardware input.
+ *
+ */
+int power_button_signal_asserted(void);
+
+/**
* Interrupt handler for power button.
*
* @param signal Signal which triggered the interrupt.