MLK-13992: ASoC: fsl_rpmsg_i2s: add flush workqueue
authorShengjiu Wang <shengjiu.wang@freescale.com>
Fri, 17 Feb 2017 02:09:31 +0000 (10:09 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:10:44 +0000 (15:10 -0500)
some cmd is sent by workqueue, others are sent by call send message
function directly, for workqueue may have delay, so there is occasion
that cmd is not sent in order.
Add flush_workqueue before the CLOSE and SUSPEND to make sure previous
cmd is finished in that time.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
sound/soc/fsl/fsl_rpmsg_i2s.c
sound/soc/fsl/imx-pcm-rpmsg.c

index 172c279..d8f8da8 100644 (file)
@@ -196,6 +196,7 @@ static int fsl_rpmsg_i2s_suspend(struct device *dev)
        struct i2s_rpmsg_s *rpmsg_tx;
        struct i2s_rpmsg_s *rpmsg_rx;
 
+       flush_workqueue(i2s_info->rpmsg_wq);
        rpmsg_tx = &i2s_info->send_msg[SNDRV_PCM_STREAM_PLAYBACK];
        rpmsg_rx = &i2s_info->send_msg[SNDRV_PCM_STREAM_CAPTURE];
 
index 25369cc..ace3bd7 100644 (file)
@@ -149,6 +149,8 @@ static int imx_rpmsg_pcm_close(struct snd_pcm_substream *substream)
                rpmsg->header.cmd = I2S_TX_CLOSE;
        else
                rpmsg->header.cmd = I2S_RX_CLOSE;
+
+       flush_workqueue(i2s_info->rpmsg_wq);
        i2s_info->send_message(rpmsg, i2s_info);
 
        kfree(prtd);