From: Werner Sembach <wse@tuxedocomputers.com>
To: W_Armin@gmx.de, hansg@kernel.org, ilpo.jarvinen@linux.intel.com
Cc: platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org,
Werner Sembach <wse@tuxedocomputers.com>
Subject: [PATCH 5/6] platform/x86/uniwill: Run callbacks of uniwill_dmi_table
Date: Mon, 17 Nov 2025 14:24:02 +0100 [thread overview]
Message-ID: <20251117132530.32460-6-wse@tuxedocomputers.com> (raw)
In-Reply-To: <20251117132530.32460-1-wse@tuxedocomputers.com>
The dmi_system_id uniwill_dmi_table[] has a callback field.
This patch calls these callbacks with EC read/write access. It also moves
the supported_features assignment further back into the code.
This enables the callbacks to dynamically determine supported_features
flags based on EC readouts.
Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
---
drivers/platform/x86/uniwill/uniwill-acpi.c | 29 ++++++++++++---------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/drivers/platform/x86/uniwill/uniwill-acpi.c b/drivers/platform/x86/uniwill/uniwill-acpi.c
index 9412783698685..15a94c256f728 100644
--- a/drivers/platform/x86/uniwill/uniwill-acpi.c
+++ b/drivers/platform/x86/uniwill/uniwill-acpi.c
@@ -335,6 +335,7 @@ struct uniwill_data {
struct mutex input_lock; /* Protects input sequence during notify */
struct input_dev *input_device;
struct notifier_block nb;
+ struct dmi_system_id id;
};
struct uniwill_battery_entry {
@@ -1767,6 +1768,7 @@ MODULE_DEVICE_TABLE(dmi, uniwill_dmi_table);
static int uniwill_probe(struct platform_device *pdev)
{
+ const struct dmi_system_id *id;
struct uniwill_data *data;
struct regmap *regmap;
acpi_handle handle;
@@ -1788,6 +1790,19 @@ static int uniwill_probe(struct platform_device *pdev)
if (IS_ERR(regmap))
return PTR_ERR(regmap);
+ if (force) {
+ /* Assume that the device supports all features */
+ supported_features = UINT_MAX;
+ pr_warn("Loading on a potentially unsupported device\n");
+ } else {
+ /* Match is guaranteed, otherwise init would have aborted */
+ id = dmi_first_match(uniwill_dmi_table);
+ memcpy(&data->id, id, sizeof(data->id));
+ if (data->id.callback)
+ data->id.callback(&data->id);
+ supported_features = (uintptr_t)data->id.driver_data;
+ }
+
data->regmap = regmap;
ret = devm_mutex_init(&pdev->dev, &data->super_key_lock);
if (ret < 0)
@@ -1938,20 +1953,10 @@ static struct platform_driver uniwill_driver = {
static int __init uniwill_init(void)
{
- const struct dmi_system_id *id;
int ret;
- id = dmi_first_match(uniwill_dmi_table);
- if (!id) {
- if (!force)
- return -ENODEV;
-
- /* Assume that the device supports all features */
- supported_features = UINT_MAX;
- pr_warn("Loading on a potentially unsupported device\n");
- } else {
- supported_features = (uintptr_t)id->driver_data;
- }
+ if (!dmi_first_match(uniwill_dmi_table) && !force)
+ return -ENODEV;
ret = platform_driver_register(&uniwill_driver);
if (ret < 0)
--
2.43.0
next prev parent reply other threads:[~2025-11-17 13:25 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-17 13:23 [PATCH 0/6] Start of Upstream Support for TUXEDO NB02 devices Werner Sembach
2025-11-17 13:23 ` [PATCH 1/6] platform/x86/uniwill: Add TUXEDO devices Werner Sembach
2025-11-18 11:03 ` Armin Wolf
2025-11-17 13:23 ` [PATCH 2/6] platform/x86/uniwill: Handle more WMI events required for " Werner Sembach
2025-11-18 11:08 ` Armin Wolf
2025-11-18 12:45 ` Werner Sembach
2025-11-18 13:12 ` Armin Wolf
2025-11-18 13:29 ` Werner Sembach
2025-11-18 13:48 ` Armin Wolf
2025-11-18 14:27 ` Werner Sembach
2025-11-18 14:41 ` Armin Wolf
2025-11-18 15:05 ` Werner Sembach
2025-11-20 0:53 ` Armin Wolf
2025-11-20 10:42 ` Werner Sembach
2025-11-20 13:40 ` Armin Wolf
2025-11-20 22:06 ` Werner Sembach
2025-11-22 23:54 ` Armin Wolf
2025-11-24 17:43 ` Werner Sembach
2025-11-24 18:40 ` Werner Sembach
2025-11-25 0:50 ` Armin Wolf
2025-11-25 14:05 ` Werner Sembach
2025-11-17 13:24 ` [PATCH 3/6] platform/x86/uniwill: Implement cTGP setting Werner Sembach
2025-11-18 11:12 ` Armin Wolf
2025-11-18 12:58 ` Werner Sembach
2025-11-18 13:29 ` Armin Wolf
2025-11-19 15:34 ` Werner Sembach
2025-11-20 1:16 ` Armin Wolf
2025-11-20 10:47 ` Werner Sembach
2025-11-17 13:24 ` [PATCH 4/6] platform/x86/uniwill: Make uniwill_dmi_table accessible in probe Werner Sembach
2025-11-18 11:16 ` Armin Wolf
2025-11-18 13:01 ` Werner Sembach
2025-11-18 13:35 ` Armin Wolf
2025-11-18 13:40 ` Werner Sembach
2025-11-17 13:24 ` Werner Sembach [this message]
2025-11-17 13:24 ` [PATCH 6/6] platform/x86/uniwill: Set cTGP support based on EC for TUXEDO IBP Gen7 MK1 Werner Sembach
2025-11-18 10:43 ` Ilpo Järvinen
2025-11-18 13:05 ` Werner Sembach
2025-11-18 11:31 ` [PATCH 0/6] Start of Upstream Support for TUXEDO NB02 devices Armin Wolf
2025-11-18 13:17 ` Werner Sembach
2025-11-18 13:42 ` Armin Wolf
2025-11-18 14:24 ` Werner Sembach
2025-11-18 13:42 ` Werner Sembach
2025-11-18 13:43 ` Armin Wolf
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=20251117132530.32460-6-wse@tuxedocomputers.com \
--to=wse@tuxedocomputers.com \
--cc=W_Armin@gmx.de \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--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®