linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Introduce a led trigger for CPU activity
@ 2011-06-25 22:10 Bryan Wu
  2011-06-25 22:10 ` [PATCH 1/4] leds: create a " Bryan Wu
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Bryan Wu @ 2011-06-25 22:10 UTC (permalink / raw)
  To: linux-arm-kernel

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 4 patches is against 3.0-rc4 and build successfully for versatile and
realview.

Bryan Wu (2):
  leds: create a trigger for CPU activity
  ARM: use new LEDS CPU trigger stub to replace old one

Linus Walleij (2):
  mach-realview: retire custom LED code
  mach-versatile: retire custom LED code

 arch/arm/kernel/process.c                |    6 +-
 arch/arm/mach-realview/core.c            |   39 --------
 arch/arm/mach-realview/core.h            |    2 -
 arch/arm/mach-realview/realview_eb.c     |    4 -
 arch/arm/mach-realview/realview_pb1176.c |    4 -
 arch/arm/mach-realview/realview_pb11mp.c |    4 -
 arch/arm/mach-realview/realview_pba8.c   |    4 -
 arch/arm/mach-realview/realview_pbx.c    |    4 -
 arch/arm/mach-versatile/core.c           |   42 ---------
 arch/arm/plat-versatile/Kconfig          |    6 +-
 arch/arm/plat-versatile/leds.c           |   13 ++-
 drivers/leds/Kconfig                     |   10 ++
 drivers/leds/Makefile                    |    1 +
 drivers/leds/ledtrig-cpu.c               |  145 ++++++++++++++++++++++++++++++
 include/linux/leds.h                     |   15 +++
 15 files changed, 188 insertions(+), 111 deletions(-)
 create mode 100644 drivers/leds/ledtrig-cpu.c

-- 
1.7.4.1

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/4] leds: create a trigger for CPU activity
  2011-06-25 22:10 [PATCH 0/4] Introduce a led trigger for CPU activity Bryan Wu
@ 2011-06-25 22:10 ` Bryan Wu
  2011-06-25 22:10 ` [PATCH 2/4] ARM: use new LEDS CPU trigger stub to replace old one Bryan Wu
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Bryan Wu @ 2011-06-25 22:10 UTC (permalink / raw)
  To: linux-arm-kernel

Attempting to consolidate the ARM LED code, this removes the
custom RealView LED trigger code to turn LEDs on and off in
response to CPU activity and replace it with a standard trigger.

(bryan.wu at canonical.com:
It moves arch/arm/kernel/leds.c syscore stubs into this trigger.
It also provides ledtrig_cpu trigger event stub in <linux/leds.h>.
Although it was inspired by ARM work, it can be used in other arch.)

Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
---
 drivers/leds/Kconfig       |   10 +++
 drivers/leds/Makefile      |    1 +
 drivers/leds/ledtrig-cpu.c |  145 ++++++++++++++++++++++++++++++++++++++++++++
 include/linux/leds.h       |   15 +++++
 4 files changed, 171 insertions(+), 0 deletions(-)
 create mode 100644 drivers/leds/ledtrig-cpu.c

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index 713d43b..186000a 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -446,6 +446,16 @@ config LEDS_TRIGGER_BACKLIGHT
 
 	  If unsure, say N.
 
+config LEDS_TRIGGER_CPU
+	bool "LED CPU Trigger"
+	depends on LEDS_TRIGGERS
+	help
+	  This allows LEDs to be controlled by active CPUs. This shows
+	  the active CPUs across an array of LEDs so you can see what
+	  CPUs are active on the system at any given moment.
+
+	  If unsure, say N.
+
 config LEDS_TRIGGER_GPIO
 	tristate "LED GPIO Trigger"
 	depends on LEDS_TRIGGERS
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index bbfd2e3..5e70d2e 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -53,4 +53,5 @@ obj-$(CONFIG_LEDS_TRIGGER_IDE_DISK)	+= ledtrig-ide-disk.o
 obj-$(CONFIG_LEDS_TRIGGER_HEARTBEAT)	+= ledtrig-heartbeat.o
 obj-$(CONFIG_LEDS_TRIGGER_BACKLIGHT)	+= ledtrig-backlight.o
 obj-$(CONFIG_LEDS_TRIGGER_GPIO)		+= ledtrig-gpio.o
+obj-$(CONFIG_LEDS_TRIGGER_CPU)		+= ledtrig-cpu.o
 obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON)	+= ledtrig-default-on.o
diff --git a/drivers/leds/ledtrig-cpu.c b/drivers/leds/ledtrig-cpu.c
new file mode 100644
index 0000000..b0a89fd
--- /dev/null
+++ b/drivers/leds/ledtrig-cpu.c
@@ -0,0 +1,145 @@
+/*
+ * ledtrig-cpu.c - LED trigger based on CPU activity
+ *
+ * Copyright 2011 Linus Walleij <linus.walleij@linaro.org>
+ * Copyright 2011 Bryan Wu <bryan.wu@canonical.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/percpu.h>
+#include <linux/syscore_ops.h>
+#include "leds.h"
+
+struct cpu_trig_data {
+	struct led_classdev *led;
+};
+
+static DEFINE_PER_CPU(struct cpu_trig_data *, cpu_triggers);
+
+void ledtrig_cpu(enum cpu_led_event ledevt)
+{
+	struct cpu_trig_data *trigdata = __get_cpu_var(cpu_triggers);
+
+	if (!trigdata)
+		return;
+
+	/* Locate the correct CPU LED */
+
+	switch (ledevt) {
+	case CPU_LED_START:
+	case CPU_LED_IDLE_START:
+		/* Will turn the LED on, max brightness */
+		if (trigdata->led)
+			led_set_brightness(trigdata->led,
+					   trigdata->led->max_brightness);
+		break;
+
+	case CPU_LED_STOP:
+	case CPU_LED_IDLE_END:
+	case CPU_LED_HALTED:
+		/* Will turn the LED off */
+		if (trigdata->led)
+			led_set_brightness(trigdata->led, LED_OFF);
+		break;
+
+	default:
+		/* Will leave the LED as it is */
+		break;
+	}
+}
+EXPORT_SYMBOL(ledtrig_cpu);
+
+static void cpu_trig_activate_cpu(void *data)
+{
+	struct cpu_trig_data *cpu_data;
+	struct led_classdev *led = data;
+	int my_cpu = smp_processor_id();
+	unsigned long target_cpu = (unsigned long) led->trigger_data;
+
+	if (target_cpu != my_cpu)
+		return;
+
+	cpu_data = kzalloc(sizeof(*cpu_data), GFP_KERNEL);
+	if (!cpu_data)
+		return;
+
+	dev_info(led->dev, "led %s indicate activity on CPU %d\n",
+		 led->name, my_cpu);
+
+	cpu_data->led = led;
+	__get_cpu_var(cpu_triggers) = cpu_data;
+}
+
+static void cpu_trig_activate(struct led_classdev *led)
+{
+	on_each_cpu(cpu_trig_activate_cpu, led, 1);
+}
+
+static void cpu_trig_deactivate(struct led_classdev *led)
+{
+	struct cpu_trig_data *cpu_data = led->trigger_data;
+
+	if (cpu_data)
+		kfree(cpu_data);
+}
+
+static struct led_trigger cpu_led_trigger = {
+	.name		= "cpu",
+	.activate	= cpu_trig_activate,
+	.deactivate	= cpu_trig_deactivate,
+};
+
+
+static int cpu_syscore_suspend(void)
+{
+	ledtrig_cpu(CPU_LED_STOP);
+	return 0;
+}
+
+static void cpu_syscore_resume(void)
+{
+	ledtrig_cpu(CPU_LED_START);
+}
+
+static void cpu_syscore_shutdown(void)
+{
+	ledtrig_cpu(CPU_LED_HALTED);
+}
+
+static struct syscore_ops cpu_syscore_ops = {
+	.shutdown	= cpu_syscore_shutdown,
+	.suspend	= cpu_syscore_suspend,
+	.resume		= cpu_syscore_resume,
+};
+
+static int __init cpu_trig_init(void)
+{
+	int ret;
+
+	ret = led_trigger_register(&cpu_led_trigger);
+	if (!ret)
+		register_syscore_ops(&cpu_syscore_ops);
+
+	return ret;
+}
+module_init(cpu_trig_init);
+
+static void __exit cpu_trig_exit(void)
+{
+	unregister_syscore_ops(&cpu_syscore_ops);
+	led_trigger_unregister(&cpu_led_trigger);
+}
+module_exit(cpu_trig_exit);
+
+MODULE_AUTHOR("Linus Walleij <linus.walleij@linaro.org>");
+MODULE_AUTHOR("Bryan Wu <bryan.wu@canonical.com>");
+MODULE_DESCRIPTION("CPU LED trigger");
+MODULE_LICENSE("GPL");
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 5884def..d9e0ebc 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -210,4 +210,19 @@ struct gpio_led_platform_data {
 struct platform_device *gpio_led_register_device(
 		int id, const struct gpio_led_platform_data *pdata);
 
+#ifdef CONFIG_LEDS_TRIGGER_CPU
+enum cpu_led_event {
+	CPU_LED_IDLE_START,
+	CPU_LED_IDLE_END,
+	CPU_LED_START,
+	CPU_LED_STOP,
+	CPU_LED_HALTED
+};
+
+/* Use this routine to handle LEDs */
+extern void ledtrig_cpu(enum cpu_led_event evt);
+#else
+#define ledtrig_cpu() do {} while(0)
+#endif
+
 #endif		/* __LINUX_LEDS_H_INCLUDED */
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/4] ARM: use new LEDS CPU trigger stub to replace old one
  2011-06-25 22:10 [PATCH 0/4] Introduce a led trigger for CPU activity Bryan Wu
  2011-06-25 22:10 ` [PATCH 1/4] leds: create a " Bryan Wu
@ 2011-06-25 22:10 ` Bryan Wu
  2011-06-26 11:08   ` Linus Walleij
  2011-06-25 22:10 ` [PATCH 3/4] mach-realview: retire custom LED code Bryan Wu
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Bryan Wu @ 2011-06-25 22:10 UTC (permalink / raw)
  To: linux-arm-kernel

Cc:  Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
---
 arch/arm/kernel/process.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 5e1e541..d3b70cc 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -30,9 +30,9 @@
 #include <linux/uaccess.h>
 #include <linux/random.h>
 #include <linux/hw_breakpoint.h>
+#include <linux/leds.h>
 
 #include <asm/cacheflush.h>
-#include <asm/leds.h>
 #include <asm/processor.h>
 #include <asm/system.h>
 #include <asm/thread_notify.h>
@@ -183,7 +183,7 @@ void cpu_idle(void)
 	/* endless idle loop with no priority at all */
 	while (1) {
 		tick_nohz_stop_sched_tick(1);
-		leds_event(led_idle_start);
+		ledtrig_cpu(CPU_LED_IDLE_START);
 		while (!need_resched()) {
 #ifdef CONFIG_HOTPLUG_CPU
 			if (cpu_is_offline(smp_processor_id()))
@@ -207,7 +207,7 @@ void cpu_idle(void)
 				local_irq_enable();
 			}
 		}
-		leds_event(led_idle_end);
+		ledtrig_cpu(CPU_LED_IDLE_END);
 		tick_nohz_restart_sched_tick();
 		preempt_enable_no_resched();
 		schedule();
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/4] mach-realview: retire custom LED code
  2011-06-25 22:10 [PATCH 0/4] Introduce a led trigger for CPU activity Bryan Wu
  2011-06-25 22:10 ` [PATCH 1/4] leds: create a " Bryan Wu
  2011-06-25 22:10 ` [PATCH 2/4] ARM: use new LEDS CPU trigger stub to replace old one Bryan Wu
@ 2011-06-25 22:10 ` Bryan Wu
  2011-06-26 11:10   ` Linus Walleij
  2011-06-25 22:10 ` [PATCH 4/4] mach-versatile: " Bryan Wu
  2011-06-26 11:02 ` [PATCH 0/4] Introduce a led trigger for CPU activity Linus Walleij
  4 siblings, 1 reply; 10+ messages in thread
From: Bryan Wu @ 2011-06-25 22:10 UTC (permalink / raw)
  To: linux-arm-kernel

From: Linus Walleij <linus.walleij@linaro.org>

This replaces the custom LED trigger code in mach-realview with
some overarching platform code for the plat-versatile family that
will lock down LEDs 2 thru 5 for CPU activity indication. The
day we have 8 core ARM systems the plat-versatile code will have
to become more elaborate.

Tested on RealView PB11MPCore by invoking four different CPU
hogs (yes > /dev/null&) and see the LEDs go on one at a time.
They all go off as the hogs are killed. Tested on the PB1176
as well - just one activity led (led 2) goes on and off with
CPU activity.

(bryan.wu at canonical.com: use ledtrig-cpu instead of ledtrig-arm-cpu)

Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
---
 arch/arm/mach-realview/core.c            |   39 ------------------------------
 arch/arm/mach-realview/core.h            |    2 -
 arch/arm/mach-realview/realview_eb.c     |    4 ---
 arch/arm/mach-realview/realview_pb1176.c |    4 ---
 arch/arm/mach-realview/realview_pb11mp.c |    4 ---
 arch/arm/mach-realview/realview_pba8.c   |    4 ---
 arch/arm/mach-realview/realview_pbx.c    |    4 ---
 arch/arm/plat-versatile/Kconfig          |    6 ++++-
 arch/arm/plat-versatile/leds.c           |   13 +++++++---
 9 files changed, 14 insertions(+), 66 deletions(-)

diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index 5c23450..3a12b6b 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -36,7 +36,6 @@
 #include <asm/system.h>
 #include <mach/hardware.h>
 #include <asm/irq.h>
-#include <asm/leds.h>
 #include <asm/mach-types.h>
 #include <asm/hardware/arm_timer.h>
 #include <asm/hardware/icst.h>
@@ -437,44 +436,6 @@ struct clcd_board clcd_plat_data = {
 	.remove		= versatile_clcd_remove_dma,
 };
 
-#ifdef CONFIG_LEDS
-#define VA_LEDS_BASE (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_LED_OFFSET)
-
-void realview_leds_event(led_event_t ledevt)
-{
-	unsigned long flags;
-	u32 val;
-	u32 led = 1 << smp_processor_id();
-
-	local_irq_save(flags);
-	val = readl(VA_LEDS_BASE);
-
-	switch (ledevt) {
-	case led_idle_start:
-		val = val & ~led;
-		break;
-
-	case led_idle_end:
-		val = val | led;
-		break;
-
-	case led_timer:
-		val = val ^ REALVIEW_SYS_LED7;
-		break;
-
-	case led_halted:
-		val = 0;
-		break;
-
-	default:
-		break;
-	}
-
-	writel(val, VA_LEDS_BASE);
-	local_irq_restore(flags);
-}
-#endif	/* CONFIG_LEDS */
-
 /*
  * Where is the timer (VA)?
  */
diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h
index 5c83d1e..47ee3bc 100644
--- a/arch/arm/mach-realview/core.h
+++ b/arch/arm/mach-realview/core.h
@@ -26,7 +26,6 @@
 #include <linux/io.h>
 
 #include <asm/setup.h>
-#include <asm/leds.h>
 
 #define AMBA_DEVICE(name,busid,base,plat)			\
 static struct amba_device name##_device = {			\
@@ -57,7 +56,6 @@ extern void __iomem *timer1_va_base;
 extern void __iomem *timer2_va_base;
 extern void __iomem *timer3_va_base;
 
-extern void realview_leds_event(led_event_t ledevt);
 extern void realview_timer_init(unsigned int timer_irq);
 extern int realview_flash_register(struct resource *res, u32 num);
 extern int realview_eth_register(const char *name, struct resource *res);
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c
index 10e75fa..2fb438a 100644
--- a/arch/arm/mach-realview/realview_eb.c
+++ b/arch/arm/mach-realview/realview_eb.c
@@ -30,7 +30,6 @@
 
 #include <mach/hardware.h>
 #include <asm/irq.h>
-#include <asm/leds.h>
 #include <asm/mach-types.h>
 #include <asm/pmu.h>
 #include <asm/pgtable.h>
@@ -455,9 +454,6 @@ static void __init realview_eb_init(void)
 		amba_device_register(d, &iomem_resource);
 	}
 
-#ifdef CONFIG_LEDS
-	leds_event = realview_leds_event;
-#endif
 	realview_reset = realview_eb_reset;
 }
 
diff --git a/arch/arm/mach-realview/realview_pb1176.c b/arch/arm/mach-realview/realview_pb1176.c
index eab6070..2e0350a 100644
--- a/arch/arm/mach-realview/realview_pb1176.c
+++ b/arch/arm/mach-realview/realview_pb1176.c
@@ -30,7 +30,6 @@
 
 #include <mach/hardware.h>
 #include <asm/irq.h>
-#include <asm/leds.h>
 #include <asm/mach-types.h>
 #include <asm/pmu.h>
 #include <asm/pgtable.h>
@@ -350,9 +349,6 @@ static void __init realview_pb1176_init(void)
 		amba_device_register(d, &iomem_resource);
 	}
 
-#ifdef CONFIG_LEDS
-	leds_event = realview_leds_event;
-#endif
 	realview_reset = realview_pb1176_reset;
 }
 
diff --git a/arch/arm/mach-realview/realview_pb11mp.c b/arch/arm/mach-realview/realview_pb11mp.c
index b2985fc..9dd929a 100644
--- a/arch/arm/mach-realview/realview_pb11mp.c
+++ b/arch/arm/mach-realview/realview_pb11mp.c
@@ -30,7 +30,6 @@
 
 #include <mach/hardware.h>
 #include <asm/irq.h>
-#include <asm/leds.h>
 #include <asm/mach-types.h>
 #include <asm/pmu.h>
 #include <asm/pgtable.h>
@@ -352,9 +351,6 @@ static void __init realview_pb11mp_init(void)
 		amba_device_register(d, &iomem_resource);
 	}
 
-#ifdef CONFIG_LEDS
-	leds_event = realview_leds_event;
-#endif
 	realview_reset = realview_pb11mp_reset;
 }
 
diff --git a/arch/arm/mach-realview/realview_pba8.c b/arch/arm/mach-realview/realview_pba8.c
index fb68665..d1bcd5f 100644
--- a/arch/arm/mach-realview/realview_pba8.c
+++ b/arch/arm/mach-realview/realview_pba8.c
@@ -29,7 +29,6 @@
 #include <linux/io.h>
 
 #include <asm/irq.h>
-#include <asm/leds.h>
 #include <asm/mach-types.h>
 #include <asm/pmu.h>
 #include <asm/pgtable.h>
@@ -302,9 +301,6 @@ static void __init realview_pba8_init(void)
 		amba_device_register(d, &iomem_resource);
 	}
 
-#ifdef CONFIG_LEDS
-	leds_event = realview_leds_event;
-#endif
 	realview_reset = realview_pba8_reset;
 }
 
diff --git a/arch/arm/mach-realview/realview_pbx.c b/arch/arm/mach-realview/realview_pbx.c
index 92ace2c..797a509 100644
--- a/arch/arm/mach-realview/realview_pbx.c
+++ b/arch/arm/mach-realview/realview_pbx.c
@@ -28,7 +28,6 @@
 #include <linux/io.h>
 
 #include <asm/irq.h>
-#include <asm/leds.h>
 #include <asm/mach-types.h>
 #include <asm/pmu.h>
 #include <asm/smp_twd.h>
@@ -385,9 +384,6 @@ static void __init realview_pbx_init(void)
 		amba_device_register(d, &iomem_resource);
 	}
 
-#ifdef CONFIG_LEDS
-	leds_event = realview_leds_event;
-#endif
 	realview_reset = realview_pbx_reset;
 }
 
diff --git a/arch/arm/plat-versatile/Kconfig b/arch/arm/plat-versatile/Kconfig
index 52353be..c600420 100644
--- a/arch/arm/plat-versatile/Kconfig
+++ b/arch/arm/plat-versatile/Kconfig
@@ -7,8 +7,12 @@ config PLAT_VERSATILE_FPGA_IRQ
 	bool
 
 config PLAT_VERSATILE_LEDS
-	def_bool y if LEDS_CLASS
+	def_bool y
 	depends on ARCH_REALVIEW || ARCH_VERSATILE
+	select NEW_LEDS
+	select LEDS_CLASS
+	select LEDS_TRIGGERS
+	select LEDS_TRIGGER_CPU
 
 config PLAT_VERSATILE_SCHED_CLOCK
 	def_bool y if !ARCH_INTEGRATOR_AP
diff --git a/arch/arm/plat-versatile/leds.c b/arch/arm/plat-versatile/leds.c
index 3169fa5..f0a5c1e 100644
--- a/arch/arm/plat-versatile/leds.c
+++ b/arch/arm/plat-versatile/leds.c
@@ -37,10 +37,10 @@ static const struct {
 } versatile_leds[] = {
 	{ "versatile:0", "heartbeat", },
 	{ "versatile:1", "mmc0", },
-	{ "versatile:2", },
-	{ "versatile:3", },
-	{ "versatile:4", },
-	{ "versatile:5", },
+	{ "versatile:2", "cpu" },
+	{ "versatile:3", "cpu" },
+	{ "versatile:4", "cpu" },
+	{ "versatile:5", "cpu" },
 	{ "versatile:6", },
 	{ "versatile:7", },
 };
@@ -85,6 +85,11 @@ static int __init versatile_leds_init(void)
 		led->cdev.brightness_set = versatile_led_set;
 		led->cdev.brightness_get = versatile_led_get;
 		led->cdev.default_trigger = versatile_leds[i].trigger;
+		/* Some trigger data for CPU LEDs */
+		if (i >= 2 && i <= 5 ) {
+			/* This is the CPU number actually */
+			led->cdev.trigger_data = (void *) i - 2;
+		}
 		led->mask = BIT(i);
 
 		if (led_classdev_register(NULL, &led->cdev) < 0) {
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/4] mach-versatile: retire custom LED code
  2011-06-25 22:10 [PATCH 0/4] Introduce a led trigger for CPU activity Bryan Wu
                   ` (2 preceding siblings ...)
  2011-06-25 22:10 ` [PATCH 3/4] mach-realview: retire custom LED code Bryan Wu
@ 2011-06-25 22:10 ` Bryan Wu
  2011-06-26 11:02 ` [PATCH 0/4] Introduce a led trigger for CPU activity Linus Walleij
  4 siblings, 0 replies; 10+ messages in thread
From: Bryan Wu @ 2011-06-25 22:10 UTC (permalink / raw)
  To: linux-arm-kernel

From: Linus Walleij <linus.walleij@linaro.org>

The CPU activity LED is now handled by the trigger in the leds
subsystem, retire this old CONFIG_LEDS-based code.

Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
---
 arch/arm/mach-versatile/core.c |   42 ----------------------------------------
 1 files changed, 0 insertions(+), 42 deletions(-)

diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 0c99cf0..b9ff8ff 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -36,7 +36,6 @@
 
 #include <asm/system.h>
 #include <asm/irq.h>
-#include <asm/leds.h>
 #include <asm/hardware/arm_timer.h>
 #include <asm/hardware/icst.h>
 #include <asm/hardware/vic.h>
@@ -646,43 +645,6 @@ static struct amba_device *amba_devs[] __initdata = {
 	&kmi1_device,
 };
 
-#ifdef CONFIG_LEDS
-#define VA_LEDS_BASE (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_LED_OFFSET)
-
-static void versatile_leds_event(led_event_t ledevt)
-{
-	unsigned long flags;
-	u32 val;
-
-	local_irq_save(flags);
-	val = readl(VA_LEDS_BASE);
-
-	switch (ledevt) {
-	case led_idle_start:
-		val = val & ~VERSATILE_SYS_LED0;
-		break;
-
-	case led_idle_end:
-		val = val | VERSATILE_SYS_LED0;
-		break;
-
-	case led_timer:
-		val = val ^ VERSATILE_SYS_LED1;
-		break;
-
-	case led_halted:
-		val = 0;
-		break;
-
-	default:
-		break;
-	}
-
-	writel(val, VA_LEDS_BASE);
-	local_irq_restore(flags);
-}
-#endif	/* CONFIG_LEDS */
-
 /* Early initializations */
 void __init versatile_init_early(void)
 {
@@ -707,10 +669,6 @@ void __init versatile_init(void)
 		struct amba_device *d = amba_devs[i];
 		amba_device_register(d, &iomem_resource);
 	}
-
-#ifdef CONFIG_LEDS
-	leds_event = versatile_leds_event;
-#endif
 }
 
 /*
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 0/4] Introduce a led trigger for CPU activity
  2011-06-25 22:10 [PATCH 0/4] Introduce a led trigger for CPU activity Bryan Wu
                   ` (3 preceding siblings ...)
  2011-06-25 22:10 ` [PATCH 4/4] mach-versatile: " Bryan Wu
@ 2011-06-26 11:02 ` Linus Walleij
  2011-06-27  5:59   ` Bryan Wu
  4 siblings, 1 reply; 10+ messages in thread
From: Linus Walleij @ 2011-06-26 11:02 UTC (permalink / raw)
  To: linux-arm-kernel

2011/6/26 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.

Aha like that, OK I buy it. Just a few comments before I ACK it!

Linus Walleij

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 2/4] ARM: use new LEDS CPU trigger stub to replace old one
  2011-06-25 22:10 ` [PATCH 2/4] ARM: use new LEDS CPU trigger stub to replace old one Bryan Wu
@ 2011-06-26 11:08   ` Linus Walleij
  2011-06-27  6:00     ` Bryan Wu
  0 siblings, 1 reply; 10+ messages in thread
From: Linus Walleij @ 2011-06-26 11:08 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Bryan, notice that this:

2011/6/26 Bryan Wu <bryan.wu@canonical.com>:

> - ? ? ? ? ? ? ? leds_event(led_idle_start);
> + ? ? ? ? ? ? ? ledtrig_cpu(CPU_LED_IDLE_START);
(...)
> - ? ? ? ? ? ? ? leds_event(led_idle_end);
> + ? ? ? ? ? ? ? ledtrig_cpu(CPU_LED_IDLE_END);

That breaks all the old users of the CPU activity LEDs.

I only fixed up RealView and Versatile!

grep -r led_idle_start arch/arm/

Gives you a hint that you also have to retire custom LEDs from
orion, omap, at91, footbridge, sa1100, ks8695, shark, clps711x,
pxa and omap1.

You have to write a patch each an every one of these, and
since they all are already using that mechanism actively
you need to select the LED trigger in their Kconfig.

Thanks,
Linus Walleij

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 3/4] mach-realview: retire custom LED code
  2011-06-25 22:10 ` [PATCH 3/4] mach-realview: retire custom LED code Bryan Wu
@ 2011-06-26 11:10   ` Linus Walleij
  0 siblings, 0 replies; 10+ messages in thread
From: Linus Walleij @ 2011-06-26 11:10 UTC (permalink / raw)
  To: linux-arm-kernel

2011/6/26 Bryan Wu <bryan.wu@canonical.com>:

> This replaces the custom LED trigger code in mach-realview with
> some overarching platform code for the plat-versatile family that
> will lock down LEDs 2 thru 5 for CPU activity indication. The
> day we have 8 core ARM systems the plat-versatile code will have
> to become more elaborate.
>
> Tested on RealView PB11MPCore by invoking four different CPU
> hogs (yes > /dev/null&) and see the LEDs go on one at a time.
> They all go off as the hogs are killed. Tested on the PB1176
> as well - just one activity led (led 2) goes on and off with
> CPU activity.
>
> (bryan.wu at canonical.com: use ledtrig-cpu instead of ledtrig-arm-cpu)
>
> Cc: Richard Purdie <rpurdie@rpsys.net>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Bryan Wu <bryan.wu@canonical.com>

This is good, especially the KConfig fixups, but also include Pawel Moll's
Acked-by on these patches.

Linus Walleij

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 0/4] Introduce a led trigger for CPU activity
  2011-06-26 11:02 ` [PATCH 0/4] Introduce a led trigger for CPU activity Linus Walleij
@ 2011-06-27  5:59   ` Bryan Wu
  0 siblings, 0 replies; 10+ messages in thread
From: Bryan Wu @ 2011-06-27  5:59 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Jun 26, 2011 at 7:02 PM, Linus Walleij
<linus.ml.walleij@gmail.com> wrote:
> 2011/6/26 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.
>
> Aha like that, OK I buy it. Just a few comments before I ACK it!
>

Thanks, man. I will prepare an updated consolidation patchset soon.

-- 
Bryan Wu <bryan.wu@canonical.com>
Kernel Developer ? ?+86.138-1617-6545 Mobile
Ubuntu Kernel Team
Canonical Ltd. ? ? ?www.canonical.com
Ubuntu - Linux for human beings | www.ubuntu.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 2/4] ARM: use new LEDS CPU trigger stub to replace old one
  2011-06-26 11:08   ` Linus Walleij
@ 2011-06-27  6:00     ` Bryan Wu
  0 siblings, 0 replies; 10+ messages in thread
From: Bryan Wu @ 2011-06-27  6:00 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Jun 26, 2011 at 7:08 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
> Hi Bryan, notice that this:
>
> 2011/6/26 Bryan Wu <bryan.wu@canonical.com>:
>
>> - ? ? ? ? ? ? ? leds_event(led_idle_start);
>> + ? ? ? ? ? ? ? ledtrig_cpu(CPU_LED_IDLE_START);
> (...)
>> - ? ? ? ? ? ? ? leds_event(led_idle_end);
>> + ? ? ? ? ? ? ? ledtrig_cpu(CPU_LED_IDLE_END);
>
> That breaks all the old users of the CPU activity LEDs.
>
> I only fixed up RealView and Versatile!
>
> grep -r led_idle_start arch/arm/
>
> Gives you a hint that you also have to retire custom LEDs from
> orion, omap, at91, footbridge, sa1100, ks8695, shark, clps711x,
> pxa and omap1.
>
> You have to write a patch each an every one of these, and
> since they all are already using that mechanism actively
> you need to select the LED trigger in their Kconfig.
>

No problem, I will clean them up soon.

Thanks,
-- 
Bryan Wu <bryan.wu@canonical.com>
Kernel Developer ? ?+86.138-1617-6545 Mobile
Ubuntu Kernel Team
Canonical Ltd. ? ? ?www.canonical.com
Ubuntu - Linux for human beings | www.ubuntu.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-06-27  6:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-25 22:10 [PATCH 0/4] Introduce a led trigger for CPU activity Bryan Wu
2011-06-25 22:10 ` [PATCH 1/4] leds: create a " Bryan Wu
2011-06-25 22:10 ` [PATCH 2/4] ARM: use new LEDS CPU trigger stub to replace old one Bryan Wu
2011-06-26 11:08   ` Linus Walleij
2011-06-27  6:00     ` Bryan Wu
2011-06-25 22:10 ` [PATCH 3/4] mach-realview: retire custom LED code Bryan Wu
2011-06-26 11:10   ` Linus Walleij
2011-06-25 22:10 ` [PATCH 4/4] mach-versatile: " Bryan Wu
2011-06-26 11:02 ` [PATCH 0/4] Introduce a led trigger for CPU activity Linus Walleij
2011-06-27  5:59   ` Bryan Wu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).