diff options
author | Bryan Wu <bryan.wu@canonical.com> | 2012-03-13 14:26:56 -0400 |
---|---|---|
committer | Bryan Wu <bryan.wu@canonical.com> | 2012-07-31 23:22:14 -0400 |
commit | fa8bbb13ab49e77c00fa09e5504ec25b7176fb4b (patch) | |
tree | 33bea9e45b5a7ba6c68a861f7ea94446d9d0f497 /arch | |
parent | 18775a7bea8fbbebe8818db7a64aaeb40b40a0c5 (diff) |
ARM: use new LEDS CPU trigger stub to replace old one
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/Kconfig | 53 | ||||
-rw-r--r-- | arch/arm/include/asm/leds.h | 50 | ||||
-rw-r--r-- | arch/arm/kernel/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/kernel/leds.c | 121 | ||||
-rw-r--r-- | arch/arm/kernel/process.c | 6 | ||||
-rw-r--r-- | arch/arm/kernel/time.c | 17 |
6 files changed, 3 insertions, 245 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index a91009c61870..dc57d3792359 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -1739,59 +1739,6 @@ config FORCE_MAX_ZONEORDER | |||
1739 | This config option is actually maximum order plus one. For example, | 1739 | This config option is actually maximum order plus one. For example, |
1740 | a value of 11 means that the largest free memory block is 2^10 pages. | 1740 | a value of 11 means that the largest free memory block is 2^10 pages. |
1741 | 1741 | ||
1742 | config LEDS | ||
1743 | bool "Timer and CPU usage LEDs" | ||
1744 | depends on ARCH_CDB89712 || ARCH_EBSA110 || \ | ||
1745 | ARCH_EBSA285 || ARCH_INTEGRATOR || \ | ||
1746 | ARCH_LUBBOCK || MACH_MAINSTONE || ARCH_NETWINDER || \ | ||
1747 | ARCH_OMAP || ARCH_P720T || ARCH_PXA_IDP || \ | ||
1748 | ARCH_SA1100 || ARCH_SHARK || ARCH_VERSATILE || \ | ||
1749 | ARCH_AT91 || ARCH_DAVINCI || \ | ||
1750 | ARCH_KS8695 || MACH_RD88F5182 || ARCH_REALVIEW | ||
1751 | help | ||
1752 | If you say Y here, the LEDs on your machine will be used | ||
1753 | to provide useful information about your current system status. | ||
1754 | |||
1755 | If you are compiling a kernel for a NetWinder or EBSA-285, you will | ||
1756 | be able to select which LEDs are active using the options below. If | ||
1757 | you are compiling a kernel for the EBSA-110 or the LART however, the | ||
1758 | red LED will simply flash regularly to indicate that the system is | ||
1759 | still functional. It is safe to say Y here if you have a CATS | ||
1760 | system, but the driver will do nothing. | ||
1761 | |||
1762 | config LEDS_TIMER | ||
1763 | bool "Timer LED" if (!ARCH_CDB89712 && !ARCH_OMAP) || \ | ||
1764 | OMAP_OSK_MISTRAL || MACH_OMAP_H2 \ | ||
1765 | || MACH_OMAP_PERSEUS2 | ||
1766 | depends on LEDS | ||
1767 | depends on !GENERIC_CLOCKEVENTS | ||
1768 | default y if ARCH_EBSA110 | ||
1769 | help | ||
1770 | If you say Y here, one of the system LEDs (the green one on the | ||
1771 | NetWinder, the amber one on the EBSA285, or the red one on the LART) | ||
1772 | will flash regularly to indicate that the system is still | ||
1773 | operational. This is mainly useful to kernel hackers who are | ||
1774 | debugging unstable kernels. | ||
1775 | |||
1776 | The LART uses the same LED for both Timer LED and CPU usage LED | ||
1777 | functions. You may choose to use both, but the Timer LED function | ||
1778 | will overrule the CPU usage LED. | ||
1779 | |||
1780 | config LEDS_CPU | ||
1781 | bool "CPU usage LED" if (!ARCH_CDB89712 && !ARCH_EBSA110 && \ | ||
1782 | !ARCH_OMAP) \ | ||
1783 | || OMAP_OSK_MISTRAL || MACH_OMAP_H2 \ | ||
1784 | || MACH_OMAP_PERSEUS2 | ||
1785 | depends on LEDS | ||
1786 | help | ||
1787 | If you say Y here, the red LED will be used to give a good real | ||
1788 | time indication of CPU usage, by lighting whenever the idle task | ||
1789 | is not currently executing. | ||
1790 | |||
1791 | The LART uses the same LED for both Timer LED and CPU usage LED | ||
1792 | functions. You may choose to use both, but the Timer LED function | ||
1793 | will overrule the CPU usage LED. | ||
1794 | |||
1795 | config ALIGNMENT_TRAP | 1742 | config ALIGNMENT_TRAP |
1796 | bool | 1743 | bool |
1797 | depends on CPU_CP15_MMU | 1744 | depends on CPU_CP15_MMU |
diff --git a/arch/arm/include/asm/leds.h b/arch/arm/include/asm/leds.h deleted file mode 100644 index c545739f39b7..000000000000 --- a/arch/arm/include/asm/leds.h +++ /dev/null | |||
@@ -1,50 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/include/asm/leds.h | ||
3 | * | ||
4 | * Copyright (C) 1998 Russell King | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * Event-driven interface for LEDs on machines | ||
11 | * Added led_start and led_stop- Alex Holden, 28th Dec 1998. | ||
12 | */ | ||
13 | #ifndef ASM_ARM_LEDS_H | ||
14 | #define ASM_ARM_LEDS_H | ||
15 | |||
16 | |||
17 | typedef enum { | ||
18 | led_idle_start, | ||
19 | led_idle_end, | ||
20 | led_timer, | ||
21 | led_start, | ||
22 | led_stop, | ||
23 | led_claim, /* override idle & timer leds */ | ||
24 | led_release, /* restore idle & timer leds */ | ||
25 | led_start_timer_mode, | ||
26 | led_stop_timer_mode, | ||
27 | led_green_on, | ||
28 | led_green_off, | ||
29 | led_amber_on, | ||
30 | led_amber_off, | ||
31 | led_red_on, | ||
32 | led_red_off, | ||
33 | led_blue_on, | ||
34 | led_blue_off, | ||
35 | /* | ||
36 | * I want this between led_timer and led_start, but | ||
37 | * someone has decided to export this to user space | ||
38 | */ | ||
39 | led_halted | ||
40 | } led_event_t; | ||
41 | |||
42 | /* Use this routine to handle LEDs */ | ||
43 | |||
44 | #ifdef CONFIG_LEDS | ||
45 | extern void (*leds_event)(led_event_t); | ||
46 | #else | ||
47 | #define leds_event(e) | ||
48 | #endif | ||
49 | |||
50 | #endif | ||
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile index 7ad2d5cf7008..8951577c4ced 100644 --- a/arch/arm/kernel/Makefile +++ b/arch/arm/kernel/Makefile | |||
@@ -21,7 +21,6 @@ obj-y := elf.o entry-armv.o entry-common.o irq.o opcodes.o \ | |||
21 | 21 | ||
22 | obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += compat.o | 22 | obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += compat.o |
23 | 23 | ||
24 | obj-$(CONFIG_LEDS) += leds.o | ||
25 | obj-$(CONFIG_OC_ETM) += etm.o | 24 | obj-$(CONFIG_OC_ETM) += etm.o |
26 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o | 25 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o |
27 | obj-$(CONFIG_ISA_DMA_API) += dma.o | 26 | obj-$(CONFIG_ISA_DMA_API) += dma.o |
diff --git a/arch/arm/kernel/leds.c b/arch/arm/kernel/leds.c deleted file mode 100644 index 1911dae19e4f..000000000000 --- a/arch/arm/kernel/leds.c +++ /dev/null | |||
@@ -1,121 +0,0 @@ | |||
1 | /* | ||
2 | * LED support code, ripped out of arch/arm/kernel/time.c | ||
3 | * | ||
4 | * Copyright (C) 1994-2001 Russell King | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | #include <linux/export.h> | ||
11 | #include <linux/init.h> | ||
12 | #include <linux/device.h> | ||
13 | #include <linux/syscore_ops.h> | ||
14 | #include <linux/string.h> | ||
15 | |||
16 | #include <asm/leds.h> | ||
17 | |||
18 | static void dummy_leds_event(led_event_t evt) | ||
19 | { | ||
20 | } | ||
21 | |||
22 | void (*leds_event)(led_event_t) = dummy_leds_event; | ||
23 | |||
24 | struct leds_evt_name { | ||
25 | const char name[8]; | ||
26 | int on; | ||
27 | int off; | ||
28 | }; | ||
29 | |||
30 | static const struct leds_evt_name evt_names[] = { | ||
31 | { "amber", led_amber_on, led_amber_off }, | ||
32 | { "blue", led_blue_on, led_blue_off }, | ||
33 | { "green", led_green_on, led_green_off }, | ||
34 | { "red", led_red_on, led_red_off }, | ||
35 | }; | ||
36 | |||
37 | static ssize_t leds_store(struct device *dev, | ||
38 | struct device_attribute *attr, | ||
39 | const char *buf, size_t size) | ||
40 | { | ||
41 | int ret = -EINVAL, len = strcspn(buf, " "); | ||
42 | |||
43 | if (len > 0 && buf[len] == '\0') | ||
44 | len--; | ||
45 | |||
46 | if (strncmp(buf, "claim", len) == 0) { | ||
47 | leds_event(led_claim); | ||
48 | ret = size; | ||
49 | } else if (strncmp(buf, "release", len) == 0) { | ||
50 | leds_event(led_release); | ||
51 | ret = size; | ||
52 | } else { | ||
53 | int i; | ||
54 | |||
55 | for (i = 0; i < ARRAY_SIZE(evt_names); i++) { | ||
56 | if (strlen(evt_names[i].name) != len || | ||
57 | strncmp(buf, evt_names[i].name, len) != 0) | ||
58 | continue; | ||
59 | if (strncmp(buf+len, " on", 3) == 0) { | ||
60 | leds_event(evt_names[i].on); | ||
61 | ret = size; | ||
62 | } else if (strncmp(buf+len, " off", 4) == 0) { | ||
63 | leds_event(evt_names[i].off); | ||
64 | ret = size; | ||
65 | } | ||
66 | break; | ||
67 | } | ||
68 | } | ||
69 | return ret; | ||
70 | } | ||
71 | |||
72 | static DEVICE_ATTR(event, 0200, NULL, leds_store); | ||
73 | |||
74 | static struct bus_type leds_subsys = { | ||
75 | .name = "leds", | ||
76 | .dev_name = "leds", | ||
77 | }; | ||
78 | |||
79 | static struct device leds_device = { | ||
80 | .id = 0, | ||
81 | .bus = &leds_subsys, | ||
82 | }; | ||
83 | |||
84 | static int leds_suspend(void) | ||
85 | { | ||
86 | leds_event(led_stop); | ||
87 | return 0; | ||
88 | } | ||
89 | |||
90 | static void leds_resume(void) | ||
91 | { | ||
92 | leds_event(led_start); | ||
93 | } | ||
94 | |||
95 | static void leds_shutdown(void) | ||
96 | { | ||
97 | leds_event(led_halted); | ||
98 | } | ||
99 | |||
100 | static struct syscore_ops leds_syscore_ops = { | ||
101 | .shutdown = leds_shutdown, | ||
102 | .suspend = leds_suspend, | ||
103 | .resume = leds_resume, | ||
104 | }; | ||
105 | |||
106 | static int __init leds_init(void) | ||
107 | { | ||
108 | int ret; | ||
109 | ret = subsys_system_register(&leds_subsys, NULL); | ||
110 | if (ret == 0) | ||
111 | ret = device_register(&leds_device); | ||
112 | if (ret == 0) | ||
113 | ret = device_create_file(&leds_device, &dev_attr_event); | ||
114 | if (ret == 0) | ||
115 | register_syscore_ops(&leds_syscore_ops); | ||
116 | return ret; | ||
117 | } | ||
118 | |||
119 | device_initcall(leds_init); | ||
120 | |||
121 | EXPORT_SYMBOL(leds_event); | ||
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 19c95ea65b2f..864580af1678 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c | |||
@@ -31,9 +31,9 @@ | |||
31 | #include <linux/random.h> | 31 | #include <linux/random.h> |
32 | #include <linux/hw_breakpoint.h> | 32 | #include <linux/hw_breakpoint.h> |
33 | #include <linux/cpuidle.h> | 33 | #include <linux/cpuidle.h> |
34 | #include <linux/leds.h> | ||
34 | 35 | ||
35 | #include <asm/cacheflush.h> | 36 | #include <asm/cacheflush.h> |
36 | #include <asm/leds.h> | ||
37 | #include <asm/processor.h> | 37 | #include <asm/processor.h> |
38 | #include <asm/thread_notify.h> | 38 | #include <asm/thread_notify.h> |
39 | #include <asm/stacktrace.h> | 39 | #include <asm/stacktrace.h> |
@@ -189,7 +189,7 @@ void cpu_idle(void) | |||
189 | while (1) { | 189 | while (1) { |
190 | tick_nohz_idle_enter(); | 190 | tick_nohz_idle_enter(); |
191 | rcu_idle_enter(); | 191 | rcu_idle_enter(); |
192 | leds_event(led_idle_start); | 192 | ledtrig_cpu(CPU_LED_IDLE_START); |
193 | while (!need_resched()) { | 193 | while (!need_resched()) { |
194 | #ifdef CONFIG_HOTPLUG_CPU | 194 | #ifdef CONFIG_HOTPLUG_CPU |
195 | if (cpu_is_offline(smp_processor_id())) | 195 | if (cpu_is_offline(smp_processor_id())) |
@@ -220,7 +220,7 @@ void cpu_idle(void) | |||
220 | } else | 220 | } else |
221 | local_irq_enable(); | 221 | local_irq_enable(); |
222 | } | 222 | } |
223 | leds_event(led_idle_end); | 223 | ledtrig_cpu(CPU_LED_IDLE_END); |
224 | rcu_idle_exit(); | 224 | rcu_idle_exit(); |
225 | tick_nohz_idle_exit(); | 225 | tick_nohz_idle_exit(); |
226 | schedule_preempt_disabled(); | 226 | schedule_preempt_disabled(); |
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c index af2afb019672..09be0c3c9069 100644 --- a/arch/arm/kernel/time.c +++ b/arch/arm/kernel/time.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/timer.h> | 25 | #include <linux/timer.h> |
26 | #include <linux/irq.h> | 26 | #include <linux/irq.h> |
27 | 27 | ||
28 | #include <asm/leds.h> | ||
29 | #include <asm/thread_info.h> | 28 | #include <asm/thread_info.h> |
30 | #include <asm/sched_clock.h> | 29 | #include <asm/sched_clock.h> |
31 | #include <asm/stacktrace.h> | 30 | #include <asm/stacktrace.h> |
@@ -80,21 +79,6 @@ u32 arch_gettimeoffset(void) | |||
80 | } | 79 | } |
81 | #endif /* CONFIG_ARCH_USES_GETTIMEOFFSET */ | 80 | #endif /* CONFIG_ARCH_USES_GETTIMEOFFSET */ |
82 | 81 | ||
83 | #ifdef CONFIG_LEDS_TIMER | ||
84 | static inline void do_leds(void) | ||
85 | { | ||
86 | static unsigned int count = HZ/2; | ||
87 | |||
88 | if (--count == 0) { | ||
89 | count = HZ/2; | ||
90 | leds_event(led_timer); | ||
91 | } | ||
92 | } | ||
93 | #else | ||
94 | #define do_leds() | ||
95 | #endif | ||
96 | |||
97 | |||
98 | #ifndef CONFIG_GENERIC_CLOCKEVENTS | 82 | #ifndef CONFIG_GENERIC_CLOCKEVENTS |
99 | /* | 83 | /* |
100 | * Kernel system timer support. | 84 | * Kernel system timer support. |
@@ -102,7 +86,6 @@ static inline void do_leds(void) | |||
102 | void timer_tick(void) | 86 | void timer_tick(void) |
103 | { | 87 | { |
104 | profile_tick(CPU_PROFILING); | 88 | profile_tick(CPU_PROFILING); |
105 | do_leds(); | ||
106 | xtime_update(1); | 89 | xtime_update(1); |
107 | #ifndef CONFIG_SMP | 90 | #ifndef CONFIG_SMP |
108 | update_process_times(user_mode(get_irq_regs())); | 91 | update_process_times(user_mode(get_irq_regs())); |