aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-clevo-mail.c
diff options
context:
space:
mode:
authorMárton Németh <nm127@freemail.hu>2007-10-31 10:09:05 -0400
committerRichard Purdie <rpurdie@rpsys.net>2008-02-07 04:52:02 -0500
commit92e015cb31c0a312bf2e0e5b96aef76a8c57e645 (patch)
tree6df4b25865102607920b5c90f1271dfe2f3cc87e /drivers/leds/leds-clevo-mail.c
parent4c79141d28bc290ae307e3f81f5bc909c26faf6e (diff)
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 49a7972459c9..6c3d33b8e383 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,
92 92
93} 93}
94 94
95static int clevo_mail_led_blink(struct led_classdev *led_cdev,
96 unsigned long* delay_on,
97 unsigned long* delay_off)
98{
99 int status = -EINVAL;
100
101 if (*delay_on == 0 /* ms */ && *delay_off == 0 /* ms */) {
102 /* Special case: the leds subsystem requested us to
103 * chose one user friendly blinking of the LED, and
104 * start it. Let's blink the led slowly (0.5Hz).
105 */
106 *delay_on = 1000; /* ms */
107 *delay_off = 1000; /* ms */
108 i8042_command(NULL, CLEVO_MAIL_LED_BLINK_0_5HZ);
109 status = 0;
110
111 } else if (*delay_on == 500 /* ms */ && *delay_off == 500 /* ms */) {
112 /* blink the led with 1Hz */
113 i8042_command(NULL, CLEVO_MAIL_LED_BLINK_1HZ);
114 status = 0;
115
116 } else if (*delay_on == 1000 /* ms */ && *delay_off == 1000 /* ms */) {
117 /* blink the led with 0.5Hz */
118 i8042_command(NULL, CLEVO_MAIL_LED_BLINK_0_5HZ);
119 status = 0;
120
121 } else {
122 printk(KERN_DEBUG KBUILD_MODNAME
123 ": clevo_mail_led_blink(..., %lu, %lu),"
124 " returning -EINVAL (unsupported)\n",
125 *delay_on, *delay_off);
126 }
127
128 return status;
129}
130
95static struct led_classdev clevo_mail_led = { 131static struct led_classdev clevo_mail_led = {
96 .name = "clevo::mail", 132 .name = "clevo::mail",
97 .brightness_set = clevo_mail_led_set, 133 .brightness_set = clevo_mail_led_set,
134 .blink_set = clevo_mail_led_blink,
98}; 135};
99 136
100static int __init clevo_mail_led_probe(struct platform_device *pdev) 137static int __init clevo_mail_led_probe(struct platform_device *pdev)