Kristian Høgsberg | 51cba3c | 2012-02-29 14:23:51 -0500 | [diff] [blame^] | 1 | #ifndef LIBBACKLIGHT_H |
| 2 | #define LIBBACKLIGHT_H |
| 3 | #include <libudev.h> |
| 4 | #include <stdint.h> |
| 5 | |
| 6 | #ifdef __cplusplus |
| 7 | extern "C" { |
| 8 | #endif |
| 9 | |
| 10 | enum backlight_type { |
| 11 | BACKLIGHT_RAW, |
| 12 | BACKLIGHT_PLATFORM, |
| 13 | BACKLIGHT_FIRMWARE, |
| 14 | }; |
| 15 | |
| 16 | struct backlight { |
| 17 | char *path; |
| 18 | int max_brightness; |
| 19 | int brightness; |
| 20 | enum backlight_type type; |
| 21 | }; |
| 22 | |
| 23 | /* |
| 24 | * Find and set up a backlight for a valid udev connector device, i.e. one |
| 25 | * matching drm subsytem and with status of connected. |
| 26 | */ |
| 27 | struct backlight *backlight_init(struct udev_device *drm_device, |
| 28 | uint32_t connector_type); |
| 29 | |
| 30 | /* Free backlight resources */ |
| 31 | void backlight_destroy(struct backlight *backlight); |
| 32 | |
| 33 | /* Provide the maximum backlight value */ |
| 34 | long backlight_get_max_brightness(struct backlight *backlight); |
| 35 | |
| 36 | /* Provide the cached backlight value */ |
| 37 | long backlight_get_brightness(struct backlight *backlight); |
| 38 | |
| 39 | /* Provide the hardware backlight value */ |
| 40 | long backlight_get_actual_brightness(struct backlight *backlight); |
| 41 | |
| 42 | /* Set the backlight to a value between 0 and max */ |
| 43 | long backlight_set_brightness(struct backlight *backlight, long brightness); |
| 44 | |
| 45 | #ifdef __cplusplus |
| 46 | } |
| 47 | #endif |
| 48 | |
| 49 | #endif /* LIBBACKLIGHT_H */ |