1 /* 2 * Register map for M-5MOLS 8M Pixel camera sensor with ISP 3 * 4 * Copyright (C) 2011 Samsung Electronics Co., Ltd. 5 * Author: HeungJun Kim <riverful.kim@samsung.com> 6 * 7 * Copyright (C) 2009 Samsung Electronics Co., Ltd. 8 * Author: Dongsoo Nathaniel Kim <dongsoo45.kim@samsung.com> 9 * 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. 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 * Category section register 30 * 31 * The category means set including relevant command of M-5MOLS. 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 /* related to FW, revisions, booting */ 44 45 /* 46 * Category 0 - SYSTEM mode 47 * 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. 54 * 55 * There is many registers between customer version address and awb one. For 56 * more specific contents, see definition if file m5mols.h. 57 */ 58 #define SYSTEM_VER_CUSTOMER I2C_REG(CAT_SYSTEM, 0x00, 1) 59 #define SYSTEM_VER_PROJECT I2C_REG(CAT_SYSTEM, 0x01, 1) 60 #define SYSTEM_VER_FIRMWARE I2C_REG(CAT_SYSTEM, 0x02, 2) 61 #define SYSTEM_VER_HARDWARE I2C_REG(CAT_SYSTEM, 0x04, 2) 62 #define SYSTEM_VER_PARAMETER I2C_REG(CAT_SYSTEM, 0x06, 2) 63 #define SYSTEM_VER_AWB I2C_REG(CAT_SYSTEM, 0x08, 2) 64 65 #define SYSTEM_SYSMODE I2C_REG(CAT_SYSTEM, 0x0b, 1) 66 #define REG_SYSINIT 0x00 /* SYSTEM mode */ 67 #define REG_PARAMETER 0x01 /* PARAMETER mode */ 68 #define REG_MONITOR 0x02 /* MONITOR mode */ 69 #define REG_CAPTURE 0x03 /* CAPTURE mode */ 70 71 #define SYSTEM_CMD(__cmd) I2C_REG(CAT_SYSTEM, cmd, 1) 72 #define SYSTEM_VER_STRING I2C_REG(CAT_SYSTEM, 0x0a, 1) 73 #define REG_SAMSUNG_ELECTRO "SE" /* Samsung Electro-Mechanics */ 74 #define REG_SAMSUNG_OPTICS "OP" /* Samsung Fiber-Optics */ 75 #define REG_SAMSUNG_TECHWIN "TB" /* Samsung Techwin */ 76 /* SYSTEM mode status */ 77 #define SYSTEM_STATUS I2C_REG(CAT_SYSTEM, 0x0c, 1) 78 79 /* Interrupt pending register */ 80 #define SYSTEM_INT_FACTOR I2C_REG(CAT_SYSTEM, 0x10, 1) 81 /* interrupt enable register */ 82 #define SYSTEM_INT_ENABLE I2C_REG(CAT_SYSTEM, 0x11, 1) 83 #define REG_INT_MODE (1 << 0) 84 #define REG_INT_AF (1 << 1) 85 #define REG_INT_ZOOM (1 << 2) 86 #define REG_INT_CAPTURE (1 << 3) 87 #define REG_INT_FRAMESYNC (1 << 4) 88 #define REG_INT_FD (1 << 5) 89 #define REG_INT_LENS_INIT (1 << 6) 90 #define REG_INT_SOUND (1 << 7) 91 #define REG_INT_MASK 0x0f 92 93 /* 94 * category 1 - PARAMETER mode 95 * 96 * This category supports function of camera features of M-5MOLS. It means we 97 * can handle with preview(MONITOR) resolution size/frame per second/interface 98 * between the sensor and the Application Processor/even the image effect. 99 */ 100 101 /* Resolution in the MONITOR mode */ 102 #define PARM_MON_SIZE I2C_REG(CAT_PARAM, 0x01, 1) 103 104 /* Frame rate */ 105 #define PARM_MON_FPS I2C_REG(CAT_PARAM, 0x02, 1) 106 #define REG_FPS_30 0x02 107 108 /* Video bus between the sensor and a host processor */ 109 #define PARM_INTERFACE I2C_REG(CAT_PARAM, 0x00, 1) 110 #define REG_INTERFACE_MIPI 0x02 111 112 /* Image effects */ 113 #define PARM_EFFECT I2C_REG(CAT_PARAM, 0x0b, 1) 114 #define REG_EFFECT_OFF 0x00 115 #define REG_EFFECT_NEGA 0x01 116 #define REG_EFFECT_EMBOSS 0x06 117 #define REG_EFFECT_OUTLINE 0x07 118 #define REG_EFFECT_WATERCOLOR 0x08 119 120 /* 121 * Category 2 - MONITOR mode 122 * 123 * The MONITOR mode is same as preview mode as we said. The M-5MOLS has another 124 * mode named "Preview", but this preview mode is used at the case specific 125 * vider-recording mode. This mmode supports only YUYV format. On the other 126 * hand, the JPEG & RAW formats is supports by CAPTURE mode. And, there are 127 * another options like zoom/color effect(different with effect in PARAMETER 128 * mode)/anti hand shaking algorithm. 129 */ 130 131 /* Target digital zoom position */ 132 #define MON_ZOOM I2C_REG(CAT_MONITOR, 0x01, 1) 133 134 /* CR value for color effect */ 135 #define MON_CFIXR I2C_REG(CAT_MONITOR, 0x0a, 1) 136 /* CB value for color effect */ 137 #define MON_CFIXB I2C_REG(CAT_MONITOR, 0x09, 1) 138 #define REG_CFIXB_SEPIA 0xd8 139 #define REG_CFIXR_SEPIA 0x18 140 141 #define MON_EFFECT I2C_REG(CAT_MONITOR, 0x0b, 1) 142 #define REG_COLOR_EFFECT_OFF 0x00 143 #define REG_COLOR_EFFECT_ON 0x01 144 145 /* Chroma enable */ 146 #define MON_CHROMA_EN I2C_REG(CAT_MONITOR, 0x10, 1) 147 /* Chroma level */ 148 #define MON_CHROMA_LVL I2C_REG(CAT_MONITOR, 0x0f, 1) 149 #define REG_CHROMA_OFF 0x00 150 #define REG_CHROMA_ON 0x01 151 152 /* Sharpness on/off */ 153 #define MON_EDGE_EN I2C_REG(CAT_MONITOR, 0x12, 1) 154 /* Sharpness level */ 155 #define MON_EDGE_LVL I2C_REG(CAT_MONITOR, 0x11, 1) 156 #define REG_EDGE_OFF 0x00 157 #define REG_EDGE_ON 0x01 158 159 /* Set color tone (contrast) */ 160 #define MON_TONE_CTL I2C_REG(CAT_MONITOR, 0x25, 1) 161 162 /* 163 * Category 3 - Auto Exposure 164 * 165 * The M-5MOLS exposure capbility is detailed as which is similar to digital 166 * camera. This category supports AE locking/various AE mode(range of exposure) 167 * /ISO/flickering/EV bias/shutter/meteoring, and anything else. And the 168 * maximum/minimum exposure gain value depending on M-5MOLS firmware, may be 169 * different. So, this category also provide getting the max/min values. And, 170 * each MONITOR and CAPTURE mode has each gain/shutter/max exposure values. 171 */ 172 173 /* Auto Exposure locking */ 174 #define AE_LOCK I2C_REG(CAT_AE, 0x00, 1) 175 #define REG_AE_UNLOCK 0x00 176 #define REG_AE_LOCK 0x01 177 178 /* Auto Exposure algorithm mode */ 179 #define AE_MODE I2C_REG(CAT_AE, 0x01, 1) 180 #define REG_AE_OFF 0x00 /* AE off */ 181 #define REG_AE_ALL 0x01 /* calc AE in all block integral */ 182 #define REG_AE_CENTER 0x03 /* calc AE in center weighted */ 183 #define REG_AE_SPOT 0x06 /* calc AE in specific spot */ 184 185 #define AE_ISO I2C_REG(CAT_AE, 0x05, 1) 186 #define REG_ISO_AUTO 0x00 187 #define REG_ISO_50 0x01 188 #define REG_ISO_100 0x02 189 #define REG_ISO_200 0x03 190 #define REG_ISO_400 0x04 191 #define REG_ISO_800 0x05 192 193 /* EV (scenemode) preset for MONITOR */ 194 #define AE_EV_PRESET_MONITOR I2C_REG(CAT_AE, 0x0a, 1) 195 /* EV (scenemode) preset for CAPTURE */ 196 #define AE_EV_PRESET_CAPTURE I2C_REG(CAT_AE, 0x0b, 1) 197 #define REG_SCENE_NORMAL 0x00 198 #define REG_SCENE_PORTRAIT 0x01 199 #define REG_SCENE_LANDSCAPE 0x02 200 #define REG_SCENE_SPORTS 0x03 201 #define REG_SCENE_PARTY_INDOOR 0x04 202 #define REG_SCENE_BEACH_SNOW 0x05 203 #define REG_SCENE_SUNSET 0x06 204 #define REG_SCENE_DAWN_DUSK 0x07 205 #define REG_SCENE_FALL 0x08 206 #define REG_SCENE_NIGHT 0x09 207 #define REG_SCENE_AGAINST_LIGHT 0x0a 208 #define REG_SCENE_FIRE 0x0b 209 #define REG_SCENE_TEXT 0x0c 210 #define REG_SCENE_CANDLE 0x0d 211 212 /* Manual gain in MONITOR mode */ 213 #define AE_MAN_GAIN_MON I2C_REG(CAT_AE, 0x12, 2) 214 /* Maximum gain in MONITOR mode */ 215 #define AE_MAX_GAIN_MON I2C_REG(CAT_AE, 0x1a, 2) 216 /* Manual gain in CAPTURE mode */ 217 #define AE_MAN_GAIN_CAP I2C_REG(CAT_AE, 0x26, 2) 218 219 #define AE_INDEX I2C_REG(CAT_AE, 0x38, 1) 220 #define REG_AE_INDEX_20_NEG 0x00 221 #define REG_AE_INDEX_15_NEG 0x01 222 #define REG_AE_INDEX_10_NEG 0x02 223 #define REG_AE_INDEX_05_NEG 0x03 224 #define REG_AE_INDEX_00 0x04 225 #define REG_AE_INDEX_05_POS 0x05 226 #define REG_AE_INDEX_10_POS 0x06 227 #define REG_AE_INDEX_15_POS 0x07 228 #define REG_AE_INDEX_20_POS 0x08 229 230 /* 231 * Category 6 - White Balance 232 */ 233 234 /* Auto Whitebalance locking */ 235 #define AWB_LOCK I2C_REG(CAT_WB, 0x00, 1) 236 #define REG_AWB_UNLOCK 0x00 237 #define REG_AWB_LOCK 0x01 238 239 #define AWB_MODE I2C_REG(CAT_WB, 0x02, 1) 240 #define REG_AWB_AUTO 0x01 /* AWB off */ 241 #define REG_AWB_PRESET 0x02 /* AWB preset */ 242 243 /* Manual WB (preset) */ 244 #define AWB_MANUAL I2C_REG(CAT_WB, 0x03, 1) 245 #define REG_AWB_INCANDESCENT 0x01 246 #define REG_AWB_FLUORESCENT_1 0x02 247 #define REG_AWB_FLUORESCENT_2 0x03 248 #define REG_AWB_DAYLIGHT 0x04 249 #define REG_AWB_CLOUDY 0x05 250 #define REG_AWB_SHADE 0x06 251 #define REG_AWB_HORIZON 0x07 252 #define REG_AWB_LEDLIGHT 0x09 253 254 /* 255 * Category 7 - EXIF information 256 */ 257 #define EXIF_INFO_EXPTIME_NU I2C_REG(CAT_EXIF, 0x00, 4) 258 #define EXIF_INFO_EXPTIME_DE I2C_REG(CAT_EXIF, 0x04, 4) 259 #define EXIF_INFO_TV_NU I2C_REG(CAT_EXIF, 0x08, 4) 260 #define EXIF_INFO_TV_DE I2C_REG(CAT_EXIF, 0x0c, 4) 261 #define EXIF_INFO_AV_NU I2C_REG(CAT_EXIF, 0x10, 4) 262 #define EXIF_INFO_AV_DE I2C_REG(CAT_EXIF, 0x14, 4) 263 #define EXIF_INFO_BV_NU I2C_REG(CAT_EXIF, 0x18, 4) 264 #define EXIF_INFO_BV_DE I2C_REG(CAT_EXIF, 0x1c, 4) 265 #define EXIF_INFO_EBV_NU I2C_REG(CAT_EXIF, 0x20, 4) 266 #define EXIF_INFO_EBV_DE I2C_REG(CAT_EXIF, 0x24, 4) 267 #define EXIF_INFO_ISO I2C_REG(CAT_EXIF, 0x28, 2) 268 #define EXIF_INFO_FLASH I2C_REG(CAT_EXIF, 0x2a, 2) 269 #define EXIF_INFO_SDR I2C_REG(CAT_EXIF, 0x2c, 2) 270 #define EXIF_INFO_QVAL I2C_REG(CAT_EXIF, 0x2e, 2) 271 272 /* 273 * Category 9 - Face Detection 274 */ 275 #define FD_CTL I2C_REG(CAT_FD, 0x00, 1) 276 #define BIT_FD_EN 0 277 #define BIT_FD_DRAW_FACE_FRAME 4 278 #define BIT_FD_DRAW_SMILE_LVL 6 279 #define REG_FD(shift) (1 << shift) 280 #define REG_FD_OFF 0x0 281 282 /* 283 * Category A - Lens Parameter 284 */ 285 #define AF_MODE I2C_REG(CAT_LENS, 0x01, 1) 286 #define REG_AF_NORMAL 0x00 /* Normal AF, one time */ 287 #define REG_AF_MACRO 0x01 /* Macro AF, one time */ 288 #define REG_AF_POWEROFF 0x07 289 290 #define AF_EXECUTE I2C_REG(CAT_LENS, 0x02, 1) 291 #define REG_AF_STOP 0x00 292 #define REG_AF_EXE_AUTO 0x01 293 #define REG_AF_EXE_CAF 0x02 294 295 #define AF_STATUS I2C_REG(CAT_LENS, 0x03, 1) 296 #define REG_AF_FAIL 0x00 297 #define REG_AF_SUCCESS 0x02 298 #define REG_AF_IDLE 0x04 299 #define REG_AF_BUSY 0x05 300 301 #define AF_VERSION I2C_REG(CAT_LENS, 0x0a, 1) 302 303 /* 304 * Category B - CAPTURE Parameter 305 */ 306 #define CAPP_YUVOUT_MAIN I2C_REG(CAT_CAPT_PARM, 0x00, 1) 307 #define REG_YUV422 0x00 308 #define REG_BAYER10 0x05 309 #define REG_BAYER8 0x06 310 #define REG_JPEG 0x10 311 312 #define CAPP_MAIN_IMAGE_SIZE I2C_REG(CAT_CAPT_PARM, 0x01, 1) 313 #define CAPP_JPEG_SIZE_MAX I2C_REG(CAT_CAPT_PARM, 0x0f, 4) 314 #define CAPP_JPEG_RATIO I2C_REG(CAT_CAPT_PARM, 0x17, 1) 315 316 #define CAPP_MCC_MODE I2C_REG(CAT_CAPT_PARM, 0x1d, 1) 317 #define REG_MCC_OFF 0x00 318 #define REG_MCC_NORMAL 0x01 319 320 #define CAPP_WDR_EN I2C_REG(CAT_CAPT_PARM, 0x2c, 1) 321 #define REG_WDR_OFF 0x00 322 #define REG_WDR_ON 0x01 323 #define REG_WDR_AUTO 0x02 324 325 #define CAPP_LIGHT_CTRL I2C_REG(CAT_CAPT_PARM, 0x40, 1) 326 #define REG_LIGHT_OFF 0x00 327 #define REG_LIGHT_ON 0x01 328 #define REG_LIGHT_AUTO 0x02 329 330 #define CAPP_FLASH_CTRL I2C_REG(CAT_CAPT_PARM, 0x41, 1) 331 #define REG_FLASH_OFF 0x00 332 #define REG_FLASH_ON 0x01 333 #define REG_FLASH_AUTO 0x02 334 335 /* 336 * Category C - CAPTURE Control 337 */ 338 #define CAPC_MODE I2C_REG(CAT_CAPT_CTRL, 0x00, 1) 339 #define REG_CAP_NONE 0x00 340 #define REG_CAP_ANTI_SHAKE 0x02 341 342 /* Select single- or multi-shot capture */ 343 #define CAPC_SEL_FRAME I2C_REG(CAT_CAPT_CTRL, 0x06, 1) 344 345 #define CAPC_START I2C_REG(CAT_CAPT_CTRL, 0x09, 1) 346 #define REG_CAP_START_MAIN 0x01 347 #define REG_CAP_START_THUMB 0x03 348 349 #define CAPC_IMAGE_SIZE I2C_REG(CAT_CAPT_CTRL, 0x0d, 4) 350 #define CAPC_THUMB_SIZE I2C_REG(CAT_CAPT_CTRL, 0x11, 4) 351 352 /* 353 * Category F - Flash 354 * 355 * This mode provides functions about internal flash stuff and system startup. 356 */ 357 358 /* Starts internal ARM core booting after power-up */ 359 #define FLASH_CAM_START I2C_REG(CAT_FLASH, 0x12, 1) 360 #define REG_START_ARM_BOOT 0x01 /* write value */ 361 #define REG_IN_FLASH_MODE 0x00 /* read value */ 362 363 #endif /* M5MOLS_REG_H */ 364