[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20180309161926.hciaq3ok7st3fc7j@earth.universe>
Date: Fri, 9 Mar 2018 17:19:26 +0100
From: Sebastian Reichel <sre@...nel.org>
To: Moritz Fischer <mdf@...nel.org>
Cc: linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
linux-pm@...r.kernel.org, robh+dt@...nel.org,
andy.shevchenko@...il.com
Subject: Re: [PATCH v3 2/2] power: reset: gpio-poweroff: Support for timeout
from device property
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@...nel.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
>
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists