From: Oleg Keri <okerixx@gmail.com>
To: hansg@kernel.org, ilpo.jarvinen@linux.intel.com
Cc: bryan.odonoghue@linaro.org, platform-driver-x86@vger.kernel.org,
linux-arm-msm@vger.kernel.org, Oleg Keri <okerixx@gmail.com>
Subject: [PATCH] platform/arm64: lenovo-yoga-slim7x-gen11-ec: add the mic mute LED
Date: Mon, 30 Nov 2026 14:33:27 +0100 [thread overview]
Message-ID: <20261130133327.3015-1-okerixx@gmail.com> (raw)
The mic mute key of the Yoga Slim 7x Gen 11 has an indicator LED which
the EC does not drive on its own. The key press is only reported as an
event and the LED stays dark.
The vendor ACPI tables implement the SetFeature method of the Lenovo
hotkey utility WMI interface (CE6C0974-0407-4F50-88BA-4FC3B6559AD8) for
this LED by setting or clearing bit 6 of the KBLT byte in the EC RAM,
the same byte that holds the keyboard backlight level in bits 1:0.
Expose that bit as the platform::micmute LED with the audio-micmute
default trigger, and select SND_CTL_LED so that the trigger is available,
as the ThinkPad T14s EC driver does. The LED is turned off across system
suspend by the LED core and restored on resume.
Signed-off-by: Oleg Keri <okerixx@gmail.com>
---
drivers/platform/arm64/Kconfig | 5 +-
.../arm64/lenovo-yoga-slim7x-gen11-ec.c | 46 +++++++++++++++++++
2 files changed, 49 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/arm64/Kconfig b/drivers/platform/arm64/Kconfig
index 3f879410b311..0a7054c66705 100644
--- a/drivers/platform/arm64/Kconfig
+++ b/drivers/platform/arm64/Kconfig
@@ -113,12 +113,13 @@ config EC_LENOVO_YOGA_SLIM7X_GEN11
depends on HWMON
select NEW_LEDS
select LEDS_CLASS
+ select SND_CTL_LED if SND
help
Say Y here to enable the EC driver for the (Snapdragon X2 Elite,
glymur-based) Lenovo Yoga Slim 7x Gen 11 laptop. The EC provides
thermistors and CPU fan speed as hwmon channels, the keyboard
- backlight as an LED, Fn-lock as a sysfs attribute, and the mic-mute
- and airplane-mode keys.
+ backlight and the mic-mute indicator as LEDs, Fn-lock as a sysfs
+ attribute, and the mic-mute and airplane-mode keys.
This is the Gen 11 (glymur) machine specifically. Its EC is a Compal
design at i2c address 0x70 and speaks a different protocol from the
diff --git a/drivers/platform/arm64/lenovo-yoga-slim7x-gen11-ec.c b/drivers/platform/arm64/lenovo-yoga-slim7x-gen11-ec.c
index 36dcbff58755..2db46fbf1f75 100644
--- a/drivers/platform/arm64/lenovo-yoga-slim7x-gen11-ec.c
+++ b/drivers/platform/arm64/lenovo-yoga-slim7x-gen11-ec.c
@@ -49,6 +49,7 @@
#define SLIM7X11_EC_KBLT_LEVEL GENMASK(1, 0)
#define SLIM7X11_EC_KBLT_AUTO 3
#define SLIM7X11_EC_KBLT_MAX 2
+#define SLIM7X11_EC_KBLT_MIC_MUTE BIT(6)
#define SLIM7X11_EC_TEMP_FIRST 0x12
#define SLIM7X11_EC_NUM_TEMP 6
@@ -60,6 +61,7 @@ struct slim7x11_ec {
struct mutex lock;
unsigned long temp_present;
struct led_classdev kbd_led;
+ struct led_classdev mic_led;
u8 kblt_level;
bool kblt_restore;
struct input_dev *keys;
@@ -234,6 +236,39 @@ static int slim7x11_ec_kbd_led_set(struct led_classdev *led, enum led_brightness
return slim7x11_ec_kbd_led_level(ec, brightness, NULL);
}
+static enum led_brightness slim7x11_ec_mic_led_get(struct led_classdev *led)
+{
+ struct slim7x11_ec *ec = container_of(led, struct slim7x11_ec, mic_led);
+ u8 raw;
+
+ guard(mutex)(&ec->lock);
+
+ if (slim7x11_ec_ram_read(ec, SLIM7X11_EC_KBLT, &raw))
+ return 0;
+
+ return !!(raw & SLIM7X11_EC_KBLT_MIC_MUTE);
+}
+
+static int slim7x11_ec_mic_led_set(struct led_classdev *led, enum led_brightness brightness)
+{
+ struct slim7x11_ec *ec = container_of(led, struct slim7x11_ec, mic_led);
+ u8 raw;
+ int ret;
+
+ guard(mutex)(&ec->lock);
+
+ ret = slim7x11_ec_ram_read(ec, SLIM7X11_EC_KBLT, &raw);
+ if (ret)
+ return ret;
+
+ if (brightness)
+ raw |= SLIM7X11_EC_KBLT_MIC_MUTE;
+ else
+ raw &= ~SLIM7X11_EC_KBLT_MIC_MUTE;
+
+ return slim7x11_ec_ram_write(ec, SLIM7X11_EC_KBLT, raw);
+}
+
static const struct hwmon_ops slim7x11_ec_hwmon_ops = {
.is_visible = slim7x11_ec_is_visible,
.read = slim7x11_ec_read,
@@ -453,6 +488,17 @@ static int slim7x11_ec_probe(struct i2c_client *client)
if (ret)
return dev_err_probe(dev, ret, "failed to register keyboard backlight\n");
+ ec->mic_led.name = "platform::micmute";
+ ec->mic_led.max_brightness = 1;
+ ec->mic_led.default_trigger = "audio-micmute";
+ ec->mic_led.flags = LED_CORE_SUSPENDRESUME;
+ ec->mic_led.brightness_get = slim7x11_ec_mic_led_get;
+ ec->mic_led.brightness_set_blocking = slim7x11_ec_mic_led_set;
+
+ ret = devm_led_classdev_register(dev, &ec->mic_led);
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to register the mic mute LED\n");
+
if (client->irq) {
slim7x11_ec_register_keys(ec);
--
2.56.1
next reply other threads:[~2026-11-30 13:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 13:33 Oleg Keri [this message]
2026-11-30 13:43 ` [PATCH] platform/arm64: lenovo-yoga-slim7x-gen11-ec: add the mic mute LED Konrad Dybcio
2026-11-30 13:47 ` Hans de Goede
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=20261130133327.3015-1-okerixx@gmail.com \
--to=okerixx@gmail.com \
--cc=bryan.odonoghue@linaro.org \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-arm-msm@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