Re: [PATCH v4 03/16] HID: ft260: add GPIO support

From: Linus Walleij

Date: Tue Dec 01 2026 - 16:12:47 EST


Hi Michael,

On Mon, Nov 30, 2026 at 9:47 PM Michael Zaidman
<michael.zaidman@xxxxxxxxx> wrote:

> > If I was doing this I would spawn a new platform device,
> > figure out some transport mechanism and create a new
> > combined pin control and GPIO driver in drivers/pinctrl/* for this.
>
> This fits the MFD split that we discussed in the v1 thread, with the
> pin control and GPIO driver as one child device. There I wrote that I
> would land the current driver first, and do the MFD split as its own
> series once this one is in the tree [1]. I keep that plan.

Well I'm not overly enthusiastic about the "merge now, fix later"
approach to anything to be frank.

Sometimes "later" never happens because people get other
priorities, like children, or new silicon.

> > 1. Do what I did in
> > commit 200e6c6e94fa786e36e4fe33eebf16b822181b99
> > "HID: mcp2221: Add module parameter to enfoce GPIO mode"
> > and control the mode with a module parameters instead
> > of custom sysfs files.
>
> For the FT260 this removes functions that the files have now:
>
> - A parameter like gpio_mode_enforce has one value for all FT260
> chips in the system. The sysfs files set each chip on its own.

Yeah I agree it would be better to have something runtime
for this. And sysfs does have the topology of things laid out
and that is to its advantage.

> - It can only switch a pin to GPIO. The three pins have more
> functions: GPIOA can be TX_ACTIVE or TX_LED, GPIO2 can be
> SUSPOUT_N, SUSPOUT or PWREN_N, and GPIOG can be BCD_DET, RX_LED or
> PWREN_N. To select one of these, the user would have to program
> the eFUSE or an EEPROM with the FTDI tool FT_PROG.
>
> The out-of-tree driver has had the three *_func files since December
> 2022, and uart_dcd_ri since March 2024.

Interesting solution. But does not scale and is not standard.

> > 2. Bite the bullet and implement some standardized
> > sysfs ABI for pin control for selected groups and functions
> > of a pin controller from userspace. No custom stuff.
> > This to be done after moving the driver over to
> > drivers/pinctrl.
>
> Documentation/driver-api/pin-control.rst describes no such interface.

I mean literally what I say, that you should implement it,
as opt-in, per-driver, in the pin control core. I could help, of
course.

> For userspace it has only the debugfs file pinmux-select. As you say,
> this work comes after the move to drivers/pinctrl, so it belongs to
> the MFD series.

Okay.

> For v5 I propose this:
>
> - Patch 3 adds the gpiochip without the four files. The gpiochip uses
> the pin functions that the chip reports at probe.

Fair enough.

> - The four files move to a separate patch at the end of the series,
> with an entry in Documentation/ABI/testing/. No other patch
> depends on it.

I would NACK that patch, so I recommend not sending it.

> Without that patch the driver loses functions that users of the
> out-of-tree driver have today.

We (the Linux kernel community) don't care about out-of-tree
drivers. We care about the right, maintainable, generalized
solution to a problem more than most things.

Other projects are more utility-oriented than Linux
along the lines "look users must have this now" but this is
not a technical argument to push in a substandard solution.

OpenWrt where I also work is such a project and there
I act differently, it's not like I don't understand the stance
or somewhat agree with it in other contexts.

> With the chip defaults, GPIO2, GPIOA
> and GPIOG are not GPIO lines, and the driver gives no other way to
> make them GPIO lines. For example, in [2] a user writes 0 to
> gpio2_func to get GPIO2 as a GPIO line.
>
> Jiri, Benjamin, the separate patch lets you decide on it apart from
> the rest of the series. When the MFD series moves the pins to a pin
> control driver, the files go to Documentation/ABI/obsolete/.

You are advising the HID maintainers to merge a custom pin
control ABI that the pin control maintainer is opposed to?

Oh well, I've had worse things done to code I care
about.

But I don't think that's good for the community.

Yours,
Linus Walleij