All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jyri Sarha <jsarha@ti.com>
To: dri-devel@lists.freedesktop.org
Cc: Jyri Sarha <jsarha@ti.com>,
	tomi.valkeinen@ti.com, laurent.pinchart@ideasonboard.com
Subject: [PATCH 11/21] drm/tilcdc: cleanup runtime PM handling
Date: Thu, 4 Feb 2016 11:31:04 +0200	[thread overview]
Message-ID: <9fdf43a0858260c660f9c8554f9eb44c8306db0c.1454577570.git.jsarha@ti.com> (raw)
In-Reply-To: <cover.1454577570.git.jsarha@ti.com>

From: Tomi Valkeinen <tomi.valkeinen@ti.com>

Cleanup runtime PM handling. Before the patch the usage of pm_runtime
calls was inconsistent and hard to follow. After the update the
pm_runtime calls are removed from set_scanout() and called around
major operations that access the HW. After the patch the DPMS code does
not have pm_runtime_forbid/allow calls any more and
pm_runtime_irq_safe() is not set anymore.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
[Added description to the patch]
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 19 +++++++++++--------
 drivers/gpu/drm/tilcdc/tilcdc_drv.c  |  1 -
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
index cc45818..3a6f11e 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
@@ -71,7 +71,6 @@ static void set_scanout(struct drm_crtc *crtc, int n)
 	struct drm_device *dev = crtc->dev;
 	struct tilcdc_drm_private *priv = dev->dev_private;
 
-	pm_runtime_get_sync(dev->dev);
 	tilcdc_write(dev, base_reg[n], tilcdc_crtc->start);
 	tilcdc_write(dev, ceil_reg[n], tilcdc_crtc->end);
 	if (tilcdc_crtc->scanout[n]) {
@@ -81,7 +80,6 @@ static void set_scanout(struct drm_crtc *crtc, int n)
 	tilcdc_crtc->scanout[n] = crtc->primary->fb;
 	drm_framebuffer_reference(tilcdc_crtc->scanout[n]);
 	tilcdc_crtc->dirty &= ~stat[n];
-	pm_runtime_put_sync(dev->dev);
 }
 
 static void update_scanout(struct drm_crtc *crtc)
@@ -186,8 +184,13 @@ static int tilcdc_crtc_page_flip(struct drm_crtc *crtc,
 
 	crtc->primary->fb = fb;
 	tilcdc_crtc->event = event;
+
+	pm_runtime_get_sync(dev->dev);
+
 	update_scanout(crtc);
 
+	pm_runtime_put_sync(dev->dev);
+
 	return 0;
 }
 
@@ -206,10 +209,8 @@ void tilcdc_crtc_dpms(struct drm_crtc *crtc, int mode)
 
 	tilcdc_crtc->dpms = mode;
 
-	pm_runtime_get_sync(dev->dev);
-
 	if (mode == DRM_MODE_DPMS_ON) {
-		pm_runtime_forbid(dev->dev);
+		pm_runtime_get_sync(dev->dev);
 		start(crtc);
 	} else {
 		tilcdc_crtc->frame_done = false;
@@ -227,10 +228,9 @@ void tilcdc_crtc_dpms(struct drm_crtc *crtc, int mode)
 			if (ret == 0)
 				dev_err(dev->dev, "timeout waiting for framedone\n");
 		}
-		pm_runtime_allow(dev->dev);
-	}
 
-	pm_runtime_put_sync(dev->dev);
+		pm_runtime_put_sync(dev->dev);
+	}
 }
 
 static bool tilcdc_crtc_mode_fixup(struct drm_crtc *crtc,
@@ -455,13 +455,16 @@ static int tilcdc_crtc_mode_set(struct drm_crtc *crtc,
 static int tilcdc_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
 		struct drm_framebuffer *old_fb)
 {
+	struct drm_device *dev = crtc->dev;
 	int r;
 
 	r = tilcdc_verify_fb(crtc, crtc->primary->fb);
 	if (r)
 		return r;
 
+	pm_runtime_get_sync(dev->dev);
 	update_scanout(crtc);
+	pm_runtime_put_sync(dev->dev);
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index 9bc15e7..715e160 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -229,7 +229,6 @@ static int tilcdc_load(struct drm_device *dev, unsigned long flags)
 	DBG("Maximum Pixel Clock Value %dKHz", priv->max_pixelclock);
 
 	pm_runtime_enable(dev->dev);
-	pm_runtime_irq_safe(dev->dev);
 
 	/*
 	 * disable creation of new console during suspend.
-- 
1.9.1

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

  parent reply	other threads:[~2016-02-04  9:31 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-04  9:30 [PATCH 00/21] drm/ticdc: Accumulated fixes over the past couple of years Jyri Sarha
2016-02-04  9:30 ` [PATCH 01/21] drm/tilcdc: disable console switching during pm operations Jyri Sarha
2016-02-08 20:00   ` Tomi Valkeinen
2016-02-09  9:41     ` Daniel Vetter
2016-02-04  9:30 ` [PATCH 02/21] drm/tilcdc: rewrite pixel clock calculation Jyri Sarha
2016-02-04  9:30 ` [PATCH 03/21] drm/tilcdc: verify fb pitch Jyri Sarha
2016-02-04  9:30 ` [PATCH 04/21] drm/tilcdc: adopt pinctrl support Jyri Sarha
2016-02-04  9:30 ` [PATCH 05/21] drm/tilcdc: fix kernel panic on suspend when no hdmi monitor connected Jyri Sarha
2016-02-04  9:30 ` [PATCH 06/21] drm/tilcdc: make frame_done interrupt active at all times Jyri Sarha
2016-02-04  9:31 ` [PATCH 07/21] drm/tilcdc: disable the lcd controller/dma engine when suspend invoked Jyri Sarha
2016-02-04  9:31 ` [PATCH 08/21] drm/tilcdc: Implement dma-buf support for tilcdc Jyri Sarha
2016-02-04  9:31 ` [PATCH 09/21] drm/tilcdc: fix build error when !CONFIG_CPU_FREQ Jyri Sarha
2016-02-04  9:31 ` [PATCH 10/21] drm/tilcdc: Allocate register storage based on the actual number registers Jyri Sarha
2016-02-04  9:31 ` Jyri Sarha [this message]
2016-02-04  9:31 ` [PATCH 12/21] drm/tilcdc: disable crtc on unload Jyri Sarha
2016-02-04  9:31 ` [PATCH 13/21] drm/tilcdc: split reset to a separate function Jyri Sarha
2016-02-04  9:31 ` [PATCH 14/21] drm/tilcdc: remove broken error handling Jyri Sarha
2016-02-04  9:31 ` [PATCH 15/21] drm/tilcdc: cleanup irq handling Jyri Sarha
2016-02-04  9:31 ` [PATCH 16/21] drm/tilcdc: Get rid of complex ping-pong mechanism Jyri Sarha
2016-02-04  9:31 ` [PATCH 17/21] drm/tilcdc: Do not update the next frame buffer close to vertical blank Jyri Sarha
2016-02-04  9:31 ` [PATCH 18/21] drm/tilcdc: Fix interrupt enable/disable code for version 2 tilcdc Jyri Sarha
2016-02-04  9:31 ` [PATCH 19/21] drm/tilcdc: Remove the duplicate LCDC_INT_ENABLE_SET_REG in registers[] Jyri Sarha
2016-02-04  9:31 ` [PATCH 20/21] drm/tilcdc: Add prints on sync lost and FIFO underrun interrupts Jyri Sarha
2016-02-04  9:31 ` [PATCH 21/21] drm/tilcdc: Disable sync lost interrupt if it fires on every frame Jyri Sarha

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=9fdf43a0858260c660f9c8554f9eb44c8306db0c.1454577570.git.jsarha@ti.com \
    --to=jsarha@ti.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=tomi.valkeinen@ti.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.