Add ITE885x UCSI I2C transport driver
Subsystems (3)
v3 cover Add ITE885x UCSI I2C transport driver
Some ASUS desktop boards describe the same ITE USB-C controller twice in ACPI: as an MSFT8000 Resource Hub Proxy and as an ITE885x device at the same I2C address. If the Resource Hub Proxy claims the address first, the ITE device cannot be registered. Only the ITE node provides the interrupt required by this transport.
Patch 1 handles MSFT8000 generically in the ACPI core. It keeps the ACPI device present but prevents its SerialBus resources from being instantiated as I2C, SPI or serdev clients.
Patch 2 adds the ITE885x UCSI transport. These controllers use ITE-specific offsets for CCI, MESSAGE_IN, CONTROL and interrupt handling. They do not expose a VERSION register or accept PPM_RESET over I2C.
The register layout and reset behaviour were checked against the ITE Windows driver supplied for this board.
Tested on an ASUS ROG Strix Z790-E Gaming WiFi with ITE8853:
- Built and booted on x86_64.
- ucsi_ite bound to ITE8853:00 without the previous -EBUSY failure.
- /sys/class/typec/port0 was registered.
- USB-C attachment detection worked.
- No UCSI, ITE or Type-C initialization errors were logged.
Suspend/resume and the ITE8800 through ITE8805 IDs have not been tested.
Changes in v3:
- Rework patch 1 as suggested by Armin: add MSFT8000 to ignore_serial_bus_ids[] in acpi_device_enumeration_by_parent().
- Keep the MSFT8000 ACPI device present while preventing its SerialBus resources from being instantiated as bus clients.
- Drop the ITE-specific ACPI x86 status override added in v2.
- Add a comment explaining why MSFT8000 is ignored during serial bus enumeration.
- Rebase onto current mainline and retest the series.
- Patch 2 is unchanged apart from the rebase.
Changes in v2:
- Move the v1 duplicate-device handling from the I2C core to the ACPI x86 status-override code, as suggested by Mika and Heikki.
- Correctly identify MSFT8000 as a Resource Hub Proxy.
- Restrict the quirk to exact matching I2C resources.
- Use devm_request_threaded_irq(), as suggested by Heikki.
- Rebase onto Linux 7.2 and update for the current UCSI API.
- Read and cache complete UCSI events before acknowledging them.
- Match the vendor transport's MESSAGE_IN and PPM_RESET behaviour.
Changes in v1:
- Initial submission.
v2: https://lore.kernel.org/all/[email protected]/
v1: https://lore.kernel.org/all/[email protected]/
Edward Blair (2):
ACPI: scan: do not enumerate MSFT8000 as a serial bus slave
usb: typec: ucsi: add ITE885x I2C transport driver
drivers/acpi/scan.c | 5 + drivers/usb/typec/ucsi/Kconfig | 11 + drivers/usb/typec/ucsi/Makefile | 1 + drivers/usb/typec/ucsi/ucsi_ite.c | 395 ++++++++++++++++++++++++++++++ 4 files changed, 412 insertions(+) create mode 100644 drivers/usb/typec/ucsi/ucsi_ite.c
base-commit: 1b78070aaef63512688aebfbc82365ef9d6660f1
Signature · 1 line
2.55.0
PATCH v3 1/2 ACPI: scan: do not enumerate MSFT8000 as a serial bus slave
MSFT8000 represents the Windows Resource Hub Proxy. Its SerialBus resources describe connections that Windows exposes to userspace rather than a physical peripheral attached to a serial bus.
Treat the device like other ACPI nodes which contain SerialBus resources without being serial bus slaves. This keeps the ACPI device present while preventing the resources from being instantiated as I2C, SPI or serdev clients and conflicting with the actual devices.
--- drivers/acpi/scan.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/acpi/scan.c +5 -0
@@ -1770,6 +1770,11 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device)* attached to a serial bus at all. */ {"MSHW0028", }, + /* + * MSFT8000 is a Windows Resource Hub Proxy device. Its SerialBus + * resources grant userspace access and do not describe a slave. + */ + {"MSFT8000", }, /* * HIDs of device with an UartSerialBusV2 resource for which userspace * expects a regular tty cdev to be created (instead of the in kernel
Signature · 1 line
2.55.0
Re: [PATCH v3 1/2] ACPI: scan: do not enumerate MSFT8000 as a serial bus slave
Am 29.08.26 um 16:55 schrieb Edward Blair:
Quoted 8 lines
MSFT8000 represents the Windows Resource Hub Proxy. Its SerialBus resources describe connections that Windows exposes to userspace rather than a physical peripheral attached to a serial bus.
Treat the device like other ACPI nodes which contain SerialBus resources without being serial bus slaves. This keeps the ACPI device present while preventing the resources from being instantiated as I2C, SPI or serdev clients and conflicting with the actual devices.
Quoted 22 lines
Suggested-by Armin Wolf <[email protected]>Signed-off-by Edward Blair <[email protected]>--- drivers/acpi/scan.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/acpi/scan.c +5
-0@@ -1770,6 +1770,11 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device)* attached to a serial bus at all. */ {"MSHW0028", }, + /* + * MSFT8000 is a Windows Resource Hub Proxy device. Its SerialBus + * resources grant userspace access and do not describe a slave. + */ + {"MSFT8000", }, /* * HIDs of device with an UartSerialBusV2 resource for which userspace * expects a regular tty cdev to be created (instead of the in kernel
Re: [PATCH v3 1/2] ACPI: scan: do not enumerate MSFT8000 as a serial bus slave
In reply to Edward BlairQuoted 5 lines · Edward Blair
MSFT8000 represents the Windows Resource Hub Proxy. Its SerialBus resources describe connections that Windows exposes to userspace rather than a physical peripheral attached to a serial bus.
Quoted 7 lines
Treat the device like other ACPI nodes which contain SerialBus resources without being serial bus slaves. This keeps the ACPI device present while preventing the resources from being instantiated as I2C, SPI or serdev clients and conflicting with the actual devices.
Suggested-by Armin Wolf <[email protected]>Signed-off-by Edward Blair <[email protected]>
and please route it as needed or let me know if you want me to pick it up.
Thanks!
Quoted 23 lines
--- drivers/acpi/scan.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/acpi/scan.c +5
-1@@ -1770,6 +1770,11 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device)* attached to a serial bus at all. */ {"MSHW0028", }, + /* + * MSFT8000 is a Windows Resource Hub Proxy device. Its SerialBus + * resources grant userspace access and do not describe a slave. + */ + {"MSFT8000", }, /* * HIDs of device with an UartSerialBusV2 resource for which userspace * expects a regular tty cdev to be created (instead of the in kernel -- 2.55.0
PATCH v3 2/2 usb: typec: ucsi: add ITE885x I2C transport driver
In reply to Edward BlairAdd a UCSI transport driver for ITE8853 and ITE8800 through ITE8805 USB Type-C controllers found on desktop motherboards.
These controllers expose CCI, MESSAGE_IN and CONTROL at ITE-specific I2C offsets and signal UCSI and vendor events through a shared interrupt status register. Read and cache each complete UCSI event before acknowledging it so command data remains coherent between the interrupt handler and UCSI core.
The interface does not expose a VERSION register and does not accept PPM_RESET over I2C. Report UCSI 1.0, limit MESSAGE_IN to its 16-byte window and handle PPM_RESET locally, matching the vendor driver's behavior.
--- drivers/usb/typec/ucsi/Kconfig | 11 + drivers/usb/typec/ucsi/Makefile | 1 + drivers/usb/typec/ucsi/ucsi_ite.c | 395 ++++++++++++++++++++++++++++++ 3 files changed, 407 insertions(+) create mode 100644 drivers/usb/typec/ucsi/ucsi_ite.c
drivers/usb/typec/ucsi/Kconfig +11 -0
@@ -104,4 +104,15 @@ config UCSI_HUAWEI_GAOKUN To compile the driver as a module, choose M here: the module will be called ucsi_huawei_gaokun. +config UCSI_ITE + tristate "UCSI Interface Driver for ITE885x" + depends on ACPI && I2C + help + This driver enables UCSI support on platforms that expose an ITE8853 + or ITE8800-ITE8805 USB Type-C controller over I2C, commonly found + on ASUS Z690/Z790/X670E motherboards. + + To compile the driver as a module, choose M here: the module will be + called ucsi_ite. + endif
drivers/usb/typec/ucsi/Makefile +1 -0
@@ -28,3 +28,4 @@ obj-$(CONFIG_UCSI_PMIC_GLINK) += ucsi_glink.o obj-$(CONFIG_CROS_EC_UCSI) += cros_ec_ucsi.o obj-$(CONFIG_UCSI_LENOVO_YOGA_C630) += ucsi_yoga_c630.o obj-$(CONFIG_UCSI_HUAWEI_GAOKUN) += ucsi_huawei_gaokun.o +obj-$(CONFIG_UCSI_ITE) += ucsi_ite.o
drivers/usb/typec/ucsi/ucsi_ite.c new file +395 -0
395 lines not on this page · raw message
Signature · 1 line
2.55.0
Heikki Krogerus
maintainerRe: [PATCH v3 2/2] usb: typec: ucsi: add ITE885x I2C transport driver
Quoted 61 lines · Edward Blair
Add a UCSI transport driver for ITE8853 and ITE8800 through ITE8805 USB Type-C controllers found on desktop motherboards.
These controllers expose CCI,
MESSAGE_INand CONTROL at ITE-specific I2C offsets and signal UCSI and vendor events through a shared interrupt status register. Read and cache each complete UCSI event before acknowledging it so command data remains coherent between the interrupt handler and UCSI core.The interface does not expose a VERSION register and does not accept
PPM_RESETover I2C. Report UCSI 1.0, limitMESSAGE_INto its 16-byte window and handlePPM_RESETlocally, matching the vendor driver's behavior.Signed-off-by Edward Blair <[email protected]>--- drivers/usb/typec/ucsi/Kconfig | 11 + drivers/usb/typec/ucsi/Makefile | 1 + drivers/usb/typec/ucsi/ucsi_ite.c | 395 ++++++++++++++++++++++++++++++ 3 files changed, 407 insertions(+) create mode 100644 drivers/usb/typec/ucsi/ucsi_ite.cdrivers/usb/typec/ucsi/Kconfig +11
-0@@ -104,4 +104,15 @@ config UCSI_HUAWEI_GAOKUN To compile the driver as a module, choose M here: the module will be called ucsi_huawei_gaokun. +config UCSI_ITE + tristate "UCSI Interface Driver for ITE885x" + depends on ACPI && I2C + help + This driver enables UCSI support on platforms that expose an ITE8853 + or ITE8800-ITE8805 USB Type-C controller over I2C, commonly found + on ASUS Z690/Z790/X670E motherboards. + + To compile the driver as a module, choose M here: the module will be + called ucsi_ite. + endifdrivers/usb/typec/ucsi/Makefile +1
-0@@ -28,3 +28,4 @@ obj-$(CONFIG_UCSI_PMIC_GLINK) += ucsi_glink.o obj-$(CONFIG_CROS_EC_UCSI) += cros_ec_ucsi.o obj-$(CONFIG_UCSI_LENOVO_YOGA_C630) += ucsi_yoga_c630.o obj-$(CONFIG_UCSI_HUAWEI_GAOKUN) += ucsi_huawei_gaokun.o +obj-$(CONFIG_UCSI_ITE) += ucsi_ite.odrivers/usb/typec/ucsi/ucsi_ite.c new file +4
-0@@ -0,0 +1,395 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* UCSI I2C transport driver for ITE885x USB-C controllers +*
drivers/usb/typec/ucsi/ucsi_ite.c line 14
Quoted 10 lines
drivers/usb/typec/ucsi/ucsi_ite.c new file +10
-0+* ITE8853/ITE8800-ITE8805 are UCSI-compliant USB-C controllers found on +* desktop motherboards. They communicate over I2C using UCSI registers at +* ITE-specific offsets and signal events through a vendor interrupt register. +*/ + +#include <linux/acpi.h> +#include <linux/i2c.h> +#include <linux/interrupt.h> +#include <linux/module.h> +#include <linux/mutex.h>
We need to include everything instead of relying on nested headers nowadays.
linux/device.h
linux/device/devres.h
linux/dev_printk.h
linux/pm.h
linux/string.h
drivers/usb/typec/ucsi/ucsi_ite.c line 112
Quoted 11 lines
drivers/usb/typec/ucsi/ucsi_ite.c new file +11
-0+static int ucsi_ite_process_event (struct ucsi_ite *ite,u32 *cci) +{ +u8 message_in[ITE_MESSAGE_IN_MAX_LEN ] = {}; +__le32 raw_cci; +u8 status; +u8 len =0 ; +int event; +int err =0 ; +int ret; + +mutex_lock (&ite->event_lock);
guard(mutex)(@ite->event_lock);
Quoted 88 lines
drivers/usb/typec/ucsi/ucsi_ite.c new file +87
-0+ ret =ucsi_ite_read (ite,ITE_REG_INT_STATUS , &status,sizeof (status)); +if (ret) + goto out_unlock; + + status &=ITE_INT_MASK ; +if (!status) { +mutex_lock (&ite->received_lock); + *cci = ite->cci; +mutex_unlock (&ite->received_lock); + ret =ITE_EVENT_NONE ; + goto out_unlock; + } + +if (status &ITE_INT_CCI ) { + err =ucsi_ite_read (ite,ITE_REG_CCI , &raw_cci, +sizeof (raw_cci)); +if (!err) { + *cci =le32_to_cpu (raw_cci); + len =UCSI_CCI_LENGTH (*cci); + +if (len >sizeof (message_in)) { + len =sizeof (message_in); + *cci &= ~GENMASK (15 ,8 ); + *cci |=UCSI_SET_CCI_LENGTH (len); + } +if (len) { + err =ucsi_ite_read (ite,ITE_REG_MESSAGE_IN , + message_in, len); + } + } + } + +/* Acknowledge each latched event with the value expected by the PPM. */ +if (status &ITE_INT_VENDOR_ALERT ) { +u8 ack =ITE_INT_VENDOR_ALERT ; + + ret =ucsi_ite_write (ite,ITE_REG_INT_ACK , &ack,sizeof (ack)); +if (ret) + goto out_unlock; + } + +if ((status &ITE_INT_CCI ) && !err) { +u8 ack =ITE_INT_CCI ; + + ret =ucsi_ite_write (ite,ITE_REG_INT_ACK , &ack,sizeof (ack)); +if (ret) + goto out_unlock; + } + +if (err) { + ret = err; + goto out_unlock; + } + +if (status &ITE_INT_CCI ) { +mutex_lock (&ite->received_lock); + ite->cci = *cci; +memset (ite->message_in,0 ,sizeof (ite->message_in)); +memcpy (ite->message_in, message_in, len); +mutex_unlock (&ite->received_lock); + event =ITE_EVENT_CCI ; + }else { +mutex_lock (&ite->received_lock); + *cci = ite->cci; +mutex_unlock (&ite->received_lock); + event =ITE_EVENT_VENDOR ; + } + + ret = event; + +out_unlock: +mutex_unlock (&ite->event_lock); +return ret; +} +static int ucsi_ite_suspend (struct device *dev) +{ +struct ucsi_ite *ite =dev_get_drvdata (dev); +int ret; + +disable_irq (ite->client->irq); + ret =ucsi_suspend (ite->ucsi); +if (ret) +enable_irq (ite->client->irq); + +return ret; +} +
drivers/usb/typec/ucsi/ucsi_ite.c
Quoted 10 lines
drivers/usb/typec/ucsi/ucsi_ite.c new file +10
-0+static int ucsi_ite_resume (struct device *dev) +{ +struct ucsi_ite *ite =dev_get_drvdata (dev); + +enable_irq (ite->client->irq); +return ucsi_resume (ite->ucsi); +} + +static DEFINE_SIMPLE_DEV_PM_OPS(ucsi_ite_pm, ucsi_ite_suspend, + ucsi_ite_resume);
Is the enable/disable_irq really necessary - couldn't you just use NOIRQ version of the PM operations (DEFINE_NOIRQ_DEV_PM_OPS)?
Thanks,
Signature · 1 line
heikki
Re: [PATCH v3 2/2] usb: typec: ucsi: add ITE885x I2C transport driver
Thanks,
I will add the explicit includes and use guard(mutex) for event_lock.
I kept the explicit IRQ handling because ucsi_resume() queues work which issues UCSI commands. If the callbacks are moved to the noirq phase, that work can run before the parent I2C controller's resume_early or resume callback, while the controller may still be unavailable.
The current ordering disables the device IRQ before quiescing UCSI, then re-enables it during normal resumption after the I2C bus has resumed. Does that address your concern, or would it be preferable the IRQ and UCSI handling to be split across separate PM phases?
Thanks,
Edward
Quoted 203 lines · Heikki Krogerus
Quoted 61 lines · Edward Blair
Add a UCSI transport driver for ITE8853 and ITE8800 through ITE8805 USB Type-C controllers found on desktop motherboards.
These controllers expose CCI,
MESSAGE_INand CONTROL at ITE-specific I2C offsets and signal UCSI and vendor events through a shared interrupt status register. Read and cache each complete UCSI event before acknowledging it so command data remains coherent between the interrupt handler and UCSI core.The interface does not expose a VERSION register and does not accept
PPM_RESETover I2C. Report UCSI 1.0, limitMESSAGE_INto its 16-byte window and handlePPM_RESETlocally, matching the vendor driver's behavior.Signed-off-by Edward Blair <[email protected]>--- drivers/usb/typec/ucsi/Kconfig | 11 + drivers/usb/typec/ucsi/Makefile | 1 + drivers/usb/typec/ucsi/ucsi_ite.c | 395 ++++++++++++++++++++++++++++++ 3 files changed, 407 insertions(+) create mode 100644 drivers/usb/typec/ucsi/ucsi_ite.cdrivers/usb/typec/ucsi/Kconfig +11
-0@@ -104,4 +104,15 @@ config UCSI_HUAWEI_GAOKUN To compile the driver as a module, choose M here: the module will be called ucsi_huawei_gaokun. +config UCSI_ITE + tristate "UCSI Interface Driver for ITE885x" + depends on ACPI && I2C + help + This driver enables UCSI support on platforms that expose an ITE8853 + or ITE8800-ITE8805 USB Type-C controller over I2C, commonly found + on ASUS Z690/Z790/X670E motherboards. + + To compile the driver as a module, choose M here: the module will be + called ucsi_ite. + endifdrivers/usb/typec/ucsi/Makefile +1
-0@@ -28,3 +28,4 @@ obj-$(CONFIG_UCSI_PMIC_GLINK) += ucsi_glink.o obj-$(CONFIG_CROS_EC_UCSI) += cros_ec_ucsi.o obj-$(CONFIG_UCSI_LENOVO_YOGA_C630) += ucsi_yoga_c630.o obj-$(CONFIG_UCSI_HUAWEI_GAOKUN) += ucsi_huawei_gaokun.o +obj-$(CONFIG_UCSI_ITE) += ucsi_ite.odrivers/usb/typec/ucsi/ucsi_ite.c new file +4
-0@@ -0,0 +1,395 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* UCSI I2C transport driver for ITE885x USB-C controllers +* drivers/usb/typec/ucsi/ucsi_ite.c line 14
Quoted 10 lines
drivers/usb/typec/ucsi/ucsi_ite.c new file +10
-0+* ITE8853/ITE8800-ITE8805 are UCSI-compliant USB-C controllers found on +* desktop motherboards. They communicate over I2C using UCSI registers at +* ITE-specific offsets and signal events through a vendor interrupt register. +*/ + +#include <linux/acpi.h> +#include <linux/i2c.h> +#include <linux/interrupt.h> +#include <linux/module.h> +#include <linux/mutex.h> We need to include everything instead of relying on nested headers nowadays.
linux/device.h
linux/device/devres.h
linux/dev_printk.h
linux/pm.h
linux/string.hdrivers/usb/typec/ucsi/ucsi_ite.c line 112
Quoted 11 lines
drivers/usb/typec/ucsi/ucsi_ite.c new file +11
-0+static int ucsi_ite_process_event (struct ucsi_ite *ite,u32 *cci) +{ +u8 message_in[ITE_MESSAGE_IN_MAX_LEN ] = {}; +__le32 raw_cci; +u8 status; +u8 len =0 ; +int event; +int err =0 ; +int ret; + +mutex_lock (&ite->event_lock);guard(mutex)(@ite->event_lock);
Quoted 88 lines
drivers/usb/typec/ucsi/ucsi_ite.c new file +87
-0+ ret =ucsi_ite_read (ite,ITE_REG_INT_STATUS , &status,sizeof (status)); +if (ret) + goto out_unlock; + + status &=ITE_INT_MASK ; +if (!status) { +mutex_lock (&ite->received_lock); + *cci = ite->cci; +mutex_unlock (&ite->received_lock); + ret =ITE_EVENT_NONE ; + goto out_unlock; + } + +if (status &ITE_INT_CCI ) { + err =ucsi_ite_read (ite,ITE_REG_CCI , &raw_cci, +sizeof (raw_cci)); +if (!err) { + *cci =le32_to_cpu (raw_cci); + len =UCSI_CCI_LENGTH (*cci); + +if (len >sizeof (message_in)) { + len =sizeof (message_in); + *cci &= ~GENMASK (15 ,8 ); + *cci |=UCSI_SET_CCI_LENGTH (len); + } +if (len) { + err =ucsi_ite_read (ite,ITE_REG_MESSAGE_IN , + message_in, len); + } + } + } + +/* Acknowledge each latched event with the value expected by the PPM. */ +if (status &ITE_INT_VENDOR_ALERT ) { +u8 ack =ITE_INT_VENDOR_ALERT ; + + ret =ucsi_ite_write (ite,ITE_REG_INT_ACK , &ack,sizeof (ack)); +if (ret) + goto out_unlock; + } + +if ((status &ITE_INT_CCI ) && !err) { +u8 ack =ITE_INT_CCI ; + + ret =ucsi_ite_write (ite,ITE_REG_INT_ACK , &ack,sizeof (ack)); +if (ret) + goto out_unlock; + } + +if (err) { + ret = err; + goto out_unlock; + } + +if (status &ITE_INT_CCI ) { +mutex_lock (&ite->received_lock); + ite->cci = *cci; +memset (ite->message_in,0 ,sizeof (ite->message_in)); +memcpy (ite->message_in, message_in, len); +mutex_unlock (&ite->received_lock); + event =ITE_EVENT_CCI ; + }else { +mutex_lock (&ite->received_lock); + *cci = ite->cci; +mutex_unlock (&ite->received_lock); + event =ITE_EVENT_VENDOR ; + } + + ret = event; + +out_unlock: +mutex_unlock (&ite->event_lock); +return ret; +} +static int ucsi_ite_suspend (struct device *dev) +{ +struct ucsi_ite *ite =dev_get_drvdata (dev); +int ret; + +disable_irq (ite->client->irq); + ret =ucsi_suspend (ite->ucsi); +if (ret) +enable_irq (ite->client->irq); + +return ret; +} +drivers/usb/typec/ucsi/ucsi_ite.c
Quoted 10 lines
drivers/usb/typec/ucsi/ucsi_ite.c new file +10
-0+static int ucsi_ite_resume (struct device *dev) +{ +struct ucsi_ite *ite =dev_get_drvdata (dev); + +enable_irq (ite->client->irq); +return ucsi_resume (ite->ucsi); +} + +static DEFINE_SIMPLE_DEV_PM_OPS(ucsi_ite_pm, ucsi_ite_suspend, + ucsi_ite_resume);Is the enable/disable_irq really necessary - couldn't you just use NOIRQ version of the PM operations (
DEFINE_NOIRQ_DEV_PM_OPS)?Thanks,
--
heikki
Heikki Krogerus
maintainerRe: [PATCH v3 2/2] usb: typec: ucsi: add ITE885x I2C transport driver
Quoted 8 lines · Edward Blair
Thanks,
I will add the explicit includes and use guard(mutex) for
event_lock.I kept the explicit IRQ handling because
ucsi_resume()queues work which issues UCSI commands. If the callbacks are moved to the noirq phase, that work can run before the parent I2C controller'sresume_earlyor resume callback, while the controller may still be unavailable.
Okay, got it.
Quoted 4 lines
The current ordering disables the device IRQ before quiescing UCSI, then re-enables it during normal resumption after the I2C bus has resumed. Does that address your concern, or would it be preferable the IRQ and UCSI handling to be split across separate PM phases?
I'm sure it's fine as it is now.
Thanks,
Quoted 208 lines
Thanks,
EdwardQuoted 203 lines · Heikki Krogerus
Quoted 61 lines · Edward Blair
Add a UCSI transport driver for ITE8853 and ITE8800 through ITE8805 USB Type-C controllers found on desktop motherboards.
These controllers expose CCI,
MESSAGE_INand CONTROL at ITE-specific I2C offsets and signal UCSI and vendor events through a shared interrupt status register. Read and cache each complete UCSI event before acknowledging it so command data remains coherent between the interrupt handler and UCSI core.The interface does not expose a VERSION register and does not accept
PPM_RESETover I2C. Report UCSI 1.0, limitMESSAGE_INto its 16-byte window and handlePPM_RESETlocally, matching the vendor driver's behavior.Signed-off-by Edward Blair <[email protected]>--- drivers/usb/typec/ucsi/Kconfig | 11 + drivers/usb/typec/ucsi/Makefile | 1 + drivers/usb/typec/ucsi/ucsi_ite.c | 395 ++++++++++++++++++++++++++++++ 3 files changed, 407 insertions(+) create mode 100644 drivers/usb/typec/ucsi/ucsi_ite.cdrivers/usb/typec/ucsi/Kconfig +11
-0@@ -104,4 +104,15 @@ config UCSI_HUAWEI_GAOKUN To compile the driver as a module, choose M here: the module will be called ucsi_huawei_gaokun. +config UCSI_ITE + tristate "UCSI Interface Driver for ITE885x" + depends on ACPI && I2C + help + This driver enables UCSI support on platforms that expose an ITE8853 + or ITE8800-ITE8805 USB Type-C controller over I2C, commonly found + on ASUS Z690/Z790/X670E motherboards. + + To compile the driver as a module, choose M here: the module will be + called ucsi_ite. + endifdrivers/usb/typec/ucsi/Makefile +1
-0@@ -28,3 +28,4 @@ obj-$(CONFIG_UCSI_PMIC_GLINK) += ucsi_glink.o obj-$(CONFIG_CROS_EC_UCSI) += cros_ec_ucsi.o obj-$(CONFIG_UCSI_LENOVO_YOGA_C630) += ucsi_yoga_c630.o obj-$(CONFIG_UCSI_HUAWEI_GAOKUN) += ucsi_huawei_gaokun.o +obj-$(CONFIG_UCSI_ITE) += ucsi_ite.odrivers/usb/typec/ucsi/ucsi_ite.c new file +4
-0@@ -0,0 +1,395 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* UCSI I2C transport driver for ITE885x USB-C controllers +* drivers/usb/typec/ucsi/ucsi_ite.c line 14
Quoted 10 lines
drivers/usb/typec/ucsi/ucsi_ite.c new file +10
-0+* ITE8853/ITE8800-ITE8805 are UCSI-compliant USB-C controllers found on +* desktop motherboards. They communicate over I2C using UCSI registers at +* ITE-specific offsets and signal events through a vendor interrupt register. +*/ + +#include <linux/acpi.h> +#include <linux/i2c.h> +#include <linux/interrupt.h> +#include <linux/module.h> +#include <linux/mutex.h> We need to include everything instead of relying on nested headers nowadays.
linux/device.h
linux/device/devres.h
linux/dev_printk.h
linux/pm.h
linux/string.hdrivers/usb/typec/ucsi/ucsi_ite.c line 112
Quoted 11 lines
drivers/usb/typec/ucsi/ucsi_ite.c new file +11
-0+static int ucsi_ite_process_event (struct ucsi_ite *ite,u32 *cci) +{ +u8 message_in[ITE_MESSAGE_IN_MAX_LEN ] = {}; +__le32 raw_cci; +u8 status; +u8 len =0 ; +int event; +int err =0 ; +int ret; + +mutex_lock (&ite->event_lock);guard(mutex)(@ite->event_lock);
Quoted 88 lines
drivers/usb/typec/ucsi/ucsi_ite.c new file +87
-0+ ret =ucsi_ite_read (ite,ITE_REG_INT_STATUS , &status,sizeof (status)); +if (ret) + goto out_unlock; + + status &=ITE_INT_MASK ; +if (!status) { +mutex_lock (&ite->received_lock); + *cci = ite->cci; +mutex_unlock (&ite->received_lock); + ret =ITE_EVENT_NONE ; + goto out_unlock; + } + +if (status &ITE_INT_CCI ) { + err =ucsi_ite_read (ite,ITE_REG_CCI , &raw_cci, +sizeof (raw_cci)); +if (!err) { + *cci =le32_to_cpu (raw_cci); + len =UCSI_CCI_LENGTH (*cci); + +if (len >sizeof (message_in)) { + len =sizeof (message_in); + *cci &= ~GENMASK (15 ,8 ); + *cci |=UCSI_SET_CCI_LENGTH (len); + } +if (len) { + err =ucsi_ite_read (ite,ITE_REG_MESSAGE_IN , + message_in, len); + } + } + } + +/* Acknowledge each latched event with the value expected by the PPM. */ +if (status &ITE_INT_VENDOR_ALERT ) { +u8 ack =ITE_INT_VENDOR_ALERT ; + + ret =ucsi_ite_write (ite,ITE_REG_INT_ACK , &ack,sizeof (ack)); +if (ret) + goto out_unlock; + } + +if ((status &ITE_INT_CCI ) && !err) { +u8 ack =ITE_INT_CCI ; + + ret =ucsi_ite_write (ite,ITE_REG_INT_ACK , &ack,sizeof (ack)); +if (ret) + goto out_unlock; + } + +if (err) { + ret = err; + goto out_unlock; + } + +if (status &ITE_INT_CCI ) { +mutex_lock (&ite->received_lock); + ite->cci = *cci; +memset (ite->message_in,0 ,sizeof (ite->message_in)); +memcpy (ite->message_in, message_in, len); +mutex_unlock (&ite->received_lock); + event =ITE_EVENT_CCI ; + }else { +mutex_lock (&ite->received_lock); + *cci = ite->cci; +mutex_unlock (&ite->received_lock); + event =ITE_EVENT_VENDOR ; + } + + ret = event; + +out_unlock: +mutex_unlock (&ite->event_lock); +return ret; +} +static int ucsi_ite_suspend (struct device *dev) +{ +struct ucsi_ite *ite =dev_get_drvdata (dev); +int ret; + +disable_irq (ite->client->irq); + ret =ucsi_suspend (ite->ucsi); +if (ret) +enable_irq (ite->client->irq); + +return ret; +} +drivers/usb/typec/ucsi/ucsi_ite.c
Quoted 10 lines
drivers/usb/typec/ucsi/ucsi_ite.c new file +10
-0+static int ucsi_ite_resume (struct device *dev) +{ +struct ucsi_ite *ite =dev_get_drvdata (dev); + +enable_irq (ite->client->irq); +return ucsi_resume (ite->ucsi); +} + +static DEFINE_SIMPLE_DEV_PM_OPS(ucsi_ite_pm, ucsi_ite_suspend, + ucsi_ite_resume);Is the enable/disable_irq really necessary - couldn't you just use NOIRQ version of the PM operations (
DEFINE_NOIRQ_DEV_PM_OPS)?Thanks,
--
heikki
Signature · 1 line
heikki
Re: [PATCH v3 2/2] usb: typec: ucsi: add ITE885x I2C transport driver
In reply to Edward BlairHi Edward,
Quoted 2 lines · Edward Blair
Add a UCSI transport driver for ITE8853 and ITE8800 through ITE8805 USB Type-C controllers found on desktop motherboards.
Thanks for working on this. I'm from ITE, and I wanted to let you know that we have been upstreaming a UCSI driver for the same controller family. The driver was posted on 7 Aug 2026 and has Heikki's Reviewed-by:
https://lore.kernel.org/linux-usb/[email protected]/
A follow-up series extending it to the IT885x and IT527x series has also been acked:
https://lore.kernel.org/r/[email protected]
Both drivers target the same register interface (CCI at 0x84, MESSAGE_IN at 0x88, CONTROL at 0x98 and the vendor interrupt registers at 0xbc/0xbd), so it would be better not to have two drivers for the same hardware in drivers/usb/typec/ucsi.
Our driver currently only matches through OF and I2C IDs, so it does not yet cover the ACPI-enumerated ITE8853/ITE8800-ITE8805 devices on the ASUS boards you are targeting. Would you be open to adding ACPI support, and any platform-specific handling those boards need, on top of ucsi_itepd instead of as a separate driver? We would be happy to help with review.
Heikki, Greg, please let us know how you would prefer to proceed.
Thanks,
Amber Kao <[email protected]>
A message that is not in the archive (sent off-list or not yet received): CAJDQNghzjreMHXTVEWTZ-Oyo1cCpzLyDUyt68EZvPD30Wp0txQ@mail.gmail.com
Re: [PATCH v3 2/2] usb: typec: ucsi: add ITE885x I2C transport driver
Hi Amber,
Thanks for reaching out, and apologies for the slow reply.
I'm happy to drop the separate transport driver in favour of ucsi_itepd. Would you be willing to take the lead on adding the ACPI support and any handling needed for these ASUS boards?
Please feel free to reuse anything useful from my patches. I can help test your changes on my ASUS ROG Strix Z790-E Gaming WiFi with ITE8853 and provide logs or ACPI tables.
The MSFT8000 enumeration fix in patch 1 is separate from the transport driver and has Armin's Reviewed-by and Rafael's Acked-by. That should remain part of the solution for these boards.
Thanks,
Edward
Quoted 56 lines · Edward Blair
Hi Amber,
Thanks for reaching out, and apologies for the slow reply.
I'm happy to drop the separate transport driver in favour of
ucsi_itepd. Would you be willing to take the lead on adding the ACPI support and any handling needed for these ASUS boards?Please feel free to reuse anything useful from my patches. I can help test your changes on my ASUS ROG Strix Z790-E Gaming WiFi with ITE8853 and provide logs or ACPI tables.
The MSFT8000 enumeration fix in patch 1 is separate from the transport driver and has Armin's Reviewed-by and Rafael's Acked-by. That should remain part of the solution for these boards.
Thanks,
EdwardQuoted 35 lines · Amber Kao
Hi Edward,
Quoted 2 lines · Edward Blair
Add a UCSI transport driver for ITE8853 and ITE8800 through ITE8805 USB Type-C controllers found on desktop motherboards.
Thanks for working on this. I'm from ITE, and I wanted to let you know that we have been upstreaming a UCSI driver for the same controller family. The driver was posted on 7 Aug 2026 and has Heikki's Reviewed-by:
https://lore.kernel.org/linux-usb/[email protected]/
A follow-up series extending it to the IT885x and IT527x series has also been acked:
https://lore.kernel.org/r/[email protected]
Both drivers target the same register interface (CCI at
0x84,MESSAGE_INat0x88, CONTROL at0x98and the vendor interrupt registers at 0xbc/0xbd), so it would be better not to have two drivers for the same hardware indrivers/usb/typec/ucsi.Our driver currently only matches through OF and I2C IDs, so it does not yet cover the ACPI-enumerated ITE8853/ITE8800-ITE8805 devices on the ASUS boards you are targeting. Would you be open to adding ACPI support, and any platform-specific handling those boards need, on top of
ucsi_itepdinstead of as a separate driver? We would be happy to help with review.Heikki, Greg, please let us know how you would prefer to proceed.
Thanks,
Amber Kao <[email protected]>
RE: [PATCH v3 2/2] usb: typec: ucsi: add ITE885x I2C transport driver
Hi Edward,
Quoted 3 lines
I'm happy to drop the separate transport driver in favour of
ucsi_itepd. Would you be willing to take the lead on adding the ACPI support and any handling needed for these ASUS boards?
Thank you for your work on ACPI support for these controllers, and for agreeing to consolidate on ucsi_itepd.
Yes, we will take the lead. I'll start adding ACPI support to ucsi_itepd, covering the ITE8853 and ITE8800-ITE8805 IDs as well as any platform-specific handling the ASUS boards need.
Quoted 3 lines
Please feel free to reuse anything useful from my patches. I can help test your changes on my ASUS ROG Strix Z790-E Gaming WiFi with ITE8853 and provide logs or ACPI tables.
Thank you. Your patches are a very useful reference, and I'll make sure your work is properly credited where it is reused. I'll Cc you on the series, and your testing on the Z790-E (and a Tested-by, if all goes well) would be much appreciated.
Quoted 3 lines
The MSFT8000 enumeration fix in patch 1 is separate from the transport driver and has Armin's Reviewed-by and Rafael's Acked-by. That should remain part of the solution for these boards.
Agreed. Patch 1 is independent of the transport driver and should go in as is. The ACPI support in ucsi_itepd will rely on it for these boards.
Finally, given your work on these controllers and your access to the hardware, we would like to add you as one of the maintainers of ucsi_itepd in MAINTAINERS. Please let me know if you are OK with that.
Thanks,
Amber Kao <[email protected]>