Commit 027f8845 authored by Hans de Goede's avatar Hans de Goede

platform/x86: panasonic-laptop: don't report duplicate brightness key-presses

The brightness key-presses might also get reported by the ACPI video bus,
check for this and in this case don't report the presses to avoid reporting
2 presses for a single key-press.

Fixes: ed83c917 ("platform/x86: panasonic-laptop: Resolve hotkey double trigger bug")
Reported-and-tested-by: default avatarStefan Seyfried <seife+kernel@b1-systems.com>
Reported-and-tested-by: default avatarKenneth Chan <kenneth.t.chan@gmail.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220624112340.10130-6-hdegoede@redhat.com
parent cb1f7d49
...@@ -918,6 +918,7 @@ config PANASONIC_LAPTOP ...@@ -918,6 +918,7 @@ config PANASONIC_LAPTOP
tristate "Panasonic Laptop Extras" tristate "Panasonic Laptop Extras"
depends on INPUT && ACPI depends on INPUT && ACPI
depends on BACKLIGHT_CLASS_DEVICE depends on BACKLIGHT_CLASS_DEVICE
depends on ACPI_VIDEO=n || ACPI_VIDEO
select INPUT_SPARSEKMAP select INPUT_SPARSEKMAP
help help
This driver adds support for access to backlight control and hotkeys This driver adds support for access to backlight control and hotkeys
......
...@@ -132,6 +132,7 @@ ...@@ -132,6 +132,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <acpi/video.h>
MODULE_AUTHOR("Hiroshi Miura <miura@da-cha.org>"); MODULE_AUTHOR("Hiroshi Miura <miura@da-cha.org>");
MODULE_AUTHOR("David Bronaugh <dbronaugh@linuxboxen.org>"); MODULE_AUTHOR("David Bronaugh <dbronaugh@linuxboxen.org>");
...@@ -783,6 +784,13 @@ static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc) ...@@ -783,6 +784,13 @@ static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc)
key, 0x80, false); key, 0x80, false);
} }
/*
* Don't report brightness key-presses if they are also reported
* by the ACPI video bus.
*/
if ((key == 1 || key == 2) && acpi_video_handles_brightness_key_presses())
return;
if (!sparse_keymap_report_event(hotk_input_dev, key, updown, false)) if (!sparse_keymap_report_event(hotk_input_dev, key, updown, false))
pr_err("Unknown hotkey event: 0x%04llx\n", result); pr_err("Unknown hotkey event: 0x%04llx\n", result);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment