Input: wacom - fix touch parsing on newer Bamboos
[linux-btrfs-devel.git] / drivers / media / video / m5mols / m5mols_reg.h
blobb83e36fc6ac658240ea9699fafaa56ee76fa8ca9
1 /*
2 * Register map for M-5MOLS 8M Pixel camera sensor with ISP
4 * Copyright (C) 2011 Samsung Electronics Co., Ltd.
5 * Author: HeungJun Kim, riverful.kim@samsung.com
7 * Copyright (C) 2009 Samsung Electronics Co., Ltd.
8 * Author: Dongsoo Nathaniel Kim, dongsoo45.kim@samsung.com
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
16 #ifndef M5MOLS_REG_H
17 #define M5MOLS_REG_H
19 #define M5MOLS_I2C_MAX_SIZE 4
20 #define M5MOLS_BYTE_READ 0x01
21 #define M5MOLS_BYTE_WRITE 0x02
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)
29 * Category section register
31 * The category means set including relevant command of M-5MOLS.
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 /* related to FW, revisions, booting */
46 * Category 0 - SYSTEM mode
48 * The SYSTEM mode in the M-5MOLS means area available to handle with the whole
49 * & all-round system of sensor. It deals with version/interrupt/setting mode &
50 * even sensor's status. Especially, the M-5MOLS sensor with ISP varies by
51 * packaging & manufacturer, even the customer and project code. And the
52 * function details may vary among them. The version information helps to
53 * determine what methods shall be used in the driver.
55 * There is many registers between customer version address and awb one. For
56 * more specific contents, see definition if file m5mols.h.
58 #define CAT0_VER_CUSTOMER 0x00 /* customer version */
59 #define CAT0_VER_AWB 0x09 /* Auto WB version */
60 #define CAT0_VER_STRING 0x0a /* string including M-5MOLS */
61 #define CAT0_SYSMODE 0x0b /* SYSTEM mode register */
62 #define CAT0_STATUS 0x0c /* SYSTEM mode status register */
63 #define CAT0_INT_FACTOR 0x10 /* interrupt pending register */
64 #define CAT0_INT_ENABLE 0x11 /* interrupt enable register */
66 #define SYSTEM_SYSMODE I2C_REG(CAT_SYSTEM, CAT0_SYSMODE, 1)
67 #define REG_SYSINIT 0x00 /* SYSTEM mode */
68 #define REG_PARAMETER 0x01 /* PARAMETER mode */
69 #define REG_MONITOR 0x02 /* MONITOR mode */
70 #define REG_CAPTURE 0x03 /* CAPTURE mode */
72 #define SYSTEM_CMD(__cmd) I2C_REG(CAT_SYSTEM, cmd, 1)
73 #define SYSTEM_VER_STRING I2C_REG(CAT_SYSTEM, CAT0_VER_STRING, 1)
74 #define REG_SAMSUNG_ELECTRO "SE" /* Samsung Electro-Mechanics */
75 #define REG_SAMSUNG_OPTICS "OP" /* Samsung Fiber-Optics */
76 #define REG_SAMSUNG_TECHWIN "TB" /* Samsung Techwin */
78 #define SYSTEM_INT_FACTOR I2C_REG(CAT_SYSTEM, CAT0_INT_FACTOR, 1)
79 #define SYSTEM_INT_ENABLE I2C_REG(CAT_SYSTEM, CAT0_INT_ENABLE, 1)
80 #define REG_INT_MODE (1 << 0)
81 #define REG_INT_AF (1 << 1)
82 #define REG_INT_ZOOM (1 << 2)
83 #define REG_INT_CAPTURE (1 << 3)
84 #define REG_INT_FRAMESYNC (1 << 4)
85 #define REG_INT_FD (1 << 5)
86 #define REG_INT_LENS_INIT (1 << 6)
87 #define REG_INT_SOUND (1 << 7)
88 #define REG_INT_MASK 0x0f
91 * category 1 - PARAMETER mode
93 * This category supports function of camera features of M-5MOLS. It means we
94 * can handle with preview(MONITOR) resolution size/frame per second/interface
95 * between the sensor and the Application Processor/even the image effect.
97 #define CAT1_DATA_INTERFACE 0x00 /* interface between sensor and AP */
98 #define CAT1_MONITOR_SIZE 0x01 /* resolution at the MONITOR mode */
99 #define CAT1_MONITOR_FPS 0x02 /* frame per second at this mode */
100 #define CAT1_EFFECT 0x0b /* image effects */
102 #define PARM_MON_SIZE I2C_REG(CAT_PARAM, CAT1_MONITOR_SIZE, 1)
104 #define PARM_MON_FPS I2C_REG(CAT_PARAM, CAT1_MONITOR_FPS, 1)
105 #define REG_FPS_30 0x02
107 #define PARM_INTERFACE I2C_REG(CAT_PARAM, CAT1_DATA_INTERFACE, 1)
108 #define REG_INTERFACE_MIPI 0x02
110 #define PARM_EFFECT I2C_REG(CAT_PARAM, CAT1_EFFECT, 1)
111 #define REG_EFFECT_OFF 0x00
112 #define REG_EFFECT_NEGA 0x01
113 #define REG_EFFECT_EMBOSS 0x06
114 #define REG_EFFECT_OUTLINE 0x07
115 #define REG_EFFECT_WATERCOLOR 0x08
118 * Category 2 - MONITOR mode
120 * The MONITOR mode is same as preview mode as we said. The M-5MOLS has another
121 * mode named "Preview", but this preview mode is used at the case specific
122 * vider-recording mode. This mmode supports only YUYV format. On the other
123 * hand, the JPEG & RAW formats is supports by CAPTURE mode. And, there are
124 * another options like zoom/color effect(different with effect in PARAMETER
125 * mode)/anti hand shaking algorithm.
127 #define CAT2_ZOOM 0x01 /* set the zoom position & execute */
128 #define CAT2_ZOOM_STEP 0x03 /* set the zoom step */
129 #define CAT2_CFIXB 0x09 /* CB value for color effect */
130 #define CAT2_CFIXR 0x0a /* CR value for color effect */
131 #define CAT2_COLOR_EFFECT 0x0b /* set on/off of color effect */
132 #define CAT2_CHROMA_LVL 0x0f /* set chroma level */
133 #define CAT2_CHROMA_EN 0x10 /* set on/off of choroma */
134 #define CAT2_EDGE_LVL 0x11 /* set sharpness level */
135 #define CAT2_EDGE_EN 0x12 /* set on/off sharpness */
136 #define CAT2_TONE_CTL 0x25 /* set tone color(contrast) */
138 #define MON_ZOOM I2C_REG(CAT_MONITOR, CAT2_ZOOM, 1)
140 #define MON_CFIXR I2C_REG(CAT_MONITOR, CAT2_CFIXR, 1)
141 #define MON_CFIXB I2C_REG(CAT_MONITOR, CAT2_CFIXB, 1)
142 #define REG_CFIXB_SEPIA 0xd8
143 #define REG_CFIXR_SEPIA 0x18
145 #define MON_EFFECT I2C_REG(CAT_MONITOR, CAT2_COLOR_EFFECT, 1)
146 #define REG_COLOR_EFFECT_OFF 0x00
147 #define REG_COLOR_EFFECT_ON 0x01
149 #define MON_CHROMA_EN I2C_REG(CAT_MONITOR, CAT2_CHROMA_EN, 1)
150 #define MON_CHROMA_LVL I2C_REG(CAT_MONITOR, CAT2_CHROMA_LVL, 1)
151 #define REG_CHROMA_OFF 0x00
152 #define REG_CHROMA_ON 0x01
154 #define MON_EDGE_EN I2C_REG(CAT_MONITOR, CAT2_EDGE_EN, 1)
155 #define MON_EDGE_LVL I2C_REG(CAT_MONITOR, CAT2_EDGE_LVL, 1)
156 #define REG_EDGE_OFF 0x00
157 #define REG_EDGE_ON 0x01
159 #define MON_TONE_CTL I2C_REG(CAT_MONITOR, CAT2_TONE_CTL, 1)
162 * Category 3 - Auto Exposure
164 * The M-5MOLS exposure capbility is detailed as which is similar to digital
165 * camera. This category supports AE locking/various AE mode(range of exposure)
166 * /ISO/flickering/EV bias/shutter/meteoring, and anything else. And the
167 * maximum/minimum exposure gain value depending on M-5MOLS firmware, may be
168 * different. So, this category also provide getting the max/min values. And,
169 * each MONITOR and CAPTURE mode has each gain/shutter/max exposure values.
171 #define CAT3_AE_LOCK 0x00 /* locking Auto exposure */
172 #define CAT3_AE_MODE 0x01 /* set AE mode, mode means range */
173 #define CAT3_ISO 0x05 /* set ISO */
174 #define CAT3_EV_PRESET_MONITOR 0x0a /* EV(scenemode) preset for MONITOR */
175 #define CAT3_EV_PRESET_CAPTURE 0x0b /* EV(scenemode) preset for CAPTURE */
176 #define CAT3_MANUAL_GAIN_MON 0x12 /* meteoring value for the MONITOR */
177 #define CAT3_MAX_GAIN_MON 0x1a /* max gain value for the MONITOR */
178 #define CAT3_MANUAL_GAIN_CAP 0x26 /* meteoring value for the CAPTURE */
179 #define CAT3_AE_INDEX 0x38 /* AE index */
181 #define AE_LOCK I2C_REG(CAT_AE, CAT3_AE_LOCK, 1)
182 #define REG_AE_UNLOCK 0x00
183 #define REG_AE_LOCK 0x01
185 #define AE_MODE I2C_REG(CAT_AE, CAT3_AE_MODE, 1)
186 #define REG_AE_OFF 0x00 /* AE off */
187 #define REG_AE_ALL 0x01 /* calc AE in all block integral */
188 #define REG_AE_CENTER 0x03 /* calc AE in center weighted */
189 #define REG_AE_SPOT 0x06 /* calc AE in specific spot */
191 #define AE_ISO I2C_REG(CAT_AE, CAT3_ISO, 1)
192 #define REG_ISO_AUTO 0x00
193 #define REG_ISO_50 0x01
194 #define REG_ISO_100 0x02
195 #define REG_ISO_200 0x03
196 #define REG_ISO_400 0x04
197 #define REG_ISO_800 0x05
199 #define AE_EV_PRESET_MONITOR I2C_REG(CAT_AE, CAT3_EV_PRESET_MONITOR, 1)
200 #define AE_EV_PRESET_CAPTURE I2C_REG(CAT_AE, CAT3_EV_PRESET_CAPTURE, 1)
201 #define REG_SCENE_NORMAL 0x00
202 #define REG_SCENE_PORTRAIT 0x01
203 #define REG_SCENE_LANDSCAPE 0x02
204 #define REG_SCENE_SPORTS 0x03
205 #define REG_SCENE_PARTY_INDOOR 0x04
206 #define REG_SCENE_BEACH_SNOW 0x05
207 #define REG_SCENE_SUNSET 0x06
208 #define REG_SCENE_DAWN_DUSK 0x07
209 #define REG_SCENE_FALL 0x08
210 #define REG_SCENE_NIGHT 0x09
211 #define REG_SCENE_AGAINST_LIGHT 0x0a
212 #define REG_SCENE_FIRE 0x0b
213 #define REG_SCENE_TEXT 0x0c
214 #define REG_SCENE_CANDLE 0x0d
216 #define AE_MAN_GAIN_MON I2C_REG(CAT_AE, CAT3_MANUAL_GAIN_MON, 2)
217 #define AE_MAX_GAIN_MON I2C_REG(CAT_AE, CAT3_MAX_GAIN_MON, 2)
218 #define AE_MAN_GAIN_CAP I2C_REG(CAT_AE, CAT3_MANUAL_GAIN_CAP, 2)
220 #define AE_INDEX I2C_REG(CAT_AE, CAT3_AE_INDEX, 1)
221 #define REG_AE_INDEX_20_NEG 0x00
222 #define REG_AE_INDEX_15_NEG 0x01
223 #define REG_AE_INDEX_10_NEG 0x02
224 #define REG_AE_INDEX_05_NEG 0x03
225 #define REG_AE_INDEX_00 0x04
226 #define REG_AE_INDEX_05_POS 0x05
227 #define REG_AE_INDEX_10_POS 0x06
228 #define REG_AE_INDEX_15_POS 0x07
229 #define REG_AE_INDEX_20_POS 0x08
232 * Category 6 - White Balance
234 * This category provide AWB locking/mode/preset/speed/gain bias, etc.
236 #define CAT6_AWB_LOCK 0x00 /* locking Auto Whitebalance */
237 #define CAT6_AWB_MODE 0x02 /* set Auto or Manual */
238 #define CAT6_AWB_MANUAL 0x03 /* set Manual(preset) value */
240 #define AWB_LOCK I2C_REG(CAT_WB, CAT6_AWB_LOCK, 1)
241 #define REG_AWB_UNLOCK 0x00
242 #define REG_AWB_LOCK 0x01
244 #define AWB_MODE I2C_REG(CAT_WB, CAT6_AWB_MODE, 1)
245 #define REG_AWB_AUTO 0x01 /* AWB off */
246 #define REG_AWB_PRESET 0x02 /* AWB preset */
248 #define AWB_MANUAL I2C_REG(CAT_WB, CAT6_AWB_MANUAL, 1)
249 #define REG_AWB_INCANDESCENT 0x01
250 #define REG_AWB_FLUORESCENT_1 0x02
251 #define REG_AWB_FLUORESCENT_2 0x03
252 #define REG_AWB_DAYLIGHT 0x04
253 #define REG_AWB_CLOUDY 0x05
254 #define REG_AWB_SHADE 0x06
255 #define REG_AWB_HORIZON 0x07
256 #define REG_AWB_LEDLIGHT 0x09
259 * Category 7 - EXIF information
261 #define CAT7_INFO_EXPTIME_NU 0x00
262 #define CAT7_INFO_EXPTIME_DE 0x04
263 #define CAT7_INFO_TV_NU 0x08
264 #define CAT7_INFO_TV_DE 0x0c
265 #define CAT7_INFO_AV_NU 0x10
266 #define CAT7_INFO_AV_DE 0x14
267 #define CAT7_INFO_BV_NU 0x18
268 #define CAT7_INFO_BV_DE 0x1c
269 #define CAT7_INFO_EBV_NU 0x20
270 #define CAT7_INFO_EBV_DE 0x24
271 #define CAT7_INFO_ISO 0x28
272 #define CAT7_INFO_FLASH 0x2a
273 #define CAT7_INFO_SDR 0x2c
274 #define CAT7_INFO_QVAL 0x2e
276 #define EXIF_INFO_EXPTIME_NU I2C_REG(CAT_EXIF, CAT7_INFO_EXPTIME_NU, 4)
277 #define EXIF_INFO_EXPTIME_DE I2C_REG(CAT_EXIF, CAT7_INFO_EXPTIME_DE, 4)
278 #define EXIF_INFO_TV_NU I2C_REG(CAT_EXIF, CAT7_INFO_TV_NU, 4)
279 #define EXIF_INFO_TV_DE I2C_REG(CAT_EXIF, CAT7_INFO_TV_DE, 4)
280 #define EXIF_INFO_AV_NU I2C_REG(CAT_EXIF, CAT7_INFO_AV_NU, 4)
281 #define EXIF_INFO_AV_DE I2C_REG(CAT_EXIF, CAT7_INFO_AV_DE, 4)
282 #define EXIF_INFO_BV_NU I2C_REG(CAT_EXIF, CAT7_INFO_BV_NU, 4)
283 #define EXIF_INFO_BV_DE I2C_REG(CAT_EXIF, CAT7_INFO_BV_DE, 4)
284 #define EXIF_INFO_EBV_NU I2C_REG(CAT_EXIF, CAT7_INFO_EBV_NU, 4)
285 #define EXIF_INFO_EBV_DE I2C_REG(CAT_EXIF, CAT7_INFO_EBV_DE, 4)
286 #define EXIF_INFO_ISO I2C_REG(CAT_EXIF, CAT7_INFO_ISO, 2)
287 #define EXIF_INFO_FLASH I2C_REG(CAT_EXIF, CAT7_INFO_FLASH, 2)
288 #define EXIF_INFO_SDR I2C_REG(CAT_EXIF, CAT7_INFO_SDR, 2)
289 #define EXIF_INFO_QVAL I2C_REG(CAT_EXIF, CAT7_INFO_QVAL, 2)
292 * Category 9 - Face Detection
294 #define CAT9_FD_CTL 0x00
296 #define FD_CTL I2C_REG(CAT_FD, CAT9_FD_CTL, 1)
297 #define BIT_FD_EN 0
298 #define BIT_FD_DRAW_FACE_FRAME 4
299 #define BIT_FD_DRAW_SMILE_LVL 6
300 #define REG_FD(shift) (1 << shift)
301 #define REG_FD_OFF 0x0
304 * Category A - Lens Parameter
306 #define CATA_AF_MODE 0x01
307 #define CATA_AF_EXECUTE 0x02
308 #define CATA_AF_STATUS 0x03
309 #define CATA_AF_VERSION 0x0a
311 #define AF_MODE I2C_REG(CAT_LENS, CATA_AF_MODE, 1)
312 #define REG_AF_NORMAL 0x00 /* Normal AF, one time */
313 #define REG_AF_MACRO 0x01 /* Macro AF, one time */
314 #define REG_AF_POWEROFF 0x07
316 #define AF_EXECUTE I2C_REG(CAT_LENS, CATA_AF_EXECUTE, 1)
317 #define REG_AF_STOP 0x00
318 #define REG_AF_EXE_AUTO 0x01
319 #define REG_AF_EXE_CAF 0x02
321 #define AF_STATUS I2C_REG(CAT_LENS, CATA_AF_STATUS, 1)
322 #define REG_AF_FAIL 0x00
323 #define REG_AF_SUCCESS 0x02
324 #define REG_AF_IDLE 0x04
325 #define REG_AF_BUSY 0x05
327 #define AF_VERSION I2C_REG(CAT_LENS, CATA_AF_VERSION, 1)
330 * Category B - CAPTURE Parameter
332 #define CATB_YUVOUT_MAIN 0x00
333 #define CATB_MAIN_IMAGE_SIZE 0x01
334 #define CATB_MCC_MODE 0x1d
335 #define CATB_WDR_EN 0x2c
336 #define CATB_LIGHT_CTRL 0x40
337 #define CATB_FLASH_CTRL 0x41
339 #define CAPP_YUVOUT_MAIN I2C_REG(CAT_CAPT_PARM, CATB_YUVOUT_MAIN, 1)
340 #define REG_YUV422 0x00
341 #define REG_BAYER10 0x05
342 #define REG_BAYER8 0x06
343 #define REG_JPEG 0x10
345 #define CAPP_MAIN_IMAGE_SIZE I2C_REG(CAT_CAPT_PARM, CATB_MAIN_IMAGE_SIZE, 1)
347 #define CAPP_MCC_MODE I2C_REG(CAT_CAPT_PARM, CATB_MCC_MODE, 1)
348 #define REG_MCC_OFF 0x00
349 #define REG_MCC_NORMAL 0x01
351 #define CAPP_WDR_EN I2C_REG(CAT_CAPT_PARM, CATB_WDR_EN, 1)
352 #define REG_WDR_OFF 0x00
353 #define REG_WDR_ON 0x01
354 #define REG_WDR_AUTO 0x02
356 #define CAPP_LIGHT_CTRL I2C_REG(CAT_CAPT_PARM, CATB_LIGHT_CTRL, 1)
357 #define REG_LIGHT_OFF 0x00
358 #define REG_LIGHT_ON 0x01
359 #define REG_LIGHT_AUTO 0x02
361 #define CAPP_FLASH_CTRL I2C_REG(CAT_CAPT_PARM, CATB_FLASH_CTRL, 1)
362 #define REG_FLASH_OFF 0x00
363 #define REG_FLASH_ON 0x01
364 #define REG_FLASH_AUTO 0x02
367 * Category C - CAPTURE Control
369 #define CATC_CAP_MODE 0x00
370 #define CATC_CAP_SEL_FRAME 0x06 /* It determines Single or Multi */
371 #define CATC_CAP_START 0x09
372 #define CATC_CAP_IMAGE_SIZE 0x0d
373 #define CATC_CAP_THUMB_SIZE 0x11
375 #define CAPC_MODE I2C_REG(CAT_CAPT_CTRL, CATC_CAP_MODE, 1)
376 #define REG_CAP_NONE 0x00
377 #define REG_CAP_ANTI_SHAKE 0x02
379 #define CAPC_SEL_FRAME I2C_REG(CAT_CAPT_CTRL, CATC_CAP_SEL_FRAME, 1)
381 #define CAPC_START I2C_REG(CAT_CAPT_CTRL, CATC_CAP_START, 1)
382 #define REG_CAP_START_MAIN 0x01
383 #define REG_CAP_START_THUMB 0x03
385 #define CAPC_IMAGE_SIZE I2C_REG(CAT_CAPT_CTRL, CATC_CAP_IMAGE_SIZE, 1)
386 #define CAPC_THUMB_SIZE I2C_REG(CAT_CAPT_CTRL, CATC_CAP_THUMB_SIZE, 1)
389 * Category F - Flash
391 * This mode provides functions about internal flash stuff and system startup.
393 #define CATF_CAM_START 0x12 /* It starts internal ARM core booting
394 * after power-up */
396 #define FLASH_CAM_START I2C_REG(CAT_FLASH, CATF_CAM_START, 1)
397 #define REG_START_ARM_BOOT 0x01
399 #endif /* M5MOLS_REG_H */