[PATCH] briq_panel: read() and write() get __user pointers, damnit
[linux-2.6/verdex.git] / arch / sh / boards / harp / led.c
blobaeb7b392b190bfe3c8371eace07b0a7eb7af65d3
1 /*
2 * linux/arch/sh/stboards/led.c
4 * Copyright (C) 2000 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 ST40STB1 HARP and compatible code.
12 #include <asm/io.h>
13 #include <asm/harp/harp.h>
15 /* Harp: Flash LD10 (front pannel) connected to EPLD (IC8) */
16 /* Overdrive: Flash LD1 (front panel) connected to EPLD (IC4) */
17 /* Works for HARP and overdrive */
18 static void mach_led(int position, int value)
20 if (value) {
21 ctrl_outl(EPLD_LED_ON, EPLD_LED);
22 } else {
23 ctrl_outl(EPLD_LED_OFF, EPLD_LED);
27 #ifdef CONFIG_HEARTBEAT
29 #include <linux/sched.h>
31 /* acts like an actual heart beat -- ie thump-thump-pause... */
32 void heartbeat_harp(void)
34 static unsigned cnt = 0, period = 0, dist = 0;
36 if (cnt == 0 || cnt == dist)
37 mach_led( -1, 1);
38 else if (cnt == 7 || cnt == dist+7)
39 mach_led( -1, 0);
41 if (++cnt > period) {
42 cnt = 0;
43 /* The hyperbolic function below modifies the heartbeat period
44 * length in dependency of the current (5min) load. It goes
45 * through the points f(0)=126, f(1)=86, f(5)=51,
46 * f(inf)->30. */
47 period = ((672<<FSHIFT)/(5*avenrun[0]+(7<<FSHIFT))) + 30;
48 dist = period / 4;
51 #endif