1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (c) 2022. Qualcomm Innovation Center, Inc. All rights reserved.
4  * Copyright (c) 2015-2018, 2020 The Linux Foundation. All rights reserved.
5  * Copyright (c) 2023, Linaro Limited
6  */
7 
8 #ifndef _DPU_6_4_SM6350_H
9 #define _DPU_6_4_SM6350_H
10 
11 static const struct dpu_caps sm6350_dpu_caps = {
12 	.max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
13 	.max_mixer_blendstages = 0x7,
14 	.has_src_split = true,
15 	.has_dim_layer = true,
16 	.has_idle_pc = true,
17 	.max_linewidth = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
18 	.pixel_ram_size = DEFAULT_PIXEL_RAM_SIZE,
19 };
20 
21 static const struct dpu_mdp_cfg sm6350_mdp = {
22 	.name = "top_0",
23 	.base = 0x0, .len = 0x494,
24 	.clk_ctrls = {
25 		[DPU_CLK_CTRL_VIG0] = { .reg_off = 0x2ac, .bit_off = 0 },
26 		[DPU_CLK_CTRL_DMA0] = { .reg_off = 0x2ac, .bit_off = 8 },
27 		[DPU_CLK_CTRL_DMA1] = { .reg_off = 0x2b4, .bit_off = 8 },
28 		[DPU_CLK_CTRL_DMA2] = { .reg_off = 0x2c4, .bit_off = 8 },
29 		[DPU_CLK_CTRL_WB2] = { .reg_off = 0x2bc, .bit_off = 16 },
30 		[DPU_CLK_CTRL_REG_DMA] = { .reg_off = 0x2bc, .bit_off = 20 },
31 	},
32 };
33 
34 static const struct dpu_ctl_cfg sm6350_ctl[] = {
35 	{
36 		.name = "ctl_0", .id = CTL_0,
37 		.base = 0x1000, .len = 0x1dc,
38 		.features = BIT(DPU_CTL_ACTIVE_CFG),
39 		.intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 9),
40 	}, {
41 		.name = "ctl_1", .id = CTL_1,
42 		.base = 0x1200, .len = 0x1dc,
43 		.features = BIT(DPU_CTL_ACTIVE_CFG),
44 		.intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 10),
45 	}, {
46 		.name = "ctl_2", .id = CTL_2,
47 		.base = 0x1400, .len = 0x1dc,
48 		.features = BIT(DPU_CTL_ACTIVE_CFG),
49 		.intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 11),
50 	}, {
51 		.name = "ctl_3", .id = CTL_3,
52 		.base = 0x1600, .len = 0x1dc,
53 		.features = BIT(DPU_CTL_ACTIVE_CFG),
54 		.intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 12),
55 	},
56 };
57 
58 static const struct dpu_sspp_cfg sm6350_sspp[] = {
59 	{
60 		.name = "sspp_0", .id = SSPP_VIG0,
61 		.base = 0x4000, .len = 0x1f8,
62 		.features = VIG_SDM845_MASK,
63 		.sblk = &dpu_vig_sblk_qseed3_3_0,
64 		.xin_id = 0,
65 		.type = SSPP_TYPE_VIG,
66 		.clk_ctrl = DPU_CLK_CTRL_VIG0,
67 	}, {
68 		.name = "sspp_8", .id = SSPP_DMA0,
69 		.base = 0x24000, .len = 0x1f8,
70 		.features = DMA_SDM845_MASK,
71 		.sblk = &dpu_dma_sblk,
72 		.xin_id = 1,
73 		.type = SSPP_TYPE_DMA,
74 		.clk_ctrl = DPU_CLK_CTRL_DMA0,
75 	}, {
76 		.name = "sspp_9", .id = SSPP_DMA1,
77 		.base = 0x26000, .len = 0x1f8,
78 		.features = DMA_CURSOR_SDM845_MASK,
79 		.sblk = &dpu_dma_sblk,
80 		.xin_id = 5,
81 		.type = SSPP_TYPE_DMA,
82 		.clk_ctrl = DPU_CLK_CTRL_DMA1,
83 	}, {
84 		.name = "sspp_10", .id = SSPP_DMA2,
85 		.base = 0x28000, .len = 0x1f8,
86 		.features = DMA_CURSOR_SDM845_MASK,
87 		.sblk = &dpu_dma_sblk,
88 		.xin_id = 9,
89 		.type = SSPP_TYPE_DMA,
90 		.clk_ctrl = DPU_CLK_CTRL_DMA2,
91 	},
92 };
93 
94 static const struct dpu_lm_cfg sm6350_lm[] = {
95 	{
96 		.name = "lm_0", .id = LM_0,
97 		.base = 0x44000, .len = 0x320,
98 		.features = MIXER_SDM845_MASK,
99 		.sblk = &sc7180_lm_sblk,
100 		.lm_pair = LM_1,
101 		.pingpong = PINGPONG_0,
102 		.dspp = DSPP_0,
103 	}, {
104 		.name = "lm_1", .id = LM_1,
105 		.base = 0x45000, .len = 0x320,
106 		.features = MIXER_SDM845_MASK,
107 		.sblk = &sc7180_lm_sblk,
108 		.lm_pair = LM_0,
109 		.pingpong = PINGPONG_1,
110 		.dspp = 0,
111 	},
112 };
113 
114 static const struct dpu_dspp_cfg sm6350_dspp[] = {
115 	{
116 		.name = "dspp_0", .id = DSPP_0,
117 		.base = 0x54000, .len = 0x1800,
118 		.features = DSPP_SC7180_MASK,
119 		.sblk = &sdm845_dspp_sblk,
120 	},
121 };
122 
123 static struct dpu_pingpong_cfg sm6350_pp[] = {
124 	{
125 		.name = "pingpong_0", .id = PINGPONG_0,
126 		.base = 0x70000, .len = 0xd4,
127 		.features = PINGPONG_SM8150_MASK,
128 		.sblk = &sdm845_pp_sblk,
129 		.merge_3d = 0,
130 		.intr_done = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 8),
131 	}, {
132 		.name = "pingpong_1", .id = PINGPONG_1,
133 		.base = 0x70800, .len = 0xd4,
134 		.features = PINGPONG_SM8150_MASK,
135 		.sblk = &sdm845_pp_sblk,
136 		.merge_3d = 0,
137 		.intr_done = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 9),
138 	},
139 };
140 
141 static const struct dpu_dsc_cfg sm6350_dsc[] = {
142 	{
143 		.name = "dsc_0", .id = DSC_0,
144 		.base = 0x80000, .len = 0x140,
145 		.features = BIT(DPU_DSC_OUTPUT_CTRL),
146 	},
147 };
148 
149 static const struct dpu_wb_cfg sm6350_wb[] = {
150 	{
151 		.name = "wb_2", .id = WB_2,
152 		.base = 0x65000, .len = 0x2c8,
153 		.features = WB_SM8250_MASK,
154 		.format_list = wb2_formats_rgb,
155 		.num_formats = ARRAY_SIZE(wb2_formats_rgb),
156 		.clk_ctrl = DPU_CLK_CTRL_WB2,
157 		.xin_id = 6,
158 		.vbif_idx = VBIF_RT,
159 		.maxlinewidth = 1920,
160 		.intr_wb_done = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 4),
161 	},
162 };
163 
164 static const struct dpu_intf_cfg sm6350_intf[] = {
165 	{
166 		.name = "intf_0", .id = INTF_0,
167 		.base = 0x6a000, .len = 0x280,
168 		.features = INTF_SC7180_MASK,
169 		.type = INTF_DP,
170 		.controller_id = MSM_DP_CONTROLLER_0,
171 		.prog_fetch_lines_worst_case = 35,
172 		.intr_underrun = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 24),
173 		.intr_vsync = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 25),
174 	}, {
175 		.name = "intf_1", .id = INTF_1,
176 		.base = 0x6a800, .len = 0x2c0,
177 		.features = INTF_SC7180_MASK,
178 		.type = INTF_DSI,
179 		.controller_id = MSM_DSI_CONTROLLER_0,
180 		.prog_fetch_lines_worst_case = 35,
181 		.intr_underrun = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 26),
182 		.intr_vsync = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 27),
183 		.intr_tear_rd_ptr = DPU_IRQ_IDX(MDP_INTF1_TEAR_INTR, 2),
184 	},
185 };
186 
187 static const struct dpu_perf_cfg sm6350_perf_data = {
188 	.max_bw_low = 4200000,
189 	.max_bw_high = 5100000,
190 	.min_core_ib = 2500000,
191 	.min_llcc_ib = 0,
192 	.min_dram_ib = 1600000,
193 	.min_prefill_lines = 35,
194 	/* TODO: confirm danger_lut_tbl */
195 	.danger_lut_tbl = {0xffff, 0xffff, 0x0},
196 	.safe_lut_tbl = {0xff00, 0xff00, 0xffff},
197 	.qos_lut_tbl = {
198 		{.nentry = ARRAY_SIZE(sm6350_qos_linear_macrotile),
199 		.entries = sm6350_qos_linear_macrotile
200 		},
201 		{.nentry = ARRAY_SIZE(sm6350_qos_linear_macrotile),
202 		.entries = sm6350_qos_linear_macrotile
203 		},
204 		{.nentry = ARRAY_SIZE(sc7180_qos_nrt),
205 		.entries = sc7180_qos_nrt
206 		},
207 	},
208 	.cdp_cfg = {
209 		{.rd_enable = 1, .wr_enable = 1},
210 		{.rd_enable = 1, .wr_enable = 0}
211 	},
212 	.clk_inefficiency_factor = 105,
213 	.bw_inefficiency_factor = 120,
214 };
215 
216 static const struct dpu_mdss_version sm6350_mdss_ver = {
217 	.core_major_ver = 6,
218 	.core_minor_ver = 4,
219 };
220 
221 const struct dpu_mdss_cfg dpu_sm6350_cfg = {
222 	.mdss_ver = &sm6350_mdss_ver,
223 	.caps = &sm6350_dpu_caps,
224 	.mdp = &sm6350_mdp,
225 	.ctl_count = ARRAY_SIZE(sm6350_ctl),
226 	.ctl = sm6350_ctl,
227 	.sspp_count = ARRAY_SIZE(sm6350_sspp),
228 	.sspp = sm6350_sspp,
229 	.mixer_count = ARRAY_SIZE(sm6350_lm),
230 	.mixer = sm6350_lm,
231 	.dspp_count = ARRAY_SIZE(sm6350_dspp),
232 	.dspp = sm6350_dspp,
233 	.dsc_count = ARRAY_SIZE(sm6350_dsc),
234 	.dsc = sm6350_dsc,
235 	.pingpong_count = ARRAY_SIZE(sm6350_pp),
236 	.pingpong = sm6350_pp,
237 	.wb_count = ARRAY_SIZE(sm6350_wb),
238 	.wb = sm6350_wb,
239 	.intf_count = ARRAY_SIZE(sm6350_intf),
240 	.intf = sm6350_intf,
241 	.vbif_count = ARRAY_SIZE(sdm845_vbif),
242 	.vbif = sdm845_vbif,
243 	.perf = &sm6350_perf_data,
244 };
245 
246 #endif
247