bcm27xx: import latest patches from the RPi foundation
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.4 / 950-0754-overlays-gpio-shutdown-Add-information-for-SysV-init.patch
1 From 047041db91fabcb768c3e5680645b69fa9528e86 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
3 Date: Thu, 30 Apr 2020 19:40:07 +0200
4 Subject: [PATCH] overlays: gpio-shutdown: Add information for SysV
5 init / inittab
6
7 KeyboardSignal and kb::kbrequest can be used to call /sbin/shutdown
8 ---
9 arch/arm/boot/dts/overlays/README | 24 ++++++++++++++++++++++++
10 1 file changed, 24 insertions(+)
11
12 --- a/arch/arm/boot/dts/overlays/README
13 +++ b/arch/arm/boot/dts/overlays/README
14 @@ -847,6 +847,7 @@ Params: gpiopin GPIO for
15 Name: gpio-shutdown
16 Info: Initiates a shutdown when GPIO pin changes. The given GPIO pin
17 is configured as an input key that generates KEY_POWER events.
18 +
19 This event is handled by systemd-logind by initiating a
20 shutdown. Systemd versions older than 225 need an udev rule
21 enable listening to the input device:
22 @@ -855,6 +856,29 @@ Info: Initiates a shutdown when GPIO p
23 SUBSYSTEMS=="platform", DRIVERS=="gpio-keys", \
24 ATTRS{keys}=="116", TAG+="power-switch"
25
26 + Alternatively this event can be handled also on systems without
27 + systemd, just by traditional SysV init daemon. KEY_POWER event
28 + (keycode 116) needs to be mapped to KeyboardSignal on console
29 + and then kb::kbrequest inittab action which is triggered by
30 + KeyboardSignal from console can be configured to issue system
31 + shutdown. Steps for this configuration are:
32 +
33 + Add following lines to the /etc/console-setup/remap.inc file:
34 +
35 + # Key Power as special keypress
36 + keycode 116 = KeyboardSignal
37 +
38 + Then add following lines to /etc/inittab file:
39 +
40 + # Action on special keypress (Key Power)
41 + kb::kbrequest:/sbin/shutdown -t1 -a -h -P now
42 +
43 + And finally reload configuration by calling following commands:
44 +
45 + # dpkg-reconfigure console-setup
46 + # service console-setup reload
47 + # init q
48 +
49 This overlay only handles shutdown. After shutdown, the system
50 can be powered up again by driving GPIO3 low. The default
51 configuration uses GPIO3 with a pullup, so if you connect a