From: Armin Wolf <W_Armin@gmx.de>
To: james@equiv.tech, markpearson@lenovo.com, jorge.lopez2@hp.com
Cc: jdelvare@suse.com, linux@roeck-us.net,
linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org,
hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com,
platform-driver-x86@vger.kernel.org, corbet@lwn.net,
linux-doc@vger.kernel.org
Subject: [PATCH v2 7/8] platform/x86: wmi: Call WCxx methods when setting data blocks
Date: Sun, 16 Feb 2025 20:32:50 +0100 [thread overview]
Message-ID: <20250216193251.866125-8-W_Armin@gmx.de> (raw)
In-Reply-To: <20250216193251.866125-1-W_Armin@gmx.de>
After performing some tests with a custom SSDT table available at
https://github.com/Wer-Wolf/acpi-wmi-ssdt i found out that Windows
also enables data block collection even when the data block is
being set.
Emulate this behaviour to avoid confusing the ACPI firmware.
The bus-based API already implements this behaviour, so only the
legacy GUID-based API needs to be changed.
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
Documentation/wmi/acpi-interface.rst | 3 +++
drivers/platform/x86/wmi.c | 6 ++++++
2 files changed, 9 insertions(+)
diff --git a/Documentation/wmi/acpi-interface.rst b/Documentation/wmi/acpi-interface.rst
index 06fb7fcf4413..f1b28835d23c 100644
--- a/Documentation/wmi/acpi-interface.rst
+++ b/Documentation/wmi/acpi-interface.rst
@@ -89,6 +89,9 @@ Similar to the ``WExx`` ACPI methods, except that it controls data collection
instead of events and thus the last two characters of the ACPI method name are
the method ID of the data block to enable/disable.
+Those ACPI methods are also called before setting data blocks to match the
+behaviour of the Windows driver.
+
_WED ACPI method
----------------
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index 97c4a161799e..db76c5bc6e12 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -461,8 +461,14 @@ acpi_status wmi_set_block(const char *guid_string, u8 instance, const struct acp
if (IS_ERR(wdev))
return AE_ERROR;
+ if (wmi_device_enable(wdev, true) < 0)
+ dev_warn(&wdev->dev, "Failed to enable device\n");
+
status = wmidev_block_set(wdev, instance, in);
+ if (wmi_device_enable(wdev, false) < 0)
+ dev_warn(&wdev->dev, "Failed to disable device\n");
+
wmi_device_put(wdev);
return status;
--
2.39.5
next prev parent reply other threads:[~2025-02-16 19:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-16 19:32 [PATCH v2 0/8] platform/x86: wmi: Rework WMI device enabling Armin Wolf
2025-02-16 19:32 ` [PATCH v2 1/8] hwmon: (hp-wmi-sensors) Use the WMI bus API when accessing sensors Armin Wolf
2025-02-16 19:32 ` [PATCH v2 2/8] platform/x86: think-lmi: Use ACPI object when extracting strings Armin Wolf
2025-02-16 19:32 ` [PATCH v2 3/8] platform/x86: think-lmi: Use WMI bus API when accessing BIOS settings Armin Wolf
2025-02-16 19:32 ` [PATCH v2 4/8] platform/x86: hp-bioscfg: Use wmi_instance_count() Armin Wolf
2025-02-16 19:32 ` [PATCH v2 5/8] platform/x86: wmi: Use devres to disable the WMI device Armin Wolf
2025-02-16 19:32 ` [PATCH v2 6/8] platform/x86: wmi: Rework WCxx/WExx ACPI method handling Armin Wolf
2025-02-16 19:32 ` Armin Wolf [this message]
2025-02-16 19:32 ` [PATCH v2 8/8] platform/x86: wmi: Update documentation regarding the GUID-based API Armin Wolf
2025-02-24 15:17 ` [PATCH v2 0/8] platform/x86: wmi: Rework WMI device enabling Ilpo Järvinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250216193251.866125-8-W_Armin@gmx.de \
--to=w_armin@gmx.de \
--cc=corbet@lwn.net \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=james@equiv.tech \
--cc=jdelvare@suse.com \
--cc=jorge.lopez2@hp.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=markpearson@lenovo.com \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®