Linux 4.16.11
[linux/fpc-iii.git] / drivers / media / platform / mtk-vcodec / venc_ipi_msg.h
blob4c869cb6fbf70da002da59591beb756f2432366f
1 /*
2 * Copyright (c) 2016 MediaTek Inc.
3 * Author: Jungchang Tsao <jungchang.tsao@mediatek.com>
4 * Daniel Hsiao <daniel.hsiao@mediatek.com>
5 * Tiffany Lin <tiffany.lin@mediatek.com>
7 * This program is free software; you can redistribute it and/or
8 * modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
18 #ifndef _VENC_IPI_MSG_H_
19 #define _VENC_IPI_MSG_H_
21 #define AP_IPIMSG_VENC_BASE 0xC000
22 #define VPU_IPIMSG_VENC_BASE 0xD000
24 /**
25 * enum venc_ipi_msg_id - message id between AP and VPU
26 * (ipi stands for inter-processor interrupt)
27 * @AP_IPIMSG_ENC_XXX: AP to VPU cmd message id
28 * @VPU_IPIMSG_ENC_XXX_DONE: VPU ack AP cmd message id
30 enum venc_ipi_msg_id {
31 AP_IPIMSG_ENC_INIT = AP_IPIMSG_VENC_BASE,
32 AP_IPIMSG_ENC_SET_PARAM,
33 AP_IPIMSG_ENC_ENCODE,
34 AP_IPIMSG_ENC_DEINIT,
36 VPU_IPIMSG_ENC_INIT_DONE = VPU_IPIMSG_VENC_BASE,
37 VPU_IPIMSG_ENC_SET_PARAM_DONE,
38 VPU_IPIMSG_ENC_ENCODE_DONE,
39 VPU_IPIMSG_ENC_DEINIT_DONE,
42 /**
43 * struct venc_ap_ipi_msg_init - AP to VPU init cmd structure
44 * @msg_id: message id (AP_IPIMSG_XXX_ENC_INIT)
45 * @reserved: reserved for future use. vpu is running in 32bit. Without
46 * this reserved field, if kernel run in 64bit. this struct size
47 * will be different between kernel and vpu
48 * @venc_inst: AP encoder instance
49 * (struct venc_vp8_inst/venc_h264_inst *)
51 struct venc_ap_ipi_msg_init {
52 uint32_t msg_id;
53 uint32_t reserved;
54 uint64_t venc_inst;
57 /**
58 * struct venc_ap_ipi_msg_set_param - AP to VPU set_param cmd structure
59 * @msg_id: message id (AP_IPIMSG_XXX_ENC_SET_PARAM)
60 * @vpu_inst_addr: VPU encoder instance addr
61 * (struct venc_vp8_vsi/venc_h264_vsi *)
62 * @param_id: parameter id (venc_set_param_type)
63 * @data_item: number of items in the data array
64 * @data[8]: data array to store the set parameters
66 struct venc_ap_ipi_msg_set_param {
67 uint32_t msg_id;
68 uint32_t vpu_inst_addr;
69 uint32_t param_id;
70 uint32_t data_item;
71 uint32_t data[8];
74 /**
75 * struct venc_ap_ipi_msg_enc - AP to VPU enc cmd structure
76 * @msg_id: message id (AP_IPIMSG_XXX_ENC_ENCODE)
77 * @vpu_inst_addr: VPU encoder instance addr
78 * (struct venc_vp8_vsi/venc_h264_vsi *)
79 * @bs_mode: bitstream mode for h264
80 * (H264_BS_MODE_SPS/H264_BS_MODE_PPS/H264_BS_MODE_FRAME)
81 * @input_addr: pointer to input image buffer plane
82 * @bs_addr: pointer to output bit stream buffer
83 * @bs_size: bit stream buffer size
85 struct venc_ap_ipi_msg_enc {
86 uint32_t msg_id;
87 uint32_t vpu_inst_addr;
88 uint32_t bs_mode;
89 uint32_t input_addr[3];
90 uint32_t bs_addr;
91 uint32_t bs_size;
94 /**
95 * struct venc_ap_ipi_msg_deinit - AP to VPU deinit cmd structure
96 * @msg_id: message id (AP_IPIMSG_XXX_ENC_DEINIT)
97 * @vpu_inst_addr: VPU encoder instance addr
98 * (struct venc_vp8_vsi/venc_h264_vsi *)
100 struct venc_ap_ipi_msg_deinit {
101 uint32_t msg_id;
102 uint32_t vpu_inst_addr;
106 * enum venc_ipi_msg_status - VPU ack AP cmd status
108 enum venc_ipi_msg_status {
109 VENC_IPI_MSG_STATUS_OK,
110 VENC_IPI_MSG_STATUS_FAIL,
114 * struct venc_vpu_ipi_msg_common - VPU ack AP cmd common structure
115 * @msg_id: message id (VPU_IPIMSG_XXX_DONE)
116 * @status: cmd status (venc_ipi_msg_status)
117 * @venc_inst: AP encoder instance (struct venc_vp8_inst/venc_h264_inst *)
119 struct venc_vpu_ipi_msg_common {
120 uint32_t msg_id;
121 uint32_t status;
122 uint64_t venc_inst;
126 * struct venc_vpu_ipi_msg_init - VPU ack AP init cmd structure
127 * @msg_id: message id (VPU_IPIMSG_XXX_ENC_SET_PARAM_DONE)
128 * @status: cmd status (venc_ipi_msg_status)
129 * @venc_inst: AP encoder instance (struct venc_vp8_inst/venc_h264_inst *)
130 * @vpu_inst_addr: VPU encoder instance addr
131 * (struct venc_vp8_vsi/venc_h264_vsi *)
132 * @reserved: reserved for future use. vpu is running in 32bit. Without
133 * this reserved field, if kernel run in 64bit. this struct size
134 * will be different between kernel and vpu
136 struct venc_vpu_ipi_msg_init {
137 uint32_t msg_id;
138 uint32_t status;
139 uint64_t venc_inst;
140 uint32_t vpu_inst_addr;
141 uint32_t reserved;
145 * struct venc_vpu_ipi_msg_set_param - VPU ack AP set_param cmd structure
146 * @msg_id: message id (VPU_IPIMSG_XXX_ENC_SET_PARAM_DONE)
147 * @status: cmd status (venc_ipi_msg_status)
148 * @venc_inst: AP encoder instance (struct venc_vp8_inst/venc_h264_inst *)
149 * @param_id: parameter id (venc_set_param_type)
150 * @data_item: number of items in the data array
151 * @data[6]: data array to store the return result
153 struct venc_vpu_ipi_msg_set_param {
154 uint32_t msg_id;
155 uint32_t status;
156 uint64_t venc_inst;
157 uint32_t param_id;
158 uint32_t data_item;
159 uint32_t data[6];
163 * enum venc_ipi_msg_enc_state - Type of encode state
164 * VEN_IPI_MSG_ENC_STATE_FRAME: one frame being encoded
165 * VEN_IPI_MSG_ENC_STATE_PART: bit stream buffer full
166 * VEN_IPI_MSG_ENC_STATE_SKIP: encoded skip frame
167 * VEN_IPI_MSG_ENC_STATE_ERROR: encounter error
169 enum venc_ipi_msg_enc_state {
170 VEN_IPI_MSG_ENC_STATE_FRAME,
171 VEN_IPI_MSG_ENC_STATE_PART,
172 VEN_IPI_MSG_ENC_STATE_SKIP,
173 VEN_IPI_MSG_ENC_STATE_ERROR,
177 * struct venc_vpu_ipi_msg_enc - VPU ack AP enc cmd structure
178 * @msg_id: message id (VPU_IPIMSG_XXX_ENC_ENCODE_DONE)
179 * @status: cmd status (venc_ipi_msg_status)
180 * @venc_inst: AP encoder instance (struct venc_vp8_inst/venc_h264_inst *)
181 * @state: encode state (venc_ipi_msg_enc_state)
182 * @is_key_frm: whether the encoded frame is key frame
183 * @bs_size: encoded bitstream size
184 * @reserved: reserved for future use. vpu is running in 32bit. Without
185 * this reserved field, if kernel run in 64bit. this struct size
186 * will be different between kernel and vpu
188 struct venc_vpu_ipi_msg_enc {
189 uint32_t msg_id;
190 uint32_t status;
191 uint64_t venc_inst;
192 uint32_t state;
193 uint32_t is_key_frm;
194 uint32_t bs_size;
195 uint32_t reserved;
199 * struct venc_vpu_ipi_msg_deinit - VPU ack AP deinit cmd structure
200 * @msg_id: message id (VPU_IPIMSG_XXX_ENC_DEINIT_DONE)
201 * @status: cmd status (venc_ipi_msg_status)
202 * @venc_inst: AP encoder instance (struct venc_vp8_inst/venc_h264_inst *)
204 struct venc_vpu_ipi_msg_deinit {
205 uint32_t msg_id;
206 uint32_t status;
207 uint64_t venc_inst;
210 #endif /* _VENC_IPI_MSG_H_ */