* [PATCH v2 0/2] soundwire: qcom: force runtime suspend across system sleep
@ 2026-11-30 7:10 Gopi Chandra Sekhar Reddy Kanala
2026-11-30 7:10 ` [PATCH v2 1/2] soundwire: qcom: use the current PM macros Gopi Chandra Sekhar Reddy Kanala
2026-11-30 7:10 ` [PATCH v2 2/2] soundwire: qcom: force runtime suspend across system sleep Gopi Chandra Sekhar Reddy Kanala
0 siblings, 2 replies; 5+ messages in thread
From: Gopi Chandra Sekhar Reddy Kanala @ 2026-11-30 7:10 UTC (permalink / raw)
To: Srinivas Kandagatla, Vinod Koul, Bard Liao, Pierre-Louis Bossart
Cc: linux-sound, linux-arm-msm, linux-kernel,
Gopi Chandra Sekhar Reddy Kanala
The qcom SoundWire controller only has runtime PM callbacks. When
system suspend starts while the controller is runtime active, it stays
active for the whole suspend, so the bus clock and hclk keep running.
On Glymur CRD this keeps CX and DDR from collapsing in s2idle.
Patch 1 moves the PM ops to the current macros. Patch 2 forces the
controller into runtime suspend at system suspend, but only when the
bus supports clock stop and no stream is set up. The no clock stop
path is not changed.
Tested on Glymur CRD (WSA884x speakers on two controllers) with
next-20261123:
- s2idle entered within the autosuspend delay after playback: both
controllers stop the bus clock and gate hclk, and playback works
after resume.
- s2idle entered during playback: the controllers are left running,
and playback works after resume.
- s2idle entered with the controllers runtime suspended: no change.
---
Changes in v2:
- Add a patch moving to the current PM macros (Sashiko)
- Only force runtime suspend when the bus supports clock stop and no
stream is set up, as the no clock stop resume path and set up
streams are not re-initialized after a forced suspend (Sashiko)
- Leave a controller that is already runtime suspended alone, instead
of disabling runtime PM for it early (Sashiko)
- Link to v1: https://lore.kernel.org/r/20261112-qcom-swr-system-sleep-v1-1-a61a83f6475d@oss.qualcomm.com
---
Gopi Chandra Sekhar Reddy Kanala (2):
soundwire: qcom: use the current PM macros
soundwire: qcom: force runtime suspend across system sleep
drivers/soundwire/qcom.c | 46 ++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 42 insertions(+), 4 deletions(-)
---
base-commit: 3191063649dbf7c0d0b768e1f3655e4c5fc6edb5
change-id: 20261112-qcom-swr-system-sleep-e42144d69ecb
Best regards,
--
Gopi Chandra Sekhar Reddy Kanala <gopi.kanala@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/2] soundwire: qcom: use the current PM macros
2026-11-30 7:10 [PATCH v2 0/2] soundwire: qcom: force runtime suspend across system sleep Gopi Chandra Sekhar Reddy Kanala
@ 2026-11-30 7:10 ` Gopi Chandra Sekhar Reddy Kanala
2026-11-30 8:33 ` Konrad Dybcio
2026-11-30 7:10 ` [PATCH v2 2/2] soundwire: qcom: force runtime suspend across system sleep Gopi Chandra Sekhar Reddy Kanala
1 sibling, 1 reply; 5+ messages in thread
From: Gopi Chandra Sekhar Reddy Kanala @ 2026-11-30 7:10 UTC (permalink / raw)
To: Srinivas Kandagatla, Vinod Koul, Bard Liao, Pierre-Louis Bossart
Cc: linux-sound, linux-arm-msm, linux-kernel,
Gopi Chandra Sekhar Reddy Kanala
Switch from SET_RUNTIME_PM_OPS() to RUNTIME_PM_OPS() and pm_ptr(). The
runtime PM callbacks are then always referenced, so they no longer need
__maybe_unused, and the compiler still drops them when CONFIG_PM is
disabled.
No functional change.
Signed-off-by: Gopi Chandra Sekhar Reddy Kanala <gopi.kanala@oss.qualcomm.com>
---
drivers/soundwire/qcom.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index a4cb62897192..4cd9093c303d 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -1790,7 +1790,7 @@ static void qcom_swrm_remove(struct platform_device *pdev)
clk_disable_unprepare(ctrl->hclk);
}
-static int __maybe_unused swrm_runtime_resume(struct device *dev)
+static int swrm_runtime_resume(struct device *dev)
{
struct qcom_swrm_ctrl *ctrl = dev_get_drvdata(dev);
int ret;
@@ -1859,7 +1859,7 @@ static int __maybe_unused swrm_runtime_resume(struct device *dev)
return 0;
}
-static int __maybe_unused swrm_runtime_suspend(struct device *dev)
+static int swrm_runtime_suspend(struct device *dev)
{
struct qcom_swrm_ctrl *ctrl = dev_get_drvdata(dev);
int ret;
@@ -1902,7 +1902,7 @@ static int __maybe_unused swrm_runtime_suspend(struct device *dev)
}
static const struct dev_pm_ops swrm_dev_pm_ops = {
- SET_RUNTIME_PM_OPS(swrm_runtime_suspend, swrm_runtime_resume, NULL)
+ RUNTIME_PM_OPS(swrm_runtime_suspend, swrm_runtime_resume, NULL)
};
static const struct of_device_id qcom_swrm_of_match[] = {
@@ -1924,7 +1924,7 @@ static struct platform_driver qcom_swrm_driver = {
.driver = {
.name = "qcom-soundwire",
.of_match_table = qcom_swrm_of_match,
- .pm = &swrm_dev_pm_ops,
+ .pm = pm_ptr(&swrm_dev_pm_ops),
}
};
module_platform_driver(qcom_swrm_driver);
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 2/2] soundwire: qcom: force runtime suspend across system sleep
2026-11-30 7:10 [PATCH v2 0/2] soundwire: qcom: force runtime suspend across system sleep Gopi Chandra Sekhar Reddy Kanala
2026-11-30 7:10 ` [PATCH v2 1/2] soundwire: qcom: use the current PM macros Gopi Chandra Sekhar Reddy Kanala
@ 2026-11-30 7:10 ` Gopi Chandra Sekhar Reddy Kanala
2026-11-30 8:34 ` Konrad Dybcio
1 sibling, 1 reply; 5+ messages in thread
From: Gopi Chandra Sekhar Reddy Kanala @ 2026-11-30 7:10 UTC (permalink / raw)
To: Srinivas Kandagatla, Vinod Koul, Bard Liao, Pierre-Louis Bossart
Cc: linux-sound, linux-arm-msm, linux-kernel,
Gopi Chandra Sekhar Reddy Kanala
The controller only implements runtime PM callbacks and relies on
runtime suspend to stop the bus clock, gate hclk and arm the wake IRQ.
That is not enough across system suspend: from the prepare phase until
the complete phase the PM core holds a runtime PM usage count on every
device, so a controller that is runtime active at that point stays
active until the system resumes. This happens when suspend is entered
within the 3 second autosuspend delay after bus activity, or when a
peripheral driver resumes its device from its own system suspend
callback, as the SDCA class function driver does to quiesce its
interrupts.
The bus clock then keeps running and hclk stays enabled for the whole
suspend. On Qualcomm platforms the LPASS clock votes behind it are held
as well, which keeps CX and DDR from collapsing in s2idle.
Add system sleep callbacks that force the controller into runtime
suspend and undo it on resume. Only do this when it is safe to run the
runtime suspend path with the peripherals still attached:
- The bus supports clock stop. Without it, runtime resume resets the
bus and only re-initializes the peripherals it saw detach, which
peripherals that were never runtime suspended have not done.
- No stream is set up on the bus. A set up stream stays prepared and
enabled across system sleep, and nothing programs its ports again
on resume. Forcing the suspend during playback left the speakers
silent after resume on Glymur CRD.
A controller that is already runtime suspended is left alone, so runtime
PM is not disabled for it any earlier than before.
Signed-off-by: Gopi Chandra Sekhar Reddy Kanala <gopi.kanala@oss.qualcomm.com>
---
drivers/soundwire/qcom.c | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index 4cd9093c303d..954acb499328 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -225,6 +225,7 @@ struct qcom_swrm_ctrl {
u32 slave_status;
u32 wr_fifo_depth;
bool clock_stop_not_supported;
+ bool sleep_forced;
/* Per-Slave SCP_ADDRPAGE1/2 shadow; -1 = unknown. */
s16 page1_cache[SDW_MAX_DEVICES + 1];
s16 page2_cache[SDW_MAX_DEVICES + 1];
@@ -1901,7 +1902,44 @@ static int swrm_runtime_suspend(struct device *dev)
return 0;
}
+static int swrm_suspend(struct device *dev)
+{
+ struct qcom_swrm_ctrl *ctrl = dev_get_drvdata(dev);
+ bool stream_set_up;
+ int ret;
+
+ if (pm_runtime_status_suspended(dev))
+ return 0;
+
+ scoped_guard(mutex, &ctrl->bus.bus_lock)
+ stream_set_up = !list_empty(&ctrl->bus.m_rt_list);
+
+ if (ctrl->clock_stop_not_supported || stream_set_up)
+ return 0;
+
+ ret = pm_runtime_force_suspend(dev);
+ if (ret)
+ return ret;
+
+ ctrl->sleep_forced = true;
+
+ return 0;
+}
+
+static int swrm_resume(struct device *dev)
+{
+ struct qcom_swrm_ctrl *ctrl = dev_get_drvdata(dev);
+
+ if (!ctrl->sleep_forced)
+ return 0;
+
+ ctrl->sleep_forced = false;
+
+ return pm_runtime_force_resume(dev);
+}
+
static const struct dev_pm_ops swrm_dev_pm_ops = {
+ SYSTEM_SLEEP_PM_OPS(swrm_suspend, swrm_resume)
RUNTIME_PM_OPS(swrm_runtime_suspend, swrm_runtime_resume, NULL)
};
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/2] soundwire: qcom: use the current PM macros
2026-11-30 7:10 ` [PATCH v2 1/2] soundwire: qcom: use the current PM macros Gopi Chandra Sekhar Reddy Kanala
@ 2026-11-30 8:33 ` Konrad Dybcio
0 siblings, 0 replies; 5+ messages in thread
From: Konrad Dybcio @ 2026-11-30 8:33 UTC (permalink / raw)
To: Gopi Chandra Sekhar Reddy Kanala, Srinivas Kandagatla,
Vinod Koul, Bard Liao, Pierre-Louis Bossart
Cc: linux-sound, linux-arm-msm, linux-kernel
On 11/30/26 8:10 AM, Gopi Chandra Sekhar Reddy Kanala wrote:
> Switch from SET_RUNTIME_PM_OPS() to RUNTIME_PM_OPS() and pm_ptr(). The
> runtime PM callbacks are then always referenced, so they no longer need
> __maybe_unused, and the compiler still drops them when CONFIG_PM is
> disabled.
>
> No functional change.
>
> Signed-off-by: Gopi Chandra Sekhar Reddy Kanala <gopi.kanala@oss.qualcomm.com>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Konrad
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 2/2] soundwire: qcom: force runtime suspend across system sleep
2026-11-30 7:10 ` [PATCH v2 2/2] soundwire: qcom: force runtime suspend across system sleep Gopi Chandra Sekhar Reddy Kanala
@ 2026-11-30 8:34 ` Konrad Dybcio
0 siblings, 0 replies; 5+ messages in thread
From: Konrad Dybcio @ 2026-11-30 8:34 UTC (permalink / raw)
To: Gopi Chandra Sekhar Reddy Kanala, Srinivas Kandagatla,
Vinod Koul, Bard Liao, Pierre-Louis Bossart
Cc: linux-sound, linux-arm-msm, linux-kernel
On 11/30/26 8:10 AM, Gopi Chandra Sekhar Reddy Kanala wrote:
> The controller only implements runtime PM callbacks and relies on
> runtime suspend to stop the bus clock, gate hclk and arm the wake IRQ.
> That is not enough across system suspend: from the prepare phase until
> the complete phase the PM core holds a runtime PM usage count on every
> device, so a controller that is runtime active at that point stays
> active until the system resumes. This happens when suspend is entered
> within the 3 second autosuspend delay after bus activity, or when a
> peripheral driver resumes its device from its own system suspend
> callback, as the SDCA class function driver does to quiesce its
> interrupts.
>
> The bus clock then keeps running and hclk stays enabled for the whole
> suspend. On Qualcomm platforms the LPASS clock votes behind it are held
> as well, which keeps CX and DDR from collapsing in s2idle.
>
> Add system sleep callbacks that force the controller into runtime
> suspend and undo it on resume. Only do this when it is safe to run the
> runtime suspend path with the peripherals still attached:
>
> - The bus supports clock stop. Without it, runtime resume resets the
> bus and only re-initializes the peripherals it saw detach, which
> peripherals that were never runtime suspended have not done.
>
> - No stream is set up on the bus. A set up stream stays prepared and
> enabled across system sleep, and nothing programs its ports again
> on resume. Forcing the suspend during playback left the speakers
> silent after resume on Glymur CRD.
>
> A controller that is already runtime suspended is left alone, so runtime
> PM is not disabled for it any earlier than before.
>
> Signed-off-by: Gopi Chandra Sekhar Reddy Kanala <gopi.kanala@oss.qualcomm.com>
> ---
Sashiko has seemingly valid feedback
Konrad
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-30 8:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-30 7:10 [PATCH v2 0/2] soundwire: qcom: force runtime suspend across system sleep Gopi Chandra Sekhar Reddy Kanala
2026-11-30 7:10 ` [PATCH v2 1/2] soundwire: qcom: use the current PM macros Gopi Chandra Sekhar Reddy Kanala
2026-11-30 8:33 ` Konrad Dybcio
2026-11-30 7:10 ` [PATCH v2 2/2] soundwire: qcom: force runtime suspend across system sleep Gopi Chandra Sekhar Reddy Kanala
2026-11-30 8:34 ` Konrad Dybcio
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®