ledtrig-default-on.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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_async(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");