Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Heiko Stuebner and committed by
Sebastian Reichel
76ee875c a53a68ce

+10 -2
+2
Documentation/devicetree/bindings/power/reset/gpio-poweroff.txt
··· 27 27 it to an output when the power-off handler is called. If this optional 28 28 property is not specified, the GPIO is initialized as an output in its 29 29 inactive state. 30 + - active-delay-ms: Delay (default 100) to wait after driving gpio active 31 + - inactive-delay-ms: Delay (default 100) to wait after driving gpio inactive 30 32 - timeout-ms: Time to wait before asserting a WARN_ON(1). If nothing is 31 33 specified, 3000 ms is used. 32 34
+8 -2
drivers/power/reset/gpio-poweroff.c
··· 26 26 */ 27 27 static struct gpio_desc *reset_gpio; 28 28 static u32 timeout = DEFAULT_TIMEOUT_MS; 29 + static u32 active_delay = 100; 30 + static u32 inactive_delay = 100; 29 31 30 32 static void gpio_poweroff_do_poweroff(void) 31 33 { ··· 35 33 36 34 /* drive it active, also inactive->active edge */ 37 35 gpiod_direction_output(reset_gpio, 1); 38 - mdelay(100); 36 + mdelay(active_delay); 37 + 39 38 /* drive inactive, also active->inactive edge */ 40 39 gpiod_set_value_cansleep(reset_gpio, 0); 41 - mdelay(100); 40 + mdelay(inactive_delay); 42 41 43 42 /* drive it active, also inactive->active edge */ 44 43 gpiod_set_value_cansleep(reset_gpio, 1); ··· 69 66 else 70 67 flags = GPIOD_OUT_LOW; 71 68 69 + device_property_read_u32(&pdev->dev, "active-delay-ms", &active_delay); 70 + device_property_read_u32(&pdev->dev, "inactive-delay-ms", 71 + &inactive_delay); 72 72 device_property_read_u32(&pdev->dev, "timeout-ms", &timeout); 73 73 74 74 reset_gpio = devm_gpiod_get(&pdev->dev, NULL, flags);