From 0b4e516906ad92ceea27259b98243d60b0bb2770 Mon Sep 17 00:00:00 2001 From: Ondrej Jirman Date: Sat, 29 Oct 2022 00:51:19 +0200 Subject: [PATCH 381/464] input: pinephone-keyboard: Allow to disable Fn layer processing Sometimes it's more flexible to handle Fn key as additional modifier that can be configured from userspace. Signed-off-by: Ondrej Jirman --- drivers/input/keyboard/pinephone-keyboard.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/input/keyboard/pinephone-keyboard.c b/drivers/input/keyboard/pinephone-keyboard.c index 557ead132450..25f569f52523 100644 --- a/drivers/input/keyboard/pinephone-keyboard.c +++ b/drivers/input/keyboard/pinephone-keyboard.c @@ -19,6 +19,10 @@ static bool disable_input; module_param(disable_input, bool, S_IRUGO); MODULE_PARM_DESC(disable_input, "Disable the keyboard part of the driver"); +static bool disable_fn; +module_param(disable_fn, bool, S_IRUGO); +MODULE_PARM_DESC(disable_fn, "Disable the FN layer special handling"); + #define DRV_NAME "pinephone-keyboard" #define PPKB_CRC8_POLYNOMIAL 0x07 @@ -249,6 +253,14 @@ static void ppkb_update(struct i2c_client *client) if (!(changed & mask)) continue; + if (disable_fn) { + /* The FN layer is a second set of rows. */ + code = MATRIX_SCAN_CODE(row, col, row_shift); + input_event(ppkb->input, EV_MSC, MSC_SCAN, code); + input_report_key(ppkb->input, keymap[code], value); + continue; + } + /* * Save off the FN key state when the key was pressed, * and use that to determine the code during a release. -- 2.34.1