From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Fabio Baltieri <fabiobaltieri@chromium.org>,
Benson Leung <bleung@chromium.org>,
Guenter Roeck <groeck@chromium.org>,
Simon Glass <sjg@chromium.org>,
linux-input@vger.kernel.org, chrome-platform@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/7] Input: cros_ec_keyb - add function key support
Date: Sun, 22 Feb 2026 18:46:53 +0800 [thread overview]
Message-ID: <aZrencp4ZQnFC9OD@tzungbi-laptop> (raw)
In-Reply-To: <20260222003717.471977-2-dmitry.torokhov@gmail.com>
On Sat, Feb 21, 2026 at 04:37:10PM -0800, Dmitry Torokhov wrote:
> From: Fabio Baltieri <fabiobaltieri@chromium.org>
>
> Add support for handling an Fn button and sending separate keycodes for
> a subset of keys in the matrix defined in the upper half of the keymap.
>
> Signed-off-by: Fabio Baltieri <fabiobaltieri@chromium.org>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Link: https://patch.msgid.link/20260211173421.1206478-3-fabiobaltieri@chromium.org
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
The patch looks good to me, just a few minor nits below. I don't insist on
these being fixed for this patch to be merged,
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
> +static void cros_ec_keyb_process_key_fn_map(struct cros_ec_keyb *ckdev,
> + int row, int col, bool state)
> +{
> + struct input_dev *idev = ckdev->idev;
> + const unsigned short *keycodes = idev->keycode;
> + unsigned int pos, fn_pos;
> + unsigned int code, fn_code;
Nit: does declaring `code` and `fn_code` as unsigned short make more sense?
Or they can be declared in the same line.
> +
> + pos = MATRIX_SCAN_CODE(row, col, ckdev->row_shift);
> + code = keycodes[pos];
> +
> + if (code == KEY_FN) {
> + ckdev->fn_active = state;
> + if (state) {
> + ckdev->fn_combo_active = false;
> + } else if (!ckdev->fn_combo_active) {
> + /*
> + * Send both Fn press and release events if nothing
> + * else has been pressed together with Fn.
> + */
> + cros_ec_emit_fn_key(idev, pos);
> + }
> + return;
> + }
> +
> + fn_pos = MATRIX_SCAN_CODE(row + ckdev->rows, col, ckdev->row_shift);
> + fn_code = keycodes[fn_pos];
> +
> + if (state) {
> + if (ckdev->fn_active) {
> + ckdev->fn_combo_active = true;
> + if (!fn_code)
> + return; /* Discard if no Fn mapping exists */
> +
> + code = fn_code;
> + pos = fn_pos;
Nit: assigning `pos` before `code` makes it neater.
> + }
> + } else {
> + /*
> + * If the Fn-remapped code is currently pressed, release it.
> + * Otherwise, release the standard code (if it was pressed).
> + */
> + if (fn_code && test_bit(fn_code, idev->key)) {
> + code = fn_code;
> + pos = fn_pos;
Nit: same here.
next prev parent reply other threads:[~2026-02-22 10:46 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-22 0:37 [PATCH 1/7] Input: export input_default_setkeycode Dmitry Torokhov
2026-02-22 0:37 ` [PATCH 2/7] Input: cros_ec_keyb - add function key support Dmitry Torokhov
2026-02-22 10:46 ` Tzung-Bi Shih [this message]
2026-02-23 3:47 ` Dmitry Torokhov
2026-02-23 12:24 ` Fabio Baltieri
2026-02-22 0:37 ` [PATCH 3/7] Input: cros_ec_keyb - use u8 instead of uint8_t Dmitry Torokhov
2026-02-22 10:47 ` Tzung-Bi Shih
2026-02-22 0:37 ` [PATCH 4/7] Input: cros_ec_keyb - use BIT() macro instead of open-coding shifts Dmitry Torokhov
2026-02-22 10:47 ` Tzung-Bi Shih
2026-02-22 0:37 ` [PATCH 5/7] Input: cros_ec_keyb - simplify cros_ec_keyb_work() Dmitry Torokhov
2026-02-22 10:47 ` Tzung-Bi Shih
2026-02-23 3:49 ` Dmitry Torokhov
2026-02-23 4:41 ` Tzung-Bi Shih
2026-02-22 0:37 ` [PATCH 6/7] Input: cros_ec_keyb - do not allocate keyboard state separately Dmitry Torokhov
2026-02-22 10:48 ` Tzung-Bi Shih
2026-02-22 0:37 ` [PATCH 7/7] Input: cros_ec_keyb - factor out column processing Dmitry Torokhov
2026-02-22 10:48 ` Tzung-Bi Shih
2026-02-23 3:51 ` Dmitry Torokhov
2026-02-23 4:40 ` Tzung-Bi Shih
2026-02-22 10:46 ` [PATCH 1/7] Input: export input_default_setkeycode Tzung-Bi Shih
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aZrencp4ZQnFC9OD@tzungbi-laptop \
--to=tzungbi@kernel.org \
--cc=bleung@chromium.org \
--cc=chrome-platform@lists.linux.dev \
--cc=dmitry.torokhov@gmail.com \
--cc=fabiobaltieri@chromium.org \
--cc=groeck@chromium.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sjg@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox