diff mbox series

[3/3] platform/x86: panasonic-laptop: Add support for programmable buttons

Message ID 20240903083533.9403-3-hdegoede@redhat.com (mailing list archive)
State Changes Requested, archived
Headers show
Series [1/3] platform/x86: panasonic-laptop: Check minimum SQTY value | expand

Commit Message

Hans de Goede Sept. 3, 2024, 8:35 a.m. UTC
From: James Harmison <jharmison@redhat.com>

Newer panasonic toughbook models have a number of programmable buttons,
add support for these.

Tested-by: James Harmison <jharmison@redhat.com>
Signed-off-by: James Harmison <jharmison@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/platform/x86/panasonic-laptop.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Comments

Ilpo Järvinen Sept. 3, 2024, 10:35 a.m. UTC | #1
On Tue, 3 Sep 2024, Hans de Goede wrote:

> From: James Harmison <jharmison@redhat.com>
> 
> Newer panasonic toughbook models have a number of programmable buttons,
> add support for these.
> 
> Tested-by: James Harmison <jharmison@redhat.com>
> Signed-off-by: James Harmison <jharmison@redhat.com>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/platform/x86/panasonic-laptop.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
> index 4c9e20e1afe8..2070caa1ea1b 100644
> --- a/drivers/platform/x86/panasonic-laptop.c
> +++ b/drivers/platform/x86/panasonic-laptop.c
> @@ -224,6 +224,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 }
>  };
>  
> @@ -811,7 +822,7 @@ static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc)
>  		return;
>  	}
>  
> -	key = result & 0xf;
> +	key = result & 0x7f;

I'd mention this in the commit message. It's kind of different from adding 
just keys.
Andy Shevchenko Sept. 3, 2024, 11:09 a.m. UTC | #2
On Tue, Sep 3, 2024 at 1:35 PM Ilpo Järvinen
<ilpo.jarvinen@linux.intel.com> wrote:
> On Tue, 3 Sep 2024, Hans de Goede wrote:

...

> > -     key = result & 0xf;
> > +     key = result & 0x7f;

Wondering if moving to GENMASK() (and BIT() respectively in other
line(s)) would help reader as well and in commit message to mention
the bit field size(s).

> I'd mention this in the commit message. It's kind of different from adding
> just keys.
diff mbox series

Patch

diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index 4c9e20e1afe8..2070caa1ea1b 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -224,6 +224,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 }
 };
 
@@ -811,7 +822,7 @@  static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc)
 		return;
 	}
 
-	key = result & 0xf;
+	key = result & 0x7f;
 	updown = result & 0x80; /* 0x80 == key down; 0x00 = key up */
 
 	/* hack: some firmware sends no key down for sleep / hibernate */