This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TLV320AIC3120EVM-U: codec clock error at linux boot time

Part Number: TLV320AIC3120EVM-U
Other Parts Discussed in Thread: TLV320AIC3120

We are using TLV320AIC3120EVM-U connected to SDTM32MP135-DK.

Only the speaker is connected to LV320AIC3120EVM-U, no microphone is used.

The connections are below:

We have the following error:

The sound card does not find the MCLK1 and the clock are not enabled.

The device tree is below:

sound: sound {
compatible = "audio-graph-card";
label = "STM32MP135F-DK";
routing = "Playback", "MCLK1"; 
dais = <&sai1a_port>;
status = "okay";
};
 
&i2c1{
tlv320aic31xx: tlv320aic31xx@18 {
	compatible = "ti,tlv320aic3120";
	reg = <0x18>;
	ai31xx-micbias-vg = <MICBIAS_2_5V>;
	reset-gpios = <&gpioe 5 GPIO_ACTIVE_LOW>;
	HPVDD-supply = <&scmi_vdd>;
	SPRVDD-supply = <&scmi_vdd>;
	SPLVDD-supply = <&scmi_vdd>;
	AVDD-supply = <&scmi_vdd>;
	IOVDD-supply = <&scmi_vdd>;
	DVDD-supply = <&scmi_v1v8_periph>;
	clocks = <&sai1a>;
	clock-names = "MCLK1";
 
	ports {
			#address-cells = <1>;
			#size-cells = <0>;
			tlv320aic31xx_tx_port: port@0 {
				reg = <0>;
	         		tlv320aic31xx_tx_endpoint: endpoint {
					remote-endpoint = <&sai1a_endpoint>;
				};
			};
 		};	
  };
};
 
&sai1{
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&sai1a_pins_mx>;
	pinctrl-1 = <&sai1a_sleep_pins_mx>;
	status = "okay";
	/* USER CODE BEGIN sai1 */
	clocks = <&rcc SAI1>, <&scmi_clk CK_SCMI_PLL3_Q>, <&scmi_clk CK_SCMI_PLL3_R>;
	clock-names = "pclk", "x8k", "x11k";
	/* USER CODE END sai1 */
 
	sai1a:audio-controller@4400a004{
		status = "okay";
		/* USER CODE BEGIN sai1a */
		compatible = "st,stm32-sai-sub-a";
		#clock-cells = <0>;
		dma-names = "tx";
		clocks = <&rcc SAI1_K>;
		clock-names = "sai_ck";
 
		sai1a_port: port {
			sai1a_endpoint: endpoint {
				remote-endpoint = <&tlv320aic31xx_tx_endpoint>;
				format = "i2s";
				mclk-fs = <512>;
			};
		};
		/* USER CODE END sai1a */
	};
};

To create the device tree we use as reference the page: SAI device tree configuration - stm32mpu, "3.3.1 Setting SAI as a master clock provide"

How can we solve this problem? Do you suggest to change the device tree or the HW connections?

Regards

  • Hi, Guy,

    Kindly offer the kernel version with me before I support you.

    Which code will you use?

    I want to know more project information.

    following is the example on how to set the i2c device

            i2c2: i2c@e400a000 {

                status = "ok";

                pinctrl-0 = <&i2c2_pins_a>;

                clock-frequency = <400000>;

                tlv320aic31xx: tlv320aic31xx@18 {

                    compatible = "ti,tlv320aic3120";

                    reg = <0x18>;

                    status = "okay";

                    ai31xx-micbias-vg = <MICBIAS_2_0V>;

                    #sound-dai-cells = <0>;

                    reset-gpios = <&gpio 6 GPIO_ACTIVE_LOW>;

     

                    HPVDD-supply = <&fixed_hpvdd>;

                    SPRVDD-supply = <&fixed_sprvdd>;

                    SPLVDD-supply = <&fixed_splvdd>;

                    AVDD-supply = <&fixed_avdd>;

                    IOVDD-supply = <&fixed_iovdd>;

                    DVDD-supply = <&fixed_dvdd>;

                };

            };

    following is the example on how to set as slave:

        sound {

            compatible = "simple-audio-card";

            simple-audio-card,name = "SpiritBear";

            simple-audio-card,mclk-fs = <250>;

            simple-audio-card,format = "i2s";

            simple-audio-card,widgets =

            "Microphone", "MIC";

            simple-audio-card,routing =

            "MIC1LP", "MIC",

            "MIC1RP", "MIC",

            "MIC1LM", "MIC",

            "ADC", "MIC",

            "MIC", "MICBIAS";

            simple-audio-card,cpu {

                sound-dai = <&i2s0>;

            }; 

            simple-audio-card,codec {

                sound-dai = <&tlv320aic31xx>;

            };

        };

    following is the example on how to set as master:

        sound {

            compatible = "simple-audio-card";

            simple-audio-card,name = "SpiritBear";

            simple-audio-card,mclk-fs= <250>;

            simple-audio-card,format = "i2s";

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

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

            simple-audio-card,widgets =

            "Microphone", "MIC";

            simple-audio-card,routing =

            "MIC1LP", "MIC",

            "MIC1RP", "MIC",

            "MIC1LM", "MIC",

            "AIF OUT", "MIC",

            "Capture", "MIC",

            "ADC", "MIC",

            "MIC", "MICBIAS";

     

            simple-audio-card,cpu {

                sound-dai = <&i2s0>;

            };

     

            tlv320aic3120codec: simple-audio-card,codec {

                sound-dai = <&tlv320aic31xx>;

            };

        };

    I wonder whether you want to set the codec as master or slave?

    I think setting as slave is simpler than setting as master. 

    Looking forward to your feedback.

  • we are using linux kernel in GitHub - STMicroelectronics/linux: Linux kernel source tree v5.15

    and the codec driver is linux/tlv320aic31xx.c at v5.15-stm32mp · STMicroelectronics/linux · GitHub

    Our codec tlv320aic3120 is slave of the SAI1 microprocessor peripheral and we need only to drive the speaker.

    The connections and the device tree information are above.

    The audio file we need to reproduce has sample frequency 48 khz and the bit speed 1536 kbit/s. The audio file is stereo, but the codec is mono. Can be a problem? In final applicatio we will use only mono audio files.

    It is better to use Master Clock or Bit Clock as PLL source?

  • No issue, even if mono playback, the sample rate is still 48kHz and bit clk is still 1.536MHz (48kHz * 2 channels * 16 bit). In some platforms, both channels will transmit the same mono audio data.

    bit clock will be simpler for device tree setting.