mirror of
https://github.com/torvalds/linux.git
synced 2024-11-15 08:31:55 +00:00
pinctrl: nomadik: Pass irqchip when adding gpiochip
We need to convert all old gpio irqchips to pass the irqchip setup along when adding the gpio_chip. For more info see drivers/gpio/TODO. For chained irqchips this is a pretty straight-forward conversion. Cc: Thierry Reding <thierry.reding@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20191014111154.9731-2-linus.walleij@linaro.org
This commit is contained in:
parent
b95e0bd23e
commit
2da7852e54
@ -248,7 +248,6 @@ struct nmk_gpio_chip {
|
||||
void __iomem *addr;
|
||||
struct clk *clk;
|
||||
unsigned int bank;
|
||||
unsigned int parent_irq;
|
||||
void (*set_ioforce)(bool enable);
|
||||
spinlock_t lock;
|
||||
bool sleepmode;
|
||||
@ -1092,6 +1091,7 @@ static int nmk_gpio_probe(struct platform_device *dev)
|
||||
struct device_node *np = dev->dev.of_node;
|
||||
struct nmk_gpio_chip *nmk_chip;
|
||||
struct gpio_chip *chip;
|
||||
struct gpio_irq_chip *girq;
|
||||
struct irq_chip *irqchip;
|
||||
bool supports_sleepmode;
|
||||
int irq;
|
||||
@ -1117,7 +1117,6 @@ static int nmk_gpio_probe(struct platform_device *dev)
|
||||
* The virt address in nmk_chip->addr is in the nomadik register space,
|
||||
* so we can simply convert the resource address, without remapping
|
||||
*/
|
||||
nmk_chip->parent_irq = irq;
|
||||
nmk_chip->sleepmode = supports_sleepmode;
|
||||
spin_lock_init(&nmk_chip->lock);
|
||||
|
||||
@ -1147,6 +1146,19 @@ static int nmk_gpio_probe(struct platform_device *dev)
|
||||
chip->base,
|
||||
chip->base + chip->ngpio - 1);
|
||||
|
||||
girq = &chip->irq;
|
||||
girq->chip = irqchip;
|
||||
girq->parent_handler = nmk_gpio_irq_handler;
|
||||
girq->num_parents = 1;
|
||||
girq->parents = devm_kcalloc(&dev->dev, 1,
|
||||
sizeof(*girq->parents),
|
||||
GFP_KERNEL);
|
||||
if (!girq->parents)
|
||||
return -ENOMEM;
|
||||
girq->parents[0] = irq;
|
||||
girq->default_type = IRQ_TYPE_NONE;
|
||||
girq->handler = handle_edge_irq;
|
||||
|
||||
clk_enable(nmk_chip->clk);
|
||||
nmk_chip->lowemi = readl_relaxed(nmk_chip->addr + NMK_GPIO_LOWEMI);
|
||||
clk_disable(nmk_chip->clk);
|
||||
@ -1158,28 +1170,7 @@ static int nmk_gpio_probe(struct platform_device *dev)
|
||||
|
||||
platform_set_drvdata(dev, nmk_chip);
|
||||
|
||||
/*
|
||||
* Let the generic code handle this edge IRQ, the the chained
|
||||
* handler will perform the actual work of handling the parent
|
||||
* interrupt.
|
||||
*/
|
||||
ret = gpiochip_irqchip_add(chip,
|
||||
irqchip,
|
||||
0,
|
||||
handle_edge_irq,
|
||||
IRQ_TYPE_NONE);
|
||||
if (ret) {
|
||||
dev_err(&dev->dev, "could not add irqchip\n");
|
||||
gpiochip_remove(&nmk_chip->chip);
|
||||
return -ENODEV;
|
||||
}
|
||||
/* Then register the chain on the parent IRQ */
|
||||
gpiochip_set_chained_irqchip(chip,
|
||||
irqchip,
|
||||
nmk_chip->parent_irq,
|
||||
nmk_gpio_irq_handler);
|
||||
|
||||
dev_info(&dev->dev, "at address %p\n", nmk_chip->addr);
|
||||
dev_info(&dev->dev, "chip registered\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user