From patchwork Fri Oct 6 12:55:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 13411464 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 8CF04E81DF4 for ; Fri, 6 Oct 2023 13:01:19 +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:References:MIME-Version: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=i4xaFhfmEenA6wiBqM2850GZZmemG0ffGIVRND/LXQ4=; b=oo2/U7O50UhPoN zYruSAH3EoGQKosWvvoAmbpIXH4AOx8fLRzEsVUO0lHsWyYUX4u5rSWwbOpOzn1mMvwTr6E1zl3zs eUkP7J2nC716TfjV9XdRpXWrrREzmmVizDJD8M85TY8FkV8jpsP0lhaVZoBA3dey1Mu9niel0z0hs /IVLdEfdhEI7GhhMO3BxjtQk60MwSI3WjM/tV71gjbJ5W7j6fnIrCBXbsEBlYbdgF102TMpurrrVy gaeuE5BQ6noJKFRPxIwLV1B0fgB9HclJ4taLjG79mgUkYNTcR3D7yX/L73pQauSmGerNbqx9M8dhW QqXarIZNmkKZxyvkZU6g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qokRj-005q6B-0t; Fri, 06 Oct 2023 13:00:47 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qokRe-005q3h-29 for linux-arm-kernel@lists.infradead.org; Fri, 06 Oct 2023 13:00:45 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20231006130039euoutp02b0aaaafbe13ba1f944ebbbba4161e019~LhjNILwxq0723107231euoutp02d for ; Fri, 6 Oct 2023 13:00:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20231006130039euoutp02b0aaaafbe13ba1f944ebbbba4161e019~LhjNILwxq0723107231euoutp02d DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1696597239; bh=HHwaNMwgorwT9qyUyNc3f5mPDjxlKqnK60SVh708oL4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nBfY9BMj0TkQo5INau6r7hV2y/CHAUmHMxodmVADkzYj7x6i4lZZJyFhVARVnHCxi nkoxVws2/cZjC35bA9MannuUg07xlkHJL8dxyO2sSXnKgbTxUJo2hMPKlWrPLSReJF SBWDu2XmgwmgpC6jTo/M8huASjh+i94Tkrm6ogOs= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20231006130038eucas1p1dc043e5c709b0fbb1ae19524081bc6b8~LhjMsMNFp3118331183eucas1p14; Fri, 6 Oct 2023 13:00:38 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 4C.75.11320.6F400256; Fri, 6 Oct 2023 14:00:38 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20231006130038eucas1p1c849a21714227a11759681ef909ffd94~LhjMLY7He2199621996eucas1p1n; Fri, 6 Oct 2023 13:00:38 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231006130038eusmtrp1242bf59a026e8a36054e116e1a543efa~LhjMKyUEW3160731607eusmtrp1O; Fri, 6 Oct 2023 13:00:38 +0000 (GMT) X-AuditID: cbfec7f4-97dff70000022c38-d1-652004f6acd6 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id C9.AA.25043.6F400256; Fri, 6 Oct 2023 14:00:38 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231006130037eusmtip24d6f4e51e43a7e697bb3db29e67a5d98~LhjLj-GO81292012920eusmtip2T; Fri, 6 Oct 2023 13:00:37 +0000 (GMT) From: Mateusz Majewski To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mateusz Majewski , Tomasz Figa , Krzysztof Kozlowski , Sylwester Nawrocki , Alim Akhtar , Linus Walleij , Marek Szyprowski Subject: [PATCH 1/4] pinctrl: samsung: defer pinctrl_enable Date: Fri, 6 Oct 2023 14:55:54 +0200 Message-ID: <20231006125557.212681-2-m.majewski2@samsung.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231006125557.212681-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrCKsWRmVeSWpSXmKPExsWy7djPc7rfWBRSDSZtM7V4MG8bm8Xe11vZ Lab8Wc5ksenxNVaLzfP/MFpc3jWHzWLG+X1MFhOPTWa2WHvkLrvF4TftrBardv1hdOD22Dnr LrvHnWt72Dw2L6n36NuyitHj8ya5ANYoLpuU1JzMstQifbsEroybB26zF9zmrbjaOJm1gXEL dxcjJ4eEgInEihmfGLsYuTiEB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LrvHnWt72Dw2L6n36NuyitHj8ya5ANYoPZui/NKSVIWM/OISW6VoQwsjPUNLCz0jE0s9Q2Pz WCsjUyV9O5uU1JzMstQifbsEvYybB26zF9zmrbjaOJm1gXELdxcjJ4eEgInE9TVf2LsYuTiE BJYySux+PZURIiEtcfjLFHYIW1jiz7UuNhBbSKCZSaKxzw3EZhMwkHjwZhlYjYhAN6PEt4lc IIOYBQ4wSSyZdRCsQVjAWuLh/FtMIDaLgKrE6btbwOK8ArYSjxd0QS2Ql9iz6DtYDaeAnUTT 8+8sEMtsJQ7t2MMEUS8ocXLmE7A4M1B989bZzBMYBWYhSc1CklrAyLSKUSS1tDg3PbfYSK84 Mbe4NC9dLzk/dxMjMHa2Hfu5ZQfjylcf9Q4xMnEwHmKU4GBWEuFNb5BJFeJNSaysSi3Kjy8q zUktPsRoCnT3RGYp0eR8YPTmlcQbmhmYGpqYWRqYWpoZK4nzehZ0JAoJpCeWpGanphakFsH0 MXFwSjUwyV9h3FC2+e8uoZ7M9rpTizdt7PWcusDbbIqLt9lkUZ0zwjVivxOCpe9n8pR41/TI Mh/k9HNi/F4p8Co1Vr5xrd9SjuC1B+W+Po3RWnQg4VTa74NRb0SvlbycEXGlI7NXrfxN3BLm RTMkDnp6Jr+KvLZ1qe2aDqlL+3lCbsydNVX+Wtm/205SVkwvC5cJ9tzuYag70x6srCHc0BUn neQqpC7ivXrB9l/lXC/Wsm6o/WJzNuyRfJWLOfv1B1Win83mrHV3mBxl2/G/69W0Rk0OJ0EB fsfDy6yXTrM3sFes8DqV7tq26bbYoncXJgWUFn574jjRcMMLrTe7ajTnxAkXzfQ0FnqRf/XH RH8X5jQlluKMREMt5qLiRABiEClaJgMAAA== X-CMS-MailID: 20231006130038eucas1p1c849a21714227a11759681ef909ffd94 X-Msg-Generator: CA X-RootMTR: 20231006130038eucas1p1c849a21714227a11759681ef909ffd94 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231006130038eucas1p1c849a21714227a11759681ef909ffd94 References: <20231006125557.212681-1-m.majewski2@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231006_060042_966981_7C0E0837 X-CRM114-Status: GOOD ( 18.44 ) 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 dev_pinctrl_register function immediately enables the pinctrl subsystem, which is unpreferable in general, since drivers might be unable to handle calls immediately. Hence devm_pinctrl_register_and_init, which does not call pinctrl_enable, is preferred. In case of our driver using the old function does not seem to be problematic for now, but will become an issue when we postpone parts of pinctrl initialization in a future commit, and it is a good idea to move off a deprecated-ish function anyway. Signed-off-by: Mateusz Majewski --- drivers/pinctrl/samsung/pinctrl-samsung.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c index e54847040b4a..e496af72a587 100644 --- a/drivers/pinctrl/samsung/pinctrl-samsung.c +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c @@ -904,11 +904,11 @@ static int samsung_pinctrl_register(struct platform_device *pdev, if (ret) return ret; - drvdata->pctl_dev = devm_pinctrl_register(&pdev->dev, ctrldesc, - drvdata); - if (IS_ERR(drvdata->pctl_dev)) { + ret = devm_pinctrl_register_and_init(&pdev->dev, ctrldesc, drvdata, + &drvdata->pctl_dev); + if (ret) { dev_err(&pdev->dev, "could not register pinctrl driver\n"); - return PTR_ERR(drvdata->pctl_dev); + return ret; } for (bank = 0; bank < drvdata->nr_banks; ++bank) { @@ -1176,6 +1176,10 @@ static int samsung_pinctrl_probe(struct platform_device *pdev) if (ret) goto err_unregister; + ret = pinctrl_enable(drvdata->pctl_dev); + if (ret) + goto err_unregister; + platform_set_drvdata(pdev, drvdata); return 0; From patchwork Fri Oct 6 12:55:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 13411466 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 9BA89E81DF5 for ; Fri, 6 Oct 2023 13:01:21 +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:References:MIME-Version: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=eIg08FSw0datervNR/Ign/mwOIJ87HS8SBjR13vDRHM=; b=mGcp+2fQj3krfJ pmt+RAFlvxoeBhczcL0LY9b9S8HHOaeT5pBbELSfpNgEMfG+CZiIhDPH7eTiyokK52/WSL2GlLWn5 kGosw+aXk04fBvURangXM9fj13nJ8lFW081qBYmtdme4k0i8m1Gxk2lFqfr5ts1DPd4keTq22aETW hNCWoW1nqNHfwt+8w7pMpOSj2NVyWdh+LRMup9a7tNCjoS/tjip6pcZ7wLjsE0R8GmFdwlEh4N9j+ RPEiYrEFzneo1xVb62Eye9FbIC9kCdmptcTuv4wnsd5bBjqQUB8Vrr55nn2ro+F8ZuTkWueZ7yfYl e1uw/ulYDQjXOGom8tbQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qokRj-005q6f-2l; Fri, 06 Oct 2023 13:00:47 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qokRf-005q4I-0N for linux-arm-kernel@lists.infradead.org; Fri, 06 Oct 2023 13:00:45 +0000 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20231006130041euoutp02ce543fca0c748cb0e72896884a3b58de~LhjPbgCyK0812808128euoutp02C for ; Fri, 6 Oct 2023 13:00:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20231006130041euoutp02ce543fca0c748cb0e72896884a3b58de~LhjPbgCyK0812808128euoutp02C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1696597241; bh=abGhTwdfkPSXmGau8dmreOOqNAsta01p/xrYBl7NXzg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X1n73wJeBq4KyZu07QSC5SEbHa9ZzNupikSNWRHcoGocda0vwGDVkQmlfp0F3MGJp ub88ORkOtQcp5Ky96XrcUJEYnYl+MRh9V4JwMNzJFYuXZV5RYNjjdb2T2DtRQPdTkv oi2pQyYUIRpGDHeTZ1677wj+6E4RumO43eLuzdxQ= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20231006130041eucas1p2ed62ed5f8c513fcffb6097235db13a24~LhjPHGylE2196721967eucas1p2c; Fri, 6 Oct 2023 13:00:41 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id ED.13.37758.9F400256; Fri, 6 Oct 2023 14:00:41 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20231006130041eucas1p1fd945c734c0d35067107e7c699201bdb~LhjOqoppP3121531215eucas1p1o; Fri, 6 Oct 2023 13:00:41 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20231006130041eusmtrp230bdbb5ee5dd38bb2b10626476a08e48~LhjOqCYQX0212502125eusmtrp2h; Fri, 6 Oct 2023 13:00:41 +0000 (GMT) X-AuditID: cbfec7f5-815ff7000002937e-9e-652004f9bb5f Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 5F.1E.10549.8F400256; Fri, 6 Oct 2023 14:00:41 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231006130040eusmtip21462b213c9f036b15634f5f0a6f3bf10~LhjOCzCT81292012920eusmtip2U; Fri, 6 Oct 2023 13:00:40 +0000 (GMT) From: Mateusz Majewski To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mateusz Majewski , Tomasz Figa , Krzysztof Kozlowski , Sylwester Nawrocki , Alim Akhtar , Linus Walleij , Marek Szyprowski Subject: [PATCH 2/4] pinctrl: samsung: use add_pin_ranges method to add pinctrl ranges Date: Fri, 6 Oct 2023 14:55:55 +0200 Message-ID: <20231006125557.212681-3-m.majewski2@samsung.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231006125557.212681-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrMKsWRmVeSWpSXmKPExsWy7djP87o/WRRSDRY/lrV4MG8bm8Xe11vZ Lab8Wc5ksenxNVaLzfP/MFpc3jWHzWLG+X1MFhOPTWa2WHvkLrvF4TftrBardv1hdOD22Dnr LrvHnWt72Dw2L6n36NuyitHj8ya5ANYoLpuU1JzMstQifbsEroz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+H5PFxGOTmS3WHrnLbnH4TTurxapdfxgduD12zrrL 7nHn2h42j81L6j36tqxi9Pi8SS6ANUrPpii/tCRVISO/uMRWKdrQwkjP0NJCz8jEUs/Q2DzW yshUSd/OJiU1J7MstUjfLkEvo/1WP1PBCYWK1c8fMzUwdkp3MXJySAiYSLRevcvUxcjFISSw lFHi4M4V7BAJaYnDX6ZA2cISf651sUEUNTNJ3Py4hgUkwSZgIPHgzTKwIhGBbkaJbxO5QIqY BQ4wSSyZdZANJCEsECbx4do7MJtFQFViUuM2ZhCbV8BWYvakvcwQG+Ql9iz6zgRicwrYSTQ9 /w62QAio5tCOPUwQ9YISJ2c+AYszA9U3b53NPIFRYBaS1CwkqQWMTKsYRVJLi3PTc4sN9YoT c4tL89L1kvNzNzECY2fbsZ+bdzDOe/VR7xAjEwfjIUYJDmYlEd70BplUId6UxMqq1KL8+KLS nNTiQ4ymQHdPZJYSTc4HRm9eSbyhmYGpoYmZpYGppZmxkjivZ0FHopBAemJJanZqakFqEUwf EwenVAOTz7Wzck29V8vUNJsuF6+e/u75zHMLpptc2+656HZ469lQsURJ8SntFjL3+OXn3PX9 dHh7cE2H8O0rN1I3c7+an6v0f+uV1zERP1f0GXhO1z17dYGuUuBttcuzst3120NnB2/pdJvl tmyNoQLDVlclngM31FbUWVuGrjrtZuD3WmLvGt7s1dJ1qeLbOVLkf21RT5ep3L+qbKmm2MlO 2yui0bFb22/L702ZLegqf9tFgHGSqOmLK49/uvIwhUYtflloqSf/yKCql9HvznSTiK231Xdp LvvPauWdsdbro8cX25VPHj4vTZ/Wl7XLRPzHo9Ll/HIttrr51m68ceeOP7pXsTymZs+CqnK/ 865HF7QrsRRnJBpqMRcVJwIAenemsyYDAAA= X-CMS-MailID: 20231006130041eucas1p1fd945c734c0d35067107e7c699201bdb X-Msg-Generator: CA X-RootMTR: 20231006130041eucas1p1fd945c734c0d35067107e7c699201bdb X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231006130041eucas1p1fd945c734c0d35067107e7c699201bdb References: <20231006125557.212681-1-m.majewski2@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231006_060043_418736_41E8C7F9 X-CRM114-Status: GOOD ( 16.84 ) 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 preferable since we can read the base in the global GPIO numberspace from the chip instead of needing to select it ourselves. Past versions could not do this, since they needed to add all the ranges before enabling the pinctrl subsystem, which was done before registering the GPIO chip. However, right now we enable the pinctrl subsystem after registering the chip and so this became possible. Signed-off-by: Mateusz Majewski --- drivers/pinctrl/samsung/pinctrl-samsung.c | 31 +++++++++++++---------- drivers/pinctrl/samsung/pinctrl-samsung.h | 2 ++ 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c index e496af72a587..511a3ac51f76 100644 --- a/drivers/pinctrl/samsung/pinctrl-samsung.c +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c @@ -665,6 +665,21 @@ static int samsung_gpio_to_irq(struct gpio_chip *gc, unsigned offset) return (virq) ? : -ENXIO; } +static int samsung_add_pin_ranges(struct gpio_chip *gc) +{ + struct samsung_pin_bank *bank = gpiochip_get_data(gc); + + bank->grange.name = bank->name; + bank->grange.id = bank->id; + bank->grange.pin_base = bank->drvdata->pin_base + bank->pin_base; + bank->grange.base = gc->base; + bank->grange.npins = bank->nr_pins; + bank->grange.gc = &bank->gpio_chip; + pinctrl_add_gpio_range(bank->drvdata->pctl_dev, &bank->grange); + + return 0; +} + static struct samsung_pin_group *samsung_pinctrl_create_groups( struct device *dev, struct samsung_pinctrl_drv_data *drvdata, @@ -892,6 +907,7 @@ static int samsung_pinctrl_register(struct platform_device *pdev, /* for each pin, the name of the pin is pin-bank name + pin number */ for (bank = 0; bank < drvdata->nr_banks; bank++) { pin_bank = &drvdata->pin_banks[bank]; + pin_bank->id = bank; for (pin = 0; pin < pin_bank->nr_pins; pin++) { sprintf(pin_names, "%s-%d", pin_bank->name, pin); pdesc = pindesc + pin_bank->pin_base + pin; @@ -911,18 +927,6 @@ static int samsung_pinctrl_register(struct platform_device *pdev, return ret; } - for (bank = 0; bank < drvdata->nr_banks; ++bank) { - pin_bank = &drvdata->pin_banks[bank]; - pin_bank->grange.name = pin_bank->name; - pin_bank->grange.id = bank; - pin_bank->grange.pin_base = drvdata->pin_base - + pin_bank->pin_base; - pin_bank->grange.base = pin_bank->grange.pin_base; - pin_bank->grange.npins = pin_bank->nr_pins; - pin_bank->grange.gc = &pin_bank->gpio_chip; - pinctrl_add_gpio_range(drvdata->pctl_dev, &pin_bank->grange); - } - return 0; } @@ -947,6 +951,7 @@ static const struct gpio_chip samsung_gpiolib_chip = { .direction_input = samsung_gpio_direction_input, .direction_output = samsung_gpio_direction_output, .to_irq = samsung_gpio_to_irq, + .add_pin_ranges = samsung_add_pin_ranges, .owner = THIS_MODULE, }; @@ -963,7 +968,7 @@ static int samsung_gpiolib_register(struct platform_device *pdev, bank->gpio_chip = samsung_gpiolib_chip; gc = &bank->gpio_chip; - gc->base = bank->grange.base; + gc->base = drvdata->pin_base + bank->pin_base; gc->ngpio = bank->nr_pins; gc->parent = &pdev->dev; gc->fwnode = bank->fwnode; diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.h b/drivers/pinctrl/samsung/pinctrl-samsung.h index 9af93e3d8d9f..173db20f70d3 100644 --- a/drivers/pinctrl/samsung/pinctrl-samsung.h +++ b/drivers/pinctrl/samsung/pinctrl-samsung.h @@ -148,6 +148,7 @@ struct samsung_pin_bank_data { * @eint_mask: bit mask of pins which support EINT function. * @eint_offset: SoC-specific EINT register or interrupt offset of bank. * @name: name to be prefixed for each pin in this pin bank. + * @id: id of the bank, propagated to the pin range. * @pin_base: starting pin number of the bank. * @soc_priv: per-bank private data for SoC-specific code. * @of_node: OF node of the bank. @@ -170,6 +171,7 @@ struct samsung_pin_bank { u32 eint_mask; u32 eint_offset; const char *name; + u32 id; u32 pin_base; void *soc_priv; From patchwork Fri Oct 6 12:55:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 13411468 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 22CFBE81DE9 for ; Fri, 6 Oct 2023 13:01:23 +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:References:MIME-Version: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=29R1M11N7ekZMKMI2ZTeZdCAjjE3zgiKKvkqKeHQjgk=; b=SUoZSEbyvYgrgS LOR+5/+vqa5YG0ZCv/U7TWdRA/BgnmTEAXPV0Lj+NHp/3MqXj3Iqd8t0EI9uqRaKSlZHAk3bh7QuD yRAUYrK8eOQNF5SHR0F1mZGoY6yQtV+z7sOk1jcrSCDdjzObEjS8Dk+Oj/aovh1LmOL0jhCXZLBB1 Vcm9E3yP4v/6XQzN5PokSb2BlovpYJVXCRMTvwvebEm4uPAu3jhltidRChdnbCLfFqlaMVTvRSavj +qDWTAmo+XuEXSX+kYiJIOrInulYRP8Mhe07/FDxku3O+d1RIRgc2zjihqghss2/dNT4EHkvnFT49 av8elrKN31/DAyM2wJtg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qokRo-005q8l-0E; Fri, 06 Oct 2023 13:00:52 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qokRg-005q54-2Q for linux-arm-kernel@lists.infradead.org; Fri, 06 Oct 2023 13:00:49 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20231006130043euoutp01d02bb64e74c21db9c81dbde0ef2dd13a~LhjQ9mr4O0243202432euoutp01n for ; Fri, 6 Oct 2023 13:00:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20231006130043euoutp01d02bb64e74c21db9c81dbde0ef2dd13a~LhjQ9mr4O0243202432euoutp01n DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1696597243; bh=AOZzdNsiIIIEQWK65sqBy/MBDyGZPZVzaQ8WJ1M1Fmc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A6twxmSedXgxWZ+cur1+JhVEgwvc8K9hJs3uaoZt52U1oylvmU6wqUEPAqbsdx8lD WciZ4JetzExz28Xf/TnO5/FWUts+TBQRAEB67GngN3wDhPToAWFoo9LIgesTCPUFFH 3oKisOIgXAtPp4fkRkWY2mM6BTlvXp6D2j3si/30= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20231006130043eucas1p2b7bdba9576ded243fd11d5b5afad1d5f~LhjQqO_Zh3171131711eucas1p2z; Fri, 6 Oct 2023 13:00:43 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 81.5A.42423.BF400256; Fri, 6 Oct 2023 14:00:43 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20231006130042eucas1p10679037ebd812183a5edff0b7c1e8b6a~LhjQSIonV3121531215eucas1p1r; Fri, 6 Oct 2023 13:00:42 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231006130042eusmtrp1a1746a9796ef019077cb3211a98852a3~LhjQRnFkb3155531555eusmtrp12; Fri, 6 Oct 2023 13:00:42 +0000 (GMT) X-AuditID: cbfec7f2-a3bff7000002a5b7-52-652004fb3294 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id FE.AA.25043.AF400256; Fri, 6 Oct 2023 14:00:42 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231006130041eusmtip2d61d013f799ccdcb01385d85e9f977e5~LhjPax9vM2282522825eusmtip2c; Fri, 6 Oct 2023 13:00:41 +0000 (GMT) From: Mateusz Majewski To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mateusz Majewski , Tomasz Figa , Krzysztof Kozlowski , Sylwester Nawrocki , Alim Akhtar , Linus Walleij , Marek Szyprowski Subject: [PATCH 3/4] pinctrl: samsung: choose GPIO numberspace base dynamically Date: Fri, 6 Oct 2023 14:55:56 +0200 Message-ID: <20231006125557.212681-4-m.majewski2@samsung.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231006125557.212681-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrMKsWRmVeSWpSXmKP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iQBwhs5rJgMAAA== X-CMS-MailID: 20231006130042eucas1p10679037ebd812183a5edff0b7c1e8b6a X-Msg-Generator: CA X-RootMTR: 20231006130042eucas1p10679037ebd812183a5edff0b7c1e8b6a X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231006130042eucas1p10679037ebd812183a5edff0b7c1e8b6a References: <20231006125557.212681-1-m.majewski2@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231006_060045_054397_EAEBFCD5 X-CRM114-Status: GOOD ( 14.98 ) 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 Selecting it statically is deprecated and results in a warning while booting the system: gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation. Signed-off-by: Mateusz Majewski --- drivers/pinctrl/samsung/pinctrl-samsung.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c index 511a3ac51f76..952aeeebb679 100644 --- a/drivers/pinctrl/samsung/pinctrl-samsung.c +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c @@ -968,7 +968,7 @@ static int samsung_gpiolib_register(struct platform_device *pdev, bank->gpio_chip = samsung_gpiolib_chip; gc = &bank->gpio_chip; - gc->base = drvdata->pin_base + bank->pin_base; + gc->base = -1; /* Dynamic allocation */ gc->ngpio = bank->nr_pins; gc->parent = &pdev->dev; gc->fwnode = bank->fwnode; From patchwork Fri Oct 6 12:55:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 13411467 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 4CC5AE81DF4 for ; Fri, 6 Oct 2023 13:01:22 +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:References:MIME-Version: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=3jvOnN50Y3Kxr/MBeUtkqJ5LOEaoIYHta2V5qjbuWf0=; b=E7F3rdcDEkVvQV jo2lmQJQtgO7yZeP2WJEghmf+gO0eW1MaBVdJTsBWMjsqo+25+7BwgG4juyly9ygN3et3ZygmRgUT aI85LNYJfknkyo34+YRMF2H+yfUTIlFCrTJJI3EzCkqXLbcuHgjnaZt3RMvbUGNTNHs0xenS3YJVC c7oJowXauyog6gVmA9YeZbkVPf3XE73/+9IdiUJ8TXLvW+Z+rJMMlNimY90RlDRYF1/A0/Sd365ni X3mQx/jIP+/44dM39XRj8SfeN2LbKkQd+FrSVxaf4ZGKfxv8qT+VGAtwAHpNfUDhFcgZtvsHgNdam a70O1MmeWXRTCBVU2sbg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qokRn-005q8I-1m; Fri, 06 Oct 2023 13:00:51 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qokRi-005q5y-34 for linux-arm-kernel@lists.infradead.org; Fri, 06 Oct 2023 13:00:48 +0000 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20231006130045euoutp02fb21bb4451e96d8c1f5e73836dab940d~LhjS-VaX-0813308133euoutp020 for ; Fri, 6 Oct 2023 13:00:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20231006130045euoutp02fb21bb4451e96d8c1f5e73836dab940d~LhjS-VaX-0813308133euoutp020 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1696597245; bh=TR7Kzoq1U4uZ7ZoVNJnoUetQhJy9xOmLtt/Kna2DQZw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RmUFf4Ke9fhAU4cZ08q3nrPYhg9tw50NwVxJNPFlSPbRCdFLaS2Dq7K8FRSW5CuYS 9c9i57dHl28N2u0HeFHveM+85JAVFBxw/v64GFLwOfv8SDRiDaySsbOt+FQ1Tw80MI 93ub3gsSLwDDaRjYRuB2IKVBjaaIKGlVSyQgWAYA= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20231006130045eucas1p2d432252966f402c4a9ea724a6c0e41e3~LhjStiLqH3165331653eucas1p2s; Fri, 6 Oct 2023 13:00:45 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id E4.5A.42423.DF400256; Fri, 6 Oct 2023 14:00:45 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20231006130044eucas1p17a141ec5aafca3d5af5295049f8b1651~LhjSMgmPy3093330933eucas1p1l; Fri, 6 Oct 2023 13:00:44 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20231006130044eusmtrp2974082dca1420afebcc023c76ab2c0ce~LhjSL521h0256802568eusmtrp2-; Fri, 6 Oct 2023 13:00:44 +0000 (GMT) X-AuditID: cbfec7f2-a3bff7000002a5b7-5c-652004fd144b Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id D4.2E.10549.CF400256; Fri, 6 Oct 2023 14:00:44 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231006130043eusmtip29ae9abc412499762caada0cec5375ced~LhjQ-XyNw0538005380eusmtip2V; Fri, 6 Oct 2023 13:00:43 +0000 (GMT) From: Mateusz Majewski To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mateusz Majewski , Tomasz Figa , Krzysztof Kozlowski , Sylwester Nawrocki , Alim Akhtar , Linus Walleij , Marek Szyprowski Subject: [PATCH 4/4] pinctrl: samsung: do not offset pinctrl numberspaces Date: Fri, 6 Oct 2023 14:55:57 +0200 Message-ID: <20231006125557.212681-5-m.majewski2@samsung.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231006125557.212681-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrAKsWRmVeSWpSXmKPExsWy7djPc7p/WRRSDRZcELd4MG8bm8Xe11vZ Lab8Wc5ksenxNVaLzfP/MFpc3jWHzWLG+X1MFhOPTWa2WHvkLrvF4TftrBardv1hdOD22Dnr LrvHnWt72Dw2L6n36NuyitHj8ya5ANYoLpuU1JzMstQifbsErozOO3UFPYoVJx59ZmxgfCTd xcjJISFgIvHm3gNGEFtIYAWjxOnJkl2MXED2F0aJiQdWMkI4nxkl5vxtZoTp2LHjBhtEYjmj xK6PF5khnFYmidfvlrGAVLEJGEg8eLOMHSQhItDOKNFz6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ifbsEvYzOO3UFPYoVJx59ZmxgfCTdxcjJISFgIrFjxw02EFtIYCmj xIMN5hBxaYnDX6awQ9jCEn+udQHVcAHVNDNJrF53gwkkwSZgIPHgzTKwIhGBbkaJbxO5QIqY BQ4wSSyZdRBsqrCAp8SU35MYuxg5OFgEVCUu/a0FCfMK2Eqc3v6dGWKBvMSeRd/BZnIK2Ek0 Pf/OAnGQrcShHXuYIOoFJU7OfAIWZwaqb946m3kCo8AsJKlZSFILGJlWMYqklhbnpucWG+oV J+YWl+al6yXn525iBMbNtmM/N+9gnPfqo94hRiYOxkOMEhzMSiK86Q0yqUK8KYmVValF+fFF pTmpxYcYTYHOnsgsJZqcD4zcvJJ4QzMDU0MTM0sDU0szYyVxXs+CjkQhgfTEktTs1NSC1CKY PiYOTqkGJiahbxaLe7h2CT7S52lf1/TogMOXdxr2J/pemp+PNGbSL+F7P/H/bQO3Iu2U01Ys si0Ct9KjKwx91HfMaGCcv9+jZMfiE888l1/6JX+g9NF7tcc+H04t1csOlF9z23KdzZ8nQT1L Pya9T/0fdru8rjm7uyPu/avqNlv/+W6tt7wK/gedPHPqWXqTj/3LJS29Xf6Mmcf+2r00rnd4 oe/0+6ZvZMqi+cVPv2/XCg7efGnbhv1lVmaWfcVxqQt6z0+XLWPqFnWY/uKyVEBz+46IA0tY uTzUri0uXD3lqO7/fdPbSq/va2GsnuPvc6j1JsPxjSdzGiu228xj7mG4z66/TjnkldCTOKWl gVIbWyvvK7EUZyQaajEXFScCADMqoCUkAwAA X-CMS-MailID: 20231006130044eucas1p17a141ec5aafca3d5af5295049f8b1651 X-Msg-Generator: CA X-RootMTR: 20231006130044eucas1p17a141ec5aafca3d5af5295049f8b1651 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231006130044eucas1p17a141ec5aafca3d5af5295049f8b1651 References: <20231006125557.212681-1-m.majewski2@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231006_060047_255198_69ACF39D X-CRM114-Status: GOOD ( 19.41 ) 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 Past versions of this driver have manually calculated base values for both the pinctrl numberspace and the global GPIO numberspace, giving both the same values. This was necessary for the global GPIO numberspace, since its values need to be unique system-wide. However, it was not necessary for the pinctrl numberspace, since its values only need to be unique for a single instance of the pinctrl device. It was just convenient to use the same values for both spaces. Right now those calculations are only used for the pinctrl numberspace, since GPIO numberspace bases are selected by the GPIO subsystem. Therefore, those calculations are unnecessary. Signed-off-by: Mateusz Majewski --- drivers/pinctrl/samsung/pinctrl-samsung.c | 15 ++++----------- drivers/pinctrl/samsung/pinctrl-samsung.h | 2 -- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c index 952aeeebb679..79babbb39ced 100644 --- a/drivers/pinctrl/samsung/pinctrl-samsung.c +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c @@ -45,8 +45,6 @@ static struct pin_config { { "samsung,pin-val", PINCFG_TYPE_DAT }, }; -static unsigned int pin_base; - static int samsung_get_group_count(struct pinctrl_dev *pctldev) { struct samsung_pinctrl_drv_data *pmx = pinctrl_dev_get_drvdata(pctldev); @@ -389,8 +387,7 @@ static void samsung_pinmux_setup(struct pinctrl_dev *pctldev, unsigned selector, func = &drvdata->pmx_functions[selector]; grp = &drvdata->pin_groups[group]; - pin_to_reg_bank(drvdata, grp->pins[0] - drvdata->pin_base, - ®, &pin_offset, &bank); + pin_to_reg_bank(drvdata, grp->pins[0], ®, &pin_offset, &bank); type = bank->type; mask = (1 << type->fld_width[PINCFG_TYPE_FUNC]) - 1; shift = pin_offset * type->fld_width[PINCFG_TYPE_FUNC]; @@ -441,8 +438,7 @@ static int samsung_pinconf_rw(struct pinctrl_dev *pctldev, unsigned int pin, unsigned long flags; drvdata = pinctrl_dev_get_drvdata(pctldev); - pin_to_reg_bank(drvdata, pin - drvdata->pin_base, ®_base, - &pin_offset, &bank); + pin_to_reg_bank(drvdata, pin, ®_base, &pin_offset, &bank); type = bank->type; if (cfg_type >= PINCFG_TYPE_NUM || !type->fld_width[cfg_type]) @@ -671,7 +667,7 @@ static int samsung_add_pin_ranges(struct gpio_chip *gc) bank->grange.name = bank->name; bank->grange.id = bank->id; - bank->grange.pin_base = bank->drvdata->pin_base + bank->pin_base; + bank->grange.pin_base = bank->pin_base; bank->grange.base = gc->base; bank->grange.npins = bank->nr_pins; bank->grange.gc = &bank->gpio_chip; @@ -891,7 +887,7 @@ static int samsung_pinctrl_register(struct platform_device *pdev, /* dynamically populate the pin number and pin name for pindesc */ for (pin = 0, pdesc = pindesc; pin < ctrldesc->npins; pin++, pdesc++) - pdesc->number = pin + drvdata->pin_base; + pdesc->number = pin; /* * allocate space for storing the dynamically generated names for all @@ -1129,9 +1125,6 @@ samsung_pinctrl_get_soc_data(struct samsung_pinctrl_drv_data *d, samsung_banks_node_get(&pdev->dev, d); - d->pin_base = pin_base; - pin_base += d->nr_pins; - return ctrl; } diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.h b/drivers/pinctrl/samsung/pinctrl-samsung.h index 173db20f70d3..9b3db50adef3 100644 --- a/drivers/pinctrl/samsung/pinctrl-samsung.h +++ b/drivers/pinctrl/samsung/pinctrl-samsung.h @@ -269,7 +269,6 @@ struct samsung_pin_ctrl { * @nr_groups: number of such pin groups. * @pmx_functions: list of pin functions available to the driver. * @nr_function: number of such pin functions. - * @pin_base: starting system wide pin number. * @nr_pins: number of pins supported by the controller. * @retention_ctrl: retention control runtime data. * @suspend: platform specific suspend callback, executed during pin controller @@ -293,7 +292,6 @@ struct samsung_pinctrl_drv_data { struct samsung_pin_bank *pin_banks; unsigned int nr_banks; - unsigned int pin_base; unsigned int nr_pins; struct samsung_retention_ctrl *retention_ctrl;