From: Bjorn Andersson <andersson@kernel.org>
To: Giri Prasad Goriparthi <giri.goriparthi@oss.qualcomm.com>
Cc: Manivannan Sadhasivam <mani@kernel.org>,
"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
"Martin K. Petersen" <mkp@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Abel Vesa <abelvesa@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Nitin Rawat <nitin.rawat@oss.qualcomm.com>,
linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
Ziqi Chen <ziqi.chen@oss.qualcomm.com>
Subject: Re: [PATCH v2 1/3] scsi: ufs: ufs-qcom: Add specified gear support for multi gear scaling
Date: Wed, 2 Dec 2026 18:45:05 -0600 [thread overview]
Message-ID: <axC7fPvJZcFSXmg-@zenbook> (raw)
In-Reply-To: <20261202-b4-ufs-qcom-multi-gear-scaling-v2-1-e2fe4cbce19d@oss.qualcomm.com>
On Wed, Dec 02, 2026 at 01:44:58PM +0530, Giri Prasad Goriparthi wrote:
> The UFS clock frequency and gear speed do not necessarily have a strict
> one-to-one correspondence on all platforms. Introduce a device tree
> based configuration interface that allows specifying the HS gear
> speed for each supported operating frequency via the "opp-level"
> property in the OPP table. When this property is not configured, the
> driver falls back to the default frequency-to-gear mapping table.
>
> Signed-off-by: Ziqi Chen <ziqi.chen@oss.qualcomm.com>
s-o-b chain doesn't match authorship.
Regards,
Bjorn
> Signed-off-by: Nitin Rawat <nitin.rawat@oss.qualcomm.com>
> Signed-off-by: Giri Prasad Goriparthi <giri.goriparthi@oss.qualcomm.com>
> ---
> drivers/ufs/host/ufs-qcom.c | 24 ++++++++++++++++++++++--
> 1 file changed, 22 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
> index 6afb8498b8c2..cc6380ebb145 100644
> --- a/drivers/ufs/host/ufs-qcom.c
> +++ b/drivers/ufs/host/ufs-qcom.c
> @@ -2506,7 +2506,7 @@ static unsigned long ufs_qcom_opp_freq_to_clk_freq(struct ufs_hba *hba,
> bool found = false;
>
> opp = dev_pm_opp_find_freq_exact_indexed(hba->dev, freq, 0, true);
> - if (IS_ERR(opp)) {
> + if (IS_ERR_OR_NULL(opp)) {
> dev_err(hba->dev, "Failed to find OPP for exact frequency %lu\n", freq);
> return 0;
> }
> @@ -2535,12 +2535,32 @@ static unsigned long ufs_qcom_opp_freq_to_clk_freq(struct ufs_hba *hba,
>
> static u32 ufs_qcom_freq_to_gear_speed(struct ufs_hba *hba, unsigned long freq)
> {
> - u32 gear = UFS_HS_DONT_CHANGE;
> unsigned long unipro_freq;
> + struct dev_pm_opp *opp;
> + u32 gear = UFS_HS_DONT_CHANGE;
>
> if (!hba->use_pm_opp)
> return gear;
>
> + opp = dev_pm_opp_find_freq_exact_indexed(hba->dev, freq, 0, true);
> + if (IS_ERR_OR_NULL(opp)) {
> + dev_err(hba->dev, "Failed to find OPP for exact frequency %lu\n", freq);
> + return gear;
> + }
> +
> + /* Get HS gear speed from 'opp-level' */
> + gear = dev_pm_opp_get_level(opp);
> + dev_pm_opp_put(opp);
> +
> + /*
> + * If opp-level is not configured in DT or the specified gear exceeds
> + * the max supported gear, fall back to the frequency-to-gear table.
> + */
> + if (gear != OPP_LEVEL_UNSET && gear <= hba->max_pwr_info.info.gear_rx)
> + return gear;
> +
> + gear = UFS_HS_DONT_CHANGE;
> +
> unipro_freq = ufs_qcom_opp_freq_to_clk_freq(hba, freq, "core_clk_unipro");
> switch (unipro_freq) {
> case 403000000:
>
> --
> 2.43.0
>
next prev parent reply other threads:[~2026-12-03 0:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 8:14 [PATCH v2 0/3] ufs-qcom: Add specified gear support for multi gear scaling Giri Prasad Goriparthi
2026-12-02 8:14 ` [PATCH v2 1/3] scsi: ufs: " Giri Prasad Goriparthi
2026-12-02 8:32 ` sashiko-bot
2026-12-02 11:20 ` Konrad Dybcio
2026-12-03 0:45 ` Bjorn Andersson [this message]
2026-12-02 8:14 ` [PATCH v2 2/3] arm64: dts: qcom: hamoa: Add opp-level for UFS gear speed Giri Prasad Goriparthi
2026-12-02 8:28 ` sashiko-bot
2026-12-02 8:15 ` [PATCH v2 3/3] arm64: dts: qcom: talos: " Giri Prasad Goriparthi
2026-12-02 8:30 ` sashiko-bot
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=axC7fPvJZcFSXmg-@zenbook \
--to=andersson@kernel.org \
--cc=James.Bottomley@hansenpartnership.com \
--cc=abelvesa@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=giri.goriparthi@oss.qualcomm.com \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=mani@kernel.org \
--cc=mkp@kernel.org \
--cc=nitin.rawat@oss.qualcomm.com \
--cc=robh@kernel.org \
--cc=ziqi.chen@oss.qualcomm.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.