2 * Copyright (C) 2012 Spreadtrum Communications Inc.
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
16 /* Four-character-code (FOURCC) */
17 #define img_fourcc(a, b, c, d)\
18 ((uint32_t)(a) | ((uint32_t)(b) << 8) | ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))
21 #define IMG_PIX_FMT_RGB565 img_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */
22 #define IMG_PIX_FMT_RGB565X img_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */
25 #define IMG_PIX_FMT_GREY img_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */
27 /* Luminance+Chrominance formats */
28 #define IMG_PIX_FMT_YVU420 img_fourcc('Y', 'V', '1', '2') /* 12 YVU 4:2:0 */
29 #define IMG_PIX_FMT_YUYV img_fourcc('Y', 'U', 'Y', 'V') /* 16 YUV 4:2:2 */
30 #define IMG_PIX_FMT_YVYU img_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */
31 #define IMG_PIX_FMT_UYVY img_fourcc('U', 'Y', 'V', 'Y') /* 16 YUV 4:2:2 */
32 #define IMG_PIX_FMT_VYUY img_fourcc('V', 'Y', 'U', 'Y') /* 16 YUV 4:2:2 */
33 #define IMG_PIX_FMT_YUV422P img_fourcc('4', '2', '2', 'P') /* 16 YVU422 planar */
34 #define IMG_PIX_FMT_YUV420 img_fourcc('Y', 'U', '1', '2') /* 12 YUV 4:2:0 */
36 /* two planes -- one Y, one Cr + Cb interleaved */
37 #define IMG_PIX_FMT_NV12 img_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */
38 #define IMG_PIX_FMT_NV21 img_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */
40 /* compressed formats */
41 #define IMG_PIX_FMT_JPEG img_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG */
43 #define SPRD_IMG_PATH_MAX 6
51 IMG_CANCELED_BUF = 0x05,
60 IMG_ENDIAN_HALFLITTLE,
70 SPRD_IMG_GET_SCALE_CAP = 0,
71 SPRD_IMG_GET_FRM_BUFFER,
77 struct sprd_img_size {
82 struct sprd_img_rect {
89 struct sprd_img_frm_addr {
95 struct sprd_img_parm {
97 uint32_t frame_base_id;
99 uint32_t need_isp_tool;
105 uint32_t is_reserved_buf;
106 struct sprd_img_rect crop_rect;
107 struct sprd_img_size dst_size;
108 struct sprd_img_frm_addr frame_addr;
109 struct sprd_img_frm_addr frame_addr_vir;
110 uint32_t reserved[4];
113 struct sprd_img_ccir_if {
121 struct sprd_img_mipi_if {
123 uint32_t bits_per_pxl;
129 struct sprd_img_sensor_if {
136 struct sprd_img_ccir_if ccir;
137 struct sprd_img_mipi_if mipi;
141 struct sprd_img_frm_info {
147 uint32_t frm_base_id;
157 uint32_t reserved[4];
160 struct sprd_img_path_info {
162 uint32_t support_yuv;
163 uint32_t support_raw;
164 uint32_t support_jpeg;
165 uint32_t support_scaling;
166 uint32_t support_trim;
167 uint32_t is_scaleing_path;;
170 struct sprd_img_path_capability {
172 struct sprd_img_path_info path_info[SPRD_IMG_PATH_MAX];
176 struct sprd_img_write_op {
182 struct sprd_img_read_op {
186 struct sprd_img_frm_info frame;
187 struct sprd_img_path_capability capability;
188 uint32_t reserved[20];
192 struct sprd_img_get_fmt {
197 struct sprd_img_time {
202 struct sprd_img_format {
208 uint32_t need_binning;
209 uint32_t bytesperline;
211 uint32_t reserved[4];
214 #define SPRD_IMG_IO_MAGIC 'Z'
215 #define SPRD_IMG_IO_SET_MODE _IOW(SPRD_IMG_IO_MAGIC, 0, uint32_t)
216 #define SPRD_IMG_IO_SET_SKIP_NUM _IOW(SPRD_IMG_IO_MAGIC, 1, uint32_t)
217 #define SPRD_IMG_IO_SET_SENSOR_SIZE _IOW(SPRD_IMG_IO_MAGIC, 2, struct sprd_img_size)
218 #define SPRD_IMG_IO_SET_SENSOR_TRIM _IOW(SPRD_IMG_IO_MAGIC, 3, struct sprd_img_rect)
219 #define SPRD_IMG_IO_SET_FRM_ID_BASE _IOW(SPRD_IMG_IO_MAGIC, 4, struct sprd_img_parm)
220 #define SPRD_IMG_IO_SET_CROP _IOW(SPRD_IMG_IO_MAGIC, 5, struct sprd_img_parm)
221 #define SPRD_IMG_IO_SET_FLASH _IOW(SPRD_IMG_IO_MAGIC, 6, uint32_t)
222 #define SPRD_IMG_IO_SET_OUTPUT_SIZE _IOW(SPRD_IMG_IO_MAGIC, 7, struct sprd_img_parm)
223 #define SPRD_IMG_IO_SET_ZOOM_MODE _IOW(SPRD_IMG_IO_MAGIC, 8, uint32_t)
224 #define SPRD_IMG_IO_SET_SENSOR_IF _IOW(SPRD_IMG_IO_MAGIC, 9, struct sprd_img_sensor_if)
225 #define SPRD_IMG_IO_SET_FRAME_ADDR _IOW(SPRD_IMG_IO_MAGIC, 10, struct sprd_img_parm)
226 #define SPRD_IMG_IO_PATH_FRM_DECI _IOW(SPRD_IMG_IO_MAGIC, 11, struct sprd_img_parm)
227 #define SPRD_IMG_IO_PATH_PAUSE _IOW(SPRD_IMG_IO_MAGIC, 12, struct sprd_img_parm)
228 #define SPRD_IMG_IO_PATH_RESUME _IOW(SPRD_IMG_IO_MAGIC, 13, uint32_t)
229 #define SPRD_IMG_IO_STREAM_ON _IOW(SPRD_IMG_IO_MAGIC, 14, uint32_t)
230 #define SPRD_IMG_IO_STREAM_OFF _IOW(SPRD_IMG_IO_MAGIC, 15, uint32_t)
231 #define SPRD_IMG_IO_GET_FMT _IOR(SPRD_IMG_IO_MAGIC, 16, struct sprd_img_get_fmt)
232 #define SPRD_IMG_IO_GET_CH_ID _IOR(SPRD_IMG_IO_MAGIC, 17, uint32_t)
233 #define SPRD_IMG_IO_GET_TIME _IOR(SPRD_IMG_IO_MAGIC, 18, struct sprd_img_time)
234 #define SPRD_IMG_IO_CHECK_FMT _IOWR(SPRD_IMG_IO_MAGIC, 19, struct sprd_img_format)
235 #define SPRD_IMG_IO_SET_SHRINK _IOW(SPRD_IMG_IO_MAGIC, 20, uint32_t)
237 #endif //_SPRD_V4L2_H_