MLK-16075-1 gpu: imx: dpu: fetchdecode: Update funcs to enable/disable src buf
authorLiu Ying <victor.liu@nxp.com>
Mon, 24 Jul 2017 05:26:19 +0000 (13:26 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:33:48 +0000 (15:33 -0500)
The bit to enable/disable source buffer is embedded in the register
LAYERPORPERTY0.  However, the other bits of the register may have
other functionalities.  So, using fetchdecode_layerproperty() to
enable/disable source buffer isn't appropriate.  This patch uses
new functions to enable/disable fetchdecode source buffer so that
the function names could be a bit specific about what they are doing.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
drivers/gpu/drm/imx/dpu/dpu-crtc.c
drivers/gpu/drm/imx/dpu/dpu-plane.c
drivers/gpu/imx/dpu/dpu-fetchdecode.c
include/video/dpu.h

index 7277ef1..6ab102b 100644 (file)
@@ -276,7 +276,7 @@ static void dpu_crtc_atomic_begin(struct drm_crtc *crtc,
                vs = fetchdecode_get_vscaler(fd);
 
                layerblend_pixengcfg_clken(lb, CLKEN__DISABLE);
-               fetchdecode_layerproperty(fd, false);
+               fetchdecode_source_buffer_disable(fd);
                hscaler_pixengcfg_clken(hs, CLKEN__DISABLE);
                vscaler_pixengcfg_clken(vs, CLKEN__DISABLE);
                hscaler_mode(hs, SCALER_NEUTRAL);
index 7b2729c..731b1f4 100644 (file)
@@ -270,7 +270,7 @@ static void dpu_plane_atomic_update(struct drm_plane *plane,
        fetchdecode_source_stride(fd, fb->pitches[0]);
        fetchdecode_src_buf_dimensions(fd, src_w, src_h);
        fetchdecode_set_fmt(fd, fb->pixel_format);
-       fetchdecode_layerproperty(fd, true);
+       fetchdecode_source_buffer_enable(fd);
        fetchdecode_framedimensions(fd, src_w, src_h);
        fetchdecode_baseaddress(fd, drm_plane_state_to_baseaddr(state));
        fetchdecode_set_stream_id(fd, dplane->stream_id ?
index 533427b..7b0ebe9 100644 (file)
@@ -261,20 +261,29 @@ void fetchdecode_clipoffset(struct dpu_fetchdecode *fd, unsigned int x,
 }
 EXPORT_SYMBOL_GPL(fetchdecode_clipoffset);
 
-void fetchdecode_layerproperty(struct dpu_fetchdecode *fd, bool enable)
+void fetchdecode_source_buffer_enable(struct dpu_fetchdecode *fd)
 {
        u32 val;
 
-       if (enable)
-               val = SOURCEBUFFERENABLE;
-       else
-               val = 0;
+       mutex_lock(&fd->mutex);
+       val = dpu_fd_read(fd, LAYERPROPERTY0);
+       val |= SOURCEBUFFERENABLE;
+       dpu_fd_write(fd, val, LAYERPROPERTY0);
+       mutex_unlock(&fd->mutex);
+}
+EXPORT_SYMBOL_GPL(fetchdecode_source_buffer_enable);
+
+void fetchdecode_source_buffer_disable(struct dpu_fetchdecode *fd)
+{
+       u32 val;
 
        mutex_lock(&fd->mutex);
+       val = dpu_fd_read(fd, LAYERPROPERTY0);
+       val &= ~SOURCEBUFFERENABLE;
        dpu_fd_write(fd, val, LAYERPROPERTY0);
        mutex_unlock(&fd->mutex);
 }
-EXPORT_SYMBOL_GPL(fetchdecode_layerproperty);
+EXPORT_SYMBOL_GPL(fetchdecode_source_buffer_disable);
 
 bool fetchdecode_is_enabled(struct dpu_fetchdecode *fd)
 {
index 45d7668..cc9adcd 100644 (file)
@@ -481,7 +481,8 @@ void fetchdecode_clipoffset(struct dpu_fetchdecode *fd, unsigned int x,
                            unsigned int y);
 void fetchdecode_clipdimensions(struct dpu_fetchdecode *fd, unsigned int w,
                                unsigned int h);
-void fetchdecode_layerproperty(struct dpu_fetchdecode *fd, bool enable);
+void fetchdecode_source_buffer_enable(struct dpu_fetchdecode *fd);
+void fetchdecode_source_buffer_disable(struct dpu_fetchdecode *fd);
 bool fetchdecode_is_enabled(struct dpu_fetchdecode *fd);
 void fetchdecode_framedimensions(struct dpu_fetchdecode *fd, unsigned int w,
                                 unsigned int h);