Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit db6b3ad1 authored by Linus Walleij's avatar Linus Walleij
Browse files

gpio: bcm-kona: lock IRQs when starting them



This uses the new API for tagging GPIO lines as in use by
IRQs. This enforces a few semantic checks on how the underlying
GPIO line is used.

Cc: Christian Daudt <csd@broadcom.com>
Cc: Grygorii Strashko <grygorii.strashko@ti.com>
Reviewed-by: default avatarMarkus Mayer <markus.mayer@linaro.org>
Tested-by: default avatarMarkus Mayer <markus.mayer@linaro.org>
Reviewed-by: default avatarJavier Martinez Canillas <javier@dowhile0.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent f41cd3c2
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -449,12 +449,34 @@ static void bcm_kona_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
	chained_irq_exit(chip, desc);
}

static unsigned int bcm_kona_gpio_irq_startup(struct irq_data *d)
{
	struct bcm_kona_gpio *kona_gpio = irq_data_get_irq_chip_data(d);

	if (gpio_lock_as_irq(&kona_gpio->gpio_chip, d->hwirq))
		dev_err(kona_gpio->gpio_chip.dev,
			"unable to lock HW IRQ %lu for IRQ\n",
			d->hwirq);
	bcm_kona_gpio_irq_unmask(d);
	return 0;
}

static void bcm_kona_gpio_irq_shutdown(struct irq_data *d)
{
	struct bcm_kona_gpio *kona_gpio = irq_data_get_irq_chip_data(d);

	bcm_kona_gpio_irq_mask(d);
	gpio_unlock_as_irq(&kona_gpio->gpio_chip, d->hwirq);
}

static struct irq_chip bcm_gpio_irq_chip = {
	.name = "bcm-kona-gpio",
	.irq_ack = bcm_kona_gpio_irq_ack,
	.irq_mask = bcm_kona_gpio_irq_mask,
	.irq_unmask = bcm_kona_gpio_irq_unmask,
	.irq_set_type = bcm_kona_gpio_irq_set_type,
	.irq_startup = bcm_kona_gpio_irq_startup,
	.irq_shutdown = bcm_kona_gpio_irq_shutdown,
};

static struct __initconst of_device_id bcm_kona_gpio_of_match[] = {