[alsa-devel] [PATCH] ASoC: WM8985: Register notifier for the regulator being disabled

Mark Brown broonie at opensource.wolfsonmicro.com
Wed Sep 29 19:43:23 CEST 2010

On Wed, Sep 29, 2010 at 11:38:37AM +0100, Dimitris Papastamos wrote:
> Make sure we get an event when the regulator is disabled so we know
> we have to sync the cache afterwards.

Note that the whole callback thing is more important for things with
idle_bias_off (which might get the regulators powered down at runtime)
than for other things which don't go down to _BIAS_OFF at runtime so
would only trigger the callback on suspend anyway.

Not a problem doing the work, it'll just be unlikely to get called at

> Minor stylistic changes.

Always split different things out into separate patches unless they
overlap with each other a lot.

> +/*
> + * We can't use the same notifier block for more than one supply and
> + * there's no way I can see to get from a callback to the caller
> + * except container_of().
> + */

Jarkko's way of doing this was a bit nicer, but both aren't great :(

> @@ -782,7 +806,7 @@ static int wm8985_set_pll(struct snd_soc_dai *dai, int pll_id,
>  {
>  	int ret;
>  	struct snd_soc_codec *codec;
> -	struct pll_div pll_div;
> +	struct pll_div pll_div = { 0 };
>  	codec = dai->codec;
>  	if (freq_in && freq_out) {

It's better to restructure the code so that the compiler is able to
follow the control flow and see that there's no uninitialised access -
this sort of change will just shut up legitimate warnings as well.  Some
of the other CODEC drivers (wm8400 is one) have had similar changes
which seem to do the trick.

More information about the Alsa-devel mailing list