Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * Register map for M-5MOLS 8M Pixel camera sensor with ISP
0004  *
0005  * Copyright (C) 2011 Samsung Electronics Co., Ltd.
0006  * Author: HeungJun Kim <riverful.kim@samsung.com>
0007  *
0008  * Copyright (C) 2009 Samsung Electronics Co., Ltd.
0009  * Author: Dongsoo Nathaniel Kim <dongsoo45.kim@samsung.com>
0010  */
0011 
0012 #ifndef M5MOLS_REG_H
0013 #define M5MOLS_REG_H
0014 
0015 #define M5MOLS_I2C_MAX_SIZE 4
0016 #define M5MOLS_BYTE_READ    0x01
0017 #define M5MOLS_BYTE_WRITE   0x02
0018 
0019 #define I2C_CATEGORY(__cat)     ((__cat >> 16) & 0xff)
0020 #define I2C_COMMAND(__comm)     ((__comm >> 8) & 0xff)
0021 #define I2C_SIZE(__reg_s)       ((__reg_s) & 0xff)
0022 #define I2C_REG(__cat, __cmd, __reg_s)  ((__cat << 16) | (__cmd << 8) | __reg_s)
0023 
0024 /*
0025  * Category section register
0026  *
0027  * The category means set including relevant command of M-5MOLS.
0028  */
0029 #define CAT_SYSTEM      0x00
0030 #define CAT_PARAM       0x01
0031 #define CAT_MONITOR     0x02
0032 #define CAT_AE          0x03
0033 #define CAT_WB          0x06
0034 #define CAT_EXIF        0x07
0035 #define CAT_FD          0x09
0036 #define CAT_LENS        0x0a
0037 #define CAT_CAPT_PARM       0x0b
0038 #define CAT_CAPT_CTRL       0x0c
0039 #define CAT_FLASH       0x0f    /* related to FW, revisions, booting */
0040 
0041 /*
0042  * Category 0 - SYSTEM mode
0043  *
0044  * The SYSTEM mode in the M-5MOLS means area available to handle with the whole
0045  * & all-round system of sensor. It deals with version/interrupt/setting mode &
0046  * even sensor's status. Especially, the M-5MOLS sensor with ISP varies by
0047  * packaging & manufacturer, even the customer and project code. And the
0048  * function details may vary among them. The version information helps to
0049  * determine what methods shall be used in the driver.
0050  *
0051  * There is many registers between customer version address and awb one. For
0052  * more specific contents, see definition if file m5mols.h.
0053  */
0054 #define SYSTEM_VER_CUSTOMER I2C_REG(CAT_SYSTEM, 0x00, 1)
0055 #define SYSTEM_VER_PROJECT  I2C_REG(CAT_SYSTEM, 0x01, 1)
0056 #define SYSTEM_VER_FIRMWARE I2C_REG(CAT_SYSTEM, 0x02, 2)
0057 #define SYSTEM_VER_HARDWARE I2C_REG(CAT_SYSTEM, 0x04, 2)
0058 #define SYSTEM_VER_PARAMETER    I2C_REG(CAT_SYSTEM, 0x06, 2)
0059 #define SYSTEM_VER_AWB      I2C_REG(CAT_SYSTEM, 0x08, 2)
0060 
0061 #define SYSTEM_SYSMODE      I2C_REG(CAT_SYSTEM, 0x0b, 1)
0062 #define REG_SYSINIT     0x00    /* SYSTEM mode */
0063 #define REG_PARAMETER       0x01    /* PARAMETER mode */
0064 #define REG_MONITOR     0x02    /* MONITOR mode */
0065 #define REG_CAPTURE     0x03    /* CAPTURE mode */
0066 
0067 #define SYSTEM_CMD(__cmd)   I2C_REG(CAT_SYSTEM, cmd, 1)
0068 #define SYSTEM_VER_STRING   I2C_REG(CAT_SYSTEM, 0x0a, 1)
0069 #define REG_SAMSUNG_ELECTRO "SE"    /* Samsung Electro-Mechanics */
0070 #define REG_SAMSUNG_OPTICS  "OP"    /* Samsung Fiber-Optics */
0071 #define REG_SAMSUNG_TECHWIN "TB"    /* Samsung Techwin */
0072 /* SYSTEM mode status */
0073 #define SYSTEM_STATUS   I2C_REG(CAT_SYSTEM, 0x0c, 1)
0074 
0075 /* Interrupt pending register */
0076 #define SYSTEM_INT_FACTOR   I2C_REG(CAT_SYSTEM, 0x10, 1)
0077 /* interrupt enable register */
0078 #define SYSTEM_INT_ENABLE   I2C_REG(CAT_SYSTEM, 0x11, 1)
0079 #define REG_INT_MODE        (1 << 0)
0080 #define REG_INT_AF      (1 << 1)
0081 #define REG_INT_ZOOM        (1 << 2)
0082 #define REG_INT_CAPTURE     (1 << 3)
0083 #define REG_INT_FRAMESYNC   (1 << 4)
0084 #define REG_INT_FD      (1 << 5)
0085 #define REG_INT_LENS_INIT   (1 << 6)
0086 #define REG_INT_SOUND       (1 << 7)
0087 #define REG_INT_MASK        0x0f
0088 
0089 /*
0090  * category 1 - PARAMETER mode
0091  *
0092  * This category supports function of camera features of M-5MOLS. It means we
0093  * can handle with preview(MONITOR) resolution size/frame per second/interface
0094  * between the sensor and the Application Processor/even the image effect.
0095  */
0096 
0097 /* Resolution in the MONITOR mode */
0098 #define PARM_MON_SIZE       I2C_REG(CAT_PARAM, 0x01, 1)
0099 
0100 /* Frame rate */
0101 #define PARM_MON_FPS        I2C_REG(CAT_PARAM, 0x02, 1)
0102 #define REG_FPS_30      0x02
0103 
0104 /* Video bus between the sensor and a host processor */
0105 #define PARM_INTERFACE      I2C_REG(CAT_PARAM, 0x00, 1)
0106 #define REG_INTERFACE_MIPI  0x02
0107 
0108 /* Image effects */
0109 #define PARM_EFFECT     I2C_REG(CAT_PARAM, 0x0b, 1)
0110 #define REG_EFFECT_OFF      0x00
0111 #define REG_EFFECT_NEGA     0x01
0112 #define REG_EFFECT_EMBOSS   0x06
0113 #define REG_EFFECT_OUTLINE  0x07
0114 #define REG_EFFECT_WATERCOLOR   0x08
0115 
0116 /*
0117  * Category 2 - MONITOR mode
0118  *
0119  * The MONITOR mode is same as preview mode as we said. The M-5MOLS has another
0120  * mode named "Preview", but this preview mode is used at the case specific
0121  * vider-recording mode. This mmode supports only YUYV format. On the other
0122  * hand, the JPEG & RAW formats is supports by CAPTURE mode. And, there are
0123  * another options like zoom/color effect(different with effect in PARAMETER
0124  * mode)/anti hand shaking algorithm.
0125  */
0126 
0127 /* Target digital zoom position */
0128 #define MON_ZOOM        I2C_REG(CAT_MONITOR, 0x01, 1)
0129 
0130 /* CR value for color effect */
0131 #define MON_CFIXR       I2C_REG(CAT_MONITOR, 0x0a, 1)
0132 /* CB value for color effect */
0133 #define MON_CFIXB       I2C_REG(CAT_MONITOR, 0x09, 1)
0134 #define REG_CFIXB_SEPIA     0xd8
0135 #define REG_CFIXR_SEPIA     0x18
0136 
0137 #define MON_EFFECT      I2C_REG(CAT_MONITOR, 0x0b, 1)
0138 #define REG_COLOR_EFFECT_OFF    0x00
0139 #define REG_COLOR_EFFECT_ON 0x01
0140 
0141 /* Chroma enable */
0142 #define MON_CHROMA_EN       I2C_REG(CAT_MONITOR, 0x10, 1)
0143 /* Chroma level */
0144 #define MON_CHROMA_LVL      I2C_REG(CAT_MONITOR, 0x0f, 1)
0145 #define REG_CHROMA_OFF      0x00
0146 #define REG_CHROMA_ON       0x01
0147 
0148 /* Sharpness on/off */
0149 #define MON_EDGE_EN     I2C_REG(CAT_MONITOR, 0x12, 1)
0150 /* Sharpness level */
0151 #define MON_EDGE_LVL        I2C_REG(CAT_MONITOR, 0x11, 1)
0152 #define REG_EDGE_OFF        0x00
0153 #define REG_EDGE_ON     0x01
0154 
0155 /* Set color tone (contrast) */
0156 #define MON_TONE_CTL        I2C_REG(CAT_MONITOR, 0x25, 1)
0157 
0158 /*
0159  * Category 3 - Auto Exposure
0160  *
0161  * The M-5MOLS exposure capbility is detailed as which is similar to digital
0162  * camera. This category supports AE locking/various AE mode(range of exposure)
0163  * /ISO/flickering/EV bias/shutter/meteoring, and anything else. And the
0164  * maximum/minimum exposure gain value depending on M-5MOLS firmware, may be
0165  * different. So, this category also provide getting the max/min values. And,
0166  * each MONITOR and CAPTURE mode has each gain/shutter/max exposure values.
0167  */
0168 
0169 /* Auto Exposure locking */
0170 #define AE_LOCK         I2C_REG(CAT_AE, 0x00, 1)
0171 #define REG_AE_UNLOCK       0x00
0172 #define REG_AE_LOCK     0x01
0173 
0174 /* Auto Exposure algorithm mode */
0175 #define AE_MODE         I2C_REG(CAT_AE, 0x01, 1)
0176 #define REG_AE_OFF      0x00    /* AE off */
0177 #define REG_AE_ALL      0x01    /* calc AE in all block integral */
0178 #define REG_AE_CENTER       0x03    /* calc AE in center weighted */
0179 #define REG_AE_SPOT     0x06    /* calc AE in specific spot */
0180 
0181 #define AE_ISO          I2C_REG(CAT_AE, 0x05, 1)
0182 #define REG_ISO_AUTO        0x00
0183 #define REG_ISO_50      0x01
0184 #define REG_ISO_100     0x02
0185 #define REG_ISO_200     0x03
0186 #define REG_ISO_400     0x04
0187 #define REG_ISO_800     0x05
0188 
0189 /* EV (scenemode) preset for MONITOR */
0190 #define AE_EV_PRESET_MONITOR    I2C_REG(CAT_AE, 0x0a, 1)
0191 /* EV (scenemode) preset for CAPTURE */
0192 #define AE_EV_PRESET_CAPTURE    I2C_REG(CAT_AE, 0x0b, 1)
0193 #define REG_SCENE_NORMAL    0x00
0194 #define REG_SCENE_PORTRAIT  0x01
0195 #define REG_SCENE_LANDSCAPE 0x02
0196 #define REG_SCENE_SPORTS    0x03
0197 #define REG_SCENE_PARTY_INDOOR  0x04
0198 #define REG_SCENE_BEACH_SNOW    0x05
0199 #define REG_SCENE_SUNSET    0x06
0200 #define REG_SCENE_DAWN_DUSK 0x07
0201 #define REG_SCENE_FALL      0x08
0202 #define REG_SCENE_NIGHT     0x09
0203 #define REG_SCENE_AGAINST_LIGHT 0x0a
0204 #define REG_SCENE_FIRE      0x0b
0205 #define REG_SCENE_TEXT      0x0c
0206 #define REG_SCENE_CANDLE    0x0d
0207 
0208 /* Manual gain in MONITOR mode */
0209 #define AE_MAN_GAIN_MON     I2C_REG(CAT_AE, 0x12, 2)
0210 /* Maximum gain in MONITOR mode */
0211 #define AE_MAX_GAIN_MON     I2C_REG(CAT_AE, 0x1a, 2)
0212 /* Manual gain in CAPTURE mode */
0213 #define AE_MAN_GAIN_CAP     I2C_REG(CAT_AE, 0x26, 2)
0214 
0215 #define AE_INDEX        I2C_REG(CAT_AE, 0x38, 1)
0216 #define REG_AE_INDEX_20_NEG 0x00
0217 #define REG_AE_INDEX_15_NEG 0x01
0218 #define REG_AE_INDEX_10_NEG 0x02
0219 #define REG_AE_INDEX_05_NEG 0x03
0220 #define REG_AE_INDEX_00     0x04
0221 #define REG_AE_INDEX_05_POS 0x05
0222 #define REG_AE_INDEX_10_POS 0x06
0223 #define REG_AE_INDEX_15_POS 0x07
0224 #define REG_AE_INDEX_20_POS 0x08
0225 
0226 /*
0227  * Category 6 - White Balance
0228  */
0229 
0230 /* Auto Whitebalance locking */
0231 #define AWB_LOCK        I2C_REG(CAT_WB, 0x00, 1)
0232 #define REG_AWB_UNLOCK      0x00
0233 #define REG_AWB_LOCK        0x01
0234 
0235 #define AWB_MODE        I2C_REG(CAT_WB, 0x02, 1)
0236 #define REG_AWB_AUTO        0x01    /* AWB off */
0237 #define REG_AWB_PRESET      0x02    /* AWB preset */
0238 
0239 /* Manual WB (preset) */
0240 #define AWB_MANUAL      I2C_REG(CAT_WB, 0x03, 1)
0241 #define REG_AWB_INCANDESCENT    0x01
0242 #define REG_AWB_FLUORESCENT_1   0x02
0243 #define REG_AWB_FLUORESCENT_2   0x03
0244 #define REG_AWB_DAYLIGHT    0x04
0245 #define REG_AWB_CLOUDY      0x05
0246 #define REG_AWB_SHADE       0x06
0247 #define REG_AWB_HORIZON     0x07
0248 #define REG_AWB_LEDLIGHT    0x09
0249 
0250 /*
0251  * Category 7 - EXIF information
0252  */
0253 #define EXIF_INFO_EXPTIME_NU    I2C_REG(CAT_EXIF, 0x00, 4)
0254 #define EXIF_INFO_EXPTIME_DE    I2C_REG(CAT_EXIF, 0x04, 4)
0255 #define EXIF_INFO_TV_NU     I2C_REG(CAT_EXIF, 0x08, 4)
0256 #define EXIF_INFO_TV_DE     I2C_REG(CAT_EXIF, 0x0c, 4)
0257 #define EXIF_INFO_AV_NU     I2C_REG(CAT_EXIF, 0x10, 4)
0258 #define EXIF_INFO_AV_DE     I2C_REG(CAT_EXIF, 0x14, 4)
0259 #define EXIF_INFO_BV_NU     I2C_REG(CAT_EXIF, 0x18, 4)
0260 #define EXIF_INFO_BV_DE     I2C_REG(CAT_EXIF, 0x1c, 4)
0261 #define EXIF_INFO_EBV_NU    I2C_REG(CAT_EXIF, 0x20, 4)
0262 #define EXIF_INFO_EBV_DE    I2C_REG(CAT_EXIF, 0x24, 4)
0263 #define EXIF_INFO_ISO       I2C_REG(CAT_EXIF, 0x28, 2)
0264 #define EXIF_INFO_FLASH     I2C_REG(CAT_EXIF, 0x2a, 2)
0265 #define EXIF_INFO_SDR       I2C_REG(CAT_EXIF, 0x2c, 2)
0266 #define EXIF_INFO_QVAL      I2C_REG(CAT_EXIF, 0x2e, 2)
0267 
0268 /*
0269  * Category 9 - Face Detection
0270  */
0271 #define FD_CTL          I2C_REG(CAT_FD, 0x00, 1)
0272 #define BIT_FD_EN       0
0273 #define BIT_FD_DRAW_FACE_FRAME  4
0274 #define BIT_FD_DRAW_SMILE_LVL   6
0275 #define REG_FD(shift)       (1 << shift)
0276 #define REG_FD_OFF      0x0
0277 
0278 /*
0279  * Category A - Lens Parameter
0280  */
0281 #define AF_MODE         I2C_REG(CAT_LENS, 0x01, 1)
0282 #define REG_AF_NORMAL       0x00    /* Normal AF, one time */
0283 #define REG_AF_MACRO        0x01    /* Macro AF, one time */
0284 #define REG_AF_POWEROFF     0x07
0285 
0286 #define AF_EXECUTE      I2C_REG(CAT_LENS, 0x02, 1)
0287 #define REG_AF_STOP     0x00
0288 #define REG_AF_EXE_AUTO     0x01
0289 #define REG_AF_EXE_CAF      0x02
0290 
0291 #define AF_STATUS       I2C_REG(CAT_LENS, 0x03, 1)
0292 #define REG_AF_FAIL     0x00
0293 #define REG_AF_SUCCESS      0x02
0294 #define REG_AF_IDLE     0x04
0295 #define REG_AF_BUSY     0x05
0296 
0297 #define AF_VERSION      I2C_REG(CAT_LENS, 0x0a, 1)
0298 
0299 /*
0300  * Category B - CAPTURE Parameter
0301  */
0302 #define CAPP_YUVOUT_MAIN    I2C_REG(CAT_CAPT_PARM, 0x00, 1)
0303 #define REG_YUV422      0x00
0304 #define REG_BAYER10     0x05
0305 #define REG_BAYER8      0x06
0306 #define REG_JPEG        0x10
0307 
0308 #define CAPP_MAIN_IMAGE_SIZE    I2C_REG(CAT_CAPT_PARM, 0x01, 1)
0309 #define CAPP_JPEG_SIZE_MAX  I2C_REG(CAT_CAPT_PARM, 0x0f, 4)
0310 #define CAPP_JPEG_RATIO     I2C_REG(CAT_CAPT_PARM, 0x17, 1)
0311 
0312 #define CAPP_MCC_MODE       I2C_REG(CAT_CAPT_PARM, 0x1d, 1)
0313 #define REG_MCC_OFF     0x00
0314 #define REG_MCC_NORMAL      0x01
0315 
0316 #define CAPP_WDR_EN     I2C_REG(CAT_CAPT_PARM, 0x2c, 1)
0317 #define REG_WDR_OFF     0x00
0318 #define REG_WDR_ON      0x01
0319 #define REG_WDR_AUTO        0x02
0320 
0321 #define CAPP_LIGHT_CTRL     I2C_REG(CAT_CAPT_PARM, 0x40, 1)
0322 #define REG_LIGHT_OFF       0x00
0323 #define REG_LIGHT_ON        0x01
0324 #define REG_LIGHT_AUTO      0x02
0325 
0326 #define CAPP_FLASH_CTRL     I2C_REG(CAT_CAPT_PARM, 0x41, 1)
0327 #define REG_FLASH_OFF       0x00
0328 #define REG_FLASH_ON        0x01
0329 #define REG_FLASH_AUTO      0x02
0330 
0331 /*
0332  * Category C - CAPTURE Control
0333  */
0334 #define CAPC_MODE       I2C_REG(CAT_CAPT_CTRL, 0x00, 1)
0335 #define REG_CAP_NONE        0x00
0336 #define REG_CAP_ANTI_SHAKE  0x02
0337 
0338 /* Select single- or multi-shot capture */
0339 #define CAPC_SEL_FRAME      I2C_REG(CAT_CAPT_CTRL, 0x06, 1)
0340 
0341 #define CAPC_START      I2C_REG(CAT_CAPT_CTRL, 0x09, 1)
0342 #define REG_CAP_START_MAIN  0x01
0343 #define REG_CAP_START_THUMB 0x03
0344 
0345 #define CAPC_IMAGE_SIZE     I2C_REG(CAT_CAPT_CTRL, 0x0d, 4)
0346 #define CAPC_THUMB_SIZE     I2C_REG(CAT_CAPT_CTRL, 0x11, 4)
0347 
0348 /*
0349  * Category F - Flash
0350  *
0351  * This mode provides functions about internal flash stuff and system startup.
0352  */
0353 
0354 /* Starts internal ARM core booting after power-up */
0355 #define FLASH_CAM_START     I2C_REG(CAT_FLASH, 0x12, 1)
0356 #define REG_START_ARM_BOOT  0x01    /* write value */
0357 #define REG_IN_FLASH_MODE   0x00    /* read value */
0358 
0359 #endif  /* M5MOLS_REG_H */