mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-05 16:37:50 +00:00
ASoC: Factor out generic widget power checks
This will form a basis for further power check refactoring: the overall goal of these changes is to allow us to check power separately to applying it, allowing improvements in the power sequencing algorithms. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
parent
9b5b0c0159
commit
cd0f2d4736
1 changed files with 14 additions and 5 deletions
|
@ -581,6 +581,19 @@ static int dapm_generic_apply_power(struct snd_soc_dapm_widget *w)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Generic check to see if a widget should be powered.
|
||||||
|
*/
|
||||||
|
static int dapm_generic_check_power(struct snd_soc_dapm_widget *w)
|
||||||
|
{
|
||||||
|
int in, out;
|
||||||
|
|
||||||
|
in = is_connected_input_ep(w);
|
||||||
|
dapm_clear_walk(w->codec);
|
||||||
|
out = is_connected_output_ep(w);
|
||||||
|
dapm_clear_walk(w->codec);
|
||||||
|
return out != 0 && in != 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Scan a single DAPM widget for a complete audio path and update the
|
* Scan a single DAPM widget for a complete audio path and update the
|
||||||
* power status appropriately.
|
* power status appropriately.
|
||||||
|
@ -653,11 +666,7 @@ static int dapm_power_widget(struct snd_soc_codec *codec, int event,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* all other widgets */
|
/* all other widgets */
|
||||||
in = is_connected_input_ep(w);
|
power = dapm_generic_check_power(w);
|
||||||
dapm_clear_walk(w->codec);
|
|
||||||
out = is_connected_output_ep(w);
|
|
||||||
dapm_clear_walk(w->codec);
|
|
||||||
power = (out != 0 && in != 0) ? 1 : 0;
|
|
||||||
power_change = (w->power == power) ? 0 : 1;
|
power_change = (w->power == power) ? 0 : 1;
|
||||||
w->power = power;
|
w->power = power;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue