AnsweredAssumed Answered

Two devices sharing SAI in imx6Ull

Question asked by Matti Sillanpää on Oct 15, 2018
Latest reply on Oct 25, 2018 by Matti Sillanpää



We've  used the shared SAI/I2S with IMX7D and kernel 4.1.15 without any problems. Also worth noting is that the imx acts as I2S slave for the codecs so that the codecs provide the bclk and frame clock.


However we've jumped to IMX6ULL from Varicite and it uses 4.9.11_1.0.0_ga kernel. There it doesn't seem to work (kernel panic when we try to record audio) and we suspect that our SAI configuration is wrong.


From .dts file:

sound@1 {
   compatible = "cnxt,imx-cx2092x-i2s";
   ssi-controller = <&sai1>;
    nxp,audio-codec = <&sound_record>;
   no-audmux = "true";

sound@2 {
   compatible = "cnxt,imx-cx2072x-i2s";
   ssi-controller = <&sai1>;
    nxp,audio-codec = <&sound_playback>;
    no-audmux = "true";


&sai1 {
   pinctrl-names = "default";
   pinctrl-0 = <&pinctrl_sai1>;
   assigned-clocks = <&clks IMX6UL_CLK_SAI1_SEL>,
   <&clks IMX6UL_CLK_SAI1>;
   assigned-clock-parents = <&clks IMX6UL_CLK_PLL4_AUDIO_DIV>;
   assigned-clock-rates = <0>, <12288000>;
   status = "okay";


&i2c2 {
   clock_frequency = <100000>;
   pinctrl-names = "default";
   pinctrl-0 = <&pinctrl_i2c2>;
   status = "okay";

   sound_playback: cx2072x@33 {
      compatible = "cnxt,cx20721";
      reg = <0x33>;
      status = "okay";

   sound_record: cx2029x@41 {
      compatible = "cnxt,cx20921";
      reg = <0x41>;
      status = "okay";

pinctrl_sai1: sai1grp {
   fsl,pins = <


I can see that the devices probe ok, and they are listed. However neither playback nor record work. Playback just complains about unable to open slave:

   root@imx6ul-var-dart:~# aplay /./usr/share/sounds/alsa/Front_Center.wav
   ALSA lib ../../../alsa-lib- unable to open slave
   aplay: main:807: audio open error: No such file or directory

However kernel crashes when trying to record:

 root@imx6ul-var-dart:~# arecord test.wav
 Unable to handle kernel NULL pointer dereference at virtual address 00000534
 pgd = 9dae0000
 [00000534] *pgd=9dafd835, *pte=00000000, *ppte=00000000
 Internal error: Oops: 17 [#1] PREEMPT SMP ARM
 Modules linked in: brcmfmac brcmutil
 CPU: 0 PID: 683 Comm: arecord Not tainted 4.9.11-mx6ul+gb200f6d #25
 Hardware name: Freescale i.MX6 UltraLite (Device Tree)
 task: 9d4d4000 task.stack: 9d9c6000
 PC is at dapm_power_widgets+0x90/0x790
 LR is at snd_soc_dapm_stream_event+0x70/0x7c


One interesting note is that in 4.9 kernel soc-core.c probe function shared sai interface was blocked:

#if 0
    if (component->card) {
        if (component->card != card) {
                "Trying to bind component to card \"%s\" but is already bound to card \"%s\"\n",
                card->name, component->card->name);
            return -ENODEV;
        return 0;

This code was missing from kernel 4.1.15 and I had to flag it out to make the probe working.


Any ideas/comments would be appreciated.