summaryrefslogtreecommitdiffstats
path: root/drivers/mfd/cros_ec_dev.c
diff options
context:
space:
mode:
authorPi-Hsun Shih <pihsun@chromium.org>2019-06-03 05:45:11 +0200
committerLee Jones <lee.jones@linaro.org>2019-07-02 13:11:31 +0200
commit554e937ec8d75930bc711612208af27961e3dc61 (patch)
tree56ef6915ca6227498ee222cb82eb901c9dcd443f /drivers/mfd/cros_ec_dev.c
parentdt-bindings: Add binding for cros-ec-rpmsg (diff)
downloadlinux-554e937ec8d75930bc711612208af27961e3dc61.tar.xz
linux-554e937ec8d75930bc711612208af27961e3dc61.zip
mfd: cros_ec: differentiate SCP from EC by feature bit
System Companion Processor (SCP) is Cortex M4 co-processor on some MediaTek platform that can run EC-style firmware. Since a SCP and EC would both exist on a system, and use the cros_ec_dev driver, we need to differentiate between them for the userspace, or they would both be registered at /dev/cros_ec, causing a conflict. Signed-off-by: Pi-Hsun Shih <pihsun@chromium.org> Acked-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd/cros_ec_dev.c')
-rw-r--r--drivers/mfd/cros_ec_dev.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
index d992365472b8..a47223d2baf4 100644
--- a/drivers/mfd/cros_ec_dev.c
+++ b/drivers/mfd/cros_ec_dev.c
@@ -459,6 +459,16 @@ static int ec_device_probe(struct platform_device *pdev)
ec_platform->ec_name = CROS_EC_DEV_TP_NAME;
}
+ /* Check whether this is actually a SCP rather than an EC. */
+ if (cros_ec_check_features(ec, EC_FEATURE_SCP)) {
+ dev_info(dev, "CrOS SCP MCU detected.\n");
+ /*
+ * Help userspace differentiating ECs from SCP,
+ * regardless of the probing order.
+ */
+ ec_platform->ec_name = CROS_EC_DEV_SCP_NAME;
+ }
+
/*
* Add the class device
* Link to the character device for creating the /dev entry