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 <[email protected]>
---
Changes from v7:
- Address comments in v7.
- Rebase the series onto https://lore.kernel.org/patchwork/patch/1059196/.
Changes from v6:
- No change.
Changes from v5:
- No change.
Changes from v4:
- No change.
Changes from v3:
- No change.
Changes from v2:
- No change.
Changes from v1:
- New patch extracted from Patch 5.
---
drivers/mfd/cros_ec_dev.c | 10 ++++++++++
include/linux/mfd/cros_ec.h | 1 +
include/linux/mfd/cros_ec_commands.h | 2 +-
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
index a3b319913097..5b52b648abf2 100644
--- a/drivers/mfd/cros_ec_dev.c
+++ b/drivers/mfd/cros_ec_dev.c
@@ -432,6 +432,16 @@ static int ec_device_probe(struct platform_device *pdev)
ec_platform->ec_name = CROS_EC_DEV_ISH_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
diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h
index 109292a60499..a3e3d6beb19a 100644
--- a/include/linux/mfd/cros_ec.h
+++ b/include/linux/mfd/cros_ec.h
@@ -25,6 +25,7 @@
#define CROS_EC_DEV_NAME "cros_ec"
#define CROS_EC_DEV_PD_NAME "cros_pd"
#define CROS_EC_DEV_ISH_NAME "cros_ish"
+#define CROS_EC_DEV_SCP_NAME "cros_scp"
/*
* The EC is unresponsive for a time after a reboot command. Add a
diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h
index d5bf909af661..80a904ed7d7f 100644
--- a/include/linux/mfd/cros_ec_commands.h
+++ b/include/linux/mfd/cros_ec_commands.h
@@ -884,7 +884,7 @@ enum ec_feature_code {
EC_FEATURE_REFINED_TABLET_MODE_HYSTERESIS = 37,
/* EC supports audio codec. */
EC_FEATURE_AUDIO_CODEC = 38,
- /* EC Supports SCP. */
+ /* The MCU is a System Companion Processor (SCP). */
EC_FEATURE_SCP = 39,
/* The MCU is an Integrated Sensor Hub */
EC_FEATURE_ISH = 40,
--
2.21.0.392.gf8f6787159e-goog
On 12/4/19 9:18, Pi-Hsun Shih wrote:
> 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 <[email protected]>
Acked-by: Enric Balletbo i Serra <[email protected]>
Lee, there are several patches touching these files right now so you could have
to solve some trivial conflicts. If you want I send a series with all that apply
cleanly just let me know.
Thanks,
Enric
> ---
> Changes from v7:
> - Address comments in v7.
> - Rebase the series onto https://lore.kernel.org/patchwork/patch/1059196/.
>
> Changes from v6:
> - No change.
>
> Changes from v5:
> - No change.
>
> Changes from v4:
> - No change.
>
> Changes from v3:
> - No change.
>
> Changes from v2:
> - No change.
>
> Changes from v1:
> - New patch extracted from Patch 5.
> ---
> drivers/mfd/cros_ec_dev.c | 10 ++++++++++
> include/linux/mfd/cros_ec.h | 1 +
> include/linux/mfd/cros_ec_commands.h | 2 +-
> 3 files changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
> index a3b319913097..5b52b648abf2 100644
> --- a/drivers/mfd/cros_ec_dev.c
> +++ b/drivers/mfd/cros_ec_dev.c
> @@ -432,6 +432,16 @@ static int ec_device_probe(struct platform_device *pdev)
> ec_platform->ec_name = CROS_EC_DEV_ISH_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
> diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h
> index 109292a60499..a3e3d6beb19a 100644
> --- a/include/linux/mfd/cros_ec.h
> +++ b/include/linux/mfd/cros_ec.h
> @@ -25,6 +25,7 @@
> #define CROS_EC_DEV_NAME "cros_ec"
> #define CROS_EC_DEV_PD_NAME "cros_pd"
> #define CROS_EC_DEV_ISH_NAME "cros_ish"
> +#define CROS_EC_DEV_SCP_NAME "cros_scp"
>
> /*
> * The EC is unresponsive for a time after a reboot command. Add a
> diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h
> index d5bf909af661..80a904ed7d7f 100644
> --- a/include/linux/mfd/cros_ec_commands.h
> +++ b/include/linux/mfd/cros_ec_commands.h
> @@ -884,7 +884,7 @@ enum ec_feature_code {
> EC_FEATURE_REFINED_TABLET_MODE_HYSTERESIS = 37,
> /* EC supports audio codec. */
> EC_FEATURE_AUDIO_CODEC = 38,
> - /* EC Supports SCP. */
> + /* The MCU is a System Companion Processor (SCP). */
> EC_FEATURE_SCP = 39,
> /* The MCU is an Integrated Sensor Hub */
> EC_FEATURE_ISH = 40,
>
On Mon, 15 Apr 2019, Enric Balletbo i Serra wrote:
> On 12/4/19 9:18, Pi-Hsun Shih wrote:
> > 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 <[email protected]>
>
> Acked-by: Enric Balletbo i Serra <[email protected]>
>
> Lee, there are several patches touching these files right now so you could have
> to solve some trivial conflicts. If you want I send a series with all that apply
> cleanly just let me know.
It would be ideal if you could bundle them to avoid conflicts.
--
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
Hi Lee,
On 25/4/19 11:06, Lee Jones wrote:
> On Mon, 15 Apr 2019, Enric Balletbo i Serra wrote:
>> On 12/4/19 9:18, Pi-Hsun Shih wrote:
>>> 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 <[email protected]>
>>
>> Acked-by: Enric Balletbo i Serra <[email protected]>
>>
>> Lee, there are several patches touching these files right now so you could have
>> to solve some trivial conflicts. If you want I send a series with all that apply
>> cleanly just let me know.
>
> It would be ideal if you could bundle them to avoid conflicts.
>
I first bundle was submitted here https://lkml.org/lkml/2019/4/8/270
I'll send a second bundle on top of the above.
- Enric