mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1 0/2] Add the PM suspend/resume callbacks for qcom-combo phys
@ 2026-10-22 10:43 Prashanth K
  2026-10-22 10:43 ` [PATCH v1 1/2] phy: qcom: qmp-combo: Add PM suspend/resume callbacks Prashanth K
  2026-10-22 10:43 ` [PATCH v1 2/2] phy: qcom: qmp-usb: " Prashanth K
  0 siblings, 2 replies; 8+ messages in thread
From: Prashanth K @ 2026-10-22 10:43 UTC (permalink / raw)
  To: Vinod Koul, Kishon Vijay Abraham I
  Cc: Krishna Kurapati, linux-arm-msm, linux-phy, linux-kernel, Prashanth K

Currently the phy clocks are left ON during system suspend, this leading to
power leakages. Prevent this by disabling the phy clocks during PM suspend.

Prashanth K (2):
  phy: qcom: qmp-combo: Add PM suspend/resume callbacks
  phy: qcom: qmp-usb: Add PM suspend/resume callbacks

 drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 17 +++++++++++++++++
 drivers/phy/qualcomm/phy-qcom-qmp-usb.c   | 17 +++++++++++++++++
 2 files changed, 34 insertions(+)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v1 1/2] phy: qcom: qmp-combo: Add PM suspend/resume callbacks
  2026-10-22 10:43 [PATCH v1 0/2] Add the PM suspend/resume callbacks for qcom-combo phys Prashanth K
@ 2026-10-22 10:43 ` Prashanth K
  2026-10-23 10:23   ` Konrad Dybcio
  2026-10-22 10:43 ` [PATCH v1 2/2] phy: qcom: qmp-usb: " Prashanth K
  1 sibling, 1 reply; 8+ messages in thread
From: Prashanth K @ 2026-10-22 10:43 UTC (permalink / raw)
  To: Vinod Koul, Kishon Vijay Abraham I
  Cc: Krishna Kurapati, linux-arm-msm, linux-phy, linux-kernel, Prashanth K

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.

Signed-off-by: Prashanth K <prashanth.k@oss.qualcomm.com>
---
 drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
index c39ced168d03..f624195c9b84 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
@@ -4463,9 +4463,26 @@ static int __maybe_unused qmp_combo_runtime_resume(struct device *dev)
 	return 0;
 }
 
+static int __maybe_unused qmp_combo_pm_suspend(struct device *dev)
+{
+	if (pm_runtime_suspended(dev))
+		return 0;
+
+	return qmp_combo_runtime_suspend(dev);
+}
+
+static int __maybe_unused qmp_combo_pm_resume(struct device *dev)
+{
+	if (pm_runtime_suspended(dev))
+		return 0;
+
+	return qmp_combo_runtime_resume(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(qmp_combo_pm_suspend, qmp_combo_pm_resume)
 };
 
 static int qmp_combo_reset_init(struct qmp_combo *qmp)
-- 
2.34.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v1 2/2] phy: qcom: qmp-usb: Add PM suspend/resume callbacks
  2026-10-22 10:43 [PATCH v1 0/2] Add the PM suspend/resume callbacks for qcom-combo phys Prashanth K
  2026-10-22 10:43 ` [PATCH v1 1/2] phy: qcom: qmp-combo: Add PM suspend/resume callbacks Prashanth K
@ 2026-10-22 10:43 ` Prashanth K
  1 sibling, 0 replies; 8+ messages in thread
From: Prashanth K @ 2026-10-22 10:43 UTC (permalink / raw)
  To: Vinod Koul, Kishon Vijay Abraham I
  Cc: Krishna Kurapati, linux-arm-msm, linux-phy, linux-kernel, Prashanth K

Currently when we perform system suspend, the phy clocks aren't
turned off, this leads to power leakage. Prevent this by adding
PM suspend/resume callbacks for the qmp-usb phy which toggles
clocks on/off correspondingly.

Signed-off-by: Prashanth K <prashanth.k@oss.qualcomm.com>
---
 drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c
index b0790bcf0bc8..d2863633007d 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c
@@ -2150,9 +2150,26 @@ static int __maybe_unused qmp_usb_runtime_resume(struct device *dev)
 	return 0;
 }
 
+static int __maybe_unused qmp_usb_pm_suspend(struct device *dev)
+{
+	if (pm_runtime_suspended(dev))
+		return 0;
+
+	return qmp_usb_runtime_suspend(dev);
+}
+
+static int __maybe_unused qmp_usb_pm_resume(struct device *dev)
+{
+	if (pm_runtime_suspended(dev))
+		return 0;
+
+	return qmp_usb_runtime_resume(dev);
+}
+
 static const struct dev_pm_ops qmp_usb_pm_ops = {
 	SET_RUNTIME_PM_OPS(qmp_usb_runtime_suspend,
 			   qmp_usb_runtime_resume, NULL)
+	SET_SYSTEM_SLEEP_PM_OPS(qmp_usb_pm_suspend, qmp_usb_pm_resume)
 };
 
 static int qmp_usb_reset_init(struct qmp_usb *qmp,
-- 
2.34.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 1/2] phy: qcom: qmp-combo: Add PM suspend/resume callbacks
  2026-10-22 10:43 ` [PATCH v1 1/2] phy: qcom: qmp-combo: Add PM suspend/resume callbacks Prashanth K
@ 2026-10-23 10:23   ` Konrad Dybcio
  2026-10-29  6:11     ` Prashanth K
  0 siblings, 1 reply; 8+ messages in thread
From: Konrad Dybcio @ 2026-10-23 10:23 UTC (permalink / raw)
  To: Prashanth K, Vinod Koul, Kishon Vijay Abraham I
  Cc: Krishna Kurapati, linux-arm-msm, linux-phy, linux-kernel

On 10/22/26 12:43 PM, 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.
> 
> Signed-off-by: Prashanth K <prashanth.k@oss.qualcomm.com>
> ---

Well this still leaves pm_runtime_forbid() in the probe function..

>  drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> index c39ced168d03..f624195c9b84 100644
> --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> @@ -4463,9 +4463,26 @@ static int __maybe_unused qmp_combo_runtime_resume(struct device *dev)
>  	return 0;
>  }
>  
> +static int __maybe_unused qmp_combo_pm_suspend(struct device *dev)
> +{
> +	if (pm_runtime_suspended(dev))
> +		return 0;
> +
> +	return qmp_combo_runtime_suspend(dev);
> +}
> +
> +static int __maybe_unused qmp_combo_pm_resume(struct device *dev)
> +{
> +	if (pm_runtime_suspended(dev))
> +		return 0;
> +
> +	return qmp_combo_runtime_resume(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(qmp_combo_pm_suspend, qmp_combo_pm_resume)

You can instead do

+	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
+				pm_runtime_force_resume)

and as a related fix, we should probably throw a mutex guard into the
runtime pm functions

Konrad

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 1/2] phy: qcom: qmp-combo: Add PM suspend/resume callbacks
  2026-10-23 10:23   ` Konrad Dybcio
@ 2026-10-29  6:11     ` Prashanth K
  2026-10-30 13:24       ` Konrad Dybcio
  0 siblings, 1 reply; 8+ messages in thread
From: Prashanth K @ 2026-10-29  6:11 UTC (permalink / raw)
  To: Konrad Dybcio, Vinod Koul, Kishon Vijay Abraham I
  Cc: Krishna Kurapati, linux-arm-msm, linux-phy, linux-kernel



On 10/23/2026 3:53 PM, Konrad Dybcio wrote:
> On 10/22/26 12:43 PM, 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.
>>
>> Signed-off-by: Prashanth K <prashanth.k@oss.qualcomm.com>
>> ---
> 
> Well this still leaves pm_runtime_forbid() in the probe function..
> 

Not sure about the history behind this, I assume its for controlling RT
behavior from user-space.
>>  drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 17 +++++++++++++++++
>>  1 file changed, 17 insertions(+)
>>
>> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
>> index c39ced168d03..f624195c9b84 100644
>> --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
>> +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
>> @@ -4463,9 +4463,26 @@ static int __maybe_unused qmp_combo_runtime_resume(struct device *dev)
>>  	return 0;
>>  }
>>  
>> +static int __maybe_unused qmp_combo_pm_suspend(struct device *dev)
>> +{
>> +	if (pm_runtime_suspended(dev))
>> +		return 0;
>> +
>> +	return qmp_combo_runtime_suspend(dev);
>> +}
>> +
>> +static int __maybe_unused qmp_combo_pm_resume(struct device *dev)
>> +{
>> +	if (pm_runtime_suspended(dev))
>> +		return 0;
>> +
>> +	return qmp_combo_runtime_resume(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(qmp_combo_pm_suspend, qmp_combo_pm_resume)
> 
> You can instead do
> 
> +	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
> +				pm_runtime_force_resume)
> 
> and as a related fix, we should probably throw a mutex guard into the
> runtime pm functions
> 
> Konrad

Yes we can do that as well. Will update in next patchset.

Thanks!
Prashanth K

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 1/2] phy: qcom: qmp-combo: Add PM suspend/resume callbacks
  2026-10-29  6:11     ` Prashanth K
@ 2026-10-30 13:24       ` Konrad Dybcio
  2026-11-02  8:15         ` Prashanth K
  0 siblings, 1 reply; 8+ messages in thread
From: Konrad Dybcio @ 2026-10-30 13:24 UTC (permalink / raw)
  To: Prashanth K, Vinod Koul, Kishon Vijay Abraham I
  Cc: Krishna Kurapati, linux-arm-msm, linux-phy, linux-kernel

On 10/29/26 7:11 AM, Prashanth K wrote:
> 
> 
> On 10/23/2026 3:53 PM, Konrad Dybcio wrote:
>> On 10/22/26 12:43 PM, 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.
>>>
>>> Signed-off-by: Prashanth K <prashanth.k@oss.qualcomm.com>
>>> ---
>>
>> Well this still leaves pm_runtime_forbid() in the probe function..
>>
> 
> Not sure about the history behind this, I assume its for controlling RT
> behavior from user-space.

Long story short it was an opt-in because it was broken.. can't recall
if the issues were on the dwc3-qcom(-legacy) side or somewhere in the
PHY code itself.

Konrad

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 1/2] phy: qcom: qmp-combo: Add PM suspend/resume callbacks
  2026-10-30 13:24       ` Konrad Dybcio
@ 2026-11-02  8:15         ` Prashanth K
  2026-11-02 14:39           ` Konrad Dybcio
  0 siblings, 1 reply; 8+ messages in thread
From: Prashanth K @ 2026-11-02  8:15 UTC (permalink / raw)
  To: Konrad Dybcio
  Cc: Krishna Kurapati, linux-arm-msm, linux-phy, linux-kernel,
	Vinod Koul, Kishon Vijay Abraham I



On 10/30/2026 6:54 PM, Konrad Dybcio wrote:
> On 10/29/26 7:11 AM, Prashanth K wrote:
>>
>>
>> On 10/23/2026 3:53 PM, Konrad Dybcio wrote:
>>> On 10/22/26 12:43 PM, 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.
>>>>
>>>> Signed-off-by: Prashanth K <prashanth.k@oss.qualcomm.com>
>>>> ---
>>>
>>> Well this still leaves pm_runtime_forbid() in the probe function..
>>>
>>
>> Not sure about the history behind this, I assume its for controlling RT
>> behavior from user-space.
> 
> Long story short it was an opt-in because it was broken.. can't recall
> if the issues were on the dwc3-qcom(-legacy) side or somewhere in the
> PHY code itself.
> 
> Konrad

ok, I'm not sure if we should modify it in this patch, I'll enable the
RT PM operations and check its behavior. But this patch is intended to
enable the system suspend/resume ops for qmp phy.

While at it, you had suggested to add mutex guard on RT operations,
I think we can add that also as a separate series since it needs
addition of mutex on qmp-usb driver.

Regards,
Prashanth K



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 1/2] phy: qcom: qmp-combo: Add PM suspend/resume callbacks
  2026-11-02  8:15         ` Prashanth K
@ 2026-11-02 14:39           ` Konrad Dybcio
  0 siblings, 0 replies; 8+ messages in thread
From: Konrad Dybcio @ 2026-11-02 14:39 UTC (permalink / raw)
  To: Prashanth K
  Cc: Krishna Kurapati, linux-arm-msm, linux-phy, linux-kernel,
	Vinod Koul, Kishon Vijay Abraham I

On 11/2/26 9:15 AM, Prashanth K wrote:
> 
> 
> On 10/30/2026 6:54 PM, Konrad Dybcio wrote:
>> On 10/29/26 7:11 AM, Prashanth K wrote:
>>>
>>>
>>> On 10/23/2026 3:53 PM, Konrad Dybcio wrote:
>>>> On 10/22/26 12:43 PM, 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.
>>>>>
>>>>> Signed-off-by: Prashanth K <prashanth.k@oss.qualcomm.com>
>>>>> ---
>>>>
>>>> Well this still leaves pm_runtime_forbid() in the probe function..
>>>>
>>>
>>> Not sure about the history behind this, I assume its for controlling RT
>>> behavior from user-space.
>>
>> Long story short it was an opt-in because it was broken.. can't recall
>> if the issues were on the dwc3-qcom(-legacy) side or somewhere in the
>> PHY code itself.
>>
>> Konrad
> 
> ok, I'm not sure if we should modify it in this patch, I'll enable the
> RT PM operations and check its behavior. But this patch is intended to
> enable the system suspend/resume ops for qmp phy.

> While at it, you had suggested to add mutex guard on RT operations,
> I think we can add that also as a separate series since it needs
> addition of mutex on qmp-usb driver.

Please assess whether it's necessary. If it is, it's a prerequisite for
the other patch. If it isn't, there aren't any blockers.

It definitely is in the combo PHY case as Sashiko points out

https://sashiko.dev/#/patchset/20261022104321.306679-1-prashanth.k%40oss.qualcomm.com

You can also use:

SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)

instead of adding custom runPM-as-sysPM wrappers

Konrad

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-11-02 14:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-22 10:43 [PATCH v1 0/2] Add the PM suspend/resume callbacks for qcom-combo phys Prashanth K
2026-10-22 10:43 ` [PATCH v1 1/2] phy: qcom: qmp-combo: Add PM suspend/resume callbacks Prashanth K
2026-10-23 10:23   ` Konrad Dybcio
2026-10-29  6:11     ` Prashanth K
2026-10-30 13:24       ` Konrad Dybcio
2026-11-02  8:15         ` Prashanth K
2026-11-02 14:39           ` Konrad Dybcio
2026-10-22 10:43 ` [PATCH v1 2/2] phy: qcom: qmp-usb: " Prashanth K

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®