From patchwork Thu Oct 5 02:58:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 13409720 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5B3D9E936F8 for ; Thu, 5 Oct 2023 02:59:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cp7NhI55tFcdcBaykPP3HHwswrTMMh8hAKIpc5Np3Kg=; b=rNgS9ytAYx5T24 5RTOZtWGTK6Wx0eYk1YO2op94mjdrSRE3HtIWst7qlUZsKE4F+Ge7qsVHcHqV6XT9KU3UcE8kfvVH iBvT73GTUq8TK5qLHHgFf/4FuUPLt0h6bxWfsUfneMXXWIU9NIKwWXWD4FTVQ8cjqnpLQmIz0iBGg jchQ1aOAZ34kfd4Kyx3sZdHzJIU4dScMd0bKIDPST2uGGOb3AG1V/qyaKV1fT6L6hbiQISVUz6ZK2 dY1kO4hx9FFFd4+6jWiEHlP8efyQ1Px3F0k95+wjiixVx2SpOpjnTD5LBgi9CB2AytXaxGxGZmKPf vhKWQJY1lMZVvacsAuSw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qoEaF-001GoQ-24; Thu, 05 Oct 2023 02:59:27 +0000 Received: from mail-ot1-x32d.google.com ([2607:f8b0:4864:20::32d]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qoEaC-001Gnb-26 for linux-arm-kernel@lists.infradead.org; Thu, 05 Oct 2023 02:59:26 +0000 Received: by mail-ot1-x32d.google.com with SMTP id 46e09a7af769-6c61dd1c229so94834a34.0 for ; Wed, 04 Oct 2023 19:59:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696474763; x=1697079563; darn=lists.infradead.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; bh=C71OcQAzBT261vJLaVS0ZLT3a6uuXRpHLmHkJwsnefw=; b=m1F6hPjbzt/mFd4Oz3arf4pH96hJBFKpCvd3MiPCHoVlGLgu2iTxSc1r1oZspuugo2 BL/eCuqByBN2TRVF/rUAiUAt/JZObtnZ+FaHoF+84U67OJYQm9y8z0DwMkvcqMZs2QQZ 6Yz0TIi9UIUhzgsox8pN+dcwdzJEM3VPyuRE4w/VNBbm0wEo1RLWuMpaSK+BtkFRTBQT jlBuxyl4xuCW/jblzGLGzJR5Z5VXnuEYMx0QblVtnbMfv+2dRH1CI2lyANmXyBFtR/l4 Jg0lxg7k0XBzAbeNEssiTxP54QXZi17nmChVEOuYwsJlw7y4m+XxIW5BETo3GfEs0wS9 q8Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696474763; x=1697079563; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=C71OcQAzBT261vJLaVS0ZLT3a6uuXRpHLmHkJwsnefw=; b=hstoTrvCULrL4ITiaF0eOJwkRPv+/s3mZnB9R3+gvSgh3KRKLp0S4y3M2Ub7PYhVIg /L+U9PIbU7+stclCCCXcX9R69uIYyHI5Dx57wyz5A2W6zbydp2+/0BcQtNhx6Z+JN68v qzFm23VY9w2J/VRLyfxUj6ynzqW7ZuoPmQ7Z9Yk69huC5SaaURaboo4kXAQ/9CukIhv+ oR+dcDHJGWPsP7B3VFsBLNEF5U9SBIUF4m263eonJgM8OSsd+2CRhFfsDpqspvgaa32n iZUpjyIB/ZxZ5lXJmPB7j2nxGo6VuOTYbB2Wp0gcDvGqGaefLCbnOzMzGbEz+Bp9XmXT 4sLg== X-Gm-Message-State: AOJu0YwenHb1VJR3UP1pLX3xlDGUw5OT07BAjun4/mGqGUIMMC1C35ue ry8lilahXFLFdqJxWPOHIn+qGg== X-Google-Smtp-Source: AGHT+IFLE3a+7Vp/OvWCFi9446MZ5SR2US5WlY9g/kRa6BRPFqm4JfQA8hECuQL2KLgO1V/YM25PiQ== X-Received: by 2002:a05:6830:4867:b0:6bf:500f:b570 with SMTP id dx7-20020a056830486700b006bf500fb570mr3559438otb.3.1696474763244; Wed, 04 Oct 2023 19:59:23 -0700 (PDT) Received: from octopus.. ([2400:4050:c3e1:100:a16d:fce2:497:afb7]) by smtp.gmail.com with ESMTPSA id b18-20020a637152000000b005782ad723casm269265pgn.27.2023.10.04.19.59.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 19:59:22 -0700 (PDT) From: AKASHI Takahiro To: sudeep.holla@arm.com, cristian.marussi@arm.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, linus.walleij@linaro.org Cc: Oleksii_Moisieiev@epam.com, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, AKASHI Takahiro Subject: [RFC v2 1/5] pinctrl: define PIN_CONFIG_INPUT Date: Thu, 5 Oct 2023 11:58:39 +0900 Message-Id: <20231005025843.508689-2-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231005025843.508689-1-takahiro.akashi@linaro.org> References: <20231005025843.508689-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231004_195924_691908_180638DD X-CRM114-Status: GOOD ( 12.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This configuration is intended to be used to allow a pin controller based GPIO driver to obtain a value at a gpio input pin. Signed-off-by: AKASHI Takahiro Reviewed-by: Linus Walleij --- RFC v2 (Oct 5, 2023) * improve a comment against @PIN_CONFIG_INPUT as per Linus RFC(Oct 2, 2023) --- include/linux/pinctrl/pinconf-generic.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h index d74b7a4ea154..da0d80aa532d 100644 --- a/include/linux/pinctrl/pinconf-generic.h +++ b/include/linux/pinctrl/pinconf-generic.h @@ -67,6 +67,10 @@ struct pinctrl_map; * passed as argument. The argument is in mA. * @PIN_CONFIG_DRIVE_STRENGTH_UA: the pin will sink or source at most the current * passed as argument. The argument is in uA. + * @PIN_CONFIG_INPUT: This will obtain a value on an input pin. To put a line + * into input mode, @PIN_CONFIG_INPUT_ENABLE must be used. Otherwise, + * an error will be returned. The returned argument is 1 for logic high + * and 0 for logic low. * @PIN_CONFIG_INPUT_DEBOUNCE: this will configure the pin to debounce mode, * which means it will wait for signals to settle when reading inputs. The * argument gives the debounce time in usecs. Setting the @@ -128,6 +132,7 @@ enum pin_config_param { PIN_CONFIG_DRIVE_PUSH_PULL, PIN_CONFIG_DRIVE_STRENGTH, PIN_CONFIG_DRIVE_STRENGTH_UA, + PIN_CONFIG_INPUT, PIN_CONFIG_INPUT_DEBOUNCE, PIN_CONFIG_INPUT_ENABLE, PIN_CONFIG_INPUT_SCHMITT, From patchwork Thu Oct 5 02:58:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 13409721 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A7A9FE936F9 for ; Thu, 5 Oct 2023 02:59:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rzmtcHzvdTejmR1oBgyT/Q3vjsKoV3xGwrzHYmb6BVQ=; b=gWQEnGpg53HpY1 zFrytVYn2Rh4Y02Fos4Z5t5ZTZ98ER4pqQKEZ/CrN5iAC123JgyEQH7K+zEBJZasmZ5m/0U+83ED2 Fi+/fo5sm9w3svRuzZTfqUCFXlaBil4ISVV3fMq0cjcp1XOPPXcQTGzmN/Yj5v/xAjb4MNsm5u4sc 707iWJcYzAWpnIwj7QglkDiGkKrV6SmiHtL3BTqGqLHC5ys8HLvJhwJzd1X6dQsnwVpdPfI8k5F1j DpMibP24k5P+kMXIqhrPDfPD62lOeJtd6Il6YqgEw+1ZZAAXaOhCy1/4+x4erOPTLbWrlbnkEkqAp c5ZFmrHxDhQtZT2+0nQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qoEaI-001Gpa-2y; Thu, 05 Oct 2023 02:59:30 +0000 Received: from mail-oi1-x232.google.com ([2607:f8b0:4864:20::232]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qoEaG-001GoP-0u for linux-arm-kernel@lists.infradead.org; Thu, 05 Oct 2023 02:59:29 +0000 Received: by mail-oi1-x232.google.com with SMTP id 5614622812f47-3ae473c0bd6so76148b6e.0 for ; Wed, 04 Oct 2023 19:59:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696474767; x=1697079567; darn=lists.infradead.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; bh=TSbRKsYb8q8GitmB/U1RL+XJyPpceXOp7I/10Xz1sb8=; b=GSqkdGRIv2NYn+J9iRCbFcwQEBh8UvRoe6xDcJ1Vq0PYOcPSWpwAa65jXsqouASw04 Bml6RgNdJfxDzLmsUVCM+be0k21SOHoRDEorWrJ45OyshfEehpdtZ8X471kHcOv28gyd 3GveL/HSQaxsjrmk32at72MFeJc9LRJDWG0JmrukIFSRFVRpoZ/Ix5UKumHGtGgABH4C v4oQoDhNNXgeRe4bcr3XkSz6RwK7N9JQyF1gCzKlC2j4hbVWR0345ZwSbHe7yVK+DHJa A9ZFxYCe4RG49V1Y+0Ip+Q09FDKK2NQYS04qF+gfKjH/pI99fHCLmyioWdKtqNZuALVL OYjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696474767; x=1697079567; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TSbRKsYb8q8GitmB/U1RL+XJyPpceXOp7I/10Xz1sb8=; b=kTMAD7sYLXqybU/HG+QQydGZZ29lxiqci2ndjBtXPCxkfHBCQpT+rC8MyZu3Sv290n KNy4nbSqUX0dJUK0sQR6fkr4vZWE1Jft7NFXhqus01RBL+dKGcP0ngzR4gzOEduE4Laz cfFe//AXfceD0HsuPyHbXeZhXn93tpmBbOYGTA8qAwwyiOvpHB2bV461zIaFSzPN8qB7 aVfzyPrt+WqEqwEPhNmQyiArxvIbXrCR6M9kKEHsltEITP8WyH1tjtqK5HRf/5j/umrS TIBy/i+sEHECAVRhEXpINNKHmvYw941X2WBt6tDICMKKiEd9bLdji7QpctrdnQ+c4UfX RfMg== X-Gm-Message-State: AOJu0YzkpufJUu1hkL0xpAJjKDcUpIjivFhtPa0ugXTEFo4iRGbF0ZqH VnwKPguvdapw2RFoAi0J+JTX2A== X-Google-Smtp-Source: AGHT+IEvgr4xZLoO3AM+An1x16yJUdYmGeTqCDtyfPw8q8eOIK+ezaH2/Gf3R2hl6ENX1z8p9dBrGw== X-Received: by 2002:a05:6808:1a27:b0:3ae:5e6a:5693 with SMTP id bk39-20020a0568081a2700b003ae5e6a5693mr4930128oib.0.1696474766819; Wed, 04 Oct 2023 19:59:26 -0700 (PDT) Received: from octopus.. ([2400:4050:c3e1:100:a16d:fce2:497:afb7]) by smtp.gmail.com with ESMTPSA id b18-20020a637152000000b005782ad723casm269265pgn.27.2023.10.04.19.59.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 19:59:26 -0700 (PDT) From: AKASHI Takahiro To: sudeep.holla@arm.com, cristian.marussi@arm.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, linus.walleij@linaro.org Cc: Oleksii_Moisieiev@epam.com, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, AKASHI Takahiro , kernel test robot Subject: [RFC v2 2/5] pinctrl: always export pin_config_get_for_pin() Date: Thu, 5 Oct 2023 11:58:40 +0900 Message-Id: <20231005025843.508689-3-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231005025843.508689-1-takahiro.akashi@linaro.org> References: <20231005025843.508689-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231004_195928_320690_B6CC3C0F X-CRM114-Status: GOOD ( 12.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This function will be used to implement a new pinctrl_gpio_get_config() outside pinconf.c in a succeeding commit. So make it always visible to avoid a kernel test bot error. Signed-off-by: AKASHI Takahiro Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202310021320.gYfm1nLQ-lkp@intel.com/ Reviewed-by: Linus Walleij --- RFC v2 (Oct 5, 2023) * new --- drivers/pinctrl/pinconf.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/pinconf.h b/drivers/pinctrl/pinconf.h index 694bfc9961fa..068089b199e4 100644 --- a/drivers/pinctrl/pinconf.h +++ b/drivers/pinctrl/pinconf.h @@ -31,13 +31,13 @@ int pinconf_apply_setting(const struct pinctrl_setting *setting); int pinconf_set_config(struct pinctrl_dev *pctldev, unsigned pin, unsigned long *configs, size_t nconfigs); +int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned pin, + unsigned long *config); /* * You will only be interested in these if you're using PINCONF * so don't supply any stubs for these. */ -int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned pin, - unsigned long *config); int pin_config_group_get(const char *dev_name, const char *pin_group, unsigned long *config); @@ -74,6 +74,12 @@ static inline int pinconf_set_config(struct pinctrl_dev *pctldev, unsigned pin, return -ENOTSUPP; } +static inline int pin_config_get_for_pin(struct pinctrl_dev *pctldev, + unsigned pin, unsigned long *config) +{ + return -ENOTSUPP; +} + #endif #if defined(CONFIG_PINCONF) && defined(CONFIG_DEBUG_FS) From patchwork Thu Oct 5 02:58:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 13409722 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DD222E936F8 for ; Thu, 5 Oct 2023 02:59:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wRjYAPpzZhCF17TstlRBG5DBGsh/uLq94zKvz1+167U=; b=1lktU1b+LqLx0A 5X2WOfsL+G4DnhMNzZbqdjC0y6OCl/Ck6iDwiXpx2lSdeQhd70kp5xYxXnQnEqmGfCL+slEslqA+J FJa1d9v++pxCR1fHXnzqU/iZfNKRr8Zhh26ffj6Ahkg9IUSd4j1B0Sk+oheUSRqtACoiUXMCDrwf+ 5krtvUQY8CzkXBL/oBAEeDoMtamr7ImeDErq4ri40ilZopAyNvq1KWtYMCcdAoRlhBNS3HGoeTS0l RHDd2GmADMpwO72jSVuqcT+zUNszxFPRPcrIWg9xGrXzl4ya+wmlByHjvkNdwoDgVPNIAj81j1dN4 OdD0J3SsKuZJIQ7FME/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qoEaN-001Grc-1y; Thu, 05 Oct 2023 02:59:35 +0000 Received: from mail-ot1-x32e.google.com ([2607:f8b0:4864:20::32e]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qoEaJ-001Gpb-2s for linux-arm-kernel@lists.infradead.org; Thu, 05 Oct 2023 02:59:34 +0000 Received: by mail-ot1-x32e.google.com with SMTP id 46e09a7af769-6c61dd1c229so94852a34.0 for ; Wed, 04 Oct 2023 19:59:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696474770; x=1697079570; darn=lists.infradead.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; bh=10JswCDtKjfsgUgjTt05ZkVWjMO4ZebDQWE8d7lo6tc=; b=e7m+IslFzwMjjOrbECji0eHoHtL6BTjgrKFtyBcVJ8A3OPAyPdIMR/I1ddLZdEd8bm bDQY8K9rKJktm6Sxaq0zQKPgwMa+f2ExoQHi/qeMWjw/aXXDtZ0Sy/jCrCxNsIfHnpl1 KSAtxCk5ohd1QakguBhHZpcJGjU3xM7izaJKqeREn9Kxt7dzW/o+EcYstjAvTvqwlVSm CXTyfTSpgSMO5izBs4EazF0dAN3g3F18qZmVrygjlJuQT0xaR1/kly7rmOiZQ95p/dlN onpdXuX5n64S7HCiKyMTWd1QHeG4j28JIbTdbZPX8GL+17sPhiY+TXjo0QhW8DdNa95O 2RdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696474770; x=1697079570; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=10JswCDtKjfsgUgjTt05ZkVWjMO4ZebDQWE8d7lo6tc=; b=OLv5rxnBXDz7FxDk5lQcGII2O7z0yo/SeoBGwYhRjVlQ2uceGGtxsl0aaVzJ0dfYqM v88qeQyJKUyXOrlSJ9B0WOLFSPqMHpDpOYH+CFyCmrav8jrF/O82utFAEHhD6XcwpLpY SlNwCvLxPSyVxRF1HRJVIsO/rBAowv4egnKMXho+URi8+oRVXuz1b7MQ+LD9jhRPuTQZ +x7PpibDhpV/xkLXDne8ooHay6MfZ2fpfSXXems2NdCpQMWYMN02q60/h3qZRRU232ue JKXNHNynzMhMpC4WfkuNJkUbIu4oDo1HpYi3EpSigCvCvp5vsHuT/qeqE0TRbVOpiWB2 f64Q== X-Gm-Message-State: AOJu0YyhZb6Q7vpgommI+oFWGBZ08uw/7bMMN0de+R3YOKVAqcq5FXPM fur+E1qGPtt4HhAWUEipPpNJTg== X-Google-Smtp-Source: AGHT+IFVHEUYGWZTaKBOTIg0Zt8j6bgzzj5zfngX59+MW1xuz8QaG4UOkQ4Qt1xPSuv/ln7C4yvMeg== X-Received: by 2002:a05:6808:15a8:b0:3ad:f3c0:5da3 with SMTP id t40-20020a05680815a800b003adf3c05da3mr4643158oiw.3.1696474770489; Wed, 04 Oct 2023 19:59:30 -0700 (PDT) Received: from octopus.. ([2400:4050:c3e1:100:a16d:fce2:497:afb7]) by smtp.gmail.com with ESMTPSA id b18-20020a637152000000b005782ad723casm269265pgn.27.2023.10.04.19.59.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 19:59:30 -0700 (PDT) From: AKASHI Takahiro To: sudeep.holla@arm.com, cristian.marussi@arm.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, linus.walleij@linaro.org Cc: Oleksii_Moisieiev@epam.com, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, AKASHI Takahiro Subject: [RFC v2 3/5] pinctrl: add pinctrl_gpio_get_config() Date: Thu, 5 Oct 2023 11:58:41 +0900 Message-Id: <20231005025843.508689-4-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231005025843.508689-1-takahiro.akashi@linaro.org> References: <20231005025843.508689-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231004_195931_930000_782FF0C4 X-CRM114-Status: GOOD ( 12.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This is a counterpart of pinctrl_gpio_set_config() which will be used, at least initially, to implement gpio_get interface in pin controller based generic gpio driver. Signed-off-by: AKASHI Takahiro Reviewed-by: Linus Walleij --- RFC (Oct 2, 2023) --- drivers/pinctrl/core.c | 19 +++++++++++++++++++ include/linux/pinctrl/consumer.h | 8 ++++++++ 2 files changed, 27 insertions(+) diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index e9dc9638120a..2f9c2efdfe0e 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c @@ -926,6 +926,25 @@ int pinctrl_gpio_set_config(unsigned gpio, unsigned long config) } EXPORT_SYMBOL_GPL(pinctrl_gpio_set_config); +int pinctrl_gpio_get_config(unsigned int gpio, unsigned long *config) +{ + struct pinctrl_gpio_range *range; + struct pinctrl_dev *pctldev; + int ret, pin; + + ret = pinctrl_get_device_gpio_range(gpio, &pctldev, &range); + if (ret) + return ret; + + mutex_lock(&pctldev->mutex); + pin = gpio_to_pin(range, gpio); + ret = pin_config_get_for_pin(pctldev, pin, config); + mutex_unlock(&pctldev->mutex); + + return ret; +} +EXPORT_SYMBOL_GPL(pinctrl_gpio_get_config); + static struct pinctrl_state *find_state(struct pinctrl *p, const char *name) { diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h index 4729d54e8995..852fac97a79b 100644 --- a/include/linux/pinctrl/consumer.h +++ b/include/linux/pinctrl/consumer.h @@ -31,6 +31,8 @@ extern void pinctrl_gpio_free(unsigned gpio); extern int pinctrl_gpio_direction_input(unsigned gpio); extern int pinctrl_gpio_direction_output(unsigned gpio); extern int pinctrl_gpio_set_config(unsigned gpio, unsigned long config); +extern int pinctrl_gpio_get_config(unsigned int gpio, + unsigned long *config); extern struct pinctrl * __must_check pinctrl_get(struct device *dev); extern void pinctrl_put(struct pinctrl *p); @@ -92,6 +94,12 @@ static inline int pinctrl_gpio_set_config(unsigned gpio, unsigned long config) return 0; } +static inline int pinctrl_gpio_get_config(unsigned int gpio, + unsigned long *config) +{ + return 0; +} + static inline struct pinctrl * __must_check pinctrl_get(struct device *dev) { return NULL; From patchwork Thu Oct 5 02:58:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 13409723 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 03A59E936ED for ; Thu, 5 Oct 2023 03:00:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gWZvDGhNDIwIcEJtCcyYdAoPmlEvyd+8Yo1619BxjLo=; b=QkY0gIihpchKmL FKNzSMJZBfb5tIbizuE7FoXNAbx9Ir5sTBLR1EjG6R56EIVUbFMZ+9VfNFC5drQZXGt2FCv1x3un9 kxBmqGV2CPbXcNswWiN8bThmhZpedqMqqlrBf/iz5frUZpBLLiYNU/16QxKvFC+025bdOUWvUnEGY GpFv+VEAT5JJAyBk0hlclTkUpOmuRpBCW+WYuni4XCtfQ6CMzN844nHbdzoCZ9A2FEigaUJmnq4Fn R5OFWz0Cq4+2sx3nhcrbqp3R/hVtUOMHBGMvFhK1JiKBeWC5HA2zdgnWzpfMGqqSimilAEMqIlzeS nnV6RYe34ziYF93PStqQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qoEaR-001Gt0-10; Thu, 05 Oct 2023 02:59:39 +0000 Received: from mail-io1-xd2f.google.com ([2607:f8b0:4864:20::d2f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qoEaN-001Gqn-1Y for linux-arm-kernel@lists.infradead.org; Thu, 05 Oct 2023 02:59:37 +0000 Received: by mail-io1-xd2f.google.com with SMTP id ca18e2360f4ac-7a24c86aae3so8587639f.0 for ; Wed, 04 Oct 2023 19:59:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696474774; x=1697079574; darn=lists.infradead.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; bh=o8UbiRXeWQbu5CCxehWCFCKEGYBPmnXfSamsU23VNAk=; b=U4jobjY0cAoH21O5eWknEJbBUpvcJa/B6eq+A6QaG2ZGn2Rfa+Y3RIZUVPhAjazjRR ZiwbNn7d5o17FYktwCCBPJvKm++T9YT++uCn8TFUQTqioeTWkI45CpYN48egVzzigdwk szl86V9JqoonRvuG/wZNkcHJMnE24TRrKcmks9Nw581hN1xghgXa8FpkZjgA/8wKRQU5 iKeGfUQnCRHICjIKsL3XBqS07K40vxnL7BdvAwow0gUh6Lycp/OV8Pxaiv4NbjvC5Imp HYcekB+fEQPeaAMtfqOiKcd4l8IYgVjJGnc3ceFRJ5jLmXzeIAKUesKKRhsBkQj7YTsK FJ0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696474774; x=1697079574; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=o8UbiRXeWQbu5CCxehWCFCKEGYBPmnXfSamsU23VNAk=; b=pnHvjqbXOrqQm32iO1nF6TYGEfSXRWHaND7KpkqPPyhVd89mLugvJiK9ltboyLNU2L OQJfyZikZhykrKBUkSnqIHItYAl5UmZytkkyysNAwNgY6hv4+Ah+v9XzFL6b91aPcejN 2rbLu8ivMCu1NDATZwNAt0j4vKcKBaX9qXhlwS/tzza4HcgxFSJleQl+NhLUNnjHROD7 L63wrzE/EbSzAJwgPsK80Z99yBpQ9iOyKWzihPa67il+5PoRomSRNPNSj3E7CF6i7k/x gtDxA0qeXVRZnIqSEYaqBCnFG/xzmvUHhk+UVIZ+pojIckRXhVMbsEikBa0NZopMYNwS bFiw== X-Gm-Message-State: AOJu0YzsSXYP66q5kuCiNXJVu/onoplCE4KGg0i9qRIvtYUsutoU/j7Y xnKlmRHnDR5r/5zf6ZjScX7yZ67GeuBwEnh4a4gMcQ== X-Google-Smtp-Source: AGHT+IEIo4FgrkyprKPEFogjQ8fMf3lI1H/+E2BdJpeZVdJkotQfybd+YwiLDuLtUjYGfdM29DxTOg== X-Received: by 2002:a92:dacd:0:b0:351:1ed0:5c6b with SMTP id o13-20020a92dacd000000b003511ed05c6bmr3933124ilq.3.1696474774015; Wed, 04 Oct 2023 19:59:34 -0700 (PDT) Received: from octopus.. ([2400:4050:c3e1:100:a16d:fce2:497:afb7]) by smtp.gmail.com with ESMTPSA id b18-20020a637152000000b005782ad723casm269265pgn.27.2023.10.04.19.59.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 19:59:33 -0700 (PDT) From: AKASHI Takahiro To: sudeep.holla@arm.com, cristian.marussi@arm.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, linus.walleij@linaro.org Cc: Oleksii_Moisieiev@epam.com, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, AKASHI Takahiro Subject: [RFC v2 4/5] gpio: add pinctrl based generic gpio driver Date: Thu, 5 Oct 2023 11:58:42 +0900 Message-Id: <20231005025843.508689-5-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231005025843.508689-1-takahiro.akashi@linaro.org> References: <20231005025843.508689-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231004_195935_523047_58DABE2F X-CRM114-Status: GOOD ( 24.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Some pin controllers provide not only a method to set up lines but also gpio function. With this commit, a new generic gpio driver will be provided. It is implemented purely by using pinctrl interfaces. One of such pin controllers is Arm's SCMI. Signed-off-by: AKASHI Takahiro --- RFC v2 (Oct 5, 2023) * rename the driver to pin-control-gpio (CONFIG_GPIO_BY_PINCTRL) * return meaningful error codes instead of -1 * remove the masking at PIN_CONFIG_PACKED * handle emulated OPEN_DRAIN configuration at get_direction() * define config_set in gpio_chip * drop remove hook RFC (Oct 2, 2023) --- drivers/gpio/Kconfig | 7 ++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-by-pinctrl.c | 165 +++++++++++++++++++++++++++++++++ 3 files changed, 173 insertions(+) create mode 100644 drivers/gpio/gpio-by-pinctrl.c diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 673bafb8be58..a60972be114c 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -216,6 +216,13 @@ config GPIO_BRCMSTB help Say yes here to enable GPIO support for Broadcom STB (BCM7XXX) SoCs. +config GPIO_BY_PINCTRL + tristate "GPIO support based on a pure pin control backend" + depends on GPIOLIB + help + Select this option to support GPIO devices based solely on pin + control, specifically pin configuration, such as SCMI. + config GPIO_CADENCE tristate "Cadence GPIO support" depends on OF_GPIO diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index eb73b5d633eb..71458d81e16a 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -43,6 +43,7 @@ obj-$(CONFIG_GPIO_BD71828) += gpio-bd71828.o obj-$(CONFIG_GPIO_BD9571MWV) += gpio-bd9571mwv.o obj-$(CONFIG_GPIO_BRCMSTB) += gpio-brcmstb.o obj-$(CONFIG_GPIO_BT8XX) += gpio-bt8xx.o +obj-$(CONFIG_GPIO_BY_PINCTRL) += gpio-by-pinctrl.o obj-$(CONFIG_GPIO_CADENCE) += gpio-cadence.o obj-$(CONFIG_GPIO_CLPS711X) += gpio-clps711x.o obj-$(CONFIG_GPIO_SNPS_CREG) += gpio-creg-snps.o diff --git a/drivers/gpio/gpio-by-pinctrl.c b/drivers/gpio/gpio-by-pinctrl.c new file mode 100644 index 000000000000..c297a9633e03 --- /dev/null +++ b/drivers/gpio/gpio-by-pinctrl.c @@ -0,0 +1,165 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// Copyright (C) 2023 Linaro Inc. +// Author: AKASHI takahiro + +#include +#include +#include +#include +#include +#include +#include "gpiolib.h" + +struct pin_control_gpio_priv { + struct gpio_chip chip; +}; + +static int pin_control_gpio_get_direction(struct gpio_chip *chip, + unsigned int offset) +{ + unsigned long config; + bool out_en, in_en; + int ret; + + config = PIN_CONFIG_OUTPUT_ENABLE; + ret = pinctrl_gpio_get_config(chip->gpiodev->base + offset, &config); + if (!ret) + out_en = !!config; + else if (ret == -EINVAL) + out_en = false; + else + return ret; + + config = PIN_CONFIG_INPUT_ENABLE; + ret = pinctrl_gpio_get_config(chip->gpiodev->base + offset, &config); + if (!ret) + in_en = !!config; + else if (ret == -EINVAL) + in_en = false; + else + return ret; + + if (in_en && !out_en) + return GPIO_LINE_DIRECTION_IN; + + if (!in_en && out_en) + return GPIO_LINE_DIRECTION_OUT; + + if (in_en && out_en) { + /* This may be an emulation for output with open drain */ + config = PIN_CONFIG_DRIVE_OPEN_DRAIN; + ret = pinctrl_gpio_get_config(chip->gpiodev->base + offset, + &config); + if (!ret && config) + return GPIO_LINE_DIRECTION_OUT; + } + + return -EINVAL; +} + +static int pin_control_gpio_direction_input(struct gpio_chip *chip, + unsigned int offset) +{ + return pinctrl_gpio_direction_input(chip->gpiodev->base + offset); +} + +static int pin_control_gpio_direction_output(struct gpio_chip *chip, + unsigned int offset, int val) +{ + return pinctrl_gpio_direction_output(chip->gpiodev->base + offset); +} + +static int pin_control_gpio_get(struct gpio_chip *chip, unsigned int offset) +{ + unsigned long config; + int ret; + + config = PIN_CONFIG_INPUT; + ret = pinctrl_gpio_get_config(chip->gpiodev->base + offset, &config); + if (ret) + return ret; + + if (config >> 8) + return 1; + + return 0; +} + +static void pin_control_gpio_set(struct gpio_chip *chip, unsigned int offset, + int val) +{ + unsigned long config; + + config = PIN_CONF_PACKED(PIN_CONFIG_OUTPUT, val); + + pinctrl_gpio_set_config(chip->gpiodev->base + offset, config); +} + +static u16 sum_up_ngpios(struct gpio_chip *chip) +{ + struct gpio_pin_range *range; + struct gpio_device *gdev = chip->gpiodev; + u16 ngpios = 0; + + list_for_each_entry(range, &gdev->pin_ranges, node) { + ngpios += range->range.npins; + } + + return ngpios; +} + +static int pin_control_gpio_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct pin_control_gpio_priv *priv; + struct gpio_chip *chip; + int ret; + + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + chip = &priv->chip; + chip->label = dev_name(dev); + chip->parent = dev; + chip->base = -1; + + chip->request = gpiochip_generic_request; + chip->free = gpiochip_generic_free; + chip->get_direction = pin_control_gpio_get_direction; + chip->direction_input = pin_control_gpio_direction_input; + chip->direction_output = pin_control_gpio_direction_output; + chip->get = pin_control_gpio_get; + chip->set = pin_control_gpio_set; + chip->set_config = gpiochip_generic_config; + + ret = devm_gpiochip_add_data(dev, chip, priv); + if (ret) + return ret; + + chip->ngpio = sum_up_ngpios(chip); + + platform_set_drvdata(pdev, priv); + + return 0; +} + +static const struct of_device_id pin_control_gpio_match[] = { + { .compatible = "pin-control-gpio" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, pin_control_gpio_match); + +static struct platform_driver pin_control_gpio_driver = { + .probe = pin_control_gpio_probe, + .driver = { + .name = "pin-control-gpio", + .of_match_table = pin_control_gpio_match, + }, +}; +module_platform_driver(pin_control_gpio_driver); + +MODULE_AUTHOR("AKASHI Takahiro "); +MODULE_DESCRIPTION("Pinctrl based GPIO driver"); +MODULE_LICENSE("GPL"); From patchwork Thu Oct 5 02:58:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 13409724 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5F4C4E936F8 for ; Thu, 5 Oct 2023 03:00:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=scgTZLbjuPrjp5FDMa9P+6iyCvO4N+RgXdLd9v6y7gY=; b=aCikspAx9LuMgi Kh+nAzytNzLws1N9PeIi1xGgTtE/RTHGkaA04S13ncSmrfra6TI9D1x0Oc6uy2L1ik47eab77KQEU yJIzqkpIDz00lOsOD0XzReMWnfMxXWuF5jbFOI3xD2L6zsB7fmUVzOTwswMVoCSJRursYWmwq2Ojh Z1yC/g18V/XcPEjbNnQojswudUUveQ+t8qAqciqFIcZ/8bXFHHKMOTWcHRAtKcf5NOzIPzPCWl71K XlUrVuzIa9zxLZyj0HdhOOsmjvnac2fLMYZ88Lso2AgTSZj2cATIUBnnbKwf+7TKu7jpTShQHnGP4 CGsn/0Fg0M0wc3NMo8og==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qoEaY-001Gvi-0D; Thu, 05 Oct 2023 02:59:46 +0000 Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qoEaV-001GsQ-0a for linux-arm-kernel@lists.infradead.org; Thu, 05 Oct 2023 02:59:44 +0000 Received: by mail-ot1-x32a.google.com with SMTP id 46e09a7af769-6c7a4735a30so92760a34.1 for ; Wed, 04 Oct 2023 19:59:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696474777; x=1697079577; darn=lists.infradead.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; bh=sRZiziU1GNu5avPXv2QF3oc3h3U4ax78pgVXLevlQ+c=; b=TDyPpiFTQppZWspmSu3WXAxRJK4f+r7Mp8rbxJds9KYj6dJJscmDkMqv57H4LcZFZ1 Nzv/G2t80JWHRQ036iuHvJkdDgwb8fuSn80po/OEbwty9PIALq/JZVM4WFyw1arFdZ5R nWK368Dspt8VvIbzmLdwPFpaoAhsI0RJzsm/WHe+VrLRTdt5LPG8+0+uIVoGNbc7PRRA Sew351OnuNBOmOLyW7jOO4acd6PirfXQ8ldjV25iFpwk5da3pJ/VNa+IAux34/kJ+XlW J8YTNSlxGZK1hjLBIKa2J6O+JS8DypiXix7HPm4xbWR7udpiRiEvFodCeOuBE+FDp6GR 3iYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696474777; x=1697079577; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sRZiziU1GNu5avPXv2QF3oc3h3U4ax78pgVXLevlQ+c=; b=QJo+wcgdIC+UFeWWOpdnvOzEGXl56BhdlxcruG1NUKW/KHoXwitdOhbgrMiWApETFX K7aOdG6UgyPxfI1+KbFIK/4P8NRvqdPlcg5ybcR4LYSNWC4igle4rInebAnmLWNwb2k4 oACdkjYQ7vzkmCPrxkoo3jpqQ3jj71NBgXmr/fk6L2w1fGTkcFmdvcBLDmQwnySUBlV4 cZhNQfeAUAfrtcK9ml4vVhig0W0YK+506HTI8Hn9JtSyYp/vmTZm97wDmGAmQvTvlwno 6SnrsJ2erWxXaSKcCJ9pPYoo6/BosmWGF+naK/ZKwjujAX0DRAdJO8aFQY7fYoE7ozHt cl2Q== X-Gm-Message-State: AOJu0YxE1AvlN2FYZpeWp53zf8Ax7/JEuIWzgn75BRp4mArbbwXlSHCW ZC0hANhe9rspjornBa6QhOKauA== X-Google-Smtp-Source: AGHT+IGuF37bJRXm/rwj6uHFmdz4QeyGcUcT5VR8YemY6FCQGga77AWz0oRvrMhJuov669/ftxBMyw== X-Received: by 2002:a05:6808:138b:b0:3ad:aadd:6cbf with SMTP id c11-20020a056808138b00b003adaadd6cbfmr4953939oiw.0.1696474776920; Wed, 04 Oct 2023 19:59:36 -0700 (PDT) Received: from octopus.. ([2400:4050:c3e1:100:a16d:fce2:497:afb7]) by smtp.gmail.com with ESMTPSA id b18-20020a637152000000b005782ad723casm269265pgn.27.2023.10.04.19.59.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 19:59:36 -0700 (PDT) From: AKASHI Takahiro To: sudeep.holla@arm.com, cristian.marussi@arm.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, linus.walleij@linaro.org Cc: Oleksii_Moisieiev@epam.com, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, AKASHI Takahiro Subject: [RFC v2 5/5] dt-bindings: gpio: Add bindings for pinctrl based generic gpio driver Date: Thu, 5 Oct 2023 11:58:43 +0900 Message-Id: <20231005025843.508689-6-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231005025843.508689-1-takahiro.akashi@linaro.org> References: <20231005025843.508689-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231004_195943_219561_5E2ECFB8 X-CRM114-Status: GOOD ( 13.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org A dt binding for pin controller based generic gpio driver is defined in this commit. One usable device is Arm's SCMI. Signed-off-by: AKASHI Takahiro --- RFC v2 (Oct 5, 2023) * rename the binding to pin-control-gpio * add the "description" * remove nodename, hog properties, and a consumer example RFC (Oct 2, 2023) --- .../bindings/gpio/pin-control-gpio.yaml | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/pin-control-gpio.yaml diff --git a/Documentation/devicetree/bindings/gpio/pin-control-gpio.yaml b/Documentation/devicetree/bindings/gpio/pin-control-gpio.yaml new file mode 100644 index 000000000000..bc935dbd7edb --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/pin-control-gpio.yaml @@ -0,0 +1,55 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/gpio/pin-control-gpio.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Pin control based generic GPIO controller + +description: + The pin control-based GPIO will facilitate a pin controller's ability + to drive electric lines high/low and other generic properties of a + pin controller to perform general-purpose one-bit binary I/O. + +maintainers: + - AKASHI Takahiro + +properties: + compatible: + const: pin-control-gpio + + gpio-controller: true + + "#gpio-cells": + const: 2 + + gpio-ranges: true + + gpio-ranges-group-names: true + +patternProperties: + "^.+-hog(-[0-9]+)?$": + type: object + + required: + - gpio-hog + +required: + - compatible + - gpio-controller + - "#gpio-cells" + - gpio-ranges + +additionalProperties: false + +examples: + - | + gpio0: gpio@0 { + compatible = "pin-control-gpio"; + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&scmi_pinctrl 0 10 5>, + <&scmi_pinctrl 5 0 0>; + gpio-ranges-group-names = "", + "pinmux_gpio"; + };