ASoC: Specify target bias state directly as a bias state
PATCH 1/2 ASoC: Specify target bias state directly as a bias state
Rather than a simple flag to say if we want the DAPM context to be at full power specify the target bias state. This should have no current effect but is a bit more direct and so makes it easier to change our decisions about the which bias state to go into in future.
--- include/sound/soc-dapm.h | 2 +- include/sound/soc.h | 8 +++--- sound/soc/soc-dapm.c | 60 +++++++++++++++++++++++++-------------------- 3 files changed, 38 insertions(+), 32 deletions(-)
include/sound/soc-dapm.h +1 -1
@@ -510,7 +510,7 @@ struct snd_soc_dapm_context {struct snd_soc_card *card;/* parent card */ /* used during DAPM updates */ -int dev_power; +enum snd_soc_bias_level target_bias_level;struct list_head list;#ifdef CONFIG_DEBUG_FS
include/sound/soc.h +4 -4
@@ -214,10 +214,10 @@* @OFF: Power Off. No restrictions on transition times. */ enum snd_soc_bias_level { -SND_SOC_BIAS_OFF , -SND_SOC_BIAS_STANDBY , -SND_SOC_BIAS_PREPARE , -SND_SOC_BIAS_ON , +SND_SOC_BIAS_OFF =0 , +SND_SOC_BIAS_STANDBY =1 , +SND_SOC_BIAS_PREPARE =2 , +SND_SOC_BIAS_ON =3 , };struct snd_jack ;
sound/soc/soc-dapm.c +33 -27
126 lines not on this page · raw message
Signature · 1 line
1.7.5.3
PATCH 2/2 ASoC: Don't bring the CODEC up to full power for supplies and biases
If the only widgets active within a CODEC are supplies and micbiases we are not passing audio, we are probably just doing microphone detection. This will not generally require either fully accurate reference voltages or much power so
If this turns out to be unsuitable for some systems we can provide a facility to override this decision.
--- sound/soc/soc-dapm.c | 23 +++++++++++++++++++++-- 1 files changed, 21 insertions(+), 2 deletions(-)
sound/soc/soc-dapm.c +21 -2
@@ -1147,8 +1147,27 @@ static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event) power = w->power_check (w); else power =1 ; -if (power) - w->dapm->target_bias_level =SND_SOC_BIAS_ON ; + +if (power) { + d = w->dapm; + +/* Supplies and micbiases only bring +* the context up to STANDBY as unless +* something else is active and +* passing audio they generally don't +* require full power. +*/ +switch (w->id) { +case snd_soc_dapm_supply: +case snd_soc_dapm_micbias: +if (d->target_bias_level <SND_SOC_BIAS_STANDBY ) + d->target_bias_level =SND_SOC_BIAS_STANDBY ; +break ; +default : + d->target_bias_level =SND_SOC_BIAS_ON ; +break ; + } + }if (w->power == power)continue ;
Signature · 1 line
1.7.5.3
Quoted 6 lines · Mark Brown
Rather than a simple flag to say if we want the DAPM context to be at full power specify the target bias state. This should have no current effect but is a bit more direct and so makes it easier to change our decisions about the which bias state to go into in future.
Signed-off-by Mark Brown <[email protected]>
Both