xref: /openbsd/sys/dev/pci/drm/include/linux/backlight.h (revision 4cfece93)
1 /* Public domain. */
2 
3 #ifndef _LINUX_BACKLIGHT_H
4 #define _LINUX_BACKLIGHT_H
5 
6 #include <sys/task.h>
7 
8 struct backlight_device;
9 
10 struct backlight_properties {
11 	int type;
12 	int max_brightness;
13 	int brightness;
14 	int power;
15 };
16 
17 struct backlight_ops {
18 	int options;
19 	int (*update_status)(struct backlight_device *);
20 	int (*get_brightness)(struct backlight_device *);
21 };
22 
23 #define BL_CORE_SUSPENDRESUME	1
24 
25 struct backlight_device {
26 	const struct backlight_ops *ops;
27 	struct backlight_properties props;
28 	struct task task;
29 	void *data;
30 };
31 
32 #define bl_get_data(bd)	(bd)->data
33 
34 #define BACKLIGHT_RAW		0
35 #define BACKLIGHT_FIRMWARE	1
36 
37 #define BACKLIGHT_UPDATE_HOTKEY	0
38 
39 struct backlight_device *backlight_device_register(const char *, void *,
40      void *, const struct backlight_ops *, struct backlight_properties *);
41 void backlight_device_unregister(struct backlight_device *);
42 
43 static inline void
44 backlight_update_status(struct backlight_device *bd)
45 {
46 	bd->ops->update_status(bd);
47 }
48 
49 static inline void
50 backlight_force_update(struct backlight_device *bd, int reason)
51 {
52 	bd->props.brightness = bd->ops->get_brightness(bd);
53 }
54 
55 void backlight_schedule_update_status(struct backlight_device *);
56 
57 int backlight_enable(struct backlight_device *);
58 int backlight_disable(struct backlight_device *);
59 
60 #define devm_of_find_backlight(x)	NULL
61 
62 #endif
63