aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-integrator/leds.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/arm/mach-integrator/leds.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/arm/mach-integrator/leds.c')
-rw-r--r--arch/arm/mach-integrator/leds.c88
1 files changed, 88 insertions, 0 deletions
diff --git a/arch/arm/mach-integrator/leds.c b/arch/arm/mach-integrator/leds.c
new file mode 100644
index 000000000000..9d182b77b312
--- /dev/null
+++ b/arch/arm/mach-integrator/leds.c
@@ -0,0 +1,88 @@
1/*
2 * linux/arch/arm/mach-integrator/leds.c
3 *
4 * Integrator/AP and Integrator/CP LED control routines
5 *
6 * Copyright (C) 1999 ARM Limited
7 * Copyright (C) 2000 Deep Blue Solutions Ltd
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23#include <linux/kernel.h>
24#include <linux/init.h>
25
26#include <asm/hardware.h>
27#include <asm/io.h>
28#include <asm/leds.h>
29#include <asm/system.h>
30#include <asm/mach-types.h>
31#include <asm/arch/cm.h>
32
33static int saved_leds;
34
35static void integrator_leds_event(led_event_t ledevt)
36{
37 unsigned long flags;
38 const unsigned int dbg_base = IO_ADDRESS(INTEGRATOR_DBG_BASE);
39 unsigned int update_alpha_leds;
40
41 // yup, change the LEDs
42 local_irq_save(flags);
43 update_alpha_leds = 0;
44
45 switch(ledevt) {
46 case led_idle_start:
47 cm_control(CM_CTRL_LED, 0);
48 break;
49
50 case led_idle_end:
51 cm_control(CM_CTRL_LED, CM_CTRL_LED);
52 break;
53
54 case led_timer:
55 saved_leds ^= GREEN_LED;
56 update_alpha_leds = 1;
57 break;
58
59 case led_red_on:
60 saved_leds |= RED_LED;
61 update_alpha_leds = 1;
62 break;
63
64 case led_red_off:
65 saved_leds &= ~RED_LED;
66 update_alpha_leds = 1;
67 break;
68
69 default:
70 break;
71 }
72
73 if (update_alpha_leds) {
74 while (__raw_readl(dbg_base + INTEGRATOR_DBG_ALPHA_OFFSET) & 1);
75 __raw_writel(saved_leds, dbg_base + INTEGRATOR_DBG_LEDS_OFFSET);
76 }
77 local_irq_restore(flags);
78}
79
80static int __init leds_init(void)
81{
82 if (machine_is_integrator() || machine_is_cintegrator())
83 leds_event = integrator_leds_event;
84
85 return 0;
86}
87
88__initcall(leds_init);