mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 1/2] platform/x86: uniwill-laptop: Fix brightness notify for 3 level keyboards
@ 2026-08-05 23:04 Werner Sembach
  2026-08-05 23:04 ` [PATCH v2 2/2] platform/x86: uniwill-laptop: Enable kb backlight and lightbar for TUXEDO Werner Sembach
  2026-08-06 16:00 ` [PATCH v2 1/2] platform/x86: uniwill-laptop: Fix brightness notify for 3 level keyboards Armin Wolf
  0 siblings, 2 replies; 3+ messages in thread
From: Werner Sembach @ 2026-08-05 23:04 UTC (permalink / raw)
  To: Armin Wolf, Hans de Goede, Ilpo Järvinen
  Cc: Werner Sembach, platform-driver-x86, linux-kernel

The devices with 3 brightness level keyboards send
UNIWILL_OSD_KB_LED_LEVEL0, UNIWILL_OSD_KB_LED_LEVEL2, and
UNIWILL_OSD_KB_LED_LEVEL4 and not UNIWILL_OSD_KB_LED_LEVEL0,
UNIWILL_OSD_KB_LED_LEVEL1, and UNIWILL_OSD_KB_LED_LEVEL2.

This patch maps the events correctly to brightness levels 0, 1, and 2.

Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
---
V1->V2: Use the events as source of truth for brightness_hw_changed value
        again to avoid a race condition as Armin had pointed out.

 drivers/platform/x86/uniwill/uniwill-acpi.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/platform/x86/uniwill/uniwill-acpi.c b/drivers/platform/x86/uniwill/uniwill-acpi.c
index 7a2eeaec4c961..5c5bb6d104494 100644
--- a/drivers/platform/x86/uniwill/uniwill-acpi.c
+++ b/drivers/platform/x86/uniwill/uniwill-acpi.c
@@ -1631,6 +1631,18 @@ static int uniwill_notify_kbd_led(struct uniwill_data *data, int brightness)
 	struct led_classdev *led_cdev;
 	int ret;
 
+	/*
+	 * The devices with 3 brightness level keyboards send
+	 * UNIWILL_OSD_KB_LED_LEVEL0, UNIWILL_OSD_KB_LED_LEVEL2, and
+	 * UNIWILL_OSD_KB_LED_LEVEL4 which need to be mapped to 0, 1, and 2.
+	 */
+	if (data->kbd_led_max_brightness == 2) {
+		if (brightness == 2)
+			brightness = 1;
+		else if (brightness == 4)
+			brightness = 2;
+	}
+
 	if (data->kbd_led_single_color)
 		led_cdev = &data->kbd_led_cdev;
 	else

base-commit: 1b04f556e8428a3865a95627ab7a0acb5d9b93a5
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-06 16:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-05 23:04 [PATCH v2 1/2] platform/x86: uniwill-laptop: Fix brightness notify for 3 level keyboards Werner Sembach
2026-08-05 23:04 ` [PATCH v2 2/2] platform/x86: uniwill-laptop: Enable kb backlight and lightbar for TUXEDO Werner Sembach
2026-08-06 16:00 ` [PATCH v2 1/2] platform/x86: uniwill-laptop: Fix brightness notify for 3 level keyboards Armin Wolf

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®