]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
scsi: ufs: core: Check if scaling up is required when disable clkscale
authorZiqi Chen <quic_ziqichen@quicinc.com>
Thu, 13 Feb 2025 08:00:06 +0000 (16:00 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 21 Feb 2025 02:53:49 +0000 (21:53 -0500)
When disabling clkscale via the clkscale_enable sysfs entry, UFS driver
shall perform scaling up once regardless. Check if scaling up is required
or not first to avoid repetitive work.

Signed-off-by: Ziqi Chen <quic_ziqichen@quicinc.com>
Co-developed-by: Can Guo <quic_cang@quicinc.com>
Signed-off-by: Can Guo <quic_cang@quicinc.com>
Link: https://lore.kernel.org/r/20250213080008.2984807-7-quic_ziqichen@quicinc.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/ufs/core/ufshcd.c

index 637901d09054bc481fde5ff0f75e7de417a96482..e59ce8e5509ed1ce959031c8fbc1fbed1ae6e56b 100644 (file)
@@ -1767,6 +1767,10 @@ static ssize_t ufshcd_clkscale_enable_store(struct device *dev,
        freq = clki->max_freq;
 
        ufshcd_suspend_clkscaling(hba);
+
+       if (!ufshcd_is_devfreq_scaling_required(hba, freq, true))
+               goto out_rel;
+
        err = ufshcd_devfreq_scale(hba, freq, true);
        if (err)
                dev_err(hba->dev, "%s: failed to scale clocks up %d\n",