Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: stm32: sai: add pm_runtime support

Enable support of pm_runtime on STM32 SAI driver to allow
SAI power state monitoring.
pm_runtime_put_autosuspend() is called from ASoC framework
on pcm device close.
The pmdown_time delay is available in runtime context, and may be set
in SAI driver to take into account shutdown delay on playback.
However, this shutdown delay is already handled in the DAPMs
of the audio codec linked to SAI CPU DAI.
So, the choice is made, not to support this delay on CPU DAI side.

Signed-off-by: Olivier Moysan <olivier.moysan@st.com>
Link: https://lore.kernel.org/r/20200911081507.7276-1-olivier.moysan@st.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Olivier Moysan and committed by
Mark Brown
4e723e75 375e2c35

+8 -2
+8 -2
sound/soc/stm/stm32_sai_sub.c
··· 12 12 #include <linux/module.h> 13 13 #include <linux/of_irq.h> 14 14 #include <linux/of_platform.h> 15 + #include <linux/pm_runtime.h> 15 16 #include <linux/regmap.h> 16 17 17 18 #include <sound/asoundef.h> ··· 1560 1559 1561 1560 ret = snd_soc_register_component(&pdev->dev, &stm32_component, 1562 1561 &sai->cpu_dai_drv, 1); 1563 - if (ret) 1562 + if (ret) { 1564 1563 snd_dmaengine_pcm_unregister(&pdev->dev); 1564 + return ret; 1565 + } 1565 1566 1566 - return ret; 1567 + pm_runtime_enable(&pdev->dev); 1568 + 1569 + return 0; 1567 1570 } 1568 1571 1569 1572 static int stm32_sai_sub_remove(struct platform_device *pdev) ··· 1577 1572 clk_unprepare(sai->pdata->pclk); 1578 1573 snd_dmaengine_pcm_unregister(&pdev->dev); 1579 1574 snd_soc_unregister_component(&pdev->dev); 1575 + pm_runtime_disable(&pdev->dev); 1580 1576 1581 1577 return 0; 1582 1578 }