mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] regulator: fixed: add always-on property
@ 2014-06-30  7:51 Steffen Trumtrar
  2014-07-11  7:56 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Steffen Trumtrar @ 2014-06-30  7:51 UTC (permalink / raw)
  To: barebox; +Cc: Steffen Trumtrar

Support the "regulator-always-on" property for fixed regulators.
The regulator gets enabled on probe and subsequent disable calls are
ignored.

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 drivers/regulator/fixed.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index 7e64919..2515d3e 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -27,6 +27,7 @@
 struct regulator_fixed {
 	int gpio;
 	int active_low;
+	int always_on;
 	struct regulator_dev rdev;
 };
 
@@ -44,6 +45,9 @@ static int regulator_fixed_disable(struct regulator_dev *rdev)
 {
 	struct regulator_fixed *fix = container_of(rdev, struct regulator_fixed, rdev);
 
+	if (fix->always_on)
+		return 0;
+
 	if (!gpio_is_valid(fix->gpio))
 		return 0;
 
@@ -79,6 +83,11 @@ static int regulator_fixed_probe(struct device_d *dev)
 
 	fix->rdev.ops = &fixed_ops;
 
+	if (of_find_property(dev->device_node, "regulator-always-on", NULL)) {
+		fix->always_on = 1;
+		regulator_fixed_enable(&fix->rdev);
+	}
+
 	ret = of_regulator_register(&fix->rdev, dev->device_node);
 	if (ret)
 		return ret;
-- 
2.0.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] regulator: fixed: add always-on property
  2014-06-30  7:51 [PATCH] regulator: fixed: add always-on property Steffen Trumtrar
@ 2014-07-11  7:56 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2014-07-11  7:56 UTC (permalink / raw)
  To: Steffen Trumtrar; +Cc: barebox

On Mon, Jun 30, 2014 at 09:51:56AM +0200, Steffen Trumtrar wrote:
> Support the "regulator-always-on" property for fixed regulators.
> The regulator gets enabled on probe and subsequent disable calls are
> ignored.
> 
> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>

Applied, thanks

Sascha

> ---
>  drivers/regulator/fixed.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
> index 7e64919..2515d3e 100644
> --- a/drivers/regulator/fixed.c
> +++ b/drivers/regulator/fixed.c
> @@ -27,6 +27,7 @@
>  struct regulator_fixed {
>  	int gpio;
>  	int active_low;
> +	int always_on;
>  	struct regulator_dev rdev;
>  };
>  
> @@ -44,6 +45,9 @@ static int regulator_fixed_disable(struct regulator_dev *rdev)
>  {
>  	struct regulator_fixed *fix = container_of(rdev, struct regulator_fixed, rdev);
>  
> +	if (fix->always_on)
> +		return 0;
> +
>  	if (!gpio_is_valid(fix->gpio))
>  		return 0;
>  
> @@ -79,6 +83,11 @@ static int regulator_fixed_probe(struct device_d *dev)
>  
>  	fix->rdev.ops = &fixed_ops;
>  
> +	if (of_find_property(dev->device_node, "regulator-always-on", NULL)) {
> +		fix->always_on = 1;
> +		regulator_fixed_enable(&fix->rdev);
> +	}
> +
>  	ret = of_regulator_register(&fix->rdev, dev->device_node);
>  	if (ret)
>  		return ret;
> -- 
> 2.0.0
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2014-07-11  7:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-30  7:51 [PATCH] regulator: fixed: add always-on property Steffen Trumtrar
2014-07-11  7:56 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox