WM8960 on audmux interafce

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

WM8960 on audmux interafce

1,962 Views
jeroenvanderlaa
Contributor III

I'm having trouble with the WM8960 on my board. It is connected to the AUDMUX of my imx6sx. My .dts file contains an entry for an audio codec defiend as follows:

sound {
    compatible = "fsl,imx-audio-wm8960";
    model = "wm8960-audio";
    cpu-dai = <&sai1>;
    audio-codec = <&wm8960>;
    ssi-controller = <&ssi1>;
    codec-master;
    audio-routing =
        "Headphone Jack", "HP_L",
        "Headphone Jack", "HP_R",
        "Ext Spk", "SPK_LP",
        "Ext Spk", "SPK_LN",
        "Ext Spk", "SPK_RP",
        "Ext Spk", "SPK_RN",
        "LINPUT1", "Main MIC",
        "Main MIC", "MICB";
        mux-int-port = <1>;
        mux-ext-port = <6>;
};

&i2c3 {
 clock-frequency = <100000>;
 pinctrl-names = "default";
 pinctrl-0 = <&pinctrl_i2c3>;
 status = "okay";

 wm8960:codec@1a {
 compatible = "wlf,wm8960";
 reg = <0x1a>;
 clocks = <&clks IMX6SX_CLK_SSI1_IPG>,
 <&clks IMX6SX_CLK_SSI1>;
 clock-names = "ipg", "mclk";
 wlf,shared-lrclk;
 };
};
&ssi1{
    fsl,mode = "i2s-slave";
    assigned-clocks = <&clks IMX6SX_CLK_SSI1_SEL>,
              <&clks IMX6SX_CLK_SSI1>;
    assigned-clock-rates = <0>, <12288000>;
    status = "okay";


};

&sai1{
    pinctrl-names = "default";
   format  = "i2s";
   status = "okay";
};

&audmux{
    pinctrl-names = "default";
    pinctrl-0 = <&AUDIO>;
    status = "okay";
};
   AUDIO: AUDIOgrp {

            fsl,pins = <
                MX6SX_PAD_ENET1_MDIO__AUDMUX_MCLK          0x000010B0
                MX6SX_PAD_SD2_CLK__AUDMUX_AUD6_RXFS        0x000010B0
                MX6SX_PAD_SD2_DATA0__AUDMUX_AUD6_RXD       0x000010B0
                MX6SX_PAD_SD2_DATA1__AUDMUX_AUD6_TXC       0x000010B0
                MX6SX_PAD_SD2_DATA2__AUDMUX_AUD6_TXFS      0x000010B0
                MX6SX_PAD_SD2_DATA3__AUDMUX_AUD6_TXD       0x000010B0
            >;
        };

ALSA sees the codec with this configuration and I can playback audio files, but there is no sound and there are PCM write errors. My main concern is that I don't know how to connect the SAI to the MUX. I think I've got the SAI in the right mode for the communication with the wm8960.

Can somebody give me pointers on how to continue?

Best regards Jeroen van der Laan

Labels (2)
2 Replies

1,072 Views
igorpadykov
NXP Employee
NXP Employee

Hi Jeroen

AUDMUX can be used (connected) only with SSI, not SAI,

so should be cpu-dai = <&ssi>;

Please check Figure 17-1. AUDMUX Block Diagram i.MX6SX ReferenceManual

http://cache.freescale.com/files/32bit/doc/ref_manual/IMX6SXRM.pdf

and use wm8962 dts example from imx6sx-sdb.dtsi

linux-imx.git - i.MX Linux Kernel 

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

1,072 Views
jeroenvanderlaa
Contributor III

Hi Igor,

thanks for the reply and the pointer in the right direction. I am a bit further now but unfortunately I'm not there yet. The wm8960 seems to be written for a SAI context only. I have commented out the part where there is a check for an opened sai stream.

static int imx_hifi_startup(struct snd_pcm_substream *substream)
{
   struct snd_soc_pcm_runtime *rtd = substream->private_data;
   struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
   struct snd_soc_card *card = rtd->card;
   struct imx_wm8960_data *data = snd_soc_card_get_drvdata(card);
   bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
   struct fsl_sai *sai = dev_get_drvdata(cpu_dai->dev);
   int ret = 0;

/*
   data->is_stream_opened[tx] = true;
   if (data->is_stream_opened[tx] != sai->is_stream_opened[tx] ||
       data->is_stream_opened[!tx] != sai->is_stream_opened[!tx]) {
      data->is_stream_opened[tx] = false;
      return -EBUSY;
   }*/

I have also needed to

When I leave this in I'm getting busy (-16) errors for playback.

Now I'm still getting IO errors on the default PCM with aplay with this check commented out. It seems to me that there is something wrong with the SSI interafce but I haven't found out what.

I'm now looking at the following driver for an SSI  interface but it's quite hard to port to 4.1.15:

https://community.nxp.com/docs/DOC-106295 

Any suggestions are still very welcome.

Best regards

Jeroen

0 Kudos