From patchwork Mon Jan 21 07:11:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 10772601 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7EB9213B4 for ; Mon, 21 Jan 2019 07:13:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 67C5A29F0D for ; Mon, 21 Jan 2019 07:13:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5BA4D29F0F; Mon, 21 Jan 2019 07:13:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3A80029F0D for ; Mon, 21 Jan 2019 07:13:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=np0YqZR4jfYJjpme3H9r1zck6vXhzQeEGCcSmyTBwdo=; b=SpeDZyzdcs6DvgzmLxyb1Aeb41 B4w3TvhAkKxUtIrDISqYUEFJhTXuYqN3GHoWH4zILr7UkKU9iII9Ulz2ECSdOwSSAgssf1k3PZOIl 8tlh6NMpm2hi4O403xeJt9jk0K3UTSQ2EO/zjdHz6iC4L7ophPeqjLpBtZjsUQ5bmwYS1hSk7iC+t OPAJxOPm+RDrhFVIVYFIqDTfbp42whedOPH9QuriLfrHPbyrLTyM1iTiH88ITHei9cTt3MvJiU6r+ 3UECXV9UGNOmrrFg/8QTgL7rkNniZYtRAnK+bx3uCwZ9FzYKKKLhbPqedGiSS7D0StBL80MvQ7uQX iP6w4qBQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1glTla-00075b-Dg; Mon, 21 Jan 2019 07:13:06 +0000 Received: from mout.kundenserver.de ([212.227.126.131]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1glTkS-0005ra-GV for linux-arm-kernel@lists.infradead.org; Mon, 21 Jan 2019 07:11:59 +0000 Received: from localhost.localdomain ([37.4.249.120]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MNL2Y-1gaxF10XBi-00OmO8; Mon, 21 Jan 2019 08:11:49 +0100 From: Stefan Wahren To: Linus Walleij , Bartosz Golaszewski , Eric Anholt Subject: [PATCH RFC V2 1/4] pinctrl: bcm2835: declare pin config as generic Date: Mon, 21 Jan 2019 08:11:22 +0100 Message-Id: <1548054685-3781-2-git-send-email-stefan.wahren@i2se.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1548054685-3781-1-git-send-email-stefan.wahren@i2se.com> References: <1548054685-3781-1-git-send-email-stefan.wahren@i2se.com> X-Provags-ID: V03:K1:W7iJvxvpubaR/TONDf2upar557qi01vEM4uRb3VUHw/fPALSWZx HBNKTCOki5P0HuBnxLg7pjiyYa6K/4CkgQdgRf5PFnK5iMmI10oKjhz0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RM114-Status: GOOD ( 11.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Wahren , linux-gpio@vger.kernel.org, Lukas Wunner , Peter Robinson , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Since commit 0de704955ee44 ("pinctrl: bcm2835: Add support for generic pinctrl binding") this driver is capable to use the generic interface. So declare this accordingly. Signed-off-by: Stefan Wahren --- drivers/pinctrl/bcm/pinctrl-bcm2835.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c index f180aa4..19eb4fd 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c @@ -969,6 +969,7 @@ static int bcm2835_pinconf_set(struct pinctrl_dev *pctldev, } static const struct pinconf_ops bcm2835_pinconf_ops = { + .is_generic = true, .pin_config_get = bcm2835_pinconf_get, .pin_config_set = bcm2835_pinconf_set, }; From patchwork Mon Jan 21 07:11:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 10772587 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 96EFE1390 for ; Mon, 21 Jan 2019 07:12:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 82E5E29F0A for ; Mon, 21 Jan 2019 07:12:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 76FFD29F0B; Mon, 21 Jan 2019 07:12:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A646A29F0E for ; Mon, 21 Jan 2019 07:12:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=7PpnGNPGMY9i9UO5HwMPCsBNCBDMg+WblPSaxh2hgCU=; b=bFeM7AixK2uIx1iZ3PcUQuu92k 7hEsei0uSGhko+bL4obVH6xtxKzb/eJz1gxhnm92TsSQGBbjwIT+ehfZxhEsZiPAPLvesqtqpYIsl hNgz97LjTsoAvp/W4z+XoRgIOtHxOyD9IGtGTYjedh5u7lg9y0p2DY35YyixootdlU7oLX0LIvs09 g10qEeguC/BiNsvKpEQWimjgMN8gDoMZVtmCmR4ZTPGFeQ5KPp6M1WIM7hVyy+JzLtsPt3oAPDIzt KqY+Uh6ufKrs7jvGf28F90GovbRKRclCpJ+JDkcfPs4tk+M//O2r2gz0dsX7s8nsqTobES4z+2nRW es9NkKUg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1glTkV-0005st-6h; Mon, 21 Jan 2019 07:11:59 +0000 Received: from mout.kundenserver.de ([212.227.126.135]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1glTkR-0005rP-SV for linux-arm-kernel@lists.infradead.org; Mon, 21 Jan 2019 07:11:57 +0000 Received: from localhost.localdomain ([37.4.249.120]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MuDHR-1h3z8S1wOT-00uWEh; Mon, 21 Jan 2019 08:11:49 +0100 From: Stefan Wahren To: Linus Walleij , Bartosz Golaszewski , Eric Anholt Subject: [PATCH RFC V2 2/4] pinctrl: bcm2835: Direct GPIO config changes to generic pinctrl Date: Mon, 21 Jan 2019 08:11:23 +0100 Message-Id: <1548054685-3781-3-git-send-email-stefan.wahren@i2se.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1548054685-3781-1-git-send-email-stefan.wahren@i2se.com> References: <1548054685-3781-1-git-send-email-stefan.wahren@i2se.com> X-Provags-ID: V03:K1:HcC3YhsT+2bauKvdEEGOrPCXuQrBd9lStqMo5dmBpX4xU3iJ6gM vSG8KEpJ8KRon7BouYqrQrE6IKcM2Qb73sC3CuJom2lV5oqNyXvp0N4tdGlSUCLnA0f6HYx uFlBasQsMq8iYwXKMlJyksovmIVdkULh+Xm/ftm4/NUWonUx7fzElPixcUPRNwv5E0eqJZ/ GZQA2bHV2Y7R2E3jTVDNg== X-UI-Out-Filterresults: notjunk:1;V03:K0:HRA3uxP+rKE=:Ql3UICRv7t4vPPIqFw4Dbl wvVj4wY89tP1Tfsn9tcyLpAQRVk8nhlzy9qDecKypkDK2H/j1sVO+IFcAf34iMf3rPzhYlpor 2LtAPCRV1pSsXenoIcCGofs+in77bfW7GEtPc6FoYj+PdLPd+XxhsMULDc0tfROckeNruTreO bbU8XPwdqpQMJeaxwiM8A1+jnrQfy7WTwjK8A4upbP3u48IsTgiLDsXkv3dGR0WyBujq5CpwN IL02EP49VVx7rwFO1MoSvBGMCDuudLYmLATvtcMJ5UWnAXLgEGm7lUxcFPX4N5DhjGcnkSjLM maiikidHDycfY3SIcXhiH74GhpL0Xh7QD9oUp9VMGN2YF9K43yaLHprT61HjEu4WL0TBqubKi ZzbgLM2PM+H91YtrS8eRL7f4+4Lag+HeLjdB4C8qCaQNgnagVnSaTyw+BSbvBRR4+IvGoMyWX wJIjCpqjPJ38wps/0O70s9Utth028pOP50BfcQxQv1QhVVMKgO/lVwRo7eWPZsIk5NYWtmP9n RbcukqTgseVZoyeNNdX412nXTkljNZX7N85uOmqR5XaKMaa7XMqBlDnuf+nLVfr7wRpjMb2Id tvwS2E1tQgiD6aFUqyD6tJRThZKpvEIhKy36bKk5BKPeXE2tSdVveOsEvSxlypqWDgAxdnSfp jfExfHxoH7KB0LlBC67qAkSSs4MypRxjW1TYCGIjlym0N+y+Tvb3KJuZHenT66UKePI1Ir8Xc tXoTEkJ3FIQC5pyfPYAFdwnAS9pFts8Ol9vKDtGci/JXj5gjvQ5TMWOSTbY= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190120_231156_222705_F0BE686D X-CRM114-Status: GOOD ( 13.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Wahren , linux-gpio@vger.kernel.org, Lukas Wunner , Peter Robinson , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP In order to support GPIO config changes direct these to the generic pinctrl. This also requires an adjust of the return code for unsupported parameter otherwise gpiod_configure_flags wont work as expected. Signed-off-by: Stefan Wahren --- drivers/pinctrl/bcm/pinctrl-bcm2835.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c index 19eb4fd..183d1ff 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c @@ -341,6 +341,7 @@ static const struct gpio_chip bcm2835_gpio_chip = { .get_direction = bcm2835_gpio_get_direction, .get = bcm2835_gpio_get, .set = bcm2835_gpio_set, + .set_config = gpiochip_generic_config, .base = -1, .ngpio = BCM2835_NUM_GPIOS, .can_sleep = false, @@ -960,7 +961,7 @@ static int bcm2835_pinconf_set(struct pinctrl_dev *pctldev, break; default: - return -EINVAL; + return -ENOTSUPP; } /* switch param type */ } /* for each config */ From patchwork Mon Jan 21 07:11:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 10772593 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 52EFB13B4 for ; Mon, 21 Jan 2019 07:12:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E3BF29F0A for ; Mon, 21 Jan 2019 07:12:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3262A29F0E; Mon, 21 Jan 2019 07:12:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D23B529F0A for ; Mon, 21 Jan 2019 07:12:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=JyaKpcxauLksqVv5s1AuvEuE99zp+vlU9PdWQMA+0VY=; b=CE+Ei1/ftQWdh7De5mOuOyD7Jh UyhB/DhVk7MsbdyORkYucpKAqMgRJjLzphM1eYuLbbgUp2TQiwb/iHiAXNLKTvyb0Zbwdm6x+l810 rhIYfdY2/qU0MkGTI3ab3KojSfTBCXE5cz5lldIDVMNyhfPxFHhFxEg96kF6baZBzK/hTO4XeEm3w PSjChbIE1AHr/h0a4gImXpAzZrCyEP88ZINP5phKiJWVQxqjVZmtiMHKS2u1UAVIs7+2xuPs3Ku+e o4pdI18L3d6dr8zA59LP0vxoJW8oLMqiyq3RMXw2qOGWRFwgWfsCowNUQtk6iLj112g3b2efvyOv4 Cd0hyflw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1glTl8-0006er-SA; Mon, 21 Jan 2019 07:12:38 +0000 Received: from mout.kundenserver.de ([212.227.126.133]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1glTkS-0005rZ-AC for linux-arm-kernel@lists.infradead.org; Mon, 21 Jan 2019 07:11:58 +0000 Received: from localhost.localdomain ([37.4.249.120]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1N1g3U-1hE7TR3Kye-011z1m; Mon, 21 Jan 2019 08:11:49 +0100 From: Stefan Wahren To: Linus Walleij , Bartosz Golaszewski , Eric Anholt Subject: [PATCH RFC V2 3/4] pinctrl: bcm2835: activate strict mux mode Date: Mon, 21 Jan 2019 08:11:24 +0100 Message-Id: <1548054685-3781-4-git-send-email-stefan.wahren@i2se.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1548054685-3781-1-git-send-email-stefan.wahren@i2se.com> References: <1548054685-3781-1-git-send-email-stefan.wahren@i2se.com> X-Provags-ID: V03:K1:ga2DczEZGpOuwlKg3MRUo9vhM1cvRDr82fvOI9/as4tY/HxulZ4 YJ+LRkXiTMvHTwNZHw4TXgYs/UGoHQclCwgibkEQG00cw1z7tOQsEdfL9+0+s4O/sn74WAN 0bTRix8nrXzfU2t8Zp9ZjZNoQpKe6voZcDqaPwdy2VcvGPYFtFNpbXAHr1JXj/ow95AXrTD DceuXD7F4GKoD7AYPR0Og== X-UI-Out-Filterresults: notjunk:1;V03:K0:VANX3WKyw58=:QQAH/sCi2M9FImUYl1jnMB VeeJsx4A6YBGIDce6qkURKNgBLyMTEsIXy4r5d1w2BvtuY0LE9O3u2yusfsnMkqOExlITYz3Y 2TEh0vhovCJPmZ+pbkmn1lFeMbx/Z4dzwxjfmEcqdX4Gj+Q0jbGhKkj0+2OtctWQYM8FEZPm8 /viEnhbUxRQnTPmRB5fNrK8mZhHfvh8RDonYcnkuYjf5szshCkgZ7YstnxL8L+S+tq+Yw7Sxq BlKlEc26+lQK3kG0D0lIdrFuhUojonCLL5gFwNtFwuT8qNbP//BQXuuPJ0EDkBUSG0PmoIj/V pLZ5KuMi4ZvwuYfPruR/FmiTmjSaXJ1tHX2Q9p2LG7RPw1pGQsAirdnCuDpbfBFGZpxClW9h4 XdQ/I7YTYp38oZGvjhEvO1XDUJbz12ak3Qh13RFsMYerW9Ia7b0HxvV6DwcgchCOY5EW0IaV/ gbSUWI3TPZgGikfXxEYDf3Cez7WR2KqZrMg3doh9Z75SPB4znkujVwYrXSUrmiZDsbnmd/nGN J0YFspETKI4pyGXQEWHA0oK8TryhVzuSAuoY6d409t1X4dYf2JblRJWkDNBUxq0mt0RjwAvVd kknMKBS4qSMZeRa1Q3R75cjbPBPSguBCn79+5UVUWVsvqqET7F2QDjfu7jFmuxOH/ac3ii15o nuUDkqfu2QtFiyzed3FdjE2WJL81zKHPw/vRBrQCFiOHyTcA27JytMsBXbjvBe29GocsyzXYf TOItXZlCmP3KSDCwxHqQVOPl2W7J6j5afB77v3jNAPCDr92EohWWvCylQ5U= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190120_231156_646148_A49040D1 X-CRM114-Status: GOOD ( 11.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Wahren , linux-gpio@vger.kernel.org, Lukas Wunner , Peter Robinson , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This activates strict mode muxing for the bcm2835 pin controller, as the GPIO Function Select Registers do not allow GPIO and functions at the same time. Signed-off-by: Stefan Wahren --- drivers/pinctrl/bcm/pinctrl-bcm2835.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c index 183d1ff..452e734 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c @@ -894,6 +894,7 @@ static const struct pinmux_ops bcm2835_pmx_ops = { .set_mux = bcm2835_pmx_set, .gpio_disable_free = bcm2835_pmx_gpio_disable_free, .gpio_set_direction = bcm2835_pmx_gpio_set_direction, + .strict = true, }; static int bcm2835_pinconf_get(struct pinctrl_dev *pctldev, From patchwork Mon Jan 21 07:11:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 10772597 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 03E951390 for ; Mon, 21 Jan 2019 07:12:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E346E29F0A for ; Mon, 21 Jan 2019 07:12:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5F4329F0C; Mon, 21 Jan 2019 07:12:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5C94A29F0D for ; Mon, 21 Jan 2019 07:12:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=k93ATkDhmyS6ybLnTUE5KRs4OKYI8+oiQ8u/3Wt/Mok=; b=oHlJFKfBdsWd+G7f0SNR6UDGfk RyNK/pXzrDBGANoQsvAzMDaBGJyJs6GHFHCUIT06fENIEKZVA0eGlldpWDLtbWyAHJ8mskRU3p6Ac 2j4Av7MO6bokPXRnL9I2f4Zv4iKvwUJ9YSWv71MteLd0QyYpJlGUIXU4MGgOIacLxuepXdvT/Y4Wq OevTpCgMBG4Eu+txeXsIU7/tS4vZoAIR+lQs3E25vlr4c4POuL7CXhiTkgnqZRvutqtmlqwJAH6XR 49Zwj8rUtLbWr5Xm/7oLnofFJ+Ql6GbXWOmZTBXaXFj6xhyngCCBedxECAgEe4IqlQEAC24iw17Ib P1HnAOFQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1glTlK-0006pK-86; Mon, 21 Jan 2019 07:12:50 +0000 Received: from mout.kundenserver.de ([212.227.126.133]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1glTkS-0005rY-AD for linux-arm-kernel@lists.infradead.org; Mon, 21 Jan 2019 07:11:59 +0000 Received: from localhost.localdomain ([37.4.249.120]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MD9jV-1gtyBr0WEz-009BRr; Mon, 21 Jan 2019 08:11:50 +0100 From: Stefan Wahren To: Linus Walleij , Bartosz Golaszewski , Eric Anholt Subject: [PATCH RFC V2 4/4] gpiolib: Take MUX usage into account Date: Mon, 21 Jan 2019 08:11:25 +0100 Message-Id: <1548054685-3781-5-git-send-email-stefan.wahren@i2se.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1548054685-3781-1-git-send-email-stefan.wahren@i2se.com> References: <1548054685-3781-1-git-send-email-stefan.wahren@i2se.com> X-Provags-ID: V03:K1:wFSm5DiGB8t/6R0BFr7+f1DoAMk0jM+ig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( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190120_231156_656053_600BF706 X-CRM114-Status: GOOD ( 18.45 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Wahren , linux-gpio@vger.kernel.org, Lukas Wunner , Peter Robinson , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The user space like gpioinfo only see the GPIO usage but not the MUX usage (e.g. I2C or SPI usage) of a pin. As a user we want to know which pin is free/safe to use. So take the MUX usage of strict pinmux controllers into account to get a more realistic view for ioctl GPIO_GET_LINEINFO_IOCTL. Signed-off-by: Stefan Wahren --- drivers/gpio/gpiolib.c | 3 ++- drivers/pinctrl/core.c | 23 +++++++++++++++++++++++ drivers/pinctrl/pinmux.c | 18 ++++++++++++++++++ drivers/pinctrl/pinmux.h | 7 +++++++ include/linux/pinctrl/consumer.h | 6 ++++++ 5 files changed, 56 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 1651d7f..da3b008 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1075,7 +1075,8 @@ static long gpio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) test_bit(FLAG_IS_HOGGED, &desc->flags) || test_bit(FLAG_USED_AS_IRQ, &desc->flags) || test_bit(FLAG_EXPORT, &desc->flags) || - test_bit(FLAG_SYSFS, &desc->flags)) + test_bit(FLAG_SYSFS, &desc->flags) || + pinctrl_gpio_is_in_use(chip->base + lineinfo.line_offset)) lineinfo.flags |= GPIOLINE_FLAG_KERNEL; if (test_bit(FLAG_IS_OUT, &desc->flags)) lineinfo.flags |= GPIOLINE_FLAG_IS_OUT; diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index c6ff4d5..6e097e4 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c @@ -760,6 +760,29 @@ int pinctrl_get_group_selector(struct pinctrl_dev *pctldev, return -EINVAL; } +bool pinctrl_gpio_is_in_use(unsigned gpio) +{ + struct pinctrl_dev *pctldev; + struct pinctrl_gpio_range *range; + bool result; + int pin; + + if (pinctrl_get_device_gpio_range(gpio, &pctldev, &range)) + return false; + + mutex_lock(&pctldev->mutex); + + /* Convert to the pin controllers number space */ + pin = gpio_to_pin(range, gpio); + + result = pinmux_is_in_use(pctldev, pin); + + mutex_unlock(&pctldev->mutex); + + return result; +} +EXPORT_SYMBOL_GPL(pinctrl_gpio_is_in_use); + /** * pinctrl_gpio_request() - request a single pin to be used as GPIO * @gpio: the GPIO pin number from the GPIO subsystem number space diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c index 4d0cc18..c1f6d46 100644 --- a/drivers/pinctrl/pinmux.c +++ b/drivers/pinctrl/pinmux.c @@ -71,6 +71,24 @@ int pinmux_validate_map(const struct pinctrl_map *map, int i) return 0; } +bool pinmux_is_in_use(struct pinctrl_dev *pctldev, unsigned pin) +{ + struct pin_desc *desc = pin_desc_get(pctldev, pin); + const struct pinmux_ops *ops = pctldev->desc->pmxops; + + if (!desc) { + dev_err(pctldev->dev, + "pin %u is not registered so it cannot be requested\n", + pin); + return false; + } + + if (ops->strict && desc->mux_usecount) + return true; + + return ops->strict && !!desc->gpio_owner; +} + /** * pin_request() - request a single pin to be muxed in, typically for GPIO * @pin: the pin number in the global pin space diff --git a/drivers/pinctrl/pinmux.h b/drivers/pinctrl/pinmux.h index 3319535..1da2a75 100644 --- a/drivers/pinctrl/pinmux.h +++ b/drivers/pinctrl/pinmux.h @@ -16,6 +16,8 @@ int pinmux_check_ops(struct pinctrl_dev *pctldev); int pinmux_validate_map(const struct pinctrl_map *map, int i); +bool pinmux_is_in_use(struct pinctrl_dev *pctldev, unsigned pin); + int pinmux_request_gpio(struct pinctrl_dev *pctldev, struct pinctrl_gpio_range *range, unsigned pin, unsigned gpio); @@ -43,6 +45,11 @@ static inline int pinmux_validate_map(const struct pinctrl_map *map, int i) return 0; } +static inline bool pinmux_is_in_use(struct pinctrl_dev *pctldev, unsigned pin) +{ + return false; +} + static inline int pinmux_request_gpio(struct pinctrl_dev *pctldev, struct pinctrl_gpio_range *range, unsigned pin, unsigned gpio) diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h index 0412cc9..0093a2b 100644 --- a/include/linux/pinctrl/consumer.h +++ b/include/linux/pinctrl/consumer.h @@ -25,6 +25,7 @@ struct device; #ifdef CONFIG_PINCTRL /* External interface to pin control */ +extern bool pinctrl_gpio_is_in_use(unsigned gpio); extern int pinctrl_gpio_request(unsigned gpio); extern void pinctrl_gpio_free(unsigned gpio); extern int pinctrl_gpio_direction_input(unsigned gpio); @@ -62,6 +63,11 @@ static inline int pinctrl_pm_select_idle_state(struct device *dev) #else /* !CONFIG_PINCTRL */ +static inline bool pinctrl_gpio_is_in_use(unsigned gpio) +{ + return 0; +} + static inline int pinctrl_gpio_request(unsigned gpio) { return 0;