GNU Linux-libre 4.14.266-gnu1
[releases.git] / drivers / media / platform / mtk-vcodec / vdec_ipi_msg.h
1 /*
2  * Copyright (c) 2016 MediaTek Inc.
3  * Author: PC Chen <pc.chen@mediatek.com>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  */
15
16 #ifndef _VDEC_IPI_MSG_H_
17 #define _VDEC_IPI_MSG_H_
18
19 /**
20  * enum vdec_ipi_msgid - message id between AP and VPU
21  * @AP_IPIMSG_XXX       : AP to VPU cmd message id
22  * @VPU_IPIMSG_XXX_ACK  : VPU ack AP cmd message id
23  */
24 enum vdec_ipi_msgid {
25         AP_IPIMSG_DEC_INIT = 0xA000,
26         AP_IPIMSG_DEC_START = 0xA001,
27         AP_IPIMSG_DEC_END = 0xA002,
28         AP_IPIMSG_DEC_DEINIT = 0xA003,
29         AP_IPIMSG_DEC_RESET = 0xA004,
30
31         VPU_IPIMSG_DEC_INIT_ACK = 0xB000,
32         VPU_IPIMSG_DEC_START_ACK = 0xB001,
33         VPU_IPIMSG_DEC_END_ACK = 0xB002,
34         VPU_IPIMSG_DEC_DEINIT_ACK = 0xB003,
35         VPU_IPIMSG_DEC_RESET_ACK = 0xB004,
36 };
37
38 /**
39  * struct vdec_ap_ipi_cmd - generic AP to VPU ipi command format
40  * @msg_id      : vdec_ipi_msgid
41  * @vpu_inst_addr       : VPU decoder instance address
42  */
43 struct vdec_ap_ipi_cmd {
44         uint32_t msg_id;
45         uint32_t vpu_inst_addr;
46 };
47
48 /**
49  * struct vdec_vpu_ipi_ack - generic VPU to AP ipi command format
50  * @msg_id      : vdec_ipi_msgid
51  * @status      : VPU exeuction result
52  * @ap_inst_addr        : AP video decoder instance address
53  */
54 struct vdec_vpu_ipi_ack {
55         uint32_t msg_id;
56         int32_t status;
57         uint64_t ap_inst_addr;
58 };
59
60 /**
61  * struct vdec_ap_ipi_init - for AP_IPIMSG_DEC_INIT
62  * @msg_id      : AP_IPIMSG_DEC_INIT
63  * @reserved    : Reserved field
64  * @ap_inst_addr        : AP video decoder instance address
65  */
66 struct vdec_ap_ipi_init {
67         uint32_t msg_id;
68         uint32_t reserved;
69         uint64_t ap_inst_addr;
70 };
71
72 /**
73  * struct vdec_ap_ipi_dec_start - for AP_IPIMSG_DEC_START
74  * @msg_id      : AP_IPIMSG_DEC_START
75  * @vpu_inst_addr       : VPU decoder instance address
76  * @data        : Header info
77  *      H264 decoder [0]:buf_sz [1]:nal_start
78  *      VP8 decoder  [0]:width/height
79  *      VP9 decoder  [0]:profile, [1][2] width/height
80  * @reserved    : Reserved field
81  */
82 struct vdec_ap_ipi_dec_start {
83         uint32_t msg_id;
84         uint32_t vpu_inst_addr;
85         uint32_t data[3];
86         uint32_t reserved;
87 };
88
89 /**
90  * struct vdec_vpu_ipi_init_ack - for VPU_IPIMSG_DEC_INIT_ACK
91  * @msg_id      : VPU_IPIMSG_DEC_INIT_ACK
92  * @status      : VPU exeuction result
93  * @ap_inst_addr        : AP vcodec_vpu_inst instance address
94  * @vpu_inst_addr       : VPU decoder instance address
95  */
96 struct vdec_vpu_ipi_init_ack {
97         uint32_t msg_id;
98         int32_t status;
99         uint64_t ap_inst_addr;
100         uint32_t vpu_inst_addr;
101 };
102
103 #endif