Commit 348d47695622c6675a0182d8f1a0fed437e38354
1 parent
d1222a0e5f
Exists in
smarc_8mm_imx_4.14.98_2.0.0_ga
and in
4 other branches
MLK-21307: ASoC: fsl_rpmsg_i2s: optimize the message sent to m4
M4 complain that there are two much period done message sent to m4, that M4 don't have enough time to handle these messages. The solution for this issue is to reduce the number of period done message. We allocate a specific memory for period done message, every time there is period done coming, it will be writed to this memory, not write it directly to the work queue, that queue will not be overflow, and the old period done message will be overwrited. In the rpmsg_i2s_work, we first check if there is period done message, then send it first, after that, send the command in queue. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com> (cherry picked from commit caabdfa176453cc7c8d6521f7865a670a7265a18)
Showing 3 changed files with 15 additions and 10 deletions Side-by-side Diff
sound/soc/fsl/fsl_rpmsg_i2s.c
... | ... | @@ -148,6 +148,16 @@ |
148 | 148 | work_of_rpmsg = container_of(work, struct work_of_rpmsg, work); |
149 | 149 | i2s_info = work_of_rpmsg->i2s_info; |
150 | 150 | |
151 | + if (i2s_info->period_done_msg_enabled[0]) { | |
152 | + i2s_send_message(&i2s_info->period_done_msg[0], i2s_info); | |
153 | + i2s_info->period_done_msg_enabled[0] = false; | |
154 | + } | |
155 | + | |
156 | + if (i2s_info->period_done_msg_enabled[1]) { | |
157 | + i2s_send_message(&i2s_info->period_done_msg[1], i2s_info); | |
158 | + i2s_info->period_done_msg_enabled[1] = false; | |
159 | + } | |
160 | + | |
151 | 161 | i2s_send_message(&work_of_rpmsg->msg, i2s_info); |
152 | 162 | |
153 | 163 | i2s_info->work_read_index++; |
sound/soc/fsl/fsl_rpmsg_i2s.h
... | ... | @@ -394,6 +394,8 @@ |
394 | 394 | struct i2s_rpmsg_r recv_msg; |
395 | 395 | |
396 | 396 | struct i2s_rpmsg rpmsg[I2S_CMD_MAX_NUM]; |
397 | + struct i2s_rpmsg period_done_msg[2]; | |
398 | + bool period_done_msg_enabled[2]; | |
397 | 399 | |
398 | 400 | struct workqueue_struct *rpmsg_wq; |
399 | 401 | struct work_of_rpmsg work_list[WORK_MAX_NUM]; |
sound/soc/fsl/imx-pcm-rpmsg.c
... | ... | @@ -577,7 +577,6 @@ |
577 | 577 | struct fsl_rpmsg_i2s *rpmsg_i2s = dev_get_drvdata(cpu_dai->dev); |
578 | 578 | struct i2s_info *i2s_info = &rpmsg_i2s->i2s_info; |
579 | 579 | struct i2s_rpmsg *rpmsg; |
580 | - int index = i2s_info->work_write_index; | |
581 | 580 | int buffer_tail = 0; |
582 | 581 | |
583 | 582 | if (!rpmsg_i2s->force_lpa) |
... | ... | @@ -601,15 +600,9 @@ |
601 | 600 | |
602 | 601 | if (buffer_tail != rpmsg->send_msg.param.buffer_tail) { |
603 | 602 | rpmsg->send_msg.param.buffer_tail = buffer_tail; |
604 | - if (i2s_info->work_write_index != i2s_info->work_read_index) { | |
605 | - memcpy(&i2s_info->work_list[index].msg, rpmsg, | |
606 | - sizeof(struct i2s_rpmsg_s)); | |
607 | - queue_work(i2s_info->rpmsg_wq, | |
608 | - &i2s_info->work_list[index].work); | |
609 | - i2s_info->work_write_index++; | |
610 | - i2s_info->work_write_index %= WORK_MAX_NUM; | |
611 | - } else | |
612 | - i2s_info->msg_drop_count[substream->stream]++; | |
603 | + memcpy(&i2s_info->period_done_msg[substream->stream], rpmsg, | |
604 | + sizeof(struct i2s_rpmsg_s)); | |
605 | + i2s_info->period_done_msg_enabled[substream->stream] = true; | |
613 | 606 | } |
614 | 607 | |
615 | 608 | return 0; |