Skip to content

Commit 546edbd

Browse files
NeroReflexJiri Kosina
authored andcommitted
HID: hid-asus: reset the backlight brightness level on resume
Some devices managed by this driver automatically set brightness to 0 before entering a suspended state and reset it back to a default brightness level after the resume: this has the effect of having the kernel report wrong brightness status after a sleep, and on some devices (like the Asus RC71L) that brightness is the intensity of LEDs directly facing the user. Fix the above issue by setting back brightness to the level it had before entering a sleep state. Signed-off-by: Denis Benato <[email protected]> Signed-off-by: Luke D. Jones <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 06ae5af commit 546edbd

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

drivers/hid/hid-asus.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,6 +1000,24 @@ static int asus_start_multitouch(struct hid_device *hdev)
10001000
return 0;
10011001
}
10021002

1003+
static int __maybe_unused asus_resume(struct hid_device *hdev) {
1004+
struct asus_drvdata *drvdata = hid_get_drvdata(hdev);
1005+
int ret = 0;
1006+
1007+
if (drvdata->kbd_backlight) {
1008+
const u8 buf[] = { FEATURE_KBD_REPORT_ID, 0xba, 0xc5, 0xc4,
1009+
drvdata->kbd_backlight->cdev.brightness };
1010+
ret = asus_kbd_set_report(hdev, buf, sizeof(buf));
1011+
if (ret < 0) {
1012+
hid_err(hdev, "Asus failed to set keyboard backlight: %d\n", ret);
1013+
goto asus_resume_err;
1014+
}
1015+
}
1016+
1017+
asus_resume_err:
1018+
return ret;
1019+
}
1020+
10031021
static int __maybe_unused asus_reset_resume(struct hid_device *hdev)
10041022
{
10051023
struct asus_drvdata *drvdata = hid_get_drvdata(hdev);
@@ -1294,6 +1312,7 @@ static struct hid_driver asus_driver = {
12941312
.input_configured = asus_input_configured,
12951313
#ifdef CONFIG_PM
12961314
.reset_resume = asus_reset_resume,
1315+
.resume = asus_resume,
12971316
#endif
12981317
.event = asus_event,
12991318
.raw_event = asus_raw_event

0 commit comments

Comments
 (0)