summaryrefslogtreecommitdiff
path: root/drivers/misc/cros_ec.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-01-16 14:52:28 -0700
committerSimon Glass <sjg@chromium.org>2021-01-30 14:25:41 -0700
commit3a6c994f3896d66e617acdf9bb58ffc4def08b71 (patch)
treed8b222358a56ab098e8a66a3f09a5b2b0d0066ee /drivers/misc/cros_ec.c
parent2b4b65339110e11b4a859fceeb1eec82b2ebb5f1 (diff)
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>
Diffstat (limited to 'drivers/misc/cros_ec.c')
-rw-r--r--drivers/misc/cros_ec.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c
index fd2f2abd7e..0bc28e882c 100644
--- a/drivers/misc/cros_ec.c
+++ b/drivers/misc/cros_ec.c
@@ -1557,6 +1557,22 @@ int cros_ec_set_lid_shutdown_mask(struct udevice *dev, int enable)
return 0;
}
+int cros_ec_get_switches(struct udevice *dev)
+{
+ struct dm_cros_ec_ops *ops;
+ int ret;
+
+ ops = dm_cros_ec_get_ops(dev);
+ if (!ops->get_switches)
+ return -ENOSYS;
+
+ ret = ops->get_switches(dev);
+ if (ret < 0)
+ return log_msg_ret("get", ret);
+
+ return ret;
+}
+
UCLASS_DRIVER(cros_ec) = {
.id = UCLASS_CROS_EC,
.name = "cros-ec",