aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/tilcdc
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2015-10-19 05:30:03 -0400
committerJyri Sarha <jsarha@ti.com>2016-02-25 09:39:36 -0500
commit65734a262350a746100dcfd85a81f7dc1b69dd10 (patch)
treeece0c53ee91128a8237653f2a17686ea9ef749f7 /drivers/gpu/drm/tilcdc
parent29ddd6e171abae990a881b9e221359f13c546369 (diff)
drm/tilcdc: cleanup runtime PM handling
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>
Diffstat (limited to 'drivers/gpu/drm/tilcdc')
-rw-r--r--drivers/gpu/drm/tilcdc/tilcdc_crtc.c19
-rw-r--r--drivers/gpu/drm/tilcdc/tilcdc_drv.c1
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 465fd047875a..08b1e03b502e 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)
71 struct drm_device *dev = crtc->dev; 71 struct drm_device *dev = crtc->dev;
72 struct tilcdc_drm_private *priv = dev->dev_private; 72 struct tilcdc_drm_private *priv = dev->dev_private;
73 73
74 pm_runtime_get_sync(dev->dev);
75 tilcdc_write(dev, base_reg[n], tilcdc_crtc->start); 74 tilcdc_write(dev, base_reg[n], tilcdc_crtc->start);
76 tilcdc_write(dev, ceil_reg[n], tilcdc_crtc->end); 75 tilcdc_write(dev, ceil_reg[n], tilcdc_crtc->end);
77 if (tilcdc_crtc->scanout[n]) { 76 if (tilcdc_crtc->scanout[n]) {
@@ -81,7 +80,6 @@ static void set_scanout(struct drm_crtc *crtc, int n)
81 tilcdc_crtc->scanout[n] = crtc->primary->fb; 80 tilcdc_crtc->scanout[n] = crtc->primary->fb;
82 drm_framebuffer_reference(tilcdc_crtc->scanout[n]); 81 drm_framebuffer_reference(tilcdc_crtc->scanout[n]);
83 tilcdc_crtc->dirty &= ~stat[n]; 82 tilcdc_crtc->dirty &= ~stat[n];
84 pm_runtime_put_sync(dev->dev);
85} 83}
86 84
87static void update_scanout(struct drm_crtc *crtc) 85static void update_scanout(struct drm_crtc *crtc)
@@ -186,8 +184,13 @@ static int tilcdc_crtc_page_flip(struct drm_crtc *crtc,
186 184
187 crtc->primary->fb = fb; 185 crtc->primary->fb = fb;
188 tilcdc_crtc->event = event; 186 tilcdc_crtc->event = event;
187
188 pm_runtime_get_sync(dev->dev);
189
189 update_scanout(crtc); 190 update_scanout(crtc);
190 191
192 pm_runtime_put_sync(dev->dev);
193
191 return 0; 194 return 0;
192} 195}
193 196
@@ -206,10 +209,8 @@ void tilcdc_crtc_dpms(struct drm_crtc *crtc, int mode)
206 209
207 tilcdc_crtc->dpms = mode; 210 tilcdc_crtc->dpms = mode;
208 211
209 pm_runtime_get_sync(dev->dev);
210
211 if (mode == DRM_MODE_DPMS_ON) { 212 if (mode == DRM_MODE_DPMS_ON) {
212 pm_runtime_forbid(dev->dev); 213 pm_runtime_get_sync(dev->dev);
213 start(crtc); 214 start(crtc);
214 } else { 215 } else {
215 tilcdc_crtc->frame_done = false; 216 tilcdc_crtc->frame_done = false;
@@ -227,10 +228,9 @@ void tilcdc_crtc_dpms(struct drm_crtc *crtc, int mode)
227 if (ret == 0) 228 if (ret == 0)
228 dev_err(dev->dev, "timeout waiting for framedone\n"); 229 dev_err(dev->dev, "timeout waiting for framedone\n");
229 } 230 }
230 pm_runtime_allow(dev->dev);
231 }
232 231
233 pm_runtime_put_sync(dev->dev); 232 pm_runtime_put_sync(dev->dev);
233 }
234} 234}
235 235
236static bool tilcdc_crtc_mode_fixup(struct drm_crtc *crtc, 236static bool tilcdc_crtc_mode_fixup(struct drm_crtc *crtc,
@@ -455,13 +455,16 @@ static int tilcdc_crtc_mode_set(struct drm_crtc *crtc,
455static int tilcdc_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, 455static int tilcdc_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
456 struct drm_framebuffer *old_fb) 456 struct drm_framebuffer *old_fb)
457{ 457{
458 struct drm_device *dev = crtc->dev;
458 int r; 459 int r;
459 460
460 r = tilcdc_verify_fb(crtc, crtc->primary->fb); 461 r = tilcdc_verify_fb(crtc, crtc->primary->fb);
461 if (r) 462 if (r)
462 return r; 463 return r;
463 464
465 pm_runtime_get_sync(dev->dev);
464 update_scanout(crtc); 466 update_scanout(crtc);
467 pm_runtime_put_sync(dev->dev);
465 return 0; 468 return 0;
466} 469}
467 470
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index 47096b1b8b2a..47f0e0282d5d 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -230,7 +230,6 @@ static int tilcdc_load(struct drm_device *dev, unsigned long flags)
230 DBG("Maximum Pixel Clock Value %dKHz", priv->max_pixelclock); 230 DBG("Maximum Pixel Clock Value %dKHz", priv->max_pixelclock);
231 231
232 pm_runtime_enable(dev->dev); 232 pm_runtime_enable(dev->dev);
233 pm_runtime_irq_safe(dev->dev);
234 233
235 /* Determine LCD IP Version */ 234 /* Determine LCD IP Version */
236 pm_runtime_get_sync(dev->dev); 235 pm_runtime_get_sync(dev->dev);