xref: /linux/drivers/media/platform/samsung/exynos-gsc/gsc-regs.h (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (c) 2011 - 2012 Samsung Electronics Co., Ltd.
4  *		http://www.samsung.com
5  *
6  * Register definition file for Samsung G-Scaler driver
7  */
8 
9 #ifndef REGS_GSC_H_
10 #define REGS_GSC_H_
11 
12 /* G-Scaler enable */
13 #define GSC_ENABLE			0x00
14 #define GSC_ENABLE_OP_STATUS		(1 << 2)
15 #define GSC_ENABLE_SFR_UPDATE		(1 << 1)
16 #define GSC_ENABLE_ON			(1 << 0)
17 
18 /* G-Scaler S/W reset */
19 #define GSC_SW_RESET			0x04
20 #define GSC_SW_RESET_SRESET		(1 << 0)
21 
22 /* G-Scaler IRQ */
23 #define GSC_IRQ				0x08
24 #define GSC_IRQ_STATUS_OR_IRQ		(1 << 17)
25 #define GSC_IRQ_STATUS_FRM_DONE_IRQ	(1 << 16)
26 #define GSC_IRQ_FRMDONE_MASK		(1 << 1)
27 #define GSC_IRQ_ENABLE			(1 << 0)
28 
29 /* G-Scaler input control */
30 #define GSC_IN_CON			0x10
31 #define GSC_IN_ROT_MASK			(7 << 16)
32 #define GSC_IN_ROT_270			(7 << 16)
33 #define GSC_IN_ROT_90_YFLIP		(6 << 16)
34 #define GSC_IN_ROT_90_XFLIP		(5 << 16)
35 #define GSC_IN_ROT_90			(4 << 16)
36 #define GSC_IN_ROT_180			(3 << 16)
37 #define GSC_IN_ROT_YFLIP		(2 << 16)
38 #define GSC_IN_ROT_XFLIP		(1 << 16)
39 #define GSC_IN_RGB_TYPE_MASK		(3 << 14)
40 #define GSC_IN_RGB_HD_NARROW		(3 << 14)
41 #define GSC_IN_RGB_HD_WIDE		(2 << 14)
42 #define GSC_IN_RGB_SD_NARROW		(1 << 14)
43 #define GSC_IN_RGB_SD_WIDE		(0 << 14)
44 #define GSC_IN_YUV422_1P_ORDER_MASK	(1 << 13)
45 #define GSC_IN_YUV422_1P_ORDER_LSB_Y	(0 << 13)
46 #define GSC_IN_YUV422_1P_OEDER_LSB_C	(1 << 13)
47 #define GSC_IN_CHROMA_ORDER_MASK	(1 << 12)
48 #define GSC_IN_CHROMA_ORDER_CBCR	(0 << 12)
49 #define GSC_IN_CHROMA_ORDER_CRCB	(1 << 12)
50 #define GSC_IN_FORMAT_MASK		(7 << 8)
51 #define GSC_IN_XRGB8888			(0 << 8)
52 #define GSC_IN_RGB565			(1 << 8)
53 #define GSC_IN_YUV420_2P		(2 << 8)
54 #define GSC_IN_YUV420_3P		(3 << 8)
55 #define GSC_IN_YUV422_1P		(4 << 8)
56 #define GSC_IN_YUV422_2P		(5 << 8)
57 #define GSC_IN_YUV422_3P		(6 << 8)
58 #define GSC_IN_TILE_TYPE_MASK		(1 << 4)
59 #define GSC_IN_TILE_C_16x8		(0 << 4)
60 #define GSC_IN_TILE_MODE		(1 << 3)
61 #define GSC_IN_LOCAL_SEL_MASK		(3 << 1)
62 #define GSC_IN_PATH_MASK		(1 << 0)
63 #define GSC_IN_PATH_MEMORY		(0 << 0)
64 
65 /* G-Scaler source image size */
66 #define GSC_SRCIMG_SIZE			0x14
67 #define GSC_SRCIMG_HEIGHT(x)		((x) << 16)
68 #define GSC_SRCIMG_WIDTH(x)		((x) << 0)
69 
70 /* G-Scaler source image offset */
71 #define GSC_SRCIMG_OFFSET		0x18
72 #define GSC_SRCIMG_OFFSET_Y(x)		((x) << 16)
73 #define GSC_SRCIMG_OFFSET_X(x)		((x) << 0)
74 
75 /* G-Scaler cropped source image size */
76 #define GSC_CROPPED_SIZE		0x1c
77 #define GSC_CROPPED_HEIGHT(x)		((x) << 16)
78 #define GSC_CROPPED_WIDTH(x)		((x) << 0)
79 
80 /* G-Scaler output control */
81 #define GSC_OUT_CON			0x20
82 #define GSC_OUT_GLOBAL_ALPHA_MASK	(0xff << 24)
83 #define GSC_OUT_GLOBAL_ALPHA(x)		((x) << 24)
84 #define GSC_OUT_RGB_TYPE_MASK		(3 << 10)
85 #define GSC_OUT_RGB_HD_WIDE		(3 << 10)
86 #define GSC_OUT_RGB_HD_NARROW		(2 << 10)
87 #define GSC_OUT_RGB_SD_WIDE		(1 << 10)
88 #define GSC_OUT_RGB_SD_NARROW		(0 << 10)
89 #define GSC_OUT_YUV422_1P_ORDER_MASK	(1 << 9)
90 #define GSC_OUT_YUV422_1P_ORDER_LSB_Y	(0 << 9)
91 #define GSC_OUT_YUV422_1P_OEDER_LSB_C	(1 << 9)
92 #define GSC_OUT_CHROMA_ORDER_MASK	(1 << 8)
93 #define GSC_OUT_CHROMA_ORDER_CBCR	(0 << 8)
94 #define GSC_OUT_CHROMA_ORDER_CRCB	(1 << 8)
95 #define GSC_OUT_FORMAT_MASK		(7 << 4)
96 #define GSC_OUT_XRGB8888		(0 << 4)
97 #define GSC_OUT_RGB565			(1 << 4)
98 #define GSC_OUT_YUV420_2P		(2 << 4)
99 #define GSC_OUT_YUV420_3P		(3 << 4)
100 #define GSC_OUT_YUV422_1P		(4 << 4)
101 #define GSC_OUT_YUV422_2P		(5 << 4)
102 #define GSC_OUT_YUV444			(7 << 4)
103 #define GSC_OUT_TILE_TYPE_MASK		(1 << 2)
104 #define GSC_OUT_TILE_C_16x8		(0 << 2)
105 #define GSC_OUT_TILE_MODE		(1 << 1)
106 #define GSC_OUT_PATH_MASK		(1 << 0)
107 #define GSC_OUT_PATH_LOCAL		(1 << 0)
108 #define GSC_OUT_PATH_MEMORY		(0 << 0)
109 
110 /* G-Scaler scaled destination image size */
111 #define GSC_SCALED_SIZE			0x24
112 #define GSC_SCALED_HEIGHT(x)		((x) << 16)
113 #define GSC_SCALED_WIDTH(x)		((x) << 0)
114 
115 /* G-Scaler pre scale ratio */
116 #define GSC_PRE_SCALE_RATIO		0x28
117 #define GSC_PRESC_SHFACTOR(x)		((x) << 28)
118 #define GSC_PRESC_V_RATIO(x)		((x) << 16)
119 #define GSC_PRESC_H_RATIO(x)		((x) << 0)
120 
121 /* G-Scaler main scale horizontal ratio */
122 #define GSC_MAIN_H_RATIO		0x2c
123 #define GSC_MAIN_H_RATIO_VALUE(x)	((x) << 0)
124 
125 /* G-Scaler main scale vertical ratio */
126 #define GSC_MAIN_V_RATIO		0x30
127 #define GSC_MAIN_V_RATIO_VALUE(x)	((x) << 0)
128 
129 /* G-Scaler destination image size */
130 #define GSC_DSTIMG_SIZE			0x40
131 #define GSC_DSTIMG_HEIGHT(x)		((x) << 16)
132 #define GSC_DSTIMG_WIDTH(x)		((x) << 0)
133 
134 /* G-Scaler destination image offset */
135 #define GSC_DSTIMG_OFFSET		0x44
136 #define GSC_DSTIMG_OFFSET_Y(x)		((x) << 16)
137 #define GSC_DSTIMG_OFFSET_X(x)		((x) << 0)
138 
139 /* G-Scaler input y address mask */
140 #define GSC_IN_BASE_ADDR_Y_MASK		0x4c
141 /* G-Scaler input y base address */
142 #define GSC_IN_BASE_ADDR_Y(n)		(0x50 + (n) * 0x4)
143 
144 /* G-Scaler input cb address mask */
145 #define GSC_IN_BASE_ADDR_CB_MASK	0x7c
146 /* G-Scaler input cb base address */
147 #define GSC_IN_BASE_ADDR_CB(n)		(0x80 + (n) * 0x4)
148 
149 /* G-Scaler input cr address mask */
150 #define GSC_IN_BASE_ADDR_CR_MASK	0xac
151 /* G-Scaler input cr base address */
152 #define GSC_IN_BASE_ADDR_CR(n)		(0xb0 + (n) * 0x4)
153 
154 /* G-Scaler output y address mask */
155 #define GSC_OUT_BASE_ADDR_Y_MASK	0x10c
156 /* G-Scaler output y base address */
157 #define GSC_OUT_BASE_ADDR_Y(n)		(0x110 + (n) * 0x4)
158 
159 /* G-Scaler output cb address mask */
160 #define GSC_OUT_BASE_ADDR_CB_MASK	0x15c
161 /* G-Scaler output cb base address */
162 #define GSC_OUT_BASE_ADDR_CB(n)		(0x160 + (n) * 0x4)
163 
164 /* G-Scaler output cr address mask */
165 #define GSC_OUT_BASE_ADDR_CR_MASK	0x1ac
166 /* G-Scaler output cr base address */
167 #define GSC_OUT_BASE_ADDR_CR(n)		(0x1b0 + (n) * 0x4)
168 
169 #endif /* REGS_GSC_H_ */
170