Skip to content

Asoc runtime pm fix v2#18

Open
nandamajay wants to merge 4 commits intomasterfrom
asoc-runtime-pm-fix-v2
Open

Asoc runtime pm fix v2#18
nandamajay wants to merge 4 commits intomasterfrom
asoc-runtime-pm-fix-v2

Conversation

@nandamajay
Copy link
Copy Markdown
Owner

This PR introduces runtime PM suspend/resume handling across LPASS pinctrl and ASoC macro codec drivers to ensure clocks are properly gated when devices are idle and re‑enabled in a defined order on resume.
The changes improve power management correctness for platforms using LPASS LPI island mode and prevent unnecessary clock votes during idle periods.

}
EXPORT_SYMBOL_GPL(lpi_pinctrl_remove);

int lpi_pinctrl_runtime_suspend(struct device *dev)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no device-specific action required in runtime suspend/resume. Runtime PM with PM clocks works correctly without explicit callbacks, so these hooks were removed.

So both runtime_suspend/resume both removed

pm_runtime_set_autosuspend_delay(dev, 100);
pm_runtime_use_autosuspend(dev);
pm_runtime_enable(dev);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we addding this here?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acknowledged

ret = lpi_gpio_read(state, offset, LPI_GPIO_CFG_REG, &ctl_reg);
if (ret) {
seq_printf(s, " %-8s: <read error %d>", pindesc.name, ret);
return;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not belong to this patch?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK, Made into a seperate patch

ret = lpi_gpio_read(state, pin, LPI_GPIO_VALUE_REG, &val);
if (ret)
return ret;
return val & LPI_GPIO_VALUE_IN_MASK;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated changes in this patch, please separate such changes.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK, kept as seperate patch

*val = ioread32(state->tlmm_base + pin_offset + addr);

pm_runtime_mark_last_busy(state->dev);
pm_runtime_put_autosuspend(state->dev);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you need a put?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, We need the put_autosuspend() to balance pm_runtime_resume_and_get(). Otherwise the runtime PM reference is leaked and the device will remain permanently active, preventing autosuspend and runtime suspend callbacks from running.

Ajay Kumar Nandam added 4 commits April 9, 2026 08:53
…me PM

Convert the LPASS WSA macro codec driver to use the PM clock framework
for runtime power management.

The driver now relies on pm_clk helpers and runtime PM instead of
manually enabling and disabling macro, dcodec, mclk, npl, and fsgen
clocks. Runtime suspend and resume handling is delegated to the PM
core via pm_clk_suspend() and pm_clk_resume(), while existing runtime
PM callbacks continue to manage regcache state.

This ensures clocks are enabled only when the WSA macro is active,
improves power efficiency on LPASS platforms supporting LPI/island
modes, and aligns the driver with common ASoC runtime PM patterns used
across Qualcomm LPASS codec drivers.

Signed-off-by: Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com>
…e PM

Convert the LPASS VA macro codec driver to use the PM clock framework
for runtime power management.

The driver now relies on pm_clk helpers and runtime PM instead of
manually enabling and disabling macro, dcodec, mclk, and npl clocks.
All clock control during runtime suspend and resume is delegated to
the PM core via pm_clk_suspend() and pm_clk_resume().

This change ensures clocks are only enabled when the VA macro is
active, improves power efficiency on LPASS platforms supporting
LPI/island modes, and aligns the driver with common ASoC runtime PM
patterns used across Qualcomm LPASS codec drivers.

Signed-off-by: Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com>
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.

Signed-off-by: Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com>
Refactor the LPI GPIO register access helpers to propagate read/write
errors to callers instead of silently returning invalid values.

Update all call sites to handle error returns and improve debugfs output
by reporting register read failures explicitly.

This improves robustness and debuggability without changing intended
GPIO functionality.

Signed-off-by: Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com>
@nandamajay nandamajay force-pushed the asoc-runtime-pm-fix-v2 branch from 0a5973a to b38abe2 Compare April 9, 2026 03:51
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