1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * LED MTD trigger
4  *
5  * Copyright 2016 Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
6  *
7  * Based on LED IDE-Disk Activity Trigger
8  *
9  * Copyright 2006 Openedhand Ltd.
10  *
11  * Author: Richard Purdie <rpurdie@openedhand.com>
12  */
13 
14 #include <linux/kernel.h>
15 #include <linux/init.h>
16 #include <linux/leds.h>
17 
18 #define BLINK_DELAY 30
19 
20 DEFINE_LED_TRIGGER(ledtrig_mtd);
21 DEFINE_LED_TRIGGER(ledtrig_nand);
22 
23 void ledtrig_mtd_activity(void)
24 {
25 	unsigned long blink_delay = BLINK_DELAY;
26 
27 	led_trigger_blink_oneshot(ledtrig_mtd,
28 				  &blink_delay, &blink_delay, 0);
29 	led_trigger_blink_oneshot(ledtrig_nand,
30 				  &blink_delay, &blink_delay, 0);
31 }
32 EXPORT_SYMBOL(ledtrig_mtd_activity);
33 
34 static int __init ledtrig_mtd_init(void)
35 {
36 	led_trigger_register_simple("mtd", &ledtrig_mtd);
37 	led_trigger_register_simple("nand-disk", &ledtrig_nand);
38 
39 	return 0;
40 }
41 device_initcall(ledtrig_mtd_init);
42