summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWai-Hong Tam <waihong@google.com>2018-08-03 17:02:18 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-08-31 05:22:49 -0700
commit1d4471de578c799d9428f78fe3ce3fee6246daef (patch)
tree70d242e2ebb81668a7c3f82eaad2aec7d3b69350
parent9285db3f7d3fd50743df80b0dd1e28da46b5d2e1 (diff)
downloadchrome-ec-1d4471de578c799d9428f78fe3ce3fee6246daef.tar.gz
Revert "cheza: Support confirmation of power lost"
This reverts commit 548e4d9708cc4402497ed290daf4df672114302c. The following CL uses the POWER_GOOD signal as an indicator, instead of the AP_RST_L which has a short low pulse during warm reset. So revert the confirmation logic for the AP_RST_L. BRANCH=none BUG=b:78455067 TEST=Check the following CL. Change-Id: Iec0a7592f8dd1686b1bce8304b42ad0407b6dfde Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/1169952 Reviewed-by: Stephen Boyd <swboyd@chromium.org>
-rw-r--r--board/cheza/gpio.inc2
-rw-r--r--include/chipset.h9
-rw-r--r--power/sdm845.c53
3 files changed, 3 insertions, 61 deletions
diff --git a/board/cheza/gpio.inc b/board/cheza/gpio.inc
index d9e4aafb38..9a33e47179 100644
--- a/board/cheza/gpio.inc
+++ b/board/cheza/gpio.inc
@@ -28,7 +28,7 @@ GPIO_INT(WP_L, PIN(A, 1), GPIO_INT_BOTH, switch_interrupt) /* EC_W
GPIO_INT(LID_OPEN, PIN(D, 2), GPIO_INT_BOTH, lid_interrupt) /* LID_OPEN_EC */
GPIO_INT(AP_RST_REQ, PIN(C, 2), GPIO_INT_RISING | GPIO_PULL_DOWN | GPIO_SEL_1P8V, chipset_reset_request_interrupt) /* Reset request from AP */
/* AP_RST_L and PS_HOLD are used for PMIC and AP negotiation. Don't change their states. */
-GPIO_INT(AP_RST_L, PIN(C, 1), GPIO_INT_BOTH | GPIO_SEL_1P8V, chipset_power_signal_interrupt)
+GPIO_INT(AP_RST_L, PIN(C, 1), GPIO_INT_BOTH | GPIO_SEL_1P8V, power_signal_interrupt)
GPIO_INT(PS_HOLD, PIN(D, 4), GPIO_INT_BOTH | GPIO_SEL_1P8V, power_signal_interrupt) /* Indicate when AP triggers reset/shutdown */
GPIO_INT(PMIC_FAULT_L, PIN(7, 6), GPIO_INT_BOTH | GPIO_SEL_1P8V, power_signal_interrupt) /* Any PMIC fault? */
GPIO_INT(POWER_GOOD, PIN(5, 4), GPIO_INT_BOTH | GPIO_SEL_1P8V, power_signal_interrupt) /* SRC_PP1800_S4A from PMIC */
diff --git a/include/chipset.h b/include/chipset.h
index 5e51e5991a..0e568dccd6 100644
--- a/include/chipset.h
+++ b/include/chipset.h
@@ -194,15 +194,6 @@ void chipset_handle_reboot(void);
*/
void chipset_reset_request_interrupt(enum gpio_signal signal);
-/**
- * Chipset-specific power signal interrupt, overrides the default one.
- *
- * It is used in SDM845, to handle the short-low-pulse during the reset
- * sequence which we don't consider it as a power-lost.
- */
-void chipset_power_signal_interrupt(enum gpio_signal signal);
-
-
#ifdef CONFIG_CMD_AP_RESET_LOG
/**
diff --git a/power/sdm845.c b/power/sdm845.c
index 878bd24737..73b18dbe34 100644
--- a/power/sdm845.c
+++ b/power/sdm845.c
@@ -79,9 +79,6 @@
/* Delay between power-off the system and all things (PMIC/AP) expected off */
#define SYSTEM_POWER_OFF_DELAY (350 * MSEC)
-/* Delay to confirm the power lost */
-#define POWER_LOST_CONFIRM_DELAY (350 * MSEC)
-
/* TODO(crosbug.com/p/25047): move to HOOK_POWER_BUTTON_CHANGE */
/* 1 if the power button was pressed last time we checked */
static char power_button_was_pressed;
@@ -97,9 +94,6 @@ static char lid_opened;
*/
static uint8_t bypass_power_lost_trigger;
-/* The timestamp of the latest power lost */
-static timestamp_t latest_power_lost_time;
-
/* Time where we will power off, if power button still held down */
static timestamp_t power_off_deadline;
@@ -156,49 +150,6 @@ void chipset_reset_request_interrupt(enum gpio_signal signal)
hook_call_deferred(&chipset_reset_request_handler_data, 0);
}
-/* Confirm power lost if the POWER_GOOD signal keeps low for a while */
-static uint32_t chipset_is_power_lost(void)
-{
- /*
- * Current POWER_GOOD signal is lost and the latest power lost trigger
- * happened before the confirmation delay.
- */
- return (get_time().val - latest_power_lost_time.val >=
- POWER_LOST_CONFIRM_DELAY) && !power_has_signals(IN_POWER_GOOD);
-}
-
-/* The deferred handler to save the power signal */
-static void deferred_power_signal_handler(void)
-{
- /* Wake the chipset task to check the power lost duration */
- task_wake(TASK_ID_CHIPSET);
-}
-DECLARE_DEFERRED(deferred_power_signal_handler);
-
-/**
- * Power signal interrupt, overrides the default one.
- *
- * It handles the short-low-pulse during the reset sequence which we don't
- * consider it as a power-lost.
- */
-void chipset_power_signal_interrupt(enum gpio_signal signal)
-{
- /* Call the default power signal interrupt */
- power_signal_interrupt(signal);
-
- /*
- * It is the start of the low pulse, save the timestamp, wake the
- * chipset task after POWER_LOST_CONFIRM_DELAY in order to check if it
- * is a power-lost or a reset (short low-pulse).
- */
- if (!(power_get_signals() & IN_POWER_GOOD)) {
- /* Keep the timestamp just at the low pulse happens. */
- latest_power_lost_time = get_time();
- hook_call_deferred(&deferred_power_signal_handler_data,
- POWER_LOST_CONFIRM_DELAY);
- }
-}
-
static void sdm845_lid_event(void)
{
/* Power task only cares about lid-open events */
@@ -610,8 +561,8 @@ static int check_for_power_off_event(void)
power_button_was_pressed = pressed;
- /* Power lost: shutdown immediately */
- if (chipset_is_power_lost() && !bypass_power_lost_trigger) {
+ /* POWER_GOOD released by AP : shutdown immediately */
+ if (!power_has_signals(IN_POWER_GOOD) && !bypass_power_lost_trigger) {
if (power_button_was_pressed)
timer_cancel(TASK_ID_CHIPSET);