* [PATCH v2 0/2] at91: gpio: pinctrl: use gpiolib API to mark a GPIO used as an IRQ
@ 2014-01-23 10:37 Jean-Jacques Hiblot
2014-01-23 10:37 ` [PATCH v2 1/2] at91: gpio: " Jean-Jacques Hiblot
2014-01-23 10:37 ` [PATCH v2 2/2] at91: pinctrl: " Jean-Jacques Hiblot
0 siblings, 2 replies; 10+ messages in thread
From: Jean-Jacques Hiblot @ 2014-01-23 10:37 UTC (permalink / raw)
To: linux-arm-kernel
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(+)
--
1.8.5.2
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 1/2] at91: gpio: use gpiolib API to mark a GPIO used as an IRQ
2014-01-23 10:37 [PATCH v2 0/2] at91: gpio: pinctrl: use gpiolib API to mark a GPIO used as an IRQ Jean-Jacques Hiblot
@ 2014-01-23 10:37 ` Jean-Jacques Hiblot
2014-01-31 7:55 ` Linus Walleij
2014-01-23 10:37 ` [PATCH v2 2/2] at91: pinctrl: " Jean-Jacques Hiblot
1 sibling, 1 reply; 10+ messages in thread
From: Jean-Jacques Hiblot @ 2014-01-23 10:37 UTC (permalink / raw)
To: linux-arm-kernel
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 <jjhiblot@traphandler.com>
---
arch/arm/mach-at91/gpio.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c
index a5afcf7..a88ed12 100644
--- a/arch/arm/mach-at91/gpio.c
+++ b/arch/arm/mach-at91/gpio.c
@@ -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,
--
1.8.5.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 2/2] at91: pinctrl: use gpiolib API to mark a GPIO used as an IRQ
2014-01-23 10:37 [PATCH v2 0/2] at91: gpio: pinctrl: use gpiolib API to mark a GPIO used as an IRQ Jean-Jacques Hiblot
2014-01-23 10:37 ` [PATCH v2 1/2] at91: gpio: " Jean-Jacques Hiblot
@ 2014-01-23 10:37 ` Jean-Jacques Hiblot
2014-01-31 7:57 ` Linus Walleij
1 sibling, 1 reply; 10+ messages in thread
From: Jean-Jacques Hiblot @ 2014-01-23 10:37 UTC (permalink / raw)
To: linux-arm-kernel
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 <jjhiblot@traphandler.com>
---
drivers/pinctrl/pinctrl-at91.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index e8c8301..e00a4bb 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -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,
--
1.8.5.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 1/2] at91: gpio: use gpiolib API to mark a GPIO used as an IRQ
2014-01-23 10:37 ` [PATCH v2 1/2] at91: gpio: " Jean-Jacques Hiblot
@ 2014-01-31 7:55 ` Linus Walleij
2014-01-31 8:57 ` Nicolas Ferre
0 siblings, 1 reply; 10+ messages in thread
From: Linus Walleij @ 2014-01-31 7:55 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Jan 23, 2014 at 11:37 AM, Jean-Jacques Hiblot
<jjhiblot@traphandler.com> wrote:
> 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 <jjhiblot@traphandler.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 2/2] at91: pinctrl: use gpiolib API to mark a GPIO used as an IRQ
2014-01-23 10:37 ` [PATCH v2 2/2] at91: pinctrl: " Jean-Jacques Hiblot
@ 2014-01-31 7:57 ` Linus Walleij
0 siblings, 0 replies; 10+ messages in thread
From: Linus Walleij @ 2014-01-31 7:57 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Jan 23, 2014 at 11:37 AM, Jean-Jacques Hiblot
<jjhiblot@traphandler.com> wrote:
> 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 <jjhiblot@traphandler.com>
Thanks!
Patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 1/2] at91: gpio: use gpiolib API to mark a GPIO used as an IRQ
2014-01-31 7:55 ` Linus Walleij
@ 2014-01-31 8:57 ` Nicolas Ferre
2014-02-07 8:07 ` Jean-Christophe PLAGNIOL-VILLARD
2014-03-12 14:38 ` Nicolas Ferre
0 siblings, 2 replies; 10+ messages in thread
From: Nicolas Ferre @ 2014-01-31 8:57 UTC (permalink / raw)
To: linux-arm-kernel
On 31/01/2014 08:55, Linus Walleij :
> On Thu, Jan 23, 2014 at 11:37 AM, Jean-Jacques Hiblot
> <jjhiblot@traphandler.com> wrote:
>
>> 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 <jjhiblot@traphandler.com>
>
> Acked-by: Linus Walleij <linus.walleij@linaro.org>
>
> Nicolas, are you queueing this patch?
Yes, I will.
> 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,
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 1/2] at91: gpio: use gpiolib API to mark a GPIO used as an IRQ
2014-01-31 8:57 ` Nicolas Ferre
@ 2014-02-07 8:07 ` Jean-Christophe PLAGNIOL-VILLARD
2014-03-12 14:38 ` Nicolas Ferre
1 sibling, 0 replies; 10+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2014-02-07 8:07 UTC (permalink / raw)
To: linux-arm-kernel
On 09:57 Fri 31 Jan , Nicolas Ferre wrote:
> On 31/01/2014 08:55, Linus Walleij :
> > On Thu, Jan 23, 2014 at 11:37 AM, Jean-Jacques Hiblot
> > <jjhiblot@traphandler.com> wrote:
> >
> >> 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 <jjhiblot@traphandler.com>
> >
> > Acked-by: Linus Walleij <linus.walleij@linaro.org>
> >
> > Nicolas, are you queueing this patch?
>
> Yes, I will.
>
> > 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.
>
> Thanks for your review. Bye,
> --
> Nicolas Ferre
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 1/2] at91: gpio: use gpiolib API to mark a GPIO used as an IRQ
2014-01-31 8:57 ` Nicolas Ferre
2014-02-07 8:07 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2014-03-12 14:38 ` Nicolas Ferre
2014-03-12 17:29 ` Nicolas Ferre
1 sibling, 1 reply; 10+ messages in thread
From: Nicolas Ferre @ 2014-03-12 14:38 UTC (permalink / raw)
To: linux-arm-kernel
On 31/01/2014 09:57, Nicolas Ferre :
> On 31/01/2014 08:55, Linus Walleij :
>> On Thu, Jan 23, 2014 at 11:37 AM, Jean-Jacques Hiblot
>> <jjhiblot@traphandler.com> wrote:
>>
>>> 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 <jjhiblot@traphandler.com>
>>
>> Acked-by: Linus Walleij <linus.walleij@linaro.org>
>>
>> Nicolas, are you queueing this patch?
>
> Yes, I will.
stacked on at91-3.15-cleanup branch.
Best regards,
>> 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,
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 1/2] at91: gpio: use gpiolib API to mark a GPIO used as an IRQ
2014-03-12 14:38 ` Nicolas Ferre
@ 2014-03-12 17:29 ` Nicolas Ferre
2014-03-14 10:17 ` Linus Walleij
0 siblings, 1 reply; 10+ messages in thread
From: Nicolas Ferre @ 2014-03-12 17:29 UTC (permalink / raw)
To: linux-arm-kernel
On 12/03/2014 15:38, Nicolas Ferre :
> On 31/01/2014 09:57, Nicolas Ferre :
>> On 31/01/2014 08:55, Linus Walleij :
>>> On Thu, Jan 23, 2014 at 11:37 AM, Jean-Jacques Hiblot
>>> <jjhiblot@traphandler.com> wrote:
>>>
>>>> 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 <jjhiblot@traphandler.com>
>>>
>>> Acked-by: Linus Walleij <linus.walleij@linaro.org>
>>>
>>> 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,
>>> 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,
>>
>
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 1/2] at91: gpio: use gpiolib API to mark a GPIO used as an IRQ
2014-03-12 17:29 ` Nicolas Ferre
@ 2014-03-14 10:17 ` Linus Walleij
0 siblings, 0 replies; 10+ messages in thread
From: Linus Walleij @ 2014-03-14 10:17 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Mar 12, 2014 at 6:29 PM, Nicolas Ferre <nicolas.ferre@atmel.com> wrote:
> On 12/03/2014 15:38, Nicolas Ferre :
>> On 31/01/2014 09:57, Nicolas Ferre :
>>> On 31/01/2014 08:55, Linus Walleij :
>>>> On Thu, Jan 23, 2014 at 11:37 AM, Jean-Jacques Hiblot
>>>> <jjhiblot@traphandler.com> wrote:
>>>>
>>>>> 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 <jjhiblot@traphandler.com>
>>>>
>>>> Acked-by: Linus Walleij <linus.walleij@linaro.org>
>>>>
>>>> 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.
It's not such a big deal IMO, but sure I'm working to clean this up.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2014-03-14 10:17 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-23 10:37 [PATCH v2 0/2] at91: gpio: pinctrl: use gpiolib API to mark a GPIO used as an IRQ Jean-Jacques Hiblot
2014-01-23 10:37 ` [PATCH v2 1/2] at91: gpio: " Jean-Jacques Hiblot
2014-01-31 7:55 ` Linus Walleij
2014-01-31 8:57 ` Nicolas Ferre
2014-02-07 8:07 ` Jean-Christophe PLAGNIOL-VILLARD
2014-03-12 14:38 ` Nicolas Ferre
2014-03-12 17:29 ` Nicolas Ferre
2014-03-14 10:17 ` Linus Walleij
2014-01-23 10:37 ` [PATCH v2 2/2] at91: pinctrl: " Jean-Jacques Hiblot
2014-01-31 7:57 ` Linus Walleij
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).