18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * LED MTD trigger 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright 2016 Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Based on LED IDE-Disk Activity Trigger 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * Copyright 2006 Openedhand Ltd. 108c2ecf20Sopenharmony_ci * 118c2ecf20Sopenharmony_ci * Author: Richard Purdie <rpurdie@openedhand.com> 128c2ecf20Sopenharmony_ci */ 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#include <linux/kernel.h> 158c2ecf20Sopenharmony_ci#include <linux/init.h> 168c2ecf20Sopenharmony_ci#include <linux/leds.h> 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci#define BLINK_DELAY 30 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ciDEFINE_LED_TRIGGER(ledtrig_mtd); 218c2ecf20Sopenharmony_ciDEFINE_LED_TRIGGER(ledtrig_nand); 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_civoid ledtrig_mtd_activity(void) 248c2ecf20Sopenharmony_ci{ 258c2ecf20Sopenharmony_ci unsigned long blink_delay = BLINK_DELAY; 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci led_trigger_blink_oneshot(ledtrig_mtd, 288c2ecf20Sopenharmony_ci &blink_delay, &blink_delay, 0); 298c2ecf20Sopenharmony_ci led_trigger_blink_oneshot(ledtrig_nand, 308c2ecf20Sopenharmony_ci &blink_delay, &blink_delay, 0); 318c2ecf20Sopenharmony_ci} 328c2ecf20Sopenharmony_ciEXPORT_SYMBOL(ledtrig_mtd_activity); 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_cistatic int __init ledtrig_mtd_init(void) 358c2ecf20Sopenharmony_ci{ 368c2ecf20Sopenharmony_ci led_trigger_register_simple("mtd", &ledtrig_mtd); 378c2ecf20Sopenharmony_ci led_trigger_register_simple("nand-disk", &ledtrig_nand); 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci return 0; 408c2ecf20Sopenharmony_ci} 418c2ecf20Sopenharmony_cidevice_initcall(ledtrig_mtd_init); 42