Merge tag 'for-5.9-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave...
[linux-2.6-microblaze.git] / include / linux / remoteproc / mtk_scp.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (c) 2019 MediaTek Inc.
4  */
5
6 #ifndef _MTK_SCP_H
7 #define _MTK_SCP_H
8
9 #include <linux/platform_device.h>
10
11 typedef void (*scp_ipi_handler_t) (void *data,
12                                    unsigned int len,
13                                    void *priv);
14 struct mtk_scp;
15
16 /**
17  * enum ipi_id - the id of inter-processor interrupt
18  *
19  * @SCP_IPI_INIT:        The interrupt from scp is to notfiy kernel
20  *                       SCP initialization completed.
21  *                       IPI_SCP_INIT is sent from SCP when firmware is
22  *                       loaded. AP doesn't need to send IPI_SCP_INIT
23  *                       command to SCP.
24  *                       For other IPI below, AP should send the request
25  *                       to SCP to trigger the interrupt.
26  * @SCP_IPI_MAX:         The maximum IPI number
27  */
28
29 enum scp_ipi_id {
30         SCP_IPI_INIT = 0,
31         SCP_IPI_VDEC_H264,
32         SCP_IPI_VDEC_VP8,
33         SCP_IPI_VDEC_VP9,
34         SCP_IPI_VENC_H264,
35         SCP_IPI_VENC_VP8,
36         SCP_IPI_MDP_INIT,
37         SCP_IPI_MDP_DEINIT,
38         SCP_IPI_MDP_FRAME,
39         SCP_IPI_DIP,
40         SCP_IPI_ISP_CMD,
41         SCP_IPI_ISP_FRAME,
42         SCP_IPI_FD_CMD,
43         SCP_IPI_CROS_HOST_CMD,
44         SCP_IPI_NS_SERVICE = 0xFF,
45         SCP_IPI_MAX = 0x100,
46 };
47
48 struct mtk_scp *scp_get(struct platform_device *pdev);
49 void scp_put(struct mtk_scp *scp);
50
51 struct device *scp_get_device(struct mtk_scp *scp);
52 struct rproc *scp_get_rproc(struct mtk_scp *scp);
53
54 int scp_ipi_register(struct mtk_scp *scp, u32 id, scp_ipi_handler_t handler,
55                      void *priv);
56 void scp_ipi_unregister(struct mtk_scp *scp, u32 id);
57
58 int scp_ipi_send(struct mtk_scp *scp, u32 id, void *buf, unsigned int len,
59                  unsigned int wait);
60
61 unsigned int scp_get_vdec_hw_capa(struct mtk_scp *scp);
62 unsigned int scp_get_venc_hw_capa(struct mtk_scp *scp);
63
64 void *scp_mapping_dm_addr(struct mtk_scp *scp, u32 mem_addr);
65
66 #endif /* _MTK_SCP_H */