patch-2.2.11 linux/arch/mips/sgi/kernel/reset.c

Next file: linux/arch/mips/sgi/kernel/setup.c
Previous file: linux/arch/mips/sgi/kernel/promcon.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.10/linux/arch/mips/sgi/kernel/reset.c linux/arch/mips/sgi/kernel/reset.c
@@ -1,4 +1,4 @@
-/* $Id: reset.c,v 1.6 1998/07/09 19:57:47 ralf Exp $
+/* $Id: reset.c,v 1.6 1999/04/10 12:21:30 ulfc Exp $
  *
  * Reset a SGI.
  *
@@ -33,7 +33,9 @@
 #define POWERDOWN_FREQ		(HZ / 4)
 #define PANIC_FREQ		(HZ / 8)
 
-static struct timer_list power_timer, blink_timer, debounce_timer;
+static unsigned char sgi_volume;
+
+static struct timer_list power_timer, blink_timer, debounce_timer, volume_timer;
 static int shuting_down, has_paniced;
 
 static void sgi_machine_restart(char *command) __attribute__((noreturn));
@@ -129,14 +131,50 @@
 	add_timer(&power_timer);
 }
 
-static inline void volume_up_button(void)
+void inline sgi_volume_set(unsigned char volume)
+{
+	sgi_volume = volume;
+
+	hpc3c0->pbus_extregs[2][0] = sgi_volume;
+	hpc3c0->pbus_extregs[2][1] = sgi_volume;
+}
+
+void inline sgi_volume_get(unsigned char *volume)
 {
-	/* Later when we have sound support ... */
+	*volume = sgi_volume;
 }
 
-static inline void volume_down_button(void)
+static inline void volume_up_button(unsigned long data)
 {
-	/* Later when we have sound support ... */
+	del_timer(&volume_timer);
+
+	if (sgi_volume < 0xff)
+		sgi_volume++;
+
+	hpc3c0->pbus_extregs[2][0] = sgi_volume;
+	hpc3c0->pbus_extregs[2][1] = sgi_volume;
+
+	if (ioc_icontrol->istat1 & 2) {
+		volume_timer.expires = jiffies + 1;
+		add_timer(&volume_timer);
+	}
+
+}
+
+static inline void volume_down_button(unsigned long data)
+{
+	del_timer(&volume_timer);
+
+	if (sgi_volume > 0)
+		sgi_volume--;
+
+	hpc3c0->pbus_extregs[2][0] = sgi_volume;
+	hpc3c0->pbus_extregs[2][1] = sgi_volume;
+
+	if (ioc_icontrol->istat1 & 2) {
+		volume_timer.expires = jiffies + 1;
+		add_timer(&volume_timer);
+	}
 }
 
 static void panel_int(int irq, void *dev_id, struct pt_regs *regs)
@@ -156,10 +194,18 @@
 
 	if (!(buttons & 2))		/* Power button was pressed */
 		power_button();
-	if (!(buttons & 0x40))		/* Volume up button was pressed */
-		volume_up_button();
-	if (!(buttons & 0x10))		/* Volume down button was pressed */
-		volume_down_button();
+	if (!(buttons & 0x40)) {	/* Volume up button was pressed */
+		init_timer(&volume_timer);
+		volume_timer.function = volume_up_button;
+		volume_timer.expires = jiffies + 1;
+		add_timer(&volume_timer);
+	}
+	if (!(buttons & 0x10)) {	/* Volume down button was pressed */
+		init_timer(&volume_timer);
+		volume_timer.function = volume_down_button;
+		volume_timer.expires = jiffies + 1;
+		add_timer(&volume_timer);
+	}
 }
 
 static int panic_event(struct notifier_block *this, unsigned long event,

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)