linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Input: cros_ec_keyb: add function key support
@ 2025-12-24 15:22 Fabio Baltieri
  2025-12-24 15:22 ` [PATCH v2 1/2] Input: cros_ec_keyb - " Fabio Baltieri
  2025-12-24 15:22 ` [PATCH v2 2/2] dt-bindings: google,cros-ec-keyb: add use-fn-overlay prop Fabio Baltieri
  0 siblings, 2 replies; 14+ messages in thread
From: Fabio Baltieri @ 2025-12-24 15:22 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Benson Leung, Guenter Roeck
  Cc: Fabio Baltieri, Tzung-Bi Shih, Simon Glass, linux-input,
	devicetree, chrome-platform, linux-kernel

Hi, v2 of the cros-ec-keyb fn key support, reworked the whole
configuration to use an overlay map doubling the row key size as
suggested and handled other comments.

Changes from v1:
  - change struct to short types
  - refactored the fn key handling in its own function
  - changed props to use the google, prefix
  - reworked the properties to use an overlay map rather than a
    dedicated one

Fabio Baltieri (2):
  Input: cros_ec_keyb - add function key support
  dt-bindings: google,cros-ec-keyb: add use-fn-overlay prop

 .../bindings/input/google,cros-ec-keyb.yaml   |  25 ++++
 drivers/input/keyboard/cros_ec_keyb.c         | 120 +++++++++++++++---
 2 files changed, 129 insertions(+), 16 deletions(-)

-- 
2.52.0.351.gbe84eed79e-goog


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v2 1/2] Input: cros_ec_keyb - add function key support
  2025-12-24 15:22 [PATCH v2 0/2] Input: cros_ec_keyb: add function key support Fabio Baltieri
@ 2025-12-24 15:22 ` Fabio Baltieri
  2025-12-27 14:24   ` Simon Glass
  2025-12-24 15:22 ` [PATCH v2 2/2] dt-bindings: google,cros-ec-keyb: add use-fn-overlay prop Fabio Baltieri
  1 sibling, 1 reply; 14+ messages in thread
From: Fabio Baltieri @ 2025-12-24 15:22 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Benson Leung, Guenter Roeck
  Cc: Fabio Baltieri, Tzung-Bi Shih, Simon Glass, linux-input,
	devicetree, chrome-platform, linux-kernel

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>
---
 drivers/input/keyboard/cros_ec_keyb.c | 120 ++++++++++++++++++++++----
 1 file changed, 104 insertions(+), 16 deletions(-)

diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c
index 1c6b0461dc35..8b95b4f8a37d 100644
--- a/drivers/input/keyboard/cros_ec_keyb.c
+++ b/drivers/input/keyboard/cros_ec_keyb.c
@@ -29,6 +29,11 @@
 
 #include <linux/unaligned.h>
 
+/* Maximum size of the normal key matrix, this is limited by the host command
+ * key_matrix field defined in ec_response_get_next_data_v3
+ */
+#define CROS_EC_KEYBOARD_COLS_MAX 18
+
 /**
  * struct cros_ec_keyb - Structure representing EC keyboard device
  *
@@ -44,6 +49,11 @@
  * @bs_idev: The input device for non-matrix buttons and switches (or NULL).
  * @notifier: interrupt event notifier for transport devices
  * @vdata: vivaldi function row data
+ * @use_fn_overlay: whether the driver use an fn function overlay
+ * @normal_key_status: active normal keys map
+ * @fn_key_status: active function keys map
+ * @fn_key_pressed: tracks the function key status
+ * @fn_key_triggered: tracks where any function key fired
  */
 struct cros_ec_keyb {
 	unsigned int rows;
@@ -61,6 +71,12 @@ struct cros_ec_keyb {
 	struct notifier_block notifier;
 
 	struct vivaldi_data vdata;
+
+	bool use_fn_overlay;
+	u8 normal_key_status[CROS_EC_KEYBOARD_COLS_MAX];
+	u8 fn_key_status[CROS_EC_KEYBOARD_COLS_MAX];
+	bool fn_key_pressed;
+	bool fn_key_triggered;
 };
 
 /**
@@ -166,16 +182,83 @@ static bool cros_ec_keyb_has_ghosting(struct cros_ec_keyb *ckdev, uint8_t *buf)
 	return false;
 }
 
+static void cros_ec_keyb_process_fn_key(struct cros_ec_keyb *ckdev,
+					int row, int col, bool state)
+{
+	struct input_dev *idev = ckdev->idev;
+	int pos = MATRIX_SCAN_CODE(row, col, ckdev->row_shift);
+
+	ckdev->fn_key_pressed = state;
+
+	if (state) {
+		ckdev->fn_key_triggered = false;
+	} else if (!ckdev->fn_key_triggered) {
+		/*
+		 * Send the original code if nothing else has been pressed
+		 * together with Fn.
+		 */
+		input_event(idev, EV_MSC, MSC_SCAN, pos);
+		input_report_key(idev, KEY_FN, true);
+		input_sync(idev);
+
+		input_event(idev, EV_MSC, MSC_SCAN, pos);
+		input_report_key(idev, KEY_FN, false);
+	}
+}
+
+static void cros_ec_keyb_process_one(struct cros_ec_keyb *ckdev,
+				     int row, int col, bool state)
+{
+	struct input_dev *idev = ckdev->idev;
+	const unsigned short *keycodes = idev->keycode;
+	int pos = MATRIX_SCAN_CODE(row, col, ckdev->row_shift);
+	unsigned int code = keycodes[pos];
+
+	dev_dbg(ckdev->dev, "changed: [r%d c%d]: byte %02x\n", row, col, state);
+
+	if (ckdev->use_fn_overlay) {
+		if (code == KEY_FN)
+			return cros_ec_keyb_process_fn_key(ckdev, row, col, state);
+
+		if (!state) {
+			if (ckdev->fn_key_status[col] & BIT(row)) {
+				pos = MATRIX_SCAN_CODE(row + ckdev->rows, col, ckdev->row_shift);
+				code = keycodes[pos];
+
+				ckdev->fn_key_status[col] &= ~BIT(row);
+			} else if (ckdev->normal_key_status[col] & BIT(row)) {
+				ckdev->normal_key_status[col] &= ~BIT(row);
+			} else {
+				/* Discard, key press code was not sent */
+				return;
+			}
+		} else if (ckdev->fn_key_pressed) {
+			pos = MATRIX_SCAN_CODE(row + ckdev->rows, col, ckdev->row_shift);
+			code = keycodes[pos];
+
+			ckdev->fn_key_triggered = true;
+
+			if (!code)
+				return;
+
+			ckdev->fn_key_status[col] |= BIT(row);
+		} else {
+			ckdev->normal_key_status[col] |= BIT(row);
+		}
+	}
+
+	input_event(idev, EV_MSC, MSC_SCAN, pos);
+	input_report_key(idev, code, state);
+}
 
 /*
  * Compares the new keyboard state to the old one and produces key
- * press/release events accordingly.  The keyboard state is 13 bytes (one byte
- * per column)
+ * press/release events accordingly.  The keyboard state is one byte
+ * per column.
  */
 static void cros_ec_keyb_process(struct cros_ec_keyb *ckdev,
 			 uint8_t *kb_state, int len)
 {
-	struct input_dev *idev = ckdev->idev;
 	int col, row;
 	int new_state;
 	int old_state;
@@ -192,20 +275,13 @@ static void cros_ec_keyb_process(struct cros_ec_keyb *ckdev,
 
 	for (col = 0; col < ckdev->cols; col++) {
 		for (row = 0; row < ckdev->rows; row++) {
-			int pos = MATRIX_SCAN_CODE(row, col, ckdev->row_shift);
-			const unsigned short *keycodes = idev->keycode;
-
 			new_state = kb_state[col] & (1 << row);
 			old_state = ckdev->old_kb_state[col] & (1 << row);
-			if (new_state != old_state) {
-				dev_dbg(ckdev->dev,
-					"changed: [r%d c%d]: byte %02x\n",
-					row, col, new_state);
-
-				input_event(idev, EV_MSC, MSC_SCAN, pos);
-				input_report_key(idev, keycodes[pos],
-						 new_state);
-			}
+
+			if (new_state == old_state)
+				continue;
+
+			cros_ec_keyb_process_one(ckdev, row, col, new_state);
 		}
 		ckdev->old_kb_state[col] = kb_state[col];
 	}
@@ -597,12 +673,19 @@ static int cros_ec_keyb_register_matrix(struct cros_ec_keyb *ckdev)
 	struct device *dev = ckdev->dev;
 	struct input_dev *idev;
 	const char *phys;
+	unsigned int rows_keymap;
 	int err;
 
 	err = matrix_keypad_parse_properties(dev, &ckdev->rows, &ckdev->cols);
 	if (err)
 		return err;
 
+	if (ckdev->cols > CROS_EC_KEYBOARD_COLS_MAX) {
+		dev_err(dev, "keypad,num-columns too large: %d (max: %d)\n",
+			ckdev->cols, CROS_EC_KEYBOARD_COLS_MAX);
+		return -EINVAL;
+	}
+
 	ckdev->valid_keys = devm_kzalloc(dev, ckdev->cols, GFP_KERNEL);
 	if (!ckdev->valid_keys)
 		return -ENOMEM;
@@ -635,7 +718,12 @@ static int cros_ec_keyb_register_matrix(struct cros_ec_keyb *ckdev)
 	ckdev->ghost_filter = device_property_read_bool(dev,
 					"google,needs-ghost-filter");
 
-	err = matrix_keypad_build_keymap(NULL, NULL, ckdev->rows, ckdev->cols,
+	ckdev->use_fn_overlay = device_property_read_bool(dev,
+					"google,use-fn-overlay");
+
+	rows_keymap = ckdev->use_fn_overlay ? ckdev->rows * 2 : ckdev->rows;
+
+	err = matrix_keypad_build_keymap(NULL, NULL, rows_keymap, ckdev->cols,
 					 NULL, idev);
 	if (err) {
 		dev_err(dev, "cannot build key matrix\n");
-- 
2.52.0.351.gbe84eed79e-goog


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 2/2] dt-bindings: google,cros-ec-keyb: add use-fn-overlay prop
  2025-12-24 15:22 [PATCH v2 0/2] Input: cros_ec_keyb: add function key support Fabio Baltieri
  2025-12-24 15:22 ` [PATCH v2 1/2] Input: cros_ec_keyb - " Fabio Baltieri
@ 2025-12-24 15:22 ` Fabio Baltieri
  2025-12-27 12:44   ` Krzysztof Kozlowski
  2025-12-27 12:44   ` Krzysztof Kozlowski
  1 sibling, 2 replies; 14+ messages in thread
From: Fabio Baltieri @ 2025-12-24 15:22 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Benson Leung, Guenter Roeck
  Cc: Fabio Baltieri, Tzung-Bi Shih, Simon Glass, linux-input,
	devicetree, chrome-platform, linux-kernel

Add binding documentation for the use-fn-overlay property.

Signed-off-by: Fabio Baltieri <fabiobaltieri@chromium.org>
---
 .../bindings/input/google,cros-ec-keyb.yaml   | 25 +++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml b/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
index fefaaf46a240..437575cdf352 100644
--- a/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
+++ b/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
@@ -44,6 +44,14 @@ properties:
       where the lower 16 bits are reserved. This property is specified only
       when the keyboard has a custom design for the top row keys.
 
+  google,use-fn-overlay:
+    description: |
+      Use a function key overlay. This allows defining an extra set of codes
+      that are sent if a key is pressed while the KEY_FN is held pressed as
+      well. The function codes have to be defined in the linux,keymap property
+      with an offset of keypad,num-rows from the normal ones.
+    type: boolean
+
 dependencies:
   function-row-physmap: [ 'linux,keymap' ]
   google,needs-ghost-filter: [ 'linux,keymap' ]
@@ -132,6 +140,23 @@ examples:
             /* UP      LEFT    */
             0x070b0067 0x070c0069>;
     };
+  - |
+    /* With function keys */
+    #include <dt-bindings/input/input.h>
+    keyboard-controller {
+        compatible = "google,cros-ec-keyb";
+        keypad,num-rows = <8>;
+        keypad,num-columns = <18>;
+        google,use-fn-overlay;
+        linux,keymap = <
+            MATRIX_KEY(0x00, 0x00, KEY_FN)
+            MATRIX_KEY(0x01, 0x00, KEY_1)
+            MATRIX_KEY(0x02, 0x00, KEY_2)
+
+            MATRIX_KEY(8 + 0x01, 0x00, KEY_F1)
+            MATRIX_KEY(8 + 0x02, 0x00, KEY_F2)
+        >;
+    };
   - |
     /* No matrix keyboard, just buttons/switches */
     keyboard-controller {
-- 
2.52.0.351.gbe84eed79e-goog


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 2/2] dt-bindings: google,cros-ec-keyb: add use-fn-overlay prop
  2025-12-24 15:22 ` [PATCH v2 2/2] dt-bindings: google,cros-ec-keyb: add use-fn-overlay prop Fabio Baltieri
@ 2025-12-27 12:44   ` Krzysztof Kozlowski
  2025-12-27 15:48     ` Fabio Baltieri
  2025-12-27 12:44   ` Krzysztof Kozlowski
  1 sibling, 1 reply; 14+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-27 12:44 UTC (permalink / raw)
  To: Fabio Baltieri
  Cc: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Benson Leung, Guenter Roeck, Tzung-Bi Shih, Simon Glass,
	linux-input, devicetree, chrome-platform, linux-kernel

On Wed, Dec 24, 2025 at 03:22:38PM +0000, Fabio Baltieri wrote:
> Add binding documentation for the use-fn-overlay property.
> 
> Signed-off-by: Fabio Baltieri <fabiobaltieri@chromium.org>
> ---
>  .../bindings/input/google,cros-ec-keyb.yaml   | 25 +++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml b/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
> index fefaaf46a240..437575cdf352 100644
> --- a/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
> +++ b/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
> @@ -44,6 +44,14 @@ properties:
>        where the lower 16 bits are reserved. This property is specified only
>        when the keyboard has a custom design for the top row keys.
>  
> +  google,use-fn-overlay:
> +    description: |
> +      Use a function key overlay. This allows defining an extra set of codes

What is a function key overlay? Overlays are DT term and therefore are
not suitable for bindings.

> +      that are sent if a key is pressed while the KEY_FN is held pressed as
> +      well. The function codes have to be defined in the linux,keymap property
> +      with an offset of keypad,num-rows from the normal ones.
> +    type: boolean
> +
>  dependencies:
>    function-row-physmap: [ 'linux,keymap' ]
>    google,needs-ghost-filter: [ 'linux,keymap' ]
> @@ -132,6 +140,23 @@ examples:
>              /* UP      LEFT    */
>              0x070b0067 0x070c0069>;
>      };
> +  - |
> +    /* With function keys */
> +    #include <dt-bindings/input/input.h>
> +    keyboard-controller {
> +        compatible = "google,cros-ec-keyb";
> +        keypad,num-rows = <8>;
> +        keypad,num-columns = <18>;
> +        google,use-fn-overlay;

Difference in one property does not justify new example.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 2/2] dt-bindings: google,cros-ec-keyb: add use-fn-overlay prop
  2025-12-24 15:22 ` [PATCH v2 2/2] dt-bindings: google,cros-ec-keyb: add use-fn-overlay prop Fabio Baltieri
  2025-12-27 12:44   ` Krzysztof Kozlowski
@ 2025-12-27 12:44   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-27 12:44 UTC (permalink / raw)
  To: Fabio Baltieri
  Cc: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Benson Leung, Guenter Roeck, Tzung-Bi Shih, Simon Glass,
	linux-input, devicetree, chrome-platform, linux-kernel

On Wed, Dec 24, 2025 at 03:22:38PM +0000, Fabio Baltieri wrote:
> Add binding documentation for the use-fn-overlay property.
> 
> Signed-off-by: Fabio Baltieri <fabiobaltieri@chromium.org>
> ---

Please organize the patch documenting the compatible (DT bindings)
before the patch using that compatible.
See also: https://elixir.bootlin.com/linux/v6.14-rc6/source/Documentation/devicetree/bindings/submitting-patches.rst#L46

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 1/2] Input: cros_ec_keyb - add function key support
  2025-12-24 15:22 ` [PATCH v2 1/2] Input: cros_ec_keyb - " Fabio Baltieri
@ 2025-12-27 14:24   ` Simon Glass
  2025-12-29 16:28     ` Fabio Baltieri
  0 siblings, 1 reply; 14+ messages in thread
From: Simon Glass @ 2025-12-27 14:24 UTC (permalink / raw)
  To: Fabio Baltieri
  Cc: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Benson Leung, Guenter Roeck, Tzung-Bi Shih, linux-input,
	devicetree, chrome-platform, linux-kernel

Hi Fabio,

On Wed, 24 Dec 2025 at 08:22, Fabio Baltieri <fabiobaltieri@chromium.org> wrote:
>
> 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>
> ---
>  drivers/input/keyboard/cros_ec_keyb.c | 120 ++++++++++++++++++++++----
>  1 file changed, 104 insertions(+), 16 deletions(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

I suggest a function comment for the two new functions you add.

> diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c
> index 1c6b0461dc35..8b95b4f8a37d 100644
> --- a/drivers/input/keyboard/cros_ec_keyb.c
> +++ b/drivers/input/keyboard/cros_ec_keyb.c
> @@ -29,6 +29,11 @@
>
>  #include <linux/unaligned.h>
>
> +/* Maximum size of the normal key matrix, this is limited by the host command
> + * key_matrix field defined in ec_response_get_next_data_v3
> + */
> +#define CROS_EC_KEYBOARD_COLS_MAX 18
> +
>  /**
>   * struct cros_ec_keyb - Structure representing EC keyboard device
>   *
> @@ -44,6 +49,11 @@
>   * @bs_idev: The input device for non-matrix buttons and switches (or NULL).
>   * @notifier: interrupt event notifier for transport devices
>   * @vdata: vivaldi function row data
> + * @use_fn_overlay: whether the driver use an fn function overlay
> + * @normal_key_status: active normal keys map
> + * @fn_key_status: active function keys map
> + * @fn_key_pressed: tracks the function key status
> + * @fn_key_triggered: tracks where any function key fired
>   */
>  struct cros_ec_keyb {
>         unsigned int rows;
> @@ -61,6 +71,12 @@ struct cros_ec_keyb {
>         struct notifier_block notifier;
>
>         struct vivaldi_data vdata;
> +
> +       bool use_fn_overlay;
> +       u8 normal_key_status[CROS_EC_KEYBOARD_COLS_MAX];
> +       u8 fn_key_status[CROS_EC_KEYBOARD_COLS_MAX];
> +       bool fn_key_pressed;
> +       bool fn_key_triggered;
>  };
>
>  /**
> @@ -166,16 +182,83 @@ static bool cros_ec_keyb_has_ghosting(struct cros_ec_keyb *ckdev, uint8_t *buf)
>         return false;
>  }
>
> +static void cros_ec_keyb_process_fn_key(struct cros_ec_keyb *ckdev,
> +                                       int row, int col, bool state)
> +{
> +       struct input_dev *idev = ckdev->idev;
> +       int pos = MATRIX_SCAN_CODE(row, col, ckdev->row_shift);
> +
> +       ckdev->fn_key_pressed = state;
> +
> +       if (state) {
> +               ckdev->fn_key_triggered = false;
> +       } else if (!ckdev->fn_key_triggered) {
> +               /*
> +                * Send the original code if nothing else has been pressed
> +                * together with Fn.
> +                */
> +               input_event(idev, EV_MSC, MSC_SCAN, pos);
> +               input_report_key(idev, KEY_FN, true);
> +               input_sync(idev);
> +
> +               input_event(idev, EV_MSC, MSC_SCAN, pos);
> +               input_report_key(idev, KEY_FN, false);
> +       }
> +}
> +
> +static void cros_ec_keyb_process_one(struct cros_ec_keyb *ckdev,
> +                                    int row, int col, bool state)
> +{
> +       struct input_dev *idev = ckdev->idev;
> +       const unsigned short *keycodes = idev->keycode;
> +       int pos = MATRIX_SCAN_CODE(row, col, ckdev->row_shift);
> +       unsigned int code = keycodes[pos];
> +
> +       dev_dbg(ckdev->dev, "changed: [r%d c%d]: byte %02x\n", row, col, state);
> +
> +       if (ckdev->use_fn_overlay) {
> +               if (code == KEY_FN)
> +                       return cros_ec_keyb_process_fn_key(ckdev, row, col, state);
> +
> +               if (!state) {
> +                       if (ckdev->fn_key_status[col] & BIT(row)) {
> +                               pos = MATRIX_SCAN_CODE(row + ckdev->rows, col, ckdev->row_shift);
> +                               code = keycodes[pos];

You might want a helper to do this as it is repeated below

> +
> +                               ckdev->fn_key_status[col] &= ~BIT(row);
> +                       } else if (ckdev->normal_key_status[col] & BIT(row)) {
> +                               ckdev->normal_key_status[col] &= ~BIT(row);
> +                       } else {
> +                               /* Discard, key press code was not sent */
> +                               return;
> +                       }
> +               } else if (ckdev->fn_key_pressed) {
> +                       pos = MATRIX_SCAN_CODE(row + ckdev->rows, col, ckdev->row_shift);
> +                       code = keycodes[pos];
> +
> +                       ckdev->fn_key_triggered = true;
> +
> +                       if (!code)
> +                               return;
> +
> +                       ckdev->fn_key_status[col] |= BIT(row);
> +               } else {
> +                       ckdev->normal_key_status[col] |= BIT(row);
> +               }
> +       }
> +
> +       input_event(idev, EV_MSC, MSC_SCAN, pos);
> +       input_report_key(idev, code, state);
> +}
>
>  /*
>   * Compares the new keyboard state to the old one and produces key
> - * press/release events accordingly.  The keyboard state is 13 bytes (one byte
> - * per column)
> + * press/release events accordingly.  The keyboard state is one byte
> + * per column.
>   */
>  static void cros_ec_keyb_process(struct cros_ec_keyb *ckdev,
>                          uint8_t *kb_state, int len)
>  {
> -       struct input_dev *idev = ckdev->idev;
>         int col, row;
>         int new_state;
>         int old_state;
> @@ -192,20 +275,13 @@ static void cros_ec_keyb_process(struct cros_ec_keyb *ckdev,
>
>         for (col = 0; col < ckdev->cols; col++) {
>                 for (row = 0; row < ckdev->rows; row++) {
> -                       int pos = MATRIX_SCAN_CODE(row, col, ckdev->row_shift);
> -                       const unsigned short *keycodes = idev->keycode;
> -
>                         new_state = kb_state[col] & (1 << row);
>                         old_state = ckdev->old_kb_state[col] & (1 << row);
> -                       if (new_state != old_state) {
> -                               dev_dbg(ckdev->dev,
> -                                       "changed: [r%d c%d]: byte %02x\n",
> -                                       row, col, new_state);
> -
> -                               input_event(idev, EV_MSC, MSC_SCAN, pos);
> -                               input_report_key(idev, keycodes[pos],
> -                                                new_state);
> -                       }
> +
> +                       if (new_state == old_state)
> +                               continue;
> +
> +                       cros_ec_keyb_process_one(ckdev, row, col, new_state);
>                 }
>                 ckdev->old_kb_state[col] = kb_state[col];
>         }
> @@ -597,12 +673,19 @@ static int cros_ec_keyb_register_matrix(struct cros_ec_keyb *ckdev)
>         struct device *dev = ckdev->dev;
>         struct input_dev *idev;
>         const char *phys;
> +       unsigned int rows_keymap;
>         int err;
>
>         err = matrix_keypad_parse_properties(dev, &ckdev->rows, &ckdev->cols);
>         if (err)
>                 return err;
>
> +       if (ckdev->cols > CROS_EC_KEYBOARD_COLS_MAX) {
> +               dev_err(dev, "keypad,num-columns too large: %d (max: %d)\n",
> +                       ckdev->cols, CROS_EC_KEYBOARD_COLS_MAX);
> +               return -EINVAL;
> +       }
> +
>         ckdev->valid_keys = devm_kzalloc(dev, ckdev->cols, GFP_KERNEL);
>         if (!ckdev->valid_keys)
>                 return -ENOMEM;
> @@ -635,7 +718,12 @@ static int cros_ec_keyb_register_matrix(struct cros_ec_keyb *ckdev)
>         ckdev->ghost_filter = device_property_read_bool(dev,
>                                         "google,needs-ghost-filter");
>
> -       err = matrix_keypad_build_keymap(NULL, NULL, ckdev->rows, ckdev->cols,
> +       ckdev->use_fn_overlay = device_property_read_bool(dev,
> +                                       "google,use-fn-overlay");
> +
> +       rows_keymap = ckdev->use_fn_overlay ? ckdev->rows * 2 : ckdev->rows;
> +
> +       err = matrix_keypad_build_keymap(NULL, NULL, rows_keymap, ckdev->cols,
>                                          NULL, idev);
>         if (err) {
>                 dev_err(dev, "cannot build key matrix\n");
> --
> 2.52.0.351.gbe84eed79e-goog
>

Regards,
Simon

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 2/2] dt-bindings: google,cros-ec-keyb: add use-fn-overlay prop
  2025-12-27 12:44   ` Krzysztof Kozlowski
@ 2025-12-27 15:48     ` Fabio Baltieri
  2025-12-29 12:49       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 14+ messages in thread
From: Fabio Baltieri @ 2025-12-27 15:48 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Benson Leung, Guenter Roeck, Tzung-Bi Shih, Simon Glass,
	linux-input, devicetree, chrome-platform, linux-kernel

On Sat, Dec 27, 2025 at 01:44:26PM +0100, Krzysztof Kozlowski wrote:
> > diff --git a/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml b/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
> > index fefaaf46a240..437575cdf352 100644
> > --- a/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
> > +++ b/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
> > @@ -44,6 +44,14 @@ properties:
> >        where the lower 16 bits are reserved. This property is specified only
> >        when the keyboard has a custom design for the top row keys.
> >  
> > +  google,use-fn-overlay:
> > +    description: |
> > +      Use a function key overlay. This allows defining an extra set of codes
> 
> What is a function key overlay? Overlays are DT term and therefore are
> not suitable for bindings.

Ok, guess I can rename it to `use-fn-key` or `use-fn-layer`, open to
suggestions really.

> > +      that are sent if a key is pressed while the KEY_FN is held pressed as
> > +      well. The function codes have to be defined in the linux,keymap property
> > +      with an offset of keypad,num-rows from the normal ones.
> > +    type: boolean
> > +
> >  dependencies:
> >    function-row-physmap: [ 'linux,keymap' ]
> >    google,needs-ghost-filter: [ 'linux,keymap' ]
> > @@ -132,6 +140,23 @@ examples:
> >              /* UP      LEFT    */
> >              0x070b0067 0x070c0069>;
> >      };
> > +  - |
> > +    /* With function keys */
> > +    #include <dt-bindings/input/input.h>
> > +    keyboard-controller {
> > +        compatible = "google,cros-ec-keyb";
> > +        keypad,num-rows = <8>;
> > +        keypad,num-columns = <18>;
> > +        google,use-fn-overlay;
> 
> Difference in one property does not justify new example.

Sure but when the property is set then one has to specify the extra
codes in the linux,keymap property and this examples shows how. I'll
drop it if you want me to but I think there's value in it.

> Please organize the patch documenting the compatible (DT bindings)
> before the patch using that compatible.
> See also: https://elixir.bootlin.com/linux/v6.14-rc6/source/Documentation/devicetree/bindings/submitting-patches.rst#L46

Ack, will do for v3.

Thanks for the review.
Fabio

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 2/2] dt-bindings: google,cros-ec-keyb: add use-fn-overlay prop
  2025-12-27 15:48     ` Fabio Baltieri
@ 2025-12-29 12:49       ` Krzysztof Kozlowski
  2025-12-29 13:33         ` Fabio Baltieri
  0 siblings, 1 reply; 14+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-29 12:49 UTC (permalink / raw)
  To: Fabio Baltieri
  Cc: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Benson Leung, Guenter Roeck, Tzung-Bi Shih, Simon Glass,
	linux-input, devicetree, chrome-platform, linux-kernel

On 27/12/2025 16:48, Fabio Baltieri wrote:
> On Sat, Dec 27, 2025 at 01:44:26PM +0100, Krzysztof Kozlowski wrote:
>>> diff --git a/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml b/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
>>> index fefaaf46a240..437575cdf352 100644
>>> --- a/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
>>> +++ b/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
>>> @@ -44,6 +44,14 @@ properties:
>>>        where the lower 16 bits are reserved. This property is specified only
>>>        when the keyboard has a custom design for the top row keys.
>>>  
>>> +  google,use-fn-overlay:
>>> +    description: |
>>> +      Use a function key overlay. This allows defining an extra set of codes
>>
>> What is a function key overlay? Overlays are DT term and therefore are
>> not suitable for bindings.
> 
> Ok, guess I can rename it to `use-fn-key` or `use-fn-layer`, open to
> suggestions really.

Use as Linux should use? Then it's software, so not suitable for DT.

> 
>>> +      that are sent if a key is pressed while the KEY_FN is held pressed as
>>> +      well. The function codes have to be defined in the linux,keymap property
>>> +      with an offset of keypad,num-rows from the normal ones.
>>> +    type: boolean
>>> +
>>>  dependencies:
>>>    function-row-physmap: [ 'linux,keymap' ]
>>>    google,needs-ghost-filter: [ 'linux,keymap' ]
>>> @@ -132,6 +140,23 @@ examples:
>>>              /* UP      LEFT    */
>>>              0x070b0067 0x070c0069>;
>>>      };
>>> +  - |
>>> +    /* With function keys */
>>> +    #include <dt-bindings/input/input.h>
>>> +    keyboard-controller {
>>> +        compatible = "google,cros-ec-keyb";
>>> +        keypad,num-rows = <8>;
>>> +        keypad,num-columns = <18>;
>>> +        google,use-fn-overlay;
>>
>> Difference in one property does not justify new example.
> 
> Sure but when the property is set then one has to specify the extra
> codes in the linux,keymap property and this examples shows how. I'll
> drop it if you want me to but I think there's value in it.

Examples are for verifying schema and you do not have schema enforcing
this, thus still pointless. Add schema for that, assuming property will
stay.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 2/2] dt-bindings: google,cros-ec-keyb: add use-fn-overlay prop
  2025-12-29 12:49       ` Krzysztof Kozlowski
@ 2025-12-29 13:33         ` Fabio Baltieri
  2025-12-29 14:59           ` Krzysztof Kozlowski
  0 siblings, 1 reply; 14+ messages in thread
From: Fabio Baltieri @ 2025-12-29 13:33 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Benson Leung, Guenter Roeck, Tzung-Bi Shih, Simon Glass,
	linux-input, devicetree, chrome-platform, linux-kernel

On Mon, Dec 29, 2025 at 01:49:05PM +0100, Krzysztof Kozlowski wrote:
> On 27/12/2025 16:48, Fabio Baltieri wrote:
> > On Sat, Dec 27, 2025 at 01:44:26PM +0100, Krzysztof Kozlowski wrote:
> >>> diff --git a/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml b/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
> >>> index fefaaf46a240..437575cdf352 100644
> >>> --- a/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
> >>> +++ b/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
> >>> @@ -44,6 +44,14 @@ properties:
> >>>        where the lower 16 bits are reserved. This property is specified only
> >>>        when the keyboard has a custom design for the top row keys.
> >>>  
> >>> +  google,use-fn-overlay:
> >>> +    description: |
> >>> +      Use a function key overlay. This allows defining an extra set of codes
> >>
> >> What is a function key overlay? Overlays are DT term and therefore are
> >> not suitable for bindings.
> > 
> > Ok, guess I can rename it to `use-fn-key` or `use-fn-layer`, open to
> > suggestions really.
> 
> Use as Linux should use? Then it's software, so not suitable for DT.

Sorry I'm not sure how I understand the comment, this describes how the
driver handles a keyboard with Fn keys, the codes are defined in the DT
linux,keymap property and the driver needs to know that there's an extra
layer to interpret the codes correctly.

> >>> +      that are sent if a key is pressed while the KEY_FN is held pressed as
> >>> +      well. The function codes have to be defined in the linux,keymap property
> >>> +      with an offset of keypad,num-rows from the normal ones.
> >>> +    type: boolean
> >>> +
> >>>  dependencies:
> >>>    function-row-physmap: [ 'linux,keymap' ]
> >>>    google,needs-ghost-filter: [ 'linux,keymap' ]
> >>> @@ -132,6 +140,23 @@ examples:
> >>>              /* UP      LEFT    */
> >>>              0x070b0067 0x070c0069>;
> >>>      };
> >>> +  - |
> >>> +    /* With function keys */
> >>> +    #include <dt-bindings/input/input.h>
> >>> +    keyboard-controller {
> >>> +        compatible = "google,cros-ec-keyb";
> >>> +        keypad,num-rows = <8>;
> >>> +        keypad,num-columns = <18>;
> >>> +        google,use-fn-overlay;
> >>
> >> Difference in one property does not justify new example.
> > 
> > Sure but when the property is set then one has to specify the extra
> > codes in the linux,keymap property and this examples shows how. I'll
> > drop it if you want me to but I think there's value in it.
> 
> Examples are for verifying schema and you do not have schema enforcing
> this, thus still pointless. Add schema for that, assuming property will
> stay.

Ok got it, I'll just drop it in v3.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 2/2] dt-bindings: google,cros-ec-keyb: add use-fn-overlay prop
  2025-12-29 13:33         ` Fabio Baltieri
@ 2025-12-29 14:59           ` Krzysztof Kozlowski
  2025-12-29 15:39             ` Fabio Baltieri
  0 siblings, 1 reply; 14+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-29 14:59 UTC (permalink / raw)
  To: Fabio Baltieri
  Cc: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Benson Leung, Guenter Roeck, Tzung-Bi Shih, Simon Glass,
	linux-input, devicetree, chrome-platform, linux-kernel

On 29/12/2025 14:33, Fabio Baltieri wrote:
> On Mon, Dec 29, 2025 at 01:49:05PM +0100, Krzysztof Kozlowski wrote:
>> On 27/12/2025 16:48, Fabio Baltieri wrote:
>>> On Sat, Dec 27, 2025 at 01:44:26PM +0100, Krzysztof Kozlowski wrote:
>>>>> diff --git a/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml b/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
>>>>> index fefaaf46a240..437575cdf352 100644
>>>>> --- a/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
>>>>> +++ b/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
>>>>> @@ -44,6 +44,14 @@ properties:
>>>>>        where the lower 16 bits are reserved. This property is specified only
>>>>>        when the keyboard has a custom design for the top row keys.
>>>>>  
>>>>> +  google,use-fn-overlay:
>>>>> +    description: |
>>>>> +      Use a function key overlay. This allows defining an extra set of codes
>>>>
>>>> What is a function key overlay? Overlays are DT term and therefore are
>>>> not suitable for bindings.
>>>
>>> Ok, guess I can rename it to `use-fn-key` or `use-fn-layer`, open to
>>> suggestions really.
>>
>> Use as Linux should use? Then it's software, so not suitable for DT.
> 
> Sorry I'm not sure how I understand the comment, this describes how the
> driver handles a keyboard with Fn keys, the codes are defined in the DT

Exactly. The purpose of DT is not to describe how driver should handle
anything.

See also DTS101 from this year's ELCE.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 2/2] dt-bindings: google,cros-ec-keyb: add use-fn-overlay prop
  2025-12-29 14:59           ` Krzysztof Kozlowski
@ 2025-12-29 15:39             ` Fabio Baltieri
  2025-12-30  7:26               ` Krzysztof Kozlowski
  0 siblings, 1 reply; 14+ messages in thread
From: Fabio Baltieri @ 2025-12-29 15:39 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Benson Leung, Guenter Roeck, Tzung-Bi Shih, Simon Glass,
	linux-input, devicetree, chrome-platform, linux-kernel

On Mon, Dec 29, 2025 at 03:59:44PM +0100, Krzysztof Kozlowski wrote:
> On 29/12/2025 14:33, Fabio Baltieri wrote:
> > On Mon, Dec 29, 2025 at 01:49:05PM +0100, Krzysztof Kozlowski wrote:
> >> On 27/12/2025 16:48, Fabio Baltieri wrote:
> >>> On Sat, Dec 27, 2025 at 01:44:26PM +0100, Krzysztof Kozlowski wrote:
> >>>>> diff --git a/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml b/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
> >>>>> index fefaaf46a240..437575cdf352 100644
> >>>>> --- a/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
> >>>>> +++ b/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
> >>>>> @@ -44,6 +44,14 @@ properties:
> >>>>>        where the lower 16 bits are reserved. This property is specified only
> >>>>>        when the keyboard has a custom design for the top row keys.
> >>>>>  
> >>>>> +  google,use-fn-overlay:
> >>>>> +    description: |
> >>>>> +      Use a function key overlay. This allows defining an extra set of codes
> >>>>
> >>>> What is a function key overlay? Overlays are DT term and therefore are
> >>>> not suitable for bindings.
> >>>
> >>> Ok, guess I can rename it to `use-fn-key` or `use-fn-layer`, open to
> >>> suggestions really.
> >>
> >> Use as Linux should use? Then it's software, so not suitable for DT.
> > 
> > Sorry I'm not sure how I understand the comment, this describes how the
> > driver handles a keyboard with Fn keys, the codes are defined in the DT
> 
> Exactly. The purpose of DT is not to describe how driver should handle
> anything.
> 
> See also DTS101 from this year's ELCE.

Sure so I guess this falls into the "describe the hardware feature"
category, so is the suggestion to rename it to something like
"has-fn-key"? That would be the hardware feature.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 1/2] Input: cros_ec_keyb - add function key support
  2025-12-27 14:24   ` Simon Glass
@ 2025-12-29 16:28     ` Fabio Baltieri
  0 siblings, 0 replies; 14+ messages in thread
From: Fabio Baltieri @ 2025-12-29 16:28 UTC (permalink / raw)
  To: Simon Glass
  Cc: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Benson Leung, Guenter Roeck, Tzung-Bi Shih, linux-input,
	devicetree, chrome-platform, linux-kernel

On Sat, Dec 27, 2025 at 07:24:33AM -0700, Simon Glass wrote:
> Hi Fabio,
> 
> On Wed, 24 Dec 2025 at 08:22, Fabio Baltieri <fabiobaltieri@chromium.org> wrote:
> >
> > 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>
> > ---
> >  drivers/input/keyboard/cros_ec_keyb.c | 120 ++++++++++++++++++++++----
> >  1 file changed, 104 insertions(+), 16 deletions(-)
> >
> 
> Reviewed-by: Simon Glass <sjg@chromium.org>
> 
> I suggest a function comment for the two new functions you add.

Sure, will do.

> > +               if (code == KEY_FN)
> > +                       return cros_ec_keyb_process_fn_key(ckdev, row, col, state);
> > +
> > +               if (!state) {
> > +                       if (ckdev->fn_key_status[col] & BIT(row)) {
> > +                               pos = MATRIX_SCAN_CODE(row + ckdev->rows, col, ckdev->row_shift);
> > +                               code = keycodes[pos];
> 
> You might want a helper to do this as it is repeated below

Sounds good, adding one for v3

Thanks for the review,
Fabio

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 2/2] dt-bindings: google,cros-ec-keyb: add use-fn-overlay prop
  2025-12-29 15:39             ` Fabio Baltieri
@ 2025-12-30  7:26               ` Krzysztof Kozlowski
  2025-12-30 11:42                 ` Fabio Baltieri
  0 siblings, 1 reply; 14+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-30  7:26 UTC (permalink / raw)
  To: Fabio Baltieri
  Cc: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Benson Leung, Guenter Roeck, Tzung-Bi Shih, Simon Glass,
	linux-input, devicetree, chrome-platform, linux-kernel

On 29/12/2025 16:39, Fabio Baltieri wrote:
> On Mon, Dec 29, 2025 at 03:59:44PM +0100, Krzysztof Kozlowski wrote:
>> On 29/12/2025 14:33, Fabio Baltieri wrote:
>>> On Mon, Dec 29, 2025 at 01:49:05PM +0100, Krzysztof Kozlowski wrote:
>>>> On 27/12/2025 16:48, Fabio Baltieri wrote:
>>>>> On Sat, Dec 27, 2025 at 01:44:26PM +0100, Krzysztof Kozlowski wrote:
>>>>>>> diff --git a/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml b/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
>>>>>>> index fefaaf46a240..437575cdf352 100644
>>>>>>> --- a/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
>>>>>>> +++ b/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
>>>>>>> @@ -44,6 +44,14 @@ properties:
>>>>>>>        where the lower 16 bits are reserved. This property is specified only
>>>>>>>        when the keyboard has a custom design for the top row keys.
>>>>>>>  
>>>>>>> +  google,use-fn-overlay:
>>>>>>> +    description: |
>>>>>>> +      Use a function key overlay. This allows defining an extra set of codes
>>>>>>
>>>>>> What is a function key overlay? Overlays are DT term and therefore are
>>>>>> not suitable for bindings.
>>>>>
>>>>> Ok, guess I can rename it to `use-fn-key` or `use-fn-layer`, open to
>>>>> suggestions really.
>>>>
>>>> Use as Linux should use? Then it's software, so not suitable for DT.
>>>
>>> Sorry I'm not sure how I understand the comment, this describes how the
>>> driver handles a keyboard with Fn keys, the codes are defined in the DT
>>
>> Exactly. The purpose of DT is not to describe how driver should handle
>> anything.
>>
>> See also DTS101 from this year's ELCE.
> 
> Sure so I guess this falls into the "describe the hardware feature"
> category, so is the suggestion to rename it to something like
> "has-fn-key"? That would be the hardware feature.


Maybe, but then I would follow up with - what about "alt", "ctrl",
"shift" and "fn" keys? And what about combinations alt+ctrl, alt+shift?
And also caps-lock? And why exactly this has to be even specified if
matrix map already has the FN key?

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 2/2] dt-bindings: google,cros-ec-keyb: add use-fn-overlay prop
  2025-12-30  7:26               ` Krzysztof Kozlowski
@ 2025-12-30 11:42                 ` Fabio Baltieri
  0 siblings, 0 replies; 14+ messages in thread
From: Fabio Baltieri @ 2025-12-30 11:42 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Benson Leung, Guenter Roeck, Tzung-Bi Shih, Simon Glass,
	linux-input, devicetree, chrome-platform, linux-kernel

On Tue, Dec 30, 2025 at 08:26:56AM +0100, Krzysztof Kozlowski wrote:
> On 29/12/2025 16:39, Fabio Baltieri wrote:
> > Sure so I guess this falls into the "describe the hardware feature"
> > category, so is the suggestion to rename it to something like
> > "has-fn-key"? That would be the hardware feature.
> 
> 
> Maybe, but then I would follow up with - what about "alt", "ctrl",
> "shift" and "fn" keys? And what about combinations alt+ctrl, alt+shift?
> And also caps-lock? And why exactly this has to be even specified if
> matrix map already has the FN key?

Fn works as a key layer, that is when the key is pressed the rest of the
matrix uses a different keymap, different codes. The driver has to make
extra space in the internal data structures for reading the new codes
from the keymap property and use them when they are specified. The other
combinations you mentioned behave normally, nothing special about them.

Looking at the input driver history the other driver that [used to] have
this was using a platform data field called use_fn_map, guess I'll go
with use-fn-map then (that one has never been ported over to dt).

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2025-12-30 11:42 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-24 15:22 [PATCH v2 0/2] Input: cros_ec_keyb: add function key support Fabio Baltieri
2025-12-24 15:22 ` [PATCH v2 1/2] Input: cros_ec_keyb - " Fabio Baltieri
2025-12-27 14:24   ` Simon Glass
2025-12-29 16:28     ` Fabio Baltieri
2025-12-24 15:22 ` [PATCH v2 2/2] dt-bindings: google,cros-ec-keyb: add use-fn-overlay prop Fabio Baltieri
2025-12-27 12:44   ` Krzysztof Kozlowski
2025-12-27 15:48     ` Fabio Baltieri
2025-12-29 12:49       ` Krzysztof Kozlowski
2025-12-29 13:33         ` Fabio Baltieri
2025-12-29 14:59           ` Krzysztof Kozlowski
2025-12-29 15:39             ` Fabio Baltieri
2025-12-30  7:26               ` Krzysztof Kozlowski
2025-12-30 11:42                 ` Fabio Baltieri
2025-12-27 12:44   ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).