summaryrefslogtreecommitdiffstats
path: root/include/linux/mfd/cros_ec.h
diff options
context:
space:
mode:
authorVic Yang <victoryang@google.com>2016-08-10 19:05:24 +0200
committerLee Jones <lee.jones@linaro.org>2016-08-31 10:50:59 +0100
commit6f1d912b687d3d17c1731f5bda3b5d6703bce4a0 (patch)
treee3a0ad0da285ff23c315a23eb4d00661c7ad16f3 /include/linux/mfd/cros_ec.h
parent694d0d0bb2030d2e36df73e2d23d5770511dbc8d (diff)
downloadlinux-stable-6f1d912b687d3d17c1731f5bda3b5d6703bce4a0.tar.gz
linux-stable-6f1d912b687d3d17c1731f5bda3b5d6703bce4a0.tar.bz2
linux-stable-6f1d912b687d3d17c1731f5bda3b5d6703bce4a0.zip
mfd: cros_ec: Add MKBP event support
Newer revisions of the ChromeOS EC add more events besides the keyboard ones. So handle interrupts in the MFD driver and let consumers register for notifications for the events they might care. To keep backward compatibility, if the EC doesn't support MKBP event, we fall back to the old MKBP key matrix host command. Cc: Randall Spangler <rspangler@chromium.org> Cc: Vincent Palatin <vpalatin@chromium.org> Cc: Benson Leung <bleung@chromium.org> Signed-off-by: Vic Yang <victoryang@google.com> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Tested-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Acked-by: Olof Johansson <olof@lixom.net> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'include/linux/mfd/cros_ec.h')
-rw-r--r--include/linux/mfd/cros_ec.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h
index d641a18abacb..76f7ef4d3a0d 100644
--- a/include/linux/mfd/cros_ec.h
+++ b/include/linux/mfd/cros_ec.h
@@ -109,6 +109,10 @@ struct cros_ec_command {
* should check msg.result for the EC's result code.
* @pkt_xfer: send packet to EC and get response
* @lock: one transaction at a time
+ * @mkbp_event_supported: true if this EC supports the MKBP event protocol.
+ * @event_notifier: interrupt event notifier for transport devices.
+ * @event_data: raw payload transferred with the MKBP event.
+ * @event_size: size in bytes of the event data.
*/
struct cros_ec_device {
@@ -137,6 +141,11 @@ struct cros_ec_device {
int (*pkt_xfer)(struct cros_ec_device *ec,
struct cros_ec_command *msg);
struct mutex lock;
+ bool mkbp_event_supported;
+ struct blocking_notifier_head event_notifier;
+
+ struct ec_response_get_next_event event_data;
+ int event_size;
};
/* struct cros_ec_platform - ChromeOS EC platform information
@@ -269,6 +278,15 @@ int cros_ec_register(struct cros_ec_device *ec_dev);
*/
int cros_ec_query_all(struct cros_ec_device *ec_dev);
+/**
+ * cros_ec_get_next_event - Fetch next event from the ChromeOS EC
+ *
+ * @ec_dev: Device to fetch event from
+ *
+ * Returns: 0 on success, Linux error number on failure
+ */
+int cros_ec_get_next_event(struct cros_ec_device *ec_dev);
+
/* sysfs stuff */
extern struct attribute_group cros_ec_attr_group;
extern struct attribute_group cros_ec_lightbar_attr_group;