diff options
author | Denis Brockus <dbrockus@chromium.org> | 2019-08-12 09:23:33 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-08-14 14:21:29 +0000 |
commit | b4348c2104746ab98d6081fb38216bb3b8fa1a82 (patch) | |
tree | 34101142df95b024ea29f2a062c9318f179d282c /power | |
parent | c48c1b89f893caa2d064a9f8fc20062a997701ef (diff) | |
download | chrome-ec-b4348c2104746ab98d6081fb38216bb3b8fa1a82.tar.gz |
Trembyle: Add chipset_handle_espi_reset_assert code
Added code for chipset_handle_espi_reset_assert.
Fixed a couple #ifdef conditions using IS_ENABLED
BUG=b:138600676
BRANCH=none
TEST=make buildall -j
Change-Id: I937ba3522d268b9151a4ed5134425e8b6a03796a
Signed-off-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1750801
Reviewed-by: Keith Short <keithshort@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
Diffstat (limited to 'power')
-rw-r--r-- | power/stoney.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/power/stoney.c b/power/stoney.c index a01c56819e..9bbfc75d33 100644 --- a/power/stoney.c +++ b/power/stoney.c @@ -67,16 +67,29 @@ void chipset_reset(enum chipset_reset_reason reason) void chipset_throttle_cpu(int throttle) { CPRINTS("%s(%d)", __func__, throttle); -#ifdef CONFIG_CPU_PROCHOT_ACTIVE_LOW - throttle = !throttle; -#endif /* CONFIG_CPU_PROCHOT_ACTIVE_LOW */ + if (IS_ENABLED(CONFIG_CPU_PROCHOT_ACTIVE_LOW)) + throttle = !throttle; + if (chipset_in_state(CHIPSET_STATE_ON)) gpio_set_level(GPIO_CPU_PROCHOT, throttle); } -/* TODO: Create the real chipset_handle_espi_reset_assert function */ void chipset_handle_espi_reset_assert(void) { + /* + * eSPI_Reset# pin being asserted without RSMRST# being asserted + * means there is an unexpected power loss (global reset event). + * In this case, check if the shutdown is forced by the EC (due + * to battery, thermal, or console command). The forced shutdown + * initiates a power button press that we need to release. + * + * NOTE: S5_PGOOD input is passed through to the RSMRST# output to + * the AP. + */ + if ((power_get_signals() & IN_S5_PGOOD) && forcing_shutdown) { + power_button_pch_release(); + forcing_shutdown = 0; + } } enum power_state power_chipset_init(void) @@ -157,13 +170,12 @@ enum power_state power_handle_state(enum power_state state) /* Enable system power ("*_A" rails) in S5. */ gpio_set_level(GPIO_EN_PWR_A, 1); -#ifdef CONFIG_CHIPSET_HAS_PRE_INIT_CALLBACK /* * Callback to do pre-initialization within the context of * chipset task. */ - chipset_pre_init_callback(); -#endif + if (IS_ENABLED(CONFIG_CHIPSET_HAS_PRE_INIT_CALLBACK)) + chipset_pre_init_callback(); if (power_wait_signals(IN_S5_PGOOD)) { chipset_force_g3(); |