All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] irqchip/stm32: Retrigger both in eoi and unmask callbacks
@ 2020-03-23 23:51 ` Marek Vasut
  0 siblings, 0 replies; 5+ messages in thread
From: Marek Vasut @ 2020-03-23 23:51 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Marek Vasut, Alexandre Torgue, Jason Cooper, Linus Walleij,
	Marc Zyngier, Thomas Gleixner, linux-gpio

Sampling the IRQ line state in EOI and retriggering the interrupt to
work around missing level-triggered interrupt support only works for
non-threaded interrupts. Threaded interrupts must be retriggered the
same way in unmask callback.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Marc Zyngier <maz@kernel.org>,
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-gpio@vger.kernel.org
To: linux-arm-kernel@lists.infradead.org
---
 drivers/pinctrl/stm32/pinctrl-stm32.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
index 9ac9ecfc2f34..2dd4a4dd944c 100644
--- a/drivers/pinctrl/stm32/pinctrl-stm32.c
+++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
@@ -304,18 +304,22 @@ static const struct gpio_chip stm32_gpio_template = {
 	.get_direction		= stm32_gpio_get_direction,
 };
 
-void stm32_gpio_irq_eoi(struct irq_data *d)
+static void stm32_gpio_irq_trigger(struct irq_data *d)
 {
 	struct stm32_gpio_bank *bank = d->domain->host_data;
 	int level;
 
-	irq_chip_eoi_parent(d);
-
 	/* If level interrupt type then retrig */
 	level = stm32_gpio_get(&bank->gpio_chip, d->hwirq);
 	if ((level == 0 && bank->irq_type[d->hwirq] == IRQ_TYPE_LEVEL_LOW) ||
 	    (level == 1 && bank->irq_type[d->hwirq] == IRQ_TYPE_LEVEL_HIGH))
 		irq_chip_retrigger_hierarchy(d);
+}
+
+void stm32_gpio_irq_eoi(struct irq_data *d)
+{
+	irq_chip_eoi_parent(d);
+	stm32_gpio_irq_trigger(d);
 };
 
 static int stm32_gpio_set_type(struct irq_data *d, unsigned int type)
@@ -371,12 +375,18 @@ static void stm32_gpio_irq_release_resources(struct irq_data *irq_data)
 	gpiochip_unlock_as_irq(&bank->gpio_chip, irq_data->hwirq);
 }
 
+static void stm32_gpio_irq_unmask(struct irq_data *d)
+{
+	irq_chip_unmask_parent(d);
+	stm32_gpio_irq_trigger(d);
+}
+
 static struct irq_chip stm32_gpio_irq_chip = {
 	.name		= "stm32gpio",
 	.irq_eoi	= stm32_gpio_irq_eoi,
 	.irq_ack	= irq_chip_ack_parent,
 	.irq_mask	= irq_chip_mask_parent,
-	.irq_unmask	= irq_chip_unmask_parent,
+	.irq_unmask	= stm32_gpio_irq_unmask,
 	.irq_set_type	= stm32_gpio_set_type,
 	.irq_set_wake	= irq_chip_set_wake_parent,
 	.irq_request_resources = stm32_gpio_irq_request_resources,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] irqchip/stm32: Retrigger both in eoi and unmask callbacks
@ 2020-03-23 23:51 ` Marek Vasut
  0 siblings, 0 replies; 5+ messages in thread
From: Marek Vasut @ 2020-03-23 23:51 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Marek Vasut, Alexandre Torgue, Marc Zyngier, Linus Walleij,
	linux-gpio, Thomas Gleixner, Jason Cooper

Sampling the IRQ line state in EOI and retriggering the interrupt to
work around missing level-triggered interrupt support only works for
non-threaded interrupts. Threaded interrupts must be retriggered the
same way in unmask callback.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Marc Zyngier <maz@kernel.org>,
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-gpio@vger.kernel.org
To: linux-arm-kernel@lists.infradead.org
---
 drivers/pinctrl/stm32/pinctrl-stm32.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
index 9ac9ecfc2f34..2dd4a4dd944c 100644
--- a/drivers/pinctrl/stm32/pinctrl-stm32.c
+++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
@@ -304,18 +304,22 @@ static const struct gpio_chip stm32_gpio_template = {
 	.get_direction		= stm32_gpio_get_direction,
 };
 
-void stm32_gpio_irq_eoi(struct irq_data *d)
+static void stm32_gpio_irq_trigger(struct irq_data *d)
 {
 	struct stm32_gpio_bank *bank = d->domain->host_data;
 	int level;
 
-	irq_chip_eoi_parent(d);
-
 	/* If level interrupt type then retrig */
 	level = stm32_gpio_get(&bank->gpio_chip, d->hwirq);
 	if ((level == 0 && bank->irq_type[d->hwirq] == IRQ_TYPE_LEVEL_LOW) ||
 	    (level == 1 && bank->irq_type[d->hwirq] == IRQ_TYPE_LEVEL_HIGH))
 		irq_chip_retrigger_hierarchy(d);
+}
+
+void stm32_gpio_irq_eoi(struct irq_data *d)
+{
+	irq_chip_eoi_parent(d);
+	stm32_gpio_irq_trigger(d);
 };
 
 static int stm32_gpio_set_type(struct irq_data *d, unsigned int type)
@@ -371,12 +375,18 @@ static void stm32_gpio_irq_release_resources(struct irq_data *irq_data)
 	gpiochip_unlock_as_irq(&bank->gpio_chip, irq_data->hwirq);
 }
 
+static void stm32_gpio_irq_unmask(struct irq_data *d)
+{
+	irq_chip_unmask_parent(d);
+	stm32_gpio_irq_trigger(d);
+}
+
 static struct irq_chip stm32_gpio_irq_chip = {
 	.name		= "stm32gpio",
 	.irq_eoi	= stm32_gpio_irq_eoi,
 	.irq_ack	= irq_chip_ack_parent,
 	.irq_mask	= irq_chip_mask_parent,
-	.irq_unmask	= irq_chip_unmask_parent,
+	.irq_unmask	= stm32_gpio_irq_unmask,
 	.irq_set_type	= stm32_gpio_set_type,
 	.irq_set_wake	= irq_chip_set_wake_parent,
 	.irq_request_resources = stm32_gpio_irq_request_resources,
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] irqchip/stm32: Retrigger both in eoi and unmask callbacks
  2020-03-23 23:51 ` Marek Vasut
@ 2020-03-24 11:10   ` Marc Zyngier
  -1 siblings, 0 replies; 5+ messages in thread
From: Marc Zyngier @ 2020-03-24 11:10 UTC (permalink / raw)
  To: Marek Vasut
  Cc: linux-arm-kernel, Alexandre Torgue, Jason Cooper, Linus Walleij,
	Thomas Gleixner, linux-gpio

On Tue, 24 Mar 2020 00:51:32 +0100
Marek Vasut <marex@denx.de> wrote:

> Sampling the IRQ line state in EOI and retriggering the interrupt to
> work around missing level-triggered interrupt support only works for
> non-threaded interrupts. Threaded interrupts must be retriggered the
> same way in unmask callback.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Alexandre Torgue <alexandre.torgue@st.com>
> Cc: Jason Cooper <jason@lakedaemon.net>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Marc Zyngier <maz@kernel.org>,
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: linux-gpio@vger.kernel.org
> To: linux-arm-kernel@lists.infradead.org
> ---
>  drivers/pinctrl/stm32/pinctrl-stm32.c | 18 ++++++++++++++----
>  1 file changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
> index 9ac9ecfc2f34..2dd4a4dd944c 100644
> --- a/drivers/pinctrl/stm32/pinctrl-stm32.c
> +++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
> @@ -304,18 +304,22 @@ static const struct gpio_chip stm32_gpio_template = {
>  	.get_direction		= stm32_gpio_get_direction,
>  };
>  
> -void stm32_gpio_irq_eoi(struct irq_data *d)
> +static void stm32_gpio_irq_trigger(struct irq_data *d)
>  {
>  	struct stm32_gpio_bank *bank = d->domain->host_data;
>  	int level;
>  
> -	irq_chip_eoi_parent(d);
> -
>  	/* If level interrupt type then retrig */
>  	level = stm32_gpio_get(&bank->gpio_chip, d->hwirq);
>  	if ((level == 0 && bank->irq_type[d->hwirq] == IRQ_TYPE_LEVEL_LOW) ||
>  	    (level == 1 && bank->irq_type[d->hwirq] == IRQ_TYPE_LEVEL_HIGH))
>  		irq_chip_retrigger_hierarchy(d);
> +}
> +
> +void stm32_gpio_irq_eoi(struct irq_data *d)

This should obviously be static. I'll amend it locally.

> +{
> +	irq_chip_eoi_parent(d);
> +	stm32_gpio_irq_trigger(d);
>  };
>  
>  static int stm32_gpio_set_type(struct irq_data *d, unsigned int type)
> @@ -371,12 +375,18 @@ static void stm32_gpio_irq_release_resources(struct irq_data *irq_data)
>  	gpiochip_unlock_as_irq(&bank->gpio_chip, irq_data->hwirq);
>  }
>  
> +static void stm32_gpio_irq_unmask(struct irq_data *d)
> +{
> +	irq_chip_unmask_parent(d);
> +	stm32_gpio_irq_trigger(d);
> +}
> +
>  static struct irq_chip stm32_gpio_irq_chip = {
>  	.name		= "stm32gpio",
>  	.irq_eoi	= stm32_gpio_irq_eoi,
>  	.irq_ack	= irq_chip_ack_parent,
>  	.irq_mask	= irq_chip_mask_parent,
> -	.irq_unmask	= irq_chip_unmask_parent,
> +	.irq_unmask	= stm32_gpio_irq_unmask,
>  	.irq_set_type	= stm32_gpio_set_type,
>  	.irq_set_wake	= irq_chip_set_wake_parent,
>  	.irq_request_resources = stm32_gpio_irq_request_resources,

I'll queue this for 5.7.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] irqchip/stm32: Retrigger both in eoi and unmask callbacks
@ 2020-03-24 11:10   ` Marc Zyngier
  0 siblings, 0 replies; 5+ messages in thread
From: Marc Zyngier @ 2020-03-24 11:10 UTC (permalink / raw)
  To: Marek Vasut
  Cc: Alexandre Torgue, Linus Walleij, linux-gpio, Thomas Gleixner,
	linux-arm-kernel, Jason Cooper

On Tue, 24 Mar 2020 00:51:32 +0100
Marek Vasut <marex@denx.de> wrote:

> Sampling the IRQ line state in EOI and retriggering the interrupt to
> work around missing level-triggered interrupt support only works for
> non-threaded interrupts. Threaded interrupts must be retriggered the
> same way in unmask callback.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Alexandre Torgue <alexandre.torgue@st.com>
> Cc: Jason Cooper <jason@lakedaemon.net>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Marc Zyngier <maz@kernel.org>,
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: linux-gpio@vger.kernel.org
> To: linux-arm-kernel@lists.infradead.org
> ---
>  drivers/pinctrl/stm32/pinctrl-stm32.c | 18 ++++++++++++++----
>  1 file changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
> index 9ac9ecfc2f34..2dd4a4dd944c 100644
> --- a/drivers/pinctrl/stm32/pinctrl-stm32.c
> +++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
> @@ -304,18 +304,22 @@ static const struct gpio_chip stm32_gpio_template = {
>  	.get_direction		= stm32_gpio_get_direction,
>  };
>  
> -void stm32_gpio_irq_eoi(struct irq_data *d)
> +static void stm32_gpio_irq_trigger(struct irq_data *d)
>  {
>  	struct stm32_gpio_bank *bank = d->domain->host_data;
>  	int level;
>  
> -	irq_chip_eoi_parent(d);
> -
>  	/* If level interrupt type then retrig */
>  	level = stm32_gpio_get(&bank->gpio_chip, d->hwirq);
>  	if ((level == 0 && bank->irq_type[d->hwirq] == IRQ_TYPE_LEVEL_LOW) ||
>  	    (level == 1 && bank->irq_type[d->hwirq] == IRQ_TYPE_LEVEL_HIGH))
>  		irq_chip_retrigger_hierarchy(d);
> +}
> +
> +void stm32_gpio_irq_eoi(struct irq_data *d)

This should obviously be static. I'll amend it locally.

> +{
> +	irq_chip_eoi_parent(d);
> +	stm32_gpio_irq_trigger(d);
>  };
>  
>  static int stm32_gpio_set_type(struct irq_data *d, unsigned int type)
> @@ -371,12 +375,18 @@ static void stm32_gpio_irq_release_resources(struct irq_data *irq_data)
>  	gpiochip_unlock_as_irq(&bank->gpio_chip, irq_data->hwirq);
>  }
>  
> +static void stm32_gpio_irq_unmask(struct irq_data *d)
> +{
> +	irq_chip_unmask_parent(d);
> +	stm32_gpio_irq_trigger(d);
> +}
> +
>  static struct irq_chip stm32_gpio_irq_chip = {
>  	.name		= "stm32gpio",
>  	.irq_eoi	= stm32_gpio_irq_eoi,
>  	.irq_ack	= irq_chip_ack_parent,
>  	.irq_mask	= irq_chip_mask_parent,
> -	.irq_unmask	= irq_chip_unmask_parent,
> +	.irq_unmask	= stm32_gpio_irq_unmask,
>  	.irq_set_type	= stm32_gpio_set_type,
>  	.irq_set_wake	= irq_chip_set_wake_parent,
>  	.irq_request_resources = stm32_gpio_irq_request_resources,

I'll queue this for 5.7.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [tip: irq/core] irqchip/stm32: Retrigger both in eoi and unmask callbacks
  2020-03-23 23:51 ` Marek Vasut
  (?)
  (?)
@ 2020-03-29 20:26 ` tip-bot2 for Marek Vasut
  -1 siblings, 0 replies; 5+ messages in thread
From: tip-bot2 for Marek Vasut @ 2020-03-29 20:26 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Marek Vasut, Marc Zyngier, x86, LKML

The following commit has been merged into the irq/core branch of tip:

Commit-ID:     00760d3cd9de2ccee6b73e30b53e71704a99209e
Gitweb:        https://git.kernel.org/tip/00760d3cd9de2ccee6b73e30b53e71704a99209e
Author:        Marek Vasut <marex@denx.de>
AuthorDate:    Tue, 24 Mar 2020 00:51:32 +01:00
Committer:     Marc Zyngier <maz@kernel.org>
CommitterDate: Tue, 24 Mar 2020 11:12:34 

irqchip/stm32: Retrigger both in eoi and unmask callbacks

Sampling the IRQ line state in EOI and retriggering the interrupt to
work around missing level-triggered interrupt support only works for
non-threaded interrupts. Threaded interrupts must be retriggered the
same way in unmask callback.

Signed-off-by: Marek Vasut <marex@denx.de>
[maz: fixed missing static attribute]
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20200323235132.530550-1-marex@denx.de
---
 drivers/pinctrl/stm32/pinctrl-stm32.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
index d330b30..af3b24f 100644
--- a/drivers/pinctrl/stm32/pinctrl-stm32.c
+++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
@@ -304,18 +304,22 @@ static const struct gpio_chip stm32_gpio_template = {
 	.get_direction		= stm32_gpio_get_direction,
 };
 
-void stm32_gpio_irq_eoi(struct irq_data *d)
+static void stm32_gpio_irq_trigger(struct irq_data *d)
 {
 	struct stm32_gpio_bank *bank = d->domain->host_data;
 	int level;
 
-	irq_chip_eoi_parent(d);
-
 	/* If level interrupt type then retrig */
 	level = stm32_gpio_get(&bank->gpio_chip, d->hwirq);
 	if ((level == 0 && bank->irq_type[d->hwirq] == IRQ_TYPE_LEVEL_LOW) ||
 	    (level == 1 && bank->irq_type[d->hwirq] == IRQ_TYPE_LEVEL_HIGH))
 		irq_chip_retrigger_hierarchy(d);
+}
+
+static void stm32_gpio_irq_eoi(struct irq_data *d)
+{
+	irq_chip_eoi_parent(d);
+	stm32_gpio_irq_trigger(d);
 };
 
 static int stm32_gpio_set_type(struct irq_data *d, unsigned int type)
@@ -371,12 +375,18 @@ static void stm32_gpio_irq_release_resources(struct irq_data *irq_data)
 	gpiochip_unlock_as_irq(&bank->gpio_chip, irq_data->hwirq);
 }
 
+static void stm32_gpio_irq_unmask(struct irq_data *d)
+{
+	irq_chip_unmask_parent(d);
+	stm32_gpio_irq_trigger(d);
+}
+
 static struct irq_chip stm32_gpio_irq_chip = {
 	.name		= "stm32gpio",
 	.irq_eoi	= stm32_gpio_irq_eoi,
 	.irq_ack	= irq_chip_ack_parent,
 	.irq_mask	= irq_chip_mask_parent,
-	.irq_unmask	= irq_chip_unmask_parent,
+	.irq_unmask	= stm32_gpio_irq_unmask,
 	.irq_set_type	= stm32_gpio_set_type,
 	.irq_set_wake	= irq_chip_set_wake_parent,
 	.irq_request_resources = stm32_gpio_irq_request_resources,

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-03-29 20:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-23 23:51 [PATCH] irqchip/stm32: Retrigger both in eoi and unmask callbacks Marek Vasut
2020-03-23 23:51 ` Marek Vasut
2020-03-24 11:10 ` Marc Zyngier
2020-03-24 11:10   ` Marc Zyngier
2020-03-29 20:26 ` [tip: irq/core] " tip-bot2 for Marek Vasut

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.