1 // SPDX-License-Identifier: GPL-2.0-only
2 /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
5 #define pr_fmt(fmt) "[drm:%s:%d] " fmt, __func__, __LINE__
6 #include <linux/slab.h>
7 #include <linux/of_address.h>
8 #include <linux/platform_device.h>
9 #include "dpu_hw_mdss.h"
10 #include "dpu_hw_interrupts.h"
11 #include "dpu_hw_catalog.h"
15 (BIT(DPU_SSPP_SRC) | BIT(DPU_SSPP_QOS) |\
16 BIT(DPU_SSPP_CSC_10BIT) | BIT(DPU_SSPP_CDP) |\
17 BIT(DPU_SSPP_TS_PREFILL) | BIT(DPU_SSPP_EXCL_RECT))
19 #define VIG_SDM845_MASK \
20 (VIG_MASK | BIT(DPU_SSPP_QOS_8LVL) | BIT(DPU_SSPP_SCALER_QSEED3))
22 #define VIG_SC7180_MASK \
23 (VIG_MASK | BIT(DPU_SSPP_QOS_8LVL) | BIT(DPU_SSPP_SCALER_QSEED4))
25 #define VIG_SM8250_MASK \
26 (VIG_MASK | BIT(DPU_SSPP_QOS_8LVL) | BIT(DPU_SSPP_SCALER_QSEED3LITE))
28 #define DMA_SDM845_MASK \
29 (BIT(DPU_SSPP_SRC) | BIT(DPU_SSPP_QOS) | BIT(DPU_SSPP_QOS_8LVL) |\
30 BIT(DPU_SSPP_TS_PREFILL) | BIT(DPU_SSPP_TS_PREFILL_REC1) |\
31 BIT(DPU_SSPP_CDP) | BIT(DPU_SSPP_EXCL_RECT))
33 #define DMA_CURSOR_SDM845_MASK \
34 (DMA_SDM845_MASK | BIT(DPU_SSPP_CURSOR))
36 #define MIXER_SDM845_MASK \
37 (BIT(DPU_MIXER_SOURCESPLIT) | BIT(DPU_DIM_LAYER))
39 #define MIXER_SC7180_MASK \
42 #define PINGPONG_SDM845_MASK BIT(DPU_PINGPONG_DITHER)
44 #define PINGPONG_SDM845_SPLIT_MASK \
45 (PINGPONG_SDM845_MASK | BIT(DPU_PINGPONG_TE2))
47 #define CTL_SC7280_MASK \
48 (BIT(DPU_CTL_ACTIVE_CFG) | BIT(DPU_CTL_FETCH_ACTIVE))
50 #define MERGE_3D_SM8150_MASK (0)
52 #define DSPP_SC7180_MASK BIT(DPU_DSPP_PCC)
54 #define INTF_SDM845_MASK (0)
56 #define INTF_SC7180_MASK BIT(DPU_INTF_INPUT_CTRL) | BIT(DPU_INTF_TE)
58 #define INTF_SC7280_MASK INTF_SC7180_MASK | BIT(DPU_DATA_HCTL_EN)
60 #define IRQ_SDM845_MASK (BIT(MDP_SSPP_TOP0_INTR) | \
61 BIT(MDP_SSPP_TOP0_INTR2) | \
62 BIT(MDP_SSPP_TOP0_HIST_INTR) | \
63 BIT(MDP_INTF0_INTR) | \
64 BIT(MDP_INTF1_INTR) | \
65 BIT(MDP_INTF2_INTR) | \
66 BIT(MDP_INTF3_INTR) | \
67 BIT(MDP_INTF4_INTR) | \
68 BIT(MDP_AD4_0_INTR) | \
71 #define IRQ_SC7180_MASK (BIT(MDP_SSPP_TOP0_INTR) | \
72 BIT(MDP_SSPP_TOP0_INTR2) | \
73 BIT(MDP_SSPP_TOP0_HIST_INTR) | \
74 BIT(MDP_INTF0_INTR) | \
77 #define IRQ_SC7280_MASK (BIT(MDP_SSPP_TOP0_INTR) | \
78 BIT(MDP_SSPP_TOP0_INTR2) | \
79 BIT(MDP_SSPP_TOP0_HIST_INTR) | \
80 BIT(MDP_INTF0_7xxx_INTR) | \
81 BIT(MDP_INTF1_7xxx_INTR) | \
82 BIT(MDP_INTF5_7xxx_INTR))
84 #define IRQ_SM8250_MASK (BIT(MDP_SSPP_TOP0_INTR) | \
85 BIT(MDP_SSPP_TOP0_INTR2) | \
86 BIT(MDP_SSPP_TOP0_HIST_INTR) | \
87 BIT(MDP_INTF0_INTR) | \
88 BIT(MDP_INTF1_INTR) | \
89 BIT(MDP_INTF2_INTR) | \
90 BIT(MDP_INTF3_INTR) | \
94 #define DEFAULT_PIXEL_RAM_SIZE (50 * 1024)
95 #define DEFAULT_DPU_LINE_WIDTH 2048
96 #define DEFAULT_DPU_OUTPUT_LINE_WIDTH 2560
98 #define MAX_HORZ_DECIMATION 4
99 #define MAX_VERT_DECIMATION 4
101 #define MAX_UPSCALE_RATIO 20
102 #define MAX_DOWNSCALE_RATIO 4
103 #define SSPP_UNITY_SCALE 1
105 #define STRCAT(X, Y) (X Y)
107 static const uint32_t plane_formats[] = {
138 static const uint32_t plane_formats_yuv[] = {
180 /*************************************************************
181 * DPU sub blocks config
182 *************************************************************/
183 /* DPU top level caps */
184 static const struct dpu_caps sdm845_dpu_caps = {
185 .max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
186 .max_mixer_blendstages = 0xb,
187 .qseed_type = DPU_SSPP_SCALER_QSEED3,
188 .smart_dma_rev = DPU_SSPP_SMART_DMA_V2,
189 .ubwc_version = DPU_HW_UBWC_VER_20,
190 .has_src_split = true,
191 .has_dim_layer = true,
193 .has_3d_merge = true,
194 .max_linewidth = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
195 .pixel_ram_size = DEFAULT_PIXEL_RAM_SIZE,
196 .max_hdeci_exp = MAX_HORZ_DECIMATION,
197 .max_vdeci_exp = MAX_VERT_DECIMATION,
200 static const struct dpu_caps sc7180_dpu_caps = {
201 .max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
202 .max_mixer_blendstages = 0x9,
203 .qseed_type = DPU_SSPP_SCALER_QSEED4,
204 .smart_dma_rev = DPU_SSPP_SMART_DMA_V2,
205 .ubwc_version = DPU_HW_UBWC_VER_20,
206 .has_dim_layer = true,
208 .max_linewidth = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
209 .pixel_ram_size = DEFAULT_PIXEL_RAM_SIZE,
212 static const struct dpu_caps sm8150_dpu_caps = {
213 .max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
214 .max_mixer_blendstages = 0xb,
215 .qseed_type = DPU_SSPP_SCALER_QSEED3,
216 .smart_dma_rev = DPU_SSPP_SMART_DMA_V2, /* TODO: v2.5 */
217 .ubwc_version = DPU_HW_UBWC_VER_30,
218 .has_src_split = true,
219 .has_dim_layer = true,
221 .has_3d_merge = true,
222 .max_linewidth = 4096,
223 .pixel_ram_size = DEFAULT_PIXEL_RAM_SIZE,
224 .max_hdeci_exp = MAX_HORZ_DECIMATION,
225 .max_vdeci_exp = MAX_VERT_DECIMATION,
228 static const struct dpu_caps sm8250_dpu_caps = {
229 .max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
230 .max_mixer_blendstages = 0xb,
231 .qseed_type = DPU_SSPP_SCALER_QSEED3LITE,
232 .smart_dma_rev = DPU_SSPP_SMART_DMA_V2, /* TODO: v2.5 */
233 .ubwc_version = DPU_HW_UBWC_VER_40,
234 .has_src_split = true,
235 .has_dim_layer = true,
237 .has_3d_merge = true,
238 .max_linewidth = 4096,
239 .pixel_ram_size = DEFAULT_PIXEL_RAM_SIZE,
242 static const struct dpu_caps sc7280_dpu_caps = {
243 .max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
244 .max_mixer_blendstages = 0x7,
245 .qseed_type = DPU_SSPP_SCALER_QSEED4,
246 .smart_dma_rev = DPU_SSPP_SMART_DMA_V2,
247 .ubwc_version = DPU_HW_UBWC_VER_30,
248 .has_dim_layer = true,
250 .max_linewidth = 2400,
251 .pixel_ram_size = DEFAULT_PIXEL_RAM_SIZE,
254 static const struct dpu_mdp_cfg sdm845_mdp[] = {
256 .name = "top_0", .id = MDP_TOP,
257 .base = 0x0, .len = 0x45C,
259 .highest_bank_bit = 0x2,
260 .clk_ctrls[DPU_CLK_CTRL_VIG0] = {
261 .reg_off = 0x2AC, .bit_off = 0},
262 .clk_ctrls[DPU_CLK_CTRL_VIG1] = {
263 .reg_off = 0x2B4, .bit_off = 0},
264 .clk_ctrls[DPU_CLK_CTRL_VIG2] = {
265 .reg_off = 0x2BC, .bit_off = 0},
266 .clk_ctrls[DPU_CLK_CTRL_VIG3] = {
267 .reg_off = 0x2C4, .bit_off = 0},
268 .clk_ctrls[DPU_CLK_CTRL_DMA0] = {
269 .reg_off = 0x2AC, .bit_off = 8},
270 .clk_ctrls[DPU_CLK_CTRL_DMA1] = {
271 .reg_off = 0x2B4, .bit_off = 8},
272 .clk_ctrls[DPU_CLK_CTRL_CURSOR0] = {
273 .reg_off = 0x2BC, .bit_off = 8},
274 .clk_ctrls[DPU_CLK_CTRL_CURSOR1] = {
275 .reg_off = 0x2C4, .bit_off = 8},
279 static const struct dpu_mdp_cfg sc7180_mdp[] = {
281 .name = "top_0", .id = MDP_TOP,
282 .base = 0x0, .len = 0x494,
284 .highest_bank_bit = 0x3,
285 .clk_ctrls[DPU_CLK_CTRL_VIG0] = {
286 .reg_off = 0x2AC, .bit_off = 0},
287 .clk_ctrls[DPU_CLK_CTRL_DMA0] = {
288 .reg_off = 0x2AC, .bit_off = 8},
289 .clk_ctrls[DPU_CLK_CTRL_CURSOR0] = {
290 .reg_off = 0x2B4, .bit_off = 8},
291 .clk_ctrls[DPU_CLK_CTRL_CURSOR1] = {
292 .reg_off = 0x2C4, .bit_off = 8},
296 static const struct dpu_mdp_cfg sm8250_mdp[] = {
298 .name = "top_0", .id = MDP_TOP,
299 .base = 0x0, .len = 0x494,
301 .highest_bank_bit = 0x3, /* TODO: 2 for LP_DDR4 */
302 .clk_ctrls[DPU_CLK_CTRL_VIG0] = {
303 .reg_off = 0x2AC, .bit_off = 0},
304 .clk_ctrls[DPU_CLK_CTRL_VIG1] = {
305 .reg_off = 0x2B4, .bit_off = 0},
306 .clk_ctrls[DPU_CLK_CTRL_VIG2] = {
307 .reg_off = 0x2BC, .bit_off = 0},
308 .clk_ctrls[DPU_CLK_CTRL_VIG3] = {
309 .reg_off = 0x2C4, .bit_off = 0},
310 .clk_ctrls[DPU_CLK_CTRL_DMA0] = {
311 .reg_off = 0x2AC, .bit_off = 8},
312 .clk_ctrls[DPU_CLK_CTRL_DMA1] = {
313 .reg_off = 0x2B4, .bit_off = 8},
314 .clk_ctrls[DPU_CLK_CTRL_CURSOR0] = {
315 .reg_off = 0x2BC, .bit_off = 8},
316 .clk_ctrls[DPU_CLK_CTRL_CURSOR1] = {
317 .reg_off = 0x2C4, .bit_off = 8},
318 .clk_ctrls[DPU_CLK_CTRL_REG_DMA] = {
319 .reg_off = 0x2BC, .bit_off = 20},
323 static const struct dpu_mdp_cfg sc7280_mdp[] = {
325 .name = "top_0", .id = MDP_TOP,
326 .base = 0x0, .len = 0x2014,
327 .highest_bank_bit = 0x1,
328 .clk_ctrls[DPU_CLK_CTRL_VIG0] = {
329 .reg_off = 0x2AC, .bit_off = 0},
330 .clk_ctrls[DPU_CLK_CTRL_DMA0] = {
331 .reg_off = 0x2AC, .bit_off = 8},
332 .clk_ctrls[DPU_CLK_CTRL_CURSOR0] = {
333 .reg_off = 0x2B4, .bit_off = 8},
334 .clk_ctrls[DPU_CLK_CTRL_CURSOR1] = {
335 .reg_off = 0x2C4, .bit_off = 8},
339 /*************************************************************
340 * CTL sub blocks config
341 *************************************************************/
342 static const struct dpu_ctl_cfg sdm845_ctl[] = {
344 .name = "ctl_0", .id = CTL_0,
345 .base = 0x1000, .len = 0xE4,
346 .features = BIT(DPU_CTL_SPLIT_DISPLAY),
347 .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 9),
350 .name = "ctl_1", .id = CTL_1,
351 .base = 0x1200, .len = 0xE4,
352 .features = BIT(DPU_CTL_SPLIT_DISPLAY),
353 .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 10),
356 .name = "ctl_2", .id = CTL_2,
357 .base = 0x1400, .len = 0xE4,
359 .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 11),
362 .name = "ctl_3", .id = CTL_3,
363 .base = 0x1600, .len = 0xE4,
365 .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 12),
368 .name = "ctl_4", .id = CTL_4,
369 .base = 0x1800, .len = 0xE4,
371 .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 13),
375 static const struct dpu_ctl_cfg sc7180_ctl[] = {
377 .name = "ctl_0", .id = CTL_0,
378 .base = 0x1000, .len = 0xE4,
379 .features = BIT(DPU_CTL_ACTIVE_CFG),
380 .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 9),
383 .name = "ctl_1", .id = CTL_1,
384 .base = 0x1200, .len = 0xE4,
385 .features = BIT(DPU_CTL_ACTIVE_CFG),
386 .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 10),
389 .name = "ctl_2", .id = CTL_2,
390 .base = 0x1400, .len = 0xE4,
391 .features = BIT(DPU_CTL_ACTIVE_CFG),
392 .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 11),
396 static const struct dpu_ctl_cfg sm8150_ctl[] = {
398 .name = "ctl_0", .id = CTL_0,
399 .base = 0x1000, .len = 0x1e0,
400 .features = BIT(DPU_CTL_ACTIVE_CFG) | BIT(DPU_CTL_SPLIT_DISPLAY),
401 .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 9),
404 .name = "ctl_1", .id = CTL_1,
405 .base = 0x1200, .len = 0x1e0,
406 .features = BIT(DPU_CTL_ACTIVE_CFG) | BIT(DPU_CTL_SPLIT_DISPLAY),
407 .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 10),
410 .name = "ctl_2", .id = CTL_2,
411 .base = 0x1400, .len = 0x1e0,
412 .features = BIT(DPU_CTL_ACTIVE_CFG),
413 .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 11),
416 .name = "ctl_3", .id = CTL_3,
417 .base = 0x1600, .len = 0x1e0,
418 .features = BIT(DPU_CTL_ACTIVE_CFG),
419 .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 12),
422 .name = "ctl_4", .id = CTL_4,
423 .base = 0x1800, .len = 0x1e0,
424 .features = BIT(DPU_CTL_ACTIVE_CFG),
425 .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 13),
428 .name = "ctl_5", .id = CTL_5,
429 .base = 0x1a00, .len = 0x1e0,
430 .features = BIT(DPU_CTL_ACTIVE_CFG),
431 .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 23),
435 static const struct dpu_ctl_cfg sc7280_ctl[] = {
437 .name = "ctl_0", .id = CTL_0,
438 .base = 0x15000, .len = 0x1E8,
439 .features = CTL_SC7280_MASK,
440 .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 9),
443 .name = "ctl_1", .id = CTL_1,
444 .base = 0x16000, .len = 0x1E8,
445 .features = CTL_SC7280_MASK,
446 .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 10),
449 .name = "ctl_2", .id = CTL_2,
450 .base = 0x17000, .len = 0x1E8,
451 .features = CTL_SC7280_MASK,
452 .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 11),
455 .name = "ctl_3", .id = CTL_3,
456 .base = 0x18000, .len = 0x1E8,
457 .features = CTL_SC7280_MASK,
458 .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 12),
462 /*************************************************************
463 * SSPP sub blocks config
464 *************************************************************/
466 /* SSPP common configuration */
468 #define _VIG_SBLK(num, sdma_pri, qseed_ver) \
470 .maxdwnscale = MAX_DOWNSCALE_RATIO, \
471 .maxupscale = MAX_UPSCALE_RATIO, \
472 .smart_dma_priority = sdma_pri, \
473 .src_blk = {.name = STRCAT("sspp_src_", num), \
474 .id = DPU_SSPP_SRC, .base = 0x00, .len = 0x150,}, \
475 .scaler_blk = {.name = STRCAT("sspp_scaler", num), \
477 .base = 0xa00, .len = 0xa0,}, \
478 .csc_blk = {.name = STRCAT("sspp_csc", num), \
479 .id = DPU_SSPP_CSC_10BIT, \
480 .base = 0x1a00, .len = 0x100,}, \
481 .format_list = plane_formats_yuv, \
482 .num_formats = ARRAY_SIZE(plane_formats_yuv), \
483 .virt_format_list = plane_formats, \
484 .virt_num_formats = ARRAY_SIZE(plane_formats), \
487 #define _DMA_SBLK(num, sdma_pri) \
489 .maxdwnscale = SSPP_UNITY_SCALE, \
490 .maxupscale = SSPP_UNITY_SCALE, \
491 .smart_dma_priority = sdma_pri, \
492 .src_blk = {.name = STRCAT("sspp_src_", num), \
493 .id = DPU_SSPP_SRC, .base = 0x00, .len = 0x150,}, \
494 .format_list = plane_formats, \
495 .num_formats = ARRAY_SIZE(plane_formats), \
496 .virt_format_list = plane_formats, \
497 .virt_num_formats = ARRAY_SIZE(plane_formats), \
500 static const struct dpu_sspp_sub_blks sdm845_vig_sblk_0 =
501 _VIG_SBLK("0", 5, DPU_SSPP_SCALER_QSEED3);
502 static const struct dpu_sspp_sub_blks sdm845_vig_sblk_1 =
503 _VIG_SBLK("1", 6, DPU_SSPP_SCALER_QSEED3);
504 static const struct dpu_sspp_sub_blks sdm845_vig_sblk_2 =
505 _VIG_SBLK("2", 7, DPU_SSPP_SCALER_QSEED3);
506 static const struct dpu_sspp_sub_blks sdm845_vig_sblk_3 =
507 _VIG_SBLK("3", 8, DPU_SSPP_SCALER_QSEED3);
509 static const struct dpu_sspp_sub_blks sdm845_dma_sblk_0 = _DMA_SBLK("8", 1);
510 static const struct dpu_sspp_sub_blks sdm845_dma_sblk_1 = _DMA_SBLK("9", 2);
511 static const struct dpu_sspp_sub_blks sdm845_dma_sblk_2 = _DMA_SBLK("10", 3);
512 static const struct dpu_sspp_sub_blks sdm845_dma_sblk_3 = _DMA_SBLK("11", 4);
514 #define SSPP_BLK(_name, _id, _base, _features, \
515 _sblk, _xinid, _type, _clkctrl) \
517 .name = _name, .id = _id, \
518 .base = _base, .len = 0x1c8, \
519 .features = _features, \
523 .clk_ctrl = _clkctrl \
526 static const struct dpu_sspp_cfg sdm845_sspp[] = {
527 SSPP_BLK("sspp_0", SSPP_VIG0, 0x4000, VIG_SDM845_MASK,
528 sdm845_vig_sblk_0, 0, SSPP_TYPE_VIG, DPU_CLK_CTRL_VIG0),
529 SSPP_BLK("sspp_1", SSPP_VIG1, 0x6000, VIG_SDM845_MASK,
530 sdm845_vig_sblk_1, 4, SSPP_TYPE_VIG, DPU_CLK_CTRL_VIG1),
531 SSPP_BLK("sspp_2", SSPP_VIG2, 0x8000, VIG_SDM845_MASK,
532 sdm845_vig_sblk_2, 8, SSPP_TYPE_VIG, DPU_CLK_CTRL_VIG2),
533 SSPP_BLK("sspp_3", SSPP_VIG3, 0xa000, VIG_SDM845_MASK,
534 sdm845_vig_sblk_3, 12, SSPP_TYPE_VIG, DPU_CLK_CTRL_VIG3),
535 SSPP_BLK("sspp_8", SSPP_DMA0, 0x24000, DMA_SDM845_MASK,
536 sdm845_dma_sblk_0, 1, SSPP_TYPE_DMA, DPU_CLK_CTRL_DMA0),
537 SSPP_BLK("sspp_9", SSPP_DMA1, 0x26000, DMA_SDM845_MASK,
538 sdm845_dma_sblk_1, 5, SSPP_TYPE_DMA, DPU_CLK_CTRL_DMA1),
539 SSPP_BLK("sspp_10", SSPP_DMA2, 0x28000, DMA_CURSOR_SDM845_MASK,
540 sdm845_dma_sblk_2, 9, SSPP_TYPE_DMA, DPU_CLK_CTRL_CURSOR0),
541 SSPP_BLK("sspp_11", SSPP_DMA3, 0x2a000, DMA_CURSOR_SDM845_MASK,
542 sdm845_dma_sblk_3, 13, SSPP_TYPE_DMA, DPU_CLK_CTRL_CURSOR1),
545 static const struct dpu_sspp_sub_blks sc7180_vig_sblk_0 =
546 _VIG_SBLK("0", 4, DPU_SSPP_SCALER_QSEED4);
548 static const struct dpu_sspp_cfg sc7180_sspp[] = {
549 SSPP_BLK("sspp_0", SSPP_VIG0, 0x4000, VIG_SC7180_MASK,
550 sc7180_vig_sblk_0, 0, SSPP_TYPE_VIG, DPU_CLK_CTRL_VIG0),
551 SSPP_BLK("sspp_8", SSPP_DMA0, 0x24000, DMA_SDM845_MASK,
552 sdm845_dma_sblk_0, 1, SSPP_TYPE_DMA, DPU_CLK_CTRL_DMA0),
553 SSPP_BLK("sspp_9", SSPP_DMA1, 0x26000, DMA_CURSOR_SDM845_MASK,
554 sdm845_dma_sblk_1, 5, SSPP_TYPE_DMA, DPU_CLK_CTRL_CURSOR0),
555 SSPP_BLK("sspp_10", SSPP_DMA2, 0x28000, DMA_CURSOR_SDM845_MASK,
556 sdm845_dma_sblk_2, 9, SSPP_TYPE_DMA, DPU_CLK_CTRL_CURSOR1),
559 static const struct dpu_sspp_sub_blks sm8250_vig_sblk_0 =
560 _VIG_SBLK("0", 5, DPU_SSPP_SCALER_QSEED3LITE);
561 static const struct dpu_sspp_sub_blks sm8250_vig_sblk_1 =
562 _VIG_SBLK("1", 6, DPU_SSPP_SCALER_QSEED3LITE);
563 static const struct dpu_sspp_sub_blks sm8250_vig_sblk_2 =
564 _VIG_SBLK("2", 7, DPU_SSPP_SCALER_QSEED3LITE);
565 static const struct dpu_sspp_sub_blks sm8250_vig_sblk_3 =
566 _VIG_SBLK("3", 8, DPU_SSPP_SCALER_QSEED3LITE);
568 static const struct dpu_sspp_cfg sm8250_sspp[] = {
569 SSPP_BLK("sspp_0", SSPP_VIG0, 0x4000, VIG_SM8250_MASK,
570 sm8250_vig_sblk_0, 0, SSPP_TYPE_VIG, DPU_CLK_CTRL_VIG0),
571 SSPP_BLK("sspp_1", SSPP_VIG1, 0x6000, VIG_SM8250_MASK,
572 sm8250_vig_sblk_1, 4, SSPP_TYPE_VIG, DPU_CLK_CTRL_VIG1),
573 SSPP_BLK("sspp_2", SSPP_VIG2, 0x8000, VIG_SM8250_MASK,
574 sm8250_vig_sblk_2, 8, SSPP_TYPE_VIG, DPU_CLK_CTRL_VIG2),
575 SSPP_BLK("sspp_3", SSPP_VIG3, 0xa000, VIG_SM8250_MASK,
576 sm8250_vig_sblk_3, 12, SSPP_TYPE_VIG, DPU_CLK_CTRL_VIG3),
577 SSPP_BLK("sspp_8", SSPP_DMA0, 0x24000, DMA_SDM845_MASK,
578 sdm845_dma_sblk_0, 1, SSPP_TYPE_DMA, DPU_CLK_CTRL_DMA0),
579 SSPP_BLK("sspp_9", SSPP_DMA1, 0x26000, DMA_SDM845_MASK,
580 sdm845_dma_sblk_1, 5, SSPP_TYPE_DMA, DPU_CLK_CTRL_DMA1),
581 SSPP_BLK("sspp_10", SSPP_DMA2, 0x28000, DMA_CURSOR_SDM845_MASK,
582 sdm845_dma_sblk_2, 9, SSPP_TYPE_DMA, DPU_CLK_CTRL_CURSOR0),
583 SSPP_BLK("sspp_11", SSPP_DMA3, 0x2a000, DMA_CURSOR_SDM845_MASK,
584 sdm845_dma_sblk_3, 13, SSPP_TYPE_DMA, DPU_CLK_CTRL_CURSOR1),
587 static const struct dpu_sspp_cfg sc7280_sspp[] = {
588 SSPP_BLK("sspp_0", SSPP_VIG0, 0x4000, VIG_SC7180_MASK,
589 sc7180_vig_sblk_0, 0, SSPP_TYPE_VIG, DPU_CLK_CTRL_VIG0),
590 SSPP_BLK("sspp_8", SSPP_DMA0, 0x24000, DMA_SDM845_MASK,
591 sdm845_dma_sblk_0, 1, SSPP_TYPE_DMA, DPU_CLK_CTRL_DMA0),
592 SSPP_BLK("sspp_9", SSPP_DMA1, 0x26000, DMA_CURSOR_SDM845_MASK,
593 sdm845_dma_sblk_1, 5, SSPP_TYPE_DMA, DPU_CLK_CTRL_CURSOR0),
594 SSPP_BLK("sspp_10", SSPP_DMA2, 0x28000, DMA_CURSOR_SDM845_MASK,
595 sdm845_dma_sblk_2, 9, SSPP_TYPE_DMA, DPU_CLK_CTRL_CURSOR1),
598 /*************************************************************
599 * MIXER sub blocks config
600 *************************************************************/
604 static const struct dpu_lm_sub_blks sdm845_lm_sblk = {
605 .maxwidth = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
606 .maxblendstages = 11, /* excluding base layer */
607 .blendstage_base = { /* offsets relative to mixer base */
608 0x20, 0x38, 0x50, 0x68, 0x80, 0x98,
609 0xb0, 0xc8, 0xe0, 0xf8, 0x110
613 #define LM_BLK(_name, _id, _base, _fmask, _sblk, _pp, _lmpair, _dspp) \
615 .name = _name, .id = _id, \
616 .base = _base, .len = 0x320, \
617 .features = _fmask, \
620 .lm_pair_mask = (1 << _lmpair), \
624 static const struct dpu_lm_cfg sdm845_lm[] = {
625 LM_BLK("lm_0", LM_0, 0x44000, MIXER_SDM845_MASK,
626 &sdm845_lm_sblk, PINGPONG_0, LM_1, 0),
627 LM_BLK("lm_1", LM_1, 0x45000, MIXER_SDM845_MASK,
628 &sdm845_lm_sblk, PINGPONG_1, LM_0, 0),
629 LM_BLK("lm_2", LM_2, 0x46000, MIXER_SDM845_MASK,
630 &sdm845_lm_sblk, PINGPONG_2, LM_5, 0),
631 LM_BLK("lm_3", LM_3, 0x0, MIXER_SDM845_MASK,
632 &sdm845_lm_sblk, PINGPONG_MAX, 0, 0),
633 LM_BLK("lm_4", LM_4, 0x0, MIXER_SDM845_MASK,
634 &sdm845_lm_sblk, PINGPONG_MAX, 0, 0),
635 LM_BLK("lm_5", LM_5, 0x49000, MIXER_SDM845_MASK,
636 &sdm845_lm_sblk, PINGPONG_3, LM_2, 0),
641 static const struct dpu_lm_sub_blks sc7180_lm_sblk = {
642 .maxwidth = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
643 .maxblendstages = 7, /* excluding base layer */
644 .blendstage_base = { /* offsets relative to mixer base */
645 0x20, 0x38, 0x50, 0x68, 0x80, 0x98, 0xb0
649 static const struct dpu_lm_cfg sc7180_lm[] = {
650 LM_BLK("lm_0", LM_0, 0x44000, MIXER_SC7180_MASK,
651 &sc7180_lm_sblk, PINGPONG_0, LM_1, DSPP_0),
652 LM_BLK("lm_1", LM_1, 0x45000, MIXER_SC7180_MASK,
653 &sc7180_lm_sblk, PINGPONG_1, LM_0, 0),
658 static const struct dpu_lm_cfg sm8150_lm[] = {
659 LM_BLK("lm_0", LM_0, 0x44000, MIXER_SDM845_MASK,
660 &sdm845_lm_sblk, PINGPONG_0, LM_1, DSPP_0),
661 LM_BLK("lm_1", LM_1, 0x45000, MIXER_SDM845_MASK,
662 &sdm845_lm_sblk, PINGPONG_1, LM_0, DSPP_1),
663 LM_BLK("lm_2", LM_2, 0x46000, MIXER_SDM845_MASK,
664 &sdm845_lm_sblk, PINGPONG_2, LM_3, 0),
665 LM_BLK("lm_3", LM_3, 0x47000, MIXER_SDM845_MASK,
666 &sdm845_lm_sblk, PINGPONG_3, LM_2, 0),
667 LM_BLK("lm_4", LM_4, 0x48000, MIXER_SDM845_MASK,
668 &sdm845_lm_sblk, PINGPONG_4, LM_5, 0),
669 LM_BLK("lm_5", LM_5, 0x49000, MIXER_SDM845_MASK,
670 &sdm845_lm_sblk, PINGPONG_5, LM_4, 0),
673 static const struct dpu_lm_cfg sc7280_lm[] = {
674 LM_BLK("lm_0", LM_0, 0x44000, MIXER_SC7180_MASK,
675 &sc7180_lm_sblk, PINGPONG_0, 0, 0),
676 LM_BLK("lm_2", LM_2, 0x46000, MIXER_SC7180_MASK,
677 &sc7180_lm_sblk, PINGPONG_2, LM_3, 0),
678 LM_BLK("lm_3", LM_3, 0x47000, MIXER_SC7180_MASK,
679 &sc7180_lm_sblk, PINGPONG_3, LM_2, 0),
682 /*************************************************************
683 * DSPP sub blocks config
684 *************************************************************/
685 static const struct dpu_dspp_sub_blks sc7180_dspp_sblk = {
686 .pcc = {.id = DPU_DSPP_PCC, .base = 0x1700,
687 .len = 0x90, .version = 0x10000},
690 static const struct dpu_dspp_sub_blks sm8150_dspp_sblk = {
691 .pcc = {.id = DPU_DSPP_PCC, .base = 0x1700,
692 .len = 0x90, .version = 0x40000},
695 #define DSPP_BLK(_name, _id, _base, _mask, _sblk) \
697 .name = _name, .id = _id, \
698 .base = _base, .len = 0x1800, \
703 static const struct dpu_dspp_cfg sc7180_dspp[] = {
704 DSPP_BLK("dspp_0", DSPP_0, 0x54000, DSPP_SC7180_MASK,
708 static const struct dpu_dspp_cfg sm8150_dspp[] = {
709 DSPP_BLK("dspp_0", DSPP_0, 0x54000, DSPP_SC7180_MASK,
711 DSPP_BLK("dspp_1", DSPP_1, 0x56000, DSPP_SC7180_MASK,
713 DSPP_BLK("dspp_2", DSPP_2, 0x58000, DSPP_SC7180_MASK,
715 DSPP_BLK("dspp_3", DSPP_3, 0x5a000, DSPP_SC7180_MASK,
719 /*************************************************************
720 * PINGPONG sub blocks config
721 *************************************************************/
722 static const struct dpu_pingpong_sub_blks sdm845_pp_sblk_te = {
723 .te2 = {.id = DPU_PINGPONG_TE2, .base = 0x2000, .len = 0x0,
725 .dither = {.id = DPU_PINGPONG_DITHER, .base = 0x30e0,
726 .len = 0x20, .version = 0x10000},
729 static const struct dpu_pingpong_sub_blks sdm845_pp_sblk = {
730 .dither = {.id = DPU_PINGPONG_DITHER, .base = 0x30e0,
731 .len = 0x20, .version = 0x10000},
734 static const struct dpu_pingpong_sub_blks sc7280_pp_sblk = {
735 .dither = {.id = DPU_PINGPONG_DITHER, .base = 0xe0,
736 .len = 0x20, .version = 0x20000},
739 #define PP_BLK_TE(_name, _id, _base, _merge_3d, _sblk, _done, _rdptr) \
741 .name = _name, .id = _id, \
742 .base = _base, .len = 0xd4, \
743 .features = PINGPONG_SDM845_SPLIT_MASK, \
744 .merge_3d = _merge_3d, \
746 .intr_done = _done, \
747 .intr_rdptr = _rdptr, \
749 #define PP_BLK(_name, _id, _base, _merge_3d, _sblk, _done, _rdptr) \
751 .name = _name, .id = _id, \
752 .base = _base, .len = 0xd4, \
753 .features = PINGPONG_SDM845_MASK, \
754 .merge_3d = _merge_3d, \
756 .intr_done = _done, \
757 .intr_rdptr = _rdptr, \
760 static const struct dpu_pingpong_cfg sdm845_pp[] = {
761 PP_BLK_TE("pingpong_0", PINGPONG_0, 0x70000, 0, sdm845_pp_sblk_te,
762 DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 8),
763 DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 12)),
764 PP_BLK_TE("pingpong_1", PINGPONG_1, 0x70800, 0, sdm845_pp_sblk_te,
765 DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 9),
766 DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 13)),
767 PP_BLK("pingpong_2", PINGPONG_2, 0x71000, 0, sdm845_pp_sblk,
768 DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 10),
769 DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 14)),
770 PP_BLK("pingpong_3", PINGPONG_3, 0x71800, 0, sdm845_pp_sblk,
771 DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 11),
772 DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 15)),
775 static struct dpu_pingpong_cfg sc7180_pp[] = {
776 PP_BLK_TE("pingpong_0", PINGPONG_0, 0x70000, 0, sdm845_pp_sblk_te, -1, -1),
777 PP_BLK_TE("pingpong_1", PINGPONG_1, 0x70800, 0, sdm845_pp_sblk_te, -1, -1),
780 static const struct dpu_pingpong_cfg sm8150_pp[] = {
781 PP_BLK_TE("pingpong_0", PINGPONG_0, 0x70000, MERGE_3D_0, sdm845_pp_sblk_te,
782 DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 8),
783 DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 12)),
784 PP_BLK_TE("pingpong_1", PINGPONG_1, 0x70800, MERGE_3D_0, sdm845_pp_sblk_te,
785 DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 9),
786 DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 13)),
787 PP_BLK("pingpong_2", PINGPONG_2, 0x71000, MERGE_3D_1, sdm845_pp_sblk,
788 DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 10),
789 DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 14)),
790 PP_BLK("pingpong_3", PINGPONG_3, 0x71800, MERGE_3D_1, sdm845_pp_sblk,
791 DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 11),
792 DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 15)),
793 PP_BLK("pingpong_4", PINGPONG_4, 0x72000, MERGE_3D_2, sdm845_pp_sblk,
794 DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 30),
796 PP_BLK("pingpong_5", PINGPONG_5, 0x72800, MERGE_3D_2, sdm845_pp_sblk,
797 DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 30),
801 /*************************************************************
802 * MERGE_3D sub blocks config
803 *************************************************************/
804 #define MERGE_3D_BLK(_name, _id, _base) \
806 .name = _name, .id = _id, \
807 .base = _base, .len = 0x100, \
808 .features = MERGE_3D_SM8150_MASK, \
812 static const struct dpu_merge_3d_cfg sm8150_merge_3d[] = {
813 MERGE_3D_BLK("merge_3d_0", MERGE_3D_0, 0x83000),
814 MERGE_3D_BLK("merge_3d_1", MERGE_3D_1, 0x83100),
815 MERGE_3D_BLK("merge_3d_2", MERGE_3D_2, 0x83200),
818 static const struct dpu_pingpong_cfg sc7280_pp[] = {
819 PP_BLK("pingpong_0", PINGPONG_0, 0x59000, 0, sc7280_pp_sblk, -1, -1),
820 PP_BLK("pingpong_1", PINGPONG_1, 0x6a000, 0, sc7280_pp_sblk, -1, -1),
821 PP_BLK("pingpong_2", PINGPONG_2, 0x6b000, 0, sc7280_pp_sblk, -1, -1),
822 PP_BLK("pingpong_3", PINGPONG_3, 0x6c000, 0, sc7280_pp_sblk, -1, -1),
824 /*************************************************************
825 * INTF sub blocks config
826 *************************************************************/
827 #define INTF_BLK(_name, _id, _base, _type, _ctrl_id, _progfetch, _features, _reg, _underrun_bit, _vsync_bit) \
829 .name = _name, .id = _id, \
830 .base = _base, .len = 0x280, \
831 .features = _features, \
833 .controller_id = _ctrl_id, \
834 .prog_fetch_lines_worst_case = _progfetch, \
835 .intr_underrun = DPU_IRQ_IDX(_reg, _underrun_bit), \
836 .intr_vsync = DPU_IRQ_IDX(_reg, _vsync_bit), \
839 static const struct dpu_intf_cfg sdm845_intf[] = {
840 INTF_BLK("intf_0", INTF_0, 0x6A000, INTF_DP, 0, 24, INTF_SDM845_MASK, MDP_SSPP_TOP0_INTR, 24, 25),
841 INTF_BLK("intf_1", INTF_1, 0x6A800, INTF_DSI, 0, 24, INTF_SDM845_MASK, MDP_SSPP_TOP0_INTR, 26, 27),
842 INTF_BLK("intf_2", INTF_2, 0x6B000, INTF_DSI, 1, 24, INTF_SDM845_MASK, MDP_SSPP_TOP0_INTR, 28, 29),
843 INTF_BLK("intf_3", INTF_3, 0x6B800, INTF_DP, 1, 24, INTF_SDM845_MASK, MDP_SSPP_TOP0_INTR, 30, 31),
846 static const struct dpu_intf_cfg sc7180_intf[] = {
847 INTF_BLK("intf_0", INTF_0, 0x6A000, INTF_DP, 0, 24, INTF_SC7180_MASK, MDP_SSPP_TOP0_INTR, 24, 25),
848 INTF_BLK("intf_1", INTF_1, 0x6A800, INTF_DSI, 0, 24, INTF_SC7180_MASK, MDP_SSPP_TOP0_INTR, 26, 27),
851 static const struct dpu_intf_cfg sm8150_intf[] = {
852 INTF_BLK("intf_0", INTF_0, 0x6A000, INTF_DP, 0, 24, INTF_SC7180_MASK, MDP_SSPP_TOP0_INTR, 24, 25),
853 INTF_BLK("intf_1", INTF_1, 0x6A800, INTF_DSI, 0, 24, INTF_SC7180_MASK, MDP_SSPP_TOP0_INTR, 26, 27),
854 INTF_BLK("intf_2", INTF_2, 0x6B000, INTF_DSI, 1, 24, INTF_SC7180_MASK, MDP_SSPP_TOP0_INTR, 28, 29),
855 INTF_BLK("intf_3", INTF_3, 0x6B800, INTF_DP, 1, 24, INTF_SC7180_MASK, MDP_SSPP_TOP0_INTR, 30, 31),
858 static const struct dpu_intf_cfg sc7280_intf[] = {
859 INTF_BLK("intf_0", INTF_0, 0x34000, INTF_DP, 0, 24, INTF_SC7280_MASK, MDP_SSPP_TOP0_INTR, 24, 25),
860 INTF_BLK("intf_1", INTF_1, 0x35000, INTF_DSI, 0, 24, INTF_SC7280_MASK, MDP_SSPP_TOP0_INTR, 26, 27),
861 INTF_BLK("intf_5", INTF_5, 0x39000, INTF_EDP, 0, 24, INTF_SC7280_MASK, MDP_SSPP_TOP0_INTR, 22, 23),
864 /*************************************************************
865 * VBIF sub blocks config
866 *************************************************************/
868 static const u32 sdm845_rt_pri_lvl[] = {3, 3, 4, 4, 5, 5, 6, 6};
869 static const u32 sdm845_nrt_pri_lvl[] = {3, 3, 3, 3, 3, 3, 3, 3};
871 static const struct dpu_vbif_cfg sdm845_vbif[] = {
873 .name = "vbif_0", .id = VBIF_0,
874 .base = 0, .len = 0x1040,
875 .features = BIT(DPU_VBIF_QOS_REMAP),
876 .xin_halt_timeout = 0x4000,
878 .npriority_lvl = ARRAY_SIZE(sdm845_rt_pri_lvl),
879 .priority_lvl = sdm845_rt_pri_lvl,
882 .npriority_lvl = ARRAY_SIZE(sdm845_nrt_pri_lvl),
883 .priority_lvl = sdm845_nrt_pri_lvl,
886 .memtype = {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3},
890 static const struct dpu_reg_dma_cfg sdm845_regdma = {
891 .base = 0x0, .version = 0x1, .trigger_sel_off = 0x119c
894 static const struct dpu_reg_dma_cfg sm8150_regdma = {
895 .base = 0x0, .version = 0x00010001, .trigger_sel_off = 0x119c
898 static const struct dpu_reg_dma_cfg sm8250_regdma = {
900 .version = 0x00010002,
901 .trigger_sel_off = 0x119c,
903 .clk_ctrl = DPU_CLK_CTRL_REG_DMA,
906 /*************************************************************
908 *************************************************************/
911 static const struct dpu_qos_lut_entry sdm845_qos_linear[] = {
912 {.fl = 4, .lut = 0x357},
913 {.fl = 5, .lut = 0x3357},
914 {.fl = 6, .lut = 0x23357},
915 {.fl = 7, .lut = 0x223357},
916 {.fl = 8, .lut = 0x2223357},
917 {.fl = 9, .lut = 0x22223357},
918 {.fl = 10, .lut = 0x222223357},
919 {.fl = 11, .lut = 0x2222223357},
920 {.fl = 12, .lut = 0x22222223357},
921 {.fl = 13, .lut = 0x222222223357},
922 {.fl = 14, .lut = 0x1222222223357},
923 {.fl = 0, .lut = 0x11222222223357}
926 static const struct dpu_qos_lut_entry sc7180_qos_linear[] = {
927 {.fl = 0, .lut = 0x0011222222335777},
930 static const struct dpu_qos_lut_entry sm8150_qos_linear[] = {
931 {.fl = 0, .lut = 0x0011222222223357 },
934 static const struct dpu_qos_lut_entry sdm845_qos_macrotile[] = {
935 {.fl = 10, .lut = 0x344556677},
936 {.fl = 11, .lut = 0x3344556677},
937 {.fl = 12, .lut = 0x23344556677},
938 {.fl = 13, .lut = 0x223344556677},
939 {.fl = 14, .lut = 0x1223344556677},
940 {.fl = 0, .lut = 0x112233344556677},
943 static const struct dpu_qos_lut_entry sc7180_qos_macrotile[] = {
944 {.fl = 0, .lut = 0x0011223344556677},
947 static const struct dpu_qos_lut_entry sdm845_qos_nrt[] = {
948 {.fl = 0, .lut = 0x0},
951 static const struct dpu_qos_lut_entry sc7180_qos_nrt[] = {
952 {.fl = 0, .lut = 0x0},
955 static const struct dpu_perf_cfg sdm845_perf_data = {
956 .max_bw_low = 6800000,
957 .max_bw_high = 6800000,
958 .min_core_ib = 2400000,
959 .min_llcc_ib = 800000,
960 .min_dram_ib = 800000,
962 .core_clk_ff = "1.0",
964 "NV12/5/1/1.23 AB24/5/1/1.23 XB24/5/1/1.23",
966 "NV12/5/1/1.25 AB24/5/1/1.25 XB24/5/1/1.25",
967 .undersized_prefill_lines = 2,
968 .xtra_prefill_lines = 2,
969 .dest_scale_prefill_lines = 3,
970 .macrotile_prefill_lines = 4,
971 .yuv_nv12_prefill_lines = 8,
972 .linear_prefill_lines = 1,
973 .downscaling_prefill_lines = 1,
974 .amortizable_threshold = 25,
975 .min_prefill_lines = 24,
976 .danger_lut_tbl = {0xf, 0xffff, 0x0},
978 {.nentry = ARRAY_SIZE(sdm845_qos_linear),
979 .entries = sdm845_qos_linear
981 {.nentry = ARRAY_SIZE(sdm845_qos_macrotile),
982 .entries = sdm845_qos_macrotile
984 {.nentry = ARRAY_SIZE(sdm845_qos_nrt),
985 .entries = sdm845_qos_nrt
989 {.rd_enable = 1, .wr_enable = 1},
990 {.rd_enable = 1, .wr_enable = 0}
992 .clk_inefficiency_factor = 105,
993 .bw_inefficiency_factor = 120,
996 static const struct dpu_perf_cfg sc7180_perf_data = {
997 .max_bw_low = 6800000,
998 .max_bw_high = 6800000,
999 .min_core_ib = 2400000,
1000 .min_llcc_ib = 800000,
1001 .min_dram_ib = 1600000,
1002 .min_prefill_lines = 24,
1003 .danger_lut_tbl = {0xff, 0xffff, 0x0},
1005 {.nentry = ARRAY_SIZE(sc7180_qos_linear),
1006 .entries = sc7180_qos_linear
1008 {.nentry = ARRAY_SIZE(sc7180_qos_macrotile),
1009 .entries = sc7180_qos_macrotile
1011 {.nentry = ARRAY_SIZE(sc7180_qos_nrt),
1012 .entries = sc7180_qos_nrt
1016 {.rd_enable = 1, .wr_enable = 1},
1017 {.rd_enable = 1, .wr_enable = 0}
1019 .clk_inefficiency_factor = 105,
1020 .bw_inefficiency_factor = 120,
1023 static const struct dpu_perf_cfg sm8150_perf_data = {
1024 .max_bw_low = 12800000,
1025 .max_bw_high = 12800000,
1026 .min_core_ib = 2400000,
1027 .min_llcc_ib = 800000,
1028 .min_dram_ib = 800000,
1029 .min_prefill_lines = 24,
1030 .danger_lut_tbl = {0xf, 0xffff, 0x0},
1032 {.nentry = ARRAY_SIZE(sm8150_qos_linear),
1033 .entries = sm8150_qos_linear
1035 {.nentry = ARRAY_SIZE(sc7180_qos_macrotile),
1036 .entries = sc7180_qos_macrotile
1038 {.nentry = ARRAY_SIZE(sc7180_qos_nrt),
1039 .entries = sc7180_qos_nrt
1041 /* TODO: macrotile-qseed is different from macrotile */
1044 {.rd_enable = 1, .wr_enable = 1},
1045 {.rd_enable = 1, .wr_enable = 0}
1047 .clk_inefficiency_factor = 105,
1048 .bw_inefficiency_factor = 120,
1051 static const struct dpu_perf_cfg sm8250_perf_data = {
1052 .max_bw_low = 13700000,
1053 .max_bw_high = 16600000,
1054 .min_core_ib = 4800000,
1056 .min_dram_ib = 800000,
1057 .min_prefill_lines = 35,
1058 .danger_lut_tbl = {0xf, 0xffff, 0x0},
1060 {.nentry = ARRAY_SIZE(sc7180_qos_linear),
1061 .entries = sc7180_qos_linear
1063 {.nentry = ARRAY_SIZE(sc7180_qos_macrotile),
1064 .entries = sc7180_qos_macrotile
1066 {.nentry = ARRAY_SIZE(sc7180_qos_nrt),
1067 .entries = sc7180_qos_nrt
1069 /* TODO: macrotile-qseed is different from macrotile */
1072 {.rd_enable = 1, .wr_enable = 1},
1073 {.rd_enable = 1, .wr_enable = 0}
1075 .clk_inefficiency_factor = 105,
1076 .bw_inefficiency_factor = 120,
1079 static const struct dpu_perf_cfg sc7280_perf_data = {
1080 .max_bw_low = 4700000,
1081 .max_bw_high = 8800000,
1082 .min_core_ib = 2500000,
1084 .min_dram_ib = 1600000,
1085 .min_prefill_lines = 24,
1086 .danger_lut_tbl = {0xffff, 0xffff, 0x0},
1088 {.nentry = ARRAY_SIZE(sc7180_qos_macrotile),
1089 .entries = sc7180_qos_macrotile
1091 {.nentry = ARRAY_SIZE(sc7180_qos_macrotile),
1092 .entries = sc7180_qos_macrotile
1094 {.nentry = ARRAY_SIZE(sc7180_qos_nrt),
1095 .entries = sc7180_qos_nrt
1099 {.rd_enable = 1, .wr_enable = 1},
1100 {.rd_enable = 1, .wr_enable = 0}
1102 .clk_inefficiency_factor = 105,
1103 .bw_inefficiency_factor = 120,
1106 /*************************************************************
1107 * Hardware catalog init
1108 *************************************************************/
1111 * sdm845_cfg_init(): populate sdm845 dpu sub-blocks reg offsets
1112 * and instance counts.
1114 static void sdm845_cfg_init(struct dpu_mdss_cfg *dpu_cfg)
1116 *dpu_cfg = (struct dpu_mdss_cfg){
1117 .caps = &sdm845_dpu_caps,
1118 .mdp_count = ARRAY_SIZE(sdm845_mdp),
1120 .ctl_count = ARRAY_SIZE(sdm845_ctl),
1122 .sspp_count = ARRAY_SIZE(sdm845_sspp),
1123 .sspp = sdm845_sspp,
1124 .mixer_count = ARRAY_SIZE(sdm845_lm),
1126 .pingpong_count = ARRAY_SIZE(sdm845_pp),
1127 .pingpong = sdm845_pp,
1128 .intf_count = ARRAY_SIZE(sdm845_intf),
1129 .intf = sdm845_intf,
1130 .vbif_count = ARRAY_SIZE(sdm845_vbif),
1131 .vbif = sdm845_vbif,
1133 .dma_cfg = sdm845_regdma,
1134 .perf = sdm845_perf_data,
1135 .mdss_irqs = IRQ_SDM845_MASK,
1140 * sc7180_cfg_init(): populate sc7180 dpu sub-blocks reg offsets
1141 * and instance counts.
1143 static void sc7180_cfg_init(struct dpu_mdss_cfg *dpu_cfg)
1145 *dpu_cfg = (struct dpu_mdss_cfg){
1146 .caps = &sc7180_dpu_caps,
1147 .mdp_count = ARRAY_SIZE(sc7180_mdp),
1149 .ctl_count = ARRAY_SIZE(sc7180_ctl),
1151 .sspp_count = ARRAY_SIZE(sc7180_sspp),
1152 .sspp = sc7180_sspp,
1153 .mixer_count = ARRAY_SIZE(sc7180_lm),
1155 .dspp_count = ARRAY_SIZE(sc7180_dspp),
1156 .dspp = sc7180_dspp,
1157 .pingpong_count = ARRAY_SIZE(sc7180_pp),
1158 .pingpong = sc7180_pp,
1159 .intf_count = ARRAY_SIZE(sc7180_intf),
1160 .intf = sc7180_intf,
1161 .vbif_count = ARRAY_SIZE(sdm845_vbif),
1162 .vbif = sdm845_vbif,
1164 .dma_cfg = sdm845_regdma,
1165 .perf = sc7180_perf_data,
1166 .mdss_irqs = IRQ_SC7180_MASK,
1171 * sm8150_cfg_init(): populate sm8150 dpu sub-blocks reg offsets
1172 * and instance counts.
1174 static void sm8150_cfg_init(struct dpu_mdss_cfg *dpu_cfg)
1176 *dpu_cfg = (struct dpu_mdss_cfg){
1177 .caps = &sm8150_dpu_caps,
1178 .mdp_count = ARRAY_SIZE(sdm845_mdp),
1180 .ctl_count = ARRAY_SIZE(sm8150_ctl),
1182 .sspp_count = ARRAY_SIZE(sdm845_sspp),
1183 .sspp = sdm845_sspp,
1184 .mixer_count = ARRAY_SIZE(sm8150_lm),
1186 .dspp_count = ARRAY_SIZE(sm8150_dspp),
1187 .dspp = sm8150_dspp,
1188 .pingpong_count = ARRAY_SIZE(sm8150_pp),
1189 .pingpong = sm8150_pp,
1190 .merge_3d_count = ARRAY_SIZE(sm8150_merge_3d),
1191 .merge_3d = sm8150_merge_3d,
1192 .intf_count = ARRAY_SIZE(sm8150_intf),
1193 .intf = sm8150_intf,
1194 .vbif_count = ARRAY_SIZE(sdm845_vbif),
1195 .vbif = sdm845_vbif,
1197 .dma_cfg = sm8150_regdma,
1198 .perf = sm8150_perf_data,
1199 .mdss_irqs = IRQ_SDM845_MASK,
1204 * sm8250_cfg_init(): populate sm8250 dpu sub-blocks reg offsets
1205 * and instance counts.
1207 static void sm8250_cfg_init(struct dpu_mdss_cfg *dpu_cfg)
1209 *dpu_cfg = (struct dpu_mdss_cfg){
1210 .caps = &sm8250_dpu_caps,
1211 .mdp_count = ARRAY_SIZE(sm8250_mdp),
1213 .ctl_count = ARRAY_SIZE(sm8150_ctl),
1215 .sspp_count = ARRAY_SIZE(sm8250_sspp),
1216 .sspp = sm8250_sspp,
1217 .mixer_count = ARRAY_SIZE(sm8150_lm),
1219 .dspp_count = ARRAY_SIZE(sm8150_dspp),
1220 .dspp = sm8150_dspp,
1221 .pingpong_count = ARRAY_SIZE(sm8150_pp),
1222 .pingpong = sm8150_pp,
1223 .merge_3d_count = ARRAY_SIZE(sm8150_merge_3d),
1224 .merge_3d = sm8150_merge_3d,
1225 .intf_count = ARRAY_SIZE(sm8150_intf),
1226 .intf = sm8150_intf,
1227 .vbif_count = ARRAY_SIZE(sdm845_vbif),
1228 .vbif = sdm845_vbif,
1230 .dma_cfg = sm8250_regdma,
1231 .perf = sm8250_perf_data,
1232 .mdss_irqs = IRQ_SM8250_MASK,
1236 static void sc7280_cfg_init(struct dpu_mdss_cfg *dpu_cfg)
1238 *dpu_cfg = (struct dpu_mdss_cfg){
1239 .caps = &sc7280_dpu_caps,
1240 .mdp_count = ARRAY_SIZE(sc7280_mdp),
1242 .ctl_count = ARRAY_SIZE(sc7280_ctl),
1244 .sspp_count = ARRAY_SIZE(sc7280_sspp),
1245 .sspp = sc7280_sspp,
1246 .mixer_count = ARRAY_SIZE(sc7280_lm),
1248 .pingpong_count = ARRAY_SIZE(sc7280_pp),
1249 .pingpong = sc7280_pp,
1250 .intf_count = ARRAY_SIZE(sc7280_intf),
1251 .intf = sc7280_intf,
1252 .vbif_count = ARRAY_SIZE(sdm845_vbif),
1253 .vbif = sdm845_vbif,
1254 .perf = sc7280_perf_data,
1255 .mdss_irqs = IRQ_SC7280_MASK,
1259 static const struct dpu_mdss_hw_cfg_handler cfg_handler[] = {
1260 { .hw_rev = DPU_HW_VER_400, .cfg_init = sdm845_cfg_init},
1261 { .hw_rev = DPU_HW_VER_401, .cfg_init = sdm845_cfg_init},
1262 { .hw_rev = DPU_HW_VER_500, .cfg_init = sm8150_cfg_init},
1263 { .hw_rev = DPU_HW_VER_501, .cfg_init = sm8150_cfg_init},
1264 { .hw_rev = DPU_HW_VER_600, .cfg_init = sm8250_cfg_init},
1265 { .hw_rev = DPU_HW_VER_620, .cfg_init = sc7180_cfg_init},
1266 { .hw_rev = DPU_HW_VER_720, .cfg_init = sc7280_cfg_init},
1269 void dpu_hw_catalog_deinit(struct dpu_mdss_cfg *dpu_cfg)
1274 struct dpu_mdss_cfg *dpu_hw_catalog_init(u32 hw_rev)
1277 struct dpu_mdss_cfg *dpu_cfg;
1279 dpu_cfg = kzalloc(sizeof(*dpu_cfg), GFP_KERNEL);
1281 return ERR_PTR(-ENOMEM);
1283 for (i = 0; i < ARRAY_SIZE(cfg_handler); i++) {
1284 if (cfg_handler[i].hw_rev == hw_rev) {
1285 cfg_handler[i].cfg_init(dpu_cfg);
1286 dpu_cfg->hwversion = hw_rev;
1291 DPU_ERROR("unsupported chipset id:%X\n", hw_rev);
1292 dpu_hw_catalog_deinit(dpu_cfg);
1293 return ERR_PTR(-ENODEV);