IMX8DX (Iris like) with a ICS 43434 audio (microphone on I2S) - device tree question

I have a ICS-43434 microphone connected with I2S to the IMX8DX CPU (Colibri). Our system is closed to the Iris board, but with another Audio chip. We use Torizon Os 6 version 6.5.0+build.8.
I was able to disable the SGLT5000 from the Colibri and add the ICS-43434, I can see it in the system:

root@32708f6ff5ab:/home/torizon# arecord --list-devices
**** List of CAPTURE Hardware Devices ****
card 0: ics43434 [ics43434], device 0: 59050000.sai-ics43432-hifi ics43432-hifi-0 [59050000.sai-ics43432-hifi ics43432-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

But I get an error when I try to record:
arecord: pcm_read:2221: read error: Input/output error

My guess is that I missing the clock configuration in my device tree, here what I have:

#include "imx8dx-colibri.dtsi"

/ {
	model = "Toradex Colibri iMX8DX on Hygie MainBoard v1";
	compatible =
		"toradex,colibri-imx8x", "fsl,imx8qxp", "fsl,imx8dx";

	aliases {
		rtc0 = &rtc_i2c;
		rtc1 = &rtc;
	};

	/* No sgtl5000 on Hygie */
	sound_card: sound-card {
		status = "disable";
	};

	/* ICS 43434 microphone */
	sound2: sound-2 {
		compatible = "simple-audio-card";
		simple-audio-card,name = "ics43434";
		simple-audio-card,format = "i2s";
		simple-audio-card,bitclock-master = <&dailink2>;
		simple-audio-card,frame-master = <&dailink2>;
		status = "okay";

		dailink2: simple-audio-card,codec {
			sound-dai = <&ics43432>;
			clocks = <&sai1_lpcg 0>;
		};

		simple-audio-card,cpu {
			sound-dai = <&sai1>;
		};

	};

	ics43432: codec@0 {
		#sound-dai-cells = <0>;
		compatible = "invensense,ics43432";
		assigned-clock-rates = <786432000>, <49152000>, <12000000>, <12000000>;
		status = "okay";
	};
};

 [...]

	/* Override Colibri pinctrl_lpuart3_ctrl, those pins are used differently on Hygie */
	pinctrl_lpuart3_ctrl: lpuart3ctrlgrp {
		fsl,pins =
			<IMX8QXP_SAI1_RXD_ADMA_SAI1_RXD 0x06000040>, /* SODIMM  25, SAI1 RXD */
			<IMX8QXP_SAI1_RXC_ADMA_SAI1_TXC 0x0E000040>;  /* SODIMM 27, I2S_SCK */	};

	/* Override Colibri pinctrl_hog0, those pins are used differently on Hygie */
	pinctrl_hog0: hog0grp {
		fsl,pins = <IMX8QXP_SAI1_RXFS_ADMA_SAI1_TXFS 0x0E000040>;  /* SODIMM 100, I2S_WS */
	};

	/* Override Colibri PWM_A, those pins are used differently on Hygie */
	pinctrl_pwm_a: pwmagrp {
		fsl,pins = <IMX8QXP_SPI0_CS1_ADMA_SAI1_TXD 0x16000040>;  /* SODIMM 59, I2S_SDOUT */
	};

[...]

/* I2S for Microphone */
&sai1 {
    #sound-dai-cells = <0>;
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_pwm_a>, <&pinctrl_lpuart3_ctrl>, <&pinctrl_hog0>;
    status = "okay";
};

Could anyone help me with the device tree and the SAI clock configuration? Shall I do something else for the activation of the SAI (power?) ? Or maybe I cannot use SAI1 for my ICS 43434 audio chip?

Any help would be greatly appreciated !

Greetings @masterfoo,

I just want to clarify something with you first. You said:

Our system is closed to the Colibri,

Does this mean you are not using our Colibri i.MX8X then? If not then what hardware are you using exactly?

Best Regards,
Jeremias

Oh, I’m really sorry, I meant Iris, not Colibri. I fixed that in my request.

So are you using our Colibri i.MX8X module but a custom carrier board that is based on our iris-board? Or is your hardware setup completely custom including the module?

Best Regards,
Jeremias

Yes, we use the Colibri i.MX8X module with a custom carrier board, and we have a ICS-43434 microphone on that carrier board (named Hygie).

Yes, we use the Colibri i.MX8X module with a custom carrier board, and we have a ICS-43434 microphone on that carrier board (named Hygie).

Thank you for clarifying. Now as for your issue here. I found a similar thread where another customer got the ICS-43432 microphone working on i.MX7: I2S Clock Frequency

Looking at this thread, it seems the assigned-clock-rates node should not be in the codec node, rather the sai node.

As for additional information. When you boot the device do you see any logs in dmesg that related to this audio codec that might provide further information.

Best Regards,
Jeremias

Hello,

I tried to move assigned-clock-rates in the SAI node but I still have the same error message from arecord.
Maybe I should also add assigned-clock-parents, but all the values I tried give me the error message clk: couldn't get parent clock 0 for /bus@59000000/sai@59050000 in dmesg.
Could you help me with the clock configuration, I’m really lost as it’s the first time I do that job…
My DTS file looks like this now:
imx8dx-colibri-hygie-custom.dts (7.0 KB)

Thank you for the support.

I think I found a better example to go off of. I looked at the device tree for the imx8x-mek from NXP: imx8x-mek.dtsi « freescale « dts « boot « arm64 « arch - linux-toradex.git - Linux kernel for Apalis, Colibri and Verdin modules

Here they add an audio codec (different audio codec than you but same concept), using sai1. In their audio codec node the have assigned-clocks and assigned-clock-rates. In the sai1 node they have the same nodes it seems. Perhaps try mimicking this.

Sorry for not being able to provide more exact instructions I don’t have the same audio codec that you have here so I can’t run my own tests.

Best Regards,
Jeremias

I’m still struggling with this microphone…
This is the clock summary I have when trying to record:

As you see I’m using now PLL1. But I’ve never seen sai1_lpcg_mclk enable, what am I missing here?

I looked at all other opened issues but none of them were fixed, I cannot find a working example using an internal clock.

Maybe what could help me is using a debug version of the kernel. How can I do that? Currently I’m using the image torizon-core-docker-colibri-imx8x-Tezi_6.5.0+build.8.tar with torizoncore-builder.

Any help appreciated :slight_smile:

Hello @masterfoo,

Sorry for the delay on this topic.

We will look into this issue and try to give some indications of what may be wrong here.

Best Regards,
Bruno