[PATCH 3/7] gpio: rcar: Add minimal runtime PM support

Subsystems: gpio subsystem, the rest

STALE4591d

3 messages, 2 authors, 2014-03-31 · open the first message on its own page

[PATCH 3/7] gpio: rcar: Add minimal runtime PM support

From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: 2014-03-27 20:47:55

From: Geert Uytterhoeven <geert+renesas@glider.be>

This is just enough to automatically enable the functional clock, if
present. Clock management during suspend/resume is still to be added.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Linus Walleij <redacted>
Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Cc: <redacted>
---
 drivers/gpio/gpio-rcar.c |    8 ++++++++
 1 file changed, 8 insertions(+)
diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index 03c91482432c..c6995f6c3c40 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -26,6 +26,7 @@
 #include <linux/pinctrl/consumer.h>
 #include <linux/platform_data/gpio-rcar.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/spinlock.h>
 #include <linux/slab.h>
 
@@ -377,6 +378,9 @@ static int gpio_rcar_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, p);
 
+	pm_runtime_enable(dev);
+	pm_runtime_get_sync(dev);
+
 	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 
@@ -460,6 +464,8 @@ static int gpio_rcar_probe(struct platform_device *pdev)
 err1:
 	irq_domain_remove(p->irq_domain);
 err0:
+	pm_runtime_put_sync(dev);
+	pm_runtime_disable(dev);
 	return ret;
 }
 
@@ -473,6 +479,8 @@ static int gpio_rcar_remove(struct platform_device *pdev)
 		return ret;
 
 	irq_domain_remove(p->irq_domain);
+	pm_runtime_put_sync(&pdev->dev);
+	pm_runtime_disable(&pdev->dev);
 	return 0;
 }
 
-- 
1.7.9.5

Re: [PATCH 3/7] gpio: rcar: Add minimal runtime PM support

From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Date: 2014-03-28 16:52:38

Hi Geert,

Thank you for the patch.

On Thursday 27 March 2014 21:47:38 Geert Uytterhoeven wrote:
quoted hunk
From: Geert Uytterhoeven <geert+renesas@glider.be>

This is just enough to automatically enable the functional clock, if
present. Clock management during suspend/resume is still to be added.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Linus Walleij <redacted>
Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Cc: <redacted>
---
 drivers/gpio/gpio-rcar.c |    8 ++++++++
 1 file changed, 8 insertions(+)
diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index 03c91482432c..c6995f6c3c40 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -26,6 +26,7 @@
 #include <linux/pinctrl/consumer.h>
 #include <linux/platform_data/gpio-rcar.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/spinlock.h>
 #include <linux/slab.h>
@@ -377,6 +378,9 @@ static int gpio_rcar_probe(struct platform_device *pdev)

 	platform_set_drvdata(pdev, p);

+	pm_runtime_enable(dev);
+	pm_runtime_get_sync(dev);
+
 	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
@@ -460,6 +464,8 @@ static int gpio_rcar_probe(struct platform_device *pdev)
err1:
 	irq_domain_remove(p->irq_domain);
 err0:
+	pm_runtime_put_sync(dev);
Do we really need the sync version, isn't pm_runtime_put() enough ?
quoted hunk
+	pm_runtime_disable(dev);
 	return ret;
 }
@@ -473,6 +479,8 @@ static int gpio_rcar_remove(struct platform_device
*pdev) return ret;

 	irq_domain_remove(p->irq_domain);
+	pm_runtime_put_sync(&pdev->dev);
Same comment here.
quoted hunk
+	pm_runtime_disable(&pdev->dev);
 	return 0;
 }
-- 
Regards,

Laurent Pinchart

Re: [PATCH 3/7] gpio: rcar: Add minimal runtime PM support

From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: 2014-03-31 10:04:33

Hi Laurent,

On Fri, Mar 28, 2014 at 5:54 PM, Laurent Pinchart
[off-list ref] wrote:
quoted
@@ -460,6 +464,8 @@ static int gpio_rcar_probe(struct platform_device *pdev)
err1:
      irq_domain_remove(p->irq_domain);
 err0:
+     pm_runtime_put_sync(dev);
Do we really need the sync version, isn't pm_runtime_put() enough ?
No we don't, copy-and-paste from rcar-thermal (which I'll fix, too).

Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help