162306a36Sopenharmony_ci# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
262306a36Sopenharmony_ci%YAML 1.2
362306a36Sopenharmony_ci---
462306a36Sopenharmony_ci$id: http://devicetree.org/schemas/power/reset/gpio-poweroff.yaml#
562306a36Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml#
662306a36Sopenharmony_ci
762306a36Sopenharmony_cititle: GPIO controlled power off
862306a36Sopenharmony_ci
962306a36Sopenharmony_cimaintainers:
1062306a36Sopenharmony_ci  - Sebastian Reichel <sre@kernel.org>
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_cidescription: >
1362306a36Sopenharmony_ci  System power off support via a GPIO line. When a shutdown is
1462306a36Sopenharmony_ci  executed the operating system is expected to switch the GPIO
1562306a36Sopenharmony_ci  from inactive to active. After a delay (active-delay-ms) it
1662306a36Sopenharmony_ci  is expected to be switched back to inactive. After another
1762306a36Sopenharmony_ci  delay (inactive-delay-ms) it is configured as active again.
1862306a36Sopenharmony_ci  Finally the operating system assumes the power off failed if
1962306a36Sopenharmony_ci  the system is still running after waiting some time (timeout-ms).
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ciproperties:
2262306a36Sopenharmony_ci  compatible:
2362306a36Sopenharmony_ci    const: gpio-poweroff
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci  gpios:
2662306a36Sopenharmony_ci    maxItems: 1
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci  input:
2962306a36Sopenharmony_ci    type: boolean
3062306a36Sopenharmony_ci    description: >
3162306a36Sopenharmony_ci      Initially configure the GPIO line as an input. Only reconfigure
3262306a36Sopenharmony_ci      it to an output when the power-off sequence is initiated. If this optional
3362306a36Sopenharmony_ci      property is not specified, the GPIO is initialized as an output in its inactive state.
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci  active-delay-ms:
3662306a36Sopenharmony_ci    default: 100
3762306a36Sopenharmony_ci    description: Delay to wait after driving gpio active
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ci  inactive-delay-ms:
4062306a36Sopenharmony_ci    default: 100
4162306a36Sopenharmony_ci    description: Delay to wait after driving gpio inactive
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci  timeout-ms:
4462306a36Sopenharmony_ci    default: 3000
4562306a36Sopenharmony_ci    description: Time to wait before assuming the power off sequence failed.
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_cirequired:
4862306a36Sopenharmony_ci  - compatible
4962306a36Sopenharmony_ci  - gpios
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ciadditionalProperties: false
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ciexamples:
5462306a36Sopenharmony_ci  - |
5562306a36Sopenharmony_ci    gpio-poweroff {
5662306a36Sopenharmony_ci        compatible = "gpio-poweroff";
5762306a36Sopenharmony_ci        gpios = <&gpio 4 0>;
5862306a36Sopenharmony_ci        timeout-ms = <3000>;
5962306a36Sopenharmony_ci    };
60