1 // SPDX-License-Identifier: GPL-2.0
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"
8 struct 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
)
14 return mtk_vcodec_fw_vpu_init(dev
, fw_use
);
16 return mtk_vcodec_fw_scp_init(dev
);
18 mtk_v4l2_err("invalid vcodec fw type");
19 return ERR_PTR(-EINVAL
);
22 EXPORT_SYMBOL_GPL(mtk_vcodec_fw_select
);
24 void mtk_vcodec_fw_release(struct mtk_vcodec_fw
*fw
)
28 EXPORT_SYMBOL_GPL(mtk_vcodec_fw_release
);
30 int mtk_vcodec_fw_load_firmware(struct mtk_vcodec_fw
*fw
)
32 return fw
->ops
->load_firmware(fw
);
34 EXPORT_SYMBOL_GPL(mtk_vcodec_fw_load_firmware
);
36 unsigned int mtk_vcodec_fw_get_vdec_capa(struct mtk_vcodec_fw
*fw
)
38 return fw
->ops
->get_vdec_capa(fw
);
40 EXPORT_SYMBOL_GPL(mtk_vcodec_fw_get_vdec_capa
);
42 unsigned int mtk_vcodec_fw_get_venc_capa(struct mtk_vcodec_fw
*fw
)
44 return fw
->ops
->get_venc_capa(fw
);
46 EXPORT_SYMBOL_GPL(mtk_vcodec_fw_get_venc_capa
);
48 void *mtk_vcodec_fw_map_dm_addr(struct mtk_vcodec_fw
*fw
, u32 mem_addr
)
50 return fw
->ops
->map_dm_addr(fw
, mem_addr
);
52 EXPORT_SYMBOL_GPL(mtk_vcodec_fw_map_dm_addr
);
54 int mtk_vcodec_fw_ipi_register(struct mtk_vcodec_fw
*fw
, int id
,
55 mtk_vcodec_ipi_handler handler
,
56 const char *name
, void *priv
)
58 return fw
->ops
->ipi_register(fw
, id
, handler
, name
, priv
);
60 EXPORT_SYMBOL_GPL(mtk_vcodec_fw_ipi_register
);
62 int mtk_vcodec_fw_ipi_send(struct mtk_vcodec_fw
*fw
, int id
, void *buf
,
63 unsigned int len
, unsigned int wait
)
65 return fw
->ops
->ipi_send(fw
, id
, buf
, len
, wait
);
67 EXPORT_SYMBOL_GPL(mtk_vcodec_fw_ipi_send
);