[PATCH 4.14 041/217] drm/arm/malidp: Preserve LAYER_FORMAT contents when setting format
From: Greg Kroah-Hartman
Date: Thu Aug 23 2018 - 04:19:55 EST
4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ayan Kumar Halder <ayan.halder@xxxxxxx>
[ Upstream commit ad7fda2e378f4356df621a39655f7c200b495d81 ]
On some Mali-DP processors, the LAYER_FORMAT register contains fields
other than the format. These bits were unconditionally cleared when
setting the pixel format, whereas they should be preserved at their
reset values.
Reported-by: Brian Starkey <brian.starkey@xxxxxxx>
Reported-by: Liviu Dudau <liviu.dudau@xxxxxxx>
Signed-off-by: Ayan Kumar halder <ayan.halder@xxxxxxx>
Acked-by: Liviu Dudau <liviu.dudau@xxxxxxx>
Signed-off-by: Liviu Dudau <liviu.dudau@xxxxxxx>
Signed-off-by: Sasha Levin <alexander.levin@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
drivers/gpu/drm/arm/malidp_planes.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/drivers/gpu/drm/arm/malidp_planes.c
+++ b/drivers/gpu/drm/arm/malidp_planes.c
@@ -23,6 +23,7 @@
/* Layer specific register offsets */
#define MALIDP_LAYER_FORMAT 0x000
+#define LAYER_FORMAT_MASK 0x3f
#define MALIDP_LAYER_CONTROL 0x004
#define LAYER_ENABLE (1 << 0)
#define LAYER_FLOWCFG_MASK 7
@@ -278,7 +279,9 @@ static void malidp_de_plane_update(struc
dest_w = plane->state->crtc_w;
dest_h = plane->state->crtc_h;
- malidp_hw_write(mp->hwdev, ms->format, mp->layer->base);
+ val = malidp_hw_read(mp->hwdev, mp->layer->base);
+ val = (val & ~LAYER_FORMAT_MASK) | ms->format;
+ malidp_hw_write(mp->hwdev, val, mp->layer->base);
for (i = 0; i < ms->n_planes; i++) {
/* calculate the offset for the layer's plane registers */