Matthew Garrett | 74a365b | 2009-03-19 21:35:39 +0000 | [diff] [blame] | 1 | #ifndef __ACPI_VIDEO_H |
| 2 | #define __ACPI_VIDEO_H |
| 3 | |
Chris Wilson | b72512e | 2010-09-05 14:51:49 +0100 | [diff] [blame] | 4 | #include <linux/errno.h> /* for ENODEV */ |
Hans de Goede | 90b066b | 2015-12-22 19:09:48 +0100 | [diff] [blame] | 5 | #include <linux/types.h> /* for bool */ |
Chris Wilson | b72512e | 2010-09-05 14:51:49 +0100 | [diff] [blame] | 6 | |
Aaron Lu | 0595009 | 2016-04-27 20:45:04 +0800 | [diff] [blame] | 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 | |
Chris Wilson | b72512e | 2010-09-05 14:51:49 +0100 | [diff] [blame] | 20 | struct acpi_device; |
| 21 | |
Matthew Garrett | f5a3d0c | 2011-07-12 18:30:52 -0400 | [diff] [blame] | 22 | #define ACPI_VIDEO_CLASS "video" |
| 23 | |
Matthew Garrett | e92a716 | 2010-01-12 14:17:03 -0500 | [diff] [blame] | 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 | |
Hans de Goede | eff4a75 | 2016-11-09 18:15:56 +0100 | [diff] [blame] | 33 | #define ACPI_VIDEO_NOTIFY_SWITCH 0x80 |
| 34 | #define ACPI_VIDEO_NOTIFY_PROBE 0x81 |
| 35 | #define ACPI_VIDEO_NOTIFY_CYCLE 0x82 |
| 36 | #define ACPI_VIDEO_NOTIFY_NEXT_OUTPUT 0x83 |
| 37 | #define ACPI_VIDEO_NOTIFY_PREV_OUTPUT 0x84 |
| 38 | #define ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS 0x85 |
| 39 | #define ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS 0x86 |
| 40 | #define ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS 0x87 |
| 41 | #define ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS 0x88 |
| 42 | #define ACPI_VIDEO_NOTIFY_DISPLAY_OFF 0x89 |
| 43 | |
Hans de Goede | 87521e1 | 2015-06-16 16:27:48 +0200 | [diff] [blame] | 44 | enum acpi_backlight_type { |
| 45 | acpi_backlight_undef = -1, |
| 46 | acpi_backlight_none = 0, |
| 47 | acpi_backlight_video, |
| 48 | acpi_backlight_vendor, |
| 49 | acpi_backlight_native, |
| 50 | }; |
| 51 | |
Sudeep Holla | bcb2b0b | 2015-09-14 16:01:55 +0100 | [diff] [blame] | 52 | #if IS_ENABLED(CONFIG_ACPI_VIDEO) |
Rafael J. Wysocki | 8e5c2b7 | 2013-07-25 21:43:39 +0200 | [diff] [blame] | 53 | extern int acpi_video_register(void); |
Zhao Yakui | 86e437f | 2009-06-16 11:23:13 +0800 | [diff] [blame] | 54 | extern void acpi_video_unregister(void); |
Matthew Garrett | e92a716 | 2010-01-12 14:17:03 -0500 | [diff] [blame] | 55 | extern int acpi_video_get_edid(struct acpi_device *device, int type, |
| 56 | int device_id, void **edid); |
Hans de Goede | 87521e1 | 2015-06-16 16:27:48 +0200 | [diff] [blame] | 57 | extern enum acpi_backlight_type acpi_video_get_backlight_type(void); |
| 58 | extern void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type); |
Hans de Goede | 382d116 | 2016-01-14 09:41:47 +0100 | [diff] [blame] | 59 | /* |
| 60 | * Note: The value returned by acpi_video_handles_brightness_key_presses() |
| 61 | * may change over time and should not be cached. |
| 62 | */ |
Hans de Goede | 90b066b | 2015-12-22 19:09:48 +0100 | [diff] [blame] | 63 | extern bool acpi_video_handles_brightness_key_presses(void); |
Aaron Lu | 0595009 | 2016-04-27 20:45:04 +0800 | [diff] [blame] | 64 | extern int acpi_video_get_levels(struct acpi_device *device, |
Aaron Lu | 9f9cd7e | 2016-05-21 15:30:46 +0800 | [diff] [blame] | 65 | struct acpi_video_device_brightness **dev_br, |
| 66 | int *pmax_level); |
Matthew Garrett | 74a365b | 2009-03-19 21:35:39 +0000 | [diff] [blame] | 67 | #else |
Arvind Yadav | 0346223 | 2016-06-23 00:26:01 +0530 | [diff] [blame] | 68 | static inline int acpi_video_register(void) { return -ENODEV; } |
Zhao Yakui | 86e437f | 2009-06-16 11:23:13 +0800 | [diff] [blame] | 69 | static inline void acpi_video_unregister(void) { return; } |
Matthew Garrett | e92a716 | 2010-01-12 14:17:03 -0500 | [diff] [blame] | 70 | static inline int acpi_video_get_edid(struct acpi_device *device, int type, |
| 71 | int device_id, void **edid) |
| 72 | { |
| 73 | return -ENODEV; |
| 74 | } |
Hans de Goede | 87521e1 | 2015-06-16 16:27:48 +0200 | [diff] [blame] | 75 | static inline enum acpi_backlight_type acpi_video_get_backlight_type(void) |
| 76 | { |
| 77 | return acpi_backlight_vendor; |
| 78 | } |
Borislav Petkov | eddda19 | 2015-06-24 12:01:49 +0200 | [diff] [blame] | 79 | static inline void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type) |
Hans de Goede | 87521e1 | 2015-06-16 16:27:48 +0200 | [diff] [blame] | 80 | { |
| 81 | } |
Hans de Goede | 90b066b | 2015-12-22 19:09:48 +0100 | [diff] [blame] | 82 | static inline bool acpi_video_handles_brightness_key_presses(void) |
| 83 | { |
| 84 | return false; |
| 85 | } |
Arnd Bergmann | e4f35c1 | 2016-05-12 23:00:12 +0200 | [diff] [blame] | 86 | static inline int acpi_video_get_levels(struct acpi_device *device, |
Aaron Lu | 9f9cd7e | 2016-05-21 15:30:46 +0800 | [diff] [blame] | 87 | struct acpi_video_device_brightness **dev_br, |
| 88 | int *pmax_level) |
Aaron Lu | 0595009 | 2016-04-27 20:45:04 +0800 | [diff] [blame] | 89 | { |
| 90 | return -ENODEV; |
| 91 | } |
Matthew Garrett | 74a365b | 2009-03-19 21:35:39 +0000 | [diff] [blame] | 92 | #endif |
| 93 | |
| 94 | #endif |