cros_ec: Add support for switches
On x86 platforms the EC provides a way to read 'switches', which are
on/off values determined by the EC.
Add a new driver method for this and implement it for LPC.
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/include/cros_ec.h b/include/cros_ec.h
index 26e3f3b..cb91343 100644
--- a/include/cros_ec.h
+++ b/include/cros_ec.h
@@ -279,6 +279,16 @@
* @return number of bytes in response, or -ve on error
*/
int (*packet)(struct udevice *dev, int out_bytes, int in_bytes);
+
+ /**
+ * get_switches() - Get value of EC switches
+ *
+ * This is currently supported on the LPC EC.
+ *
+ * @dev: Device to use
+ * @return current switches value, or -ENOSYS if not supported
+ */
+ int (*get_switches)(struct udevice *dev);
};
#define dm_cros_ec_get_ops(dev) \
@@ -577,4 +587,13 @@
*/
int cros_ec_check_feature(struct udevice *dev, uint feature);
+/**
+ * cros_ec_get_switches() - Get switches value
+ *
+ * @dev: CROS-EC device
+ * @return switches value, or -ENOSYS if not supported, or other -ve value on
+ * other error
+ */
+int cros_ec_get_switches(struct udevice *dev);
+
#endif