[alsa-devel] [PATCH 2/5] ASoC: twl6040: Prevent extra power transitions during resume

Peter Ujfalusi peter.ujfalusi at ti.com
Fri Jan 11 14:40:20 CET 2013


On 01/11/2013 12:52 PM, Mark Brown wrote:
> On Fri, Jan 11, 2013 at 11:32:32AM +0100, Peter Ujfalusi wrote:
> 
>> -	twl6040_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
>> -	twl6040_set_bias_level(codec, codec->dapm.suspend_bias_level);
>> +	if (codec->dapm.bias_level != codec->dapm.suspend_bias_level) {
>> +		twl6040_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
>> +		twl6040_set_bias_level(codec, codec->dapm.suspend_bias_level);
>> +	}
> 
> The device should always be in either _STANDBY or _OFF (depending on if
> it supports idle_bias_off) before it tries to suspend so
> suspend_bias_level ought to be redundant.  We should really get round to
> killing it...

Yes, that's true. At the moment I can just send the codec to _STANDBY in
resume since I don't have idle_bias_off support ready (due to external
dependencies, but I'm working on it). But when we have idle_bias_off support
we want to avoid sending the codec to _STANDBY here just that ASoC core will
put us back to _OFF later on. On/Off is a bit expensive on twl6040.
Since the core saves the previous bias_level in before suspend I can just do
this here:

	twl6040_set_bias_level(codec, codec->dapm.suspend_bias_level);

If we were in _OFF before it is going to do nothing, but if we were in
_STANDBY it brings the codec back.

-- 
Péter


More information about the Alsa-devel mailing list