AnsweredAssumed Answered

SSI-AC97 and WM9712 integration

Question asked by Matej Kupljen on Sep 2, 2019
Latest reply on Sep 3, 2019 by Matej Kupljen

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

Outcomes