From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.45 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796071629; b=TDjCrIgxltLLZc0nAu5vVhaXNntkuHzlFtGvgw436lYmQFrig/mzmdeOq0wcaey4iWTv 4oZHcGaiHJiaq+ZqvED8wKxQm2A4sjVpVSY8xfb5IRtLz+xtqZrFywWwVexwtY1Sb9S+u bZDD6el5/xPJUeSGxF8PbpJMVWcH8jX3av6iMjZ/kTEoZnEngFY9d6m9w5kqJPqUGipp+ Y3POfDS/8OZYB9Fj18yeLyGzy/3OZE3rBEn+ArUpRGcN8M0Xsc83JlqOSDLZrDmPtK06c 4EeqTDM1PJbHs2fUpEWUfdhnDN/ESvNO0vZVIwY60/bcsPBDVfQZmx59Aco8GaD2Bcw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796071629; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=5GM2WnqPBDQH/ZObcrSF8KD+tNtucq1OkbnOtDcoEY0=; b=353I+issslSOe8IUZOlx+jDVD4wlsDLuvQ0LU48ce8aRO1YEZNbagjlgifU8EURTi1R4 J26MHn+uTch/s+aACkDnSVEHs4x1qLJSZX7IOppNVuIPsInFhbjQfAc/4D2UV07OfsLiB jG2R4Cs4NWGefxruBwlLHAiKRRGvLYRTH+mmAQc1n4iZJJdmbJocCgjcRtkD1gjzVlCM6 mPuRxNfEcpR5WNF3TekojjEKROa6Xtk+jb9L6+5oZMynKT15mKU+O8f/daykZEzVQCp9e aWnxyLMSqUkcA7P3WThpEASHaoiKyTn9945u1EH2DpM+Lq/9dyHxXF38SBQUua0B14Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=wOGFHcCx; arc=none smtp.remote-ip=209.85.128.45 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9AB29606A32A for ; Mon, 30 Nov 2026 20:47:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9AB29606A32A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=wOGFHcCx Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4bb6ba3b244so113189925e9.3 for ; Mon, 30 Nov 2026 12:47:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796071627; x=1796676427; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=5GM2WnqPBDQH/ZObcrSF8KD+tNtucq1OkbnOtDcoEY0=; b=wOGFHcCx77EdHBTeRjmNP6hSRKrVayXErZC+RaFWtp8PooqQhKF7bjJG+G7zcCdkej 0uFICZZqWDtMeuh19yBGf4V/QeeX3ib48iFR7rAM4m1SMaA8hXLG2gliG+AK/TL9D25g e48mvo6e/YGAe3Lg48/XL4FWWKR9F5RoGLqLmjq9sNao2XT8J70sMrvBokxcyV5FXl4P RirL6RPoaG2La7p3YSWhqdN3G++qenjIhjvcuLgHh4AALIc7pRUd5f0nrBg7FK3UEzg0 gpWZuINYiNnw3LfDOIPF4IAfpqfm+mzmP8cxiqSaa9Ky4m8IOcmNo2GaAXHOJbg1nRdN uP4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796071627; x=1796676427; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=5GM2WnqPBDQH/ZObcrSF8KD+tNtucq1OkbnOtDcoEY0=; b=G1ktxjrixs8E9W5YE6D6KNhKHXCPad3u3aqyJV9yPnbI8JvWat4s+K2Z42LA0UpeiI VoQeC1ZuLj13HVmA8bFR/R13xen4MWLy5hcJrnwFhilTLof5h74dOBrXz/kATtnr3s9D zwpBJ+Wf5QTcDbxKKDVWNlhcmkzyxFjyKMU7GbBdQm4ZsPQNPSc4nhWFJ+HkF8YRZgTN gi9mKy6RN8TsaAYcB71BE/LgmkpPE04Jt1AeS9ixU3xMlY2WrR/F2I0iQrNz0l8D04If /YJGGIfNcel3Q57Qvcj4z++a0b+R4MzVEY2nqaTw+nWYjHbDX24cLSOjJHeplwsnz9Xx Y7IQ== X-Forwarded-Encrypted: i=1; AL+hErE2y4R1/in8VMpEFMRHzkEeBAZyq1y0LCX8NVIV1Bu62CI/NYFwUW93EBEnHLTuwxVDjnObqbRq/VB1@vger.kernel.org X-Gm-Message-State: APuU4Z+d/ZLMrXA75ecLrYD07GTqA+uHcyKPyQF7ScjtrgU29kLlc7GD ov863w0RM4NdzhoKJEhS273u1w05GI0bAEXOieU9llHn3F0I2nYUICUB X-Gm-Gg: AZFdTZfNZPOGn9Ph/ohzML2v9kjqtO9wBDHJn89kaUQFqM55gCAwHZxed6pzry61tvD koVkGvkYkID+9Ange+wEwiIF4As/e1kLTAsbgj5QftPH3MCjHeHu4isNihN6Ud4niPx50xbnzA1 CltHfK566SmNvgavvsiKPfW3wb5Tgq94Jy5vczl0kG6tFxbl8wQbHtwUcXwjwtIUQ9miYmOlsGX p64HXM/RlXHMttn5Fgks0UVhOmb195Zgo2xRq3whMHNMsZYkMH/6m78uhKouomzQ8SfmoFHRMQZ p72lwXTARGZMVueM/yNCbeWaWxtidJZtM05BvwA3SAZ+Dm6XFNHDK7seYioOSALgwt/4xR3OZ7p VCqCEaszgwPP9bK3XajtaHyuJCY/2oo0ggTkFClwdQVu0RKZn8nBLKYCi5cjVsf8KXlxfRnIHto sZYbSihvqRXJIvIbizWeWZw0rVJj1wOVbMXPioA71G8QXueccKywqU6UVGo+S5dFR8xkMQUEe+S 3NbWlElZ5j9MnL9vuocVi8DoVQsSr1s7R5bQXTqFCSXJIY5qKMBXZEMpNQvzFCRZwSa8EAliWct bDInq7Hk1xo8rGE1r6lZlfFBb2lDbHGPahZGrkY89ELYqh911Q== X-Received: by 2002:a05:600c:4f0d:b0:4bb:5c97:f4b1 with SMTP id 5b1f17b1804b1-4bb8881941bmr751771175e9.24.1796071626806; Mon, 30 Nov 2026 12:47:06 -0800 (PST) Received: from m2.. ([37.142.159.181]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4bb884b39b6sm890252395e9.12.2026.11.30.12.47.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 12:47:06 -0800 (PST) From: Michael Zaidman To: Linus Walleij Cc: Michael Zaidman , Jiri Kosina , Benjamin Tissoires , Bartosz Golaszewski , Greg Kroah-Hartman , Jiri Slaby , Raman Varabets , Germain Hebert , Christina Quast , Rio Liu , Bruno Giacomazzi , linux-input@vger.kernel.org, linux-serial@vger.kernel.org, linux-gpio@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 03/16] HID: ft260: add GPIO support Date: Mon, 30 Nov 2026 22:46:55 +0200 Message-ID: <20261130204656.8744-1-michael.zaidman@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hi Linus, On Mon, Nov 30, 2026 at 12:15:36AM +0100, Linus Walleij wrote: > > +/* Multi-function pin functions */ > > +enum { > > + FT260_MFPIN_GPIO = 0x00, > > + FT260_MFPIN_SUSPOUT = 0x01, > [...] > > This is clearly pin multiplexing, by the textbook. Yes. These are the values of the FT260 HID reports that select the function of the pins GPIO2, GPIOA and GPIOG. > > +FT260_SSTAT_ATTR_SHOW(gpio2_func); > > +FT260_BYTE_ATTR_STORE(gpio2_func, ft260_set_gpio2_func_report, > > + FT260_SELECT_GPIO2_FUNC, ft260_gpio_en_update); > > +static DEVICE_ATTR_RW(gpio2_func); > [...] > > Is this a custom sysfs to expose and set pin multiplexing? Yes, for four files. gpio2_func, gpioa_func and gpiog_func select the function of these three pins. uart_dcd_ri switches GPIO4 and GPIO5 between GPIO and the UART DCD and RI lines. The other files in the hunk, i2c_enable, uart_mode, clock_ctl and clock, are in mainline since v5.13. The patch only adds a callback argument to their store macro. For i2c_enable and uart_mode, the callback updates the mask of the GPIO lines. > I think this hacking needs to stop. > > This driver needs to be using proper pin control. > > 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. > 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. - 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. > 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. 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. 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. - 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. Without that patch the driver loses functions that users of the out-of-tree driver have today. 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/. [1] https://lore.kernel.org/all/20260926183136.25146-1-michael.zaidman@gmail.com/ [2] https://github.com/MichaelZaidman/hid-ft260/issues/9 Thanks, Michael