ASoC: meson: axg-tdm-interface: manage formatters in trigger
authorJerome Brunet <jbrunet@baylibre.com>
Wed, 20 Oct 2021 11:42:17 +0000 (13:42 +0200)
committerMark Brown <broonie@kernel.org>
Fri, 22 Oct 2021 12:25:48 +0000 (13:25 +0100)
commitbf5e4887eeddb48480568466536aa08ec7f179a5
tree165f0460859f504c5de7d6d9b1b6bc9333fbed4e
parente138233e56e9829e65b6293887063a1a3ccb2d68
ASoC: meson: axg-tdm-interface: manage formatters in trigger

So far, the formatters have been reset/enabled using the .prepare()
callback. This was done in this callback because walking the formatters use
a mutex so it could not be done in .trigger(), which is atomic by default.

It turns out there is a problem on capture path of the AXG series.
The FIFO may get out of sync with the TDM decoder if the IP are not enabled
in a specific order. The FIFO must be enabled before the formatter starts
producing data. IOW, we must deal with FE before the BE. The .prepare()
callback is called on the BEs before the FE so it is not OK for the AXG.

The .trigger() callback order can be configured, and it deals with the FE
before the BEs by default. To solve our problem, we just need to start and
stop the formatters from the .trigger() callback. It is OK do so now that
the links have been made 'nonatomic' in the card driver.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/20211020114217.133153-3-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/meson/axg-tdm-interface.c