mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/5] ASoC: codecs: lpass-macro: manage clocks in runtime PM
@ 2026-09-28 10:32 Ajay Kumar Nandam
  2026-09-28 10:32 ` [PATCH 1/5] ASoC: codecs: lpass-rx-macro: " Ajay Kumar Nandam
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Ajay Kumar Nandam @ 2026-09-28 10:32 UTC (permalink / raw)
  To: Srinivas Kandagatla, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai
  Cc: linux-sound, linux-arm-msm, linux-kernel, Ajay Kumar Nandam

The LPASS macro codec drivers currently rely on the PM clock framework
to manage their clocks. The PM clock framework is useful for the common
case where drivers only need clocks enabled while the device is active,
but its lifecycle is not a good fit for these codec clocks.

The PM clock framework separates the prepare and enable lifetimes:

 - of_pm_clk_add_clks() adds the DT clocks to the device PM clock list.
 - pm_clk_acquire() is called while adding each clock.
 - for normal clocks, pm_clk_acquire() calls clk_prepare() immediately
   and marks the clock as PCE_STATUS_PREPARED.
 - runtime resume calls pm_clk_resume(), which calls clk_enable() for
   clocks already in PCE_STATUS_PREPARED.
 - runtime suspend calls pm_clk_suspend(), which calls clk_disable() and
   returns the clock to PCE_STATUS_PREPARED.
 - clk_unprepare() is not called on normal runtime suspend; it happens
   when the PM clock entry is removed/destroyed. For a codec device this
   usually means driver remove or reboot, not the end of an audio use
   case.

PM-clk does have a different runtime suspend path for clocks that report
clk_is_enabled_when_prepared(), where suspend uses
clk_disable_unprepare(). The issue described here is for normal clocks
with separate enable/disable operations, which remain prepared across
runtime suspend.

That prepare/enable split is problematic for platforms where the audio
macro clocks are sourced from an XO-backed clock tree. Preparing a child
clock walks the parent tree. If the parent path reaches an RPM/RPMh
managed XO clock, the provider may vote for the XO resource during
prepare. Therefore a non-zero prepare count can be sufficient to keep
the XO resource voted at the provider level, even when the corresponding
enable count is zero.

In other words, after the codec runtime suspends, PM-clk has disabled the
LPASS macro clocks, but it has intentionally kept them prepared. On
XO-backed clock trees that remaining prepared state can still hold the
parent XO vote and prevent XO shutdown. This is expected behaviour from
the PM clock framework, but it does not match the power requirement for
these audio macro clocks.

For the LPASS macro drivers the required clock lifetime is simpler: the
macro register block needs these clocks only while the device is runtime
active. Move RX, TX, VA and WSA macro clock handling into the existing
runtime PM callbacks using clk_prepare_enable() on runtime resume and
clk_disable_unprepare() on runtime suspend. This makes both prepare and
enable counts follow the device runtime PM active state and releases
parent XO votes when the macro runtime suspends.

Each macro driver is converted independently so the series remains
bisectable. The final patch drops the now-unused PM_CLK dependency from
the LPASS macro Kconfig symbols.

Signed-off-by: Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com>
---
Ajay Kumar Nandam (5):
      ASoC: codecs: lpass-rx-macro: manage clocks in runtime PM
      ASoC: codecs: lpass-tx-macro: manage clocks in runtime PM
      ASoC: codecs: lpass-va-macro: manage clocks in runtime PM
      ASoC: codecs: lpass-wsa-macro: manage clocks in runtime PM
      ASoC: codecs: lpass-macro: drop PM_CLK dependency

 sound/soc/codecs/Kconfig           |  4 --
 sound/soc/codecs/lpass-rx-macro.c  | 74 ++++++++++++++++++++++++-----------
 sound/soc/codecs/lpass-tx-macro.c  | 75 ++++++++++++++++++++++++-----------
 sound/soc/codecs/lpass-va-macro.c  | 74 ++++++++++++++++++++++-------------
 sound/soc/codecs/lpass-wsa-macro.c | 80 +++++++++++++++++++++++++-------------
 5 files changed, 203 insertions(+), 104 deletions(-)
---
base-commit: f5f84daefcd92d7a630066635ecea1433ed5eac7
change-id: 20260925-xo-sd-runtimepm-v1-final-37ebcf40aecb

Best regards,
--  
Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com>


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

end of thread, other threads:[~2026-09-28 10:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-28 10:32 [PATCH 0/5] ASoC: codecs: lpass-macro: manage clocks in runtime PM Ajay Kumar Nandam
2026-09-28 10:32 ` [PATCH 1/5] ASoC: codecs: lpass-rx-macro: " Ajay Kumar Nandam
2026-09-28 10:32 ` [PATCH 2/5] ASoC: codecs: lpass-tx-macro: " Ajay Kumar Nandam
2026-09-28 10:32 ` [PATCH 3/5] ASoC: codecs: lpass-va-macro: " Ajay Kumar Nandam
2026-09-28 10:32 ` [PATCH 4/5] ASoC: codecs: lpass-wsa-macro: " Ajay Kumar Nandam
2026-09-28 10:32 ` [PATCH 5/5] ASoC: codecs: lpass-macro: drop PM_CLK dependency Ajay Kumar Nandam

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®