[TG3]: Set minimal hw interrupt mitigation.
[linux-2.6/verdex.git] / arch / sh / boards / overdrive / led.c
blob734742e92279e4c7cee51dd1ae857ba2e84b2e80
1 /*
2 * linux/arch/sh/overdrive/led.c
4 * Copyright (C) 1999 Stuart Menefy <stuart.menefy@st.com>
6 * May be copied or modified under the terms of the GNU General Public
7 * License. See linux/COPYING for more information.
9 * This file contains an Overdrive specific LED feature.
12 #include <linux/config.h>
13 #include <asm/system.h>
14 #include <asm/io.h>
15 #include <asm/overdrive/overdrive.h>
17 static void mach_led(int position, int value)
19 unsigned long flags;
20 unsigned long reg;
22 local_irq_save(flags);
24 reg = readl(OVERDRIVE_CTRL);
25 if (value) {
26 reg |= (1<<3);
27 } else {
28 reg &= ~(1<<3);
30 writel(reg, OVERDRIVE_CTRL);
32 local_irq_restore(flags);
35 #ifdef CONFIG_HEARTBEAT
37 #include <linux/sched.h>
39 /* acts like an actual heart beat -- ie thump-thump-pause... */
40 void heartbeat_od(void)
42 static unsigned cnt = 0, period = 0, dist = 0;
44 if (cnt == 0 || cnt == dist)
45 mach_led( -1, 1);
46 else if (cnt == 7 || cnt == dist+7)
47 mach_led( -1, 0);
49 if (++cnt > period) {
50 cnt = 0;
51 /* The hyperbolic function below modifies the heartbeat period
52 * length in dependency of the current (5min) load. It goes
53 * through the points f(0)=126, f(1)=86, f(5)=51,
54 * f(inf)->30. */
55 period = ((672<<FSHIFT)/(5*avenrun[0]+(7<<FSHIFT))) + 30;
56 dist = period / 4;
59 #endif /* CONFIG_HEARTBEAT */