Skip to content

Commit 8639386

Browse files
Aaron Lurafaeljw
authored andcommitted
ACPI / video: update video_extension.txt for backlight control
The ACPI video driver has changed a lot, and it doesn't export interfaces in /proc any more, so the documentation for it should be updated. This update focuses on ACPI video driver's backlight control. Signed-off-by: Aaron Lu <aaron.lu@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 70e66e4 commit 8639386

1 file changed

Lines changed: 95 additions & 26 deletions

File tree

‎Documentation/acpi/video_extension.txt‎

Lines changed: 95 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,99 @@ defining the video POST device, retrieving EDID information or to
88
setup a video output, etc. Note that this is an ref. implementation
99
only. It may or may not work for your integrated video device.
1010

11-
Interfaces exposed to userland through /proc/acpi/video:
12-
13-
VGA/info : display the supported video bus device capability like Video ROM, CRT/LCD/TV.
14-
VGA/ROM : Used to get a copy of the display devices' ROM data (up to 4k).
15-
VGA/POST_info : Used to determine what options are implemented.
16-
VGA/POST : Used to get/set POST device.
17-
VGA/DOS : Used to get/set ownership of output switching:
18-
Please refer ACPI spec B.4.1 _DOS
19-
VGA/CRT : CRT output
20-
VGA/LCD : LCD output
21-
VGA/TVO : TV output
22-
VGA/*/brightness : Used to get/set brightness of output device
23-
24-
Notify event through /proc/acpi/event:
25-
26-
#define ACPI_VIDEO_NOTIFY_SWITCH 0x80
27-
#define ACPI_VIDEO_NOTIFY_PROBE 0x81
28-
#define ACPI_VIDEO_NOTIFY_CYCLE 0x82
29-
#define ACPI_VIDEO_NOTIFY_NEXT_OUTPUT 0x83
30-
#define ACPI_VIDEO_NOTIFY_PREV_OUTPUT 0x84
31-
32-
#define ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS 0x82
33-
#define ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS 0x83
34-
#define ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS 0x84
35-
#define ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS 0x85
36-
#define ACPI_VIDEO_NOTIFY_DISPLAY_OFF 0x86
11+
The ACPI video driver does 3 things regarding backlight control:
3712

13+
1 Export a sysfs interface for user space to control backlight level
14+
15+
If the ACPI table has a video device, and acpi_backlight=vendor kernel
16+
command line is not present, the driver will register a backlight device
17+
and set the required backlight operation structure for it for the sysfs
18+
interface control. For every registered class device, there will be a
19+
directory named acpi_videoX under /sys/class/backlight.
20+
21+
The backlight sysfs interface has a standard definition here:
22+
Documentation/ABI/stable/sysfs-class-backlight.
23+
24+
And what ACPI video driver does is:
25+
actual_brightness: on read, control method _BQC will be evaluated to
26+
get the brightness level the firmware thinks it is at;
27+
bl_power: not implemented, will set the current brightness instead;
28+
brightness: on write, control method _BCM will run to set the requested
29+
brightness level;
30+
max_brightness: Derived from the _BCL package(see below);
31+
type: firmware
32+
33+
Note that ACPI video backlight driver will always use index for
34+
brightness, actual_brightness and max_brightness. So if we have
35+
the following _BCL package:
36+
37+
Method (_BCL, 0, NotSerialized)
38+
{
39+
Return (Package (0x0C)
40+
{
41+
0x64,
42+
0x32,
43+
0x0A,
44+
0x14,
45+
0x1E,
46+
0x28,
47+
0x32,
48+
0x3C,
49+
0x46,
50+
0x50,
51+
0x5A,
52+
0x64
53+
})
54+
}
55+
56+
The first two levels are for when laptop are on AC or on battery and are
57+
not used by Linux currently. The remaining 10 levels are supported levels
58+
that we can choose from. The applicable index values are from 0 (that
59+
corresponds to the 0x0A brightness value) to 9 (that corresponds to the
60+
0x64 brightness value) inclusive. Each of those index values is regarded
61+
as a "brightness level" indicator. Thus from the user space perspective
62+
the range of available brightness levels is from 0 to 9 (max_brightness)
63+
inclusive.
64+
65+
2 Notify user space about hotkey event
66+
67+
There are generally two cases for hotkey event reporting:
68+
i) For some laptops, when user presses the hotkey, a scancode will be
69+
generated and sent to user space through the input device created by
70+
the keyboard driver as a key type input event, with proper remap, the
71+
following key code will appear to user space:
72+
73+
EV_KEY, KEY_BRIGHTNESSUP
74+
EV_KEY, KEY_BRIGHTNESSDOWN
75+
etc.
76+
77+
For this case, ACPI video driver does not need to do anything(actually,
78+
it doesn't even know this happened).
79+
80+
ii) For some laptops, the press of the hotkey will not generate the
81+
scancode, instead, firmware will notify the video device ACPI node
82+
about the event. The event value is defined in the ACPI spec. ACPI
83+
video driver will generate an key type input event according to the
84+
notify value it received and send the event to user space through the
85+
input device it created:
86+
87+
event keycode
88+
0x86 KEY_BRIGHTNESSUP
89+
0x87 KEY_BRIGHTNESSDOWN
90+
etc.
91+
92+
so this would lead to the same effect as case i) now.
93+
94+
Once user space tool receives this event, it can modify the backlight
95+
level through the sysfs interface.
96+
97+
3 Change backlight level in the kernel
98+
99+
This works for machines covered by case ii) in Section 2. Once the driver
100+
received a notification, it will set the backlight level accordingly. This does
101+
not affect the sending of event to user space, they are always sent to user
102+
space regardless of whether or not the video module controls the backlight level
103+
directly. This behaviour can be controlled through the brightness_switch_enabled
104+
module parameter as documented in kernel-parameters.txt. It is recommended to
105+
disable this behaviour once a GUI environment starts up and wants to have full
106+
control of the backlight level.

0 commit comments

Comments
 (0)