IMX93 soundcard for a simple codec - pcm5102a

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

IMX93 soundcard for a simple codec - pcm5102a

3,868 次查看
rockerr
Contributor II

I'm trying to create a device tree for a simple codec available in the linux-imx kernel: pcm5102a.

Could give me some directions on how to start? I see that imx93 doesn't support i2s directly, but i2s over sai. It seemed reasonable to start off with modifications on the bt_sco_codec, resulting in below fragment of a device tree:

 

	codec: pcm5102a-codec {
		#sound-dai-cells = <1>;
		compatible = "ti,pcm5102a";
	};

	sound-pcm5102a {
		compatible = "simple-audio-card";
		simple-audio-card,name = "pcm5102a-audio";
		simple-audio-card,format = "dsp_a";
		simple-audio-card,bitclock-inversion;
		simple-audio-card,frame-master = <&pcm5102a_cpu>;
		simple-audio-card,bitclock-master = <&pcm5102a_cpu>;

		pcm5102a_cpu: simple-audio-card,cpu {
			sound-dai = <&sai1>;
			dai-tdm-slot-num = <2>;
			dai-tdm-slot-width = <16>;
		};

		simple-audio-card,codec {
			sound-dai = <&pcm5102a-codec 1>;
		};
	};

 

 

This tree unfortunately can't be parsed, I suppose it's very invalid. Are there any NXP resources on how to proceed with this?

标签 (2)
0 项奖励
回复
15 回复数

3,855 次查看
joanxie
NXP TechSupport
NXP TechSupport

i.mx93 is still under preproduction stage, but maybe you can refer to the this dts file

"https://github.com/nxp-imx/linux-imx/blob/lf-6.1.y/arch/arm64/boot/dts/freescale/imx93-11x11-evk-aud..."

0 项奖励
回复

3,782 次查看
rockerr
Contributor II

I came up with this, decided to use "simple-audio-card". The device tree did compile with the linux kernel, however it's not visible when running aplay -l nor there are any messages related to pcm5102a in the dmesg outupt.

 

#include "imx93-11x11-evk.dts"

/{
	pcm5102a: pcm5102a-codec {
		#sound-dai-cells = <1>;
		compatible = "ti,pcm5102a";
	};

	sound-pcm5102a {
		compatible = "simple-audio-card";
		simple-audio-card,name = "pcm5102a-audio";
		simple-audio-card,format = "i2s";
		simple-audio-card,bitclock-inversion;
		simple-audio-card,frame-master = <&pcm5102a_cpu>;
		simple-audio-card,bitclock-master = <&pcm5102a_cpu>;

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

		pcm5102a_dai: simple-audio-card,codec {
			sound-dai = <&pcm5102a>;
		};
	};
};

 

 Do you see an obvious error on my side? Should I first remove other devices that are using sai1?

If I read the IMX93-EVK Expansion board manual and the IMX93 reference sheet, then SAI1 should be accessible via the expansion ports on GPIO pins 7, 23, 32, 33. Is that true?

0 项奖励
回复

3,743 次查看
joanxie
NXP TechSupport
NXP TechSupport

in your source code, do you have driver for simple-audio-card? if you need to use sai1, you need remove other device which uses this

SAI1 should be accessible via the expansion ports on GPIO pins 7, 23, 32, 33. Is that true?

>where did you get this information?

0 项奖励
回复

3,735 次查看
rockerr
Contributor II
It also seems that all the other devices that depend on sai1 are either disabled or completely deleted from the device tree. What could be the other reasons for the sound card not to show up?
0 项奖励
回复

3,736 次查看
rockerr
Contributor II
Is there any difference regarding the imx93 evk expansion connector pinout between target imx93-11x11-evk and imx93-14x14-evk?
0 项奖励
回复

3,737 次查看
rockerr
Contributor II

simple-audio-card seems to be build into linux-imx kernel, check out sound/soc/generic/simple-card.c 

Regarding SAI1 and the pinout, in i.MX 93 Automotive Application Processors Data Sheet on page 97, table called "Table 103. 14 x 14 mm functional contact assignment (continued)" mentions ball names related to  SAI1: SAI1_RXD0, SAI1_TXC, SAI1_TXD0 and SAI1_TXFS, respectively these go along with default functions: GPIO1.IO[4] , GPIO1.IO[12] , GPIO1.IO[13] , GPIO1.IO[11]. In the MCIMX93-EVK Board User Manual in the 2.18 Expansion Connector section it's mentioned that GPIO_IO4, GPIO_IO12, GPIO_IO13 and GPIO_IO11 are accessible via expansion connector pins 7, 32, 33 and 23.

I have no idea if that's right, but that was my wild guess and I really hoped for it to work.

Meanwhile I still can't bring up my sound card, I'll try removing other devices first. Is there a way to somehow debug this? The Device Tree builds without any errors, dmesg output lacks any suspicious messages, yet still the sound card isn't available with aplay -l.

0 项奖励
回复

3,628 次查看
joanxie
NXP TechSupport
NXP TechSupport

refer to the dts file

https://github.com/nxp-imx/linux-imx/blob/lf-6.1.y/arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts

youc an find sa1 mux mode as below

pinctrl_sai1: sai1grp {
fsl,pins = <
MX93_PAD_SAI1_TXC__SAI1_TX_BCLK 0x31e
MX93_PAD_SAI1_TXFS__SAI1_TX_SYNC 0x31e
MX93_PAD_SAI1_TXD0__SAI1_TX_DATA00 0x31e
MX93_PAD_SAI1_RXD0__SAI1_RX_DATA00 0x31e
>;
};

for example SA1_RXD0, you can refer to the SW_MUX_CTL_PAD_SAI1_RXD0 SW MUX Control Register (SW_MUX_CTL_PAD_SAI1_RXD0)

refer  to the reference manual

joanxie_1-1695108288789.png

 

SAI1_RDX0 should mux SAI1_RX_DATA00, not GPIO1_IO14

 

0 项奖励
回复

3,593 次查看
rockerr
Contributor II
Okay, I've found the document, "i.MX 93 Applications Processor Reference Manual".
0 项奖励
回复

3,595 次查看
rockerr
Contributor II
Which reference manual are you referring to? I'm not able to find the right document. My goal is to have SAI1 accessible through Expansion Connector, is that even possible?
0 项奖励
回复

3,538 次查看
joanxie
NXP TechSupport
NXP TechSupport

I just refer to the dts file, imx93 board is based on this, you also can refer to the board schematic, SAI1 is used to BT

joanxie_0-1695273227225.png

 

joanxie_1-1695273288722.png

 

0 项奖励
回复

3,513 次查看
rockerr
Contributor II

I see, yes I made my pcm5102a DT fragment based on that BT config. Is specifying the tdm slot paramters necessary?

Anyway, I tried to specify the tdm slot and that didn't change anything. The sound card still isn't discovered, the probe functions of simple-audio-card aren't probed at all. At the same time the dtb file from my fragment is for sure present in the kernel tree. How could I debug this and perhaps get some information about the dts files that are actually taken into account by the kernel during boot?

Another question relates to how could one access the the sai1(or sai3 if that's easier to access) from the im93-evk. I hoped that the expansion connector could help with this, but I cannot find any info about it. You already said that my previous ideas were wrong. So is it even possible to access sai1/3 from the expansion connector?

0 项奖励
回复

3,492 次查看
joanxie
NXP TechSupport
NXP TechSupport

I already mentioned before, you can refer to the dts file we offered

"https://github.com/nxp-imx/linux-imx/blob/lf-6.1.y/arch/arm64/boot/dts/freescale/imx93-11x11-evk-aud...

this uses SAI3 and you can access by these GPIO pins

joanxie_0-1695354667860.png

if you use sai1, which is used by BT in dts, you need to disable it firstly before you use it, since imx93 is still under preporduction, I couldn't share more, I already tell you all of information you can find, the dts file, the reference manual and the schematic, pls design and set according imx93 evk board, if you have further request, pls contact beta group team

"i.MX 93 family pre-production samples and EVKs along with technical support available for early access customers through a paid program. For more info, please contact Beta.iMX@nxp.com for more details."

0 项奖励
回复

3,294 次查看
rockerr
Contributor II

I've read all the documents suggested by you and this is the outcome:

* route SAI3 signals to the J1001 connector

* probe simple-audio-card soundcard

Probe errors still happen, changes are made to the imx93-11x11-evk.dts device tree - disabling all the other sound cards and setting the SAI3 clock to a higher value. SAI3 routing is set with reg_audio_switch1 node, similarly to how it's done in the imx93-11x11-evk-aud-hat.dts.

/ {
    reg_audio_switch1: regulator-audio-switch1 {
		compatible = "regulator-fixed";
		regulator-name = "audio-switch1";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		gpio = <&adp5585gpio 4 GPIO_ACTIVE_HIGH>;
		enable-active-high;
		regulator-always-on;
	};

	pcm5102a: pcm5102a-codec {
		#sound-dai-cells = <0>;
		compatible = "ti,pcm5102a";
	};

	sound-pcm5102a {
		compatible = "simple-audio-card";
		simple-audio-card,name = "pcm5102a-audio";
		simple-audio-card,format = "i2s";
		simple-audio-card,bitclock-inversion;
		simple-audio-card,frame-master = <&pcm5102a_cpu>;
		simple-audio-card,bitclock-master = <&pcm5102a_cpu>;

		pcm5102a_cpu: simple-audio-card,cpu {
			sound-dai = <&sai3>;
			dai-tdm-slot-num = <2>;
			dai-tdm-slot-width = <16>;
		};

		pcm5102a_dai: simple-audio-card,codec {
			sound-dai = <&pcm5102a>;
		};
	};
};

&sai3 {
	#sound-dai-cells = <0>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_sai3>;
	assigned-clocks = <&clk IMX93_CLK_SAI3>;
	assigned-clock-parents = <&clk IMX93_CLK_AUDIO_PLL>;
	assigned-clock-rates = <24576000>;
	fsl,sai-mclk-direction-output;
	status = "okay";
};

The probe error is as below:

dmesg output:

[   20.376045] simple_probe START!
[   20.379236] CODEC found: sound-pcm5102a
[   20.383100] simple-card error!
[   20.386346] CODEC found: sound-pcm5102a
[   20.390458] simple-card error!
[   20.393681] CODEC found: sound-pcm5102a
[   20.397741] simple-card error!
[   20.401419] platform sound-pcm5102a: deferred probe pending
[   20.408157] platform regulator-dvdd_sel: deferred probe pending
[   20.415109] platform regulator-dvdd: deferred probe pending
[   20.421724] platform regulator-vdd: deferred probe pending
[   20.428267] platform regulator-vddo: deferred probe pending
[   20.434929] platform regulator-vaa_sel: deferred probe pending
[   20.441818] platform regulator-avdd: deferred probe pending
[   20.448467] i2c 2-003c: deferred probe pending

 

cat /sys/kernel/debug/devices_deferred

sound-pcm5102a  asoc-simple-card: parse error
regulator-dvdd_sel      platform: wait for supplier gpio-isp@34
regulator-dvdd  platform: wait for supplier gpio-isp@34
regulator-vdd   platform: wait for supplier gpio-isp@34
regulator-vddo  platform: wait for supplier gpio-isp@34
regulator-vaa_sel       platform: wait for supplier gpio-isp@34
regulator-avdd  platform: wait for supplier gpio-isp@34
2-003c  i2c: wait for supplier gpio-isp@34

 

I'm not sure if all the "deferred" messages are related to the sound-pcm5102a, or just the first one, this seems like a problem related to adp5585, the U103 Mux controlled by I2C. What am I missing here?

 

0 项奖励
回复

3,291 次查看
rockerr
Contributor II
I've added printk messages to the simple-audio-card to know if it's being probed at the start of the probing function and at the line where the codec is read.
0 项奖励
回复

3,808 次查看
rockerr
Contributor II

I see, are there available examples for imx8 series, are they cross-compatible by any chance?
What about the audio-graph-card, is it supported by imx93?

0 项奖励
回复