From: Shawn Lin <shawn.lin@rock-chips.com>
To: Ram Kumar Dwivedi <ram.dwivedi@oss.qualcomm.com>,
mani@kernel.org, alim.akhtar@samsung.com, avri.altman@wdc.com,
bvanassche@acm.org, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, James.Bottomley@HansenPartnership.com,
martin.petersen@oracle.com
Cc: shawn.lin@rock-chips.com, linux-arm-msm@vger.kernel.org,
linux-scsi@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH V4 3/4] scsi: ufs: core Enforce minimum pm level for sysfs configuration
Date: Tue, 6 Jan 2026 22:27:29 +0800 [thread overview]
Message-ID: <7547e933-1cbd-4bf9-bc8a-fb0c78b11337@rock-chips.com> (raw)
In-Reply-To: <20260106134008.1969090-4-ram.dwivedi@oss.qualcomm.com>
在 2026/01/06 星期二 21:40, Ram Kumar Dwivedi 写道:
> Some UFS platforms only support a limited subset of power levels.
> Currently, the sysfs interface allows users to set any pm level
> without validating the minimum supported value. If an unsupported
> level is selected, suspend may fail.
>
> Introduce an pm_lvl_min field in the ufs_hba structure and use it
> to clamp the pm level requested via sysfs so that only supported
> levels are accepted. Platforms that require a minimum pm level
> can set this field during probe.
>
> Signed-off-by: Ram Kumar Dwivedi <ram.dwivedi@oss.qualcomm.com>
> ---
> drivers/ufs/core/ufs-sysfs.c | 2 +-
> include/ufs/ufshcd.h | 1 +
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/ufs/core/ufs-sysfs.c b/drivers/ufs/core/ufs-sysfs.c
> index b33f8656edb5..02e5468ad49d 100644
> --- a/drivers/ufs/core/ufs-sysfs.c
> +++ b/drivers/ufs/core/ufs-sysfs.c
> @@ -141,7 +141,7 @@ static inline ssize_t ufs_sysfs_pm_lvl_store(struct device *dev,
> if (kstrtoul(buf, 0, &value))
> return -EINVAL;
>
> - if (value >= UFS_PM_LVL_MAX)
> + if (value >= UFS_PM_LVL_MAX || value < hba->pm_lvl_min)
It makes sense that some platform support a limited subset of power
levels. But each level is in increasing order of power savings, and you
set it to UFS_PM_LVL_5. Don't you support UFS_PM_LVL_0 the full active
mode?
> return -EINVAL;
>
> if (ufs_pm_lvl_states[value].dev_state == UFS_DEEPSLEEP_PWR_MODE &&
> diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
> index 19154228780b..ac8697a7355b 100644
> --- a/include/ufs/ufshcd.h
> +++ b/include/ufs/ufshcd.h
> @@ -972,6 +972,7 @@ struct ufs_hba {
> enum ufs_pm_level rpm_lvl;
> /* Desired UFS power management level during system PM */
> enum ufs_pm_level spm_lvl;
> + enum ufs_pm_level pm_lvl_min;
> int pm_op_in_progress;
>
> /* Auto-Hibernate Idle Timer register value */
next prev parent reply other threads:[~2026-01-06 14:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-06 13:40 [PATCH V4 0/4] ufs: ufs-qcom: Add support firmware managed platforms Ram Kumar Dwivedi
2026-01-06 13:40 ` [PATCH V4 1/4] MAINTAINERS: broaden UFS Qualcomm binding file pattern Ram Kumar Dwivedi
2026-01-06 13:40 ` [PATCH V4 2/4] dt-bindings: ufs: Document bindings for SA8255P UFS Host Controller Ram Kumar Dwivedi
2026-01-07 7:38 ` Krzysztof Kozlowski
2026-01-13 7:25 ` Ram Kumar Dwivedi
2026-01-06 13:40 ` [PATCH V4 3/4] scsi: ufs: core Enforce minimum pm level for sysfs configuration Ram Kumar Dwivedi
2026-01-06 13:56 ` Bart Van Assche
2026-01-13 7:28 ` Ram Kumar Dwivedi
2026-01-06 14:27 ` Shawn Lin [this message]
2026-01-07 16:51 ` Manivannan Sadhasivam
2026-01-06 13:40 ` [PATCH V4 4/4] ufs: ufs-qcom: Add support for firmware-managed resource abstraction Ram Kumar Dwivedi
2026-01-08 4:42 ` Manivannan Sadhasivam
2026-01-13 7:21 ` Ram Kumar Dwivedi
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=7547e933-1cbd-4bf9-bc8a-fb0c78b11337@rock-chips.com \
--to=shawn.lin@rock-chips.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=alim.akhtar@samsung.com \
--cc=avri.altman@wdc.com \
--cc=bvanassche@acm.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.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=martin.petersen@oracle.com \
--cc=ram.dwivedi@oss.qualcomm.com \
--cc=robh@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