diff options
author | Patryk Duda <pdk@semihalf.com> | 2020-11-10 15:46:55 +0100 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-11-17 17:54:57 +0000 |
commit | 8ba81426bbc4030e1fa93e13f294fb3526a0d4de (patch) | |
tree | 09b7b90f5dac38b45656bbd373d75db76ed4255f /include/i2c.h | |
parent | d5be226d97ca76c4cd4ba7d51ced44950b284a37 (diff) | |
download | chrome-ec-8ba81426bbc4030e1fa93e13f294fb3526a0d4de.tar.gz |
mkbp_event: Always mark MKBP interrupt as inactive before setting it again
This patch fixes issue with sensors data not flowing to the AP
after ChromeOS reboot.
Issue occurs when ChromeOS doesn't disable sensor FIFO interrupt.
During ChromeOS reboot, EC sends MKBP event to host, but event can't be
served. Hook task calls force_mkbp_if_events(), scheduled by
activate_mkbp_with_events(). Called function sets state.interrupt to
INTERRUPT_INACTIVE and calls active_mkbp_with_events() to set MKBP
interrupt again (again force_mkbp_if_events() is scheduled). This is
repeated 2 times only (limited by state.failed_attempts).
After 3 attempts to generate MKBP interrupt force_mkbp_if_events()
function is not changing state.interrupt to INTERRUPT_INACTIVE. As a
result calling activate_mkbp_with_events() doesn't set MKBP interrupt
and doesn't schedule force_mkbp_if_events() to be called by hook task.
When ChromeOS is running, EC is not able to send MKBP interrupt again,
because it is blocked by INTERRUPT_ACTIVE state. The only way to change
interrupt state is call EC_CMD_GET_NEXT_EVENT host command which will
eventually call set_inactive_if_no_events(). This host command is called
by host only when it receives MKBP interrupt.
This patch fixes vicious circle by setting state.interrupt to
INTERRUPT_INACTIVE in force_mkbp_if_events() always and calling
activate_mkbp_with_events() only when failed_attempts counter doesn't
exceed limit.
It is safe to mark interrupt state as INACTIVE, because
force_mkbp_with_events() function can be only scheduled by
activate_mkbp_with_event() which will set interrupt state to ACTIVE (if
there are still events waiting). Furthermore, failed_attempts counter is
only reset when AP actually pulls all of the events or number of
attempts is exceeded.
BUG=b:162254118
BRANCH=none
TEST=Flash EC ToT on eve. Boot ChromeOS then reboot it.
Switch to developer console and check if sensors
works by calling following command:
'local_test_runner -waituntilready false hardware.SensorRing'
Signed-off-by: Patryk Duda <pdk@semihalf.com>
Change-Id: Ic6acf44770aba8d5d00f070de256751128171205
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2527171
Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'include/i2c.h')
0 files changed, 0 insertions, 0 deletions