summaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-clevo-mail.c
diff options
context:
space:
mode:
authorMárton Németh <nm127@freemail.hu>2007-10-31 15:09:05 +0100
committerRichard Purdie <rpurdie@rpsys.net>2008-02-07 09:52:02 +0000
commit92e015cb31c0a312bf2e0e5b96aef76a8c57e645 (patch)
tree6df4b25865102607920b5c90f1271dfe2f3cc87e /drivers/leds/leds-clevo-mail.c
parent4c79141d28bc290ae307e3f81f5bc909c26faf6e (diff)
downloadop-kernel-dev-92e015cb31c0a312bf2e0e5b96aef76a8c57e645.zip
op-kernel-dev-92e015cb31c0a312bf2e0e5b96aef76a8c57e645.tar.gz
leds: hw acceleration for Clevo mail LED driver
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> Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Diffstat (limited to 'drivers/leds/leds-clevo-mail.c')
-rw-r--r--drivers/leds/leds-clevo-mail.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/leds/leds-clevo-mail.c b/drivers/leds/leds-clevo-mail.c
index 49a7972..6c3d33b 100644
--- a/drivers/leds/leds-clevo-mail.c
+++ b/drivers/leds/leds-clevo-mail.c
@@ -92,9 +92,46 @@ static void clevo_mail_led_set(struct led_classdev *led_cdev,
}
+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)
OpenPOWER on IntegriCloud