mtk_vcodec_fw.c (1893B)
1// SPDX-License-Identifier: GPL-2.0 2 3#include "mtk_vcodec_fw.h" 4#include "mtk_vcodec_fw_priv.h" 5#include "mtk_vcodec_util.h" 6#include "mtk_vcodec_drv.h" 7 8struct mtk_vcodec_fw *mtk_vcodec_fw_select(struct mtk_vcodec_dev *dev, 9 enum mtk_vcodec_fw_type type, 10 enum mtk_vcodec_fw_use fw_use) 11{ 12 switch (type) { 13 case VPU: 14 return mtk_vcodec_fw_vpu_init(dev, fw_use); 15 case SCP: 16 return mtk_vcodec_fw_scp_init(dev); 17 default: 18 mtk_v4l2_err("invalid vcodec fw type"); 19 return ERR_PTR(-EINVAL); 20 } 21} 22EXPORT_SYMBOL_GPL(mtk_vcodec_fw_select); 23 24void mtk_vcodec_fw_release(struct mtk_vcodec_fw *fw) 25{ 26 fw->ops->release(fw); 27} 28EXPORT_SYMBOL_GPL(mtk_vcodec_fw_release); 29 30int mtk_vcodec_fw_load_firmware(struct mtk_vcodec_fw *fw) 31{ 32 return fw->ops->load_firmware(fw); 33} 34EXPORT_SYMBOL_GPL(mtk_vcodec_fw_load_firmware); 35 36unsigned int mtk_vcodec_fw_get_vdec_capa(struct mtk_vcodec_fw *fw) 37{ 38 return fw->ops->get_vdec_capa(fw); 39} 40EXPORT_SYMBOL_GPL(mtk_vcodec_fw_get_vdec_capa); 41 42unsigned int mtk_vcodec_fw_get_venc_capa(struct mtk_vcodec_fw *fw) 43{ 44 return fw->ops->get_venc_capa(fw); 45} 46EXPORT_SYMBOL_GPL(mtk_vcodec_fw_get_venc_capa); 47 48void *mtk_vcodec_fw_map_dm_addr(struct mtk_vcodec_fw *fw, u32 mem_addr) 49{ 50 return fw->ops->map_dm_addr(fw, mem_addr); 51} 52EXPORT_SYMBOL_GPL(mtk_vcodec_fw_map_dm_addr); 53 54int mtk_vcodec_fw_ipi_register(struct mtk_vcodec_fw *fw, int id, 55 mtk_vcodec_ipi_handler handler, 56 const char *name, void *priv) 57{ 58 return fw->ops->ipi_register(fw, id, handler, name, priv); 59} 60EXPORT_SYMBOL_GPL(mtk_vcodec_fw_ipi_register); 61 62int mtk_vcodec_fw_ipi_send(struct mtk_vcodec_fw *fw, int id, void *buf, 63 unsigned int len, unsigned int wait) 64{ 65 return fw->ops->ipi_send(fw, id, buf, len, wait); 66} 67EXPORT_SYMBOL_GPL(mtk_vcodec_fw_ipi_send); 68 69int mtk_vcodec_fw_get_type(struct mtk_vcodec_fw *fw) 70{ 71 return fw->type; 72} 73EXPORT_SYMBOL_GPL(mtk_vcodec_fw_get_type);