summaryrefslogtreecommitdiff
path: root/drivers/platform
diff options
context:
space:
mode:
authorDaniel Bertalan <dani@danielbertalan.dev>2023-04-14 21:02:10 +0300
committerHans de Goede <hdegoede@redhat.com>2023-04-17 13:21:03 +0300
commit3a133f7c51b20d5d330d5424f3ef0dc283992500 (patch)
tree448c4bb0d6f9fe9384a7c7af59179a1e6e4576f8 /drivers/platform
parent14f6f0e3709a8aa987ae78783d2e4d63f88cc13a (diff)
downloadlinux-3a133f7c51b20d5d330d5424f3ef0dc283992500.tar.xz
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>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 32c10457399e..826c522ed1c0 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -11691,6 +11691,7 @@ static int __init thinkpad_acpi_module_init(void)
{
const struct dmi_system_id *dmi_id;
int ret, i;
+ acpi_object_type obj_type;
tpacpi_lifecycle = TPACPI_LIFE_INIT;
@@ -11716,6 +11717,21 @@ static int __init thinkpad_acpi_module_init(void)
TPACPI_ACPIHANDLE_INIT(ecrd);
TPACPI_ACPIHANDLE_INIT(ecwr);
+ /*
+ * Quirk: in some models (e.g. X380 Yoga), an object named ECRD
+ * exists, but it is a register, not a method.
+ */
+ if (ecrd_handle) {
+ acpi_get_type(ecrd_handle, &obj_type);
+ if (obj_type != ACPI_TYPE_METHOD)
+ ecrd_handle = NULL;
+ }
+ if (ecwr_handle) {
+ acpi_get_type(ecwr_handle, &obj_type);
+ if (obj_type != ACPI_TYPE_METHOD)
+ ecwr_handle = NULL;
+ }
+
tpacpi_wq = create_singlethread_workqueue(TPACPI_WORKQUEUE_NAME);
if (!tpacpi_wq) {
thinkpad_acpi_module_exit();