blob: 5731ccb42585b7d4a04c59487e4efb777e29d697 [file] [log] [blame]
Matthew Garrett74a365b2009-03-19 21:35:39 +00001#ifndef __ACPI_VIDEO_H
2#define __ACPI_VIDEO_H
3
Chris Wilsonb72512e2010-09-05 14:51:49 +01004#include <linux/errno.h> /* for ENODEV */
Hans de Goede90b066b2015-12-22 19:09:48 +01005#include <linux/types.h> /* for bool */
Chris Wilsonb72512e2010-09-05 14:51:49 +01006
Aaron Lu05950092016-04-27 20:45:04 +08007struct 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
13struct acpi_video_device_brightness {
14 int curr;
15 int count;
16 int *levels;
17 struct acpi_video_brightness_flags flags;
18};
19
Chris Wilsonb72512e2010-09-05 14:51:49 +010020struct acpi_device;
21
Matthew Garrettf5a3d0c2011-07-12 18:30:52 -040022#define ACPI_VIDEO_CLASS "video"
23
Matthew Garrette92a7162010-01-12 14:17:03 -050024#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
Hans de Goede87521e12015-06-16 16:27:48 +020033enum 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
Sudeep Hollabcb2b0b2015-09-14 16:01:55 +010041#if IS_ENABLED(CONFIG_ACPI_VIDEO)
Rafael J. Wysocki8e5c2b72013-07-25 21:43:39 +020042extern int acpi_video_register(void);
Zhao Yakui86e437f2009-06-16 11:23:13 +080043extern void acpi_video_unregister(void);
Matthew Garrette92a7162010-01-12 14:17:03 -050044extern int acpi_video_get_edid(struct acpi_device *device, int type,
45 int device_id, void **edid);
Hans de Goede87521e12015-06-16 16:27:48 +020046extern enum acpi_backlight_type acpi_video_get_backlight_type(void);
47extern void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type);
Hans de Goede382d1162016-01-14 09:41:47 +010048/*
49 * Note: The value returned by acpi_video_handles_brightness_key_presses()
50 * may change over time and should not be cached.
51 */
Hans de Goede90b066b2015-12-22 19:09:48 +010052extern bool acpi_video_handles_brightness_key_presses(void);
Aaron Lu05950092016-04-27 20:45:04 +080053extern int acpi_video_get_levels(struct acpi_device *device,
Aaron Lu9f9cd7e2016-05-21 15:30:46 +080054 struct acpi_video_device_brightness **dev_br,
55 int *pmax_level);
Matthew Garrett74a365b2009-03-19 21:35:39 +000056#else
57static inline int acpi_video_register(void) { return 0; }
Zhao Yakui86e437f2009-06-16 11:23:13 +080058static inline void acpi_video_unregister(void) { return; }
Matthew Garrette92a7162010-01-12 14:17:03 -050059static inline int acpi_video_get_edid(struct acpi_device *device, int type,
60 int device_id, void **edid)
61{
62 return -ENODEV;
63}
Hans de Goede87521e12015-06-16 16:27:48 +020064static inline enum acpi_backlight_type acpi_video_get_backlight_type(void)
65{
66 return acpi_backlight_vendor;
67}
Borislav Petkoveddda192015-06-24 12:01:49 +020068static inline void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type)
Hans de Goede87521e12015-06-16 16:27:48 +020069{
70}
Hans de Goede90b066b2015-12-22 19:09:48 +010071static inline bool acpi_video_handles_brightness_key_presses(void)
72{
73 return false;
74}
Arnd Bergmanne4f35c12016-05-12 23:00:12 +020075static inline int acpi_video_get_levels(struct acpi_device *device,
Aaron Lu9f9cd7e2016-05-21 15:30:46 +080076 struct acpi_video_device_brightness **dev_br,
77 int *pmax_level)
Aaron Lu05950092016-04-27 20:45:04 +080078{
79 return -ENODEV;
80}
Matthew Garrett74a365b2009-03-19 21:35:39 +000081#endif
82
83#endif