From: "Németh Márton" <nm127@freemail.hu>
To: Richard Purdie <rpurdie@rpsys.net>
Cc: Randy Dunlap <randy.dunlap@oracle.com>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Rodrigo Pereira <rodripe@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 4/4] leds-clevo-mail: hw acceleration for Clevo mail LED driver
Date: Sun, 28 Oct 2007 12:23:33 +0100 [thread overview]
Message-ID: <47247135.6060206@freemail.hu> (raw)
From: Márton Németh <nm127@freemail.hu>
Add support for hardware accelerated LED blinking for the mail LED
commonly found on Clevo notebooks.
Signed-off-by: Márton Németh <nm127@freemail.hu>
---
diff -uprN linux-2.6.24-rc1.c/drivers/leds/Kconfig linux-2.6.24-rc1.d/drivers/leds/Kconfig
--- linux-2.6.24-rc1.c/drivers/leds/Kconfig 2007-10-28 09:09:45.000000000 +0100
+++ linux-2.6.24-rc1.d/drivers/leds/Kconfig 2007-10-28 09:09:25.000000000 +0100
@@ -122,9 +122,11 @@ config LEDS_CLEVO_MAIL
programs through the leds subsystem. This LED have three
known mode: off, blink at 0.5Hz and blink at 1Hz.
- As this LED cannot change it's brightness it blinks instead.
- The brightness value 0 means off, 1..127 means blink at 0.5Hz
- and 128..255 means blink at 1Hz.
+ The driver supports two kinds of interface: using ledtrig-timer
+ or through /sys/class/leds/clevo::mail/brightness. As this LED
+ cannot change it's brightness it blinks instead. The brightness
+ value 0 means off, 1..127 means blink at 0.5Hz and 128..255 means
+ blink at 1Hz.
This module can drive the mail LED for the following notebooks:
diff -uprN linux-2.6.24-rc1.c/drivers/leds/leds-clevo-mail.c linux-2.6.24-rc1.d/drivers/leds/leds-clevo-mail.c
--- linux-2.6.24-rc1.c/drivers/leds/leds-clevo-mail.c 2007-10-28 10:20:49.000000000 +0100
+++ linux-2.6.24-rc1.d/drivers/leds/leds-clevo-mail.c 2007-10-28 10:20:55.000000000 +0100
@@ -92,9 +92,46 @@ static void clevo_mail_led_set(struct le
}
+static int clevo_mail_led_blink(struct led_classdev *led_cdev,
+ unsigned long* delay_on,
+ unsigned long* delay_off)
+{
+ int status = -EINVAL;
+
+ if (*delay_on == 0 /* ms */ && *delay_off == 0 /* ms */) {
+ /* Special case: the leds subsystem requested us to
+ * chose one user friendly blinking of the LED, and
+ * start it. Let's blink the led slowly (0.5Hz).
+ */
+ *delay_on = 1000; /* ms */
+ *delay_off = 1000; /* ms */
+ i8042_command(NULL, CLEVO_MAIL_LED_BLINK_0_5HZ);
+ status = 0;
+
+ } else if (*delay_on == 500 /* ms */ && *delay_off == 500 /* ms */) {
+ /* blink the led with 1Hz */
+ i8042_command(NULL, CLEVO_MAIL_LED_BLINK_1HZ);
+ status = 0;
+
+ } else if (*delay_on == 1000 /* ms */ && *delay_off == 1000 /* ms */) {
+ /* blink the led with 0.5Hz */
+ i8042_command(NULL, CLEVO_MAIL_LED_BLINK_0_5HZ);
+ status = 0;
+
+ } else {
+ printk(KERN_DEBUG KBUILD_MODNAME
+ ": clevo_mail_led_blink(..., %lu, %lu),"
+ " returning -EINVAL (unsupported)\n",
+ *delay_on, *delay_off);
+ }
+
+ return status;
+}
+
static struct led_classdev clevo_mail_led = {
.name = "clevo::mail",
.brightness_set = clevo_mail_led_set,
+ .blink_set = clevo_mail_led_blink,
};
static int __init clevo_mail_led_probe(struct platform_device *pdev)
reply other threads:[~2007-10-28 10:27 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=47247135.6060206@freemail.hu \
--to=nm127@freemail.hu \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=randy.dunlap@oracle.com \
--cc=rodripe@gmail.com \
--cc=rpurdie@rpsys.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.