[PATCH 2/3] ASoC: stm32: dfsdm: add pm_runtime support for audio

From: Olivier Moysan
Date: Thu Nov 18 2021 - 04:03:26 EST


Enable support of pm_runtime on STM32 DFSDM audio driver
to allow power state monitoring.

Signed-off-by: Olivier Moysan <olivier.moysan@xxxxxxxxxxx>
---
sound/soc/stm/stm32_adfsdm.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/sound/soc/stm/stm32_adfsdm.c b/sound/soc/stm/stm32_adfsdm.c
index e6078f50e508..534f96af97c5 100644
--- a/sound/soc/stm/stm32_adfsdm.c
+++ b/sound/soc/stm/stm32_adfsdm.c
@@ -12,7 +12,7 @@
#include <linux/mutex.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
-
+#include <linux/pm_runtime.h>
#include <linux/iio/iio.h>
#include <linux/iio/consumer.h>
#include <linux/iio/adc/stm32-dfsdm-adc.h>
@@ -363,15 +363,20 @@ static int stm32_adfsdm_probe(struct platform_device *pdev)
#endif

ret = snd_soc_add_component(component, NULL, 0);
- if (ret < 0)
+ if (ret < 0) {
dev_err(&pdev->dev, "%s: Failed to register PCM platform\n",
__func__);
+ return ret;
+ }

- return ret;
+ pm_runtime_enable(&pdev->dev);
+
+ return 0;
}

static int stm32_adfsdm_remove(struct platform_device *pdev)
{
+ pm_runtime_disable(&pdev->dev);
snd_soc_unregister_component(&pdev->dev);

return 0;
--
2.17.1