summaryrefslogtreecommitdiff
path: root/include/media/mt9m114.h
blob: 25f27ac62b8c44bde2999df2003586a493e7d72f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/*
 * Copyright (C) 2013 NVIDIA Corporation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 * 02111-1307, USA
 */

#ifndef __MT9M114_H__
#define __MT9M114_H__

#include <linux/ioctl.h>  /* For IOCTL macros */
#include <linux/edp.h>

#define SENSOR_NAME     "mt9m114"
#define DEV(x)          "/dev/"x
#define SENSOR_PATH     DEV(SENSOR_NAME)
#define LOG_NAME(x)     "ImagerODM-"x
#define LOG_TAG         LOG_NAME(SENSOR_NAME)

#define MT9M114_SENSOR_WAIT_MS          0
#define MT9M114_SENSOR_TABLE_END        1
#define MT9M114_SENSOR_BYTE_WRITE       2
#define MT9M114_SENSOR_WORD_WRITE       3
#define MT9M114_SENSOR_MASK_BYTE_WRITE  4
#define MT9M114_SENSOR_MASK_WORD_WRITE  5
#define MT9M114_SEQ_WRITE_START         6
#define MT9M114_SEQ_WRITE_END           7

#define MT9M114_SENSOR_MAX_RETRIES      3 /* max counter for retry I2C access */
#define MT9M114_MAX_FACEDETECT_WINDOWS  5
#define MT9M114_SENSOR_IOCTL_SET_MODE  _IOW('o', 1, struct mt9m114_modeinfo)
#define MT9M114_SENSOR_IOCTL_GET_STATUS         _IOR('o', 2, __u8)
#define MT9M114_SENSOR_IOCTL_SET_COLOR_EFFECT   _IOW('o', 3, __u16)
#define MT9M114_SENSOR_IOCTL_SET_WHITE_BALANCE  _IOW('o', 4, __u8)
#define MT9M114_SENSOR_IOCTL_SET_SCENE_MODE     _IOW('o', 5, __u8)
#define MT9M114_SENSOR_IOCTL_SET_AF_MODE        _IOW('o', 6, __u8)
#define MT9M114_SENSOR_IOCTL_GET_AF_STATUS      _IOR('o', 7, __u8)
#define MT9M114_SENSOR_IOCTL_SET_CAMERA         _IOW('o', 8, __u8)
#define MT9M114_SENSOR_IOCTL_SET_EV             _IOW('o', 9, __s16)
#define MT9M114_SENSOR_IOCTL_GET_EV             _IOR('o', 10, __s16)

struct mt9m114_mode {
	int xres;
	int yres;
};

struct mt9m114_modeinfo {
	int xres;
	int yres;
};

#define AF_CMD_START 0
#define AF_CMD_ABORT 1
#define AF_CMD_SET_POSITION  2
#define AF_CMD_SET_WINDOW_POSITION 3
#define AF_CMD_SET_WINDOW_SIZE 4
#define AF_CMD_SET_AFMODE  5
#define AF_CMD_SET_CAF 6
#define AF_CMD_GET_AF_STATUS 7

enum {
	MT9M114_YUV_ColorEffect_Invalid = 0xA000,
	MT9M114_YUV_ColorEffect_Aqua,
	MT9M114_YUV_ColorEffect_Blackboard,
	MT9M114_YUV_ColorEffect_Mono,
	MT9M114_YUV_ColorEffect_Negative,
	MT9M114_YUV_ColorEffect_None,
	MT9M114_YUV_ColorEffect_Posterize,
	MT9M114_YUV_ColorEffect_Sepia,
	MT9M114_YUV_ColorEffect_Solarize,
	MT9M114_YUV_ColorEffect_Whiteboard,
	MT9M114_YUV_ColorEffect_Vivid,
	MT9M114_YUV_ColorEffect_WaterColor,
	MT9M114_YUV_ColorEffect_Vintage,
	MT9M114_YUV_ColorEffect_Vintage2,
	MT9M114_YUV_ColorEffect_Lomo,
	MT9M114_YUV_ColorEffect_Red,
	MT9M114_YUV_ColorEffect_Blue,
	MT9M114_YUV_ColorEffect_Yellow,
	MT9M114_YUV_ColorEffect_Aura,
	MT9M114_YUV_ColorEffect_Max
};

enum {
	MT9M114_YUV_Whitebalance_Invalid = 0,
	MT9M114_YUV_Whitebalance_Auto,
	MT9M114_YUV_Whitebalance_Incandescent,
	MT9M114_YUV_Whitebalance_Fluorescent,
	MT9M114_YUV_Whitebalance_WarmFluorescent,
	MT9M114_YUV_Whitebalance_Daylight,
	MT9M114_YUV_Whitebalance_CloudyDaylight,
	MT9M114_YUV_Whitebalance_Shade,
	MT9M114_YUV_Whitebalance_Twilight,
	MT9M114_YUV_Whitebalance_Custom
};

enum {
	MT9M114_YUV_SceneMode_Invalid = 0,
	MT9M114_YUV_SceneMode_Auto,
	MT9M114_YUV_SceneMode_Action,
	MT9M114_YUV_SceneMode_Portrait,
	MT9M114_YUV_SceneMode_Landscape,
	MT9M114_YUV_SceneMode_Beach,
	MT9M114_YUV_SceneMode_Candlelight,
	MT9M114_YUV_SceneMode_Fireworks,
	MT9M114_YUV_SceneMode_Night,
	MT9M114_YUV_SceneMode_NightPortrait,
	MT9M114_YUV_SceneMode_Party,
	MT9M114_YUV_SceneMode_Snow,
	MT9M114_YUV_SceneMode_Sports,
	MT9M114_YUV_SceneMode_SteadyPhoto,
	MT9M114_YUV_SceneMode_Sunset,
	MT9M114_YUV_SceneMode_Theatre,
	MT9M114_YUV_SceneMode_Barcode,
	MT9M114_YUV_SceneMode_BackLight
};

struct mt9m114_sensordata {
	__u32 fuse_id_size;
	__u8  fuse_id[16];
};

#ifdef __KERNEL__
struct mt9m114_power_rail {
	struct regulator *dvdd;
	struct regulator *avdd;
	struct regulator *iovdd;
};

struct mt9m114_platform_data {
	int (*power_on)(struct mt9m114_power_rail *pw);
	int (*power_off)(struct mt9m114_power_rail *pw);
	const char *mclk_name;
	struct edp_client edpc_config;
};
#endif /* __KERNEL__ */

#endif  /* __MT9M114_H__ */