Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp5462926pxb; Mon, 28 Mar 2022 12:49:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1jFZYMsBKJi9NkGA49kPJsRno1fb9+ban+8cWdMP0QGh77yvlAG8hARMarrTQu08GxHcr X-Received: by 2002:a17:906:c103:b0:6e0:df50:7f52 with SMTP id do3-20020a170906c10300b006e0df507f52mr14496475ejc.501.1648496990109; Mon, 28 Mar 2022 12:49:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648496990; cv=none; d=google.com; s=arc-20160816; b=WNeg1t9zSQwLwVrrrvn4MOfDzNfHvwwqgzpYwCdcW0bna0W/NzyB66M1oo3bxd6C3l UcQo7G/bxIxkOOhkWEQWCcp6uFhjJlMBdwUgMBSJkA9KJZlG8mT0Flfcidr+MFrHwz7O xbaVWa/W+3rgKuWlRIweKqF3UQxX20rm4FnvOhqJZ9ipBU1YtCAa1e2YybAIiKBc5m3Z wybtp110FEkDiAMSIndD/VTcKkj2mF+URXKbNQtdBieA9Fbw7v5vageYyeRDuSb5q7Cb 70ljpR4HC9KJ8G0bCPOuDEgpmw4jCRhLSmh7ZA/7seXKoFxhXQ/gdEQ4FRBxueiaxZB2 hCVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=CuEcPDB+AlpLfXTqAeWfzXqofQSTcIxpMeVQrjaG4Nk=; b=mL1gzcriuWxAL4+7q+pTG8FGw2G/SYz2JiVVoLNXqNBTMxolJd/fnJLlK5xSFXsroZ GjcE1tDvJwC78Avnst0h2+2++KcxUwhGa1m+cWpgTQjOzBSvgP+uT2m8wi+5ySSli2kD C+ZDAYkDwZChIPdy0K3o6g8Q+ytl5ZSpbxCF967nPyL6NYc9n0SHgYyDpp4xXEFmxgu7 kJ0LlrW3uebRo3wvIwqPb82TOSNpb1eljPQBcA8mey1nHoZ6YnPYhExuuOMwrZXg+0z4 Cu8E3/9bgSJlbvQXEu8rhbON2VqDzOBY9o6Dq4diAc8q6FTQBrk9vUscuLPInCwvld6e YB+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@postmarketos.org header.s=donut header.b="CeL2JT/7"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i13-20020a05640242cd00b00418e70517e6si19465527edc.67.2022.03.28.12.49.22; Mon, 28 Mar 2022 12:49:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@postmarketos.org header.s=donut header.b="CeL2JT/7"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236651AbiC1BCl (ORCPT + 99 others); Sun, 27 Mar 2022 21:02:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237196AbiC1BCb (ORCPT ); Sun, 27 Mar 2022 21:02:31 -0400 Received: from proxmox1.postmarketos.org (proxmox1.postmarketos.org [IPv6:2a01:4f8:a0:821d::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AC5CE4ECE0; Sun, 27 Mar 2022 18:00:50 -0700 (PDT) Received: from localhost.localdomain (cpc78119-cwma10-2-0-cust590.7-3.cable.virginm.net [81.96.50.79]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by proxmox1.postmarketos.org (Postfix) with ESMTPSA id E46AA140193; Mon, 28 Mar 2022 00:50:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=postmarketos.org; s=donut; t=1648428629; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CuEcPDB+AlpLfXTqAeWfzXqofQSTcIxpMeVQrjaG4Nk=; b=CeL2JT/7rrhCyZeiu6hxNT/c/FpFJCMWOh7V/0uP6zoUQRmcQ2p4+tjczMM49dpdvaRnjW 2jrWHgYS/bhHVE09b/DHO6AYRO2+C0WYxvhFvAJBsqGhENrvThvD6TouD+oGLqadGDvG4A RjursQ4ABdzsZ/liMBNriWXQwHG6Aws= From: Caleb Connolly To: Caleb Connolly , Rob Herring , Heiko Stuebner , Linus Walleij , Bartosz Golaszewski , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org Cc: ~postmarketos/upstreaming@lists.sr.ht, martijn@brixit.nl, Arnaud Ferraris Subject: [PATCH 2/4] pinctrl/rockchip: support setting input-enable param Date: Mon, 28 Mar 2022 01:50:03 +0100 Message-Id: <20220328005005.72492-3-kc@postmarketos.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220328005005.72492-1-kc@postmarketos.org> References: <20220328005005.72492-1-kc@postmarketos.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Handle the PIN_CONFIG_INPUT_ENABLE param for configuring GPIOs as input. Signed-off-by: Caleb Connolly --- drivers/pinctrl/pinctrl-rockchip.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index d54fc1cdf609..9d50d9756bb9 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -2129,7 +2129,7 @@ static int rockchip_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin, param = pinconf_to_config_param(configs[i]); arg = pinconf_to_config_argument(configs[i]); - if (param == (PIN_CONFIG_OUTPUT | PIN_CONFIG_INPUT_ENABLE)) { + if (param == PIN_CONFIG_OUTPUT || param == PIN_CONFIG_INPUT_ENABLE) { /* * Check for gpio driver not being probed yet. * The lock makes sure that either gpio-probe has completed @@ -2181,6 +2181,16 @@ static int rockchip_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin, if (rc) return rc; break; + case PIN_CONFIG_INPUT_ENABLE: + rc = rockchip_set_mux(bank, pin - bank->pin_base, + RK_FUNC_GPIO); + if (rc != RK_FUNC_GPIO) + return -EINVAL; + + rc = gpio->direction_input(gpio, pin - bank->pin_base); + if (rc) + return rc; + break; case PIN_CONFIG_DRIVE_STRENGTH: /* rk3288 is the first with per-pin drive-strength */ if (!info->ctrl->drv_calc_reg) -- 2.35.1