Hello,
I am working on bringup of a custom board with a LS1028A and three ADAU1761 codecs. The codecs are supposed to be configured in TDM8 mode and share a common playback I2S bus connected to SAI4, and a common capture I2S bus connected to SAI3.
What is the recommended way of modelling this setup in the Linux device tree ?
So far I have tried the following:
&i2c0 {
status = "okay";
i2c_codec1: adau1761@38 {
compatible = "adi,adau1761";
#sound-dai-cells=<0>;
reg = <0x38>;
tdm-offset = <0>;
clocks = <&adau1761_mclk>;
clock-names = "mclk";
};
i2c_codec2: adau1761@39 {
compatible = "adi,adau1761";
#sound-dai-cells=<0>;
reg = <0x39>;
tdm-offset = <16>;
clocks = <&adau1761_mclk>;
clock-names = "mclk";
};
i2c_codec3: adau1761@3a {
compatible = "adi,adau1761";
#sound-dai-cells=<0>;
reg = <0x3a>;
tdm-offset = <32>;
clocks = <&adau1761_mclk>;
clock-names = "mclk";
};
};
At first I attempted creating three simple-audio-card's. That attempted failed since sharing the same cpu (SAI3 and SAI4) failed with no ALSA device as a result.
Then I attempted cerating a single simple-audio-card with a dai-link containing two cpu sub-nodes and three codec sub-nodes. ALSA enumerates this device, and I get the expected ADAU1761 controls for a single codec. But how do I get the two other sets of ADAU1761 controls? And how do I do the widgets and routing for this ?
Note: The widgets and routing below is just experimental.
sound {
status = "okay";
compatible = "simple-audio-card";
simple-audio-card,format = "i2s";
simple-audio-card,widgets =
"Headphone", "O1 Headphone",
"Headphone", "O2 Headphone",
"Headphone", "O3 Headphone";
simple-audio-card,routing =
"Playback", "O1 Headphone",
"Playback", "O2 Headphone",
"Playback", "O3 Headphone";
simple-audio-card,dai-link {
format = "i2s";
convert-channels = <8>;
bitclock-master = <&snd_dai_playback>;
frame-master = <&snd_dai_playback>;
snd_dai_capture: cpu@0 {
sound-dai = <&sai3>;
dai-tdm-slot-num = <8>;
dai-tdm-slot-width = <16>;
};
snd_dai_playback: cpu@1 {
sound-dai = <&sai4>;
dai-tdm-slot-num = <8>;
dai-tdm-slot-width = <16>;
};
codec@0 {
sound-dai = <&i2c_codec1>;
frame-master;
bitclock-master;
system-clock-frequency = <25000000>;
};
codec@1 {
sound-dai = <&i2c_codec2>;
system-clock-frequency = <25000000>;
};
codec@2 {
sound-dai = <&i2c_codec3>;
system-clock-frequency = <25000000>;
};
};
};
We don't have a such set up with multiple codecs, so we can suggest you some experiments to work with -
1) As per our understanding either SAI or codec can be the master device for bit clock and frame clock.
So if codec@0 is set as master then SAI (cpu) can’t be set as master it should be slave device.
codec@0 {
sound-dai = <&i2c_codec1>;
frame-master;
bitclock-master;
system-clock-frequency = <25000000>;
};
bitclock-master = <&snd_dai_playback>;
frame-master = <&snd_dai_playback>;
Your block diagram depicts U54 Codec #3 as the master, so make sure you populate these values correctly.
2) Can you also try with multiple dai-link nodes, one for each codec I am referring to Documentation/devicetree/bindings/sound/simple-card.txt, Example #2, where both dai-link@1 and dai-link@2 have same cpu subnode but different codec node.