fix file specification in comments
[linux-2.6-block.git] / arch / sh / boards / bigsur / led.c
CommitLineData
1da177e4 1/*
f30c2269 2 * linux/arch/sh/boards/bigsur/led.c
1da177e4
LT
3 *
4 * By Dustin McIntire (dustin@sensoria.com) (c)2001
5 * Derived from led_se.c and led.c, which bore the message:
6 * Copyright (C) 2000 Stuart Menefy <stuart.menefy@st.com>
7 *
8 * May be copied or modified under the terms of the GNU General Public
9 * License. See linux/COPYING for more information.
10 *
11 * This file contains Big Sur specific LED code.
12 */
13
1da177e4
LT
14#include <asm/io.h>
15#include <asm/bigsur/bigsur.h>
16
17static void mach_led(int position, int value)
18{
19 int word;
20
21 word = bigsur_inl(BIGSUR_CSLR);
22 if (value) {
23 bigsur_outl(word & ~BIGSUR_LED, BIGSUR_CSLR);
24 } else {
25 bigsur_outl(word | BIGSUR_LED, BIGSUR_CSLR);
26 }
27}
28
29#ifdef CONFIG_HEARTBEAT
30
31#include <linux/sched.h>
32
33/* Cycle the LED on/off */
34void heartbeat_bigsur(void)
35{
36 static unsigned cnt = 0, period = 0, dist = 0;
37
38 if (cnt == 0 || cnt == dist)
39 mach_led( -1, 1);
40 else if (cnt == 7 || cnt == dist+7)
41 mach_led( -1, 0);
42
43 if (++cnt > period) {
44 cnt = 0;
45 /* The hyperbolic function below modifies the heartbeat period
46 * length in dependency of the current (5min) load. It goes
47 * through the points f(0)=126, f(1)=86, f(5)=51,
48 * f(inf)->30. */
49 period = ((672<<FSHIFT)/(5*avenrun[0]+(7<<FSHIFT))) + 30;
50 dist = period / 4;
51 }
52}
53#endif /* CONFIG_HEARTBEAT */
54