提交 8302cf58 编写于 作者: T Thierry Reding 提交者: Linus Walleij

gpio: Introduce struct gpio_irq_chip.first

Some GPIO chips cannot support sparse IRQ numbering and therefore need
to manually allocate their interrupt descriptors statically. For these
cases, a driver can pass the first allocated IRQ via the struct
gpio_irq_chip's "first" field and thereby cause the IRQ domain to map
all IRQs during initialization.
Suggested-by: NGrygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: NThierry Reding <treding@nvidia.com>
Acked-by: NGrygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
上级 60ed54ca
...@@ -1778,7 +1778,8 @@ static int gpiochip_add_irqchip(struct gpio_chip *gpiochip) ...@@ -1778,7 +1778,8 @@ static int gpiochip_add_irqchip(struct gpio_chip *gpiochip)
ops = &gpiochip_domain_ops; ops = &gpiochip_domain_ops;
gpiochip->irq.domain = irq_domain_add_simple(np, gpiochip->ngpio, gpiochip->irq.domain = irq_domain_add_simple(np, gpiochip->ngpio,
0, ops, gpiochip); gpiochip->irq.first,
ops, gpiochip);
if (!gpiochip->irq.domain) if (!gpiochip->irq.domain)
return -EINVAL; return -EINVAL;
......
...@@ -128,6 +128,14 @@ struct gpio_irq_chip { ...@@ -128,6 +128,14 @@ struct gpio_irq_chip {
* in IRQ domain of the chip. * in IRQ domain of the chip.
*/ */
unsigned long *valid_mask; unsigned long *valid_mask;
/**
* @first:
*
* Required for static IRQ allocation. If set, irq_domain_add_simple()
* will allocate and map all IRQs during initialization.
*/
unsigned int first;
}; };
static inline struct gpio_irq_chip *to_gpio_irq_chip(struct irq_chip *chip) static inline struct gpio_irq_chip *to_gpio_irq_chip(struct irq_chip *chip)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册