Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Copyright (c) 2019 MediaTek Inc.
0004  */
0005 
0006 #ifndef _MTK_SCP_H
0007 #define _MTK_SCP_H
0008 
0009 #include <linux/platform_device.h>
0010 
0011 typedef void (*scp_ipi_handler_t) (void *data,
0012                    unsigned int len,
0013                    void *priv);
0014 struct mtk_scp;
0015 
0016 /**
0017  * enum ipi_id - the id of inter-processor interrupt
0018  *
0019  * @SCP_IPI_INIT:    The interrupt from scp is to notfiy kernel
0020  *           SCP initialization completed.
0021  *           IPI_SCP_INIT is sent from SCP when firmware is
0022  *           loaded. AP doesn't need to send IPI_SCP_INIT
0023  *           command to SCP.
0024  *           For other IPI below, AP should send the request
0025  *           to SCP to trigger the interrupt.
0026  * @SCP_IPI_MAX:     The maximum IPI number
0027  */
0028 
0029 enum scp_ipi_id {
0030     SCP_IPI_INIT = 0,
0031     SCP_IPI_VDEC_H264,
0032     SCP_IPI_VDEC_VP8,
0033     SCP_IPI_VDEC_VP9,
0034     SCP_IPI_VENC_H264,
0035     SCP_IPI_VENC_VP8,
0036     SCP_IPI_MDP_INIT,
0037     SCP_IPI_MDP_DEINIT,
0038     SCP_IPI_MDP_FRAME,
0039     SCP_IPI_DIP,
0040     SCP_IPI_ISP_CMD,
0041     SCP_IPI_ISP_FRAME,
0042     SCP_IPI_FD_CMD,
0043     SCP_IPI_CROS_HOST_CMD,
0044     SCP_IPI_VDEC_LAT,
0045     SCP_IPI_VDEC_CORE,
0046     SCP_IPI_NS_SERVICE = 0xFF,
0047     SCP_IPI_MAX = 0x100,
0048 };
0049 
0050 struct mtk_scp *scp_get(struct platform_device *pdev);
0051 void scp_put(struct mtk_scp *scp);
0052 
0053 struct device *scp_get_device(struct mtk_scp *scp);
0054 struct rproc *scp_get_rproc(struct mtk_scp *scp);
0055 
0056 int scp_ipi_register(struct mtk_scp *scp, u32 id, scp_ipi_handler_t handler,
0057              void *priv);
0058 void scp_ipi_unregister(struct mtk_scp *scp, u32 id);
0059 
0060 int scp_ipi_send(struct mtk_scp *scp, u32 id, void *buf, unsigned int len,
0061          unsigned int wait);
0062 
0063 unsigned int scp_get_vdec_hw_capa(struct mtk_scp *scp);
0064 unsigned int scp_get_venc_hw_capa(struct mtk_scp *scp);
0065 
0066 void *scp_mapping_dm_addr(struct mtk_scp *scp, u32 mem_addr);
0067 
0068 #endif /* _MTK_SCP_H */