* [PATCH 0/2] platform/x86: uniwill: add read-only WMI EC backend
@ 2026-11-23 21:05 Renan Biegelmeyer
2026-11-23 21:05 ` [PATCH 1/2] " Renan Biegelmeyer
2026-11-23 21:05 ` [PATCH 2/2] platform/x86: uniwill: document the WMI EC fallback Renan Biegelmeyer
0 siblings, 2 replies; 3+ messages in thread
From: Renan Biegelmeyer @ 2026-11-23 21:05 UTC (permalink / raw)
To: Armin Wolf, platform-driver-x86
Cc: Hans de Goede, Ilpo Järvinen, linux-kernel, Renan Biegelmeyer
Some Uniwill-based devices do not expose the INOU0000 ACPI device, so the
in-tree driver cannot bind even though the EC is still reachable through the
AcpiTest_MULong WMI interface. This is the case on the Avell A62 LIV used for
testing.
Patch 1 adds a read-only regmap backend over that WMI interface, makes the WMI
driver instantiate the platform device when INOU0000 is absent and the EC
answers a test read, and restricts the WMI path to the hwmon sensors (CPU/GPU
temperature, fan speed and PWM). All write-oriented features are skipped; the
WMI backend intentionally has no write callback.
Patch 2 documents the fallback.
The series is based on platform-drivers-x86/for-next at 2268d837d and is
compile-tested with W=1 and checkpatch --strict. Runtime-tested on an Avell
A62 LIV (i7-10750H, BIOS N.1.02) with the same change backported to 7.3.5:
the driver exposes fan1/fan2, temp1/temp2 and pwm1/pwm2, with values matching
coretemp/nvidia-smi (3157/3084 RPM, 60/56 °C, PWM 102).
Tested-by: Renan Biegelmeyer <renan.biegel@gmail.com>
Renan Biegelmeyer (2):
platform/x86: uniwill: add read-only WMI EC backend
platform/x86: uniwill: document the WMI EC fallback
Documentation/wmi/devices/uniwill-laptop.rst | 8 ++
drivers/platform/x86/uniwill/uniwill-acpi.c | 138 +++++++++++++++++--
drivers/platform/x86/uniwill/uniwill-wmi.c | 76 ++++++++++
drivers/platform/x86/uniwill/uniwill-wmi.h | 12 ++
4 files changed, 225 insertions(+), 9 deletions(-)
base-commit: 2268d837dea13a78639fa3dad60472bb67478709
--
2.56.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] platform/x86: uniwill: add read-only WMI EC backend
2026-11-23 21:05 [PATCH 0/2] platform/x86: uniwill: add read-only WMI EC backend Renan Biegelmeyer
@ 2026-11-23 21:05 ` Renan Biegelmeyer
2026-11-23 21:05 ` [PATCH 2/2] platform/x86: uniwill: document the WMI EC fallback Renan Biegelmeyer
1 sibling, 0 replies; 3+ messages in thread
From: Renan Biegelmeyer @ 2026-11-23 21:05 UTC (permalink / raw)
To: Armin Wolf, platform-driver-x86
Cc: Hans de Goede, Ilpo Järvinen, linux-kernel, Renan Biegelmeyer
Some Uniwill-based devices do not expose the INOU0000 ACPI device, so
the driver cannot bind even though the EC is still reachable through the
AcpiTest_MULong WMI interface.
Add a read-only regmap backend for that interface and let the WMI driver
instantiate the platform device when INOU0000 is absent and the EC answers
a test read. Only the hwmon sensors (CPU/GPU temperature, fan speed and
PWM) are initialized in this mode; all write-oriented features are
skipped, as the WMI backend intentionally has no write callback.
Add a DMI entry for the Avell A62 LIV, which uses this interface.
Signed-off-by: Renan Biegelmeyer <renan.biegel@gmail.com>
---
drivers/platform/x86/uniwill/uniwill-acpi.c | 138 ++++++++++++++++++--
drivers/platform/x86/uniwill/uniwill-wmi.c | 76 +++++++++++
drivers/platform/x86/uniwill/uniwill-wmi.h | 12 ++
3 files changed, 217 insertions(+), 9 deletions(-)
diff --git a/drivers/platform/x86/uniwill/uniwill-acpi.c b/drivers/platform/x86/uniwill/uniwill-acpi.c
index 7fb52b574..9b7627271 100644
--- a/drivers/platform/x86/uniwill/uniwill-acpi.c
+++ b/drivers/platform/x86/uniwill/uniwill-acpi.c
@@ -42,10 +42,12 @@
#include <linux/pm.h>
#include <linux/printk.h>
#include <linux/regmap.h>
+#include <linux/slab.h>
#include <linux/string.h>
#include <linux/sysfs.h>
#include <linux/types.h>
#include <linux/units.h>
+#include <linux/wmi.h>
#include <acpi/battery.h>
@@ -338,7 +340,7 @@
#define EC_ADDR_PWM_2_WRITEABLE 0x1809
-#define DRIVER_NAME "uniwill"
+#define DRIVER_NAME UNIWILL_PLATFORM_NAME
/*
* The OEM software always sleeps up to 6 ms after reading/writing EC
@@ -380,7 +382,9 @@ struct uniwill_data {
struct device *dev;
acpi_handle handle;
struct regmap *regmap;
+ struct mutex wmi_lock; /* Protects WMI EC transactions */
unsigned int features;
+ bool wmi_ec;
u8 project_id;
struct acpi_battery_hook hook;
struct mutex battery_lock; /* Protects the list of currently registered batteries */
@@ -596,6 +600,55 @@ static const struct regmap_bus uniwill_ec_bus = {
.val_format_endian_default = REGMAP_ENDIAN_LITTLE,
};
+#define UNIWILL_WMI_EC_METHOD 4
+#define UNIWILL_WMI_EC_READ_OP 0x01
+#define UNIWILL_WMI_EC_FAIL_MARKER 0xfe
+
+static int uniwill_wmi_ec_reg_read(void *context, unsigned int reg, unsigned int *val)
+{
+ struct uniwill_data *data = context;
+ u32 args[10] = { };
+ u8 *bytes = (u8 *)args;
+ struct acpi_buffer in = { .length = sizeof(args), .pointer = args };
+ struct acpi_buffer out = { ACPI_ALLOCATE_BUFFER, NULL };
+ union acpi_object *obj;
+ acpi_status status;
+ int ret = 0;
+
+ bytes[0] = reg & 0xff;
+ bytes[1] = reg >> 8;
+ bytes[5] = UNIWILL_WMI_EC_READ_OP;
+
+ guard(mutex)(&data->wmi_lock);
+ status = wmi_evaluate_method(UNIWILL_WMI_EC_GUID, 0, UNIWILL_WMI_EC_METHOD,
+ &in, &out);
+ obj = out.pointer;
+ if (ACPI_FAILURE(status) || !obj || obj->type != ACPI_TYPE_BUFFER ||
+ obj->buffer.length < 1)
+ ret = -EIO;
+ else if (obj->buffer.length >= 4 &&
+ obj->buffer.pointer[0] == UNIWILL_WMI_EC_FAIL_MARKER &&
+ obj->buffer.pointer[1] == UNIWILL_WMI_EC_FAIL_MARKER &&
+ obj->buffer.pointer[2] == UNIWILL_WMI_EC_FAIL_MARKER &&
+ obj->buffer.pointer[3] == UNIWILL_WMI_EC_FAIL_MARKER)
+ ret = -EIO;
+ else
+ *val = obj->buffer.pointer[0];
+
+ kfree(obj);
+
+ if (!ret)
+ usleep_range(UNIWILL_EC_DELAY_US, UNIWILL_EC_DELAY_US * 2);
+
+ return ret;
+}
+
+static const struct regmap_bus uniwill_wmi_ec_bus = {
+ .reg_read = uniwill_wmi_ec_reg_read,
+ .reg_format_endian_default = REGMAP_ENDIAN_LITTLE,
+ .val_format_endian_default = REGMAP_ENDIAN_LITTLE,
+};
+
static bool uniwill_writeable_reg(struct device *dev, unsigned int reg)
{
switch (reg) {
@@ -716,6 +769,18 @@ static const struct regmap_config uniwill_ec_config = {
.use_single_write = true,
};
+/* The WMI EC interface is only used for read-only sensor access. */
+static const struct regmap_config uniwill_wmi_ec_config = {
+ .reg_bits = 16,
+ .val_bits = 8,
+ .readable_reg = uniwill_readable_reg,
+ .volatile_reg = uniwill_volatile_reg,
+ .can_sleep = true,
+ .max_register = 0xFFF,
+ .cache_type = REGCACHE_NONE,
+ .use_single_read = true,
+};
+
static int uniwill_write_fn_lock(struct uniwill_data *data, bool status)
{
unsigned int value;
@@ -2363,14 +2428,18 @@ static int uniwill_ec_init(struct uniwill_data *data)
static int uniwill_probe(struct platform_device *pdev)
{
+ struct uniwill_wmi_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct uniwill_data *data;
struct regmap *regmap;
- acpi_handle handle;
+ acpi_handle handle = NULL;
+ bool wmi_ec = pdata && pdata->read_only;
int ret;
- handle = ACPI_HANDLE(&pdev->dev);
- if (!handle)
- return -ENODEV;
+ if (!wmi_ec) {
+ handle = ACPI_HANDLE(&pdev->dev);
+ if (!handle)
+ return -ENODEV;
+ }
data = devm_kzalloc_obj(&pdev->dev, *data);
if (!data)
@@ -2378,9 +2447,20 @@ static int uniwill_probe(struct platform_device *pdev)
data->dev = &pdev->dev;
data->handle = handle;
+ data->wmi_ec = wmi_ec;
platform_set_drvdata(pdev, data);
- regmap = devm_regmap_init(&pdev->dev, &uniwill_ec_bus, data, &uniwill_ec_config);
+ if (wmi_ec) {
+ ret = devm_mutex_init(&pdev->dev, &data->wmi_lock);
+ if (ret < 0)
+ return ret;
+
+ regmap = devm_regmap_init(&pdev->dev, &uniwill_wmi_ec_bus, data,
+ &uniwill_wmi_ec_config);
+ } else {
+ regmap = devm_regmap_init(&pdev->dev, &uniwill_ec_bus, data,
+ &uniwill_ec_config);
+ }
if (IS_ERR(regmap))
return PTR_ERR(regmap);
@@ -2390,15 +2470,31 @@ static int uniwill_probe(struct platform_device *pdev)
if (ret < 0)
return ret;
- ret = uniwill_ec_init(data);
- if (ret < 0)
- return ret;
+ if (!wmi_ec) {
+ ret = uniwill_ec_init(data);
+ if (ret < 0)
+ return ret;
+ }
data->features = device_descriptor.features;
data->kbd_led_single_color = device_descriptor.kbd_led_single_color;
data->kbd_led_max_brightness = device_descriptor.kbd_led_max_brightness;
data->lightbar_max_intensity = device_descriptor.lightbar_max_intensity;
+ if (wmi_ec) {
+ /*
+ * The WMI EC interface only supports read-only access. Do not
+ * touch any write-oriented feature, including the manual
+ * control bit set by uniwill_ec_init().
+ */
+ data->features = UNIWILL_FEATURE_CPU_TEMP |
+ UNIWILL_FEATURE_GPU_TEMP |
+ UNIWILL_FEATURE_PRIMARY_FAN |
+ UNIWILL_FEATURE_SECONDARY_FAN;
+
+ return uniwill_hwmon_init(data);
+ }
+
/*
* Some devices might need to perform some device-specific initialization steps
* before the supported features are initialized. Because of this we have to call
@@ -2441,6 +2537,9 @@ static void uniwill_shutdown(struct platform_device *pdev)
{
struct uniwill_data *data = platform_get_drvdata(pdev);
+ if (data->wmi_ec)
+ return;
+
regmap_clear_bits(data->regmap, EC_ADDR_AP_OEM, ENABLE_MANUAL_CTRL);
}
@@ -2544,6 +2643,9 @@ static int uniwill_suspend(struct device *dev)
struct uniwill_data *data = dev_get_drvdata(dev);
int ret;
+ if (data->wmi_ec)
+ return 0;
+
ret = uniwill_suspend_fn_lock(data);
if (ret < 0)
return ret;
@@ -2661,6 +2763,9 @@ static int uniwill_resume(struct device *dev)
struct uniwill_data *data = dev_get_drvdata(dev);
int ret;
+ if (data->wmi_ec)
+ return 0;
+
regcache_cache_only(data->regmap, false);
ret = regcache_sync(data->regmap);
@@ -3072,6 +3177,14 @@ static struct uniwill_device_descriptor x4sp4nal_descriptor __initdata = {
.kbd_led_max_brightness = 2,
};
+static struct uniwill_device_descriptor avell_a62_liv_descriptor __initdata = {
+ /* Sensors are accessible through the read-only WMI EC interface. */
+ .features = UNIWILL_FEATURE_CPU_TEMP |
+ UNIWILL_FEATURE_GPU_TEMP |
+ UNIWILL_FEATURE_PRIMARY_FAN |
+ UNIWILL_FEATURE_SECONDARY_FAN,
+};
+
static const struct dmi_system_id uniwill_dmi_table[] __initconst = {
{
.ident = "AiStone X4SP4NAL",
@@ -3128,6 +3241,13 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {
},
.driver_data = &lapqc71a_lapqc71b_descriptor,
},
+ {
+ .ident = "Avell A62 LIV",
+ .matches = {
+ DMI_MATCH(DMI_PRODUCT_NAME, "A62 LIV"),
+ },
+ .driver_data = &avell_a62_liv_descriptor,
+ },
{
.ident = "Intel NUC x15",
.matches = {
diff --git a/drivers/platform/x86/uniwill/uniwill-wmi.c b/drivers/platform/x86/uniwill/uniwill-wmi.c
index 2ffa29a82..35eb36d1c 100644
--- a/drivers/platform/x86/uniwill/uniwill-wmi.c
+++ b/drivers/platform/x86/uniwill/uniwill-wmi.c
@@ -13,9 +13,12 @@
#include <linux/acpi.h>
#include <linux/device.h>
+#include <linux/err.h>
#include <linux/init.h>
#include <linux/notifier.h>
+#include <linux/platform_device.h>
#include <linux/printk.h>
+#include <linux/slab.h>
#include <linux/types.h>
#include <linux/wmi.h>
@@ -50,6 +53,78 @@ static void uniwill_wmi_notify(struct wmi_device *wdev, union acpi_object *obj)
dev_err(&wdev->dev, "Failed to handle event %u\n", value);
}
+#define UNIWILL_WMI_EC_METHOD 4
+#define UNIWILL_WMI_EC_READ_OP 0x01
+#define UNIWILL_WMI_EC_TEST_ADDR 0x043e
+#define UNIWILL_WMI_EC_FAIL_MARKER 0xfe
+
+/*
+ * The EC WMI GUID is not unique either, so make sure that the EC actually
+ * answers a read request before exposing it to the platform driver.
+ */
+static int uniwill_wmi_ec_read_test(void)
+{
+ u32 args[10] = { };
+ u8 *bytes = (u8 *)args;
+ struct acpi_buffer in = { .length = sizeof(args), .pointer = args };
+ struct acpi_buffer out = { ACPI_ALLOCATE_BUFFER, NULL };
+ union acpi_object *obj;
+ acpi_status status;
+ int ret = 0;
+
+ bytes[0] = UNIWILL_WMI_EC_TEST_ADDR & 0xff;
+ bytes[1] = UNIWILL_WMI_EC_TEST_ADDR >> 8;
+ bytes[5] = UNIWILL_WMI_EC_READ_OP;
+
+ status = wmi_evaluate_method(UNIWILL_WMI_EC_GUID, 0, UNIWILL_WMI_EC_METHOD,
+ &in, &out);
+ obj = out.pointer;
+ if (ACPI_FAILURE(status) || !obj || obj->type != ACPI_TYPE_BUFFER ||
+ obj->buffer.length < 1)
+ ret = -EIO;
+ else if (obj->buffer.length >= 4 &&
+ obj->buffer.pointer[0] == UNIWILL_WMI_EC_FAIL_MARKER &&
+ obj->buffer.pointer[1] == UNIWILL_WMI_EC_FAIL_MARKER &&
+ obj->buffer.pointer[2] == UNIWILL_WMI_EC_FAIL_MARKER &&
+ obj->buffer.pointer[3] == UNIWILL_WMI_EC_FAIL_MARKER)
+ ret = -EIO;
+
+ kfree(obj);
+
+ return ret;
+}
+
+static void uniwill_wmi_unregister_platform_device(void *data)
+{
+ platform_device_unregister(data);
+}
+
+static int uniwill_wmi_probe(struct wmi_device *wdev, const void *context)
+{
+ struct uniwill_wmi_platform_data pdata = { .read_only = true };
+ struct platform_device *pdev;
+
+ if (!wmi_has_guid(UNIWILL_WMI_EC_GUID))
+ return 0;
+
+ /* Prefer the ACPI EC interface whenever the BIOS provides it. */
+ if (acpi_dev_present("INOU0000", NULL, -1))
+ return 0;
+
+ if (uniwill_wmi_ec_read_test() < 0)
+ return 0;
+
+ pdev = platform_device_register_data(&wdev->dev, UNIWILL_PLATFORM_NAME,
+ PLATFORM_DEVID_AUTO, &pdata,
+ sizeof(pdata));
+ if (IS_ERR(pdev))
+ return PTR_ERR(pdev);
+
+ return devm_add_action_or_reset(&wdev->dev,
+ uniwill_wmi_unregister_platform_device,
+ pdev);
+}
+
/*
* We cannot fully trust this GUID since Uniwill just copied the WMI GUID
* from the Windows driver example, and others probably did the same.
@@ -69,6 +144,7 @@ static struct wmi_driver uniwill_wmi_driver = {
},
.id_table = uniwill_wmi_id_table,
.min_event_size = sizeof(u32),
+ .probe = uniwill_wmi_probe,
.notify = uniwill_wmi_notify,
.no_singleton = true,
};
diff --git a/drivers/platform/x86/uniwill/uniwill-wmi.h b/drivers/platform/x86/uniwill/uniwill-wmi.h
index 1b6f650c4..1cdf2fcbf 100644
--- a/drivers/platform/x86/uniwill/uniwill-wmi.h
+++ b/drivers/platform/x86/uniwill/uniwill-wmi.h
@@ -9,6 +9,18 @@
#define UNIWILL_WMI_H
#include <linux/init.h>
+#include <linux/types.h>
+
+#define UNIWILL_PLATFORM_NAME "uniwill"
+#define UNIWILL_WMI_EC_GUID "ABBC0F6F-8EA1-11D1-00A0-C90629100000"
+
+/*
+ * Used when the BIOS does not expose the INOU0000 ACPI device and the EC
+ * is only reachable through the AcpiTest_MULong WMI interface.
+ */
+struct uniwill_wmi_platform_data {
+ bool read_only;
+};
#define UNIWILL_OSD_CAPSLOCK 0x01
#define UNIWILL_OSD_NUMLOCK 0x02
--
2.56.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] platform/x86: uniwill: document the WMI EC fallback
2026-11-23 21:05 [PATCH 0/2] platform/x86: uniwill: add read-only WMI EC backend Renan Biegelmeyer
2026-11-23 21:05 ` [PATCH 1/2] " Renan Biegelmeyer
@ 2026-11-23 21:05 ` Renan Biegelmeyer
1 sibling, 0 replies; 3+ messages in thread
From: Renan Biegelmeyer @ 2026-11-23 21:05 UTC (permalink / raw)
To: Armin Wolf, platform-driver-x86
Cc: Hans de Goede, Ilpo Järvinen, linux-kernel, Renan Biegelmeyer
Document that devices without the INOU0000 ACPI device use the
AcpiTest_MULong WMI interface in read-only mode.
Signed-off-by: Renan Biegelmeyer <renan.biegel@gmail.com>
---
Documentation/wmi/devices/uniwill-laptop.rst | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Documentation/wmi/devices/uniwill-laptop.rst b/Documentation/wmi/devices/uniwill-laptop.rst
index 65583b239..36dad51d3 100644
--- a/Documentation/wmi/devices/uniwill-laptop.rst
+++ b/Documentation/wmi/devices/uniwill-laptop.rst
@@ -191,6 +191,14 @@ Indexed IO with IO ports with a granularity of a single byte can be performed us
(read) and ``WIOP`` (write) ACPI control methods. Those ACPI methods are unused because they
provide no benefit when compared to the native IO port access functions provided by the kernel.
+EC WMI fallback
+---------------
+
+Some devices do not expose the ``INOU0000`` ACPI device. On those devices the driver falls back to
+the EC WMI interface described in the previous sections (``GetSetULong``, method 4). Because this
+interface is only used for read-only access, the driver exposes the CPU/GPU temperature, fan speed
+and PWM sensors, but none of the features that require writing to the EC.
+
Special thanks go to github user `pobrn` which developed the
`qc71_laptop <https://github.com/pobrn/qc71_laptop>`_ driver on which this driver is partly based.
The same is true for Tuxedo Computers, which developed the
--
2.56.1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-23 21:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-23 21:05 [PATCH 0/2] platform/x86: uniwill: add read-only WMI EC backend Renan Biegelmeyer
2026-11-23 21:05 ` [PATCH 1/2] " Renan Biegelmeyer
2026-11-23 21:05 ` [PATCH 2/2] platform/x86: uniwill: document the WMI EC fallback Renan Biegelmeyer
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®