at91: gpio: pinctrl: use gpiolib API to mark a GPIO used as an IRQ
Subsystems (5)
v2 cover at91: gpio: pinctrl: use gpiolib API to mark a GPIO used as an IRQ
change since V1:
* fixed unmasking/masking issue (unmask the irq in startup, mask it in shutdown)
Jean-Jacques Hiblot (2):
at91: gpio: use gpiolib API to mark a GPIO used as an IRQ
at91: pinctrl: use gpiolib API to mark a GPIO used as an IRQ
arch/arm/mach-at91/gpio.c | 27 +++++++++++++++++++++++++++ drivers/pinctrl/pinctrl-at91.c | 27 +++++++++++++++++++++++++++ 2 files changed, 54 insertions(+)
Signature · 1 line
1.8.5.2
PATCH v2 1/2 at91: gpio: use gpiolib API to mark a GPIO used as an IRQ
When an IRQ is started on a GPIO line, mark this GPIO as IRQ in the gpiolib so we can keep track of the usage centrally.
--- arch/arm/mach-at91/gpio.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
arch/arm/mach-at91/gpio.c +27 -0
@@ -577,8 +577,35 @@ static int alt_gpio_irq_type(struct irq_data *d, unsigned type)return 0 ; } +static unsigned int gpio_irq_startup (struct irq_data *d) +{ +struct at91_gpio_chip *at91_gpio =irq_data_get_irq_chip_data (d); +unsigned pin = d->hwirq; +int ret; + + ret =gpio_lock_as_irq (&at91_gpio->chip, pin); +if (ret) { +dev_err (at91_gpio->chip.dev,"unable to lock pind %lu IRQ\n" , + d->hwirq); +return ret; + } +gpio_irq_unmask (d); +return 0 ; +} + +static void gpio_irq_shutdown (struct irq_data *d) +{ +struct at91_gpio_chip *at91_gpio =irq_data_get_irq_chip_data (d); +unsigned pin = d->hwirq; + +gpio_irq_mask (d); +gpio_unlock_as_irq (&at91_gpio->chip, pin); +} +static struct irq_chip gpio_irqchip = { .name ="GPIO" , + .irq_shutdown = gpio_irq_shutdown, + .irq_startup = gpio_irq_startup, .irq_disable = gpio_irq_mask, .irq_mask = gpio_irq_mask, .irq_unmask = gpio_irq_unmask,
Signature · 1 line
1.8.5.2
PATCH v2 1/2 at91: gpio: use gpiolib API to mark a GPIO used as an IRQ
Quoted 4 lines · Jean-Jacques Hiblot
When an IRQ is started on a GPIO line, mark this GPIO as IRQ in the gpiolib so we can keep track of the usage centrally.
Signed-off-by Jean-Jacques Hiblot <[email protected]>
Nicolas, are you queueing this patch?
I guess this custom GPIO implementation is going away with the transition to pinctrl else I'd requested that it be moved to drivers/gpio...
Yours,
Linus Walleij
PATCH v2 1/2 at91: gpio: use gpiolib API to mark a GPIO used as an IRQ
On 31/01/2014 08:55, Linus Walleij :
Quoted 11 lines
Quoted 4 lines · Jean-Jacques Hiblot
When an IRQ is started on a GPIO line, mark this GPIO as IRQ in the gpiolib so we can keep track of the usage centrally.
Signed-off-by Jean-Jacques Hiblot <[email protected]>Acked-by Linus Walleij <[email protected]>Nicolas, are you queueing this patch?
Yes, I will.
Quoted 3 lines
I guess this custom GPIO implementation is going away with the transition to pinctrl else I'd requested that it be moved to
drivers/gpio...
Absolutely. But I suspect it will still be around for some time...
Thanks for your review. Bye,
Signature · 1 line
Nicolas Ferre
PATCH v2 1/2 at91: gpio: use gpiolib API to mark a GPIO used as an IRQ
Quoted 13 lines · Nicolas Ferre
On 31/01/2014 08:55, Linus Walleij :
Quoted 11 lines
Quoted 4 lines · Jean-Jacques Hiblot
When an IRQ is started on a GPIO line, mark this GPIO as IRQ in the gpiolib so we can keep track of the usage centrally.
Signed-off-by Jean-Jacques Hiblot <[email protected]>Acked-by Linus Walleij <[email protected]>Nicolas, are you queueing this patch?
Quoted 7 lines
Yes, I will.
Quoted 3 lines
I guess this custom GPIO implementation is going away with the transition to pinctrl else I'd requested that it be moved to
drivers/gpio...Absolutely. But I suspect it will still be around for some time...
moved no
I'm not even sure we need to update it at all to simply for the switch to DT
nearly all the support for old SoC is here so I see no reason to do not switch I even a big patch serie to switch old board to DT
So for me no do not touch the old stuff
Best Regards,
J.
Quoted 4 lines
Thanks for your review. Bye,
Signature · 1 line
Nicolas Ferre
PATCH v2 1/2 at91: gpio: use gpiolib API to mark a GPIO used as an IRQ
In reply to Nicolas FerreOn 31/01/2014 09:57, Nicolas Ferre :
Quoted 7 lines
On 31/01/2014 08:55, Linus Walleij :
Quoted 6 lines
Quoted 3 lines · Jean-Jacques Hiblot
When an IRQ is started on a GPIO line, mark this GPIO as IRQ in the gpiolib so we can keep track of the usage centrally.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Jean-Jacques Hiblot <[email protected]>Acked-by Linus Walleij <[email protected]>Nicolas, are you queueing this patch?
Yes, I will.
stacked on at91-3.15-cleanup branch.
Best regards,
Quoted 8 lines
Quoted 3 lines
I guess this custom GPIO implementation is going away with the transition to pinctrl else I'd requested that it be moved to
drivers/gpio...Absolutely. But I suspect it will still be around for some time...
Thanks for your review. Bye,
Signature · 1 line
Nicolas Ferre
PATCH v2 1/2 at91: gpio: use gpiolib API to mark a GPIO used as an IRQ
On 12/03/2014 15:38, Nicolas Ferre :
Quoted 10 lines
On 31/01/2014 09:57, Nicolas Ferre :
Quoted 9 lines
On 31/01/2014 08:55, Linus Walleij :
Quoted 8 lines
Quoted 4 lines · Jean-Jacques Hiblot
When an IRQ is started on a GPIO line, mark this GPIO as IRQ in the gpiolib so we can keep track of the usage centrally.
Signed-off-by Jean-Jacques Hiblot <[email protected]>
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Acked-by Linus Walleij <[email protected]>Nicolas, are you queueing this patch?
Yes, I will.
stacked on at91-3.15-cleanup branch.
... And immediately removed thanks to Boris' advice: it seems that you will move to a gpio_irq_request/release_resources() model.
So, we might wait for the solution to settle in 3.15-rc before building on top of it.
Thanks, bye,
Quoted 10 lines
Quoted 8 lines
Quoted 3 lines
I guess this custom GPIO implementation is going away with the transition to pinctrl else I'd requested that it be moved to
drivers/gpio...Absolutely. But I suspect it will still be around for some time...
Thanks for your review. Bye,
Signature · 1 line
Nicolas Ferre
PATCH v2 1/2 at91: gpio: use gpiolib API to mark a GPIO used as an IRQ
Quoted 17 lines · Nicolas Ferre
On 12/03/2014 15:38, Nicolas Ferre :
Quoted 16 lines
On 31/01/2014 09:57, Nicolas Ferre :
Quoted 14 lines
On 31/01/2014 08:55, Linus Walleij :
Quoted 11 lines
Quoted 4 lines · Jean-Jacques Hiblot
When an IRQ is started on a GPIO line, mark this GPIO as IRQ in the gpiolib so we can keep track of the usage centrally.
Signed-off-by Jean-Jacques Hiblot <[email protected]>Acked-by Linus Walleij <[email protected]>Nicolas, are you queueing this patch?
Yes, I will.
Quoted 7 lines
Quoted 1 line
stacked on at91-3.15-cleanup branch.
... And immediately removed thanks to Boris' advice: it seems that you will move to a gpio_irq_request/release_resources() model.
So, we might wait for the solution to settle in 3.15-rc before building on top of it.
It's not such a big deal IMO, but sure I'm working to clean this up.
Yours,
Linus Walleij
PATCH v2 2/2 at91: pinctrl: use gpiolib API to mark a GPIO used as an IRQ
In reply to Jean-Jacques HiblotWhen an IRQ is started on a GPIO line, mark this GPIO as IRQ in the gpiolib so we can keep track of the usage centrally.
--- drivers/pinctrl/pinctrl-at91.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
drivers/pinctrl/pinctrl-at91.c +27 -0
@@ -1299,6 +1299,31 @@ static int alt_gpio_irq_type(struct irq_data *d, unsigned type)return 0 ; } +static unsigned int gpio_irq_startup (struct irq_data *d) +{ +struct at91_gpio_chip *at91_gpio =irq_data_get_irq_chip_data (d); +unsigned pin = d->hwirq; +int ret; + + ret =gpio_lock_as_irq (&at91_gpio->chip, pin); +if (ret) { +dev_err (at91_gpio->chip.dev,"unable to lock pind %lu IRQ\n" , + d->hwirq); +return ret; + } +gpio_irq_unmask (d); +return 0 ; +} + +static void gpio_irq_shutdown (struct irq_data *d) +{ +struct at91_gpio_chip *at91_gpio =irq_data_get_irq_chip_data (d); +unsigned pin = d->hwirq; + +gpio_irq_mask (d); +gpio_unlock_as_irq (&at91_gpio->chip, pin); +} +#ifdef CONFIG_PM static u32 wakeups[MAX_GPIO_BANKS ];
@@ -1377,6 +1402,8 @@ void at91_pinctrl_gpio_resume(void)static struct irq_chip gpio_irqchip = { .name ="GPIO" , + .irq_startup = gpio_irq_startup, + .irq_shutdown = gpio_irq_shutdown, .irq_disable = gpio_irq_mask, .irq_mask = gpio_irq_mask, .irq_unmask = gpio_irq_unmask,
Signature · 1 line
1.8.5.2
PATCH v2 2/2 at91: pinctrl: use gpiolib API to mark a GPIO used as an IRQ
Quoted 4 lines · Jean-Jacques Hiblot
When an IRQ is started on a GPIO line, mark this GPIO as IRQ in the gpiolib so we can keep track of the usage centrally.
Signed-off-by Jean-Jacques Hiblot <[email protected]>
Thanks!
Patch applied.
Yours,
Linus Walleij