aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Jackson <Andrew.Jackson@arm.com>2014-12-19 11:18:05 -0500
committerMark Brown <broonie@kernel.org>2014-12-22 10:05:54 -0500
commit3475c3d034d7f276a474c8bd53f44b48c8bf669d (patch)
tree97657a04139c460ae8785d09a33b3d71a6a99514
parent97bf6af1f928216fd6c5a66e8a57bfa95a659672 (diff)
ASoC: dwc: Ensure FIFOs are flushed to prevent channel swap
Flush the FIFOs when the stream is prepared for use. This avoids an inadvertent swapping of the left/right channels if the FIFOs are not empty at startup. Signed-off-by: Andrew Jackson <Andrew.Jackson@arm.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
-rw-r--r--sound/soc/dwc/designware_i2s.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sound/soc/dwc/designware_i2s.c b/sound/soc/dwc/designware_i2s.c
index b93168d4f648..4df19b57429c 100644
--- a/sound/soc/dwc/designware_i2s.c
+++ b/sound/soc/dwc/designware_i2s.c
@@ -263,6 +263,19 @@ static void dw_i2s_shutdown(struct snd_pcm_substream *substream,
263 snd_soc_dai_set_dma_data(dai, substream, NULL); 263 snd_soc_dai_set_dma_data(dai, substream, NULL);
264} 264}
265 265
266static int dw_i2s_prepare(struct snd_pcm_substream *substream,
267 struct snd_soc_dai *dai)
268{
269 struct dw_i2s_dev *dev = snd_soc_dai_get_drvdata(dai);
270
271 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
272 i2s_write_reg(dev->i2s_base, TXFFR, 1);
273 else
274 i2s_write_reg(dev->i2s_base, RXFFR, 1);
275
276 return 0;
277}
278
266static int dw_i2s_trigger(struct snd_pcm_substream *substream, 279static int dw_i2s_trigger(struct snd_pcm_substream *substream,
267 int cmd, struct snd_soc_dai *dai) 280 int cmd, struct snd_soc_dai *dai)
268{ 281{
@@ -294,6 +307,7 @@ static struct snd_soc_dai_ops dw_i2s_dai_ops = {
294 .startup = dw_i2s_startup, 307 .startup = dw_i2s_startup,
295 .shutdown = dw_i2s_shutdown, 308 .shutdown = dw_i2s_shutdown,
296 .hw_params = dw_i2s_hw_params, 309 .hw_params = dw_i2s_hw_params,
310 .prepare = dw_i2s_prepare,
297 .trigger = dw_i2s_trigger, 311 .trigger = dw_i2s_trigger,
298}; 312};
299 313