Re: [PATCH] leds: Add support for power LED on WRAP systems

Previous thread: [PATCH 8/8] x86: fix sparse warnings in acpi/bus.c by Harvey Harrison on Tuesday, February 5, 2008 - 4:42 pm. (1 message)

Next thread: [PATCH] ipvs: Make wrr "no available servers" error message rate-limited by Sven Wegener on Tuesday, February 5, 2008 - 4:30 pm. (3 messages)
To: <rpurdie@...>
Cc: <kris@...>, <linux-kernel@...>
Date: Tuesday, February 5, 2008 - 4:51 pm

WRAP systems have an additional LED. The power LED is normally lit after boot
and doesn't serve any other purpose besides showing that the system is powered
on. Nevertheless, its state is controllable and we can attach a trigger to it.

Cc: Kristian Kielhofner <kris@krisk.org>
Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
---
drivers/leds/leds-wrap.c | 41 +++++++++++++++++++++++++++++++++++------
1 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/drivers/leds/leds-wrap.c b/drivers/leds/leds-wrap.c
index 27fb2d8..0ccb483 100644
--- a/drivers/leds/leds-wrap.c
+++ b/drivers/leds/leds-wrap.c
@@ -19,11 +19,21 @@
#include <linux/scx200_gpio.h>

#define DRVNAME "wrap-led"
+#define WRAP_POWER_LED_GPIO 2
#define WRAP_ERROR_LED_GPIO 3
#define WRAP_EXTRA_LED_GPIO 18

static struct platform_device *pdev;

+static void wrap_power_led_set(struct led_classdev *led_cdev,
+ enum led_brightness value)
+{
+ if (value)
+ scx200_gpio_set_low(WRAP_POWER_LED_GPIO);
+ else
+ scx200_gpio_set_high(WRAP_POWER_LED_GPIO);
+}
+
static void wrap_error_led_set(struct led_classdev *led_cdev,
enum led_brightness value)
{
@@ -42,6 +52,11 @@ static void wrap_extra_led_set(struct led_classdev *led_cdev,
scx200_gpio_set_high(WRAP_EXTRA_LED_GPIO);
}

+static struct led_classdev wrap_power_led = {
+ .name = "wrap:power",
+ .brightness_set = wrap_power_led_set,
+};
+
static struct led_classdev wrap_error_led = {
.name = "wrap:error",
.brightness_set = wrap_error_led_set,
@@ -56,6 +71,7 @@ static struct led_classdev wrap_extra_led = {
static int wrap_led_suspend(struct platform_device *dev,
pm_message_t state)
{
+ led_classdev_suspend(&wrap_power_led);
led_classdev_suspend(&wrap_error_led);
led_classdev_suspend(&wrap_extra_led);
return 0;
@@ -63,6 +79,7 @@ static int wrap_led_suspend(struct platform_device *dev,

static int wrap_led_resume(struct platform_device *dev)
{
+ led_classdev_resume(&wr...

To: Sven Wegener <sven.wegener@...>
Cc: <kris@...>, <linux-kernel@...>
Date: Thursday, February 7, 2008 - 5:25 am

There is already a patch queued up to do something like this in the LED
tree, can you check that does everything you need please?

http://git.o-hand.com/?p=linux-rpurdie-leds;a=shortlog;h=for-mm

Thanks,

Richard

--

To: Richard Purdie <rpurdie@...>
Cc: <kris@...>, <linux-kernel@...>
Date: Thursday, February 7, 2008 - 5:55 am

It's ok, exactly the same my patch implements.

Sven
--

Previous thread: [PATCH 8/8] x86: fix sparse warnings in acpi/bus.c by Harvey Harrison on Tuesday, February 5, 2008 - 4:42 pm. (1 message)

Next thread: [PATCH] ipvs: Make wrr "no available servers" error message rate-limited by Sven Wegener on Tuesday, February 5, 2008 - 4:30 pm. (3 messages)