提交 cdef2ad3 编写于 作者: L Lars-Peter Clausen 提交者: Mark Brown

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: NLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: NMark Brown <broonie@kernel.org>
上级 7ddd4cd5
...@@ -1169,38 +1169,6 @@ static int dapm_generic_check_power(struct snd_soc_dapm_widget *w) ...@@ -1169,38 +1169,6 @@ static int dapm_generic_check_power(struct snd_soc_dapm_widget *w)
return out != 0 && in != 0; 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 */ /* Check to see if a power supply is needed */
static int dapm_supply_check_power(struct snd_soc_dapm_widget *w) 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, ...@@ -3086,12 +3054,6 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
case snd_soc_dapm_mux: case snd_soc_dapm_mux:
w->power_check = dapm_generic_check_power; w->power_check = dapm_generic_check_power;
break; 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_adc:
case snd_soc_dapm_aif_out: case snd_soc_dapm_aif_out:
case snd_soc_dapm_dac: case snd_soc_dapm_dac:
...@@ -3106,6 +3068,8 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm, ...@@ -3106,6 +3068,8 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
case snd_soc_dapm_mic: case snd_soc_dapm_mic:
case snd_soc_dapm_line: case snd_soc_dapm_line:
case snd_soc_dapm_dai_link: 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; w->power_check = dapm_generic_check_power;
break; break;
case snd_soc_dapm_supply: case snd_soc_dapm_supply:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册