diff options
author | Shengjiu Wang <shengjiu.wang@nxp.com> | 2018-11-08 15:07:13 +0800 |
---|---|---|
committer | Dong Aisheng <aisheng.dong@nxp.com> | 2019-11-25 15:53:10 +0800 |
commit | aa4833ef354c38464e5e85d42645d3bd8f97c8f6 (patch) | |
tree | aa821da71cf844900079b9cd803d3026b5bf152a /sound/soc/fsl/imx-pcm-rpmsg.c | |
parent | 66aea92f46c17f455d72e67ebadaf9768dbc77fe (diff) |
MLK-20277-1: ASoC: imx-pcm-rpmsg: reset the period index at stop
With the case that underrun happened, the aplay will trigger
stop and start, if the period index is not reset at stop, the
counter of period will be wrong
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.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sound/soc/fsl/imx-pcm-rpmsg.c b/sound/soc/fsl/imx-pcm-rpmsg.c index a7e4818050b3..f492e009399d 100644 --- a/sound/soc/fsl/imx-pcm-rpmsg.c +++ b/sound/soc/fsl/imx-pcm-rpmsg.c @@ -449,6 +449,7 @@ static int imx_rpmsg_terminate_all(struct snd_pcm_substream *substream) struct i2s_info *i2s_info = &rpmsg_i2s->i2s_info; struct i2s_rpmsg *rpmsg; u8 index = i2s_info->work_index; + int cmd; if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) rpmsg = &i2s_info->rpmsg[I2S_TX_TERMINATE]; @@ -466,6 +467,18 @@ static int imx_rpmsg_terminate_all(struct snd_pcm_substream *substream) i2s_info->work_index++; i2s_info->work_index %= WORK_MAX_NUM; + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + cmd = I2S_TX_PERIOD_DONE + I2S_TYPE_A_NUM; + i2s_info->rpmsg[cmd].send_msg.param.buffer_tail = 0; + i2s_info->rpmsg[cmd].recv_msg.param.buffer_tail = 0; + i2s_info->rpmsg[I2S_TX_POINTER].recv_msg.param.buffer_offset = 0; + } else { + cmd = I2S_RX_PERIOD_DONE + I2S_TYPE_A_NUM; + i2s_info->rpmsg[cmd].send_msg.param.buffer_tail = 0; + i2s_info->rpmsg[cmd].recv_msg.param.buffer_tail = 0; + i2s_info->rpmsg[I2S_RX_POINTER].recv_msg.param.buffer_offset = 0; + } + del_timer(&i2s_info->stream_timer[substream->stream]); return 0; } |