From patchwork Mon Dec 6 23:32:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 12695057 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 E03E7C433F5 for ; Mon, 6 Dec 2021 23:33:54 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Subject:From:To:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=VTvFMtcH/Qb26lylndRFdAyIVNna3clIzLwDYt4027M=; b=f7EN07gxYKq2CI JBczYmAiyV2vC98FsKUZQZVpJ04vIzMCVDRmlrrY2LcAtxKquIOh2qCgIum5HdDGXRYf85PGhJyEC ik6BNV3/DLbxr6293uRwUr8Xd4OX4eV9R9y9McFZGnMTr4ZI9y5YClF9ooWk1et6vsJaywK+lG1AC k2Zxrqnb4Gqnuc5ARU5L1zRb6tcV1JQ4gpoBcdd56VhJN+Darw62EhK67pNv3DX+CK2Ugq78rxnyP mup2WWmXOsI7vJGDdMwV1DGs73Ljm1zE/8jK652sWiKrxGlZJIo6o9LO2ZHga1UBdA1BjuviGknkv UNoi8w89Rfj5xDWsbfjw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1muNSy-006W4R-6z; Mon, 06 Dec 2021 23:32:16 +0000 Received: from mail-eopbgr60105.outbound.protection.outlook.com ([40.107.6.105] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1muNSu-006W3V-H9 for linux-arm-kernel@lists.infradead.org; Mon, 06 Dec 2021 23:32:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aFnKmOTIsAnxEZHDh4M1KRT0Hum963JyUO0WiAt/ct/yZfAfsclDcRA9HN1IF4YVQZm28p6Tyer7BZbcaY4JkOsre9aHNBD09ak+0+PAz3zSOKdHwAuXy01FOiMDhVvN07IwarGBh2oB/QkAM1Uo63zGV90PZIrCAmNia3zmgaIeowQDh+pKBJztySzonRtk11FRLFYOtTDXsFonsIkKPb92talPvhGLhGe3iW6xEeH86VlR/9iH+P3JnD7Vf54xTAj/GoRkmLA8pcZFXuhs8oru0cG7trepOEt7+AEY8LJibiJBF/9luz8tfyXCGu+7ItwaVTKyxetlyrAItxtssA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6doiZQHFai/phyfyJ2/J9eao/4SzhJ8lReE04/Eke/0=; b=TCLJRKKu2CeIhwH2TVMVeI+4jvUO4nxiHcr5MI1NFLyFV1p7bdBU8yTHrnuVJndCu+eyRD4iZcMsvsZhA1YUHFQghyy/K85EcHwDWLKQFcZlJsLHAEgcEcLLHB1SJ4r53PTPOO/TfzJYTm6Z0UicpVaH0YqBjw2L3fok9vDSHcrPR7VXoi2b10oNNPxEC45SFArUGlkPCO/dMrjUKg3z5rw96LIobYFq3WfkBw3978O2uXO7kPhEoHvAZsdPJl9CTMQCCsQBi0Evbzxy4P6CEihOXnb44YyUEGGG7jFTK058+Kpv61Dg9jAz6xdZ1JjUHeSSX6jYPz5nmkh37+FVlQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=axentia.se; dmarc=pass action=none header.from=axentia.se; dkim=pass header.d=axentia.se; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentia.se; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6doiZQHFai/phyfyJ2/J9eao/4SzhJ8lReE04/Eke/0=; b=giOOwhBegVPAPySLSaEOzwEXo56MGIqn7v9DGLc0J8kQAG6+91ifQT78FndkazXPJFfbHOeqB7f0JAlLez4YOwltpV0YoqaT5GJXcjGlSvA4RAsYn7YpZzxuGuKM9U3oOMjZ03d+O9s7DumUn1p4gKAucEqigEtKQ//RWVc7CDc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=axentia.se; Received: from DB8PR02MB5482.eurprd02.prod.outlook.com (2603:10a6:10:eb::29) by DB7PR02MB4105.eurprd02.prod.outlook.com (2603:10a6:10:41::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.11; Mon, 6 Dec 2021 23:32:06 +0000 Received: from DB8PR02MB5482.eurprd02.prod.outlook.com ([fe80::7519:c72c:98b1:a39]) by DB8PR02MB5482.eurprd02.prod.outlook.com ([fe80::7519:c72c:98b1:a39%4]) with mapi id 15.20.4755.022; Mon, 6 Dec 2021 23:32:06 +0000 Message-ID: <4d17866a-d9a4-a3d7-189a-781d18dbea00@axentia.se> Date: Tue, 7 Dec 2021 00:32:03 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Content-Language: en-US To: "linux-kernel@vger.kernel.org" From: Peter Rosin Subject: [PATCH] pinctrl: at91: allow use of of gpio-line-names property Organization: Axentia Technologies AB X-ClientProxiedBy: GV3P280CA0071.SWEP280.PROD.OUTLOOK.COM (2603:10a6:150:a::6) To DB8PR02MB5482.eurprd02.prod.outlook.com (2603:10a6:10:eb::29) MIME-Version: 1.0 Received: from [192.168.13.3] (185.178.140.238) by GV3P280CA0071.SWEP280.PROD.OUTLOOK.COM (2603:10a6:150:a::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.11 via Frontend Transport; Mon, 6 Dec 2021 23:32:05 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a303c2b7-ef59-4298-db0c-08d9b9109d7c X-MS-TrafficTypeDiagnostic: DB7PR02MB4105:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WvRYbvcuYCfD6YRQUhkjz/AHpdydMIeGMljnAitKc837PbYkMgBlDikVkk9K6K94m+s4HBjYXQgz7fkKMPMeE4L/o5eYLPsQa4rZALy1Y9QmLFbvZKcDrngZ1mI6I0sumVz4honQEZSPug2o/j00oAKWBTNPWjx+8M9Nzh7/mEsUXvYxQAL05fnEtlf2QIpqwtR0/3espWAutk+Ft/Jgnl2XwWmNXMhaVdV1YhKymzaqDVYWP264uKSd0BrdqJXhuV7j8IdOJqbP3gMfLWh4hQxD6tmuOnw9+4QfP2MXlVfvfv4y7Rf6iH2W4PYuImseOBJseSph9lxfEARhgzklXov0K9jIgcw3znpNUiJ/KVVhNFBo6JM21+1RqaP8LEdG1ouuN9972xloFECKtnwELvuWLBhhurQ0ZORMJV8heBE30/PaAm2HsV9ignfBwUOC8E7J3So6rI6AFICtNyK4SIZsu6BYx8Xt77B3fv40JQDGuwA+mP+8M4q+0Xwl5CQF9rrn0KC+57b3+HFkbvX9MxcMqLKLBJ6TRB1Yc0eQ6QRuuvgRMoJ4Tt1+p074D5XgUGbezMnoEchFNRwwl49P0ahyOgjjMd0kZqprIqaeQo4VYFbp5nc7ot7uHpM+WZgn3XmijWUSaVF6EddTuthMj7bcbl3Ca2yc4OPrm8gbqBlYCGkZRA29hDZOvoh2jSDr2B41eDmmiQqiBd/JpMoQkZhnEgy3zMUN471KO9k0jKQ= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB8PR02MB5482.eurprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(346002)(136003)(366004)(396003)(39830400003)(376002)(5660300002)(83380400001)(54906003)(86362001)(4326008)(6916009)(16576012)(36916002)(31686004)(26005)(316002)(2906002)(508600001)(66946007)(956004)(8676002)(31696002)(8936002)(36756003)(6486002)(2616005)(38100700002)(66556008)(66476007)(186003)(45980500001)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?OWtMnRCPAmMvQ5yvNBhCqivq+LCD?= =?utf-8?q?4HmGuzu62RgmXB17QiKiJhv1TeZWa0fSKR+8Xs1XiEdjagYwKyEs/6RfdUMIWyoW9?= =?utf-8?q?V9l6aR/xHzpqng6FTeN8ZmHlobqMzkaOBQ1+x6DrNTV9VYy4oh+d2X5XHhEWY8vXC?= =?utf-8?q?0pZGlMf6blFBhsPzBpmPTZcF6z0DPi7LlBsC0Rt67nxCpnzVLSmzktPYZOIFedzqq?= =?utf-8?q?vTG13VUriMetn3oGR52GGwoH32uEuvTsUeLw4fQuRbtY2YcxKLczy+3ef84BZzoaq?= =?utf-8?q?prtgi9mNSzMM8/pguYQZujdmI6B/zcqIYgqVRG4Wk7EWwS5FmkzA8KAAn0mJkPZrX?= =?utf-8?q?E6/OYntsstWB1Pji0+iRTdQTCL2AT6eWsQ65FQT8RAPlPazBX30O9AG0LPLxsuTf2?= =?utf-8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IbSLfPjt5mb7Wllj2upFijLN4bISGdKJtrsYC2fCXdKhTtzAJfnsf1aciN0vyjv?= =?utf-8?q?Vwcc4jzGotOvzEnA+B0JxXBFjIXyMEHyZRsiNqX+MI5WhEm+yRGUEULAmW9FNf3w4?= =?utf-8?q?H1/aDsBSRmoiNQjPjirLatkXNi0oAI342em+8bbfryvmnZMU6yWmecybgutTeQJvc?= =?utf-8?q?QdUXeaQU3qw/Rfhl7r58szp/0NRMRxMhYvJMNSEHepDTZxlVpYSxMqyU=3D?= X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-Network-Message-Id: a303c2b7-ef59-4298-db0c-08d9b9109d7c X-MS-Exchange-CrossTenant-AuthSource: DB8PR02MB5482.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2021 23:32:06.4195 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4ee68585-03e1-4785-942a-df9c1871a234 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kfZpJQfiJyFrgyaXOk9EAv9EaTxzFrmTtYVvwAliZjNDE4XUmJUvdhBLwPnHh1ZS X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR02MB4105 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211206_153212_636589_DF106871 X-CRM114-Status: GOOD ( 13.75 ) 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: , Cc: Alexandre Belloni , Linus Walleij , "linux-gpio@vger.kernel.org" , Ludovic Desroches , "linux-arm-kernel@lists.infradead.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org If no line name is given (by not having a gpio-line-names property, or by having empty "" strings for some lines), fall back to the existing pioC12-style line name scheme. It is useful to be able to explicitly name lines from the schematics or its function, rather than having the MCU names forced upon every user. Signed-off-by: Peter Rosin --- drivers/pinctrl/pinctrl-at91.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) I don't know if it's sane to fall back to the pioC12-style on empty strings, or if someone adding a gpio-line-names property should be responsible for filling in those names "by hand". I generally don't care what "unused" pins are named, so either is fine by me... Cheers, Peter diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c index 6022496bb6a9..4f108d07e6ad 100644 --- a/drivers/pinctrl/pinctrl-at91.c +++ b/drivers/pinctrl/pinctrl-at91.c @@ -1821,7 +1821,7 @@ static int at91_gpio_probe(struct platform_device *pdev) int irq, i; int alias_idx = of_alias_get_id(np, "gpio"); uint32_t ngpio; - char **names; + const char **names; BUG_ON(alias_idx >= ARRAY_SIZE(gpio_chips)); if (gpio_chips[alias_idx]) { @@ -1890,8 +1890,15 @@ static int at91_gpio_probe(struct platform_device *pdev) goto clk_enable_err; } - for (i = 0; i < chip->ngpio; i++) - names[i] = kasprintf(GFP_KERNEL, "pio%c%d", alias_idx + 'A', i); + if (of_property_read_string_array(np, "gpio-line-names", + names, chip->ngpio) != chip->ngpio) + memset(names, 0, chip->ngpio * sizeof(char *)); + + for (i = 0; i < chip->ngpio; i++) { + if (!names[i] || !names[i][0]) + names[i] = kasprintf(GFP_KERNEL, + "pio%c%d", alias_idx + 'A', i); + } chip->names = (const char *const *)names;