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_
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
{
38 unsigned int signaled
;
39 struct mtk_vcodec_ctx
*ctx
;
40 struct platform_device
*dev
;
42 ipi_handler_t handler
;
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
);
53 * vpu_dec_start - start decoding, basically the function will be invoked once
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
);
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
);
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
);
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
);
88 * vpu_dec_ipi_handler - Handler for VPU 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
);