summaryrefslogtreecommitdiffstats
path: root/backend/backlight.h
blob: 69fb893ad4b09f4b83cf364492889d488f9e0978 (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 BACKEND_BACKLIGHT_H_
#define BACKEND_BACKLIGHT_H_

#include "timer.h"
#include "api.h"
#include "probe.h"


struct backlight {
	const char *name;

	int (*min_brightness)(struct backlight *b);
	int (*max_brightness)(struct backlight *b);
	int (*brightness_step)(struct backlight *b);
	int (*current_brightness)(struct backlight *b);
	int (*set_brightness)(struct backlight *b, int value);
	int (*screen_lock)(struct backlight *b, int lock);
	int (*screen_is_locked)(struct backlight *b);

	void (*destroy)(struct backlight *b);
	int (*update)(struct backlight *b);
	unsigned int poll_interval;

	/* Internal */
	int autodim_enabled;
	int autodim_enabled_on_ac;
	int framebuffer_fd;
	int fb_blanked;
	struct sleeptimer timer;
};

void backlight_init(struct backlight *b, const char *name);

struct backlight * backlight_probe(void);
void backlight_destroy(struct backlight *b);

int backlight_fill_pt_message_stat(struct backlight *b, struct pt_message *msg);
int backlight_notify_state_change(struct backlight *b);

int backlight_set_brightness(struct backlight *b, int value);
int backlight_set_percentage(struct backlight *b, unsigned int percent);
int backlight_get_percentage(struct backlight *b);
int backlight_screen_lock(struct backlight *b, int lock);

DECLARE_PROBES(backlight);
#define BACKLIGHT_PROBE(_name, _func)	DEFINE_PROBE(backlight, _name, _func)

#endif /* BACKEND_BACKLIGHT_H_ */
bues.ch cgit interface