2 * drivers/media/platform/s5p-mfc/s5p_mfc_opr.h
4 * Header file for Samsung MFC (Multi Function Codec - FIMV) driver
5 * Contains declarations of hw related functions.
7 * Kamil Debski, Copyright (C) 2012 Samsung Electronics Co., Ltd.
8 * http://www.samsung.com/
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
15 #ifndef S5P_MFC_OPR_H_
16 #define S5P_MFC_OPR_H_
18 #include "s5p_mfc_common.h"
22 /* codec common registers */
26 void *risc_base_address;
28 void *host2risc_command;
29 void *risc2host_command;
30 void *mfc_bus_reset_ctrl;
31 void *firmware_version;
34 void *context_mem_addr;
35 void *context_mem_size;
37 void *metadata_enable;
39 void *dbg_info_enable;
40 void *dbg_buffer_addr;
41 void *dbg_buffer_size;
43 void *mfc_timeout_value;
44 void *hed_shared_mem_addr;
45 void *dis_shared_mem_addr;/* only v7 */
46 void *ret_instance_id;
48 void *dbg_buffer_output_size;
49 void *metadata_status;
50 void *metadata_addr_mb_info;
51 void *metadata_size_mb_info;
52 void *dbg_info_stage_counter;
54 /* decoder registers */
57 void *d_display_delay;
58 void *d_set_frame_width;
59 void *d_set_frame_height;
62 void *d_min_first_plane_dpb_size;
63 void *d_min_second_plane_dpb_size;
64 void *d_min_third_plane_dpb_size;/* only v8 */
66 void *d_mvc_num_views;
67 void *d_min_num_dis;/* only v7 */
68 void *d_min_first_dis_size;/* only v7 */
69 void *d_min_second_dis_size;/* only v7 */
70 void *d_min_third_dis_size;/* only v7 */
71 void *d_post_filter_luma_dpb0;/* v7 and v8 */
72 void *d_post_filter_luma_dpb1;/* v7 and v8 */
73 void *d_post_filter_luma_dpb2;/* only v7 */
74 void *d_post_filter_chroma_dpb0;/* v7 and v8 */
75 void *d_post_filter_chroma_dpb1;/* v7 and v8 */
76 void *d_post_filter_chroma_dpb2;/* only v7 */
79 void *d_init_buffer_options;
80 void *d_first_plane_dpb_stride_size;/* only v8 */
81 void *d_second_plane_dpb_stride_size;/* only v8 */
82 void *d_third_plane_dpb_stride_size;/* only v8 */
83 void *d_first_plane_dpb_size;
84 void *d_second_plane_dpb_size;
85 void *d_third_plane_dpb_size;/* only v8 */
86 void *d_mv_buffer_size;
87 void *d_first_plane_dpb;
88 void *d_second_plane_dpb;
89 void *d_third_plane_dpb;
91 void *d_scratch_buffer_addr;
92 void *d_scratch_buffer_size;
93 void *d_metadata_buffer_addr;
94 void *d_metadata_buffer_size;
95 void *d_nal_start_options;/* v7 and v8 */
96 void *d_cpb_buffer_addr;
97 void *d_cpb_buffer_size;
98 void *d_available_dpb_flag_upper;
99 void *d_available_dpb_flag_lower;
100 void *d_cpb_buffer_offset;
101 void *d_slice_if_enable;
103 void *d_stream_data_size;
104 void *d_dynamic_dpb_flag_upper;/* v7 and v8 */
105 void *d_dynamic_dpb_flag_lower;/* v7 and v8 */
106 void *d_display_frame_width;
107 void *d_display_frame_height;
108 void *d_display_status;
109 void *d_display_first_plane_addr;
110 void *d_display_second_plane_addr;
111 void *d_display_third_plane_addr;/* only v8 */
112 void *d_display_frame_type;
113 void *d_display_crop_info1;
114 void *d_display_crop_info2;
115 void *d_display_picture_profile;
116 void *d_display_luma_crc;/* v7 and v8 */
117 void *d_display_chroma0_crc;/* v7 and v8 */
118 void *d_display_chroma1_crc;/* only v8 */
119 void *d_display_luma_crc_top;/* only v6 */
120 void *d_display_chroma_crc_top;/* only v6 */
121 void *d_display_luma_crc_bot;/* only v6 */
122 void *d_display_chroma_crc_bot;/* only v6 */
123 void *d_display_aspect_ratio;
124 void *d_display_extended_ar;
125 void *d_decoded_frame_width;
126 void *d_decoded_frame_height;
127 void *d_decoded_status;
128 void *d_decoded_first_plane_addr;
129 void *d_decoded_second_plane_addr;
130 void *d_decoded_third_plane_addr;/* only v8 */
131 void *d_decoded_frame_type;
132 void *d_decoded_crop_info1;
133 void *d_decoded_crop_info2;
134 void *d_decoded_picture_profile;
135 void *d_decoded_nal_size;
136 void *d_decoded_luma_crc;
137 void *d_decoded_chroma0_crc;
138 void *d_decoded_chroma1_crc;/* only v8 */
139 void *d_ret_picture_tag_top;
140 void *d_ret_picture_tag_bot;
141 void *d_ret_picture_time_top;
142 void *d_ret_picture_time_bot;
143 void *d_chroma_format;
144 void *d_vc1_info;/* v7 and v8 */
147 void *d_metadata_addr_concealed_mb;
148 void *d_metadata_size_concealed_mb;
149 void *d_metadata_addr_vc1_param;
150 void *d_metadata_size_vc1_param;
151 void *d_metadata_addr_sei_nal;
152 void *d_metadata_size_sei_nal;
153 void *d_metadata_addr_vui;
154 void *d_metadata_size_vui;
155 void *d_metadata_addr_mvcvui;/* v7 and v8 */
156 void *d_metadata_size_mvcvui;/* v7 and v8 */
158 void *d_frame_pack_sei_avail;
159 void *d_frame_pack_arrgment_id;
160 void *d_frame_pack_sei_info;
161 void *d_frame_pack_grid_pos;
162 void *d_display_recovery_sei_info;/* v7 and v8 */
163 void *d_decoded_recovery_sei_info;/* v7 and v8 */
164 void *d_display_first_addr;/* only v7 */
165 void *d_display_second_addr;/* only v7 */
166 void *d_display_third_addr;/* only v7 */
167 void *d_decoded_first_addr;/* only v7 */
168 void *d_decoded_second_addr;/* only v7 */
169 void *d_decoded_third_addr;/* only v7 */
170 void *d_used_dpb_flag_upper;/* v7 and v8 */
171 void *d_used_dpb_flag_lower;/* v7 and v8 */
173 /* encoder registers */
175 void *e_frame_height;
176 void *e_cropped_frame_width;
177 void *e_cropped_frame_height;
178 void *e_frame_crop_offset;
180 void *e_picture_profile;
181 void *e_vbv_buffer_size;
182 void *e_vbv_init_delay;
183 void *e_fixed_picture_qp;
186 void *e_rc_qp_bound_pb;/* v7 and v8 */
188 void *e_mb_rc_config;
189 void *e_padding_ctrl;
190 void *e_air_threshold;
191 void *e_mv_hor_range;
192 void *e_mv_ver_range;
197 void *e_scratch_buffer_addr;
198 void *e_scratch_buffer_size;
201 void *e_ir_buffer_addr;/* v7 and v8 */
202 void *e_source_first_plane_addr;
203 void *e_source_second_plane_addr;
204 void *e_source_third_plane_addr;/* v7 and v8 */
205 void *e_source_first_plane_stride;/* v7 and v8 */
206 void *e_source_second_plane_stride;/* v7 and v8 */
207 void *e_source_third_plane_stride;/* v7 and v8 */
208 void *e_stream_buffer_addr;
209 void *e_stream_buffer_size;
210 void *e_roi_buffer_addr;
211 void *e_param_change;
215 void *e_mslice_size_mb;
216 void *e_mslice_size_bits;
217 void *e_frame_insertion;
218 void *e_rc_frame_rate;
222 void *e_bit_count_enable;
223 void *e_max_bit_count;
224 void *e_min_bit_count;
225 void *e_metadata_buffer_addr;
226 void *e_metadata_buffer_size;
227 void *e_encoded_source_first_plane_addr;
228 void *e_encoded_source_second_plane_addr;
229 void *e_encoded_source_third_plane_addr;/* v7 and v8 */
232 void *e_picture_count;
233 void *e_ret_picture_tag;
234 void *e_stream_buffer_write_pointer; /* only v6 */
235 void *e_recon_luma_dpb_addr;
236 void *e_recon_chroma_dpb_addr;
237 void *e_metadata_addr_enc_slice;
238 void *e_metadata_size_enc_slice;
239 void *e_mpeg4_options;
240 void *e_mpeg4_hec_period;
241 void *e_aspect_ratio;
242 void *e_extended_sar;
243 void *e_h264_options;
244 void *e_h264_options_2;/* v7 and v8 */
245 void *e_h264_lf_alpha_offset;
246 void *e_h264_lf_beta_offset;
247 void *e_h264_i_period;
248 void *e_h264_fmo_slice_grp_map_type;
249 void *e_h264_fmo_num_slice_grp_minus1;
250 void *e_h264_fmo_slice_grp_change_dir;
251 void *e_h264_fmo_slice_grp_change_rate_minus1;
252 void *e_h264_fmo_run_length_minus1_0;
253 void *e_h264_aso_slice_order_0;
254 void *e_h264_chroma_qp_offset;
255 void *e_h264_num_t_layer;
256 void *e_h264_hierarchical_qp_layer0;
257 void *e_h264_frame_packing_sei_info;
258 void *e_h264_nal_control;/* v7 and v8 */
259 void *e_mvc_frame_qp_view1;
260 void *e_mvc_rc_bit_rate_view1;
261 void *e_mvc_rc_qbound_view1;
262 void *e_mvc_rc_mode_view1;
263 void *e_mvc_inter_view_prediction_on;
264 void *e_vp8_options;/* v7 and v8 */
265 void *e_vp8_filter_options;/* v7 and v8 */
266 void *e_vp8_golden_frame_option;/* v7 and v8 */
267 void *e_vp8_num_t_layer;/* v7 and v8 */
268 void *e_vp8_hierarchical_qp_layer0;/* v7 and v8 */
269 void *e_vp8_hierarchical_qp_layer1;/* v7 and v8 */
270 void *e_vp8_hierarchical_qp_layer2;/* v7 and v8 */
273 struct s5p_mfc_hw_ops {
274 int (*alloc_dec_temp_buffers)(struct s5p_mfc_ctx *ctx);
275 void (*release_dec_desc_buffer)(struct s5p_mfc_ctx *ctx);
276 int (*alloc_codec_buffers)(struct s5p_mfc_ctx *ctx);
277 void (*release_codec_buffers)(struct s5p_mfc_ctx *ctx);
278 int (*alloc_instance_buffer)(struct s5p_mfc_ctx *ctx);
279 void (*release_instance_buffer)(struct s5p_mfc_ctx *ctx);
280 int (*alloc_dev_context_buffer)(struct s5p_mfc_dev *dev);
281 void (*release_dev_context_buffer)(struct s5p_mfc_dev *dev);
282 void (*dec_calc_dpb_size)(struct s5p_mfc_ctx *ctx);
283 void (*enc_calc_src_size)(struct s5p_mfc_ctx *ctx);
284 int (*set_dec_stream_buffer)(struct s5p_mfc_ctx *ctx,
285 int buf_addr, unsigned int start_num_byte,
286 unsigned int buf_size);
287 int (*set_dec_frame_buffer)(struct s5p_mfc_ctx *ctx);
288 int (*set_enc_stream_buffer)(struct s5p_mfc_ctx *ctx,
289 unsigned long addr, unsigned int size);
290 void (*set_enc_frame_buffer)(struct s5p_mfc_ctx *ctx,
291 unsigned long y_addr, unsigned long c_addr);
292 void (*get_enc_frame_buffer)(struct s5p_mfc_ctx *ctx,
293 unsigned long *y_addr, unsigned long *c_addr);
294 int (*set_enc_ref_buffer)(struct s5p_mfc_ctx *ctx);
295 int (*init_decode)(struct s5p_mfc_ctx *ctx);
296 int (*init_encode)(struct s5p_mfc_ctx *ctx);
297 int (*encode_one_frame)(struct s5p_mfc_ctx *ctx);
298 void (*try_run)(struct s5p_mfc_dev *dev);
299 void (*cleanup_queue)(struct list_head *lh,
300 struct vb2_queue *vq);
301 void (*clear_int_flags)(struct s5p_mfc_dev *dev);
302 void (*write_info)(struct s5p_mfc_ctx *ctx, unsigned int data,
304 unsigned int (*read_info)(struct s5p_mfc_ctx *ctx,
306 int (*get_dspl_y_adr)(struct s5p_mfc_dev *dev);
307 int (*get_dec_y_adr)(struct s5p_mfc_dev *dev);
308 int (*get_dspl_status)(struct s5p_mfc_dev *dev);
309 int (*get_dec_status)(struct s5p_mfc_dev *dev);
310 int (*get_dec_frame_type)(struct s5p_mfc_dev *dev);
311 int (*get_disp_frame_type)(struct s5p_mfc_ctx *ctx);
312 int (*get_consumed_stream)(struct s5p_mfc_dev *dev);
313 int (*get_int_reason)(struct s5p_mfc_dev *dev);
314 int (*get_int_err)(struct s5p_mfc_dev *dev);
315 int (*err_dec)(unsigned int err);
316 int (*err_dspl)(unsigned int err);
317 int (*get_img_width)(struct s5p_mfc_dev *dev);
318 int (*get_img_height)(struct s5p_mfc_dev *dev);
319 int (*get_dpb_count)(struct s5p_mfc_dev *dev);
320 int (*get_mv_count)(struct s5p_mfc_dev *dev);
321 int (*get_inst_no)(struct s5p_mfc_dev *dev);
322 int (*get_enc_strm_size)(struct s5p_mfc_dev *dev);
323 int (*get_enc_slice_type)(struct s5p_mfc_dev *dev);
324 int (*get_enc_dpb_count)(struct s5p_mfc_dev *dev);
325 int (*get_enc_pic_count)(struct s5p_mfc_dev *dev);
326 int (*get_sei_avail_status)(struct s5p_mfc_ctx *ctx);
327 int (*get_mvc_num_views)(struct s5p_mfc_dev *dev);
328 int (*get_mvc_view_id)(struct s5p_mfc_dev *dev);
329 unsigned int (*get_pic_type_top)(struct s5p_mfc_ctx *ctx);
330 unsigned int (*get_pic_type_bot)(struct s5p_mfc_ctx *ctx);
331 unsigned int (*get_crop_info_h)(struct s5p_mfc_ctx *ctx);
332 unsigned int (*get_crop_info_v)(struct s5p_mfc_ctx *ctx);
335 void s5p_mfc_init_hw_ops(struct s5p_mfc_dev *dev);
336 void s5p_mfc_init_regs(struct s5p_mfc_dev *dev);
337 int s5p_mfc_alloc_priv_buf(struct device *dev,
338 struct s5p_mfc_priv_buf *b);
339 void s5p_mfc_release_priv_buf(struct device *dev,
340 struct s5p_mfc_priv_buf *b);
343 #endif /* S5P_MFC_OPR_H_ */