]> git.itanic.dy.fi Git - linux-stable/commit
ASoC: meson: axg-tdm-formatter: fix channel slot allocation
authorJerome Brunet <jbrunet@baylibre.com>
Wed, 9 Aug 2023 17:19:31 +0000 (19:19 +0200)
committerMark Brown <broonie@kernel.org>
Wed, 9 Aug 2023 23:22:55 +0000 (00:22 +0100)
commitc1f848f12103920ca165758aedb1c10904e193e1
treef2796f02af85af871792381baee7db530721b562
parente6475ce253187d2e68867102fddd57341ebbf8eb
ASoC: meson: axg-tdm-formatter: fix channel slot allocation

When the tdm lane mask is computed, the driver currently fills the 1st lane
before moving on to the next. If the stream has less channels than the
lanes can accommodate, slots will be disabled on the last lanes.

Unfortunately, the HW distribute channels in a different way. It distribute
channels in pair on each lanes before moving on the next slots.

This difference leads to problems if a device has an interface with more
than 1 lane and with more than 2 slots per lane.

For example: a playback interface with 2 lanes and 4 slots each (total 8
slots - zero based numbering)
- Playing a 8ch stream:
  - All slots activated by the driver
  - channel #2 will be played on lane #1 - slot #0 following HW placement
- Playing a 4ch stream:
  - Lane #1 disabled by the driver
  - channel #2 will be played on lane #0 - slot #2

This behaviour is obviously not desirable.

Change the way slots are activated on the TDM lanes to follow what the HW
does and make sure each channel always get mapped to the same slot/lane.

Fixes: 1a11d88f499c ("ASoC: meson: add tdm formatter base driver")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/20230809171931.1244502-1-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/meson/axg-tdm-formatter.c