From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796471230; b=mBKqUTXWImVKAfICvUnpd2AASzNxa6m8uN2Md5M59MzzPi65ELqJoQvNtIMKkyvr3I3F jNHnGt+561e/yGZwaW4tYxtErKRT081sUHeEaTOEgPBByh+5xC3bF9fQm2ui3ZnDnIHEd R+3+YLDwnKhU/tvoHlKTFH/UcFggndAnHf60aJpT9euXoQXaxT/c8kNKVLNPjpqohT5DU GiNB82Kuhyod0psepeVn/BCRyJnc7oWUf8s6YaVaqrOLX6JRIbTz1QaAJeGYM3uZsP+zE ZkFzKaANrhjSLmAHxKEqakowf6pjsP3wxS8JWw6yXcq8TGVZpqzzlrYVIgW0kBC7lsA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796471230; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Transfer-Encoding; bh=eO1j2FtWSCVbD9NJCdTxj79Mo+/MV9LxO2+zNqPpEDc=; b=xxtKUnT5/uC7IN7Am3bmhOrHYHfRoHcu901Zx0IZeWUikPZnmjdKqWmP9vTu8L/tO9YD 8r/6wh/02RsUOdQwTH/OsPqBJKgzej1rUY9ivBZ88R50slfdDfC+Lkj6yrhBHdf+7j0I9 SssWyifcXYFQhgSQLxxkGKSN3JO/782ig8CTbnNYQC0TXoNGutSz87A2hO4xB8yA2Y3cj /3GGDmzuKeRAOcFbgDbD2OIloHWXmgfVrmIdyRxLQNj0hwzpgL31V39VMnhhKec7KAD86 Zc0chHs2BXrNpItz+JDLWqjBGer1G59My6jncbwm/matQDa5zKb8K06d4HvJ7K0EKNQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=KOGTESgi; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A83CA606A322; Sat, 5 Dec 2026 11:47:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=KOGTESgi Received: by smtp.kernel.org (Postfix) with ESMTPSA id 723E21F00936; Sat, 5 Dec 2026 11:47:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796471230; bh=eO1j2FtWSCVbD9NJCdTxj79Mo+/MV9LxO2+zNqPpEDc=; h=From:To:Cc:Subject:Date; b=KOGTESgi+rhOFor3NbNlW/UDhnUqno2Gy6gPprCsZONhrwvueb3T/C4D+VHiXSQBv DPIQi8yi4xsWJssbOyLWl3MvzEkBRLOgNLH0UuLvWWa0A8D9mmaGqiuOmrcOht2k0v Jn33oMXMxZAuy0HJaWchlSECyrxgQhRLiWjqkRoyCy7aWuYzJ/FhetZMxDehKlQj5b 7yLLZcZ+baHIaxNSSSnZj6H279J1LDWbUwpH18D7p4pAxq9a80ivF7fpJxvenjKoaY b+jotEmn6Go9ZpptOn8MYB43+M5HM6NEb0rQ/v0iLQXAzn5xCnMQ7EVt3dHkrZgQMw OVPlkvtlBsjwg== From: Chen-Yu Tsai To: Linus Walleij Cc: Paul Kocialkowski , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , linux-sunxi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, Andre Przywara Subject: [PATCH v2] pinctrl: sunxi: Implement function_is_gpio Date: Sat, 5 Dec 2026 19:46:58 +0800 Message-ID: <20261205114659.1111076-1-wens@kernel.org> X-Mailer: git-send-email 2.53.0 X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Paul Kocialkowski 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 on strict sunxi pin controllers. Match the "gpio_in" and "gpio_out" function names explicitly. Signed-off-by: Paul Kocialkowski [wens@kernel.org: Match explicit function names] Signed-off-by: Chen-Yu Tsai --- Changes since v1: - Match explicit function names - Link to v1: https://lore.kernel.org/r/20260517171405.3697469-1-paulk@sys-base.io --- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c index bf4ec4665e2b..4c37769d4226 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c @@ -828,6 +828,15 @@ 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 int function) +{ + struct sunxi_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); + const char *name = pctl->functions[function].name; + + return !strcmp(name, "gpio_in") || !strcmp(name, "gpio_out"); +} + static void sunxi_pmx_set(struct pinctrl_dev *pctldev, unsigned pin, u8 config) @@ -974,6 +983,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, -- 2.53.0