summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShengjiu Wang <shengjiu.wang@nxp.com>2019-08-28 13:20:17 -0400
committerMark Brown <broonie@kernel.org>2019-08-29 15:14:11 -0400
commit696d05225cebffd172008d212657be90e823eac0 (patch)
treea1faf374f9c9c50c8790910c22fa4ce4ec108cf5
parentd2ac1fe0342ce2b44621f60d053800e2d94f1d21 (diff)
ASoC: fsl_ssi: Fix clock control issue in master mode
The test case is arecord -Dhw:0 -d 10 -f S16_LE -r 48000 -c 2 temp.wav & aplay -Dhw:0 -d 30 -f S16_LE -r 48000 -c 2 test.wav There will be error after end of arecord: aplay: pcm_write:2051: write error: Input/output error Capture and Playback work in parallel in master mode, one substream stops, the other substream is impacted, the reason is that clock is disabled wrongly. The clock's reference count is not increased when second substream starts, the hw_param() function returns in the beginning because first substream is enabled, then in end of first substream, the hw_free() disables the clock. This patch is to move the clock enablement to the place before checking of the device enablement in hw_param(). Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Link: https://lore.kernel.org/r/1567012817-12625-1-git-send-email-shengjiu.wang@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/fsl/fsl_ssi.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index fa862af25c1a..085855f9b08d 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -799,15 +799,6 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream,
799 u32 wl = SSI_SxCCR_WL(sample_size); 799 u32 wl = SSI_SxCCR_WL(sample_size);
800 int ret; 800 int ret;
801 801
802 /*
803 * SSI is properly configured if it is enabled and running in
804 * the synchronous mode; Note that AC97 mode is an exception
805 * that should set separate configurations for STCCR and SRCCR
806 * despite running in the synchronous mode.
807 */
808 if (ssi->streams && ssi->synchronous)
809 return 0;
810
811 if (fsl_ssi_is_i2s_master(ssi)) { 802 if (fsl_ssi_is_i2s_master(ssi)) {
812 ret = fsl_ssi_set_bclk(substream, dai, hw_params); 803 ret = fsl_ssi_set_bclk(substream, dai, hw_params);
813 if (ret) 804 if (ret)
@@ -823,6 +814,15 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream,
823 } 814 }
824 } 815 }
825 816
817 /*
818 * SSI is properly configured if it is enabled and running in
819 * the synchronous mode; Note that AC97 mode is an exception
820 * that should set separate configurations for STCCR and SRCCR
821 * despite running in the synchronous mode.
822 */
823 if (ssi->streams && ssi->synchronous)
824 return 0;
825
826 if (!fsl_ssi_is_ac97(ssi)) { 826 if (!fsl_ssi_is_ac97(ssi)) {
827 /* 827 /*
828 * Keep the ssi->i2s_net intact while having a local variable 828 * Keep the ssi->i2s_net intact while having a local variable