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 
ledtrig_mtd_activity(void)23 void ledtrig_mtd_activity(void)
24 {
25 	led_trigger_blink_oneshot(ledtrig_mtd, BLINK_DELAY, BLINK_DELAY, 0);
26 	led_trigger_blink_oneshot(ledtrig_nand, BLINK_DELAY, BLINK_DELAY, 0);
27 }
28 EXPORT_SYMBOL(ledtrig_mtd_activity);
29 
ledtrig_mtd_init(void)30 static int __init ledtrig_mtd_init(void)
31 {
32 	led_trigger_register_simple("mtd", &ledtrig_mtd);
33 	led_trigger_register_simple("nand-disk", &ledtrig_nand);
34 
35 	return 0;
36 }
37 device_initcall(ledtrig_mtd_init);
38