aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2014-10-20 13:36:38 -0400
committerMark Brown <broonie@kernel.org>2014-10-22 07:11:38 -0400
commitcdef2ad3ae64cc1ab2daeff26335e0dde988eed7 (patch)
treec10d76157fd806da9adfd59625458e13b46f04b6
parent7ddd4cd5c31ccaf32febe52462f9fdc915893212 (diff)
ASoC: dapm: Remove special DAI widget power check functions
dapm_adc_check_power() checks if the widget is active, if yes it only checks whether there are any connected input paths. Otherwise it calls dapm_generic_check_power() which will check for both connected input and output paths. But the function that checks for connected output paths will return true if the widget is a active sink. Which means the generic power check function will work just fine and there is no need for a special power check function. The same applies for dapm_dac_check_power(), but with input and output paths reversed. This patch removes both dapm_adc_check_power() and dapm_dac_check_power() and replace their usage with dapm_generic_check_power(). Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/soc-dapm.c40
1 files changed, 2 insertions, 38 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 28269f219e16..219d73c27a8c 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1169,38 +1169,6 @@ static int dapm_generic_check_power(struct snd_soc_dapm_widget *w)
1169 return out != 0 && in != 0; 1169 return out != 0 && in != 0;
1170} 1170}
1171 1171
1172/* Check to see if an ADC has power */
1173static int dapm_adc_check_power(struct snd_soc_dapm_widget *w)
1174{
1175 int in;
1176
1177 DAPM_UPDATE_STAT(w, power_checks);
1178
1179 if (w->active) {
1180 in = is_connected_input_ep(w, NULL);
1181 dapm_clear_walk_input(w->dapm, &w->sources);
1182 return in != 0;
1183 } else {
1184 return dapm_generic_check_power(w);
1185 }
1186}
1187
1188/* Check to see if a DAC has power */
1189static int dapm_dac_check_power(struct snd_soc_dapm_widget *w)
1190{
1191 int out;
1192
1193 DAPM_UPDATE_STAT(w, power_checks);
1194
1195 if (w->active) {
1196 out = is_connected_output_ep(w, NULL);
1197 dapm_clear_walk_output(w->dapm, &w->sinks);
1198 return out != 0;
1199 } else {
1200 return dapm_generic_check_power(w);
1201 }
1202}
1203
1204/* Check to see if a power supply is needed */ 1172/* Check to see if a power supply is needed */
1205static int dapm_supply_check_power(struct snd_soc_dapm_widget *w) 1173static int dapm_supply_check_power(struct snd_soc_dapm_widget *w)
1206{ 1174{
@@ -3086,12 +3054,6 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
3086 case snd_soc_dapm_mux: 3054 case snd_soc_dapm_mux:
3087 w->power_check = dapm_generic_check_power; 3055 w->power_check = dapm_generic_check_power;
3088 break; 3056 break;
3089 case snd_soc_dapm_dai_out:
3090 w->power_check = dapm_adc_check_power;
3091 break;
3092 case snd_soc_dapm_dai_in:
3093 w->power_check = dapm_dac_check_power;
3094 break;
3095 case snd_soc_dapm_adc: 3057 case snd_soc_dapm_adc:
3096 case snd_soc_dapm_aif_out: 3058 case snd_soc_dapm_aif_out:
3097 case snd_soc_dapm_dac: 3059 case snd_soc_dapm_dac:
@@ -3106,6 +3068,8 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
3106 case snd_soc_dapm_mic: 3068 case snd_soc_dapm_mic:
3107 case snd_soc_dapm_line: 3069 case snd_soc_dapm_line:
3108 case snd_soc_dapm_dai_link: 3070 case snd_soc_dapm_dai_link:
3071 case snd_soc_dapm_dai_out:
3072 case snd_soc_dapm_dai_in:
3109 w->power_check = dapm_generic_check_power; 3073 w->power_check = dapm_generic_check_power;
3110 break; 3074 break;
3111 case snd_soc_dapm_supply: 3075 case snd_soc_dapm_supply: