From: Paul Menzel <pmenzel@molgen.mpg.de>
To: Vinod Koul <vkoul@kernel.org>,
Bard Liao <yung-chuan.liao@linux.intel.com>,
Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
Cc: Paul Menzel <pmenzel@molgen.mpg.de>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] soundwire: Suspend and resume managers and peripherals asynchronously
Date: Fri, 27 Nov 2026 16:00:56 +0100 [thread overview]
Message-ID: <20261127150101.48880-2-pmenzel@molgen.mpg.de> (raw)
In-Reply-To: <20261127150101.48880-1-pmenzel@molgen.mpg.de>
On system resume, the resume callback of a SoundWire peripheral driver
usually waits until the manager has enumerated the peripheral again and the
driver’s update_status callback has re-initialized it. The PM core runs the
callbacks of devices without the async flag one after another in dpm_list
order, so the peripherals on different links wait for each other, and each
of them also waits for all synchronous devices before it in that list.
Apart from the parent-child relation, which the PM core respects for
asynchronous devices, the manager and peripheral devices do not depend on
other devices in the system sleep transitions. Codec drivers that need
their peripherals active, like wcd937x, wcd938x and wcd939x, add device
links, which the PM core respects too. So enable asynchronous suspend and
resume for the managers and the peripherals.
On a Dell XPS 9315 (Alder Lake, SOF), in one cycle, the RT1316 amplifier on
link 2 took 16.3 ms in its resume callback, and the RT714 DMIC codec on
link 3 took 9.9 ms after it. Together with the next patch for the Intel
link devices, the resume callbacks of the two links and the two codecs now
overlap, and their span shrinks from 28.9 ms to 17.1 ms (median of five
s2idle cycles each).
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
---
Notes:
The analysis (sleepgraph device callback timings, function traces of the
link start-up), the patch and this commit message were drafted with
claude-opus-5-5 (Claude Code), asked to cut the s2idle resume time of
this laptop, see Documentation/process/generated-content.rst. The tests
are in the commit message and the cover letter.
drivers/soundwire/master.c | 3 +++
drivers/soundwire/slave.c | 6 ++++++
2 files changed, 9 insertions(+)
diff --git a/drivers/soundwire/master.c b/drivers/soundwire/master.c
index 440bfc52ccba5..54ce317ab1628 100644
--- a/drivers/soundwire/master.c
+++ b/drivers/soundwire/master.c
@@ -147,6 +147,9 @@ int sdw_master_device_add(struct sdw_bus *bus, struct device *parent,
dev_set_name(&md->dev, "sdw-master-%d-%d", bus->controller_id, bus->link_id);
+ /* the managers of different links can resume in parallel */
+ device_enable_async_suspend(&md->dev);
+
ret = device_register(&md->dev);
if (ret) {
dev_err(parent, "Failed to add master: ret %d\n", ret);
diff --git a/drivers/soundwire/slave.c b/drivers/soundwire/slave.c
index a7d2938b031d0..3e77c9c586d17 100644
--- a/drivers/soundwire/slave.c
+++ b/drivers/soundwire/slave.c
@@ -84,6 +84,12 @@ int sdw_slave_add(struct sdw_bus *bus,
sdca_lookup_interface_revision(slave);
sdca_lookup_functions(slave);
+ /*
+ * Peripherals wait for their re-initialization on resume, which can
+ * be done for all of them in parallel.
+ */
+ device_enable_async_suspend(&slave->dev);
+
ret = device_register(&slave->dev);
if (ret) {
dev_err(bus->dev, "Failed to add slave: ret %d\n", ret);
--
2.54.0
next prev parent reply other threads:[~2026-11-27 15:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 15:00 [PATCH 0/2] soundwire: Suspend and resume asynchronously Paul Menzel
2026-11-27 15:00 ` Paul Menzel [this message]
2026-11-27 15:00 ` [PATCH 2/2] soundwire: intel: Suspend and resume the links asynchronously Paul Menzel
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=20261127150101.48880-2-pmenzel@molgen.mpg.de \
--to=pmenzel@molgen.mpg.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=pierre-louis.bossart@linux.dev \
--cc=vkoul@kernel.org \
--cc=yung-chuan.liao@linux.intel.com \
/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®