Thread (16 messages) 16 messages, 5 authors, 4d ago

[PATCH 5/6] arm64: dts: qcom: sdm845-oneplus-common: enable USB Type-C role switching

From: taygoth <hidden>
Date: 2026-05-18 20:23:15
Also in: linux-devicetree, linux-usb, lkml
Subsystem: arm/qualcomm mailing list, arm/qualcomm support, the rest · Maintainers: Bjorn Andersson, Konrad Dybcio, Linus Torvalds

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 <redacted>
---
 .../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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help