Skip to contentSkip to conversation

Variable mclk-fs in ASoC audio cards?

DISCUSSION John Watts 1 participant 1 message Mar 22, 2024

lore
Share & tools
lore

John Watts

author
#0 lore raw

Greetings fellow ALSAers :)

Over the past month I have been working on a driver for the 8-channel TDM CS5368 audio codec. However I've run in to an interesting snag that seems to be an open problem. Let me explain.

The audio codec generally runs at 8 channels of 32-bit data, so:
MCLK = BCLK = LRCK * 256

However it is possible to read 4 or 2 channels instead:
MCLK = BCLK = LRCK * 128
MCLK = BCLK = LRCK * 64

This trade-off allows avoiding high frequency clocking at the expense of a reduced channel count.

Quoted 1 line

From what I current see the way to indicate the multiplier here is using

mclk-fs in the device tree, but this would mean effectively fixing the channel count in the device tree.

I have searched around found someone has suggested mapping mclk-fs to rates here:
https://lore.kernel.org/all/CAEnQRZDpJu27_pB=-ZYQjsNPC8eA4-Ur-36niT2hCosMWtC7jw@mail.gmail.com/T/#u

This functionality is somewhat adjacent to it, but I was wondering if it would be better to somehow factor dai-tdm-slot-* in to mclk-fs calculation.

Perhaps mclk-fs could be divided by dai-tdm-slot-num then multiplied by slots?

Has anyone hit this problem before? How did you solve it?

John.