ANDROID: GKI: gpio: Add support for hierarchical IRQ domains

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.

Bug: 150638297
Change-Id: I3f63cb13c0cd1b602d3205c40648d5e7d3c62d4d
Patch-mainline: https://lore.kernel.org/patchwork/patch/989528/
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Lina Iyer <ilina@codeaurora.org>
Signed-off-by: Will McVicker <willmcvicker@google.com>
(cherry picked commit from 789fe8a323e13bf5b15cf667bb7876554506c739)
This commit is contained in:
Thierry Reding
2018-09-21 12:25:43 +02:00
committed by Will McVicker
parent c4b311a7d0
commit 4fd4604c8b
2 changed files with 17 additions and 4 deletions

View File

@@ -1909,7 +1909,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;
@@ -1919,9 +1921,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;

View File

@@ -47,6 +47,12 @@ struct gpio_irq_chip {
*/
const struct irq_domain_ops *domain_ops;
/**
* @parent_domain:
*
*/
struct irq_domain *parent_domain;
/**
* @handler:
*