diff options
author | Wai-Hong Tam <waihong@google.com> | 2020-03-02 14:36:51 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-03-10 03:09:24 +0000 |
commit | b56e4bd42417aabe3d1a487a66aab78bcb9bc25e (patch) | |
tree | 2e337a278c17e58bd46c0020171f04d2554ca03c /power | |
parent | b3742671427a7ac7a06920a76feab3d947273d2d (diff) | |
download | chrome-ec-b56e4bd42417aabe3d1a487a66aab78bcb9bc25e.tar.gz |
sc7180, sdm845: Clear invalid request on the power-on/off check
The power-on, power-off, and reset request is stored in the same flag.
When a user calls 'apshutdown' in S5, the request is saved. When
another event triggers the power-on sequence, like power button, the
flag was still carried forward and then request to shutdown.
The similar problem also happens on power-off.
Should clear invalid request on the check to avoid this issue.
BRANCH=None
BUG=b:150481751
TEST=Manually tested the scenario:
dut-control power_state:on
dut-control power_state:off
dut-control power_state:off
dut-control power_state:on
Change-Id: Ica6033668845a839f01900e1c98b6c92e0a12bcb
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2083443
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Diffstat (limited to 'power')
-rw-r--r-- | power/sc7180.c | 8 | ||||
-rw-r--r-- | power/sdm845.c | 8 |
2 files changed, 10 insertions, 6 deletions
diff --git a/power/sc7180.c b/power/sc7180.c index 7919218492..046c88d7b0 100644 --- a/power/sc7180.c +++ b/power/sc7180.c @@ -560,12 +560,12 @@ static uint8_t check_for_power_on_event(void) if (power_request == POWER_REQ_ON) { power_request = POWER_REQ_NONE; return POWER_ON_BY_POWER_REQ_ON; - } - - if (power_request == POWER_REQ_RESET) { + } else if (power_request == POWER_REQ_RESET) { power_request = POWER_REQ_NONE; return POWER_ON_BY_POWER_REQ_RESET; } + /* Clear invalid request */ + power_request = POWER_REQ_NONE; /* power on requested at EC startup for recovery */ if (auto_power_on) { @@ -609,6 +609,8 @@ static uint8_t check_for_power_off_event(void) */ return POWER_OFF_BY_POWER_REQ_RESET; } + /* Clear invalid request */ + power_request = POWER_REQ_NONE; /* * Check for power button press. diff --git a/power/sdm845.c b/power/sdm845.c index 85bfa33438..5add75e95a 100644 --- a/power/sdm845.c +++ b/power/sdm845.c @@ -561,12 +561,12 @@ static uint8_t check_for_power_on_event(void) if (power_request == POWER_REQ_ON) { power_request = POWER_REQ_NONE; return POWER_ON_BY_POWER_REQ_ON; - } - - if (power_request == POWER_REQ_RESET) { + } else if (power_request == POWER_REQ_RESET) { power_request = POWER_REQ_NONE; return POWER_ON_BY_POWER_REQ_RESET; } + /* Clear invalid request */ + power_request = POWER_REQ_NONE; /* check if system is already ON */ if (power_get_signals() & IN_POWER_GOOD) { @@ -629,6 +629,8 @@ static uint8_t check_for_power_off_event(void) */ return POWER_OFF_BY_POWER_REQ_RESET; } + /* Clear invalid request */ + power_request = POWER_REQ_NONE; /* * Check for power button press. |