jcs's openbsd hax
openbsd
1/* Public domain. */
2
3#ifndef _LINUX_BACKLIGHT_H
4#define _LINUX_BACKLIGHT_H
5
6#include <sys/task.h>
7#include <linux/fb.h>
8
9struct backlight_device;
10struct device;
11
12struct backlight_properties {
13 int type;
14#define BACKLIGHT_RAW 0
15#define BACKLIGHT_FIRMWARE 1
16#define BACKLIGHT_PLATFORM 2
17 int max_brightness;
18 int brightness;
19 int power;
20#define BACKLIGHT_POWER_ON 0
21#define BACKLIGHT_POWER_OFF 1
22 int scale;
23#define BACKLIGHT_SCALE_LINEAR 0
24 int state;
25#define BL_CORE_SUSPENDED 0x00000001
26};
27
28struct backlight_ops {
29 int options;
30#define BL_CORE_SUSPENDRESUME 0x00000001
31 int (*update_status)(struct backlight_device *);
32 int (*get_brightness)(struct backlight_device *);
33};
34
35struct backlight_device {
36 const struct backlight_ops *ops;
37 struct backlight_properties props;
38 struct task task;
39 void *data;
40 SLIST_ENTRY(backlight_device) next;
41 const char *name;
42};
43
44static inline void *
45bl_get_data(struct backlight_device *bd)
46{
47 return bd->data;
48}
49
50static inline int
51backlight_get_brightness(struct backlight_device *bd)
52{
53 return bd->props.brightness;
54}
55
56#define BACKLIGHT_UPDATE_HOTKEY 0
57
58struct backlight_device *backlight_device_register(const char *, void *,
59 void *, const struct backlight_ops *, const struct backlight_properties *);
60void backlight_device_unregister(struct backlight_device *);
61
62static inline struct backlight_device *
63devm_backlight_device_register(void *dev, const char *name, void *parent,
64 void *data, const struct backlight_ops *bo,
65 const struct backlight_properties *bp)
66{
67 return backlight_device_register(name, dev, data, bo, bp);
68}
69
70static inline void
71backlight_update_status(struct backlight_device *bd)
72{
73 bd->ops->update_status(bd);
74}
75
76static inline void
77backlight_force_update(struct backlight_device *bd, int reason)
78{
79 bd->props.brightness = bd->ops->get_brightness(bd);
80}
81
82static inline void
83backlight_device_set_brightness(struct backlight_device *bd, int level)
84{
85 if (level > bd->props.max_brightness)
86 return;
87 bd->props.brightness = level;
88 bd->ops->update_status(bd);
89}
90
91void backlight_schedule_update_status(struct backlight_device *);
92
93int backlight_enable(struct backlight_device *);
94int backlight_disable(struct backlight_device *);
95
96static inline struct backlight_device *
97devm_of_find_backlight(struct device *dev)
98{
99 return NULL;
100}
101
102struct backlight_device *backlight_device_get_by_name(const char *);
103
104#endif