18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Register map for M-5MOLS 8M Pixel camera sensor with ISP
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2011 Samsung Electronics Co., Ltd.
68c2ecf20Sopenharmony_ci * Author: HeungJun Kim <riverful.kim@samsung.com>
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Copyright (C) 2009 Samsung Electronics Co., Ltd.
98c2ecf20Sopenharmony_ci * Author: Dongsoo Nathaniel Kim <dongsoo45.kim@samsung.com>
108c2ecf20Sopenharmony_ci */
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#ifndef M5MOLS_REG_H
138c2ecf20Sopenharmony_ci#define M5MOLS_REG_H
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#define M5MOLS_I2C_MAX_SIZE	4
168c2ecf20Sopenharmony_ci#define M5MOLS_BYTE_READ	0x01
178c2ecf20Sopenharmony_ci#define M5MOLS_BYTE_WRITE	0x02
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#define I2C_CATEGORY(__cat)		((__cat >> 16) & 0xff)
208c2ecf20Sopenharmony_ci#define I2C_COMMAND(__comm)		((__comm >> 8) & 0xff)
218c2ecf20Sopenharmony_ci#define I2C_SIZE(__reg_s)		((__reg_s) & 0xff)
228c2ecf20Sopenharmony_ci#define I2C_REG(__cat, __cmd, __reg_s)	((__cat << 16) | (__cmd << 8) | __reg_s)
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci/*
258c2ecf20Sopenharmony_ci * Category section register
268c2ecf20Sopenharmony_ci *
278c2ecf20Sopenharmony_ci * The category means set including relevant command of M-5MOLS.
288c2ecf20Sopenharmony_ci */
298c2ecf20Sopenharmony_ci#define CAT_SYSTEM		0x00
308c2ecf20Sopenharmony_ci#define CAT_PARAM		0x01
318c2ecf20Sopenharmony_ci#define CAT_MONITOR		0x02
328c2ecf20Sopenharmony_ci#define CAT_AE			0x03
338c2ecf20Sopenharmony_ci#define CAT_WB			0x06
348c2ecf20Sopenharmony_ci#define CAT_EXIF		0x07
358c2ecf20Sopenharmony_ci#define CAT_FD			0x09
368c2ecf20Sopenharmony_ci#define CAT_LENS		0x0a
378c2ecf20Sopenharmony_ci#define CAT_CAPT_PARM		0x0b
388c2ecf20Sopenharmony_ci#define CAT_CAPT_CTRL		0x0c
398c2ecf20Sopenharmony_ci#define CAT_FLASH		0x0f	/* related to FW, revisions, booting */
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci/*
428c2ecf20Sopenharmony_ci * Category 0 - SYSTEM mode
438c2ecf20Sopenharmony_ci *
448c2ecf20Sopenharmony_ci * The SYSTEM mode in the M-5MOLS means area available to handle with the whole
458c2ecf20Sopenharmony_ci * & all-round system of sensor. It deals with version/interrupt/setting mode &
468c2ecf20Sopenharmony_ci * even sensor's status. Especially, the M-5MOLS sensor with ISP varies by
478c2ecf20Sopenharmony_ci * packaging & manufacturer, even the customer and project code. And the
488c2ecf20Sopenharmony_ci * function details may vary among them. The version information helps to
498c2ecf20Sopenharmony_ci * determine what methods shall be used in the driver.
508c2ecf20Sopenharmony_ci *
518c2ecf20Sopenharmony_ci * There is many registers between customer version address and awb one. For
528c2ecf20Sopenharmony_ci * more specific contents, see definition if file m5mols.h.
538c2ecf20Sopenharmony_ci */
548c2ecf20Sopenharmony_ci#define SYSTEM_VER_CUSTOMER	I2C_REG(CAT_SYSTEM, 0x00, 1)
558c2ecf20Sopenharmony_ci#define SYSTEM_VER_PROJECT	I2C_REG(CAT_SYSTEM, 0x01, 1)
568c2ecf20Sopenharmony_ci#define SYSTEM_VER_FIRMWARE	I2C_REG(CAT_SYSTEM, 0x02, 2)
578c2ecf20Sopenharmony_ci#define SYSTEM_VER_HARDWARE	I2C_REG(CAT_SYSTEM, 0x04, 2)
588c2ecf20Sopenharmony_ci#define SYSTEM_VER_PARAMETER	I2C_REG(CAT_SYSTEM, 0x06, 2)
598c2ecf20Sopenharmony_ci#define SYSTEM_VER_AWB		I2C_REG(CAT_SYSTEM, 0x08, 2)
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci#define SYSTEM_SYSMODE		I2C_REG(CAT_SYSTEM, 0x0b, 1)
628c2ecf20Sopenharmony_ci#define REG_SYSINIT		0x00	/* SYSTEM mode */
638c2ecf20Sopenharmony_ci#define REG_PARAMETER		0x01	/* PARAMETER mode */
648c2ecf20Sopenharmony_ci#define REG_MONITOR		0x02	/* MONITOR mode */
658c2ecf20Sopenharmony_ci#define REG_CAPTURE		0x03	/* CAPTURE mode */
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci#define SYSTEM_CMD(__cmd)	I2C_REG(CAT_SYSTEM, cmd, 1)
688c2ecf20Sopenharmony_ci#define SYSTEM_VER_STRING	I2C_REG(CAT_SYSTEM, 0x0a, 1)
698c2ecf20Sopenharmony_ci#define REG_SAMSUNG_ELECTRO	"SE"	/* Samsung Electro-Mechanics */
708c2ecf20Sopenharmony_ci#define REG_SAMSUNG_OPTICS	"OP"	/* Samsung Fiber-Optics */
718c2ecf20Sopenharmony_ci#define REG_SAMSUNG_TECHWIN	"TB"	/* Samsung Techwin */
728c2ecf20Sopenharmony_ci/* SYSTEM mode status */
738c2ecf20Sopenharmony_ci#define SYSTEM_STATUS	I2C_REG(CAT_SYSTEM, 0x0c, 1)
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci/* Interrupt pending register */
768c2ecf20Sopenharmony_ci#define SYSTEM_INT_FACTOR	I2C_REG(CAT_SYSTEM, 0x10, 1)
778c2ecf20Sopenharmony_ci/* interrupt enable register */
788c2ecf20Sopenharmony_ci#define SYSTEM_INT_ENABLE	I2C_REG(CAT_SYSTEM, 0x11, 1)
798c2ecf20Sopenharmony_ci#define REG_INT_MODE		(1 << 0)
808c2ecf20Sopenharmony_ci#define REG_INT_AF		(1 << 1)
818c2ecf20Sopenharmony_ci#define REG_INT_ZOOM		(1 << 2)
828c2ecf20Sopenharmony_ci#define REG_INT_CAPTURE		(1 << 3)
838c2ecf20Sopenharmony_ci#define REG_INT_FRAMESYNC	(1 << 4)
848c2ecf20Sopenharmony_ci#define REG_INT_FD		(1 << 5)
858c2ecf20Sopenharmony_ci#define REG_INT_LENS_INIT	(1 << 6)
868c2ecf20Sopenharmony_ci#define REG_INT_SOUND		(1 << 7)
878c2ecf20Sopenharmony_ci#define REG_INT_MASK		0x0f
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci/*
908c2ecf20Sopenharmony_ci * category 1 - PARAMETER mode
918c2ecf20Sopenharmony_ci *
928c2ecf20Sopenharmony_ci * This category supports function of camera features of M-5MOLS. It means we
938c2ecf20Sopenharmony_ci * can handle with preview(MONITOR) resolution size/frame per second/interface
948c2ecf20Sopenharmony_ci * between the sensor and the Application Processor/even the image effect.
958c2ecf20Sopenharmony_ci */
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci/* Resolution in the MONITOR mode */
988c2ecf20Sopenharmony_ci#define PARM_MON_SIZE		I2C_REG(CAT_PARAM, 0x01, 1)
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ci/* Frame rate */
1018c2ecf20Sopenharmony_ci#define PARM_MON_FPS		I2C_REG(CAT_PARAM, 0x02, 1)
1028c2ecf20Sopenharmony_ci#define REG_FPS_30		0x02
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ci/* Video bus between the sensor and a host processor */
1058c2ecf20Sopenharmony_ci#define PARM_INTERFACE		I2C_REG(CAT_PARAM, 0x00, 1)
1068c2ecf20Sopenharmony_ci#define REG_INTERFACE_MIPI	0x02
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci/* Image effects */
1098c2ecf20Sopenharmony_ci#define PARM_EFFECT		I2C_REG(CAT_PARAM, 0x0b, 1)
1108c2ecf20Sopenharmony_ci#define REG_EFFECT_OFF		0x00
1118c2ecf20Sopenharmony_ci#define REG_EFFECT_NEGA		0x01
1128c2ecf20Sopenharmony_ci#define REG_EFFECT_EMBOSS	0x06
1138c2ecf20Sopenharmony_ci#define REG_EFFECT_OUTLINE	0x07
1148c2ecf20Sopenharmony_ci#define REG_EFFECT_WATERCOLOR	0x08
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ci/*
1178c2ecf20Sopenharmony_ci * Category 2 - MONITOR mode
1188c2ecf20Sopenharmony_ci *
1198c2ecf20Sopenharmony_ci * The MONITOR mode is same as preview mode as we said. The M-5MOLS has another
1208c2ecf20Sopenharmony_ci * mode named "Preview", but this preview mode is used at the case specific
1218c2ecf20Sopenharmony_ci * vider-recording mode. This mmode supports only YUYV format. On the other
1228c2ecf20Sopenharmony_ci * hand, the JPEG & RAW formats is supports by CAPTURE mode. And, there are
1238c2ecf20Sopenharmony_ci * another options like zoom/color effect(different with effect in PARAMETER
1248c2ecf20Sopenharmony_ci * mode)/anti hand shaking algorithm.
1258c2ecf20Sopenharmony_ci */
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ci/* Target digital zoom position */
1288c2ecf20Sopenharmony_ci#define MON_ZOOM		I2C_REG(CAT_MONITOR, 0x01, 1)
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci/* CR value for color effect */
1318c2ecf20Sopenharmony_ci#define MON_CFIXR		I2C_REG(CAT_MONITOR, 0x0a, 1)
1328c2ecf20Sopenharmony_ci/* CB value for color effect */
1338c2ecf20Sopenharmony_ci#define MON_CFIXB		I2C_REG(CAT_MONITOR, 0x09, 1)
1348c2ecf20Sopenharmony_ci#define REG_CFIXB_SEPIA		0xd8
1358c2ecf20Sopenharmony_ci#define REG_CFIXR_SEPIA		0x18
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci#define MON_EFFECT		I2C_REG(CAT_MONITOR, 0x0b, 1)
1388c2ecf20Sopenharmony_ci#define REG_COLOR_EFFECT_OFF	0x00
1398c2ecf20Sopenharmony_ci#define REG_COLOR_EFFECT_ON	0x01
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci/* Chroma enable */
1428c2ecf20Sopenharmony_ci#define MON_CHROMA_EN		I2C_REG(CAT_MONITOR, 0x10, 1)
1438c2ecf20Sopenharmony_ci/* Chroma level */
1448c2ecf20Sopenharmony_ci#define MON_CHROMA_LVL		I2C_REG(CAT_MONITOR, 0x0f, 1)
1458c2ecf20Sopenharmony_ci#define REG_CHROMA_OFF		0x00
1468c2ecf20Sopenharmony_ci#define REG_CHROMA_ON		0x01
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_ci/* Sharpness on/off */
1498c2ecf20Sopenharmony_ci#define MON_EDGE_EN		I2C_REG(CAT_MONITOR, 0x12, 1)
1508c2ecf20Sopenharmony_ci/* Sharpness level */
1518c2ecf20Sopenharmony_ci#define MON_EDGE_LVL		I2C_REG(CAT_MONITOR, 0x11, 1)
1528c2ecf20Sopenharmony_ci#define REG_EDGE_OFF		0x00
1538c2ecf20Sopenharmony_ci#define REG_EDGE_ON		0x01
1548c2ecf20Sopenharmony_ci
1558c2ecf20Sopenharmony_ci/* Set color tone (contrast) */
1568c2ecf20Sopenharmony_ci#define MON_TONE_CTL		I2C_REG(CAT_MONITOR, 0x25, 1)
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_ci/*
1598c2ecf20Sopenharmony_ci * Category 3 - Auto Exposure
1608c2ecf20Sopenharmony_ci *
1618c2ecf20Sopenharmony_ci * The M-5MOLS exposure capbility is detailed as which is similar to digital
1628c2ecf20Sopenharmony_ci * camera. This category supports AE locking/various AE mode(range of exposure)
1638c2ecf20Sopenharmony_ci * /ISO/flickering/EV bias/shutter/meteoring, and anything else. And the
1648c2ecf20Sopenharmony_ci * maximum/minimum exposure gain value depending on M-5MOLS firmware, may be
1658c2ecf20Sopenharmony_ci * different. So, this category also provide getting the max/min values. And,
1668c2ecf20Sopenharmony_ci * each MONITOR and CAPTURE mode has each gain/shutter/max exposure values.
1678c2ecf20Sopenharmony_ci */
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_ci/* Auto Exposure locking */
1708c2ecf20Sopenharmony_ci#define AE_LOCK			I2C_REG(CAT_AE, 0x00, 1)
1718c2ecf20Sopenharmony_ci#define REG_AE_UNLOCK		0x00
1728c2ecf20Sopenharmony_ci#define REG_AE_LOCK		0x01
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_ci/* Auto Exposure algorithm mode */
1758c2ecf20Sopenharmony_ci#define AE_MODE			I2C_REG(CAT_AE, 0x01, 1)
1768c2ecf20Sopenharmony_ci#define REG_AE_OFF		0x00	/* AE off */
1778c2ecf20Sopenharmony_ci#define REG_AE_ALL		0x01	/* calc AE in all block integral */
1788c2ecf20Sopenharmony_ci#define REG_AE_CENTER		0x03	/* calc AE in center weighted */
1798c2ecf20Sopenharmony_ci#define REG_AE_SPOT		0x06	/* calc AE in specific spot */
1808c2ecf20Sopenharmony_ci
1818c2ecf20Sopenharmony_ci#define AE_ISO			I2C_REG(CAT_AE, 0x05, 1)
1828c2ecf20Sopenharmony_ci#define REG_ISO_AUTO		0x00
1838c2ecf20Sopenharmony_ci#define REG_ISO_50		0x01
1848c2ecf20Sopenharmony_ci#define REG_ISO_100		0x02
1858c2ecf20Sopenharmony_ci#define REG_ISO_200		0x03
1868c2ecf20Sopenharmony_ci#define REG_ISO_400		0x04
1878c2ecf20Sopenharmony_ci#define REG_ISO_800		0x05
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ci/* EV (scenemode) preset for MONITOR */
1908c2ecf20Sopenharmony_ci#define AE_EV_PRESET_MONITOR	I2C_REG(CAT_AE, 0x0a, 1)
1918c2ecf20Sopenharmony_ci/* EV (scenemode) preset for CAPTURE */
1928c2ecf20Sopenharmony_ci#define AE_EV_PRESET_CAPTURE	I2C_REG(CAT_AE, 0x0b, 1)
1938c2ecf20Sopenharmony_ci#define REG_SCENE_NORMAL	0x00
1948c2ecf20Sopenharmony_ci#define REG_SCENE_PORTRAIT	0x01
1958c2ecf20Sopenharmony_ci#define REG_SCENE_LANDSCAPE	0x02
1968c2ecf20Sopenharmony_ci#define REG_SCENE_SPORTS	0x03
1978c2ecf20Sopenharmony_ci#define REG_SCENE_PARTY_INDOOR	0x04
1988c2ecf20Sopenharmony_ci#define REG_SCENE_BEACH_SNOW	0x05
1998c2ecf20Sopenharmony_ci#define REG_SCENE_SUNSET	0x06
2008c2ecf20Sopenharmony_ci#define REG_SCENE_DAWN_DUSK	0x07
2018c2ecf20Sopenharmony_ci#define REG_SCENE_FALL		0x08
2028c2ecf20Sopenharmony_ci#define REG_SCENE_NIGHT		0x09
2038c2ecf20Sopenharmony_ci#define REG_SCENE_AGAINST_LIGHT	0x0a
2048c2ecf20Sopenharmony_ci#define REG_SCENE_FIRE		0x0b
2058c2ecf20Sopenharmony_ci#define REG_SCENE_TEXT		0x0c
2068c2ecf20Sopenharmony_ci#define REG_SCENE_CANDLE	0x0d
2078c2ecf20Sopenharmony_ci
2088c2ecf20Sopenharmony_ci/* Manual gain in MONITOR mode */
2098c2ecf20Sopenharmony_ci#define AE_MAN_GAIN_MON		I2C_REG(CAT_AE, 0x12, 2)
2108c2ecf20Sopenharmony_ci/* Maximum gain in MONITOR mode */
2118c2ecf20Sopenharmony_ci#define AE_MAX_GAIN_MON		I2C_REG(CAT_AE, 0x1a, 2)
2128c2ecf20Sopenharmony_ci/* Manual gain in CAPTURE mode */
2138c2ecf20Sopenharmony_ci#define AE_MAN_GAIN_CAP		I2C_REG(CAT_AE, 0x26, 2)
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_ci#define AE_INDEX		I2C_REG(CAT_AE, 0x38, 1)
2168c2ecf20Sopenharmony_ci#define REG_AE_INDEX_20_NEG	0x00
2178c2ecf20Sopenharmony_ci#define REG_AE_INDEX_15_NEG	0x01
2188c2ecf20Sopenharmony_ci#define REG_AE_INDEX_10_NEG	0x02
2198c2ecf20Sopenharmony_ci#define REG_AE_INDEX_05_NEG	0x03
2208c2ecf20Sopenharmony_ci#define REG_AE_INDEX_00		0x04
2218c2ecf20Sopenharmony_ci#define REG_AE_INDEX_05_POS	0x05
2228c2ecf20Sopenharmony_ci#define REG_AE_INDEX_10_POS	0x06
2238c2ecf20Sopenharmony_ci#define REG_AE_INDEX_15_POS	0x07
2248c2ecf20Sopenharmony_ci#define REG_AE_INDEX_20_POS	0x08
2258c2ecf20Sopenharmony_ci
2268c2ecf20Sopenharmony_ci/*
2278c2ecf20Sopenharmony_ci * Category 6 - White Balance
2288c2ecf20Sopenharmony_ci */
2298c2ecf20Sopenharmony_ci
2308c2ecf20Sopenharmony_ci/* Auto Whitebalance locking */
2318c2ecf20Sopenharmony_ci#define AWB_LOCK		I2C_REG(CAT_WB, 0x00, 1)
2328c2ecf20Sopenharmony_ci#define REG_AWB_UNLOCK		0x00
2338c2ecf20Sopenharmony_ci#define REG_AWB_LOCK		0x01
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_ci#define AWB_MODE		I2C_REG(CAT_WB, 0x02, 1)
2368c2ecf20Sopenharmony_ci#define REG_AWB_AUTO		0x01	/* AWB off */
2378c2ecf20Sopenharmony_ci#define REG_AWB_PRESET		0x02	/* AWB preset */
2388c2ecf20Sopenharmony_ci
2398c2ecf20Sopenharmony_ci/* Manual WB (preset) */
2408c2ecf20Sopenharmony_ci#define AWB_MANUAL		I2C_REG(CAT_WB, 0x03, 1)
2418c2ecf20Sopenharmony_ci#define REG_AWB_INCANDESCENT	0x01
2428c2ecf20Sopenharmony_ci#define REG_AWB_FLUORESCENT_1	0x02
2438c2ecf20Sopenharmony_ci#define REG_AWB_FLUORESCENT_2	0x03
2448c2ecf20Sopenharmony_ci#define REG_AWB_DAYLIGHT	0x04
2458c2ecf20Sopenharmony_ci#define REG_AWB_CLOUDY		0x05
2468c2ecf20Sopenharmony_ci#define REG_AWB_SHADE		0x06
2478c2ecf20Sopenharmony_ci#define REG_AWB_HORIZON		0x07
2488c2ecf20Sopenharmony_ci#define REG_AWB_LEDLIGHT	0x09
2498c2ecf20Sopenharmony_ci
2508c2ecf20Sopenharmony_ci/*
2518c2ecf20Sopenharmony_ci * Category 7 - EXIF information
2528c2ecf20Sopenharmony_ci */
2538c2ecf20Sopenharmony_ci#define EXIF_INFO_EXPTIME_NU	I2C_REG(CAT_EXIF, 0x00, 4)
2548c2ecf20Sopenharmony_ci#define EXIF_INFO_EXPTIME_DE	I2C_REG(CAT_EXIF, 0x04, 4)
2558c2ecf20Sopenharmony_ci#define EXIF_INFO_TV_NU		I2C_REG(CAT_EXIF, 0x08, 4)
2568c2ecf20Sopenharmony_ci#define EXIF_INFO_TV_DE		I2C_REG(CAT_EXIF, 0x0c, 4)
2578c2ecf20Sopenharmony_ci#define EXIF_INFO_AV_NU		I2C_REG(CAT_EXIF, 0x10, 4)
2588c2ecf20Sopenharmony_ci#define EXIF_INFO_AV_DE		I2C_REG(CAT_EXIF, 0x14, 4)
2598c2ecf20Sopenharmony_ci#define EXIF_INFO_BV_NU		I2C_REG(CAT_EXIF, 0x18, 4)
2608c2ecf20Sopenharmony_ci#define EXIF_INFO_BV_DE		I2C_REG(CAT_EXIF, 0x1c, 4)
2618c2ecf20Sopenharmony_ci#define EXIF_INFO_EBV_NU	I2C_REG(CAT_EXIF, 0x20, 4)
2628c2ecf20Sopenharmony_ci#define EXIF_INFO_EBV_DE	I2C_REG(CAT_EXIF, 0x24, 4)
2638c2ecf20Sopenharmony_ci#define EXIF_INFO_ISO		I2C_REG(CAT_EXIF, 0x28, 2)
2648c2ecf20Sopenharmony_ci#define EXIF_INFO_FLASH		I2C_REG(CAT_EXIF, 0x2a, 2)
2658c2ecf20Sopenharmony_ci#define EXIF_INFO_SDR		I2C_REG(CAT_EXIF, 0x2c, 2)
2668c2ecf20Sopenharmony_ci#define EXIF_INFO_QVAL		I2C_REG(CAT_EXIF, 0x2e, 2)
2678c2ecf20Sopenharmony_ci
2688c2ecf20Sopenharmony_ci/*
2698c2ecf20Sopenharmony_ci * Category 9 - Face Detection
2708c2ecf20Sopenharmony_ci */
2718c2ecf20Sopenharmony_ci#define FD_CTL			I2C_REG(CAT_FD, 0x00, 1)
2728c2ecf20Sopenharmony_ci#define BIT_FD_EN		0
2738c2ecf20Sopenharmony_ci#define BIT_FD_DRAW_FACE_FRAME	4
2748c2ecf20Sopenharmony_ci#define BIT_FD_DRAW_SMILE_LVL	6
2758c2ecf20Sopenharmony_ci#define REG_FD(shift)		(1 << shift)
2768c2ecf20Sopenharmony_ci#define REG_FD_OFF		0x0
2778c2ecf20Sopenharmony_ci
2788c2ecf20Sopenharmony_ci/*
2798c2ecf20Sopenharmony_ci * Category A - Lens Parameter
2808c2ecf20Sopenharmony_ci */
2818c2ecf20Sopenharmony_ci#define AF_MODE			I2C_REG(CAT_LENS, 0x01, 1)
2828c2ecf20Sopenharmony_ci#define REG_AF_NORMAL		0x00	/* Normal AF, one time */
2838c2ecf20Sopenharmony_ci#define REG_AF_MACRO		0x01	/* Macro AF, one time */
2848c2ecf20Sopenharmony_ci#define REG_AF_POWEROFF		0x07
2858c2ecf20Sopenharmony_ci
2868c2ecf20Sopenharmony_ci#define AF_EXECUTE		I2C_REG(CAT_LENS, 0x02, 1)
2878c2ecf20Sopenharmony_ci#define REG_AF_STOP		0x00
2888c2ecf20Sopenharmony_ci#define REG_AF_EXE_AUTO		0x01
2898c2ecf20Sopenharmony_ci#define REG_AF_EXE_CAF		0x02
2908c2ecf20Sopenharmony_ci
2918c2ecf20Sopenharmony_ci#define AF_STATUS		I2C_REG(CAT_LENS, 0x03, 1)
2928c2ecf20Sopenharmony_ci#define REG_AF_FAIL		0x00
2938c2ecf20Sopenharmony_ci#define REG_AF_SUCCESS		0x02
2948c2ecf20Sopenharmony_ci#define REG_AF_IDLE		0x04
2958c2ecf20Sopenharmony_ci#define REG_AF_BUSY		0x05
2968c2ecf20Sopenharmony_ci
2978c2ecf20Sopenharmony_ci#define AF_VERSION		I2C_REG(CAT_LENS, 0x0a, 1)
2988c2ecf20Sopenharmony_ci
2998c2ecf20Sopenharmony_ci/*
3008c2ecf20Sopenharmony_ci * Category B - CAPTURE Parameter
3018c2ecf20Sopenharmony_ci */
3028c2ecf20Sopenharmony_ci#define CAPP_YUVOUT_MAIN	I2C_REG(CAT_CAPT_PARM, 0x00, 1)
3038c2ecf20Sopenharmony_ci#define REG_YUV422		0x00
3048c2ecf20Sopenharmony_ci#define REG_BAYER10		0x05
3058c2ecf20Sopenharmony_ci#define REG_BAYER8		0x06
3068c2ecf20Sopenharmony_ci#define REG_JPEG		0x10
3078c2ecf20Sopenharmony_ci
3088c2ecf20Sopenharmony_ci#define CAPP_MAIN_IMAGE_SIZE	I2C_REG(CAT_CAPT_PARM, 0x01, 1)
3098c2ecf20Sopenharmony_ci#define CAPP_JPEG_SIZE_MAX	I2C_REG(CAT_CAPT_PARM, 0x0f, 4)
3108c2ecf20Sopenharmony_ci#define CAPP_JPEG_RATIO		I2C_REG(CAT_CAPT_PARM, 0x17, 1)
3118c2ecf20Sopenharmony_ci
3128c2ecf20Sopenharmony_ci#define CAPP_MCC_MODE		I2C_REG(CAT_CAPT_PARM, 0x1d, 1)
3138c2ecf20Sopenharmony_ci#define REG_MCC_OFF		0x00
3148c2ecf20Sopenharmony_ci#define REG_MCC_NORMAL		0x01
3158c2ecf20Sopenharmony_ci
3168c2ecf20Sopenharmony_ci#define CAPP_WDR_EN		I2C_REG(CAT_CAPT_PARM, 0x2c, 1)
3178c2ecf20Sopenharmony_ci#define REG_WDR_OFF		0x00
3188c2ecf20Sopenharmony_ci#define REG_WDR_ON		0x01
3198c2ecf20Sopenharmony_ci#define REG_WDR_AUTO		0x02
3208c2ecf20Sopenharmony_ci
3218c2ecf20Sopenharmony_ci#define CAPP_LIGHT_CTRL		I2C_REG(CAT_CAPT_PARM, 0x40, 1)
3228c2ecf20Sopenharmony_ci#define REG_LIGHT_OFF		0x00
3238c2ecf20Sopenharmony_ci#define REG_LIGHT_ON		0x01
3248c2ecf20Sopenharmony_ci#define REG_LIGHT_AUTO		0x02
3258c2ecf20Sopenharmony_ci
3268c2ecf20Sopenharmony_ci#define CAPP_FLASH_CTRL		I2C_REG(CAT_CAPT_PARM, 0x41, 1)
3278c2ecf20Sopenharmony_ci#define REG_FLASH_OFF		0x00
3288c2ecf20Sopenharmony_ci#define REG_FLASH_ON		0x01
3298c2ecf20Sopenharmony_ci#define REG_FLASH_AUTO		0x02
3308c2ecf20Sopenharmony_ci
3318c2ecf20Sopenharmony_ci/*
3328c2ecf20Sopenharmony_ci * Category C - CAPTURE Control
3338c2ecf20Sopenharmony_ci */
3348c2ecf20Sopenharmony_ci#define CAPC_MODE		I2C_REG(CAT_CAPT_CTRL, 0x00, 1)
3358c2ecf20Sopenharmony_ci#define REG_CAP_NONE		0x00
3368c2ecf20Sopenharmony_ci#define REG_CAP_ANTI_SHAKE	0x02
3378c2ecf20Sopenharmony_ci
3388c2ecf20Sopenharmony_ci/* Select single- or multi-shot capture */
3398c2ecf20Sopenharmony_ci#define CAPC_SEL_FRAME		I2C_REG(CAT_CAPT_CTRL, 0x06, 1)
3408c2ecf20Sopenharmony_ci
3418c2ecf20Sopenharmony_ci#define CAPC_START		I2C_REG(CAT_CAPT_CTRL, 0x09, 1)
3428c2ecf20Sopenharmony_ci#define REG_CAP_START_MAIN	0x01
3438c2ecf20Sopenharmony_ci#define REG_CAP_START_THUMB	0x03
3448c2ecf20Sopenharmony_ci
3458c2ecf20Sopenharmony_ci#define CAPC_IMAGE_SIZE		I2C_REG(CAT_CAPT_CTRL, 0x0d, 4)
3468c2ecf20Sopenharmony_ci#define CAPC_THUMB_SIZE		I2C_REG(CAT_CAPT_CTRL, 0x11, 4)
3478c2ecf20Sopenharmony_ci
3488c2ecf20Sopenharmony_ci/*
3498c2ecf20Sopenharmony_ci * Category F - Flash
3508c2ecf20Sopenharmony_ci *
3518c2ecf20Sopenharmony_ci * This mode provides functions about internal flash stuff and system startup.
3528c2ecf20Sopenharmony_ci */
3538c2ecf20Sopenharmony_ci
3548c2ecf20Sopenharmony_ci/* Starts internal ARM core booting after power-up */
3558c2ecf20Sopenharmony_ci#define FLASH_CAM_START		I2C_REG(CAT_FLASH, 0x12, 1)
3568c2ecf20Sopenharmony_ci#define REG_START_ARM_BOOT	0x01	/* write value */
3578c2ecf20Sopenharmony_ci#define REG_IN_FLASH_MODE	0x00	/* read value */
3588c2ecf20Sopenharmony_ci
3598c2ecf20Sopenharmony_ci#endif	/* M5MOLS_REG_H */
360