Linux Input/HID development
 help / color / mirror / Atom feed
From: Michal Szpakowski <michi.szpakowski@gmail.com>
To: linux-input@vger.kernel.org, Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: "Ronald Tschalär" <ronald@innovation.ch>,
	"Aditya Garg" <gargaditya08@live.com>,
	"Lukas Wunner" <lukas@wunner.de>,
	stable@vger.kernel.org
Subject: [PATCH] Input: applespi - turn the keyboard backlight off across suspend
Date: Thu,  1 Oct 2026 10:41:54 +0200	[thread overview]
Message-ID: <20261001084154.4703-1-michi.szpakowski@gmail.com> (raw)

The keyboard backlight of the SPI topcase stays lit through s2idle: the
driver's suspend handler only switches the caps-lock LED off, and the
backlight LED is registered without LED_CORE_SUSPENDRESUME, so the LED
core never gets to blank it. Under deep (S3) the rails go down anyway,
which is why it only shows on machines that default to s2idle.

Set the flag. The LED core then sets the brightness to 0 before the
device suspends and restores the previous level on resume; the LED is a
child of the SPI device, so the command goes out before applespi_suspend()
drains its writes and disables the GPE.

Tested on a MacBookPro13,1 (2016): 30 s of s2idle with the backlight at
200/255 leaves it lit on the stock kernel; with the flag it goes dark at
suspend and is back at 200 on wake.

Fixes: 038b1a05eae6 ("Input: add Apple SPI keyboard and trackpad driver")
Cc: stable@vger.kernel.org
Signed-off-by: Michal Szpakowski <michi.szpakowski@gmail.com>
---
 drivers/input/keyboard/applespi.c | 1 +
 1 file changed, 1 insertion(+)

--- a/drivers/input/keyboard/applespi.c
+++ b/drivers/input/keyboard/applespi.c
@@ -1772,6 +1772,7 @@
 	applespi->backlight_info.name            = "spi::kbd_backlight";
 	applespi->backlight_info.default_trigger = "kbd-backlight";
 	applespi->backlight_info.brightness_set  = applespi_set_bl_level;
+	applespi->backlight_info.flags           = LED_CORE_SUSPENDRESUME;
 
 	sts = devm_led_classdev_register(&spi->dev, &applespi->backlight_info);
 	if (sts)

             reply	other threads:[~2026-10-01  8:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-01  8:41 Michal Szpakowski [this message]
2026-10-01  8:56 ` [PATCH] Input: applespi - turn the keyboard backlight off across suspend sashiko-bot
2026-10-01  9:56 ` [PATCH v2] " Michal Szpakowski

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=20261001084154.4703-1-michi.szpakowski@gmail.com \
    --to=michi.szpakowski@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gargaditya08@live.com \
    --cc=linux-input@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=ronald@innovation.ch \
    --cc=stable@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