mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] platform/x86: asus-wmi: add speaker mute LED
@ 2026-09-18 18:09 Jorge Núñez Granero
  2026-09-18 18:23 ` Ilpo Järvinen
  0 siblings, 1 reply; 2+ messages in thread
From: Jorge Núñez Granero @ 2026-09-18 18:09 UTC (permalink / raw)
  To: platform-driver-x86
  Cc: Corentin Chary, Luke D . Jones, Denis Benato, Hans de Goede,
	Ilpo Järvinen, linux-kernel, Jorge Núñez Granero

Some ASUS laptops (e.g. the ExpertBook B3405CCA) have a mute LED on the
F1 key next to the mic mute LED on F4. The mic mute LED is already
driven through WMI device 0x00040017, but the speaker mute LED is not
known to the driver, so it never lights up under Linux while the
firmware does light it under Windows.

The DSDT of the B3405CCA exposes device 0x0004001C in the same LED
group with the presence bit set, and calling DEVS(0x0004001C, 1/0)
turns the F1 key LED on and off.

Register it as "platform::mute" with the "audio-mute" default trigger,
mirroring the existing mic mute LED, so that the snd-ctl-led speaker
mode drives it automatically. Only registered when the firmware
reports the device as present, so nothing changes on other models.

Tested on an ASUS ExpertBook B3405CCA (BIOS 307): DSTS reports the
device present and DEVS 1/0 toggles the LED.

Signed-off-by: Jorge Núñez Granero <eljorge199525@gmail.com>
---
 drivers/platform/x86/asus-wmi.c            | 24 ++++++++++++++++++++++
 include/linux/platform_data/x86/asus-wmi.h |  1 +
 2 files changed, 25 insertions(+)

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index a650904..60bbd10 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -262,6 +262,7 @@ struct asus_wmi {
 	struct led_classdev lightbar_led;
 	int lightbar_led_wk;
 	struct led_classdev micmute_led;
+	struct led_classdev mute_led;
 	struct led_classdev camera_led;
 	struct workqueue_struct *led_workqueue;
 	struct work_struct tpd_led_work;
@@ -2054,6 +2055,16 @@ static int micmute_led_set(struct led_classdev *led_cdev,
 	return err < 0 ? err : 0;
 }
 
+static int mute_led_set(struct led_classdev *led_cdev,
+			enum led_brightness brightness)
+{
+	int state = brightness != LED_OFF;
+	int err;
+
+	err = asus_wmi_set_devstate(ASUS_WMI_DEVID_MUTE_LED, state, NULL);
+	return err < 0 ? err : 0;
+}
+
 static enum led_brightness camera_led_get(struct led_classdev *led_cdev)
 {
 	struct asus_wmi *asus;
@@ -2084,6 +2095,7 @@ static void asus_wmi_led_exit(struct asus_wmi *asus)
 	led_classdev_unregister(&asus->wlan_led);
 	led_classdev_unregister(&asus->lightbar_led);
 	led_classdev_unregister(&asus->micmute_led);
+	led_classdev_unregister(&asus->mute_led);
 	led_classdev_unregister(&asus->camera_led);
 
 	if (asus->led_workqueue)
@@ -2181,6 +2193,18 @@ static int asus_wmi_led_init(struct asus_wmi *asus)
 			goto error;
 	}
 
+	if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_MUTE_LED)) {
+		asus->mute_led.name = "platform::mute";
+		asus->mute_led.max_brightness = 1;
+		asus->mute_led.brightness_set_blocking = mute_led_set;
+		asus->mute_led.default_trigger = "audio-mute";
+
+		rv = led_classdev_register(&asus->platform_device->dev,
+					   &asus->mute_led);
+		if (rv)
+			goto error;
+	}
+
 	if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_CAMERA_LED)) {
 		asus->camera_led.name = "asus::camera";
 		asus->camera_led.max_brightness = 1;
diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h
index b5ed8c8..6cb2e58 100644
--- a/include/linux/platform_data/x86/asus-wmi.h
+++ b/include/linux/platform_data/x86/asus-wmi.h
@@ -54,6 +54,7 @@
 #define ASUS_WMI_DEVID_LED5		0x00020015
 #define ASUS_WMI_DEVID_LED6		0x00020016
 #define ASUS_WMI_DEVID_MICMUTE_LED		0x00040017
+#define ASUS_WMI_DEVID_MUTE_LED		0x0004001C
 
 /* Disable Camera LED */
 #define ASUS_WMI_DEVID_CAMERA_LED_NEG	0x00060078 /* 0 = on (unused) */
-- 
2.55.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-18 18:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-18 18:09 [PATCH] platform/x86: asus-wmi: add speaker mute LED Jorge Núñez Granero
2026-09-18 18:23 ` Ilpo Järvinen

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®