From a23d1df081f1ed33bc8dc7fffc42d1dfa3db2366 Mon Sep 17 00:00:00 2001 From: Shengjiu Wang <shengjiu.wang@nxp.com> Date: Thu, 7 Mar 2019 11:09:17 +0800 Subject: [PATCH] MLK-21107-1: ASoC: Fix timer wake up system after suspend Fixes commit 4028bd0f76fd ("MLK-21002-2: ASoC: imx-pcm-rpmsg: don't remove timer at suspend") if the timer isn't removed at suspend, there will be interrupt from M4 side when the period size is small to wake up system quickly So we need to revert the previous fix and add timer in resume state Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> --- sound/soc/fsl/imx-pcm-rpmsg.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sound/soc/fsl/imx-pcm-rpmsg.c b/sound/soc/fsl/imx-pcm-rpmsg.c index 934284433155c..c61dc98dd3353 100644 --- a/sound/soc/fsl/imx-pcm-rpmsg.c +++ b/sound/soc/fsl/imx-pcm-rpmsg.c @@ -494,6 +494,7 @@ int imx_rpmsg_pcm_trigger(struct snd_pcm_substream *substream, int cmd) struct snd_soc_pcm_runtime *rtd = substream->private_data; 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; int ret; switch (cmd) { @@ -504,8 +505,14 @@ 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) + if (rpmsg_i2s->force_lpa) { + int time_msec; + + time_msec = (int)(runtime->period_size*1000/runtime->rate); + mod_timer(&i2s_info->stream_timer[substream->stream], + jiffies + msecs_to_jiffies(time_msec)); break; + } case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: imx_rpmsg_restart(substream); break; @@ -515,7 +522,8 @@ int imx_rpmsg_pcm_trigger(struct snd_pcm_substream *substream, int cmd) imx_rpmsg_pause(substream); else imx_rpmsg_terminate_all(substream); - } + } else + del_timer(&i2s_info->stream_timer[substream->stream]); break; case SNDRV_PCM_TRIGGER_PAUSE_PUSH: imx_rpmsg_pause(substream); -- GitLab