1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (c) 2016 MediaTek Inc.
4 * Author: PC Chen <pc.chen@mediatek.com>
7 #ifndef _VDEC_VPU_IF_H_
8 #define _VDEC_VPU_IF_H_
13 * struct vdec_vpu_inst - VPU instance for video codec
14 * @ipi_id : ipi id for each decoder
15 * @vsi : driver structure allocated by VPU side and shared to AP side
16 * for control and info share
17 * @failure : VPU execution result status, 0: success, others: fail
18 * @inst_addr : VPU decoder instance address
19 * @signaled : 1 - Host has received ack message from VPU, 0 - not received
20 * @ctx : context for v4l2 layer integration
21 * @dev : platform device of VPU
22 * @wq : wait queue to wait VPU message ack
23 * @handler : ipi handler for each decoder
25 struct vdec_vpu_inst
{
30 unsigned int signaled
;
31 struct mtk_vcodec_ctx
*ctx
;
32 struct platform_device
*dev
;
34 ipi_handler_t handler
;
38 * vpu_dec_init - init decoder instance and allocate required resource in VPU.
40 * @vpu: instance for vdec_vpu_inst
42 int vpu_dec_init(struct vdec_vpu_inst
*vpu
);
45 * vpu_dec_start - start decoding, basically the function will be invoked once
48 * @vpu : instance for vdec_vpu_inst
49 * @data: meta data to pass bitstream info to VPU decoder
50 * @len : meta data length
52 int vpu_dec_start(struct vdec_vpu_inst
*vpu
, uint32_t *data
, unsigned int len
);
55 * vpu_dec_end - end decoding, basically the function will be invoked once
56 * when HW decoding done interrupt received successfully. The
57 * decoder in VPU will continue to do reference frame management
58 * and check if there is a new decoded frame available to display.
60 * @vpu : instance for vdec_vpu_inst
62 int vpu_dec_end(struct vdec_vpu_inst
*vpu
);
65 * vpu_dec_deinit - deinit decoder instance and resource freed in VPU.
67 * @vpu: instance for vdec_vpu_inst
69 int vpu_dec_deinit(struct vdec_vpu_inst
*vpu
);
72 * vpu_dec_reset - reset decoder, use for flush decoder when end of stream or
73 * seek. Remainig non displayed frame will be pushed to display.
75 * @vpu: instance for vdec_vpu_inst
77 int vpu_dec_reset(struct vdec_vpu_inst
*vpu
);