1 From 926b51afea146826c8076e5fb305eaa0332399b4 Mon Sep 17 00:00:00 2001
2 From: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>
3 Date: Tue, 10 Mar 2009 10:49:02 +0200
4 Subject: [PATCH] omap3isp: Add ISP backend (PRV and RSZ)
6 Signed-off-by: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>
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
18 diff --git a/drivers/media/video/isp/isppreview.c b/drivers/media/video/isp/isppreview.c
20 index 0000000..17f1abc
22 +++ b/drivers/media/video/isp/isppreview.c
27 + * Driver Library for Preview module in TI's OMAP3 Camera ISP
29 + * Copyright (C) 2009 Texas Instruments, Inc.
32 + * Senthilvadivu Guruswamy <svadivu@ti.com>
33 + * Pallavi Kulkarni <p-kulkarni@ti.com>
34 + * Sergio Aguirre <saaguirre@ti.com>
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.
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.
45 +#include <linux/mutex.h>
46 +#include <linux/module.h>
47 +#include <linux/uaccess.h>
51 +#include "isppreview.h"
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;
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}
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}
108 +/* Default values in Office Flourescent Light for RGB to YUV Conversion*/
109 +static struct ispprev_csc flr_prev_csc[] = {
111 + { /* CSC Coef Matrix */
115 + }, /* CSC Offset */
119 + { /* CSC Coef Matrix BW */
123 + }, /* CSC Offset */
127 + { /* CSC Coef Matrix Sepia */
131 + }, /* CSC Offset */
137 +/* Default values in Office Flourescent Light for CFA Gradient*/
138 +#define FLR_CFA_GRADTHRS_HORZ 0x28
139 +#define FLR_CFA_GRADTHRS_VERT 0x28
141 +/* Default values in Office Flourescent Light for Chroma Suppression*/
142 +#define FLR_CSUP_GAIN 0x0D
143 +#define FLR_CSUP_THRES 0xEB
145 +/* Default values in Office Flourescent Light for Noise Filter*/
146 +#define FLR_NF_STRGTH 0x03
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
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
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
165 +static int update_color_matrix;
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.
190 + * This structure is used to store the OMAP ISP Preview module Information.
192 +static struct isp_prev {
199 + enum preview_input prev_inpfmt;
200 + enum preview_output prev_outfmt;
210 + enum v4l2_colorfx color;
211 + enum cfa_fmt cfafmt;
212 + struct mutex ispprev_mutex; /* For checking/modifying prev_inuse */
217 +/* Saved parameters */
218 +static struct prev_params *prev_config_params;
221 + * Coeficient Tables for the submodules in Preview.
222 + * Array is initialised with the values from.the tables text file.
226 + * CFA Filter Coefficient Table
229 +static u32 cfa_coef_table[] = {
230 +#include "cfa_coef_table.h"
234 + * Gamma Correction Table - Red
236 +static u32 redgamma_table[] = {
237 +#include "redgamma_table.h"
241 + * Gamma Correction Table - Green
243 +static u32 greengamma_table[] = {
244 +#include "greengamma_table.h"
248 + * Gamma Correction Table - Blue
250 +static u32 bluegamma_table[] = {
251 +#include "bluegamma_table.h"
255 + * Noise Filter Threshold table
257 +static u32 noise_filter_table[] = {
258 +#include "noise_filter_table.h"
262 + * Luminance Enhancement Table
264 +static u32 luma_enhance_table[] = {
265 +#include "luma_enhance_table.h"
269 + * omap34xx_isp_preview_config - Abstraction layer Preview configuration.
270 + * @userspace_add: Pointer from Userspace to structure with flags and data to
273 +int omap34xx_isp_preview_config(void *userspace_add)
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];
288 + if (userspace_add == NULL)
291 + preview_struct = userspace_add;
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,
297 + goto err_copy_from_user;
298 + isppreview_config_luma_enhancement(yen_t);
300 + params->features |= PREV_LUMA_ENHANCE;
301 + } else if (ISP_ABS_PREV_LUMAENH & preview_struct->update)
302 + params->features &= ~PREV_LUMA_ENHANCE;
304 + if (ISP_ABS_PREV_INVALAW & preview_struct->flag) {
305 + isppreview_enable_invalaw(1);
306 + params->features |= PREV_INVERSE_ALAW;
308 + isppreview_enable_invalaw(0);
309 + params->features &= ~PREV_INVERSE_ALAW;
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);
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;
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;
336 + isppreview_config_cfa(prev_cfa_t);
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;
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);
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;
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);
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);
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);
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);
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);
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);
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;
417 + if (ISP_ABS_PREV_GAMMABYPASS & preview_struct->flag) {
418 + isppreview_enable_gammabypass(1);
419 + params->features |= PREV_GAMMA_BYPASS;
421 + isppreview_enable_gammabypass(0);
422 + params->features &= ~PREV_GAMMA_BYPASS;
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;
432 + if (omap34xx_isp_tables_update(&isp_table_update))
433 + goto err_copy_from_user;
438 + printk(KERN_ERR "Preview Config: Copy From User Error\n");
441 +EXPORT_SYMBOL_GPL(omap34xx_isp_preview_config);
444 + * omap34xx_isp_tables_update - Abstraction layer Tables update.
445 + * @isptables_struct: Pointer from Userspace to structure with flags and table
448 +int omap34xx_isp_tables_update(struct isptables_update *isptables_struct)
451 + if (ISP_ABS_TBL_NF & isptables_struct->flag) {
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;
465 + params->features &= ~PREV_NOISE_FILTER;
466 + if (ISP_ABS_TBL_NF & isptables_struct->update)
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;
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;
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;
503 + printk(KERN_ERR "Preview Tables:Copy From User Error\n");
508 + * isppreview_config_shadow_registers - Program shadow registers for preview.
510 + * Allows user to program shadow registers associated with preview module.
512 +void isppreview_config_shadow_registers()
514 + u8 current_brightness_contrast;
515 + int ctr, prv_disabled;
517 + isppreview_query_brightness(¤t_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);
526 + isppreview_query_contrast(¤t_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);
534 + if (update_color_matrix) {
535 + isppreview_config_rgb_to_ycbcr(flr_prev_csc[ispprev_obj.color]);
536 + update_color_matrix = 0;
538 + if (gg_update || rg_update || bg_update || nf_update) {
539 + isppreview_enable(0);
544 + isp_reg_writel(ISPPRV_TBL_ADDR_GREEN_G_START,
545 + OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_ADDR);
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);
556 + isp_reg_writel(ISPPRV_TBL_ADDR_RED_G_START,
557 + OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_ADDR);
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);
568 + isp_reg_writel(ISPPRV_TBL_ADDR_BLUE_G_START,
569 + OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_ADDR);
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);
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);
589 + isppreview_enable_noisefilter(1);
593 + if (~nf_update && nf_enable)
594 + isppreview_enable_noisefilter(1);
596 + if (nf_update && ~nf_enable)
597 + isppreview_enable_noisefilter(0);
599 + if (prv_disabled) {
600 + isppreview_enable(1);
604 +EXPORT_SYMBOL_GPL(isppreview_config_shadow_registers);
607 + * isppreview_request - Reserves the preview module.
609 + * Returns 0 if successful, or -EBUSY if the module was already reserved.
611 +int isppreview_request()
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");
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);
626 +EXPORT_SYMBOL_GPL(isppreview_request);
629 + * isppreview_free - Frees the preview module.
631 + * Returns 0 if successful, or -EINVAL if the module was already freed.
633 +int isppreview_free()
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));
645 + mutex_unlock(&ispprev_obj.ispprev_mutex);
646 + DPRINTK_ISPPREV("ISP_ERR : Preview Module already freed\n");
651 +EXPORT_SYMBOL_GPL(isppreview_free);
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.
657 + * Configures the default configuration for the CCDC to work with.
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).
662 + * The valid values for the output are PREVIEW_RSZ (0), PREVIEW_MEM (1).
664 + * Returns 0 if successful, or -EINVAL if wrong input or output values are
667 +int isppreview_config_datapath(enum preview_input input,
668 + enum preview_output output)
672 + struct prev_params *params = prev_config_params;
673 + struct ispprev_yclimit yclimit;
675 + pcr = isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR);
679 + pcr &= ~ISPPRV_PCR_SOURCE;
680 + pcr &= ~ISPPRV_PCR_ONESHOT;
681 + ispprev_obj.prev_inpfmt = PRV_RAW_CCDC;
684 + pcr |= ISPPRV_PCR_SOURCE;
685 + pcr |= ISPPRV_PCR_ONESHOT;
686 + ispprev_obj.prev_inpfmt = PRV_RAW_MEM;
688 + case PRV_CCDC_DRKF:
689 + pcr |= ISPPRV_PCR_DRKFCAP;
690 + pcr |= ISPPRV_PCR_ONESHOT;
691 + ispprev_obj.prev_inpfmt = PRV_CCDC_DRKF;
694 + ispprev_obj.prev_inpfmt = PRV_COMPCFA;
697 + ispprev_obj.prev_inpfmt = PRV_OTHERS;
699 + case PRV_RGBBAYERCFA:
700 + ispprev_obj.prev_inpfmt = PRV_RGBBAYERCFA;
703 + printk(KERN_ERR "ISP_ERR : Wrong Input\n");
709 + pcr |= ISPPRV_PCR_RSZPORT;
710 + pcr &= ~ISPPRV_PCR_SDRPORT;
713 + pcr &= ~ISPPRV_PCR_RSZPORT;
714 + pcr |= ISPPRV_PCR_SDRPORT;
717 + printk(KERN_ERR "ISP_ERR : Wrong Output\n");
720 + ispprev_obj.prev_outfmt = output;
722 + isp_reg_writel(pcr, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR);
724 + isppreview_config_ycpos(params->pix_fmt);
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);
733 + if (params->gtable.redtable != NULL)
734 + isppreview_config_gammacorrn(params->gtable);
736 + enable = (params->features & PREV_CFA) ? 1 : 0;
737 + isppreview_enable_cfa(enable);
739 + enable = (params->features & PREV_CHROMA_SUPPRESS) ? 1 : 0;
740 + isppreview_enable_chroma_suppression(enable);
742 + enable = (params->features & PREV_LUMA_ENHANCE) ? 1 : 0;
743 + isppreview_enable_luma_enhancement(enable);
745 + enable = (params->features & PREV_NOISE_FILTER) ? 1 : 0;
747 + isppreview_config_noisefilter(params->nf);
748 + isppreview_enable_noisefilter(enable);
750 + enable = (params->features & PREV_DEFECT_COR) ? 1 : 0;
752 + isppreview_config_dcor(params->dcor);
753 + isppreview_enable_dcor(enable);
755 + enable = (params->features & PREV_GAMMA_BYPASS) ? 1 : 0;
756 + isppreview_enable_gammabypass(enable);
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);
763 + isppreview_config_contrast(params->contrast * ISPPRV_CONTRAST_UNITS);
764 + isppreview_config_brightness(params->brightness * ISPPRV_BRIGHT_UNITS);
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);
774 +EXPORT_SYMBOL_GPL(isppreview_config_datapath);
777 + * isppreview_set_skip - Set the number of rows/columns that should be skipped.
778 + * h - Start Pixel Horizontal.
779 + * v - Start Line Vertical.
781 +void isppreview_set_skip(u32 h, u32 v)
783 + ispprev_obj.sph = h;
784 + ispprev_obj.slv = v;
786 +EXPORT_SYMBOL_GPL(isppreview_set_skip);
789 + * isppreview_config_ycpos - Configure byte layout of YUV image.
790 + * @mode: Indicates the required byte layout.
792 +void isppreview_config_ycpos(enum preview_ycpos_mode mode)
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);
799 +EXPORT_SYMBOL_GPL(isppreview_config_ycpos);
802 + * isppreview_config_averager - Enable / disable / configure averager
803 + * @average: Average value to be configured.
805 +void isppreview_config_averager(u8 average)
809 + reg = AVE_ODD_PIXEL_DIST | AVE_EVEN_PIXEL_DIST | average;
810 + isp_reg_writel(reg, OMAP3_ISP_IOMEM_PREV, ISPPRV_AVE);
812 +EXPORT_SYMBOL_GPL(isppreview_config_averager);
815 + * isppreview_enable_invalaw - Enable/Disable Inverse A-Law module in Preview.
816 + * @enable: 1 - Reverse the A-Law done in CCDC.
818 +void isppreview_enable_invalaw(u8 enable)
821 + pcr_val = isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR);
824 + isp_reg_writel(pcr_val | ISPPRV_PCR_WIDTH | ISPPRV_PCR_INVALAW,
825 + OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR);
827 + isp_reg_writel(pcr_val &
828 + ~(ISPPRV_PCR_WIDTH | ISPPRV_PCR_INVALAW),
829 + OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR);
832 +EXPORT_SYMBOL_GPL(isppreview_enable_invalaw);
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.
839 + * The proccess is applied for each captured frame.
841 +void isppreview_enable_drkframe(u8 enable)
844 + isp_reg_or(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, ISPPRV_PCR_DRKFEN);
846 + isp_reg_and(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
847 + ~ISPPRV_PCR_DRKFEN);
850 +EXPORT_SYMBOL_GPL(isppreview_enable_drkframe);
853 + * isppreview_enable_shadcomp - Enables/Disables the shading compensation.
854 + * @enable: 1 - Enables the shading compensation.
856 + * If dark frame subtract won't be used, then enable this shading
859 +void isppreview_enable_shadcomp(u8 enable)
863 + isp_reg_or(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
864 + ISPPRV_PCR_SCOMP_EN);
865 + isppreview_enable_drkframe(1);
867 + isp_reg_and(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
868 + ~ISPPRV_PCR_SCOMP_EN);
871 +EXPORT_SYMBOL_GPL(isppreview_enable_shadcomp);
874 + * isppreview_config_drkf_shadcomp - Configures shift value in shading comp.
875 + * @scomp_shtval: 3bit value of shift used in shading compensation.
877 +void isppreview_config_drkf_shadcomp(u8 scomp_shtval)
879 + u32 pcr_val = isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR);
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);
885 +EXPORT_SYMBOL_GPL(isppreview_config_drkf_shadcomp);
888 + * isppreview_enable_hmed - Enables/Disables of the Horizontal Median Filter.
889 + * @enable: 1 - Enables Horizontal Median Filter.
891 +void isppreview_enable_hmed(u8 enable)
894 + isp_reg_or(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, ISPPRV_PCR_HMEDEN);
896 + isp_reg_and(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
897 + ~ISPPRV_PCR_HMEDEN);
899 + ispprev_obj.hmed_en = enable ? 1 : 0;
901 +EXPORT_SYMBOL_GPL(isppreview_enable_hmed);
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.
908 +void isppreview_config_hmed(struct ispprev_hmed prev_hmed)
914 + if (prev_hmed.odddist == 1)
915 + odddist = ~ISPPRV_HMED_ODDDIST;
917 + odddist = ISPPRV_HMED_ODDDIST;
919 + if (prev_hmed.evendist == 1)
920 + evendist = ~ISPPRV_HMED_EVENDIST;
922 + evendist = ISPPRV_HMED_EVENDIST;
924 + isp_reg_writel(odddist | evendist | (prev_hmed.thres <<
925 + ISPPRV_HMED_THRESHOLD_SHIFT),
926 + OMAP3_ISP_IOMEM_PREV, ISPPRV_HMED);
929 +EXPORT_SYMBOL_GPL(isppreview_config_hmed);
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.
936 +void isppreview_config_noisefilter(struct ispprev_nf prev_nf)
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);
948 +EXPORT_SYMBOL_GPL(isppreview_config_noisefilter);
951 + * isppreview_config_dcor - Configures the defect correction
952 + * @prev_nf: Structure containing the defect correction structure
954 +void isppreview_config_dcor(struct ispprev_dcor prev_dcor)
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);
967 + isp_reg_and(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
968 + ~ISPPRV_PCR_DCCOUP);
971 +EXPORT_SYMBOL_GPL(isppreview_config_dcor);
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.
978 +void isppreview_config_cfa(struct ispprev_cfa prev_cfa)
982 + ispprev_obj.cfafmt = prev_cfa.cfafmt;
984 + isp_reg_or(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
985 + (prev_cfa.cfafmt << ISPPRV_PCR_CFAFMT_SHIFT));
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);
992 + isp_reg_writel(ISPPRV_CFA_TABLE_ADDR, OMAP3_ISP_IOMEM_PREV,
993 + ISPPRV_SET_TBL_ADDR);
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);
1000 +EXPORT_SYMBOL_GPL(isppreview_config_cfa);
1003 + * isppreview_config_gammacorrn - Configures the Gamma Correction table values
1004 + * @gtable: Structure containing the table for red, blue, green gamma table.
1006 +void isppreview_config_gammacorrn(struct ispprev_gtable gtable)
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);
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);
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);
1031 +EXPORT_SYMBOL_GPL(isppreview_config_gammacorrn);
1034 + * isppreview_config_luma_enhancement - Sets the Luminance Enhancement table.
1035 + * @ytable: Structure containing the table for Luminance Enhancement table.
1037 +void isppreview_config_luma_enhancement(u32 *ytable)
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);
1048 +EXPORT_SYMBOL_GPL(isppreview_config_luma_enhancement);
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.
1055 +void isppreview_config_chroma_suppression(struct ispprev_csup csup)
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);
1061 +EXPORT_SYMBOL_GPL(isppreview_config_chroma_suppression);
1064 + * isppreview_enable_noisefilter - Enables/Disables the Noise Filter.
1065 + * @enable: 1 - Enables the Noise Filter.
1067 +void isppreview_enable_noisefilter(u8 enable)
1070 + isp_reg_or(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, ISPPRV_PCR_NFEN);
1072 + isp_reg_and(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, ~ISPPRV_PCR_NFEN);
1073 + ispprev_obj.nf_en = enable ? 1 : 0;
1075 +EXPORT_SYMBOL_GPL(isppreview_enable_noisefilter);
1078 + * isppreview_enable_dcor - Enables/Disables the defect correction.
1079 + * @enable: 1 - Enables the defect correction.
1081 +void isppreview_enable_dcor(u8 enable)
1084 + isp_reg_or(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, ISPPRV_PCR_DCOREN);
1086 + isp_reg_and(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
1087 + ~ISPPRV_PCR_DCOREN);
1089 + ispprev_obj.dcor_en = enable ? 1 : 0;
1091 +EXPORT_SYMBOL_GPL(isppreview_enable_dcor);
1094 + * isppreview_enable_cfa - Enable/Disable the CFA Interpolation.
1095 + * @enable: 1 - Enables the CFA.
1097 +void isppreview_enable_cfa(u8 enable)
1100 + isp_reg_or(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, ISPPRV_PCR_CFAEN);
1102 + isp_reg_and(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
1103 + ~ISPPRV_PCR_CFAEN);
1105 + ispprev_obj.cfa_en = enable ? 1 : 0;
1107 +EXPORT_SYMBOL_GPL(isppreview_enable_cfa);
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.
1114 +void isppreview_enable_gammabypass(u8 enable)
1117 + isp_reg_or(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
1118 + ISPPRV_PCR_GAMMA_BYPASS);
1120 + isp_reg_and(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
1121 + ~ISPPRV_PCR_GAMMA_BYPASS);
1124 +EXPORT_SYMBOL_GPL(isppreview_enable_gammabypass);
1127 + * isppreview_enable_luma_enhancement - Enables/Disables Luminance Enhancement
1128 + * @enable: 1 - Enable the Luminance Enhancement.
1130 +void isppreview_enable_luma_enhancement(u8 enable)
1133 + isp_reg_or(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
1134 + ISPPRV_PCR_YNENHEN);
1136 + isp_reg_and(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
1137 + ~ISPPRV_PCR_YNENHEN);
1139 + ispprev_obj.yenh_en = enable ? 1 : 0;
1141 +EXPORT_SYMBOL_GPL(isppreview_enable_luma_enhancement);
1144 + * isppreview_enable_chroma_suppression - Enables/Disables Chrominance Suppr.
1145 + * @enable: 1 - Enable the Chrominance Suppression.
1147 +void isppreview_enable_chroma_suppression(u8 enable)
1150 + isp_reg_or(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, ISPPRV_PCR_SUPEN);
1152 + isp_reg_and(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
1153 + ~ISPPRV_PCR_SUPEN);
1155 + ispprev_obj.csup_en = enable ? 1 : 0;
1157 +EXPORT_SYMBOL_GPL(isppreview_enable_chroma_suppression);
1160 + * isppreview_config_whitebalance - Configures the White Balance parameters.
1161 + * @prev_wbal: Structure containing the digital gain and white balance
1164 + * Coefficient matrix always with default values.
1166 +void isppreview_config_whitebalance(struct ispprev_wbal prev_wbal)
1170 + isp_reg_writel(prev_wbal.dgain, OMAP3_ISP_IOMEM_PREV, ISPPRV_WB_DGAIN);
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);
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);
1196 +EXPORT_SYMBOL_GPL(isppreview_config_whitebalance);
1199 + * isppreview_config_whitebalance2 - Configures the White Balance parameters.
1200 + * @prev_wbal: Structure containing the digital gain and white balance
1203 + * Coefficient matrix can be changed.
1205 +void isppreview_config_whitebalance2(struct prev_white_balance prev_wbal)
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);
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);
1234 +EXPORT_SYMBOL_GPL(isppreview_config_whitebalance2);
1237 + * isppreview_config_blkadj - Configures the Black Adjustment parameters.
1238 + * @prev_blkadj: Structure containing the black adjustment towards red, green,
1241 +void isppreview_config_blkadj(struct ispprev_blkadj prev_blkadj)
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);
1248 +EXPORT_SYMBOL_GPL(isppreview_config_blkadj);
1251 + * isppreview_config_rgb_blending - Configures the RGB-RGB Blending matrix.
1252 + * @rgb2rgb: Structure containing the rgb to rgb blending matrix and the rgb
1255 +void isppreview_config_rgb_blending(struct ispprev_rgbtorgb rgb2rgb)
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);
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);
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);
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);
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);
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);
1282 + val = (rgb2rgb.offset[2] & 0x3ff) << ISPPRV_RGB_OFF2_MTX_OFFB_SHIFT;
1283 + isp_reg_writel(val, OMAP3_ISP_IOMEM_PREV, ISPPRV_RGB_OFF2);
1285 +EXPORT_SYMBOL_GPL(isppreview_config_rgb_blending);
1288 + * Configures the RGB-YCbYCr conversion matrix
1289 + * @prev_csc: Structure containing the RGB to YCbYCr matrix and the
1292 +void isppreview_config_rgb_to_ycbcr(struct ispprev_csc prev_csc)
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);
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);
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);
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);
1316 +EXPORT_SYMBOL_GPL(isppreview_config_rgb_to_ycbcr);
1319 + * isppreview_query_contrast - Query the contrast.
1320 + * @contrast: Pointer to hold the current programmed contrast value.
1322 +void isppreview_query_contrast(u8 *contrast)
1324 + u32 brt_cnt_val = 0;
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);
1330 +EXPORT_SYMBOL_GPL(isppreview_query_contrast);
1333 + * isppreview_update_contrast - Updates the contrast.
1334 + * @contrast: Pointer to hold the current programmed contrast value.
1336 + * Value should be programmed before enabling the module.
1338 +void isppreview_update_contrast(u8 *contrast)
1340 + ispprev_obj.contrast = *contrast;
1342 +EXPORT_SYMBOL_GPL(isppreview_update_contrast);
1345 + * isppreview_config_contrast - Configures the Contrast.
1346 + * @contrast: 8 bit value in U8Q4 format.
1348 + * Value should be programmed before enabling the module.
1350 +void isppreview_config_contrast(u8 contrast)
1352 + u32 brt_cnt_val = 0;
1354 + brt_cnt_val = isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_CNT_BRT);
1355 + brt_cnt_val &= ~(0xff << ISPPRV_CNT_BRT_CNT_SHIFT);
1357 + isp_reg_writel(brt_cnt_val | contrast << ISPPRV_CNT_BRT_CNT_SHIFT,
1358 + OMAP3_ISP_IOMEM_PREV, ISPPRV_CNT_BRT);
1360 +EXPORT_SYMBOL_GPL(isppreview_config_contrast);
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.
1367 +void isppreview_get_contrast_range(u8 *min_contrast, u8 *max_contrast)
1369 + *min_contrast = ISPPRV_CONTRAST_MIN;
1370 + *max_contrast = ISPPRV_CONTRAST_MAX;
1372 +EXPORT_SYMBOL_GPL(isppreview_get_contrast_range);
1375 + * isppreview_update_brightness - Updates the brightness in preview module.
1376 + * @brightness: Pointer to hold the current programmed brightness value.
1379 +void isppreview_update_brightness(u8 *brightness)
1381 + ispprev_obj.brightness = *brightness;
1383 +EXPORT_SYMBOL_GPL(isppreview_update_brightness);
1386 + * isppreview_config_brightness - Configures the brightness.
1387 + * @contrast: 8bitvalue in U8Q0 format.
1389 +void isppreview_config_brightness(u8 brightness)
1391 + u32 brt_cnt_val = 0;
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);
1400 +EXPORT_SYMBOL_GPL(isppreview_config_brightness);
1403 + * isppreview_query_brightness - Query the brightness.
1404 + * @brightness: Pointer to hold the current programmed brightness value.
1406 +void isppreview_query_brightness(u8 *brightness)
1408 + *brightness = isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_CNT_BRT);
1410 +EXPORT_SYMBOL_GPL(isppreview_query_brightness);
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
1417 +void isppreview_get_brightness_range(u8 *min_brightness, u8 *max_brightness)
1419 + *min_brightness = ISPPRV_BRIGHT_MIN;
1420 + *max_brightness = ISPPRV_BRIGHT_MAX;
1422 +EXPORT_SYMBOL_GPL(isppreview_get_brightness_range);
1425 + * isppreview_set_color - Sets the color effect.
1426 + * @mode: Indicates the required color effect.
1428 +void isppreview_set_color(u8 *mode)
1430 + ispprev_obj.color = *mode;
1431 + update_color_matrix = 1;
1433 +EXPORT_SYMBOL_GPL(isppreview_set_color);
1436 + * isppreview_get_color - Gets the current color effect.
1437 + * @mode: Indicates the current color effect.
1439 +void isppreview_get_color(u8 *mode)
1441 + *mode = ispprev_obj.color;
1443 +EXPORT_SYMBOL_GPL(isppreview_get_color);
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.
1449 +void isppreview_config_yc_range(struct ispprev_yclimit yclimit)
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);
1457 +EXPORT_SYMBOL_GPL(isppreview_config_yc_range);
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
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.
1469 +int isppreview_try_size(u32 input_w, u32 input_h, u32 *output_w, u32 *output_h)
1471 + u32 prevout_w = input_w;
1472 + u32 prevout_h = input_h;
1476 + ispprev_obj.previn_w = input_w;
1477 + ispprev_obj.previn_h = input_h;
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");
1484 + if (omap_rev() == OMAP3430_REV_ES1_0)
1485 + max_out = ISPPRV_MAXOUTPUT_WIDTH;
1487 + max_out = ISPPRV_MAXOUTPUT_WIDTH_ES2;
1489 + ispprev_obj.fmtavg = 0;
1491 + if (input_w > max_out) {
1492 + div = (input_w/max_out);
1493 + if (div >= 2 && div < 4) {
1494 + ispprev_obj.fmtavg = 1;
1496 + } else if (div >= 4 && div < 8) {
1497 + ispprev_obj.fmtavg = 2;
1499 + } else if (div >= 8) {
1500 + ispprev_obj.fmtavg = 3;
1505 + if (ispprev_obj.hmed_en)
1507 + if (ispprev_obj.nf_en) {
1511 + if (ispprev_obj.cfa_en) {
1512 + switch (ispprev_obj.cfafmt) {
1513 + case CFAFMT_BAYER:
1514 + case CFAFMT_SONYVGA:
1518 + case CFAFMT_RGBFOVEON:
1519 + case CFAFMT_RRGGBBFOVEON:
1520 + case CFAFMT_DNSPL:
1521 + case CFAFMT_HONEYCOMB:
1526 + if (ispprev_obj.yenh_en || ispprev_obj.csup_en)
1529 + /* Start at the correct row/column by skipping
1530 + * a Sensor specific amount.
1532 + prevout_w -= ispprev_obj.sph;
1533 + prevout_h -= ispprev_obj.slv;
1536 + if (prevout_w % 2)
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;
1546 + *output_w = prevout_w;
1547 + ispprev_obj.prevout_w = prevout_w;
1548 + *output_h = prevout_h;
1549 + ispprev_obj.prevout_h = prevout_h;
1552 +EXPORT_SYMBOL_GPL(isppreview_try_size);
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
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
1565 +int isppreview_config_size(u32 input_w, u32 input_h, u32 output_w, u32 output_h)
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");
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);
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);
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 ;
1599 + isppreview_config_outlineoffset(prevsdroff);
1603 +EXPORT_SYMBOL_GPL(isppreview_config_size);
1606 + * isppreview_config_inlineoffset - Configures the Read address line offset.
1607 + * @offset: Line Offset for the input image.
1609 +int isppreview_config_inlineoffset(u32 offset)
1611 + if ((offset & ISP_32B_BOUNDARY_OFFSET) == offset) {
1612 + isp_reg_writel(offset & 0xffff,
1613 + OMAP3_ISP_IOMEM_PREV, ISPPRV_RADR_OFFSET);
1615 + printk(KERN_ERR "ISP_ERR : Offset should be in 32 byte "
1621 +EXPORT_SYMBOL_GPL(isppreview_config_inlineoffset);
1624 + * isppreview_set_inaddr - Sets memory address of input frame.
1625 + * @addr: 32bit memory address aligned on 32byte boundary.
1627 + * Configures the memory address from which the input frame is to be read.
1629 +int isppreview_set_inaddr(u32 addr)
1631 + if ((addr & ISP_32B_BOUNDARY_BUF) == addr)
1632 + isp_reg_writel(addr, OMAP3_ISP_IOMEM_PREV, ISPPRV_RSDR_ADDR);
1634 + printk(KERN_ERR "ISP_ERR: Address should be in 32 byte "
1640 +EXPORT_SYMBOL_GPL(isppreview_set_inaddr);
1643 + * isppreview_config_outlineoffset - Configures the Write address line offset.
1644 + * @offset: Line Offset for the preview output.
1646 +int isppreview_config_outlineoffset(u32 offset)
1648 + if ((offset & ISP_32B_BOUNDARY_OFFSET) != offset) {
1649 + printk(KERN_ERR "ISP_ERR : Offset should be in 32 byte "
1653 + isp_reg_writel(offset & 0xffff, OMAP3_ISP_IOMEM_PREV,
1654 + ISPPRV_WADD_OFFSET);
1657 +EXPORT_SYMBOL_GPL(isppreview_config_outlineoffset);
1660 + * isppreview_set_outaddr - Sets the memory address to store output frame
1661 + * @addr: 32bit memory address aligned on 32byte boundary.
1663 + * Configures the memory address to which the output frame is written.
1665 +int isppreview_set_outaddr(u32 addr)
1667 + if ((addr & ISP_32B_BOUNDARY_BUF) != addr) {
1668 + printk(KERN_ERR "ISP_ERR: Address should be in 32 byte "
1672 + isp_reg_writel(addr, OMAP3_ISP_IOMEM_PREV, ISPPRV_WSDR_ADDR);
1675 +EXPORT_SYMBOL_GPL(isppreview_set_outaddr);
1678 + * isppreview_config_darklineoffset - Sets the Dark frame address line offset.
1679 + * @offset: Line Offset for the Darkframe.
1681 +int isppreview_config_darklineoffset(u32 offset)
1683 + if ((offset & ISP_32B_BOUNDARY_OFFSET) != offset) {
1684 + printk(KERN_ERR "ISP_ERR : Offset should be in 32 byte "
1688 + isp_reg_writel(offset & 0xffff, OMAP3_ISP_IOMEM_PREV,
1689 + ISPPRV_DRKF_OFFSET);
1692 +EXPORT_SYMBOL_GPL(isppreview_config_darklineoffset);
1695 + * isppreview_set_darkaddr - Sets the memory address to store Dark frame.
1696 + * @addr: 32bit memory address aligned on 32 bit boundary.
1698 +int isppreview_set_darkaddr(u32 addr)
1700 + if ((addr & ISP_32B_BOUNDARY_BUF) != addr) {
1701 + printk(KERN_ERR "ISP_ERR : Address should be in 32 byte "
1705 + isp_reg_writel(addr, OMAP3_ISP_IOMEM_PREV, ISPPRV_DSDR_ADDR);
1708 +EXPORT_SYMBOL_GPL(isppreview_set_darkaddr);
1710 +void __isppreview_enable(int enable)
1713 + isp_reg_or(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, ISPPRV_PCR_EN);
1715 + isp_reg_and(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, ~ISPPRV_PCR_EN);
1719 + * isppreview_enable - Enables the Preview module.
1720 + * @enable: 1 - Enables the preview module.
1722 + * Client should configure all the sub modules in Preview before this.
1724 +void isppreview_enable(int enable)
1726 + __isppreview_enable(enable);
1727 + ispprev_obj.pm_state = enable;
1729 +EXPORT_SYMBOL_GPL(isppreview_enable);
1732 + * isppreview_suspend - Suspend Preview module.
1734 +void isppreview_suspend(void)
1736 + if (ispprev_obj.pm_state)
1737 + __isppreview_enable(0);
1739 +EXPORT_SYMBOL_GPL(isppreview_suspend);
1742 + * isppreview_resume - Resume Preview module.
1744 +void isppreview_resume(void)
1746 + if (ispprev_obj.pm_state)
1747 + __isppreview_enable(1);
1749 +EXPORT_SYMBOL_GPL(isppreview_resume);
1753 + * isppreview_busy - Gets busy state of preview module.
1755 +int isppreview_busy(void)
1757 + return isp_reg_readl(OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR) &
1760 +EXPORT_SYMBOL_GPL(isppreview_busy);
1763 + * isppreview_get_config - Gets parameters of preview module.
1765 +struct prev_params *isppreview_get_config(void)
1767 + return prev_config_params;
1769 +EXPORT_SYMBOL_GPL(isppreview_get_config);
1772 + * isppreview_save_context - Saves the values of the preview module registers.
1774 +void isppreview_save_context(void)
1776 + DPRINTK_ISPPREV("Saving context\n");
1777 + isp_save_context(ispprev_reg_list);
1779 +EXPORT_SYMBOL_GPL(isppreview_save_context);
1782 + * isppreview_restore_context - Restores the values of preview module registers
1784 +void isppreview_restore_context(void)
1786 + DPRINTK_ISPPREV("Restoring context\n");
1787 + isp_restore_context(ispprev_reg_list);
1789 +EXPORT_SYMBOL_GPL(isppreview_restore_context);
1792 + * isppreview_print_status - Prints the values of the Preview Module registers.
1794 + * Also prints other debug information stored in the preview moduel.
1796 +void isppreview_print_status(void)
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));
1870 +EXPORT_SYMBOL_GPL(isppreview_print_status);
1873 + * isp_preview_init - Module Initialization.
1875 +int __init isp_preview_init(void)
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");
1884 + params = prev_config_params;
1886 + ispprev_obj.prev_inuse = 0;
1887 + mutex_init(&ispprev_obj.ispprev_mutex);
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;
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;
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];
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);
1947 + * isp_preview_cleanup - Module Cleanup.
1949 +void isp_preview_cleanup(void)
1951 + kfree(prev_config_params);
1953 diff --git a/drivers/media/video/isp/isppreview.h b/drivers/media/video/isp/isppreview.h
1954 new file mode 100644
1955 index 0000000..e88c329
1957 +++ b/drivers/media/video/isp/isppreview.h
1962 + * Driver header file for Preview module in TI's OMAP3 Camera ISP
1964 + * Copyright (C) 2009 Texas Instruments, Inc.
1967 + * Senthilvadivu Guruswamy <svadivu@ti.com>
1968 + * Pallavi Kulkarni <p-kulkarni@ti.com>
1969 + * Sergio Aguirre <saaguirre@ti.com>
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.
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.
1980 +#ifndef OMAP_ISP_PREVIEW_H
1981 +#define OMAP_ISP_PREVIEW_H
1983 +#include <mach/isp_user.h>
1984 +/* Isp query control structure */
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
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
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)
2005 +#define WB_GAIN_MAX 4
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)
2022 +#define ISP_NF_TABLE_SIZE (1 << 10)
2024 +#define ISP_GAMMA_TABLE_SIZE (1 << 10)
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
2032 + *Enumeration Constants for input and output format
2034 +enum preview_input {
2042 +enum preview_output {
2047 + * Configure byte layout of YUV image
2049 +enum preview_ycpos_mode {
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.
2062 +struct ispprev_gtable {
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
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];
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.
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;
2101 + * struct prev_rgb2ycbcr_coeffs - Structure RGB2YCbCr parameters.
2102 + * @coeff: Color conversion gains in 3x3 matrix.
2103 + * @offset: Color conversion offsets.
2105 +struct prev_rgb2ycbcr_coeffs {
2106 + short coeff[RGB_MAX][RGB_MAX];
2107 + short offset[RGB_MAX];
2111 + * struct prev_darkfrm_params - Structure for Dark frame suppression.
2112 + * @addr: Memory start address.
2113 + * @offset: Line offset.
2115 +struct prev_darkfrm_params {
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.
2142 +struct prev_params {
2144 + enum preview_ycpos_mode pix_fmt;
2145 + struct ispprev_cfa cfa;
2146 + struct ispprev_csup csup;
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;
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.
2174 +struct isptables_update {
2177 + struct ispprev_nf *prev_nf;
2184 +void isppreview_config_shadow_registers(void);
2186 +int isppreview_request(void);
2188 +int isppreview_free(void);
2190 +int isppreview_config_datapath(enum preview_input input,
2191 + enum preview_output output);
2193 +void isppreview_config_ycpos(enum preview_ycpos_mode mode);
2195 +void isppreview_config_averager(u8 average);
2197 +void isppreview_enable_invalaw(u8 enable);
2199 +void isppreview_enable_drkframe(u8 enable);
2201 +void isppreview_enable_shadcomp(u8 enable);
2203 +void isppreview_config_drkf_shadcomp(u8 scomp_shtval);
2205 +void isppreview_enable_gammabypass(u8 enable);
2207 +void isppreview_enable_hmed(u8 enable);
2209 +void isppreview_config_hmed(struct ispprev_hmed);
2211 +void isppreview_enable_noisefilter(u8 enable);
2213 +void isppreview_config_noisefilter(struct ispprev_nf prev_nf);
2215 +void isppreview_enable_dcor(u8 enable);
2217 +void isppreview_config_dcor(struct ispprev_dcor prev_dcor);
2220 +void isppreview_config_cfa(struct ispprev_cfa);
2222 +void isppreview_config_gammacorrn(struct ispprev_gtable);
2224 +void isppreview_config_chroma_suppression(struct ispprev_csup csup);
2226 +void isppreview_enable_cfa(u8 enable);
2228 +void isppreview_config_luma_enhancement(u32 *ytable);
2230 +void isppreview_enable_luma_enhancement(u8 enable);
2232 +void isppreview_enable_chroma_suppression(u8 enable);
2234 +void isppreview_config_whitebalance(struct ispprev_wbal);
2236 +void isppreview_config_blkadj(struct ispprev_blkadj);
2238 +void isppreview_config_rgb_blending(struct ispprev_rgbtorgb);
2240 +void isppreview_config_rgb_to_ycbcr(struct ispprev_csc);
2242 +void isppreview_update_contrast(u8 *contrast);
2244 +void isppreview_query_contrast(u8 *contrast);
2246 +void isppreview_config_contrast(u8 contrast);
2248 +void isppreview_get_contrast_range(u8 *min_contrast, u8 *max_contrast);
2250 +void isppreview_update_brightness(u8 *brightness);
2252 +void isppreview_config_brightness(u8 brightness);
2254 +void isppreview_get_brightness_range(u8 *min_brightness, u8 *max_brightness);
2256 +void isppreview_set_color(u8 *mode);
2258 +void isppreview_get_color(u8 *mode);
2260 +void isppreview_query_brightness(u8 *brightness);
2262 +void isppreview_config_yc_range(struct ispprev_yclimit yclimit);
2264 +int isppreview_try_size(u32 input_w, u32 input_h, u32 *output_w,
2267 +int isppreview_config_size(u32 input_w, u32 input_h, u32 output_w,
2270 +int isppreview_config_inlineoffset(u32 offset);
2272 +int isppreview_set_inaddr(u32 addr);
2274 +int isppreview_config_outlineoffset(u32 offset);
2276 +int isppreview_set_outaddr(u32 addr);
2278 +int isppreview_config_darklineoffset(u32 offset);
2280 +int isppreview_set_darkaddr(u32 addr);
2282 +void isppreview_enable(int enable);
2284 +void isppreview_suspend(void);
2286 +void isppreview_resume(void);
2288 +int isppreview_busy(void);
2290 +struct prev_params *isppreview_get_config(void);
2292 +void isppreview_print_status(void);
2294 +#ifndef CONFIG_ARCH_OMAP3410
2295 +void isppreview_save_context(void);
2297 +static inline void isppreview_save_context(void) {}
2300 +#ifndef CONFIG_ARCH_OMAP3410
2301 +void isppreview_restore_context(void);
2303 +static inline void isppreview_restore_context(void) {}
2306 +int omap34xx_isp_preview_config(void *userspace_add);
2308 +int omap34xx_isp_tables_update(struct isptables_update *isptables_struct);
2310 +void isppreview_set_skip(u32 h, u32 v);
2312 +#endif/* OMAP_ISP_PREVIEW_H */
2313 diff --git a/drivers/media/video/isp/ispresizer.c b/drivers/media/video/isp/ispresizer.c
2314 new file mode 100644
2315 index 0000000..f78ddb3
2317 +++ b/drivers/media/video/isp/ispresizer.c
2322 + * Driver Library for Resizer module in TI's OMAP3 Camera ISP
2324 + * Copyright (C)2009 Texas Instruments, Inc.
2327 + * Sameer Venkatraman <sameerv@ti.com>
2329 + * Sergio Aguirre <saaguirre@ti.com>
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.
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.
2340 +#include <linux/module.h>
2343 +#include "ispreg.h"
2344 +#include "ispresizer.h"
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 = {
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,
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
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
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
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,
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.
2411 +static struct isp_res {
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 */
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}
2480 + * ispresizer_config_shadow_registers - Configure shadow registers.
2482 +void ispresizer_config_shadow_registers()
2486 +EXPORT_SYMBOL(ispresizer_config_shadow_registers);
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.
2497 +void ispresizer_trycrop(u32 left, u32 top, u32 width, u32 height, u32 ow,
2500 + ispres_obj.cropwidth = width + 6;
2501 + ispres_obj.cropheight = height + 6;
2502 + ispresizer_try_size(&ispres_obj.cropwidth, &ispres_obj.cropheight, &ow,
2504 + ispres_obj.ipht_crop = top;
2505 + ispres_obj.ipwd_crop = left;
2507 +EXPORT_SYMBOL(ispresizer_trycrop);
2510 + * ispresizer_applycrop - Apply crop to input image.
2512 +void ispresizer_applycrop(void)
2514 + ispresizer_config_size(ispres_obj.cropwidth, ispres_obj.cropheight,
2515 + ispres_obj.outputwidth,
2516 + ispres_obj.outputheight);
2519 +EXPORT_SYMBOL(ispresizer_applycrop);
2522 + * ispresizer_request - Reserves the Resizer module.
2524 + * Allows only one user at a time.
2526 + * Returns 0 if successful, or -EBUSY if resizer module was already requested.
2528 +int ispresizer_request()
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);
2540 + mutex_unlock(&ispres_obj.ispres_mutex);
2541 + printk(KERN_ERR "ISP_ERR : Resizer Module Busy\n");
2545 +EXPORT_SYMBOL(ispresizer_request);
2548 + * ispresizer_free - Makes Resizer module free.
2550 + * Returns 0 if successful, or -EINVAL if resizer module was already freed.
2552 +int ispresizer_free()
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));
2562 + mutex_unlock(&ispres_obj.ispres_mutex);
2563 + DPRINTK_ISPRESZ("ISP_ERR : Resizer Module already freed\n");
2567 +EXPORT_SYMBOL(ispresizer_free);
2570 + * ispresizer_config_datapath - Specifies which input to use in resizer module
2571 + * @input: Indicates the module that gives the image to resizer.
2573 + * Sets up the default resizer configuration according to the arguments.
2575 + * Returns 0 if successful, or -EINVAL if an unsupported input was requested.
2577 +int ispresizer_config_datapath(enum ispresizer_input input)
2580 + DPRINTK_ISPRESZ("ispresizer_config_datapath()+\n");
2581 + ispres_obj.resinput = 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);
2590 + cnt |= ISPRSZ_CNT_INPSRC;
2591 + cnt &= ~ISPRSZ_CNT_INPTYP;
2593 + case RSZ_MEM_COL8:
2594 + cnt |= ISPRSZ_CNT_INPSRC;
2595 + cnt |= ISPRSZ_CNT_INPTYP;
2598 + printk(KERN_ERR "ISP_ERR : Wrong Input\n");
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");
2609 +EXPORT_SYMBOL(ispresizer_config_datapath);
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.
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:-
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
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
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
2643 + * Fills up the output/input widht/height, horizontal/vertical resize ratio,
2644 + * horizontal/vertical crop variables in the isp_res structure.
2646 +int ispresizer_try_size(u32 *input_width, u32 *input_height, u32 *output_w,
2649 + u32 rsz, rsz_7, rsz_4;
2651 + u32 input_w, input_h;
2652 + int max_in_otf, max_out_7tap;
2654 + input_w = *input_width;
2655 + input_h = *input_height;
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"
2666 + if (input_h > MAX_IN_HEIGHT)
2669 + if (*output_w < 16)
2672 + if (*output_h < 2)
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;
2679 + max_in_otf = MAX_IN_WIDTH_ONTHEFLY_MODE_ES2;
2680 + max_out_7tap = MAX_7TAP_VRSZ_OUTWIDTH_ES2;
2683 + if (ispres_obj.resinput == RSZ_OTFLY_YUV) {
2684 + if (input_w > max_in_otf)
2687 + if (input_w > MAX_IN_WIDTH_MEMORY_MODE)
2691 + *output_h &= 0xfffffffe;
2692 + sph = DEFAULTSTPHASE;
2694 + rsz_7 = ((input_h - 7) * 256) / (*output_h - 1);
2695 + rsz_4 = ((input_h - 4) * 256) / (*output_h - 1);
2697 + rsz = (input_h * 256) / *output_h;
2699 + if (rsz <= MID_RESIZE_VALUE) {
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);
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);
2719 + if (rsz > MID_RESIZE_VALUE) {
2721 + (((64 * sph) + ((*output_h - 1) * rsz) + 32) / 256) + 7;
2724 + (((32 * sph) + ((*output_h - 1) * rsz) + 16) / 256) + 4;
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;
2733 + *output_w &= 0xfffffff0;
2734 + sph = DEFAULTSTPHASE;
2736 + rsz_7 = ((input_w - 7) * 256) / (*output_w - 1);
2737 + rsz_4 = ((input_w - 4) * 256) / (*output_w - 1);
2739 + rsz = (input_w * 256) / *output_w;
2740 + if (rsz > MID_RESIZE_VALUE) {
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);
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);
2760 + /* Recalculate input based on TRM equations */
2761 + if (rsz > MID_RESIZE_VALUE) {
2763 + (((64 * sph) + ((*output_w - 1) * rsz) + 32) / 256) + 7;
2766 + (((32 * sph) + ((*output_w - 1) * rsz) + 16) / 256) + 7;
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;
2775 + *input_height = input_h;
2776 + *input_width = input_w;
2779 +EXPORT_SYMBOL(ispresizer_try_size);
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.
2788 + * Configures the appropriate values stored in the isp_res structure in the
2789 + * resizer registers.
2791 + * Returns 0 if successful, or -EINVAL if passed values haven't been verified
2792 + * with ispresizer_try_size() previously.
2794 +int ispresizer_config_size(u32 input_w, u32 input_h, u32 output_w,
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);
2823 + /* Set Resizer input address and offset adderss */
2824 + ispresizer_config_inlineoffset(isp_reg_readl(OMAP3_ISP_IOMEM_PREV,
2825 + ISPPRV_WADD_OFFSET));
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,
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);
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);
2845 + isp_reg_writel((0x00 << ISPRSZ_IN_START_HORZ_ST_SHIFT) |
2846 + (0x00 << ISPRSZ_IN_START_VERT_ST_SHIFT),
2847 + OMAP3_ISP_IOMEM_RESZ,
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,
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,
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,
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,
2874 + if (ispres_obj.h_resz <= MID_RESIZE_VALUE) {
2876 + for (i = 0; i < 16; i++) {
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));
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));
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));
2909 + if (ispres_obj.v_resz <= MID_RESIZE_VALUE) {
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));
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));
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));
2946 + ispresizer_config_outlineoffset(output_w*2);
2947 + DPRINTK_ISPRESZ("ispresizer_config_size()-\n");
2950 +EXPORT_SYMBOL(ispresizer_config_size);
2952 +void __ispresizer_enable(int enable)
2955 + DPRINTK_ISPRESZ("+ispresizer_enable()+\n");
2957 + val = (isp_reg_readl(OMAP3_ISP_IOMEM_RESZ, ISPRSZ_PCR) & 0x2) |
2958 + ISPRSZ_PCR_ENABLE;
2960 + val = isp_reg_readl(OMAP3_ISP_IOMEM_RESZ, ISPRSZ_PCR) &
2961 + ~ISPRSZ_PCR_ENABLE;
2963 + isp_reg_writel(val, OMAP3_ISP_IOMEM_RESZ, ISPRSZ_PCR);
2964 + DPRINTK_ISPRESZ("+ispresizer_enable()-\n");
2968 + * ispresizer_enable - Enables the resizer module.
2969 + * @enable: 1 - Enable, 0 - Disable
2971 + * Client should configure all the sub modules in resizer before this.
2973 +void ispresizer_enable(int enable)
2975 + __ispresizer_enable(enable);
2976 + ispres_obj.pm_state = enable;
2978 +EXPORT_SYMBOL(ispresizer_enable);
2981 + * ispresizer_suspend - Suspend resizer module.
2983 +void ispresizer_suspend(void)
2985 + if (ispres_obj.pm_state)
2986 + __ispresizer_enable(0);
2988 +EXPORT_SYMBOL(ispresizer_suspend);
2991 + * ispresizer_resume - Resume resizer module.
2993 +void ispresizer_resume(void)
2995 + if (ispres_obj.pm_state)
2996 + __ispresizer_enable(1);
2998 +EXPORT_SYMBOL(ispresizer_resume);
3001 + * ispresizer_busy - Checks if ISP resizer is busy.
3003 + * Returns busy field from ISPRSZ_PCR register.
3005 +int ispresizer_busy(void)
3007 + return isp_reg_readl(OMAP3_ISP_IOMEM_RESZ, ISPRSZ_PCR) &
3010 +EXPORT_SYMBOL(ispresizer_busy);
3013 + * ispresizer_config_startphase - Sets the horizontal and vertical start phase.
3014 + * @hstartphase: horizontal start phase (0 - 7).
3015 + * @vstartphase: vertical startphase (0 - 7).
3017 + * This API just updates the isp_res struct. Actual register write happens in
3018 + * ispresizer_config_size.
3020 +void ispresizer_config_startphase(u8 hstartphase, u8 vstartphase)
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");
3027 +EXPORT_SYMBOL(ispresizer_config_startphase);
3030 + * ispresizer_config_ycpos - Specifies if output should be in YC or CY format.
3031 + * @yc: 0 - YC format, 1 - CY format
3033 +void ispresizer_config_ycpos(u8 yc)
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");
3040 +EXPORT_SYMBOL(ispresizer_config_ycpos);
3043 + * Sets the chrominance algorithm
3044 + * @cbilin: 0 - chrominance uses same processing as luminance,
3045 + * 1 - bilinear interpolation processing
3047 +void ispresizer_enable_cbilin(u8 enable)
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");
3054 +EXPORT_SYMBOL(ispresizer_enable_cbilin);
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.
3061 +void ispresizer_config_luma_enhance(struct isprsz_yenh *yenh)
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,
3071 + DPRINTK_ISPRESZ("ispresizer_config_luma_enhance()-\n");
3073 +EXPORT_SYMBOL(ispresizer_config_luma_enhance);
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.
3082 +void ispresizer_config_filter_coef(struct isprsz_coef *coef)
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];
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];
3098 + DPRINTK_ISPRESZ("ispresizer_config_filter_coef()-\n");
3100 +EXPORT_SYMBOL(ispresizer_config_filter_coef);
3103 + * ispresizer_config_inlineoffset - Configures the read address line offset.
3104 + * @offset: Line Offset for the input image.
3106 + * Returns 0 if successful, or -EINVAL if offset is not 32 bits aligned.
3108 +int ispresizer_config_inlineoffset(u32 offset)
3110 + DPRINTK_ISPRESZ("ispresizer_config_inlineoffset()+\n");
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");
3118 +EXPORT_SYMBOL(ispresizer_config_inlineoffset);
3121 + * ispresizer_set_inaddr - Sets the memory address of the input frame.
3122 + * @addr: 32bit memory address aligned on 32byte boundary.
3124 + * Returns 0 if successful, or -EINVAL if address is not 32 bits aligned.
3126 +int ispresizer_set_inaddr(u32 addr)
3128 + DPRINTK_ISPRESZ("ispresizer_set_inaddr()+\n");
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");
3137 +EXPORT_SYMBOL(ispresizer_set_inaddr);
3140 + * ispresizer_config_outlineoffset - Configures the write address line offset.
3141 + * @offset: Line offset for the preview output.
3143 + * Returns 0 if successful, or -EINVAL if address is not 32 bits aligned.
3145 +int ispresizer_config_outlineoffset(u32 offset)
3147 + DPRINTK_ISPRESZ("ispresizer_config_outlineoffset()+\n");
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");
3155 +EXPORT_SYMBOL(ispresizer_config_outlineoffset);
3158 + * Configures the memory address to which the output frame is written.
3159 + * @addr: 32bit memory address aligned on 32byte boundary.
3161 +int ispresizer_set_outaddr(u32 addr)
3163 + DPRINTK_ISPRESZ("ispresizer_set_outaddr()+\n");
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");
3171 +EXPORT_SYMBOL(ispresizer_set_outaddr);
3174 + * ispresizer_save_context - Saves the values of the resizer module registers.
3176 +void ispresizer_save_context(void)
3178 + DPRINTK_ISPRESZ("Saving context\n");
3179 + isp_save_context(isprsz_reg_list);
3181 +EXPORT_SYMBOL(ispresizer_save_context);
3184 + * ispresizer_restore_context - Restores resizer module register values.
3186 +void ispresizer_restore_context(void)
3188 + DPRINTK_ISPRESZ("Restoring context\n");
3189 + isp_restore_context(isprsz_reg_list);
3191 +EXPORT_SYMBOL(ispresizer_restore_context);
3194 + * ispresizer_print_status - Prints the values of the resizer module registers.
3196 +void ispresizer_print_status()
3198 + if (!is_ispresz_debug_enabled())
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));
3227 +EXPORT_SYMBOL(ispresizer_print_status);
3230 + * isp_resizer_init - Module Initialisation.
3232 + * Always returns 0.
3234 +int __init isp_resizer_init(void)
3236 + mutex_init(&ispres_obj.ispres_mutex);
3237 + ispres_obj.pm_state = 0;
3242 + * isp_resizer_cleanup - Module Cleanup.
3244 +void isp_resizer_cleanup(void)
3247 diff --git a/drivers/media/video/isp/ispresizer.h b/drivers/media/video/isp/ispresizer.h
3248 new file mode 100644
3249 index 0000000..4e92225
3251 +++ b/drivers/media/video/isp/ispresizer.h
3256 + * Driver header file for Resizer module in TI's OMAP3 Camera ISP
3258 + * Copyright (C) 2009 Texas Instruments, Inc.
3261 + * Sameer Venkatraman <sameerv@ti.com>
3263 + * Sergio Aguirre <saaguirre@ti.com>
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.
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.
3274 +#ifndef OMAP_ISP_RESIZER_H
3275 +#define OMAP_ISP_RESIZER_H
3278 + * Resizer Constants
3280 +#define MAX_IN_WIDTH_MEMORY_MODE 4095
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
3289 +#define MAX_7TAP_HRSZ_OUTWIDTH 1280
3290 +#define MAX_7TAP_VRSZ_OUTWIDTH 640
3292 +#define MAX_7TAP_HRSZ_OUTWIDTH_ES2 3300
3293 +#define MAX_7TAP_VRSZ_OUTWIDTH_ES2 1650
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
3308 + * The client is supposed to call resizer API in the following sequence:
3310 + * - config_datatpath()
3311 + * - optionally config/enable sub modules
3312 + * - try/config size
3313 + * - setup callback
3314 + * - setup in/out memory offsets and ptrs
3321 +enum ispresizer_input {
3328 + * struct isprsz_coef - Structure for resizer filter coeffcients.
3329 + * @h_filter_coef_4tap: Horizontal filter coefficients for 8-phase/4-tap
3331 + * @v_filter_coef_4tap: Vertical filter coefficients for 8-phase/4-tap
3333 + * @h_filter_coef_7tap: Horizontal filter coefficients for 4-phase/7-tap
3335 + * @v_filter_coef_7tap: Vertical filter coefficients for 4-phase/7-tap
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];
3346 + * struct isprsz_yenh - Structure for resizer luminance enhancer parameters.
3347 + * @algo: Algorithm select.
3348 + * @gain: Maximum gain.
3350 + * @coreoffset: Coring offset.
3352 +struct isprsz_yenh {
3359 +void ispresizer_config_shadow_registers(void);
3361 +int ispresizer_request(void);
3363 +int ispresizer_free(void);
3365 +int ispresizer_config_datapath(enum ispresizer_input input);
3367 +void ispresizer_enable_cbilin(u8 enable);
3369 +void ispresizer_config_ycpos(u8 yc);
3371 +void ispresizer_config_startphase(u8 hstartphase, u8 vstartphase);
3373 +void ispresizer_config_filter_coef(struct isprsz_coef *coef);
3375 +void ispresizer_config_luma_enhance(struct isprsz_yenh *yenh);
3377 +int ispresizer_try_size(u32 *input_w, u32 *input_h, u32 *output_w,
3380 +void ispresizer_applycrop(void);
3382 +void ispresizer_trycrop(u32 left, u32 top, u32 width, u32 height, u32 ow,
3385 +int ispresizer_config_size(u32 input_w, u32 input_h, u32 output_w,
3388 +int ispresizer_config_inlineoffset(u32 offset);
3390 +int ispresizer_set_inaddr(u32 addr);
3392 +int ispresizer_config_outlineoffset(u32 offset);
3394 +int ispresizer_set_outaddr(u32 addr);
3396 +void ispresizer_enable(int enable);
3398 +void ispresizer_suspend(void);
3400 +void ispresizer_resume(void);
3402 +int ispresizer_busy(void);
3404 +void ispresizer_save_context(void);
3406 +void ispresizer_restore_context(void);
3408 +void ispresizer_print_status(void);
3410 +#endif /* OMAP_ISP_RESIZER_H */