Skip to content

Commit 29f6eb5

Browse files
starnightandy-shev
authored andcommitted
platform/x86: asus-wmi: Only notify kbd LED hw_change by fn-key pressed
Since commit dbb3d78 ("platform/x86: asus-wmi: Call led hw_changed API on kbd brightness change"), asus-wmi directly changes the keyboard LED brightness when the keyboard brightness keys are pressed, raising the appropriate notification. However, this notification was unintentionally also being raised during boot and resume from suspend. This was resulting in userspace showing the keyboard LED OSD on resume for no good reason. Move the keyboard LED brightness changed notification from kbd_led_update to the new kbd_led_set_by_kbd function which is only called from the keyboard brightness function keys codepath. Signed-off-by: Jian-Hong Pan <jian-hong@endlessm.com> Signed-off-by: Daniel Drake <drake@endlessm.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
1 parent 69372c1 commit 29f6eb5

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

drivers/platform/x86/asus-wmi.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,6 @@ static void kbd_led_update(struct asus_wmi *asus)
467467
ctrl_param = 0x80 | (asus->kbd_led_wk & 0x7F);
468468

469469
asus_wmi_set_devstate(ASUS_WMI_DEVID_KBD_BACKLIGHT, ctrl_param, NULL);
470-
led_classdev_notify_brightness_hw_changed(&asus->kbd_led, asus->kbd_led_wk);
471470
}
472471

473472
static int kbd_led_read(struct asus_wmi *asus, int *level, int *env)
@@ -521,6 +520,14 @@ static void kbd_led_set(struct led_classdev *led_cdev,
521520
do_kbd_led_set(led_cdev, value);
522521
}
523522

523+
static void kbd_led_set_by_kbd(struct asus_wmi *asus, enum led_brightness value)
524+
{
525+
struct led_classdev *led_cdev = &asus->kbd_led;
526+
527+
do_kbd_led_set(led_cdev, value);
528+
led_classdev_notify_brightness_hw_changed(led_cdev, asus->kbd_led_wk);
529+
}
530+
524531
static enum led_brightness kbd_led_get(struct led_classdev *led_cdev)
525532
{
526533
struct asus_wmi *asus;
@@ -1759,18 +1766,18 @@ static void asus_wmi_notify(u32 value, void *context)
17591766
}
17601767

17611768
if (code == NOTIFY_KBD_BRTUP) {
1762-
do_kbd_led_set(&asus->kbd_led, asus->kbd_led_wk + 1);
1769+
kbd_led_set_by_kbd(asus, asus->kbd_led_wk + 1);
17631770
goto exit;
17641771
}
17651772
if (code == NOTIFY_KBD_BRTDWN) {
1766-
do_kbd_led_set(&asus->kbd_led, asus->kbd_led_wk - 1);
1773+
kbd_led_set_by_kbd(asus, asus->kbd_led_wk - 1);
17671774
goto exit;
17681775
}
17691776
if (code == NOTIFY_KBD_BRTTOGGLE) {
17701777
if (asus->kbd_led_wk == asus->kbd_led.max_brightness)
1771-
do_kbd_led_set(&asus->kbd_led, 0);
1778+
kbd_led_set_by_kbd(asus, 0);
17721779
else
1773-
do_kbd_led_set(&asus->kbd_led, asus->kbd_led_wk + 1);
1780+
kbd_led_set_by_kbd(asus, asus->kbd_led_wk + 1);
17741781
goto exit;
17751782
}
17761783

0 commit comments

Comments
 (0)