From patchwork Wed Mar 10 12:54:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= X-Patchwork-Id: 12128031 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=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,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 2843EC433E6 for ; Wed, 10 Mar 2021 12:58:51 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 A7C4964F45 for ; Wed, 10 Mar 2021 12:58:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A7C4964F45 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; 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:To:From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Zk+wUbWYtuiURnvoiksdLcXCfZEyCkzN0nA+FLB019o=; b=B1Tp2qVQR0WkFmHsprCBkaBmU 7dKSUXFUQx8T0Mnds4HvKFx056ykTXWOkG66g2nkF5EyDEU8zjq+3Lfq4qYqDXYyiOrX3NGIWsjX5 hRK67zY+RFTMm+cYGFBGlb6WU0rKh8IrALbz/jWd/U5Ka+nlDPvuRKWQMrsLD5QS1Ie6XI7yr1ra7 rYItuPvMhDIcf5CATb+Do133TMnyz/YQ9iJmZEfFG9PqaWAdA44vEkPjOwV0HrcjXUjw1CwGWUh8b o7yWD0h4LOiOVRlGqc6jIzG4/LUaNQslQqrJ1YqhRhj5FBuraXb0xkjDNB/kABYBtARroP8ROG+PT scyN5dTkg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lJyOo-006pwb-9A; Wed, 10 Mar 2021 12:57:14 +0000 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lJyMo-006piV-1x for linux-arm-kernel@lists.infradead.org; Wed, 10 Mar 2021 12:57:12 +0000 Received: by mail-wr1-x42c.google.com with SMTP id u16so23184681wrt.1 for ; Wed, 10 Mar 2021 04:55:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=PAJAtWRkOAd1GAbdY1wbENWkeMEKWY/41w1iBmNjTLI=; b=cazss+i4tQDmShbLOPgzyz+hTJ+DcsxQmLGpcenNbyn+nRyLZgYb4FEX6eQ6iH1sms 6WuV1tFBGn3TJNXpphOQy5OZIp4fIJKNwV/bVwtjqz90sUs0N9aysxJ0mQeL462kRwoC jA5zJ8esGY4/t+V7r/PVR473ZtnppYJZCJMynJJZAxApOskbL9t/L2su9ZXAuwYNOK07 HlTBNx77fR5yTUUG0bf8L2g/MXYuVU25HjSZjTnvIzZZFMHsDIhQb+db1Mfa875+XLvF UaOMY0XGlABF98uaGNIdDJUhZCVilazp+oVyT/GdFbyVJa5c5eLUixMkeqWYhQetm27i vF5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PAJAtWRkOAd1GAbdY1wbENWkeMEKWY/41w1iBmNjTLI=; b=M9YOGvYpnYji9rSvLDrJtWUHLRs7oqUY6DD7pkr1Sh6CWQKQqUf9wYzMofnYFvyml/ QD1rdPH4IM0yHjDoXg83QL+BrymwAEX+ZmBbomJ3bKPBnro6Fk7yCfbzeBqTKmym4dIu tsUew1MxhCUYDyAfELlBU6yQI5cMXPwUP9n1HWnopedu1byvNL56v82rAN7wUvD0t2DC GavfQPrdLP3kx1TUf0SoIZBT5XzGVokFZJZurXa+nVeiUTa4IWeZ6DrKLuMqlJg5WHye jpgetUCob6+5+HIrefx2l+npVgkC/w7OweqIbMlrW2NiQXT3IaZdCiLSYumXtil7+fnP 4dNg== X-Gm-Message-State: AOAM531W6fEYsK9JTAhKmxD+Z18zCpaLUC3XQAdYzXg8fP5mFFfR31k0 kor8kcOpyBDplCBgq7q+5e0= X-Google-Smtp-Source: ABdhPJzxO4akgYd8HXWjCFx0nCm0awc9dI0zGCOnlB0OxUCYnUMZ+9e8/904IpOxNxHlkV+9J9pf6A== X-Received: by 2002:a5d:6945:: with SMTP id r5mr3328286wrw.367.1615380908661; Wed, 10 Mar 2021 04:55:08 -0800 (PST) Received: from skynet.lan ([80.31.204.166]) by smtp.gmail.com with ESMTPSA id v6sm29403398wrx.32.2021.03.10.04.55.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Mar 2021 04:55:08 -0800 (PST) From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= To: Linus Walleij , Rob Herring , Michael Walle , Bartosz Golaszewski , Florian Fainelli , bcm-kernel-feedback-list@broadcom.com, Jonas Gorski , =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= , Necip Fazil Yildiran , Andy Shevchenko , linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v6 02/15] gpio: regmap: set gpio_chip of_node Date: Wed, 10 Mar 2021 13:54:50 +0100 Message-Id: <20210310125504.31886-3-noltari@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210310125504.31886-1-noltari@gmail.com> References: <20210310125504.31886-1-noltari@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210310_125710_557259_6EB53193 X-CRM114-Status: GOOD ( 14.09 ) 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 needed for properly registering GPIO regmap as a child of a regmap pin controller. Signed-off-by: Álvaro Fernández Rojas Reviewed-by: Michael Walle Reviewed-by: Andy Shevchenko --- v6: add comment and simplify of_node assignment v5: switch to fwnode v4: fix documentation v3: introduce patch needed for properly parsing gpio-range drivers/gpio/gpio-regmap.c | 1 + include/linux/gpio/regmap.h | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c index 5412cb3b0b2a..d4fc656e70b0 100644 --- a/drivers/gpio/gpio-regmap.c +++ b/drivers/gpio/gpio-regmap.c @@ -249,6 +249,7 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config chip = &gpio->gpio_chip; chip->parent = config->parent; + chip->of_node = to_of_node(config->fwnode); chip->base = -1; chip->ngpio = config->ngpio; chip->names = config->names; diff --git a/include/linux/gpio/regmap.h b/include/linux/gpio/regmap.h index ad76f3d0a6ba..334dd928042b 100644 --- a/include/linux/gpio/regmap.h +++ b/include/linux/gpio/regmap.h @@ -4,6 +4,7 @@ #define _LINUX_GPIO_REGMAP_H struct device; +struct fwnode_handle; struct gpio_regmap; struct irq_domain; struct regmap; @@ -16,6 +17,8 @@ struct regmap; * @parent: The parent device * @regmap: The regmap used to access the registers * given, the name of the device is used + * @fwnode: (Optional) The firmware node. + * If not given, the fwnode of the parent is used. * @label: (Optional) Descriptive name for GPIO controller. * If not given, the name of the device is used. * @ngpio: Number of GPIOs @@ -57,6 +60,7 @@ struct regmap; struct gpio_regmap_config { struct device *parent; struct regmap *regmap; + struct fwnode_handle *fwnode; const char *label; int ngpio;