diff options
author | Andrew McRae <amcrae@google.com> | 2022-09-06 23:56:25 +1000 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-09-07 06:13:42 +0000 |
commit | 67ba4e94f2d5fb51f569e1c6b7a2d8c58b1192fc (patch) | |
tree | 596d39e331acb884530d9cc2629f0b985d4df57c /common | |
parent | 3c6192a56789f76d83676d797710eb53b3a577ac (diff) | |
download | chrome-ec-67ba4e94f2d5fb51f569e1c6b7a2d8c58b1192fc.tar.gz |
lid: Only change the lid state when forcing open
Force the lid state only when it is being changed.
When the system starts, it always sends a message to disable
the forced lid open. However if the EC command lidclose has been
run, disabling the forced lid open will read the actual lid status
from the GPIO, possibly overriding the state set by lidclose.
BUG=b:244082750
TEST=Pass firmware.ECLidSwitch.close_lid_to_shutdown
BRANCH=none
Signed-off-by: Andrew McRae <amcrae@google.com>
Change-Id: I10595e45e5055422c1c8ce66d8271c96749848ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3877883
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Reviewed-by: Peter Marheine <pmarheine@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/lid_switch.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/common/lid_switch.c b/common/lid_switch.c index c566a38fc7..9b355b9cb4 100644 --- a/common/lid_switch.c +++ b/common/lid_switch.c @@ -161,12 +161,14 @@ DECLARE_CONSOLE_COMMAND(lidstate, command_lidstate, NULL, "Get state of lid"); static enum ec_status hc_force_lid_open(struct host_cmd_handler_args *args) { const struct ec_params_force_lid_open *p = args->params; + int old_state = forced_lid_open; /* Override lid open if necessary */ forced_lid_open = p->enabled ? 1 : 0; /* Make this take effect immediately; no debounce time */ - hook_call_deferred(&lid_change_deferred_data, 0); + if (forced_lid_open != old_state) + hook_call_deferred(&lid_change_deferred_data, 0); return EC_RES_SUCCESS; } |