From nobody Wed Oct 1 23:35:02 2025 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 067572877F7 for ; Fri, 26 Sep 2025 07:26:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758871583; cv=none; b=pQ+3k+ozhIJ9wYRr/IwQZrlj8QbLH4Mu+8T0+832rSv5B32yXWoFzI4nw3+mI56LLaDubT4jW1M48CSg4PvKHmNvJ6Lb+2XGIDVyR+V2v0ucWMBEX80pObLp8aYdR/IasZSM3ZFUkl0d65EdfDOWNQIGGYeQMQyhawJJ+NNHx+s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758871583; c=relaxed/simple; bh=upWyBh8lqfmu6LV7sTpbUr+WwNLCQ/FfInBDAu5O+9Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Qc5nclz461ONv77Xo/q9hP/ue9Mnn6Du6opdjSlDXCevvbTE9F34S+Ag9EpURRH0pZnvszVhbBENeg2Ufm4lgLhutVLlT9XYTdRFYenkX5jqwdVOvK15gqSr7YqErhjNGHCCc7DdHaDVvMLnwnNp7R+d9bcoz4QJn4ftr8B8QZA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=XVd4pMNv; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="XVd4pMNv" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 58Q6x4qK015888 for ; Fri, 26 Sep 2025 07:26:21 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 2e7Hy87wIaFmYTkT/SRJPCIfc6N0tMOhDASgzvKcFpk=; b=XVd4pMNvfugGo4ho rsQfGkE9d6MGZmPhUheVr4VWV6ar7uge2eUpr1UnNvtruQoLX4pQ/RcgCRTW+7a5 OgaU7isGRulQf+1XolJPPBBikmIXPhPmpYHmqk5gd5gQBt6TZzm982CRo6k9sZAX X6FbeWzSI01RLoaJQ+KdIjJCvPCRk/WSBsoT2kdRxNdkQQITLGjgJrkD7PdvPbAw mDOtsE/pUPRJXRbS6BvKqyeRlqITZSXQK3XgQXAS6t7WjOrMHPo00PENgfVC93Mx 5EybkFVLjdts/fprbM53MgoKXN1f6SW+hJ+ILirsRlVk9QqjFYTMlS58OTFoyC3i MwPH/Q== Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 49db0t9wkw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 26 Sep 2025 07:26:20 +0000 (GMT) Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-32eddb7bad7so485804a91.3 for ; Fri, 26 Sep 2025 00:26:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758871579; x=1759476379; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2e7Hy87wIaFmYTkT/SRJPCIfc6N0tMOhDASgzvKcFpk=; b=Roz8cvEwoDSy2ZCJqnTcNAO6G4GQoJi8wLTCcTH3D4ISMa7W5Ptcsv/wlHDPn0fn7k WXPkHRVXrOaYbt1nWY4u6Cpd00KvMFw8cWNehXBo/Op5uMnuybxYbDrEr9NTp5DRrzRF Io7EdMikUJM7EyS13drgaCDqBHoKSlWSVyZFIJJ9U9StGPStrJ9bkr61CVq8VFrD60to vUqmtE/Pbldtt3jWth4j7TneRFgHkZdNr/KrKOsILmWw8Yd4LX3A/y7n7fn74aoRebMN Tp7CivXA+LQw/nuBveYhUkL7hBTqX26M/LUbTDfq1bOadfJS0vxK3sLc7WkSM4EUCaOU SqSA== X-Forwarded-Encrypted: i=1; AJvYcCVu+UdksMNeErZ8cuFZ7cakq2Yzu3r9cY0bF4EGgj7iHZlnAYhwydSvI+bfweRUmH8CQU+XsbNRF4vKGkY=@vger.kernel.org X-Gm-Message-State: AOJu0YyMu4Pd8OP5gj4qp43LHpHM5nSxRS0Um1435N0QcyHpM/EyvRPk q3MGnZukvDKxeCcvuT0GIOtlLgY9i2RF7nJcjm87FcL4VZGMhW8ypg2Ms3jgJTu4x8QZFHbCQAU As/b3vmYzKutiqeOFzeGZ9B5icQYPnIyRSMSYI4zRnnrlT9ioI09jN3lgGOwii3aToEc= X-Gm-Gg: ASbGncsAs1EWygq119vx62mVh2Qu3UQ/N70TcMrG0Hx8/+tIupXnHMkQUji37UoXres 8ogLaTp8VCXb+ulduMX2Rj2FmonTpER2NfRJTZ+Q29GbPbr1CruaFY5HS6WlA/ajG9iBLsEWbSO 8trMrkwSQ8LIMj0vtLdc7MJjGyeutNfQPivFDueTxvepRWha/1l0ATebmfjZzp9Tuzxix4f5wKW N1DcGsCfwT9a/p03fYc/MTM8JTxKZrNZNYJ1N/7XW6yMupxGgZ17iQoKsjIUusUrXfpNz5fD8fp 6NtaS3RXRVvN40gQTc+nqeAVPo+6WL5hoyPxqqoDNd43njUj3jPcrmlyANcucvXr8X2GCQYRefc BY0PFD4EynTee4YEZPVv3mxfSm3H7W9Prnhck+Sp52rWF86PUV3y02RTY X-Received: by 2002:a17:902:8210:b0:27e:eabe:7604 with SMTP id d9443c01a7336-27eeabe7ad7mr12133745ad.9.1758871579494; Fri, 26 Sep 2025 00:26:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHAa2bZIUvZ/fMfkpjyLvaZZws4+i1XtR3RZF24APnyUt8R5PXamasJ9KugA1kJ8xeGnyatmg== X-Received: by 2002:a17:902:8210:b0:27e:eabe:7604 with SMTP id d9443c01a7336-27eeabe7ad7mr12133375ad.9.1758871578931; Fri, 26 Sep 2025 00:26:18 -0700 (PDT) Received: from sziotdisp01-gv.qualcomm.com.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-27ed671d8a2sm45117985ad.55.2025.09.26.00.26.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Sep 2025 00:26:18 -0700 (PDT) From: Xiangxu Yin Date: Fri, 26 Sep 2025 15:25:37 +0800 Subject: [PATCH v7 01/14] dt-bindings: phy: Add QMP USB3+DP PHY for QCS615 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250926-add-displayport-support-for-qcs615-platform-v7-1-dc5edaac6c2b@oss.qualcomm.com> References: <20250926-add-displayport-support-for-qcs615-platform-v7-0-dc5edaac6c2b@oss.qualcomm.com> In-Reply-To: <20250926-add-displayport-support-for-qcs615-platform-v7-0-dc5edaac6c2b@oss.qualcomm.com> To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Sean Paul , Marijn Suijten , David Airlie , Simona Vetter Cc: linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, fange.zhang@oss.qualcomm.com, yongxing.mou@oss.qualcomm.com, li.liu@oss.qualcomm.com, Dmitry Baryshkov , Bjorn Andersson , Konrad Dybcio , Xiangxu Yin X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1758871562; l=3580; i=xiangxu.yin@oss.qualcomm.com; s=20241125; h=from:subject:message-id; bh=upWyBh8lqfmu6LV7sTpbUr+WwNLCQ/FfInBDAu5O+9Q=; b=JfaeqU3+hlJ1OLbENBUNv32kEiS9ilat5jb4eIX6JV/6qs0s1jIEQdNeG7Q3eHdAOyUTNVxcY Ifpbu8NIITtBig+3IbyNrnLGoEmW0ri2aMMjpaGkCrpcwkZhzWWhzrO X-Developer-Key: i=xiangxu.yin@oss.qualcomm.com; a=ed25519; pk=F1TwipJzpywfbt3n/RPi4l/A4AVF+QC89XzCHgZYaOc= X-Proofpoint-ORIG-GUID: 8Rv7VpPy1ciOp938m9zHvOeUcl9ymTGa X-Proofpoint-GUID: 8Rv7VpPy1ciOp938m9zHvOeUcl9ymTGa X-Authority-Analysis: v=2.4 cv=Jvz8bc4C c=1 sm=1 tr=0 ts=68d6401c cx=c_pps a=UNFcQwm+pnOIJct1K4W+Mw==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=yJojWOMRYYMA:10 a=gEfo2CItAAAA:8 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=z8W1oWq9hX_DlPyfQGsA:9 a=QEXdDO2ut3YA:10 a=uKXjsCUrEbL0IQVhDsJ9:22 a=sptkURWiP4Gy88Gu7hUp:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTI1MDE3MSBTYWx0ZWRfX346HaDMrawWC h6HyOyqKDIZ+qSklaRX8XKPLkKcAHYAViGKR5EGzTNfjJUTHkPz5iJlkigwMlhFFFwPY+m2lUZX yibsBy/oH2fuXlLSW/uYxDhFIAeeNjHeAEEk/qze6RZGC7fishdE7CPMqTAjkIRuDsiKa0TtmlN JKNOoN0O4VStQKOQ2BIDYg/695yod8UxnwoeZq1Kg/27BA6NjTCVDiR9lN/2KMPIfOpTxkuNKS9 bsb+m3ZD5X0c+bWIgA9TEc0mD4Xu6U/ZdZuZQM2W3f3RqxrZfQVRRQhdJRRPEU9zZXQtfdEQ6/J +KAbOG+LoUDlQE/BjxU9BSNa/bo6iDVud6NZvNrv7ahgUExQshoQg/DRoDdvQfbl0pZhyLykPWJ Bw6lvFuo8Gsy1twZ3w+g1bmqQaIcPg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1117,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-09-26_02,2025-09-26_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 malwarescore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 suspectscore=0 spamscore=0 priorityscore=1501 adultscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2509150000 definitions=main-2509250171 Add device tree binding documentation for the Qualcomm QMP USB3+DP PHY on QCS615 Platform. This PHY supports both USB3 and DP functionality over USB-C, with PHY mode switching capability. It does not support combo mode. Reviewed-by: Rob Herring (Arm) Signed-off-by: Xiangxu Yin --- .../bindings/phy/qcom,qcs615-qmp-usb3dp-phy.yaml | 111 +++++++++++++++++= ++++ 1 file changed, 111 insertions(+) diff --git a/Documentation/devicetree/bindings/phy/qcom,qcs615-qmp-usb3dp-p= hy.yaml b/Documentation/devicetree/bindings/phy/qcom,qcs615-qmp-usb3dp-phy.= yaml new file mode 100644 index 0000000000000000000000000000000000000000..efb465c71c1b5870bd7ad3b0ec2= 15cf693a32f04 --- /dev/null +++ b/Documentation/devicetree/bindings/phy/qcom,qcs615-qmp-usb3dp-phy.yaml @@ -0,0 +1,111 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/qcom,qcs615-qmp-usb3dp-phy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm QMP USB3-DP PHY controller (DP, QCS615) + +maintainers: + - Xiangxu Yin + +description: + The QMP PHY controller supports physical layer functionality for both US= B3 + and DisplayPort over USB-C. While it enables mode switching between USB3= and + DisplayPort, but does not support combo mode. + +properties: + compatible: + enum: + - qcom,qcs615-qmp-usb3-dp-phy + + reg: + maxItems: 1 + + clocks: + maxItems: 4 + + clock-names: + items: + - const: aux + - const: ref + - const: cfg_ahb + - const: pipe + + resets: + maxItems: 2 + + reset-names: + items: + - const: phy_phy + - const: dp_phy + + vdda-phy-supply: true + + vdda-pll-supply: true + + "#clock-cells": + const: 1 + description: + See include/dt-bindings/phy/phy-qcom-qmp.h + + "#phy-cells": + const: 1 + description: + See include/dt-bindings/phy/phy-qcom-qmp.h + + qcom,tcsr-reg: + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + - items: + - description: phandle to TCSR hardware block + - description: offset of the VLS CLAMP register + - description: offset of the PHY mode register + description: Clamp and PHY mode register present in the TCSR + +required: + - compatible + - reg + - clocks + - clock-names + - resets + - reset-names + - vdda-phy-supply + - vdda-pll-supply + - "#clock-cells" + - "#phy-cells" + - qcom,tcsr-reg + +additionalProperties: false + +examples: + - | + #include + #include + + phy@88e8000 { + compatible =3D "qcom,qcs615-qmp-usb3-dp-phy"; + reg =3D <0x88e8000 0x2000>; + + clocks =3D <&gcc GCC_USB2_SEC_PHY_AUX_CLK>, + <&gcc GCC_USB3_SEC_CLKREF_CLK>, + <&gcc GCC_AHB2PHY_WEST_CLK>, + <&gcc GCC_USB2_SEC_PHY_PIPE_CLK>; + clock-names =3D "aux", + "ref", + "cfg_ahb", + "pipe"; + + resets =3D <&gcc GCC_USB3PHY_PHY_SEC_BCR>, + <&gcc GCC_USB3_DP_PHY_SEC_BCR>; + reset-names =3D "phy_phy", + "dp_phy"; + + vdda-phy-supply =3D <&vreg_l5a>; + vdda-pll-supply =3D <&vreg_l12a>; + + #clock-cells =3D <1>; + #phy-cells =3D <1>; + + qcom,tcsr-reg =3D <&tcsr 0xbff0 0xb24c>; + }; --=20 2.34.1 From nobody Wed Oct 1 23:35:02 2025 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 092212877F7 for ; Fri, 26 Sep 2025 07:26:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758871590; cv=none; b=FGQESOp7jNR/a7edM8cwP5m79DwO63xgOwEL4fHrOBZ+yYPe7FKvOo4LdqmPljNNKS7cE44uxHCaKZOFrOhpDZOXT1CUNVlcox4C1PZcGIMf3A/jJcEcQ+HRsvtKne2XYj0a/37br0CFZ+XRj0r/7ufgoKkDxkhwWZpppzfYuxk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758871590; c=relaxed/simple; bh=0c1kjfygm3Igs/lmvv1odqP5mBi6xk6AIpYhTadaHr0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ib0SEzX5ZRPV7I48JnN+TW9J1DqbfvijRMt+Gx6GP4uX7E4G1wSmzdmOYJrInDFoG0aiZNQ/foXEFMi/2r+xPoUu6IsCX430+/WRCHWUD5OET3KvNqavz1CCG5U4xL0PCdiChUprYZR07ISfvdyPdcFcdktLOLL/aSH6OuiBWdc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=Z/jniJ1U; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="Z/jniJ1U" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 58Q6w1m0027798 for ; Fri, 26 Sep 2025 07:26:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= LDnnPZbDY0CeogNvXqz1T50BX7PocujidnNTMym7C0k=; b=Z/jniJ1UlsTGZWrO xj+uKz2uTEQNJjyzrJiGfEbVZuEuJWPfjxN6jDFYEBeNP1KXZnw9tqdwQCc7yPEF 40a50zUys8wnEzXH73q1TLF3kA8K6nzYMaDWQF3Vv1dsduj+UcYLCk0wrgXPD4ki LhSMj31/ZoSpv6TIzjSQzjaJilM3Rv2gZh0tYgV+fer73L4RD6Jr40Be6g5i7VIq fjOo4H2wqHJPiKpPyHv8ppYAvEPLV1YfdGEb0wLsbMAnY4DfqcI83Ok4yjlUZGIB 5P4N+ELCDxb0r4xxx7r5/PyWrUh52GDvimwhrBqujjSlOFh1DhIZinuDue74Ybg0 KWZL/g== Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 49db0q1vdm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 26 Sep 2025 07:26:27 +0000 (GMT) Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-244582e9d17so5964335ad.3 for ; Fri, 26 Sep 2025 00:26:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758871586; x=1759476386; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LDnnPZbDY0CeogNvXqz1T50BX7PocujidnNTMym7C0k=; b=SyqegLUNxMcZBQxiP/K0rwnmO0JQi+WOTH7d9m4pamxny4MTopSj6ZB677J81x+BMs 8qPXcPdGCDTsbVq+5i5q/36fLLdWE1U0rQT0fBlQdnvE1xU+lD4D6PIjk4nsMXHr+0gg RbNs7HCoCnZ/oSGPyTJKEVC2P6jn70rlyI4EXT/Eq20ESriIn50AK2XtwbSuo09iMoZ+ uvlYY6zUtRpcNQoc/MS1YXrw1xxYq1NMl0f0WBk3gRJ5EV8UIk5LVgu3mOObj7WAD8Nl qotH0+m7CUKxkqyZGxhhE5a0UsFKlE79bOLfQRBeER9Vl6vNddPUjGuOHRL1WLTeOO+o CiuA== X-Forwarded-Encrypted: i=1; AJvYcCU/rbMtjnD6cn6gL74TRhr8WtpZkLtY/3t5rCRyUpu6x+Dss1kLUbc4AINohkweOHqa4g/f1ckeJFVYDUc=@vger.kernel.org X-Gm-Message-State: AOJu0YyaYUj2XV/TUmsYGDRNHuPVLO/JJKvFvl8bjHUrfxGIztm9LT7V 1Lg9fVaTe3YhEMOLkU7AEW14GTIhrPIC1hQpsE8KMaHj8Z954Vxvr90YVVaxHGirhhyz/z1uQ6D fkaJWtUbJKNtbN5jpfCWUAGRoTJFvHEmyAAOISGqM4I7qBXOKBmPgjerFeHguuSI2Rhk= X-Gm-Gg: ASbGncvT3vnhotR6mkXM2NV3j1r5BjPI2t4bqBnvz3qC6ewNAjnLjtVs1lRKqUw3cqc twPlWLT8T/Wozx1/c8xyqs5FDinoE0WO5PSQG8Hk+mY4syjItiW8df+SinP97txFFNPNmCjzfbU H6R+RA5JBRmJobhIs6WFdCVDPnnCSl8tITQqL3Iic/i00N4HEnO2IwxPXeKg/WBP37PLPKJXA+o i5dEpOoCUcxWwDY53judsuAcDYrNXJiO0xzNO/CUSnXOEnN/9+0OJP1IBjwXxnz1DDhvnsGwW9l uW4h8/00LFPSTVKR3jUMWwiiQu9YkHwdxcMCaZfL3mg/ND5VvvLdbVkf6RuApMP9ejwu+IAn1YY KvSpCRc73q/YWHv13rLYFH2EPZJKyfK2J2kv8YG189VfNbAUCzFOa9aRu X-Received: by 2002:a17:902:cf08:b0:27e:da7d:32d2 with SMTP id d9443c01a7336-27eda7d3793mr30320265ad.7.1758871586510; Fri, 26 Sep 2025 00:26:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHxiFddbFAngGf1XM+qgqpfj3JT8h9WNMtP7aQ5DBj35K+y1oPgxXc4iPIr97dhjyeNzhgjAA== X-Received: by 2002:a17:902:cf08:b0:27e:da7d:32d2 with SMTP id d9443c01a7336-27eda7d3793mr30320095ad.7.1758871586029; Fri, 26 Sep 2025 00:26:26 -0700 (PDT) Received: from sziotdisp01-gv.qualcomm.com.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-27ed671d8a2sm45117985ad.55.2025.09.26.00.26.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Sep 2025 00:26:25 -0700 (PDT) From: Xiangxu Yin Date: Fri, 26 Sep 2025 15:25:38 +0800 Subject: [PATCH v7 02/14] phy: qcom: qmp-usbc: Rename USB-specific ops to prepare for DP support Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250926-add-displayport-support-for-qcs615-platform-v7-2-dc5edaac6c2b@oss.qualcomm.com> References: <20250926-add-displayport-support-for-qcs615-platform-v7-0-dc5edaac6c2b@oss.qualcomm.com> In-Reply-To: <20250926-add-displayport-support-for-qcs615-platform-v7-0-dc5edaac6c2b@oss.qualcomm.com> To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Sean Paul , Marijn Suijten , David Airlie , Simona Vetter Cc: linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, fange.zhang@oss.qualcomm.com, yongxing.mou@oss.qualcomm.com, li.liu@oss.qualcomm.com, Dmitry Baryshkov , Bjorn Andersson , Konrad Dybcio , Xiangxu Yin X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1758871562; l=5530; i=xiangxu.yin@oss.qualcomm.com; s=20241125; h=from:subject:message-id; bh=0c1kjfygm3Igs/lmvv1odqP5mBi6xk6AIpYhTadaHr0=; b=qzNO1eXnVdxmYW9uDiezxYD8k/slxmAUVRfxGy3B4wOLxnYujakXy1F8v2+t8hWqAXzQFDyoW DjiJhnc58wnBVLu//Pw8A81pvwNsrdPc2y40t6ch5tRkC8FZ069J7mS X-Developer-Key: i=xiangxu.yin@oss.qualcomm.com; a=ed25519; pk=F1TwipJzpywfbt3n/RPi4l/A4AVF+QC89XzCHgZYaOc= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTI1MDE3MSBTYWx0ZWRfX2g2lCMOWGpvN wRofz+gVBQ96YC0hr/gBNuXrB6f/ANfwANvc+oxr+YI1x0PhDPQMtPp7chgUlgYg7qH7OiT0Stb JZJpYP3k3EPveoFU07w3PAUilRmXR+Gg/HUuqP2ncEgFGObsumL7BHK9bOPfLwUgIeuP3tMRlx/ e+Itturl4ISX669dm/MnVTgb3llS0c4jdAErz8hs5/76lNrAvJH5WzoImtn6ZtdO75R4G6u6PWq NYPsmxzJ+4HUJ6DjSKYohsjg/d6QIlAjTMXtF1jSSXTH6iWafJ59pMKOoVmpE5CfjzwIg0P9pKm 8CosKR1KmIxv+H9LAHaXAjjliSVRw3D17bNSM9cYnuZitlb9yX0AAEwe4g92CpzR13UVBOFa1zn 0+g/lq0FVUQuwl4FM7N8O6nmlpx3Gg== X-Proofpoint-GUID: Lj4wAEfHmsFMBIHlJjS6fPOWG8MAfzdj X-Proofpoint-ORIG-GUID: Lj4wAEfHmsFMBIHlJjS6fPOWG8MAfzdj X-Authority-Analysis: v=2.4 cv=JsX8bc4C c=1 sm=1 tr=0 ts=68d64023 cx=c_pps a=IZJwPbhc+fLeJZngyXXI0A==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=yJojWOMRYYMA:10 a=EUspDBNiAAAA:8 a=TrVKeqC-PG4e-vJ_ulQA:9 a=QEXdDO2ut3YA:10 a=uG9DUKGECoFWVXl0Dc02:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1117,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-09-26_02,2025-09-26_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 priorityscore=1501 spamscore=0 malwarescore=0 lowpriorityscore=0 bulkscore=0 clxscore=1015 phishscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2509150000 definitions=main-2509250171 To support following DisplayPort (DP) mode over the Type-C PHY, rename USB-specific functions and ops to clearly separate them from common or DP-related logic. This is a preparatory cleanup to enable USB + DP dual mode. Reviewed-by: Dmitry Baryshkov Signed-off-by: Xiangxu Yin --- drivers/phy/qualcomm/phy-qcom-qmp-usbc.c | 55 ++++++++++++++++------------= ---- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c b/drivers/phy/qualcom= m/phy-qcom-qmp-usbc.c index 5e7fcb26744a4401c3076960df9c0dcbec7fdef7..62920dd2aed39bbfddd54ba2682= e3d45d65a09c8 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c @@ -342,11 +342,10 @@ struct qmp_usbc { =20 struct mutex phy_mutex; =20 + struct phy *usb_phy; enum phy_mode mode; unsigned int usb_init_count; =20 - struct phy *phy; - struct clk_fixed_rate pipe_clk_fixed; =20 struct typec_switch_dev *sw; @@ -454,7 +453,7 @@ static const struct qmp_phy_cfg sdm660_usb3phy_cfg =3D { .regs =3D qmp_v3_usb3phy_regs_layout_qcm2290, }; =20 -static int qmp_usbc_init(struct phy *phy) +static int qmp_usbc_com_init(struct phy *phy) { struct qmp_usbc *qmp =3D phy_get_drvdata(phy); const struct qmp_phy_cfg *cfg =3D qmp->cfg; @@ -504,7 +503,7 @@ static int qmp_usbc_init(struct phy *phy) return ret; } =20 -static int qmp_usbc_exit(struct phy *phy) +static int qmp_usbc_com_exit(struct phy *phy) { struct qmp_usbc *qmp =3D phy_get_drvdata(phy); const struct qmp_phy_cfg *cfg =3D qmp->cfg; @@ -518,7 +517,7 @@ static int qmp_usbc_exit(struct phy *phy) return 0; } =20 -static int qmp_usbc_power_on(struct phy *phy) +static int qmp_usbc_usb_power_on(struct phy *phy) { struct qmp_usbc *qmp =3D phy_get_drvdata(phy); const struct qmp_phy_cfg *cfg =3D qmp->cfg; @@ -566,7 +565,7 @@ static int qmp_usbc_power_on(struct phy *phy) return ret; } =20 -static int qmp_usbc_power_off(struct phy *phy) +static int qmp_usbc_usb_power_off(struct phy *phy) { struct qmp_usbc *qmp =3D phy_get_drvdata(phy); const struct qmp_phy_cfg *cfg =3D qmp->cfg; @@ -587,20 +586,20 @@ static int qmp_usbc_power_off(struct phy *phy) return 0; } =20 -static int qmp_usbc_enable(struct phy *phy) +static int qmp_usbc_usb_enable(struct phy *phy) { struct qmp_usbc *qmp =3D phy_get_drvdata(phy); int ret; =20 mutex_lock(&qmp->phy_mutex); =20 - ret =3D qmp_usbc_init(phy); + ret =3D qmp_usbc_com_init(phy); if (ret) goto out_unlock; =20 - ret =3D qmp_usbc_power_on(phy); + ret =3D qmp_usbc_usb_power_on(phy); if (ret) { - qmp_usbc_exit(phy); + qmp_usbc_com_exit(phy); goto out_unlock; } =20 @@ -611,19 +610,19 @@ static int qmp_usbc_enable(struct phy *phy) return ret; } =20 -static int qmp_usbc_disable(struct phy *phy) +static int qmp_usbc_usb_disable(struct phy *phy) { struct qmp_usbc *qmp =3D phy_get_drvdata(phy); int ret; =20 qmp->usb_init_count--; - ret =3D qmp_usbc_power_off(phy); + ret =3D qmp_usbc_usb_power_off(phy); if (ret) return ret; - return qmp_usbc_exit(phy); + return qmp_usbc_com_exit(phy); } =20 -static int qmp_usbc_set_mode(struct phy *phy, enum phy_mode mode, int subm= ode) +static int qmp_usbc_usb_set_mode(struct phy *phy, enum phy_mode mode, int = submode) { struct qmp_usbc *qmp =3D phy_get_drvdata(phy); =20 @@ -632,10 +631,10 @@ static int qmp_usbc_set_mode(struct phy *phy, enum ph= y_mode mode, int submode) return 0; } =20 -static const struct phy_ops qmp_usbc_phy_ops =3D { - .init =3D qmp_usbc_enable, - .exit =3D qmp_usbc_disable, - .set_mode =3D qmp_usbc_set_mode, +static const struct phy_ops qmp_usbc_usb_phy_ops =3D { + .init =3D qmp_usbc_usb_enable, + .exit =3D qmp_usbc_usb_disable, + .set_mode =3D qmp_usbc_usb_set_mode, .owner =3D THIS_MODULE, }; =20 @@ -690,7 +689,7 @@ static int __maybe_unused qmp_usbc_runtime_suspend(stru= ct device *dev) =20 dev_vdbg(dev, "Suspending QMP phy, mode:%d\n", qmp->mode); =20 - if (!qmp->phy->init_count) { + if (!qmp->usb_init_count) { dev_vdbg(dev, "PHY not initialized, bailing out\n"); return 0; } @@ -710,7 +709,7 @@ static int __maybe_unused qmp_usbc_runtime_resume(struc= t device *dev) =20 dev_vdbg(dev, "Resuming QMP phy, mode:%d\n", qmp->mode); =20 - if (!qmp->phy->init_count) { + if (!qmp->usb_init_count) { dev_vdbg(dev, "PHY not initialized, bailing out\n"); return 0; } @@ -865,11 +864,11 @@ static int qmp_usbc_typec_switch_set(struct typec_swi= tch_dev *sw, qmp->orientation =3D orientation; =20 if (qmp->usb_init_count) { - qmp_usbc_power_off(qmp->phy); - qmp_usbc_exit(qmp->phy); + qmp_usbc_usb_power_off(qmp->usb_phy); + qmp_usbc_com_exit(qmp->usb_phy); =20 - qmp_usbc_init(qmp->phy); - qmp_usbc_power_on(qmp->phy); + qmp_usbc_com_init(qmp->usb_phy); + qmp_usbc_usb_power_on(qmp->usb_phy); } =20 mutex_unlock(&qmp->phy_mutex); @@ -1097,14 +1096,14 @@ static int qmp_usbc_probe(struct platform_device *p= dev) if (ret) goto err_node_put; =20 - qmp->phy =3D devm_phy_create(dev, np, &qmp_usbc_phy_ops); - if (IS_ERR(qmp->phy)) { - ret =3D PTR_ERR(qmp->phy); + qmp->usb_phy =3D devm_phy_create(dev, np, &qmp_usbc_usb_phy_ops); + if (IS_ERR(qmp->usb_phy)) { + ret =3D PTR_ERR(qmp->usb_phy); dev_err(dev, "failed to create PHY: %d\n", ret); goto err_node_put; } =20 - phy_set_drvdata(qmp->phy, qmp); + phy_set_drvdata(qmp->usb_phy, qmp); =20 of_node_put(np); =20 --=20 2.34.1 From nobody Wed Oct 1 23:35:02 2025 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 11BB528934D for ; Fri, 26 Sep 2025 07:26:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758871596; cv=none; b=UzfqNNwNyOsmGqkL7sABc+K+B00MKhONnTMxi3tpbY+BmFzSEr64TjjApd6M7MGFr1LHZAw8j7IcD2dvdwqP8Mf9B9lDJjzC+K8m+fy4JkEdM+vFfEfJzMocXncyeqbYztI+aQhLO9I+eK+dZhjk6rGNSmM0Xhnz2q32KAvGejs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758871596; c=relaxed/simple; bh=V+bmwYjKfMRV9O7yUHq5omi3q3vjjg0Qz8GTgu2JE4Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WD1gk95Ik4TDgflOwOdXh0Ru8qiUBddxD1JwhjHUhPUSPMsTJXWwRhtHftRCsR5KEhT5eIuYKUlquFkNtdIrbXv2DNtJsDYx1G8Ecqrk+C71QDJ5NlXUkgV21kbw+3xHEmisOX7a/H6NmyLGVL2M8lGHn2xudbrWgib1r+zv3Bk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=MUO36ulx; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="MUO36ulx" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 58Q6ocZ6011374 for ; Fri, 26 Sep 2025 07:26:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= xaxo68cQZZrWEEivhuCOX2owVkj5hniZ5EATwBZwjNk=; b=MUO36ulxe97L2OD9 1BqLZ//oeJKZlzPBFOMEWw0RJNvdw6Pf21HW9DNvxjAfqTZxX9lXGyjuCQOHTFqo Cgtxr9MURwmFGZMKjyP0sJ4AquEbrh2DoLj8M3GJ02OwcnvseyJfgH6amDgUSh++ SjJNEmhjL1cgfJG5odETXojel1Hs2Yewrcdsk23PxhoadICDqTXCNFgxtdAFi+o5 ixs0t+uhHIfw5b2pb3cgg315fB4f/+O8MUmvDkXxiY8YZYHfBJzyZN+kIudbBWET oBjXnOa1EJM4Uoje0/ngN90OBmzBlr1h66aond7InW7AA8Bc+ymf201AVd//d5uw fiYfDA== Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 49db0q1w1d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 26 Sep 2025 07:26:34 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-269b2d8af0cso4284755ad.2 for ; Fri, 26 Sep 2025 00:26:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758871593; x=1759476393; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xaxo68cQZZrWEEivhuCOX2owVkj5hniZ5EATwBZwjNk=; b=rHfrqCKLb4Wnf3DVOTSBzQBz5Aw7L7Qs1+GX1A15rvY8QdE+d0KJl+j2N/lNnxlg/a ySucxSWBYTpRv5Kg0zxMEjCsNVifW5ZLdFwG7guT3j8eGJCXxz1/cR5PzbD5QBTmXcvH m3A805Z/fEyA7TUqo8SLWDrS6UNIP2esdx+dIEReDAvB+Q0IDkRmIf4/jH827bQCj3R1 Y20F/RP1/Lfl6GF2epAHh9LVB2uyXkaAu3x7a0txuUs+2V7AQTrToT4q7lwjgmFG9hVX +BSOwhRBaayHsFhxqD4xm1UwEuCEx6XiHry2ILmZqSJiG9SlWP6qphUlwdlln/ZUy7g7 alZw== X-Forwarded-Encrypted: i=1; AJvYcCVIa5Z0T4tf5TY0oXPPWTRNSsT17dTXUUSSwViFD6YiFe3JRcjzCEI6h5bW2o+FHKUZaEZQsEhpqVaz/rA=@vger.kernel.org X-Gm-Message-State: AOJu0Yzpji9Gej5qOdlZKOqDuNEQyPoNtM2/mCsaJLb+DpfBayXmgF3S IF99O7qfZgTlPPX6uYfIGI3MoD2LrLOm+4Vd1AppQ83SDMuJq2J1QSpe19VfO8PZ9rq5yrp551N 9TzU0n1M5hlljhqFeAXQWg7lDYjsr3QYXZpn85gcYmwYSA1d7F+iEwo7Nj3ZbcqJovCw= X-Gm-Gg: ASbGncuRmcVNFCfosom/fTce0ksugw+14+yTfrXWypkgxjCnItk8GsqTGnEwPOMkonI uswp7Z1SrfWjp50cGuXLOU1jpQvbP698W2pjDy8sMaASjXdjjjZK9LZe6xlQPgrfJA7z8v0etha bynftXgXOOoe5bjJdk539+xGr+LFkD8Sp6ObywbLBUEockjKF/+0/gT8l4yE5LJtVM5kXhk5Y5d ANpH7+7yIgSpfCvoGtBH+2d6kSgDJNm0ZeyNPenS0VfFMW5xEg6kkqw0zigmErahs7geJp3khyd OYN0GYks6VEVn+sL39dEIfwWgDedSJg6ewi7eYUtjhT8fpZfF/ugHjUhG0K8igMHcbQ9ErFycaR ju8EDgMGxjzfALsPO16KSGQfv5S6BWYyiS/uuz7Ngmz33hZhN6hwIeNG4 X-Received: by 2002:a17:902:db11:b0:24e:af92:70de with SMTP id d9443c01a7336-27ed4a7e773mr47493205ad.7.1758871593445; Fri, 26 Sep 2025 00:26:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHtuIwETTdMuZFytO6gNG8pDDirIuQO50mBZZkHzCplsKRiXqaAce6j6yazHtoa1boWUkBnIg== X-Received: by 2002:a17:902:db11:b0:24e:af92:70de with SMTP id d9443c01a7336-27ed4a7e773mr47492965ad.7.1758871593007; Fri, 26 Sep 2025 00:26:33 -0700 (PDT) Received: from sziotdisp01-gv.qualcomm.com.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-27ed671d8a2sm45117985ad.55.2025.09.26.00.26.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Sep 2025 00:26:32 -0700 (PDT) From: Xiangxu Yin Date: Fri, 26 Sep 2025 15:25:39 +0800 Subject: [PATCH v7 03/14] phy: qcom: qmp-usbc: Add DP-related fields for USB/DP switchable PHY Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250926-add-displayport-support-for-qcs615-platform-v7-3-dc5edaac6c2b@oss.qualcomm.com> References: <20250926-add-displayport-support-for-qcs615-platform-v7-0-dc5edaac6c2b@oss.qualcomm.com> In-Reply-To: <20250926-add-displayport-support-for-qcs615-platform-v7-0-dc5edaac6c2b@oss.qualcomm.com> To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Sean Paul , Marijn Suijten , David Airlie , Simona Vetter Cc: linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, fange.zhang@oss.qualcomm.com, yongxing.mou@oss.qualcomm.com, li.liu@oss.qualcomm.com, Dmitry Baryshkov , Bjorn Andersson , Konrad Dybcio , Xiangxu Yin X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1758871562; l=3979; i=xiangxu.yin@oss.qualcomm.com; s=20241125; h=from:subject:message-id; bh=V+bmwYjKfMRV9O7yUHq5omi3q3vjjg0Qz8GTgu2JE4Q=; b=8Gw1TqMTIu4+SMDOsf2QNnJ1zb+xwdOWQ6J2y4ga7ZkzeMW8XD2pf5E9cnQQLlVs0je+aagaj NmrMOdI5mPgC9gOOCsgy43oMazsY2HtkgiGoJtjIMzdWF79TzMxQ05T X-Developer-Key: i=xiangxu.yin@oss.qualcomm.com; a=ed25519; pk=F1TwipJzpywfbt3n/RPi4l/A4AVF+QC89XzCHgZYaOc= X-Proofpoint-ORIG-GUID: ayAUiDhNoATGxeEUnu7oQFUnlU2xH4Ah X-Proofpoint-GUID: ayAUiDhNoATGxeEUnu7oQFUnlU2xH4Ah X-Authority-Analysis: v=2.4 cv=aZhsXBot c=1 sm=1 tr=0 ts=68d6402a cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=yJojWOMRYYMA:10 a=EUspDBNiAAAA:8 a=jm3WsR2aq1IkTfYpOVcA:9 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTI1MDE3MSBTYWx0ZWRfX6J3STx7l5Ifc Xs8yPKYBguZ+RdWfXNHdITUaqUcRGRDlJ3uV7SYyLi4R0iQfAxibDFzVpowugdkvlvDEh4V+0tV aWleFYo+MmpGd6C5r8dSwmNPE9FFa5a0tkaUiuC7UTGEc0h6Crdp0yQNQj5/TQZkE7cgQvcAd2v tj5+XM8CNZq5kxTxlrZ401jAEXakSRK0Ru4dVag4kp9KobVvQ0Zqn/fijNhSEPxHl8QPIXjcehE C1sH0DaQQ7hpPi9FYm6FhFSuFKqPwHN5UUMtCUXUFVqOWfgM3lHmGekjftgVXJKezymhtdvzVIp Q5tKcgG0jSle/bRu4u9ntYlZ3Fz8i7oJFMcFA8NFVaNchjAWdZFMk5TgYGXC31ppdGG9tELLtKl 18f4Yl4GzyUmV70rccucIipmu9Z1Sw== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1117,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-09-26_02,2025-09-26_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 priorityscore=1501 suspectscore=0 malwarescore=0 adultscore=0 clxscore=1015 impostorscore=0 bulkscore=0 lowpriorityscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2509150000 definitions=main-2509250171 Extend qmp_usbc_offsets and qmp_phy_cfg with DP-specific fields, including register offsets, init tables, and callback hooks. Also update qmp_usbc struct to track DP-related resources and state. This enables support for USB/DP switchable Type-C PHYs that operate in either mode. Reviewed-by: Dmitry Baryshkov Signed-off-by: Xiangxu Yin --- drivers/phy/qualcomm/phy-qcom-qmp-usbc.c | 54 +++++++++++++++++++++++++++-= ---- 1 file changed, 46 insertions(+), 8 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c b/drivers/phy/qualcom= m/phy-qcom-qmp-usbc.c index 62920dd2aed39bbfddd54ba2682e3d45d65a09c8..de28c3464a40ea97740e16fe78c= ba4b927911d92 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c @@ -293,13 +293,18 @@ struct qmp_usbc_offsets { /* for PHYs with >=3D 2 lanes */ u16 tx2; u16 rx2; + + u16 dp_serdes; + u16 dp_txa; + u16 dp_txb; + u16 dp_dp_phy; }; =20 -/* struct qmp_phy_cfg - per-PHY initialization config */ +struct qmp_usbc; struct qmp_phy_cfg { const struct qmp_usbc_offsets *offsets; =20 - /* Init sequence for PHY blocks - serdes, tx, rx, pcs */ + /* Init sequence for USB PHY blocks - serdes, tx, rx, pcs */ const struct qmp_phy_init_tbl *serdes_tbl; int serdes_tbl_num; const struct qmp_phy_init_tbl *tx_tbl; @@ -309,6 +314,27 @@ struct qmp_phy_cfg { const struct qmp_phy_init_tbl *pcs_tbl; int pcs_tbl_num; =20 + /* Init sequence for DP PHY blocks - serdes, tx, rbr, hbr, hbr2 */ + const struct qmp_phy_init_tbl *dp_serdes_tbl; + int dp_serdes_tbl_num; + const struct qmp_phy_init_tbl *dp_tx_tbl; + int dp_tx_tbl_num; + const struct qmp_phy_init_tbl *serdes_tbl_rbr; + int serdes_tbl_rbr_num; + const struct qmp_phy_init_tbl *serdes_tbl_hbr; + int serdes_tbl_hbr_num; + const struct qmp_phy_init_tbl *serdes_tbl_hbr2; + int serdes_tbl_hbr2_num; + + const u8 (*swing_tbl)[4][4]; + const u8 (*pre_emphasis_tbl)[4][4]; + + /* DP PHY callbacks */ + void (*dp_aux_init)(struct qmp_usbc *qmp); + void (*configure_dp_tx)(struct qmp_usbc *qmp); + int (*configure_dp_phy)(struct qmp_usbc *qmp); + int (*calibrate_dp_phy)(struct qmp_usbc *qmp); + /* regulators to be requested */ const char * const *vreg_list; int num_vregs; @@ -329,24 +355,36 @@ struct qmp_usbc { void __iomem *rx; void __iomem *tx2; void __iomem *rx2; - - struct regmap *tcsr_map; - u32 vls_clamp_reg; + void __iomem *dp_dp_phy; + void __iomem *dp_tx; + void __iomem *dp_tx2; + void __iomem *dp_serdes; =20 struct clk *pipe_clk; + struct clk_fixed_rate pipe_clk_fixed; + + struct clk_hw dp_link_hw; + struct clk_hw dp_pixel_hw; struct clk_bulk_data *clks; int num_clks; int num_resets; struct reset_control_bulk_data *resets; struct regulator_bulk_data *vregs; =20 + struct regmap *tcsr_map; + u32 vls_clamp_reg; + u32 dp_phy_mode_reg; + struct mutex phy_mutex; =20 struct phy *usb_phy; enum phy_mode mode; unsigned int usb_init_count; =20 - struct clk_fixed_rate pipe_clk_fixed; + struct phy *dp_phy; + unsigned int dp_aux_cfg; + struct phy_configure_opts_dp dp_opts; + unsigned int dp_init_count; =20 struct typec_switch_dev *sw; enum typec_orientation orientation; @@ -689,7 +727,7 @@ static int __maybe_unused qmp_usbc_runtime_suspend(stru= ct device *dev) =20 dev_vdbg(dev, "Suspending QMP phy, mode:%d\n", qmp->mode); =20 - if (!qmp->usb_init_count) { + if (!qmp->usb_init_count && !qmp->dp_init_count) { dev_vdbg(dev, "PHY not initialized, bailing out\n"); return 0; } @@ -709,7 +747,7 @@ static int __maybe_unused qmp_usbc_runtime_resume(struc= t device *dev) =20 dev_vdbg(dev, "Resuming QMP phy, mode:%d\n", qmp->mode); =20 - if (!qmp->usb_init_count) { + if (!qmp->usb_init_count && !qmp->dp_init_count) { dev_vdbg(dev, "PHY not initialized, bailing out\n"); return 0; } --=20 2.34.1 From nobody Wed Oct 1 23:35:02 2025 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 66DF7286D77 for ; Fri, 26 Sep 2025 07:26:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758871603; cv=none; b=s3lYpj2v1lY7GpYTx4ugtV4bNQfpH0Zx2xZwz+CGYfX3wx9MjXRx/C7wuKm5eN6XbqIeFQm5IsXCAN1dxMSiyohWA6tHvXfCOk6h9LQTqX9IVmTIlz6svG8THnGFWNVqg0vwR5UcNLTRqnTI0IcAL493FXFaGSyVx6N79NTfSIY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758871603; c=relaxed/simple; bh=ScND5R19fNR4fxgqnX3CVdg+GNtnOHYJhlmcXMGybGg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iMdgHlA1CzlXy6qn5FgZ2iZiHchcPCfDz0cU+7wAaDFgSxoT7prpRYPp3dwZNXO8JlJjUxwtW3FIvoxwiCVZzpiU/RmdlsGDPWppM1W3odJE5O62MOUffB6j8pn8nUPNCdVrXov9HpMrNTL/LoFXwv8j7PeTVzds88gJvktgvDA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=lcdzY8+4; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="lcdzY8+4" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 58Q702FT006031 for ; Fri, 26 Sep 2025 07:26:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= ph7HUhaBaiRojkAD3JbT6dqDUnW8cPmN0abiXHdzjwk=; b=lcdzY8+45Q584zCA QRnxVJrPlZktq2dplon92ol7t5p473evyuZmuab1of/TrftCyoOCQ05DSkkvE0Jj pKNBPkuhqNjCXLcUNzrIT2utJjxvR/0To/zz2QJh+dWHN7aNk5w6AkpT4tnVEpcq x02xFHYNPf4Ep4Csc0d5V/N9fvjDs1rD75x6qBvk/tEZlFeDjvQcFKyt7l/XkuCv OKeT9XEZ6/oxA5m1odjRCj4aenCl5BcGvNwCYnfu55OkVPCEiEG5ymtR7gE9RSuH TgqTNRYCNP+5XwXE0FPdmfrS2QkE5+JQuWh8HB56sUc0GP5Lx6Wpt9YYKLt89T0h p6mJ6A== Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 49db321vjh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 26 Sep 2025 07:26:41 +0000 (GMT) Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-b554a032e39so434979a12.3 for ; Fri, 26 Sep 2025 00:26:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758871601; x=1759476401; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ph7HUhaBaiRojkAD3JbT6dqDUnW8cPmN0abiXHdzjwk=; b=vZPQn83O8ihUjL6XM/AHhU3FhRNEkNaM9LjYi2rNqjPJIAN6v7q21pvhjgZodvz0gM vJg+5QnBLcx3wFIxZa3GZ6CKHeLsjD8F393V8+mm8o2Po5RiLaoZ76xVIWnW+FuePUkb qlLwR8G1JbJdTajREByix7DvoIEawOFpnKoYn22zy+yHbvDkj0ljC75ptbRlC86Kn5r6 Du30w+s/EiDVQHZTBoC4Bt4OF5J3YtWUXu8Pz4phNpFpcOEoyOJJUuDcRFTV00hsJlD+ BQSqiLge7zDtNw0YAoL7ha7yR5HTt3CBer6qb9ha0+U9E+ESvBc5L51Y8sBXhErpSTxe RWZg== X-Forwarded-Encrypted: i=1; AJvYcCXt3TDIILVisGQrIHwHesOPzGP6e/hIlCneHVQbjrXTMH6aHTm6YmgS+1053TilwACZ2yVoUgZhmqpiLb8=@vger.kernel.org X-Gm-Message-State: AOJu0YyeNHvh927e4bgz4+aFDnjb0lUe3jRPQ/1yTRGmOyv7ag4RZ/pL ktWTnm7n+QHGlnMTqOH9jb2gQ+J4SBgIPnSC7b7X+VHdx5qBbAGoECWD9ahPVMjrixqqUDSHe1p n7vGyeVah/oGpai05Jd+lWiHhdDKehaXqgxfl+mym7lI9lAA6efuChF0xhkeHnfGK6EROroV17k SCwg== X-Gm-Gg: ASbGncvqBPgLGl7SWWe1LlUfVSf2v7K2cEL8sh//Ir++Rke/0sLwwsJ5bYukyyV22qu ZJ97SsaSBYUvg43N75Gyk2TyBsCUKwdU47qU3ahVOXvCDl29WbHBgo8ZEdgB/SRmGLZV7fAE9GV eZmgNy6QKXy8pT4a3yTRfFhN0pBluaUyJpMYu64CqtZ8b0RWdKuVkJU5R1W1uyrUqXRAoSbucso 7OzEtyOl4c5lqKBOZgqMyZMmGwJaY5Qefsn3eWoz0I7wp6fRZ+IQn7q04VK8ZA+Ica+Se0QaeC4 SgPxkOiaW79Yx+SuhcfNw7pq1jXIbUOPkex79FMVVUbdlFObIF+vQMBkvChW4oujjaMqqy5gmsa 90VI67DF/bteqeLCXaFiClmxS76Ez00I/ZMG7zKweo6ZvWUWHa2Jv8tTb X-Received: by 2002:a17:902:e886:b0:274:944f:9d84 with SMTP id d9443c01a7336-27ed4a66e4bmr41068345ad.11.1758871600545; Fri, 26 Sep 2025 00:26:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHODL/foIPc/vImOn8UziuC4Zpy7ZHgp1f2EJiz+aCgHOwhMhAgQuOtz8+uUG2x/ioV5tv2Ag== X-Received: by 2002:a17:902:e886:b0:274:944f:9d84 with SMTP id d9443c01a7336-27ed4a66e4bmr41068165ad.11.1758871600028; Fri, 26 Sep 2025 00:26:40 -0700 (PDT) Received: from sziotdisp01-gv.qualcomm.com.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-27ed671d8a2sm45117985ad.55.2025.09.26.00.26.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Sep 2025 00:26:39 -0700 (PDT) From: Xiangxu Yin Date: Fri, 26 Sep 2025 15:25:40 +0800 Subject: [PATCH v7 04/14] phy: qcom: qmp-usbc: Add regulator init_load support Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250926-add-displayport-support-for-qcs615-platform-v7-4-dc5edaac6c2b@oss.qualcomm.com> References: <20250926-add-displayport-support-for-qcs615-platform-v7-0-dc5edaac6c2b@oss.qualcomm.com> In-Reply-To: <20250926-add-displayport-support-for-qcs615-platform-v7-0-dc5edaac6c2b@oss.qualcomm.com> To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Sean Paul , Marijn Suijten , David Airlie , Simona Vetter Cc: linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, fange.zhang@oss.qualcomm.com, yongxing.mou@oss.qualcomm.com, li.liu@oss.qualcomm.com, Dmitry Baryshkov , Bjorn Andersson , Konrad Dybcio , Xiangxu Yin X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1758871563; l=5441; i=xiangxu.yin@oss.qualcomm.com; s=20241125; h=from:subject:message-id; bh=ScND5R19fNR4fxgqnX3CVdg+GNtnOHYJhlmcXMGybGg=; b=JilRW12/cwSKH9uXb4YCzsMzmAHwczV/dMTBJ0+x5D+EOLPW/ukmoNYlEdlvelT+23gPue8jR L3puGEnpVrzDKhlYwLo5EoTxfEV258QfbUpE/f35Qm9todR/cb0QfWr X-Developer-Key: i=xiangxu.yin@oss.qualcomm.com; a=ed25519; pk=F1TwipJzpywfbt3n/RPi4l/A4AVF+QC89XzCHgZYaOc= X-Authority-Analysis: v=2.4 cv=ao6/yCZV c=1 sm=1 tr=0 ts=68d64031 cx=c_pps a=rz3CxIlbcmazkYymdCej/Q==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=yJojWOMRYYMA:10 a=EUspDBNiAAAA:8 a=6BFfyeCpfu5Dl7vuC9UA:9 a=QEXdDO2ut3YA:10 a=bFCP_H2QrGi7Okbo017w:22 X-Proofpoint-ORIG-GUID: D7m4WVSe0UDGz_Aqdp99EXYfAqnlducu X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTI1MDE3MiBTYWx0ZWRfX2Kg+/NqVSR1R LBhyGQNOn5ZqsxxGsqCtmJobxTIJv9TXjE9X5KdxrJUozDtziK/TRv9aZta61g4SuD1rHACqxOe Dy4U6X1AJUyXDaJq2HWcf4Di2ZaxSZwVopJ9BOaFyPDpnskEyaDtN2pJ6EhGrxyPrsg2lEV/ui9 Dctj9e0NUJ7PCHQayiwzqjgbG47gUPlNk+JoY1U8Dhdg+eBYOWZvaV4kkDXIT0LexV69qviYv6g 9LAS+c2A7KG3aT/9ZKaw6BhzmxbN9qYkYm+4Y+n3//wzDs1jIeew1taLfRoZq8Tjffrx12we+Mf 9OYT7NpzCKl3lq5Y1N2TMYDSIdOGn5QNjgutCcJXWTyDXi3tkd+IHfATQ7Ph/qzfPKONHoBfwJq 5wn+g97W4LNqSDmeYhg3Z8pM+6PTAw== X-Proofpoint-GUID: D7m4WVSe0UDGz_Aqdp99EXYfAqnlducu X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1117,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-09-26_02,2025-09-26_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 impostorscore=0 priorityscore=1501 suspectscore=0 phishscore=0 adultscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2509150000 definitions=main-2509250172 QMP USBC PHY drivers previously did not set init_load_uA for regulators, which could result in incorrect vote levels. This patch introduces regulator definitions with proper init_load_uA values based on each chip's power grid design. QCS615 USB3 PHY was previously reusing qcm2290_usb3phy_cfg, but its regulator requirements differ. A new qcs615_usb3phy_cfg is added to reflect the correct settings. Reviewed-by: Dmitry Baryshkov Signed-off-by: Xiangxu Yin --- drivers/phy/qualcomm/phy-qcom-qmp-usbc.c | 68 ++++++++++++++++++----------= ---- 1 file changed, 39 insertions(+), 29 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c b/drivers/phy/qualcom= m/phy-qcom-qmp-usbc.c index de28c3464a40ea97740e16fe78cba4b927911d92..3b48c69f9c3cb7daec495ebc281= b83fe34e56881 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c @@ -336,7 +336,7 @@ struct qmp_phy_cfg { int (*calibrate_dp_phy)(struct qmp_usbc *qmp); =20 /* regulators to be requested */ - const char * const *vreg_list; + const struct regulator_bulk_data *vreg_list; int num_vregs; =20 /* array of registers with different offsets */ @@ -428,9 +428,19 @@ static const char * const usb3phy_reset_l[] =3D { "phy_phy", "phy", }; =20 -/* list of regulators */ -static const char * const qmp_phy_vreg_l[] =3D { - "vdda-phy", "vdda-pll", +static const struct regulator_bulk_data qmp_phy_msm8998_vreg_l[] =3D { + { .supply =3D "vdda-phy", .init_load_uA =3D 68600 }, + { .supply =3D "vdda-pll", .init_load_uA =3D 14200 }, +}; + +static const struct regulator_bulk_data qmp_phy_sm2290_vreg_l[] =3D { + { .supply =3D "vdda-phy", .init_load_uA =3D 66100 }, + { .supply =3D "vdda-pll", .init_load_uA =3D 13300 }, +}; + +static const struct regulator_bulk_data qmp_phy_qcs615_vreg_l[] =3D { + { .supply =3D "vdda-phy", .init_load_uA =3D 50000 }, + { .supply =3D "vdda-pll", .init_load_uA =3D 20000 }, }; =20 static const struct qmp_usbc_offsets qmp_usbc_offsets_v3_qcm2290 =3D { @@ -454,8 +464,8 @@ static const struct qmp_phy_cfg msm8998_usb3phy_cfg =3D= { .rx_tbl_num =3D ARRAY_SIZE(msm8998_usb3_rx_tbl), .pcs_tbl =3D msm8998_usb3_pcs_tbl, .pcs_tbl_num =3D ARRAY_SIZE(msm8998_usb3_pcs_tbl), - .vreg_list =3D qmp_phy_vreg_l, - .num_vregs =3D ARRAY_SIZE(qmp_phy_vreg_l), + .vreg_list =3D qmp_phy_msm8998_vreg_l, + .num_vregs =3D ARRAY_SIZE(qmp_phy_msm8998_vreg_l), .regs =3D qmp_v3_usb3phy_regs_layout, }; =20 @@ -470,8 +480,8 @@ static const struct qmp_phy_cfg qcm2290_usb3phy_cfg =3D= { .rx_tbl_num =3D ARRAY_SIZE(qcm2290_usb3_rx_tbl), .pcs_tbl =3D qcm2290_usb3_pcs_tbl, .pcs_tbl_num =3D ARRAY_SIZE(qcm2290_usb3_pcs_tbl), - .vreg_list =3D qmp_phy_vreg_l, - .num_vregs =3D ARRAY_SIZE(qmp_phy_vreg_l), + .vreg_list =3D qmp_phy_sm2290_vreg_l, + .num_vregs =3D ARRAY_SIZE(qmp_phy_sm2290_vreg_l), .regs =3D qmp_v3_usb3phy_regs_layout_qcm2290, }; =20 @@ -486,8 +496,24 @@ static const struct qmp_phy_cfg sdm660_usb3phy_cfg =3D= { .rx_tbl_num =3D ARRAY_SIZE(sdm660_usb3_rx_tbl), .pcs_tbl =3D qcm2290_usb3_pcs_tbl, .pcs_tbl_num =3D ARRAY_SIZE(qcm2290_usb3_pcs_tbl), - .vreg_list =3D qmp_phy_vreg_l, - .num_vregs =3D ARRAY_SIZE(qmp_phy_vreg_l), + .vreg_list =3D qmp_phy_msm8998_vreg_l, + .num_vregs =3D ARRAY_SIZE(qmp_phy_msm8998_vreg_l), + .regs =3D qmp_v3_usb3phy_regs_layout_qcm2290, +}; + +static const struct qmp_phy_cfg qcs615_usb3phy_cfg =3D { + .offsets =3D &qmp_usbc_offsets_v3_qcm2290, + + .serdes_tbl =3D qcm2290_usb3_serdes_tbl, + .serdes_tbl_num =3D ARRAY_SIZE(qcm2290_usb3_serdes_tbl), + .tx_tbl =3D qcm2290_usb3_tx_tbl, + .tx_tbl_num =3D ARRAY_SIZE(qcm2290_usb3_tx_tbl), + .rx_tbl =3D qcm2290_usb3_rx_tbl, + .rx_tbl_num =3D ARRAY_SIZE(qcm2290_usb3_rx_tbl), + .pcs_tbl =3D qcm2290_usb3_pcs_tbl, + .pcs_tbl_num =3D ARRAY_SIZE(qcm2290_usb3_pcs_tbl), + .vreg_list =3D qmp_phy_qcs615_vreg_l, + .num_vregs =3D ARRAY_SIZE(qmp_phy_qcs615_vreg_l), .regs =3D qmp_v3_usb3phy_regs_layout_qcm2290, }; =20 @@ -773,23 +799,6 @@ static const struct dev_pm_ops qmp_usbc_pm_ops =3D { qmp_usbc_runtime_resume, NULL) }; =20 -static int qmp_usbc_vreg_init(struct qmp_usbc *qmp) -{ - const struct qmp_phy_cfg *cfg =3D qmp->cfg; - struct device *dev =3D qmp->dev; - int num =3D cfg->num_vregs; - int i; - - qmp->vregs =3D devm_kcalloc(dev, num, sizeof(*qmp->vregs), GFP_KERNEL); - if (!qmp->vregs) - return -ENOMEM; - - for (i =3D 0; i < num; i++) - qmp->vregs[i].supply =3D cfg->vreg_list[i]; - - return devm_regulator_bulk_get(dev, num, qmp->vregs); -} - static int qmp_usbc_reset_init(struct qmp_usbc *qmp, const char *const *reset_list, int num_resets) @@ -1097,7 +1106,8 @@ static int qmp_usbc_probe(struct platform_device *pde= v) =20 mutex_init(&qmp->phy_mutex); =20 - ret =3D qmp_usbc_vreg_init(qmp); + ret =3D devm_regulator_bulk_get_const(qmp->dev, qmp->cfg->num_vregs, + qmp->cfg->vreg_list, &qmp->vregs); if (ret) return ret; =20 @@ -1163,7 +1173,7 @@ static const struct of_device_id qmp_usbc_of_match_ta= ble[] =3D { .data =3D &qcm2290_usb3phy_cfg, }, { .compatible =3D "qcom,qcs615-qmp-usb3-phy", - .data =3D &qcm2290_usb3phy_cfg, + .data =3D &qcs615_usb3phy_cfg, }, { .compatible =3D "qcom,sdm660-qmp-usb3-phy", .data =3D &sdm660_usb3phy_cfg, --=20 2.34.1 From nobody Wed Oct 1 23:35:02 2025 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5694A2877D2 for ; Fri, 26 Sep 2025 07:26:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758871611; cv=none; b=G/MQa8Orm2sk33sFCNURsbonmmfonHmklzXbX0v9TZ9rVFnx5EO8fLJUcZc8DUw6Q5fnADu9LjkrVDItdCes5EXDx4HKlzlJbKsCcCM40elnbnOcqzk37b5yXr9WZINwcfzuKcUUgNxIzqlH5bBhjMPvqwJ6CCxpUtX8h2Ma/zg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758871611; c=relaxed/simple; bh=ELWG8LiwmiYEyfPeDUlMXNqM8qMgGsCS4xblAlTbEJQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WRsI0HV/qA1WVu4AOkKSrWFTQuOEvYEiDaytwo2tLsfj5Qf1I3ka/qiJcbQOsDbAfg6TmxsvCGi/5r5qS3BLkf95s3blREXSjVqd9K45r3h88ig2VDUjKWzmR4we9ZVnDZjsbCt+2WBPQZM0/nfkD1svvgHy/FAP7cA6blO4RBU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=Am2o/AMX; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="Am2o/AMX" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 58Q6t2P0000846 for ; Fri, 26 Sep 2025 07:26:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= psRlzFRQmGXeUGSfcVjnYNDBFIL2wBL8tNvEcKPV1ss=; b=Am2o/AMXBkDOuFFj BN0xG6G7ndAIzTRIHxAE36OEiTYgcM1VU8HPwWUq78Ip1cVhmPlC6GD7FLsngtG5 L/tZDjrIxOIUpVd0LVxZ0w9yLI+SDdsT24k20+VGXTA2TleoODYzrhjm2uINyXFf ZiWzyR4PucPH7V770vC9Sr9LT/Ine0VUnMF5iU2XJGQe404VH3Ghd7g/XZ+dNasA IejgBMNV7XNTSn3TNBlQnsmbTQczcuRvV9DFkfrdD5Cq14vTg3UgmRuyGP5NkDk1 cnjP+YNvxyfByuS91zl9Y65E1QPvjSr/utupNvDqAgKThWBsUq88H3NZ7L6X/kbw GDWs9g== Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 49db0tsw2w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 26 Sep 2025 07:26:49 +0000 (GMT) Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-b551016556eso429664a12.0 for ; Fri, 26 Sep 2025 00:26:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758871608; x=1759476408; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=psRlzFRQmGXeUGSfcVjnYNDBFIL2wBL8tNvEcKPV1ss=; b=vWg8VCW3g/kcuum1aTnBOZreqqEf+zFDnCuZ1JXKKvW65Etpaz4JOWGJZMnEXFBCFS nN1EsfyphJWnlO/YsFJgb6CHajWavobpBoHR5EXloz/0O7eEpkzRKbgLXJBy+k3QRI0e COQQ5Y6ikh8PYbzj7omJ17qB7PDzykFkTjMJV8gu1ujANp3u/IxYQ1RQAxzSlU/vRZ7U fuT7lJ5yUUn7IByzh6sKpNQQ2/Bd3O3eX5URHVpeOIKvNeKpn7twikbg2xScFt/HtiLv neYshoj1Cu1IQjpa/PtOenWTdy3y0OWvGj/pUFIL6MBpKXZbDo3KLQz2D/hyaWcQz1CX tAQg== X-Forwarded-Encrypted: i=1; AJvYcCW8Cum3IFzMr98TmLkW7HixpnGIepD3FBUZ+MPX4BbKrq67c38HWc8icqjW0JEoxAUetp9A3thWK9rM3VU=@vger.kernel.org X-Gm-Message-State: AOJu0YyN94OODNOZc4MAWru3Ehs1U6PDUmHH19690wPB08btBYrYAHI5 LP5NVELP4iH+z5kKcsyVbNgV6GW+GvG/PtPVXWPlxggg3QchGPJRTQBYUVoSnFPMdgc5vj8P1qI 9x+kMs10KEKBluBKFKy2JhCY+WJkOtE0+zzofk9swBXdzGz3+6rmLAnDiWNqp1eRrFuw= X-Gm-Gg: ASbGncsmrMBCl/ykIcS3qJRdpXUEL+pCseoxF1ARwFnoJlBvWhtw6WZcODa2Ss97afk 0R2J5/3bDSjnPC+WYBX+qFubOWsVgx+pW1L2ikgVLL6zBijY8BFNJhbZmpjyq+hUNcePru22jV2 rY5zHCllPCPcpaDlONL/nyDAQA50qr5JetUEDqqsVaR0pPRmdLHD8BH2muSxSUlyzdTAvl9DtEM 99fUGllZV5vYoLlSdI8BnNh1dexgHH1DKGtsEn2p/79GimQ/Qd5QfawZQ39EuMrTB4XMP6teHcE iegiUOwB2hhwEDiyYYMKsxYTZxPRHCEO8twDkJ17sxRvvad73T/ey3cjdN6IbZ+dZH9IXLv8MYX VL8gNnepYS2HK5U0c0LTnYoVqnio6771k1hJ9sUw5gAtO/qjcKGMCYLFi X-Received: by 2002:a17:902:a507:b0:25a:4437:dbb7 with SMTP id d9443c01a7336-27ed49d5fedmr27989945ad.4.1758871607679; Fri, 26 Sep 2025 00:26:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHxSAyhiw2MTcI/NmqZ98HAKqPc0hfqQBjKkbuKjAc9epuCdvKvreEt1D4+pSfhH0QsIo9TKw== X-Received: by 2002:a17:902:a507:b0:25a:4437:dbb7 with SMTP id d9443c01a7336-27ed49d5fedmr27989565ad.4.1758871607181; Fri, 26 Sep 2025 00:26:47 -0700 (PDT) Received: from sziotdisp01-gv.qualcomm.com.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-27ed671d8a2sm45117985ad.55.2025.09.26.00.26.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Sep 2025 00:26:46 -0700 (PDT) From: Xiangxu Yin Date: Fri, 26 Sep 2025 15:25:41 +0800 Subject: [PATCH v7 05/14] phy: qcom: qmp-usbc: Move reset config into PHY cfg Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250926-add-displayport-support-for-qcs615-platform-v7-5-dc5edaac6c2b@oss.qualcomm.com> References: <20250926-add-displayport-support-for-qcs615-platform-v7-0-dc5edaac6c2b@oss.qualcomm.com> In-Reply-To: <20250926-add-displayport-support-for-qcs615-platform-v7-0-dc5edaac6c2b@oss.qualcomm.com> To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Sean Paul , Marijn Suijten , David Airlie , Simona Vetter Cc: linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, fange.zhang@oss.qualcomm.com, yongxing.mou@oss.qualcomm.com, li.liu@oss.qualcomm.com, Dmitry Baryshkov , Bjorn Andersson , Konrad Dybcio , Xiangxu Yin X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1758871563; l=3375; i=xiangxu.yin@oss.qualcomm.com; s=20241125; h=from:subject:message-id; bh=ELWG8LiwmiYEyfPeDUlMXNqM8qMgGsCS4xblAlTbEJQ=; b=zmaVB07r32HmpVtcC+B5C54IYIVDvs8vEclG5sjAMe5L1XwWEnY4ERzGLG5jFl4Ib+AzZzwOO Eh2N5d9F6fcDBHXUGGh9YHirwHvVYYYGpwjrhJLv5FPRK30pA0p4H6/ X-Developer-Key: i=xiangxu.yin@oss.qualcomm.com; a=ed25519; pk=F1TwipJzpywfbt3n/RPi4l/A4AVF+QC89XzCHgZYaOc= X-Authority-Analysis: v=2.4 cv=I9Vohdgg c=1 sm=1 tr=0 ts=68d64039 cx=c_pps a=rz3CxIlbcmazkYymdCej/Q==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=yJojWOMRYYMA:10 a=EUspDBNiAAAA:8 a=zr9GHpnC6WUyfWqp_BsA:9 a=QEXdDO2ut3YA:10 a=bFCP_H2QrGi7Okbo017w:22 X-Proofpoint-GUID: LzL2R_HaPxAxPZkflySA8UycTA34sfG1 X-Proofpoint-ORIG-GUID: LzL2R_HaPxAxPZkflySA8UycTA34sfG1 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTI1MDE3MSBTYWx0ZWRfXxM8jz6k1vsux ly5kjsk4wFs/ai2XMCgrBi1AGAFH0CuBg5RQQbVDwse8O50NQ6jh41/65HJlHsTAHBMz/uj1Md/ TcbRDljZ5DiE694oSvf9Gn6kWeWRFH5FExGgTCBJot+t82O3Ki/BCBlwot87SBaKGYdjnSr8LFk YiodthYISrRrnzmgxJNrl+UIaoJFCfYFRz12QoN0hasFiJwupeUXiIh7vXJMhPpqHOIhMADrD7M 3SEstIuYfSltkORl6mpuq9tpeWiL2Bxa72jlw7ZSbL8+LnX7jXz/7vpqwQYaJsk8tKlD/YMhpi6 CktDcSR5pkRebDHy9L51hIb3P0QhQfSaynt598DS2v7c5l/cQpaT566dX3P81dy6dzv00aX6Fte sGP7mZ0GAyZkHUvELlrJuvrLnSGzGg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1117,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-09-26_02,2025-09-26_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 spamscore=0 adultscore=0 suspectscore=0 lowpriorityscore=0 priorityscore=1501 malwarescore=0 impostorscore=0 phishscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2509150000 definitions=main-2509250171 The original reset list only works for USB-only PHYs. USB3DP PHYs require different reset names such as "dp_phy", so they need a separate list. Moving reset configuration into qmp_phy_cfg allows per-PHY customization without adding special-case logic in DT parsing. The legacy DT path keeps using the old hardcoded list, while non-legacy paths use cfg->reset_list. Reviewed-by: Dmitry Baryshkov Signed-off-by: Xiangxu Yin --- drivers/phy/qualcomm/phy-qcom-qmp-usbc.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c b/drivers/phy/qualcom= m/phy-qcom-qmp-usbc.c index 3b48c69f9c3cb7daec495ebc281b83fe34e56881..f9e20f43435c050e33e9490343a= 4693a339d692a 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c @@ -335,7 +335,8 @@ struct qmp_phy_cfg { int (*configure_dp_phy)(struct qmp_usbc *qmp); int (*calibrate_dp_phy)(struct qmp_usbc *qmp); =20 - /* regulators to be requested */ + const char * const *reset_list; + int num_resets; const struct regulator_bulk_data *vreg_list; int num_vregs; =20 @@ -464,6 +465,8 @@ static const struct qmp_phy_cfg msm8998_usb3phy_cfg =3D= { .rx_tbl_num =3D ARRAY_SIZE(msm8998_usb3_rx_tbl), .pcs_tbl =3D msm8998_usb3_pcs_tbl, .pcs_tbl_num =3D ARRAY_SIZE(msm8998_usb3_pcs_tbl), + .reset_list =3D usb3phy_reset_l, + .num_resets =3D ARRAY_SIZE(usb3phy_reset_l), .vreg_list =3D qmp_phy_msm8998_vreg_l, .num_vregs =3D ARRAY_SIZE(qmp_phy_msm8998_vreg_l), .regs =3D qmp_v3_usb3phy_regs_layout, @@ -480,6 +483,8 @@ static const struct qmp_phy_cfg qcm2290_usb3phy_cfg =3D= { .rx_tbl_num =3D ARRAY_SIZE(qcm2290_usb3_rx_tbl), .pcs_tbl =3D qcm2290_usb3_pcs_tbl, .pcs_tbl_num =3D ARRAY_SIZE(qcm2290_usb3_pcs_tbl), + .reset_list =3D usb3phy_reset_l, + .num_resets =3D ARRAY_SIZE(usb3phy_reset_l), .vreg_list =3D qmp_phy_sm2290_vreg_l, .num_vregs =3D ARRAY_SIZE(qmp_phy_sm2290_vreg_l), .regs =3D qmp_v3_usb3phy_regs_layout_qcm2290, @@ -496,6 +501,8 @@ static const struct qmp_phy_cfg sdm660_usb3phy_cfg =3D { .rx_tbl_num =3D ARRAY_SIZE(sdm660_usb3_rx_tbl), .pcs_tbl =3D qcm2290_usb3_pcs_tbl, .pcs_tbl_num =3D ARRAY_SIZE(qcm2290_usb3_pcs_tbl), + .reset_list =3D usb3phy_reset_l, + .num_resets =3D ARRAY_SIZE(usb3phy_reset_l), .vreg_list =3D qmp_phy_msm8998_vreg_l, .num_vregs =3D ARRAY_SIZE(qmp_phy_msm8998_vreg_l), .regs =3D qmp_v3_usb3phy_regs_layout_qcm2290, @@ -512,6 +519,8 @@ static const struct qmp_phy_cfg qcs615_usb3phy_cfg =3D { .rx_tbl_num =3D ARRAY_SIZE(qcm2290_usb3_rx_tbl), .pcs_tbl =3D qcm2290_usb3_pcs_tbl, .pcs_tbl_num =3D ARRAY_SIZE(qcm2290_usb3_pcs_tbl), + .reset_list =3D usb3phy_reset_l, + .num_resets =3D ARRAY_SIZE(usb3phy_reset_l), .vreg_list =3D qmp_phy_qcs615_vreg_l, .num_vregs =3D ARRAY_SIZE(qmp_phy_qcs615_vreg_l), .regs =3D qmp_v3_usb3phy_regs_layout_qcm2290, @@ -1051,8 +1060,7 @@ static int qmp_usbc_parse_dt(struct qmp_usbc *qmp) "failed to get pipe clock\n"); } =20 - ret =3D qmp_usbc_reset_init(qmp, usb3phy_reset_l, - ARRAY_SIZE(usb3phy_reset_l)); + ret =3D qmp_usbc_reset_init(qmp, cfg->reset_list, cfg->num_resets); if (ret) return ret; =20 --=20 2.34.1 From nobody Wed Oct 1 23:35:02 2025 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6A9582882D3 for ; Fri, 26 Sep 2025 07:26:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758871619; cv=none; b=dIp9JQHQU8j2Ke+Vhx/y6BmChhqafMFS4h3qsh994eEfTr5XqfehsE5GNv3brC7Vx1mQqOgd57r1eyGoaGhfDdH19HDBWi2F3VMOAXLH1HAgxw0BRO/mlNgpEtXWmc12MzpiF5SFwYANFoJIV0mZ0koD6/M2UUphzCE8CGFId0Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758871619; c=relaxed/simple; bh=sQPoZH4tUo3UuB961LzXNvDbVN6wFgUyJ1ykO8QOYP0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=e44up0XDFBPNmguWDv2VucBoitV6K6Km6WnqCL/LpsAUwkaS8RBLvCAC1vZsLcCyL5qppZdLij8zYG0d3/cwrmjF1fYMiPuGagWKdVUYISNvmX+seuNWWSmX+ObkSDm2f8LNRbrEy3MIX3auziYfC1FAS6tbm6tbIF+y0hKP1/w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=XfWlCmZE; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="XfWlCmZE" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 58Q6mnUK007845 for ; Fri, 26 Sep 2025 07:26:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= FMgw8/M2F0KwYim6Nj5JuT6WMNpKSzRu3DCfLT5iw/8=; b=XfWlCmZEDn3jJxCy vmYktee1qJKKuMOvh7kV2o36vywOy2csQBP3fKJC8TZT9vtl/xI83eFEHsfz/PjA FfMUqaEf5+v9bbMFknUm27+pJdVBT978TWT2ienqrxImk9Zp7CMBDjF105cCqPkF oV6s1XxOYb7Q3o1SIfaOb31v+YLed6FuA5E/IgjTXO8sPJLtLeSM95ImxyJf1T8T IafWNSMornVMiQ9UXeZnw6w5LCS0Msmm5bYdkFvOrGhmRINWroMMYD+XKg+KvrMU SBhxJ9twsqwEiUbUg4r8F3/7WrbhcY2+DjogTo+XobvWcaKLw0XCuuPbYX6PAh2G k77kPA== Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 49db0vsvyp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 26 Sep 2025 07:26:56 +0000 (GMT) Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-32eb3736080so473151a91.3 for ; Fri, 26 Sep 2025 00:26:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758871615; x=1759476415; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FMgw8/M2F0KwYim6Nj5JuT6WMNpKSzRu3DCfLT5iw/8=; b=wafG768g6m7PBcajuppILl3+Y1ZnQ9zEtz0OO4cuaF6luRxWdpQj8pIJEn0/mMJ51S 45WE+dFyqvjWfGDA/twgReGG72VH+ih/Mvd5iIY5T9osiUuz6kTL2jdgRwwdNWQ9DHG2 cxRQZjVNENbs4mmTZcvRJC4kilPXcufjGKoZIACPmGPkc1e1UUw/VMbpjGrdP4LyweD0 L0jwzH0S0ax0AhQDnr+b4XovNDOtU5iVofkD6BOlQCMCuh8VSiNmHKi7/i80IaaPUKOP 8KFyxxgtdvGl2CVISg19P5egZfGYa33PH4Jn3tcnJBi6zW7QEONnHWcCOHoXwULjzA2q 4gkA== X-Forwarded-Encrypted: i=1; AJvYcCUzDMgeCAR7ZW9kjIFuGTereTX17FJOjp/csNfDBhxr1qM2D9vKwngdyBLpuJdf/wn/mgYaco1X47yBUKY=@vger.kernel.org X-Gm-Message-State: AOJu0YzsKu5TdybPS02aEL8VSPsYAPnCH5q3SoMo9hiEVM0Vjmq5ub/F 6MgUZErO+PPjfXrxaIOU4tMm+6pR+UkwXjgDD1jpkZ2qxHisutUKaSNJROyAHjp0b69vvdgzO53 rtDBGa0qG+Ks1Inp7Z571ewuU3CbsyFnKJJccLEqnacfUG0C5FdLuCqAiyZovLW+JNAw= X-Gm-Gg: ASbGnctOkrorhGBaRf0wGMSFNcBEcCLKKJwWwT26u9EJi6u9y74qCqEhYKvX2P8SXVK 1N0zk8iZ8aO/VPS+R2tt/srkKuI2xZy6RU9UZqomapVUNA1+0uBDcJpkwJ8Dr1NBHIpZ5KnH3Qj QyACr0ACnDHQCBeSiZyj7gHqsOo50Hvn2U8lKniIGDAlMCNvCAppq/l4Y1sz0tIorZ4Arw4cyqK owglo7usxsY079D43YahYYHwxP9YAQtA+zTkaVo70kaRWiES2oQC8kqa+Cblpf4iD0ZMIUUTs9G q1WdgJEJJopU08zsJmGqKC+uzuA628tFdqE4Tmq3FdmcZ+2wloBefIHZ+8uZXH3ETLuf7fK8Swt ctrt/Ml1SkD/aw+wjH0nK6BLVKda0gWFknw/QuyyGl442wudthiZRqjVQ X-Received: by 2002:a17:902:e886:b0:274:944f:9d84 with SMTP id d9443c01a7336-27ed4a66e4bmr41072985ad.11.1758871614613; Fri, 26 Sep 2025 00:26:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHsfi2wwW0tWeUBY8/O37c4Y9XpJiHSJa21/wL035u0q2mXXnzhro70UfmYHqzmO7iOK8lapg== X-Received: by 2002:a17:902:e886:b0:274:944f:9d84 with SMTP id d9443c01a7336-27ed4a66e4bmr41072765ad.11.1758871614026; Fri, 26 Sep 2025 00:26:54 -0700 (PDT) Received: from sziotdisp01-gv.qualcomm.com.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-27ed671d8a2sm45117985ad.55.2025.09.26.00.26.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Sep 2025 00:26:53 -0700 (PDT) From: Xiangxu Yin Date: Fri, 26 Sep 2025 15:25:42 +0800 Subject: [PATCH v7 06/14] phy: qcom: qmp-usbc: add DP link and vco_div clocks for DP PHY Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250926-add-displayport-support-for-qcs615-platform-v7-6-dc5edaac6c2b@oss.qualcomm.com> References: <20250926-add-displayport-support-for-qcs615-platform-v7-0-dc5edaac6c2b@oss.qualcomm.com> In-Reply-To: <20250926-add-displayport-support-for-qcs615-platform-v7-0-dc5edaac6c2b@oss.qualcomm.com> To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Sean Paul , Marijn Suijten , David Airlie , Simona Vetter Cc: linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, fange.zhang@oss.qualcomm.com, yongxing.mou@oss.qualcomm.com, li.liu@oss.qualcomm.com, Dmitry Baryshkov , Bjorn Andersson , Konrad Dybcio , Xiangxu Yin X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1758871563; l=8823; i=xiangxu.yin@oss.qualcomm.com; s=20241125; h=from:subject:message-id; bh=sQPoZH4tUo3UuB961LzXNvDbVN6wFgUyJ1ykO8QOYP0=; b=XXFbkkhdiDA++yzkTbAlNVJdQSHQ/w8nelb5pzTli3tQSIoeL4yLs1KMDwtxLgRjW4ABCFlbB 0kjfLiH5TShC4IAK5YW2LaOHmym/nqU8+vHWus5PZBM4KJsHbjCP5x/ X-Developer-Key: i=xiangxu.yin@oss.qualcomm.com; a=ed25519; pk=F1TwipJzpywfbt3n/RPi4l/A4AVF+QC89XzCHgZYaOc= X-Proofpoint-ORIG-GUID: UqWR2WKTvPNrabDgPKBy36TQbErXIyVE X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTI1MDE3MSBTYWx0ZWRfXzZ0Chw+cnf20 Z/i4U/7TlK89WmzVHqPbZKuNOI71wiITME6KUXjXxVzMIwWQGhUJjS50gx5zkTzNq2gvSnLmsSn mr8uWoymv6olfSolhn/tqsNyN/R4sGNvL9tiwIPtCjcMJR2pHZ+IpteJENKTjQSxWf4LtcJOTdj zT1Hfz5AGayUM68yv9lBScZTY8N23aaxypdCPMRtDAglq/xPDfFOT/FiXs4gZNK6AguOyxb8sBe ri5vPRGit/3BVnw5+tMk+dzfOfJQipP1k84zyYc9MwfpTAe6PgEp5khvtXykpAFRpBEwZxvNvKk IKPpOFaaL+XiCU8Tx6nJDEG9q7NX/oy8XYDkN68Aftwn+AG1dIx++7s3umoualBpCVXkab5N/4U pKCLfRQNXcKqC0JrJQ0xYwY35lcvuA== X-Authority-Analysis: v=2.4 cv=OstCCi/t c=1 sm=1 tr=0 ts=68d64040 cx=c_pps a=0uOsjrqzRL749jD1oC5vDA==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=yJojWOMRYYMA:10 a=EUspDBNiAAAA:8 a=LV3rUWBglltBUjuJGHkA:9 a=QEXdDO2ut3YA:10 a=mQ_c8vxmzFEMiUWkPHU9:22 X-Proofpoint-GUID: UqWR2WKTvPNrabDgPKBy36TQbErXIyVE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1117,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-09-26_02,2025-09-26_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 clxscore=1015 suspectscore=0 lowpriorityscore=0 priorityscore=1501 malwarescore=0 bulkscore=0 spamscore=0 phishscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2509150000 definitions=main-2509250171 USB3DP PHY requires link and vco_div clocks when operating in DP mode. Extend qmp_usbc_register_clocks and the clock provider logic to register these clocks along with the existing pipe clock, to support both USB and DP configurations. Reviewed-by: Dmitry Baryshkov Signed-off-by: Xiangxu Yin --- drivers/phy/qualcomm/phy-qcom-qmp-usbc.c | 210 +++++++++++++++++++++++++++= +++- 1 file changed, 204 insertions(+), 6 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c b/drivers/phy/qualcom= m/phy-qcom-qmp-usbc.c index f9e20f43435c050e33e9490343a4693a339d692a..7139f4dab82fd7b0d1362dddefb= a178465e76fa4 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c @@ -22,6 +22,7 @@ #include #include #include +#include =20 #include "phy-qcom-qmp-common.h" =20 @@ -851,9 +852,23 @@ static int qmp_usbc_clk_init(struct qmp_usbc *qmp) return devm_clk_bulk_get_optional(dev, num, qmp->clks); } =20 -static void phy_clk_release_provider(void *res) +static struct clk_hw *qmp_usbc_clks_hw_get(struct of_phandle_args *clkspec= , void *data) { - of_clk_del_provider(res); + struct qmp_usbc *qmp =3D data; + + if (clkspec->args_count =3D=3D 0) + return &qmp->pipe_clk_fixed.hw; + + switch (clkspec->args[0]) { + case QMP_USB43DP_USB3_PIPE_CLK: + return &qmp->pipe_clk_fixed.hw; + case QMP_USB43DP_DP_LINK_CLK: + return &qmp->dp_link_hw; + case QMP_USB43DP_DP_VCO_DIV_CLK: + return &qmp->dp_pixel_hw; + } + + return ERR_PTR(-EINVAL); } =20 /* @@ -878,12 +893,14 @@ static int phy_pipe_clk_register(struct qmp_usbc *qmp= , struct device_node *np) { struct clk_fixed_rate *fixed =3D &qmp->pipe_clk_fixed; struct clk_init_data init =3D { }; + char name[64]; int ret; =20 ret =3D of_property_read_string(np, "clock-output-names", &init.name); if (ret) { - dev_err(qmp->dev, "%pOFn: No clock-output-names\n", np); - return ret; + /* Clock name is not mandatory. */ + snprintf(name, sizeof(name), "%s::pipe_clk", dev_name(qmp->dev)); + init.name =3D name; } =20 init.ops =3D &clk_fixed_rate_ops; @@ -892,10 +909,184 @@ static int phy_pipe_clk_register(struct qmp_usbc *qm= p, struct device_node *np) fixed->fixed_rate =3D 125000000; fixed->hw.init =3D &init; =20 - ret =3D devm_clk_hw_register(qmp->dev, &fixed->hw); + return devm_clk_hw_register(qmp->dev, &fixed->hw); +} + + +/* + * Display Port PLL driver block diagram for branch clocks + * + * +------------------------------+ + * | DP_VCO_CLK | + * | | + * | +-------------------+ | + * | | (DP PLL/VCO) | | + * | +---------+---------+ | + * | v | + * | +----------+-----------+ | + * | | hsclk_divsel_clk_src | | + * | +----------+-----------+ | + * +------------------------------+ + * | + * +---------<---------v------------>----------+ + * | | + * +--------v----------------+ | + * | dp_phy_pll_link_clk | | + * | link_clk | | + * +--------+----------------+ | + * | | + * | | + * v v + * Input to DISPCC block | + * for link clk, crypto clk | + * and interface clock | + * | + * | + * +--------<------------+-----------------+---<---+ + * | | | + * +----v---------+ +--------v-----+ +--------v------+ + * | vco_divided | | vco_divided | | vco_divided | + * | _clk_src | | _clk_src | | _clk_src | + * | | | | | | + * |divsel_six | | divsel_two | | divsel_four | + * +-------+------+ +-----+--------+ +--------+------+ + * | | | + * v---->----------v-------------<------v + * | + * +----------+-----------------+ + * | dp_phy_pll_vco_div_clk | + * +---------+------------------+ + * | + * v + * Input to DISPCC block + * for DP pixel clock + * + */ +static int qmp_dp_pixel_clk_determine_rate(struct clk_hw *hw, struct clk_r= ate_request *req) +{ + switch (req->rate) { + case 1620000000UL / 2: + case 2700000000UL / 2: + /* 5.4 is same link rate as 2.7GHz, i.e. div 4 */ + return 0; + default: + return -EINVAL; + } +} + +static unsigned long qmp_dp_pixel_clk_recalc_rate(struct clk_hw *hw, unsig= ned long parent_rate) +{ + const struct qmp_usbc *qmp; + const struct phy_configure_opts_dp *dp_opts; + + qmp =3D container_of(hw, struct qmp_usbc, dp_pixel_hw); + + dp_opts =3D &qmp->dp_opts; + + switch (dp_opts->link_rate) { + case 1620: + return 1620000000UL / 2; + case 2700: + return 2700000000UL / 2; + case 5400: + return 5400000000UL / 4; + default: + return 0; + } +} + +static const struct clk_ops qmp_dp_pixel_clk_ops =3D { + .determine_rate =3D qmp_dp_pixel_clk_determine_rate, + .recalc_rate =3D qmp_dp_pixel_clk_recalc_rate, +}; + +static int qmp_dp_link_clk_determine_rate(struct clk_hw *hw, struct clk_ra= te_request *req) +{ + switch (req->rate) { + case 162000000: + case 270000000: + case 540000000: + return 0; + default: + return -EINVAL; + } +} + +static unsigned long qmp_dp_link_clk_recalc_rate(struct clk_hw *hw, unsign= ed long parent_rate) +{ + const struct qmp_usbc *qmp; + const struct phy_configure_opts_dp *dp_opts; + + qmp =3D container_of(hw, struct qmp_usbc, dp_link_hw); + dp_opts =3D &qmp->dp_opts; + + switch (dp_opts->link_rate) { + case 1620: + case 2700: + case 5400: + return dp_opts->link_rate * 100000; + default: + return 0; + } +} + +static const struct clk_ops qmp_dp_link_clk_ops =3D { + .determine_rate =3D qmp_dp_link_clk_determine_rate, + .recalc_rate =3D qmp_dp_link_clk_recalc_rate, +}; + +static int phy_dp_clks_register(struct qmp_usbc *qmp, struct device_node *= np) +{ + struct clk_init_data init =3D { }; + char name[64]; + int ret; + + snprintf(name, sizeof(name), "%s::link_clk", dev_name(qmp->dev)); + init.ops =3D &qmp_dp_link_clk_ops; + init.name =3D name; + qmp->dp_link_hw.init =3D &init; + ret =3D devm_clk_hw_register(qmp->dev, &qmp->dp_link_hw); + if (ret < 0) { + dev_err(qmp->dev, "link clk reg fail ret=3D%d\n", ret); + return ret; + } + + snprintf(name, sizeof(name), "%s::vco_div_clk", dev_name(qmp->dev)); + init.ops =3D &qmp_dp_pixel_clk_ops; + init.name =3D name; + qmp->dp_pixel_hw.init =3D &init; + ret =3D devm_clk_hw_register(qmp->dev, &qmp->dp_pixel_hw); + if (ret) { + dev_err(qmp->dev, "pxl clk reg fail ret=3D%d\n", ret); + return ret; + } + + return 0; +} + +static void phy_clk_release_provider(void *res) +{ + of_clk_del_provider(res); +} + +static int qmp_usbc_register_clocks(struct qmp_usbc *qmp, struct device_no= de *np) +{ + struct clk_fixed_rate *fixed =3D &qmp->pipe_clk_fixed; + int ret; + + ret =3D phy_pipe_clk_register(qmp, np); if (ret) return ret; =20 + if (qmp->dp_serdes !=3D 0) { + ret =3D phy_dp_clks_register(qmp, np); + if (ret) + return ret; + } + + if (np =3D=3D qmp->dev->of_node) + return devm_of_clk_add_hw_provider(qmp->dev, qmp_usbc_clks_hw_get, qmp); + ret =3D of_clk_add_hw_provider(np, of_clk_hw_simple_get, &fixed->hw); if (ret) return ret; @@ -1040,6 +1231,13 @@ static int qmp_usbc_parse_dt(struct qmp_usbc *qmp) if (IS_ERR(base)) return PTR_ERR(base); =20 + if (offs->dp_serdes !=3D 0) { + qmp->dp_serdes =3D base + offs->dp_serdes; + qmp->dp_tx =3D base + offs->dp_txa; + qmp->dp_tx2 =3D base + offs->dp_txb; + qmp->dp_dp_phy =3D base + offs->dp_dp_phy; + } + qmp->serdes =3D base + offs->serdes; qmp->pcs =3D base + offs->pcs; if (offs->pcs_misc) @@ -1148,7 +1346,7 @@ static int qmp_usbc_probe(struct platform_device *pde= v) */ pm_runtime_forbid(dev); =20 - ret =3D phy_pipe_clk_register(qmp, np); + ret =3D qmp_usbc_register_clocks(qmp, np); if (ret) goto err_node_put; =20 --=20 2.34.1 From nobody Wed Oct 1 23:35:02 2025 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 24F84296BD8 for ; Fri, 26 Sep 2025 07:27:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758871625; cv=none; b=cc1pTa9gSdy0ofEt8XXRVff968zpso0Eh49SGpG6yK4xR4YHDb+MSTYbzkPcPIGAlztgvaDoNYPVMXexmg8EqlCJI9Z5ojzXoWTaKzayd6IJjzL/HvwpeX45VvX+8euiN5Fii0/gDNj5OJfgnXFeD+v52oJ0jjsCjXHF8HF+y4M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758871625; c=relaxed/simple; bh=2OW0hX9TF4LQlObLysgxoFrzLXkqUgu/cavYoT3SHP8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=k6/+2J3qsqA3Ox6xOU5rwjio6XCwnaejp2V1RWWHx6yoLnL9MXa9HOeTlZMMqje8QW0JD/U38SzNfjMdP4g+gln/KFAim8HwbiJS67swaohetvCwoMFoWc0yprdkQquR7W1HNLa5mhrJpMjP3zpuJXWaNjFKDzc34U6jJbr1ZNM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=RPr50GtY; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="RPr50GtY" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 58Q6p672014879 for ; Fri, 26 Sep 2025 07:27:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= IxgE0hKaY239kxGeqZ+8x/JCG89cRYkF0bkaQ2dVCzM=; b=RPr50GtYbu331Fr7 6uqZL8bF1SLiEM8h0rMRK7Udfa0FjSNLHTAH536sn9KLs5OZwRYgoA0+MYVxfnIb +DtCXyrAdMytGHio40wjlWUA8g7rOC2uLsbGJt8mUilxcve6RT9HIuv8VdTfDLeF fekZsobX+NLsC9IJcHUXF1uLM862eOqTFNCkq3JNeY3jIx3F+hNNo/VSxGXyhoHI 6qxyyi/3fl2UpMVBoOGpUALAZRzpmq6teE84eJf9tu/yUQsggNgUqncj9GzMOUiI zkxys/hj4LXHOmzzIU7u9jvRbvo8vtKss+g9ejNzRuuNKMTDj8yWksKirSWmTmrU CaunvQ== Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 49db0t9wrs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 26 Sep 2025 07:27:03 +0000 (GMT) Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-33085281806so583486a91.1 for ; Fri, 26 Sep 2025 00:27:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758871622; x=1759476422; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IxgE0hKaY239kxGeqZ+8x/JCG89cRYkF0bkaQ2dVCzM=; b=jHUw1ClfOU95WQSpWFktY4L8WZrPp8vqyFVnE8OUj4YDB103C8GXAWxTFHrgUBYFcK Bm0GwULHBgcvUalUp/JSlECpz/UvrS3l+DypWEsalikQGFKl9jy4jz9UJKOVqE/LbKuE p9k02TK44ykY8CQlBSnN6c5azLbnhBD3wXM4Acy+RJm97W0cIv7Ta3GIuRlMoGM9D8T3 UqHJme5M/qX7Ggzd1BPbinjmdHTicYyqlmHPpQ2LUXndFrurva4hm8d3hgTQ+Wi3TwAt pEAbKW6YptruV6vRfHMerrRfWCLyoFG5DsQwO+KEeHkknxz6npHOosQpsaP0NqEP6rwT G3Lw== X-Forwarded-Encrypted: i=1; AJvYcCWQvZwSBegVEbOMPylzDUbygx3IBOIwfOAeA0Bh6X2ISnc04yy5l5AXe0Wf98o6xVpm91BrcTRjx1xwygU=@vger.kernel.org X-Gm-Message-State: AOJu0YxwwJWVqxEeK6tj2PxHTRGdJ+jD1sIif+8k7hXDLcBf1IF8RdwK zF2+telG7cMhqaCenAyj4ikpEVP6ZL7CcAy6aH8Lutkek4oJGfcG5O4pcIxTho9+WhRBkUQbwI+ S15n66TZO9rao9vofyWCUfVgTb+ZNQr9bBVq7asksNPhjV/G0xHrpxwOxOswcnc5XBQA= X-Gm-Gg: ASbGncuRdr/vo+U4zomja8dEyfuYooU9sWDI0t1ffpxO+PDD4YdpyS2Ns4s66A2N/LN dMHHfxwlSJ92SbEG45WeqHXni4z4L8MR2IOKaFNQa463sYbXoKOgy3rJ3Fo5Hu5nyDjqTMvOdRR XqsSJavfRWMY8VCPUNyr8oRdxKBGBUOwEKdzNAxwCp0zIvTuakEeA+J3hxUhvRaY/WUjWZmLrTT U9b+fm+5jNcDeThyLyyADeq+qbbMwlin60W8z1X64lDBVRElghE7ug2Y3ivpgVm6eDb3n4eytmk kNtO9lIkpWOJ5MzojF2VlTy8A5QawVzYNhNGmdpP9He3BrPod1PvIUPHartRp27++PbV6l6zO7Q hihZ59fPoGoLiXeNA0KvV6WgE5tE8QZgBGQLjTHn3QgS0DyzrdHsRSXET X-Received: by 2002:a17:902:ec85:b0:272:f27d:33bd with SMTP id d9443c01a7336-27ed44d5f06mr43818375ad.0.1758871621622; Fri, 26 Sep 2025 00:27:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IELcGDRUyHhDjRuK+sfwMHvaCkFijxaFU/1OQEc5tsi7wGyfqnm7Rd7vXgkx97Obwa2yIJ71Q== X-Received: by 2002:a17:902:ec85:b0:272:f27d:33bd with SMTP id d9443c01a7336-27ed44d5f06mr43817965ad.0.1758871621114; Fri, 26 Sep 2025 00:27:01 -0700 (PDT) Received: from sziotdisp01-gv.qualcomm.com.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-27ed671d8a2sm45117985ad.55.2025.09.26.00.26.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Sep 2025 00:27:00 -0700 (PDT) From: Xiangxu Yin Date: Fri, 26 Sep 2025 15:25:43 +0800 Subject: [PATCH v7 07/14] phy: qcom: qmp-usbc: Move USB-only init to usb_power_on Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250926-add-displayport-support-for-qcs615-platform-v7-7-dc5edaac6c2b@oss.qualcomm.com> References: <20250926-add-displayport-support-for-qcs615-platform-v7-0-dc5edaac6c2b@oss.qualcomm.com> In-Reply-To: <20250926-add-displayport-support-for-qcs615-platform-v7-0-dc5edaac6c2b@oss.qualcomm.com> To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Sean Paul , Marijn Suijten , David Airlie , Simona Vetter Cc: linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, fange.zhang@oss.qualcomm.com, yongxing.mou@oss.qualcomm.com, li.liu@oss.qualcomm.com, Dmitry Baryshkov , Bjorn Andersson , Konrad Dybcio , Xiangxu Yin X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1758871563; l=2424; i=xiangxu.yin@oss.qualcomm.com; s=20241125; h=from:subject:message-id; bh=2OW0hX9TF4LQlObLysgxoFrzLXkqUgu/cavYoT3SHP8=; b=o+EwyMZL/K98MOCjTKEANPF15zjybJyWzaygL2LdekPrK23Nbpo2cRjW2t65GTczfpyFcNO1A Kq6j6hcnQLdCpTI5xm9JEDlxg1/Xuwp+qm75/ijFHpz6J4XrHFoaCPB X-Developer-Key: i=xiangxu.yin@oss.qualcomm.com; a=ed25519; pk=F1TwipJzpywfbt3n/RPi4l/A4AVF+QC89XzCHgZYaOc= X-Proofpoint-ORIG-GUID: 5W5zrfGvH56KJO0VILdBpye6ke69_gvL X-Proofpoint-GUID: 5W5zrfGvH56KJO0VILdBpye6ke69_gvL X-Authority-Analysis: v=2.4 cv=Jvz8bc4C c=1 sm=1 tr=0 ts=68d64047 cx=c_pps a=0uOsjrqzRL749jD1oC5vDA==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=yJojWOMRYYMA:10 a=EUspDBNiAAAA:8 a=JIg05Gv9We-wtn8mShgA:9 a=QEXdDO2ut3YA:10 a=mQ_c8vxmzFEMiUWkPHU9:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTI1MDE3MSBTYWx0ZWRfX8/WHykC1FOdZ qnuzfKnoiF2YAD31oOypohMPtCOSr/qxiqYPaSJM6GV9Bu5rdML5U6QUZVF0maICm9jJXNOTMvm x9/p5iSueer3k5eSa2IHJVsREfLjq2yJZe3HKjCuFxahr99dUHxQx/3ekYKIe6vD7LwfdTv9auJ yqWhiV2iipSJ5a6j+mQqdvkvv1zlHWtd4/5JvDk2wnANpCm4ypwB3bKi9nRNoSfcGRP3G4YvjYj Bo46E1dV85EllRIF8SYkFBPM2UiPNX+VNM3emo06+GoHcTjJ88y+G7Kv8Y1NkapF+YWUw3quP2Y Bg5SgvPAv2sRbN+TYeKDRCc1ezLbuCPJE7esp9J9u6pkRDMd2seH/0Zjd88LTSX9/n/UHyMNOvZ SPtIjCPLX5OLrdxtQkz03yZdKDLUMQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1117,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-09-26_02,2025-09-26_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 malwarescore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 suspectscore=0 spamscore=0 priorityscore=1501 adultscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2509150000 definitions=main-2509250171 The current implementation programs USB-specific registers in qmp_usbc_com_init(), which is shared by both USB and DP modes. This causes unnecessary configuration when the PHY is used for DP. Move USB-only register setup from com_init to qmp_usbc_usb_power_on, so it runs only for USB mode. Reviewed-by: Dmitry Baryshkov Signed-off-by: Xiangxu Yin --- drivers/phy/qualcomm/phy-qcom-qmp-usbc.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c b/drivers/phy/qualcom= m/phy-qcom-qmp-usbc.c index 7139f4dab82fd7b0d1362dddefba178465e76fa4..a971bdc3e767727e69ea07b14d9= a036347d365f4 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c @@ -30,6 +30,8 @@ #include "phy-qcom-qmp-pcs-misc-v3.h" =20 #define PHY_INIT_COMPLETE_TIMEOUT 10000 +#define SW_PORTSELECT_VAL BIT(0) +#define SW_PORTSELECT_MUX BIT(1) =20 /* set of registers with offsets different per-PHY */ enum qphy_reg_layout { @@ -531,8 +533,6 @@ static int qmp_usbc_com_init(struct phy *phy) { struct qmp_usbc *qmp =3D phy_get_drvdata(phy); const struct qmp_phy_cfg *cfg =3D qmp->cfg; - void __iomem *pcs =3D qmp->pcs; - u32 val =3D 0; int ret; =20 ret =3D regulator_bulk_enable(cfg->num_vregs, qmp->vregs); @@ -557,16 +557,6 @@ static int qmp_usbc_com_init(struct phy *phy) if (ret) goto err_assert_reset; =20 - qphy_setbits(pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], SW_PWRDN); - -#define SW_PORTSELECT_VAL BIT(0) -#define SW_PORTSELECT_MUX BIT(1) - /* Use software based port select and switch on typec orientation */ - val =3D SW_PORTSELECT_MUX; - if (qmp->orientation =3D=3D TYPEC_ORIENTATION_REVERSE) - val |=3D SW_PORTSELECT_VAL; - writel(val, qmp->pcs_misc); - return 0; =20 err_assert_reset: @@ -599,6 +589,14 @@ static int qmp_usbc_usb_power_on(struct phy *phy) unsigned int val; int ret; =20 + qphy_setbits(qmp->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], SW_PWRDN); + + /* Use software based port select and switch on typec orientation */ + val =3D SW_PORTSELECT_MUX; + if (qmp->orientation =3D=3D TYPEC_ORIENTATION_REVERSE) + val |=3D SW_PORTSELECT_VAL; + writel(val, qmp->pcs_misc); + qmp_configure(qmp->dev, qmp->serdes, cfg->serdes_tbl, cfg->serdes_tbl_num); =20 --=20 2.34.1 From nobody Wed Oct 1 23:35:02 2025 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6508E2874FC for ; Fri, 26 Sep 2025 07:27:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758871632; cv=none; b=UVA4PGZsmnpQU4IpIF6oaO49Bo9p8RRpr5ezT3xWMc3SDgvmH28Uh2c3/WBPMLW7nI/yQogtTDjObR7fdZwdWjF5zM9XAVrhGCACLKAiLDLt+7fd21gquGvNnMYnliKh6rKIdbeOWXSI3nE7nYp98MR6Abr1c6fTAeiFbd1+mJg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758871632; c=relaxed/simple; bh=oQp9DwFQdYQWDdvU1iDKEeRn3mcSQ7RLuxSrcgehlKo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Rl5sW9aIGIqx/FjYOD2fipyu15WzNhovctBFdG1GOny5ot1lTppvk9LnZtheHWKXdCIi+VNY9h1y//sFBsQV0jtAAAxzlI5f+j12/5zdREVtkjQTA9jNu1mWexduyWg9e3SzeBqCTSk5WJiwR/Q1wLR7aFAif10qdUoi3co1ajQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=lkDAmd/c; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="lkDAmd/c" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 58Q71A59000853 for ; Fri, 26 Sep 2025 07:27:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= lBHyWqd8iRjW0Q2gzYVRQmCW7nBgory1hKdsYJUUAsI=; b=lkDAmd/c+gItPHky MG1ymVUnjm+C75EZKgwjM5cRBYektJOe3+J6v1OM4GtT0pXLwPknTxX/z+kehlpS 1qpPRhY35bCN7Nz4JtSGWSK1+xNdS3+PzAKJGeSm+kOtqaIiUhoRLOs1hykqfXua XEryZK/0xKFyjhI1iv70tJ8UTgTi+1HvmsZ3H5dLjQajMPTr9elVEou+W6PM0UEi CScAFHYyQoUcpYtxcq6rFJWBc9A/GT+nCfnwYBx3oLh1XfcSkyiJ+TLi+Xj+jzm8 Aq2TL+pPUyTM5P3DHqhKOZavvkRIXAq6caHglKort7bfbvrrOt5ngkkIrv405vEi VCqykA== Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 49db0tsw4u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 26 Sep 2025 07:27:10 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-25bcad10907so4516735ad.1 for ; Fri, 26 Sep 2025 00:27:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758871629; x=1759476429; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lBHyWqd8iRjW0Q2gzYVRQmCW7nBgory1hKdsYJUUAsI=; b=psfL84L0J0aNPdMRrkfUIYoAc2RXfZZOckvMtdSwuW6YjqXIuoWeDkpqOhebw9/46Y uDf56BCuPUbe6w9jR0Ui5HQo9TjXWnozhZhEhUgTQiUqWrPX1mgtDCw1s/ogF9KwYwA9 GH+7NlfPP9P+w+QYEe38J9e+DKuFRMHNKLRVsDJRErsrSdzdZZ30yF84BND4WovHUnb3 f2LzADX035OQt0vBxP0zKaUglquOeRg8P0tJGqyON81dU85SbG1KUSHYOqe8yMPzCjkg D2d4rmyJ0LEDPJV24hWnUXTQk/xsJBdgzuQJGvWke18iMDiwdUUNUbjeRUZhqVUS676o ey0Q== X-Forwarded-Encrypted: i=1; AJvYcCVcT8UI1GerIjX9b4jtBPzgmjCxUEZnLCPXzbTF0HZ5/0EuMBI+Yt7nSY2q48pBHMqLblZRX1B2P+b5ngc=@vger.kernel.org X-Gm-Message-State: AOJu0YxQFGaULGu8LwTEimTN1Zhk1hQvpwUc800U3gZ8xdW+twx8s3DP v+qbB9tbkZBKneK9c/y/U5y40QheeWJEqjTdh2/5Y+qYLn8cPzbiFTzkClTu2tS9S+NGGBJkQIF BXnEH8NmvuTG+sFqsLQIfT4TyTCpoyJa1ljQcPQcoerXcgH9q0RJAgh92rtIVlCSlbU0= X-Gm-Gg: ASbGncvMrX0D5KlmTcr6qLCOrJ2YyBwmuEThidoBo+GpeOPOQ/+un887E9874Dmm0OB ZI+Mvy8WppUeCtWo1xtESRTxJMtjpQVn9BuyI6PcdxXwFZ+3JZ7mtM6shLAa3ozuFevyvGc5zi9 gLcGr8lx1qLTlzvpqgySzklaVUPsaKToJV4TEv99sz1yE3BQtmgXh7xqbNFVkGXyhEQyNTVDZsp Xq0USztDUDO4Rqd9nSePD8PdNZd2BZrM3psQ8bPNfX1Dx7ixRwVMqFRnj1Yks6E3kxmQJtuEWHC MkY0cwc5R8IbKiDnD37tcZ+CZRhTHfSXgJK7x46zbV/79lId4mfPDPPXDR4adLBgug0dHfO+Lz3 eIQasLxzRsb/3toYaVPKCKwH1+TpnCmyFHoIIOD6tU4VAIh7KNLLb+IYV X-Received: by 2002:a17:902:f551:b0:25c:b66e:9c2a with SMTP id d9443c01a7336-27ed4a36409mr41153765ad.6.1758871628851; Fri, 26 Sep 2025 00:27:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE+O099xujjC/yO29xVuYREkkBiX2GXu9s5RriPjceCnhs9oR7nstztkgV9IiUszESNtEahwA== X-Received: by 2002:a17:902:f551:b0:25c:b66e:9c2a with SMTP id d9443c01a7336-27ed4a36409mr41153415ad.6.1758871628393; Fri, 26 Sep 2025 00:27:08 -0700 (PDT) Received: from sziotdisp01-gv.qualcomm.com.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-27ed671d8a2sm45117985ad.55.2025.09.26.00.27.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Sep 2025 00:27:07 -0700 (PDT) From: Xiangxu Yin Date: Fri, 26 Sep 2025 15:25:44 +0800 Subject: [PATCH v7 08/14] phy: qcom: qmp-usbc: Add TCSR parsing and PHY mode setting Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250926-add-displayport-support-for-qcs615-platform-v7-8-dc5edaac6c2b@oss.qualcomm.com> References: <20250926-add-displayport-support-for-qcs615-platform-v7-0-dc5edaac6c2b@oss.qualcomm.com> In-Reply-To: <20250926-add-displayport-support-for-qcs615-platform-v7-0-dc5edaac6c2b@oss.qualcomm.com> To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Sean Paul , Marijn Suijten , David Airlie , Simona Vetter Cc: linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, fange.zhang@oss.qualcomm.com, yongxing.mou@oss.qualcomm.com, li.liu@oss.qualcomm.com, Dmitry Baryshkov , Bjorn Andersson , Konrad Dybcio , Xiangxu Yin X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1758871564; l=2826; i=xiangxu.yin@oss.qualcomm.com; s=20241125; h=from:subject:message-id; bh=oQp9DwFQdYQWDdvU1iDKEeRn3mcSQ7RLuxSrcgehlKo=; b=5At+q9+DnToGjvm7JMgfhDG/u1O0nUC5yiheYa8olWBceN5UNjNGS0ctGUNJs5yiRruaCRpoW Ug2K5mb7goTClU9tN6MRx+HQIYAxz5hnlhHOMwLEuoKL+Cz9JMOcGUo X-Developer-Key: i=xiangxu.yin@oss.qualcomm.com; a=ed25519; pk=F1TwipJzpywfbt3n/RPi4l/A4AVF+QC89XzCHgZYaOc= X-Authority-Analysis: v=2.4 cv=I9Vohdgg c=1 sm=1 tr=0 ts=68d6404e cx=c_pps a=JL+w9abYAAE89/QcEU+0QA==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=yJojWOMRYYMA:10 a=EUspDBNiAAAA:8 a=NTL_5ILWjaOn02JYBUkA:9 a=QEXdDO2ut3YA:10 a=324X-CrmTo6CU4MGRt3R:22 X-Proofpoint-GUID: RaGzwJ0CFKYooxXusQQISfdKzsrI1aLJ X-Proofpoint-ORIG-GUID: RaGzwJ0CFKYooxXusQQISfdKzsrI1aLJ X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTI1MDE3MSBTYWx0ZWRfXw7bdt3meJDJK kZP4RLwx6N8I445uGWQokXK1enewfrPoVgBhXgjvE2OeCicAKOI3DDbito/GQJGKZxQq7Eq3tqi H7ONKbv4KpClyZ7mEJzj2RPLqckmGf5VMXmzr5ePa8kJzPI7SqbkV0XmjEyG+pO2P5w98x0nW7z iNgcFXsyO8H8bQBxWU0KZYV+bXw2bK9kHda3hq8sLTffjevJDmR/T1zsR49qpozUS8hGNYqQJH2 P14ulS+F1zUhOdDgWgS9V225AuxIs8O85+4Jb6Er8Vo6Pj/qLV7dpZETpnWBPQYJh/8a1NMb4iJ bDSKTHonXgDvf5gzuNppiKxkadddboI13nlGdI3tFRQ7QVjsHlOIVVFc0xNEGOeYBXqqhbGeBUh cv4ap3x9GyVQWwPURB0v/PAc7fCNog== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1117,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-09-26_02,2025-09-26_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 spamscore=0 adultscore=0 suspectscore=0 lowpriorityscore=0 priorityscore=1501 malwarescore=0 impostorscore=0 phishscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2509150000 definitions=main-2509250171 Extend TCSR parsing to read optional dp_phy_mode_reg and add qmp_usbc_set_phy_mode() to switch between USB and DP modes when supported. Reviewed-by: Dmitry Baryshkov Signed-off-by: Xiangxu Yin --- drivers/phy/qualcomm/phy-qcom-qmp-usbc.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c b/drivers/phy/qualcom= m/phy-qcom-qmp-usbc.c index a971bdc3e767727e69ea07b14d9a036347d365f4..fab6ccc4a5f12a4096e9a71f066= f8ccec73adad2 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c @@ -529,6 +529,12 @@ static const struct qmp_phy_cfg qcs615_usb3phy_cfg =3D= { .regs =3D qmp_v3_usb3phy_regs_layout_qcm2290, }; =20 +static void qmp_usbc_set_phy_mode(struct qmp_usbc *qmp, bool is_dp) +{ + if (qmp->tcsr_map && qmp->dp_phy_mode_reg) + regmap_write(qmp->tcsr_map, qmp->dp_phy_mode_reg, is_dp); +} + static int qmp_usbc_com_init(struct phy *phy) { struct qmp_usbc *qmp =3D phy_get_drvdata(phy); @@ -669,6 +675,8 @@ static int qmp_usbc_usb_enable(struct phy *phy) if (ret) goto out_unlock; =20 + qmp_usbc_set_phy_mode(qmp, false); + ret =3D qmp_usbc_usb_power_on(phy); if (ret) { qmp_usbc_com_exit(phy); @@ -1113,6 +1121,7 @@ static int qmp_usbc_typec_switch_set(struct typec_swi= tch_dev *sw, qmp_usbc_com_exit(qmp->usb_phy); =20 qmp_usbc_com_init(qmp->usb_phy); + qmp_usbc_set_phy_mode(qmp, false); qmp_usbc_usb_power_on(qmp->usb_phy); } =20 @@ -1263,15 +1272,16 @@ static int qmp_usbc_parse_dt(struct qmp_usbc *qmp) return 0; } =20 -static int qmp_usbc_parse_vls_clamp(struct qmp_usbc *qmp) +static int qmp_usbc_parse_tcsr(struct qmp_usbc *qmp) { struct of_phandle_args tcsr_args; struct device *dev =3D qmp->dev; - int ret; + int ret, args_count; =20 - /* for backwards compatibility ignore if there is no property */ - ret =3D of_parse_phandle_with_fixed_args(dev->of_node, "qcom,tcsr-reg", 1= , 0, - &tcsr_args); + args_count =3D of_property_count_u32_elems(dev->of_node, "qcom,tcsr-reg"); + args_count =3D args_count - 1; + ret =3D of_parse_phandle_with_fixed_args(dev->of_node, "qcom,tcsr-reg", + args_count, 0, &tcsr_args); if (ret =3D=3D -ENOENT) return 0; else if (ret < 0) @@ -1284,6 +1294,9 @@ static int qmp_usbc_parse_vls_clamp(struct qmp_usbc *= qmp) =20 qmp->vls_clamp_reg =3D tcsr_args.args[0]; =20 + if (args_count > 1) + qmp->dp_phy_mode_reg =3D tcsr_args.args[1]; + return 0; } =20 @@ -1319,7 +1332,7 @@ static int qmp_usbc_probe(struct platform_device *pde= v) if (ret) return ret; =20 - ret =3D qmp_usbc_parse_vls_clamp(qmp); + ret =3D qmp_usbc_parse_tcsr(qmp); if (ret) return ret; =20 --=20 2.34.1 From nobody Wed Oct 1 23:35:02 2025 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1232E29ACDB for ; Fri, 26 Sep 2025 07:27:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758871639; cv=none; b=DYQdFxlhkHEByWjb10m3LeGrEcpttwiJUP5ADxlPugMn3GBKD3fC0fUXzox8R8rfA5YNIAMsDykuW4JNvYkqt46Lhlbwk/EzxtezrENUYin9/B4KIY5W9jt+WM356zpHoEoLPlBKmbBSZeOx00VbcRlulAFtbn+FmscLXqWBm2M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758871639; c=relaxed/simple; bh=LgO4dxC3/fyEINo3QtKn8terWYpqw7iknLpLIm5TGwU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VQzNIMp+PhQA107Wu4/ekXt2KMSaAgFUaRACCbc9Bar0weWS9GLwh3Cu80kZw5Ayx0+eYd6N43FP7c7ZrAvEao8XI2IGsV6VV9dkxnQKVDHoHhlah8yRSzNEYFm+8I5p6t9mLck3sP0oTKIDSQXePa7XjRov0Wv0pUEV2qq/2Cs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=U/j75yrq; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="U/j75yrq" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 58Q6latI015771 for ; Fri, 26 Sep 2025 07:27:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= y92IX8yih7rAKX9K1Ho2mfy8GLr4Y08/lKKaRrWHxvM=; b=U/j75yrq8xw527Rh 6uLgE67tPtTnTC9LkgN6CpjGcaI1mX2NmZZERRVeLuNdcScC9Oq+wbr1UbJa1kP5 YZ2FZO8M0KTfnUltutDOds19FYZnJS8iXHRUyTyaqtnnurAFbXNXycZzkfuM455s KMubR5WO2FJIVWYJdiFreNMdcfPQo6owi7qlr02l1iEBV3vJ34hlYg+1iDJG3lzU sf4yjweV6S72NDgdIZYZ0sLaIDqyf0IgBL7LptQ0wIPZJBO8EZJZI/JM2o9Ju97Z O12n+98bt4prqzDbZY9PJqAoYohIRfdFiO9XTkVR+fZJlBUsKdZhBmsUVCv7KIEB X+Dpgw== Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 49db0t9wtf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 26 Sep 2025 07:27:16 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-244582e9d17so5965915ad.3 for ; Fri, 26 Sep 2025 00:27:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758871635; x=1759476435; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=y92IX8yih7rAKX9K1Ho2mfy8GLr4Y08/lKKaRrWHxvM=; b=uauk4IpR1RpE8H9Pmx8RFzb8fG7hdurZNcWQoTCBYrAQUBePHQC7Aj8OIAMhuWsw5x fmgJs955Wrxx7C3Hz9Ldgla7LJIAFp2qWCHsGSNBghql++QKKbDKqb1KLTbw6Ubfgvoo 8YIiwtJuorQPQUOAA0neJiSn6kBgsRoBoXD8damwX/cml+KQYWBPdM/NHzxjbkioJfBg 7doJSrZDve0VK4fVB+hyCf6Ww6KzN8Glx2QWXTGlJivUYrjfpJ8PfrB0J3aGp/1+HElJ 8I7c4/GIc/lCix8j7yZRrLSK3kzFM0i4nVG/q0Ujkek+eCmX6+PHffxQHpNc3e0udoKv OwYQ== X-Forwarded-Encrypted: i=1; AJvYcCU0dct61kxdP7HxSGnOGnSOfpfcXscfXEb6yWBu8U+Fs+/RWyteLFi/eC9N2f7ORyOL9kn5N+TXhmbZ3O0=@vger.kernel.org X-Gm-Message-State: AOJu0Yz65uRmMHYFJD8+7DsxjAaZs9TjclsjoF+ESG2fVjQGhLCCc8Hr lEWzW1LHnjAR14QUIqE4obaB88xVUjSaxb3kPhl+8ZBFp9bny/sSf+TPrbWkiHMyoij7MrJZf+S iouLyTQag5Em+liL6Ez/m0ogVd+bw6+0JfN8pCWCkRkYf4HwIPxl6aLhdfUG2oChNUh4= X-Gm-Gg: ASbGncsvAESDXlUA1o04HqCAvxgDGlwptT3v5PiwXymb80tlehb0+qrddkPvBT/PKPe umkV3Mxd6NC7R+Yh4GPbnm/VAJtad5r7LHcakB5YpX1wwCJRZ9Nk56slUwLmi2CsD6M7AbAw7uA 83/v06rO/swf0HNnGzdZBGxsgQRWwgtsQ1YYr96Y2d1xLGWNHAzCZ9zngUqiv/G+q/DD8V6slAY wJdfP11DAP2cIzbaQSi/e/FR28gYdV7t3QRazIqeusW37ycO6w0oG3k9wukV5mrFFum7vz3ggVy sT5bh1NDOG8hG7xr91epyycPCTXvv7Y0jBJ8AjckyC/dsHhmJ6IoJBfE8YIgNZLz0b8bhZgDGmt 9R2fzAg3pMJRDVHlkOMhvOGO0un/tQhmZoViqQdgj+VXGNMiNrBdoeKxb X-Received: by 2002:a17:903:11c3:b0:267:af07:652f with SMTP id d9443c01a7336-27ed4a5cba8mr40527245ad.10.1758871635518; Fri, 26 Sep 2025 00:27:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGBOqk9gM27+PjI5fj5URhpDKJkSCSxuwgB+n8CrmysFzuKsfvTUq3YXiak3Zv6mVFiHZ9u6A== X-Received: by 2002:a17:903:11c3:b0:267:af07:652f with SMTP id d9443c01a7336-27ed4a5cba8mr40526965ad.10.1758871634987; Fri, 26 Sep 2025 00:27:14 -0700 (PDT) Received: from sziotdisp01-gv.qualcomm.com.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-27ed671d8a2sm45117985ad.55.2025.09.26.00.27.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Sep 2025 00:27:14 -0700 (PDT) From: Xiangxu Yin Date: Fri, 26 Sep 2025 15:25:45 +0800 Subject: [PATCH v7 09/14] phy: qcom: qmp-usbc: Add DP PHY ops for USB/DP switchable Type-C PHYs Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250926-add-displayport-support-for-qcs615-platform-v7-9-dc5edaac6c2b@oss.qualcomm.com> References: <20250926-add-displayport-support-for-qcs615-platform-v7-0-dc5edaac6c2b@oss.qualcomm.com> In-Reply-To: <20250926-add-displayport-support-for-qcs615-platform-v7-0-dc5edaac6c2b@oss.qualcomm.com> To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Sean Paul , Marijn Suijten , David Airlie , Simona Vetter Cc: linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, fange.zhang@oss.qualcomm.com, yongxing.mou@oss.qualcomm.com, li.liu@oss.qualcomm.com, Dmitry Baryshkov , Bjorn Andersson , Konrad Dybcio , Xiangxu Yin X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1758871564; l=6447; i=xiangxu.yin@oss.qualcomm.com; s=20241125; h=from:subject:message-id; bh=LgO4dxC3/fyEINo3QtKn8terWYpqw7iknLpLIm5TGwU=; b=NqfS4eoetvvBeroV7EnmiTlKJ9QgREt5xEyTW5g5H8bGKAzo2l5sV64I0Z9uGe26DqzsmyZWp e2cavSNtW1zCvvohlR/RTJzQrMjZwJOVRZ08J+raWoRueUdVAEqyMLo X-Developer-Key: i=xiangxu.yin@oss.qualcomm.com; a=ed25519; pk=F1TwipJzpywfbt3n/RPi4l/A4AVF+QC89XzCHgZYaOc= X-Proofpoint-ORIG-GUID: DzKEgVkFmERGPHqT5ip8lEQ2YMGl71WW X-Proofpoint-GUID: DzKEgVkFmERGPHqT5ip8lEQ2YMGl71WW X-Authority-Analysis: v=2.4 cv=Jvz8bc4C c=1 sm=1 tr=0 ts=68d64054 cx=c_pps a=JL+w9abYAAE89/QcEU+0QA==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=yJojWOMRYYMA:10 a=EUspDBNiAAAA:8 a=U7rhxC6dmq8FdBza6woA:9 a=QEXdDO2ut3YA:10 a=324X-CrmTo6CU4MGRt3R:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTI1MDE3MSBTYWx0ZWRfX5tmKg5M2u2aE YA+rv+OPYUKMcQ7BS67Xk7SWnEBCK+++BjbLWunicHFGMzR4NlcxUpBNnugEqAQ2EfWymAVQ00q wtIjOzt5+8mDd3L5e6SGqKVkvW0AgMmbOP57C8FjkfLX+wEYEVZm2aK+ZNuw34K6bvbpqRI52JA MnJ3I8BsQSAXcg9UhwZlwlNa42paKD88HyDpYb/m0gOnWzD0sGSFuu2+1eoO5zUVVI5gmgwUIqN TcgU4lsOZ8DwACbl492/MaHRn4oYSKUalvJo6BzjZaGBqyXvx2wqM/CoG6ZzeDXsTCCpLmiEwFY R/zMMWKH1xe/UqoABOyeIenek1772u9b8BluwAK7Ti+KxmiWs5hWfH2v7IIWcjDEJYDcZDFHvFa A/e+uCE/Irgs5NOH9As7TNRcut6dOQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1117,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-09-26_02,2025-09-26_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 malwarescore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 suspectscore=0 spamscore=0 priorityscore=1501 adultscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2509150000 definitions=main-2509250171 Define qmp_usbc_dp_phy_ops struct to support DP mode on USB/DP switchable PHYs. Reviewed-by: Dmitry Baryshkov Signed-off-by: Xiangxu Yin --- drivers/phy/qualcomm/phy-qcom-qmp-usbc.c | 194 +++++++++++++++++++++++++++= +++- 1 file changed, 193 insertions(+), 1 deletion(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c b/drivers/phy/qualcom= m/phy-qcom-qmp-usbc.c index fab6ccc4a5f12a4096e9a71f066f8ccec73adad2..3580c19fd62e02aa373cec42e9f= 53143f39214df 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c @@ -29,6 +29,8 @@ #include "phy-qcom-qmp.h" #include "phy-qcom-qmp-pcs-misc-v3.h" =20 +#include "phy-qcom-qmp-dp-phy.h" + #define PHY_INIT_COMPLETE_TIMEOUT 10000 #define SW_PORTSELECT_VAL BIT(0) #define SW_PORTSELECT_MUX BIT(1) @@ -711,6 +713,159 @@ static int qmp_usbc_usb_set_mode(struct phy *phy, enu= m phy_mode mode, int submod return 0; } =20 +static int qmp_usbc_dp_enable(struct phy *phy) +{ + struct qmp_usbc *qmp =3D phy_get_drvdata(phy); + const struct qmp_phy_cfg *cfg =3D qmp->cfg; + int ret; + + if (qmp->dp_init_count) { + dev_err(qmp->dev, "DP already inited\n"); + return 0; + } + + mutex_lock(&qmp->phy_mutex); + + ret =3D qmp_usbc_com_init(phy); + if (ret) + goto dp_init_unlock; + + qmp_usbc_set_phy_mode(qmp, true); + + cfg->dp_aux_init(qmp); + + qmp->dp_init_count++; + +dp_init_unlock: + mutex_unlock(&qmp->phy_mutex); + return ret; +} + +static int qmp_usbc_dp_disable(struct phy *phy) +{ + struct qmp_usbc *qmp =3D phy_get_drvdata(phy); + + mutex_lock(&qmp->phy_mutex); + + qmp_usbc_com_exit(phy); + + qmp->dp_init_count--; + + mutex_unlock(&qmp->phy_mutex); + + return 0; +} + +static int qmp_usbc_dp_configure(struct phy *phy, union phy_configure_opts= *opts) +{ + const struct phy_configure_opts_dp *dp_opts =3D &opts->dp; + struct qmp_usbc *qmp =3D phy_get_drvdata(phy); + const struct qmp_phy_cfg *cfg =3D qmp->cfg; + + mutex_lock(&qmp->phy_mutex); + + memcpy(&qmp->dp_opts, dp_opts, sizeof(*dp_opts)); + if (qmp->dp_opts.set_voltages) { + cfg->configure_dp_tx(qmp); + qmp->dp_opts.set_voltages =3D 0; + } + + mutex_unlock(&qmp->phy_mutex); + + return 0; +} + +static int qmp_usbc_dp_calibrate(struct phy *phy) +{ + struct qmp_usbc *qmp =3D phy_get_drvdata(phy); + const struct qmp_phy_cfg *cfg =3D qmp->cfg; + int ret =3D 0; + + mutex_lock(&qmp->phy_mutex); + + if (cfg->calibrate_dp_phy) { + ret =3D cfg->calibrate_dp_phy(qmp); + if (ret) { + dev_err(qmp->dev, "dp calibrate err(%d)\n", ret); + mutex_unlock(&qmp->phy_mutex); + return ret; + } + } + + mutex_unlock(&qmp->phy_mutex); + return 0; +} + +static int qmp_usbc_dp_serdes_init(struct qmp_usbc *qmp) +{ + const struct qmp_phy_cfg *cfg =3D qmp->cfg; + void __iomem *serdes =3D qmp->dp_serdes; + const struct phy_configure_opts_dp *dp_opts =3D &qmp->dp_opts; + + qmp_configure(qmp->dev, serdes, cfg->dp_serdes_tbl, + cfg->dp_serdes_tbl_num); + + switch (dp_opts->link_rate) { + case 1620: + qmp_configure(qmp->dev, serdes, cfg->serdes_tbl_rbr, + cfg->serdes_tbl_rbr_num); + break; + case 2700: + qmp_configure(qmp->dev, serdes, cfg->serdes_tbl_hbr, + cfg->serdes_tbl_hbr_num); + break; + case 5400: + qmp_configure(qmp->dev, serdes, cfg->serdes_tbl_hbr2, + cfg->serdes_tbl_hbr2_num); + break; + default: + /* Other link rates aren't supported */ + return -EINVAL; + } + + return 0; +} + +static int qmp_usbc_dp_power_on(struct phy *phy) +{ + struct qmp_usbc *qmp =3D phy_get_drvdata(phy); + const struct qmp_phy_cfg *cfg =3D qmp->cfg; + + void __iomem *tx =3D qmp->dp_tx; + void __iomem *tx2 =3D qmp->dp_tx2; + + mutex_lock(&qmp->phy_mutex); + + qmp_usbc_dp_serdes_init(qmp); + + qmp_configure_lane(qmp->dev, tx, cfg->dp_tx_tbl, cfg->dp_tx_tbl_num, 1); + qmp_configure_lane(qmp->dev, tx2, cfg->dp_tx_tbl, cfg->dp_tx_tbl_num, 2); + + /* Configure special DP tx tunings */ + cfg->configure_dp_tx(qmp); + + /* Configure link rate, swing, etc. */ + cfg->configure_dp_phy(qmp); + + mutex_unlock(&qmp->phy_mutex); + + return 0; +} + +static int qmp_usbc_dp_power_off(struct phy *phy) +{ + struct qmp_usbc *qmp =3D phy_get_drvdata(phy); + + mutex_lock(&qmp->phy_mutex); + + /* Assert DP PHY power down */ + writel(DP_PHY_PD_CTL_PSR_PWRDN, qmp->dp_dp_phy + QSERDES_DP_PHY_PD_CTL); + + mutex_unlock(&qmp->phy_mutex); + + return 0; +} + static const struct phy_ops qmp_usbc_usb_phy_ops =3D { .init =3D qmp_usbc_usb_enable, .exit =3D qmp_usbc_usb_disable, @@ -718,6 +873,16 @@ static const struct phy_ops qmp_usbc_usb_phy_ops =3D { .owner =3D THIS_MODULE, }; =20 +static const struct phy_ops qmp_usbc_dp_phy_ops =3D { + .init =3D qmp_usbc_dp_enable, + .exit =3D qmp_usbc_dp_disable, + .configure =3D qmp_usbc_dp_configure, + .calibrate =3D qmp_usbc_dp_calibrate, + .power_on =3D qmp_usbc_dp_power_on, + .power_off =3D qmp_usbc_dp_power_off, + .owner =3D THIS_MODULE, +}; + static void qmp_usbc_enable_autonomous_mode(struct qmp_usbc *qmp) { const struct qmp_phy_cfg *cfg =3D qmp->cfg; @@ -1300,6 +1465,23 @@ static int qmp_usbc_parse_tcsr(struct qmp_usbc *qmp) return 0; } =20 +static struct phy *qmp_usbc_phy_xlate(struct device *dev, const struct of_= phandle_args *args) +{ + struct qmp_usbc *qmp =3D dev_get_drvdata(dev); + + if (args->args_count =3D=3D 0) + return qmp->usb_phy; + + switch (args->args[0]) { + case QMP_USB43DP_USB3_PHY: + return qmp->usb_phy; + case QMP_USB43DP_DP_PHY: + return qmp->dp_phy ?: ERR_PTR(-ENODEV); + } + + return ERR_PTR(-EINVAL); +} + static int qmp_usbc_probe(struct platform_device *pdev) { struct device *dev =3D &pdev->dev; @@ -1370,9 +1552,19 @@ static int qmp_usbc_probe(struct platform_device *pd= ev) =20 phy_set_drvdata(qmp->usb_phy, qmp); =20 + if (qmp->dp_serdes !=3D 0) { + qmp->dp_phy =3D devm_phy_create(dev, np, &qmp_usbc_dp_phy_ops); + if (IS_ERR(qmp->dp_phy)) { + ret =3D PTR_ERR(qmp->dp_phy); + dev_err(dev, "failed to create PHY: %d\n", ret); + goto err_node_put; + } + phy_set_drvdata(qmp->dp_phy, qmp); + } + of_node_put(np); =20 - phy_provider =3D devm_of_phy_provider_register(dev, of_phy_simple_xlate); + phy_provider =3D devm_of_phy_provider_register(dev, qmp_usbc_phy_xlate); =20 return PTR_ERR_OR_ZERO(phy_provider); =20 --=20 2.34.1 From nobody Wed Oct 1 23:35:02 2025 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B1D4286D72 for ; Fri, 26 Sep 2025 07:27:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758871646; cv=none; b=qHT4BAx9wcNYhRcaP/xSqua48SwXGJTLduDlK0cZju+vc72PZZkUZTtv7Pn1OdS+U8Hqc6YZR3foVc1ryGc2vyTDn+fudhAkcOtELwtuO+XZpYo+uxKJaibmzcczzptzmNdlZN/HKjJG2H7eHJYUvbewSi/pnSk7NvXudBR17Lc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758871646; c=relaxed/simple; bh=DPKLxEacqPPVPld/3Cw3ossBUvxFPG/ElRs6jI9aG+g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FRi0oBkcZ2POx/Mg1DN+m3t/F1BjOBg8UL9MM3Me0UeXazuVGPmIb8w3tf5Xtke0L33ETSmiiXksjUi7WZoSZqFdYLLRhGXZ5txYW+RBioKdRA7yqNQT5IyEyl6sbkb5JiFsXYE4aQgWOP1O0dpcjRadSTXtDehk5+m4fwDTasM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=MZrHsPoM; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="MZrHsPoM" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 58Q7DuV5024911 for ; Fri, 26 Sep 2025 07:27:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= BBnKAQHtJIUzOuuf/k4xFN6GQiHRN0JpTaejw5fAgk8=; b=MZrHsPoMJRf4Qv7t g/gyESw15cUBoBQ0NM7U0rvmGcaabIU1i9HsyOExSPgwZ1Y0OFNx93A0GNbAvuaR C7ahVwfEwmv2FxHxBhTza2NEKZ3uHzYqJbf5qOdFRcvu/q2y1nvr3qI6sf4T8paD JbYZyLtyU2abpbrfU292PyoBMkzcplJedsbXatYBZYPWY0qpN6CG8DuPmfJ60YNR ZybP9POnattamOTLDX53KBNx5nOEz6POTf2oG9L4xDuBoBiLkOv3RQt8OsAi9/N3 KL/OyY1vw9KzgcIJrDLIOltl5Ksz5Yj6fThvRDApV3cfj20RFODrTIDLe9EjJLVL FFx2NA== Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 49db34hvbt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 26 Sep 2025 07:27:24 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-26b7fc4b7e3so4836965ad.0 for ; Fri, 26 Sep 2025 00:27:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758871643; x=1759476443; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BBnKAQHtJIUzOuuf/k4xFN6GQiHRN0JpTaejw5fAgk8=; b=ddJHqBGjQecJzYIL0xLpyTSg9ePO6fa2IYJYK2uYg2fqVwnHnvpy+2/v4LN2Y+Frqe d04zSVO+ZjetbcS3nt3K+8QbFt6c0iH7IUBHmuUNwMegR27zxwX4jVF/9sJSEwpMnQW9 SYHT5H8W54uuIvB1PgTImF1ogpYC7TB6+yV4YYBZT5rJoP1ZMWR0RtXGTmJKnEljkjTA uTuE9AL7JYG0u560V1ljXuNq08SrOruFH1dkk+EiVnyyaCfA1cCOPEzDNedTKwNJjZRB bvunnCzWFtoPz74s1hZHVJcp/ciRb0YZnrC5gJqosc4hVZ9vVwVhRNI4Hyj4xTJfNJBG Wmbw== X-Forwarded-Encrypted: i=1; AJvYcCVpK/RjZk1cFlRFSLrifzdJz1IlhrF3N1xq4msvmOL2+uKWMqj1w5yroeuM6FIv/Z2cSRo/+8pV7Xwe3cw=@vger.kernel.org X-Gm-Message-State: AOJu0YwL7llKzj6yOOc7Iip8WZwHI/PgLwJOBdeQR9cxym0PbLisscP6 AIhjsE5jZHXDWjeM1GpCcwoTC8nBGGGW+sAgsI/KwwENQRsAz9pnohuWCq/jaeqBYC8pl5SZ7in ZvjfbJTmSmpfg/NJ18CIavnjuY77LyoDOQdrU5tV626YHfHecF1p25BvC37vxNVO3fYg= X-Gm-Gg: ASbGncvQocCTklP6n/1fvtabzMcQNYioqGc/8LIA3MTsKD/wnuEfXEdKA9cRqAsFGE2 JGaok7KKoBZUrSi+Zzkmu3DUemigCVWMWFoFPtX6tjA5Qn4zSx//m2BFAcmw9GhfFfBCFTgTSRb ZMEK0P2CF4CxWpOLzAg+zV3dvA+CD/wlS6vRboEdU1SJRI2RXeCS2GleiMBo0HbHc09BjBxbV0W K4faMR3mPI/bqcVXVBI+HsfXH9w+/JejHpfJdQ4D9vzM/+h803gJIw7j19dduk/s/6XL57K3Kw7 uqCYrIkucdztz17ZaFNpitz4SAqq2DxyPA3DeRgw/NtyI66SwLXUovFnD+wj00YbJJMGruQrhZv Wscz5QzXXKPQe8Wh30N3opuYZgfj6AWsTPXFddQA7vg7UPt4X51vf1x4y X-Received: by 2002:a17:902:db11:b0:26b:1871:1f70 with SMTP id d9443c01a7336-27ed49df69fmr43571235ad.5.1758871642874; Fri, 26 Sep 2025 00:27:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHTX2igDAbPEs0gasTbZkRY3PEKRg6iD3OO1BbSDu+8oSgdmgCgwl1nIHEcronmpOxG6BZOag== X-Received: by 2002:a17:902:db11:b0:26b:1871:1f70 with SMTP id d9443c01a7336-27ed49df69fmr43571025ad.5.1758871642379; Fri, 26 Sep 2025 00:27:22 -0700 (PDT) Received: from sziotdisp01-gv.qualcomm.com.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-27ed671d8a2sm45117985ad.55.2025.09.26.00.27.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Sep 2025 00:27:21 -0700 (PDT) From: Xiangxu Yin Date: Fri, 26 Sep 2025 15:25:46 +0800 Subject: [PATCH v7 10/14] phy: qcom: qmp-usbc: Add USB/DP exclude handling Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250926-add-displayport-support-for-qcs615-platform-v7-10-dc5edaac6c2b@oss.qualcomm.com> References: <20250926-add-displayport-support-for-qcs615-platform-v7-0-dc5edaac6c2b@oss.qualcomm.com> In-Reply-To: <20250926-add-displayport-support-for-qcs615-platform-v7-0-dc5edaac6c2b@oss.qualcomm.com> To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Sean Paul , Marijn Suijten , David Airlie , Simona Vetter Cc: linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, fange.zhang@oss.qualcomm.com, yongxing.mou@oss.qualcomm.com, li.liu@oss.qualcomm.com, Dmitry Baryshkov , Bjorn Andersson , Konrad Dybcio , Xiangxu Yin X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1758871564; l=1933; i=xiangxu.yin@oss.qualcomm.com; s=20241125; h=from:subject:message-id; bh=DPKLxEacqPPVPld/3Cw3ossBUvxFPG/ElRs6jI9aG+g=; b=LKwRqi1oGH1DuHLM7E16LiWfNw5DOeR+8o8s9eF6SZvkMm3iSdaWji+J524cD6f83xQZU7P4x jx9iHVmnqEvCOsMZMAFLUJLwoQrBPzoPBnQelsJeE52ZLRbP7VKfXfm X-Developer-Key: i=xiangxu.yin@oss.qualcomm.com; a=ed25519; pk=F1TwipJzpywfbt3n/RPi4l/A4AVF+QC89XzCHgZYaOc= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTI1MDE3MiBTYWx0ZWRfXzeTiclNCK7As Lp0RFB9KAyLJJLS2mrthc5tlOzKmz0GqmHfK/2UqnenXPSesJBXCTCBcbATMVYOXhZfEzQ6P/rS E3DucjP8I++kgvuiWCAmwcPvLiUZ90VFsN/nlbRvfoUTao2NJavMQ4UKIS8dInEYQnglE7/Qs90 mvam/ZTjVBHcIRgVxY34G7sirClYhn8CX0fIf5z7vZvN0ELFuOyi3EFCM/BLF07RxBhMU+4KWmD gEYE9ayEJeTuxogkqocIda6bpZRn5mny6D1j/tkCYgjB3yKVlrlGEjDtv5A+XmipQ4sdqqRrK5l 3ynRrgKWQbbCq3fGSq9fqDDXGAMBjZ+/PVat2DzZO92gJdsmaGtJsa7ZSJFnkpogVZZbXtXY7/L R3JEimc7eIgM6GYtqW1mbDdjYLgYSg== X-Authority-Analysis: v=2.4 cv=Hb0ZjyE8 c=1 sm=1 tr=0 ts=68d6405c cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=yJojWOMRYYMA:10 a=EUspDBNiAAAA:8 a=RloG_8Ug8mropJZ47ewA:9 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-ORIG-GUID: KH05nZ1DInFjSvCO0uV8nNdjMHbRNpYO X-Proofpoint-GUID: KH05nZ1DInFjSvCO0uV8nNdjMHbRNpYO X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1117,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-09-26_02,2025-09-26_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 adultscore=0 bulkscore=0 impostorscore=0 spamscore=0 lowpriorityscore=0 suspectscore=0 malwarescore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2509150000 definitions=main-2509250172 When both USB and DP PHY modes are enabled simultaneously on the same QMP USBC PHY, it can lead to hardware misconfiguration and undefined behavior. This happens because the PHY resources are not designed to operate in both modes at the same time. To prevent this, introduce a mutual exclusion check between USB and DP PHY modes. Reviewed-by: Dmitry Baryshkov Signed-off-by: Xiangxu Yin Reviewed-by: Konrad Dybcio --- drivers/phy/qualcomm/phy-qcom-qmp-usbc.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c b/drivers/phy/qualcom= m/phy-qcom-qmp-usbc.c index 3580c19fd62e02aa373cec42e9f53143f39214df..d84bf68940043bce13565503bb3= 4796e653adbb7 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c @@ -666,6 +666,19 @@ static int qmp_usbc_usb_power_off(struct phy *phy) return 0; } =20 +static int qmp_usbc_check_phy_status(struct qmp_usbc *qmp, bool is_dp) +{ + if ((is_dp && qmp->usb_init_count) || + (!is_dp && qmp->dp_init_count)) { + dev_err(qmp->dev, + "PHY is configured for %s, can not enable %s\n", + is_dp ? "USB" : "DP", is_dp ? "DP" : "USB"); + return -EBUSY; + } + + return 0; +} + static int qmp_usbc_usb_enable(struct phy *phy) { struct qmp_usbc *qmp =3D phy_get_drvdata(phy); @@ -673,6 +686,10 @@ static int qmp_usbc_usb_enable(struct phy *phy) =20 mutex_lock(&qmp->phy_mutex); =20 + ret =3D qmp_usbc_check_phy_status(qmp, false); + if (ret) + goto out_unlock; + ret =3D qmp_usbc_com_init(phy); if (ret) goto out_unlock; @@ -726,6 +743,10 @@ static int qmp_usbc_dp_enable(struct phy *phy) =20 mutex_lock(&qmp->phy_mutex); =20 + ret =3D qmp_usbc_check_phy_status(qmp, true); + if (ret) + goto dp_init_unlock; + ret =3D qmp_usbc_com_init(phy); if (ret) goto dp_init_unlock; --=20 2.34.1 From nobody Wed Oct 1 23:35:02 2025 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5CCC429C343 for ; Fri, 26 Sep 2025 07:27:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758871654; cv=none; b=Nv17tizpfQZ07EdvxdQsqXFi6l1dO5N7D+tGU4QwU5YvlmqRz5QOagP4SH6xHTrqrrqivYUbBldV2DNQz7MnT8NATv98zZEPBHs+17yaXU7UJGgw0yNpgldQsT/XbrKFZk2zyWnLXRmBsjlGsjKGzvP9/tS5LNyZ51Gn0y9fwuU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758871654; c=relaxed/simple; bh=wRcG6hvTUjOLE7118EUHmvDQXHvLMsHays/1bOGOLyY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OcTywNnULayxw8i3d0BxYWMVtCpbmCLNnEr3DNEyfJsoXPkqHEm1kH3eWq1lHWxDXUofFqi21U8527/bGeGyy92ZzcmlcpLId9Wub0d538rCFwdZ17NV/q1gNKzz4z4es78Io0SY2OGAvnFBQMyOzyOTdTAEyPjZHNtD9pTp//Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=KhtRuJcv; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="KhtRuJcv" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 58Q6s1SA024702 for ; Fri, 26 Sep 2025 07:27:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= MQywDDAcWYT+0RdvqyfNhFfl3UTIYdzSA7Mm529kFnI=; b=KhtRuJcvPu2sWGeG W/x9o1nTXsayfxdMsuPkT2+JC+lW73yB1WOL4aKQExniQXRuGmfc/jiyJwlgUicv LddNSTufEPYv4By28XuHTi/IiRX26hU3dvRwAoPNX6kzKwHfFEDi6N6o7mJPEdGB 6OdK6WeYDZloE/WpidqRH57WqOfjj9KIG6RmHOyONrhk2OHoj8ry3/mBs6o9ZuxI pqKQ+trhATW9mNrXICg0S0aL6eu9y/Zpp/aWt3Ksq21yaMlmiMjQFtRT1Cv8jbb+ fCKr+5Z7Yu6OxfTxU1HiHrLM92XFsxUK5sUl+9gycrUrc3PmyfAICZt3w9f6pJQB Cg8xIA== Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 49db34hvcu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 26 Sep 2025 07:27:31 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2698ede62c2so4648635ad.1 for ; Fri, 26 Sep 2025 00:27:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758871650; x=1759476450; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MQywDDAcWYT+0RdvqyfNhFfl3UTIYdzSA7Mm529kFnI=; b=Q9y+smA6ktq7WHhQPcMG6BLyRlnsv2x6D4qrvFiQDN2b5JEDIzUwPknMGTb7a8zAEu KsSIQ4BNT39NqhCC2dCeyYKPbxZTP/4EescNclBoorL0mGEuqOLYmjmWE36+cRQ6NVT4 xG8HEPvS0D2y5d+wRMd2Ld21/1OcW6dfbW09/9EEZctpnWS5RyhG8CTeEcPibhMQqLdV NzfbmcCsEHMnrG01ktBJbkXAEKQIMKQEhiUpcOtDox2pXarzlBrbIrfnS1IXH7QA/2WX RR+Sy2dFJUk91VOKGjfyTfOCPxVTiM2Bj6uxi/M8+He36degVtpwKONslOi+cLRlH6o3 wELw== X-Forwarded-Encrypted: i=1; AJvYcCVjsGwgBhMbptzqJ6I4uN+ibZjHX55JdHsfrGtdLPMKjFX6YE91gwooFBRkOedXgvaBPqA8u8mwgtrl5jE=@vger.kernel.org X-Gm-Message-State: AOJu0YzGd3P7e5QvXXicK64fAeixCOaRtxJ9kH09KpZwlCPqpgOS5uJW lsH8wdiG4YYBweoX35mJmslSOJHKxrJAfvdSqKPUUfQ2HUuB6FoFsgsXyG5um5KJfiT6hmkTxd+ 1qcwluYTY7MPjnHEm+IbG9U0/oKPEUcHZ0O0fmu50yqk/88CGPc4N1MzVOwkagUSSyQc= X-Gm-Gg: ASbGnct9Ac/rjteroS8KlfWDAOqKp+onumSVl+ka1Fz9ZTZ+BQCgvsEHmcd9jar5V2Y VuEGUflGkvl7cvbx5XtCw97YsSIUgqasvu3+lhP2Lt+oKEEBSXiTFdU3h+RJSR0S7/2XwxhOdY+ bInJdeZAsbmJZfHHHpUUBgAU1VAcLkoR7WDLCTABrUuJ4IOkdZTt1KTv4z1HQu8DpcgZOGbDKB3 n/3j42v9JRQUQqBiPfsUWC9JpBaRSrrCNQGr8sUyFWGxldMtqWkkeSRzmDzZVBTPIhdE/GQEAiY AJMsZpODFUj9Nrc0BVm7yCEtK4kjYXDHWvKyTiAl5PS8iAWO/N36gARflIQGX8tMUfNpeYxossD 3pgtOTEsjY5M3Qs3utZ1w9iRxXgoFQ72BFaTfNFz7ftrevsnpzzrzAewI X-Received: by 2002:a17:902:e812:b0:266:914a:2e7a with SMTP id d9443c01a7336-27ed4a7e84amr39541615ad.6.1758871649888; Fri, 26 Sep 2025 00:27:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHGeihG3SZx7aSMWPcADuq74URnH7VI514dOIMBXDrqShDi7JTOZBn+M6jC2FHBu/HAXAys3Q== X-Received: by 2002:a17:902:e812:b0:266:914a:2e7a with SMTP id d9443c01a7336-27ed4a7e84amr39541355ad.6.1758871649315; Fri, 26 Sep 2025 00:27:29 -0700 (PDT) Received: from sziotdisp01-gv.qualcomm.com.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-27ed671d8a2sm45117985ad.55.2025.09.26.00.27.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Sep 2025 00:27:29 -0700 (PDT) From: Xiangxu Yin Date: Fri, 26 Sep 2025 15:25:47 +0800 Subject: [PATCH v7 11/14] phy: qcom: qmp: Add DP v2 PHY register definitions Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250926-add-displayport-support-for-qcs615-platform-v7-11-dc5edaac6c2b@oss.qualcomm.com> References: <20250926-add-displayport-support-for-qcs615-platform-v7-0-dc5edaac6c2b@oss.qualcomm.com> In-Reply-To: <20250926-add-displayport-support-for-qcs615-platform-v7-0-dc5edaac6c2b@oss.qualcomm.com> To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Sean Paul , Marijn Suijten , David Airlie , Simona Vetter Cc: linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, fange.zhang@oss.qualcomm.com, yongxing.mou@oss.qualcomm.com, li.liu@oss.qualcomm.com, Dmitry Baryshkov , Bjorn Andersson , Konrad Dybcio , Xiangxu Yin X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1758871564; l=10561; i=xiangxu.yin@oss.qualcomm.com; s=20241125; h=from:subject:message-id; bh=wRcG6hvTUjOLE7118EUHmvDQXHvLMsHays/1bOGOLyY=; b=FPxuz4rURJ6NnLqrrlTRqMBMa7ZFv4jrZJDloo8Mx3tNZkgPnYVfrVLUoU7GcSlfK3LvH5dTA AFTTl+Q6a4NCAvEtHEwUlwcSh+IjzXar5jNa3ggvbQNzzS4l6PfMHaH X-Developer-Key: i=xiangxu.yin@oss.qualcomm.com; a=ed25519; pk=F1TwipJzpywfbt3n/RPi4l/A4AVF+QC89XzCHgZYaOc= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTI1MDE3MiBTYWx0ZWRfX0lbIQAkEbgtE DbeUdZ+ERLIkYih6dmMXDlXflVsi3KffvdTzG3tMK1FQK0bK5BYTrN3zuAFmZHlWxyhaAjcTPDn HIkUYK6HDT4+4RPn/o3KU0Ts8xTuLniynD95hQWww66EdkDFc1A2BToodWE9Uxv0k4svxkDs5nk ZmFT8eaOBPdGj2/7ixvplo6mcVvJ/d7kwH3b9x+6HNygy27LLUDYoohGeRFqMNahEprH9V2NDJG N0ms1wQXPXGRCQoLBnzTNUktRnI8TySrpVeK+ZD8p7rvGtZYU40o4emjXyglse3HRoks453XyNN DdPEL2STm5XdvZTG2HuRgybe3+vdkcIQr18RMSEPePOGO2kRZowvMiAbTXqpZXDif10kVcKIVQO gADSSwVZUhpjiTqHZYn5UV/cEwVjaA== X-Authority-Analysis: v=2.4 cv=Hb0ZjyE8 c=1 sm=1 tr=0 ts=68d64063 cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=yJojWOMRYYMA:10 a=EUspDBNiAAAA:8 a=7JoLr56Aoq0vruZkpkIA:9 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-ORIG-GUID: Eu4_Ss5SP50ESrL0g1HBtBWFqQwGiTjD X-Proofpoint-GUID: Eu4_Ss5SP50ESrL0g1HBtBWFqQwGiTjD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1117,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-09-26_02,2025-09-26_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 adultscore=0 bulkscore=0 impostorscore=0 spamscore=0 lowpriorityscore=0 suspectscore=0 malwarescore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2509150000 definitions=main-2509250172 Add dedicated headers for DP v2 PHY, including QSERDES COM and TX/RX register definitions. Reviewed-by: Dmitry Baryshkov Signed-off-by: Xiangxu Yin --- drivers/phy/qualcomm/phy-qcom-qmp-dp-phy-v2.h | 21 ++++ drivers/phy/qualcomm/phy-qcom-qmp-qserdes-com-v2.h | 106 +++++++++++++++++= ++++ .../phy/qualcomm/phy-qcom-qmp-qserdes-txrx-v2.h | 68 +++++++++++++ drivers/phy/qualcomm/phy-qcom-qmp.h | 3 + 4 files changed, 198 insertions(+) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-dp-phy-v2.h b/drivers/phy/qu= alcomm/phy-qcom-qmp-dp-phy-v2.h new file mode 100644 index 0000000000000000000000000000000000000000..8b9572d3cdebb70a0f3811f129a= 40aa78e184638 --- /dev/null +++ b/drivers/phy/qualcomm/phy-qcom-qmp-dp-phy-v2.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2017, The Linux Foundation. All rights reserved. + */ + +#ifndef QCOM_PHY_QMP_DP_PHY_V2_H_ +#define QCOM_PHY_QMP_DP_PHY_V2_H_ + +// /* Only for QMP V2 PHY - DP PHY registers */ +#define QSERDES_V2_DP_PHY_AUX_INTERRUPT_MASK 0x048 +#define QSERDES_V2_DP_PHY_AUX_INTERRUPT_CLEAR 0x04c +#define QSERDES_V2_DP_PHY_AUX_BIST_CFG 0x050 + +#define QSERDES_V2_DP_PHY_VCO_DIV 0x068 +#define QSERDES_V2_DP_PHY_TX0_TX1_LANE_CTL 0x06c +#define QSERDES_V2_DP_PHY_TX2_TX3_LANE_CTL 0x088 + +#define QSERDES_V2_DP_PHY_SPARE0 0x0ac +#define QSERDES_V2_DP_PHY_STATUS 0x0c0 + +#endif diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-qserdes-com-v2.h b/drivers/p= hy/qualcomm/phy-qcom-qmp-qserdes-com-v2.h new file mode 100644 index 0000000000000000000000000000000000000000..3ea1884f35dd50a0bde9b213f19= 3ac8ac6b77612 --- /dev/null +++ b/drivers/phy/qualcomm/phy-qcom-qmp-qserdes-com-v2.h @@ -0,0 +1,106 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2017, The Linux Foundation. All rights reserved. + */ + +#ifndef QCOM_PHY_QMP_QSERDES_COM_V2_H_ +#define QCOM_PHY_QMP_QSERDES_COM_V2_H_ + +/* Only for QMP V2 PHY - QSERDES COM registers */ +#define QSERDES_V2_COM_ATB_SEL1 0x000 +#define QSERDES_V2_COM_ATB_SEL2 0x004 +#define QSERDES_V2_COM_FREQ_UPDATE 0x008 +#define QSERDES_V2_COM_BG_TIMER 0x00c +#define QSERDES_V2_COM_SSC_EN_CENTER 0x010 +#define QSERDES_V2_COM_SSC_ADJ_PER1 0x014 +#define QSERDES_V2_COM_SSC_ADJ_PER2 0x018 +#define QSERDES_V2_COM_SSC_PER1 0x01c +#define QSERDES_V2_COM_SSC_PER2 0x020 +#define QSERDES_V2_COM_SSC_STEP_SIZE1 0x024 +#define QSERDES_V2_COM_SSC_STEP_SIZE2 0x028 +#define QSERDES_V2_COM_POST_DIV 0x02c +#define QSERDES_V2_COM_POST_DIV_MUX 0x030 +#define QSERDES_V2_COM_BIAS_EN_CLKBUFLR_EN 0x034 +#define QSERDES_V2_COM_CLK_ENABLE1 0x038 +#define QSERDES_V2_COM_SYS_CLK_CTRL 0x03c +#define QSERDES_V2_COM_SYSCLK_BUF_ENABLE 0x040 +#define QSERDES_V2_COM_PLL_EN 0x044 +#define QSERDES_V2_COM_PLL_IVCO 0x048 +#define QSERDES_V2_COM_LOCK_CMP1_MODE0 0x04c +#define QSERDES_V2_COM_LOCK_CMP2_MODE0 0x050 +#define QSERDES_V2_COM_LOCK_CMP3_MODE0 0x054 +#define QSERDES_V2_COM_LOCK_CMP1_MODE1 0x058 +#define QSERDES_V2_COM_LOCK_CMP2_MODE1 0x05c +#define QSERDES_V2_COM_LOCK_CMP3_MODE1 0x060 +#define QSERDES_V2_COM_EP_CLOCK_DETECT_CTR 0x068 +#define QSERDES_V2_COM_SYSCLK_DET_COMP_STATUS 0x06c +#define QSERDES_V2_COM_CLK_EP_DIV 0x074 +#define QSERDES_V2_COM_CP_CTRL_MODE0 0x078 +#define QSERDES_V2_COM_CP_CTRL_MODE1 0x07c +#define QSERDES_V2_COM_PLL_RCTRL_MODE0 0x084 +#define QSERDES_V2_COM_PLL_RCTRL_MODE1 0x088 +#define QSERDES_V2_COM_PLL_CCTRL_MODE0 0x090 +#define QSERDES_V2_COM_PLL_CCTRL_MODE1 0x094 +#define QSERDES_V2_COM_PLL_CNTRL 0x09c +#define QSERDES_V2_COM_BIAS_EN_CTRL_BY_PSM 0x0a8 +#define QSERDES_V2_COM_SYSCLK_EN_SEL 0x0ac +#define QSERDES_V2_COM_CML_SYSCLK_SEL 0x0b0 +#define QSERDES_V2_COM_RESETSM_CNTRL 0x0b4 +#define QSERDES_V2_COM_RESETSM_CNTRL2 0x0b8 +#define QSERDES_V2_COM_LOCK_CMP_EN 0x0c8 +#define QSERDES_V2_COM_LOCK_CMP_CFG 0x0cc +#define QSERDES_V2_COM_DEC_START_MODE0 0x0d0 +#define QSERDES_V2_COM_DEC_START_MODE1 0x0d4 +#define QSERDES_V2_COM_VCOCAL_DEADMAN_CTRL 0x0d8 +#define QSERDES_V2_COM_DIV_FRAC_START1_MODE0 0x0dc +#define QSERDES_V2_COM_DIV_FRAC_START2_MODE0 0x0e0 +#define QSERDES_V2_COM_DIV_FRAC_START3_MODE0 0x0e4 +#define QSERDES_V2_COM_DIV_FRAC_START1_MODE1 0x0e8 +#define QSERDES_V2_COM_DIV_FRAC_START2_MODE1 0x0ec +#define QSERDES_V2_COM_DIV_FRAC_START3_MODE1 0x0f0 +#define QSERDES_V2_COM_VCO_TUNE_MINVAL1 0x0f4 +#define QSERDES_V2_COM_VCO_TUNE_MINVAL2 0x0f8 +#define QSERDES_V2_COM_INTEGLOOP_INITVAL 0x100 +#define QSERDES_V2_COM_INTEGLOOP_EN 0x104 +#define QSERDES_V2_COM_INTEGLOOP_GAIN0_MODE0 0x108 +#define QSERDES_V2_COM_INTEGLOOP_GAIN1_MODE0 0x10c +#define QSERDES_V2_COM_INTEGLOOP_GAIN0_MODE1 0x110 +#define QSERDES_V2_COM_INTEGLOOP_GAIN1_MODE1 0x114 +#define QSERDES_V2_COM_VCO_TUNE_MAXVAL1 0x118 +#define QSERDES_V2_COM_VCO_TUNE_MAXVAL2 0x11c +#define QSERDES_V2_COM_VCO_TUNE_CTRL 0x124 +#define QSERDES_V2_COM_VCO_TUNE_MAP 0x128 +#define QSERDES_V2_COM_VCO_TUNE1_MODE0 0x12c +#define QSERDES_V2_COM_VCO_TUNE2_MODE0 0x130 +#define QSERDES_V2_COM_VCO_TUNE1_MODE1 0x134 +#define QSERDES_V2_COM_VCO_TUNE2_MODE1 0x138 +#define QSERDES_V2_COM_VCO_TUNE_INITVAL1 0x13c +#define QSERDES_V2_COM_VCO_TUNE_INITVAL2 0x140 +#define QSERDES_V2_COM_VCO_TUNE_TIMER1 0x144 +#define QSERDES_V2_COM_VCO_TUNE_TIMER2 0x148 +#define QSERDES_V2_COM_CMN_STATUS 0x15c +#define QSERDES_V2_COM_RESET_SM_STATUS 0x160 +#define QSERDES_V2_COM_RESTRIM_CODE_STATUS 0x164 +#define QSERDES_V2_COM_PLLCAL_CODE1_STATUS 0x168 +#define QSERDES_V2_COM_PLLCAL_CODE2_STATUS 0x16c +#define QSERDES_V2_COM_CLK_SELECT 0x174 +#define QSERDES_V2_COM_HSCLK_SEL 0x178 +#define QSERDES_V2_COM_INTEGLOOP_BINCODE_STATUS 0x17c +#define QSERDES_V2_COM_PLL_ANALOG 0x180 +#define QSERDES_V2_COM_CORECLK_DIV 0x184 +#define QSERDES_V2_COM_SW_RESET 0x188 +#define QSERDES_V2_COM_CORE_CLK_EN 0x18c +#define QSERDES_V2_COM_C_READY_STATUS 0x190 +#define QSERDES_V2_COM_CMN_CONFIG 0x194 +#define QSERDES_V2_COM_CMN_RATE_OVERRIDE 0x198 +#define QSERDES_V2_COM_SVS_MODE_CLK_SEL 0x19c +#define QSERDES_V2_COM_DEBUG_BUS0 0x1a0 +#define QSERDES_V2_COM_DEBUG_BUS1 0x1a4 +#define QSERDES_V2_COM_DEBUG_BUS2 0x1a8 +#define QSERDES_V2_COM_DEBUG_BUS3 0x1ac +#define QSERDES_V2_COM_DEBUG_BUS_SEL 0x1b0 +#define QSERDES_V2_COM_CMN_MISC1 0x1b4 +#define QSERDES_V2_COM_CMN_MISC2 0x1b8 +#define QSERDES_V2_COM_CORECLK_DIV_MODE1 0x1bc + +#endif diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-qserdes-txrx-v2.h b/drivers/= phy/qualcomm/phy-qcom-qmp-qserdes-txrx-v2.h new file mode 100644 index 0000000000000000000000000000000000000000..34919720b7bc457ae9549e7c538= 64be01a27a9b3 --- /dev/null +++ b/drivers/phy/qualcomm/phy-qcom-qmp-qserdes-txrx-v2.h @@ -0,0 +1,68 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2017, The Linux Foundation. All rights reserved. + */ + +#ifndef QCOM_PHY_QMP_QSERDES_TXRX_V2_H_ +#define QCOM_PHY_QMP_QSERDES_TXRX_V2_H_ + +/* Only for QMP V2 PHY - TX registers */ +#define QSERDES_V2_TX_BIST_MODE_LANENO 0x000 +#define QSERDES_V2_TX_CLKBUF_ENABLE 0x008 +#define QSERDES_V2_TX_TX_EMP_POST1_LVL 0x00c +#define QSERDES_V2_TX_TX_DRV_LVL 0x01c +#define QSERDES_V2_TX_RESET_TSYNC_EN 0x024 +#define QSERDES_V2_TX_PRE_STALL_LDO_BOOST_EN 0x028 +#define QSERDES_V2_TX_TX_BAND 0x02c +#define QSERDES_V2_TX_SLEW_CNTL 0x030 +#define QSERDES_V2_TX_INTERFACE_SELECT 0x034 +#define QSERDES_V2_TX_RES_CODE_LANE_TX 0x03c +#define QSERDES_V2_TX_RES_CODE_LANE_RX 0x040 +#define QSERDES_V2_TX_RES_CODE_LANE_OFFSET_TX 0x044 +#define QSERDES_V2_TX_RES_CODE_LANE_OFFSET_RX 0x048 +#define QSERDES_V2_TX_DEBUG_BUS_SEL 0x058 +#define QSERDES_V2_TX_TRANSCEIVER_BIAS_EN 0x05c +#define QSERDES_V2_TX_HIGHZ_DRVR_EN 0x060 +#define QSERDES_V2_TX_TX_POL_INV 0x064 +#define QSERDES_V2_TX_PARRATE_REC_DETECT_IDLE_EN 0x068 +#define QSERDES_V2_TX_LANE_MODE_1 0x08c +#define QSERDES_V2_TX_LANE_MODE_2 0x090 +#define QSERDES_V2_TX_LANE_MODE_3 0x094 +#define QSERDES_V2_TX_RCV_DETECT_LVL_2 0x0a4 +#define QSERDES_V2_TX_TRAN_DRVR_EMP_EN 0x0c0 +#define QSERDES_V2_TX_TX_INTERFACE_MODE 0x0c4 +#define QSERDES_V2_TX_VMODE_CTRL1 0x0f0 + +/* Only for QMP V2 PHY - RX registers */ +#define QSERDES_V2_RX_UCDR_FO_GAIN 0x008 +#define QSERDES_V2_RX_UCDR_SO_GAIN_HALF 0x00c +#define QSERDES_V2_RX_UCDR_SO_GAIN 0x014 +#define QSERDES_V2_RX_UCDR_SVS_SO_GAIN_HALF 0x024 +#define QSERDES_V2_RX_UCDR_SVS_SO_GAIN_QUARTER 0x028 +#define QSERDES_V2_RX_UCDR_SVS_SO_GAIN 0x02c +#define QSERDES_V2_RX_UCDR_FASTLOCK_FO_GAIN 0x030 +#define QSERDES_V2_RX_UCDR_SO_SATURATION_AND_ENABLE 0x034 +#define QSERDES_V2_RX_UCDR_FASTLOCK_COUNT_LOW 0x03c +#define QSERDES_V2_RX_UCDR_FASTLOCK_COUNT_HIGH 0x040 +#define QSERDES_V2_RX_UCDR_PI_CONTROLS 0x044 +#define QSERDES_V2_RX_RX_TERM_BW 0x07c +#define QSERDES_V2_RX_VGA_CAL_CNTRL1 0x0bc +#define QSERDES_V2_RX_VGA_CAL_CNTRL2 0x0c0 +#define QSERDES_V2_RX_RX_EQ_GAIN2_LSB 0x0c8 +#define QSERDES_V2_RX_RX_EQ_GAIN2_MSB 0x0cc +#define QSERDES_V2_RX_RX_EQU_ADAPTOR_CNTRL1 0x0d0 +#define QSERDES_V2_RX_RX_EQU_ADAPTOR_CNTRL2 0x0d4 +#define QSERDES_V2_RX_RX_EQU_ADAPTOR_CNTRL3 0x0d8 +#define QSERDES_V2_RX_RX_EQU_ADAPTOR_CNTRL4 0x0dc +#define QSERDES_V2_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1 0x0f8 +#define QSERDES_V2_RX_RX_OFFSET_ADAPTOR_CNTRL2 0x0fc +#define QSERDES_V2_RX_SIGDET_ENABLES 0x100 +#define QSERDES_V2_RX_SIGDET_CNTRL 0x104 +#define QSERDES_V2_RX_SIGDET_LVL 0x108 +#define QSERDES_V2_RX_SIGDET_DEGLITCH_CNTRL 0x10c +#define QSERDES_V2_RX_RX_BAND 0x110 +#define QSERDES_V2_RX_RX_INTERFACE_MODE 0x11c +#define QSERDES_V2_RX_RX_MODE_00 0x164 +#define QSERDES_V2_RX_RX_MODE_01 0x168 + +#endif diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.h b/drivers/phy/qualcomm/phy= -qcom-qmp.h index f58c82b2dd23e1bda616d67ab7993794b997063b..1a9e4cc5aa11d6e18d97ce93d0e= 44c9a5afa3fbf 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp.h +++ b/drivers/phy/qualcomm/phy-qcom-qmp.h @@ -9,6 +9,9 @@ #include "phy-qcom-qmp-qserdes-com.h" #include "phy-qcom-qmp-qserdes-txrx.h" =20 +#include "phy-qcom-qmp-qserdes-com-v2.h" +#include "phy-qcom-qmp-qserdes-txrx-v2.h" + #include "phy-qcom-qmp-qserdes-com-v3.h" #include "phy-qcom-qmp-qserdes-txrx-v3.h" =20 --=20 2.34.1 From nobody Wed Oct 1 23:35:02 2025 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 161CC29D280 for ; Fri, 26 Sep 2025 07:27:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758871662; cv=none; b=jUhVi/vfs5nJ2yBqIMXHVtqXmDiO69U9LzQNdEz9xWKOfCTB9mrBI+ujq3xjaTsnHvISNcV3kvjgDWTqiCgeccxvy+wgLaGAXk6N7WT77Se/Dwe2A783o7VvGTDBPWq8cCmBtOwmBo51WOerOJIL6Sg0QILi5kmJV0hxV0vd2uU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758871662; c=relaxed/simple; bh=bAcJPNht/+rnG7uZv7s+NNJvq4heKp19LQ+dsihcBNQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MkFGvecTJ5PBONXRLlo1UBLyc5MrIg5vFLoqmhuKshyT77Hu86cjq1+l+97/DpEG1IjBD6BvQ18CKFwYLj4+t6+qoUWi6SUD2dtPUhxMsIKGm7v/NDIkNzuBssDWSRvT6Fm2LKUnorDVzfz9KCndEMAC6HJfiJVOz1JV/1VXptA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=KeTeE/j+; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="KeTeE/j+" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 58Q6latO015771 for ; Fri, 26 Sep 2025 07:27:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= OymEGRX9BPbmJJk3jd9hUj8zYXUCvOAy4RsQcEnI+98=; b=KeTeE/j+fMwqurqj i6AEHHu5WXeK5/wLt8YN3Ohd7nEGaKIY3uzFlnB4XICL863Oj9r/IQWF2UXirp2c gadbrvgD0I6RRgZ+2NS73UdMBQb+Hdah2zILsjKmcqjX4yM83xhjVJ1zQrPzU8EC G2datMy40topC4U1LjvLEC+uaVoAHx7OJFx9Bsbzpz4YYOEwdTQSKfuA7zksWZMg BylKIxR1N1lNzsjgyG9xGo5JcozUyDP14eRNFpcEcNiTlrXVJHeoMc3XXVlRpsJr UUhd8HAU1cY+RsoI8A4QxeA1lJcJ54KxlJL+hh3z9uqOuthfM8yxuLG26EK1JvVr qnexbQ== Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 49db0t9wvq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 26 Sep 2025 07:27:38 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2680b3acdf0so4403945ad.2 for ; Fri, 26 Sep 2025 00:27:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758871658; x=1759476458; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OymEGRX9BPbmJJk3jd9hUj8zYXUCvOAy4RsQcEnI+98=; b=bGlZ51ZtbXYPgX0FaodZiOLlZe/vRxvU32pGioD6b71qmK4mhfr4JdoqClk5OhGkSU HNsBE9G4H4UJ8tgXyqPdDFbBgiFshXSDUtqQG+SHkfrUS4ESfFMrz7/wBgWvMKe9IT3m lTVIRNDkI8noLI8xOOtIUrChvvC3bpOhNEtIaCKk+tPUfqri8KTSG0G3RmlxnjI66aXl f3R9HHGQIY7ZulFM3SohQIRihMFX+VE9AMgSGvgCRY79iSuPdGTUNCEgBcHx/nwCjMqe 4d0AgOoINvFHikUWMQBAlFwoCGB77e4suGrTK5X/R2TdWV9weKTzYHL640ZQNIHynzyN VI+w== X-Forwarded-Encrypted: i=1; AJvYcCV/d8O2k7JNxZyZKGTQFmuy0b93GRiei0yFQrdlQuGl/AW0R8QCwae7OsND1jPPUlb5LBGuScz1dQuu+Qk=@vger.kernel.org X-Gm-Message-State: AOJu0Yw38EjqAn2n/pSS40B4EP16FsqC6tlFi07y+QYIgau9DCbVJ9iU 820BahdEcbc9+1d79/7h3kGwNB15tbUqJH5wtaLEcgLjr0Jsgx7EwGCbYruUbd8yeQhX/O0eaVx zGeJjjyUZmpGIwG6OMFEK1tQBGMPC+9IYb01Yera39BLbt1Oq2Vw5XXIcNbgploxNTtA= X-Gm-Gg: ASbGnctVHFoHqDmforUI32SnPsOBEn6UMHyjPz21emyuG4DLEt9GW2txdoFneq4Aymn UmQG4uq1oRND9AYDgcghveW1aTJ8oAmYoKL9CjpOmZem4ffn+Ai7Pcgkj3M4w4ZsWL0TlH2gutL cEdDK9GoNNXa05EGTPvoRUs8dU7Nf65dwDMtZGzMMc0evZ7KmBnI4J+X672z46KyH7zBF/GS5uA OiI6nRp/p6u+LnE0HBpaiJwfOG+3xfM/YrFsX6CJMmx+UEeQuOabj1q8u7NjRfc/3R0WvoqSf57 bwPWCEEuzCYgLP2G3pNh9QL9jgWC+C8e57Xlh/PcqDnUkdrTuuPOUEv3SmmJqjJtw8wGnNDYBz8 2WLeqHqmB2487SWGQeN73TZ7VqhpNf3+tgcixobP0QtZKmRwevyv1yv8z X-Received: by 2002:a17:903:32cf:b0:269:80e2:c5a8 with SMTP id d9443c01a7336-27ed4a36556mr42844545ad.7.1758871657082; Fri, 26 Sep 2025 00:27:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGPP+Ypu93N21m8S6kBgBSMJBRXMD3hXCuDSD66NazWdrAWQ5ZFGsGBW2MYZ9RZjYC42kBGag== X-Received: by 2002:a17:903:32cf:b0:269:80e2:c5a8 with SMTP id d9443c01a7336-27ed4a36556mr42844195ad.7.1758871656533; Fri, 26 Sep 2025 00:27:36 -0700 (PDT) Received: from sziotdisp01-gv.qualcomm.com.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-27ed671d8a2sm45117985ad.55.2025.09.26.00.27.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Sep 2025 00:27:36 -0700 (PDT) From: Xiangxu Yin Date: Fri, 26 Sep 2025 15:25:48 +0800 Subject: [PATCH v7 12/14] phy: qcom: qmp-usbc: Add QCS615 USB/DP PHY config and DP mode support Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250926-add-displayport-support-for-qcs615-platform-v7-12-dc5edaac6c2b@oss.qualcomm.com> References: <20250926-add-displayport-support-for-qcs615-platform-v7-0-dc5edaac6c2b@oss.qualcomm.com> In-Reply-To: <20250926-add-displayport-support-for-qcs615-platform-v7-0-dc5edaac6c2b@oss.qualcomm.com> To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Sean Paul , Marijn Suijten , David Airlie , Simona Vetter Cc: linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, fange.zhang@oss.qualcomm.com, yongxing.mou@oss.qualcomm.com, li.liu@oss.qualcomm.com, Dmitry Baryshkov , Bjorn Andersson , Konrad Dybcio , Xiangxu Yin X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1758871564; l=17174; i=xiangxu.yin@oss.qualcomm.com; s=20241125; h=from:subject:message-id; bh=bAcJPNht/+rnG7uZv7s+NNJvq4heKp19LQ+dsihcBNQ=; b=9Vrv75s6dH1x+rP9Q3wQeDjWty1+Ijt9S1ZGYrYcSefijB25kVFVo3D7RY/bZE30aFJdrF3uC ew1kwEGd6GKD8CgOPyshFBl3m8KDk5BjkvEvdXtyLhIFWXIBgDvqy2W X-Developer-Key: i=xiangxu.yin@oss.qualcomm.com; a=ed25519; pk=F1TwipJzpywfbt3n/RPi4l/A4AVF+QC89XzCHgZYaOc= X-Proofpoint-ORIG-GUID: m1aIzoG5YbS-lqcorebcdQiIJh590CVQ X-Proofpoint-GUID: m1aIzoG5YbS-lqcorebcdQiIJh590CVQ X-Authority-Analysis: v=2.4 cv=Jvz8bc4C c=1 sm=1 tr=0 ts=68d6406b cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=yJojWOMRYYMA:10 a=EUspDBNiAAAA:8 a=shGh-05uZheFR9ghjlIA:9 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTI1MDE3MSBTYWx0ZWRfX+Pbm/BG1T0LB sYemoXRoWmGxI1c5qw4Oez2cmEjOTf+xz6mrbwcmTSlGrHiG7IXmbjUcZwXV/9nv2tEEZSG7jCG y0U5NxGCp1pSjlspQHB5qXoYh9EHf4IzhnqQ2O4hdG2fXYtkus2k0KMelsfLuRvjAwY5U/SOrZe /pDE5LNyVh/yf3Njti7+ZX8xhccprGzI/vtpdaTTSr0kYYb/8Hn1rfIOovohAiJOEpKy8ZXz5Oo zTjR8tHRLIHg8uDaH8Yvqj0TPNUrUocLxlZAbXXSBkWcupZVu2Eat3HuljWcYd6HQHjHXYtE9da 9sTjTdc3tEXDlV6N3lPImmsfXN2Bf72ueA8HIiXVU6DsZZYep2+K9BP515yhsE3oBxeKG5OAyM4 hoEwsKJNKm8fJOOM/GSFDYkuThwPkg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1117,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-09-26_02,2025-09-26_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 malwarescore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 suspectscore=0 spamscore=0 priorityscore=1501 adultscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2509150000 definitions=main-2509250171 Add QCS615-specific configuration for USB/DP PHY, including DP init routines, voltage swing tables, and platform data. Add compatible "qcs615-qmp-usb3-dp-phy". Note: SW_PORTSELECT handling for orientation flip is not implemented due to QCS615 fixed-orientation design and non-standard lane mapping. Signed-off-by: Xiangxu Yin Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-qmp-usbc.c | 413 +++++++++++++++++++++++++++= ++++ 1 file changed, 413 insertions(+) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c b/drivers/phy/qualcom= m/phy-qcom-qmp-usbc.c index d84bf68940043bce13565503bb34796e653adbb7..105cc0f4b8dddeed2431d64c2be= 44bda73f6000a 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c @@ -30,6 +30,7 @@ #include "phy-qcom-qmp-pcs-misc-v3.h" =20 #include "phy-qcom-qmp-dp-phy.h" +#include "phy-qcom-qmp-dp-phy-v2.h" =20 #define PHY_INIT_COMPLETE_TIMEOUT 10000 #define SW_PORTSELECT_VAL BIT(0) @@ -289,6 +290,83 @@ static const struct qmp_phy_init_tbl qcm2290_usb3_pcs_= tbl[] =3D { QMP_PHY_INIT_CFG(QPHY_V3_PCS_RX_SIGDET_LVL, 0x88), }; =20 +static const struct qmp_phy_init_tbl qmp_v2_dp_serdes_tbl[] =3D { + QMP_PHY_INIT_CFG(QSERDES_COM_SVS_MODE_CLK_SEL, 0x01), + QMP_PHY_INIT_CFG(QSERDES_COM_SYSCLK_EN_SEL, 0x37), + QMP_PHY_INIT_CFG(QSERDES_COM_CLK_SELECT, 0x00), + QMP_PHY_INIT_CFG(QSERDES_COM_SYS_CLK_CTRL, 0x06), + QMP_PHY_INIT_CFG(QSERDES_COM_BIAS_EN_CLKBUFLR_EN, 0x3f), + QMP_PHY_INIT_CFG(QSERDES_COM_CLK_ENABLE1, 0x0e), + QMP_PHY_INIT_CFG(QSERDES_COM_BG_CTRL, 0x0f), + QMP_PHY_INIT_CFG(QSERDES_COM_SYSCLK_BUF_ENABLE, 0x06), + QMP_PHY_INIT_CFG(QSERDES_COM_CLK_SELECT, 0x30), + QMP_PHY_INIT_CFG(QSERDES_COM_PLL_IVCO, 0x0f), + QMP_PHY_INIT_CFG(QSERDES_COM_PLL_CCTRL_MODE0, 0x28), + QMP_PHY_INIT_CFG(QSERDES_COM_PLL_RCTRL_MODE0, 0x16), + QMP_PHY_INIT_CFG(QSERDES_COM_CP_CTRL_MODE0, 0x0b), + QMP_PHY_INIT_CFG(QSERDES_COM_INTEGLOOP_GAIN0_MODE0, 0x40), + QMP_PHY_INIT_CFG(QSERDES_COM_INTEGLOOP_GAIN1_MODE0, 0x00), + QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_MAP, 0x00), + QMP_PHY_INIT_CFG(QSERDES_COM_BG_TIMER, 0x08), + QMP_PHY_INIT_CFG(QSERDES_COM_CORECLK_DIV, 0x05), + QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_CTRL, 0x00), + QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE1_MODE0, 0x00), + QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE2_MODE0, 0x00), + QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_CTRL, 0x00), + QMP_PHY_INIT_CFG(QSERDES_COM_CORE_CLK_EN, 0x0f), + QMP_PHY_INIT_CFG(QSERDES_COM_CMN_CONFIG, 0x02), +}; + +static const struct qmp_phy_init_tbl qmp_v2_dp_serdes_tbl_rbr[] =3D { + QMP_PHY_INIT_CFG(QSERDES_COM_HSCLK_SEL, 0x2c), + QMP_PHY_INIT_CFG(QSERDES_COM_DEC_START_MODE0, 0x69), + QMP_PHY_INIT_CFG(QSERDES_COM_DIV_FRAC_START1_MODE0, 0x00), + QMP_PHY_INIT_CFG(QSERDES_COM_DIV_FRAC_START2_MODE0, 0x80), + QMP_PHY_INIT_CFG(QSERDES_COM_DIV_FRAC_START3_MODE0, 0x07), + QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP1_MODE0, 0xbf), + QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP2_MODE0, 0x21), + QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP3_MODE0, 0x00), +}; + +static const struct qmp_phy_init_tbl qmp_v2_dp_serdes_tbl_hbr[] =3D { + QMP_PHY_INIT_CFG(QSERDES_COM_HSCLK_SEL, 0x24), + QMP_PHY_INIT_CFG(QSERDES_COM_DEC_START_MODE0, 0x69), + QMP_PHY_INIT_CFG(QSERDES_COM_DIV_FRAC_START1_MODE0, 0x00), + QMP_PHY_INIT_CFG(QSERDES_COM_DIV_FRAC_START2_MODE0, 0x80), + QMP_PHY_INIT_CFG(QSERDES_COM_DIV_FRAC_START3_MODE0, 0x07), + QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP1_MODE0, 0x3f), + QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP2_MODE0, 0x38), + QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP3_MODE0, 0x00), +}; + +static const struct qmp_phy_init_tbl qmp_v2_dp_serdes_tbl_hbr2[] =3D { + QMP_PHY_INIT_CFG(QSERDES_COM_HSCLK_SEL, 0x20), + QMP_PHY_INIT_CFG(QSERDES_COM_DEC_START_MODE0, 0x8c), + QMP_PHY_INIT_CFG(QSERDES_COM_DIV_FRAC_START1_MODE0, 0x00), + QMP_PHY_INIT_CFG(QSERDES_COM_DIV_FRAC_START2_MODE0, 0x00), + QMP_PHY_INIT_CFG(QSERDES_COM_DIV_FRAC_START3_MODE0, 0x0a), + QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP1_MODE0, 0x7f), + QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP2_MODE0, 0x70), + QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP3_MODE0, 0x00), +}; + +static const struct qmp_phy_init_tbl qmp_v2_dp_tx_tbl[] =3D { + QMP_PHY_INIT_CFG(QSERDES_V2_TX_TRANSCEIVER_BIAS_EN, 0x1a), + QMP_PHY_INIT_CFG(QSERDES_V2_TX_VMODE_CTRL1, 0x40), + QMP_PHY_INIT_CFG(QSERDES_V2_TX_PRE_STALL_LDO_BOOST_EN, 0x30), + QMP_PHY_INIT_CFG(QSERDES_V2_TX_INTERFACE_SELECT, 0x3d), + QMP_PHY_INIT_CFG(QSERDES_V2_TX_CLKBUF_ENABLE, 0x0f), + QMP_PHY_INIT_CFG(QSERDES_V2_TX_RESET_TSYNC_EN, 0x03), + QMP_PHY_INIT_CFG(QSERDES_V2_TX_TRAN_DRVR_EMP_EN, 0x03), + QMP_PHY_INIT_CFG(QSERDES_V2_TX_PARRATE_REC_DETECT_IDLE_EN, 0x00), + QMP_PHY_INIT_CFG(QSERDES_V2_TX_TX_INTERFACE_MODE, 0x00), + QMP_PHY_INIT_CFG(QSERDES_V2_TX_TX_EMP_POST1_LVL, 0x2b), + QMP_PHY_INIT_CFG(QSERDES_V2_TX_TX_DRV_LVL, 0x2f), + QMP_PHY_INIT_CFG(QSERDES_V2_TX_TX_BAND, 0x4), + QMP_PHY_INIT_CFG(QSERDES_V2_TX_RES_CODE_LANE_OFFSET_TX, 0x12), + QMP_PHY_INIT_CFG(QSERDES_V2_TX_RES_CODE_LANE_OFFSET_RX, 0x12), +}; + struct qmp_usbc_offsets { u16 serdes; u16 pcs; @@ -434,6 +512,10 @@ static const char * const usb3phy_reset_l[] =3D { "phy_phy", "phy", }; =20 +static const char * const usb3dpphy_reset_l[] =3D { + "phy_phy", "dp_phy", +}; + static const struct regulator_bulk_data qmp_phy_msm8998_vreg_l[] =3D { { .supply =3D "vdda-phy", .init_load_uA =3D 68600 }, { .supply =3D "vdda-pll", .init_load_uA =3D 14200 }, @@ -459,6 +541,34 @@ static const struct qmp_usbc_offsets qmp_usbc_offsets_= v3_qcm2290 =3D { .rx2 =3D 0x800, }; =20 +static const struct qmp_usbc_offsets qmp_usbc_usb3dp_offsets_qcs615 =3D { + .serdes =3D 0x0, + .pcs =3D 0xc00, + .pcs_misc =3D 0xa00, + .tx =3D 0x200, + .rx =3D 0x400, + .tx2 =3D 0x600, + .rx2 =3D 0x800, + .dp_serdes =3D 0x1c00, + .dp_txa =3D 0x1400, + .dp_txb =3D 0x1800, + .dp_dp_phy =3D 0x1000, +}; + +static const u8 qmp_v2_dp_pre_emphasis_hbr2_rbr[4][4] =3D { + {0x00, 0x0b, 0x12, 0xff}, + {0x00, 0x0a, 0x12, 0xff}, + {0x00, 0x0c, 0xff, 0xff}, + {0xff, 0xff, 0xff, 0xff} +}; + +static const u8 qmp_v2_dp_voltage_swing_hbr2_rbr[4][4] =3D { + {0x07, 0x0f, 0x14, 0xff}, + {0x11, 0x1d, 0x1f, 0xff}, + {0x18, 0x1f, 0xff, 0xff}, + {0xff, 0xff, 0xff, 0xff} +}; + static const struct qmp_phy_cfg msm8998_usb3phy_cfg =3D { .offsets =3D &qmp_usbc_offsets_v3_qcm2290, =20 @@ -531,6 +641,51 @@ static const struct qmp_phy_cfg qcs615_usb3phy_cfg =3D= { .regs =3D qmp_v3_usb3phy_regs_layout_qcm2290, }; =20 +static void qmp_v2_dp_aux_init(struct qmp_usbc *qmp); +static void qmp_v2_configure_dp_tx(struct qmp_usbc *qmp); +static int qmp_v2_configure_dp_phy(struct qmp_usbc *qmp); +static int qmp_v2_calibrate_dp_phy(struct qmp_usbc *qmp); + +static const struct qmp_phy_cfg qcs615_usb3dp_phy_cfg =3D { + .offsets =3D &qmp_usbc_usb3dp_offsets_qcs615, + + .serdes_tbl =3D qcm2290_usb3_serdes_tbl, + .serdes_tbl_num =3D ARRAY_SIZE(qcm2290_usb3_serdes_tbl), + .tx_tbl =3D qcm2290_usb3_tx_tbl, + .tx_tbl_num =3D ARRAY_SIZE(qcm2290_usb3_tx_tbl), + .rx_tbl =3D qcm2290_usb3_rx_tbl, + .rx_tbl_num =3D ARRAY_SIZE(qcm2290_usb3_rx_tbl), + .pcs_tbl =3D qcm2290_usb3_pcs_tbl, + .pcs_tbl_num =3D ARRAY_SIZE(qcm2290_usb3_pcs_tbl), + + .regs =3D qmp_v3_usb3phy_regs_layout_qcm2290, + + .dp_serdes_tbl =3D qmp_v2_dp_serdes_tbl, + .dp_serdes_tbl_num =3D ARRAY_SIZE(qmp_v2_dp_serdes_tbl), + .dp_tx_tbl =3D qmp_v2_dp_tx_tbl, + .dp_tx_tbl_num =3D ARRAY_SIZE(qmp_v2_dp_tx_tbl), + + .serdes_tbl_rbr =3D qmp_v2_dp_serdes_tbl_rbr, + .serdes_tbl_rbr_num =3D ARRAY_SIZE(qmp_v2_dp_serdes_tbl_rbr), + .serdes_tbl_hbr =3D qmp_v2_dp_serdes_tbl_hbr, + .serdes_tbl_hbr_num =3D ARRAY_SIZE(qmp_v2_dp_serdes_tbl_hbr), + .serdes_tbl_hbr2 =3D qmp_v2_dp_serdes_tbl_hbr2, + .serdes_tbl_hbr2_num =3D ARRAY_SIZE(qmp_v2_dp_serdes_tbl_hbr2), + + .swing_tbl =3D &qmp_v2_dp_voltage_swing_hbr2_rbr, + .pre_emphasis_tbl =3D &qmp_v2_dp_pre_emphasis_hbr2_rbr, + + .dp_aux_init =3D qmp_v2_dp_aux_init, + .configure_dp_tx =3D qmp_v2_configure_dp_tx, + .configure_dp_phy =3D qmp_v2_configure_dp_phy, + .calibrate_dp_phy =3D qmp_v2_calibrate_dp_phy, + + .reset_list =3D usb3dpphy_reset_l, + .num_resets =3D ARRAY_SIZE(usb3dpphy_reset_l), + .vreg_list =3D qmp_phy_qcs615_vreg_l, + .num_vregs =3D ARRAY_SIZE(qmp_phy_qcs615_vreg_l), +}; + static void qmp_usbc_set_phy_mode(struct qmp_usbc *qmp, bool is_dp) { if (qmp->tcsr_map && qmp->dp_phy_mode_reg) @@ -589,6 +744,253 @@ static int qmp_usbc_com_exit(struct phy *phy) return 0; } =20 +static void qmp_v2_dp_aux_init(struct qmp_usbc *qmp) +{ + writel(DP_PHY_PD_CTL_AUX_PWRDN | + DP_PHY_PD_CTL_LANE_0_1_PWRDN | DP_PHY_PD_CTL_LANE_2_3_PWRDN | + DP_PHY_PD_CTL_PLL_PWRDN, + qmp->dp_dp_phy + QSERDES_DP_PHY_PD_CTL); + + writel(DP_PHY_PD_CTL_PWRDN | DP_PHY_PD_CTL_AUX_PWRDN | + DP_PHY_PD_CTL_LANE_0_1_PWRDN | DP_PHY_PD_CTL_LANE_2_3_PWRDN | + DP_PHY_PD_CTL_PLL_PWRDN, + qmp->dp_dp_phy + QSERDES_DP_PHY_PD_CTL); + + writel(0x00, qmp->dp_dp_phy + QSERDES_DP_PHY_AUX_CFG0); + writel(0x13, qmp->dp_dp_phy + QSERDES_DP_PHY_AUX_CFG1); + writel(0x00, qmp->dp_dp_phy + QSERDES_DP_PHY_AUX_CFG2); + writel(0x00, qmp->dp_dp_phy + QSERDES_DP_PHY_AUX_CFG3); + writel(0x0a, qmp->dp_dp_phy + QSERDES_DP_PHY_AUX_CFG4); + writel(0x26, qmp->dp_dp_phy + QSERDES_DP_PHY_AUX_CFG5); + writel(0x0a, qmp->dp_dp_phy + QSERDES_DP_PHY_AUX_CFG6); + writel(0x03, qmp->dp_dp_phy + QSERDES_DP_PHY_AUX_CFG7); + writel(0xbb, qmp->dp_dp_phy + QSERDES_DP_PHY_AUX_CFG8); + writel(0x03, qmp->dp_dp_phy + QSERDES_DP_PHY_AUX_CFG9); + qmp->dp_aux_cfg =3D 0; + + writel(PHY_AUX_STOP_ERR_MASK | PHY_AUX_DEC_ERR_MASK | + PHY_AUX_SYNC_ERR_MASK | PHY_AUX_ALIGN_ERR_MASK | + PHY_AUX_REQ_ERR_MASK, + qmp->dp_dp_phy + QSERDES_V2_DP_PHY_AUX_INTERRUPT_MASK); +} + +static int qmp_v2_configure_dp_swing(struct qmp_usbc *qmp) +{ + const struct qmp_phy_cfg *cfg =3D qmp->cfg; + const struct phy_configure_opts_dp *dp_opts =3D &qmp->dp_opts; + void __iomem *tx =3D qmp->dp_tx; + void __iomem *tx2 =3D qmp->dp_tx2; + unsigned int v_level =3D 0, p_level =3D 0; + u8 voltage_swing_cfg, pre_emphasis_cfg; + int i; + + if (dp_opts->lanes > 4) { + dev_err(qmp->dev, "Invalid lane_num(%d)\n", dp_opts->lanes); + return -EINVAL; + } + + for (i =3D 0; i < dp_opts->lanes; i++) { + v_level =3D max(v_level, dp_opts->voltage[i]); + p_level =3D max(p_level, dp_opts->pre[i]); + } + + if (v_level > 4 || p_level > 4) { + dev_err(qmp->dev, "Invalid v(%d) | p(%d) level)\n", + v_level, p_level); + return -EINVAL; + } + + voltage_swing_cfg =3D (*cfg->swing_tbl)[v_level][p_level]; + pre_emphasis_cfg =3D (*cfg->pre_emphasis_tbl)[v_level][p_level]; + + voltage_swing_cfg |=3D DP_PHY_TXn_TX_DRV_LVL_MUX_EN; + pre_emphasis_cfg |=3D DP_PHY_TXn_TX_EMP_POST1_LVL_MUX_EN; + + if (voltage_swing_cfg =3D=3D 0xff && pre_emphasis_cfg =3D=3D 0xff) + return -EINVAL; + + writel(voltage_swing_cfg, tx + QSERDES_V2_TX_TX_DRV_LVL); + writel(pre_emphasis_cfg, tx + QSERDES_V2_TX_TX_EMP_POST1_LVL); + writel(voltage_swing_cfg, tx2 + QSERDES_V2_TX_TX_DRV_LVL); + writel(pre_emphasis_cfg, tx2 + QSERDES_V2_TX_TX_EMP_POST1_LVL); + + return 0; +} + +static void qmp_usbc_configure_dp_mode(struct qmp_usbc *qmp) +{ + bool reverse =3D (qmp->orientation =3D=3D TYPEC_ORIENTATION_REVERSE); + u32 val; + + val =3D DP_PHY_PD_CTL_PWRDN | DP_PHY_PD_CTL_AUX_PWRDN | + DP_PHY_PD_CTL_PLL_PWRDN | DP_PHY_PD_CTL_LANE_0_1_PWRDN | DP_PHY_PD_= CTL_LANE_2_3_PWRDN; + + writel(val, qmp->dp_dp_phy + QSERDES_DP_PHY_PD_CTL); + + if (reverse) + writel(0xc9, qmp->dp_dp_phy + QSERDES_DP_PHY_MODE); + else + writel(0xd9, qmp->dp_dp_phy + QSERDES_DP_PHY_MODE); +} + +static int qmp_usbc_configure_dp_clocks(struct qmp_usbc *qmp) +{ + const struct phy_configure_opts_dp *dp_opts =3D &qmp->dp_opts; + u32 phy_vco_div; + unsigned long pixel_freq; + + switch (dp_opts->link_rate) { + case 1620: + phy_vco_div =3D 0x1; + pixel_freq =3D 1620000000UL / 2; + break; + case 2700: + phy_vco_div =3D 0x1; + pixel_freq =3D 2700000000UL / 2; + break; + case 5400: + phy_vco_div =3D 0x2; + pixel_freq =3D 5400000000UL / 4; + break; + default: + dev_err(qmp->dev, "link rate:%d not supported\n", dp_opts->link_rate); + return -EINVAL; + } + writel(phy_vco_div, qmp->dp_dp_phy + QSERDES_V2_DP_PHY_VCO_DIV); + + clk_set_rate(qmp->dp_link_hw.clk, dp_opts->link_rate * 100000); + clk_set_rate(qmp->dp_pixel_hw.clk, pixel_freq); + + return 0; +} + +static void qmp_v2_configure_dp_tx(struct qmp_usbc *qmp) +{ + const struct phy_configure_opts_dp *dp_opts =3D &qmp->dp_opts; + void __iomem *tx =3D qmp->dp_tx; + void __iomem *tx2 =3D qmp->dp_tx2; + + /* program default setting first */ + writel(0x2a, tx + QSERDES_V2_TX_TX_DRV_LVL); + writel(0x20, tx + QSERDES_V2_TX_TX_EMP_POST1_LVL); + writel(0x2a, tx2 + QSERDES_V2_TX_TX_DRV_LVL); + writel(0x20, tx2 + QSERDES_V2_TX_TX_EMP_POST1_LVL); + + if (dp_opts->link_rate >=3D 2700) { + writel(0xc4, tx + QSERDES_V2_TX_LANE_MODE_1); + writel(0xc4, tx2 + QSERDES_V2_TX_LANE_MODE_1); + } else { + writel(0xc6, tx + QSERDES_V2_TX_LANE_MODE_1); + writel(0xc6, tx2 + QSERDES_V2_TX_LANE_MODE_1); + } + + qmp_v2_configure_dp_swing(qmp); +} + +static int qmp_v2_configure_dp_phy(struct qmp_usbc *qmp) +{ + u32 status; + int ret; + + qmp_usbc_configure_dp_mode(qmp); + + writel(0x05, qmp->dp_dp_phy + QSERDES_V2_DP_PHY_TX0_TX1_LANE_CTL); + writel(0x05, qmp->dp_dp_phy + QSERDES_V2_DP_PHY_TX2_TX3_LANE_CTL); + + ret =3D qmp_usbc_configure_dp_clocks(qmp); + if (ret) + return ret; + + writel(0x01, qmp->dp_dp_phy + QSERDES_DP_PHY_CFG); + writel(0x05, qmp->dp_dp_phy + QSERDES_DP_PHY_CFG); + writel(0x01, qmp->dp_dp_phy + QSERDES_DP_PHY_CFG); + writel(0x09, qmp->dp_dp_phy + QSERDES_DP_PHY_CFG); + + writel(0x20, qmp->dp_serdes + QSERDES_COM_RESETSM_CNTRL); + + if (readl_poll_timeout(qmp->dp_serdes + QSERDES_COM_C_READY_STATUS, + status, + ((status & BIT(0)) > 0), + 500, + 10000)) { + dev_err(qmp->dev, "C_READY not ready\n"); + return -ETIMEDOUT; + } + + if (readl_poll_timeout(qmp->dp_serdes + QSERDES_COM_CMN_STATUS, + status, + ((status & BIT(0)) > 0), + 500, + 10000)){ + dev_err(qmp->dev, "FREQ_DONE not ready\n"); + return -ETIMEDOUT; + } + + if (readl_poll_timeout(qmp->dp_serdes + QSERDES_COM_CMN_STATUS, + status, + ((status & BIT(1)) > 0), + 500, + 10000)){ + dev_err(qmp->dev, "PLL_LOCKED not ready\n"); + return -ETIMEDOUT; + } + + writel(0x19, qmp->dp_dp_phy + QSERDES_DP_PHY_CFG); + + if (readl_poll_timeout(qmp->dp_dp_phy + QSERDES_V2_DP_PHY_STATUS, + status, + ((status & BIT(0)) > 0), + 500, + 10000)){ + dev_err(qmp->dev, "TSYNC_DONE not ready\n"); + return -ETIMEDOUT; + } + + if (readl_poll_timeout(qmp->dp_dp_phy + QSERDES_V2_DP_PHY_STATUS, + status, + ((status & BIT(1)) > 0), + 500, + 10000)){ + dev_err(qmp->dev, "PHY_READY not ready\n"); + return -ETIMEDOUT; + } + + writel(0x3f, qmp->dp_tx + QSERDES_V2_TX_TRANSCEIVER_BIAS_EN); + writel(0x10, qmp->dp_tx + QSERDES_V2_TX_HIGHZ_DRVR_EN); + writel(0x0a, qmp->dp_tx + QSERDES_V2_TX_TX_POL_INV); + writel(0x3f, qmp->dp_tx2 + QSERDES_V2_TX_TRANSCEIVER_BIAS_EN); + writel(0x10, qmp->dp_tx2 + QSERDES_V2_TX_HIGHZ_DRVR_EN); + writel(0x0a, qmp->dp_tx2 + QSERDES_V2_TX_TX_POL_INV); + + writel(0x18, qmp->dp_dp_phy + QSERDES_DP_PHY_CFG); + writel(0x19, qmp->dp_dp_phy + QSERDES_DP_PHY_CFG); + + if (readl_poll_timeout(qmp->dp_dp_phy + QSERDES_V2_DP_PHY_STATUS, + status, + ((status & BIT(1)) > 0), + 500, + 10000)){ + dev_err(qmp->dev, "PHY_READY not ready\n"); + return -ETIMEDOUT; + } + + return 0; +} + +static int qmp_v2_calibrate_dp_phy(struct qmp_usbc *qmp) +{ + static const u8 cfg1_settings[] =3D {0x13, 0x23, 0x1d}; + u8 val; + + qmp->dp_aux_cfg++; + qmp->dp_aux_cfg %=3D ARRAY_SIZE(cfg1_settings); + val =3D cfg1_settings[qmp->dp_aux_cfg]; + + writel(val, qmp->dp_dp_phy + QSERDES_DP_PHY_AUX_CFG1); + + return 0; +} + static int qmp_usbc_usb_power_on(struct phy *phy) { struct qmp_usbc *qmp =3D phy_get_drvdata(phy); @@ -855,6 +1257,14 @@ static int qmp_usbc_dp_power_on(struct phy *phy) void __iomem *tx =3D qmp->dp_tx; void __iomem *tx2 =3D qmp->dp_tx2; =20 + /* + * FIXME: SW_PORTSELECT handling for DP orientation flip is not implement= ed. + * Expected: + * - For standard lane mapping: configure SW_PORTSELECT in QSERDES_DP_PHY= _CFG_1. + * - For non-standard mapping: pass orientation to dp_ctrl and handle flip + * via logical2physical lane remapping. + */ + mutex_lock(&qmp->phy_mutex); =20 qmp_usbc_dp_serdes_init(qmp); @@ -1601,6 +2011,9 @@ static const struct of_device_id qmp_usbc_of_match_ta= ble[] =3D { }, { .compatible =3D "qcom,qcm2290-qmp-usb3-phy", .data =3D &qcm2290_usb3phy_cfg, + }, { + .compatible =3D "qcom,qcs615-qmp-usb3-dp-phy", + .data =3D &qcs615_usb3dp_phy_cfg, }, { .compatible =3D "qcom,qcs615-qmp-usb3-phy", .data =3D &qcs615_usb3phy_cfg, --=20 2.34.1 From nobody Wed Oct 1 23:35:02 2025 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5C1429DB61 for ; Fri, 26 Sep 2025 07:27:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758871668; cv=none; b=jD+ZeArejheNWSneCvKD0ZzJMpQUypwSC8laMVaeeSULcS6dNC/5yEHyTW9OaAj5kbYjGYdHPed5XEK428U1bQm557bnmmk0eMVyUc7V1OAgcGyrk+3T6lGuB/zFhBB7oASSXXbylQGymos4SjhT0C6TmSDLY7ZFIPM6wVrWuH4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758871668; c=relaxed/simple; bh=UeZKmgHCN9l/z6woLU+dgaheHV7gZb8x1YpMg80h2Ho=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=I4pMzBf+cG0e00HXZ15kV9eEVyBm3yDdtIBYLH2qeNPZJnPezoFU+g5PLYy/eB7YjJpJH0ecXQFZo0dp3R1FGQxUORxj3cvjyPprwgoTgAz/G5CPn5i70dAohzDiDYQVLf1SqWu90NPefvxmbBViFtXt1XVGV+ucxsTMR3ByOKo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=CU2kiTjh; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="CU2kiTjh" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 58Q6x4qi015888 for ; Fri, 26 Sep 2025 07:27:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= uVEGKPfTK4CyG256nSXNU/ph37D4/Mz0PD52oseg3XA=; b=CU2kiTjh32UVW9G4 nXpo9ECvQU/n1Q/CBbLN0IPXz7A3KqM6EdheS2G0C7ldcHst0WjVeEEwV/kht+JR jN8nlkjTeq6wgWv9p9BXMmLCdCtGhoN3U5KLzSoytxOywL2iBt7uNw/HKvtceR22 z+VjAwTxy5FBS4rjGrQfy34+AFU5lmf2LbPjmybOCDs7h0lqsraIVjHld76NSitH 3Nj0RHkQzEM6ejaBkm3I1/6413DkWEAYBZweVlQ3yQDaPkAZLkmOt/36YPbwUZSZ payU/DO2uDShaWi6iaznaakRjtbhhgJ1K7T8VEcJfTV4wRXpXPMVCfwrqDQTlU4s lrXHTA== Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 49db0t9wws-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 26 Sep 2025 07:27:45 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-245fbdc2546so4392685ad.0 for ; Fri, 26 Sep 2025 00:27:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758871664; x=1759476464; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uVEGKPfTK4CyG256nSXNU/ph37D4/Mz0PD52oseg3XA=; b=dc+zGC3F/NMx+lV56gAFKRYbU1ALB0FaBUjy/gOS66weaZDh0jS/HIrvlIU9+fhA46 jNF90AdIH6BI/nRVyP0q5D5ZTQOsPkesISFaMrsWJWS6GU7vDg8l+uQwMFaIzbc1I8J2 mhu2TsJLxMGGl+eark84fA4apDXgEkzynARPmGlNrZ19u/PvNmTpEaRbSHOd155oU4ku aGg3ZbsdpWigDG7xKvfcEAcOq/NzYPDs1myHzJGGdWphpOMeCJyKJCxZVfrTM2w7xID/ Dq8H05oWLBAvS4avT7H/GmNKSef8ujIC99TUeD5rXsUegouKlNVB8t3H3gbGuOLfYs1q OGhA== X-Forwarded-Encrypted: i=1; AJvYcCWHjvOn4MRYdWnDx024Hx0YrErQo2MF4hgKATTbzM32dVeh7DBX2qkK6MvazHVdrgoEqWiwiweLR7Tnv4A=@vger.kernel.org X-Gm-Message-State: AOJu0YzmE1qL74IHSjhJVpbDvH6K53r05hPKTNWbfpe7oQbGhfqns2I1 obe9ma0SAcE6k9zV8SDKj4QPPOfMRr9JyM/Kak3E8QceBn8gEVognrhuzUmIpbEhqG6eBxGVWVk dK2UK5+BJnCU13ZFi0zUMYe8JNvmNB0QQ8jxomewhM8jaor8AOyEtX+LASIi6FnkPH64= X-Gm-Gg: ASbGncvBZV7D4XBVVO2PQrbkfatJtO48MrJZq6uYd8mWAy+/qBM8ksSLaz1xL+JaSzc h+mGQhRmJ16vFjr5OKta1/C+DuO127yPSyHI42SWO5fH1IdR2VJw/1i+Ze8IOu/cD2eDOkl1Vh+ 9yAr7xmnJ6tdtIM6tCl7cmiGN1cQzwdp5CO14It9OHZ88Ov7TPUHpHwkLOf6YlROdBfmTmbJKWS RQl3wfDHHAYkPb+SEdnbBu65vJV5+6iikE3SpWRzaaeNwf4GaP1EJ7r+6KCmobREEjzSOWmUSRw S0+RKOJ+Y00EBR0iij14OQObLBVAhpDhBP1A7FHiQmIcIN3NISj7QEzeIR5/qLzmouLa2rgrc0Q cBZk2X0eaCZ61hCAeZxvJQxDjEu4QK1FrOlJIatC76+sQ+5aWOyAGbwtO X-Received: by 2002:a17:902:ea10:b0:276:76e1:2e78 with SMTP id d9443c01a7336-27ed4a65b66mr41166355ad.10.1758871663989; Fri, 26 Sep 2025 00:27:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHTMPQnYrmkydBbyiQIQgniQj5kG7gjh5ulwYoXYRMjjY0NtYlAOwIMTMBHgkZJveqv2i8Q0Q== X-Received: by 2002:a17:902:ea10:b0:276:76e1:2e78 with SMTP id d9443c01a7336-27ed4a65b66mr41166225ad.10.1758871663421; Fri, 26 Sep 2025 00:27:43 -0700 (PDT) Received: from sziotdisp01-gv.qualcomm.com.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-27ed671d8a2sm45117985ad.55.2025.09.26.00.27.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Sep 2025 00:27:43 -0700 (PDT) From: Xiangxu Yin Date: Fri, 26 Sep 2025 15:25:49 +0800 Subject: [PATCH v7 13/14] drm/msm/dp: move link-specific parsing from dp_panel to dp_link Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250926-add-displayport-support-for-qcs615-platform-v7-13-dc5edaac6c2b@oss.qualcomm.com> References: <20250926-add-displayport-support-for-qcs615-platform-v7-0-dc5edaac6c2b@oss.qualcomm.com> In-Reply-To: <20250926-add-displayport-support-for-qcs615-platform-v7-0-dc5edaac6c2b@oss.qualcomm.com> To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Sean Paul , Marijn Suijten , David Airlie , Simona Vetter Cc: linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, fange.zhang@oss.qualcomm.com, yongxing.mou@oss.qualcomm.com, li.liu@oss.qualcomm.com, Dmitry Baryshkov , Bjorn Andersson , Konrad Dybcio , Xiangxu Yin X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1758871565; l=9158; i=xiangxu.yin@oss.qualcomm.com; s=20241125; h=from:subject:message-id; bh=UeZKmgHCN9l/z6woLU+dgaheHV7gZb8x1YpMg80h2Ho=; b=vMBIqrB/792stx1kOuN/XjluhDbtq88XahKNEIswgAUpf1AYnUtt3jVmv5J8tPHNDa06lQh5A 1w9ZGPlmcdFAldjBjAfA7dMiVeTmguqKZNbGHC5N1Kl6bEafKWI/yWA X-Developer-Key: i=xiangxu.yin@oss.qualcomm.com; a=ed25519; pk=F1TwipJzpywfbt3n/RPi4l/A4AVF+QC89XzCHgZYaOc= X-Proofpoint-ORIG-GUID: VgV0v5BrA85NJatJL8F8k8BYOf_YUuJ_ X-Proofpoint-GUID: VgV0v5BrA85NJatJL8F8k8BYOf_YUuJ_ X-Authority-Analysis: v=2.4 cv=Jvz8bc4C c=1 sm=1 tr=0 ts=68d64071 cx=c_pps a=JL+w9abYAAE89/QcEU+0QA==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=yJojWOMRYYMA:10 a=EUspDBNiAAAA:8 a=yj-bGh8x4a1trPqgwHkA:9 a=QEXdDO2ut3YA:10 a=324X-CrmTo6CU4MGRt3R:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTI1MDE3MSBTYWx0ZWRfX7R6CnQx6Z8F+ NfVDcDfcYTuZZRIUoIQ1/UXiCs5w4kdB7dTlnQX1+YEOAlj3Pag5sSW26IR7Vc/uQOfyZnR0fVx 3vJte4dSnRlhOh3xXijimJro6PCOWKfcjSCRqxON2azSLydyBi9TpwsUNf9HRJobkunzK42sKwd Jg3GfH0SGxaafR2j2N9YU1hYYhHzbOUz7qoim4zkQK2fLqANJLF5dHikMz5tMJXRVJbDTy2G/Mm 0pg2oXi208qCka5/DEmltEXB77OKS7e7lZ3UtfuaXijdQ9fEefeKV/Q47gkDmeoqtRr0aT2sJqp uL807gnhey1rto6/8n4NMgkkAgERn1H25FweShU1LXc6bYST+unIkzUoAZilVhA97r5fWZiG/aX bxUj3Q8+nGJOh81iDsna21UGJuLczQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1117,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-09-26_02,2025-09-26_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 malwarescore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 suspectscore=0 spamscore=0 priorityscore=1501 adultscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2509150000 definitions=main-2509250171 Since max_dp_lanes and max_dp_link_rate are link-specific parameters, move their parsing from dp_panel to dp_link for better separation of concerns. Reviewed-by: Dmitry Baryshkov Signed-off-by: Xiangxu Yin --- drivers/gpu/drm/msm/dp/dp_link.c | 57 ++++++++++++++++++++++++++++ drivers/gpu/drm/msm/dp/dp_link.h | 4 ++ drivers/gpu/drm/msm/dp/dp_panel.c | 78 +++++------------------------------= ---- drivers/gpu/drm/msm/dp/dp_panel.h | 3 -- 4 files changed, 70 insertions(+), 72 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_link.c b/drivers/gpu/drm/msm/dp/dp_l= ink.c index 66e1bbd80db3a28f5f16d083486752007ceaf3f7..2aeb3ecf76fab2ee6a9512b785c= a5dceebfc3964 100644 --- a/drivers/gpu/drm/msm/dp/dp_link.c +++ b/drivers/gpu/drm/msm/dp/dp_link.c @@ -6,12 +6,14 @@ #define pr_fmt(fmt) "[drm-dp] %s: " fmt, __func__ =20 #include +#include #include =20 #include "dp_reg.h" #include "dp_link.h" #include "dp_panel.h" =20 +#define DP_LINK_RATE_HBR2 540000 /* kbytes */ #define DP_TEST_REQUEST_MASK 0x7F =20 enum audio_sample_rate { @@ -1210,10 +1212,61 @@ u32 msm_dp_link_get_test_bits_depth(struct msm_dp_l= ink *msm_dp_link, u32 bpp) return tbd; } =20 +static u32 msm_dp_link_link_frequencies(struct device_node *of_node) +{ + struct device_node *endpoint; + u64 frequency =3D 0; + int cnt; + + endpoint =3D of_graph_get_endpoint_by_regs(of_node, 1, 0); /* port@1 */ + if (!endpoint) + return 0; + + cnt =3D of_property_count_u64_elems(endpoint, "link-frequencies"); + + if (cnt > 0) + of_property_read_u64_index(endpoint, "link-frequencies", + cnt - 1, &frequency); + of_node_put(endpoint); + + do_div(frequency, + 10 * /* from symbol rate to link rate */ + 1000); /* kbytes */ + + return frequency; +} + +static int msm_dp_link_parse_dt(struct device *dev, struct msm_dp_link *ms= m_dp_link) +{ + struct device_node *of_node =3D dev->of_node; + int cnt; + + /* + * data-lanes is the property of msm_dp_out endpoint + */ + cnt =3D drm_of_get_data_lanes_count_ep(of_node, 1, 0, 1, DP_MAX_NUM_DP_LA= NES); + if (cnt < 0) { + /* legacy code, data-lanes is the property of mdss_dp node */ + cnt =3D drm_of_get_data_lanes_count(of_node, 1, DP_MAX_NUM_DP_LANES); + } + + if (cnt > 0) + msm_dp_link->max_dp_lanes =3D cnt; + else + msm_dp_link->max_dp_lanes =3D DP_MAX_NUM_DP_LANES; /* 4 lanes */ + + msm_dp_link->max_dp_link_rate =3D msm_dp_link_link_frequencies(of_node); + if (!msm_dp_link->max_dp_link_rate) + msm_dp_link->max_dp_link_rate =3D DP_LINK_RATE_HBR2; + + return 0; +} + struct msm_dp_link *msm_dp_link_get(struct device *dev, struct drm_dp_aux = *aux) { struct msm_dp_link_private *link; struct msm_dp_link *msm_dp_link; + int ret; =20 if (!dev || !aux) { DRM_ERROR("invalid input\n"); @@ -1229,5 +1282,9 @@ struct msm_dp_link *msm_dp_link_get(struct device *de= v, struct drm_dp_aux *aux) mutex_init(&link->psm_mutex); msm_dp_link =3D &link->msm_dp_link; =20 + ret =3D msm_dp_link_parse_dt(dev, msm_dp_link); + if (ret) + return ERR_PTR(ret); + return msm_dp_link; } diff --git a/drivers/gpu/drm/msm/dp/dp_link.h b/drivers/gpu/drm/msm/dp/dp_l= ink.h index ba47c6d19fbfacfc58031263e4a2f5a6d9c2c229..0684a962d4ec93f7da764c4af2e= 2154c7050329c 100644 --- a/drivers/gpu/drm/msm/dp/dp_link.h +++ b/drivers/gpu/drm/msm/dp/dp_link.h @@ -12,6 +12,7 @@ #define DS_PORT_STATUS_CHANGED 0x200 #define DP_TEST_BIT_DEPTH_UNKNOWN 0xFFFFFFFF #define DP_LINK_CAP_ENHANCED_FRAMING (1 << 0) +#define DP_MAX_NUM_DP_LANES 4 =20 struct msm_dp_link_info { unsigned char revision; @@ -72,6 +73,9 @@ struct msm_dp_link { struct msm_dp_link_test_audio test_audio; struct msm_dp_link_phy_params phy_params; struct msm_dp_link_info link_params; + + u32 max_dp_lanes; + u32 max_dp_link_rate; }; =20 /** diff --git a/drivers/gpu/drm/msm/dp/dp_panel.c b/drivers/gpu/drm/msm/dp/dp_= panel.c index 15b7f6c7146e1176a80b5c9d25896b1c8ede3aed..ad5d55bf009dbe60e61ca4f4c10= 8116333129203 100644 --- a/drivers/gpu/drm/msm/dp/dp_panel.c +++ b/drivers/gpu/drm/msm/dp/dp_panel.c @@ -16,9 +16,6 @@ =20 #define DP_INTF_CONFIG_DATABUS_WIDEN BIT(4) =20 -#define DP_MAX_NUM_DP_LANES 4 -#define DP_LINK_RATE_HBR2 540000 /* kbytes */ - struct msm_dp_panel_private { struct device *dev; struct drm_device *drm_dev; @@ -91,6 +88,7 @@ static int msm_dp_panel_read_dpcd(struct msm_dp_panel *ms= m_dp_panel) int rc, max_lttpr_lanes, max_lttpr_rate; struct msm_dp_panel_private *panel; struct msm_dp_link_info *link_info; + struct msm_dp_link *link; u8 *dpcd, major, minor; =20 panel =3D container_of(msm_dp_panel, struct msm_dp_panel_private, msm_dp_= panel); @@ -105,16 +103,20 @@ static int msm_dp_panel_read_dpcd(struct msm_dp_panel= *msm_dp_panel) major =3D (link_info->revision >> 4) & 0x0f; minor =3D link_info->revision & 0x0f; =20 + link =3D panel->link; + drm_dbg_dp(panel->drm_dev, "max_lanes=3D%d max_link_rate=3D%d\n", + link->max_dp_lanes, link->max_dp_link_rate); + link_info->rate =3D drm_dp_max_link_rate(dpcd); link_info->num_lanes =3D drm_dp_max_lane_count(dpcd); =20 /* Limit data lanes from data-lanes of endpoint property of dtsi */ - if (link_info->num_lanes > msm_dp_panel->max_dp_lanes) - link_info->num_lanes =3D msm_dp_panel->max_dp_lanes; + if (link_info->num_lanes > link->max_dp_lanes) + link_info->num_lanes =3D link->max_dp_lanes; =20 /* Limit link rate from link-frequencies of endpoint property of dtsi */ - if (link_info->rate > msm_dp_panel->max_dp_link_rate) - link_info->rate =3D msm_dp_panel->max_dp_link_rate; + if (link_info->rate > link->max_dp_link_rate) + link_info->rate =3D link->max_dp_link_rate; =20 /* Limit data lanes from LTTPR capabilities, if any */ max_lttpr_lanes =3D drm_dp_lttpr_max_lane_count(panel->link->lttpr_common= _caps); @@ -173,9 +175,6 @@ int msm_dp_panel_read_sink_caps(struct msm_dp_panel *ms= m_dp_panel, =20 panel =3D container_of(msm_dp_panel, struct msm_dp_panel_private, msm_dp_= panel); =20 - drm_dbg_dp(panel->drm_dev, "max_lanes=3D%d max_link_rate=3D%d\n", - msm_dp_panel->max_dp_lanes, msm_dp_panel->max_dp_link_rate); - rc =3D msm_dp_panel_read_dpcd(msm_dp_panel); if (rc) { DRM_ERROR("read dpcd failed %d\n", rc); @@ -648,60 +647,6 @@ int msm_dp_panel_init_panel_info(struct msm_dp_panel *= msm_dp_panel) return 0; } =20 -static u32 msm_dp_panel_link_frequencies(struct device_node *of_node) -{ - struct device_node *endpoint; - u64 frequency =3D 0; - int cnt; - - endpoint =3D of_graph_get_endpoint_by_regs(of_node, 1, 0); /* port@1 */ - if (!endpoint) - return 0; - - cnt =3D of_property_count_u64_elems(endpoint, "link-frequencies"); - - if (cnt > 0) - of_property_read_u64_index(endpoint, "link-frequencies", - cnt - 1, &frequency); - of_node_put(endpoint); - - do_div(frequency, - 10 * /* from symbol rate to link rate */ - 1000); /* kbytes */ - - return frequency; -} - -static int msm_dp_panel_parse_dt(struct msm_dp_panel *msm_dp_panel) -{ - struct msm_dp_panel_private *panel; - struct device_node *of_node; - int cnt; - - panel =3D container_of(msm_dp_panel, struct msm_dp_panel_private, msm_dp_= panel); - of_node =3D panel->dev->of_node; - - /* - * data-lanes is the property of msm_dp_out endpoint - */ - cnt =3D drm_of_get_data_lanes_count_ep(of_node, 1, 0, 1, DP_MAX_NUM_DP_LA= NES); - if (cnt < 0) { - /* legacy code, data-lanes is the property of mdss_dp node */ - cnt =3D drm_of_get_data_lanes_count(of_node, 1, DP_MAX_NUM_DP_LANES); - } - - if (cnt > 0) - msm_dp_panel->max_dp_lanes =3D cnt; - else - msm_dp_panel->max_dp_lanes =3D DP_MAX_NUM_DP_LANES; /* 4 lanes */ - - msm_dp_panel->max_dp_link_rate =3D msm_dp_panel_link_frequencies(of_node); - if (!msm_dp_panel->max_dp_link_rate) - msm_dp_panel->max_dp_link_rate =3D DP_LINK_RATE_HBR2; - - return 0; -} - struct msm_dp_panel *msm_dp_panel_get(struct device *dev, struct drm_dp_au= x *aux, struct msm_dp_link *link, void __iomem *link_base, @@ -709,7 +654,6 @@ struct msm_dp_panel *msm_dp_panel_get(struct device *de= v, struct drm_dp_aux *aux { struct msm_dp_panel_private *panel; struct msm_dp_panel *msm_dp_panel; - int ret; =20 if (!dev || !aux || !link) { DRM_ERROR("invalid input\n"); @@ -729,10 +673,6 @@ struct msm_dp_panel *msm_dp_panel_get(struct device *d= ev, struct drm_dp_aux *aux msm_dp_panel =3D &panel->msm_dp_panel; msm_dp_panel->max_bw_code =3D DP_LINK_BW_8_1; =20 - ret =3D msm_dp_panel_parse_dt(msm_dp_panel); - if (ret) - return ERR_PTR(ret); - return msm_dp_panel; } =20 diff --git a/drivers/gpu/drm/msm/dp/dp_panel.h b/drivers/gpu/drm/msm/dp/dp_= panel.h index d2cf401506dcbaf553192d5e18c87207337664ab..921a296852d4df65f817665d3e1= 344f2f7c9ece7 100644 --- a/drivers/gpu/drm/msm/dp/dp_panel.h +++ b/drivers/gpu/drm/msm/dp/dp_panel.h @@ -41,9 +41,6 @@ struct msm_dp_panel { bool vsc_sdp_supported; u32 hw_revision; =20 - u32 max_dp_lanes; - u32 max_dp_link_rate; - u32 max_bw_code; }; =20 --=20 2.34.1 From nobody Wed Oct 1 23:35:02 2025 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 222732BD58C for ; Fri, 26 Sep 2025 07:27:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758871674; cv=none; b=U2+d8qXndHbxIxA+cZTevIKZKj9WkGxEp3CyUBjdniPm7AUoBah5Ru+OPpxIKsqQEdf5pJn8AV+KGGE0BnCH3Q8Eku3hWRwHCDxnrsfH5WvRok/YNlHxVanywl7tPyb7LYXYvMX6+bTPV2lmmIUuux9gHieOc1uA+uzAUspjzdU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758871674; c=relaxed/simple; bh=MBFao/DJ+AvQFYkIXOckenkzKbeQrB9uXWrKsMRXuzM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jXR7sEJAj3IwPfSH6jRzHu+UmNvmNJDRFGSUPczemklVawofRlpDWw47B/zAEXad30oS5wXLgRvfIQ7aN5qr22P89SJB8F9inFcAFFGApDy5yt0rCJbW1olgnDj/R7SavS4yX5fdEQfDXhqIHVdvyk8N0dzTbka+3ybDBhnBOJk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=k0H4muO3; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="k0H4muO3" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 58Q7Bskw011502 for ; Fri, 26 Sep 2025 07:27:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= U/ewAsdzTC0PEPN+SodRZso/2oAjrX6us73TZlYVliA=; b=k0H4muO3JpiR7XrO JM4T5YxLbsqy10gN+14OQMeJibqBDRsBRXETrvoguPrkFTFM1342pdduCa9HNsPa hD+ao5gTh8zSuYOGTnseBQxqOHaEgVd/DH16krmH7MnMT8ul9XiyAieFsm1tx/2C fdTn9febRNqewpv1n2Rj/qQWr/AD7w1Kqxay5UlvrJfMNH22Z3s101D/kptIxXnu +VTF3vt6q1EAQLpILpzY4pKYty5A0ny2hhPONwzV36jo8nj3hwTHRkSgpQLqpDss YAJd1G0rsfe93FVzownYpH1KAGPIzhc7JZpJqkV0bEGD+Dh9+4no1l2PpWMMHILO EUG1Vg== Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 49db0q1w8k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 26 Sep 2025 07:27:52 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2728a359f2aso5034265ad.3 for ; Fri, 26 Sep 2025 00:27:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758871671; x=1759476471; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=U/ewAsdzTC0PEPN+SodRZso/2oAjrX6us73TZlYVliA=; b=KUS3GnN1Ru8UK2WhJOhrVmIidhzB1qSoL3XBO4/VPywPueHmVgHPRc0CdgBshibDEP NfPfsPxFXDpaadkGJySuxH3B+BrX3L8aKutMA0ckxwaETHiLGzuKwQNh0YY3aUk31iIC CZ3JRQ7t7OVCnrNtIueINPKYpvt+mnq3CkoMHZBWjIEvH/Mh0ezNGtSZ4amj0Xr4GZHx a8uZ6Pk4/I3IbLHMfzHSIdeoh9zoHbU3WgNKYRaXQQjrdOq9Zpq4ajrTQpwSkQX8l0wv AjDHEOJBPGyJ4DnzvJqOBuRF+fcMkRXOD8HZwLEcGvzUoKBEmqf6VdT/SYmkXKAWOjeD S33A== X-Forwarded-Encrypted: i=1; AJvYcCVpkDKQ6bOhenSXnlE0DadQ35ZCIOsnfZaiDAXTS7CFe8g7iDDSPB3yEsL7wJCPJNqIISm6ghJOX/bQt74=@vger.kernel.org X-Gm-Message-State: AOJu0Yy0PzmOszoJj64OKossboiTTWb+QAXOHebh+MalDo+YWnAYX+/4 vYjjcYc9Xo0S/LKBXIXc4lG7Fqjo6FIb5TAsPdk8IuVeyiHfgeeMQIv1+tFCScYOmGqjJvwJ5jX 2Zc/3Vg25bkQmjqYU2W2poqVtlzOta94VCpINv+mqK2YLNmkJEkeltJyy5viHR8OHU4E= X-Gm-Gg: ASbGncsCivIXDME1RiS6vzaAP62vCjXRht4pg9vmUMQ74R4r2ltrhZnSDnRq/u4zLN1 BdwqMmmTH26F47KXKR2TOgDi+XsiXf7AAesu7GZh4ct+gWOn2jjWj2XbS567atEA3b5j+n+eOgU t5ydyuKghIa2CTzQlqrhA1Uf2cLmHskG4U78VFi62EqxTcQbEsDrWo3u9AYQC7K9JteKwTmRN2l oCSncoZogIaen8a+brFmIdTmPC+UxbAZHPDXpRSDMlewhd45WdNujfSMH1abLjCMBpmXOFZrpy7 q+gMnXilWPi6MpB8oeYPsucExWf9vK0OE3FsgosvTYluTMMoGxUqJsE9DJ5+BxrGkZB3IoQdCBS e7i2fzBk53GA3F7p/TRsOBC29HugsQ+ItncfVWyYeK2SNwn1oW2VMxg39 X-Received: by 2002:a17:902:db11:b0:24e:af92:70de with SMTP id d9443c01a7336-27ed4a7e773mr47520835ad.7.1758871671183; Fri, 26 Sep 2025 00:27:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE6Uw+EDOSyIFj9+o/m/cxC6jk8OuXVNovEMdP23XauT6Xa+BsSzopZGkt0smtTXUlDKaRzrA== X-Received: by 2002:a17:902:db11:b0:24e:af92:70de with SMTP id d9443c01a7336-27ed4a7e773mr47520575ad.7.1758871670715; Fri, 26 Sep 2025 00:27:50 -0700 (PDT) Received: from sziotdisp01-gv.qualcomm.com.ap.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-27ed671d8a2sm45117985ad.55.2025.09.26.00.27.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Sep 2025 00:27:50 -0700 (PDT) From: Xiangxu Yin Date: Fri, 26 Sep 2025 15:25:50 +0800 Subject: [PATCH v7 14/14] drm/msm/dp: Add support for lane mapping configuration Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250926-add-displayport-support-for-qcs615-platform-v7-14-dc5edaac6c2b@oss.qualcomm.com> References: <20250926-add-displayport-support-for-qcs615-platform-v7-0-dc5edaac6c2b@oss.qualcomm.com> In-Reply-To: <20250926-add-displayport-support-for-qcs615-platform-v7-0-dc5edaac6c2b@oss.qualcomm.com> To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Sean Paul , Marijn Suijten , David Airlie , Simona Vetter Cc: linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, fange.zhang@oss.qualcomm.com, yongxing.mou@oss.qualcomm.com, li.liu@oss.qualcomm.com, Dmitry Baryshkov , Bjorn Andersson , Konrad Dybcio , Xiangxu Yin X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1758871565; l=5055; i=xiangxu.yin@oss.qualcomm.com; s=20241125; h=from:subject:message-id; bh=MBFao/DJ+AvQFYkIXOckenkzKbeQrB9uXWrKsMRXuzM=; b=zmiqH6Oqah/3aH8g6DUespvXSHN8tX5HUqWwLWpFm91V/bc2Bw5FvFuS9/SZ4W7yCWeya8H1V j4g275HWltSBVdF/NJ931zfBE12Z5hD9+v2gG0JMubyTRU8iKPh3q9w X-Developer-Key: i=xiangxu.yin@oss.qualcomm.com; a=ed25519; pk=F1TwipJzpywfbt3n/RPi4l/A4AVF+QC89XzCHgZYaOc= X-Proofpoint-ORIG-GUID: 0RdiJBqyMtz7JI7U08BNNAi8A9WaaSRX X-Proofpoint-GUID: 0RdiJBqyMtz7JI7U08BNNAi8A9WaaSRX X-Authority-Analysis: v=2.4 cv=aZhsXBot c=1 sm=1 tr=0 ts=68d64078 cx=c_pps a=JL+w9abYAAE89/QcEU+0QA==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=yJojWOMRYYMA:10 a=EUspDBNiAAAA:8 a=TnvzUFuqcobRuy42eWwA:9 a=QEXdDO2ut3YA:10 a=324X-CrmTo6CU4MGRt3R:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTI1MDE3MSBTYWx0ZWRfXyi6AsrJZaXUj kc0V6XZb35A3XuyDaYuSTw59WP6SEVD9kOncwUBi0G5iOeDFHLsWXJE+8uBarYq18kf1/LqmeKh L/84YteusWhwgLJSvMjPu7uZXIF0aesEzKaG0ZzB7JUzr2rYo1dX511zYm2aqdHy6H/fUWj2JyR Grg/ftiEokr9G4QIJIHUOxaBhZ5HvvRbIsNeNP3L1KNJeMLvgIPCIsHiul7EErlvm7VNt0e3XXW YSBkbZhdRGqQhKTfiCQ3nEIyyXwifdf5G77J7HJnhsjvJR0g0e9iDN3L4FaOuoVCvRw0wV0aEji X/6ZxVDbcWT+CG3rbIjUVhn5PEoeJCPd9TIwmDaZq5dHjaMiPjkPs8wN6N85Cm+JOPSO6zZorV5 SGtMWmao4jcJSQWW0qNfJlsf/2QYww== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1117,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-09-26_02,2025-09-26_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 priorityscore=1501 suspectscore=0 malwarescore=0 adultscore=0 clxscore=1015 impostorscore=0 bulkscore=0 lowpriorityscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2509150000 definitions=main-2509250171 QCS615 platform requires non-default logical-to-physical lane mapping due to its unique hardware routing. Unlike the standard mapping sequence <0 1 2 3>, QCS615 uses <3 2 0 1>, which necessitates explicit configuration via the data-lanes property in the device tree. This ensures correct signal routing between the DP controller and PHY. For partial definitions, fill remaining lanes with unused physical lanes in ascending order. Reviewed-by: Dmitry Baryshkov Signed-off-by: Xiangxu Yin --- drivers/gpu/drm/msm/dp/dp_ctrl.c | 10 +++---- drivers/gpu/drm/msm/dp/dp_link.c | 61 ++++++++++++++++++++++++++++++++++++= ++++ drivers/gpu/drm/msm/dp/dp_link.h | 1 + 3 files changed, 67 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.c b/drivers/gpu/drm/msm/dp/dp_c= trl.c index c42fd2c17a328f6deae211c9cd57cc7416a9365a..cbcc7c2f0ffc4696749b6c43818= d20853ddec069 100644 --- a/drivers/gpu/drm/msm/dp/dp_ctrl.c +++ b/drivers/gpu/drm/msm/dp/dp_ctrl.c @@ -423,13 +423,13 @@ static void msm_dp_ctrl_config_ctrl(struct msm_dp_ctr= l_private *ctrl) =20 static void msm_dp_ctrl_lane_mapping(struct msm_dp_ctrl_private *ctrl) { - u32 ln_0 =3D 0, ln_1 =3D 1, ln_2 =3D 2, ln_3 =3D 3; /* One-to-One mapping= */ + u32 *lane_map =3D ctrl->link->lane_map; u32 ln_mapping; =20 - ln_mapping =3D ln_0 << LANE0_MAPPING_SHIFT; - ln_mapping |=3D ln_1 << LANE1_MAPPING_SHIFT; - ln_mapping |=3D ln_2 << LANE2_MAPPING_SHIFT; - ln_mapping |=3D ln_3 << LANE3_MAPPING_SHIFT; + ln_mapping =3D lane_map[0] << LANE0_MAPPING_SHIFT; + ln_mapping |=3D lane_map[1] << LANE1_MAPPING_SHIFT; + ln_mapping |=3D lane_map[2] << LANE2_MAPPING_SHIFT; + ln_mapping |=3D lane_map[3] << LANE3_MAPPING_SHIFT; =20 msm_dp_write_link(ctrl, REG_DP_LOGICAL2PHYSICAL_LANE_MAPPING, ln_mapping); diff --git a/drivers/gpu/drm/msm/dp/dp_link.c b/drivers/gpu/drm/msm/dp/dp_l= ink.c index 2aeb3ecf76fab2ee6a9512b785ca5dceebfc3964..2ae78d33fffd7c49190983952ee= 8f5a249f2b69d 100644 --- a/drivers/gpu/drm/msm/dp/dp_link.c +++ b/drivers/gpu/drm/msm/dp/dp_link.c @@ -1236,6 +1236,62 @@ static u32 msm_dp_link_link_frequencies(struct devic= e_node *of_node) return frequency; } =20 +/* + * Always populate msm_dp_link->lane_map with 4 lanes. + * - Use DTS "data-lanes" if present; otherwise fall back to default mappi= ng. + * - For partial definitions, fill remaining entries with unused lanes in + * ascending order. + */ +static int msm_dp_link_lane_map(struct device *dev, struct msm_dp_link *ms= m_dp_link) +{ + struct device_node *of_node =3D dev->of_node; + struct device_node *endpoint; + int cnt =3D msm_dp_link->max_dp_lanes; + u32 tmp[DP_MAX_NUM_DP_LANES]; + u32 map[DP_MAX_NUM_DP_LANES] =3D {0, 1, 2, 3}; /* default 1:1 mapping */ + bool used[DP_MAX_NUM_DP_LANES] =3D {false}; + int i, ret =3D -EINVAL; + + endpoint =3D of_graph_get_endpoint_by_regs(of_node, 1, -1); + if (endpoint) { + ret =3D of_property_read_u32_array(endpoint, "data-lanes", tmp, cnt); + if (ret) + dev_dbg(dev, "endpoint data-lanes read failed (ret=3D%d)\n", ret); + } + + if (ret) { + ret =3D of_property_read_u32_array(of_node, "data-lanes", tmp, cnt); + if (ret) { + dev_info(dev, "data-lanes not defined, set to default\n"); + goto out; + } + } + + for (i =3D 0; i < cnt; i++) { + if (tmp[i] >=3D DP_MAX_NUM_DP_LANES) { + dev_err(dev, "data-lanes[%d]=3D%u out of range\n", i, tmp[i]); + return -EINVAL; + } + used[tmp[i]] =3D true; + map[i] =3D tmp[i]; + } + + /* Fill the remaining entries with unused physical lanes (ascending) */ + i =3D cnt; + for (int j =3D 0; i < DP_MAX_NUM_DP_LANES && j < DP_MAX_NUM_DP_LANES; j++= ) { + if (!used[j]) + map[i++] =3D j; + } + +out: + if (endpoint) + of_node_put(endpoint); + + dev_dbg(dev, "data-lanes count %d <%d %d %d %d>\n", cnt, map[0], map[1], = map[2], map[3]); + memcpy(msm_dp_link->lane_map, map, sizeof(map)); + return 0; +} + static int msm_dp_link_parse_dt(struct device *dev, struct msm_dp_link *ms= m_dp_link) { struct device_node *of_node =3D dev->of_node; @@ -1255,6 +1311,11 @@ static int msm_dp_link_parse_dt(struct device *dev, = struct msm_dp_link *msm_dp_l else msm_dp_link->max_dp_lanes =3D DP_MAX_NUM_DP_LANES; /* 4 lanes */ =20 + if (msm_dp_link_lane_map(dev, msm_dp_link)) { + dev_err(dev, "failed to parse data-lanes\n"); + return -EINVAL; + } + msm_dp_link->max_dp_link_rate =3D msm_dp_link_link_frequencies(of_node); if (!msm_dp_link->max_dp_link_rate) msm_dp_link->max_dp_link_rate =3D DP_LINK_RATE_HBR2; diff --git a/drivers/gpu/drm/msm/dp/dp_link.h b/drivers/gpu/drm/msm/dp/dp_l= ink.h index 0684a962d4ec93f7da764c4af2e2154c7050329c..b1eb2de6d2a7693f17aa2f25665= 7110af839533d 100644 --- a/drivers/gpu/drm/msm/dp/dp_link.h +++ b/drivers/gpu/drm/msm/dp/dp_link.h @@ -74,6 +74,7 @@ struct msm_dp_link { struct msm_dp_link_phy_params phy_params; struct msm_dp_link_info link_params; =20 + u32 lane_map[DP_MAX_NUM_DP_LANES]; u32 max_dp_lanes; u32 max_dp_link_rate; }; --=20 2.34.1