Skip to content

Commit

Permalink
ASoC: dapm - Make DAPM reset code a separate function.
Browse files Browse the repository at this point in the history
It's useful to export the DAPM reset as a static function for future use
by other DAPM functions. e.g. The dynamic PCM query widgets resets the DAPM
graph before working out active paths.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Liam Girdwood authored and Mark Brown committed Feb 15, 2012
1 parent 65f01ef commit 6c120e1
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions sound/soc/soc-dapm.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,19 @@ static inline struct snd_soc_card *dapm_get_soc_card(
return NULL;
}

static void dapm_reset(struct snd_soc_card *card)
{
struct snd_soc_dapm_widget *w;

memset(&card->dapm_stats, 0, sizeof(card->dapm_stats));

list_for_each_entry(w, &card->widgets, list) {
w->power_checked = false;
w->inputs = -1;
w->outputs = -1;
}
}

static int soc_widget_read(struct snd_soc_dapm_widget *w, int reg)
{
if (w->codec)
Expand Down Expand Up @@ -1402,13 +1415,7 @@ static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event)
}
}

memset(&card->dapm_stats, 0, sizeof(card->dapm_stats));

list_for_each_entry(w, &card->widgets, list) {
w->power_checked = false;
w->inputs = -1;
w->outputs = -1;
}
dapm_reset(card);

/* Check which widgets we need to power and store them in
* lists indicating if they should be powered up or down. We
Expand Down

0 comments on commit 6c120e1

Please sign in to comment.