ledtrig-mtd.c 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * LED MTD trigger
  3. *
  4. * Copyright 2016 Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
  5. *
  6. * Based on LED IDE-Disk Activity Trigger
  7. *
  8. * Copyright 2006 Openedhand Ltd.
  9. *
  10. * Author: Richard Purdie <rpurdie@openedhand.com>
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License version 2 as
  14. * published by the Free Software Foundation.
  15. *
  16. */
  17. #include <linux/kernel.h>
  18. #include <linux/init.h>
  19. #include <linux/leds.h>
  20. #define BLINK_DELAY 30
  21. DEFINE_LED_TRIGGER(ledtrig_mtd);
  22. DEFINE_LED_TRIGGER(ledtrig_nand);
  23. void ledtrig_mtd_activity(void)
  24. {
  25. unsigned long blink_delay = BLINK_DELAY;
  26. led_trigger_blink_oneshot(ledtrig_mtd,
  27. &blink_delay, &blink_delay, 0);
  28. led_trigger_blink_oneshot(ledtrig_nand,
  29. &blink_delay, &blink_delay, 0);
  30. }
  31. EXPORT_SYMBOL(ledtrig_mtd_activity);
  32. static int __init ledtrig_mtd_init(void)
  33. {
  34. led_trigger_register_simple("mtd", &ledtrig_mtd);
  35. led_trigger_register_simple("nand-disk", &ledtrig_nand);
  36. return 0;
  37. }
  38. device_initcall(ledtrig_mtd_init);