Merge branch 'timers-timekeeping-for-linus' of git://git.kernel.org/pub/scm/linux...
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / staging / crystalhd / crystalhd_fw_if.h
1 /***************************************************************************
2 * Copyright (c) 2005-2009, Broadcom Corporation.
3 *
4 * Name: crystalhd_fw_if . h
5 *
6 * Description:
7 * BCM70012 Firmware interface definitions.
8 *
9 * HISTORY:
10 *
11 **********************************************************************
12 * This file is part of the crystalhd device driver.
13 *
14 * This driver is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, version 2 of the License.
17 *
18 * This driver is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this driver. If not, see <http://www.gnu.org/licenses/>.
25 **********************************************************************/
26
27 #ifndef _CRYSTALHD_FW_IF_H_
28 #define _CRYSTALHD_FW_IF_H_
29
30 /* TBD: Pull in only required defs into this file.. */
31
32 /* User Data Header */
33 struct user_data {
34 struct user_data *next;
35 uint32_t type;
36 uint32_t size;
37 };
38
39 /*------------------------------------------------------*
40 * MPEG Extension to the PPB *
41 *------------------------------------------------------*/
42 struct ppb_mpeg {
43 uint32_t to_be_defined;
44 uint32_t valid;
45
46 /* Always valid, defaults to picture size if no
47 sequence display extension in the stream. */
48 uint32_t display_horizontal_size;
49 uint32_t display_vertical_size;
50
51 /* MPEG_VALID_PANSCAN
52 Offsets are a copy values from the MPEG stream. */
53 uint32_t offset_count;
54 int32_t horizontal_offset[3];
55 int32_t vertical_offset[3];
56
57 /* MPEG_VALID_USERDATA
58 User data is in the form of a linked list. */
59 int32_t userDataSize;
60 struct user_data *userData;
61
62 };
63
64
65 /*------------------------------------------------------*
66 * VC1 Extension to the PPB *
67 *------------------------------------------------------*/
68 struct ppb_vc1 {
69 uint32_t to_be_defined;
70 uint32_t valid;
71
72 /* Always valid, defaults to picture size if no
73 sequence display extension in the stream. */
74 uint32_t display_horizontal_size;
75 uint32_t display_vertical_size;
76
77 /* VC1 pan scan windows */
78 uint32_t num_panscan_windows;
79 int32_t ps_horiz_offset[4];
80 int32_t ps_vert_offset[4];
81 int32_t ps_width[4];
82 int32_t ps_height[4];
83
84 /* VC1_VALID_USERDATA
85 User data is in the form of a linked list. */
86 int32_t userDataSize;
87 struct user_data *userData;
88
89 };
90
91 /*------------------------------------------------------*
92 * H.264 Extension to the PPB *
93 *------------------------------------------------------*/
94
95 /**
96 * @brief Film grain SEI message.
97 *
98 * Content of the film grain SEI message.
99 */
100
101 /* maximum number of model-values as for Thomson spec(standard says 5) */
102 #define MAX_FGT_MODEL_VALUE (3)
103
104 /* maximum number of intervals(as many as 256 intervals?) */
105 #define MAX_FGT_VALUE_INTERVAL (256)
106
107 struct fgt_sei {
108 struct fgt_sei *next;
109 unsigned char model_values[3][MAX_FGT_VALUE_INTERVAL][MAX_FGT_MODEL_VALUE];
110 unsigned char upper_bound[3][MAX_FGT_VALUE_INTERVAL];
111 unsigned char lower_bound[3][MAX_FGT_VALUE_INTERVAL];
112
113 unsigned char cancel_flag; /* Cancel flag: 1 no film grain. */
114 unsigned char model_id; /* Model id. */
115
116 /* +unused SE based on Thomson spec */
117 unsigned char color_desc_flag; /* Separate color descrition flag. */
118 unsigned char bit_depth_luma; /* Bit depth luma minus 8. */
119 unsigned char bit_depth_chroma; /* Bit depth chroma minus 8. */
120 unsigned char full_range_flag; /* Full range flag. */
121 unsigned char color_primaries; /* Color primaries. */
122 unsigned char transfer_charact; /* Transfer characteristics. */
123 unsigned char matrix_coeff; /*< Matrix coefficients. */
124 /* -unused SE based on Thomson spec */
125
126 unsigned char blending_mode_id; /* Blending mode. */
127 unsigned char log2_scale_factor; /* Log2 scale factor (2-7). */
128 unsigned char comp_flag[3]; /* Components [0,2] parameters present flag. */
129 unsigned char num_intervals_minus1[3]; /* Number of intensity level intervals. */
130 unsigned char num_model_values[3]; /* Number of model values. */
131 uint16_t repetition_period; /* Repetition period (0-16384) */
132
133 };
134
135 struct ppb_h264 {
136 /* 'valid' specifies which fields (or sets of
137 * fields) below are valid. If the corresponding
138 * bit in 'valid' is NOT set then that field(s)
139 * is (are) not initialized. */
140 uint32_t valid;
141
142 int32_t poc_top; /* POC for Top Field/Frame */
143 int32_t poc_bottom; /* POC for Bottom Field */
144 uint32_t idr_pic_id;
145
146 /* H264_VALID_PANSCAN */
147 uint32_t pan_scan_count;
148 int32_t pan_scan_left[3];
149 int32_t pan_scan_right[3];
150 int32_t pan_scan_top[3];
151 int32_t pan_scan_bottom[3];
152
153 /* H264_VALID_CT_TYPE */
154 uint32_t ct_type_count;
155 uint32_t ct_type[3];
156
157 /* H264_VALID_SPS_CROP */
158 int32_t sps_crop_left;
159 int32_t sps_crop_right;
160 int32_t sps_crop_top;
161 int32_t sps_crop_bottom;
162
163 /* H264_VALID_VUI */
164 uint32_t chroma_top;
165 uint32_t chroma_bottom;
166
167 /* H264_VALID_USER */
168 uint32_t user_data_size;
169 struct user_data *user_data;
170
171 /* H264 VALID FGT */
172 struct fgt_sei *pfgt;
173
174 };
175
176 struct ppb {
177 /* Common fields. */
178 uint32_t picture_number; /* Ordinal display number */
179 uint32_t video_buffer; /* Video (picbuf) number */
180 uint32_t video_address; /* Address of picbuf Y */
181 uint32_t video_address_uv; /* Address of picbuf UV */
182 uint32_t video_stripe; /* Picbuf stripe */
183 uint32_t video_width; /* Picbuf width */
184 uint32_t video_height; /* Picbuf height */
185
186 uint32_t channel_id; /* Decoder channel ID */
187 uint32_t status; /* reserved */
188 uint32_t width; /* pixels */
189 uint32_t height; /* pixels */
190 uint32_t chroma_format; /* see above */
191 uint32_t pulldown; /* see above */
192 uint32_t flags; /* see above */
193 uint32_t pts; /* 32 LSBs of PTS */
194 uint32_t protocol; /* protocolXXX (above) */
195
196 uint32_t frame_rate; /* see above */
197 uint32_t matrix_coeff; /* see above */
198 uint32_t aspect_ratio; /* see above */
199 uint32_t colour_primaries; /* see above */
200 uint32_t transfer_char; /* see above */
201 uint32_t pcr_offset; /* 45kHz if PCR type; else 27MHz */
202 uint32_t n_drop; /* Number of pictures to be dropped */
203
204 uint32_t custom_aspect_ratio_width_height;
205 /* upper 16-bits is Y and lower 16-bits is X */
206
207 uint32_t picture_tag; /* Indexing tag from BUD packets */
208 uint32_t picture_done_payload;
209 uint32_t picture_meta_payload;
210 uint32_t reserved[1];
211
212 /* Protocol-specific extensions. */
213 union {
214 struct ppb_h264 h264;
215 struct ppb_mpeg mpeg;
216 struct ppb_vc1 vc1;
217 } other;
218
219 };
220
221 struct c011_pib {
222 uint32_t bFormatChange;
223 uint32_t resolution;
224 uint32_t channelId;
225 uint32_t ppbPtr;
226 int32_t ptsStcOffset;
227 uint32_t zeroPanscanValid;
228 uint32_t dramOutBufAddr;
229 uint32_t yComponent;
230 struct ppb ppb;
231
232 };
233
234 struct dec_rsp_channel_start_video {
235 uint32_t command;
236 uint32_t sequence;
237 uint32_t status;
238 uint32_t picBuf;
239 uint32_t picRelBuf;
240 uint32_t picInfoDeliveryQ;
241 uint32_t picInfoReleaseQ;
242 uint32_t channelStatus;
243 uint32_t userDataDeliveryQ;
244 uint32_t userDataReleaseQ;
245 uint32_t transportStreamCaptureAddr;
246 uint32_t asyncEventQ;
247
248 };
249
250 #define eCMD_C011_CMD_BASE (0x73763000)
251
252 /* host commands */
253 enum c011_ts_cmd {
254 eCMD_TS_GET_NEXT_PIC = 0x7376F100, /* debug get next picture */
255 eCMD_TS_GET_LAST_PIC = 0x7376F102, /* debug get last pic status */
256 eCMD_TS_READ_WRITE_MEM = 0x7376F104, /* debug read write memory */
257
258 /* New API commands */
259 /* General commands */
260 eCMD_C011_INIT = eCMD_C011_CMD_BASE + 0x01,
261 eCMD_C011_RESET = eCMD_C011_CMD_BASE + 0x02,
262 eCMD_C011_SELF_TEST = eCMD_C011_CMD_BASE + 0x03,
263 eCMD_C011_GET_VERSION = eCMD_C011_CMD_BASE + 0x04,
264 eCMD_C011_GPIO = eCMD_C011_CMD_BASE + 0x05,
265 eCMD_C011_DEBUG_SETUP = eCMD_C011_CMD_BASE + 0x06,
266
267 /* Decoding commands */
268 eCMD_C011_DEC_CHAN_OPEN = eCMD_C011_CMD_BASE + 0x100,
269 eCMD_C011_DEC_CHAN_CLOSE = eCMD_C011_CMD_BASE + 0x101,
270 eCMD_C011_DEC_CHAN_ACTIVATE = eCMD_C011_CMD_BASE + 0x102,
271 eCMD_C011_DEC_CHAN_STATUS = eCMD_C011_CMD_BASE + 0x103,
272 eCMD_C011_DEC_CHAN_FLUSH = eCMD_C011_CMD_BASE + 0x104,
273 eCMD_C011_DEC_CHAN_TRICK_PLAY = eCMD_C011_CMD_BASE + 0x105,
274 eCMD_C011_DEC_CHAN_TS_PIDS = eCMD_C011_CMD_BASE + 0x106,
275 eCMD_C011_DEC_CHAN_PS_STREAM_ID = eCMD_C011_CMD_BASE + 0x107,
276 eCMD_C011_DEC_CHAN_INPUT_PARAMS = eCMD_C011_CMD_BASE + 0x108,
277 eCMD_C011_DEC_CHAN_VIDEO_OUTPUT = eCMD_C011_CMD_BASE + 0x109,
278 eCMD_C011_DEC_CHAN_OUTPUT_FORMAT = eCMD_C011_CMD_BASE + 0x10A,
279 eCMD_C011_DEC_CHAN_SCALING_FILTERS = eCMD_C011_CMD_BASE + 0x10B,
280 eCMD_C011_DEC_CHAN_OSD_MODE = eCMD_C011_CMD_BASE + 0x10D,
281 eCMD_C011_DEC_CHAN_DROP = eCMD_C011_CMD_BASE + 0x10E,
282 eCMD_C011_DEC_CHAN_RELEASE = eCMD_C011_CMD_BASE + 0x10F,
283 eCMD_C011_DEC_CHAN_STREAM_SETTINGS = eCMD_C011_CMD_BASE + 0x110,
284 eCMD_C011_DEC_CHAN_PAUSE_OUTPUT = eCMD_C011_CMD_BASE + 0x111,
285 eCMD_C011_DEC_CHAN_CHANGE = eCMD_C011_CMD_BASE + 0x112,
286 eCMD_C011_DEC_CHAN_SET_STC = eCMD_C011_CMD_BASE + 0x113,
287 eCMD_C011_DEC_CHAN_SET_PTS = eCMD_C011_CMD_BASE + 0x114,
288 eCMD_C011_DEC_CHAN_CC_MODE = eCMD_C011_CMD_BASE + 0x115,
289 eCMD_C011_DEC_CREATE_AUDIO_CONTEXT = eCMD_C011_CMD_BASE + 0x116,
290 eCMD_C011_DEC_COPY_AUDIO_CONTEXT = eCMD_C011_CMD_BASE + 0x117,
291 eCMD_C011_DEC_DELETE_AUDIO_CONTEXT = eCMD_C011_CMD_BASE + 0x118,
292 eCMD_C011_DEC_CHAN_SET_DECYPTION = eCMD_C011_CMD_BASE + 0x119,
293 eCMD_C011_DEC_CHAN_START_VIDEO = eCMD_C011_CMD_BASE + 0x11A,
294 eCMD_C011_DEC_CHAN_STOP_VIDEO = eCMD_C011_CMD_BASE + 0x11B,
295 eCMD_C011_DEC_CHAN_PIC_CAPTURE = eCMD_C011_CMD_BASE + 0x11C,
296 eCMD_C011_DEC_CHAN_PAUSE = eCMD_C011_CMD_BASE + 0x11D,
297 eCMD_C011_DEC_CHAN_PAUSE_STATE = eCMD_C011_CMD_BASE + 0x11E,
298 eCMD_C011_DEC_CHAN_SET_SLOWM_RATE = eCMD_C011_CMD_BASE + 0x11F,
299 eCMD_C011_DEC_CHAN_GET_SLOWM_RATE = eCMD_C011_CMD_BASE + 0x120,
300 eCMD_C011_DEC_CHAN_SET_FF_RATE = eCMD_C011_CMD_BASE + 0x121,
301 eCMD_C011_DEC_CHAN_GET_FF_RATE = eCMD_C011_CMD_BASE + 0x122,
302 eCMD_C011_DEC_CHAN_FRAME_ADVANCE = eCMD_C011_CMD_BASE + 0x123,
303 eCMD_C011_DEC_CHAN_SET_SKIP_PIC_MODE = eCMD_C011_CMD_BASE + 0x124,
304 eCMD_C011_DEC_CHAN_GET_SKIP_PIC_MODE = eCMD_C011_CMD_BASE + 0x125,
305 eCMD_C011_DEC_CHAN_FILL_PIC_BUF = eCMD_C011_CMD_BASE + 0x126,
306 eCMD_C011_DEC_CHAN_SET_CONTINUITY_CHECK = eCMD_C011_CMD_BASE + 0x127,
307 eCMD_C011_DEC_CHAN_GET_CONTINUITY_CHECK = eCMD_C011_CMD_BASE + 0x128,
308 eCMD_C011_DEC_CHAN_SET_BRCM_TRICK_MODE = eCMD_C011_CMD_BASE + 0x129,
309 eCMD_C011_DEC_CHAN_GET_BRCM_TRICK_MODE = eCMD_C011_CMD_BASE + 0x12A,
310 eCMD_C011_DEC_CHAN_REVERSE_FIELD_STATUS = eCMD_C011_CMD_BASE + 0x12B,
311 eCMD_C011_DEC_CHAN_I_PICTURE_FOUND = eCMD_C011_CMD_BASE + 0x12C,
312 eCMD_C011_DEC_CHAN_SET_PARAMETER = eCMD_C011_CMD_BASE + 0x12D,
313 eCMD_C011_DEC_CHAN_SET_USER_DATA_MODE = eCMD_C011_CMD_BASE + 0x12E,
314 eCMD_C011_DEC_CHAN_SET_PAUSE_DISPLAY_MODE = eCMD_C011_CMD_BASE + 0x12F,
315 eCMD_C011_DEC_CHAN_SET_SLOW_DISPLAY_MODE = eCMD_C011_CMD_BASE + 0x130,
316 eCMD_C011_DEC_CHAN_SET_FF_DISPLAY_MODE = eCMD_C011_CMD_BASE + 0x131,
317 eCMD_C011_DEC_CHAN_SET_DISPLAY_TIMING_MODE = eCMD_C011_CMD_BASE + 0x132,
318 eCMD_C011_DEC_CHAN_SET_DISPLAY_MODE = eCMD_C011_CMD_BASE + 0x133,
319 eCMD_C011_DEC_CHAN_GET_DISPLAY_MODE = eCMD_C011_CMD_BASE + 0x134,
320 eCMD_C011_DEC_CHAN_SET_REVERSE_FIELD = eCMD_C011_CMD_BASE + 0x135,
321 eCMD_C011_DEC_CHAN_STREAM_OPEN = eCMD_C011_CMD_BASE + 0x136,
322 eCMD_C011_DEC_CHAN_SET_PCR_PID = eCMD_C011_CMD_BASE + 0x137,
323 eCMD_C011_DEC_CHAN_SET_VID_PID = eCMD_C011_CMD_BASE + 0x138,
324 eCMD_C011_DEC_CHAN_SET_PAN_SCAN_MODE = eCMD_C011_CMD_BASE + 0x139,
325 eCMD_C011_DEC_CHAN_START_DISPLAY_AT_PTS = eCMD_C011_CMD_BASE + 0x140,
326 eCMD_C011_DEC_CHAN_STOP_DISPLAY_AT_PTS = eCMD_C011_CMD_BASE + 0x141,
327 eCMD_C011_DEC_CHAN_SET_DISPLAY_ORDER = eCMD_C011_CMD_BASE + 0x142,
328 eCMD_C011_DEC_CHAN_GET_DISPLAY_ORDER = eCMD_C011_CMD_BASE + 0x143,
329 eCMD_C011_DEC_CHAN_SET_HOST_TRICK_MODE = eCMD_C011_CMD_BASE + 0x144,
330 eCMD_C011_DEC_CHAN_SET_OPERATION_MODE = eCMD_C011_CMD_BASE + 0x145,
331 eCMD_C011_DEC_CHAN_DISPLAY_PAUSE_UNTO_PTS = eCMD_C011_CMD_BASE + 0x146,
332 eCMD_C011_DEC_CHAN_SET_PTS_STC_DIFF_THRESHOLD = eCMD_C011_CMD_BASE + 0x147,
333 eCMD_C011_DEC_CHAN_SEND_COMPRESSED_BUF = eCMD_C011_CMD_BASE + 0x148,
334 eCMD_C011_DEC_CHAN_SET_CLIPPING = eCMD_C011_CMD_BASE + 0x149,
335 eCMD_C011_DEC_CHAN_SET_PARAMETERS_FOR_HARD_RESET_INTERRUPT_TO_HOST
336 = eCMD_C011_CMD_BASE + 0x150,
337
338 /* Decoder RevD commands */
339 eCMD_C011_DEC_CHAN_SET_CSC = eCMD_C011_CMD_BASE + 0x180, /* color space conversion */
340 eCMD_C011_DEC_CHAN_SET_RANGE_REMAP = eCMD_C011_CMD_BASE + 0x181,
341 eCMD_C011_DEC_CHAN_SET_FGT = eCMD_C011_CMD_BASE + 0x182,
342 /* Note: 0x183 not implemented yet in Rev D main */
343 eCMD_C011_DEC_CHAN_SET_LASTPICTURE_PADDING = eCMD_C011_CMD_BASE + 0x183,
344
345 /* Decoder 7412 commands (7412-only) */
346 eCMD_C011_DEC_CHAN_SET_CONTENT_KEY = eCMD_C011_CMD_BASE + 0x190,
347 eCMD_C011_DEC_CHAN_SET_SESSION_KEY = eCMD_C011_CMD_BASE + 0x191,
348 eCMD_C011_DEC_CHAN_FMT_CHANGE_ACK = eCMD_C011_CMD_BASE + 0x192,
349
350 eCMD_C011_DEC_CHAN_CUSTOM_VIDOUT = eCMD_C011_CMD_BASE + 0x1FF,
351
352 /* Encoding commands */
353 eCMD_C011_ENC_CHAN_OPEN = eCMD_C011_CMD_BASE + 0x200,
354 eCMD_C011_ENC_CHAN_CLOSE = eCMD_C011_CMD_BASE + 0x201,
355 eCMD_C011_ENC_CHAN_ACTIVATE = eCMD_C011_CMD_BASE + 0x202,
356 eCMD_C011_ENC_CHAN_CONTROL = eCMD_C011_CMD_BASE + 0x203,
357 eCMD_C011_ENC_CHAN_STATISTICS = eCMD_C011_CMD_BASE + 0x204,
358
359 eNOTIFY_C011_ENC_CHAN_EVENT = eCMD_C011_CMD_BASE + 0x210,
360
361 };
362
363 #endif