diff options
author | Oleksij Rempel <linux@rempel-privat.de> | 2015-09-14 05:16:30 -0400 |
---|---|---|
committer | Darren Hart <dvhart@linux.intel.com> | 2015-10-03 11:40:44 -0400 |
commit | 307340493f3d62935db0bd48a9909bb746ffef1e (patch) | |
tree | 77c2b9d1cc3a64756973788c31eeff76d2d8690e /drivers/platform | |
parent | 10e6aaabc37171a8b2c0f531696db91f5ac442f9 (diff) |
asus-wmi: restore kbd led level after resume
Afters suspend/resume cycle with closed lid the kbd backlight level
is lost. This patch will will restore this value to last known level.
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/x86/asus-wmi.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index efbc3f0c592b..1f7d80ff8cb4 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c | |||
@@ -582,7 +582,7 @@ static void asus_wmi_led_exit(struct asus_wmi *asus) | |||
582 | 582 | ||
583 | static int asus_wmi_led_init(struct asus_wmi *asus) | 583 | static int asus_wmi_led_init(struct asus_wmi *asus) |
584 | { | 584 | { |
585 | int rv = 0; | 585 | int rv = 0, led_val; |
586 | 586 | ||
587 | asus->led_workqueue = create_singlethread_workqueue("led_workqueue"); | 587 | asus->led_workqueue = create_singlethread_workqueue("led_workqueue"); |
588 | if (!asus->led_workqueue) | 588 | if (!asus->led_workqueue) |
@@ -602,9 +602,11 @@ static int asus_wmi_led_init(struct asus_wmi *asus) | |||
602 | goto error; | 602 | goto error; |
603 | } | 603 | } |
604 | 604 | ||
605 | if (kbd_led_read(asus, NULL, NULL) >= 0) { | 605 | led_val = kbd_led_read(asus, NULL, NULL); |
606 | if (led_val >= 0) { | ||
606 | INIT_WORK(&asus->kbd_led_work, kbd_led_update); | 607 | INIT_WORK(&asus->kbd_led_work, kbd_led_update); |
607 | 608 | ||
609 | asus->kbd_led_wk = led_val; | ||
608 | asus->kbd_led.name = "asus::kbd_backlight"; | 610 | asus->kbd_led.name = "asus::kbd_backlight"; |
609 | asus->kbd_led.brightness_set = kbd_led_set; | 611 | asus->kbd_led.brightness_set = kbd_led_set; |
610 | asus->kbd_led.brightness_get = kbd_led_get; | 612 | asus->kbd_led.brightness_get = kbd_led_get; |
@@ -2160,6 +2162,16 @@ static int asus_hotk_thaw(struct device *device) | |||
2160 | return 0; | 2162 | return 0; |
2161 | } | 2163 | } |
2162 | 2164 | ||
2165 | static int asus_hotk_resume(struct device *device) | ||
2166 | { | ||
2167 | struct asus_wmi *asus = dev_get_drvdata(device); | ||
2168 | |||
2169 | if (!IS_ERR_OR_NULL(asus->kbd_led.dev)) | ||
2170 | queue_work(asus->led_workqueue, &asus->kbd_led_work); | ||
2171 | |||
2172 | return 0; | ||
2173 | } | ||
2174 | |||
2163 | static int asus_hotk_restore(struct device *device) | 2175 | static int asus_hotk_restore(struct device *device) |
2164 | { | 2176 | { |
2165 | struct asus_wmi *asus = dev_get_drvdata(device); | 2177 | struct asus_wmi *asus = dev_get_drvdata(device); |
@@ -2190,6 +2202,8 @@ static int asus_hotk_restore(struct device *device) | |||
2190 | bl = !asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_UWB); | 2202 | bl = !asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_UWB); |
2191 | rfkill_set_sw_state(asus->uwb.rfkill, bl); | 2203 | rfkill_set_sw_state(asus->uwb.rfkill, bl); |
2192 | } | 2204 | } |
2205 | if (!IS_ERR_OR_NULL(asus->kbd_led.dev)) | ||
2206 | queue_work(asus->led_workqueue, &asus->kbd_led_work); | ||
2193 | 2207 | ||
2194 | return 0; | 2208 | return 0; |
2195 | } | 2209 | } |
@@ -2197,6 +2211,7 @@ static int asus_hotk_restore(struct device *device) | |||
2197 | static const struct dev_pm_ops asus_pm_ops = { | 2211 | static const struct dev_pm_ops asus_pm_ops = { |
2198 | .thaw = asus_hotk_thaw, | 2212 | .thaw = asus_hotk_thaw, |
2199 | .restore = asus_hotk_restore, | 2213 | .restore = asus_hotk_restore, |
2214 | .resume = asus_hotk_resume, | ||
2200 | }; | 2215 | }; |
2201 | 2216 | ||
2202 | static int asus_wmi_probe(struct platform_device *pdev) | 2217 | static int asus_wmi_probe(struct platform_device *pdev) |