How should I write a dts file to use 16ch TDM with "simple-audio-card"?

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

How should I write a dts file to use 16ch TDM with "simple-audio-card"?

Jump to solution
1,584 Views
Takashi_Kashiwagi
Senior Contributor I

Hi community.

 

I have using IMX8MP with kernel 5.15.60.

I want to create a 768KHz 32bit 16ch Full-duplex audio device. (I attached block-diagram.)
How should I describe it in dts when using "simple-audio-card"?

 

 

// linux-imx/Documentation/devicetree/bindings/sound/fsl-sai.txt
// I want to use SAI1 as 768KHz, 32bits, TX 16ch (8 lanes), RX 16ch (8 lanes), but I don't know how to set the dts file.
// TX/RX_SYNC, TX/RX_BCLK are provided external FPGA.
&sai1 {
	/* Basic settings are done in "imx8mp.dtsi". */
	#sound-dai-cells = <0>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_sai1>;
	fsl,sai-synchronous-rx;	// <<= add for TDM
	fsl,sai-multi-lane;	// <<= add for TDM
	fsl,dataline = <8 0xFF 0xFF>; // <<= add for TDM
	status = "okay";
};

~~~
	sound-aio16ch{
		compatible = "simple-audio-card";
		simple-audio-card,name = "products-AIO";
		simple-audio-card,format = "left_j";
		simple-audio-card,bitclock-master = <&dailink0_master>; // <<--	What should i write here? (SAI1 does not supply TX/RX_SYNC, TX/RX_BCLK.)
		simple-audio-card,frame-master = <&dailink0_master>; // <<--	What should i write here? (SAI1 does not supply TX/RX_SYNC, TX/RX_BCLK.)
		simple-audio-card,widgets =	// <<--	What should i write here? (I read "simple-card.yaml", but I don't really understand how to write it.)
				"Microphone", "Microphone Jack",
				"Headphone", "Headphone Jack",
				"Speaker", "External Speaker";
		simple-audio-card,routing = // <<--	What should i write here? (I read "simple-card.yaml", but I don't really understand how to write it.)
				"MIC_IN", "Microphone Jack",
				"Headphone Jack", "HP_OUT",
				"External Speaker", "LINE_OUT";
		simple-audio-card,cpu {
			sound-dai = <&sai1>;
			dai-tdm-slot-num = <16>;
			dai-tdm-slot-width = <32>;
		};
		dailink0_master: simple-audio-card,codec {	// <<--	What should i write here?
			sound-dai = <&ak4648>;
		};
    };

 

 

Best Regards,

KASHIWAGI Takashi

0 Kudos
1 Solution
1,513 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @Takashi_Kashiwagi,

I hope you are doing well

For "simple-audio-card,widgets" property please refer to the Documentation/devicetree/bindings/sound/widgets.txt file from the kernel source code.
 
simple-audio-card,routing: A list of the connections between audio components. Each entry is a pair of strings, the first being the connection's sink, and the second being the connection's source.
 
For more information regarding device tree binding, kindly refer to the below document.
 
Thanks & Regards,
Dhruvit Vasavada

View solution in original post

4 Replies
1,500 Views
Takashi_Kashiwagi
Senior Contributor I

Hi @Dhruvit  san.

 

Thank you for reply.

 

For "simple-audio-card,widgets" property please refer to the Documentation/devicetree/bindings/sound/widgets.txt file from the kernel source code.

simple-audio-card,routing: A list of the connections between audio components. Each entry is a pair of strings, the first being the connection's sink, and the second being the connection's source.

Understood. I will read that document.

 

Best Regards,

KASHIWAGI Takashi

 

 

0 Kudos
1,559 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @Takashi_Kashiwagi,

I hope you are doing well.

Kindly take a reference of the below documents to describe the channel number and width. 
Documentation/devicetree/bindings/sound/tdm-slot.txt from the Linux source code.
 
For clock-related configuration, it can be done using the "assigned-clock-rates" property. For more information, kindly refer to the Documentation/devicetree/bindings/clock/clock-bindings.txt from the Linux source code.
 
For a reference, one can refer to the below device tree file.

arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi from the Linux source code.
 
Thanks & Regards,
Dhruvit Vasavada
1,539 Views
Takashi_Kashiwagi
Senior Contributor I

Hi Dhruvit-san.

 

Thank you for reply!

 

Kindly take a reference of the below documents to describe the channel number and width. 
Documentation/devicetree/bindings/sound/tdm-slot.txtfrom the Linux source code.
 
Thanks for the documentation, I think I can handle the tdm setup.
 
For clock-related configuration, it can be done using the "assigned-clock-rates" property. For more information, kindly refer to the Documentation/devicetree/bindings/clock/clock-bindings.txtfrom the Linux source code.
This is not well understood. The codec I plan to use does not output MCLK, TX/RX_BCLK, or TX/RX_SYNC. Or is this item unrelated to the Audio clock?
 
Also, is there any clear documentation on "simple-audio-card,widgets" and "simple-audio-card,routing"? (I looked at the simple-card.yaml, but could not figure out which item in the driver I should write in relation to which.)
 

 

adda16ch:codec{
	compatible = "teac,adda16ch";
	#sound-dai-cells = <0>;
	status = "okay";
};

sound-adda16ch{
	#address-cells = <1>;
	#size-cells = <0>;
	status = "okay";
        compatible = "simple-audio-card";
        simple-audio-card,name = "ADDA16InOut";
        simple-audio-card,format = "left_j";
		
	simple-audio-card,bitclock-master = <&testADDA>;
	simple-audio-card,frame-master = <&testADDA>;

	simple-audio-card,widgets =
			"Line", "Line In Jack",
			"Line", "Line Out Jack";
	simple-audio-card,routing =
			"AIN1", "Line In Jack",
			"AIN2", "Line In Jack",
			"AIN3", "Line In Jack",
			"AIN4", "Line In Jack",
			"AIN5", "Line In Jack",
			"AIN6", "Line In Jack",
			"AIN7", "Line In Jack",
			"AIN8", "Line In Jack",
			"AIN9", "Line In Jack",
			"AIN10", "Line In Jack",
			"AIN11", "Line In Jack",
			"AIN12", "Line In Jack",
			"AIN13", "Line In Jack",
			"AIN14", "Line In Jack",
			"AIN15", "Line In Jack",
			"AIN16", "Line In Jack",
			"AOUT1", "Line Out Jack",
			"AOUT2", "Line Out Jack",
			"AOUT3", "Line Out Jack",
			"AOUT4", "Line Out Jack",
			"AOUT5", "Line Out Jack",
			"AOUT6", "Line Out Jack",
			"AOUT7", "Line Out Jack",
			"AOUT8", "Line Out Jack",
			"AOUT9", "Line Out Jack",
			"AOUT10", "Line Out Jack",
			"AOUT11", "Line Out Jack",
			"AOUT12", "Line Out Jack",
			"AOUT13", "Line Out Jack",
			"AOUT14", "Line Out Jack",
			"AOUT15", "Line Out Jack",
			"AOUT16", "Line Out Jack";
	testADDA:simple-audio-card,cpu {
		sound-dai = <&sai1>;
		dai-tdm-slot-num = <16>;
		dai-tdm-slot-width = <32>;
	};

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

 

Best Regards,
KASHIWAGI TAKASHI
 
0 Kudos
1,514 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @Takashi_Kashiwagi,

I hope you are doing well

For "simple-audio-card,widgets" property please refer to the Documentation/devicetree/bindings/sound/widgets.txt file from the kernel source code.
 
simple-audio-card,routing: A list of the connections between audio components. Each entry is a pair of strings, the first being the connection's sink, and the second being the connection's source.
 
For more information regarding device tree binding, kindly refer to the below document.
 
Thanks & Regards,
Dhruvit Vasavada