Re: [PATCH v9 4/7] input: keyboard: Add driver for ASUS Transformer dock multimedia keys
From: Svyatoslav Ryhel
Date: Tue Jul 14 2026 - 10:08:47 EST
пт, 3 лип. 2026 р. о 11:53 Svyatoslav Ryhel <clamor95@xxxxxxxxx> пише:
>
> чт, 25 черв. 2026 р. о 11:16 Svyatoslav Ryhel <clamor95@xxxxxxxxx> пише:
> >
> > From: Michał Mirosław <mirq-linux@xxxxxxxxxxxx>
> >
> > Add support for multimedia top button row of ASUS Transformer's Mobile
> > Dock keyboard. Driver is made that function keys (F1-F12) are used by
> > default which suits average Linux use better and with pressing
> > ScreenLock + AltGr function keys layout is switched to multimedia keys.
> > Only Dock keyboard input events are tracked for AltGr pressing.
> >
> > Co-developed-by: Ion Agorria <ion@xxxxxxxxxxx>
> > Signed-off-by: Ion Agorria <ion@xxxxxxxxxxx>
> > Signed-off-by: Michał Mirosław <mirq-linux@xxxxxxxxxxxx>
> > Signed-off-by: Svyatoslav Ryhel <clamor95@xxxxxxxxx>
> > ---
> > drivers/input/keyboard/Kconfig | 10 +
> > drivers/input/keyboard/Makefile | 1 +
> > .../input/keyboard/asus-transformer-ec-keys.c | 314 ++++++++++++++++++
> > 3 files changed, 325 insertions(+)
> > create mode 100644 drivers/input/keyboard/asus-transformer-ec-keys.c
> >
> > diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
> > index 9d1019ba0245..913cb4900565 100644
> > --- a/drivers/input/keyboard/Kconfig
> > +++ b/drivers/input/keyboard/Kconfig
> > @@ -89,6 +89,16 @@ config KEYBOARD_APPLESPI
> > To compile this driver as a module, choose M here: the
> > module will be called applespi.
> >
> > +config KEYBOARD_ASUS_TRANSFORMER_EC
> > + tristate "Asus Transformer's Mobile Dock multimedia keys"
> > + depends on MFD_ASUS_TRANSFORMER_EC
> > + help
> > + Say Y here if you want to use multimedia keys present on Asus
> > + Transformer's Mobile Dock.
> > +
> > + To compile this driver as a module, choose M here: the
> > + module will be called asus-transformer-ec-keys.
> > +
> > config KEYBOARD_ATARI
> > tristate "Atari keyboard"
> > depends on ATARI
> > diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
> > index 60bb7baf802f..0d81096887ad 100644
> > --- a/drivers/input/keyboard/Makefile
> > +++ b/drivers/input/keyboard/Makefile
> > @@ -11,6 +11,7 @@ obj-$(CONFIG_KEYBOARD_ADP5585) += adp5585-keys.o
> > obj-$(CONFIG_KEYBOARD_ADP5588) += adp5588-keys.o
> > obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o
> > obj-$(CONFIG_KEYBOARD_APPLESPI) += applespi.o
> > +obj-$(CONFIG_KEYBOARD_ASUS_TRANSFORMER_EC) += asus-transformer-ec-keys.o
> > obj-$(CONFIG_KEYBOARD_ATARI) += atakbd.o
> > obj-$(CONFIG_KEYBOARD_ATKBD) += atkbd.o
> > obj-$(CONFIG_KEYBOARD_BCM) += bcm-keypad.o
> > diff --git a/drivers/input/keyboard/asus-transformer-ec-keys.c b/drivers/input/keyboard/asus-transformer-ec-keys.c
> > new file mode 100644
> > index 000000000000..53aff3ce7146
> > --- /dev/null
> > +++ b/drivers/input/keyboard/asus-transformer-ec-keys.c
> > @@ -0,0 +1,314 @@
> > +// SPDX-License-Identifier: GPL-2.0-or-later
> > +
> > +#include <linux/array_size.h>
> > +#include <linux/err.h>
> > +#include <linux/i2c.h>
> > +#include <linux/input.h>
> > +#include <linux/mfd/asus-transformer-ec.h>
> > +#include <linux/module.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/slab.h>
> > +
> > +#define ASUSEC_EXT_KEY_CODES 0x20
> > +
> > +struct asus_ec_keys_data {
> > + struct notifier_block nb;
> > + struct asusec_core *ec;
> > + struct input_dev *xidev;
> > + struct input_handler input_handler;
> > + unsigned short keymap[ASUSEC_EXT_KEY_CODES * 2];
> > + const char *kbc_phys;
> > + bool special_key_pressed;
> > + bool special_key_mode;
> > +};
> > +
> > +static void asus_ec_input_event(struct input_handle *handle,
> > + unsigned int event_type,
> > + unsigned int event_code, int value)
> > +{
> > + struct asus_ec_keys_data *priv = handle->handler->private;
> > +
> > + /* Store special key state */
> > + if (event_type == EV_KEY && event_code == KEY_RIGHTALT)
> > + priv->special_key_pressed = !!value;
> > +}
> > +
> > +static int asus_ec_input_connect(struct input_handler *handler,
> > + struct input_dev *dev,
> > + const struct input_device_id *id)
> > +{
> > + struct asus_ec_keys_data *priv = handler->private;
> > + struct input_handle *handle;
> > + int error;
> > +
> > + if (!dev->phys || !strstr(dev->phys, priv->kbc_phys))
> > + return -ENODEV;
> > +
>
> Hello Dmitry!
>
> Would this approach be acceptable? Handler links strictly to asus-ec keyboard.
>
Hello Dmitry! May you please take a look? ATM only ACK on input patches left.