1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Copyright (c) 2016 MediaTek Inc. 4 * Author: PC Chen <pc.chen@mediatek.com> 5 */ 6 7 #ifndef _VDEC_IPI_MSG_H_ 8 #define _VDEC_IPI_MSG_H_ 9 10 /* 11 * enum vdec_ipi_msgid - message id between AP and VPU 12 * @AP_IPIMSG_XXX : AP to VPU cmd message id 13 * @VPU_IPIMSG_XXX_ACK : VPU ack AP cmd message id 14 */ 15 enum vdec_ipi_msgid { 16 AP_IPIMSG_DEC_INIT = 0xA000, 17 AP_IPIMSG_DEC_START = 0xA001, 18 AP_IPIMSG_DEC_END = 0xA002, 19 AP_IPIMSG_DEC_DEINIT = 0xA003, 20 AP_IPIMSG_DEC_RESET = 0xA004, 21 22 VPU_IPIMSG_DEC_INIT_ACK = 0xB000, 23 VPU_IPIMSG_DEC_START_ACK = 0xB001, 24 VPU_IPIMSG_DEC_END_ACK = 0xB002, 25 VPU_IPIMSG_DEC_DEINIT_ACK = 0xB003, 26 VPU_IPIMSG_DEC_RESET_ACK = 0xB004, 27 }; 28 29 /** 30 * struct vdec_ap_ipi_cmd - generic AP to VPU ipi command format 31 * @msg_id : vdec_ipi_msgid 32 * @vpu_inst_addr : VPU decoder instance address. Used if ABI version < 2. 33 * @inst_id : instance ID. Used if the ABI version >= 2. 34 */ 35 struct vdec_ap_ipi_cmd { 36 uint32_t msg_id; 37 union { 38 uint32_t vpu_inst_addr; 39 uint32_t inst_id; 40 }; 41 }; 42 43 /** 44 * struct vdec_vpu_ipi_ack - generic VPU to AP ipi command format 45 * @msg_id : vdec_ipi_msgid 46 * @status : VPU exeuction result 47 * @ap_inst_addr : AP video decoder instance address 48 */ 49 struct vdec_vpu_ipi_ack { 50 uint32_t msg_id; 51 int32_t status; 52 uint64_t ap_inst_addr; 53 }; 54 55 /** 56 * struct vdec_ap_ipi_init - for AP_IPIMSG_DEC_INIT 57 * @msg_id : AP_IPIMSG_DEC_INIT 58 * @reserved : Reserved field 59 * @ap_inst_addr : AP video decoder instance address 60 */ 61 struct vdec_ap_ipi_init { 62 uint32_t msg_id; 63 uint32_t reserved; 64 uint64_t ap_inst_addr; 65 }; 66 67 /** 68 * struct vdec_ap_ipi_dec_start - for AP_IPIMSG_DEC_START 69 * @msg_id : AP_IPIMSG_DEC_START 70 * @vpu_inst_addr : VPU decoder instance address. Used if ABI version < 2. 71 * @inst_id : instance ID. Used if the ABI version >= 2. 72 * @data : Header info 73 * H264 decoder [0]:buf_sz [1]:nal_start 74 * VP8 decoder [0]:width/height 75 * VP9 decoder [0]:profile, [1][2] width/height 76 * @reserved : Reserved field 77 */ 78 struct vdec_ap_ipi_dec_start { 79 uint32_t msg_id; 80 union { 81 uint32_t vpu_inst_addr; 82 uint32_t inst_id; 83 }; 84 uint32_t data[3]; 85 uint32_t reserved; 86 }; 87 88 /** 89 * struct vdec_vpu_ipi_init_ack - for VPU_IPIMSG_DEC_INIT_ACK 90 * @msg_id : VPU_IPIMSG_DEC_INIT_ACK 91 * @status : VPU exeuction result 92 * @ap_inst_addr : AP vcodec_vpu_inst instance address 93 * @vpu_inst_addr : VPU decoder instance address 94 * @vdec_abi_version: ABI version of the firmware. Kernel can use it to 95 * ensure that it is compatible with the firmware. 96 * This field is not valid for MT8173 and must not be 97 * accessed for this chip. 98 * @inst_id : instance ID. Valid only if the ABI version >= 2. 99 */ 100 struct vdec_vpu_ipi_init_ack { 101 uint32_t msg_id; 102 int32_t status; 103 uint64_t ap_inst_addr; 104 uint32_t vpu_inst_addr; 105 uint32_t vdec_abi_version; 106 uint32_t inst_id; 107 }; 108 109 #endif 110