xref: /openbmc/linux/include/acpi/video.h (revision 3805e6a1)
1 #ifndef __ACPI_VIDEO_H
2 #define __ACPI_VIDEO_H
3 
4 #include <linux/errno.h> /* for ENODEV */
5 #include <linux/types.h> /* for bool */
6 
7 struct acpi_video_brightness_flags {
8 	u8 _BCL_no_ac_battery_levels:1;	/* no AC/Battery levels in _BCL */
9 	u8 _BCL_reversed:1;		/* _BCL package is in a reversed order */
10 	u8 _BQC_use_index:1;		/* _BQC returns an index value */
11 };
12 
13 struct acpi_video_device_brightness {
14 	int curr;
15 	int count;
16 	int *levels;
17 	struct acpi_video_brightness_flags flags;
18 };
19 
20 struct acpi_device;
21 
22 #define ACPI_VIDEO_CLASS	"video"
23 
24 #define ACPI_VIDEO_DISPLAY_CRT  1
25 #define ACPI_VIDEO_DISPLAY_TV   2
26 #define ACPI_VIDEO_DISPLAY_DVI  3
27 #define ACPI_VIDEO_DISPLAY_LCD  4
28 
29 #define ACPI_VIDEO_DISPLAY_LEGACY_MONITOR 0x0100
30 #define ACPI_VIDEO_DISPLAY_LEGACY_PANEL   0x0110
31 #define ACPI_VIDEO_DISPLAY_LEGACY_TV      0x0200
32 
33 enum acpi_backlight_type {
34 	acpi_backlight_undef = -1,
35 	acpi_backlight_none = 0,
36 	acpi_backlight_video,
37 	acpi_backlight_vendor,
38 	acpi_backlight_native,
39 };
40 
41 #if IS_ENABLED(CONFIG_ACPI_VIDEO)
42 extern int acpi_video_register(void);
43 extern void acpi_video_unregister(void);
44 extern int acpi_video_get_edid(struct acpi_device *device, int type,
45 			       int device_id, void **edid);
46 extern enum acpi_backlight_type acpi_video_get_backlight_type(void);
47 extern void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type);
48 /*
49  * Note: The value returned by acpi_video_handles_brightness_key_presses()
50  * may change over time and should not be cached.
51  */
52 extern bool acpi_video_handles_brightness_key_presses(void);
53 extern int acpi_video_get_levels(struct acpi_device *device,
54 				 struct acpi_video_device_brightness **dev_br);
55 #else
56 static inline int acpi_video_register(void) { return 0; }
57 static inline void acpi_video_unregister(void) { return; }
58 static inline int acpi_video_get_edid(struct acpi_device *device, int type,
59 				      int device_id, void **edid)
60 {
61 	return -ENODEV;
62 }
63 static inline enum acpi_backlight_type acpi_video_get_backlight_type(void)
64 {
65 	return acpi_backlight_vendor;
66 }
67 static inline void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type)
68 {
69 }
70 static inline bool acpi_video_handles_brightness_key_presses(void)
71 {
72 	return false;
73 }
74 static inline int acpi_video_get_levels(struct acpi_device *device,
75 			struct acpi_video_device_brightness **dev_br)
76 {
77 	return -ENODEV;
78 }
79 #endif
80 
81 #endif
82