9 #include <linux/list.h>
18 #if defined(CONFIG_VIDEOBUF2_VMALLOC) || defined(CONFIG_VIDEOBUF2_VMALLOC_MODULE)
19 #define MCAM_MODE_VMALLOC 1
22 #if defined(CONFIG_VIDEOBUF2_DMA_CONTIG) || defined(CONFIG_VIDEOBUF2_DMA_CONTIG_MODULE)
23 #define MCAM_MODE_DMA_CONTIG 1
26 #if defined(CONFIG_VIDEOBUF2_DMA_SG) || defined(CONFIG_VIDEOBUF2_DMA_SG_MODULE)
27 #define MCAM_MODE_DMA_SG 1
30 #if !defined(MCAM_MODE_VMALLOC) && !defined(MCAM_MODE_DMA_CONTIG) && \
31 !defined(MCAM_MODE_DMA_SG)
32 #error One of the videobuf buffer modes must be selected in the config
43 #define MAX_DMA_BUFS 3
61 #ifdef MCAM_MODE_VMALLOC
64 #ifdef MCAM_MODE_DMA_CONTIG
67 #ifdef MCAM_MODE_DMA_SG
126 #ifdef MCAM_MODE_VMALLOC
127 unsigned int dma_buf_size;
173 static inline void mcam_reg_write_mask(
struct mcam_camera *
cam,
unsigned int reg,
174 unsigned int val,
unsigned int mask)
176 unsigned int v = mcam_reg_read(cam, reg);
178 v = (v & ~mask) | (val & mask);
179 mcam_reg_write(cam, reg, v);
182 static inline void mcam_reg_clear_bit(
struct mcam_camera *cam,
183 unsigned int reg,
unsigned int val)
185 mcam_reg_write_mask(cam, reg, 0, val);
188 static inline void mcam_reg_set_bit(
struct mcam_camera *cam,
189 unsigned int reg,
unsigned int val)
191 mcam_reg_write_mask(cam, reg, val, val);
209 #define REG_Y0BAR 0x00
210 #define REG_Y1BAR 0x04
211 #define REG_Y2BAR 0x08
214 #define REG_IMGPITCH 0x24
215 #define IMGP_YP_SHFT 2
216 #define IMGP_YP_MASK 0x00003ffc
217 #define IMGP_UVP_SHFT 18
218 #define IMGP_UVP_MASK 0x3ffc0000
219 #define REG_IRQSTATRAW 0x28
220 #define IRQ_EOF0 0x00000001
221 #define IRQ_EOF1 0x00000002
222 #define IRQ_EOF2 0x00000004
223 #define IRQ_SOF0 0x00000008
224 #define IRQ_SOF1 0x00000010
225 #define IRQ_SOF2 0x00000020
226 #define IRQ_OVERFLOW 0x00000040
227 #define IRQ_TWSIW 0x00010000
228 #define IRQ_TWSIR 0x00020000
229 #define IRQ_TWSIE 0x00040000
230 #define TWSIIRQS (IRQ_TWSIW|IRQ_TWSIR|IRQ_TWSIE)
231 #define FRAMEIRQS (IRQ_EOF0|IRQ_EOF1|IRQ_EOF2|IRQ_SOF0|IRQ_SOF1|IRQ_SOF2)
232 #define ALLIRQS (TWSIIRQS|FRAMEIRQS|IRQ_OVERFLOW)
233 #define REG_IRQMASK 0x2c
234 #define REG_IRQSTAT 0x30
236 #define REG_IMGSIZE 0x34
237 #define IMGSZ_V_MASK 0x1fff0000
238 #define IMGSZ_V_SHIFT 16
239 #define IMGSZ_H_MASK 0x00003fff
240 #define REG_IMGOFFSET 0x38
242 #define REG_CTRL0 0x3c
243 #define C0_ENABLE 0x00000001
246 #define C0_DF_MASK 0x00fffffc
249 #define C0_RGB4_RGBX 0x00000000
250 #define C0_RGB4_XRGB 0x00000004
251 #define C0_RGB4_BGRX 0x00000008
252 #define C0_RGB4_XBGR 0x0000000c
253 #define C0_RGB5_RGGB 0x00000000
254 #define C0_RGB5_GRBG 0x00000004
255 #define C0_RGB5_GBRG 0x00000008
256 #define C0_RGB5_BGGR 0x0000000c
260 #define C0_DF_YUV 0x00000000
261 #define C0_DF_RGB 0x000000a0
262 #define C0_DF_BAYER 0x00000140
264 #define C0_RGBF_565 0x00000000
265 #define C0_RGBF_444 0x00000800
266 #define C0_RGB_BGR 0x00001000
267 #define C0_YUV_PLANAR 0x00000000
268 #define C0_YUV_PACKED 0x00008000
269 #define C0_YUV_420PL 0x0000a000
271 #define C0_YUVE_YUYV 0x00000000
272 #define C0_YUVE_YVYU 0x00010000
273 #define C0_YUVE_VYUY 0x00020000
274 #define C0_YUVE_UYVY 0x00030000
275 #define C0_YUVE_XYUV 0x00000000
276 #define C0_YUVE_XYVU 0x00010000
277 #define C0_YUVE_XUVY 0x00020000
278 #define C0_YUVE_XVUY 0x00030000
280 #define C0_HPOL_LOW 0x01000000
281 #define C0_VPOL_LOW 0x02000000
282 #define C0_VCLK_LOW 0x04000000
283 #define C0_DOWNSCALE 0x08000000
284 #define C0_SIFM_MASK 0xc0000000
285 #define C0_SIF_HVSYNC 0x00000000
286 #define CO_SOF_NOSYNC 0x40000000
289 #define REG_CTRL1 0x40
290 #define C1_CLKGATE 0x00000001
291 #define C1_DESC_ENA 0x00000100
292 #define C1_DESC_3WORD 0x00000200
293 #define C1_444ALPHA 0x00f00000
294 #define C1_ALPHA_SHFT 20
295 #define C1_DMAB32 0x00000000
296 #define C1_DMAB16 0x02000000
297 #define C1_DMAB64 0x04000000
298 #define C1_DMAB_MASK 0x06000000
299 #define C1_TWOBUFS 0x08000000
300 #define C1_PWRDWN 0x10000000
302 #define REG_CLKCTRL 0x88
303 #define CLK_DIV_MASK 0x0000ffff
306 #define REG_UBAR 0xc4
309 #define REG_DMA_DESC_Y 0x200
310 #define REG_DMA_DESC_U 0x204
311 #define REG_DMA_DESC_V 0x208
312 #define REG_DESC_LEN_Y 0x20c
313 #define REG_DESC_LEN_U 0x210
314 #define REG_DESC_LEN_V 0x214
319 #define VGA_WIDTH 640
320 #define VGA_HEIGHT 480