Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / sh / boards / mpc1211 / led.c
blob0a31beec3465f5633f42a88bb43806d607be77ce
1 /*
2 * linux/arch/sh/kernel/led_mpc1211.c
4 * Copyright (C) 2001 Saito.K & Jeanne
6 * This file contains Interface MPC-1211 specific LED code.
7 */
9 #include <linux/config.h>
11 static void mach_led(int position, int value)
13 volatile unsigned char* p = (volatile unsigned char*)0xa2000000;
15 if (value) {
16 *p |= 1;
17 } else {
18 *p &= ~1;
22 #ifdef CONFIG_HEARTBEAT
24 #include <linux/sched.h>
26 /* Cycle the LED's in the clasic Knightrider/Sun pattern */
27 void heartbeat_mpc1211(void)
29 static unsigned int cnt = 0, period = 0;
30 volatile unsigned char* p = (volatile unsigned char*)0xa2000000;
31 static unsigned bit = 0, up = 1;
33 cnt += 1;
34 if (cnt < period) {
35 return;
38 cnt = 0;
40 /* Go through the points (roughly!):
41 * f(0)=10, f(1)=16, f(2)=20, f(5)=35,f(inf)->110
43 period = 110 - ( (300<<FSHIFT)/
44 ((avenrun[0]/5) + (3<<FSHIFT)) );
46 if (up) {
47 if (bit == 7) {
48 bit--;
49 up=0;
50 } else {
51 bit ++;
53 } else {
54 if (bit == 0) {
55 bit++;
56 up=1;
57 } else {
58 bit--;
61 *p = 1<<bit;
64 #endif /* CONFIG_HEARTBEAT */