summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJames Harmison <jharmison@redhat.com>2024-09-09 13:32:27 +0200
committerHans de Goede <hdegoede@redhat.com>2024-09-11 14:21:28 +0200
commitb522dd730b9680fdbd525ba2a1e781ccba5b69cb (patch)
treebd664e35f067931dcd2b3cb0dd7d7f11a456ad30 /drivers
parentf80d7100f091e96b54beb32dc6d136520453582f (diff)
downloadlwn-b522dd730b9680fdbd525ba2a1e781ccba5b69cb.tar.gz
lwn-b522dd730b9680fdbd525ba2a1e781ccba5b69cb.zip
platform/x86: panasonic-laptop: Add support for programmable buttons
The value returned by "HINF" contains press/release information in bit 7 and a keycode in bits 0-6. Change the code to retrieve the keycode to use all 7 keycode bits instead of only using bits 0-3 and add mappings for the higher keycodes used by the programmable buttons found on newer panasonic toughbook models. Tested-by: James Harmison <jharmison@redhat.com> Signed-off-by: James Harmison <jharmison@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20240909113227.254470-3-hdegoede@redhat.com
Diffstat (limited to 'drivers')
-rw-r--r--drivers/platform/x86/panasonic-laptop.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index cf845ee1c7b1..1c88636649a1 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -121,6 +121,7 @@
#include <linux/acpi.h>
#include <linux/backlight.h>
+#include <linux/bits.h>
#include <linux/ctype.h>
#include <linux/i8042.h>
#include <linux/init.h>
@@ -224,6 +225,17 @@ static const struct key_entry panasonic_keymap[] = {
{ KE_KEY, 8, { KEY_PROG1 } }, /* Change CPU boost */
{ KE_KEY, 9, { KEY_BATTERY } },
{ KE_KEY, 10, { KEY_SUSPEND } },
+ { KE_KEY, 21, { KEY_MACRO1 } },
+ { KE_KEY, 22, { KEY_MACRO2 } },
+ { KE_KEY, 24, { KEY_MACRO3 } },
+ { KE_KEY, 25, { KEY_MACRO4 } },
+ { KE_KEY, 34, { KEY_MACRO5 } },
+ { KE_KEY, 35, { KEY_MACRO6 } },
+ { KE_KEY, 36, { KEY_MACRO7 } },
+ { KE_KEY, 37, { KEY_MACRO8 } },
+ { KE_KEY, 41, { KEY_MACRO9 } },
+ { KE_KEY, 42, { KEY_MACRO10 } },
+ { KE_KEY, 43, { KEY_MACRO11 } },
{ KE_END, 0 }
};
@@ -810,8 +822,8 @@ static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc)
return;
}
- key = result & 0xf;
- updown = result & 0x80; /* 0x80 == key down; 0x00 = key up */
+ key = result & GENMASK(6, 0);
+ updown = result & BIT(7); /* 0x80 == key down; 0x00 = key up */
/* hack: some firmware sends no key down for sleep / hibernate */
if (key == 7 || key == 10) {