xilinx mpsoc SGTL5000 no soundcards found

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

xilinx mpsoc SGTL5000 no soundcards found

Jump to solution
2,064 Views
tianyi2
Contributor I

我在使用xilinx mpsoc(5ev)中使用到了nxp的sgtl5000,用petalinux 2019.1编译了该程序。

在运行时aplay -l,显示no soundcards found.

请问在哪里可以找到sgtl5000的驱动以及设备树是怎么写的?

0 Kudos
1 Solution
1,776 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hi,

   上面和你说过,Linux ALSA SoC driver的架构,分成三个部分,分别是平台端,codec端,Machine driver。而平台端,是你使用的CPU端I2S的驱动端,codec端就是SGTL5000的驱动端。而Machine driver,就是把CPU的DAI(数字音频接口)和CODEC的DAI连接起来,构成一个dai link结构,这个Machine driver需要你自己去写,而且它在device tree里面就是一个sound节点,加载的就是这个mahcine driver的名字。

   我们这边只能给你提供一个思路,因为平台端不是我们NXP的,我们也不知道他的Platform driver是怎么样的。 声卡如何加上去,一般都是CPU端的厂商给予支持。

   我们的客户也是这样,使用别人的声卡,用我们的CPU,那么我也要给客户支持,提供思路把声卡加入到我们的平台上来。

   你说的SSI1,就是我们CPU端的I2S接口,而你用的CPU端I2S,不叫这个名字,所以,你要读一下platform driver,或者看他们EVK的BSP默认的machine driver是怎么写,参考它可以写你一个你自己的基于sgtl5000的machine driver。

As you mentioned above, the architecture of Linux ALSA SoC driver is divided into three parts: platform side, codec side and machine driver. The platform side is the driver side of I2S on the CPU side, and the codec side is the driver side of SGTL5000. Machine driver, which links the DAI of CPU and the DAI of CODEC, forms a Dai link structure. This machine driver needs to be written by yourself, and it is a sound node in the device tree, which loads the name of the mahcine driver.


We can only provide you with a way of thinking, because the platform is not our NXP, we do not know what his Platform Driver is like. How to add sound card is generally supported by CPU manufacturers.


Our customers are the same, using other people's voice cards, using our CPU, then I also want to give customer support, provide ideas to add voice cards to our platform.

伟东

View solution in original post

0 Kudos
7 Replies
1,775 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hi,

   See attahment, please!

  

BR,

Weidong

0 Kudos
1,776 Views
tianyi2
Contributor I

首先,谢谢您的回复!

1、我将设备树修改的部分改成

/include/ "system-conf.dtsi"
/ {
regulators {
compatible = "simple-bus";
#address-cells = <1>;
#size-cells = <0>;

reg_1p8v: regulator@0 {
compatible = "regulator-fixed";
reg = <0>;
regulator-name = "1P8V";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
};

};
};


&i2c0 {
clock-frequency = <100000>;
pinctrl-names = "default";
status = "okay";

codec: sgtl5000@0a {
compatible = "fsl,sgtl5000";
reg = <0x0a>;
VDDA-supply = <&reg_1p8v>;
VDDIO-supply = <&reg_1p8v>;
};
};

我不明白reg = <0>;此处的含义,能不能解释一下,另外此处电压是1.8V,这是硬件规定的。

2、内核部分,我仍然使用的是原来的sgtl5000.c,因为使用你给我的文件内核是编译不过的,内核版本为4.19.0。

3、相关的内核打印是

[ 4.257202] dwc3-of-simple ff9d0000.usb0: dwc3_simple_set_phydata: Can't find usb3-phy
[ 4.265687] dwc3 fe200000.dwc3: Failed to get clk 'ref': -2
[ 4.272880] sgtl5000 1-000a: Linked as a consumer to regulator.1
[ 4.279078] cdns-i2c ff020000.i2c: 100 kHz mmio ff020000 irq 34
[ 4.285438] cdns-i2c ff030000.i2c: 400 kHz mmio ff030000 irq 35
[ 4.322814] mmc0: SDHCI controller on ff160000.mmc [ff160000.mmc] using ADMA 64-bit
[ 4.338861] rtc_zynqmp ffa60000.rtc: setting system clock to 1970-01-01 00:00:06 UTC (6)
[ 4.346946] of_cfs_init
[ 4.349397] of_cfs_init: OK
[ 4.352316] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[ 4.388815] mmc0: new SDHC card at address 0001
[ 4.393842] mmcblk0: mmc0:0001 SD8GB 7.28 GiB (ro)
[ 4.400679] mmcblk0: p1
[ 4.496714] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[ 4.503252] clk: Not disabling unused clocks
[ 4.507520] ALSA device list:
[ 4.510470] No soundcards found.
[ 4.514117] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[ 4.522722] cfg80211: failed to load regulatory.db
[ 4.527696] Freeing unused kernel memory: 832K
[ 4.550837] Run /init as init process

4、请帮我分析下为什么还是没有声卡?

0 Kudos
1,776 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hi,

   Linux ALSA SoC driver inlcudes 3 parts:

1. Platform driver: CPU I2S or audio port of CPU

2. codec driver:  like SGTL5000.c

3. Machine driver:  it is used to connect CPU I2S DAI to CODEC I2S DAI.

From your booting logs, it seems that there are some issues on you machine driver.

你的系统中regulator和我们I.MX处理器的开发板是不一样的,那么dts节点配置也是不同。你现在遇到的问题,不是和regulator有关系。而是,你的machine driver没有正常的把CPU DAI和CODEC DAI连接起来,形成 dai link,所以,你要检查Machine driver. 这个Machine driver才是真正意义上sound card,你的dts里似乎没有sound节点。

Have a nice day!

BR,

Weidong

0 Kudos
1,776 Views
tianyi2
Contributor I

Hi

按照您的建议,我修改了设备树,如下,但是编译的时候说ssi1找不到定义,能不能给出ssi1的定义。谢谢!

/include/ "system-conf.dtsi"
/ {
regulators {
compatible = "simple-bus";
#address-cells = <1>;
#size-cells = <0>;

reg_1p8v: regulator@0 {
compatible = "regulator-fixed";
reg = <0>;
regulator-name = "1P8V";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
};

};
sound {
compatible = "fsl,imx-audio-sgtl5000";
model = "imx6q-sabrelite-sgtl5000";
ssi-controller = <&ssi1>;
audio-codec = <&codec>;
audio-routing =
"MIC_IN", "Mic Jack",
"Mic Jack", "Mic Bias",
"Headphone Jack", "HP_OUT";
mux-int-port = <1>;
mux-ext-port = <4>;
};
ssi1 {
status = "okay";
};

};


&i2c0 {
clock-frequency = <100000>;
pinctrl-names = "default";
status = "okay";

codec: sgtl5000@0a {
compatible = "fsl,sgtl5000";
reg = <0x0a>;
VDDA-supply = <&reg_1p8v>;
VDDIO-supply = <&reg_1p8v>;
};
};

0 Kudos
1,777 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hi,

   上面和你说过,Linux ALSA SoC driver的架构,分成三个部分,分别是平台端,codec端,Machine driver。而平台端,是你使用的CPU端I2S的驱动端,codec端就是SGTL5000的驱动端。而Machine driver,就是把CPU的DAI(数字音频接口)和CODEC的DAI连接起来,构成一个dai link结构,这个Machine driver需要你自己去写,而且它在device tree里面就是一个sound节点,加载的就是这个mahcine driver的名字。

   我们这边只能给你提供一个思路,因为平台端不是我们NXP的,我们也不知道他的Platform driver是怎么样的。 声卡如何加上去,一般都是CPU端的厂商给予支持。

   我们的客户也是这样,使用别人的声卡,用我们的CPU,那么我也要给客户支持,提供思路把声卡加入到我们的平台上来。

   你说的SSI1,就是我们CPU端的I2S接口,而你用的CPU端I2S,不叫这个名字,所以,你要读一下platform driver,或者看他们EVK的BSP默认的machine driver是怎么写,参考它可以写你一个你自己的基于sgtl5000的machine driver。

As you mentioned above, the architecture of Linux ALSA SoC driver is divided into three parts: platform side, codec side and machine driver. The platform side is the driver side of I2S on the CPU side, and the codec side is the driver side of SGTL5000. Machine driver, which links the DAI of CPU and the DAI of CODEC, forms a Dai link structure. This machine driver needs to be written by yourself, and it is a sound node in the device tree, which loads the name of the mahcine driver.


We can only provide you with a way of thinking, because the platform is not our NXP, we do not know what his Platform Driver is like. How to add sound card is generally supported by CPU manufacturers.


Our customers are the same, using other people's voice cards, using our CPU, then I also want to give customer support, provide ideas to add voice cards to our platform.

伟东

0 Kudos
1,776 Views
tianyi2
Contributor I

Hi,Wigros

现在可以linux可以检测到声卡了,但是遭到了新的问题,首先把sgtl5000寄存器列出来,如下:

遇到的问题:

1.播放声音32000hz,16bit,算出来的i2s sclk应该是2*32000*16 = 1024000,但是量到的频率是3M多

2.i2s sclk有信号,但是播放声音时,i2s datain没波形,请看一下寄存器配置是否正确,谢谢!

0xa0 0x11 0x00 0x71 0x00 0x01 0x01 0x30 0x01 0x10 0x00 0x10 0x00 0x00 0x02 0x00 0x3c 0x3c 0x3c 0x3c 0x01 0x5f 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x18 0x18 0x00 0x22 0x00 0x08 0x00 0x41 0x00 0x00 0x03 0x04 0x0f 0x0f 0x7a 0xfb 0x50 0x00 0x08 0x00 0x00 0x17 0x01 0xc0 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

Thanks

0 Kudos
1,776 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hello Yun,

    Please help to recreate a  ticket for your new question on community !

Thanks!

BR,

Weidong

0 Kudos