[alsa-devel] [PATCH] ASoC: wm8960: Let wm8960 codec driver manage its own MCLK

Mark Brown broonie at kernel.org
Wed Dec 3 13:41:24 CET 2014


On Wed, Dec 03, 2014 at 07:00:38PM +0800, Zidan Wang wrote:

>  #include <sound/core.h>
> @@ -988,6 +990,8 @@ static void wm8960_set_pdata_from_of(struct i2c_client *i2c,
>  
>  	if (of_property_read_bool(np, "wlf,shared-lrclk"))
>  		pdata->shared_lrclk = true;
> +
> +	pdata->mclk = devm_clk_get(&i2c->dev, NULL);

This isn't platform data then...  we also need to check the return code
here and handle at least probe deferral.

> +    /* Mark the mclk pointer to NULL if no mclk assigned */
> +	if (IS_ERR(wm8960->pdata.mclk)) {

Indentation is wrong for the comment here.

> +		/* But do not ignore the request for probe defer */
> +		if (PTR_ERR(wm8960->pdata.mclk) == -EPROBE_DEFER)
> +			return -EPROBE_DEFER;
> +		wm8960->pdata.mclk = NULL;
> +	}

OK, so we are trying to handle probe deferral - but this should be next
to the clk_get().

> +	if (wm8960->pdata.mclk) {
> +		ret = clk_prepare_enable(wm8960->pdata.mclk);

Just continue to use !IS_ERR() - NULL is a valid clock.

> +static int wm8960_runtime_suspend(struct device *dev)
> +{
> +	struct wm8960_priv *wm8960 = dev_get_drvdata(dev);
> +
> +	/* Power down PLL to save power */
> +	regmap_update_bits(wm8960->regmap, WM8960_POWER2, 0x1, 0);

This isn't undone by the resume.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20141203/9101a12c/attachment.sig>


More information about the Alsa-devel mailing list