4 * TI OMAP3 ISP - Resizer module
6 * Copyright (C) 2010 Nokia Corporation
7 * Copyright (C) 2009 Texas Instruments, Inc
9 * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
10 * Sakari Ailus <sakari.ailus@iki.fi>
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
17 #ifndef OMAP3_ISP_RESIZER_H
18 #define OMAP3_ISP_RESIZER_H
20 #include <linux/spinlock.h>
21 #include <linux/types.h>
24 * Constants for filter coefficients count
29 * struct isprsz_coef - Structure for resizer filter coefficients.
30 * @h_filter_coef_4tap: Horizontal filter coefficients for 8-phase/4-tap
32 * @v_filter_coef_4tap: Vertical filter coefficients for 8-phase/4-tap
34 * @h_filter_coef_7tap: Horizontal filter coefficients for 4-phase/7-tap
36 * @v_filter_coef_7tap: Vertical filter coefficients for 4-phase/7-tap
40 u16 h_filter_coef_4tap
[32];
41 u16 v_filter_coef_4tap
[32];
42 /* Every 8th value is a dummy value in the following arrays: */
43 u16 h_filter_coef_7tap
[32];
44 u16 v_filter_coef_7tap
[32];
47 /* Chrominance horizontal algorithm */
48 enum resizer_chroma_algo
{
49 RSZ_THE_SAME
= 0, /* Chrominance the same as Luminance */
50 RSZ_BILINEAR
= 1, /* Chrominance uses bilinear interpolation */
53 /* Resizer input type select */
54 enum resizer_colors_type
{
55 RSZ_YUV422
= 0, /* YUV422 color is interleaved */
56 RSZ_COLOR8
= 1, /* Color separate data on 8 bits */
60 * Structure for horizontal and vertical resizing value
62 struct resizer_ratio
{
68 * Structure for luminance enhancer parameters.
70 struct resizer_luma_yenh
{
71 u8 algo
; /* algorithm select. */
72 u8 gain
; /* maximum gain. */
73 u8 slope
; /* slope. */
74 u8 core
; /* core offset. */
77 enum resizer_input_entity
{
79 RESIZER_INPUT_VP
, /* input video port - prev or ccdc */
83 /* Sink and source resizer pads */
84 #define RESZ_PAD_SINK 0
85 #define RESZ_PAD_SOURCE 1
86 #define RESZ_PADS_NUM 2
89 * struct isp_res_device - OMAP3 ISP resizer module
90 * @lock: Protects formats and crop rectangles between set_selection and IRQ
91 * @crop.request: Crop rectangle requested by the user
92 * @crop.active: Active crop rectangle (based on hardware requirements)
94 struct isp_res_device
{
95 struct v4l2_subdev subdev
;
96 struct media_pad pads
[RESZ_PADS_NUM
];
97 struct v4l2_mbus_framefmt formats
[RESZ_PADS_NUM
];
99 enum resizer_input_entity input
;
100 struct isp_video video_in
;
101 struct isp_video video_out
;
103 u32 addr_base
; /* stored source buffer address in memory mode */
104 u32 crop_offset
; /* additional offset for crop in memory mode */
105 struct resizer_ratio ratio
;
107 unsigned int applycrop
:1;
108 enum isp_pipeline_stream_state state
;
109 wait_queue_head_t wait
;
114 struct v4l2_rect request
;
115 struct v4l2_rect active
;
121 int omap3isp_resizer_init(struct isp_device
*isp
);
122 void omap3isp_resizer_cleanup(struct isp_device
*isp
);
124 int omap3isp_resizer_register_entities(struct isp_res_device
*res
,
125 struct v4l2_device
*vdev
);
126 void omap3isp_resizer_unregister_entities(struct isp_res_device
*res
);
127 void omap3isp_resizer_isr_frame_sync(struct isp_res_device
*res
);
128 void omap3isp_resizer_isr(struct isp_res_device
*isp_res
);
130 void omap3isp_resizer_max_rate(struct isp_res_device
*res
,
131 unsigned int *max_rate
);
133 void omap3isp_resizer_suspend(struct isp_res_device
*isp_res
);
135 void omap3isp_resizer_resume(struct isp_res_device
*isp_res
);
137 int omap3isp_resizer_busy(struct isp_res_device
*isp_res
);
139 #endif /* OMAP3_ISP_RESIZER_H */