From 06f0798162f72e7e2b33e053ea554f283d00d0fc Mon Sep 17 00:00:00 2001 From: Werner Sembach Date: Tue, 30 May 2023 17:36:40 +0200 Subject: [PATCH] Slim down state restore by not rewriting unchanged values in led_cdev struct --- src/uniwill_leds.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/uniwill_leds.h b/src/uniwill_leds.h index 1f14ee7..a129f4c 100644 --- a/src/uniwill_leds.h +++ b/src/uniwill_leds.h @@ -287,7 +287,9 @@ void uniwill_leds_restore_state_extern(void) { if (uw_leds_initialized) { if (uniwill_kb_backlight_type == UNIWILL_KB_BACKLIGHT_TYPE_FIXED_COLOR) { - uniwill_led_cdev.brightness_set(&uniwill_led_cdev, uniwill_led_cdev.brightness); + if (uniwill_write_kbd_bl_white(uniwill_led_cdev.brightness)) { + pr_debug("uniwill_leds_restore_state_extern(): uniwill_write_kbd_bl_white() failed\n"); + } } else if (uniwill_kb_backlight_type == UNIWILL_KB_BACKLIGHT_TYPE_1_ZONE_RGB) { // reset @@ -296,7 +298,11 @@ void uniwill_leds_restore_state_extern(void) { uniwill_write_ec_ram(UW_EC_REG_KBD_BL_STATUS, data); // write - uniwill_mcled_cdev.led_cdev.brightness_set(&uniwill_mcled_cdev.led_cdev, uniwill_mcled_cdev.led_cdev.brightness); + if (uniwill_write_kbd_bl_rgb(uniwill_mcled_cdev.subled_info[0].brightness, + uniwill_mcled_cdev.subled_info[1].brightness, + uniwill_mcled_cdev.subled_info[2].brightness)) { + pr_debug("uniwill_leds_restore_state_extern(): uniwill_write_kbd_bl_rgb() failed\n"); + } } } }