From patchwork Sat Mar 18 12:18:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 664949 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D04BC76195 for ; Sat, 18 Mar 2023 12:18:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229850AbjCRMSl (ORCPT ); Sat, 18 Mar 2023 08:18:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229778AbjCRMSh (ORCPT ); Sat, 18 Mar 2023 08:18:37 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B1EB2B28D for ; Sat, 18 Mar 2023 05:18:35 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id c8-20020a05600c0ac800b003ed2f97a63eso6523906wmr.3 for ; Sat, 18 Mar 2023 05:18:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679141913; 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=Y158HVl8JVW4kMbtNHVGz7DrzRA/UEL4hPTStyAK4RQ=; b=x22PqK+6ZXCPHpxOmDybAcWK65bJW2SFmYFRZX/U2lPvZN47064/XDsEQrvZUqQSbx SHXZ5hICxNI+n1Y/WAeo2miVErQQAxL9fALqCv9FUuBgNlqg67scASaEsy+9yjGe/GkM pRTNX+pH2qYBbO1rdcLzY9ZjMOJM79kp8D2r57hispnJxStsonpYXs6A24BTJrrLqnhH D1U9HDIyHr1b5M7EcKF+W3ti9piAGW/7zx78PN1+FSnk8awk0lFZmq0iwkNdwzph6+YV dY+8AkE1hOrdU2fKF5R0rFrhaXfBtjip5SlbtYUzk1MJupmoE2kNVvNVI1g2rDcHnRf7 YhSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679141913; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Y158HVl8JVW4kMbtNHVGz7DrzRA/UEL4hPTStyAK4RQ=; b=miEPf4OWC0Ki+hSwd+9eFRIHWHsVfirI3MCZzOhTD0ENQci5syS587gT2ZfqBpOCXu B6apr8wgINqesu/7mjSg3jUiTeBrdB22c8ZNW100G6DgC6IdfKkHosBSvyOduH5pot5H 73fMemMhDCYi2UwwcpwYxwks8U/2DwAW6fnJ/aoIg+2IM9K3CunkFAgJoh28HifaNde2 8tclgUVmeZrCnNAa+LVCRRaGvjD7K99VnEYXR649s4KmlCbN3vv9jlByH/no1h466H8H 2RNGAe4M99WOXdweiF/q9qqrwx1P0YWQN16fmUnzFAS6qPjuXZgD9SU1xnr4op6kWMcA rcaw== X-Gm-Message-State: AO0yUKXBAjldemUpvSl9mzXV9TqoX4hWhvT6mdTuZtYSN6Po7ufY3nqv 4zZNO8FpYAq1d74qdjDb+KMSnA== X-Google-Smtp-Source: AK7set8iIQNb6pKFhvafzdRNafm3uaOE9M0/St/wMrcs47yRRXyQx9q7LW5v496UDDAU7RwXubOgPw== X-Received: by 2002:a05:600c:4f02:b0:3eb:39c3:8844 with SMTP id l2-20020a05600c4f0200b003eb39c38844mr28511278wmq.12.1679141913227; Sat, 18 Mar 2023 05:18:33 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id az40-20020a05600c602800b003e2096da239sm10814997wmb.7.2023.03.18.05.18.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Mar 2023 05:18:32 -0700 (PDT) From: Bryan O'Donoghue To: linux@roeck-us.net, heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org, andersson@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Cc: wcheng@codeaurora.org, caleb.connolly@linaro.org, bryan.odonoghue@linaro.org, konrad.dybcio@linaro.org, subbaram@quicinc.com, jackp@quicinc.com, robertom@qti.qualcomm.com Subject: [PATCH v4 01/18] dt-bindings: regulator: qcom,usb-vbus-regulator: Mark reg as required Date: Sat, 18 Mar 2023 12:18:11 +0000 Message-Id: <20230318121828.739424-2-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230318121828.739424-1-bryan.odonoghue@linaro.org> References: <20230318121828.739424-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Mark reg as a required property. Signed-off-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-regulator.yaml b/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml index b1cff3adb21b5..7a3b59f836092 100644 --- a/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml +++ b/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml @@ -25,6 +25,7 @@ properties: required: - compatible + - reg additionalProperties: false From patchwork Sat Mar 18 12:18:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 664948 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68B5BC74A5B for ; Sat, 18 Mar 2023 12:18:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229890AbjCRMSs (ORCPT ); Sat, 18 Mar 2023 08:18:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229823AbjCRMSi (ORCPT ); Sat, 18 Mar 2023 08:18:38 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12B3F36FE1 for ; Sat, 18 Mar 2023 05:18:35 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id o11-20020a05600c4fcb00b003eb33ea29a8so4835699wmq.1 for ; Sat, 18 Mar 2023 05:18:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679141914; 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=L7eN/63SDc85+UDeFHAOu9kRyf47mzqSNvdnHmym3mg=; b=O6NJ+FHTsFOHo2N86vNinRnKFtCnLuu07DOCmyb7qpo0E8fESPaId+UmT8irlzjCt6 xE7lT21LgzkoZNGzdKAyb/EEjhb3nX6w/rLCzzpBM7IHlJbb2rKwpgiol91/5FI/BR06 hQ+nXmT7AgAr+lFITpgielq1KeYSrsDKrDlDJmG12MgeFO3nScXotHvYiuKWvirsCaJU tBZQWSyyCa8ubwYtxikCPDk3iZdQrmwt8oR+v9GPNBt3XFEnf/SMCz3fbqNM+H7vxRxF 88RDuIr8dU7rvdFVmFui9KdP0nAL81ivg0D2k0QxKDvG/fTP0opHCZJAc7vLWUPXIQwK K8ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679141914; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=L7eN/63SDc85+UDeFHAOu9kRyf47mzqSNvdnHmym3mg=; b=71HJjdY9X2+7vz3L0Z4BtZpq4RW+osaoc+8gwnPcC5JLcqufZmHESIz8GdKWt9j3Pf wlgvAyHttS4Mk65YpMpYA+dm0M6og3kqzzYnYnsP/nWvhQ4Lb/o3+uF3x5uI66bvc0CB fbpOKKkjtX7TgfWiP33CtpgfaAAp6vCxzhrxkNhi6Y/138a1SN2PwGwMl0zuIy7ZHlXK 9/aK++vY7Bjpr9L8PVy1YhKBhE5+JVfO1+dw8clB7eNzlbCcYImcHLa9HDd5sHcXbZrj U2sXWjwJ0Ayk7pRv/onEEQ1UZOsR9pt+Em84ZTAE3ewYCdrTcHEpo/DtvJEiNwjZ6nti m6pA== X-Gm-Message-State: AO0yUKXzDcsPZNMYVCboqomA5NdSMfAymNQ/nt+Tx/Mp0ClAJmaz486L ZtVPdZvtbIPYcO05THPQxiqE1A== X-Google-Smtp-Source: AK7set8FL0lyXvLO5HO6MR+AkdXI5usib5t+BFb/4ye23swp2uLzequk1OFqv/MMmv4p1VBv0HfIDQ== X-Received: by 2002:a05:600c:3d95:b0:3eb:5990:aea4 with SMTP id bi21-20020a05600c3d9500b003eb5990aea4mr4767347wmb.12.1679141914422; Sat, 18 Mar 2023 05:18:34 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id az40-20020a05600c602800b003e2096da239sm10814997wmb.7.2023.03.18.05.18.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Mar 2023 05:18:33 -0700 (PDT) From: Bryan O'Donoghue To: linux@roeck-us.net, heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org, andersson@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Cc: wcheng@codeaurora.org, caleb.connolly@linaro.org, bryan.odonoghue@linaro.org, konrad.dybcio@linaro.org, subbaram@quicinc.com, jackp@quicinc.com, robertom@qti.qualcomm.com Subject: [PATCH v4 02/18] dt-bindings: regulator: qcom,usb-vbus-regulator: Mark regulator-*-microamp required Date: Sat, 18 Mar 2023 12:18:12 +0000 Message-Id: <20230318121828.739424-3-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230318121828.739424-1-bryan.odonoghue@linaro.org> References: <20230318121828.739424-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The VBUS driver needs to know the regulator-min-microamp and regulator-max-microamp so they should both be marked as required. regulator.yaml defines those two dependencies so include regulator.yaml. We need to change from additionalProperties: false to unevaluatedProperties: false. Signed-off-by: Bryan O'Donoghue Reviewed-by: Krzysztof Kozlowski --- .../bindings/regulator/qcom,usb-vbus-regulator.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml b/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml index 7a3b59f836092..f6ecb0f72ad9a 100644 --- a/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml +++ b/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml @@ -14,6 +14,9 @@ description: | regulator will be enabled in situations where the device is required to provide power to the connected peripheral. +allOf: + - $ref: "regulator.yaml#" + properties: compatible: enum: @@ -26,8 +29,10 @@ properties: required: - compatible - reg + - regulator-min-microamp + - regulator-max-microamp -additionalProperties: false +unevaluatedProperties: false examples: - | @@ -37,6 +42,8 @@ examples: pm8150b_vbus: usb-vbus-regulator@1100 { compatible = "qcom,pm8150b-vbus-reg"; reg = <0x1100>; + regulator-min-microamp = <500000>; + regulator-max-microamp = <3000000>; }; }; ... From patchwork Sat Mar 18 12:18:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 665170 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C562C7619A for ; Sat, 18 Mar 2023 12:18:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229908AbjCRMSv (ORCPT ); Sat, 18 Mar 2023 08:18:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229838AbjCRMSi (ORCPT ); Sat, 18 Mar 2023 08:18:38 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EA645588 for ; Sat, 18 Mar 2023 05:18:37 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id k25-20020a7bc419000000b003ed23114fa7so6516134wmi.4 for ; Sat, 18 Mar 2023 05:18:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679141915; 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=qJqqjU1k7l7SWj6A3NdoYJnwGra9kxkjhiJ76PD1RCY=; b=O7kDPq3J5qAohMsFT1AAP9UXq5lnileP07if2nrAT4GsZuFo005c3+e3L4XfJBC1uj VPyhjyY+gWZWZYORmz96hD9DDXCl3rnHjWUDZi/TlfRCVBUijTLF+ghPT9Xzmv8TSMQe Dxbp0QAB+is/ejSROVyhbQ6PLvaaZYWib0Y50oMO+JKKexR4YF6ibI4BgtqgJn4YUPsD 54Q1fDsvCyHR+NN+cy9k29LTThcIzuWMD8RjJ7tUiJvQi/QHyY14KreExOQgi1iR7Mi/ +LopeNm70O9BllgaNsY+8sSFTm0zNAxQ2cYVSgftsrewH9xsMx1Vl+ptFowgt8NFCQHu iGnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679141915; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qJqqjU1k7l7SWj6A3NdoYJnwGra9kxkjhiJ76PD1RCY=; b=28ZkeGtfwSyMJv3LYnkmqBLGPgq1W0RX3mvcceU1ERiS2beMcBJHpWziX3adtHpKxU gSO2n2ePG/luKiRwXWJKePxG1hDK86lv35nOBPGrbGchGVZIRUm56F4N1+7+JZOZ2Vgk Y2dXXLVoeoPhu7o0JrW31eH6FjR2BbpnPHEwg8CKFlzapVvZAeDuRSEvHv/GHZsKTfRV V3yNOMjWX76SHkN4cIxWU8RuCBenKa/87arwRKnFZnrrd9s0Y3jgoFrgwGAkGlE6UFNk MUpcENgKCyVXEcogC9ERrHjkpl6PJpj8kpzmX1y/tKJwtc0+AR9ikWsKHUVqAuPebrG8 o+BQ== X-Gm-Message-State: AO0yUKUJAbMeHRHx7u4UOWIAHbnpO7iO0DmOoLa3a8/CtLCKbP/hS8IB ZaG6gMTGIc8PNxsiVvQn0Jyb1g== X-Google-Smtp-Source: AK7set9WcyqlUsEYjJKjfCU/1DzawREfgIFMT1tNnJ2keiCoz5LxP4Cqqx2mAYd7PllyvqmH6OrYeA== X-Received: by 2002:a05:600c:3595:b0:3ed:2a91:3bc9 with SMTP id p21-20020a05600c359500b003ed2a913bc9mr16691554wmq.15.1679141915706; Sat, 18 Mar 2023 05:18:35 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id az40-20020a05600c602800b003e2096da239sm10814997wmb.7.2023.03.18.05.18.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Mar 2023 05:18:35 -0700 (PDT) From: Bryan O'Donoghue To: linux@roeck-us.net, heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org, andersson@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Cc: wcheng@codeaurora.org, caleb.connolly@linaro.org, bryan.odonoghue@linaro.org, konrad.dybcio@linaro.org, subbaram@quicinc.com, jackp@quicinc.com, robertom@qti.qualcomm.com Subject: [PATCH v4 03/18] dt-bindings: phy: qcom,sc7180-qmp-usb3-dp-phy: Add orientation-switch as optional Date: Sat, 18 Mar 2023 12:18:13 +0000 Message-Id: <20230318121828.739424-4-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230318121828.739424-1-bryan.odonoghue@linaro.org> References: <20230318121828.739424-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org orientation-switch it the standard declaration to inform the Type-C mux layer that a remote-endpoint is capable of processing orientation change messages. Add as an optional since not all versions of the dp-phy currently support the orientation-switch. Signed-off-by: Bryan O'Donoghue --- .../devicetree/bindings/phy/qcom,sc7180-qmp-usb3-dp-phy.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/phy/qcom,sc7180-qmp-usb3-dp-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,sc7180-qmp-usb3-dp-phy.yaml index 0ef2c9b9d4669..52886cdb0e506 100644 --- a/Documentation/devicetree/bindings/phy/qcom,sc7180-qmp-usb3-dp-phy.yaml +++ b/Documentation/devicetree/bindings/phy/qcom,sc7180-qmp-usb3-dp-phy.yaml @@ -61,6 +61,10 @@ properties: power-domains: maxItems: 1 + orientation-switch: + description: Flag the port as possible handler of orientation switching + type: boolean + resets: items: - description: reset of phy block. From patchwork Sat Mar 18 12:18:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 664947 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFA3EC761AF for ; Sat, 18 Mar 2023 12:18:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229862AbjCRMSw (ORCPT ); Sat, 18 Mar 2023 08:18:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229841AbjCRMSj (ORCPT ); Sat, 18 Mar 2023 08:18:39 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29C32F971 for ; Sat, 18 Mar 2023 05:18:38 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id w11so3725969wmo.2 for ; Sat, 18 Mar 2023 05:18:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679141916; 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=7wLSDWvrESz4iYHp2hJf4zI/B2Ft5IfrJsh7oW3/t5M=; b=P8L6gmRvxvKRPt7yP50DNz6B+U2CeoTtWTC3OgMES0EU57hTS5giSJU1BkKbuj/D9k 79lWtx2nndF97422oUJP+c8wsy/n6CFQBly1VdWdx4XhddAWxPxSZ7ZAqSwHxF0gYp11 ZYq8KsdZMum4xGU47cLh6q3ph6Kf50joOIL1YNs5+I7QPn/sauClBYC3LQQXks3Ra2US IT5I9oHUcDZ4GtSzbpPPibwGq4cSg3KB37Kh+p7CN5IkVwpyH90kgw299xipcMJRv/ZY 4FIU+zxqiuD09M95EDxOQ9kZch9hwozjQIQqKYfPDkX6dpwOKLF6UAxopA4lwV0nJ9r3 OM4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679141916; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7wLSDWvrESz4iYHp2hJf4zI/B2Ft5IfrJsh7oW3/t5M=; b=gDDAcyWnH8Go9c7hoDh/lBAjvc69R4Dr37BKSMmv3O66fIHwdhu2wGxfpByX5l6KTe 0eHVy001OJWk5PD2na6HJ9+bzGmZ8MXQz19gWYC16UtU+BMKNvHvhX2mrywO16Z4LEsB nEjHSjKki2zg+h0RzhmRWsCWBTAPKzStVQbMMiE/wvbJlJhIIFPicJoEgS53VwIjPhgs vdbcVOFBrqeLKFEm3gSN9ajNX5K3jVVmgvOswrYkN/8rZjS4VTa06uXie9fh2mnZrHGj IiUUpniSpfx+rBEp6I/r/uUPWmoAz3PfrANHshr1iGnR4fNTlG1rVYvmTg5htZmliIZ9 H8Zg== X-Gm-Message-State: AO0yUKVFBpvq+RkiPIqRa1MWEpCaNOrFKTYcCz/xMYYNkiSmh29dxo/l G4jVxspZJ4aw0WNTj7rxo26IYg== X-Google-Smtp-Source: AK7set+9yXGCNUiHc2ojXeS8P9OXRKhTJIrw13uPQbsv32HtvarbM3YY2yihX22FZSfG62oky6Qtgw== X-Received: by 2002:a05:600c:45d2:b0:3ed:2a8f:e6dd with SMTP id s18-20020a05600c45d200b003ed2a8fe6ddmr16602324wmo.6.1679141916686; Sat, 18 Mar 2023 05:18:36 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id az40-20020a05600c602800b003e2096da239sm10814997wmb.7.2023.03.18.05.18.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Mar 2023 05:18:36 -0700 (PDT) From: Bryan O'Donoghue To: linux@roeck-us.net, heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org, andersson@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Cc: wcheng@codeaurora.org, caleb.connolly@linaro.org, bryan.odonoghue@linaro.org, konrad.dybcio@linaro.org, subbaram@quicinc.com, jackp@quicinc.com, robertom@qti.qualcomm.com Subject: [PATCH v4 04/18] dt-bindings: phy: qcom,sc7180-qmp-usb3-dp-phy: Add port as an optional Date: Sat, 18 Mar 2023 12:18:14 +0000 Message-Id: <20230318121828.739424-5-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230318121828.739424-1-bryan.odonoghue@linaro.org> References: <20230318121828.739424-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org port is required to instantiate a remote-endpoint which can receive orientation-switch messages from a Type-C mux. Signed-off-by: Bryan O'Donoghue --- .../bindings/phy/qcom,sc7180-qmp-usb3-dp-phy.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/phy/qcom,sc7180-qmp-usb3-dp-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,sc7180-qmp-usb3-dp-phy.yaml index 52886cdb0e506..1c887e34b1223 100644 --- a/Documentation/devicetree/bindings/phy/qcom,sc7180-qmp-usb3-dp-phy.yaml +++ b/Documentation/devicetree/bindings/phy/qcom,sc7180-qmp-usb3-dp-phy.yaml @@ -65,6 +65,12 @@ properties: description: Flag the port as possible handler of orientation switching type: boolean + port: + $ref: /schemas/graph.yaml#/properties/port + description: + A port node to link the PHY to a TypeC controller for the purpose of + handling altmode muxing and orientation switching. + resets: items: - description: reset of phy block. From patchwork Sat Mar 18 12:18:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 665169 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E535EC61DA4 for ; Sat, 18 Mar 2023 12:18:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229900AbjCRMSz (ORCPT ); Sat, 18 Mar 2023 08:18:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229867AbjCRMSm (ORCPT ); Sat, 18 Mar 2023 08:18:42 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 655A93BD8F for ; Sat, 18 Mar 2023 05:18:40 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id r19-20020a05600c459300b003eb3e2a5e7bso4840309wmo.0 for ; Sat, 18 Mar 2023 05:18:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679141918; 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=K1I7qnuznofFTSCzUNTU+tjSLuCVpFiHoBhZuvsEgQo=; b=fUI2WHNAcwM7CaBIm/FYsjWY7EVFMhJIpidQ3lVgQfo0tydlqkfH6zCZpJiKvhn64X b+3U5ro9fd3o69SsxXBOGon+4r42R9NsLFf5ASRyfEaYKWpiUuVAYcCoazA7rbqQf4kz LDIkqTOTq+D736yiCT05E4ZXiBOy76oIaqXWhSKS6MrLltjsUCjgVS4SIIbpAdWj2oW5 STPnSMyZ5VYLShoz3x94LcpoMlXLG8f0xal1G8HDZebC/NnvtPSfbyrtep+qygPNouc0 +fLZ386gJiOz+5ReOffKsZEEOefiXI6QW73F6debrH2uz3wCwBCjTeyf9vzMxbG7YmOb TpvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679141918; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=K1I7qnuznofFTSCzUNTU+tjSLuCVpFiHoBhZuvsEgQo=; b=fUQyKMFEmVBwfiWYMbJPQxWt88nro5GPa2LAn0i5iTE3k0pAya0/DX3jLED/m0jIuJ klxpqOdTLeWw/+o0+CDi8UghbkOPaXh4OQBcYwO/BCJ93G4ZtU2XDwcZpyek7RTj0kws NEnDhdqjCJ+R71XdLavpusst7R2kfg81iqAGLJfTBKJkQNE6r4p8+bMyClWZv6TXiOTj 5cz3rmeJ8ZorspGbCM4uNFFMoFJSuQmuHlgrLQaKE45bRN26Js1DkQBiz+IxqKqHyFuy +h7i3FaA2EsQ7JP9Mh8qTzs6MW1sHzY3rZjSfpLb70ZwS6O4Jz9eCWQt3qbXH8QQdbJl TPCQ== X-Gm-Message-State: AO0yUKV8mCd4DKEsTirPqDXwmgusQ82qE/qX0Q9FaF1O9O9LELjQE/Fw PX8xMETaV0kB9CHuZhutz/JPgQ== X-Google-Smtp-Source: AK7set8xYrXPeP2b1RenkXRYO0JjE8L/3iiwsbrUkVHvmiO6JzQAN+E0uHt9pdnVTw7H27H34QPUDg== X-Received: by 2002:a1c:f216:0:b0:3ed:346d:4534 with SMTP id s22-20020a1cf216000000b003ed346d4534mr4722999wmc.0.1679141918454; Sat, 18 Mar 2023 05:18:38 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id az40-20020a05600c602800b003e2096da239sm10814997wmb.7.2023.03.18.05.18.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Mar 2023 05:18:38 -0700 (PDT) From: Bryan O'Donoghue To: linux@roeck-us.net, heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org, andersson@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Cc: wcheng@codeaurora.org, caleb.connolly@linaro.org, bryan.odonoghue@linaro.org, konrad.dybcio@linaro.org, subbaram@quicinc.com, jackp@quicinc.com, robertom@qti.qualcomm.com Subject: [PATCH v4 05/18] dt-bindings: usb: Add qcom,pmic-typec dt-binding header Date: Sat, 18 Mar 2023 12:18:15 +0000 Message-Id: <20230318121828.739424-6-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230318121828.739424-1-bryan.odonoghue@linaro.org> References: <20230318121828.739424-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Adds a series of defines which are used in the DTS and type-c driver for identifying interrupts. Signed-off-by: Bryan O'Donoghue --- .../dt-bindings/usb/typec/qcom,pmic-typec.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 include/dt-bindings/usb/typec/qcom,pmic-typec.h diff --git a/include/dt-bindings/usb/typec/qcom,pmic-typec.h b/include/dt-bindings/usb/typec/qcom,pmic-typec.h new file mode 100644 index 0000000000000..733e23b6cdbc4 --- /dev/null +++ b/include/dt-bindings/usb/typec/qcom,pmic-typec.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2023, The Linux Foundation. All rights reserved. + */ + +#ifndef _DT_BINDINGS_TCPM_QCOM_PMIC_TYPEC_H +#define _DT_BINDINGS_TCPM_QCOM_PMIC_TYPEC_H + +#define PMIC_TYPEC_OR_RID_IRQ 0x0 +#define PMIC_TYPEC_VPD_IRQ 0x1 +#define PMIC_TYPEC_CC_STATE_IRQ 0x2 +#define PMIC_TYPEC_VCONN_OC_IRQ 0x3 +#define PMIC_TYPEC_VBUS_IRQ 0x4 +#define PMIC_TYPEC_ATTACH_DETACH_IRQ 0x5 +#define PMIC_TYPEC_LEGACY_CABLE_IRQ 0x6 +#define PMIC_TYPEC_TRY_SNK_SRC_IRQ 0x7 + +#endif From patchwork Sat Mar 18 12:18:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 664945 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3B9DC761AF for ; Sat, 18 Mar 2023 12:18:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229502AbjCRMS6 (ORCPT ); Sat, 18 Mar 2023 08:18:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229886AbjCRMSq (ORCPT ); Sat, 18 Mar 2023 08:18:46 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 395AE3C78C for ; Sat, 18 Mar 2023 05:18:41 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id m35so4776830wms.4 for ; Sat, 18 Mar 2023 05:18:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679141919; 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=0h1UMM0j9zCioWczt99LUEVvu222yMb94T9JPkSX//E=; b=BjLQSqoA36NQ6+eSX+TK61KD1DqoNQV/ybm8A+Woexs6P/hCFxkUjiV/hsaCTXghDe WWjHMvh/s/GqGdd3iU2M1BiKAL4dT46XgQb1RLg3ANEYcqZ17C6ZAYG700nqjI/3Tn11 uDbsrJ4gjklv0ZEl7sQOAEsAhqYtv5vJs3Uy1yltHn9EFsLiL+xpOOdnwWELm+ayEmoU TatpOPiJJA6RI0AEYxUVdFMTZm0v+zLEu4LPP+aBNNzTWPEN8kg+dlMSy9B/Ip10WxJQ tSZNIHo2b+uW46O5f3cc7IswXRqbPXg/mfALlnkwYTyy3oEsX5UBxuqxDmrI+ayT1aPp QhhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679141919; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0h1UMM0j9zCioWczt99LUEVvu222yMb94T9JPkSX//E=; b=0kn/edcuPSaZvoG/iJIiJBdnzipIC+oUSe/I+fzz5e71N1Sf33H0rBSq/gaRwQk2Mr BzBg3q21jm7Q32HS3WczFxTfKDKKIDhnbRlP6yfqHGyGVJz9Vd2Wu7sYUWSLub8NtFMA J3FcDDhSSuqZEMY3Ciq4fX/Lbv30T5NKR7dW9he6LYVUoBMOD5vY18hYcIh6IxkeFT3m hCakFxgFp661WQINy0e5meItHMYNAQQWO149KrTX7o1pG23Mcbx5c0swDey9o8jXqIqh 8j4VvCK5xVHjDqFk6B4m9pNE+xPquxl6hGFyajH+ALPj7xW7U4g7oLwj46nmaXYvEklL RK5A== X-Gm-Message-State: AO0yUKUGXX/ccRtfd6CAkJWa359MOx1jkEHtt8PemlFZRPThXpywUoI7 72Ol7ydCKiuEeRnMW3Qk5u2Mig== X-Google-Smtp-Source: AK7set9sppaNNTfDHW0fvCuUhKVBr/VVnxsKfzgYODoyL0gV+jO0owOhuEP8OB2vMqpyMgGKe+CQWg== X-Received: by 2002:a05:600c:a41:b0:3eb:9822:f0 with SMTP id c1-20020a05600c0a4100b003eb982200f0mr28813847wmq.30.1679141919445; Sat, 18 Mar 2023 05:18:39 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id az40-20020a05600c602800b003e2096da239sm10814997wmb.7.2023.03.18.05.18.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Mar 2023 05:18:39 -0700 (PDT) From: Bryan O'Donoghue To: linux@roeck-us.net, heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org, andersson@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Cc: wcheng@codeaurora.org, caleb.connolly@linaro.org, bryan.odonoghue@linaro.org, konrad.dybcio@linaro.org, subbaram@quicinc.com, jackp@quicinc.com, robertom@qti.qualcomm.com Subject: [PATCH v4 06/18] dt-bindings: usb: Add Qualcomm PMIC Type-C controller YAML schema Date: Sat, 18 Mar 2023 12:18:16 +0000 Message-Id: <20230318121828.739424-7-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230318121828.739424-1-bryan.odonoghue@linaro.org> References: <20230318121828.739424-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Add a YAML binding for the Type-C silicon interface inside Qualcomm's pm8150b hardware block. The Type-C driver operates with a pdphy driver inside of a high level single TCPM device. Based on original work by Wesley. Signed-off-by: Wesley Cheng Signed-off-by: Bryan O'Donoghue --- .../bindings/usb/qcom,pmic-typec.yaml | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/qcom,pmic-typec.yaml diff --git a/Documentation/devicetree/bindings/usb/qcom,pmic-typec.yaml b/Documentation/devicetree/bindings/usb/qcom,pmic-typec.yaml new file mode 100644 index 0000000000000..d87bbab88d8be --- /dev/null +++ b/Documentation/devicetree/bindings/usb/qcom,pmic-typec.yaml @@ -0,0 +1,88 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/usb/qcom,pmic-typec.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Qualcomm PMIC based USB type C Detection Driver + +maintainers: + - Bryan O'Donoghue + +description: | + Qualcomm PMIC Type C Detect + +properties: + compatible: + enum: + - qcom,pm8150b-typec + + reg: + maxItems: 1 + description: Type C base address + + interrupts: + items: + - description: Bitmask of CC attach, VBUS error, tCCDebounce done and more + - description: VCONN Powered Detection + - description: CC state change + - description: VCONN over-current condition + - description: VBUS state change + - description: Attach Deteach notification + - description: Legacy cable detect + - description: Try.Src Try.Snk state change + + interrupt-names: + items: + - const: or-rid-detect-change + - const: vpd-detect + - const: cc-state-change + - const: vconn-oc + - const: vbus-change + - const: attach-detach + - const: legacy-cable-detect + - const: try-snk-src-detect + + vdd-vbus-supply: + description: VBUS power supply. + +required: + - compatible + - reg + - interrupts + - interrupt-names + - vdd-vbus-supply + +additionalProperties: false + +examples: + - | + #include + #include + pm8150b { + #address-cells = <1>; + #size-cells = <0>; + + pm8150b_typec: typec@1500 { + compatible = "qcom,pm8150b-typec"; + reg = <0x1500>; + interrupts = <0x2 0x15 PMIC_TYPEC_OR_RID_IRQ IRQ_TYPE_EDGE_RISING>, + <0x2 0x15 PMIC_TYPEC_VPD_IRQ IRQ_TYPE_EDGE_BOTH>, + <0x2 0x15 PMIC_TYPEC_CC_STATE_IRQ IRQ_TYPE_EDGE_RISING>, + <0x2 0x15 PMIC_TYPEC_VCONN_OC_IRQ IRQ_TYPE_EDGE_BOTH>, + <0x2 0x15 PMIC_TYPEC_VBUS_IRQ IRQ_TYPE_EDGE_RISING>, + <0x2 0x15 PMIC_TYPEC_ATTACH_DETACH_IRQ IRQ_TYPE_EDGE_RISING>, + <0x2 0x15 PMIC_TYPEC_LEGACY_CABLE_IRQ IRQ_TYPE_EDGE_BOTH>, + <0x2 0x15 PMIC_TYPEC_TRY_SNK_SRC_IRQ IRQ_TYPE_EDGE_RISING>; + interrupt-names = "or-rid-detect-change", + "vpd-detect", + "cc-state-change", + "vconn-oc", + "vbus-change", + "attach-detach", + "legacy-cable-detect", + "try-snk-src-detect"; + vdd-vbus-supply = <&pm8150b_vbus>; + }; + }; +... From patchwork Sat Mar 18 12:18:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 664946 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E22AC74A5B for ; Sat, 18 Mar 2023 12:18:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229866AbjCRMS4 (ORCPT ); Sat, 18 Mar 2023 08:18:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229772AbjCRMSq (ORCPT ); Sat, 18 Mar 2023 08:18:46 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B47C10A98 for ; Sat, 18 Mar 2023 05:18:43 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id r19-20020a05600c459300b003eb3e2a5e7bso4840358wmo.0 for ; Sat, 18 Mar 2023 05:18:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679141921; 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=l73lhSfJR0MXTja3lCI/L1FnLvsz9yKY6h4sxugZA5A=; b=p7uFWd6oW2fsk7FImFHU7uiL3c4UNxMdTDkhJbDsKgytoyQRZwTxyn/gfCbObzNPF5 lsvx1k5ng2jaV2vdc7p8Rcb5pu4NAmcTQvrkk/+wcNU5Phc4x0ADSiRsk0FLtD4odAX3 qZ0TfJIWMY1HGPTWYOYYFbwf/2/8wA3HABUUY9mAXgH8odu0m896wESdrSXEM+8UsXXY BkpCk39hmKqDzOivg3x0Bu1mBDW6THODnfdtpaNM48JHc53xRYe0AlxWrafDYwEi10IT +DTTrXRNzNOiu2MQTiDn5n++552Q7phxnk6ReHqlEzF5bmQDrva+BU7MOLXwoTP3y834 3SMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679141921; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=l73lhSfJR0MXTja3lCI/L1FnLvsz9yKY6h4sxugZA5A=; b=dfMlzj5Oee6Vl/UcsL3+GMXLtPggy9PL1rPnXdLtEj0OJU9b+IU+g/zUQUWenRscJr b88F9OhGpSEj5XzhAnBA9IhvG2ZNCD8pe/g2pFrs8LZKy23DEX9mUCACjjPo+FR8rsnq zd4r9+mRPnHR5LFP0c/6V/+OT9jx68oE3qzAuu1UF7OBB25IZxjts4zM8XOvV45ZVMNN vFGV1Mqjx5tqJNzWS4egx37WzsTo1P8LowT3eBJkxW13qGGgOiRiElRZEYo42P7PoQaB UPgpMCw6nDxIHhvnpUkVCpKT19uN/zPKgSO+GCLz+1J9TiGam2lI7priBkWwzVEA/xQJ Hn7w== X-Gm-Message-State: AO0yUKXBPC8AAERfQtBOPGL1xLmFfC8VKXdtmdLcoJrZgm3h/wdEWTp+ /kUXbkXLop5sk2LvtDsNnYIdGA== X-Google-Smtp-Source: AK7set9SEmSPVQbsgjWcJNUcoI172tQtFIJk2apNAzcvfRQ8VUsdFYSjj/i7zGSAbFeF7Klps6fCnA== X-Received: by 2002:a05:600c:1d24:b0:3da:1f6a:7b36 with SMTP id l36-20020a05600c1d2400b003da1f6a7b36mr26807018wms.0.1679141921479; Sat, 18 Mar 2023 05:18:41 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id az40-20020a05600c602800b003e2096da239sm10814997wmb.7.2023.03.18.05.18.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Mar 2023 05:18:40 -0700 (PDT) From: Bryan O'Donoghue To: linux@roeck-us.net, heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org, andersson@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Cc: wcheng@codeaurora.org, caleb.connolly@linaro.org, bryan.odonoghue@linaro.org, konrad.dybcio@linaro.org, subbaram@quicinc.com, jackp@quicinc.com, robertom@qti.qualcomm.com Subject: [PATCH v4 07/18] dt-bindings: usb: Add qcom,pmic-pdphy dt-binding header Date: Sat, 18 Mar 2023 12:18:17 +0000 Message-Id: <20230318121828.739424-8-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230318121828.739424-1-bryan.odonoghue@linaro.org> References: <20230318121828.739424-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Adds a series of defines which are used in the DTS and pdphy driver for identifying interrupts. Signed-off-by: Bryan O'Donoghue --- .../dt-bindings/usb/typec/qcom,pmic-pdphy.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 include/dt-bindings/usb/typec/qcom,pmic-pdphy.h diff --git a/include/dt-bindings/usb/typec/qcom,pmic-pdphy.h b/include/dt-bindings/usb/typec/qcom,pmic-pdphy.h new file mode 100644 index 0000000000000..7d39985bcc779 --- /dev/null +++ b/include/dt-bindings/usb/typec/qcom,pmic-pdphy.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2023, Linaro Ltd. All rights reserved. + */ + +#ifndef _DT_BINDINGS_QCOM_PMIC_PDPHY_H +#define _DT_BINDINGS_QCOM_PMIC_PDPHY_H + +#define PMIC_PDPHY_SIG_TX_IRQ 0x0 +#define PMIC_PDPHY_SIG_RX_IRQ 0x1 +#define PMIC_PDPHY_MSG_TX_IRQ 0x2 +#define PMIC_PDPHY_MSG_RX_IRQ 0x3 +#define PMIC_PDPHY_MSG_TX_FAIL_IRQ 0x4 +#define PMIC_PDPHY_MSG_TX_DISCARD_IRQ 0x5 +#define PMIC_PDPHY_MSG_RX_DISCARD_IRQ 0x6 +#define PMIC_PDPHY_FR_SWAP_IRQ 0x7 + +#endif From patchwork Sat Mar 18 12:18:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 665168 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20B86C61DA4 for ; Sat, 18 Mar 2023 12:19:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229772AbjCRMS7 (ORCPT ); Sat, 18 Mar 2023 08:18:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229896AbjCRMSs (ORCPT ); Sat, 18 Mar 2023 08:18:48 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B5EF222EC for ; Sat, 18 Mar 2023 05:18:43 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id x22so4784286wmj.3 for ; Sat, 18 Mar 2023 05:18:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679141922; 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=fI4AYapt0RytFxas+YG3RwluUr+LdRhSkfTAHXWWG/w=; b=jBCY2hKOGsHUhOb2ErAnGk8EZiwi9PUud2ytugcFCSI0IxK+uiMAQkUQOl+8aowAed Z0mtJWqfEqEvfXO2x9gTo1ZclSQ6MlCwgN0eEfTQZci3V+VsK0I9AmdiIvuMGB6Zo1Pb NDAl6mq3gGE+k0+EELuRp0o4O9SusZO3Pn9tedbU0fMCu7tOdFV4Y2nPOGPcmuSVMKot QStluQLSKdmK1M2v2R3KN0JRDpqotRX9fILGo2GX71BjKLOdDQU/4Ttr5Q5JQJlJbEZt ndnwNn61Sh6AwCIXL66B4oVIQOCSVnZ0zsz79Pnkh7RenUUeg/pH50tezc+vzjFDPGP9 oEPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679141922; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fI4AYapt0RytFxas+YG3RwluUr+LdRhSkfTAHXWWG/w=; b=nV6rdPLmF79UO3gMuDCtgGZNOC9g01LxHp0xcO3t6iaRa3c6HDALe7kMre5tAwPneO SfxrwX6QjWTl02+bjXYEUDkm3lW6ZfxKJ0ZydDg47QDdzL2k5zDlO7GKau/06oBWKL2z Kxo3ajh5YODrwXUvvju5m1TtAotWHpE0ZMVOKwQQqw0qC7ejig7Dl79dKyvsy6t5OGDl WgKEbFaPjdWhTzKxagXqIT8q+4FBgQMmYeD0ZEsuzV5HGasU2dyzBV0DpnglUxlyPpkk Tgb+cl9E9EQLWBvfH30eWrg2J9a7J5o7rNnaOlpaECi2Do93xwE+MuekjE7VTFzlNed7 gfjA== X-Gm-Message-State: AO0yUKVHJC1zUHu+/xM85V5lmAoZAlAJxDncqUrRWHDx88vJffAtFXgz qoILRBu0R7ZbjKvV493s6+vMMQ== X-Google-Smtp-Source: AK7set8G1BPZ+YZ6GW/7ALfmWyvbWgCOcwIQmmuos4VSdGGxOojMmZ27GMYk/YoyO8q8T41q6kievQ== X-Received: by 2002:a7b:c38b:0:b0:3ed:2e02:1bfe with SMTP id s11-20020a7bc38b000000b003ed2e021bfemr4007788wmj.20.1679141922644; Sat, 18 Mar 2023 05:18:42 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id az40-20020a05600c602800b003e2096da239sm10814997wmb.7.2023.03.18.05.18.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Mar 2023 05:18:42 -0700 (PDT) From: Bryan O'Donoghue To: linux@roeck-us.net, heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org, andersson@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Cc: wcheng@codeaurora.org, caleb.connolly@linaro.org, bryan.odonoghue@linaro.org, konrad.dybcio@linaro.org, subbaram@quicinc.com, jackp@quicinc.com, robertom@qti.qualcomm.com Subject: [PATCH v4 08/18] dt-bindings: usb: Add Qualcomm PMIC PDPHY controller YAML schema Date: Sat, 18 Mar 2023 12:18:18 +0000 Message-Id: <20230318121828.739424-9-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230318121828.739424-1-bryan.odonoghue@linaro.org> References: <20230318121828.739424-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Add a YAML binding for the power-delivery PHY silicon interface inside Qualcomm's pm8150b hardware block. The pdphy driver operates with a type-c driver inside of a high level single TCPM device to provide overall TCPM functionality. Signed-off-by: Bryan O'Donoghue --- .../bindings/usb/qcom,pmic-pdphy.yaml | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/qcom,pmic-pdphy.yaml diff --git a/Documentation/devicetree/bindings/usb/qcom,pmic-pdphy.yaml b/Documentation/devicetree/bindings/usb/qcom,pmic-pdphy.yaml new file mode 100644 index 0000000000000..79318e3da41e6 --- /dev/null +++ b/Documentation/devicetree/bindings/usb/qcom,pmic-pdphy.yaml @@ -0,0 +1,89 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/usb/qcom,pmic-pdphy.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Qualcomm PMIC based USB PDPHY driver + +maintainers: + - Bryan O'Donoghue + +description: | + Qualcomm PMIC Power Delivery PHY driver + +properties: + compatible: + enum: + - qcom,pm8150b-pdphy + + reg: + maxItems: 1 + description: PDPHY base address + + interrupts: + items: + - description: Sig TX - transmitted reset signal + - description: Sig RX - received reset signal + - description: TX completion + - description: RX completion + - description: TX fail + - description: TX discgard + - description: RX discgard + - description: Fast Role Swap event + + interrupt-names: + items: + - const: sig-tx + - const: sig-rx + - const: msg-tx + - const: msg-rx + - const: msg-tx-failed + - const: msg-tx-discarded + - const: msg-rx-discarded + - const: fr-swap + + vdd-phy-supply: + description: VDD regulator supply to the PHY. + +required: + - compatible + - reg + - interrupts + - interrupt-names + - vdd-phy-supply + +additionalProperties: false + +examples: + - | + #include + #include + + pm8150b { + #address-cells = <1>; + #size-cells = <0>; + + pm8150b_pdphy: pdphy@1700 { + compatible = "qcom,pm8150b-pdphy"; + reg = <0x1700>; + interrupts = <0x2 0x17 PMIC_PDPHY_SIG_TX_IRQ IRQ_TYPE_EDGE_RISING>, + <0x2 0x17 PMIC_PDPHY_SIG_RX_IRQ IRQ_TYPE_EDGE_RISING>, + <0x2 0x17 PMIC_PDPHY_MSG_TX_IRQ IRQ_TYPE_EDGE_RISING>, + <0x2 0x17 PMIC_PDPHY_MSG_RX_IRQ IRQ_TYPE_EDGE_RISING>, + <0x2 0x17 PMIC_PDPHY_MSG_TX_FAIL_IRQ IRQ_TYPE_EDGE_RISING>, + <0x2 0x17 PMIC_PDPHY_MSG_TX_DISCARD_IRQ IRQ_TYPE_EDGE_RISING>, + <0x2 0x17 PMIC_PDPHY_MSG_RX_DISCARD_IRQ IRQ_TYPE_EDGE_RISING>, + <0x2 0x17 PMIC_PDPHY_FR_SWAP_IRQ IRQ_TYPE_EDGE_RISING>; + interrupt-names = "sig-tx", + "sig-rx", + "msg-tx", + "msg-rx", + "msg-tx-failed", + "msg-tx-discarded", + "msg-rx-discarded", + "fr-swap"; + vdd-phy-supply = <&vreg_l2a_3p1>; + }; + }; +... From patchwork Sat Mar 18 12:18:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 665167 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80680C77B6C for ; Sat, 18 Mar 2023 12:19:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229842AbjCRMTA (ORCPT ); Sat, 18 Mar 2023 08:19:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229837AbjCRMSv (ORCPT ); Sat, 18 Mar 2023 08:18:51 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B55962ED56 for ; Sat, 18 Mar 2023 05:18:44 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id bh21-20020a05600c3d1500b003ed1ff06fb0so4826682wmb.3 for ; Sat, 18 Mar 2023 05:18:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679141924; 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=kmhAneZaAlmWW9bghs/uPFpD4YYuHAdYFsrvbdKAhWg=; b=fdegTtX0ArzzAVQgtxqPEWd1rY6tz416Sf6+aphRty7zbQdD3CnlxOv3SAR9VmM2F1 Xf7++SVP0uSUWOBMm16RQm50yOgHNgrK4YdGl90MLa9m2BWtdAL0ja5ldyMObA+jKLlY YAVusGNkWjwa9bX3LgAAYd/V3+PLSJoVmCdTuvNn6bYQvo+mIFozyMZ5RVCSZPTU5e7K LUXG0LWn5HQyrGezv/pqwKvsbTac4iLulEIKXoOSmhsvTnDqGciS8lXMFbgSNZ2tFunB S9mnkBKA5wcn6sMrBeb34gDrb9FC5VKEXi5Am5e0VFQJb42fdIn0ViQGvhkDBpFX7PYb JtBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679141924; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kmhAneZaAlmWW9bghs/uPFpD4YYuHAdYFsrvbdKAhWg=; b=F1vg8yAhP9Wcd5IJpygab78OfNFOOn6hBujc8bycQEWtCrCUzRALTDBCvr80fSyU9s 0fZDdwjenfDdjF53gpF/Kr8/+iPn2WnUzkGZo8y4Tc6xwHyEWmDufdWZJbh8kZkyw7Im kTBQp/+MlTArbHwFU6UG4r9ziRSbfz8hh/Y+ZMixJFrAqStx3Swug5qO0rldpE3rw5fm gnARQQB4B75s+Z8U1gyKHwPI/BMX1K9FClPL7Y4KiBMRvq7expllkvr4PSSQzlwQdBsi /s3gORozqyfntsrXoSQVs9CemnAuS1zTNSWORZeCh9Hexk2ZOr0ekGn63nLMN9XWLKTc M9UA== X-Gm-Message-State: AO0yUKXTCL7d6o7GJJ+WSJMedyH+f5mJb+nRQSlDXc9sHOu5Cu8WnC1o OH7dVQx4CEwlrlDFV3pki/vvtQ== X-Google-Smtp-Source: AK7set+sTySfoJ57o27rpr0isEzIgS4OofwKP0cnf9gsEujcPk6W68xzuo5zqsFvh17HdFW01BpcPw== X-Received: by 2002:a05:600c:35ce:b0:3e2:1368:e3a0 with SMTP id r14-20020a05600c35ce00b003e21368e3a0mr28066551wmq.18.1679141923883; Sat, 18 Mar 2023 05:18:43 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id az40-20020a05600c602800b003e2096da239sm10814997wmb.7.2023.03.18.05.18.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Mar 2023 05:18:43 -0700 (PDT) From: Bryan O'Donoghue To: linux@roeck-us.net, heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org, andersson@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Cc: wcheng@codeaurora.org, caleb.connolly@linaro.org, bryan.odonoghue@linaro.org, konrad.dybcio@linaro.org, subbaram@quicinc.com, jackp@quicinc.com, robertom@qti.qualcomm.com Subject: [PATCH v4 09/18] dt-bindings: usb: Add Qualcomm PMIC TCPM YAML schema Date: Sat, 18 Mar 2023 12:18:19 +0000 Message-Id: <20230318121828.739424-10-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230318121828.739424-1-bryan.odonoghue@linaro.org> References: <20230318121828.739424-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Add a YAML description for the pm8150b-tcpm driver. The pm8150b-tcpm encapsulates a type-c block and a pdphy block into one block presented to the TCPM Linux API. Signed-off-by: Bryan O'Donoghue --- .../bindings/usb/qcom,pmic-virt-tcpm.yaml | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/qcom,pmic-virt-tcpm.yaml diff --git a/Documentation/devicetree/bindings/usb/qcom,pmic-virt-tcpm.yaml b/Documentation/devicetree/bindings/usb/qcom,pmic-virt-tcpm.yaml new file mode 100644 index 0000000000000..576842c8b65b4 --- /dev/null +++ b/Documentation/devicetree/bindings/usb/qcom,pmic-virt-tcpm.yaml @@ -0,0 +1,88 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/usb/qcom,pmic-virt-tcpm.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Qualcomm PMIC Virtual TCPM Driver + +maintainers: + - Bryan O'Donoghue + +description: | + Qualcomm PMIC Virtual Type-C Port Manager Driver + A virtual device which manages Qualcomm PMIC provided Type-C port and + Power Delivery in one place. + +properties: + compatible: + const: qcom,pmic-virt-tcpm + + connector: + type: object + $ref: /schemas/connector/usb-connector.yaml# + unevaluatedProperties: false + + port: + $ref: /schemas/graph.yaml#/properties/port + description: + Contains a port which consumes data-role switching messages. + + qcom,pmic-typec: + $ref: /schemas/types.yaml#/definitions/phandle + description: + A phandle to the typec port hardware driver. + + qcom,pmic-pdphy: + $ref: /schemas/types.yaml#/definitions/phandle + description: + A phandle to the type-c pdphy hardware driver. + +required: + - compatible + - connector + - port + - qcom,pmic-typec + - qcom,pmic-pdphy + +additionalProperties: false + +examples: + - | + #include + #include + #include + #include + + pm8150b_tcpm: pmic-tcpm { + compatible = "qcom,pmic-virt-tcpm"; + + qcom,pmic-typec = <&pm8150b_typec>; + qcom,pmic-pdphy = <&pm8150b_pdphy>; + + port { + usb3_role: endpoint { + remote-endpoint = <&dwc3_drd_switch>; + }; + }; + + connector { + compatible = "usb-c-connector"; + + power-role = "source"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + pmic_tcpm_ss_mux: endpoint { + remote-endpoint = <&qmp_ss_mux>; + }; + }; + }; + }; + }; + +... From patchwork Sat Mar 18 12:18:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 664944 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5A59C74A5B for ; Sat, 18 Mar 2023 12:19:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229916AbjCRMTB (ORCPT ); Sat, 18 Mar 2023 08:19:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229884AbjCRMSx (ORCPT ); Sat, 18 Mar 2023 08:18:53 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B379D32E55 for ; Sat, 18 Mar 2023 05:18:46 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id r19-20020a05600c459300b003eb3e2a5e7bso4840418wmo.0 for ; Sat, 18 Mar 2023 05:18:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679141925; 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=yLd7HI2bUYorqCDaYSST2B2/Phylx7+zRqYsOZS+7qo=; b=nsNTikRLmNDmw/VvknWrCjttwANEloSgdqcOcAl4VsNrz21ekchdK2nQYZZ3OekKBI RjfjWo4F1dLK+i34tRBWRbc/AuzvAlULUROLOmUy/s8+iza4nkxgUGC28FMNpU5x34aB fJ5px8sdw2hhKgtJU+sIgxE/U2YhpCQ1z8xcsE9Mu8r8kVTwgJpTIJnGC6Tm+pngzosD nCxSePxx8S68y1Fvyts9qqE4Nh4ulvY6Fr3pzozqlZo4+CrKQDGPWUNuD2tLR68r6bRj EzE2WHOCN1/U4xTfv2HcpWBsQxqZ5G+zWRja7Vms8Sfpxo1xGOlmbS6OrMejMcRTdRZB PTrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679141925; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yLd7HI2bUYorqCDaYSST2B2/Phylx7+zRqYsOZS+7qo=; b=Bzd9yHNClP437+jHSIRy+Xi4XZLE5O9u5xBNY4Ao1LYEUxjT9gu5gvJSz1jcc5kSKp iRit90e4lM3m8037zhSSoZX9yeCXP0GGlynTmP9CMY1HaWS3CDjReVDsd3wEMkLV7h6f oZ+ng5UWtrSyYj+MjOUYCJ0SUS/r8GkTI6gwWFN+PCMo2/2yxQGgGRBmO4hP1Fe59LQ1 Q16IC67IpfxDW5UOM/kYT7sORtlrrR5QuFHY8F8G5JuC1mcj8ocwgPgSg28v7bYyWom7 L4YLpmjQyKIWzrto2oLHaeQPyR/gdmOBtlqMlnbQcrXWypIGxFzPVatCdAcoejGBpd0g YxTg== X-Gm-Message-State: AO0yUKXxQluAdcZSS2lED1s5ixdgM6cA6Gxa90UtYsHaDG1mJQyIayih YSETy0/bzfFqtnZdmUs42UTKOg== X-Google-Smtp-Source: AK7set+3dKGjp0ekVrV6jLvGmCMjFH9/qHg/fX8HGtcPua3GPB2vAVZdH9/sOzgRxXzeAGA284b+Lw== X-Received: by 2002:a05:600c:3790:b0:3e2:1dac:b071 with SMTP id o16-20020a05600c379000b003e21dacb071mr4928122wmr.13.1679141924982; Sat, 18 Mar 2023 05:18:44 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id az40-20020a05600c602800b003e2096da239sm10814997wmb.7.2023.03.18.05.18.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Mar 2023 05:18:44 -0700 (PDT) From: Bryan O'Donoghue To: linux@roeck-us.net, heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org, andersson@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Cc: wcheng@codeaurora.org, caleb.connolly@linaro.org, bryan.odonoghue@linaro.org, konrad.dybcio@linaro.org, subbaram@quicinc.com, jackp@quicinc.com, robertom@qti.qualcomm.com Subject: [PATCH v4 10/18] dt-bindings: mfd: qcom, spmi-pmic: Add pdphy to SPMI device types Date: Sat, 18 Mar 2023 12:18:20 +0000 Message-Id: <20230318121828.739424-11-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230318121828.739424-1-bryan.odonoghue@linaro.org> References: <20230318121828.739424-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The PDPHY sits inside of the PMIC SPMI block providing register-level ability to read/write USB Type-C Power Delivery protocol packets over the SBU pins. Signed-off-by: Bryan O'Donoghue --- Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml b/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml index 8f076bb622b15..111aec53caeb5 100644 --- a/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml +++ b/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml @@ -140,6 +140,10 @@ patternProperties: type: object $ref: /schemas/power/reset/qcom,pon.yaml# + "pdphy@[0-9a-f]+$": + type: object + $ref: /schemas/usb/qcom,pmic-pdphy.yaml# + "^rtc@[0-9a-f]+$": type: object $ref: /schemas/rtc/qcom-pm8xxx-rtc.yaml# From patchwork Sat Mar 18 12:18:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 665166 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B76CC76196 for ; Sat, 18 Mar 2023 12:19:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229945AbjCRMTC (ORCPT ); Sat, 18 Mar 2023 08:19:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229904AbjCRMSy (ORCPT ); Sat, 18 Mar 2023 08:18:54 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1046410B2 for ; Sat, 18 Mar 2023 05:18:47 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id g6-20020a05600c4ec600b003ed8826253aso1487578wmq.0 for ; Sat, 18 Mar 2023 05:18:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679141926; 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=Ht/SWuDYXnevXoEkhNpATVLiHltFCqt8r9SyP29xT4k=; b=QvjZJDcYpNTQEkV11pdQMormGyP1I9+/P6omCWW6NSyxyN5ZZxRZUGJuEO5pDXInNP KUKJYj6S6Tc98tWooci/slFLDZn7P0XssdDOHkqSh9BbZy1oUFEq+mpmp0ig5jMSvE0n 3OCUiQcbz83BlJziM8xPsEEWIBT8DPYUp/nOPLxhGdu4FkIp7/Ky50QWjtf352WTBLUP 6TyLdIiSNC4lqBFG7od8a0WrkvLzRGXJ05N3/f9ovmw/l7OWUuHVzuYJCkzgpi1m/Vod FiWpFUwcb5fLaFfnqLwGFPJFGwzo/yBEYnVOx/r2QiksoOqEgAP8HOUg8V85uRJycMkI ZA8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679141926; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ht/SWuDYXnevXoEkhNpATVLiHltFCqt8r9SyP29xT4k=; b=7wvoVtWbnZwRgp3W3K/9ewgfZgxliLlyd5UEplpzzd9es4zfbmMg7wsxzkkS8FPCxr kjnVkSWqmnN5dTfYRZRmKT72bIZ925BkloBjokEFvbowcT5/RexhpUEp8Gn3htjwJBoG CbYeriJSXDwEhgxGD3XFiRaqn3c32DmcYNcpIPW/FSRek8yrTRJuXFmRrdsz7+vIBxbr 4sQYNeYM0tpA11ygwy52K8XeqNkZ26IE/5kT2HuqqFqGfMHMDmq32xCqI00Gwj6XqBG7 vADbALeJSVl+0MmRpWO6pBczNni/wFagPoOE1E7OL4KtHid3O4Zxv6Gm1ES+OLvtinFH pJeQ== X-Gm-Message-State: AO0yUKU65+vzYA0g65/lgEI/lSAWzB9o2alpPc8lmrBJFAQDssMKMZK1 OyafjcuwqE7iCgom+Rf+K9wp3A== X-Google-Smtp-Source: AK7set/Z573jzBu8Hjbd29QCCYPbw3UTwZEWg5JLKIkNkDlnJmmMTyT2kjlezi3LmHGv2rWyTDzOEg== X-Received: by 2002:a05:600c:3c8f:b0:3ea:bc08:b63e with SMTP id bg15-20020a05600c3c8f00b003eabc08b63emr29033660wmb.2.1679141926000; Sat, 18 Mar 2023 05:18:46 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id az40-20020a05600c602800b003e2096da239sm10814997wmb.7.2023.03.18.05.18.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Mar 2023 05:18:45 -0700 (PDT) From: Bryan O'Donoghue To: linux@roeck-us.net, heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org, andersson@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Cc: wcheng@codeaurora.org, caleb.connolly@linaro.org, bryan.odonoghue@linaro.org, konrad.dybcio@linaro.org, subbaram@quicinc.com, jackp@quicinc.com, robertom@qti.qualcomm.com Subject: [PATCH v4 11/18] dt-bindings: mfd: qcom, spmi-pmic: Add typec to SPMI device types Date: Sat, 18 Mar 2023 12:18:21 +0000 Message-Id: <20230318121828.739424-12-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230318121828.739424-1-bryan.odonoghue@linaro.org> References: <20230318121828.739424-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Add the PMIC Type-C port driver to the list of devices. Signed-off-by: Bryan O'Donoghue --- Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml b/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml index 111aec53caeb5..44e1dbd5c0f32 100644 --- a/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml +++ b/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml @@ -152,6 +152,10 @@ patternProperties: type: object $ref: /schemas/thermal/qcom,spmi-temp-alarm.yaml# + "^typec@[0-9a-f]+$": + type: object + $ref: /schemas/usb/qcom,pmic-typec.yaml# + "^usb-detect@[0-9a-f]+$": type: object $ref: /schemas/extcon/qcom,pm8941-misc.yaml# From patchwork Sat Mar 18 12:18:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 664940 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1352CC761AF for ; Sat, 18 Mar 2023 12:19:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229972AbjCRMTI (ORCPT ); Sat, 18 Mar 2023 08:19:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229892AbjCRMTB (ORCPT ); Sat, 18 Mar 2023 08:19:01 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35B323D91B for ; Sat, 18 Mar 2023 05:18:47 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id fm20-20020a05600c0c1400b003ead37e6588so6508644wmb.5 for ; Sat, 18 Mar 2023 05:18:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679141927; 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=vA0LfsucuAAAYvBzmzm1MrAeYx8BO3H74tY+ox3Lv2w=; b=r8x/gIrfP5rnMA/Et4CI++9vU4Mj0Tx2TaPHT9E4eqC9jxu8JSKqwMYOlWEtw3gD7W giOT+hZD2gkfnDP43TSZ8avwQg+tX0ZEOqy61KEbAsaj+Ja5dJ4ToLt6TQPYMA/zKLqZ MOgdDK2ASJxogrbTpRQi06UmPVC90Y4MN1F7gJk9iqrffCZ/yHZwaOs3bCw0I4Q7R8Lf VpZXRLiPHqhrJMdv87dhKJPxYme++WMxzZlPsP3hx+/1VXAWnvg7d3Bl4NLWvxtZbu4f FmmQEbBiaqCGCzhL4ia6pBNRXFoTzq1m+HYgDWNLz3o0hwTBgEUrNnU11F+QeUrqG2Jr GlDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679141927; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vA0LfsucuAAAYvBzmzm1MrAeYx8BO3H74tY+ox3Lv2w=; b=x/oGrUWPWKsI8OzN+AQBKCkOK9rCKg9nnVGm7MzXDsPre3FQ6+dI6YuWgUMNA3eX9/ xqgJV/80kbJeI1Ww2AHz9W3cmwuk3z+OeKpl2yOjbZnxFcY44NiyXX3q91rD4qIIopat a+7u81HjGVc9Q6wLnNg4gynLPgpwyhKBEvO3VCSWtN+i6iXH+RE4AY1sPsHPO/fFUukO Xn39yBeTbFVnJzmqcJXLINOhTkrZQm6QNzd5E5E1o6TcSpgxuBUe4p4Ykxqecac5UpwO 3Yiw9izBLEKwHjYEpcvUSKyHmvxdeIW6m9qiH4bKesVRlNQLiPBSvag3elLhzo62yhQL I3JA== X-Gm-Message-State: AO0yUKV3lcmeX4nznyGL9TSK6/e6jCZ73HsGXw5KPNGKyQzgc9w86xIC 7fJfmmM/PfaphoeaCF2Z7Bh7OA== X-Google-Smtp-Source: AK7set+kjQW2tjGuXIRWH6OWUen5Nm/Q9nsWnQnGAU9NfMgvy0smXQivzmoWb/Fs4IarN0KCwy60fQ== X-Received: by 2002:a05:600c:4f86:b0:3ed:29d9:56ae with SMTP id n6-20020a05600c4f8600b003ed29d956aemr18576337wmq.6.1679141927189; Sat, 18 Mar 2023 05:18:47 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id az40-20020a05600c602800b003e2096da239sm10814997wmb.7.2023.03.18.05.18.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Mar 2023 05:18:46 -0700 (PDT) From: Bryan O'Donoghue To: linux@roeck-us.net, heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org, andersson@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Cc: wcheng@codeaurora.org, caleb.connolly@linaro.org, bryan.odonoghue@linaro.org, konrad.dybcio@linaro.org, subbaram@quicinc.com, jackp@quicinc.com, robertom@qti.qualcomm.com Subject: [PATCH v4 12/18] usb: typec: qcom: Add Qualcomm PMIC TCPM support Date: Sat, 18 Mar 2023 12:18:22 +0000 Message-Id: <20230318121828.739424-13-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230318121828.739424-1-bryan.odonoghue@linaro.org> References: <20230318121828.739424-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org This commit adds a QCOM PMIC TCPM driver with an initial pm8150b block. qcom_pmic_virt_tcpm.c : Responsible for registering with TCPM and arbitrates access to the Type-C and PDPHY hardware blocks in one place. This driver presents a virtual device to the Linux TCPM layer. qcom_pmic_pdphy.c: Rsponsible for interfacing with the PDPHY hardware and processing power-delivery related calls from TCPM. This hardware binding can be extended to facilitate similar hardware in different PMICs. qcom_pmic_typec.c: Responsible for notifying and processing Type-C related calls from TCPM. This hardware binding can be extended to facilitate similar hardware in different PMICs. This code provides all of the same functionality as the existing qcom typec driver plus power-delivery as well. As a result commit 6c8cf3695176 ("usb: typec: Add QCOM PMIC typec detection driver") can be deleted entirely. References code from Jonathan Marek, Jack Pham, Wesley Cheng, Hemant Kumar, Guru Das Srinagesh and Ashay Jaiswal. Signed-off-by: Bryan O'Donoghue --- MAINTAINERS | 10 + drivers/usb/typec/Kconfig | 13 - drivers/usb/typec/Makefile | 1 - drivers/usb/typec/qcom-pmic-typec.c | 261 ------- drivers/usb/typec/tcpm/Kconfig | 11 + drivers/usb/typec/tcpm/Makefile | 1 + drivers/usb/typec/tcpm/qcom/Makefile | 6 + drivers/usb/typec/tcpm/qcom/qcom_pmic_pdphy.c | 605 +++++++++++++++++ drivers/usb/typec/tcpm/qcom/qcom_pmic_pdphy.h | 85 +++ drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 637 ++++++++++++++++++ drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.h | 163 +++++ .../usb/typec/tcpm/qcom/qcom_pmic_virt_tcpm.c | 326 +++++++++ 12 files changed, 1844 insertions(+), 275 deletions(-) delete mode 100644 drivers/usb/typec/qcom-pmic-typec.c create mode 100644 drivers/usb/typec/tcpm/qcom/Makefile create mode 100644 drivers/usb/typec/tcpm/qcom/qcom_pmic_pdphy.c create mode 100644 drivers/usb/typec/tcpm/qcom/qcom_pmic_pdphy.h create mode 100644 drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c create mode 100644 drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.h create mode 100644 drivers/usb/typec/tcpm/qcom/qcom_pmic_virt_tcpm.c diff --git a/MAINTAINERS b/MAINTAINERS index 9b218dc388323..59f8a3c0b6364 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -17435,6 +17435,16 @@ S: Maintained F: Documentation/devicetree/bindings/thermal/qcom-tsens.yaml F: drivers/thermal/qcom/ +QUALCOMM TYPEC PORT MANAGER DRIVER +M: Bryan O'Donoghue +L: linux-arm-msm@vger.kernel.org +L: linux-usb@vger.kernel.org +S: Maintained +F: Documentation/devicetree/bindings/usb/qcom,pmic-*.yaml +F: drivers/usb/typec/tcpm/qcom/ +F: include/dt-bindings/usb/typec/qcom,pmic-pdphy.h +F: include/dt-bindings/usb/typec/qcom,pmic-typec.h + QUALCOMM VENUS VIDEO ACCELERATOR DRIVER M: Stanimir Varbanov M: Vikash Garodia diff --git a/drivers/usb/typec/Kconfig b/drivers/usb/typec/Kconfig index 831e7049977df..2f80c2792dbda 100644 --- a/drivers/usb/typec/Kconfig +++ b/drivers/usb/typec/Kconfig @@ -100,19 +100,6 @@ 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_PMIC - tristate "Qualcomm PMIC USB Type-C driver" - depends on ARCH_QCOM || COMPILE_TEST - depends on USB_ROLE_SWITCH || !USB_ROLE_SWITCH - help - Driver for supporting role switch over the Qualcomm PMIC. This will - handle the USB Type-C role and orientation detection reported by the - QCOM PMIC if the PMIC has the capability to handle USB Type-C - detection. - - It will also enable the VBUS output to connected devices when a - DFP connection is made. - 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 4a83dad51a6cf..7a368fea61bc9 100644 --- a/drivers/usb/typec/Makefile +++ b/drivers/usb/typec/Makefile @@ -8,7 +8,6 @@ obj-$(CONFIG_TYPEC_UCSI) += ucsi/ obj-$(CONFIG_TYPEC_TPS6598X) += tipd/ obj-$(CONFIG_TYPEC_ANX7411) += anx7411.o obj-$(CONFIG_TYPEC_HD3SS3220) += hd3ss3220.o -obj-$(CONFIG_TYPEC_QCOM_PMIC) += qcom-pmic-typec.o obj-$(CONFIG_TYPEC_STUSB160X) += stusb160x.o obj-$(CONFIG_TYPEC_RT1719) += rt1719.o obj-$(CONFIG_TYPEC_WUSB3801) += wusb3801.o diff --git a/drivers/usb/typec/qcom-pmic-typec.c b/drivers/usb/typec/qcom-pmic-typec.c deleted file mode 100644 index 432ea62f1bab6..0000000000000 --- a/drivers/usb/typec/qcom-pmic-typec.c +++ /dev/null @@ -1,261 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (c) 2020, The Linux Foundation. All rights reserved. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define TYPEC_MISC_STATUS 0xb -#define CC_ATTACHED BIT(0) -#define CC_ORIENTATION BIT(1) -#define SNK_SRC_MODE BIT(6) -#define TYPEC_MODE_CFG 0x44 -#define TYPEC_DISABLE_CMD BIT(0) -#define EN_SNK_ONLY BIT(1) -#define EN_SRC_ONLY BIT(2) -#define TYPEC_VCONN_CONTROL 0x46 -#define VCONN_EN_SRC BIT(0) -#define VCONN_EN_VAL BIT(1) -#define TYPEC_EXIT_STATE_CFG 0x50 -#define SEL_SRC_UPPER_REF BIT(2) -#define TYPEC_INTR_EN_CFG_1 0x5e -#define TYPEC_INTR_EN_CFG_1_MASK GENMASK(7, 0) - -struct qcom_pmic_typec { - struct device *dev; - struct regmap *regmap; - u32 base; - - struct typec_port *port; - struct usb_role_switch *role_sw; - - struct regulator *vbus_reg; - bool vbus_enabled; -}; - -static void qcom_pmic_typec_enable_vbus_regulator(struct qcom_pmic_typec - *qcom_usb, bool enable) -{ - int ret; - - if (enable == qcom_usb->vbus_enabled) - return; - - if (enable) { - ret = regulator_enable(qcom_usb->vbus_reg); - if (ret) - return; - } else { - ret = regulator_disable(qcom_usb->vbus_reg); - if (ret) - return; - } - qcom_usb->vbus_enabled = enable; -} - -static void qcom_pmic_typec_check_connection(struct qcom_pmic_typec *qcom_usb) -{ - enum typec_orientation orientation; - enum usb_role role; - unsigned int stat; - bool enable_vbus; - - regmap_read(qcom_usb->regmap, qcom_usb->base + TYPEC_MISC_STATUS, - &stat); - - if (stat & CC_ATTACHED) { - orientation = (stat & CC_ORIENTATION) ? - TYPEC_ORIENTATION_REVERSE : - TYPEC_ORIENTATION_NORMAL; - typec_set_orientation(qcom_usb->port, orientation); - - role = (stat & SNK_SRC_MODE) ? USB_ROLE_HOST : USB_ROLE_DEVICE; - if (role == USB_ROLE_HOST) - enable_vbus = true; - else - enable_vbus = false; - } else { - role = USB_ROLE_NONE; - enable_vbus = false; - } - - qcom_pmic_typec_enable_vbus_regulator(qcom_usb, enable_vbus); - usb_role_switch_set_role(qcom_usb->role_sw, role); -} - -static irqreturn_t qcom_pmic_typec_interrupt(int irq, void *_qcom_usb) -{ - struct qcom_pmic_typec *qcom_usb = _qcom_usb; - - qcom_pmic_typec_check_connection(qcom_usb); - return IRQ_HANDLED; -} - -static void qcom_pmic_typec_typec_hw_init(struct qcom_pmic_typec *qcom_usb, - enum typec_port_type type) -{ - u8 mode = 0; - - regmap_update_bits(qcom_usb->regmap, - qcom_usb->base + TYPEC_INTR_EN_CFG_1, - TYPEC_INTR_EN_CFG_1_MASK, 0); - - if (type == TYPEC_PORT_SRC) - mode = EN_SRC_ONLY; - else if (type == TYPEC_PORT_SNK) - mode = EN_SNK_ONLY; - - regmap_update_bits(qcom_usb->regmap, qcom_usb->base + TYPEC_MODE_CFG, - EN_SNK_ONLY | EN_SRC_ONLY, mode); - - regmap_update_bits(qcom_usb->regmap, - qcom_usb->base + TYPEC_VCONN_CONTROL, - VCONN_EN_SRC | VCONN_EN_VAL, VCONN_EN_SRC); - regmap_update_bits(qcom_usb->regmap, - qcom_usb->base + TYPEC_EXIT_STATE_CFG, - SEL_SRC_UPPER_REF, SEL_SRC_UPPER_REF); -} - -static int qcom_pmic_typec_probe(struct platform_device *pdev) -{ - struct qcom_pmic_typec *qcom_usb; - struct device *dev = &pdev->dev; - struct fwnode_handle *fwnode; - struct typec_capability cap; - const char *buf; - int ret, irq, role; - u32 reg; - - ret = device_property_read_u32(dev, "reg", ®); - if (ret < 0) { - dev_err(dev, "missing base address\n"); - return ret; - } - - qcom_usb = devm_kzalloc(dev, sizeof(*qcom_usb), GFP_KERNEL); - if (!qcom_usb) - return -ENOMEM; - - qcom_usb->dev = dev; - qcom_usb->base = reg; - - qcom_usb->regmap = dev_get_regmap(dev->parent, NULL); - if (!qcom_usb->regmap) { - dev_err(dev, "Failed to get regmap\n"); - return -EINVAL; - } - - qcom_usb->vbus_reg = devm_regulator_get(qcom_usb->dev, "usb_vbus"); - if (IS_ERR(qcom_usb->vbus_reg)) - return PTR_ERR(qcom_usb->vbus_reg); - - fwnode = device_get_named_child_node(dev, "connector"); - if (!fwnode) - return -EINVAL; - - ret = fwnode_property_read_string(fwnode, "power-role", &buf); - if (!ret) { - role = typec_find_port_power_role(buf); - if (role < 0) - role = TYPEC_PORT_SNK; - } else { - role = TYPEC_PORT_SNK; - } - cap.type = role; - - ret = fwnode_property_read_string(fwnode, "data-role", &buf); - if (!ret) { - role = typec_find_port_data_role(buf); - if (role < 0) - role = TYPEC_PORT_UFP; - } else { - role = TYPEC_PORT_UFP; - } - cap.data = role; - - cap.prefer_role = TYPEC_NO_PREFERRED_ROLE; - cap.fwnode = fwnode; - qcom_usb->port = typec_register_port(dev, &cap); - if (IS_ERR(qcom_usb->port)) { - ret = PTR_ERR(qcom_usb->port); - dev_err(dev, "Failed to register type c port %d\n", ret); - goto err_put_node; - } - fwnode_handle_put(fwnode); - - qcom_usb->role_sw = fwnode_usb_role_switch_get(dev_fwnode(qcom_usb->dev)); - if (IS_ERR(qcom_usb->role_sw)) { - ret = dev_err_probe(dev, PTR_ERR(qcom_usb->role_sw), - "failed to get role switch\n"); - goto err_typec_port; - } - - irq = platform_get_irq(pdev, 0); - if (irq < 0) - goto err_usb_role_sw; - - ret = devm_request_threaded_irq(qcom_usb->dev, irq, NULL, - qcom_pmic_typec_interrupt, IRQF_ONESHOT, - "qcom-pmic-typec", qcom_usb); - if (ret) { - dev_err(&pdev->dev, "Could not request IRQ\n"); - goto err_usb_role_sw; - } - - platform_set_drvdata(pdev, qcom_usb); - qcom_pmic_typec_typec_hw_init(qcom_usb, cap.type); - qcom_pmic_typec_check_connection(qcom_usb); - - return 0; - -err_usb_role_sw: - usb_role_switch_put(qcom_usb->role_sw); -err_typec_port: - typec_unregister_port(qcom_usb->port); -err_put_node: - fwnode_handle_put(fwnode); - - return ret; -} - -static int qcom_pmic_typec_remove(struct platform_device *pdev) -{ - struct qcom_pmic_typec *qcom_usb = platform_get_drvdata(pdev); - - usb_role_switch_set_role(qcom_usb->role_sw, USB_ROLE_NONE); - qcom_pmic_typec_enable_vbus_regulator(qcom_usb, 0); - - typec_unregister_port(qcom_usb->port); - usb_role_switch_put(qcom_usb->role_sw); - - return 0; -} - -static const struct of_device_id qcom_pmic_typec_table[] = { - { .compatible = "qcom,pm8150b-usb-typec" }, - { } -}; -MODULE_DEVICE_TABLE(of, qcom_pmic_typec_table); - -static struct platform_driver qcom_pmic_typec = { - .driver = { - .name = "qcom,pmic-typec", - .of_match_table = qcom_pmic_typec_table, - }, - .probe = qcom_pmic_typec_probe, - .remove = qcom_pmic_typec_remove, -}; -module_platform_driver(qcom_pmic_typec); - -MODULE_DESCRIPTION("QCOM PMIC USB type C driver"); -MODULE_LICENSE("GPL v2"); diff --git a/drivers/usb/typec/tcpm/Kconfig b/drivers/usb/typec/tcpm/Kconfig index e6b88ca4a4b94..5d393f520fc2f 100644 --- a/drivers/usb/typec/tcpm/Kconfig +++ b/drivers/usb/typec/tcpm/Kconfig @@ -76,4 +76,15 @@ config TYPEC_WCOVE To compile this driver as module, choose M here: the module will be called typec_wcove.ko +config TYPEC_QCOM_PMIC + tristate "Qualcomm PMIC USB Type-C Port Controller Manager driver" + depends on ARCH_QCOM || COMPILE_TEST + help + A Type-C port and Power Delivery driver which aggregates two + discrete pieces of silicon in the PM8150b PMIC block: the + Type-C port controller and the Power Delivery PHY. + + This driver enables Type-C role switching, orientation, Alternate + mode and Power Delivery support both for VBUS and VCONN. + endif # TYPEC_TCPM diff --git a/drivers/usb/typec/tcpm/Makefile b/drivers/usb/typec/tcpm/Makefile index 08e57bb499cbc..7a8cad0c0bdb4 100644 --- a/drivers/usb/typec/tcpm/Makefile +++ b/drivers/usb/typec/tcpm/Makefile @@ -9,3 +9,4 @@ obj-$(CONFIG_TYPEC_MT6360) += tcpci_mt6360.o obj-$(CONFIG_TYPEC_TCPCI_MT6370) += tcpci_mt6370.o obj-$(CONFIG_TYPEC_TCPCI_MAXIM) += tcpci_maxim.o tcpci_maxim-y += tcpci_maxim_core.o maxim_contaminant.o +obj-$(CONFIG_TYPEC_QCOM_PMIC) += qcom/ diff --git a/drivers/usb/typec/tcpm/qcom/Makefile b/drivers/usb/typec/tcpm/qcom/Makefile new file mode 100644 index 0000000000000..e78458292e0cf --- /dev/null +++ b/drivers/usb/typec/tcpm/qcom/Makefile @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0 +# +obj-$(CONFIG_TYPEC_QCOM_PMIC) += qcom_pmic_tcpm.o +qcom_pmic_tcpm-y += qcom_pmic_virt_tcpm.o \ + qcom_pmic_typec.o \ + qcom_pmic_pdphy.o diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_pdphy.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_pdphy.c new file mode 100644 index 0000000000000..746f6a79fc315 --- /dev/null +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_pdphy.c @@ -0,0 +1,605 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2023, Linaro Ltd. All rights reserved. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "qcom_pmic_pdphy.h" + +#define PMIC_PDPHY_MAX_IRQS 0x08 + +struct pmic_pdphy_irq_params { + int virq; + char *irq_name; +}; + +struct pmic_pdphy_resources { + unsigned int nr_irqs; + struct pmic_pdphy_irq_params irq_params[PMIC_PDPHY_MAX_IRQS]; +}; + +struct pmic_pdphy_irq_data { + int virq; + int irq; + struct pmic_pdphy *pmic_pdphy; +}; + +struct pmic_pdphy { + struct device *dev; + struct tcpm_port *tcpm_port; + struct regmap *regmap; + u32 base; + + unsigned int nr_irqs; + struct pmic_pdphy_irq_data *irq_data; + + struct work_struct reset_work; + struct work_struct receive_work; + struct regulator *vdd_pdphy; + spinlock_t lock; /* Register atomicity */ +}; + +static void qcom_pmic_pdphy_reset_on(struct pmic_pdphy *pmic_pdphy) +{ + struct device *dev = pmic_pdphy->dev; + int ret; + + /* Terminate TX */ + ret = regmap_write(pmic_pdphy->regmap, + pmic_pdphy->base + USB_PDPHY_TX_CONTROL_REG, 0); + if (ret) + goto err; + + ret = regmap_write(pmic_pdphy->regmap, + pmic_pdphy->base + USB_PDPHY_FRAME_FILTER_REG, 0); + if (ret) + goto err; + + return; +err: + dev_err(dev, "pd_reset_on error\n"); +} + +static void qcom_pmic_pdphy_reset_off(struct pmic_pdphy *pmic_pdphy) +{ + struct device *dev = pmic_pdphy->dev; + int ret; + + ret = regmap_write(pmic_pdphy->regmap, + pmic_pdphy->base + USB_PDPHY_FRAME_FILTER_REG, + FRAME_FILTER_EN_SOP | FRAME_FILTER_EN_HARD_RESET); + if (ret) + dev_err(dev, "pd_reset_off error\n"); +} + +static void qcom_pmic_pdphy_sig_reset_work(struct work_struct *work) +{ + struct pmic_pdphy *pmic_pdphy = container_of(work, struct pmic_pdphy, + reset_work); + unsigned long flags; + + spin_lock_irqsave(&pmic_pdphy->lock, flags); + + qcom_pmic_pdphy_reset_on(pmic_pdphy); + qcom_pmic_pdphy_reset_off(pmic_pdphy); + + spin_unlock_irqrestore(&pmic_pdphy->lock, flags); + + tcpm_pd_hard_reset(pmic_pdphy->tcpm_port); +} + +static int +qcom_pmic_pdphy_clear_tx_control_reg(struct pmic_pdphy *pmic_pdphy) +{ + struct device *dev = pmic_pdphy->dev; + unsigned int val; + int ret; + + /* Clear TX control register */ + ret = regmap_write(pmic_pdphy->regmap, + pmic_pdphy->base + USB_PDPHY_TX_CONTROL_REG, 0); + if (ret) + goto done; + + /* Perform readback to ensure sufficient delay for command to latch */ + ret = regmap_read(pmic_pdphy->regmap, + pmic_pdphy->base + USB_PDPHY_TX_CONTROL_REG, &val); + +done: + if (ret) + dev_err(dev, "pd_clear_tx_control_reg: clear tx flag\n"); + + return ret; +} + +static int +qcom_pmic_pdphy_pd_transmit_signal(struct pmic_pdphy *pmic_pdphy, + enum tcpm_transmit_type type, + unsigned int negotiated_rev) +{ + struct device *dev = pmic_pdphy->dev; + unsigned int val; + unsigned long flags; + int ret; + + spin_lock_irqsave(&pmic_pdphy->lock, flags); + + /* Clear TX control register */ + ret = qcom_pmic_pdphy_clear_tx_control_reg(pmic_pdphy); + if (ret) + goto done; + + val = TX_CONTROL_SEND_SIGNAL; + if (negotiated_rev == PD_REV30) + val |= TX_CONTROL_RETRY_COUNT(2); + else + val |= TX_CONTROL_RETRY_COUNT(3); + + if (type == TCPC_TX_CABLE_RESET || type == TCPC_TX_HARD_RESET) + val |= TX_CONTROL_FRAME_TYPE(1); + + ret = regmap_write(pmic_pdphy->regmap, + pmic_pdphy->base + USB_PDPHY_TX_CONTROL_REG, val); + +done: + spin_unlock_irqrestore(&pmic_pdphy->lock, flags); + + dev_vdbg(dev, "pd_transmit_signal: type %d negotiate_rev %d send %d\n", + type, negotiated_rev, ret); + + return ret; +} + +static int +qcom_pmic_pdphy_pd_transmit_payload(struct pmic_pdphy *pmic_pdphy, + enum tcpm_transmit_type type, + const struct pd_message *msg, + unsigned int negotiated_rev) +{ + struct device *dev = pmic_pdphy->dev; + unsigned int val, hdr_len, txbuf_len, txsize_len; + unsigned long flags; + int ret; + + spin_lock_irqsave(&pmic_pdphy->lock, flags); + + ret = regmap_read(pmic_pdphy->regmap, + pmic_pdphy->base + USB_PDPHY_RX_ACKNOWLEDGE_REG, + &val); + if (ret) + goto done; + + if (val) { + dev_err(dev, "pd_transmit_payload: RX message pending\n"); + ret = -EBUSY; + goto done; + } + + /* Clear TX control register */ + ret = qcom_pmic_pdphy_clear_tx_control_reg(pmic_pdphy); + if (ret) + goto done; + + hdr_len = sizeof(msg->header); + txbuf_len = pd_header_cnt_le(msg->header) * 4; + txsize_len = hdr_len + txbuf_len - 1; + + /* Write message header sizeof(u16) to USB_PDPHY_TX_BUFFER_HDR_REG */ + ret = regmap_bulk_write(pmic_pdphy->regmap, + pmic_pdphy->base + USB_PDPHY_TX_BUFFER_HDR_REG, + &msg->header, hdr_len); + if (ret) + goto done; + + /* Write payload to USB_PDPHY_TX_BUFFER_DATA_REG for txbuf_len */ + if (txbuf_len) { + ret = regmap_bulk_write(pmic_pdphy->regmap, + pmic_pdphy->base + USB_PDPHY_TX_BUFFER_DATA_REG, + &msg->payload, txbuf_len); + if (ret) + goto done; + } + + /* Write total length ((header + data) - 1) to USB_PDPHY_TX_SIZE_REG */ + ret = regmap_write(pmic_pdphy->regmap, + pmic_pdphy->base + USB_PDPHY_TX_SIZE_REG, + txsize_len); + if (ret) + goto done; + + /* Clear TX control register */ + ret = qcom_pmic_pdphy_clear_tx_control_reg(pmic_pdphy); + if (ret) + goto done; + + /* Initiate transmit with retry count as indicated by PD revision */ + val = TX_CONTROL_FRAME_TYPE(type) | TX_CONTROL_SEND_MSG; + if (pd_header_rev(msg->header) == PD_REV30) + val |= TX_CONTROL_RETRY_COUNT(2); + else + val |= TX_CONTROL_RETRY_COUNT(3); + + ret = regmap_write(pmic_pdphy->regmap, + pmic_pdphy->base + USB_PDPHY_TX_CONTROL_REG, val); + +done: + spin_unlock_irqrestore(&pmic_pdphy->lock, flags); + + if (ret) { + dev_err(dev, "pd_transmit_payload: %d hdr %*ph data %*ph ret %d\n", + ret, hdr_len, &msg->header, txbuf_len, &msg->payload, ret); + } + + return ret; +} + +int qcom_pmic_pdphy_pd_transmit(struct pmic_pdphy *pmic_pdphy, + enum tcpm_transmit_type type, + const struct pd_message *msg, + unsigned int negotiated_rev) +{ + struct device *dev = pmic_pdphy->dev; + int ret; + + if (msg) { + ret = qcom_pmic_pdphy_pd_transmit_payload(pmic_pdphy, type, msg, + negotiated_rev); + } else { + ret = qcom_pmic_pdphy_pd_transmit_signal(pmic_pdphy, type, + negotiated_rev); + } + + if (ret) + dev_dbg(dev, "pd_transmit: type %x result %d\n", type, ret); + + return ret; +} + +static void qcom_pmic_pdphy_pd_receive(struct pmic_pdphy *pmic_pdphy) +{ + struct device *dev = pmic_pdphy->dev; + struct pd_message msg; + unsigned int size, rx_status; + unsigned long flags; + int ret; + + spin_lock_irqsave(&pmic_pdphy->lock, flags); + + ret = regmap_read(pmic_pdphy->regmap, + pmic_pdphy->base + USB_PDPHY_RX_SIZE_REG, &size); + if (ret) + goto done; + + /* If we received a subsequent RX sig this value can be zero */ + if ((size < 1 || size > sizeof(msg.payload))) { + dev_dbg(dev, "pd_receive: invalid size %d\n", size); + goto done; + } + + size += 1; + ret = regmap_read(pmic_pdphy->regmap, + pmic_pdphy->base + USB_PDPHY_RX_STATUS_REG, + &rx_status); + + if (ret) + goto done; + + ret = regmap_bulk_read(pmic_pdphy->regmap, + pmic_pdphy->base + USB_PDPHY_RX_BUFFER_REG, + (u8 *)&msg, size); + if (ret) + goto done; + + /* Return ownership of RX buffer to hardware */ + ret = regmap_write(pmic_pdphy->regmap, + pmic_pdphy->base + USB_PDPHY_RX_ACKNOWLEDGE_REG, 0); + +done: + spin_unlock_irqrestore(&pmic_pdphy->lock, flags); + + if (!ret) { + dev_vdbg(dev, "pd_receive: handing %d bytes to tcpm\n", size); + tcpm_pd_receive(pmic_pdphy->tcpm_port, &msg); + } +} + +static irqreturn_t qcom_pmic_pdphy_isr(int irq, void *dev_id) +{ + struct pmic_pdphy_irq_data *irq_data = dev_id; + struct pmic_pdphy *pmic_pdphy = irq_data->pmic_pdphy; + struct device *dev = pmic_pdphy->dev; + + switch (irq_data->virq) { + case PMIC_PDPHY_SIG_TX_IRQ: + dev_err(dev, "isr: tx_sig\n"); + break; + case PMIC_PDPHY_SIG_RX_IRQ: + schedule_work(&pmic_pdphy->reset_work); + break; + case PMIC_PDPHY_MSG_TX_IRQ: + tcpm_pd_transmit_complete(pmic_pdphy->tcpm_port, + TCPC_TX_SUCCESS); + break; + case PMIC_PDPHY_MSG_RX_IRQ: + qcom_pmic_pdphy_pd_receive(pmic_pdphy); + break; + case PMIC_PDPHY_MSG_TX_FAIL_IRQ: + tcpm_pd_transmit_complete(pmic_pdphy->tcpm_port, + TCPC_TX_FAILED); + break; + case PMIC_PDPHY_MSG_TX_DISCARD_IRQ: + tcpm_pd_transmit_complete(pmic_pdphy->tcpm_port, + TCPC_TX_DISCARDED); + break; + } + + return IRQ_HANDLED; +} + +int qcom_pmic_pdphy_set_pd_rx(struct pmic_pdphy *pmic_pdphy, bool on) +{ + unsigned long flags; + int ret; + + spin_lock_irqsave(&pmic_pdphy->lock, flags); + + ret = regmap_write(pmic_pdphy->regmap, + pmic_pdphy->base + USB_PDPHY_RX_ACKNOWLEDGE_REG, !on); + + spin_unlock_irqrestore(&pmic_pdphy->lock, flags); + + dev_dbg(pmic_pdphy->dev, "set_pd_rx: %s\n", on ? "on" : "off"); + + return ret; +} + +int qcom_pmic_pdphy_set_roles(struct pmic_pdphy *pmic_pdphy, + bool data_role_host, bool power_role_src) +{ + struct device *dev = pmic_pdphy->dev; + unsigned long flags; + int ret; + + spin_lock_irqsave(&pmic_pdphy->lock, flags); + + ret = regmap_update_bits(pmic_pdphy->regmap, + pmic_pdphy->base + USB_PDPHY_MSG_CONFIG_REG, + MSG_CONFIG_PORT_DATA_ROLE | + MSG_CONFIG_PORT_POWER_ROLE, + data_role_host << 3 | power_role_src << 2); + + spin_unlock_irqrestore(&pmic_pdphy->lock, flags); + + dev_dbg(dev, "pdphy_set_roles: data_role_host=%d power_role_src=%d\n", + data_role_host, power_role_src); + + return ret; +} + +static int qcom_pmic_pdphy_enable(struct pmic_pdphy *pmic_pdphy) +{ + struct device *dev = pmic_pdphy->dev; + int ret; + + ret = regulator_enable(pmic_pdphy->vdd_pdphy); + if (ret) + return ret; + + /* PD 2.0, DR=TYPEC_DEVICE, PR=TYPEC_SINK */ + ret = regmap_update_bits(pmic_pdphy->regmap, + pmic_pdphy->base + USB_PDPHY_MSG_CONFIG_REG, + MSG_CONFIG_SPEC_REV_MASK, PD_REV20); + if (ret) + goto done; + + ret = regmap_write(pmic_pdphy->regmap, + pmic_pdphy->base + USB_PDPHY_EN_CONTROL_REG, 0); + if (ret) + goto done; + + ret = regmap_write(pmic_pdphy->regmap, + pmic_pdphy->base + USB_PDPHY_EN_CONTROL_REG, + CONTROL_ENABLE); + if (ret) + goto done; + + qcom_pmic_pdphy_reset_off(pmic_pdphy); +done: + if (ret) { + regulator_disable(pmic_pdphy->vdd_pdphy); + dev_err(dev, "pdphy_enable fail %d\n", ret); + } + + return ret; +} + +static int qcom_pmic_pdphy_disable(struct pmic_pdphy *pmic_pdphy) +{ + int ret; + + qcom_pmic_pdphy_reset_on(pmic_pdphy); + + ret = regmap_write(pmic_pdphy->regmap, + pmic_pdphy->base + USB_PDPHY_EN_CONTROL_REG, 0); + + regulator_disable(pmic_pdphy->vdd_pdphy); + + return ret; +} + +static int pmic_pdphy_reset(struct pmic_pdphy *pmic_pdphy) +{ + int ret; + + ret = qcom_pmic_pdphy_disable(pmic_pdphy); + if (ret) + goto done; + + usleep_range(400, 500); + ret = qcom_pmic_pdphy_enable(pmic_pdphy); +done: + return ret; +} + +int qcom_pmic_pdphy_init(struct pmic_pdphy *pmic_pdphy, + struct tcpm_port *tcpm_port) +{ + int i; + int ret; + + pmic_pdphy->tcpm_port = tcpm_port; + + ret = pmic_pdphy_reset(pmic_pdphy); + if (ret) + return ret; + + for (i = 0; i < pmic_pdphy->nr_irqs; i++) + enable_irq(pmic_pdphy->irq_data[i].irq); + + return 0; +} + +void qcom_pmic_pdphy_put(struct pmic_pdphy *pmic_pdphy) +{ + put_device(pmic_pdphy->dev); +} + +static int qcom_pmic_pdphy_probe(struct platform_device *pdev) +{ + struct pmic_pdphy *pmic_pdphy; + struct device *dev = &pdev->dev; + const struct pmic_pdphy_resources *res; + struct pmic_pdphy_irq_data *irq_data; + int i, ret, irq; + u32 reg; + + ret = device_property_read_u32(dev, "reg", ®); + if (ret < 0) { + dev_err(dev, "missing base address\n"); + return ret; + } + + res = of_device_get_match_data(dev); + if (!res) + return -ENODEV; + + if (!res->nr_irqs || res->nr_irqs > PMIC_PDPHY_MAX_IRQS) + return -EINVAL; + + pmic_pdphy = devm_kzalloc(dev, sizeof(*pmic_pdphy), GFP_KERNEL); + if (!pmic_pdphy) + return -ENOMEM; + + irq_data = devm_kzalloc(dev, sizeof(*irq_data) * res->nr_irqs, + GFP_KERNEL); + if (!irq_data) + return -ENOMEM; + + pmic_pdphy->vdd_pdphy = devm_regulator_get(dev, "vdd-pdphy"); + if (IS_ERR(pmic_pdphy->vdd_pdphy)) + return PTR_ERR(pmic_pdphy->vdd_pdphy); + + pmic_pdphy->dev = dev; + pmic_pdphy->base = reg; + pmic_pdphy->nr_irqs = res->nr_irqs; + pmic_pdphy->irq_data = irq_data; + spin_lock_init(&pmic_pdphy->lock); + INIT_WORK(&pmic_pdphy->reset_work, qcom_pmic_pdphy_sig_reset_work); + + pmic_pdphy->regmap = dev_get_regmap(dev->parent, NULL); + if (!pmic_pdphy->regmap) { + dev_err(dev, "Failed to get regmap\n"); + return -ENODEV; + } + + platform_set_drvdata(pdev, pmic_pdphy); + for (i = 0; i < res->nr_irqs; i++, irq_data++) { + irq = platform_get_irq_byname(pdev, res->irq_params[i].irq_name); + if (irq < 0) + return irq; + + irq_data->pmic_pdphy = pmic_pdphy; + irq_data->irq = irq; + irq_data->virq = res->irq_params[i].virq; + + ret = devm_request_threaded_irq(dev, irq, NULL, + qcom_pmic_pdphy_isr, + IRQF_ONESHOT | IRQF_NO_AUTOEN, + res->irq_params[i].irq_name, + irq_data); + if (ret) + return ret; + } + return 0; +} + +static int qcom_pmic_pdphy_remove(struct platform_device *pdev) +{ + struct pmic_pdphy *pmic_pdphy = platform_get_drvdata(pdev); + + qcom_pmic_pdphy_reset_on(pmic_pdphy); + + return 0; +} + +static struct pmic_pdphy_resources pm8150b_pdphy_res = { + .irq_params = { + { + .virq = PMIC_PDPHY_SIG_TX_IRQ, + .irq_name = "sig-tx", + }, + { + .virq = PMIC_PDPHY_SIG_RX_IRQ, + .irq_name = "sig-rx", + }, + { + .virq = PMIC_PDPHY_MSG_TX_IRQ, + .irq_name = "msg-tx", + }, + { + .virq = PMIC_PDPHY_MSG_RX_IRQ, + .irq_name = "msg-rx", + }, + { + .virq = PMIC_PDPHY_MSG_TX_FAIL_IRQ, + .irq_name = "msg-tx-failed", + }, + { + .virq = PMIC_PDPHY_MSG_TX_DISCARD_IRQ, + .irq_name = "msg-tx-discarded", + }, + { + .virq = PMIC_PDPHY_MSG_RX_DISCARD_IRQ, + .irq_name = "msg-rx-discarded", + }, + }, + .nr_irqs = 7, +}; + +static const struct of_device_id qcom_pmic_pdphy_table[] = { + { .compatible = "qcom,pm8150b-pdphy", .data = &pm8150b_pdphy_res }, + { }, +}; +MODULE_DEVICE_TABLE(of, qcom_pmic_pdphy_table); + +struct platform_driver qcom_pmic_pdphy_platform_driver = { + .driver = { + .name = "qcom,pmic-usb-pdphy", + .of_match_table = qcom_pmic_pdphy_table, + }, + .probe = qcom_pmic_pdphy_probe, + .remove = qcom_pmic_pdphy_remove, +}; diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_pdphy.h b/drivers/usb/typec/tcpm/qcom/qcom_pmic_pdphy.h new file mode 100644 index 0000000000000..ac64139d4fe93 --- /dev/null +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_pdphy.h @@ -0,0 +1,85 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2023, Linaro Ltd. All rights reserved. + */ +#ifndef __QCOM_PMIC_PDPHY_H__ +#define __QCOM_PMIC_PDPHY_H__ + +#define USB_PDPHY_MAX_DATA_OBJ_LEN 28 +#define USB_PDPHY_MSG_HDR_LEN 2 + +/* PD PHY register offsets and bit fields */ +#define USB_PDPHY_MSG_CONFIG_REG 0x40 +#define MSG_CONFIG_PORT_DATA_ROLE BIT(3) +#define MSG_CONFIG_PORT_POWER_ROLE BIT(2) +#define MSG_CONFIG_SPEC_REV_MASK (BIT(1) | BIT(0)) + +#define USB_PDPHY_EN_CONTROL_REG 0x46 +#define CONTROL_ENABLE BIT(0) + +#define USB_PDPHY_RX_STATUS_REG 0x4A +#define RX_FRAME_TYPE (BIT(0) | BIT(1) | BIT(2)) + +#define USB_PDPHY_FRAME_FILTER_REG 0x4C +#define FRAME_FILTER_EN_HARD_RESET BIT(5) +#define FRAME_FILTER_EN_SOP BIT(0) + +#define USB_PDPHY_TX_SIZE_REG 0x42 +#define TX_SIZE_MASK 0xF + +#define USB_PDPHY_TX_CONTROL_REG 0x44 +#define TX_CONTROL_RETRY_COUNT(n) (((n) & 0x3) << 5) +#define TX_CONTROL_FRAME_TYPE(n) (((n) & 0x7) << 2) +#define TX_CONTROL_FRAME_TYPE_CABLE_RESET (0x1 << 2) +#define TX_CONTROL_SEND_SIGNAL BIT(1) +#define TX_CONTROL_SEND_MSG BIT(0) + +#define USB_PDPHY_RX_SIZE_REG 0x48 + +#define USB_PDPHY_RX_ACKNOWLEDGE_REG 0x4B +#define RX_BUFFER_TOKEN BIT(0) + +#define USB_PDPHY_BIST_MODE_REG 0x4E +#define BIST_MODE_MASK 0xF +#define BIST_ENABLE BIT(7) +#define PD_MSG_BIST 0x3 +#define PD_BIST_TEST_DATA_MODE 0x8 + +#define USB_PDPHY_TX_BUFFER_HDR_REG 0x60 +#define USB_PDPHY_TX_BUFFER_DATA_REG 0x62 + +#define USB_PDPHY_RX_BUFFER_REG 0x80 + +/* VDD regulator */ +#define VDD_PDPHY_VOL_MIN 2800000 /* uV */ +#define VDD_PDPHY_VOL_MAX 3300000 /* uV */ +#define VDD_PDPHY_HPM_LOAD 3000 /* uA */ + +/* Message Spec Rev field */ +#define PD_MSG_HDR_REV(hdr) (((hdr) >> 6) & 3) + +/* timers */ +#define RECEIVER_RESPONSE_TIME 15 /* tReceiverResponse */ +#define HARD_RESET_COMPLETE_TIME 5 /* tHardResetComplete */ + +struct pmic_pdphy; +extern struct platform_driver qcom_pmic_pdphy_platform_driver; + +int qcom_pmic_pdphy_init(struct pmic_pdphy *pmic_pdphy, + struct tcpm_port *tcpm_port); + +void qcom_pmic_pdphy_put(struct pmic_pdphy *pmic_pdphy); + +int qcom_pmic_pdphy_set_roles(struct pmic_pdphy *pmic_pdphy, + bool power_role_src, + bool data_role_host); + +int qcom_pmic_pdphy_set_pd_rx(struct pmic_pdphy *pmic_pdphy, bool on); + +int qcom_pmic_pdphy_pd_transmit(struct pmic_pdphy *pmic_pdphy, + enum tcpm_transmit_type type, + const struct pd_message *msg, + unsigned int negotiated_rev); + +#endif /* __QCOM_PMIC_PDPHY_H__ */ diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c new file mode 100644 index 0000000000000..7b6f6100af949 --- /dev/null +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c @@ -0,0 +1,637 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2023, Linaro Ltd. All rights reserved. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "qcom_pmic_typec.h" + +#define PMIC_TYPEC_MAX_IRQS 0x08 + +struct pmic_typec_irq_params { + int virq; + char *irq_name; +}; + +struct pmic_typec_resources { + unsigned int nr_irqs; + struct pmic_typec_irq_params irq_params[PMIC_TYPEC_MAX_IRQS]; +}; + +struct pmic_typec_irq_data { + int virq; + int irq; + struct pmic_typec *pmic_typec; +}; + +struct pmic_typec { + struct device *dev; + struct tcpm_port *tcpm_port; + struct regmap *regmap; + u32 base; + unsigned int nr_irqs; + struct pmic_typec_irq_data *irq_data; + + struct regulator *vdd_vbus; + + int cc; + bool debouncing_cc; + struct delayed_work cc_debounce_dwork; + + spinlock_t lock; /* Register atomicity */ +}; + +static const char * const typec_cc_status_name[] = { + [TYPEC_CC_OPEN] = "Open", + [TYPEC_CC_RA] = "Ra", + [TYPEC_CC_RD] = "Rd", + [TYPEC_CC_RP_DEF] = "Rp-def", + [TYPEC_CC_RP_1_5] = "Rp-1.5", + [TYPEC_CC_RP_3_0] = "Rp-3.0", +}; + +static const char *rp_unknown = "unknown"; + +static const char *cc_to_name(enum typec_cc_status cc) +{ + if (cc > TYPEC_CC_RP_3_0) + return rp_unknown; + + return typec_cc_status_name[cc]; +} + +static const char * const rp_sel_name[] = { + [TYPEC_SRC_RP_SEL_80UA] = "Rp-def-80uA", + [TYPEC_SRC_RP_SEL_180UA] = "Rp-1.5-180uA", + [TYPEC_SRC_RP_SEL_330UA] = "Rp-3.0-330uA", +}; + +static const char *rp_sel_to_name(int rp_sel) +{ + if (rp_sel > TYPEC_SRC_RP_SEL_330UA) + return rp_unknown; + + return rp_sel_name[rp_sel]; +} + +#define misc_to_cc(msic) !!(misc & CC_ORIENTATION) ? "cc1" : "cc2" +#define misc_to_vconn(msic) !!(misc & CC_ORIENTATION) ? "cc2" : "cc1" + +static void qcom_pmic_typec_cc_debounce(struct work_struct *work) +{ + struct pmic_typec *pmic_typec = + container_of(work, struct pmic_typec, cc_debounce_dwork.work); + unsigned long flags; + + spin_lock_irqsave(&pmic_typec->lock, flags); + pmic_typec->debouncing_cc = false; + spin_unlock_irqrestore(&pmic_typec->lock, flags); + + dev_dbg(pmic_typec->dev, "Debounce cc complete\n"); +} + +static irqreturn_t pmic_typec_isr(int irq, void *dev_id) +{ + struct pmic_typec_irq_data *irq_data = dev_id; + struct pmic_typec *pmic_typec = irq_data->pmic_typec; + u32 misc_stat; + bool vbus_change = false; + bool cc_change = false; + unsigned long flags; + int ret; + + spin_lock_irqsave(&pmic_typec->lock, flags); + + ret = regmap_read(pmic_typec->regmap, + pmic_typec->base + TYPEC_MISC_STATUS_REG, + &misc_stat); + if (ret) + goto done; + + switch (irq_data->virq) { + case PMIC_TYPEC_VBUS_IRQ: + /* Incoming vbus assert/de-assert detect */ + vbus_change = true; + break; + case PMIC_TYPEC_CC_STATE_IRQ: + if (!pmic_typec->debouncing_cc) + cc_change = true; + break; + case PMIC_TYPEC_ATTACH_DETACH_IRQ: + if (!pmic_typec->debouncing_cc) + cc_change = true; + break; + } + +done: + spin_unlock_irqrestore(&pmic_typec->lock, flags); + + if (vbus_change) + tcpm_vbus_change(pmic_typec->tcpm_port); + + if (cc_change) + tcpm_cc_change(pmic_typec->tcpm_port); + + return IRQ_HANDLED; +} + +int qcom_pmic_typec_get_vbus(struct pmic_typec *pmic_typec) +{ + struct device *dev = pmic_typec->dev; + unsigned int misc; + int ret; + + ret = regmap_read(pmic_typec->regmap, + pmic_typec->base + TYPEC_MISC_STATUS_REG, + &misc); + if (ret) + misc = 0; + + dev_dbg(dev, "get_vbus: 0x%08x detect %d\n", misc, !!(misc & TYPEC_VBUS_DETECT)); + + return !!(misc & TYPEC_VBUS_DETECT); +} + +int qcom_pmic_typec_set_vbus(struct pmic_typec *pmic_typec, bool on) +{ + u32 sm_stat; + u32 val; + int ret; + + if (on) { + ret = regulator_enable(pmic_typec->vdd_vbus); + if (ret) + return ret; + + val = TYPEC_SM_VBUS_VSAFE5V; + } else { + ret = regulator_disable(pmic_typec->vdd_vbus); + if (ret) + return ret; + + val = TYPEC_SM_VBUS_VSAFE0V; + } + + /* Poll waiting for transition to required vSafe5V or vSafe0V */ + ret = regmap_read_poll_timeout(pmic_typec->regmap, + pmic_typec->base + TYPEC_SM_STATUS_REG, + sm_stat, sm_stat & val, + 100, 250000); + if (ret) + dev_err(pmic_typec->dev, "vbus vsafe%dv fail\n", on ? 5 : 0); + + return ret; +} + +int qcom_pmic_typec_get_cc(struct pmic_typec *pmic_typec, + enum typec_cc_status *cc1, + enum typec_cc_status *cc2) +{ + struct device *dev = pmic_typec->dev; + unsigned int misc, val; + bool attached; + int ret = 0; + + ret = regmap_read(pmic_typec->regmap, + pmic_typec->base + TYPEC_MISC_STATUS_REG, &misc); + if (ret) + goto done; + + attached = !!(misc & CC_ATTACHED); + + if (pmic_typec->debouncing_cc) { + ret = -EBUSY; + goto done; + } + + *cc1 = TYPEC_CC_OPEN; + *cc2 = TYPEC_CC_OPEN; + + if (!(attached)) + goto done; + + if (misc & SNK_SRC_MODE) { + ret = regmap_read(pmic_typec->regmap, + pmic_typec->base + TYPEC_SRC_STATUS_REG, + &val); + if (ret) + goto done; + switch (val & DETECTED_SRC_TYPE_MASK) { + case SRC_RD_OPEN: + val = TYPEC_CC_RD; + break; + case SRC_RD_RA_VCONN: + val = TYPEC_CC_RD; + *cc1 = TYPEC_CC_RA; + *cc2 = TYPEC_CC_RA; + break; + default: + dev_warn(dev, "unexpected src status %.2x\n", val); + val = TYPEC_CC_RD; + break; + } + } else { + ret = regmap_read(pmic_typec->regmap, + pmic_typec->base + TYPEC_SNK_STATUS_REG, + &val); + if (ret) + goto done; + switch (val & DETECTED_SNK_TYPE_MASK) { + case SNK_RP_STD: + val = TYPEC_CC_RP_DEF; + break; + case SNK_RP_1P5: + val = TYPEC_CC_RP_1_5; + break; + case SNK_RP_3P0: + val = TYPEC_CC_RP_3_0; + break; + default: + dev_warn(dev, "unexpected snk status %.2x\n", val); + val = TYPEC_CC_RP_DEF; + break; + } + val = TYPEC_CC_RP_DEF; + } + + if (misc & CC_ORIENTATION) + *cc2 = val; + else + *cc1 = val; + +done: + dev_dbg(dev, "get_cc: misc 0x%08x cc1 0x%08x %s cc2 0x%08x %s attached %d cc=%s\n", + misc, *cc1, cc_to_name(*cc1), *cc2, cc_to_name(*cc2), attached, + misc_to_cc(misc)); + + return ret; +} + +static void qcom_pmic_set_cc_debounce(struct pmic_typec *pmic_typec) +{ + pmic_typec->debouncing_cc = true; + schedule_delayed_work(&pmic_typec->cc_debounce_dwork, + msecs_to_jiffies(2)); +} + +int qcom_pmic_typec_set_cc(struct pmic_typec *pmic_typec, + enum typec_cc_status cc) +{ + struct device *dev = pmic_typec->dev; + unsigned int mode, currsrc; + unsigned int misc; + unsigned long flags; + int ret; + + spin_lock_irqsave(&pmic_typec->lock, flags); + + ret = regmap_read(pmic_typec->regmap, + pmic_typec->base + TYPEC_MISC_STATUS_REG, + &misc); + if (ret) + goto done; + + mode = EN_SRC_ONLY; + + switch (cc) { + case TYPEC_CC_OPEN: + currsrc = TYPEC_SRC_RP_SEL_80UA; + break; + case TYPEC_CC_RP_DEF: + currsrc = TYPEC_SRC_RP_SEL_80UA; + break; + case TYPEC_CC_RP_1_5: + currsrc = TYPEC_SRC_RP_SEL_180UA; + break; + case TYPEC_CC_RP_3_0: + currsrc = TYPEC_SRC_RP_SEL_330UA; + break; + case TYPEC_CC_RD: + currsrc = TYPEC_SRC_RP_SEL_80UA; + mode = EN_SNK_ONLY; + break; + default: + dev_warn(dev, "unexpected set_cc %d\n", cc); + ret = -EINVAL; + goto done; + } + + if (mode == EN_SRC_ONLY) { + ret = regmap_write(pmic_typec->regmap, + pmic_typec->base + TYPEC_CURRSRC_CFG_REG, + currsrc); + if (ret) + goto done; + } + + pmic_typec->cc = cc; + qcom_pmic_set_cc_debounce(pmic_typec); + ret = 0; + +done: + spin_unlock_irqrestore(&pmic_typec->lock, flags); + + dev_dbg(dev, "set_cc: currsrc=%x %s mode %s debounce %d attached %d cc=%s\n", + currsrc, rp_sel_to_name(currsrc), + mode == EN_SRC_ONLY ? "EN_SRC_ONLY" : "EN_SNK_ONLY", + pmic_typec->debouncing_cc, !!(misc & CC_ATTACHED), + misc_to_cc(misc)); + + return ret; +} + +int qcom_pmic_typec_set_vconn(struct pmic_typec *pmic_typec, bool on) +{ + struct device *dev = pmic_typec->dev; + unsigned int orientation, misc, mask, value; + unsigned long flags; + int ret; + + spin_lock_irqsave(&pmic_typec->lock, flags); + + ret = regmap_read(pmic_typec->regmap, + pmic_typec->base + TYPEC_MISC_STATUS_REG, &misc); + if (ret) + goto done; + + /* Set VCONN on the inversion of the active CC channel */ + orientation = (misc & CC_ORIENTATION) ? 0 : VCONN_EN_ORIENTATION; + if (on) { + mask = VCONN_EN_ORIENTATION | VCONN_EN_VALUE; + value = orientation | VCONN_EN_VALUE | VCONN_EN_SRC; + } else { + mask = VCONN_EN_VALUE; + value = 0; + } + + ret = regmap_update_bits(pmic_typec->regmap, + pmic_typec->base + TYPEC_VCONN_CONTROL_REG, + mask, value); +done: + spin_unlock_irqrestore(&pmic_typec->lock, flags); + + dev_dbg(dev, "set_vconn: orientation %d control 0x%08x state %s cc %s vconn %s\n", + orientation, value, on ? "on" : "off", misc_to_vconn(misc), misc_to_cc(misc)); + + return ret; +} + +int qcom_pmic_typec_start_toggling(struct pmic_typec *pmic_typec, + enum typec_port_type port_type, + enum typec_cc_status cc) +{ + struct device *dev = pmic_typec->dev; + unsigned int misc; + u8 mode = 0; + unsigned long flags; + int ret; + + switch (port_type) { + case TYPEC_PORT_SRC: + mode = EN_SRC_ONLY; + break; + case TYPEC_PORT_SNK: + mode = EN_SNK_ONLY; + break; + case TYPEC_PORT_DRP: + mode = EN_TRY_SNK; + break; + } + + spin_lock_irqsave(&pmic_typec->lock, flags); + + ret = regmap_read(pmic_typec->regmap, + pmic_typec->base + TYPEC_MISC_STATUS_REG, &misc); + if (ret) + goto done; + + dev_dbg(dev, "start_toggling: misc 0x%08x attached %d port_type %d current cc %d new %d\n", + misc, !!(misc & CC_ATTACHED), port_type, pmic_typec->cc, cc); + + qcom_pmic_set_cc_debounce(pmic_typec); + + /* force it to toggle at least once */ + ret = regmap_write(pmic_typec->regmap, + pmic_typec->base + TYPEC_MODE_CFG_REG, + TYPEC_DISABLE_CMD); + if (ret) + goto done; + + ret = regmap_write(pmic_typec->regmap, + pmic_typec->base + TYPEC_MODE_CFG_REG, + mode); +done: + spin_unlock_irqrestore(&pmic_typec->lock, flags); + + return ret; +} + +#define TYPEC_INTR_EN_CFG_1_MASK \ + (TYPEC_LEGACY_CABLE_INT_EN | \ + TYPEC_NONCOMPLIANT_LEGACY_CABLE_INT_EN | \ + TYPEC_TRYSOURCE_DETECT_INT_EN | \ + TYPEC_TRYSINK_DETECT_INT_EN | \ + TYPEC_CCOUT_DETACH_INT_EN | \ + TYPEC_CCOUT_ATTACH_INT_EN | \ + TYPEC_VBUS_DEASSERT_INT_EN | \ + TYPEC_VBUS_ASSERT_INT_EN) + +#define TYPEC_INTR_EN_CFG_2_MASK \ + (TYPEC_STATE_MACHINE_CHANGE_INT_EN | TYPEC_VBUS_ERROR_INT_EN | \ + TYPEC_DEBOUNCE_DONE_INT_EN) + +int qcom_pmic_typec_init(struct pmic_typec *pmic_typec, + struct tcpm_port *tcpm_port) +{ + int i; + int mask; + int ret; + + /* Configure interrupt sources */ + ret = regmap_write(pmic_typec->regmap, + pmic_typec->base + TYPEC_INTERRUPT_EN_CFG_1_REG, + TYPEC_INTR_EN_CFG_1_MASK); + if (ret) + goto done; + + ret = regmap_write(pmic_typec->regmap, + pmic_typec->base + TYPEC_INTERRUPT_EN_CFG_2_REG, + TYPEC_INTR_EN_CFG_2_MASK); + if (ret) + goto done; + + /* start in TRY_SNK mode */ + ret = regmap_write(pmic_typec->regmap, + pmic_typec->base + TYPEC_MODE_CFG_REG, EN_TRY_SNK); + if (ret) + goto done; + + /* Configure VCONN for software control */ + ret = regmap_update_bits(pmic_typec->regmap, + pmic_typec->base + TYPEC_VCONN_CONTROL_REG, + VCONN_EN_SRC | VCONN_EN_VALUE, VCONN_EN_SRC); + if (ret) + goto done; + + /* Set CC threshold to 1.6 Volts | tPDdebounce = 10-20ms */ + mask = SEL_SRC_UPPER_REF | USE_TPD_FOR_EXITING_ATTACHSRC; + ret = regmap_update_bits(pmic_typec->regmap, + pmic_typec->base + TYPEC_EXIT_STATE_CFG_REG, + mask, mask); + if (ret) + goto done; + + pmic_typec->tcpm_port = tcpm_port; + + for (i = 0; i < pmic_typec->nr_irqs; i++) + enable_irq(pmic_typec->irq_data[i].irq); + +done: + return ret; +} + +void qcom_pmic_typec_put(struct pmic_typec *pmic_typec) +{ + put_device(pmic_typec->dev); +} + +static int qcom_pmic_typec_probe(struct platform_device *pdev) +{ + struct pmic_typec *pmic_typec; + struct device *dev = &pdev->dev; + const struct pmic_typec_resources *res; + struct pmic_typec_irq_data *irq_data; + int i, ret, irq; + u32 reg; + + ret = device_property_read_u32(dev, "reg", ®); + if (ret < 0) { + dev_err(dev, "missing base address\n"); + return ret; + } + + res = of_device_get_match_data(dev); + if (!res) + return -ENODEV; + + if (!res->nr_irqs || res->nr_irqs > PMIC_TYPEC_MAX_IRQS) + return -EINVAL; + + pmic_typec = devm_kzalloc(dev, sizeof(*pmic_typec), GFP_KERNEL); + if (!pmic_typec) + return -ENOMEM; + + irq_data = devm_kzalloc(dev, sizeof(*irq_data) * res->nr_irqs, + GFP_KERNEL); + if (!irq_data) + return -ENOMEM; + + pmic_typec->vdd_vbus = devm_regulator_get(dev, "vdd-vbus"); + if (IS_ERR(pmic_typec->vdd_vbus)) + return PTR_ERR(pmic_typec->vdd_vbus); + + pmic_typec->dev = dev; + pmic_typec->base = reg; + pmic_typec->nr_irqs = res->nr_irqs; + pmic_typec->irq_data = irq_data; + spin_lock_init(&pmic_typec->lock); + INIT_DELAYED_WORK(&pmic_typec->cc_debounce_dwork, + qcom_pmic_typec_cc_debounce); + + pmic_typec->regmap = dev_get_regmap(dev->parent, NULL); + if (!pmic_typec->regmap) { + dev_err(dev, "Failed to get regmap\n"); + return -ENODEV; + } + + irq = platform_get_irq(pdev, 0); + if (irq < 0) + return irq; + + platform_set_drvdata(pdev, pmic_typec); + + for (i = 0; i < res->nr_irqs; i++, irq_data++) { + irq = platform_get_irq_byname(pdev, + res->irq_params[i].irq_name); + if (irq < 0) + return irq; + + irq_data->pmic_typec = pmic_typec; + irq_data->irq = irq; + irq_data->virq = res->irq_params[i].virq; + ret = devm_request_threaded_irq(dev, irq, NULL, pmic_typec_isr, + IRQF_ONESHOT | IRQF_NO_AUTOEN, + res->irq_params[i].irq_name, + irq_data); + if (ret) + return ret; + } + + return 0; +} + +static struct pmic_typec_resources pm8150b_typec_res = { + .irq_params = { + { + .irq_name = "vpd-detect", + .virq = PMIC_TYPEC_VPD_IRQ, + }, + + { + .irq_name = "cc-state-change", + .virq = PMIC_TYPEC_CC_STATE_IRQ, + }, + { + .irq_name = "vconn-oc", + .virq = PMIC_TYPEC_VCONN_OC_IRQ, + }, + + { + .irq_name = "vbus-change", + .virq = PMIC_TYPEC_VBUS_IRQ, + }, + + { + .irq_name = "attach-detach", + .virq = PMIC_TYPEC_ATTACH_DETACH_IRQ, + }, + { + .irq_name = "legacy-cable-detect", + .virq = PMIC_TYPEC_LEGACY_CABLE_IRQ, + }, + + { + .irq_name = "try-snk-src-detect", + .virq = PMIC_TYPEC_TRY_SNK_SRC_IRQ, + }, + }, + .nr_irqs = 7, +}; + +static const struct of_device_id qcom_pmic_typec_table[] = { + { .compatible = "qcom,pm8150b-typec", .data = &pm8150b_typec_res }, + { }, +}; +MODULE_DEVICE_TABLE(of, qcom_pmic_typec_table); + +struct platform_driver qcom_pmic_typec_platform_driver = { + .driver = { + .name = "qcom,pmic-typec", + .of_match_table = qcom_pmic_typec_table, + }, + .probe = qcom_pmic_typec_probe, +}; diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.h b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.h new file mode 100644 index 0000000000000..1428325954795 --- /dev/null +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.h @@ -0,0 +1,163 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2023, Linaro Ltd. All rights reserved. + */ +#ifndef __QCOM_PMIC_TYPEC_H__ +#define __QCOM_PMIC_TYPEC_H__ + +#include + +#define TYPEC_SNK_STATUS_REG 0x06 +#define DETECTED_SNK_TYPE_MASK GENMASK(6, 0) +#define SNK_DAM_MASK GENMASK(6, 4) +#define SNK_DAM_500MA BIT(6) +#define SNK_DAM_1500MA BIT(5) +#define SNK_DAM_3000MA BIT(4) +#define SNK_RP_STD BIT(3) +#define SNK_RP_1P5 BIT(2) +#define SNK_RP_3P0 BIT(1) +#define SNK_RP_SHORT BIT(0) + +#define TYPEC_SRC_STATUS_REG 0x08 +#define DETECTED_SRC_TYPE_MASK GENMASK(4, 0) +#define SRC_HIGH_BATT BIT(5) +#define SRC_DEBUG_ACCESS BIT(4) +#define SRC_RD_OPEN BIT(3) +#define SRC_RD_RA_VCONN BIT(2) +#define SRC_RA_OPEN BIT(1) +#define AUDIO_ACCESS_RA_RA BIT(0) + +#define TYPEC_STATE_MACHINE_STATUS_REG 0x09 +#define TYPEC_ATTACH_DETACH_STATE BIT(5) + +#define TYPEC_SM_STATUS_REG 0x0A +#define TYPEC_SM_VBUS_VSAFE5V BIT(5) +#define TYPEC_SM_VBUS_VSAFE0V BIT(6) +#define TYPEC_SM_USBIN_LT_LV BIT(7) + +#define TYPEC_MISC_STATUS_REG 0x0B +#define TYPEC_WATER_DETECTION_STATUS BIT(7) +#define SNK_SRC_MODE BIT(6) +#define TYPEC_VBUS_DETECT BIT(5) +#define TYPEC_VBUS_ERROR_STATUS BIT(4) +#define TYPEC_DEBOUNCE_DONE BIT(3) +#define CC_ORIENTATION BIT(1) +#define CC_ATTACHED BIT(0) + +#define LEGACY_CABLE_STATUS_REG 0x0D +#define TYPEC_LEGACY_CABLE_STATUS BIT(1) +#define TYPEC_NONCOMP_LEGACY_CABLE_STATUS BIT(0) + +#define TYPEC_U_USB_STATUS_REG 0x0F +#define U_USB_GROUND_NOVBUS BIT(6) +#define U_USB_GROUND BIT(4) +#define U_USB_FMB1 BIT(3) +#define U_USB_FLOAT1 BIT(2) +#define U_USB_FMB2 BIT(1) +#define U_USB_FLOAT2 BIT(0) + +#define TYPEC_MODE_CFG_REG 0x44 +#define TYPEC_TRY_MODE_MASK GENMASK(4, 3) +#define EN_TRY_SNK BIT(4) +#define EN_TRY_SRC BIT(3) +#define TYPEC_POWER_ROLE_CMD_MASK GENMASK(2, 0) +#define EN_SRC_ONLY BIT(2) +#define EN_SNK_ONLY BIT(1) +#define TYPEC_DISABLE_CMD BIT(0) + +#define TYPEC_VCONN_CONTROL_REG 0x46 +#define VCONN_EN_ORIENTATION BIT(2) +#define VCONN_EN_VALUE BIT(1) +#define VCONN_EN_SRC BIT(0) + +#define TYPEC_CCOUT_CONTROL_REG 0x48 +#define TYPEC_CCOUT_BUFFER_EN BIT(2) +#define TYPEC_CCOUT_VALUE BIT(1) +#define TYPEC_CCOUT_SRC BIT(0) + +#define DEBUG_ACCESS_SRC_CFG_REG 0x4C +#define EN_UNORIENTED_DEBUG_ACCESS_SRC BIT(0) + +#define TYPE_C_CRUDE_SENSOR_CFG_REG 0x4e +#define EN_SRC_CRUDE_SENSOR BIT(1) +#define EN_SNK_CRUDE_SENSOR BIT(0) + +#define TYPEC_EXIT_STATE_CFG_REG 0x50 +#define BYPASS_VSAFE0V_DURING_ROLE_SWAP BIT(3) +#define SEL_SRC_UPPER_REF BIT(2) +#define USE_TPD_FOR_EXITING_ATTACHSRC BIT(1) +#define EXIT_SNK_BASED_ON_CC BIT(0) + +#define TYPEC_CURRSRC_CFG_REG 0x52 +#define TYPEC_SRC_RP_SEL_330UA BIT(1) +#define TYPEC_SRC_RP_SEL_180UA BIT(0) +#define TYPEC_SRC_RP_SEL_80UA 0 +#define TYPEC_SRC_RP_SEL_MASK GENMASK(1, 0) + +#define TYPEC_INTERRUPT_EN_CFG_1_REG 0x5E +#define TYPEC_LEGACY_CABLE_INT_EN BIT(7) +#define TYPEC_NONCOMPLIANT_LEGACY_CABLE_INT_EN BIT(6) +#define TYPEC_TRYSOURCE_DETECT_INT_EN BIT(5) +#define TYPEC_TRYSINK_DETECT_INT_EN BIT(4) +#define TYPEC_CCOUT_DETACH_INT_EN BIT(3) +#define TYPEC_CCOUT_ATTACH_INT_EN BIT(2) +#define TYPEC_VBUS_DEASSERT_INT_EN BIT(1) +#define TYPEC_VBUS_ASSERT_INT_EN BIT(0) + +#define TYPEC_INTERRUPT_EN_CFG_2_REG 0x60 +#define TYPEC_SRC_BATT_HPWR_INT_EN BIT(6) +#define MICRO_USB_STATE_CHANGE_INT_EN BIT(5) +#define TYPEC_STATE_MACHINE_CHANGE_INT_EN BIT(4) +#define TYPEC_DEBUG_ACCESS_DETECT_INT_EN BIT(3) +#define TYPEC_WATER_DETECTION_INT_EN BIT(2) +#define TYPEC_VBUS_ERROR_INT_EN BIT(1) +#define TYPEC_DEBOUNCE_DONE_INT_EN BIT(0) + +#define TYPEC_DEBOUNCE_OPTION_REG 0x62 +#define REDUCE_TCCDEBOUNCE_TO_2MS BIT(2) + +#define TYPE_C_SBU_CFG_REG 0x6A +#define SEL_SBU1_ISRC_VAL 0x04 +#define SEL_SBU2_ISRC_VAL 0x01 + +#define TYPEC_U_USB_CFG_REG 0x70 +#define EN_MICRO_USB_FACTORY_MODE BIT(1) +#define EN_MICRO_USB_MODE BIT(0) + +#define TYPEC_PMI632_U_USB_WATER_PROTECTION_CFG_REG 0x72 + +#define TYPEC_U_USB_WATER_PROTECTION_CFG_REG 0x73 +#define EN_MICRO_USB_WATER_PROTECTION BIT(4) +#define MICRO_USB_DETECTION_ON_TIME_CFG_MASK GENMASK(3, 2) +#define MICRO_USB_DETECTION_PERIOD_CFG_MASK GENMASK(1, 0) + +#define TYPEC_PMI632_MICRO_USB_MODE_REG 0x73 +#define MICRO_USB_MODE_ONLY BIT(0) + +struct pmic_typec; +extern struct platform_driver qcom_pmic_typec_platform_driver; + +int qcom_pmic_typec_init(struct pmic_typec *pmic_typec, + struct tcpm_port *tcpm_port); + +void qcom_pmic_typec_put(struct pmic_typec *pmic_typec); + +int qcom_pmic_typec_get_cc(struct pmic_typec *pmic_typec, + enum typec_cc_status *cc1, + enum typec_cc_status *cc2); + +int qcom_pmic_typec_set_cc(struct pmic_typec *pmic_typec, + enum typec_cc_status cc); + +int qcom_pmic_typec_get_vbus(struct pmic_typec *pmic_typec); + +int qcom_pmic_typec_set_vconn(struct pmic_typec *pmic_typec, bool on); + +int qcom_pmic_typec_start_toggling(struct pmic_typec *pmic_typec, + enum typec_port_type port_type, + enum typec_cc_status cc); + +int qcom_pmic_typec_set_vbus(struct pmic_typec *pmic_typec, bool on); + +#endif /* __QCOM_PMIC_TYPE_C_H__ */ diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_virt_tcpm.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_virt_tcpm.c new file mode 100644 index 0000000000000..91544b4b59439 --- /dev/null +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_virt_tcpm.c @@ -0,0 +1,326 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2023, Linaro Ltd. All rights reserved. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "qcom_pmic_pdphy.h" +#include "qcom_pmic_typec.h" + +struct pmic_virt_tcpm { + struct device *dev; + struct pmic_typec *pmic_typec; + struct pmic_pdphy *pmic_pdphy; + struct tcpm_port *tcpm_port; + struct tcpc_dev tcpc; + bool vbus_enabled; + struct mutex lock; /* VBUS state serialization */ +}; + +#define tcpc_to_tcpm(_tcpc_) container_of(_tcpc_, struct pmic_virt_tcpm, tcpc) + +static int qcom_pmic_virt_tcpm_get_vbus(struct tcpc_dev *tcpc) +{ + struct pmic_virt_tcpm *tcpm = tcpc_to_tcpm(tcpc); + int ret; + + mutex_lock(&tcpm->lock); + ret = tcpm->vbus_enabled || qcom_pmic_typec_get_vbus(tcpm->pmic_typec); + mutex_unlock(&tcpm->lock); + + return ret; +} + +static int qcom_pmic_virt_tcpm_set_vbus(struct tcpc_dev *tcpc, bool on, + bool sink) +{ + struct pmic_virt_tcpm *tcpm = tcpc_to_tcpm(tcpc); + int ret = 0; + + mutex_lock(&tcpm->lock); + if (tcpm->vbus_enabled == on) + goto done; + + ret = qcom_pmic_typec_set_vbus(tcpm->pmic_typec, on); + if (ret) + goto done; + + tcpm->vbus_enabled = on; + tcpm_vbus_change(tcpm->tcpm_port); + +done: + dev_dbg(tcpm->dev, "set_vbus set: %d result %d\n", on, ret); + mutex_unlock(&tcpm->lock); + + return ret; +} + +static int qcom_pmic_virt_tcpm_set_vconn(struct tcpc_dev *tcpc, bool on) +{ + struct pmic_virt_tcpm *tcpm = tcpc_to_tcpm(tcpc); + + return qcom_pmic_typec_set_vconn(tcpm->pmic_typec, on); +} + +static int qcom_pmic_virt_tcpm_get_cc(struct tcpc_dev *tcpc, + enum typec_cc_status *cc1, + enum typec_cc_status *cc2) +{ + struct pmic_virt_tcpm *tcpm = tcpc_to_tcpm(tcpc); + + return qcom_pmic_typec_get_cc(tcpm->pmic_typec, cc1, cc2); +} + +static int qcom_pmic_virt_tcpm_set_cc(struct tcpc_dev *tcpc, + enum typec_cc_status cc) +{ + struct pmic_virt_tcpm *tcpm = tcpc_to_tcpm(tcpc); + + return qcom_pmic_typec_set_cc(tcpm->pmic_typec, cc); +} + +static int qcom_pmic_virt_tcpm_set_polarity(struct tcpc_dev *tcpc, + enum typec_cc_polarity pol) +{ + /* Polarity is set separately by phy-qcom-qmp.c */ + return 0; +} + +static int qcom_pmic_virt_tcpm_start_toggling(struct tcpc_dev *tcpc, + enum typec_port_type port_type, + enum typec_cc_status cc) +{ + struct pmic_virt_tcpm *tcpm = tcpc_to_tcpm(tcpc); + + return qcom_pmic_typec_start_toggling(tcpm->pmic_typec, port_type, cc); +} + +static int qcom_pmic_virt_tcpm_set_roles(struct tcpc_dev *tcpc, bool attached, + enum typec_role power_role, + enum typec_data_role data_role) +{ + struct pmic_virt_tcpm *tcpm = tcpc_to_tcpm(tcpc); + + return qcom_pmic_pdphy_set_roles(tcpm->pmic_pdphy, data_role, + power_role); +} + +static int qcom_pmic_virt_tcpm_set_pd_rx(struct tcpc_dev *tcpc, bool on) +{ + struct pmic_virt_tcpm *tcpm = tcpc_to_tcpm(tcpc); + + return qcom_pmic_pdphy_set_pd_rx(tcpm->pmic_pdphy, on); +} + +static int qcom_pmic_virt_tcpm_pd_transmit(struct tcpc_dev *tcpc, + enum tcpm_transmit_type type, + const struct pd_message *msg, + unsigned int negotiated_rev) +{ + struct pmic_virt_tcpm *tcpm = tcpc_to_tcpm(tcpc); + + return qcom_pmic_pdphy_pd_transmit(tcpm->pmic_pdphy, type, msg, + negotiated_rev); +} + +static struct platform_device +*qcom_pmic_virt_tcpm_get_pdev(struct device *dev, const char *property_name) +{ + struct device_node *np; + struct platform_device *pdev; + const __be32 *prop; + + prop = of_get_property(dev->of_node, property_name, NULL); + if (!prop) { + dev_err(dev, "required '%s' property missing\n", property_name); + return ERR_PTR(-EINVAL); + } + + np = of_find_node_by_phandle(be32_to_cpup(prop)); + if (!np) { + dev_err(dev, "could not find '%s' node\n", property_name); + return ERR_PTR(-ENODEV); + } + + pdev = of_find_device_by_node(np); + of_node_put(np); + + if (pdev) + return pdev; + + return ERR_PTR(-ENODEV); +} + +static int qcom_pmic_virt_tcpm_init(struct tcpc_dev *tcpc) +{ + return 0; +} + +static int qcom_pmic_virt_tcpm_probe(struct platform_device *pdev) +{ + struct pmic_virt_tcpm *tcpm; + struct device *dev = &pdev->dev; + struct platform_device *typec_pdev; + struct platform_device *pdphy_pdev; + int ret; + + tcpm = devm_kzalloc(dev, sizeof(*tcpm), GFP_KERNEL); + if (!tcpm) + return -ENOMEM; + + tcpm->dev = dev; + tcpm->tcpc.init = qcom_pmic_virt_tcpm_init; + tcpm->tcpc.get_vbus = qcom_pmic_virt_tcpm_get_vbus; + tcpm->tcpc.set_vbus = qcom_pmic_virt_tcpm_set_vbus; + tcpm->tcpc.set_cc = qcom_pmic_virt_tcpm_set_cc; + tcpm->tcpc.get_cc = qcom_pmic_virt_tcpm_get_cc; + tcpm->tcpc.set_polarity = qcom_pmic_virt_tcpm_set_polarity; + tcpm->tcpc.set_vconn = qcom_pmic_virt_tcpm_set_vconn; + tcpm->tcpc.start_toggling = qcom_pmic_virt_tcpm_start_toggling; + tcpm->tcpc.set_pd_rx = qcom_pmic_virt_tcpm_set_pd_rx; + tcpm->tcpc.set_roles = qcom_pmic_virt_tcpm_set_roles; + tcpm->tcpc.pd_transmit = qcom_pmic_virt_tcpm_pd_transmit; + + mutex_init(&tcpm->lock); + platform_set_drvdata(pdev, tcpm); + + ret = of_platform_populate(dev->of_node, NULL, NULL, dev); + if (ret) { + dev_err(dev, "Populating child devices fail\n"); + return ret; + }; + + typec_pdev = qcom_pmic_virt_tcpm_get_pdev(dev, "qcom,pmic-typec"); + if (IS_ERR(typec_pdev)) { + dev_err(dev, "Error linking typec endpoint\n"); + return PTR_ERR(typec_pdev); + } + + tcpm->pmic_typec = platform_get_drvdata(typec_pdev); + if (!tcpm->pmic_typec) { + ret = -EPROBE_DEFER; + goto put_typec_pdev; + } + + pdphy_pdev = qcom_pmic_virt_tcpm_get_pdev(dev, "qcom,pmic-pdphy"); + if (IS_ERR(pdphy_pdev)) { + dev_err(dev, "Error linking pdphy endpoint\n"); + ret = PTR_ERR(pdphy_pdev); + goto put_typec_pdev; + } + + tcpm->pmic_pdphy = platform_get_drvdata(pdphy_pdev); + if (!tcpm->pmic_pdphy) { + ret = -EPROBE_DEFER; + goto put_pdphy_dev; + } + + tcpm->tcpc.fwnode = device_get_named_child_node(tcpm->dev, "connector"); + if (IS_ERR(tcpm->tcpc.fwnode)) + return PTR_ERR(tcpm->tcpc.fwnode); + + tcpm->tcpm_port = tcpm_register_port(tcpm->dev, &tcpm->tcpc); + if (IS_ERR(tcpm->tcpm_port)) { + ret = PTR_ERR(tcpm->tcpm_port); + goto fwnode_remove; + } + + ret = qcom_pmic_pdphy_init(tcpm->pmic_pdphy, tcpm->tcpm_port); + if (ret) + goto fwnode_remove; + + ret = qcom_pmic_typec_init(tcpm->pmic_typec, tcpm->tcpm_port); + if (ret) + goto fwnode_remove; + + return 0; + +fwnode_remove: + fwnode_remove_software_node(tcpm->tcpc.fwnode); + +put_pdphy_dev: + put_device(&pdphy_pdev->dev); + +put_typec_pdev: + put_device(&typec_pdev->dev); + + return ret; +} + +static int qcom_pmic_virt_tcpm_remove(struct platform_device *pdev) +{ + struct pmic_virt_tcpm *tcpm = platform_get_drvdata(pdev); + + tcpm_unregister_port(tcpm->tcpm_port); + fwnode_remove_software_node(tcpm->tcpc.fwnode); + qcom_pmic_pdphy_put(tcpm->pmic_pdphy); + qcom_pmic_typec_put(tcpm->pmic_typec); + + return 0; +} + +static const struct of_device_id qcom_pmic_virt_tcpm_table[] = { + { .compatible = "qcom,pmic-virt-tcpm" }, + { } +}; +MODULE_DEVICE_TABLE(of, qcom_pmic_virt_tcpm_table); + +static struct platform_driver qcom_pmic_virt_tcpm_platform_driver = { + .driver = { + .name = "qcom,pmic-tcpm", + .of_match_table = qcom_pmic_virt_tcpm_table, + }, + .probe = qcom_pmic_virt_tcpm_probe, + .remove = qcom_pmic_virt_tcpm_remove, +}; + +static int __init qcom_pmic_virt_tcpm_module_init(void) +{ + int ret; + + ret = platform_driver_register(&qcom_pmic_typec_platform_driver); + if (ret) + return ret; + + ret = platform_driver_register(&qcom_pmic_pdphy_platform_driver); + if (ret) + goto unregister_typec; + + ret = platform_driver_register(&qcom_pmic_virt_tcpm_platform_driver); + if (ret) + goto unregister_pdphy; + + return 0; + +unregister_pdphy: + platform_driver_unregister(&qcom_pmic_pdphy_platform_driver); + +unregister_typec: + platform_driver_unregister(&qcom_pmic_typec_platform_driver); + + return ret; +} +module_init(qcom_pmic_virt_tcpm_module_init); + +static void __exit qcom_pmic_virt_tcpm_module_exit(void) +{ + platform_driver_unregister(&qcom_pmic_virt_tcpm_platform_driver); + platform_driver_unregister(&qcom_pmic_pdphy_platform_driver); + platform_driver_unregister(&qcom_pmic_typec_platform_driver); +} +module_exit(qcom_pmic_virt_tcpm_module_exit); + +MODULE_DESCRIPTION("QCOM PMIC USB Type-C Port Manager Driver"); +MODULE_LICENSE("GPL"); From patchwork Sat Mar 18 12:18:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 665165 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3E79C7618A for ; Sat, 18 Mar 2023 12:19:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229948AbjCRMTF (ORCPT ); Sat, 18 Mar 2023 08:19:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229911AbjCRMSz (ORCPT ); Sat, 18 Mar 2023 08:18:55 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 167535588 for ; Sat, 18 Mar 2023 05:18:49 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id w11so3726162wmo.2 for ; Sat, 18 Mar 2023 05:18:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679141928; 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=pFpDO4r3OSMpuybPq4CoNiCijlv8kXLH8jhHe8bIkk0=; b=A/RQ+2P0oyCCezCrzeDcWLegc5yFmJGS4Vb5NT8ogFy2puCBN/lCbcA/6IhTA4L0jT usiB35KSMJoI33DviJRO4AeVkcqSQTONJb6gTLGEC4nYKxluGzBIxnn6cIKPnBHY7sr0 LARYowsvNc4QGjaDn5O41VYiCAfeByoRQFtPexjFOnGU6QRwaaFUiMYK/Xy3gJ6RzqIN 5o7sQu/Z93InWfcfvWbB1vjAlkr7JtJGeqCtLP2hYGaaVpNpx2XSN/CdTJNUSvTYNG3c yygyHUD7x3jJJFrdrMznWQ0TtquM35IeFjT1ulgu1q7RXSU0uiBx5SlP0QiN5FfyO87Z xpyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679141928; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pFpDO4r3OSMpuybPq4CoNiCijlv8kXLH8jhHe8bIkk0=; b=nRZPBV0P/TvFfN4UbmMKIEXDxBZ4RpiSNKsTERJ9gSBwK810bTXoHMKN4cxy9XvExj WYp3t/XrBkhMNo8Zg6n+xXYnqoXViqCY3zKbt5dRveZrN+tCFWYFr5wgQoZZM50nJwMa /Jru5wpp0PoMXz4b2E6oPJqLW7x5u/UyUmrz04pLx5uTSNkUtu96xMMk49jSNyFdsGrp eihliWKNyiNkFmnF/9NRTbLJdEEzZ6bD02P1cam0wo/GSo9VREAk670rUMZ7RyjITT80 wZk+Sn5GCN0m/THj5d+0ABcJ8jWUFi78e7+osPvIznLzTIjxct9EtkgrkpW+lxWVD9In H3Zw== X-Gm-Message-State: AO0yUKVehYV+/KCdfp38zlQ4bioV9W8b31HtoQqxyE9QkTGind9GEt2P hStbAfoNrnPki1IcFuLfRQX8tQ== X-Google-Smtp-Source: AK7set/vEg5NTGF6xkL73JLWedkZT6fLFWoP9mq3DT5/EX1KwohNRK0bBlG7a5mkMp2sq5AL4tKpAw== X-Received: by 2002:a05:600c:1e02:b0:3ed:31f5:11e with SMTP id ay2-20020a05600c1e0200b003ed31f5011emr12350267wmb.5.1679141928336; Sat, 18 Mar 2023 05:18:48 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id az40-20020a05600c602800b003e2096da239sm10814997wmb.7.2023.03.18.05.18.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Mar 2023 05:18:47 -0700 (PDT) From: Bryan O'Donoghue To: linux@roeck-us.net, heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org, andersson@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Cc: wcheng@codeaurora.org, caleb.connolly@linaro.org, bryan.odonoghue@linaro.org, konrad.dybcio@linaro.org, subbaram@quicinc.com, jackp@quicinc.com, robertom@qti.qualcomm.com, Dmitry Baryshkov Subject: [PATCH v4 13/18] phy: qcom-qmp: Register as a typec switch for orientation detection Date: Sat, 18 Mar 2023 12:18:23 +0000 Message-Id: <20230318121828.739424-14-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230318121828.739424-1-bryan.odonoghue@linaro.org> References: <20230318121828.739424-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Dmitry Baryshkov The lane select switch for USB typec orientation is within the USB QMP PHY. the current device. It could be connected through an endpoint, to an independent device handling the typec detection, ie the QCOM SPMI typec driver. bod: Fixed the logic qcom_qmp_phy_typec_switch_set() to disable phy on disconnect if and only if we have initialized the PHY. Retained CC orientation logic in qcom_qmp_phy_com_init() to simplify patch. bod: Ported from earlier version of driver to phy-qcom-qmp-combo.c Co-developed-by: Wesley Cheng Signed-off-by: Wesley Cheng Co-developed-by: Bryan O'Donoghue Signed-off-by: Bryan O'Donoghue Signed-off-by: Dmitry Baryshkov --- drivers/phy/qualcomm/Kconfig | 8 +++ drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 80 +++++++++++++++++++++-- 2 files changed, 84 insertions(+), 4 deletions(-) diff --git a/drivers/phy/qualcomm/Kconfig b/drivers/phy/qualcomm/Kconfig index 4850d48f31fa1..8240fffdbed4e 100644 --- a/drivers/phy/qualcomm/Kconfig +++ b/drivers/phy/qualcomm/Kconfig @@ -101,6 +101,14 @@ config PHY_QCOM_QMP_USB endif # PHY_QCOM_QMP +config PHY_QCOM_QMP_TYPEC + def_bool PHY_QCOM_QMP=y && TYPEC=y || PHY_QCOM_QMP=m && TYPEC + help + Register a type C switch from the QMP PHY driver for type C + orientation support. This has dependencies with if the type C kernel + configuration is enabled or not. This support will not be present if + USB type C is disabled. + config PHY_QCOM_QUSB2 tristate "Qualcomm QUSB2 PHY Driver" depends on OF && (ARCH_QCOM || COMPILE_TEST) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c index c1483e157af4a..afe708c63557d 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c @@ -19,6 +19,7 @@ #include #include #include +#include #include @@ -63,6 +64,10 @@ /* QPHY_V3_PCS_MISC_CLAMP_ENABLE register bits */ #define CLAMP_EN BIT(0) /* enables i/o clamp_n */ +/* QPHY_V3_DP_COM_TYPEC_CTRL register bits */ +#define SW_PORTSELECT_VAL BIT(0) +#define SW_PORTSELECT_MUX BIT(1) + #define PHY_INIT_COMPLETE_TIMEOUT 10000 struct qmp_phy_init_tbl { @@ -1323,6 +1328,9 @@ struct qmp_combo { struct clk_fixed_rate pipe_clk_fixed; struct clk_hw dp_link_hw; struct clk_hw dp_pixel_hw; + + struct typec_switch_dev *sw; + enum typec_orientation orientation; }; static void qmp_v3_dp_aux_init(struct qmp_combo *qmp); @@ -1970,7 +1978,8 @@ static void qmp_v3_configure_dp_tx(struct qmp_combo *qmp) static bool qmp_combo_configure_dp_mode(struct qmp_combo *qmp) { u32 val; - bool reverse = false; + bool reverse = qmp->orientation == TYPEC_ORIENTATION_REVERSE; + const struct phy_configure_opts_dp *dp_opts = &qmp->dp_opts; val = DP_PHY_PD_CTL_PWRDN | DP_PHY_PD_CTL_AUX_PWRDN | DP_PHY_PD_CTL_PLL_PWRDN | DP_PHY_PD_CTL_DP_CLAMP_EN; @@ -1989,10 +1998,18 @@ static bool qmp_combo_configure_dp_mode(struct qmp_combo *qmp) * if (orientation == ORIENTATION_CC2) * writel(0x4c, qmp->dp_dp_phy + QSERDES_V3_DP_PHY_MODE); */ + if (dp_opts->lanes == 4 || reverse) + val |= DP_PHY_PD_CTL_LANE_0_1_PWRDN; + if (dp_opts->lanes == 4 || !reverse) + val |= DP_PHY_PD_CTL_LANE_2_3_PWRDN; + val |= DP_PHY_PD_CTL_LANE_2_3_PWRDN; writel(val, qmp->dp_dp_phy + QSERDES_DP_PHY_PD_CTL); - writel(0x5c, qmp->dp_dp_phy + QSERDES_DP_PHY_MODE); + if (reverse) + writel(0x4c, qmp->pcs + QSERDES_DP_PHY_MODE); + else + writel(0x5c, qmp->pcs + QSERDES_DP_PHY_MODE); return reverse; } @@ -2476,6 +2493,7 @@ static int qmp_combo_com_init(struct qmp_combo *qmp) { const struct qmp_phy_cfg *cfg = qmp->cfg; void __iomem *com = qmp->com; + u32 val; int ret; mutex_lock(&qmp->phy_mutex); @@ -2513,8 +2531,11 @@ static int qmp_combo_com_init(struct qmp_combo *qmp) SW_DPPHY_RESET_MUX | SW_DPPHY_RESET | SW_USB3PHY_RESET_MUX | SW_USB3PHY_RESET); - /* Default type-c orientation, i.e CC1 */ - qphy_setbits(com, QPHY_V3_DP_COM_TYPEC_CTRL, 0x02); + /* Latch CC orientation based on reported state by TCPM */ + val = SW_PORTSELECT_MUX; + if (qmp->orientation == TYPEC_ORIENTATION_REVERSE) + val |= SW_PORTSELECT_VAL; + qphy_setbits(com, QPHY_V3_DP_COM_TYPEC_CTRL, val); qphy_setbits(com, QPHY_V3_DP_COM_PHY_MODE_CTRL, USB3_MODE | DP_MODE); @@ -3353,6 +3374,53 @@ static struct phy *qmp_combo_phy_xlate(struct device *dev, struct of_phandle_arg return ERR_PTR(-EINVAL); } +#if IS_ENABLED(CONFIG_PHY_QCOM_QMP_TYPEC) +static int qmp_combo_typec_switch_set(struct typec_switch_dev *sw, + enum typec_orientation orientation) +{ + struct qmp_combo *qmp = typec_switch_get_drvdata(sw); + struct phy *dp_phy = qmp->dp_phy; + int ret = 0; + + dev_dbg(qmp->dev, "Toggling orientation current %d requested %d\n", + qmp->orientation, orientation); + + qmp->orientation = orientation; + + if (orientation == TYPEC_ORIENTATION_NONE) { + if (qmp->init_count) + ret = qmp_combo_dp_power_off(dp_phy); + } else { + if (!qmp->init_count) + ret = qmp_combo_dp_power_on(dp_phy); + } + + return 0; +} + +static int qmp_combo_typec_switch_register(struct qmp_combo *qmp) +{ + struct typec_switch_desc sw_desc; + struct device *dev = qmp->dev; + + sw_desc.drvdata = qmp; + sw_desc.fwnode = dev->fwnode; + sw_desc.set = qmp_combo_typec_switch_set; + qmp->sw = typec_switch_register(dev, &sw_desc); + if (IS_ERR(qmp->sw)) { + dev_err(dev, "Error registering typec switch: %ld\n", + PTR_ERR(qmp->sw)); + } + + return 0; +} +#else +static int qmp_combo_typec_switch_register(struct qmp_combo *qmp) +{ + return 0; +} +#endif + static int qmp_combo_probe(struct platform_device *pdev) { struct qmp_combo *qmp; @@ -3443,6 +3511,10 @@ static int qmp_combo_probe(struct platform_device *pdev) else phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); + ret = qmp_combo_typec_switch_register(qmp); + if (ret) + goto err_node_put; + of_node_put(usb_np); of_node_put(dp_np); From patchwork Sat Mar 18 12:18:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 664943 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6EE1EC76195 for ; Sat, 18 Mar 2023 12:19:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229954AbjCRMTE (ORCPT ); Sat, 18 Mar 2023 08:19:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229913AbjCRMSz (ORCPT ); Sat, 18 Mar 2023 08:18:55 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAA103BDA6 for ; Sat, 18 Mar 2023 05:18:49 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id p16so4780545wmq.5 for ; Sat, 18 Mar 2023 05:18:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679141929; 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=WI0JWAq1Qy9TsaI8cMhQK4FjxjeVaLM5k+fSC4hp/Qw=; b=TrV66uIedf+yF19hp/cGovG0zW335l6n/XEgCu0TAd3XmmOawfE2v5VRQCBywmykon Ku43GWWsNo72z/kZD1/MZIzKJZHObC3stVPPYUuV6048a7Wp/UmTjYiZzMSa4ExNjE5k xSWWVFWm5GwP9Of+YYvMNbpRxT+yC6Ha0vwkiPZ3OhVmqe3zSirAiVgIa44Q2hBmNr94 Vvoe1cSaP+JQSW0C+nPH2LQnKWVN0rn35MrVKQRzBZOHfUvV/ihGXBWCypHeScH6eZHy k9ZHmkj/QuNV82xJLtp+JU+Iv885B4KiSW+Nydn8sGNwPCygrZFFOmRMT5yHLsE7bLDw Fw8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679141929; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WI0JWAq1Qy9TsaI8cMhQK4FjxjeVaLM5k+fSC4hp/Qw=; b=at17J2VRryFVygAi3LsFOCLe2PuflvmTymBxGJ9XBtU7YbBZGaYRai0r4BRY0cs5u3 VMWZmg29Ry1u2lPcy3Phfc9qHDNZ+6aH6EAZfQ559z+om0B1bpJeajYhslY+EdqamBHc NQzEwrygBD7ahrXN8NY7hkzfTD4oF7fEl5y+oG+yMDGO1N8hz6VXueOS8FCwJQTz/QyQ vWw0x/iRVwmu4Es6I8KsWRJ2enaizwiqTCv7bNFyGMJiAWMkUOjMIUbsq15gbXlFAepQ sbawuQAQz9gmK7t1gzlr1QXo7GUckXjXmUwly3AWsGT5mepdVyyL0qhmryflK0Znmel8 kPmQ== X-Gm-Message-State: AO0yUKUk5ikXPlsaGS/4MziG9bItb5pDsoeed2VIV+lIiaUDxdn0FJRP K4e7p2CNb7XOY6VGlQfE04gZxw== X-Google-Smtp-Source: AK7set8Dli9SYmFUEc+jzvDBSGXNZzhLikV+Bz3HnfvvnjI+1w2/LdXLsJxkW1WMwq2U4Y8p5/BeBw== X-Received: by 2002:a05:600c:4fc8:b0:3ed:1f98:670f with SMTP id o8-20020a05600c4fc800b003ed1f98670fmr4001689wmq.20.1679141929484; Sat, 18 Mar 2023 05:18:49 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id az40-20020a05600c602800b003e2096da239sm10814997wmb.7.2023.03.18.05.18.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Mar 2023 05:18:48 -0700 (PDT) From: Bryan O'Donoghue To: linux@roeck-us.net, heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org, andersson@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Cc: wcheng@codeaurora.org, caleb.connolly@linaro.org, bryan.odonoghue@linaro.org, konrad.dybcio@linaro.org, subbaram@quicinc.com, jackp@quicinc.com, robertom@qti.qualcomm.com Subject: [PATCH v4 14/18] arm64: dts: qcom: pm8150b: Add a TCPM description Date: Sat, 18 Mar 2023 12:18:24 +0000 Message-Id: <20230318121828.739424-15-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230318121828.739424-1-bryan.odonoghue@linaro.org> References: <20230318121828.739424-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Type-C port management functionality lives inside of the PMIC block on pm8150b. The Type-C port management logic controls orientation detection, vbus/vconn sense and to send/receive Type-C Power Domain messages. Signed-off-by: Bryan O'Donoghue --- arch/arm64/boot/dts/qcom/pm8150b.dtsi | 70 +++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/pm8150b.dtsi b/arch/arm64/boot/dts/qcom/pm8150b.dtsi index 66752cc063d60..6db32bdbf5747 100644 --- a/arch/arm64/boot/dts/qcom/pm8150b.dtsi +++ b/arch/arm64/boot/dts/qcom/pm8150b.dtsi @@ -7,6 +7,8 @@ #include #include #include +#include +#include / { thermal-zones { @@ -37,6 +39,14 @@ trip2 { }; }; }; + + tcpm: pm8150b-tcpm { + compatible = "qcom,pmic-virt-tcpm"; + qcom,pmic-typec = <&pm8150b_typec>; + qcom,pmic-pdphy = <&pm8150b_pdphy>; + + status = "disabled"; + }; }; &spmi_bus { @@ -59,6 +69,66 @@ pm8150b_vbus: usb-vbus-regulator@1100 { reg = <0x1100>; }; + pm8150b_typec: typec@1500 { + compatible = "qcom,pm8150b-typec"; + reg = <0x1500>; + interrupts = <0x2 0x15 PMIC_TYPEC_OR_RID_IRQ + IRQ_TYPE_EDGE_RISING>, + <0x2 0x15 PMIC_TYPEC_VPD_IRQ + IRQ_TYPE_EDGE_BOTH>, + <0x2 0x15 PMIC_TYPEC_CC_STATE_IRQ + IRQ_TYPE_EDGE_RISING>, + <0x2 0x15 PMIC_TYPEC_VCONN_OC_IRQ + IRQ_TYPE_EDGE_BOTH>, + <0x2 0x15 PMIC_TYPEC_VBUS_IRQ + IRQ_TYPE_EDGE_RISING>, + <0x2 0x15 PMIC_TYPEC_ATTACH_DETACH_IRQ + IRQ_TYPE_EDGE_RISING>, + <0x2 0x15 PMIC_TYPEC_LEGACY_CABLE_IRQ + IRQ_TYPE_EDGE_BOTH>, + <0x2 0x15 PMIC_TYPEC_TRY_SNK_SRC_IRQ + IRQ_TYPE_EDGE_RISING>; + interrupt-names = "or-rid-detect-change", + "vpd-detect", + "cc-state-change", + "vconn-oc", + "vbus-change", + "attach-detach", + "legacy-cable-detect", + "try-snk-src-detect"; + vdd-vbus-supply = <&pm8150b_vbus>; + }; + + pm8150b_pdphy: pdphy@1700 { + compatible = "qcom,pm8150b-pdphy"; + reg = <0x1700>; + interrupts = <0x2 0x17 PMIC_PDPHY_SIG_TX_IRQ + IRQ_TYPE_EDGE_RISING>, + <0x2 0x17 PMIC_PDPHY_SIG_RX_IRQ + IRQ_TYPE_EDGE_RISING>, + <0x2 0x17 PMIC_PDPHY_MSG_TX_IRQ + IRQ_TYPE_EDGE_RISING>, + <0x2 0x17 PMIC_PDPHY_MSG_RX_IRQ + IRQ_TYPE_EDGE_RISING>, + <0x2 0x17 PMIC_PDPHY_MSG_TX_FAIL_IRQ + IRQ_TYPE_EDGE_RISING>, + <0x2 0x17 PMIC_PDPHY_MSG_TX_DISCARD_IRQ + IRQ_TYPE_EDGE_RISING>, + <0x2 0x17 PMIC_PDPHY_MSG_RX_DISCARD_IRQ + IRQ_TYPE_EDGE_RISING>, + <0x2 0x17 PMIC_PDPHY_FR_SWAP_IRQ + IRQ_TYPE_EDGE_RISING>; + interrupt-names = "sig-tx", + "sig-rx", + "msg-tx", + "msg-rx", + "msg-tx-failed", + "msg-tx-discarded", + "msg-rx-discarded", + "fr-swap"; + vdd-phy-supply = <&vreg_l2a_3p1>; + }; + pm8150b_temp: temp-alarm@2400 { compatible = "qcom,spmi-temp-alarm"; reg = <0x2400>; From patchwork Sat Mar 18 12:18:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 664942 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19FD1C761A6 for ; Sat, 18 Mar 2023 12:19:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229837AbjCRMTG (ORCPT ); Sat, 18 Mar 2023 08:19:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229923AbjCRMS5 (ORCPT ); Sat, 18 Mar 2023 08:18:57 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4768F3D905 for ; Sat, 18 Mar 2023 05:18:50 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id r19-20020a05600c459300b003eb3e2a5e7bso4840494wmo.0 for ; Sat, 18 Mar 2023 05:18:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679141930; 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=lmmSgVp+T5bjkIFsMi3maL1+5aq8aFIlfAImDxKbXx8=; b=jBF3mPf638u6dQjyRXjV1gl7BuWJh9R4eNHIXH6gEO0TmG7FExVfyd88UJqQzMo5dZ EUJJkBUy5n7UEXJTQJpE2ocEnOg3S4vNaXhkyjkIw4lipMOb9O0kIocQWzctEiQ6Yx5o tkiAbR3bOmCmOQSJVWrYmYNywp6zFD/3gipFdcqzmkNBKzC+kuc8l40Nz/rk7ZvErhEU uSS1d55Azhb6BmadEH83lKOoi3+3UPt01jeR/HBrt/b0wonl6t8Obl/X7WTPajqz/MKJ Qq0fMbfGaLFanHfOZfaZCP0vB2v0kQ+fIUjXv8PcAfmDK64jt5M5ZzuwKPhS7luS/vh9 8Qtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679141930; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lmmSgVp+T5bjkIFsMi3maL1+5aq8aFIlfAImDxKbXx8=; b=FjnR7jZ4n++giTSgSMG2KVKk1KAwoZFytnlkEx5m1+yyVAJnjqkvQkMvMEsoWBh4uk qY0YnsAkmGvwoG58taXR6Us9X7oT8g/aY6CS+rebqupXjP3rnAKREx3a+thVAWsbNxr3 FBjbMdYRcToeCihpb3iRRaLxh/CLJsn37miaOmoWfzlOweC7V7Fs+QWLshsM707kN9cd 8LD15PNDWcaUm7NBrgUpY0sDQqA0rYYWOycIEWcQo11H1v91bxzyRDStXNDkmduovRhM f3/kOouKFYH1MY76CGTIkLo3tIZm2HoNbrRxU+9t8H4tVjsEWpGyM16OvUtecPmAFknn TNNA== X-Gm-Message-State: AO0yUKUFmqGc6GE5rUbJjzoa+XSafzg8le6i8NIZEUDPI4npA1ROcbX3 6vUGytUcfhel0XY9BD+2eLNNhA== X-Google-Smtp-Source: AK7set9rrtWziKSBJYKllFgoT2rlmBSnnqp8pFppSQ6pJxHQ3UdbDlCPmHZ9RWj26VoXxguDvGFpJA== X-Received: by 2002:a05:600c:4452:b0:3e1:374:8b66 with SMTP id v18-20020a05600c445200b003e103748b66mr26723807wmn.40.1679141930580; Sat, 18 Mar 2023 05:18:50 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id az40-20020a05600c602800b003e2096da239sm10814997wmb.7.2023.03.18.05.18.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Mar 2023 05:18:50 -0700 (PDT) From: Bryan O'Donoghue To: linux@roeck-us.net, heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org, andersson@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Cc: wcheng@codeaurora.org, caleb.connolly@linaro.org, bryan.odonoghue@linaro.org, konrad.dybcio@linaro.org, subbaram@quicinc.com, jackp@quicinc.com, robertom@qti.qualcomm.com Subject: [PATCH v4 15/18] arm64: dts: qcom: qrb5165-rb5: Switch on Type-C VBUS boost Date: Sat, 18 Mar 2023 12:18:25 +0000 Message-Id: <20230318121828.739424-16-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230318121828.739424-1-bryan.odonoghue@linaro.org> References: <20230318121828.739424-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Switch on VBUS for the Type-C port. We need to support a higher amperage than the bootloader set 2 Amps. Signed-off-by: Bryan O'Donoghue --- arch/arm64/boot/dts/qcom/qrb5165-rb5.dts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts b/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts index aa0a7bd7307ce..1ce88f0c31db2 100644 --- a/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts +++ b/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts @@ -1338,3 +1338,9 @@ &qup_spi0_data_clk { drive-strength = <6>; bias-disable; }; + +&pm8150b_vbus { + regulator-min-microamp = <500000>; + regulator-max-microamp = <3000000>; + status = "okay"; +}; From patchwork Sat Mar 18 12:18:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 664941 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06AEFC77B60 for ; Sat, 18 Mar 2023 12:19:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229892AbjCRMTK (ORCPT ); Sat, 18 Mar 2023 08:19:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229926AbjCRMTB (ORCPT ); Sat, 18 Mar 2023 08:19:01 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 348673BC50 for ; Sat, 18 Mar 2023 05:18:52 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id bg16-20020a05600c3c9000b003eb34e21bdfso6535281wmb.0 for ; Sat, 18 Mar 2023 05:18:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679141931; 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=adWouj9TAfQywdhRumc5cG6O0xCwlWjxDmV+i3e04SA=; b=lIeURAy+0w90okDqHG4p1/1K/X6UyW1VRGHQ34SlIH6TevX8QACxPyFRgq9pzfgWqu bOi07xAazuK7JfFQR4um/YT5LU1TCdrlAhruZquNQoEmnb0DmdZSoch6CMpwOczykjam iDf7wTO9nGvKtyqNo43Zbgaho7ykPMRmhDzRj5HoJBdhkmEdLgb8RF0TDWar61UIw583 ctcyQ0Uzf7f1fxc+GMSOfsmLAkMc6x+U90MeRZPRlNwHYN0pVV8mPnw12TAkRxPFCpkj Hv4zbuOaU3aCD2NGEgJjVxxADSVOeIueatp81ogfwUbJnlJwmIiIYpIAfEZelhG8cCa0 glFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679141931; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=adWouj9TAfQywdhRumc5cG6O0xCwlWjxDmV+i3e04SA=; b=TV4e+nx7KOVAsgrz0NbaG/KB4lFqMcOqE5V0O8rsWcNBcX+oux2Bon4SB3lHTunu4L YMe+gFkbBhjCU9PmAJ2NyVEr7917tA3ImOX5wpOcx3VsW6u+2VT8irwnekVLrozIRJOC SKgkslLpBdbUJOeIDm1+o27XBC8Ywk34RKuJW+k0zfNFpKw4bVDbuvZZx3/W6oFy6K7U G22Jd2xpgsxnNYCueatHDMGHbCkdyFWDUGKQGXBGL8+G+2OdNsNxbK/ZjoWdoxIevnPx eVt/DZaDgqVUogYN1clDId0SVAE9+164vh2qK7YWOE+2U0cSiCOtUjppVpE/AIT0Krjb 2xaQ== X-Gm-Message-State: AO0yUKVFl7TTVgvi/0bkoXD+uOlji6FZdkYNofyTzMb+qPbeLJpk0HNQ WuKS4NmAQvKZQAwVFG+SQxE8VQ== X-Google-Smtp-Source: AK7set895Nk8b2XqmlaqePhN7M+btOb2bRg9N0LHOClkoGe9ONhdpG2UDKfwC8pB5wojmkVPf3VQyw== X-Received: by 2002:a05:600c:4f02:b0:3eb:39c3:8844 with SMTP id l2-20020a05600c4f0200b003eb39c38844mr28511771wmq.12.1679141931565; Sat, 18 Mar 2023 05:18:51 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id az40-20020a05600c602800b003e2096da239sm10814997wmb.7.2023.03.18.05.18.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Mar 2023 05:18:51 -0700 (PDT) From: Bryan O'Donoghue To: linux@roeck-us.net, heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org, andersson@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Cc: wcheng@codeaurora.org, caleb.connolly@linaro.org, bryan.odonoghue@linaro.org, konrad.dybcio@linaro.org, subbaram@quicinc.com, jackp@quicinc.com, robertom@qti.qualcomm.com Subject: [PATCH v4 16/18] arm64: dts: qcom: qrb5165-rb5: Switch on basic TCPM Date: Sat, 18 Mar 2023 12:18:26 +0000 Message-Id: <20230318121828.739424-17-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230318121828.739424-1-bryan.odonoghue@linaro.org> References: <20230318121828.739424-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Switch on TCPM for the RB5. Here we declare as a source only not a sink since qrb5165 doesn't support powering exclusively from the type-c port. Signed-off-by: Bryan O'Donoghue Reviewed-by: Konrad Dybcio --- arch/arm64/boot/dts/qcom/qrb5165-rb5.dts | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts b/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts index 1ce88f0c31db2..965742a5be7ae 100644 --- a/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts +++ b/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts @@ -9,6 +9,7 @@ #include #include #include +#include #include "sm8250.dtsi" #include "pm8150.dtsi" #include "pm8150b.dtsi" @@ -1339,8 +1340,32 @@ &qup_spi0_data_clk { bias-disable; }; +&pm8150b_typec { + status = "okay"; +}; + +&pm8150b_pdphy { + status = "okay"; +}; + &pm8150b_vbus { regulator-min-microamp = <500000>; regulator-max-microamp = <3000000>; status = "okay"; }; + +&tcpm { + status = "okay"; + connector { + compatible = "usb-c-connector"; + + power-role = "source"; + data-role = "dual"; + self-powered; + + source-pdos = ; + }; +}; From patchwork Sat Mar 18 12:18:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 665164 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD610C761A6 for ; Sat, 18 Mar 2023 12:19:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229925AbjCRMTK (ORCPT ); Sat, 18 Mar 2023 08:19:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229950AbjCRMTC (ORCPT ); Sat, 18 Mar 2023 08:19:02 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 451993C798 for ; Sat, 18 Mar 2023 05:18:53 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id bh21-20020a05600c3d1500b003ed1ff06fb0so4826834wmb.3 for ; Sat, 18 Mar 2023 05:18:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679141932; 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=HgA98XC3+FaAuBf1Y62S9Q5BYrBoyKlV/w/a14kqW24=; b=egLfsGGvHt5vqbzk5EqmPySkNGvbU83a8IHyO/W+3xl00OXBpJKowkWsKjiEaq8ZJv C6nACGh+D07OFEyGFWtAHfh4G0iBonfrbn5SLjIqxqpdT/7SxNlmMHRA1zNpdxjEwUeb 8uBk2zwGoHkleBQN7rIsiHW1WYFKZUoPg6DoRWp/blRxnWSlX6Tm0QvwZ2Z3sD570Yxn 2iQkYZuQhCC0rPA4zx+3LRGe+J6nRG1WB8Hx0JKQ41F5YE6j9UiSmQWKmqjrN9ar3fjl ple6tonAzOnKAB8sTuRE5WGrWOABtsaCLWVkDuLa0E09A26V+oFWKmO39BrK7YYHCz10 E+ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679141932; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HgA98XC3+FaAuBf1Y62S9Q5BYrBoyKlV/w/a14kqW24=; b=TIzTkvRzjthUpOQjv7Og/i3F3J5Se8LSu85Rh55IQ8TC4F3IG98SHk+NnAqlxEvIwn gaSEu8sAXz1z6FJ56iCylg3FgOZ0jID8rniylI3EJcIxcz4S7O6zAIOitg4xxVoYV3DR cIarhn4AiW/rTpspd8hOFz3X/lewaGGI+1SUc8wbNu9eoAyPP8HS2I58TSqu7jafZz01 5yYx5uuKBd/Es1bycbKrhhZUv88DNujmLFwoZHZZLErtCUxlA+nPqllSfMQBh6/2kde0 nJy58BXhZEkJNPU5JwTfn6b5um+oCVjNxJSAYg1tvYHK97u3OLo474W6Rn50qPoQrpj8 Xdjw== X-Gm-Message-State: AO0yUKXEuFm6M5pjbQMZhmWwHI+NRXXCyNMXZOXAfTFlyIx4wK7tOIU3 Bh/Ct5ZgodDtcia9QT/8InmSOA== X-Google-Smtp-Source: AK7set/QhTme8pR70cdgmGWDy74Qh2DbF1/mYlGXy114yKruUyE20GEFz+ixmj02EVJSSXnakX3UjA== X-Received: by 2002:a05:600c:3846:b0:3ea:f883:4ce with SMTP id s6-20020a05600c384600b003eaf88304cemr26206235wmr.20.1679141932658; Sat, 18 Mar 2023 05:18:52 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id az40-20020a05600c602800b003e2096da239sm10814997wmb.7.2023.03.18.05.18.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Mar 2023 05:18:52 -0700 (PDT) From: Bryan O'Donoghue To: linux@roeck-us.net, heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org, andersson@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Cc: wcheng@codeaurora.org, caleb.connolly@linaro.org, bryan.odonoghue@linaro.org, konrad.dybcio@linaro.org, subbaram@quicinc.com, jackp@quicinc.com, robertom@qti.qualcomm.com Subject: [PATCH v4 17/18] arm64: dts: qcom: qrb5165-rb5: Switch on TCPM usb-role-switching for usb_1 Date: Sat, 18 Mar 2023 12:18:27 +0000 Message-Id: <20230318121828.739424-18-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230318121828.739424-1-bryan.odonoghue@linaro.org> References: <20230318121828.739424-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Switch on usb-role-switching for usb_1 via TCPM. We need to declare usb-role-switch in &usb_1 and associate with the remote-endpoint in TCPM which provides the necessary signal. Signed-off-by: Bryan O'Donoghue --- arch/arm64/boot/dts/qcom/qrb5165-rb5.dts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts b/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts index 965742a5be7ae..43d549d6672e9 100644 --- a/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts +++ b/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts @@ -1273,7 +1273,13 @@ &usb_1 { }; &usb_1_dwc3 { - dr_mode = "peripheral"; + dr_mode = "otg"; + usb-role-switch; + port { + dwc3_drd_switch: endpoint { + remote-endpoint = <&usb3_role>; + }; + }; }; &usb_1_hsphy { @@ -1356,6 +1362,12 @@ &pm8150b_vbus { &tcpm { status = "okay"; + port { + usb3_role: endpoint { + remote-endpoint = <&dwc3_drd_switch>; + }; + }; + connector { compatible = "usb-c-connector"; From patchwork Sat Mar 18 12:18:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 665163 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED31FC7618A for ; Sat, 18 Mar 2023 12:19:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229950AbjCRMTM (ORCPT ); Sat, 18 Mar 2023 08:19:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229970AbjCRMTF (ORCPT ); Sat, 18 Mar 2023 08:19:05 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D57173C788 for ; Sat, 18 Mar 2023 05:18:55 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id g6-20020a05600c4ec600b003ed8826253aso1487630wmq.0 for ; Sat, 18 Mar 2023 05:18:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679141934; 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=Q9jBbxddMPOzw1mqqKfwsKM1tV280U+NcSqrBp7AXSM=; b=QM8gySjjhDgZjhWGs5XRPGb56gHvY9mP106k8jXRIWxfobClWlZnrDkQ2nceySbziP z7i9A5mzpMjIOvasUMJwgdOmXjCE21V+koi/QPXDt7VqLrRhn7X5OAS/lRJ9734WLscq N7l+JEUMIWirax8wgS8+Xx1YCwbHxoqCncMDQKvDmjox86h+iMMAQ0L4ZWBH/boar7Vs ZER4MX/yLSWqr/4DkhFThOlnEpix7nkV2TAflZu108iCMs12iNgWftMDiBxkCAZMiZd4 /TgyCUq25recQ3styT7jcVsHwrssyY4XQ0UHxld04ivXjLolX71GebfSOJV9OTxYKTAI pTGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679141934; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Q9jBbxddMPOzw1mqqKfwsKM1tV280U+NcSqrBp7AXSM=; b=Tpqrhli5hSlsvjPn1+yIEfTNRfX72T3q97CrpOUTQNFC5/J6o9784x9Bf3J3Tvv+S5 iZkBRgPR98OmqUQxSFs14T1Qc94qxRNnCG3C9KrtJKwMMGTHGw6kUUXYx/wNKNR1HROK hmjYfxvOw5fJtbhOI8K0rBtYgwQHF8xauo8/Xvm/AsPGnZWl2MCJlaGOdbByYhIF1LRl D2zV4j7SNJ8I9rRd5T+sYGdbOrJCrxjSnF3rWwZftRQPTn0bLkiaev1FBlOU719I6/xJ D3JABxK8SY4DQH7vmZ49Yxt4tikOrnGhcQbNpmSqaYoGb4yVGIatQOtOfJzMMl3V/bgj N6vg== X-Gm-Message-State: AO0yUKVUjP5MtjlF/Uhf5xpheMMR0yeKu0FChaI7+ml9aZ8MRSsnG9JF TmvbdYIMLccIMDK7B+Ageghkqg== X-Google-Smtp-Source: AK7set8ZP4I+O3O//Cm1ixM1bdVD0Gb3KrIoiircm16kGQ5iTGMG7sANSo0TLiOgatzSMwPStTmDlw== X-Received: by 2002:a1c:4c0d:0:b0:3df:fcbd:3159 with SMTP id z13-20020a1c4c0d000000b003dffcbd3159mr4632261wmf.3.1679141933751; Sat, 18 Mar 2023 05:18:53 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id az40-20020a05600c602800b003e2096da239sm10814997wmb.7.2023.03.18.05.18.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Mar 2023 05:18:53 -0700 (PDT) From: Bryan O'Donoghue To: linux@roeck-us.net, heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org, andersson@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Cc: wcheng@codeaurora.org, caleb.connolly@linaro.org, bryan.odonoghue@linaro.org, konrad.dybcio@linaro.org, subbaram@quicinc.com, jackp@quicinc.com, robertom@qti.qualcomm.com Subject: [PATCH v4 18/18] arm64: dts: qcom: qrb5165-rb5: Switch on TCPM orientation-switch for usb_1_qmpphy Date: Sat, 18 Mar 2023 12:18:28 +0000 Message-Id: <20230318121828.739424-19-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230318121828.739424-1-bryan.odonoghue@linaro.org> References: <20230318121828.739424-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Switch on USB orientation-switching for usb_1_qmp via TCPM. Detecting the orientation switch is required to get the PHY to reset and bring-up the PHY with the CC lines set to the appropriate lane. Signed-off-by: Bryan O'Donoghue --- arch/arm64/boot/dts/qcom/qrb5165-rb5.dts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts b/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts index 43d549d6672e9..e5eecf02653ff 100644 --- a/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts +++ b/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts @@ -1295,6 +1295,12 @@ &usb_1_qmpphy { vdda-phy-supply = <&vreg_l9a_1p2>; vdda-pll-supply = <&vreg_l18a_0p92>; + orientation-switch; + port { + qmp_ss_mux: endpoint { + remote-endpoint = <&pmic_tcpm_ss_mux>; + }; + }; }; &usb_2 { @@ -1379,5 +1385,17 @@ connector { PDO_FIXED_DUAL_ROLE | PDO_FIXED_USB_COMM | PDO_FIXED_DATA_SWAP)>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + pmic_tcpm_ss_mux: endpoint { + remote-endpoint = <&qmp_ss_mux>; + }; + }; + }; }; };