blob: 86b0448d2ce58d1421016728aab28b182fcaaa20 [file] [log] [blame]
Stephane Viau2e362e12014-11-18 12:49:48 -05001/*
Stephane Viau02dfd9d2015-03-24 15:06:02 -04002 * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
Stephane Viau2e362e12014-11-18 12:49:48 -05003 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#include "mdp5_kms.h"
15#include "mdp5_cfg.h"
16
17struct mdp5_cfg_handler {
18 int revision;
19 struct mdp5_cfg config;
20};
21
22/* mdp5_cfg must be exposed (used in mdp5.xml.h) */
23const struct mdp5_cfg_hw *mdp5_cfg = NULL;
24
jilai wang8a94b0a2015-07-08 18:25:40 -040025const struct mdp5_cfg_hw msm8x74v1_config = {
26 .name = "msm8x74v1",
27 .mdp = {
28 .count = 1,
Stephane Viaud879eb52015-09-15 08:41:53 -040029 .caps = MDP_CAP_SMP |
30 0,
jilai wang8a94b0a2015-07-08 18:25:40 -040031 },
32 .smp = {
33 .mmb_count = 22,
34 .mmb_size = 4096,
35 .clients = {
36 [SSPP_VIG0] = 1, [SSPP_VIG1] = 4, [SSPP_VIG2] = 7,
37 [SSPP_DMA0] = 10, [SSPP_DMA1] = 13,
38 [SSPP_RGB0] = 16, [SSPP_RGB1] = 17, [SSPP_RGB2] = 18,
39 },
40 },
41 .ctl = {
42 .count = 5,
Archit Taneja031d63d2016-05-09 12:14:49 +053043 .base = { 0x00500, 0x00600, 0x00700, 0x00800, 0x00900 },
jilai wang8a94b0a2015-07-08 18:25:40 -040044 .flush_hw_mask = 0x0003ffff,
45 },
46 .pipe_vig = {
47 .count = 3,
Archit Taneja031d63d2016-05-09 12:14:49 +053048 .base = { 0x01100, 0x01500, 0x01900 },
jilai wang8a94b0a2015-07-08 18:25:40 -040049 .caps = MDP_PIPE_CAP_HFLIP |
50 MDP_PIPE_CAP_VFLIP |
51 MDP_PIPE_CAP_SCALE |
52 MDP_PIPE_CAP_CSC |
53 0,
54 },
55 .pipe_rgb = {
56 .count = 3,
Archit Taneja031d63d2016-05-09 12:14:49 +053057 .base = { 0x01d00, 0x02100, 0x02500 },
jilai wang8a94b0a2015-07-08 18:25:40 -040058 .caps = MDP_PIPE_CAP_HFLIP |
59 MDP_PIPE_CAP_VFLIP |
60 MDP_PIPE_CAP_SCALE |
61 0,
62 },
63 .pipe_dma = {
64 .count = 2,
Archit Taneja031d63d2016-05-09 12:14:49 +053065 .base = { 0x02900, 0x02d00 },
jilai wang8a94b0a2015-07-08 18:25:40 -040066 .caps = MDP_PIPE_CAP_HFLIP |
67 MDP_PIPE_CAP_VFLIP |
68 0,
69 },
70 .lm = {
71 .count = 5,
Archit Taneja031d63d2016-05-09 12:14:49 +053072 .base = { 0x03100, 0x03500, 0x03900, 0x03d00, 0x04100 },
jilai wang8a94b0a2015-07-08 18:25:40 -040073 .nb_stages = 5,
74 },
75 .dspp = {
76 .count = 3,
Archit Taneja031d63d2016-05-09 12:14:49 +053077 .base = { 0x04500, 0x04900, 0x04d00 },
jilai wang8a94b0a2015-07-08 18:25:40 -040078 },
79 .pp = {
80 .count = 3,
Archit Taneja031d63d2016-05-09 12:14:49 +053081 .base = { 0x21a00, 0x21b00, 0x21c00 },
jilai wang8a94b0a2015-07-08 18:25:40 -040082 },
83 .intf = {
Archit Taneja031d63d2016-05-09 12:14:49 +053084 .base = { 0x21000, 0x21200, 0x21400, 0x21600 },
jilai wang8a94b0a2015-07-08 18:25:40 -040085 .connect = {
86 [0] = INTF_eDP,
87 [1] = INTF_DSI,
88 [2] = INTF_DSI,
89 [3] = INTF_HDMI,
90 },
91 },
92 .max_clk = 200000000,
93};
94
95const struct mdp5_cfg_hw msm8x74v2_config = {
Stephane Viau2e362e12014-11-18 12:49:48 -050096 .name = "msm8x74",
Stephane Viauf5253812015-03-09 09:11:04 -040097 .mdp = {
98 .count = 1,
Stephane Viaud879eb52015-09-15 08:41:53 -040099 .caps = MDP_CAP_SMP |
100 0,
Stephane Viauf5253812015-03-09 09:11:04 -0400101 },
Stephane Viau2e362e12014-11-18 12:49:48 -0500102 .smp = {
103 .mmb_count = 22,
104 .mmb_size = 4096,
Stephane Viau6fa6acd2015-03-09 09:11:06 -0400105 .clients = {
106 [SSPP_VIG0] = 1, [SSPP_VIG1] = 4, [SSPP_VIG2] = 7,
107 [SSPP_DMA0] = 10, [SSPP_DMA1] = 13,
108 [SSPP_RGB0] = 16, [SSPP_RGB1] = 17, [SSPP_RGB2] = 18,
109 },
Stephane Viau2e362e12014-11-18 12:49:48 -0500110 },
111 .ctl = {
112 .count = 5,
Archit Taneja031d63d2016-05-09 12:14:49 +0530113 .base = { 0x00500, 0x00600, 0x00700, 0x00800, 0x00900 },
Stephane Viau389b09a2015-03-13 15:49:33 -0400114 .flush_hw_mask = 0x0003ffff,
Stephane Viau2e362e12014-11-18 12:49:48 -0500115 },
116 .pipe_vig = {
117 .count = 3,
Archit Taneja031d63d2016-05-09 12:14:49 +0530118 .base = { 0x01100, 0x01500, 0x01900 },
jilai wang34984092015-07-08 18:12:40 -0400119 .caps = MDP_PIPE_CAP_HFLIP | MDP_PIPE_CAP_VFLIP |
120 MDP_PIPE_CAP_SCALE | MDP_PIPE_CAP_CSC |
121 MDP_PIPE_CAP_DECIMATION,
Stephane Viau2e362e12014-11-18 12:49:48 -0500122 },
123 .pipe_rgb = {
124 .count = 3,
Archit Taneja031d63d2016-05-09 12:14:49 +0530125 .base = { 0x01d00, 0x02100, 0x02500 },
jilai wang34984092015-07-08 18:12:40 -0400126 .caps = MDP_PIPE_CAP_HFLIP | MDP_PIPE_CAP_VFLIP |
127 MDP_PIPE_CAP_SCALE | MDP_PIPE_CAP_DECIMATION,
Stephane Viau2e362e12014-11-18 12:49:48 -0500128 },
129 .pipe_dma = {
130 .count = 2,
Archit Taneja031d63d2016-05-09 12:14:49 +0530131 .base = { 0x02900, 0x02d00 },
jilai wang34984092015-07-08 18:12:40 -0400132 .caps = MDP_PIPE_CAP_HFLIP | MDP_PIPE_CAP_VFLIP,
Stephane Viau2e362e12014-11-18 12:49:48 -0500133 },
134 .lm = {
135 .count = 5,
Archit Taneja031d63d2016-05-09 12:14:49 +0530136 .base = { 0x03100, 0x03500, 0x03900, 0x03d00, 0x04100 },
Stephane Viau2e362e12014-11-18 12:49:48 -0500137 .nb_stages = 5,
Hai Li9b7a9fc2015-06-24 19:13:40 -0400138 .max_width = 2048,
139 .max_height = 0xFFFF,
Stephane Viau2e362e12014-11-18 12:49:48 -0500140 },
141 .dspp = {
142 .count = 3,
Archit Taneja031d63d2016-05-09 12:14:49 +0530143 .base = { 0x04500, 0x04900, 0x04d00 },
Stephane Viau2e362e12014-11-18 12:49:48 -0500144 },
145 .ad = {
146 .count = 2,
Archit Taneja031d63d2016-05-09 12:14:49 +0530147 .base = { 0x13000, 0x13200 },
Stephane Viau2e362e12014-11-18 12:49:48 -0500148 },
Hai Li38305902015-03-05 15:20:47 -0500149 .pp = {
150 .count = 3,
Archit Taneja031d63d2016-05-09 12:14:49 +0530151 .base = { 0x12c00, 0x12d00, 0x12e00 },
Hai Li38305902015-03-05 15:20:47 -0500152 },
Stephane Viau2e362e12014-11-18 12:49:48 -0500153 .intf = {
Archit Taneja031d63d2016-05-09 12:14:49 +0530154 .base = { 0x12400, 0x12600, 0x12800, 0x12a00 },
Stephane Viaufe344642015-04-30 13:45:52 -0400155 .connect = {
156 [0] = INTF_eDP,
157 [1] = INTF_DSI,
158 [2] = INTF_DSI,
159 [3] = INTF_HDMI,
160 },
Stephane Viau67ac0a22015-03-13 15:49:34 -0400161 },
Stephane Viau2e362e12014-11-18 12:49:48 -0500162 .max_clk = 200000000,
163};
164
165const struct mdp5_cfg_hw apq8084_config = {
166 .name = "apq8084",
Stephane Viauf5253812015-03-09 09:11:04 -0400167 .mdp = {
168 .count = 1,
Stephane Viaud879eb52015-09-15 08:41:53 -0400169 .caps = MDP_CAP_SMP |
170 0,
Stephane Viauf5253812015-03-09 09:11:04 -0400171 },
Stephane Viau2e362e12014-11-18 12:49:48 -0500172 .smp = {
173 .mmb_count = 44,
174 .mmb_size = 8192,
Stephane Viau6fa6acd2015-03-09 09:11:06 -0400175 .clients = {
176 [SSPP_VIG0] = 1, [SSPP_VIG1] = 4,
177 [SSPP_VIG2] = 7, [SSPP_VIG3] = 19,
178 [SSPP_DMA0] = 10, [SSPP_DMA1] = 13,
179 [SSPP_RGB0] = 16, [SSPP_RGB1] = 17,
180 [SSPP_RGB2] = 18, [SSPP_RGB3] = 22,
181 },
Stephane Viau2e362e12014-11-18 12:49:48 -0500182 .reserved_state[0] = GENMASK(7, 0), /* first 8 MMBs */
Stephane Viau6fa6acd2015-03-09 09:11:06 -0400183 .reserved = {
184 /* Two SMP blocks are statically tied to RGB pipes: */
185 [16] = 2, [17] = 2, [18] = 2, [22] = 2,
186 },
Stephane Viau2e362e12014-11-18 12:49:48 -0500187 },
188 .ctl = {
189 .count = 5,
Archit Taneja031d63d2016-05-09 12:14:49 +0530190 .base = { 0x00500, 0x00600, 0x00700, 0x00800, 0x00900 },
Stephane Viau389b09a2015-03-13 15:49:33 -0400191 .flush_hw_mask = 0x003fffff,
Stephane Viau2e362e12014-11-18 12:49:48 -0500192 },
193 .pipe_vig = {
194 .count = 4,
Archit Taneja031d63d2016-05-09 12:14:49 +0530195 .base = { 0x01100, 0x01500, 0x01900, 0x01d00 },
jilai wang34984092015-07-08 18:12:40 -0400196 .caps = MDP_PIPE_CAP_HFLIP | MDP_PIPE_CAP_VFLIP |
197 MDP_PIPE_CAP_SCALE | MDP_PIPE_CAP_CSC |
198 MDP_PIPE_CAP_DECIMATION,
Stephane Viau2e362e12014-11-18 12:49:48 -0500199 },
200 .pipe_rgb = {
201 .count = 4,
Archit Taneja031d63d2016-05-09 12:14:49 +0530202 .base = { 0x02100, 0x02500, 0x02900, 0x02d00 },
jilai wang34984092015-07-08 18:12:40 -0400203 .caps = MDP_PIPE_CAP_HFLIP | MDP_PIPE_CAP_VFLIP |
204 MDP_PIPE_CAP_SCALE | MDP_PIPE_CAP_DECIMATION,
Stephane Viau2e362e12014-11-18 12:49:48 -0500205 },
206 .pipe_dma = {
207 .count = 2,
Archit Taneja031d63d2016-05-09 12:14:49 +0530208 .base = { 0x03100, 0x03500 },
jilai wang34984092015-07-08 18:12:40 -0400209 .caps = MDP_PIPE_CAP_HFLIP | MDP_PIPE_CAP_VFLIP,
Stephane Viau2e362e12014-11-18 12:49:48 -0500210 },
211 .lm = {
212 .count = 6,
Archit Taneja031d63d2016-05-09 12:14:49 +0530213 .base = { 0x03900, 0x03d00, 0x04100, 0x04500, 0x04900, 0x04d00 },
Stephane Viau2e362e12014-11-18 12:49:48 -0500214 .nb_stages = 5,
Hai Li9b7a9fc2015-06-24 19:13:40 -0400215 .max_width = 2048,
216 .max_height = 0xFFFF,
Stephane Viau2e362e12014-11-18 12:49:48 -0500217 },
218 .dspp = {
219 .count = 4,
Archit Taneja031d63d2016-05-09 12:14:49 +0530220 .base = { 0x05100, 0x05500, 0x05900, 0x05d00 },
Stephane Viau2e362e12014-11-18 12:49:48 -0500221
222 },
223 .ad = {
224 .count = 3,
Archit Taneja031d63d2016-05-09 12:14:49 +0530225 .base = { 0x13400, 0x13600, 0x13800 },
Stephane Viau2e362e12014-11-18 12:49:48 -0500226 },
Hai Li38305902015-03-05 15:20:47 -0500227 .pp = {
228 .count = 4,
Archit Taneja031d63d2016-05-09 12:14:49 +0530229 .base = { 0x12e00, 0x12f00, 0x13000, 0x13100 },
Hai Li38305902015-03-05 15:20:47 -0500230 },
Stephane Viau2e362e12014-11-18 12:49:48 -0500231 .intf = {
Archit Taneja031d63d2016-05-09 12:14:49 +0530232 .base = { 0x12400, 0x12600, 0x12800, 0x12a00, 0x12c00 },
Stephane Viaufe344642015-04-30 13:45:52 -0400233 .connect = {
234 [0] = INTF_eDP,
235 [1] = INTF_DSI,
236 [2] = INTF_DSI,
237 [3] = INTF_HDMI,
238 },
Stephane Viau67ac0a22015-03-13 15:49:34 -0400239 },
Stephane Viau2e362e12014-11-18 12:49:48 -0500240 .max_clk = 320000000,
241};
242
Stephane Viau02dfd9d2015-03-24 15:06:02 -0400243const struct mdp5_cfg_hw msm8x16_config = {
244 .name = "msm8x16",
245 .mdp = {
246 .count = 1,
Archit Taneja031d63d2016-05-09 12:14:49 +0530247 .base = { 0x0 },
Stephane Viaud879eb52015-09-15 08:41:53 -0400248 .caps = MDP_CAP_SMP |
249 0,
Stephane Viau02dfd9d2015-03-24 15:06:02 -0400250 },
251 .smp = {
252 .mmb_count = 8,
253 .mmb_size = 8192,
254 .clients = {
255 [SSPP_VIG0] = 1, [SSPP_DMA0] = 4,
256 [SSPP_RGB0] = 7, [SSPP_RGB1] = 8,
257 },
258 },
259 .ctl = {
260 .count = 5,
Archit Taneja031d63d2016-05-09 12:14:49 +0530261 .base = { 0x01000, 0x01200, 0x01400, 0x01600, 0x01800 },
Stephane Viau02dfd9d2015-03-24 15:06:02 -0400262 .flush_hw_mask = 0x4003ffff,
263 },
264 .pipe_vig = {
265 .count = 1,
Archit Taneja031d63d2016-05-09 12:14:49 +0530266 .base = { 0x04000 },
jilai wang34984092015-07-08 18:12:40 -0400267 .caps = MDP_PIPE_CAP_HFLIP | MDP_PIPE_CAP_VFLIP |
268 MDP_PIPE_CAP_SCALE | MDP_PIPE_CAP_CSC |
269 MDP_PIPE_CAP_DECIMATION,
Stephane Viau02dfd9d2015-03-24 15:06:02 -0400270 },
271 .pipe_rgb = {
272 .count = 2,
Archit Taneja031d63d2016-05-09 12:14:49 +0530273 .base = { 0x14000, 0x16000 },
jilai wang34984092015-07-08 18:12:40 -0400274 .caps = MDP_PIPE_CAP_HFLIP | MDP_PIPE_CAP_VFLIP |
Rob Clark07cd2e32016-10-17 12:00:21 -0400275 MDP_PIPE_CAP_DECIMATION,
Stephane Viau02dfd9d2015-03-24 15:06:02 -0400276 },
277 .pipe_dma = {
278 .count = 1,
Archit Taneja031d63d2016-05-09 12:14:49 +0530279 .base = { 0x24000 },
jilai wang34984092015-07-08 18:12:40 -0400280 .caps = MDP_PIPE_CAP_HFLIP | MDP_PIPE_CAP_VFLIP,
Stephane Viau02dfd9d2015-03-24 15:06:02 -0400281 },
282 .lm = {
283 .count = 2, /* LM0 and LM3 */
Archit Taneja031d63d2016-05-09 12:14:49 +0530284 .base = { 0x44000, 0x47000 },
Rob Clark67cba0f2016-10-24 11:46:44 -0400285 .nb_stages = 8,
Hai Li9b7a9fc2015-06-24 19:13:40 -0400286 .max_width = 2048,
287 .max_height = 0xFFFF,
Stephane Viau02dfd9d2015-03-24 15:06:02 -0400288 },
289 .dspp = {
290 .count = 1,
Archit Taneja031d63d2016-05-09 12:14:49 +0530291 .base = { 0x54000 },
Stephane Viau02dfd9d2015-03-24 15:06:02 -0400292
293 },
294 .intf = {
Archit Taneja031d63d2016-05-09 12:14:49 +0530295 .base = { 0x00000, 0x6a800 },
Stephane Viaufe344642015-04-30 13:45:52 -0400296 .connect = {
297 [0] = INTF_DISABLED,
298 [1] = INTF_DSI,
299 },
Stephane Viau02dfd9d2015-03-24 15:06:02 -0400300 },
Stephane Viau02dfd9d2015-03-24 15:06:02 -0400301 .max_clk = 320000000,
302};
303
Stephane Viau3a84f842015-06-19 16:04:47 -0400304const struct mdp5_cfg_hw msm8x94_config = {
305 .name = "msm8x94",
306 .mdp = {
307 .count = 1,
Stephane Viaud879eb52015-09-15 08:41:53 -0400308 .caps = MDP_CAP_SMP |
309 0,
Stephane Viau3a84f842015-06-19 16:04:47 -0400310 },
311 .smp = {
312 .mmb_count = 44,
313 .mmb_size = 8192,
314 .clients = {
315 [SSPP_VIG0] = 1, [SSPP_VIG1] = 4,
316 [SSPP_VIG2] = 7, [SSPP_VIG3] = 19,
317 [SSPP_DMA0] = 10, [SSPP_DMA1] = 13,
318 [SSPP_RGB0] = 16, [SSPP_RGB1] = 17,
319 [SSPP_RGB2] = 18, [SSPP_RGB3] = 22,
320 },
321 .reserved_state[0] = GENMASK(23, 0), /* first 24 MMBs */
322 .reserved = {
323 [1] = 1, [4] = 1, [7] = 1, [19] = 1,
324 [16] = 5, [17] = 5, [18] = 5, [22] = 5,
325 },
326 },
327 .ctl = {
328 .count = 5,
Archit Taneja031d63d2016-05-09 12:14:49 +0530329 .base = { 0x01000, 0x01200, 0x01400, 0x01600, 0x01800 },
Stephane Viau3a84f842015-06-19 16:04:47 -0400330 .flush_hw_mask = 0xf0ffffff,
331 },
332 .pipe_vig = {
333 .count = 4,
Archit Taneja031d63d2016-05-09 12:14:49 +0530334 .base = { 0x04000, 0x06000, 0x08000, 0x0a000 },
jilai wang34984092015-07-08 18:12:40 -0400335 .caps = MDP_PIPE_CAP_HFLIP | MDP_PIPE_CAP_VFLIP |
336 MDP_PIPE_CAP_SCALE | MDP_PIPE_CAP_CSC |
337 MDP_PIPE_CAP_DECIMATION,
Stephane Viau3a84f842015-06-19 16:04:47 -0400338 },
339 .pipe_rgb = {
340 .count = 4,
Archit Taneja031d63d2016-05-09 12:14:49 +0530341 .base = { 0x14000, 0x16000, 0x18000, 0x1a000 },
jilai wang34984092015-07-08 18:12:40 -0400342 .caps = MDP_PIPE_CAP_HFLIP | MDP_PIPE_CAP_VFLIP |
343 MDP_PIPE_CAP_SCALE | MDP_PIPE_CAP_DECIMATION,
Stephane Viau3a84f842015-06-19 16:04:47 -0400344 },
345 .pipe_dma = {
346 .count = 2,
Archit Taneja031d63d2016-05-09 12:14:49 +0530347 .base = { 0x24000, 0x26000 },
jilai wang34984092015-07-08 18:12:40 -0400348 .caps = MDP_PIPE_CAP_HFLIP | MDP_PIPE_CAP_VFLIP,
Stephane Viau3a84f842015-06-19 16:04:47 -0400349 },
350 .lm = {
351 .count = 6,
Archit Taneja031d63d2016-05-09 12:14:49 +0530352 .base = { 0x44000, 0x45000, 0x46000, 0x47000, 0x48000, 0x49000 },
Stephane Viau3a84f842015-06-19 16:04:47 -0400353 .nb_stages = 8,
Hai Li9b7a9fc2015-06-24 19:13:40 -0400354 .max_width = 2048,
355 .max_height = 0xFFFF,
Stephane Viau3a84f842015-06-19 16:04:47 -0400356 },
357 .dspp = {
358 .count = 4,
Archit Taneja031d63d2016-05-09 12:14:49 +0530359 .base = { 0x54000, 0x56000, 0x58000, 0x5a000 },
Stephane Viau3a84f842015-06-19 16:04:47 -0400360
361 },
362 .ad = {
363 .count = 3,
Archit Taneja031d63d2016-05-09 12:14:49 +0530364 .base = { 0x78000, 0x78800, 0x79000 },
Stephane Viau3a84f842015-06-19 16:04:47 -0400365 },
366 .pp = {
367 .count = 4,
Archit Taneja031d63d2016-05-09 12:14:49 +0530368 .base = { 0x70000, 0x70800, 0x71000, 0x71800 },
Stephane Viau3a84f842015-06-19 16:04:47 -0400369 },
370 .intf = {
Archit Taneja031d63d2016-05-09 12:14:49 +0530371 .base = { 0x6a000, 0x6a800, 0x6b000, 0x6b800, 0x6c000 },
Stephane Viau3a84f842015-06-19 16:04:47 -0400372 .connect = {
373 [0] = INTF_DISABLED,
374 [1] = INTF_DSI,
375 [2] = INTF_DSI,
376 [3] = INTF_HDMI,
377 },
378 },
Stephane Viaud879eb52015-09-15 08:41:53 -0400379 .max_clk = 400000000,
380};
381
382const struct mdp5_cfg_hw msm8x96_config = {
383 .name = "msm8x96",
384 .mdp = {
385 .count = 1,
Stephane Viaud879eb52015-09-15 08:41:53 -0400386 .caps = MDP_CAP_DSC |
387 MDP_CAP_CDM |
388 0,
389 },
390 .ctl = {
391 .count = 5,
Archit Taneja031d63d2016-05-09 12:14:49 +0530392 .base = { 0x01000, 0x01200, 0x01400, 0x01600, 0x01800 },
Stephane Viaud879eb52015-09-15 08:41:53 -0400393 .flush_hw_mask = 0xf4ffffff,
394 },
395 .pipe_vig = {
396 .count = 4,
Archit Taneja031d63d2016-05-09 12:14:49 +0530397 .base = { 0x04000, 0x06000, 0x08000, 0x0a000 },
Stephane Viaud879eb52015-09-15 08:41:53 -0400398 .caps = MDP_PIPE_CAP_HFLIP |
399 MDP_PIPE_CAP_VFLIP |
400 MDP_PIPE_CAP_SCALE |
401 MDP_PIPE_CAP_CSC |
402 MDP_PIPE_CAP_DECIMATION |
403 MDP_PIPE_CAP_SW_PIX_EXT |
404 0,
405 },
406 .pipe_rgb = {
407 .count = 4,
Archit Taneja031d63d2016-05-09 12:14:49 +0530408 .base = { 0x14000, 0x16000, 0x18000, 0x1a000 },
Stephane Viaud879eb52015-09-15 08:41:53 -0400409 .caps = MDP_PIPE_CAP_HFLIP |
410 MDP_PIPE_CAP_VFLIP |
411 MDP_PIPE_CAP_SCALE |
412 MDP_PIPE_CAP_DECIMATION |
413 MDP_PIPE_CAP_SW_PIX_EXT |
414 0,
415 },
416 .pipe_dma = {
417 .count = 2,
Archit Taneja031d63d2016-05-09 12:14:49 +0530418 .base = { 0x24000, 0x26000 },
Stephane Viaud879eb52015-09-15 08:41:53 -0400419 .caps = MDP_PIPE_CAP_HFLIP |
420 MDP_PIPE_CAP_VFLIP |
421 MDP_PIPE_CAP_SW_PIX_EXT |
422 0,
423 },
424 .lm = {
425 .count = 6,
Archit Taneja031d63d2016-05-09 12:14:49 +0530426 .base = { 0x44000, 0x45000, 0x46000, 0x47000, 0x48000, 0x49000 },
Stephane Viaud879eb52015-09-15 08:41:53 -0400427 .nb_stages = 8,
428 .max_width = 2560,
429 .max_height = 0xFFFF,
430 },
431 .dspp = {
432 .count = 2,
Archit Taneja031d63d2016-05-09 12:14:49 +0530433 .base = { 0x54000, 0x56000 },
Stephane Viaud879eb52015-09-15 08:41:53 -0400434 },
435 .ad = {
436 .count = 3,
Archit Taneja031d63d2016-05-09 12:14:49 +0530437 .base = { 0x78000, 0x78800, 0x79000 },
Stephane Viaud879eb52015-09-15 08:41:53 -0400438 },
439 .pp = {
440 .count = 4,
Archit Taneja031d63d2016-05-09 12:14:49 +0530441 .base = { 0x70000, 0x70800, 0x71000, 0x71800 },
Stephane Viaud879eb52015-09-15 08:41:53 -0400442 },
443 .cdm = {
444 .count = 1,
Archit Taneja031d63d2016-05-09 12:14:49 +0530445 .base = { 0x79200 },
Stephane Viaud879eb52015-09-15 08:41:53 -0400446 },
447 .dsc = {
448 .count = 2,
Archit Taneja031d63d2016-05-09 12:14:49 +0530449 .base = { 0x80000, 0x80400 },
Stephane Viaud879eb52015-09-15 08:41:53 -0400450 },
451 .intf = {
Archit Taneja031d63d2016-05-09 12:14:49 +0530452 .base = { 0x6a000, 0x6a800, 0x6b000, 0x6b800, 0x6c000 },
Stephane Viaud879eb52015-09-15 08:41:53 -0400453 .connect = {
454 [0] = INTF_DISABLED,
455 [1] = INTF_DSI,
456 [2] = INTF_DSI,
457 [3] = INTF_HDMI,
458 },
459 },
460 .max_clk = 412500000,
Stephane Viau3a84f842015-06-19 16:04:47 -0400461};
462
Stephane Viau2e362e12014-11-18 12:49:48 -0500463static const struct mdp5_cfg_handler cfg_handlers[] = {
jilai wang8a94b0a2015-07-08 18:25:40 -0400464 { .revision = 0, .config = { .hw = &msm8x74v1_config } },
465 { .revision = 2, .config = { .hw = &msm8x74v2_config } },
Stephane Viau2e362e12014-11-18 12:49:48 -0500466 { .revision = 3, .config = { .hw = &apq8084_config } },
Stephane Viau02dfd9d2015-03-24 15:06:02 -0400467 { .revision = 6, .config = { .hw = &msm8x16_config } },
Stephane Viau3a84f842015-06-19 16:04:47 -0400468 { .revision = 9, .config = { .hw = &msm8x94_config } },
Stephane Viaud879eb52015-09-15 08:41:53 -0400469 { .revision = 7, .config = { .hw = &msm8x96_config } },
Stephane Viau2e362e12014-11-18 12:49:48 -0500470};
471
Stephane Viau2e362e12014-11-18 12:49:48 -0500472static struct mdp5_cfg_platform *mdp5_get_config(struct platform_device *dev);
473
Rob Clark42238da2014-11-18 14:28:43 -0500474const struct mdp5_cfg_hw *mdp5_cfg_get_hw_config(struct mdp5_cfg_handler *cfg_handler)
Stephane Viau2e362e12014-11-18 12:49:48 -0500475{
Stephane Viau2e362e12014-11-18 12:49:48 -0500476 return cfg_handler->config.hw;
477}
478
Rob Clark42238da2014-11-18 14:28:43 -0500479struct mdp5_cfg *mdp5_cfg_get_config(struct mdp5_cfg_handler *cfg_handler)
Stephane Viau2e362e12014-11-18 12:49:48 -0500480{
Stephane Viau2e362e12014-11-18 12:49:48 -0500481 return &cfg_handler->config;
482}
483
Rob Clark42238da2014-11-18 14:28:43 -0500484int mdp5_cfg_get_hw_rev(struct mdp5_cfg_handler *cfg_handler)
Stephane Viau2e362e12014-11-18 12:49:48 -0500485{
Stephane Viau2e362e12014-11-18 12:49:48 -0500486 return cfg_handler->revision;
487}
488
Rob Clark42238da2014-11-18 14:28:43 -0500489void mdp5_cfg_destroy(struct mdp5_cfg_handler *cfg_handler)
Stephane Viau2e362e12014-11-18 12:49:48 -0500490{
Stephane Viau2e362e12014-11-18 12:49:48 -0500491 kfree(cfg_handler);
492}
493
Rob Clark42238da2014-11-18 14:28:43 -0500494struct mdp5_cfg_handler *mdp5_cfg_init(struct mdp5_kms *mdp5_kms,
Stephane Viau2e362e12014-11-18 12:49:48 -0500495 uint32_t major, uint32_t minor)
496{
497 struct drm_device *dev = mdp5_kms->dev;
498 struct platform_device *pdev = dev->platformdev;
499 struct mdp5_cfg_handler *cfg_handler;
500 struct mdp5_cfg_platform *pconfig;
501 int i, ret = 0;
502
503 cfg_handler = kzalloc(sizeof(*cfg_handler), GFP_KERNEL);
504 if (unlikely(!cfg_handler)) {
505 ret = -ENOMEM;
506 goto fail;
507 }
508
509 if (major != 1) {
510 dev_err(dev->dev, "unexpected MDP major version: v%d.%d\n",
511 major, minor);
512 ret = -ENXIO;
513 goto fail;
514 }
515
516 /* only after mdp5_cfg global pointer's init can we access the hw */
517 for (i = 0; i < ARRAY_SIZE(cfg_handlers); i++) {
518 if (cfg_handlers[i].revision != minor)
519 continue;
520 mdp5_cfg = cfg_handlers[i].config.hw;
521
522 break;
523 }
524 if (unlikely(!mdp5_cfg)) {
525 dev_err(dev->dev, "unexpected MDP minor revision: v%d.%d\n",
526 major, minor);
527 ret = -ENXIO;
528 goto fail;
529 }
530
531 cfg_handler->revision = minor;
532 cfg_handler->config.hw = mdp5_cfg;
533
534 pconfig = mdp5_get_config(pdev);
535 memcpy(&cfg_handler->config.platform, pconfig, sizeof(*pconfig));
536
537 DBG("MDP5: %s hw config selected", mdp5_cfg->name);
538
539 return cfg_handler;
540
541fail:
542 if (cfg_handler)
543 mdp5_cfg_destroy(cfg_handler);
544
Jeffrey Hugof3a24612019-05-21 08:00:30 -0700545 return ERR_PTR(ret);
Stephane Viau2e362e12014-11-18 12:49:48 -0500546}
547
548static struct mdp5_cfg_platform *mdp5_get_config(struct platform_device *dev)
549{
550 static struct mdp5_cfg_platform config = {};
Archit Tanejad50c1922015-11-18 12:44:52 +0530551
Stephane Viau2e362e12014-11-18 12:49:48 -0500552 config.iommu = iommu_domain_alloc(&platform_bus_type);
553
554 return &config;
555}