LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Vasily Khoruzhick <anarsoul@gmail.com>
To: linux-kernel@vger.kernel.org, Richard Purdie <rpurdie@rpsys.net>,
	Anton Vorontsov <cbouatmailru@gmail.com>,
	"Arnaud Patard (Rtp)" <arnaud.patard@rtp-net.org>,
	anarsoul@gmail.com
Subject: [RFC PATCH 1/2] LEDs: Add ability to blink via simple trigger
Date: Fri,  7 Jan 2011 18:28:16 +0200	[thread overview]
Message-ID: <1294417697-4692-2-git-send-email-anarsoul@gmail.com> (raw)
In-Reply-To: <1294417697-4692-1-git-send-email-anarsoul@gmail.com>

As blink API is now available, it's possible to add
ability to blink via simple trigger.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
 drivers/leds/led-triggers.c |   20 ++++++++++++++++++++
 include/linux/leds.h        |    3 +++
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
index c41eb61..45f92ec 100644
--- a/drivers/leds/led-triggers.c
+++ b/drivers/leds/led-triggers.c
@@ -231,6 +231,26 @@ void led_trigger_event(struct led_trigger *trigger,
 }
 EXPORT_SYMBOL_GPL(led_trigger_event);
 
+void led_trigger_blink(struct led_trigger *trigger,
+			unsigned long *delay_on,
+			unsigned long *delay_off)
+{
+	struct list_head *entry;
+
+	if (!trigger)
+		return;
+
+	read_lock(&trigger->leddev_list_lock);
+	list_for_each(entry, &trigger->led_cdevs) {
+		struct led_classdev *led_cdev;
+
+		led_cdev = list_entry(entry, struct led_classdev, trig_list);
+		led_blink_set(led_cdev, delay_on, delay_off);
+	}
+	read_unlock(&trigger->leddev_list_lock);
+}
+EXPORT_SYMBOL_GPL(led_trigger_blink);
+
 void led_trigger_register_simple(const char *name, struct led_trigger **tp)
 {
 	struct led_trigger *trigger;
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 0f19df9..a1591e8 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -145,6 +145,9 @@ extern void led_trigger_register_simple(const char *name,
 extern void led_trigger_unregister_simple(struct led_trigger *trigger);
 extern void led_trigger_event(struct led_trigger *trigger,
 				enum led_brightness event);
+extern void led_trigger_blink(struct led_trigger *trigger,
+			unsigned long *delay_on,
+			unsigned long *delay_off);
 
 #else
 
-- 
1.7.3.2


  reply	other threads:[~2011-01-07 16:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-07 16:28 [RFC PATCH 0/2] LEDs: power_supply: " Vasily Khoruzhick
2011-01-07 16:28 ` Vasily Khoruzhick [this message]
2011-01-07 16:28 ` [RFC PATCH 2/2] power_supply: Add new LED trigger charging-blink-solid-full Vasily Khoruzhick
2011-01-14 16:18   ` Anton Vorontsov
2011-01-14 16:37     ` Vasily Khoruzhick
2011-01-31 13:33   ` Anton Vorontsov

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=1294417697-4692-2-git-send-email-anarsoul@gmail.com \
    --to=anarsoul@gmail.com \
    --cc=arnaud.patard@rtp-net.org \
    --cc=cbouatmailru@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rpurdie@rpsys.net \
    --subject='Re: [RFC PATCH 1/2] LEDs: Add ability to blink via simple trigger' \
    /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

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