1 /* SPDX-License-Identifier: GPL-2.0 */
2 
3 #ifndef _MTK_VCODEC_FW_H_
4 #define _MTK_VCODEC_FW_H_
5 
6 #include <linux/remoteproc.h>
7 #include <linux/remoteproc/mtk_scp.h>
8 
9 #include "../../vpu/mtk_vpu.h"
10 
11 struct mtk_vcodec_dec_dev;
12 struct mtk_vcodec_enc_dev;
13 
14 enum mtk_vcodec_fw_type {
15 	VPU,
16 	SCP,
17 };
18 
19 enum mtk_vcodec_fw_use {
20 	DECODER,
21 	ENCODER,
22 };
23 
24 struct mtk_vcodec_fw;
25 
26 typedef void (*mtk_vcodec_ipi_handler) (void *data,
27 	unsigned int len, void *priv);
28 
29 struct mtk_vcodec_fw *mtk_vcodec_fw_select(void *priv, enum mtk_vcodec_fw_type type,
30 					   enum mtk_vcodec_fw_use fw_use);
31 void mtk_vcodec_fw_release(struct mtk_vcodec_fw *fw);
32 
33 int mtk_vcodec_fw_load_firmware(struct mtk_vcodec_fw *fw);
34 unsigned int mtk_vcodec_fw_get_vdec_capa(struct mtk_vcodec_fw *fw);
35 unsigned int mtk_vcodec_fw_get_venc_capa(struct mtk_vcodec_fw *fw);
36 void *mtk_vcodec_fw_map_dm_addr(struct mtk_vcodec_fw *fw, u32 mem_addr);
37 int mtk_vcodec_fw_ipi_register(struct mtk_vcodec_fw *fw, int id,
38 			       mtk_vcodec_ipi_handler handler,
39 			       const char *name, void *priv);
40 int mtk_vcodec_fw_ipi_send(struct mtk_vcodec_fw *fw, int id,
41 			   void *buf, unsigned int len, unsigned int wait);
42 int mtk_vcodec_fw_get_type(struct mtk_vcodec_fw *fw);
43 
44 #endif /* _MTK_VCODEC_FW_H_ */
45