Linux Samsung SOC development
 help / color / mirror / Atom feed
From: Inki Dae <inki.dae@samsung.com>
To: dri-devel@lists.freedesktop.org
Cc: linux-samsung-soc@vger.kernel.org,
	Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Subject: [PATCH v2 6/7] drm/exynos: add pm_runtime to DECON 5433
Date: Tue, 03 Nov 2015 19:47:08 +0900	[thread overview]
Message-ID: <1446547629-12521-7-git-send-email-inki.dae@samsung.com> (raw)
In-Reply-To: <1446547629-12521-1-git-send-email-inki.dae@samsung.com>

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Let pm_runtime handle the enabling/disabling of the device with
proper refcnt instead of rely on specific flags to track the enabled
state.

Changelog v2:
- Change CONFIG_PM_SLEEP -> CONFIG_PM

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 54 +++++++++++++++++++--------
 1 file changed, 39 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index fbe1b31..edfd6e3 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -385,12 +385,6 @@ static void decon_enable(struct exynos_drm_crtc *crtc)
 
 	pm_runtime_get_sync(ctx->dev);
 
-	for (i = 0; i < ARRAY_SIZE(decon_clks_name); i++) {
-		ret = clk_prepare_enable(ctx->clks[i]);
-		if (ret < 0)
-			goto err;
-	}
-
 	set_bit(BIT_CLKS_ENABLED, &ctx->flags);
 
 	/* if vblank was enabled status, enable it again. */
@@ -399,11 +393,6 @@ static void decon_enable(struct exynos_drm_crtc *crtc)
 
 	decon_commit(ctx->crtc);
 
-	return;
-err:
-	while (--i >= 0)
-		clk_disable_unprepare(ctx->clks[i]);
-
 	set_bit(BIT_SUSPENDED, &ctx->flags);
 }
 
@@ -425,9 +414,6 @@ static void decon_disable(struct exynos_drm_crtc *crtc)
 
 	decon_swreset(ctx);
 
-	for (i = 0; i < ARRAY_SIZE(decon_clks_name); i++)
-		clk_disable_unprepare(ctx->clks[i]);
-
 	clear_bit(BIT_CLKS_ENABLED, &ctx->flags);
 
 	pm_runtime_put_sync(ctx->dev);
@@ -478,7 +464,6 @@ err:
 static struct exynos_drm_crtc_ops decon_crtc_ops = {
 	.enable			= decon_enable,
 	.disable		= decon_disable,
-	.commit			= decon_commit,
 	.enable_vblank		= decon_enable_vblank,
 	.disable_vblank		= decon_disable_vblank,
 	.atomic_begin		= decon_atomic_begin,
@@ -581,6 +566,44 @@ out:
 	return IRQ_HANDLED;
 }
 
+#ifdef CONFIG_PM
+static int exynos5433_decon_suspend(struct device *dev)
+{
+	struct decon_context *ctx = dev_get_drvdata(dev);
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(decon_clks_name); i++)
+		clk_disable_unprepare(ctx->clks[i]);
+
+	return 0;
+}
+
+static int exynos5433_decon_resume(struct device *dev)
+{
+	struct decon_context *ctx = dev_get_drvdata(dev);
+	int i, ret;
+
+	for (i = 0; i < ARRAY_SIZE(decon_clks_name); i++) {
+		ret = clk_prepare_enable(ctx->clks[i]);
+		if (ret < 0)
+			goto err;
+	}
+
+	return 0;
+
+err:
+	while (--i >= 0)
+		clk_disable_unprepare(ctx->clks[i]);
+
+	return ret;
+}
+#endif
+
+static const struct dev_pm_ops exynos5433_decon_pm_ops = {
+	SET_RUNTIME_PM_OPS(exynos5433_decon_suspend, exynos5433_decon_resume,
+			   NULL)
+};
+
 static const struct of_device_id exynos5433_decon_driver_dt_match[] = {
 	{
 		.compatible = "samsung,exynos5433-decon",
@@ -684,6 +707,7 @@ struct platform_driver exynos5433_decon_driver = {
 	.remove		= exynos5433_decon_remove,
 	.driver		= {
 		.name	= "exynos5433-decon",
+		.pm	= &exynos5433_decon_pm_ops,
 		.of_match_table = exynos5433_decon_driver_dt_match,
 	},
 };
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2015-11-03 10:47 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-03 10:47 [PATCH v2 0/7] drm/exynos: add pm runtime support Inki Dae
2015-11-03 10:47 ` [PATCH v2 1/7] drm/exynos: do not start enabling DP at bind() phase Inki Dae
2015-11-03 10:47 ` [PATCH v2 2/7] drm/exynos: add pm_runtime to DP Inki Dae
2015-11-03 10:47 ` [PATCH v2 3/7] drm/exynos: add pm_runtime to HDMI Inki Dae
2015-11-03 10:47 ` [PATCH v2 4/7] drm/exynos: add pm_runtime to Mixer Inki Dae
2015-11-03 10:47 ` [PATCH v2 5/7] drm/exynos: add pm_runtime to FIMD Inki Dae
2015-11-03 10:47 ` Inki Dae [this message]
2015-11-03 10:47 ` [PATCH v2 7/7] drm/exynos: add pm_runtime to DECON 7 Inki Dae
2015-11-03 13:24 ` [PATCH v2 0/7] drm/exynos: add pm runtime support Andrzej Hajda
2015-11-03 15:38   ` Inki Dae
2015-11-04  7:24     ` Andrzej Hajda
2015-11-04  7:56       ` Inki Dae
2015-11-04 10:13         ` Andrzej Hajda
2015-11-04 11:46           ` Inki Dae
2015-11-19 14:51 ` Javier Martinez Canillas
2015-11-19 14:55   ` Javier Martinez Canillas
2015-11-19 15:51     ` Javier Martinez Canillas
2015-11-20 10:59       ` Inki Dae
2015-11-20 11:13         ` Inki Dae
2015-11-20 16:44           ` Javier Martinez Canillas
2015-11-21  9:38             ` Inki Dae
2015-11-21 13:40               ` Daniel Stone
2015-11-21 14:59                 ` Inki Dae
2015-11-23 12:25                   ` Javier Martinez Canillas
2015-11-23 16:47                     ` Inki Dae
2015-11-23 18:38                       ` Javier Martinez Canillas
2015-11-24  2:28                         ` Inki Dae
2015-11-24 13:19                           ` Javier Martinez Canillas
2015-11-25 15:52                             ` Inki Dae
2015-11-20 16:23         ` Javier Martinez Canillas
2015-11-21  9:40           ` Inki Dae

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1446547629-12521-7-git-send-email-inki.dae@samsung.com \
    --to=inki.dae@samsung.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gustavo.padovan@collabora.co.uk \
    --cc=linux-samsung-soc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox