summaryrefslogtreecommitdiff
path: root/libbacklight.h
blob: ff0e84231cef33659c85302fcbff0c85a08d6d50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef LIBBACKLIGHT_H
#define LIBBACKLIGHT_H
#include <pciaccess.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 the given PCI device or card/connector
 * combination. It is valid (and preferred) to provide both sets of information
 */
struct backlight *backlight_init(struct pci_device *dev, int card,
				 int connector_type, int connector_type_id);

/* 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 */