1 /* SPDX-License-Identifier: GPL-2.0 */ 2 3 #ifndef _MTK_VCODEC_FW_PRIV_H_ 4 #define _MTK_VCODEC_FW_PRIV_H_ 5 6 #include "mtk_vcodec_fw.h" 7 8 struct mtk_vcodec_dec_dev; 9 struct mtk_vcodec_enc_dev; 10 11 struct mtk_vcodec_fw { 12 enum mtk_vcodec_fw_type type; 13 const struct mtk_vcodec_fw_ops *ops; 14 struct platform_device *pdev; 15 struct mtk_scp *scp; 16 enum mtk_vcodec_fw_use fw_use; 17 }; 18 19 struct mtk_vcodec_fw_ops { 20 int (*load_firmware)(struct mtk_vcodec_fw *fw); 21 unsigned int (*get_vdec_capa)(struct mtk_vcodec_fw *fw); 22 unsigned int (*get_venc_capa)(struct mtk_vcodec_fw *fw); 23 void *(*map_dm_addr)(struct mtk_vcodec_fw *fw, u32 dtcm_dmem_addr); 24 int (*ipi_register)(struct mtk_vcodec_fw *fw, int id, 25 mtk_vcodec_ipi_handler handler, const char *name, 26 void *priv); 27 int (*ipi_send)(struct mtk_vcodec_fw *fw, int id, void *buf, 28 unsigned int len, unsigned int wait); 29 void (*release)(struct mtk_vcodec_fw *fw); 30 }; 31 32 #if IS_ENABLED(CONFIG_VIDEO_MEDIATEK_VCODEC_VPU) 33 struct mtk_vcodec_fw *mtk_vcodec_fw_vpu_init(void *priv, enum mtk_vcodec_fw_use fw_use); 34 #else 35 static inline struct mtk_vcodec_fw * 36 mtk_vcodec_fw_vpu_init(void *priv, enum mtk_vcodec_fw_use fw_use) 37 { 38 return ERR_PTR(-ENODEV); 39 } 40 #endif /* CONFIG_VIDEO_MEDIATEK_VCODEC_VPU */ 41 42 #if IS_ENABLED(CONFIG_VIDEO_MEDIATEK_VCODEC_SCP) 43 struct mtk_vcodec_fw *mtk_vcodec_fw_scp_init(void *priv, enum mtk_vcodec_fw_use fw_use); 44 #else 45 static inline struct mtk_vcodec_fw * 46 mtk_vcodec_fw_scp_init(void *priv, enum mtk_vcodec_fw_use fw_use) 47 { 48 return ERR_PTR(-ENODEV); 49 } 50 #endif /* CONFIG_VIDEO_MEDIATEK_VCODEC_SCP */ 51 52 #endif /* _MTK_VCODEC_FW_PRIV_H_ */ 53