1 // SPDX-License-Identifier: GPL-2.0-only
3 * LED Disk Activity Trigger
5 * Copyright 2006 Openedhand Ltd.
7 * Author: Richard Purdie <rpurdie@openedhand.com>
10 #include <linux/kernel.h>
11 #include <linux/init.h>
12 #include <linux/leds.h>
14 #define BLINK_DELAY 30
16 DEFINE_LED_TRIGGER(ledtrig_disk
);
17 DEFINE_LED_TRIGGER(ledtrig_disk_read
);
18 DEFINE_LED_TRIGGER(ledtrig_disk_write
);
20 void ledtrig_disk_activity(bool write
)
22 led_trigger_blink_oneshot(ledtrig_disk
, BLINK_DELAY
, BLINK_DELAY
, 0);
24 led_trigger_blink_oneshot(ledtrig_disk_write
,
25 BLINK_DELAY
, BLINK_DELAY
, 0);
27 led_trigger_blink_oneshot(ledtrig_disk_read
,
28 BLINK_DELAY
, BLINK_DELAY
, 0);
30 EXPORT_SYMBOL(ledtrig_disk_activity
);
32 static int __init
ledtrig_disk_init(void)
34 led_trigger_register_simple("disk-activity", &ledtrig_disk
);
35 led_trigger_register_simple("disk-read", &ledtrig_disk_read
);
36 led_trigger_register_simple("disk-write", &ledtrig_disk_write
);
40 device_initcall(ledtrig_disk_init
);