* [PATCH v1 1/3] dt-bindings: chrome: Add Cros EC UCSI driver
2025-09-30 1:23 [PATCH v1 0/3] Load cros_ec_ucsi from OF and ACPI definitions Jameson Thies
@ 2025-09-30 1:23 ` Jameson Thies
2025-09-30 4:36 ` Rob Herring (Arm)
2025-09-30 1:23 ` [PATCH v1 2/3] usb: typec: cros_ec_ucsi: Load driver from OF and ACPI definitions Jameson Thies
2025-09-30 1:23 ` [PATCH v1 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; 6+ messages in thread
From: Jameson Thies @ 2025-09-30 1:23 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 PDCs allow the host to read port status and
control port behavior with UCSI commands sent to the embedded controller
(EC). Add documentation for cros-ec-ucsi node which loads the Chrome OS
UCSI driver.
Signed-off-by: Jameson Thies <jthies@google.com>
---
.../bindings/chrome/google,cros-ec-ucsi.yaml | 71 +++++++++++++++++++
1 file changed, 71 insertions(+)
create mode 100644 Documentation/devicetree/bindings/chrome/google,cros-ec-ucsi.yaml
diff --git a/Documentation/devicetree/bindings/chrome/google,cros-ec-ucsi.yaml b/Documentation/devicetree/bindings/chrome/google,cros-ec-ucsi.yaml
new file mode 100644
index 000000000000..2121776e3ff0
--- /dev/null
+++ b/Documentation/devicetree/bindings/chrome/google,cros-ec-ucsi.yaml
@@ -0,0 +1,71 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/chrome/google,cros-ec-ucsi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Google Chrome OS EC(Embedded Controller) UCSI driver.
+
+maintainers:
+ - Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
+ - Andrei Kuchynski <akuchynski@chromium.org>
+ - Benson Leung <bleung@chromium.org>
+ - Jameson Thies <jthies@google.com>
+ - Łukasz Bartosik <ukaszb@chromium.org>
+
+description:
+ Chrome OS devices with PDC-based USB-C ports expose a UCSI interface
+ from the Embedded Controller (EC) which allows the host to request
+ port state and control limited port behavior (DR/PR swap). This node
+ allows the host UCSI driver to send and receive UCSI commands to a
+ Chrome OS EC. The node for this device should be under a cros-ec node
+ like google,cros-ec-spi.
+
+properties:
+ compatible:
+ const: google,cros-ec-ucsi
+
+ '#address-cells':
+ const: 1
+
+ '#size-cells':
+ const: 0
+
+patternProperties:
+ '^connector@[0-9a-f]+$':
+ $ref: /schemas/connector/usb-connector.yaml#
+ required:
+ - reg
+
+required:
+ - compatible
+
+additionalProperties: false
+
+examples:
+ - |+
+ spi {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ cros_ec: ec@0 {
+ compatible = "google,cros-ec-spi";
+ reg = <0>;
+ interrupts = <35 0>;
+
+ typec {
+ compatible = "google,cros-ec-ucsi";
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ connector@0 {
+ compatible = "usb-c-connector";
+ reg = <0>;
+ power-role = "dual";
+ data-role = "dual";
+ try-power-role = "source";
+ };
+ };
+ };
+ };
--
2.51.0.570.gb178f27e6d-goog
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH v1 1/3] dt-bindings: chrome: Add Cros EC UCSI driver
2025-09-30 1:23 ` [PATCH v1 1/3] dt-bindings: chrome: Add Cros EC UCSI driver Jameson Thies
@ 2025-09-30 4:36 ` Rob Herring (Arm)
2025-09-30 22:55 ` Jameson Thies
0 siblings, 1 reply; 6+ messages in thread
From: Rob Herring (Arm) @ 2025-09-30 4:36 UTC (permalink / raw)
To: Jameson Thies
Cc: devicetree, bleung, heikki.krogerus, ukaszb, linux-usb,
akuchynski, tzungbi, krzk+dt, linux-kernel, abhishekpandit,
chrome-platform
On Tue, 30 Sep 2025 01:23:46 +0000, Jameson Thies wrote:
> Chrome OS devices with PDCs allow the host to read port status and
> control port behavior with UCSI commands sent to the embedded controller
> (EC). Add documentation for cros-ec-ucsi node which loads the Chrome OS
> UCSI driver.
>
> Signed-off-by: Jameson Thies <jthies@google.com>
> ---
> .../bindings/chrome/google,cros-ec-ucsi.yaml | 71 +++++++++++++++++++
> 1 file changed, 71 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/chrome/google,cros-ec-ucsi.yaml
>
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/chrome/google,cros-ec-ucsi.example.dtb: ec@0 (google,cros-ec-spi): typec:compatible:0: 'google,cros-ec-typec' was expected
from schema $id: http://devicetree.org/schemas/mfd/google,cros-ec.yaml#
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20250930012352.413066-2-jthies@google.com
The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1 1/3] dt-bindings: chrome: Add Cros EC UCSI driver
2025-09-30 4:36 ` Rob Herring (Arm)
@ 2025-09-30 22:55 ` Jameson Thies
0 siblings, 0 replies; 6+ messages in thread
From: Jameson Thies @ 2025-09-30 22:55 UTC (permalink / raw)
To: Rob Herring (Arm)
Cc: devicetree, bleung, heikki.krogerus, ukaszb, linux-usb,
akuchynski, tzungbi, krzk+dt, linux-kernel, abhishekpandit,
chrome-platform
> My bot found errors running 'make dt_binding_check' on your patch:
Thanks for catching this. I did run "make dt_binding_check
DT_SCHEMA_FILES=google,cros-ec-ucsi.yaml" to check the newly added
yaml file. But I didn't check google,cros-ec.yaml or any of the DTS
files with "make dtbs_check" so I missed this regression. I'll follow
up with a v2 series and test all bindings with "make dt_binding_check"
and "make dtbs_check".
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v1 2/3] usb: typec: cros_ec_ucsi: Load driver from OF and ACPI definitions
2025-09-30 1:23 [PATCH v1 0/3] Load cros_ec_ucsi from OF and ACPI definitions Jameson Thies
2025-09-30 1:23 ` [PATCH v1 1/3] dt-bindings: chrome: Add Cros EC UCSI driver Jameson Thies
@ 2025-09-30 1:23 ` Jameson Thies
2025-09-30 1:23 ` [PATCH v1 3/3] mfd: cros_ec: Don't add cros_ec_ucsi if it is defined in OF or ACPI Jameson Thies
2 siblings, 0 replies; 6+ messages in thread
From: Jameson Thies @ 2025-09-30 1:23 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>
---
drivers/usb/typec/ucsi/cros_ec_ucsi.c | 25 +++++++++++++++++++++++--
1 file changed, 23 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..3d19560bbaa7 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,7 @@ 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_ec_dev *ec_data;
struct cros_ucsi_data *udata;
int ret;
@@ -244,8 +246,13 @@ 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(pdev->dev.parent);
+ } else {
+ ec_data = dev_get_drvdata(dev->parent);
+ udata->ec = ec_data->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 +333,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.570.gb178f27e6d-goog
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH v1 3/3] mfd: cros_ec: Don't add cros_ec_ucsi if it is defined in OF or ACPI
2025-09-30 1:23 [PATCH v1 0/3] Load cros_ec_ucsi from OF and ACPI definitions Jameson Thies
2025-09-30 1:23 ` [PATCH v1 1/3] dt-bindings: chrome: Add Cros EC UCSI driver Jameson Thies
2025-09-30 1:23 ` [PATCH v1 2/3] usb: typec: cros_ec_ucsi: Load driver from OF and ACPI definitions Jameson Thies
@ 2025-09-30 1:23 ` Jameson Thies
2 siblings, 0 replies; 6+ messages in thread
From: Jameson Thies @ 2025-09-30 1:23 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 | 40 ++++++++++++++++++++++++++++++++++-----
1 file changed, 35 insertions(+), 5 deletions(-)
diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
index dc80a272726b..b0523f6541d2 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,
@@ -177,6 +173,16 @@ static const struct mfd_cell cros_ec_vbc_cells[] = {
{ .name = "cros-ec-vbc", }
};
+static int ucsi_acpi_match(struct device *dev, const void *data)
+{
+ struct acpi_device_id ucsi_acpi_device_ids[] = {
+ { "GOOG0021", 0 },
+ {"", 0},
+ };
+ return !!acpi_match_device(ucsi_acpi_device_ids, dev);
+}
+
+
static void cros_ec_class_release(struct device *dev)
{
kfree(to_cros_ec_dev(dev));
@@ -264,6 +270,30 @@ 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)) {
+ struct device *acpi_dev = device_find_child(ec->ec_dev->dev,
+ NULL,
+ ucsi_acpi_match);
+
+ if (!!acpi_dev) {
+ put_device(acpi_dev);
+ } else if (!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.570.gb178f27e6d-goog
^ permalink raw reply related [flat|nested] 6+ messages in thread