Page 1 of 1

basic ACPI questions (power button, brightness control)

Posted: Wed Jul 27, 2022 12:35 am
by xeyes
Built ACPICA while looking into a different problem and have some basic questions on it:

Power button:

I registered a fixed event handler for this event, and it works once in Qemu, but subsequet presses no longer triggers SCI or my handler.

Do I need to do something in the handler for it to be called again? I saw that AcpiEvFixedEventDispatch() already clears the status bit.

It doesn't work at all on real hardware, pressing power button doesn't trigger either SCI or the handler. Is it required that a power botton is always wired to trigger this fixed event or the vendors can become creative and do something else?


Brightness control:

In the spec there is a section on "Extensions for Display Adapters". But ACPICA didn't print any of those method names (such as _BCL) during initialization.

Didn't find much about backlight in ACPICA's documents either. Could folks with experience of this help give some pointers on where to look?


Also wondering whether this is a commonly supported and used interface to change brightness on laptops? Or is it like the "protected mode VBE interface", that is not supported by most devices thus a device specific GPU driver is needed for brightness control in most cases once ACPI is enabled?

Re: basic ACPI questions (power button, brightness control)

Posted: Wed Jul 27, 2022 11:44 am
by nullplan
Well, I can tell you that my laptop does implement _BCL and _BCM, and they appear to work at least at a glance.

Re: basic ACPI questions (power button, brightness control)

Posted: Wed Jul 27, 2022 12:56 pm
by Octacone
xeyes wrote: thus a device specific GPU driver is needed for brightness control in most cases once ACPI is enabled?
Hmm... while writing a Intel HD Graphics driver I've seen a lot of paragraphs about brightness control. It seems straight forward and I think you don't even need ACPI.

Re: basic ACPI questions (power button, brightness control)

Posted: Thu Jul 28, 2022 9:20 pm
by xeyes
nullplan wrote:Well, I can tell you that my laptop does implement _BCL and _BCM, and they appear to work at least at a glance.
Consider yourself lucky :lol:

Tried 3 laptops and ACPI brightness control works only on 1 out of the 3 under Linux.

I got the only supported one half working before looking at its AML code. _BCM works for some levels, but _BCL always return a fake list of 102 items, values from 0 to 100, many of which don't do anything when given to _BCM.

Can't figure out why, I dumped the tables and found out that the logic inside _BCL is similar to

Code: Select all

if (win8 or later)
    return fake list of 102 items levels
else
    return real list of supported levels
What's special about Win8? I searched the internet and learned that Windows stopped using ACPI brightness control from Win 8 onwards, which was 10 years ago. Maybe it isn't a surprise that only 1 out of 3 laptops still support an interface that "nobody" is using now.

Thus, the current situation is :

1. You lie to FW, claiming that you are Windows, for AML to work well
2. FW also lie to Windows (fake or real), claiming that it supports 100 levels in its _BCL return value, knowing that Windows doesn't use _BCM

Maybe ACPI brightness control isn't exactly another VBE 3.0 PM interface yet, but it seems to be quickly on its way to become one.


On the other hand, the power button events work much better on laptops that don't support _BCM, do both work on yours?
Octacone wrote:
xeyes wrote: thus a device specific GPU driver is needed for brightness control in most cases once ACPI is enabled?
Hmm... while writing a Intel HD Graphics driver I've seen a lot of paragraphs about brightness control. It seems straight forward and I think you don't even need ACPI.
Thanks! Good to hear that it might not be too difficult to do this from the GPU side.

Probably not a good idea to start writing graphics driver because a timer interrupt was lost though, so maybe later.