Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp215997imu; Wed, 19 Dec 2018 17:03:33 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wfm6VIouD0q7Nr6+VGFx/Mt58KsrL2RfALEM3yfg+0xJsRmBjhx5ZyYZY6ggOAPwA44QqG X-Received: by 2002:a63:65c7:: with SMTP id z190mr21367309pgb.249.1545267813164; Wed, 19 Dec 2018 17:03:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545267813; cv=none; d=google.com; s=arc-20160816; b=d0hy2GZIaGYy5IwDXFXxe8pmk61hBBU8oVbFlNLwgTuWvWeDBP1KeVZ9vjohg5wlTj +PWT4t9kQUgnFRLNr+3odDR7FkN7jD4oNYCQdUCWske0d8oOPL6EsTkh7R8YzshHM3lU iY0UgTSnok25+3jDztzvnvQYXTyd0A1nCD2viMGyV/a/nv7eDOIQBEAdKM3HagCqwCy6 JemLey4R5Jbtz7IzzplnHDh+jVFTpxwWBvYVqndHvJw3OFyZs7+iGKyzCyYWLMgqakkb vSLl67Dyd/FJ96FoV/zjXEBM55GWa4pKRUDQH/uLayrNjOALBIoIy566i6z17AFNDqY3 bySw== 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 :dmarc-filter:dkim-signature:dkim-signature; bh=72FMLzkydGy3iCNlWpVMR0fZDpL+GaSXFOZbQvAzKhs=; b=rfjrjMxtDkHq/TAxfZDBPMSWYmaATnE0LWE6NHHZqJLpANV8W2KkQNWuy5psI1NTIl OtHQRz/KOSztbNIwyRgI3s2o/TT9kW/Cw0zQ7X1p69YpBfd0CqZOVUvlhQhIZ+MZa6GP Dxrq8ce0sOdN9SLmBo8HZXXrRPJv/hTF1uUpnm6d8Yo4Ry0ndarEGH3u4cq4hjwajTW5 uZIJqctlPIqObXvtUfp8/XNdBralAXdQky3z2tF9wUHCoNR2KWHRYNDxWwGIeuWPvHcT fffTWynxup7V6sPFFYrdu5qht0/Ybgtd0NaE6QAiPVX+hahQ8Yq3m6QcFHAIIziX8VU4 Cjug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=VA870PGR; dkim=pass header.i=@codeaurora.org header.s=default header.b=AVM0Aw3d; 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 76si18062409pfw.66.2018.12.19.17.03.16; Wed, 19 Dec 2018 17:03:33 -0800 (PST) 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 header.i=@codeaurora.org header.s=default header.b=VA870PGR; dkim=pass header.i=@codeaurora.org header.s=default header.b=AVM0Aw3d; 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 S1729697AbeLSWLd (ORCPT + 99 others); Wed, 19 Dec 2018 17:11:33 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:44474 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729587AbeLSWLb (ORCPT ); Wed, 19 Dec 2018 17:11:31 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id C8362608C5; Wed, 19 Dec 2018 22:11:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1545257490; bh=vgKObgUP3PBENRIoVDIXRGSK16opUVYnkrhtJlTmOTY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VA870PGRcX8Fz5IANYo5J6ouj/C9w5RXqAtgZ6t3ylpPxVWTMKpFm1S5XPmAHXm8L IjFz5zIG1PDpmf6f9/UvzCW9BceZcJf27qDw11xdtTO0LpDXZDZrI/4nMLRR1uQC5y YILZjPNFdI1ZetYu+a9Kje5w0Usy7QcbPMMSsz2U= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from codeaurora.org (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: ilina@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id C5CC1606FC; Wed, 19 Dec 2018 22:11:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1545257489; bh=vgKObgUP3PBENRIoVDIXRGSK16opUVYnkrhtJlTmOTY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AVM0Aw3dxc1UA4m1uW4Fc6ps/Fd25wa0zyZUVBlh2SSeDZfUyyAmEs5rfwjAXWM+E oQNwD8zrkihqheiMQk0D8VpZuckz7xtM4SWYpzZ3jFQmBFMbSqDDc7rwyxBXLIoAOv fIJWvSfr/P0WAVeRJ4bsYJCiz667WTo9e0GfPxO4= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org C5CC1606FC Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=ilina@codeaurora.org From: Lina Iyer To: sboyd@kernel.org, evgreen@chromium.org, marc.zyngier@arm.com Cc: linux-kernel@vger.kernel.org, rplsssn@codeaurora.org, linux-arm-msm@vger.kernel.org, thierry.reding@gmail.com, bjorn.andersson@linaro.org, Thierry Reding Subject: [PATCH 1/7] gpio: Add support for hierarchical IRQ domains Date: Wed, 19 Dec 2018 15:10:59 -0700 Message-Id: <20181219221105.3004-2-ilina@codeaurora.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20181219221105.3004-1-ilina@codeaurora.org> References: <20181219221105.3004-1-ilina@codeaurora.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 From: Thierry Reding Hierarchical IRQ domains can be used to stack different IRQ controllers on top of each other. One specific use-case where this can be useful is if a power management controller has top-level controls for wakeup interrupts. In such cases, the power management controller can be a parent to other interrupt controllers and program additional registers when an IRQ has its wake capability enabled or disabled. Signed-off-by: Thierry Reding --- drivers/gpio/gpiolib.c | 15 +++++++++++---- include/linux/gpio/driver.h | 6 ++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 230e41562462..eb08de2e7c1d 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1917,7 +1917,9 @@ static int gpiochip_add_irqchip(struct gpio_chip *gpiochip, type = IRQ_TYPE_NONE; } - gpiochip->to_irq = gpiochip_to_irq; + if (!gpiochip->to_irq) + gpiochip->to_irq = gpiochip_to_irq; + gpiochip->irq.default_type = type; gpiochip->irq.lock_key = lock_key; gpiochip->irq.request_key = request_key; @@ -1927,9 +1929,14 @@ static int gpiochip_add_irqchip(struct gpio_chip *gpiochip, else ops = &gpiochip_domain_ops; - gpiochip->irq.domain = irq_domain_add_simple(np, gpiochip->ngpio, - gpiochip->irq.first, - ops, gpiochip); + if (gpiochip->irq.parent_domain) + gpiochip->irq.domain = irq_domain_add_hierarchy(gpiochip->irq.parent_domain, + 0, gpiochip->ngpio, + np, ops, gpiochip); + else + gpiochip->irq.domain = irq_domain_add_simple(np, gpiochip->ngpio, + gpiochip->irq.first, + ops, gpiochip); if (!gpiochip->irq.domain) return -EINVAL; diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h index 2db62b550b95..abcdb0c25a93 100644 --- a/include/linux/gpio/driver.h +++ b/include/linux/gpio/driver.h @@ -47,6 +47,12 @@ struct gpio_irq_chip { */ const struct irq_domain_ops *domain_ops; + /** + * @parent_domain: + * + */ + struct irq_domain *parent_domain; + /** * @handler: * -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project