All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] power: reset: gpio-poweroff: add ability to specific active and inactive delays
@ 2018-11-11 21:45 Heiko Stuebner
  2018-12-03 23:49   ` Rob Herring
  2018-12-05 21:45 ` Sebastian Reichel
  0 siblings, 2 replies; 5+ messages in thread
From: Heiko Stuebner @ 2018-11-11 21:45 UTC (permalink / raw)
  To: sre
  Cc: robh+dt, mark.rutland, linux-pm, devicetree, linux-kernel, mdf,
	heiko, Heiko Stuebner

From: Heiko Stuebner <heiko.stuebner@bq.com>

Similar to gpio-reset allow to specify active and inactive delays
while keeping the 100ms defaults that were used previously all the time.

The dt-properties are named the same as in gpio-reset but get an "-ms"
suffix as properties should contain such a suffix specifying its unit.

Signed-off-by: Heiko Stuebner <heiko.stuebner@bq.com>
---
 .../devicetree/bindings/power/reset/gpio-poweroff.txt  |  2 ++
 drivers/power/reset/gpio-poweroff.c                    | 10 ++++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/power/reset/gpio-poweroff.txt b/Documentation/devicetree/bindings/power/reset/gpio-poweroff.txt
index 6d8980c18c34..3e56c1b34a4c 100644
--- a/Documentation/devicetree/bindings/power/reset/gpio-poweroff.txt
+++ b/Documentation/devicetree/bindings/power/reset/gpio-poweroff.txt
@@ -27,6 +27,8 @@ Optional properties:
   it to an output when the power-off handler is called. If this optional
   property is not specified, the GPIO is initialized as an output in its
   inactive state.
+- active-delay-ms: Delay (default 100) to wait after driving gpio active
+- inactive-delay-ms: Delay (default 100) to wait after driving gpio inactive
 - timeout-ms: Time to wait before asserting a WARN_ON(1). If nothing is
               specified, 3000 ms is used.
 
diff --git a/drivers/power/reset/gpio-poweroff.c b/drivers/power/reset/gpio-poweroff.c
index 38206c39b3bf..52525b6c18db 100644
--- a/drivers/power/reset/gpio-poweroff.c
+++ b/drivers/power/reset/gpio-poweroff.c
@@ -26,6 +26,8 @@
  */
 static struct gpio_desc *reset_gpio;
 static u32 timeout = DEFAULT_TIMEOUT_MS;
+static u32 active_delay = 100;
+static u32 inactive_delay = 100;
 
 static void gpio_poweroff_do_poweroff(void)
 {
@@ -33,10 +35,11 @@ static void gpio_poweroff_do_poweroff(void)
 
 	/* drive it active, also inactive->active edge */
 	gpiod_direction_output(reset_gpio, 1);
-	mdelay(100);
+	mdelay(active_delay);
+
 	/* drive inactive, also active->inactive edge */
 	gpiod_set_value_cansleep(reset_gpio, 0);
-	mdelay(100);
+	mdelay(inactive_delay);
 
 	/* drive it active, also inactive->active edge */
 	gpiod_set_value_cansleep(reset_gpio, 1);
@@ -66,6 +69,9 @@ static int gpio_poweroff_probe(struct platform_device *pdev)
 	else
 		flags = GPIOD_OUT_LOW;
 
+	device_property_read_u32(&pdev->dev, "active-delay-ms", &active_delay);
+	device_property_read_u32(&pdev->dev, "inactive-delay-ms",
+				 &inactive_delay);
 	device_property_read_u32(&pdev->dev, "timeout-ms", &timeout);
 
 	reset_gpio = devm_gpiod_get(&pdev->dev, NULL, flags);
-- 
2.18.0


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

* Re: [PATCH] power: reset: gpio-poweroff: add ability to specific active and inactive delays
  2018-11-11 21:45 [PATCH] power: reset: gpio-poweroff: add ability to specific active and inactive delays Heiko Stuebner
@ 2018-12-03 23:49   ` Rob Herring
  2018-12-05 21:45 ` Sebastian Reichel
  1 sibling, 0 replies; 5+ messages in thread
From: Rob Herring @ 2018-12-03 23:49 UTC (permalink / raw)
  To: Heiko Stuebner
  Cc: sre, robh+dt, mark.rutland, linux-pm, devicetree, linux-kernel,
	mdf, heiko, Heiko Stuebner

On Sun, 11 Nov 2018 22:45:38 +0100, Heiko Stuebner wrote:
> From: Heiko Stuebner <heiko.stuebner@bq.com>
> 
> Similar to gpio-reset allow to specify active and inactive delays
> while keeping the 100ms defaults that were used previously all the time.
> 
> The dt-properties are named the same as in gpio-reset but get an "-ms"
> suffix as properties should contain such a suffix specifying its unit.
> 
> Signed-off-by: Heiko Stuebner <heiko.stuebner@bq.com>
> ---
>  .../devicetree/bindings/power/reset/gpio-poweroff.txt  |  2 ++
>  drivers/power/reset/gpio-poweroff.c                    | 10 ++++++++--
>  2 files changed, 10 insertions(+), 2 deletions(-)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH] power: reset: gpio-poweroff: add ability to specific active and inactive delays
@ 2018-12-03 23:49   ` Rob Herring
  0 siblings, 0 replies; 5+ messages in thread
From: Rob Herring @ 2018-12-03 23:49 UTC (permalink / raw)
  Cc: sre, robh+dt, mark.rutland, linux-pm, devicetree, linux-kernel,
	mdf, heiko, Heiko Stuebner

On Sun, 11 Nov 2018 22:45:38 +0100, Heiko Stuebner wrote:
> From: Heiko Stuebner <heiko.stuebner@bq.com>
> 
> Similar to gpio-reset allow to specify active and inactive delays
> while keeping the 100ms defaults that were used previously all the time.
> 
> The dt-properties are named the same as in gpio-reset but get an "-ms"
> suffix as properties should contain such a suffix specifying its unit.
> 
> Signed-off-by: Heiko Stuebner <heiko.stuebner@bq.com>
> ---
>  .../devicetree/bindings/power/reset/gpio-poweroff.txt  |  2 ++
>  drivers/power/reset/gpio-poweroff.c                    | 10 ++++++++--
>  2 files changed, 10 insertions(+), 2 deletions(-)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH] power: reset: gpio-poweroff: add ability to specific active and inactive delays
  2018-12-03 23:49   ` Rob Herring
  (?)
@ 2018-12-04  0:22   ` Moritz Fischer
  -1 siblings, 0 replies; 5+ messages in thread
From: Moritz Fischer @ 2018-12-04  0:22 UTC (permalink / raw)
  To: Rob Herring
  Cc: heiko, sre, Rob Herring, Mark Rutland, linux-pm, Devicetree List,
	Linux Kernel Mailing List, heiko.stuebner

On Mon, Dec 3, 2018 at 3:49 PM Rob Herring <robh@kernel.org> wrote:
>
> On Sun, 11 Nov 2018 22:45:38 +0100, Heiko Stuebner wrote:
> > From: Heiko Stuebner <heiko.stuebner@bq.com>
> >
> > Similar to gpio-reset allow to specify active and inactive delays
> > while keeping the 100ms defaults that were used previously all the time.
> >
> > The dt-properties are named the same as in gpio-reset but get an "-ms"
> > suffix as properties should contain such a suffix specifying its unit.
> >
> > Signed-off-by: Heiko Stuebner <heiko.stuebner@bq.com>
> > ---
> >  .../devicetree/bindings/power/reset/gpio-poweroff.txt  |  2 ++
> >  drivers/power/reset/gpio-poweroff.c                    | 10 ++++++++--
> >  2 files changed, 10 insertions(+), 2 deletions(-)
> >
>
> Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Moritz Fischer <mdf@kernel.org>

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

* Re: [PATCH] power: reset: gpio-poweroff: add ability to specific active and inactive delays
  2018-11-11 21:45 [PATCH] power: reset: gpio-poweroff: add ability to specific active and inactive delays Heiko Stuebner
  2018-12-03 23:49   ` Rob Herring
@ 2018-12-05 21:45 ` Sebastian Reichel
  1 sibling, 0 replies; 5+ messages in thread
From: Sebastian Reichel @ 2018-12-05 21:45 UTC (permalink / raw)
  To: Heiko Stuebner
  Cc: robh+dt, mark.rutland, linux-pm, devicetree, linux-kernel, mdf,
	Heiko Stuebner

[-- Attachment #1: Type: text/plain, Size: 2952 bytes --]

Hi,

On Sun, Nov 11, 2018 at 10:45:38PM +0100, Heiko Stuebner wrote:
> From: Heiko Stuebner <heiko.stuebner@bq.com>
> 
> Similar to gpio-reset allow to specify active and inactive delays
> while keeping the 100ms defaults that were used previously all the time.
> 
> The dt-properties are named the same as in gpio-reset but get an "-ms"
> suffix as properties should contain such a suffix specifying its unit.
> 
> Signed-off-by: Heiko Stuebner <heiko.stuebner@bq.com>
> ---

Thanks, queued.

-- Sebastian

>  .../devicetree/bindings/power/reset/gpio-poweroff.txt  |  2 ++
>  drivers/power/reset/gpio-poweroff.c                    | 10 ++++++++--
>  2 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/power/reset/gpio-poweroff.txt b/Documentation/devicetree/bindings/power/reset/gpio-poweroff.txt
> index 6d8980c18c34..3e56c1b34a4c 100644
> --- a/Documentation/devicetree/bindings/power/reset/gpio-poweroff.txt
> +++ b/Documentation/devicetree/bindings/power/reset/gpio-poweroff.txt
> @@ -27,6 +27,8 @@ Optional properties:
>    it to an output when the power-off handler is called. If this optional
>    property is not specified, the GPIO is initialized as an output in its
>    inactive state.
> +- active-delay-ms: Delay (default 100) to wait after driving gpio active
> +- inactive-delay-ms: Delay (default 100) to wait after driving gpio inactive
>  - timeout-ms: Time to wait before asserting a WARN_ON(1). If nothing is
>                specified, 3000 ms is used.
>  
> diff --git a/drivers/power/reset/gpio-poweroff.c b/drivers/power/reset/gpio-poweroff.c
> index 38206c39b3bf..52525b6c18db 100644
> --- a/drivers/power/reset/gpio-poweroff.c
> +++ b/drivers/power/reset/gpio-poweroff.c
> @@ -26,6 +26,8 @@
>   */
>  static struct gpio_desc *reset_gpio;
>  static u32 timeout = DEFAULT_TIMEOUT_MS;
> +static u32 active_delay = 100;
> +static u32 inactive_delay = 100;
>  
>  static void gpio_poweroff_do_poweroff(void)
>  {
> @@ -33,10 +35,11 @@ static void gpio_poweroff_do_poweroff(void)
>  
>  	/* drive it active, also inactive->active edge */
>  	gpiod_direction_output(reset_gpio, 1);
> -	mdelay(100);
> +	mdelay(active_delay);
> +
>  	/* drive inactive, also active->inactive edge */
>  	gpiod_set_value_cansleep(reset_gpio, 0);
> -	mdelay(100);
> +	mdelay(inactive_delay);
>  
>  	/* drive it active, also inactive->active edge */
>  	gpiod_set_value_cansleep(reset_gpio, 1);
> @@ -66,6 +69,9 @@ static int gpio_poweroff_probe(struct platform_device *pdev)
>  	else
>  		flags = GPIOD_OUT_LOW;
>  
> +	device_property_read_u32(&pdev->dev, "active-delay-ms", &active_delay);
> +	device_property_read_u32(&pdev->dev, "inactive-delay-ms",
> +				 &inactive_delay);
>  	device_property_read_u32(&pdev->dev, "timeout-ms", &timeout);
>  
>  	reset_gpio = devm_gpiod_get(&pdev->dev, NULL, flags);
> -- 
> 2.18.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2018-12-05 21:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-11 21:45 [PATCH] power: reset: gpio-poweroff: add ability to specific active and inactive delays Heiko Stuebner
2018-12-03 23:49 ` Rob Herring
2018-12-03 23:49   ` Rob Herring
2018-12-04  0:22   ` Moritz Fischer
2018-12-05 21:45 ` Sebastian Reichel

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.