1 // Definitions for gpio-poweroff module
5 // This overlay sets up an input device that generates KEY_POWER events
6 // when a given GPIO pin changes. It defaults to using GPIO3, which can
7 // also be used to wake up (start) the Rpi again after shutdown.
8 // Raspberry Pi 1 Model B rev 1 can be wake up only by GPIO1 pin, so for
9 // these boards change default GPIO pin to 1 via gpio_pin parameter. Since
10 // wakeup is active-low, this defaults to active-low with a pullup
11 // enabled, but all of this can be changed using overlay parameters (but
12 // note that GPIO3 has an external pullup on at least some boards).
15 compatible = "brcm,bcm2835";
18 // Configure the gpio pin controller
21 // Define a pinctrl state, that sets up the gpio
22 // as an input with a pullup enabled. This does
23 // not take effect by itself, only when referenced
24 // by a "pinctrl client", as is done below. See:
25 // https://www.kernel.org/doc/Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
26 // https://www.kernel.org/doc/Documentation/devicetree/bindings/pinctrl/brcm,bcm2835-gpio.txt
27 pin_state: shutdown_button_pins@3 {
28 brcm,pins = <3>; // gpio number
29 brcm,function = <0>; // 0 = input, 1 = output
30 brcm,pull = <2>; // 0 = none, 1 = pull down, 2 = pull up
35 // Add a new device to the /soc devicetree node
38 shutdown_button: shutdown_button@3 {
39 // Let the gpio-keys driver handle this device. See:
40 // https://www.kernel.org/doc/Documentation/devicetree/bindings/input/gpio-keys.txt
41 compatible = "gpio-keys";
43 // Declare a single pinctrl state (referencing the one declared above) and name it
44 // default, so it is activated automatically.
45 pinctrl-names = "default";
46 pinctrl-0 = <&pin_state>;
51 // Define a single key, called "shutdown" that monitors the gpio and sends KEY_POWER
53 // https://github.com/torvalds/linux/blob/v4.12/include/uapi/linux/input-event-codes.h#L190)
56 linux,code = <116>; // KEY_POWER
58 debounce-interval = <100>; // ms
64 // This defines parameters that can be specified when loading
65 // the overlay. Each foo = line specifies one parameter, named
66 // foo. The rest of the specification gives properties where the
67 // parameter value is inserted into (changing the values above
68 // or adding new ones).
70 // Allow overriding the GPIO number.
71 gpio_pin = <&button>,"gpios:4",
72 <&shutdown_button>,"reg:0",
74 <&pin_state>,"brcm,pins:0";
76 // Allow changing the internal pullup/down state. 0 = none, 1 = pulldown, 2 = pullup
77 // Note that GPIO3 and GPIO2 are the I2c pins and have an external pullup (at least
78 // on some boards). Same applies for GPIO1 on Raspberry Pi 1 Model B rev 1.
79 gpio_pull = <&pin_state>,"brcm,pull:0";
81 // Allow setting the active_low flag. 0 = active high, 1 = active low
82 active_low = <&button>,"gpios:8";
83 debounce = <&button>,"debounce-interval:0";