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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
|
/*
* Samsung Exynos5 SoC series FIMC-IS driver
*
*
* Copyright (c) 2011 Samsung Electronics Co., Ltd
*
* 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.
*/
#ifndef IS_DEVICE_ISCHAIN_H
#define IS_DEVICE_ISCHAIN_H
#include <linux/pm_qos.h>
#include "is-mem.h"
#include "is-subdev-ctrl.h"
#include "hardware/is-hw-control.h"
#include "is-groupmgr.h"
#include "is-resourcemgr.h"
#include "is-pipe.h"
#include "is-binary.h"
#define SENSOR_MAX_CTL 0x3
#define SENSOR_MAX_CTL_MASK (SENSOR_MAX_CTL-1)
#define REPROCESSING_FLAG 0x80000000
#define REPROCESSING_MASK 0xF0000000
#define REPROCESSING_SHIFT 28
#define OTF_3AA_MASK 0x0F000000
#define OTF_3AA_SHIFT 24
#define SSX_VINDEX_MASK 0x00FF0000
#define SSX_VINDEX_SHIFT 16
#define TAX_VINDEX_MASK 0x0000FF00
#define TAX_VINDEX_SHIFT 8
#define MODULE_MASK 0x000000FF
#define IS_SETFILE_MASK 0x0000FFFF
#define IS_SCENARIO_MASK 0xFFFF0000
#define IS_SCENARIO_SHIFT 16
#define IS_ISP_CRANGE_MASK 0x0F000000
#define IS_ISP_CRANGE_SHIFT 24
#define IS_SCC_CRANGE_MASK 0x00F00000
#define IS_SCC_CRANGE_SHIFT 20
#define IS_SCP_CRANGE_MASK 0x000F0000
#define IS_SCP_CRANGE_SHIFT 16
#define IS_CRANGE_FULL 0
#define IS_CRANGE_LIMITED 1
/* TODO: remove AA_SCENE_MODE_REMOSAIC */
#define CHK_MODECHANGE_SCN(captureIntent) \
(((captureIntent == AA_CAPTURE_INTENT_STILL_CAPTURE_REMOSAIC_SINGLE) \
|| (captureIntent == AA_CAPTURE_INTENT_STILL_CAPTURE_REMOSAIC_SINGLE_FLASH) \
|| (captureIntent == AA_CAPTURE_INTENT_STILL_CAPTURE_REMOSAIC_DYNAMIC_SHOT) \
|| (captureIntent == AA_CAPTURE_INTENT_STILL_CAPTURE_REMOSAIC_MFHDR_DYNAMIC_SHOT) \
|| (captureIntent == AA_CAPTURE_INTENT_STILL_CAPTURE_REMOSAIC_EXPOSURE_DYNAMIC_SHOT)) ? 1 : 0)
/*global state*/
enum is_ischain_state {
IS_ISCHAIN_OPENING,
IS_ISCHAIN_CLOSING,
IS_ISCHAIN_OPEN,
IS_ISCHAIN_INITING,
IS_ISCHAIN_INIT,
IS_ISCHAIN_START,
IS_ISCHAIN_LOADED,
IS_ISCHAIN_POWER_ON,
IS_ISCHAIN_OPEN_STREAM,
IS_ISCHAIN_REPROCESSING,
};
enum is_camera_device {
CAMERA_SINGLE_REAR,
CAMERA_SINGLE_FRONT,
};
enum is_fast_ctl_state {
IS_FAST_CTL_FREE,
IS_FAST_CTL_REQUEST,
IS_FAST_CTL_STATE,
};
struct is_fast_ctl {
struct list_head list;
u32 state;
bool lens_pos_flag;
uint32_t lens_pos;
};
#define MAX_NUM_FAST_CTL 9
struct fast_control_mgr {
u32 fast_capture_count;
spinlock_t slock;
struct is_fast_ctl fast_ctl[MAX_NUM_FAST_CTL];
u32 queued_count[IS_FAST_CTL_STATE];
struct list_head queued_list[IS_FAST_CTL_STATE];
};
#define NUM_OF_3AA_SUBDEV 4
#define NUM_OF_ISP_SUBDEV 2
#define NUM_OF_DCP_SUBDEV 6
#define NUM_OF_MCS_SUBDEV 6
struct is_device_ischain {
u32 instance; /* logical stream id */
u32 sensor_id; /* physical module enum */
struct platform_device *pdev;
struct exynos_platform_is *pdata;
struct is_resourcemgr *resourcemgr;
struct is_groupmgr *groupmgr;
struct is_devicemgr *devicemgr;
struct is_interface *interface;
struct is_hardware *hardware;
struct is_mem *mem;
u32 module;
struct is_minfo *minfo;
struct is_path_info path;
struct is_region *is_region;
ulong kvaddr_shared;
dma_addr_t dvaddr_shared;
unsigned long state;
atomic_t group_open_cnt;
atomic_t open_cnt;
atomic_t init_cnt;
u32 setfile;
#if !defined(FAST_FDAE)
struct camera2_fd_uctl fdUd;
#endif
#ifdef ENABLE_SENSOR_DRIVER
struct camera2_uctl peri_ctls[SENSOR_MAX_CTL];
#endif
/* isp margin */
u32 margin_left;
u32 margin_right;
u32 margin_width;
u32 margin_top;
u32 margin_bottom;
u32 margin_height;
#ifdef ENABLE_BUFFER_HIDING
struct is_pipe pipe;
#endif
struct is_group group_paf; /* for PAF Bayer RDMA */
struct is_subdev pdaf; /* PDP(PATSTAT) AF RDMA */
struct is_subdev pdst; /* PDP(PATSTAT) PD STAT WDMA */
struct is_group group_3aa;
struct is_subdev txc;
struct is_subdev txp;
struct is_subdev txf;
struct is_subdev txg;
struct is_subdev orbxc; /* for key points/descriptor */
struct is_group group_isp;
struct is_subdev ixc;
struct is_subdev ixp;
struct is_subdev ixt;
struct is_subdev ixg;
struct is_subdev ixv;
struct is_subdev ixw;
struct is_subdev mexc; /* for ME */
struct is_subdev drc;
struct is_subdev scc;
struct is_group group_dis;
struct is_subdev dxc; /* for capture video node of TPU */
struct is_subdev odc;
struct is_subdev dnr;
struct is_subdev scp;
struct is_group group_dcp;
struct is_subdev dc1s;
struct is_subdev dc0c;
struct is_subdev dc1c;
struct is_subdev dc2c;
struct is_subdev dc3c;
struct is_subdev dc4c;
struct is_group group_mcs;
struct is_subdev m0p;
struct is_subdev m1p;
struct is_subdev m2p;
struct is_subdev m3p;
struct is_subdev m4p;
struct is_subdev m5p;
struct is_group group_vra;
struct is_group group_clh; /* CLAHE RDMA */
struct is_subdev clhc; /* CLAHE WDMA */
u32 private_data;
struct is_device_sensor *sensor;
struct pm_qos_request user_qos;
/* Async metadata control to reduce frame delay */
struct fast_control_mgr fastctlmgr;
/* for NI(noise index from DDK) use */
u32 cur_noise_idx[NI_BACKUP_MAX]; /* Noise index for N + 1 */
u32 next_noise_idx[NI_BACKUP_MAX]; /* Noise index for N + 2 */
};
/*global function*/
int is_ischain_probe(struct is_device_ischain *device,
struct is_interface *interface,
struct is_resourcemgr *resourcemgr,
struct is_groupmgr *groupmgr,
struct is_devicemgr *devicemgr,
struct is_mem *mem,
struct platform_device *pdev,
u32 instance);
int is_ischain_g_ddk_setfile_version(struct is_device_ischain *device,
void *user_ptr);
int is_ischain_g_capability(struct is_device_ischain *this,
ulong user_ptr);
void is_ischain_meta_invalid(struct is_frame *frame);
int is_ischain_open_wrap(struct is_device_ischain *device, bool EOS);
int is_ischain_close_wrap(struct is_device_ischain *device);
int is_ischain_start_wrap(struct is_device_ischain *device,
struct is_group *group);
int is_ischain_stop_wrap(struct is_device_ischain *device,
struct is_group *group);
/* PAF_RDMA subdev */
int is_ischain_paf_open(struct is_device_ischain *device,
struct is_video_ctx *vctx);
int is_ischain_paf_close(struct is_device_ischain *device,
struct is_video_ctx *vctx);
int is_ischain_paf_s_input(struct is_device_ischain *device,
u32 stream_type,
u32 module_id,
u32 video_id,
u32 input_type,
u32 stream_leader);
int is_ischain_paf_buffer_queue(struct is_device_ischain *device,
struct is_queue *queue,
u32 index);
int is_ischain_paf_buffer_finish(struct is_device_ischain *device,
u32 index);
/* 3AA subdev */
int is_ischain_3aa_open(struct is_device_ischain *device,
struct is_video_ctx *vctx);
int is_ischain_3aa_close(struct is_device_ischain *device,
struct is_video_ctx *vctx);
int is_ischain_3aa_s_input(struct is_device_ischain *device,
u32 stream_type,
u32 module_id,
u32 video_id,
u32 input_type,
u32 stream_leader);
int is_ischain_3aa_buffer_queue(struct is_device_ischain *device,
struct is_queue *queue,
u32 index);
int is_ischain_3aa_buffer_finish(struct is_device_ischain *device,
u32 index);
/* isp subdev */
int is_ischain_isp_open(struct is_device_ischain *device,
struct is_video_ctx *vctx);
int is_ischain_isp_close(struct is_device_ischain *device,
struct is_video_ctx *vctx);
int is_ischain_isp_s_input(struct is_device_ischain *device,
u32 stream_type,
u32 module_id,
u32 video_id,
u32 input_type,
u32 stream_leader);
int is_ischain_isp_buffer_queue(struct is_device_ischain *device,
struct is_queue *queue,
u32 index);
int is_ischain_isp_buffer_finish(struct is_device_ischain *this,
u32 index);
/* MCSC subdev */
int is_ischain_mcs_open(struct is_device_ischain *device,
struct is_video_ctx *vctx);
int is_ischain_mcs_close(struct is_device_ischain *device,
struct is_video_ctx *vctx);
int is_ischain_mcs_s_input(struct is_device_ischain *device,
u32 stream_type,
u32 module_id,
u32 video_id,
u32 otf_input,
u32 stream_leader);
int is_ischain_mcs_buffer_queue(struct is_device_ischain *device,
struct is_queue *queue,
u32 index);
int is_ischain_mcs_buffer_finish(struct is_device_ischain *device,
u32 index);
/* vra subdev */
int is_ischain_vra_open(struct is_device_ischain *device,
struct is_video_ctx *vctx);
int is_ischain_vra_close(struct is_device_ischain *device,
struct is_video_ctx *vctx);
int is_ischain_vra_s_input(struct is_device_ischain *device,
u32 stream_type,
u32 module_id,
u32 video_id,
u32 otf_input,
u32 stream_leader);
int is_ischain_vra_buffer_queue(struct is_device_ischain *device,
struct is_queue *queue,
u32 index);
int is_ischain_vra_buffer_finish(struct is_device_ischain *this,
u32 index);
/* CLAHE subdev */
int is_ischain_clh_open(struct is_device_ischain *device,
struct is_video_ctx *vctx);
int is_ischain_clh_close(struct is_device_ischain *device,
struct is_video_ctx *vctx);
int is_ischain_clh_s_input(struct is_device_ischain *device,
u32 stream_type,
u32 module_id,
u32 video_id,
u32 input_type,
u32 stream_leader);
int is_ischain_clh_buffer_queue(struct is_device_ischain *device,
struct is_queue *queue,
u32 index);
int is_ischain_clh_buffer_finish(struct is_device_ischain *device,
u32 index);
int is_itf_stream_on(struct is_device_ischain *this);
int is_itf_stream_off(struct is_device_ischain *this);
int is_itf_process_start(struct is_device_ischain *device,
u32 group);
int is_itf_process_stop(struct is_device_ischain *device,
u32 group);
int is_itf_force_stop(struct is_device_ischain *device,
u32 group);
int is_itf_grp_shot(struct is_device_ischain *device,
struct is_group *group,
struct is_frame *frame);
int is_itf_i2c_lock(struct is_device_ischain *this,
int i2c_clk, bool lock);
int is_itf_s_param(struct is_device_ischain *device,
struct is_frame *frame,
u32 lindex,
u32 hindex,
u32 indexes);
void * is_itf_g_param(struct is_device_ischain *device,
struct is_frame *frame,
u32 index);
void is_itf_storefirm(struct is_device_ischain *device);
void is_itf_restorefirm(struct is_device_ischain *device);
int is_itf_set_fwboot(struct is_device_ischain *device, u32 val);
int is_ischain_buf_tag_input(struct is_device_ischain *device,
struct is_subdev *subdev,
struct is_frame *ldr_frame,
u32 pixelformat,
u32 width,
u32 height,
u32 target_addr[]);
int is_ischain_buf_tag(struct is_device_ischain *device,
struct is_subdev *subdev,
struct is_frame *ldr_frame,
u32 pixelformat,
u32 width,
u32 height,
u32 target_addr[]);
int is_ischain_buf_tag_64bit(struct is_device_ischain *device,
struct is_subdev *subdev,
struct is_frame *ldr_frame,
u32 pixelformat,
u32 width,
u32 height,
uint64_t target_addr[]);
extern const struct is_queue_ops is_ischain_paf_ops;
extern const struct is_queue_ops is_ischain_3aa_ops;
extern const struct is_queue_ops is_ischain_isp_ops;
extern const struct is_queue_ops is_ischain_dis_ops;
extern const struct is_queue_ops is_ischain_dcp_ops;
extern const struct is_queue_ops is_ischain_mcs_ops;
extern const struct is_queue_ops is_ischain_vra_ops;
extern const struct is_queue_ops is_ischain_clh_ops;
extern const struct is_queue_ops is_ischain_subdev_ops;
int is_itf_power_down(struct is_interface *interface);
int is_ischain_power(struct is_device_ischain *this, int on);
#define IS_EQUAL_COORD(i, o) \
(((i)[0] != (o)[0]) || ((i)[1] != (o)[1]) || \
((i)[2] != (o)[2]) || ((i)[3] != (o)[3]))
#define IS_NULL_COORD(c) \
(!(c)[0] && !(c)[1] && !(c)[2] && !(c)[3])
#endif
|