I have a custom device based on the i.MX6Q with the SGTL5000 Audi CODEC. I cannot get anything to output on my speakers using aplay. I hear a pop when I hit return but no audio. Here is the device tree section I have created for our device:
sound {
compatible = "fsl,imx-audio-sgtl5000";
model = "imx-audio-sgtl5000";
cpu-dai = <&ssi1>;
audio-codec = <&codec>;
audio-routing =
"MIC_IN", "Mic Jack",
"Mic Jack", "Mic Bias",
"LINE_IN", "Line In Jack",
"LINE_OUT", "Line Out Jack",
"Headphone Jack", "HP_OUT";
mux-int-port = <2>;
mux-ext-port = <5>;
};
&i2c1 {
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c1>;
status = "okay";
codec: sgtl5000@0a {
compatible = "fsl,sgtl5000";
reg = <0x0a>;
VDDA-supply = <®_3p3v>;
VDDIO-supply = <®_3p3v>;
clocks = <&codec_osc>;
};
};
&ssi1 {
fsl,mode = "i2s-slave";
status = "okay";
};
When the kernel boots, I get the following output:
ALSA: Restoring mixer settings...
No state is present for card imxaudiosgtl500
Found hardware: "imx-audio-sgtl5" "" "" "" ""
Hardware is initialized using a generic method
No state is present for card imxaudiosgtl500
Has anybody seen this type of kernel message?
When I get to the prompt, this is the cards seen by the kernel:
root@imx6qc398:~# cat /proc/asound/cards
0 [imxaudiosgtl500]: imx-audio-sgtl5 - imx-audio-sgtl5000
imx-audio-sgtl5000
I have made some progress. I have found that the asound.state is part of the recipe structure and I have added my specific audio device to the file at:
sources/meta-fsl-bsp-release/recipes-bsp/alsa-state/alsa-state/mx6/asound.state.3.10.17
Before the changes, the kernel output was:
ALSA: Restoring mixer settings...
No state is present for card imx6qc398sgtl50
Found hardware: "imx6q-c398-sgtl" "" "" "" ""
Hardware is initialized using a generic method
No state is present for card imx6qc398sgtl50
After the changes, it was now:
ALSA: Restoring mixer settings...
Found hardware: "imx6q-c398-sgtl" "" "" "" ""
Hardware is initialized using a generic method
/usr/sbin/alsactl: set_control:1325: failed to obtain info for control #8 (No such file or directory)
/usr/sbin/alsactl: set_control:1325: failed to obtain info for control #9 (No such file or directory)
/usr/sbin/alsactl: set_control:1325: failed to obtain info for control #10 (No such file or directory)
/usr/sbin/alsactl: set_control:1325: failed to obtain info for control #11 (No such file or directory)
/usr/sbin/alsactl: set_control:1325: failed to obtain info for control #12 (No such file or directory)
/usr/sbin/alsactl: set_control:1325: failed to obtain info for control #13 (No such file or directory)
/usr/sbin/alsactl: set_control:1325: failed to obtain info for control #14 (No such file or directory)
/usr/sbin/alsactl: set_control:1325: failed to obtain info for control #15 (No such file or directory)
So I now have the audio state being recognized by the kernel. But it is still using a generic method to initialize the card. On to the next problem...
Any insight to this problem would be appreciated. Am I missing another piece of the recipe?
Hi Paul
one can check if necessary clocks provided for codec. Also
sgtl5000 is not integrated on NXP/FSL i.MX6 BSPs, however one can look
at boundarydevices releases where it works on sabrelite board:
https://boundarydevices.com/audio-output-selection-under-linux-on-i-mx6/
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thanks for the response. They seem to be few and far between.
The SGTL5000 CODEC on our board is clocked directly by a 14.318 MHz oscillator. The device tree specifies this:
clocks { | |||
codec_osc: codec_osc { | |||
compatible = "fixed-clock"; | |||
#clock-cells = <0>; | |||
clock-frequency = <14318000>; | |||
}; | |||
}; |
After reviewing the Boundary Devices device tree, I tried to make my device tree entries look as close to theirs as possible (other than the clock). This had no effect.
When I review the /var/lib/alsa/asound.state file in the kernel, there is no state entry for the sgtl5000audio device. There is only one for the wm8962audio device. Is this file built during the kernel build? Where can it be configured?
I tried to copy a known good asound.state file but this did not help.
I believe my Linux configuration is correct. My settings are below.
It appears that the kernel recognizes the audio settings I desire. I believe the problem is that the asound.state config file is not being built for the sgtl5000 but for the wm8962 instead. As you can see below I have the wm8962 device disabled.
Can you provide any insight into how this file is built?
#
# SoC Audio for Freescale CPUs
#
#
# Common SoC Audio options for Freescale CPUs:
#
CONFIG_SND_SOC_FSL_ASRC=y
CONFIG_SND_SOC_FSL_SAI=y
CONFIG_SND_SOC_FSL_SSI=y
CONFIG_SND_SOC_FSL_SPDIF=y
CONFIG_SND_SOC_FSL_ESAI=y
CONFIG_SND_SOC_FSL_UTILS=y
CONFIG_SND_SOC_FSL_HDMI=y
CONFIG_SND_SOC_IMX_PCM_DMA=y
CONFIG_SND_SOC_IMX_AUDMUX=y
CONFIG_SND_IMX_SOC=y
CONFIG_SND_SOC_IMX_PCM_FIQ=y
CONFIG_SND_SOC_IMX_HDMI_DMA=y
#
# SoC Audio support for Freescale i.MX boards:
#
# CONFIG_SND_SOC_EUKREA_TLV320 is not set
CONFIG_SND_SOC_IMX_CS42888=y
# CONFIG_SND_SOC_IMX_WM8962 is not set
CONFIG_SND_SOC_IMX_SGTL5000=y
# CONFIG_SND_SOC_IMX_MQS is not set
# CONFIG_SND_SOC_IMX_SPDIF is not set
# CONFIG_SND_SOC_IMX_MC13783 is not set
CONFIG_SND_SOC_IMX_HDMI=y
# CONFIG_SND_SOC_IMX_SI476X is not set
CONFIG_SND_SOC_I2C_AND_SPI=y
CONFIG_SND_SOC_CS42XX8=y
CONFIG_SND_SOC_CS42XX8_I2C=y
CONFIG_SND_SOC_HDMI_CODEC=y
CONFIG_SND_SOC_SGTL5000=y
CONFIG_SND_SOC_SI476X=y
# CONFIG_SND_SIMPLE_CARD is not set
# CONFIG_SOUND_PRIME is not set