Skip to contentSkip to conversation

gpio: R-Car and EM GPIO update V2

PATCH In review Magnus Damm 3 participants 12 messages Nov 20, 2013

Subsystems (3)
lore
Share & tools
lore

Magnus Damm

author maintainer
#0 lore raw

cover gpio: R-Car and EM GPIO update V2

gpio: R-Car and EM GPIO update V2

[PATCH 01/05 v2] gpio: rcar: Use lazy disable [PATCH 02/05 v2] gpio: rcar: Enable mask on suspend [PATCH 03/05] gpio: em: Setup gpiochip->dev [PATCH 04/05 v2] gpio: em: Use lazy disable [PATCH 05/05 v2] gpio: em: Enable mask on suspend

Update the R-Car GPIO driver and the GPIO driver used on EMEV2 to use lazy disable and mask on suspend. This fixes the Suspend-to-RAM behavior to make sure wakeup sources are left enabled while suspending. Also include a small fix for gpio-em that fixes the DT use case.

Thanks to Laurent and Linus for feedback.

---

Written against renesas.git tag renesas-devel-v3.12-20131119

Changes since V1:
- Split lazy disable and mask on suspend patches
- Improved commit messages

 drivers/gpio/gpio-em.c   |    5 ++---
 drivers/gpio/gpio-rcar.c |    5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)
author maintainer
#1 lore raw

PATCH v2 1/5 gpio: rcar: Use lazy disable

From: Magnus Damm <[email protected]>

Set the ->irq_enable() and ->irq_disable() methods to NULL to enable lazy disable of interrupts. This by itself provides some level of optimization, but is mainly enabled as ground work for future Suspend-to-RAM wake up support.

---

 drivers/gpio/gpio-rcar.c |    2 --
 1 file changed, 2 deletions(-)
drivers/gpio/gpio-rcar.c +0 -2
@@ -368,8 +368,6 @@ static int gpio_rcar_probe(struct platfo
 	irq_chip->name = name;
 	irq_chip->irq_mask = gpio_rcar_irq_disable;
 	irq_chip->irq_unmask = gpio_rcar_irq_enable;
-	irq_chip->irq_enable = gpio_rcar_irq_enable;
-	irq_chip->irq_disable = gpio_rcar_irq_disable;
 	irq_chip->irq_set_type = gpio_rcar_irq_set_type;
 	irq_chip->flags	= IRQCHIP_SKIP_SET_WAKE | IRQCHIP_SET_TYPE_MASKED;
 
#2 lore raw

Re: [PATCH 01/05 v2] gpio: rcar: Use lazy disable

Quoted 8 lines · Magnus Damm

From: Magnus Damm <[email protected]>

Set the ->irq_enable() and ->irq_disable() methods to NULL to enable lazy disable of interrupts. This by itself provides some level of optimization, but is mainly enabled as ground work for future Suspend-to-RAM wake up support.

Patch applied w/Laurent's ACK.

Yours,
Linus Walleij

author maintainer
#3 lore raw

PATCH v2 2/5 gpio: rcar: Enable mask on suspend

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Now when lazy interrupt disable has been enabled in the driver then extend the code to set IRQCHIP_MASK_ON_SUSPEND which tells the core that only IRQs marked as wakeups need to stay enabled during Suspend-to-RAM.

Tested on the Lager board with GPIO-keys and Suspend-to-RAM.

---

 drivers/gpio/gpio-rcar.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpio/gpio-rcar.c +2 -1
@@ -369,7 +369,8 @@ static int gpio_rcar_probe(struct platfo
 	irq_chip->irq_mask = gpio_rcar_irq_disable;
 	irq_chip->irq_unmask = gpio_rcar_irq_enable;
 	irq_chip->irq_set_type = gpio_rcar_irq_set_type;
-	irq_chip->flags	= IRQCHIP_SKIP_SET_WAKE | IRQCHIP_SET_TYPE_MASKED;
+	irq_chip->flags	= IRQCHIP_SKIP_SET_WAKE | IRQCHIP_SET_TYPE_MASKED
+			 | IRQCHIP_MASK_ON_SUSPEND;
 
 	p->irq_domain = irq_domain_add_simple(pdev->dev.of_node,
 					      p->config.number_of_pins,
#4 lore raw

Re: [PATCH 02/05 v2] gpio: rcar: Enable mask on suspend

Quoted 10 lines · Magnus Damm

From: Magnus Damm <[email protected]>

Now when lazy interrupt disable has been enabled in the driver then extend the code to set IRQCHIP_MASK_ON_SUSPEND which tells the core that only IRQs marked as wakeups need to stay enabled during Suspend-to-RAM.

Tested on the Lager board with GPIO-keys and Suspend-to-RAM.

Patch applied.

Yours,
Linus Walleij

author maintainer
#5 lore raw

PATCH 3/5 gpio: em: Setup gpiochip->dev

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Make sure gpio_chip->dev is setup so of_gpiochip_add() will work as expected.

---

 drivers/gpio/gpio-em.c |    1 +
 1 file changed, 1 insertion(+)
drivers/gpio/gpio-em.c +1 -0
@@ -327,6 +327,7 @@ static int em_gio_probe(struct platform_
 	gpio_chip->request = em_gio_request;
 	gpio_chip->free = em_gio_free;
 	gpio_chip->label = name;
+	gpio_chip->dev = &pdev->dev;
 	gpio_chip->owner = THIS_MODULE;
 	gpio_chip->base = pdata->gpio_base;
 	gpio_chip->ngpio = pdata->number_of_pins;
author maintainer
#7 lore raw

PATCH v2 4/5 gpio: em: Use lazy disable

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Set the ->irq_enable() and ->irq_disable() methods to NULL to enable lazy disable of interrupts. This by itself provides some level of optimization, but is mainly enabled as ground work for future Suspend-to-RAM wake up support.

---

 drivers/gpio/gpio-em.c |    2 --
 1 file changed, 2 deletions(-)
drivers/gpio/gpio-em.c +0 -2
@@ -336,8 +336,6 @@ static int em_gio_probe(struct platform_
 	irq_chip->name = name;
 	irq_chip->irq_mask = em_gio_irq_disable;
 	irq_chip->irq_unmask = em_gio_irq_enable;
-	irq_chip->irq_enable = em_gio_irq_enable;
-	irq_chip->irq_disable = em_gio_irq_disable;
 	irq_chip->irq_set_type = em_gio_irq_set_type;
 	irq_chip->flags	= IRQCHIP_SKIP_SET_WAKE;
 
#8 lore raw

Re: [PATCH 04/05 v2] gpio: em: Use lazy disable

Quoted 8 lines · Magnus Damm

From: Magnus Damm <[email protected]>

Set the ->irq_enable() and ->irq_disable() methods to NULL to enable lazy disable of interrupts. This by itself provides some level of optimization, but is mainly enabled as ground work for future Suspend-to-RAM wake up support.

Patch applied.

Yours,
Linus Walleij

author maintainer
#9 lore raw

PATCH v2 5/5 gpio: em: Enable mask on suspend

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Now when lazy interrupt disable has been enabled in the driver then extend the code to set IRQCHIP_MASK_ON_SUSPEND which tells the core that only IRQs marked as wakeups need to stay enabled during Suspend-to-RAM.

Tested on the KZM9D board with GPIO-keys.

---

 drivers/gpio/gpio-em.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-em.c +1 -1
@@ -337,7 +337,7 @@ static int em_gio_probe(struct platform_
 	irq_chip->irq_mask = em_gio_irq_disable;
 	irq_chip->irq_unmask = em_gio_irq_enable;
 	irq_chip->irq_set_type = em_gio_irq_set_type;
-	irq_chip->flags	= IRQCHIP_SKIP_SET_WAKE;
+	irq_chip->flags	= IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND;
 
 	p->irq_domain = irq_domain_add_simple(pdev->dev.of_node,
 					      pdata->number_of_pins,
#10 lore raw

Re: [PATCH 05/05 v2] gpio: em: Enable mask on suspend

Quoted 10 lines · Magnus Damm

From: Magnus Damm <[email protected]>

Now when lazy interrupt disable has been enabled in the driver then extend the code to set IRQCHIP_MASK_ON_SUSPEND which tells the core that only IRQs marked as wakeups need to stay enabled during Suspend-to-RAM.

Tested on the KZM9D board with GPIO-keys.

Patch applied.

Yours,
Linus Walleij

Acked-by on the v1 series
#11 lore raw
In reply to Magnus Damm

Hi Magnus,

Thank you for the patch.

Quoted 8 lines · On Wednesday 20 November 2013 09:22:59 Magnus Damm wrote:

gpio: R-Car and EM GPIO update V2

[PATCH 01/05 v2] gpio: rcar: Use lazy disable [PATCH 02/05 v2] gpio: rcar: Enable mask on suspend [PATCH 03/05] gpio: em: Setup gpiochip->dev [PATCH 04/05 v2] gpio: em: Use lazy disable [PATCH 05/05 v2] gpio: em: Enable mask on suspend

Quoted 8 lines

Update the R-Car GPIO driver and the GPIO driver used on EMEV2 to use lazy disable and mask on suspend. This fixes the Suspend-to-RAM behavior to make sure wakeup sources are left enabled while suspending. Also include a small fix for gpio-em that fixes the DT use case.

Thanks to Laurent and Linus for feedback.

For the whole series,

Quoted 11 lines

---

Written against renesas.git tag renesas-devel-v3.12-20131119

Changes since V1:
- Split lazy disable and mask on suspend patches
- Improved commit messages

 drivers/gpio/gpio-em.c   |    5 ++---
 drivers/gpio/gpio-rcar.c |    5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)
Signature · 3 lines
Regards,

Laurent Pinchart