pause SMP and fix idle clk gate when change ddr frequence
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-rockchip / vcodec_service.h
1 \r
2 /* arch/arm/mach-rk29/include/mach/vpu_service.h\r
3  *\r
4  * Copyright (C) 2010 ROCKCHIP, Inc.\r
5  * author: chenhengming chm@rock-chips.com\r
6  *\r
7  * This software is licensed under the terms of the GNU General Public\r
8  * License version 2, as published by the Free Software Foundation, and\r
9  * may be copied, distributed, and modified under those terms.\r
10  *\r
11  * This program is distributed in the hope that it will be useful,\r
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14  * GNU General Public License for more details.\r
15  *\r
16  */\r
17 \r
18 #ifndef __ARCH_ARM_MACH_RK29_VCODEC_SERVICE_H\r
19 #define __ARCH_ARM_MACH_RK29_VCODEC_SERVICE_H\r
20 \r
21 #include <linux/ioctl.h>    /* needed for the _IOW etc stuff used later */\r
22 \r
23 /*\r
24  * Ioctl definitions\r
25  */\r
26 \r
27 /* Use 'k' as magic number */\r
28 #define VPU_IOC_MAGIC                       'l'\r
29 \r
30 #define VPU_IOC_SET_CLIENT_TYPE             _IOW(VPU_IOC_MAGIC, 1, unsigned long)\r
31 #define VPU_IOC_GET_HW_FUSE_STATUS          _IOW(VPU_IOC_MAGIC, 2, unsigned long)\r
32 \r
33 #define VPU_IOC_SET_REG                     _IOW(VPU_IOC_MAGIC, 3, unsigned long)\r
34 #define VPU_IOC_GET_REG                     _IOW(VPU_IOC_MAGIC, 4, unsigned long)\r
35 \r
36 #define VPU_IOC_PROBE_IOMMU_STATUS          _IOR(VPU_IOC_MAGIC, 5, unsigned long)\r
37 \r
38 typedef enum VPU_CLIENT_TYPE {\r
39     VPU_ENC                 = 0x0,\r
40     VPU_DEC                 = 0x1,\r
41     VPU_PP                  = 0x2,\r
42     VPU_DEC_PP              = 0x3,\r
43     VPU_TYPE_BUTT           ,\r
44 \r
45 } VPU_CLIENT_TYPE;\r
46 \r
47 /* Hardware decoder configuration description */\r
48 \r
49 typedef struct VPUHwDecConfig {\r
50     unsigned long   maxDecPicWidth;         /* Maximum video decoding width supported  */\r
51     unsigned long   maxPpOutPicWidth;       /* Maximum output width of Post-Processor */\r
52     unsigned long   h264Support;            /* HW supports h.264 */\r
53     unsigned long   jpegSupport;            /* HW supports JPEG */\r
54     unsigned long   mpeg4Support;           /* HW supports MPEG-4 */\r
55     unsigned long   customMpeg4Support;     /* HW supports custom MPEG-4 features */\r
56     unsigned long   vc1Support;             /* HW supports VC-1 Simple */\r
57     unsigned long   mpeg2Support;           /* HW supports MPEG-2 */\r
58     unsigned long   ppSupport;              /* HW supports post-processor */\r
59     unsigned long   ppConfig;               /* HW post-processor functions bitmask */\r
60     unsigned long   sorensonSparkSupport;   /* HW supports Sorenson Spark */\r
61     unsigned long   refBufSupport;          /* HW supports reference picture buffering */\r
62     unsigned long   vp6Support;             /* HW supports VP6 */\r
63     unsigned long   vp7Support;             /* HW supports VP7 */\r
64     unsigned long   vp8Support;             /* HW supports VP8 */\r
65     unsigned long   avsSupport;             /* HW supports AVS */\r
66     unsigned long   jpegESupport;           /* HW supports JPEG extensions */\r
67     unsigned long   rvSupport;              /* HW supports REAL */\r
68     unsigned long   mvcSupport;             /* HW supports H264 MVC extension */\r
69 } VPUHwDecConfig_t;\r
70 \r
71 /* Hardware encoder configuration description */\r
72 \r
73 typedef struct VPUHwEndConfig\r
74 {\r
75     unsigned long   maxEncodedWidth;        /* Maximum supported width for video encoding (not JPEG) */\r
76     unsigned long   h264Enabled;            /* HW supports H.264 */\r
77     unsigned long   jpegEnabled;            /* HW supports JPEG */\r
78     unsigned long   mpeg4Enabled;           /* HW supports MPEG-4 */\r
79     unsigned long   vsEnabled;              /* HW supports video stabilization */\r
80     unsigned long   rgbEnabled;             /* HW supports RGB input */\r
81     unsigned long   reg_size;\r
82     unsigned long   reserv[2];              /* reverved */\r
83 } VPUHwEncConfig_t;\r
84 \r
85 typedef struct VPUHwCfgReq\r
86 {\r
87     unsigned long  *cfg;\r
88     unsigned long   size;\r
89 } VPUHwCfgReq_t;\r
90 \r
91 #define DWL_MPEG2_E         31  /* 1 bit */\r
92 #define DWL_VC1_E           29  /* 2 bits */\r
93 #define DWL_JPEG_E          28  /* 1 bit */\r
94 #define DWL_MPEG4_E         26  /* 2 bits */\r
95 #define DWL_H264_E          24  /* 2 bits */\r
96 #define DWL_VP6_E           23  /* 1 bit */\r
97 #define DWL_PJPEG_E         22  /* 1 bit */\r
98 #define DWL_REF_BUFF_E      20  /* 1 bit */\r
99 \r
100 #define DWL_JPEG_EXT_E          31  /* 1 bit */\r
101 #define DWL_REF_BUFF_ILACE_E    30  /* 1 bit */\r
102 #define DWL_MPEG4_CUSTOM_E      29  /* 1 bit */\r
103 #define DWL_REF_BUFF_DOUBLE_E   28  /* 1 bit */\r
104 #define DWL_RV_E            26  /* 2 bits */\r
105 #define DWL_VP7_E           24  /* 1 bit */\r
106 #define DWL_VP8_E           23  /* 1 bit */\r
107 #define DWL_AVS_E           22  /* 1 bit */\r
108 #define DWL_MVC_E           20  /* 2 bits */\r
109 \r
110 #define DWL_CFG_E           24  /* 4 bits */\r
111 #define DWL_PP_E            16  /* 1 bit */\r
112 \r
113 #define DWL_SORENSONSPARK_E 11  /* 1 bit */\r
114 \r
115 #define DWL_H264_FUSE_E          31 /* 1 bit */\r
116 #define DWL_MPEG4_FUSE_E         30 /* 1 bit */\r
117 #define DWL_MPEG2_FUSE_E         29 /* 1 bit */\r
118 #define DWL_SORENSONSPARK_FUSE_E 28 /* 1 bit */\r
119 #define DWL_JPEG_FUSE_E          27 /* 1 bit */\r
120 #define DWL_VP6_FUSE_E           26 /* 1 bit */\r
121 #define DWL_VC1_FUSE_E           25 /* 1 bit */\r
122 #define DWL_PJPEG_FUSE_E         24 /* 1 bit */\r
123 #define DWL_CUSTOM_MPEG4_FUSE_E  23 /* 1 bit */\r
124 #define DWL_RV_FUSE_E            22 /* 1 bit */\r
125 #define DWL_VP7_FUSE_E           21 /* 1 bit */\r
126 #define DWL_VP8_FUSE_E           20 /* 1 bit */\r
127 #define DWL_AVS_FUSE_E           19 /* 1 bit */\r
128 #define DWL_MVC_FUSE_E           18 /* 1 bit */\r
129 \r
130 #define DWL_DEC_MAX_1920_FUSE_E  15 /* 1 bit */\r
131 #define DWL_DEC_MAX_1280_FUSE_E  14 /* 1 bit */\r
132 #define DWL_DEC_MAX_720_FUSE_E   13 /* 1 bit */\r
133 #define DWL_DEC_MAX_352_FUSE_E   12 /* 1 bit */\r
134 #define DWL_REF_BUFF_FUSE_E       7 /* 1 bit */\r
135 \r
136 \r
137 #define DWL_PP_FUSE_E    31  /* 1 bit */\r
138 #define DWL_PP_DEINTERLACE_FUSE_E   30  /* 1 bit */\r
139 #define DWL_PP_ALPHA_BLEND_FUSE_E   29  /* 1 bit */\r
140 #define DWL_PP_MAX_1920_FUSE_E  15  /* 1 bit */\r
141 #define DWL_PP_MAX_1280_FUSE_E  14  /* 1 bit */\r
142 #define DWL_PP_MAX_720_FUSE_E  13  /* 1 bit */\r
143 #define DWL_PP_MAX_352_FUSE_E  12  /* 1 bit */\r
144 \r
145 \r
146 #define MPEG4_NOT_SUPPORTED             (u32)(0x00)\r
147 #define MPEG4_SIMPLE_PROFILE            (u32)(0x01)\r
148 #define MPEG4_ADVANCED_SIMPLE_PROFILE   (u32)(0x02)\r
149 #define MPEG4_CUSTOM_NOT_SUPPORTED      (u32)(0x00)\r
150 #define MPEG4_CUSTOM_FEATURE_1          (u32)(0x01)\r
151 #define H264_NOT_SUPPORTED              (u32)(0x00)\r
152 #define H264_BASELINE_PROFILE           (u32)(0x01)\r
153 #define H264_MAIN_PROFILE               (u32)(0x02)\r
154 #define H264_HIGH_PROFILE               (u32)(0x03)\r
155 #define VC1_NOT_SUPPORTED               (u32)(0x00)\r
156 #define VC1_SIMPLE_PROFILE              (u32)(0x01)\r
157 #define VC1_MAIN_PROFILE                (u32)(0x02)\r
158 #define VC1_ADVANCED_PROFILE            (u32)(0x03)\r
159 #define MPEG2_NOT_SUPPORTED             (u32)(0x00)\r
160 #define MPEG2_MAIN_PROFILE              (u32)(0x01)\r
161 #define JPEG_NOT_SUPPORTED              (u32)(0x00)\r
162 #define JPEG_BASELINE                   (u32)(0x01)\r
163 #define JPEG_PROGRESSIVE                (u32)(0x02)\r
164 #define PP_NOT_SUPPORTED                (u32)(0x00)\r
165 #define PP_SUPPORTED                    (u32)(0x01)\r
166 #define PP_DITHERING                    (u32)(0x10000000)\r
167 #define PP_SCALING                      (u32)(0x0C000000)\r
168 #define PP_DEINTERLACING                (u32)(0x02000000)\r
169 #define PP_ALPHA_BLENDING               (u32)(0x01000000)\r
170 #define SORENSON_SPARK_NOT_SUPPORTED    (u32)(0x00)\r
171 #define SORENSON_SPARK_SUPPORTED        (u32)(0x01)\r
172 #define VP6_NOT_SUPPORTED               (u32)(0x00)\r
173 #define VP6_SUPPORTED                   (u32)(0x01)\r
174 #define VP7_NOT_SUPPORTED               (u32)(0x00)\r
175 #define VP7_SUPPORTED                   (u32)(0x01)\r
176 #define VP8_NOT_SUPPORTED               (u32)(0x00)\r
177 #define VP8_SUPPORTED                   (u32)(0x01)\r
178 #define REF_BUF_NOT_SUPPORTED           (u32)(0x00)\r
179 #define REF_BUF_SUPPORTED               (u32)(0x01)\r
180 #define REF_BUF_INTERLACED              (u32)(0x02)\r
181 #define REF_BUF_DOUBLE                  (u32)(0x04)\r
182 #define AVS_NOT_SUPPORTED               (u32)(0x00)\r
183 #define AVS_SUPPORTED                   (u32)(0x01)\r
184 #define JPEG_EXT_NOT_SUPPORTED          (u32)(0x00)\r
185 #define JPEG_EXT_SUPPORTED              (u32)(0x01)\r
186 #define RV_NOT_SUPPORTED                (u32)(0x00)\r
187 #define RV_SUPPORTED                    (u32)(0x01)\r
188 #define MVC_NOT_SUPPORTED               (u32)(0x00)\r
189 #define MVC_SUPPORTED                   (u32)(0x01)\r
190 \r
191 #define H264_NOT_SUPPORTED_FUSE             (u32)(0x00)\r
192 #define H264_FUSE_ENABLED                   (u32)(0x01)\r
193 #define MPEG4_NOT_SUPPORTED_FUSE            (u32)(0x00)\r
194 #define MPEG4_FUSE_ENABLED                  (u32)(0x01)\r
195 #define MPEG2_NOT_SUPPORTED_FUSE            (u32)(0x00)\r
196 #define MPEG2_FUSE_ENABLED                  (u32)(0x01)\r
197 #define SORENSON_SPARK_NOT_SUPPORTED_FUSE   (u32)(0x00)\r
198 #define SORENSON_SPARK_ENABLED              (u32)(0x01)\r
199 #define JPEG_NOT_SUPPORTED_FUSE             (u32)(0x00)\r
200 #define JPEG_FUSE_ENABLED                   (u32)(0x01)\r
201 #define VP6_NOT_SUPPORTED_FUSE              (u32)(0x00)\r
202 #define VP6_FUSE_ENABLED                    (u32)(0x01)\r
203 #define VP7_NOT_SUPPORTED_FUSE              (u32)(0x00)\r
204 #define VP7_FUSE_ENABLED                    (u32)(0x01)\r
205 #define VP8_NOT_SUPPORTED_FUSE              (u32)(0x00)\r
206 #define VP8_FUSE_ENABLED                    (u32)(0x01)\r
207 #define VC1_NOT_SUPPORTED_FUSE              (u32)(0x00)\r
208 #define VC1_FUSE_ENABLED                    (u32)(0x01)\r
209 #define JPEG_PROGRESSIVE_NOT_SUPPORTED_FUSE (u32)(0x00)\r
210 #define JPEG_PROGRESSIVE_FUSE_ENABLED       (u32)(0x01)\r
211 #define REF_BUF_NOT_SUPPORTED_FUSE          (u32)(0x00)\r
212 #define REF_BUF_FUSE_ENABLED                (u32)(0x01)\r
213 #define AVS_NOT_SUPPORTED_FUSE              (u32)(0x00)\r
214 #define AVS_FUSE_ENABLED                    (u32)(0x01)\r
215 #define RV_NOT_SUPPORTED_FUSE               (u32)(0x00)\r
216 #define RV_FUSE_ENABLED                     (u32)(0x01)\r
217 #define MVC_NOT_SUPPORTED_FUSE              (u32)(0x00)\r
218 #define MVC_FUSE_ENABLED                    (u32)(0x01)\r
219 \r
220 #define PP_NOT_SUPPORTED_FUSE               (u32)(0x00)\r
221 #define PP_FUSE_ENABLED                     (u32)(0x01)\r
222 #define PP_FUSE_DEINTERLACING_ENABLED       (u32)(0x40000000)\r
223 #define PP_FUSE_ALPHA_BLENDING_ENABLED      (u32)(0x20000000)\r
224 #define MAX_PP_OUT_WIDHT_1920_FUSE_ENABLED  (u32)(0x00008000)\r
225 #define MAX_PP_OUT_WIDHT_1280_FUSE_ENABLED  (u32)(0x00004000)\r
226 #define MAX_PP_OUT_WIDHT_720_FUSE_ENABLED   (u32)(0x00002000)\r
227 #define MAX_PP_OUT_WIDHT_352_FUSE_ENABLED   (u32)(0x00001000)\r
228 \r
229 #define VPU_DEC_HWCFG0              50\r
230 #define VPU_DEC_HWCFG1              51\r
231 #define VPU_DEC_HW_FUSE_CFG         57\r
232 #define VPU_PP_HW_SYNTH_CFG         40\r
233 #define VPU_PP_HW_FUSE_CFG          41\r
234 \r
235 typedef struct VPUHwFuseStatus\r
236 {\r
237     u32 h264SupportFuse;            /* HW supports h.264 */\r
238     u32 mpeg4SupportFuse;           /* HW supports MPEG-4 */\r
239     u32 mpeg2SupportFuse;           /* HW supports MPEG-2 */\r
240     u32 sorensonSparkSupportFuse;   /* HW supports Sorenson Spark */\r
241     u32 jpegSupportFuse;            /* HW supports JPEG */\r
242     u32 vp6SupportFuse;             /* HW supports VP6 */\r
243     u32 vp7SupportFuse;             /* HW supports VP6 */\r
244     u32 vp8SupportFuse;             /* HW supports VP6 */\r
245     u32 vc1SupportFuse;             /* HW supports VC-1 Simple */\r
246     u32 jpegProgSupportFuse;        /* HW supports Progressive JPEG */\r
247     u32 ppSupportFuse;              /* HW supports post-processor */\r
248     u32 ppConfigFuse;               /* HW post-processor functions bitmask */\r
249     u32 maxDecPicWidthFuse;         /* Maximum video decoding width supported  */\r
250     u32 maxPpOutPicWidthFuse;       /* Maximum output width of Post-Processor */\r
251     u32 refBufSupportFuse;          /* HW supports reference picture buffering */\r
252     u32 avsSupportFuse;             /* one of the AVS values defined above */\r
253     u32 rvSupportFuse;              /* one of the REAL values defined above */\r
254     u32 mvcSupportFuse;\r
255     u32 customMpeg4SupportFuse;     /* Fuse for custom MPEG-4 */\r
256 \r
257 } VPUHwFuseStatus_t;\r
258 \r
259 \r
260 #endif\r
261 \r