1
2
3
4
5
6
7
8
9
10
11
12 #ifndef M5MOLS_REG_H
13 #define M5MOLS_REG_H
14
15 #define M5MOLS_I2C_MAX_SIZE 4
16 #define M5MOLS_BYTE_READ 0x01
17 #define M5MOLS_BYTE_WRITE 0x02
18
19 #define I2C_CATEGORY(__cat) ((__cat >> 16) & 0xff)
20 #define I2C_COMMAND(__comm) ((__comm >> 8) & 0xff)
21 #define I2C_SIZE(__reg_s) ((__reg_s) & 0xff)
22 #define I2C_REG(__cat, __cmd, __reg_s) ((__cat << 16) | (__cmd << 8) | __reg_s)
23
24
25
26
27
28
29 #define CAT_SYSTEM 0x00
30 #define CAT_PARAM 0x01
31 #define CAT_MONITOR 0x02
32 #define CAT_AE 0x03
33 #define CAT_WB 0x06
34 #define CAT_EXIF 0x07
35 #define CAT_FD 0x09
36 #define CAT_LENS 0x0a
37 #define CAT_CAPT_PARM 0x0b
38 #define CAT_CAPT_CTRL 0x0c
39 #define CAT_FLASH 0x0f
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54 #define SYSTEM_VER_CUSTOMER I2C_REG(CAT_SYSTEM, 0x00, 1)
55 #define SYSTEM_VER_PROJECT I2C_REG(CAT_SYSTEM, 0x01, 1)
56 #define SYSTEM_VER_FIRMWARE I2C_REG(CAT_SYSTEM, 0x02, 2)
57 #define SYSTEM_VER_HARDWARE I2C_REG(CAT_SYSTEM, 0x04, 2)
58 #define SYSTEM_VER_PARAMETER I2C_REG(CAT_SYSTEM, 0x06, 2)
59 #define SYSTEM_VER_AWB I2C_REG(CAT_SYSTEM, 0x08, 2)
60
61 #define SYSTEM_SYSMODE I2C_REG(CAT_SYSTEM, 0x0b, 1)
62 #define REG_SYSINIT 0x00
63 #define REG_PARAMETER 0x01
64 #define REG_MONITOR 0x02
65 #define REG_CAPTURE 0x03
66
67 #define SYSTEM_CMD(__cmd) I2C_REG(CAT_SYSTEM, cmd, 1)
68 #define SYSTEM_VER_STRING I2C_REG(CAT_SYSTEM, 0x0a, 1)
69 #define REG_SAMSUNG_ELECTRO "SE"
70 #define REG_SAMSUNG_OPTICS "OP"
71 #define REG_SAMSUNG_TECHWIN "TB"
72
73 #define SYSTEM_STATUS I2C_REG(CAT_SYSTEM, 0x0c, 1)
74
75
76 #define SYSTEM_INT_FACTOR I2C_REG(CAT_SYSTEM, 0x10, 1)
77
78 #define SYSTEM_INT_ENABLE I2C_REG(CAT_SYSTEM, 0x11, 1)
79 #define REG_INT_MODE (1 << 0)
80 #define REG_INT_AF (1 << 1)
81 #define REG_INT_ZOOM (1 << 2)
82 #define REG_INT_CAPTURE (1 << 3)
83 #define REG_INT_FRAMESYNC (1 << 4)
84 #define REG_INT_FD (1 << 5)
85 #define REG_INT_LENS_INIT (1 << 6)
86 #define REG_INT_SOUND (1 << 7)
87 #define REG_INT_MASK 0x0f
88
89
90
91
92
93
94
95
96
97
98 #define PARM_MON_SIZE I2C_REG(CAT_PARAM, 0x01, 1)
99
100
101 #define PARM_MON_FPS I2C_REG(CAT_PARAM, 0x02, 1)
102 #define REG_FPS_30 0x02
103
104
105 #define PARM_INTERFACE I2C_REG(CAT_PARAM, 0x00, 1)
106 #define REG_INTERFACE_MIPI 0x02
107
108
109 #define PARM_EFFECT I2C_REG(CAT_PARAM, 0x0b, 1)
110 #define REG_EFFECT_OFF 0x00
111 #define REG_EFFECT_NEGA 0x01
112 #define REG_EFFECT_EMBOSS 0x06
113 #define REG_EFFECT_OUTLINE 0x07
114 #define REG_EFFECT_WATERCOLOR 0x08
115
116
117
118
119
120
121
122
123
124
125
126
127
128 #define MON_ZOOM I2C_REG(CAT_MONITOR, 0x01, 1)
129
130
131 #define MON_CFIXR I2C_REG(CAT_MONITOR, 0x0a, 1)
132
133 #define MON_CFIXB I2C_REG(CAT_MONITOR, 0x09, 1)
134 #define REG_CFIXB_SEPIA 0xd8
135 #define REG_CFIXR_SEPIA 0x18
136
137 #define MON_EFFECT I2C_REG(CAT_MONITOR, 0x0b, 1)
138 #define REG_COLOR_EFFECT_OFF 0x00
139 #define REG_COLOR_EFFECT_ON 0x01
140
141
142 #define MON_CHROMA_EN I2C_REG(CAT_MONITOR, 0x10, 1)
143
144 #define MON_CHROMA_LVL I2C_REG(CAT_MONITOR, 0x0f, 1)
145 #define REG_CHROMA_OFF 0x00
146 #define REG_CHROMA_ON 0x01
147
148
149 #define MON_EDGE_EN I2C_REG(CAT_MONITOR, 0x12, 1)
150
151 #define MON_EDGE_LVL I2C_REG(CAT_MONITOR, 0x11, 1)
152 #define REG_EDGE_OFF 0x00
153 #define REG_EDGE_ON 0x01
154
155
156 #define MON_TONE_CTL I2C_REG(CAT_MONITOR, 0x25, 1)
157
158
159
160
161
162
163
164
165
166
167
168
169
170 #define AE_LOCK I2C_REG(CAT_AE, 0x00, 1)
171 #define REG_AE_UNLOCK 0x00
172 #define REG_AE_LOCK 0x01
173
174
175 #define AE_MODE I2C_REG(CAT_AE, 0x01, 1)
176 #define REG_AE_OFF 0x00
177 #define REG_AE_ALL 0x01
178 #define REG_AE_CENTER 0x03
179 #define REG_AE_SPOT 0x06
180
181 #define AE_ISO I2C_REG(CAT_AE, 0x05, 1)
182 #define REG_ISO_AUTO 0x00
183 #define REG_ISO_50 0x01
184 #define REG_ISO_100 0x02
185 #define REG_ISO_200 0x03
186 #define REG_ISO_400 0x04
187 #define REG_ISO_800 0x05
188
189
190 #define AE_EV_PRESET_MONITOR I2C_REG(CAT_AE, 0x0a, 1)
191
192 #define AE_EV_PRESET_CAPTURE I2C_REG(CAT_AE, 0x0b, 1)
193 #define REG_SCENE_NORMAL 0x00
194 #define REG_SCENE_PORTRAIT 0x01
195 #define REG_SCENE_LANDSCAPE 0x02
196 #define REG_SCENE_SPORTS 0x03
197 #define REG_SCENE_PARTY_INDOOR 0x04
198 #define REG_SCENE_BEACH_SNOW 0x05
199 #define REG_SCENE_SUNSET 0x06
200 #define REG_SCENE_DAWN_DUSK 0x07
201 #define REG_SCENE_FALL 0x08
202 #define REG_SCENE_NIGHT 0x09
203 #define REG_SCENE_AGAINST_LIGHT 0x0a
204 #define REG_SCENE_FIRE 0x0b
205 #define REG_SCENE_TEXT 0x0c
206 #define REG_SCENE_CANDLE 0x0d
207
208
209 #define AE_MAN_GAIN_MON I2C_REG(CAT_AE, 0x12, 2)
210
211 #define AE_MAX_GAIN_MON I2C_REG(CAT_AE, 0x1a, 2)
212
213 #define AE_MAN_GAIN_CAP I2C_REG(CAT_AE, 0x26, 2)
214
215 #define AE_INDEX I2C_REG(CAT_AE, 0x38, 1)
216 #define REG_AE_INDEX_20_NEG 0x00
217 #define REG_AE_INDEX_15_NEG 0x01
218 #define REG_AE_INDEX_10_NEG 0x02
219 #define REG_AE_INDEX_05_NEG 0x03
220 #define REG_AE_INDEX_00 0x04
221 #define REG_AE_INDEX_05_POS 0x05
222 #define REG_AE_INDEX_10_POS 0x06
223 #define REG_AE_INDEX_15_POS 0x07
224 #define REG_AE_INDEX_20_POS 0x08
225
226
227
228
229
230
231 #define AWB_LOCK I2C_REG(CAT_WB, 0x00, 1)
232 #define REG_AWB_UNLOCK 0x00
233 #define REG_AWB_LOCK 0x01
234
235 #define AWB_MODE I2C_REG(CAT_WB, 0x02, 1)
236 #define REG_AWB_AUTO 0x01
237 #define REG_AWB_PRESET 0x02
238
239
240 #define AWB_MANUAL I2C_REG(CAT_WB, 0x03, 1)
241 #define REG_AWB_INCANDESCENT 0x01
242 #define REG_AWB_FLUORESCENT_1 0x02
243 #define REG_AWB_FLUORESCENT_2 0x03
244 #define REG_AWB_DAYLIGHT 0x04
245 #define REG_AWB_CLOUDY 0x05
246 #define REG_AWB_SHADE 0x06
247 #define REG_AWB_HORIZON 0x07
248 #define REG_AWB_LEDLIGHT 0x09
249
250
251
252
253 #define EXIF_INFO_EXPTIME_NU I2C_REG(CAT_EXIF, 0x00, 4)
254 #define EXIF_INFO_EXPTIME_DE I2C_REG(CAT_EXIF, 0x04, 4)
255 #define EXIF_INFO_TV_NU I2C_REG(CAT_EXIF, 0x08, 4)
256 #define EXIF_INFO_TV_DE I2C_REG(CAT_EXIF, 0x0c, 4)
257 #define EXIF_INFO_AV_NU I2C_REG(CAT_EXIF, 0x10, 4)
258 #define EXIF_INFO_AV_DE I2C_REG(CAT_EXIF, 0x14, 4)
259 #define EXIF_INFO_BV_NU I2C_REG(CAT_EXIF, 0x18, 4)
260 #define EXIF_INFO_BV_DE I2C_REG(CAT_EXIF, 0x1c, 4)
261 #define EXIF_INFO_EBV_NU I2C_REG(CAT_EXIF, 0x20, 4)
262 #define EXIF_INFO_EBV_DE I2C_REG(CAT_EXIF, 0x24, 4)
263 #define EXIF_INFO_ISO I2C_REG(CAT_EXIF, 0x28, 2)
264 #define EXIF_INFO_FLASH I2C_REG(CAT_EXIF, 0x2a, 2)
265 #define EXIF_INFO_SDR I2C_REG(CAT_EXIF, 0x2c, 2)
266 #define EXIF_INFO_QVAL I2C_REG(CAT_EXIF, 0x2e, 2)
267
268
269
270
271 #define FD_CTL I2C_REG(CAT_FD, 0x00, 1)
272 #define BIT_FD_EN 0
273 #define BIT_FD_DRAW_FACE_FRAME 4
274 #define BIT_FD_DRAW_SMILE_LVL 6
275 #define REG_FD(shift) (1 << shift)
276 #define REG_FD_OFF 0x0
277
278
279
280
281 #define AF_MODE I2C_REG(CAT_LENS, 0x01, 1)
282 #define REG_AF_NORMAL 0x00
283 #define REG_AF_MACRO 0x01
284 #define REG_AF_POWEROFF 0x07
285
286 #define AF_EXECUTE I2C_REG(CAT_LENS, 0x02, 1)
287 #define REG_AF_STOP 0x00
288 #define REG_AF_EXE_AUTO 0x01
289 #define REG_AF_EXE_CAF 0x02
290
291 #define AF_STATUS I2C_REG(CAT_LENS, 0x03, 1)
292 #define REG_AF_FAIL 0x00
293 #define REG_AF_SUCCESS 0x02
294 #define REG_AF_IDLE 0x04
295 #define REG_AF_BUSY 0x05
296
297 #define AF_VERSION I2C_REG(CAT_LENS, 0x0a, 1)
298
299
300
301
302 #define CAPP_YUVOUT_MAIN I2C_REG(CAT_CAPT_PARM, 0x00, 1)
303 #define REG_YUV422 0x00
304 #define REG_BAYER10 0x05
305 #define REG_BAYER8 0x06
306 #define REG_JPEG 0x10
307
308 #define CAPP_MAIN_IMAGE_SIZE I2C_REG(CAT_CAPT_PARM, 0x01, 1)
309 #define CAPP_JPEG_SIZE_MAX I2C_REG(CAT_CAPT_PARM, 0x0f, 4)
310 #define CAPP_JPEG_RATIO I2C_REG(CAT_CAPT_PARM, 0x17, 1)
311
312 #define CAPP_MCC_MODE I2C_REG(CAT_CAPT_PARM, 0x1d, 1)
313 #define REG_MCC_OFF 0x00
314 #define REG_MCC_NORMAL 0x01
315
316 #define CAPP_WDR_EN I2C_REG(CAT_CAPT_PARM, 0x2c, 1)
317 #define REG_WDR_OFF 0x00
318 #define REG_WDR_ON 0x01
319 #define REG_WDR_AUTO 0x02
320
321 #define CAPP_LIGHT_CTRL I2C_REG(CAT_CAPT_PARM, 0x40, 1)
322 #define REG_LIGHT_OFF 0x00
323 #define REG_LIGHT_ON 0x01
324 #define REG_LIGHT_AUTO 0x02
325
326 #define CAPP_FLASH_CTRL I2C_REG(CAT_CAPT_PARM, 0x41, 1)
327 #define REG_FLASH_OFF 0x00
328 #define REG_FLASH_ON 0x01
329 #define REG_FLASH_AUTO 0x02
330
331
332
333
334 #define CAPC_MODE I2C_REG(CAT_CAPT_CTRL, 0x00, 1)
335 #define REG_CAP_NONE 0x00
336 #define REG_CAP_ANTI_SHAKE 0x02
337
338
339 #define CAPC_SEL_FRAME I2C_REG(CAT_CAPT_CTRL, 0x06, 1)
340
341 #define CAPC_START I2C_REG(CAT_CAPT_CTRL, 0x09, 1)
342 #define REG_CAP_START_MAIN 0x01
343 #define REG_CAP_START_THUMB 0x03
344
345 #define CAPC_IMAGE_SIZE I2C_REG(CAT_CAPT_CTRL, 0x0d, 4)
346 #define CAPC_THUMB_SIZE I2C_REG(CAT_CAPT_CTRL, 0x11, 4)
347
348
349
350
351
352
353
354
355 #define FLASH_CAM_START I2C_REG(CAT_FLASH, 0x12, 1)
356 #define REG_START_ARM_BOOT 0x01
357 #define REG_IN_FLASH_MODE 0x00
358
359 #endif