Skip to contentSkip to conversation

Introduce a led trigger for CPU activity

PATCH Superseded Bryan Wu 10 participants 65 messages Jul 6, 2011 – Jul 19, 2011

Subsystems (10)

v1 of 10 Superseded Latest is v10 →

lore
Share & tools
lore

Bryan Wu

author
#0 lore raw

cover Introduce a led trigger for CPU activity

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.0-rc6 and build successfully for all the machines.

Bryan Wu (15):
leds: create a trigger for CPU activity
arm: at91: convert old leds drivers to gpio_led and led_trigger
drivers
mach-ks8695: remove leds driver, since nobody use it
mach-shark: retire custom LED code
mach-orion5x: convert custom LED code to gpio_led and LED CPU trigger
mach-integrator: retire custom LED code
mach-clps711x: retire custom LED code of P720T machine
mach-ebsa110: retire custom LED code
mach-footbridge: retire custom LED code
mach-pxa: retire custom LED code
plat-samsung: remove including old leds event API header file
mach-pnx4008: remove including old leds event API header file
mach-omap1: retire custom LED code
mach-sa1100: retire custom LED code
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/Kconfig                               |   70 ++-----
 arch/arm/configs/orion5x_defconfig             |    1 +
 arch/arm/include/asm/leds.h                    |   50 ----
 arch/arm/kernel/Makefile                       |    1 -
 arch/arm/kernel/leds.c                         |  119 ----------
 arch/arm/kernel/process.c                      |    6 +-
 arch/arm/kernel/time.c                         |   17 --
 arch/arm/mach-at91/board-cap9adk.c             |   21 ++-
 arch/arm/mach-at91/board-csb337.c              |    3 -
 arch/arm/mach-at91/board-ecbat91.c             |   18 ++-
 arch/arm/mach-at91/board-eco920.c              |   23 ++-
 arch/arm/mach-at91/board-kafa.c                |   17 ++-
 arch/arm/mach-at91/board-kb9202.c              |   23 ++-
 arch/arm/mach-at91/board-rm9200dk.c            |    3 -
 arch/arm/mach-at91/board-rm9200ek.c            |    3 -
 arch/arm/mach-at91/board-sam9-l9260.c          |   23 ++-
 arch/arm/mach-at91/board-sam9261ek.c           |    3 -
 arch/arm/mach-at91/board-yl-9200.c             |    3 -
 arch/arm/mach-at91/include/mach/board.h        |    1 -
 arch/arm/mach-at91/leds.c                      |  105 ---------
 arch/arm/mach-clps711x/Kconfig                 |    5 +
 arch/arm/mach-clps711x/Makefile                |    2 -
 arch/arm/mach-clps711x/include/mach/time.h     |    2 -
 arch/arm/mach-clps711x/p720t-leds.c            |   67 ------
 arch/arm/mach-clps711x/p720t.c                 |   57 +++++
 arch/arm/mach-clps711x/time.c                  |    1 -
 arch/arm/mach-ebsa110/Makefile                 |    4 +-
 arch/arm/mach-ebsa110/leds.c                   |   77 ++++---
 arch/arm/mach-footbridge/Kconfig               |   16 ++
 arch/arm/mach-footbridge/Makefile              |    4 -
 arch/arm/mach-footbridge/ebsa285-leds.c        |  139 -----------
 arch/arm/mach-footbridge/ebsa285.c             |   76 ++++++
 arch/arm/mach-footbridge/include/mach/system.h |    1 -
 arch/arm/mach-footbridge/netwinder-hw.c        |  102 +++++++--
 arch/arm/mach-footbridge/netwinder-leds.c      |  139 -----------
 arch/arm/mach-integrator/Makefile              |    3 +-
 arch/arm/mach-integrator/core.c                |    1 -
 arch/arm/mach-integrator/leds.c                |  147 ++++++------
 arch/arm/mach-ks8695/Makefile                  |    3 -
 arch/arm/mach-ks8695/devices.c                 |   21 --
 arch/arm/mach-ks8695/include/mach/devices.h    |    5 -
 arch/arm/mach-ks8695/leds.c                    |   93 --------
 arch/arm/mach-omap1/Kconfig                    |   21 ++
 arch/arm/mach-omap1/Makefile                   |    8 -
 arch/arm/mach-omap1/board-h2.c                 |   34 +++-
 arch/arm/mach-omap1/board-h3.c                 |   34 +++-
 arch/arm/mach-omap1/board-osk.c                |   33 +++
 arch/arm/mach-omap1/leds-h2p2-debug.c          |  167 --------------
 arch/arm/mach-omap1/leds-innovator.c           |   99 --------
 arch/arm/mach-omap1/leds-osk.c                 |  115 ----------
 arch/arm/mach-omap1/leds.c                     |   69 ------
 arch/arm/mach-omap1/leds.h                     |    3 -
 arch/arm/mach-omap1/time.c                     |    1 -
 arch/arm/mach-omap1/timer32k.c                 |    1 -
 arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c   |    1 -
 arch/arm/mach-orion5x/rd88f5181l-ge-setup.c    |    1 -
 arch/arm/mach-orion5x/rd88f5182-setup.c        |   74 ++----
 arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c   |    1 -
 arch/arm/mach-pnx4008/time.c                   |    1 -
 arch/arm/mach-pxa/Kconfig                      |   17 ++
 arch/arm/mach-pxa/Makefile                     |    8 -
 arch/arm/mach-pxa/idp.c                        |   76 ++++++
 arch/arm/mach-pxa/leds-idp.c                   |  116 ----------
 arch/arm/mach-pxa/leds-lubbock.c               |  125 ----------
 arch/arm/mach-pxa/leds-mainstone.c             |  120 ----------
 arch/arm/mach-pxa/leds.c                       |   32 ---
 arch/arm/mach-pxa/leds.h                       |   13 -
 arch/arm/mach-pxa/lubbock.c                    |   90 ++++++++
 arch/arm/mach-pxa/mainstone.c                  |   89 +++++++
 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-sa1100/Kconfig                   |   29 +++
 arch/arm/mach-sa1100/Makefile                  |   10 -
 arch/arm/mach-sa1100/assabet.c                 |   75 ++++++
 arch/arm/mach-sa1100/badge4.c                  |   30 +++
 arch/arm/mach-sa1100/cerf.c                    |   42 ++++
 arch/arm/mach-sa1100/hackkit.c                 |   32 +++
 arch/arm/mach-sa1100/lart.c                    |   26 ++
 arch/arm/mach-sa1100/leds-assabet.c            |  114 ---------
 arch/arm/mach-sa1100/leds-badge4.c             |  111 ---------
 arch/arm/mach-sa1100/leds-cerf.c               |  110 ---------
 arch/arm/mach-sa1100/leds-hackkit.c            |  112 ---------
 arch/arm/mach-sa1100/leds-lart.c               |  101 --------
 arch/arm/mach-sa1100/leds-simpad.c             |  100 --------
 arch/arm/mach-sa1100/leds.c                    |   52 -----
 arch/arm/mach-sa1100/leds.h                    |   14 --
 arch/arm/mach-sa1100/simpad.c                  |   48 ++++
 arch/arm/mach-shark/Makefile                   |    4 +-
 arch/arm/mach-shark/core.c                     |    1 -
 arch/arm/mach-shark/leds.c                     |  222 +++++++-----------
 arch/arm/mach-versatile/core.c                 |   42 ----
 arch/arm/plat-omap/Kconfig                     |    9 +-
 arch/arm/plat-omap/debug-leds.c                |  292 ++++++------------------
 arch/arm/plat-samsung/time.c                   |    1 -
 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                     |  144 ++++++++++++
 include/linux/leds.h                           |   15 ++
 105 files changed, 1532 insertions(+), 3119 deletions(-)
 delete mode 100644 arch/arm/include/asm/leds.h
 delete mode 100644 arch/arm/kernel/leds.c
 delete mode 100644 arch/arm/mach-clps711x/p720t-leds.c
 delete mode 100644 arch/arm/mach-footbridge/ebsa285-leds.c
 delete mode 100644 arch/arm/mach-footbridge/netwinder-leds.c
 delete mode 100644 arch/arm/mach-ks8695/leds.c
 delete mode 100644 arch/arm/mach-omap1/leds-h2p2-debug.c
 delete mode 100644 arch/arm/mach-omap1/leds-innovator.c
 delete mode 100644 arch/arm/mach-omap1/leds-osk.c
 delete mode 100644 arch/arm/mach-omap1/leds.c
 delete mode 100644 arch/arm/mach-omap1/leds.h
 delete mode 100644 arch/arm/mach-pxa/leds-idp.c
 delete mode 100644 arch/arm/mach-pxa/leds-lubbock.c
 delete mode 100644 arch/arm/mach-pxa/leds-mainstone.c
 delete mode 100644 arch/arm/mach-pxa/leds.c
 delete mode 100644 arch/arm/mach-pxa/leds.h
 delete mode 100644 arch/arm/mach-sa1100/leds-assabet.c
 delete mode 100644 arch/arm/mach-sa1100/leds-badge4.c
 delete mode 100644 arch/arm/mach-sa1100/leds-cerf.c
 delete mode 100644 arch/arm/mach-sa1100/leds-hackkit.c
 delete mode 100644 arch/arm/mach-sa1100/leds-lart.c
 delete mode 100644 arch/arm/mach-sa1100/leds-simpad.c
 delete mode 100644 arch/arm/mach-sa1100/leds.c
 delete mode 100644 arch/arm/mach-sa1100/leds.h
 create mode 100644 drivers/leds/ledtrig-cpu.c
Signature · 1 line
1.7.5
author
#1 lore raw

PATCH 1/17 leds: create a trigger for CPU activity

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.)

---
 drivers/leds/Kconfig       |   10 +++
 drivers/leds/Makefile      |    1 +
 drivers/leds/ledtrig-cpu.c |  144 ++++++++++++++++++++++++++++++++++++++++++++
 include/linux/leds.h       |   15 +++++
 4 files changed, 170 insertions(+), 0 deletions(-)
 create mode 100644 drivers/leds/ledtrig-cpu.c
drivers/leds/Kconfig +10 -0
index 713d43b..186000a 100644
@@ -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
drivers/leds/Makefile +1 -0
index bbfd2e3..5e70d2e 100644
@@ -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
drivers/leds/ledtrig-cpu.c new file +144 -0

144 lines not on this page · raw message

include/linux/leds.h +15 -0
index 5884def..94cdb9a 100644
@@ -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(evt) do {} while (0)
+#endif
+
 #endif		/* __LINUX_LEDS_H_INCLUDED */
Signature · 1 line
1.7.5
#2 lore raw

PATCH 1/17 leds: create a trigger for CPU activity

Quoted 104 lines · Bryan Wu

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.)

---

?drivers/leds/Kconfig ? ? ? | ? 10 +++
?drivers/leds/Makefile ? ? ?| ? ?1 +
?drivers/leds/ledtrig-cpu.c | ?144 ++++++++++++++++++++++++++++++++++++++++++++
?include/linux/leds.h ? ? ? | ? 15 +++++

?4 files changed, 170 insertions(+), 0 deletions(-) ?create mode 100644 drivers/leds/ledtrig-cpu.c

drivers/leds/Kconfig +0 -0
index 713d43b..186000a 100644
@@ -446,6 +446,16 @@ config LEDS_TRIGGER_BACKLIGHT
 

? ? ? ? ?If unsure, say N.

drivers/leds/Kconfig +10 -0
+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

drivers/leds/Makefile +0 -0
index bbfd2e3..5e70d2e 100644
@@ -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

drivers/leds/ledtrig-cpu.c new file +47 -0
new file mode 100644
index 0000000..4d63ada
@@ -0,0 +1,144 @@
+/*
+ * ledtrig-cpu.c - LED trigger based on CPU activity
+ *
+ * Copyright 2011 Linus Walleij <[email protected]>
+ * Copyright 2011 Bryan Wu <[email protected]>
+ *
+ * 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:

drivers/leds/ledtrig-cpu.c line 57

Quoted 10 lines
drivers/leds/ledtrig-cpu.c new file +10 -0
+ ? ? ? ? ? ? ? /* 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;
+ ? ? ? }
+}

I'm a bit worrying about the LED brightness hardcoded here, what if a platform requires different behavior, e.g. LED_OFF when IDLE_START.

Quoted 53 lines
drivers/leds/ledtrig-cpu.c new file +53 -0
+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;
+
+ ? ? ? 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);
+}
+

drivers/leds/ledtrig-cpu.c line 120

Quoted 10 lines
drivers/leds/ledtrig-cpu.c new file +10 -0
+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,
+};

Even this is static, I think naming of ledtrig_cpu_syscore_* will be better here, causing less confusion. As cpu_syscore_shutdown really gave me a first impression it's about the action when the CPU shuts down.

Quoted 9 lines
drivers/leds/ledtrig-cpu.c new file +9 -0
+
+static int __init cpu_trig_init(void)
+{
+ ? ? ? int ret;
+
+ ? ? ? ret = led_trigger_register(&cpu_led_trigger);
+ ? ? ? if (!ret)
+ ? ? ? ? ? ? ? register_syscore_ops(&cpu_syscore_ops);
+

drivers/leds/ledtrig-cpu.c line 139

Quoted 10 lines
drivers/leds/ledtrig-cpu.c new file +10 -0
+ ? ? ? 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);

ledtrig_cpu_exit?

Quoted 13 lines
drivers/leds/ledtrig-cpu.c new file +5 -0
+
+MODULE_AUTHOR("Linus Walleij <[email protected]>");
+MODULE_AUTHOR("Bryan Wu <[email protected]>");
+MODULE_DESCRIPTION("CPU LED trigger");
+MODULE_LICENSE("GPL");
include/linux/leds.h +0 -0
index 5884def..94cdb9a 100644
@@ -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);

include/linux/leds.h

Quoted 8 lines
include/linux/leds.h +8 -0
+#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
+};

A brief block of comments explaining these events would be very helpful for passing correct parameters to ledtrig_cpu()

Quoted 12 lines
include/linux/leds.h +7 -0
+
+/* Use this routine to handle LEDs */
+extern void ledtrig_cpu(enum cpu_led_event evt);
+#else
+#define ledtrig_cpu(evt) do {} while (0)
+#endif
+

?#endif ? ? ? ? /* __LINUX_LEDS_H_INCLUDED */
--
1.7.5

#3 lore raw

PATCH 1/17 leds: create a trigger for CPU activity

Quoted 18 lines · Eric Miao
Quoted 17 lines · Bryan Wu

+ ? ? ? 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;

(quoted diff) +9 -0
+
+ ? ? ? 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;
+
Quoted 8 lines
Quoted 5 lines

+ ? ? ? default:
+ ? ? ? ? ? ? ? /* Will leave the LED as it is */
+ ? ? ? ? ? ? ? break;
+ ? ? ? }
+}

I'm a bit worrying about the LED brightness hardcoded here, what if a platform requires different behavior, e.g. LED_OFF when IDLE_START.

Indeed - there are platforms (Netwinder, Assabet etc) which use LED=ON to mean that the system is not idle - and also turn the LED on when halted.

A change of behaviour could be fairly disasterous too. Eg, some people use Netwinders in a stand-alone mode, and getting the LED behaviour correct is _critical_ as it is the only display that some people may see - and they may use that display to decide whether they can pull the power after shutdown. Changing it may mean that they end up pulling the power while the system is still alive.

#4 lore raw

PATCH 1/17 leds: create a trigger for CPU activity

Quoted 28 lines · Russell King - ARM Linux
Quoted 18 lines · Eric Miao
Quoted 17 lines · Bryan Wu

+ ? ? ? 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;

(quoted diff) +9 -0
+
+ ? ? ? 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;
+
Quoted 8 lines
Quoted 5 lines

+ ? ? ? default:
+ ? ? ? ? ? ? ? /* Will leave the LED as it is */
+ ? ? ? ? ? ? ? break;
+ ? ? ? }
+}

I'm a bit worrying about the LED brightness hardcoded here, what if a platform requires different behavior, e.g. LED_OFF when IDLE_START.

Quoted 3 lines

Indeed - there are platforms (Netwinder, Assabet etc) which use LED=ON to mean that the system is not idle - and also turn the LED on when halted.

What about simply setting active_low to 1 in the struct gpio_led instance for those particular LEDs (or invert it if it is already set)?

Nicolas

author
#5 lore raw

PATCH 1/17 leds: create a trigger for CPU activity

In reply to Eric Miao
Quoted 178 lines · Eric Miao
Quoted 104 lines · Bryan Wu

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.)

---

?drivers/leds/Kconfig ? ? ? | ? 10 +++
?drivers/leds/Makefile ? ? ?| ? ?1 +
?drivers/leds/ledtrig-cpu.c | ?144 ++++++++++++++++++++++++++++++++++++++++++++
?include/linux/leds.h ? ? ? | ? 15 +++++

?4 files changed, 170 insertions(+), 0 deletions(-) ?create mode 100644 drivers/leds/ledtrig-cpu.c

drivers/leds/Kconfig +0 -0
index 713d43b..186000a 100644
@@ -446,6 +446,16 @@ config LEDS_TRIGGER_BACKLIGHT
 

? ? ? ? ?If unsure, say N.

drivers/leds/Kconfig +10 -0
+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

drivers/leds/Makefile +0 -0
index bbfd2e3..5e70d2e 100644
@@ -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

drivers/leds/ledtrig-cpu.c new file +47 -0
new file mode 100644
index 0000000..4d63ada
@@ -0,0 +1,144 @@
+/*
+ * ledtrig-cpu.c - LED trigger based on CPU activity
+ *
+ * Copyright 2011 Linus Walleij <[email protected]>
+ * Copyright 2011 Bryan Wu <[email protected]>
+ *
+ * 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:

drivers/leds/ledtrig-cpu.c line 57

Quoted 10 lines
drivers/leds/ledtrig-cpu.c new file +10 -0
+ ? ? ? ? ? ? ? /* 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;
+ ? ? ? }
+}

I'm a bit worrying about the LED brightness hardcoded here, what if a platform requires different behavior, e.g. LED_OFF when IDLE_START.

Quoted 59 lines
drivers/leds/ledtrig-cpu.c new file +59 -0
+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;
+
+ ? ? ? 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 = {
Quoted 9 lines

drivers/leds/ledtrig-cpu.c line 120

Quoted 4 lines
drivers/leds/ledtrig-cpu.c new file +4 -0
+ ? ? ? .shutdown ? ? ? = cpu_syscore_shutdown,
+ ? ? ? .suspend ? ? ? ?= cpu_syscore_suspend,
+ ? ? ? .resume ? ? ? ? = cpu_syscore_resume,
+};

Even this is static, I think naming of ledtrig_cpu_syscore_* will be better here, causing less confusion. As cpu_syscore_shutdown really gave me a first impression it's about the action when the CPU shuts down.

OK, I will fix this name confusing issue.
Thanks

Quoted 65 lines
Quoted 9 lines
drivers/leds/ledtrig-cpu.c new file +9 -0
+
+static int __init cpu_trig_init(void)
+{
+ ? ? ? int ret;
+
+ ? ? ? ret = led_trigger_register(&cpu_led_trigger);
+ ? ? ? if (!ret)
+ ? ? ? ? ? ? ? register_syscore_ops(&cpu_syscore_ops);
+

drivers/leds/ledtrig-cpu.c line 139

Quoted 10 lines
drivers/leds/ledtrig-cpu.c new file +10 -0
+ ? ? ? 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);

ledtrig_cpu_exit?

Quoted 13 lines
drivers/leds/ledtrig-cpu.c new file +5 -0
+
+MODULE_AUTHOR("Linus Walleij <[email protected]>");
+MODULE_AUTHOR("Bryan Wu <[email protected]>");
+MODULE_DESCRIPTION("CPU LED trigger");
+MODULE_LICENSE("GPL");
include/linux/leds.h +0 -0
index 5884def..94cdb9a 100644
@@ -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);

include/linux/leds.h

Quoted 8 lines
include/linux/leds.h +8 -0
+#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
+};

A brief block of comments explaining these events would be very helpful for passing correct parameters to ledtrig_cpu()

Quoted 7 lines
include/linux/leds.h +7 -0
+
+/* Use this routine to handle LEDs */
+extern void ledtrig_cpu(enum cpu_led_event evt);
+#else
+#define ledtrig_cpu(evt) do {} while (0)
+#endif
+
Quoted 5 lines

?#endif ? ? ? ? /* __LINUX_LEDS_H_INCLUDED */
--
1.7.5

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Signature · 5 lines
Bryan Wu <[email protected]>
Kernel Developer ? ?+86.138-1617-6545 Mobile
Ubuntu Kernel Team
Canonical Ltd. ? ? ?www.canonical.com
Ubuntu - Linux for human beings | www.ubuntu.com
author
#6 lore raw

PATCH 2/17 arm: at91: convert old leds drivers to gpio_led and led_trigger drivers

In reply to Bryan Wu

Build with at91 defconfigs successfully

---
 arch/arm/mach-at91/board-cap9adk.c      |   21 ++++++-
 arch/arm/mach-at91/board-csb337.c       |    3 -
 arch/arm/mach-at91/board-ecbat91.c      |   18 +++++-
 arch/arm/mach-at91/board-eco920.c       |   23 ++++++-
 arch/arm/mach-at91/board-kafa.c         |   17 ++++-
 arch/arm/mach-at91/board-kb9202.c       |   23 ++++++-
 arch/arm/mach-at91/board-rm9200dk.c     |    3 -
 arch/arm/mach-at91/board-rm9200ek.c     |    3 -
 arch/arm/mach-at91/board-sam9-l9260.c   |   23 ++++++-
 arch/arm/mach-at91/board-sam9261ek.c    |    3 -
 arch/arm/mach-at91/board-yl-9200.c      |    3 -
 arch/arm/mach-at91/include/mach/board.h |    1 -
 arch/arm/mach-at91/leds.c               |  105 -------------------------------
 13 files changed, 108 insertions(+), 138 deletions(-)
arch/arm/mach-at91/board-cap9adk.c +19 -2
index cdb65d4..7a6a32b 100644
@@ -55,8 +55,6 @@ static void __init cap9adk_init_early(void)
 	/* Initialize processor: 12 MHz crystal */
 	at91cap9_initialize(12000000);
 
-	/* Setup the LEDs: USER1 and USER2 LED for cpu/timer... */
-	at91_init_leds(AT91_PIN_PA10, AT91_PIN_PA11);
 	/* ... POWER LED always on */
 	at91_set_gpio_output(AT91_PIN_PC29, 1);
 
@@ -365,6 +363,23 @@ static struct ac97c_platform_data cap9adk_ac97_data = {
 //	.reset_pin	= ... not connected
 };
 
+/*
+ * LEDs
+ */
+static struct gpio_led cap9adk_leds[] = {
+	{	/* D1 */
+		.name			= "led1",
+		.gpio			= AT91_PIN_PA10,
+		.active_low		= 1,
+		.default_trigger	= "heartbeat",
+	},
+	{	/* D2 */
+		.name			= "led2",
+		.gpio			= AT91_PIN_PA11,
+		.active_low		= 1,
+		.default_trigger	= "timer",
+	}
+};
 
 static void __init cap9adk_board_init(void)
 {
@@ -392,6 +407,8 @@ static void __init cap9adk_board_init(void)
 	at91_add_device_lcdc(&cap9adk_lcdc_data);
 	/* AC97 */
 	at91_add_device_ac97(&cap9adk_ac97_data);
+	/* LEDs */
+	at91_gpio_leds(cap9adk_leds, ARRAY_SIZE(cap9adk_leds));
 }
 
 MACHINE_START(AT91CAP9ADK, "Atmel AT91CAP9A-DK")
arch/arm/mach-at91/board-csb337.c +0 -3
index d98bcec..da3fb48 100644
@@ -48,9 +48,6 @@ static void __init csb337_init_early(void)
 	/* Initialize processor: 3.6864 MHz crystal */
 	at91rm9200_initialize(3686400);
 
-	/* Setup the LEDs */
-	at91_init_leds(AT91_PIN_PB0, AT91_PIN_PB1);
-
 	/* DBGU on ttyS0 */
 	at91_register_uart(0, 0, 0);
 
arch/arm/mach-at91/board-ecbat91.c +15 -3
index a6f57fa..e82d024 100644
@@ -51,9 +51,6 @@ static void __init ecb_at91init_early(void)
 	/* Initialize processor: 18.432 MHz crystal */
 	at91rm9200_initialize(18432000);
 
-	/* Setup the LEDs */
-	at91_init_leds(AT91_PIN_PC7, AT91_PIN_PC7);
-
 	/* DBGU on ttyS0. (Rx & Tx only) */
 	at91_register_uart(0, 0, 0);
 
@@ -149,6 +146,18 @@ static struct spi_board_info __initdata ecb_at91spi_devices[] = {
 	},
 };
 
+/*
+ * LEDs
+ */
+static struct gpio_led ecb_leds[] = {
+	{	/* D1 */
+		.name			= "led1",
+		.gpio			= AT91_PIN_PC7,
+		.active_low		= 1,
+		.default_trigger	= "heartbeat",
+	}
+};
+
 static void __init ecb_at91board_init(void)
 {
 	/* Serial */
@@ -168,6 +177,9 @@ static void __init ecb_at91board_init(void)
 
 	/* SPI */
 	at91_add_device_spi(ecb_at91spi_devices, ARRAY_SIZE(ecb_at91spi_devices));
+
+	/* LEDs */
+	at91_gpio_leds(ecb_leds, ARRAY_SIZE(ecb_leds));
 }
 
 MACHINE_START(ECBAT91, "emQbit's ECB_AT91")
arch/arm/mach-at91/board-eco920.c +20 -3
index bfc0062..60fd9e6 100644
@@ -37,9 +37,6 @@ static void __init eco920_init_early(void)
 
 	at91rm9200_initialize(18432000);
 
-	/* Setup the LEDs */
-	at91_init_leds(AT91_PIN_PB0, AT91_PIN_PB1);
-
 	/* DBGU on ttyS0. (Rx & Tx only */
 	at91_register_uart(0, 0, 0);
 
@@ -100,6 +97,24 @@ static struct spi_board_info eco920_spi_devices[] = {
 	},
 };
 
+/*
+ * LEDs
+ */
+static struct gpio_led eco920_leds[] = {
+	{	/* D1 */
+		.name			= "led1",
+		.gpio			= AT91_PIN_PB0,
+		.active_low		= 1,
+		.default_trigger	= "heartbeat",
+	},
+	{	/* D2 */
+		.name			= "led2",
+		.gpio			= AT91_PIN_PB1,
+		.active_low		= 1,
+		.default_trigger	= "timer",
+	}
+};
+
 static void __init eco920_board_init(void)
 {
 	at91_add_device_serial();
@@ -130,6 +145,8 @@ static void __init eco920_board_init(void)
 	);
 
 	at91_add_device_spi(eco920_spi_devices, ARRAY_SIZE(eco920_spi_devices));
+	/* LEDs */
+	at91_gpio_leds(eco920_leds, ARRAY_SIZE(eco920_leds));
 }
 
 MACHINE_START(ECO920, "eco920")
arch/arm/mach-at91/board-kafa.c +14 -3
index 9b003ff..5a46902 100644
@@ -48,9 +48,6 @@ static void __init kafa_init_early(void)
 	/* Initialize processor: 18.432 MHz crystal */
 	at91rm9200_initialize(18432000);
 
-	/* Set up the LEDs */
-	at91_init_leds(AT91_PIN_PB4, AT91_PIN_PB4);
-
 	/* DBGU on ttyS0. (Rx & Tx only) */
 	at91_register_uart(0, 0, 0);
 
@@ -80,6 +77,18 @@ static struct at91_udc_data __initdata kafa_udc_data = {
 	.pullup_pin	= AT91_PIN_PB7,
 };
 
+/*
+ * LEDs
+ */
+static struct gpio_led kafa_leds[] = {
+	{	/* D1 */
+		.name			= "led1",
+		.gpio			= AT91_PIN_PB4,
+		.active_low		= 1,
+		.default_trigger	= "heartbeat",
+	},
+};
+
 static void __init kafa_board_init(void)
 {
 	/* Serial */
@@ -94,6 +103,8 @@ static void __init kafa_board_init(void)
 	at91_add_device_i2c(NULL, 0);
 	/* SPI */
 	at91_add_device_spi(NULL, 0);
+	/* LEDs */
+	at91_gpio_leds(kafa_leds, ARRAY_SIZE(kafa_leds));
 }
 
 MACHINE_START(KAFA, "Sperry-Sun KAFA")
arch/arm/mach-at91/board-kb9202.c +20 -3
index a813a74..1a62283 100644
@@ -50,9 +50,6 @@ static void __init kb9202_init_early(void)
 	/* Initialize processor: 10 MHz crystal */
 	at91rm9200_initialize(10000000);
 
-	/* Set up the LEDs */
-	at91_init_leds(AT91_PIN_PC19, AT91_PIN_PC18);
-
 	/* DBGU on ttyS0. (Rx & Tx only) */
 	at91_register_uart(0, 0, 0);
 
@@ -117,6 +114,24 @@ static struct atmel_nand_data __initdata kb9202_nand_data = {
 	.partition_info	= nand_partitions,
 };
 
+/*
+ * LEDs
+ */
+static struct gpio_led kb9202_leds[] = {
+	{	/* D1 */
+		.name			= "led1",
+		.gpio			= AT91_PIN_PC19,
+		.active_low		= 1,
+		.default_trigger	= "heartbeat",
+	},
+	{	/* D2 */
+		.name			= "led2",
+		.gpio			= AT91_PIN_PC18,
+		.active_low		= 1,
+		.default_trigger	= "timer",
+	}
+};
+
 static void __init kb9202_board_init(void)
 {
 	/* Serial */
@@ -135,6 +150,8 @@ static void __init kb9202_board_init(void)
 	at91_add_device_spi(NULL, 0);
 	/* NAND */
 	at91_add_device_nand(&kb9202_nand_data);
+	/* LEDs */
+	at91_gpio_leds(kb9202_leds, ARRAY_SIZE(kb9202_leds));
 }
 
 MACHINE_START(KB9200, "KB920x")
arch/arm/mach-at91/board-rm9200dk.c +0 -3
index aef9627..029e487 100644
@@ -50,9 +50,6 @@ static void __init dk_init_early(void)
 	/* Initialize processor: 18.432 MHz crystal */
 	at91rm9200_initialize(18432000);
 
-	/* Setup the LEDs */
-	at91_init_leds(AT91_PIN_PB2, AT91_PIN_PB2);
-
 	/* DBGU on ttyS0. (Rx & Tx only) */
 	at91_register_uart(0, 0, 0);
 
arch/arm/mach-at91/board-rm9200ek.c +0 -3
index 015a021..0452f85 100644
@@ -50,9 +50,6 @@ static void __init ek_init_early(void)
 	/* Initialize processor: 18.432 MHz crystal */
 	at91rm9200_initialize(18432000);
 
-	/* Setup the LEDs */
-	at91_init_leds(AT91_PIN_PB1, AT91_PIN_PB2);
-
 	/* DBGU on ttyS0. (Rx & Tx only) */
 	at91_register_uart(0, 0, 0);
 
arch/arm/mach-at91/board-sam9-l9260.c +20 -3
index aaf1bf0..a4c2de3 100644
@@ -49,9 +49,6 @@ static void __init ek_init_early(void)
 	/* Initialize processor: 18.432 MHz crystal */
 	at91sam9260_initialize(18432000);
 
-	/* Setup the LEDs */
-	at91_init_leds(AT91_PIN_PA9, AT91_PIN_PA6);
-
 	/* DBGU on ttyS0. (Rx & Tx only) */
 	at91_register_uart(0, 0, 0);
 
@@ -190,6 +187,24 @@ static struct at91_mmc_data __initdata ek_mmc_data = {
 //	.vcc_pin	= ... not connected
 };
 
+/*
+ * LEDs
+ */
+static struct gpio_led ek_leds[] = {
+	{	/* D1 */
+		.name			= "led1",
+		.gpio			= AT91_PIN_PA9,
+		.active_low		= 1,
+		.default_trigger	= "heartbeat",
+	},
+	{	/* D2 */
+		.name			= "led2",
+		.gpio			= AT91_PIN_PA6,
+		.active_low		= 1,
+		.default_trigger	= "timer",
+	}
+};
+
 static void __init ek_board_init(void)
 {
 	/* Serial */
@@ -208,6 +223,8 @@ static void __init ek_board_init(void)
 	at91_add_device_mmc(0, &ek_mmc_data);
 	/* I2C */
 	at91_add_device_i2c(NULL, 0);
+	/* LEDs */
+	at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
 }
 
 MACHINE_START(SAM9_L9260, "Olimex SAM9-L9260")
arch/arm/mach-at91/board-sam9261ek.c +0 -3
index b60c22b..00cc106 100644
@@ -59,9 +59,6 @@ static void __init ek_init_early(void)
 	/* Initialize processor: 18.432 MHz crystal */
 	at91sam9261_initialize(18432000);
 
-	/* Setup the LEDs */
-	at91_init_leds(AT91_PIN_PA13, AT91_PIN_PA14);
-
 	/* DBGU on ttyS0. (Rx & Tx only) */
 	at91_register_uart(0, 0, 0);
 
arch/arm/mach-at91/board-yl-9200.c +0 -3
index c208cc3..8a905a7 100644
@@ -58,9 +58,6 @@ static void __init yl9200_init_early(void)
 	/* Initialize processor: 18.432 MHz crystal */
 	at91rm9200_initialize(18432000);
 
-	/* Setup the LEDs D2=PB17 (timer), D3=PB16 (cpu) */
-	at91_init_leds(AT91_PIN_PB16, AT91_PIN_PB17);
-
 	/* DBGU on ttyS0. (Rx & Tx only) */
 	at91_register_uart(0, 0, 0);
 
arch/arm/mach-at91/include/mach/board.h +0 -1
index ed544a0..c2a7746 100644
@@ -200,7 +200,6 @@ struct at91_can_data {
 extern void __init at91_add_device_can(struct at91_can_data *data);
 
  /* LEDs */
-extern void __init at91_init_leds(u8 cpu_led, u8 timer_led);
 extern void __init at91_gpio_leds(struct gpio_led *leds, int nr);
 extern void __init at91_pwm_leds(struct gpio_led *leds, int nr);
 
arch/arm/mach-at91/leds.c +0 -105

108 lines not on this page · raw message

Signature · 1 line
1.7.5
author
#7 lore raw

PATCH 3/17 mach-realview: retire custom LED code

In reply to Bryan Wu

From: Linus Walleij <[email protected]>

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)

---
 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(-)
arch/arm/mach-realview/core.c +0 -39
index 5c23450..3a12b6b 100644
@@ -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)?
  */
arch/arm/mach-realview/core.h +0 -2
index 5c83d1e..47ee3bc 100644
@@ -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);
arch/arm/mach-realview/realview_eb.c +0 -4
index 10e75fa..2fb438a 100644
@@ -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;
 }
 
arch/arm/mach-realview/realview_pb1176.c +0 -4
index eab6070..2e0350a 100644
@@ -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;
 }
 
arch/arm/mach-realview/realview_pb11mp.c +0 -4
index b2985fc..9dd929a 100644
@@ -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;
 }
 
arch/arm/mach-realview/realview_pba8.c +0 -4
index fb68665..d1bcd5f 100644
@@ -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;
 }
 
arch/arm/mach-realview/realview_pbx.c +0 -4
index 92ace2c..797a509 100644
@@ -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;
 }
 
arch/arm/plat-versatile/Kconfig +5 -1
index 52353be..c600420 100644
@@ -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
arch/arm/plat-versatile/leds.c +9 -4
index 3169fa5..a617a8f 100644
@@ -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) {
Signature · 1 line
1.7.5
#8 lore raw

PATCH 3/17 mach-realview: retire custom LED code

Quoted 5 lines · Bryan Wu
arch/arm/plat-versatile/Kconfig +0 -0
index 52353be..c600420 100644

arch/arm/plat-versatile/Kconfig config PLAT_VERSATILE_FPGA_IRQ · line 15

Quoted 10 lines
arch/arm/plat-versatile/Kconfig +5 -1
@@ -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

Can you explain the choice to force LED support to be enabled with no choice for these?

author
#9 lore raw

PATCH 3/17 mach-realview: retire custom LED code

Quoted 8 lines · Russell King - ARM Linux
Quoted 7 lines · Bryan Wu
arch/arm/plat-versatile/Kconfig +0 -0
index 52353be..c600420 100644
@@ -7,8 +7,12 @@ config PLAT_VERSATILE_FPGA_IRQ

? ? ? bool

Quoted 12 lines
Quoted 8 lines

?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

Can you explain the choice to force LED support to be enabled with no choice for these?

I force to select this to default build-in LEDS stuff and don't wanna to modify the defconfig to build-in LEDS stuff as default. Now, I agree we can let users to select them when they wanna to enable LED via menuconfig.

Thanks,

Signature · 5 lines
Bryan Wu <[email protected]>
Kernel Developer ? ?+86.138-1617-6545 Mobile
Ubuntu Kernel Team
Canonical Ltd. ? ? ?www.canonical.com
Ubuntu - Linux for human beings | www.ubuntu.com
author
#10 lore raw

PATCH 4/17 mach-versatile: retire custom LED code

In reply to Bryan Wu

From: Linus Walleij <[email protected]>

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

---
 arch/arm/mach-versatile/core.c |   42 ----------------------------------------
 1 files changed, 0 insertions(+), 42 deletions(-)
arch/arm/mach-versatile/core.c +0 -42
index 0c99cf0..b9ff8ff 100644
@@ -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
 }
 
 /*
Signature · 1 line
1.7.5
#11 lore raw

PATCH 4/17 mach-versatile: retire custom LED code

Quoted 4 lines · Bryan Wu

From: Linus Walleij <[email protected]>

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

Shouldn't this be part of the previous patch? The previous patch changes both Realview and Versatile by touching plat-versatile.

author
#12 lore raw

PATCH 4/17 mach-versatile: retire custom LED code

Quoted 9 lines · Russell King - ARM Linux
Quoted 4 lines · Bryan Wu

From: Linus Walleij <[email protected]>

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

Shouldn't this be part of the previous patch? ?The previous patch changes both Realview and Versatile by touching plat-versatile.

I will fold them together, if Linus has no problem about it.

Thanks,

Signature · 5 lines
Bryan Wu <[email protected]>
Kernel Developer ? ?+86.138-1617-6545 Mobile
Ubuntu Kernel Team
Canonical Ltd. ? ? ?www.canonical.com
Ubuntu - Linux for human beings | www.ubuntu.com
#13 lore raw

PATCH 4/17 mach-versatile: retire custom LED code

Quoted 8 lines · Bryan Wu
Quoted 4 lines · Russell King - ARM Linux

Shouldn't this be part of the previous patch? ?The previous patch changes both Realview and Versatile by touching plat-versatile.

I will fold them together, if Linus has no problem about it.

I have no problems with anything, and I'm not one bit picky about SoB:s and Author: tags, I'm more concerned about the LED code getting cleaned up. Just do whatever it takes to make good patches out of this!

Thanks,
Linus Walleij

author
#14 lore raw

PATCH 5/17 mach-ks8695: remove leds driver, since nobody use it

In reply to Bryan Wu
---
 arch/arm/mach-ks8695/Makefile               |    3 -
 arch/arm/mach-ks8695/devices.c              |   21 ------
 arch/arm/mach-ks8695/include/mach/devices.h |    5 --
 arch/arm/mach-ks8695/leds.c                 |   93 ---------------------------
 4 files changed, 0 insertions(+), 122 deletions(-)
 delete mode 100644 arch/arm/mach-ks8695/leds.c
arch/arm/mach-ks8695/Makefile +0 -3
index 7e3e816..39c7d3c 100644
@@ -11,9 +11,6 @@ obj-				:=
 # PCI support is optional
 obj-$(CONFIG_PCI)		+= pci.o
 
-# LEDs
-obj-$(CONFIG_LEDS)		+= leds.o
-
 # Board-specific support
 obj-$(CONFIG_MACH_KS8695)	+= board-micrel.o
 obj-$(CONFIG_MACH_DSM320)	+= board-dsm320.o
arch/arm/mach-ks8695/devices.c +0 -21
index b89fb6d..5ebf45d 100644
@@ -181,27 +181,6 @@ static void __init ks8695_add_device_watchdog(void)
 }
 
 
-/* --------------------------------------------------------------------
- *  LEDs
- * -------------------------------------------------------------------- */
-
-#if defined(CONFIG_LEDS)
-short ks8695_leds_cpu = -1;
-short ks8695_leds_timer = -1;
-
-void __init ks8695_init_leds(u8 cpu_led, u8 timer_led)
-{
-	/* Enable GPIO to access the LEDs */
-	gpio_direction_output(cpu_led, 1);
-	gpio_direction_output(timer_led, 1);
-
-	ks8695_leds_cpu	  = cpu_led;
-	ks8695_leds_timer = timer_led;
-}
-#else
-void __init ks8695_init_leds(u8 cpu_led, u8 timer_led) {}
-#endif
-
 /* -------------------------------------------------------------------- */
 
 /*
arch/arm/mach-ks8695/include/mach/devices.h +0 -5
index 2744fec..6e0c94a 100644
@@ -18,11 +18,6 @@ extern void __init ks8695_add_device_wan(void);
 extern void __init ks8695_add_device_lan(void);
 extern void __init ks8695_add_device_hpna(void);
 
- /* LEDs */
-extern short ks8695_leds_cpu;
-extern short ks8695_leds_timer;
-extern void __init ks8695_init_leds(u8 cpu_led, u8 timer_led);
-
  /* PCI */
 #define KS8695_MODE_PCI		0
 #define KS8695_MODE_MINIPCI	1
arch/arm/mach-ks8695/leds.c deleted +0 -93

93 lines not on this page · raw message

Signature · 1 line
1.7.5
author
#17 lore raw

PATCH 5/17 mach-ks8695: remove leds driver, since nobody use it

Quoted 6 lines · Sergei Shtylyov

Hello.

Quoted 1 line · Andrew Victor
Quoted 1 line
Quoted 8 lines
Quoted 3 lines

As the original author of this code.

? If you're the original author, shouldn't there be:

From: Andrew Victor <[email protected]>

No problem, I will change that.

Thanks,

Signature · 5 lines
Bryan Wu <[email protected]>
Kernel Developer ? ?+86.138-1617-6545 Mobile
Ubuntu Kernel Team
Canonical Ltd. ? ? ?www.canonical.com
Ubuntu - Linux for human beings | www.ubuntu.com
#18 lore raw

PATCH 5/17 mach-ks8695: remove leds driver, since nobody use it

Quoted 9 lines · Bryan Wu
Quoted 8 lines · Sergei Shtylyov

Hello.

Quoted 3 lines · Andrew Victor
Quoted 1 line

As the original author of this code.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

? If you're the original author, shouldn't there be:

From: Andrew Victor <[email protected]>

No problem, I will change that.

Beware. Is Andrew Victor the original author of the code being removed here and in this case he's indicating his agreement to the removal of his code, or he is the one actually responsible for the removal? If the former then it is wrong to put a "From" with his name and the "Acked-by:" is the right thing to do.

Nicolas

author
#19 lore raw

PATCH 5/17 mach-ks8695: remove leds driver, since nobody use it

Quoted 18 lines · Nicolas Pitre
Quoted 16 lines · Bryan Wu
Quoted 14 lines · Sergei Shtylyov

Hello.

Quoted 5 lines · Andrew Victor
Quoted 1 line

As the original author of this code.

? If you're the original author, shouldn't there be:

From: Andrew Victor <[email protected]>

Quoted 8 lines
Quoted 1 line

No problem, I will change that.

Beware. ?Is Andrew Victor the original author of the code being removed here and in this case he's indicating his agreement to the removal of his code, or he is the one actually responsible for the removal? ?If the former then it is wrong to put a "From" with his name and the "Acked-by:" is the right thing to do.

Right, I was confused by the email. I prepared the removing patch and Andrew said "Acked-by".
Andrew, is that what you want?

Thanks,

Signature · 5 lines
Bryan Wu <[email protected]>
Kernel Developer ? ?+86.138-1617-6545 Mobile
Ubuntu Kernel Team
Canonical Ltd. ? ? ?www.canonical.com
Ubuntu - Linux for human beings | www.ubuntu.com
#20 lore raw

PATCH 5/17 mach-ks8695: remove leds driver, since nobody use it

hi,

Quoted 10 lines
Quoted 6 lines

Beware. ?Is Andrew Victor the original author of the code being removed here and in this case he's indicating his agreement to the removal of his code, or he is the one actually responsible for the removal? ?If the former then it is wrong to put a "From" with his name and the "Acked-by:" is the right thing to do.

Right, I was confused by the email. I prepared the removing patch and Andrew said "Acked-by".
Andrew, is that what you want?

Yes, I'm acknowledging the removal of my code.
So, Acked-by.

Regards,
Andrew

author
#21 lore raw

PATCH 6/17 mach-shark: retire custom LED code

In reply to Bryan Wu

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

---
 arch/arm/Kconfig             |    6 +
 arch/arm/mach-shark/Makefile |    4 +-
 arch/arm/mach-shark/core.c   |    1 -
 arch/arm/mach-shark/leds.c   |  222 ++++++++++++++++--------------------------
 4 files changed, 90 insertions(+), 143 deletions(-)
arch/arm/Kconfig +6 -0
index 9adc278..df971c7 100644
@@ -783,6 +783,12 @@ config ARCH_SHARK
 	select ZONE_DMA
 	select PCI
 	select ARCH_USES_GETTIMEOFFSET
+	select NEW_LEDS
+	select LEDS_CLASS
+	select LEDS_TRIGGERS
+	select LEDS_TRIGGER_CPU
+	select LEDS_TRIGGER_HEARTBEAT
+	select LEDS_TRIGGER_DEFAULT_ON
 	help
 	  Support for the StrongARM based Digital DNARD machine, also known
 	  as "Shark" (<http://www.shark-linux.de/shark.html>).
arch/arm/mach-shark/Makefile +1 -3
index 45be9b0..2965718 100644
@@ -4,9 +4,7 @@
 
 # Object file lists.
 
-obj-y			:= core.o dma.o irq.o pci.o
+obj-y			:= core.o dma.o irq.o pci.o leds.o
 obj-m			:=
 obj-n			:=
 obj-			:=
-
-obj-$(CONFIG_LEDS)	+= leds.o
arch/arm/mach-shark/core.c +0 -1
index 5cf7f94..f4b6288 100644
@@ -13,7 +13,6 @@
 
 #include <asm/setup.h>
 #include <asm/mach-types.h>
-#include <asm/leds.h>
 #include <asm/param.h>
 
 #include <asm/mach/map.h>
arch/arm/mach-shark/leds.c +83 -139

249 lines not on this page · raw message

Signature · 1 line
1.7.5
#22 lore raw

PATCH 6/17 mach-shark: retire custom LED code

Quoted 5 lines · Bryan Wu
arch/arm/Kconfig +0 -0
index 9adc278..df971c7 100644

arch/arm/Kconfig config ARCH_SHARK · line 791

Quoted 9 lines
arch/arm/Kconfig +6 -0
@@ -783,6 +783,12 @@ config ARCH_SHARK
 	select ZONE_DMA
 	select PCI
 	select ARCH_USES_GETTIMEOFFSET
+	select NEW_LEDS
+	select LEDS_CLASS
+	select LEDS_TRIGGERS
+	select LEDS_TRIGGER_CPU
+	select LEDS_TRIGGER_HEARTBEAT
+	select LEDS_TRIGGER_DEFAULT_ON

So Shark too gets forced to have LED support no matter what. Can we please stop this madness.

author
#23 lore raw

PATCH 6/17 mach-shark: retire custom LED code

Quoted 10 lines · Russell King - ARM Linux
Quoted 9 lines · Bryan Wu
arch/arm/Kconfig +0 -0
index 9adc278..df971c7 100644
@@ -783,6 +783,12 @@ config ARCH_SHARK

? ? ? select ZONE_DMA
? ? ? select PCI
? ? ? select ARCH_USES_GETTIMEOFFSET
+ ? ? select NEW_LEDS

Quoted 9 lines
Quoted 5 lines

+ ? ? select LEDS_CLASS
+ ? ? select LEDS_TRIGGERS
+ ? ? select LEDS_TRIGGER_CPU
+ ? ? select LEDS_TRIGGER_HEARTBEAT
+ ? ? select LEDS_TRIGGER_DEFAULT_ON

So Shark too gets forced to have LED support no matter what. ?Can we please stop this madness.

I will remove them

Thanks,

Signature · 5 lines
Bryan Wu <[email protected]>
Kernel Developer ? ?+86.138-1617-6545 Mobile
Ubuntu Kernel Team
Canonical Ltd. ? ? ?www.canonical.com
Ubuntu - Linux for human beings | www.ubuntu.com
author
#24 lore raw

PATCH 7/17 mach-orion5x: convert custom LED code to gpio_led and LED CPU trigger

In reply to Bryan Wu
---
 arch/arm/configs/orion5x_defconfig           |    1 +
 arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c |    1 -
 arch/arm/mach-orion5x/rd88f5181l-ge-setup.c  |    1 -
 arch/arm/mach-orion5x/rd88f5182-setup.c      |   74 ++++++++------------------
 arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c |    1 -
 5 files changed, 24 insertions(+), 54 deletions(-)
arch/arm/configs/orion5x_defconfig +1 -0
index a288d70..6579baf 100644
@@ -126,6 +126,7 @@ CONFIG_LEDS_CLASS=y
 CONFIG_LEDS_GPIO=y
 CONFIG_LEDS_TRIGGERS=y
 CONFIG_LEDS_TRIGGER_TIMER=y
+CONFIG_LEDS_TRIGGER_CPU=y
 CONFIG_LEDS_TRIGGER_HEARTBEAT=y
 CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
 CONFIG_RTC_CLASS=y
arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c +0 -1
index 9eec7c2..ddb6be1 100644
@@ -19,7 +19,6 @@
 #include <net/dsa.h>
 #include <asm/mach-types.h>
 #include <asm/gpio.h>
-#include <asm/leds.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
 #include <mach/orion5x.h>
arch/arm/mach-orion5x/rd88f5181l-ge-setup.c +0 -1
index 0cc90bb..454f666 100644
@@ -20,7 +20,6 @@
 #include <net/dsa.h>
 #include <asm/mach-types.h>
 #include <asm/gpio.h>
-#include <asm/leds.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
 #include <mach/orion5x.h>
arch/arm/mach-orion5x/rd88f5182-setup.c +23 -51

105 lines not on this page · raw message

arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c +0 -1
index ad2eba9..0c5d1d2 100644
@@ -22,7 +22,6 @@
 #include <net/dsa.h>
 #include <asm/mach-types.h>
 #include <asm/gpio.h>
-#include <asm/leds.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
 #include <mach/orion5x.h>
Signature · 1 line
1.7.5
#25 lore raw

PATCH 7/17 mach-orion5x: convert custom LED code to gpio_led and LED CPU trigger

Quoted 1 line · Bryan Wu
Quoted 172 lines
---
 arch/arm/configs/orion5x_defconfig           |    1 +
 arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c |    1 -
 arch/arm/mach-orion5x/rd88f5181l-ge-setup.c  |    1 -
 arch/arm/mach-orion5x/rd88f5182-setup.c      |   74 ++++++++------------------
 arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c |    1 -
 5 files changed, 24 insertions(+), 54 deletions(-)
arch/arm/configs/orion5x_defconfig +1 -0
index a288d70..6579baf 100644
@@ -126,6 +126,7 @@ CONFIG_LEDS_CLASS=y
 CONFIG_LEDS_GPIO=y
 CONFIG_LEDS_TRIGGERS=y
 CONFIG_LEDS_TRIGGER_TIMER=y
+CONFIG_LEDS_TRIGGER_CPU=y
 CONFIG_LEDS_TRIGGER_HEARTBEAT=y
 CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
 CONFIG_RTC_CLASS=y
arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c +0 -1
index 9eec7c2..ddb6be1 100644
@@ -19,7 +19,6 @@
 #include <net/dsa.h>
 #include <asm/mach-types.h>
 #include <asm/gpio.h>
-#include <asm/leds.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
 #include <mach/orion5x.h>
arch/arm/mach-orion5x/rd88f5181l-ge-setup.c +0 -1
index 0cc90bb..454f666 100644
@@ -20,7 +20,6 @@
 #include <net/dsa.h>
 #include <asm/mach-types.h>
 #include <asm/gpio.h>
-#include <asm/leds.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
 #include <mach/orion5x.h>
arch/arm/mach-orion5x/rd88f5182-setup.c +23 -51
index 48da39b..200e02c 100644
@@ -19,9 +19,9 @@
 #include <linux/mv643xx_eth.h>
 #include <linux/ata_platform.h>
 #include <linux/i2c.h>
+#include <linux/gpio.h>
+#include <linux/leds.h>
 #include <asm/mach-types.h>
-#include <asm/gpio.h>
-#include <asm/leds.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
 #include <mach/orion5x.h>
@@ -54,12 +54,6 @@
 #define RD88F5182_PCI_SLOT0_IRQ_A_PIN	7
 #define RD88F5182_PCI_SLOT0_IRQ_B_PIN	6
 
-/*
- * GPIO Debug LED
- */
-
-#define RD88F5182_GPIO_DBG_LED		0
-
 /*****************************************************************************
  * 16M NOR Flash on Device bus CS1
  ****************************************************************************/
@@ -84,55 +78,32 @@ static struct platform_device rd88f5182_nor_flash = {
 	.resource		= &rd88f5182_nor_flash_resource,
 };
 
-#ifdef CONFIG_LEDS
-
 /*****************************************************************************
- * Use GPIO debug led as CPU active indication
+ * Use GPIO LED as CPU active indication
  ****************************************************************************/
 
-static void rd88f5182_dbgled_event(led_event_t evt)
-{
-	int val;
-
-	if (evt == led_idle_end)
-		val = 1;
-	else if (evt == led_idle_start)
-		val = 0;
-	else
-		return;
-
-	gpio_set_value(RD88F5182_GPIO_DBG_LED, val);
-}
-
-static int __init rd88f5182_dbgled_init(void)
-{
-	int pin;
-
-	if (machine_is_rd88f5182()) {
-		pin = RD88F5182_GPIO_DBG_LED;
+#define RD88F5182_GPIO_LED		0
 
-		if (gpio_request(pin, "DBGLED") == 0) {
-			if (gpio_direction_output(pin, 0) != 0) {
-				printk(KERN_ERR "rd88f5182_dbgled_init failed "
-						"to set output pin %d\n", pin);
-				gpio_free(pin);
-				return 0;
-			}
-		} else {
-			printk(KERN_ERR "rd88f5182_dbgled_init failed "
-					"to request gpio %d\n", pin);
-			return 0;
-		}
-
-		leds_event = rd88f5182_dbgled_event;
-	}
-
-	return 0;
-}
+static struct gpio_led rd88f5182_gpio_led_pins[] = {
+	{
+		.name		= "rd88f5182:cpu",
+		.default_trigger = "cpu",
+		.gpio		= RD88F5182_GPIO_LED,
+	},
+};
 
-__initcall(rd88f5182_dbgled_init);
+static struct gpio_led_platform_data rd88f5182_gpio_led_data = {
+	.leds		= rd88f5182_gpio_led_pins,
+	.num_leds	= ARRAY_SIZE(rd88f5182_gpio_led_pins),
+};
 
-#endif
+static struct platform_device rd88f5182_gpio_leds = {
+	.name	= "leds-gpio",
+	.id	= -1,
+	.dev	= {
+		.platform_data = &rd88f5182_gpio_led_data,
+	},
+};
 
 /*****************************************************************************
  * PCI
@@ -299,6 +270,7 @@ static void __init rd88f5182_init(void)
 
 	orion5x_setup_dev1_win(RD88F5182_NOR_BASE, RD88F5182_NOR_SIZE);
 	platform_device_register(&rd88f5182_nor_flash);
+	platform_device_register(&rd88f5182_gpio_leds);
 
 	i2c_register_board_info(0, &rd88f5182_i2c_rtc, 1);
 }
arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c +0 -1
index ad2eba9..0c5d1d2 100644
@@ -22,7 +22,6 @@
 #include <net/dsa.h>
 #include <asm/mach-types.h>
 #include <asm/gpio.h>
-#include <asm/leds.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
 #include <mach/orion5x.h>
Signature · 1 line
1.7.5
author
#26 lore raw

PATCH 8/17 mach-integrator: retire custom LED code

In reply to Bryan Wu

Use 4 LEDs in baseboard instead of the LED in core module.

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

---
 arch/arm/Kconfig                  |    7 ++
 arch/arm/mach-integrator/Makefile |    3 +-
 arch/arm/mach-integrator/core.c   |    1 -
 arch/arm/mach-integrator/leds.c   |  147 +++++++++++++++++++------------------
 4 files changed, 84 insertions(+), 74 deletions(-)
arch/arm/Kconfig +7 -0
index df971c7..066009a 100644
@@ -243,6 +243,13 @@ config ARCH_INTEGRATOR
 	select GENERIC_CLOCKEVENTS
 	select PLAT_VERSATILE
 	select PLAT_VERSATILE_FPGA_IRQ
+	select NEW_LEDS
+	select LEDS_CLASS
+	select LEDS_TRIGGERS
+	select LEDS_TRIGGER_CPU
+	select LEDS_TRIGGER_HEARTBEAT
+	select LEDS_TRIGGER_DEFAULT_ON
+
 	help
 	  Support for ARM's Integrator platform.
 
arch/arm/mach-integrator/Makefile +1 -2
index ebeef96..5521d18 100644
@@ -4,11 +4,10 @@
 
 # Object file lists.
 
-obj-y					:= core.o lm.o
+obj-y					:= core.o lm.o leds.o
 obj-$(CONFIG_ARCH_INTEGRATOR_AP)	+= integrator_ap.o
 obj-$(CONFIG_ARCH_INTEGRATOR_CP)	+= integrator_cp.o
 
-obj-$(CONFIG_LEDS)			+= leds.o
 obj-$(CONFIG_PCI)			+= pci_v3.o pci.o
 obj-$(CONFIG_CPU_FREQ_INTEGRATOR)	+= cpu.o
 obj-$(CONFIG_INTEGRATOR_IMPD1)		+= impd1.o
arch/arm/mach-integrator/core.c +0 -1
index 77315b9..c4753d8 100644
@@ -28,7 +28,6 @@
 #include <asm/irq.h>
 #include <mach/cm.h>
 #include <asm/system.h>
-#include <asm/leds.h>
 #include <asm/mach/time.h>
 #include <asm/pgtable.h>
 
arch/arm/mach-integrator/leds.c +76 -71

167 lines not on this page · raw message

Signature · 1 line
1.7.5
#27 lore raw

PATCH 8/17 mach-integrator: retire custom LED code

Quoted 4 lines · Bryan Wu

Use 4 LEDs in baseboard instead of the LED in core module.

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

This is a functional change. Integrator CP has four baseboard LEDs. I don't remember Integrator AP having those, but it does have the LED on the core module, which is used for CPU activity on all Integrator platforms.

#28 lore raw

PATCH 8/17 mach-integrator: retire custom LED code

Quoted 8 lines · Russell King - ARM Linux
Quoted 4 lines · Bryan Wu

Use 4 LEDs in baseboard instead of the LED in core module.

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

This is a functional change. ?Integrator CP has four baseboard LEDs. I don't remember Integrator AP having those,

I have one here, it has three LEDs: green, yellow, red. It appears the yellow one wasn't used for anything before.

Quoted 2 lines

but it does have the LED on the core module, which is used for CPU activity on all Integrator platforms.

Sounds more intuitive too, if that LED is to be used for anything, it's for this.

Thanks,
Linus Walleij

author
#29 lore raw

PATCH 9/17 mach-clps711x: retire custom LED code of P720T machine

In reply to Bryan Wu

Add tigger based LED driver into board file of P720T. Remove old LED driver file.

---
 arch/arm/mach-clps711x/Kconfig             |    5 ++
 arch/arm/mach-clps711x/Makefile            |    2 -
 arch/arm/mach-clps711x/include/mach/time.h |    2 -
 arch/arm/mach-clps711x/p720t-leds.c        |   67 ----------------------------
 arch/arm/mach-clps711x/p720t.c             |   57 +++++++++++++++++++++++
 arch/arm/mach-clps711x/time.c              |    1 -
 6 files changed, 62 insertions(+), 72 deletions(-)
 delete mode 100644 arch/arm/mach-clps711x/p720t-leds.c
arch/arm/mach-clps711x/Kconfig +5 -0
index eb34bd1..b2a0ee2 100644
@@ -38,6 +38,11 @@ config ARCH_EDB7211
 
 config ARCH_P720T
 	bool "P720T"
+	select NEW_LEDS
+	select LEDS_CLASS
+	select LEDS_TRIGGERS
+	select LEDS_TRIGGER_HEARTBEAT
+
 	help
 	  Say Y here if you intend to run this kernel on the ARM Prospector
 	  720T.
arch/arm/mach-clps711x/Makefile +0 -2
index 4a19731..af9dcce 100644
@@ -16,5 +16,3 @@ obj-$(CONFIG_ARCH_CLEP7312) += clep7312.o
 obj-$(CONFIG_ARCH_EDB7211)  += edb7211-arch.o edb7211-mm.o
 obj-$(CONFIG_ARCH_FORTUNET) += fortunet.o
 obj-$(CONFIG_ARCH_P720T)    += p720t.o
-leds-$(CONFIG_ARCH_P720T)   += p720t-leds.o
-obj-$(CONFIG_LEDS)          += $(leds-y)
arch/arm/mach-clps711x/include/mach/time.h +0 -2
index 61fef91..bafc325 100644
@@ -17,7 +17,6 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#include <asm/leds.h>
 #include <asm/hardware/clps7111.h>
 
 extern void clps711x_setup_timer(void);
@@ -29,7 +28,6 @@ static irqreturn_t
 p720t_timer_interrupt(int irq, void *dev_id)
 {
 	struct pt_regs *regs = get_irq_regs();
-	do_leds();
 	xtime_update(1);
 #ifndef CONFIG_SMP
 	update_process_times(user_mode(regs));
arch/arm/mach-clps711x/p720t-leds.c deleted +0 -67

67 lines not on this page · raw message

arch/arm/mach-clps711x/p720t.c +57 -0

72 lines not on this page · raw message

arch/arm/mach-clps711x/time.c +0 -1
index d581ef0..d79fe79 100644
@@ -25,7 +25,6 @@
 
 #include <mach/hardware.h>
 #include <asm/irq.h>
-#include <asm/leds.h>
 #include <asm/hardware/clps7111.h>
 
 #include <asm/mach/time.h>
Signature · 1 line
1.7.5
author
#30 lore raw

PATCH 10/17 mach-ebsa110: retire custom LED code

In reply to Bryan Wu
---
 arch/arm/Kconfig               |    4 ++
 arch/arm/mach-ebsa110/Makefile |    4 +--
 arch/arm/mach-ebsa110/leds.c   |   77 +++++++++++++++++++++++----------------
 3 files changed, 50 insertions(+), 35 deletions(-)
arch/arm/Kconfig +4 -0
index 066009a..2a37079 100644
@@ -350,6 +350,10 @@ config ARCH_EBSA110
 	select ISA
 	select NO_IOPORT
 	select ARCH_USES_GETTIMEOFFSET
+	select NEW_LEDS
+	select LEDS_CLASS
+	select LEDS_TRIGGERS
+	select LEDS_TRIGGER_HEARTBEAT
 	help
 	  This is an evaluation board for the StrongARM processor available
 	  from Digital. It has limited hardware on-board, including an
arch/arm/mach-ebsa110/Makefile +1 -3
index 6520ac8..935e4af 100644
@@ -4,9 +4,7 @@
 
 # Object file lists.
 
-obj-y			:= core.o io.o
+obj-y			:= core.o io.o leds.o
 obj-m			:=
 obj-n			:=
 obj-			:=
-
-obj-$(CONFIG_LEDS)	+= leds.o
arch/arm/mach-ebsa110/leds.c +45 -32

96 lines not on this page · raw message

Signature · 1 line
1.7.5
#31 lore raw

PATCH 10/17 mach-ebsa110: retire custom LED code

arch/arm/Kconfig config ARCH_EBSA110 · line 356

Quoted 12 lines · Bryan Wu
arch/arm/Kconfig +4 -0
index 066009a..2a37079 100644
@@ -350,6 +350,10 @@ config ARCH_EBSA110
 	select ISA
 	select NO_IOPORT
 	select ARCH_USES_GETTIMEOFFSET
+	select NEW_LEDS
+	select LEDS_CLASS
+	select LEDS_TRIGGERS
+	select LEDS_TRIGGER_HEARTBEAT

Same comment about forcing.

arch/arm/Kconfig config ARCH_EBSA110

Quoted 8 lines
arch/arm/Kconfig +4 -3
-static int __init leds_init(void)
+static int __init ebsa110_leds_init(void)
 {
-	if (machine_is_ebsa110())
-		leds_event = ebsa110_leds_event;
+
+	struct led_classdev *cdev;
+	int ret;

Same comment about initialization. This seems to be a common theme.

As a whole, this patch set seems to result in a net step backwards to the goal of a single kernel image.

author
#32 lore raw

PATCH 11/17 mach-footbridge: retire custom LED code

In reply to Bryan Wu
---
 arch/arm/mach-footbridge/Kconfig               |   16 +++
 arch/arm/mach-footbridge/Makefile              |    4 -
 arch/arm/mach-footbridge/ebsa285-leds.c        |  139 ------------------------
 arch/arm/mach-footbridge/ebsa285.c             |   76 +++++++++++++
 arch/arm/mach-footbridge/include/mach/system.h |    1 -
 arch/arm/mach-footbridge/netwinder-hw.c        |  102 +++++++++++++++---
 arch/arm/mach-footbridge/netwinder-leds.c      |  139 ------------------------
 7 files changed, 180 insertions(+), 297 deletions(-)
 delete mode 100644 arch/arm/mach-footbridge/ebsa285-leds.c
 delete mode 100644 arch/arm/mach-footbridge/netwinder-leds.c
arch/arm/mach-footbridge/Kconfig +16 -0
index 46adca0..0a97d5c 100644
@@ -39,6 +39,12 @@ config ARCH_EBSA285_ADDIN
 	bool "EBSA285 (addin mode)"
 	select ARCH_EBSA285
 	select FOOTBRIDGE_ADDIN
+	select NEW_LEDS
+	select LEDS_CLASS
+	select LEDS_TRIGGERS
+	select LEDS_TRIGGER_CPU
+	select LEDS_TRIGGER_HEARTBEAT
+	select LEDS_TRIGGER_DEFAULT_ON
 	help
 	  Say Y here if you intend to run this kernel on the EBSA285 card
 	  in addin mode.
@@ -52,6 +58,11 @@ config ARCH_EBSA285_HOST
 	select ISA
 	select ISA_DMA
 	select PCI
+	select NEW_LEDS
+	select LEDS_CLASS
+	select LEDS_TRIGGERS
+	select LEDS_TRIGGER_CPU
+	select LEDS_TRIGGER_HEARTBEAT
 	help
 	  Say Y here if you intend to run this kernel on the EBSA285 card
 	  in host ("central function") mode.
@@ -65,6 +76,11 @@ config ARCH_NETWINDER
 	select ISA
 	select ISA_DMA
 	select PCI
+	select NEW_LEDS
+	select LEDS_CLASS
+	select LEDS_TRIGGERS
+	select LEDS_TRIGGER_CPU
+	select LEDS_TRIGGER_HEARTBEAT
 	help
 	  Say Y here if you intend to run this kernel on the Rebel.COM
 	  NetWinder.  Information about this machine can be found at:
arch/arm/mach-footbridge/Makefile +0 -4
index 3afb1b2..0b64dd4 100644
@@ -14,15 +14,11 @@ pci-$(CONFIG_ARCH_EBSA285_HOST) += ebsa285-pci.o
 pci-$(CONFIG_ARCH_NETWINDER) += netwinder-pci.o
 pci-$(CONFIG_ARCH_PERSONAL_SERVER) += personal-pci.o
 
-leds-$(CONFIG_ARCH_EBSA285) += ebsa285-leds.o
-leds-$(CONFIG_ARCH_NETWINDER) += netwinder-leds.o
-
 obj-$(CONFIG_ARCH_CATS) += cats-hw.o isa-timer.o
 obj-$(CONFIG_ARCH_EBSA285) += ebsa285.o dc21285-timer.o
 obj-$(CONFIG_ARCH_NETWINDER) += netwinder-hw.o isa-timer.o
 obj-$(CONFIG_ARCH_PERSONAL_SERVER) += personal.o dc21285-timer.o
 
 obj-$(CONFIG_PCI)	+=$(pci-y)
-obj-$(CONFIG_LEDS)	+=$(leds-y)
 
 obj-$(CONFIG_ISA)	+= isa.o isa-rtc.o
arch/arm/mach-footbridge/ebsa285-leds.c deleted +0 -139

139 lines not on this page · raw message

arch/arm/mach-footbridge/ebsa285.c +76 -0

88 lines not on this page · raw message

arch/arm/mach-footbridge/include/mach/system.h +0 -1
index 0b29315..c026efa 100644
@@ -10,7 +10,6 @@
 #include <linux/io.h>
 #include <asm/hardware/dec21285.h>
 #include <mach/hardware.h>
-#include <asm/leds.h>
 #include <asm/mach-types.h>
 
 static inline void arch_idle(void)
arch/arm/mach-footbridge/netwinder-hw.c +88 -14

131 lines not on this page · raw message

arch/arm/mach-footbridge/netwinder-leds.c deleted +0 -139

139 lines not on this page · raw message

Signature · 1 line
1.7.5
author
#34 lore raw

PATCH 11/17 mach-footbridge: retire custom LED code

Quoted 5 lines · Russell King - ARM Linux
Quoted 1 line · Bryan Wu

Same comments again.

OK, removed.

Thanks,

Signature · 5 lines
Bryan Wu <[email protected]>
Kernel Developer ? ?+86.138-1617-6545 Mobile
Ubuntu Kernel Team
Canonical Ltd. ? ? ?www.canonical.com
Ubuntu - Linux for human beings | www.ubuntu.com
author
#35 lore raw

PATCH 12/17 mach-pxa: retire custom LED code

In reply to Bryan Wu
---
 arch/arm/mach-pxa/Kconfig          |   17 +++++
 arch/arm/mach-pxa/Makefile         |    8 --
 arch/arm/mach-pxa/idp.c            |   76 ++++++++++++++++++++++
 arch/arm/mach-pxa/leds-idp.c       |  116 ---------------------------------
 arch/arm/mach-pxa/leds-lubbock.c   |  125 ------------------------------------
 arch/arm/mach-pxa/leds-mainstone.c |  120 ----------------------------------
 arch/arm/mach-pxa/leds.c           |   32 ---------
 arch/arm/mach-pxa/leds.h           |   13 ----
 arch/arm/mach-pxa/lubbock.c        |   90 ++++++++++++++++++++++++++
 arch/arm/mach-pxa/mainstone.c      |   89 +++++++++++++++++++++++++
 10 files changed, 272 insertions(+), 414 deletions(-)
 delete mode 100644 arch/arm/mach-pxa/leds-idp.c
 delete mode 100644 arch/arm/mach-pxa/leds-lubbock.c
 delete mode 100644 arch/arm/mach-pxa/leds-mainstone.c
 delete mode 100644 arch/arm/mach-pxa/leds.c
 delete mode 100644 arch/arm/mach-pxa/leds.h
arch/arm/mach-pxa/Kconfig +17 -0
index cd19309..111ade4 100644
@@ -8,11 +8,23 @@ config ARCH_LUBBOCK
 	bool "Intel DBPXA250 Development Platform (aka Lubbock)"
 	select PXA25x
 	select SA1111
+	select NEW_LEDS
+	select LEDS_CLASS
+	select LEDS_TRIGGERS
+	select LEDS_TRIGGER_CPU
+	select LEDS_TRIGGER_HEARTBEAT
+	select LEDS_TRIGGER_DEFAULT_ON
 
 config MACH_MAINSTONE
 	bool "Intel HCDDBBVA0 Development Platform (aka Mainstone)"
 	select PXA27x
 	select HAVE_PWM
+	select NEW_LEDS
+	select LEDS_CLASS
+	select LEDS_TRIGGERS
+	select LEDS_TRIGGER_CPU
+	select LEDS_TRIGGER_HEARTBEAT
+	select LEDS_TRIGGER_DEFAULT_ON
 
 config MACH_ZYLONITE
 	bool
@@ -59,6 +71,11 @@ comment "Third Party Dev Platforms (sorted by vendor name)"
 config ARCH_PXA_IDP
 	bool "Accelent Xscale IDP"
 	select PXA25x
+	select NEW_LEDS
+	select LEDS_CLASS
+	select LEDS_TRIGGERS
+	select LEDS_TRIGGER_CPU
+	select LEDS_TRIGGER_HEARTBEAT
 
 config ARCH_VIPER
 	bool "Arcom/Eurotech VIPER SBC"
arch/arm/mach-pxa/Makefile +0 -8
index cc39d17..2d42d23 100644
@@ -95,12 +95,4 @@ obj-$(CONFIG_MACH_RAUMFELD_CONNECTOR)	+= raumfeld.o
 obj-$(CONFIG_MACH_RAUMFELD_SPEAKER)	+= raumfeld.o
 obj-$(CONFIG_MACH_ZIPIT2)	+= z2.o
 
-# Support for blinky lights
-led-y := leds.o
-led-$(CONFIG_ARCH_LUBBOCK)	+= leds-lubbock.o
-led-$(CONFIG_MACH_MAINSTONE)	+= leds-mainstone.o
-led-$(CONFIG_ARCH_PXA_IDP)	+= leds-idp.o
-
-obj-$(CONFIG_LEDS)		+= $(led-y)
-
 obj-$(CONFIG_TOSA_BT)		+= tosa-bt.o
arch/arm/mach-pxa/idp.c +76 -0

82 lines not on this page · raw message

arch/arm/mach-pxa/leds-idp.c deleted +0 -116

116 lines not on this page · raw message

arch/arm/mach-pxa/leds-lubbock.c deleted +0 -125

125 lines not on this page · raw message

arch/arm/mach-pxa/leds-mainstone.c deleted +0 -120

120 lines not on this page · raw message

arch/arm/mach-pxa/leds.c deleted +0 -32
deleted file mode 100644
index bbe4d5f..0000000
@@ -1,32 +0,0 @@
-/*
- * linux/arch/arm/mach-pxa/leds.c
- *
- * xscale LEDs dispatcher
- *
- * Copyright (C) 2001 Nicolas Pitre
- *
- * Copyright (c) 2001 Jeff Sutherland, Accelent Systems Inc.
- */
-#include <linux/compiler.h>
-#include <linux/init.h>
-
-#include <asm/leds.h>
-#include <asm/mach-types.h>
-
-#include "leds.h"
-
-static int __init
-pxa_leds_init(void)
-{
-	if (machine_is_lubbock())
-		leds_event = lubbock_leds_event;
-	if (machine_is_mainstone())
-		leds_event = mainstone_leds_event;
-	if (machine_is_pxa_idp())
-		leds_event = idp_leds_event;
-
-	leds_event(led_start);
-	return 0;
-}
-
-core_initcall(pxa_leds_init);
arch/arm/mach-pxa/leds.h deleted +0 -13
deleted file mode 100644
index 7f0dfe0..0000000
@@ -1,13 +0,0 @@
-/*
- * arch/arm/mach-pxa/leds.h
- *
- * Copyright (c) 2001 Jeff Sutherland, Accelent Systems Inc.
- *
- * blinky lights for various PXA-based systems:
- *
- */
-
-extern void idp_leds_event(led_event_t evt);
-extern void lubbock_leds_event(led_event_t evt);
-extern void mainstone_leds_event(led_event_t evt);
-extern void trizeps4_leds_event(led_event_t evt);
arch/arm/mach-pxa/lubbock.c +90 -0

108 lines not on this page · raw message

arch/arm/mach-pxa/mainstone.c +89 -0

101 lines not on this page · raw message

Signature · 1 line
1.7.5
author
#37 lore raw

PATCH 12/17 mach-pxa: retire custom LED code

Quoted 5 lines · Russell King - ARM Linux
Quoted 1 line · Bryan Wu

Same comments.

Removed,

Thanks,

Signature · 5 lines
Bryan Wu <[email protected]>
Kernel Developer ? ?+86.138-1617-6545 Mobile
Ubuntu Kernel Team
Canonical Ltd. ? ? ?www.canonical.com
Ubuntu - Linux for human beings | www.ubuntu.com
author
#38 lore raw

PATCH 13/17 plat-samsung: remove including old leds event API header file

In reply to Bryan Wu
---
 arch/arm/plat-samsung/time.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
arch/arm/plat-samsung/time.c +0 -1
index 2231d80..bd9d42d 100644
@@ -29,7 +29,6 @@
 #include <linux/platform_device.h>
 
 #include <asm/system.h>
-#include <asm/leds.h>
 #include <asm/mach-types.h>
 
 #include <asm/irq.h>
Signature · 1 line
1.7.5
author
#39 lore raw

PATCH 14/17 mach-pnx4008: remove including old leds event API header file

In reply to Bryan Wu
---
 arch/arm/mach-pnx4008/time.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
arch/arm/mach-pnx4008/time.c +0 -1
index 0c8aad4..4385793 100644
@@ -26,7 +26,6 @@
 
 #include <asm/system.h>
 #include <mach/hardware.h>
-#include <asm/leds.h>
 #include <asm/mach/time.h>
 #include <asm/errno.h>
 
Signature · 1 line
1.7.5
author
#40 lore raw

PATCH 15/17 mach-omap1: retire custom LED code

In reply to Bryan Wu
---
 arch/arm/mach-omap1/Kconfig           |   21 +++
 arch/arm/mach-omap1/Makefile          |    8 -
 arch/arm/mach-omap1/board-h2.c        |   34 ++++-
 arch/arm/mach-omap1/board-h3.c        |   34 ++++-
 arch/arm/mach-omap1/board-osk.c       |   33 ++++
 arch/arm/mach-omap1/leds-h2p2-debug.c |  167 -------------------
 arch/arm/mach-omap1/leds-innovator.c  |   99 -----------
 arch/arm/mach-omap1/leds-osk.c        |  115 -------------
 arch/arm/mach-omap1/leds.c            |   69 --------
 arch/arm/mach-omap1/leds.h            |    3 -
 arch/arm/mach-omap1/time.c            |    1 -
 arch/arm/mach-omap1/timer32k.c        |    1 -
 arch/arm/plat-omap/Kconfig            |    9 +-
 arch/arm/plat-omap/debug-leds.c       |  292 ++++++++-------------------------
 14 files changed, 193 insertions(+), 693 deletions(-)
 delete mode 100644 arch/arm/mach-omap1/leds-h2p2-debug.c
 delete mode 100644 arch/arm/mach-omap1/leds-innovator.c
 delete mode 100644 arch/arm/mach-omap1/leds-osk.c
 delete mode 100644 arch/arm/mach-omap1/leds.c
 delete mode 100644 arch/arm/mach-omap1/leds.h
arch/arm/mach-omap1/Kconfig +21 -0
index e0a0281..df8b52a 100644
@@ -46,6 +46,11 @@ config MACH_OMAP_H2
 	bool "TI H2 Support"
 	depends on ARCH_OMAP1 && ARCH_OMAP16XX
 	select OMAP_MCBSP
+	select NEW_LEDS
+	select LEDS_CLASS
+	select LEDS_TRIGGERS
+	select LEDS_TRIGGER_CPU
+	select LEDS_TRIGGER_HEARTBEAT
     	help
 	  TI OMAP 1610/1611B H2 board support. Say Y here if you have such
 	  a board.
@@ -53,6 +58,11 @@ config MACH_OMAP_H2
 config MACH_OMAP_H3
 	bool "TI H3 Support"
 	depends on ARCH_OMAP1 && ARCH_OMAP16XX
+	select NEW_LEDS
+	select LEDS_CLASS
+	select LEDS_TRIGGERS
+	select LEDS_TRIGGER_CPU
+	select LEDS_TRIGGER_HEARTBEAT
     	help
 	  TI OMAP 1710 H3 board support. Say Y here if you have such
 	  a board.
@@ -73,6 +83,11 @@ config MACH_OMAP_OSK
 	bool "TI OSK Support"
 	depends on ARCH_OMAP1 && ARCH_OMAP16XX
 	select OMAP_MCBSP
+	select NEW_LEDS
+	select LEDS_CLASS
+	select LEDS_TRIGGERS
+	select LEDS_TRIGGER_CPU
+	select LEDS_TRIGGER_HEARTBEAT
     	help
 	  TI OMAP 5912 OSK (OMAP Starter Kit) board support. Say Y here
           if you have such a board.
@@ -88,6 +103,12 @@ config OMAP_OSK_MISTRAL
 config MACH_OMAP_PERSEUS2
 	bool "TI Perseus2"
 	depends on ARCH_OMAP1 && ARCH_OMAP730
+	select NEW_LEDS
+	select LEDS_CLASS
+	select LEDS_TRIGGERS
+	select LEDS_TRIGGER_CPU
+	select LEDS_TRIGGER_HEARTBEAT
+	select LEDS_TRIGGER_DEFAULT_ON
     	help
 	  Support for TI OMAP 730 Perseus2 board. Say Y here if you have such
 	  a board.
arch/arm/mach-omap1/Makefile +0 -8
index 5b114d1..4d2a140 100644
@@ -54,14 +54,6 @@ obj-$(CONFIG_ARCH_OMAP850)		+= gpio7xx.o
 obj-$(CONFIG_ARCH_OMAP15XX)		+= gpio15xx.o
 obj-$(CONFIG_ARCH_OMAP16XX)		+= gpio16xx.o
 
-# LEDs support
-led-$(CONFIG_MACH_OMAP_H2)		+= leds-h2p2-debug.o
-led-$(CONFIG_MACH_OMAP_H3)		+= leds-h2p2-debug.o
-led-$(CONFIG_MACH_OMAP_INNOVATOR)	+= leds-innovator.o
-led-$(CONFIG_MACH_OMAP_PERSEUS2)	+= leds-h2p2-debug.o
-led-$(CONFIG_MACH_OMAP_OSK)		+= leds-osk.o
-obj-$(CONFIG_LEDS)			+= $(led-y)
-
 ifneq ($(CONFIG_FB_OMAP),)
 obj-y += lcd_dma.o
 endif
arch/arm/mach-omap1/board-h2.c +33 -1
index ba3bd09..c5c9116 100644
@@ -30,9 +30,10 @@
 #include <linux/input.h>
 #include <linux/i2c/tps65010.h>
 #include <linux/smc91x.h>
+#include <linux/leds.h>
+#include <linux/gpio.h>
 
 #include <mach/hardware.h>
-#include <asm/gpio.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -331,6 +332,32 @@ static struct platform_device h2_lcd_device = {
 	.id		= -1,
 };
 
+static struct gpio_led h2_gpio_led_pins[] = {
+	{
+		.name		= "h2:red",
+		.default_trigger = "heartbeat",
+		.gpio		= 3,
+	},
+	{
+		.name		= "h2:green",
+		.default_trigger = "cpu",
+		.gpio		= OMAP_MPUIO(4),
+	},
+};
+
+static struct gpio_led_platform_data h2_gpio_led_data = {
+	.leds		= h2_gpio_led_pins,
+	.num_leds	= ARRAY_SIZE(h2_gpio_led_pins),
+};
+
+static struct platform_device h2_gpio_leds = {
+	.name	= "leds-gpio",
+	.id	= -1,
+	.dev	= {
+		.platform_data = &h2_gpio_led_data,
+	},
+};
+
 static struct platform_device *h2_devices[] __initdata = {
 	&h2_nor_device,
 	&h2_nand_device,
@@ -338,6 +365,7 @@ static struct platform_device *h2_devices[] __initdata = {
 	&h2_irda_device,
 	&h2_kp_device,
 	&h2_lcd_device,
+	&h2_gpio_leds,
 };
 
 static void __init h2_init_smc91x(void)
@@ -444,6 +472,10 @@ static void __init h2_init(void)
 	omap_cfg_reg(E19_1610_KBR4);
 	omap_cfg_reg(N19_1610_KBR5);
 
+	/* GPIO based LEDs */
+	omap_cfg_reg(P18_1610_GPIO3);
+	omap_cfg_reg(MPUIO4);
+
 	platform_add_devices(h2_devices, ARRAY_SIZE(h2_devices));
 	omap_board_config = h2_config;
 	omap_board_config_size = ARRAY_SIZE(h2_config);
arch/arm/mach-omap1/board-h3.c +33 -1
index ac48677..4bdc0a2 100644
@@ -30,11 +30,12 @@
 #include <linux/spi/spi.h>
 #include <linux/i2c/tps65010.h>
 #include <linux/smc91x.h>
+#include <linux/gpio.h>
+#include <linux/leds.h>
 
 #include <asm/setup.h>
 #include <asm/page.h>
 #include <mach/hardware.h>
-#include <asm/gpio.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -344,6 +345,32 @@ static struct spi_board_info h3_spi_board_info[] __initdata = {
 	},
 };
 
+static struct gpio_led h3_gpio_led_pins[] = {
+	{
+		.name		= "h3:red",
+		.default_trigger = "heartbeat",
+		.gpio		= 3,
+	},
+	{
+		.name		= "h3:green",
+		.default_trigger = "cpu",
+		.gpio		= OMAP_MPUIO(4),
+	},
+};
+
+static struct gpio_led_platform_data h3_gpio_led_data = {
+	.leds		= h3_gpio_led_pins,
+	.num_leds	= ARRAY_SIZE(h3_gpio_led_pins),
+};
+
+static struct platform_device h3_gpio_leds = {
+	.name	= "leds-gpio",
+	.id	= -1,
+	.dev	= {
+		.platform_data = &h3_gpio_led_data,
+	},
+};
+
 static struct platform_device *devices[] __initdata = {
 	&nor_device,
 	&nand_device,
@@ -351,6 +378,7 @@ static struct platform_device *devices[] __initdata = {
 	&intlat_device,
 	&h3_kp_device,
 	&h3_lcd_device,
+	&h3_gpio_leds,
 };
 
 static struct omap_usb_config h3_usb_config __initdata = {
@@ -424,6 +452,10 @@ static void __init h3_init(void)
 	omap_cfg_reg(E19_1610_KBR4);
 	omap_cfg_reg(N19_1610_KBR5);
 
+	/* GPIO based LEDs */
+	omap_cfg_reg(P18_1610_GPIO3);
+	omap_cfg_reg(MPUIO4);
+
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 	spi_register_board_info(h3_spi_board_info,
 				ARRAY_SIZE(h3_spi_board_info));
arch/arm/mach-omap1/board-osk.c +33 -0
index e68dfde..6051af1 100644
@@ -398,10 +398,37 @@ static struct platform_device osk5912_lcd_device = {
 	.id		= -1,
 };
 
+static struct gpio_led mistral_gpio_led_pins[] = {
+	{
+		.name		= "mistral:red",
+		.default_trigger = "heartbeat",
+		.gpio		= 3,
+	},
+	{
+		.name		= "mistral:green",
+		.default_trigger = "cpu",
+		.gpio		= OMAP_MPUIO(4),
+	},
+};
+
+static struct gpio_led_platform_data mistral_gpio_led_data = {
+	.leds		= mistral_gpio_led_pins,
+	.num_leds	= ARRAY_SIZE(mistral_gpio_led_pins),
+};
+
+static struct platform_device mistral_gpio_leds = {
+	.name	= "leds-gpio",
+	.id	= -1,
+	.dev	= {
+		.platform_data = &mistral_gpio_led_data,
+	},
+};
+
 static struct platform_device *mistral_devices[] __initdata = {
 	&osk5912_kp_device,
 	&mistral_bl_device,
 	&osk5912_lcd_device,
+	&mistral_gpio_leds,
 };
 
 static int mistral_get_pendown_state(void)
@@ -526,6 +553,12 @@ static void __init osk_mistral_init(void)
 	if (gpio_request(2, "lcd_pwr") == 0)
 		gpio_direction_output(2, 1);
 
+	/*
+	 * GPIO based LEDs
+	 */
+	omap_cfg_reg(P18_1610_GPIO3);
+	omap_cfg_reg(MPUIO4);
+
 	i2c_register_board_info(1, mistral_i2c_board_info,
 			ARRAY_SIZE(mistral_i2c_board_info));
 
arch/arm/mach-omap1/leds-h2p2-debug.c deleted +0 -167

167 lines not on this page · raw message

arch/arm/mach-omap1/leds-innovator.c deleted +0 -99

99 lines not on this page · raw message

arch/arm/mach-omap1/leds-osk.c deleted +0 -115

115 lines not on this page · raw message

arch/arm/mach-omap1/leds.c deleted +0 -69

69 lines not on this page · raw message

arch/arm/mach-omap1/leds.h deleted +0 -3
deleted file mode 100644
index a1e9fed..0000000
@@ -1,3 +0,0 @@
-extern void innovator_leds_event(led_event_t evt);
-extern void h2p2_dbg_leds_event(led_event_t evt);
-extern void osk_leds_event(led_event_t evt);
arch/arm/mach-omap1/time.c +0 -1
index 03e1e10..8974eb4 100644
@@ -47,7 +47,6 @@
 
 #include <asm/system.h>
 #include <mach/hardware.h>
-#include <asm/leds.h>
 #include <asm/irq.h>
 #include <asm/sched_clock.h>
 
arch/arm/mach-omap1/timer32k.c +0 -1
index 13d7b8f..1a8f77f 100644
@@ -48,7 +48,6 @@
 
 #include <asm/system.h>
 #include <mach/hardware.h>
-#include <asm/leds.h>
 #include <asm/irq.h>
 #include <asm/mach/irq.h>
 #include <asm/mach/time.h>
arch/arm/plat-omap/Kconfig +7 -2
index 49a4c75..8d4cf6b 100644
@@ -34,9 +34,14 @@ config OMAP_DEBUG_DEVICES
 	  For debug cards on TI reference boards.
 
 config OMAP_DEBUG_LEDS
-	bool
+	def_bool y
 	depends on OMAP_DEBUG_DEVICES
-	default y if LEDS_CLASS
+	select NEW_LEDS
+	select LEDS_CLASS
+	select LEDS_TRIGGERS
+	select LEDS_TRIGGER_CPU
+	select LEDS_TRIGGER_HEARTBEAT
+	select LEDS_TRIGGER_DEFAULT_ON
 
 config OMAP_SMARTREFLEX
 	bool "SmartReflex support"
arch/arm/plat-omap/debug-leds.c +66 -226

359 lines not on this page · raw message

Signature · 1 line
1.7.5
author
#42 lore raw

PATCH 16/17 mach-sa1100: retire custom LED code

In reply to Bryan Wu
---
 arch/arm/mach-sa1100/Kconfig        |   29 +++++++++
 arch/arm/mach-sa1100/Makefile       |   10 ---
 arch/arm/mach-sa1100/assabet.c      |   75 +++++++++++++++++++++++
 arch/arm/mach-sa1100/badge4.c       |   30 +++++++++
 arch/arm/mach-sa1100/cerf.c         |   42 +++++++++++++
 arch/arm/mach-sa1100/hackkit.c      |   32 ++++++++++
 arch/arm/mach-sa1100/lart.c         |   26 ++++++++
 arch/arm/mach-sa1100/leds-assabet.c |  114 -----------------------------------
 arch/arm/mach-sa1100/leds-badge4.c  |  111 ----------------------------------
 arch/arm/mach-sa1100/leds-cerf.c    |  110 ---------------------------------
 arch/arm/mach-sa1100/leds-hackkit.c |  112 ----------------------------------
 arch/arm/mach-sa1100/leds-lart.c    |  101 -------------------------------
 arch/arm/mach-sa1100/leds-simpad.c  |  100 ------------------------------
 arch/arm/mach-sa1100/leds.c         |   52 ----------------
 arch/arm/mach-sa1100/leds.h         |   14 ----
 arch/arm/mach-sa1100/simpad.c       |   48 +++++++++++++++
 16 files changed, 282 insertions(+), 724 deletions(-)
 delete mode 100644 arch/arm/mach-sa1100/leds-assabet.c
 delete mode 100644 arch/arm/mach-sa1100/leds-badge4.c
 delete mode 100644 arch/arm/mach-sa1100/leds-cerf.c
 delete mode 100644 arch/arm/mach-sa1100/leds-hackkit.c
 delete mode 100644 arch/arm/mach-sa1100/leds-lart.c
 delete mode 100644 arch/arm/mach-sa1100/leds-simpad.c
 delete mode 100644 arch/arm/mach-sa1100/leds.c
 delete mode 100644 arch/arm/mach-sa1100/leds.h
arch/arm/mach-sa1100/Kconfig +29 -0
index 42625e4..266fce9 100644
@@ -5,6 +5,11 @@ menu "SA11x0 Implementations"
 config SA1100_ASSABET
 	bool "Assabet"
 	select CPU_FREQ_SA1110
+	select NEW_LEDS
+	select LEDS_CLASS
+	select LEDS_TRIGGERS
+	select LEDS_TRIGGER_CPU
+	select LEDS_TRIGGER_HEARTBEAT
 	help
 	  Say Y here if you are using the Intel(R) StrongARM(R) SA-1110
 	  Microprocessor Development Board (also known as the Assabet).
@@ -21,6 +26,12 @@ config ASSABET_NEPONSET
 config SA1100_CERF
 	bool "CerfBoard"
 	select CPU_FREQ_SA1110
+	select NEW_LEDS
+	select LEDS_CLASS
+	select LEDS_TRIGGERS
+	select LEDS_TRIGGER_CPU
+	select LEDS_TRIGGER_HEARTBEAT
+	select LEDS_TRIGGER_DEFAULT_ON
 	help
 	  The Intrinsyc CerfBoard is based on the StrongARM 1110 (Discontinued).
 	  More information is available at:
@@ -80,6 +91,11 @@ config SA1100_BADGE4
 	bool "HP Labs BadgePAD 4"
 	select SA1111
 	select CPU_FREQ_SA1100
+	select NEW_LEDS
+	select LEDS_CLASS
+	select LEDS_TRIGGERS
+	select LEDS_TRIGGER_CPU
+	select LEDS_TRIGGER_HEARTBEAT
 	help
 	  Say Y here if you want to build a kernel for the HP Laboratories
 	  BadgePAD 4.
@@ -106,6 +122,11 @@ config SA1100_JORNADA720_SSP
 config SA1100_HACKKIT
 	bool "HackKit Core CPU Board"
 	select CPU_FREQ_SA1100
+	select NEW_LEDS
+	select LEDS_CLASS
+	select LEDS_TRIGGERS
+	select LEDS_TRIGGER_CPU
+	select LEDS_TRIGGER_HEARTBEAT
 	help
 	  Say Y here to support the HackKit Core CPU Board
 	  <http://hackkit.eletztrick.de>;
@@ -113,6 +134,10 @@ config SA1100_HACKKIT
 config SA1100_LART
 	bool "LART"
 	select CPU_FREQ_SA1100
+	select NEW_LEDS
+	select LEDS_CLASS
+	select LEDS_TRIGGERS
+	select LEDS_TRIGGER_CPU
 	help
 	  Say Y here if you are using the Linux Advanced Radio Terminal
 	  (also known as the LART).  See <http://www.lartmaker.nl/> for
@@ -149,6 +174,10 @@ config SA1100_SHANNON
 config SA1100_SIMPAD
 	bool "Simpad"
 	select CPU_FREQ_SA1110
+	select NEW_LEDS
+	select LEDS_CLASS
+	select LEDS_TRIGGERS
+	select LEDS_TRIGGER_HEARTBEAT
 	help
 	  The SIEMENS webpad SIMpad is based on the StrongARM 1110. There
 	  are two different versions CL4 and SL4. CL4 has 32MB RAM and 16MB
arch/arm/mach-sa1100/Makefile +0 -10
index 41252d2..5f5f491 100644
@@ -7,21 +7,17 @@ obj-y := clock.o generic.o gpio.o irq.o dma.o time.o #nmi-oopser.o
 obj-m :=
 obj-n :=
 obj-  :=
-led-y := leds.o
 
 obj-$(CONFIG_CPU_FREQ_SA1100)		+= cpu-sa1100.o
 obj-$(CONFIG_CPU_FREQ_SA1110)		+= cpu-sa1110.o
 
 # Specific board support
 obj-$(CONFIG_SA1100_ASSABET)		+= assabet.o
-led-$(CONFIG_SA1100_ASSABET)		+= leds-assabet.o
 obj-$(CONFIG_ASSABET_NEPONSET)		+= neponset.o
 
 obj-$(CONFIG_SA1100_BADGE4)		+= badge4.o
-led-$(CONFIG_SA1100_BADGE4)		+= leds-badge4.o
 
 obj-$(CONFIG_SA1100_CERF)		+= cerf.o
-led-$(CONFIG_SA1100_CERF)		+= leds-cerf.o
 
 obj-$(CONFIG_SA1100_COLLIE)		+= collie.o
 
@@ -29,13 +25,11 @@ obj-$(CONFIG_SA1100_H3100)		+= h3100.o h3xxx.o
 obj-$(CONFIG_SA1100_H3600)		+= h3600.o h3xxx.o
 
 obj-$(CONFIG_SA1100_HACKKIT)		+= hackkit.o
-led-$(CONFIG_SA1100_HACKKIT)		+= leds-hackkit.o
 
 obj-$(CONFIG_SA1100_JORNADA720)		+= jornada720.o
 obj-$(CONFIG_SA1100_JORNADA720_SSP)	+= jornada720_ssp.o
 
 obj-$(CONFIG_SA1100_LART)		+= lart.o
-led-$(CONFIG_SA1100_LART)		+= leds-lart.o
 
 obj-$(CONFIG_SA1100_NANOENGINE)		+= nanoengine.o
 obj-$(CONFIG_PCI_NANOENGINE)		+= pci-nanoengine.o
@@ -45,10 +39,6 @@ obj-$(CONFIG_SA1100_PLEB)		+= pleb.o
 obj-$(CONFIG_SA1100_SHANNON)		+= shannon.o
 
 obj-$(CONFIG_SA1100_SIMPAD)		+= simpad.o
-led-$(CONFIG_SA1100_SIMPAD)		+= leds-simpad.o
-
-# LEDs support
-obj-$(CONFIG_LEDS) += $(led-y)
 
 # Miscellaneous functions
 obj-$(CONFIG_PM)			+= pm.o sleep.o
arch/arm/mach-sa1100/assabet.c +75 -0

87 lines not on this page · raw message

arch/arm/mach-sa1100/badge4.c +30 -0
index 4f19ff8..0711c30 100644
@@ -22,6 +22,8 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <linux/errno.h>
+#include <linux/gpio.h>
+#include <linux/leds.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -69,8 +71,36 @@ static struct platform_device sa1111_device = {
 	.resource	= sa1111_resources,
 };
 
+/* LEDs */
+struct gpio_led badge4_gpio_leds[] = {
+	{
+		.name			= "badge4:red",
+		.default_trigger	= "heartbeat",
+		.gpio			= 7,
+	},
+	{
+		.name			= "badge4:green",
+		.default_trigger	= "cpu",
+		.gpio			= 9,
+	},
+};
+
+static struct gpio_led_platform_data badge4_gpio_led_info = {
+	.leds		= badge4_gpio_leds,
+	.num_leds	= ARRAY_SIZE(badge4_gpio_leds),
+};
+
+static struct platform_device badge4_leds = {
+	.name	= "leds-gpio",
+	.id	= -1,
+	.dev	= {
+		.platform_data	= &badge4_gpio_led_info,
+	}
+};
+
 static struct platform_device *devices[] __initdata = {
 	&sa1111_device,
+	&badge4_leds;
 };
 
 static int __init badge4_sa1111_init(void)
arch/arm/mach-sa1100/cerf.c +42 -0

56 lines not on this page · raw message

arch/arm/mach-sa1100/hackkit.c +32 -0
index db5e434..1661f2e 100644
@@ -21,6 +21,10 @@
 #include <linux/serial_core.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
+#include <linux/tty.h>
+#include <linux/gpio.h>
+#include <linux/leds.h>
+#include <linux/platform_device.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -185,9 +189,37 @@ static struct resource hackkit_flash_resource = {
 	.flags		= IORESOURCE_MEM,
 };
 
+/* LEDs */
+struct gpio_led hackkit_gpio_leds[] = {
+	{
+		.name			= "hackkit:red",
+		.default_trigger	= "cpu",
+		.gpio			= 22,
+	},
+	{
+		.name			= "hackkit:green",
+		.default_trigger	= "heartbeat",
+		.gpio			= 23,
+	},
+};
+
+static struct gpio_led_platform_data hackkit_gpio_led_info = {
+	.leds		= hackkit_gpio_leds,
+	.num_leds	= ARRAY_SIZE(hackkit_gpio_leds),
+};
+
+static struct platform_device hackkit_leds = {
+	.name	= "leds-gpio",
+	.id	= -1,
+	.dev	= {
+		.platform_data	= &hackkit_gpio_led_info,
+	}
+};
+
 static void __init hackkit_init(void)
 {
 	sa11x0_register_mtd(&hackkit_flash_data, &hackkit_flash_resource, 1);
+	platform_device_register(&hackkit_leds);
 }
 
 /**********************************************************************
arch/arm/mach-sa1100/lart.c +26 -0
index 7b9556b..1678fa5 100644
@@ -5,6 +5,9 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/tty.h>
+#include <linux/gpio.h>
+#include <linux/leds.h>
+#include <linux/platform_device.h>
 
 #include <mach/hardware.h>
 #include <asm/setup.h>
@@ -45,6 +48,27 @@ static struct map_desc lart_io_desc[] __initdata = {
 	}
 };
 
+/* LEDs */
+struct gpio_led lart_gpio_leds[] = {
+	{
+		.name			= "lart:red",
+		.default_trigger	= "cpu",
+		.gpio			= 23,
+	},
+};
+
+static struct gpio_led_platform_data lart_gpio_led_info = {
+	.leds		= lart_gpio_leds,
+	.num_leds	= ARRAY_SIZE(lart_gpio_leds),
+};
+
+static struct platform_device lart_leds = {
+	.name	= "leds-gpio",
+	.id	= -1,
+	.dev	= {
+		.platform_data	= &lart_gpio_led_info,
+	}
+};
 static void __init lart_map_io(void)
 {
 	sa1100_map_io();
@@ -58,6 +82,8 @@ static void __init lart_map_io(void)
 	GPDR |= GPIO_UART_TXD;
 	GPDR &= ~GPIO_UART_RXD;
 	PPAR |= PPAR_UPR;
+
+	platform_device_register(&lart_leds);
 }
 
 MACHINE_START(LART, "LART")
arch/arm/mach-sa1100/leds-assabet.c deleted +0 -114

114 lines not on this page · raw message

arch/arm/mach-sa1100/leds-badge4.c deleted +0 -111

111 lines not on this page · raw message

arch/arm/mach-sa1100/leds-cerf.c deleted +0 -110

110 lines not on this page · raw message

arch/arm/mach-sa1100/leds-hackkit.c deleted +0 -112

112 lines not on this page · raw message

arch/arm/mach-sa1100/leds-lart.c deleted +0 -101

101 lines not on this page · raw message

arch/arm/mach-sa1100/leds-simpad.c deleted +0 -100

100 lines not on this page · raw message

arch/arm/mach-sa1100/leds.c deleted +0 -52

52 lines not on this page · raw message

arch/arm/mach-sa1100/leds.h deleted +0 -14
deleted file mode 100644
index 68cc9f7..0000000
@@ -1,14 +0,0 @@
-extern void assabet_leds_event(led_event_t evt);
-extern void badge4_leds_event(led_event_t evt);
-extern void consus_leds_event(led_event_t evt);
-extern void brutus_leds_event(led_event_t evt);
-extern void cerf_leds_event(led_event_t evt);
-extern void flexanet_leds_event(led_event_t evt);
-extern void graphicsclient_leds_event(led_event_t evt);
-extern void hackkit_leds_event(led_event_t evt);
-extern void lart_leds_event(led_event_t evt);
-extern void pfs168_leds_event(led_event_t evt);
-extern void graphicsmaster_leds_event(led_event_t evt);
-extern void adsbitsy_leds_event(led_event_t evt);
-extern void system3_leds_event(led_event_t evt);
-extern void simpad_leds_event(led_event_t evt);
arch/arm/mach-sa1100/simpad.c +48 -0

61 lines not on this page · raw message

Signature · 1 line
1.7.5
#43 lore raw

PATCH 16/17 mach-sa1100: retire custom LED code

Quoted 25 lines · Bryan Wu
arch/arm/mach-sa1100/simpad.c +9 -0
index cfb7607..6f87258 100644
@@ -13,6 +13,8 @@
  #include<linux/mtd/mtd.h>
  #include<linux/mtd/partitions.h>
  #include<linux/io.h>
+#include<linux/leds.h>
+#include<linux/slab.h>
 
  #include<asm/irq.h>
  #include<mach/hardware.h>
@@ -205,7 +207,53 @@ static struct platform_device *devices[] __initdata = {
  	&simpad_mq200fb
  };
 
+/* LEDs */
+#define LED_GREEN	1
 
+static void simpad_led_set(struct led_classdev *cdev,
+			      enum led_brightness b)
+{
+	if (b != LED_OFF)
+		set_cs3_bit(LED_GREEN);

arch/arm/mach-sa1100/simpad.c static struct platform_device *devices[] __initdata = { · line 227

Quoted 10 lines
arch/arm/mach-sa1100/simpad.c +10 -0
+	else
+		clear_cs3_bit(LED_GREEN);
+}
+
+static enum led_brightness simpad_led_get(struct led_classdev *cdev)
+{
+	u32 reg = *(CS3BUSTYPE *)(CS3_BASE);
+
+	return (reg&  LED_GREEN) ? LED_FULL : LED_OFF;
+}

NACK, bit 1 on the CS3 register is PCMCIA power control (write) and PCMCIA BVD1 (read), but not LED_GREEN. LED2_ON would be correct for write, but you would need to read cs3_shadow instead of the register itself for the LED status.

BTW: Some time ago I wrote a similar patch for ARM that converts CS3 functions to GPIOs, wich simplifies the LED stuff even further ;-)

http://www.spinics.net/lists/arm-kernel/msg122479.html

Thanks,
Jochen

author
#44 lore raw

PATCH 16/17 mach-sa1100: retire custom LED code

Quoted 35 lines · Jochen Friedrich
Quoted 33 lines · Bryan Wu
arch/arm/mach-sa1100/simpad.c +0 -0
index cfb7607..6f87258 100644
@@ -13,6 +13,8 @@

?#include<linux/mtd/mtd.h>
?#include<linux/mtd/partitions.h>
?#include<linux/io.h>

arch/arm/mach-sa1100/simpad.c +2 -0
+#include<linux/leds.h>
+#include<linux/slab.h>

?#include<asm/irq.h>
?#include<mach/hardware.h>

arch/arm/mach-sa1100/simpad.c +0 -0
@@ -205,7 +207,53 @@ static struct platform_device *devices[] __initdata =
 {

? ? ? ?&simpad_mq200fb
?};

arch/arm/mach-sa1100/simpad.c +14 -0
+/* LEDs */
+#define LED_GREEN ? ? ?1
 
+static void simpad_led_set(struct led_classdev *cdev,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? enum led_brightness b)
+{
+ ? ? ? if (b != LED_OFF)
+ ? ? ? ? ? ? ? set_cs3_bit(LED_GREEN);
+ ? ? ? else
+ ? ? ? ? ? ? ? clear_cs3_bit(LED_GREEN);
+}
+
+static enum led_brightness simpad_led_get(struct led_classdev *cdev)
+{
+ ? ? ? u32 reg = *(CS3BUSTYPE *)(CS3_BASE);
Quoted 9 lines

arch/arm/mach-sa1100/simpad.c

Quoted 3 lines
arch/arm/mach-sa1100/simpad.c +3 -0
+
+ ? ? ? return (reg& ?LED_GREEN) ? LED_FULL : LED_OFF;
+}

NACK, bit 1 on the CS3 register is PCMCIA power control (write) and PCMCIA BVD1 (read), but not LED_GREEN. LED2_ON would be correct for write, but you would need to read cs3_shadow instead of the register itself for the LED status.

Actually, I'm not familiar with this hardware in details. Thanks for pointing out.

Quoted 5 lines

BTW: Some time ago I wrote a similar patch for ARM that converts CS3 functions to GPIOs, wich simplifies the LED stuff even further ;-)

http://www.spinics.net/lists/arm-kernel/msg122479.html

This looks good and it's the right way to do that. We need gpiolib supporting firstly. How's status of your patchset, I guess you're trying to update it.

Thanks,

Signature · 5 lines
Bryan Wu <[email protected]>
Kernel Developer ? ?+86.138-1617-6545 Mobile
Ubuntu Kernel Team
Canonical Ltd. ? ? ?www.canonical.com
Ubuntu - Linux for human beings | www.ubuntu.com
#45 lore raw

PATCH 16/17 mach-sa1100: retire custom LED code

Hi Bryan,

Quoted 3 lines

This looks good and it's the right way to do that. We need gpiolib supporting firstly. How's status of your patchset, I guess you're trying to update it.

I've resubmitted it yesterday for another review. In parallel, I'll retest this on top of 3.0-rc5 on real hardware and ask Russell if it's OK to submit to his patch tracker.

Thanks,
Jochen

author
#46 lore raw

PATCH 16/17 mach-sa1100: retire custom LED code

Quoted 10 lines · Jochen Friedrich

Hi Bryan,

Quoted 3 lines

This looks good and it's the right way to do that. We need gpiolib supporting firstly. How's status of your patchset, I guess you're trying to update it.

I've resubmitted it yesterday for another review. In parallel, I'll retest this on top of 3.0-rc5 on real hardware and ask Russell if it's OK to submit to his patch tracker.

Great, I will remove my modification of simpad code in my patchset.

Thanks,

Signature · 5 lines
Bryan Wu <[email protected]>
Kernel Developer ? ?+86.138-1617-6545 Mobile
Ubuntu Kernel Team
Canonical Ltd. ? ? ?www.canonical.com
Ubuntu - Linux for human beings | www.ubuntu.com
#47 lore raw

PATCH 16/17 mach-sa1100: retire custom LED code

Hi Bryan,

Quoted 3 lines
Quoted 3 lines

I've resubmitted it yesterday for another review. In parallel, I'll retest this on top of 3.0-rc5 on real hardware and ask Russell if it's OK to submit to his patch tracker.

after fixing ARMv4 support for EABI in OpenWRT once again ;-), I just successfully retested the patchset on my CL4 SIMpad.

@Russell: is it OK to submit this to the patch tracking system?

Quoted 1 line

Great, I will remove my modification of simpad code in my patchset.

Thanks,
Jochen

#48 lore raw

PATCH 16/17 mach-sa1100: retire custom LED code

Quoted 1 line · Jochen Friedrich

@Russell: is it OK to submit this to the patch tracking system?

I can't say at the moment as I'm swamped with email. I was already swamped this morning, but since then some nice person at develtech.com has misconfigured their M$ Exchange server which has been dumping emails from the last six months back in my mailbox. The problem is that I've been out this afternoon and so wasn't around to notice.

I've had to firewall their ISPs mail servers from my system to stop the deluge, which I think may have also cut at least Wim Van Sebroeck off.

Nevertheless, the result isn't pretty at this end (so far spent an hour on it sorting out the mess), and its only luck that I happened to spot your message.

This is one of the times when I wish M$ didn't make stuff "easy to use" - the person running that system probably doesn't even realize what they've done. Computers are dangerous tools in the hands of people who don't really understand what they're doing.

#49 lore raw

PATCH 16/17 mach-sa1100: retire custom LED code

In reply to Bryan Wu
Quoted 80 lines · Bryan Wu
arch/arm/mach-sa1100/assabet.c +65 -0
index 5778274..13e4e5d 100644
@@ -19,6 +19,8 @@
 #include <linux/mtd/partitions.h>
 #include <linux/delay.h>
 #include <linux/mm.h>
+#include <linux/leds.h>
+#include <linux/slab.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -445,6 +447,79 @@ static void __init assabet_map_io(void)
 	sa1100_register_uart(2, 3);
 }
 
+/* LEDs */
+struct assabet_led {
+	struct led_classdev cdev;
+	u32 mask;
+};
+
+/*
+ * The triggers lines up below will only be used if the
+ * LED triggers are compiled in.
+ */
+static const struct {
+	const char *name;
+	const char *trigger;
+} assabet_leds[] = {
+	{ "assabet:red", "cpu",},
+	{ "assabet:green", "heartbeat", },
+};
+
+static void assabet_led_set(struct led_classdev *cdev,
+		enum led_brightness b)
+{
+	struct assabet_led *led = container_of(cdev,
+			struct assabet_led, cdev);
+
+	if (b != LED_OFF)
+		ASSABET_BCR_clear(led->mask);
+	else
+		ASSABET_BCR_set(led->mask);
+}
+
+static enum led_brightness assabet_led_get(struct led_classdev *cdev)
+{
+	struct assabet_led *led = container_of(cdev,
+			struct assabet_led, cdev);
+
+	return (ASSABET_BCR & led->mask) ? LED_OFF : LED_FULL;
+}
+
+static int __init assabet_leds_init(void)
+{
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(assabet_leds); i++) {
+		struct assabet_led *led;
+
+		led = kzalloc(sizeof(*led), GFP_KERNEL);
+		if (!led)
+			break;
+
+		led->cdev.name = assabet_leds[i].name;
+		led->cdev.brightness_set = assabet_led_set;
+		led->cdev.brightness_get = assabet_led_get;
+		led->cdev.default_trigger = assabet_leds[i].trigger;
+
+		if (!i)
+			led->mask = ASSABET_BCR_LED_RED;
+		else
+			led->mask = ASSABET_BCR_LED_GREEN;
+
+		if (led_classdev_register(NULL, &led->cdev) < 0) {
+			kfree(led);
+			break;
+		}

arch/arm/mach-sa1100/assabet.c static void __init assabet_map_io(void) · line 522

Quoted 10 lines
arch/arm/mach-sa1100/assabet.c +10 -0
+	}
+
+	return 0;
+}
+
+/*
+ * Since we may have triggers on any subsystem, defer registration
+ * until after subsystem_init.
+ */
+fs_initcall(assabet_leds_init);

This is buggy. init functions are called irrespective of what platform we're running on, so this means if assabet is built in to the kernel, then we'll register its LEDs and try to access the BCR register irrespective of whether we are on assabet or not.

Quoted 54 lines
arch/arm/mach-sa1100/simpad.c +38 -0
index cfb7607..6f87258 100644
@@ -13,6 +13,8 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <linux/io.h>
+#include <linux/leds.h>
+#include <linux/slab.h>
 
 #include <asm/irq.h>
 #include <mach/hardware.h>
@@ -205,7 +207,53 @@ static struct platform_device *devices[] __initdata = {
 	&simpad_mq200fb
 };
 
+/* LEDs */
+#define LED_GREEN	1
 
+static void simpad_led_set(struct led_classdev *cdev,
+			      enum led_brightness b)
+{
+	if (b != LED_OFF)
+		set_cs3_bit(LED_GREEN);
+	else
+		clear_cs3_bit(LED_GREEN);
+}
+
+static enum led_brightness simpad_led_get(struct led_classdev *cdev)
+{
+	u32 reg = *(CS3BUSTYPE *)(CS3_BASE);
+
+	return (reg & LED_GREEN) ? LED_FULL : LED_OFF;
+}
+
+static int __init simpad_leds_init(void)
+{
+	struct led_classdev *simpad_led;
+	int ret;
+
+	simpad_led = kzalloc(sizeof(*simpad_led), GFP_KERNEL);
+	if (!simpad_led)
+		return -ENOMEM;
+
+	simpad_led->name = "simpad:green";
+	simpad_led->brightness_set = simpad_led_set;
+	simpad_led->brightness_get = simpad_led_get;
+	simpad_led->default_trigger = "heartbeat";
+
+	ret = led_classdev_register(NULL, simpad_led);
+	if (ret < 0) {
+		kfree(simpad_led);
+		return ret;

arch/arm/mach-sa1100/simpad.c static struct platform_device *devices[] __initdata = { · line 256

Quoted 10 lines
arch/arm/mach-sa1100/simpad.c +10 -0
+	}
+
+	return 0;
+}
+
+/*
+ * Since we may have triggers on any subsystem, defer registration
+ * until after subsystem_init.
+ */
+fs_initcall(simpad_leds_init);

Looks like simpad is similarly afflicted. I haven't gone through the rest to check for similar issues.

#50 lore raw

PATCH 16/17 mach-sa1100: retire custom LED code

Hi Russell,

Quoted 4 lines
Quoted 1 line

+fs_initcall(simpad_leds_init);

Looks like simpad is similarly afflicted. I haven't gone through the rest to check for similar issues.

simpad is buggy in other means, as well (wrong bit, read of write-only register, missing locking). That's why I want to push my CS3 cleanup patch first, converting a custom IO to standard GPIO ;-)

Thanks,
Jochen

author
#51 lore raw

PATCH 16/17 mach-sa1100: retire custom LED code

Quoted 11 lines · Jochen Friedrich

Hi Russell,

Quoted 4 lines
Quoted 1 line

+fs_initcall(simpad_leds_init);

Looks like simpad is similarly afflicted. ?I haven't gone through the rest to check for similar issues.

simpad is buggy in other means, as well (wrong bit, read of write-only register, missing locking). That's why I want to push my CS3 cleanup patch first, converting a custom IO to standard GPIO ;-)

if you can use this GPIO based gpio_led driver, there is not such fs_initcall issue.

Thanks,

Signature · 5 lines
Bryan Wu <[email protected]>
Kernel Developer ? ?+86.138-1617-6545 Mobile
Ubuntu Kernel Team
Canonical Ltd. ? ? ?www.canonical.com
Ubuntu - Linux for human beings | www.ubuntu.com
author
#52 lore raw

PATCH 16/17 mach-sa1100: retire custom LED code

In reply to Russell King - ARM Linux
Quoted 88 lines · Russell King - ARM Linux
Quoted 87 lines · Bryan Wu
arch/arm/mach-sa1100/assabet.c +0 -0
index 5778274..13e4e5d 100644
@@ -19,6 +19,8 @@

?#include <linux/mtd/partitions.h>
?#include <linux/delay.h>
?#include <linux/mm.h>

arch/arm/mach-sa1100/assabet.c +2 -0
+#include <linux/leds.h>
+#include <linux/slab.h>

?#include <mach/hardware.h>
?#include <asm/mach-types.h>

arch/arm/mach-sa1100/assabet.c +70 -0
@@ -445,6 +447,79 @@ static void __init assabet_map_io(void)
 ? ? ? sa1100_register_uart(2, 3);
 ?}
 
+/* LEDs */
+struct assabet_led {
+ ? ? struct led_classdev cdev;
+ ? ? u32 mask;
+};
+
+/*
+ * The triggers lines up below will only be used if the
+ * LED triggers are compiled in.
+ */
+static const struct {
+ ? ? const char *name;
+ ? ? const char *trigger;
+} assabet_leds[] = {
+ ? ? { "assabet:red", "cpu",},
+ ? ? { "assabet:green", "heartbeat", },
+};
+
+static void assabet_led_set(struct led_classdev *cdev,
+ ? ? ? ? ? ? enum led_brightness b)
+{
+ ? ? struct assabet_led *led = container_of(cdev,
+ ? ? ? ? ? ? ? ? ? ? struct assabet_led, cdev);
+
+ ? ? if (b != LED_OFF)
+ ? ? ? ? ? ? ASSABET_BCR_clear(led->mask);
+ ? ? else
+ ? ? ? ? ? ? ASSABET_BCR_set(led->mask);
+}
+
+static enum led_brightness assabet_led_get(struct led_classdev *cdev)
+{
+ ? ? struct assabet_led *led = container_of(cdev,
+ ? ? ? ? ? ? ? ? ? ? struct assabet_led, cdev);
+
+ ? ? return (ASSABET_BCR & led->mask) ? LED_OFF : LED_FULL;
+}
+
+static int __init assabet_leds_init(void)
+{
+ ? ? int i;
+
+ ? ? for (i = 0; i < ARRAY_SIZE(assabet_leds); i++) {
+ ? ? ? ? ? ? struct assabet_led *led;
+
+ ? ? ? ? ? ? led = kzalloc(sizeof(*led), GFP_KERNEL);
+ ? ? ? ? ? ? if (!led)
+ ? ? ? ? ? ? ? ? ? ? break;
+
+ ? ? ? ? ? ? led->cdev.name = assabet_leds[i].name;
+ ? ? ? ? ? ? led->cdev.brightness_set = assabet_led_set;
+ ? ? ? ? ? ? led->cdev.brightness_get = assabet_led_get;
+ ? ? ? ? ? ? led->cdev.default_trigger = assabet_leds[i].trigger;
+
+ ? ? ? ? ? ? if (!i)
+ ? ? ? ? ? ? ? ? ? ? led->mask = ASSABET_BCR_LED_RED;
+ ? ? ? ? ? ? else
+ ? ? ? ? ? ? ? ? ? ? led->mask = ASSABET_BCR_LED_GREEN;
+
+ ? ? ? ? ? ? if (led_classdev_register(NULL, &led->cdev) < 0) {
+ ? ? ? ? ? ? ? ? ? ? kfree(led);
+ ? ? ? ? ? ? ? ? ? ? break;
+ ? ? ? ? ? ? }
+ ? ? }
+
+ ? ? return 0;
+}
+
+/*
+ * Since we may have triggers on any subsystem, defer registration
Quoted 9 lines

arch/arm/mach-sa1100/assabet.c static void __init assabet_map_io(void) · line 522

Quoted 3 lines
arch/arm/mach-sa1100/assabet.c +3 -0
+ * until after subsystem_init.
+ */
+fs_initcall(assabet_leds_init);

This is buggy. ?init functions are called irrespective of what platform we're running on, so this means if assabet is built in to the kernel, then we'll register its LEDs and try to access the BCR register irrespective of whether we are on assabet or not.

Right, I got it. So if we are going to run a single binary for all the sa1100 machines, how about we check the machine in each fs_initcall

static int __init assabet_leds_init(void)
{
? ? int i;

     if (!machine_is_assabet())
          return -ENODEV,

? ? for (i = 0; i < ARRAY_SIZE(assabet_leds); i++) { ? ? ? ? ? ? struct assabet_led *led;

Thanks,

Quoted 73 lines
Quoted 54 lines
arch/arm/mach-sa1100/simpad.c +0 -0
index cfb7607..6f87258 100644
@@ -13,6 +13,8 @@

?#include <linux/mtd/mtd.h>
?#include <linux/mtd/partitions.h>
?#include <linux/io.h>

arch/arm/mach-sa1100/simpad.c +2 -0
+#include <linux/leds.h>
+#include <linux/slab.h>

?#include <asm/irq.h>
?#include <mach/hardware.h>

arch/arm/mach-sa1100/simpad.c +0 -0
@@ -205,7 +207,53 @@ static struct platform_device *devices[] __initdata = {

? ? ? &simpad_mq200fb
?};

arch/arm/mach-sa1100/simpad.c +36 -0
+/* LEDs */
+#define LED_GREEN ? ?1
 
+static void simpad_led_set(struct led_classdev *cdev,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? enum led_brightness b)
+{
+ ? ? if (b != LED_OFF)
+ ? ? ? ? ? ? set_cs3_bit(LED_GREEN);
+ ? ? else
+ ? ? ? ? ? ? clear_cs3_bit(LED_GREEN);
+}
+
+static enum led_brightness simpad_led_get(struct led_classdev *cdev)
+{
+ ? ? u32 reg = *(CS3BUSTYPE *)(CS3_BASE);
+
+ ? ? return (reg & LED_GREEN) ? LED_FULL : LED_OFF;
+}
+
+static int __init simpad_leds_init(void)
+{
+ ? ? struct led_classdev *simpad_led;
+ ? ? int ret;
+
+ ? ? simpad_led = kzalloc(sizeof(*simpad_led), GFP_KERNEL);
+ ? ? if (!simpad_led)
+ ? ? ? ? ? ? return -ENOMEM;
+
+ ? ? simpad_led->name = "simpad:green";
+ ? ? simpad_led->brightness_set = simpad_led_set;
+ ? ? simpad_led->brightness_get = simpad_led_get;
+ ? ? simpad_led->default_trigger = "heartbeat";
+
+ ? ? ret = led_classdev_register(NULL, simpad_led);
+ ? ? if (ret < 0) {
+ ? ? ? ? ? ? kfree(simpad_led);
+ ? ? ? ? ? ? return ret;

arch/arm/mach-sa1100/simpad.c static struct platform_device *devices[] __initdata = { · line 256

Quoted 10 lines
arch/arm/mach-sa1100/simpad.c +10 -0
+ ? ? }
+
+ ? ? return 0;
+}
+
+/*
+ * Since we may have triggers on any subsystem, defer registration
+ * until after subsystem_init.
+ */
+fs_initcall(simpad_leds_init);

Looks like simpad is similarly afflicted. ?I haven't gone through the rest to check for similar issues.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Signature · 5 lines
Bryan Wu <[email protected]>
Kernel Developer ? ?+86.138-1617-6545 Mobile
Ubuntu Kernel Team
Canonical Ltd. ? ? ?www.canonical.com
Ubuntu - Linux for human beings | www.ubuntu.com
#53 lore raw

PATCH 16/17 mach-sa1100: retire custom LED code

Quoted 7 lines · Bryan Wu

Right, I got it. So if we are going to run a single binary for all the sa1100 machines, how about we check the machine in each fs_initcall

static int __init assabet_leds_init(void)
{
? ? int i;

Quoted 5 lines
     if (!machine_is_assabet())
          return -ENODEV,

? ? for (i = 0; i < ARRAY_SIZE(assabet_leds); i++) { ? ? ? ? ? ? struct assabet_led *led;

Yes, that'll do, thanks.

#54 lore raw

PATCH 16/17 mach-sa1100: retire custom LED code

Quoted 8 lines · Russell King - ARM Linux
Quoted 7 lines · Bryan Wu

Right, I got it. So if we are going to run a single binary for all the sa1100 machines, how about we check the machine in each fs_initcall

static int __init assabet_leds_init(void)

{
     int i;
Quoted 8 lines
Quoted 5 lines
     if (!machine_is_assabet())
          return -ENODEV,

     for (i = 0; i < ARRAY_SIZE(assabet_leds); i++) {
             struct assabet_led *led;

Yes, that'll do, thanks.

Do you think it's worth copying the logic from powerpc for this?

arch/powerpc/include/asm/machdep.h:

#define __define_machine_initcall(mach,level,fn,id) \
        static int __init __machine_initcall_##mach##_##fn(void) { \
                if (machine_is(mach)) return fn(); \
                return 0; \
        } \
        __define_initcall(level,__machine_initcall_##mach##_##fn,id);
#define machine_core_initcall(mach,fn)          __define_machine_initcall(mach,"1",fn,1)
#define machine_core_initcall_sync(mach,fn)     __define_machine_initcall(mach,"1s",fn,1s)
#define machine_postcore_initcall(mach,fn)      __define_machine_initcall(mach,"2",fn,2)
#define machine_postcore_initcall_sync(mach,fn) __define_machine_initcall(mach,"2s",fn,2s)
#define machine_arch_initcall(mach,fn)          __define_machine_initcall(mach,"3",fn,3)
#define machine_arch_initcall_sync(mach,fn)     __define_machine_initcall(mach,"3s",fn,3s)
#define machine_subsys_initcall(mach,fn)        __define_machine_initcall(mach,"4",fn,4)
#define machine_subsys_initcall_sync(mach,fn)   __define_machine_initcall(mach,"4s",fn,4s)
#define machine_fs_initcall(mach,fn)            __define_machine_initcall(mach,"5",fn,5)
#define machine_fs_initcall_sync(mach,fn)       __define_machine_initcall(mach,"5s",fn,5s)
#define machine_rootfs_initcall(mach,fn)        __define_machine_initcall(mach,"rootfs",fn,rootfs)
#define machine_device_initcall(mach,fn)        __define_machine_initcall(mach,"6",fn,6)
#define machine_device_initcall_sync(mach,fn)   __define_machine_initcall(mach,"6s",fn,6s)
#define machine_late_initcall(mach,fn)          __define_machine_initcall(mach,"7",fn,7)
#define machine_late_initcall_sync(mach,fn)     __define_machine_initcall(mach,"7s",fn,7s)

I don't really like the magic macros, but my feeling is that it's easier to do the conversion without introducing subtle bugs this way.

Arnd

author
#55 lore raw

PATCH 16/17 mach-sa1100: retire custom LED code

Quoted 44 lines · Arnd Bergmann
Quoted 8 lines · Russell King - ARM Linux
Quoted 7 lines · Bryan Wu

Right, I got it. So if we are going to run a single binary for all the sa1100 machines, how about we check the machine in each fs_initcall

static int __init assabet_leds_init(void)
{
? ? ?int i;

Quoted 8 lines
Quoted 5 lines

? ? ?if (!machine_is_assabet())
? ? ? ? ? return -ENODEV,

? ? ?for (i = 0; i < ARRAY_SIZE(assabet_leds); i++) { ? ? ? ? ? ? ?struct assabet_led *led;

Yes, that'll do, thanks.

Do you think it's worth copying the logic from powerpc for this?

arch/powerpc/include/asm/machdep.h:
#define __define_machine_initcall(mach,level,fn,id) \
? ? ? ?static int __init __machine_initcall_##mach##_##fn(void) { \
? ? ? ? ? ? ? ?if (machine_is(mach)) return fn(); \
? ? ? ? ? ? ? ?return 0; \
? ? ? ?} \
? ? ? ?__define_initcall(level,__machine_initcall_##mach##_##fn,id);
#define machine_core_initcall(mach,fn) ? ? ? ? ?__define_machine_initcall(mach,"1",fn,1) #define machine_core_initcall_sync(mach,fn) ? ? __define_machine_initcall(mach,"1s",fn,1s) #define machine_postcore_initcall(mach,fn) ? ? ?__define_machine_initcall(mach,"2",fn,2) #define machine_postcore_initcall_sync(mach,fn) __define_machine_initcall(mach,"2s",fn,2s) #define machine_arch_initcall(mach,fn) ? ? ? ? ?__define_machine_initcall(mach,"3",fn,3) #define machine_arch_initcall_sync(mach,fn) ? ? __define_machine_initcall(mach,"3s",fn,3s) #define machine_subsys_initcall(mach,fn) ? ? ? ?__define_machine_initcall(mach,"4",fn,4) #define machine_subsys_initcall_sync(mach,fn) ? __define_machine_initcall(mach,"4s",fn,4s) #define machine_fs_initcall(mach,fn) ? ? ? ? ? ?__define_machine_initcall(mach,"5",fn,5) #define machine_fs_initcall_sync(mach,fn) ? ? ? __define_machine_initcall(mach,"5s",fn,5s) #define machine_rootfs_initcall(mach,fn) ? ? ? ?__define_machine_initcall(mach,"rootfs",fn,rootfs) #define machine_device_initcall(mach,fn) ? ? ? ?__define_machine_initcall(mach,"6",fn,6) #define machine_device_initcall_sync(mach,fn) ? __define_machine_initcall(mach,"6s",fn,6s) #define machine_late_initcall(mach,fn) ? ? ? ? ?__define_machine_initcall(mach,"7",fn,7) #define machine_late_initcall_sync(mach,fn) ? ? __define_machine_initcall(mach,"7s",fn,7s)

Quoted 3 lines

I don't really like the magic macros, but my feeling is that it's easier to do the conversion without introducing subtle bugs this way.

I think this is a great idea. what about moving it to include/asm-generic/

Thanks,

Signature · 5 lines
Bryan Wu <[email protected]>
Kernel Developer ? ?+86.138-1617-6545 Mobile
Ubuntu Kernel Team
Canonical Ltd. ? ? ?www.canonical.com
Ubuntu - Linux for human beings | www.ubuntu.com
#56 lore raw

PATCH 16/17 mach-sa1100: retire custom LED code

Quoted 1 line · Bryan Wu

I think this is a great idea. what about moving it to include/asm-generic/

Except, instead of:

		if (machine_is(mach)) return fn(); \

we'd need:

		if (machine_is_##mach()) return fn(); \
#57 lore raw

PATCH 16/17 mach-sa1100: retire custom LED code

Quoted 2 lines · Russell King - ARM Linux
Quoted 1 line · Bryan Wu

I think this is a great idea. what about moving it to include/asm-generic/

I wouldn't want to encourage new architectures to actually use this method until they grow to need it. For most simple architectures, it's probably better to have a different method of doing machine specific work.

Quoted 7 lines

Except, instead of:

		if (machine_is(mach)) return fn(); \

we'd need:

		if (machine_is_##mach()) return fn(); \

Right. Maybe we can start simple and just do a single definition at fs_initcall level:

#define machine_initcall(mach,level,fn) \
        static int __init __machine_initcall_##mach##_##fn(void) { \
                if (machine_is ## mach()) return fn(); \
                return 0; \
        } \
        fs_initcall(,__machine_initcall_##mach##_##fn);


	Arnd
author
#58 lore raw

PATCH 17/17 ARM: use new LEDS CPU trigger stub to replace old one

In reply to Bryan Wu
Cc Linus Walleij <[email protected]>
---
 arch/arm/Kconfig            |   53 -------------------
 arch/arm/include/asm/leds.h |   50 ------------------
 arch/arm/kernel/Makefile    |    1 -
 arch/arm/kernel/leds.c      |  119 -------------------------------------------
 arch/arm/kernel/process.c   |    6 +-
 arch/arm/kernel/time.c      |   17 ------
 6 files changed, 3 insertions(+), 243 deletions(-)
 delete mode 100644 arch/arm/include/asm/leds.h
 delete mode 100644 arch/arm/kernel/leds.c
arch/arm/Kconfig +0 -53
index 2a37079..7b9b88e 100644
@@ -1572,59 +1572,6 @@ config FORCE_MAX_ZONEORDER
 	  This config option is actually maximum order plus one. For example,
 	  a value of 11 means that the largest free memory block is 2^10 pages.
 
-config LEDS
-	bool "Timer and CPU usage LEDs"
-	depends on ARCH_CDB89712 || ARCH_EBSA110 || \
-		   ARCH_EBSA285 || ARCH_INTEGRATOR || \
-		   ARCH_LUBBOCK || MACH_MAINSTONE || ARCH_NETWINDER || \
-		   ARCH_OMAP || ARCH_P720T || ARCH_PXA_IDP || \
-		   ARCH_SA1100 || ARCH_SHARK || ARCH_VERSATILE || \
-		   ARCH_AT91 || ARCH_DAVINCI || \
-		   ARCH_KS8695 || MACH_RD88F5182 || ARCH_REALVIEW
-	help
-	  If you say Y here, the LEDs on your machine will be used
-	  to provide useful information about your current system status.
-
-	  If you are compiling a kernel for a NetWinder or EBSA-285, you will
-	  be able to select which LEDs are active using the options below. If
-	  you are compiling a kernel for the EBSA-110 or the LART however, the
-	  red LED will simply flash regularly to indicate that the system is
-	  still functional. It is safe to say Y here if you have a CATS
-	  system, but the driver will do nothing.
-
-config LEDS_TIMER
-	bool "Timer LED" if (!ARCH_CDB89712 && !ARCH_OMAP) || \
-			    OMAP_OSK_MISTRAL || MACH_OMAP_H2 \
-			    || MACH_OMAP_PERSEUS2
-	depends on LEDS
-	depends on !GENERIC_CLOCKEVENTS
-	default y if ARCH_EBSA110
-	help
-	  If you say Y here, one of the system LEDs (the green one on the
-	  NetWinder, the amber one on the EBSA285, or the red one on the LART)
-	  will flash regularly to indicate that the system is still
-	  operational. This is mainly useful to kernel hackers who are
-	  debugging unstable kernels.
-
-	  The LART uses the same LED for both Timer LED and CPU usage LED
-	  functions. You may choose to use both, but the Timer LED function
-	  will overrule the CPU usage LED.
-
-config LEDS_CPU
-	bool "CPU usage LED" if (!ARCH_CDB89712 && !ARCH_EBSA110 && \
-			!ARCH_OMAP) \
-			|| OMAP_OSK_MISTRAL || MACH_OMAP_H2 \
-			|| MACH_OMAP_PERSEUS2
-	depends on LEDS
-	help
-	  If you say Y here, the red LED will be used to give a good real
-	  time indication of CPU usage, by lighting whenever the idle task
-	  is not currently executing.
-
-	  The LART uses the same LED for both Timer LED and CPU usage LED
-	  functions. You may choose to use both, but the Timer LED function
-	  will overrule the CPU usage LED.
-
 config ALIGNMENT_TRAP
 	bool
 	depends on CPU_CP15_MMU
arch/arm/include/asm/leds.h deleted +0 -50

50 lines not on this page · raw message

arch/arm/kernel/Makefile +0 -1
index a5b31af..5ef0051 100644
@@ -19,7 +19,6 @@ obj-y		:= elf.o entry-armv.o entry-common.o irq.o \
 
 obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += compat.o
 
-obj-$(CONFIG_LEDS)		+= leds.o
 obj-$(CONFIG_OC_ETM)		+= etm.o
 
 obj-$(CONFIG_ISA_DMA_API)	+= dma.o
arch/arm/kernel/leds.c deleted +0 -119

119 lines not on this page · raw message

arch/arm/kernel/process.c +3 -3
index 5e1e541..d3b70cc 100644
@@ -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();
arch/arm/kernel/time.c +0 -17
index cb634c3..a2a0c88 100644
@@ -27,7 +27,6 @@
 
 #include <linux/mc146818rtc.h>
 
-#include <asm/leds.h>
 #include <asm/thread_info.h>
 #include <asm/sched_clock.h>
 #include <asm/stacktrace.h>
@@ -84,21 +83,6 @@ u32 arch_gettimeoffset(void)
 }
 #endif /* CONFIG_ARCH_USES_GETTIMEOFFSET */
 
-#ifdef CONFIG_LEDS_TIMER
-static inline void do_leds(void)
-{
-	static unsigned int count = HZ/2;
-
-	if (--count == 0) {
-		count = HZ/2;
-		leds_event(led_timer);
-	}
-}
-#else
-#define	do_leds()
-#endif
-
-
 #ifndef CONFIG_GENERIC_CLOCKEVENTS
 /*
  * Kernel system timer support.
@@ -106,7 +90,6 @@ static inline void do_leds(void)
 void timer_tick(void)
 {
 	profile_tick(CPU_PROFILING);
-	do_leds();
 	xtime_update(1);
 #ifndef CONFIG_SMP
 	update_process_times(user_mode(get_irq_regs()));
Signature · 1 line
1.7.5
#59 lore raw

PATCH 17/17 ARM: use new LEDS CPU trigger stub to replace old one

Quoted 16 lines · Bryan Wu

#include <asm/cacheflush.h>

arch/arm/kernel/process.c +1 -2
-#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()))

arch/arm/kernel/process.c void cpu_idle(void) · line 213

Quoted 8 lines
arch/arm/kernel/process.c +1 -1
@@ -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();

Nevermind my previous comment about the place where this is used. I've found it now ;-)

Arnd

#60 lore raw

cover Introduce a led trigger for CPU activity

In reply to Bryan Wu
Quoted 3 lines

?drivers/leds/ledtrig-cpu.c ? ? ? ? ? ? ? ? ? ? | ?144 ++++++++++++ ?include/linux/leds.h ? ? ? ? ? ? ? ? ? ? ? ? ? | ? 15 ++ ?105 files changed, 1532 insertions(+), 3119 deletions(-)

Not bad, I like the numbers here. This is definitely a good move. I had long ago wanted to remove those legacy LED code in mach-pxa.

Thanks Bryan.

#61 lore raw

cover Introduce a led trigger for CPU activity

Quoted 6 lines · Eric Miao
Quoted 3 lines

?drivers/leds/ledtrig-cpu.c ? ? ? ? ? ? ? ? ? ? | ?144 ++++++++++++ ?include/linux/leds.h ? ? ? ? ? ? ? ? ? ? ? ? ? | ? 15 ++ ?105 files changed, 1532 insertions(+), 3119 deletions(-)

Not bad, I like the numbers here. This is definitely a good move. I had long ago wanted to remove those legacy LED code in mach-pxa.

The down-side is that through these moves we've lost functionality each time. For example, the blinking heartbeat LED on the Assabet and Netwinder which I always enabled to let me know whether the machines were still alove has long since gone.

I hope that this series restores that functionality on those platforms where it has been lost.

#62 lore raw

cover Introduce a led trigger for CPU activity

Quoted 8 lines · Russell King - ARM Linux
Quoted 6 lines · Eric Miao
Quoted 3 lines

?drivers/leds/ledtrig-cpu.c ? ? ? ? ? ? ? ? ? ? | ?144 ++++++++++++ ?include/linux/leds.h ? ? ? ? ? ? ? ? ? ? ? ? ? | ? 15 ++ ?105 files changed, 1532 insertions(+), 3119 deletions(-)

Not bad, I like the numbers here. This is definitely a good move. I had long ago wanted to remove those legacy LED code in mach-pxa.

Quoted 8 lines

The down-side is that through these moves we've lost functionality each time. ?For example, the blinking heartbeat LED on the Assabet and Netwinder which I always enabled to let me know whether the machines were still alove has long since gone.

I hope that this series restores that functionality on those platforms where it has been lost.

Yeah, I have the same concern. So probably extending the current simple API to allow a more flexible behavior would be better.

#63 lore raw

cover Introduce a led trigger for CPU activity

In reply to Russell King - ARM Linux
Quoted 5 lines · Russell King - ARM Linux
Quoted 4 lines · Eric Miao
Quoted 3 lines

?drivers/leds/ledtrig-cpu.c ? ? ? ? ? ? ? ? ? ? | ?144 ++++++++++++ ?include/linux/leds.h ? ? ? ? ? ? ? ? ? ? ? ? ? | ? 15 ++ ?105 files changed, 1532 insertions(+), 3119 deletions(-)

Quoted 7 lines
Quoted 2 lines

Not bad, I like the numbers here. This is definitely a good move. I had long ago wanted to remove those legacy LED code in mach-pxa.

The down-side is that through these moves we've lost functionality each time. For example, the blinking heartbeat LED on the Assabet and Netwinder which I always enabled to let me know whether the machines were still alove has long since gone.

There exists a generic heartbeat LED trigger for that. Making it the default for a particular LED should be trivial.

Nicolas

author
#64 lore raw

cover Introduce a led trigger for CPU activity

In reply to Russell King - ARM Linux
Quoted 8 lines · Russell King - ARM Linux
Quoted 6 lines · Eric Miao
Quoted 3 lines

?drivers/leds/ledtrig-cpu.c ? ? ? ? ? ? ? ? ? ? | ?144 ++++++++++++ ?include/linux/leds.h ? ? ? ? ? ? ? ? ? ? ? ? ? | ? 15 ++ ?105 files changed, 1532 insertions(+), 3119 deletions(-)

Not bad, I like the numbers here. This is definitely a good move. I had long ago wanted to remove those legacy LED code in mach-pxa.

Quoted 8 lines

The down-side is that through these moves we've lost functionality each time. ?For example, the blinking heartbeat LED on the Assabet and Netwinder which I always enabled to let me know whether the machines were still alove has long since gone.

I hope that this series restores that functionality on those platforms where it has been lost.

I chose the 'heartbeat' and 'cpu' triggers as default triggers of Assabet 2 LEDs.
+/*
+ * The triggers lines up below will only be used if the
+ * LED triggers are compiled in.
+ */
+static const struct {
+ const char *name;
+ const char *trigger;
+} assabet_leds[] = {
+ { "assabet:red", "cpu",},
+ { "assabet:green", "heartbeat", },
+};

But it can be changed on the fly via sysfs. Does this replacement make sense?

Thanks,

Signature · 5 lines
Bryan Wu <[email protected]>
Kernel Developer ? ?+86.138-1617-6545 Mobile
Ubuntu Kernel Team
Canonical Ltd. ? ? ?www.canonical.com
Ubuntu - Linux for human beings | www.ubuntu.com