All of lore.kernel.org
 help / color / mirror / Atom feed
* Help with wm8731 support for the Utilite (imx6q)
@ 2014-10-17 16:57 Jonathan Bennett
  2014-10-18 19:13 ` Fabio Estevam
  0 siblings, 1 reply; 20+ messages in thread
From: Jonathan Bennett @ 2014-10-17 16:57 UTC (permalink / raw)
  To: alsa-devel

Hey, I'm working with a compulab utilite, trying to get everything working
with 3.17, with the eventual goal of getting better support for it
upstream. Currently fighting the sound. It's a imx6q talking to a wm8731
over i2c/i2s.
I am booting Fedora 21 arm Alpha, with my own dtb (
http://pastebin.com/4a4PBKwx) and driver (http://pastebin.com/1CsesuVV)

It shows up in aplay -l, but trying to play anything to it gives me a div
by 0 in a driver:  [<c04f27e4>] (Ldiv0) from [<bf50512c>]
(fsl_ssi_hw_params+0x194/0x364 [snd_soc_fsl_ssi]) This div0 happens in
sound/soc/fsl/fsl_ssi.c, in the function fsl_ssi_set_bclk.

My driver file is an almost direct copy of what compulab shipped with a
3.10 kernel. This is my first attempt at kernel hacking, so any help would
be appreciated.

~Jonathan Bennett

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Help with wm8731 support for the Utilite (imx6q)
  2014-10-17 16:57 Help with wm8731 support for the Utilite (imx6q) Jonathan Bennett
@ 2014-10-18 19:13 ` Fabio Estevam
  2014-10-19  5:35   ` Jonathan Bennett
  0 siblings, 1 reply; 20+ messages in thread
From: Fabio Estevam @ 2014-10-18 19:13 UTC (permalink / raw)
  To: Jonathan Bennett; +Cc: alsa-devel, valentin

Hi Jonathan,

On Fri, Oct 17, 2014 at 1:57 PM, Jonathan Bennett <jbscience87@gmail.com> wrote:
> Hey, I'm working with a compulab utilite, trying to get everything working
> with 3.17, with the eventual goal of getting better support for it
> upstream. Currently fighting the sound. It's a imx6q talking to a wm8731
> over i2c/i2s.
> I am booting Fedora 21 arm Alpha, with my own dtb (
> http://pastebin.com/4a4PBKwx) and driver (http://pastebin.com/1CsesuVV)

I don't have access to a utilite board, but just trying to understand:
is wm8731 audio functional with the 3.10.17 kernel com compulab?

> It shows up in aplay -l, but trying to play anything to it gives me a div
> by 0 in a driver:  [<c04f27e4>] (Ldiv0) from [<bf50512c>]
> (fsl_ssi_hw_params+0x194/0x364 [snd_soc_fsl_ssi]) This div0 happens in
> sound/soc/fsl/fsl_ssi.c, in the function fsl_ssi_set_bclk.
>
> My driver file is an almost direct copy of what compulab shipped with a
> 3.10 kernel. This is my first attempt at kernel hacking, so any help would
> be appreciated.

I would suggest as a first step to get the dts for compulab upstreamed.

There was an attempt from Valentin Raevsky (added on Cc) last year:
http://lists.infradead.org/pipermail/linux-arm-kernel/2013-October/204896.html

After the basic dts file is added then you can work on adding audio support.

Some suggestions:

- The dts from 3.10.17 can not be applied 'as-is' into 3.17. Take a
look for example into the audio node you have:

        sound {
                compatible = "fsl,imx6q-cm-fx6-wm8731",
                          "fsl,imx-audio-wm8731";
                model = "wm8731-audio";
                ssi-controller = <&ssi2>;
                src-port = <2>;
                ext-port = <4>;
                audio-codec = <&codec>;
                audio-routing = "LOUT", "ROUT", "LLINEIN", "RLINEIN";
        };

'src-port' and 'ext-port' are not valid properties.

They should be like this instead:

        mux-int-port = <2>;
        mux-ext-port = <4>;

Take a look at arch/arm/boot/dts/imx6qdl-sabresd.dtsi for a reference.

Also the codec clocks that are passed into the dts are not correct.
The wm8731 does not acquire any clocks in the mainline driver.

You should also try to use the 'simple-audio-card' binding instead of
creating the imx-wm8731 machine file.

Here is a reference of the arch/arm/boot/dts/vf610-twr.dts where you
can see simple-audio-card in use.

Good luck!

Regards,

Fabio Estevam

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Help with wm8731 support for the Utilite (imx6q)
  2014-10-18 19:13 ` Fabio Estevam
@ 2014-10-19  5:35   ` Jonathan Bennett
  2014-10-19  5:58     ` Jonathan Bennett
  0 siblings, 1 reply; 20+ messages in thread
From: Jonathan Bennett @ 2014-10-19  5:35 UTC (permalink / raw)
  To: Fabio Estevam, alsa-devel, Aaron Kling

On Sat, Oct 18, 2014 at 2:13 PM, Fabio Estevam <festevam@gmail.com> wrote:

> Hi Jonathan,
>
> On Fri, Oct 17, 2014 at 1:57 PM, Jonathan Bennett <jbscience87@gmail.com>
> wrote:
> > Hey, I'm working with a compulab utilite, trying to get everything
> working
> > with 3.17, with the eventual goal of getting better support for it
> > upstream. Currently fighting the sound. It's a imx6q talking to a wm8731
> > over i2c/i2s.
> > I am booting Fedora 21 arm Alpha, with my own dtb (
> > http://pastebin.com/4a4PBKwx) and driver (http://pastebin.com/1CsesuVV)
>
> I don't have access to a utilite board, but just trying to understand:
> is wm8731 audio functional with the 3.10.17 kernel com compulab?
>
> The audio works on their pre-canned ubuntu image, which runs 3.10.


> > It shows up in aplay -l, but trying to play anything to it gives me a div
> > by 0 in a driver:  [<c04f27e4>] (Ldiv0) from [<bf50512c>]
> > (fsl_ssi_hw_params+0x194/0x364 [snd_soc_fsl_ssi]) This div0 happens in
> > sound/soc/fsl/fsl_ssi.c, in the function fsl_ssi_set_bclk.
> >
> > My driver file is an almost direct copy of what compulab shipped with a
> > 3.10 kernel. This is my first attempt at kernel hacking, so any help
> would
> > be appreciated.
>
> I would suggest as a first step to get the dts for compulab upstreamed.
>
> There was an attempt from Valentin Raevsky (added on Cc) last year:
>
> http://lists.infradead.org/pipermail/linux-arm-kernel/2013-October/204896.html
>
> After the basic dts file is added then you can work on adding audio
> support.
>
> There is already a small dts file upstreamed.  It barely works. I've been
get usb and the second ethernet port working, which I would like to get
pushed upstream. I was hoping to have more of it working before then,
though.

> Some suggestions:
>
> - The dts from 3.10.17 can not be applied 'as-is' into 3.17. Take a
> look for example into the audio node you have:
>
>         sound {
>                 compatible = "fsl,imx6q-cm-fx6-wm8731",
>                           "fsl,imx-audio-wm8731";
>                 model = "wm8731-audio";
>                 ssi-controller = <&ssi2>;
>                 src-port = <2>;
>                 ext-port = <4>;
>                 audio-codec = <&codec>;
>                 audio-routing = "LOUT", "ROUT", "LLINEIN", "RLINEIN";
>         };
>
> 'src-port' and 'ext-port' are not valid properties.
>
> They should be like this instead:
>
>         mux-int-port = <2>;
>         mux-ext-port = <4>;
>
> Take a look at arch/arm/boot/dts/imx6qdl-sabresd.dtsi for a reference.
>
> Also the codec clocks that are passed into the dts are not correct.
> The wm8731 does not acquire any clocks in the mainline driver.
>
> You should also try to use the 'simple-audio-card' binding instead of
> creating the imx-wm8731 machine file.
>
> Here is a reference of the arch/arm/boot/dts/vf610-twr.dts where you
> can see simple-audio-card in use.
>
> I am trying to use simple-audio-card, without any success. I've been
hammering at this for a couple days now. My current dts looks like
this(just the audio related bits):

        sound {
                compatible = "simple-audio-card";
                simple-audio-card,model = "wm8731-audio";
                mux-int-port = <2>;
                mux-ext-port = <4>;
                simple-audio-card,format = "i2s";
                simple-audio-card,mclk-fs = <256>;
                simple-audio-card,cpu {
                        sound-dai = <&ssi2>;
                };
                simple-audio-card,codec {
                        sound-dai = <&codec>;
                };
        };
....
/* i2c3 */
&i2c3 {
   pinctrl-names = "default";
   pinctrl-0 = <&pinctrl_i2c3>;
   status = "okay";

   eeprom@50 {
      compatible = "at24,24c02";
      reg = <0x50>;
      pagesize = <16>;
   };

   codec: wm8731@1a {
      #sound-dai-cells = <0>;
      compatible = "wlf,wm8731";
      reg = <0x1a>;
      AVDD-supply = <&reg_3p3v>;
      HPVDD-supply = <&reg_3p3v>;
      DCVDD-supply = <&reg_3p3v>;
      DBVDD-supply = <&reg_3p3v>;
   };
};
...
&ssi2 {
        fsl,mode = "i2s-master";
        status = "okay";
        #sound-dai-cells = <0>;
};


It registers:
# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: D202c000ssiwm87 [202c000.ssi-wm8731-hifi], device 0:
202c000.ssi-wm8731-hifi wm8731-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0


However:
# speaker-test

speaker-test 1.0.28

Playback device is default
Stream parameters are 48000Hz, S16_LE, 1 channels
Using 16 octaves of pink noise
Rate set to 48000Hz (requested 48[   57.443583] asoc-simple-card sound:
ASoC: machine hw_params failed: -22
000Hz)
Buffer size range from 128 to 32768
Period size range from 64 to 16384
Using max buffer size 32768
Periods = 4
Unable to set hw params for playback: Invalid argument
Setting of hwparams failed: Invalid argument




It's a wm8731 hanging off an i2c bus from an i.mx6q chip. Seems like
exactly what simple-audio-card is designed for. I imagine that there is
something simple that I am overlooking, but I'm at a loss to find it.


> Good luck!
>
> Regards,
>
> Fabio Estevam
>

Thanks for the help!
~Jonathan Bennett

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Help with wm8731 support for the Utilite (imx6q)
  2014-10-19  5:35   ` Jonathan Bennett
@ 2014-10-19  5:58     ` Jonathan Bennett
  2014-10-20 12:06       ` Fabio Estevam
  0 siblings, 1 reply; 20+ messages in thread
From: Jonathan Bennett @ 2014-10-19  5:58 UTC (permalink / raw)
  To: Fabio Estevam, alsa-devel, Aaron Kling

And a different dts that is closer to the example given:

        sound {
                compatible = "simple-audio-card";
                simple-audio-card,model = "wm8731-audio";
                mux-int-port = <2>;
                mux-ext-port = <4>;
                simple-audio-card,format = "i2s";
                simple-audio-card,cpu {
                        sound-dai = <&ssi2>;
                        master-clkdir-out;
                        frame-master;
                        bitclock-master;
                };
                simple-audio-card,codec {
                        frame-master;
                        bitclock-master;
                        sound-dai = <&codec>;
                };
        };

/* i2c3 */
&i2c3 {
   pinctrl-names = "default";
   pinctrl-0 = <&pinctrl_i2c3>;
   status = "okay";

   eeprom@50 {
      compatible = "at24,24c02";
      reg = <0x50>;
      pagesize = <16>;
   };

   codec: wm8731@1a {
      #sound-dai-cells = <0>;
      compatible = "wlf,wm8731";
      reg = <0x1a>;
      AVDD-supply = <&reg_3p3v>;
      HPVDD-supply = <&reg_3p3v>;
      DCVDD-supply = <&reg_3p3v>;
      DBVDD-supply = <&reg_3p3v>;
      clocks = <&clks IMX6QDL_CLK_SSI2>;
   };
};



&ssi2 {
        fsl,mode = "i2s-master";
        status = "okay";
        #sound-dai-cells = <0>;
};

Gives me this output:
# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: imxspdif [imx-spdif], device 0: S/PDIF PCM snd-soc-dummy-dai-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: D202c000ssiwm87 [202c000.ssi-wm8731-hifi], device 0:
202c000.ssi-wm8731-hifi wm8731-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
[root@localhost ~]# speaker-test -D hw:1

speaker-test 1.0.28

Playback device is hw:1
Stream parameters are 48000Hz, S16_LE, 1 channels
Using 16 octaves of pink noise
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 128 to 32768
Period size range from 64 to 16384
Using max buffer size 32768
Periods = 4
was set period_size = 8192
was set buffer_size = 32768
 0 - Front Left
Write error: -5,Input/output error
xrun_recovery failed: -5,Input/output error
Transfer failed: Input/output error


On Sun, Oct 19, 2014 at 12:35 AM, Jonathan Bennett <jbscience87@gmail.com>
wrote:

>
> On Sat, Oct 18, 2014 at 2:13 PM, Fabio Estevam <festevam@gmail.com> wrote:
>
>> Hi Jonathan,
>>
>> On Fri, Oct 17, 2014 at 1:57 PM, Jonathan Bennett <jbscience87@gmail.com>
>> wrote:
>> > Hey, I'm working with a compulab utilite, trying to get everything
>> working
>> > with 3.17, with the eventual goal of getting better support for it
>> > upstream. Currently fighting the sound. It's a imx6q talking to a wm8731
>> > over i2c/i2s.
>> > I am booting Fedora 21 arm Alpha, with my own dtb (
>> > http://pastebin.com/4a4PBKwx) and driver (http://pastebin.com/1CsesuVV)
>>
>> I don't have access to a utilite board, but just trying to understand:
>> is wm8731 audio functional with the 3.10.17 kernel com compulab?
>>
>> The audio works on their pre-canned ubuntu image, which runs 3.10.
>
>
>> > It shows up in aplay -l, but trying to play anything to it gives me a
>> div
>> > by 0 in a driver:  [<c04f27e4>] (Ldiv0) from [<bf50512c>]
>> > (fsl_ssi_hw_params+0x194/0x364 [snd_soc_fsl_ssi]) This div0 happens in
>> > sound/soc/fsl/fsl_ssi.c, in the function fsl_ssi_set_bclk.
>> >
>> > My driver file is an almost direct copy of what compulab shipped with a
>> > 3.10 kernel. This is my first attempt at kernel hacking, so any help
>> would
>> > be appreciated.
>>
>> I would suggest as a first step to get the dts for compulab upstreamed.
>>
>> There was an attempt from Valentin Raevsky (added on Cc) last year:
>>
>> http://lists.infradead.org/pipermail/linux-arm-kernel/2013-October/204896.html
>>
>> After the basic dts file is added then you can work on adding audio
>> support.
>>
>> There is already a small dts file upstreamed.  It barely works. I've been
> get usb and the second ethernet port working, which I would like to get
> pushed upstream. I was hoping to have more of it working before then,
> though.
>
>> Some suggestions:
>>
>> - The dts from 3.10.17 can not be applied 'as-is' into 3.17. Take a
>> look for example into the audio node you have:
>>
>>         sound {
>>                 compatible = "fsl,imx6q-cm-fx6-wm8731",
>>                           "fsl,imx-audio-wm8731";
>>                 model = "wm8731-audio";
>>                 ssi-controller = <&ssi2>;
>>                 src-port = <2>;
>>                 ext-port = <4>;
>>                 audio-codec = <&codec>;
>>                 audio-routing = "LOUT", "ROUT", "LLINEIN", "RLINEIN";
>>         };
>>
>> 'src-port' and 'ext-port' are not valid properties.
>>
>> They should be like this instead:
>>
>>         mux-int-port = <2>;
>>         mux-ext-port = <4>;
>>
>> Take a look at arch/arm/boot/dts/imx6qdl-sabresd.dtsi for a reference.
>>
>> Also the codec clocks that are passed into the dts are not correct.
>> The wm8731 does not acquire any clocks in the mainline driver.
>>
>> You should also try to use the 'simple-audio-card' binding instead of
>> creating the imx-wm8731 machine file.
>>
>> Here is a reference of the arch/arm/boot/dts/vf610-twr.dts where you
>> can see simple-audio-card in use.
>>
>> I am trying to use simple-audio-card, without any success. I've been
> hammering at this for a couple days now. My current dts looks like
> this(just the audio related bits):
>
>         sound {
>                 compatible = "simple-audio-card";
>                 simple-audio-card,model = "wm8731-audio";
>                 mux-int-port = <2>;
>                 mux-ext-port = <4>;
>                 simple-audio-card,format = "i2s";
>                 simple-audio-card,mclk-fs = <256>;
>                 simple-audio-card,cpu {
>                         sound-dai = <&ssi2>;
>                 };
>                 simple-audio-card,codec {
>                         sound-dai = <&codec>;
>                 };
>         };
> ....
> /* i2c3 */
> &i2c3 {
>    pinctrl-names = "default";
>    pinctrl-0 = <&pinctrl_i2c3>;
>    status = "okay";
>
>    eeprom@50 {
>       compatible = "at24,24c02";
>       reg = <0x50>;
>       pagesize = <16>;
>    };
>
>    codec: wm8731@1a {
>       #sound-dai-cells = <0>;
>       compatible = "wlf,wm8731";
>       reg = <0x1a>;
>       AVDD-supply = <&reg_3p3v>;
>       HPVDD-supply = <&reg_3p3v>;
>       DCVDD-supply = <&reg_3p3v>;
>       DBVDD-supply = <&reg_3p3v>;
>    };
> };
> ...
> &ssi2 {
>         fsl,mode = "i2s-master";
>         status = "okay";
>         #sound-dai-cells = <0>;
> };
>
>
> It registers:
> # aplay -l
> **** List of PLAYBACK Hardware Devices ****
> card 0: D202c000ssiwm87 [202c000.ssi-wm8731-hifi], device 0:
> 202c000.ssi-wm8731-hifi wm8731-hifi-0 []
>   Subdevices: 1/1
>   Subdevice #0: subdevice #0
>
>
> However:
> # speaker-test
>
> speaker-test 1.0.28
>
> Playback device is default
> Stream parameters are 48000Hz, S16_LE, 1 channels
> Using 16 octaves of pink noise
> Rate set to 48000Hz (requested 48[   57.443583] asoc-simple-card sound:
> ASoC: machine hw_params failed: -22
> 000Hz)
> Buffer size range from 128 to 32768
> Period size range from 64 to 16384
> Using max buffer size 32768
> Periods = 4
> Unable to set hw params for playback: Invalid argument
> Setting of hwparams failed: Invalid argument
>
>
>
>
> It's a wm8731 hanging off an i2c bus from an i.mx6q chip. Seems like
> exactly what simple-audio-card is designed for. I imagine that there is
> something simple that I am overlooking, but I'm at a loss to find it.
>
>
>> Good luck!
>>
>> Regards,
>>
>> Fabio Estevam
>>
>
> Thanks for the help!
> ~Jonathan Bennett
>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Help with wm8731 support for the Utilite (imx6q)
  2014-10-19  5:58     ` Jonathan Bennett
@ 2014-10-20 12:06       ` Fabio Estevam
  2014-10-20 16:29         ` Fabio Estevam
  0 siblings, 1 reply; 20+ messages in thread
From: Fabio Estevam @ 2014-10-20 12:06 UTC (permalink / raw)
  To: Jonathan Bennett; +Cc: alsa-devel, Aaron Kling, Igor Grinberg, valentin

On Sun, Oct 19, 2014 at 3:58 AM, Jonathan Bennett <jbscience87@gmail.com> wrote:
> And a different dts that is closer to the example given:
>
>         sound {
>                 compatible = "simple-audio-card";
>                 simple-audio-card,model = "wm8731-audio";
>                 mux-int-port = <2>;
>                 mux-ext-port = <4>;
>                 simple-audio-card,format = "i2s";
>                 simple-audio-card,cpu {
>                         sound-dai = <&ssi2>;
>                         master-clkdir-out;
>                         frame-master;
>                         bitclock-master;
>                 };
>                 simple-audio-card,codec {
>                         frame-master;
>                         bitclock-master;
>                         sound-dai = <&codec>;
>                 };
>         };
>
> /* i2c3 */
> &i2c3 {
>    pinctrl-names = "default";
>    pinctrl-0 = <&pinctrl_i2c3>;
>    status = "okay";
>
>    eeprom@50 {
>       compatible = "at24,24c02";
>       reg = <0x50>;
>       pagesize = <16>;
>    };
>
>    codec: wm8731@1a {
>       #sound-dai-cells = <0>;
>       compatible = "wlf,wm8731";
>       reg = <0x1a>;
>       AVDD-supply = <&reg_3p3v>;
>       HPVDD-supply = <&reg_3p3v>;
>       DCVDD-supply = <&reg_3p3v>;
>       DBVDD-supply = <&reg_3p3v>;
>       clocks = <&clks IMX6QDL_CLK_SSI2>;

This 'clocks' entry does not seem correct.

IMX6QDL_CLK_SSI2 is the clock from SSI2 module, which is turned on by
the ssi driver.

Who provides the MCLK for wm8731 on utilite board? Isn't it mx6 CLKO pin?

Are you able to monitor this clock with a scope and make sure that it
is actually being turned on?

We use CLKO output to drive MCLK pins on mx6qdl-sabresd board with
wm8762 codec. You can use it as a reference.

Adding the Compulab's folks on Cc.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Help with wm8731 support for the Utilite (imx6q)
  2014-10-20 12:06       ` Fabio Estevam
@ 2014-10-20 16:29         ` Fabio Estevam
  2014-10-20 19:59           ` Jonathan Bennett
  0 siblings, 1 reply; 20+ messages in thread
From: Fabio Estevam @ 2014-10-20 16:29 UTC (permalink / raw)
  To: Jonathan Bennett; +Cc: alsa-devel, Aaron Kling, Igor Grinberg, valentin

On Mon, Oct 20, 2014 at 10:06 AM, Fabio Estevam <festevam@gmail.com> wrote:

>>       clocks = <&clks IMX6QDL_CLK_SSI2>;
>
> This 'clocks' entry does not seem correct.
>
> IMX6QDL_CLK_SSI2 is the clock from SSI2 module, which is turned on by
> the ssi driver.
>
> Who provides the MCLK for wm8731 on utilite board? Isn't it mx6 CLKO pin?
>
> Are you able to monitor this clock with a scope and make sure that it
> is actually being turned on?
>
> We use CLKO output to drive MCLK pins on mx6qdl-sabresd board with
> wm8762 codec. You can use it as a reference.
>
> Adding the Compulab's folks on Cc.

Do the changes below help? (using IMX6QDL_CLK_CKO)

    codec: wm8731@1a {
       #sound-dai-cells = <0>;
       compatible = "wlf,wm8731";
       reg = <0x1a>;
       AVDD-supply = <&reg_3p3v>;
       HPVDD-supply = <&reg_3p3v>;
       DCVDD-supply = <&reg_3p3v>;
       DBVDD-supply = <&reg_3p3v>;
       clocks = <&clks IMX6QDL_CLK_CKO>;

with this one applied:

--- a/sound/soc/codecs/wm8731.c
+++ b/sound/soc/codecs/wm8731.c
@@ -13,6 +13,7 @@
  * published by the Free Software Foundation.
  */

+#include <linux/clk.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/init.h>
@@ -46,6 +47,7 @@ struct wm8731_priv {
     struct regmap *regmap;
     struct regulator_bulk_data supplies[WM8731_NUM_SUPPLIES];
     const struct snd_pcm_hw_constraint_list *constraints;
+    struct clk *mclk;
     unsigned int sysclk;
     int sysclk_type;
     int playback_fs;
@@ -742,6 +744,21 @@ static int wm8731_i2c_probe(struct i2c_client *i2c,
         return ret;
     }

+    wm8731->mclk = devm_clk_get(&i2c->dev, NULL);
+    if (IS_ERR(wm8731->mclk)) {
+        ret = PTR_ERR(wm8731->mclk);
+        dev_err(&i2c->dev, "Failed to get mclock: %d\n", ret);
+        /* Defer the probe to see if the clk will be provided later */
+        if (ret == -ENOENT)
+            return -EPROBE_DEFER;
+    }
+
+    if (!IS_ERR(wm8731->mclk)) {
+        ret = clk_prepare_enable(wm8731->mclk);
+        if (ret)
+            return ret;
+    }
+
     i2c_set_clientdata(i2c, wm8731);

     ret = snd_soc_register_codec(&i2c->dev,

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Help with wm8731 support for the Utilite (imx6q)
  2014-10-20 16:29         ` Fabio Estevam
@ 2014-10-20 19:59           ` Jonathan Bennett
  2014-10-21 12:06             ` Valentin Raevsky
  0 siblings, 1 reply; 20+ messages in thread
From: Jonathan Bennett @ 2014-10-20 19:59 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: alsa-devel, Aaron Kling, Igor Grinberg, valentin

With those changes:
[    8.656319] wm8731 2-001a: simple-card: set_sysclk error
[    8.661964] asoc-simple-card sound: ASoC: failed to init
202c000.ssi-wm8731-hifi: -22
[    8.670067] asoc-simple-card sound: ASoC: failed to instantiate card -22
[    8.678063] Bluetooth: vendor=0x2df, device=0x911b, class=255, fn=3
[    8.679996] asoc-simple-card: probe of sound failed with error -22


Looking at the 3.10 driver file and digging through some documentation, it
looks like the wm8731 can be used in either slave or master mode. According
to Compulab's driver, the supplying clocks when the wm8731 is in slave mode
are pll4 (IMX6QDL_CLK_PLL4_AUDIO) and ssi.1 (IMX6QDL_CLK_SSI2)

In master mode, it's IMX6QDL_CLK_CKO and IMX6QDL_CLK_CKO2.

I have not found an actual schematic to see how it is physically wired.
Popped open the case, and the codec is on the bottom side of the board with
the cpu on it, 100% unaccessible during operations. Even at that, the cpu
and codec are bga, so no probing of pins.

Looking at their driver file, I am also wondering if we need to tweak the
audmux init. I've played with this some in the dts, but hasn't made much
difference.

On Mon, Oct 20, 2014 at 11:29 AM, Fabio Estevam <festevam@gmail.com> wrote:

> On Mon, Oct 20, 2014 at 10:06 AM, Fabio Estevam <festevam@gmail.com>
> wrote:
>
> >>       clocks = <&clks IMX6QDL_CLK_SSI2>;
> >
> > This 'clocks' entry does not seem correct.
> >
> > IMX6QDL_CLK_SSI2 is the clock from SSI2 module, which is turned on by
> > the ssi driver.
> >
> > Who provides the MCLK for wm8731 on utilite board? Isn't it mx6 CLKO pin?
> >
> > Are you able to monitor this clock with a scope and make sure that it
> > is actually being turned on?
> >
> > We use CLKO output to drive MCLK pins on mx6qdl-sabresd board with
> > wm8762 codec. You can use it as a reference.
> >
> > Adding the Compulab's folks on Cc.
>
> Do the changes below help? (using IMX6QDL_CLK_CKO)
>
>     codec: wm8731@1a {
>        #sound-dai-cells = <0>;
>        compatible = "wlf,wm8731";
>        reg = <0x1a>;
>        AVDD-supply = <&reg_3p3v>;
>        HPVDD-supply = <&reg_3p3v>;
>        DCVDD-supply = <&reg_3p3v>;
>        DBVDD-supply = <&reg_3p3v>;
>        clocks = <&clks IMX6QDL_CLK_CKO>;
>
> with this one applied:
>
> --- a/sound/soc/codecs/wm8731.c
> +++ b/sound/soc/codecs/wm8731.c
> @@ -13,6 +13,7 @@
>   * published by the Free Software Foundation.
>   */
>
> +#include <linux/clk.h>
>  #include <linux/module.h>
>  #include <linux/moduleparam.h>
>  #include <linux/init.h>
> @@ -46,6 +47,7 @@ struct wm8731_priv {
>      struct regmap *regmap;
>      struct regulator_bulk_data supplies[WM8731_NUM_SUPPLIES];
>      const struct snd_pcm_hw_constraint_list *constraints;
> +    struct clk *mclk;
>      unsigned int sysclk;
>      int sysclk_type;
>      int playback_fs;
> @@ -742,6 +744,21 @@ static int wm8731_i2c_probe(struct i2c_client *i2c,
>          return ret;
>      }
>
> +    wm8731->mclk = devm_clk_get(&i2c->dev, NULL);
> +    if (IS_ERR(wm8731->mclk)) {
> +        ret = PTR_ERR(wm8731->mclk);
> +        dev_err(&i2c->dev, "Failed to get mclock: %d\n", ret);
> +        /* Defer the probe to see if the clk will be provided later */
> +        if (ret == -ENOENT)
> +            return -EPROBE_DEFER;
> +    }
> +
> +    if (!IS_ERR(wm8731->mclk)) {
> +        ret = clk_prepare_enable(wm8731->mclk);
> +        if (ret)
> +            return ret;
> +    }
> +
>      i2c_set_clientdata(i2c, wm8731);
>
>      ret = snd_soc_register_codec(&i2c->dev,
>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Help with wm8731 support for the Utilite (imx6q)
  2014-10-20 19:59           ` Jonathan Bennett
@ 2014-10-21 12:06             ` Valentin Raevsky
  2014-10-21 18:04               ` Jonathan Bennett
  0 siblings, 1 reply; 20+ messages in thread
From: Valentin Raevsky @ 2014-10-21 12:06 UTC (permalink / raw)
  To: Jonathan Bennett, Fabio Estevam; +Cc: alsa-devel, Aaron Kling, Igor Grinberg

Hi Jonathan,

See my comments in line.

Moreover, I'd appreciate it if you could try the CompuLab 3.10.17 kernel 
on your board in order to rule out a hw problem.

Take the latest 3.10.17 source from here:
https://github.com/utilite-computer/linux-kernel
tag: v3.10.17-cm-fx6-1-beta1

Build  instructions:

# export LOADADDR=0x10008000
# make cm_fx6_defconfig
# make zImage modules -j8 CONFIG_DEBUG_SECTION_MISMATCH=y
# make imx6q-sbc-fx6m.dtb
# make imx6q-sbc-fx6.dtb

imx6q-sbc-fx6m.dtb - Utilite
imx6q-sbc-fx6.dtb  - Evaluation Board

Regards,
Valentin.

On 10/20/2014 10:59 PM, Jonathan Bennett wrote:
> With those changes:
> [    8.656319] wm8731 2-001a: simple-card: set_sysclk error
> [    8.661964] asoc-simple-card sound: ASoC: failed to init
> 202c000.ssi-wm8731-hifi: -22
> [    8.670067] asoc-simple-card sound: ASoC: failed to instantiate card -22
> [    8.678063] Bluetooth: vendor=0x2df, device=0x911b, class=255, fn=3
> [    8.679996] asoc-simple-card: probe of sound failed with error -22
>
>
> Looking at the 3.10 driver file and digging through some documentation,
> it looks like the wm8731 can be used in either slave or master mode.
> According to Compulab's driver, the supplying clocks when the wm8731 is
> in slave mode are pll4 (IMX6QDL_CLK_PLL4_AUDIO) and ssi.1 (IMX6QDL_CLK_SSI2)
These clocks are correct for slave mode.
>
> In master mode, it's IMX6QDL_CLK_CKO and IMX6QDL_CLK_CKO2.
These clocks are correct for master mode, but do not try make it work.
Master mode requires a hw change on the module.

>
> I have not found an actual schematic to see how it is physically wired.
> Popped open the case, and the codec is on the bottom side of the board
> with the cpu on it, 100% unaccessible during operations. Even at that,
> the cpu and codec are bga, so no probing of pins.
>
> Looking at their driver file, I am also wondering if we need to tweak
> the audmux init. I've played with this some in the dts, but hasn't made
> much difference.
>
> On Mon, Oct 20, 2014 at 11:29 AM, Fabio Estevam <festevam@gmail.com
> <mailto:festevam@gmail.com>> wrote:
>
>     On Mon, Oct 20, 2014 at 10:06 AM, Fabio Estevam <festevam@gmail.com
>     <mailto:festevam@gmail.com>> wrote:
>
>     >>       clocks = <&clks IMX6QDL_CLK_SSI2>;
>     >
>     > This 'clocks' entry does not seem correct.
>     >
>     > IMX6QDL_CLK_SSI2 is the clock from SSI2 module, which is turned on by
>     > the ssi driver.
>     >
>     > Who provides the MCLK for wm8731 on utilite board? Isn't it mx6 CLKO pin?
>     >
>     > Are you able to monitor this clock with a scope and make sure that it
>     > is actually being turned on?
>     >
>     > We use CLKO output to drive MCLK pins on mx6qdl-sabresd board with
>     > wm8762 codec. You can use it as a reference.
>     >
>     > Adding the Compulab's folks on Cc.
>
>     Do the changes below help? (using IMX6QDL_CLK_CKO)
>
>          codec: wm8731@1a {
>             #sound-dai-cells = <0>;
>             compatible = "wlf,wm8731";
>             reg = <0x1a>;
>             AVDD-supply = <&reg_3p3v>;
>             HPVDD-supply = <&reg_3p3v>;
>             DCVDD-supply = <&reg_3p3v>;
>             DBVDD-supply = <&reg_3p3v>;
>             clocks = <&clks IMX6QDL_CLK_CKO>;
>
>     with this one applied:
>
>     --- a/sound/soc/codecs/wm8731.c
>     +++ b/sound/soc/codecs/wm8731.c
>     @@ -13,6 +13,7 @@
>        * published by the Free Software Foundation.
>        */
>
>     +#include <linux/clk.h>
>       #include <linux/module.h>
>       #include <linux/moduleparam.h>
>       #include <linux/init.h>
>     @@ -46,6 +47,7 @@ struct wm8731_priv {
>           struct regmap *regmap;
>           struct regulator_bulk_data supplies[WM8731_NUM_SUPPLIES];
>           const struct snd_pcm_hw_constraint_list *constraints;
>     +    struct clk *mclk;
>           unsigned int sysclk;
>           int sysclk_type;
>           int playback_fs;
>     @@ -742,6 +744,21 @@ static int wm8731_i2c_probe(struct i2c_client *i2c,
>               return ret;
>           }
>
>     +    wm8731->mclk = devm_clk_get(&i2c->dev, NULL);
>     +    if (IS_ERR(wm8731->mclk)) {
>     +        ret = PTR_ERR(wm8731->mclk);
>     +        dev_err(&i2c->dev, "Failed to get mclock: %d\n", ret);
>     +        /* Defer the probe to see if the clk will be provided later */
>     +        if (ret == -ENOENT)
>     +            return -EPROBE_DEFER;
>     +    }
>     +
>     +    if (!IS_ERR(wm8731->mclk)) {
>     +        ret = clk_prepare_enable(wm8731->mclk);
>     +        if (ret)
>     +            return ret;
>     +    }
>     +
>           i2c_set_clientdata(i2c, wm8731);
>
>           ret = snd_soc_register_codec(&i2c->dev,
>
>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Help with wm8731 support for the Utilite (imx6q)
  2014-10-21 12:06             ` Valentin Raevsky
@ 2014-10-21 18:04               ` Jonathan Bennett
  2014-10-21 18:12                 ` Fabio Estevam
  0 siblings, 1 reply; 20+ messages in thread
From: Jonathan Bennett @ 2014-10-21 18:04 UTC (permalink / raw)
  To: Valentin Raevsky; +Cc: Aaron Kling, alsa-devel, Fabio Estevam, Igor Grinberg

On Tue, Oct 21, 2014 at 7:06 AM, Valentin Raevsky <valentin@compulab.co.il>
wrote:

> Hi Jonathan,
>
> See my comments in line.
>
> Moreover, I'd appreciate it if you could try the CompuLab 3.10.17 kernel
> on your board in order to rule out a hw problem.
>
> Take the latest 3.10.17 source from here:
> https://github.com/utilite-computer/linux-kernel
> tag: v3.10.17-cm-fx6-1-beta1
>
> Build  instructions:
>
> # export LOADADDR=0x10008000
> # make cm_fx6_defconfig
> # make zImage modules -j8 CONFIG_DEBUG_SECTION_MISMATCH=y
> # make imx6q-sbc-fx6m.dtb
> # make imx6q-sbc-fx6.dtb
>
> imx6q-sbc-fx6m.dtb - Utilite
> imx6q-sbc-fx6.dtb  - Evaluation Board
>
> Regards,
> Valentin.

Hey. I have pulled the Ubuntu image and booted it up. Sound worked without
a hitch there. I think we can rule out an actual HW problem.

>
>
> On 10/20/2014 10:59 PM, Jonathan Bennett wrote:
>
>> With those changes:
>> [    8.656319] wm8731 2-001a: simple-card: set_sysclk error
>> [    8.661964] asoc-simple-card sound: ASoC: failed to init
>> 202c000.ssi-wm8731-hifi: -22
>> [    8.670067] asoc-simple-card sound: ASoC: failed to instantiate card
>> -22
>> [    8.678063] Bluetooth: vendor=0x2df, device=0x911b, class=255, fn=3
>> [    8.679996] asoc-simple-card: probe of sound failed with error -22
>>
>>
>> Looking at the 3.10 driver file and digging through some documentation,
>> it looks like the wm8731 can be used in either slave or master mode.
>> According to Compulab's driver, the supplying clocks when the wm8731 is
>> in slave mode are pll4 (IMX6QDL_CLK_PLL4_AUDIO) and ssi.1
>> (IMX6QDL_CLK_SSI2)
>>
> These clocks are correct for slave mode.
>
>>
>> I realized something just last night. I was grabbing changes from the
devel branch of github.com/utilite-computer, thinking that those changes
were based off the vanilla 3.10 kernel. Those changes are actually based on
the Freescale 3.10 kernel. I pulled a Freescale patch that is
obviously missing: "ENGR00276249-1 ARM: imx6q: Add missing baud clock for
ssi" I also switched back to imx-wm8731.c for the driver. With this setup,
the driver registers, and speaker-test thinks it plays, however there is no
actual sound output. I call it progress.

My previous ldiv0 was apparently a result of the missing baudclock in
clk-imx6q.c. s



> In master mode, it's IMX6QDL_CLK_CKO and IMX6QDL_CLK_CKO2.
>>
> These clocks are correct for master mode, but do not try make it work.
> Master mode requires a hw change on the module.
>

>> I have not found an actual schematic to see how it is physically wired.
>> Popped open the case, and the codec is on the bottom side of the board
>> with the cpu on it, 100% unaccessible during operations. Even at that,
>> the cpu and codec are bga, so no probing of pins.
>>
>> Looking at their driver file, I am also wondering if we need to tweak
>> the audmux init. I've played with this some in the dts, but hasn't made
>> much difference.
>>
>> On Mon, Oct 20, 2014 at 11:29 AM, Fabio Estevam <festevam@gmail.com
>> <mailto:festevam@gmail.com>> wrote:
>>
>>     On Mon, Oct 20, 2014 at 10:06 AM, Fabio Estevam <festevam@gmail.com
>>     <mailto:festevam@gmail.com>> wrote:
>>
>>     >>       clocks = <&clks IMX6QDL_CLK_SSI2>;
>>     >
>>     > This 'clocks' entry does not seem correct.
>>     >
>>     > IMX6QDL_CLK_SSI2 is the clock from SSI2 module, which is turned on
>> by
>>     > the ssi driver.
>>     >
>>     > Who provides the MCLK for wm8731 on utilite board? Isn't it mx6
>> CLKO pin?
>>     >
>>     > Are you able to monitor this clock with a scope and make sure that
>> it
>>     > is actually being turned on?
>>     >
>>     > We use CLKO output to drive MCLK pins on mx6qdl-sabresd board with
>>     > wm8762 codec. You can use it as a reference.
>>     >
>>     > Adding the Compulab's folks on Cc.
>>
>>     Do the changes below help? (using IMX6QDL_CLK_CKO)
>>
>>          codec: wm8731@1a {
>>             #sound-dai-cells = <0>;
>>             compatible = "wlf,wm8731";
>>             reg = <0x1a>;
>>             AVDD-supply = <&reg_3p3v>;
>>             HPVDD-supply = <&reg_3p3v>;
>>             DCVDD-supply = <&reg_3p3v>;
>>             DBVDD-supply = <&reg_3p3v>;
>>             clocks = <&clks IMX6QDL_CLK_CKO>;
>>
>>     with this one applied:
>>
>>     --- a/sound/soc/codecs/wm8731.c
>>     +++ b/sound/soc/codecs/wm8731.c
>>     @@ -13,6 +13,7 @@
>>        * published by the Free Software Foundation.
>>        */
>>
>>     +#include <linux/clk.h>
>>       #include <linux/module.h>
>>       #include <linux/moduleparam.h>
>>       #include <linux/init.h>
>>     @@ -46,6 +47,7 @@ struct wm8731_priv {
>>           struct regmap *regmap;
>>           struct regulator_bulk_data supplies[WM8731_NUM_SUPPLIES];
>>           const struct snd_pcm_hw_constraint_list *constraints;
>>     +    struct clk *mclk;
>>           unsigned int sysclk;
>>           int sysclk_type;
>>           int playback_fs;
>>     @@ -742,6 +744,21 @@ static int wm8731_i2c_probe(struct i2c_client
>> *i2c,
>>               return ret;
>>           }
>>
>>     +    wm8731->mclk = devm_clk_get(&i2c->dev, NULL);
>>     +    if (IS_ERR(wm8731->mclk)) {
>>     +        ret = PTR_ERR(wm8731->mclk);
>>     +        dev_err(&i2c->dev, "Failed to get mclock: %d\n", ret);
>>     +        /* Defer the probe to see if the clk will be provided later
>> */
>>     +        if (ret == -ENOENT)
>>     +            return -EPROBE_DEFER;
>>     +    }
>>     +
>>     +    if (!IS_ERR(wm8731->mclk)) {
>>     +        ret = clk_prepare_enable(wm8731->mclk);
>>     +        if (ret)
>>     +            return ret;
>>     +    }
>>     +
>>           i2c_set_clientdata(i2c, wm8731);
>>
>>           ret = snd_soc_register_codec(&i2c->dev,
>>
>>
>>
>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Help with wm8731 support for the Utilite (imx6q)
  2014-10-21 18:04               ` Jonathan Bennett
@ 2014-10-21 18:12                 ` Fabio Estevam
  2014-10-21 18:49                   ` Jonathan Bennett
  0 siblings, 1 reply; 20+ messages in thread
From: Fabio Estevam @ 2014-10-21 18:12 UTC (permalink / raw)
  To: Jonathan Bennett; +Cc: alsa-devel, Aaron Kling, Igor Grinberg, Valentin Raevsky

On Tue, Oct 21, 2014 at 4:04 PM, Jonathan Bennett <jbscience87@gmail.com> wrote:

> I realized something just last night. I was grabbing changes from the devel
> branch of github.com/utilite-computer, thinking that those changes were
> based off the vanilla 3.10 kernel. Those changes are actually based on the
> Freescale 3.10 kernel. I pulled a Freescale patch that is obviously missing:
> "ENGR00276249-1 ARM: imx6q: Add missing baud clock for ssi" I also switched

The baud clock patch is present in 3.18-rc1:

commit 935632e9938e3e286b9c62a7e54d35c428533cc9
Author: Shengjiu Wang <shengjiu.wang@freescale.com>
Date:   Tue Sep 9 17:13:26 2014 +0800

    ARM: dts: imx6qdl: add baud clock and clock-names for ssi

    Baud clock is used for bit clock generation in master mode. Ipg clock
    is peripheral clock and peripheral access clock.

    Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
    Signed-off-by: Shawn Guo <shawn.guo@freescale.c


> back to imx-wm8731.c for the driver. With this setup, the driver registers,
> and speaker-test thinks it plays, however there is no actual sound output. I
> call it progress.

Great progress: some things to check :

1. audmux settings

2. Can you try to run 'alsamixer' and make sure that the volume is not
at the lowest level?

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Help with wm8731 support for the Utilite (imx6q)
  2014-10-21 18:12                 ` Fabio Estevam
@ 2014-10-21 18:49                   ` Jonathan Bennett
  2014-10-21 22:37                     ` Jonathan Bennett
  0 siblings, 1 reply; 20+ messages in thread
From: Jonathan Bennett @ 2014-10-21 18:49 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: alsa-devel, Aaron Kling, Igor Grinberg, Valentin Raevsky

On Tue, Oct 21, 2014 at 1:12 PM, Fabio Estevam <festevam@gmail.com> wrote:

> On Tue, Oct 21, 2014 at 4:04 PM, Jonathan Bennett <jbscience87@gmail.com>
> wrote:
>
> > I realized something just last night. I was grabbing changes from the
> devel
> > branch of github.com/utilite-computer, thinking that those changes were
> > based off the vanilla 3.10 kernel. Those changes are actually based on
> the
> > Freescale 3.10 kernel. I pulled a Freescale patch that is obviously
> missing:
> > "ENGR00276249-1 ARM: imx6q: Add missing baud clock for ssi" I also
> switched
>
> The baud clock patch is present in 3.18-rc1:
>
> commit 935632e9938e3e286b9c62a7e54d35c428533cc9
> Author: Shengjiu Wang <shengjiu.wang@freescale.com>
> Date:   Tue Sep 9 17:13:26 2014 +0800
>
>     ARM: dts: imx6qdl: add baud clock and clock-names for ssi
>
>     Baud clock is used for bit clock generation in master mode. Ipg clock
>     is peripheral clock and peripheral access clock.
>
>     Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
>     Signed-off-by: Shawn Guo <shawn.guo@freescale.c
>
 Awesome!
It's great to see this stuff go mainline.

>
> > back to imx-wm8731.c for the driver. With this setup, the driver
> registers,
> > and speaker-test thinks it plays, however there is no actual sound
> output. I
> > call it progress.
>
> Great progress: some things to check :
>
> 1. audmux settings
>
Well, the imx-wm8731 driver (It's really just glue for loading wm8731) does
have audmux settings in it. These get called during the module probe. Not
sure what might need to change there. My thoughts are that they should be
correct.


>
> 2. Can you try to run 'alsamixer' and make sure that the volume is not
> at the lowest level?
>
Yeah, I've made sure to check alsamixer and turn the volume up. Still no
joy.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Help with wm8731 support for the Utilite (imx6q)
  2014-10-21 18:49                   ` Jonathan Bennett
@ 2014-10-21 22:37                     ` Jonathan Bennett
  2014-10-22  8:04                       ` Valentin Raevsky
  0 siblings, 1 reply; 20+ messages in thread
From: Jonathan Bennett @ 2014-10-21 22:37 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: alsa-devel, Aaron Kling, Igor Grinberg, Valentin Raevsky

On Tue, Oct 21, 2014 at 1:49 PM, Jonathan Bennett <jbscience87@gmail.com>
wrote:

>
>
> On Tue, Oct 21, 2014 at 1:12 PM, Fabio Estevam <festevam@gmail.com> wrote:
>
>> On Tue, Oct 21, 2014 at 4:04 PM, Jonathan Bennett <jbscience87@gmail.com>
>> wrote:
>>
>> > I realized something just last night. I was grabbing changes from the
>> devel
>> > branch of github.com/utilite-computer, thinking that those changes were
>> > based off the vanilla 3.10 kernel. Those changes are actually based on
>> the
>> > Freescale 3.10 kernel. I pulled a Freescale patch that is obviously
>> missing:
>> > "ENGR00276249-1 ARM: imx6q: Add missing baud clock for ssi" I also
>> switched
>>
>> The baud clock patch is present in 3.18-rc1:
>>
>> commit 935632e9938e3e286b9c62a7e54d35c428533cc9
>> Author: Shengjiu Wang <shengjiu.wang@freescale.com>
>> Date:   Tue Sep 9 17:13:26 2014 +0800
>>
>>     ARM: dts: imx6qdl: add baud clock and clock-names for ssi
>>
>>     Baud clock is used for bit clock generation in master mode. Ipg clock
>>     is peripheral clock and peripheral access clock.
>>
>>     Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
>>     Signed-off-by: Shawn Guo <shawn.guo@freescale.c
>>
>  Awesome!
> It's great to see this stuff go mainline.
>

I have rebased to 3.18 rc-1. It has simplified the patch set a bit, as more
of  the Freescale things have hit mainline. http://pastebin.com/C652GKe3 is
my patchset.
Again, the card registers and thinks it plays, but there is no actual
output.


>> > back to imx-wm8731.c for the driver. With this setup, the driver
>> registers,
>> > and speaker-test thinks it plays, however there is no actual sound
>> output. I
>> > call it progress.
>>
>> Great progress: some things to check :
>>
>> 1. audmux settings
>>
> Well, the imx-wm8731 driver (It's really just glue for loading wm8731)
> does have audmux settings in it. These get called during the module probe.
> Not sure what might need to change there. My thoughts are that they should
> be correct.
>
>
>>
>> 2. Can you try to run 'alsamixer' and make sure that the volume is not
>> at the lowest level?
>>
> Yeah, I've made sure to check alsamixer and turn the volume up. Still no
> joy.
>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Help with wm8731 support for the Utilite (imx6q)
  2014-10-21 22:37                     ` Jonathan Bennett
@ 2014-10-22  8:04                       ` Valentin Raevsky
  2014-10-22 12:13                         ` Jonathan Bennett
  0 siblings, 1 reply; 20+ messages in thread
From: Valentin Raevsky @ 2014-10-22  8:04 UTC (permalink / raw)
  To: Jonathan Bennett, Fabio Estevam; +Cc: alsa-devel, Aaron Kling, Igor Grinberg

On 10/22/2014 01:37 AM, Jonathan Bennett wrote:
>
>
> On Tue, Oct 21, 2014 at 1:49 PM, Jonathan Bennett <jbscience87@gmail.com
> <mailto:jbscience87@gmail.com>> wrote:
>
>
>
>     On Tue, Oct 21, 2014 at 1:12 PM, Fabio Estevam <festevam@gmail.com
>     <mailto:festevam@gmail.com>> wrote:
>
>         On Tue, Oct 21, 2014 at 4:04 PM, Jonathan Bennett
>         <jbscience87@gmail.com <mailto:jbscience87@gmail.com>> wrote:
>
>         > I realized something just last night. I was grabbing changes from the devel
>         > branch ofgithub.com/utilite-computer
>         <http://github.com/utilite-computer>, thinking that those
>         changes were
>         > based off the vanilla 3.10 kernel. Those changes are actually based on the
>         > Freescale 3.10 kernel. I pulled a Freescale patch that is obviously missing:
>         > "ENGR00276249-1 ARM: imx6q: Add missing baud clock for ssi" I also switched
>
>         The baud clock patch is present in 3.18-rc1:
>
>         commit 935632e9938e3e286b9c62a7e54d35c428533cc9
>         Author: Shengjiu Wang <shengjiu.wang@freescale.com
>         <mailto:shengjiu.wang@freescale.com>>
>         Date:   Tue Sep 9 17:13:26 2014 +0800
>
>              ARM: dts: imx6qdl: add baud clock and clock-names for ssi
>
>              Baud clock is used for bit clock generation in master mode.
>         Ipg clock
>              is peripheral clock and peripheral access clock.
>
>              Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com
>         <mailto:shengjiu.wang@freescale.com>>
>              Signed-off-by: Shawn Guo <shawn.guo@freescale.c
>
>       Awesome!
>     It's great to see this stuff go mainline.
>
>
> I have rebased to 3.18 rc-1. It has simplified the patch set a bit, as
> more of  the Freescale things have hit mainline.
> http://pastebin.com/C652GKe3 is my patchset.
> Again, the card registers and thinks it plays, but there is no actual
> output.
Make sure that "Output Mixer HiFi Playback Switch" is on
Issue:
# amixer cset numid=14,iface=MIXER,name='Output Mixer HiFi Playback 
Switch' on
# alsactl store wm8731audio

>
>
>         > back to imx-wm8731.c for the driver. With this setup, the driver registers,
>         > and speaker-test thinks it plays, however there is no actual sound output. I
>         > call it progress.
>
>         Great progress: some things to check :
>
>         1. audmux settings
>
>     Well, the imx-wm8731 driver (It's really just glue for loading
>     wm8731) does have audmux settings in it. These get called during the
>     module probe. Not sure what might need to change there. My thoughts
>     are that they should be correct.
>
>
>         2. Can you try to run 'alsamixer' and make sure that the volume
>         is not
>         at the lowest level?
>
>     Yeah, I've made sure to check alsamixer and turn the volume up.
>     Still no joy.
>
>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Help with wm8731 support for the Utilite (imx6q)
  2014-10-22  8:04                       ` Valentin Raevsky
@ 2014-10-22 12:13                         ` Jonathan Bennett
  2014-10-22 12:17                           ` Fabio Estevam
  0 siblings, 1 reply; 20+ messages in thread
From: Jonathan Bennett @ 2014-10-22 12:13 UTC (permalink / raw)
  To: Valentin Raevsky; +Cc: Aaron Kling, alsa-devel, Fabio Estevam, Igor Grinberg

On Wed, Oct 22, 2014 at 3:04 AM, Valentin Raevsky <valentin@compulab.co.il>
wrote:

> On 10/22/2014 01:37 AM, Jonathan Bennett wrote:
>
>>
>>
>> On Tue, Oct 21, 2014 at 1:49 PM, Jonathan Bennett <jbscience87@gmail.com
>> <mailto:jbscience87@gmail.com>> wrote:
>>
>>
>>
>>     On Tue, Oct 21, 2014 at 1:12 PM, Fabio Estevam <festevam@gmail.com
>>     <mailto:festevam@gmail.com>> wrote:
>>
>>         On Tue, Oct 21, 2014 at 4:04 PM, Jonathan Bennett
>>         <jbscience87@gmail.com <mailto:jbscience87@gmail.com>> wrote:
>>
>>         > I realized something just last night. I was grabbing changes
>> from the devel
>>         > branch ofgithub.com/utilite-computer
>>         <http://github.com/utilite-computer>, thinking that those
>>         changes were
>>         > based off the vanilla 3.10 kernel. Those changes are actually
>> based on the
>>         > Freescale 3.10 kernel. I pulled a Freescale patch that is
>> obviously missing:
>>         > "ENGR00276249-1 ARM: imx6q: Add missing baud clock for ssi" I
>> also switched
>>
>>         The baud clock patch is present in 3.18-rc1:
>>
>>         commit 935632e9938e3e286b9c62a7e54d35c428533cc9
>>         Author: Shengjiu Wang <shengjiu.wang@freescale.com
>>         <mailto:shengjiu.wang@freescale.com>>
>>         Date:   Tue Sep 9 17:13:26 2014 +0800
>>
>>              ARM: dts: imx6qdl: add baud clock and clock-names for ssi
>>
>>              Baud clock is used for bit clock generation in master mode.
>>         Ipg clock
>>              is peripheral clock and peripheral access clock.
>>
>>              Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com
>>         <mailto:shengjiu.wang@freescale.com>>
>>              Signed-off-by: Shawn Guo <shawn.guo@freescale.c
>>
>>       Awesome!
>>     It's great to see this stuff go mainline.
>>
>>
>> I have rebased to 3.18 rc-1. It has simplified the patch set a bit, as
>> more of  the Freescale things have hit mainline.
>> http://pastebin.com/C652GKe3 is my patchset.
>> Again, the card registers and thinks it plays, but there is no actual
>> output.
>>
> Make sure that "Output Mixer HiFi Playback Switch" is on
> Issue:
> # amixer cset numid=14,iface=MIXER,name='Output Mixer HiFi Playback
> Switch' on
> # alsactl store wm8731audio
>
 BRILLIANT!!!
We've got sound. Thank you for the answer.
Questions:
First, what is the best way to set that to on by default? I know "alsactl
store wm8731audio" Makes it survive reboots. On a fresh install, though,
that should probably default to on.

Second: I would love to see support for this get mainlined. Should I go
back and try to get simple-audio-card working, or stick with the compulab
glue driver?



>
>>
>>         > back to imx-wm8731.c for the driver. With this setup, the
>> driver registers,
>>         > and speaker-test thinks it plays, however there is no actual
>> sound output. I
>>         > call it progress.
>>
>>         Great progress: some things to check :
>>
>>         1. audmux settings
>>
>>     Well, the imx-wm8731 driver (It's really just glue for loading
>>     wm8731) does have audmux settings in it. These get called during the
>>     module probe. Not sure what might need to change there. My thoughts
>>     are that they should be correct.
>>
>>
>>         2. Can you try to run 'alsamixer' and make sure that the volume
>>         is not
>>         at the lowest level?
>>
>>     Yeah, I've made sure to check alsamixer and turn the volume up.
>>     Still no joy.
>>
>>
>>
>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Help with wm8731 support for the Utilite (imx6q)
  2014-10-22 12:13                         ` Jonathan Bennett
@ 2014-10-22 12:17                           ` Fabio Estevam
  2014-10-22 13:32                             ` Jonathan Bennett
  0 siblings, 1 reply; 20+ messages in thread
From: Fabio Estevam @ 2014-10-22 12:17 UTC (permalink / raw)
  To: Jonathan Bennett; +Cc: alsa-devel, Aaron Kling, Igor Grinberg, Valentin Raevsky

Hi Jonathan,

On Wed, Oct 22, 2014 at 10:13 AM, Jonathan Bennett
<jbscience87@gmail.com> wrote:

>  BRILLIANT!!!
> We've got sound. Thank you for the answer.

Good job :-)

> Questions:
> First, what is the best way to set that to on by default? I know "alsactl
> store wm8731audio" Makes it survive reboots. On a fresh install, though,
> that should probably default to on.
>
> Second: I would love to see support for this get mainlined. Should I go back
> and try to get simple-audio-card working, or stick with the compulab glue
> driver?

Yes, please try implementing simple-audio-card support.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Help with wm8731 support for the Utilite (imx6q)
  2014-10-22 12:17                           ` Fabio Estevam
@ 2014-10-22 13:32                             ` Jonathan Bennett
  2014-10-22 14:29                               ` Fabio Estevam
  0 siblings, 1 reply; 20+ messages in thread
From: Jonathan Bennett @ 2014-10-22 13:32 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: alsa-devel, Aaron Kling, Igor Grinberg, Valentin Raevsky

On Wed, Oct 22, 2014 at 7:17 AM, Fabio Estevam <festevam@gmail.com> wrote:

> Hi Jonathan,
>
> On Wed, Oct 22, 2014 at 10:13 AM, Jonathan Bennett
> <jbscience87@gmail.com> wrote:
>
> >  BRILLIANT!!!
> > We've got sound. Thank you for the answer.
>
> Good job :-)
>
> > Questions:
> > First, what is the best way to set that to on by default? I know "alsactl
> > store wm8731audio" Makes it survive reboots. On a fresh install, though,
> > that should probably default to on.
> >
> > Second: I would love to see support for this get mainlined. Should I go
> back
> > and try to get simple-audio-card working, or stick with the compulab glue
> > driver?
>
> Yes, please try implementing simple-audio-card support.
>
Applying what I've learned back to the simple-audio-card, I can get a
muffled pop in the headphones, like something is powering up. That's about
it. When playing to the card, things think they play fine, but no real
audio. I've checked volume levels, and also used Valentin's hint.

Sound bits from dts:

       sound {
                compatible = "simple-audio-card";
                simple-audio-card,model = "wm8731-audio";
                simple-audio-card,format = "i2s";
                simple-audio-card,audio-routing =
                        "Line Out", "LOUT",
                        "Line Out", "ROUT",
                        "LLINEIN","Line In",
                        "RLINEIN","Line In";
                simple-audio-card,cpu {
                        sound-dai = <&ssi2>;
                        bitclock-master;
                        frame-master;
                };
                simple-audio-card,codec {
                        sound-dai = <&codec>;
                };
        };

/* i2c3 */
&i2c3 {
   pinctrl-names = "default";
   pinctrl-0 = <&pinctrl_i2c3>;
   status = "okay";
   eeprom@50 {
      compatible = "at24,24c02";
      reg = <0x50>;
      pagesize = <16>;
   };

   codec: wm8731@1a {
      #sound-dai-cells = <0>;
      compatible = "wlf,wm8731";
      reg = <0x1a>;
      AVDD-supply = <&reg_3p3v>;
      HPVDD-supply = <&reg_3p3v>;
      DCVDD-supply = <&reg_3p3v>;
      DBVDD-supply = <&reg_3p3v>;
   };
};

&ssi2 {
        status = "okay";
        #sound-dai-cells = <0>;
};


&audmux {
        status = "okay";
        ssi2 {
                fsl,audmux-port = <1>;
                fsl,port-config = <
                        (IMX_AUDMUX_V2_PTCR_SYN |
                        IMX_AUDMUX_V2_PTCR_TFSDIR |
                        IMX_AUDMUX_V2_PTCR_TFSEL(3) |
                        IMX_AUDMUX_V2_PTCR_RCLKDIR |
                        IMX_AUDMUX_V2_PTCR_RCSEL(3 | 0x8) |
                        IMX_AUDMUX_V2_PTCR_TCLKDIR |
                        IMX_AUDMUX_V2_PTCR_TCSEL(3))
                        IMX_AUDMUX_V2_PDCR_RXDSEL(3)
                >;
        };
        pins4 {
                fsl,audmux-port = <3>;
                fsl,port-config = <
                        (IMX_AUDMUX_V2_PTCR_SYN |
                        IMX_AUDMUX_V2_PTCR_RCLKDIR |
                        IMX_AUDMUX_V2_PTCR_RCSEL(1 | 0x8) |
                        IMX_AUDMUX_V2_PTCR_TCLKDIR |
                        IMX_AUDMUX_V2_PTCR_TCSEL(1))
                        IMX_AUDMUX_V2_PDCR_RXDSEL(1)
                >;
        };

};

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Help with wm8731 support for the Utilite (imx6q)
  2014-10-22 13:32                             ` Jonathan Bennett
@ 2014-10-22 14:29                               ` Fabio Estevam
  2014-10-22 16:02                                 ` Fabio Estevam
  0 siblings, 1 reply; 20+ messages in thread
From: Fabio Estevam @ 2014-10-22 14:29 UTC (permalink / raw)
  To: Jonathan Bennett; +Cc: alsa-devel, Aaron Kling, Igor Grinberg, Valentin Raevsky

On Wed, Oct 22, 2014 at 11:32 AM, Jonathan Bennett
<jbscience87@gmail.com> wrote:

> Applying what I've learned back to the simple-audio-card, I can get a
> muffled pop in the headphones, like something is powering up. That's about
> it. When playing to the card, things think they play fine, but no real
> audio. I've checked volume levels, and also used Valentin's hint.
>
> Sound bits from dts:
>
>        sound {
>                 compatible = "simple-audio-card";
>                 simple-audio-card,model = "wm8731-audio";
>                 simple-audio-card,format = "i2s";
>                 simple-audio-card,audio-routing =
>                         "Line Out", "LOUT",
>                         "Line Out", "ROUT",
>                         "LLINEIN","Line In",
>                         "RLINEIN","Line In";
>                 simple-audio-card,cpu {
>                         sound-dai = <&ssi2>;
>                         bitclock-master;
>                         frame-master;
>                 };
>                 simple-audio-card,codec {
>                         sound-dai = <&codec>;
>                 };
>         };

What about changing this part to?

       sound {
                compatible = "simple-audio-card";
                simple-audio-card,model = "wm8731-audio";
                simple-audio-card,format = "i2s";
                simple-audio-card,bitclock-master = <&dailink0_master>;
                simple-audio-card,frame-master = <&dailink0_master>;
                simple-audio-card,audio-routing =
                        "Line Out", "LOUT",
                        "Line Out", "ROUT",
                        "LLINEIN","Line In",
                        "RLINEIN","Line In";

                simple-audio-card,cpu {
                        sound-dai = <&ssi2>;
                };

                dailink0_master: simple-audio-card,codec {
                        sound-dai = <&codec>;
                        clocks = <&clks IMX6QDL_CLK_CKO>;
                };
        };

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Help with wm8731 support for the Utilite (imx6q)
  2014-10-22 14:29                               ` Fabio Estevam
@ 2014-10-22 16:02                                 ` Fabio Estevam
  2014-10-22 17:43                                   ` Jonathan Bennett
  0 siblings, 1 reply; 20+ messages in thread
From: Fabio Estevam @ 2014-10-22 16:02 UTC (permalink / raw)
  To: Jonathan Bennett; +Cc: alsa-devel, Aaron Kling, Igor Grinberg, Valentin Raevsky

On Wed, Oct 22, 2014 at 12:29 PM, Fabio Estevam <festevam@gmail.com> wrote:

> What about changing this part to?

Forgot that you use ssi as master and codec as slave, so something
like this maybe:

       sound {
                compatible = "simple-audio-card";
                simple-audio-card,model = "wm8731-audio";
                simple-audio-card,format = "i2s";
                simple-audio-card,bitclock-master = <&dailink0_master>;
                simple-audio-card,frame-master = <&dailink0_master>;
                simple-audio-card,audio-routing =
                        "Line Out", "LOUT",
                        "Line Out", "ROUT",
                        "LLINEIN","Line In",
                        "RLINEIN","Line In";

                dailink0_master: simple-audio-card,cpu {
                        sound-dai = <&ssi2>;
                        clocks = <&clks IMX6QDL_CLK_CKO>;
                };

                simple-audio-card,codec {
                        sound-dai = <&codec>;

                };
        };

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Help with wm8731 support for the Utilite (imx6q)
  2014-10-22 16:02                                 ` Fabio Estevam
@ 2014-10-22 17:43                                   ` Jonathan Bennett
  2016-04-06  8:25                                     ` Karolina
  0 siblings, 1 reply; 20+ messages in thread
From: Jonathan Bennett @ 2014-10-22 17:43 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: alsa-devel, Aaron Kling, Igor Grinberg, Valentin Raevsky

On Wed, Oct 22, 2014 at 11:02 AM, Fabio Estevam <festevam@gmail.com> wrote:

> On Wed, Oct 22, 2014 at 12:29 PM, Fabio Estevam <festevam@gmail.com>
> wrote:
>
> > What about changing this part to?
>
> Forgot that you use ssi as master and codec as slave, so something
> like this maybe:
>
>        sound {
>                 compatible = "simple-audio-card";
>                 simple-audio-card,model = "wm8731-audio";
>                 simple-audio-card,format = "i2s";
>                 simple-audio-card,bitclock-master = <&dailink0_master>;
>                 simple-audio-card,frame-master = <&dailink0_master>;
>                 simple-audio-card,audio-routing =
>                         "Line Out", "LOUT",
>                         "Line Out", "ROUT",
>                         "LLINEIN","Line In",
>                         "RLINEIN","Line In";
>
>                 dailink0_master: simple-audio-card,cpu {
>                         sound-dai = <&ssi2>;
>                         clocks = <&clks IMX6QDL_CLK_CKO>;
>
Tried several different clocks here, didn't seem to make a difference. Open
to thoughts here, but I'm beginning to be inclined to stick with the glue
driver that works. I'd eventually like to get this stuff mainlined, but
want to make sure to do it correctly.

>                 };
>
>                 simple-audio-card,codec {
>                         sound-dai = <&codec>;
>
>                 };
>         };
>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Help with wm8731 support for the Utilite (imx6q)
  2014-10-22 17:43                                   ` Jonathan Bennett
@ 2016-04-06  8:25                                     ` Karolina
  0 siblings, 0 replies; 20+ messages in thread
From: Karolina @ 2016-04-06  8:25 UTC (permalink / raw)
  To: alsa-devel

Jonathan,

could you please tell me how did you connect WM8731 to development board?

I have Carambola2 and am trying to play .wav file. Have downloaded and build
this module: https://github.com/sonnyyu/ar9331-i2s-alsa
No I just don't know how to connect pins on
http://www.mikroe.com/add-on-boards/audio-voice/audio-codec-proto/ and
Carambola...

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2016-04-06  8:30 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-17 16:57 Help with wm8731 support for the Utilite (imx6q) Jonathan Bennett
2014-10-18 19:13 ` Fabio Estevam
2014-10-19  5:35   ` Jonathan Bennett
2014-10-19  5:58     ` Jonathan Bennett
2014-10-20 12:06       ` Fabio Estevam
2014-10-20 16:29         ` Fabio Estevam
2014-10-20 19:59           ` Jonathan Bennett
2014-10-21 12:06             ` Valentin Raevsky
2014-10-21 18:04               ` Jonathan Bennett
2014-10-21 18:12                 ` Fabio Estevam
2014-10-21 18:49                   ` Jonathan Bennett
2014-10-21 22:37                     ` Jonathan Bennett
2014-10-22  8:04                       ` Valentin Raevsky
2014-10-22 12:13                         ` Jonathan Bennett
2014-10-22 12:17                           ` Fabio Estevam
2014-10-22 13:32                             ` Jonathan Bennett
2014-10-22 14:29                               ` Fabio Estevam
2014-10-22 16:02                                 ` Fabio Estevam
2014-10-22 17:43                                   ` Jonathan Bennett
2016-04-06  8:25                                     ` Karolina

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.