Skip to contentSkip to conversation

Introduce a led trigger for CPU activity and consolidate LED driver in ARM

PATCH Superseded Bryan Wu 7 participants 31 messages Aug 3, 2011 – Aug 17, 2011

Subsystems (10)

v2 of 10 Superseded Latest is v10 →

lore
Share & tools
lore

Bryan Wu

author
#0 lore raw

v2 cover Introduce a led trigger for CPU activity and consolidate LED driver in ARM

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.1 mainline git tree and build successfully for all the machines.

v1 --> v2:
* remove select operations in Kconfig of every machines
* add back supporting of led in core module of mach-integrator
* solidate name scheme in ledtrig-cpu.c
* add comments of CPU_LED_* cpu led events
* fold patches of RealView and Versatile together
* add machine_is_ check during assabet led driver init
* add some Acked-by in patch logs
* remove code for simpad machine in machine-sa11000, since Jochen Friedrich introduced gpiolib and gpio-led driver for simpad
* on Assabet and Netwinder machine, LED operations is reversed like:
setting bit means turn off leds
clearing bit means turn on leds
* add a new function to read CM_CTRL register for led driver

This patchset is based on patches from Jochen Friedrich for simpad:
* http://lists.infradead.org/pipermail/linux-arm-kernel/2011-July/057566.html
* http://lists.infradead.org/pipermail/linux-arm-kernel/2011-July/057564.html
* http://lists.infradead.org/pipermail/linux-arm-kernel/2011-July/057567.html
* http://lists.infradead.org/pipermail/linux-arm-kernel/2011-July/057565.html
* http://lists.infradead.org/pipermail/linux-arm-kernel/2011-July/057568.html

Bryan Wu (16):
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: introduce cm_read function helper to read CM_CTRL
register
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 (1):
mach-realview and mach-versatile: retire custom LED code

 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 --
 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/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                 |   60 +++++
 arch/arm/mach-clps711x/time.c                  |    1 -
 arch/arm/mach-ebsa110/Makefile                 |    4 +-
 arch/arm/mach-ebsa110/leds.c                   |   80 ++++---
 arch/arm/mach-footbridge/Makefile              |    4 -
 arch/arm/mach-footbridge/ebsa285-leds.c        |  139 -----------
 arch/arm/mach-footbridge/ebsa285.c             |   79 +++++++
 arch/arm/mach-footbridge/include/mach/system.h |    1 -
 arch/arm/mach-footbridge/netwinder-hw.c        |  110 ++++++++--
 arch/arm/mach-footbridge/netwinder-leds.c      |  139 -----------
 arch/arm/mach-integrator/Makefile              |    3 +-
 arch/arm/mach-integrator/core.c                |   18 ++-
 arch/arm/mach-integrator/include/mach/cm.h     |    1 +
 arch/arm/mach-integrator/leds.c                |  159 ++++++++-----
 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/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/Makefile                     |    8 -
 arch/arm/mach-pxa/idp.c                        |   79 +++++++
 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                    |   93 ++++++++
 arch/arm/mach-pxa/mainstone.c                  |   92 ++++++++
 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/Makefile                  |    9 -
 arch/arm/mach-sa1100/assabet.c                 |   83 +++++++
 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.c                    |   50 ----
 arch/arm/mach-sa1100/leds.h                    |   13 -
 arch/arm/mach-shark/Makefile                   |    4 +-
 arch/arm/mach-shark/core.c                     |    1 -
 arch/arm/mach-shark/leds.c                     |  225 +++++++-----------
 arch/arm/mach-versatile/core.c                 |   42 ----
 arch/arm/plat-omap/Kconfig                     |    3 +-
 arch/arm/plat-omap/debug-leds.c                |  292 ++++++------------------
 arch/arm/plat-samsung/time.c                   |    1 -
 arch/arm/plat-versatile/Kconfig                |    2 +-
 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 ++
 98 files changed, 1442 insertions(+), 3008 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.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 v2 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 b591e72..a97c6a3 100644
@@ -430,6 +430,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..b782abd 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 enters idle */
+	CPU_LED_IDLE_END,	/* CPU idle ends */
+	CPU_LED_START,		/* Machine starts, especially resume */
+	CPU_LED_STOP,		/* Machine stops, especially suspend */
+	CPU_LED_HALTED,		/* Machine shutdown */
+};
+
+/* 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

2011/8/3 Bryan Wu <[email protected]>:

Quoted 3 lines

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.

[...]

Quoted 15 lines
drivers/leds/ledtrig-cpu.c new file +15 -0
+void ledtrig_cpu(enum cpu_led_event ledevt)
+{
+       struct ledtrig_cpu_data *trigdata = __get_cpu_var(ledtrig_cpu_triggers);
+
+       if (!trigdata)
+               return;
+
+       /* Locate the correct CPU LED */
+
+       switch (ledevt) {
+       case CPU_LED_IDLE_START:
+       case CPU_LED_START:
+               /* Will turn the LED on, max brightness */
+               if (trigdata->led)
+                       led_set_brightness(trigdata->led,

drivers/leds/ledtrig-cpu.c line 51

Quoted 10 lines
drivers/leds/ledtrig-cpu.c new file +10 -0
+                                          trigdata->led->max_brightness);
+               break;
+
+       case CPU_LED_IDLE_END:
+       case CPU_LED_STOP:
+       case CPU_LED_HALTED:
+               /* Will turn the LED off */
+               if (trigdata->led)
+                       led_set_brightness(trigdata->led, LED_OFF);
+               break;

Might be better to swap CPU_LED_IDLE_START with CPU_LED_IDLE_END here so that when entering idle state the leds turn off.

Best Regards,
Micha? Miros?aw

author
#3 lore raw

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

2011/8/3 Micha? Miros?aw <[email protected]>:

Quoted 25 lines

2011/8/3 Bryan Wu <[email protected]>:

Quoted 3 lines

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.

[...]

Quoted 20 lines
(quoted diff) +20 -0
+void ledtrig_cpu(enum cpu_led_event ledevt)
+{
+ ? ? ? struct ledtrig_cpu_data *trigdata = __get_cpu_var(ledtrig_cpu_triggers);
+
+ ? ? ? if (!trigdata)
+ ? ? ? ? ? ? ? return;
+
+ ? ? ? /* Locate the correct CPU LED */
+
+ ? ? ? switch (ledevt) {
+ ? ? ? case CPU_LED_IDLE_START:
+ ? ? ? case CPU_LED_START:
+ ? ? ? ? ? ? ? /* Will turn the LED on, max brightness */
+ ? ? ? ? ? ? ? if (trigdata->led)
+ ? ? ? ? ? ? ? ? ? ? ? led_set_brightness(trigdata->led,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?trigdata->led->max_brightness);
+ ? ? ? ? ? ? ? break;
+
+ ? ? ? case CPU_LED_IDLE_END:
+ ? ? ? case CPU_LED_STOP:
Quoted 9 lines
Quoted 5 lines

+ ? ? ? case CPU_LED_HALTED:
+ ? ? ? ? ? ? ? /* Will turn the LED off */
+ ? ? ? ? ? ? ? if (trigdata->led)
+ ? ? ? ? ? ? ? ? ? ? ? led_set_brightness(trigdata->led, LED_OFF);
+ ? ? ? ? ? ? ? break;

Might be better to swap CPU_LED_IDLE_START with CPU_LED_IDLE_END here so that when entering idle state the leds turn off.

Good point, 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
#4 lore raw

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

In reply to Bryan Wu

Hi Bryan,

Quoted 23 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/ledtrig-cpu.c new file +0 -0
new file mode 100644
index 0000000..0537c3b

[...]

Quoted 1 line

+static DEFINE_PER_CPU(struct ledtrig_cpu_data *, ledtrig_cpu_triggers);

[...]

Quoted 22 lines
drivers/leds/ledtrig-cpu.c new file +22 -0
+static void ledtrig_cpu_activate_cpu(void *data)
+{
+	struct ledtrig_cpu_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(ledtrig_cpu_triggers) = cpu_data;
+}
+
+static void ledtrig_cpu_activate(struct led_classdev *led)

drivers/leds/ledtrig-cpu.c line 91

Quoted 10 lines
drivers/leds/ledtrig-cpu.c new file +10 -0
+{
+	on_each_cpu(ledtrig_cpu_activate_cpu, led, 1);
+}
+
+static void ledtrig_cpu_deactivate(struct led_classdev *led)
+{
+	struct ledtrig_cpu_data *cpu_data = led->trigger_data;
+
+	kfree(cpu_data);
+}

Is this deactivation correct? My (limited) understanding of the smp api is that we'll allocate the ledtrig_cpu_data for each CPU and store it in the ledtrig_cpu_triggers pointers. So shouldn't this be doing a __get_cpu_var(ledtrig_cpu_triggers) and a kfree() on that (and setting to NULL)?

Also, where does led->trigger_data get assigned with the cpu id?

Jamie

#5 lore raw

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

Quoted 32 lines · Jamie Iles

Hi Bryan,
[...]

Quoted 1 line

+static DEFINE_PER_CPU(struct ledtrig_cpu_data *, ledtrig_cpu_triggers);

[...]

Quoted 28 lines
drivers/leds/ledtrig-cpu.c new file +28 -0
+static void ledtrig_cpu_activate_cpu(void *data)
+{
+ ? ? struct ledtrig_cpu_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(ledtrig_cpu_triggers) = cpu_data;
+}
+
+static void ledtrig_cpu_activate(struct led_classdev *led)
+{
+ ? ? on_each_cpu(ledtrig_cpu_activate_cpu, led, 1);
+}
+
+static void ledtrig_cpu_deactivate(struct led_classdev *led)
+{
Quoted 8 lines

drivers/leds/ledtrig-cpu.c line 56

Quoted 4 lines

+ ? ? struct ledtrig_cpu_data *cpu_data = led->trigger_data;

drivers/leds/ledtrig-cpu.c new file +3 -0
+
+ ? ? kfree(cpu_data);
+}

Is this deactivation correct? ?My (limited) understanding of the smp api is that we'll allocate the ledtrig_cpu_data for each CPU and store it in the ledtrig_cpu_triggers pointers.

At this point you have a handle to a specific LED and that one is tied to a certain CPU aldready, since it is a member of
struct ledtrig_cpu_data. The LED is CPU-local by nature already since it is looked up in the code being called from the ARM kernel, i.e. the activate/deactivate pairs get called once per CPU.

Quoted 3 lines

So shouldn't this be doing a __get_cpu_var(ledtrig_cpu_triggers) and a kfree() on that (and setting to NULL)?

You could do that but why? There is no way the pointer value can make any harm. If activate() is called again it will be overwritten with the new pointer.

Quoted 1 line

Also, where does led->trigger_data get assigned with the cpu id?

The activate() function is called on every core and if the CPU ID is not equal to the assigned CPU it just exits, here:

+ int my_cpu = smp_processor_id();
+ unsigned long target_cpu = (unsigned long) led->trigger_data;
+
+ if (target_cpu != my_cpu)
+ return;

Yours,
Linus Walleij

#6 lore raw

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

Hi Linus,

Quoted 42 lines · Linus Walleij
Quoted 32 lines · Jamie Iles

Hi Bryan,
[...]

Quoted 1 line

+static DEFINE_PER_CPU(struct ledtrig_cpu_data *, ledtrig_cpu_triggers);

[...]

Quoted 28 lines
drivers/leds/ledtrig-cpu.c new file +28 -0
+static void ledtrig_cpu_activate_cpu(void *data)
+{
+ ? ? struct ledtrig_cpu_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(ledtrig_cpu_triggers) = cpu_data;
+}
+
+static void ledtrig_cpu_activate(struct led_classdev *led)
+{
+ ? ? on_each_cpu(ledtrig_cpu_activate_cpu, led, 1);
+}
+
+static void ledtrig_cpu_deactivate(struct led_classdev *led)
+{
Quoted 8 lines

drivers/leds/ledtrig-cpu.c line 56

Quoted 4 lines

+ ? ? struct ledtrig_cpu_data *cpu_data = led->trigger_data;

drivers/leds/ledtrig-cpu.c new file +3 -0
+
+ ? ? kfree(cpu_data);
+}

Is this deactivation correct? ?My (limited) understanding of the smp api is that we'll allocate the ledtrig_cpu_data for each CPU and store it in the ledtrig_cpu_triggers pointers.

Quoted 5 lines

At this point you have a handle to a specific LED and that one is tied to a certain CPU aldready, since it is a member of
struct ledtrig_cpu_data. The LED is CPU-local by nature already since it is looked up in the code being called from the ARM kernel, i.e. the activate/deactivate pairs get called once per CPU.

OK, I'm fine with that.

Quoted 8 lines
Quoted 4 lines

So shouldn't this be doing a __get_cpu_var(ledtrig_cpu_triggers) and a kfree() on that (and setting to NULL)?

You could do that but why? There is no way the pointer value can make any harm. If activate() is called again it will be overwritten with the new pointer.

Yes, but can't ledtrig_cpu() potentially still be called after deactivation, then the:

	if (!trigdata)
		return;

would be incorrect? My main point though was that it looks like led->trigger_data is the processor id and kfree() is being called on that.

drivers/leds/ledtrig-cpu.c line 68

Quoted 10 lines
Quoted 1 line

Also, where does led->trigger_data get assigned with the cpu id?

The activate() function is called on every core and if the CPU ID is not equal to the assigned CPU it just exits, here:

drivers/leds/ledtrig-cpu.c new file +5 -0
+     int my_cpu = smp_processor_id();
+     unsigned long target_cpu = (unsigned long) led->trigger_data;
+
+     if (target_cpu != my_cpu)
+             return;

I understand that bit, but I can't see anything that actually assigns led->trigger_data in the first place.

Jamie

#7 lore raw

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

Hi Jamie,

Quoted 2 lines

I understand that bit, but I can't see anything that actually assigns led->trigger_data in the first place.

I just tested this on simpad and while I can assign the cpu trigger to the green LED using the sys fs, the trigger just sits there and does nothing, just like the "none" trigger.

Thanks,
Jochen

#8 lore raw

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

In reply to Jamie Iles
Quoted 11 lines · Jamie Iles
Quoted 7 lines
Quoted 3 lines

So shouldn't this be doing a __get_cpu_var(ledtrig_cpu_triggers) and a kfree() on that (and setting to NULL)?

You could do that but why? There is no way the pointer value can make any harm. If activate() is called again it will be overwritten with the new pointer.

Yes, but can't ledtrig_cpu() potentially still be called after deactivation, then the:

Quoted 6 lines

? ? ? ?if (!trigdata)
? ? ? ? ? ? ? ?return;

would be incorrect? ?My main point though was that it looks like led->trigger_data is the processor id and kfree() is being called on that.

You're right, it just works fine because trigdata is always NULL...

Quoted 5 lines
Quoted 5 lines
Quoted 1 line

Also, where does led->trigger_data get assigned with the cpu id?

The activate() function is called on every core and if the CPU ID is not equal to the assigned CPU it just exits, here:

Quoted 8 lines
Quoted 5 lines

+ ? ? int my_cpu = smp_processor_id();
+ ? ? unsigned long target_cpu = (unsigned long) led->trigger_data; +
+ ? ? if (target_cpu != my_cpu)
+ ? ? ? ? ? ? return;

I understand that bit, but I can't see anything that actually assigns led->trigger_data in the first place.

You're right, it's because nothing really does. And since kfree(NULL); is fine this works, and makes the above thing work fine as well.

Since led->trigger_data is never used we shouldn't touch it in I believe, Bryan can you just take it out and replace with something like this (totally untested):

static void ledtrig_cpu_deactivate_cpu(struct led_classdev *led)

{
       struct ledtrig_cpu_data *cpu_data = __get_cpu_var(ledtrig_cpu_triggers);
       int my_cpu = smp_processor_id();
       unsigned long target_cpu = (unsigned long) led->trigger_data;

       if (target_cpu != my_cpu)
               return;

       kfree(cpu_data);
       __get_cpu_var(ledtrig_cpu_triggers) = NULL;
}

static void ledtrig_cpu_activate(struct led_classdev *led)

{
       on_each_cpu(ledtrig_cpu_deactivate_cpu, led, 1);
}

Bryan can you test this change?

Thanks!
Linus Walleij

author
#9 lore raw

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

Quoted 56 lines · Linus Walleij
Quoted 11 lines · Jamie Iles
Quoted 7 lines
Quoted 3 lines

So shouldn't this be doing a __get_cpu_var(ledtrig_cpu_triggers) and a kfree() on that (and setting to NULL)?

You could do that but why? There is no way the pointer value can make any harm. If activate() is called again it will be overwritten with the new pointer.

Yes, but can't ledtrig_cpu() potentially still be called after deactivation, then the:

Quoted 6 lines

? ? ? ?if (!trigdata)
? ? ? ? ? ? ? ?return;

would be incorrect? ?My main point though was that it looks like led->trigger_data is the processor id and kfree() is being called on that.

You're right, it just works fine because trigdata is always NULL...

Quoted 5 lines
Quoted 5 lines
Quoted 1 line

Also, where does led->trigger_data get assigned with the cpu id?

The activate() function is called on every core and if the CPU ID is not equal to the assigned CPU it just exits, here:

Quoted 8 lines
Quoted 5 lines

+ ? ? int my_cpu = smp_processor_id();
+ ? ? unsigned long target_cpu = (unsigned long) led->trigger_data; +
+ ? ? if (target_cpu != my_cpu)
+ ? ? ? ? ? ? return;

I understand that bit, but I can't see anything that actually assigns led->trigger_data in the first place.

You're right, it's because nothing really does. And since kfree(NULL); is fine this works, and makes the above thing work fine as well.

Since led->trigger_data is never used we shouldn't touch it in I believe, Bryan can you just take it out and replace with something like this (totally untested):

static void ledtrig_cpu_deactivate_cpu(struct led_classdev *led) {
? ? ? struct ledtrig_cpu_data *cpu_data = __get_cpu_var(ledtrig_cpu_triggers); ? ? ? int my_cpu = smp_processor_id();
? ? ? unsigned long target_cpu = (unsigned long) led->trigger_data;

? ? ? if (target_cpu != my_cpu)
? ? ? ? ? ? ? return;

? ? ? kfree(cpu_data);
? ? ? __get_cpu_var(ledtrig_cpu_triggers) = NULL;
}

Quoted 7 lines

static void ledtrig_cpu_activate(struct led_classdev *led) {
? ? ? on_each_cpu(ledtrig_cpu_deactivate_cpu, led, 1); }

Bryan can you test this change?

No problem, I've reworked this patchset and included this updates. Please find patches here:

git://kernel.ubuntu.com/roc/linux-2.6 leds
gitweb: http://kernel.ubuntu.com/git?p=roc/linux-2.6/.git;a=shortlog;h=refs/heads/leds

Please help to test on your hardware.

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 v2 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 679b0b7..0f95be9 100644
@@ -55,8 +55,6 @@ static void __init cap9adk_init_early(void)
 	/* Initialize processor: 12 MHz crystal */
 	at91_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);
 
@@ -359,6 +357,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)
 {
@@ -386,6 +401,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 17654d5..0b2cdee 100644
@@ -48,9 +48,6 @@ static void __init csb337_init_early(void)
 	/* Initialize processor: 3.6864 MHz crystal */
 	at91_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 7c0313c..15cbbe4 100644
@@ -51,9 +51,6 @@ static void __init ecb_at91init_early(void)
 	/* Initialize processor: 18.432 MHz crystal */
 	at91_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);
 
@@ -144,6 +141,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 */
@@ -163,6 +172,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 8252c72..efa8e55 100644
@@ -37,9 +37,6 @@ static void __init eco920_init_early(void)
 
 	at91_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);
 
@@ -95,6 +92,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();
@@ -125,6 +140,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 4a17089..17a470b 100644
@@ -48,9 +48,6 @@ static void __init kafa_init_early(void)
 	/* Initialize processor: 18.432 MHz crystal */
 	at91_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);
 
@@ -75,6 +72,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 */
@@ -89,6 +98,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 9dc8d49..bee2a4e 100644
@@ -50,9 +50,6 @@ static void __init kb9202_init_early(void)
 	/* Initialize processor: 10 MHz crystal */
 	at91_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);
 
@@ -112,6 +109,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 */
@@ -130,6 +145,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 6f08faa..8694b74 100644
@@ -50,9 +50,6 @@ static void __init dk_init_early(void)
 	/* Initialize processor: 18.432 MHz crystal */
 	at91_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 85bcccd..3a96ed3 100644
@@ -50,9 +50,6 @@ static void __init ek_init_early(void)
 	/* Initialize processor: 18.432 MHz crystal */
 	at91_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 4d3a02f..8c3a15a 100644
@@ -49,9 +49,6 @@ static void __init ek_init_early(void)
 	/* Initialize processor: 18.432 MHz crystal */
 	at91_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);
 
@@ -184,6 +181,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 */
@@ -202,6 +217,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 5096a0e..4d7b6fa 100644
@@ -59,9 +59,6 @@ static void __init ek_init_early(void)
 	/* Initialize processor: 18.432 MHz crystal */
 	at91_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 95edcbd..9ac5c47 100644
@@ -58,9 +58,6 @@ static void __init yl9200_init_early(void)
 	/* Initialize processor: 18.432 MHz crystal */
 	at91_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
#11 lore raw

PATCH v2 3/17 mach-realview and mach-versatile: 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/mach-versatile/core.c           |   42 ------------------------------
 arch/arm/plat-versatile/Kconfig          |    2 +-
 arch/arm/plat-versatile/leds.c           |   13 ++++++---
 10 files changed, 10 insertions(+), 108 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 7a4e3b1..8bdd783 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 ad5671a..72bbe53 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 b43644b..e6eeffc 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 763e8f3..f29c640 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 363b0ab..61d30fa 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/mach-versatile/core.c +0 -42

60 lines not on this page · raw message

arch/arm/plat-versatile/Kconfig +1 -1
index 52353be..bfcea07 100644
@@ -7,7 +7,7 @@ config PLAT_VERSATILE_FPGA_IRQ
 	bool
 
 config PLAT_VERSATILE_LEDS
-	def_bool y if LEDS_CLASS
+	def_bool y if NEW_LEDS
 	depends on ARCH_REALVIEW || ARCH_VERSATILE
 
 config PLAT_VERSATILE_SCHED_CLOCK
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
#12 lore raw

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

Quoted 8 lines · 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.

Quoted 7 lines

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)

This is broken. More than that, this LEDS stuff is broken.

With CONFIG_NEW_LEDS=y and CONFIG_LEDS_CLASS=n,

CC arch/arm/plat-versatile/leds.o
arch/arm/plat-versatile/leds.c: In function 'versatile_leds_init':
arch/arm/plat-versatile/leds.c:91: error: 'struct led_classdev' has no member named 'trigger_data'

I wasn't offered LEDS_TRIGGERS to select. It looks like this leds stuff really is broken:

config LEDS_CLASS
bool "LED Class Support"
help
This option enables the led sysfs class in /sys/class/leds. You'll need this to do anything useful with LEDs. If unsure, say N.

Okay, this says its for sysfs support. But then:

config LEDS_TRIGGERS
bool "LED Trigger support"
depends on LEDS_CLASS
help
This option enables trigger support for the leds class. These triggers allow kernel events to drive the LEDs and can be configured via sysfs. If unsure, say Y.

you can only have LED triggers if you have LED class support. So what's the point of NEW_LEDS=y and LEDS_CLASS=n? From those descriptions, LEDS_CLASS should control the sysfs interfaces, and LEDS_TRIGGERS should control the kernel internal interfaces _independently_.

As things stand, this looks completely crazy. So no, I'm not acking these patches until the LEDs layer gets a modicum of sanity.

author
#13 lore raw

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

Quoted 15 lines · Russell King - ARM Linux
Quoted 14 lines · 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.

Quoted 6 lines
Quoted 1 line

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

This is broken. ?More than that, this LEDS stuff is broken.

With CONFIG_NEW_LEDS=y and CONFIG_LEDS_CLASS=n,

Actually, I don't see any user of this config, either. And all the LEDS stuffs depend on LEDS_CLASS.

Can we just simply select LEDS_CLASS when CONFIG_NEW_LEDS=y?

---

drivers/leds/Kconfig +1 -0
index b444cc3..5ae3ef7 100644
@@ -7,6 +7,7 @@ config LEDS_GPIO_REGISTER
 
 menuconfig NEW_LEDS
        bool "LED Support"
+       select LEDS_CLASS
        help
          Say Y to enable Linux LED support.  This allows control of supported
          LEDs from both userspace and optionally, by kernel events (triggers).

---

Richard, could you please give some comments?

-Bryan

Quoted 31 lines

?CC ? ? ?arch/arm/plat-versatile/leds.o
arch/arm/plat-versatile/leds.c: In function 'versatile_leds_init':
arch/arm/plat-versatile/leds.c:91: error: 'struct led_classdev' has no member named 'trigger_data'

I wasn't offered LEDS_TRIGGERS to select. ?It looks like this leds stuff really is broken:

config LEDS_CLASS
? ? ? ?bool "LED Class Support"
? ? ? ?help
? ? ? ? ?This option enables the led sysfs class in /sys/class/leds. ?You'll ? ? ? ? ?need this to do anything useful with LEDs. ?If unsure, say N.

Okay, this says its for sysfs support. ?But then:

config LEDS_TRIGGERS
? ? ? ?bool "LED Trigger support"
? ? ? ?depends on LEDS_CLASS
? ? ? ?help
? ? ? ? ?This option enables trigger support for the leds class. ? ? ? ? ?These triggers allow kernel events to drive the LEDs and can ? ? ? ? ?be configured via sysfs. If unsure, say Y.

you can only have LED triggers if you have LED class support. ?So what's the point of NEW_LEDS=y and LEDS_CLASS=n? ?From those descriptions, LEDS_CLASS should control the sysfs interfaces, and LEDS_TRIGGERS should control the kernel internal interfaces _independently_.

As things stand, this looks completely crazy. ?So no, I'm not acking these patches until the LEDs layer gets a modicum of sanity.

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
#14 lore raw

PATCH v2 4/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 85a3c9a..1e6594a 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
#15 lore raw

PATCH v2 5/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/mach-shark/Makefile |    4 +-
 arch/arm/mach-shark/core.c   |    1 -
 arch/arm/mach-shark/leds.c   |  225 ++++++++++++++++--------------------------
 3 files changed, 87 insertions(+), 143 deletions(-)
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 ac2873c..36b6b87 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 +86 -139

252 lines not on this page · raw message

Signature · 1 line
1.7.5
author
#16 lore raw

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

In reply to Bryan Wu
---
 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 -
 4 files changed, 23 insertions(+), 54 deletions(-)
arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c +0 -1
index 291d22b..fb9c635 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 3f02362..f4d64e6 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
author
#17 lore raw

PATCH v2 7/17 mach-integrator: introduce cm_read function helper to read CM_CTRL register

In reply to Bryan Wu
---
 arch/arm/mach-integrator/core.c            |   17 +++++++++++++++++
 arch/arm/mach-integrator/include/mach/cm.h |    1 +
 2 files changed, 18 insertions(+), 0 deletions(-)
arch/arm/mach-integrator/core.c +17 -0
index 77315b9..0ee6af6 100644
@@ -225,6 +225,23 @@ void cm_control(u32 mask, u32 set)
 
 EXPORT_SYMBOL(cm_control);
 
+/**
+ * cm_read - read the CM_CTRL register.
+ */
+u32 cm_read(void)
+{
+	unsigned long flags;
+	u32 val = 0;
+
+	spin_lock_irqsave(&cm_lock, flags);
+	val = readl(CM_CTRL);
+	spin_unlock_irqrestore(&cm_lock, flags);
+
+	return val;
+}
+
+EXPORT_SYMBOL(cm_read);
+
 /*
  * We need to stop things allocating the low memory; ideally we need a
  * better implementation of GFP_DMA which does not assume that DMA-able
arch/arm/mach-integrator/include/mach/cm.h +1 -0
index 445d57a..3731508 100644
@@ -2,6 +2,7 @@
  * update the core module control register.
  */
 void cm_control(u32, u32);
+u32 cm_read(void);
 
 #define CM_CTRL_LED			(1 << 0)
 #define CM_CTRL_nMBDET			(1 << 1)
Signature · 1 line
1.7.5
#18 lore raw

PATCH 7/17 mach-integrator: introduce cm_read function helper to read CM_CTRL register

Hello.

Quoted 15 lines · Bryan Wu
---
  arch/arm/mach-integrator/core.c            |   17 +++++++++++++++++
  arch/arm/mach-integrator/include/mach/cm.h |    1 +
  2 files changed, 18 insertions(+), 0 deletions(-)
arch/arm/mach-integrator/core.c +1 -0
index 77315b9..0ee6af6 100644
@@ -225,6 +225,23 @@ void cm_control(u32 mask, u32 set)
 
  EXPORT_SYMBOL(cm_control);
 
+/**

arch/arm/mach-integrator/core.c void cm_control(u32 mask, u32 set) · line 238

Quoted 10 lines
arch/arm/mach-integrator/core.c +10 -0
+ * cm_read - read the CM_CTRL register.
+ */
+u32 cm_read(void)
+{
+	unsigned long flags;
+	u32 val = 0;
+
+	spin_lock_irqsave(&cm_lock, flags);
+	val = readl(CM_CTRL);
+	spin_unlock_irqrestore(&cm_lock, flags);

What's the point of locking around already atomic read?

WBR, Sergei

author
#19 lore raw

PATCH v2 7/17 mach-integrator: introduce cm_read function helper to read CM_CTRL register

Quoted 19 lines · Sergei Shtylyov

Hello.

Quoted 15 lines · Bryan Wu

---
?arch/arm/mach-integrator/core.c ? ? ? ? ? ?| ? 17 +++++++++++++++++ ?arch/arm/mach-integrator/include/mach/cm.h | ? ?1 +
?2 files changed, 18 insertions(+), 0 deletions(-)

arch/arm/mach-integrator/core.c +0 -0
index 77315b9..0ee6af6 100644
@@ -225,6 +225,23 @@ void cm_control(u32 mask, u32 set)
 
 ?EXPORT_SYMBOL(cm_control);
 
Quoted 14 lines

arch/arm/mach-integrator/core.c void cm_control(u32 mask, u32 set)

Quoted 11 lines
arch/arm/mach-integrator/core.c +11 -0
+/**
+ * cm_read - read the CM_CTRL register.
+ */
+u32 cm_read(void)
+{
+ ? ? ? unsigned long flags;
+ ? ? ? u32 val = 0;
+
+ ? ? ? spin_lock_irqsave(&cm_lock, flags);
+ ? ? ? val = readl(CM_CTRL);
+ ? ? ? spin_unlock_irqrestore(&cm_lock, flags);

? What's the point of locking around already atomic read?

Actually, I'm not sure about whether we need special operation on CM_CTRL register. So I followed the cm_control() function style.

Yeah, if it is just a common register, it's quite convenient for me to read it in leds drivers.

Thanks a lot,

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 7/17 mach-integrator: introduce cm_read function helper to read CM_CTRL register

In reply to Bryan Wu

Hello.

Quoted 11 lines · Bryan Wu
---
  arch/arm/mach-integrator/core.c            |   17 +++++++++++++++++
  arch/arm/mach-integrator/include/mach/cm.h |    1 +
  2 files changed, 18 insertions(+), 0 deletions(-)
arch/arm/mach-integrator/core.c +0 -0
index 77315b9..0ee6af6 100644

arch/arm/mach-integrator/core.c void cm_control(u32 mask, u32 set) · line 234

Quoted 10 lines
arch/arm/mach-integrator/core.c +7 -0
@@ -225,6 +225,23 @@ void cm_control(u32 mask, u32 set)
 
  EXPORT_SYMBOL(cm_control);
 
+/**
+ * cm_read - read the CM_CTRL register.
+ */
+u32 cm_read(void)
+{
+	unsigned long flags;
+	u32 val = 0;

Intialization not needed.

arch/arm/mach-integrator/core.c void cm_control(u32 mask, u32 set) · line 247

Quoted 13 lines
arch/arm/mach-integrator/core.c +10 -0
+
+	spin_lock_irqsave(&cm_lock, flags);
+	val = readl(CM_CTRL);
+	spin_unlock_irqrestore(&cm_lock, flags);
+
+	return val;
+}
+
+EXPORT_SYMBOL(cm_read);
+
  /*
   * We need to stop things allocating the low memory; ideally we need a
   * better implementation of GFP_DMA which does not assume that DMA-able

WBR, Sergei

author
#21 lore raw

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

In reply to Bryan Wu

Use the LED in core module for CPU activity and also enable 4 debugging LEDs in baseboard.

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

---
 arch/arm/mach-integrator/Makefile |    3 +-
 arch/arm/mach-integrator/core.c   |    1 -
 arch/arm/mach-integrator/leds.c   |  159 ++++++++++++++++++++++---------------
 3 files changed, 96 insertions(+), 67 deletions(-)
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 0ee6af6..bba9fe2 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 +95 -64

186 lines not on this page · raw message

Signature · 1 line
1.7.5
author
#22 lore raw

PATCH v2 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/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             |   60 +++++++++++++++++++++++++
 arch/arm/mach-clps711x/time.c              |    1 -
 5 files changed, 60 insertions(+), 72 deletions(-)
 delete mode 100644 arch/arm/mach-clps711x/p720t-leds.c
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 +60 -0

75 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
#23 lore raw

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

In reply to Bryan Wu
---
 arch/arm/mach-ebsa110/Makefile |    4 +-
 arch/arm/mach-ebsa110/leds.c   |   80 ++++++++++++++++++++++++----------------
 2 files changed, 49 insertions(+), 35 deletions(-)
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 +48 -32

99 lines not on this page · raw message

Signature · 1 line
1.7.5
author
#24 lore raw

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

In reply to Bryan Wu
---
 arch/arm/mach-footbridge/Makefile              |    4 -
 arch/arm/mach-footbridge/ebsa285-leds.c        |  139 ------------------------
 arch/arm/mach-footbridge/ebsa285.c             |   79 ++++++++++++++
 arch/arm/mach-footbridge/include/mach/system.h |    1 -
 arch/arm/mach-footbridge/netwinder-hw.c        |  110 ++++++++++++++++---
 arch/arm/mach-footbridge/netwinder-leds.c      |  139 ------------------------
 6 files changed, 175 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/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 +79 -0

91 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 +96 -14

139 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
#25 lore raw

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

In reply to Bryan Wu
---
 arch/arm/mach-pxa/Makefile         |    8 --
 arch/arm/mach-pxa/idp.c            |   79 +++++++++++++++++++++++
 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        |   93 ++++++++++++++++++++++++++
 arch/arm/mach-pxa/mainstone.c      |   92 ++++++++++++++++++++++++++
 9 files changed, 264 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/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 +79 -0

85 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 +93 -0

111 lines not on this page · raw message

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

104 lines not on this page · raw message

Signature · 1 line
1.7.5
author
#26 lore raw

PATCH v2 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 e3bb806..a65ef40 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
#27 lore raw

PATCH v2 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
#28 lore raw

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

In reply to Bryan Wu
---
 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            |    3 +-
 arch/arm/plat-omap/debug-leds.c       |  292 ++++++++-------------------------
 13 files changed, 166 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/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 cb7fb1a..e1c764a 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 31f3487..ec9cabb 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 b08a213..e0d74c4 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 a183777..8abb067 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 96604a5..85870a8 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 +1 -2
index 6e6735f..b2fb233 100644
@@ -34,9 +34,8 @@ config OMAP_DEBUG_DEVICES
 	  For debug cards on TI reference boards.
 
 config OMAP_DEBUG_LEDS
-	bool
+	def_bool y if NEW_LEDS
 	depends on OMAP_DEBUG_DEVICES
-	default y if LEDS_CLASS
 
 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
#29 lore raw

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

In reply to Bryan Wu
---
 arch/arm/mach-sa1100/Makefile       |    9 ---
 arch/arm/mach-sa1100/assabet.c      |   83 +++++++++++++++++++++++++
 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.c         |   50 ---------------
 arch/arm/mach-sa1100/leds.h         |   13 ----
 13 files changed, 213 insertions(+), 620 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.c
 delete mode 100644 arch/arm/mach-sa1100/leds.h
arch/arm/mach-sa1100/Makefile +0 -9
index 0063178..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
@@ -46,9 +40,6 @@ obj-$(CONFIG_SA1100_SHANNON)		+= shannon.o
 
 obj-$(CONFIG_SA1100_SIMPAD)		+= simpad.o
 
-# LEDs support
-obj-$(CONFIG_LEDS) += $(led-y)
-
 # Miscellaneous functions
 obj-$(CONFIG_PM)			+= pm.o sleep.o
 obj-$(CONFIG_SA1100_SSP)		+= ssp.o
arch/arm/mach-sa1100/assabet.c +83 -0

95 lines not on this page · raw message

arch/arm/mach-sa1100/badge4.c +30 -0
index b4311b0..90097e8 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.c deleted +0 -50

50 lines not on this page · raw message

arch/arm/mach-sa1100/leds.h deleted +0 -13
deleted file mode 100644
index 776b602..0000000
@@ -1,13 +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);
Signature · 1 line
1.7.5
author
#30 lore raw

PATCH v2 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 2c71a8f..f9d9f4a 100644
@@ -1592,59 +1592,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 f7887dc..5c6c1b7 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