1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2015, The Linux Foundation. All rights reserved.
8 static const char * const dsi_v2_bus_clk_names[] = {
9 "core_mmss", "iface", "bus",
12 static const struct msm_dsi_config apq8064_dsi_cfg = {
17 {"vdda", 100000, 100}, /* 1.2 V */
18 {"avdd", 10000, 100}, /* 3.0 V */
19 {"vddio", 100000, 100}, /* 1.8 V */
22 .bus_clk_names = dsi_v2_bus_clk_names,
23 .num_bus_clks = ARRAY_SIZE(dsi_v2_bus_clk_names),
24 .io_start = { 0x4700000, 0x5800000 },
28 static const char * const dsi_6g_bus_clk_names[] = {
29 "mdp_core", "iface", "bus", "core_mmss",
32 static const struct msm_dsi_config msm8974_apq8084_dsi_cfg = {
33 .io_offset = DSI_6G_REG_SHIFT,
38 {"vdd", 150000, 100}, /* 3.0 V */
39 {"vdda", 100000, 100}, /* 1.2 V */
40 {"vddio", 100000, 100}, /* 1.8 V */
43 .bus_clk_names = dsi_6g_bus_clk_names,
44 .num_bus_clks = ARRAY_SIZE(dsi_6g_bus_clk_names),
45 .io_start = { 0xfd922800, 0xfd922b00 },
49 static const char * const dsi_8916_bus_clk_names[] = {
50 "mdp_core", "iface", "bus",
53 static const struct msm_dsi_config msm8916_dsi_cfg = {
54 .io_offset = DSI_6G_REG_SHIFT,
59 {"vdda", 100000, 100}, /* 1.2 V */
60 {"vddio", 100000, 100}, /* 1.8 V */
63 .bus_clk_names = dsi_8916_bus_clk_names,
64 .num_bus_clks = ARRAY_SIZE(dsi_8916_bus_clk_names),
65 .io_start = { 0x1a98000 },
69 static const char * const dsi_8976_bus_clk_names[] = {
70 "mdp_core", "iface", "bus",
73 static const struct msm_dsi_config msm8976_dsi_cfg = {
74 .io_offset = DSI_6G_REG_SHIFT,
79 {"vdda", 100000, 100}, /* 1.2 V */
80 {"vddio", 100000, 100}, /* 1.8 V */
83 .bus_clk_names = dsi_8976_bus_clk_names,
84 .num_bus_clks = ARRAY_SIZE(dsi_8976_bus_clk_names),
85 .io_start = { 0x1a94000, 0x1a96000 },
89 static const struct msm_dsi_config msm8994_dsi_cfg = {
90 .io_offset = DSI_6G_REG_SHIFT,
95 {"vdda", 100000, 100}, /* 1.25 V */
96 {"vddio", 100000, 100}, /* 1.8 V */
97 {"vcca", 10000, 100}, /* 1.0 V */
98 {"vdd", 100000, 100}, /* 1.8 V */
103 .bus_clk_names = dsi_6g_bus_clk_names,
104 .num_bus_clks = ARRAY_SIZE(dsi_6g_bus_clk_names),
105 .io_start = { 0xfd998000, 0xfd9a0000 },
109 static const char * const dsi_8996_bus_clk_names[] = {
110 "mdp_core", "iface", "bus", "core_mmss",
113 static const struct msm_dsi_config msm8996_dsi_cfg = {
114 .io_offset = DSI_6G_REG_SHIFT,
118 {"vdda", 18160, 1 }, /* 1.25 V */
119 {"vcca", 17000, 32 }, /* 0.925 V */
120 {"vddio", 100000, 100 },/* 1.8 V */
123 .bus_clk_names = dsi_8996_bus_clk_names,
124 .num_bus_clks = ARRAY_SIZE(dsi_8996_bus_clk_names),
125 .io_start = { 0x994000, 0x996000 },
129 static const char * const dsi_msm8998_bus_clk_names[] = {
130 "iface", "bus", "core",
133 static const struct msm_dsi_config msm8998_dsi_cfg = {
134 .io_offset = DSI_6G_REG_SHIFT,
138 {"vdd", 367000, 16 }, /* 0.9 V */
139 {"vdda", 62800, 2 }, /* 1.2 V */
142 .bus_clk_names = dsi_msm8998_bus_clk_names,
143 .num_bus_clks = ARRAY_SIZE(dsi_msm8998_bus_clk_names),
144 .io_start = { 0xc994000, 0xc996000 },
148 static const char * const dsi_sdm660_bus_clk_names[] = {
149 "iface", "bus", "core", "core_mmss",
152 static const struct msm_dsi_config sdm660_dsi_cfg = {
153 .io_offset = DSI_6G_REG_SHIFT,
157 {"vdd", 73400, 32 }, /* 0.9 V */
158 {"vdda", 12560, 4 }, /* 1.2 V */
161 .bus_clk_names = dsi_sdm660_bus_clk_names,
162 .num_bus_clks = ARRAY_SIZE(dsi_sdm660_bus_clk_names),
163 .io_start = { 0xc994000, 0xc996000 },
167 static const char * const dsi_sdm845_bus_clk_names[] = {
171 static const char * const dsi_sc7180_bus_clk_names[] = {
175 static const struct msm_dsi_config sdm845_dsi_cfg = {
176 .io_offset = DSI_6G_REG_SHIFT,
180 {"vdda", 21800, 4 }, /* 1.2 V */
183 .bus_clk_names = dsi_sdm845_bus_clk_names,
184 .num_bus_clks = ARRAY_SIZE(dsi_sdm845_bus_clk_names),
185 .io_start = { 0xae94000, 0xae96000 },
189 static const struct msm_dsi_config sc7180_dsi_cfg = {
190 .io_offset = DSI_6G_REG_SHIFT,
194 {"vdda", 21800, 4 }, /* 1.2 V */
197 .bus_clk_names = dsi_sc7180_bus_clk_names,
198 .num_bus_clks = ARRAY_SIZE(dsi_sc7180_bus_clk_names),
199 .io_start = { 0xae94000 },
203 static const struct msm_dsi_host_cfg_ops msm_dsi_v2_host_ops = {
204 .link_clk_set_rate = dsi_link_clk_set_rate_v2,
205 .link_clk_enable = dsi_link_clk_enable_v2,
206 .link_clk_disable = dsi_link_clk_disable_v2,
207 .clk_init_ver = dsi_clk_init_v2,
208 .tx_buf_alloc = dsi_tx_buf_alloc_v2,
209 .tx_buf_get = dsi_tx_buf_get_v2,
211 .dma_base_get = dsi_dma_base_get_v2,
212 .calc_clk_rate = dsi_calc_clk_rate_v2,
215 static const struct msm_dsi_host_cfg_ops msm_dsi_6g_host_ops = {
216 .link_clk_set_rate = dsi_link_clk_set_rate_6g,
217 .link_clk_enable = dsi_link_clk_enable_6g,
218 .link_clk_disable = dsi_link_clk_disable_6g,
219 .clk_init_ver = NULL,
220 .tx_buf_alloc = dsi_tx_buf_alloc_6g,
221 .tx_buf_get = dsi_tx_buf_get_6g,
222 .tx_buf_put = dsi_tx_buf_put_6g,
223 .dma_base_get = dsi_dma_base_get_6g,
224 .calc_clk_rate = dsi_calc_clk_rate_6g,
227 static const struct msm_dsi_host_cfg_ops msm_dsi_6g_v2_host_ops = {
228 .link_clk_set_rate = dsi_link_clk_set_rate_6g,
229 .link_clk_enable = dsi_link_clk_enable_6g,
230 .link_clk_disable = dsi_link_clk_disable_6g,
231 .clk_init_ver = dsi_clk_init_6g_v2,
232 .tx_buf_alloc = dsi_tx_buf_alloc_6g,
233 .tx_buf_get = dsi_tx_buf_get_6g,
234 .tx_buf_put = dsi_tx_buf_put_6g,
235 .dma_base_get = dsi_dma_base_get_6g,
236 .calc_clk_rate = dsi_calc_clk_rate_6g,
239 static const struct msm_dsi_cfg_handler dsi_cfg_handlers[] = {
240 {MSM_DSI_VER_MAJOR_V2, MSM_DSI_V2_VER_MINOR_8064,
241 &apq8064_dsi_cfg, &msm_dsi_v2_host_ops},
242 {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_0,
243 &msm8974_apq8084_dsi_cfg, &msm_dsi_6g_host_ops},
244 {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_1,
245 &msm8974_apq8084_dsi_cfg, &msm_dsi_6g_host_ops},
246 {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_1_1,
247 &msm8974_apq8084_dsi_cfg, &msm_dsi_6g_host_ops},
248 {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_2,
249 &msm8974_apq8084_dsi_cfg, &msm_dsi_6g_host_ops},
250 {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_3,
251 &msm8994_dsi_cfg, &msm_dsi_6g_host_ops},
252 {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_3_1,
253 &msm8916_dsi_cfg, &msm_dsi_6g_host_ops},
254 {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_4_1,
255 &msm8996_dsi_cfg, &msm_dsi_6g_host_ops},
256 {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_4_2,
257 &msm8976_dsi_cfg, &msm_dsi_6g_host_ops},
258 {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_1_0,
259 &sdm660_dsi_cfg, &msm_dsi_6g_v2_host_ops},
260 {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_2_0,
261 &msm8998_dsi_cfg, &msm_dsi_6g_v2_host_ops},
262 {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_2_1,
263 &sdm845_dsi_cfg, &msm_dsi_6g_v2_host_ops},
264 {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_3_0,
265 &sdm845_dsi_cfg, &msm_dsi_6g_v2_host_ops},
266 {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_4_0,
267 &sdm845_dsi_cfg, &msm_dsi_6g_v2_host_ops},
268 {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_4_1,
269 &sc7180_dsi_cfg, &msm_dsi_6g_v2_host_ops},
272 const struct msm_dsi_cfg_handler *msm_dsi_cfg_get(u32 major, u32 minor)
274 const struct msm_dsi_cfg_handler *cfg_hnd = NULL;
277 for (i = ARRAY_SIZE(dsi_cfg_handlers) - 1; i >= 0; i--) {
278 if ((dsi_cfg_handlers[i].major == major) &&
279 (dsi_cfg_handlers[i].minor == minor)) {
280 cfg_hnd = &dsi_cfg_handlers[i];