Skip to content

Commit

Permalink
ASoC: Sync initial widget state with hardware
Browse files Browse the repository at this point in the history
ASoC generally uses the register defaults for everything, but in some
cases the hardware will default to enabling some of the DAPM widgets
(clocks for example). Ensure that DAPM knows about the actual widget
state at initialisation by reading the enable bits after instantiating
the widgets so they don't get left enabled needlessly.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
  • Loading branch information
Mark Brown committed Feb 9, 2011
1 parent 6ed8f14 commit b66a70d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions sound/soc/soc-dapm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1627,6 +1627,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_add_routes);
int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm)
{
struct snd_soc_dapm_widget *w;
unsigned int val;

list_for_each_entry(w, &dapm->card->widgets, list)
{
Expand Down Expand Up @@ -1675,6 +1676,18 @@ int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm)
case snd_soc_dapm_post:
break;
}

/* Read the initial power state from the device */
if (w->reg >= 0) {
val = snd_soc_read(w->codec, w->reg);
val &= 1 << w->shift;
if (w->invert)
val = !val;

if (val)
w->power = 1;
}

w->new = 1;
}

Expand Down

0 comments on commit b66a70d

Please sign in to comment.