Linux Input/HID development
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Linus Walleij <linusw@kernel.org>
Cc: sashiko-reviews@lists.linux.dev,
	Michael Zaidman <michael.zaidman@gmail.com>,
	linux-input@vger.kernel.org, linux-serial@vger.kernel.org,
	linux-gpio@vger.kernel.org
Subject: Re: [PATCH v4 03/16] HID: ft260: add GPIO support
Date: Sun, 29 Nov 2026 20:35:25 -0800	[thread overview]
Message-ID: <aad705560d3d562f7ad7703092433a88@gmail.com> (raw)
In-Reply-To: <CAD++jLkYkuCLgA27gQwzv4YW3Js5F4njJwDqCeG=5as1u_=KSQ@mail.gmail.com>

Hi Linus,

On Mon, Nov 30, 2026 at 12:17:47AM +0100, Linus Walleij wrote:
> And yet your LLM inference fails to see what kind of architectural
> violation this is. And this should be [Severity: Critical]

Thank God LLMs still cannot figure out architectural direction on their
own, otherwise we would all be out of a job...

...
> I wonder if I can add something to review-prompts to make it
> detect things like this better?

Yes, kernel/subsystem/gpio.md in review-prompts would be the place for
it. It already triggers on gpio_chip usage anywhere in the tree, whereas
a separate pinctrl guide would not load when a driver avoids pinctrl
altogether.

That said, this rule is not really documented in the kernel tree either,
so neither humans nor LLMs have much to go on. If the diff below matches
what you have in mind, I am happy to send it as a proper patch.

Thanks.

diff --git a/Documentation/driver-api/gpio/driver.rst b/Documentation/driver-api/gpio/driver.rst
index 3e53374c7e9f..7cd34b3d1672 100644
--- a/Documentation/driver-api/gpio/driver.rst
+++ b/Documentation/driver-api/gpio/driver.rst
@@ -284,6 +284,20 @@ supports more versatile control over electrical properties and can handle
 different pull-up or pull-down resistance values.
 
 
+Multiplexed GPIO pins
+---------------------
+
+If pins handled by a GPIO controller can be multiplexed between GPIO and
+other hardware functions (such as UART, I2C, SPI, clock, or LED signals),
+do not implement ad-hoc pin-function selection in the GPIO driver or expose
+custom sysfs attributes to change pin modes. Implement a combined pin
+control and GPIO driver under ``drivers/pinctrl/`` instead. When the pins
+are part of a multi-function or bridge device handled in another subsystem
+(such as USB or HID), spawn a child device (for example, a platform device)
+for the combined driver. See Documentation/driver-api/pin-control.rst for
+details.
+
+
 GPIO drivers providing IRQs
 ===========================
 
diff --git a/Documentation/driver-api/pin-control.rst b/Documentation/driver-api/pin-control.rst
index 80106e44a368..27d5e3b1fc49 100644
--- a/Documentation/driver-api/pin-control.rst
+++ b/Documentation/driver-api/pin-control.rst
@@ -1470,6 +1470,28 @@ will be done when the state is activated, so in effect one specific pin
 can be used by different functions at different times on a running system.
 
 
+Userspace pin multiplexing
+==========================
+
+Drivers must not expose custom per-driver userspace interfaces (such as
+driver-specific sysfs attributes) for inspecting or changing pin multiplexing
+and pin function selection. Pin multiplexing must be implemented through the
+pin control subsystem in ``drivers/pinctrl/``.
+
+When a multi-function or bridge device lives in another subsystem (for example,
+a USB or HID adapter combining I2C, serial, and multiplexed GPIO pins), spawn a
+child device such as a platform device and implement a combined pin control and
+GPIO driver under ``drivers/pinctrl/`` rather than adding ad-hoc mux controls
+to the parent driver.
+
+If hotpluggable or otherwise non-firmware-described hardware genuinely needs
+userspace control over pin groups and functions (because Device Tree, ACPI, or
+board mappings cannot describe the wiring), that support must be designed as a
+standardized interface in the pin control core rather than per-driver sysfs
+files. The ``pinmux-select`` debugfs file described below is for debugging only
+and is not a stable userspace ABI.
+
+
 Debugfs files
 =============
 

-- 
Dmitry

  reply	other threads:[~2026-11-30  4:35 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 20:04 [PATCH v4 00/16] HID: ft260: add UART and GPIO support, plus I2C fixes Michael Zaidman
2026-11-17 20:04 ` [PATCH v4 01/16] HID: ft260: add serial driver Michael Zaidman
2026-11-18  7:21   ` Jiri Slaby
2026-11-18 16:38     ` Michael Zaidman
2026-11-17 20:04 ` [PATCH v4 02/16] HID: ft260: uart: fix " Michael Zaidman
2026-11-17 20:49   ` sashiko-bot
2026-11-18 20:56     ` Michael Zaidman
2026-11-17 20:04 ` [PATCH v4 03/16] HID: ft260: add GPIO support Michael Zaidman
2026-11-17 20:23   ` sashiko-bot
2026-11-18 20:56     ` Michael Zaidman
2026-11-29 23:17     ` Linus Walleij
2026-11-30  4:35       ` Dmitry Torokhov [this message]
2026-11-29 23:15   ` Linus Walleij
2026-11-17 20:04 ` [PATCH v4 04/16] HID: ft260: i2c: reduce driver module loading time Michael Zaidman
2026-11-17 20:04 ` [PATCH v4 05/16] HID: ft260: fix sysfs store failure notice for big numbers Michael Zaidman
2026-11-17 20:04 ` [PATCH v4 06/16] HID: ft260: i2c: reduce bus-error message severity Michael Zaidman
2026-11-17 20:04 ` [PATCH v4 07/16] HID: ft260: uart: enable flow control Michael Zaidman
2026-11-17 20:04 ` [PATCH v4 08/16] HID: ft260: uart: add modem pins control via ioctl Michael Zaidman
2026-11-17 23:56   ` Maarten Brock
2026-11-18 16:40     ` Michael Zaidman
2026-11-17 20:04 ` [PATCH v4 09/16] HID: ft260: group sysfs attrs per HID interface Michael Zaidman
2026-11-17 20:04 ` [PATCH v4 10/16] HID: ft260: i2c: fix large write transaction failure Michael Zaidman
2026-11-17 20:04 ` [PATCH v4 11/16] HID: ft260: workaround for TN_189 errata endpoint STALL after enumeration Michael Zaidman
2026-11-17 20:50   ` sashiko-bot
2026-11-18 20:57     ` Michael Zaidman
2026-11-17 20:04 ` [PATCH v4 12/16] HID: ft260: i2c: abort in-flight transfers with STOP before reset Michael Zaidman
2026-11-17 20:04 ` [PATCH v4 13/16] HID: ft260: i2c: reject an I2C clock outside the supported range Michael Zaidman
2026-11-17 20:04 ` [PATCH v4 14/16] HID: ft260: i2c: fix i2c_reset sysfs store return value Michael Zaidman
2026-11-17 20:04 ` [PATCH v4 15/16] HID: ft260: i2c: recover a bus held by a slave Michael Zaidman
2026-11-17 20:04 ` [PATCH v4 16/16] HID: ft260: use lock guards Michael Zaidman

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=aad705560d3d562f7ad7703092433a88@gmail.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=michael.zaidman@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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