mirror of
https://github.com/wessel-novacustom/clevo-keyboard.git
synced 2024-11-15 03:34:01 +01:00
Turn keyboard off on suspend to prevent default colours showing on resume before driver has control again.
This commit is contained in:
parent
3af08adf79
commit
25181b40d2
|
@ -325,7 +325,7 @@ static ssize_t set_brightness_fs(struct device *child,
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_enabled(u8 state)
|
static int set_enabled_cmd(u8 state)
|
||||||
{
|
{
|
||||||
u32 cmd = 0xE0000000;
|
u32 cmd = 0xE0000000;
|
||||||
TUXEDO_INFO("Set keyboard enabled to: %d\n", state);
|
TUXEDO_INFO("Set keyboard enabled to: %d\n", state);
|
||||||
|
@ -336,7 +336,12 @@ static void set_enabled(u8 state)
|
||||||
cmd |= 0x07F001;
|
cmd |= 0x07F001;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tuxedo_evaluate_wmi_method(WMI_SUBMETHOD_ID_SET_KB_LEDS, cmd, NULL)) {
|
return tuxedo_evaluate_wmi_method(WMI_SUBMETHOD_ID_SET_KB_LEDS, cmd, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void set_enabled(u8 state)
|
||||||
|
{
|
||||||
|
if (!set_enabled_cmd(state)) {
|
||||||
kbd_led_state.enabled = state;
|
kbd_led_state.enabled = state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -617,6 +622,13 @@ static int tuxedo_wmi_remove(struct platform_device *dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int tuxedo_wmi_suspend(struct platform_device *dev, pm_message_t state)
|
||||||
|
{
|
||||||
|
// turning the keyboard off prevents default colours showing on resume
|
||||||
|
set_enabled_cmd(0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int tuxedo_wmi_resume(struct platform_device *dev)
|
static int tuxedo_wmi_resume(struct platform_device *dev)
|
||||||
{
|
{
|
||||||
tuxedo_evaluate_wmi_method(WMI_SUBMETHOD_ID_GET_AP, 0, NULL);
|
tuxedo_evaluate_wmi_method(WMI_SUBMETHOD_ID_GET_AP, 0, NULL);
|
||||||
|
@ -636,6 +648,7 @@ static int tuxedo_wmi_resume(struct platform_device *dev)
|
||||||
|
|
||||||
static struct platform_driver tuxedo_platform_driver = {
|
static struct platform_driver tuxedo_platform_driver = {
|
||||||
.remove = tuxedo_wmi_remove,
|
.remove = tuxedo_wmi_remove,
|
||||||
|
.suspend = tuxedo_wmi_suspend,
|
||||||
.resume = tuxedo_wmi_resume,
|
.resume = tuxedo_wmi_resume,
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = DRIVER_NAME,
|
.name = DRIVER_NAME,
|
||||||
|
|
Loading…
Reference in a new issue