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 LrvHnWt72Dw2L6n36NuyitHj8ya5ANYoLpuU1JzMstQifbsErozOO3UFPYoVJx59Zmxgf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a2WHvkLrvF4TftrBardv1hdOD22Dnr LrvHnWt72Dw2L6n36NuyitHj8ya5ANYoPZui/NKSVIWM/OISW6VoQwsjPUNLCz0jE0s9Q2Pz WCsjUyV9O5uU1JzMstQifbsEvYzOO3UFPYoVJx59ZmxgfCTdxcjJISFgIrFjxw02EFtIYCmj 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;