diff options
author | Paul Mundt <lethal@linux-sh.org> | 2007-02-13 01:42:28 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2007-02-13 01:42:28 -0500 |
commit | 3b4d9539628502768fe7f8fd4b48f2fbf2426255 (patch) | |
tree | 2bc27b9b57ed3f768a40cedc7c44b95da4025526 /arch/sh/boards/se/73180 | |
parent | c7666e72cff1a2793055486340ac5f5137494c08 (diff) |
sh: heartbeat consolidation for banked LEDs.
This consolidates the various board heartbeat LED implementations,
used for strobing the load average across a LED bank. Those boards
not implementing a full bank can hook in via the LED class.
We leave the compat hook in the machvec for now until those non-banked
boards are able to migrate to the drivers/leds.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/boards/se/73180')
-rw-r--r-- | arch/sh/boards/se/73180/Makefile | 2 | ||||
-rw-r--r-- | arch/sh/boards/se/73180/led.c | 53 | ||||
-rw-r--r-- | arch/sh/boards/se/73180/setup.c | 31 |
3 files changed, 27 insertions, 59 deletions
diff --git a/arch/sh/boards/se/73180/Makefile b/arch/sh/boards/se/73180/Makefile index 8f63886a0f3f..e7c09967c529 100644 --- a/arch/sh/boards/se/73180/Makefile +++ b/arch/sh/boards/se/73180/Makefile | |||
@@ -3,5 +3,3 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := setup.o io.o irq.o | 5 | obj-y := setup.o io.o irq.o |
6 | |||
7 | obj-$(CONFIG_HEARTBEAT) += led.o | ||
diff --git a/arch/sh/boards/se/73180/led.c b/arch/sh/boards/se/73180/led.c deleted file mode 100644 index 4b72e9a3ead9..000000000000 --- a/arch/sh/boards/se/73180/led.c +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | /* | ||
2 | * arch/sh/boards/se/73180/led.c | ||
3 | * | ||
4 | * Derived from arch/sh/boards/se/770x/led.c | ||
5 | * | ||
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 Solution Engine specific LED code. | ||
12 | */ | ||
13 | |||
14 | #include <linux/sched.h> | ||
15 | #include <asm/mach/se73180.h> | ||
16 | |||
17 | /* Cycle the LED's in the clasic Knightrider/Sun pattern */ | ||
18 | void heartbeat_73180se(void) | ||
19 | { | ||
20 | static unsigned int cnt = 0, period = 0; | ||
21 | volatile unsigned short *p = (volatile unsigned short *) PA_LED; | ||
22 | static unsigned bit = 0, up = 1; | ||
23 | |||
24 | cnt += 1; | ||
25 | if (cnt < period) { | ||
26 | return; | ||
27 | } | ||
28 | |||
29 | cnt = 0; | ||
30 | |||
31 | /* Go through the points (roughly!): | ||
32 | * f(0)=10, f(1)=16, f(2)=20, f(5)=35,f(inf)->110 | ||
33 | */ | ||
34 | period = 110 - ((300 << FSHIFT) / ((avenrun[0] / 5) + (3 << FSHIFT))); | ||
35 | |||
36 | if (up) { | ||
37 | if (bit == 7) { | ||
38 | bit--; | ||
39 | up = 0; | ||
40 | } else { | ||
41 | bit++; | ||
42 | } | ||
43 | } else { | ||
44 | if (bit == 0) { | ||
45 | bit++; | ||
46 | up = 1; | ||
47 | } else { | ||
48 | bit--; | ||
49 | } | ||
50 | } | ||
51 | *p = 1 << (bit + LED_SHIFT); | ||
52 | |||
53 | } | ||
diff --git a/arch/sh/boards/se/73180/setup.c b/arch/sh/boards/se/73180/setup.c index b38ef50a160a..911ce1cdbd7f 100644 --- a/arch/sh/boards/se/73180/setup.c +++ b/arch/sh/boards/se/73180/setup.c | |||
@@ -10,13 +10,39 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/platform_device.h> | ||
13 | #include <asm/machvec.h> | 14 | #include <asm/machvec.h> |
14 | #include <asm/se73180.h> | 15 | #include <asm/se73180.h> |
15 | #include <asm/irq.h> | 16 | #include <asm/irq.h> |
16 | 17 | ||
17 | void heartbeat_73180se(void); | ||
18 | void init_73180se_IRQ(void); | 18 | void init_73180se_IRQ(void); |
19 | 19 | ||
20 | static struct resource heartbeat_resources[] = { | ||
21 | [0] = { | ||
22 | .start = PA_LED, | ||
23 | .end = PA_LED + 8 - 1, | ||
24 | .flags = IORESOURCE_MEM, | ||
25 | }, | ||
26 | }; | ||
27 | |||
28 | static struct platform_device heartbeat_device = { | ||
29 | .name = "heartbeat", | ||
30 | .id = -1, | ||
31 | .num_resources = ARRAY_SIZE(heartbeat_resources), | ||
32 | .resource = heartbeat_resources, | ||
33 | }; | ||
34 | |||
35 | static struct platform_device *se73180_devices[] __initdata = { | ||
36 | &heartbeat_device, | ||
37 | }; | ||
38 | |||
39 | static int __init se73180_devices_setup(void) | ||
40 | { | ||
41 | return platform_add_devices(sh7343se_platform_devices, | ||
42 | ARRAY_SIZE(sh7343se_platform_devices)); | ||
43 | } | ||
44 | __initcall(se73180_devices_setup); | ||
45 | |||
20 | /* | 46 | /* |
21 | * The Machine Vector | 47 | * The Machine Vector |
22 | */ | 48 | */ |
@@ -46,8 +72,5 @@ struct sh_machine_vector mv_73180se __initmv = { | |||
46 | 72 | ||
47 | .mv_init_irq = init_73180se_IRQ, | 73 | .mv_init_irq = init_73180se_IRQ, |
48 | .mv_irq_demux = shmse_irq_demux, | 74 | .mv_irq_demux = shmse_irq_demux, |
49 | #ifdef CONFIG_HEARTBEAT | ||
50 | .mv_heartbeat = heartbeat_73180se, | ||
51 | #endif | ||
52 | }; | 75 | }; |
53 | ALIAS_MV(73180se) | 76 | ALIAS_MV(73180se) |