From patchwork Fri Mar 6 22:53:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King - ARM Linux X-Patchwork-Id: 5957971 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 450B49F373 for ; Fri, 6 Mar 2015 22:54:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4DD04202F0 for ; Fri, 6 Mar 2015 22:54:03 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id EBF14202EC for ; Fri, 6 Mar 2015 22:54:01 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 929A32661B5; Fri, 6 Mar 2015 23:54:00 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 234A4266142; Fri, 6 Mar 2015 23:53:57 +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 A69B326617B; Fri, 6 Mar 2015 23:53:55 +0100 (CET) Received: from pandora.arm.linux.org.uk (pandora.arm.linux.org.uk [78.32.30.218]) by alsa0.perex.cz (Postfix) with ESMTP id 0DCCB26609F for ; Fri, 6 Mar 2015 23:53:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=pandora-2014; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=I+S52SvGCXiS62qNBp5wndHBkIbQDexG5hn3VQjWAYA=; b=qDZ9GsAIn9IR2OdkU2wCQxlCpwIpr1mHaKlGu2c3jDX60c9VNqfMhr9yniObiWfipJyC6ZDeIvkaxaWV2hhxL8miSBamTMjtZwAweH6/fsOsyByD8lvm+Rh+TmboELFlqCNxgCqup2upZ/EknU69LSJxvcojyG5POdZ73HiL3sE=; Received: from n2100.arm.linux.org.uk ([2002:4e20:1eda:1:214:fdff:fe10:4f86]:57361) by pandora.arm.linux.org.uk with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1YU17m-00006Z-CL; Fri, 06 Mar 2015 22:53:42 +0000 Received: from linux by n2100.arm.linux.org.uk with local (Exim 4.76) (envelope-from ) id 1YU17i-0001v0-6Z; Fri, 06 Mar 2015 22:53:38 +0000 Date: Fri, 6 Mar 2015 22:53:37 +0000 From: Russell King - ARM Linux To: Eric Nelson Message-ID: <20150306225337.GH8656@n2100.arm.linux.org.uk> References: <1424991273-10081-1-git-send-email-eric.nelson@boundarydevices.com> <54FA2F03.2060804@boundarydevices.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <54FA2F03.2060804@boundarydevices.com> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: fabio.estevam@freescale.com, alsa-devel@alsa-project.org, lars@metafoo.de, tiwai@suse.de, lgirdwood@gmail.com, broonie@kernel.org, jean-michel.hautbois@vodalys.com, troy.kisky@boundarydevices.com Subject: Re: [alsa-devel] [PATCH RFC 0/6] ASoC: sgtl5000: fix use of regulators and internal LDO 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Mar 06, 2015 at 03:49:39PM -0700, Eric Nelson wrote: > Based on your review, it seems like the following is needed for a > V2 patch (set): > > - Move call to sgtl5000_fill_defaults() earlier in the > sgtl5000_i2c_probe routine, before adjusting ANA_POWER. > This will allow registers LINEREG_CTRL, CLK_CTRL, and even ANA_POWER > back into the default register list. > - Move regulators from codec to I2C device > - switch to devm_regulator api > - various code cleanups to simplify logic > - Adjust regulator usage in SND_SOC_BIAS_OFF > > I'll leave out the "write all default" registers for the moment. I'll also interject here to say that, against mainline, I need this patch to make the sgtl5k work on SolidRun's Hummingboard hardware. Without this, the internal regulator seems to get powered down, and we lose access to the device until the entire board is power cycled. sound/soc/codecs/sgtl5000.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index e182e6569bbd..79d5cbd65f36 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c @@ -825,6 +825,10 @@ static int ldo_regulator_disable(struct regulator_dev *dev) struct snd_soc_codec *codec = (struct snd_soc_codec *)ldo->codec_data; snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER, + SGTL5000_LINREG_SIMPLE_POWERUP, + SGTL5000_LINREG_SIMPLE_POWERUP); + + snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER, SGTL5000_LINEREG_D_POWERUP, 0); @@ -1155,8 +1159,11 @@ static int sgtl5000_set_power_regs(struct snd_soc_codec *codec) * if vddio and vddd > 3.1v, * charge pump should be clean before set ana_pwr */ - snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER, - SGTL5000_VDDC_CHRGPMP_POWERUP, 0); +// FIXME: this is total crap - we have read this register above into +// ana_pwr, which we then modify (above), and then write back to the +// register below. This modification just gets completely overwritten. +// snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER, +// SGTL5000_VDDC_CHRGPMP_POWERUP, 0); /* VDDC use VDDIO rail */ lreg_ctrl |= SGTL5000_VDDC_ASSN_OVRD;