Skip to contentSkip to conversation

DRM driver for Hikey 970

PATCH In review Mauro Carvalho Chehab 11 participants 105 messages Aug 19, 2020 – Aug 26, 2020 Page 3 of 3

Subsystems (11)
lore
Share & tools
lore
#85 lore raw
In reply to Mauro Carvalho Chehab

Hi Mauro.

It seems my review comments failed to reach dri-devel - likely due to the size of the mail.
Link:
https://lore.kernel.org/linux-devicetree/[email protected]/

I my review feedback I refer to checkpatch a few time. For drivers/gpu/ we have some nice tooling support.
One thing our tooling does for us is running checkpatch every time we apply a patch.

    checkpatch -q --emacs --strict --show-types

So we expect patches to be more or less checkpatch --strict clean.

"more or less" - as common sense also plays a role. And sometimes checkpatch is just wrong.

Just in case you wondered why checkpatch --strict was requested.

Sam

Quoted 11,597 lines

+++ b/drivers/staging/hikey9xx/Kconfig

drivers/staging/hikey9xx/Kconfig +3 -0
@@ -36,3 +36,6 @@ config REGULATOR_HI6421V600
 	  This driver provides support for the voltage regulators on
 	  HiSilicon Hi6421v600 PMU / Codec IC.
 	  This is used on Kirin 3670 boards, like HiKey 970.
+
+# DRM/KMS driver
+source "drivers/staging/hikey9xx/gpu/Kconfig"
drivers/staging/hikey9xx/Makefile +1 -0
index 9371dcc3d35b..1a848d398ab6 100644
@@ -3,3 +3,4 @@
 obj-$(CONFIG_SPMI_HISI3670)		+= hisi-spmi-controller.o
 obj-$(CONFIG_MFD_HI6421_SPMI)		+= hi6421-spmi-pmic.o
 obj-$(CONFIG_REGULATOR_HI6421V600)	+= hi6421v600-regulator.o
+obj-y					+= gpu/
drivers/staging/hikey9xx/gpu/Kconfig new file +22 -0
new file mode 100644
index 000000000000..957da13bcf81
@@ -0,0 +1,22 @@
+config DRM_HISI_KIRIN9XX
+	tristate "DRM Support for Hisilicon Kirin9xx series SoCs Platform"
+	depends on DRM && OF && ARM64
+	select DRM_KMS_HELPER
+	select DRM_GEM_CMA_HELPER
+	select DRM_KMS_CMA_HELPER
+	select DRM_MIPI_DSI
+	help
+	  Choose this option if you have a HiSilicon Kirin960 or Kirin970.
+	  If M is selected the module will be called kirin9xx-drm.
+
+config DRM_HISI_KIRIN970
+	bool "Enable support for Hisilicon Kirin970"
+	depends on DRM_MIPI_DSI
+	depends on DRM_HISI_KIRIN9XX
+	help
+	  Choose this option if you have a hisilicon Kirin chipsets(kirin970).
+
+config DRM_HISI_KIRIN9XX_DSI
+	tristate
+	depends on DRM_HISI_KIRIN9XX
+	default y
drivers/staging/hikey9xx/gpu/Makefile new file +9 -0
new file mode 100644
index 000000000000..9177c3006b14
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0-only
+kirin9xx-drm-y := kirin9xx_drm_drv.o \
+		  kirin9xx_drm_dss.o \
+		  kirin9xx_drm_dpe_utils.o \
+		  kirin970_defs.o kirin960_defs.o \
+		  kirin9xx_drm_overlay_utils.o
+
+obj-$(CONFIG_DRM_HISI_KIRIN9XX) += kirin9xx-drm.o kirin9xx_pwm.o
+obj-$(CONFIG_DRM_HISI_KIRIN9XX_DSI) += kirin9xx_dw_drm_dsi.o
drivers/staging/hikey9xx/gpu/kirin960_defs.c new file +378 -0
new file mode 100644
index 000000000000..720f4f80a518
@@ -0,0 +1,378 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2008-2011, Hisilicon Tech. Co., Ltd. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <drm/drm_atomic.h>
+#include <drm/drm_atomic_helper.h>
+#include <drm/drm_crtc.h>
+#include <drm/drm_crtc_helper.h>
+#include <drm/drm_drv.h>
+#include <drm/drm_fb_cma_helper.h>
+#include <drm/drm_fourcc.h>
+#include <drm/drm_gem_cma_helper.h>
+#include <drm/drm_plane_helper.h>
+
+#include "kirin9xx_drm_dpe_utils.h"
+#include "kirin9xx_drm_drv.h"
+#include "kirin960_dpe_reg.h"
+
+/*
+ * dss_chn_idx
+ * DSS_RCHN_D2 = 0,	DSS_RCHN_D3,	DSS_RCHN_V0,	DSS_RCHN_G0,	DSS_RCHN_V1,
+ * DSS_RCHN_G1,	DSS_RCHN_D0,	DSS_RCHN_D1,	DSS_WCHN_W0,	DSS_WCHN_W1,
+ * DSS_RCHN_V2,   DSS_WCHN_W2,
+ */
+static const u32 kirin960_g_dss_module_base[DSS_CHN_MAX_DEFINE][MODULE_CHN_MAX] = {
+	/* D0 */
+	{
+	MIF_CH0_OFFSET,
+	AIF0_CH0_OFFSET,
+	AIF1_CH0_OFFSET,
+	MCTL_CTL_MUTEX_RCH0,
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH0_FLUSH_EN,
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH0_OV_OEN,
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH0_STARTY,
+	DSS_MCTRL_SYS_OFFSET + MCTL_MOD0_DBG,
+	DSS_RCH_D0_DMA_OFFSET,
+	DSS_RCH_D0_DFC_OFFSET,
+	0,
+	0,
+	0,
+	0,
+	0,
+	0,
+	DSS_RCH_D0_CSC_OFFSET,
+	},
+
+	/* D1 */
+	{
+	MIF_CH1_OFFSET,
+	AIF0_CH1_OFFSET,
+	AIF1_CH1_OFFSET,
+	MCTL_CTL_MUTEX_RCH1,
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH1_FLUSH_EN,
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH1_OV_OEN,
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH1_STARTY,
+	DSS_MCTRL_SYS_OFFSET + MCTL_MOD1_DBG,
+	DSS_RCH_D1_DMA_OFFSET,
+	DSS_RCH_D1_DFC_OFFSET,
+	0,
+	0,
+	0,
+	0,
+	0,
+	0,
+	DSS_RCH_D1_CSC_OFFSET,
+	},
+
+	/* V0 */
+	{
+	MIF_CH2_OFFSET,
+	AIF0_CH2_OFFSET,
+	AIF1_CH2_OFFSET,
+	MCTL_CTL_MUTEX_RCH2,
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH2_FLUSH_EN,
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH2_OV_OEN,
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH2_STARTY,
+	DSS_MCTRL_SYS_OFFSET + MCTL_MOD2_DBG,
+	DSS_RCH_VG0_DMA_OFFSET,
+	DSS_RCH_VG0_DFC_OFFSET,
+	DSS_RCH_VG0_SCL_OFFSET,
+	DSS_RCH_VG0_SCL_LUT_OFFSET,
+	DSS_RCH_VG0_ARSR_OFFSET,
+	DSS_RCH_VG0_ARSR_LUT_OFFSET,
+	DSS_RCH_VG0_POST_CLIP_OFFSET,
+	DSS_RCH_VG0_PCSC_OFFSET,
+	DSS_RCH_VG0_CSC_OFFSET,
+	},
+
+	/* G0 */
+	{
+	MIF_CH3_OFFSET,
+	AIF0_CH3_OFFSET,
+	AIF1_CH3_OFFSET,
+	MCTL_CTL_MUTEX_RCH3,
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH3_FLUSH_EN,
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH3_OV_OEN,
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH3_STARTY,
+	DSS_MCTRL_SYS_OFFSET + MCTL_MOD3_DBG,
+	DSS_RCH_G0_DMA_OFFSET,
+	DSS_RCH_G0_DFC_OFFSET,
+	DSS_RCH_G0_SCL_OFFSET,
+	0,
+	0,
+	0,
+	DSS_RCH_G0_POST_CLIP_OFFSET,
+	0,
+	DSS_RCH_G0_CSC_OFFSET,
+	},
+
+	/* V1 */
+	{
+	MIF_CH4_OFFSET,
+	AIF0_CH4_OFFSET,
+	AIF1_CH4_OFFSET,
+	MCTL_CTL_MUTEX_RCH4,
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH4_FLUSH_EN,
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH4_OV_OEN,
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH4_STARTY,
+	DSS_MCTRL_SYS_OFFSET + MCTL_MOD4_DBG,
+	DSS_RCH_VG1_DMA_OFFSET,
+	DSS_RCH_VG1_DFC_OFFSET,
+	DSS_RCH_VG1_SCL_OFFSET,
+	DSS_RCH_VG1_SCL_LUT_OFFSET,
+	0,
+	0,
+	DSS_RCH_VG1_POST_CLIP_OFFSET,
+	0,
+	DSS_RCH_VG1_CSC_OFFSET,
+	},
+
+	/* G1 */
+	{
+	MIF_CH5_OFFSET,
+	AIF0_CH5_OFFSET,
+	AIF1_CH5_OFFSET,
+	MCTL_CTL_MUTEX_RCH5,
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH5_FLUSH_EN,
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH5_OV_OEN,
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH5_STARTY,
+	DSS_MCTRL_SYS_OFFSET + MCTL_MOD5_DBG,
+	DSS_RCH_G1_DMA_OFFSET,
+	DSS_RCH_G1_DFC_OFFSET,
+	DSS_RCH_G1_SCL_OFFSET,
+	0,
+	0,
+	0,
+	DSS_RCH_G1_POST_CLIP_OFFSET,
+	0,
+	DSS_RCH_G1_CSC_OFFSET,
+	},
+
+	/* D2 */
+	{
+	MIF_CH6_OFFSET,
+	AIF0_CH6_OFFSET,
+	AIF1_CH6_OFFSET,
+	MCTL_CTL_MUTEX_RCH6,
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH6_FLUSH_EN,
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH6_OV_OEN,
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH6_STARTY,
+	DSS_MCTRL_SYS_OFFSET + MCTL_MOD6_DBG,
+	DSS_RCH_D2_DMA_OFFSET,
+	DSS_RCH_D2_DFC_OFFSET,
+	0,
+	0,
+	0,
+	0,
+	0,
+	0,
+	DSS_RCH_D2_CSC_OFFSET,
+	},
+
+	/* D3 */
+	{
+	MIF_CH7_OFFSET,
+	AIF0_CH7_OFFSET,
+	AIF1_CH7_OFFSET,
+	MCTL_CTL_MUTEX_RCH7,
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH7_FLUSH_EN,
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH7_OV_OEN,
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH7_STARTY,
+	DSS_MCTRL_SYS_OFFSET + MCTL_MOD7_DBG,
+	DSS_RCH_D3_DMA_OFFSET,
+	DSS_RCH_D3_DFC_OFFSET,
+	0,
+	0,
+	0,
+	0,
+	0,
+	0,
+	DSS_RCH_D3_CSC_OFFSET,
+	},
+
+	/* W0 */
+	{
+	MIF_CH8_OFFSET,
+	AIF0_CH8_OFFSET,
+	AIF1_CH8_OFFSET,
+	MCTL_CTL_MUTEX_WCH0,
+	DSS_MCTRL_SYS_OFFSET + MCTL_WCH0_FLUSH_EN,
+	DSS_MCTRL_SYS_OFFSET + MCTL_WCH0_OV_IEN,
+	0,
+	0,
+	DSS_WCH0_DMA_OFFSET,
+	DSS_WCH0_DFC_OFFSET,
+	0,
+	0,
+	0,
+	0,
+	0,
+	0,
+	DSS_WCH0_CSC_OFFSET,
+	},
+
+	/* W1 */
+	{
+	MIF_CH9_OFFSET,
+	AIF0_CH9_OFFSET,
+	AIF1_CH9_OFFSET,
+	MCTL_CTL_MUTEX_WCH1,
+	DSS_MCTRL_SYS_OFFSET + MCTL_WCH1_FLUSH_EN,
+	DSS_MCTRL_SYS_OFFSET + MCTL_WCH1_OV_IEN,
+	0,
+	0,
+	DSS_WCH1_DMA_OFFSET,
+	DSS_WCH1_DFC_OFFSET,
+	0,
+	0,
+	0,
+	0,
+	0,
+	0,
+	DSS_WCH1_CSC_OFFSET,
+	},
+	/* V2 */
+	{
+	MIF_CH10_OFFSET,
+	AIF0_CH11_OFFSET,
+	AIF1_CH11_OFFSET,
+	MCTL_CTL_MUTEX_RCH8,
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH8_FLUSH_EN,
+	0,
+	0,
+	DSS_MCTRL_SYS_OFFSET + MCTL_MOD8_DBG,
+	DSS_RCH_VG2_DMA_OFFSET,
+	DSS_RCH_VG2_DFC_OFFSET,
+	DSS_RCH_VG2_SCL_OFFSET,
+	DSS_RCH_VG2_SCL_LUT_OFFSET,
+	0,
+	0,
+	DSS_RCH_VG2_POST_CLIP_OFFSET,
+	0,
+	DSS_RCH_VG2_CSC_OFFSET,
+	},
+	/* W2 */
+	{
+	MIF_CH11_OFFSET,
+	AIF0_CH12_OFFSET,
+	AIF1_CH12_OFFSET,
+	MCTL_CTL_MUTEX_WCH2,
+	DSS_MCTRL_SYS_OFFSET + MCTL_WCH2_FLUSH_EN,
+	0,
+	0,
+	0,
+	DSS_WCH2_DMA_OFFSET,
+	DSS_WCH2_DFC_OFFSET,
+	0,
+	0,
+	0,
+	0,
+	0,
+	0,
+	DSS_WCH2_CSC_OFFSET,
+	},
+};
+
+static const u32 kirin960_g_dss_module_ovl_base[DSS_MCTL_IDX_MAX][MODULE_OVL_MAX] = {
+	{DSS_OVL0_OFFSET,
+	DSS_MCTRL_CTL0_OFFSET},
+
+	{DSS_OVL1_OFFSET,
+	DSS_MCTRL_CTL1_OFFSET},
+
+	{DSS_OVL2_OFFSET,
+	DSS_MCTRL_CTL2_OFFSET},
+
+	{DSS_OVL3_OFFSET,
+	DSS_MCTRL_CTL3_OFFSET},
+
+	{0,
+	DSS_MCTRL_CTL4_OFFSET},
+
+	{0,
+	DSS_MCTRL_CTL5_OFFSET},
+};
+
+/*SCF_LUT_CHN coef_idx*/
+static const int kirin960_g_scf_lut_chn_coef_idx[DSS_CHN_MAX_DEFINE] = {
+	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+};
+
+static const u32 kirin960_g_dss_module_cap[DSS_CHN_MAX_DEFINE][MODULE_CAP_MAX] = {
+	/* D2 */
+	{0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1},
+	/* D3 */
+	{0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1},
+	/* V0 */
+	{0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1},
+	/* G0 */
+	{0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0},
+	/* V1 */
+	{0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1},
+	/* G1 */
+	{0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0},
+	/* D0 */
+	{0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1},
+	/* D1 */
+	{0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1},
+
+	/* W0 */
+	{1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1},
+	/* W1 */
+	{1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1},
+
+	/* V2 */
+	{0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1},
+	/* W2 */
+	{1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1},
+};
+
+/* number of smrx idx for each channel */
+static const u32 kirin960_g_dss_chn_sid_num[DSS_CHN_MAX_DEFINE] = {
+	4, 1, 4, 4, 4, 4, 1, 1, 3, 3, 3, 2
+};
+
+/* start idx of each channel */
+/* smrx_idx = g_dss_smmu_smrx_idx[chn_idx] + (0 ~ g_dss_chn_sid_num[chn_idx]) */
+static const u32 kirin960_g_dss_smmu_smrx_idx[DSS_CHN_MAX_DEFINE] = {
+	0, 4, 5, 9, 13, 17, 21, 22, 26, 29, 23, 32
+};
+
+static const u32 kirin960_g_dss_mif_sid_map[DSS_CHN_MAX] = {
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+void kirin960_dpe_defs(struct dss_hw_ctx *ctx)
+{
+	memcpy(&ctx->g_dss_module_base, &kirin960_g_dss_module_base,
+		sizeof(kirin960_g_dss_module_base));
+	memcpy(&ctx->g_dss_module_ovl_base, &kirin960_g_dss_module_ovl_base,
+		sizeof(kirin960_g_dss_module_ovl_base));
+	memcpy(&ctx->g_scf_lut_chn_coef_idx, &kirin960_g_scf_lut_chn_coef_idx,
+		sizeof(kirin960_g_scf_lut_chn_coef_idx));
+	memcpy(&ctx->g_dss_module_cap, &kirin960_g_dss_module_cap,
+		sizeof(kirin960_g_dss_module_cap));
+	memcpy(&ctx->g_dss_chn_sid_num, &kirin960_g_dss_chn_sid_num,
+		sizeof(kirin960_g_dss_chn_sid_num));
+	memcpy(&ctx->g_dss_smmu_smrx_idx, &kirin960_g_dss_smmu_smrx_idx,
+		sizeof(kirin960_g_dss_smmu_smrx_idx));
+
+	ctx->smmu_offset = DSS_SMMU_OFFSET;
+	ctx->afbc_header_addr_align = AFBC_HEADER_ADDR_ALIGN;
+	ctx->dss_mmbuf_clk_rate_power_off = DEFAULT_DSS_MMBUF_CLK_RATE_POWER_OFF;
+	ctx->rot_mem_ctrl = ROT_MEM_CTRL;
+	ctx->dither_mem_ctrl = DITHER_MEM_CTRL;
+	ctx->arsr2p_lb_mem_ctrl = ARSR2P_LB_MEM_CTRL;
+	ctx->pxl0_clk_rate_power_off = DEFAULT_DSS_PXL0_CLK_RATE_POWER_OFF;
+}
drivers/staging/hikey9xx/gpu/kirin960_dpe_reg.h new file +233 -0
new file mode 100644
index 000000000000..895952762e5c
@@ -0,0 +1,233 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2016 Linaro Limited.
+ * Copyright (c) 2014-2016 Hisilicon Limited.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#ifndef __KIRIN960_DPE_REG_H__
+#define __KIRIN960_DPE_REG_H__
+
+#include "kirin9xx_dpe.h"
+
+#define CRGPERI_PLL0_CLK_RATE	(1600000000UL)
+#define CRGPERI_PLL2_CLK_RATE	(960000000UL)
+#define CRGPERI_PLL3_CLK_RATE	(1600000000UL)
+
+/*dss clk power off */
+#define DEFAULT_DSS_PXL0_CLK_RATE_POWER_OFF	(277000000UL)
+#define DEFAULT_DSS_MMBUF_CLK_RATE_POWER_OFF	(238000000UL)
+
+/*****************************************************************************/
+
+#define SCPWREN	(0x0D0)
+#define SCPEREN1 (0x040)
+#define SCPERDIS1  (0x044)
+#define SCPERRSTDIS1	(0x090)
+#define SCISODIS	(0x0C4)
+
+/*****************************************************************************/
+
+/* MODULE BASE ADDRESS */
+
+#define DSS_SMMU_OFFSET	(0x8000)
+
+#define DSS_RCH_VG0_POST_CLIP_OFFSET	(0x203A0)
+
+#define DSS_RCH_VG1_POST_CLIP_OFFSET	(0x283A0)
+
+#define DSS_RCH_VG2_POST_CLIP_OFFSET	(0x303A0)
+#define DSS_RCH_VG2_AFBCD_OFFSET	(0x30900)
+
+#define DSS_RCH_G0_POST_CLIP_OFFSET (0x383A0)
+
+#define DSS_RCH_G1_POST_CLIP_OFFSET (0x403A0)
+
+#define DSS_RCH_D2_AFBCD_OFFSET	(0x50900)
+
+#define DSS_RCH_D3_AFBCD_OFFSET	(0x51900)
+
+#define DSS_RCH_D1_AFBCD_OFFSET	(0x53900)
+
+#define DSS_WCH0_ROT_OFFSET	(0x5A500)
+
+#define DSS_WCH1_ROT_OFFSET	(0x5C500)
+
+#define DSS_DPP_DEGAMA_OFFSET	(0x70500)
+#define DSS_DPP_LCP_OFFSET	(0x70900)
+#define DSS_DPP_ARSR1P_OFFSET	(0x70A00)
+#define DSS_DPP_BITEXT0_OFFSET	(0x70B00)
+#define DSS_DPP_LCP_LUT_OFFSET	(0x73000)
+#define DSS_DPP_ARSR1P_LUT_OFFSET	(0x7B000)
+
+#define DSS_POST_SCF_OFFSET	DSS_DPP_ARSR1P_OFFSET
+#define DSS_POST_SCF_LUT_OFFSET	DSS_DPP_ARSR1P_LUT_OFFSET
+
+/* AIF */
+#define AIF0_CH0_ADD_OFFSET	(DSS_VBIF0_AIF + 0x04)
+#define AIF0_CH1_ADD_OFFSET	(DSS_VBIF0_AIF + 0x24)
+#define AIF0_CH2_ADD_OFFSET	(DSS_VBIF0_AIF + 0x44)
+#define AIF0_CH3_ADD_OFFSET	(DSS_VBIF0_AIF + 0x64)
+#define AIF0_CH4_ADD_OFFSET	(DSS_VBIF0_AIF + 0x84)
+#define AIF0_CH5_ADD_OFFSET	(DSS_VBIF0_AIF + 0xa4)
+#define AIF0_CH6_ADD_OFFSET	(DSS_VBIF0_AIF + 0xc4)
+#define AIF0_CH7_ADD_OFFSET	(DSS_VBIF0_AIF + 0xe4)
+#define AIF0_CH8_ADD_OFFSET	(DSS_VBIF0_AIF + 0x104)
+#define AIF0_CH9_ADD_OFFSET	(DSS_VBIF0_AIF + 0x124)
+#define AIF0_CH10_ADD_OFFSET	(DSS_VBIF0_AIF + 0x144)
+#define AIF0_CH11_ADD_OFFSET	(DSS_VBIF0_AIF + 0x164)
+#define AIF0_CH12_ADD_OFFSET	(DSS_VBIF0_AIF + 0x184)
+
+#define AIF1_CH0_ADD_OFFSET	(DSS_VBIF1_AIF + 0x04)
+#define AIF1_CH1_ADD_OFFSET	(DSS_VBIF1_AIF + 0x24)
+#define AIF1_CH2_ADD_OFFSET	(DSS_VBIF1_AIF + 0x44)
+#define AIF1_CH3_ADD_OFFSET	(DSS_VBIF1_AIF + 0x64)
+#define AIF1_CH4_ADD_OFFSET	(DSS_VBIF1_AIF + 0x84)
+#define AIF1_CH5_ADD_OFFSET	(DSS_VBIF1_AIF + 0xa4)
+#define AIF1_CH6_ADD_OFFSET	(DSS_VBIF1_AIF + 0xc4)
+#define AIF1_CH7_ADD_OFFSET	(DSS_VBIF1_AIF + 0xe4)
+#define AIF1_CH8_ADD_OFFSET	(DSS_VBIF1_AIF + 0x104)
+#define AIF1_CH9_ADD_OFFSET	(DSS_VBIF1_AIF + 0x124)
+#define AIF1_CH10_ADD_OFFSET	(DSS_VBIF1_AIF + 0x144)
+#define AIF1_CH11_ADD_OFFSET	(DSS_VBIF1_AIF + 0x164)
+#define AIF1_CH12_ADD_OFFSET	(DSS_VBIF1_AIF + 0x184)
+
+/* DFC */
+#define DFC_GLB_ALPHA	(0x0008)
+
+/* ARSR2P v0 */
+#define ARSR2P_IHRIGHT		(0x00C)
+#define ARSR2P_IVTOP		(0x010)
+#define ARSR2P_IVBOTTOM		(0x014)
+#define ARSR2P_IHINC		(0x018)
+#define ARSR2P_IVINC		(0x01C)
+#define ARSR2P_UV_OFFSET		(0x020)
+#define ARSR2P_MODE		(0x024)
+#define ARSR2P_SKIN_THRES_Y		(0x028)
+#define ARSR2P_SKIN_THRES_U		(0x02C)
+#define ARSR2P_SKIN_THRES_V		(0x030)
+#define ARSR2P_SKIN_CFG0		(0x034)
+#define ARSR2P_SKIN_CFG1		(0x038)
+#define ARSR2P_SKIN_CFG2		(0x03C)
+#define ARSR2P_SHOOT_CFG1		(0x040)
+#define ARSR2P_SHOOT_CFG2		(0x044)
+#define ARSR2P_SHARP_CFG1		(0x048)
+#define ARSR2P_SHARP_CFG2		(0x04C)
+#define ARSR2P_SHARP_CFG3		(0x050)
+#define ARSR2P_SHARP_CFG4		(0x054)
+#define ARSR2P_SHARP_CFG5		(0x058)
+#define ARSR2P_SHARP_CFG6		(0x05C)
+#define ARSR2P_SHARP_CFG7		(0x060)
+#define ARSR2P_SHARP_CFG8		(0x064)
+#define ARSR2P_SHARP_CFG9		(0x068)
+#define ARSR2P_TEXTURW_ANALYSTS		(0x06C)
+#define ARSR2P_INTPLSHOOTCTRL		(0x070)
+#define ARSR2P_DEBUG0		(0x074)
+#define ARSR2P_DEBUG1		(0x078)
+#define ARSR2P_DEBUG2		(0x07C)
+#define ARSR2P_DEBUG3		(0x080)
+#define ARSR2P_LB_MEM_CTRL		(0x084)
+#define ARSR2P_IHLEFT1		(0x088)
+#define ARSR2P_IHRIGHT1		(0x090)
+#define ARSR2P_IVBOTTOM1		(0x094)
+
+/* POST_CLIP  v g */
+#define POST_CLIP_CTL_HRZ	(0x0010)
+#define POST_CLIP_CTL_VRZ	(0x0014)
+#define POST_CLIP_EN	(0x0018)
+
+/* CSC */
+
+#define CSC_ICG_MODULE	(0x0024)
+
+/* DMA BUF */
+
+#define AFBCE_HREG_HDR_PTR_LO	(0x908)
+#define AFBCE_HREG_PLD_PTR_LO	(0x90C)
+
+#define ROT_MEM_CTRL		(0x538)
+#define ROT_SIZE	(0x53C)
+
+/* DMA aligned limited:  128bits aligned */
+
+#define AFBC_HEADER_ADDR_ALIGN	(64)
+#define AFBC_HEADER_STRIDE_ALIGN	(64)
+
+/* DPP */
+
+#define DITHER_PARA (0x000)
+#define DITHER_CTL (0x004)
+#define DITHER_MATRIX_PART1 (0x008)
+#define DITHER_MATRIX_PART0 (0x00C)
+#define DITHER_ERRDIFF_WEIGHT (0x010)
+#define DITHER_FRC_01_PART1 (0x014)
+#define DITHER_FRC_01_PART0 (0x018)
+#define DITHER_FRC_10_PART1 (0x01C)
+#define DITHER_FRC_10_PART0 (0x020)
+#define DITHER_FRC_11_PART1 (0x024)
+#define DITHER_FRC_11_PART0 (0x028)
+#define DITHER_MEM_CTRL (0x02C)
+#define DITHER_DBG0 (0x030)
+#define DITHER_DBG1 (0x034)
+#define DITHER_DBG2 (0x038)
+
+#define LCP_GMP_BYPASS_EN	(0x030)
+#define LCP_XCC_BYPASS_EN	(0x034)
+#define LCP_DEGAMA_EN	(0x038)
+#define LCP_DEGAMA_MEM_CTRL	(0x03C)
+#define LCP_GMP_MEM_CTRL	(0x040)
+
+#define ARSR1P_IHLEFT		(0x000)
+#define ARSR1P_IHRIGHT		(0x004)
+#define ARSR1P_IHLEFT1		(0x008)
+#define ARSR1P_IHRIGHT1		(0x00C)
+#define ARSR1P_IVTOP		(0x010)
+#define ARSR1P_IVBOTTOM		(0x014)
+#define ARSR1P_UV_OFFSET		(0x018)
+#define ARSR1P_IHINC		(0x01C)
+#define ARSR1P_IVINC		(0x020)
+#define ARSR1P_MODE			(0x024)
+#define ARSR1P_FORMAT		(0x028)
+#define ARSR1P_SKIN_THRES_Y		(0x02C)
+#define ARSR1P_SKIN_THRES_U		(0x030)
+#define ARSR1P_SKIN_THRES_V		(0x034)
+#define ARSR1P_SKIN_EXPECTED	(0x038)
+#define ARSR1P_SKIN_CFG			(0x03C)
+#define ARSR1P_SHOOT_CFG1		(0x040)
+#define ARSR1P_SHOOT_CFG2		(0x044)
+#define ARSR1P_SHARP_CFG1		(0x048)
+#define ARSR1P_SHARP_CFG2		(0x04C)
+#define ARSR1P_SHARP_CFG3		(0x050)
+#define ARSR1P_SHARP_CFG4		(0x054)
+#define ARSR1P_SHARP_CFG5		(0x058)
+#define ARSR1P_SHARP_CFG6		(0x05C)
+#define ARSR1P_SHARP_CFG7		(0x060)
+#define ARSR1P_SHARP_CFG8		(0x064)
+#define ARSR1P_SHARP_CFG9		(0x068)
+#define ARSR1P_SHARP_CFG10		(0x06C)
+#define ARSR1P_SHARP_CFG11		(0x070)
+#define ARSR1P_DIFF_CTRL		(0x074)
+#define ARSR1P_LSC_CFG1		(0x078)
+#define ARSR1P_LSC_CFG2		(0x07C)
+#define ARSR1P_LSC_CFG3		(0x080)
+#define ARSR1P_FORCE_CLK_ON_CFG		(0x084)
+
+/* BIT EXT */
+
+#define LCP_U_GMP_COEF	(0x0000)
+
+#define ARSR1P_LSC_GAIN		(0x084)
+#define ARSR1P_COEFF_H_Y0	(0x0F0)
+#define ARSR1P_COEFF_H_Y1	(0x114)
+#define ARSR1P_COEFF_V_Y0	(0x138)
+#define ARSR1P_COEFF_V_Y1	(0x15C)
+#define ARSR1P_COEFF_H_UV0	(0x180)
+#define ARSR1P_COEFF_H_UV1	(0x1A4)
+#define ARSR1P_COEFF_V_UV0	(0x1C8)
+#define ARSR1P_COEFF_V_UV1	(0x1EC)
+
+#endif
drivers/staging/hikey9xx/gpu/kirin970_defs.c new file +381 -0
new file mode 100644
index 000000000000..749e37dbd4c0
@@ -0,0 +1,381 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2008-2011, Hisilicon Tech. Co., Ltd. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <drm/drm_atomic.h>
+#include <drm/drm_atomic_helper.h>
+#include <drm/drm_crtc.h>
+#include <drm/drm_crtc_helper.h>
+#include <drm/drm_drv.h>
+#include <drm/drm_fb_cma_helper.h>
+#include <drm/drm_fourcc.h>
+#include <drm/drm_gem_cma_helper.h>
+#include <drm/drm_plane_helper.h>
+
+#include "kirin9xx_drm_dpe_utils.h"
+#include "kirin9xx_drm_drv.h"
+#include "kirin970_dpe_reg.h"
+
+static const u32 kirin970_g_dss_module_base[DSS_CHN_MAX_DEFINE][MODULE_CHN_MAX] = {
+	// D0
+	{
+	MIF_CH0_OFFSET,   //MODULE_MIF_CHN
+	AIF0_CH0_OFFSET,  //MODULE_AIF0_CHN
+	AIF1_CH0_OFFSET,  //MODULE_AIF1_CHN
+	MCTL_CTL_MUTEX_RCH0,  //MODULE_MCTL_CHN_MUTEX
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH0_FLUSH_EN,  //MODULE_MCTL_CHN_FLUSH_EN
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH0_OV_OEN,  //MODULE_MCTL_CHN_OV_OEN
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH0_STARTY,  //MODULE_MCTL_CHN_STARTY
+	DSS_MCTRL_SYS_OFFSET + MCTL_MOD0_DBG,  //MODULE_MCTL_CHN_MOD_DBG
+	DSS_RCH_D0_DMA_OFFSET,  //MODULE_DMA
+	DSS_RCH_D0_DFC_OFFSET,  //MODULE_DFC
+	0,  //MODULE_SCL
+	0,  //MODULE_SCL_LUT
+	0,  //MODULE_ARSR2P
+	0,  //MODULE_ARSR2P_LUT
+	0, //MODULE_POST_CLIP_ES
+	0,  //MODULE_POST_CLIP
+	0,  //MODULE_PCSC
+	DSS_RCH_D0_CSC_OFFSET,  //MODULE_CSC
+	},
+
+	// D1
+	{
+	MIF_CH1_OFFSET,   //MODULE_MIF_CHN
+	AIF0_CH1_OFFSET,  //MODULE_AIF0_CHN
+	AIF1_CH1_OFFSET,  //MODULE_AIF1_CHN
+	MCTL_CTL_MUTEX_RCH1,  //MODULE_MCTL_CHN_MUTEX
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH1_FLUSH_EN,  //MODULE_MCTL_CHN_FLUSH_EN
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH1_OV_OEN,  //MODULE_MCTL_CHN_OV_OEN
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH1_STARTY,  //MODULE_MCTL_CHN_STARTY
+	DSS_MCTRL_SYS_OFFSET + MCTL_MOD1_DBG,  //MODULE_MCTL_CHN_MOD_DBG
+	DSS_RCH_D1_DMA_OFFSET,  //MODULE_DMA
+	DSS_RCH_D1_DFC_OFFSET,  //MODULE_DFC
+	0,  //MODULE_SCL
+	0,  //MODULE_SCL_LUT
+	0,  //MODULE_ARSR2P
+	0,  //MODULE_ARSR2P_LUT
+	0, //MODULE_POST_CLIP_ES
+	0,  //MODULE_POST_CLIP
+	0,  //MODULE_PCSC
+	DSS_RCH_D1_CSC_OFFSET,  //MODULE_CSC
+	},
+
+	// V0
+	{
+	MIF_CH2_OFFSET,   //MODULE_MIF_CHN
+	AIF0_CH2_OFFSET,  //MODULE_AIF0_CHN
+	AIF1_CH2_OFFSET,  //MODULE_AIF1_CHN
+	MCTL_CTL_MUTEX_RCH2,  //MODULE_MCTL_CHN_MUTEX
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH2_FLUSH_EN,  //MODULE_MCTL_CHN_FLUSH_EN
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH2_OV_OEN,  //MODULE_MCTL_CHN_OV_OEN
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH2_STARTY,  //MODULE_MCTL_CHN_STARTY
+	DSS_MCTRL_SYS_OFFSET + MCTL_MOD2_DBG,  //MODULE_MCTL_CHN_MOD_DBG
+	DSS_RCH_VG0_DMA_OFFSET,  //MODULE_DMA
+	DSS_RCH_VG0_DFC_OFFSET,  //MODULE_DFC
+	DSS_RCH_VG0_SCL_OFFSET,  //MODULE_SCL
+	DSS_RCH_VG0_SCL_LUT_OFFSET,  //MODULE_SCL_LUT
+	DSS_RCH_VG0_ARSR_OFFSET,  //MODULE_ARSR2P
+	DSS_RCH_VG0_ARSR_LUT_OFFSET,  //MODULE_ARSR2P_LUT
+	DSS_RCH_VG0_POST_CLIP_OFFSET_ES,  //MODULE_POST_CLIP_ES
+	DSS_RCH_VG0_POST_CLIP_OFFSET,  //MODULE_POST_CLIP
+	DSS_RCH_VG0_PCSC_OFFSET,  //MODULE_PCSC
+	DSS_RCH_VG0_CSC_OFFSET,  //MODULE_CSC
+	},
+
+	// G0
+	{
+	MIF_CH3_OFFSET,   //MODULE_MIF_CHN
+	AIF0_CH3_OFFSET,  //MODULE_AIF0_CHN
+	AIF1_CH3_OFFSET,  //MODULE_AIF1_CHN
+	MCTL_CTL_MUTEX_RCH3,  //MODULE_MCTL_CHN_MUTEX
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH3_FLUSH_EN,  //MODULE_MCTL_CHN_FLUSH_EN
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH3_OV_OEN,  //MODULE_MCTL_CHN_OV_OEN
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH3_STARTY,  //MODULE_MCTL_CHN_STARTY
+	DSS_MCTRL_SYS_OFFSET + MCTL_MOD3_DBG,  //MODULE_MCTL_CHN_MOD_DBG
+	DSS_RCH_G0_DMA_OFFSET,  //MODULE_DMA
+	DSS_RCH_G0_DFC_OFFSET,  //MODULE_DFC
+	DSS_RCH_G0_SCL_OFFSET,  //MODULE_SCL
+	0,  //MODULE_SCL_LUT
+	0,  //MODULE_ARSR2P
+	0,  //MODULE_ARSR2P_LUT
+	DSS_RCH_G0_POST_CLIP_OFFSET_ES,  //MODULE_POST_CLIP_ES
+	DSS_RCH_G0_POST_CLIP_OFFSET,  //MODULE_POST_CLIP
+	0,  //MODULE_PCSC
+	DSS_RCH_G0_CSC_OFFSET,  //MODULE_CSC
+	},
+
+	// V1
+	{
+	MIF_CH4_OFFSET,   //MODULE_MIF_CHN
+	AIF0_CH4_OFFSET,  //MODULE_AIF0_CHN
+	AIF1_CH4_OFFSET,  //MODULE_AIF1_CHN
+	MCTL_CTL_MUTEX_RCH4,  //MODULE_MCTL_CHN_MUTEX
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH4_FLUSH_EN,  //MODULE_MCTL_CHN_FLUSH_EN
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH4_OV_OEN,  //MODULE_MCTL_CHN_OV_OEN
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH4_STARTY,  //MODULE_MCTL_CHN_STARTY
+	DSS_MCTRL_SYS_OFFSET + MCTL_MOD4_DBG,  //MODULE_MCTL_CHN_MOD_DBG
+	DSS_RCH_VG1_DMA_OFFSET,  //MODULE_DMA
+	DSS_RCH_VG1_DFC_OFFSET,  //MODULE_DFC
+	DSS_RCH_VG1_SCL_OFFSET,  //MODULE_SCL
+	DSS_RCH_VG1_SCL_LUT_OFFSET,  //MODULE_SCL_LUT
+	0,  //MODULE_ARSR2P
+	0,  //MODULE_ARSR2P_LUT
+	DSS_RCH_VG1_POST_CLIP_OFFSET_ES,  //MODULE_POST_CLIP_ES
+	DSS_RCH_VG1_POST_CLIP_OFFSET,  //MODULE_POST_CLIP
+	0,  //MODULE_PCSC
+	DSS_RCH_VG1_CSC_OFFSET,  //MODULE_CSC
+	},
+
+	// G1
+	{
+	MIF_CH5_OFFSET,   //MODULE_MIF_CHN
+	AIF0_CH5_OFFSET,  //MODULE_AIF0_CHN
+	AIF1_CH5_OFFSET,  //MODULE_AIF1_CHN
+	MCTL_CTL_MUTEX_RCH5,  //MODULE_MCTL_CHN_MUTEX
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH5_FLUSH_EN,  //MODULE_MCTL_CHN_FLUSH_EN
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH5_OV_OEN,  //MODULE_MCTL_CHN_OV_OEN
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH5_STARTY,  //MODULE_MCTL_CHN_STARTY
+	DSS_MCTRL_SYS_OFFSET + MCTL_MOD5_DBG,  //MODULE_MCTL_CHN_MOD_DBG
+	DSS_RCH_G1_DMA_OFFSET,  //MODULE_DMA
+	DSS_RCH_G1_DFC_OFFSET,  //MODULE_DFC
+	DSS_RCH_G1_SCL_OFFSET,  //MODULE_SCL
+	0,  //MODULE_SCL_LUT
+	0,  //MODULE_ARSR2P
+	0,  //MODULE_ARSR2P_LUT
+	DSS_RCH_G1_POST_CLIP_OFFSET_ES,  //MODULE_POST_CLIP_ES
+	DSS_RCH_G1_POST_CLIP_OFFSET,  //MODULE_POST_CLIP
+	0,  //MODULE_PCSC
+	DSS_RCH_G1_CSC_OFFSET,  //MODULE_CSC
+	},
+
+	// D2
+	{
+	MIF_CH6_OFFSET,   //MODULE_MIF_CHN
+	AIF0_CH6_OFFSET,  //MODULE_AIF0_CHN
+	AIF1_CH6_OFFSET,  //MODULE_AIF1_CHN
+	MCTL_CTL_MUTEX_RCH6,  //MODULE_MCTL_CHN_MUTEX
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH6_FLUSH_EN,  //MODULE_MCTL_CHN_FLUSH_EN
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH6_OV_OEN,  //MODULE_MCTL_CHN_OV_OEN
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH6_STARTY,  //MODULE_MCTL_CHN_STARTY
+	DSS_MCTRL_SYS_OFFSET + MCTL_MOD6_DBG,  //MODULE_MCTL_CHN_MOD_DBG
+	DSS_RCH_D2_DMA_OFFSET,  //MODULE_DMA
+	DSS_RCH_D2_DFC_OFFSET,  //MODULE_DFC
+	0,  //MODULE_SCL
+	0,  //MODULE_SCL_LUT
+	0,  //MODULE_ARSR2P
+	0,  //MODULE_ARSR2P_LUT
+	0, //MODULE_POST_CLIP_ES
+	0,  //MODULE_POST_CLIP
+	0,  //MODULE_PCSC
+	DSS_RCH_D2_CSC_OFFSET,  //MODULE_CSC
+	},
+
+	// D3
+	{
+	MIF_CH7_OFFSET,   //MODULE_MIF_CHN
+	AIF0_CH7_OFFSET,  //MODULE_AIF0_CHN
+	AIF1_CH7_OFFSET,  //MODULE_AIF1_CHN
+	MCTL_CTL_MUTEX_RCH7,  //MODULE_MCTL_CHN_MUTEX
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH7_FLUSH_EN,  //MODULE_MCTL_CHN_FLUSH_EN
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH7_OV_OEN,  //MODULE_MCTL_CHN_OV_OEN
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH7_STARTY,  //MODULE_MCTL_CHN_STARTY
+	DSS_MCTRL_SYS_OFFSET + MCTL_MOD7_DBG,  //MODULE_MCTL_CHN_MOD_DBG
+	DSS_RCH_D3_DMA_OFFSET,  //MODULE_DMA
+	DSS_RCH_D3_DFC_OFFSET,  //MODULE_DFC
+	0,  //MODULE_SCL
+	0,  //MODULE_SCL_LUT
+	0,  //MODULE_ARSR2P
+	0,  //MODULE_ARSR2P_LUT
+	0, //MODULE_POST_CLIP_ES
+	0,  //MODULE_POST_CLIP
+	0,  //MODULE_PCSC
+	DSS_RCH_D3_CSC_OFFSET,  //MODULE_CSC
+	},
+
+	// W0
+	{
+	MIF_CH8_OFFSET,   //MODULE_MIF_CHN
+	AIF0_CH8_OFFSET,  //MODULE_AIF0_CHN
+	AIF1_CH8_OFFSET,  //MODULE_AIF1_CHN
+	MCTL_CTL_MUTEX_WCH0,  //MODULE_MCTL_CHN_MUTEX
+	DSS_MCTRL_SYS_OFFSET + MCTL_WCH0_FLUSH_EN,  //MODULE_MCTL_CHN_FLUSH_EN
+	DSS_MCTRL_SYS_OFFSET + MCTL_WCH0_OV_IEN,  //MODULE_MCTL_CHN_OV_OEN
+	0,  //MODULE_MCTL_CHN_STARTY
+	0,  //MODULE_MCTL_CHN_MOD_DBG
+	DSS_WCH0_DMA_OFFSET,  //MODULE_DMA
+	DSS_WCH0_DFC_OFFSET,  //MODULE_DFC
+	0,  //MODULE_SCL
+	0,  //MODULE_SCL_LUT
+	0,  //MODULE_ARSR2P
+	0,  //MODULE_ARSR2P_LUT
+	0, //MODULE_POST_CLIP_ES
+	0,  //MODULE_POST_CLIP
+	0,  //MODULE_PCSC
+	DSS_WCH0_CSC_OFFSET,  //MODULE_CSC
+	},
+
+	// W1
+	{
+	MIF_CH9_OFFSET,   //MODULE_MIF_CHN
+	AIF0_CH9_OFFSET,  //MODULE_AIF0_CHN
+	AIF1_CH9_OFFSET,  //MODULE_AIF1_CHN
+	MCTL_CTL_MUTEX_WCH1,  //MODULE_MCTL_CHN_MUTEX
+	DSS_MCTRL_SYS_OFFSET + MCTL_WCH1_FLUSH_EN,  //MODULE_MCTL_CHN_FLUSH_EN
+	DSS_MCTRL_SYS_OFFSET + MCTL_WCH1_OV_IEN,  //MODULE_MCTL_CHN_OV_OEN
+	0,  //MODULE_MCTL_CHN_STARTY
+	0,  //MODULE_MCTL_CHN_MOD_DBG
+	DSS_WCH1_DMA_OFFSET,  //MODULE_DMA
+	DSS_WCH1_DFC_OFFSET,  //MODULE_DFC
+	0,  //MODULE_SCL
+	0,  //MODULE_SCL_LUT
+	0,  //MODULE_ARSR2P
+	0,  //MODULE_ARSR2P_LUT
+	0, //MODULE_POST_CLIP_ES
+	0,  //MODULE_POST_CLIP
+	0,  //MODULE_PCSC
+	DSS_WCH1_CSC_OFFSET,  //MODULE_CSC
+	},
+
+	// V2
+	{
+	MIF_CH10_OFFSET,   //MODULE_MIF_CHN
+	AIF0_CH11_OFFSET,  //MODULE_AIF0_CHN
+	AIF1_CH11_OFFSET,  //MODULE_AIF1_CHN
+	MCTL_CTL_MUTEX_RCH8,  //MODULE_MCTL_CHN_MUTEX
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH8_FLUSH_EN,  //MODULE_MCTL_CHN_FLUSH_EN
+	DSS_MCTRL_SYS_OFFSET + MCTL_RCH8_OV_OEN,  //MODULE_MCTL_CHN_OV_OEN
+	0,  //MODULE_MCTL_CHN_STARTY
+	DSS_MCTRL_SYS_OFFSET + MCTL_MOD8_DBG,  //MODULE_MCTL_CHN_MOD_DBG
+	DSS_RCH_VG2_DMA_OFFSET,  //MODULE_DMA
+	DSS_RCH_VG2_DFC_OFFSET,  //MODULE_DFC
+	DSS_RCH_VG2_SCL_OFFSET,  //MODULE_SCL
+	DSS_RCH_VG2_SCL_LUT_OFFSET,  //MODULE_SCL_LUT
+	0,  //MODULE_ARSR2P
+	0,  //MODULE_ARSR2P_LUT
+	DSS_RCH_VG2_POST_CLIP_OFFSET_ES,  //MODULE_POST_CLIP_ES
+	DSS_RCH_VG2_POST_CLIP_OFFSET,  //MODULE_POST_CLIP
+	0,  //MODULE_PCSC
+	DSS_RCH_VG2_CSC_OFFSET,  //MODULE_CSC
+	},
+	// W2
+	{
+	MIF_CH11_OFFSET,   //MODULE_MIF_CHN
+	AIF0_CH12_OFFSET,  //MODULE_AIF0_CHN
+	AIF1_CH12_OFFSET,  //MODULE_AIF1_CHN
+	MCTL_CTL_MUTEX_WCH2,  //MODULE_MCTL_CHN_MUTEX
+	DSS_MCTRL_SYS_OFFSET + MCTL_WCH2_FLUSH_EN,  //MODULE_MCTL_CHN_FLUSH_EN
+	0,  //MODULE_MCTL_CHN_OV_OEN
+	0,  //MODULE_MCTL_CHN_STARTY
+	0,  //MODULE_MCTL_CHN_MOD_DBG
+	DSS_WCH2_DMA_OFFSET,  //MODULE_DMA
+	DSS_WCH2_DFC_OFFSET,  //MODULE_DFC
+	0,  //MODULE_SCL
+	0,  //MODULE_SCL_LUT
+	0,  //MODULE_ARSR2P
+	0,  //MODULE_ARSR2P_LUT
+	0, //MODULE_POST_CLIP_ES
+	0,  //MODULE_POST_CLIP
+	0,  //MODULE_PCSC
+	DSS_WCH2_CSC_OFFSET,  //MODULE_CSC
+	},
+};
+
+static const u32 kirin970_g_dss_module_ovl_base[DSS_MCTL_IDX_MAX][MODULE_OVL_MAX] = {
+	{DSS_OVL0_OFFSET,
+	DSS_MCTRL_CTL0_OFFSET},
+
+	{DSS_OVL1_OFFSET,
+	DSS_MCTRL_CTL1_OFFSET},
+
+	{DSS_OVL2_OFFSET,
+	DSS_MCTRL_CTL2_OFFSET},
+
+	{DSS_OVL3_OFFSET,
+	DSS_MCTRL_CTL3_OFFSET},
+
+	{0,
+	DSS_MCTRL_CTL4_OFFSET},
+
+	{0,
+	DSS_MCTRL_CTL5_OFFSET},
+};
+
+//SCF_LUT_CHN coef_idx
+static const int kirin970_g_scf_lut_chn_coef_idx[DSS_CHN_MAX_DEFINE] = {
+	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+};
+
+static const u32 kirin970_g_dss_module_cap[DSS_CHN_MAX_DEFINE][MODULE_CAP_MAX] = {
+	/* D2 */
+	{0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1},
+	/* D3 */
+	{0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1},
+	/* V0 */
+	{0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1},
+	/* G0 */
+	{0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0},
+	/* V1 */
+	{0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1},
+	/* G1 */
+	{0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0},
+	/* D0 */
+	{0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1},
+	/* D1 */
+	{0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1},
+
+	/* W0 */
+	{1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1},
+	/* W1 */
+	{1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1},
+
+	/* V2 */
+	{0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1},
+	/* W2 */
+	{1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1},
+};
+
+/* number of smrx idx for each channel */
+static const u32 kirin970_g_dss_chn_sid_num[DSS_CHN_MAX_DEFINE] = {
+	4, 1, 4, 4, 4, 4, 1, 1, 3, 4, 3, 3
+};
+
+/* start idx of each channel */
+/* smrx_idx = g_dss_smmu_smrx_idx[chn_idx] + (0 ~ g_dss_chn_sid_num[chn_idx]) */
+static const u32 kirin970_g_dss_smmu_smrx_idx[DSS_CHN_MAX_DEFINE] = {
+	0, 4, 5, 9, 13, 17, 21, 22, 26, 29, 23, 36
+};
+
+void kirin970_dpe_defs(struct dss_hw_ctx *ctx)
+{
+	memcpy(&ctx->g_dss_module_base, &kirin970_g_dss_module_base,
+		sizeof(kirin970_g_dss_module_base));
+	memcpy(&ctx->g_dss_module_ovl_base, &kirin970_g_dss_module_ovl_base,
+		sizeof(kirin970_g_dss_module_ovl_base));
+	memcpy(&ctx->g_scf_lut_chn_coef_idx, &kirin970_g_scf_lut_chn_coef_idx,
+		sizeof(kirin970_g_scf_lut_chn_coef_idx));
+	memcpy(&ctx->g_dss_module_cap, &kirin970_g_dss_module_cap,
+		sizeof(kirin970_g_dss_module_cap));
+	memcpy(&ctx->g_dss_chn_sid_num, &kirin970_g_dss_chn_sid_num,
+		sizeof(kirin970_g_dss_chn_sid_num));
+	memcpy(&ctx->g_dss_smmu_smrx_idx, &kirin970_g_dss_smmu_smrx_idx,
+		sizeof(kirin970_g_dss_smmu_smrx_idx));
+
+	ctx->smmu_offset = DSS_SMMU_OFFSET;
+	ctx->afbc_header_addr_align = AFBC_HEADER_ADDR_ALIGN;
+	ctx->dss_mmbuf_clk_rate_power_off = DEFAULT_DSS_MMBUF_CLK_RATE_POWER_OFF;
+	ctx->rot_mem_ctrl = ROT_MEM_CTRL;
+	ctx->dither_mem_ctrl = DITHER_MEM_CTRL;
+	ctx->arsr2p_lb_mem_ctrl = ARSR2P_LB_MEM_CTRL;
+	ctx->pxl0_clk_rate_power_off = DEFAULT_DSS_PXL0_CLK_RATE_POWER_OFF;
+}
drivers/staging/hikey9xx/gpu/kirin970_dpe_reg.h new file +1188 -0
new file mode 100644
index 000000000000..a4e9e0e84eec
@@ -0,0 +1,1188 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2016 Linaro Limited.
+ * Copyright (c) 2014-2016 Hisilicon Limited.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#ifndef __KIRIN970_DPE_REG_H__
+#define __KIRIN970_DPE_REG_H__
+
+#include "kirin9xx_dpe.h"
+
+#define CRGPERI_PLL0_CLK_RATE	(1660000000UL)
+#define CRGPERI_PLL2_CLK_RATE	(1920000000UL)
+#define CRGPERI_PLL3_CLK_RATE	(1200000000UL)
+#define CRGPERI_PLL7_CLK_RATE	(1782000000UL)
+
+/*core_clk: 0.65v-300M, 0.75-415M, 0.8-553.33M*/
+#define DEFAULT_DSS_CORE_CLK_RATE_L3	(554000000UL)
+#define DEFAULT_DSS_CORE_CLK_RATE_L2	(415000000UL)
+
+#define DEFAULT_DSS_CORE_CLK_RATE_ES	(400000000UL)
+
+/*pix0_clk: 0.65v-300M, 0.75-415M, 0.8-645M*/
+#define DEFAULT_DSS_PXL0_CLK_RATE_L3	(645000000UL)
+#define DEFAULT_DSS_PXL0_CLK_RATE_L2	(415000000UL)
+#define DEFAULT_DSS_PXL0_CLK_RATE_L1	(300000000UL)
+
+/*mmbuf_clk: 0.65v-237.14M, 0.75-332M, 0.8-480M*/
+#define DEFAULT_DSS_MMBUF_CLK_RATE_L3	(480000000UL)
+#define DEFAULT_DSS_MMBUF_CLK_RATE_L2	(332000000UL)
+
+/*pix1_clk: 0.65v-254.57M, 0.75-415M, 0.8-594M*/
+#define DEFAULT_DSS_PXL1_CLK_RATE_L3	(594000000UL)
+#define DEFAULT_DSS_PXL1_CLK_RATE_L2	(415000000UL)
+#define DEFAULT_DSS_PXL1_CLK_RATE_L1	(255000000UL)
+
+/*mdc_dvfs_clk: 0.65v-240M, 0.75-332M, 0.8-553.33M*/
+#define DEFAULT_MDC_CORE_CLK_RATE_L3	(554000000UL)
+#define DEFAULT_MDC_CORE_CLK_RATE_L2	(332000000UL)
+#define DEFAULT_MDC_CORE_CLK_RATE_L1	(240000000UL)
+
+/*dss clk power off */
+#define DEFAULT_DSS_PXL0_CLK_RATE_POWER_OFF	(238000000UL)
+#define DEFAULT_DSS_MMBUF_CLK_RATE_POWER_OFF	(208000000UL)
+
+/*****************************************************************************/
+
+#define PEREN4	(0x040)
+#define PERDIS4	(0x044)
+#define PERRSTEN0	(0x060)
+#define PERRSTDIS5	(0x0A0)
+#define PEREN6	(0x410)
+#define PERDIS6	(0x414)
+
+//SYSCTRL
+#define SCISODIS	(0x044)
+#define SCPWREN	(0x060)
+#define SCPEREN1	(0x170)
+#define SCPERDIS1	(0x174)
+#define SCPEREN4	(0x1B0)
+#define SCPERDIS4	(0x1B4)
+#define SCPERRSTDIS1	(0x210)
+
+//PCTRL
+#define PERI_CTRL33	(0x088)
+
+/*****************************************************************************/
+
+
+/* MODULE BASE ADDRESS */
+
+//SMMU
+#define DSS_SMMU_OFFSET	(0x80000)
+
+// RCH_V
+#define DSS_RCH_VG0_POST_CLIP_OFFSET_ES	(0x203A0)
+#define DSS_RCH_VG0_POST_CLIP_OFFSET	(0x20480)
+
+#define DSS_RCH_VG1_POST_CLIP_OFFSET_ES	(0x283A0)
+#define DSS_RCH_VG1_POST_CLIP_OFFSET	(0x28480)
+
+#define DSS_RCH_VG2_POST_CLIP_OFFSET_ES	(0x303A0)
+#define DSS_RCH_VG2_POST_CLIP_OFFSET	(0x30480)
+#define DSS_RCH_VG2_SCL_LUT_OFFSET		(0x31000)   //ES
+
+// RCH_G
+#define DSS_RCH_G0_POST_CLIP_OFFSET_ES		(0x383A0)
+#define DSS_RCH_G0_POST_CLIP_OFFSET		(0x38480)
+
+#define DSS_RCH_G1_POST_CLIP_OFFSET_ES	(0x403A0)
+#define DSS_RCH_G1_POST_CLIP_OFFSET		(0x40480)
+
+// RCH_D
+
+// WCH
+#define DSS_WCH0_BITEXT_OFFSET		(0x5A140)
+#define DSS_WCH0_DITHER_OFFSET            (0x5A1D0)
+#define DSS_WCH0_PCSC_OFFSET			(0x5A400)
+#define DSS_WCH0_ROT_OFFSET			(0x5A530)
+#define DSS_WCH0_FBCE_CREG_CTRL_GATE (0x5A964)
+
+#define DSS_WCH1_BITEXT_OFFSET		(0x5C140)
+#define DSS_WCH1_DITHER_OFFSET            (0x5C1D0)
+#define DSS_WCH1_SCL_OFFSET			(0x5C200)
+#define DSS_WCH1_PCSC_OFFSET			(0x5C400)
+#define DSS_WCH1_ROT_OFFSET			(0x5C530)
+#define DSS_WCH1_FBCE_CREG_CTRL_GATE	(0x5C964)
+
+// DPP
+#define DSS_DPP_CLIP_OFFSET	(0x70180)
+#define DSS_DPP_XCC_OFFSET	(0x70900)
+#define DSS_DPP_DEGAMMA_OFFSET	(0x70950)
+#define DSS_DPP_GMP_OFFSET	(0x709A0)
+#define DSS_DPP_ARSR_POST_OFFSET	(0x70A00)
+#define DSS_DPP_GMP_LUT_OFFSET	(0x73000)
+#define DSS_DPP_GAMA_PRE_LUT_OFFSET	(0x75000)
+#define DSS_DPP_DEGAMMA_LUT_OFFSET	(0x78000)
+#define DSS_DPP_ARSR_POST_LUT_OFFSET	(0x7B000)
+
+//for boston es
+#define DSS_DPP_LCP_OFFSET_ES	(0x70900)
+#define DSS_DPP_LCP_LUT_OFFSET_ES	(0x73000)
+
+// POST SCF
+#define DSS_POST_SCF_OFFSET	DSS_DPP_ARSR_POST_OFFSET
+#define DSS_POST_SCF_LUT_OFFSET	DSS_DPP_ARSR_POST_LUT_OFFSET
+//POST SCF for ES
+#define DSS_POST_SCF_LUT_OFFSET_ES	(0x7B000)
+
+/* AIF */
+
+//(0x0004+0x20*n)
+#define AIF_CH_HS	(0x0004)
+//(0x0008+0x20*n)
+#define AIF_CH_LS	(0x0008)
+
+/* SMMU */
+
+#define SMMU_SMRx_P	(0x10000)
+#define SMMU_RLD_EN0_P	(0x101F0)
+#define SMMU_RLD_EN1_P	(0x101F4)
+#define SMMU_RLD_EN2_P	(0x101F8)
+#define SMMU_INTMAS_P	(0x10200)
+#define SMMU_INTRAW_P	(0x10204)
+#define SMMU_INTSTAT_P	(0x10208)
+#define SMMU_INTCLR_P	(0x1020C)
+#define SMMU_SCR_P		(0x10210)
+#define SMMU_PCB_SCTRL	(0x10214)
+#define SMMU_PCB_TTBR	(0x10218)
+#define SMMU_PCB_TTBCR	(0x1021C)
+#define SMMU_OFFSET_ADDR_P	(0x10220)
+
+/* DFC */
+#define DFC_GLB_ALPHA01		(0x0008)
+#define DFC_GLB_ALPHA23		(0x0028)
+#define DFC_BITEXT_CTL		(0x0040)
+#define DFC_DITHER_CTL1      (0x00D0)
+
+/* SCF */
+
+/* MACROS */
+#define SCF_MIN_INPUT	(16) //SCF min input pix 16x16
+#define SCF_MIN_OUTPUT	(16) //SCF min output pix 16x16
+
+#define SCF_INC_FACTOR	BIT(18) //(262144)
+
+/* ARSR2P ES  v0 */
+#define ARSR2P_INPUT_WIDTH_HEIGHT_ES	(0x000)
+#define ARSR2P_OUTPUT_WIDTH_HEIGHT_ES	(0x004)
+#define ARSR2P_IHLEFT_ES	(0x008)
+#define ARSR2P_IHRIGHT_ES	(0x00C)
+#define ARSR2P_IVTOP_ES		(0x010)
+#define ARSR2P_IVBOTTOM_ES	(0x014)
+#define ARSR2P_IHINC_ES		(0x018)
+#define ARSR2P_IVINC_ES		(0x01C)
+#define ARSR2P_UV_OFFSET_ES	(0x020)
+#define ARSR2P_MODE_ES		(0x024)
+#define ARSR2P_SKIN_THRES_Y_ES	(0x028)
+#define ARSR2P_SKIN_THRES_U_ES	(0x02C)
+#define ARSR2P_SKIN_THRES_V_ES	(0x030)
+#define ARSR2P_SKIN_CFG0_ES	(0x034)
+#define ARSR2P_SKIN_CFG1_ES	(0x038)
+#define ARSR2P_SKIN_CFG2_ES	(0x03C)
+#define ARSR2P_SHOOT_CFG1_ES	(0x040)
+#define ARSR2P_SHOOT_CFG2_ES	(0x044)
+#define ARSR2P_SHARP_CFG1_ES	(0x048)
+#define ARSR2P_SHARP_CFG2_ES	(0x04C)
+#define ARSR2P_SHARP_CFG3_ES	(0x050)
+#define ARSR2P_SHARP_CFG4_ES	(0x054)
+#define ARSR2P_SHARP_CFG5_ES	(0x058)
+#define ARSR2P_SHARP_CFG6_ES	(0x05C)
+#define ARSR2P_SHARP_CFG7_ES	(0x060)
+#define ARSR2P_SHARP_CFG8_ES	(0x064)
+#define ARSR2P_SHARP_CFG9_ES	(0x068)
+#define ARSR2P_TEXTURW_ANALYSTS_ES	(0x06C)
+#define ARSR2P_INTPLSHOOTCTRL_ES	(0x070)
+#define ARSR2P_DEBUG0_ES	(0x074)
+#define ARSR2P_DEBUG1_ES	(0x078)
+#define ARSR2P_DEBUG2_ES	(0x07C)
+#define ARSR2P_DEBUG3_ES	(0x080)
+#define ARSR2P_LB_MEM_CTRL_ES	(0x084)
+#define ARSR2P_IHLEFT1_ES	(0x088)
+#define ARSR2P_IHRIGHT1_ES	(0x090)
+#define ARSR2P_IVBOTTOM1_ES	(0x094)
+
+#define ARSR2P_LUT_COEFY_V_OFFSET_ES	(0x0000)
+#define ARSR2P_LUT_COEFY_H_OFFSET_ES	(0x0100)
+#define ARSR2P_LUT_COEFA_V_OFFSET_ES	(0x0300)
+#define ARSR2P_LUT_COEFA_H_OFFSET_ES	(0x0400)
+#define ARSR2P_LUT_COEFUV_V_OFFSET_ES	(0x0600)
+#define ARSR2P_LUT_COEFUV_H_OFFSET_ES	(0x0700)
+
+/* ARSR2P  v0 */
+#define ARSR2P_IHLEFT1 (0x00C)
+#define ARSR2P_IHRIGHT (0x010)
+#define ARSR2P_IHRIGHT1 (0x014)
+#define ARSR2P_IVTOP (0x018)
+#define ARSR2P_IVBOTTOM (0x01C)
+#define ARSR2P_IVBOTTOM1 (0x020)
+#define ARSR2P_IHINC (0x024)
+#define ARSR2P_IVINC (0x028)
+#define ARSR2P_OFFSET (0x02C)
+#define ARSR2P_MODE (0x030)
+#define ARSR2P_SKIN_THRES_Y (0x034)
+#define ARSR2P_SKIN_THRES_U (0x038)
+#define ARSR2P_SKIN_THRES_V (0x03C)
+#define ARSR2P_SKIN_CFG0 (0x040)
+#define ARSR2P_SKIN_CFG1 (0x044)
+#define ARSR2P_SKIN_CFG2 (0x048)
+#define ARSR2P_SHOOT_CFG1 (0x04C)
+#define ARSR2P_SHOOT_CFG2 (0x050)
+#define ARSR2P_SHOOT_CFG3 (0x054)
+#define ARSR2P_SHARP_CFG1 (0x080)
+#define ARSR2P_SHARP_CFG2 (0x084)
+#define ARSR2P_SHARP_CFG3 (0x088)
+#define ARSR2P_SHARP_CFG4 (0x08C)
+#define ARSR2P_SHARP_CFG5 (0x090)
+#define ARSR2P_SHARP_CFG6 (0x094)
+#define ARSR2P_SHARP_CFG7 (0x098)
+#define ARSR2P_SHARP_CFG8 (0x09C)
+#define ARSR2P_SHARP_CFG9 (0x0A0)
+#define ARSR2P_SHARP_CFG10 (0x0A4)
+#define ARSR2P_SHARP_CFG11 (0x0A8)
+#define ARSR2P_SHARP_CFG12 (0x0AC)
+#define ARSR2P_TEXTURW_ANALYSTS (0x0D0)
+#define ARSR2P_INTPLSHOOTCTRL (0x0D4)
+#define ARSR2P_DEBUG0 (0x0D8)
+#define ARSR2P_DEBUG1 (0x0DC)
+#define ARSR2P_DEBUG2 (0x0E0)
+#define ARSR2P_DEBUG3 (0x0E4)
+#define ARSR2P_LB_MEM_CTRL (0x0E8)
+
+/* POST_CLIP  v g */
+#define POST_CLIP_CTL_HRZ			(0x0004)
+#define POST_CLIP_CTL_VRZ			(0x0008)
+#define POST_CLIP_EN				(0x000C)
+
+#define POST_CLIP_DISP_SIZE_ES		(0x0000)
+#define POST_CLIP_CTL_HRZ_ES		(0x0010)
+#define POST_CLIP_CTL_VRZ_ES		(0x0014)
+#define POST_CLIP_EN_ES			(0x0018)
+
+/* CSC */
+#define CSC_ICG_MODULE_ES	(0x0024)
+#define CSC_P00				(0x0010)
+#define CSC_P01				(0x0014)
+#define CSC_P02				(0x0018)
+#define CSC_P10				(0x001C)
+#define CSC_P11				(0x0020)
+#define CSC_P12				(0x0024)
+#define CSC_P20				(0x0028)
+#define CSC_P21				(0x002C)
+#define CSC_P22				(0x0030)
+#define CSC_ICG_MODULE		(0x0034)
+
+//AFBCE
+#define AFBCE_HREG_HDR_PTR_L0		(0x908)
+#define AFBCE_HREG_PLD_PTR_L0		(0x90C)
+
+//ROT
+#define ROT_MEM_CTRL_ES		(0x538)
+#define ROT_SIZE_ES			(0x53C)
+
+#define ROT_MEM_CTRL			(0x588)
+#define ROT_SIZE				(0x58C)
+#define ROT_422_MODE			(0x590)
+
+//REG_DEFAULT
+
+/* MACROS */
+
+/* DMA aligned limited:  128bits aligned */
+
+//16Bytes
+//32BPP:1024, 16BPP 512
+
+#define AFBC_HEADER_ADDR_ALIGN	(16)
+#define AFBC_HEADER_STRIDE_ALIGN	(16)
+
+//16Pixels
+
+#define MMBUF_BASE	(0x40) //(0xea800000)
+#define MMBUF_BLOCK0_LINE_NUM	(8)
+#define MMBUF_BLOCK0_ROT_LINE_NUM	(64)
+#define MMBUF_BLOCK1_LINE_NUM	(16)
+
+#define HFBC_PIC_WIDTH_MIN	(64)
+#define HFBC_PIC_WIDTH_ROT_MIN	(16)
+#define HFBC_PIC_WIDTH_MAX	(512)
+#define HFBC_PIC_WIDTH_ROT_MAX  (4096)
+#define HFBC_PIC_HEIGHT_MIN	(8)
+#define HFBC_PIC_HEIGHT_ROT_MIN	(32)
+#define HFBC_PIC_HEIGHT_MAX	(8196)
+#define HFBC_PIC_HEIGHT_ROT_MAX	(2160)
+#define HFBC_BLOCK0_WIDTH_ALIGN	(64)
+#define HFBC_BLOCK0_HEIGHT_ALIGN     (8)
+#define HFBC_BLOCK1_WIDTH_ALIGN	 (32)
+#define HFBC_BLOCK1_HEIGHT_ALIGN   (16)
+#define HFBC_HEADER_ADDR_ALIGN	  (4)
+#define HFBC_HEADER_STRIDE_ALIGN	  (32)
+#define HFBC_HEADER_STRIDE_BLOCK	  (4)
+#define HFBC_PAYLOAD0_ALIGN_8BIT       (512)
+#define HFBC_PAYLOAD1_ALIGN_8BIT       (256)
+#define HFBC_PAYLOAD_ALIGN_10BIT	(1024)
+
+#define HFBCD_BLOCK0_CROP_MAX	(7)
+#define HFBCD_BLOCK0_ROT_CROP_MAX	(63)
+#define HFBCD_BLOCK1_CROP_MAX	(15)
+
+/* MCTL  SYS */
+//SECU
+#define MCTL_RCH0_SECU_GATE		(0x0080)
+#define MCTL_RCH1_SECU_GATE		(0x0084)
+#define MCTL_RCH2_SECU_GATE		(0x0088)
+#define MCTL_RCH3_SECU_GATE		(0x008C)
+#define MCTL_RCH4_SECU_GATE		(0x0090)
+#define MCTL_RCH5_SECU_GATE		(0x0094)
+#define MCTL_RCH6_SECU_GATE		(0x0098)
+#define MCTL_RCH7_SECU_GATE		(0x009C)
+#define MCTL_RCH8_SECU_GATE		(0x00A0)
+#define MCTL_OV2_SECU_GATE		(0x00B0)
+#define MCTL_OV3_SECU_GATE		(0x00B4)
+#define MCTL_DSI0_SECU_CFG			(0x00C0)
+#define MCTL_DSI1_SECU_CFG			(0x00C4)
+#define MCTL_DP_SECU_GATE			(0x00C8)
+#define MCTL_DSI_MUX_SECU_GATE	(0x00CC)
+//FLUSH EN
+//SW FOR RCH
+#define MCTL_RCH8_OV_OEN	(0x015C)
+//SW FOR OV
+#define MCTL_RCH_OV0_SEL1  (0x0190)
+#define MCTL_RCH_OV1_SEL1  (0x0194)
+#define MCTL_RCH_OV2_SEL1  (0x0198)
+//SW FOR WCH
+//SW FOR OV2/3 OUTPUT
+//SW
+//RCH STARTY
+#define MCTL_RCH8_STARTY	(0x01E0)
+//LP
+
+//RCH
+#define MCTL_MOD_DBG_ADD_CH_NUM (2)  // copybit
+
+/* SBL */
+//SBL FOR ES
+#define SBL_REG_FRMT_MODE_ES                          (0x0000)
+#define SBL_REG_FRMT_DBUF_CTRL_ES                     (0x0008)
+#define SBL_REG_FRMT_FRAME_WIDTH_7_TO_0_ES            (0x0010)
+#define SBL_REG_FRMT_FRAME_WIDTH_15_TO_8_ES           (0x0014)
+#define SBL_REG_FRMT_FRAME_HEIGHT_7_TO_0_ES           (0x0018)
+#define SBL_REG_FRMT_FRAME_HEIGHT_15_TO_8_ES          (0x001c)
+#define SBL_REG_FRMT_ROI_HOR_START_7_TO_0_ES          (0x0080)
+#define SBL_REG_FRMT_ROI_HOR_START_15_TO_8_ES         (0x0084)
+#define SBL_REG_FRMT_ROI_HOR_END_7_TO_0_ES            (0x0088)
+#define SBL_REG_FRMT_ROI_HOR_END_15_TO_8_ES           (0x008c)
+#define SBL_REG_FRMT_ROI_VER_START_7_TO_0_ES          (0x0090)
+#define SBL_REG_FRMT_ROI_VER_START_15_TO_8_ES         (0x0094)
+#define SBL_REG_FRMT_ROI_VER_END_7_TO_0_ES            (0x0098)
+#define SBL_REG_FRMT_ROI_VER_END_15_TO_8_ES           (0x009c)
+#define SBL_REG_CALC_CONTROL_0_ES                     (0x0400)
+#define SBL_REG_CALC_CONTROL_1_ES                     (0x0404)
+#define SBL_REG_CALC_AMBIENT_LIGHT_7_TO_0_ES          (0x0408)
+#define SBL_REG_CALC_AMBIENT_LIGHT_15_TO_8_ES         (0x040c)
+#define SBL_REG_CALC_BACKLIGHT_7_TO_0_ES              (0x0410)
+#define SBL_REG_CALC_BACKLIGHT_15_TO_8_ES             (0x0414)
+#define SBL_REG_CALC_ASSERTIVENESS_ES                 (0x0418)
+#define SBL_REG_CALC_TF_CONTROL_ES                    (0x041c)
+#define SBL_REG_CALC_STRENGTH_MANUAL_7_TO_0_ES        (0x0420)
+#define SBL_REG_CALC_STRENGTH_MANUAL_9_TO_8_ES        (0x0424)
+#define SBL_REG_CALC_GAIN_AA_MANUAL_7_TO_0_ES         (0x0428)
+#define SBL_REG_CALC_GAIN_AA_MANUAL_11_TO_8_ES        (0x042c)
+#define SBL_REG_CALC_ROI_FACTOR_IN_7_TO_0_ES          (0x0430)
+#define SBL_REG_CALC_ROI_FACTOR_IN_15_TO_8_ES         (0x0434)
+#define SBL_REG_CALC_ROI_FACTOR_OUT_7_TO_0_ES         (0x0438)
+#define SBL_REG_CALC_ROI_FACTOR_OUT_15_TO_8_ES        (0x043c)
+#define SBL_REG_CALC_PSR_DELTA_CHANGE_7_TO_0_ES       (0x0448)
+#define SBL_REG_CALC_PSR_DELTA_CHANGE_15_TO_8_ES      (0x044c)
+#define SBL_REG_CALC_PSR_DELTA_SETTLE_7_TO_0_ES       (0x0450)
+#define SBL_REG_CALC_PSR_DELTA_SETTLE_15_TO_8_ES      (0x0454)
+#define SBL_REG_CALC_AL_SCALE_7_TO_0_ES               (0x0458)
+#define SBL_REG_CALC_AL_SCALE_15_TO_8_ES              (0x045c)
+#define SBL_REG_CALC_AL_TF_STEP_SAMPLE_ES             (0x0460)
+#define SBL_REG_CALC_AL_TF_STEP_WAIT_7_TO_0_ES        (0x0468)
+#define SBL_REG_CALC_AL_TF_STEP_WAIT_11_TO_8_ES       (0x046c)
+#define SBL_REG_CALC_AL_TF_STEP_WAITUP_7_TO_0_ES      (0x0470)
+#define SBL_REG_CALC_AL_TF_STEP_WAITUP_11_TO_8_ES     (0x0474)
+#define SBL_REG_CALC_AL_TF_STEP_SIZE_7_TO_0_ES        (0x0478)
+#define SBL_REG_CALC_AL_TF_STEP_SIZE_11_TO_8_ES       (0x047c)
+#define SBL_REG_CALC_AL_TF_LIMIT_7_TO_0_ES            (0x0480)
+#define SBL_REG_CALC_AL_TF_LIMIT_15_TO_8_ES           (0x0484)
+#define SBL_REG_CALC_AL_TF_ALPHA_ES                   (0x0488)
+#define SBL_REG_CALC_AL_TF_ALPHA_UP_ES                (0x048c)
+#define SBL_REG_CALC_AL_TF_NOISE_7_TO_0_ES            (0x0490)
+#define SBL_REG_CALC_AL_TF_NOISE_15_TO_8_ES           (0x0494)
+#define SBL_REG_CALC_AL_TF_M_INC_7_TO_0_ES            (0x0498)
+#define SBL_REG_CALC_AL_TF_M_INC_15_TO_8_ES           (0x049c)
+#define SBL_REG_CALC_AL_TF_K_INC_7_TO_0_ES            (0x04a0)
+#define SBL_REG_CALC_AL_TF_K_INC_15_TO_8_ES           (0x04a4)
+#define SBL_REG_CALC_AL_TF_M_DEC_7_TO_0_ES            (0x04a8)
+#define SBL_REG_CALC_AL_TF_M_DEC_15_TO_8_ES           (0x04ac)
+#define SBL_REG_CALC_AL_TF_K_DEC_7_TO_0_ES            (0x04b0)
+#define SBL_REG_CALC_AL_TF_K_DEC_15_TO_8_ES           (0x04b4)
+#define SBL_REG_CALC_AL_TF_AGGRESSIVENESS_ES          (0x04b8)
+#define SBL_REG_CALC_AL_RTF_FILTER_A_7_TO_0_ES        (0x04c0)
+#define SBL_REG_CALC_AL_RTF_FILTER_A_15_TO_8_ES       (0x04c4)
+#define SBL_REG_CALC_AL_RTF_FILTER_B_7_TO_0_ES        (0x04c8)
+#define SBL_REG_CALC_AL_RTF_FILTER_B_15_TO_8_ES       (0x04cc)
+#define SBL_REG_CALC_AL_RTF_FILTER_C_7_TO_0_ES        (0x04d0)
+#define SBL_REG_CALC_AL_RTF_FILTER_C_15_TO_8_ES       (0x04d4)
+#define SBL_REG_CALC_AB_AL_KNEE1_7_TO_0_ES            (0x04d8)
+#define SBL_REG_CALC_AB_AL_KNEE1_15_TO_8_ES           (0x04dc)
+#define SBL_REG_CALC_AB_AL_KNEE2_7_TO_0_ES            (0x04e0)
+#define SBL_REG_CALC_AB_AL_KNEE2_15_TO_8_ES           (0x04e4)
+#define SBL_REG_CALC_AB_BL_KNEE1_7_TO_0_ES            (0x04e8)
+#define SBL_REG_CALC_AB_BL_KNEE1_15_TO_8_ES           (0x04ec)
+#define SBL_REG_CALC_AB_BL_KNEE2_7_TO_0_ES            (0x04f0)
+#define SBL_REG_CALC_AB_BL_KNEE2_15_TO_8_ES           (0x04f4)
+#define SBL_REG_CALC_BL_PANEL_MAX_7_TO_0_ES           (0x04f8)
+#define SBL_REG_CALC_BL_PANEL_MAX_15_TO_8_ES          (0x04fc)
+#define SBL_REG_CALC_BL_OFFSET_7_TO_0_ES              (0x0500)
+#define SBL_REG_CALC_BL_OFFSET_15_TO_8_ES             (0x0504)
+#define SBL_REG_CALC_BL_MIN_7_TO_0_ES                 (0x0508)
+#define SBL_REG_CALC_BL_MIN_15_TO_8_ES                (0x050c)
+#define SBL_REG_CALC_BL_ATTEN_ALPHA_7_TO_0_ES         (0x0510)
+#define SBL_REG_CALC_BL_ATTEN_ALPHA_9_TO_8_ES         (0x0514)
+#define SBL_REG_CALC_SBC1_TF_DEPTH_7_TO_0_ES          (0x0518)
+#define SBL_REG_CALC_SBC1_TF_DEPTH_15_TO_8_ES         (0x051c)
+#define SBL_REG_CALC_SBC1_TF_STEP_7_TO_0_ES           (0x0520)
+#define SBL_REG_CALC_SBC1_TF_STEP_15_TO_8_ES          (0x0524)
+#define SBL_REG_CALC_SBC1_TF_ASYM_ES                  (0x0528)
+#define SBL_REG_CALC_SBC1_TF_DEPTH_LOG_7_TO_0_ES      (0x0530)
+#define SBL_REG_CALC_SBC1_TF_DEPTH_LOG_15_TO_8_ES     (0x0534)
+#define SBL_REG_CALC_SBC1_TF_STEP_LOG_7_TO_0_ES       (0x0538)
+#define SBL_REG_CALC_SBC1_TF_STEP_LOG_15_TO_8_ES      (0x053c)
+#define SBL_REG_CALC_SBC1_TF_ASYM_LOG_ES              (0x0540)
+#define SBL_REG_CALC_SBC2_TF_DEPTH_7_TO_0_ES          (0x0548)
+#define SBL_REG_CALC_SBC2_TF_DEPTH_15_TO_8_ES         (0x054c)
+#define SBL_REG_CALC_SBC2_TF_STEP_7_TO_0_ES           (0x0550)
+#define SBL_REG_CALC_SBC2_TF_STEP_15_TO_8_ES          (0x0554)
+#define SBL_REG_CALC_SBC2_TF_ASYM_ES                  (0x0558)
+#define SBL_REG_CALC_SBC2_TF_DEPTH_LOG_7_TO_0_ES      (0x0560)
+#define SBL_REG_CALC_SBC2_TF_DEPTH_LOG_15_TO_8_ES     (0x0564)
+#define SBL_REG_CALC_SBC2_TF_STEP_LOG_7_TO_0_ES       (0x0568)
+#define SBL_REG_CALC_SBC2_TF_STEP_LOG_15_TO_8_ES      (0x056c)
+#define SBL_REG_CALC_SBC2_TF_ASYM_LOG_ES              (0x0570)
+#define SBL_REG_CALC_CALIBRATION_A_7_TO_0_ES          (0x05b8)
+#define SBL_REG_CALC_CALIBRATION_A_15_TO_8_ES         (0x05bc)
+#define SBL_REG_CALC_CALIBRATION_B_7_TO_0_ES          (0x05c0)
+#define SBL_REG_CALC_CALIBRATION_B_15_TO_8_ES         (0x05c4)
+#define SBL_REG_CALC_CALIBRATION_C_7_TO_0_ES          (0x05c8)
+#define SBL_REG_CALC_CALIBRATION_C_15_TO_8_ES         (0x05cc)
+#define SBL_REG_CALC_CALIBRATION_D_7_TO_0_ES          (0x05d0)
+#define SBL_REG_CALC_CALIBRATION_D_15_TO_8_ES         (0x05d4)
+#define SBL_REG_CALC_CALIBRATION_E_7_TO_0_ES          (0x05d8)
+#define SBL_REG_CALC_CALIBRATION_E_15_TO_8_ES         (0x05dc)
+#define SBL_REG_CALC_BACKLIGHT_SCALE_7_TO_0_ES        (0x05e0)
+#define SBL_REG_CALC_BACKLIGHT_SCALE_15_TO_8_ES       (0x05e4)
+#define SBL_REG_CALC_GAIN_AA_TF_DEPTH_7_TO_0_ES       (0x05e8)
+#define SBL_REG_CALC_GAIN_AA_TF_DEPTH_15_TO_8_ES      (0x05ec)
+#define SBL_REG_CALC_GAIN_AA_TF_STEP_7_TO_0_ES        (0x05f0)
+#define SBL_REG_CALC_GAIN_AA_TF_STEP_11_TO_8_ES       (0x05f4)
+#define SBL_REG_CALC_GAIN_AA_TF_ASYM_ES               (0x05f8)
+#define SBL_REG_CALC_STRENGTH_LIMIT_7_TO_0_ES         (0x0600)
+#define SBL_REG_CALC_STRENGTH_LIMIT_9_TO_8_ES         (0x0604)
+#define SBL_REG_CALC_ICUT_HIST_MIN_ES                 (0x0608)
+#define SBL_REG_CALC_ICUT_BL_MIN_7_TO_0_ES            (0x0610)
+#define SBL_REG_CALC_ICUT_BL_MIN_15_TO_8_ES           (0x0614)
+#define SBL_REG_CALC_GAIN_CA_TF_DEPTH_7_TO_0_ES       (0x0618)
+#define SBL_REG_CALC_GAIN_CA_TF_DEPTH_15_TO_8_ES      (0x061c)
+#define SBL_REG_CALC_GAIN_CA_TF_STEP_7_TO_0_ES        (0x0620)
+#define SBL_REG_CALC_GAIN_CA_TF_STEP_11_TO_8_ES       (0x0624)
+#define SBL_REG_CALC_GAIN_CA_TF_ASYM_ES               (0x0628)
+#define SBL_REG_CALC_GAIN_MAX_7_TO_0_ES               (0x0630)
+#define SBL_REG_CALC_GAIN_MAX_11_TO_8_ES              (0x0634)
+#define SBL_REG_CALC_GAIN_MIDDLE_7_TO_0_ES            (0x0638)
+#define SBL_REG_CALC_GAIN_MIDDLE_11_TO_8_ES           (0x063c)
+#define SBL_REG_CALC_BRIGHTPR_ES                      (0x0640)
+#define SBL_REG_CALC_BPR_CORRECT_ES                   (0x0648)
+#define SBL_CALC_BACKLIGHT_OUT_7_TO_0_ES              (0x0650)
+#define SBL_CALC_BACKLIGHT_OUT_15_TO_8_ES             (0x0654)
+#define SBL_CALC_STRENGTH_INROI_OUT_7_TO_0_ES         (0x0658)
+#define SBL_CALC_STRENGTH_INROI_OUT_9_TO_8_ES         (0x065c)
+#define SBL_CALC_STRENGTH_OUTROI_OUT_7_TO_0_ES        (0x0660)
+#define SBL_CALC_STRENGTH_OUTROI_OUT_9_TO_8_ES        (0x0664)
+#define SBL_CALC_DARKENH_OUT_7_TO_0_ES                (0x0668)
+#define SBL_CALC_DARKENH_OUT_15_TO_8_ES               (0x066c)
+#define SBL_CALC_BRIGHTPR_OUT_ES                      (0x0670)
+#define SBL_CALC_STAT_OUT_7_TO_0_ES                   (0x0678)
+#define SBL_CALC_STAT_OUT_15_TO_8_ES                  (0x067c)
+#define SBL_REG_CALC_AL_DELTA_SETTLE_7_TO_0_ES        (0x0680)
+#define SBL_REG_CALC_AL_DELTA_SETTLE_15_TO_8_ES       (0x0684)
+#define SBL_REG_CALC_BL_DELTA_SETTLE_7_TO_0_ES        (0x0688)
+#define SBL_REG_CALC_BL_DELTA_SETTLE_15_TO_8_ES       (0x068c)
+#define SBL_CALC_AL_CALIB_LUT_ADDR_I_ES               (0x06c0)
+#define SBL_CALC_AL_CALIB_LUT_DATA_W_7_TO_0_ES        (0x06d0)
+#define SBL_CALC_AL_CALIB_LUT_DATA_W_15_TO_8_ES       (0x06d4)
+#define SBL_CALC_BL_IN_LUT_ADDR_I_ES                  (0x0700)
+#define SBL_CALC_BL_IN_LUT_DATA_W_7_TO_0_ES           (0x0710)
+#define SBL_CALC_BL_IN_LUT_DATA_W_15_TO_8_ES          (0x0714)
+#define SBL_CALC_BL_OUT_LUT_ADDR_I_ES                 (0x0740)
+#define SBL_CALC_BL_OUT_LUT_DATA_W_7_TO_0_ES          (0x0750)
+#define SBL_CALC_BL_OUT_LUT_DATA_W_15_TO_8_ES         (0x0754)
+#define SBL_CALC_BL_ATTEN_LUT_ADDR_I_ES               (0x0780)
+#define SBL_CALC_BL_ATTEN_LUT_DATA_W_7_TO_0_ES        (0x0790)
+#define SBL_CALC_BL_ATTEN_LUT_DATA_W_15_TO_8_ES       (0x0794)
+#define SBL_CALC_BL_AUTO_LUT_ADDR_I_ES                (0x07c0)
+#define SBL_CALC_BL_AUTO_LUT_DATA_W_7_TO_0_ES         (0x07d0)
+#define SBL_CALC_BL_AUTO_LUT_DATA_W_15_TO_8_ES        (0x07d4)
+#define SBL_CALC_AL_CHANGE_LUT_ADDR_I_ES              (0x0800)
+#define SBL_CALC_AL_CHANGE_LUT_DATA_W_7_TO_0_ES       (0x0810)
+#define SBL_CALC_AL_CHANGE_LUT_DATA_W_15_TO_8_ES      (0x0814)
+#define SBL_REG_CABC_INTENSITY_7_TO_0_ES              (0x0900)
+#define SBL_REG_CABC_INTENSITY_11_TO_8_ES             (0x0904)
+#define SBL_REG_CABC_ICUT_SELECT_ES                   (0x0908)
+#define SBL_REG_CABC_ICUT_MANUAL_ES                   (0x090c)
+#define SBL_CABC_ICUT_OUT_ES                          (0x0910)
+#define SBL_REG_CORE1_VC_CONTROL_0_ES                 (0x0c00)
+#define SBL_REG_CORE1_IRDX_CONTROL_0_ES               (0x0c40)
+#define SBL_REG_CORE1_IRDX_CONTROL_1_ES               (0x0c44)
+#define SBL_REG_CORE1_IRDX_VARIANCE_ES                (0x0c4c)
+#define SBL_REG_CORE1_IRDX_SLOPE_MAX_ES               (0x0c50)
+#define SBL_REG_CORE1_IRDX_SLOPE_MIN_ES               (0x0c54)
+#define SBL_REG_CORE1_IRDX_BLACK_LEVEL_7_TO_0_ES      (0x0c58)
+#define SBL_REG_CORE1_IRDX_BLACK_LEVEL_9_TO_8_ES      (0x0c5c)
+#define SBL_REG_CORE1_IRDX_WHITE_LEVEL_7_TO_0_ES      (0x0c60)
+#define SBL_REG_CORE1_IRDX_WHITE_LEVEL_9_TO_8_ES      (0x0c64)
+#define SBL_REG_CORE1_IRDX_LIMIT_AMPL_ES              (0x0c68)
+#define SBL_REG_CORE1_IRDX_DITHER_ES                  (0x0c6c)
+#define SBL_REG_CORE1_IRDX_STRENGTH_INROI_7_TO_0_ES   (0x0c70)
+#define SBL_REG_CORE1_IRDX_STRENGTH_INROI_9_TO_8_ES   (0x0c74)
+#define SBL_REG_CORE1_IRDX_STRENGTH_OUTROI_7_TO_0_ES  (0x0c78)
+#define SBL_REG_CORE1_IRDX_STRENGTH_OUTROI_9_TO_8_ES  (0x0c7c)
+#define SBL_CORE1_IRDX_ASYMMETRY_LUT_ADDR_I_ES        (0x0c80)
+#define SBL_CORE1_IRDX_ASYMMETRY_LUT_DATA_W_7_TO_0_ES (0x0c84)
+#define SBL_CORE1_IRDX_ASYMMETRY_LUT_DATA_W_11_TO_8_ES (0x0c88)
+#define SBL_CORE1_IRDX_COLOR_LUT_ADDR_I_ES            (0x0cc0)
+#define SBL_CORE1_IRDX_COLOR_LUT_DATA_W_7_TO_0_ES     (0x0cc4)
+#define SBL_CORE1_IRDX_COLOR_LUT_DATA_W_11_TO_8_ES    (0x0cc8)
+#define SBL_REG_CORE1_IRDX_FILTER_CTRL_ES             (0x0d00)
+#define SBL_REG_CORE1_IRDX_SVARIANCE_ES               (0x0d04)
+#define SBL_REG_CORE1_IRDX_BRIGHTPR_ES                (0x0d08)
+#define SBL_REG_CORE1_IRDX_CONTRAST_ES                (0x0d0c)
+#define SBL_REG_CORE1_IRDX_DARKENH_7_TO_0_ES          (0x0d10)
+#define SBL_REG_CORE1_IRDX_DARKENH_15_TO_8_ES         (0x0d14)
+#define SBL_REG_CORE1_DTHR_CONTROL_ES                 (0x0dc0)
+#define SBL_REG_CORE1_LOGO_TOP_ES                     (0x0dd0)
+#define SBL_REG_CORE1_LOGO_LEFT_ES                    (0x0dd4)
+#define SBL_REG_CORE1_CA_D_ARTITHRESH_7_TO_0_ES       (0x0e00)
+#define SBL_REG_CORE1_CA_D_ARTITHRESH_9_TO_8_ES       (0x0e04)
+#define SBL_CORE1_CA_STR_ATTEN_7_TO_0_ES              (0x0e10)
+#define SBL_CORE1_CA_STR_ATTEN_15_TO_8_ES             (0x0e14)
+#define SBL_CORE1_CA_STR_ATTEN_16_ES                  (0x0e18)
+#define SBL_REG_CORE1_FRD_D_THRESH_7_TO_0_ES          (0x0e20)
+#define SBL_REG_CORE1_FRD_D_THRESH_9_TO_8_ES          (0x0e24)
+#define SBL_REG_CORE1_REG0_7_TO_0_ES                  (0x0e28)
+#define SBL_REG_CORE1_REG0_15_TO_8_ES                 (0x0e2c)
+#define SBL_REG_CORE1_REG1_7_TO_0_ES                  (0x0e30)
+#define SBL_REG_CORE1_REG1_15_TO_8_ES                 (0x0e34)
+#define SBL_REG_CORE1_REG2_7_TO_0_ES                  (0x0e38)
+#define SBL_REG_CORE1_REG2_15_TO_8_ES                 (0x0e3c)
+#define SBL_REG_CORE1_REG3_7_TO_0_ES                  (0x0e40)
+#define SBL_REG_CORE1_REG3_15_TO_8_ES                 (0x0e44)
+#define SBL_REG_CORE1_REG4_7_TO_0_ES                  (0x0e48)
+#define SBL_REG_CORE1_REG4_15_TO_8_ES                 (0x0e4c)
+#define SBL_REG_CORE1_REG5_7_TO_0_ES                  (0x0e50)
+#define SBL_REG_CORE1_REG5_15_TO_8_ES                 (0x0e54)
+#define SBL_CORE1_REG_OUT0_7_TO_0_ES                  (0x0e58)
+#define SBL_CORE1_REG_OUT0_15_TO_8_ES                 (0x0e5c)
+#define SBL_CORE1_REG_OUT1_7_TO_0_ES                  (0x0e60)
+#define SBL_CORE1_REG_OUT1_15_TO_8_ES                 (0x0e64)
+
+//SBL for 970
+#define SBL_REG_FRMT_MODE                                  (0x0000)
+#define SBL_REG_FRMT_FRAME_DIMEN                           (0x0004)
+#define SBL_REG_FRMT_HW_VERSION                            (0x0014)
+#define SBL_REG_FRMT_ROI_HOR                               (0x0020)
+#define SBL_REG_FRMT_ROI_VER                               (0x0024)
+#define SBL_REG_CALC_CONTROL                               (0x0100)
+#define SBL_REG_AL_BL                                      (0x0104)
+#define SBL_REG_FILTERS_CTRL                               (0x0108)
+#define SBL_REG_MANUAL                                     (0x010c)
+#define SBL_REG_CALC_ROI_FACTOR                            (0x0110)
+#define SBL_REG_CALC_PSR_DELTA                             (0x0114)
+#define SBL_REG_CALC_AL                                    (0x0118)
+#define SBL_REG_CALC_AL_TF_STEP_WAIT                       (0x011c)
+#define SBL_REG_CALC_AL_TF_STEP_SIZE_LIMIT                 (0x0120)
+#define SBL_REG_CALC_AL_TF_ALPHA                           (0x0124)
+#define SBL_REG_CALC_AL_TF_NOISE_M_INC                     (0x0128)
+#define SBL_REG_CALC_AL_TF_K_INC_M_DEC                     (0x012c)
+#define SBL_REG_CALC_AL_TF_K_DEC_AGGRESSIVENESS            (0x0130)
+#define SBL_REG_CALC_AL_RTF_FILTER_A_7_TO_0                (0x0134)
+#define SBL_REG_CALC_AL_RTF_FILTER_C_AB_AL_KNEE1           (0x0138)
+#define SBL_REG_CALC_AB_AL_KNEE2_AB_BL_KNEE1               (0x013c)
+#define SBL_REG_CALC_AB_BL_KNEE2_BL_PANEL_MAX              (0x0140)
+#define SBL_REG_CALC_BL_OFFSET_BL_MIN                      (0x0144)
+#define SBL_REG_CALC_BL_ATTEN_ALPHA_SBC1_TF_DEPTH          (0x0148)
+#define SBL_REG_CALC_SBC1_TF_STEP_SBC1_TF_ASYM             (0x014c)
+#define SBL_REG_CALC_SBC1_TF_DEPTH_LOG_SBC1_TF_STEP_LOG    (0x0150)
+#define SBL_REG_CALC_SBC1_TF_ASYM_LOG_SBC2_TF_DEPTH        (0x0154)
+#define SBL_REG_CALC_SBC2_TF_STEP_SBC2_TF_ASYM             (0x0158)
+#define SBL_REG_CALC_SBC2_TF_DEPTH_LOG_SBC2_TF_STEP_LOG    (0x015c)
+#define SBL_REG_CALC_SBC2_TF_ASYM_LOG                      (0x0160)
+#define SBL_REG_CALC_CALIBRATION_A_B                       (0x0170)
+#define SBL_REG_CALC_CALIBRATION_C_D                       (0x0174)
+#define SBL_REG_CALC_CALIBRATION_E_BACKLIGHT_SCALE         (0x0178)
+#define SBL_REG_CALC_GAIN_AA_TF_DEPTH_STEP                 (0x017c)
+#define SBL_REG_CALC_GAIN_AA_TF_ASYM_STRENGTH_LIMIT        (0x0180)
+#define SBL_REG_CALC_ICUT_HIST_MIN_ICUT_BL_MIN             (0x0184)
+#define SBL_REG_CALC_GAIN_CA_TF_DEPTH_GAIN_CA_TF_STEP      (0x0188)
+#define SBL_REG_CALC_GAIN_CA_TF_ASYM_GAIN_MAX              (0x018c)
+#define SBL_REG_CALC_GAIN_MIDDLE_CALC_BRIGHTPR             (0x0190)
+#define SBL_REG_CALC_BPR_CORRECT_CALC_BACKLIGHT_OUT        (0x0194)
+#define SBL_CALC_STRENGTH_INROI_OUTROI_OUT                 (0x0198)
+#define SBL_CALC_DARKENH_OUT_CALC_BRIGHTPR_OUT             (0x019c)
+#define SBL_CALC_STAT_OUT                                  (0x01A0)
+#define SBL_REG_CALC_BL_DELTA_SETTLE                       (0x01A4)
+#define SBL_CALC_AL_CALIB_LUT_ADDR_I                       (0x01B0)
+#define SBL_CALC_AL_CALIB_LUT_DATA_W                       (0x01B4)
+#define SBL_CALC_BL_IN_LUT_ADDR_I                          (0x01C0)
+#define SBL_CALC_BL_IN_LUT_DATA_W                          (0x01C4)
+#define SBL_CALC_BL_OUT_LUT_ADDR_I                         (0x01D0)
+#define SBL_CALC_BL_OUT_LUT_DATA_W                         (0x01D4)
+#define SBL_CALC_BL_ATTEN_LUT_ADDR_I                       (0x01E0)
+#define SBL_CALC_BL_ATTEN_LUT_DATA_W                       (0x01E4)
+#define SBL_CALC_BL_AUTO_LUT_ADDR_I                        (0x01F0)
+#define SBL_CALC_BL_AUTO_LUT_DATA_W                        (0x01F4)
+#define SBL_CALC_AL_CHANGE_LUT_ADDR_I                      (0x0200)
+#define SBL_CALC_AL_CHANGE_LUT_DATA_W                      (0x0204)
+#define SBL_REG_CABC_INTENSITY_CABC_ICUT_SELECT            (0x0240)
+#define SBL_REG_CABC_ICUT_MANUAL_CABC_ICUT_OUT             (0x0244)
+#define SBL_REG_VC_VC_CONTROL_0                            (0x0300)
+#define SBL_REG_VC_IRDX_CONTROL                            (0x0308)
+#define SBL_REG_VC_IRDX_ALPHA_MANUAL_VC_IRDX_BETA_MANUA    (0x030c)
+#define SBL_REG_VC_IRDX_VARIANCE                           (0x0310)
+#define SBL_REG_VC_IRDX_SLOPE_MAX_MIN                      (0x0314)
+#define SBL_REG_VC_IRDX_BLACK_WHITE_LEVEL_7_TO_0           (0x0318)
+#define SBL_REG_VC_IRDX_LIMIT_AMPL_VC_IRDX_DITHER          (0x031c)
+#define SBL_REG_VC_IRDX_STRENGTH_INROI_OUTROI              (0x0320)
+#define SBL_CORE1_IRDX_ASYMMETRY_LUT_ADDR_I                (0x0324)
+#define SBL_CORE1_IRDX_ASYMMETRY_LUT_DATA_W                (0x0328)
+#define SBL_CORE1_IRDX_COLOR_LUT_ADDR_I                    (0x0334)
+#define SBL_CORE1_IRDX_COLOR_LUT_DATA_W                    (0x0338)
+#define SBL_REG_VC_IRDX_FILTER_CTRL                        (0x0344)
+#define SBL_REG_VC_IRDX_BRIGHTPR                           (0x0348)
+#define SBL_REG_VC_IRDX_CONTRAST                           (0x034c)
+#define SBL_REG_VC_IRDX_DARKENH                            (0x0350)
+#define SBL_REG_VC_DTHR_CONTROL                            (0x0370)
+#define SBL_REG_VC_LOGO_TOP_LEFT                           (0x0374)
+#define SBL_REG_VC_CA_D_ARTITHRESH                         (0x0380)
+#define SBL_VC_CA_STR_ATTEN                                (0x0384)
+#define SBL_REG_VC_REG1_REG2                               (0x038c)
+#define SBL_REG_VC_REG3_REG4                               (0x0390)
+#define SBL_REG_VC_REG5_REG_OUT0                           (0x0394)
+#define SBL_VC_REG_OUT1                                    (0x0398)
+#define SBL_VC_ANTI_FLCKR_CONTROL                          (0x039c)
+#define SBL_VC_ANTI_FLCKR_RFD_FRD_THR                      (0x03a0)
+#define SBL_VC_ANTI_FLCKR_SCD_THR_ANTI_FLCKR_FD3_SC_DLY    (0x03a4)
+#define SBL_VC_ANTI_FLCKR_AL_ANTI_FLCKR_T_DURATION         (0x03a8)
+#define SBL_VC_ANTI_FLCKR_ALPHA                            (0x03ac)
+
+/* DPP */
+//DPP TOP
+//#define DPP_ARSR1P_MEM_CTRL	(0x01C)
+#define DPP_ARSR_POST_MEM_CTRL	(0x01C)
+//#define DPP_ARSR1P	(0x048)
+
+//DITHER
+#define DITHER_CTL1 (0x000)
+#define DITHER_CTL0 (0x004)
+#define DITHER_TRI_THD12_0 (0x008)
+#define DITHER_TRI_THD12_1 (0x00C)
+#define DITHER_TRI_THD10 (0x010)
+#define DITHER_TRI_THD12_UNI_0 (0x014)
+#define DITHER_TRI_THD12_UNI_1 (0x018)
+#define DITHER_TRI_THD10_UNI (0x01C)
+#define DITHER_BAYER_CTL (0x020)
+#define DITHER_BAYER_ALPHA_THD (0x024)
+#define DITHER_MATRIX_PART1 (0x028)
+#define DITHER_MATRIX_PART0 (0x02C)
+#define DITHER_HIFREQ_REG_INI_CFG_EN (0x030)
+#define DITHER_HIFREQ_REG_INI0_0 (0x034)
+#define DITHER_HIFREQ_REG_INI0_1 (0x038)
+#define DITHER_HIFREQ_REG_INI0_2 (0x03C)
+#define DITHER_HIFREQ_REG_INI0_3 (0x040)
+#define DITHER_HIFREQ_REG_INI1_0 (0x044)
+#define DITHER_HIFREQ_REG_INI1_1 (0x048)
+#define DITHER_HIFREQ_REG_INI1_2 (0x04C)
+#define DITHER_HIFREQ_REG_INI1_3 (0x050)
+#define DITHER_HIFREQ_REG_INI2_0 (0x054)
+#define DITHER_HIFREQ_REG_INI2_1 (0x058)
+#define DITHER_HIFREQ_REG_INI2_2 (0x05C)
+#define DITHER_HIFREQ_REG_INI2_3 (0x060)
+#define DITHER_HIFREQ_POWER_CTRL (0x064)
+#define DITHER_HIFREQ_FILT_0 (0x068)
+#define DITHER_HIFREQ_FILT_1 (0x06C)
+#define DITHER_HIFREQ_FILT_2 (0x070)
+#define DITHER_HIFREQ_THD_R0 (0x074)
+#define DITHER_HIFREQ_THD_R1 (0x078)
+#define DITHER_HIFREQ_THD_G0 (0x07C)
+#define DITHER_HIFREQ_THD_G1 (0x080)
+#define DITHER_HIFREQ_THD_B0 (0x084)
+#define DITHER_HIFREQ_THD_B1 (0x088)
+#define DITHER_HIFREQ_DBG0 (0x08C)
+#define DITHER_HIFREQ_DBG1 (0x090)
+#define DITHER_HIFREQ_DBG2 (0x094)
+#define DITHER_ERRDIFF_CTL (0x098)
+#define DITHER_ERRDIFF_WEIGHT (0x09C)
+#define DITHER_FRC_CTL (0x0A0)
+#define DITHER_FRC_01_PART1 (0x0A4)
+#define DITHER_FRC_01_PART0 (0x0A8)
+#define DITHER_FRC_10_PART1 (0x0AC)
+#define DITHER_FRC_10_PART0 (0x0B0)
+#define DITHER_FRC_11_PART1 (0x0B4)
+#define DITHER_FRC_11_PART0 (0x0B8)
+#define DITHER_MEM_CTRL (0x0BC)
+#define DITHER_DBG0 (0x0C0)
+#define DITHER_DBG1 (0x0C4)
+#define DITHER_DBG2 (0x0C8)
+#define DITHER_CTRL2 (0x0CC)
+
+//Dither for ES
+#define DITHER_PARA_ES (0x000)
+#define DITHER_CTL_ES (0x004)
+#define DITHER_MATRIX_PART1_ES (0x008)
+#define DITHER_MATRIX_PART0_ES (0x00C)
+#define DITHER_ERRDIFF_WEIGHT_ES (0x010)
+#define DITHER_FRC_01_PART1_ES (0x014)
+#define DITHER_FRC_01_PART0_ES (0x018)
+#define DITHER_FRC_10_PART1_ES (0x01C)
+#define DITHER_FRC_10_PART0_ES (0x020)
+#define DITHER_FRC_11_PART1_ES (0x024)
+#define DITHER_FRC_11_PART0_ES (0x028)
+#define DITHER_MEM_CTRL_ES (0x02C)
+#define DITHER_DBG0_ES (0x030)
+#define DITHER_DBG1_ES (0x034)
+#define DITHER_DBG2_ES (0x038)
+
+//CSC_RGB2YUV_10bits  CSC_YUV2RGB_10bits
+
+//GAMA
+#define GAMA_LUT_SEL (0x008)
+#define GAMA_DBG0 (0x00C)
+#define GAMA_DBG1 (0x010)
+
+//ACM for ES
+#define ACM_EN_ES            (0x000)
+#define ACM_SATA_OFFSET_ES   (0x004)
+#define ACM_HUESEL_ES        (0x008)
+#define ACM_CSC_IDC0_ES      (0x00C)
+#define ACM_CSC_IDC1_ES      (0x010)
+#define ACM_CSC_IDC2_ES      (0x014)
+#define ACM_CSC_P00_ES       (0x018)
+#define ACM_CSC_P01_ES       (0x01C)
+#define ACM_CSC_P02_ES       (0x020)
+#define ACM_CSC_P10_ES       (0x024)
+#define ACM_CSC_P11_ES       (0x028)
+#define ACM_CSC_P12_ES       (0x02C)
+#define ACM_CSC_P20_ES       (0x030)
+#define ACM_CSC_P21_ES       (0x034)
+#define ACM_CSC_P22_ES       (0x038)
+#define ACM_CSC_MRREC_ES     (0x03C)
+#define ACM_R0_H_ES          (0x040)
+#define ACM_R1_H_ES          (0x044)
+#define ACM_R2_H_ES          (0x048)
+#define ACM_R3_H_ES          (0x04C)
+#define ACM_R4_H_ES          (0x050)
+#define ACM_R5_H_ES          (0x054)
+#define ACM_R6_H_ES          (0x058)
+#define ACM_LUT_DIS0_ES      (0x05C)
+#define ACM_LUT_DIS1_ES      (0x060)
+#define ACM_LUT_DIS2_ES      (0x064)
+#define ACM_LUT_DIS3_ES      (0x068)
+#define ACM_LUT_DIS4_ES      (0x06C)
+#define ACM_LUT_DIS5_ES      (0x070)
+#define ACM_LUT_DIS6_ES      (0x074)
+#define ACM_LUT_DIS7_ES      (0x078)
+#define ACM_LUT_PARAM0_ES    (0x07C)
+#define ACM_LUT_PARAM1_ES    (0x080)
+#define ACM_LUT_PARAM2_ES    (0x084)
+#define ACM_LUT_PARAM3_ES    (0x088)
+#define ACM_LUT_PARAM4_ES    (0x08C)
+#define ACM_LUT_PARAM5_ES    (0x090)
+#define ACM_LUT_PARAM6_ES    (0x094)
+#define ACM_LUT_PARAM7_ES    (0x098)
+#define ACM_LUT_SEL_ES       (0x09C)
+#define ACM_MEM_CTRL_ES      (0x0A0)
+#define ACM_DEBUG_TOP_ES     (0x0A4)
+#define ACM_DEBUG_CFG_ES     (0x0A8)
+#define ACM_DEBUG_W_ES       (0x0AC)
+
+//ACM
+#define ACM_HUE_RLH01 (0x040)
+#define ACM_HUE_RLH23 (0x044)
+#define ACM_HUE_RLH45 (0x048)
+#define ACM_HUE_RLH67 (0x04C)
+#define ACM_HUE_PARAM01 (0x060)
+#define ACM_HUE_PARAM23 (0x064)
+#define ACM_HUE_PARAM45 (0x068)
+#define ACM_HUE_PARAM67 (0x06C)
+#define ACM_HUE_SMOOTH0 (0x070)
+#define ACM_HUE_SMOOTH1 (0x074)
+#define ACM_HUE_SMOOTH2 (0x078)
+#define ACM_HUE_SMOOTH3 (0x07C)
+#define ACM_HUE_SMOOTH4 (0x080)
+#define ACM_HUE_SMOOTH5 (0x084)
+#define ACM_HUE_SMOOTH6 (0x088)
+#define ACM_HUE_SMOOTH7 (0x08C)
+#define ACM_DBG_TOP (0x0A4)
+#define ACM_DBG_CFG (0x0A8)
+#define ACM_DBG_W (0x0AC)
+#define ACM_COLOR_CHOOSE (0x0B0)
+#define ACM_RGB2YUV_IDC0 (0x0C0)
+#define ACM_RGB2YUV_IDC1 (0x0C4)
+#define ACM_RGB2YUV_IDC2 (0x0C8)
+#define ACM_RGB2YUV_P00 (0x0CC)
+#define ACM_RGB2YUV_P01 (0x0D0)
+#define ACM_RGB2YUV_P02 (0x0D4)
+#define ACM_RGB2YUV_P10 (0x0D8)
+#define ACM_RGB2YUV_P11 (0x0DC)
+#define ACM_RGB2YUV_P12 (0x0E0)
+#define ACM_RGB2YUV_P20 (0x0E4)
+#define ACM_RGB2YUV_P21 (0x0E8)
+#define ACM_RGB2YUV_P22 (0x0EC)
+#define ACM_FACE_CRTL (0x100)
+#define ACM_FACE_STARTXY (0x104)
+#define ACM_FACE_SMOOTH_LEN01 (0x108)
+#define ACM_FACE_SMOOTH_LEN23 (0x10C)
+#define ACM_FACE_SMOOTH_PARAM0 (0x118)
+#define ACM_FACE_SMOOTH_PARAM1 (0x11C)
+#define ACM_FACE_SMOOTH_PARAM2 (0x120)
+#define ACM_FACE_SMOOTH_PARAM3 (0x124)
+#define ACM_FACE_SMOOTH_PARAM4 (0x128)
+#define ACM_FACE_SMOOTH_PARAM5 (0x12C)
+#define ACM_FACE_SMOOTH_PARAM6 (0x130)
+#define ACM_FACE_SMOOTH_PARAM7 (0x134)
+#define ACM_FACE_AREA_SEL (0x138)
+#define ACM_FACE_SAT_LH (0x13C)
+#define ACM_FACE_SAT_SMOOTH_LH (0x140)
+#define ACM_FACE_SAT_SMO_PARAM_LH (0x148)
+#define ACM_L_CONT_EN (0x160)
+#define ACM_LC_PARAM01 (0x174)
+#define ACM_LC_PARAM23 (0x178)
+#define ACM_LC_PARAM45 (0x17C)
+#define ACM_LC_PARAM67 (0x180)
+#define ACM_L_ADJ_CTRL (0x1A0)
+#define ACM_CAPTURE_CTRL (0x1B0)
+#define ACM_CAPTURE_IN (0x1B4)
+#define ACM_CAPTURE_OUT (0x1B8)
+#define ACM_INK_CTRL (0x1C0)
+#define ACM_INK_OUT (0x1C4)
+
+//ACE FOR ES
+
+//LCP
+#define LCP_GMP_BYPASS_EN_ES	(0x030)
+#define LCP_XCC_BYPASS_EN_ES	(0x034)
+#define LCP_DEGAMA_EN_ES	(0x038)
+#define LCP_DEGAMA_MEM_CTRL_ES	(0x03C)
+#define LCP_GMP_MEM_CTRL_ES	(0x040)
+
+//XCC
+#define XCC_COEF_00 (0x000)
+#define XCC_COEF_01 (0x004)
+#define XCC_COEF_02 (0x008)
+#define XCC_COEF_03 (0x00C)
+#define XCC_COEF_10 (0x010)
+#define XCC_COEF_11 (0x014)
+#define XCC_COEF_12 (0x018)
+#define XCC_COEF_13 (0x01C)
+#define XCC_COEF_20 (0x020)
+#define XCC_COEF_21 (0x024)
+#define XCC_COEF_22 (0x028)
+#define XCC_COEF_23 (0x02C)
+#define XCC_EN (0x034)
+
+//DEGAMMA
+#define DEGAMA_EN (0x000)
+#define DEGAMA_MEM_CTRL (0x004)
+#define DEGAMA_LUT_SEL (0x008)
+#define DEGAMA_DBG0 (0x00C)
+#define DEGAMA_DBG1 (0x010)
+
+//GMP
+#define GMP_EN (0x000)
+#define GMP_MEM_CTRL (0x004)
+#define GMP_LUT_SEL (0x008)
+#define GMP_DBG_W0 (0x00C)
+#define GMP_DBG_R0 (0x010)
+#define GMP_DBG_R1 (0x014)
+#define GMP_DBG_R2 (0x018)
+
+//ARSR1P ES
+#define ARSR1P_IHLEFT_ES		(0x000)
+#define ARSR1P_IHRIGHT_ES          (0x004)
+#define ARSR1P_IHLEFT1_ES          (0x008)
+#define ARSR1P_IHRIGHT1_ES         (0x00C)
+#define ARSR1P_IVTOP_ES            (0x010)
+#define ARSR1P_IVBOTTOM_ES         (0x014)
+#define ARSR1P_UV_OFFSET_ES		(0x018)
+#define ARSR1P_IHINC_ES            (0x01C)
+#define ARSR1P_IVINC_ES            (0x020)
+#define ARSR1P_MODE_ES		(0x024)
+#define ARSR1P_FORMAT_ES           (0x028)
+#define ARSR1P_SKIN_THRES_Y_ES	(0x02C)
+#define ARSR1P_SKIN_THRES_U_ES	(0x030)
+#define ARSR1P_SKIN_THRES_V_ES	(0x034)
+#define ARSR1P_SKIN_EXPECTED_ES    (0x038)
+#define ARSR1P_SKIN_CFG_ES		(0x03C)
+#define ARSR1P_SHOOT_CFG1_ES		(0x040)
+#define ARSR1P_SHOOT_CFG2_ES		(0x044)
+#define ARSR1P_SHARP_CFG1_ES		(0x048)
+#define ARSR1P_SHARP_CFG2_ES		(0x04C)
+#define ARSR1P_SHARP_CFG3_ES		(0x050)
+#define ARSR1P_SHARP_CFG4_ES		(0x054)
+#define ARSR1P_SHARP_CFG5_ES		(0x058)
+#define ARSR1P_SHARP_CFG6_ES		(0x05C)
+#define ARSR1P_SHARP_CFG7_ES		(0x060)
+#define ARSR1P_SHARP_CFG8_ES		(0x064)
+#define ARSR1P_SHARP_CFG9_ES		(0x068)
+#define ARSR1P_SHARP_CFG10_ES		(0x06C)
+#define ARSR1P_SHARP_CFG11_ES		(0x070)
+#define ARSR1P_DIFF_CTRL_ES		(0x074)
+#define ARSR1P_LSC_CFG1_ES         (0x078)
+#define ARSR1P_LSC_CFG2_ES         (0x07C)
+#define ARSR1P_LSC_CFG3_ES         (0x080)
+#define ARSR1P_FORCE_CLK_ON_CFG_ES	(0x084)
+
+//ARSR1P
+
+#define ARSR_POST_IHLEFT (0x000)
+#define ARSR_POST_IHRIGHT (0x004)
+#define ARSR_POST_IHLEFT1 (0x008)
+#define ARSR_POST_IHRIGHT1 (0x00C)
+#define ARSR_POST_IVTOP (0x010)
+#define ARSR_POST_IVBOTTOM (0x014)
+#define ARSR_POST_UV_OFFSET (0x018)
+#define ARSR_POST_IHINC (0x01C)
+#define ARSR_POST_IVINC (0x020)
+#define ARSR_POST_MODE (0x024)
+#define ARSR_POST_FORMAT (0x028)
+#define ARSR_POST_SKIN_THRES_Y (0x02C)
+#define ARSR_POST_SKIN_THRES_U (0x030)
+#define ARSR_POST_SKIN_THRES_V (0x034)
+#define ARSR_POST_SKIN_EXPECTED (0x038)
+#define ARSR_POST_SKIN_CFG (0x03C)
+#define ARSR_POST_SHOOT_CFG1 (0x040)
+#define ARSR_POST_SHOOT_CFG2 (0x044)
+#define ARSR_POST_SHOOT_CFG3 (0x048)
+#define ARSR_POST_SHARP_CFG1_H (0x04C)
+#define ARSR_POST_SHARP_CFG1_L (0x050)
+#define ARSR_POST_SHARP_CFG2_H (0x054)
+#define ARSR_POST_SHARP_CFG2_L (0x058)
+#define ARSR_POST_SHARP_CFG3 (0x05C)
+#define ARSR_POST_SHARP_CFG4 (0x060)
+#define ARSR_POST_SHARP_CFG5 (0x064)
+#define ARSR_POST_SHARP_CFG6 (0x068)
+#define ARSR_POST_SHARP_CFG6_CUT (0x06C)
+#define ARSR_POST_SHARP_CFG7 (0x070)
+#define ARSR_POST_SHARP_CFG7_RATIO (0x074)
+#define ARSR_POST_SHARP_CFG8 (0x078)
+#define ARSR_POST_SHARP_CFG9 (0x07C)
+#define ARSR_POST_SHARP_CFG10 (0x080)
+#define ARSR_POST_SHARP_CFG11 (0x084)
+#define ARSR_POST_DIFF_CTRL (0x088)
+#define ARSR_POST_SKIN_SLOP_Y (0x08C)
+#define ARSR_POST_SKIN_SLOP_U (0x090)
+#define ARSR_POST_SKIN_SLOP_V (0x094)
+#define ARSR_POST_FORCE_CLK_ON_CFG (0x098)
+#define ARSR_POST_DEBUG_RW_0 (0x09C)
+#define ARSR_POST_DEBUG_RW_1 (0x0A0)
+#define ARSR_POST_DEBUG_RW_2 (0x0A4)
+#define ARSR_POST_DEBUG_RO_0 (0x0A8)
+#define ARSR_POST_DEBUG_RO_1 (0x0AC)
+#define ARSR_POST_DEBUG_RO_2 (0x0B0)
+
+/* BIT EXT */
+
+//GAMA PRE LUT
+#define U_GAMA_PRE_R_COEF	(0x000)
+#define U_GAMA_PRE_G_COEF	(0x400)
+#define U_GAMA_PRE_B_COEF	(0x800)
+#define U_GAMA_PRE_R_LAST_COEF (0x200)
+#define U_GAMA_PRE_G_LAST_COEF (0x600)
+#define U_GAMA_PRE_B_LAST_COEF (0xA00)
+
+//ACM LUT
+#define ACM_U_ACM_SATR_FACE_COEF (0x500)
+#define ACM_U_ACM_LTA_COEF (0x580)
+#define ACM_U_ACM_LTR0_COEF (0x600)
+#define ACM_U_ACM_LTR1_COEF (0x640)
+#define ACM_U_ACM_LTR2_COEF (0x680)
+#define ACM_U_ACM_LTR3_COEF (0x6C0)
+#define ACM_U_ACM_LTR4_COEF (0x700)
+#define ACM_U_ACM_LTR5_COEF (0x740)
+#define ACM_U_ACM_LTR6_COEF (0x780)
+#define ACM_U_ACM_LTR7_COEF (0x7C0)
+#define ACM_U_ACM_LH0_COFF (0x800)
+#define ACM_U_ACM_LH1_COFF (0x880)
+#define ACM_U_ACM_LH2_COFF (0x900)
+#define ACM_U_ACM_LH3_COFF (0x980)
+#define ACM_U_ACM_LH4_COFF (0xA00)
+#define ACM_U_ACM_LH5_COFF (0xA80)
+#define ACM_U_ACM_LH6_COFF (0xB00)
+#define ACM_U_ACM_LH7_COFF (0xB80)
+#define ACM_U_ACM_CH0_COFF (0xC00)
+#define ACM_U_ACM_CH1_COFF (0xC80)
+#define ACM_U_ACM_CH2_COFF (0xD00)
+#define ACM_U_ACM_CH3_COFF (0xD80)
+#define ACM_U_ACM_CH4_COFF (0xE00)
+#define ACM_U_ACM_CH5_COFF (0xE80)
+#define ACM_U_ACM_CH6_COFF (0xF00)
+#define ACM_U_ACM_CH7_COFF (0xF80)
+
+//LCP LUT
+#define GMP_U_GMP_COEF	(0x0000)
+
+#define U_DEGAMA_R_COEF	(0x0000)
+#define U_DEGAMA_G_COEF	(0x0400)
+#define U_DEGAMA_B_COEF	(0x0800)
+#define U_DEGAMA_R_LAST_COEF (0x0200)
+#define U_DEGAMA_G_LAST_COEF (0x0600)
+#define U_DEGAMA_B_LAST_COEF (0x0A00)
+
+//ARSR1P LUT for ES
+#define ARSR1P_LSC_GAIN_ES		(0x084)  //0xB07C+0x4*range27
+#define ARSR1P_COEFF_H_Y0_ES	(0x0F0)  //0xB0E8+0x4*range9
+#define ARSR1P_COEFF_H_Y1_ES	(0x114)  //0xB10C+0x4*range9
+#define ARSR1P_COEFF_V_Y0_ES	(0x138)  //0xB130+0x4*range9
+#define ARSR1P_COEFF_V_Y1_ES	(0x15C)  //0xB154+0x4*range9
+#define ARSR1P_COEFF_H_UV0_ES	(0x180)  //0xB178+0x4*range9
+#define ARSR1P_COEFF_H_UV1_ES	(0x1A4)  //0xB19C+0x4*range9
+#define ARSR1P_COEFF_V_UV0_ES	(0x1C8)  //0xB1C0+0x4*range9
+#define ARSR1P_COEFF_V_UV1_ES	(0x1EC)  //0xB1E4+0x4*range9
+
+//ARSR1P LUT
+#define ARSR_POST_COEFF_H_Y0	(0x0F0)  //0xB0E8+0x4*range9
+#define ARSR_POST_COEFF_H_Y1	(0x114)  //0xB10C+0x4*range9
+#define ARSR_POST_COEFF_V_Y0	(0x138)  //0xB130+0x4*range9
+#define ARSR_POST_COEFF_V_Y1	(0x15C)  //0xB154+0x4*range9
+#define ARSR_POST_COEFF_H_UV0	(0x180)  //0xB178+0x4*range9
+#define ARSR_POST_COEFF_H_UV1	(0x1A4)  //0xB19C+0x4*range9
+#define ARSR_POST_COEFF_V_UV0	(0x1C8)  //0xB1C0+0x4*range9
+#define ARSR_POST_COEFF_V_UV1	(0x1EC)  //0xB1E4+0x4*range9
+
+//DPE
+#define DPE_INT_STAT (0x0000)
+#define DPE_INT_UNMASK (0x0004)
+#define DPE_BYPASS_ACE (0x0008)
+#define DPE_BYPASS_ACE_STAT (0x000c)
+#define DPE_UPDATE_LOCAL (0x0010)
+#define DPE_LOCAL_VALID (0x0014)
+#define DPE_GAMMA_AB_SHADOW (0x0018)
+#define DPE_GAMMA_AB_WORK (0x001c)
+#define DPE_GLOBAL_HIST_AB_SHADOW (0x0020)
+#define DPE_GLOBAL_HIST_AB_WORK (0x0024)
+#define DPE_IMAGE_INFO (0x0030)
+#define DPE_HALF_BLOCK_INFO (0x0034)
+#define DPE_XYWEIGHT (0x0038)
+#define DPE_LHIST_SFT (0x003c)
+#define DPE_ROI_START_POINT (0x0040)
+#define DPE_ROI_WIDTH_HIGH (0x0044)
+#define DPE_ROI_MODE_CTRL (0x0048)
+#define DPE_ROI_HIST_STAT_MODE (0x004c)
+#define DPE_HUE (0x0050)
+#define DPE_SATURATION (0x0054)
+#define DPE_VALUE (0x0058)
+#define DPE_SKIN_GAIN (0x005c)
+#define DPE_UP_LOW_TH (0x0060)
+#define DPE_RGB_BLEND_WEIGHT (0x0064)
+#define DPE_FNA_STATISTIC (0x0068)
+#define DPE_UP_CNT (0x0070)
+#define DPE_LOW_CNT (0x0074)
+#define DPE_SUM_SATURATION (0x0078)
+#define DPE_GLOBAL_HIST_LUT_ADDR (0x0080)
+#define DPE_LHIST_EN (0x0100)
+#define DPE_LOCAL_HIST_VxHy_2z_2z1 (0x0104)
+#define DPE_GAMMA_EN (0x0108)
+#define DPE_GAMMA_W (0x0108)
+#define DPE_GAMMA_R (0x0110)
+#define DPE_GAMMA_VxHy_3z2_3z1_3z_W (0x010c)
+#define DPE_GAMMA_EN_HV_R (0x0110)
+#define DPE_GAMMA_VxHy_3z2_3z1_3z_R (0x0114)
+#define DPE_INIT_GAMMA (0x0120)
+#define DPE_MANUAL_RELOAD (0x0124)
+#define DPE_RAMCLK_FUNC (0x0128)
+#define DPE_CLK_GATE (0x012c)
+#define DPE_GAMMA_RAM_A_CFG_MEM_CTRL (0x0130)
+#define DPE_GAMMA_RAM_B_CFG_MEM_CTRL (0x0134)
+#define DPE_LHIST_RAM_CFG_MEM_CTRL (0x0138)
+#define DPE_GAMMA_RAM_A_CFG_PM_CTRL (0x0140)
+#define DPE_GAMMA_RAM_B_CFG_PM_CTRL (0x0144)
+#define DPE_LHIST_RAM_CFG_PM_CTRL (0x0148)
+#define DPE_SAT_GLOBAL_HIST_LUT_ADDR (0x0180)
+#define DPE_FNA_EN (0x0200)
+#define DPE_FNA_ADDR (0x0200)
+#define DPE_FNA_DATA (0x0204)
+#define DPE_FNA_VxHy (0x0204)
+#define DPE_UPDATE_FNA (0x0208)
+#define DPE_FNA_VALID (0x0210)
+#define DPE_DB_PIPE_CFG (0x0220)
+#define DPE_DB_PIPE_EXT_WIDTH (0x0224)
+#define DPE_DB_PIPE_FULL_IMG_WIDTH (0x0228)
+#define DPE_ACE_DBG0 (0x0300)
+#define DPE_ACE_DBG1 (0x0304)
+#define DPE_ACE_DBG2 (0x0308)
+#define DPE_BYPASS_NR (0x0400)
+#define DPE_S3_SOME_BRIGHTNESS01 (0x0410)
+#define DPE_S3_SOME_BRIGHTNESS23 (0x0414)
+#define DPE_S3_SOME_BRIGHTNESS4 (0x0418)
+#define DPE_S3_MIN_MAX_SIGMA (0x0420)
+#define DPE_S3_GREEN_SIGMA03 (0x0430)
+#define DPE_S3_GREEN_SIGMA45 (0x0434)
+#define DPE_S3_RED_SIGMA03 (0x0440)
+#define DPE_S3_RED_SIGMA45 (0x0444)
+#define DPE_S3_BLUE_SIGMA03 (0x0450)
+#define DPE_S3_BLUE_SIGMA45 (0x0454)
+#define DPE_S3_WHITE_SIGMA03 (0x0460)
+#define DPE_S3_WHITE_SIGMA45 (0x0464)
+#define DPE_S3_FILTER_LEVEL (0x0470)
+#define DPE_S3_SIMILARITY_COEFF (0x0474)
+#define DPE_S3_V_FILTER_WEIGHT_ADJ (0x0478)
+#define DPE_S3_HUE (0x0480)
+#define DPE_S3_SATURATION (0x0484)
+#define DPE_S3_VALUE (0x0488)
+#define DPE_S3_SKIN_GAIN (0x048c)
+#define DPE_NR_RAMCLK_FUNC (0x0490)
+#define DPE_NR_CLK_GATE (0x0494)
+#define DPE_NR_RAM_A_CFG_MEM_CTRL (0x0498)
+#define DPE_NR_RAM_A_CFG_PM_CTRL (0x049c)
+
+/* IFBC */
+
+/* LDI */
+#define LDI_DP_DSI_SEL		(0x0080)
+
+/* MIPI DSI */
+
+#define AUTO_ULPS_MODE	(0x00E0)
+#define AUTO_ULPS_ENTER_DELAY	(0x00E4)
+#define AUTO_ULPS_WAKEUP_TIME	(0x00E8)
+#define AUTO_ULPS_MIN_TIME  (0xF8)
+#define DSI_MEM_CTRL  (0x0194)
+#define DSI_PM_CTRL  (0x0198)
+#define DSI_DEBUG  (0x019C)
+
+/* MMBUF */
+
+//MEDIA_CRG
+#define MEDIA_PEREN0	(0x000)
+#define MEDIA_PERDIS0	(0x004)
+#define MEDIA_PERDIS1	(0x014)
+#define MEDIA_PERDIS2	(0x024)
+#define MEDIA_PERRSTEN0	(0x030)
+#define MEDIA_PERRSTDIS0	(0x034)
+#define MEDIA_PERRSTDIS1	(0x040)
+#define MEDIA_CLKDIV8  (0x080)
+#define MEDIA_CLKDIV9  (0x084)
+#define MEDIA_PEREN1	(0x010)
+#define MEDIA_PEREN2	(0x020)
+#define PERRSTEN_GENERAL_SEC (0xA00)
+#define PERRSTDIS_GENERAL_SEC (0xA04)
+
+#endif
drivers/staging/hikey9xx/gpu/kirin9xx_dpe.h new file +2437 -0
new file mode 100644
index 000000000000..9139647e9fe5
@@ -0,0 +1,2437 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+/*
+ * Copyright (c) 2016 Linaro Limited.
+ * Copyright (c) 2014-2016 Hisilicon Limited.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#ifndef __KIRIN_DPE_H__
+#define __KIRIN_DPE_H__
+
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+#include <linux/device.h>
+#include <linux/kernel.h>
+#include <linux/wait.h>
+#include <linux/bug.h>
+#include <linux/iommu.h>
+#include <linux/regulator/consumer.h>
+#include <linux/regulator/driver.h>
+#include <linux/regulator/machine.h>
+
+#include <drm/drm_plane.h>
+#include <drm/drm_crtc.h>
+
+/* vcc name */
+#define REGULATOR_PDP_NAME	"ldo3"
+
+enum dss_chn_idx {
+	DSS_RCHN_NONE = -1,
+	DSS_RCHN_D2 = 0,
+	DSS_RCHN_D3,
+	DSS_RCHN_V0,
+	DSS_RCHN_G0,
+	DSS_RCHN_V1,
+	DSS_RCHN_G1,
+	DSS_RCHN_D0,
+	DSS_RCHN_D1,
+
+	DSS_WCHN_W0,
+	DSS_WCHN_W1,
+
+	DSS_CHN_MAX,
+
+	DSS_RCHN_V2 = DSS_CHN_MAX,  /*for copybit, only supported in chicago*/
+	DSS_WCHN_W2,
+
+	DSS_COPYBIT_MAX,
+};
+
+struct dss_rect_ltrb {
+	s32 left;
+	s32 top;
+	s32 right;
+	s32 bottom;
+};
+
+enum {
+	DSI_1_LANES = 0,
+	DSI_2_LANES,
+	DSI_3_LANES,
+	DSI_4_LANES,
+};
+
+enum dss_ovl_idx {
+	DSS_OVL0 = 0,
+	DSS_OVL1,
+	DSS_OVL2,
+	DSS_OVL3,
+	DSS_OVL_IDX_MAX,
+};
+
+enum lcd_orientation {
+	LCD_LANDSCAPE = 0,
+	LCD_PORTRAIT,
+};
+
+enum lcd_format {
+	LCD_RGB888 = 0,
+	LCD_RGB101010,
+	LCD_RGB565,
+};
+
+enum lcd_rgb_order {
+	LCD_RGB = 0,
+	LCD_BGR,
+};
+
+enum dss_addr {
+	DSS_ADDR_PLANE0 = 0,
+	DSS_ADDR_PLANE1,
+	DSS_ADDR_PLANE2,
+};
+
+enum dss_transform {
+	DSS_TRANSFORM_NOP = 0x0,
+	DSS_TRANSFORM_FLIP_H = 0x01,
+	DSS_TRANSFORM_FLIP_V = 0x02,
+	DSS_TRANSFORM_ROT = 0x04,
+};
+
+enum dss_dfc_format {
+	DFC_PIXEL_FORMAT_RGB_565 = 0,
+	DFC_PIXEL_FORMAT_XRGB_4444,
+	DFC_PIXEL_FORMAT_ARGB_4444,
+	DFC_PIXEL_FORMAT_XRGB_5551,
+	DFC_PIXEL_FORMAT_ARGB_5551,
+	DFC_PIXEL_FORMAT_XRGB_8888,
+	DFC_PIXEL_FORMAT_ARGB_8888,
+	DFC_PIXEL_FORMAT_BGR_565,
+	DFC_PIXEL_FORMAT_XBGR_4444,
+	DFC_PIXEL_FORMAT_ABGR_4444,
+	DFC_PIXEL_FORMAT_XBGR_5551,
+	DFC_PIXEL_FORMAT_ABGR_5551,
+	DFC_PIXEL_FORMAT_XBGR_8888,
+	DFC_PIXEL_FORMAT_ABGR_8888,
+
+	DFC_PIXEL_FORMAT_YUV444,
+	DFC_PIXEL_FORMAT_YVU444,
+	DFC_PIXEL_FORMAT_YUYV422,
+	DFC_PIXEL_FORMAT_YVYU422,
+	DFC_PIXEL_FORMAT_VYUY422,
+	DFC_PIXEL_FORMAT_UYVY422,
+};
+
+enum dss_dma_format {
+	DMA_PIXEL_FORMAT_RGB_565 = 0,
+	DMA_PIXEL_FORMAT_ARGB_4444,
+	DMA_PIXEL_FORMAT_XRGB_4444,
+	DMA_PIXEL_FORMAT_ARGB_5551,
+	DMA_PIXEL_FORMAT_XRGB_5551,
+	DMA_PIXEL_FORMAT_ARGB_8888,
+	DMA_PIXEL_FORMAT_XRGB_8888,
+
+	DMA_PIXEL_FORMAT_RESERVED0,
+
+	DMA_PIXEL_FORMAT_YUYV_422_Pkg,
+	DMA_PIXEL_FORMAT_YUV_420_SP_HP,
+	DMA_PIXEL_FORMAT_YUV_420_P_HP,
+	DMA_PIXEL_FORMAT_YUV_422_SP_HP,
+	DMA_PIXEL_FORMAT_YUV_422_P_HP,
+	DMA_PIXEL_FORMAT_AYUV_4444,
+};
+
+enum dss_buf_format {
+	DSS_BUF_LINEAR = 0,
+	DSS_BUF_TILE,
+};
+
+enum dss_blend_mode {
+	DSS_BLEND_CLEAR = 0,
+	DSS_BLEND_SRC,
+	DSS_BLEND_DST,
+	DSS_BLEND_SRC_OVER_DST,
+	DSS_BLEND_DST_OVER_SRC,
+	DSS_BLEND_SRC_IN_DST,
+	DSS_BLEND_DST_IN_SRC,
+	DSS_BLEND_SRC_OUT_DST,
+	DSS_BLEND_DST_OUT_SRC,
+	DSS_BLEND_SRC_ATOP_DST,
+	DSS_BLEND_DST_ATOP_SRC,
+	DSS_BLEND_SRC_XOR_DST,
+	DSS_BLEND_SRC_ADD_DST,
+	DSS_BLEND_FIX_OVER,
+	DSS_BLEND_FIX_PER0,
+	DSS_BLEND_FIX_PER1,
+	DSS_BLEND_FIX_PER2,
+	DSS_BLEND_FIX_PER3,
+	DSS_BLEND_FIX_PER4,
+	DSS_BLEND_FIX_PER5,
+	DSS_BLEND_FIX_PER6,
+	DSS_BLEND_FIX_PER7,
+	DSS_BLEND_FIX_PER8,
+	DSS_BLEND_FIX_PER9,
+	DSS_BLEND_FIX_PER10,
+	DSS_BLEND_FIX_PER11,
+	DSS_BLEND_FIX_PER12,
+	DSS_BLEND_FIX_PER13,
+	DSS_BLEND_FIX_PER14,
+	DSS_BLEND_FIX_PER15,
+	DSS_BLEND_FIX_PER16,
+	DSS_BLEND_FIX_PER17,
+
+	DSS_BLEND_MAX,
+};
+
+enum dss_chn_cap {
+	MODULE_CAP_ROT,
+	MODULE_CAP_SCL,
+	MODULE_CAP_CSC,
+	MODULE_CAP_SHARPNESS_1D,
+	MODULE_CAP_SHARPNESS_2D,
+	MODULE_CAP_CE,
+	MODULE_CAP_AFBCD,
+	MODULE_CAP_AFBCE,
+	MODULE_CAP_YUV_PLANAR,
+	MODULE_CAP_YUV_SEMI_PLANAR,
+	MODULE_CAP_YUV_PACKAGE,
+	MODULE_CAP_MAX,
+};
+
+enum dss_ovl_module {
+	MODULE_OVL_BASE,
+	MODULE_MCTL_BASE,
+	MODULE_OVL_MAX,
+};
+
+enum dss_axi_idx {
+	AXI_CHN0 = 0,
+	AXI_CHN1,
+	AXI_CHN_MAX,
+};
+
+enum dss_rdma_idx {
+	DSS_RDMA0 = 0,
+	DSS_RDMA1,
+	DSS_RDMA2,
+	DSS_RDMA3,
+	DSS_RDMA4,
+	DSS_RDMA_MAX,
+};
+
+enum dss_chn_module {
+	MODULE_MIF_CHN,
+	MODULE_AIF0_CHN,
+	MODULE_AIF1_CHN,
+	MODULE_MCTL_CHN_MUTEX,
+	MODULE_MCTL_CHN_FLUSH_EN,
+	MODULE_MCTL_CHN_OV_OEN,
+	MODULE_MCTL_CHN_STARTY,
+	MODULE_MCTL_CHN_MOD_DBG,
+	MODULE_DMA,
+	MODULE_DFC,
+	MODULE_SCL,
+	MODULE_SCL_LUT,
+	MODULE_ARSR2P,
+	MODULE_ARSR2P_LUT,
+	MODULE_POST_CLIP,
+	MODULE_PCSC,
+	MODULE_CSC,
+	MODULE_POST_CLIP_ES,	/* Only for Kirin 970 */
+	MODULE_CHN_MAX,
+};
+
+
+/*****************************************************************************/
+
+#define FB_ACCEL_HI62xx	0x1
+#define FB_ACCEL_HI363x	0x2
+#define FB_ACCEL_HI365x	0x4
+#define FB_ACCEL_HI625x	0x8
+#define FB_ACCEL_HI366x	0x10
+#define FB_ACCEL_KIRIN970_ES  0x20
+#define FB_ACCEL_KIRIN970  0x40
+#define FB_ACCEL_KIRIN660  0x80
+#define FB_ACCEL_KIRIN980_ES  0x100
+#define FB_ACCEL_KIRIN980  0x200
+#define FB_ACCEL_PLATFORM_TYPE_FPGA     0x10000000   //FPGA
+#define FB_ACCEL_PLATFORM_TYPE_ASIC     0x20000000   //ASIC
+
+/* Kirin 970 specific data from MPI DSI */
+
+#define KIRIN970_DSI_MEM_CTRL	(0x0194)
+#define KIRIN970_PHY_MODE	(0xFC)
+
+/******************************************************************************/
+
+#define DSS_WCH_MAX  (2)
+
+/******************************************************************************/
+
+#define DEFAULT_MIPI_CLK_RATE	(192 * 100000L)
+#define DEFAULT_PCLK_DSI_RATE	(120 * 1000000L)
+
+#define DSS_MAX_PXL0_CLK_144M (144000000UL)
+
+#define DSS_ADDR  0xE8600000
+#define DSS_DSI_ADDR	(DSS_ADDR + 0x01000)
+#define DSS_LDI_ADDR	(DSS_ADDR + 0x7d000)
+#define PMC_BASE	(0xFFF31000)
+#define PERI_CRG_BASE	(0xFFF35000)
+#define SCTRL_BASE	(0xFFF0A000)
+#define PCTRL_BASE		(0xE8A09000)
+
+#define GPIO_LCD_POWER_1V2  (54)
+#define GPIO_LCD_STANDBY    (67)
+#define GPIO_LCD_RESETN     (65)
+#define GPIO_LCD_GATING     (60)
+#define GPIO_LCD_PCLK_GATING (58)
+#define GPIO_LCD_REFCLK_GATING (59)
+#define GPIO_LCD_SPICS         (168)
+#define GPIO_LCD_DRV_EN        (73)
+
+#define GPIO_PG_SEL_A (72)
+#define GPIO_TX_RX_A (74)
+#define GPIO_PG_SEL_B (76)
+#define GPIO_TX_RX_B (78)
+
+/******************************************************************************/
+
+#define DEFAULT_DSS_CORE_CLK_08V_RATE	(535000000UL)
+#define DEFAULT_DSS_CORE_CLK_07V_RATE	(400000000UL)
+#define DEFAULT_DSS_CORE_CLK_RATE_L1	(300000000UL)
+#define DEFAULT_DSS_MMBUF_CLK_RATE_L1	(238000000UL)
+
+#define DEFAULT_PCLK_DSS_RATE	(114000000UL)
+#define DEFAULT_PCLK_PCTRL_RATE	(80000000UL)
+#define DSS_MAX_PXL0_CLK_288M (288000000UL)
+
+/*dss clk power off */
+#define DEFAULT_DSS_CORE_CLK_RATE_POWER_OFF	(277000000UL)
+#define DEFAULT_DSS_PXL1_CLK_RATE_POWER_OFF	(238000000UL)
+
+#define MMBUF_SIZE_MAX	(288 * 1024)
+#define HISI_DSS_CMDLIST_MAX	(16)
+#define HISI_DSS_CMDLIST_IDXS_MAX (0xFFFF)
+#define HISI_DSS_COPYBIT_CMDLIST_IDXS	 (0xC000)
+#define HISI_DSS_DPP_MAX_SUPPORT_BIT (0x7ff)
+#define HISIFB_DSS_PLATFORM_TYPE  (FB_ACCEL_HI366x | FB_ACCEL_PLATFORM_TYPE_ASIC)
+
+#define DSS_MIF_SMMU_SMRX_IDX_STEP (16)
+#define CRG_PERI_DIS3_DEFAULT_VAL     (0x0002F000)
+#define SCF_LINE_BUF	(2560)
+#define DSS_GLB_MODULE_CLK_SEL_DEFAULT_VAL  (0xF0000008)
+#define DSS_LDI_CLK_SEL_DEFAULT_VAL    (0x00000004)
+#define DSS_DBUF_MEM_CTRL_DEFAULT_VAL  (0x00000008)
+#define DSS_SMMU_RLD_EN0_DEFAULT_VAL    (0xffffffff)
+#define DSS_SMMU_RLD_EN1_DEFAULT_VAL    (0xffffff8f)
+#define DSS_SMMU_OUTSTANDING_VAL		(0xf)
+#define DSS_MIF_CTRL2_INVAL_SEL3_STRIDE_MASK		(0xc)
+#define DSS_AFBCE_ENC_OS_CFG_DEFAULT_VAL			(0x7)
+#define TUI_SEC_RCH			(DSS_RCHN_V0)
+#define DSS_CHN_MAX_DEFINE (DSS_COPYBIT_MAX)
+
+/* perf stat */
+#define DSS_DEVMEM_PERF_BASE (0xFDF10000)
+#define CRG_PERIPH_APB_PERRSTSTAT0_REG (0x68)
+#define CRG_PERIPH_APB_IP_RST_PERF_STAT_BIT (18)
+#define PERF_SAMPSTOP_REG (0x10)
+#define DEVMEM_PERF_SIZE (0x100)
+
+/* dp clock used for hdmi */
+#define DEFAULT_AUXCLK_DPCTRL_RATE	16000000UL
+#define DEFAULT_ACLK_DPCTRL_RATE_ES	288000000UL
+#define DEFAULT_ACLK_DPCTRL_RATE_CS	207000000UL
+#define DEFAULT_MIDIA_PPLL7_CLOCK_FREQ	1782000000UL
+
+#define KIRIN970_VCO_MIN_FREQ_OUTPUT         1000000 /*Boston: 1000 * 1000*/
+#define KIRIN970_SYS_19M2   19200 /*Boston: 19.2f * 1000 */
+
+#define MIDIA_PPLL7_CTRL0	0x50c
+#define MIDIA_PPLL7_CTRL1	0x510
+
+#define MIDIA_PPLL7_FREQ_DEVIDER_MASK	GENMASK(25, 2)
+#define MIDIA_PPLL7_FRAC_MODE_MASK	GENMASK(25, 0)
+
+#define ACCESS_REGISTER_FN_MAIN_ID_HDCP           0xc500aa01
+#define ACCESS_REGISTER_FN_SUB_ID_HDCP_CTRL   (0x55bbccf1)
+#define ACCESS_REGISTER_FN_SUB_ID_HDCP_INT   (0x55bbccf2)
+
+/* DSS Registers */
+
+/* MACROS */
+#define DSS_WIDTH(width)	((width) - 1)
+#define DSS_HEIGHT(height)	((height) - 1)
+
+#define RES_540P	(960 * 540)
+#define RES_720P	(1280 * 720)
+#define RES_1080P	(1920 * 1080)
+#define RES_1200P	(1920 * 1200)
+#define RES_1440P	(2560 * 1440)
+#define RES_1600P	(2560 * 1600)
+#define RES_4K_PHONE	(3840 * 2160)
+#define RES_4K_PAD	(3840 * 2400)
+
+#define DFC_MAX_CLIP_NUM	(31)
+
+/* for DFS */
+/* 1480 * 144bits */
+#define DFS_TIME	(80)
+#define DFS_TIME_MIN	(50)
+#define DFS_TIME_MIN_4K	(10)
+#define DBUF0_DEPTH	(1408)
+#define DBUF1_DEPTH	(512)
+#define DBUF_WIDTH_BIT	(144)
+
+#define GET_THD_RQOS_IN(max_depth)	((max_depth) * 10 / 100)
+#define GET_THD_RQOS_OUT(max_depth)	((max_depth) * 30 / 100)
+#define GET_THD_WQOS_IN(max_depth)	((max_depth) * 95 / 100)
+#define GET_THD_WQOS_OUT(max_depth)	((max_depth) * 70 / 100)
+#define GET_THD_CG_IN(max_depth)	((max_depth) - 1)
+#define GET_THD_CG_OUT(max_depth)	((max_depth) * 70 / 100)
+#define GET_FLUX_REQ_IN(max_depth)	((max_depth) * 50 / 100)
+#define GET_FLUX_REQ_OUT(max_depth)	((max_depth) * 90 / 100)
+#define GET_THD_OTHER_DFS_CG_HOLD(max_depth)	(0x20)
+#define GET_THD_OTHER_WR_WAIT(max_depth)	((max_depth) * 90 / 100)
+
+#define GET_RDMA_ROT_HQOS_ASSERT_LEV(max_depth)	((max_depth) * 30 / 100)
+#define GET_RDMA_ROT_HQOS_REMOVE_LEV(max_depth)	((max_depth) * 60 / 100)
+
+#define AXI0_MAX_DSS_CHN_THRESHOLD	(3)
+#define AXI1_MAX_DSS_CHN_THRESHOLD	(3)
+
+#define DEFAULT_AXI_CLK_RATE0	(120 * 1000000)
+#define DEFAULT_AXI_CLK_RATE1	(240 * 1000000)
+#define DEFAULT_AXI_CLK_RATE2	(360 * 1000000)
+#define DEFAULT_AXI_CLK_RATE3	(480 * 1000000)
+#define DEFAULT_AXI_CLK_RATE4	(667 * 1000000)
+#define DEFAULT_AXI_CLK_RATE5	(800 * 1000000)
+
+/*****************************************************************************/
+
+#define PEREN0	(0x000)
+#define PERDIS0	(0x004)
+#define PEREN2	(0x020)
+#define PERDIS2	(0x024)
+#define PERCLKEN2	(0x028)
+#define PERSTAT2	(0x02C)
+#define PEREN3	(0x030)
+#define PERDIS3	(0x034)
+#define PERCLKEN3	(0x038)
+#define PERSTAT3	(0x03C)
+#define PEREN5	(0x050)
+#define PERDIS5	(0x054)
+#define PERCLKEN5	(0x058)
+#define PERSTAT5	(0x05C)
+#define PERRSTDIS0	(0x064)
+#define PERRSTEN2	(0x078)
+#define PERRSTDIS2	(0x07C)
+#define PERRSTEN3	(0x084)
+#define PERRSTDIS3	(0x088)
+#define PERRSTSTAT3 (0x08c)
+#define PERRSTEN4	(0x090)
+#define PERRSTDIS4	(0x094)
+#define PERRSTSTAT4 (0x098)
+#define CLKDIV3	(0x0B4)
+#define CLKDIV5	(0x0BC)
+#define CLKDIV10	(0x0D0)
+#define CLKDIV18	(0x0F0)
+#define CLKDIV20	(0x0F8)
+#define ISOEN	(0x144)
+#define ISODIS	(0x148)
+#define ISOSTAT	(0x14c)
+#define PERPWREN	(0x150)
+#define PERPWRDIS	(0x154)
+#define PERPWRSTAT (0x158)
+#define PERI_AUTODIV8	(0x380)
+#define PERI_AUTODIV9	(0x384)
+#define PERI_AUTODIV10	(0x388)
+
+#define NOC_POWER_IDLEREQ	(0x380)
+#define NOC_POWER_IDLEACK	(0x384)
+#define NOC_POWER_IDLE	(0x388)
+
+#define SCPERCLKEN1 (0x048)
+#define SCCLKDIV2	(0x258)
+#define SCCLKDIV4	(0x260)
+
+#define PERI_CTRL23	(0x060)
+#define PERI_CTRL29	(0x078)
+#define PERI_CTRL30	(0x07C)
+#define PERI_CTRL32	(0x084)
+#define PERI_STAT0	(0x094)
+#define PERI_STAT1	(0x098)
+#define PERI_STAT16	(0x0D4)
+
+#define PCTRL_DPHYTX_ULPSEXIT1	BIT(4)
+#define PCTRL_DPHYTX_ULPSEXIT0	BIT(3)
+
+#define PCTRL_DPHYTX_CTRL1	BIT(1)
+#define PCTRL_DPHYTX_CTRL0	BIT(0)
+
+/*****************************************************************************/
+
+#define BIT_DSS_GLB_INTS	BIT(30)
+#define BIT_MMU_IRPT_S	BIT(29)
+#define BIT_MMU_IRPT_NS	BIT(28)
+#define BIT_DBG_MCTL_INTS	BIT(27)
+#define BIT_DBG_WCH1_INTS	BIT(26)
+#define BIT_DBG_WCH0_INTS	BIT(25)
+#define BIT_DBG_RCH7_INTS	BIT(24)
+#define BIT_DBG_RCH6_INTS	BIT(23)
+#define BIT_DBG_RCH5_INTS	BIT(22)
+#define BIT_DBG_RCH4_INTS	BIT(21)
+#define BIT_DBG_RCH3_INTS	BIT(20)
+#define BIT_DBG_RCH2_INTS	BIT(19)
+#define BIT_DBG_RCH1_INTS	BIT(18)
+#define BIT_DBG_RCH0_INTS	BIT(17)
+#define BIT_ITF0_INTS	BIT(16)
+#define BIT_DPP_INTS	BIT(15)
+#define BIT_CMDLIST13	BIT(14)
+#define BIT_CMDLIST12	BIT(13)
+#define BIT_CMDLIST11	BIT(12)
+#define BIT_CMDLIST10	BIT(11)
+#define BIT_CMDLIST9	BIT(10)
+#define BIT_CMDLIST8	BIT(9)
+#define BIT_CMDLIST7	BIT(8)
+#define BIT_CMDLIST6	BIT(7)
+#define BIT_CMDLIST5	BIT(6)
+#define BIT_CMDLIST4	BIT(5)
+#define BIT_CMDLIST3	BIT(4)
+#define BIT_CMDLIST2	BIT(3)
+#define BIT_CMDLIST1	BIT(2)
+#define BIT_CMDLIST0	BIT(1)
+
+#define BIT_SDP_DSS_GLB_INTS	BIT(29)
+#define BIT_SDP_MMU_IRPT_S	BIT(28)
+#define BIT_SDP_MMU_IRPT_NS	BIT(27)
+#define BIT_SDP_DBG_MCTL_INTS	BIT(26)
+#define BIT_SDP_DBG_WCH1_INTS	BIT(25)
+#define BIT_SDP_DBG_WCH0_INTS	BIT(24)
+#define BIT_SDP_DBG_RCH7_INTS	BIT(23)
+#define BIT_SDP_DBG_RCH6_INTS	BIT(22)
+#define BIT_SDP_DBG_RCH5_INTS	BIT(21)
+#define BIT_SDP_DBG_RCH4_INTS	BIT(20)
+#define BIT_SDP_DBG_RCH3_INTS	BIT(19)
+#define BIT_SDP_DBG_RCH2_INTS	BIT(18)
+#define BIT_SDP_DBG_RCH1_INTS	BIT(17)
+#define BIT_SDP_DBG_RCH0_INTS	BIT(16)
+#define BIT_SDP_ITF1_INTS	BIT(15)
+#define BIT_SDP_CMDLIST13	BIT(14)
+#define BIT_SDP_CMDLIST12	BIT(13)
+#define BIT_SDP_CMDLIST11	BIT(12)
+#define BIT_SDP_CMDLIST10	BIT(11)
+#define BIT_SDP_CMDLIST9	BIT(10)
+#define BIT_SDP_CMDLIST8	BIT(9)
+#define BIT_SDP_CMDLIST7	BIT(8)
+#define BIT_SDP_CMDLIST6	BIT(7)
+#define BIT_SDP_CMDLIST5	BIT(6)
+#define BIT_SDP_CMDLIST4	BIT(5)
+#define BIT_SDP_CMDLIST3	BIT(4)
+#define BIT_SDP_SDP_CMDLIST2	BIT(3)
+#define BIT_SDP_CMDLIST1	BIT(2)
+#define BIT_SDP_CMDLIST0	BIT(1)
+#define BIT_SDP_RCH_CE_INTS	BIT(0)
+
+#define BIT_OFF_DSS_GLB_INTS	BIT(31)
+#define BIT_OFF_MMU_IRPT_S	BIT(30)
+#define BIT_OFF_MMU_IRPT_NS	BIT(29)
+#define BIT_OFF_DBG_MCTL_INTS	BIT(28)
+#define BIT_OFF_DBG_WCH1_INTS	BIT(27)
+#define BIT_OFF_DBG_WCH0_INTS	BIT(26)
+#define BIT_OFF_DBG_RCH7_INTS	BIT(25)
+#define BIT_OFF_DBG_RCH6_INTS	BIT(24)
+#define BIT_OFF_DBG_RCH5_INTS	BIT(23)
+#define BIT_OFF_DBG_RCH4_INTS	BIT(22)
+#define BIT_OFF_DBG_RCH3_INTS	BIT(21)
+#define BIT_OFF_DBG_RCH2_INTS	BIT(20)
+#define BIT_OFF_DBG_RCH1_INTS	BIT(19)
+#define BIT_OFF_DBG_RCH0_INTS	BIT(18)
+#define BIT_OFF_WCH1_INTS	BIT(17)
+#define BIT_OFF_WCH0_INTS	BIT(16)
+#define BIT_OFF_WCH0_WCH1_FRM_END_INT	BIT(15)
+#define BIT_OFF_CMDLIST13	BIT(14)
+#define BIT_OFF_CMDLIST12	BIT(13)
+#define BIT_OFF_CMDLIST11	BIT(12)
+#define BIT_OFF_CMDLIST10	BIT(11)
+#define BIT_OFF_CMDLIST9	BIT(10)
+#define BIT_OFF_CMDLIST8	BIT(9)
+#define BIT_OFF_CMDLIST7	BIT(8)
+#define BIT_OFF_CMDLIST6	BIT(7)
+#define BIT_OFF_CMDLIST5	BIT(6)
+#define BIT_OFF_CMDLIST4	BIT(5)
+#define BIT_OFF_CMDLIST3	BIT(4)
+#define BIT_OFF_CMDLIST2	BIT(3)
+#define BIT_OFF_CMDLIST1	BIT(2)
+#define BIT_OFF_CMDLIST0	BIT(1)
+#define BIT_OFF_RCH_CE_INTS	BIT(0)
+
+#define BIT_OFF_CAM_DBG_WCH2_INTS	BIT(4)
+#define BIT_OFF_CAM_DBG_RCH8_INTS	BIT(3)
+#define BIT_OFF_CAM_WCH2_FRMEND_INTS  BIT(2)
+#define BIT_OFF_CAM_CMDLIST15_INTS	BIT(1)
+#define BIT_OFF_CAM_CMDLIST14_INTS	BIT(0)
+
+#define BIT_VACTIVE_CNT	BIT(14)
+#define BIT_DSI_TE_TRI	BIT(13)
+#define BIT_LCD_TE0_PIN	BIT(12)
+#define BIT_LCD_TE1_PIN	BIT(11)
+#define BIT_VACTIVE1_END	BIT(10)
+#define BIT_VACTIVE1_START	BIT(9)
+#define BIT_VACTIVE0_END	BIT(8)
+#define BIT_VACTIVE0_START	BIT(7)
+#define BIT_VFRONTPORCH	BIT(6)
+#define BIT_VBACKPORCH	BIT(5)
+#define BIT_VSYNC	BIT(4)
+#define BIT_VFRONTPORCH_END	BIT(3)
+#define BIT_LDI_UNFLOW	BIT(2)
+#define BIT_FRM_END	BIT(1)
+#define BIT_FRM_START	BIT(0)
+
+#define BIT_CTL_FLUSH_EN	BIT(21)
+#define BIT_SCF_FLUSH_EN	BIT(19)
+#define BIT_DPP0_FLUSH_EN	BIT(18)
+#define BIT_DBUF1_FLUSH_EN	BIT(17)
+#define BIT_DBUF0_FLUSH_EN	BIT(16)
+#define BIT_OV3_FLUSH_EN	BIT(15)
+#define BIT_OV2_FLUSH_EN	BIT(14)
+#define BIT_OV1_FLUSH_EN	BIT(13)
+#define BIT_OV0_FLUSH_EN	BIT(12)
+#define BIT_WB1_FLUSH_EN	BIT(11)
+#define BIT_WB0_FLUSH_EN	BIT(10)
+#define BIT_DMA3_FLUSH_EN	BIT(9)
+#define BIT_DMA2_FLUSH_EN	BIT(8)
+#define BIT_DMA1_FLUSH_EN	BIT(7)
+#define BIT_DMA0_FLUSH_EN	BIT(6)
+#define BIT_RGB1_FLUSH_EN	BIT(4)
+#define BIT_RGB0_FLUSH_EN	BIT(3)
+#define BIT_VIG1_FLUSH_EN	BIT(1)
+#define BIT_VIG0_FLUSH_EN	BIT(0)
+
+#define BIT_BUS_DBG_INT	BIT(5)
+#define BIT_CRC_SUM_INT	BIT(4)
+#define BIT_CRC_ITF1_INT	BIT(3)
+#define BIT_CRC_ITF0_INT	BIT(2)
+#define BIT_CRC_OV1_INT	BIT(1)
+#define BIT_CRC_OV0_INT	BIT(0)
+
+#define BIT_SBL_SEND_FRAME_OUT	BIT(19)
+#define BIT_SBL_STOP_FRAME_OUT	BIT(18)
+#define BIT_SBL_BACKLIGHT_OUT	BIT(17)
+#define BIT_SBL_DARKENH_OUT		BIT(16)
+#define BIT_SBL_BRIGHTPTR_OUT	BIT(15)
+#define BIT_STRENGTH_INROI_OUT	BIT(14)
+#define BIT_STRENGTH_OUTROI_OUT	BIT(13)
+#define BIT_DONE_OUT			BIT(12)
+#define BIT_PPROC_DONE_OUT		BIT(11)
+
+#define BIT_HIACE_IND	BIT(8)
+#define BIT_STRENGTH_INTP	BIT(7)
+#define BIT_BACKLIGHT_INTP	BIT(6)
+#define BIT_CE_END_IND	BIT(5)
+#define BIT_CE_CANCEL_IND	BIT(4)
+#define BIT_CE_LUT1_RW_COLLIDE_IND	BIT(3)
+#define BIT_CE_LUT0_RW_COLLIDE_IND	BIT(2)
+#define BIT_CE_HIST1_RW_COLLIDE_IND	BIT(1)
+#define BIT_CE_HIST0_RW_COLLIDE_IND	BIT(0)
+
+/* MODULE BASE ADDRESS */
+
+#define DSS_MIPI_DSI0_OFFSET	(0x00001000)
+#define DSS_MIPI_DSI1_OFFSET	(0x00001400)
+
+#define DSS_GLB0_OFFSET	(0x12000)
+
+#define DSS_DBG_OFFSET	(0x11000)
+
+#define DSS_CMDLIST_OFFSET	(0x2000)
+
+#define DSS_VBIF0_AIF	(0x7000)
+#define DSS_VBIF1_AIF	(0x9000)
+
+#define DSS_MIF_OFFSET	(0xA000)
+
+#define DSS_MCTRL_SYS_OFFSET	(0x10000)
+
+#define DSS_MCTRL_CTL0_OFFSET	(0x10800)
+#define DSS_MCTRL_CTL1_OFFSET	(0x10900)
+#define DSS_MCTRL_CTL2_OFFSET	(0x10A00)
+#define DSS_MCTRL_CTL3_OFFSET	(0x10B00)
+#define DSS_MCTRL_CTL4_OFFSET	(0x10C00)
+#define DSS_MCTRL_CTL5_OFFSET	(0x10D00)
+
+#define DSS_RCH_VG0_DMA_OFFSET	(0x20000)
+#define DSS_RCH_VG0_DFC_OFFSET (0x20100)
+#define DSS_RCH_VG0_SCL_OFFSET	(0x20200)
+#define DSS_RCH_VG0_ARSR_OFFSET	(0x20300)
+#define DSS_RCH_VG0_PCSC_OFFSET	(0x20400)
+#define DSS_RCH_VG0_CSC_OFFSET	(0x20500)
+#define DSS_RCH_VG0_DEBUG_OFFSET	(0x20600)
+#define DSS_RCH_VG0_VPP_OFFSET	(0x20700)
+#define DSS_RCH_VG0_DMA_BUF_OFFSET	(0x20800)
+#define DSS_RCH_VG0_AFBCD_OFFSET	(0x20900)
+#define DSS_RCH_VG0_REG_DEFAULT_OFFSET	(0x20A00)
+#define DSS_RCH_VG0_SCL_LUT_OFFSET	(0x21000)
+#define DSS_RCH_VG0_ARSR_LUT_OFFSET	(0x25000)
+
+#define DSS_RCH_VG1_DMA_OFFSET	(0x28000)
+#define DSS_RCH_VG1_DFC_OFFSET (0x28100)
+#define DSS_RCH_VG1_SCL_OFFSET	(0x28200)
+#define DSS_RCH_VG1_CSC_OFFSET	(0x28500)
+#define DSS_RCH_VG1_DEBUG_OFFSET	(0x28600)
+#define DSS_RCH_VG1_VPP_OFFSET	(0x28700)
+#define DSS_RCH_VG1_DMA_BUF_OFFSET	(0x28800)
+#define DSS_RCH_VG1_AFBCD_OFFSET	(0x28900)
+#define DSS_RCH_VG1_REG_DEFAULT_OFFSET	(0x28A00)
+#define DSS_RCH_VG1_SCL_LUT_OFFSET	(0x29000)
+
+#define DSS_RCH_VG2_DMA_OFFSET	(0x30000)
+#define DSS_RCH_VG2_DFC_OFFSET (0x30100)
+#define DSS_RCH_VG2_SCL_OFFSET	(0x30200)
+#define DSS_RCH_VG2_CSC_OFFSET	(0x30500)
+#define DSS_RCH_VG2_DEBUG_OFFSET	(0x30600)
+#define DSS_RCH_VG2_VPP_OFFSET	(0x30700)
+#define DSS_RCH_VG2_DMA_BUF_OFFSET	(0x30800)
+#define DSS_RCH_VG2_REG_DEFAULT_OFFSET	(0x30A00)
+#define DSS_RCH_VG2_SCL_LUT_OFFSET	(0x31000)
+
+#define DSS_RCH_G0_DMA_OFFSET	(0x38000)
+#define DSS_RCH_G0_DFC_OFFSET	(0x38100)
+#define DSS_RCH_G0_SCL_OFFSET	(0x38200)
+#define DSS_RCH_G0_CSC_OFFSET (0x38500)
+#define DSS_RCH_G0_DEBUG_OFFSET (0x38600)
+#define DSS_RCH_G0_DMA_BUF_OFFSET (0x38800)
+#define DSS_RCH_G0_AFBCD_OFFSET (0x38900)
+#define DSS_RCH_G0_REG_DEFAULT_OFFSET (0x38A00)
+
+#define DSS_RCH_G1_DMA_OFFSET	(0x40000)
+#define DSS_RCH_G1_DFC_OFFSET	(0x40100)
+#define DSS_RCH_G1_SCL_OFFSET	(0x40200)
+#define DSS_RCH_G1_CSC_OFFSET (0x40500)
+#define DSS_RCH_G1_DEBUG_OFFSET (0x40600)
+#define DSS_RCH_G1_DMA_BUF_OFFSET (0x40800)
+#define DSS_RCH_G1_AFBCD_OFFSET (0x40900)
+#define DSS_RCH_G1_REG_DEFAULT_OFFSET (0x40A00)
+
+#define DSS_RCH_D2_DMA_OFFSET	(0x50000)
+#define DSS_RCH_D2_DFC_OFFSET	(0x50100)
+#define DSS_RCH_D2_CSC_OFFSET	(0x50500)
+#define DSS_RCH_D2_DEBUG_OFFSET	(0x50600)
+#define DSS_RCH_D2_DMA_BUF_OFFSET	(0x50800)
+
+#define DSS_RCH_D3_DMA_OFFSET	(0x51000)
+#define DSS_RCH_D3_DFC_OFFSET	(0x51100)
+#define DSS_RCH_D3_CSC_OFFSET	(0x51500)
+#define DSS_RCH_D3_DEBUG_OFFSET	(0x51600)
+#define DSS_RCH_D3_DMA_BUF_OFFSET	(0x51800)
+
+#define DSS_RCH_D0_DMA_OFFSET	(0x52000)
+#define DSS_RCH_D0_DFC_OFFSET	(0x52100)
+#define DSS_RCH_D0_CSC_OFFSET	(0x52500)
+#define DSS_RCH_D0_DEBUG_OFFSET	(0x52600)
+#define DSS_RCH_D0_DMA_BUF_OFFSET	(0x52800)
+#define DSS_RCH_D0_AFBCD_OFFSET	(0x52900)
+
+#define DSS_RCH_D1_DMA_OFFSET	(0x53000)
+#define DSS_RCH_D1_DFC_OFFSET	(0x53100)
+#define DSS_RCH_D1_CSC_OFFSET	(0x53500)
+#define DSS_RCH_D1_DEBUG_OFFSET	(0x53600)
+#define DSS_RCH_D1_DMA_BUF_OFFSET	(0x53800)
+
+#define DSS_WCH0_DMA_OFFSET	(0x5A000)
+#define DSS_WCH0_DFC_OFFSET	(0x5A100)
+#define DSS_WCH0_CSC_OFFSET	(0x5A500)
+#define DSS_WCH0_DEBUG_OFFSET	(0x5A600)
+#define DSS_WCH0_DMA_BUFFER_OFFSET	(0x5A800)
+#define DSS_WCH0_AFBCE_OFFSET	(0x5A900)
+
+#define DSS_WCH1_DMA_OFFSET	(0x5C000)
+#define DSS_WCH1_DFC_OFFSET	(0x5C100)
+#define DSS_WCH1_CSC_OFFSET	(0x5C500)
+#define DSS_WCH1_DEBUG_OFFSET	(0x5C600)
+#define DSS_WCH1_DMA_BUFFER_OFFSET	(0x5C800)
+#define DSS_WCH1_AFBCE_OFFSET	(0x5C900)
+
+#define DSS_WCH2_DMA_OFFSET	(0x5E000)
+#define DSS_WCH2_DFC_OFFSET	(0x5E100)
+#define DSS_WCH2_CSC_OFFSET	(0x5E500)
+#define DSS_WCH2_ROT_OFFSET	(0x5E500)
+#define DSS_WCH2_DEBUG_OFFSET	(0x5E600)
+#define DSS_WCH2_DMA_BUFFER_OFFSET	(0x5E800)
+#define DSS_WCH2_AFBCE_OFFSET	(0x5E900)
+
+#define DSS_OVL0_OFFSET	(0x60000)
+#define DSS_OVL1_OFFSET	(0x60400)
+#define DSS_OVL2_OFFSET	(0x60800)
+#define DSS_OVL3_OFFSET	(0x60C00)
+
+#define DSS_DBUF0_OFFSET	(0x6D000)
+#define DSS_DBUF1_OFFSET	(0x6E000)
+
+#define DSS_HI_ACE_OFFSET	(0x6F000)
+
[… more lines in the raw message]

Lines of this file are not shown. View the raw message.

drivers/staging/hikey9xx/gpu/kirin9xx_drm_dpe_utils.c new file +1178 -0
new file mode 100644
index 000000000000..82a0edb95953

Lines of this file are not shown. View the raw message.

drivers/staging/hikey9xx/gpu/kirin9xx_drm_dpe_utils.h new file +286 -0
new file mode 100644
index 000000000000..444ddc148416

Lines of this file are not shown. View the raw message.

drivers/staging/hikey9xx/gpu/kirin9xx_drm_drv.c new file +368 -0
new file mode 100644
index 000000000000..18fec5a1b59d

Lines of this file are not shown. View the raw message.

drivers/staging/hikey9xx/gpu/kirin9xx_drm_drv.h new file +57 -0
new file mode 100644
index 000000000000..fb33d5826ef8

Lines of this file are not shown. View the raw message.

drivers/staging/hikey9xx/gpu/kirin9xx_drm_dss.c new file +1063 -0
new file mode 100644
index 000000000000..e3a1f85bdbd2

Lines of this file are not shown. View the raw message.

drivers/staging/hikey9xx/gpu/kirin9xx_drm_overlay_utils.c new file +1005 -0
new file mode 100644
index 000000000000..5ac7f4b31d99

Lines of this file are not shown. View the raw message.

drivers/staging/hikey9xx/gpu/kirin9xx_dw_drm_dsi.c new file +2132 -0
new file mode 100644
index 000000000000..49f4b1b9151d

Lines of this file are not shown. View the raw message.

drivers/staging/hikey9xx/gpu/kirin9xx_dw_dsi_reg.h new file +146 -0
new file mode 100644
index 000000000000..c22f237a1262

Lines of this file are not shown. View the raw message.

drivers/staging/hikey9xx/gpu/kirin9xx_fb_panel.h new file +191 -0
new file mode 100644
index 000000000000..2ebf4dd9f09e

Lines of this file are not shown. View the raw message.

drivers/staging/hikey9xx/gpu/kirin9xx_pwm.c new file +404 -0
new file mode 100644
index 000000000000..d686664b8627

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

#86 lore raw
Quoted 4 lines · Sam Ravnborg

Hi Mauro.

It seems my review comments failed to reach dri-devel - likely due to the size of the mail.

Right, some e-mails in this thread went through the dri-devel moderation queue due to their sizes. This mail of yours did as well, because you didn't trim the quoted text (hint, hint).

Signature · 6 lines
Earthling Michel Dänzer               |               https://redhat.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#87 lore raw
In reply to Sam Ravnborg

Hi Sam,

Em Wed, 19 Aug 2020 22:48:00 +0200
Sam Ravnborg <[email protected]> escreveu:

Quoted 4 lines

Hi Mauro.

It seems my review comments failed to reach dri-devel - likely due to the size of the mail.

Probably. It reached here properly.

Quoted 8 lines

Link:
https://lore.kernel.org/linux-devicetree/[email protected]/

I my review feedback I refer to checkpatch a few time. For drivers/gpu/ we have some nice tooling support.
One thing our tooling does for us is running checkpatch every time we apply a patch.

Quoted 8 lines
    checkpatch -q --emacs --strict --show-types

So we expect patches to be more or less checkpatch --strict clean.

"more or less" - as common sense also plays a role. And sometimes checkpatch is just wrong.

Just in case you wondered why checkpatch --strict was requested.

We also use checkpatch --strict for media as a reference, ignoring the things that would make things worse during review :-)

I'll run checkpatch here and ensure that the coding style issues will be properly addressed.

Thanks,
Mauro

#89 lore raw
In reply to Mauro Carvalho Chehab
Quoted 10 lines · Mauro Carvalho Chehab

Yet, I'm submitting it via staging due to the following reasons:

- It depends on the LDO3 power supply, which is provided by a regulator driver that it is currently on staging;
- Due to legal reasons, I need to preserve the authorship of each one responsbile for each patch. So, I need to start from the original patch from Kernel 4.4;
- There are still some problems I need to figure out how to solve:
- The adv7535 can't get EDID data. Maybe it is a timing issue,

     but it requires more research to be sure about how to solve it;

I've seen this on the HiKey960 as well. There is a patch to the adv7533 driver I have to add a mdelay that seems to consistently resolve the timing problem. At some point I mentioned it to one of the maintainers who seems open to having it added, but it seemed silly to submit it until there was a upstream driver that needed such a change. So I think that patch can be submitted as a follow on to this (hopefully cleaned up) series.

Quoted 3 lines

- The driver only accept resolutions on a defined list, as there's a known bug that this driver may have troubles with random resolutions. Probably due to a bug at the pixel clock settings;

So, yes, the SoC clks can't generate proper signals for HDMI frequencies (apparently it's not an issue for panels). There is a fixed set that we can get "close enough" that most monitors will work, but its always a bit iffy (some monitors are strict in what they take).

On the kirin driver, we were able to do a calculation to figure out if the generated frequency would be close enough:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c#n615

I suspect we could do something similar for the hikey960/70, but I've not really had time to dig in deeply there.

Personally, I don't see the allow-list as a problematic short term solution, and again, not sure its worth pushing to staging for.

Quoted 4 lines

- Sometimes (at least with 1080p), it generates LDI underflow errors, which in turn causes the DRM to stop working. That happens for example when using gdm on Wayland and gnome on X11;

Interestingly, I've not seen this on HiKey960 (at least with Android/Surfaceflinger). The original HiKey board does have the trouble where at 1080p the screen sometimes comes up horizontally offset due to the LDI underflow, but the patches to address it have been worse then the problem, so we reverted those.

Quoted 3 lines

- Probably related to the previous issue, when the monitor suspends due to DPMS, it doesn't return back to life.

I don't believe I see this on HiKey960. But if it's the LDI issue on the 970 that may explain it.

Quoted 2 lines

So, IMO, the best is to keep it on staging for a while, until those remaining bugs gets solved.

I'm not sure I see all of these as compelling for pushing it in via staging. And I suspect in the process of submitting the patches for review folks may find the cause of some of the problems you list here.

Quoted 4 lines

I added this series, together with the regulator driver and a few other patches (including a hack to fix a Kernel 5.8 regression at WiFi ) at:

Quoted 8 lines

https://gitlab.freedesktop.org/mchehab_kernel/hikey-970/-/commits/master

Chen Feng (1):
staging: hikey9xx: Add hisilicon DRM driver for hikey960/970

John Stultz (1):
staging: hikey9xx/gpu: port it to work with Kernel v4.9

Nit: This is a display driver and has little to do with the GPU (other then it will eventually live in drivers/gpu/drm/...), so I might suggest using more conventional subject prefix, "drm: hisilicon:"

thanks
-john
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#90 lore raw

Hi John.

Quoted 6 lines
Quoted 2 lines

So, IMO, the best is to keep it on staging for a while, until those remaining bugs gets solved.

I'm not sure I see all of these as compelling for pushing it in via staging. And I suspect in the process of submitting the patches for review folks may find the cause of some of the problems you list here.

There is a tendency to forget drivers in staging, and with the almost constant refactoring that happens in the drm drivers we would end up fixing this driver when a bot trigger an error.
So IMO we need very good reasons to go in via staging.

Sam
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#91 lore raw

Em Wed, 19 Aug 2020 23:25:51 +0200
Sam Ravnborg <[email protected]> escreveu:

Quoted 5 lines

Hi John.

Quoted 3 lines
Quoted 2 lines

So, IMO, the best is to keep it on staging for a while, until those remaining bugs gets solved.

Quoted 8 lines
Quoted 3 lines

I'm not sure I see all of these as compelling for pushing it in via staging. And I suspect in the process of submitting the patches for review folks may find the cause of some of the problems you list here.

There is a tendency to forget drivers in staging, and with the almost constant refactoring that happens in the drm drivers we would end up fixing this driver when a bot trigger an error.
So IMO we need very good reasons to go in via staging.

My plan is to have this driver upstream for 5.10, and getting it out of staging by Kernel 5.11. So, I doubt that the DRM kAPIs would change a lot during those 2 Kernel cycles.

In any case, I'm also fine to have a final patch at the end of this series moving it out of staging. The only thing that, IMHO, prevents it to be out of staging is the LDI underflow. Right now, if no input events reach the driver, DPMS will put the monitor to suspend, and it never returns back from life. I bet that, once we discover the root cause, the fix would be just a couple of lines, but identifying where the problem is can take a while.

Thanks,
Mauro
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#92 lore raw
In reply to John Stultz

Em Wed, 19 Aug 2020 14:13:05 -0700
John Stultz <[email protected]> escreveu:

Quoted 13 lines
Quoted 10 lines · Mauro Carvalho Chehab

Yet, I'm submitting it via staging due to the following reasons:

- It depends on the LDO3 power supply, which is provided by a regulator driver that it is currently on staging;
- Due to legal reasons, I need to preserve the authorship of each one responsbile for each patch. So, I need to start from the original patch from Kernel 4.4;
- There are still some problems I need to figure out how to solve:
- The adv7535 can't get EDID data. Maybe it is a timing issue,

     but it requires more research to be sure about how to solve it;  
Quoted 7 lines

I've seen this on the HiKey960 as well. There is a patch to the adv7533 driver I have to add a mdelay that seems to consistently resolve the timing problem. At some point I mentioned it to one of the maintainers who seems open to having it added, but it seemed silly to submit it until there was a upstream driver that needed such a change. So I think that patch can be submitted as a follow on to this (hopefully cleaned up) series.

Yeah, I saw that mdelay() patch on your tree. While it should be cheap to add a mdelay() or udelay_range() there, I'm not sure if this is just a timing issue or if something else is missing. The 4.9 driver does some extra setups on adv7535 (see the enclosed patch).

I'm wondering if something from that is missing. Btw, IMHO, one interesting setting on the downstream code is support for colorbar test. This was helpful when I was making this driver work upstream, as it could be useful for someone trying to make some other DRM driver using it.

Quoted 10 lines
Quoted 4 lines

- The driver only accept resolutions on a defined list, as there's a known bug that this driver may have troubles with random resolutions. Probably due to a bug at the pixel clock settings;

So, yes, the SoC clks can't generate proper signals for HDMI frequencies (apparently it's not an issue for panels). There is a fixed set that we can get "close enough" that most monitors will work, but its always a bit iffy (some monitors are strict in what they take).

There is an extra logic for Kirin 620 that seems to be validating the frequencies that would be set to the clocks. If they're out of the range, it would return MODE_BAD. I suspect that something similar would be needed for Kirin 970 and 960. With that regards, 970 is different from 960. I actually tried to write a patch for it, but I guess there are still some things missing on my code, for 970.

This patch:

	https://gitlab.freedesktop.org/mchehab_kernel/hikey-970/-/commit/4614415770b33e27a9f15c7dde20895fb750592f

Splits the part of the code which calculates the clk_Hz from the part which sets it. So, now, dss_calculate_clock() checks the pixel clock frequency and adjusts it, if needed.

I have another patch that were checking if the code modified the clock_Hz at dss_crtc_mode_fixup(). With that, it would be easy to return MODE_INVALID if something bad happens. However, such patch didn't work as I would expect, so I ended dropping it.

Quoted 6 lines

On the kirin driver, we were able to do a calculation to figure out if the generated frequency would be close enough:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c#n615

I suspect we could do something similar for the hikey960/70, but I've not really had time to dig in deeply there.

Yeah, I tried something similar to that. Maybe it will work properly for Hikey 960, but Hikey 970 has a much more complex code to setup the pixel clock. On 960, just one clock is set:

	clk_set_rate(ctx->dss_pxl0_clk, clk_Hz);

While, on 970, pxl0 is always set to the same frequency (144 MHz), at least for pixel clocks up to 255 MHz[1], but the code do some complex calculus to setup PLL7 registers using the clock frequency.

[1] pixel clocks above 255 MHz will be rejected anyway, as they'll return MODE_BAD due to the checks if a mode is valid.

Quoted 3 lines

Personally, I don't see the allow-list as a problematic short term solution, and again, not sure its worth pushing to staging for.

Yeah, I guess we can live with that for a while.

Quoted 8 lines
Quoted 5 lines

- Sometimes (at least with 1080p), it generates LDI underflow errors, which in turn causes the DRM to stop working. That happens for example when using gdm on Wayland and gnome on X11;

Interestingly, I've not seen this on HiKey960 (at least with Android/Surfaceflinger).

Here, it happens all the time when the monitor returns back from DPMS suspend. It also happens on some specific cases (X11 x Wayland), console mode + startx, etc.

It sounds to me that it occurs when the driver tries to setup a new resolution. Maybe something needs to be disabled before changing res (and re-enabled afterwards).

Quoted 4 lines

The original HiKey board does have the
trouble where at 1080p the screen sometimes comes up horizontally offset due to the LDI underflow, but the patches to address it have been worse then the problem, so we reverted those.

The "visible" effect on my monitor is that the image disappears, and the monitor complains that there's an "Invalid Mode" at the HDMI signal.

Quoted 7 lines
Quoted 4 lines

- Probably related to the previous issue, when the monitor suspends due to DPMS, it doesn't return back to life.

I don't believe I see this on HiKey960. But if it's the LDI issue on the 970 that may explain it.

Yes, when this happens, I get LDI underflow messages.

Quoted 6 lines
Quoted 2 lines

So, IMO, the best is to keep it on staging for a while, until those remaining bugs gets solved.

I'm not sure I see all of these as compelling for pushing it in via staging. And I suspect in the process of submitting the patches for review folks may find the cause of some of the problems you list here.

Yeah, I hope we can get rid of at least part of those during the review process ;-)

Yet, I'd like to preserve the history. As the enclosed patch shows, maybe there are some hidden gems at the previously existing code.

I may also have done something wrong when converting the driver. So, preserving the history seems to be a good idea to me.

One of the advantages of using staging is that the full history will be preserved at the incremental code at staging, while the final patch moving the code out of staging will have all the changes folded together into a single patch.

That makes easier for people to do a final review on it.

Also, some subsystem maintainers don't like the idea of merging the entire history on their subsystems.

Quoted 3 lines

Nit: This is a display driver and has little to do with the GPU (other then it will eventually live in drivers/gpu/drm/...), so I might suggest using more conventional subject prefix, "drm: hisilicon:"

Ah, OK! I'll change the prefix at the next versions of this series.

Thanks,
Mauro

HACK: Some changes from downstream to adv7511 code

drivers/gpu/drm/bridge/adv7511/adv7511.h +1 -0
index a9bb734366ae..1440c08caf42 100644
@@ -333,6 +333,7 @@ struct adv7511 {
 
 	struct regmap *regmap;
 	struct regmap *regmap_cec;
+	struct regmap *regmap_packet;
 	enum drm_connector_status status;
 	bool powered;
 
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +171 -4

213 lines not on this page · raw message

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#93 lore raw
In reply to Mauro Carvalho Chehab
Quoted 8 lines · Mauro Carvalho Chehab

So, IMO, the best is to keep it on staging for a while, until those remaining bugs gets solved.

I added this series, together with the regulator driver and a few other patches (including a hack to fix a Kernel 5.8 regression at WiFi ) at:

https://gitlab.freedesktop.org/mchehab_kernel/hikey-970/-/commits/master

Sorry, one more small request: Could you create a branch that only has the DRM driver changes in it?

The reason I ask, is that since the HiKey960 isn't affected by the majority of the problems you listed as motivation for going through staging. So if we can validate that your tree works fine on HiKey960, the series can be cleaned up and submitted properly upstream to enable that SoC, and the outstanding 970 issues can be worked out afterwards against mainline.

thanks
-john
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#94 lore raw
Quoted 15 lines · John Stultz
Quoted 8 lines · Mauro Carvalho Chehab

So, IMO, the best is to keep it on staging for a while, until those remaining bugs gets solved.

I added this series, together with the regulator driver and a few other patches (including a hack to fix a Kernel 5.8 regression at WiFi ) at:

https://gitlab.freedesktop.org/mchehab_kernel/hikey-970/-/commits/master

Sorry, one more small request: Could you create a branch that only has the DRM driver changes in it?

Quoted 6 lines

The reason I ask, is that since the HiKey960 isn't affected by the majority of the problems you listed as motivation for going through staging. So if we can validate that your tree works fine on HiKey960, the series can be cleaned up and submitted properly upstream to enable that SoC, and the outstanding 970 issues can be worked out afterwards against mainline.

Just as a heads up, I tried testing your tree with my HiKey960, and after fixing the compat string inconsistency, the drivers seem to load properly. However the drm_hwcomposer seems to have some trouble with the driver:
01-01 00:12:41.456 345 345 E hwc-drm-display-compositor: Commit
test failed for display 0, FIXME
01-01 00:12:41.456 345 345 E hwc-drm-two: Failed to apply the
frame composition ret=-22
01-01 00:12:41.456 351 351 E HWComposer:
presentAndGetReleaseFences: present failed for display 0: BadParameter
(4)

I'll dig in a bit further as to why, but wanted to give you a heads up.

thanks
-john
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#95 lore raw
Quoted 36 lines · John Stultz
Quoted 15 lines · John Stultz
Quoted 8 lines · Mauro Carvalho Chehab

So, IMO, the best is to keep it on staging for a while, until those remaining bugs gets solved.

I added this series, together with the regulator driver and a few other patches (including a hack to fix a Kernel 5.8 regression at WiFi ) at:

https://gitlab.freedesktop.org/mchehab_kernel/hikey-970/-/commits/master

Sorry, one more small request: Could you create a branch that only has the DRM driver changes in it?

Quoted 6 lines

The reason I ask, is that since the HiKey960 isn't affected by the majority of the problems you listed as motivation for going through staging. So if we can validate that your tree works fine on HiKey960, the series can be cleaned up and submitted properly upstream to enable that SoC, and the outstanding 970 issues can be worked out afterwards against mainline.

Just as a heads up, I tried testing your tree with my HiKey960, and after fixing the compat string inconsistency, the drivers seem to load properly. However the drm_hwcomposer seems to have some trouble with the driver:
01-01 00:12:41.456 345 345 E hwc-drm-display-compositor: Commit
test failed for display 0, FIXME
01-01 00:12:41.456 345 345 E hwc-drm-two: Failed to apply the
frame composition ret=-22
01-01 00:12:41.456 351 351 E HWComposer:
presentAndGetReleaseFences: present failed for display 0: BadParameter
(4)

Quoted 1 line

I'll dig in a bit further as to why, but wanted to give you a heads up.

Ok, I've mostly gotten it sorted out:
- You're missing a few color formats.
- And I re-discovered a crash that was already fixed in my tree.

I'll send those patches in a few here.

That said even with the patches I've got on top of your series, I still see a few issues:
1) I'm seeing red-blue swap with your driver. I need to dig a bit to see what the difference is, I know gralloc has a config option for this, and maybe the version of the driver I'm carrying has it wrong?
2) Performance is noticeably worse. Whereas with my tree, I see close to 60fps (that clk issue we mentioned earlier is why it's not exactly
60) in most tests, but with yours it mostly hovers around 30some fps, occasionally speeding up to 40 and then back down.

Obviously with some work I suspect we'll be able to sort these out, but I also do feel that the set you're starting with for upstreaming is pretty old. The driver I'm carrying was heavily refactored around 5.0 to share code with the existing kirin driver, in the hopes of making usptreaming easier, and it seems a shame to throw that out and focus your efforts on the older tree.

But to be fair, I've not had time to upstream the driver myself, and it's obviously your choice on how you spend your time. I am really excited to see your efforts here, regardless of which driver you end up pushing.

thanks
-john

#96 lore raw

Em Wed, 19 Aug 2020 20:28:44 -0700
John Stultz <[email protected]> escreveu:

Quoted 37 lines · John Stultz
Quoted 36 lines · John Stultz
Quoted 15 lines
Quoted 8 lines · Mauro Carvalho Chehab

So, IMO, the best is to keep it on staging for a while, until those remaining bugs gets solved.

I added this series, together with the regulator driver and a few other patches (including a hack to fix a Kernel 5.8 regression at WiFi ) at:

https://gitlab.freedesktop.org/mchehab_kernel/hikey-970/-/commits/master

Sorry, one more small request: Could you create a branch that only has the DRM driver changes in it?

Quoted 6 lines

The reason I ask, is that since the HiKey960 isn't affected by the majority of the problems you listed as motivation for going through staging. So if we can validate that your tree works fine on HiKey960, the series can be cleaned up and submitted properly upstream to enable that SoC, and the outstanding 970 issues can be worked out afterwards against mainline.

Just as a heads up, I tried testing your tree with my HiKey960, and after fixing the compat string inconsistency, the drivers seem to load properly. However the drm_hwcomposer seems to have some trouble with the driver:
01-01 00:12:41.456 345 345 E hwc-drm-display-compositor: Commit
test failed for display 0, FIXME
01-01 00:12:41.456 345 345 E hwc-drm-two: Failed to apply the
frame composition ret=-22
01-01 00:12:41.456 351 351 E HWComposer:
presentAndGetReleaseFences: present failed for display 0: BadParameter
(4)

Quoted 7 lines
Quoted 1 line

I'll dig in a bit further as to why, but wanted to give you a heads up.

Ok, I've mostly gotten it sorted out:
- You're missing a few color formats.
- And I re-discovered a crash that was already fixed in my tree.

I'll send those patches in a few here.

Thank you for the patches! I'll test them with Hikey 970 in order to be sure they're compatible also with such SoC.

Quoted 7 lines

That said even with the patches I've got on top of your series, I still see a few issues:

1) I'm seeing red-blue swap with your driver. I need to dig a bit to see what the difference is, I know gralloc has a config option for this, and maybe the version of the driver I'm carrying has it wrong?

There are some settings at adv7535 with regards to the colormap. The 4.9 fork of it has some different settings. Maybe it could be somehow related to it.

I have here a Hikey 960, but didn't test it yet.

Quoted 4 lines

2) Performance is noticeably worse. Whereas with my tree, I see close to 60fps (that clk issue we mentioned earlier is why it's not exactly
60) in most tests, but with yours it mostly hovers around 30some fps, occasionally speeding up to 40 and then back down.

That's weird, but it could be due to some settings related to CMA, IOMMU and/or AFBC.

Quoted 11 lines

Obviously with some work I suspect we'll be able to sort these out, but I also do feel that the set you're starting with for upstreaming is pretty old. The driver I'm carrying was heavily refactored around 5.0 to share code with the existing kirin driver, in the hopes of making usptreaming easier, and it seems a shame to throw that out and focus your efforts on the older tree.

But to be fair, I've not had time to upstream the driver myself, and it's obviously your choice on how you spend your time. I am really excited to see your efforts here, regardless of which driver you end up pushing.

On a quick look I've done, besides not having support for Hikey 970, the code on your tree seems to have less settings than the original one for Hikey 960. Yet, it should take some time to figure out what those extra settings are doing.

Once I get this driver merged, and have USB support working fine[1], my plan is to compare the version from your tree, and compare with the one I have, in order to cleanup some stuff, check performance and do some other optimizations.

-

[1] this is a little OOT here: USB has been a challenge. Depending on the build, I'm getting an NMI interrupt error when the USB3 stack is loaded (usually at dwc3). The error is ESR_ELx_AET_UC. Unfortunately, it doesn't point to where this error is generated, making very hard to debug it.

Thanks,
Mauro
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#97 lore raw
In reply to John Stultz

Hi John,

Em Wed, 19 Aug 2020 20:28:44 -0700
John Stultz <[email protected]> escreveu:

Quoted 5 lines

That said even with the patches I've got on top of your series, I still see a few issues:
1) I'm seeing red-blue swap with your driver. I need to dig a bit to see what the difference is, I know gralloc has a config option for this, and maybe the version of the driver I'm carrying has it wrong?

Maybe it is due to this:

	drivers/staging/hikey9xx/gpu/kirin9xx_drm_overlay_utils.c:      hal_fmt = HISI_FB_PIXEL_FORMAT_BGRA_8888;/* dss_get_format(fb->pixel_format); */

It sounds to me that someone added a hack hardcoding BGRA_8888 over there.

Btw, I removed the hack, with:

drivers/staging/hikey9xx/gpu/kirin9xx_drm_overlay_utils.c +1 -1
index a68db1a27bbf..ba64aae371e4 100644
@@ -857,7 +857,7 @@ void hisi_fb_pan_display(struct drm_plane *plane)
        rect.right = src_w - 1;
        rect.top = 0;
        rect.bottom = src_h - 1;
-       hal_fmt = HISI_FB_PIXEL_FORMAT_BGRA_8888;/* dss_get_format(fb->pixel_format); */
+       hal_fmt = dss_get_format(fb->format->format);
 
        DRM_DEBUG_DRIVER("channel%d: src:(%d,%d, %dx%d) crtc:(%d,%d, %dx%d), rect(%d,%d,%d,%d),fb:%dx%d, pixel_format=%d, stride=%d, paddr=0x%x, bpp=%d.\n",
                         chn_idx, src_x, src_y, src_w, src_h,

And now red and blue are swapped on my HDMI screen too.

I'll compare this part with your version, but I guess the bug is on this logic.

Thanks,
Mauro

#98 lore raw

Em Mon, 24 Aug 2020 08:49:30 +0200
Mauro Carvalho Chehab <[email protected]> escreveu:

Quoted 37 lines

Hi John,

Em Wed, 19 Aug 2020 20:28:44 -0700
John Stultz <[email protected]> escreveu:

Quoted 5 lines

That said even with the patches I've got on top of your series, I still see a few issues:
1) I'm seeing red-blue swap with your driver. I need to dig a bit to see what the difference is, I know gralloc has a config option for this, and maybe the version of the driver I'm carrying has it wrong?

Maybe it is due to this:

	drivers/staging/hikey9xx/gpu/kirin9xx_drm_overlay_utils.c:      hal_fmt = HISI_FB_PIXEL_FORMAT_BGRA_8888;/* dss_get_format(fb->pixel_format); */

It sounds to me that someone added a hack hardcoding BGRA_8888 over there.

Btw, I removed the hack, with:

drivers/staging/hikey9xx/gpu/kirin9xx_drm_overlay_utils.c +1 -1
index a68db1a27bbf..ba64aae371e4 100644
@@ -857,7 +857,7 @@ void hisi_fb_pan_display(struct drm_plane *plane)
        rect.right = src_w - 1;
        rect.top = 0;
        rect.bottom = src_h - 1;
-       hal_fmt = HISI_FB_PIXEL_FORMAT_BGRA_8888;/* dss_get_format(fb->pixel_format); */
+       hal_fmt = dss_get_format(fb->format->format);
 
        DRM_DEBUG_DRIVER("channel%d: src:(%d,%d, %dx%d) crtc:(%d,%d, %dx%d), rect(%d,%d,%d,%d),fb:%dx%d, pixel_format=%d, stride=%d, paddr=0x%x, bpp=%d.\n",
                         chn_idx, src_x, src_y, src_w, src_h,
Quoted 4 lines

And now red and blue are swapped on my HDMI screen too.

I'll compare this part with your version, but I guess the bug is on this logic.

It sounds to me that the Hikey 960 version on your tree has some color inversion hack, just for ARGB 32 bpp. See:

	static const struct kirin_format dpe_formats[] = {
		{ DRM_FORMAT_RGB565, DPE_RGB_565 },
		{ DRM_FORMAT_BGR565, DPE_BGR_565 },
		{ DRM_FORMAT_XRGB8888, DPE_RGBX_8888 },
		{ DRM_FORMAT_XBGR8888, DPE_BGRX_8888 },
		{ DRM_FORMAT_RGBA8888, DPE_RGBA_8888 },
		{ DRM_FORMAT_BGRA8888, DPE_BGRA_8888 },
		{ DRM_FORMAT_ARGB8888, DPE_BGRA_8888 },
		{ DRM_FORMAT_ABGR8888, DPE_RGBA_8888 },
	};

The last two lines are weird, as they're reverting the byte order, If there's some endiannes issue (which the change from ARGB->ABGR seems to imply), I would expect to have something similar for the other formats as well.

I did some tests here: both FB and X11 sets bpp to 24 bits.

Trying to use "startx -- -depth 32" don't work:

"Default Screen Section" for depth/fbbpp 32/32
[ 129.250] (EE) modeset(0): Given depth (32) is not supported by the driver

Which sounds weird, as the driver announces 32 bit formats. I suspect that this could be related to the valid modes hack at the driver.

Btw, there are some color shift also with --depth 16, but replacing BGR <=> RGB didn't work.

Did you test the different bpp resolutions with the driver on your tree? The enclosed patch makes 24 bits bpp work here.

Thanks,
Mauro

-

[PATCH] staging: kirin9xx/gpu: rework the colorspace mode setting logic

There are some problems when setting the fourcc KMS:
The original code hardcodes BGRA_8888. The real issue here seems to be that the byte order is different than the one for Kirin 620.

Instead of addressing it, the origincla code just used a fixed mode. A port of the Hikey 960 DPE driver based on Kernel 5.0, found at:

https://git.linaro.org/people/john.stultz/android-dev.git/tree/drivers/gpu/drm/hisilicon/kirin/kirin_drm_dpe.c?h=dev/hikey960-mainline-WIP

contains a hack that swaps the byte order for 32-bits ARGB/BRGR (see the last two lines):

		{ DRM_FORMAT_RGB565, DPE_RGB_565 },
		{ DRM_FORMAT_BGR565, DPE_BGR_565 },
		{ DRM_FORMAT_XRGB8888, DPE_RGBX_8888 },
		{ DRM_FORMAT_XBGR8888, DPE_BGRX_8888 },
		{ DRM_FORMAT_RGBA8888, DPE_RGBA_8888 },
		{ DRM_FORMAT_BGRA8888, DPE_BGRA_8888 },
		{ DRM_FORMAT_ARGB8888, DPE_BGRA_8888 },
		{ DRM_FORMAT_ABGR8888, DPE_RGBA_8888 },

But the same change was not applied to other modesets.

The Hikey 960 port was tested with AOSP, which seems to be using ABGR format. Here, the chosen fourcc was XBGR 32 bpp instead. I suspect that the original developer also found a similar issue and decided to hardcode the fourcc format.

That's said, currently the drivers uses some code instead of tables in order to seek for the register settings. The version from John Stultz tre for Kirin 960 that does a better approach of using tables instead of code.

I opted to use the same code as the basis for the new logic, as it makes easier to identify what the driver is actually doing.

drivers/staging/hikey9xx/gpu/kirin9xx_dpe.h +33 -0
index e05522f85df8..26add227c389 100644
@@ -144,6 +144,39 @@ enum dss_dma_format {
 	DMA_PIXEL_FORMAT_AYUV_4444,
 };
 
+enum dpe_fb_format {
+	DPE_RGB_565 = 0,
+	DPE_RGBX_4444,
+	DPE_RGBA_4444,
+	DPE_RGBX_5551,
+	DPE_RGBA_5551,
+	DPE_RGBX_8888,
+	DPE_RGBA_8888,
+	DPE_BGR_565,
+	DPE_BGRX_4444,
+	DPE_BGRA_4444,
+	DPE_BGRX_5551,
+	DPE_BGRA_5551,
+	DPE_BGRX_8888,
+	DPE_BGRA_8888,
+	DPE_YUV_422_I,
+	/* YUV Semi-planar */
+	DPE_YCbCr_422_SP,
+	DPE_YCrCb_422_SP,
+	DPE_YCbCr_420_SP,
+	DPE_YCrCb_420_SP,
+	/* YUV Planar */
+	DPE_YCbCr_422_P,
+	DPE_YCrCb_422_P,
+	DPE_YCbCr_420_P,
+	DPE_YCrCb_420_P,
+	/* YUV Package */
+	DPE_YUYV_422_Pkg,
+	DPE_UYVY_422_Pkg,
+	DPE_YVYU_422_Pkg,
+	DPE_VYUY_422_Pkg,
+};
+
 enum dss_buf_format {
 	DSS_BUF_LINEAR = 0,
 	DSS_BUF_TILE,
drivers/staging/hikey9xx/gpu/kirin9xx_drm_dpe_utils.h +4 -47

70 lines not on this page · raw message

drivers/staging/hikey9xx/gpu/kirin9xx_drm_dss.c +4 -54

82 lines not on this page · raw message

drivers/staging/hikey9xx/gpu/kirin9xx_drm_overlay_utils.c +117 -192

372 lines not on this page · raw message

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#99 lore raw
In reply to John Stultz

Em Wed, 19 Aug 2020 14:36:52 -0700
John Stultz <[email protected]> escreveu:

Quoted 14 lines
Quoted 8 lines · Mauro Carvalho Chehab

So, IMO, the best is to keep it on staging for a while, until those remaining bugs gets solved.

I added this series, together with the regulator driver and a few other patches (including a hack to fix a Kernel 5.8 regression at WiFi ) at:

https://gitlab.freedesktop.org/mchehab_kernel/hikey-970/-/commits/master

Sorry, one more small request: Could you create a branch that only has the DRM driver changes in it?

Quoted 6 lines

The reason I ask, is that since the HiKey960 isn't affected by the majority of the problems you listed as motivation for going through staging. So if we can validate that your tree works fine on HiKey960, the series can be cleaned up and submitted properly upstream to enable that SoC, and the outstanding 970 issues can be worked out afterwards against mainline.

Well, if support for HiKey 960 is OK, I guess what we can do is to not push the patch with DT bindings for hikey970. We should probably fix the color swap thing at the driver first.

From my side, provided that the history is preserved, I don't mind if this is merged:

- via staging tree;
- at dri-devel tree;
- or having a the historic patchsets merged at /staging, with a follow up patch moving it from staging/ into /gpu/drm/.

Thanks,
Mauro
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#100 lore raw

PATCH 1/3 drm: hikey9xx: Fix inconsistent compat string

In reply to Mauro Carvalho Chehab

This is against Mauro's tree here:
https://gitlab.freedesktop.org/mchehab_kernel/hikey-970/-/commits/master/

A previous patch changed this string to be "hisilicon,kirin960-dpe", but there are other place where the code still expects "hisilicon,hi3660-dpe", so change it back.

Cc Mauro Carvalho Chehab <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Manivannan Sadhasivam <[email protected]>
Cc dri-devel <[email protected]>
Cc Liwei Cai <[email protected]>
Cc Xinliang Liu <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Sumit Semwal <[email protected]>
Cc Chen Feng <[email protected]>
---
 drivers/staging/hikey9xx/gpu/kirin9xx_drm_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/hikey9xx/gpu/kirin9xx_drm_drv.c +1 -1
index 18fec5a1b59d..efa5727612f5 100644
@@ -339,7 +339,7 @@ static int kirin_drm_platform_resume(struct platform_device *pdev)
 }
 
 static const struct of_device_id kirin_drm_dt_ids[] = {
-	{ .compatible = "hisilicon,kirin960-dpe",
+	{ .compatible = "hisilicon,hi3660-dpe",
 	  .data = &kirin960_dss_dc_ops,
 	},
 	{ .compatible = "hisilicon,kirin970-dpe",
Signature · 6 lines
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#101 lore raw

PATCH 2/3 drm: kirin9xxx: Add additional color formats

This is against Mauro's tree here:
https://gitlab.freedesktop.org/mchehab_kernel/hikey-970/-/commits/master/

Add support for two color formats (ARGB and ABGR) needed for use with drm_hwcomposer and AOSP.

NOTE: I see Red/Blue swapped colors with this (and yes I did try the obvious swap of formats here, to no luck :), so I need to dig more on whats different from the other driver on this.

But with these formats supported drm_hwcomposer no longer crashes

Cc Mauro Carvalho Chehab <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Manivannan Sadhasivam <[email protected]>
Cc dri-devel <[email protected]>
Cc Liwei Cai <[email protected]>
Cc Xinliang Liu <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Sumit Semwal <[email protected]>
Cc Chen Feng <[email protected]>
---
 drivers/staging/hikey9xx/gpu/kirin9xx_drm_dss.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/staging/hikey9xx/gpu/kirin9xx_drm_dss.c +4 -3
index e3a1f85bdbd2..f2e99c766927 100644
@@ -55,14 +55,15 @@ static const struct dss_format dss_formats[] = {
 	{ DRM_FORMAT_XBGR8888, HISI_FB_PIXEL_FORMAT_BGRX_8888 },
 	{ DRM_FORMAT_RGBA8888, HISI_FB_PIXEL_FORMAT_RGBA_8888 },
 	{ DRM_FORMAT_BGRA8888, HISI_FB_PIXEL_FORMAT_BGRA_8888 },
-	/*{ DRM_FORMAT_ARGB8888,  },*/
-	/*{ DRM_FORMAT_ABGR8888,  },*/
+	{ DRM_FORMAT_ARGB8888, HISI_FB_PIXEL_FORMAT_RGBA_8888 },
+	{ DRM_FORMAT_ABGR8888, HISI_FB_PIXEL_FORMAT_BGRA_8888 },
 };
 
 static const u32 channel_formats1[] = {
 	DRM_FORMAT_RGB565, DRM_FORMAT_BGR565,
 	DRM_FORMAT_XRGB8888, DRM_FORMAT_XBGR8888,
-	DRM_FORMAT_RGBA8888, DRM_FORMAT_BGRA8888
+	DRM_FORMAT_RGBA8888, DRM_FORMAT_BGRA8888,
+	DRM_FORMAT_ARGB8888, DRM_FORMAT_ABGR8888,
 };
 
 u32 dss_get_channel_formats(u8 ch, const u32 **formats)
Signature · 6 lines
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#102 lore raw

PATCH 3/3 drm: hikey9xxx: Fix null pointer crash on reboot

This is against Mauro's tree here:
https://gitlab.freedesktop.org/mchehab_kernel/hikey-970/-/commits/master/

On reboot we see the following crash:

[  608.746787] Unable to handle kernel read from unreadable memory at virtual address 00000000000000a8
...
[  608.822101] CPU: 3 PID: 234 Comm: kworker/3:2 Not tainted 5.8.0-00183-g03481a190c60-dirty #32
[  608.830626] Hardware name: HiKey960 (DT)
[  608.834571] Workqueue: events drm_mode_rmfb_work_fn
[  608.839454] pstate: 80400005 (Nzcv daif +PAN -UAO BTYPE=--)
[  608.845031] pc : drm_gem_fb_get_obj+0x10/0x28
[  608.849390] lr : drm_fb_cma_get_gem_obj+0x10/0x20
[  608.854093] sp : ffffffc012f63b10
[  608.857404] x29: ffffffc012f63b10 x28: ffffff8212282e00
[  608.862716] x27: 0000000000000000 x26: ffffff8217501800
[  608.868027] x25: 0000000000000000 x24: ffffffc012f63d60
[  608.873339] x23: 0000000000000001 x22: ffffff8217504080
[  608.878652] x21: ffffffc0119b9000 x20: ffffff8212282e00
[  608.883963] x19: ffffff82175047c0 x18: ffffffffffffffff
[  608.889275] x17: ffffff8219c97708 x16: ffffff8219c97728
[  608.894586] x15: ffffffc0119b9d08 x14: 0000000000000000
[  608.899898] x13: 0000000000000000 x12: 0000000000000000
[  608.905209] x11: 0000003c00000000 x10: 0000046500000441
[  608.910519] x9 : ffffffc0119b9d08 x8 : ffffffc011bf7000
[  608.915830] x7 : 0000000000000898 x6 : ffffff8217504080
[  608.921142] x5 : ffffff8212282e00 x4 : ffffffc0111935e0
[  608.926454] x3 : 0000000000000000 x2 : ffffffc0119b9d08
[  608.931764] x1 : 0000000000000000 x0 : 0000000000000000
[  608.937079] Call trace:
[  608.939531]  drm_gem_fb_get_obj+0x10/0x28
[  608.943547]  hisi_fb_pan_display+0x50/0x1f8
[  608.947736]  dss_plane_atomic_update+0x10/0x20
[  608.952183]  drm_atomic_helper_commit_planes+0xe0/0x228
[  608.957412]  drm_atomic_helper_commit_tail+0x34/0x80
[  608.962377]  commit_tail+0x150/0x180
[  608.965955]  drm_atomic_helper_commit+0x164/0x178
[  608.970665]  drm_atomic_commit+0x4c/0x60
[  608.974591]  drm_framebuffer_remove+0x3f4/0x440
[  608.979123]  drm_mode_rmfb_work_fn+0x48/0x68
[  608.983398]  process_one_work+0x1ec/0x4b0
[  608.987408]  worker_thread+0x208/0x478
[  608.991160]  kthread+0x140/0x150
[  608.994390]  ret_from_fork+0x10/0x30
[  608.997972] Code: d503233f 71000c3f 540000a8 8b214c01 (f9405420)
[  609.004069] ---[ end trace a837c42fc434e1a4 ]---

Which is due to the plane->state->fb value being null.

Fix this with a solution used in a different version of this patch series.

Cc Mauro Carvalho Chehab <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Manivannan Sadhasivam <[email protected]>
Cc dri-devel <[email protected]>
Cc Liwei Cai <[email protected]>
Cc Xinliang Liu <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Sumit Semwal <[email protected]>
Cc Chen Feng <[email protected]>
---
 drivers/staging/hikey9xx/gpu/kirin9xx_drm_dss.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/staging/hikey9xx/gpu/kirin9xx_drm_dss.c +7 -0
index f2e99c766927..7adbd924bec2 100644
@@ -702,6 +702,13 @@ static int dss_plane_atomic_check(struct drm_plane *plane,
 static void dss_plane_atomic_update(struct drm_plane *plane,
 				    struct drm_plane_state *old_state)
 {
+	struct drm_plane_state *state = plane->state;
+
+	if (!state->fb) {
+		state->visible = false;
+		return;
+	}
+
 	hisi_fb_pan_display(plane);
 }
 
Signature · 6 lines
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#103 lore raw

[PATCH 4/3] drm: hikey9xx: remove wait for VACTIVE IRQ

From: Vincent Donnefort <[email protected]>

A quick add-on to my earlier fixup series as I realized what the performance problem was.

This is against Mauro's tree here:
https://gitlab.freedesktop.org/mchehab_kernel/hikey-970/-/commits/master/

For each display cycle, the Kirin960 display IP will generate a VACTIVE interrupt followed by a VBLANK. During a FBIOPAN ioctl, the driver will then wait for the first one to then wait for the second one. This is an issue when the CPU load is too low: the wait_event() function might trigger a transition to a deep sleep state and then, waking up from that state will take too much time to catch the VBLANK interrupt on time, the difference between those two interrupts being only 60 us.

* Ideal case: ACT VBL

				+                  +
				v                  v
		 ---> wait(ACT) +------> wait(VBL) +-->

* Our case: ACT VBL ACT VBL

				+   +          +   +
				v   v          v   v
		 ---> wait(ACT) +------> wait(VBL) +-->

The wait for VACTIVE IRQ can safely be removed: there is no hardware access performed between the VACTIVE and the VBLANK IRQs.

This behavior has been introduced from 4.11 with the following patch:
a3fbb53f4 drm/atomic: Wait for vblank whenever a plane is added to state.

Cc Mauro Carvalho Chehab <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Manivannan Sadhasivam <[email protected]>
Cc dri-devel <[email protected]>
Cc Liwei Cai <[email protected]>
Cc Xinliang Liu <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Sumit Semwal <[email protected]>
Cc Chen Feng <[email protected]>
[jstultz: hand-ported to Mauro's patch set]
---
 .../hikey9xx/gpu/kirin9xx_drm_dpe_utils.c     |  2 +-
 .../staging/hikey9xx/gpu/kirin9xx_drm_dss.c   |  5 ---
 .../hikey9xx/gpu/kirin9xx_drm_overlay_utils.c | 36 -------------------
 3 files changed, 1 insertion(+), 42 deletions(-)
drivers/staging/hikey9xx/gpu/kirin9xx_drm_dpe_utils.c +1 -1
index 82a0edb95953..cc80689d90c9 100644
@@ -582,7 +582,7 @@ void dpe_interrupt_unmask(struct dss_crtc *acrtc)
 	writel(unmask, dss_base + GLB_CPU_PDP_INT_MSK);
 
 	unmask = ~0;
-	unmask &= ~(BIT_VSYNC | BIT_VACTIVE0_END | BIT_LDI_UNFLOW);
+	unmask &= ~(BIT_VSYNC | BIT_LDI_UNFLOW);
 
 	writel(unmask, dss_base + DSS_LDI0_OFFSET + LDI_CPU_ITF_INT_MSK);
 }
drivers/staging/hikey9xx/gpu/kirin9xx_drm_dss.c +0 -5
index 7adbd924bec2..c99ce7c4d479 100644
@@ -440,11 +440,6 @@ static irqreturn_t dss_irq_handler(int irq, void *data)
 	isr_s1 &= ~(readl(dss_base + GLB_CPU_PDP_INT_MSK));
 	isr_s2 &= ~(readl(dss_base + DSS_LDI0_OFFSET + LDI_CPU_ITF_INT_MSK));
 
-	if (isr_s2 & BIT_VACTIVE0_END) {
-		ctx->vactive0_end_flag++;
-		wake_up_interruptible_all(&ctx->vactive0_end_wq);
-	}
-
 	if (isr_s2 & BIT_VSYNC) {
 		ctx->vsync_timestamp = ktime_get();
 		drm_crtc_handle_vblank(crtc);
drivers/staging/hikey9xx/gpu/kirin9xx_drm_overlay_utils.c +0 -36
index 5ac7f4b31d99..932bad2f428e 100644
@@ -822,40 +822,6 @@ void hisifb_mctl_sw_clr(struct dss_crtc *acrtc)
 	DRM_INFO("-.\n");
 }
 
-static int hisi_dss_wait_for_complete(struct dss_crtc *acrtc)
-{
-	int ret = 0;
-	u32 times = 0;
-	u32 prev_vactive0_end = 0;
-	struct dss_hw_ctx *ctx = acrtc->ctx;
-
-	prev_vactive0_end = ctx->vactive0_end_flag;
-
-REDO:
-	ret = wait_event_interruptible_timeout(ctx->vactive0_end_wq,
-					       (prev_vactive0_end != ctx->vactive0_end_flag),
-		msecs_to_jiffies(300));
-	if (ret == -ERESTARTSYS) {
-		if (times < 50) {
-			times++;
-			mdelay(10);
-			goto REDO;
-		}
-	}
-
-	if (ret <= 0) {
-		disable_ldi(acrtc);
-		hisifb_mctl_sw_clr(acrtc);
-		DRM_ERROR("wait_for vactive0_end_flag timeout! ret=%d.\n", ret);
-
-		ret = -ETIMEDOUT;
-	} else {
-		ret = 0;
-	}
-
-	return ret;
-}
-
 void hisi_fb_pan_display(struct drm_plane *plane)
 {
 	struct drm_plane_state *state = plane->state;
@@ -932,7 +898,6 @@ void hisi_fb_pan_display(struct drm_plane *plane)
 	hisi_dss_unflow_handler(ctx, true);
 
 	enable_ldi(acrtc);
-	hisi_dss_wait_for_complete(acrtc);
 }
 
 void hisi_dss_online_play(struct kirin_fbdev *fbdev, struct drm_plane *plane,
@@ -1001,5 +966,4 @@ void hisi_dss_online_play(struct kirin_fbdev *fbdev, struct drm_plane *plane,
 	hisi_dss_unflow_handler(ctx, true);
 
 	enable_ldi(acrtc);
-	hisi_dss_wait_for_complete(acrtc);
 }
Signature · 6 lines
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#104 lore raw

Re: [PATCH 1/3] drm: hikey9xx: Fix inconsistent compat string

In reply to John Stultz

Em Thu, 20 Aug 2020 03:39:39 +0000
John Stultz <[email protected]> escreveu:

Quoted 6 lines

This is against Mauro's tree here:
https://gitlab.freedesktop.org/mchehab_kernel/hikey-970/-/commits/master/

A previous patch changed this string to be "hisilicon,kirin960-dpe", but there are other place where the code still expects "hisilicon,hi3660-dpe", so change it back.

All 4 patches applied fine, and didn't cause any bad side effects for Hikey 970.

So, I'll add them to my series. Thanks!

Thanks,
Mauro
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel