From nobody Thu Oct 2 00:50:39 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