mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Prashanth K <prashanth.k@oss.qualcomm.com>
To: Manivannan Sadhasivam <mani@kernel.org>
Cc: Vinod Koul <vkoul@kernel.org>,
	Kishon Vijay Abraham I <kishon@kernel.org>,
	Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>,
	linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] phy: qcom: qmp-combo: Add PM suspend/resume callbacks
Date: Mon, 30 Nov 2026 16:30:54 +0530	[thread overview]
Message-ID: <1cfd168f-325a-4d2d-b79f-3f79d14a03de@oss.qualcomm.com> (raw)
In-Reply-To: <179578690105.13164.10122053052435645688.b4-reply@b4>



On 11/27/2026 7:11 PM, Manivannan Sadhasivam wrote:
> 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.

https://sashiko.dev/#/patchset/20261022104321.306679-1-prashanth.k@oss.qualcomm.com?part=1

This was suggested by sashiko, and later Konrad also suggested to throw
a mutex guard for safety. Its true that we havent seen any issues for
now, but it would be safter to have a mutex to avoid concurrency.

> 
>> Signed-off-by: Prashanth K <prashanth.k@oss.qualcomm.com>
>> ---
>>  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

Yea, that sounds better, will do that.

- Prashanth K


      reply	other threads:[~2026-11-30 11:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 10:31 [PATCH v2 0/2] Add the PM suspend/resume callbacks for qmp phys Prashanth K
2026-11-13 10:31 ` [PATCH v2 1/2] phy: qcom: qmp-usb: Add PM suspend/resume callbacks Prashanth K
2026-11-27 13:40   ` Manivannan Sadhasivam
2026-11-13 10:31 ` [PATCH v2 2/2] phy: qcom: qmp-combo: " Prashanth K
2026-11-27 13:41   ` Manivannan Sadhasivam
2026-11-30 11:00     ` Prashanth K [this message]

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=1cfd168f-325a-4d2d-b79f-3f79d14a03de@oss.qualcomm.com \
    --to=prashanth.k@oss.qualcomm.com \
    --cc=kishon@kernel.org \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=mani@kernel.org \
    --cc=vkoul@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

all inboxes | Powered by JetHome®