1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Copyright (c) 2022 MediaTek Inc. 4 * Author: Ping-Hsun Wu <ping-hsun.wu@mediatek.com> 5 */ 6 7 #ifndef __MTK_MDP3_VPU_H__ 8 #define __MTK_MDP3_VPU_H__ 9 10 #include <linux/platform_device.h> 11 #include "mtk-img-ipi.h" 12 13 enum mdp_ipi_result { 14 MDP_IPI_SUCCESS = 0, 15 MDP_IPI_ENOMEM = 12, 16 MDP_IPI_EBUSY = 16, 17 MDP_IPI_EINVAL = 22, 18 MDP_IPI_EMINST = 24, 19 MDP_IPI_ERANGE = 34, 20 MDP_IPI_NR_ERRNO, 21 22 MDP_IPI_EOTHER = MDP_IPI_NR_ERRNO, 23 MDP_IPI_PATH_CANT_MERGE, 24 MDP_IPI_OP_FAIL, 25 }; 26 27 struct mdp_ipi_init_msg { 28 u32 status; 29 u64 drv_data; 30 u32 work_addr; /* [in] working buffer address */ 31 u32 work_size; /* [in] working buffer size */ 32 } __packed; 33 34 struct mdp_ipi_deinit_msg { 35 u32 status; 36 u64 drv_data; 37 u32 work_addr; 38 } __packed; 39 40 struct mdp_vpu_dev { 41 /* synchronization protect for accessing vpu working buffer info */ 42 struct mutex *lock; 43 struct mtk_scp *scp; 44 struct completion ipi_acked; 45 void *param; 46 dma_addr_t param_addr; 47 size_t param_size; 48 void *work; 49 dma_addr_t work_addr; 50 size_t work_size; 51 void *config; 52 dma_addr_t config_addr; 53 size_t config_size; 54 u32 status; 55 }; 56 57 void mdp_vpu_shared_mem_free(struct mdp_vpu_dev *vpu); 58 int mdp_vpu_dev_init(struct mdp_vpu_dev *vpu, struct mtk_scp *scp, 59 struct mutex *lock /* for sync */); 60 int mdp_vpu_dev_deinit(struct mdp_vpu_dev *vpu); 61 int mdp_vpu_process(struct mdp_vpu_dev *vpu, struct img_ipi_frameparam *param); 62 63 #endif /* __MTK_MDP3_VPU_H__ */ 64