summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/soc-dapm.h2
-rw-r--r--sound/soc/soc-dapm.c15
2 files changed, 15 insertions, 2 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index c080635b3c35..e2853daf802c 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -473,6 +473,8 @@ struct snd_soc_dapm_widget {
473 unsigned char ext:1; /* has external widgets */ 473 unsigned char ext:1; /* has external widgets */
474 unsigned char force:1; /* force state */ 474 unsigned char force:1; /* force state */
475 unsigned char ignore_suspend:1; /* kept enabled over suspend */ 475 unsigned char ignore_suspend:1; /* kept enabled over suspend */
476 unsigned char new_power:1; /* power from this run */
477 unsigned char power_checked:1; /* power checked this run */
476 int subseq; /* sort within widget type */ 478 int subseq; /* sort within widget type */
477 479
478 int (*power_check)(struct snd_soc_dapm_widget *w); 480 int (*power_check)(struct snd_soc_dapm_widget *w);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index e6a08822227e..c39146d435e2 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -787,10 +787,17 @@ EXPORT_SYMBOL_GPL(dapm_reg_event);
787 787
788static int dapm_widget_power_check(struct snd_soc_dapm_widget *w) 788static int dapm_widget_power_check(struct snd_soc_dapm_widget *w)
789{ 789{
790 if (w->power_checked)
791 return w->new_power;
792
790 if (w->force) 793 if (w->force)
791 return 1; 794 w->new_power = 1;
792 else 795 else
793 return w->power_check(w); 796 w->new_power = w->power_check(w);
797
798 w->power_checked = true;
799
800 return w->new_power;
794} 801}
795 802
796/* Generic check to see if a widget should be powered. 803/* Generic check to see if a widget should be powered.
@@ -1322,6 +1329,10 @@ static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event)
1322 1329
1323 memset(&card->dapm_stats, 0, sizeof(card->dapm_stats)); 1330 memset(&card->dapm_stats, 0, sizeof(card->dapm_stats));
1324 1331
1332 list_for_each_entry(w, &card->widgets, list) {
1333 w->power_checked = false;
1334 }
1335
1325 /* Check which widgets we need to power and store them in 1336 /* Check which widgets we need to power and store them in
1326 * lists indicating if they should be powered up or down. We 1337 * lists indicating if they should be powered up or down. We
1327 * only check widgets that have been flagged as dirty but note 1338 * only check widgets that have been flagged as dirty but note