summaryrefslogtreecommitdiff
path: root/sound/soc/sof
diff options
context:
space:
mode:
authorDaniel Baluta <daniel.baluta@nxp.com>2020-06-11 16:43:16 +0300
committerDaniel Baluta <daniel.baluta@nxp.com>2020-06-11 16:50:22 +0300
commit89d64ed05dabd5f96f7f3d9ef70f81e816f3feaa (patch)
treefac8f8a982cb8e0992cd0b323a0646372a992118 /sound/soc/sof
parentf7b437ebaa48611ff54893e61aa3ca88eb2360c4 (diff)
MLK-24263-8 ASoC: SOF: Add support for system / runtime PM on i.MX8
Similar with commit a4c2646bc92 ("MLK-24263-5 ASoC: SOF: Add support for system / runtime PM") this adds the system/runtime PM handlers. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Diffstat (limited to 'sound/soc/sof')
-rw-r--r--sound/soc/sof/imx/imx8.c55
1 files changed, 51 insertions, 4 deletions
diff --git a/sound/soc/sof/imx/imx8.c b/sound/soc/sof/imx/imx8.c
index 080da33ff5ba..f6d934f8358e 100644
--- a/sound/soc/sof/imx/imx8.c
+++ b/sound/soc/sof/imx/imx8.c
@@ -42,6 +42,7 @@
struct imx8_priv {
struct device *dev;
struct snd_sof_dev *sdev;
+ bool suspended;
/* DSP IPC handler */
struct imx_dsp_ipc *dsp_ipc;
@@ -378,18 +379,64 @@ static int imx8_ipc_pcm_params(struct snd_sof_dev *sdev,
return 0;
}
+int imx8_resume(struct snd_sof_dev *sdev)
+{
+ struct imx8_priv *priv = (struct imx8_priv *)sdev->private;
+ int i;
+
+ for (i = 0; i < DSP_MU_CHAN_NUM; i++)
+ imx_dsp_request_channel(priv->dsp_ipc, i);
+
+ return 0;
+}
+
+int imx8_suspend(struct snd_sof_dev *sdev)
+{
+ struct imx8_priv *priv = (struct imx8_priv *)sdev->private;
+ int i;
+
+ for (i = 0; i < DSP_MU_CHAN_NUM; i++)
+ imx_dsp_free_channel(priv->dsp_ipc, i);
+
+ return 0;
+}
+
+int imx8_dsp_runtime_resume(struct snd_sof_dev *sdev)
+{
+ return imx8_resume(sdev);
+}
+
+int imx8_dsp_runtime_suspend(struct snd_sof_dev *sdev)
+{
+
+ return imx8_suspend(sdev);
+}
+
int imx8_dsp_resume(struct snd_sof_dev *sdev)
{
- /* nothing to do for now */
+ struct imx8_priv *priv = (struct imx8_priv *)sdev->private;
+
+ if (priv->suspended) {
+ imx8_resume(sdev);
+ priv->suspended = false;
+ }
+
return 0;
}
int imx8_dsp_suspend(struct snd_sof_dev *sdev)
{
- /* nothing to do for now */
+ struct imx8_priv *priv = (struct imx8_priv *)sdev->private;
+
+ if (!priv->suspended) {
+ imx8_suspend(sdev);
+ priv->suspended = true;
+ }
+
return 0;
}
+
static struct snd_soc_dai_driver imx8_dai[] = {
{
.name = "esai-port",
@@ -430,8 +477,8 @@ struct snd_sof_dsp_ops sof_imx8_ops = {
/* PM */
.suspend = imx8_dsp_suspend,
.resume = imx8_dsp_resume,
- .runtime_suspend = imx8_dsp_suspend,
- .runtime_resume = imx8_dsp_resume,
+ .runtime_suspend = imx8_dsp_runtime_suspend,
+ .runtime_resume = imx8_dsp_runtime_resume,
/* ALSA HW info flags */
.hw_info = SNDRV_PCM_INFO_MMAP |