Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4188152yba; Tue, 7 May 2019 13:43:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqx//lGCjksxX3JKuiRXxveNkOWCscIPYGha+nHI36XBIBjov3ZmWbVfkSwXEhuegmcwVMvG X-Received: by 2002:a62:2b4e:: with SMTP id r75mr43341194pfr.131.1557261792247; Tue, 07 May 2019 13:43:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557261792; cv=none; d=google.com; s=arc-20160816; b=NjuloOjEb6PF9yJYyuISrnwj6ddGKjfqKWmFuG80WvuKWM5PlBJZ+vVRcz7nfnhOHr rN98CgYJ7mUzfV5WUekUJD295yVWHbq9cAJzs62mk9B+H2zkkrbezBDLaP8Q8TAtCgGc 3mNNBVHwN8kQLWCuyg34JBbilTv0dpj2wqe8hipDUgMkqOk9U8lx3IIAFZbr2a3+GyZU jLeZufrM9gk50gj+s6iJUn9LkiG/7tNgQ2DyoaWTu24ERZRQlnAX5+nyWYMIZJ7JnKFU dQaP1fgMJg9fEDkR0hVYiIVlbepM16Y93v6EhfrakHCCVEPeE8Ou9iRqnTVFWNXnjLiT Em7A== 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=3zJGMDRJktd6APX1vGVLug7ce0j8qBNwekZf064ntg0=; b=Sh6vl7NKy6emSCO3GC8N/aMPFBiuMMT6Dr+AGutLdLYwreUa3BSeEp73rH0EwauAIH u0gRl0ErcljSjrmC1wO/ZaCu9pX/Bkr+ZajQJ01g2Nj+oX/Aa5P2Tlmz7uNQPghko5al 7Q2k9YA1r6H3noiuqw7GbvzeG7B+nuAoldzYsVB4Y41SHCVWVaUNBwdaElsipFPxw3fd CJv7A9ho0DYC1PQGi2ustKVmOJiTUuhcfzMPyvhUIjYPUIx7/F9RTAa7CkUTi0R3+cpV fRBh0uD0Ty4Q89bRCdeVeiNvMDeV8V/xfWn8g1wlFG1y3a2ov1ZleEg82mDR8Y/7M0ml +wdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b="j//KzvLv"; dkim=pass header.i=@codeaurora.org header.s=default header.b=UApR2Qcd; 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 j8si19565684pfn.74.2019.05.07.13.42.56; Tue, 07 May 2019 13:43:12 -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=@codeaurora.org header.s=default header.b="j//KzvLv"; dkim=pass header.i=@codeaurora.org header.s=default header.b=UApR2Qcd; 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 S1727145AbfEGUk4 (ORCPT + 99 others); Tue, 7 May 2019 16:40:56 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:52744 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726378AbfEGUkx (ORCPT ); Tue, 7 May 2019 16:40:53 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 0C5E960E42; Tue, 7 May 2019 20:40:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1557261652; bh=Aqgn2CVunlmix1d49JF2zfljL8gEG1nXzkYpE3e8RAo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j//KzvLvmw+0YZTWVLiA0YKCS96hrjEVvAnSVtnf5c1lKwUAMN8JcZtyU6XnJ3dxB dAMmS5tC3ZwzC1hVgMW6AhxCGu2KwOipITl1EEhnmy246VET5DOBn+BzRZxN/8WqVY cv4Mb69iYARdIMn9FQGmeorhJaJMBA4Fz5aLBKHc= 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 2F393608BA; Tue, 7 May 2019 20:40:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1557261651; bh=Aqgn2CVunlmix1d49JF2zfljL8gEG1nXzkYpE3e8RAo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UApR2QcdYThiCmhlESi9lt8sqkGz3wihNvDbf3RoWHrwHCg8BOMpgRH35rXt5pJJE IUe6a/qb3Xk6C89dW6DNnth4Pimp30xxhQfM+x0gcTh4bghymIKZ52HR32kNj5P65J UOGiJgtRkl74TnFUvu95DrD/qeznszjn6njr3pyA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 2F393608BA 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, linus.walleij@linaro.org 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, Thierry Reding , Lina Iyer Subject: [PATCH v5 01/11] gpio: Add support for hierarchical IRQ domains Date: Tue, 7 May 2019 14:37:39 -0600 Message-Id: <20190507203749.3384-2-ilina@codeaurora.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190507203749.3384-1-ilina@codeaurora.org> References: <20190507203749.3384-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 bca3e7740ef6..4a9a6d4afe6e 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1936,7 +1936,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; @@ -1946,9 +1948,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 01497910f023..f481862f1bb0 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