From patchwork Sun Mar 15 00:25:35 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Brownell X-Patchwork-Id: 12162 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n2F0PQC0018598 for ; Sun, 15 Mar 2009 00:25:41 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752029AbZCOAZl (ORCPT ); Sat, 14 Mar 2009 20:25:41 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752909AbZCOAZl (ORCPT ); Sat, 14 Mar 2009 20:25:41 -0400 Received: from n27.bullet.mail.mud.yahoo.com ([68.142.206.222]:44312 "HELO n27.bullet.mail.mud.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751723AbZCOAZk (ORCPT ); Sat, 14 Mar 2009 20:25:40 -0400 Received: from [68.142.194.244] by n27.bullet.mail.mud.yahoo.com with NNFMP; 15 Mar 2009 00:25:38 -0000 Received: from [68.142.201.64] by t2.bullet.mud.yahoo.com with NNFMP; 15 Mar 2009 00:25:38 -0000 Received: from [127.0.0.1] by omp416.mail.mud.yahoo.com with NNFMP; 15 Mar 2009 00:25:38 -0000 X-Yahoo-Newman-Id: 860938.97372.bm@omp416.mail.mud.yahoo.com Received: (qmail 46167 invoked from network); 15 Mar 2009 00:25:38 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=pacbell.net; h=Received:X-YMail-OSG:X-Yahoo-Newman-Property:From:To:Subject:Date:User-Agent:Cc:References:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-Disposition:Message-Id; b=EsWRh+hYcC63ezwuklecMRnJrmzYfsxeQY72I5FpdNqQallE1htBcAbnGutWVsviFbOJTkUTvk5FVoutANeNJIW6eYx0hRu6J+b/aehKkN6vq+6fj6qZdq/qFNm1TBnnRXfs0cmNlL/dVxUkMmisJXqTBW6ORpuu04U0lKRLmT8= ; Received: from unknown (HELO pogo) (david-b@69.226.224.20 with plain) by smtp102.sbc.mail.sp1.yahoo.com with SMTP; 15 Mar 2009 00:25:38 -0000 X-YMail-OSG: DS7lbJEVM1nRNY5EjNOu2OI_RLUvBjU2FaHOVLII5AzVhE6zBcGIsBp5nE8pkYGJYJy419OucJFhTa9n5HwdUANDZg3QTVXpUP_DiNEb4M0V0.lVZfOxLxyn5xIsadRIwhn2P2qyM77hUmuoHo54TmsLWCnlnHfESkZnDIKH.zVQ2F1knByOsH5fydwIMzHqrSUnhnHyCBjdvR_hJPgEqGAg9Is2SHX42La0Gg-- X-Yahoo-Newman-Property: ymail-3 From: David Brownell To: Mark Brown , Liam Girdwood Subject: [patch 2.6.29-rc8 regulator-next] regulator: init fixes (v4) Date: Sat, 14 Mar 2009 17:25:35 -0700 User-Agent: KMail/1.9.10 Cc: lkml , OMAP References: <200903111743.34708.david-b@pacbell.net> <200903111932.16317.david-b@pacbell.net> <20090312120119.GB24376@sirena.org.uk> In-Reply-To: <20090312120119.GB24376@sirena.org.uk> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200903141725.35541.david-b@pacbell.net> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: David Brownell Make the regulator setup code cope more consistently with regulators left enabled by the bootloader ... making it act as if the "boot_on" flag were being set by the boot loader (as needed) instead of by Linux board init code (always). This eliminates the other half of the bug whereby regulators that were enabled during the boot sequence would be enabled with enable count of zero ... preventing regulator_disable() from working when called from drivers. (The first half was fixed by the "regulator: refcount fixes" patch, and related specifically to the "boot_on" flag.) One open issue involves systems that need to force a regulator off at boot time -- the converse of today's "boot_on" flag. There can be arbitrarily long delays between system startup and when a driver can be loaded to turn off the regulator, during which power is being wasted. Signed-off-by: David Brownell --- drivers/regulator/core.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -815,6 +815,14 @@ static int set_machine_constraints(struc goto out; } rdev->use_count = 1; + } else if (ops->is_enabled) { + /* ... if the bootloader left it on, drivers need a + * nonzero enable count else it can't be disabled. + */ + ret = ops->is_enabled(rdev); + if (ret > 0) + rdev->use_count = 1; + ret = 0; } print_constraints(rdev);