leds.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * LED Core
  3. *
  4. * Copyright 2005 Openedhand Ltd.
  5. *
  6. * Author: Richard Purdie <[email protected]>
  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. #ifndef __LEDS_H_INCLUDED
  14. #define __LEDS_H_INCLUDED
  15. #include <linux/rwsem.h>
  16. #include <linux/leds.h>
  17. static inline int led_get_brightness(struct led_classdev *led_cdev)
  18. {
  19. return led_cdev->brightness;
  20. }
  21. static inline struct led_classdev *trigger_to_lcdev(struct led_trigger *trig)
  22. {
  23. struct led_classdev *led_cdev;
  24. read_lock(&trig->leddev_list_lock);
  25. list_for_each_entry(led_cdev, &trig->led_cdevs, trig_list) {
  26. if (!strcmp(led_cdev->default_trigger, trig->name)) {
  27. read_unlock(&trig->leddev_list_lock);
  28. return led_cdev;
  29. }
  30. }
  31. read_unlock(&trig->leddev_list_lock);
  32. return NULL;
  33. }
  34. void led_init_core(struct led_classdev *led_cdev);
  35. void led_stop_software_blink(struct led_classdev *led_cdev);
  36. void led_set_brightness_nopm(struct led_classdev *led_cdev,
  37. enum led_brightness value);
  38. void led_set_brightness_nosleep(struct led_classdev *led_cdev,
  39. enum led_brightness value);
  40. extern struct rw_semaphore leds_list_lock;
  41. extern struct list_head leds_list;
  42. extern struct list_head trigger_list;
  43. #endif /* __LEDS_H_INCLUDED */