From: "Mark Pearson" <mpearson-lenovo@squebb.ca>
To: "Qiling Zhu" <kmatzkaczor244@gmail.com>,
"Derek J . Clark" <derekjohn.clark@gmail.com>,
"Rong Zhang" <i@rong.moe>, "Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Henrique de Moraes Holschuh" <hmh@hmh.eng.br>
Cc: "platform-driver-x86@vger.kernel.org"
<platform-driver-x86@vger.kernel.org>,
linux-kernel@vger.kernel.org,
ibm-acpi-devel@lists.sourceforge.net,
"Lee Jones" <lee@kernel.org>, "Pavel Machek" <pavel@kernel.org>,
"Griffin Kroah-Hartman" <griffin@kroah.com>,
linux-leds@vger.kernel.org, "Vishnu Sankar" <vishnuocv@gmail.com>,
"Vishnu Sankar" <vsankar@lenovo.com>,
"Andrea Rabbaglietti" <rabbagliettiandrea@gmail.com>
Subject: Re: [PATCH v4 1/6] platform/x86: thinkpad_acpi: Report auto keyboard backlight mode as off
Date: Wed, 25 Nov 2026 14:05:10 -0500 [thread overview]
Message-ID: <2d83dea5-7751-473e-bc59-903eb6809ef6@app.fastmail.com> (raw)
In-Reply-To: <20261125084644.137506-2-kmatzkaczor244@gmail.com>
On Wed, Nov 25, 2026, at 3:46 AM, Qiling Zhu wrote:
> The EC keyboard backlight level 3, which selects the auto mode, is
> passed to the LED classdev verbatim by kbdlight_sysfs_get(). The LED
> then reports a brightness of 3 with max_brightness 2, both through the
> brightness sysfs attribute and through brightness_hw_changed
> notifications.
>
> This is not only cosmetic. According to a report on a ThinkPad X9-14
> Gen 1, UPower 1.91.x treats the out-of-range value as invalid and stops
> watching brightness_hw_changed, so the desktop no longer follows the
> Fn+Space hotkey after auto mode has been entered.
>
> The auto mode is not a brightness level. Report it as 0, which is
> within the exported brightness range, in a new helper,
> kbdlight_level_to_brightness(), as ideapad-laptop does for its auto
> mode.
>
> Fixes: bb28f3d51ff5 ("thinkpad_acpi: Add support for keyboard
> backlight")
> Reported-by: Andrea Rabbaglietti <rabbagliettiandrea@gmail.com>
> Closes:
> https://lore.kernel.org/r/CAENjc+w0Rqy=kDSew7XtNJCSvyPiXPJ5faWdmCr5RGYFhpunCA@mail.gmail.com
> Cc: stable@vger.kernel.org
> Signed-off-by: Qiling Zhu <kmatzkaczor244@gmail.com>
> Reviewed-by: Rong Zhang <i@rong.moe>
>
> ---
> Mark Pearson's Reviewed-by was given on the v3 version of this patch,
> which did the mapping inline in kbdlight_sysfs_get(). The helper was
> added at Rong's request, so the tag is not carried over.
>
> With this patch on its own, on kernels that still use the LED core
> suspend/resume path, a backlight that went to sleep in auto mode comes
> back off after resume; before, it came back in auto mode, since that
> path wrote the unmapped value back. The rest of this series restores
> the level the EC had.
> ---
> drivers/platform/x86/lenovo/thinkpad_acpi.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/lenovo/thinkpad_acpi.c
> b/drivers/platform/x86/lenovo/thinkpad_acpi.c
> index 4f81855ad..31d3721bb 100644
> --- a/drivers/platform/x86/lenovo/thinkpad_acpi.c
> +++ b/drivers/platform/x86/lenovo/thinkpad_acpi.c
> @@ -5102,6 +5102,9 @@ static struct ibm_struct video_driver_data = {
> * Keyboard backlight subdriver
> */
>
> +/* EC level that selects the auto mode for the keyboard backlight */
> +#define TPACPI_KBD_LIGHT_AUTO_LEVEL 3
> +
> static enum led_brightness kbdlight_brightness;
> static DEFINE_MUTEX(kbdlight_mutex);
>
> @@ -5135,6 +5138,15 @@ static int kbdlight_get_level(void)
> return status & 0x3;
> }
>
> +static int kbdlight_level_to_brightness(int level)
> +{
> + /* Auto mode is not a brightness level; report it as off. */
> + if (level == TPACPI_KBD_LIGHT_AUTO_LEVEL)
> + return 0;
> +
> + return level;
> +}
> +
> static bool kbdlight_is_supported(void)
> {
> int status = 0;
> @@ -5194,7 +5206,7 @@ static enum led_brightness
> kbdlight_sysfs_get(struct led_classdev *led_cdev)
> if (level < 0)
> return 0;
>
> - return level;
> + return kbdlight_level_to_brightness(level);
> }
>
> static struct tpacpi_led_classdev tpacpi_led_kbdlight = {
> --
Still looks good :)
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Mark
next prev parent reply other threads:[~2026-11-25 19:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 8:46 [PATCH v4 0/6] platform/x86: thinkpad_acpi: Add a keyboard backlight auto-mode trigger Qiling Zhu
2026-11-25 8:46 ` [PATCH v4 1/6] platform/x86: thinkpad_acpi: Report auto keyboard backlight mode as off Qiling Zhu
2026-11-25 19:05 ` Mark Pearson [this message]
2026-11-25 8:46 ` [PATCH v4 2/6] platform/x86: thinkpad_acpi: Extract kbdlight notify helpers Qiling Zhu
2026-11-25 19:09 ` Mark Pearson
2026-11-25 8:46 ` [PATCH v4 3/6] platform/x86: thinkpad_acpi: Don't poke keyboard backlight's LED core brightness Qiling Zhu
2026-11-25 13:11 ` Rong Zhang
2026-11-25 8:46 ` [PATCH v4 4/6] platform/x86: thinkpad_acpi: Restore keyboard backlight level ourselves Qiling Zhu
2026-11-25 13:16 ` Rong Zhang
2026-11-25 8:46 ` [PATCH v4 5/6] platform/x86: thinkpad_acpi: Detect auto-mode capability via MLCG Qiling Zhu
2026-11-25 13:17 ` Rong Zhang
2026-11-25 8:46 ` [PATCH v4 6/6] platform/x86: thinkpad_acpi: Add a keyboard backlight auto-mode trigger Qiling Zhu
2026-11-25 13:17 ` Rong Zhang
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=2d83dea5-7751-473e-bc59-903eb6809ef6@app.fastmail.com \
--to=mpearson-lenovo@squebb.ca \
--cc=derekjohn.clark@gmail.com \
--cc=griffin@kroah.com \
--cc=hansg@kernel.org \
--cc=hmh@hmh.eng.br \
--cc=i@rong.moe \
--cc=ibm-acpi-devel@lists.sourceforge.net \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=kmatzkaczor244@gmail.com \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rabbagliettiandrea@gmail.com \
--cc=vishnuocv@gmail.com \
--cc=vsankar@lenovo.com \
/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®