51cba3ca38
libbacklight is 300 lines of code in one .c file, and we're relying on udev changes that aren't yet upstream. For now, let's just keep a copy in weston and if the Xorg DDX drivers start using libbacklight and it becomes more widely available, we'll make it an external dependency.
50 lines
1.1 KiB
C
50 lines
1.1 KiB
C
#ifndef LIBBACKLIGHT_H
|
|
#define LIBBACKLIGHT_H
|
|
#include <libudev.h>
|
|
#include <stdint.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
enum backlight_type {
|
|
BACKLIGHT_RAW,
|
|
BACKLIGHT_PLATFORM,
|
|
BACKLIGHT_FIRMWARE,
|
|
};
|
|
|
|
struct backlight {
|
|
char *path;
|
|
int max_brightness;
|
|
int brightness;
|
|
enum backlight_type type;
|
|
};
|
|
|
|
/*
|
|
* Find and set up a backlight for a valid udev connector device, i.e. one
|
|
* matching drm subsytem and with status of connected.
|
|
*/
|
|
struct backlight *backlight_init(struct udev_device *drm_device,
|
|
uint32_t connector_type);
|
|
|
|
/* Free backlight resources */
|
|
void backlight_destroy(struct backlight *backlight);
|
|
|
|
/* Provide the maximum backlight value */
|
|
long backlight_get_max_brightness(struct backlight *backlight);
|
|
|
|
/* Provide the cached backlight value */
|
|
long backlight_get_brightness(struct backlight *backlight);
|
|
|
|
/* Provide the hardware backlight value */
|
|
long backlight_get_actual_brightness(struct backlight *backlight);
|
|
|
|
/* Set the backlight to a value between 0 and max */
|
|
long backlight_set_brightness(struct backlight *backlight, long brightness);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* LIBBACKLIGHT_H */
|