mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Armin Wolf <W_Armin@gmx.de>
To: hansg@kernel.org, ilpo.jarvinen@linux.intel.com, wse@tuxedocomputers.com
Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 3/3] platform/x86: uniwill-laptop: Make KBD_LED_MAX_INTENSITY configurable
Date: Sat, 11 Jul 2026 00:35:44 +0200	[thread overview]
Message-ID: <20260710223544.49602-4-W_Armin@gmx.de> (raw)
In-Reply-To: <20260710223544.49602-1-W_Armin@gmx.de>

Some (yet to be enabled) Tuxedo devices have a maximum intensity of
200 instead of the default 50. Remove the hardcoded maximum intensity
and use the device descriptor instead.

Suggested-by: Werner Sembach <wse@tuxedocomputers.com>
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
 drivers/platform/x86/uniwill/uniwill-acpi.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/x86/uniwill/uniwill-acpi.c b/drivers/platform/x86/uniwill/uniwill-acpi.c
index 4591ee299a90..5b8e35bf9a51 100644
--- a/drivers/platform/x86/uniwill/uniwill-acpi.c
+++ b/drivers/platform/x86/uniwill/uniwill-acpi.c
@@ -351,7 +351,6 @@
 #define LED_CHANNELS		3
 
 #define KBD_LED_CHANNELS	3
-#define KBD_LED_MAX_INTENSITY	50
 
 #define UNIWILL_FEATURE_FN_LOCK			BIT(0)
 #define UNIWILL_FEATURE_SUPER_KEY		BIT(1)
@@ -403,6 +402,7 @@ struct uniwill_data {
 	struct mc_subled led_mc_subled_info[LED_CHANNELS];
 	bool kbd_led_single_color;
 	u8 kbd_led_max_brightness;
+	u8 kbd_led_max_intensity;
 	unsigned int last_kbd_status;
 	union {
 		struct {
@@ -429,6 +429,7 @@ struct uniwill_device_descriptor {
 	unsigned int features;
 	bool kbd_led_single_color;
 	u8 kbd_led_max_brightness;
+	u8 kbd_led_max_intensity;
 	u8 lightbar_max_brightness;
 	/* Executed during driver probing */
 	int (*probe)(struct uniwill_data *data);
@@ -1780,8 +1781,8 @@ static int uniwill_rgb_kbd_led_init(struct uniwill_data *data)
 		 * Make sure that the initial intensity value is not greater than
 		 * the maximum intensity.
 		 */
-		if (regval > KBD_LED_MAX_INTENSITY) {
-			regval = KBD_LED_MAX_INTENSITY;
+		if (regval > data->kbd_led_max_intensity) {
+			regval = data->kbd_led_max_intensity;
 			ret = regmap_write(data->regmap, uniwill_kbd_led_channel_to_reg[i], regval);
 			if (ret < 0)
 				return ret;
@@ -1793,7 +1794,7 @@ static int uniwill_rgb_kbd_led_init(struct uniwill_data *data)
 			intensity_all_zeros = false;
 
 		data->kbd_led_mc_subled_info[i].intensity = regval;
-		data->kbd_led_mc_subled_info[i].max_intensity = KBD_LED_MAX_INTENSITY;
+		data->kbd_led_mc_subled_info[i].max_intensity = data->kbd_led_max_intensity;
 		data->kbd_led_mc_subled_info[i].channel = i;
 	}
 
@@ -2338,6 +2339,7 @@ static int uniwill_probe(struct platform_device *pdev)
 	data->features = device_descriptor.features;
 	data->kbd_led_single_color = device_descriptor.kbd_led_single_color;
 	data->kbd_led_max_brightness = device_descriptor.kbd_led_max_brightness;
+	data->kbd_led_max_intensity = device_descriptor.kbd_led_max_intensity;
 	data->lightbar_max_brightness = device_descriptor.lightbar_max_brightness;
 
 	/*
@@ -2675,6 +2677,7 @@ static struct uniwill_device_descriptor machenike_l16p_descriptor __initdata = {
 		    UNIWILL_FEATURE_USB_POWERSHARE,
 	.kbd_led_single_color = false,
 	.kbd_led_max_brightness = 4,
+	.kbd_led_max_intensity = 50,
 };
 
 static struct uniwill_device_descriptor lapqc71a_lapqc71b_descriptor __initdata = {
@@ -2858,6 +2861,7 @@ static struct uniwill_device_descriptor x4sp4nal_descriptor __initdata = {
 		    UNIWILL_FEATURE_USB_POWERSHARE,
 	.kbd_led_single_color = true,
 	.kbd_led_max_brightness = 2,
+	.kbd_led_max_intensity = 50,
 };
 
 static const struct dmi_system_id uniwill_dmi_table[] __initconst = {
@@ -3355,6 +3359,7 @@ static int __init uniwill_init(void)
 		device_descriptor.kbd_led_single_color = false;
 		/* Some models only support 3 brightness levels */
 		device_descriptor.kbd_led_max_brightness = 4;
+		device_descriptor.kbd_led_max_intensity = 50;
 		/* Some models only support 36 brightness levels per color component */
 		device_descriptor.lightbar_max_brightness = 200;
 		pr_warn("Enabling potentially unsupported features\n");
-- 
2.39.5


  parent reply	other threads:[~2026-07-10 22:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-10 22:35 [PATCH v2 0/3] platform/x86: uniwill-laptop: Prepare for extending keyboard backlight support Armin Wolf
2026-07-10 22:35 ` [PATCH v2 1/3] platform/x86: uniwill-laptop: Split uniwill_kbd_led_init() Armin Wolf
2026-07-15 15:12   ` Werner Sembach
2026-07-15 23:56     ` Armin Wolf
2026-07-16 15:10       ` Werner Sembach
2026-07-10 22:35 ` [PATCH v2 2/3] platform/x86: uniwill-laptop: Remove single color keyboard detection Armin Wolf
2026-07-15 15:16   ` Werner Sembach
2026-07-15 23:59     ` Armin Wolf
2026-07-10 22:35 ` Armin Wolf [this message]
2026-07-15 15:19   ` [PATCH v2 3/3] platform/x86: uniwill-laptop: Make KBD_LED_MAX_INTENSITY configurable Werner Sembach
2026-07-16 15:12     ` Werner Sembach
2026-07-16 16:20       ` Armin Wolf

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=20260710223544.49602-4-W_Armin@gmx.de \
    --to=w_armin@gmx.de \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=wse@tuxedocomputers.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