Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp1942574imc; Fri, 22 Feb 2019 14:19:46 -0800 (PST) X-Google-Smtp-Source: AHgI3IbvoebyLZ+JFpfQtAlb/hGSsL7OfRrJhf51AoxF3ZSBHu8so5LQsI4tGu4KsGIbZCunZhXN X-Received: by 2002:a63:eb56:: with SMTP id b22mr6090429pgk.287.1550873986060; Fri, 22 Feb 2019 14:19:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550873986; cv=none; d=google.com; s=arc-20160816; b=GpgJC4jmqhsjtGWT2JBACBUqP8nQb86c5W9NUgI+iJjbqpL8Iw50fi4AEUQz8kS9MN +pXUJEFXzyR4UoB/ECL2IiBu+Wk6ltadP6pw2IcTxaZGxGZ5syLdWcY6zqjvV6JIRAh/ mshwe/tybdLdojsF4FVkLzvKUZol0sfZLgJLBW/yF2eoparIOgylDWLsmMkBagyhed+w H3rXsKB4dR60Z6VMseHxpw2hHEAlE76pyIBsq7Zveoob5fTHITW5prnaLge6j3e0yIdl EAvRhtE7X9Sun+le6FpCHxQDs/4IB67uAiLA+movhQoyWo9uwKnaPpoYRFQseoY6gD6C TlvA== 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=1R4jJJcfu0MU6G+XpNQ/nblMVTdk25wPQd8gf0qnsGw=; b=awdMeQsu5TPZ/R/rZyhbTk49Cnk/ByCxCnFqET6ufed514xQfodCv+pyJnPJO7hHOi jg03Azf637KcU5Xxu/Z51OcB4JTLXpBofj0R5jPPIlqFM3YMKJqH2pyB/WyxpO6EJJLO xZbulN1JVrYhLJPXoDzbSNjj+puD4CNlCNF8i1U/2FbzP5qtnQ57CXkkOUdevanLtH5T U47JAxH8VS8VD0Ypb+yHPH0qaIDBJ/WCUgvIpLJa0y/cbBQmcU/NcdrVJP1aFuSJACxF AzLXywGOJdQ4GvcyT10pXl8p8Pq4L5r3iu9rtEk/gI0ONsG+Pscntg62vmhIbPAxKwPY jnIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=bLMAZoW6; dkim=pass header.i=@codeaurora.org header.s=default header.b=bLMAZoW6; 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 b2si2237963pgq.275.2019.02.22.14.19.30; Fri, 22 Feb 2019 14:19:46 -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=bLMAZoW6; dkim=pass header.i=@codeaurora.org header.s=default header.b=bLMAZoW6; 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 S1726620AbfBVWTH (ORCPT + 99 others); Fri, 22 Feb 2019 17:19:07 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:44198 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725878AbfBVWTF (ORCPT ); Fri, 22 Feb 2019 17:19:05 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id DDE6460915; Fri, 22 Feb 2019 22:19:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1550873944; bh=9t2SZ7zrd35gVahSxst8gxZJ86btG0fsUgholHi5jrI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bLMAZoW6R5D6Ac32ebAKqLlC+5XQ6icyhJ1xKaVT8vPOsY0wm4sm0AUKfUPMhGzGi 3A0O0N5PQnI+1CGw+dnedUj7oEkWWar2y5tC8DxZoc00ZIdwU/8lkXUWlgycma2nwH dh6rBgfrLv1tIXteAgr+IVZIwv6VWDCvmCbQQ78g= 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 1BB476034F; Fri, 22 Feb 2019 22:19:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1550873944; bh=9t2SZ7zrd35gVahSxst8gxZJ86btG0fsUgholHi5jrI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bLMAZoW6R5D6Ac32ebAKqLlC+5XQ6icyhJ1xKaVT8vPOsY0wm4sm0AUKfUPMhGzGi 3A0O0N5PQnI+1CGw+dnedUj7oEkWWar2y5tC8DxZoc00ZIdwU/8lkXUWlgycma2nwH dh6rBgfrLv1tIXteAgr+IVZIwv6VWDCvmCbQQ78g= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 1BB476034F 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: swboyd@chromium.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, dianders@chromium.org, linus.walleij@linaro.org, Thierry Reding , Lina Iyer Subject: [PATCH v3 1/9] gpio: Add support for hierarchical IRQ domains Date: Fri, 22 Feb 2019 15:18:42 -0700 Message-Id: <20190222221850.26939-2-ilina@codeaurora.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190222221850.26939-1-ilina@codeaurora.org> References: <20190222221850.26939-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 Signed-off-by: Lina Iyer --- 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 d1adfdf50fb3..46ccb9b174b9 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1895,7 +1895,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; @@ -1905,9 +1907,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 07cddbf45186..88ef196f96ec 100644 --- a/include/linux/gpio/driver.h +++ b/include/linux/gpio/driver.h @@ -48,6 +48,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