From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796046448; b=Rl1Mt2JW0ip9U7HVZBSS/6ErKcgWOY3iWrQw4ebKmBCPwv69d16xASuW2PLThuICt5gO XnuSnA6KKLkWVpSD8uTNAiLoiA4yKYaw25inWBkYm5ZJxh5bfgUegZsMD1+mlVm63xkye QAObmEOu/Gg9bQmH/GsyTQfWVkPwxp16x0s7Zl3Ly8dMqbI2zyh8lM/DPJCQD80fpQ6ht j7IbYhhehaWE4nNx5y4Cmd9DP6MidR5V9RrfGuQu/hEkrUZXD8P86XF7xS1EimYBovgJL ZIEXGZ9ObzKk6SnR/OzDH1Y0tLNpoio4WCYd6eRVJa0G9mxabN+4sh4ehAVW9XeyBWA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796046448; h=Received:DKIM-Signature:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:From:Content-Language:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=csyd4/gbe6Uz4ZbsvB9Jc6DWRPxyLmBSJ6W8+ci8nOw=; b=Wi+Ur55pCySJgGjT7R7G2EiqiqjCj5bcM8JhLx65vBW3dt8ymY+c7atXeO2CakcEZF+K mda0o/+X6fyZN1mt1APAwzfuZkLx1tfHL0fNL1ss9NwH8m1reFnr2JHKXJ/eIyfLfsGaV Z6EKka8QAMO5+gIDvwEfuRx5ZCAQ1FhT0H/g6xeLT+lcVL+tzQ4j7O3vRNrdrO5475Ctp h/zzGiAOCxJPz3vaIKarWvNNDB3Xul6HqfkwU0gjQDt32K4TOdEul95zPrQDV9x1suVRn 5sI7ONVd3ymnQJRxCD+d4H4EgOW9dQPEgByOSMbEW6wafis/fhQLHhhaphBJzZb1mSA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=cM+mD9eS; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6019606A325; Mon, 30 Nov 2026 13:47:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=cM+mD9eS Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C8621F02EFF; Mon, 30 Nov 2026 13:47:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796046448; bh=csyd4/gbe6Uz4ZbsvB9Jc6DWRPxyLmBSJ6W8+ci8nOw=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=cM+mD9eSsTNkLwCRpWHFPNMj8+ueWfgRCCnVY0ZV7UJ2B43YaNmNwhDMSh0Ww6uhS qtszONKYteHFHbJi/vCh0cQOHOME1kmeignYEPdYaPvyUSxk4yVfKGfSBHO99QMH2f D45rP3XupAVEGqNXRXiSzn+PDnInCm7QZ8VncUuyHJCl0CHJUSsOaFn/b7DhJ2PkeN GyJWNBaPrDFpTsuneHTpFVjrv1DSWg0e6ZJ/UbuFn3czMA5jt73CDEv1P0BPWiA1IG Fmfv1s5fopnzu8aPji051++J5tiq/L/YcyXFw/9iNJaDcqnNwo6RQEPYROBAoRG2lG SJg2JjC1eT+nA== Message-ID: Date: Mon, 30 Nov 2026 14:47:25 +0100 X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] platform/arm64: lenovo-yoga-slim7x-gen11-ec: add the mic mute LED To: Oleg Keri , ilpo.jarvinen@linux.intel.com Cc: bryan.odonoghue@linaro.org, platform-driver-x86@vger.kernel.org, linux-arm-msm@vger.kernel.org References: <20261130133327.3015-1-okerixx@gmail.com> From: Hans de Goede Content-Language: en-US, nl In-Reply-To: <20261130133327.3015-1-okerixx@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi, On 30-Nov-26 14:33, Oleg Keri wrote: > 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 Thanks, patch looks good to me: Reviewed-by: Hans de Goede Regards, Hans > --- > 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); >