diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-09-28 13:23:53 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-10-04 11:50:18 -0400 |
commit | 35c64bcad5c8244d973efbf7e58f6e0e09635504 (patch) | |
tree | 7a6803cfe34232f20793fbae86fd1e8593f0bf6f /sound/soc/soc-dapm.c | |
parent | f9de6d741d246583a8fdcf212cf14456a1622ce1 (diff) |
ASoC: Ensure all DAPM widgets have a power check callback
Makes the code simpler.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r-- | sound/soc/soc-dapm.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 12bd01a1863a..8d760449965d 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -857,6 +857,11 @@ static int dapm_supply_check_power(struct snd_soc_dapm_widget *w) | |||
857 | return power; | 857 | return power; |
858 | } | 858 | } |
859 | 859 | ||
860 | static int dapm_always_on_check_power(struct snd_soc_dapm_widget *w) | ||
861 | { | ||
862 | return 1; | ||
863 | } | ||
864 | |||
860 | static int dapm_seq_compare(struct snd_soc_dapm_widget *a, | 865 | static int dapm_seq_compare(struct snd_soc_dapm_widget *a, |
861 | struct snd_soc_dapm_widget *b, | 866 | struct snd_soc_dapm_widget *b, |
862 | bool power_up) | 867 | bool power_up) |
@@ -1229,9 +1234,6 @@ static void dapm_power_one_widget(struct snd_soc_dapm_widget *w, | |||
1229 | break; | 1234 | break; |
1230 | 1235 | ||
1231 | default: | 1236 | default: |
1232 | if (!w->power_check) | ||
1233 | break; | ||
1234 | |||
1235 | if (!w->force) | 1237 | if (!w->force) |
1236 | power = w->power_check(w); | 1238 | power = w->power_check(w); |
1237 | else | 1239 | else |
@@ -2090,6 +2092,9 @@ int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm) | |||
2090 | break; | 2092 | break; |
2091 | } | 2093 | } |
2092 | 2094 | ||
2095 | if (!w->power_check) | ||
2096 | w->power_check = dapm_always_on_check_power; | ||
2097 | |||
2093 | /* Read the initial power state from the device */ | 2098 | /* Read the initial power state from the device */ |
2094 | if (w->reg >= 0) { | 2099 | if (w->reg >= 0) { |
2095 | val = soc_widget_read(w, w->reg); | 2100 | val = soc_widget_read(w, w->reg); |