diff options
author | Heiko Stuebner <heiko.stuebner@bq.com> | 2018-11-11 22:45:38 +0100 |
---|---|---|
committer | Sebastian Reichel <sre@kernel.org> | 2018-12-05 22:38:29 +0100 |
commit | 76ee875c2f48c57cbafa35d9c3b34e7202a45a83 (patch) | |
tree | 06fef854ed5e05a8122f07b01491bdf1b75d0d5d /drivers/power | |
parent | power: supply: charger-manager: Make code more readable (diff) | |
download | linux-76ee875c2f48c57cbafa35d9c3b34e7202a45a83.tar.xz linux-76ee875c2f48c57cbafa35d9c3b34e7202a45a83.zip |
power: reset: gpio-poweroff: add ability to specific active and inactive delays
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>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Moritz Fischer <mdf@kernel.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/reset/gpio-poweroff.c | 10 |
1 files changed, 8 insertions, 2 deletions
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); |