How to model 3xADAU1761 codec in TDM8 with 2xSAI in ALSA ?

Rolf Peder Klemetsen rpk at systemsoft.no
Mon Mar 9 09:33:42 CET 2020


Hello,

I am working on bringup of a custom board that has three ADAU1761
codecs, and a NXP LS1028A SoC. 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 at 38 {
        compatible = "adi,adau1761";
        #sound-dai-cells=<0>;
        reg = <0x38>;
        tdm-offset = <0>;
        clocks = <&adau1761_mclk>;
        clock-names = "mclk";
    };

    i2c_codec2: adau1761 at 39 {
        compatible = "adi,adau1761";
        #sound-dai-cells=<0>;
        reg = <0x39>;
        tdm-offset = <16>;
        clocks = <&adau1761_mclk>;
        clock-names = "mclk";
    };

    i2c_codec3: adau1761 at 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 creating a single simple-audio-card with two
dai-links (one for playback and one for capture), each containing
three codec sub-nodes.
That doesn't really work either. Can someone please point me in the
right direction?
Many of the parameters that I have put in the dts have no effect and
are assumed not supported.


Regards
Rolf

sound {
        status = "okay";
        model = "Super Sound System";
        compatible = "simple-audio-card";
        simple-audio-card,name = "sound";
        simple-audio-card,format = "i2s";
        simple-audio-card,bitclock-master = <&p_snd_codec_o1>;
        simple-audio-card,frame-master = <&p_snd_codec_o1>;
        simple-audio-card,widgets =
            "Microphone", "Mic In",
            "Headphone", "Headphone Out",
            "Line", "Line In",
            "Line", "Line Out";

        simple-audio-card,routing =
            "Line Out", "LOUT",
            "Line Out", "ROUT",
            "Headphone Out", "LHP",
            "Headphone Out", "RHP",
            "Mic In", "MICBIAS",
            "LINN", "Mic In",
            "RINN", "Mic In",
            "LINP", "Mic In",
            "RINP", "Mic In",
            "LAUX", "Line In",
            "RAUX", "Line In";

        playback_link: simple-audio-card,dai-link at 0 {
            format = "i2s";
            convert-channels = <8>;
            bitclock-master = <&p_snd_codec_o1>;
            frame-master = <&p_snd_codec_o1>;
            name-prefix = "p";

            snd_dai_playback: cpu at 0 {

                cpu-dai-name = "sai4_0";
                sound-dai-name = "sai4_0";


                sound-dai = <&sai4 0>;
                dai-tdm-slot-num = <8>;
                dai-tdm-slot-width = <16>;
                dai-tdm-slot-tx-mask = <1 0 1 0 1 0 0 0>;
                dai-tdm-slot-rx-mask = <0 0 0 0 0 0 0 0>;
            };

            p_snd_codec_o1: codec at 0 {
                sound-dai = <&i2c_codec1>;
                frame-master;
                bitclock-master;
                clocks=<&adau1761_mclk>;
                clock-frequency = <12288000>;
                clock-names = "mclk";
                name-prefix = "c1";
                dai-tdm-slot-tx-mask = <1 0 0 0 0 0 0 0>;
                dai-tdm-slot-rx-mask = <0 0 0 0 0 0 0 0>;
            };

            p_snd_codec_o2: codec at 1 {
                sound-dai = <&i2c_codec2>;
                clocks=<&adau1761_mclk>;
                clock-frequency = <12288000>;
                clock-names = "mclk";
                name-prefix = "c2";
                dai-tdm-slot-tx-mask = <0 0 1 0 0 0 0 0>;
                dai-tdm-slot-rx-mask = <0 0 0 0 0 0 0 0>;
            };
            p_snd_codec_o3: codec at 2 {
                sound-dai = <&i2c_codec3>;
                clocks=<&adau1761_mclk>;
                clock-frequency = <12288000>;
                clock-names = "mclk";
                name-prefix = "c3";
                dai-tdm-slot-tx-mask = <0 0 0 0 1 0 0 0>;
                dai-tdm-slot-rx-mask = <0 0 0 0 0 0 0 0>;
            };


        };

        capture_link: simple-audio-card,dai-link at 1 {
            format = "i2s";
            convert-channels = <8>;
            bitclock-master = <&c_snd_codec_o1>;
            frame-master = <&c_snd_codec_o1>;
            name-prefix = "c";

            snd_dai_capture: cpu at 0 {
                sound-dai = <&sai3>;
                dai-tdm-slot-num = <8>;
                dai-tdm-slot-width = <16>;
                dai-tdm-slot-tx-mask = <0 0 0 0 0 0 0 0>;
                dai-tdm-slot-rx-mask = <0 1 0 1 0 1 0 0>;
            };

            c_snd_codec_o1: codec at 0 {
                sound-dai = <&i2c_codec1>;
                frame-master;
                bitclock-master;
                clocks=<&adau1761_mclk>;
                clock-names = "mclk";
                clock-frequency = <12288000>;
                name-prefix = "c1";
                dai-tdm-slot-tx-mask = <0 0 0 0 0 0 0 0>;
                dai-tdm-slot-rx-mask = <0 1 0 0 0 0 0 0>;
            };

            c_snd_codec_o2: codec at 1 {
                sound-dai = <&i2c_codec2>;
                clocks=<&adau1761_mclk>;
                clock-names = "mclk";
                clock-frequency = <12288000>;
                name-prefix = "c2";
                dai-tdm-slot-tx-mask = <0 0 0 0 0 0 0 0>;
                dai-tdm-slot-rx-mask = <0 0 0 1 0 0 0 0>;
            };
            c_snd_codec_o3: codec at 2 {
                sound-dai = <&i2c_codec3>;
                clocks=<&adau1761_mclk>;
                clock-names = "mclk";
                clock-frequency = <12288000>;
                name-prefix = "c3";
                dai-tdm-slot-tx-mask = <0 0 0 0 0 0 0 0>;
                dai-tdm-slot-rx-mask = <0 0 0 0 0 1 0 0>;
            };


        };


More information about the Alsa-devel mailing list