platform/x86: Add GETAC MPMD programmable button driver
PATCH 1/1 platform/x86: Add GETAC MPMD programmable button driver
From: chubukou <[email protected]>
GETAC rugged laptops (e.g. S410) expose vendor button events through an ACPI device "MPMD" with hardware ID MTC0303. The Embedded Controller raises query methods that issue Notify(MPMD, <code>) on programmable / hotkey button activity. Because no Linux driver binds MTC0303, these notifies are silently dropped and the buttons appear dead under Linux (neither libinput nor acpid observe them: they are device notifies, not generic ACPI events).
Add a minimal ACPI driver that binds MTC0303 and forwards the notifies as input events through a sparse-keymap. On the S410 (BIOS R1.25) the programmable P2 button generates Notify(MPMD, 0x97) and is mapped to KEY_PROG1. Other buttons in the 0xC0..0xCB range (EC queries _Q81.._Q89, _Q6A, _Q6B) remain unmapped until confirmed on a given model; enable dynamic-debug to identify them.
--- MAINTAINERS | 6 ++ drivers/platform/x86/Kconfig | 11 ++++ drivers/platform/x86/Makefile | 3 + drivers/platform/x86/getac-mpmd.c | 96 +++++++++++++++++++++++++++++++ 4 files changed, 116 insertions(+) create mode 100644 drivers/platform/x86/getac-mpmd.c
MAINTAINERS +6 -0
@@ -11014,6 +11014,12 @@ F: Documentation/filesystems/gfs2/ F: fs/gfs2/ F: include/uapi/linux/gfs2_ondisk.h +GETAC MPMD DRIVER +M: chubukou <[email protected]> +L: [email protected] +S: Maintained +F: drivers/platform/x86/getac-mpmd.c + GIGABYTE WATERFORCE SENSOR DRIVER M: Aleksa Savic <[email protected]> L: [email protected]
drivers/platform/x86/Kconfig +11 -0
@@ -440,6 +440,17 @@ config FUJITSU_TABLET If you have a Fujitsu convertible or slate, say Y or M here. +config GETAC_MPMD + tristate "GETAC MPMD programmable button support" + depends on ACPI + help + Driver for the GETAC MPMD ACPI device (HID MTC0303) which forwards + Embedded Controller button events (e.g. the programmable P2 button) + as input key events. Without this driver the buttons are silently + dropped and appear dead under Linux. + + Say Y or M if you have a GETAC rugged laptop (e.g. S410). + config GPD_POCKET_FAN tristate "GPD Pocket Fan Controller support" depends on ACPI
drivers/platform/x86/Makefile +3 -0
@@ -57,6 +57,9 @@ obj-$(CONFIG_FUJITSU_TABLET) += fujitsu-tablet.o # GPD obj-$(CONFIG_GPD_POCKET_FAN) += gpd-pocket-fan.o +# GETAC +obj-$(CONFIG_GETAC_MPMD) += getac-mpmd.o + # Hewlett Packard obj-$(CONFIG_X86_PLATFORM_DRIVERS_HP) += hp/
drivers/platform/x86/getac-mpmd.c new file +96 -0
96 lines not on this page · raw message
Signature · 1 line
2.55.0
Ilpo Järvinen
maintainerQuoted 10 lines · Zhan Chubukou
From: chubukou <[email protected]>
GETAC rugged laptops (e.g. S410) expose vendor button events through an ACPI device "MPMD" with hardware ID MTC0303. The Embedded Controller raises query methods that issue
Notify(MPMD, <code>)on programmable / hotkey button activity. Because no Linux driver binds MTC0303, these notifies are silently dropped and the buttons appear dead under Linux (neither libinput nor acpid observe them: they are device notifies, not generic ACPI events).
Quoted 8 lines
Add a minimal ACPI driver that binds MTC0303 and forwards the notifies as input events through a sparse-keymap. On the S410 (BIOS R1.25) the programmable P2 button generates
Notify(MPMD, 0x97)and is mapped toKEY_PROG1. Other buttons in the 0xC0..0xCB range (EC queries _Q81.._Q89,_Q6A,_Q6B) remain unmapped until confirmed on a given model; enable dynamic-debug to identify them.Signed-off-by chubukou <[email protected]>
We need a read name here. For more information, please see Documentation/process/submitting-patches.rst
Quoted 82 lines
--- MAINTAINERS | 6 ++ drivers/platform/x86/Kconfig | 11 ++++ drivers/platform/x86/Makefile | 3 + drivers/platform/x86/getac-mpmd.c | 96 +++++++++++++++++++++++++++++++ 4 files changed, 116 insertions(+) create mode 100644 drivers/platform/x86/getac-mpmd.cMAINTAINERS +6
-0@@ -11014,6 +11014,12 @@ F: Documentation/filesystems/gfs2/ F: fs/gfs2/ F: include/uapi/linux/gfs2_ondisk.h +GETAC MPMD DRIVER +M: chubukou <[email protected]> +L: [email protected] +S: Maintained +F: drivers/platform/x86/getac-mpmd.c + GIGABYTE WATERFORCE SENSOR DRIVER M: Aleksa Savic <[email protected]> L: [email protected]drivers/platform/x86/Kconfig +11
-0@@ -440,6 +440,17 @@ config FUJITSU_TABLET If you have a Fujitsu convertible or slate, say Y or M here. +config GETAC_MPMD + tristate "GETAC MPMD programmable button support" + depends on ACPI + help + Driver for the GETAC MPMD ACPI device (HID MTC0303) which forwards + Embedded Controller button events (e.g. the programmable P2 button) + as input key events. Without this driver the buttons are silently + dropped and appear dead under Linux. + + Say Y or M if you have a GETAC rugged laptop (e.g. S410). + config GPD_POCKET_FAN tristate "GPD Pocket Fan Controller support" depends on ACPIdrivers/platform/x86/Makefile +3
-0@@ -57,6 +57,9 @@ obj-$(CONFIG_FUJITSU_TABLET) += fujitsu-tablet.o # GPD obj-$(CONFIG_GPD_POCKET_FAN) += gpd-pocket-fan.o +# GETAC +obj-$(CONFIG_GETAC_MPMD) += getac-mpmd.o + # Hewlett Packard obj-$(CONFIG_X86_PLATFORM_DRIVERS_HP) += hp/drivers/platform/x86/getac-mpmd.c new file +15
-0@@ -0,0 +1,96 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* GETAC MPMD programmable button driver +* +* GETAC rugged laptops expose vendor events through an ACPI device named +* "MPMD" with hardware ID MTC0303. The Embedded Controller raises query +* methods that Notify(MPMD, <code>) on programmable / hotkey button +* activity. Without a driver bound to MTC0303 these notifies are silently +* dropped, so the buttons appear dead under Linux. +* +* This driver binds MTC0303 and forwards the notifies as input events. +* +* Observed on GETAC S410 (BIOS R1.25.070520): +* 0x97 P2 programmable button (repeats at ~3 Hz while held) +*
drivers/platform/x86/getac-mpmd.c line 25
Quoted 10 lines
drivers/platform/x86/getac-mpmd.c new file +10
-0+* The 0xC0..0xCB range is generated by EC query methods _Q81.._Q89, _Q6A +* and _Q6B and is left as KEY_UNKNOWN until a button is confirmed; enable +* module dynamic-debug to identify further buttons on a given model. +* +* Copyright (C) 2026 chubukou <[email protected]> +*/ + +#include <linux/acpi.h> +#include <linux/input.h> +#include <linux/input/sparse-keymap.h>
You probably need something in Kconfig for these?
Quoted 7 lines
drivers/platform/x86/getac-mpmd.c new file +7
-0+#include <linux/module.h> + +struct getac_mpmd_priv { +struct input_dev *input; +}; + +static const struct key_entry getac_mpmd_keymap[] = {
drivers/platform/x86/getac-mpmd.c line 42
Quoted 10 lines
drivers/platform/x86/getac-mpmd.c new file +10
-0+ { KE_KEY, 0x97, { KEY_PROG1 } }, /* P2 programmable button */ + { KE_END, 0 } +}; + +static void getac_mpmd_notify (struct acpi_device *adev,u32 event) +{ +struct getac_mpmd_priv *priv =acpi_driver_data (adev); + +if (!sparse_keymap_report_event (priv->input, event,1 , true)) +dev_dbg (&adev->dev,"unknown notify event 0x%02x\n" , event);
Add include for dev_dbg()
drivers/platform/x86/getac-mpmd.c line 51
Quoted 9 lines
drivers/platform/x86/getac-mpmd.c new file +9
-0+} + +static int getac_mpmd_add (struct acpi_device *adev) +{ +struct getac_mpmd_priv *priv; +struct input_dev *input; +int ret; + + priv =devm_kzalloc (&adev->dev,sizeof (*priv),GFP_KERNEL );
Please add linux/device.h include for this.
Quoted 11 lines
drivers/platform/x86/getac-mpmd.c new file +11
-0+if (!priv) +return -ENOMEM ; + + input =devm_input_allocate_device (&adev->dev); +if (!input) +return -ENOMEM ; + + input->name ="GETAC MPMD programmable buttons" ; + input->phys ="getac-mpmd/input0" ; + input->id.bustype =BUS_HOST ; +
drivers/platform/x86/getac-mpmd.c line 72
Quoted 10 lines
drivers/platform/x86/getac-mpmd.c new file +10
-0+ ret =sparse_keymap_setup (input, getac_mpmd_keymap,NULL ); +if (ret) +return ret; + + ret =input_register_device (input); +if (ret) +return ret; + + priv->input = input; + adev->driver_data = priv;
Once you've converted to platform_driver (see below), please use the accessor to set drvdata.
drivers/platform/x86/getac-mpmd.c line 82
Quoted 10 lines
drivers/platform/x86/getac-mpmd.c new file +10
-0+return 0 ; +} + +static const struct acpi_device_id getac_mpmd_ids[] = { + {"MTC0303" }, + { } +}; +MODULE_DEVICE_TABLE (acpi, getac_mpmd_ids); + +static struct acpi_driver getac_mpmd_driver = {
Please don't add new acpi_drivers anymore. Rafael is trying to get rid all of them.
Quoted 15 lines
drivers/platform/x86/getac-mpmd.c new file +14
-0+ .name = "getac_mpmd", + .class = "getac", + .ids = getac_mpmd_ids, + .ops = { + .add = getac_mpmd_add, + .notify = getac_mpmd_notify, + }, +}; + +module_acpi_driver (getac_mpmd_driver); + +MODULE_AUTHOR ("chubukou <[email protected]>" ); +MODULE_DESCRIPTION ("GETAC MPMD (MTC0303) programmable button driver" ); +MODULE_LICENSE ("GPL" );
Signature · 1 line
i.