ASoC: dapm: Remove special DAI widget power check functions
authorLars-Peter Clausen <lars@metafoo.de>
Mon, 20 Oct 2014 17:36:38 +0000 (19:36 +0200)
committerMark Brown <broonie@kernel.org>
Wed, 22 Oct 2014 11:11:38 +0000 (12:11 +0100)
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>
sound/soc/soc-dapm.c

index 28269f219e1680654bdb50c51b94261efcf902f9..219d73c27a8c5704975468128b97d60482a24409 100644 (file)
@@ -1169,38 +1169,6 @@ static int dapm_generic_check_power(struct snd_soc_dapm_widget *w)
        return out != 0 && in != 0;
 }
 
-/* Check to see if an ADC has power */
-static int dapm_adc_check_power(struct snd_soc_dapm_widget *w)
-{
-       int in;
-
-       DAPM_UPDATE_STAT(w, power_checks);
-
-       if (w->active) {
-               in = is_connected_input_ep(w, NULL);
-               dapm_clear_walk_input(w->dapm, &w->sources);
-               return in != 0;
-       } else {
-               return dapm_generic_check_power(w);
-       }
-}
-
-/* Check to see if a DAC has power */
-static int dapm_dac_check_power(struct snd_soc_dapm_widget *w)
-{
-       int out;
-
-       DAPM_UPDATE_STAT(w, power_checks);
-
-       if (w->active) {
-               out = is_connected_output_ep(w, NULL);
-               dapm_clear_walk_output(w->dapm, &w->sinks);
-               return out != 0;
-       } else {
-               return dapm_generic_check_power(w);
-       }
-}
-
 /* Check to see if a power supply is needed */
 static int dapm_supply_check_power(struct snd_soc_dapm_widget *w)
 {
@@ -3086,12 +3054,6 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
        case snd_soc_dapm_mux:
                w->power_check = dapm_generic_check_power;
                break;
-       case snd_soc_dapm_dai_out:
-               w->power_check = dapm_adc_check_power;
-               break;
-       case snd_soc_dapm_dai_in:
-               w->power_check = dapm_dac_check_power;
-               break;
        case snd_soc_dapm_adc:
        case snd_soc_dapm_aif_out:
        case snd_soc_dapm_dac:
@@ -3106,6 +3068,8 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
        case snd_soc_dapm_mic:
        case snd_soc_dapm_line:
        case snd_soc_dapm_dai_link:
+       case snd_soc_dapm_dai_out:
+       case snd_soc_dapm_dai_in:
                w->power_check = dapm_generic_check_power;
                break;
        case snd_soc_dapm_supply: