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>
This commit is contained in:
Aaron Durbin
2014-08-20 15:36:27 -05:00
committed by chrome-internal-fetch
parent f883354bba
commit 97a4fd2751
2 changed files with 17 additions and 2 deletions

View File

@@ -30,6 +30,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.
*
@@ -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)

View File

@@ -17,6 +17,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.
*