ledtrig-default-on.c 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * LED Kernel Default ON Trigger
  3. *
  4. * Copyright 2008 Nick Forbes <nick.forbes@incepta.com>
  5. *
  6. * Based on Richard Purdie's ledtrig-timer.c.
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. */
  13. #include <linux/module.h>
  14. #include <linux/kernel.h>
  15. #include <linux/init.h>
  16. #include <linux/leds.h>
  17. #include "leds.h"
  18. static void defon_trig_activate(struct led_classdev *led_cdev)
  19. {
  20. led_set_brightness(led_cdev, led_cdev->max_brightness);
  21. }
  22. static struct led_trigger defon_led_trigger = {
  23. .name = "default-on",
  24. .activate = defon_trig_activate,
  25. };
  26. static int __init defon_trig_init(void)
  27. {
  28. return led_trigger_register(&defon_led_trigger);
  29. }
  30. static void __exit defon_trig_exit(void)
  31. {
  32. led_trigger_unregister(&defon_led_trigger);
  33. }
  34. module_init(defon_trig_init);
  35. module_exit(defon_trig_exit);
  36. MODULE_AUTHOR("Nick Forbes <nick.forbes@incepta.com>");
  37. MODULE_DESCRIPTION("Default-ON LED trigger");
  38. MODULE_LICENSE("GPL");