cancel
Showing results for 
Search instead for 
Did you mean: 

No Audio Output from SGTL5000 on STM32MP13-Disco

Midhul_Pk
Associate II


hai everyone,

i’m working with the sgtl5000 codec on my stm32mp13-disco board but i get no sound from the headphone jack or line-out. here are my alsa mixer settings after amixer -c 0. 

 

root@stm32mp13-disco:~#  aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: stm32mp1sgtl500 [stm32mp1-sgtl5000], device 0: 4400a004.audio-controller-sgtl5000 sgtl5000-0 [4400a004.audio-controller-sgtl5000 sgtl5000-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

 

  Subdevice #0: subdevice #0
root@stm32mp13-disco:~#  amixer -c 0
Simple mixer control 'Headphone',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 127
  Mono:
  Front Left: Playback 127 [100%] [12.00dB] [on]
  Front Right: Playback 127 [100%] [12.00dB] [on]
Simple mixer control 'Headphone Mux',0
  Capabilities: enum
  Items: 'DAC' 'LINE_IN'
  Item0: 'DAC'
Simple mixer control 'Headphone Playback ZC',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'PCM',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 192
  Mono:
  Front Left: Playback 188 [98%]
  Front Right: Playback 188 [98%]
Simple mixer control 'Lineout',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 31 [100%] [0.00dB] [on]
  Front Right: Playback 31 [100%] [0.00dB] [on]
Simple mixer control 'Mic',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 3
  Mono: 0 [0%] [0.00dB]
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch cswitch-joined
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 15
  Front Left: Capture 12 [80%] [on]
  Front Right: Capture 12 [80%] [on]
Simple mixer control 'Capture Attenuate Switch (-6dB)',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'Capture Mux',0
  Capabilities: enum
  Items: 'MIC_IN' 'LINE_IN'
  Item0: 'MIC_IN'
Simple mixer control 'Capture ZC',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'AVC',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'AVC Hard Limiter',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'AVC Integrator Response',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 3
  Mono: 1 [33%]
Simple mixer control 'AVC Max Gain',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 2
  Mono: 1 [50%] [6.00dB]
Simple mixer control 'AVC Threshold',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 96
  Mono: 12 [12%] [12.00dB]
Simple mixer control 'BASS 0',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 95
  Mono: 47 [49%]
Simple mixer control 'BASS 1',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 95
  Mono: 47 [49%]
Simple mixer control 'BASS 2',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 95
  Mono: 47 [49%]
Simple mixer control 'BASS 3',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 95
  Mono: 47 [49%]
Simple mixer control 'BASS 4',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 95
  Mono: 47 [49%]
Simple mixer control 'DAP MIX Mux',0
  Capabilities: enum
  Items: 'ADC' 'I2S'
  Item0: 'I2S'
Simple mixer control 'DAP Main channel',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 65535
  Mono: 65535 [100%]
Simple mixer control 'DAP Mix channel',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 65535
  Mono: 0 [0%]
Simple mixer control 'DAP Mux',0
  Capabilities: enum
  Items: 'ADC' 'I2S'
  Item0: 'I2S'
Simple mixer control 'Digital Input Mux',0
  Capabilities: enum
  Items: 'ADC' 'I2S' 'Rsvrd' 'DAP'
  Item0: 'I2S'

Everything looks unmuted and at max volume but speaker-test and aplay test.wav are silent.

any ideas on which setting to change or what else to check? thanks!

 

 

 

 

3 REPLIES 3
Erwan SZYMANSKI
ST Employee

Hello @Midhul_Pk ,
According to the fact that you see all of this information already, it would let think that the main aspect in term of driver probes and device-trees are OK.

Now the next step for you is to understand in term of signal if you get the expected behavior. If I was you, I would have checked the different signals at the oscilloscope when you launch your audio playback. For example, can you confirm that you can well see the MCLK working during the playback ? Then look at data lanes etc ..

If you see something wrong in the signals, check at your pinctrl configuration if everything is well defined and so on.

You can come back to me with your device tree and your signals probed if you want. Maybe a complete dmesg too.

Kind regards,
Erwan.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hi @Erwan SZYMANSKI 

Thanks for your reply. I'm now getting audio output from the headphone, but the sound level is very low/quiet even with all volumes set to maximum in amixer (Amplitude is low). The output sounds more like noise rather than clear audio.

here the dts for Sound Card. 

sound {
	compatible = "simple-audio-card";
	simple-audio-card,name = "stm32mp1-sgtl5000";
	simple-audio-card,format = "i2s";

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

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

	simple-audio-card,widgets =
		"Microphone", "Mic Jack",
		"Headphone",  "Headphone Jack",
		"Line",       "Line In Jack",
		"Line",       "Line Out Jack";

	simple-audio-card,routing =
		"Mic Jack",        "MIC_IN",
		"Headphone Jack",  "HP_OUT",
		"Line In Jack",    "LINE_IN",
		"Line Out Jack",   "LINE_OUT";

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

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


sai  

&pinctrl {

    sai1_pins_a: sai1-0 {
        pins {
            pinmux = <STM32_PINMUX('A', 4, AF12)>, /* SAI1_SCK_A */
                     <STM32_PINMUX('A', 0, AF6)>, /* SAI1_SD_B */
                     <STM32_PINMUX('A', 5, AF6)>, /* SAI1_SD_A */
                     <STM32_PINMUX('F', 11, AF6)>, /* SAI1_FS_A */
                     <STM32_PINMUX('D', 13, AF6)>; /* SAI1_MCKA */
            slew-rate = <0>;
            drive-push-pull;
            bias-disable;
        };
    };

    sai1_sleep_pins_a: sai1-sleep-0 {
        pins {
            pinmux = <STM32_PINMUX('A', 4, ANALOG)>, /* SAI1_SCK_A */
                     <STM32_PINMUX('A', 0, ANALOG)>, /* SAI1_SD_B */
                     <STM32_PINMUX('A', 5, ANALOG)>, /* SAI1_SD_A */
                     <STM32_PINMUX('F', 11, ANALOG)>, /* SAI1_FS_A */
                     <STM32_PINMUX('D', 13, ANALOG)>; /* SAI1_MCKA */
        };
    };
};


 
&sai1 {
	status = "okay";
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&sai1_pins_a>;
	pinctrl-1 = <&sai1_sleep_pins_a>;

	clock-names = "pclk", "x8k", "x11k";
	clocks = <&rcc SAI1>, <&scmi_clk CK_SCMI_PLL3_Q>, <&scmi_clk CK_SCMI_PLL3_R>;
	assigned-clocks = <&rcc SAI1_K>;
	assigned-clock-parents = <&scmi_clk CK_SCMI_PLL3_Q>;
	assigned-clock-rates = <12288000>;

	sai1a: audio-controller@4400a004 {
	    compatible = "st,stm32-sai-sub-a";
	    reg = <0x4 0x20>;
	    status = "okay";
	    #sound-dai-cells = <0>;

	    clocks = <&rcc SAI1_K>;
	    clock-names = "sai_ck";
	    #clock-cells = <0>;
	    clock-output-names = "sai1a_mclk";

	    dmas = <&dmamux1 87 0x400 0x01>;
	    dma-names = "tx";
	};

	sai1b: audio-controller@4400a024 {
	    compatible = "st,stm32-sai-sub-b";
	    reg = <0x24 0x20>;
	    status = "okay";
	    #sound-dai-cells = <0>;
	    clocks = <&rcc SAI1_K>;
	    clock-names = "sai_ck";
	    dmas = <&dmamux1 88 0x400 0x01>;
	    dma-names = "rx";
	};
};

i2c Codec.

	sgtl5000: codec@0a {
	
	    compatible = "fsl,sgtl5000";
	    reg = <0x0a>;
	    status = "okay";
	    #sound-dai-cells = <0>;

	    /* Power rails */
	    VDDA-supply = <&scmi_v3v3_sw>;
	    VDDIO-supply = <&scmi_v3v3_sw>;
	    VDDD-supply = <&scmi_v1v8_periph>;

	    clocks = <&sai1a>;
	    clock-names = "mclk";
	};

bclk ( 16 bit data)bclk ( 16 bit data)mclkmclkLrclkLrclk

Mclk , lrclk,Bclk are getting properly. is there any changes in device tree ?? 

 

 

Hello @Midhul_Pk ,
As you confirm that you have all your clocks as expected, the remaining configuration should not rely on device tree or anything, but more on Codec configuration for me, but I am not an audio expert. 

You should check the different configurable part of the codec according to the codec documentation, and see if everything is aligned to get a correct audio playback. For me, the issue does not come from your DT, all looks quite good.

Kind regards,
Erwan.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.