1*238c84f7SMauro Carvalho Chehab // SPDX-License-Identifier: GPL-2.0-only
2*238c84f7SMauro Carvalho Chehab /*
3*238c84f7SMauro Carvalho Chehab * Samsung EXYNOS4x12 FIMC-IS (Imaging Subsystem) driver
4*238c84f7SMauro Carvalho Chehab *
5*238c84f7SMauro Carvalho Chehab * Copyright (C) 2013 Samsung Electronics Co., Ltd.
6*238c84f7SMauro Carvalho Chehab *
7*238c84f7SMauro Carvalho Chehab * Authors: Younghwan Joo <yhwan.joo@samsung.com>
8*238c84f7SMauro Carvalho Chehab * Sylwester Nawrocki <s.nawrocki@samsung.com>
9*238c84f7SMauro Carvalho Chehab */
10*238c84f7SMauro Carvalho Chehab #define pr_fmt(fmt) "%s:%d " fmt, __func__, __LINE__
11*238c84f7SMauro Carvalho Chehab
12*238c84f7SMauro Carvalho Chehab #include <linux/bitops.h>
13*238c84f7SMauro Carvalho Chehab #include <linux/bug.h>
14*238c84f7SMauro Carvalho Chehab #include <linux/device.h>
15*238c84f7SMauro Carvalho Chehab #include <linux/errno.h>
16*238c84f7SMauro Carvalho Chehab #include <linux/kernel.h>
17*238c84f7SMauro Carvalho Chehab #include <linux/module.h>
18*238c84f7SMauro Carvalho Chehab #include <linux/platform_device.h>
19*238c84f7SMauro Carvalho Chehab #include <linux/slab.h>
20*238c84f7SMauro Carvalho Chehab #include <linux/types.h>
21*238c84f7SMauro Carvalho Chehab #include <linux/videodev2.h>
22*238c84f7SMauro Carvalho Chehab
23*238c84f7SMauro Carvalho Chehab #include <media/v4l2-device.h>
24*238c84f7SMauro Carvalho Chehab #include <media/v4l2-ioctl.h>
25*238c84f7SMauro Carvalho Chehab
26*238c84f7SMauro Carvalho Chehab #include "fimc-is.h"
27*238c84f7SMauro Carvalho Chehab #include "fimc-is-command.h"
28*238c84f7SMauro Carvalho Chehab #include "fimc-is-errno.h"
29*238c84f7SMauro Carvalho Chehab #include "fimc-is-param.h"
30*238c84f7SMauro Carvalho Chehab #include "fimc-is-regs.h"
31*238c84f7SMauro Carvalho Chehab #include "fimc-is-sensor.h"
32*238c84f7SMauro Carvalho Chehab
__hw_param_copy(void * dst,void * src)33*238c84f7SMauro Carvalho Chehab static void __hw_param_copy(void *dst, void *src)
34*238c84f7SMauro Carvalho Chehab {
35*238c84f7SMauro Carvalho Chehab memcpy(dst, src, FIMC_IS_PARAM_MAX_SIZE);
36*238c84f7SMauro Carvalho Chehab }
37*238c84f7SMauro Carvalho Chehab
__fimc_is_hw_update_param_global_shotmode(struct fimc_is * is)38*238c84f7SMauro Carvalho Chehab static void __fimc_is_hw_update_param_global_shotmode(struct fimc_is *is)
39*238c84f7SMauro Carvalho Chehab {
40*238c84f7SMauro Carvalho Chehab struct param_global_shotmode *dst, *src;
41*238c84f7SMauro Carvalho Chehab
42*238c84f7SMauro Carvalho Chehab dst = &is->is_p_region->parameter.global.shotmode;
43*238c84f7SMauro Carvalho Chehab src = &is->config[is->config_index].global.shotmode;
44*238c84f7SMauro Carvalho Chehab __hw_param_copy(dst, src);
45*238c84f7SMauro Carvalho Chehab }
46*238c84f7SMauro Carvalho Chehab
__fimc_is_hw_update_param_sensor_framerate(struct fimc_is * is)47*238c84f7SMauro Carvalho Chehab static void __fimc_is_hw_update_param_sensor_framerate(struct fimc_is *is)
48*238c84f7SMauro Carvalho Chehab {
49*238c84f7SMauro Carvalho Chehab struct param_sensor_framerate *dst, *src;
50*238c84f7SMauro Carvalho Chehab
51*238c84f7SMauro Carvalho Chehab dst = &is->is_p_region->parameter.sensor.frame_rate;
52*238c84f7SMauro Carvalho Chehab src = &is->config[is->config_index].sensor.frame_rate;
53*238c84f7SMauro Carvalho Chehab __hw_param_copy(dst, src);
54*238c84f7SMauro Carvalho Chehab }
55*238c84f7SMauro Carvalho Chehab
__fimc_is_hw_update_param(struct fimc_is * is,u32 offset)56*238c84f7SMauro Carvalho Chehab int __fimc_is_hw_update_param(struct fimc_is *is, u32 offset)
57*238c84f7SMauro Carvalho Chehab {
58*238c84f7SMauro Carvalho Chehab struct is_param_region *par = &is->is_p_region->parameter;
59*238c84f7SMauro Carvalho Chehab struct chain_config *cfg = &is->config[is->config_index];
60*238c84f7SMauro Carvalho Chehab
61*238c84f7SMauro Carvalho Chehab switch (offset) {
62*238c84f7SMauro Carvalho Chehab case PARAM_ISP_CONTROL:
63*238c84f7SMauro Carvalho Chehab __hw_param_copy(&par->isp.control, &cfg->isp.control);
64*238c84f7SMauro Carvalho Chehab break;
65*238c84f7SMauro Carvalho Chehab
66*238c84f7SMauro Carvalho Chehab case PARAM_ISP_OTF_INPUT:
67*238c84f7SMauro Carvalho Chehab __hw_param_copy(&par->isp.otf_input, &cfg->isp.otf_input);
68*238c84f7SMauro Carvalho Chehab break;
69*238c84f7SMauro Carvalho Chehab
70*238c84f7SMauro Carvalho Chehab case PARAM_ISP_DMA1_INPUT:
71*238c84f7SMauro Carvalho Chehab __hw_param_copy(&par->isp.dma1_input, &cfg->isp.dma1_input);
72*238c84f7SMauro Carvalho Chehab break;
73*238c84f7SMauro Carvalho Chehab
74*238c84f7SMauro Carvalho Chehab case PARAM_ISP_DMA2_INPUT:
75*238c84f7SMauro Carvalho Chehab __hw_param_copy(&par->isp.dma2_input, &cfg->isp.dma2_input);
76*238c84f7SMauro Carvalho Chehab break;
77*238c84f7SMauro Carvalho Chehab
78*238c84f7SMauro Carvalho Chehab case PARAM_ISP_AA:
79*238c84f7SMauro Carvalho Chehab __hw_param_copy(&par->isp.aa, &cfg->isp.aa);
80*238c84f7SMauro Carvalho Chehab break;
81*238c84f7SMauro Carvalho Chehab
82*238c84f7SMauro Carvalho Chehab case PARAM_ISP_FLASH:
83*238c84f7SMauro Carvalho Chehab __hw_param_copy(&par->isp.flash, &cfg->isp.flash);
84*238c84f7SMauro Carvalho Chehab break;
85*238c84f7SMauro Carvalho Chehab
86*238c84f7SMauro Carvalho Chehab case PARAM_ISP_AWB:
87*238c84f7SMauro Carvalho Chehab __hw_param_copy(&par->isp.awb, &cfg->isp.awb);
88*238c84f7SMauro Carvalho Chehab break;
89*238c84f7SMauro Carvalho Chehab
90*238c84f7SMauro Carvalho Chehab case PARAM_ISP_IMAGE_EFFECT:
91*238c84f7SMauro Carvalho Chehab __hw_param_copy(&par->isp.effect, &cfg->isp.effect);
92*238c84f7SMauro Carvalho Chehab break;
93*238c84f7SMauro Carvalho Chehab
94*238c84f7SMauro Carvalho Chehab case PARAM_ISP_ISO:
95*238c84f7SMauro Carvalho Chehab __hw_param_copy(&par->isp.iso, &cfg->isp.iso);
96*238c84f7SMauro Carvalho Chehab break;
97*238c84f7SMauro Carvalho Chehab
98*238c84f7SMauro Carvalho Chehab case PARAM_ISP_ADJUST:
99*238c84f7SMauro Carvalho Chehab __hw_param_copy(&par->isp.adjust, &cfg->isp.adjust);
100*238c84f7SMauro Carvalho Chehab break;
101*238c84f7SMauro Carvalho Chehab
102*238c84f7SMauro Carvalho Chehab case PARAM_ISP_METERING:
103*238c84f7SMauro Carvalho Chehab __hw_param_copy(&par->isp.metering, &cfg->isp.metering);
104*238c84f7SMauro Carvalho Chehab break;
105*238c84f7SMauro Carvalho Chehab
106*238c84f7SMauro Carvalho Chehab case PARAM_ISP_AFC:
107*238c84f7SMauro Carvalho Chehab __hw_param_copy(&par->isp.afc, &cfg->isp.afc);
108*238c84f7SMauro Carvalho Chehab break;
109*238c84f7SMauro Carvalho Chehab
110*238c84f7SMauro Carvalho Chehab case PARAM_ISP_OTF_OUTPUT:
111*238c84f7SMauro Carvalho Chehab __hw_param_copy(&par->isp.otf_output, &cfg->isp.otf_output);
112*238c84f7SMauro Carvalho Chehab break;
113*238c84f7SMauro Carvalho Chehab
114*238c84f7SMauro Carvalho Chehab case PARAM_ISP_DMA1_OUTPUT:
115*238c84f7SMauro Carvalho Chehab __hw_param_copy(&par->isp.dma1_output, &cfg->isp.dma1_output);
116*238c84f7SMauro Carvalho Chehab break;
117*238c84f7SMauro Carvalho Chehab
118*238c84f7SMauro Carvalho Chehab case PARAM_ISP_DMA2_OUTPUT:
119*238c84f7SMauro Carvalho Chehab __hw_param_copy(&par->isp.dma2_output, &cfg->isp.dma2_output);
120*238c84f7SMauro Carvalho Chehab break;
121*238c84f7SMauro Carvalho Chehab
122*238c84f7SMauro Carvalho Chehab case PARAM_DRC_CONTROL:
123*238c84f7SMauro Carvalho Chehab __hw_param_copy(&par->drc.control, &cfg->drc.control);
124*238c84f7SMauro Carvalho Chehab break;
125*238c84f7SMauro Carvalho Chehab
126*238c84f7SMauro Carvalho Chehab case PARAM_DRC_OTF_INPUT:
127*238c84f7SMauro Carvalho Chehab __hw_param_copy(&par->drc.otf_input, &cfg->drc.otf_input);
128*238c84f7SMauro Carvalho Chehab break;
129*238c84f7SMauro Carvalho Chehab
130*238c84f7SMauro Carvalho Chehab case PARAM_DRC_DMA_INPUT:
131*238c84f7SMauro Carvalho Chehab __hw_param_copy(&par->drc.dma_input, &cfg->drc.dma_input);
132*238c84f7SMauro Carvalho Chehab break;
133*238c84f7SMauro Carvalho Chehab
134*238c84f7SMauro Carvalho Chehab case PARAM_DRC_OTF_OUTPUT:
135*238c84f7SMauro Carvalho Chehab __hw_param_copy(&par->drc.otf_output, &cfg->drc.otf_output);
136*238c84f7SMauro Carvalho Chehab break;
137*238c84f7SMauro Carvalho Chehab
138*238c84f7SMauro Carvalho Chehab case PARAM_FD_CONTROL:
139*238c84f7SMauro Carvalho Chehab __hw_param_copy(&par->fd.control, &cfg->fd.control);
140*238c84f7SMauro Carvalho Chehab break;
141*238c84f7SMauro Carvalho Chehab
142*238c84f7SMauro Carvalho Chehab case PARAM_FD_OTF_INPUT:
143*238c84f7SMauro Carvalho Chehab __hw_param_copy(&par->fd.otf_input, &cfg->fd.otf_input);
144*238c84f7SMauro Carvalho Chehab break;
145*238c84f7SMauro Carvalho Chehab
146*238c84f7SMauro Carvalho Chehab case PARAM_FD_DMA_INPUT:
147*238c84f7SMauro Carvalho Chehab __hw_param_copy(&par->fd.dma_input, &cfg->fd.dma_input);
148*238c84f7SMauro Carvalho Chehab break;
149*238c84f7SMauro Carvalho Chehab
150*238c84f7SMauro Carvalho Chehab case PARAM_FD_CONFIG:
151*238c84f7SMauro Carvalho Chehab __hw_param_copy(&par->fd.config, &cfg->fd.config);
152*238c84f7SMauro Carvalho Chehab break;
153*238c84f7SMauro Carvalho Chehab
154*238c84f7SMauro Carvalho Chehab default:
155*238c84f7SMauro Carvalho Chehab return -EINVAL;
156*238c84f7SMauro Carvalho Chehab }
157*238c84f7SMauro Carvalho Chehab
158*238c84f7SMauro Carvalho Chehab return 0;
159*238c84f7SMauro Carvalho Chehab }
160*238c84f7SMauro Carvalho Chehab
__get_pending_param_count(struct fimc_is * is)161*238c84f7SMauro Carvalho Chehab unsigned int __get_pending_param_count(struct fimc_is *is)
162*238c84f7SMauro Carvalho Chehab {
163*238c84f7SMauro Carvalho Chehab struct chain_config *config = &is->config[is->config_index];
164*238c84f7SMauro Carvalho Chehab unsigned long flags;
165*238c84f7SMauro Carvalho Chehab unsigned int count;
166*238c84f7SMauro Carvalho Chehab
167*238c84f7SMauro Carvalho Chehab spin_lock_irqsave(&is->slock, flags);
168*238c84f7SMauro Carvalho Chehab count = hweight32(config->p_region_index[0]);
169*238c84f7SMauro Carvalho Chehab count += hweight32(config->p_region_index[1]);
170*238c84f7SMauro Carvalho Chehab spin_unlock_irqrestore(&is->slock, flags);
171*238c84f7SMauro Carvalho Chehab
172*238c84f7SMauro Carvalho Chehab return count;
173*238c84f7SMauro Carvalho Chehab }
174*238c84f7SMauro Carvalho Chehab
__is_hw_update_params(struct fimc_is * is)175*238c84f7SMauro Carvalho Chehab int __is_hw_update_params(struct fimc_is *is)
176*238c84f7SMauro Carvalho Chehab {
177*238c84f7SMauro Carvalho Chehab unsigned long *p_index;
178*238c84f7SMauro Carvalho Chehab int i, id, ret = 0;
179*238c84f7SMauro Carvalho Chehab
180*238c84f7SMauro Carvalho Chehab id = is->config_index;
181*238c84f7SMauro Carvalho Chehab p_index = &is->config[id].p_region_index[0];
182*238c84f7SMauro Carvalho Chehab
183*238c84f7SMauro Carvalho Chehab if (test_bit(PARAM_GLOBAL_SHOTMODE, p_index))
184*238c84f7SMauro Carvalho Chehab __fimc_is_hw_update_param_global_shotmode(is);
185*238c84f7SMauro Carvalho Chehab
186*238c84f7SMauro Carvalho Chehab if (test_bit(PARAM_SENSOR_FRAME_RATE, p_index))
187*238c84f7SMauro Carvalho Chehab __fimc_is_hw_update_param_sensor_framerate(is);
188*238c84f7SMauro Carvalho Chehab
189*238c84f7SMauro Carvalho Chehab for (i = PARAM_ISP_CONTROL; i < PARAM_DRC_CONTROL; i++) {
190*238c84f7SMauro Carvalho Chehab if (test_bit(i, p_index))
191*238c84f7SMauro Carvalho Chehab ret = __fimc_is_hw_update_param(is, i);
192*238c84f7SMauro Carvalho Chehab }
193*238c84f7SMauro Carvalho Chehab
194*238c84f7SMauro Carvalho Chehab for (i = PARAM_DRC_CONTROL; i < PARAM_SCALERC_CONTROL; i++) {
195*238c84f7SMauro Carvalho Chehab if (test_bit(i, p_index))
196*238c84f7SMauro Carvalho Chehab ret = __fimc_is_hw_update_param(is, i);
197*238c84f7SMauro Carvalho Chehab }
198*238c84f7SMauro Carvalho Chehab
199*238c84f7SMauro Carvalho Chehab for (i = PARAM_FD_CONTROL; i <= PARAM_FD_CONFIG; i++) {
200*238c84f7SMauro Carvalho Chehab if (test_bit(i, p_index))
201*238c84f7SMauro Carvalho Chehab ret = __fimc_is_hw_update_param(is, i);
202*238c84f7SMauro Carvalho Chehab }
203*238c84f7SMauro Carvalho Chehab
204*238c84f7SMauro Carvalho Chehab return ret;
205*238c84f7SMauro Carvalho Chehab }
206*238c84f7SMauro Carvalho Chehab
__is_get_frame_size(struct fimc_is * is,struct v4l2_mbus_framefmt * mf)207*238c84f7SMauro Carvalho Chehab void __is_get_frame_size(struct fimc_is *is, struct v4l2_mbus_framefmt *mf)
208*238c84f7SMauro Carvalho Chehab {
209*238c84f7SMauro Carvalho Chehab struct isp_param *isp;
210*238c84f7SMauro Carvalho Chehab
211*238c84f7SMauro Carvalho Chehab isp = &is->config[is->config_index].isp;
212*238c84f7SMauro Carvalho Chehab mf->width = isp->otf_input.width;
213*238c84f7SMauro Carvalho Chehab mf->height = isp->otf_input.height;
214*238c84f7SMauro Carvalho Chehab }
215*238c84f7SMauro Carvalho Chehab
__is_set_frame_size(struct fimc_is * is,struct v4l2_mbus_framefmt * mf)216*238c84f7SMauro Carvalho Chehab void __is_set_frame_size(struct fimc_is *is, struct v4l2_mbus_framefmt *mf)
217*238c84f7SMauro Carvalho Chehab {
218*238c84f7SMauro Carvalho Chehab unsigned int index = is->config_index;
219*238c84f7SMauro Carvalho Chehab struct isp_param *isp;
220*238c84f7SMauro Carvalho Chehab struct drc_param *drc;
221*238c84f7SMauro Carvalho Chehab struct fd_param *fd;
222*238c84f7SMauro Carvalho Chehab
223*238c84f7SMauro Carvalho Chehab isp = &is->config[index].isp;
224*238c84f7SMauro Carvalho Chehab drc = &is->config[index].drc;
225*238c84f7SMauro Carvalho Chehab fd = &is->config[index].fd;
226*238c84f7SMauro Carvalho Chehab
227*238c84f7SMauro Carvalho Chehab /* Update isp size info (OTF only) */
228*238c84f7SMauro Carvalho Chehab isp->otf_input.width = mf->width;
229*238c84f7SMauro Carvalho Chehab isp->otf_input.height = mf->height;
230*238c84f7SMauro Carvalho Chehab isp->otf_output.width = mf->width;
231*238c84f7SMauro Carvalho Chehab isp->otf_output.height = mf->height;
232*238c84f7SMauro Carvalho Chehab /* Update drc size info (OTF only) */
233*238c84f7SMauro Carvalho Chehab drc->otf_input.width = mf->width;
234*238c84f7SMauro Carvalho Chehab drc->otf_input.height = mf->height;
235*238c84f7SMauro Carvalho Chehab drc->otf_output.width = mf->width;
236*238c84f7SMauro Carvalho Chehab drc->otf_output.height = mf->height;
237*238c84f7SMauro Carvalho Chehab /* Update fd size info (OTF only) */
238*238c84f7SMauro Carvalho Chehab fd->otf_input.width = mf->width;
239*238c84f7SMauro Carvalho Chehab fd->otf_input.height = mf->height;
240*238c84f7SMauro Carvalho Chehab
241*238c84f7SMauro Carvalho Chehab if (test_bit(PARAM_ISP_OTF_INPUT,
242*238c84f7SMauro Carvalho Chehab &is->config[index].p_region_index[0]))
243*238c84f7SMauro Carvalho Chehab return;
244*238c84f7SMauro Carvalho Chehab
245*238c84f7SMauro Carvalho Chehab /* Update field */
246*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_ISP_OTF_INPUT);
247*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_ISP_OTF_OUTPUT);
248*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_DRC_OTF_INPUT);
249*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_DRC_OTF_OUTPUT);
250*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_FD_OTF_INPUT);
251*238c84f7SMauro Carvalho Chehab }
252*238c84f7SMauro Carvalho Chehab
fimc_is_hw_get_sensor_max_framerate(struct fimc_is * is)253*238c84f7SMauro Carvalho Chehab int fimc_is_hw_get_sensor_max_framerate(struct fimc_is *is)
254*238c84f7SMauro Carvalho Chehab {
255*238c84f7SMauro Carvalho Chehab switch (is->sensor->drvdata->id) {
256*238c84f7SMauro Carvalho Chehab case FIMC_IS_SENSOR_ID_S5K6A3:
257*238c84f7SMauro Carvalho Chehab return 30;
258*238c84f7SMauro Carvalho Chehab default:
259*238c84f7SMauro Carvalho Chehab return 15;
260*238c84f7SMauro Carvalho Chehab }
261*238c84f7SMauro Carvalho Chehab }
262*238c84f7SMauro Carvalho Chehab
__is_set_sensor(struct fimc_is * is,int fps)263*238c84f7SMauro Carvalho Chehab void __is_set_sensor(struct fimc_is *is, int fps)
264*238c84f7SMauro Carvalho Chehab {
265*238c84f7SMauro Carvalho Chehab unsigned int index = is->config_index;
266*238c84f7SMauro Carvalho Chehab struct sensor_param *sensor;
267*238c84f7SMauro Carvalho Chehab struct isp_param *isp;
268*238c84f7SMauro Carvalho Chehab
269*238c84f7SMauro Carvalho Chehab sensor = &is->config[index].sensor;
270*238c84f7SMauro Carvalho Chehab isp = &is->config[index].isp;
271*238c84f7SMauro Carvalho Chehab
272*238c84f7SMauro Carvalho Chehab if (fps == 0) {
273*238c84f7SMauro Carvalho Chehab sensor->frame_rate.frame_rate =
274*238c84f7SMauro Carvalho Chehab fimc_is_hw_get_sensor_max_framerate(is);
275*238c84f7SMauro Carvalho Chehab isp->otf_input.frametime_min = 0;
276*238c84f7SMauro Carvalho Chehab isp->otf_input.frametime_max = 66666;
277*238c84f7SMauro Carvalho Chehab } else {
278*238c84f7SMauro Carvalho Chehab sensor->frame_rate.frame_rate = fps;
279*238c84f7SMauro Carvalho Chehab isp->otf_input.frametime_min = 0;
280*238c84f7SMauro Carvalho Chehab isp->otf_input.frametime_max = (u32)1000000 / fps;
281*238c84f7SMauro Carvalho Chehab }
282*238c84f7SMauro Carvalho Chehab
283*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_SENSOR_FRAME_RATE);
284*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_ISP_OTF_INPUT);
285*238c84f7SMauro Carvalho Chehab }
286*238c84f7SMauro Carvalho Chehab
__is_set_init_isp_aa(struct fimc_is * is)287*238c84f7SMauro Carvalho Chehab static void __maybe_unused __is_set_init_isp_aa(struct fimc_is *is)
288*238c84f7SMauro Carvalho Chehab {
289*238c84f7SMauro Carvalho Chehab struct isp_param *isp;
290*238c84f7SMauro Carvalho Chehab
291*238c84f7SMauro Carvalho Chehab isp = &is->config[is->config_index].isp;
292*238c84f7SMauro Carvalho Chehab
293*238c84f7SMauro Carvalho Chehab isp->aa.cmd = ISP_AA_COMMAND_START;
294*238c84f7SMauro Carvalho Chehab isp->aa.target = ISP_AA_TARGET_AF | ISP_AA_TARGET_AE |
295*238c84f7SMauro Carvalho Chehab ISP_AA_TARGET_AWB;
296*238c84f7SMauro Carvalho Chehab isp->aa.mode = 0;
297*238c84f7SMauro Carvalho Chehab isp->aa.scene = 0;
298*238c84f7SMauro Carvalho Chehab isp->aa.sleep = 0;
299*238c84f7SMauro Carvalho Chehab isp->aa.face = 0;
300*238c84f7SMauro Carvalho Chehab isp->aa.touch_x = 0;
301*238c84f7SMauro Carvalho Chehab isp->aa.touch_y = 0;
302*238c84f7SMauro Carvalho Chehab isp->aa.manual_af_setting = 0;
303*238c84f7SMauro Carvalho Chehab isp->aa.err = ISP_AF_ERROR_NONE;
304*238c84f7SMauro Carvalho Chehab
305*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_ISP_AA);
306*238c84f7SMauro Carvalho Chehab }
307*238c84f7SMauro Carvalho Chehab
__is_set_isp_flash(struct fimc_is * is,u32 cmd,u32 redeye)308*238c84f7SMauro Carvalho Chehab void __is_set_isp_flash(struct fimc_is *is, u32 cmd, u32 redeye)
309*238c84f7SMauro Carvalho Chehab {
310*238c84f7SMauro Carvalho Chehab unsigned int index = is->config_index;
311*238c84f7SMauro Carvalho Chehab struct isp_param *isp = &is->config[index].isp;
312*238c84f7SMauro Carvalho Chehab
313*238c84f7SMauro Carvalho Chehab isp->flash.cmd = cmd;
314*238c84f7SMauro Carvalho Chehab isp->flash.redeye = redeye;
315*238c84f7SMauro Carvalho Chehab isp->flash.err = ISP_FLASH_ERROR_NONE;
316*238c84f7SMauro Carvalho Chehab
317*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_ISP_FLASH);
318*238c84f7SMauro Carvalho Chehab }
319*238c84f7SMauro Carvalho Chehab
__is_set_isp_awb(struct fimc_is * is,u32 cmd,u32 val)320*238c84f7SMauro Carvalho Chehab void __is_set_isp_awb(struct fimc_is *is, u32 cmd, u32 val)
321*238c84f7SMauro Carvalho Chehab {
322*238c84f7SMauro Carvalho Chehab unsigned int index = is->config_index;
323*238c84f7SMauro Carvalho Chehab struct isp_param *isp;
324*238c84f7SMauro Carvalho Chehab
325*238c84f7SMauro Carvalho Chehab isp = &is->config[index].isp;
326*238c84f7SMauro Carvalho Chehab
327*238c84f7SMauro Carvalho Chehab isp->awb.cmd = cmd;
328*238c84f7SMauro Carvalho Chehab isp->awb.illumination = val;
329*238c84f7SMauro Carvalho Chehab isp->awb.err = ISP_AWB_ERROR_NONE;
330*238c84f7SMauro Carvalho Chehab
331*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_ISP_AWB);
332*238c84f7SMauro Carvalho Chehab }
333*238c84f7SMauro Carvalho Chehab
__is_set_isp_effect(struct fimc_is * is,u32 cmd)334*238c84f7SMauro Carvalho Chehab void __is_set_isp_effect(struct fimc_is *is, u32 cmd)
335*238c84f7SMauro Carvalho Chehab {
336*238c84f7SMauro Carvalho Chehab unsigned int index = is->config_index;
337*238c84f7SMauro Carvalho Chehab struct isp_param *isp;
338*238c84f7SMauro Carvalho Chehab
339*238c84f7SMauro Carvalho Chehab isp = &is->config[index].isp;
340*238c84f7SMauro Carvalho Chehab
341*238c84f7SMauro Carvalho Chehab isp->effect.cmd = cmd;
342*238c84f7SMauro Carvalho Chehab isp->effect.err = ISP_IMAGE_EFFECT_ERROR_NONE;
343*238c84f7SMauro Carvalho Chehab
344*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_ISP_IMAGE_EFFECT);
345*238c84f7SMauro Carvalho Chehab }
346*238c84f7SMauro Carvalho Chehab
__is_set_isp_iso(struct fimc_is * is,u32 cmd,u32 val)347*238c84f7SMauro Carvalho Chehab void __is_set_isp_iso(struct fimc_is *is, u32 cmd, u32 val)
348*238c84f7SMauro Carvalho Chehab {
349*238c84f7SMauro Carvalho Chehab unsigned int index = is->config_index;
350*238c84f7SMauro Carvalho Chehab struct isp_param *isp;
351*238c84f7SMauro Carvalho Chehab
352*238c84f7SMauro Carvalho Chehab isp = &is->config[index].isp;
353*238c84f7SMauro Carvalho Chehab
354*238c84f7SMauro Carvalho Chehab isp->iso.cmd = cmd;
355*238c84f7SMauro Carvalho Chehab isp->iso.value = val;
356*238c84f7SMauro Carvalho Chehab isp->iso.err = ISP_ISO_ERROR_NONE;
357*238c84f7SMauro Carvalho Chehab
358*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_ISP_ISO);
359*238c84f7SMauro Carvalho Chehab }
360*238c84f7SMauro Carvalho Chehab
__is_set_isp_adjust(struct fimc_is * is,u32 cmd,u32 val)361*238c84f7SMauro Carvalho Chehab void __is_set_isp_adjust(struct fimc_is *is, u32 cmd, u32 val)
362*238c84f7SMauro Carvalho Chehab {
363*238c84f7SMauro Carvalho Chehab unsigned int index = is->config_index;
364*238c84f7SMauro Carvalho Chehab unsigned long *p_index;
365*238c84f7SMauro Carvalho Chehab struct isp_param *isp;
366*238c84f7SMauro Carvalho Chehab
367*238c84f7SMauro Carvalho Chehab p_index = &is->config[index].p_region_index[0];
368*238c84f7SMauro Carvalho Chehab isp = &is->config[index].isp;
369*238c84f7SMauro Carvalho Chehab
370*238c84f7SMauro Carvalho Chehab switch (cmd) {
371*238c84f7SMauro Carvalho Chehab case ISP_ADJUST_COMMAND_MANUAL_CONTRAST:
372*238c84f7SMauro Carvalho Chehab isp->adjust.contrast = val;
373*238c84f7SMauro Carvalho Chehab break;
374*238c84f7SMauro Carvalho Chehab case ISP_ADJUST_COMMAND_MANUAL_SATURATION:
375*238c84f7SMauro Carvalho Chehab isp->adjust.saturation = val;
376*238c84f7SMauro Carvalho Chehab break;
377*238c84f7SMauro Carvalho Chehab case ISP_ADJUST_COMMAND_MANUAL_SHARPNESS:
378*238c84f7SMauro Carvalho Chehab isp->adjust.sharpness = val;
379*238c84f7SMauro Carvalho Chehab break;
380*238c84f7SMauro Carvalho Chehab case ISP_ADJUST_COMMAND_MANUAL_EXPOSURE:
381*238c84f7SMauro Carvalho Chehab isp->adjust.exposure = val;
382*238c84f7SMauro Carvalho Chehab break;
383*238c84f7SMauro Carvalho Chehab case ISP_ADJUST_COMMAND_MANUAL_BRIGHTNESS:
384*238c84f7SMauro Carvalho Chehab isp->adjust.brightness = val;
385*238c84f7SMauro Carvalho Chehab break;
386*238c84f7SMauro Carvalho Chehab case ISP_ADJUST_COMMAND_MANUAL_HUE:
387*238c84f7SMauro Carvalho Chehab isp->adjust.hue = val;
388*238c84f7SMauro Carvalho Chehab break;
389*238c84f7SMauro Carvalho Chehab case ISP_ADJUST_COMMAND_AUTO:
390*238c84f7SMauro Carvalho Chehab isp->adjust.contrast = 0;
391*238c84f7SMauro Carvalho Chehab isp->adjust.saturation = 0;
392*238c84f7SMauro Carvalho Chehab isp->adjust.sharpness = 0;
393*238c84f7SMauro Carvalho Chehab isp->adjust.exposure = 0;
394*238c84f7SMauro Carvalho Chehab isp->adjust.brightness = 0;
395*238c84f7SMauro Carvalho Chehab isp->adjust.hue = 0;
396*238c84f7SMauro Carvalho Chehab break;
397*238c84f7SMauro Carvalho Chehab }
398*238c84f7SMauro Carvalho Chehab
399*238c84f7SMauro Carvalho Chehab if (!test_bit(PARAM_ISP_ADJUST, p_index)) {
400*238c84f7SMauro Carvalho Chehab isp->adjust.cmd = cmd;
401*238c84f7SMauro Carvalho Chehab isp->adjust.err = ISP_ADJUST_ERROR_NONE;
402*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_ISP_ADJUST);
403*238c84f7SMauro Carvalho Chehab } else {
404*238c84f7SMauro Carvalho Chehab isp->adjust.cmd |= cmd;
405*238c84f7SMauro Carvalho Chehab }
406*238c84f7SMauro Carvalho Chehab }
407*238c84f7SMauro Carvalho Chehab
__is_set_isp_metering(struct fimc_is * is,u32 id,u32 val)408*238c84f7SMauro Carvalho Chehab void __is_set_isp_metering(struct fimc_is *is, u32 id, u32 val)
409*238c84f7SMauro Carvalho Chehab {
410*238c84f7SMauro Carvalho Chehab unsigned int index = is->config_index;
411*238c84f7SMauro Carvalho Chehab struct isp_param *isp;
412*238c84f7SMauro Carvalho Chehab unsigned long *p_index;
413*238c84f7SMauro Carvalho Chehab
414*238c84f7SMauro Carvalho Chehab p_index = &is->config[index].p_region_index[0];
415*238c84f7SMauro Carvalho Chehab isp = &is->config[index].isp;
416*238c84f7SMauro Carvalho Chehab
417*238c84f7SMauro Carvalho Chehab switch (id) {
418*238c84f7SMauro Carvalho Chehab case IS_METERING_CONFIG_CMD:
419*238c84f7SMauro Carvalho Chehab isp->metering.cmd = val;
420*238c84f7SMauro Carvalho Chehab break;
421*238c84f7SMauro Carvalho Chehab case IS_METERING_CONFIG_WIN_POS_X:
422*238c84f7SMauro Carvalho Chehab isp->metering.win_pos_x = val;
423*238c84f7SMauro Carvalho Chehab break;
424*238c84f7SMauro Carvalho Chehab case IS_METERING_CONFIG_WIN_POS_Y:
425*238c84f7SMauro Carvalho Chehab isp->metering.win_pos_y = val;
426*238c84f7SMauro Carvalho Chehab break;
427*238c84f7SMauro Carvalho Chehab case IS_METERING_CONFIG_WIN_WIDTH:
428*238c84f7SMauro Carvalho Chehab isp->metering.win_width = val;
429*238c84f7SMauro Carvalho Chehab break;
430*238c84f7SMauro Carvalho Chehab case IS_METERING_CONFIG_WIN_HEIGHT:
431*238c84f7SMauro Carvalho Chehab isp->metering.win_height = val;
432*238c84f7SMauro Carvalho Chehab break;
433*238c84f7SMauro Carvalho Chehab default:
434*238c84f7SMauro Carvalho Chehab return;
435*238c84f7SMauro Carvalho Chehab }
436*238c84f7SMauro Carvalho Chehab
437*238c84f7SMauro Carvalho Chehab if (!test_bit(PARAM_ISP_METERING, p_index)) {
438*238c84f7SMauro Carvalho Chehab isp->metering.err = ISP_METERING_ERROR_NONE;
439*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_ISP_METERING);
440*238c84f7SMauro Carvalho Chehab }
441*238c84f7SMauro Carvalho Chehab }
442*238c84f7SMauro Carvalho Chehab
__is_set_isp_afc(struct fimc_is * is,u32 cmd,u32 val)443*238c84f7SMauro Carvalho Chehab void __is_set_isp_afc(struct fimc_is *is, u32 cmd, u32 val)
444*238c84f7SMauro Carvalho Chehab {
445*238c84f7SMauro Carvalho Chehab unsigned int index = is->config_index;
446*238c84f7SMauro Carvalho Chehab struct isp_param *isp;
447*238c84f7SMauro Carvalho Chehab
448*238c84f7SMauro Carvalho Chehab isp = &is->config[index].isp;
449*238c84f7SMauro Carvalho Chehab
450*238c84f7SMauro Carvalho Chehab isp->afc.cmd = cmd;
451*238c84f7SMauro Carvalho Chehab isp->afc.manual = val;
452*238c84f7SMauro Carvalho Chehab isp->afc.err = ISP_AFC_ERROR_NONE;
453*238c84f7SMauro Carvalho Chehab
454*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_ISP_AFC);
455*238c84f7SMauro Carvalho Chehab }
456*238c84f7SMauro Carvalho Chehab
__is_set_drc_control(struct fimc_is * is,u32 val)457*238c84f7SMauro Carvalho Chehab void __is_set_drc_control(struct fimc_is *is, u32 val)
458*238c84f7SMauro Carvalho Chehab {
459*238c84f7SMauro Carvalho Chehab unsigned int index = is->config_index;
460*238c84f7SMauro Carvalho Chehab struct drc_param *drc;
461*238c84f7SMauro Carvalho Chehab
462*238c84f7SMauro Carvalho Chehab drc = &is->config[index].drc;
463*238c84f7SMauro Carvalho Chehab
464*238c84f7SMauro Carvalho Chehab drc->control.bypass = val;
465*238c84f7SMauro Carvalho Chehab
466*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_DRC_CONTROL);
467*238c84f7SMauro Carvalho Chehab }
468*238c84f7SMauro Carvalho Chehab
__is_set_fd_control(struct fimc_is * is,u32 val)469*238c84f7SMauro Carvalho Chehab void __is_set_fd_control(struct fimc_is *is, u32 val)
470*238c84f7SMauro Carvalho Chehab {
471*238c84f7SMauro Carvalho Chehab unsigned int index = is->config_index;
472*238c84f7SMauro Carvalho Chehab struct fd_param *fd;
473*238c84f7SMauro Carvalho Chehab unsigned long *p_index;
474*238c84f7SMauro Carvalho Chehab
475*238c84f7SMauro Carvalho Chehab p_index = &is->config[index].p_region_index[1];
476*238c84f7SMauro Carvalho Chehab fd = &is->config[index].fd;
477*238c84f7SMauro Carvalho Chehab
478*238c84f7SMauro Carvalho Chehab fd->control.cmd = val;
479*238c84f7SMauro Carvalho Chehab
480*238c84f7SMauro Carvalho Chehab if (!test_bit((PARAM_FD_CONFIG - 32), p_index))
481*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_FD_CONTROL);
482*238c84f7SMauro Carvalho Chehab }
483*238c84f7SMauro Carvalho Chehab
__is_set_fd_config_maxface(struct fimc_is * is,u32 val)484*238c84f7SMauro Carvalho Chehab void __is_set_fd_config_maxface(struct fimc_is *is, u32 val)
485*238c84f7SMauro Carvalho Chehab {
486*238c84f7SMauro Carvalho Chehab unsigned int index = is->config_index;
487*238c84f7SMauro Carvalho Chehab struct fd_param *fd;
488*238c84f7SMauro Carvalho Chehab unsigned long *p_index;
489*238c84f7SMauro Carvalho Chehab
490*238c84f7SMauro Carvalho Chehab p_index = &is->config[index].p_region_index[1];
491*238c84f7SMauro Carvalho Chehab fd = &is->config[index].fd;
492*238c84f7SMauro Carvalho Chehab
493*238c84f7SMauro Carvalho Chehab fd->config.max_number = val;
494*238c84f7SMauro Carvalho Chehab
495*238c84f7SMauro Carvalho Chehab if (!test_bit((PARAM_FD_CONFIG - 32), p_index)) {
496*238c84f7SMauro Carvalho Chehab fd->config.cmd = FD_CONFIG_COMMAND_MAXIMUM_NUMBER;
497*238c84f7SMauro Carvalho Chehab fd->config.err = ERROR_FD_NONE;
498*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_FD_CONFIG);
499*238c84f7SMauro Carvalho Chehab } else {
500*238c84f7SMauro Carvalho Chehab fd->config.cmd |= FD_CONFIG_COMMAND_MAXIMUM_NUMBER;
501*238c84f7SMauro Carvalho Chehab }
502*238c84f7SMauro Carvalho Chehab }
503*238c84f7SMauro Carvalho Chehab
__is_set_fd_config_rollangle(struct fimc_is * is,u32 val)504*238c84f7SMauro Carvalho Chehab void __is_set_fd_config_rollangle(struct fimc_is *is, u32 val)
505*238c84f7SMauro Carvalho Chehab {
506*238c84f7SMauro Carvalho Chehab unsigned int index = is->config_index;
507*238c84f7SMauro Carvalho Chehab struct fd_param *fd;
508*238c84f7SMauro Carvalho Chehab unsigned long *p_index;
509*238c84f7SMauro Carvalho Chehab
510*238c84f7SMauro Carvalho Chehab p_index = &is->config[index].p_region_index[1];
511*238c84f7SMauro Carvalho Chehab fd = &is->config[index].fd;
512*238c84f7SMauro Carvalho Chehab
513*238c84f7SMauro Carvalho Chehab fd->config.roll_angle = val;
514*238c84f7SMauro Carvalho Chehab
515*238c84f7SMauro Carvalho Chehab if (!test_bit((PARAM_FD_CONFIG - 32), p_index)) {
516*238c84f7SMauro Carvalho Chehab fd->config.cmd = FD_CONFIG_COMMAND_ROLL_ANGLE;
517*238c84f7SMauro Carvalho Chehab fd->config.err = ERROR_FD_NONE;
518*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_FD_CONFIG);
519*238c84f7SMauro Carvalho Chehab } else {
520*238c84f7SMauro Carvalho Chehab fd->config.cmd |= FD_CONFIG_COMMAND_ROLL_ANGLE;
521*238c84f7SMauro Carvalho Chehab }
522*238c84f7SMauro Carvalho Chehab }
523*238c84f7SMauro Carvalho Chehab
__is_set_fd_config_yawangle(struct fimc_is * is,u32 val)524*238c84f7SMauro Carvalho Chehab void __is_set_fd_config_yawangle(struct fimc_is *is, u32 val)
525*238c84f7SMauro Carvalho Chehab {
526*238c84f7SMauro Carvalho Chehab unsigned int index = is->config_index;
527*238c84f7SMauro Carvalho Chehab struct fd_param *fd;
528*238c84f7SMauro Carvalho Chehab unsigned long *p_index;
529*238c84f7SMauro Carvalho Chehab
530*238c84f7SMauro Carvalho Chehab p_index = &is->config[index].p_region_index[1];
531*238c84f7SMauro Carvalho Chehab fd = &is->config[index].fd;
532*238c84f7SMauro Carvalho Chehab
533*238c84f7SMauro Carvalho Chehab fd->config.yaw_angle = val;
534*238c84f7SMauro Carvalho Chehab
535*238c84f7SMauro Carvalho Chehab if (!test_bit((PARAM_FD_CONFIG - 32), p_index)) {
536*238c84f7SMauro Carvalho Chehab fd->config.cmd = FD_CONFIG_COMMAND_YAW_ANGLE;
537*238c84f7SMauro Carvalho Chehab fd->config.err = ERROR_FD_NONE;
538*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_FD_CONFIG);
539*238c84f7SMauro Carvalho Chehab } else {
540*238c84f7SMauro Carvalho Chehab fd->config.cmd |= FD_CONFIG_COMMAND_YAW_ANGLE;
541*238c84f7SMauro Carvalho Chehab }
542*238c84f7SMauro Carvalho Chehab }
543*238c84f7SMauro Carvalho Chehab
__is_set_fd_config_smilemode(struct fimc_is * is,u32 val)544*238c84f7SMauro Carvalho Chehab void __is_set_fd_config_smilemode(struct fimc_is *is, u32 val)
545*238c84f7SMauro Carvalho Chehab {
546*238c84f7SMauro Carvalho Chehab unsigned int index = is->config_index;
547*238c84f7SMauro Carvalho Chehab struct fd_param *fd;
548*238c84f7SMauro Carvalho Chehab unsigned long *p_index;
549*238c84f7SMauro Carvalho Chehab
550*238c84f7SMauro Carvalho Chehab p_index = &is->config[index].p_region_index[1];
551*238c84f7SMauro Carvalho Chehab fd = &is->config[index].fd;
552*238c84f7SMauro Carvalho Chehab
553*238c84f7SMauro Carvalho Chehab fd->config.smile_mode = val;
554*238c84f7SMauro Carvalho Chehab
555*238c84f7SMauro Carvalho Chehab if (!test_bit((PARAM_FD_CONFIG - 32), p_index)) {
556*238c84f7SMauro Carvalho Chehab fd->config.cmd = FD_CONFIG_COMMAND_SMILE_MODE;
557*238c84f7SMauro Carvalho Chehab fd->config.err = ERROR_FD_NONE;
558*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_FD_CONFIG);
559*238c84f7SMauro Carvalho Chehab } else {
560*238c84f7SMauro Carvalho Chehab fd->config.cmd |= FD_CONFIG_COMMAND_SMILE_MODE;
561*238c84f7SMauro Carvalho Chehab }
562*238c84f7SMauro Carvalho Chehab }
563*238c84f7SMauro Carvalho Chehab
__is_set_fd_config_blinkmode(struct fimc_is * is,u32 val)564*238c84f7SMauro Carvalho Chehab void __is_set_fd_config_blinkmode(struct fimc_is *is, u32 val)
565*238c84f7SMauro Carvalho Chehab {
566*238c84f7SMauro Carvalho Chehab unsigned int index = is->config_index;
567*238c84f7SMauro Carvalho Chehab struct fd_param *fd;
568*238c84f7SMauro Carvalho Chehab unsigned long *p_index;
569*238c84f7SMauro Carvalho Chehab
570*238c84f7SMauro Carvalho Chehab p_index = &is->config[index].p_region_index[1];
571*238c84f7SMauro Carvalho Chehab fd = &is->config[index].fd;
572*238c84f7SMauro Carvalho Chehab
573*238c84f7SMauro Carvalho Chehab fd->config.blink_mode = val;
574*238c84f7SMauro Carvalho Chehab
575*238c84f7SMauro Carvalho Chehab if (!test_bit((PARAM_FD_CONFIG - 32), p_index)) {
576*238c84f7SMauro Carvalho Chehab fd->config.cmd = FD_CONFIG_COMMAND_BLINK_MODE;
577*238c84f7SMauro Carvalho Chehab fd->config.err = ERROR_FD_NONE;
578*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_FD_CONFIG);
579*238c84f7SMauro Carvalho Chehab } else {
580*238c84f7SMauro Carvalho Chehab fd->config.cmd |= FD_CONFIG_COMMAND_BLINK_MODE;
581*238c84f7SMauro Carvalho Chehab }
582*238c84f7SMauro Carvalho Chehab }
583*238c84f7SMauro Carvalho Chehab
__is_set_fd_config_eyedetect(struct fimc_is * is,u32 val)584*238c84f7SMauro Carvalho Chehab void __is_set_fd_config_eyedetect(struct fimc_is *is, u32 val)
585*238c84f7SMauro Carvalho Chehab {
586*238c84f7SMauro Carvalho Chehab unsigned int index = is->config_index;
587*238c84f7SMauro Carvalho Chehab struct fd_param *fd;
588*238c84f7SMauro Carvalho Chehab unsigned long *p_index;
589*238c84f7SMauro Carvalho Chehab
590*238c84f7SMauro Carvalho Chehab p_index = &is->config[index].p_region_index[1];
591*238c84f7SMauro Carvalho Chehab fd = &is->config[index].fd;
592*238c84f7SMauro Carvalho Chehab
593*238c84f7SMauro Carvalho Chehab fd->config.eye_detect = val;
594*238c84f7SMauro Carvalho Chehab
595*238c84f7SMauro Carvalho Chehab if (!test_bit((PARAM_FD_CONFIG - 32), p_index)) {
596*238c84f7SMauro Carvalho Chehab fd->config.cmd = FD_CONFIG_COMMAND_EYES_DETECT;
597*238c84f7SMauro Carvalho Chehab fd->config.err = ERROR_FD_NONE;
598*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_FD_CONFIG);
599*238c84f7SMauro Carvalho Chehab } else {
600*238c84f7SMauro Carvalho Chehab fd->config.cmd |= FD_CONFIG_COMMAND_EYES_DETECT;
601*238c84f7SMauro Carvalho Chehab }
602*238c84f7SMauro Carvalho Chehab }
603*238c84f7SMauro Carvalho Chehab
__is_set_fd_config_mouthdetect(struct fimc_is * is,u32 val)604*238c84f7SMauro Carvalho Chehab void __is_set_fd_config_mouthdetect(struct fimc_is *is, u32 val)
605*238c84f7SMauro Carvalho Chehab {
606*238c84f7SMauro Carvalho Chehab unsigned int index = is->config_index;
607*238c84f7SMauro Carvalho Chehab struct fd_param *fd;
608*238c84f7SMauro Carvalho Chehab unsigned long *p_index;
609*238c84f7SMauro Carvalho Chehab
610*238c84f7SMauro Carvalho Chehab p_index = &is->config[index].p_region_index[1];
611*238c84f7SMauro Carvalho Chehab fd = &is->config[index].fd;
612*238c84f7SMauro Carvalho Chehab
613*238c84f7SMauro Carvalho Chehab fd->config.mouth_detect = val;
614*238c84f7SMauro Carvalho Chehab
615*238c84f7SMauro Carvalho Chehab if (!test_bit((PARAM_FD_CONFIG - 32), p_index)) {
616*238c84f7SMauro Carvalho Chehab fd->config.cmd = FD_CONFIG_COMMAND_MOUTH_DETECT;
617*238c84f7SMauro Carvalho Chehab fd->config.err = ERROR_FD_NONE;
618*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_FD_CONFIG);
619*238c84f7SMauro Carvalho Chehab } else {
620*238c84f7SMauro Carvalho Chehab fd->config.cmd |= FD_CONFIG_COMMAND_MOUTH_DETECT;
621*238c84f7SMauro Carvalho Chehab }
622*238c84f7SMauro Carvalho Chehab }
623*238c84f7SMauro Carvalho Chehab
__is_set_fd_config_orientation(struct fimc_is * is,u32 val)624*238c84f7SMauro Carvalho Chehab void __is_set_fd_config_orientation(struct fimc_is *is, u32 val)
625*238c84f7SMauro Carvalho Chehab {
626*238c84f7SMauro Carvalho Chehab unsigned int index = is->config_index;
627*238c84f7SMauro Carvalho Chehab struct fd_param *fd;
628*238c84f7SMauro Carvalho Chehab unsigned long *p_index;
629*238c84f7SMauro Carvalho Chehab
630*238c84f7SMauro Carvalho Chehab p_index = &is->config[index].p_region_index[1];
631*238c84f7SMauro Carvalho Chehab fd = &is->config[index].fd;
632*238c84f7SMauro Carvalho Chehab
633*238c84f7SMauro Carvalho Chehab fd->config.orientation = val;
634*238c84f7SMauro Carvalho Chehab
635*238c84f7SMauro Carvalho Chehab if (!test_bit((PARAM_FD_CONFIG - 32), p_index)) {
636*238c84f7SMauro Carvalho Chehab fd->config.cmd = FD_CONFIG_COMMAND_ORIENTATION;
637*238c84f7SMauro Carvalho Chehab fd->config.err = ERROR_FD_NONE;
638*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_FD_CONFIG);
639*238c84f7SMauro Carvalho Chehab } else {
640*238c84f7SMauro Carvalho Chehab fd->config.cmd |= FD_CONFIG_COMMAND_ORIENTATION;
641*238c84f7SMauro Carvalho Chehab }
642*238c84f7SMauro Carvalho Chehab }
643*238c84f7SMauro Carvalho Chehab
__is_set_fd_config_orientation_val(struct fimc_is * is,u32 val)644*238c84f7SMauro Carvalho Chehab void __is_set_fd_config_orientation_val(struct fimc_is *is, u32 val)
645*238c84f7SMauro Carvalho Chehab {
646*238c84f7SMauro Carvalho Chehab unsigned int index = is->config_index;
647*238c84f7SMauro Carvalho Chehab struct fd_param *fd;
648*238c84f7SMauro Carvalho Chehab unsigned long *p_index;
649*238c84f7SMauro Carvalho Chehab
650*238c84f7SMauro Carvalho Chehab p_index = &is->config[index].p_region_index[1];
651*238c84f7SMauro Carvalho Chehab fd = &is->config[index].fd;
652*238c84f7SMauro Carvalho Chehab
653*238c84f7SMauro Carvalho Chehab fd->config.orientation_value = val;
654*238c84f7SMauro Carvalho Chehab
655*238c84f7SMauro Carvalho Chehab if (!test_bit((PARAM_FD_CONFIG - 32), p_index)) {
656*238c84f7SMauro Carvalho Chehab fd->config.cmd = FD_CONFIG_COMMAND_ORIENTATION_VALUE;
657*238c84f7SMauro Carvalho Chehab fd->config.err = ERROR_FD_NONE;
658*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_FD_CONFIG);
659*238c84f7SMauro Carvalho Chehab } else {
660*238c84f7SMauro Carvalho Chehab fd->config.cmd |= FD_CONFIG_COMMAND_ORIENTATION_VALUE;
661*238c84f7SMauro Carvalho Chehab }
662*238c84f7SMauro Carvalho Chehab }
663*238c84f7SMauro Carvalho Chehab
fimc_is_set_initial_params(struct fimc_is * is)664*238c84f7SMauro Carvalho Chehab void fimc_is_set_initial_params(struct fimc_is *is)
665*238c84f7SMauro Carvalho Chehab {
666*238c84f7SMauro Carvalho Chehab struct global_param *global;
667*238c84f7SMauro Carvalho Chehab struct isp_param *isp;
668*238c84f7SMauro Carvalho Chehab struct drc_param *drc;
669*238c84f7SMauro Carvalho Chehab struct fd_param *fd;
670*238c84f7SMauro Carvalho Chehab unsigned long *p_index;
671*238c84f7SMauro Carvalho Chehab unsigned int index;
672*238c84f7SMauro Carvalho Chehab
673*238c84f7SMauro Carvalho Chehab index = is->config_index;
674*238c84f7SMauro Carvalho Chehab global = &is->config[index].global;
675*238c84f7SMauro Carvalho Chehab isp = &is->config[index].isp;
676*238c84f7SMauro Carvalho Chehab drc = &is->config[index].drc;
677*238c84f7SMauro Carvalho Chehab fd = &is->config[index].fd;
678*238c84f7SMauro Carvalho Chehab p_index = &is->config[index].p_region_index[0];
679*238c84f7SMauro Carvalho Chehab
680*238c84f7SMauro Carvalho Chehab /* Global */
681*238c84f7SMauro Carvalho Chehab global->shotmode.cmd = 1;
682*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_GLOBAL_SHOTMODE);
683*238c84f7SMauro Carvalho Chehab
684*238c84f7SMauro Carvalho Chehab /* ISP */
685*238c84f7SMauro Carvalho Chehab isp->control.cmd = CONTROL_COMMAND_START;
686*238c84f7SMauro Carvalho Chehab isp->control.bypass = CONTROL_BYPASS_DISABLE;
687*238c84f7SMauro Carvalho Chehab isp->control.err = CONTROL_ERROR_NONE;
688*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_ISP_CONTROL);
689*238c84f7SMauro Carvalho Chehab
690*238c84f7SMauro Carvalho Chehab isp->otf_input.cmd = OTF_INPUT_COMMAND_ENABLE;
691*238c84f7SMauro Carvalho Chehab if (!test_bit(PARAM_ISP_OTF_INPUT, p_index)) {
692*238c84f7SMauro Carvalho Chehab isp->otf_input.width = DEFAULT_PREVIEW_STILL_WIDTH;
693*238c84f7SMauro Carvalho Chehab isp->otf_input.height = DEFAULT_PREVIEW_STILL_HEIGHT;
694*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_ISP_OTF_INPUT);
695*238c84f7SMauro Carvalho Chehab }
696*238c84f7SMauro Carvalho Chehab if (is->sensor->test_pattern)
697*238c84f7SMauro Carvalho Chehab isp->otf_input.format = OTF_INPUT_FORMAT_STRGEN_COLORBAR_BAYER;
698*238c84f7SMauro Carvalho Chehab else
699*238c84f7SMauro Carvalho Chehab isp->otf_input.format = OTF_INPUT_FORMAT_BAYER;
700*238c84f7SMauro Carvalho Chehab isp->otf_input.bitwidth = 10;
701*238c84f7SMauro Carvalho Chehab isp->otf_input.order = OTF_INPUT_ORDER_BAYER_GR_BG;
702*238c84f7SMauro Carvalho Chehab isp->otf_input.crop_offset_x = 0;
703*238c84f7SMauro Carvalho Chehab isp->otf_input.crop_offset_y = 0;
704*238c84f7SMauro Carvalho Chehab isp->otf_input.err = OTF_INPUT_ERROR_NONE;
705*238c84f7SMauro Carvalho Chehab
706*238c84f7SMauro Carvalho Chehab isp->dma1_input.cmd = DMA_INPUT_COMMAND_DISABLE;
707*238c84f7SMauro Carvalho Chehab isp->dma1_input.width = 0;
708*238c84f7SMauro Carvalho Chehab isp->dma1_input.height = 0;
709*238c84f7SMauro Carvalho Chehab isp->dma1_input.format = 0;
710*238c84f7SMauro Carvalho Chehab isp->dma1_input.bitwidth = 0;
711*238c84f7SMauro Carvalho Chehab isp->dma1_input.plane = 0;
712*238c84f7SMauro Carvalho Chehab isp->dma1_input.order = 0;
713*238c84f7SMauro Carvalho Chehab isp->dma1_input.buffer_number = 0;
714*238c84f7SMauro Carvalho Chehab isp->dma1_input.width = 0;
715*238c84f7SMauro Carvalho Chehab isp->dma1_input.err = DMA_INPUT_ERROR_NONE;
716*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_ISP_DMA1_INPUT);
717*238c84f7SMauro Carvalho Chehab
718*238c84f7SMauro Carvalho Chehab isp->dma2_input.cmd = DMA_INPUT_COMMAND_DISABLE;
719*238c84f7SMauro Carvalho Chehab isp->dma2_input.width = 0;
720*238c84f7SMauro Carvalho Chehab isp->dma2_input.height = 0;
721*238c84f7SMauro Carvalho Chehab isp->dma2_input.format = 0;
722*238c84f7SMauro Carvalho Chehab isp->dma2_input.bitwidth = 0;
723*238c84f7SMauro Carvalho Chehab isp->dma2_input.plane = 0;
724*238c84f7SMauro Carvalho Chehab isp->dma2_input.order = 0;
725*238c84f7SMauro Carvalho Chehab isp->dma2_input.buffer_number = 0;
726*238c84f7SMauro Carvalho Chehab isp->dma2_input.width = 0;
727*238c84f7SMauro Carvalho Chehab isp->dma2_input.err = DMA_INPUT_ERROR_NONE;
728*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_ISP_DMA2_INPUT);
729*238c84f7SMauro Carvalho Chehab
730*238c84f7SMauro Carvalho Chehab isp->aa.cmd = ISP_AA_COMMAND_START;
731*238c84f7SMauro Carvalho Chehab isp->aa.target = ISP_AA_TARGET_AE | ISP_AA_TARGET_AWB;
732*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_ISP_AA);
733*238c84f7SMauro Carvalho Chehab
734*238c84f7SMauro Carvalho Chehab if (!test_bit(PARAM_ISP_FLASH, p_index))
735*238c84f7SMauro Carvalho Chehab __is_set_isp_flash(is, ISP_FLASH_COMMAND_DISABLE,
736*238c84f7SMauro Carvalho Chehab ISP_FLASH_REDEYE_DISABLE);
737*238c84f7SMauro Carvalho Chehab
738*238c84f7SMauro Carvalho Chehab if (!test_bit(PARAM_ISP_AWB, p_index))
739*238c84f7SMauro Carvalho Chehab __is_set_isp_awb(is, ISP_AWB_COMMAND_AUTO, 0);
740*238c84f7SMauro Carvalho Chehab
741*238c84f7SMauro Carvalho Chehab if (!test_bit(PARAM_ISP_IMAGE_EFFECT, p_index))
742*238c84f7SMauro Carvalho Chehab __is_set_isp_effect(is, ISP_IMAGE_EFFECT_DISABLE);
743*238c84f7SMauro Carvalho Chehab
744*238c84f7SMauro Carvalho Chehab if (!test_bit(PARAM_ISP_ISO, p_index))
745*238c84f7SMauro Carvalho Chehab __is_set_isp_iso(is, ISP_ISO_COMMAND_AUTO, 0);
746*238c84f7SMauro Carvalho Chehab
747*238c84f7SMauro Carvalho Chehab if (!test_bit(PARAM_ISP_ADJUST, p_index)) {
748*238c84f7SMauro Carvalho Chehab __is_set_isp_adjust(is, ISP_ADJUST_COMMAND_MANUAL_CONTRAST, 0);
749*238c84f7SMauro Carvalho Chehab __is_set_isp_adjust(is,
750*238c84f7SMauro Carvalho Chehab ISP_ADJUST_COMMAND_MANUAL_SATURATION, 0);
751*238c84f7SMauro Carvalho Chehab __is_set_isp_adjust(is, ISP_ADJUST_COMMAND_MANUAL_SHARPNESS, 0);
752*238c84f7SMauro Carvalho Chehab __is_set_isp_adjust(is, ISP_ADJUST_COMMAND_MANUAL_EXPOSURE, 0);
753*238c84f7SMauro Carvalho Chehab __is_set_isp_adjust(is,
754*238c84f7SMauro Carvalho Chehab ISP_ADJUST_COMMAND_MANUAL_BRIGHTNESS, 0);
755*238c84f7SMauro Carvalho Chehab __is_set_isp_adjust(is, ISP_ADJUST_COMMAND_MANUAL_HUE, 0);
756*238c84f7SMauro Carvalho Chehab }
757*238c84f7SMauro Carvalho Chehab
758*238c84f7SMauro Carvalho Chehab if (!test_bit(PARAM_ISP_METERING, p_index)) {
759*238c84f7SMauro Carvalho Chehab __is_set_isp_metering(is, 0, ISP_METERING_COMMAND_CENTER);
760*238c84f7SMauro Carvalho Chehab __is_set_isp_metering(is, 1, 0);
761*238c84f7SMauro Carvalho Chehab __is_set_isp_metering(is, 2, 0);
762*238c84f7SMauro Carvalho Chehab __is_set_isp_metering(is, 3, 0);
763*238c84f7SMauro Carvalho Chehab __is_set_isp_metering(is, 4, 0);
764*238c84f7SMauro Carvalho Chehab }
765*238c84f7SMauro Carvalho Chehab
766*238c84f7SMauro Carvalho Chehab if (!test_bit(PARAM_ISP_AFC, p_index))
767*238c84f7SMauro Carvalho Chehab __is_set_isp_afc(is, ISP_AFC_COMMAND_AUTO, 0);
768*238c84f7SMauro Carvalho Chehab
769*238c84f7SMauro Carvalho Chehab isp->otf_output.cmd = OTF_OUTPUT_COMMAND_ENABLE;
770*238c84f7SMauro Carvalho Chehab if (!test_bit(PARAM_ISP_OTF_OUTPUT, p_index)) {
771*238c84f7SMauro Carvalho Chehab isp->otf_output.width = DEFAULT_PREVIEW_STILL_WIDTH;
772*238c84f7SMauro Carvalho Chehab isp->otf_output.height = DEFAULT_PREVIEW_STILL_HEIGHT;
773*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_ISP_OTF_OUTPUT);
774*238c84f7SMauro Carvalho Chehab }
775*238c84f7SMauro Carvalho Chehab isp->otf_output.format = OTF_OUTPUT_FORMAT_YUV444;
776*238c84f7SMauro Carvalho Chehab isp->otf_output.bitwidth = 12;
777*238c84f7SMauro Carvalho Chehab isp->otf_output.order = 0;
778*238c84f7SMauro Carvalho Chehab isp->otf_output.err = OTF_OUTPUT_ERROR_NONE;
779*238c84f7SMauro Carvalho Chehab
780*238c84f7SMauro Carvalho Chehab if (!test_bit(PARAM_ISP_DMA1_OUTPUT, p_index)) {
781*238c84f7SMauro Carvalho Chehab isp->dma1_output.cmd = DMA_OUTPUT_COMMAND_DISABLE;
782*238c84f7SMauro Carvalho Chehab isp->dma1_output.width = 0;
783*238c84f7SMauro Carvalho Chehab isp->dma1_output.height = 0;
784*238c84f7SMauro Carvalho Chehab isp->dma1_output.format = 0;
785*238c84f7SMauro Carvalho Chehab isp->dma1_output.bitwidth = 0;
786*238c84f7SMauro Carvalho Chehab isp->dma1_output.plane = 0;
787*238c84f7SMauro Carvalho Chehab isp->dma1_output.order = 0;
788*238c84f7SMauro Carvalho Chehab isp->dma1_output.buffer_number = 0;
789*238c84f7SMauro Carvalho Chehab isp->dma1_output.buffer_address = 0;
790*238c84f7SMauro Carvalho Chehab isp->dma1_output.notify_dma_done = 0;
791*238c84f7SMauro Carvalho Chehab isp->dma1_output.dma_out_mask = 0;
792*238c84f7SMauro Carvalho Chehab isp->dma1_output.err = DMA_OUTPUT_ERROR_NONE;
793*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_ISP_DMA1_OUTPUT);
794*238c84f7SMauro Carvalho Chehab }
795*238c84f7SMauro Carvalho Chehab
796*238c84f7SMauro Carvalho Chehab if (!test_bit(PARAM_ISP_DMA2_OUTPUT, p_index)) {
797*238c84f7SMauro Carvalho Chehab isp->dma2_output.cmd = DMA_OUTPUT_COMMAND_DISABLE;
798*238c84f7SMauro Carvalho Chehab isp->dma2_output.width = 0;
799*238c84f7SMauro Carvalho Chehab isp->dma2_output.height = 0;
800*238c84f7SMauro Carvalho Chehab isp->dma2_output.format = 0;
801*238c84f7SMauro Carvalho Chehab isp->dma2_output.bitwidth = 0;
802*238c84f7SMauro Carvalho Chehab isp->dma2_output.plane = 0;
803*238c84f7SMauro Carvalho Chehab isp->dma2_output.order = 0;
804*238c84f7SMauro Carvalho Chehab isp->dma2_output.buffer_number = 0;
805*238c84f7SMauro Carvalho Chehab isp->dma2_output.buffer_address = 0;
806*238c84f7SMauro Carvalho Chehab isp->dma2_output.notify_dma_done = 0;
807*238c84f7SMauro Carvalho Chehab isp->dma2_output.dma_out_mask = 0;
808*238c84f7SMauro Carvalho Chehab isp->dma2_output.err = DMA_OUTPUT_ERROR_NONE;
809*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_ISP_DMA2_OUTPUT);
810*238c84f7SMauro Carvalho Chehab }
811*238c84f7SMauro Carvalho Chehab
812*238c84f7SMauro Carvalho Chehab /* Sensor */
813*238c84f7SMauro Carvalho Chehab if (!test_bit(PARAM_SENSOR_FRAME_RATE, p_index)) {
814*238c84f7SMauro Carvalho Chehab if (is->config_index == 0)
815*238c84f7SMauro Carvalho Chehab __is_set_sensor(is, 0);
816*238c84f7SMauro Carvalho Chehab }
817*238c84f7SMauro Carvalho Chehab
818*238c84f7SMauro Carvalho Chehab /* DRC */
819*238c84f7SMauro Carvalho Chehab drc->control.cmd = CONTROL_COMMAND_START;
820*238c84f7SMauro Carvalho Chehab __is_set_drc_control(is, CONTROL_BYPASS_ENABLE);
821*238c84f7SMauro Carvalho Chehab
822*238c84f7SMauro Carvalho Chehab drc->otf_input.cmd = OTF_INPUT_COMMAND_ENABLE;
823*238c84f7SMauro Carvalho Chehab if (!test_bit(PARAM_DRC_OTF_INPUT, p_index)) {
824*238c84f7SMauro Carvalho Chehab drc->otf_input.width = DEFAULT_PREVIEW_STILL_WIDTH;
825*238c84f7SMauro Carvalho Chehab drc->otf_input.height = DEFAULT_PREVIEW_STILL_HEIGHT;
826*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_DRC_OTF_INPUT);
827*238c84f7SMauro Carvalho Chehab }
828*238c84f7SMauro Carvalho Chehab drc->otf_input.format = OTF_INPUT_FORMAT_YUV444;
829*238c84f7SMauro Carvalho Chehab drc->otf_input.bitwidth = 12;
830*238c84f7SMauro Carvalho Chehab drc->otf_input.order = 0;
831*238c84f7SMauro Carvalho Chehab drc->otf_input.err = OTF_INPUT_ERROR_NONE;
832*238c84f7SMauro Carvalho Chehab
833*238c84f7SMauro Carvalho Chehab drc->dma_input.cmd = DMA_INPUT_COMMAND_DISABLE;
834*238c84f7SMauro Carvalho Chehab drc->dma_input.width = 0;
835*238c84f7SMauro Carvalho Chehab drc->dma_input.height = 0;
836*238c84f7SMauro Carvalho Chehab drc->dma_input.format = 0;
837*238c84f7SMauro Carvalho Chehab drc->dma_input.bitwidth = 0;
838*238c84f7SMauro Carvalho Chehab drc->dma_input.plane = 0;
839*238c84f7SMauro Carvalho Chehab drc->dma_input.order = 0;
840*238c84f7SMauro Carvalho Chehab drc->dma_input.buffer_number = 0;
841*238c84f7SMauro Carvalho Chehab drc->dma_input.width = 0;
842*238c84f7SMauro Carvalho Chehab drc->dma_input.err = DMA_INPUT_ERROR_NONE;
843*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_DRC_DMA_INPUT);
844*238c84f7SMauro Carvalho Chehab
845*238c84f7SMauro Carvalho Chehab drc->otf_output.cmd = OTF_OUTPUT_COMMAND_ENABLE;
846*238c84f7SMauro Carvalho Chehab if (!test_bit(PARAM_DRC_OTF_OUTPUT, p_index)) {
847*238c84f7SMauro Carvalho Chehab drc->otf_output.width = DEFAULT_PREVIEW_STILL_WIDTH;
848*238c84f7SMauro Carvalho Chehab drc->otf_output.height = DEFAULT_PREVIEW_STILL_HEIGHT;
849*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_DRC_OTF_OUTPUT);
850*238c84f7SMauro Carvalho Chehab }
851*238c84f7SMauro Carvalho Chehab drc->otf_output.format = OTF_OUTPUT_FORMAT_YUV444;
852*238c84f7SMauro Carvalho Chehab drc->otf_output.bitwidth = 8;
853*238c84f7SMauro Carvalho Chehab drc->otf_output.order = 0;
854*238c84f7SMauro Carvalho Chehab drc->otf_output.err = OTF_OUTPUT_ERROR_NONE;
855*238c84f7SMauro Carvalho Chehab
856*238c84f7SMauro Carvalho Chehab /* FD */
857*238c84f7SMauro Carvalho Chehab __is_set_fd_control(is, CONTROL_COMMAND_STOP);
858*238c84f7SMauro Carvalho Chehab fd->control.bypass = CONTROL_BYPASS_DISABLE;
859*238c84f7SMauro Carvalho Chehab
860*238c84f7SMauro Carvalho Chehab fd->otf_input.cmd = OTF_INPUT_COMMAND_ENABLE;
861*238c84f7SMauro Carvalho Chehab if (!test_bit(PARAM_FD_OTF_INPUT, p_index)) {
862*238c84f7SMauro Carvalho Chehab fd->otf_input.width = DEFAULT_PREVIEW_STILL_WIDTH;
863*238c84f7SMauro Carvalho Chehab fd->otf_input.height = DEFAULT_PREVIEW_STILL_HEIGHT;
864*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_FD_OTF_INPUT);
865*238c84f7SMauro Carvalho Chehab }
866*238c84f7SMauro Carvalho Chehab
867*238c84f7SMauro Carvalho Chehab fd->otf_input.format = OTF_INPUT_FORMAT_YUV444;
868*238c84f7SMauro Carvalho Chehab fd->otf_input.bitwidth = 8;
869*238c84f7SMauro Carvalho Chehab fd->otf_input.order = 0;
870*238c84f7SMauro Carvalho Chehab fd->otf_input.err = OTF_INPUT_ERROR_NONE;
871*238c84f7SMauro Carvalho Chehab
872*238c84f7SMauro Carvalho Chehab fd->dma_input.cmd = DMA_INPUT_COMMAND_DISABLE;
873*238c84f7SMauro Carvalho Chehab fd->dma_input.width = 0;
874*238c84f7SMauro Carvalho Chehab fd->dma_input.height = 0;
875*238c84f7SMauro Carvalho Chehab fd->dma_input.format = 0;
876*238c84f7SMauro Carvalho Chehab fd->dma_input.bitwidth = 0;
877*238c84f7SMauro Carvalho Chehab fd->dma_input.plane = 0;
878*238c84f7SMauro Carvalho Chehab fd->dma_input.order = 0;
879*238c84f7SMauro Carvalho Chehab fd->dma_input.buffer_number = 0;
880*238c84f7SMauro Carvalho Chehab fd->dma_input.width = 0;
881*238c84f7SMauro Carvalho Chehab fd->dma_input.err = DMA_INPUT_ERROR_NONE;
882*238c84f7SMauro Carvalho Chehab fimc_is_set_param_bit(is, PARAM_FD_DMA_INPUT);
883*238c84f7SMauro Carvalho Chehab
884*238c84f7SMauro Carvalho Chehab __is_set_fd_config_maxface(is, 5);
885*238c84f7SMauro Carvalho Chehab __is_set_fd_config_rollangle(is, FD_CONFIG_ROLL_ANGLE_FULL);
886*238c84f7SMauro Carvalho Chehab __is_set_fd_config_yawangle(is, FD_CONFIG_YAW_ANGLE_45_90);
887*238c84f7SMauro Carvalho Chehab __is_set_fd_config_smilemode(is, FD_CONFIG_SMILE_MODE_DISABLE);
888*238c84f7SMauro Carvalho Chehab __is_set_fd_config_blinkmode(is, FD_CONFIG_BLINK_MODE_DISABLE);
889*238c84f7SMauro Carvalho Chehab __is_set_fd_config_eyedetect(is, FD_CONFIG_EYES_DETECT_ENABLE);
890*238c84f7SMauro Carvalho Chehab __is_set_fd_config_mouthdetect(is, FD_CONFIG_MOUTH_DETECT_DISABLE);
891*238c84f7SMauro Carvalho Chehab __is_set_fd_config_orientation(is, FD_CONFIG_ORIENTATION_DISABLE);
892*238c84f7SMauro Carvalho Chehab __is_set_fd_config_orientation_val(is, 0);
893*238c84f7SMauro Carvalho Chehab }
894