Linux-libre 3.11-gnu
[librecmc/linux-libre.git] / drivers / media / platform / s5p-mfc / s5p_mfc_opr.h
1 /*
2  * drivers/media/platform/s5p-mfc/s5p_mfc_opr.h
3  *
4  * Header file for Samsung MFC (Multi Function Codec - FIMV) driver
5  * Contains declarations of hw related functions.
6  *
7  * Kamil Debski, Copyright (C) 2012 Samsung Electronics Co., Ltd.
8  * http://www.samsung.com/
9  *
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.
13  */
14
15 #ifndef S5P_MFC_OPR_H_
16 #define S5P_MFC_OPR_H_
17
18 #include "s5p_mfc_common.h"
19
20 struct s5p_mfc_hw_ops {
21         int (*alloc_dec_temp_buffers)(struct s5p_mfc_ctx *ctx);
22         void (*release_dec_desc_buffer)(struct s5p_mfc_ctx *ctx);
23         int (*alloc_codec_buffers)(struct s5p_mfc_ctx *ctx);
24         void (*release_codec_buffers)(struct s5p_mfc_ctx *ctx);
25         int (*alloc_instance_buffer)(struct s5p_mfc_ctx *ctx);
26         void (*release_instance_buffer)(struct s5p_mfc_ctx *ctx);
27         int (*alloc_dev_context_buffer)(struct s5p_mfc_dev *dev);
28         void (*release_dev_context_buffer)(struct s5p_mfc_dev *dev);
29         void (*dec_calc_dpb_size)(struct s5p_mfc_ctx *ctx);
30         void (*enc_calc_src_size)(struct s5p_mfc_ctx *ctx);
31         int (*set_dec_stream_buffer)(struct s5p_mfc_ctx *ctx,
32                         int buf_addr, unsigned int start_num_byte,
33                         unsigned int buf_size);
34         int (*set_dec_frame_buffer)(struct s5p_mfc_ctx *ctx);
35         int (*set_enc_stream_buffer)(struct s5p_mfc_ctx *ctx,
36                         unsigned long addr, unsigned int size);
37         void (*set_enc_frame_buffer)(struct s5p_mfc_ctx *ctx,
38                         unsigned long y_addr, unsigned long c_addr);
39         void (*get_enc_frame_buffer)(struct s5p_mfc_ctx *ctx,
40                         unsigned long *y_addr, unsigned long *c_addr);
41         int (*set_enc_ref_buffer)(struct s5p_mfc_ctx *ctx);
42         int (*init_decode)(struct s5p_mfc_ctx *ctx);
43         int (*init_encode)(struct s5p_mfc_ctx *ctx);
44         int (*encode_one_frame)(struct s5p_mfc_ctx *ctx);
45         void (*try_run)(struct s5p_mfc_dev *dev);
46         void (*cleanup_queue)(struct list_head *lh,
47                         struct vb2_queue *vq);
48         void (*clear_int_flags)(struct s5p_mfc_dev *dev);
49         void (*write_info)(struct s5p_mfc_ctx *ctx, unsigned int data,
50                         unsigned int ofs);
51         unsigned int (*read_info)(struct s5p_mfc_ctx *ctx,
52                         unsigned int ofs);
53         int (*get_dspl_y_adr)(struct s5p_mfc_dev *dev);
54         int (*get_dec_y_adr)(struct s5p_mfc_dev *dev);
55         int (*get_dspl_status)(struct s5p_mfc_dev *dev);
56         int (*get_dec_status)(struct s5p_mfc_dev *dev);
57         int (*get_dec_frame_type)(struct s5p_mfc_dev *dev);
58         int (*get_disp_frame_type)(struct s5p_mfc_ctx *ctx);
59         int (*get_consumed_stream)(struct s5p_mfc_dev *dev);
60         int (*get_int_reason)(struct s5p_mfc_dev *dev);
61         int (*get_int_err)(struct s5p_mfc_dev *dev);
62         int (*err_dec)(unsigned int err);
63         int (*err_dspl)(unsigned int err);
64         int (*get_img_width)(struct s5p_mfc_dev *dev);
65         int (*get_img_height)(struct s5p_mfc_dev *dev);
66         int (*get_dpb_count)(struct s5p_mfc_dev *dev);
67         int (*get_mv_count)(struct s5p_mfc_dev *dev);
68         int (*get_inst_no)(struct s5p_mfc_dev *dev);
69         int (*get_enc_strm_size)(struct s5p_mfc_dev *dev);
70         int (*get_enc_slice_type)(struct s5p_mfc_dev *dev);
71         int (*get_enc_dpb_count)(struct s5p_mfc_dev *dev);
72         int (*get_enc_pic_count)(struct s5p_mfc_dev *dev);
73         int (*get_sei_avail_status)(struct s5p_mfc_ctx *ctx);
74         int (*get_mvc_num_views)(struct s5p_mfc_dev *dev);
75         int (*get_mvc_view_id)(struct s5p_mfc_dev *dev);
76         unsigned int (*get_pic_type_top)(struct s5p_mfc_ctx *ctx);
77         unsigned int (*get_pic_type_bot)(struct s5p_mfc_ctx *ctx);
78         unsigned int (*get_crop_info_h)(struct s5p_mfc_ctx *ctx);
79         unsigned int (*get_crop_info_v)(struct s5p_mfc_ctx *ctx);
80 };
81
82 void s5p_mfc_init_hw_ops(struct s5p_mfc_dev *dev);
83 int s5p_mfc_alloc_priv_buf(struct device *dev,
84                                         struct s5p_mfc_priv_buf *b);
85 void s5p_mfc_release_priv_buf(struct device *dev,
86                                         struct s5p_mfc_priv_buf *b);
87
88
89 #endif /* S5P_MFC_OPR_H_ */