DAC and ADC on same SAI

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

DAC and ADC on same SAI

ソリューションへジャンプ
1,030件の閲覧回数
valentinlageard
Contributor I

Hi,
I'm trying to setup a device tree so we can use a AK4458 DAC and a AK5558 ADC using the same SAI (SAI1). I've successfully setup a simple-audio-card device tree node for the AK4458 but I am now trying to also integrate the AK5558. I'm just wondering if it's something that is possible with simple-audio-card. Note that they should be using the same format. They're both using TDM256, 32bits, MSB. Here is an extract from my current test device tree. On this current configuration, I don't seem to have any RX frame sync while starting to record on the corresponding card.

 

 

/ {
        custom-audio-card {
                compatible = "simple-audio-card";
                #address-cells = <1>;
                #size-cells = <0>;
                simple-audio-card,name = "Custom Audio";
                system-clock-fixed;
                system-clock-direction-out;

                simple-audio-card,dai-link@0 {
                        format = "left_j";
                        bitclock-master = <&sai1cpu0_master>;
                        frame-master = <&sai1cpu0_master>;
                        sai1cpu0_master: cpu {
                                sound-dai = <&sai1>;
                                dai-tdm-slot-num = <8>;
                                dai-tdm-slot-width = <32>;
                                dai-tdm-slot-tx-mask = <1 1 1 1 1 1 1 1>;
                                dai-tdm-slot-rx-mask = <1 1 1 1 1 1 1 1>;
                        };
                        codec {
                                sound-dai = <&ak4458>;
                                prefix = "ak4458";
                                dai-tdm-slot-num = <8>;
                                dai-tdm-slot-width = <32>;
                                dai-tdm-slot-tx-mask = <1 1 1 1 1 1 1 1>;
                                dai-tdm-slot-rx-mask = <0 0 0 0 0 0 0 0>;
                        };
                };

                simple-audio-card,dai-link@1 {
                        format = "left_j";
                        bitclock-master = <&sai1cpu1_slave>;
                        frame-master = <&sai1cpu1_slave>;
                        sai1cpu1_slave: cpu {
                                sound-dai = <&sai1>;
                                dai-tdm-slot-num = <8>;
                                dai-tdm-slot-width = <32>;
                                dai-tdm-slot-tx-mask = <1 1 1 1 1 1 1 1>;
                                dai-tdm-slot-rx-mask = <1 1 1 1 1 1 1 1>;
                        };
                        codec {
                                sound-dai = <&ak5558>;
                                prefix = "ak5558";
                                dai-tdm-slot-num = <8>;
                                dai-tdm-slot-width = <32>;
                                dai-tdm-slot-tx-mask = <0 0 0 0 0 0 0 0>;
                                dai-tdm-slot-rx-mask = <1 1 1 1 1 1 1 1>;
                        };
                };
        };
};

&sai1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_sai1>; // TODO !
        clocks = <&clk IMX8MM_CLK_SAI1_IPG>, <&clk IMX8MM_CLK_DUMMY>,
                 <&clk IMX8MM_CLK_SAI1_ROOT>, <&clk IMX8MM_CLK_DUMMY>,
                 <&clk IMX8MM_CLK_DUMMY>, <&clk IMX8MM_AUDIO_PLL1_OUT>,
                 <&clk IMX8MM_AUDIO_PLL2_OUT>;
        clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3", "pll8k", "pll11k";
        assigned-clocks = <&clk IMX8MM_CLK_SAI1>;
        assigned-clock-parents = <&clk IMX8MM_AUDIO_PLL1_OUT>;
        assigned-clock-rates = <24576000>;
        fsl,sai-asynchronous;
        fsl,sai-mclk-direction-output; // SAI will output the MCLK
        fsl,dataline = <1 0x01 0x01>;
        status = "okay";
};

 

0 件の賞賛
返信
1 解決策
972件の閲覧回数
valentinlageard
Contributor I
I actually had a misconfigured pin ! Also, I now use the sai in RX synchronous mode. Everything works as expected as far as I can tell !

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
1,003件の閲覧回数
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

Researching internally, it seems that it is possible, there is an example about how to do a similar application, here how to do it with i.MX8MM and AK4458 that could help you as a reference:

On 8MM EVK board, when comment I2C access to AK4458, AK4458 sound card device will be registered, without connecting to audio board. Attached is the patch; after applying it, you can find below sound card devices.

root@imx8mmevk:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: imxspdif [imx-spdif], device 0: S/PDIF PCM snd-soc-dummy-dai-0 [S/PDIF PCM snd-soc-dummy-dai-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: btscoaudio [bt-sco-audio], device 0: 30020000.sai-bt-sco-pcm bt-sco-pcm-0 [30020000.sai-bt-sco-pcm bt-sco-pcm-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: btscoaudio [bt-sco-audio], device 1: 30020000.sai-bt-sco-pcm-wb bt-sco-pcm-wb-1 [30020000.sai-bt-sco-pcm-wb bt-sco-pcm-wb-1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 3: wm8524audio [wm8524-audio], device 0: 30030000.sai-wm8524-hifi wm8524-hifi-0 [30030000.sai-wm8524-hifi wm8524-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 4: ak4458audio [ak4458-audio], device 0: Audio multicodec-0 [Audio multicodec-0]
Subdevices: 1/1
Subdevice #0: subdevice #0

In imx-ak4458.c, imx_aif_hw_params, if you don't enable tdm and dsd, slots of each lane is set to 2.

So when play stereo music, only TXD0 has signal.

When play 4 channels music, you can observe signal on TXD0 and TXD1. Channel 0 and 1 are sent to TXD0, channel 2 and 3 are sent to TXD1

I hope this information helps you.

Best regards.

973件の閲覧回数
valentinlageard
Contributor I
I actually had a misconfigured pin ! Also, I now use the sai in RX synchronous mode. Everything works as expected as far as I can tell !
0 件の賞賛
返信