Skip to content

Commit 3a133f7

Browse files
BertalanDjwrdegoede
authored andcommitted
platform/x86: thinkpad_acpi: Fix Embedded Controller access on X380 Yoga
On the X380 Yoga, the `ECRD` and `ECWR` ACPI objects cannot be used for accessing the Embedded Controller: instead of a method that reads from the EC's memory, `ECRD` is the name of a location in high memory. This meant that trying to call them would fail with the following message: ACPI: \_SB.PCI0.LPCB.EC.ECRD: 1 arguments were passed to a non-method ACPI object (RegionField) With this commit, it is now possible to access the EC and read temperature and fan speed information. Note that while writes to the HFSP register do go through (as indicated by subsequent reads showing the new value), the fan does not actually change its speed. Signed-off-by: Daniel Bertalan <dani@danielbertalan.dev> Link: https://lore.kernel.org/r/20230414180034.63914-1-dani@danielbertalan.dev Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
1 parent 14f6f0e commit 3a133f7

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

drivers/platform/x86/thinkpad_acpi.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11691,6 +11691,7 @@ static int __init thinkpad_acpi_module_init(void)
1169111691
{
1169211692
const struct dmi_system_id *dmi_id;
1169311693
int ret, i;
11694+
acpi_object_type obj_type;
1169411695

1169511696
tpacpi_lifecycle = TPACPI_LIFE_INIT;
1169611697

@@ -11716,6 +11717,21 @@ static int __init thinkpad_acpi_module_init(void)
1171611717
TPACPI_ACPIHANDLE_INIT(ecrd);
1171711718
TPACPI_ACPIHANDLE_INIT(ecwr);
1171811719

11720+
/*
11721+
* Quirk: in some models (e.g. X380 Yoga), an object named ECRD
11722+
* exists, but it is a register, not a method.
11723+
*/
11724+
if (ecrd_handle) {
11725+
acpi_get_type(ecrd_handle, &obj_type);
11726+
if (obj_type != ACPI_TYPE_METHOD)
11727+
ecrd_handle = NULL;
11728+
}
11729+
if (ecwr_handle) {
11730+
acpi_get_type(ecwr_handle, &obj_type);
11731+
if (obj_type != ACPI_TYPE_METHOD)
11732+
ecwr_handle = NULL;
11733+
}
11734+
1171911735
tpacpi_wq = create_singlethread_workqueue(TPACPI_WORKQUEUE_NAME);
1172011736
if (!tpacpi_wq) {
1172111737
thinkpad_acpi_module_exit();

0 commit comments

Comments
 (0)