* [PATCH v4 1/3] dt-bindings: chrome: Add cros-ec-ucsi compatibility to typec binding
2025-10-13 20:33 [PATCH v4 0/3] Load cros_ec_ucsi from OF and ACPI definitions Jameson Thies
@ 2025-10-13 20:33 ` Jameson Thies
2025-11-06 17:28 ` Benson Leung
2025-10-13 20:33 ` [PATCH v4 2/3] usb: typec: cros_ec_ucsi: Load driver from OF and ACPI definitions Jameson Thies
2025-10-13 20:33 ` [PATCH v4 3/3] mfd: cros_ec: Don't add cros_ec_ucsi if it is defined in OF or ACPI Jameson Thies
2 siblings, 1 reply; 8+ messages in thread
From: Jameson Thies @ 2025-10-13 20:33 UTC (permalink / raw)
To: dmitry.baryshkov, 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>
Reviewed-by: Rob Herring (Arm) <robh@kernel.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.858.gf9c4a03a3a-goog
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH v4 1/3] dt-bindings: chrome: Add cros-ec-ucsi compatibility to typec binding
2025-10-13 20:33 ` [PATCH v4 1/3] dt-bindings: chrome: Add cros-ec-ucsi compatibility to typec binding Jameson Thies
@ 2025-11-06 17:28 ` Benson Leung
2025-11-06 18:21 ` Abhishek Pandit-Subedi
0 siblings, 1 reply; 8+ messages in thread
From: Benson Leung @ 2025-11-06 17:28 UTC (permalink / raw)
To: Jameson Thies
Cc: dmitry.baryshkov, akuchynski, abhishekpandit, krzk+dt, robh,
bleung, heikki.krogerus, ukaszb, tzungbi, devicetree,
chrome-platform, linux-usb, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2854 bytes --]
Hi Jameson,
On Mon, Oct 13, 2025 at 08:33:25PM +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: Rob Herring (Arm) <robh@kernel.org>
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.858.gf9c4a03a3a-goog
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v4 1/3] dt-bindings: chrome: Add cros-ec-ucsi compatibility to typec binding
2025-11-06 17:28 ` Benson Leung
@ 2025-11-06 18:21 ` Abhishek Pandit-Subedi
0 siblings, 0 replies; 8+ messages in thread
From: Abhishek Pandit-Subedi @ 2025-11-06 18:21 UTC (permalink / raw)
To: Benson Leung
Cc: Jameson Thies, dmitry.baryshkov, akuchynski, krzk+dt, robh,
bleung, heikki.krogerus, ukaszb, tzungbi, devicetree,
chrome-platform, linux-usb, linux-kernel
On Thu, Nov 6, 2025 at 9:28 AM Benson Leung <bleung@google.com> wrote:
>
> Hi Jameson,
>
> On Mon, Oct 13, 2025 at 08:33:25PM +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: Rob Herring (Arm) <robh@kernel.org>
>
> 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.858.gf9c4a03a3a-goog
> >
Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v4 2/3] usb: typec: cros_ec_ucsi: Load driver from OF and ACPI definitions
2025-10-13 20:33 [PATCH v4 0/3] Load cros_ec_ucsi from OF and ACPI definitions Jameson Thies
2025-10-13 20:33 ` [PATCH v4 1/3] dt-bindings: chrome: Add cros-ec-ucsi compatibility to typec binding Jameson Thies
@ 2025-10-13 20:33 ` Jameson Thies
2025-11-06 18:17 ` Abhishek Pandit-Subedi
2025-10-13 20:33 ` [PATCH v4 3/3] mfd: cros_ec: Don't add cros_ec_ucsi if it is defined in OF or ACPI Jameson Thies
2 siblings, 1 reply; 8+ messages in thread
From: Jameson Thies @ 2025-10-13 20:33 UTC (permalink / raw)
To: dmitry.baryshkov, 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>
Reviewed-by: Benson Leung <bleung@chromium.org>
---
drivers/usb/typec/ucsi/cros_ec_ucsi.c | 26 ++++++++++++++++++++++++--
1 file changed, 24 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..0c19ba84d11c 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;
@@ -243,9 +244,16 @@ static int cros_ucsi_probe(struct platform_device *pdev)
if (!udata)
return -ENOMEM;
+ /* ACPI and OF FW nodes for cros_ec_ucsi are children of the ChromeOS EC. If the
+ * cros_ec_ucsi device has an ACPI or OF FW node, its parent is the ChromeOS EC device.
+ * Platforms without a FW node for cros_ec_ucsi may add it as a subdevice of cros_ec_dev.
+ */
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 +334,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.858.gf9c4a03a3a-goog
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH v4 2/3] usb: typec: cros_ec_ucsi: Load driver from OF and ACPI definitions
2025-10-13 20:33 ` [PATCH v4 2/3] usb: typec: cros_ec_ucsi: Load driver from OF and ACPI definitions Jameson Thies
@ 2025-11-06 18:17 ` Abhishek Pandit-Subedi
0 siblings, 0 replies; 8+ messages in thread
From: Abhishek Pandit-Subedi @ 2025-11-06 18:17 UTC (permalink / raw)
To: Jameson Thies
Cc: dmitry.baryshkov, akuchynski, krzk+dt, robh, bleung,
heikki.krogerus, ukaszb, tzungbi, devicetree, chrome-platform,
linux-usb, linux-kernel
On Mon, Oct 13, 2025 at 1:34 PM Jameson Thies <jthies@google.com> 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 | 26 ++++++++++++++++++++++++--
> 1 file changed, 24 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..0c19ba84d11c 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;
>
> @@ -243,9 +244,16 @@ static int cros_ucsi_probe(struct platform_device *pdev)
> if (!udata)
> return -ENOMEM;
>
> + /* ACPI and OF FW nodes for cros_ec_ucsi are children of the ChromeOS EC. If the
> + * cros_ec_ucsi device has an ACPI or OF FW node, its parent is the ChromeOS EC device.
> + * Platforms without a FW node for cros_ec_ucsi may add it as a subdevice of cros_ec_dev.
> + */
> 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 +334,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.858.gf9c4a03a3a-goog
>
Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v4 3/3] mfd: cros_ec: Don't add cros_ec_ucsi if it is defined in OF or ACPI
2025-10-13 20:33 [PATCH v4 0/3] Load cros_ec_ucsi from OF and ACPI definitions Jameson Thies
2025-10-13 20:33 ` [PATCH v4 1/3] dt-bindings: chrome: Add cros-ec-ucsi compatibility to typec binding Jameson Thies
2025-10-13 20:33 ` [PATCH v4 2/3] usb: typec: cros_ec_ucsi: Load driver from OF and ACPI definitions Jameson Thies
@ 2025-10-13 20:33 ` Jameson Thies
2025-11-06 18:18 ` Abhishek Pandit-Subedi
2 siblings, 1 reply; 8+ messages in thread
From: Jameson Thies @ 2025-10-13 20:33 UTC (permalink / raw)
To: dmitry.baryshkov, 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 mfd. cros_ec_ucsi will load from the OF or ACPI node.
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.858.gf9c4a03a3a-goog
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH v4 3/3] mfd: cros_ec: Don't add cros_ec_ucsi if it is defined in OF or ACPI
2025-10-13 20:33 ` [PATCH v4 3/3] mfd: cros_ec: Don't add cros_ec_ucsi if it is defined in OF or ACPI Jameson Thies
@ 2025-11-06 18:18 ` Abhishek Pandit-Subedi
0 siblings, 0 replies; 8+ messages in thread
From: Abhishek Pandit-Subedi @ 2025-11-06 18:18 UTC (permalink / raw)
To: Jameson Thies
Cc: dmitry.baryshkov, akuchynski, krzk+dt, robh, bleung,
heikki.krogerus, ukaszb, tzungbi, devicetree, chrome-platform,
linux-usb, linux-kernel
On Mon, Oct 13, 2025 at 1:34 PM Jameson Thies <jthies@google.com> 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 mfd. cros_ec_ucsi will load from the OF or ACPI node.
>
> 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.858.gf9c4a03a3a-goog
>
Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
^ permalink raw reply [flat|nested] 8+ messages in thread