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/mips/sgi/kernel/reset.c | |
parent | 5e7c7ef3e74c0de78a375fb13dd69fdcf96a1a8d (diff) |
o Smooth volume control
o Reads volume setting from PROM
Diffstat (limited to 'arch/mips/sgi/kernel/reset.c')
-rw-r--r-- | arch/mips/sgi/kernel/reset.c | 68 |
1 files changed, 54 insertions, 14 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, |