Re: [PATCH 3/6] usb: typec: add Qualcomm PMI8998 role-switch driver

From: Dmitry Baryshkov

Date: Mon May 18 2026 - 17:46:07 EST


On Tue, May 19, 2026 at 01:22:48AM +0500, taygoth wrote:
> The Qualcomm PMI8998 PMIC integrates a USB Type-C detection block in
> its SMB2 charger USBIN region at offset 0x1300. The block performs CC
> sensing, debounce and Rp/Rd resolution in silicon and reports role
> changes through a single consolidated "type-c-change" interrupt.
>
> This driver reads TYPE_C_STATUS_4 on probe and on every interrupt,
> decodes the hardware-detected role (host / device / none) and pushes
> it to a usb_role_switch consumer (typically dwc3) so the controller
> can flip between peripheral and host on cable orientation change. An
> optional VBUS supply regulator is toggled on USB_ROLE_HOST transitions
> so bus-powered downstream peripherals can be powered.

This is an interesting implementation, but...

>
> No software TCPM state machine is used because the hardware handles
> the Type-C protocol natively, and the PMI8998 interrupt topology does
> not expose the granular per-event signals the TCPM code path expects.
> Power Delivery is not implemented in this driver; the PMI8998 PDPHY
> block at offset 0x1700 (register-identical to PM8150B) can be wired
> up by a separate driver later if PD negotiation is required.

I think TCPM / PD-PHY is (more or less) a sensible requirement. Without
it you can't negotiate higher power modes or AltModes support (which
means no DP).

Also, this (read-only) implementation doesn't leave space for the active
events, like role negotiation.

Anyway, could you please be more specific, which events or which
controls do you need?

>
> This enables USB host mode on the OnePlus 6 (enchilada), OnePlus 6T
> (fajita), Xiaomi Poco F1 (beryllium), SHIFT 6mq (axolotl) and other
> SDM845-based phones that use the PMI8998 as their second PMIC.
>
> Signed-off-by: taygoth <taygoth@xxxxxxxxx>

Please correct your Git configuration to use your full name in the From
metadata and in the SoB.

> ---
> drivers/usb/typec/Kconfig | 17 ++
> drivers/usb/typec/Makefile | 1 +
> drivers/usb/typec/qcom_pmi8998_typec.c | 213 +++++++++++++++++++++++++
> 3 files changed, 231 insertions(+)
> create mode 100644 drivers/usb/typec/qcom_pmi8998_typec.c
>
>

--
With best wishes
Dmitry