diff options
author | Duncan Laurie <dlaurie@google.com> | 2017-06-29 07:14:58 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-06-30 03:08:42 -0700 |
commit | bbb759ceaa843f548f90c35d1668e17c8879bad3 (patch) | |
tree | 7e1b84d8cd73740c01d3cad2398666581f16cee4 /include/device_event.h | |
parent | 5e5788f3cac7fecd45072807bb6a79ce2b767961 (diff) | |
download | chrome-ec-bbb759ceaa843f548f90c35d1668e17c8879bad3.tar.gz |
Add support for reporting device events
In order to report specific wake events from differernt devices
add a host command that allows setting device event mask, and
triggering a host event when that device event is set.
This is done as a separate command and mask because we are running
out of host events, and it takes over the unused thermal overload
event that was never used in EC or BIOS.
The first use case for this is platforms that have AP wake events
that go to the EC, for instance devices that use Deep S3 and have
a limited set of wake pins. (such as Eve)
This allows the AP to determine the exact wake source for an event
so it can be logged and acted on by the AP if necessary.
BUG=b:36024430
BRANCH=eve
TEST=manual testing on eve with trackpad and dsp wake events
Change-Id: I48d94014c00dc1dad098ab96af0ddc7860229762
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://chromium-review.googlesource.com/555632
Reviewed-by: Scott Collyer <scollyer@chromium.org>
Diffstat (limited to 'include/device_event.h')
-rw-r--r-- | include/device_event.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/include/device_event.h b/include/device_event.h new file mode 100644 index 0000000000..40d4114b16 --- /dev/null +++ b/include/device_event.h @@ -0,0 +1,44 @@ +/* Copyright (c) 2017 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* Device event module for Chrome EC */ + +#ifndef __CROS_EC_DEVICE_EVENT_H +#define __CROS_EC_DEVICE_EVENT_H + +#include "common.h" +#include "ec_commands.h" + +/** + * Return the raw device event state. + */ +uint32_t device_get_events(void); + +/** + * Set one or more device event bits. + * + * @param mask Event bits to set (use EC_DEVICE_EVENT_MASK()). + */ +void device_set_events(uint32_t mask); + +/** + * Clear one or more device event bits. + * + * @param mask Event bits to clear (use EC_DEVICE_EVENT_MASK()). + * Write 1 to a bit to clear it. + */ +void device_clear_events(uint32_t mask); + +/** + * Set a single device event. + * + * @param event Event to set (EC_DEVICE_EVENT_*). + */ +static inline void device_set_single_event(int event) +{ + device_set_events(EC_DEVICE_EVENT_MASK(event)); +} + +#endif /* __CROS_EC_DEVICE_EVENT_H */ |