summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2013-05-08 05:44:52 +0800
committerChromeBot <chrome-bot@google.com>2013-05-08 09:42:57 -0700
commit0c32432fb2ebbdcf718ca7957633bb52c934a134 (patch)
tree7b9e317904fc1ecd6cfa2c187b03ca748d8d3c25
parenta8ac50faa31c4d9ea305ab974384df4e16bc8ac6 (diff)
downloadchrome-ec-0c32432fb2ebbdcf718ca7957633bb52c934a134.tar.gz
spring: Fix a bug that charger task is stuck
When the user powers off the device with power button, the keyscan mutex gets locked by GAIA power task and is never unlocked until next boot. This blocks charger task when it tries to send battery key. Let's not try to do anything with keyscan when the system is off. BUG=None TEST=Power off with power button. Plug/unplug charger and see console output. BRANCH=spring Change-Id: Ic6808bd669f054ba48208566de99e837518274fb Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/50364 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Todd Broch <tbroch@chromium.org>
-rw-r--r--chip/stm32/keyboard_scan.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/chip/stm32/keyboard_scan.c b/chip/stm32/keyboard_scan.c
index 42a74884a8..d719bfe43b 100644
--- a/chip/stm32/keyboard_scan.c
+++ b/chip/stm32/keyboard_scan.c
@@ -689,11 +689,12 @@ void keyboard_enable_scanning(int enable)
void keyboard_send_battery_key()
{
+ /* Add to FIFO only if AP is on or else it will wake from suspend */
+ if (!chipset_in_state(CHIPSET_STATE_ON))
+ return;
mutex_lock(&scanning_enabled);
debounced_state[BATTERY_KEY_COL] ^= BATTERY_KEY_ROW_MASK;
- /* Add to FIFO only if AP is on or else it will wake from suspend */
- if ((chipset_in_state(CHIPSET_STATE_ON)) &&
- kb_fifo_add(debounced_state) == EC_SUCCESS)
+ if (kb_fifo_add(debounced_state) == EC_SUCCESS)
board_interrupt_host(1);
else
CPRINTF("dropped battery keystroke\n");