Skip to contentSkip to conversation

platform/chrome: Add ChromeOS EC USB driver

PATCH Superseded Dawid Niedzwiecki 1 participant 1 message Aug 4, 2025

Subsystems (2)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 platform/chrome: Add ChromeOS EC USB driver

Use USB to talk to the ChromeOS EC. The protocol is defined by the EC and is fairly simple, with a length byte, checksum, command byte and version byte in the header.

Use vendor defined usb interface with in/out endpoints to transfer requests and responses. Also use one interrupt in endpoint which signals readiness of response and pending events on the EC side.

---
V2 -> V3:
- Fix getting USB PID
- Use a proper device pointer in the devm_kzalloc call
- Improve feeing memory

 drivers/platform/chrome/Kconfig       |  11 +
 drivers/platform/chrome/Makefile      |   1 +
 drivers/platform/chrome/cros_ec_usb.c | 586 ++++++++++++++++++++++++++
 3 files changed, 598 insertions(+)
 create mode 100644 drivers/platform/chrome/cros_ec_usb.c
drivers/platform/chrome/Kconfig +11 -0
index 2281d6dacc9b..e77f06f13fc4 100644
@@ -316,6 +316,17 @@ config CROS_TYPEC_SWITCH
 	  To compile this driver as a module, choose M here: the module will be
 	  called cros_typec_switch.
 
+config CROS_EC_USB
+	tristate "ChromeOS Embedded Controller (USB)"
+	depends on CROS_EC && USB
+	help
+	  If you say Y here, you get support for talking to the ChromeOS EC
+	  through a USB. The driver uses vendor defined interface and is capable
+	  of signaling events from EC.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called cros_ec_usb.
+
 source "drivers/platform/chrome/wilco_ec/Kconfig"
 
 # Kunit test cases
drivers/platform/chrome/Makefile +1 -0
index b981a1bb5bd8..444383e8912d 100644
@@ -38,6 +38,7 @@ obj-$(CONFIG_CROS_EC_SYSFS)		+= cros_ec_sysfs.o
 obj-$(CONFIG_CROS_HPS_I2C)		+= cros_hps_i2c.o
 obj-$(CONFIG_CROS_USBPD_LOGGER)		+= cros_usbpd_logger.o
 obj-$(CONFIG_CROS_USBPD_NOTIFY)		+= cros_usbpd_notify.o
+obj-$(CONFIG_CROS_EC_USB)		+= cros_ec_usb.o
 
 obj-$(CONFIG_WILCO_EC)			+= wilco_ec/
 
drivers/platform/chrome/cros_ec_usb.c new file +586 -0

586 lines not on this page · raw message

Signature · 1 line
2.50.1.565.gc32cd1483b-goog