From nobody Mon May 25 04:33:46 2026 Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (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 9B90C392C4B for ; Mon, 18 May 2026 20:23:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779135785; cv=none; b=DE59UkSkFbPDxDk4htc/tEKKes0pogRDnV0Ydwp0g0dgIeAnhRTXe3PR2bZ3EHYKD44Xb+80N5XSuL4ssrLDMtxe2RCZlK8gPnQnsgM8rHUGUBMQ1FdG2F5vwKOGeEeacCrbp3zn40rS+PIS3sXft5njeZgx5pmmILVaib5atXY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779135785; c=relaxed/simple; bh=76imd3xvKIwUkGBVDpZRcuQTnCY8Hnrgy5OngDhkblo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Td7raPvYsOXl62ZZmDuyr8fGqvxDlXp7eswPhPhYxYktSFyaTU2m7xLJ8IoPkZiDZoROUsYec8zLIt6+OXiX2+ZhL0D3KYqNSc00ZhGqNkf6wgMqDw9GD1fJeW23007BznkR94rIHfTa/q/t/hSVEKgnrYY5NsRsdB4aVuzLb8U= 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=mM9+02m6; arc=none smtp.client-ip=209.85.208.179 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="mM9+02m6" Received: by mail-lj1-f179.google.com with SMTP id 38308e7fff4ca-38e7d983f79so28223281fa.0 for ; Mon, 18 May 2026 13:23:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779135782; x=1779740582; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Tw2B0mpnGoOvamKzgFhtoftN+PwqkKvsefcUjvNFdnY=; b=mM9+02m6JXu3/BhrglIhDvyLkMp0xUnvmGEqTbI2en/IQMN9/3jf+hedyk5NBEFttD RMy1aR7NUgX9ULlYAOUZ+sNI9nuBoyUOkNxkzBJUxpwYkKFgFQiIcRWTQOPhNYfyUnAG 3uYWhANZn/dccRx3oU4RiKUBgYWDy36c1w5mV2ZPUhpxa61T550WQVYIwjWjP6ckTm5q uTy+8iUML/hjVvsd7KX37fE9m1cIRqNMaiaC2p9lGLGBob3YiQva7Dgyh4iDW9Djokl2 Jt6CrUZaCa4w0TdS6cOWyisNNHMiioICtWKfzSe1syZ1p3T8+cx3vrD7OEKARV5F0BOw 87nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779135782; x=1779740582; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Tw2B0mpnGoOvamKzgFhtoftN+PwqkKvsefcUjvNFdnY=; b=pki05WU9X1A6QcC5rqYEUAXTiydFlrb5PZRgf1h3tewkv8Tx+VrQOXSQtmIQSQsr6D DMYEd6qYgViib61ci48BVVrzh56e/ClEMZn7JC2eh163pG/JXvCxbFOU4G0Yn5lGEHkm Es/QUpWtMPA1Wq2/E9mO/d+M6va+icPr5zG3+vLdrw1108dLvNmoAQtczDvBPcLPb+oL +u4/F7qHCEoqiYj9EXTBSpff9vpmyJGXwJFZHERjJLcf3x7aBXIws4qinVHZhUcc37ag jkLDErgrCkSuV849E5tRvnU4NCghhnQDk8S16z/9kJQwbjvAAWdak05VTNgNVfQn7d6q gHPQ== X-Forwarded-Encrypted: i=1; AFNElJ8t0qz8ZlSauIuG6Raf9bT6mOsHzL7njq6UDoyYBnMI4zpJs1CzH0dMROmJSpVEAK4IEenZtw5z7nDWiRc=@vger.kernel.org X-Gm-Message-State: AOJu0YxZj8wf5zPjL29ZK7o58rDpvsIJ4h/CYkQnUU7UrYEV5NZ7mrZo S7WQNtfA92/anDG1sgPBXRJ7XOa3HOHVcpFTRitgEKzJrRsNx+MdyspA X-Gm-Gg: Acq92OHNqzkRn5eEUOaN0aSKrYt6qV2gCNpKDhq2+RZJOFPVIM1EvcrffJwBIwxpWQr 0Y1+rdW6DbvJofWu52ImGee+ESj6QXg6WJygoXBsBKB8Xqr1ZIWtZ+1mHzw1zRWS5OBPzVE8+SE 07dLgl5p3iS5I7jGu9O38HFXxPZE04GMME7iUtP23goIaf8sXJ9T7LkXeioCTCGLuNxwk1HWhIO Wh8K7fDkmumQCWOOT3JFVEw58uYqNvtxrdwpEPnmfoEG0ECps3/jbSmMfDUTygy8+m18qo2D425 Q26VBJteFlbWseVhQEPk7+THv+N/gx5uCuFgve7F3lrEddhSfR6dORJdDAcn3BKiGbR4SbxV9Dq mCG/+XDtsnGDRaUOoT3Zog5oDNtzQxJy6dV3rcnZd65SuYDXIA3h1bAhdjF82yY96QEVSS7qywe UKpb1tJfypO6f6ZIb/7noCq3zow2xh0yZWiii65s8ocmWh2p4MQAE= X-Received: by 2002:a05:651c:4393:20b0:393:9ee6:1b7b with SMTP id 38308e7fff4ca-39561c3734dmr39284741fa.22.1779135781624; Mon, 18 May 2026 13:23:01 -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.58 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 May 2026 13:22:59 -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 1/6] dt-bindings: regulator: qcom,usb-vbus-regulator: add PMI8998 Date: Tue, 19 May 2026 01:22:46 +0500 Message-ID: <2a3c65bbfb85d944110b14b40ef375f238ca3932.1779127507.git.taygoth@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Bryan O'Donoghue --- .../devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regu= lator.yaml b/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regu= lator.yaml index fcefc722ee2a..9e2e2c8f9539 100644 --- a/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.y= aml +++ b/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.y= aml @@ -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 =20 reg: --=20 2.47.3 From nobody Mon May 25 04:33:46 2026 Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (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 60E97391846 for ; Mon, 18 May 2026 20:23:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779135791; cv=none; b=NRwrh+kh2l342ZuQzd7/u0N7LfmUDba7amcLyPcYy5ah//2IQreiMsRTWMZKaY2tBvm3HaVaYY1iX07y/V4w1UhBFY6Sg8Xx3k5Nn1TrEbBijn0DtEX1NxGz+buSwUW/AbVNOgjzE9B1r6H+RSpy1GrVgHwIL7H+Czunf6jJz0c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779135791; c=relaxed/simple; bh=xgChc86S/ky0hTX1WHgw+ITaDh9vre+/OuTho3WUOIU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YQuY3Raq4Fdn/SRAd0AtUfPt4eHnrHCmDIqoDFXR0bAQRZaCtazePddcSF2g+YBlQs5Q3Wo4ven41jh8ymNChqx3ap3yRyiYTeivFmLmcVuI389X+T4BcWGP5suJkLCghcrJIaedBwNjmqHVGpWFiOIrzudUtSjmYdksuI8JdoI= 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=fzxtwpUZ; arc=none smtp.client-ip=209.85.167.43 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="fzxtwpUZ" Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-5aa0da74eaaso3617642e87.1 for ; Mon, 18 May 2026 13:23:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779135785; x=1779740585; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=K+gznpkaSXk+Nx5SKTS+MzsNikKdxnv7goUi1xVYfHc=; b=fzxtwpUZDYCDvuwfiHAQeeWnO5BJMe7Pcw0EVEfLvJ7vwbeIHgQezBzhH+aIBJ3abN VyK/Jlm7KQIyoBJ3oU/y2IsFMjqrwfEBWHP8K5aU/TPYmklkyRU+4Cd5wHJiIJFAVOU5 esSrflyKAosviPnVBCVaszt0O14G+KfmWbVapChrKBROSJYJbtEMwhSqdnv/upmHxYaj K5uoLgyay9FXk5lSu/HCKHlpH6/+Ut4vzg5BynDnhLvYfrW1MkGLEotikZYusEoRN6/j TjvhWo6n+7rUboZ/ptV7dA7ttNQ7wLjMHDA5mGqaku8/svxiKc3ogkcv0MsTKKWcCdXw ELdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779135785; x=1779740585; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=K+gznpkaSXk+Nx5SKTS+MzsNikKdxnv7goUi1xVYfHc=; b=Ni7nNbg+VwKyajt4xG22+ZDAklQeEp/Rox5aD8r0U7vB3lwjS1sd2JI2oEXnyw0ef/ HMngUmqyIMCPFqKD+cjorKXIXheN+rQ+urlAj1fmw1Y+Y5WMIzHMUXSWzXaL5Ge+fC+H iQLB4bGLI8bOi2pjAfl9a097zR28mkXGvZofrt6Z/Yb+za8FD+kL8TaWg0V9BE3ECssw QCadvfQ/7gnmSmMwQO7vnS085FOhKauEHym7G/n0r+L8N+7HPtAQzqwFR5MhGNiTSfE8 +mo9fx/HWB9//U/ZWt9di9ziEHDU64HF6x3/ibcNwECH/krNivIiXcw5SsjYPQaUZ4KC xvGA== X-Forwarded-Encrypted: i=1; AFNElJ+ahXZkY9SsS7wOk65TcjnG2pHhXvzYbsQIQ9+6aWmicnjfjX390GLxxkg52xQoKtIdWcnKtSYpNS0g1ro=@vger.kernel.org X-Gm-Message-State: AOJu0YwC+A8U4gLjYEF3nyhSPwTtTbSM6ouEAfEKYDnUctExCkeZ/8E/ xdUYs5BPG+yQr+JAL3+HIbPspwtFkHoaMOQzI61UixXb+t/N1/l7PRT3 X-Gm-Gg: Acq92OFFt1U/6OETgaERNOcvCgiI6MK2g4fAo27iJFX1T2dY55Pt38MmnVQDXB5w6zP RfZbAa2Aqy82AkL0I1yeyzJu5RAja94PBvhIl86fDDOfFUH4MQ5T92iQVlmmoIAIUNWYZHcr+Ku JP+/EDc3Ev2vvpaQGgO0pav7XwaT+/HEmMMU/3A7tXZrpCS+zL6G6wQ8d1MT5H8l9tLRhSSQ8Sc J8TvUf6pVvFDnfRAsxZ+BAAbRa1mCYgaTXnSe1dm8HjlB8PVqpVXqjMISG872ga9jGgaN0XjxUD AJD4OoNxemLtd5urEYNaMxGOFxD4AaornJ/3rpUga99k9sEX1YmIN9zGoHzy3EniYW8NRU7hJLI 2m6DrkwaMNyyW46yWGFKLefWd+o0gJYJFN6YoE/89Nln9ZbEI01XodJRPL+TgLt1n/FBpz4ck05 Sdt4WXfl1lK2s+IPHx8C52RzxEhCVtGNv7Ux7fpYA6WJs9O4W+tFw= X-Received: by 2002:a05:6512:1044:b0:5a8:837a:2a98 with SMTP id 2adb3069b0e04-5a8ffc6705bmr6263143e87.14.1779135785334; Mon, 18 May 2026 13:23:05 -0700 (PDT) Received: from localhost.localdomain ([90.157.113.57]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-395887b42f8sm15225061fa.36.2026.05.18.13.23.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 May 2026 13:23:03 -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 2/6] dt-bindings: usb: add Qualcomm PMI8998 Type-C controller Date: Tue, 19 May 2026 01:22:47 +0500 Message-ID: <5f4271701066943ead54f82003ab282c4b39f3da.1779127507.git.taygoth@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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 --- .../bindings/usb/qcom,pmi8998-typec.yaml | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/qcom,pmi8998-type= c.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 + +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.) =E2=80=94 PMI8998 lacks the granular per-event i= nterrupt + 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 + + pmic { + #address-cells =3D <1>; + #size-cells =3D <0>; + + typec@1300 { + compatible =3D "qcom,pmi8998-typec"; + reg =3D <0x1300>; + + interrupts =3D <0x2 0x13 0x7 IRQ_TYPE_EDGE_BOTH>; + interrupt-names =3D "type-c-change"; + + vdd-vbus-supply =3D <&pmi8998_vbus>; + + connector { + compatible =3D "usb-c-connector"; + label =3D "USB-C"; + power-role =3D "dual"; + data-role =3D "dual"; + try-power-role =3D "sink"; + + ports { + #address-cells =3D <1>; + #size-cells =3D <0>; + + port@0 { + reg =3D <0>; + pmi8998_hs_in: endpoint { + remote-endpoint =3D <&usb_1_dwc3_hs>; + }; + }; + }; + }; + }; + }; +... --=20 2.47.3 From nobody Mon May 25 04:33:46 2026 Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) (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 91ADE392803 for ; Mon, 18 May 2026 20:23:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779135791; cv=none; b=uLgLwPkMSYc3ggcoXvQRaPdfVgHVPbVQ2/TY0BFc7BTp4VLjYH37MAbxckWd+otqlR86/jJ25LsY4SSlpuixll3+rR10Q2h6NdApV84rlqsoqoMRAyrQumPfUaJPXjODZ58gRCpBydvhd2NoN66885rKmRHf4NgcRRmrilAMelw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779135791; c=relaxed/simple; bh=irpYGJCKR3bjiT4mhwqM9pkxHGcR9vvcqrGle5vQiYE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fdVEWsNHQIMi4Uh5EVkH1KbTBVA2jgjrl9mGMY4B+zMWWYgVDLOA7ieVzUD3hii/DtUE2W7pUndIU6j8R+wMMDPzGcHNji9n8gKPVX5uCd+9D9XXBnhzLQLZsltWm/hfiDUCIrK2WDDuocQVCh6r/kk2BK4Z4MTzi4eY9oUu1Jg= 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=PBWIX99i; arc=none smtp.client-ip=209.85.208.178 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="PBWIX99i" Received: by mail-lj1-f178.google.com with SMTP id 38308e7fff4ca-38e97e73234so25376601fa.1 for ; Mon, 18 May 2026 13:23:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779135788; x=1779740588; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=p/SGitXszrpcNPK3dZcbgwcy5TAfrIErrXFlnM2twUc=; b=PBWIX99i3/ktSuY5On4V79oWlLH59ieJFSe6/rnOC2gw6fYpDKlnmvpTekEL7uNMGU ia+yfgl+F2c9DlyG0ymOrrRls3uqpPDbgba37h1xO2TC1Am1t2/gCcpbScB8qoiKiPgj NhIXp0pMkBg2Fbm/7mqmNVaF/pHBFVyGh1SBpechQkB1AiskGCJCJ27RS4P2FzynZA9J qnkrspO7YuF1tZv9rGfKxZT2iJbwEAyFu67zg69kt2/fHo+Fc6BOXl2fQHKkvGlayhrg U83rWvkSFnWTdiU/rH4WZ+bs/HCA8pbi/zzs63uvCFOhkQ1C7infVwS9r+BYmJDWZth8 pRUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779135788; x=1779740588; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=p/SGitXszrpcNPK3dZcbgwcy5TAfrIErrXFlnM2twUc=; b=ON377vowvIWqY+jLwil+ElEuYk14AqYyQ76tNlyaaewUewocxYXoBHrD3kJJcFWf5X aTgSWy1V7meCfNuoAO1w19VmD8XtDN0FEQKlReGdAF+Xgcz82SkfOyY+GJWu/NOOTOI8 JyHtz8sb0CK5PLt/xPOoY8gEmmIBkSzS2ynI7wa8oj/nG0c12sq5Bo6JOlpP1cAhJl/V 54UJtCEwNiHnZnrQYYnWoxbge8u0FTH19v9A6ro00Nm+rolgz70L8PTNaGe451qv5lx/ Vf/O1dbhHH1SE1XPS+B1GLe9BcxCtm92FQlZRMn9viL3uS+ZaPLOx5GAf34IwxxswBjR dcaA== X-Forwarded-Encrypted: i=1; AFNElJ/5kXCYIpbDL6vyWh+jtfoZIjyC8IQDBFBwJO1vi/ETgsDjNoZ9oPbaBmo4y/Wg+ucHLqqIdQPlsPkFZCo=@vger.kernel.org X-Gm-Message-State: AOJu0YyGxUoXK4EmQ6ml0B7xwuUO4gCqIafPQ+01bd5C2HKX7P+HiYJf NXjLM7XFwrMD1C0xZZ+Ab3fR3JMOnbRryVnv81QnAyLVBNT89nuiaOVD X-Gm-Gg: Acq92OFI31MxHMSXYGn+qASnPeFUos7xqlWMUWoXnJrAR6q9xbk1tDnRhgmPT1F2gNq 3Wq37mtS6xI45NkPeOkyWbk2aFBXFoVzuXBiJcvQIX3MWrQqoITz3kUuTeUBZMPtHCq+eg+g1Zf 9TdX2javpHHKN/MHZoMEbAkdPrGGFpHuPQm1Ns1WMUtcN8VJQ42mS2EEllyjDGjl6m684xyZrSv SPlP1TJrNZNsW09veoMlpOzhhtd6WcqGc9lqBkZeEalho27FP2Lt7W3FjnwJixTyvOOPOyyra7r ICLjsl5ledenFW4O/RetgATJsz40FwzXECKjCeBrW8vr06nfCAPbKBTPTzCvcL4C9LIwkzgEtTQ 6RnVF0UI7mm+r5KyG3aDt6OK2+MCCIsyZBNRtE5Xw6EoQoAf8iDpwNUBaDuF1o8i70YLP+ApL87 AItC0I91SEJ1gncWtYUrjl5FbMq8esDahIpe8wyXCwb2haTa3JfnvZ+RC7JtnvGA== X-Received: by 2002:a05:651c:41d5:b0:38f:e2ad:e975 with SMTP id 38308e7fff4ca-39561c0d38amr51094441fa.14.1779135787577; Mon, 18 May 2026 13:23:07 -0700 (PDT) Received: from localhost.localdomain ([90.157.113.57]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-395887b42f8sm15225061fa.36.2026.05.18.13.23.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 May 2026 13:23:06 -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 3/6] usb: typec: add Qualcomm PMI8998 role-switch driver Date: Tue, 19 May 2026 01:22:48 +0500 Message-ID: <6fedbcd344505b63de72037f69ea94f916255f03.1779127507.git.taygoth@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- 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. =20 +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) +=3D anx7411.o obj-$(CONFIG_TYPEC_HD3SS3220) +=3D hd3ss3220.o obj-$(CONFIG_TYPEC_STUSB160X) +=3D stusb160x.o obj-$(CONFIG_TYPEC_RT1719) +=3D rt1719.o +obj-$(CONFIG_TYPEC_QCOM_PMI8998) +=3D qcom_pmi8998_typec.o obj-$(CONFIG_TYPEC_WUSB3801) +=3D wusb3801.o obj-$(CONFIG_TYPEC) +=3D mux/ diff --git a/drivers/usb/typec/qcom_pmi8998_typec.c b/drivers/usb/typec/qco= m_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 + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#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 =3D regmap_read(typec->regmap, + typec->base + TYPE_C_STATUS_4_REG, &status); + if (ret) + return ret; + + role =3D pmi8998_typec_decode(status); + if (role =3D=3D typec->role) + return 0; + + if (typec->vbus) { + bool want_vbus =3D (role =3D=3D USB_ROLE_HOST); + + if (want_vbus && !typec->vbus_enabled) { + ret =3D regulator_enable(typec->vbus); + if (ret) + return ret; + typec->vbus_enabled =3D true; + } else if (!want_vbus && typec->vbus_enabled) { + regulator_disable(typec->vbus); + typec->vbus_enabled =3D false; + } + } + + ret =3D usb_role_switch_set_role(typec->role_sw, role); + if (ret) + return ret; + + typec->role =3D 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 =3D &pdev->dev; + struct fwnode_handle *connector; + struct pmi8998_typec *typec; + int ret; + + typec =3D devm_kzalloc(dev, sizeof(*typec), GFP_KERNEL); + if (!typec) + return -ENOMEM; + + typec->dev =3D dev; + typec->role =3D USB_ROLE_NONE; + + typec->regmap =3D dev_get_regmap(dev->parent, NULL); + if (!typec->regmap) + return -ENODEV; + + ret =3D of_property_read_u32_index(dev->of_node, "reg", 0, &typec->base); + if (ret) + return ret; + + typec->irq =3D platform_get_irq_byname(pdev, "type-c-change"); + if (typec->irq < 0) + return typec->irq; + + connector =3D device_get_named_child_node(dev, "connector"); + if (!connector) + return -EINVAL; + + typec->role_sw =3D fwnode_usb_role_switch_get(connector); + fwnode_handle_put(connector); + if (IS_ERR(typec->role_sw)) + return PTR_ERR(typec->role_sw); + + typec->vbus =3D devm_regulator_get_optional(dev, "vdd-vbus"); + if (IS_ERR(typec->vbus)) { + if (PTR_ERR(typec->vbus) !=3D -ENODEV) { + ret =3D PTR_ERR(typec->vbus); + goto err_role_put; + } + typec->vbus =3D NULL; + } + + platform_set_drvdata(pdev, typec); + + pmi8998_typec_apply(typec); + + ret =3D 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 =3D 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[] =3D { + { .compatible =3D "qcom,pmi8998-typec" }, + { } +}; +MODULE_DEVICE_TABLE(of, pmi8998_typec_of_match); + +static struct platform_driver pmi8998_typec_driver =3D { + .probe =3D pmi8998_typec_probe, + .remove =3D pmi8998_typec_remove, + .driver =3D { + .name =3D "qcom-pmi8998-typec", + .of_match_table =3D pmi8998_typec_of_match, + }, +}; +module_platform_driver(pmi8998_typec_driver); + +MODULE_AUTHOR("Maxim Furman "); +MODULE_DESCRIPTION("Qualcomm PMI8998 USB Type-C role-switch driver"); +MODULE_LICENSE("GPL"); --=20 2.47.3 From nobody Mon May 25 04:33:46 2026 Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) (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 30893391845 for ; Mon, 18 May 2026 20:23:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779135796; cv=none; b=sA8iBa9uNtI7cZr3xTtuCeRxPlIP71vbNwKe8fFcnvYBPtn19RKQj7JD0sNNufmp6ZmJhGwYv3UcLdT8W7DxQStY/mQUo4aIuLwYcXfLT+r0quu95aJHj29NiqfGQqxUanal5SkLQyMW6/tbt0zQMGUmV3tTAdZhPC8Re3rZQRk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779135796; c=relaxed/simple; bh=CJeSSYYnZeStLm7YVc5JWFlVV48PQFOvjmfLZx4cw/U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cpnHGcJll1kYg65Rzri+mTMch1WpRecJfgDcyy1c4aScNiz3aWCnEcU689vOs3Fn54E6t3Oh/h+PW2cr/7ldoIob2MyDj7MI2IrNKnf3J0gJj1KTPWAlLOuTPCUn802Drrf4QDgQojvfbbMhBTuRXwNIBKsQd/v92rs/N8S7Nnk= 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=SlmOn0XF; arc=none smtp.client-ip=209.85.208.180 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="SlmOn0XF" Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-38e800deae4so28044861fa.0 for ; Mon, 18 May 2026 13:23:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779135790; x=1779740590; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tLtvCiHLhOODkbTb6ldPXwhZ1lgl9LVuxx7kGug/QYY=; b=SlmOn0XFAv6VxT8niudZz3kzeKSzKL0MZZrEh2uMcyPYPhOk3IiOEq+m1keWp6lJGl 6CWdHexjCw4Ilm3Yb9uOS7fPXM3cBgT300bb1qjOV2TgV4xYbUuxo4V7YKwycu9cfoxn +owxja5rcHk8aEeR7vzEeGVjOxnq0NLEhvyIGFSUirioGAc1FHGOYYqNZGdKieuVzbVn s3OT2KVf+IkcRRG0o4EF/MHYgNQghvvrEajsC7FM51LDx1bIeNMff4FWCIaSjpB1Ded6 /cdtRBjETTxg1Tz1Gmdfg2zHIZxoawWxsIv+oNikpqrGhhSUvQRDUTiCZNZpyE5viUCq iFMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779135790; x=1779740590; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=tLtvCiHLhOODkbTb6ldPXwhZ1lgl9LVuxx7kGug/QYY=; b=dZF84XEnYEvjYoMYOQ95v1MzNzrcHpDVSNakv4zXeWoYmz0Zux5IJn3TZMW9mKjJLt dkzdb40/O80mbMpfjLcHXwD/p9NdxroH0UUzhtTyx90HIGo7hYGGINjJaW8pNR7MPlMY KHzxOYBPlLVjo0JylI8IDSaMkMKiFBnPCgiulavUoeItnGI2Lsqj68ITkOFLhX4/931u 1Z+PIbWEXDsBwm/85ePtok4dnAC6aR585EvoLwM+gT8/5PJcwNXoItHDyAfcKQ0WQzF2 j0WcuvFOlsDPQkhrUMaHI4PSyP3Pv9FhR4sWedvLEYMei5Fb2Z6Lcbb9aKnLhDh12bom Lygg== X-Forwarded-Encrypted: i=1; AFNElJ+cSGdAIp5mlV/qAOFTZsZIYg9D7vHRP5LNZgp2UTniD0woqsoPVmRaJ42yiEj7eo6Gq9TYtdqSQqhj4xo=@vger.kernel.org X-Gm-Message-State: AOJu0YxHQ4ju0UtQV7dseRkotr45gmr0jZ0XO930okOdCvmTlNS/vtJD 8tSC1m4puVKcI+cqoH4AAMpZZAF8+H8Sh1aAJBux9+Xfk/57Kj2rnPKt X-Gm-Gg: Acq92OHyqZbZs/oYct2PIJrwU3ogibufdCE+1pCJWKPUvCaxifIPqyQVai4gopVQ8hO Mz4RKvF/blmLQJKZc29WVIEPWt/z86o3iOjXQqw5O2CESErG8/KADbGFAcSzM46Y1i+Uf5RlXiW C0dHgmF36TjjhnswJXiVJQWQE4FK1bSfbkkabFOUZNlw/8Dph94aTHtz6gH7Y5yeNTV84ooCnlE xfDR4sJTnEX2+/mQJaL5htI/a3OztTfCPbmtH+XnEcChl+3ETOdSDa91Hz4Mkf3+UCLRq7o3IyZ YllnIf9cDyA5d9Jc34D0T7Qu31Hxuds79JvtFIiOYuWQ+by5cUvFzRuhJS774rzZlwdPwvrykqz t+UB2UTbU7MjZjLkB8aM2lDWrUqmTggvnP4YvKmAhDwOa9+hsUY1QPhPk5HkuJDAQb3jpzrnBtF 8153Hh/zn31WyVfYrCWK2ZUXubrndfIh7b1RlbMnfoiPixkPsLpIc= X-Received: by 2002:a2e:a995:0:b0:393:a4f5:3e0f with SMTP id 38308e7fff4ca-39561ae1a22mr51690241fa.2.1779135789949; Mon, 18 May 2026 13:23:09 -0700 (PDT) Received: from localhost.localdomain ([90.157.113.57]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-395887b42f8sm15225061fa.36.2026.05.18.13.23.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 May 2026 13:23:08 -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 4/6] arm64: dts: qcom: pmi8998: add USB Type-C and VBUS regulator nodes Date: Tue, 19 May 2026 01:22:49 +0500 Message-ID: <10efd57e82ebceedb75dbe3e038af81de4f1557c.1779127507.git.taygoth@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- 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/qc= om/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 =3D "disabled"; }; =20 + pmi8998_vbus: vbus-reg@1100 { + compatible =3D "qcom,pmi8998-vbus-reg", + "qcom,pm8150b-vbus-reg"; + reg =3D <0x1100>; + status =3D "disabled"; + }; + + pmi8998_typec: typec@1300 { + compatible =3D "qcom,pmi8998-typec"; + reg =3D <0x1300>; + + interrupts =3D <0x2 0x13 0x7 IRQ_TYPE_EDGE_BOTH>; + interrupt-names =3D "type-c-change"; + + vdd-vbus-supply =3D <&pmi8998_vbus>; + + status =3D "disabled"; + }; + pmi8998_gpios: gpio@c000 { compatible =3D "qcom,pmi8998-gpio", "qcom,spmi-gpio"; reg =3D <0xc000>; --=20 2.47.3 From nobody Mon May 25 04:33:46 2026 Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) (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 6424E36215A for ; Mon, 18 May 2026 20:23:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779135796; cv=none; b=mpJRycVlfbciuJuZr+imDS+YB8WKTmftIxWHTASo5ABQ6G3wwr2raYue7IAs2nRlZrSHfB3JiA9UzKxbKOKvijl5VVULcM1q+RmDupMzNKvuf8usnqBKoNdvBabZl/AQ+cCeklSXHq+g1c7u3kKQ6BAMaaRgRZdkyEnKO6Md1VM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779135796; c=relaxed/simple; bh=TYdy6nuGg2H6DLqJvqnXf3NKbUg3XykFU/TUZ5CEuWI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=e1ojGOckVxF7+srJFAg/yNV/giWgKNWY5K5SGOgpZDbuB5Ypk9RFHkfq69WzYe6BXAKbIAs4TlylD+wdwf/54Iu6VfsoKOq+OHRyMRY79SaGesqGLYHnQO18fClKv8hk/eIjBz0LBXPrH7Pt4/+5Sk5YUDlOmjtMIBNp7YXGSxc= 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=DhHbnNes; arc=none smtp.client-ip=209.85.208.174 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="DhHbnNes" Received: by mail-lj1-f174.google.com with SMTP id 38308e7fff4ca-39394e1e8f3so29384191fa.1 for ; Mon, 18 May 2026 13:23:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779135794; x=1779740594; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=V7MgMydFIuv/r1d4/vML1sQi26pQ+VbIk3AiQmKgmmE=; b=DhHbnNesJe2+EWPYUwyEinfP/Kg5FxHd6NLWVezExRXTBICvlq8xhfcts/6OUdR7fo mXo/TsfgiWmX/z9bivqz7LiKH9Xjv1dyHqJ0zHNXt5pJ7+QvdP2UskWeMxnCgdYFKjEU rSXn9xDp1i1zxJ7E0AZd+DgLraEqrh/GOFZ8Zc0rHCD+a0ual9Mt54U6ZfTlu9g7lQUZ iQ3znw2kp1rSCDIrtmjOKB9EtWuxi6v329Fi/f54fF0oWX1Ut5PVluBZY0s22aOB1gWd bPKbDg7gxsSDXJL2NMb8QlwyColEUmZhu03YqFmZTazKJ96L8RfDCt3P7dLJDwCwVls6 FMZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779135794; x=1779740594; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=V7MgMydFIuv/r1d4/vML1sQi26pQ+VbIk3AiQmKgmmE=; b=S23HelkPxG8rubDOTcsLdddJpFXCbw23QdVZmhBJdViRiEYn4G2WCywaltyfiRkaDh dqiXZven67qRPOb+cJVQft7fRcPLmKeV9qVdQQR+QCjB5M71OIThz3nsw9BAHg/Keajm SBq2JzMZJcTAl22Npe88Rj/VIh4SidQYjBLor/72BIcZUMq2HCF+nE8PU90J+Liz5dgZ MLRiPLgO0YEVNSL8/nVmOv2NW3THWCMNE82NgO8rFVIYAXoFUd7C5Ril9jCe0/QuEPpY Vord4UnuFt8fuUpLYQS6Wg5h49LuuQ7ZsxbxxsAnhzNxRO8JRtsWChxM0aUiwbaGRMvs RETw== X-Forwarded-Encrypted: i=1; AFNElJ8XnuV7VJpMDelcQnvZRt6QhKmg2+x1W2YGHYh0w2uH9UNADI+qknw6iQI4UK3UIkpKQC/viaViPGlDrKM=@vger.kernel.org X-Gm-Message-State: AOJu0YxiNc+ppi5c4EXaKGTeIWSdOHJ1afNSz77knpZHiaj8F4jnGFYp 4iwT0GZYQOc+T2MWyLrKj4nD46WSEJVGj95QmpJ3qG0MVXs10KLFw9OW X-Gm-Gg: Acq92OHbr3WTSJ87SbGVytch9cn8Ng6xz4nCHLaCync1iByUJVvpxfNez5Xt7lvHfMP Cbmbnrq626Qho0cOn45FH4bp2B9WMm+foF79P5JKUGCO8m5ZWASZNwWg++C3nARSgjvSZKVZWr5 yrPcMC9Tze1UUicbmwH559LO97fMo41/gj+RdmPaBbOSDkRwu+iB4RU0HE2gqiMJDGL/VJUhI20 7h0qegRUcz5QVwviXAdy4Zemmu1eB+4P1LpQ/tadtJBPTMU8OWTDizIPXd3iqnq0VTS9GPi8KKX uxuzjAcTmwwoW3B0SZ7GxdJ/Wf7wsU/gVI26JP3OsmmG9Oz1p5beCn2T7JQBILquAMv4h1Wlv2x vbB84rOy+ph5EbRJpGd5Mb7srWWBrAFZQLt7koHKWwKUT3j377UK4Hzgijlbh4S7OC2qvoireG3 H6Fwgw4nzxMWZ7m3eh5QWFVDhdbwrCUF6KOgDyEygv X-Received: by 2002:a2e:3318:0:b0:393:a145:54f3 with SMTP id 38308e7fff4ca-39561d62df2mr40726251fa.15.1779135793502; Mon, 18 May 2026 13:23:13 -0700 (PDT) Received: from localhost.localdomain ([90.157.113.57]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-395887b42f8sm15225061fa.36.2026.05.18.13.23.10 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 May 2026 13:23:12 -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 5/6] arm64: dts: qcom: sdm845-oneplus-common: enable USB Type-C role switching Date: Tue, 19 May 2026 01:22:50 +0500 Message-ID: X-Mailer: git-send-email 2.44.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 =3D "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 --- .../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/arm= 64/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 =3D "okay"; }; =20 +&pmi8998_vbus { + regulator-min-microamp =3D <500000>; + regulator-max-microamp =3D <1500000>; + status =3D "okay"; +}; + +&pmi8998_typec { + status =3D "okay"; + + connector { + compatible =3D "usb-c-connector"; + label =3D "USB-C"; + power-role =3D "dual"; + data-role =3D "dual"; + try-power-role =3D "sink"; + + ports { + #address-cells =3D <1>; + #size-cells =3D <0>; + + port@0 { + reg =3D <0>; + pmi8998_hs_in: endpoint { + remote-endpoint =3D <&usb_1_dwc3_hs>; + }; + }; + }; + }; +}; + &pmi8998_flash { status =3D "okay"; =20 @@ -890,19 +920,18 @@ &usb_1 { }; =20 &usb_1_dwc3 { - /* - * We don't have the capability to switch modes yet. - */ - dr_mode =3D "peripheral"; - - /* fastest mode for USB 2 */ - maximum-speed =3D "high-speed"; + dr_mode =3D "otg"; + usb-role-switch; =20 /* Remove USB3 phy as it's unused on this device. */ phys =3D <&usb_1_hsphy>; phy-names =3D "usb2-phy"; }; =20 +&usb_1_dwc3_hs { + remote-endpoint =3D <&pmi8998_hs_in>; +}; + &usb_1_hsphy { status =3D "okay"; =20 --=20 2.47.3 From nobody Mon May 25 04:33:46 2026 Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (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 DB200391E7B for ; Mon, 18 May 2026 20:23:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779135803; cv=none; b=a+5kzjs1T8M+2ixsIWi1o3v9nfLJsMKAkrCdpBn6mlWzhIEiEM70GaWlRTfB/2y/w0GFqF+uSVXp7rUl4rXniZ9bJabU7k6SUJlvsn2JgfVWlJBm32K8A/sVzKgza4NuDBB/k5TL/vdml+TOdXRjyUa67eGynh/dNPV5gYzMQmM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779135803; c=relaxed/simple; bh=QzaN/O/VlVMdJSFQy2H+lcyumcLYvF1o8hZeXgqCS2s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZdikhKnw+3EcAzIt6M2S8E9hiDVGkWT40zxr0bJGearP9DpedQap2QTm/LZMBs8AD/Gx3c6I5SgdCfBPSWCnkUXAsHwd6dB0/7GaR43TDDWJ8jQAztUz7sOrMRKkd/L1ah0bArNJR6brD30wsLLRSWbbfc7ZI7fB0Y4uD0QRPdA= 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=msGf+D36; arc=none smtp.client-ip=209.85.208.176 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="msGf+D36" Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-38e97e73234so25378461fa.1 for ; Mon, 18 May 2026 13:23:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779135796; x=1779740596; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jiJgbjum4jxo4zX9VgnCn31yV0goVxaYIj4uyBltCfk=; b=msGf+D36QGPX4Ec2wrtXvmY3rm4T1+tihRJeG3wlE/yYqqyXSCjPQS77ARYKcXIbbV i7CkYoEiNiyJALRwpb7w8WJ6O9vZU7C+83PckOxLULYd0cx6jSbr+biU4gmz3I7nYAVp WV17g3mgMZgBOnK8/4ounC0TLMK4r8tZQlOoc2eph0eQOdSWma2gKIVtiO1QXmnKq48e qnL5Mq5U1HaQoRlx6GM7otEUv0vw5xJJSLDNtQ+lnwN8EBDPna5Y98fCoicCtRabN/rS vILakx9gd0uX7ZoydRo38+KRKQMWT3yz78nf18wDxtLUmiWl/LAg4RLGEzcam88D2E7q 1iFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779135796; x=1779740596; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=jiJgbjum4jxo4zX9VgnCn31yV0goVxaYIj4uyBltCfk=; b=QjZ2fzrTI6YhBwAHSA0hTMWlz6xTC15vLZOj79txTchde0LBA6nWDrv4KUzzc0qSMm nMO9uMEStcyzaBEcnWL88n8YHk1OKIlRKNxVsX7TZsgoLs9fNt7x+62NDDOlc0A8a2cf ZeBgAYh5d6skC6611TZS2BexJEP7xFV6kPiTpE13Gh5jxihdH04xb3cbgWS2Zh8B2tFQ rM0ZaCXcQ8CLxcKfs/cubuWj4hKm+y/SNnTrGe3e3CRP1fWs3iLXkbG1Ga5Wcj40Fk2S 5ngbREcgeqLhe3B3e1Ki1SmYYWkDxcVqALJsmuVD9iTxizvxCTNlizKsXq8pLlLwGvm0 U5og== X-Forwarded-Encrypted: i=1; AFNElJ8+W8vdS+gvikhflXLdrHAjRxV2dKk1krlbx01F0YCyUpvm8oy3+rW/Dyz8UK/pHdtUIMu9P9vTVepIX+8=@vger.kernel.org X-Gm-Message-State: AOJu0YxQoCV1XrqPe2Z8bUk2+/oEV6nD9wsND/nUhc/50qnf+9Wt56X4 7hqLM8PnhV3bpnXGC3ypSHW9LT8xuNMrxduaeS1eUHbW8FRVhWQYRofK X-Gm-Gg: Acq92OFc0mcSFm6QLDMb6Y0MdCYf+QyjsP9muETTWOysbURyIjkeEJvh1IjkWMwG1nb MB0iLsBdoW+1fXLE7g2Hy8Lm6GfqKCahLOe+jD1zQBYRU/of/KjwE4zpXUkyZhCAkzCdXBsa5sb f90iQrpxqclzWxDxJwqdd7H38JeOjua51TIXJw1ccVSbQSfFRD81CnASVeUFB3i56cfhvJ7g+yj km7DJrbK3HjSkGKZIoOop2G1r+08fyFk1W7O0dlpLWKM8Kd87Plx4zwuBuYccTLhOdHonDhoO+L GbWDU8z043DJF4R0gZrK8Zl0pGQGg3pfAfJESdHD2f63Mqxtjhx8X4NeBASSUWY7e5YYtEfGPmz cF+FprebXYMtsX7qgqdGx25pMGp1YAztEQzyd/Xn76NcuJNuXY67RycsTLoRpZqvCY55L3ORWdf SyXgLVzk3y69Lv7tDgQhjLD5v9RpJSpmL90ir7LtBj X-Received: by 2002:a2e:8a95:0:b0:394:635:70b1 with SMTP id 38308e7fff4ca-395619b0b28mr45511291fa.3.1779135795950; Mon, 18 May 2026 13:23:15 -0700 (PDT) Received: from localhost.localdomain ([90.157.113.57]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-395887b42f8sm15225061fa.36.2026.05.18.13.23.13 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 May 2026 13:23:14 -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 6/6] MAINTAINERS: add entry for Qualcomm PMI8998 USB Type-C driver Date: Tue, 19 May 2026 01:22:51 +0500 Message-ID: X-Mailer: git-send-email 2.44.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add a MAINTAINERS entry covering the new qcom_pmi8998_typec driver and its device-tree binding. Signed-off-by: taygoth --- 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/ =20 +QUALCOMM PMI8998 USB TYPE-C ROLE-SWITCH DRIVER +M: Maxim Furman +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 M: Dikshita Agarwal --=20 2.47.3