ACPI / video: Fix backlight taking 2 steps on a brightness up/down keypress
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
[9fa1be1a5b5729e4c6b404f34c9ce49ff4882fd8@redhat.com: Move the delayed_work struct into struct
 acpi_video_device instead of having it as a global]
[9fa1be1a5b5729e4c6b404f34c9ce49ff4882fd8@redhat.com: Keep brightness_switch_enabled as a boolean and always
 delay the keypress handling]
Tested-by: Hans de Goede <9fa1be1a5b5729e4c6b404f34c9ce49ff4882fd8@redhat.com>
Tested-by: Bjørn Mork <8a2957e0063f2abf61bd145b6236a74a3708ac54@mork.no>
Signed-off-by: Hans de Goede <9fa1be1a5b5729e4c6b404f34c9ce49ff4882fd8@redhat.com>
Signed-off-by: Rafael J. Wysocki <27ffc44a8ec6a212fba98cfc3246c6ce8ab131e0@intel.com>

KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs