Hi,
I've recently been trying to add support for gaming features to my Nitro
AN17-41 laptop.
in particular, I was interested in the "mode/turbo" button, which changes
the CPU/GPU overclocking and fan control from the HW.
Looking through the ACPI tables and WMI methods, I realized that this
support
was already provided for Predator series in the `acer-wmi` driver.
But it currently ignores AC adapter plug/unplug events.
I have found relevant WMI events that are currently ignored:
[352418.426647] acer-wmi: Unknown function number - 8 - 0
[352418.426647] acer-wmi: Unknown function number - 9 - 0
After fiddling a bit more, I now know how to trigger these events and what
their values mean:
* Event 8: triggered every time when AC adapter is plugged in or unplugged.
It also triggered when charging via a USB PD adapter.
Values:
0 - not charging
1 - standard AC charging
4 - charging via USB-PD
* Event 9: triggered when HW detects that it is being powered via a
reliable adapter.
It also somehow coordinates with the result of the WMI method
`GetGamingSysInfo(ACER_WMID_CMD_GET_PREDATOR_V4_BAT_STATUS)`.
In most cases this event fires at the same time as the previous event,
but in some cases (USB-PD charging, or AC charging when the battery is low)
this event fires later, when the battery is charged to a certain level and
the AC adapter is connected. I assume this event means "allow turbo mode".
Values:
0 - turbo mode is not allowed
1 - turbo mode is allowed.
This can be used to automatically switch to the appropriate mode.
I can work on this and submit a patch, but I struggling to find what has
to be done here.
Questions:
1. Is it allowed to change supported platform profile modes at runtime?
Suppose I set or clear bits in the `platform_profile_handler.choices`
when these events fire, so that userspace can know what modes are
currently available.
Is it allowed, and if so, do I need to use additional locking mechanisms?
2. Do I even need to export this specific HW state
("reliable-AC-adapter-and-good-battery")
via sysfs?