Skip to content

Commit 8419caa

Browse files
ericnelsonazbroonie
authored andcommitted
ASoC: sgtl5000: Do not disable regulators in SND_SOC_BIAS_OFF
Disabling the SGTL5000 through regulators would certainly save more power than simply disabling the reference voltages as described in the data sheet, but won't properly restore things on resume. This driver does not support active regulators. So we simply disable the reference bias currents. Signed-off-by: Eric Nelson <[email protected]> Signed-off-by: Clemens Gruber <[email protected]> Reviewed-by: Fabio Estevam <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent 08dea16 commit 8419caa

File tree

1 file changed

+5
-30
lines changed

1 file changed

+5
-30
lines changed

sound/soc/codecs/sgtl5000.c

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -761,42 +761,17 @@ static int sgtl5000_pcm_hw_params(struct snd_pcm_substream *substream,
761761
static int sgtl5000_set_bias_level(struct snd_soc_codec *codec,
762762
enum snd_soc_bias_level level)
763763
{
764-
int ret;
765-
struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec);
766-
767764
switch (level) {
768765
case SND_SOC_BIAS_ON:
769766
case SND_SOC_BIAS_PREPARE:
770-
break;
771767
case SND_SOC_BIAS_STANDBY:
772-
if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) {
773-
ret = regulator_bulk_enable(
774-
sgtl5000->num_supplies,
775-
sgtl5000->supplies);
776-
if (ret)
777-
return ret;
778-
udelay(10);
779-
780-
regcache_cache_only(sgtl5000->regmap, false);
781-
782-
ret = regcache_sync(sgtl5000->regmap);
783-
if (ret != 0) {
784-
dev_err(codec->dev,
785-
"Failed to restore cache: %d\n", ret);
786-
787-
regcache_cache_only(sgtl5000->regmap, true);
788-
regulator_bulk_disable(sgtl5000->num_supplies,
789-
sgtl5000->supplies);
790-
791-
return ret;
792-
}
793-
}
794-
768+
snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER,
769+
SGTL5000_REFTOP_POWERUP,
770+
SGTL5000_REFTOP_POWERUP);
795771
break;
796772
case SND_SOC_BIAS_OFF:
797-
regcache_cache_only(sgtl5000->regmap, true);
798-
regulator_bulk_disable(sgtl5000->num_supplies,
799-
sgtl5000->supplies);
773+
snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER,
774+
SGTL5000_REFTOP_POWERUP, 0);
800775
break;
801776
}
802777

0 commit comments

Comments
 (0)