Re: [PATCH v2 1/3] scsi: ufs: ufs-qcom: Add specified gear support for multi gear scaling

From: Konrad Dybcio

Date: Wed Dec 02 2026 - 06:20:54 EST


On 12/2/26 9:14 AM, 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@xxxxxxxxxxxxxxxx>
> Signed-off-by: Nitin Rawat <nitin.rawat@xxxxxxxxxxxxxxxx>
> Signed-off-by: Giri Prasad Goriparthi <giri.goriparthi@xxxxxxxxxxxxxxxx>
> ---
> 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;

nite: spurious reshuffling

Konrad