mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
To: Mark Brown <broonie@kernel.org>,
	Nitin Rawat <quic_nitirawa@quicinc.com>,
	vkoul@kernel.org, kishon@kernel.org, mani@kernel.org,
	conor+dt@kernel.org, bvanassche@acm.org, andersson@kernel.org,
	neil.armstrong@linaro.org, dmitry.baryshkov@oss.qualcomm.com,
	konradybcio@kernel.org, krzk+dt@kernel.org
Cc: linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH V1 4/4] phy: qcom-qmp-ufs: read max-microamp values from device tree
Date: Wed, 6 Aug 2025 17:58:30 +0200	[thread overview]
Message-ID: <f368b6da-1aa3-4b8e-9106-3c29d4ab5c5e@oss.qualcomm.com> (raw)
In-Reply-To: <20250806154340.20122-5-quic_nitirawa@quicinc.com>

On 8/6/25 5:43 PM, Nitin Rawat wrote:
> Add support in QMP PHY driver to read optional vdda-phy-max-microamp
> and vdda-pll-max-microamp properties from the device tree.
> 
> These properties define the expected maximum current (in microamps) for
> each supply. The driver uses this information to configure regulators
> more accurately and ensure they operate in the correct mode based on
> client load requirements.
> 
> If the property is not present, the driver defaults load to
> `QMP_VREG_UNUSED`.
> 
> Signed-off-by: Nitin Rawat <quic_nitirawa@quicinc.com>
> ---
>  drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 22 +++++++++++++++++++---
>  1 file changed, 19 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c
> index 9c69c77d10c8..6e116f7370c3 100644
> --- a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c
> +++ b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c
> @@ -39,6 +39,8 @@
>  #define PHY_INIT_COMPLETE_TIMEOUT		10000
>  
>  #define NUM_OVERLAY				2
> +#define QMP_VREG_UNUSED				-1
> +#define MAX_PROP_NAME				32
>  
>  /* set of registers with offsets different per-PHY */
>  enum qphy_reg_layout {
> @@ -1894,15 +1896,29 @@ static int qmp_ufs_vreg_init(struct qmp_ufs *qmp)
>  {
>  	const struct qmp_phy_cfg *cfg = qmp->cfg;
>  	struct device *dev = qmp->dev;
> +	struct device_node *np = dev->of_node;
> +	char prop_name[MAX_PROP_NAME];
>  	int num = cfg->num_vregs;
> -	int i;
> +	const char *supply;
> +	int i, ret;
>  
>  	qmp->vregs = devm_kcalloc(dev, num, sizeof(*qmp->vregs), GFP_KERNEL);
>  	if (!qmp->vregs)
>  		return -ENOMEM;
>  
> -	for (i = 0; i < num; i++)
> -		qmp->vregs[i].supply = cfg->vreg_list[i];
> +	for (i = 0; i < num; i++) {
> +		supply = cfg->vreg_list[i];
> +		qmp->vregs[i].supply = supply;
> +
> +		/* Defaults to unused */
> +		qmp->vregs[i].init_load_uA = QMP_VREG_UNUSED;
> +
> +		snprintf(prop_name, sizeof(prop_name), "%s-max-microamp", supply);
> +		ret = of_property_read_u32(np, prop_name, &qmp->vregs[i].init_load_uA);
> +		if (ret)
> +			dev_dbg(qmp->dev, "No max microamp for %s, using default %d\n",
> +				supply, QMP_VREG_UNUSED);

+Mark

do you think having this in regulator core would make sense?

Konrad

  reply	other threads:[~2025-08-06 15:58 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-06 15:43 [PATCH V1 0/4] Add support to configure regulator load for UFS QMP PHY Nitin Rawat
2025-08-06 15:43 ` [PATCH V1 1/4] dt-bindings: phy: Add max-microamp properties for PHY and PLL supplies Nitin Rawat
2025-08-08  7:28   ` Krzysztof Kozlowski
2025-08-11 15:20   ` Bjorn Andersson
2025-08-06 15:43 ` [PATCH V1 2/4] arm64: dts: qcom: sm8750: add max-microamp for UFS " Nitin Rawat
2025-08-08  7:29   ` Krzysztof Kozlowski
2025-08-08  8:58     ` Konrad Dybcio
2025-08-08  9:39       ` Krzysztof Kozlowski
2025-08-08 15:19         ` Nitin Rawat
2025-08-09 11:07           ` Manivannan Sadhasivam
2025-08-11 19:55             ` Nitin Rawat
2025-08-12 10:52               ` Dmitry Baryshkov
2025-08-12 11:38                 ` 回复: " yizhijiao2025
2025-08-13 20:47                 ` Nitin Rawat
2025-08-11 15:25   ` Bjorn Andersson
2025-08-06 15:43 ` [PATCH V1 3/4] arm64: dts: qcom: sm8650: " Nitin Rawat
2025-08-06 15:43 ` [PATCH V1 4/4] phy: qcom-qmp-ufs: read max-microamp values from device tree Nitin Rawat
2025-08-06 15:58   ` Konrad Dybcio [this message]
2025-08-06 16:51     ` Mark Brown
2025-08-07 13:06       ` Konrad Dybcio
2025-08-07 13:44         ` Mark Brown
2025-08-07 15:42           ` Nitin Rawat
2025-08-07 17:26             ` Mark Brown
2025-08-07 17:35               ` Nitin Rawat
2025-08-07 17:43                 ` Mark Brown
2025-08-07 17:56                   ` Nitin Rawat
2025-08-07 18:45                     ` Mark Brown
2025-08-07 20:45                       ` Nitin Rawat
2025-08-08  7:25                         ` Krzysztof Kozlowski
2025-08-07 17:43               ` Konrad Dybcio
2025-08-07 18:09                 ` Nitin Rawat
2025-08-07 19:09                 ` Mark Brown
2025-08-11 15:50                   ` Bjorn Andersson
2025-08-11 16:14                     ` Mark Brown
2025-08-11 19:48                     ` Nitin Rawat
2025-08-13 21:01                       ` Nitin Rawat
2025-08-08 12:33   ` Manivannan Sadhasivam
2025-08-09  7:30   ` Dmitry Baryshkov
2025-08-11 19:49     ` Nitin Rawat

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f368b6da-1aa3-4b8e-9106-3c29d4ab5c5e@oss.qualcomm.com \
    --to=konrad.dybcio@oss.qualcomm.com \
    --cc=andersson@kernel.org \
    --cc=broonie@kernel.org \
    --cc=bvanassche@acm.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=kishon@kernel.org \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=mani@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=quic_nitirawa@quicinc.com \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®