OSDN Git Service

ASoC: mchp-i2s-mcc: Fix simultaneous capture and playback in master mode
authorCodrin Ciubotariu <codrin.ciubotariu@microchip.com>
Tue, 20 Aug 2019 16:24:11 +0000 (19:24 +0300)
committerMark Brown <broonie@kernel.org>
Tue, 20 Aug 2019 17:39:46 +0000 (18:39 +0100)
commitc9cff337eab394c4dc8b128dde7308a1dd2e653a
treeb5a16c15ab52b337f53fd27927ec3212c6a912f9
parentbbf9a127abca4aac5cc75f882bc7efcc398e86ae
ASoC: mchp-i2s-mcc: Fix simultaneous capture and playback in master mode

This controller supports capture and playback running at the same time,
with the limitation that both capture and playback must be configured the
same way (sample rate, sample format, number of channels, etc). For this,
we have to assure that the configuration registers look the same when
capture and playback are initiated.
This patch fixes a bug in which the controller is in master mode and the
hw_params() callback fails for the second audio stream. The fail occurs
because the divisors are calculated after comparing the configuration
registers for capture and playback. The fix consists in calculating the
divisors before comparing the configuration registers. BCLK and LRC are
then configured and started only if the controller is not already running.

Fixes: 7e0cdf545a55 ("ASoC: mchp-i2s-mcc: add driver for I2SC Multi-Channel Controller")
Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Link: https://lore.kernel.org/r/20190820162411.24836-4-codrin.ciubotariu@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/atmel/mchp-i2s-mcc.c