[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250627195436.3877-1-W_Armin@gmx.de>
Date: Fri, 27 Jun 2025 21:54:36 +0200
From: Armin Wolf <W_Armin@....de>
To: xy-jackie@....com,
alireza.bestboyy@...il.com,
atescula@...il.com
Cc: mpearson-lenovo@...ebb.ca,
hdegoede@...hat.com,
ilpo.jarvinen@...ux.intel.com,
platform-driver-x86@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] platform/x86: lenovo-hotkey: Handle missing hardware features gracefully
Not all devices support audio mute and microphone mute LEDs, so the
explicitly checks for hardware support while probing. However missing
hardware features are treated as errors, causing the driver so fail
probing on devices that do not support both LEDs.
Fix this by simply ignoring hardware features that are not present.
This way the driver will properly load on devices not supporting both
LEDs and will stop throwing error messages on devices with no LEDS
at all.
Reported-by: Andrei Tescula <atescula@...il.com>
Closes: https://https://lore.kernel.org/platform-driver-x86/2eda8f9b-9421-4068-87ae-ccfd834649bc@gmail.com/
Reported-by: BEST8OY <alireza.bestboyy@...il.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220271
Tested-by: BEST8OY <alireza.bestboyy@...il.com>
Fixes: 61250669eaa9 ("platform/x86:lenovo-wmi-hotkey-utilities.c: Support for mic and audio mute LEDs")
Signed-off-by: Armin Wolf <W_Armin@....de>
---
.../platform/x86/lenovo/wmi-hotkey-utilities.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/drivers/platform/x86/lenovo/wmi-hotkey-utilities.c b/drivers/platform/x86/lenovo/wmi-hotkey-utilities.c
index 89153afd7015..44f489336199 100644
--- a/drivers/platform/x86/lenovo/wmi-hotkey-utilities.c
+++ b/drivers/platform/x86/lenovo/wmi-hotkey-utilities.c
@@ -127,21 +127,26 @@ static int lenovo_super_hotkey_wmi_led_init(enum mute_led_type led_type, struct
else
return -EIO;
- wpriv->cdev[led_type].max_brightness = LED_ON;
- wpriv->cdev[led_type].flags = LED_CORE_SUSPENDRESUME;
-
switch (led_type) {
case MIC_MUTE:
+ /*
+ * A missing hardware feature is not an error, so do not return
+ * an error here.
+ */
if (led_version != WMI_LUD_SUPPORT_MICMUTE_LED_VER)
- return -EIO;
+ return 0;
wpriv->cdev[led_type].name = "platform::micmute";
wpriv->cdev[led_type].brightness_set_blocking = &lsh_wmi_micmute_led_set;
wpriv->cdev[led_type].default_trigger = "audio-micmute";
break;
case AUDIO_MUTE:
+ /*
+ * A missing hardware feature is not an error, so do not return
+ * an error here.
+ */
if (led_version != WMI_LUD_SUPPORT_AUDIOMUTE_LED_VER)
- return -EIO;
+ return 0;
wpriv->cdev[led_type].name = "platform::mute";
wpriv->cdev[led_type].brightness_set_blocking = &lsh_wmi_audiomute_led_set;
@@ -152,6 +157,9 @@ static int lenovo_super_hotkey_wmi_led_init(enum mute_led_type led_type, struct
return -EINVAL;
}
+ wpriv->cdev[led_type].max_brightness = LED_ON;
+ wpriv->cdev[led_type].flags = LED_CORE_SUSPENDRESUME;
+
err = devm_led_classdev_register(dev, &wpriv->cdev[led_type]);
if (err < 0) {
dev_err(dev, "Could not register mute LED %d : %d\n", led_type, err);
--
2.39.5
Powered by blists - more mailing lists