LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] leds: Add support for the 3rd LED on the PCEngines WRAP
@ 2007-12-27 13:31 Michael Loeffler
  2008-01-13 23:21 ` Richard Purdie
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Loeffler @ 2007-12-27 13:31 UTC (permalink / raw)
  To: linux-kernel; +Cc: Richard Purdie, Kristian Kielhofner

The 3rd LED on this board is something like a power-led, it is on all the
time. With this change to the leds-wrap driver it is possible to use this
LED too.

Signed-off-by: Michael Loeffler <zvpunry@zvpunry.de>
---
Hi

I wonder why there was no support for this LED. This LED and the GPIO
line is documented in the first commit message (0d75565f) for this file.

I use this changed version for five weeks and it just works. I think this
patch can be included in 2.6.25.

bye

PS: I'm not subscribed to the lkml, so please Cc me.

 drivers/leds/leds-wrap.c |   43 +++++++++++++++++++++++++++++++++++++------
 1 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/drivers/leds/leds-wrap.c b/drivers/leds/leds-wrap.c
index 27fb2d8..254e426 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
+#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(&wrap_power_led);
 	led_classdev_resume(&wrap_error_led);
 	led_classdev_resume(&wrap_extra_led);
 	return 0;
@@ -76,17 +93,31 @@ static int wrap_led_probe(struct platform_device *pdev)
 {
 	int ret;
 
+	ret = led_classdev_register(&pdev->dev, &wrap_power_led);
+	if (ret < 0)
+		return ret;
+
 	ret = led_classdev_register(&pdev->dev, &wrap_error_led);
-	if (ret == 0) {
-		ret = led_classdev_register(&pdev->dev, &wrap_extra_led);
-		if (ret < 0)
-			led_classdev_unregister(&wrap_error_led);
-	}
+	if (ret < 0)
+		goto err1;
+
+	ret = led_classdev_register(&pdev->dev, &wrap_extra_led);
+	if (ret < 0)
+		goto err2;
+
+	return ret;
+
+err2:
+	led_classdev_unregister(&wrap_error_led);
+err1:
+	led_classdev_unregister(&wrap_power_led);
+
 	return ret;
 }
 
 static int wrap_led_remove(struct platform_device *pdev)
 {
+	led_classdev_unregister(&wrap_power_led);
 	led_classdev_unregister(&wrap_error_led);
 	led_classdev_unregister(&wrap_extra_led);
 	return 0;
-- 
1.5.3.7.1112.g9758e



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

* Re: [PATCH] leds: Add support for the 3rd LED on the PCEngines WRAP
  2007-12-27 13:31 [PATCH] leds: Add support for the 3rd LED on the PCEngines WRAP Michael Loeffler
@ 2008-01-13 23:21 ` Richard Purdie
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Purdie @ 2008-01-13 23:21 UTC (permalink / raw)
  To: Michael Loeffler; +Cc: linux-kernel, Kristian Kielhofner

On Thu, 2007-12-27 at 14:31 +0100, Michael Loeffler wrote:
> The 3rd LED on this board is something like a power-led, it is on all the
> time. With this change to the leds-wrap driver it is possible to use this
> LED too.
> 
> Signed-off-by: Michael Loeffler <zvpunry@zvpunry.de>
> ---
> Hi
>
> I wonder why there was no support for this LED. This LED and the GPIO
> line is documented in the first commit message (0d75565f) for this
> file.
>
> I use this changed version for five weeks and it just works. I think
> this patch can be included in 2.6.25.

I've queued it up in the LED tree, thanks.

Richard


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

end of thread, other threads:[~2008-01-13 23:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-27 13:31 [PATCH] leds: Add support for the 3rd LED on the PCEngines WRAP Michael Loeffler
2008-01-13 23:21 ` Richard Purdie

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