Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp475818imm; Fri, 21 Sep 2018 03:28:41 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZlxYQLvKo3P6XvTzdGe/zq0gS+kBSS8fpsN0oc+/hSPmPnNbri3Kekm+vmiaIWCVx+PvnX X-Received: by 2002:a17:902:4d46:: with SMTP id o6-v6mr15919030plh.59.1537525721224; Fri, 21 Sep 2018 03:28:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537525721; cv=none; d=google.com; s=arc-20160816; b=H/qBwfKYZ+yt8aRVG+7wuS/xmTMY57RRAUE6uakKPs11vDO7XO2cXHnPYgH1QI4xKw 0R4aWyU+d3EBqhz+aWFDM1/BGVqTQcptWzxOEwxVZIC9B2gM5BN92LfJhlGobVjz9id+ CBZbquwAI99rBspSB1ANnPq6QHQJaqFlpZp7ec5qB5UPMJ5IsMEDMfHt+oO2a1tM0RuG vz8noDDv5p83pQjQNmgkKMaqiRIaRUKXCos89zWLd5Gukytcqr7WswwgOHJv747EojLC dpKJLo+4zgCqIfw2pHzTOMO4UuB4wsoHnP2+h3kk5XSFP74YMpY1D3wpAvc+OYFfS5gV G+Tw== 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=5uGioRpmWHw5HmBGBMYla/FtUi6hl7emhEwjHohddII=; b=Q3vraT43+FlzMTb9obiPWk71/+RjIvVPY/GG6r/56hmD3jnp1eEFiExqjz1lntOc1d 0mXwzQSDrDPU6xj05hufHbW8TA6LkrjpsHqRq8NaSAFIwHO/wfd4vZJM9u7cBMOtoa1z vhbB6LIadx1HpfrothfhCM5rubgbH9F40qLbcJcnoHnbOFcHWY7uCrLG7T4YYFAAoWCG gLSnVkfa0+FJc/yQmaXf+qaxSmQPTQGqHLIafqKk49D3nqza+pxkTkn4UcnqIDdQmp+s fNyCHnaRRyz6+DExh7E3Su1gYVlLV2utxuPC5XJPDBavFTNueHfqIqABqVH1zIhKmYAW R97Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KAGNz1Jo; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p62-v6si15311220pgp.648.2018.09.21.03.28.24; Fri, 21 Sep 2018 03:28:41 -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 header.i=@gmail.com header.s=20161025 header.b=KAGNz1Jo; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390424AbeIUQON (ORCPT + 99 others); Fri, 21 Sep 2018 12:14:13 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:54830 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390390AbeIUQOM (ORCPT ); Fri, 21 Sep 2018 12:14:12 -0400 Received: by mail-wm1-f68.google.com with SMTP id c14-v6so2493696wmb.4; Fri, 21 Sep 2018 03:25:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5uGioRpmWHw5HmBGBMYla/FtUi6hl7emhEwjHohddII=; b=KAGNz1JotYwpwgKedqzNuJSQpZZabk2WAg1RdGTll1ITafzjPx8xL+1RrPkDNc7vNc erhT6L8fB1A+hab7uAtSQDVyV4uMS0hwJ7lQ57CtZBMTw1Txoan1sf0plCFfykWJOqcT 696kgx25ng6ctz/gTrKoQg8iUsI6jWfcxw1dx0+Zq3lnjRJ7pTL4Zo+eD7tqkFemB6Qe cr3XmAsWaWvrI8Fdg2TMYKgYbeyDuia2GwJ98e5A4JvnieD52cLmk4gbyZ5vrFdvTSXc Fa36TdtSbG5Cd81jboptQ90aKTMoEooj77pJRPIWFsBFCSfu55HKMpsYwa/gdi5Al2mh tk8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5uGioRpmWHw5HmBGBMYla/FtUi6hl7emhEwjHohddII=; b=AvNSIESkslfSRTHBzN5Bg6YqAbFcjw1hKS/UKRknHZWaxTo4JB3vygeiRiADTFcKb8 76R2ZQbNjfmsEtPqV6TqHqMjS/z3TZVRhx8SUcZmsJe1tVhoXcaSqzmwr/AQr3Z61ac8 zKzn60o7RWIvduLbhb2Fk85p8c97TGRcUw8G2XY1Fnx+wNXQQJUTbYUrN4WTqqQKjAOb 4WQUwnRwPVMVU2kdSNPfPVEfkiz8kaprktyfBu6qcIoTJe/2bQH/lGFQQfQzLN0JgUg2 zuPjlzKAPx/a3S6W8Moru/vfH0BN98hn0SC3IJ2XDcS1cEu2vPCxzDVAIYJRc5b0Nizz 0pyQ== X-Gm-Message-State: APzg51C447UqGqpC6tKCq2ysLhNbjScn1SFuzY9MWf9MT0+4bd1gP8nV TzKK04zycdA4HGmW2+gIqnE= X-Received: by 2002:a1c:7704:: with SMTP id t4-v6mr6133479wmi.136.1537525557530; Fri, 21 Sep 2018 03:25:57 -0700 (PDT) Received: from localhost (pD9E515A3.dip0.t-ipconnect.de. [217.229.21.163]) by smtp.gmail.com with ESMTPSA id i125-v6sm6341423wmd.23.2018.09.21.03.25.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 21 Sep 2018 03:25:57 -0700 (PDT) From: Thierry Reding To: Linus Walleij , Thierry Reding Cc: Thomas Gleixner , devicetree@vger.kernel.org, linux-tegra@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/9] gpio: Add support for hierarchical IRQ domains Date: Fri, 21 Sep 2018 12:25:43 +0200 Message-Id: <20180921102546.12745-7-thierry.reding@gmail.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180921102546.12745-1-thierry.reding@gmail.com> References: <20180921102546.12745-1-thierry.reding@gmail.com> 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 a53d17745d21..94146093ee95 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1918,7 +1918,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; @@ -1928,9 +1930,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 d8dcd0e44cab..fcd09a396d76 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: * -- 2.19.0