mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ygeorgie <ygeorgie@gmail.com>
To: linux-kernel@vger.kernel.org, Richard Purdie <rpurdie@linux.intel.com>
Cc: Yury Georgievskiy <ygeorgie@gmail.com>
Subject: [PATCH RFC] leds: Allow heartbeat trigger to use user-defined brightness.
Date: Thu, 27 Jan 2011 16:22:57 +0100	[thread overview]
Message-ID: <1296141777-6016-1-git-send-email-ygeorgie@gmail.com> (raw)

From: Yury Georgievskiy <ygeorgie@gmail.com>

Led brightness for PWM leds can be dynamically adjusted.
GPIO leds are not affected as only on/off states are possible.

Checked with PWM leds.
Writing new value in /sys/class/leds/led-pwm::/brightness
alter PWM led brightness as expected.

Signed-off-by: Yury Georgievskiy <ygeorgie@gmail.com>
---
 drivers/leds/ledtrig-heartbeat.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/leds/ledtrig-heartbeat.c b/drivers/leds/ledtrig-heartbeat.c
index 759c0bb..74afb5a 100644
--- a/drivers/leds/ledtrig-heartbeat.c
+++ b/drivers/leds/ledtrig-heartbeat.c
@@ -48,7 +48,7 @@ static void led_heartbeat_function(unsigned long data)
 			msecs_to_jiffies(heartbeat_data->period);
 		delay = msecs_to_jiffies(70);
 		heartbeat_data->phase++;
-		brightness = led_cdev->max_brightness;
+		brightness = led_cdev->brightness;
 		break;
 	case 1:
 		delay = heartbeat_data->period / 4 - msecs_to_jiffies(70);
@@ -57,7 +57,7 @@ static void led_heartbeat_function(unsigned long data)
 	case 2:
 		delay = msecs_to_jiffies(70);
 		heartbeat_data->phase++;
-		brightness = led_cdev->max_brightness;
+		brightness = led_cdev->brightness;
 		break;
 	default:
 		delay = heartbeat_data->period - heartbeat_data->period / 4 -
@@ -66,7 +66,7 @@ static void led_heartbeat_function(unsigned long data)
 		break;
 	}

-	led_set_brightness(led_cdev, brightness);
+	led_cdev->brightness_set(led_cdev, brightness);
 	mod_timer(&heartbeat_data->timer, jiffies + delay);
 }

--
1.7.3.2


                 reply	other threads:[~2011-01-27 15:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1296141777-6016-1-git-send-email-ygeorgie@gmail.com \
    --to=ygeorgie@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rpurdie@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®