aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2018-07-15 19:57:22 -0400
committerDave Airlie <airlied@redhat.com>2018-07-15 19:57:35 -0400
commita929b32537bc6800f7b54df56455ca942bcd3035 (patch)
tree01ce0cd1cb797647af277d1160b95d999850ce52
parent990187537be1136ccd739efa550780ca4ee1a100 (diff)
parent92298c1cd8e8a6b56322b602ad72b54e6237631d (diff)
Merge branch 'drm-armada-fixes' of git://git.armlinux.org.uk/~rmk/linux-arm into drm-fixes
Two armada fixes. Signed-off-by: Dave Airlie <airlied@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180713075427.GA16160@rmk-PC.armlinux.org.uk
-rw-r--r--drivers/gpu/drm/armada/armada_crtc.c12
-rw-r--r--drivers/gpu/drm/armada/armada_hw.h1
-rw-r--r--drivers/gpu/drm/armada/armada_overlay.c30
3 files changed, 33 insertions, 10 deletions
diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c
index 03eeee11dd5b..42a40daff132 100644
--- a/drivers/gpu/drm/armada/armada_crtc.c
+++ b/drivers/gpu/drm/armada/armada_crtc.c
@@ -519,8 +519,9 @@ static irqreturn_t armada_drm_irq(int irq, void *arg)
519 u32 v, stat = readl_relaxed(dcrtc->base + LCD_SPU_IRQ_ISR); 519 u32 v, stat = readl_relaxed(dcrtc->base + LCD_SPU_IRQ_ISR);
520 520
521 /* 521 /*
522 * This is rediculous - rather than writing bits to clear, we 522 * Reading the ISR appears to clear bits provided CLEAN_SPU_IRQ_ISR
523 * have to set the actual status register value. This is racy. 523 * is set. Writing has some other effect to acknowledge the IRQ -
524 * without this, we only get a single IRQ.
524 */ 525 */
525 writel_relaxed(0, dcrtc->base + LCD_SPU_IRQ_ISR); 526 writel_relaxed(0, dcrtc->base + LCD_SPU_IRQ_ISR);
526 527
@@ -1116,16 +1117,22 @@ armada_drm_crtc_set_property(struct drm_crtc *crtc,
1116static int armada_drm_crtc_enable_vblank(struct drm_crtc *crtc) 1117static int armada_drm_crtc_enable_vblank(struct drm_crtc *crtc)
1117{ 1118{
1118 struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc); 1119 struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc);
1120 unsigned long flags;
1119 1121
1122 spin_lock_irqsave(&dcrtc->irq_lock, flags);
1120 armada_drm_crtc_enable_irq(dcrtc, VSYNC_IRQ_ENA); 1123 armada_drm_crtc_enable_irq(dcrtc, VSYNC_IRQ_ENA);
1124 spin_unlock_irqrestore(&dcrtc->irq_lock, flags);
1121 return 0; 1125 return 0;
1122} 1126}
1123 1127
1124static void armada_drm_crtc_disable_vblank(struct drm_crtc *crtc) 1128static void armada_drm_crtc_disable_vblank(struct drm_crtc *crtc)
1125{ 1129{
1126 struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc); 1130 struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc);
1131 unsigned long flags;
1127 1132
1133 spin_lock_irqsave(&dcrtc->irq_lock, flags);
1128 armada_drm_crtc_disable_irq(dcrtc, VSYNC_IRQ_ENA); 1134 armada_drm_crtc_disable_irq(dcrtc, VSYNC_IRQ_ENA);
1135 spin_unlock_irqrestore(&dcrtc->irq_lock, flags);
1129} 1136}
1130 1137
1131static const struct drm_crtc_funcs armada_crtc_funcs = { 1138static const struct drm_crtc_funcs armada_crtc_funcs = {
@@ -1415,6 +1422,7 @@ static int armada_drm_crtc_create(struct drm_device *drm, struct device *dev,
1415 CFG_PDWN64x66, dcrtc->base + LCD_SPU_SRAM_PARA1); 1422 CFG_PDWN64x66, dcrtc->base + LCD_SPU_SRAM_PARA1);
1416 writel_relaxed(0x2032ff81, dcrtc->base + LCD_SPU_DMA_CTRL1); 1423 writel_relaxed(0x2032ff81, dcrtc->base + LCD_SPU_DMA_CTRL1);
1417 writel_relaxed(dcrtc->irq_ena, dcrtc->base + LCD_SPU_IRQ_ENA); 1424 writel_relaxed(dcrtc->irq_ena, dcrtc->base + LCD_SPU_IRQ_ENA);
1425 readl_relaxed(dcrtc->base + LCD_SPU_IRQ_ISR);
1418 writel_relaxed(0, dcrtc->base + LCD_SPU_IRQ_ISR); 1426 writel_relaxed(0, dcrtc->base + LCD_SPU_IRQ_ISR);
1419 1427
1420 ret = devm_request_irq(dev, irq, armada_drm_irq, 0, "armada_drm_crtc", 1428 ret = devm_request_irq(dev, irq, armada_drm_irq, 0, "armada_drm_crtc",
diff --git a/drivers/gpu/drm/armada/armada_hw.h b/drivers/gpu/drm/armada/armada_hw.h
index 27319a8335e2..345dc4d0851e 100644
--- a/drivers/gpu/drm/armada/armada_hw.h
+++ b/drivers/gpu/drm/armada/armada_hw.h
@@ -160,6 +160,7 @@ enum {
160 CFG_ALPHAM_GRA = 0x1 << 16, 160 CFG_ALPHAM_GRA = 0x1 << 16,
161 CFG_ALPHAM_CFG = 0x2 << 16, 161 CFG_ALPHAM_CFG = 0x2 << 16,
162 CFG_ALPHA_MASK = 0xff << 8, 162 CFG_ALPHA_MASK = 0xff << 8,
163#define CFG_ALPHA(x) ((x) << 8)
163 CFG_PIXCMD_MASK = 0xff, 164 CFG_PIXCMD_MASK = 0xff,
164}; 165};
165 166
diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c
index c391955009d6..afa7ded3ae31 100644
--- a/drivers/gpu/drm/armada/armada_overlay.c
+++ b/drivers/gpu/drm/armada/armada_overlay.c
@@ -28,6 +28,7 @@ struct armada_ovl_plane_properties {
28 uint16_t contrast; 28 uint16_t contrast;
29 uint16_t saturation; 29 uint16_t saturation;
30 uint32_t colorkey_mode; 30 uint32_t colorkey_mode;
31 uint32_t colorkey_enable;
31}; 32};
32 33
33struct armada_ovl_plane { 34struct armada_ovl_plane {
@@ -54,11 +55,13 @@ armada_ovl_update_attr(struct armada_ovl_plane_properties *prop,
54 writel_relaxed(0x00002000, dcrtc->base + LCD_SPU_CBSH_HUE); 55 writel_relaxed(0x00002000, dcrtc->base + LCD_SPU_CBSH_HUE);
55 56
56 spin_lock_irq(&dcrtc->irq_lock); 57 spin_lock_irq(&dcrtc->irq_lock);
57 armada_updatel(prop->colorkey_mode | CFG_ALPHAM_GRA, 58 armada_updatel(prop->colorkey_mode,
58 CFG_CKMODE_MASK | CFG_ALPHAM_MASK | CFG_ALPHA_MASK, 59 CFG_CKMODE_MASK | CFG_ALPHAM_MASK | CFG_ALPHA_MASK,
59 dcrtc->base + LCD_SPU_DMA_CTRL1); 60 dcrtc->base + LCD_SPU_DMA_CTRL1);
60 61 if (dcrtc->variant->has_spu_adv_reg)
61 armada_updatel(ADV_GRACOLORKEY, 0, dcrtc->base + LCD_SPU_ADV_REG); 62 armada_updatel(prop->colorkey_enable,
63 ADV_GRACOLORKEY | ADV_VIDCOLORKEY,
64 dcrtc->base + LCD_SPU_ADV_REG);
62 spin_unlock_irq(&dcrtc->irq_lock); 65 spin_unlock_irq(&dcrtc->irq_lock);
63} 66}
64 67
@@ -321,8 +324,17 @@ static int armada_ovl_plane_set_property(struct drm_plane *plane,
321 dplane->prop.colorkey_vb |= K2B(val); 324 dplane->prop.colorkey_vb |= K2B(val);
322 update_attr = true; 325 update_attr = true;
323 } else if (property == priv->colorkey_mode_prop) { 326 } else if (property == priv->colorkey_mode_prop) {
324 dplane->prop.colorkey_mode &= ~CFG_CKMODE_MASK; 327 if (val == CKMODE_DISABLE) {
325 dplane->prop.colorkey_mode |= CFG_CKMODE(val); 328 dplane->prop.colorkey_mode =
329 CFG_CKMODE(CKMODE_DISABLE) |
330 CFG_ALPHAM_CFG | CFG_ALPHA(255);
331 dplane->prop.colorkey_enable = 0;
332 } else {
333 dplane->prop.colorkey_mode =
334 CFG_CKMODE(val) |
335 CFG_ALPHAM_GRA | CFG_ALPHA(0);
336 dplane->prop.colorkey_enable = ADV_GRACOLORKEY;
337 }
326 update_attr = true; 338 update_attr = true;
327 } else if (property == priv->brightness_prop) { 339 } else if (property == priv->brightness_prop) {
328 dplane->prop.brightness = val - 256; 340 dplane->prop.brightness = val - 256;
@@ -453,7 +465,9 @@ int armada_overlay_plane_create(struct drm_device *dev, unsigned long crtcs)
453 dplane->prop.colorkey_yr = 0xfefefe00; 465 dplane->prop.colorkey_yr = 0xfefefe00;
454 dplane->prop.colorkey_ug = 0x01010100; 466 dplane->prop.colorkey_ug = 0x01010100;
455 dplane->prop.colorkey_vb = 0x01010100; 467 dplane->prop.colorkey_vb = 0x01010100;
456 dplane->prop.colorkey_mode = CFG_CKMODE(CKMODE_RGB); 468 dplane->prop.colorkey_mode = CFG_CKMODE(CKMODE_RGB) |
469 CFG_ALPHAM_GRA | CFG_ALPHA(0);
470 dplane->prop.colorkey_enable = ADV_GRACOLORKEY;
457 dplane->prop.brightness = 0; 471 dplane->prop.brightness = 0;
458 dplane->prop.contrast = 0x4000; 472 dplane->prop.contrast = 0x4000;
459 dplane->prop.saturation = 0x4000; 473 dplane->prop.saturation = 0x4000;