Re: [PATCH v2 3/3] platform/x86: uniwill-laptop: Make KBD_LED_MAX_INTENSITY configurable

From: Werner Sembach

Date: Thu Jul 16 2026 - 11:50:31 EST



Am 15.07.26 um 17:19 schrieb Werner Sembach:

Am 11.07.26 um 00:35 schrieb Armin Wolf:
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.

sorry i gave missinformation, we actually convert down to the range 0-50 in td for all devices here: https://gitlab.com/tuxedocomputers/development/packages/tuxedo-drivers/-/blob/0b2f8c6ab7ef709343ae74b3de51dcae45357641/src/uniwill_leds.h#L106

so this patch can actually be dropped


Suggested-by: Werner Sembach <wse@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Armin Wolf <W_Armin@xxxxxx>
---
  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");

lgtm

Reviewed-by: Werner Sembach <wse@xxxxxxxxxxxxxxxxxxx>