From 6e140060e28d7da15890b61fd45dc240ad7e17ef Mon Sep 17 00:00:00 2001 From: Werner Sembach Date: Tue, 9 May 2023 20:44:20 +0200 Subject: [PATCH 1/4] Add debug print --- src/uniwill_leds.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/uniwill_leds.h b/src/uniwill_leds.h index af72863..26b2b17 100644 --- a/src/uniwill_leds.h +++ b/src/uniwill_leds.h @@ -179,6 +179,7 @@ int uniwill_leds_init_early(struct platform_device *dev) pr_err("Reading barebone ID failed.\n"); return ret; } + pr_debug("EC Barebone ID: %#04x\n", data); if (data == UW_EC_REG_BAREBONE_ID_VALUE_PFxxxxx || data == UW_EC_REG_BAREBONE_ID_VALUE_PFxMxxx || From 2fb6977b4b3cee2a633a9f9228687c4cf2fbddb6 Mon Sep 17 00:00:00 2001 From: Werner Sembach Date: Tue, 9 May 2023 20:45:35 +0200 Subject: [PATCH 2/4] Add IBP14 Gen8 to white only keyboard backlight device list --- src/uniwill_interfaces.h | 1 + src/uniwill_leds.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/uniwill_interfaces.h b/src/uniwill_interfaces.h index ceba580..9273da7 100644 --- a/src/uniwill_interfaces.h +++ b/src/uniwill_interfaces.h @@ -64,6 +64,7 @@ typedef void (uniwill_event_callb_t)(u32); #define UW_EC_REG_BAREBONE_ID_VALUE_PH6TRX1 0x15 #define UW_EC_REG_BAREBONE_ID_VALUE_PH6TQxx 0x16 #define UW_EC_REG_BAREBONE_ID_VALUE_PH4Axxx 0x17 +#define UW_EC_REG_BAREBONE_ID_VALUE_PH4Pxxx 0x18 #define UW_EC_REG_FEATURES_0 0x0765 #define UW_EC_REG_FEATURES_1 0x0766 diff --git a/src/uniwill_leds.h b/src/uniwill_leds.h index 26b2b17..d08efc7 100644 --- a/src/uniwill_leds.h +++ b/src/uniwill_leds.h @@ -188,7 +188,8 @@ int uniwill_leds_init_early(struct platform_device *dev) data == UW_EC_REG_BAREBONE_ID_VALUE_PH4TQx1 || data == UW_EC_REG_BAREBONE_ID_VALUE_PH6TRX1 || data == UW_EC_REG_BAREBONE_ID_VALUE_PH6TQxx || - data == UW_EC_REG_BAREBONE_ID_VALUE_PH4Axxx) { + data == UW_EC_REG_BAREBONE_ID_VALUE_PH4Axxx || + data == UW_EC_REG_BAREBONE_ID_VALUE_PH4Pxxx) { ret = uniwill_read_ec_ram(UW_EC_REG_KBD_BL_STATUS, &data); if (ret) { pr_err("Reading keyboard backlight status failed.\n"); From 5c9ca122cca5932ec12d1967460519efd0d87894 Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Wed, 10 May 2023 10:28:40 +0200 Subject: [PATCH 3/4] Add color scaling to cl kbd bl driver Modify scaling for one-zone rgb Implements #79 --- src/clevo_leds.h | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/clevo_leds.h b/src/clevo_leds.h index 5714756..4f16dbe 100644 --- a/src/clevo_leds.h +++ b/src/clevo_leds.h @@ -64,6 +64,17 @@ void clevo_leds_set_color_extern(u32 color); static enum clevo_kb_backlight_types clevo_kb_backlight_type = CLEVO_KB_BACKLIGHT_TYPE_NONE; static bool leds_initialized = false; +/** + * Color scaling quirk list + */ +static void color_scaling(enum clevo_kb_backlight_types *type, u8 *red, u8 *green, u8 *blue) +{ + if (*type == CLEVO_KB_BACKLIGHT_TYPE_1_ZONE_RGB) { + *red = (180 * *red) / 255; + *blue = (200 * *blue) / 255; + } +} + static int clevo_evaluate_set_white_brightness(u8 brightness) { pr_debug("Set white brightness on %d\n", brightness); @@ -134,6 +145,7 @@ static struct led_classdev_mc clevo_mcled_cdevs[3]; // forward declaration static void clevo_leds_set_brightness_mc(struct led_classdev *led_cdev, enum led_brightness brightness) { int ret; u32 zone, color; + u8 red, green, blue; struct led_classdev_mc *mcled_cdev = lcdev_to_mccdev(led_cdev); ret = clevo_evaluate_set_rgb_brightness(brightness); @@ -147,9 +159,15 @@ static void clevo_leds_set_brightness_mc(struct led_classdev *led_cdev, enum led zone = mcled_cdev->subled_info[0].channel; - color = (mcled_cdev->subled_info[0].intensity << 16) + - (mcled_cdev->subled_info[1].intensity << 8) + - mcled_cdev->subled_info[2].intensity; + red = mcled_cdev->subled_info[0].intensity; + green = mcled_cdev->subled_info[1].intensity; + blue = mcled_cdev->subled_info[2].intensity; + + color_scaling(&clevo_kb_backlight_type, &red, &green, &blue); + + color = (red << 16) + + (green << 8) + + blue; ret = clevo_evaluate_set_rgb_color(zone, color); if (ret) { From 24e6f19b55448fb366ad33ccb9ef2426df8cfb00 Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Fri, 12 May 2023 16:01:58 +0200 Subject: [PATCH 4/4] Add TDP def for IBPG8MK1 --- src/tuxedo_io/tuxedo_io.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index 7dd3dfc..5156b2b 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -82,6 +82,9 @@ static int tdp_max_ph4tqx[] = { 0x32, 0x32, 0x00 }; static int tdp_min_ph4axx[] = { 0x05, 0x05, 0x00 }; static int tdp_max_ph4axx[] = { 0x2d, 0x3c, 0x00 }; +static int tdp_min_phxpxx[] = { 0x05, 0x05, 0x05 }; +static int tdp_max_phxpxx[] = { 0x2a, 0x32, 0x5a }; + static int tdp_min_pfxluxg[] = { 0x05, 0x05, 0x05 }; static int tdp_max_pfxluxg[] = { 0x23, 0x23, 0x28 }; @@ -124,6 +127,9 @@ void uw_id_tdp(void) tdp_min_defs = tdp_min_ph4axx; tdp_max_defs = tdp_max_ph4axx; #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) + } else if (dmi_match(DMI_PRODUCT_SKU, "IBP1XI08MK1")) { + tdp_min_defs = tdp_min_phxpxx; + tdp_max_defs = tdp_max_phxpxx; } else if (dmi_match(DMI_PRODUCT_SKU, "PULSE1502")) { tdp_min_defs = tdp_min_pfxluxg; tdp_max_defs = tdp_max_pfxluxg;