Commit 96ff0f5c authored by Jamie Lentin's avatar Jamie Lentin Committed by Jason Cooper
Browse files

power: Add simple poweroff-gpio driver



Given appropriate devicetree bindings, this driver registers a
pm_power_off function to set a GPIO line high/low to power down
your board.

Signed-off-by: default avatarJamie Lentin <jm@lentin.co.uk>
Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
Tested-by: default avatarSimon Baatz <gmbnomis@gmail.com>
Signed-off-by: default avatarJason Cooper <jason@lakedaemon.net>
parent f4a00139
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
GPIO line that should be set high/low to power off a device

Required properties:
- compatible : should be "gpio-poweroff".
- gpios : The GPIO to set high/low, see "gpios property" in
  Documentation/devicetree/bindings/gpio/gpio.txt. If the pin should be
  low to power down the board set it to "Active Low", otherwise set
  gpio to "Active High".

Optional properties:
- input : Initially configure the GPIO line as an input. Only reconfigure
  it to an output when the pm_power_off function is called. If this optional
  property is not specified, the GPIO is initialized as an output in its
  inactive state.


Examples:

gpio-poweroff {
	compatible = "gpio-poweroff";
	gpios = <&gpio 4 0>; /* GPIO 4 Active Low */
};
+3 −0
Original line number Diff line number Diff line
@@ -335,6 +335,9 @@ config AB8500_BATTERY_THERM_ON_BATCTRL
	help
	  Say Y to enable battery temperature measurements using
	  thermistor connected on BATCTRL ADC.

source "drivers/power/reset/Kconfig"

endif # POWER_SUPPLY

source "drivers/power/avs/Kconfig"
+1 −0
Original line number Diff line number Diff line
@@ -49,3 +49,4 @@ obj-$(CONFIG_CHARGER_MAX8997) += max8997_charger.o
obj-$(CONFIG_CHARGER_MAX8998)	+= max8998_charger.o
obj-$(CONFIG_POWER_AVS)		+= avs/
obj-$(CONFIG_CHARGER_SMB347)	+= smb347-charger.o
obj-$(CONFIG_POWER_RESET)	+= reset/
+15 −0
Original line number Diff line number Diff line
menuconfig POWER_RESET
	bool "Board level reset or power off"
	help
	  Provides a number of drivers which either reset a complete board
	  or shut it down, by manipulating the main power supply on the board.

	  Say Y here to enable board reset and power off

config POWER_RESET_GPIO
	bool "GPIO power-off driver"
	depends on OF_GPIO && POWER_RESET
	help
	  This driver supports turning off your board via a GPIO line.
	  If your board needs a GPIO high/low to power down, say Y and
	  create a binding in your devicetree.
+1 −0
Original line number Diff line number Diff line
obj-$(CONFIG_POWER_RESET_GPIO) += gpio-poweroff.o
Loading