From: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
To: Charles Keepax <ckeepax@opensource.cirrus.com>,
broonie@kernel.org, Bard Liao <yung-chuan.liao@linux.intel.com>
Cc: lgirdwood@gmail.com, yung-chuan.liao@linux.intel.com,
rafael@kernel.org, linux-pm@vger.kernel.org,
linux-sound@vger.kernel.org, patches@opensource.cirrus.com
Subject: Re: [PATCH] ASoC: SDCA: Add NO_DIRECT_COMPLETE flag to class driver
Date: Tue, 20 Jan 2026 17:50:29 +0100 [thread overview]
Message-ID: <43cb31d5-1423-4354-8eb1-68afbac622da@linux.dev> (raw)
In-Reply-To: <20260115131727.373738-1-ckeepax@opensource.cirrus.com>
On 1/15/26 14:17, Charles Keepax wrote:
> The SDCA class driver currently expects the device will be fully powered
> down on system suspend but not on runtime suspend. This is typically
> required as when audio is not active (ie. runtime suspend) jack detect
> is expected to still function, but when the whole system is hibernated
> there is no need to recognise audio jack events. This means the class
> driver needs to always be informed of a system suspend, so the direct
> complete optimisation (where PM will skip calling system suspend if the
> device is runtime suspended) is not appropriate for the SDCA class
> driver.
>
> Add the NO_DIRECT_COMPLETE flag to prevent this optimisation from
> running against this driver.
Humm, this flag makes sure the class driver .suspend method is called, but does the core also force a pm_runtime resume before?
In other words, what is the state of the device when the system suspend routine is invoked by the PM core when this flag is set?
FWIW, we had a similar problem on the Intel side, and we used the .prepare method to force a pm_runtime resume. If the host was pm_runtime suspended, then we'd bring it back to full power before the system suspend. It may seem overkill but it's required at the hardware level, a system suspend with the clock already stopped isn't supported.
If the PM core guaranteed the device state was resumed by adding this flag, then the Intel folks could remove quite a few lines of code.
link: https://github.com/thesofproject/linux/blob/ec0e6c69113f4b342ee8eabec286dea33d98a7cc/drivers/soundwire/intel_auxdevice.c#L568
Going back to this SDCA driver, if the PM core does NOT change the pm_runtime state, then should the class driver perform a full pm_runtime resume and then do the expected system suspend sequence?
Sorry if I am splitting hair, in the past we played with these PM flags and always understood them in the wrong way...
> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
> ---
> sound/soc/sdca/sdca_class_function.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/sound/soc/sdca/sdca_class_function.c b/sound/soc/sdca/sdca_class_function.c
> index 0afa41c1ee93c..98fd3fd1052b4 100644
> --- a/sound/soc/sdca/sdca_class_function.c
> +++ b/sound/soc/sdca/sdca_class_function.c
> @@ -377,6 +377,8 @@ static int class_function_probe(struct auxiliary_device *auxdev,
> if (ret)
> return ret;
>
> + dev_pm_set_driver_flags(dev, DPM_FLAG_NO_DIRECT_COMPLETE);
> +
> pm_runtime_set_autosuspend_delay(dev, 200);
> pm_runtime_use_autosuspend(dev);
> pm_runtime_set_active(dev);
next prev parent reply other threads:[~2026-01-20 16:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-15 13:17 [PATCH] ASoC: SDCA: Add NO_DIRECT_COMPLETE flag to class driver Charles Keepax
2026-01-20 16:50 ` Pierre-Louis Bossart [this message]
2026-01-20 17:45 ` Charles Keepax
2026-01-21 12:41 ` Pierre-Louis Bossart
2026-01-21 13:05 ` Charles Keepax
2026-01-21 15:08 ` Pierre-Louis Bossart
2026-01-22 13:26 ` Mark Brown
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=43cb31d5-1423-4354-8eb1-68afbac622da@linux.dev \
--to=pierre-louis.bossart@linux.dev \
--cc=broonie@kernel.org \
--cc=ckeepax@opensource.cirrus.com \
--cc=lgirdwood@gmail.com \
--cc=linux-pm@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
--cc=rafael@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