GNU Linux-libre 4.19.264-gnu1
[releases.git] / drivers / media / platform / mtk-mdp / mtk_mdp_ipi.h
1 /*
2  * Copyright (c) 2015-2016 MediaTek Inc.
3  * Author: Houlong Wei <houlong.wei@mediatek.com>
4  *         Ming Hsiu Tsai <minghsiu.tsai@mediatek.com>
5  *
6  * This program is free software; you can redistribute it and/or 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 __MTK_MDP_IPI_H__
17 #define __MTK_MDP_IPI_H__
18
19 #define MTK_MDP_MAX_NUM_PLANE           3
20
21 enum mdp_ipi_msgid {
22         AP_MDP_INIT             = 0xd000,
23         AP_MDP_DEINIT           = 0xd001,
24         AP_MDP_PROCESS          = 0xd002,
25
26         VPU_MDP_INIT_ACK        = 0xe000,
27         VPU_MDP_DEINIT_ACK      = 0xe001,
28         VPU_MDP_PROCESS_ACK     = 0xe002
29 };
30
31 #pragma pack(push, 4)
32
33 /**
34  * struct mdp_ipi_init - for AP_MDP_INIT
35  * @msg_id   : AP_MDP_INIT
36  * @ipi_id   : IPI_MDP
37  * @ap_inst  : AP mtk_mdp_vpu address
38  */
39 struct mdp_ipi_init {
40         uint32_t msg_id;
41         uint32_t ipi_id;
42         uint64_t ap_inst;
43 };
44
45 /**
46  * struct mdp_ipi_comm - for AP_MDP_PROCESS, AP_MDP_DEINIT
47  * @msg_id        : AP_MDP_PROCESS, AP_MDP_DEINIT
48  * @ipi_id        : IPI_MDP
49  * @ap_inst       : AP mtk_mdp_vpu address
50  * @vpu_inst_addr : VPU MDP instance address
51  * @padding       : Alignment padding
52  */
53 struct mdp_ipi_comm {
54         uint32_t msg_id;
55         uint32_t ipi_id;
56         uint64_t ap_inst;
57         uint32_t vpu_inst_addr;
58         uint32_t padding;
59 };
60
61 /**
62  * struct mdp_ipi_comm_ack - for VPU_MDP_DEINIT_ACK, VPU_MDP_PROCESS_ACK
63  * @msg_id        : VPU_MDP_DEINIT_ACK, VPU_MDP_PROCESS_ACK
64  * @ipi_id        : IPI_MDP
65  * @ap_inst       : AP mtk_mdp_vpu address
66  * @vpu_inst_addr : VPU MDP instance address
67  * @status        : VPU exeuction result
68  */
69 struct mdp_ipi_comm_ack {
70         uint32_t msg_id;
71         uint32_t ipi_id;
72         uint64_t ap_inst;
73         uint32_t vpu_inst_addr;
74         int32_t status;
75 };
76
77 /**
78  * struct mdp_config - configured for source/destination image
79  * @x        : left
80  * @y        : top
81  * @w        : width
82  * @h        : height
83  * @w_stride : bytes in horizontal
84  * @h_stride : bytes in vertical
85  * @crop_x   : cropped left
86  * @crop_y   : cropped top
87  * @crop_w   : cropped width
88  * @crop_h   : cropped height
89  * @format   : color format
90  */
91 struct mdp_config {
92         int32_t x;
93         int32_t y;
94         int32_t w;
95         int32_t h;
96         int32_t w_stride;
97         int32_t h_stride;
98         int32_t crop_x;
99         int32_t crop_y;
100         int32_t crop_w;
101         int32_t crop_h;
102         int32_t format;
103 };
104
105 struct mdp_buffer {
106         uint64_t addr_mva[MTK_MDP_MAX_NUM_PLANE];
107         int32_t plane_size[MTK_MDP_MAX_NUM_PLANE];
108         int32_t plane_num;
109 };
110
111 struct mdp_config_misc {
112         int32_t orientation; /* 0, 90, 180, 270 */
113         int32_t hflip; /* 1 will enable the flip */
114         int32_t vflip; /* 1 will enable the flip */
115         int32_t alpha; /* global alpha */
116 };
117
118 struct mdp_process_vsi {
119         struct mdp_config src_config;
120         struct mdp_buffer src_buffer;
121         struct mdp_config dst_config;
122         struct mdp_buffer dst_buffer;
123         struct mdp_config_misc misc;
124 };
125
126 #pragma pack(pop)
127
128 #endif /* __MTK_MDP_IPI_H__ */