163c13d61SErin Lo /* SPDX-License-Identifier: GPL-2.0 */ 263c13d61SErin Lo /* 363c13d61SErin Lo * Copyright (c) 2019 MediaTek Inc. 463c13d61SErin Lo */ 563c13d61SErin Lo 663c13d61SErin Lo #ifndef _MTK_SCP_H 763c13d61SErin Lo #define _MTK_SCP_H 863c13d61SErin Lo 963c13d61SErin Lo #include <linux/platform_device.h> 1063c13d61SErin Lo 1163c13d61SErin Lo typedef void (*scp_ipi_handler_t) (void *data, 1263c13d61SErin Lo unsigned int len, 1363c13d61SErin Lo void *priv); 1463c13d61SErin Lo struct mtk_scp; 1563c13d61SErin Lo 1663c13d61SErin Lo /** 1763c13d61SErin Lo * enum ipi_id - the id of inter-processor interrupt 1863c13d61SErin Lo * 1963c13d61SErin Lo * @SCP_IPI_INIT: The interrupt from scp is to notfiy kernel 2063c13d61SErin Lo * SCP initialization completed. 2163c13d61SErin Lo * IPI_SCP_INIT is sent from SCP when firmware is 2263c13d61SErin Lo * loaded. AP doesn't need to send IPI_SCP_INIT 2363c13d61SErin Lo * command to SCP. 2463c13d61SErin Lo * For other IPI below, AP should send the request 2563c13d61SErin Lo * to SCP to trigger the interrupt. 2663c13d61SErin Lo * @SCP_IPI_MAX: The maximum IPI number 2763c13d61SErin Lo */ 2863c13d61SErin Lo 2963c13d61SErin Lo enum scp_ipi_id { 3063c13d61SErin Lo SCP_IPI_INIT = 0, 3163c13d61SErin Lo SCP_IPI_VDEC_H264, 3263c13d61SErin Lo SCP_IPI_VDEC_VP8, 3363c13d61SErin Lo SCP_IPI_VDEC_VP9, 3463c13d61SErin Lo SCP_IPI_VENC_H264, 3563c13d61SErin Lo SCP_IPI_VENC_VP8, 3663c13d61SErin Lo SCP_IPI_MDP_INIT, 3763c13d61SErin Lo SCP_IPI_MDP_DEINIT, 3863c13d61SErin Lo SCP_IPI_MDP_FRAME, 3963c13d61SErin Lo SCP_IPI_DIP, 4063c13d61SErin Lo SCP_IPI_ISP_CMD, 4163c13d61SErin Lo SCP_IPI_ISP_FRAME, 4263c13d61SErin Lo SCP_IPI_FD_CMD, 4363c13d61SErin Lo SCP_IPI_CROS_HOST_CMD, 44*59fba9eeSYunfei Dong SCP_IPI_VDEC_LAT, 45*59fba9eeSYunfei Dong SCP_IPI_VDEC_CORE, 4670179969SPi-Hsun Shih SCP_IPI_NS_SERVICE = 0xFF, 4770179969SPi-Hsun Shih SCP_IPI_MAX = 0x100, 4863c13d61SErin Lo }; 4963c13d61SErin Lo 5063c13d61SErin Lo struct mtk_scp *scp_get(struct platform_device *pdev); 5163c13d61SErin Lo void scp_put(struct mtk_scp *scp); 5263c13d61SErin Lo 5363c13d61SErin Lo struct device *scp_get_device(struct mtk_scp *scp); 5463c13d61SErin Lo struct rproc *scp_get_rproc(struct mtk_scp *scp); 5563c13d61SErin Lo 5663c13d61SErin Lo int scp_ipi_register(struct mtk_scp *scp, u32 id, scp_ipi_handler_t handler, 5763c13d61SErin Lo void *priv); 5863c13d61SErin Lo void scp_ipi_unregister(struct mtk_scp *scp, u32 id); 5963c13d61SErin Lo 6063c13d61SErin Lo int scp_ipi_send(struct mtk_scp *scp, u32 id, void *buf, unsigned int len, 6163c13d61SErin Lo unsigned int wait); 6263c13d61SErin Lo 6363c13d61SErin Lo unsigned int scp_get_vdec_hw_capa(struct mtk_scp *scp); 6463c13d61SErin Lo unsigned int scp_get_venc_hw_capa(struct mtk_scp *scp); 6563c13d61SErin Lo 6663c13d61SErin Lo void *scp_mapping_dm_addr(struct mtk_scp *scp, u32 mem_addr); 6763c13d61SErin Lo 6863c13d61SErin Lo #endif /* _MTK_SCP_H */ 69