ACPI / video: Fix backlight taking 2 steps on a brightness up/down keypress
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 18 Jul 2014 12:32:51 +0000 (14:32 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 21 Jul 2014 11:43:56 +0000 (13:43 +0200)
commit8ab58e8e7e097bae5fe39cbc67eb93a91f7134b7
tree8fd45f56ceeb1857f9e0baaf0cb7ac0a926ac2a8
parent9a3c4145af32125c5ee39c0272662b47307a8323
ACPI / video: Fix backlight taking 2 steps on a brightness up/down keypress

In various scenarious userspace will respond to brightness up/down keypresses
by increasing/decreasing the backlight brightness itself. If the kernel then
also changes the brightness this results in the brightness having changed 2
steps for a single keypress which is undesirable. See e.g. :

https://bugs.launchpad.net/gnome-settings-daemon/+bug/527157
http://askubuntu.com/questions/173921/why-does-my-thinkpad-brightness-control-skip-steps

This commit delays responding to brightness up/down keypresses by 100 ms and
if userspace in that time responds by changing the backlight itself, cancels
the kernels own handling of these keypresses, fixing the 2 steps issue.

Link: http://marc.info/?l=linux-kernel&m=140535721100839&w=2
[hdegoede@redhat.com: Move the delayed_work struct into struct
 acpi_video_device instead of having it as a global]
[hdegoede@redhat.com: Keep brightness_switch_enabled as a boolean and always
 delay the keypress handling]
Tested-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/video.c