2 * Samsung EXYNOS4x12 FIMC-IS (Imaging Subsystem) driver
4 * Copyright (C) 2013 Samsung Electronics Co., Ltd.
6 * Authors: Younghwan Joo <yhwan.joo@samsung.com>
7 * Sylwester Nawrocki <s.nawrocki@samsung.com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
13 #define pr_fmt(fmt) "%s:%d " fmt, __func__, __LINE__
15 #include <linux/bitops.h>
16 #include <linux/bug.h>
17 #include <linux/device.h>
18 #include <linux/errno.h>
19 #include <linux/kernel.h>
20 #include <linux/module.h>
21 #include <linux/platform_device.h>
22 #include <linux/slab.h>
23 #include <linux/types.h>
24 #include <linux/videodev2.h>
26 #include <media/v4l2-device.h>
27 #include <media/v4l2-ioctl.h>
30 #include "fimc-is-command.h"
31 #include "fimc-is-errno.h"
32 #include "fimc-is-param.h"
33 #include "fimc-is-regs.h"
34 #include "fimc-is-sensor.h"
36 static void __hw_param_copy(void *dst
, void *src
)
38 memcpy(dst
, src
, FIMC_IS_PARAM_MAX_SIZE
);
41 static void __fimc_is_hw_update_param_global_shotmode(struct fimc_is
*is
)
43 struct param_global_shotmode
*dst
, *src
;
45 dst
= &is
->is_p_region
->parameter
.global
.shotmode
;
46 src
= &is
->config
[is
->config_index
].global
.shotmode
;
47 __hw_param_copy(dst
, src
);
50 static void __fimc_is_hw_update_param_sensor_framerate(struct fimc_is
*is
)
52 struct param_sensor_framerate
*dst
, *src
;
54 dst
= &is
->is_p_region
->parameter
.sensor
.frame_rate
;
55 src
= &is
->config
[is
->config_index
].sensor
.frame_rate
;
56 __hw_param_copy(dst
, src
);
59 int __fimc_is_hw_update_param(struct fimc_is
*is
, u32 offset
)
61 struct is_param_region
*par
= &is
->is_p_region
->parameter
;
62 struct chain_config
*cfg
= &is
->config
[is
->config_index
];
65 case PARAM_ISP_CONTROL
:
66 __hw_param_copy(&par
->isp
.control
, &cfg
->isp
.control
);
69 case PARAM_ISP_OTF_INPUT
:
70 __hw_param_copy(&par
->isp
.otf_input
, &cfg
->isp
.otf_input
);
73 case PARAM_ISP_DMA1_INPUT
:
74 __hw_param_copy(&par
->isp
.dma1_input
, &cfg
->isp
.dma1_input
);
77 case PARAM_ISP_DMA2_INPUT
:
78 __hw_param_copy(&par
->isp
.dma2_input
, &cfg
->isp
.dma2_input
);
82 __hw_param_copy(&par
->isp
.aa
, &cfg
->isp
.aa
);
86 __hw_param_copy(&par
->isp
.flash
, &cfg
->isp
.flash
);
90 __hw_param_copy(&par
->isp
.awb
, &cfg
->isp
.awb
);
93 case PARAM_ISP_IMAGE_EFFECT
:
94 __hw_param_copy(&par
->isp
.effect
, &cfg
->isp
.effect
);
98 __hw_param_copy(&par
->isp
.iso
, &cfg
->isp
.iso
);
101 case PARAM_ISP_ADJUST
:
102 __hw_param_copy(&par
->isp
.adjust
, &cfg
->isp
.adjust
);
105 case PARAM_ISP_METERING
:
106 __hw_param_copy(&par
->isp
.metering
, &cfg
->isp
.metering
);
110 __hw_param_copy(&par
->isp
.afc
, &cfg
->isp
.afc
);
113 case PARAM_ISP_OTF_OUTPUT
:
114 __hw_param_copy(&par
->isp
.otf_output
, &cfg
->isp
.otf_output
);
117 case PARAM_ISP_DMA1_OUTPUT
:
118 __hw_param_copy(&par
->isp
.dma1_output
, &cfg
->isp
.dma1_output
);
121 case PARAM_ISP_DMA2_OUTPUT
:
122 __hw_param_copy(&par
->isp
.dma2_output
, &cfg
->isp
.dma2_output
);
125 case PARAM_DRC_CONTROL
:
126 __hw_param_copy(&par
->drc
.control
, &cfg
->drc
.control
);
129 case PARAM_DRC_OTF_INPUT
:
130 __hw_param_copy(&par
->drc
.otf_input
, &cfg
->drc
.otf_input
);
133 case PARAM_DRC_DMA_INPUT
:
134 __hw_param_copy(&par
->drc
.dma_input
, &cfg
->drc
.dma_input
);
137 case PARAM_DRC_OTF_OUTPUT
:
138 __hw_param_copy(&par
->drc
.otf_output
, &cfg
->drc
.otf_output
);
141 case PARAM_FD_CONTROL
:
142 __hw_param_copy(&par
->fd
.control
, &cfg
->fd
.control
);
145 case PARAM_FD_OTF_INPUT
:
146 __hw_param_copy(&par
->fd
.otf_input
, &cfg
->fd
.otf_input
);
149 case PARAM_FD_DMA_INPUT
:
150 __hw_param_copy(&par
->fd
.dma_input
, &cfg
->fd
.dma_input
);
153 case PARAM_FD_CONFIG
:
154 __hw_param_copy(&par
->fd
.config
, &cfg
->fd
.config
);
164 unsigned int __get_pending_param_count(struct fimc_is
*is
)
166 struct chain_config
*config
= &is
->config
[is
->config_index
];
170 spin_lock_irqsave(&is
->slock
, flags
);
171 count
= hweight32(config
->p_region_index
[0]);
172 count
+= hweight32(config
->p_region_index
[1]);
173 spin_unlock_irqrestore(&is
->slock
, flags
);
178 int __is_hw_update_params(struct fimc_is
*is
)
180 unsigned long *p_index
;
183 id
= is
->config_index
;
184 p_index
= &is
->config
[id
].p_region_index
[0];
186 if (test_bit(PARAM_GLOBAL_SHOTMODE
, p_index
))
187 __fimc_is_hw_update_param_global_shotmode(is
);
189 if (test_bit(PARAM_SENSOR_FRAME_RATE
, p_index
))
190 __fimc_is_hw_update_param_sensor_framerate(is
);
192 for (i
= PARAM_ISP_CONTROL
; i
< PARAM_DRC_CONTROL
; i
++) {
193 if (test_bit(i
, p_index
))
194 ret
= __fimc_is_hw_update_param(is
, i
);
197 for (i
= PARAM_DRC_CONTROL
; i
< PARAM_SCALERC_CONTROL
; i
++) {
198 if (test_bit(i
, p_index
))
199 ret
= __fimc_is_hw_update_param(is
, i
);
202 for (i
= PARAM_FD_CONTROL
; i
<= PARAM_FD_CONFIG
; i
++) {
203 if (test_bit(i
, p_index
))
204 ret
= __fimc_is_hw_update_param(is
, i
);
210 void __is_get_frame_size(struct fimc_is
*is
, struct v4l2_mbus_framefmt
*mf
)
212 struct isp_param
*isp
;
214 isp
= &is
->config
[is
->config_index
].isp
;
215 mf
->width
= isp
->otf_input
.width
;
216 mf
->height
= isp
->otf_input
.height
;
219 void __is_set_frame_size(struct fimc_is
*is
, struct v4l2_mbus_framefmt
*mf
)
221 unsigned int index
= is
->config_index
;
222 struct isp_param
*isp
;
223 struct drc_param
*drc
;
226 isp
= &is
->config
[index
].isp
;
227 drc
= &is
->config
[index
].drc
;
228 fd
= &is
->config
[index
].fd
;
230 /* Update isp size info (OTF only) */
231 isp
->otf_input
.width
= mf
->width
;
232 isp
->otf_input
.height
= mf
->height
;
233 isp
->otf_output
.width
= mf
->width
;
234 isp
->otf_output
.height
= mf
->height
;
235 /* Update drc size info (OTF only) */
236 drc
->otf_input
.width
= mf
->width
;
237 drc
->otf_input
.height
= mf
->height
;
238 drc
->otf_output
.width
= mf
->width
;
239 drc
->otf_output
.height
= mf
->height
;
240 /* Update fd size info (OTF only) */
241 fd
->otf_input
.width
= mf
->width
;
242 fd
->otf_input
.height
= mf
->height
;
244 if (test_bit(PARAM_ISP_OTF_INPUT
,
245 &is
->config
[index
].p_region_index
[0]))
249 fimc_is_set_param_bit(is
, PARAM_ISP_OTF_INPUT
);
250 fimc_is_set_param_bit(is
, PARAM_ISP_OTF_OUTPUT
);
251 fimc_is_set_param_bit(is
, PARAM_DRC_OTF_INPUT
);
252 fimc_is_set_param_bit(is
, PARAM_DRC_OTF_OUTPUT
);
253 fimc_is_set_param_bit(is
, PARAM_FD_OTF_INPUT
);
256 int fimc_is_hw_get_sensor_max_framerate(struct fimc_is
*is
)
258 switch (is
->sensor
->drvdata
->id
) {
259 case FIMC_IS_SENSOR_ID_S5K6A3
:
266 void __is_set_sensor(struct fimc_is
*is
, int fps
)
268 unsigned int index
= is
->config_index
;
269 struct sensor_param
*sensor
;
270 struct isp_param
*isp
;
272 sensor
= &is
->config
[index
].sensor
;
273 isp
= &is
->config
[index
].isp
;
276 sensor
->frame_rate
.frame_rate
=
277 fimc_is_hw_get_sensor_max_framerate(is
);
278 isp
->otf_input
.frametime_min
= 0;
279 isp
->otf_input
.frametime_max
= 66666;
281 sensor
->frame_rate
.frame_rate
= fps
;
282 isp
->otf_input
.frametime_min
= 0;
283 isp
->otf_input
.frametime_max
= (u32
)1000000 / fps
;
286 fimc_is_set_param_bit(is
, PARAM_SENSOR_FRAME_RATE
);
287 fimc_is_set_param_bit(is
, PARAM_ISP_OTF_INPUT
);
290 static void __maybe_unused
__is_set_init_isp_aa(struct fimc_is
*is
)
292 struct isp_param
*isp
;
294 isp
= &is
->config
[is
->config_index
].isp
;
296 isp
->aa
.cmd
= ISP_AA_COMMAND_START
;
297 isp
->aa
.target
= ISP_AA_TARGET_AF
| ISP_AA_TARGET_AE
|
305 isp
->aa
.manual_af_setting
= 0;
306 isp
->aa
.err
= ISP_AF_ERROR_NONE
;
308 fimc_is_set_param_bit(is
, PARAM_ISP_AA
);
311 void __is_set_isp_flash(struct fimc_is
*is
, u32 cmd
, u32 redeye
)
313 unsigned int index
= is
->config_index
;
314 struct isp_param
*isp
= &is
->config
[index
].isp
;
316 isp
->flash
.cmd
= cmd
;
317 isp
->flash
.redeye
= redeye
;
318 isp
->flash
.err
= ISP_FLASH_ERROR_NONE
;
320 fimc_is_set_param_bit(is
, PARAM_ISP_FLASH
);
323 void __is_set_isp_awb(struct fimc_is
*is
, u32 cmd
, u32 val
)
325 unsigned int index
= is
->config_index
;
326 struct isp_param
*isp
;
328 isp
= &is
->config
[index
].isp
;
331 isp
->awb
.illumination
= val
;
332 isp
->awb
.err
= ISP_AWB_ERROR_NONE
;
334 fimc_is_set_param_bit(is
, PARAM_ISP_AWB
);
337 void __is_set_isp_effect(struct fimc_is
*is
, u32 cmd
)
339 unsigned int index
= is
->config_index
;
340 struct isp_param
*isp
;
342 isp
= &is
->config
[index
].isp
;
344 isp
->effect
.cmd
= cmd
;
345 isp
->effect
.err
= ISP_IMAGE_EFFECT_ERROR_NONE
;
347 fimc_is_set_param_bit(is
, PARAM_ISP_IMAGE_EFFECT
);
350 void __is_set_isp_iso(struct fimc_is
*is
, u32 cmd
, u32 val
)
352 unsigned int index
= is
->config_index
;
353 struct isp_param
*isp
;
355 isp
= &is
->config
[index
].isp
;
358 isp
->iso
.value
= val
;
359 isp
->iso
.err
= ISP_ISO_ERROR_NONE
;
361 fimc_is_set_param_bit(is
, PARAM_ISP_ISO
);
364 void __is_set_isp_adjust(struct fimc_is
*is
, u32 cmd
, u32 val
)
366 unsigned int index
= is
->config_index
;
367 unsigned long *p_index
;
368 struct isp_param
*isp
;
370 p_index
= &is
->config
[index
].p_region_index
[0];
371 isp
= &is
->config
[index
].isp
;
374 case ISP_ADJUST_COMMAND_MANUAL_CONTRAST
:
375 isp
->adjust
.contrast
= val
;
377 case ISP_ADJUST_COMMAND_MANUAL_SATURATION
:
378 isp
->adjust
.saturation
= val
;
380 case ISP_ADJUST_COMMAND_MANUAL_SHARPNESS
:
381 isp
->adjust
.sharpness
= val
;
383 case ISP_ADJUST_COMMAND_MANUAL_EXPOSURE
:
384 isp
->adjust
.exposure
= val
;
386 case ISP_ADJUST_COMMAND_MANUAL_BRIGHTNESS
:
387 isp
->adjust
.brightness
= val
;
389 case ISP_ADJUST_COMMAND_MANUAL_HUE
:
390 isp
->adjust
.hue
= val
;
392 case ISP_ADJUST_COMMAND_AUTO
:
393 isp
->adjust
.contrast
= 0;
394 isp
->adjust
.saturation
= 0;
395 isp
->adjust
.sharpness
= 0;
396 isp
->adjust
.exposure
= 0;
397 isp
->adjust
.brightness
= 0;
402 if (!test_bit(PARAM_ISP_ADJUST
, p_index
)) {
403 isp
->adjust
.cmd
= cmd
;
404 isp
->adjust
.err
= ISP_ADJUST_ERROR_NONE
;
405 fimc_is_set_param_bit(is
, PARAM_ISP_ADJUST
);
407 isp
->adjust
.cmd
|= cmd
;
411 void __is_set_isp_metering(struct fimc_is
*is
, u32 id
, u32 val
)
413 unsigned int index
= is
->config_index
;
414 struct isp_param
*isp
;
415 unsigned long *p_index
;
417 p_index
= &is
->config
[index
].p_region_index
[0];
418 isp
= &is
->config
[index
].isp
;
421 case IS_METERING_CONFIG_CMD
:
422 isp
->metering
.cmd
= val
;
424 case IS_METERING_CONFIG_WIN_POS_X
:
425 isp
->metering
.win_pos_x
= val
;
427 case IS_METERING_CONFIG_WIN_POS_Y
:
428 isp
->metering
.win_pos_y
= val
;
430 case IS_METERING_CONFIG_WIN_WIDTH
:
431 isp
->metering
.win_width
= val
;
433 case IS_METERING_CONFIG_WIN_HEIGHT
:
434 isp
->metering
.win_height
= val
;
440 if (!test_bit(PARAM_ISP_METERING
, p_index
)) {
441 isp
->metering
.err
= ISP_METERING_ERROR_NONE
;
442 fimc_is_set_param_bit(is
, PARAM_ISP_METERING
);
446 void __is_set_isp_afc(struct fimc_is
*is
, u32 cmd
, u32 val
)
448 unsigned int index
= is
->config_index
;
449 struct isp_param
*isp
;
451 isp
= &is
->config
[index
].isp
;
454 isp
->afc
.manual
= val
;
455 isp
->afc
.err
= ISP_AFC_ERROR_NONE
;
457 fimc_is_set_param_bit(is
, PARAM_ISP_AFC
);
460 void __is_set_drc_control(struct fimc_is
*is
, u32 val
)
462 unsigned int index
= is
->config_index
;
463 struct drc_param
*drc
;
465 drc
= &is
->config
[index
].drc
;
467 drc
->control
.bypass
= val
;
469 fimc_is_set_param_bit(is
, PARAM_DRC_CONTROL
);
472 void __is_set_fd_control(struct fimc_is
*is
, u32 val
)
474 unsigned int index
= is
->config_index
;
476 unsigned long *p_index
;
478 p_index
= &is
->config
[index
].p_region_index
[1];
479 fd
= &is
->config
[index
].fd
;
481 fd
->control
.cmd
= val
;
483 if (!test_bit((PARAM_FD_CONFIG
- 32), p_index
))
484 fimc_is_set_param_bit(is
, PARAM_FD_CONTROL
);
487 void __is_set_fd_config_maxface(struct fimc_is
*is
, u32 val
)
489 unsigned int index
= is
->config_index
;
491 unsigned long *p_index
;
493 p_index
= &is
->config
[index
].p_region_index
[1];
494 fd
= &is
->config
[index
].fd
;
496 fd
->config
.max_number
= val
;
498 if (!test_bit((PARAM_FD_CONFIG
- 32), p_index
)) {
499 fd
->config
.cmd
= FD_CONFIG_COMMAND_MAXIMUM_NUMBER
;
500 fd
->config
.err
= ERROR_FD_NONE
;
501 fimc_is_set_param_bit(is
, PARAM_FD_CONFIG
);
503 fd
->config
.cmd
|= FD_CONFIG_COMMAND_MAXIMUM_NUMBER
;
507 void __is_set_fd_config_rollangle(struct fimc_is
*is
, u32 val
)
509 unsigned int index
= is
->config_index
;
511 unsigned long *p_index
;
513 p_index
= &is
->config
[index
].p_region_index
[1];
514 fd
= &is
->config
[index
].fd
;
516 fd
->config
.roll_angle
= val
;
518 if (!test_bit((PARAM_FD_CONFIG
- 32), p_index
)) {
519 fd
->config
.cmd
= FD_CONFIG_COMMAND_ROLL_ANGLE
;
520 fd
->config
.err
= ERROR_FD_NONE
;
521 fimc_is_set_param_bit(is
, PARAM_FD_CONFIG
);
523 fd
->config
.cmd
|= FD_CONFIG_COMMAND_ROLL_ANGLE
;
527 void __is_set_fd_config_yawangle(struct fimc_is
*is
, u32 val
)
529 unsigned int index
= is
->config_index
;
531 unsigned long *p_index
;
533 p_index
= &is
->config
[index
].p_region_index
[1];
534 fd
= &is
->config
[index
].fd
;
536 fd
->config
.yaw_angle
= val
;
538 if (!test_bit((PARAM_FD_CONFIG
- 32), p_index
)) {
539 fd
->config
.cmd
= FD_CONFIG_COMMAND_YAW_ANGLE
;
540 fd
->config
.err
= ERROR_FD_NONE
;
541 fimc_is_set_param_bit(is
, PARAM_FD_CONFIG
);
543 fd
->config
.cmd
|= FD_CONFIG_COMMAND_YAW_ANGLE
;
547 void __is_set_fd_config_smilemode(struct fimc_is
*is
, u32 val
)
549 unsigned int index
= is
->config_index
;
551 unsigned long *p_index
;
553 p_index
= &is
->config
[index
].p_region_index
[1];
554 fd
= &is
->config
[index
].fd
;
556 fd
->config
.smile_mode
= val
;
558 if (!test_bit((PARAM_FD_CONFIG
- 32), p_index
)) {
559 fd
->config
.cmd
= FD_CONFIG_COMMAND_SMILE_MODE
;
560 fd
->config
.err
= ERROR_FD_NONE
;
561 fimc_is_set_param_bit(is
, PARAM_FD_CONFIG
);
563 fd
->config
.cmd
|= FD_CONFIG_COMMAND_SMILE_MODE
;
567 void __is_set_fd_config_blinkmode(struct fimc_is
*is
, u32 val
)
569 unsigned int index
= is
->config_index
;
571 unsigned long *p_index
;
573 p_index
= &is
->config
[index
].p_region_index
[1];
574 fd
= &is
->config
[index
].fd
;
576 fd
->config
.blink_mode
= val
;
578 if (!test_bit((PARAM_FD_CONFIG
- 32), p_index
)) {
579 fd
->config
.cmd
= FD_CONFIG_COMMAND_BLINK_MODE
;
580 fd
->config
.err
= ERROR_FD_NONE
;
581 fimc_is_set_param_bit(is
, PARAM_FD_CONFIG
);
583 fd
->config
.cmd
|= FD_CONFIG_COMMAND_BLINK_MODE
;
587 void __is_set_fd_config_eyedetect(struct fimc_is
*is
, u32 val
)
589 unsigned int index
= is
->config_index
;
591 unsigned long *p_index
;
593 p_index
= &is
->config
[index
].p_region_index
[1];
594 fd
= &is
->config
[index
].fd
;
596 fd
->config
.eye_detect
= val
;
598 if (!test_bit((PARAM_FD_CONFIG
- 32), p_index
)) {
599 fd
->config
.cmd
= FD_CONFIG_COMMAND_EYES_DETECT
;
600 fd
->config
.err
= ERROR_FD_NONE
;
601 fimc_is_set_param_bit(is
, PARAM_FD_CONFIG
);
603 fd
->config
.cmd
|= FD_CONFIG_COMMAND_EYES_DETECT
;
607 void __is_set_fd_config_mouthdetect(struct fimc_is
*is
, u32 val
)
609 unsigned int index
= is
->config_index
;
611 unsigned long *p_index
;
613 p_index
= &is
->config
[index
].p_region_index
[1];
614 fd
= &is
->config
[index
].fd
;
616 fd
->config
.mouth_detect
= val
;
618 if (!test_bit((PARAM_FD_CONFIG
- 32), p_index
)) {
619 fd
->config
.cmd
= FD_CONFIG_COMMAND_MOUTH_DETECT
;
620 fd
->config
.err
= ERROR_FD_NONE
;
621 fimc_is_set_param_bit(is
, PARAM_FD_CONFIG
);
623 fd
->config
.cmd
|= FD_CONFIG_COMMAND_MOUTH_DETECT
;
627 void __is_set_fd_config_orientation(struct fimc_is
*is
, u32 val
)
629 unsigned int index
= is
->config_index
;
631 unsigned long *p_index
;
633 p_index
= &is
->config
[index
].p_region_index
[1];
634 fd
= &is
->config
[index
].fd
;
636 fd
->config
.orientation
= val
;
638 if (!test_bit((PARAM_FD_CONFIG
- 32), p_index
)) {
639 fd
->config
.cmd
= FD_CONFIG_COMMAND_ORIENTATION
;
640 fd
->config
.err
= ERROR_FD_NONE
;
641 fimc_is_set_param_bit(is
, PARAM_FD_CONFIG
);
643 fd
->config
.cmd
|= FD_CONFIG_COMMAND_ORIENTATION
;
647 void __is_set_fd_config_orientation_val(struct fimc_is
*is
, u32 val
)
649 unsigned int index
= is
->config_index
;
651 unsigned long *p_index
;
653 p_index
= &is
->config
[index
].p_region_index
[1];
654 fd
= &is
->config
[index
].fd
;
656 fd
->config
.orientation_value
= val
;
658 if (!test_bit((PARAM_FD_CONFIG
- 32), p_index
)) {
659 fd
->config
.cmd
= FD_CONFIG_COMMAND_ORIENTATION_VALUE
;
660 fd
->config
.err
= ERROR_FD_NONE
;
661 fimc_is_set_param_bit(is
, PARAM_FD_CONFIG
);
663 fd
->config
.cmd
|= FD_CONFIG_COMMAND_ORIENTATION_VALUE
;
667 void fimc_is_set_initial_params(struct fimc_is
*is
)
669 struct global_param
*global
;
670 struct isp_param
*isp
;
671 struct drc_param
*drc
;
673 unsigned long *p_index
;
676 index
= is
->config_index
;
677 global
= &is
->config
[index
].global
;
678 isp
= &is
->config
[index
].isp
;
679 drc
= &is
->config
[index
].drc
;
680 fd
= &is
->config
[index
].fd
;
681 p_index
= &is
->config
[index
].p_region_index
[0];
684 global
->shotmode
.cmd
= 1;
685 fimc_is_set_param_bit(is
, PARAM_GLOBAL_SHOTMODE
);
688 isp
->control
.cmd
= CONTROL_COMMAND_START
;
689 isp
->control
.bypass
= CONTROL_BYPASS_DISABLE
;
690 isp
->control
.err
= CONTROL_ERROR_NONE
;
691 fimc_is_set_param_bit(is
, PARAM_ISP_CONTROL
);
693 isp
->otf_input
.cmd
= OTF_INPUT_COMMAND_ENABLE
;
694 if (!test_bit(PARAM_ISP_OTF_INPUT
, p_index
)) {
695 isp
->otf_input
.width
= DEFAULT_PREVIEW_STILL_WIDTH
;
696 isp
->otf_input
.height
= DEFAULT_PREVIEW_STILL_HEIGHT
;
697 fimc_is_set_param_bit(is
, PARAM_ISP_OTF_INPUT
);
699 if (is
->sensor
->test_pattern
)
700 isp
->otf_input
.format
= OTF_INPUT_FORMAT_STRGEN_COLORBAR_BAYER
;
702 isp
->otf_input
.format
= OTF_INPUT_FORMAT_BAYER
;
703 isp
->otf_input
.bitwidth
= 10;
704 isp
->otf_input
.order
= OTF_INPUT_ORDER_BAYER_GR_BG
;
705 isp
->otf_input
.crop_offset_x
= 0;
706 isp
->otf_input
.crop_offset_y
= 0;
707 isp
->otf_input
.err
= OTF_INPUT_ERROR_NONE
;
709 isp
->dma1_input
.cmd
= DMA_INPUT_COMMAND_DISABLE
;
710 isp
->dma1_input
.width
= 0;
711 isp
->dma1_input
.height
= 0;
712 isp
->dma1_input
.format
= 0;
713 isp
->dma1_input
.bitwidth
= 0;
714 isp
->dma1_input
.plane
= 0;
715 isp
->dma1_input
.order
= 0;
716 isp
->dma1_input
.buffer_number
= 0;
717 isp
->dma1_input
.width
= 0;
718 isp
->dma1_input
.err
= DMA_INPUT_ERROR_NONE
;
719 fimc_is_set_param_bit(is
, PARAM_ISP_DMA1_INPUT
);
721 isp
->dma2_input
.cmd
= DMA_INPUT_COMMAND_DISABLE
;
722 isp
->dma2_input
.width
= 0;
723 isp
->dma2_input
.height
= 0;
724 isp
->dma2_input
.format
= 0;
725 isp
->dma2_input
.bitwidth
= 0;
726 isp
->dma2_input
.plane
= 0;
727 isp
->dma2_input
.order
= 0;
728 isp
->dma2_input
.buffer_number
= 0;
729 isp
->dma2_input
.width
= 0;
730 isp
->dma2_input
.err
= DMA_INPUT_ERROR_NONE
;
731 fimc_is_set_param_bit(is
, PARAM_ISP_DMA2_INPUT
);
733 isp
->aa
.cmd
= ISP_AA_COMMAND_START
;
734 isp
->aa
.target
= ISP_AA_TARGET_AE
| ISP_AA_TARGET_AWB
;
735 fimc_is_set_param_bit(is
, PARAM_ISP_AA
);
737 if (!test_bit(PARAM_ISP_FLASH
, p_index
))
738 __is_set_isp_flash(is
, ISP_FLASH_COMMAND_DISABLE
,
739 ISP_FLASH_REDEYE_DISABLE
);
741 if (!test_bit(PARAM_ISP_AWB
, p_index
))
742 __is_set_isp_awb(is
, ISP_AWB_COMMAND_AUTO
, 0);
744 if (!test_bit(PARAM_ISP_IMAGE_EFFECT
, p_index
))
745 __is_set_isp_effect(is
, ISP_IMAGE_EFFECT_DISABLE
);
747 if (!test_bit(PARAM_ISP_ISO
, p_index
))
748 __is_set_isp_iso(is
, ISP_ISO_COMMAND_AUTO
, 0);
750 if (!test_bit(PARAM_ISP_ADJUST
, p_index
)) {
751 __is_set_isp_adjust(is
, ISP_ADJUST_COMMAND_MANUAL_CONTRAST
, 0);
752 __is_set_isp_adjust(is
,
753 ISP_ADJUST_COMMAND_MANUAL_SATURATION
, 0);
754 __is_set_isp_adjust(is
, ISP_ADJUST_COMMAND_MANUAL_SHARPNESS
, 0);
755 __is_set_isp_adjust(is
, ISP_ADJUST_COMMAND_MANUAL_EXPOSURE
, 0);
756 __is_set_isp_adjust(is
,
757 ISP_ADJUST_COMMAND_MANUAL_BRIGHTNESS
, 0);
758 __is_set_isp_adjust(is
, ISP_ADJUST_COMMAND_MANUAL_HUE
, 0);
761 if (!test_bit(PARAM_ISP_METERING
, p_index
)) {
762 __is_set_isp_metering(is
, 0, ISP_METERING_COMMAND_CENTER
);
763 __is_set_isp_metering(is
, 1, 0);
764 __is_set_isp_metering(is
, 2, 0);
765 __is_set_isp_metering(is
, 3, 0);
766 __is_set_isp_metering(is
, 4, 0);
769 if (!test_bit(PARAM_ISP_AFC
, p_index
))
770 __is_set_isp_afc(is
, ISP_AFC_COMMAND_AUTO
, 0);
772 isp
->otf_output
.cmd
= OTF_OUTPUT_COMMAND_ENABLE
;
773 if (!test_bit(PARAM_ISP_OTF_OUTPUT
, p_index
)) {
774 isp
->otf_output
.width
= DEFAULT_PREVIEW_STILL_WIDTH
;
775 isp
->otf_output
.height
= DEFAULT_PREVIEW_STILL_HEIGHT
;
776 fimc_is_set_param_bit(is
, PARAM_ISP_OTF_OUTPUT
);
778 isp
->otf_output
.format
= OTF_OUTPUT_FORMAT_YUV444
;
779 isp
->otf_output
.bitwidth
= 12;
780 isp
->otf_output
.order
= 0;
781 isp
->otf_output
.err
= OTF_OUTPUT_ERROR_NONE
;
783 if (!test_bit(PARAM_ISP_DMA1_OUTPUT
, p_index
)) {
784 isp
->dma1_output
.cmd
= DMA_OUTPUT_COMMAND_DISABLE
;
785 isp
->dma1_output
.width
= 0;
786 isp
->dma1_output
.height
= 0;
787 isp
->dma1_output
.format
= 0;
788 isp
->dma1_output
.bitwidth
= 0;
789 isp
->dma1_output
.plane
= 0;
790 isp
->dma1_output
.order
= 0;
791 isp
->dma1_output
.buffer_number
= 0;
792 isp
->dma1_output
.buffer_address
= 0;
793 isp
->dma1_output
.notify_dma_done
= 0;
794 isp
->dma1_output
.dma_out_mask
= 0;
795 isp
->dma1_output
.err
= DMA_OUTPUT_ERROR_NONE
;
796 fimc_is_set_param_bit(is
, PARAM_ISP_DMA1_OUTPUT
);
799 if (!test_bit(PARAM_ISP_DMA2_OUTPUT
, p_index
)) {
800 isp
->dma2_output
.cmd
= DMA_OUTPUT_COMMAND_DISABLE
;
801 isp
->dma2_output
.width
= 0;
802 isp
->dma2_output
.height
= 0;
803 isp
->dma2_output
.format
= 0;
804 isp
->dma2_output
.bitwidth
= 0;
805 isp
->dma2_output
.plane
= 0;
806 isp
->dma2_output
.order
= 0;
807 isp
->dma2_output
.buffer_number
= 0;
808 isp
->dma2_output
.buffer_address
= 0;
809 isp
->dma2_output
.notify_dma_done
= 0;
810 isp
->dma2_output
.dma_out_mask
= 0;
811 isp
->dma2_output
.err
= DMA_OUTPUT_ERROR_NONE
;
812 fimc_is_set_param_bit(is
, PARAM_ISP_DMA2_OUTPUT
);
816 if (!test_bit(PARAM_SENSOR_FRAME_RATE
, p_index
)) {
817 if (is
->config_index
== 0)
818 __is_set_sensor(is
, 0);
822 drc
->control
.cmd
= CONTROL_COMMAND_START
;
823 __is_set_drc_control(is
, CONTROL_BYPASS_ENABLE
);
825 drc
->otf_input
.cmd
= OTF_INPUT_COMMAND_ENABLE
;
826 if (!test_bit(PARAM_DRC_OTF_INPUT
, p_index
)) {
827 drc
->otf_input
.width
= DEFAULT_PREVIEW_STILL_WIDTH
;
828 drc
->otf_input
.height
= DEFAULT_PREVIEW_STILL_HEIGHT
;
829 fimc_is_set_param_bit(is
, PARAM_DRC_OTF_INPUT
);
831 drc
->otf_input
.format
= OTF_INPUT_FORMAT_YUV444
;
832 drc
->otf_input
.bitwidth
= 12;
833 drc
->otf_input
.order
= 0;
834 drc
->otf_input
.err
= OTF_INPUT_ERROR_NONE
;
836 drc
->dma_input
.cmd
= DMA_INPUT_COMMAND_DISABLE
;
837 drc
->dma_input
.width
= 0;
838 drc
->dma_input
.height
= 0;
839 drc
->dma_input
.format
= 0;
840 drc
->dma_input
.bitwidth
= 0;
841 drc
->dma_input
.plane
= 0;
842 drc
->dma_input
.order
= 0;
843 drc
->dma_input
.buffer_number
= 0;
844 drc
->dma_input
.width
= 0;
845 drc
->dma_input
.err
= DMA_INPUT_ERROR_NONE
;
846 fimc_is_set_param_bit(is
, PARAM_DRC_DMA_INPUT
);
848 drc
->otf_output
.cmd
= OTF_OUTPUT_COMMAND_ENABLE
;
849 if (!test_bit(PARAM_DRC_OTF_OUTPUT
, p_index
)) {
850 drc
->otf_output
.width
= DEFAULT_PREVIEW_STILL_WIDTH
;
851 drc
->otf_output
.height
= DEFAULT_PREVIEW_STILL_HEIGHT
;
852 fimc_is_set_param_bit(is
, PARAM_DRC_OTF_OUTPUT
);
854 drc
->otf_output
.format
= OTF_OUTPUT_FORMAT_YUV444
;
855 drc
->otf_output
.bitwidth
= 8;
856 drc
->otf_output
.order
= 0;
857 drc
->otf_output
.err
= OTF_OUTPUT_ERROR_NONE
;
860 __is_set_fd_control(is
, CONTROL_COMMAND_STOP
);
861 fd
->control
.bypass
= CONTROL_BYPASS_DISABLE
;
863 fd
->otf_input
.cmd
= OTF_INPUT_COMMAND_ENABLE
;
864 if (!test_bit(PARAM_FD_OTF_INPUT
, p_index
)) {
865 fd
->otf_input
.width
= DEFAULT_PREVIEW_STILL_WIDTH
;
866 fd
->otf_input
.height
= DEFAULT_PREVIEW_STILL_HEIGHT
;
867 fimc_is_set_param_bit(is
, PARAM_FD_OTF_INPUT
);
870 fd
->otf_input
.format
= OTF_INPUT_FORMAT_YUV444
;
871 fd
->otf_input
.bitwidth
= 8;
872 fd
->otf_input
.order
= 0;
873 fd
->otf_input
.err
= OTF_INPUT_ERROR_NONE
;
875 fd
->dma_input
.cmd
= DMA_INPUT_COMMAND_DISABLE
;
876 fd
->dma_input
.width
= 0;
877 fd
->dma_input
.height
= 0;
878 fd
->dma_input
.format
= 0;
879 fd
->dma_input
.bitwidth
= 0;
880 fd
->dma_input
.plane
= 0;
881 fd
->dma_input
.order
= 0;
882 fd
->dma_input
.buffer_number
= 0;
883 fd
->dma_input
.width
= 0;
884 fd
->dma_input
.err
= DMA_INPUT_ERROR_NONE
;
885 fimc_is_set_param_bit(is
, PARAM_FD_DMA_INPUT
);
887 __is_set_fd_config_maxface(is
, 5);
888 __is_set_fd_config_rollangle(is
, FD_CONFIG_ROLL_ANGLE_FULL
);
889 __is_set_fd_config_yawangle(is
, FD_CONFIG_YAW_ANGLE_45_90
);
890 __is_set_fd_config_smilemode(is
, FD_CONFIG_SMILE_MODE_DISABLE
);
891 __is_set_fd_config_blinkmode(is
, FD_CONFIG_BLINK_MODE_DISABLE
);
892 __is_set_fd_config_eyedetect(is
, FD_CONFIG_EYES_DETECT_ENABLE
);
893 __is_set_fd_config_mouthdetect(is
, FD_CONFIG_MOUTH_DETECT_DISABLE
);
894 __is_set_fd_config_orientation(is
, FD_CONFIG_ORIENTATION_DISABLE
);
895 __is_set_fd_config_orientation_val(is
, 0);