From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.229.135 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796299747; b=XK5G1Resqk/yJwmanP2R3D4KDAaF0Fv6WT2F+/19BVftiylU0EbIMWtz3qdPKhVpT4uB EkGX7H1FruqtuHkCGSV6ij+NXqqx0o5UF70iM+Z1lFoajiFMGlW1CUxteukdQYyhbrXG3 iBsCmXNB7RxfMzRgDLZ9rYAvHIfxNOe1Kp25pPWvjoEqM+6S2Pc5MQ22uedTTyglcgQyF 3/rQXTKOFy5gO0ziio9zwbId9abMscBstB5Jdj/vizDCzb4SUIZA/sMe2/0AoNYuz7gYe UynFetKzi53oinim3lvrmhX0ekDBjdisZLxf1VfUYpWAffKd0fGCytRmfoYZSptr1jQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796299747; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=WtOtSd2PpoxQhjUiad4SwV8npJrct9XbumcGKPBDC5U=; b=QcxolUXhA4t8lAlxcEtujpJ0Scd17C/Ezm1ebF9XrjelvoCiInsWCZ2FoM235sNDO7MT r+4Od/nqBaA1j19Cnjq8EUReqsphz2Pahwpy0gRY1cMFqUEubrHoITOa/lbB9Vx7OyKTe 0nqK8okvkHb0nzjiCgREFfC6gqo6vgFYEIgM1+RHaM+iuCCZGHhpgaFK+A7r+Lp9ipGoH mXjrL22z36YAr8HncysBdNXlfGiogjrYIe3ow0Lhe8YsVq0ZedBZPsAPhIb5GhirgSZLD Ai6gKNHY59pbam+8R7b7OTJzkdp4q0lKiKY75p6dR7yaOyX8uC/UjxK2hNl2J5TNG3A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=mkejooNb; arc=none smtp.remote-ip=74.125.229.135 Received: from mail-dl2-f7.google.com (mail-dl2-f7.google.com [74.125.229.135]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A8A93606AA61 for ; Thu, 3 Dec 2026 12:09:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A8A93606AA61 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=mkejooNb Received: by mail-dl2-f7.google.com with SMTP id a92af1059eb24-13985f8229aso11520148c88.1 for ; Thu, 03 Dec 2026 04:09:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796299746; x=1796904546; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=WtOtSd2PpoxQhjUiad4SwV8npJrct9XbumcGKPBDC5U=; b=mkejooNbhVipHfsEPX9Wc6bDrq3w1+QY5h2ccXhk3gOpArQ4dO84XaJQb+V2f8Lr8Y o9trThjpgfJjDaH5gjNqLXLXnGuLNmjK8xT2Cje+8mSfhUBMr3EqB2wQycH2GUf187u1 BNeaWSpFb/7iFknrQs+zaGlC/PPD/8nWvr5H2o82KLJT+3ORCPllZH1M2EmjvMYDyfM6 0pKWv8WWQmYIH3ntyusZ2J53lVBI2ldjmknx4JNlKW/X4NbonB07kLdqvHhKOsRAjkou 7a1cJMQoF91patWlD3a/69mDRO3Zf32iyqx01eKHr50YKXCZ8Ug8Lr9NYan07Bkh6sBZ /Bzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796299746; x=1796904546; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=WtOtSd2PpoxQhjUiad4SwV8npJrct9XbumcGKPBDC5U=; b=ArgKn2qxQiKsg8Ig1W6wd6K9DlTLOHJnmyaG+xKblv1WOJXk6ZMMkqRCcQZ1rXEAPi xjqmJpCuTbpfDstrP1XV+PUQPE/KKQUrVkae1vFZRjIqkZJ7ShixTQPn5VbQpbdecA4H 8HNzhiknUxiPi/vwMveZehchI53RU0l5Ka15NMTvP2yviJl6kF9CxJ4EYMHGsyByaLs7 GlQGY6C7xAOXY883T2cm826IBmtopQrMIhSrQRNldIXAMarnorNwXCQIFc+zD1Y9W84M 7HrmMlIB1Pm38RAB75gVUdHulgSSskE7PFpn7dEnfZwT9PKAhPtUAAfAFESTNw/wsf/K FGjQ== X-Forwarded-Encrypted: i=1; AL+hErE4oOPZmGLE5Sl3dOV4U/ljfOduTUhZ5ett6R2nZPDa30hprPnkhv8IOq6kbtXOYPDnQwozoifBVJ81qv8=@vger.kernel.org X-Gm-Message-State: APuU4Z++AqqpJpHQgjnWXsD463wyIJIxHTeC64/aU8oQQ+9CBz6gTxNc Zlj69Vzc/SV6HPbD1e3TE7NJJuOGztig/TFxev6rMclusg8/WrsXjoef X-Gm-Gg: AZFdTZdw82XLmmWkHGvP7rygJv0oWbofAEov7zPHC/wJx7wZT5+e5XBZB7GC2BKofIK LtucXa0Eda2GcU1jMHTy69SylTHGr4t3j3uh2eEQFevJsE/2vB7jwvvH0rQ771w7LCvMKYCRcXR PusfM9RCXVDiN6YAQdw7tcDiRt6LxFqrBzNCMcaGavTOrjLZI/b4p0B4BfDiigKU099kdtuFYIP foOEYFYu0LhPwLZiWt7sU1ODdKO1kOAWaRes3TTVn5DxH4yFbb1LBoRDkuiutzwPYr3bKYmzd9J 3DPIFjV1nar6SekNM3fKzwayrjQQUWJ6nSiKIgNL3mWmkc7DDJ8lqZzP2L7io6OLtBBL3SfmNo/ Ca+IVJxbmXBziIJbz+EtIJxQVm9CwGJpSPRv4sqAhNtCOqaSvlDmvuO4SZ6d8kzgLyhvBmRXMTM nKCi4KYxh3zyYzvrvAln+qHcSyCvhLikaAocJAe3X4py5YioZlGAVQrwHyMztarC3U6hyDl+RCq ojWVk57bk7aQnG6QKsvhq+CghsYhT1BrK4DVHWetrGi1WLubw6ECUEC3dkcT14tihyRRMnsnbUs gbaM0lfLNgt/nOJ0+o109s9K5AQH X-Received: by 2002:a05:701a:cccd:20b0:1ab:aaf3:389d with SMTP id a92af1059eb24-1b5568234c2mr42304371c88.1.1796299745729; Thu, 03 Dec 2026 04:09:05 -0800 (PST) Received: from ThinkPad ([192.220.23.71]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1b556840494sm101600588c88.12.2026.12.03.04.09.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 04:09:05 -0800 (PST) From: Qiling Zhu To: Mark Pearson , "Derek J. Clark" , Rong Zhang , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Henrique de Moraes Holschuh Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, ibm-acpi-devel@lists.sourceforge.net, Lee Jones , Pavel Machek , Griffin Kroah-Hartman , linux-leds@vger.kernel.org, vishnuocv@gmail.com, vsankar@lenovo.com, Andrea Rabbaglietti Subject: [PATCH v6 0/6] platform/x86: thinkpad_acpi: Add a keyboard backlight auto-mode trigger Date: Thu, 3 Dec 2026 20:06:58 +0800 Message-ID: <20261203120704.41431-1-kmatzkaczor244@gmail.com> X-Mailer: git-send-email 2.56.1 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hi all, On supported ThinkPads, Fn+Space can select automatic keyboard backlight control. This series exposes that mode through the private LED trigger "tpacpi-kbd-auto", following the hw control trigger framework and its ideapad-laptop example. The first patch fixes an out-of-range brightness value that was reported to make UPower stop tracking hotkey changes on a ThinkPad X9-14 Gen 1. The patches: 1/6 Report auto keyboard backlight mode as off (stable) 2/6 Extract kbdlight notify helpers (refactor) 3/6 Don't poke keyboard backlight's LED core brightness (writes) 4/6 Restore keyboard backlight level ourselves (sleep/wake) 5/6 Detect auto-mode capability via MLCG (groundwork) 6/6 Add a keyboard backlight auto-mode trigger (feature) A few notes on the design: - The auto mode is EC level 3 and not a brightness, so it is reported as 0 to the LED core. The trigger is registered when MLCG bit 20 says the EC supports the auto mode, and it is attached by default if the EC is already in auto mode when the driver loads. - 4/6 drops kbdlight_suspend() and has kbdlight_resume() write the cached EC level back on every model: with thinkpad_acpi unloaded, the firmware turned the backlight off for s2idle and hibernation on my machine, and the EC came back at its previous level after s2idle and at 0 after hibernation. No LED_SUSPENDED gate is kept: this LED does not set LED_CORE_SUSPENDRESUME, and with the suspend callback gone I do not see what would set the flag for it. With 1/6 on its own, a backlight that went to sleep in auto mode comes back off after resume on kernels that still use the LED core suspend/resume path; the rest of the series restores the level the EC had. - kbdlight_brightness now holds the raw EC level, including the auto mode, rather than a brightness; a comment above the variable says so, and the name is unchanged. Changes since v5: - 5/6 defines TPACPI_KBD_LIGHT_AUTO_CAPABLE_BIT with BIT(), as Ilpo suggested; the name is kept. No other code change, and the Reviewed-by tags are unchanged. Sent following Ilpo's suggestion on the timing. Changes since v4, in short: 2/6 now contains the changes to the notify helpers that 4/6 used to make, 4/6 shrank accordingly, and 5/6 dropped a redundant comment. Details are in the v5 thread: https://lore.kernel.org/r/20261130131252.80436-1-kmatzkaczor244@gmail.com/ Testing was done on a ThinkPad X1 Carbon Gen 14 (linux-next next-20261030): the software paths, the trigger following Fn+Space in and out of auto mode, and suspend/resume from manual levels and from auto mode. S3-capable models and other models are still untested, and testing there would be very welcome. One observation from testing with a desktop session: KDE's power management can write back the keyboard brightness it last knew about after resume, so a level written directly through sysfs may be replaced by it. The series also applies cleanly to the current linux-next. The checkpatch.pl --strict warnings I see are for three commit IDs that are missing from my shallow clone. This series was developed with LLM assistance; I reviewed every design decision against the framework sources and validated the behavior on real hardware myself. Thank you all for your time and for the reviews of the earlier versions. Regards, Qiling Zhu Qiling Zhu (6): platform/x86: thinkpad_acpi: Report auto keyboard backlight mode as off platform/x86: thinkpad_acpi: Extract kbdlight notify helpers platform/x86: thinkpad_acpi: Don't poke keyboard backlight's LED core brightness platform/x86: thinkpad_acpi: Restore keyboard backlight level ourselves platform/x86: thinkpad_acpi: Detect auto-mode capability via MLCG platform/x86: thinkpad_acpi: Add a keyboard backlight auto-mode trigger drivers/platform/x86/lenovo/Kconfig | 1 + drivers/platform/x86/lenovo/thinkpad_acpi.c | 183 +++++++++++++++----- 2 files changed, 142 insertions(+), 42 deletions(-) base-commit: 7649ba73f9e7e1e04d0b46213e39c79ae09dd55c -- 2.56.1