summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-10-04 22:15:59 +0100
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-10-05 11:22:22 +0100
commit9b8a83b205bd07b06784028effd94515fe9278c3 (patch)
tree82e015462cf5e36769c2da61d3bf49f6d2873e63 /sound/soc/soc-dapm.c
parent75c1f891b4c394c607532fdcea294c2556e410c4 (diff)
downloadblackbird-op-linux-9b8a83b205bd07b06784028effd94515fe9278c3.tar.gz
blackbird-op-linux-9b8a83b205bd07b06784028effd94515fe9278c3.zip
ASoC: Only run power_check() on a widget once per run
Some widgets will get power_check() run on them more than once during a DAPM run, most commonly due to supply widgets checking to see if their consumers are powered up. It's wasteful to do this so cache the result of power_check() during a run. For one system I tested this on I got an improvement of: Power Path Neighbour Before: 106 970 1186 After: 69 727 905 from this. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c15
1 files changed, 13 insertions, 2 deletions
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);
static int dapm_widget_power_check(struct snd_soc_dapm_widget *w)
{
+ if (w->power_checked)
+ return w->new_power;
+
if (w->force)
- return 1;
+ w->new_power = 1;
else
- return w->power_check(w);
+ w->new_power = w->power_check(w);
+
+ w->power_checked = true;
+
+ return w->new_power;
}
/* 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)
memset(&card->dapm_stats, 0, sizeof(card->dapm_stats));
+ list_for_each_entry(w, &card->widgets, list) {
+ w->power_checked = false;
+ }
+
/* Check which widgets we need to power and store them in
* lists indicating if they should be powered up or down. We
* only check widgets that have been flagged as dirty but note
OpenPOWER on IntegriCloud