Skip to content

Commit 2c5cbc9

Browse files
committed
platform/x86: panasonic-laptop: Add support for programmable buttons
JIRA: https://issues.redhat.com/browse/RHEL-55365 commit b522dd7 Author: James Harmison <jharmison@redhat.com> Date: Mon Sep 9 13:32:27 2024 +0200 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 Signed-off-by: David Arcari <darcari@redhat.com>
1 parent 8fdf0df commit 2c5cbc9

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

drivers/platform/x86/panasonic-laptop.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@
121121

122122
#include <linux/acpi.h>
123123
#include <linux/backlight.h>
124+
#include <linux/bits.h>
124125
#include <linux/ctype.h>
125126
#include <linux/i8042.h>
126127
#include <linux/init.h>
@@ -224,6 +225,17 @@ static const struct key_entry panasonic_keymap[] = {
224225
{ KE_KEY, 8, { KEY_PROG1 } }, /* Change CPU boost */
225226
{ KE_KEY, 9, { KEY_BATTERY } },
226227
{ KE_KEY, 10, { KEY_SUSPEND } },
228+
{ KE_KEY, 21, { KEY_MACRO1 } },
229+
{ KE_KEY, 22, { KEY_MACRO2 } },
230+
{ KE_KEY, 24, { KEY_MACRO3 } },
231+
{ KE_KEY, 25, { KEY_MACRO4 } },
232+
{ KE_KEY, 34, { KEY_MACRO5 } },
233+
{ KE_KEY, 35, { KEY_MACRO6 } },
234+
{ KE_KEY, 36, { KEY_MACRO7 } },
235+
{ KE_KEY, 37, { KEY_MACRO8 } },
236+
{ KE_KEY, 41, { KEY_MACRO9 } },
237+
{ KE_KEY, 42, { KEY_MACRO10 } },
238+
{ KE_KEY, 43, { KEY_MACRO11 } },
227239
{ KE_END, 0 }
228240
};
229241

@@ -830,8 +842,8 @@ static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc)
830842
return;
831843
}
832844

833-
key = result & 0xf;
834-
updown = result & 0x80; /* 0x80 == key down; 0x00 = key up */
845+
key = result & GENMASK(6, 0);
846+
updown = result & BIT(7); /* 0x80 == key down; 0x00 = key up */
835847

836848
/* hack: some firmware sends no key down for sleep / hibernate */
837849
if (key == 7 || key == 10) {

0 commit comments

Comments
 (0)