Two devices sharing SAI in imx6Ull

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

Two devices sharing SAI in imx6Ull

2,951 Views
maash
Contributor II

Hi.

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>;
   fsl,sai-mclk-direction-input;
   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 = <
      MX6UL_PAD_CSI_DATA02__SAI1_RX_SYNC 0x10B0
      MX6UL_PAD_CSI_DATA03__SAI1_RX_BCLK 0x10B0
      MX6UL_PAD_CSI_DATA04__SAI1_TX_SYNC 0x10B0
      MX6UL_PAD_CSI_DATA05__SAI1_TX_BCLK 0x10B0
      MX6UL_PAD_CSI_DATA06__SAI1_RX_DATA 0x10B0
      MX6UL_PAD_CSI_DATA07__SAI1_TX_DATA 0x10B0
   >;
};

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-1.1.4.1/src/pcm/pcm_dmix.c:1099:(snd_pcm_dmix_open) 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) {
            dev_err(component->dev,
                "Trying to bind component to card \"%s\" but is already bound to card \"%s\"\n",
                card->name, component->card->name);
            return -ENODEV;
        }
        return 0;
    }
#endif

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.

Labels (3)
0 Kudos
Reply
5 Replies

2,582 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hi, Matti ,

    Could you provide the following information for me?

1. Full cards list

-aplay -l

-arecord -l

then paste them here.

2. Full schematic or connections between CPU and codecs

Have a nice day!

NXP TIC weidong sun

0 Kudos
Reply

2,582 Views
maash
Contributor II

Hi.

Sorry for the delay, was hold up on other stuff:

root@imx6ul-var-dart:~# arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: imxcx2092xi2s [imx-cx2092x-i2s], device 0: System Capture cx2092x-aif-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0

root@imx6ul-var-dart:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 1: imxcx2072xi2s [imx-cx2072x-i2s], device 0: System Playback cx2072x-dsp-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0

And as sidenote, when only one device is configured in the device tree (cx2092x or cx2072x) no crashes are observed.

I don't have schematic at hand as this was hand propped as demo. But I'll try to walk you trough this:

1. Codec(cx2092x) is I2S master and supplies blck & lrclk for both devices.

2. Connections in imx6 side. This is what our HW guy told me:

   Bclk  -> gpio4_24

   lrclk   -> gpio4_23

   rxd     -> gpio4_27

   txd     -> gpio4_28

kytkenta.jpg

HOWEVER. We do not schematics for the variscite imx6ul var som. For example the varicite pin header places the sai1_tx_bclk to csi_data07 pin, however that doesn't match the corresponding register iomuxc_sw_mux_ctl_pad_csi_data07.

Also could you tell me why iomuxc_sw_mux_ctl_pad_csi_data07 register doesn't contain configuration for csi_data07, but csi_data09 as alt0?

0 Kudos
Reply

2,582 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hi, Matti,

   Below is IOMUX PINs for SA1 of I.MX6ULL, if you don't have schematic, we all don't know which pins cpu have used for 2 CODECs, which cause we don't know how to configure IO multiplexing .

   So I doubt there is something wrong with IOMUX in dts for SAI1

pastedImage_5.png

Connections hardware engineer told you are not correct, she should told you pins name of I.MX6LL for SAI1 interface, then you will know to configure them in dts.

Have a nice day!

NXP TIC weidong sun

0 Kudos
Reply

2,582 Views
maash
Contributor II

Hi.

If you check those gpio pins, they actually match to correct cpu pad, but with different ALT function. He used the gpio name just to identify the pin name.

0 Kudos
Reply

2,582 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Any update?

0 Kudos
Reply