[alsa-devel] Help with wm8731 support for the Utilite (imx6q)

Jonathan Bennett jbscience87 at gmail.com
Tue Oct 21 20:04:27 CEST 2014


On Tue, Oct 21, 2014 at 7:06 AM, Valentin Raevsky <valentin at 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 at gmail.com
>> <mailto:festevam at gmail.com>> wrote:
>>
>>     On Mon, Oct 20, 2014 at 10:06 AM, Fabio Estevam <festevam at gmail.com
>>     <mailto:festevam at 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 at 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,
>>
>>
>>
>


More information about the Alsa-devel mailing list