summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorShengjiu Wang <shengjiu.wang@nxp.com>2019-07-29 14:33:08 +0800
committerShengjiu Wang <shengjiu.wang@nxp.com>2019-08-07 11:03:54 +0800
commitbabbc2cd8313fb5cf604b5ca93a86200df0e46b2 (patch)
treeb455f03bbfd380353a3227b25da05c2b7a8a785f /sound
parentc4bd981ca2ca28dc2c4b90c6a399876148f0d779 (diff)
MLK-22340-2: ASoC: imx-pcm-rpmsg: drop the cmd I2S_TX_POINTER
There is error log for short period size: [ 6977.102062] i2s_rpmsg virtio0.rpmsg-audio-channel.-1.1: rpmsg_send cmd 22 timeout! We use the I2S_TX_POINTER(cmd 22) to get the consumed period index from M4 every period time, and m4 should send feedback to A53. When the period time is small, there will too much cmd send to m4, m4 may not handle it quickly that cause timeout. This patch is to remove the I2S_TX_POINTER cmd, m4 should send notification to A53 every period time to be compatible with this change. with the patch the loading of this rpmsg channel is reduced. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/fsl/imx-pcm-rpmsg.c29
1 files changed, 7 insertions, 22 deletions
diff --git a/sound/soc/fsl/imx-pcm-rpmsg.c b/sound/soc/fsl/imx-pcm-rpmsg.c
index 39b9b62e8303..adcb90f86410 100644
--- a/sound/soc/fsl/imx-pcm-rpmsg.c
+++ b/sound/soc/fsl/imx-pcm-rpmsg.c
@@ -107,12 +107,11 @@ static snd_pcm_uframes_t imx_rpmsg_pcm_pointer(
int buffer_tail = 0;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
- rpmsg = &i2s_info->rpmsg[I2S_TX_POINTER];
+ rpmsg = &i2s_info->rpmsg[I2S_TX_PERIOD_DONE + I2S_TYPE_A_NUM];
else
- rpmsg = &i2s_info->rpmsg[I2S_RX_POINTER];
+ rpmsg = &i2s_info->rpmsg[I2S_RX_PERIOD_DONE + I2S_TYPE_A_NUM];
- buffer_tail = rpmsg->recv_msg.param.buffer_offset /
- snd_pcm_lib_period_bytes(substream);
+ buffer_tail = rpmsg->recv_msg.param.buffer_tail;
pos = buffer_tail * snd_pcm_lib_period_bytes(substream);
return bytes_to_frames(substream->runtime, pos);
@@ -131,14 +130,14 @@ static void imx_rpmsg_timer_callback(unsigned long data)
int time_msec;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
- rpmsg = &i2s_info->rpmsg[I2S_TX_POINTER];
+ rpmsg = &i2s_info->rpmsg[I2S_TX_PERIOD_DONE + I2S_TYPE_A_NUM];
else
- rpmsg = &i2s_info->rpmsg[I2S_RX_POINTER];
+ rpmsg = &i2s_info->rpmsg[I2S_RX_PERIOD_DONE + I2S_TYPE_A_NUM];
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
- rpmsg->send_msg.header.cmd = I2S_TX_POINTER;
+ rpmsg->send_msg.header.cmd = I2S_TX_PERIOD_DONE;
else
- rpmsg->send_msg.header.cmd = I2S_RX_POINTER;
+ rpmsg->send_msg.header.cmd = I2S_RX_PERIOD_DONE;
if (i2s_info->work_write_index != i2s_info->work_read_index) {
memcpy(&i2s_info->work_list[index].msg, rpmsg,
@@ -154,8 +153,6 @@ static void imx_rpmsg_timer_callback(unsigned long data)
mod_timer(&i2s_info->stream_timer[substream->stream],
jiffies + msecs_to_jiffies(time_msec));
}
-
- snd_pcm_period_elapsed(substream);
}
static int imx_rpmsg_pcm_open(struct snd_pcm_substream *substream)
@@ -294,19 +291,7 @@ static void imx_rpmsg_pcm_dma_complete(void *arg)
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;
- struct i2s_rpmsg *rpmsg, *rpmsg2;
-
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
- rpmsg = &i2s_info->rpmsg[I2S_TX_POINTER];
- rpmsg2 = &i2s_info->rpmsg[I2S_TX_PERIOD_DONE + I2S_TYPE_A_NUM];
- } else {
- rpmsg = &i2s_info->rpmsg[I2S_RX_POINTER];
- rpmsg2 = &i2s_info->rpmsg[I2S_RX_PERIOD_DONE + I2S_TYPE_A_NUM];
- }
- rpmsg->recv_msg.param.buffer_offset =
- rpmsg2->recv_msg.param.buffer_tail
- * snd_pcm_lib_period_bytes(substream);
/*
* With suspend state, which is not running state, M4 will trigger
* system resume with PERIOD_DONE command, at this moment, the