Skip to content

Commit

Permalink
ASoC: Ensure all DAPM widgets have a power check callback
Browse files Browse the repository at this point in the history
Makes the code simpler.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Mark Brown committed Oct 4, 2011
1 parent f9de6d7 commit 35c64bc
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions sound/soc/soc-dapm.c
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,11 @@ static int dapm_supply_check_power(struct snd_soc_dapm_widget *w)
return power;
}

static int dapm_always_on_check_power(struct snd_soc_dapm_widget *w)
{
return 1;
}

static int dapm_seq_compare(struct snd_soc_dapm_widget *a,
struct snd_soc_dapm_widget *b,
bool power_up)
Expand Down Expand Up @@ -1229,9 +1234,6 @@ static void dapm_power_one_widget(struct snd_soc_dapm_widget *w,
break;

default:
if (!w->power_check)
break;

if (!w->force)
power = w->power_check(w);
else
Expand Down Expand Up @@ -2090,6 +2092,9 @@ int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm)
break;
}

if (!w->power_check)
w->power_check = dapm_always_on_check_power;

/* Read the initial power state from the device */
if (w->reg >= 0) {
val = soc_widget_read(w, w->reg);
Expand Down

0 comments on commit 35c64bc

Please sign in to comment.