drm/exynos: decon: add simple runtime pm support
authorMarek Szyprowski <m.szyprowski@samsung.com>
Thu, 30 Jun 2016 13:58:55 +0000 (15:58 +0200)
committerInki Dae <inki.dae@samsung.com>
Wed, 6 Jul 2016 02:24:04 +0000 (11:24 +0900)
Add simple runtime pm to let driver to control power domain. No runtime pm
callbacks are defined, because state of the driver is already handled by
the DRM core.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Ib2c6b6ef6e6577ef9a7259d1ae80202ab0e0a7c7

drivers/gpu/drm/exynos/exynos5433_drm_decon.c

index 64484711db8fa4090c2ab2fd7a2cc427be6921f4..d966989f55c34f316ea0c08e5a18414d706d3dd4 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/of_device.h>
 #include <linux/mfd/syscon.h>
 #include <linux/regmap.h>
+#include <linux/pm_runtime.h>
 
 #include <video/exynos5433_decon.h>
 
@@ -514,6 +515,7 @@ static void decon_dpms_on(struct decon_context *ctx)
        if (!ctx->suspended)
                return;
 
+       pm_runtime_get_sync(ctx->dev);
        ctx->suspended = false;
 
        for (i = 0; i < ARRAY_SIZE(decon_clks_name); i++) {
@@ -577,6 +579,7 @@ static void decon_dpms_off(struct decon_context *ctx)
        for (i = ARRAY_SIZE(decon_clks_name) - 1; i >= 0; i--)
                clk_disable_unprepare(ctx->clks[i]);
 
+       pm_runtime_put_sync(ctx->dev);
        ctx->suspended = true;
 
        /*
@@ -894,13 +897,26 @@ static int exynos5433_decon_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, ctx);
 
-       return component_add(dev, &decon_component_ops);
+       pm_runtime_enable(dev);
+
+       ret = component_add(dev, &decon_component_ops);
+       if (ret)
+               goto err_disable_pm_runtime;
+
+       return 0;
+
+err_disable_pm_runtime:
+       pm_runtime_disable(dev);
+
+       return ret;
 }
 
 static int exynos5433_decon_remove(struct platform_device *pdev)
 {
        component_del(&pdev->dev, &decon_component_ops);
 
+       pm_runtime_disable(&pdev->dev);
+
        return 0;
 }