18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright 2016 Linaro Ltd.
48c2ecf20Sopenharmony_ci * Copyright 2016 ZTE Corporation.
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#ifndef __ZX_PLANE_REGS_H__
88c2ecf20Sopenharmony_ci#define __ZX_PLANE_REGS_H__
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci/* GL registers */
118c2ecf20Sopenharmony_ci#define GL_CTRL0			0x00
128c2ecf20Sopenharmony_ci#define GL_UPDATE			BIT(5)
138c2ecf20Sopenharmony_ci#define GL_CTRL1			0x04
148c2ecf20Sopenharmony_ci#define GL_DATA_FMT_SHIFT		0
158c2ecf20Sopenharmony_ci#define GL_DATA_FMT_MASK		(0xf << GL_DATA_FMT_SHIFT)
168c2ecf20Sopenharmony_ci#define GL_FMT_ARGB8888			0
178c2ecf20Sopenharmony_ci#define GL_FMT_RGB888			1
188c2ecf20Sopenharmony_ci#define GL_FMT_RGB565			2
198c2ecf20Sopenharmony_ci#define GL_FMT_ARGB1555			3
208c2ecf20Sopenharmony_ci#define GL_FMT_ARGB4444			4
218c2ecf20Sopenharmony_ci#define GL_CTRL2			0x08
228c2ecf20Sopenharmony_ci#define GL_GLOBAL_ALPHA_SHIFT		8
238c2ecf20Sopenharmony_ci#define GL_GLOBAL_ALPHA_MASK		(0xff << GL_GLOBAL_ALPHA_SHIFT)
248c2ecf20Sopenharmony_ci#define GL_CTRL3			0x0c
258c2ecf20Sopenharmony_ci#define GL_SCALER_BYPASS_MODE		BIT(0)
268c2ecf20Sopenharmony_ci#define GL_STRIDE			0x18
278c2ecf20Sopenharmony_ci#define GL_ADDR				0x1c
288c2ecf20Sopenharmony_ci#define GL_SRC_SIZE			0x38
298c2ecf20Sopenharmony_ci#define GL_SRC_W_SHIFT			16
308c2ecf20Sopenharmony_ci#define GL_SRC_W_MASK			(0x3fff << GL_SRC_W_SHIFT)
318c2ecf20Sopenharmony_ci#define GL_SRC_H_SHIFT			0
328c2ecf20Sopenharmony_ci#define GL_SRC_H_MASK			(0x3fff << GL_SRC_H_SHIFT)
338c2ecf20Sopenharmony_ci#define GL_POS_START			0x9c
348c2ecf20Sopenharmony_ci#define GL_POS_END			0xa0
358c2ecf20Sopenharmony_ci#define GL_POS_X_SHIFT			16
368c2ecf20Sopenharmony_ci#define GL_POS_X_MASK			(0x1fff << GL_POS_X_SHIFT)
378c2ecf20Sopenharmony_ci#define GL_POS_Y_SHIFT			0
388c2ecf20Sopenharmony_ci#define GL_POS_Y_MASK			(0x1fff << GL_POS_Y_SHIFT)
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#define GL_SRC_W(x)	(((x) << GL_SRC_W_SHIFT) & GL_SRC_W_MASK)
418c2ecf20Sopenharmony_ci#define GL_SRC_H(x)	(((x) << GL_SRC_H_SHIFT) & GL_SRC_H_MASK)
428c2ecf20Sopenharmony_ci#define GL_POS_X(x)	(((x) << GL_POS_X_SHIFT) & GL_POS_X_MASK)
438c2ecf20Sopenharmony_ci#define GL_POS_Y(x)	(((x) << GL_POS_Y_SHIFT) & GL_POS_Y_MASK)
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci/* VL registers */
468c2ecf20Sopenharmony_ci#define VL_CTRL0			0x00
478c2ecf20Sopenharmony_ci#define VL_UPDATE			BIT(3)
488c2ecf20Sopenharmony_ci#define VL_CTRL1			0x04
498c2ecf20Sopenharmony_ci#define VL_YUV420_PLANAR		BIT(5)
508c2ecf20Sopenharmony_ci#define VL_YUV422_SHIFT			3
518c2ecf20Sopenharmony_ci#define VL_YUV422_YUYV			(0 << VL_YUV422_SHIFT)
528c2ecf20Sopenharmony_ci#define VL_YUV422_YVYU			(1 << VL_YUV422_SHIFT)
538c2ecf20Sopenharmony_ci#define VL_YUV422_UYVY			(2 << VL_YUV422_SHIFT)
548c2ecf20Sopenharmony_ci#define VL_YUV422_VYUY			(3 << VL_YUV422_SHIFT)
558c2ecf20Sopenharmony_ci#define VL_FMT_YUV420			0
568c2ecf20Sopenharmony_ci#define VL_FMT_YUV422			1
578c2ecf20Sopenharmony_ci#define VL_FMT_YUV420_P010		2
588c2ecf20Sopenharmony_ci#define VL_FMT_YUV420_HANTRO		3
598c2ecf20Sopenharmony_ci#define VL_FMT_YUV444_8BIT		4
608c2ecf20Sopenharmony_ci#define VL_FMT_YUV444_10BIT		5
618c2ecf20Sopenharmony_ci#define VL_CTRL2			0x08
628c2ecf20Sopenharmony_ci#define VL_SCALER_BYPASS_MODE		BIT(0)
638c2ecf20Sopenharmony_ci#define VL_STRIDE			0x0c
648c2ecf20Sopenharmony_ci#define LUMA_STRIDE_SHIFT		16
658c2ecf20Sopenharmony_ci#define LUMA_STRIDE_MASK		(0xffff << LUMA_STRIDE_SHIFT)
668c2ecf20Sopenharmony_ci#define CHROMA_STRIDE_SHIFT		0
678c2ecf20Sopenharmony_ci#define CHROMA_STRIDE_MASK		(0xffff << CHROMA_STRIDE_SHIFT)
688c2ecf20Sopenharmony_ci#define VL_SRC_SIZE			0x10
698c2ecf20Sopenharmony_ci#define VL_Y				0x14
708c2ecf20Sopenharmony_ci#define VL_POS_START			0x30
718c2ecf20Sopenharmony_ci#define VL_POS_END			0x34
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci#define LUMA_STRIDE(x)	 (((x) << LUMA_STRIDE_SHIFT) & LUMA_STRIDE_MASK)
748c2ecf20Sopenharmony_ci#define CHROMA_STRIDE(x) (((x) << CHROMA_STRIDE_SHIFT) & CHROMA_STRIDE_MASK)
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci/* RSZ registers */
778c2ecf20Sopenharmony_ci#define RSZ_SRC_CFG			0x00
788c2ecf20Sopenharmony_ci#define RSZ_DEST_CFG			0x04
798c2ecf20Sopenharmony_ci#define RSZ_ENABLE_CFG			0x14
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci#define RSZ_VL_LUMA_HOR			0x08
828c2ecf20Sopenharmony_ci#define RSZ_VL_LUMA_VER			0x0c
838c2ecf20Sopenharmony_ci#define RSZ_VL_CHROMA_HOR		0x10
848c2ecf20Sopenharmony_ci#define RSZ_VL_CHROMA_VER		0x14
858c2ecf20Sopenharmony_ci#define RSZ_VL_CTRL_CFG			0x18
868c2ecf20Sopenharmony_ci#define RSZ_VL_FMT_SHIFT		3
878c2ecf20Sopenharmony_ci#define RSZ_VL_FMT_MASK			(0x3 << RSZ_VL_FMT_SHIFT)
888c2ecf20Sopenharmony_ci#define RSZ_VL_FMT_YCBCR420		(0x0 << RSZ_VL_FMT_SHIFT)
898c2ecf20Sopenharmony_ci#define RSZ_VL_FMT_YCBCR422		(0x1 << RSZ_VL_FMT_SHIFT)
908c2ecf20Sopenharmony_ci#define RSZ_VL_FMT_YCBCR444		(0x2 << RSZ_VL_FMT_SHIFT)
918c2ecf20Sopenharmony_ci#define RSZ_VL_ENABLE_CFG		0x1c
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci#define RSZ_VER_SHIFT			16
948c2ecf20Sopenharmony_ci#define RSZ_VER_MASK			(0xffff << RSZ_VER_SHIFT)
958c2ecf20Sopenharmony_ci#define RSZ_HOR_SHIFT			0
968c2ecf20Sopenharmony_ci#define RSZ_HOR_MASK			(0xffff << RSZ_HOR_SHIFT)
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci#define RSZ_VER(x)	(((x) << RSZ_VER_SHIFT) & RSZ_VER_MASK)
998c2ecf20Sopenharmony_ci#define RSZ_HOR(x)	(((x) << RSZ_HOR_SHIFT) & RSZ_HOR_MASK)
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci#define RSZ_DATA_STEP_SHIFT		16
1028c2ecf20Sopenharmony_ci#define RSZ_DATA_STEP_MASK		(0xffff << RSZ_DATA_STEP_SHIFT)
1038c2ecf20Sopenharmony_ci#define RSZ_PARA_STEP_SHIFT		0
1048c2ecf20Sopenharmony_ci#define RSZ_PARA_STEP_MASK		(0xffff << RSZ_PARA_STEP_SHIFT)
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci#define RSZ_DATA_STEP(x) (((x) << RSZ_DATA_STEP_SHIFT) & RSZ_DATA_STEP_MASK)
1078c2ecf20Sopenharmony_ci#define RSZ_PARA_STEP(x) (((x) << RSZ_PARA_STEP_SHIFT) & RSZ_PARA_STEP_MASK)
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci/* HBSC registers */
1108c2ecf20Sopenharmony_ci#define HBSC_SATURATION			0x00
1118c2ecf20Sopenharmony_ci#define HBSC_HUE			0x04
1128c2ecf20Sopenharmony_ci#define HBSC_BRIGHT			0x08
1138c2ecf20Sopenharmony_ci#define HBSC_CONTRAST			0x0c
1148c2ecf20Sopenharmony_ci#define HBSC_THRESHOLD_COL1		0x10
1158c2ecf20Sopenharmony_ci#define HBSC_THRESHOLD_COL2		0x14
1168c2ecf20Sopenharmony_ci#define HBSC_THRESHOLD_COL3		0x18
1178c2ecf20Sopenharmony_ci#define HBSC_CTRL0			0x28
1188c2ecf20Sopenharmony_ci#define HBSC_CTRL_EN			BIT(2)
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci#endif /* __ZX_PLANE_REGS_H__ */
121