public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: Laxman Dewangan <ldewangan@nvidia.com>
Cc: broonie@kernel.org, sameo@linux.intel.com,
	rob.herring@calxeda.com, pawel.moll@arm.com,
	mark.rutland@arm.com, rob@landley.net, lee.jones@linaro.org,
	grant.likely@linaro.org, devicetree@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	gg@slimlogic.co.uk, kishon@ti.com, j-keerthy@ti.com,
	ian.campbell@citrix.com
Subject: Re: [PATCH V3] regulator: palmas: add support for external control of rails
Date: Tue, 20 Aug 2013 10:48:09 -0600	[thread overview]
Message-ID: <52139DC9.4040803@wwwdotorg.org> (raw)
In-Reply-To: <1377004456-26318-1-git-send-email-ldewangan@nvidia.com>

On 08/20/2013 07:14 AM, Laxman Dewangan wrote:
> Palmas rails like LDOs, SMPSs, REGENs, SYSENs can be enable and disable
> by register programming through I2C communication as well as it can be
> enable/disable with the external control input ENABLE1, ENABLE2 and NSLEEP.
> 
> Add support for configuring these rails to be controlled by external control
> inputs. This is require to configure the rail's control register as well as
> configuration of resource register.
> 
> Provide the external input names through parameter "roof-floor". Updated the
> DT binding document to details different value of the roof-floor.

> diff --git a/Documentation/devicetree/bindings/regulator/palmas-pmic.txt b/Documentation/devicetree/bindings/regulator/palmas-pmic.txt

The binding changes look reasonable and backwards-compatible, so they're
good. Just one nit:

(In the example, I assume:)
>  			regulator-always-on;
>  			regulator-boot-on;
>  			ti,warm-reset;
> -			ti,roof-floor;
> +			ti,roof-floor = 0x1; /* ENABLE1 control */

You need <> around the value, so better:

			ti,roof-floor = <0x1>; /* ENABLE1 control */

or better:

			ti,roof-floor = <1>; /* ENABLE1 control */

(even better might be a header file that defines names for those
constants...)

> diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c

> @@ -746,9 +854,24 @@ static void palmas_dt_to_pdata(struct device *dev,
>  			of_property_read_bool(palmas_matches[idx].of_node,
>  					     "ti,warm-reset");
>  
> -		pdata->reg_init[idx]->roof_floor =
> -			of_property_read_bool(palmas_matches[idx].of_node,
> -					      "ti,roof-floor");
> +		ret = of_property_read_u32(palmas_matches[idx].of_node,
> +					      "ti,roof-floor", &prop);
> +		/* EINVAL: Property not found */
> +		if (ret != -EINVAL) {
> +			int econtrol;
> +
> +			/* use default value, when no value is specified */
> +			econtrol = PALMAS_EXT_CONTROL_NSLEEP;
> +			if (!ret) {
> +				if (prop == 1)
> +					econtrol = PALMAS_EXT_CONTROL_ENABLE1;
> +				else if (prop == 2)
> +					econtrol = PALMAS_EXT_CONTROL_ENABLE2;
> +				else if (prop == 3)
> +					econtrol = PALMAS_EXT_CONTROL_NSLEEP;

Should probably at least WARN() here if the value is invalid?

> +			}
> +			pdata->reg_init[idx]->roof_floor = econtrol;
> +		}


  reply	other threads:[~2013-08-20 16:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-20 13:14 [PATCH V3] regulator: palmas: add support for external control of rails Laxman Dewangan
2013-08-20 16:48 ` Stephen Warren [this message]
2013-08-20 19:13 ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52139DC9.4040803@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gg@slimlogic.co.uk \
    --cc=grant.likely@linaro.org \
    --cc=ian.campbell@citrix.com \
    --cc=j-keerthy@ti.com \
    --cc=kishon@ti.com \
    --cc=ldewangan@nvidia.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=rob.herring@calxeda.com \
    --cc=rob@landley.net \
    --cc=sameo@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox