[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <nx4lo6qfyfoxha7poyipa2hjc2vogp6twxbcap2555aj4y56gg@ddhkfh7eifvm>
Date: Wed, 17 Dec 2025 10:05:45 -0800
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: Fabio Baltieri <fabiobaltieri@...omium.org>
Cc: Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>,
Benson Leung <bleung@...omium.org>, Guenter Roeck <groeck@...omium.org>,
Tzung-Bi Shih <tzungbi@...nel.org>, Simon Glass <sjg@...omium.org>, linux-input@...r.kernel.org,
devicetree@...r.kernel.org, chrome-platform@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 3/3] dt-bindings: google,cros-ec-keyb: add fn-key and
f-keymap props
Hi Fabio,
On Tue, Dec 16, 2025 at 12:23:06PM +0000, Fabio Baltieri wrote:
> Hi Dmitry,
>
> On Thu, Dec 11, 2025 at 08:44:02PM -0800, Dmitry Torokhov wrote:
> > On Wed, Dec 10, 2025 at 06:00:29PM +0000, Fabio Baltieri wrote:
> > > Hey Rob, thanks for the review.
> > >
> > > On Tue, Dec 09, 2025 at 01:22:43PM -0600, Rob Herring wrote:
> > > > On Tue, Dec 09, 2025 at 03:47:06PM +0000, Fabio Baltieri wrote:
> > > > > + fn-key:
> > > > > + $ref: /schemas/types.yaml#/definitions/uint32
> > > > > + description: |
> > > > > + An u32 containing the coordinate of the Fn key, use the MATRIX_KEY(row,
> > > > > + col, code) macro, code is ignored.
> > > > > +
> > > > > + fn-keymap:
> > > >
> > > > If keymap is linux,keymap, then this should perhaps be linux,fn-keymap.
> > > > Depends if we still think linux,keymap is Linux specific?
> > >
> > > I'm open for suggestions, trying to understand the pattern, these are
> > > specific to this binding I think if anything they should be
> > > google,fn-key and google,fn-keymap, similarly to the existing
> > > google,needs-ghost-filter -- no idea why function-row-physmap was not
> > > prefixed but I guess it slipped in and now it's not worth changing it.
> >
> > Just double the number of rows in the regular keymap to accommodate the
> > FN modifier, no need for separate keymap. Also no need to have fn-key
> > property, use whatever key that reports KEY_FN. See how it is done in
> > drivers/input/keyboard/tegra-kbc.c
>
> Had a look at the tegra-kbc driver as you suggested, first thing it
> seems like the fn-key functionality there is dead code since 2013,
> `use_fn_map` could only be enabled with platform data, not OF, and that
> has been removed in 3a495aeada2b, as it stands kbc->use_fn_map can only
> be false. I could send a patch to rip off that code if you want me to,
> clearly it hasn't been used in a while (unless I'm missing something).
I guess you are right, we shoudl clean that up. We have another newer
driver that uses the same approach:
drivers/input/keyboard/pinephone-keyboard.c
> About the extended fn map, I've two problems with it:
> - it seems very wasteful: the normal map is loaded in a linear array
> so it can be access directly, which make sense as that's typically
> very densely populated, but in the case of the fn keys that's going to
> be mostly empty, I'd expect ~20 keys top from a 18x8 matrix. So that
> would waste load of space, direct access is good but for ~20 keys I
> think it's fine to scan it, especially since it only happens when Fn
> is pressed.
I am not concerned with this, as this is a singleton device. You
probably "waste" as much space in the code segment by implementing the
custom scanning logic. Additionally with the consolidated keymap
approach you are not breaking ioctls dealing with setting and retrieving
key codes.
> - I'd end up with two values for cols kicking around the driver, the
> real one and the one used in the map, which I feel adds confusing in
> the code.
Not sure I follow. You still have the same row and col reported, just
when figuring out the final keycode you need to add an offset.
> - more importantly, one would have to keep the offset in mind when
> setting the keys in dt, we rely on OEM doing this and I think having a
Do we now? I thought we retain greater control over this. Maybe we
should sync internally.
> separate property with a meaningful name and a map with the same
> row,col and different code is more intuitive and would make their life
> easier, especially since we ship with keyboard of different size
> and the offset would be different depending on the device.
>
> As for the fn-key property, unfortunately based on past experience I'd
> expect such OEM to want to change that code, I could specify the code
> rather than the row,col but I would not plain hardcode. Even my
> (thinkpad) laptop sends KEY_WAKEUP for Fn.
Again, we need to make sure we control OEMs better. On Lenovo Fn sends
wakeup only if it is not combined with another key, so it really has
custom logic with events delivered either through the main AT keyboard
or through custom interface in thinkpad platform driver. We do not need
this in oiur designs.
Thanks.
--
Dmitry
Powered by blists - more mailing lists