diff options
author | Ulf Carlsson <md1ulfc@mdstud.chalmers.se> | 1999-04-10 12:21:30 +0000 |
---|---|---|
committer | Ulf Carlsson <md1ulfc@mdstud.chalmers.se> | 1999-04-10 12:21:30 +0000 |
commit | 73f87f3dfa06985598da70789faa8a85e0c6b063 (patch) | |
tree | fd0a16b2d19665b3dc657b67cf98b364e97716bf /arch | |
parent | 5e7c7ef3e74c0de78a375fb13dd69fdcf96a1a8d (diff) |
o Smooth volume control
o Reads volume setting from PROM
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/sgi/kernel/reset.c | 68 | ||||
-rw-r--r-- | arch/mips/sgi/kernel/setup.c | 5 |
2 files changed, 58 insertions, 15 deletions
diff --git a/arch/mips/sgi/kernel/reset.c b/arch/mips/sgi/kernel/reset.c index 0dc872e64..4a89532a6 100644 --- a/arch/mips/sgi/kernel/reset.c +++ b/arch/mips/sgi/kernel/reset.c @@ -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,20 +131,50 @@ static inline void power_button(void) add_timer(&power_timer); } -unsigned char current_volume = 0x7f; +void inline sgi_volume_set(unsigned char volume) +{ + sgi_volume = volume; -static inline void volume_up_button(void) + hpc3c0->pbus_extregs[2][0] = sgi_volume; + hpc3c0->pbus_extregs[2][1] = sgi_volume; +} + +void inline sgi_volume_get(unsigned char *volume) { - current_volume = (current_volume < 0xe1) ? current_volume + 0x1e : 0xff; - hpc3c0->pbus_extregs[2][0] = current_volume; - hpc3c0->pbus_extregs[2][1] = current_volume; + *volume = sgi_volume; +} + +static inline void volume_up_button(unsigned long data) +{ + 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(void) +static inline void volume_down_button(unsigned long data) { - current_volume = (current_volume > 0x1e) ? current_volume - 0x1e : 0; - hpc3c0->pbus_extregs[2][0] = current_volume; - hpc3c0->pbus_extregs[2][1] = current_volume; + 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) @@ -162,10 +194,18 @@ static void panel_int(int irq, void *dev_id, struct pt_regs *regs) 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, diff --git a/arch/mips/sgi/kernel/setup.c b/arch/mips/sgi/kernel/setup.c index 5a9c12232..7dbbc1c80 100644 --- a/arch/mips/sgi/kernel/setup.c +++ b/arch/mips/sgi/kernel/setup.c @@ -1,4 +1,4 @@ -/* $Id: setup.c,v 1.20 1999/02/11 23:50:31 tsbogend Exp $ +/* $Id: setup.c,v 1.21 1999/04/05 01:41:18 ulfc Exp $ * * setup.c: SGI specific setup, including init of the feature struct. * @@ -29,6 +29,7 @@ extern struct rtc_ops indy_rtc_ops; void indy_reboot_setup(void); +void sgi_volume_set(unsigned char); #define sgi_kh ((struct hpc_keyb *) (KSEG1 + 0x1fbd9800 + 64)) @@ -143,6 +144,8 @@ __initfunc(void sgi_setup(void)) console_setup ("ttyS0"); } #endif + + sgi_volume_set(simple_strtoul(prom_getenv("volume"), NULL, 10)); #ifdef CONFIG_VT #ifdef CONFIG_SGI_NEWPORT_CONSOLE |