154 lines · c
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 VPU12 * @AP_IPIMSG_XXX : AP to VPU cmd message id13 * @VPU_IPIMSG_XXX_ACK : VPU ack AP cmd message id14 */15enum 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 AP_IPIMSG_DEC_CORE = 0xA005,22 AP_IPIMSG_DEC_CORE_END = 0xA006,23 AP_IPIMSG_DEC_GET_PARAM = 0xA007,24 25 VPU_IPIMSG_DEC_INIT_ACK = 0xB000,26 VPU_IPIMSG_DEC_START_ACK = 0xB001,27 VPU_IPIMSG_DEC_END_ACK = 0xB002,28 VPU_IPIMSG_DEC_DEINIT_ACK = 0xB003,29 VPU_IPIMSG_DEC_RESET_ACK = 0xB004,30 VPU_IPIMSG_DEC_CORE_ACK = 0xB005,31 VPU_IPIMSG_DEC_CORE_END_ACK = 0xB006,32 VPU_IPIMSG_DEC_GET_PARAM_ACK = 0xB007,33};34 35/**36 * struct vdec_ap_ipi_cmd - generic AP to VPU ipi command format37 * @msg_id : vdec_ipi_msgid38 * @vpu_inst_addr : VPU decoder instance address. Used if ABI version < 2.39 * @inst_id : instance ID. Used if the ABI version >= 2.40 * @codec_type : codec fourcc41 * @reserved : reserved param42 */43struct vdec_ap_ipi_cmd {44 uint32_t msg_id;45 union {46 uint32_t vpu_inst_addr;47 uint32_t inst_id;48 };49 u32 codec_type;50 u32 reserved;51};52 53/**54 * struct vdec_vpu_ipi_ack - generic VPU to AP ipi command format55 * @msg_id : vdec_ipi_msgid56 * @status : VPU exeuction result57 * @ap_inst_addr : AP video decoder instance address58 */59struct vdec_vpu_ipi_ack {60 uint32_t msg_id;61 int32_t status;62 uint64_t ap_inst_addr;63};64 65/**66 * struct vdec_ap_ipi_init - for AP_IPIMSG_DEC_INIT67 * @msg_id : AP_IPIMSG_DEC_INIT68 * @codec_type : codec fourcc69 * @ap_inst_addr : AP video decoder instance address70 */71struct vdec_ap_ipi_init {72 uint32_t msg_id;73 u32 codec_type;74 uint64_t ap_inst_addr;75};76 77/**78 * struct vdec_ap_ipi_dec_start - for AP_IPIMSG_DEC_START79 * @msg_id : AP_IPIMSG_DEC_START80 * @vpu_inst_addr : VPU decoder instance address. Used if ABI version < 2.81 * @inst_id : instance ID. Used if the ABI version >= 2.82 * @data : Header info83 * H264 decoder [0]:buf_sz [1]:nal_start84 * VP8 decoder [0]:width/height85 * VP9 decoder [0]:profile, [1][2] width/height86 * @codec_type : codec fourcc87 */88struct vdec_ap_ipi_dec_start {89 uint32_t msg_id;90 union {91 uint32_t vpu_inst_addr;92 uint32_t inst_id;93 };94 uint32_t data[3];95 u32 codec_type;96};97 98/**99 * struct vdec_vpu_ipi_init_ack - for VPU_IPIMSG_DEC_INIT_ACK100 * @msg_id : VPU_IPIMSG_DEC_INIT_ACK101 * @status : VPU exeuction result102 * @ap_inst_addr : AP vcodec_vpu_inst instance address103 * @vpu_inst_addr : VPU decoder instance address104 * @vdec_abi_version: ABI version of the firmware. Kernel can use it to105 * ensure that it is compatible with the firmware.106 * This field is not valid for MT8173 and must not be107 * accessed for this chip.108 * @inst_id : instance ID. Valid only if the ABI version >= 2.109 */110struct vdec_vpu_ipi_init_ack {111 uint32_t msg_id;112 int32_t status;113 uint64_t ap_inst_addr;114 uint32_t vpu_inst_addr;115 uint32_t vdec_abi_version;116 uint32_t inst_id;117};118 119/**120 * struct vdec_ap_ipi_get_param - for AP_IPIMSG_DEC_GET_PARAM121 * @msg_id : AP_IPIMSG_DEC_GET_PARAM122 * @inst_id : instance ID. Used if the ABI version >= 2.123 * @data : picture information124 * @param_type : get param type125 * @codec_type : Codec fourcc126 */127struct vdec_ap_ipi_get_param {128 u32 msg_id;129 u32 inst_id;130 u32 data[4];131 u32 param_type;132 u32 codec_type;133};134 135/**136 * struct vdec_vpu_ipi_get_param_ack - for VPU_IPIMSG_DEC_GET_PARAM_ACK137 * @msg_id : VPU_IPIMSG_DEC_GET_PARAM_ACK138 * @status : VPU execution result139 * @ap_inst_addr : AP vcodec_vpu_inst instance address140 * @data : picture information from SCP.141 * @param_type : get param type142 * @reserved : reserved param143 */144struct vdec_vpu_ipi_get_param_ack {145 u32 msg_id;146 s32 status;147 u64 ap_inst_addr;148 u32 data[4];149 u32 param_type;150 u32 reserved;151};152 153#endif154