Hello,
Second try for the analog bypass implementation.
Since the first try most of the things has been turned around - I tried to follow Mark's advice, I hope I managed well enough: [1] New power, codec state handling The codec will be powered at all time, except if the codec's bias level has been set to SND_SOC_BIAS_OFF via the twl4030_set_bias_level call.
[2] Keeping the power consumption on the lowest level When the codec is in SND_SOC_BIAS_ON state (playback/recording), there is nothing can be done, the amplifiers are powered, PLL is enabled. When the codec enters to SND_SOC_BIAS_STANDBY state, two thing can happen: - If none of the bypass switches are enabled, than the gain controls for the outputs are forced to power-down mode and the PLL is disabled - If one of the bypass switches are enabled, than the gain controls will be kept in their user configured state and the PLL stays enabled.
When the codec is in SND_SOC_BIAS_STANDBY (gains and PLL are disabled), change in the bypass config will trigger an event and if it is needed the gains and PLL will be enabled. Switching all bypass off will switch the gains and PLL off.
With the this implementation, there is no visible difference in power consumption compared to the previous, codec off way. So when the codec is in SND_SOC_BIAS_STANDBY mode and all of the bypasses are disabled, the additional power consumption is minimal, if any.
--- Peter Ujfalusi (1): ASoC: TWL4030: Add analog loopback support
sound/soc/codecs/twl4030.c | 212 +++++++++++++++++++++++++++++++++++++++++--- sound/soc/codecs/twl4030.h | 15 +++ 2 files changed, 214 insertions(+), 13 deletions(-)