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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/9/20 9:33 AM, Rolf Peder Klemetsen wrote:
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@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 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.

Hi,

One physical sound card is definitely the right direction. If you need multiple sound cards exposed to userspace you can use the ALSA plugin architecture to create multiple virtual sound cards on top of the one sound card.

Do you know why your approach with a single sound card does not work, do you get any error messages? Is the sound card registered?

The primary use case of the simple-audio-card is as the name suggests simple setups and your setup is not that simple. It is possible that your particular setup has never been tested with the simple-sound-card and there are still some hidden bugs. It might also be the case that you might have to create a custom sound card driver for your setup if you can't make it work with the simple card driver.

I believe I can see at least on issue with your DT snipped. For the widgets that are registered by the CODECs the prefix will be added to the name. So for example "LOUT" has to be "c1 LOUT", in addition you'll have to add one route for each sound card.

- Lars


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@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@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@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@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@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@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@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@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@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@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>;
             };


         };





[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux