diff options
author | Arnd Bergmann <arnd@arndb.de> | 2012-08-13 10:45:48 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2012-08-13 10:45:48 -0400 |
commit | 19e4ab54e7f5fe46a3c931afa7e786f11d57b558 (patch) | |
tree | aeada0b9d0800b94cb795020a856c625ddc4f41c /arch/arm/kernel | |
parent | 0d7614f09c1ebdbaa1599a5aba7593f147bf96ee (diff) | |
parent | fa8bbb13ab49e77c00fa09e5504ec25b7176fb4b (diff) |
Merge branch 'for-arm-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds into next/drivers
From Bryan Wu <bryan.wu@canonical.com>:
Based on Linus Walleij's ARM LED consolidation work, this patchset introduce a
new generic led trigger for CPU not only for ARM but also for others.
For enabling CPU idle event, CPU arch code should call ledtrig_cpu() stub to
trigger idle start or idle end event.
These patches convert old style LED driver in arch/arm to gpio_led or new led
driver interface. Against 3.5 release and build successfully for all the machines.
Test ledtrig-cpu driver on OMAP4 Panda board.
v9 --> v10
* fix compiling issue on versatile_defconfig reported by Russell King
* rebase to 3.5 kernel and move patches to new git tree
v8 --> v9:
* use mutex to replace rw_sema pointed out by Tim Gardner
* add a new struct led_trigger_cpu
* add lock_is_inited to record mutex lock initialization
v6 --> v7:
* add a patch to unify the led-trigger name
* fix some typo pointed
* use BUG_ON to detect CPU numbers during building stage
v5 --> v6:
* replace __get_cpu_var() to per_cpu()
* remove smp_processor_id() which is wrong with for_each_possible_cpu()
* test on real OMAP4 Panda board
* add comments about CPU hotplug in the CPU LED trigger driver
v4 --> v5:
* rebase all the patches on top of latest linux-next
* replace on_each_cpu() with for_each_possible_cpu()
* add some description of ledtrig_cpu() API
* remove old leds code from driver nwflash.c, which should use a new led trigger then
* this trigger driver can be built as module now
v3 --> v4:
* fix a typo pointed by Jochen Friedrich
* fix some building errors
* add Reviewed-by and Tested-by into patch log
v2 --> v3:
* almost rewrote the whole ledtrig-cpu driver, which is more simple
* every CPU will have a per-CPU trigger
* cpu trigger can be assigned to any leds
* fix a lockdep issue in led-trigger common code
* other fix according to review
v1 --> v2:
* remove select operations in Kconfig of every machines
* add back supporting of led in core module of mach-integrator
* solidate name scheme in ledtrig-cpu.c
* add comments of CPU_LED_* cpu led events
* fold patches of RealView and Versatile together
* add machine_is_ check during assabet led driver init
* add some Acked-by in patch logs
* remove code for simpad machine in machine-sa11000, since Jochen Friedrich
introduced gpiolib and gpio-led driver for simpad
* on Assabet and Netwinder machine, LED operations is reversed like:
setting bit means turn off leds
clearing bit means turn on leds
* add a new function to read CM_CTRL register for led driver
* 'for-arm-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds:
ARM: use new LEDS CPU trigger stub to replace old one
ARM: mach-sa1100: retire custom LED code
ARM: mach-omap1: retire custom LED code
ARM: mach-pnx4008: remove including old leds event API header file
ARM: plat-samsung: remove including old leds event API header file
ARM: mach-pxa: retire custom LED code
char: nwflash: remove old led event code
ARM: mach-footbridge: retire custom LED code
ARM: mach-ebsa110: retire custom LED code
ARM: mach-clps711x: retire custom LED code of P720T machine
ARM: mach-integrator: retire custom LED code
ARM: mach-integrator: move CM_CTRL to header file for accessing by other functions
ARM: mach-orion5x: convert custom LED code to gpio_led and LED CPU trigger
ARM: mach-shark: retire custom LED code
ARM: mach-ks8695: remove leds driver, since nobody use it
ARM: mach-realview and mach-versatile: retire custom LED code
ARM: at91: convert old leds drivers to gpio_led and led_trigger drivers
led-triggers: create a trigger for CPU activity
Conflicts:
arch/arm/mach-clps711x/p720t.c
arch/arm/mach-sa1100/leds-cerf.c
arch/arm/mach-sa1100/leds-lart.c
Let's hope this is the last time we pull this and it doesn't cause
more trouble. I have verified that version 10 causes no build
warnings or errors any more, and the patches still look good.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/arm/kernel')
-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 |
4 files changed, 3 insertions, 142 deletions
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 693b744fd572..04eea22d7958 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())); |