ADAU7002 interfacing with SAI on iMX6UL

cancel
Showing results for 
Search instead for 
Did you mean: 

ADAU7002 interfacing with SAI on iMX6UL

635 Views
jw_stw
Contributor I

Hello,

I am trying to setup the device tree of my Variscite iMX6UL Dart SOM to interface with multiple ADAU7002 in TDM format using simple sound card. I have made edits in the dtsi file to try and enable SAI3 with no luck. Here are my edits to the simple sound card with the ADAU7002 as input and the WM8731 as my output.

_________imx6ul-imx6ull-var-dart-common.dtsi___________

sound {
        compatible = "simple-audio-card";
        simple-audio-card,name = "master-sound";
        simple-audio-card,widgets =
            "Headphone", "Headphone Jack",
            "Line", "Line Jack",
            "Microphone", "Mic Jack";
        simple-audio-card,routing =
            "Headphone Jack", "RHPOUT",
            "Headphone Jack", "LHPOUT",
            "LLINEIN", "Line Jack",
            "RLINEIN", "Line Jack",
            "MICIN", "Mic Bias",
            "Mic Bias", "Mic Jack";

        simple-audio-card,dai-link@0{
            format = "i2s";
            bitclock-master = <&wm8731_dac>;
            frame-master = <&wm8731_dac>;
            /*bitclock-inversion;*/
    
            cpu {
                sound-dai = <&sai2>;
            };
    
            wm8731_dac: codec {
                sound-dai = <&codec>;
                system-clock-id = <2>;  /* WM8731_SYSCLK_MCLK */
                system-clock-frequency = <12288000>;
            };
        };

        simple-audio-card,dai-link@1{
            format = "left_j";
            bitclock-master = <&adau7002_adc>;
            frame-master = <&adau7002_adc>;
            mclk-fs = <3>;
    
            cpu {
                sound-dai = <&sai3>;
                dai-tdm-slot-num = <8>;
                dai-tdm-slot-width = <32>;
            };
    
            adau7002_adc: codec {
                sound-dai = <&sai3>;
                system-clock-id = <3>;  
                system-clock-frequency = <12288000>;
            };
        };
        
        adau7002: adau7002-tdm {
            compatible = "adi,adau7002";
        };    
    };

Also here are some edits for the iomux:

        pinctrl_sai3: sai3grp {
            fsl,pins = <
                MX6UL_PAD_LCD_DATA09__SAI3_MCLK        0x17088
                MX6UL_PAD_LCD_DATA11__SAI3_RX_BCLK      0x17088
                MX6UL_PAD_LCD_DATA14__SAI3_RX_DATA    0x11088
                MX6UL_PAD_LCD_DATA10__SAI3_RX_SYNC      0x17088
            >;
        };

Here is the addition of SAI3 to the device tree as well:

&sai3 {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_sai3>;
    assigned-clocks = <&clks IMX6UL_CLK_SAI3_SEL>,
              <&clks IMX6UL_CLK_SAI3>;
    assigned-clock-parents = <&clks IMX6UL_CLK_PLL4_AUDIO_DIV>;
    assigned-clock-rates = <0>, <12288000>;
    fsl,sai-mclk-direction-output;
    status = "okay";
};

When I look at the boot log I get errors regarding my dai-link parsing. Not sure what the problem is with my parsing but here are the errors from the log:

[    2.373092] OF: /sound/simple-audio-card,dai-link@0/cpu: could not get #sound-dai-cells for /soc/aips-bus@02000000/spba-bus@02000000/sai@0202c000
[    2.385201] asoc-simple-card sound: parse error -22
[    2.388850] asoc-simple-card: probe of sound failed with error -22
[    2.395213] fsl-asrc 2034000.asrc: failed to get spba clock
[    2.405975] imx6ul-pinctrl 20e0000.iomuxc: pin MX6UL_PAD_LCD_DATA11 already requested by 21c8000.lcdif; cannot claim for 2030000.sai
[    2.417085] imx6ul-pinctrl 20e0000.iomuxc: pin-81 (2030000.sai) status -22
[    2.423870] imx6ul-pinctrl 20e0000.iomuxc: could not request pin 81 (MX6UL_PAD_LCD_DATA11) from group sai3grp  on device 20e0000.iomuxc
[    2.435009] fsl-sai 2030000.sai: Error applying setting, reverse things back
[    2.442949] fsl-sai: probe of 2030000.sai failed with error -22

Thank you,

Jordan

Labels (3)
0 Kudos
1 Reply

304 Views
igorpadykov
NXP TechSupport
NXP TechSupport

Hi Jordan

 "simple sound card " is not supported by nxp, one can look at third party developments

https://bootlin.com/blog/eight-channels-audio-on-i-mx7-with-pcm3168/ 

Re: Testing SAI with mainline — ALSA Devel 

Regarding nxp bsps, one can try with sai driver and

debug it starting in function fsl_sai_set_dai_tdm_slot(), scheck how sets it fsl_sai_probe()

linux/soc/fsl/fsl_sai.c

linux-imx/fsl_sai.c at imx_4.14.78_1.0.0_ga_var01 · varigit/linux-imx · GitHub 

log "could not request pin" may relates that some pin is already used or has wrong name.

May be useful AN4553 Using Open Source Debugging Tools for Linux on i.MX Processors
https://www.nxp.com/docs/en/application-note/AN4553.pdf

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos