Repository navigation
LPASS codec macros: switch to explicit clock management in runtime PM - #1218
Merged
Salendarsingh Gaud (sgaud-quic) merged 12 commits intoOct 5, 2026
Conversation
added 12 commits
September 30, 2026 12:18
The WSA and VA macro drivers use PM clock framework APIs after the runtime PM clock conversion. Add the matching Kconfig dependency for build configurations where PM_CLK is not otherwise selected. This is a 6.18 backport carrying only the PM_CLK Kconfig dependency from the merged WSA and VA PM clock framework changes. Link: https://patch.msgid.link/20260702-xo-sd-codec-v7-b4-v8-1-d39d0fdb7859@oss.qualcomm.com Link: https://patch.msgid.link/20260702-xo-sd-codec-v7-b4-v8-2-d39d0fdb7859@oss.qualcomm.com Signed-off-by: Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com> Signed-off-by: Aiyaz Patel <aiyapate@qti.qualcomm.com>
…r MCLK output Switch WSA MCLK output registration to devm_clk_hw_register() so the clk hw is automatically unregistered on probe failure and remove. Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Signed-off-by: Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com> Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com> Tested-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com> Link: https://patch.msgid.link/20260702-xo-sd-codec-v7-b4-v8-3-d39d0fdb7859@oss.qualcomm.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Aiyaz Patel <aiyapate@qti.qualcomm.com>
…or runtime PM Convert the LPASS TX macro codec driver to runtime PM clock management using the PM clock framework. Replace manual macro/dcodec/mclk/npl/fsgen clock toggling with PM clock helpers and runtime PM callbacks. Keep the SWR gate runtime PM reference from SWR clock enable until disable so autosuspend does not gate clocks while SWR is still prepared. Set autosuspend delay to 100 ms so PM-clock-managed votes are dropped soon after idle while still avoiding suspend/resume churn on short gaps. Add a PM_CLK dependency to SND_SOC_LPASS_TX_MACRO since this patch introduces PM clock APIs. Tighten error unwind by checking pm_runtime_put_sync_suspend() in probe and by restoring regcache state if pm_clk_resume()/regcache_sync() fails. Co-developed-by: Ravi Hothi <ravi.hothi@oss.qualcomm.com> Signed-off-by: Ravi Hothi <ravi.hothi@oss.qualcomm.com> Signed-off-by: Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com> Link: https://patch.msgid.link/20260707-xo-sd-codec-tx-rx-v2-1-f61b4622f97f@oss.qualcomm.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Aiyaz Patel <aiyapate@qti.qualcomm.com>
…or runtime PM Convert the LPASS RX macro codec driver to runtime PM clock management using the PM clock framework. Replace manual macro/dcodec/mclk/npl/fsgen clock toggling with PM clock helpers and runtime PM callbacks. Keep the SWR gate runtime PM reference from SWR clock enable until disable so autosuspend does not gate clocks while SWR is still prepared. Set autosuspend delay to 100 ms so PM-clock-managed votes are dropped soon after idle while still avoiding suspend/resume churn on short gaps. Add a PM_CLK dependency to SND_SOC_LPASS_RX_MACRO since this patch introduces PM clock APIs. Tighten error unwind by checking pm_runtime_put_sync_suspend() in probe and by restoring regcache state if pm_clk_resume()/regcache_sync() fails. Drop the now-empty rx_macro_remove() callback since all clock cleanup is handled by PM clock framework and devm. Co-developed-by: Ravi Hothi <ravi.hothi@oss.qualcomm.com> Signed-off-by: Ravi Hothi <ravi.hothi@oss.qualcomm.com> Signed-off-by: Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com> Link: https://patch.msgid.link/20260707-xo-sd-codec-tx-rx-v2-2-f61b4622f97f@oss.qualcomm.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Aiyaz Patel <aiyapate@qti.qualcomm.com>
…rn value clk_set_rate() returns 0 on success or a negative errno on failure but the TX and RX macro probe functions were ignoring it. Check the return value and bail out of probe on failure. Suggested-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Co-developed-by: Ravi Hothi <ravi.hothi@oss.qualcomm.com> Signed-off-by: Ravi Hothi <ravi.hothi@oss.qualcomm.com> Signed-off-by: Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com> Link: https://patch.msgid.link/20260707-xo-sd-codec-tx-rx-v2-3-f61b4622f97f@oss.qualcomm.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Aiyaz Patel <aiyapate@qti.qualcomm.com>
…alue clk_set_rate() returns 0 on success or a negative errno on failure but the WSA macro probe function is ignoring it. Check the return value and bail out of probe on failure. This is rebased for the Qualcomm 6.18 tree, which already guards the optional NPL clock before programming it. Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Signed-off-by: Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://patch.msgid.link/20260715-xo-sd-codec-wsa-va-clk-set-rate-v2-1-16ca64c2b929@oss.qualcomm.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Aiyaz Patel <aiyapate@qti.qualcomm.com>
clk_set_rate() returns 0 on success or a negative errno on failure but the VA macro probe function is ignoring it. Check the return value and bail out of probe on failure. This is rebased for the Qualcomm 6.18 tree, which has additional Shikra-specific VA macro data fields. Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Signed-off-by: Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://patch.msgid.link/20260715-xo-sd-codec-wsa-va-clk-set-rate-v2-2-16ca64c2b929@oss.qualcomm.com Signed-off-by: Mark Brown <broonie@kernel.org> 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 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>
aiyapate
requested review from
a team,
knaveen-qc,
Nicolas Dechesne (ndechesne) and
Trilok Soni (trsoni)
September 30, 2026 07:10
|
Merge Check Failed: No CR Numbers Found Error: No Change Request numbers were found. Please add Change Request numbers to your pull request description in the format CRs-Fixed: 12345 or link GitHub issues that are associated with Change Requests. |
|
Merge Check Failed: No Change Task Found No associated change tasks found for CR 4649922 on any of the following entities: Entities:
CR: 4649922 Please ensure the CR has a change task associated with at least one of the entities for this branch. |
Contributor
|
Please raise the FROMLIST patches PR for the Mainline 0.0 release. |
Author
|
Have raised and got the PR merged in mainline: qualcomm-linux/kernel-topics#1945. |
Komal Bajaj (Komal-Bajaj)
approved these changes
Oct 5, 2026
Test Matrix
|
Salendarsingh Gaud (sgaud-quic)
merged commit Oct 5, 2026
305f69a
into
qualcomm-linux:qcom-6.18.y
6 of 8 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
and marks the clock as PCE_STATUS_PREPARED.
clocks already in PCE_STATUS_PREPARED.
returns the clock to PCE_STATUS_PREPARED.
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