* [PATCH] gpio/rockchip: lock GPIOs used as interrupts
@ 2021-12-02 15:50 John Keeping
2021-12-02 16:45 ` Nicolas Frattaroli
2021-12-03 14:59 ` Bartosz Golaszewski
0 siblings, 2 replies; 3+ messages in thread
From: John Keeping @ 2021-12-02 15:50 UTC (permalink / raw)
To: linux-gpio
Cc: John Keeping, Linus Walleij, Bartosz Golaszewski, Heiko Stuebner,
linux-arm-kernel, linux-rockchip, linux-kernel
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 <john@metanate.com>
---
drivers/gpio/gpio-rockchip.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c
index ce63cbd14d69a..c1b8e5dbbcc47 100644
--- a/drivers/gpio/gpio-rockchip.c
+++ b/drivers/gpio/gpio-rockchip.c
@@ -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);
@@ -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);
/*
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio/rockchip: lock GPIOs used as interrupts
2021-12-02 15:50 [PATCH] gpio/rockchip: lock GPIOs used as interrupts John Keeping
@ 2021-12-02 16:45 ` Nicolas Frattaroli
2021-12-03 14:59 ` Bartosz Golaszewski
1 sibling, 0 replies; 3+ messages in thread
From: Nicolas Frattaroli @ 2021-12-02 16:45 UTC (permalink / raw)
To: linux-gpio, linux-rockchip
Cc: John Keeping, Linus Walleij, Bartosz Golaszewski, Heiko Stuebner,
linux-arm-kernel, linux-rockchip, linux-kernel, John Keeping
On Donnerstag, 2. Dezember 2021 16:50:21 CET John Keeping wrote:
> 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 <john@metanate.com>
Tested-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
Applied this on my Quartz64 Model A (RK3566) where I currently am
having a play with some SPI devices. Now gpioinfo correctly shows
the interrupt pin as being in use.
Before:
line 3: unnamed unused input active-high
After:
line 3: unnamed "interrupt" input active-high [used]
Regards,
Nicolas Frattaroli
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio/rockchip: lock GPIOs used as interrupts
2021-12-02 15:50 [PATCH] gpio/rockchip: lock GPIOs used as interrupts John Keeping
2021-12-02 16:45 ` Nicolas Frattaroli
@ 2021-12-03 14:59 ` Bartosz Golaszewski
1 sibling, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2021-12-03 14:59 UTC (permalink / raw)
To: John Keeping
Cc: open list:GPIO SUBSYSTEM, Linus Walleij, Heiko Stuebner,
Linux ARM, open list:ARM/Rockchip SoC...,
Linux Kernel Mailing List
On Thu, Dec 2, 2021 at 4:50 PM John Keeping <john@metanate.com> wrote:
>
> 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 <john@metanate.com>
> ---
> drivers/gpio/gpio-rockchip.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c
> index ce63cbd14d69a..c1b8e5dbbcc47 100644
> --- a/drivers/gpio/gpio-rockchip.c
> +++ b/drivers/gpio/gpio-rockchip.c
> @@ -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);
> @@ -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);
>
> /*
> --
> 2.34.1
>
The title should be: gpio: rockchip: ...
Queued for next, thanks!
Bart
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-12-03 15:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-02 15:50 [PATCH] gpio/rockchip: lock GPIOs used as interrupts John Keeping
2021-12-02 16:45 ` Nicolas Frattaroli
2021-12-03 14:59 ` Bartosz Golaszewski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).