Skip to content

X0 shutdown fix audio - #93

Open
aiyapate wants to merge 11 commits into
qualcomm-linux:resolute-qcom-develfrom
aiyapate:x0_shutdown_fix_audio
Open

X0 shutdown fix audio#93
aiyapate wants to merge 11 commits into
qualcomm-linux:resolute-qcom-develfrom
aiyapate:x0_shutdown_fix_audio

Conversation

@aiyapate

Copy link
Copy Markdown

This series refactors LPASS GPIO register access and runtime power management to enable proper release of LPASS power domain and RPMH clock votes when the macros are idle.

Refactor LPASS LPI GPIO register access to remove per-register runtime PM get/put operations and manage runtime PM at the caller level.
Convert LPASS macro drivers (RX/TX/VA/WSA) to use runtime PM along with of_pm_clk_add_clks() for clock management.
Replace permanent power domain holds with runtime PM aware device links.
Move clock vote handling to runtime PM suspend/resume callbacks.
Add clock rate error handling and support optional NPL clocks on platforms where they are not present.

aiyapate and others added 11 commits August 26, 2026 08:58
This reverts commits 8b7092b
("FROMLIST: pinctrl: qcom: lpass-lpi: Switch to PM clock framework
for runtime PM"), d7eca95
("FROMLIST: pinctrl: qcom: lpass-lpi: Fix GPIO register access
helper return types"), cbbffab
("FROMLIST: pinctrl: qcom: lpass-lpi: Resume clocks for GPIO
access") and 2cbe01a ("FROMLIST:
pinctrl: qcom: lpass-lpi: Enable runtime PM hooks on remaining
SoCs").

These changes are outdated and will be replaced by a newer upstream
PM clock framework conversion for the LPASS LPI pinctrl driver.

Signed-off-by: Aiyaz Patel <aiyapate@qti.qualcomm.com>
This reverts commits 9b88a6b
("FROMLIST: ASoC: codecs: lpass-wsa-macro: Switch to PM clock
framework for runtime PM"), 4215694
("FROMLIST: ASoC: codecs: lpass-va-macro: Switch to PM clock
framework for runtime PM") and 1fc9a6e
("FROMLIST: ASoC: codecs: lpass-wsa-macro: Guard optional NPL clock
rate programming").

These changes are outdated and will be replaced by a newer upstream
PM clock framework conversion for the LPASS WSA/VA macro codec
drivers.

Signed-off-by: Aiyaz Patel <aiyapate@qti.qualcomm.com>
…runtime PM

Convert the LPASS LPI pinctrl driver to use the PM clock framework for
runtime power management.

This allows the LPASS LPI pinctrl driver to drop clock votes when idle,
improves power efficiency on platforms using LPASS LPI island mode, and
aligns the driver with common runtime PM patterns used across Qualcomm
LPASS subsystems.

Guard GPIO register read/write helpers and slew-rate register programming
with synchronous runtime PM calls so the device is active during MMIO
operations whenever autosuspend is enabled.

Make PINCTRL_LPASS_LPI depend on PM_CLK, since this patch introduces
direct PM clock API use in the shared core.

Suggested-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>
Signed-off-by: Aiyaz Patel <aiyapate@qti.qualcomm.com>
(cherry picked from commit b719ede389d8a6b3fb24d3a6641fec2e46d8ff36)
…LPI SoCs

The LPASS LPI core conversion to PM clock framework relies on variant
drivers wiring runtime PM callbacks.

Hook up runtime PM callbacks for the LPASS LPI variant drivers touched
in this patch so they are prepared for the shared core conversion.

This commit is a preparatory NOP on its own, as runtime PM is still
disabled on these devices until the following core conversion patch.

This is a mechanical per-variant driver update that relies on the
same generic PM clock flow (of_pm_clk_add_clks() + pm_clk_suspend/
pm_clk_resume()) and DT-provided clocks.

Runtime behavior was validated on Kodiak (sc7280).

Suggested-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>
Signed-off-by: Aiyaz Patel <aiyapate@qti.qualcomm.com>
(cherry picked from commit f0c565076d56407b4a1b9e75328df0f3adaa0194)
[aiyapate: dropped hunks for pinctrl-milos-lpass-lpi.c,
 pinctrl-sdm670-lpass-lpi.c and pinctrl-sm6350-lpass-lpi.c, which are
 not present in this tree]
…for runtime PM

Convert the LPASS WSA macro codec driver to runtime PM clock management by
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_WSA_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.

Suggested-by: Mark Brown <broonie@kernel.org>
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-1-d39d0fdb7859@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Aiyaz Patel <aiyapate@qti.qualcomm.com>
(cherry picked from commit cd054a6e272caa97ab808ef6f5588749a1429108
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git)
…or runtime PM

Convert the LPASS VA macro codec driver to runtime PM clock management by
using the PM clock framework.

Replace manual macro/dcodec/mclk/npl clock handling with PM clock helpers
and runtime PM callbacks, and keep runtime PM references around fsgen clock
gating so PM-clock-managed clocks remain active while fsgen is enabled.

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_VA_MACRO since this patch
introduces PM clock APIs.

Improve failure unwind paths: handle runtime PM put errors in probe/fsgen
paths and restore regcache state correctly on resume failure.

Suggested-by: Mark Brown <broonie@kernel.org>
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>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Link: https://patch.msgid.link/20260702-xo-sd-codec-v7-b4-v8-2-d39d0fdb7859@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Aiyaz Patel <aiyapate@qti.qualcomm.com>
(cherry picked from commit eb667d0fbdd38d5a800b9e7aafc9a6c14530b9bf
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git)
…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>
(cherry picked from commit 541735571578b84987868c5662089f73bac36895
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git)
…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.

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>
(cherry picked from commit 6173e18dd47cce430506c2f642e0b8d8db51ff1e
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git)
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.

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>
(cherry picked from commit 4fddda16f939b6ee53c6946ad71a2ea1fabf43c5
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git)
…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>
(cherry picked from commit b9b23e72abef91ab4689f1467cefc2517042ab26
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git)
…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>
(cherry picked from commit b05482e7ce1b110f86b08a99768ac41e4c9e4dfa
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git)
@aiyapate
aiyapate force-pushed the x0_shutdown_fix_audio branch from af39518 to 5b6277e Compare August 26, 2026 05:04
@keerthi-go

Copy link
Copy Markdown

Closing and re-opening to run all the PR checks.

@aiyapate

Copy link
Copy Markdown
Author
  1. Why do we need this change?
    To resolve the X0 shutdown issue where the audio clocks were active, blocking X0 shutdown.
  2. Was it merged on qcom-next, qcom-6.18 or upstream Kernel?
    Merged in linux-next. On going on qcom-next.
  3. Was it verified with Ubuntu Kernel? What is the test case that is verified?
    Verification pending on latest tip.
  4. If it's required, please rebase the PR since we have rebased on Canonical x05 release.
    Rebased on latest tip.

@quic-tingweiz

Copy link
Copy Markdown
  1. Why do we need this change?
    To resolve the X0 shutdown issue where the audio clocks were active, blocking X0 shutdown.
  2. Was it merged on qcom-next, qcom-6.18 or upstream Kernel?
    Merged in linux-next. On going on qcom-next.
  3. Was it verified with Ubuntu Kernel? What is the test case that is verified?
    Verification pending on latest tip.
  4. If it's required, please rebase the PR since we have rebased on Canonical x05 release.
    Rebased on latest tip.

Please update here once verification is done.

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.

3 participants