Linux 4.16.11
[linux/fpc-iii.git] / drivers / media / platform / mtk-vcodec / vdec_vpu_if.h
blobcd37bb2a610f20af0f3252d6d25a946e72652566
1 /*
2 * Copyright (c) 2016 MediaTek Inc.
3 * Author: PC Chen <pc.chen@mediatek.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
15 #ifndef _VDEC_VPU_IF_H_
16 #define _VDEC_VPU_IF_H_
18 #include "mtk_vpu.h"
20 /**
21 * struct vdec_vpu_inst - VPU instance for video codec
22 * @ipi_id : ipi id for each decoder
23 * @vsi : driver structure allocated by VPU side and shared to AP side
24 * for control and info share
25 * @failure : VPU execution result status, 0: success, others: fail
26 * @inst_addr : VPU decoder instance address
27 * @signaled : 1 - Host has received ack message from VPU, 0 - not received
28 * @ctx : context for v4l2 layer integration
29 * @dev : platform device of VPU
30 * @wq : wait queue to wait VPU message ack
31 * @handler : ipi handler for each decoder
33 struct vdec_vpu_inst {
34 enum ipi_id id;
35 void *vsi;
36 int32_t failure;
37 uint32_t inst_addr;
38 unsigned int signaled;
39 struct mtk_vcodec_ctx *ctx;
40 struct platform_device *dev;
41 wait_queue_head_t wq;
42 ipi_handler_t handler;
45 /**
46 * vpu_dec_init - init decoder instance and allocate required resource in VPU.
48 * @vpu: instance for vdec_vpu_inst
50 int vpu_dec_init(struct vdec_vpu_inst *vpu);
52 /**
53 * vpu_dec_start - start decoding, basically the function will be invoked once
54 * every frame.
56 * @vpu : instance for vdec_vpu_inst
57 * @data: meta data to pass bitstream info to VPU decoder
58 * @len : meta data length
60 int vpu_dec_start(struct vdec_vpu_inst *vpu, uint32_t *data, unsigned int len);
62 /**
63 * vpu_dec_end - end decoding, basically the function will be invoked once
64 * when HW decoding done interrupt received successfully. The
65 * decoder in VPU will continute to do referene frame management
66 * and check if there is a new decoded frame available to display.
68 * @vpu : instance for vdec_vpu_inst
70 int vpu_dec_end(struct vdec_vpu_inst *vpu);
72 /**
73 * vpu_dec_deinit - deinit decoder instance and resource freed in VPU.
75 * @vpu: instance for vdec_vpu_inst
77 int vpu_dec_deinit(struct vdec_vpu_inst *vpu);
79 /**
80 * vpu_dec_reset - reset decoder, use for flush decoder when end of stream or
81 * seek. Remainig non displayed frame will be pushed to display.
83 * @vpu: instance for vdec_vpu_inst
85 int vpu_dec_reset(struct vdec_vpu_inst *vpu);
87 /**
88 * vpu_dec_ipi_handler - Handler for VPU ipi message.
90 * @data: ipi message
91 * @len : length of ipi message
92 * @priv: callback private data which is passed by decoder when register.
94 void vpu_dec_ipi_handler(void *data, unsigned int len, void *priv);
96 #endif