diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-07 13:10:09 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-07 13:10:09 -0500 |
commit | e8a82fd030c2e0ba4d4169cc4257ef174ff6f6b4 (patch) | |
tree | 0515ffe68d9a88eda2d16f45e6391b05475fd9d1 /arch/mips/sgi-ip22/ip22-reset.c | |
parent | e1a8e6c9b757c09249ab29fc6da12d9ab64567e1 (diff) | |
parent | b38c73995f63fe205c0068cb0ce3131895244068 (diff) |
Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
Diffstat (limited to 'arch/mips/sgi-ip22/ip22-reset.c')
-rw-r--r-- | arch/mips/sgi-ip22/ip22-reset.c | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/arch/mips/sgi-ip22/ip22-reset.c b/arch/mips/sgi-ip22/ip22-reset.c index 214ffd2e98a3..92a3b3c15ed3 100644 --- a/arch/mips/sgi-ip22/ip22-reset.c +++ b/arch/mips/sgi-ip22/ip22-reset.c | |||
@@ -3,8 +3,9 @@ | |||
3 | * License. See the file "COPYING" in the main directory of this archive | 3 | * License. See the file "COPYING" in the main directory of this archive |
4 | * for more details. | 4 | * for more details. |
5 | * | 5 | * |
6 | * Copyright (C) 1997, 1998, 2001, 2003 by Ralf Baechle | 6 | * Copyright (C) 1997, 1998, 2001, 03, 05, 06 by Ralf Baechle |
7 | */ | 7 | */ |
8 | #include <linux/linkage.h> | ||
8 | #include <linux/init.h> | 9 | #include <linux/init.h> |
9 | #include <linux/ds1286.h> | 10 | #include <linux/ds1286.h> |
10 | #include <linux/module.h> | 11 | #include <linux/module.h> |
@@ -12,6 +13,7 @@ | |||
12 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
13 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
14 | #include <linux/notifier.h> | 15 | #include <linux/notifier.h> |
16 | #include <linux/pm.h> | ||
15 | #include <linux/timer.h> | 17 | #include <linux/timer.h> |
16 | 18 | ||
17 | #include <asm/io.h> | 19 | #include <asm/io.h> |
@@ -41,28 +43,10 @@ static struct timer_list power_timer, blink_timer, debounce_timer, volume_timer; | |||
41 | 43 | ||
42 | #define MACHINE_PANICED 1 | 44 | #define MACHINE_PANICED 1 |
43 | #define MACHINE_SHUTTING_DOWN 2 | 45 | #define MACHINE_SHUTTING_DOWN 2 |
44 | static int machine_state = 0; | ||
45 | 46 | ||
46 | static void sgi_machine_restart(char *command) __attribute__((noreturn)); | 47 | static int machine_state; |
47 | static void sgi_machine_halt(void) __attribute__((noreturn)); | ||
48 | static void sgi_machine_power_off(void) __attribute__((noreturn)); | ||
49 | 48 | ||
50 | static void sgi_machine_restart(char *command) | 49 | static void ATTRIB_NORET sgi_machine_power_off(void) |
51 | { | ||
52 | if (machine_state & MACHINE_SHUTTING_DOWN) | ||
53 | sgi_machine_power_off(); | ||
54 | sgimc->cpuctrl0 |= SGIMC_CCTRL0_SYSINIT; | ||
55 | while (1); | ||
56 | } | ||
57 | |||
58 | static void sgi_machine_halt(void) | ||
59 | { | ||
60 | if (machine_state & MACHINE_SHUTTING_DOWN) | ||
61 | sgi_machine_power_off(); | ||
62 | ArcEnterInteractiveMode(); | ||
63 | } | ||
64 | |||
65 | static void sgi_machine_power_off(void) | ||
66 | { | 50 | { |
67 | unsigned int tmp; | 51 | unsigned int tmp; |
68 | 52 | ||
@@ -84,6 +68,21 @@ static void sgi_machine_power_off(void) | |||
84 | } | 68 | } |
85 | } | 69 | } |
86 | 70 | ||
71 | static void ATTRIB_NORET sgi_machine_restart(char *command) | ||
72 | { | ||
73 | if (machine_state & MACHINE_SHUTTING_DOWN) | ||
74 | sgi_machine_power_off(); | ||
75 | sgimc->cpuctrl0 |= SGIMC_CCTRL0_SYSINIT; | ||
76 | while (1); | ||
77 | } | ||
78 | |||
79 | static void ATTRIB_NORET sgi_machine_halt(void) | ||
80 | { | ||
81 | if (machine_state & MACHINE_SHUTTING_DOWN) | ||
82 | sgi_machine_power_off(); | ||
83 | ArcEnterInteractiveMode(); | ||
84 | } | ||
85 | |||
87 | static void power_timeout(unsigned long data) | 86 | static void power_timeout(unsigned long data) |
88 | { | 87 | { |
89 | sgi_machine_power_off(); | 88 | sgi_machine_power_off(); |
@@ -95,7 +94,7 @@ static void blink_timeout(unsigned long data) | |||
95 | sgi_ioc_reset ^= (SGIOC_RESET_LC0OFF|SGIOC_RESET_LC1OFF); | 94 | sgi_ioc_reset ^= (SGIOC_RESET_LC0OFF|SGIOC_RESET_LC1OFF); |
96 | sgioc->reset = sgi_ioc_reset; | 95 | sgioc->reset = sgi_ioc_reset; |
97 | 96 | ||
98 | mod_timer(&blink_timer, jiffies+data); | 97 | mod_timer(&blink_timer, jiffies + data); |
99 | } | 98 | } |
100 | 99 | ||
101 | static void debounce(unsigned long data) | 100 | static void debounce(unsigned long data) |
@@ -103,7 +102,7 @@ static void debounce(unsigned long data) | |||
103 | del_timer(&debounce_timer); | 102 | del_timer(&debounce_timer); |
104 | if (sgint->istat1 & SGINT_ISTAT1_PWR) { | 103 | if (sgint->istat1 & SGINT_ISTAT1_PWR) { |
105 | /* Interrupt still being sent. */ | 104 | /* Interrupt still being sent. */ |
106 | debounce_timer.expires = jiffies + 5; /* 0.05s */ | 105 | debounce_timer.expires = jiffies + (HZ / 20); /* 0.05s */ |
107 | add_timer(&debounce_timer); | 106 | add_timer(&debounce_timer); |
108 | 107 | ||
109 | sgioc->panel = SGIOC_PANEL_POWERON | SGIOC_PANEL_POWERINTR | | 108 | sgioc->panel = SGIOC_PANEL_POWERON | SGIOC_PANEL_POWERINTR | |
@@ -151,7 +150,7 @@ static inline void volume_up_button(unsigned long data) | |||
151 | indy_volume_button(1); | 150 | indy_volume_button(1); |
152 | 151 | ||
153 | if (sgint->istat1 & SGINT_ISTAT1_PWR) { | 152 | if (sgint->istat1 & SGINT_ISTAT1_PWR) { |
154 | volume_timer.expires = jiffies + 1; | 153 | volume_timer.expires = jiffies + (HZ / 100); |
155 | add_timer(&volume_timer); | 154 | add_timer(&volume_timer); |
156 | } | 155 | } |
157 | } | 156 | } |
@@ -164,7 +163,7 @@ static inline void volume_down_button(unsigned long data) | |||
164 | indy_volume_button(-1); | 163 | indy_volume_button(-1); |
165 | 164 | ||
166 | if (sgint->istat1 & SGINT_ISTAT1_PWR) { | 165 | if (sgint->istat1 & SGINT_ISTAT1_PWR) { |
167 | volume_timer.expires = jiffies + 1; | 166 | volume_timer.expires = jiffies + (HZ / 100); |
168 | add_timer(&volume_timer); | 167 | add_timer(&volume_timer); |
169 | } | 168 | } |
170 | } | 169 | } |
@@ -199,14 +198,14 @@ static irqreturn_t panel_int(int irq, void *dev_id, struct pt_regs *regs) | |||
199 | if (!(buttons & SGIOC_PANEL_VOLUPINTR)) { | 198 | if (!(buttons & SGIOC_PANEL_VOLUPINTR)) { |
200 | init_timer(&volume_timer); | 199 | init_timer(&volume_timer); |
201 | volume_timer.function = volume_up_button; | 200 | volume_timer.function = volume_up_button; |
202 | volume_timer.expires = jiffies + 1; | 201 | volume_timer.expires = jiffies + (HZ / 100); |
203 | add_timer(&volume_timer); | 202 | add_timer(&volume_timer); |
204 | } | 203 | } |
205 | /* Volume down button was pressed */ | 204 | /* Volume down button was pressed */ |
206 | if (!(buttons & SGIOC_PANEL_VOLDNINTR)) { | 205 | if (!(buttons & SGIOC_PANEL_VOLDNINTR)) { |
207 | init_timer(&volume_timer); | 206 | init_timer(&volume_timer); |
208 | volume_timer.function = volume_down_button; | 207 | volume_timer.function = volume_down_button; |
209 | volume_timer.expires = jiffies + 1; | 208 | volume_timer.expires = jiffies + (HZ / 100); |
210 | add_timer(&volume_timer); | 209 | add_timer(&volume_timer); |
211 | } | 210 | } |
212 | 211 | ||
@@ -234,7 +233,7 @@ static int __init reboot_setup(void) | |||
234 | { | 233 | { |
235 | _machine_restart = sgi_machine_restart; | 234 | _machine_restart = sgi_machine_restart; |
236 | _machine_halt = sgi_machine_halt; | 235 | _machine_halt = sgi_machine_halt; |
237 | _machine_power_off = sgi_machine_power_off; | 236 | pm_power_off = sgi_machine_power_off; |
238 | 237 | ||
239 | request_irq(SGI_PANEL_IRQ, panel_int, 0, "Front Panel", NULL); | 238 | request_irq(SGI_PANEL_IRQ, panel_int, 0, "Front Panel", NULL); |
240 | init_timer(&blink_timer); | 239 | init_timer(&blink_timer); |