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