1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18#ifndef ATOMISP_PLATFORM_H_
19#define ATOMISP_PLATFORM_H_
20
21#include <asm/intel-family.h>
22#include <asm/processor.h>
23
24#include <linux/i2c.h>
25#include <linux/sfi.h>
26#include <media/v4l2-subdev.h>
27#include "atomisp.h"
28
29#define MAX_SENSORS_PER_PORT 4
30#define MAX_STREAMS_PER_CHANNEL 2
31
32#define CAMERA_MODULE_ID_LEN 64
33
34enum atomisp_bayer_order {
35 atomisp_bayer_order_grbg,
36 atomisp_bayer_order_rggb,
37 atomisp_bayer_order_bggr,
38 atomisp_bayer_order_gbrg
39};
40
41enum atomisp_input_stream_id {
42 ATOMISP_INPUT_STREAM_GENERAL = 0,
43 ATOMISP_INPUT_STREAM_CAPTURE = 0,
44 ATOMISP_INPUT_STREAM_POSTVIEW,
45 ATOMISP_INPUT_STREAM_PREVIEW,
46 ATOMISP_INPUT_STREAM_VIDEO,
47 ATOMISP_INPUT_STREAM_NUM
48};
49
50enum atomisp_input_format {
51 ATOMISP_INPUT_FORMAT_YUV420_8_LEGACY,
52 ATOMISP_INPUT_FORMAT_YUV420_8,
53 ATOMISP_INPUT_FORMAT_YUV420_10,
54 ATOMISP_INPUT_FORMAT_YUV420_16,
55 ATOMISP_INPUT_FORMAT_YUV422_8,
56 ATOMISP_INPUT_FORMAT_YUV422_10,
57 ATOMISP_INPUT_FORMAT_YUV422_16,
58 ATOMISP_INPUT_FORMAT_RGB_444,
59 ATOMISP_INPUT_FORMAT_RGB_555,
60 ATOMISP_INPUT_FORMAT_RGB_565,
61 ATOMISP_INPUT_FORMAT_RGB_666,
62 ATOMISP_INPUT_FORMAT_RGB_888,
63 ATOMISP_INPUT_FORMAT_RAW_6,
64 ATOMISP_INPUT_FORMAT_RAW_7,
65 ATOMISP_INPUT_FORMAT_RAW_8,
66 ATOMISP_INPUT_FORMAT_RAW_10,
67 ATOMISP_INPUT_FORMAT_RAW_12,
68 ATOMISP_INPUT_FORMAT_RAW_14,
69 ATOMISP_INPUT_FORMAT_RAW_16,
70 ATOMISP_INPUT_FORMAT_BINARY_8,
71
72
73
74
75
76 ATOMISP_INPUT_FORMAT_GENERIC_SHORT1,
77 ATOMISP_INPUT_FORMAT_GENERIC_SHORT2,
78 ATOMISP_INPUT_FORMAT_GENERIC_SHORT3,
79 ATOMISP_INPUT_FORMAT_GENERIC_SHORT4,
80 ATOMISP_INPUT_FORMAT_GENERIC_SHORT5,
81 ATOMISP_INPUT_FORMAT_GENERIC_SHORT6,
82 ATOMISP_INPUT_FORMAT_GENERIC_SHORT7,
83 ATOMISP_INPUT_FORMAT_GENERIC_SHORT8,
84
85
86
87 ATOMISP_INPUT_FORMAT_YUV420_8_SHIFT,
88
89 ATOMISP_INPUT_FORMAT_YUV420_10_SHIFT,
90
91
92
93
94 ATOMISP_INPUT_FORMAT_EMBEDDED,
95
96
97
98
99
100
101 ATOMISP_INPUT_FORMAT_USER_DEF1,
102 ATOMISP_INPUT_FORMAT_USER_DEF2,
103 ATOMISP_INPUT_FORMAT_USER_DEF3,
104 ATOMISP_INPUT_FORMAT_USER_DEF4,
105 ATOMISP_INPUT_FORMAT_USER_DEF5,
106 ATOMISP_INPUT_FORMAT_USER_DEF6,
107 ATOMISP_INPUT_FORMAT_USER_DEF7,
108 ATOMISP_INPUT_FORMAT_USER_DEF8,
109};
110
111#define N_ATOMISP_INPUT_FORMAT (ATOMISP_INPUT_FORMAT_USER_DEF8 + 1)
112
113enum intel_v4l2_subdev_type {
114 RAW_CAMERA = 1,
115 SOC_CAMERA = 2,
116 CAMERA_MOTOR = 3,
117 LED_FLASH = 4,
118 XENON_FLASH = 5,
119 FILE_INPUT = 6,
120 TEST_PATTERN = 7,
121};
122
123struct intel_v4l2_subdev_id {
124 char name[17];
125 enum intel_v4l2_subdev_type type;
126 enum atomisp_camera_port port;
127};
128
129struct intel_v4l2_subdev_i2c_board_info {
130 struct i2c_board_info board_info;
131 int i2c_adapter_id;
132};
133
134struct intel_v4l2_subdev_table {
135 struct intel_v4l2_subdev_i2c_board_info v4l2_subdev;
136 enum intel_v4l2_subdev_type type;
137 enum atomisp_camera_port port;
138 struct v4l2_subdev *subdev;
139};
140
141struct atomisp_platform_data {
142 struct intel_v4l2_subdev_table *subdevs;
143};
144
145
146struct atomisp_sensor_caps {
147
148 int stream_num;
149 bool is_slave;
150};
151
152
153struct atomisp_camera_caps {
154
155 int sensor_num;
156
157 struct atomisp_sensor_caps sensor[MAX_SENSORS_PER_PORT];
158
159 bool multi_stream_ctrl;
160};
161
162
163
164
165
166
167struct atomisp_isys_config_info {
168 u8 input_format;
169 u16 width;
170 u16 height;
171};
172
173struct atomisp_input_stream_info {
174 enum atomisp_input_stream_id stream;
175 u8 enable;
176
177
178 u8 ch_id;
179
180
181 u8 isys_configs;
182
183
184
185
186
187 struct atomisp_isys_config_info isys_info[MAX_STREAMS_PER_CHANNEL];
188};
189
190struct camera_vcm_control;
191struct camera_vcm_ops {
192 int (*power_up)(struct v4l2_subdev *sd, struct camera_vcm_control *vcm);
193 int (*power_down)(struct v4l2_subdev *sd,
194 struct camera_vcm_control *vcm);
195 int (*queryctrl)(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc,
196 struct camera_vcm_control *vcm);
197 int (*g_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl,
198 struct camera_vcm_control *vcm);
199 int (*s_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl,
200 struct camera_vcm_control *vcm);
201};
202
203struct camera_vcm_control {
204 char camera_module[CAMERA_MODULE_ID_LEN];
205 struct camera_vcm_ops *ops;
206 struct list_head list;
207};
208
209struct camera_sensor_platform_data {
210 int (*flisclk_ctrl)(struct v4l2_subdev *subdev, int flag);
211 int (*csi_cfg)(struct v4l2_subdev *subdev, int flag);
212
213
214
215
216
217 int (*gpio0_ctrl)(struct v4l2_subdev *subdev, int on);
218 int (*gpio1_ctrl)(struct v4l2_subdev *subdev, int on);
219 int (*v1p8_ctrl)(struct v4l2_subdev *subdev, int on);
220 int (*v2p8_ctrl)(struct v4l2_subdev *subdev, int on);
221 int (*v1p2_ctrl)(struct v4l2_subdev *subdev, int on);
222 struct camera_vcm_control *(*get_vcm_ctrl)(struct v4l2_subdev *subdev,
223 char *module_id);
224};
225
226struct camera_mipi_info {
227 enum atomisp_camera_port port;
228 unsigned int num_lanes;
229 enum atomisp_input_format input_format;
230 enum atomisp_bayer_order raw_bayer_order;
231 struct atomisp_sensor_mode_data data;
232 enum atomisp_input_format metadata_format;
233 u32 metadata_width;
234 u32 metadata_height;
235 const u32 *metadata_effective_width;
236};
237
238const struct atomisp_platform_data *atomisp_get_platform_data(void);
239const struct atomisp_camera_caps *atomisp_get_default_camera_caps(void);
240
241
242#define __IS_SOC(x) (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL && \
243 boot_cpu_data.x86 == 6 && \
244 boot_cpu_data.x86_model == (x))
245#define __IS_SOCS(x,y) (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL && \
246 boot_cpu_data.x86 == 6 && \
247 (boot_cpu_data.x86_model == (x) || \
248 boot_cpu_data.x86_model == (y)))
249
250#define IS_MFLD __IS_SOC(INTEL_FAM6_ATOM_SALTWELL_MID)
251#define IS_BYT __IS_SOC(INTEL_FAM6_ATOM_SILVERMONT)
252#define IS_CHT __IS_SOC(INTEL_FAM6_ATOM_AIRMONT)
253#define IS_MRFD __IS_SOC(INTEL_FAM6_ATOM_SILVERMONT_MID)
254#define IS_MOFD __IS_SOC(INTEL_FAM6_ATOM_AIRMONT_MID)
255
256
257#define IS_ISP2401 __IS_SOCS(INTEL_FAM6_ATOM_AIRMONT, \
258 INTEL_FAM6_ATOM_AIRMONT_MID)
259
260#endif
261