xref: /linux/drivers/gpu/drm/ingenic/ingenic-ipu.h (revision 4b4193256c8d3bc3a5397b5cd9494c2ad386317d)
1*fc1acf31SPaul Cercueil /* SPDX-License-Identifier: GPL-2.0 */
2*fc1acf31SPaul Cercueil //
3*fc1acf31SPaul Cercueil // Ingenic JZ47xx IPU - Register definitions and private API
4*fc1acf31SPaul Cercueil //
5*fc1acf31SPaul Cercueil // Copyright (C) 2020, Paul Cercueil <paul@crapouillou.net>
6*fc1acf31SPaul Cercueil 
7*fc1acf31SPaul Cercueil #ifndef DRIVERS_GPU_DRM_INGENIC_INGENIC_IPU_H
8*fc1acf31SPaul Cercueil #define DRIVERS_GPU_DRM_INGENIC_INGENIC_IPU_H
9*fc1acf31SPaul Cercueil 
10*fc1acf31SPaul Cercueil #include <linux/bitops.h>
11*fc1acf31SPaul Cercueil 
12*fc1acf31SPaul Cercueil #define JZ_REG_IPU_CTRL			0x00
13*fc1acf31SPaul Cercueil #define JZ_REG_IPU_STATUS		0x04
14*fc1acf31SPaul Cercueil #define JZ_REG_IPU_D_FMT		0x08
15*fc1acf31SPaul Cercueil #define JZ_REG_IPU_Y_ADDR		0x0c
16*fc1acf31SPaul Cercueil #define JZ_REG_IPU_U_ADDR		0x10
17*fc1acf31SPaul Cercueil #define JZ_REG_IPU_V_ADDR		0x14
18*fc1acf31SPaul Cercueil #define JZ_REG_IPU_IN_GS		0x18
19*fc1acf31SPaul Cercueil #define JZ_REG_IPU_Y_STRIDE		0x1c
20*fc1acf31SPaul Cercueil #define JZ_REG_IPU_UV_STRIDE		0x20
21*fc1acf31SPaul Cercueil #define JZ_REG_IPU_OUT_ADDR		0x24
22*fc1acf31SPaul Cercueil #define JZ_REG_IPU_OUT_GS		0x28
23*fc1acf31SPaul Cercueil #define JZ_REG_IPU_OUT_STRIDE		0x2c
24*fc1acf31SPaul Cercueil #define JZ_REG_IPU_RSZ_COEF_INDEX	0x30
25*fc1acf31SPaul Cercueil #define JZ_REG_IPU_CSC_C0_COEF		0x34
26*fc1acf31SPaul Cercueil #define JZ_REG_IPU_CSC_C1_COEF		0x38
27*fc1acf31SPaul Cercueil #define JZ_REG_IPU_CSC_C2_COEF		0x3c
28*fc1acf31SPaul Cercueil #define JZ_REG_IPU_CSC_C3_COEF		0x40
29*fc1acf31SPaul Cercueil #define JZ_REG_IPU_CSC_C4_COEF		0x44
30*fc1acf31SPaul Cercueil #define JZ_REG_IPU_HRSZ_COEF_LUT	0x48
31*fc1acf31SPaul Cercueil #define JZ_REG_IPU_VRSZ_COEF_LUT	0x4c
32*fc1acf31SPaul Cercueil #define JZ_REG_IPU_CSC_OFFSET		0x50
33*fc1acf31SPaul Cercueil #define JZ_REG_IPU_Y_PHY_T_ADDR		0x54
34*fc1acf31SPaul Cercueil #define JZ_REG_IPU_U_PHY_T_ADDR		0x58
35*fc1acf31SPaul Cercueil #define JZ_REG_IPU_V_PHY_T_ADDR		0x5c
36*fc1acf31SPaul Cercueil #define JZ_REG_IPU_OUT_PHY_T_ADDR	0x60
37*fc1acf31SPaul Cercueil 
38*fc1acf31SPaul Cercueil #define JZ_IPU_CTRL_ADDR_SEL		BIT(20)
39*fc1acf31SPaul Cercueil #define JZ_IPU_CTRL_ZOOM_SEL		BIT(18)
40*fc1acf31SPaul Cercueil #define JZ_IPU_CTRL_DFIX_SEL		BIT(17)
41*fc1acf31SPaul Cercueil #define JZ_IPU_CTRL_LCDC_SEL		BIT(11)
42*fc1acf31SPaul Cercueil #define JZ_IPU_CTRL_SPKG_SEL		BIT(10)
43*fc1acf31SPaul Cercueil #define JZ_IPU_CTRL_VSCALE		BIT(9)
44*fc1acf31SPaul Cercueil #define JZ_IPU_CTRL_HSCALE		BIT(8)
45*fc1acf31SPaul Cercueil #define JZ_IPU_CTRL_STOP		BIT(7)
46*fc1acf31SPaul Cercueil #define JZ_IPU_CTRL_RST			BIT(6)
47*fc1acf31SPaul Cercueil #define JZ_IPU_CTRL_FM_IRQ_EN		BIT(5)
48*fc1acf31SPaul Cercueil #define JZ_IPU_CTRL_CSC_EN		BIT(4)
49*fc1acf31SPaul Cercueil #define JZ_IPU_CTRL_VRSZ_EN		BIT(3)
50*fc1acf31SPaul Cercueil #define JZ_IPU_CTRL_HRSZ_EN		BIT(2)
51*fc1acf31SPaul Cercueil #define JZ_IPU_CTRL_RUN			BIT(1)
52*fc1acf31SPaul Cercueil #define JZ_IPU_CTRL_CHIP_EN		BIT(0)
53*fc1acf31SPaul Cercueil 
54*fc1acf31SPaul Cercueil #define JZ_IPU_STATUS_OUT_END		BIT(0)
55*fc1acf31SPaul Cercueil 
56*fc1acf31SPaul Cercueil #define JZ_IPU_IN_GS_H_LSB		0x0
57*fc1acf31SPaul Cercueil #define JZ_IPU_IN_GS_W_LSB		0x10
58*fc1acf31SPaul Cercueil #define JZ_IPU_OUT_GS_H_LSB		0x0
59*fc1acf31SPaul Cercueil #define JZ_IPU_OUT_GS_W_LSB		0x10
60*fc1acf31SPaul Cercueil 
61*fc1acf31SPaul Cercueil #define JZ_IPU_Y_STRIDE_Y_LSB		0
62*fc1acf31SPaul Cercueil #define JZ_IPU_UV_STRIDE_U_LSB		16
63*fc1acf31SPaul Cercueil #define JZ_IPU_UV_STRIDE_V_LSB		0
64*fc1acf31SPaul Cercueil 
65*fc1acf31SPaul Cercueil #define JZ_IPU_D_FMT_IN_FMT_LSB		0
66*fc1acf31SPaul Cercueil #define JZ_IPU_D_FMT_IN_FMT_RGB555	(0x0 << JZ_IPU_D_FMT_IN_FMT_LSB)
67*fc1acf31SPaul Cercueil #define JZ_IPU_D_FMT_IN_FMT_YUV420	(0x0 << JZ_IPU_D_FMT_IN_FMT_LSB)
68*fc1acf31SPaul Cercueil #define JZ_IPU_D_FMT_IN_FMT_YUV422	(0x1 << JZ_IPU_D_FMT_IN_FMT_LSB)
69*fc1acf31SPaul Cercueil #define JZ_IPU_D_FMT_IN_FMT_RGB888	(0x2 << JZ_IPU_D_FMT_IN_FMT_LSB)
70*fc1acf31SPaul Cercueil #define JZ_IPU_D_FMT_IN_FMT_YUV444	(0x2 << JZ_IPU_D_FMT_IN_FMT_LSB)
71*fc1acf31SPaul Cercueil #define JZ_IPU_D_FMT_IN_FMT_RGB565	(0x3 << JZ_IPU_D_FMT_IN_FMT_LSB)
72*fc1acf31SPaul Cercueil 
73*fc1acf31SPaul Cercueil #define JZ_IPU_D_FMT_YUV_FMT_LSB	2
74*fc1acf31SPaul Cercueil #define JZ_IPU_D_FMT_YUV_Y1UY0V		(0x0 << JZ_IPU_D_FMT_YUV_FMT_LSB)
75*fc1acf31SPaul Cercueil #define JZ_IPU_D_FMT_YUV_Y1VY0U		(0x1 << JZ_IPU_D_FMT_YUV_FMT_LSB)
76*fc1acf31SPaul Cercueil #define JZ_IPU_D_FMT_YUV_UY1VY0		(0x2 << JZ_IPU_D_FMT_YUV_FMT_LSB)
77*fc1acf31SPaul Cercueil #define JZ_IPU_D_FMT_YUV_VY1UY0		(0x3 << JZ_IPU_D_FMT_YUV_FMT_LSB)
78*fc1acf31SPaul Cercueil #define JZ_IPU_D_FMT_IN_FMT_YUV411	(0x3 << JZ_IPU_D_FMT_IN_FMT_LSB)
79*fc1acf31SPaul Cercueil 
80*fc1acf31SPaul Cercueil #define JZ_IPU_D_FMT_OUT_FMT_LSB	19
81*fc1acf31SPaul Cercueil #define JZ_IPU_D_FMT_OUT_FMT_RGB555	(0x0 << JZ_IPU_D_FMT_OUT_FMT_LSB)
82*fc1acf31SPaul Cercueil #define JZ_IPU_D_FMT_OUT_FMT_RGB565	(0x1 << JZ_IPU_D_FMT_OUT_FMT_LSB)
83*fc1acf31SPaul Cercueil #define JZ_IPU_D_FMT_OUT_FMT_RGB888	(0x2 << JZ_IPU_D_FMT_OUT_FMT_LSB)
84*fc1acf31SPaul Cercueil #define JZ_IPU_D_FMT_OUT_FMT_YUV422	(0x3 << JZ_IPU_D_FMT_OUT_FMT_LSB)
85*fc1acf31SPaul Cercueil #define JZ_IPU_D_FMT_OUT_FMT_RGBAAA	(0x4 << JZ_IPU_D_FMT_OUT_FMT_LSB)
86*fc1acf31SPaul Cercueil 
87*fc1acf31SPaul Cercueil #define JZ_IPU_D_FMT_RGB_OUT_OFT_LSB	22
88*fc1acf31SPaul Cercueil #define JZ_IPU_D_FMT_RGB_OUT_OFT_RGB	(0x0 << JZ_IPU_D_FMT_RGB_OUT_OFT_LSB)
89*fc1acf31SPaul Cercueil #define JZ_IPU_D_FMT_RGB_OUT_OFT_RBG	(0x1 << JZ_IPU_D_FMT_RGB_OUT_OFT_LSB)
90*fc1acf31SPaul Cercueil #define JZ_IPU_D_FMT_RGB_OUT_OFT_GBR	(0x2 << JZ_IPU_D_FMT_RGB_OUT_OFT_LSB)
91*fc1acf31SPaul Cercueil #define JZ_IPU_D_FMT_RGB_OUT_OFT_GRB	(0x3 << JZ_IPU_D_FMT_RGB_OUT_OFT_LSB)
92*fc1acf31SPaul Cercueil #define JZ_IPU_D_FMT_RGB_OUT_OFT_BRG	(0x4 << JZ_IPU_D_FMT_RGB_OUT_OFT_LSB)
93*fc1acf31SPaul Cercueil #define JZ_IPU_D_FMT_RGB_OUT_OFT_BGR	(0x5 << JZ_IPU_D_FMT_RGB_OUT_OFT_LSB)
94*fc1acf31SPaul Cercueil 
95*fc1acf31SPaul Cercueil #define JZ4725B_IPU_RSZ_LUT_COEF_LSB	2
96*fc1acf31SPaul Cercueil #define JZ4725B_IPU_RSZ_LUT_COEF_MASK	0x7ff
97*fc1acf31SPaul Cercueil #define JZ4725B_IPU_RSZ_LUT_IN_EN	BIT(1)
98*fc1acf31SPaul Cercueil #define JZ4725B_IPU_RSZ_LUT_OUT_EN	BIT(0)
99*fc1acf31SPaul Cercueil 
100*fc1acf31SPaul Cercueil #define JZ4760_IPU_RSZ_COEF20_LSB	6
101*fc1acf31SPaul Cercueil #define JZ4760_IPU_RSZ_COEF31_LSB	17
102*fc1acf31SPaul Cercueil #define JZ4760_IPU_RSZ_COEF_MASK	0x7ff
103*fc1acf31SPaul Cercueil #define JZ4760_IPU_RSZ_OFFSET_LSB	1
104*fc1acf31SPaul Cercueil #define JZ4760_IPU_RSZ_OFFSET_MASK	0x1f
105*fc1acf31SPaul Cercueil 
106*fc1acf31SPaul Cercueil #define JZ_IPU_CSC_OFFSET_CHROMA_LSB	16
107*fc1acf31SPaul Cercueil #define JZ_IPU_CSC_OFFSET_LUMA_LSB	16
108*fc1acf31SPaul Cercueil 
109*fc1acf31SPaul Cercueil #endif /* DRIVERS_GPU_DRM_INGENIC_INGENIC_IPU_H */
110