tizen 2.4 release
[profile/mobile/platform/kernel/linux-3.10-sc7730.git] / include / video / sprd_scale_k.h
1 /*
2  * Copyright (C) 2012 Spreadtrum Communications Inc.
3  *
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.
7  *
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.
12  */
13 #ifndef _SPRD_SCALE_H_
14 #define _SPRD_SCALE_H_
15
16 enum scale_fmt_e {
17         SCALE_YUV422 = 0,
18         SCALE_YUV420,
19         SCALE_YUV400,
20         SCALE_YUV420_3FRAME,
21         SCALE_RGB565,
22         SCALE_RGB888,
23         SCALE_FTM_MAX
24 };
25
26 enum scale_data_endian_e {
27         SCALE_ENDIAN_BIG = 0,
28         SCALE_ENDIAN_LITTLE,
29         SCALE_ENDIAN_HALFBIG,
30         SCALE_ENDIAN_HALFLITTLE,
31         SCALE_ENDIAN_MAX
32 };
33
34 enum scale_mode_e {
35         SCALE_MODE_NORMAL = 0,
36         SCALE_MODE_SLICE,
37         SCALE_MODE_SLICE_READDR,
38         SCALE_MODE_MAX
39 };
40
41 enum scale_process_e {
42         SCALE_PROCESS_SUCCESS = 0,
43         SCALE_PROCESS_EXIT = -1,
44         SCALE_PROCESS_SYS_BUSY = -2,
45         SCALE_PROCESS_MAX = 0xFF
46 };
47
48 struct scale_size_t {
49         uint32_t w;
50         uint32_t h;
51 };
52
53 struct scale_rect_t {
54         uint32_t x;
55         uint32_t y;
56         uint32_t w;
57         uint32_t h;
58 };
59
60 struct scale_addr_t {
61         uint32_t yaddr;
62         uint32_t uaddr;
63         uint32_t vaddr;
64 };
65
66 struct scale_endian_sel_t {
67         uint8_t y_endian;
68         uint8_t uv_endian;
69         uint8_t reserved0;
70         uint8_t reserved1;
71 };
72
73 struct scale_slice_param_t {
74         uint32_t slice_height;
75         struct scale_rect_t input_rect;
76         struct scale_addr_t input_addr;
77         struct scale_addr_t output_addr;
78 };
79
80 struct scale_frame_param_t {
81         struct scale_size_t input_size;
82         struct scale_rect_t input_rect;
83         enum scale_fmt_e input_format;
84         struct scale_addr_t input_addr;
85         struct scale_endian_sel_t input_endian;
86         struct scale_size_t output_size;
87         enum scale_fmt_e output_format;
88         struct scale_addr_t output_addr;
89         struct scale_endian_sel_t output_endian;
90         enum scale_mode_e scale_mode;
91         uint32_t slice_height;
92         void  *coeff_addr;
93 };
94
95 struct scale_frame_info_t {
96         uint32_t type;
97         uint32_t lock;
98         uint32_t flags;
99         uint32_t fid;
100         uint32_t width;
101         uint32_t height;
102         uint32_t height_uv;
103         uint32_t yaddr;
104         uint32_t uaddr;
105         uint32_t vaddr;
106         struct scale_endian_sel_t endian;
107         enum scale_process_e scale_result;
108 };
109
110
111 #define SCALE_IO_MAGIC 'S'
112
113 #define SCALE_IO_START     _IOW(SCALE_IO_MAGIC, 0, struct scale_frame_param_t)
114 #define SCALE_IO_CONTINUE  _IOW(SCALE_IO_MAGIC, 1, struct scale_slice_param_t)
115 #define SCALE_IO_DONE      _IOW(SCALE_IO_MAGIC, 2, struct scale_slice_param_t)
116
117 #endif