aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/sound/soc/sof/pcm.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/sof/pcm.c')
-rw-r--r--sound/soc/sof/pcm.c44
1 files changed, 13 insertions, 31 deletions
diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c
index 649968841dad..334e9d59b1ba 100644
--- a/sound/soc/sof/pcm.c
+++ b/sound/soc/sof/pcm.c
@@ -211,8 +211,8 @@ static int sof_pcm_hw_params(struct snd_pcm_substream *substream,
/* save pcm hw_params */
memcpy(&spcm->params[substream->stream], params, sizeof(*params));
- INIT_WORK(&spcm->stream[substream->stream].period_elapsed_work,
- sof_pcm_period_elapsed_work);
+ /* clear hw_params_upon_resume flag */
+ spcm->hw_params_upon_resume[substream->stream] = 0;
return ret;
}
@@ -251,6 +251,13 @@ static int sof_pcm_hw_free(struct snd_pcm_substream *substream)
cancel_work_sync(&spcm->stream[substream->stream].period_elapsed_work);
+ if (ret < 0)
+ return ret;
+
+ ret = snd_sof_pcm_platform_hw_free(sdev, substream);
+ if (ret < 0)
+ dev_err(sdev->dev, "error: platform hw free failed\n");
+
return ret;
}
@@ -416,7 +423,6 @@ static int sof_pcm_open(struct snd_pcm_substream *substream)
struct snd_sof_pcm *spcm;
struct snd_soc_tplg_stream_caps *caps;
int ret;
- int err;
/* nothing to do for BE */
if (rtd->dai_link->no_pcm)
@@ -429,19 +435,11 @@ static int sof_pcm_open(struct snd_pcm_substream *substream)
dev_dbg(sdev->dev, "pcm: open stream %d dir %d\n", spcm->pcm.pcm_id,
substream->stream);
- /* clear hw_params_upon_resume flag */
- spcm->hw_params_upon_resume[substream->stream] = 0;
+ INIT_WORK(&spcm->stream[substream->stream].period_elapsed_work,
+ sof_pcm_period_elapsed_work);
caps = &spcm->pcm.caps[substream->stream];
- ret = pm_runtime_get_sync(sdev->dev);
- if (ret < 0) {
- dev_err(sdev->dev, "error: pcm open failed to resume %d\n",
- ret);
- pm_runtime_put_noidle(sdev->dev);
- return ret;
- }
-
/* set any runtime constraints based on topology */
snd_pcm_hw_constraint_step(substream->runtime, 0,
SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
@@ -485,17 +483,8 @@ static int sof_pcm_open(struct snd_pcm_substream *substream)
spcm->stream[substream->stream].substream = substream;
ret = snd_sof_pcm_platform_open(sdev, substream);
- if (ret < 0) {
- dev_err(sdev->dev, "error: pcm open failed %d\n",
- ret);
-
- pm_runtime_mark_last_busy(sdev->dev);
-
- err = pm_runtime_put_autosuspend(sdev->dev);
- if (err < 0)
- dev_err(sdev->dev, "error: pcm close failed to idle %d\n",
- err);
- }
+ if (ret < 0)
+ dev_err(sdev->dev, "error: pcm open failed %d\n", ret);
return ret;
}
@@ -530,13 +519,6 @@ static int sof_pcm_close(struct snd_pcm_substream *substream)
*/
}
- pm_runtime_mark_last_busy(sdev->dev);
-
- err = pm_runtime_put_autosuspend(sdev->dev);
- if (err < 0)
- dev_err(sdev->dev, "error: pcm close failed to idle %d\n",
- err);
-
return 0;
}