diff options
-rw-r--r-- | include/sound/soc-dapm.h | 2 | ||||
-rw-r--r-- | sound/soc/soc-dapm.c | 27 |
2 files changed, 15 insertions, 14 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index fcc929da0339..839a97b63269 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h | |||
@@ -367,6 +367,8 @@ struct snd_soc_dapm_widget { | |||
367 | unsigned char suspend:1; /* was active before suspend */ | 367 | unsigned char suspend:1; /* was active before suspend */ |
368 | unsigned char pmdown:1; /* waiting for timeout */ | 368 | unsigned char pmdown:1; /* waiting for timeout */ |
369 | 369 | ||
370 | int (*power_check)(struct snd_soc_dapm_widget *w); | ||
371 | |||
370 | /* external events */ | 372 | /* external events */ |
371 | unsigned short event_flags; /* flags to specify event types */ | 373 | unsigned short event_flags; /* flags to specify event types */ |
372 | int (*event)(struct snd_soc_dapm_widget*, struct snd_kcontrol *, int); | 374 | int (*event)(struct snd_soc_dapm_widget*, struct snd_kcontrol *, int); |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 22522e2d83a4..d3d17354e76c 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -631,20 +631,7 @@ static int dapm_power_widget(struct snd_soc_codec *codec, int event, | |||
631 | { | 631 | { |
632 | int power, ret; | 632 | int power, ret; |
633 | 633 | ||
634 | /* Work out the new power state */ | ||
635 | switch (w->id) { | 634 | switch (w->id) { |
636 | case snd_soc_dapm_vmid: | ||
637 | /* No action required */ | ||
638 | return 0; | ||
639 | |||
640 | case snd_soc_dapm_adc: | ||
641 | power = dapm_adc_check_power(w); | ||
642 | break; | ||
643 | |||
644 | case snd_soc_dapm_dac: | ||
645 | power = dapm_dac_check_power(w); | ||
646 | break; | ||
647 | |||
648 | case snd_soc_dapm_pre: | 635 | case snd_soc_dapm_pre: |
649 | if (!w->event) | 636 | if (!w->event) |
650 | return 0; | 637 | return 0; |
@@ -680,10 +667,13 @@ static int dapm_power_widget(struct snd_soc_codec *codec, int event, | |||
680 | return 0; | 667 | return 0; |
681 | 668 | ||
682 | default: | 669 | default: |
683 | power = dapm_generic_check_power(w); | ||
684 | break; | 670 | break; |
685 | } | 671 | } |
686 | 672 | ||
673 | if (!w->power_check) | ||
674 | return 0; | ||
675 | |||
676 | power = w->power_check(w); | ||
687 | if (w->power == power) | 677 | if (w->power == power) |
688 | return 0; | 678 | return 0; |
689 | w->power = power; | 679 | w->power = power; |
@@ -1147,15 +1137,22 @@ int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec) | |||
1147 | case snd_soc_dapm_switch: | 1137 | case snd_soc_dapm_switch: |
1148 | case snd_soc_dapm_mixer: | 1138 | case snd_soc_dapm_mixer: |
1149 | case snd_soc_dapm_mixer_named_ctl: | 1139 | case snd_soc_dapm_mixer_named_ctl: |
1140 | w->power_check = dapm_generic_check_power; | ||
1150 | dapm_new_mixer(codec, w); | 1141 | dapm_new_mixer(codec, w); |
1151 | break; | 1142 | break; |
1152 | case snd_soc_dapm_mux: | 1143 | case snd_soc_dapm_mux: |
1153 | case snd_soc_dapm_value_mux: | 1144 | case snd_soc_dapm_value_mux: |
1145 | w->power_check = dapm_generic_check_power; | ||
1154 | dapm_new_mux(codec, w); | 1146 | dapm_new_mux(codec, w); |
1155 | break; | 1147 | break; |
1156 | case snd_soc_dapm_adc: | 1148 | case snd_soc_dapm_adc: |
1149 | w->power_check = dapm_adc_check_power; | ||
1150 | break; | ||
1157 | case snd_soc_dapm_dac: | 1151 | case snd_soc_dapm_dac: |
1152 | w->power_check = dapm_dac_check_power; | ||
1153 | break; | ||
1158 | case snd_soc_dapm_pga: | 1154 | case snd_soc_dapm_pga: |
1155 | w->power_check = dapm_generic_check_power; | ||
1159 | dapm_new_pga(codec, w); | 1156 | dapm_new_pga(codec, w); |
1160 | break; | 1157 | break; |
1161 | case snd_soc_dapm_input: | 1158 | case snd_soc_dapm_input: |
@@ -1165,6 +1162,8 @@ int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec) | |||
1165 | case snd_soc_dapm_hp: | 1162 | case snd_soc_dapm_hp: |
1166 | case snd_soc_dapm_mic: | 1163 | case snd_soc_dapm_mic: |
1167 | case snd_soc_dapm_line: | 1164 | case snd_soc_dapm_line: |
1165 | w->power_check = dapm_generic_check_power; | ||
1166 | break; | ||
1168 | case snd_soc_dapm_vmid: | 1167 | case snd_soc_dapm_vmid: |
1169 | case snd_soc_dapm_pre: | 1168 | case snd_soc_dapm_pre: |
1170 | case snd_soc_dapm_post: | 1169 | case snd_soc_dapm_post: |