linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Clemens Gruber <clemens.gruber@pqgruber.com>
To: alsa-devel@alsa-project.org
Cc: Mark Brown <broonie@kernel.org>,
	Fabio Estevam <festevam@gmail.com>, Eric Nelson <eric@nelint.com>,
	linux-kernel@vger.kernel.org,
	Clemens Gruber <clemens.gruber@pqgruber.com>
Subject: [PATCH 5/6] ASoC: sgtl5000: Do not disable regulators in SND_SOC_BIAS_OFF
Date: Tue,  7 Jun 2016 01:14:52 +0200	[thread overview]
Message-ID: <20160606231453.19377-6-clemens.gruber@pqgruber.com> (raw)
In-Reply-To: <20160606231453.19377-1-clemens.gruber@pqgruber.com>

From: Eric Nelson <eric@nelint.com>

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 <eric@nelint.com>
Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
---
 sound/soc/codecs/sgtl5000.c | 35 +++++------------------------------
 1 file changed, 5 insertions(+), 30 deletions(-)

diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index 9f1d51e..b8a2de85 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -761,42 +761,17 @@ static int sgtl5000_pcm_hw_params(struct snd_pcm_substream *substream,
 static int sgtl5000_set_bias_level(struct snd_soc_codec *codec,
 				   enum snd_soc_bias_level level)
 {
-	int ret;
-	struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec);
-
 	switch (level) {
 	case SND_SOC_BIAS_ON:
 	case SND_SOC_BIAS_PREPARE:
-		break;
 	case SND_SOC_BIAS_STANDBY:
-		if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) {
-			ret = regulator_bulk_enable(
-						sgtl5000->num_supplies,
-						sgtl5000->supplies);
-			if (ret)
-				return ret;
-			udelay(10);
-
-			regcache_cache_only(sgtl5000->regmap, false);
-
-			ret = regcache_sync(sgtl5000->regmap);
-			if (ret != 0) {
-				dev_err(codec->dev,
-					"Failed to restore cache: %d\n", ret);
-
-				regcache_cache_only(sgtl5000->regmap, true);
-				regulator_bulk_disable(sgtl5000->num_supplies,
-						       sgtl5000->supplies);
-
-				return ret;
-			}
-		}
-
+		snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER,
+				    SGTL5000_REFTOP_POWERUP,
+				    SGTL5000_REFTOP_POWERUP);
 		break;
 	case SND_SOC_BIAS_OFF:
-		regcache_cache_only(sgtl5000->regmap, true);
-		regulator_bulk_disable(sgtl5000->num_supplies,
-				       sgtl5000->supplies);
+		snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER,
+				    SGTL5000_REFTOP_POWERUP, 0);
 		break;
 	}
 
-- 
2.8.3

  parent reply	other threads:[~2016-06-06 23:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-06 23:14 [PATCH 0/6] ASoC: sgtl5000: fix use of regulators and internal LDO Clemens Gruber
2016-06-06 23:14 ` [PATCH 1/6] ASoC: sgtl5000: Fix regulator support Clemens Gruber
2016-06-15  2:12   ` Fabio Estevam
2016-06-15 14:38   ` Applied "ASoC: sgtl5000: Fix regulator support" to the asoc tree Mark Brown
2016-06-06 23:14 ` [PATCH 2/6] ASoC: sgtl5000: Write all default registers Clemens Gruber
2016-06-15  2:12   ` Fabio Estevam
2016-06-06 23:14 ` [PATCH 3/6] ASoC: sgtl5000: Initialize CHIP_ANA_POWER to power-on defaults Clemens Gruber
2016-06-15  2:13   ` Fabio Estevam
2016-06-15 14:38   ` Applied "ASoC: sgtl5000: Initialize CHIP_ANA_POWER to power-on defaults" to the asoc tree Mark Brown
2016-06-06 23:14 ` [PATCH 4/6] ASoC: sgtl5000: Disable internal PLL early Clemens Gruber
2016-06-15  2:13   ` Fabio Estevam
2016-06-06 23:14 ` Clemens Gruber [this message]
2016-06-15  2:13   ` [PATCH 5/6] ASoC: sgtl5000: Do not disable regulators in SND_SOC_BIAS_OFF Fabio Estevam
2016-06-15 14:38   ` Applied "ASoC: sgtl5000: Do not disable regulators in SND_SOC_BIAS_OFF" to the asoc tree Mark Brown
2016-06-06 23:14 ` [PATCH 6/6] ASoC: sgtl5000: Remove misleading comment Clemens Gruber
2016-06-15  2:14   ` Fabio Estevam
2016-06-15 14:38   ` Applied "ASoC: sgtl5000: Remove misleading comment" to the asoc tree Mark Brown
2016-06-07 10:49 ` [PATCH 0/6] ASoC: sgtl5000: fix use of regulators and internal LDO Eric Nelson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160606231453.19377-6-clemens.gruber@pqgruber.com \
    --to=clemens.gruber@pqgruber.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=eric@nelint.com \
    --cc=festevam@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).