From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68F2A3246E8 for ; Mon, 18 May 2026 20:23:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779135782; cv=none; b=i2w0BXoAK902lswflqGmG2o4A4wC4ih0FeB2lsWDJ3z2jrswL44WpTLIaMdJu0X30UuqndA6sEXcRAzgg/Dmlwh8Cezeii44YTZIvqJFyinSfA3gt7iB1WsQ0IEaF5GAM7SIoPJQC3xe17wRBPCqGNQY/lb0ygEZ1g6oP5N9Umk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779135782; c=relaxed/simple; bh=7wjz55g5It7D1iARd2kd9SG5ABYHwmZ+CNk27XYM0yk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=P8fWE38JrbGW408tQOH5EHsZeb+Xm46ehj5zcmZjdj4MPLTmVGFCnA+aRzGJbZd5J1VuK9P7VnKDSRrqIFw9efGxu0jr1957P3zTtsMprOK6qZnzzXOUEDYVj3LFP9DUijHk2oK9PCnxOj92fy/56YZXR+9KpEnx/K77l+25Lgs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JYWi7qrO; arc=none smtp.client-ip=209.85.208.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JYWi7qrO" Received: by mail-lj1-f177.google.com with SMTP id 38308e7fff4ca-393da8f389bso27619641fa.1 for ; Mon, 18 May 2026 13:23:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779135779; x=1779740579; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=2hKEXdf7SpgU8S8EsSxa8nph73zmVb4ykhaEpQLdhQs=; b=JYWi7qrO1QGMYc4/kgccIhi5wzyqO7daO4KqRUfknPRvdgfN8F0cAj+glq2kTwHuSO FM/IoYgQl05303L1NVjsPudRPqexYRrr7XDivoCo4Z3ZzPuJn/Ui3W/hRpdk4Ik5N/dL vN+xJ3RORmCSo06GdwDLjz8VyPPlHDFiLr4cxSF5b/6h9Hd11T5zrqbTQMcYZ4dIWWPa G5hwj4hmtpNb+TmlH4KMvtG+lQLm9xsQQ37yYee93Ar3P6lFlF4TyIeHlykACFEG9cRc 4ktCP7jmPqIZSlxqjDoeAVOpJyEWVSVclrRAxmSTEW15myYJxfXE7BNWp5KzJHUo0CjJ s2QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779135779; x=1779740579; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=2hKEXdf7SpgU8S8EsSxa8nph73zmVb4ykhaEpQLdhQs=; b=nJKQftaLTr3RpynteV1TQP70vlVLbjP51eF1vyZ4pk2xhKaeD9zyco9LRI4MWCE5ss DMLgimEBKOCSj+kAVWIRd0BCDI0YTS+uOQVqf+dHs4Xi4DqFYuvnfRtt1IwFKxGPFeQ/ JhjMzikgEgBCYfGdca1OLAlfCMoTWVKAXqGbR8nkQJorarD9XHrW9abyuVrRnpYbuDrZ IxrmDcjmoYWJS1FHOi9qPBuz4GhxcTM9A9dcpEOWzqwhAjt5X7hY2FYvk7poM3JAQf05 EG5928t5nRQaqgGzeKL56ZE41PwtijXQQsNzYTA4SxwVj2J3tNhNPHSU8hpa8Dnd/Ey9 3nAg== X-Forwarded-Encrypted: i=1; AFNElJ8NjUvGCYvOsH5yYPOQvLRjuKJlfOILUPwu3ayjD1g8QuWyGnTEoTdSaIdAdz9lUTaxj32rVHRgG/7re38=@vger.kernel.org X-Gm-Message-State: AOJu0Yy3v3vl62pgMoTaiOVjX+EBhOLAK0DMtvlzrpaoS/wODkNpq64/ IslHOB1FDNZfBl0qYxisD6QWLdAn1XZPeEK0fBYu5ZS523V8EZ0Yf6/0 X-Gm-Gg: Acq92OGNf0Wo4jaSPjDNx+KBs438+ztPopA/iJ3Aai4JD++UYCOxyj1OP2WHnFehBvY D/yN1T/F/CW7Nyr58srSu3lkB/D2ZdVlOZfQB2/ngLaQxUjBr36qdVS3UKNYZ1A7M20WSp/CWfN Cj3PN0RxW1cgY01yAjXUcNamKTAuPHc/F2QJaUpaBkSv9TvcxDqgfpxr5aFxwxEOpYnBIN5ezp9 +tZ/5p95d8UAc5PRLO9yMB7Mpt6F06pDZaPUfB0FklNvom6bPKAyiNJIoYynRc2oQj5ejPKwET4 zQFIw8Y7x2hGiJLiqUeihtW8OsZY1UZx7j+hnHtO0IYv0+sgZzyexMfzOh9lH+VQRmjrs1U2Iqw BmjyypgKp64ubVZ+lefmGLMnO0o6syQdaZLRSgKCxCXFA0MeSXvsoImM2Fcjtd5Dx9f+KkQvCig MJLqbT2wn2D4qcHpj5cgcvb/bWnivQvbS9LhNtzNKF X-Received: by 2002:a05:651c:41d7:b0:38d:e220:8dc2 with SMTP id 38308e7fff4ca-39561dbd27dmr49775531fa.20.1779135778324; Mon, 18 May 2026 13:22:58 -0700 (PDT) Received: from localhost.localdomain ([90.157.113.57]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-395887b42f8sm15225061fa.36.2026.05.18.13.22.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 May 2026 13:22:57 -0700 (PDT) From: taygoth To: linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org 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 Subject: [PATCH 0/6] usb: typec: add Qualcomm PMI8998 USB Type-C role-switch support Date: Tue, 19 May 2026 01:22:45 +0500 Message-ID: X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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