Saturday, June 15, 2013

ACPI Brightness Control (2) - Hotkeys

Overview of Brightness Hotkeys


When a brightness up or down hotkey is pressed, the screen shows a OSD and panel brightness is changed accordingly. A simple action results a simple output, but what happens underneath is a lot of magic.

Figure 1 - Hotkeys Overview (Software)

Figure 1 shows a overview from software perspectives. When a hotkey is pressed, ACPI events are generates that triggers a series of actions specific to OS which eventually changes panel brightness. More information can be found in "ACPI Brightness Control (1) - Control Methods".

BIOS ASL for Brightness Up and Down


How does BIOS tell OS to change brightness? ACPI Appendix B.6 (Notifications Specific to Output Devices) defines five types of notification; however two of them are most commonly used:
  • Notify(LCD, 0x86) – increase brightness
  • Notify(LCD, 0x87) – decrease brightness
where LCD is a devices with _BCL, _BQC and _BCM as the below example:

Device (_SB.PCI0.GFX0.LCD) {
     ...
     Method (_BCL, 0) {
          ...
     }
     Method (_BQC, 0) {
          ...
     }
     Method (_BCM, 1) {
          ...
     }
}

The below is an ASL example of an EC handing Q events for brightness hotkeys:

Device (_SB.PCI0.LPC.EC) {
     Method (_Q12, 0) {
          Notify (_SB.PCI0.GFX0.LCD, 0x86)
     }

     Method (_Q13, 0) {
          Notify (_SB.PCI0.GFX0.LCD, 0x87)
     }
}

When Hotkeys Fail


Most of them, brightness hotkeys fail for two reasons: 

1) No events are triggered: 
On Ubuntu or many other Linux distro, running "acpi_listen" and pressing hotkeys shows standard ACPI events. If you don't see anything with hotkey presses, the system BIOS fails to issue events

2) _BCM fails to work
As Windows 8 no longer uses, many BIOS engineers never check whether _BCM works (please remember ACPI requires _BCM to present in order to support brightness controls). In Linux, you can and write to /sys/class/backlight/acpi_video0/brightness to verify whether _BCM works.

No comments:

Post a Comment