GNU Linux-libre 4.14.266-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  */
52 struct mdp_ipi_comm {
53         uint32_t msg_id;
54         uint32_t ipi_id;
55         uint64_t ap_inst;
56         uint32_t vpu_inst_addr;
57 };
58
59 /**
60  * struct mdp_ipi_comm_ack - for VPU_MDP_DEINIT_ACK, VPU_MDP_PROCESS_ACK
61  * @msg_id        : VPU_MDP_DEINIT_ACK, VPU_MDP_PROCESS_ACK
62  * @ipi_id        : IPI_MDP
63  * @ap_inst       : AP mtk_mdp_vpu address
64  * @vpu_inst_addr : VPU MDP instance address
65  * @status        : VPU exeuction result
66  */
67 struct mdp_ipi_comm_ack {
68         uint32_t msg_id;
69         uint32_t ipi_id;
70         uint64_t ap_inst;
71         uint32_t vpu_inst_addr;
72         int32_t status;
73 };
74
75 /**
76  * struct mdp_config - configured for source/destination image
77  * @x        : left
78  * @y        : top
79  * @w        : width
80  * @h        : height
81  * @w_stride : bytes in horizontal
82  * @h_stride : bytes in vertical
83  * @crop_x   : cropped left
84  * @crop_y   : cropped top
85  * @crop_w   : cropped width
86  * @crop_h   : cropped height
87  * @format   : color format
88  */
89 struct mdp_config {
90         int32_t x;
91         int32_t y;
92         int32_t w;
93         int32_t h;
94         int32_t w_stride;
95         int32_t h_stride;
96         int32_t crop_x;
97         int32_t crop_y;
98         int32_t crop_w;
99         int32_t crop_h;
100         int32_t format;
101 };
102
103 struct mdp_buffer {
104         uint64_t addr_mva[MTK_MDP_MAX_NUM_PLANE];
105         int32_t plane_size[MTK_MDP_MAX_NUM_PLANE];
106         int32_t plane_num;
107 };
108
109 struct mdp_config_misc {
110         int32_t orientation; /* 0, 90, 180, 270 */
111         int32_t hflip; /* 1 will enable the flip */
112         int32_t vflip; /* 1 will enable the flip */
113         int32_t alpha; /* global alpha */
114 };
115
116 struct mdp_process_vsi {
117         struct mdp_config src_config;
118         struct mdp_buffer src_buffer;
119         struct mdp_config dst_config;
120         struct mdp_buffer dst_buffer;
121         struct mdp_config_misc misc;
122 };
123
124 #pragma pack(pop)
125
126 #endif /* __MTK_MDP_IPI_H__ */