[PATCH] platform/x86: fujitsu-laptop: Support Lifebook S2110 hotkeys

Valtteri Koskivuori posted 1 patch 7 months, 1 week ago
drivers/platform/x86/fujitsu-laptop.c | 33 +++++++++++++++++++++++----
1 file changed, 29 insertions(+), 4 deletions(-)
[PATCH] platform/x86: fujitsu-laptop: Support Lifebook S2110 hotkeys
Posted by Valtteri Koskivuori 7 months, 1 week ago
The S2110 has an additional set of media playback control keys enabled
by a hardware toggle button that switches the keys between "Application"
and "Player" modes. Toggling "Player" mode just shifts the scancode of
each hotkey up by 4.

Add defines for new scancodes, and a keymap and dmi id for the S2110.

Tested on a Fujitsu Lifebook S2110.

Signed-off-by: Valtteri Koskivuori <vkoskiv@gmail.com>
---
 drivers/platform/x86/fujitsu-laptop.c | 33 +++++++++++++++++++++++----
 1 file changed, 29 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
index a0eae24ca9e6..162809140f68 100644
--- a/drivers/platform/x86/fujitsu-laptop.c
+++ b/drivers/platform/x86/fujitsu-laptop.c
@@ -17,13 +17,13 @@
 /*
  * fujitsu-laptop.c - Fujitsu laptop support, providing access to additional
  * features made available on a range of Fujitsu laptops including the
- * P2xxx/P5xxx/S6xxx/S7xxx series.
+ * P2xxx/P5xxx/S2xxx/S6xxx/S7xxx series.
  *
  * This driver implements a vendor-specific backlight control interface for
  * Fujitsu laptops and provides support for hotkeys present on certain Fujitsu
  * laptops.
  *
- * This driver has been tested on a Fujitsu Lifebook S6410, S7020 and
+ * This driver has been tested on a Fujitsu Lifebook S2110, S6410, S7020 and
  * P8010.  It should work on most P-series and S-series Lifebooks, but
  * YMMV.
  *
@@ -107,7 +107,11 @@
 #define KEY2_CODE			0x411
 #define KEY3_CODE			0x412
 #define KEY4_CODE			0x413
-#define KEY5_CODE			0x420
+#define KEY5_CODE			0x414
+#define KEY6_CODE			0x415
+#define KEY7_CODE			0x416
+#define KEY8_CODE			0x417
+#define KEY9_CODE			0x420
 
 /* Hotkey ringbuffer limits */
 #define MAX_HOTKEY_RINGBUFFER_SIZE	100
@@ -560,7 +564,7 @@ static const struct key_entry keymap_default[] = {
 	{ KE_KEY, KEY2_CODE,            { KEY_PROG2 } },
 	{ KE_KEY, KEY3_CODE,            { KEY_PROG3 } },
 	{ KE_KEY, KEY4_CODE,            { KEY_PROG4 } },
-	{ KE_KEY, KEY5_CODE,            { KEY_RFKILL } },
+	{ KE_KEY, KEY9_CODE,            { KEY_RFKILL } },
 	/* Soft keys read from status flags */
 	{ KE_KEY, FLAG_RFKILL,          { KEY_RFKILL } },
 	{ KE_KEY, FLAG_TOUCHPAD_TOGGLE, { KEY_TOUCHPAD_TOGGLE } },
@@ -584,6 +588,18 @@ static const struct key_entry keymap_p8010[] = {
 	{ KE_END, 0 }
 };
 
+static const struct key_entry keymap_s2110[] = {
+	{ KE_KEY, KEY1_CODE, { KEY_PROG1 } }, /* "A" */
+	{ KE_KEY, KEY2_CODE, { KEY_PROG2 } }, /* "B" */
+	{ KE_KEY, KEY3_CODE, { KEY_WWW } },   /* "Internet" */
+	{ KE_KEY, KEY4_CODE, { KEY_EMAIL } }, /* "E-mail" */
+	{ KE_KEY, KEY5_CODE, { KEY_STOPCD } },
+	{ KE_KEY, KEY6_CODE, { KEY_PLAYPAUSE } },
+	{ KE_KEY, KEY7_CODE, { KEY_PREVIOUSSONG } },
+	{ KE_KEY, KEY8_CODE, { KEY_NEXTSONG } },
+	{ KE_END, 0 }
+};
+
 static const struct key_entry *keymap = keymap_default;
 
 static int fujitsu_laptop_dmi_keymap_override(const struct dmi_system_id *id)
@@ -621,6 +637,15 @@ static const struct dmi_system_id fujitsu_laptop_dmi_table[] = {
 		},
 		.driver_data = (void *)keymap_p8010
 	},
+	{
+		.callback = fujitsu_laptop_dmi_keymap_override,
+		.ident = "Fujitsu LifeBook S2110",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK S2110"),
+		},
+		.driver_data = (void *)keymap_s2110
+	},
 	{}
 };
 
-- 
2.49.0
Re: [PATCH] platform/x86: fujitsu-laptop: Support Lifebook S2110 hotkeys
Posted by Ilpo Järvinen 7 months ago
On Fri, 09 May 2025 21:42:49 +0300, Valtteri Koskivuori wrote:

> The S2110 has an additional set of media playback control keys enabled
> by a hardware toggle button that switches the keys between "Application"
> and "Player" modes. Toggling "Player" mode just shifts the scancode of
> each hotkey up by 4.
> 
> Add defines for new scancodes, and a keymap and dmi id for the S2110.
> 
> [...]


Thank you for your contribution, it has been applied to my local
review-ilpo-fixes branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-fixes branch only once I've pushed my
local branch there, which might take a while.

The list of commits applied:
[1/1] platform/x86: fujitsu-laptop: Support Lifebook S2110 hotkeys
      commit: a7e255ff9fe4d9b8b902023aaf5b7a673786bb50

--
 i.
Re: [PATCH] platform/x86: fujitsu-laptop: Support Lifebook S2110 hotkeys
Posted by Jonathan Woithe 7 months, 1 week ago
On Fri, May 09, 2025 at 09:42:49PM +0300, Valtteri Koskivuori wrote:
> The S2110 has an additional set of media playback control keys enabled
> by a hardware toggle button that switches the keys between "Application"
> and "Player" modes. Toggling "Player" mode just shifts the scancode of
> each hotkey up by 4.
> 
> Add defines for new scancodes, and a keymap and dmi id for the S2110.
> 
> Tested on a Fujitsu Lifebook S2110.
> 
> Signed-off-by: Valtteri Koskivuori <vkoskiv@gmail.com>

These additions look fine to me.

Acked-by: Jonathan Woithe <jwoithe@just42.net>

> ---
>  drivers/platform/x86/fujitsu-laptop.c | 33 +++++++++++++++++++++++----
>  1 file changed, 29 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
> index a0eae24ca9e6..162809140f68 100644
> --- a/drivers/platform/x86/fujitsu-laptop.c
> +++ b/drivers/platform/x86/fujitsu-laptop.c
> @@ -17,13 +17,13 @@
>  /*
>   * fujitsu-laptop.c - Fujitsu laptop support, providing access to additional
>   * features made available on a range of Fujitsu laptops including the
> - * P2xxx/P5xxx/S6xxx/S7xxx series.
> + * P2xxx/P5xxx/S2xxx/S6xxx/S7xxx series.
>   *
>   * This driver implements a vendor-specific backlight control interface for
>   * Fujitsu laptops and provides support for hotkeys present on certain Fujitsu
>   * laptops.
>   *
> - * This driver has been tested on a Fujitsu Lifebook S6410, S7020 and
> + * This driver has been tested on a Fujitsu Lifebook S2110, S6410, S7020 and
>   * P8010.  It should work on most P-series and S-series Lifebooks, but
>   * YMMV.
>   *
> @@ -107,7 +107,11 @@
>  #define KEY2_CODE			0x411
>  #define KEY3_CODE			0x412
>  #define KEY4_CODE			0x413
> -#define KEY5_CODE			0x420
> +#define KEY5_CODE			0x414
> +#define KEY6_CODE			0x415
> +#define KEY7_CODE			0x416
> +#define KEY8_CODE			0x417
> +#define KEY9_CODE			0x420
>  
>  /* Hotkey ringbuffer limits */
>  #define MAX_HOTKEY_RINGBUFFER_SIZE	100
> @@ -560,7 +564,7 @@ static const struct key_entry keymap_default[] = {
>  	{ KE_KEY, KEY2_CODE,            { KEY_PROG2 } },
>  	{ KE_KEY, KEY3_CODE,            { KEY_PROG3 } },
>  	{ KE_KEY, KEY4_CODE,            { KEY_PROG4 } },
> -	{ KE_KEY, KEY5_CODE,            { KEY_RFKILL } },
> +	{ KE_KEY, KEY9_CODE,            { KEY_RFKILL } },
>  	/* Soft keys read from status flags */
>  	{ KE_KEY, FLAG_RFKILL,          { KEY_RFKILL } },
>  	{ KE_KEY, FLAG_TOUCHPAD_TOGGLE, { KEY_TOUCHPAD_TOGGLE } },
> @@ -584,6 +588,18 @@ static const struct key_entry keymap_p8010[] = {
>  	{ KE_END, 0 }
>  };
>  
> +static const struct key_entry keymap_s2110[] = {
> +	{ KE_KEY, KEY1_CODE, { KEY_PROG1 } }, /* "A" */
> +	{ KE_KEY, KEY2_CODE, { KEY_PROG2 } }, /* "B" */
> +	{ KE_KEY, KEY3_CODE, { KEY_WWW } },   /* "Internet" */
> +	{ KE_KEY, KEY4_CODE, { KEY_EMAIL } }, /* "E-mail" */
> +	{ KE_KEY, KEY5_CODE, { KEY_STOPCD } },
> +	{ KE_KEY, KEY6_CODE, { KEY_PLAYPAUSE } },
> +	{ KE_KEY, KEY7_CODE, { KEY_PREVIOUSSONG } },
> +	{ KE_KEY, KEY8_CODE, { KEY_NEXTSONG } },
> +	{ KE_END, 0 }
> +};
> +
>  static const struct key_entry *keymap = keymap_default;
>  
>  static int fujitsu_laptop_dmi_keymap_override(const struct dmi_system_id *id)
> @@ -621,6 +637,15 @@ static const struct dmi_system_id fujitsu_laptop_dmi_table[] = {
>  		},
>  		.driver_data = (void *)keymap_p8010
>  	},
> +	{
> +		.callback = fujitsu_laptop_dmi_keymap_override,
> +		.ident = "Fujitsu LifeBook S2110",
> +		.matches = {
> +			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
> +			DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK S2110"),
> +		},
> +		.driver_data = (void *)keymap_s2110
> +	},
>  	{}
>  };
>  
> -- 
> 2.49.0

--