Skip to content

qcom: audio: Allow CX/DDR collapse in s2idle - #1392

Open
Gopi Chandra Sekhar Reddy Kanala (gkanala-qc) wants to merge 4 commits into
qualcomm-linux:qcom-7.3from
gkanala-qc:qcom-7.3
Open

Gopi Chandra Sekhar Reddy Kanala (gkanala-qc) wants to merge 4 commits into
qualcomm-linux:qcom-7.3from
gkanala-qc:qcom-7.3

Conversation

@gkanala-qc

Glymur CRD: release LPASS audio votes so CX/DDR can collapse in s2idle
On Glymur CRD, the audio stack held LPASS clock votes while system idle and during
s2idle, so CX, DDR and AOSS never collapsed (qcom_stats cxsd/ddr/aosd Count
stayed 0).

Idle fixes
soundwire: qcom: gate dependent controller hclk with runtime PM
The lane provider controller (swr1, which supplies data lanes to swr2) turned
its hclk on at probe and never turned it off. It now gets runtime PM through
a device link to its consumer, so hclk is gated whenever the link is idle.
ASoC: codecs: lpass-macro: register output clocks before runtime PM
The rx/tx/va/wsa macros registered their output clock after enabling runtime
PM. The clk core then woke each macro whenever clk_summary was read, so the
macro clocks always looked enabled. The clock is now registered before
runtime PM is enabled.
Suspend fixes
During system suspend, the WCD9378 SDCA suspend callback wakes the codec,
and that wake propagates to the SoundWire controllers and the LPI pin
controller. Both had only runtime PM callbacks, so once woken they stayed
on, with their clock votes, for the whole suspend.

soundwire: qcom: force runtime suspend across system sleep

pinctrl: qcom: sm8650-lpass-lpi: Force runtime suspend on system sleep
Both now use pm_runtime_force_suspend()/pm_runtime_force_resume() as their
system sleep callbacks, the same way the lpass macros already do. Glymur
binds the sm8650 LPI driver through its fallback compatible.

Jira ticket: https://jira-dc.qualcomm.com/jira/browse/QLIJIRA-208

Backport: qualcomm-linux/kernel-topics#2177

@qcomlnxci

Copy link
Copy Markdown

Test Matrix

Test Case kbdev-glymur-crd-multimedia
BT_FW_KMD_Service ✅ Pass
BT_ON_OFF ✅ Pass
BT_SCAN ✅ Pass
CPUFreq_Validation ✅ Pass
CPU_affinity ✅ Pass
DSP_AudioPD ✅ Pass
Ethernet_Basic_Validation ⚠️ skip
Freq_Scaling ✅ Pass
GIC ✅ Pass
IPA ✅ Pass
Interrupts ✅ Pass
KVM_Driver ✅ Pass
KVM_EL2_DTB ✅ Pass
KVM_Infra ✅ Pass
OpenCV ✅ Pass
PCIe ✅ Pass
Probe_Failure_Check ❌ Fail
RMNET ✅ Pass
UFS_Validation ⚠️ skip
USBHost ✅ Pass
WiFi_Firmware_Driver ✅ Pass
WiFi_OnOff ✅ Pass
adsp_remoteproc ✅ Pass
cdsp_remoteproc ✅ Pass
gpdsp_remoteproc ⚠️ skip
hotplug ✅ Pass
irq ✅ Pass
kaslr ✅ Pass
pinctrl ✅ Pass
qcom_hwrng ✅ Pass
rngtest ✅ Pass
shmbridge ✅ Pass
smmu ❌ Fail
watchdog ✅ Pass
wpss_remoteproc ✅ Pass

@qcomlnxci

Copy link
Copy Markdown

Test jobs on 541d9ea

Srinivas Kandagatla and others added 4 commits November 6, 2026 12:09
On controllers borrowing DATA lanes, the lane provider has no bus of its
own and no runtime PM, so the hclk enabled at probe stays on even when
the consumer has suspended and the link is idle.

Give the provider minimal runtime PM callbacks that only gate its hclk.
Mark it active and enable runtime PM before advertising it as ready.
Add DL_FLAG_PM_RUNTIME and DL_FLAG_RPM_ACTIVE to the consumer-to-provider
device link, so the provider resumes before the consumer accesses its
registers and suspends after the consumer stops the bus clock.

In remove(), disable runtime PM on the provider and drop hclk if it is
still active. Resume the provider around the consumer's final register
writes that disable it, then clear the cross-pointers. Restore the
provider's MM_SYNC configuration when the consumer resumes the link.

Adapted to this tree's lane-provider/consumer implementation.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
…time PM

The rx, tx, wsa and va macros register their output clock (SWR clock
gate or fsgen) after enabling runtime PM. The clk core then marks each
macro as a runtime PM managed provider, and clk_summary resumes it
through clk_pm_runtime_get_all() before walking the tree. Resuming the
macro enables its macro, dcodec, mclk, npl and fsgen clocks, so the
summary always shows them enabled even when audio is idle.

The clk core doesn't need to resume these providers. The gate
prepare/unprepare callbacks already take and drop runtime PM
themselves. is_enabled reads a cached, non-volatile register, so it
never touches the hardware.

Register the clk_hw before devm_pm_runtime_enable(). Keep adding the OF
provider at the end of probe, so a consumer can't prepare the gate
before runtime PM is enabled.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
The controller only implements runtime PM callbacks and relies on
runtime suspend to stop the bus clock and release hclk. That is not
enough across system suspend: from the prepare phase until complete the
PM core holds a runtime PM usage count on every device, so a controller
that is runtime active at that point, or that one of its peripherals
resumes from its own system suspend callback, stays active until the
system resumes.

This happens on Glymur CRD with the WCD9378 SDCA codec. The SDCA class
function's system suspend callback resumes the function to quiesce its
interrupts, which resumes the codec, the SoundWire bus master and,
through runtime PM device links, the lane provider controller, the
RX/TX macros and the LPASS LPI pin controller. Nothing suspends them
again, so their LPASS clock votes are held for the whole suspend and CX
and DDR never collapse.

Use pm_runtime_force_suspend() and pm_runtime_force_resume() as the
system sleep callbacks, so the runtime suspend path (clock stop, hclk
off, wake IRQ armed) always runs at system suspend and is undone on
resume. Peripherals are children of the bus and suspend before it. The
lane provider is a device link supplier of its consumer, so it suspends
after the consumer has stopped the bus and resumes before the consumer
restarts it, which is the order the runtime callbacks already expect.

Signed-off-by: Gopi Chandra Sekhar Reddy Kanala <gopi.kanala@oss.qualcomm.com>
…stem sleep

The LPASS LPI pin controller votes for the LPASS HW_MACRO and HW_DCODEC
clocks through pm_clk and only has runtime PM callbacks. Its consumers,
such as the SoundWire controllers, keep it runtime active through their
device links. If a consumer is active when system suspend starts, or is
resumed during it, the usage count the PM core holds from the prepare
phase keeps the pin controller from runtime suspending, and both votes
are held for the whole suspend. On Glymur CRD this keeps CX and DDR
from collapsing.

Use pm_runtime_force_suspend() and pm_runtime_force_resume() as the
system sleep callbacks so the clocks are always released at system
suspend. Consumers are suspended before their suppliers, so the pin
controller is the last of them to go down and the first to come back.

Signed-off-by: Gopi Chandra Sekhar Reddy Kanala <gopi.kanala@oss.qualcomm.com>
@qcomlnxci

Copy link
Copy Markdown

Test Matrix

Test Case kbdev-glymur-crd-multimedia
BT_FW_KMD_Service ✅ Pass
BT_ON_OFF ✅ Pass
BT_SCAN ✅ Pass
CPUFreq_Validation ✅ Pass
CPU_affinity ✅ Pass
DSP_AudioPD ✅ Pass
Ethernet_Basic_Validation ⚠️ skip
Freq_Scaling ✅ Pass
GIC ✅ Pass
IPA ✅ Pass
Interrupts ✅ Pass
KVM_Driver ✅ Pass
KVM_EL2_DTB ✅ Pass
KVM_Infra ✅ Pass
OpenCV ✅ Pass
PCIe ✅ Pass
Probe_Failure_Check ❌ Fail
RMNET ✅ Pass
UFS_Validation ⚠️ skip
USBHost ✅ Pass
WiFi_Firmware_Driver ✅ Pass
WiFi_OnOff ✅ Pass
adsp_remoteproc ✅ Pass
cdsp_remoteproc ✅ Pass
gpdsp_remoteproc ⚠️ skip
hotplug ✅ Pass
irq ✅ Pass
kaslr ✅ Pass
pinctrl ✅ Pass
qcom_hwrng ✅ Pass
rngtest ✅ Pass
shmbridge ✅ Pass
smmu ❌ Fail
watchdog ✅ Pass
wpss_remoteproc ✅ Pass

@qcomlnxci

Copy link
Copy Markdown

Test jobs on a43156f

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