imx8mm sai and alsa issues

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

imx8mm sai and alsa issues

Jump to solution
3,352 Views
L30
Contributor II

Hi everyone, first thing :

I've already searched but i didn't find anything useful, so i want to apologize if this issue has already been resolved, in this case if you guys can point me to the right post i will be glad to close this one and mark it as solved.


Our company is working on creating a board based on imx8mm SOC (right now we are working on a Kontron development board).

One of our goals is to have an ALSA audio device with at least 4 in and 4 out (32 bit samples) so i'm trying to create a device tree and produce all the necessary kernel patches.

In the meantime we are working with the Kontron development board and the Yocto BSP to create the OS and right now i'm stuck with a device-tree that compiles correctly BUT i'm unable to see my ALSA simple-soundcard.

The SAI device we were planning to use is SAI3, with imx8mm set as masterclock (I don't know if that's the case -i doubt it- but our devel board doesn't expose the SAI pin we need to make TDM audio out so the only test i can perform is to see the TDM device under ALSA and trying to use it).

We are trying to use kernel V5.10 and this is the custom device-tree file

/*
* imx8mm custom board device tree file
*/

/dts-v1/;

#include "imx8mm-kontron-n801x-som.dtsi"
#include <dt-bindings/net/mscc-phy-vsc8531.h>


/ {
	model = "Custom Kontron i.MX8MM board";
	compatible = "kontron,imx8mm-n801x-s", "kontron,imx8mm-n801x-som", "kontron,kontron-mx8mm", "fsl,imx8mm";

	aliases {
		ethernet1 = &usbnet;
	};

	/* fixed crystal dedicated to mcp2515 */
	osc_can: clock-osc-can {
		compatible = "fixed-clock";
		#clock-cells = <0>;
		clock-frequency = <16000000>;
		clock-output-names = "osc-can";
	};

	leds {
		compatible = "gpio-leds";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_gpio_led>;

		led1 {
			label = "led1";
			gpios = <&gpio4 17 GPIO_ACTIVE_LOW>;
			linux,default-trigger = "heartbeat";
		};

		led2 {
			label = "led2";
			gpios = <&gpio4 19 GPIO_ACTIVE_LOW>;
		};

		led3 {
			label = "led3";
			gpios = <&gpio4 18 GPIO_ACTIVE_LOW>;
		};

		led4 {
			label = "led4";
			gpios = <&gpio4 8 GPIO_ACTIVE_LOW>;
		};

		led5 {
			label = "led5";
			gpios = <&gpio4 9 GPIO_ACTIVE_LOW>;
		};

		led6 {
			label = "led6";
			gpios = <&gpio4 7 GPIO_ACTIVE_LOW>;
		};
	};

	reg_rst_eth2: regulator-rst-eth2 {
		compatible = "regulator-fixed";
		regulator-name = "rst-usb-eth2";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_usb_eth2>;
		gpio = <&gpio3 2 GPIO_ACTIVE_HIGH>;
		enable-active-high;
		regulator-always-on;
	};

	reg_vdd_5v: regulator-5v {
		compatible = "regulator-fixed";
		regulator-name = "vdd-5v";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		regulator-always-on;
	};

	codec_dummy: codec_dummy {
		compatible = "linux,snd-soc-dummy";
		#sound-dai-cells = <0>;
 		status = "okay";
 	};

	sound-sai3sound {
		compatible = "simple-audio-card";
		simple-audio-card,name = "I2S Audio";

		simple-audio-card,format = "i2s";
		simple-audio-card,bitclock-master = <&snd_cpu>;
		simple-audio-card,frame-master = <&snd_cpu>;
		status = "okay";

		snd_cpu: simple-audio-card,cpu {
			sound-dai = <&sai3 0>;
			dai-tdm-slot-num = <8>;
			dai-tdm-slot-width = <32>;
		};

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

};


&fec1 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_enet>;
	phy-connection-type = "rgmii-rxid";
	phy-handle = <&ethphy>;
	status = "okay";

	mdio {
		#address-cells = <1>;
		#size-cells = <0>;

		ethphy: ethernet-phy@0 {
			compatible = "ethernet-phy-id0007.0570";
			reg = <0>;
			reset-assert-us = <100>;
			reset-deassert-us = <100>;
			reset-gpios = <&gpio4 27 GPIO_ACTIVE_LOW>;
			vsc8531,led-0-mode = <VSC8531_LINK_100_1000_ACTIVITY>;
			vsc8531,led-1-mode = <VSC8531_LINK_ACTIVITY>;
			vsc8531,led-0-combine-disable;
		};
	};
};

&uart1 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_uart1>;
	uart-has-rtscts;
	status = "okay";
};

// &uart2 {
// 	pinctrl-names = "default";
// 	pinctrl-0 = <&pinctrl_uart2>;
// 	linux,rs485-enabled-at-boot-time;
// 	uart-has-rtscts;
// 	status = "okay";
// };

&usbotg1 {
	dr_mode = "otg";
	over-current-active-low;
	status = "okay";
};

&usbotg2 {
	dr_mode = "host";
	disable-over-current;
	#address-cells = <1>;
	#size-cells = <0>;
	status = "okay";

	usb1@1 {
		compatible = "usb424,9514";
		reg = <1>;
		#address-cells = <1>;
		#size-cells = <0>;

		usbnet: usbether@1 {
			compatible = "usb424,ec00";
			reg = <1>;
			local-mac-address = [ 00 00 00 00 00 00 ];
		};
	};
};

&usdhc2 {
	pinctrl-names = "default", "state_100mhz", "state_200mhz";
	pinctrl-0 = <&pinctrl_usdhc2>;
	pinctrl-1 = <&pinctrl_usdhc2_100mhz>;
	pinctrl-2 = <&pinctrl_usdhc2_200mhz>;
	vmmc-supply = <&reg_vdd_3v3>;
	vqmmc-supply = <&reg_nvcc_sd>;
	cd-gpios = <&gpio2 12 GPIO_ACTIVE_LOW>;
	status = "okay";
};

&iomuxc {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_gpio>;

	pinctrl_adv7535: adv7535grp {
		fsl,pins = <
			MX8MM_IOMUXC_SAI1_TXD4_GPIO4_IO16		0x19
		>;
	};

	pinctrl_can: cangrp {
		fsl,pins = <
			MX8MM_IOMUXC_SAI3_RXFS_GPIO4_IO28		0x19
		>;
	};

	pinctrl_dsi_sel: dsiselgrp {
		fsl,pins = <
			MX8MM_IOMUXC_SAI1_TXD2_GPIO4_IO14		0x19
		>;
	};

	pinctrl_dsi_oe: dsioegrp {
		fsl,pins = <
			MX8MM_IOMUXC_SAI1_TXD3_GPIO4_IO15		0x19
		>;
	};

	pinctrl_ecspi2: ecspi2grp {
		fsl,pins = <
			MX8MM_IOMUXC_ECSPI2_MISO_ECSPI2_MISO		0x82
			MX8MM_IOMUXC_ECSPI2_MOSI_ECSPI2_MOSI		0x82
			MX8MM_IOMUXC_ECSPI2_SCLK_ECSPI2_SCLK		0x82
			MX8MM_IOMUXC_ECSPI2_SS0_GPIO5_IO13		0x19
		>;
	};

	pinctrl_ecspi3: ecspi3grp {
		fsl,pins = <
			MX8MM_IOMUXC_UART2_RXD_ECSPI3_MISO		0x82
			MX8MM_IOMUXC_UART1_TXD_ECSPI3_MOSI		0x82
			MX8MM_IOMUXC_UART1_RXD_ECSPI3_SCLK		0x82
			MX8MM_IOMUXC_UART2_TXD_GPIO5_IO25		0x19
		>;
	};

	pinctrl_enet: enetgrp {
		fsl,pins = <
			MX8MM_IOMUXC_ENET_MDC_ENET1_MDC			0x3
			MX8MM_IOMUXC_ENET_MDIO_ENET1_MDIO		0x3
			MX8MM_IOMUXC_ENET_TD3_ENET1_RGMII_TD3		0x1f
			MX8MM_IOMUXC_ENET_TD2_ENET1_RGMII_TD2		0x1f
			MX8MM_IOMUXC_ENET_TD1_ENET1_RGMII_TD1		0x1f
			MX8MM_IOMUXC_ENET_TD0_ENET1_RGMII_TD0		0x1f
			MX8MM_IOMUXC_ENET_RD3_ENET1_RGMII_RD3		0x91
			MX8MM_IOMUXC_ENET_RD2_ENET1_RGMII_RD2		0x91
			MX8MM_IOMUXC_ENET_RD1_ENET1_RGMII_RD1		0x91
			MX8MM_IOMUXC_ENET_RD0_ENET1_RGMII_RD0		0x91
			MX8MM_IOMUXC_ENET_TXC_ENET1_RGMII_TXC		0x1f
			MX8MM_IOMUXC_ENET_RXC_ENET1_RGMII_RXC		0x91
			MX8MM_IOMUXC_ENET_RX_CTL_ENET1_RGMII_RX_CTL	0x91
			MX8MM_IOMUXC_ENET_TX_CTL_ENET1_RGMII_TX_CTL	0x1f
			MX8MM_IOMUXC_SAI2_MCLK_GPIO4_IO27		0x19 /* PHY RST */
			MX8MM_IOMUXC_SAI2_TXC_GPIO4_IO25		0x19 /* ETH IRQ */
		>;
	};

	pinctrl_gpio_led: gpioledgrp {
		fsl,pins = <
			MX8MM_IOMUXC_NAND_READY_B_GPIO3_IO16		0x19
			MX8MM_IOMUXC_SAI1_RXD5_GPIO4_IO7		0x19
			MX8MM_IOMUXC_SAI1_RXD6_GPIO4_IO8		0x19
			MX8MM_IOMUXC_SAI1_RXD7_GPIO4_IO9		0x19
			MX8MM_IOMUXC_SAI1_TXD5_GPIO4_IO17		0x19
			MX8MM_IOMUXC_SAI1_TXD6_GPIO4_IO18		0x19
			MX8MM_IOMUXC_SAI1_TXD7_GPIO4_IO19		0x19
		>;
	};

	pinctrl_gpio: gpiogrp {
		fsl,pins = <
			MX8MM_IOMUXC_GPIO1_IO03_GPIO1_IO3		0x19
			MX8MM_IOMUXC_GPIO1_IO07_GPIO1_IO7		0x19
			MX8MM_IOMUXC_GPIO1_IO09_GPIO1_IO9		0x19
			MX8MM_IOMUXC_GPIO1_IO11_GPIO1_IO11		0x19
			MX8MM_IOMUXC_GPIO1_IO06_GPIO1_IO6		0x19
			MX8MM_IOMUXC_GPIO1_IO08_GPIO1_IO8		0x19
			MX8MM_IOMUXC_GPIO1_IO10_GPIO1_IO10		0x19
			MX8MM_IOMUXC_SAI3_MCLK_GPIO5_IO2		0x19
		>;
	};

	pinctrl_i2c3: i2c3grp {
		fsl,pins = <
			MX8MM_IOMUXC_I2C3_SCL_I2C3_SCL			0x400001c3
			MX8MM_IOMUXC_I2C3_SDA_I2C3_SDA			0x400001c3
		>;
	};

	pinctrl_i2c4: i2c4grp {
		fsl,pins = <
			MX8MM_IOMUXC_I2C4_SCL_I2C4_SCL			0x400001c3
			MX8MM_IOMUXC_I2C4_SDA_I2C4_SDA			0x400001c3
		>;
	};

	pinctrl_pwm2: pwm2grp {
		fsl,pins = <
			MX8MM_IOMUXC_SPDIF_RX_PWM2_OUT			0x19
		>;
	};

	pinctrl_sn65dsi84: sn65dsi84grp {
		fsl,pins = <
			MX8MM_IOMUXC_SAI2_TXD0_GPIO4_IO26		0x19
			MX8MM_IOMUXC_SD2_WP_GPIO2_IO20			0x19
		>;
	};

	pinctrl_uart1: uart1grp {
		fsl,pins = <
			MX8MM_IOMUXC_SAI2_RXC_UART1_DCE_RX		0x140
			MX8MM_IOMUXC_SAI2_RXFS_UART1_DCE_TX		0x140
			MX8MM_IOMUXC_SAI2_RXD0_UART1_DCE_RTS_B		0x140
			MX8MM_IOMUXC_SAI2_TXFS_UART1_DCE_CTS_B		0x140
		>;
	};

	// pinctrl_uart2: uart2grp {
	// 	fsl,pins = <
	// 		MX8MM_IOMUXC_SAI3_TXFS_UART2_DCE_RX		0x140
	// 		MX8MM_IOMUXC_SAI3_TXC_UART2_DCE_TX		0x140
	// 		MX8MM_IOMUXC_SAI3_RXD_UART2_DCE_RTS_B		0x140
	// 		MX8MM_IOMUXC_SAI3_RXC_UART2_DCE_CTS_B		0x140
	// 	>;
	// };

	pinctrl_usb_eth2: usbeth2grp {
		fsl,pins = <
			MX8MM_IOMUXC_NAND_CE1_B_GPIO3_IO2		0x19
		>;
	};

	pinctrl_usdhc2: usdhc2grp {
		fsl,pins = <
			MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK			0x190
			MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD			0x1d0
			MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0		0x1d0
			MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1		0x1d0
			MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2		0x1d0
			MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3		0x1d0
			MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12		0x019
		>;
	};

	pinctrl_usdhc2_100mhz: usdhc2grp100mhz {
		fsl,pins = <
			MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK			0x194
			MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD			0x1d4
			MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0		0x1d4
			MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1		0x1d4
			MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2		0x1d4
			MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3		0x1d4
			MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12		0x019
		>;
	};

	pinctrl_usdhc2_200mhz: usdhc2grp200mhz {
		fsl,pins = <
			MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK			0x196
			MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD			0x1d6
			MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0		0x1d6
			MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1		0x1d6
			MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2		0x1d6
			MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3		0x1d6
			MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12		0x019
		>;
	};

	pinctrl_sai3: sai3grp {
		fsl,pins = <
			MX8MM_IOMUXC_SAI3_TXFS_SAI3_TX_SYNC		0xd6
			MX8MM_IOMUXC_SAI3_TXD_SAI3_TX_DATA0		0xd6
			MX8MM_IOMUXC_SAI3_TXC_SAI3_TX_BCLK		0xd6
			MX8MM_IOMUXC_SAI3_MCLK_SAI3_MCLK		0xd6
		>;
	};
};

&sai3 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_sai3>;
	assigned-clocks = <&clk IMX8MM_CLK_SAI3>;
	assigned-clock-parents = <&clk IMX8MM_AUDIO_PLL1_OUT>;
	assigned-clock-rates = <24576000>;
	fsl,sai-mclk-direction-output;
	status = "okay";
};

 

This device tree file is the result after consulting this forum / examples on the BSP and other usefull sources like this

I've also modified the kernel config (using bitbake and menuconfig) , created a fragment and appended to the yocto kernel recipe

CONFIG_SND_DMAENGINE_PCM=y
CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y
CONFIG_SND_SOC_FSL_ESAI=y

CONFIG_SND_SOC=y
CONFIG_SND=y
###########################
#
CONFIG_SND_VERBOSE_PRINTK=y
# CONFIG_SND_PCI is not set
# CONFIG_SND_SPI is not set
# CONFIG_SND_USB is not set
CONFIG_SND_SOC_FSL_AUDMIX=y

#
# SoC Audio support for Freescale i.MX boards:
# CONFIG_NETWORK_FILESYSTEMS is not set
###
CONFIG_SND_DEBUG=y
CONFIG_SND_DEBUG_VERBOSE=y
# CONFIG_SND_PCM_XRUN_DEBUG is not set
# CONFIG_SND_CTL_VALIDATION is not set
CONFIG_SND_SOC_FSL_Asrc=y
CONFIG_SND_SOC_FSL_SAI=y
# CONFIG_SND_SOC_FSL_MQS is not set
CONFIG_SND_SOC_FSL_SSI=y
CONFIG_SND_SOC_FSL_EAsrc=y
CONFIG_SND_SOC_IMX_PCM_DMA=y
CONFIG_SND_SOC_IMX_AUDMUX=y
CONFIG_SND_IMX_SOC=y

# SoC Audio support for Freescale i.MX boards:
#
# CONFIG_SND_SOC_IMX_ES8328 is not set
# CONFIG_SND_SOC_IMX_SGTL5000 is not set
# CONFIG_SND_SOC_IMX_SPDIF is not set
CONFIG_SND_SOC_FSL_ASOC_CARD=y
# CONFIG_SND_SOC_IMX_AUDMIX is not set
CONFIG_SND_SIMPLE_CARD_UTILS=y
CONFIG_SND_SIMPLE_CARD=y
CONFIG_SND_AUDIO_GRAPH_CARD=y

Things i know:

- the device-tree is correctly compiled by yocto and used by the linux kernel, in fact that's the only device-tree onboard plus if i cat the device-tree model under /proc that's the result

root@70820e12a37e:~# cat /proc/device-tree/model 
Custom Kontron i.MX8MM board

 

- under /proc/device-tree i can see my device

root@70820e12a37e:/proc/device-tree# ls -alh
total 0
-r--r--r--  1 root root  4 Jan  4 15:36 #address-cells
-r--r--r--  1 root root  4 Jan  4 15:36 #size-cells
drwxr-xr-x 27 root root  0 Jan  1  1970 .
drwxr-xr-x  3 root root  0 Jan  1  1970 ..
drwxr-xr-x  2 root root  0 Jan  4 15:36 aliases
drwxr-xr-x  2 root root  0 Jan  4 15:36 chosen
drwxr-xr-x  2 root root  0 Jan  4 15:36 clock-ext1
drwxr-xr-x  2 root root  0 Jan  4 15:36 clock-ext2
drwxr-xr-x  2 root root  0 Jan  4 15:36 clock-ext3
drwxr-xr-x  2 root root  0 Jan  4 15:36 clock-ext4
drwxr-xr-x  2 root root  0 Jan  4 15:36 clock-osc-24m
drwxr-xr-x  2 root root  0 Jan  4 15:36 clock-osc-32k
drwxr-xr-x  2 root root  0 Jan  4 15:36 clock-osc-can
drwxr-xr-x  2 root root  0 Jan  4 15:36 codec_dummy
-r--r--r--  1 root root 81 Jan  4 15:36 compatible
drwxr-xr-x  8 root root  0 Jan  4 15:36 cpus
-r--r--r--  1 root root  4 Jan  4 15:36 interrupt-parent
drwxr-xr-x  8 root root  0 Jan  4 15:36 leds
drwxr-xr-x  2 root root  0 Jan  4 15:36 memory@40000000
drwxr-xr-x  2 root root  0 Jan  4 15:36 mipi-video-phy
-r--r--r--  1 root root 37 Jan  4 15:34 model
-r--r--r--  1 root root  1 Jan  4 15:36 name
drwxr-xr-x  5 root root  0 Jan  4 15:36 opp-table
drwxr-xr-x  2 root root  0 Jan  4 15:36 pmu
drwxr-xr-x  2 root root  0 Jan  4 15:36 psci
drwxr-xr-x  2 root root  0 Jan  4 15:36 regulator-5v
drwxr-xr-x  2 root root  0 Jan  4 15:36 regulator-rst-eth2
drwxr-xr-x 14 root root  0 Jan  4 15:36 soc@0
drwxr-xr-x  4 root root  0 Jan  4 15:36 sound-sai3sound
drwxr-xr-x  3 root root  0 Jan  4 15:36 thermal-zones
drwxr-xr-x  2 root root  0 Jan  4 15:36 timer
drwxr-xr-x  2 root root  0 Jan  4 15:36 usbphynop1
drwxr-xr-x  2 root root  0 Jan  4 15:36 usbphynop2

 

The ALSA device is still missing

root@70820e12a37e:/proc/device-tree# aplay -l
aplay: device_list:272: no soundcards found...

 

Also, the kernel logs doesn't show errors , I've tryied to enable the ALSA log debug level, but nothing shows during boot (no errors, no soundcards, no warnings...only "No soundcard found...").

I'm really struggling to make this work, at least after a lot of trial/error i've made the device-tree compile correctly so i'm start thinking...am i missing something? is there some other passage i need to do , some other option i need to enable in the kernel, or alsa settings... every hint is appreciated

Feel free to ask if i've omitted some useful info

0 Kudos
Reply
1 Solution
3,292 Views
L30
Contributor II

Found a solution!

You were right @JorgeCas, the device tree was almost correct.
I found that my real issue was that the config fragment wasn't used by Yocto to patch my defconfig.
IDK why but i think that the fact that the kernel recipe of the Kontron BSP that i'm using is not requiring "linux-yocto.inc" might be the cause.
So, in order to test it i've modified the original file, but i want to export the all config and pass it to yocto through my append.

Also:

1) applied this patch, otherwise the alsa device is not initialized

---
sound/soc/soc-utils.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c
index 54dcece52b0c..892d02992b02 100644
--- a/sound/soc/soc-utils.c
+++ b/sound/soc/soc-utils.c
@@ -7,6 +7,8 @@
// Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
// Liam Girdwood <lrg@slimlogic.co.uk>

+#include <linux/module.h>
+#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/export.h>
#include <sound/core.h>
@@ -149,9 +151,18 @@ static int snd_soc_dummy_probe(struct platform_device *pdev)
return ret;
}

+#ifdef CONFIG_OF
+static const struct of_device_id soc_dummy_device_id[] = {
+ { .compatible = "asoc,snd-soc-dummy" },
+ {}
+};
+MODULE_DEVICE_TABLE(of, soc_dummy_device_id);
+#endif
+
static struct platform_driver soc_dummy_driver = {
.driver = {
.name = "snd-soc-dummy",
+ .of_match_table = of_match_ptr(soc_dummy_device_id),
},
.probe = snd_soc_dummy_probe,
};
--

2) inside the device-tree i've removed MX8MM_IOMUXC_SAI3_MCLK_GPIO5_IO2 from "pinctrl_gpio: gpiogrp" , otherwise the audio device is not correctly initialized because that pin, needed by the SAI, is already used by pinctrl.

3) also inside the device-tree i've modified the "compatible" parameter in codec_dummy node from "linux" to "asoc" (same name applied in the previous patch)

compatible = "asoc,snd-soc-dummy";


Now the device is correctly showed under alsa and i can use it with speaker-test .
IDK if the signals are correct, i haven't already tested with the oscilloscope.

View solution in original post

5 Replies
3,316 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Dear Leonardo Ulivi,

I reviewed your device tree and seems to be ok.

Could you provide me your audio codec?

Because when we want to configure correctly your device tree we need to consider:

- The SAI interface.

- The interface between the SAI and the audio codec.

- The audio codec.

Also, just to confirm, are you using our imx8mm-evk.dtsi as a reference for your design?

Best regards.

0 Kudos
Reply
3,288 Views
L30
Contributor II
I forgot to mention that yes, i was using imx8mm-evk.dtsi as reference .
BTW not everyone takes the time to reply on these forums, the fact that you gave a positive opinion on the device-tree prompted me to better check the rest of the BSP, leading to a solution.

Thank you very much!
3,293 Views
L30
Contributor II

Found a solution!

You were right @JorgeCas, the device tree was almost correct.
I found that my real issue was that the config fragment wasn't used by Yocto to patch my defconfig.
IDK why but i think that the fact that the kernel recipe of the Kontron BSP that i'm using is not requiring "linux-yocto.inc" might be the cause.
So, in order to test it i've modified the original file, but i want to export the all config and pass it to yocto through my append.

Also:

1) applied this patch, otherwise the alsa device is not initialized

---
sound/soc/soc-utils.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c
index 54dcece52b0c..892d02992b02 100644
--- a/sound/soc/soc-utils.c
+++ b/sound/soc/soc-utils.c
@@ -7,6 +7,8 @@
// Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
// Liam Girdwood <lrg@slimlogic.co.uk>

+#include <linux/module.h>
+#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/export.h>
#include <sound/core.h>
@@ -149,9 +151,18 @@ static int snd_soc_dummy_probe(struct platform_device *pdev)
return ret;
}

+#ifdef CONFIG_OF
+static const struct of_device_id soc_dummy_device_id[] = {
+ { .compatible = "asoc,snd-soc-dummy" },
+ {}
+};
+MODULE_DEVICE_TABLE(of, soc_dummy_device_id);
+#endif
+
static struct platform_driver soc_dummy_driver = {
.driver = {
.name = "snd-soc-dummy",
+ .of_match_table = of_match_ptr(soc_dummy_device_id),
},
.probe = snd_soc_dummy_probe,
};
--

2) inside the device-tree i've removed MX8MM_IOMUXC_SAI3_MCLK_GPIO5_IO2 from "pinctrl_gpio: gpiogrp" , otherwise the audio device is not correctly initialized because that pin, needed by the SAI, is already used by pinctrl.

3) also inside the device-tree i've modified the "compatible" parameter in codec_dummy node from "linux" to "asoc" (same name applied in the previous patch)

compatible = "asoc,snd-soc-dummy";


Now the device is correctly showed under alsa and i can use it with speaker-test .
IDK if the signals are correct, i haven't already tested with the oscilloscope.

3,104 Views
fatalerror
Contributor II

Thanks for posting the solution, excellent information! I had the same problem with an imx8mp module. NXP posted a similar setup for imx8mm in this very forum's knowledge base but I could not get that to work with 5.x kernels. With the subtle differences you figured out it was a piece of cake...

1,691 Views
L30
Contributor II
So happy that this was usefull
Have a nice day!!
0 Kudos
Reply