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