Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 84047
b: refs/heads/master
c: 92e015c
h: refs/heads/master
i:
  84045: c604a23
  84043: 9abc230
  84039: 8b20e4d
  84031: 9b9c862
v: v3
  • Loading branch information
Márton Németh authored and Richard Purdie committed Feb 7, 2008
1 parent a6df021 commit 9ebf353
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4c79141d28bc290ae307e3f81f5bc909c26faf6e
refs/heads/master: 92e015cb31c0a312bf2e0e5b96aef76a8c57e645
8 changes: 5 additions & 3 deletions trunk/drivers/leds/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
37 changes: 37 additions & 0 deletions trunk/drivers/leds/leds-clevo-mail.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9ebf353

Please sign in to comment.