blob: db8548ff03cef48fc2af9f7fab2443e9b1c0d6d7 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Matthew Garrett74a365b2009-03-19 21:35:39 +00002#ifndef __ACPI_VIDEO_H
3#define __ACPI_VIDEO_H
4
Chris Wilsonb72512e2010-09-05 14:51:49 +01005#include <linux/errno.h> /* for ENODEV */
Hans de Goede90b066b2015-12-22 19:09:48 +01006#include <linux/types.h> /* for bool */
Chris Wilsonb72512e2010-09-05 14:51:49 +01007
Aaron Lu05950092016-04-27 20:45:04 +08008struct acpi_video_brightness_flags {
9 u8 _BCL_no_ac_battery_levels:1; /* no AC/Battery levels in _BCL */
10 u8 _BCL_reversed:1; /* _BCL package is in a reversed order */
11 u8 _BQC_use_index:1; /* _BQC returns an index value */
12};
13
14struct acpi_video_device_brightness {
15 int curr;
16 int count;
17 int *levels;
18 struct acpi_video_brightness_flags flags;
19};
20
Chris Wilsonb72512e2010-09-05 14:51:49 +010021struct acpi_device;
22
Matthew Garrettf5a3d0c2011-07-12 18:30:52 -040023#define ACPI_VIDEO_CLASS "video"
24
Matthew Garrette92a7162010-01-12 14:17:03 -050025#define ACPI_VIDEO_DISPLAY_CRT 1
26#define ACPI_VIDEO_DISPLAY_TV 2
27#define ACPI_VIDEO_DISPLAY_DVI 3
28#define ACPI_VIDEO_DISPLAY_LCD 4
29
30#define ACPI_VIDEO_DISPLAY_LEGACY_MONITOR 0x0100
31#define ACPI_VIDEO_DISPLAY_LEGACY_PANEL 0x0110
32#define ACPI_VIDEO_DISPLAY_LEGACY_TV 0x0200
33
Hans de Goedeeff4a752016-11-09 18:15:56 +010034#define ACPI_VIDEO_NOTIFY_SWITCH 0x80
35#define ACPI_VIDEO_NOTIFY_PROBE 0x81
36#define ACPI_VIDEO_NOTIFY_CYCLE 0x82
37#define ACPI_VIDEO_NOTIFY_NEXT_OUTPUT 0x83
38#define ACPI_VIDEO_NOTIFY_PREV_OUTPUT 0x84
39#define ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS 0x85
40#define ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS 0x86
41#define ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS 0x87
42#define ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS 0x88
43#define ACPI_VIDEO_NOTIFY_DISPLAY_OFF 0x89
44
Hans de Goede87521e12015-06-16 16:27:48 +020045enum acpi_backlight_type {
46 acpi_backlight_undef = -1,
47 acpi_backlight_none = 0,
48 acpi_backlight_video,
49 acpi_backlight_vendor,
50 acpi_backlight_native,
51};
52
Sudeep Hollabcb2b0b2015-09-14 16:01:55 +010053#if IS_ENABLED(CONFIG_ACPI_VIDEO)
Rafael J. Wysocki8e5c2b72013-07-25 21:43:39 +020054extern int acpi_video_register(void);
Zhao Yakui86e437f2009-06-16 11:23:13 +080055extern void acpi_video_unregister(void);
Matthew Garrette92a7162010-01-12 14:17:03 -050056extern int acpi_video_get_edid(struct acpi_device *device, int type,
57 int device_id, void **edid);
Hans de Goede87521e12015-06-16 16:27:48 +020058extern enum acpi_backlight_type acpi_video_get_backlight_type(void);
59extern void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type);
Hans de Goede382d1162016-01-14 09:41:47 +010060/*
61 * Note: The value returned by acpi_video_handles_brightness_key_presses()
62 * may change over time and should not be cached.
63 */
Hans de Goede90b066b2015-12-22 19:09:48 +010064extern bool acpi_video_handles_brightness_key_presses(void);
Aaron Lu05950092016-04-27 20:45:04 +080065extern int acpi_video_get_levels(struct acpi_device *device,
Aaron Lu9f9cd7e2016-05-21 15:30:46 +080066 struct acpi_video_device_brightness **dev_br,
67 int *pmax_level);
Matthew Garrett74a365b2009-03-19 21:35:39 +000068#else
Arvind Yadav03462232016-06-23 00:26:01 +053069static inline int acpi_video_register(void) { return -ENODEV; }
Zhao Yakui86e437f2009-06-16 11:23:13 +080070static inline void acpi_video_unregister(void) { return; }
Matthew Garrette92a7162010-01-12 14:17:03 -050071static inline int acpi_video_get_edid(struct acpi_device *device, int type,
72 int device_id, void **edid)
73{
74 return -ENODEV;
75}
Hans de Goede87521e12015-06-16 16:27:48 +020076static inline enum acpi_backlight_type acpi_video_get_backlight_type(void)
77{
78 return acpi_backlight_vendor;
79}
Borislav Petkoveddda192015-06-24 12:01:49 +020080static inline void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type)
Hans de Goede87521e12015-06-16 16:27:48 +020081{
82}
Hans de Goede90b066b2015-12-22 19:09:48 +010083static inline bool acpi_video_handles_brightness_key_presses(void)
84{
85 return false;
86}
Arnd Bergmanne4f35c12016-05-12 23:00:12 +020087static inline int acpi_video_get_levels(struct acpi_device *device,
Aaron Lu9f9cd7e2016-05-21 15:30:46 +080088 struct acpi_video_device_brightness **dev_br,
89 int *pmax_level)
Aaron Lu05950092016-04-27 20:45:04 +080090{
91 return -ENODEV;
92}
Matthew Garrett74a365b2009-03-19 21:35:39 +000093#endif
94
95#endif