diff options
author | Armin Wolf <W_Armin@gmx.de> | 2024-08-13 05:29:03 +0300 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2024-08-19 14:36:35 +0300 |
commit | 3573fee87fe36e7c078d801809b186984ebe10d9 (patch) | |
tree | 141cbd89d7777d9771b4fcd7e608db9d5a196f8e /drivers/platform/surface/aggregator/controller.c | |
parent | 8f2407cb3f1e8586622e80269338efb7bed2f05b (diff) | |
download | linux-3573fee87fe36e7c078d801809b186984ebe10d9.tar.xz |
platform/x86: lg-laptop: Add operation region support
The LEGX0820 ACPI device is expected to provide a custom operation
region:
OperationRegion (XIN1, 0x8F, Zero, 0x04B0)
Field (XIN1, AnyAcc, Lock, Preserve)
{
DMSG, 8,
HDAP, 8,
Offset (0x03),
AFNM, 8,
Offset (0x10),
P80B, 8,
P81B, 8,
P82B, 8,
P83B, 8,
P84B, 8,
P85B, 8,
P86B, 8,
P87B, 8,
Offset (0x20),
DTTM, 8,
TMP1, 8,
LTP1, 8,
HTP1, 8,
TMP2, 8,
LTP2, 8,
HTP2, 8,
Offset (0x3E8),
PMSG, 1600
}
The PMSG field is used by AML code to log debug messages when DMSG is
true. Since those debug messages are already logged using the standard
ACPI Debug object, we set DMSG unconditionally to 0x00 and ignore any
writes to PMSG.
The TMPx, LTPx, HTPx and AFNM fields are used to inform the driver when
the temperature/(presumably) trip points/fan mode changes. This only
happens when the DTTM flag is set.
Unfortunately we have to implement support for this operation region
because the AML codes uses code constructs like this one:
If (((\_SB.XINI.PLAV != Zero) && (\_SB.XINI.DTTM != Zero)))
The PLAV field gets set to 1 when the driver registers its address space
handler, so by default XIN1 should not be accessed.
However ACPI does not use short-circuit evaluation when evaluating
logical conditions. This causes the DTTM field to be accessed even
when PLAV is 0, which results in an ACPI error.
Since this check happens inside various thermal-related ACPI control
methods, various thermal zone become unusable since any attempt to
read their temperature results in an ACPI error.
Fix this by providing support for this operation region. I suspect
that the problem does not happen under Windows (which seemingly does
not use short-circuit evaluation either) because the necessary driver
comes preinstalled with the machine.
Tested-by: Chris <ghostwind@gmail.com>
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20240813022903.20567-1-W_Armin@gmx.de
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/platform/surface/aggregator/controller.c')
0 files changed, 0 insertions, 0 deletions