SSI-AC97 and WM9712 integration

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

SSI-AC97 and WM9712 integration

1,411 Views
matej_kupljen
Contributor I

Hi all,

I am trying to enable WM9712 codec on iMX6q custom platform.

I used this DTS configuration:

sound { 
   compatible = "fsl,imx-audio-ac97"; 
   model = "fsl,imx6q-ac97"; 
   audio-cpu = <&ssi2>; 
   audio-routing = 
      "AC97 Playback", "Line Out Jack", 
      "Line In Jack", "AC97 Capture"; 
   mux-int-port = <2>; 
   mux-ext-port = <5>;

}

 

&iomuxc { 
   imx6q-phytec-pcaaxl3 { 
      pinctrl_ac97_running: ac97running { 
         fsl,pins = < 
            MX6QDL_PAD_DISP0_DAT16__AUD5_TXC 0x1b0b0 
            MX6QDL_PAD_DISP0_DAT17__AUD5_TXD 0x1b0b0 
            MX6QDL_PAD_DISP0_DAT18__AUD5_TXFS 0x1b0b0 
            MX6QDL_PAD_DISP0_DAT19__AUD5_RXD 0x1b0b0 
            MX6QDL_PAD_GPIO_17__GPIO7_IO12 0x1b0b0
         >; 
      }; 

      pinctrl_ac97_warm_reset: ac97warmreset { 
         fsl,pins = < 
            MX6QDL_PAD_DISP0_DAT16__AUD5_TXC 0x1b0b0 
            MX6QDL_PAD_DISP0_DAT17__AUD5_TXD 0x1b0b0 
            MX6QDL_PAD_DISP0_DAT18__GPIO5_IO12 0x1b0b0 
            MX6QDL_PAD_DISP0_DAT19__AUD5_RXD 0x1b0b0 
            MX6QDL_PAD_GPIO_17__GPIO7_IO12 0x1b0b0
         >; 
      }; 

      pinctrl_ac97_reset: ac97reset { 
         fsl,pins = < 
            MX6QDL_PAD_DISP0_DAT16__AUD5_TXC 0x1b0b0 
            MX6QDL_PAD_DISP0_DAT17__GPIO5_IO11 0x1b0b0 
            MX6QDL_PAD_DISP0_DAT18__GPIO5_IO12 0x1b0b0 
            MX6QDL_PAD_DISP0_DAT19__AUD5_RXD 0x1b0b0 
            MX6QDL_PAD_GPIO_17__GPIO7_IO12 0x1b0b0
         >; 
      }; 
   }; 
}; 

&audmux { 
   status = "okay"; 

   ssi2 { 
      fsl,audmux-port = <1>; 
      fsl,port-config = < 
         (IMX_AUDMUX_V2_PTCR_TFSDIR | 
         IMX_AUDMUX_V2_PTCR_TFSEL(4) | 
         IMX_AUDMUX_V2_PTCR_TCLKDIR | 
         IMX_AUDMUX_V2_PTCR_TCSEL(4)) 
         IMX_AUDMUX_V2_PDCR_RXDSEL(4) 
      >; 
   }; 

pins5 { 
   fsl,audmux-port = <4>; 
   fsl,port-config = < 
      0x00000000 
      IMX_AUDMUX_V2_PDCR_RXDSEL(1) 
   >; 
   }; 
};

 

&ssi2 { 
   status = "okay"; 
   cell-index = <1>; 

   fsl,fiq-stream-filter;
   fsl,mode = "ac97-slave"; 
   pinctrl-names = "ac97-running", "ac97-reset", "ac97-warm-reset"; 
   pinctrl-0 = <&pinctrl_ac97_running>; 
   pinctrl-1 = <&pinctrl_ac97_reset>; 
   pinctrl-2 = <&pinctrl_ac97_warm_reset>; 
   ac97-gpios = <&gpio5 12 0 &gpio5 11 0 &gpio7 12 0>; 
};

I think the configuration for ssi2 and pins5 under audmux is not necessary since the driver overrides this values. 

When the kernel boots, the codec is correctly detected and also alsamixer shows it correctly. However, when I try to playback some WAV file, or record something I get overruns and underuns:

# aplay sample.wav

Playing WAVE 'sample.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo

underrun!!! (at least 0.143 ms long)

underrun!!! (at least 0.063 ms long)

underrun!!! (at least 0.097 ms long)

# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ac97audio [ac97-audio], device 0: HiFi ac97-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0

# cat /proc/asound/ac97audio/pcm0p/info
card: 0
device: 0
subdevice: 0
stream: PLAYBACK
id: HiFi ac97-hifi-0
name:
subname: subdevice #0
class: 0
subclass: 0
subdevices_count: 1
subdevices_avail: 1

Any ideas?

Thanks and BR,
Matej

Labels (6)
0 Kudos
4 Replies

1,169 Views
igorpadykov
NXP Employee
NXP Employee

Hi Matej

one can look on

SSI-AC97 with wm9713 makes double size record file 

also some boards support ac97 codec, like

linux/arch/arm/boot/dts/imx6qdl-udoo.dtsi

imx6qdl-udoo.dtsi\dts\boot\arm\arch - linux-imx - i.MX Linux kernel 

Some audio tests can be found in Chapter 7 Audio attached Linux Manual.

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,169 Views
matej_kupljen
Contributor I

Hi Igor,

thank you for the answer and for the references.

Actually, I checked udoo schematics and also the DTS, which was the basis for my DTS. But I guess the real big difference is that I have to specify "fsl,fiq-stream-filter;" option in the DTS, since I get other errors if the DMA is enabled.

With this DTS, I can see that the codec is detected, but I cannot play or record anything.

I think my AUDMUX settings are O.K.?

# cat /sys/kernel/debug/audmux/ssi1
PDCR: 00008000
PTCR: 05000800
TxFS input, TxClk output from SSI5
Port is symmetric
Data received from SSI5
root@phycard-imx6-ksp0083-2:~# cat /sys/kernel/debug/audmux/ssi4
PDCR: 00002000
PTCR: 88000800
TxFS output from imx-ssi.1, TxClk input
Port is symmetric
Data received from imx-ssi.1

 

Any other ideas/hints?

Thanks and BR,
Matej

0 Kudos

1,169 Views
igorpadykov
NXP Employee
NXP Employee

Hi Matej

to verify AUDMUX settings one can check signals with oscilloscope.

I think better to try use with dma. Errors may be caused if one uses non-nxp bsp,

so recommended to try with bsps from nxp linux-imx - i.MX Linux kernel 

Best regards
igor

0 Kudos

1,169 Views
matej_kupljen
Contributor I

Hi Igor,

I'll try to connect the signals with oscilloscope, if I can connect it to the lines somewhere.
Yes, I agree that is better to use DMA, but I believe I cannot use it, since they use different formats and I get error about no matching format found. That is exactly what this parameter is supposed to do. From Documentation/devicetree/bindings/sound/fsl,ssi.txt:

- fsl,fiq-stream-filter: Bool property. Disabled DMA and use FIQ instead to
filter the codec stream. This is necessary for some boards
where an incompatible codec is connected to this SSI, e.g.
on pca100 and pcm043.

What I tracked it down is that everything seems to be set up correctly, but the FIQ handler is not executed so the stream does not advance, which is handled in arch/arm/mach-imx/ssi-fiq.S.

If you check the comment in the beginning of the file sound/soc/fsl/fsl_ssi.c you can see, that with the WM9712 codec we need to use FIQ because of the limitation of this codec.

If I find the solution, I'll post it here. If someone has any more suggestion/comment/idea, I am all ears, because I already spent too much time on this.

Thanks and BR,

Matej

0 Kudos