All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] regulator: fixed: Add support to handle enable-active-high DT property
@ 2016-12-07 11:25 Vignesh R
  2016-12-08 22:21 ` Simon Glass
  2016-12-27 22:55 ` [U-Boot] " Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Vignesh R @ 2016-12-07 11:25 UTC (permalink / raw)
  To: u-boot

Add support to handle enable-active-high DT property. This property is
used to drive the gpio controlling fixed regulator as active high when
claiming gpio line.

Signed-off-by: Vignesh R <vigneshr@ti.com>
---
 doc/device-tree-bindings/regulator/fixed.txt | 4 ++++
 drivers/power/regulator/fixed.c              | 7 ++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/doc/device-tree-bindings/regulator/fixed.txt b/doc/device-tree-bindings/regulator/fixed.txt
index 8a0d002688d8..5fd9033fea2d 100644
--- a/doc/device-tree-bindings/regulator/fixed.txt
+++ b/doc/device-tree-bindings/regulator/fixed.txt
@@ -12,6 +12,9 @@ Optional properties:
 - gpio: GPIO to use for enable control
 - startup-delay-us: startup time in microseconds
 - regulator constraints (binding info: regulator.txt)
+- enable-active-high: Polarity of GPIO is Active high. If this property
+  is missing, the default assumed is Active low.
+
 
 Other kernel-style properties, are currently not used.
 
@@ -36,4 +39,5 @@ fixed_regulator at 0 {
 	regulator-max-microamp = <15000>;
 	regulator-always-on;
 	regulator-boot-on;
+	enable-active-high;
 };
diff --git a/drivers/power/regulator/fixed.c b/drivers/power/regulator/fixed.c
index 62dc47f76985..3d2d9081c1b1 100644
--- a/drivers/power/regulator/fixed.c
+++ b/drivers/power/regulator/fixed.c
@@ -27,6 +27,8 @@ static int fixed_regulator_ofdata_to_platdata(struct udevice *dev)
 	struct dm_regulator_uclass_platdata *uc_pdata;
 	struct fixed_regulator_platdata *dev_pdata;
 	struct gpio_desc *gpio;
+	const void *blob = gd->fdt_blob;
+	int node = dev->of_offset, flags = GPIOD_IS_OUT;
 	int ret;
 
 	dev_pdata = dev_get_platdata(dev);
@@ -37,9 +39,12 @@ static int fixed_regulator_ofdata_to_platdata(struct udevice *dev)
 	/* Set type to fixed */
 	uc_pdata->type = REGULATOR_TYPE_FIXED;
 
+	if (fdtdec_get_bool(blob, node, "enable-active-high"))
+		flags |= GPIOD_IS_OUT_ACTIVE;
+
 	/* Get fixed regulator optional enable GPIO desc */
 	gpio = &dev_pdata->gpio;
-	ret = gpio_request_by_name(dev, "gpio", 0, gpio, GPIOD_IS_OUT);
+	ret = gpio_request_by_name(dev, "gpio", 0, gpio, flags);
 	if (ret) {
 		debug("Fixed regulator optional enable GPIO - not found! Error: %d\n",
 		      ret);
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] regulator: fixed: Add support to handle enable-active-high DT property
  2016-12-07 11:25 [U-Boot] [PATCH] regulator: fixed: Add support to handle enable-active-high DT property Vignesh R
@ 2016-12-08 22:21 ` Simon Glass
  2016-12-27 22:55 ` [U-Boot] " Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Glass @ 2016-12-08 22:21 UTC (permalink / raw)
  To: u-boot

On 7 December 2016 at 06:25, Vignesh R <vigneshr@ti.com> wrote:
> Add support to handle enable-active-high DT property. This property is
> used to drive the gpio controlling fixed regulator as active high when
> claiming gpio line.
>
> Signed-off-by: Vignesh R <vigneshr@ti.com>
> ---
>  doc/device-tree-bindings/regulator/fixed.txt | 4 ++++
>  drivers/power/regulator/fixed.c              | 7 ++++++-
>  2 files changed, 10 insertions(+), 1 deletion(-)

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] regulator: fixed: Add support to handle enable-active-high DT property
  2016-12-07 11:25 [U-Boot] [PATCH] regulator: fixed: Add support to handle enable-active-high DT property Vignesh R
  2016-12-08 22:21 ` Simon Glass
@ 2016-12-27 22:55 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2016-12-27 22:55 UTC (permalink / raw)
  To: u-boot

On Wed, Dec 07, 2016 at 04:55:06PM +0530, Vignesh R wrote:

> Add support to handle enable-active-high DT property. This property is
> used to drive the gpio controlling fixed regulator as active high when
> claiming gpio line.
> 
> Signed-off-by: Vignesh R <vigneshr@ti.com>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161227/da3583aa/attachment.sig>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-12-27 22:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-07 11:25 [U-Boot] [PATCH] regulator: fixed: Add support to handle enable-active-high DT property Vignesh R
2016-12-08 22:21 ` Simon Glass
2016-12-27 22:55 ` [U-Boot] " Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.