Linux device tree question - Use internal clock for SAI peripheral on IMX8

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Linux device tree question - Use internal clock for SAI peripheral on IMX8

Jump to solution
989 Views
MasterFoo
Contributor II

Hi,

I have a board with a ICS43434 microphone (I2S device) connected to SAI interface of an IMX8DX. Linux runs on that microprocessor. I'm kind of novice with device tree configuration and I'm struggling to find the correct configuration for the clocks. Whatever configuration I try I have no signal going out of the SAI pins (bit clock and word clock). 
I uploaded my device tree file. This is the output of /sys/kernel/debug/clk/clk_summary when runnig arecord:

clk.png

arecord -l gives me a correct output:
arecordlist.png

But I get the following error when recording: pcm_read:2221: read error: Input/output error

What is missing so that the SAI1 clock is enabled?

Any help appreciated !

 

0 Kudos
Reply
1 Solution
865 Views
jimmychan
NXP TechSupport
NXP TechSupport

Please try to set like this:

simple-audio-card,bitclock-master = <&cpudai>;
simple-audio-card,frame-master = <&cpudai>;

cpudai: simple-audio-card,cpu {
          sound-dai = <&sai1>;
};

View solution in original post

6 Replies
947 Views
jimmychan
NXP TechSupport
NXP TechSupport

Is your audio codec control by I2C? so put it under the I2C node.

FYI. this is the evk device tree file.

https://github.com/nxp-imx/linux-imx/blob/imx_5.4.70_2.3.0/arch/arm64/boot/dts/freescale/imx8x-mek.d...

0 Kudos
Reply
911 Views
MasterFoo
Contributor II

No, the ICS43434 has no I2C/SPI interface. I removed the "@" and "reg=" in the codec defintion, those were copy/paste mistakes.
Do you think I shall put the codec under another node so that the clocks are correctly configured?

0 Kudos
Reply
905 Views
jimmychan
NXP TechSupport
NXP TechSupport

Have you try to measure the signals? is the clock correct?

You may try to set the mclkout0_lpcg to 12288000.

0 Kudos
Reply
883 Views
MasterFoo
Contributor II

Yes, I'm measuring the signals (all 3 pins on I2S) and there is no clock at all. I tried many clocks rates including 12288000,
I think that I'm maybe misunderstanding what clocks, assigned-clocks and assigned-clock-parents mean...
And what I should set for sai1, the codec and the sound entry in the device tree. The others example I found while googling seem to use an external clock for the master clock, but I need to use the SAI master clock.
With the attached version of DTS I can see now sai1_lpcg_mclk enabled. But still no signals.

MasterFoo_0-1717065966159.png

 

0 Kudos
Reply
866 Views
jimmychan
NXP TechSupport
NXP TechSupport

Please try to set like this:

simple-audio-card,bitclock-master = <&cpudai>;
simple-audio-card,frame-master = <&cpudai>;

cpudai: simple-audio-card,cpu {
          sound-dai = <&sai1>;
};

851 Views
MasterFoo
Contributor II
Thank you so much!
0 Kudos
Reply