From patchwork Wed Mar 17 14:37:43 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: 12145897 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 15B7FC433E0 for ; Wed, 17 Mar 2021 14:40:40 +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 7E16564F26 for ; Wed, 17 Mar 2021 14:40:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7E16564F26 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=Rpe7fRN2hkL5571cyJmVTTslrDqAha0DAqt0yKlvUh4=; b=eQVgEo3w3GIle+QrQX5bC6hGp LrXPxErqmBAafUtuNkrFCi9pGZPfIAgm9PN3enaAwCrbOWvXRcmDY4NG+U5V+ubd+dxPwIoac9kuO HrysjMZHSJ4Bo7MZ/Jyhqc6/QxI8r17g+mBMWXKRkbqe2oUvzbMy7kbBSH3JX9qD9sV7F7Wc6u7Ga /v++pBPLvShxJgizV9fZOoMZdMH2CHKL1YY4chtGzf+bZKHpDM4DPKiUBmAqADOu+w0BO0fT33i7Y ZSWD5dAPigubuJe1+a3flaW0k9c2MuwF6kX6sxNMpExXcMT+2IpCEMVJstZftw1epAE1bS8yxXskV QUzDIzM+Q==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lMXJm-003HkS-2a; Wed, 17 Mar 2021 14:38:38 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lMXJI-003HbK-6K for linux-arm-kernel@lists.infradead.org; Wed, 17 Mar 2021 14:38:09 +0000 Received: by mail-wm1-x334.google.com with SMTP id d191so1612457wmd.2 for ; Wed, 17 Mar 2021 07:38:07 -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=C0TvtEEP48Zgzs74E4VbkJs6YSKaxZPIWYY6W83ftUM=; b=OrWVI3sg1uH8iX4kit/E2ktQ0i6Wb+3hNhcTrcP/9T0jOeESaG++L313WgIEapSgjc gQ8XDi6QkoFCu1ywUUkvx4/fj9qQry25K09TvQXmbsliPRkdDbwPjeauVdUuzmFoVhNu n2wPBrx1BdBdeywqIt2a49VBGcuaMQHuT+QayUBfpmPDNkJ6Dtz1PCv5sk263i42R5HK mi1zwYTw+XA++jzpFXI1BfGpcETozJmnF4lS9yaoyuovk0VhBGanclLiJ2mi+a+FmGIm +zN7TiEQ47YqUptoBAHVQEIj6ldOhvrLKG1iZ6if6DwAFv9y3su5ZP5oVPgXs633B0FT FJew== 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=C0TvtEEP48Zgzs74E4VbkJs6YSKaxZPIWYY6W83ftUM=; b=hzLkP3wizkrG68kZ6mz8j2q7GdXH+XAnslx7BUQHTXYRILOMrSPSbAGIY+e/DHC7W2 iN7rpejOKM1V18TEHbJbPoC5fpw4xbDfkEi/QSAq4D/EA1d/krPjKAq5ZTYKoRowfxyJ 1fUDwzLdxmFMyFwCzYSocorHz4RRTbcuBbFi+S9oN3sp2E3/ZHFBrO6vlF3Bovl9lQ2C SnJB2XjjiU7YxlX11MvtDV3ZGHwZ+NCl0q/fwxHzv3m7OBY7Jst90HOPo98xraXTC45+ rFnAj99cqbjtly+IY0lQeHudCE1Pq/EYdkgJFx11ZN0SThe6IKMhBtxB8ozEAu+gSmn+ 2wgg== X-Gm-Message-State: AOAM5309RCA8X6Kvdppu74Abthb0kauMtNzi8bbVJpB8xuJqmk1GLDyg kkXWgAZCLWEsLd4CNdRkTQA= X-Google-Smtp-Source: ABdhPJzbQHAySX1aqpq881n9VhSrbcA+iAz5agaJa1A7+7oS1ePqto52QZGX28Z7OLXvoKF23hYapg== X-Received: by 2002:a7b:c308:: with SMTP id k8mr3945391wmj.54.1615991887560; Wed, 17 Mar 2021 07:38:07 -0700 (PDT) Received: from skynet.lan ([80.31.204.166]) by smtp.gmail.com with ESMTPSA id a75sm2518948wme.10.2021.03.17.07.38.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 07:38:07 -0700 (PDT) From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= To: Linus Walleij , Bartosz Golaszewski , Rob Herring , Lee Jones , Michael Walle , 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 v8 02/22] gpio: regmap: set gpio_chip of_node Date: Wed, 17 Mar 2021 15:37:43 +0100 Message-Id: <20210317143803.26127-3-noltari@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210317143803.26127-1-noltari@gmail.com> References: <20210317143803.26127-1-noltari@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210317_143808_319287_64C117DE X-CRM114-Status: GOOD ( 14.10 ) 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 --- v8: no changes 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;