Skip to content

Commit

Permalink
gpio: rockchip: lock GPIOs used as interrupts
Browse files Browse the repository at this point in the history
Use the standard gpiochip request/release resource functions so that any
GPIOs used as interrupts are properly locked.  This allows libgpiod to
correctly show these GPIOs as in-use.

Signed-off-by: John Keeping <[email protected]>
Tested-by: Nicolas Frattaroli <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
  • Loading branch information
johnkeeping authored and brgl committed Dec 3, 2021
1 parent a00128d commit adc8b4b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions drivers/gpio/gpio-rockchip.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,22 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type)
return ret;
}

static int rockchip_irq_reqres(struct irq_data *d)
{
struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
struct rockchip_pin_bank *bank = gc->private;

return gpiochip_reqres_irq(&bank->gpio_chip, d->hwirq);
}

static void rockchip_irq_relres(struct irq_data *d)
{
struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
struct rockchip_pin_bank *bank = gc->private;

gpiochip_relres_irq(&bank->gpio_chip, d->hwirq);
}

static void rockchip_irq_suspend(struct irq_data *d)
{
struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
Expand Down Expand Up @@ -536,6 +552,8 @@ static int rockchip_interrupts_register(struct rockchip_pin_bank *bank)
gc->chip_types[0].chip.irq_suspend = rockchip_irq_suspend;
gc->chip_types[0].chip.irq_resume = rockchip_irq_resume;
gc->chip_types[0].chip.irq_set_type = rockchip_irq_set_type;
gc->chip_types[0].chip.irq_request_resources = rockchip_irq_reqres;
gc->chip_types[0].chip.irq_release_resources = rockchip_irq_relres;
gc->wake_enabled = IRQ_MSK(bank->nr_pins);

/*
Expand Down

0 comments on commit adc8b4b

Please sign in to comment.