Devicetree
 help / color / mirror / Atom feed
* [PATCH 0/6] usb: typec: add Qualcomm PMI8998 USB Type-C role-switch support
@ 2026-05-18 20:22 taygoth
  2026-05-18 20:22 ` [PATCH 1/6] dt-bindings: regulator: qcom,usb-vbus-regulator: add PMI8998 taygoth
                   ` (7 more replies)
  0 siblings, 8 replies; 21+ messages in thread
From: taygoth @ 2026-05-18 20:22 UTC (permalink / raw)
  To: linux-arm-msm, linux-usb, devicetree, linux-kernel
  Cc: Mark Brown, Liam Girdwood, Wesley Cheng, Greg Kroah-Hartman,
	Heikki Krogerus, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Bjorn Andersson, Konrad Dybcio, Bryan O'Donoghue,
	Casey Connolly

This series adds USB Type-C role-switch support for the PMI8998 PMIC
used on SDM845 phones (OnePlus 6/6T, Xiaomi Poco F1, SHIFT 6mq), which
have been locked to USB peripheral mode under mainline kernels until
now.

The PMI8998 SMB2 charger block integrates a Type-C detection unit at
SPMI offset 0x1300 that performs CC sensing, debounce and Rp/Rd
resolution entirely in hardware. The state is exposed through the
TYPE_C_STATUS_4 register and reported via a single consolidated
"type-c-change" interrupt. The new driver reads that status on every
interrupt and pushes the negotiated role to a usb_role_switch consumer
(dwc3), enabling automatic peripheral/host switching on cable change.
Because the hardware handles the Type-C state machine natively, no
software TCPM port manager is required.

The Type-C block shares the SMB2 USBIN region with the already
mainlined qcom_pmi8998-charger driver. The two coexist on the shared
SPMI regmap without write conflict: the typec driver only reads
TYPE_C_STATUS_* and touches the IRQ enable bits at offsets
0x130b-0x130f and 0x1367-0x1368.

The PMI8998 USB OTG VBUS boost converter at offset 0x1100 has the
same CMD_OTG / OTG_CFG / OTG_CURRENT_LIMIT register layout as PM8150B,
so the existing drivers/regulator/qcom_usb_vbus-regulator can drive it
through a compatible cascade -- only the DT binding needs the new
compatible string added.

Power Delivery is not implemented. The PMI8998 PDPHY block at offset
0x1700 is register-identical to PM8150B and could be wired through
the existing drivers/usb/typec/tcpm/qcom code in a follow-up if PD
negotiation becomes a requirement.

Tested-on: OnePlus 6T (sdm845-oneplus-fajita) running Mobian
6.12-sdm845. A USB flash drive, USB ethernet adapter, USB WiFi
adapter (TP-Link Archer T2) and a self-powered USB-C dock with
downstream ethernet all enumerate through xHCI after the role
transitions from peripheral to host. Repeat plug/unplug cycles drive
the role through device -> none -> host -> none -> device cleanly
with no IRQ stalls or stale role-switch state.

Series mirror:
  https://github.com/taygoth/linux/tree/pmi8998-typec

taygoth (6):
  dt-bindings: regulator: qcom,usb-vbus-regulator: add PMI8998
  dt-bindings: usb: add Qualcomm PMI8998 Type-C controller
  usb: typec: add Qualcomm PMI8998 role-switch driver
  arm64: dts: qcom: pmi8998: add USB Type-C and VBUS regulator nodes
  arm64: dts: qcom: sdm845-oneplus-common: enable USB Type-C role
    switching
  MAINTAINERS: add entry for Qualcomm PMI8998 USB Type-C driver

 .../regulator/qcom,usb-vbus-regulator.yaml    |   1 +
 .../bindings/usb/qcom,pmi8998-typec.yaml      |  97 ++++++++
 MAINTAINERS                                   |   8 +
 arch/arm64/boot/dts/qcom/pmi8998.dtsi         |  19 ++
 .../boot/dts/qcom/sdm845-oneplus-common.dtsi  |  43 +++-
 drivers/usb/typec/Kconfig                     |  17 ++
 drivers/usb/typec/Makefile                    |   1 +
 drivers/usb/typec/qcom_pmi8998_typec.c        | 213 ++++++++++++++++++
 8 files changed, 392 insertions(+), 7 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/qcom,pmi8998-typec.yaml
 create mode 100644 drivers/usb/typec/qcom_pmi8998_typec.c


base-commit: 5200f5f493f79f14bbdc349e402a40dfb32f23c8
-- 
2.47.3


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 1/6] dt-bindings: regulator: qcom,usb-vbus-regulator: add PMI8998
  2026-05-18 20:22 [PATCH 0/6] usb: typec: add Qualcomm PMI8998 USB Type-C role-switch support taygoth
@ 2026-05-18 20:22 ` taygoth
  2026-05-18 21:56   ` Bryan O'Donoghue
  2026-05-19 10:51   ` Krzysztof Kozlowski
  2026-05-18 20:22 ` [PATCH 2/6] dt-bindings: usb: add Qualcomm PMI8998 Type-C controller taygoth
                   ` (6 subsequent siblings)
  7 siblings, 2 replies; 21+ messages in thread
From: taygoth @ 2026-05-18 20:22 UTC (permalink / raw)
  To: linux-arm-msm, linux-usb, devicetree, linux-kernel
  Cc: Mark Brown, Liam Girdwood, Wesley Cheng, Greg Kroah-Hartman,
	Heikki Krogerus, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Bjorn Andersson, Konrad Dybcio, Bryan O'Donoghue,
	Casey Connolly

The Qualcomm PMI8998 PMIC integrates a USB OTG VBUS boost converter
inside its SMB2 charger block at offset 0x1100. The OTG control
register layout (CMD_OTG at +0x40, OTG_CURRENT_LIMIT_CFG at +0x52,
OTG_CFG at +0x53) matches the PM8150B SMB5 block, so the existing
qcom_usb_vbus-regulator driver can drive it without code changes via
compatible cascade.

Verified by inspecting the downstream qpnp-smb2 driver and reading
live register values on a OnePlus 6T (sdm845-oneplus-fajita) running
mainline Linux.

Signed-off-by: taygoth <taygoth@gmail.com>
---
 .../devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml   | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml b/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml
index fcefc722ee2a..9e2e2c8f9539 100644
--- a/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml
+++ b/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml
@@ -28,6 +28,7 @@ properties:
               - qcom,pm6150-vbus-reg
               - qcom,pm7250b-vbus-reg
               - qcom,pmi632-vbus-reg
+              - qcom,pmi8998-vbus-reg
           - const: qcom,pm8150b-vbus-reg
 
   reg:
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 2/6] dt-bindings: usb: add Qualcomm PMI8998 Type-C controller
  2026-05-18 20:22 [PATCH 0/6] usb: typec: add Qualcomm PMI8998 USB Type-C role-switch support taygoth
  2026-05-18 20:22 ` [PATCH 1/6] dt-bindings: regulator: qcom,usb-vbus-regulator: add PMI8998 taygoth
@ 2026-05-18 20:22 ` taygoth
  2026-05-18 20:42   ` sashiko-bot
  2026-05-18 22:03   ` Dmitry Baryshkov
  2026-05-18 20:22 ` [PATCH 3/6] usb: typec: add Qualcomm PMI8998 role-switch driver taygoth
                   ` (5 subsequent siblings)
  7 siblings, 2 replies; 21+ messages in thread
From: taygoth @ 2026-05-18 20:22 UTC (permalink / raw)
  To: linux-arm-msm, linux-usb, devicetree, linux-kernel
  Cc: Mark Brown, Liam Girdwood, Wesley Cheng, Greg Kroah-Hartman,
	Heikki Krogerus, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Bjorn Andersson, Konrad Dybcio, Bryan O'Donoghue,
	Casey Connolly

The 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 hardware and reports role changes
through a single consolidated "type-c-change" interrupt.

This is architecturally distinct from the qcom,pmic-typec binding
(PM8150B / PMI632 family) which exposes a granular 8-16 IRQ topology
fanned out per Type-C event for a software TCPM state machine. PMI8998
has neither the per-event IRQs nor a register layout compatible with
the TCPM code path, so this binding describes a separate hardware-
managed role-switch controller.

Signed-off-by: taygoth <taygoth@gmail.com>
---
 .../bindings/usb/qcom,pmi8998-typec.yaml      | 97 +++++++++++++++++++
 1 file changed, 97 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/qcom,pmi8998-typec.yaml

diff --git a/Documentation/devicetree/bindings/usb/qcom,pmi8998-typec.yaml b/Documentation/devicetree/bindings/usb/qcom,pmi8998-typec.yaml
new file mode 100644
index 000000000000..f2814f5ce3de
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/qcom,pmi8998-typec.yaml
@@ -0,0 +1,97 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/usb/qcom,pmi8998-typec.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm PMI8998 USB Type-C role-switch controller
+
+maintainers:
+  - Maxim Furman <taygoth@gmail.com>
+
+description:
+  The PMI8998 PMIC integrates a USB Type-C detection block inside its SMB2
+  charger USBIN region at offset 0x1300. CC sensing, debounce and Rp/Rd
+  resolution are performed in hardware, and the negotiated role is reported
+  through a single consolidated "type-c-change" interrupt.
+
+  This block is distinct from the TCPM-based qcom,pmic-typec controllers
+  (PM8150B, PMI632, etc.) — PMI8998 lacks the granular per-event interrupt
+  topology those parts expose and the driver therefore translates the
+  hardware-decided role directly into a usb_role_switch_set_role() call
+  rather than running a software TCPM state machine. Power Delivery is not
+  supported by this binding.
+
+properties:
+  compatible:
+    const: qcom,pmi8998-typec
+
+  reg:
+    maxItems: 1
+    description: Type-C SPMI register base offset (typically 0x1300).
+
+  interrupts:
+    maxItems: 1
+
+  interrupt-names:
+    items:
+      - const: type-c-change
+
+  vdd-vbus-supply:
+    description:
+      VBUS source regulator enabled when the controller transitions to
+      USB host mode so bus-powered downstream peripherals can be powered.
+
+  connector:
+    type: object
+    $ref: /schemas/connector/usb-connector.yaml#
+    unevaluatedProperties: false
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - interrupt-names
+  - connector
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    pmic {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        typec@1300 {
+            compatible = "qcom,pmi8998-typec";
+            reg = <0x1300>;
+
+            interrupts = <0x2 0x13 0x7 IRQ_TYPE_EDGE_BOTH>;
+            interrupt-names = "type-c-change";
+
+            vdd-vbus-supply = <&pmi8998_vbus>;
+
+            connector {
+                compatible = "usb-c-connector";
+                label = "USB-C";
+                power-role = "dual";
+                data-role = "dual";
+                try-power-role = "sink";
+
+                ports {
+                    #address-cells = <1>;
+                    #size-cells = <0>;
+
+                    port@0 {
+                        reg = <0>;
+                        pmi8998_hs_in: endpoint {
+                            remote-endpoint = <&usb_1_dwc3_hs>;
+                        };
+                    };
+                };
+            };
+        };
+    };
+...
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 3/6] usb: typec: add Qualcomm PMI8998 role-switch driver
  2026-05-18 20:22 [PATCH 0/6] usb: typec: add Qualcomm PMI8998 USB Type-C role-switch support taygoth
  2026-05-18 20:22 ` [PATCH 1/6] dt-bindings: regulator: qcom,usb-vbus-regulator: add PMI8998 taygoth
  2026-05-18 20:22 ` [PATCH 2/6] dt-bindings: usb: add Qualcomm PMI8998 Type-C controller taygoth
@ 2026-05-18 20:22 ` taygoth
  2026-05-18 20:58   ` sashiko-bot
                     ` (2 more replies)
  2026-05-18 20:22 ` [PATCH 4/6] arm64: dts: qcom: pmi8998: add USB Type-C and VBUS regulator nodes taygoth
                   ` (4 subsequent siblings)
  7 siblings, 3 replies; 21+ messages in thread
From: taygoth @ 2026-05-18 20:22 UTC (permalink / raw)
  To: linux-arm-msm, linux-usb, devicetree, linux-kernel
  Cc: Mark Brown, Liam Girdwood, Wesley Cheng, Greg Kroah-Hartman,
	Heikki Krogerus, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Bjorn Andersson, Konrad Dybcio, Bryan O'Donoghue,
	Casey Connolly

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.

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.

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@gmail.com>
---
 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

diff --git a/drivers/usb/typec/Kconfig b/drivers/usb/typec/Kconfig
index 2f80c2792dbd..1912ca3f6e0a 100644
--- a/drivers/usb/typec/Kconfig
+++ b/drivers/usb/typec/Kconfig
@@ -100,6 +100,23 @@ config TYPEC_STUSB160X
 	  If you choose to build this driver as a dynamically linked module, the
 	  module will be called stusb160x.ko.
 
+config TYPEC_QCOM_PMI8998
+	tristate "Qualcomm PMI8998 USB Type-C role-switch driver"
+	depends on ARCH_QCOM || COMPILE_TEST
+	depends on SPMI
+	select USB_ROLE_SWITCH
+	help
+	  Say Y or M here to enable the role-switch driver for the USB
+	  Type-C detection block integrated in the Qualcomm PMI8998 PMIC.
+	  This is the part used on SDM845 phones such as the OnePlus 6/6T,
+	  Xiaomi Poco F1 and SHIFT 6mq. The driver reports the
+	  hardware-detected role through the USB role switch class so the
+	  USB DRD controller (e.g. dwc3) can flip between peripheral and
+	  host on cable orientation change.
+
+	  If you choose to build this driver as a dynamically linked module,
+	  the module will be called qcom_pmi8998_typec.ko.
+
 config TYPEC_WUSB3801
 	tristate "Willsemi WUSB3801 Type-C port controller driver"
 	depends on I2C
diff --git a/drivers/usb/typec/Makefile b/drivers/usb/typec/Makefile
index 8a6a1c663eb6..568f8ee68c9d 100644
--- a/drivers/usb/typec/Makefile
+++ b/drivers/usb/typec/Makefile
@@ -10,5 +10,6 @@ obj-$(CONFIG_TYPEC_ANX7411)	+= anx7411.o
 obj-$(CONFIG_TYPEC_HD3SS3220)	+= hd3ss3220.o
 obj-$(CONFIG_TYPEC_STUSB160X) 	+= stusb160x.o
 obj-$(CONFIG_TYPEC_RT1719)	+= rt1719.o
+obj-$(CONFIG_TYPEC_QCOM_PMI8998)	+= qcom_pmi8998_typec.o
 obj-$(CONFIG_TYPEC_WUSB3801)	+= wusb3801.o
 obj-$(CONFIG_TYPEC)		+= mux/
diff --git a/drivers/usb/typec/qcom_pmi8998_typec.c b/drivers/usb/typec/qcom_pmi8998_typec.c
new file mode 100644
index 000000000000..77662b4f1b0c
--- /dev/null
+++ b/drivers/usb/typec/qcom_pmi8998_typec.c
@@ -0,0 +1,213 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Qualcomm PMI8998 USB Type-C role-switch driver.
+ *
+ * The PMI8998 PMIC integrates a USB Type-C detection block inside its
+ * SMB2 charger USBIN region at offset 0x1300. The block performs CC
+ * sensing, debounce and Rp/Rd resolution in hardware, then reports the
+ * negotiated role via TYPE_C_STATUS_4 and a single consolidated
+ * "type-c-change" interrupt.
+ *
+ * This driver translates the hardware-decided role into a
+ * usb_role_switch_set_role() call so the USB DRD controller (typically
+ * dwc3) can flip between peripheral and host. An optional VBUS supply
+ * regulator is enabled on USB_ROLE_HOST transitions so bus-powered
+ * peripherals can be powered.
+ *
+ * No software TCPM state machine is needed because the hardware handles
+ * the Type-C protocol natively. Power Delivery is not supported by this
+ * driver; the PMI8998 PDPHY block at offset 0x1700 (identical register
+ * layout to PM8150B) can be wired up separately by an additional driver
+ * if PD negotiation is required.
+ *
+ * Copyright (c) 2026 Maxim Furman <taygoth@gmail.com>
+ */
+
+#include <linux/bits.h>
+#include <linux/err.h>
+#include <linux/interrupt.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/property.h>
+#include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
+#include <linux/usb/role.h>
+
+#define TYPE_C_STATUS_1_REG			0x0b
+#define   UFP_TYPEC_RDSTD				BIT(7)
+#define   UFP_TYPEC_RD1P5				BIT(6)
+#define   UFP_TYPEC_RD3P0				BIT(5)
+
+#define TYPE_C_STATUS_2_REG			0x0c
+#define   DFP_RD_OPEN					BIT(3)
+#define   DFP_RD_RA_VCONN				BIT(2)
+#define   DFP_RD_RD					BIT(1)
+#define   DFP_RA_RA					BIT(0)
+
+#define TYPE_C_STATUS_4_REG			0x0e
+#define   UFP_DFP_MODE_STATUS				BIT(7)
+#define   TYPEC_VBUS_STATUS				BIT(6)
+#define   TYPEC_VBUS_ERROR_STATUS			BIT(5)
+#define   TYPEC_DEBOUNCE_DONE_STATUS			BIT(4)
+#define   CC_ORIENTATION				BIT(1)
+#define   CC_ATTACHED					BIT(0)
+
+#define TYPE_C_STATUS_5_REG			0x0f
+
+#define TYPE_C_INTRPT_ENB_REG			0x67
+#define TYPE_C_INTRPT_ENB_SW_CTRL_REG		0x68
+
+struct pmi8998_typec {
+	struct device		*dev;
+	struct regmap		*regmap;
+	u32			base;
+	int			irq;
+	struct usb_role_switch	*role_sw;
+	struct regulator	*vbus;
+	bool			vbus_enabled;
+	enum usb_role		role;
+};
+
+static enum usb_role pmi8998_typec_decode(unsigned int status)
+{
+	if (!(status & CC_ATTACHED))
+		return USB_ROLE_NONE;
+	if (!(status & TYPEC_DEBOUNCE_DONE_STATUS))
+		return USB_ROLE_NONE;
+
+	return (status & UFP_DFP_MODE_STATUS) ? USB_ROLE_HOST : USB_ROLE_DEVICE;
+}
+
+static int pmi8998_typec_apply(struct pmi8998_typec *typec)
+{
+	unsigned int status;
+	enum usb_role role;
+	int ret;
+
+	ret = regmap_read(typec->regmap,
+			  typec->base + TYPE_C_STATUS_4_REG, &status);
+	if (ret)
+		return ret;
+
+	role = pmi8998_typec_decode(status);
+	if (role == typec->role)
+		return 0;
+
+	if (typec->vbus) {
+		bool want_vbus = (role == USB_ROLE_HOST);
+
+		if (want_vbus && !typec->vbus_enabled) {
+			ret = regulator_enable(typec->vbus);
+			if (ret)
+				return ret;
+			typec->vbus_enabled = true;
+		} else if (!want_vbus && typec->vbus_enabled) {
+			regulator_disable(typec->vbus);
+			typec->vbus_enabled = false;
+		}
+	}
+
+	ret = usb_role_switch_set_role(typec->role_sw, role);
+	if (ret)
+		return ret;
+
+	typec->role = role;
+	return 0;
+}
+
+static irqreturn_t pmi8998_typec_isr(int irq, void *data)
+{
+	pmi8998_typec_apply(data);
+	return IRQ_HANDLED;
+}
+
+static int pmi8998_typec_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct fwnode_handle *connector;
+	struct pmi8998_typec *typec;
+	int ret;
+
+	typec = devm_kzalloc(dev, sizeof(*typec), GFP_KERNEL);
+	if (!typec)
+		return -ENOMEM;
+
+	typec->dev = dev;
+	typec->role = USB_ROLE_NONE;
+
+	typec->regmap = dev_get_regmap(dev->parent, NULL);
+	if (!typec->regmap)
+		return -ENODEV;
+
+	ret = of_property_read_u32_index(dev->of_node, "reg", 0, &typec->base);
+	if (ret)
+		return ret;
+
+	typec->irq = platform_get_irq_byname(pdev, "type-c-change");
+	if (typec->irq < 0)
+		return typec->irq;
+
+	connector = device_get_named_child_node(dev, "connector");
+	if (!connector)
+		return -EINVAL;
+
+	typec->role_sw = fwnode_usb_role_switch_get(connector);
+	fwnode_handle_put(connector);
+	if (IS_ERR(typec->role_sw))
+		return PTR_ERR(typec->role_sw);
+
+	typec->vbus = devm_regulator_get_optional(dev, "vdd-vbus");
+	if (IS_ERR(typec->vbus)) {
+		if (PTR_ERR(typec->vbus) != -ENODEV) {
+			ret = PTR_ERR(typec->vbus);
+			goto err_role_put;
+		}
+		typec->vbus = NULL;
+	}
+
+	platform_set_drvdata(pdev, typec);
+
+	pmi8998_typec_apply(typec);
+
+	ret = devm_request_threaded_irq(dev, typec->irq, NULL,
+					pmi8998_typec_isr, IRQF_ONESHOT,
+					dev_name(dev), typec);
+	if (ret)
+		goto err_role_put;
+
+	return 0;
+
+err_role_put:
+	usb_role_switch_put(typec->role_sw);
+	return ret;
+}
+
+static void pmi8998_typec_remove(struct platform_device *pdev)
+{
+	struct pmi8998_typec *typec = platform_get_drvdata(pdev);
+
+	if (typec->vbus_enabled)
+		regulator_disable(typec->vbus);
+	usb_role_switch_put(typec->role_sw);
+}
+
+static const struct of_device_id pmi8998_typec_of_match[] = {
+	{ .compatible = "qcom,pmi8998-typec" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, pmi8998_typec_of_match);
+
+static struct platform_driver pmi8998_typec_driver = {
+	.probe		= pmi8998_typec_probe,
+	.remove		= pmi8998_typec_remove,
+	.driver		= {
+		.name		= "qcom-pmi8998-typec",
+		.of_match_table	= pmi8998_typec_of_match,
+	},
+};
+module_platform_driver(pmi8998_typec_driver);
+
+MODULE_AUTHOR("Maxim Furman <taygoth@gmail.com>");
+MODULE_DESCRIPTION("Qualcomm PMI8998 USB Type-C role-switch driver");
+MODULE_LICENSE("GPL");
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 4/6] arm64: dts: qcom: pmi8998: add USB Type-C and VBUS regulator nodes
  2026-05-18 20:22 [PATCH 0/6] usb: typec: add Qualcomm PMI8998 USB Type-C role-switch support taygoth
                   ` (2 preceding siblings ...)
  2026-05-18 20:22 ` [PATCH 3/6] usb: typec: add Qualcomm PMI8998 role-switch driver taygoth
@ 2026-05-18 20:22 ` taygoth
  2026-05-18 21:19   ` sashiko-bot
  2026-05-18 20:22 ` [PATCH 5/6] arm64: dts: qcom: sdm845-oneplus-common: enable USB Type-C role switching taygoth
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 21+ messages in thread
From: taygoth @ 2026-05-18 20:22 UTC (permalink / raw)
  To: linux-arm-msm, linux-usb, devicetree, linux-kernel
  Cc: Mark Brown, Liam Girdwood, Wesley Cheng, Greg Kroah-Hartman,
	Heikki Krogerus, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Bjorn Andersson, Konrad Dybcio, Bryan O'Donoghue,
	Casey Connolly

The PMI8998 PMIC includes a USB Type-C detection block at SPMI offset
0x1300 and a USB OTG VBUS boost converter at offset 0x1100. Both are
left disabled here so that only boards which wire up the connector and
USB role-switch enable them.

The VBUS regulator falls back to the qcom,pm8150b-vbus-reg compatible
because the OTG register layout (CMD_OTG, OTG_CFG, OTG_CURRENT_LIMIT)
is identical to the PM8150B SMB5 block.

Signed-off-by: taygoth <taygoth@gmail.com>
---
 arch/arm64/boot/dts/qcom/pmi8998.dtsi | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/pmi8998.dtsi b/arch/arm64/boot/dts/qcom/pmi8998.dtsi
index cd3f0790fd42..08a5f58c9b85 100644
--- a/arch/arm64/boot/dts/qcom/pmi8998.dtsi
+++ b/arch/arm64/boot/dts/qcom/pmi8998.dtsi
@@ -29,6 +29,25 @@ pmi8998_charger: charger@1000 {
 			status = "disabled";
 		};
 
+		pmi8998_vbus: vbus-reg@1100 {
+			compatible = "qcom,pmi8998-vbus-reg",
+				     "qcom,pm8150b-vbus-reg";
+			reg = <0x1100>;
+			status = "disabled";
+		};
+
+		pmi8998_typec: typec@1300 {
+			compatible = "qcom,pmi8998-typec";
+			reg = <0x1300>;
+
+			interrupts = <0x2 0x13 0x7 IRQ_TYPE_EDGE_BOTH>;
+			interrupt-names = "type-c-change";
+
+			vdd-vbus-supply = <&pmi8998_vbus>;
+
+			status = "disabled";
+		};
+
 		pmi8998_gpios: gpio@c000 {
 			compatible = "qcom,pmi8998-gpio", "qcom,spmi-gpio";
 			reg = <0xc000>;
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 5/6] arm64: dts: qcom: sdm845-oneplus-common: enable USB Type-C role switching
  2026-05-18 20:22 [PATCH 0/6] usb: typec: add Qualcomm PMI8998 USB Type-C role-switch support taygoth
                   ` (3 preceding siblings ...)
  2026-05-18 20:22 ` [PATCH 4/6] arm64: dts: qcom: pmi8998: add USB Type-C and VBUS regulator nodes taygoth
@ 2026-05-18 20:22 ` taygoth
  2026-05-18 21:36   ` sashiko-bot
  2026-05-18 20:22 ` [PATCH 6/6] MAINTAINERS: add entry for Qualcomm PMI8998 USB Type-C driver taygoth
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 21+ messages in thread
From: taygoth @ 2026-05-18 20:22 UTC (permalink / raw)
  To: linux-arm-msm, linux-usb, devicetree, linux-kernel
  Cc: Mark Brown, Liam Girdwood, Wesley Cheng, Greg Kroah-Hartman,
	Heikki Krogerus, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Bjorn Andersson, Konrad Dybcio, Bryan O'Donoghue,
	Casey Connolly

Enable the PMI8998 Type-C controller and USB OTG VBUS regulator so the
OnePlus 6 and OnePlus 6T can dynamically switch between USB peripheral
and host roles depending on the connected cable, instead of being
locked to peripheral mode at boot.

The dwc3 controller is moved from dr_mode = "peripheral" to "otg" and
gains a usb-role-switch property. The existing usb_1_dwc3_hs endpoint
declared in sdm845.dtsi has its remote-endpoint pointed at the new
pmi8998 Type-C connector subnode. The maximum-speed override is no
longer required because role switching infrastructure handles speed
negotiation through the usb-c-connector.

The VBUS regulator current limits (500 mA - 1.5 A) match the boost
converter capability noted in the downstream qpnp-smb2 charger config.

Signed-off-by: taygoth <taygoth@gmail.com>
---
 .../boot/dts/qcom/sdm845-oneplus-common.dtsi  | 43 ++++++++++++++++---
 1 file changed, 36 insertions(+), 7 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
index 6b7378cf4d49..42badc71ba6a 100644
--- a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
@@ -606,6 +606,36 @@ &pmi8998_charger {
 	status = "okay";
 };
 
+&pmi8998_vbus {
+	regulator-min-microamp = <500000>;
+	regulator-max-microamp = <1500000>;
+	status = "okay";
+};
+
+&pmi8998_typec {
+	status = "okay";
+
+	connector {
+		compatible = "usb-c-connector";
+		label = "USB-C";
+		power-role = "dual";
+		data-role = "dual";
+		try-power-role = "sink";
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+				pmi8998_hs_in: endpoint {
+					remote-endpoint = <&usb_1_dwc3_hs>;
+				};
+			};
+		};
+	};
+};
+
 &pmi8998_flash {
 	status = "okay";
 
@@ -890,19 +920,18 @@ &usb_1 {
 };
 
 &usb_1_dwc3 {
-	/*
-	 * We don't have the capability to switch modes yet.
-	 */
-	dr_mode = "peripheral";
-
-	/* fastest mode for USB 2 */
-	maximum-speed = "high-speed";
+	dr_mode = "otg";
+	usb-role-switch;
 
 	/* Remove USB3 phy as it's unused on this device. */
 	phys = <&usb_1_hsphy>;
 	phy-names = "usb2-phy";
 };
 
+&usb_1_dwc3_hs {
+	remote-endpoint = <&pmi8998_hs_in>;
+};
+
 &usb_1_hsphy {
 	status = "okay";
 
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 6/6] MAINTAINERS: add entry for Qualcomm PMI8998 USB Type-C driver
  2026-05-18 20:22 [PATCH 0/6] usb: typec: add Qualcomm PMI8998 USB Type-C role-switch support taygoth
                   ` (4 preceding siblings ...)
  2026-05-18 20:22 ` [PATCH 5/6] arm64: dts: qcom: sdm845-oneplus-common: enable USB Type-C role switching taygoth
@ 2026-05-18 20:22 ` taygoth
  2026-05-18 21:59 ` [PATCH 0/6] usb: typec: add Qualcomm PMI8998 USB Type-C role-switch support Bryan O'Donoghue
  2026-05-19 11:12 ` Konrad Dybcio
  7 siblings, 0 replies; 21+ messages in thread
From: taygoth @ 2026-05-18 20:22 UTC (permalink / raw)
  To: linux-arm-msm, linux-usb, devicetree, linux-kernel
  Cc: Mark Brown, Liam Girdwood, Wesley Cheng, Greg Kroah-Hartman,
	Heikki Krogerus, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Bjorn Andersson, Konrad Dybcio, Bryan O'Donoghue,
	Casey Connolly

Add a MAINTAINERS entry covering the new qcom_pmi8998_typec driver
and its device-tree binding.

Signed-off-by: taygoth <taygoth@gmail.com>
---
 MAINTAINERS | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index c2c6d79275c6..d2861fdef012 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -22120,6 +22120,14 @@ S:	Maintained
 F:	Documentation/devicetree/bindings/usb/qcom,pmic-*.yaml
 F:	drivers/usb/typec/tcpm/qcom/
 
+QUALCOMM PMI8998 USB TYPE-C ROLE-SWITCH DRIVER
+M:	Maxim Furman <taygoth@gmail.com>
+L:	linux-arm-msm@vger.kernel.org
+L:	linux-usb@vger.kernel.org
+S:	Maintained
+F:	Documentation/devicetree/bindings/usb/qcom,pmi8998-typec.yaml
+F:	drivers/usb/typec/qcom_pmi8998_typec.c
+
 QUALCOMM VENUS VIDEO ACCELERATOR DRIVER
 M:	Vikash Garodia <vikash.garodia@oss.qualcomm.com>
 M:	Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH 2/6] dt-bindings: usb: add Qualcomm PMI8998 Type-C controller
  2026-05-18 20:22 ` [PATCH 2/6] dt-bindings: usb: add Qualcomm PMI8998 Type-C controller taygoth
@ 2026-05-18 20:42   ` sashiko-bot
  2026-05-18 22:03   ` Dmitry Baryshkov
  1 sibling, 0 replies; 21+ messages in thread
From: sashiko-bot @ 2026-05-18 20:42 UTC (permalink / raw)
  To: taygoth; +Cc: robh, devicetree, conor+dt

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The `qcom,spmi-pmic.yaml` parent schema unconditionally enforces the old `qcom,pmic-typec.yaml` on all `typec@` nodes, which will cause `dtbs_check` validation failures for the newly introduced `qcom,pmi8998-typec` hardware node.
--

commit 1c9db8c5249c49002058f3167b19c898d414957d
Author: taygoth <taygoth@gmail.com>
dt-bindings: usb: add Qualcomm PMI8998 Type-C controller

This commit adds a new devicetree binding for the Qualcomm PMI8998 USB
Type-C role-switch controller. It describes a hardware block distinct from
the TCPM-based qcom,pmic-typec controllers, using a single consolidated
interrupt instead of granular per-event IRQs.

> diff --git a/Documentation/devicetree/bindings/usb/qcom,pmi8998-typec.yaml b/Documentation/devicetree/bindings/usb/qcom,pmi8998-typec.yaml
> new file mode 100644
> index 0000000000000..f2814f5ce3de7
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/usb/qcom,pmi8998-typec.yaml
[ ... ]
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +
> +    pmic {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        typec@1300 {
> +            compatible = "qcom,pmi8998-typec";

Will this node cause dtbs_check validation failures when instantiated
under the PMIC?

In Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml, the
patternProperties rule for ^typec@[0-9a-f]+$ has a hardcoded reference
to /schemas/usb/qcom,pmic-typec.yaml#.

Because this new qcom,pmi8998-typec schema defines only 1 interrupt instead
of the 8 to 16 required by the older binding, it will fail validation
against the parent PMIC schema.

Should the parent qcom,spmi-pmic.yaml schema be updated alongside this
change to permit this new hardware block?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1779127507.git.taygoth@gmail.com?part=2

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 3/6] usb: typec: add Qualcomm PMI8998 role-switch driver
  2026-05-18 20:22 ` [PATCH 3/6] usb: typec: add Qualcomm PMI8998 role-switch driver taygoth
@ 2026-05-18 20:58   ` sashiko-bot
  2026-05-18 21:45   ` Dmitry Baryshkov
  2026-05-19 10:52   ` Krzysztof Kozlowski
  2 siblings, 0 replies; 21+ messages in thread
From: sashiko-bot @ 2026-05-18 20:58 UTC (permalink / raw)
  To: taygoth; +Cc: robh, conor+dt, devicetree

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] Race condition and Use-After-Free during driver removal due to mixed devm and manual cleanup.
- [Medium] VBUS regulator enable count leak on probe error path.
- [Medium] Silently ignored return value of hardware initialization in probe().
--

commit 2be57d2a22cd876c2f33d5adcda09af34cd9c497
Author: taygoth <taygoth@gmail.com>

usb: typec: add Qualcomm PMI8998 role-switch driver

This commit introduces a new USB Type-C role-switch driver for the Qualcomm
PMI8998 PMIC. It translates the hardware-detected role into a consumer
switch state, and enables an optional VBUS supply regulator when acting as
a USB host.

> diff --git a/drivers/usb/typec/qcom_pmi8998_typec.c b/drivers/usb/typec/qcom_pmi8998_typec.c
> new file mode 100644
> index 0000000000000..77662b4f1b0c6
> --- /dev/null
> +++ b/drivers/usb/typec/qcom_pmi8998_typec.c

[ ... ]

> +static int pmi8998_typec_probe(struct platform_device *pdev)
> +{

[ ... ]

> +	platform_set_drvdata(pdev, typec);
> +
> +	pmi8998_typec_apply(typec);

Should the return value of pmi8998_typec_apply() be checked here? 

If operations like regmap_read() or regulator_enable() fail inside apply(),
the probe will silently succeed with an unsynchronized hardware state.

> +
> +	ret = devm_request_threaded_irq(dev, typec->irq, NULL,
> +					pmi8998_typec_isr, IRQF_ONESHOT,
> +					dev_name(dev), typec);
> +	if (ret)
> +		goto err_role_put;
> +
> +	return 0;
> +
> +err_role_put:
> +	usb_role_switch_put(typec->role_sw);

If pmi8998_typec_apply() above evaluates to USB_ROLE_HOST, it will enable
the vbus regulator and set typec->vbus_enabled to true. 

If the interrupt request then fails, does this error path leak the regulator
enable count by missing a regulator_disable() call?

> +	return ret;
> +}
> +
> +static void pmi8998_typec_remove(struct platform_device *pdev)
> +{
> +	struct pmi8998_typec *typec = platform_get_drvdata(pdev);
> +
> +	if (typec->vbus_enabled)
> +		regulator_disable(typec->vbus);
> +	usb_role_switch_put(typec->role_sw);

Because the interrupt was requested using devm_request_threaded_irq(), it
will not be freed until after pmi8998_typec_remove() returns.

If a hardware interrupt fires right after we disable the regulator and
put the role switch:

pmi8998_typec_remove()
    regulator_disable(typec->vbus);
    usb_role_switch_put(typec->role_sw);

-> interrupt fires
pmi8998_typec_isr()
    pmi8998_typec_apply()

Could the ISR attempt to use the freed typec->role_sw or perform an
unbalanced regulator_disable() since typec->vbus_enabled is never set
to false in remove()?

> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1779127507.git.taygoth@gmail.com?part=3

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 4/6] arm64: dts: qcom: pmi8998: add USB Type-C and VBUS regulator nodes
  2026-05-18 20:22 ` [PATCH 4/6] arm64: dts: qcom: pmi8998: add USB Type-C and VBUS regulator nodes taygoth
@ 2026-05-18 21:19   ` sashiko-bot
  0 siblings, 0 replies; 21+ messages in thread
From: sashiko-bot @ 2026-05-18 21:19 UTC (permalink / raw)
  To: taygoth; +Cc: robh, conor+dt, devicetree

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Devicetree schema validation failure for VBUS regulator node due to incorrect name and missing properties.
- [Medium] Devicetree schema validation failure for Type-C node due to schema routing conflict and missing required subnode.
--

commit d114c820eb701d590cfd5b3e5e83a32def5c8605
Author: taygoth <taygoth@gmail.com>

arm64: dts: qcom: pmi8998: add USB Type-C and VBUS regulator nodes

This commit adds disabled nodes for the PMI8998 PMIC USB Type-C detection
block and the USB OTG VBUS boost converter. The VBUS regulator falls back
to the pm8150b-vbus-reg compatible due to identical register layouts.

> --- a/arch/arm64/boot/dts/qcom/pmi8998.dtsi
> +++ b/arch/arm64/boot/dts/qcom/pmi8998.dtsi
> @@ -29,6 +29,25 @@ pmi8998_charger: charger@1000 {
>  			status = "disabled";
>  		};
>  
> +		pmi8998_vbus: vbus-reg@1100 {

Will this node name cause a devicetree schema validation failure during
dtbs_check?

It looks like Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml
enforces the node name pattern ^usb-vbus-regulator@[0-9a-f]+$ and has
additionalProperties: false.

> +			compatible = "qcom,pmi8998-vbus-reg",
> +				     "qcom,pm8150b-vbus-reg";
> +			reg = <0x1100>;

Are we missing the regulator-min-microamp and regulator-max-microamp
properties here? 

The qcom,usb-vbus-regulator.yaml schema strictly requires them, which might
trigger warnings for all boards including pmi8998.dtsi even if the status is
disabled.

> +			status = "disabled";
> +		};
> +
> +		pmi8998_typec: typec@1300 {

Does naming this node typec@1300 create a schema routing conflict?

The pattern ^typec@[0-9a-f]+$ in qcom,spmi-pmic.yaml hardcodes a reference
to /schemas/usb/qcom,pmic-typec.yaml#. Since qcom,pmi8998-typec has its own
binding and isn't permitted in qcom,pmic-typec.yaml, dtbs_check might
evaluate it against the wrong schema and reject the compatible string.

> +			compatible = "qcom,pmi8998-typec";
> +			reg = <0x1300>;
> +
> +			interrupts = <0x2 0x13 0x7 IRQ_TYPE_EDGE_BOTH>;
> +			interrupt-names = "type-c-change";
> +
> +			vdd-vbus-supply = <&pmi8998_vbus>;

Does this node also need the connector subnode? It appears to be explicitly
listed as required in qcom,pmi8998-typec.yaml.

> +
> +			status = "disabled";
> +		};

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1779127507.git.taygoth@gmail.com?part=4

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 5/6] arm64: dts: qcom: sdm845-oneplus-common: enable USB Type-C role switching
  2026-05-18 20:22 ` [PATCH 5/6] arm64: dts: qcom: sdm845-oneplus-common: enable USB Type-C role switching taygoth
@ 2026-05-18 21:36   ` sashiko-bot
  0 siblings, 0 replies; 21+ messages in thread
From: sashiko-bot @ 2026-05-18 21:36 UTC (permalink / raw)
  To: taygoth; +Cc: conor+dt, devicetree, robh

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Removing `maximum-speed = "high-speed"` misconfigures the DWC3 controller to default to SuperSpeed on a physically High-Speed-only board, leading to false capabilities advertisement and potential AXI bus hangs.
- [High] The `vdd-vbus-supply` property is missing from the `&pmi8998_typec` node, which completely breaks VBUS power delivery in USB host mode.
--

commit fd2e287ee85d01cae64bd27f78d0a7b1a4d6ea65
Author: taygoth <taygoth@gmail.com>

arm64: dts: qcom: sdm845-oneplus-common: enable USB Type-C role switching

This commit enables the PMI8998 Type-C controller and configures the dwc3
controller for OTG mode on the OnePlus 6/6T. It removes the maximum-speed
property and maps the USB endpoints for role switching.

> diff --git a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
> --- a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
[ ... ]
> +&pmi8998_vbus {
> +	regulator-min-microamp = <500000>;
> +	regulator-max-microamp = <1500000>;
> +	status = "okay";
> +};
> +
> +&pmi8998_typec {
> +	status = "okay";

Does this node need a vdd-vbus-supply property?

The qcom,pmi8998-typec driver looks up the VBUS regulator using
devm_regulator_get_optional(dev, "vdd-vbus"). Without a vdd-vbus-supply
property pointing to &pmi8998_vbus, the lookup returns -ENODEV and the
driver proceeds with a NULL vbus.

Will this result in the driver silently skipping the VBUS regulator
enablement during USB_ROLE_HOST transitions, leaving bus-powered downstream
peripherals without power?

> +
> +	connector {
> +		compatible = "usb-c-connector";
[ ... ]
> @@ -890,19 +920,18 @@ &usb_1 {
>  };
>  
>  &usb_1_dwc3 {
> -	/*
> -	 * We don't have the capability to switch modes yet.
> -	 */
> -	dr_mode = "peripheral";
> -
> -	/* fastest mode for USB 2 */
> -	maximum-speed = "high-speed";
> +	dr_mode = "otg";
> +	usb-role-switch;

Is it safe to remove the maximum-speed property here?

The commit message notes that the role switching infrastructure handles speed
negotiation through the usb-c-connector. However, Type-C CC pins typically
only negotiate power delivery and data roles, not the underlying USB protocol
speed limits.

If maximum-speed is omitted, the DWC3 core driver falls back to reading the
controller's internal hardware parameters (GHWPARAMS3). Since the SDM845 IP
is SuperSpeed-capable, it will default to USB_SPEED_SUPER.

Because the board only wires High-Speed lines and drops the SuperSpeed PHY
(phys = <&usb_1_hsphy>), will the xHCI driver register a SuperSpeed root hub
and attempt Rx.Detect polling? Could attempting to access the PIPE interface
of an unclocked QMP PHY trigger an AXI bus hang?

>  
>  	/* Remove USB3 phy as it's unused on this device. */
>  	phys = <&usb_1_hsphy>;
[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1779127507.git.taygoth@gmail.com?part=5

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 3/6] usb: typec: add Qualcomm PMI8998 role-switch driver
  2026-05-18 20:22 ` [PATCH 3/6] usb: typec: add Qualcomm PMI8998 role-switch driver taygoth
  2026-05-18 20:58   ` sashiko-bot
@ 2026-05-18 21:45   ` Dmitry Baryshkov
  2026-05-18 22:07     ` Bryan O'Donoghue
  2026-05-19 10:52   ` Krzysztof Kozlowski
  2 siblings, 1 reply; 21+ messages in thread
From: Dmitry Baryshkov @ 2026-05-18 21:45 UTC (permalink / raw)
  To: taygoth
  Cc: linux-arm-msm, linux-usb, devicetree, linux-kernel, Mark Brown,
	Liam Girdwood, Wesley Cheng, Greg Kroah-Hartman, Heikki Krogerus,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Bjorn Andersson,
	Konrad Dybcio, Bryan O'Donoghue, Casey Connolly

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@gmail.com>

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

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 1/6] dt-bindings: regulator: qcom,usb-vbus-regulator: add PMI8998
  2026-05-18 20:22 ` [PATCH 1/6] dt-bindings: regulator: qcom,usb-vbus-regulator: add PMI8998 taygoth
@ 2026-05-18 21:56   ` Bryan O'Donoghue
  2026-05-19 10:51   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 21+ messages in thread
From: Bryan O'Donoghue @ 2026-05-18 21:56 UTC (permalink / raw)
  To: taygoth, linux-arm-msm, linux-usb, devicetree, linux-kernel
  Cc: Mark Brown, Liam Girdwood, Wesley Cheng, Greg Kroah-Hartman,
	Heikki Krogerus, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Bjorn Andersson, Konrad Dybcio, Casey Connolly

On 18/05/2026 21:22, taygoth wrote:
> The Qualcomm PMI8998 PMIC integrates a USB OTG VBUS boost converter
> inside its SMB2 charger block at offset 0x1100. The OTG control
> register layout (CMD_OTG at +0x40, OTG_CURRENT_LIMIT_CFG at +0x52,
> OTG_CFG at +0x53) matches the PM8150B SMB5 block, so the existing
> qcom_usb_vbus-regulator driver can drive it without code changes via
> compatible cascade.
> 
> Verified by inspecting the downstream qpnp-smb2 driver and reading
> live register values on a OnePlus 6T (sdm845-oneplus-fajita) running
> mainline Linux.
> 
> Signed-off-by: taygoth <taygoth@gmail.com>
> ---
>   .../devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml   | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml b/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml
> index fcefc722ee2a..9e2e2c8f9539 100644
> --- a/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml
> +++ b/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml
> @@ -28,6 +28,7 @@ properties:
>                 - qcom,pm6150-vbus-reg
>                 - qcom,pm7250b-vbus-reg
>                 - qcom,pmi632-vbus-reg
> +              - qcom,pmi8998-vbus-reg
>             - const: qcom,pm8150b-vbus-reg
>   
>     reg:

Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>

---
bod

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 0/6] usb: typec: add Qualcomm PMI8998 USB Type-C role-switch support
  2026-05-18 20:22 [PATCH 0/6] usb: typec: add Qualcomm PMI8998 USB Type-C role-switch support taygoth
                   ` (5 preceding siblings ...)
  2026-05-18 20:22 ` [PATCH 6/6] MAINTAINERS: add entry for Qualcomm PMI8998 USB Type-C driver taygoth
@ 2026-05-18 21:59 ` Bryan O'Donoghue
       [not found]   ` <CAFPzRonyVt9Kd+Sc0ooNz8By6b-Zr_jHr0sBXv-M25dQ0w9Cjg@mail.gmail.com>
  2026-05-19 11:12 ` Konrad Dybcio
  7 siblings, 1 reply; 21+ messages in thread
From: Bryan O'Donoghue @ 2026-05-18 21:59 UTC (permalink / raw)
  To: taygoth, linux-arm-msm, linux-usb, devicetree, linux-kernel
  Cc: Mark Brown, Liam Girdwood, Wesley Cheng, Greg Kroah-Hartman,
	Heikki Krogerus, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Bjorn Andersson, Konrad Dybcio, Casey Connolly

On 18/05/2026 21:22, taygoth wrote:
> Power Delivery is not implemented. The PMI8998 PDPHY block at offset
> 0x1700 is register-identical to PM8150B and could be wired through
> the existing drivers/usb/typec/tcpm/qcom code in a follow-up if PD
> negotiation becomes a requirement.

So in this case why not implement your code as a new instance of of 
type-c phy in the existing TCPM driver ?

---
bod

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 2/6] dt-bindings: usb: add Qualcomm PMI8998 Type-C controller
  2026-05-18 20:22 ` [PATCH 2/6] dt-bindings: usb: add Qualcomm PMI8998 Type-C controller taygoth
  2026-05-18 20:42   ` sashiko-bot
@ 2026-05-18 22:03   ` Dmitry Baryshkov
  1 sibling, 0 replies; 21+ messages in thread
From: Dmitry Baryshkov @ 2026-05-18 22:03 UTC (permalink / raw)
  To: taygoth
  Cc: linux-arm-msm, linux-usb, devicetree, linux-kernel, Mark Brown,
	Liam Girdwood, Wesley Cheng, Greg Kroah-Hartman, Heikki Krogerus,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Bjorn Andersson,
	Konrad Dybcio, Bryan O'Donoghue, Casey Connolly

On Tue, May 19, 2026 at 01:22:47AM +0500, taygoth wrote:
> The 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 hardware and reports role changes
> through a single consolidated "type-c-change" interrupt.
> 
> This is architecturally distinct from the qcom,pmic-typec binding
> (PM8150B / PMI632 family) which exposes a granular 8-16 IRQ topology
> fanned out per Type-C event for a software TCPM state machine. PMI8998
> has neither the per-event IRQs nor a register layout compatible with
> the TCPM code path, so this binding describes a separate hardware-
> managed role-switch controller.
> 
> Signed-off-by: taygoth <taygoth@gmail.com>
> ---
>  .../bindings/usb/qcom,pmi8998-typec.yaml      | 97 +++++++++++++++++++
>  1 file changed, 97 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/usb/qcom,pmi8998-typec.yaml
> 
> diff --git a/Documentation/devicetree/bindings/usb/qcom,pmi8998-typec.yaml b/Documentation/devicetree/bindings/usb/qcom,pmi8998-typec.yaml
> new file mode 100644
> index 000000000000..f2814f5ce3de
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/usb/qcom,pmi8998-typec.yaml
> @@ -0,0 +1,97 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/usb/qcom,pmi8998-typec.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Qualcomm PMI8998 USB Type-C role-switch controller
> +
> +maintainers:
> +  - Maxim Furman <taygoth@gmail.com>
> +
> +description:
> +  The PMI8998 PMIC integrates a USB Type-C detection block inside its SMB2
> +  charger USBIN region at offset 0x1300. CC sensing, debounce and Rp/Rd
> +  resolution are performed in hardware, and the negotiated role is reported
> +  through a single consolidated "type-c-change" interrupt.
> +
> +  This block is distinct from the TCPM-based qcom,pmic-typec controllers
> +  (PM8150B, PMI632, etc.) — PMI8998 lacks the granular per-event interrupt
> +  topology those parts expose and the driver therefore translates the
> +  hardware-decided role directly into a usb_role_switch_set_role() call
> +  rather than running a software TCPM state machine. Power Delivery is not
> +  supported by this binding.
> +
> +properties:
> +  compatible:
> +    const: qcom,pmi8998-typec
> +
> +  reg:
> +    maxItems: 1
> +    description: Type-C SPMI register base offset (typically 0x1300).
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  interrupt-names:
> +    items:
> +      - const: type-c-change
> +
> +  vdd-vbus-supply:
> +    description:
> +      VBUS source regulator enabled when the controller transitions to
> +      USB host mode so bus-powered downstream peripherals can be powered.

We probably need to fix this for PM8150B too... This should be
connector's vbus-supply instead. I'll send a patch for the existing
devices.

> +
> +  connector:
> +    type: object
> +    $ref: /schemas/connector/usb-connector.yaml#
> +    unevaluatedProperties: false
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +  - interrupt-names
> +  - connector
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +
> +    pmic {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        typec@1300 {
> +            compatible = "qcom,pmi8998-typec";
> +            reg = <0x1300>;
> +
> +            interrupts = <0x2 0x13 0x7 IRQ_TYPE_EDGE_BOTH>;
> +            interrupt-names = "type-c-change";
> +
> +            vdd-vbus-supply = <&pmi8998_vbus>;
> +
> +            connector {
> +                compatible = "usb-c-connector";
> +                label = "USB-C";
> +                power-role = "dual";
> +                data-role = "dual";
> +                try-power-role = "sink";
> +
> +                ports {
> +                    #address-cells = <1>;
> +                    #size-cells = <0>;
> +
> +                    port@0 {
> +                        reg = <0>;
> +                        pmi8998_hs_in: endpoint {
> +                            remote-endpoint = <&usb_1_dwc3_hs>;
> +                        };
> +                    };
> +                };
> +            };
> +        };
> +    };
> +...
> -- 
> 2.47.3
> 

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 3/6] usb: typec: add Qualcomm PMI8998 role-switch driver
  2026-05-18 21:45   ` Dmitry Baryshkov
@ 2026-05-18 22:07     ` Bryan O'Donoghue
  2026-05-18 22:09       ` Bryan O'Donoghue
  0 siblings, 1 reply; 21+ messages in thread
From: Bryan O'Donoghue @ 2026-05-18 22:07 UTC (permalink / raw)
  To: Dmitry Baryshkov, taygoth
  Cc: linux-arm-msm, linux-usb, devicetree, linux-kernel, Mark Brown,
	Liam Girdwood, Wesley Cheng, Greg Kroah-Hartman, Heikki Krogerus,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Bjorn Andersson,
	Konrad Dybcio, Casey Connolly, Luca Weiss

On 18/05/2026 22:45, Dmitry Baryshkov wrote:
>> 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).

If the PDPHY is register compatible  as stated then the PD part is very 
close.

Looking at the pmi8998 STATUS_REG_4

- VBUS_STATUS
- ORIENTATION
- ATTACHED

are all driven. So I believe it would be possible to bring the pmi8998 
into - along side the pmi8998 logic.

@Maxim have you looked at that as an option ?

I believe Casey and Luca? both worked on that.

For preference I think we should try to land pmi8998 into the existing 
TCPM logic though, as another TypeC port handler within the existing logic.

The important signals above, appear to be driven.

---
bod

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 3/6] usb: typec: add Qualcomm PMI8998 role-switch driver
  2026-05-18 22:07     ` Bryan O'Donoghue
@ 2026-05-18 22:09       ` Bryan O'Donoghue
  0 siblings, 0 replies; 21+ messages in thread
From: Bryan O'Donoghue @ 2026-05-18 22:09 UTC (permalink / raw)
  To: Dmitry Baryshkov, taygoth
  Cc: linux-arm-msm, linux-usb, devicetree, linux-kernel, Mark Brown,
	Liam Girdwood, Wesley Cheng, Greg Kroah-Hartman, Heikki Krogerus,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Bjorn Andersson,
	Konrad Dybcio, Casey Connolly, Luca Weiss

On 18/05/2026 23:07, Bryan O'Donoghue wrote:
> along side the pmi8998 logic.

*pm8150b

---
bod

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 0/6] usb: typec: add Qualcomm PMI8998 USB Type-C role-switch support
       [not found]   ` <CAFPzRonyVt9Kd+Sc0ooNz8By6b-Zr_jHr0sBXv-M25dQ0w9Cjg@mail.gmail.com>
@ 2026-05-18 23:43     ` Bryan O'Donoghue
  0 siblings, 0 replies; 21+ messages in thread
From: Bryan O'Donoghue @ 2026-05-18 23:43 UTC (permalink / raw)
  To: Максим Фурман
  Cc: linux-arm-msm, linux-usb, devicetree, linux-kernel, Mark Brown,
	Liam Girdwood, Wesley Cheng, Greg Kroah-Hartman, Heikki Krogerus,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Bjorn Andersson,
	Konrad Dybcio, Casey Connolly

On 19/05/2026 00:37, Максим Фурман wrote:
> Three shapes for adding a second port handler to the existing driver:
>    (a) extracted ops -- pmic_typec_port_ops with chip-specific get_cc /
>        get_vbus / set_mode / set_vconn / start_toggling, refactor PM8150B
>        code into the ops, add parallel PMI8998 implementation
>    (b) parallel port file -- keep PM8150B code untouched, add a sibling
>        source file with the same tcpc_dev callback surface
>    (c) per-chip register table + per-chip decode helpers in the same file
> 
> Bryan, do you have a preference? I'd rather match your taste than guess,
> since you'll be maintaining the merged result.

Taste - loaded with honey, chilli and salt please chef and add the whole 
clove of garlic....

My feeling is sibling file but please use your own taste/discretion.

---
bod

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 1/6] dt-bindings: regulator: qcom,usb-vbus-regulator: add PMI8998
  2026-05-18 20:22 ` [PATCH 1/6] dt-bindings: regulator: qcom,usb-vbus-regulator: add PMI8998 taygoth
  2026-05-18 21:56   ` Bryan O'Donoghue
@ 2026-05-19 10:51   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 21+ messages in thread
From: Krzysztof Kozlowski @ 2026-05-19 10:51 UTC (permalink / raw)
  To: taygoth
  Cc: linux-arm-msm, linux-usb, devicetree, linux-kernel, Mark Brown,
	Liam Girdwood, Wesley Cheng, Greg Kroah-Hartman, Heikki Krogerus,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Bjorn Andersson,
	Konrad Dybcio, Bryan O'Donoghue, Casey Connolly

On Tue, May 19, 2026 at 01:22:46AM +0500, taygoth wrote:
> The Qualcomm PMI8998 PMIC integrates a USB OTG VBUS boost converter
> inside its SMB2 charger block at offset 0x1100. The OTG control
> register layout (CMD_OTG at +0x40, OTG_CURRENT_LIMIT_CFG at +0x52,
> OTG_CFG at +0x53) matches the PM8150B SMB5 block, so the existing
> qcom_usb_vbus-regulator driver can drive it without code changes via
> compatible cascade.
> 
> Verified by inspecting the downstream qpnp-smb2 driver and reading
> live register values on a OnePlus 6T (sdm845-oneplus-fajita) running
> mainline Linux.
> 
> Signed-off-by: taygoth <taygoth@gmail.com>

Incomplete identity. Please use real names. We do not accept anonymous
contributions.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 3/6] usb: typec: add Qualcomm PMI8998 role-switch driver
  2026-05-18 20:22 ` [PATCH 3/6] usb: typec: add Qualcomm PMI8998 role-switch driver taygoth
  2026-05-18 20:58   ` sashiko-bot
  2026-05-18 21:45   ` Dmitry Baryshkov
@ 2026-05-19 10:52   ` Krzysztof Kozlowski
  2 siblings, 0 replies; 21+ messages in thread
From: Krzysztof Kozlowski @ 2026-05-19 10:52 UTC (permalink / raw)
  To: taygoth
  Cc: linux-arm-msm, linux-usb, devicetree, linux-kernel, Mark Brown,
	Liam Girdwood, Wesley Cheng, Greg Kroah-Hartman, Heikki Krogerus,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Bjorn Andersson,
	Konrad Dybcio, Bryan O'Donoghue, Casey Connolly

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.
> 
> 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.
> 
> 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@gmail.com>

Incomplete identity.

> ---
>  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

Do not mix up subsystems which take entire sets in one patchset. USB
patches should be split.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 0/6] usb: typec: add Qualcomm PMI8998 USB Type-C role-switch support
  2026-05-18 20:22 [PATCH 0/6] usb: typec: add Qualcomm PMI8998 USB Type-C role-switch support taygoth
                   ` (6 preceding siblings ...)
  2026-05-18 21:59 ` [PATCH 0/6] usb: typec: add Qualcomm PMI8998 USB Type-C role-switch support Bryan O'Donoghue
@ 2026-05-19 11:12 ` Konrad Dybcio
  7 siblings, 0 replies; 21+ messages in thread
From: Konrad Dybcio @ 2026-05-19 11:12 UTC (permalink / raw)
  To: taygoth, linux-arm-msm, linux-usb, devicetree, linux-kernel
  Cc: Mark Brown, Liam Girdwood, Wesley Cheng, Greg Kroah-Hartman,
	Heikki Krogerus, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Bjorn Andersson, Konrad Dybcio, Bryan O'Donoghue,
	Casey Connolly

On 5/18/26 10:22 PM, taygoth wrote:
> This series adds USB Type-C role-switch support for the PMI8998 PMIC
> used on SDM845 phones (OnePlus 6/6T, Xiaomi Poco F1, SHIFT 6mq), which
> have been locked to USB peripheral mode under mainline kernels until
> now.
> 
> The PMI8998 SMB2 charger block integrates a Type-C detection unit at
> SPMI offset 0x1300 that performs CC sensing, debounce and Rp/Rd
> resolution entirely in hardware. The state is exposed through the
> TYPE_C_STATUS_4 register and reported via a single consolidated
> "type-c-change" interrupt. The new driver reads that status on every
> interrupt and pushes the negotiated role to a usb_role_switch consumer
> (dwc3), enabling automatic peripheral/host switching on cable change.
> Because the hardware handles the Type-C state machine natively, no
> software TCPM port manager is required.
> 
> The Type-C block shares the SMB2 USBIN region with the already
> mainlined qcom_pmi8998-charger driver. The two coexist on the shared
> SPMI regmap without write conflict: the typec driver only reads
> TYPE_C_STATUS_* and touches the IRQ enable bits at offsets
> 0x130b-0x130f and 0x1367-0x1368.
> 
> The PMI8998 USB OTG VBUS boost converter at offset 0x1100 has the
> same CMD_OTG / OTG_CFG / OTG_CURRENT_LIMIT register layout as PM8150B,
> so the existing drivers/regulator/qcom_usb_vbus-regulator can drive it
> through a compatible cascade -- only the DT binding needs the new
> compatible string added.
> 
> Power Delivery is not implemented. The PMI8998 PDPHY block at offset
> 0x1700 is register-identical to PM8150B and could be wired through
> the existing drivers/usb/typec/tcpm/qcom code in a follow-up if PD
> negotiation becomes a requirement.
> 
> Tested-on: OnePlus 6T (sdm845-oneplus-fajita) running Mobian
> 6.12-sdm845.

FWIW 6.12 has been released 2 years ago and the sdm845 fork contains
a lot of unrelated changes. Please give this a test on linux-next/master

Konrad

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2026-05-19 11:12 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-18 20:22 [PATCH 0/6] usb: typec: add Qualcomm PMI8998 USB Type-C role-switch support taygoth
2026-05-18 20:22 ` [PATCH 1/6] dt-bindings: regulator: qcom,usb-vbus-regulator: add PMI8998 taygoth
2026-05-18 21:56   ` Bryan O'Donoghue
2026-05-19 10:51   ` Krzysztof Kozlowski
2026-05-18 20:22 ` [PATCH 2/6] dt-bindings: usb: add Qualcomm PMI8998 Type-C controller taygoth
2026-05-18 20:42   ` sashiko-bot
2026-05-18 22:03   ` Dmitry Baryshkov
2026-05-18 20:22 ` [PATCH 3/6] usb: typec: add Qualcomm PMI8998 role-switch driver taygoth
2026-05-18 20:58   ` sashiko-bot
2026-05-18 21:45   ` Dmitry Baryshkov
2026-05-18 22:07     ` Bryan O'Donoghue
2026-05-18 22:09       ` Bryan O'Donoghue
2026-05-19 10:52   ` Krzysztof Kozlowski
2026-05-18 20:22 ` [PATCH 4/6] arm64: dts: qcom: pmi8998: add USB Type-C and VBUS regulator nodes taygoth
2026-05-18 21:19   ` sashiko-bot
2026-05-18 20:22 ` [PATCH 5/6] arm64: dts: qcom: sdm845-oneplus-common: enable USB Type-C role switching taygoth
2026-05-18 21:36   ` sashiko-bot
2026-05-18 20:22 ` [PATCH 6/6] MAINTAINERS: add entry for Qualcomm PMI8998 USB Type-C driver taygoth
2026-05-18 21:59 ` [PATCH 0/6] usb: typec: add Qualcomm PMI8998 USB Type-C role-switch support Bryan O'Donoghue
     [not found]   ` <CAFPzRonyVt9Kd+Sc0ooNz8By6b-Zr_jHr0sBXv-M25dQ0w9Cjg@mail.gmail.com>
2026-05-18 23:43     ` Bryan O'Donoghue
2026-05-19 11:12 ` Konrad Dybcio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox