From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753653AbcFFXQ6 (ORCPT ); Mon, 6 Jun 2016 19:16:58 -0400 Received: from mail.pqgruber.com ([178.189.19.235]:32045 "EHLO mail.pqgruber.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753557AbcFFXQV (ORCPT ); Mon, 6 Jun 2016 19:16:21 -0400 From: Clemens Gruber To: alsa-devel@alsa-project.org Cc: Mark Brown , Fabio Estevam , Eric Nelson , linux-kernel@vger.kernel.org, Clemens Gruber Subject: [PATCH 5/6] ASoC: sgtl5000: Do not disable regulators in SND_SOC_BIAS_OFF Date: Tue, 7 Jun 2016 01:14:52 +0200 Message-Id: <20160606231453.19377-6-clemens.gruber@pqgruber.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20160606231453.19377-1-clemens.gruber@pqgruber.com> References: <20160606231453.19377-1-clemens.gruber@pqgruber.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric Nelson 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 Signed-off-by: Clemens Gruber --- 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