From patchwork Thu Feb 26 22:54:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Nelson X-Patchwork-Id: 5896601 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C08A4BF440 for ; Thu, 26 Feb 2015 22:58:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E94EB2038A for ; Thu, 26 Feb 2015 22:58:04 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id BF8D6203AB for ; Thu, 26 Feb 2015 22:58:03 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id D3EF2265211; Thu, 26 Feb 2015 23:58:02 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 932A52650AF; Thu, 26 Feb 2015 23:55:34 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 9A767265086; Thu, 26 Feb 2015 23:55:32 +0100 (CET) Received: from mail-pd0-f170.google.com (mail-pd0-f170.google.com [209.85.192.170]) by alsa0.perex.cz (Postfix) with ESMTP id 1AD5D264EAA for ; Thu, 26 Feb 2015 23:54:54 +0100 (CET) Received: by pdjp10 with SMTP id p10so16379915pdj.3 for ; Thu, 26 Feb 2015 14:54:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/h71M1nWHysA4nCczdfvLZFVvpnZK6MmKqgjjVsaXYk=; b=DHLzccODJuCpUV06sILqUtirI9payFztmcSAbexeOSmVlielvLSXzm+aYXQMWtZeIt sjzUjMGUsO6NzYqyuXncsCzKKDbkHo2exvuTQHgNJoRcn5fK48O6o1ecWGEVIgM+DPva HiPFI5KCxjWtsGeZ3SvlQ/ucjx37BmyV71/E6eUeTwwiazWAx+yHyFA1bv+kKO91hpU4 CDQvxYqaskHj8XYXWkJXuH01e4SWDcBeSZtOqX+JnLogopHATQUPeRXLAOmG4Cvxq82H eoQ2clRimUSKWYN1oGNlU+O4VvTEiidtbVhnJJ0Bt9JcRyToj3Cg9yPZ2F+Nz6P8CE1N 29Gg== X-Gm-Message-State: ALoCoQnJ3bvLbeKvnP61bPX74YIa099LlwPqZosbjUJQ9R0PmGkXMhvHNsDpeNfrMtpuotucSkVo X-Received: by 10.68.65.33 with SMTP id u1mr18891793pbs.114.1424991293370; Thu, 26 Feb 2015 14:54:53 -0800 (PST) Received: from ericsam.boundarydevices.com (wsip-70-184-93-199.ph.ph.cox.net. [70.184.93.199]) by mx.google.com with ESMTPSA id i7sm1915431pbq.92.2015.02.26.14.54.51 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 26 Feb 2015 14:54:52 -0800 (PST) From: Eric Nelson To: alsa-devel@alsa-project.org Date: Thu, 26 Feb 2015 15:54:33 -0700 Message-Id: <1424991273-10081-7-git-send-email-eric.nelson@boundarydevices.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1424991273-10081-1-git-send-email-eric.nelson@boundarydevices.com> References: <1424991273-10081-1-git-send-email-eric.nelson@boundarydevices.com> Cc: fabio.estevam@freescale.com, lars@metafoo.de, tiwai@suse.de, Eric Nelson , lgirdwood@gmail.com, broonie@kernel.org, rmk+kernel@arm.linux.org.uk, jean-michel.hautbois@vodalys.com, troy.kisky@boundarydevices.com Subject: [alsa-devel] [RFC PATCH 6/6] ASoC: sgtl5000: Don't disable regulators in SND_SOC_BIAS_OFF X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Disabling the SGTL5000 through regulators would certainly save power than simply disabling the reference voltages as described in the data sheet, but won't properly restore things on resume. As patch 1 in the series shows, no user of this driver has support for active regulators yet, so this hasn't shown up. This patch is much more conservative and simply disables the reference bias currents. Signed-off-by: Eric Nelson --- sound/soc/codecs/sgtl5000.c | 32 +++++--------------------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index 5f7dd5d..d4d793f 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c @@ -767,36 +767,14 @@ static int sgtl5000_set_bias_level(struct snd_soc_codec *codec, switch (level) { case SND_SOC_BIAS_ON: case SND_SOC_BIAS_PREPARE: - break; case SND_SOC_BIAS_STANDBY: - if (codec->dapm.bias_level == 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; }