aboutsummaryrefslogtreecommitdiff
path: root/drivers/misc/cros_ec_lpc.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_lpc.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_lpc.c')
-rw-r--r--drivers/misc/cros_ec_lpc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/misc/cros_ec_lpc.c b/drivers/misc/cros_ec_lpc.c
index e0002b9753..f40375978d 100644
--- a/drivers/misc/cros_ec_lpc.c
+++ b/drivers/misc/cros_ec_lpc.c
@@ -207,6 +207,12 @@ int cros_ec_lpc_init(struct cros_ec_dev *dev, const void *blob)
return 0;
}
+/* Return the byte of EC switch states */
+static int cros_ec_lpc_get_switches(struct udevice *dev)
+{
+ return inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES);
+}
+
/*
* Test if LPC command args are supported.
*
@@ -239,6 +245,7 @@ static struct dm_cros_ec_ops cros_ec_ops = {
.packet = cros_ec_lpc_packet,
.command = cros_ec_lpc_command,
.check_version = cros_ec_lpc_check_version,
+ .get_switches = cros_ec_lpc_get_switches,
};
static const struct udevice_id cros_ec_ids[] = {