diff options
author | Nick Vaccaro <nvaccaro@chromium.org> | 2017-05-04 20:17:42 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2018-04-03 10:14:50 +0000 |
commit | 4e3d2579bc4d7ad82cb87e955da666af38ba12b8 (patch) | |
tree | a4614a3ad180d755360fa1f4036e74868f9b5de2 | |
parent | a49f19a1aa9ad3f4951490f96f0320fa646b572e (diff) | |
download | chrome-ec-4e3d2579bc4d7ad82cb87e955da666af38ba12b8.tar.gz |
common: allow report disabling of host events
Adds a mechanism that allows a board to disable interrupting the AP /
kernel when the status of any one of the EC_HOST_EVENTS included in
CONFIG_HOST_EVENT_REPORT_MASK changes state. Default state enables
reporting of all events; a board can override this by defining
CONFIG_HOST_EVENT_REPORT_MASK in its board.h file.
NOTE: The host_set_events() and host_clear_events() routines no longer
interrupt the AP if none of the host events the AP is interested in
changed state.
BRANCH=none
BUG=chromium:637061
TEST=make buildall passes
Change-Id: Ifbea6a76a13c56c3f499d193ee39dc5fee7ca977
Signed-off-by: Nick Vaccaro <nvaccaro@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/502078
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
(cherry picked from commit e9215ba711d337e4cfc9524c4ef07b03a813c8fb)
Reviewed-on: https://chromium-review.googlesource.com/989860
Reviewed-by: Joel Kitching <kitching@chromium.org>
Commit-Queue: Joel Kitching <kitching@chromium.org>
Tested-by: Joel Kitching <kitching@chromium.org>
Trybot-Ready: Joel Kitching <kitching@chromium.org>
-rw-r--r-- | common/host_event_commands.c | 22 | ||||
-rw-r--r-- | include/config.h | 4 |
2 files changed, 19 insertions, 7 deletions
diff --git a/common/host_event_commands.c b/common/host_event_commands.c index 0364474de0..1dc9ac5c0c 100644 --- a/common/host_event_commands.c +++ b/common/host_event_commands.c @@ -40,9 +40,14 @@ uint32_t host_get_events(void) void host_set_events(uint32_t mask) { - /* Only print if something's about to change */ - if ((events & mask) != mask || (events_copy_b & mask) != mask) - CPRINTS("event set 0x%08x", mask); + /* ignore host events the rest of board doesn't care about */ + mask &= CONFIG_HOST_EVENT_REPORT_MASK; + + /* exit now if nothing has changed */ + if (!((events & mask) != mask || (events_copy_b & mask) != mask)) + return; + + CPRINTS("event set 0x%08x", mask); atomic_or(&events, mask); atomic_or(&events_copy_b, mask); @@ -62,9 +67,14 @@ void host_set_events(uint32_t mask) void host_clear_events(uint32_t mask) { - /* Only print if something's about to change */ - if (events & mask) - CPRINTS("event clear 0x%08x", mask); + /* ignore host events the rest of board doesn't care about */ + mask &= CONFIG_HOST_EVENT_REPORT_MASK; + + /* return early if nothing changed */ + if (!(events & mask)) + return; + + CPRINTS("event clear 0x%08x", mask); atomic_clear(&events, mask); diff --git a/include/config.h b/include/config.h index 415cba7b21..ccf4f2c84b 100644 --- a/include/config.h +++ b/include/config.h @@ -1261,7 +1261,6 @@ #undef CONFIG_GESTURE_SIGMO_EVENT - /* Do we want to detect the lid angle? */ #undef CONFIG_LID_ANGLE @@ -1328,6 +1327,9 @@ */ #undef CONFIG_HOST_COMMAND_STATUS +/* clear bit(s) to mask reporting of an EC_HOST_EVENT_XXX event(s) */ +#define CONFIG_HOST_EVENT_REPORT_MASK 0xffffffff + /* * The host commands are sorted in the .rodata.hcmds section so use the binary * search algorithm to match a command to its handler |