From patchwork Sun Dec 4 13:21:23 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: thomas.abraham@linaro.org X-Patchwork-Id: 5445 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 5915A23E19 for ; Sun, 4 Dec 2011 13:21:28 +0000 (UTC) Received: from mail-lpp01m010-f52.google.com (mail-lpp01m010-f52.google.com [209.85.215.52]) by fiordland.canonical.com (Postfix) with ESMTP id 14088A1807C for ; Sun, 4 Dec 2011 13:21:28 +0000 (UTC) Received: by laah2 with SMTP id h2so2500394laa.11 for ; Sun, 04 Dec 2011 05:21:27 -0800 (PST) Received: by 10.152.134.179 with SMTP id pl19mr3563055lab.13.1323004887689; Sun, 04 Dec 2011 05:21:27 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.41.198 with SMTP id h6cs220744lal; Sun, 4 Dec 2011 05:21:26 -0800 (PST) Received: by 10.216.145.214 with SMTP id p64mr1432991wej.73.1323004884287; Sun, 04 Dec 2011 05:21:24 -0800 (PST) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx.google.com with ESMTPS id fo11si8837388wbb.98.2011.12.04.05.21.23 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 04 Dec 2011 05:21:24 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.50 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) client-ip=74.125.82.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.50 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) smtp.mail=thomas.abraham@linaro.org Received: by wgbdr11 with SMTP id dr11so5470098wgb.31 for ; Sun, 04 Dec 2011 05:21:23 -0800 (PST) MIME-Version: 1.0 Received: by 10.216.136.165 with SMTP id w37mr1390000wei.63.1323004883773; Sun, 04 Dec 2011 05:21:23 -0800 (PST) Received: by 10.223.60.211 with HTTP; Sun, 4 Dec 2011 05:21:23 -0800 (PST) In-Reply-To: <1321615040-13257-2-git-send-email-rnayak@ti.com> References: <1321615040-13257-1-git-send-email-rnayak@ti.com> <1321615040-13257-2-git-send-email-rnayak@ti.com> Date: Sun, 4 Dec 2011 18:51:23 +0530 Message-ID: Subject: Re: [PATCH v5 1/4] regulator: helper routine to extract regulator_init_data From: Thomas Abraham To: Rajendra Nayak Cc: broonie@opensource.wolfsonmicro.com, grant.likely@secretlab.ca, robherring2@gmail.com, linaro-dev@lists.linaro.org, patches@linaro.org, tony@atomide.com, devicetree-discuss@lists.ozlabs.org, linux-kernel@vger.kernel.org, olof@lixom.net, linux-omap@vger.kernel.org, lrg@ti.com, linux-arm-kernel@lists.infradead.org On 18 November 2011 16:47, Rajendra Nayak wrote: > The helper routine is meant to be used by the regulator drivers > to extract the regulator_init_data structure from the data > that is passed from device tree. > 'consumer_supplies' which is part of regulator_init_data is not extracted > as the regulator consumer mappings are passed through DT differently, > implemented in subsequent patches. > Similarly the regulator<-->parent/supply mapping is handled in > subsequent patches. > > Also add documentation for regulator bindings to be used to pass > regulator_init_data struct information from device tree. > > Some of the regulator properties which are linux and board specific, > are left out since its not clear if they can > be in someway embedded into the kernel or passed in from DT. > They will be revisited later. > > Signed-off-by: Rajendra Nayak > --- >  .../devicetree/bindings/regulator/regulator.txt    |   54 +++++++++++++ >  drivers/regulator/Makefile                         |    1 + >  drivers/regulator/of_regulator.c                   |   81 ++++++++++++++++++++ >  include/linux/regulator/of_regulator.h             |   20 +++++ >  4 files changed, 156 insertions(+), 0 deletions(-) >  create mode 100644 Documentation/devicetree/bindings/regulator/regulator.txt >  create mode 100644 drivers/regulator/of_regulator.c >  create mode 100644 include/linux/regulator/of_regulator.h > > diff --git a/Documentation/devicetree/bindings/regulator/regulator.txt b/Documentation/devicetree/bindings/regulator/regulator.txt > new file mode 100644 > index 0000000..82bef20 > --- /dev/null > +++ b/Documentation/devicetree/bindings/regulator/regulator.txt > @@ -0,0 +1,54 @@ > +Voltage/Current Regulators > + > +Optional properties: > +- regulator-name: A string used as a descriptive name for regulator outputs > +- regulator-min-microvolt: smallest voltage consumers may set > +- regulator-max-microvolt: largest voltage consumers may set > +- regulator-microvolt-offset: Offset applied to voltages to compensate for voltage drops > +- regulator-min-microamp: smallest current consumers may set > +- regulator-max-microamp: largest current consumers may set > +- regulator-always-on: boolean, regulator should never be disabled > +- regulator-boot-on: bootloader/firmware enabled regulator > +- -supply: phandle to the parent supply/regulator node For regulators that are not turned on by bootloader, and which require 'apply_uV' constraint, is there any alternative for turning on the regulator when using dt? Or, how about adding a additional check as below. rdev->constraints->max_uV); Thanks, Thomas. diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 5baa196..25a6781 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -816,8 +816,9 @@ static int machine_constraints_voltage(struct regulator_dev *rdev, int ret; /* do we need to apply the constraint voltage */ - if (rdev->constraints->apply_uV && - rdev->constraints->min_uV == rdev->constraints->max_uV) { + if ((rdev->constraints->apply_uV && + rdev->constraints->min_uV == rdev->constraints->max_uV) || + (!rdev->constraints->boot_on && rdev->constraints->always_on)) { ret = _regulator_do_set_voltage(rdev, rdev->constraints->min_uV,