mirror of
https://github.com/wessel-novacustom/clevo-keyboard.git
synced 2024-11-15 11:43:59 +01:00
Fix uw kbd bl default values and keep disabled during init
This commit is contained in:
parent
f98573aa21
commit
857d5f6bea
|
@ -40,7 +40,7 @@
|
||||||
#define UNIWILL_BRIGHTNESS_MAX 0xc8
|
#define UNIWILL_BRIGHTNESS_MAX 0xc8
|
||||||
#define UNIWILL_BRIGHTNESS_DEFAULT UNIWILL_BRIGHTNESS_MAX * 0.75
|
#define UNIWILL_BRIGHTNESS_DEFAULT UNIWILL_BRIGHTNESS_MAX * 0.75
|
||||||
#define UNIWILL_COLOR_DEFAULT 0xffffff
|
#define UNIWILL_COLOR_DEFAULT 0xffffff
|
||||||
#define UNIWILL_COLOR_STRING_DEFAULT "white"
|
#define UNIWILL_COLOR_STRING_DEFAULT "WHITE"
|
||||||
|
|
||||||
union uw_ec_read_return {
|
union uw_ec_read_return {
|
||||||
u32 dword;
|
u32 dword;
|
||||||
|
@ -72,7 +72,7 @@ struct kbd_led_state_uw_t {
|
||||||
} kbd_led_state_uw = {
|
} kbd_led_state_uw = {
|
||||||
.brightness = UNIWILL_BRIGHTNESS_DEFAULT,
|
.brightness = UNIWILL_BRIGHTNESS_DEFAULT,
|
||||||
.color = UNIWILL_COLOR_DEFAULT,
|
.color = UNIWILL_COLOR_DEFAULT,
|
||||||
.color_string = "white"
|
.color_string = UNIWILL_COLOR_STRING_DEFAULT
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct key_entry uniwill_wmi_keymap[] = {
|
static struct key_entry uniwill_wmi_keymap[] = {
|
||||||
|
@ -358,18 +358,21 @@ static int uniwill_keyboard_probe(struct platform_device *dev)
|
||||||
// Save previous enable state
|
// Save previous enable state
|
||||||
uniwill_kbd_bl_enable_state_on_start = uniwill_read_kbd_bl_enabled();
|
uniwill_kbd_bl_enable_state_on_start = uniwill_read_kbd_bl_enabled();
|
||||||
|
|
||||||
|
// Disable backlight while initializing
|
||||||
|
uniwill_write_kbd_bl_enable(0);
|
||||||
|
|
||||||
// Initialize keyboard backlight driver state according to parameters
|
// Initialize keyboard backlight driver state according to parameters
|
||||||
if (param_brightness > UNIWILL_BRIGHTNESS_MAX) param_brightness = UNIWILL_BRIGHTNESS_DEFAULT;
|
if (param_brightness > UNIWILL_BRIGHTNESS_MAX) param_brightness = UNIWILL_BRIGHTNESS_DEFAULT;
|
||||||
kbd_led_state_uw.brightness = param_brightness;
|
kbd_led_state_uw.brightness = param_brightness;
|
||||||
if (color_lookup(&color_list, param_color) <= (u32) 0xffffff) kbd_led_state_uw.color = color_lookup(&color_list, param_color);
|
if (color_lookup(&color_list, param_color) <= (u32) 0xffffff) kbd_led_state_uw.color = color_lookup(&color_list, param_color);
|
||||||
else kbd_led_state_uw.color = UNIWILL_COLOR_DEFAULT;
|
else kbd_led_state_uw.color = UNIWILL_COLOR_DEFAULT;
|
||||||
|
|
||||||
// Enable keyboard backlight
|
|
||||||
uniwill_write_kbd_bl_enable(1);
|
|
||||||
|
|
||||||
// Update keyboard according to the current state
|
// Update keyboard according to the current state
|
||||||
uniwill_write_kbd_bl_state();
|
uniwill_write_kbd_bl_state();
|
||||||
|
|
||||||
|
// Enable keyboard backlight
|
||||||
|
uniwill_write_kbd_bl_enable(1);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_remove_notifiers:
|
err_remove_notifiers:
|
||||||
|
@ -403,8 +406,8 @@ static int uniwill_keyboard_suspend(struct platform_device *dev, pm_message_t st
|
||||||
|
|
||||||
static int uniwill_keyboard_resume(struct platform_device *dev)
|
static int uniwill_keyboard_resume(struct platform_device *dev)
|
||||||
{
|
{
|
||||||
uniwill_write_kbd_bl_enable(1);
|
|
||||||
uniwill_write_kbd_bl_state();
|
uniwill_write_kbd_bl_state();
|
||||||
|
uniwill_write_kbd_bl_enable(1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue