GNU Linux-libre 5.19-rc6-gnu
[releases.git] / drivers / media / platform / mediatek / vcodec / mtk_vcodec_fw_priv.h
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_dev;
9
10 struct mtk_vcodec_fw {
11         enum mtk_vcodec_fw_type type;
12         const struct mtk_vcodec_fw_ops *ops;
13         struct platform_device *pdev;
14         struct mtk_scp *scp;
15 };
16
17 struct mtk_vcodec_fw_ops {
18         int (*load_firmware)(struct mtk_vcodec_fw *fw);
19         unsigned int (*get_vdec_capa)(struct mtk_vcodec_fw *fw);
20         unsigned int (*get_venc_capa)(struct mtk_vcodec_fw *fw);
21         void *(*map_dm_addr)(struct mtk_vcodec_fw *fw, u32 dtcm_dmem_addr);
22         int (*ipi_register)(struct mtk_vcodec_fw *fw, int id,
23                             mtk_vcodec_ipi_handler handler, const char *name,
24                             void *priv);
25         int (*ipi_send)(struct mtk_vcodec_fw *fw, int id, void *buf,
26                         unsigned int len, unsigned int wait);
27         void (*release)(struct mtk_vcodec_fw *fw);
28 };
29
30 #if IS_ENABLED(CONFIG_VIDEO_MEDIATEK_VCODEC_VPU)
31 struct mtk_vcodec_fw *mtk_vcodec_fw_vpu_init(struct mtk_vcodec_dev *dev,
32                                              enum mtk_vcodec_fw_use fw_use);
33 #else
34 static inline struct mtk_vcodec_fw *
35 mtk_vcodec_fw_vpu_init(struct mtk_vcodec_dev *dev,
36                        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(struct mtk_vcodec_dev *dev);
44 #else
45 static inline struct mtk_vcodec_fw *
46 mtk_vcodec_fw_scp_init(struct mtk_vcodec_dev *dev)
47 {
48         return ERR_PTR(-ENODEV);
49 }
50 #endif /* CONFIG_VIDEO_MEDIATEK_VCODEC_SCP */
51
52 #endif /* _MTK_VCODEC_FW_PRIV_H_ */