From patchwork Sun May 17 17:14:05 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Kocialkowski X-Patchwork-Id: 2286 Return-Path: X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mxe881.netcup.net (Postfix) with ESMTPS id CD2681C021A for ; Sun, 17 May 2026 19:23:48 +0200 (CEST) Authentication-Results: mxe881; spf=pass (sender IP is 172.232.135.74) smtp.mailfrom=linux-sunxi+bounces-23434-noreply=patchwork.local@lists.linux.dev smtp.helo=sto.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 172.232.135.74 as permitted sender) client-ip=172.232.135.74; envelope-from=linux-sunxi+bounces-23434-noreply=patchwork.local@lists.linux.dev; helo=sto.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sto.lore.kernel.org (Postfix) with ESMTP id 9D2A13002308 for ; Sun, 17 May 2026 17:23:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5FE113C65E0; Sun, 17 May 2026 17:23:45 +0000 (UTC) X-Original-To: linux-sunxi@lists.linux.dev Received: from leonov.paulk.fr (leonov.paulk.fr [185.233.101.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1EA203C5DD4 for ; Sun, 17 May 2026 17:23:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.233.101.22 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779038625; cv=none; b=aY8RukDLyci0OfKrbOLcbBLIgKl+Hc2M4fgJ1zT5f33qGrGha8gDNRPcXw0fGQYYMpC0n0f6D12Z1S5+u7pMcYHlgrSP1Pr28wUcX+pBlR70bzUlOYqZKa34TJzkhEq1Ee3oeZWv9QIVqMzVJvX5lQyJEHz0a5/hYEb0DGZaapE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779038625; c=relaxed/simple; bh=w5oEMeftLT6dpjH4N6NKR2mi8NlY8HlAmFv9o+3dyb0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=GlK6qP9A44vTSMxO3nABidH39ZRUpZnFVMhb5iupA7S74aNhF9/WT9I6njWiyUCtPZ0tjkfGDdxW6gLRy9JOcItCDd39qqsFizYPIKPzjZacJqSVWtdq7RPW36tV/yHY/ndUAFgOKB4VMDevvo5QtIHzNW3fHX+luQSxroiAtuU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sys-base.io; spf=pass smtp.mailfrom=sys-base.io; arc=none smtp.client-ip=185.233.101.22 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sys-base.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sys-base.io Received: from laika.paulk.fr (12.234.24.109.rev.sfr.net [109.24.234.12]) by leonov.paulk.fr (Postfix) with ESMTPS id 82C481F8004A for ; Sun, 17 May 2026 17:14:25 +0000 (UTC) Received: by laika.paulk.fr (Postfix, from userid 65534) id A1F09B407A2; Sun, 17 May 2026 17:14:24 +0000 (UTC) X-Spam-Level: * Received: from collins (unknown [192.168.1.64]) by laika.paulk.fr (Postfix) with ESMTP id CB7A8B4079C; Sun, 17 May 2026 17:14:06 +0000 (UTC) From: Paul Kocialkowski To: linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Cc: Andre Przywara , Linus Walleij , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Paul Kocialkowski Subject: [PATCH] pinctrl: sunxi: Implement function_is_gpio Date: Sun, 17 May 2026 19:14:05 +0200 Message-ID: <20260517171405.3697469-1-paulk@sys-base.io> X-Mailer: git-send-email 2.54.0 Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Rspamd-Server: rspamd-worker-8404 X-Spamd-Result: default: False [-0.66 / 15.00]; BAYES_HAM(-5.50)[99.99%]; RBL_SENDERSCORE(2.00)[172.232.135.74:from]; SUSPICIOUS_RECIPS(1.50)[]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; MAILLIST(-0.15)[generic]; BAD_REP_POLICIES(0.10)[]; MIME_GOOD(-0.10)[text/plain]; HAS_LIST_UNSUB(-0.01)[]; FREEMAIL_CC(0.00)[arm.com,kernel.org,gmail.com,sholland.org,sys-base.io]; DMARC_NA(0.00)[sys-base.io]; FUZZY_BLOCKED(0.00)[rspamd.com]; TAGGED_RCPT(0.00)[]; MIME_TRACE(0.00)[0:+]; DBL_BLOCKED_OPENRESOLVER(0.00)[sys-base.io:email]; PRECEDENCE_BULK(0.00)[]; FROM_HAS_DN(0.00)[]; FROM_NEQ_ENVFROM(0.00)[paulk@sys-base.io,linux-sunxi@lists.linux.dev]; RCPT_COUNT_SEVEN(0.00)[10]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; R_SPF_ALLOW(0.00)[+ip4:172.232.135.74]; TO_DN_SOME(0.00)[]; RCVD_COUNT_SEVEN(0.00)[7]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:63949, ipnet:172.232.128.0/19, country:SG]; R_DKIM_NA(0.00)[]; ARC_ALLOW(0.00)[subspace.kernel.org:s=arc-20240116:i=1]; TAGGED_FROM(0.00)[bounces-23434-noreply=patchwork.local]; FORGED_SENDER_MAILLIST(0.00)[] X-Rspamd-Queue-Id: CD2681C021A X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= The function_is_gpio pinmux op allows the core to find out whether a GPIO can be safely requested from a pinctrl property and requested as a GPIO at the same time. This is especially useful to request a GPIO with a particular drive strength, which would otherwise not be possible. Signed-off-by: Paul Kocialkowski --- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c index d3042e0c9712..6162f2d86723 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c @@ -821,6 +821,17 @@ static int sunxi_pmx_get_func_groups(struct pinctrl_dev *pctldev, return 0; } +static bool sunxi_pmx_function_is_gpio(struct pinctrl_dev *pctldev, + unsigned function) +{ + struct sunxi_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); + + if (!strncmp(pctl->functions[function].name, "gpio", 4)) + return true; + + return false; +} + static void sunxi_pmx_set(struct pinctrl_dev *pctldev, unsigned pin, u8 config) @@ -952,6 +963,7 @@ static const struct pinmux_ops sunxi_pmx_ops = { .get_functions_count = sunxi_pmx_get_funcs_cnt, .get_function_name = sunxi_pmx_get_func_name, .get_function_groups = sunxi_pmx_get_func_groups, + .function_is_gpio = sunxi_pmx_function_is_gpio, .set_mux = sunxi_pmx_set_mux, .gpio_set_direction = sunxi_pmx_gpio_set_direction, .request = sunxi_pmx_request,