Re: [PATCH v2 2/2] phy: qcom: qmp-combo: Add PM suspend/resume callbacks
From: Manivannan Sadhasivam
Date: Fri Nov 27 2026 - 08:41:56 EST
On 2026-11-13 16:01 +0530, Prashanth K wrote:
> Currently when we perform system suspend, the phy clocks aren't
> turned off leading to power leakage. Prevent this by adding PM
> suspend/resume callbacks for the qmp-combo-phy which toggles
> clocks on/off correspondingly.
>
> While at it, add mutex guard in runtime_suspend/resume in order
> to prevent any race between RT operations and phy_init/exit(),
> as it can lead to unclocked register access crash, underflowing
> the clock enable counts.
>
I don't see how this race can happen.
> Signed-off-by: Prashanth K <prashanth.k@xxxxxxxxxxxxxxxx>
> ---
> drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> index 187f0cd11f6c..65d280f45db1 100644
> --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> @@ -4717,6 +4717,8 @@ static int __maybe_unused qmp_combo_runtime_suspend(struct device *dev)
>
> dev_vdbg(dev, "Suspending QMP phy, mode:%d\n", qmp->phy_mode);
>
> + guard(mutex)(&qmp->phy_mutex);
> +
> if (!qmp->init_count) {
> dev_vdbg(dev, "PHY not initialized, bailing out\n");
> return 0;
> @@ -4737,6 +4739,8 @@ static int __maybe_unused qmp_combo_runtime_resume(struct device *dev)
>
> dev_vdbg(dev, "Resuming QMP phy, mode:%d\n", qmp->phy_mode);
>
> + guard(mutex)(&qmp->phy_mutex);
> +
> if (!qmp->init_count) {
> dev_vdbg(dev, "PHY not initialized, bailing out\n");
> return 0;
> @@ -4761,6 +4765,7 @@ static int __maybe_unused qmp_combo_runtime_resume(struct device *dev)
> static const struct dev_pm_ops qmp_combo_pm_ops = {
> SET_RUNTIME_PM_OPS(qmp_combo_runtime_suspend,
> qmp_combo_runtime_resume, NULL)
> + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
Same comment as patch 1.
- Mani