summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/linux/linux-omap-2.6.29/isp/omap3camera/0005-omap3isp-Add-ISP-backend-PRV-and-RSZ.patch
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-08-27 15:14:24 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2010-08-27 15:29:45 +0100
commit29d6678fd546377459ef75cf54abeef5b969b5cf (patch)
tree8edd65790e37a00d01c3f203f773fe4b5012db18 /meta/recipes-kernel/linux/linux-omap-2.6.29/isp/omap3camera/0005-omap3isp-Add-ISP-backend-PRV-and-RSZ.patch
parentda49de6885ee1bc424e70bc02f21f6ab920efb55 (diff)
downloadpoky-29d6678fd546377459ef75cf54abeef5b969b5cf.tar.gz
Major layout change to the packages directory
Having one monolithic packages directory makes it hard to find things and is generally overwhelming. This commit splits it into several logical sections roughly based on function, recipes.txt gives more information about the classifications used. The opportunity is also used to switch from "packages" to "recipes" as used in OpenEmbedded as the term "packages" can be confusing to people and has many different meanings. Not all recipes have been classified yet, this is just a first pass at separating things out. Some packages are moved to meta-extras as they're no longer actively used or maintained. Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'meta/recipes-kernel/linux/linux-omap-2.6.29/isp/omap3camera/0005-omap3isp-Add-ISP-backend-PRV-and-RSZ.patch')
-rw-r--r--meta/recipes-kernel/linux/linux-omap-2.6.29/isp/omap3camera/0005-omap3isp-Add-ISP-backend-PRV-and-RSZ.patch3413
1 files changed, 3413 insertions, 0 deletions
diff --git a/meta/recipes-kernel/linux/linux-omap-2.6.29/isp/omap3camera/0005-omap3isp-Add-ISP-backend-PRV-and-RSZ.patch b/meta/recipes-kernel/linux/linux-omap-2.6.29/isp/omap3camera/0005-omap3isp-Add-ISP-backend-PRV-and-RSZ.patch
new file mode 100644
index 0000000000..c549eadc88
--- /dev/null
+++ b/meta/recipes-kernel/linux/linux-omap-2.6.29/isp/omap3camera/0005-omap3isp-Add-ISP-backend-PRV-and-RSZ.patch
@@ -0,0 +1,3413 @@
1From 926b51afea146826c8076e5fb305eaa0332399b4 Mon Sep 17 00:00:00 2001
2From: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>
3Date: Tue, 10 Mar 2009 10:49:02 +0200
4Subject: [PATCH] omap3isp: Add ISP backend (PRV and RSZ)
5
6Signed-off-by: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>
7---
8 drivers/media/video/isp/isppreview.c | 1929 ++++++++++++++++++++++++++++++++++
9 drivers/media/video/isp/isppreview.h | 354 +++++++
10 drivers/media/video/isp/ispresizer.c | 928 ++++++++++++++++
11 drivers/media/video/isp/ispresizer.h | 158 +++
12 4 files changed, 3369 insertions(+), 0 deletions(-)
13 create mode 100644 drivers/media/video/isp/isppreview.c
14 create mode 100644 drivers/media/video/isp/isppreview.h
15 create mode 100644 drivers/media/video/isp/ispresizer.c
16 create mode 100644 drivers/media/video/isp/ispresizer.h
17
18diff --git a/drivers/media/video/isp/isppreview.c b/drivers/media/video/isp/isppreview.c
19new file mode 100644
20index 0000000..17f1abc
21--- /dev/null
22+++ b/drivers/media/video/isp/isppreview.c
23@@ -0,0 +1,1929 @@
24+/*
25+ * isppreview.c
26+ *
27+ * Driver Library for Preview module in TI's OMAP3 Camera ISP
28+ *
29+ * Copyright (C) 2009 Texas Instruments, Inc.
30+ *
31+ * Contributors:
32+ * Senthilvadivu Guruswamy <svadivu@ti.com>
33+ * Pallavi Kulkarni <p-kulkarni@ti.com>
34+ * Sergio Aguirre <saaguirre@ti.com>
35+ *
36+ * This package is free software; you can redistribute it and/or modify
37+ * it under the terms of the GNU General Public License version 2 as
38+ * published by the Free Software Foundation.
39+ *
40+ * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
41+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
42+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
43+ */
44+
45+#include <linux/mutex.h>
46+#include <linux/module.h>
47+#include <linux/uaccess.h>
48+
49+#include "isp.h"
50+#include "ispreg.h"
51+#include "isppreview.h"
52+
53+static struct ispprev_nf prev_nf_t;
54+static struct prev_params *params;
55+static int rg_update, gg_update, bg_update, nf_enable, nf_update;
56+
57+/* Structure for saving/restoring preview module registers */
58+static struct isp_reg ispprev_reg_list[] = {
59+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_HORZ_INFO, 0x0000},
60+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_VERT_INFO, 0x0000},
61+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_RSDR_ADDR, 0x0000},
62+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_RADR_OFFSET, 0x0000},
63+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_DSDR_ADDR, 0x0000},
64+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_DRKF_OFFSET, 0x0000},
65+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_WSDR_ADDR, 0x0000},
66+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_WADD_OFFSET, 0x0000},
67+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_AVE, 0x0000},
68+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_HMED, 0x0000},
69+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_NF, 0x0000},
70+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_WB_DGAIN, 0x0000},
71+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_WBGAIN, 0x0000},
72+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_WBSEL, 0x0000},
73+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_CFA, 0x0000},
74+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_BLKADJOFF, 0x0000},
75+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_RGB_MAT1, 0x0000},
76+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_RGB_MAT2, 0x0000},
77+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_RGB_MAT3, 0x0000},
78+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_RGB_MAT4, 0x0000},
79+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_RGB_MAT5, 0x0000},
80+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_RGB_OFF1, 0x0000},
81+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_RGB_OFF2, 0x0000},
82+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_CSC0, 0x0000},
83+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_CSC1, 0x0000},
84+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_CSC2, 0x0000},
85+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_CSC_OFFSET, 0x0000},
86+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_CNT_BRT, 0x0000},
87+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_CSUP, 0x0000},
88+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_SETUP_YC, 0x0000},
89+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_CDC_THR0, 0x0000},
90+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_CDC_THR1, 0x0000},
91+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_CDC_THR2, 0x0000},
92+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_CDC_THR3, 0x0000},
93+ {OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, 0x0000},
94+ {0, ISP_TOK_TERM, 0x0000}
95+};
96+
97+
98+/* Default values in Office Flourescent Light for RGBtoRGB Blending */
99+static struct ispprev_rgbtorgb flr_rgb2rgb = {
100+ { /* RGB-RGB Matrix */
101+ {0x01E2, 0x0F30, 0x0FEE},
102+ {0x0F9B, 0x01AC, 0x0FB9},
103+ {0x0FE0, 0x0EC0, 0x0260}
104+ }, /* RGB Offset */
105+ {0x0000, 0x0000, 0x0000}
106+};
107+
108+/* Default values in Office Flourescent Light for RGB to YUV Conversion*/
109+static struct ispprev_csc flr_prev_csc[] = {
110+ {
111+ { /* CSC Coef Matrix */
112+ {66, 129, 25},
113+ {-38, -75, 112},
114+ {112, -94 , -18}
115+ }, /* CSC Offset */
116+ {0x0, 0x0, 0x0}
117+ },
118+ {
119+ { /* CSC Coef Matrix BW */
120+ {66, 129, 25},
121+ {0, 0, 0},
122+ {0, 0, 0}
123+ }, /* CSC Offset */
124+ {0x0, 0x0, 0x0}
125+ },
126+ {
127+ { /* CSC Coef Matrix Sepia */
128+ {19, 38, 7},
129+ {0, 0, 0},
130+ {0, 0, 0}
131+ }, /* CSC Offset */
132+ {0x0, 0xE7, 0x14}
133+ }
134+};
135+
136+
137+/* Default values in Office Flourescent Light for CFA Gradient*/
138+#define FLR_CFA_GRADTHRS_HORZ 0x28
139+#define FLR_CFA_GRADTHRS_VERT 0x28
140+
141+/* Default values in Office Flourescent Light for Chroma Suppression*/
142+#define FLR_CSUP_GAIN 0x0D
143+#define FLR_CSUP_THRES 0xEB
144+
145+/* Default values in Office Flourescent Light for Noise Filter*/
146+#define FLR_NF_STRGTH 0x03
147+
148+/* Default values in Office Flourescent Light for White Balance*/
149+#define FLR_WBAL_DGAIN 0x100
150+#define FLR_WBAL_COEF0 0x20
151+#define FLR_WBAL_COEF1 0x29
152+#define FLR_WBAL_COEF2 0x2d
153+#define FLR_WBAL_COEF3 0x20
154+
155+#define FLR_WBAL_COEF0_ES1 0x20
156+#define FLR_WBAL_COEF1_ES1 0x23
157+#define FLR_WBAL_COEF2_ES1 0x39
158+#define FLR_WBAL_COEF3_ES1 0x20
159+
160+/* Default values in Office Flourescent Light for Black Adjustment*/
161+#define FLR_BLKADJ_BLUE 0x0
162+#define FLR_BLKADJ_GREEN 0x0
163+#define FLR_BLKADJ_RED 0x0
164+
165+static int update_color_matrix;
166+
167+/**
168+ * struct isp_prev - Structure for storing ISP Preview module information
169+ * @prev_inuse: Flag to determine if CCDC has been reserved or not (0 or 1).
170+ * @prevout_w: Preview output width.
171+ * @prevout_h: Preview output height.
172+ * @previn_w: Preview input width.
173+ * @previn_h: Preview input height.
174+ * @prev_inpfmt: Preview input format.
175+ * @prev_outfmt: Preview output format.
176+ * @hmed_en: Horizontal median filter enable.
177+ * @nf_en: Noise filter enable.
178+ * @dcor_en: Defect correction enable.
179+ * @cfa_en: Color Filter Array (CFA) interpolation enable.
180+ * @csup_en: Chrominance suppression enable.
181+ * @yenh_en: Luma enhancement enable.
182+ * @fmtavg: Number of horizontal pixels to average in input formatter. The
183+ * input width should be a multiple of this number.
184+ * @brightness: Brightness in preview module.
185+ * @contrast: Contrast in preview module.
186+ * @color: Color effect in preview module.
187+ * @cfafmt: Color Filter Array (CFA) Format.
188+ * @ispprev_mutex: Mutex for isp preview.
189+ *
190+ * This structure is used to store the OMAP ISP Preview module Information.
191+ */
192+static struct isp_prev {
193+ int pm_state;
194+ u8 prev_inuse;
195+ u32 prevout_w;
196+ u32 prevout_h;
197+ u32 previn_w;
198+ u32 previn_h;
199+ enum preview_input prev_inpfmt;
200+ enum preview_output prev_outfmt;
201+ u8 hmed_en;
202+ u8 nf_en;
203+ u8 dcor_en;
204+ u8 cfa_en;
205+ u8 csup_en;
206+ u8 yenh_en;
207+ u8 fmtavg;
208+ u8 brightness;
209+ u8 contrast;
210+ enum v4l2_colorfx color;
211+ enum cfa_fmt cfafmt;
212+ struct mutex ispprev_mutex; /* For checking/modifying prev_inuse */
213+ u32 sph;
214+ u32 slv;
215+} ispprev_obj;
216+
217+/* Saved parameters */
218+static struct prev_params *prev_config_params;
219+
220+/*
221+ * Coeficient Tables for the submodules in Preview.
222+ * Array is initialised with the values from.the tables text file.
223+ */
224+
225+/*
226+ * CFA Filter Coefficient Table
227+ *
228+ */
229+static u32 cfa_coef_table[] = {
230+#include "cfa_coef_table.h"
231+};
232+
233+/*
234+ * Gamma Correction Table - Red
235+ */
236+static u32 redgamma_table[] = {
237+#include "redgamma_table.h"
238+};
239+
240+/*
241+ * Gamma Correction Table - Green
242+ */
243+static u32 greengamma_table[] = {
244+#include "greengamma_table.h"
245+};
246+
247+/*
248+ * Gamma Correction Table - Blue
249+ */
250+static u32 bluegamma_table[] = {
251+#include "bluegamma_table.h"
252+};
253+
254+/*
255+ * Noise Filter Threshold table
256+ */
257+static u32 noise_filter_table[] = {
258+#include "noise_filter_table.h"
259+};
260+
261+/*
262+ * Luminance Enhancement Table
263+ */
264+static u32 luma_enhance_table[] = {
265+#include "luma_enhance_table.h"
266+};
267+
268+/**
269+ * omap34xx_isp_preview_config - Abstraction layer Preview configuration.
270+ * @userspace_add: Pointer from Userspace to structure with flags and data to
271+ * update.
272+ **/
273+int omap34xx_isp_preview_config(void *userspace_add)
274+{
275+ struct ispprev_hmed prev_hmed_t;
276+ struct ispprev_cfa prev_cfa_t;
277+ struct ispprev_csup csup_t;
278+ struct ispprev_wbal prev_wbal_t;
279+ struct ispprev_blkadj prev_blkadj_t;
280+ struct ispprev_rgbtorgb rgb2rgb_t;
281+ struct ispprev_csc prev_csc_t;
282+ struct ispprev_yclimit yclimit_t;
283+ struct ispprev_dcor prev_dcor_t;
284+ struct ispprv_update_config *preview_struct;
285+ struct isptables_update isp_table_update;
286+ int yen_t[ISPPRV_YENH_TBL_SIZE];
287+
288+ if (userspace_add == NULL)
289+ return -EINVAL;
290+
291+ preview_struct = userspace_add;
292+
293+ if (ISP_ABS_PREV_LUMAENH & preview_struct->flag) {
294+ if (ISP_ABS_PREV_LUMAENH & preview_struct->update) {
295+ if (copy_from_user(yen_t, preview_struct->yen,
296+ sizeof(yen_t)))
297+ goto err_copy_from_user;
298+ isppreview_config_luma_enhancement(yen_t);
299+ }
300+ params->features |= PREV_LUMA_ENHANCE;
301+ } else if (ISP_ABS_PREV_LUMAENH & preview_struct->update)
302+ params->features &= ~PREV_LUMA_ENHANCE;
303+
304+ if (ISP_ABS_PREV_INVALAW & preview_struct->flag) {
305+ isppreview_enable_invalaw(1);
306+ params->features |= PREV_INVERSE_ALAW;
307+ } else {
308+ isppreview_enable_invalaw(0);
309+ params->features &= ~PREV_INVERSE_ALAW;
310+ }
311+
312+ if (ISP_ABS_PREV_HRZ_MED & preview_struct->flag) {
313+ if (ISP_ABS_PREV_HRZ_MED & preview_struct->update) {
314+ if (copy_from_user(&prev_hmed_t,
315+ (struct ispprev_hmed *)
316+ preview_struct->prev_hmed,
317+ sizeof(struct ispprev_hmed)))
318+ goto err_copy_from_user;
319+ isppreview_config_hmed(prev_hmed_t);
320+ }
321+ isppreview_enable_hmed(1);
322+ params->features |= PREV_HORZ_MEDIAN_FILTER;
323+ } else if (ISP_ABS_PREV_HRZ_MED & preview_struct->update) {
324+ isppreview_enable_hmed(0);
325+ params->features &= ~PREV_HORZ_MEDIAN_FILTER;
326+ }
327+
328+ if (ISP_ABS_PREV_CFA & preview_struct->flag) {
329+ if (ISP_ABS_PREV_CFA & preview_struct->update) {
330+ if (copy_from_user(&prev_cfa_t,
331+ (struct ispprev_cfa *)
332+ preview_struct->prev_cfa,
333+ sizeof(struct ispprev_cfa)))
334+ goto err_copy_from_user;
335+
336+ isppreview_config_cfa(prev_cfa_t);
337+ }
338+ isppreview_enable_cfa(1);
339+ params->features |= PREV_CFA;
340+ } else if (ISP_ABS_PREV_CFA & preview_struct->update) {
341+ isppreview_enable_cfa(0);
342+ params->features &= ~PREV_CFA;
343+ }
344+
345+ if (ISP_ABS_PREV_CHROMA_SUPP & preview_struct->flag) {
346+ if (ISP_ABS_PREV_CHROMA_SUPP & preview_struct->update) {
347+ if (copy_from_user(&csup_t,
348+ (struct ispprev_csup *)
349+ preview_struct->csup,
350+ sizeof(struct ispprev_csup)))
351+ goto err_copy_from_user;
352+ isppreview_config_chroma_suppression(csup_t);
353+ }
354+ isppreview_enable_chroma_suppression(1);
355+ params->features |= PREV_CHROMA_SUPPRESS;
356+ } else if (ISP_ABS_PREV_CHROMA_SUPP & preview_struct->update) {
357+ isppreview_enable_chroma_suppression(0);
358+ params->features &= ~PREV_CHROMA_SUPPRESS;
359+ }
360+
361+ if (ISP_ABS_PREV_WB & preview_struct->update) {
362+ if (copy_from_user(&prev_wbal_t, (struct ispprev_wbal *)
363+ preview_struct->prev_wbal,
364+ sizeof(struct ispprev_wbal)))
365+ goto err_copy_from_user;
366+ isppreview_config_whitebalance(prev_wbal_t);
367+ }
368+
369+ if (ISP_ABS_PREV_BLKADJ & preview_struct->update) {
370+ if (copy_from_user(&prev_blkadj_t, (struct ispprev_blkadjl *)
371+ preview_struct->prev_blkadj,
372+ sizeof(struct ispprev_blkadj)))
373+ goto err_copy_from_user;
374+ isppreview_config_blkadj(prev_blkadj_t);
375+ }
376+
377+ if (ISP_ABS_PREV_RGB2RGB & preview_struct->update) {
378+ if (copy_from_user(&rgb2rgb_t, (struct ispprev_rgbtorgb *)
379+ preview_struct->rgb2rgb,
380+ sizeof(struct ispprev_rgbtorgb)))
381+ goto err_copy_from_user;
382+ isppreview_config_rgb_blending(rgb2rgb_t);
383+ }
384+
385+ if (ISP_ABS_PREV_COLOR_CONV & preview_struct->update) {
386+ if (copy_from_user(&prev_csc_t, (struct ispprev_csc *)
387+ preview_struct->prev_csc,
388+ sizeof(struct ispprev_csc)))
389+ goto err_copy_from_user;
390+ isppreview_config_rgb_to_ycbcr(prev_csc_t);
391+ }
392+
393+ if (ISP_ABS_PREV_YC_LIMIT & preview_struct->update) {
394+ if (copy_from_user(&yclimit_t, (struct ispprev_yclimit *)
395+ preview_struct->yclimit,
396+ sizeof(struct ispprev_yclimit)))
397+ goto err_copy_from_user;
398+ isppreview_config_yc_range(yclimit_t);
399+ }
400+
401+ if (ISP_ABS_PREV_DEFECT_COR & preview_struct->flag) {
402+ if (ISP_ABS_PREV_DEFECT_COR & preview_struct->update) {
403+ if (copy_from_user(&prev_dcor_t,
404+ (struct ispprev_dcor *)
405+ preview_struct->prev_dcor,
406+ sizeof(struct ispprev_dcor)))
407+ goto err_copy_from_user;
408+ isppreview_config_dcor(prev_dcor_t);
409+ }
410+ isppreview_enable_dcor(1);
411+ params->features |= PREV_DEFECT_COR;
412+ } else if (ISP_ABS_PREV_DEFECT_COR & preview_struct->update) {
413+ isppreview_enable_dcor(0);
414+ params->features &= ~PREV_DEFECT_COR;
415+ }
416+
417+ if (ISP_ABS_PREV_GAMMABYPASS & preview_struct->flag) {
418+ isppreview_enable_gammabypass(1);
419+ params->features |= PREV_GAMMA_BYPASS;
420+ } else {
421+ isppreview_enable_gammabypass(0);
422+ params->features &= ~PREV_GAMMA_BYPASS;
423+ }
424+
425+ isp_table_update.update = preview_struct->update;
426+ isp_table_update.flag = preview_struct->flag;
427+ isp_table_update.prev_nf = preview_struct->prev_nf;
428+ isp_table_update.red_gamma = preview_struct->red_gamma;
429+ isp_table_update.green_gamma = preview_struct->green_gamma;
430+ isp_table_update.blue_gamma = preview_struct->blue_gamma;
431+
432+ if (omap34xx_isp_tables_update(&isp_table_update))
433+ goto err_copy_from_user;
434+
435+ return 0;
436+
437+err_copy_from_user:
438+ printk(KERN_ERR "Preview Config: Copy From User Error\n");
439+ return -EFAULT;
440+}
441+EXPORT_SYMBOL_GPL(omap34xx_isp_preview_config);
442+
443+/**
444+ * omap34xx_isp_tables_update - Abstraction layer Tables update.
445+ * @isptables_struct: Pointer from Userspace to structure with flags and table
446+ * data to update.
447+ **/
448+int omap34xx_isp_tables_update(struct isptables_update *isptables_struct)
449+{
450+
451+ if (ISP_ABS_TBL_NF & isptables_struct->flag) {
452+ nf_enable = 1;
453+ params->features |= PREV_NOISE_FILTER;
454+ if (ISP_ABS_TBL_NF & isptables_struct->update) {
455+ if (copy_from_user(&prev_nf_t, (struct ispprev_nf *)
456+ isptables_struct->prev_nf,
457+ sizeof(struct ispprev_nf)))
458+ goto err_copy_from_user;
459+
460+ nf_update = 1;
461+ } else
462+ nf_update = 0;
463+ } else {
464+ nf_enable = 0;
465+ params->features &= ~PREV_NOISE_FILTER;
466+ if (ISP_ABS_TBL_NF & isptables_struct->update)
467+ nf_update = 1;
468+ else
469+ nf_update = 0;
470+ }
471+
472+ if (ISP_ABS_TBL_REDGAMMA & isptables_struct->update) {
473+ if (copy_from_user(redgamma_table, isptables_struct->red_gamma,
474+ sizeof(redgamma_table))) {
475+ goto err_copy_from_user;
476+ }
477+ rg_update = 1;
478+ } else
479+ rg_update = 0;
480+
481+ if (ISP_ABS_TBL_GREENGAMMA & isptables_struct->update) {
482+ if (copy_from_user(greengamma_table,
483+ isptables_struct->green_gamma,
484+ sizeof(greengamma_table)))
485+ goto err_copy_from_user;
486+ gg_update = 1;
487+ } else
488+ gg_update = 0;
489+
490+ if (ISP_ABS_TBL_BLUEGAMMA & isptables_struct->update) {
491+ if (copy_from_user(bluegamma_table,
492+ isptables_struct->blue_gamma,
493+ sizeof(bluegamma_table))) {
494+ goto err_copy_from_user;
495+ }
496+ bg_update = 1;
497+ } else
498+ bg_update = 0;
499+
500+ return 0;
501+
502+err_copy_from_user:
503+ printk(KERN_ERR "Preview Tables:Copy From User Error\n");
504+ return -EFAULT;
505+}
506+
507+/**
508+ * isppreview_config_shadow_registers - Program shadow registers for preview.
509+ *
510+ * Allows user to program shadow registers associated with preview module.
511+ **/
512+void isppreview_config_shadow_registers()
513+{
514+ u8 current_brightness_contrast;
515+ int ctr, prv_disabled;
516+
517+ isppreview_query_brightness(&current_brightness_contrast);
518+ if (current_brightness_contrast !=
519+ (ispprev_obj.brightness * ISPPRV_BRIGHT_UNITS)) {
520+ DPRINTK_ISPPREV(" Changing Brightness level to %d\n",
521+ ispprev_obj.brightness);
522+ isppreview_config_brightness(ispprev_obj.brightness *
523+ ISPPRV_BRIGHT_UNITS);
524+ }
525+
526+ isppreview_query_contrast(&current_brightness_contrast);
527+ if (current_brightness_contrast !=
528+ (ispprev_obj.contrast * ISPPRV_CONTRAST_UNITS)) {
529+ DPRINTK_ISPPREV(" Changing Contrast level to %d\n",
530+ ispprev_obj.contrast);
531+ isppreview_config_contrast(ispprev_obj.contrast *
532+ ISPPRV_CONTRAST_UNITS);
533+ }
534+ if (update_color_matrix) {
535+ isppreview_config_rgb_to_ycbcr(flr_prev_csc[ispprev_obj.color]);
536+ update_color_matrix = 0;
537+ }
538+ if (gg_update || rg_update || bg_update || nf_update) {
539+ isppreview_enable(0);
540+ prv_disabled = 1;
541+ }
542+
543+ if (gg_update) {
544+ isp_reg_writel(ISPPRV_TBL_ADDR_GREEN_G_START,
545+ OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_ADDR);
546+
547+ for (ctr = 0; ctr < ISP_GAMMA_TABLE_SIZE; ctr++) {
548+ isp_reg_writel(greengamma_table[ctr],
549+ OMAP3_ISP_IOMEM_PREV,
550+ ISPPRV_SET_TBL_DATA);
551+ }
552+ gg_update = 0;
553+ }
554+
555+ if (rg_update) {
556+ isp_reg_writel(ISPPRV_TBL_ADDR_RED_G_START,
557+ OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_ADDR);
558+
559+ for (ctr = 0; ctr < ISP_GAMMA_TABLE_SIZE; ctr++) {
560+ isp_reg_writel(redgamma_table[ctr],
561+ OMAP3_ISP_IOMEM_PREV,
562+ ISPPRV_SET_TBL_DATA);
563+ }
564+ rg_update = 0;
565+ }
566+
567+ if (bg_update) {
568+ isp_reg_writel(ISPPRV_TBL_ADDR_BLUE_G_START,
569+ OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_ADDR);
570+
571+ for (ctr = 0; ctr < ISP_GAMMA_TABLE_SIZE; ctr++) {
572+ isp_reg_writel(bluegamma_table[ctr],
573+ OMAP3_ISP_IOMEM_PREV,
574+ ISPPRV_SET_TBL_DATA);
575+ }
576+ bg_update = 0;
577+ }
578+
579+ if (nf_update && nf_enable) {
580+ isp_reg_writel(0xC00,
581+ OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_ADDR);
582+ isp_reg_writel(prev_nf_t.spread,
583+ OMAP3_ISP_IOMEM_PREV, ISPPRV_NF);
584+ for (ctr = 0; ctr < ISPPRV_NF_TBL_SIZE; ctr++) {
585+ isp_reg_writel(prev_nf_t.table[ctr],
586+ OMAP3_ISP_IOMEM_PREV,
587+ ISPPRV_SET_TBL_DATA);
588+ }
589+ isppreview_enable_noisefilter(1);
590+ nf_update = 0;
591+ }
592+
593+ if (~nf_update && nf_enable)
594+ isppreview_enable_noisefilter(1);
595+
596+ if (nf_update && ~nf_enable)
597+ isppreview_enable_noisefilter(0);
598+
599+ if (prv_disabled) {
600+ isppreview_enable(1);
601+ prv_disabled = 0;
602+ }
603+}
604+EXPORT_SYMBOL_GPL(isppreview_config_shadow_registers);
605+
606+/**
607+ * isppreview_request - Reserves the preview module.
608+ *
609+ * Returns 0 if successful, or -EBUSY if the module was already reserved.
610+ **/
611+int isppreview_request()
612+{
613+ mutex_lock(&ispprev_obj.ispprev_mutex);
614+ if (ispprev_obj.prev_inuse) {
615+ mutex_unlock(&ispprev_obj.ispprev_mutex);
616+ printk(KERN_ERR "ISP_ERR : Preview Module Busy\n");
617+ return -EBUSY;
618+ }
619+ ispprev_obj.prev_inuse = 1;
620+ mutex_unlock(&ispprev_obj.ispprev_mutex);
621+ isp_reg_or(OMAP3_ISP_IOMEM_MAIN, ISP_CTRL, ISPCTRL_PREV_RAM_EN |
622+ ISPCTRL_PREV_CLK_EN |
623+ ISPCTRL_SBL_WR1_RAM_EN);
624+ return 0;
625+}
626+EXPORT_SYMBOL_GPL(isppreview_request);
627+
628+/**
629+ * isppreview_free - Frees the preview module.
630+ *
631+ * Returns 0 if successful, or -EINVAL if the module was already freed.
632+ **/
633+int isppreview_free()
634+{
635+ mutex_lock(&ispprev_obj.ispprev_mutex);
636+ if (ispprev_obj.prev_inuse) {
637+ ispprev_obj.prev_inuse = 0;
638+ mutex_unlock(&ispprev_obj.ispprev_mutex);
639+ isp_reg_and(OMAP3_ISP_IOMEM_MAIN, ISP_CTRL,
640+ ~(ISPCTRL_PREV_CLK_EN |
641+ ISPCTRL_PREV_RAM_EN |
642+ ISPCTRL_SBL_WR1_RAM_EN));
643+ return 0;
644+ } else {
645+ mutex_unlock(&ispprev_obj.ispprev_mutex);
646+ DPRINTK_ISPPREV("ISP_ERR : Preview Module already freed\n");
647+ return -EINVAL;
648+ }
649+
650+}
651+EXPORT_SYMBOL_GPL(isppreview_free);
652+
653+/** isppreview_config_datapath - Specifies input and output modules for Preview
654+ * @input: Indicates the module that gives the image to preview.
655+ * @output: Indicates the module to which the preview outputs to.
656+ *
657+ * Configures the default configuration for the CCDC to work with.
658+ *
659+ * The valid values for the input are PRV_RAW_CCDC (0), PRV_RAW_MEM (1),
660+ * PRV_RGBBAYERCFA (2), PRV_COMPCFA (3), PRV_CCDC_DRKF (4), PRV_OTHERS (5).
661+ *
662+ * The valid values for the output are PREVIEW_RSZ (0), PREVIEW_MEM (1).
663+ *
664+ * Returns 0 if successful, or -EINVAL if wrong input or output values are
665+ * specified.
666+ **/
667+int isppreview_config_datapath(enum preview_input input,
668+ enum preview_output output)
669+{
670+ u32 pcr = 0;
671+ u8 enable = 0;
672+ struct prev_params *params = prev_config_params;
673+ struct ispprev_yclimit yclimit;
674+
675+ pcr = isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR);
676+
677+ switch (input) {
678+ case PRV_RAW_CCDC:
679+ pcr &= ~ISPPRV_PCR_SOURCE;
680+ pcr &= ~ISPPRV_PCR_ONESHOT;
681+ ispprev_obj.prev_inpfmt = PRV_RAW_CCDC;
682+ break;
683+ case PRV_RAW_MEM:
684+ pcr |= ISPPRV_PCR_SOURCE;
685+ pcr |= ISPPRV_PCR_ONESHOT;
686+ ispprev_obj.prev_inpfmt = PRV_RAW_MEM;
687+ break;
688+ case PRV_CCDC_DRKF:
689+ pcr |= ISPPRV_PCR_DRKFCAP;
690+ pcr |= ISPPRV_PCR_ONESHOT;
691+ ispprev_obj.prev_inpfmt = PRV_CCDC_DRKF;
692+ break;
693+ case PRV_COMPCFA:
694+ ispprev_obj.prev_inpfmt = PRV_COMPCFA;
695+ break;
696+ case PRV_OTHERS:
697+ ispprev_obj.prev_inpfmt = PRV_OTHERS;
698+ break;
699+ case PRV_RGBBAYERCFA:
700+ ispprev_obj.prev_inpfmt = PRV_RGBBAYERCFA;
701+ break;
702+ default:
703+ printk(KERN_ERR "ISP_ERR : Wrong Input\n");
704+ return -EINVAL;
705+ };
706+
707+ switch (output) {
708+ case PREVIEW_RSZ:
709+ pcr |= ISPPRV_PCR_RSZPORT;
710+ pcr &= ~ISPPRV_PCR_SDRPORT;
711+ break;
712+ case PREVIEW_MEM:
713+ pcr &= ~ISPPRV_PCR_RSZPORT;
714+ pcr |= ISPPRV_PCR_SDRPORT;
715+ break;
716+ default:
717+ printk(KERN_ERR "ISP_ERR : Wrong Output\n");
718+ return -EINVAL;
719+ }
720+ ispprev_obj.prev_outfmt = output;
721+
722+ isp_reg_writel(pcr, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR);
723+
724+ isppreview_config_ycpos(params->pix_fmt);
725+
726+ if (params->cfa.cfa_table != NULL)
727+ isppreview_config_cfa(params->cfa);
728+ if (params->csup.hypf_en == 1)
729+ isppreview_config_chroma_suppression(params->csup);
730+ if (params->ytable != NULL)
731+ isppreview_config_luma_enhancement(params->ytable);
732+
733+ if (params->gtable.redtable != NULL)
734+ isppreview_config_gammacorrn(params->gtable);
735+
736+ enable = (params->features & PREV_CFA) ? 1 : 0;
737+ isppreview_enable_cfa(enable);
738+
739+ enable = (params->features & PREV_CHROMA_SUPPRESS) ? 1 : 0;
740+ isppreview_enable_chroma_suppression(enable);
741+
742+ enable = (params->features & PREV_LUMA_ENHANCE) ? 1 : 0;
743+ isppreview_enable_luma_enhancement(enable);
744+
745+ enable = (params->features & PREV_NOISE_FILTER) ? 1 : 0;
746+ if (enable)
747+ isppreview_config_noisefilter(params->nf);
748+ isppreview_enable_noisefilter(enable);
749+
750+ enable = (params->features & PREV_DEFECT_COR) ? 1 : 0;
751+ if (enable)
752+ isppreview_config_dcor(params->dcor);
753+ isppreview_enable_dcor(enable);
754+
755+ enable = (params->features & PREV_GAMMA_BYPASS) ? 1 : 0;
756+ isppreview_enable_gammabypass(enable);
757+
758+ isppreview_config_whitebalance(params->wbal);
759+ isppreview_config_blkadj(params->blk_adj);
760+ isppreview_config_rgb_blending(params->rgb2rgb);
761+ isppreview_config_rgb_to_ycbcr(params->rgb2ycbcr);
762+
763+ isppreview_config_contrast(params->contrast * ISPPRV_CONTRAST_UNITS);
764+ isppreview_config_brightness(params->brightness * ISPPRV_BRIGHT_UNITS);
765+
766+ yclimit.minC = ISPPRV_YC_MIN;
767+ yclimit.maxC = ISPPRV_YC_MAX;
768+ yclimit.minY = ISPPRV_YC_MIN;
769+ yclimit.maxY = ISPPRV_YC_MAX;
770+ isppreview_config_yc_range(yclimit);
771+
772+ return 0;
773+}
774+EXPORT_SYMBOL_GPL(isppreview_config_datapath);
775+
776+/**
777+ * isppreview_set_skip - Set the number of rows/columns that should be skipped.
778+ * h - Start Pixel Horizontal.
779+ * v - Start Line Vertical.
780+ **/
781+void isppreview_set_skip(u32 h, u32 v)
782+{
783+ ispprev_obj.sph = h;
784+ ispprev_obj.slv = v;
785+}
786+EXPORT_SYMBOL_GPL(isppreview_set_skip);
787+
788+/**
789+ * isppreview_config_ycpos - Configure byte layout of YUV image.
790+ * @mode: Indicates the required byte layout.
791+ **/
792+void isppreview_config_ycpos(enum preview_ycpos_mode mode)
793+{
794+ u32 pcr = isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR);
795+ pcr &= ~ISPPRV_PCR_YCPOS_CrYCbY;
796+ pcr |= (mode << ISPPRV_PCR_YCPOS_SHIFT);
797+ isp_reg_writel(pcr, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR);
798+}
799+EXPORT_SYMBOL_GPL(isppreview_config_ycpos);
800+
801+/**
802+ * isppreview_config_averager - Enable / disable / configure averager
803+ * @average: Average value to be configured.
804+ **/
805+void isppreview_config_averager(u8 average)
806+{
807+ int reg = 0;
808+
809+ reg = AVE_ODD_PIXEL_DIST | AVE_EVEN_PIXEL_DIST | average;
810+ isp_reg_writel(reg, OMAP3_ISP_IOMEM_PREV, ISPPRV_AVE);
811+}
812+EXPORT_SYMBOL_GPL(isppreview_config_averager);
813+
814+/**
815+ * isppreview_enable_invalaw - Enable/Disable Inverse A-Law module in Preview.
816+ * @enable: 1 - Reverse the A-Law done in CCDC.
817+ **/
818+void isppreview_enable_invalaw(u8 enable)
819+{
820+ u32 pcr_val = 0;
821+ pcr_val = isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR);
822+
823+ if (enable) {
824+ isp_reg_writel(pcr_val | ISPPRV_PCR_WIDTH | ISPPRV_PCR_INVALAW,
825+ OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR);
826+ } else {
827+ isp_reg_writel(pcr_val &
828+ ~(ISPPRV_PCR_WIDTH | ISPPRV_PCR_INVALAW),
829+ OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR);
830+ }
831+}
832+EXPORT_SYMBOL_GPL(isppreview_enable_invalaw);
833+
834+/**
835+ * isppreview_enable_drkframe - Enable/Disable of the darkframe subtract.
836+ * @enable: 1 - Acquires memory bandwidth since the pixels in each frame is
837+ * subtracted with the pixels in the current frame.
838+ *
839+ * The proccess is applied for each captured frame.
840+ **/
841+void isppreview_enable_drkframe(u8 enable)
842+{
843+ if (enable)
844+ isp_reg_or(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, ISPPRV_PCR_DRKFEN);
845+ else {
846+ isp_reg_and(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
847+ ~ISPPRV_PCR_DRKFEN);
848+ }
849+}
850+EXPORT_SYMBOL_GPL(isppreview_enable_drkframe);
851+
852+/**
853+ * isppreview_enable_shadcomp - Enables/Disables the shading compensation.
854+ * @enable: 1 - Enables the shading compensation.
855+ *
856+ * If dark frame subtract won't be used, then enable this shading
857+ * compensation.
858+ **/
859+void isppreview_enable_shadcomp(u8 enable)
860+{
861+
862+ if (enable) {
863+ isp_reg_or(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
864+ ISPPRV_PCR_SCOMP_EN);
865+ isppreview_enable_drkframe(1);
866+ } else {
867+ isp_reg_and(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
868+ ~ISPPRV_PCR_SCOMP_EN);
869+ }
870+}
871+EXPORT_SYMBOL_GPL(isppreview_enable_shadcomp);
872+
873+/**
874+ * isppreview_config_drkf_shadcomp - Configures shift value in shading comp.
875+ * @scomp_shtval: 3bit value of shift used in shading compensation.
876+ **/
877+void isppreview_config_drkf_shadcomp(u8 scomp_shtval)
878+{
879+ u32 pcr_val = isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR);
880+
881+ pcr_val &= ISPPRV_PCR_SCOMP_SFT_MASK;
882+ isp_reg_writel(pcr_val | (scomp_shtval << ISPPRV_PCR_SCOMP_SFT_SHIFT),
883+ OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR);
884+}
885+EXPORT_SYMBOL_GPL(isppreview_config_drkf_shadcomp);
886+
887+/**
888+ * isppreview_enable_hmed - Enables/Disables of the Horizontal Median Filter.
889+ * @enable: 1 - Enables Horizontal Median Filter.
890+ **/
891+void isppreview_enable_hmed(u8 enable)
892+{
893+ if (enable)
894+ isp_reg_or(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, ISPPRV_PCR_HMEDEN);
895+ else {
896+ isp_reg_and(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
897+ ~ISPPRV_PCR_HMEDEN);
898+ }
899+ ispprev_obj.hmed_en = enable ? 1 : 0;
900+}
901+EXPORT_SYMBOL_GPL(isppreview_enable_hmed);
902+
903+/**
904+ * isppreview_config_hmed - Configures the Horizontal Median Filter.
905+ * @prev_hmed: Structure containing the odd and even distance between the
906+ * pixels in the image along with the filter threshold.
907+ **/
908+void isppreview_config_hmed(struct ispprev_hmed prev_hmed)
909+{
910+
911+ u32 odddist = 0;
912+ u32 evendist = 0;
913+
914+ if (prev_hmed.odddist == 1)
915+ odddist = ~ISPPRV_HMED_ODDDIST;
916+ else
917+ odddist = ISPPRV_HMED_ODDDIST;
918+
919+ if (prev_hmed.evendist == 1)
920+ evendist = ~ISPPRV_HMED_EVENDIST;
921+ else
922+ evendist = ISPPRV_HMED_EVENDIST;
923+
924+ isp_reg_writel(odddist | evendist | (prev_hmed.thres <<
925+ ISPPRV_HMED_THRESHOLD_SHIFT),
926+ OMAP3_ISP_IOMEM_PREV, ISPPRV_HMED);
927+
928+}
929+EXPORT_SYMBOL_GPL(isppreview_config_hmed);
930+
931+/**
932+ * isppreview_config_noisefilter - Configures the Noise Filter.
933+ * @prev_nf: Structure containing the noisefilter table, strength to be used
934+ * for the noise filter and the defect correction enable flag.
935+ **/
936+void isppreview_config_noisefilter(struct ispprev_nf prev_nf)
937+{
938+ int i = 0;
939+
940+ isp_reg_writel(prev_nf.spread, OMAP3_ISP_IOMEM_PREV, ISPPRV_NF);
941+ isp_reg_writel(ISPPRV_NF_TABLE_ADDR, OMAP3_ISP_IOMEM_PREV,
942+ ISPPRV_SET_TBL_ADDR);
943+ for (i = 0; i < ISPPRV_NF_TBL_SIZE; i++) {
944+ isp_reg_writel(prev_nf.table[i], OMAP3_ISP_IOMEM_PREV,
945+ ISPPRV_SET_TBL_DATA);
946+ }
947+}
948+EXPORT_SYMBOL_GPL(isppreview_config_noisefilter);
949+
950+/**
951+ * isppreview_config_dcor - Configures the defect correction
952+ * @prev_nf: Structure containing the defect correction structure
953+ **/
954+void isppreview_config_dcor(struct ispprev_dcor prev_dcor)
955+{
956+ if (prev_dcor.couplet_mode_en) {
957+ isp_reg_writel(prev_dcor.detect_correct[0],
958+ OMAP3_ISP_IOMEM_PREV, ISPPRV_CDC_THR0);
959+ isp_reg_writel(prev_dcor.detect_correct[1],
960+ OMAP3_ISP_IOMEM_PREV, ISPPRV_CDC_THR1);
961+ isp_reg_writel(prev_dcor.detect_correct[2],
962+ OMAP3_ISP_IOMEM_PREV, ISPPRV_CDC_THR2);
963+ isp_reg_writel(prev_dcor.detect_correct[3],
964+ OMAP3_ISP_IOMEM_PREV, ISPPRV_CDC_THR3);
965+ isp_reg_or(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, ISPPRV_PCR_DCCOUP);
966+ } else {
967+ isp_reg_and(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
968+ ~ISPPRV_PCR_DCCOUP);
969+ }
970+}
971+EXPORT_SYMBOL_GPL(isppreview_config_dcor);
972+
973+/**
974+ * isppreview_config_cfa - Configures the CFA Interpolation parameters.
975+ * @prev_cfa: Structure containing the CFA interpolation table, CFA format
976+ * in the image, vertical and horizontal gradient threshold.
977+ **/
978+void isppreview_config_cfa(struct ispprev_cfa prev_cfa)
979+{
980+ int i = 0;
981+
982+ ispprev_obj.cfafmt = prev_cfa.cfafmt;
983+
984+ isp_reg_or(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
985+ (prev_cfa.cfafmt << ISPPRV_PCR_CFAFMT_SHIFT));
986+
987+ isp_reg_writel(
988+ (prev_cfa.cfa_gradthrs_vert << ISPPRV_CFA_GRADTH_VER_SHIFT) |
989+ (prev_cfa.cfa_gradthrs_horz << ISPPRV_CFA_GRADTH_HOR_SHIFT),
990+ OMAP3_ISP_IOMEM_PREV, ISPPRV_CFA);
991+
992+ isp_reg_writel(ISPPRV_CFA_TABLE_ADDR, OMAP3_ISP_IOMEM_PREV,
993+ ISPPRV_SET_TBL_ADDR);
994+
995+ for (i = 0; i < ISPPRV_CFA_TBL_SIZE; i++) {
996+ isp_reg_writel(prev_cfa.cfa_table[i],
997+ OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_DATA);
998+ }
999+}
1000+EXPORT_SYMBOL_GPL(isppreview_config_cfa);
1001+
1002+/**
1003+ * isppreview_config_gammacorrn - Configures the Gamma Correction table values
1004+ * @gtable: Structure containing the table for red, blue, green gamma table.
1005+ **/
1006+void isppreview_config_gammacorrn(struct ispprev_gtable gtable)
1007+{
1008+ int i = 0;
1009+
1010+ isp_reg_writel(ISPPRV_REDGAMMA_TABLE_ADDR,
1011+ OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_ADDR);
1012+ for (i = 0; i < ISPPRV_GAMMA_TBL_SIZE; i++) {
1013+ isp_reg_writel(gtable.redtable[i],
1014+ OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_DATA);
1015+ }
1016+
1017+ isp_reg_writel(ISPPRV_GREENGAMMA_TABLE_ADDR,
1018+ OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_ADDR);
1019+ for (i = 0; i < ISPPRV_GAMMA_TBL_SIZE; i++) {
1020+ isp_reg_writel(gtable.greentable[i],
1021+ OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_DATA);
1022+ }
1023+
1024+ isp_reg_writel(ISPPRV_BLUEGAMMA_TABLE_ADDR,
1025+ OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_ADDR);
1026+ for (i = 0; i < ISPPRV_GAMMA_TBL_SIZE; i++) {
1027+ isp_reg_writel(gtable.bluetable[i],
1028+ OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_DATA);
1029+ }
1030+}
1031+EXPORT_SYMBOL_GPL(isppreview_config_gammacorrn);
1032+
1033+/**
1034+ * isppreview_config_luma_enhancement - Sets the Luminance Enhancement table.
1035+ * @ytable: Structure containing the table for Luminance Enhancement table.
1036+ **/
1037+void isppreview_config_luma_enhancement(u32 *ytable)
1038+{
1039+ int i = 0;
1040+
1041+ isp_reg_writel(ISPPRV_YENH_TABLE_ADDR,
1042+ OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_ADDR);
1043+ for (i = 0; i < ISPPRV_YENH_TBL_SIZE; i++) {
1044+ isp_reg_writel(ytable[i],
1045+ OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_DATA);
1046+ }
1047+}
1048+EXPORT_SYMBOL_GPL(isppreview_config_luma_enhancement);
1049+
1050+/**
1051+ * isppreview_config_chroma_suppression - Configures the Chroma Suppression.
1052+ * @csup: Structure containing the threshold value for suppression
1053+ * and the hypass filter enable flag.
1054+ **/
1055+void isppreview_config_chroma_suppression(struct ispprev_csup csup)
1056+{
1057+ isp_reg_writel(csup.gain | (csup.thres << ISPPRV_CSUP_THRES_SHIFT) |
1058+ (csup.hypf_en << ISPPRV_CSUP_HPYF_SHIFT),
1059+ OMAP3_ISP_IOMEM_PREV, ISPPRV_CSUP);
1060+}
1061+EXPORT_SYMBOL_GPL(isppreview_config_chroma_suppression);
1062+
1063+/**
1064+ * isppreview_enable_noisefilter - Enables/Disables the Noise Filter.
1065+ * @enable: 1 - Enables the Noise Filter.
1066+ **/
1067+void isppreview_enable_noisefilter(u8 enable)
1068+{
1069+ if (enable)
1070+ isp_reg_or(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, ISPPRV_PCR_NFEN);
1071+ else
1072+ isp_reg_and(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, ~ISPPRV_PCR_NFEN);
1073+ ispprev_obj.nf_en = enable ? 1 : 0;
1074+}
1075+EXPORT_SYMBOL_GPL(isppreview_enable_noisefilter);
1076+
1077+/**
1078+ * isppreview_enable_dcor - Enables/Disables the defect correction.
1079+ * @enable: 1 - Enables the defect correction.
1080+ **/
1081+void isppreview_enable_dcor(u8 enable)
1082+{
1083+ if (enable)
1084+ isp_reg_or(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, ISPPRV_PCR_DCOREN);
1085+ else {
1086+ isp_reg_and(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
1087+ ~ISPPRV_PCR_DCOREN);
1088+ }
1089+ ispprev_obj.dcor_en = enable ? 1 : 0;
1090+}
1091+EXPORT_SYMBOL_GPL(isppreview_enable_dcor);
1092+
1093+/**
1094+ * isppreview_enable_cfa - Enable/Disable the CFA Interpolation.
1095+ * @enable: 1 - Enables the CFA.
1096+ **/
1097+void isppreview_enable_cfa(u8 enable)
1098+{
1099+ if (enable)
1100+ isp_reg_or(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, ISPPRV_PCR_CFAEN);
1101+ else {
1102+ isp_reg_and(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
1103+ ~ISPPRV_PCR_CFAEN);
1104+ }
1105+ ispprev_obj.cfa_en = enable ? 1 : 0;
1106+}
1107+EXPORT_SYMBOL_GPL(isppreview_enable_cfa);
1108+
1109+/**
1110+ * isppreview_enable_gammabypass - Enables/Disables the GammaByPass
1111+ * @enable: 1 - Bypasses Gamma - 10bit input is cropped to 8MSB.
1112+ * 0 - Goes through Gamma Correction. input and output is 10bit.
1113+ **/
1114+void isppreview_enable_gammabypass(u8 enable)
1115+{
1116+ if (enable) {
1117+ isp_reg_or(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
1118+ ISPPRV_PCR_GAMMA_BYPASS);
1119+ } else {
1120+ isp_reg_and(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
1121+ ~ISPPRV_PCR_GAMMA_BYPASS);
1122+ }
1123+}
1124+EXPORT_SYMBOL_GPL(isppreview_enable_gammabypass);
1125+
1126+/**
1127+ * isppreview_enable_luma_enhancement - Enables/Disables Luminance Enhancement
1128+ * @enable: 1 - Enable the Luminance Enhancement.
1129+ **/
1130+void isppreview_enable_luma_enhancement(u8 enable)
1131+{
1132+ if (enable) {
1133+ isp_reg_or(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
1134+ ISPPRV_PCR_YNENHEN);
1135+ } else {
1136+ isp_reg_and(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
1137+ ~ISPPRV_PCR_YNENHEN);
1138+ }
1139+ ispprev_obj.yenh_en = enable ? 1 : 0;
1140+}
1141+EXPORT_SYMBOL_GPL(isppreview_enable_luma_enhancement);
1142+
1143+/**
1144+ * isppreview_enable_chroma_suppression - Enables/Disables Chrominance Suppr.
1145+ * @enable: 1 - Enable the Chrominance Suppression.
1146+ **/
1147+void isppreview_enable_chroma_suppression(u8 enable)
1148+{
1149+ if (enable)
1150+ isp_reg_or(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, ISPPRV_PCR_SUPEN);
1151+ else {
1152+ isp_reg_and(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
1153+ ~ISPPRV_PCR_SUPEN);
1154+ }
1155+ ispprev_obj.csup_en = enable ? 1 : 0;
1156+}
1157+EXPORT_SYMBOL_GPL(isppreview_enable_chroma_suppression);
1158+
1159+/**
1160+ * isppreview_config_whitebalance - Configures the White Balance parameters.
1161+ * @prev_wbal: Structure containing the digital gain and white balance
1162+ * coefficient.
1163+ *
1164+ * Coefficient matrix always with default values.
1165+ **/
1166+void isppreview_config_whitebalance(struct ispprev_wbal prev_wbal)
1167+{
1168+ u32 val;
1169+
1170+ isp_reg_writel(prev_wbal.dgain, OMAP3_ISP_IOMEM_PREV, ISPPRV_WB_DGAIN);
1171+
1172+ val = prev_wbal.coef0 << ISPPRV_WBGAIN_COEF0_SHIFT;
1173+ val |= prev_wbal.coef1 << ISPPRV_WBGAIN_COEF1_SHIFT;
1174+ val |= prev_wbal.coef2 << ISPPRV_WBGAIN_COEF2_SHIFT;
1175+ val |= prev_wbal.coef3 << ISPPRV_WBGAIN_COEF3_SHIFT;
1176+ isp_reg_writel(val, OMAP3_ISP_IOMEM_PREV, ISPPRV_WBGAIN);
1177+
1178+ isp_reg_writel(ISPPRV_WBSEL_COEF0 << ISPPRV_WBSEL_N0_0_SHIFT |
1179+ ISPPRV_WBSEL_COEF1 << ISPPRV_WBSEL_N0_1_SHIFT |
1180+ ISPPRV_WBSEL_COEF0 << ISPPRV_WBSEL_N0_2_SHIFT |
1181+ ISPPRV_WBSEL_COEF1 << ISPPRV_WBSEL_N0_3_SHIFT |
1182+ ISPPRV_WBSEL_COEF2 << ISPPRV_WBSEL_N1_0_SHIFT |
1183+ ISPPRV_WBSEL_COEF3 << ISPPRV_WBSEL_N1_1_SHIFT |
1184+ ISPPRV_WBSEL_COEF2 << ISPPRV_WBSEL_N1_2_SHIFT |
1185+ ISPPRV_WBSEL_COEF3 << ISPPRV_WBSEL_N1_3_SHIFT |
1186+ ISPPRV_WBSEL_COEF0 << ISPPRV_WBSEL_N2_0_SHIFT |
1187+ ISPPRV_WBSEL_COEF1 << ISPPRV_WBSEL_N2_1_SHIFT |
1188+ ISPPRV_WBSEL_COEF0 << ISPPRV_WBSEL_N2_2_SHIFT |
1189+ ISPPRV_WBSEL_COEF1 << ISPPRV_WBSEL_N2_3_SHIFT |
1190+ ISPPRV_WBSEL_COEF2 << ISPPRV_WBSEL_N3_0_SHIFT |
1191+ ISPPRV_WBSEL_COEF3 << ISPPRV_WBSEL_N3_1_SHIFT |
1192+ ISPPRV_WBSEL_COEF2 << ISPPRV_WBSEL_N3_2_SHIFT |
1193+ ISPPRV_WBSEL_COEF3 << ISPPRV_WBSEL_N3_3_SHIFT,
1194+ OMAP3_ISP_IOMEM_PREV, ISPPRV_WBSEL);
1195+}
1196+EXPORT_SYMBOL_GPL(isppreview_config_whitebalance);
1197+
1198+/**
1199+ * isppreview_config_whitebalance2 - Configures the White Balance parameters.
1200+ * @prev_wbal: Structure containing the digital gain and white balance
1201+ * coefficient.
1202+ *
1203+ * Coefficient matrix can be changed.
1204+ **/
1205+void isppreview_config_whitebalance2(struct prev_white_balance prev_wbal)
1206+{
1207+ isp_reg_writel(prev_wbal.wb_dgain,
1208+ OMAP3_ISP_IOMEM_PREV, ISPPRV_WB_DGAIN);
1209+ isp_reg_writel(prev_wbal.wb_gain[0] |
1210+ prev_wbal.wb_gain[1] << ISPPRV_WBGAIN_COEF1_SHIFT |
1211+ prev_wbal.wb_gain[2] << ISPPRV_WBGAIN_COEF2_SHIFT |
1212+ prev_wbal.wb_gain[3] << ISPPRV_WBGAIN_COEF3_SHIFT,
1213+ OMAP3_ISP_IOMEM_PREV, ISPPRV_WBGAIN);
1214+
1215+ isp_reg_writel(
1216+ prev_wbal.wb_coefmatrix[0][0] << ISPPRV_WBSEL_N0_0_SHIFT |
1217+ prev_wbal.wb_coefmatrix[0][1] << ISPPRV_WBSEL_N0_1_SHIFT |
1218+ prev_wbal.wb_coefmatrix[0][2] << ISPPRV_WBSEL_N0_2_SHIFT |
1219+ prev_wbal.wb_coefmatrix[0][3] << ISPPRV_WBSEL_N0_3_SHIFT |
1220+ prev_wbal.wb_coefmatrix[1][0] << ISPPRV_WBSEL_N1_0_SHIFT |
1221+ prev_wbal.wb_coefmatrix[1][1] << ISPPRV_WBSEL_N1_1_SHIFT |
1222+ prev_wbal.wb_coefmatrix[1][2] << ISPPRV_WBSEL_N1_2_SHIFT |
1223+ prev_wbal.wb_coefmatrix[1][3] << ISPPRV_WBSEL_N1_3_SHIFT |
1224+ prev_wbal.wb_coefmatrix[2][0] << ISPPRV_WBSEL_N2_0_SHIFT |
1225+ prev_wbal.wb_coefmatrix[2][1] << ISPPRV_WBSEL_N2_1_SHIFT |
1226+ prev_wbal.wb_coefmatrix[2][2] << ISPPRV_WBSEL_N2_2_SHIFT |
1227+ prev_wbal.wb_coefmatrix[2][3] << ISPPRV_WBSEL_N2_3_SHIFT |
1228+ prev_wbal.wb_coefmatrix[3][0] << ISPPRV_WBSEL_N3_0_SHIFT |
1229+ prev_wbal.wb_coefmatrix[3][1] << ISPPRV_WBSEL_N3_1_SHIFT |
1230+ prev_wbal.wb_coefmatrix[3][2] << ISPPRV_WBSEL_N3_2_SHIFT |
1231+ prev_wbal.wb_coefmatrix[3][3] << ISPPRV_WBSEL_N3_3_SHIFT,
1232+ OMAP3_ISP_IOMEM_PREV, ISPPRV_WBSEL);
1233+}
1234+EXPORT_SYMBOL_GPL(isppreview_config_whitebalance2);
1235+
1236+/**
1237+ * isppreview_config_blkadj - Configures the Black Adjustment parameters.
1238+ * @prev_blkadj: Structure containing the black adjustment towards red, green,
1239+ * blue.
1240+ **/
1241+void isppreview_config_blkadj(struct ispprev_blkadj prev_blkadj)
1242+{
1243+ isp_reg_writel(prev_blkadj.blue |
1244+ (prev_blkadj.green << ISPPRV_BLKADJOFF_G_SHIFT) |
1245+ (prev_blkadj.red << ISPPRV_BLKADJOFF_R_SHIFT),
1246+ OMAP3_ISP_IOMEM_PREV, ISPPRV_BLKADJOFF);
1247+}
1248+EXPORT_SYMBOL_GPL(isppreview_config_blkadj);
1249+
1250+/**
1251+ * isppreview_config_rgb_blending - Configures the RGB-RGB Blending matrix.
1252+ * @rgb2rgb: Structure containing the rgb to rgb blending matrix and the rgb
1253+ * offset.
1254+ **/
1255+void isppreview_config_rgb_blending(struct ispprev_rgbtorgb rgb2rgb)
1256+{
1257+ u32 val = 0;
1258+
1259+ val = (rgb2rgb.matrix[0][0] & 0xfff) << ISPPRV_RGB_MAT1_MTX_RR_SHIFT;
1260+ val |= (rgb2rgb.matrix[0][1] & 0xfff) << ISPPRV_RGB_MAT1_MTX_GR_SHIFT;
1261+ isp_reg_writel(val, OMAP3_ISP_IOMEM_PREV, ISPPRV_RGB_MAT1);
1262+
1263+ val = (rgb2rgb.matrix[0][2] & 0xfff) << ISPPRV_RGB_MAT2_MTX_BR_SHIFT;
1264+ val |= (rgb2rgb.matrix[1][0] & 0xfff) << ISPPRV_RGB_MAT2_MTX_RG_SHIFT;
1265+ isp_reg_writel(val, OMAP3_ISP_IOMEM_PREV, ISPPRV_RGB_MAT2);
1266+
1267+ val = (rgb2rgb.matrix[1][1] & 0xfff) << ISPPRV_RGB_MAT3_MTX_GG_SHIFT;
1268+ val |= (rgb2rgb.matrix[1][2] & 0xfff) << ISPPRV_RGB_MAT3_MTX_BG_SHIFT;
1269+ isp_reg_writel(val, OMAP3_ISP_IOMEM_PREV, ISPPRV_RGB_MAT3);
1270+
1271+ val = (rgb2rgb.matrix[2][0] & 0xfff) << ISPPRV_RGB_MAT4_MTX_RB_SHIFT;
1272+ val |= (rgb2rgb.matrix[2][1] & 0xfff) << ISPPRV_RGB_MAT4_MTX_GB_SHIFT;
1273+ isp_reg_writel(val, OMAP3_ISP_IOMEM_PREV, ISPPRV_RGB_MAT4);
1274+
1275+ val = (rgb2rgb.matrix[2][2] & 0xfff) << ISPPRV_RGB_MAT5_MTX_BB_SHIFT;
1276+ isp_reg_writel(val, OMAP3_ISP_IOMEM_PREV, ISPPRV_RGB_MAT5);
1277+
1278+ val = (rgb2rgb.offset[0] & 0x3ff) << ISPPRV_RGB_OFF1_MTX_OFFG_SHIFT;
1279+ val |= (rgb2rgb.offset[1] & 0x3ff) << ISPPRV_RGB_OFF1_MTX_OFFR_SHIFT;
1280+ isp_reg_writel(val, OMAP3_ISP_IOMEM_PREV, ISPPRV_RGB_OFF1);
1281+
1282+ val = (rgb2rgb.offset[2] & 0x3ff) << ISPPRV_RGB_OFF2_MTX_OFFB_SHIFT;
1283+ isp_reg_writel(val, OMAP3_ISP_IOMEM_PREV, ISPPRV_RGB_OFF2);
1284+}
1285+EXPORT_SYMBOL_GPL(isppreview_config_rgb_blending);
1286+
1287+/**
1288+ * Configures the RGB-YCbYCr conversion matrix
1289+ * @prev_csc: Structure containing the RGB to YCbYCr matrix and the
1290+ * YCbCr offset.
1291+ **/
1292+void isppreview_config_rgb_to_ycbcr(struct ispprev_csc prev_csc)
1293+{
1294+ u32 val = 0;
1295+
1296+ val = (prev_csc.matrix[0][0] & 0x3ff) << ISPPRV_CSC0_RY_SHIFT;
1297+ val |= (prev_csc.matrix[0][1] & 0x3ff) << ISPPRV_CSC0_GY_SHIFT;
1298+ val |= (prev_csc.matrix[0][2] & 0x3ff) << ISPPRV_CSC0_BY_SHIFT;
1299+ isp_reg_writel(val, OMAP3_ISP_IOMEM_PREV, ISPPRV_CSC0);
1300+
1301+ val = (prev_csc.matrix[1][0] & 0x3ff) << ISPPRV_CSC1_RCB_SHIFT;
1302+ val |= (prev_csc.matrix[1][1] & 0x3ff) << ISPPRV_CSC1_GCB_SHIFT;
1303+ val |= (prev_csc.matrix[1][2] & 0x3ff) << ISPPRV_CSC1_BCB_SHIFT;
1304+ isp_reg_writel(val, OMAP3_ISP_IOMEM_PREV, ISPPRV_CSC1);
1305+
1306+ val = (prev_csc.matrix[2][0] & 0x3ff) << ISPPRV_CSC2_RCR_SHIFT;
1307+ val |= (prev_csc.matrix[2][1] & 0x3ff) << ISPPRV_CSC2_GCR_SHIFT;
1308+ val |= (prev_csc.matrix[2][2] & 0x3ff) << ISPPRV_CSC2_BCR_SHIFT;
1309+ isp_reg_writel(val, OMAP3_ISP_IOMEM_PREV, ISPPRV_CSC2);
1310+
1311+ val = (prev_csc.offset[0] & 0xff) << ISPPRV_CSC_OFFSET_CR_SHIFT;
1312+ val |= (prev_csc.offset[1] & 0xff) << ISPPRV_CSC_OFFSET_CB_SHIFT;
1313+ val |= (prev_csc.offset[2] & 0xff) << ISPPRV_CSC_OFFSET_Y_SHIFT;
1314+ isp_reg_writel(val, OMAP3_ISP_IOMEM_PREV, ISPPRV_CSC_OFFSET);
1315+}
1316+EXPORT_SYMBOL_GPL(isppreview_config_rgb_to_ycbcr);
1317+
1318+/**
1319+ * isppreview_query_contrast - Query the contrast.
1320+ * @contrast: Pointer to hold the current programmed contrast value.
1321+ **/
1322+void isppreview_query_contrast(u8 *contrast)
1323+{
1324+ u32 brt_cnt_val = 0;
1325+
1326+ brt_cnt_val = isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_CNT_BRT);
1327+ *contrast = (brt_cnt_val >> ISPPRV_CNT_BRT_CNT_SHIFT) & 0xff;
1328+ DPRINTK_ISPPREV(" Current brt cnt value in hw is %x\n", brt_cnt_val);
1329+}
1330+EXPORT_SYMBOL_GPL(isppreview_query_contrast);
1331+
1332+/**
1333+ * isppreview_update_contrast - Updates the contrast.
1334+ * @contrast: Pointer to hold the current programmed contrast value.
1335+ *
1336+ * Value should be programmed before enabling the module.
1337+ **/
1338+void isppreview_update_contrast(u8 *contrast)
1339+{
1340+ ispprev_obj.contrast = *contrast;
1341+}
1342+EXPORT_SYMBOL_GPL(isppreview_update_contrast);
1343+
1344+/**
1345+ * isppreview_config_contrast - Configures the Contrast.
1346+ * @contrast: 8 bit value in U8Q4 format.
1347+ *
1348+ * Value should be programmed before enabling the module.
1349+ **/
1350+void isppreview_config_contrast(u8 contrast)
1351+{
1352+ u32 brt_cnt_val = 0;
1353+
1354+ brt_cnt_val = isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_CNT_BRT);
1355+ brt_cnt_val &= ~(0xff << ISPPRV_CNT_BRT_CNT_SHIFT);
1356+ contrast &= 0xff;
1357+ isp_reg_writel(brt_cnt_val | contrast << ISPPRV_CNT_BRT_CNT_SHIFT,
1358+ OMAP3_ISP_IOMEM_PREV, ISPPRV_CNT_BRT);
1359+}
1360+EXPORT_SYMBOL_GPL(isppreview_config_contrast);
1361+
1362+/**
1363+ * isppreview_get_contrast_range - Gets the range contrast value.
1364+ * @min_contrast: Pointer to hold the minimum Contrast value.
1365+ * @max_contrast: Pointer to hold the maximum Contrast value.
1366+ **/
1367+void isppreview_get_contrast_range(u8 *min_contrast, u8 *max_contrast)
1368+{
1369+ *min_contrast = ISPPRV_CONTRAST_MIN;
1370+ *max_contrast = ISPPRV_CONTRAST_MAX;
1371+}
1372+EXPORT_SYMBOL_GPL(isppreview_get_contrast_range);
1373+
1374+/**
1375+ * isppreview_update_brightness - Updates the brightness in preview module.
1376+ * @brightness: Pointer to hold the current programmed brightness value.
1377+ *
1378+ **/
1379+void isppreview_update_brightness(u8 *brightness)
1380+{
1381+ ispprev_obj.brightness = *brightness;
1382+}
1383+EXPORT_SYMBOL_GPL(isppreview_update_brightness);
1384+
1385+/**
1386+ * isppreview_config_brightness - Configures the brightness.
1387+ * @contrast: 8bitvalue in U8Q0 format.
1388+ **/
1389+void isppreview_config_brightness(u8 brightness)
1390+{
1391+ u32 brt_cnt_val = 0;
1392+
1393+ DPRINTK_ISPPREV("\tConfiguring brightness in ISP: %d\n", brightness);
1394+ brt_cnt_val = isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_CNT_BRT);
1395+ brt_cnt_val &= ~(0xff << ISPPRV_CNT_BRT_BRT_SHIFT);
1396+ brightness &= 0xff;
1397+ isp_reg_writel(brt_cnt_val | brightness << ISPPRV_CNT_BRT_BRT_SHIFT,
1398+ OMAP3_ISP_IOMEM_PREV, ISPPRV_CNT_BRT);
1399+}
1400+EXPORT_SYMBOL_GPL(isppreview_config_brightness);
1401+
1402+/**
1403+ * isppreview_query_brightness - Query the brightness.
1404+ * @brightness: Pointer to hold the current programmed brightness value.
1405+ **/
1406+void isppreview_query_brightness(u8 *brightness)
1407+{
1408+ *brightness = isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_CNT_BRT);
1409+}
1410+EXPORT_SYMBOL_GPL(isppreview_query_brightness);
1411+
1412+/**
1413+ * isppreview_get_brightness_range - Gets the range brightness value
1414+ * @min_brightness: Pointer to hold the minimum brightness value
1415+ * @max_brightness: Pointer to hold the maximum brightness value
1416+ **/
1417+void isppreview_get_brightness_range(u8 *min_brightness, u8 *max_brightness)
1418+{
1419+ *min_brightness = ISPPRV_BRIGHT_MIN;
1420+ *max_brightness = ISPPRV_BRIGHT_MAX;
1421+}
1422+EXPORT_SYMBOL_GPL(isppreview_get_brightness_range);
1423+
1424+/**
1425+ * isppreview_set_color - Sets the color effect.
1426+ * @mode: Indicates the required color effect.
1427+ **/
1428+void isppreview_set_color(u8 *mode)
1429+{
1430+ ispprev_obj.color = *mode;
1431+ update_color_matrix = 1;
1432+}
1433+EXPORT_SYMBOL_GPL(isppreview_set_color);
1434+
1435+/**
1436+ * isppreview_get_color - Gets the current color effect.
1437+ * @mode: Indicates the current color effect.
1438+ **/
1439+void isppreview_get_color(u8 *mode)
1440+{
1441+ *mode = ispprev_obj.color;
1442+}
1443+EXPORT_SYMBOL_GPL(isppreview_get_color);
1444+
1445+/**
1446+ * isppreview_config_yc_range - Configures the max and min Y and C values.
1447+ * @yclimit: Structure containing the range of Y and C values.
1448+ **/
1449+void isppreview_config_yc_range(struct ispprev_yclimit yclimit)
1450+{
1451+ isp_reg_writel(yclimit.maxC << ISPPRV_SETUP_YC_MAXC_SHIFT |
1452+ yclimit.maxY << ISPPRV_SETUP_YC_MAXY_SHIFT |
1453+ yclimit.minC << ISPPRV_SETUP_YC_MINC_SHIFT |
1454+ yclimit.minY << ISPPRV_SETUP_YC_MINY_SHIFT,
1455+ OMAP3_ISP_IOMEM_PREV, ISPPRV_SETUP_YC);
1456+}
1457+EXPORT_SYMBOL_GPL(isppreview_config_yc_range);
1458+
1459+/**
1460+ * isppreview_try_size - Calculates output dimensions with the modules enabled.
1461+ * @input_w: input width for the preview in number of pixels per line
1462+ * @input_h: input height for the preview in number of lines
1463+ * @output_w: output width from the preview in number of pixels per line
1464+ * @output_h: output height for the preview in number of lines
1465+ *
1466+ * Calculates the number of pixels cropped in the submodules that are enabled,
1467+ * Fills up the output width height variables in the isp_prev structure.
1468+ **/
1469+int isppreview_try_size(u32 input_w, u32 input_h, u32 *output_w, u32 *output_h)
1470+{
1471+ u32 prevout_w = input_w;
1472+ u32 prevout_h = input_h;
1473+ u32 div = 0;
1474+ int max_out;
1475+
1476+ ispprev_obj.previn_w = input_w;
1477+ ispprev_obj.previn_h = input_h;
1478+
1479+ if (input_w < 32 || input_h < 32) {
1480+ printk(KERN_ERR "ISP_ERR : preview does not support "
1481+ "width < 16 or height < 32 \n");
1482+ return -EINVAL;
1483+ }
1484+ if (omap_rev() == OMAP3430_REV_ES1_0)
1485+ max_out = ISPPRV_MAXOUTPUT_WIDTH;
1486+ else
1487+ max_out = ISPPRV_MAXOUTPUT_WIDTH_ES2;
1488+
1489+ ispprev_obj.fmtavg = 0;
1490+
1491+ if (input_w > max_out) {
1492+ div = (input_w/max_out);
1493+ if (div >= 2 && div < 4) {
1494+ ispprev_obj.fmtavg = 1;
1495+ prevout_w /= 2;
1496+ } else if (div >= 4 && div < 8) {
1497+ ispprev_obj.fmtavg = 2;
1498+ prevout_w /= 4;
1499+ } else if (div >= 8) {
1500+ ispprev_obj.fmtavg = 3;
1501+ prevout_w /= 8;
1502+ }
1503+ }
1504+
1505+ if (ispprev_obj.hmed_en)
1506+ prevout_w -= 4;
1507+ if (ispprev_obj.nf_en) {
1508+ prevout_w -= 4;
1509+ prevout_h -= 4;
1510+ }
1511+ if (ispprev_obj.cfa_en) {
1512+ switch (ispprev_obj.cfafmt) {
1513+ case CFAFMT_BAYER:
1514+ case CFAFMT_SONYVGA:
1515+ prevout_w -= 4;
1516+ prevout_h -= 4;
1517+ break;
1518+ case CFAFMT_RGBFOVEON:
1519+ case CFAFMT_RRGGBBFOVEON:
1520+ case CFAFMT_DNSPL:
1521+ case CFAFMT_HONEYCOMB:
1522+ prevout_h -= 2;
1523+ break;
1524+ };
1525+ }
1526+ if (ispprev_obj.yenh_en || ispprev_obj.csup_en)
1527+ prevout_w -= 2;
1528+
1529+ /* Start at the correct row/column by skipping
1530+ * a Sensor specific amount.
1531+ */
1532+ prevout_w -= ispprev_obj.sph;
1533+ prevout_h -= ispprev_obj.slv;
1534+
1535+
1536+ if (prevout_w % 2)
1537+ prevout_w -= 1;
1538+
1539+ if (ispprev_obj.prev_outfmt == PREVIEW_MEM) {
1540+ if (((prevout_w * 2) & ISP_32B_BOUNDARY_OFFSET) !=
1541+ (prevout_w * 2)) {
1542+ prevout_w = ((prevout_w * 2) &
1543+ ISP_32B_BOUNDARY_OFFSET) / 2;
1544+ }
1545+ }
1546+ *output_w = prevout_w;
1547+ ispprev_obj.prevout_w = prevout_w;
1548+ *output_h = prevout_h;
1549+ ispprev_obj.prevout_h = prevout_h;
1550+ return 0;
1551+}
1552+EXPORT_SYMBOL_GPL(isppreview_try_size);
1553+
1554+/**
1555+ * isppreview_config_size - Sets the size of ISP preview output.
1556+ * @input_w: input width for the preview in number of pixels per line
1557+ * @input_h: input height for the preview in number of lines
1558+ * @output_w: output width from the preview in number of pixels per line
1559+ * @output_h: output height for the preview in number of lines
1560+ *
1561+ * Configures the appropriate values stored in the isp_prev structure to
1562+ * HORZ/VERT_INFO. Configures PRV_AVE if needed for downsampling as calculated
1563+ * in trysize.
1564+ **/
1565+int isppreview_config_size(u32 input_w, u32 input_h, u32 output_w, u32 output_h)
1566+{
1567+ u32 prevsdroff;
1568+
1569+ if ((output_w != ispprev_obj.prevout_w) ||
1570+ (output_h != ispprev_obj.prevout_h)) {
1571+ printk(KERN_ERR "ISP_ERR : isppreview_try_size should "
1572+ "be called before config size\n");
1573+ return -EINVAL;
1574+ }
1575+
1576+ isp_reg_writel((ispprev_obj.sph << ISPPRV_HORZ_INFO_SPH_SHIFT) |
1577+ (ispprev_obj.previn_w - 1),
1578+ OMAP3_ISP_IOMEM_PREV, ISPPRV_HORZ_INFO);
1579+ isp_reg_writel((ispprev_obj.slv << ISPPRV_VERT_INFO_SLV_SHIFT) |
1580+ (ispprev_obj.previn_h - 2),
1581+ OMAP3_ISP_IOMEM_PREV, ISPPRV_VERT_INFO);
1582+
1583+ if (ispprev_obj.cfafmt == CFAFMT_BAYER)
1584+ isp_reg_writel(ISPPRV_AVE_EVENDIST_2 <<
1585+ ISPPRV_AVE_EVENDIST_SHIFT |
1586+ ISPPRV_AVE_ODDDIST_2 <<
1587+ ISPPRV_AVE_ODDDIST_SHIFT |
1588+ ispprev_obj.fmtavg,
1589+ OMAP3_ISP_IOMEM_PREV, ISPPRV_AVE);
1590+
1591+ if (ispprev_obj.prev_outfmt == PREVIEW_MEM) {
1592+ prevsdroff = ispprev_obj.prevout_w * 2;
1593+ if ((prevsdroff & ISP_32B_BOUNDARY_OFFSET) != prevsdroff) {
1594+ DPRINTK_ISPPREV("ISP_WARN: Preview output buffer line"
1595+ " size is truncated"
1596+ " to 32byte boundary\n");
1597+ prevsdroff &= ISP_32B_BOUNDARY_BUF ;
1598+ }
1599+ isppreview_config_outlineoffset(prevsdroff);
1600+ }
1601+ return 0;
1602+}
1603+EXPORT_SYMBOL_GPL(isppreview_config_size);
1604+
1605+/**
1606+ * isppreview_config_inlineoffset - Configures the Read address line offset.
1607+ * @offset: Line Offset for the input image.
1608+ **/
1609+int isppreview_config_inlineoffset(u32 offset)
1610+{
1611+ if ((offset & ISP_32B_BOUNDARY_OFFSET) == offset) {
1612+ isp_reg_writel(offset & 0xffff,
1613+ OMAP3_ISP_IOMEM_PREV, ISPPRV_RADR_OFFSET);
1614+ } else {
1615+ printk(KERN_ERR "ISP_ERR : Offset should be in 32 byte "
1616+ "boundary\n");
1617+ return -EINVAL;
1618+ }
1619+ return 0;
1620+}
1621+EXPORT_SYMBOL_GPL(isppreview_config_inlineoffset);
1622+
1623+/**
1624+ * isppreview_set_inaddr - Sets memory address of input frame.
1625+ * @addr: 32bit memory address aligned on 32byte boundary.
1626+ *
1627+ * Configures the memory address from which the input frame is to be read.
1628+ **/
1629+int isppreview_set_inaddr(u32 addr)
1630+{
1631+ if ((addr & ISP_32B_BOUNDARY_BUF) == addr)
1632+ isp_reg_writel(addr, OMAP3_ISP_IOMEM_PREV, ISPPRV_RSDR_ADDR);
1633+ else {
1634+ printk(KERN_ERR "ISP_ERR: Address should be in 32 byte "
1635+ "boundary\n");
1636+ return -EINVAL;
1637+ }
1638+ return 0;
1639+}
1640+EXPORT_SYMBOL_GPL(isppreview_set_inaddr);
1641+
1642+/**
1643+ * isppreview_config_outlineoffset - Configures the Write address line offset.
1644+ * @offset: Line Offset for the preview output.
1645+ **/
1646+int isppreview_config_outlineoffset(u32 offset)
1647+{
1648+ if ((offset & ISP_32B_BOUNDARY_OFFSET) != offset) {
1649+ printk(KERN_ERR "ISP_ERR : Offset should be in 32 byte "
1650+ "boundary\n");
1651+ return -EINVAL;
1652+ }
1653+ isp_reg_writel(offset & 0xffff, OMAP3_ISP_IOMEM_PREV,
1654+ ISPPRV_WADD_OFFSET);
1655+ return 0;
1656+}
1657+EXPORT_SYMBOL_GPL(isppreview_config_outlineoffset);
1658+
1659+/**
1660+ * isppreview_set_outaddr - Sets the memory address to store output frame
1661+ * @addr: 32bit memory address aligned on 32byte boundary.
1662+ *
1663+ * Configures the memory address to which the output frame is written.
1664+ **/
1665+int isppreview_set_outaddr(u32 addr)
1666+{
1667+ if ((addr & ISP_32B_BOUNDARY_BUF) != addr) {
1668+ printk(KERN_ERR "ISP_ERR: Address should be in 32 byte "
1669+ "boundary\n");
1670+ return -EINVAL;
1671+ }
1672+ isp_reg_writel(addr, OMAP3_ISP_IOMEM_PREV, ISPPRV_WSDR_ADDR);
1673+ return 0;
1674+}
1675+EXPORT_SYMBOL_GPL(isppreview_set_outaddr);
1676+
1677+/**
1678+ * isppreview_config_darklineoffset - Sets the Dark frame address line offset.
1679+ * @offset: Line Offset for the Darkframe.
1680+ **/
1681+int isppreview_config_darklineoffset(u32 offset)
1682+{
1683+ if ((offset & ISP_32B_BOUNDARY_OFFSET) != offset) {
1684+ printk(KERN_ERR "ISP_ERR : Offset should be in 32 byte "
1685+ "boundary\n");
1686+ return -EINVAL;
1687+ }
1688+ isp_reg_writel(offset & 0xffff, OMAP3_ISP_IOMEM_PREV,
1689+ ISPPRV_DRKF_OFFSET);
1690+ return 0;
1691+}
1692+EXPORT_SYMBOL_GPL(isppreview_config_darklineoffset);
1693+
1694+/**
1695+ * isppreview_set_darkaddr - Sets the memory address to store Dark frame.
1696+ * @addr: 32bit memory address aligned on 32 bit boundary.
1697+ **/
1698+int isppreview_set_darkaddr(u32 addr)
1699+{
1700+ if ((addr & ISP_32B_BOUNDARY_BUF) != addr) {
1701+ printk(KERN_ERR "ISP_ERR : Address should be in 32 byte "
1702+ "boundary\n");
1703+ return -EINVAL;
1704+ }
1705+ isp_reg_writel(addr, OMAP3_ISP_IOMEM_PREV, ISPPRV_DSDR_ADDR);
1706+ return 0;
1707+}
1708+EXPORT_SYMBOL_GPL(isppreview_set_darkaddr);
1709+
1710+void __isppreview_enable(int enable)
1711+{
1712+ if (enable)
1713+ isp_reg_or(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, ISPPRV_PCR_EN);
1714+ else
1715+ isp_reg_and(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, ~ISPPRV_PCR_EN);
1716+}
1717+
1718+/**
1719+ * isppreview_enable - Enables the Preview module.
1720+ * @enable: 1 - Enables the preview module.
1721+ *
1722+ * Client should configure all the sub modules in Preview before this.
1723+ **/
1724+void isppreview_enable(int enable)
1725+{
1726+ __isppreview_enable(enable);
1727+ ispprev_obj.pm_state = enable;
1728+}
1729+EXPORT_SYMBOL_GPL(isppreview_enable);
1730+
1731+/**
1732+ * isppreview_suspend - Suspend Preview module.
1733+ **/
1734+void isppreview_suspend(void)
1735+{
1736+ if (ispprev_obj.pm_state)
1737+ __isppreview_enable(0);
1738+}
1739+EXPORT_SYMBOL_GPL(isppreview_suspend);
1740+
1741+/**
1742+ * isppreview_resume - Resume Preview module.
1743+ **/
1744+void isppreview_resume(void)
1745+{
1746+ if (ispprev_obj.pm_state)
1747+ __isppreview_enable(1);
1748+}
1749+EXPORT_SYMBOL_GPL(isppreview_resume);
1750+
1751+
1752+/**
1753+ * isppreview_busy - Gets busy state of preview module.
1754+ **/
1755+int isppreview_busy(void)
1756+{
1757+ return isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR) &
1758+ ISPPRV_PCR_BUSY;
1759+}
1760+EXPORT_SYMBOL_GPL(isppreview_busy);
1761+
1762+/**
1763+ * isppreview_get_config - Gets parameters of preview module.
1764+ **/
1765+struct prev_params *isppreview_get_config(void)
1766+{
1767+ return prev_config_params;
1768+}
1769+EXPORT_SYMBOL_GPL(isppreview_get_config);
1770+
1771+/**
1772+ * isppreview_save_context - Saves the values of the preview module registers.
1773+ **/
1774+void isppreview_save_context(void)
1775+{
1776+ DPRINTK_ISPPREV("Saving context\n");
1777+ isp_save_context(ispprev_reg_list);
1778+}
1779+EXPORT_SYMBOL_GPL(isppreview_save_context);
1780+
1781+/**
1782+ * isppreview_restore_context - Restores the values of preview module registers
1783+ **/
1784+void isppreview_restore_context(void)
1785+{
1786+ DPRINTK_ISPPREV("Restoring context\n");
1787+ isp_restore_context(ispprev_reg_list);
1788+}
1789+EXPORT_SYMBOL_GPL(isppreview_restore_context);
1790+
1791+/**
1792+ * isppreview_print_status - Prints the values of the Preview Module registers.
1793+ *
1794+ * Also prints other debug information stored in the preview moduel.
1795+ **/
1796+void isppreview_print_status(void)
1797+{
1798+ DPRINTK_ISPPREV("Module in use =%d\n", ispprev_obj.prev_inuse);
1799+ DPRINTK_ISPPREV("Preview Input format =%d, Output Format =%d\n",
1800+ ispprev_obj.prev_inpfmt,
1801+ ispprev_obj.prev_outfmt);
1802+ DPRINTK_ISPPREV("Accepted Preview Input (width = %d,Height = %d)\n",
1803+ ispprev_obj.previn_w,
1804+ ispprev_obj.previn_h);
1805+ DPRINTK_ISPPREV("Accepted Preview Output (width = %d,Height = %d)\n",
1806+ ispprev_obj.prevout_w,
1807+ ispprev_obj.prevout_h);
1808+ DPRINTK_ISPPREV("###ISP_CTRL in preview =0x%x\n",
1809+ isp_reg_readl(OMAP3_ISP_IOMEM_MAIN, ISP_CTRL));
1810+ DPRINTK_ISPPREV("###ISP_IRQ0ENABLE in preview =0x%x\n",
1811+ isp_reg_readl(OMAP3_ISP_IOMEM_MAIN, ISP_IRQ0ENABLE));
1812+ DPRINTK_ISPPREV("###ISP_IRQ0STATUS in preview =0x%x\n",
1813+ isp_reg_readl(OMAP3_ISP_IOMEM_MAIN, ISP_IRQ0STATUS));
1814+ DPRINTK_ISPPREV("###PRV PCR =0x%x\n",
1815+ isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR));
1816+ DPRINTK_ISPPREV("###PRV HORZ_INFO =0x%x\n",
1817+ isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_HORZ_INFO));
1818+ DPRINTK_ISPPREV("###PRV VERT_INFO =0x%x\n",
1819+ isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_VERT_INFO));
1820+ DPRINTK_ISPPREV("###PRV WSDR_ADDR =0x%x\n",
1821+ isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_WSDR_ADDR));
1822+ DPRINTK_ISPPREV("###PRV WADD_OFFSET =0x%x\n",
1823+ isp_reg_readl(OMAP3_ISP_IOMEM_PREV,
1824+ ISPPRV_WADD_OFFSET));
1825+ DPRINTK_ISPPREV("###PRV AVE =0x%x\n",
1826+ isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_AVE));
1827+ DPRINTK_ISPPREV("###PRV HMED =0x%x\n",
1828+ isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_HMED));
1829+ DPRINTK_ISPPREV("###PRV NF =0x%x\n",
1830+ isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_NF));
1831+ DPRINTK_ISPPREV("###PRV WB_DGAIN =0x%x\n",
1832+ isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_WB_DGAIN));
1833+ DPRINTK_ISPPREV("###PRV WBGAIN =0x%x\n",
1834+ isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_WBGAIN));
1835+ DPRINTK_ISPPREV("###PRV WBSEL =0x%x\n",
1836+ isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_WBSEL));
1837+ DPRINTK_ISPPREV("###PRV CFA =0x%x\n",
1838+ isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_CFA));
1839+ DPRINTK_ISPPREV("###PRV BLKADJOFF =0x%x\n",
1840+ isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_BLKADJOFF));
1841+ DPRINTK_ISPPREV("###PRV RGB_MAT1 =0x%x\n",
1842+ isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_RGB_MAT1));
1843+ DPRINTK_ISPPREV("###PRV RGB_MAT2 =0x%x\n",
1844+ isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_RGB_MAT2));
1845+ DPRINTK_ISPPREV("###PRV RGB_MAT3 =0x%x\n",
1846+ isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_RGB_MAT3));
1847+ DPRINTK_ISPPREV("###PRV RGB_MAT4 =0x%x\n",
1848+ isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_RGB_MAT4));
1849+ DPRINTK_ISPPREV("###PRV RGB_MAT5 =0x%x\n",
1850+ isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_RGB_MAT5));
1851+ DPRINTK_ISPPREV("###PRV RGB_OFF1 =0x%x\n",
1852+ isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_RGB_OFF1));
1853+ DPRINTK_ISPPREV("###PRV RGB_OFF2 =0x%x\n",
1854+ isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_RGB_OFF2));
1855+ DPRINTK_ISPPREV("###PRV CSC0 =0x%x\n",
1856+ isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_CSC0));
1857+ DPRINTK_ISPPREV("###PRV CSC1 =0x%x\n",
1858+ isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_CSC1));
1859+ DPRINTK_ISPPREV("###PRV CSC2 =0x%x\n",
1860+ isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_CSC2));
1861+ DPRINTK_ISPPREV("###PRV CSC_OFFSET =0x%x\n",
1862+ isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_CSC_OFFSET));
1863+ DPRINTK_ISPPREV("###PRV CNT_BRT =0x%x\n",
1864+ isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_CNT_BRT));
1865+ DPRINTK_ISPPREV("###PRV CSUP =0x%x\n",
1866+ isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_CSUP));
1867+ DPRINTK_ISPPREV("###PRV SETUP_YC =0x%x\n",
1868+ isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_SETUP_YC));
1869+}
1870+EXPORT_SYMBOL_GPL(isppreview_print_status);
1871+
1872+/**
1873+ * isp_preview_init - Module Initialization.
1874+ **/
1875+int __init isp_preview_init(void)
1876+{
1877+ int i = 0;
1878+
1879+ prev_config_params = kmalloc(sizeof(*prev_config_params), GFP_KERNEL);
1880+ if (!prev_config_params) {
1881+ printk(KERN_ERR "Can't get memory for isp_preview params!\n");
1882+ return -ENOMEM;
1883+ }
1884+ params = prev_config_params;
1885+
1886+ ispprev_obj.prev_inuse = 0;
1887+ mutex_init(&ispprev_obj.ispprev_mutex);
1888+
1889+ /* Init values */
1890+ ispprev_obj.sph = 2;
1891+ ispprev_obj.slv = 0;
1892+ ispprev_obj.color = V4L2_COLORFX_NONE;
1893+ ispprev_obj.contrast = ISPPRV_CONTRAST_DEF;
1894+ params->contrast = ISPPRV_CONTRAST_DEF;
1895+ ispprev_obj.brightness = ISPPRV_BRIGHT_DEF;
1896+ params->brightness = ISPPRV_BRIGHT_DEF;
1897+ params->average = NO_AVE;
1898+ params->lens_shading_shift = 0;
1899+ params->pix_fmt = YCPOS_YCrYCb;
1900+ params->cfa.cfafmt = CFAFMT_BAYER;
1901+ params->cfa.cfa_table = cfa_coef_table;
1902+ params->cfa.cfa_gradthrs_horz = FLR_CFA_GRADTHRS_HORZ;
1903+ params->cfa.cfa_gradthrs_vert = FLR_CFA_GRADTHRS_VERT;
1904+ params->csup.gain = FLR_CSUP_GAIN;
1905+ params->csup.thres = FLR_CSUP_THRES;
1906+ params->csup.hypf_en = 0;
1907+ params->ytable = luma_enhance_table;
1908+ params->nf.spread = FLR_NF_STRGTH;
1909+ memcpy(params->nf.table, noise_filter_table, sizeof(params->nf.table));
1910+ params->dcor.couplet_mode_en = 1;
1911+ for (i = 0; i < 4; i++)
1912+ params->dcor.detect_correct[i] = 0xE;
1913+ params->gtable.bluetable = bluegamma_table;
1914+ params->gtable.greentable = greengamma_table;
1915+ params->gtable.redtable = redgamma_table;
1916+ params->wbal.dgain = FLR_WBAL_DGAIN;
1917+ if (omap_rev() > OMAP3430_REV_ES1_0) {
1918+ params->wbal.coef0 = FLR_WBAL_COEF0_ES1;
1919+ params->wbal.coef1 = FLR_WBAL_COEF1_ES1;
1920+ params->wbal.coef2 = FLR_WBAL_COEF2_ES1;
1921+ params->wbal.coef3 = FLR_WBAL_COEF3_ES1;
1922+ } else {
1923+ params->wbal.coef0 = FLR_WBAL_COEF0;
1924+ params->wbal.coef1 = FLR_WBAL_COEF1;
1925+ params->wbal.coef2 = FLR_WBAL_COEF2;
1926+ params->wbal.coef3 = FLR_WBAL_COEF3;
1927+ }
1928+ params->blk_adj.red = FLR_BLKADJ_RED;
1929+ params->blk_adj.green = FLR_BLKADJ_GREEN;
1930+ params->blk_adj.blue = FLR_BLKADJ_BLUE;
1931+ params->rgb2rgb = flr_rgb2rgb;
1932+ params->rgb2ycbcr = flr_prev_csc[ispprev_obj.color];
1933+
1934+ params->features = PREV_CFA | PREV_DEFECT_COR | PREV_NOISE_FILTER;
1935+ params->features &= ~(PREV_AVERAGER | PREV_INVERSE_ALAW |
1936+ PREV_HORZ_MEDIAN_FILTER |
1937+ PREV_GAMMA_BYPASS |
1938+ PREV_DARK_FRAME_SUBTRACT |
1939+ PREV_LENS_SHADING |
1940+ PREV_DARK_FRAME_CAPTURE |
1941+ PREV_CHROMA_SUPPRESS |
1942+ PREV_LUMA_ENHANCE);
1943+ return 0;
1944+}
1945+
1946+/**
1947+ * isp_preview_cleanup - Module Cleanup.
1948+ **/
1949+void isp_preview_cleanup(void)
1950+{
1951+ kfree(prev_config_params);
1952+}
1953diff --git a/drivers/media/video/isp/isppreview.h b/drivers/media/video/isp/isppreview.h
1954new file mode 100644
1955index 0000000..e88c329
1956--- /dev/null
1957+++ b/drivers/media/video/isp/isppreview.h
1958@@ -0,0 +1,354 @@
1959+/*
1960+ * isppreview.h
1961+ *
1962+ * Driver header file for Preview module in TI's OMAP3 Camera ISP
1963+ *
1964+ * Copyright (C) 2009 Texas Instruments, Inc.
1965+ *
1966+ * Contributors:
1967+ * Senthilvadivu Guruswamy <svadivu@ti.com>
1968+ * Pallavi Kulkarni <p-kulkarni@ti.com>
1969+ * Sergio Aguirre <saaguirre@ti.com>
1970+ *
1971+ * This package is free software; you can redistribute it and/or modify
1972+ * it under the terms of the GNU General Public License version 2 as
1973+ * published by the Free Software Foundation.
1974+ *
1975+ * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
1976+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
1977+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1978+ */
1979+
1980+#ifndef OMAP_ISP_PREVIEW_H
1981+#define OMAP_ISP_PREVIEW_H
1982+
1983+#include <mach/isp_user.h>
1984+/* Isp query control structure */
1985+
1986+#define ISPPRV_BRIGHT_STEP 0x1
1987+#define ISPPRV_BRIGHT_DEF 0x0
1988+#define ISPPRV_BRIGHT_LOW 0x0
1989+#define ISPPRV_BRIGHT_HIGH 0xF
1990+#define ISPPRV_BRIGHT_UNITS 0x7
1991+
1992+#define ISPPRV_CONTRAST_STEP 0x1
1993+#define ISPPRV_CONTRAST_DEF 0x4
1994+#define ISPPRV_CONTRAST_LOW 0x0
1995+#define ISPPRV_CONTRAST_HIGH 0xF
1996+#define ISPPRV_CONTRAST_UNITS 0x4
1997+
1998+#define NO_AVE 0x0
1999+#define AVE_2_PIX 0x1
2000+#define AVE_4_PIX 0x2
2001+#define AVE_8_PIX 0x3
2002+#define AVE_ODD_PIXEL_DIST (1 << 4) /* For Bayer Sensors */
2003+#define AVE_EVEN_PIXEL_DIST (1 << 2)
2004+
2005+#define WB_GAIN_MAX 4
2006+
2007+/* Features list */
2008+#define PREV_AVERAGER (1 << 0)
2009+#define PREV_INVERSE_ALAW (1 << 1)
2010+#define PREV_HORZ_MEDIAN_FILTER (1 << 2)
2011+#define PREV_NOISE_FILTER (1 << 3)
2012+#define PREV_CFA (1 << 4)
2013+#define PREV_GAMMA_BYPASS (1 << 5)
2014+#define PREV_LUMA_ENHANCE (1 << 6)
2015+#define PREV_CHROMA_SUPPRESS (1 << 7)
2016+#define PREV_DARK_FRAME_SUBTRACT (1 << 8)
2017+#define PREV_LENS_SHADING (1 << 9)
2018+#define PREV_DARK_FRAME_CAPTURE (1 << 10)
2019+#define PREV_DEFECT_COR (1 << 11)
2020+
2021+
2022+#define ISP_NF_TABLE_SIZE (1 << 10)
2023+
2024+#define ISP_GAMMA_TABLE_SIZE (1 << 10)
2025+
2026+/* Table addresses */
2027+#define ISPPRV_TBL_ADDR_RED_G_START 0x00
2028+#define ISPPRV_TBL_ADDR_BLUE_G_START 0x800
2029+#define ISPPRV_TBL_ADDR_GREEN_G_START 0x400
2030+
2031+/*
2032+ *Enumeration Constants for input and output format
2033+ */
2034+enum preview_input {
2035+ PRV_RAW_CCDC,
2036+ PRV_RAW_MEM,
2037+ PRV_RGBBAYERCFA,
2038+ PRV_COMPCFA,
2039+ PRV_CCDC_DRKF,
2040+ PRV_OTHERS
2041+};
2042+enum preview_output {
2043+ PREVIEW_RSZ,
2044+ PREVIEW_MEM
2045+};
2046+/*
2047+ * Configure byte layout of YUV image
2048+ */
2049+enum preview_ycpos_mode {
2050+ YCPOS_YCrYCb = 0,
2051+ YCPOS_YCbYCr = 1,
2052+ YCPOS_CbYCrY = 2,
2053+ YCPOS_CrYCbY = 3
2054+};
2055+
2056+/**
2057+ * struct ispprev_gtable - Structure for Gamma Correction.
2058+ * @redtable: Pointer to the red gamma table.
2059+ * @greentable: Pointer to the green gamma table.
2060+ * @bluetable: Pointer to the blue gamma table.
2061+ */
2062+struct ispprev_gtable {
2063+ u32 *redtable;
2064+ u32 *greentable;
2065+ u32 *bluetable;
2066+};
2067+
2068+/**
2069+ * struct prev_white_balance - Structure for White Balance 2.
2070+ * @wb_dgain: White balance common gain.
2071+ * @wb_gain: Individual color gains.
2072+ * @wb_coefmatrix: Coefficient matrix
2073+ */
2074+struct prev_white_balance {
2075+ u16 wb_dgain; /* white balance common gain */
2076+ u8 wb_gain[WB_GAIN_MAX]; /* individual color gains */
2077+ u8 wb_coefmatrix[WB_GAIN_MAX][WB_GAIN_MAX];
2078+};
2079+
2080+/**
2081+ * struct prev_size_params - Structure for size parameters.
2082+ * @hstart: Starting pixel.
2083+ * @vstart: Starting line.
2084+ * @hsize: Width of input image.
2085+ * @vsize: Height of input image.
2086+ * @pixsize: Pixel size of the image in terms of bits.
2087+ * @in_pitch: Line offset of input image.
2088+ * @out_pitch: Line offset of output image.
2089+ */
2090+struct prev_size_params {
2091+ unsigned int hstart;
2092+ unsigned int vstart;
2093+ unsigned int hsize;
2094+ unsigned int vsize;
2095+ unsigned char pixsize;
2096+ unsigned short in_pitch;
2097+ unsigned short out_pitch;
2098+};
2099+
2100+/**
2101+ * struct prev_rgb2ycbcr_coeffs - Structure RGB2YCbCr parameters.
2102+ * @coeff: Color conversion gains in 3x3 matrix.
2103+ * @offset: Color conversion offsets.
2104+ */
2105+struct prev_rgb2ycbcr_coeffs {
2106+ short coeff[RGB_MAX][RGB_MAX];
2107+ short offset[RGB_MAX];
2108+};
2109+
2110+/**
2111+ * struct prev_darkfrm_params - Structure for Dark frame suppression.
2112+ * @addr: Memory start address.
2113+ * @offset: Line offset.
2114+ */
2115+struct prev_darkfrm_params {
2116+ u32 addr;
2117+ u32 offset;
2118+ };
2119+
2120+/**
2121+ * struct prev_params - Structure for all configuration
2122+ * @features: Set of features enabled.
2123+ * @pix_fmt: Output pixel format.
2124+ * @cfa: CFA coefficients.
2125+ * @csup: Chroma suppression coefficients.
2126+ * @ytable: Pointer to Luma enhancement coefficients.
2127+ * @nf: Noise filter coefficients.
2128+ * @dcor: Noise filter coefficients.
2129+ * @gtable: Gamma coefficients.
2130+ * @wbal: White Balance parameters.
2131+ * @blk_adj: Black adjustment parameters.
2132+ * @rgb2rgb: RGB blending parameters.
2133+ * @rgb2ycbcr: RGB to ycbcr parameters.
2134+ * @hmf_params: Horizontal median filter.
2135+ * @size_params: Size parameters.
2136+ * @drkf_params: Darkframe parameters.
2137+ * @lens_shading_shift:
2138+ * @average: Downsampling rate for averager.
2139+ * @contrast: Contrast.
2140+ * @brightness: Brightness.
2141+ */
2142+struct prev_params {
2143+ u16 features;
2144+ enum preview_ycpos_mode pix_fmt;
2145+ struct ispprev_cfa cfa;
2146+ struct ispprev_csup csup;
2147+ u32 *ytable;
2148+ struct ispprev_nf nf;
2149+ struct ispprev_dcor dcor;
2150+ struct ispprev_gtable gtable;
2151+ struct ispprev_wbal wbal;
2152+ struct ispprev_blkadj blk_adj;
2153+ struct ispprev_rgbtorgb rgb2rgb;
2154+ struct ispprev_csc rgb2ycbcr;
2155+ struct ispprev_hmed hmf_params;
2156+ struct prev_size_params size_params;
2157+ struct prev_darkfrm_params drkf_params;
2158+ u8 lens_shading_shift;
2159+ u8 average;
2160+ u8 contrast;
2161+ u8 brightness;
2162+};
2163+
2164+/**
2165+ * struct isptables_update - Structure for Table Configuration.
2166+ * @update: Specifies which tables should be updated.
2167+ * @flag: Specifies which tables should be enabled.
2168+ * @prev_nf: Pointer to structure for Noise Filter
2169+ * @lsc: Pointer to LSC gain table. (currently not used)
2170+ * @red_gamma: Pointer to red gamma correction table.
2171+ * @green_gamma: Pointer to green gamma correction table.
2172+ * @blue_gamma: Pointer to blue gamma correction table.
2173+ */
2174+struct isptables_update {
2175+ u16 update;
2176+ u16 flag;
2177+ struct ispprev_nf *prev_nf;
2178+ u32 *lsc;
2179+ u32 *red_gamma;
2180+ u32 *green_gamma;
2181+ u32 *blue_gamma;
2182+};
2183+
2184+void isppreview_config_shadow_registers(void);
2185+
2186+int isppreview_request(void);
2187+
2188+int isppreview_free(void);
2189+
2190+int isppreview_config_datapath(enum preview_input input,
2191+ enum preview_output output);
2192+
2193+void isppreview_config_ycpos(enum preview_ycpos_mode mode);
2194+
2195+void isppreview_config_averager(u8 average);
2196+
2197+void isppreview_enable_invalaw(u8 enable);
2198+
2199+void isppreview_enable_drkframe(u8 enable);
2200+
2201+void isppreview_enable_shadcomp(u8 enable);
2202+
2203+void isppreview_config_drkf_shadcomp(u8 scomp_shtval);
2204+
2205+void isppreview_enable_gammabypass(u8 enable);
2206+
2207+void isppreview_enable_hmed(u8 enable);
2208+
2209+void isppreview_config_hmed(struct ispprev_hmed);
2210+
2211+void isppreview_enable_noisefilter(u8 enable);
2212+
2213+void isppreview_config_noisefilter(struct ispprev_nf prev_nf);
2214+
2215+void isppreview_enable_dcor(u8 enable);
2216+
2217+void isppreview_config_dcor(struct ispprev_dcor prev_dcor);
2218+
2219+
2220+void isppreview_config_cfa(struct ispprev_cfa);
2221+
2222+void isppreview_config_gammacorrn(struct ispprev_gtable);
2223+
2224+void isppreview_config_chroma_suppression(struct ispprev_csup csup);
2225+
2226+void isppreview_enable_cfa(u8 enable);
2227+
2228+void isppreview_config_luma_enhancement(u32 *ytable);
2229+
2230+void isppreview_enable_luma_enhancement(u8 enable);
2231+
2232+void isppreview_enable_chroma_suppression(u8 enable);
2233+
2234+void isppreview_config_whitebalance(struct ispprev_wbal);
2235+
2236+void isppreview_config_blkadj(struct ispprev_blkadj);
2237+
2238+void isppreview_config_rgb_blending(struct ispprev_rgbtorgb);
2239+
2240+void isppreview_config_rgb_to_ycbcr(struct ispprev_csc);
2241+
2242+void isppreview_update_contrast(u8 *contrast);
2243+
2244+void isppreview_query_contrast(u8 *contrast);
2245+
2246+void isppreview_config_contrast(u8 contrast);
2247+
2248+void isppreview_get_contrast_range(u8 *min_contrast, u8 *max_contrast);
2249+
2250+void isppreview_update_brightness(u8 *brightness);
2251+
2252+void isppreview_config_brightness(u8 brightness);
2253+
2254+void isppreview_get_brightness_range(u8 *min_brightness, u8 *max_brightness);
2255+
2256+void isppreview_set_color(u8 *mode);
2257+
2258+void isppreview_get_color(u8 *mode);
2259+
2260+void isppreview_query_brightness(u8 *brightness);
2261+
2262+void isppreview_config_yc_range(struct ispprev_yclimit yclimit);
2263+
2264+int isppreview_try_size(u32 input_w, u32 input_h, u32 *output_w,
2265+ u32 *output_h);
2266+
2267+int isppreview_config_size(u32 input_w, u32 input_h, u32 output_w,
2268+ u32 output_h);
2269+
2270+int isppreview_config_inlineoffset(u32 offset);
2271+
2272+int isppreview_set_inaddr(u32 addr);
2273+
2274+int isppreview_config_outlineoffset(u32 offset);
2275+
2276+int isppreview_set_outaddr(u32 addr);
2277+
2278+int isppreview_config_darklineoffset(u32 offset);
2279+
2280+int isppreview_set_darkaddr(u32 addr);
2281+
2282+void isppreview_enable(int enable);
2283+
2284+void isppreview_suspend(void);
2285+
2286+void isppreview_resume(void);
2287+
2288+int isppreview_busy(void);
2289+
2290+struct prev_params *isppreview_get_config(void);
2291+
2292+void isppreview_print_status(void);
2293+
2294+#ifndef CONFIG_ARCH_OMAP3410
2295+void isppreview_save_context(void);
2296+#else
2297+static inline void isppreview_save_context(void) {}
2298+#endif
2299+
2300+#ifndef CONFIG_ARCH_OMAP3410
2301+void isppreview_restore_context(void);
2302+#else
2303+static inline void isppreview_restore_context(void) {}
2304+#endif
2305+
2306+int omap34xx_isp_preview_config(void *userspace_add);
2307+
2308+int omap34xx_isp_tables_update(struct isptables_update *isptables_struct);
2309+
2310+void isppreview_set_skip(u32 h, u32 v);
2311+
2312+#endif/* OMAP_ISP_PREVIEW_H */
2313diff --git a/drivers/media/video/isp/ispresizer.c b/drivers/media/video/isp/ispresizer.c
2314new file mode 100644
2315index 0000000..f78ddb3
2316--- /dev/null
2317+++ b/drivers/media/video/isp/ispresizer.c
2318@@ -0,0 +1,928 @@
2319+/*
2320+ * ispresizer.c
2321+ *
2322+ * Driver Library for Resizer module in TI's OMAP3 Camera ISP
2323+ *
2324+ * Copyright (C)2009 Texas Instruments, Inc.
2325+ *
2326+ * Contributors:
2327+ * Sameer Venkatraman <sameerv@ti.com>
2328+ * Mohit Jalori
2329+ * Sergio Aguirre <saaguirre@ti.com>
2330+ *
2331+ * This package is free software; you can redistribute it and/or modify
2332+ * it under the terms of the GNU General Public License version 2 as
2333+ * published by the Free Software Foundation.
2334+ *
2335+ * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
2336+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
2337+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2338+ */
2339+
2340+#include <linux/module.h>
2341+
2342+#include "isp.h"
2343+#include "ispreg.h"
2344+#include "ispresizer.h"
2345+
2346+/* Default configuration of resizer,filter coefficients,yenh for camera isp */
2347+static struct isprsz_yenh ispreszdefaultyenh = {0, 0, 0, 0};
2348+static struct isprsz_coef ispreszdefcoef = {
2349+ {
2350+ 0x0027, 0x00B2, 0x00B2, 0x0027,
2351+ 0x0027, 0x00B2, 0x0027, 0x00B2,
2352+ 0x0027, 0x00B2, 0x0027, 0x00B2,
2353+ 0x0027, 0x00B2, 0x0027, 0x00B2,
2354+ 0x0027, 0x00B2, 0x0027, 0x00B2,
2355+ 0x0027, 0x00B2, 0x0027, 0x00B2,
2356+ 0x0027, 0x00B2, 0x0027, 0x00B2,
2357+ 0x0027, 0x00B2, 0x0027, 0x00B2,
2358+ },
2359+ {
2360+ 0x0000, 0x0100, 0x0000, 0x0000,
2361+ 0x03FA, 0x00F6, 0x0010, 0x0000,
2362+ 0x03F9, 0x00DB, 0x002C, 0x0000,
2363+ 0x03FB, 0x00B3, 0x0053, 0x03FF,
2364+ 0x03FD, 0x0082, 0x0084, 0x03FD,
2365+ 0x03FF, 0x0053, 0x00B3, 0x03FB,
2366+ 0x0000, 0x002C, 0x00DB, 0x03F9,
2367+ 0x0000, 0x0010, 0x00F6, 0x03FA
2368+ },
2369+ {
2370+ 0x0004, 0x0023, 0x0023, 0x005A,
2371+ 0x005A, 0x0058, 0x0058, 0x0004,
2372+ 0x0023, 0x0023, 0x005A, 0x005A,
2373+ 0x0058, 0x0058, 0x0004, 0x0023,
2374+ 0x0023, 0x005A, 0x005A, 0x0058,
2375+ 0x0058, 0x0004, 0x0023, 0x0023,
2376+ 0x005A, 0x005A, 0x0058, 0x0058
2377+ },
2378+ {
2379+ 0x0004, 0x0023, 0x005A, 0x0058,
2380+ 0x0023, 0x0004, 0x0000, 0x0002,
2381+ 0x0018, 0x004d, 0x0060, 0x0031,
2382+ 0x0008, 0x0000, 0x0001, 0x000f,
2383+ 0x003f, 0x0062, 0x003f, 0x000f,
2384+ 0x0001, 0x0000, 0x0008, 0x0031,
2385+ 0x0060, 0x004d, 0x0018, 0x0002
2386+ }
2387+};
2388+
2389+/**
2390+ * struct isp_res - Structure for the resizer module to store its information.
2391+ * @res_inuse: Indicates if resizer module has been reserved. 1 - Reserved,
2392+ * 0 - Freed.
2393+ * @h_startphase: Horizontal starting phase.
2394+ * @v_startphase: Vertical starting phase.
2395+ * @h_resz: Horizontal resizing value.
2396+ * @v_resz: Vertical resizing value.
2397+ * @outputwidth: Output Image Width in pixels.
2398+ * @outputheight: Output Image Height in pixels.
2399+ * @inputwidth: Input Image Width in pixels.
2400+ * @inputheight: Input Image Height in pixels.
2401+ * @algo: Algorithm select. 0 - Disable, 1 - [-1 2 -1]/2 high-pass filter,
2402+ * 2 - [-1 -2 6 -2 -1]/4 high-pass filter.
2403+ * @ipht_crop: Vertical start line for cropping.
2404+ * @ipwd_crop: Horizontal start pixel for cropping.
2405+ * @cropwidth: Crop Width.
2406+ * @cropheight: Crop Height.
2407+ * @resinput: Resizer input.
2408+ * @coeflist: Register configuration for Resizer.
2409+ * @ispres_mutex: Mutex for isp resizer.
2410+ */
2411+static struct isp_res {
2412+ int pm_state;
2413+ u8 res_inuse;
2414+ u8 h_startphase;
2415+ u8 v_startphase;
2416+ u16 h_resz;
2417+ u16 v_resz;
2418+ u32 outputwidth;
2419+ u32 outputheight;
2420+ u32 inputwidth;
2421+ u32 inputheight;
2422+ u8 algo;
2423+ u32 ipht_crop;
2424+ u32 ipwd_crop;
2425+ u32 cropwidth;
2426+ u32 cropheight;
2427+ dma_addr_t tmp_buf;
2428+ enum ispresizer_input resinput;
2429+ struct isprsz_coef coeflist;
2430+ struct mutex ispres_mutex; /* For checking/modifying res_inuse */
2431+} ispres_obj;
2432+
2433+/* Structure for saving/restoring resizer module registers */
2434+static struct isp_reg isprsz_reg_list[] = {
2435+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_CNT, 0x0000},
2436+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_OUT_SIZE, 0x0000},
2437+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_IN_START, 0x0000},
2438+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_IN_SIZE, 0x0000},
2439+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_SDR_INADD, 0x0000},
2440+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_SDR_INOFF, 0x0000},
2441+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_SDR_OUTADD, 0x0000},
2442+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_SDR_OUTOFF, 0x0000},
2443+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_HFILT10, 0x0000},
2444+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_HFILT32, 0x0000},
2445+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_HFILT54, 0x0000},
2446+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_HFILT76, 0x0000},
2447+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_HFILT98, 0x0000},
2448+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_HFILT1110, 0x0000},
2449+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_HFILT1312, 0x0000},
2450+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_HFILT1514, 0x0000},
2451+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_HFILT1716, 0x0000},
2452+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_HFILT1918, 0x0000},
2453+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_HFILT2120, 0x0000},
2454+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_HFILT2322, 0x0000},
2455+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_HFILT2524, 0x0000},
2456+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_HFILT2726, 0x0000},
2457+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_HFILT2928, 0x0000},
2458+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_HFILT3130, 0x0000},
2459+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_VFILT10, 0x0000},
2460+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_VFILT32, 0x0000},
2461+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_VFILT54, 0x0000},
2462+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_VFILT76, 0x0000},
2463+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_VFILT98, 0x0000},
2464+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_VFILT1110, 0x0000},
2465+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_VFILT1312, 0x0000},
2466+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_VFILT1514, 0x0000},
2467+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_VFILT1716, 0x0000},
2468+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_VFILT1918, 0x0000},
2469+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_VFILT2120, 0x0000},
2470+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_VFILT2322, 0x0000},
2471+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_VFILT2524, 0x0000},
2472+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_VFILT2726, 0x0000},
2473+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_VFILT2928, 0x0000},
2474+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_VFILT3130, 0x0000},
2475+ {OMAP3_ISP_IOMEM_RESZ, ISPRSZ_YENH, 0x0000},
2476+ {0, ISP_TOK_TERM, 0x0000}
2477+};
2478+
2479+/**
2480+ * ispresizer_config_shadow_registers - Configure shadow registers.
2481+ **/
2482+void ispresizer_config_shadow_registers()
2483+{
2484+ return;
2485+}
2486+EXPORT_SYMBOL(ispresizer_config_shadow_registers);
2487+
2488+/**
2489+ * ispresizer_trycrop - Validate crop dimensions.
2490+ * @left: Left distance to start position of crop.
2491+ * @top: Top distance to start position of crop.
2492+ * @width: Width of input image.
2493+ * @height: Height of input image.
2494+ * @ow: Width of output image.
2495+ * @oh: Height of output image.
2496+ **/
2497+void ispresizer_trycrop(u32 left, u32 top, u32 width, u32 height, u32 ow,
2498+ u32 oh)
2499+{
2500+ ispres_obj.cropwidth = width + 6;
2501+ ispres_obj.cropheight = height + 6;
2502+ ispresizer_try_size(&ispres_obj.cropwidth, &ispres_obj.cropheight, &ow,
2503+ &oh);
2504+ ispres_obj.ipht_crop = top;
2505+ ispres_obj.ipwd_crop = left;
2506+}
2507+EXPORT_SYMBOL(ispresizer_trycrop);
2508+
2509+/**
2510+ * ispresizer_applycrop - Apply crop to input image.
2511+ **/
2512+void ispresizer_applycrop(void)
2513+{
2514+ ispresizer_config_size(ispres_obj.cropwidth, ispres_obj.cropheight,
2515+ ispres_obj.outputwidth,
2516+ ispres_obj.outputheight);
2517+ return;
2518+}
2519+EXPORT_SYMBOL(ispresizer_applycrop);
2520+
2521+/**
2522+ * ispresizer_request - Reserves the Resizer module.
2523+ *
2524+ * Allows only one user at a time.
2525+ *
2526+ * Returns 0 if successful, or -EBUSY if resizer module was already requested.
2527+ **/
2528+int ispresizer_request()
2529+{
2530+ mutex_lock(&ispres_obj.ispres_mutex);
2531+ if (!ispres_obj.res_inuse) {
2532+ ispres_obj.res_inuse = 1;
2533+ mutex_unlock(&ispres_obj.ispres_mutex);
2534+ isp_reg_writel(isp_reg_readl(OMAP3_ISP_IOMEM_MAIN, ISP_CTRL) |
2535+ ISPCTRL_SBL_WR0_RAM_EN |
2536+ ISPCTRL_RSZ_CLK_EN,
2537+ OMAP3_ISP_IOMEM_MAIN, ISP_CTRL);
2538+ return 0;
2539+ } else {
2540+ mutex_unlock(&ispres_obj.ispres_mutex);
2541+ printk(KERN_ERR "ISP_ERR : Resizer Module Busy\n");
2542+ return -EBUSY;
2543+ }
2544+}
2545+EXPORT_SYMBOL(ispresizer_request);
2546+
2547+/**
2548+ * ispresizer_free - Makes Resizer module free.
2549+ *
2550+ * Returns 0 if successful, or -EINVAL if resizer module was already freed.
2551+ **/
2552+int ispresizer_free()
2553+{
2554+ mutex_lock(&ispres_obj.ispres_mutex);
2555+ if (ispres_obj.res_inuse) {
2556+ ispres_obj.res_inuse = 0;
2557+ mutex_unlock(&ispres_obj.ispres_mutex);
2558+ isp_reg_and(OMAP3_ISP_IOMEM_MAIN, ISP_CTRL,
2559+ ~(ISPCTRL_RSZ_CLK_EN | ISPCTRL_SBL_WR0_RAM_EN));
2560+ return 0;
2561+ } else {
2562+ mutex_unlock(&ispres_obj.ispres_mutex);
2563+ DPRINTK_ISPRESZ("ISP_ERR : Resizer Module already freed\n");
2564+ return -EINVAL;
2565+ }
2566+}
2567+EXPORT_SYMBOL(ispresizer_free);
2568+
2569+/**
2570+ * ispresizer_config_datapath - Specifies which input to use in resizer module
2571+ * @input: Indicates the module that gives the image to resizer.
2572+ *
2573+ * Sets up the default resizer configuration according to the arguments.
2574+ *
2575+ * Returns 0 if successful, or -EINVAL if an unsupported input was requested.
2576+ **/
2577+int ispresizer_config_datapath(enum ispresizer_input input)
2578+{
2579+ u32 cnt = 0;
2580+ DPRINTK_ISPRESZ("ispresizer_config_datapath()+\n");
2581+ ispres_obj.resinput = input;
2582+ switch (input) {
2583+ case RSZ_OTFLY_YUV:
2584+ cnt &= ~ISPRSZ_CNT_INPTYP;
2585+ cnt &= ~ISPRSZ_CNT_INPSRC;
2586+ ispresizer_set_inaddr(0);
2587+ ispresizer_config_inlineoffset(0);
2588+ break;
2589+ case RSZ_MEM_YUV:
2590+ cnt |= ISPRSZ_CNT_INPSRC;
2591+ cnt &= ~ISPRSZ_CNT_INPTYP;
2592+ break;
2593+ case RSZ_MEM_COL8:
2594+ cnt |= ISPRSZ_CNT_INPSRC;
2595+ cnt |= ISPRSZ_CNT_INPTYP;
2596+ break;
2597+ default:
2598+ printk(KERN_ERR "ISP_ERR : Wrong Input\n");
2599+ return -EINVAL;
2600+ }
2601+ isp_reg_or(OMAP3_ISP_IOMEM_RESZ, ISPRSZ_CNT, cnt);
2602+ ispresizer_config_ycpos(0);
2603+ ispresizer_config_filter_coef(&ispreszdefcoef);
2604+ ispresizer_enable_cbilin(0);
2605+ ispresizer_config_luma_enhance(&ispreszdefaultyenh);
2606+ DPRINTK_ISPRESZ("ispresizer_config_datapath()-\n");
2607+ return 0;
2608+}
2609+EXPORT_SYMBOL(ispresizer_config_datapath);
2610+
2611+/**
2612+ * ispresizer_try_size - Validates input and output images size.
2613+ * @input_w: input width for the resizer in number of pixels per line
2614+ * @input_h: input height for the resizer in number of lines
2615+ * @output_w: output width from the resizer in number of pixels per line
2616+ * resizer when writing to memory needs this to be multiple of 16.
2617+ * @output_h: output height for the resizer in number of lines, must be even.
2618+ *
2619+ * Calculates the horizontal and vertical resize ratio, number of pixels to
2620+ * be cropped in the resizer module and checks the validity of various
2621+ * parameters. Formula used for calculation is:-
2622+ *
2623+ * 8-phase 4-tap mode :-
2624+ * inputwidth = (32 * sph + (ow - 1) * hrsz + 16) >> 8 + 7
2625+ * inputheight = (32 * spv + (oh - 1) * vrsz + 16) >> 8 + 4
2626+ * endpahse for width = ((32 * sph + (ow - 1) * hrsz + 16) >> 5) % 8
2627+ * endphase for height = ((32 * sph + (oh - 1) * hrsz + 16) >> 5) % 8
2628+ *
2629+ * 4-phase 7-tap mode :-
2630+ * inputwidth = (64 * sph + (ow - 1) * hrsz + 32) >> 8 + 7
2631+ * inputheight = (64 * spv + (oh - 1) * vrsz + 32) >> 8 + 7
2632+ * endpahse for width = ((64 * sph + (ow - 1) * hrsz + 32) >> 6) % 4
2633+ * endphase for height = ((64 * sph + (oh - 1) * hrsz + 32) >> 6) % 4
2634+ *
2635+ * Where:
2636+ * sph = Start phase horizontal
2637+ * spv = Start phase vertical
2638+ * ow = Output width
2639+ * oh = Output height
2640+ * hrsz = Horizontal resize value
2641+ * vrsz = Vertical resize value
2642+ *
2643+ * Fills up the output/input widht/height, horizontal/vertical resize ratio,
2644+ * horizontal/vertical crop variables in the isp_res structure.
2645+ **/
2646+int ispresizer_try_size(u32 *input_width, u32 *input_height, u32 *output_w,
2647+ u32 *output_h)
2648+{
2649+ u32 rsz, rsz_7, rsz_4;
2650+ u32 sph;
2651+ u32 input_w, input_h;
2652+ int max_in_otf, max_out_7tap;
2653+
2654+ input_w = *input_width;
2655+ input_h = *input_height;
2656+
2657+ if (input_w < 32 || input_h < 32) {
2658+ DPRINTK_ISPCCDC("ISP_ERR: RESIZER cannot handle input width"
2659+ " less than 32 pixels or height less than"
2660+ " 32\n");
2661+ return -EINVAL;
2662+ }
2663+ input_w -= 6;
2664+ input_h -= 6;
2665+
2666+ if (input_h > MAX_IN_HEIGHT)
2667+ return -EINVAL;
2668+
2669+ if (*output_w < 16)
2670+ *output_w = 16;
2671+
2672+ if (*output_h < 2)
2673+ *output_h = 2;
2674+
2675+ if (omap_rev() == OMAP3430_REV_ES1_0) {
2676+ max_in_otf = MAX_IN_WIDTH_ONTHEFLY_MODE;
2677+ max_out_7tap = MAX_7TAP_VRSZ_OUTWIDTH;
2678+ } else {
2679+ max_in_otf = MAX_IN_WIDTH_ONTHEFLY_MODE_ES2;
2680+ max_out_7tap = MAX_7TAP_VRSZ_OUTWIDTH_ES2;
2681+ }
2682+
2683+ if (ispres_obj.resinput == RSZ_OTFLY_YUV) {
2684+ if (input_w > max_in_otf)
2685+ return -EINVAL;
2686+ } else {
2687+ if (input_w > MAX_IN_WIDTH_MEMORY_MODE)
2688+ return -EINVAL;
2689+ }
2690+
2691+ *output_h &= 0xfffffffe;
2692+ sph = DEFAULTSTPHASE;
2693+
2694+ rsz_7 = ((input_h - 7) * 256) / (*output_h - 1);
2695+ rsz_4 = ((input_h - 4) * 256) / (*output_h - 1);
2696+
2697+ rsz = (input_h * 256) / *output_h;
2698+
2699+ if (rsz <= MID_RESIZE_VALUE) {
2700+ rsz = rsz_4;
2701+ if (rsz < MINIMUM_RESIZE_VALUE) {
2702+ rsz = MINIMUM_RESIZE_VALUE;
2703+ *output_h = (((input_h - 4) * 256) / rsz) + 1;
2704+ printk(KERN_INFO "%s: using output_h %d instead\n",
2705+ __func__, *output_h);
2706+ }
2707+ } else {
2708+ rsz = rsz_7;
2709+ if (*output_w > max_out_7tap)
2710+ *output_w = max_out_7tap;
2711+ if (rsz > MAXIMUM_RESIZE_VALUE) {
2712+ rsz = MAXIMUM_RESIZE_VALUE;
2713+ *output_h = (((input_h - 7) * 256) / rsz) + 1;
2714+ printk(KERN_INFO "%s: using output_h %d instead\n",
2715+ __func__, *output_h);
2716+ }
2717+ }
2718+
2719+ if (rsz > MID_RESIZE_VALUE) {
2720+ input_h =
2721+ (((64 * sph) + ((*output_h - 1) * rsz) + 32) / 256) + 7;
2722+ } else {
2723+ input_h =
2724+ (((32 * sph) + ((*output_h - 1) * rsz) + 16) / 256) + 4;
2725+ }
2726+
2727+ ispres_obj.outputheight = *output_h;
2728+ ispres_obj.v_resz = rsz;
2729+ ispres_obj.inputheight = input_h;
2730+ ispres_obj.ipht_crop = DEFAULTSTPIXEL;
2731+ ispres_obj.v_startphase = sph;
2732+
2733+ *output_w &= 0xfffffff0;
2734+ sph = DEFAULTSTPHASE;
2735+
2736+ rsz_7 = ((input_w - 7) * 256) / (*output_w - 1);
2737+ rsz_4 = ((input_w - 4) * 256) / (*output_w - 1);
2738+
2739+ rsz = (input_w * 256) / *output_w;
2740+ if (rsz > MID_RESIZE_VALUE) {
2741+ rsz = rsz_7;
2742+ if (rsz > MAXIMUM_RESIZE_VALUE) {
2743+ rsz = MAXIMUM_RESIZE_VALUE;
2744+ *output_w = (((input_w - 7) * 256) / rsz) + 1;
2745+ *output_w = (*output_w + 0xf) & 0xfffffff0;
2746+ printk(KERN_INFO "%s: using output_w %d instead\n",
2747+ __func__, *output_w);
2748+ }
2749+ } else {
2750+ rsz = rsz_4;
2751+ if (rsz < MINIMUM_RESIZE_VALUE) {
2752+ rsz = MINIMUM_RESIZE_VALUE;
2753+ *output_w = (((input_w - 4) * 256) / rsz) + 1;
2754+ *output_w = (*output_w + 0xf) & 0xfffffff0;
2755+ printk(KERN_INFO "%s: using output_w %d instead\n",
2756+ __func__, *output_w);
2757+ }
2758+ }
2759+
2760+ /* Recalculate input based on TRM equations */
2761+ if (rsz > MID_RESIZE_VALUE) {
2762+ input_w =
2763+ (((64 * sph) + ((*output_w - 1) * rsz) + 32) / 256) + 7;
2764+ } else {
2765+ input_w =
2766+ (((32 * sph) + ((*output_w - 1) * rsz) + 16) / 256) + 7;
2767+ }
2768+
2769+ ispres_obj.outputwidth = *output_w;
2770+ ispres_obj.h_resz = rsz;
2771+ ispres_obj.inputwidth = input_w;
2772+ ispres_obj.ipwd_crop = DEFAULTSTPIXEL;
2773+ ispres_obj.h_startphase = sph;
2774+
2775+ *input_height = input_h;
2776+ *input_width = input_w;
2777+ return 0;
2778+}
2779+EXPORT_SYMBOL(ispresizer_try_size);
2780+
2781+/**
2782+ * ispresizer_config_size - Configures input and output image size.
2783+ * @input_w: input width for the resizer in number of pixels per line.
2784+ * @input_h: input height for the resizer in number of lines.
2785+ * @output_w: output width from the resizer in number of pixels per line.
2786+ * @output_h: output height for the resizer in number of lines.
2787+ *
2788+ * Configures the appropriate values stored in the isp_res structure in the
2789+ * resizer registers.
2790+ *
2791+ * Returns 0 if successful, or -EINVAL if passed values haven't been verified
2792+ * with ispresizer_try_size() previously.
2793+ **/
2794+int ispresizer_config_size(u32 input_w, u32 input_h, u32 output_w,
2795+ u32 output_h)
2796+{
2797+ int i, j;
2798+ u32 res;
2799+ DPRINTK_ISPRESZ("ispresizer_config_size()+, input_w = %d,input_h ="
2800+ " %d, output_w = %d, output_h"
2801+ " = %d,hresz = %d,vresz = %d,"
2802+ " hcrop = %d, vcrop = %d,"
2803+ " hstph = %d, vstph = %d\n",
2804+ ispres_obj.inputwidth,
2805+ ispres_obj.inputheight,
2806+ ispres_obj.outputwidth,
2807+ ispres_obj.outputheight,
2808+ ispres_obj.h_resz,
2809+ ispres_obj.v_resz,
2810+ ispres_obj.ipwd_crop,
2811+ ispres_obj.ipht_crop,
2812+ ispres_obj.h_startphase,
2813+ ispres_obj.v_startphase);
2814+ if ((output_w != ispres_obj.outputwidth)
2815+ || (output_h != ispres_obj.outputheight)) {
2816+ printk(KERN_ERR "Output parameters passed do not match the"
2817+ " values calculated by the"
2818+ " trysize passed w %d, h %d"
2819+ " \n", output_w , output_h);
2820+ return -EINVAL;
2821+ }
2822+
2823+ /* Set Resizer input address and offset adderss */
2824+ ispresizer_config_inlineoffset(isp_reg_readl(OMAP3_ISP_IOMEM_PREV,
2825+ ISPPRV_WADD_OFFSET));
2826+
2827+ res = isp_reg_readl(OMAP3_ISP_IOMEM_RESZ, ISPRSZ_CNT) &
2828+ ~(ISPRSZ_CNT_HSTPH_MASK | ISPRSZ_CNT_VSTPH_MASK);
2829+ isp_reg_writel(res |
2830+ (ispres_obj.h_startphase << ISPRSZ_CNT_HSTPH_SHIFT) |
2831+ (ispres_obj.v_startphase << ISPRSZ_CNT_VSTPH_SHIFT),
2832+ OMAP3_ISP_IOMEM_RESZ,
2833+ ISPRSZ_CNT);
2834+ /* Set start address for cropping */
2835+ isp_reg_writel(ispres_obj.tmp_buf + 2 *
2836+ (ispres_obj.ipht_crop * ispres_obj.inputwidth +
2837+ (ispres_obj.ipwd_crop & ~15)),
2838+ OMAP3_ISP_IOMEM_RESZ, ISPRSZ_SDR_INADD);
2839+
2840+ isp_reg_writel(
2841+ ((ispres_obj.ipwd_crop & 15) << ISPRSZ_IN_START_HORZ_ST_SHIFT) |
2842+ (0x00 << ISPRSZ_IN_START_VERT_ST_SHIFT),
2843+ OMAP3_ISP_IOMEM_RESZ, ISPRSZ_IN_START);
2844+
2845+ isp_reg_writel((0x00 << ISPRSZ_IN_START_HORZ_ST_SHIFT) |
2846+ (0x00 << ISPRSZ_IN_START_VERT_ST_SHIFT),
2847+ OMAP3_ISP_IOMEM_RESZ,
2848+ ISPRSZ_IN_START);
2849+
2850+ isp_reg_writel((ispres_obj.inputwidth << ISPRSZ_IN_SIZE_HORZ_SHIFT) |
2851+ (ispres_obj.inputheight <<
2852+ ISPRSZ_IN_SIZE_VERT_SHIFT),
2853+ OMAP3_ISP_IOMEM_RESZ,
2854+ ISPRSZ_IN_SIZE);
2855+ if (!ispres_obj.algo) {
2856+ isp_reg_writel((output_w << ISPRSZ_OUT_SIZE_HORZ_SHIFT) |
2857+ (output_h << ISPRSZ_OUT_SIZE_VERT_SHIFT),
2858+ OMAP3_ISP_IOMEM_RESZ,
2859+ ISPRSZ_OUT_SIZE);
2860+ } else {
2861+ isp_reg_writel(((output_w - 4) << ISPRSZ_OUT_SIZE_HORZ_SHIFT) |
2862+ (output_h << ISPRSZ_OUT_SIZE_VERT_SHIFT),
2863+ OMAP3_ISP_IOMEM_RESZ,
2864+ ISPRSZ_OUT_SIZE);
2865+ }
2866+
2867+ res = isp_reg_readl(OMAP3_ISP_IOMEM_RESZ, ISPRSZ_CNT) &
2868+ ~(ISPRSZ_CNT_HRSZ_MASK | ISPRSZ_CNT_VRSZ_MASK);
2869+ isp_reg_writel(res |
2870+ ((ispres_obj.h_resz - 1) << ISPRSZ_CNT_HRSZ_SHIFT) |
2871+ ((ispres_obj.v_resz - 1) << ISPRSZ_CNT_VRSZ_SHIFT),
2872+ OMAP3_ISP_IOMEM_RESZ,
2873+ ISPRSZ_CNT);
2874+ if (ispres_obj.h_resz <= MID_RESIZE_VALUE) {
2875+ j = 0;
2876+ for (i = 0; i < 16; i++) {
2877+ isp_reg_writel(
2878+ (ispres_obj.coeflist.h_filter_coef_4tap[j]
2879+ << ISPRSZ_HFILT10_COEF0_SHIFT) |
2880+ (ispres_obj.coeflist.h_filter_coef_4tap[j + 1]
2881+ << ISPRSZ_HFILT10_COEF1_SHIFT),
2882+ OMAP3_ISP_IOMEM_RESZ,
2883+ ISPRSZ_HFILT10 + (i * 0x04));
2884+ j += 2;
2885+ }
2886+ } else {
2887+ j = 0;
2888+ for (i = 0; i < 16; i++) {
2889+ if ((i + 1) % 4 == 0) {
2890+ isp_reg_writel((ispres_obj.coeflist.
2891+ h_filter_coef_7tap[j] <<
2892+ ISPRSZ_HFILT10_COEF0_SHIFT),
2893+ OMAP3_ISP_IOMEM_RESZ,
2894+ ISPRSZ_HFILT10 + (i * 0x04));
2895+ j += 1;
2896+ } else {
2897+ isp_reg_writel((ispres_obj.coeflist.
2898+ h_filter_coef_7tap[j] <<
2899+ ISPRSZ_HFILT10_COEF0_SHIFT) |
2900+ (ispres_obj.coeflist.
2901+ h_filter_coef_7tap[j+1] <<
2902+ ISPRSZ_HFILT10_COEF1_SHIFT),
2903+ OMAP3_ISP_IOMEM_RESZ,
2904+ ISPRSZ_HFILT10 + (i * 0x04));
2905+ j += 2;
2906+ }
2907+ }
2908+ }
2909+ if (ispres_obj.v_resz <= MID_RESIZE_VALUE) {
2910+ j = 0;
2911+ for (i = 0; i < 16; i++) {
2912+ isp_reg_writel((ispres_obj.coeflist.
2913+ v_filter_coef_4tap[j] <<
2914+ ISPRSZ_VFILT10_COEF0_SHIFT) |
2915+ (ispres_obj.coeflist.
2916+ v_filter_coef_4tap[j + 1] <<
2917+ ISPRSZ_VFILT10_COEF1_SHIFT),
2918+ OMAP3_ISP_IOMEM_RESZ,
2919+ ISPRSZ_VFILT10 + (i * 0x04));
2920+ j += 2;
2921+ }
2922+ } else {
2923+ j = 0;
2924+ for (i = 0; i < 16; i++) {
2925+ if ((i + 1) % 4 == 0) {
2926+ isp_reg_writel((ispres_obj.coeflist.
2927+ v_filter_coef_7tap[j] <<
2928+ ISPRSZ_VFILT10_COEF0_SHIFT),
2929+ OMAP3_ISP_IOMEM_RESZ,
2930+ ISPRSZ_VFILT10 + (i * 0x04));
2931+ j += 1;
2932+ } else {
2933+ isp_reg_writel((ispres_obj.coeflist.
2934+ v_filter_coef_7tap[j] <<
2935+ ISPRSZ_VFILT10_COEF0_SHIFT) |
2936+ (ispres_obj.coeflist.
2937+ v_filter_coef_7tap[j+1] <<
2938+ ISPRSZ_VFILT10_COEF1_SHIFT),
2939+ OMAP3_ISP_IOMEM_RESZ,
2940+ ISPRSZ_VFILT10 + (i * 0x04));
2941+ j += 2;
2942+ }
2943+ }
2944+ }
2945+
2946+ ispresizer_config_outlineoffset(output_w*2);
2947+ DPRINTK_ISPRESZ("ispresizer_config_size()-\n");
2948+ return 0;
2949+}
2950+EXPORT_SYMBOL(ispresizer_config_size);
2951+
2952+void __ispresizer_enable(int enable)
2953+{
2954+ int val;
2955+ DPRINTK_ISPRESZ("+ispresizer_enable()+\n");
2956+ if (enable) {
2957+ val = (isp_reg_readl(OMAP3_ISP_IOMEM_RESZ, ISPRSZ_PCR) & 0x2) |
2958+ ISPRSZ_PCR_ENABLE;
2959+ } else {
2960+ val = isp_reg_readl(OMAP3_ISP_IOMEM_RESZ, ISPRSZ_PCR) &
2961+ ~ISPRSZ_PCR_ENABLE;
2962+ }
2963+ isp_reg_writel(val, OMAP3_ISP_IOMEM_RESZ, ISPRSZ_PCR);
2964+ DPRINTK_ISPRESZ("+ispresizer_enable()-\n");
2965+}
2966+
2967+/**
2968+ * ispresizer_enable - Enables the resizer module.
2969+ * @enable: 1 - Enable, 0 - Disable
2970+ *
2971+ * Client should configure all the sub modules in resizer before this.
2972+ **/
2973+void ispresizer_enable(int enable)
2974+{
2975+ __ispresizer_enable(enable);
2976+ ispres_obj.pm_state = enable;
2977+}
2978+EXPORT_SYMBOL(ispresizer_enable);
2979+
2980+/**
2981+ * ispresizer_suspend - Suspend resizer module.
2982+ **/
2983+void ispresizer_suspend(void)
2984+{
2985+ if (ispres_obj.pm_state)
2986+ __ispresizer_enable(0);
2987+}
2988+EXPORT_SYMBOL(ispresizer_suspend);
2989+
2990+/**
2991+ * ispresizer_resume - Resume resizer module.
2992+ **/
2993+void ispresizer_resume(void)
2994+{
2995+ if (ispres_obj.pm_state)
2996+ __ispresizer_enable(1);
2997+}
2998+EXPORT_SYMBOL(ispresizer_resume);
2999+
3000+/**
3001+ * ispresizer_busy - Checks if ISP resizer is busy.
3002+ *
3003+ * Returns busy field from ISPRSZ_PCR register.
3004+ **/
3005+int ispresizer_busy(void)
3006+{
3007+ return isp_reg_readl(OMAP3_ISP_IOMEM_RESZ, ISPRSZ_PCR) &
3008+ ISPPRV_PCR_BUSY;
3009+}
3010+EXPORT_SYMBOL(ispresizer_busy);
3011+
3012+/**
3013+ * ispresizer_config_startphase - Sets the horizontal and vertical start phase.
3014+ * @hstartphase: horizontal start phase (0 - 7).
3015+ * @vstartphase: vertical startphase (0 - 7).
3016+ *
3017+ * This API just updates the isp_res struct. Actual register write happens in
3018+ * ispresizer_config_size.
3019+ **/
3020+void ispresizer_config_startphase(u8 hstartphase, u8 vstartphase)
3021+{
3022+ DPRINTK_ISPRESZ("ispresizer_config_startphase()+\n");
3023+ ispres_obj.h_startphase = hstartphase;
3024+ ispres_obj.v_startphase = vstartphase;
3025+ DPRINTK_ISPRESZ("ispresizer_config_startphase()-\n");
3026+}
3027+EXPORT_SYMBOL(ispresizer_config_startphase);
3028+
3029+/**
3030+ * ispresizer_config_ycpos - Specifies if output should be in YC or CY format.
3031+ * @yc: 0 - YC format, 1 - CY format
3032+ **/
3033+void ispresizer_config_ycpos(u8 yc)
3034+{
3035+ DPRINTK_ISPRESZ("ispresizer_config_ycpos()+\n");
3036+ isp_reg_and_or(OMAP3_ISP_IOMEM_RESZ, ISPRSZ_CNT, ~ISPRSZ_CNT_YCPOS,
3037+ (yc ? ISPRSZ_CNT_YCPOS : 0));
3038+ DPRINTK_ISPRESZ("ispresizer_config_ycpos()-\n");
3039+}
3040+EXPORT_SYMBOL(ispresizer_config_ycpos);
3041+
3042+/**
3043+ * Sets the chrominance algorithm
3044+ * @cbilin: 0 - chrominance uses same processing as luminance,
3045+ * 1 - bilinear interpolation processing
3046+ **/
3047+void ispresizer_enable_cbilin(u8 enable)
3048+{
3049+ DPRINTK_ISPRESZ("ispresizer_enable_cbilin()+\n");
3050+ isp_reg_and_or(OMAP3_ISP_IOMEM_RESZ, ISPRSZ_CNT, ~ISPRSZ_CNT_CBILIN,
3051+ (enable ? ISPRSZ_CNT_CBILIN : 0));
3052+ DPRINTK_ISPRESZ("ispresizer_enable_cbilin()-\n");
3053+}
3054+EXPORT_SYMBOL(ispresizer_enable_cbilin);
3055+
3056+/**
3057+ * ispresizer_config_luma_enhance - Configures luminance enhancer parameters.
3058+ * @yenh: Pointer to structure containing desired values for core, slope, gain
3059+ * and algo parameters.
3060+ **/
3061+void ispresizer_config_luma_enhance(struct isprsz_yenh *yenh)
3062+{
3063+ DPRINTK_ISPRESZ("ispresizer_config_luma_enhance()+\n");
3064+ ispres_obj.algo = yenh->algo;
3065+ isp_reg_writel((yenh->algo << ISPRSZ_YENH_ALGO_SHIFT) |
3066+ (yenh->gain << ISPRSZ_YENH_GAIN_SHIFT) |
3067+ (yenh->slope << ISPRSZ_YENH_SLOP_SHIFT) |
3068+ (yenh->coreoffset << ISPRSZ_YENH_CORE_SHIFT),
3069+ OMAP3_ISP_IOMEM_RESZ,
3070+ ISPRSZ_YENH);
3071+ DPRINTK_ISPRESZ("ispresizer_config_luma_enhance()-\n");
3072+}
3073+EXPORT_SYMBOL(ispresizer_config_luma_enhance);
3074+
3075+/**
3076+ * ispresizer_config_filter_coef - Sets filter coefficients for 4 & 7-tap mode.
3077+ * This API just updates the isp_res struct.Actual register write happens in
3078+ * ispresizer_config_size.
3079+ * @coef: Structure containing horizontal and vertical filter coefficients for
3080+ * both 4-tap and 7-tap mode.
3081+ **/
3082+void ispresizer_config_filter_coef(struct isprsz_coef *coef)
3083+{
3084+ int i;
3085+ DPRINTK_ISPRESZ("ispresizer_config_filter_coef()+\n");
3086+ for (i = 0; i < 32; i++) {
3087+ ispres_obj.coeflist.h_filter_coef_4tap[i] =
3088+ coef->h_filter_coef_4tap[i];
3089+ ispres_obj.coeflist.v_filter_coef_4tap[i] =
3090+ coef->v_filter_coef_4tap[i];
3091+ }
3092+ for (i = 0; i < 28; i++) {
3093+ ispres_obj.coeflist.h_filter_coef_7tap[i] =
3094+ coef->h_filter_coef_7tap[i];
3095+ ispres_obj.coeflist.v_filter_coef_7tap[i] =
3096+ coef->v_filter_coef_7tap[i];
3097+ }
3098+ DPRINTK_ISPRESZ("ispresizer_config_filter_coef()-\n");
3099+}
3100+EXPORT_SYMBOL(ispresizer_config_filter_coef);
3101+
3102+/**
3103+ * ispresizer_config_inlineoffset - Configures the read address line offset.
3104+ * @offset: Line Offset for the input image.
3105+ *
3106+ * Returns 0 if successful, or -EINVAL if offset is not 32 bits aligned.
3107+ **/
3108+int ispresizer_config_inlineoffset(u32 offset)
3109+{
3110+ DPRINTK_ISPRESZ("ispresizer_config_inlineoffset()+\n");
3111+ if (offset % 32)
3112+ return -EINVAL;
3113+ isp_reg_writel(offset << ISPRSZ_SDR_INOFF_OFFSET_SHIFT,
3114+ OMAP3_ISP_IOMEM_RESZ, ISPRSZ_SDR_INOFF);
3115+ DPRINTK_ISPRESZ("ispresizer_config_inlineoffset()-\n");
3116+ return 0;
3117+}
3118+EXPORT_SYMBOL(ispresizer_config_inlineoffset);
3119+
3120+/**
3121+ * ispresizer_set_inaddr - Sets the memory address of the input frame.
3122+ * @addr: 32bit memory address aligned on 32byte boundary.
3123+ *
3124+ * Returns 0 if successful, or -EINVAL if address is not 32 bits aligned.
3125+ **/
3126+int ispresizer_set_inaddr(u32 addr)
3127+{
3128+ DPRINTK_ISPRESZ("ispresizer_set_inaddr()+\n");
3129+ if (addr % 32)
3130+ return -EINVAL;
3131+ isp_reg_writel(addr << ISPRSZ_SDR_INADD_ADDR_SHIFT,
3132+ OMAP3_ISP_IOMEM_RESZ, ISPRSZ_SDR_INADD);
3133+ ispres_obj.tmp_buf = addr;
3134+ DPRINTK_ISPRESZ("ispresizer_set_inaddr()-\n");
3135+ return 0;
3136+}
3137+EXPORT_SYMBOL(ispresizer_set_inaddr);
3138+
3139+/**
3140+ * ispresizer_config_outlineoffset - Configures the write address line offset.
3141+ * @offset: Line offset for the preview output.
3142+ *
3143+ * Returns 0 if successful, or -EINVAL if address is not 32 bits aligned.
3144+ **/
3145+int ispresizer_config_outlineoffset(u32 offset)
3146+{
3147+ DPRINTK_ISPRESZ("ispresizer_config_outlineoffset()+\n");
3148+ if (offset % 32)
3149+ return -EINVAL;
3150+ isp_reg_writel(offset << ISPRSZ_SDR_OUTOFF_OFFSET_SHIFT,
3151+ OMAP3_ISP_IOMEM_RESZ, ISPRSZ_SDR_OUTOFF);
3152+ DPRINTK_ISPRESZ("ispresizer_config_outlineoffset()-\n");
3153+ return 0;
3154+}
3155+EXPORT_SYMBOL(ispresizer_config_outlineoffset);
3156+
3157+/**
3158+ * Configures the memory address to which the output frame is written.
3159+ * @addr: 32bit memory address aligned on 32byte boundary.
3160+ **/
3161+int ispresizer_set_outaddr(u32 addr)
3162+{
3163+ DPRINTK_ISPRESZ("ispresizer_set_outaddr()+\n");
3164+ if (addr % 32)
3165+ return -EINVAL;
3166+ isp_reg_writel(addr << ISPRSZ_SDR_OUTADD_ADDR_SHIFT,
3167+ OMAP3_ISP_IOMEM_RESZ, ISPRSZ_SDR_OUTADD);
3168+ DPRINTK_ISPRESZ("ispresizer_set_outaddr()-\n");
3169+ return 0;
3170+}
3171+EXPORT_SYMBOL(ispresizer_set_outaddr);
3172+
3173+/**
3174+ * ispresizer_save_context - Saves the values of the resizer module registers.
3175+ **/
3176+void ispresizer_save_context(void)
3177+{
3178+ DPRINTK_ISPRESZ("Saving context\n");
3179+ isp_save_context(isprsz_reg_list);
3180+}
3181+EXPORT_SYMBOL(ispresizer_save_context);
3182+
3183+/**
3184+ * ispresizer_restore_context - Restores resizer module register values.
3185+ **/
3186+void ispresizer_restore_context(void)
3187+{
3188+ DPRINTK_ISPRESZ("Restoring context\n");
3189+ isp_restore_context(isprsz_reg_list);
3190+}
3191+EXPORT_SYMBOL(ispresizer_restore_context);
3192+
3193+/**
3194+ * ispresizer_print_status - Prints the values of the resizer module registers.
3195+ **/
3196+void ispresizer_print_status()
3197+{
3198+ if (!is_ispresz_debug_enabled())
3199+ return;
3200+ DPRINTK_ISPRESZ("###ISP_CTRL inresizer =0x%x\n",
3201+ isp_reg_readl(OMAP3_ISP_IOMEM_MAIN, ISP_CTRL));
3202+ DPRINTK_ISPRESZ("###ISP_IRQ0ENABLE in resizer =0x%x\n",
3203+ isp_reg_readl(OMAP3_ISP_IOMEM_MAIN, ISP_IRQ0ENABLE));
3204+ DPRINTK_ISPRESZ("###ISP_IRQ0STATUS in resizer =0x%x\n",
3205+ isp_reg_readl(OMAP3_ISP_IOMEM_MAIN, ISP_IRQ0STATUS));
3206+ DPRINTK_ISPRESZ("###RSZ PCR =0x%x\n",
3207+ isp_reg_readl(OMAP3_ISP_IOMEM_RESZ, ISPRSZ_PCR));
3208+ DPRINTK_ISPRESZ("###RSZ CNT =0x%x\n",
3209+ isp_reg_readl(OMAP3_ISP_IOMEM_RESZ, ISPRSZ_CNT));
3210+ DPRINTK_ISPRESZ("###RSZ OUT SIZE =0x%x\n",
3211+ isp_reg_readl(OMAP3_ISP_IOMEM_RESZ, ISPRSZ_OUT_SIZE));
3212+ DPRINTK_ISPRESZ("###RSZ IN START =0x%x\n",
3213+ isp_reg_readl(OMAP3_ISP_IOMEM_RESZ, ISPRSZ_IN_START));
3214+ DPRINTK_ISPRESZ("###RSZ IN SIZE =0x%x\n",
3215+ isp_reg_readl(OMAP3_ISP_IOMEM_RESZ, ISPRSZ_IN_SIZE));
3216+ DPRINTK_ISPRESZ("###RSZ SDR INADD =0x%x\n",
3217+ isp_reg_readl(OMAP3_ISP_IOMEM_RESZ, ISPRSZ_SDR_INADD));
3218+ DPRINTK_ISPRESZ("###RSZ SDR INOFF =0x%x\n",
3219+ isp_reg_readl(OMAP3_ISP_IOMEM_RESZ, ISPRSZ_SDR_INOFF));
3220+ DPRINTK_ISPRESZ("###RSZ SDR OUTADD =0x%x\n",
3221+ isp_reg_readl(OMAP3_ISP_IOMEM_RESZ, ISPRSZ_SDR_OUTADD));
3222+ DPRINTK_ISPRESZ("###RSZ SDR OTOFF =0x%x\n",
3223+ isp_reg_readl(OMAP3_ISP_IOMEM_RESZ, ISPRSZ_SDR_OUTOFF));
3224+ DPRINTK_ISPRESZ("###RSZ YENH =0x%x\n",
3225+ isp_reg_readl(OMAP3_ISP_IOMEM_RESZ, ISPRSZ_YENH));
3226+}
3227+EXPORT_SYMBOL(ispresizer_print_status);
3228+
3229+/**
3230+ * isp_resizer_init - Module Initialisation.
3231+ *
3232+ * Always returns 0.
3233+ **/
3234+int __init isp_resizer_init(void)
3235+{
3236+ mutex_init(&ispres_obj.ispres_mutex);
3237+ ispres_obj.pm_state = 0;
3238+ return 0;
3239+}
3240+
3241+/**
3242+ * isp_resizer_cleanup - Module Cleanup.
3243+ **/
3244+void isp_resizer_cleanup(void)
3245+{
3246+}
3247diff --git a/drivers/media/video/isp/ispresizer.h b/drivers/media/video/isp/ispresizer.h
3248new file mode 100644
3249index 0000000..4e92225
3250--- /dev/null
3251+++ b/drivers/media/video/isp/ispresizer.h
3252@@ -0,0 +1,158 @@
3253+/*
3254+ * ispresizer.h
3255+ *
3256+ * Driver header file for Resizer module in TI's OMAP3 Camera ISP
3257+ *
3258+ * Copyright (C) 2009 Texas Instruments, Inc.
3259+ *
3260+ * Contributors:
3261+ * Sameer Venkatraman <sameerv@ti.com>
3262+ * Mohit Jalori
3263+ * Sergio Aguirre <saaguirre@ti.com>
3264+ *
3265+ * This package is free software; you can redistribute it and/or modify
3266+ * it under the terms of the GNU General Public License version 2 as
3267+ * published by the Free Software Foundation.
3268+ *
3269+ * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
3270+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
3271+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
3272+ */
3273+
3274+#ifndef OMAP_ISP_RESIZER_H
3275+#define OMAP_ISP_RESIZER_H
3276+
3277+/*
3278+ * Resizer Constants
3279+ */
3280+#define MAX_IN_WIDTH_MEMORY_MODE 4095
3281+
3282+#define MAX_IN_WIDTH_ONTHEFLY_MODE 1280
3283+#define MAX_IN_WIDTH_ONTHEFLY_MODE_ES2 4095
3284+#define MAX_IN_HEIGHT 4095
3285+#define MINIMUM_RESIZE_VALUE 64
3286+#define MAXIMUM_RESIZE_VALUE 1024
3287+#define MID_RESIZE_VALUE 512
3288+
3289+#define MAX_7TAP_HRSZ_OUTWIDTH 1280
3290+#define MAX_7TAP_VRSZ_OUTWIDTH 640
3291+
3292+#define MAX_7TAP_HRSZ_OUTWIDTH_ES2 3300
3293+#define MAX_7TAP_VRSZ_OUTWIDTH_ES2 1650
3294+
3295+#define DEFAULTSTPIXEL 0
3296+#define DEFAULTSTPHASE 1
3297+#define DEFAULTHSTPIXEL4TAPMODE 3
3298+#define FOURPHASE 4
3299+#define EIGHTPHASE 8
3300+#define RESIZECONSTANT 256
3301+#define SHIFTER4TAPMODE 0
3302+#define SHIFTER7TAPMODE 1
3303+#define DEFAULTOFFSET 7
3304+#define OFFSETVERT4TAPMODE 4
3305+#define OPWDALIGNCONSTANT 0xfffffff0
3306+
3307+/*
3308+ * The client is supposed to call resizer API in the following sequence:
3309+ * - request()
3310+ * - config_datatpath()
3311+ * - optionally config/enable sub modules
3312+ * - try/config size
3313+ * - setup callback
3314+ * - setup in/out memory offsets and ptrs
3315+ * - enable()
3316+ * ...
3317+ * - disable()
3318+ * - free()
3319+ */
3320+
3321+enum ispresizer_input {
3322+ RSZ_OTFLY_YUV,
3323+ RSZ_MEM_YUV,
3324+ RSZ_MEM_COL8
3325+};
3326+
3327+/**
3328+ * struct isprsz_coef - Structure for resizer filter coeffcients.
3329+ * @h_filter_coef_4tap: Horizontal filter coefficients for 8-phase/4-tap
3330+ * mode (.5x-4x)
3331+ * @v_filter_coef_4tap: Vertical filter coefficients for 8-phase/4-tap
3332+ * mode (.5x-4x)
3333+ * @h_filter_coef_7tap: Horizontal filter coefficients for 4-phase/7-tap
3334+ * mode (.25x-.5x)
3335+ * @v_filter_coef_7tap: Vertical filter coefficients for 4-phase/7-tap
3336+ * mode (.25x-.5x)
3337+ */
3338+struct isprsz_coef {
3339+ u16 h_filter_coef_4tap[32];
3340+ u16 v_filter_coef_4tap[32];
3341+ u16 h_filter_coef_7tap[28];
3342+ u16 v_filter_coef_7tap[28];
3343+};
3344+
3345+/**
3346+ * struct isprsz_yenh - Structure for resizer luminance enhancer parameters.
3347+ * @algo: Algorithm select.
3348+ * @gain: Maximum gain.
3349+ * @slope: Slope.
3350+ * @coreoffset: Coring offset.
3351+ */
3352+struct isprsz_yenh {
3353+ u8 algo;
3354+ u8 gain;
3355+ u8 slope;
3356+ u8 coreoffset;
3357+};
3358+
3359+void ispresizer_config_shadow_registers(void);
3360+
3361+int ispresizer_request(void);
3362+
3363+int ispresizer_free(void);
3364+
3365+int ispresizer_config_datapath(enum ispresizer_input input);
3366+
3367+void ispresizer_enable_cbilin(u8 enable);
3368+
3369+void ispresizer_config_ycpos(u8 yc);
3370+
3371+void ispresizer_config_startphase(u8 hstartphase, u8 vstartphase);
3372+
3373+void ispresizer_config_filter_coef(struct isprsz_coef *coef);
3374+
3375+void ispresizer_config_luma_enhance(struct isprsz_yenh *yenh);
3376+
3377+int ispresizer_try_size(u32 *input_w, u32 *input_h, u32 *output_w,
3378+ u32 *output_h);
3379+
3380+void ispresizer_applycrop(void);
3381+
3382+void ispresizer_trycrop(u32 left, u32 top, u32 width, u32 height, u32 ow,
3383+ u32 oh);
3384+
3385+int ispresizer_config_size(u32 input_w, u32 input_h, u32 output_w,
3386+ u32 output_h);
3387+
3388+int ispresizer_config_inlineoffset(u32 offset);
3389+
3390+int ispresizer_set_inaddr(u32 addr);
3391+
3392+int ispresizer_config_outlineoffset(u32 offset);
3393+
3394+int ispresizer_set_outaddr(u32 addr);
3395+
3396+void ispresizer_enable(int enable);
3397+
3398+void ispresizer_suspend(void);
3399+
3400+void ispresizer_resume(void);
3401+
3402+int ispresizer_busy(void);
3403+
3404+void ispresizer_save_context(void);
3405+
3406+void ispresizer_restore_context(void);
3407+
3408+void ispresizer_print_status(void);
3409+
3410+#endif /* OMAP_ISP_RESIZER_H */
3411--
34121.5.6.5
3413