2 * LED Disk Activity Trigger
4 * Copyright 2006 Openedhand Ltd.
6 * Author: Richard Purdie <rpurdie@openedhand.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
14 #include <linux/kernel.h>
15 #include <linux/init.h>
16 #include <linux/leds.h>
18 #define BLINK_DELAY 30
20 DEFINE_LED_TRIGGER(ledtrig_disk
);
21 DEFINE_LED_TRIGGER(ledtrig_disk_read
);
22 DEFINE_LED_TRIGGER(ledtrig_disk_write
);
23 DEFINE_LED_TRIGGER(ledtrig_ide
);
25 void ledtrig_disk_activity(bool write
)
27 unsigned long blink_delay
= BLINK_DELAY
;
29 led_trigger_blink_oneshot(ledtrig_disk
,
30 &blink_delay
, &blink_delay
, 0);
31 led_trigger_blink_oneshot(ledtrig_ide
,
32 &blink_delay
, &blink_delay
, 0);
34 led_trigger_blink_oneshot(ledtrig_disk_write
,
35 &blink_delay
, &blink_delay
, 0);
37 led_trigger_blink_oneshot(ledtrig_disk_read
,
38 &blink_delay
, &blink_delay
, 0);
40 EXPORT_SYMBOL(ledtrig_disk_activity
);
42 static int __init
ledtrig_disk_init(void)
44 led_trigger_register_simple("disk-activity", &ledtrig_disk
);
45 led_trigger_register_simple("disk-read", &ledtrig_disk_read
);
46 led_trigger_register_simple("disk-write", &ledtrig_disk_write
);
47 led_trigger_register_simple("ide-disk", &ledtrig_ide
);
51 device_initcall(ledtrig_disk_init
);