From patchwork Mon Mar 15 11:41:54 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: 12139007 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,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 A592CC433DB for ; Mon, 15 Mar 2021 11:49:14 +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 33F8864E27 for ; Mon, 15 Mar 2021 11:49:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 33F8864E27 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=UsWg4af6vle1OpgkLqNtcrjH0AdqeL2NRTYQA/7p0HM=; b=nqrfufwUi4fZD/NJAjOkXym47 J3r37sH/OgD7Wta2ueGqc7IpN9x/wBfLNpQOoq+71lU5RylZQ3DgtoJrnBtruOwF2WW4oTiv7j4pm dVQ0YTgFKJ53V5gz+Tvyjau/A4frbJwiel06vzaMoe9Om9vvPX+b3jkTN8rnWGTvVHZAiVqTnaf1V 637TMtTPl1Iz+41i/GQ/1Hb9F5rL2Yjcc8/VOeo8ibk+YfYlsjewpeoiwYgF/vJunQt6Camsv+QAU nCS3ezCatWIcCMxJcbN4kz4QytHEKqk9PQ5q1IxB71u8rpU1aF0FjNBWGnE8hCJ9YI6DaT0kmYM/B 03y34CA2w==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lLleZ-00FhD0-O9; Mon, 15 Mar 2021 11:44:57 +0000 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lLlc3-00Fgp2-Hh for linux-arm-kernel@lists.infradead.org; Mon, 15 Mar 2021 11:42:23 +0000 Received: by mail-wm1-x329.google.com with SMTP id f22-20020a7bc8d60000b029010c024a1407so20067274wml.2 for ; Mon, 15 Mar 2021 04:42:19 -0700 (PDT) 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=8p2sRr73izT3MD3Slfxb4OEVn7AXvUcs0YwW7of8/6E=; b=al8HSrrpctWOAl0Cok55UGPRu1EkYMKzjy4V8Yu/mydPEMhZSioCeDdO9e9Jt2Gsu/ eH8UzTCBWspY+CEz3+x8lSCX9FlaC6FeMvTjivsSabmzfSFODY81soFBTa4WWgs+5MXO zk0N/mJ3HcZ7ISErJwX3rh9njHaNow847Qyy7s2lJ5FPSLD8+CnbBTbeHEi5AZVsSRpe SmeNzSK7MrHbRQPO0qCkfS+SORCcMw+tBlXO0n7AOFRw5Zk2+rVlljTEuvWyDF73nXMw dHU9s0y/FxqnYbwk/m81+2LoRQzJu0MYRxgxrcK89bKMThrHN0ji5k5Tpuqxom1gW6MF tS8w== 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=8p2sRr73izT3MD3Slfxb4OEVn7AXvUcs0YwW7of8/6E=; b=G2iREIb9zn+bKJGA6Lc/VPa4iPzLk62F7ruMqJlc++S0dqOu146hLEXGLqJvrtQd6+ vAdYx4lxs1eWwEJkkoZVf0Z6nqneB32rl54Q9SedvtZ572DkakpC8tVappyBBnW3FBq9 JslGTLzjGEC29hCCKH1J0rUxBLfqYEdyjVnnEC6x3Cf+eNDKQaQxhX4QAVv6IebijCVQ C01J0dJq/cNM6GAPobf8VZiBxx6ngBfvJkRe6Q7TS3V9WRD3gg3R5rHOLdr6PREn7x0v tcUNXMtUvhgIqZq9uo60rGhcX/GBNegDO0uCKniK/WWNL0wWsBGBIIxwYKUA/3ZiqANi CoAA== X-Gm-Message-State: AOAM530WvkPZtZFlxuvF5w0tIpzCqoy1CDOvw0ivvHGx1xrpMjzQEniA e2sfCWRjMteA9HugfzmQbak= X-Google-Smtp-Source: ABdhPJwyTWVEOLAJO+TLh3kueXLO11+bPQPE2bmeQFiIWusEGPtL4QMTlJ0r0VzGkLp+5FZBVRJ6bA== X-Received: by 2002:a05:600c:2053:: with SMTP id p19mr25641528wmg.87.1615808538919; Mon, 15 Mar 2021 04:42:18 -0700 (PDT) Received: from skynet.lan ([80.31.204.166]) by smtp.gmail.com with ESMTPSA id v189sm12648187wme.39.2021.03.15.04.42.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Mar 2021 04:42:18 -0700 (PDT) From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= To: Linus Walleij , Bartosz Golaszewski , Rob Herring , Florian Fainelli , bcm-kernel-feedback-list@broadcom.com, Lee Jones , Michael Walle , =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Roja?= =?utf-8?q?s?= , Jonas Gorski , Necip Fazil Yildiran , Andy Shevchenko , linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 02/22] gpio: regmap: set gpio_chip of_node Date: Mon, 15 Mar 2021 12:41:54 +0100 Message-Id: <20210315114214.3096-3-noltari@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210315114214.3096-1-noltari@gmail.com> References: <20210315114214.3096-1-noltari@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210315_114220_483045_26A32D71 X-CRM114-Status: GOOD ( 14.77 ) 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 --- v7: add gpio-regmap.c comment 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 | 2 ++ include/linux/gpio/regmap.h | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c index 5412cb3b0b2a..2215d712da08 100644 --- a/drivers/gpio/gpio-regmap.c +++ b/drivers/gpio/gpio-regmap.c @@ -249,6 +249,8 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config chip = &gpio->gpio_chip; chip->parent = config->parent; + /* gpiolib will use of_node of the parent if chip->of_node is NULL */ + 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;