[PATCH v1 18/21] drm/mediatek: add dither bypass shadow register function

From: Yongqiang Niu
Date: Thu Aug 20 2020 - 02:06:20 EST


add dither bypass shadow register function

Signed-off-by: Yongqiang Niu <yongqiang.niu@xxxxxxxxxxxx>
---
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
index 0c81253..315bd3a 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
@@ -23,6 +23,9 @@
#define DISP_OD_INTSTA 0x000c
#define DISP_OD_CFG 0x0020
#define DISP_OD_SIZE 0x0030
+
+#define DITHER_REG(idx) (0x100 + (idx) * 4)
+#define DITHER_BYPASS_SHADOW BIT(0)
#define DISP_DITHER_5 0x0114
#define DISP_DITHER_7 0x011c
#define DISP_DITHER_15 0x013c
@@ -291,6 +294,13 @@ static void mtk_dither_stop(struct mtk_ddp_comp *comp)
writel_relaxed(0x0, comp->regs + DISP_DITHER_EN);
}

+static void mtk_dither_bypass_shadow(struct mtk_ddp_comp *comp)
+{
+ mtk_ddp_write_mask(NULL, DITHER_BYPASS_SHADOW, comp,
+ DITHER_REG(0),
+ DITHER_BYPASS_SHADOW);
+}
+
static void mtk_gamma_config(struct mtk_ddp_comp *comp, unsigned int w,
unsigned int h, unsigned int vrefresh,
unsigned int bpc, struct cmdq_pkt *cmdq_pkt)
@@ -368,6 +378,7 @@ static void mtk_postmask_stop(struct mtk_ddp_comp *comp)
.config = mtk_dither_config,
.start = mtk_dither_start,
.stop = mtk_dither_stop,
+ .bypass_shadow = mtk_dither_bypass_shadow,
};

static const struct mtk_ddp_comp_funcs ddp_gamma = {
--
1.8.1.1.dirty