1*4882a593SmuzhiyunDriver a GPIO line that can be used to turn the power off. 2*4882a593Smuzhiyun 3*4882a593SmuzhiyunThe driver supports both level triggered and edge triggered power off. 4*4882a593SmuzhiyunAt driver load time, the driver will request the given gpio line and 5*4882a593Smuzhiyuninstall a handler to power off the system. If the optional properties 6*4882a593Smuzhiyun'input' is not found, the GPIO line will be driven in the inactive 7*4882a593Smuzhiyunstate. Otherwise its configured as an input. 8*4882a593Smuzhiyun 9*4882a593SmuzhiyunWhen the power-off handler is called, the gpio is configured as an 10*4882a593Smuzhiyunoutput, and drive active, so triggering a level triggered power off 11*4882a593Smuzhiyuncondition. This will also cause an inactive->active edge condition, so 12*4882a593Smuzhiyuntriggering positive edge triggered power off. After a delay of 100ms, 13*4882a593Smuzhiyunthe GPIO is set to inactive, thus causing an active->inactive edge, 14*4882a593Smuzhiyuntriggering negative edge triggered power off. After another 100ms 15*4882a593Smuzhiyundelay the GPIO is driver active again. If the power is still on and 16*4882a593Smuzhiyunthe CPU still running after a 3000ms delay, a WARN_ON(1) is emitted. 17*4882a593Smuzhiyun 18*4882a593SmuzhiyunRequired properties: 19*4882a593Smuzhiyun- compatible : should be "gpio-poweroff". 20*4882a593Smuzhiyun- gpios : The GPIO to set high/low, see "gpios property" in 21*4882a593Smuzhiyun Documentation/devicetree/bindings/gpio/gpio.txt. If the pin should be 22*4882a593Smuzhiyun low to power down the board set it to "Active Low", otherwise set 23*4882a593Smuzhiyun gpio to "Active High". 24*4882a593Smuzhiyun 25*4882a593SmuzhiyunOptional properties: 26*4882a593Smuzhiyun- input : Initially configure the GPIO line as an input. Only reconfigure 27*4882a593Smuzhiyun it to an output when the power-off handler is called. If this optional 28*4882a593Smuzhiyun property is not specified, the GPIO is initialized as an output in its 29*4882a593Smuzhiyun inactive state. 30*4882a593Smuzhiyun- active-delay-ms: Delay (default 100) to wait after driving gpio active 31*4882a593Smuzhiyun- inactive-delay-ms: Delay (default 100) to wait after driving gpio inactive 32*4882a593Smuzhiyun- timeout-ms: Time to wait before asserting a WARN_ON(1). If nothing is 33*4882a593Smuzhiyun specified, 3000 ms is used. 34*4882a593Smuzhiyun 35*4882a593SmuzhiyunExamples: 36*4882a593Smuzhiyun 37*4882a593Smuzhiyungpio-poweroff { 38*4882a593Smuzhiyun compatible = "gpio-poweroff"; 39*4882a593Smuzhiyun gpios = <&gpio 4 0>; 40*4882a593Smuzhiyun timeout-ms = <3000>; 41*4882a593Smuzhiyun}; 42