* [PATCH v3 0/3] Load cros_ec_ucsi from OF and ACPI definitions
@ 2025-10-09 1:03 Jameson Thies
2025-10-09 1:03 ` [PATCH v3 1/3] dt-bindings: chrome: Add cros-ec-ucsi compatibility to typec binding Jameson Thies
` (2 more replies)
0 siblings, 3 replies; 15+ messages in thread
From: Jameson Thies @ 2025-10-09 1:03 UTC (permalink / raw)
To: akuchynski, abhishekpandit, krzk+dt, robh, bleung,
heikki.krogerus, ukaszb, tzungbi
Cc: devicetree, chrome-platform, linux-usb, linux-kernel,
Jameson Thies
The ChromeOS UCSI driver (cros_ec_ucsi) currently gets added as
subdevice of cros_ec_dev. But without it being defined by an ACPI
node or in the OF device tree, the typec connectors are not correctly
associated with other part of the device tree. This series updates the
cros_ec_ucsi driver to load based on device definitions in ACPI and OF.
It also changes the cros_ec_dev driver to block adding cros_ec_ucsi
as a subdevice if it is defined in the device tree.
For context, I initially sent out this series for review in March 2025
(https://lkml.kernel.org/20250312195951.1579682-1-jthies@google.com/).
Patch 1/3 has been updated to address comments from the initial review.
There were some open questions on patch 3/3 regarding adding MFD
children when there is no cros_ec_ucsi node and parents conditionally
checking if a child exists to create one.
The expected behavior of this series is to only add the cros_ec_ucsi
subdevice when there isn't a corresponding FW node because always adding
it would result in multiple cros_ec_ucsi devices and too many ports
being registered with the USB Type-C connector class on devices with
correctly defined FW nodes. It also does not look for a child node to
create a child. It is looking for a child of the parent EC device to
only add cros_ec_ucsi if it does not already exist as a sibling.
v3 changes:
- adds cros-ec-ucsi compatibility string to google,cros-ec-typec.yaml
instead of defining a new binding.
- updates maintainter list in google,cros-ec-typec.yaml
- cleaned up assignments to udata->ec in cros_ec_ucsi.c
- now using acpi_dev_found() to check for ACPI node in cros_ec_dev.c
v2 changes:
- updated google,cros-ec.yaml to support typec ports defined by
google,cros-ec-ucsi.yaml. Tested with make dt_binding_check
and dtbs_check
Jameson Thies (3):
dt-bindings: chrome: Add cros-ec-ucsi compatibility to typec binding
usb: typec: cros_ec_ucsi: Load driver from OF and ACPI definitions
mfd: cros_ec: Don't add cros_ec_ucsi if it is defined in OF or ACPI
.../bindings/chrome/google,cros-ec-typec.yaml | 19 +++++++++++----
drivers/mfd/cros_ec_dev.c | 23 +++++++++++++++----
drivers/usb/typec/ucsi/cros_ec_ucsi.c | 22 ++++++++++++++++--
3 files changed, 53 insertions(+), 11 deletions(-)
base-commit: 48633acccf38d706d7b368400647bb9db9caf1ae
--
2.51.0.710.ga91ca5db03-goog
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3 1/3] dt-bindings: chrome: Add cros-ec-ucsi compatibility to typec binding
2025-10-09 1:03 [PATCH v3 0/3] Load cros_ec_ucsi from OF and ACPI definitions Jameson Thies
@ 2025-10-09 1:03 ` Jameson Thies
2025-10-09 19:09 ` Benson Leung
2025-10-10 17:54 ` Rob Herring (Arm)
2025-10-09 1:03 ` [PATCH v3 2/3] usb: typec: cros_ec_ucsi: Load driver from OF and ACPI definitions Jameson Thies
2025-10-09 1:03 ` [PATCH v3 3/3] mfd: cros_ec: Don't add cros_ec_ucsi if it is defined in OF or ACPI Jameson Thies
2 siblings, 2 replies; 15+ messages in thread
From: Jameson Thies @ 2025-10-09 1:03 UTC (permalink / raw)
To: akuchynski, abhishekpandit, krzk+dt, robh, bleung,
heikki.krogerus, ukaszb, tzungbi
Cc: devicetree, chrome-platform, linux-usb, linux-kernel,
Jameson Thies
Chrome OS devices with discrete power delivery controllers (PDCs) allow
the host to read port status and control port behavior through a USB
Type-C Connector System Software (UCSI) interface with the embedded
controller (EC). This uses a separate interface driver than other
Chrome OS devices with a Type-C port manager in the EC FW. Those use
a host command interface supported by cros-ec-typec. Add a cros-ec-ucsi
compatibility string to the existing cros-ec-typec binding.
Additionally, update maintainer list to reflect cros-ec-ucsi and
cros-ec-typec driver maintainers.
Signed-off-by: Jameson Thies <jthies@google.com>
---
.../bindings/chrome/google,cros-ec-typec.yaml | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/Documentation/devicetree/bindings/chrome/google,cros-ec-typec.yaml b/Documentation/devicetree/bindings/chrome/google,cros-ec-typec.yaml
index 9f9816fbecbc..fd1a459879bd 100644
--- a/Documentation/devicetree/bindings/chrome/google,cros-ec-typec.yaml
+++ b/Documentation/devicetree/bindings/chrome/google,cros-ec-typec.yaml
@@ -8,17 +8,28 @@ title: Google Chrome OS EC(Embedded Controller) Type C port driver.
maintainers:
- Benson Leung <bleung@chromium.org>
- - Prashant Malani <pmalani@chromium.org>
+ - Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
+ - Andrei Kuchynski <akuchynski@chromium.org>
+ - Łukasz Bartosik <ukaszb@chromium.org>
+ - Jameson Thies <jthies@google.com>
description:
Chrome OS devices have an Embedded Controller(EC) which has access to
Type C port state. This node is intended to allow the host to read and
- control the Type C ports. The node for this device should be under a
- cros-ec node like google,cros-ec-spi.
+ control the Type C ports. This binding is compatible with both the
+ cros-ec-typec and cros-ec-ucsi drivers. The cros-ec-typec driver
+ supports the host command interface used by the Chrome OS EC with a
+ built-in Type-C port manager and external Type-C Port Controller
+ (TCPC). The cros-ec-ucsi driver supports the USB Type-C Connector
+ System Software (UCSI) interface used by the Chrome OS EC when the
+ platform has a separate power delivery controller (PDC). The node for
+ this device should be under a cros-ec node like google,cros-ec-spi.
properties:
compatible:
- const: google,cros-ec-typec
+ enum:
+ - google,cros-ec-typec
+ - google,cros-ec-ucsi
'#address-cells':
const: 1
--
2.51.0.710.ga91ca5db03-goog
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3 2/3] usb: typec: cros_ec_ucsi: Load driver from OF and ACPI definitions
2025-10-09 1:03 [PATCH v3 0/3] Load cros_ec_ucsi from OF and ACPI definitions Jameson Thies
2025-10-09 1:03 ` [PATCH v3 1/3] dt-bindings: chrome: Add cros-ec-ucsi compatibility to typec binding Jameson Thies
@ 2025-10-09 1:03 ` Jameson Thies
2025-10-09 19:12 ` Benson Leung
2025-10-10 17:37 ` Dmitry Baryshkov
2025-10-09 1:03 ` [PATCH v3 3/3] mfd: cros_ec: Don't add cros_ec_ucsi if it is defined in OF or ACPI Jameson Thies
2 siblings, 2 replies; 15+ messages in thread
From: Jameson Thies @ 2025-10-09 1:03 UTC (permalink / raw)
To: akuchynski, abhishekpandit, krzk+dt, robh, bleung,
heikki.krogerus, ukaszb, tzungbi
Cc: devicetree, chrome-platform, linux-usb, linux-kernel,
Jameson Thies
Add support for cros_ec_ucsi to load based on "google,cros-ec-ucsi"
compatible devices and "GOOG0021" ACPI nodes.
Signed-off-by: Jameson Thies <jthies@google.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
drivers/usb/typec/ucsi/cros_ec_ucsi.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/typec/ucsi/cros_ec_ucsi.c b/drivers/usb/typec/ucsi/cros_ec_ucsi.c
index eed2a7d0ebc6..62b80ad85a68 100644
--- a/drivers/usb/typec/ucsi/cros_ec_ucsi.c
+++ b/drivers/usb/typec/ucsi/cros_ec_ucsi.c
@@ -5,11 +5,13 @@
* Copyright 2024 Google LLC.
*/
+#include <linux/acpi.h>
#include <linux/container_of.h>
#include <linux/dev_printk.h>
#include <linux/jiffies.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
+#include <linux/of.h>
#include <linux/platform_data/cros_ec_commands.h>
#include <linux/platform_data/cros_usbpd_notify.h>
#include <linux/platform_data/cros_ec_proto.h>
@@ -235,7 +237,6 @@ static void cros_ucsi_destroy(struct cros_ucsi_data *udata)
static int cros_ucsi_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
- struct cros_ec_dev *ec_data = dev_get_drvdata(dev->parent);
struct cros_ucsi_data *udata;
int ret;
@@ -244,8 +245,11 @@ static int cros_ucsi_probe(struct platform_device *pdev)
return -ENOMEM;
udata->dev = dev;
+ if (is_acpi_device_node(dev->fwnode) || is_of_node(dev->fwnode))
+ udata->ec = dev_get_drvdata(dev->parent);
+ else
+ udata->ec = ((struct cros_ec_dev *)dev_get_drvdata(dev->parent))->ec_dev;
- udata->ec = ec_data->ec_dev;
if (!udata->ec)
return dev_err_probe(dev, -ENODEV, "couldn't find parent EC device\n");
@@ -326,10 +330,24 @@ static const struct platform_device_id cros_ucsi_id[] = {
};
MODULE_DEVICE_TABLE(platform, cros_ucsi_id);
+static const struct acpi_device_id cros_ec_ucsi_acpi_device_ids[] = {
+ { "GOOG0021", 0 },
+ { }
+};
+MODULE_DEVICE_TABLE(acpi, cros_ec_ucsi_acpi_device_ids);
+
+static const struct of_device_id cros_ucsi_of_match[] = {
+ { .compatible = "google,cros-ec-ucsi", },
+ {}
+};
+MODULE_DEVICE_TABLE(of, cros_ucsi_of_match);
+
static struct platform_driver cros_ucsi_driver = {
.driver = {
.name = KBUILD_MODNAME,
.pm = &cros_ucsi_pm_ops,
+ .acpi_match_table = cros_ec_ucsi_acpi_device_ids,
+ .of_match_table = cros_ucsi_of_match,
},
.id_table = cros_ucsi_id,
.probe = cros_ucsi_probe,
--
2.51.0.710.ga91ca5db03-goog
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3 3/3] mfd: cros_ec: Don't add cros_ec_ucsi if it is defined in OF or ACPI
2025-10-09 1:03 [PATCH v3 0/3] Load cros_ec_ucsi from OF and ACPI definitions Jameson Thies
2025-10-09 1:03 ` [PATCH v3 1/3] dt-bindings: chrome: Add cros-ec-ucsi compatibility to typec binding Jameson Thies
2025-10-09 1:03 ` [PATCH v3 2/3] usb: typec: cros_ec_ucsi: Load driver from OF and ACPI definitions Jameson Thies
@ 2025-10-09 1:03 ` Jameson Thies
2025-10-09 19:13 ` Benson Leung
2025-10-10 17:38 ` Dmitry Baryshkov
2 siblings, 2 replies; 15+ messages in thread
From: Jameson Thies @ 2025-10-09 1:03 UTC (permalink / raw)
To: akuchynski, abhishekpandit, krzk+dt, robh, bleung,
heikki.krogerus, ukaszb, tzungbi
Cc: devicetree, chrome-platform, linux-usb, linux-kernel,
Jameson Thies
On devices with a UCSI PPM in the EC, check for cros_ec_ucsi to be
defined in the OF device tree or an ACPI node. If it is defined by
either OF or ACPI, it does not need to be added as a subdevice of
cros_ec_dev.
Signed-off-by: Jameson Thies <jthies@google.com>
---
drivers/mfd/cros_ec_dev.c | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
index dc80a272726b..1928c2ea2b8f 100644
--- a/drivers/mfd/cros_ec_dev.c
+++ b/drivers/mfd/cros_ec_dev.c
@@ -5,6 +5,7 @@
* Copyright (C) 2014 Google, Inc.
*/
+#include <linux/acpi.h>
#include <linux/dmi.h>
#include <linux/kconfig.h>
#include <linux/mfd/core.h>
@@ -131,11 +132,6 @@ static const struct cros_feature_to_cells cros_subdevices[] = {
.mfd_cells = cros_ec_rtc_cells,
.num_cells = ARRAY_SIZE(cros_ec_rtc_cells),
},
- {
- .id = EC_FEATURE_UCSI_PPM,
- .mfd_cells = cros_ec_ucsi_cells,
- .num_cells = ARRAY_SIZE(cros_ec_ucsi_cells),
- },
{
.id = EC_FEATURE_HANG_DETECT,
.mfd_cells = cros_ec_wdt_cells,
@@ -264,6 +260,23 @@ static int ec_device_probe(struct platform_device *pdev)
}
}
+ /*
+ * FW nodes can load cros_ec_ucsi, but early PDC devices did not define
+ * the required nodes. On PDC systems without FW nodes for cros_ec_ucsi,
+ * the driver should be added as an mfd subdevice.
+ */
+ if (cros_ec_check_features(ec, EC_FEATURE_USB_PD) &&
+ cros_ec_check_features(ec, EC_FEATURE_UCSI_PPM) &&
+ !acpi_dev_found("GOOG0021") &&
+ !of_find_compatible_node(NULL, NULL, "google,cros-ec-ucsi")) {
+ retval = mfd_add_hotplug_devices(ec->dev,
+ cros_ec_ucsi_cells,
+ ARRAY_SIZE(cros_ec_ucsi_cells));
+
+ if (retval)
+ dev_warn(ec->dev, "failed to add cros_ec_ucsi: %d\n", retval);
+ }
+
/*
* UCSI provides power supply information so we don't need to separately
* load the cros_usbpd_charger driver.
--
2.51.0.710.ga91ca5db03-goog
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v3 1/3] dt-bindings: chrome: Add cros-ec-ucsi compatibility to typec binding
2025-10-09 1:03 ` [PATCH v3 1/3] dt-bindings: chrome: Add cros-ec-ucsi compatibility to typec binding Jameson Thies
@ 2025-10-09 19:09 ` Benson Leung
2025-10-10 17:54 ` Rob Herring (Arm)
1 sibling, 0 replies; 15+ messages in thread
From: Benson Leung @ 2025-10-09 19:09 UTC (permalink / raw)
To: Jameson Thies
Cc: akuchynski, abhishekpandit, krzk+dt, robh, bleung,
heikki.krogerus, ukaszb, tzungbi, devicetree, chrome-platform,
linux-usb, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2789 bytes --]
On Thu, Oct 09, 2025 at 01:03:06AM +0000, Jameson Thies wrote:
> Chrome OS devices with discrete power delivery controllers (PDCs) allow
> the host to read port status and control port behavior through a USB
> Type-C Connector System Software (UCSI) interface with the embedded
> controller (EC). This uses a separate interface driver than other
> Chrome OS devices with a Type-C port manager in the EC FW. Those use
> a host command interface supported by cros-ec-typec. Add a cros-ec-ucsi
> compatibility string to the existing cros-ec-typec binding.
>
> Additionally, update maintainer list to reflect cros-ec-ucsi and
> cros-ec-typec driver maintainers.
>
> Signed-off-by: Jameson Thies <jthies@google.com>
Reviewed-by: Benson Leung <bleung@chromium.org>
> ---
> .../bindings/chrome/google,cros-ec-typec.yaml | 19 +++++++++++++++----
> 1 file changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/chrome/google,cros-ec-typec.yaml b/Documentation/devicetree/bindings/chrome/google,cros-ec-typec.yaml
> index 9f9816fbecbc..fd1a459879bd 100644
> --- a/Documentation/devicetree/bindings/chrome/google,cros-ec-typec.yaml
> +++ b/Documentation/devicetree/bindings/chrome/google,cros-ec-typec.yaml
> @@ -8,17 +8,28 @@ title: Google Chrome OS EC(Embedded Controller) Type C port driver.
>
> maintainers:
> - Benson Leung <bleung@chromium.org>
> - - Prashant Malani <pmalani@chromium.org>
> + - Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
> + - Andrei Kuchynski <akuchynski@chromium.org>
> + - Łukasz Bartosik <ukaszb@chromium.org>
> + - Jameson Thies <jthies@google.com>
>
> description:
> Chrome OS devices have an Embedded Controller(EC) which has access to
> Type C port state. This node is intended to allow the host to read and
> - control the Type C ports. The node for this device should be under a
> - cros-ec node like google,cros-ec-spi.
> + control the Type C ports. This binding is compatible with both the
> + cros-ec-typec and cros-ec-ucsi drivers. The cros-ec-typec driver
> + supports the host command interface used by the Chrome OS EC with a
> + built-in Type-C port manager and external Type-C Port Controller
> + (TCPC). The cros-ec-ucsi driver supports the USB Type-C Connector
> + System Software (UCSI) interface used by the Chrome OS EC when the
> + platform has a separate power delivery controller (PDC). The node for
> + this device should be under a cros-ec node like google,cros-ec-spi.
>
> properties:
> compatible:
> - const: google,cros-ec-typec
> + enum:
> + - google,cros-ec-typec
> + - google,cros-ec-ucsi
>
> '#address-cells':
> const: 1
> --
> 2.51.0.710.ga91ca5db03-goog
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 2/3] usb: typec: cros_ec_ucsi: Load driver from OF and ACPI definitions
2025-10-09 1:03 ` [PATCH v3 2/3] usb: typec: cros_ec_ucsi: Load driver from OF and ACPI definitions Jameson Thies
@ 2025-10-09 19:12 ` Benson Leung
2025-10-10 17:37 ` Dmitry Baryshkov
1 sibling, 0 replies; 15+ messages in thread
From: Benson Leung @ 2025-10-09 19:12 UTC (permalink / raw)
To: Jameson Thies
Cc: akuchynski, abhishekpandit, krzk+dt, robh, bleung,
heikki.krogerus, ukaszb, tzungbi, devicetree, chrome-platform,
linux-usb, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2814 bytes --]
On Thu, Oct 09, 2025 at 01:03:07AM +0000, Jameson Thies wrote:
> Add support for cros_ec_ucsi to load based on "google,cros-ec-ucsi"
> compatible devices and "GOOG0021" ACPI nodes.
>
> Signed-off-by: Jameson Thies <jthies@google.com>
> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Benson Leung <bleung@chromium.org>
> ---
> drivers/usb/typec/ucsi/cros_ec_ucsi.c | 22 ++++++++++++++++++++--
> 1 file changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/typec/ucsi/cros_ec_ucsi.c b/drivers/usb/typec/ucsi/cros_ec_ucsi.c
> index eed2a7d0ebc6..62b80ad85a68 100644
> --- a/drivers/usb/typec/ucsi/cros_ec_ucsi.c
> +++ b/drivers/usb/typec/ucsi/cros_ec_ucsi.c
> @@ -5,11 +5,13 @@
> * Copyright 2024 Google LLC.
> */
>
> +#include <linux/acpi.h>
> #include <linux/container_of.h>
> #include <linux/dev_printk.h>
> #include <linux/jiffies.h>
> #include <linux/mod_devicetable.h>
> #include <linux/module.h>
> +#include <linux/of.h>
> #include <linux/platform_data/cros_ec_commands.h>
> #include <linux/platform_data/cros_usbpd_notify.h>
> #include <linux/platform_data/cros_ec_proto.h>
> @@ -235,7 +237,6 @@ static void cros_ucsi_destroy(struct cros_ucsi_data *udata)
> static int cros_ucsi_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> - struct cros_ec_dev *ec_data = dev_get_drvdata(dev->parent);
> struct cros_ucsi_data *udata;
> int ret;
>
> @@ -244,8 +245,11 @@ static int cros_ucsi_probe(struct platform_device *pdev)
> return -ENOMEM;
>
> udata->dev = dev;
> + if (is_acpi_device_node(dev->fwnode) || is_of_node(dev->fwnode))
> + udata->ec = dev_get_drvdata(dev->parent);
> + else
> + udata->ec = ((struct cros_ec_dev *)dev_get_drvdata(dev->parent))->ec_dev;
>
> - udata->ec = ec_data->ec_dev;
> if (!udata->ec)
> return dev_err_probe(dev, -ENODEV, "couldn't find parent EC device\n");
>
> @@ -326,10 +330,24 @@ static const struct platform_device_id cros_ucsi_id[] = {
> };
> MODULE_DEVICE_TABLE(platform, cros_ucsi_id);
>
> +static const struct acpi_device_id cros_ec_ucsi_acpi_device_ids[] = {
> + { "GOOG0021", 0 },
> + { }
> +};
> +MODULE_DEVICE_TABLE(acpi, cros_ec_ucsi_acpi_device_ids);
> +
> +static const struct of_device_id cros_ucsi_of_match[] = {
> + { .compatible = "google,cros-ec-ucsi", },
> + {}
> +};
> +MODULE_DEVICE_TABLE(of, cros_ucsi_of_match);
> +
> static struct platform_driver cros_ucsi_driver = {
> .driver = {
> .name = KBUILD_MODNAME,
> .pm = &cros_ucsi_pm_ops,
> + .acpi_match_table = cros_ec_ucsi_acpi_device_ids,
> + .of_match_table = cros_ucsi_of_match,
> },
> .id_table = cros_ucsi_id,
> .probe = cros_ucsi_probe,
> --
> 2.51.0.710.ga91ca5db03-goog
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 3/3] mfd: cros_ec: Don't add cros_ec_ucsi if it is defined in OF or ACPI
2025-10-09 1:03 ` [PATCH v3 3/3] mfd: cros_ec: Don't add cros_ec_ucsi if it is defined in OF or ACPI Jameson Thies
@ 2025-10-09 19:13 ` Benson Leung
2025-10-10 17:38 ` Dmitry Baryshkov
1 sibling, 0 replies; 15+ messages in thread
From: Benson Leung @ 2025-10-09 19:13 UTC (permalink / raw)
To: Jameson Thies
Cc: akuchynski, abhishekpandit, krzk+dt, robh, bleung,
heikki.krogerus, ukaszb, tzungbi, devicetree, chrome-platform,
linux-usb, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2259 bytes --]
On Thu, Oct 09, 2025 at 01:03:08AM +0000, Jameson Thies wrote:
> On devices with a UCSI PPM in the EC, check for cros_ec_ucsi to be
> defined in the OF device tree or an ACPI node. If it is defined by
> either OF or ACPI, it does not need to be added as a subdevice of
> cros_ec_dev.
>
> Signed-off-by: Jameson Thies <jthies@google.com>
Reviewed-by: Benson Leung <bleung@chromium.org>
> ---
> drivers/mfd/cros_ec_dev.c | 23 ++++++++++++++++++-----
> 1 file changed, 18 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
> index dc80a272726b..1928c2ea2b8f 100644
> --- a/drivers/mfd/cros_ec_dev.c
> +++ b/drivers/mfd/cros_ec_dev.c
> @@ -5,6 +5,7 @@
> * Copyright (C) 2014 Google, Inc.
> */
>
> +#include <linux/acpi.h>
> #include <linux/dmi.h>
> #include <linux/kconfig.h>
> #include <linux/mfd/core.h>
> @@ -131,11 +132,6 @@ static const struct cros_feature_to_cells cros_subdevices[] = {
> .mfd_cells = cros_ec_rtc_cells,
> .num_cells = ARRAY_SIZE(cros_ec_rtc_cells),
> },
> - {
> - .id = EC_FEATURE_UCSI_PPM,
> - .mfd_cells = cros_ec_ucsi_cells,
> - .num_cells = ARRAY_SIZE(cros_ec_ucsi_cells),
> - },
> {
> .id = EC_FEATURE_HANG_DETECT,
> .mfd_cells = cros_ec_wdt_cells,
> @@ -264,6 +260,23 @@ static int ec_device_probe(struct platform_device *pdev)
> }
> }
>
> + /*
> + * FW nodes can load cros_ec_ucsi, but early PDC devices did not define
> + * the required nodes. On PDC systems without FW nodes for cros_ec_ucsi,
> + * the driver should be added as an mfd subdevice.
> + */
> + if (cros_ec_check_features(ec, EC_FEATURE_USB_PD) &&
> + cros_ec_check_features(ec, EC_FEATURE_UCSI_PPM) &&
> + !acpi_dev_found("GOOG0021") &&
> + !of_find_compatible_node(NULL, NULL, "google,cros-ec-ucsi")) {
> + retval = mfd_add_hotplug_devices(ec->dev,
> + cros_ec_ucsi_cells,
> + ARRAY_SIZE(cros_ec_ucsi_cells));
> +
> + if (retval)
> + dev_warn(ec->dev, "failed to add cros_ec_ucsi: %d\n", retval);
> + }
> +
> /*
> * UCSI provides power supply information so we don't need to separately
> * load the cros_usbpd_charger driver.
> --
> 2.51.0.710.ga91ca5db03-goog
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 2/3] usb: typec: cros_ec_ucsi: Load driver from OF and ACPI definitions
2025-10-09 1:03 ` [PATCH v3 2/3] usb: typec: cros_ec_ucsi: Load driver from OF and ACPI definitions Jameson Thies
2025-10-09 19:12 ` Benson Leung
@ 2025-10-10 17:37 ` Dmitry Baryshkov
2025-10-11 0:10 ` Jameson Thies
1 sibling, 1 reply; 15+ messages in thread
From: Dmitry Baryshkov @ 2025-10-10 17:37 UTC (permalink / raw)
To: Jameson Thies
Cc: akuchynski, abhishekpandit, krzk+dt, robh, bleung,
heikki.krogerus, ukaszb, tzungbi, devicetree, chrome-platform,
linux-usb, linux-kernel
On Thu, Oct 09, 2025 at 01:03:07AM +0000, Jameson Thies wrote:
> Add support for cros_ec_ucsi to load based on "google,cros-ec-ucsi"
> compatible devices and "GOOG0021" ACPI nodes.
>
> Signed-off-by: Jameson Thies <jthies@google.com>
> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/usb/typec/ucsi/cros_ec_ucsi.c | 22 ++++++++++++++++++++--
> 1 file changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/typec/ucsi/cros_ec_ucsi.c b/drivers/usb/typec/ucsi/cros_ec_ucsi.c
> index eed2a7d0ebc6..62b80ad85a68 100644
> --- a/drivers/usb/typec/ucsi/cros_ec_ucsi.c
> +++ b/drivers/usb/typec/ucsi/cros_ec_ucsi.c
> @@ -5,11 +5,13 @@
> * Copyright 2024 Google LLC.
> */
>
> +#include <linux/acpi.h>
> #include <linux/container_of.h>
> #include <linux/dev_printk.h>
> #include <linux/jiffies.h>
> #include <linux/mod_devicetable.h>
> #include <linux/module.h>
> +#include <linux/of.h>
> #include <linux/platform_data/cros_ec_commands.h>
> #include <linux/platform_data/cros_usbpd_notify.h>
> #include <linux/platform_data/cros_ec_proto.h>
> @@ -235,7 +237,6 @@ static void cros_ucsi_destroy(struct cros_ucsi_data *udata)
> static int cros_ucsi_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> - struct cros_ec_dev *ec_data = dev_get_drvdata(dev->parent);
> struct cros_ucsi_data *udata;
> int ret;
>
> @@ -244,8 +245,11 @@ static int cros_ucsi_probe(struct platform_device *pdev)
> return -ENOMEM;
>
> udata->dev = dev;
> + if (is_acpi_device_node(dev->fwnode) || is_of_node(dev->fwnode))
> + udata->ec = dev_get_drvdata(dev->parent);
> + else
> + udata->ec = ((struct cros_ec_dev *)dev_get_drvdata(dev->parent))->ec_dev;
Hmm, could you please comment, why does it depend on a way UCSI device
is instantiated?
>
> - udata->ec = ec_data->ec_dev;
> if (!udata->ec)
> return dev_err_probe(dev, -ENODEV, "couldn't find parent EC device\n");
>
> @@ -326,10 +330,24 @@ static const struct platform_device_id cros_ucsi_id[] = {
> };
> MODULE_DEVICE_TABLE(platform, cros_ucsi_id);
>
> +static const struct acpi_device_id cros_ec_ucsi_acpi_device_ids[] = {
> + { "GOOG0021", 0 },
> + { }
> +};
> +MODULE_DEVICE_TABLE(acpi, cros_ec_ucsi_acpi_device_ids);
> +
> +static const struct of_device_id cros_ucsi_of_match[] = {
> + { .compatible = "google,cros-ec-ucsi", },
> + {}
> +};
> +MODULE_DEVICE_TABLE(of, cros_ucsi_of_match);
> +
> static struct platform_driver cros_ucsi_driver = {
> .driver = {
> .name = KBUILD_MODNAME,
> .pm = &cros_ucsi_pm_ops,
> + .acpi_match_table = cros_ec_ucsi_acpi_device_ids,
> + .of_match_table = cros_ucsi_of_match,
> },
> .id_table = cros_ucsi_id,
> .probe = cros_ucsi_probe,
> --
> 2.51.0.710.ga91ca5db03-goog
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 3/3] mfd: cros_ec: Don't add cros_ec_ucsi if it is defined in OF or ACPI
2025-10-09 1:03 ` [PATCH v3 3/3] mfd: cros_ec: Don't add cros_ec_ucsi if it is defined in OF or ACPI Jameson Thies
2025-10-09 19:13 ` Benson Leung
@ 2025-10-10 17:38 ` Dmitry Baryshkov
2025-10-10 23:42 ` Jameson Thies
1 sibling, 1 reply; 15+ messages in thread
From: Dmitry Baryshkov @ 2025-10-10 17:38 UTC (permalink / raw)
To: Jameson Thies
Cc: akuchynski, abhishekpandit, krzk+dt, robh, bleung,
heikki.krogerus, ukaszb, tzungbi, devicetree, chrome-platform,
linux-usb, linux-kernel
On Thu, Oct 09, 2025 at 01:03:08AM +0000, Jameson Thies wrote:
> On devices with a UCSI PPM in the EC, check for cros_ec_ucsi to be
> defined in the OF device tree or an ACPI node. If it is defined by
> either OF or ACPI, it does not need to be added as a subdevice of
> cros_ec_dev.
It still can be a subdevice of the EC, if it has a correct DT node.
>
> Signed-off-by: Jameson Thies <jthies@google.com>
> ---
> drivers/mfd/cros_ec_dev.c | 23 ++++++++++++++++++-----
> 1 file changed, 18 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
> index dc80a272726b..1928c2ea2b8f 100644
> --- a/drivers/mfd/cros_ec_dev.c
> +++ b/drivers/mfd/cros_ec_dev.c
> @@ -5,6 +5,7 @@
> * Copyright (C) 2014 Google, Inc.
> */
>
> +#include <linux/acpi.h>
> #include <linux/dmi.h>
> #include <linux/kconfig.h>
> #include <linux/mfd/core.h>
> @@ -131,11 +132,6 @@ static const struct cros_feature_to_cells cros_subdevices[] = {
> .mfd_cells = cros_ec_rtc_cells,
> .num_cells = ARRAY_SIZE(cros_ec_rtc_cells),
> },
> - {
> - .id = EC_FEATURE_UCSI_PPM,
> - .mfd_cells = cros_ec_ucsi_cells,
> - .num_cells = ARRAY_SIZE(cros_ec_ucsi_cells),
> - },
> {
> .id = EC_FEATURE_HANG_DETECT,
> .mfd_cells = cros_ec_wdt_cells,
> @@ -264,6 +260,23 @@ static int ec_device_probe(struct platform_device *pdev)
> }
> }
>
> + /*
> + * FW nodes can load cros_ec_ucsi, but early PDC devices did not define
> + * the required nodes. On PDC systems without FW nodes for cros_ec_ucsi,
> + * the driver should be added as an mfd subdevice.
> + */
> + if (cros_ec_check_features(ec, EC_FEATURE_USB_PD) &&
> + cros_ec_check_features(ec, EC_FEATURE_UCSI_PPM) &&
> + !acpi_dev_found("GOOG0021") &&
> + !of_find_compatible_node(NULL, NULL, "google,cros-ec-ucsi")) {
> + retval = mfd_add_hotplug_devices(ec->dev,
> + cros_ec_ucsi_cells,
> + ARRAY_SIZE(cros_ec_ucsi_cells));
> +
> + if (retval)
> + dev_warn(ec->dev, "failed to add cros_ec_ucsi: %d\n", retval);
> + }
> +
> /*
> * UCSI provides power supply information so we don't need to separately
> * load the cros_usbpd_charger driver.
> --
> 2.51.0.710.ga91ca5db03-goog
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 1/3] dt-bindings: chrome: Add cros-ec-ucsi compatibility to typec binding
2025-10-09 1:03 ` [PATCH v3 1/3] dt-bindings: chrome: Add cros-ec-ucsi compatibility to typec binding Jameson Thies
2025-10-09 19:09 ` Benson Leung
@ 2025-10-10 17:54 ` Rob Herring (Arm)
1 sibling, 0 replies; 15+ messages in thread
From: Rob Herring (Arm) @ 2025-10-10 17:54 UTC (permalink / raw)
To: Jameson Thies
Cc: tzungbi, akuchynski, linux-kernel, devicetree, linux-usb, krzk+dt,
chrome-platform, bleung, abhishekpandit, heikki.krogerus, ukaszb
On Thu, 09 Oct 2025 01:03:06 +0000, Jameson Thies wrote:
> Chrome OS devices with discrete power delivery controllers (PDCs) allow
> the host to read port status and control port behavior through a USB
> Type-C Connector System Software (UCSI) interface with the embedded
> controller (EC). This uses a separate interface driver than other
> Chrome OS devices with a Type-C port manager in the EC FW. Those use
> a host command interface supported by cros-ec-typec. Add a cros-ec-ucsi
> compatibility string to the existing cros-ec-typec binding.
>
> Additionally, update maintainer list to reflect cros-ec-ucsi and
> cros-ec-typec driver maintainers.
>
> Signed-off-by: Jameson Thies <jthies@google.com>
> ---
> .../bindings/chrome/google,cros-ec-typec.yaml | 19 +++++++++++++++----
> 1 file changed, 15 insertions(+), 4 deletions(-)
>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 3/3] mfd: cros_ec: Don't add cros_ec_ucsi if it is defined in OF or ACPI
2025-10-10 17:38 ` Dmitry Baryshkov
@ 2025-10-10 23:42 ` Jameson Thies
0 siblings, 0 replies; 15+ messages in thread
From: Jameson Thies @ 2025-10-10 23:42 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: akuchynski, abhishekpandit, krzk+dt, robh, bleung,
heikki.krogerus, ukaszb, tzungbi, devicetree, chrome-platform,
linux-usb, linux-kernel
> It still can be a subdevice of the EC, if it has a correct DT node.
That's correct. What I meant to say in the commit message is that it
does not need to be added as a subdevice of the cros_ec_dev mfd. I'll
clarify the commit message in the v4 series.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 2/3] usb: typec: cros_ec_ucsi: Load driver from OF and ACPI definitions
2025-10-10 17:37 ` Dmitry Baryshkov
@ 2025-10-11 0:10 ` Jameson Thies
2025-10-11 1:22 ` Dmitry Baryshkov
0 siblings, 1 reply; 15+ messages in thread
From: Jameson Thies @ 2025-10-11 0:10 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: akuchynski, abhishekpandit, krzk+dt, robh, bleung,
heikki.krogerus, ukaszb, tzungbi, devicetree, chrome-platform,
linux-usb, linux-kernel
Hi Dmitry,
on early ChromeOS devices using this driver it gets added as a
subdevice of the cros_ec_dev mfd. But, we want to change this to load
the device from OF/ACPI nodes. The issue here is that older devices
which don't define the OF/ACPI nodes to load cros_ec_ucsi will still
need to add the device through cros_ec_dev.
So cros_ec_ucsi needs to support multiple methods of being
instantiated, and going through cros_ec_dev creates an intermediary
device in the path which doesn't exist when the driver is loaded
through OF/ACPI. I'll add a comment explaining this in the v4 series.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 2/3] usb: typec: cros_ec_ucsi: Load driver from OF and ACPI definitions
2025-10-11 0:10 ` Jameson Thies
@ 2025-10-11 1:22 ` Dmitry Baryshkov
2025-10-13 19:49 ` Jameson Thies
0 siblings, 1 reply; 15+ messages in thread
From: Dmitry Baryshkov @ 2025-10-11 1:22 UTC (permalink / raw)
To: Jameson Thies
Cc: akuchynski, abhishekpandit, krzk+dt, robh, bleung,
heikki.krogerus, ukaszb, tzungbi, devicetree, chrome-platform,
linux-usb, linux-kernel
On Fri, Oct 10, 2025 at 05:10:13PM -0700, Jameson Thies wrote:
> Hi Dmitry,
> on early ChromeOS devices using this driver it gets added as a
> subdevice of the cros_ec_dev mfd. But, we want to change this to load
> the device from OF/ACPI nodes. The issue here is that older devices
> which don't define the OF/ACPI nodes to load cros_ec_ucsi will still
> need to add the device through cros_ec_dev.
IIRC, MFD devices support binding subdevices to the OF nodes. Do you
plan to use it? Could you possibly point out the example DTs?
>
> So cros_ec_ucsi needs to support multiple methods of being
> instantiated, and going through cros_ec_dev creates an intermediary
> device in the path which doesn't exist when the driver is loaded
> through OF/ACPI. I'll add a comment explaining this in the v4 series.
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 2/3] usb: typec: cros_ec_ucsi: Load driver from OF and ACPI definitions
2025-10-11 1:22 ` Dmitry Baryshkov
@ 2025-10-13 19:49 ` Jameson Thies
2025-10-13 20:21 ` Dmitry Baryshkov
0 siblings, 1 reply; 15+ messages in thread
From: Jameson Thies @ 2025-10-13 19:49 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: akuchynski, abhishekpandit, krzk+dt, robh, bleung,
heikki.krogerus, ukaszb, tzungbi, devicetree, chrome-platform,
linux-usb, linux-kernel
> IIRC, MFD devices support binding subdevices to the OF nodes. Do you
> plan to use it? Could you possibly point out the example DTs?
I'm not planning to add this, we want to move away from using the
cros_ec_dev mfd to load cros_ec_ucsi. On upcoming devices using
cros_ec_ucsi will just be loaded based on ACPI/DT. Regarding example
DTs, I'll point this out in the comment.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 2/3] usb: typec: cros_ec_ucsi: Load driver from OF and ACPI definitions
2025-10-13 19:49 ` Jameson Thies
@ 2025-10-13 20:21 ` Dmitry Baryshkov
0 siblings, 0 replies; 15+ messages in thread
From: Dmitry Baryshkov @ 2025-10-13 20:21 UTC (permalink / raw)
To: Jameson Thies
Cc: akuchynski, abhishekpandit, krzk+dt, robh, bleung,
heikki.krogerus, ukaszb, tzungbi, devicetree, chrome-platform,
linux-usb, linux-kernel
On 13/10/2025 22:49, Jameson Thies wrote:
>> IIRC, MFD devices support binding subdevices to the OF nodes. Do you
>> plan to use it? Could you possibly point out the example DTs?
>
> I'm not planning to add this, we want to move away from using the
> cros_ec_dev mfd to load cros_ec_ucsi. On upcoming devices using
> cros_ec_ucsi will just be loaded based on ACPI/DT. Regarding example
> DTs, I'll point this out in the comment.
Ack, thanks for the explanation. It might be a good idea to add
something similar to the commit message.
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2025-10-13 20:21 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-09 1:03 [PATCH v3 0/3] Load cros_ec_ucsi from OF and ACPI definitions Jameson Thies
2025-10-09 1:03 ` [PATCH v3 1/3] dt-bindings: chrome: Add cros-ec-ucsi compatibility to typec binding Jameson Thies
2025-10-09 19:09 ` Benson Leung
2025-10-10 17:54 ` Rob Herring (Arm)
2025-10-09 1:03 ` [PATCH v3 2/3] usb: typec: cros_ec_ucsi: Load driver from OF and ACPI definitions Jameson Thies
2025-10-09 19:12 ` Benson Leung
2025-10-10 17:37 ` Dmitry Baryshkov
2025-10-11 0:10 ` Jameson Thies
2025-10-11 1:22 ` Dmitry Baryshkov
2025-10-13 19:49 ` Jameson Thies
2025-10-13 20:21 ` Dmitry Baryshkov
2025-10-09 1:03 ` [PATCH v3 3/3] mfd: cros_ec: Don't add cros_ec_ucsi if it is defined in OF or ACPI Jameson Thies
2025-10-09 19:13 ` Benson Leung
2025-10-10 17:38 ` Dmitry Baryshkov
2025-10-10 23:42 ` Jameson Thies
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).