Commit 51b05f6b authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Jason Cooper

irqchip: renesas-irqc: Add minimal runtime PM support

This is just enough to let pm_clk_*() enable the functional clock, and
manage it for suspend/resume, if present.
Before, it was assumed enabled by the bootloader or reset state.
Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: default avatarSimon Horman <horms+renesas@verge.net.au>
Link: https://lkml.kernel.org/r/1426704961-27322-3-git-send-email-geert+renesas@glider.beSigned-off-by: default avatarJason Cooper <jason@lakedaemon.net>
parent 1cd5ec73
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_data/irq-renesas-irqc.h> #include <linux/platform_data/irq-renesas-irqc.h>
#include <linux/pm_runtime.h>
#define IRQC_IRQ_MAX 32 /* maximum 32 interrupts per driver instance */ #define IRQC_IRQ_MAX 32 /* maximum 32 interrupts per driver instance */
...@@ -180,6 +181,9 @@ static int irqc_probe(struct platform_device *pdev) ...@@ -180,6 +181,9 @@ static int irqc_probe(struct platform_device *pdev)
p->pdev = pdev; p->pdev = pdev;
platform_set_drvdata(pdev, p); platform_set_drvdata(pdev, p);
pm_runtime_enable(&pdev->dev);
pm_runtime_get_sync(&pdev->dev);
/* get hold of manadatory IOMEM */ /* get hold of manadatory IOMEM */
io = platform_get_resource(pdev, IORESOURCE_MEM, 0); io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!io) { if (!io) {
...@@ -260,6 +264,8 @@ static int irqc_probe(struct platform_device *pdev) ...@@ -260,6 +264,8 @@ static int irqc_probe(struct platform_device *pdev)
err2: err2:
iounmap(p->iomem); iounmap(p->iomem);
err1: err1:
pm_runtime_put(&pdev->dev);
pm_runtime_disable(&pdev->dev);
kfree(p); kfree(p);
err0: err0:
return ret; return ret;
...@@ -275,6 +281,8 @@ static int irqc_remove(struct platform_device *pdev) ...@@ -275,6 +281,8 @@ static int irqc_remove(struct platform_device *pdev)
irq_domain_remove(p->irq_domain); irq_domain_remove(p->irq_domain);
iounmap(p->iomem); iounmap(p->iomem);
pm_runtime_put(&pdev->dev);
pm_runtime_disable(&pdev->dev);
kfree(p); kfree(p);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment