From patchwork Fri Jul 23 07:58:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jeffery X-Patchwork-Id: 12395451 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D94A4C4338F for ; Fri, 23 Jul 2021 08:01:49 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A189160EBD for ; Fri, 23 Jul 2021 08:01:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A189160EBD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=aj.id.au Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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=MLG/ZIeHL5xtx8FZLg+GKydNXq9X2vTHFqN1qBbaxtk=; b=kriszVOJ8Uwf7h s6zEHt+b/MZlHUs+scO8jxtyy/Z21oxQOqf1h3xnU0wQ/hGRBTrYT/4mqVHUZnbrXnUdiJ/T2qs+E jvNdyDWqiqYruDWZSffNcH/D+AEIKrpNXQ6PlWbWiHn9ScophFTEUNqR3kRxq5PkyFbxaGlUVADhk wYtX5zF3WyGFwftQfk0sSI/CsvUrsaHvrpJMI+WZYckz9aS6Wa7Ht/mHhoOgvP0zz1dqjjzo2TauR E1H75KvY+M/dsX0RYjzlrQp1B9IMmGvni4BW5zKBJ2si9agehONZYTUnCkVqZ4S7CumO3qxCgK04H 1K7EnIeVklUN9iS1mNgA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m6q5z-003mbh-MB; Fri, 23 Jul 2021 07:59:47 +0000 Received: from new2-smtp.messagingengine.com ([66.111.4.224]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m6q5g-003mVN-Mv for linux-arm-kernel@lists.infradead.org; Fri, 23 Jul 2021 07:59:30 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 1EAE1581648; Fri, 23 Jul 2021 03:59:28 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 23 Jul 2021 03:59:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aj.id.au; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=FL7d3DKD/w/mD 2Cy6ISU7AvGUnJr6NtK3PC+jbi7Vek=; b=JSZnIxLpHBR3Njwf2tb7V9IoNe/HJ jylTJnK1aspzSiYLtzIXiWXN0emgYGI7xozW+Xobmzh0k+s08qPx3qT9G/m6XNNM M3ExHWI34mojpdfjTqDgMHXrUHFtcvklGzx2hYcjy2vjCjLtXlCvrjHNlR+bb2iy zsNftFoEgxWr9dW2wbs9CWwHErsfz563TCpqBUPJH1TJdy8HM05B8o/3aTpFplmx ozGxM50nYeZ/XlEnyhYqcVwFNcBSjD5tV+Yk2wI0vLy0lbsIXml0MbQzqkdKcwkM wtMaZcNzUP1UR1AjcXAyEP9yqMd90265R8QimGMDhKNLeJCBk/MrmtwoQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=FL7d3DKD/w/mD2Cy6ISU7AvGUnJr6NtK3PC+jbi7Vek=; b=EeTsDFpJ AHLazN3xvoV6v35U9PMiextcf+3Jrm7k51n6N/W6EdwQoCOdjRvAZttJGCow4/SA 9vtMd0JULQzphfOkUNBCYpIcPyLIjcFplJvE4TXYLU/ADy2PJkVAt4yNa2p3tTqy Tlr/jmVdSIG8iZ1BbxxKdU1anCBrQYQyneIE6NmAX9BGuITYMzEFTBlVg0KTmf5y q0G6s4akqYkmP6KA9FOxCyyaoVoWuCstE2jAUvQlDdbCEPsTATEDutKn4LpLjz3W c4cyDeIdm4vS8CelnRSCOuagPTGQooqA2f4d8M41Idyp7Rp8zKlhxsT1/Bl/0jmK 5bberMT3Bc6cZQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrfeejgdduvddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehnughrvgifucflvghffhgvrhihuceorghnughrvgifsegr jhdrihgurdgruheqnecuggftrfgrthhtvghrnhepjefgvdevheetkeevgeegleelgfelte etjeffleffvdduudevieffgeetleevhfetnecuvehluhhsthgvrhfuihiivgepudenucfr rghrrghmpehmrghilhhfrhhomheprghnughrvgifsegrjhdrihgurdgruh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 23 Jul 2021 03:59:23 -0400 (EDT) From: Andrew Jeffery To: linux-leds@vger.kernel.org, linux-gpio@vger.kernel.org Cc: clg@kaod.org, robh+dt@kernel.org, joel@jms.id.au, pavel@ucw.cz, linus.walleij@linaro.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 2/6] pinctrl: Add hook for device-specific map parsing Date: Fri, 23 Jul 2021 17:28:54 +0930 Message-Id: <20210723075858.376378-3-andrew@aj.id.au> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210723075858.376378-1-andrew@aj.id.au> References: <20210723075858.376378-1-andrew@aj.id.au> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210723_005928_857997_A0EDD01A X-CRM114-Status: GOOD ( 12.45 ) 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 The devicetree binding for the PCA955x LED/GPIO expanders was not written with pinctrl in mind. To maintain compatibility with existing devicetrees while implementing pinctrl support for the PCA955x devices, add the ability to parse a custom device node layout to pinctrl. Signed-off-by: Andrew Jeffery --- drivers/pinctrl/core.c | 6 +++++- include/linux/pinctrl/pinctrl.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index 9c788f0e2844..e4862552eb9b 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c @@ -1063,7 +1063,11 @@ static struct pinctrl *create_pinctrl(struct device *dev, INIT_LIST_HEAD(&p->states); INIT_LIST_HEAD(&p->dt_maps); - ret = pinctrl_dt_to_map(p, pctldev); + if (pctldev && pctldev->desc->pctlops->dt_dev_to_map) { + ret = pctldev->desc->pctlops->dt_dev_to_map(pctldev, dev); + } else { + ret = pinctrl_dt_to_map(p, pctldev); + } if (ret < 0) { kfree(p); return ERR_PTR(ret); diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h index 1ceebc499cc4..2eeec0af61fe 100644 --- a/include/linux/pinctrl/pinctrl.h +++ b/include/linux/pinctrl/pinctrl.h @@ -95,6 +95,7 @@ struct pinctrl_ops { unsigned *num_pins); void (*pin_dbg_show) (struct pinctrl_dev *pctldev, struct seq_file *s, unsigned offset); + int (*dt_dev_to_map) (struct pinctrl_dev *pctldev, struct device *dev); int (*dt_node_to_map) (struct pinctrl_dev *pctldev, struct device_node *np_config, struct pinctrl_map **map, unsigned *num_maps);