Full support for Ginger Console
[linux-ginger.git] / drivers / media / video / isp / ispresizer.h
blob27212f7a6dd1b520a944d6e05008ec5981735e21
1 /*
2 * ispresizer.h
4 * Driver header file for Resizer module in TI's OMAP3 Camera ISP
6 * Copyright (C) 2009 Texas Instruments, Inc.
8 * Contributors:
9 * Sameer Venkatraman <sameerv@ti.com>
10 * Mohit Jalori
11 * Sergio Aguirre <saaguirre@ti.com>
13 * This package is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
17 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
19 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22 #ifndef OMAP_ISP_RESIZER_H
23 #define OMAP_ISP_RESIZER_H
26 * Resizer Constants
28 #define MAX_IN_WIDTH_MEMORY_MODE 4095
30 #define MAX_IN_WIDTH_ONTHEFLY_MODE 1280
31 #define MAX_IN_WIDTH_ONTHEFLY_MODE_ES2 4095
32 #define MAX_IN_HEIGHT 4095
33 #define MINIMUM_RESIZE_VALUE 64
34 #define MAXIMUM_RESIZE_VALUE 1024
35 #define MID_RESIZE_VALUE 512
37 #define MAX_7TAP_HRSZ_OUTWIDTH 1280
38 #define MAX_7TAP_VRSZ_OUTWIDTH 640
40 #define MAX_7TAP_HRSZ_OUTWIDTH_ES2 3300
41 #define MAX_7TAP_VRSZ_OUTWIDTH_ES2 1650
43 #define DEFAULTSTPIXEL 0
44 #define DEFAULTSTPHASE 1
45 #define DEFAULTHSTPIXEL4TAPMODE 3
46 #define FOURPHASE 4
47 #define EIGHTPHASE 8
48 #define RESIZECONSTANT 256
49 #define SHIFTER4TAPMODE 0
50 #define SHIFTER7TAPMODE 1
51 #define DEFAULTOFFSET 7
52 #define OFFSETVERT4TAPMODE 4
53 #define OPWDALIGNCONSTANT 0xfffffff0
56 * The client is supposed to call resizer API in the following sequence:
57 * - request()
58 * - config_datatpath()
59 * - optionally config/enable sub modules
60 * - try/config size
61 * - setup callback
62 * - setup in/out memory offsets and ptrs
63 * - enable()
64 * ...
65 * - disable()
66 * - free()
69 enum resizer_input {
70 RSZ_OTFLY_YUV,
71 RSZ_MEM_YUV,
72 RSZ_MEM_COL8
75 /**
76 * struct isprsz_coef - Structure for resizer filter coeffcients.
77 * @h_filter_coef_4tap: Horizontal filter coefficients for 8-phase/4-tap
78 * mode (.5x-4x)
79 * @v_filter_coef_4tap: Vertical filter coefficients for 8-phase/4-tap
80 * mode (.5x-4x)
81 * @h_filter_coef_7tap: Horizontal filter coefficients for 4-phase/7-tap
82 * mode (.25x-.5x)
83 * @v_filter_coef_7tap: Vertical filter coefficients for 4-phase/7-tap
84 * mode (.25x-.5x)
86 struct isprsz_coef {
87 u16 h_filter_coef_4tap[32];
88 u16 v_filter_coef_4tap[32];
89 u16 h_filter_coef_7tap[28];
90 u16 v_filter_coef_7tap[28];
93 /**
94 * struct isprsz_yenh - Structure for resizer luminance enhancer parameters.
95 * @algo: Algorithm select.
96 * @gain: Maximum gain.
97 * @slope: Slope.
98 * @coreoffset: Coring offset.
100 struct isprsz_yenh {
101 u8 algo;
102 u8 gain;
103 u8 slope;
104 u8 coreoffset;
108 * struct isp_res_device - Structure for the resizer module to store its
109 * information.
110 * @res_inuse: Indicates if resizer module has been reserved. 1 - Reserved,
111 * 0 - Freed.
112 * @h_startphase: Horizontal starting phase.
113 * @v_startphase: Vertical starting phase.
114 * @h_resz: Horizontal resizing value.
115 * @v_resz: Vertical resizing value.
116 * @outputwidth: Output Image Width in pixels.
117 * @outputheight: Output Image Height in pixels.
118 * @inputwidth: Input Image Width in pixels.
119 * @inputheight: Input Image Height in pixels.
120 * @algo: Algorithm select. 0 - Disable, 1 - [-1 2 -1]/2 high-pass filter,
121 * 2 - [-1 -2 6 -2 -1]/4 high-pass filter.
122 * @ipht_crop: Vertical start line for cropping.
123 * @ipwd_crop: Horizontal start pixel for cropping.
124 * @cropwidth: Crop Width.
125 * @cropheight: Crop Height.
126 * @resinput: Resizer input.
127 * @coeflist: Register configuration for Resizer.
128 * @ispres_mutex: Mutex for isp resizer.
130 struct isp_res_device {
131 u8 res_inuse;
132 u8 h_startphase;
133 u8 v_startphase;
134 u16 h_resz;
135 u16 v_resz;
136 u8 algo;
137 dma_addr_t tmp_buf;
138 struct isprsz_coef coeflist;
139 struct mutex ispres_mutex; /* For checking/modifying res_inuse */
140 struct isprsz_yenh defaultyenh;
141 struct device *dev;
142 int applycrop;
145 int ispresizer_config_crop(struct isp_res_device *isp_res,
146 struct v4l2_crop *a);
147 void ispresizer_config_shadow_registers(struct isp_res_device *isp_res);
149 int ispresizer_request(struct isp_res_device *isp_res);
151 int ispresizer_free(struct isp_res_device *isp_res);
153 void ispresizer_enable_cbilin(struct isp_res_device *isp_res, u8 enable);
155 void ispresizer_config_ycpos(struct isp_res_device *isp_res, u8 yc);
157 void ispresizer_config_startphase(struct isp_res_device *isp_res,
158 u8 hstartphase, u8 vstartphase);
160 void ispresizer_config_filter_coef(struct isp_res_device *isp_res,
161 struct isprsz_coef *coef);
163 void ispresizer_config_luma_enhance(struct isp_res_device *isp_res,
164 struct isprsz_yenh *yenh);
166 int ispresizer_try_pipeline(struct isp_res_device *isp_res,
167 struct isp_pipeline *pipe);
169 int ispresizer_s_pipeline(struct isp_res_device *isp_res,
170 struct isp_pipeline *pipe);
172 int ispresizer_config_inlineoffset(struct isp_res_device *isp_res, u32 offset);
174 int ispresizer_set_inaddr(struct isp_res_device *isp_res, u32 addr);
176 int ispresizer_config_outlineoffset(struct isp_res_device *isp_res, u32 offset);
178 int ispresizer_set_outaddr(struct isp_res_device *isp_res, u32 addr);
180 void ispresizer_enable(struct isp_res_device *isp_res, int enable);
182 int ispresizer_busy(struct isp_res_device *isp_res);
184 void ispresizer_save_context(struct device *dev);
186 void ispresizer_restore_context(struct device *dev);
188 void ispresizer_print_status(struct isp_res_device *isp_res);
190 #endif /* OMAP_ISP_RESIZER_H */