Skip to content

LPASS codec macros: switch to explicit clock management in runtime PM - #1945

Merged
mohsRafi merged 5 commits into
qualcomm-linux:tech/mm/audio/allfrom
aiyapate:X0-shutdown
Oct 1, 2026
Merged

mohsRafi merged 5 commits into
qualcomm-linux:tech/mm/audio/allfrom
aiyapate:X0-shutdown

Conversation

@aiyapate

Copy link
Copy Markdown

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.

CRs-Fixed: 4649922

Ajay Kumar Nandam added 5 commits September 30, 2026 15:38
Replace PM clock framework usage with explicit clock prepare/enable and
disable/unprepare operations from runtime PM callbacks. This keeps the RX
macro clock prepare state tied to the runtime PM active state, so idle
suspend can release parent clock votes.

Use DEFINE_RUNTIME_DEV_PM_OPS() so system suspend forces the same runtime
suspend path for an active device.

Link: https://lore.kernel.org/all/20260928-xo-sd-runtimepm-v1-final-v1-1-e3ebade3aeb7@oss.qualcomm.com/
Signed-off-by: Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com>
Signed-off-by: Aiyaz Patel <aiyapate@qti.qualcomm.com>
Replace PM clock framework usage with explicit clock prepare/enable and
disable/unprepare operations from runtime PM callbacks. This keeps the TX
macro clock prepare state tied to the runtime PM active state, so idle
suspend can release parent clock votes.

Use DEFINE_RUNTIME_DEV_PM_OPS() so system suspend forces the same runtime
suspend path for an active device.

Link: https://lore.kernel.org/all/20260928-xo-sd-runtimepm-v1-final-v1-2-e3ebade3aeb7@oss.qualcomm.com/
Signed-off-by: Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com>
Signed-off-by: Aiyaz Patel <aiyapate@qti.qualcomm.com>
Replace PM clock framework usage with explicit clock prepare/enable and
disable/unprepare operations from runtime PM callbacks. This keeps the VA
macro clock prepare state tied to the runtime PM active state, so idle
suspend can release parent clock votes.

Use DEFINE_RUNTIME_DEV_PM_OPS() so system suspend forces the same runtime
suspend path for an active device.

Link: https://lore.kernel.org/all/20260928-xo-sd-runtimepm-v1-final-v1-3-e3ebade3aeb7@oss.qualcomm.com/
Signed-off-by: Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com>
Signed-off-by: Aiyaz Patel <aiyapate@qti.qualcomm.com>
Replace PM clock framework usage with explicit clock prepare/enable and
disable/unprepare operations from runtime PM callbacks. This keeps the WSA
macro clock prepare state tied to the runtime PM active state, so idle
suspend can release parent clock votes.

Use DEFINE_RUNTIME_DEV_PM_OPS() so system suspend forces the same runtime
suspend path for an active device.

Link: https://lore.kernel.org/all/20260928-xo-sd-runtimepm-v1-final-v1-4-e3ebade3aeb7@oss.qualcomm.com/
Signed-off-by: Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com>
Signed-off-by: Aiyaz Patel <aiyapate@qti.qualcomm.com>
The LPASS macro codec drivers no longer use PM clock framework helpers
after moving clock handling into runtime PM callbacks. Drop the PM_CLK
dependency from RX, TX, VA and WSA macro Kconfig symbols.

Link: https://lore.kernel.org/all/20260928-xo-sd-runtimepm-v1-final-v1-5-e3ebade3aeb7@oss.qualcomm.com/
Signed-off-by: Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com>
Signed-off-by: Aiyaz Patel <aiyapate@qti.qualcomm.com>
@qcomlnxci
qcomlnxci requested review from a team, PrasadKumpatla and mohsRafi and removed request for a team September 30, 2026 11:14
@mohsRafi
mohsRafi merged commit 277113f into qualcomm-linux:tech/mm/audio/all Oct 1, 2026
4 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants