18c2ecf20Sopenharmony_ciDriver a GPIO line that can be used to turn the power off.
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ciThe driver supports both level triggered and edge triggered power off.
48c2ecf20Sopenharmony_ciAt driver load time, the driver will request the given gpio line and
58c2ecf20Sopenharmony_ciinstall a handler to power off the system. If the optional properties
68c2ecf20Sopenharmony_ci'input' is not found, the GPIO line will be driven in the inactive
78c2ecf20Sopenharmony_cistate. Otherwise its configured as an input.
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ciWhen the power-off handler is called, the gpio is configured as an
108c2ecf20Sopenharmony_cioutput, and drive active, so triggering a level triggered power off
118c2ecf20Sopenharmony_cicondition. This will also cause an inactive->active edge condition, so
128c2ecf20Sopenharmony_citriggering positive edge triggered power off. After a delay of 100ms,
138c2ecf20Sopenharmony_cithe GPIO is set to inactive, thus causing an active->inactive edge,
148c2ecf20Sopenharmony_citriggering negative edge triggered power off. After another 100ms
158c2ecf20Sopenharmony_cidelay the GPIO is driver active again. If the power is still on and
168c2ecf20Sopenharmony_cithe CPU still running after a 3000ms delay, a WARN_ON(1) is emitted.
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ciRequired properties:
198c2ecf20Sopenharmony_ci- compatible : should be "gpio-poweroff".
208c2ecf20Sopenharmony_ci- gpios : The GPIO to set high/low, see "gpios property" in
218c2ecf20Sopenharmony_ci  Documentation/devicetree/bindings/gpio/gpio.txt. If the pin should be
228c2ecf20Sopenharmony_ci  low to power down the board set it to "Active Low", otherwise set
238c2ecf20Sopenharmony_ci  gpio to "Active High".
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ciOptional properties:
268c2ecf20Sopenharmony_ci- input : Initially configure the GPIO line as an input. Only reconfigure
278c2ecf20Sopenharmony_ci  it to an output when the power-off handler is called. If this optional
288c2ecf20Sopenharmony_ci  property is not specified, the GPIO is initialized as an output in its
298c2ecf20Sopenharmony_ci  inactive state.
308c2ecf20Sopenharmony_ci- active-delay-ms: Delay (default 100) to wait after driving gpio active
318c2ecf20Sopenharmony_ci- inactive-delay-ms: Delay (default 100) to wait after driving gpio inactive
328c2ecf20Sopenharmony_ci- timeout-ms: Time to wait before asserting a WARN_ON(1). If nothing is
338c2ecf20Sopenharmony_ci              specified, 3000 ms is used.
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ciExamples:
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_cigpio-poweroff {
388c2ecf20Sopenharmony_ci	compatible = "gpio-poweroff";
398c2ecf20Sopenharmony_ci	gpios = <&gpio 4 0>;
408c2ecf20Sopenharmony_ci	timeout-ms = <3000>;
418c2ecf20Sopenharmony_ci};
42