Commit bb7e64e6 authored by Linus Walleij's avatar Linus Walleij

pinctrl: nsp: Convert to immutable irq_chip

Convert the driver to immutable irq-chip with a bit of
intuition.

Cc: Marc Zyngier <maz@kernel.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230403-immutable-irqchips-v1-2-503788a7f6e6@linaro.org
parent 2cc4485e
......@@ -60,7 +60,6 @@ struct nsp_gpio {
struct device *dev;
void __iomem *base;
void __iomem *io_ctrl;
struct irq_chip irqchip;
struct gpio_chip gc;
struct pinctrl_dev *pctl;
struct pinctrl_desc pctldesc;
......@@ -193,6 +192,7 @@ static void nsp_gpio_irq_mask(struct irq_data *d)
raw_spin_lock_irqsave(&chip->lock, flags);
nsp_gpio_irq_set_mask(d, false);
raw_spin_unlock_irqrestore(&chip->lock, flags);
gpiochip_disable_irq(gc, irqd_to_hwirq(d));
}
static void nsp_gpio_irq_unmask(struct irq_data *d)
......@@ -201,6 +201,7 @@ static void nsp_gpio_irq_unmask(struct irq_data *d)
struct nsp_gpio *chip = gpiochip_get_data(gc);
unsigned long flags;
gpiochip_enable_irq(gc, irqd_to_hwirq(d));
raw_spin_lock_irqsave(&chip->lock, flags);
nsp_gpio_irq_set_mask(d, true);
raw_spin_unlock_irqrestore(&chip->lock, flags);
......@@ -258,6 +259,16 @@ static int nsp_gpio_irq_set_type(struct irq_data *d, unsigned int type)
return 0;
}
static const struct irq_chip nsp_gpio_irq_chip = {
.name = "gpio-a",
.irq_ack = nsp_gpio_irq_ack,
.irq_mask = nsp_gpio_irq_mask,
.irq_unmask = nsp_gpio_irq_unmask,
.irq_set_type = nsp_gpio_irq_set_type,
.flags = IRQCHIP_IMMUTABLE,
GPIOCHIP_IRQ_RESOURCE_HELPERS,
};
static int nsp_gpio_direction_input(struct gpio_chip *gc, unsigned gpio)
{
struct nsp_gpio *chip = gpiochip_get_data(gc);
......@@ -650,14 +661,6 @@ static int nsp_gpio_probe(struct platform_device *pdev)
irq = platform_get_irq(pdev, 0);
if (irq > 0) {
struct gpio_irq_chip *girq;
struct irq_chip *irqc;
irqc = &chip->irqchip;
irqc->name = "gpio-a";
irqc->irq_ack = nsp_gpio_irq_ack;
irqc->irq_mask = nsp_gpio_irq_mask;
irqc->irq_unmask = nsp_gpio_irq_unmask;
irqc->irq_set_type = nsp_gpio_irq_set_type;
val = readl(chip->base + NSP_CHIP_A_INT_MASK);
val = val | NSP_CHIP_A_GPIO_INT_BIT;
......@@ -673,7 +676,7 @@ static int nsp_gpio_probe(struct platform_device *pdev)
}
girq = &chip->gc.irq;
girq->chip = irqc;
gpio_irq_chip_set_chip(girq, &nsp_gpio_irq_chip);
/* This will let us handle the parent IRQ in the driver */
girq->parent_handler = NULL;
girq->num_parents = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment