aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorThomas Bogendoerfer <tsbogend@alpha.franken.de>2008-07-11 17:03:03 -0400
committerRalf Baechle <ralf@linux-mips.org>2008-07-15 13:44:37 -0400
commitb03d7b18fd783f39e31560d568e7db954f3080af (patch)
tree4b3e0afaeab63b704701baec6fbcbd931c30a1b7 /arch
parentefff4ae259b8f750ea426d3084007f85c0a15a85 (diff)
[MIPS] IP22: Add platform device for Indy volume buttons
Create platform device for Indy volume buttons and remove button handling from ip22-reset.c Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/sgi-ip22/ip22-platform.c11
-rw-r--r--arch/mips/sgi-ip22/ip22-reset.c51
2 files changed, 13 insertions, 49 deletions
diff --git a/arch/mips/sgi-ip22/ip22-platform.c b/arch/mips/sgi-ip22/ip22-platform.c
index d93d07a8c317..fc6df96305ed 100644
--- a/arch/mips/sgi-ip22/ip22-platform.c
+++ b/arch/mips/sgi-ip22/ip22-platform.c
@@ -182,3 +182,14 @@ static int __init sgi_hal2_devinit(void)
182} 182}
183 183
184device_initcall(sgi_hal2_devinit); 184device_initcall(sgi_hal2_devinit);
185
186static int __init sgi_button_devinit(void)
187{
188 if (ip22_is_fullhouse())
189 return 0; /* full house has no volume buttons */
190
191 return IS_ERR(platform_device_register_simple("sgiindybtns",
192 -1, NULL, 0));
193}
194
195device_initcall(sgi_button_devinit);
diff --git a/arch/mips/sgi-ip22/ip22-reset.c b/arch/mips/sgi-ip22/ip22-reset.c
index a435b31cf031..4ad5c3393fd3 100644
--- a/arch/mips/sgi-ip22/ip22-reset.c
+++ b/arch/mips/sgi-ip22/ip22-reset.c
@@ -39,7 +39,7 @@
39#define POWERDOWN_FREQ (HZ / 4) 39#define POWERDOWN_FREQ (HZ / 4)
40#define PANIC_FREQ (HZ / 8) 40#define PANIC_FREQ (HZ / 8)
41 41
42static struct timer_list power_timer, blink_timer, debounce_timer, volume_timer; 42static struct timer_list power_timer, blink_timer, debounce_timer;
43 43
44#define MACHINE_PANICED 1 44#define MACHINE_PANICED 1
45#define MACHINE_SHUTTING_DOWN 2 45#define MACHINE_SHUTTING_DOWN 2
@@ -139,36 +139,6 @@ static inline void power_button(void)
139 add_timer(&power_timer); 139 add_timer(&power_timer);
140} 140}
141 141
142void (*indy_volume_button)(int) = NULL;
143
144EXPORT_SYMBOL(indy_volume_button);
145
146static inline void volume_up_button(unsigned long data)
147{
148 del_timer(&volume_timer);
149
150 if (indy_volume_button)
151 indy_volume_button(1);
152
153 if (sgint->istat1 & SGINT_ISTAT1_PWR) {
154 volume_timer.expires = jiffies + (HZ / 100);
155 add_timer(&volume_timer);
156 }
157}
158
159static inline void volume_down_button(unsigned long data)
160{
161 del_timer(&volume_timer);
162
163 if (indy_volume_button)
164 indy_volume_button(-1);
165
166 if (sgint->istat1 & SGINT_ISTAT1_PWR) {
167 volume_timer.expires = jiffies + (HZ / 100);
168 add_timer(&volume_timer);
169 }
170}
171
172static irqreturn_t panel_int(int irq, void *dev_id) 142static irqreturn_t panel_int(int irq, void *dev_id)
173{ 143{
174 unsigned int buttons; 144 unsigned int buttons;
@@ -190,25 +160,8 @@ static irqreturn_t panel_int(int irq, void *dev_id)
190 * House. Only lowest 2 bits are used. Guiness uses upper four bits 160 * House. Only lowest 2 bits are used. Guiness uses upper four bits
191 * for volume control". This is not true, all bits are pulled high 161 * for volume control". This is not true, all bits are pulled high
192 * on fullhouse */ 162 * on fullhouse */
193 if (ip22_is_fullhouse() || !(buttons & SGIOC_PANEL_POWERINTR)) { 163 if (!(buttons & SGIOC_PANEL_POWERINTR))
194 power_button(); 164 power_button();
195 return IRQ_HANDLED;
196 }
197 /* TODO: mute/unmute */
198 /* Volume up button was pressed */
199 if (!(buttons & SGIOC_PANEL_VOLUPINTR)) {
200 init_timer(&volume_timer);
201 volume_timer.function = volume_up_button;
202 volume_timer.expires = jiffies + (HZ / 100);
203 add_timer(&volume_timer);
204 }
205 /* Volume down button was pressed */
206 if (!(buttons & SGIOC_PANEL_VOLDNINTR)) {
207 init_timer(&volume_timer);
208 volume_timer.function = volume_down_button;
209 volume_timer.expires = jiffies + (HZ / 100);
210 add_timer(&volume_timer);
211 }
212 165
213 return IRQ_HANDLED; 166 return IRQ_HANDLED;
214} 167}