8 #include <linux/linkage.h>
11 #include <linux/module.h>
13 #include <linux/kernel.h>
14 #include <linux/sched.h>
21 #include <asm/reboot.h>
33 #define POWERDOWN_TIMEOUT 120
38 #define POWERDOWN_FREQ (HZ / 4)
39 #define PANIC_FREQ (HZ / 8)
41 static struct timer_list power_timer, blink_timer, debounce_timer;
43 #define MACHINE_PANICED 1
44 #define MACHINE_SHUTTING_DOWN 2
46 static int machine_state;
48 static void __noreturn sgi_machine_power_off(
void)
73 sgi_machine_power_off();
80 if (machine_state & MACHINE_SHUTTING_DOWN)
81 sgi_machine_power_off();
85 static void power_timeout(
unsigned long data)
87 sgi_machine_power_off();
90 static void blink_timeout(
unsigned long data)
99 static void debounce(
unsigned long data)
104 debounce_timer.expires =
jiffies + (
HZ / 20);
120 static inline void power_button(
void)
125 if ((machine_state & MACHINE_SHUTTING_DOWN) ||
126 kill_cad_pid(
SIGINT, 1)) {
128 sgi_machine_power_off();
136 power_timer.function = power_timeout;
145 buttons =
sgioc->panel;
152 debounce_timer.function = debounce;
153 debounce_timer.expires =
jiffies + 5;
171 if (machine_state & MACHINE_PANICED)
182 .notifier_call = panic_event,
200 blink_timer.function = blink_timeout;