video: rockchip: hdmi: v2: fix some format check error
[firefly-linux-kernel-4.4.55.git] / drivers / video / rockchip / iep / iep.h
1 #ifndef _IEP_H_
2 #define _IEP_H_
3
4 /* Capability for current iep version
5 using by userspace to determine iep features */
6 struct IEP_CAP {
7         u8 scaling_supported;
8         u8 i4_deinterlace_supported;
9         u8 i2_deinterlace_supported;
10         u8 compression_noise_reduction_supported;
11         u8 sampling_noise_reduction_supported;
12         u8 hsb_enhancement_supported;
13         u8 cg_enhancement_supported;
14         u8 direct_path_supported;
15         u16 max_dynamic_width;
16         u16 max_dynamic_height;
17         u16 max_static_width;
18         u16 max_static_height;
19         u8 max_enhance_radius;
20 };
21
22 #define IEP_IOC_MAGIC 'i'
23
24 #define IEP_SET_PARAMETER_REQ           _IOW(IEP_IOC_MAGIC, 1, unsigned long)
25 #define IEP_SET_PARAMETER_DEINTERLACE   _IOW(IEP_IOC_MAGIC, 2, unsigned long)
26 #define IEP_SET_PARAMETER_ENHANCE       _IOW(IEP_IOC_MAGIC, 3, unsigned long)
27 #define IEP_SET_PARAMETER_CONVERT       _IOW(IEP_IOC_MAGIC, 4, unsigned long)
28 #define IEP_SET_PARAMETER_SCALE         _IOW(IEP_IOC_MAGIC, 5, unsigned long)
29 #define IEP_GET_RESULT_SYNC             _IOW(IEP_IOC_MAGIC, 6, unsigned long)
30 #define IEP_GET_RESULT_ASYNC            _IOW(IEP_IOC_MAGIC, 7, unsigned long)
31 #define IEP_SET_PARAMETER               _IOW(IEP_IOC_MAGIC, 8, unsigned long)
32 #define IEP_RELEASE_CURRENT_TASK        _IOW(IEP_IOC_MAGIC, 9, unsigned long)
33 #define IEP_GET_IOMMU_STATE             _IOR(IEP_IOC_MAGIC,10, unsigned long)
34 #define IEP_QUERY_CAP                   _IOR(IEP_IOC_MAGIC,11, struct IEP_CAP)
35
36 #ifdef CONFIG_COMPAT
37 #define COMPAT_IEP_SET_PARAMETER_REQ            _IOW(IEP_IOC_MAGIC, 1, u32)
38 #define COMPAT_IEP_SET_PARAMETER_DEINTERLACE    _IOW(IEP_IOC_MAGIC, 2, u32)
39 #define COMPAT_IEP_SET_PARAMETER_ENHANCE        _IOW(IEP_IOC_MAGIC, 3, u32)
40 #define COMPAT_IEP_SET_PARAMETER_CONVERT        _IOW(IEP_IOC_MAGIC, 4, u32)
41 #define COMPAT_IEP_SET_PARAMETER_SCALE          _IOW(IEP_IOC_MAGIC, 5, u32)
42 #define COMPAT_IEP_GET_RESULT_SYNC              _IOW(IEP_IOC_MAGIC, 6, u32)
43 #define COMPAT_IEP_GET_RESULT_ASYNC             _IOW(IEP_IOC_MAGIC, 7, u32)
44 #define COMPAT_IEP_SET_PARAMETER                _IOW(IEP_IOC_MAGIC, 8, u32)
45 #define COMPAT_IEP_RELEASE_CURRENT_TASK         _IOW(IEP_IOC_MAGIC, 9, u32)
46 #define COMPAT_IEP_GET_IOMMU_STATE              _IOR(IEP_IOC_MAGIC,10, u32)
47 #define COMPAT_IEP_QUERY_CAP                    _IOR(IEP_IOC_MAGIC,11, struct IEP_CAP)
48 #endif
49
50 /* Driver information */
51 #define DRIVER_DESC             "IEP Device Driver"
52 #define DRIVER_NAME             "iep"
53
54 #define DEBUG
55 #ifdef DEBUG
56 #define iep_debug(level, fmt, args...)                          \
57         do {                                                    \
58                 if (debug >= level)                             \
59                         pr_info("%s:%d: " fmt,                  \
60                                  __func__, __LINE__, ##args);   \
61         } while (0)
62 #else
63 #define iep_debug(level, fmt, args...)
64 #endif
65
66 #define iep_debug_enter() vpu_debug(4, "enter\n")
67 #define iep_debug_leave() vpu_debug(4, "leave\n")
68
69 #define iep_err(fmt, args...)                           \
70                 pr_err("%s:%d: " fmt, __func__, __LINE__, ##args)
71
72 /* Logging */
73 #define IEP_DEBUG 0
74 #if IEP_DEBUG
75 #define IEP_DBG(format, args...)        printk("%s: " format, DRIVER_NAME, ## args)
76 #else
77 #define IEP_DBG(format, args...)
78 #endif
79
80 #define IEP_INFORMATION 1
81 #if IEP_INFORMATION
82 #define IEP_INFO(format, args...)       printk(format, ## args)
83 #else
84 #define IEP_INFO(format, args...)
85 #endif
86
87 #define IEP_ERR(format, args...)        printk(KERN_ERR "%s: " format, DRIVER_NAME, ## args)
88 #define IEP_WARNING(format, args...)    printk(KERN_WARNING "%s: " format, DRIVER_NAME, ## args)
89
90 enum {
91         yuv2rgb_BT_601_l = 0x0,     /* BT.601_1 */
92         yuv2rgb_BT_601_f = 0x1,     /* BT.601_f */
93         yuv2rgb_BT_709_l = 0x2,     /* BT.709_1 */
94         yuv2rgb_BT_709_f = 0x3,     /* BT.709_f */
95 };
96
97 enum {
98         rgb2yuv_BT_601_l = 0x0,     /* BT.601_1 */
99         rgb2yuv_BT_601_f = 0x1,     /* BT.601_f */
100         rgb2yuv_BT_709_l = 0x2,     /* BT.709_1 */
101         rgb2yuv_BT_709_f = 0x3,     /* BT.709_f */
102 };
103
104 enum {
105         dein_mode_bypass_dis         = 0x0,
106         dein_mode_I4O2               = 0x1,
107         dein_mode_I4O1B              = 0x2,
108         dein_mode_I4O1T              = 0x3,
109         dein_mode_I2O1B              = 0x4,
110         dein_mode_I2O1T              = 0x5,
111         dein_mode_bypass             = 0x6,
112 };
113
114 enum IEP_FIELD_ORDER {
115         FIELD_ORDER_TOP_FIRST,
116         FIELD_ORDER_BOTTOM_FIRST
117 };
118
119 enum IEP_YUV_DEINTERLACE_MODE {
120         IEP_DEINTERLACE_MODE_DISABLE,
121         IEP_DEINTERLACE_MODE_I2O1,
122         IEP_DEINTERLACE_MODE_I4O1,
123         IEP_DEINTERLACE_MODE_I4O2,
124         IEP_DEINTERLACE_MODE_BYPASS
125 };
126
127 enum {
128         rgb_enhance_bypass          = 0x0,
129         rgb_enhance_denoise         = 0x1,
130         rgb_enhance_detail          = 0x2,
131         rgb_enhance_edge            = 0x3,
132 };/* for rgb_enhance_mode */
133
134 enum {
135         rgb_contrast_CC_P_DDE          = 0x0, /* cg prior to dde */
136         rgb_contrast_DDE_P_CC          = 0x1, /* dde prior to cg */
137 }; /* for rgb_contrast_enhance_mode */
138
139 enum {
140         black_screen                   = 0x0,
141         blue_screen                    = 0x1,
142         color_bar                      = 0x2,
143         normal_mode                    = 0x3,
144 }; /* for video mode */
145
146 /*
147           Alpha    Red     Green   Blue  
148 {  4, 32, {{32,24,   24,16,  16, 8,  8, 0 }}, GGL_RGBA },    IEP_FORMAT_ARGB_8888
149 {  4, 32, {{32,24,   8, 0,  16, 8,  24,16 }}, GGL_RGB  },    IEP_FORMAT_ABGR_8888
150 {  4, 32, {{ 8, 0,  32,24,  24,16,  16, 8 }}, GGL_RGB  },    IEP_FORMAT_RGBA_8888
151 {  4, 32, {{ 8, 0,  16, 8,  24,16,  32,24 }}, GGL_BGRA },    IEP_FORMAT_BGRA_8888
152 {  2, 16, {{ 0, 0,  16,11,  11, 5,   5, 0 }}, GGL_RGB  },    IEP_FORMAT_RGB_565
153 {  2, 16, {{ 0, 0,   5, 0,  11, 5,  16,11 }}, GGL_RGB  },    IEP_FORMAT_RGB_565
154 */
155 enum {
156         IEP_FORMAT_ARGB_8888    = 0x0,
157         IEP_FORMAT_ABGR_8888    = 0x1,
158         IEP_FORMAT_RGBA_8888    = 0x2,
159         IEP_FORMAT_BGRA_8888    = 0x3,
160         IEP_FORMAT_RGB_565      = 0x4,
161         IEP_FORMAT_BGR_565      = 0x5,
162
163         IEP_FORMAT_YCbCr_422_SP = 0x10,
164         IEP_FORMAT_YCbCr_422_P  = 0x11,
165         IEP_FORMAT_YCbCr_420_SP = 0x12,
166         IEP_FORMAT_YCbCr_420_P  = 0x13,
167         IEP_FORMAT_YCrCb_422_SP = 0x14,
168         IEP_FORMAT_YCrCb_422_P  = 0x15,/* same as IEP_FORMAT_YCbCr_422_P */
169         IEP_FORMAT_YCrCb_420_SP = 0x16,
170         IEP_FORMAT_YCrCb_420_P  = 0x17,/* same as IEP_FORMAT_YCbCr_420_P */
171 }; /* for format */
172
173 struct iep_img
174 {
175         u16 act_w;      /* act_width */
176         u16 act_h;      /* act_height */
177         s16 x_off;      /* x offset for the vir,word unit */
178         s16 y_off;      /* y offset for the vir,word unit */
179
180         u16 vir_w;      /* unit :pix */
181         u16 vir_h;      /* unit :pix */
182         u32 format;
183         u32 mem_addr;
184         u32 uv_addr;
185         u32 v_addr;
186
187         u8 rb_swap;     /* not be used */
188         u8 uv_swap;     /* not be used */
189
190         u8 alpha_swap;  /* not be used */
191 };
192
193 struct IEP_MSG {
194         struct iep_img src;
195         struct iep_img dst;
196
197         struct iep_img src1;
198         struct iep_img dst1;
199
200         struct iep_img src_itemp;
201         struct iep_img src_ftemp;
202
203         struct iep_img dst_itemp;
204         struct iep_img dst_ftemp;
205
206         u8 dither_up_en;
207         u8 dither_down_en;/* not to be used */
208
209         u8 yuv2rgb_mode;
210         u8 rgb2yuv_mode;
211
212         u8 global_alpha_value;
213
214         u8 rgb2yuv_clip_en;
215         u8 yuv2rgb_clip_en;
216
217         u8 lcdc_path_en;
218         s32 off_x;
219         s32 off_y;
220         s32 width;
221         s32 height;
222         s32 layer;
223
224         u8 yuv_3D_denoise_en;
225
226         /* yuv color enhance */
227         u8 yuv_enhance_en;
228         s32 sat_con_int;
229         s32 contrast_int;
230         s32 cos_hue_int;
231         s32 sin_hue_int;
232         s8 yuv_enh_brightness;  /*-32<brightness<31*/
233         u8 video_mode;          /*0-3*/
234         u8 color_bar_y; /*0-127*/
235         u8 color_bar_u; /*0-127*/
236         u8 color_bar_v; /*0-127*/
237
238
239         u8 rgb_enhance_en;/*i don't konw what is used*/
240
241         u8 rgb_color_enhance_en;/*sw_rgb_color_enh_en*/
242         u32 rgb_enh_coe;
243
244         u8 rgb_enhance_mode;/*sw_rgb_enh_sel,dde sel*/
245
246         u8 rgb_cg_en;/*sw_rgb_con_gam_en*/
247         u32 cg_tab[192];
248
249         /*sw_con_gam_order;0 cg prior to dde,1 dde prior to cg*/
250         u8 rgb_contrast_enhance_mode;
251
252         s32 enh_threshold;
253         s32 enh_alpha;
254         s32 enh_radius;
255
256         u8 scale_up_mode;
257
258         u8 field_order;
259         u8 dein_mode;
260         /*DIL HF*/
261         u8 dein_high_fre_en;
262         u8 dein_high_fre_fct;
263         /*DIL EI*/
264         u8 dein_ei_mode;
265         u8 dein_ei_smooth;
266         u8 dein_ei_sel;
267         u8 dein_ei_radius;/*when dein_ei_sel=0 will be used*/
268
269         u8 vir_addr_enable;
270
271         void *base;
272 };
273
274 #endif