aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2017-06-19 21:17:30 -0400
committerDave Airlie <airlied@redhat.com>2017-06-19 21:17:30 -0400
commit3aaf4d95b07333af27c050511898d74a299fc743 (patch)
tree5c744e6105935328d5c8bfea3dab19be347406bc
parentd02b0ffb005469ef4ee73610fb08dff45e4487f8 (diff)
parente40eda3dda1ef36ddef7e02c1b280a9ae91a561b (diff)
Merge branch 'for-upstream/mali-dp' of git://linux-arm.org/linux-ld into drm-next
Here are the Mali DP driver changes. They include the mali-dp specific changes from Jose Abreu on crtc->mode_valid() as well as a couple of patches for fixing the sharing of IRQ lines and use of DRM CMA helper for framebuffer physical address calculation. Please pull! * 'for-upstream/mali-dp' of git://linux-arm.org/linux-ld: drm/arm: mali-dp: Use CMA helper for plane buffer address calculation drm/mali-dp: Check PM status when sharing interrupt lines drm/arm: malidp: Use crtc->mode_valid() callback
-rw-r--r--drivers/gpu/drm/arm/malidp_crtc.c11
-rw-r--r--drivers/gpu/drm/arm/malidp_hw.c19
-rw-r--r--drivers/gpu/drm/arm/malidp_planes.c12
3 files changed, 26 insertions, 16 deletions
diff --git a/drivers/gpu/drm/arm/malidp_crtc.c b/drivers/gpu/drm/arm/malidp_crtc.c
index 9446a673d469..4bb38a21efec 100644
--- a/drivers/gpu/drm/arm/malidp_crtc.c
+++ b/drivers/gpu/drm/arm/malidp_crtc.c
@@ -22,9 +22,8 @@
22#include "malidp_drv.h" 22#include "malidp_drv.h"
23#include "malidp_hw.h" 23#include "malidp_hw.h"
24 24
25static bool malidp_crtc_mode_fixup(struct drm_crtc *crtc, 25static enum drm_mode_status malidp_crtc_mode_valid(struct drm_crtc *crtc,
26 const struct drm_display_mode *mode, 26 const struct drm_display_mode *mode)
27 struct drm_display_mode *adjusted_mode)
28{ 27{
29 struct malidp_drm *malidp = crtc_to_malidp_device(crtc); 28 struct malidp_drm *malidp = crtc_to_malidp_device(crtc);
30 struct malidp_hw_device *hwdev = malidp->dev; 29 struct malidp_hw_device *hwdev = malidp->dev;
@@ -40,11 +39,11 @@ static bool malidp_crtc_mode_fixup(struct drm_crtc *crtc,
40 if (rate != req_rate) { 39 if (rate != req_rate) {
41 DRM_DEBUG_DRIVER("pxlclk doesn't support %ld Hz\n", 40 DRM_DEBUG_DRIVER("pxlclk doesn't support %ld Hz\n",
42 req_rate); 41 req_rate);
43 return false; 42 return MODE_NOCLOCK;
44 } 43 }
45 } 44 }
46 45
47 return true; 46 return MODE_OK;
48} 47}
49 48
50static void malidp_crtc_enable(struct drm_crtc *crtc) 49static void malidp_crtc_enable(struct drm_crtc *crtc)
@@ -408,7 +407,7 @@ static int malidp_crtc_atomic_check(struct drm_crtc *crtc,
408} 407}
409 408
410static const struct drm_crtc_helper_funcs malidp_crtc_helper_funcs = { 409static const struct drm_crtc_helper_funcs malidp_crtc_helper_funcs = {
411 .mode_fixup = malidp_crtc_mode_fixup, 410 .mode_valid = malidp_crtc_mode_valid,
412 .enable = malidp_crtc_enable, 411 .enable = malidp_crtc_enable,
413 .disable = malidp_crtc_disable, 412 .disable = malidp_crtc_disable,
414 .atomic_check = malidp_crtc_atomic_check, 413 .atomic_check = malidp_crtc_atomic_check,
diff --git a/drivers/gpu/drm/arm/malidp_hw.c b/drivers/gpu/drm/arm/malidp_hw.c
index 28360b8542f7..17bca99e8ac8 100644
--- a/drivers/gpu/drm/arm/malidp_hw.c
+++ b/drivers/gpu/drm/arm/malidp_hw.c
@@ -766,12 +766,17 @@ static irqreturn_t malidp_de_irq(int irq, void *arg)
766 u32 status, mask, dc_status; 766 u32 status, mask, dc_status;
767 irqreturn_t ret = IRQ_NONE; 767 irqreturn_t ret = IRQ_NONE;
768 768
769 if (!drm->dev_private)
770 return IRQ_HANDLED;
771
772 hwdev = malidp->dev; 769 hwdev = malidp->dev;
773 de = &hwdev->map.de_irq_map; 770 de = &hwdev->map.de_irq_map;
774 771
772 /*
773 * if we are suspended it is likely that we were invoked because
774 * we share an interrupt line with some other driver, don't try
775 * to read the hardware registers
776 */
777 if (hwdev->pm_suspended)
778 return IRQ_NONE;
779
775 /* first handle the config valid IRQ */ 780 /* first handle the config valid IRQ */
776 dc_status = malidp_hw_read(hwdev, hwdev->map.dc_base + MALIDP_REG_STATUS); 781 dc_status = malidp_hw_read(hwdev, hwdev->map.dc_base + MALIDP_REG_STATUS);
777 if (dc_status & hwdev->map.dc_irq_map.vsync_irq) { 782 if (dc_status & hwdev->map.dc_irq_map.vsync_irq) {
@@ -854,6 +859,14 @@ static irqreturn_t malidp_se_irq(int irq, void *arg)
854 struct malidp_hw_device *hwdev = malidp->dev; 859 struct malidp_hw_device *hwdev = malidp->dev;
855 u32 status, mask; 860 u32 status, mask;
856 861
862 /*
863 * if we are suspended it is likely that we were invoked because
864 * we share an interrupt line with some other driver, don't try
865 * to read the hardware registers
866 */
867 if (hwdev->pm_suspended)
868 return IRQ_NONE;
869
857 status = malidp_hw_read(hwdev, hwdev->map.se_base + MALIDP_REG_STATUS); 870 status = malidp_hw_read(hwdev, hwdev->map.se_base + MALIDP_REG_STATUS);
858 if (!(status & hwdev->map.se_irq_map.irq_mask)) 871 if (!(status & hwdev->map.se_irq_map.irq_mask))
859 return IRQ_NONE; 872 return IRQ_NONE;
diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
index 063a8d2b0be3..600fa7bd7f52 100644
--- a/drivers/gpu/drm/arm/malidp_planes.c
+++ b/drivers/gpu/drm/arm/malidp_planes.c
@@ -264,11 +264,9 @@ static void malidp_de_set_plane_pitches(struct malidp_plane *mp,
264static void malidp_de_plane_update(struct drm_plane *plane, 264static void malidp_de_plane_update(struct drm_plane *plane,
265 struct drm_plane_state *old_state) 265 struct drm_plane_state *old_state)
266{ 266{
267 struct drm_gem_cma_object *obj;
268 struct malidp_plane *mp; 267 struct malidp_plane *mp;
269 const struct malidp_hw_regmap *map; 268 const struct malidp_hw_regmap *map;
270 struct malidp_plane_state *ms = to_malidp_plane_state(plane->state); 269 struct malidp_plane_state *ms = to_malidp_plane_state(plane->state);
271 u16 ptr;
272 u32 src_w, src_h, dest_w, dest_h, val; 270 u32 src_w, src_h, dest_w, dest_h, val;
273 int i; 271 int i;
274 272
@@ -285,12 +283,12 @@ static void malidp_de_plane_update(struct drm_plane *plane,
285 283
286 for (i = 0; i < ms->n_planes; i++) { 284 for (i = 0; i < ms->n_planes; i++) {
287 /* calculate the offset for the layer's plane registers */ 285 /* calculate the offset for the layer's plane registers */
288 ptr = mp->layer->ptr + (i << 4); 286 u16 ptr = mp->layer->ptr + (i << 4);
287 dma_addr_t fb_addr = drm_fb_cma_get_gem_addr(plane->state->fb,
288 plane->state, i);
289 289
290 obj = drm_fb_cma_get_gem_obj(plane->state->fb, i); 290 malidp_hw_write(mp->hwdev, lower_32_bits(fb_addr), ptr);
291 obj->paddr += plane->state->fb->offsets[i]; 291 malidp_hw_write(mp->hwdev, upper_32_bits(fb_addr), ptr + 4);
292 malidp_hw_write(mp->hwdev, lower_32_bits(obj->paddr), ptr);
293 malidp_hw_write(mp->hwdev, upper_32_bits(obj->paddr), ptr + 4);
294 } 292 }
295 malidp_de_set_plane_pitches(mp, ms->n_planes, 293 malidp_de_set_plane_pitches(mp, ms->n_planes,
296 plane->state->fb->pitches); 294 plane->state->fb->pitches);