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