From patchwork Sat Mar 6 15:56:59 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: 12120109 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 8BC2BC433E0 for ; Sat, 6 Mar 2021 15:59:30 +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 E029364FF0 for ; Sat, 6 Mar 2021 15:59:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E029364FF0 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=6ytmsDAWRIqTvQUp3zL374vtJ+TEPlsNCTnlxerFrhM=; b=k6sZQmApIWIIbvfCpHKRFuRHH rJeSLSuNo6FFe/LSJI/OYIqq0p8Lq0b/kAQvrpGxo//h/xryYAZ7MfQJpR1Yo6I76khqFSDsbXtUU I8c61tnIUW30pmZOB/hT3HOdykw1eHwtQ9WhGE/OvJqWh9nDDOqbD3xEZ010L29IB7r/B6V9rUvBg 6bxezhwYoO00wcVBbrlvQrreqpns0uIJvg3RKz6kQ6EvZ53FTDeedlFg5GUM1+3eO7FM5ztpAO4HN 0dt3fAbDrr7a78MoJAG7s+R7BHc8+kgxlaVWUNUDIUYB6sQEQD0/C7AUbiisEwKXmGcyAbhYR1tKA kTwUhg2vw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lIZJV-003V3L-M8; Sat, 06 Mar 2021 15:57:58 +0000 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lIZIu-003UqE-BB for linux-arm-kernel@lists.infradead.org; Sat, 06 Mar 2021 15:57:25 +0000 Received: by mail-wr1-x434.google.com with SMTP id a18so5903235wrc.13 for ; Sat, 06 Mar 2021 07:57:15 -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=i2/CD8od2LVeeQI8j9cSShPFvLURIkZli5+jweOumGs=; b=BC8UnkuuvYHiJYmTRuzg2weD9srUtY6Pj3ykzemMW7rA1pcoDHbmTMeM3FGJugFbHZ Vs7DMi6gchiknFBReddn2WSuMXt6DmCo+wViu+nHnLr0Abos3Jo+SmQMoPws0pT/lmVT NM46VbWhLqEgEYtMv8zoEsZfpqR7fJjyMVuT0DC4z084RDMkd5nYZ/jZ0ce0IWLilORq XeTxn+5zPRq9/7MNR6cTP4d+p1ArYXLCLgPTY/CqqX7HzO6P6UueM3miCAhRCmQt+/Es 4w4B037kd8hs5rBe3XUEQW3ki+BMK+VsBxNuNpvPcbRmDPRJPUYmntp19vjQLG3UO7/z 3UGg== 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=i2/CD8od2LVeeQI8j9cSShPFvLURIkZli5+jweOumGs=; b=fB5w1NefLtxZsd2UQ4CNLmudnqHCM217wI9r295PCvORfUIT1O22T382MMrDBTgMLM GXDZUBHDdtfnL5+gLxNdQnBVGmauiBt6QplWu9PJCfGYDvdXkatX3JrUyjyLI3BXtHkf h7TBxl56KQntEl26Xnzwd5pOPe23+Hwu7J/+Kk01AgzrG2s0C79XLqWJM0iKNV5fTcPg jd5Ntnoa/J/PMpinmcalx76xmuGfz4TsmGUFXS/R/msxCX2/nd1ilBmdvPd0o7cgFc4z gKkmgJ8PLlpp66GaBkTjWmdCeS6VCJ1KbowAWa1q8m8doBSAMerb7lOUa4ob3CGTYBl4 RRTw== X-Gm-Message-State: AOAM5313T3pr1dSlKtsl3cSHherhPIBxQuUNy+VOYK166pJgCM/KRqg8 3LghtgoYgKVS97qj32/AKTM= X-Google-Smtp-Source: ABdhPJwL/h4+/NswiGP/6Nf6hKisVVxQU4suYN1jE/z2P769HUCaRenm5PODvzOxjGIOxJO6wTi5xw== X-Received: by 2002:a5d:6a86:: with SMTP id s6mr15070069wru.307.1615046235687; Sat, 06 Mar 2021 07:57:15 -0800 (PST) Received: from skynet.lan (224.red-2-138-103.dynamicip.rima-tde.net. [2.138.103.224]) by smtp.gmail.com with ESMTPSA id p6sm9315188wru.2.2021.03.06.07.57.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Mar 2021 07:57:15 -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 v5 02/15] gpio: regmap: set gpio_chip of_node Date: Sat, 6 Mar 2021 16:56:59 +0100 Message-Id: <20210306155712.4298-3-noltari@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210306155712.4298-1-noltari@gmail.com> References: <20210306155712.4298-1-noltari@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210306_155720_584947_606360A2 X-CRM114-Status: GOOD ( 13.64 ) 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 --- v5: switch to fwnode v4: fix documentation v3: introduce patch needed for properly parsing gpio-range drivers/gpio/gpio-regmap.c | 4 ++++ include/linux/gpio/regmap.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c index 5412cb3b0b2a..626433934d69 100644 --- a/drivers/gpio/gpio-regmap.c +++ b/drivers/gpio/gpio-regmap.c @@ -249,6 +249,10 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config chip = &gpio->gpio_chip; chip->parent = config->parent; + if (config->fwnode) + chip->of_node = to_of_node(config->fwnode); + else + chip->of_node = dev_of_node(config->parent); 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..c12e8d1d171b 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,7 @@ 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 * @label: (Optional) Descriptive name for GPIO controller. * If not given, the name of the device is used. * @ngpio: Number of GPIOs @@ -57,6 +59,7 @@ struct regmap; struct gpio_regmap_config { struct device *parent; struct regmap *regmap; + struct fwnode_handle *fwnode; const char *label; int ngpio;