Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6762923ybi; Mon, 8 Jul 2019 08:15:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqz5yIRR+Z7jZcK0v8p7uoEMGayWN+TtMZFO3+vpcN0gtNbe+qsRs7qKBsUIJFqH97k/Abyr X-Received: by 2002:a17:90a:9301:: with SMTP id p1mr19138220pjo.22.1562598934584; Mon, 08 Jul 2019 08:15:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562598934; cv=none; d=google.com; s=arc-20160816; b=bIdSzm2u3zP+6Dx0LqDD9gStWHA8yBNHhIJ0k9Y76r4GL0VWs9z52TWcdI1Bj8SDSl FKNQBjZw9+q5BRudyGeRZQcLxLNsKBI11XadUH54z54ESV1dOlUXmZHIQniKFAdlTgk3 v9H6e65SEIYBqJHsPzqYHWBkU4gZN6ENPVCqClgHNoUKL8+qWUu0uDib65VryWxZ8ymA cZdAE4mFjcLdo5LUPSJnXhPZZp5Iw9A+5kc8sPW39o3YMN0xmBFgrlvtMnBNHQQN8HGB +lTqAa/7Gyf1nN5K8oqCCs7n1f9tLcFgBD4LeS7ZZzFDhjqaHm4YUHjtY2HR132Jr/nz VEBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7+fIfkO/pSM/iR6PAX4/p9Jae9D/F5pbLkF9OFrsiVM=; b=urowmJTOKoQjJnePuHlObOGOT4M8nPHc9qGvdWPrnvOtg7pZ2iB+Ntzr6JviITvWg9 aN1eBXrYWwMuwhA9IaD7fTe6clfJMuONkJ5Rlof0WfuHTiHLNnz65E1D1a8TZa4NPy05 h6Fjoe60/KnX7aQvac7Bw2VGmZVdM903z3lvS/LT1JsdiMVSQhPJ3k6rBKDNo8+0yHbe ni9wQV/AnZIGczQwKK0Mv12mR3s0JjBupJfUwgxaWkcjwljo5ZnQ6SLwwd+fQoSeyj41 A/3ZZ0BE9n29qAfckb6Q1Z/LZg+msB5Mbu4ice3rTKgb4qSYAwefEeC4cEpPSwWsOWjr My9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@onstation.org header.s=default header.b=biKGCEB3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si19247922plz.57.2019.07.08.08.15.18; Mon, 08 Jul 2019 08:15:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@onstation.org header.s=default header.b=biKGCEB3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730276AbfGHLB7 (ORCPT + 99 others); Mon, 8 Jul 2019 07:01:59 -0400 Received: from onstation.org ([52.200.56.107]:56130 "EHLO onstation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728391AbfGHLB5 (ORCPT ); Mon, 8 Jul 2019 07:01:57 -0400 Received: from localhost.localdomain (c-98-239-145-235.hsd1.wv.comcast.net [98.239.145.235]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: masneyb) by onstation.org (Postfix) with ESMTPSA id 26C3E3EE9C; Mon, 8 Jul 2019 11:01:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=onstation.org; s=default; t=1562583716; bh=ABCfObbpbwuoupDoFMigDxKhE1zAF3XOt0cZUmn746o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=biKGCEB3hPCdsoZvEmt4KP6nEyNW/8vTY1LYgY8xgImoGEstmu4nzwpIQDBx88Fp4 9hDkAUPsvyucUC6m6BqyGCwhzt7DxeGU51JksjBHnLT1L0RE7NyG3ZOeb+oSolH7uJ Pi84jEIP+NBfh+BZ1eeVS4jT3HqydqyCUv/l25Vc= From: Brian Masney To: linus.walleij@linaro.org Cc: linux-gpio@vger.kernel.org, bgolaszewski@baylibre.com, tglx@linutronix.de, marc.zyngier@arm.com, ilina@codeaurora.org, jonathanh@nvidia.com, skomatineni@nvidia.com, bbiswas@nvidia.com, linux-tegra@vger.kernel.org, david.daney@cavium.com, yamada.masahiro@socionext.com, treding@nvidia.com, bjorn.andersson@linaro.org, agross@kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] gpio: introduce gpiochip_populate_parent_fwspec_{two,four}cell functions Date: Mon, 8 Jul 2019 07:01:35 -0400 Message-Id: <20190708110138.24657-2-masneyb@onstation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190708110138.24657-1-masneyb@onstation.org> References: <20190708110138.24657-1-masneyb@onstation.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce the functions gpiochip_populate_parent_fwspec_{two,four}cell that will be used for hierarchical IRQ support in GPIO drivers. Signed-off-by: Brian Masney --- drivers/gpio/gpiolib.c | 24 ++++++++++++++++++++++++ include/linux/gpio/driver.h | 30 ++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index d767e111694d..06c9cf714c99 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1946,6 +1946,30 @@ static bool gpiochip_hierarchy_is_hierarchical(struct gpio_chip *gc) return !!gc->irq.parent_domain; } +void gpiochip_populate_parent_fwspec_twocell(struct gpio_chip *chip, + struct irq_fwspec *fwspec, + unsigned int parent_hwirq, + unsigned int parent_type) +{ + fwspec->param_count = 2; + fwspec->param[0] = parent_hwirq; + fwspec->param[1] = parent_type; +} +EXPORT_SYMBOL_GPL(gpiochip_populate_parent_fwspec_twocell); + +void gpiochip_populate_parent_fwspec_fourcell(struct gpio_chip *chip, + struct irq_fwspec *fwspec, + unsigned int parent_hwirq, + unsigned int parent_type) +{ + fwspec->param_count = 4; + fwspec->param[0] = 0; + fwspec->param[1] = parent_hwirq; + fwspec->param[2] = 0; + fwspec->param[3] = parent_type; +} +EXPORT_SYMBOL_GPL(gpiochip_populate_parent_fwspec_fourcell); + #else static int gpiochip_hierarchy_add_domain(struct gpio_chip *gc) diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h index 682ad09e29f4..6b6bca20c8f9 100644 --- a/include/linux/gpio/driver.h +++ b/include/linux/gpio/driver.h @@ -493,6 +493,36 @@ struct bgpio_pdata { int ngpio; }; +#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY + +void gpiochip_populate_parent_fwspec_twocell(struct gpio_chip *chip, + struct irq_fwspec *fwspec, + unsigned int parent_hwirq, + unsigned int parent_type); +void gpiochip_populate_parent_fwspec_fourcell(struct gpio_chip *chip, + struct irq_fwspec *fwspec, + unsigned int parent_hwirq, + unsigned int parent_type); + +#else + +static void gpiochip_populate_parent_fwspec_twocell(struct gpio_chip *chip, + struct irq_fwspec *fwspec, + unsigned int parent_hwirq, + unsigned int parent_type) +{ +} + +static void gpiochip_populate_parent_fwspec_fourcell(struct gpio_chip *chip, + struct irq_fwspec *fwspec, + unsigned int parent_hwirq, + unsigned int parent_type) +{ +} + +#endif /* CONFIG_IRQ_DOMAIN_HIERARCHY */ + + #if IS_ENABLED(CONFIG_GPIO_GENERIC) int bgpio_init(struct gpio_chip *gc, struct device *dev, -- 2.20.1