summaryrefslogtreecommitdiff
path: root/sound/soc/fsl/imx-pcm-rpmsg.c
diff options
context:
space:
mode:
authorShengjiu Wang <shengjiu.wang@nxp.com>2018-11-08 15:15:42 +0800
committerDong Aisheng <aisheng.dong@nxp.com>2019-11-25 15:53:12 +0800
commitcabb2debdc7e290dc09d7c41b55cfe43336cce13 (patch)
treedae094187265d03b39f71fbefb4eed2e99c4c4cf /sound/soc/fsl/imx-pcm-rpmsg.c
parent783c56a330e020e5d31add27034ed51a51605acd (diff)
MLK-20277-3: ASoC: imx-pcm-rpmsg: change the state of substream in resume
In LPA mode, the system will be resumed by audio notification, when the period size is small, there will be occasion that when notification the underrun is happen, but the substream runtime state is not running so the aplay won't trigger stop first, then start. just only trigger the start, which don't comply with the convention. So in this patch, we change the substream runtime state to running, when the notification happened at resume. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Diffstat (limited to 'sound/soc/fsl/imx-pcm-rpmsg.c')
-rw-r--r--sound/soc/fsl/imx-pcm-rpmsg.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/sound/soc/fsl/imx-pcm-rpmsg.c b/sound/soc/fsl/imx-pcm-rpmsg.c
index f492e009399d..440f0777e95e 100644
--- a/sound/soc/fsl/imx-pcm-rpmsg.c
+++ b/sound/soc/fsl/imx-pcm-rpmsg.c
@@ -282,6 +282,7 @@ static void imx_rpmsg_pcm_dma_complete(void *arg)
{
struct snd_pcm_substream *substream = arg;
struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct fsl_rpmsg_i2s *rpmsg_i2s = dev_get_drvdata(cpu_dai->dev);
struct i2s_info *i2s_info = &rpmsg_i2s->i2s_info;
@@ -301,14 +302,20 @@ static void imx_rpmsg_pcm_dma_complete(void *arg)
/*
* With suspend state, which is not running state, M4 will trigger
* system resume with PERIOD_DONE command, at this moment, the
- * snd_pcm_period_elapsed can't update the hw ptr. so call
- * snd_pcm_update_hw_ptr directly for this special case.
+ * snd_pcm_period_elapsed can't update the hw ptr. so change the
+ * state to be running and update timer
*
*/
- if (!snd_pcm_running(substream) && rpmsg_i2s->force_lpa)
- snd_pcm_update_hw_ptr(substream);
- else
- snd_pcm_period_elapsed(substream);
+ if (!snd_pcm_running(substream) && rpmsg_i2s->force_lpa) {
+ int time_msec;
+
+ substream->runtime->status->state = SNDRV_PCM_STATE_RUNNING;
+ time_msec = min(500,
+ (int)(runtime->period_size*1000/runtime->rate));
+ mod_timer(&i2s_info->stream_timer[substream->stream],
+ jiffies + msecs_to_jiffies(time_msec));
+ }
+ snd_pcm_period_elapsed(substream);
}
static int imx_rpmsg_pcm_prepare_and_submit(struct snd_pcm_substream *substream)
@@ -491,7 +498,6 @@ int imx_rpmsg_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
struct fsl_rpmsg_i2s *rpmsg_i2s = dev_get_drvdata(cpu_dai->dev);
struct i2s_info *i2s_info = &rpmsg_i2s->i2s_info;
int ret;
- int time_msec;
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
@@ -501,13 +507,8 @@ int imx_rpmsg_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
imx_rpmsg_async_issue_pending(substream);
break;
case SNDRV_PCM_TRIGGER_RESUME:
- if (rpmsg_i2s->force_lpa) {
- time_msec = min(500,
- (int)(runtime->period_size*1000/runtime->rate));
- mod_timer(&i2s_info->stream_timer[substream->stream],
- jiffies + msecs_to_jiffies(time_msec));
+ if (rpmsg_i2s->force_lpa)
break;
- }
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
imx_rpmsg_restart(substream);
break;