Linux Power Management development
 help / color / mirror / Atom feed
* Re: [PATCH v3 1/2] dt-bindings: power: reset: gpio-poweroff: Add 'timeout-ms' property
       [not found] <20180222231714.11843-1-mdf@kernel.org>
@ 2018-03-01 23:26 ` Rob Herring
       [not found] ` <20180222231714.11843-2-mdf@kernel.org>
  1 sibling, 0 replies; 2+ messages in thread
From: Rob Herring @ 2018-03-01 23:26 UTC (permalink / raw)
  To: Moritz Fischer; +Cc: linux-kernel, devicetree, linux-pm, sre, andy.shevchenko

On Thu, Feb 22, 2018 at 03:17:13PM -0800, Moritz Fischer wrote:
> Add 'timeout-ms' property to support boards where the 3s timeout that the
> current driver defaults to is too short.
> 
> Signed-off-by: Moritz Fischer <mdf@kernel.org>
> ---
> 
> Changes from v2:
> - Addressed Rob's feedback (timeout_ms -> timeout-ms)
> 
> Changes from v1:
> - Addressed Rob's feedback (timeout -> timeout_ms)
> - Added to old example rather than creating separate one
> 
> ---
> 
>  Documentation/devicetree/bindings/power/reset/gpio-poweroff.txt | 3 +++
>  1 file changed, 3 insertions(+)

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

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

* Re: [PATCH v3 2/2] power: reset: gpio-poweroff: Support for timeout from device property
       [not found] ` <20180222231714.11843-2-mdf@kernel.org>
@ 2018-03-09 16:19   ` Sebastian Reichel
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2018-03-09 16:19 UTC (permalink / raw)
  To: Moritz Fischer
  Cc: linux-kernel, devicetree, linux-pm, robh+dt, andy.shevchenko

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

Hi,

On Thu, Feb 22, 2018 at 03:17:14PM -0800, Moritz Fischer wrote:
> Add support for reading a timeout value from device property.
> Fall back to previous default of 3s if nothing is specified.
> 
> Signed-off-by: Moritz Fischer <mdf@kernel.org>
> ---

Thanks, both queued.

-- Sebastian

> Changes from v2:
> - use device_property_read_{bool,u32} instead of of equivalent
> 
> Changes from v1:
> - of_property_read_u32() overwrites the output only if it succeeds,
>   simplify error handling
> ---
> 
>  drivers/power/reset/gpio-poweroff.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/power/reset/gpio-poweroff.c b/drivers/power/reset/gpio-poweroff.c
> index be3d81ff51cc..6273ad3b411d 100644
> --- a/drivers/power/reset/gpio-poweroff.c
> +++ b/drivers/power/reset/gpio-poweroff.c
> @@ -19,11 +19,13 @@
>  #include <linux/of_platform.h>
>  #include <linux/module.h>
>  
> +#define DEFAULT_TIMEOUT_MS 3000
>  /*
>   * Hold configuration here, cannot be more than one instance of the driver
>   * since pm_power_off itself is global.
>   */
>  static struct gpio_desc *reset_gpio;
> +static u32 timeout = DEFAULT_TIMEOUT_MS;
>  
>  static void gpio_poweroff_do_poweroff(void)
>  {
> @@ -40,7 +42,7 @@ static void gpio_poweroff_do_poweroff(void)
>  	gpiod_set_value(reset_gpio, 1);
>  
>  	/* give it some time */
> -	mdelay(3000);
> +	mdelay(timeout);
>  
>  	WARN_ON(1);
>  }
> @@ -58,12 +60,14 @@ static int gpio_poweroff_probe(struct platform_device *pdev)
>  		return -EBUSY;
>  	}
>  
> -	input = of_property_read_bool(pdev->dev.of_node, "input");
> +	input = device_property_read_bool(&pdev->dev, "input");
>  	if (input)
>  		flags = GPIOD_IN;
>  	else
>  		flags = GPIOD_OUT_LOW;
>  
> +	device_property_read_u32(&pdev->dev, "timeout-ms", &timeout);
> +
>  	reset_gpio = devm_gpiod_get(&pdev->dev, NULL, flags);
>  	if (IS_ERR(reset_gpio))
>  		return PTR_ERR(reset_gpio);
> -- 
> 2.16.1
> 

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

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

end of thread, other threads:[~2018-03-09 16:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20180222231714.11843-1-mdf@kernel.org>
2018-03-01 23:26 ` [PATCH v3 1/2] dt-bindings: power: reset: gpio-poweroff: Add 'timeout-ms' property Rob Herring
     [not found] ` <20180222231714.11843-2-mdf@kernel.org>
2018-03-09 16:19   ` [PATCH v3 2/2] power: reset: gpio-poweroff: Support for timeout from device property Sebastian Reichel

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