MLK-16772 gpu: imx: dpu: cf: Add safety_stream_cf_color module parameter support
authorLiu Ying <victor.liu@nxp.com>
Mon, 6 Nov 2017 02:35:46 +0000 (10:35 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:39:08 +0000 (15:39 -0500)
This patch adds safety_stream_cf_color module parameter support so that
users may set the default color generated by the constframe units(4 and 5)
of safety streams.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
drivers/gpu/drm/imx/dpu/dpu-crtc.c
drivers/gpu/imx/dpu/dpu-constframe.c

index 6520fe2..eb43058 100644 (file)
@@ -453,7 +453,6 @@ static void dpu_crtc_mode_set_nofb(struct drm_crtc *crtc)
        constframe_framedimensions(dpu_crtc->cf,
                                        mode->crtc_hdisplay,
                                        mode->crtc_vdisplay);
-       constframe_constantcolor(dpu_crtc->cf, 0, 0, 0, 0);
 
        ed_src = dpu_crtc->stream_id ? ED_SRC_CONSTFRAME5 : ED_SRC_CONSTFRAME4;
        extdst_pixengcfg_src_sel(dpu_crtc->ed, ed_src);
index 1290545..d014830 100644 (file)
 #include <video/dpu.h>
 #include "dpu-prv.h"
 
+static unsigned int safety_stream_cf_color = 0x0;
+module_param(safety_stream_cf_color, uint, 0444);
+MODULE_PARM_DESC(safety_stream_cf_color,
+"Safety stream constframe color in hex(0xRRGGBBAA) [default=0x00000000]");
+
 #define FRAMEDIMENSIONS                0xC
 #define WIDTH(w)               (((w) - 1) & 0x3FFF)
 #define HEIGHT(h)              ((((h) - 1) & 0x3FFF) << 16)
@@ -168,6 +173,7 @@ EXPORT_SYMBOL_GPL(dpu_cf_put);
 
 void _dpu_cf_init(struct dpu_soc *dpu, unsigned int id)
 {
+       struct dpu_constframe *cf;
        int i;
 
        for (i = 0; i < ARRAY_SIZE(cf_ids); i++)
@@ -177,7 +183,15 @@ void _dpu_cf_init(struct dpu_soc *dpu, unsigned int id)
        if (WARN_ON(i == ARRAY_SIZE(cf_ids)))
                return;
 
-       constframe_shden(dpu->cf_priv[i], true);
+       cf = dpu->cf_priv[i];
+
+       constframe_shden(cf, true);
+
+       if (id == 4 || id == 5) {
+               mutex_lock(&cf->mutex);
+               dpu_cf_write(cf, safety_stream_cf_color, CONSTANTCOLOR);
+               mutex_unlock(&cf->mutex);
+       }
 }
 
 int dpu_cf_init(struct dpu_soc *dpu, unsigned int id,