backlight.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef BACKEND_BACKLIGHT_H_
  2. #define BACKEND_BACKLIGHT_H_
  3. #include "timer.h"
  4. #include "api.h"
  5. #include "probe.h"
  6. struct backlight {
  7. const char *name;
  8. int (*min_brightness)(struct backlight *b);
  9. int (*max_brightness)(struct backlight *b);
  10. int (*brightness_step)(struct backlight *b);
  11. int (*current_brightness)(struct backlight *b);
  12. int (*set_brightness)(struct backlight *b, int value);
  13. int (*screen_lock)(struct backlight *b, int lock);
  14. int (*screen_is_locked)(struct backlight *b);
  15. void (*destroy)(struct backlight *b);
  16. int (*update)(struct backlight *b);
  17. unsigned int poll_interval;
  18. /* Internal */
  19. int autodim_enabled;
  20. int autodim_enabled_on_ac;
  21. int framebuffer_fd;
  22. int fb_blanked;
  23. struct sleeptimer timer;
  24. };
  25. void backlight_init(struct backlight *b, const char *name);
  26. struct backlight * backlight_probe(void);
  27. void backlight_destroy(struct backlight *b);
  28. int backlight_fill_pt_message_stat(struct backlight *b, struct pt_message *msg);
  29. int backlight_notify_state_change(struct backlight *b);
  30. int backlight_set_brightness(struct backlight *b, int value);
  31. int backlight_set_percentage(struct backlight *b, unsigned int percent);
  32. int backlight_get_percentage(struct backlight *b);
  33. int backlight_screen_lock(struct backlight *b, int lock);
  34. DECLARE_PROBES(backlight);
  35. #define BACKLIGHT_PROBE(_name, _func) DEFINE_PROBE(backlight, _name, _func)
  36. #endif /* BACKEND_BACKLIGHT_H_ */