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 },
110 * TODO: core_mmss_clk fails to enable for some reason, but things work fine
111 * without it too. Figure out why it doesn't enable and uncomment below
113 static const char * const dsi_8996_bus_clk_names
[] = {
114 "mdp_core", "iface", "bus", /* "core_mmss", */
117 static const struct msm_dsi_config msm8996_dsi_cfg
= {
118 .io_offset
= DSI_6G_REG_SHIFT
,
122 {"vdda", 18160, 1 }, /* 1.25 V */
123 {"vcca", 17000, 32 }, /* 0.925 V */
124 {"vddio", 100000, 100 },/* 1.8 V */
127 .bus_clk_names
= dsi_8996_bus_clk_names
,
128 .num_bus_clks
= ARRAY_SIZE(dsi_8996_bus_clk_names
),
129 .io_start
= { 0x994000, 0x996000 },
133 static const char * const dsi_msm8998_bus_clk_names
[] = {
134 "iface", "bus", "core",
137 static const struct msm_dsi_config msm8998_dsi_cfg
= {
138 .io_offset
= DSI_6G_REG_SHIFT
,
142 {"vdd", 367000, 16 }, /* 0.9 V */
143 {"vdda", 62800, 2 }, /* 1.2 V */
146 .bus_clk_names
= dsi_msm8998_bus_clk_names
,
147 .num_bus_clks
= ARRAY_SIZE(dsi_msm8998_bus_clk_names
),
148 .io_start
= { 0xc994000, 0xc996000 },
152 static const char * const dsi_sdm845_bus_clk_names
[] = {
156 static const char * const dsi_sc7180_bus_clk_names
[] = {
160 static const struct msm_dsi_config sdm845_dsi_cfg
= {
161 .io_offset
= DSI_6G_REG_SHIFT
,
165 {"vdda", 21800, 4 }, /* 1.2 V */
168 .bus_clk_names
= dsi_sdm845_bus_clk_names
,
169 .num_bus_clks
= ARRAY_SIZE(dsi_sdm845_bus_clk_names
),
170 .io_start
= { 0xae94000, 0xae96000 },
174 static const struct msm_dsi_config sc7180_dsi_cfg
= {
175 .io_offset
= DSI_6G_REG_SHIFT
,
179 {"vdda", 21800, 4 }, /* 1.2 V */
182 .bus_clk_names
= dsi_sc7180_bus_clk_names
,
183 .num_bus_clks
= ARRAY_SIZE(dsi_sc7180_bus_clk_names
),
184 .io_start
= { 0xae94000 },
188 static const struct msm_dsi_host_cfg_ops msm_dsi_v2_host_ops
= {
189 .link_clk_set_rate
= dsi_link_clk_set_rate_v2
,
190 .link_clk_enable
= dsi_link_clk_enable_v2
,
191 .link_clk_disable
= dsi_link_clk_disable_v2
,
192 .clk_init_ver
= dsi_clk_init_v2
,
193 .tx_buf_alloc
= dsi_tx_buf_alloc_v2
,
194 .tx_buf_get
= dsi_tx_buf_get_v2
,
196 .dma_base_get
= dsi_dma_base_get_v2
,
197 .calc_clk_rate
= dsi_calc_clk_rate_v2
,
200 static const struct msm_dsi_host_cfg_ops msm_dsi_6g_host_ops
= {
201 .link_clk_set_rate
= dsi_link_clk_set_rate_6g
,
202 .link_clk_enable
= dsi_link_clk_enable_6g
,
203 .link_clk_disable
= dsi_link_clk_disable_6g
,
204 .clk_init_ver
= NULL
,
205 .tx_buf_alloc
= dsi_tx_buf_alloc_6g
,
206 .tx_buf_get
= dsi_tx_buf_get_6g
,
207 .tx_buf_put
= dsi_tx_buf_put_6g
,
208 .dma_base_get
= dsi_dma_base_get_6g
,
209 .calc_clk_rate
= dsi_calc_clk_rate_6g
,
212 static const struct msm_dsi_host_cfg_ops msm_dsi_6g_v2_host_ops
= {
213 .link_clk_set_rate
= dsi_link_clk_set_rate_6g
,
214 .link_clk_enable
= dsi_link_clk_enable_6g
,
215 .link_clk_disable
= dsi_link_clk_disable_6g
,
216 .clk_init_ver
= dsi_clk_init_6g_v2
,
217 .tx_buf_alloc
= dsi_tx_buf_alloc_6g
,
218 .tx_buf_get
= dsi_tx_buf_get_6g
,
219 .tx_buf_put
= dsi_tx_buf_put_6g
,
220 .dma_base_get
= dsi_dma_base_get_6g
,
221 .calc_clk_rate
= dsi_calc_clk_rate_6g
,
224 static const struct msm_dsi_cfg_handler dsi_cfg_handlers
[] = {
225 {MSM_DSI_VER_MAJOR_V2
, MSM_DSI_V2_VER_MINOR_8064
,
226 &apq8064_dsi_cfg
, &msm_dsi_v2_host_ops
},
227 {MSM_DSI_VER_MAJOR_6G
, MSM_DSI_6G_VER_MINOR_V1_0
,
228 &msm8974_apq8084_dsi_cfg
, &msm_dsi_6g_host_ops
},
229 {MSM_DSI_VER_MAJOR_6G
, MSM_DSI_6G_VER_MINOR_V1_1
,
230 &msm8974_apq8084_dsi_cfg
, &msm_dsi_6g_host_ops
},
231 {MSM_DSI_VER_MAJOR_6G
, MSM_DSI_6G_VER_MINOR_V1_1_1
,
232 &msm8974_apq8084_dsi_cfg
, &msm_dsi_6g_host_ops
},
233 {MSM_DSI_VER_MAJOR_6G
, MSM_DSI_6G_VER_MINOR_V1_2
,
234 &msm8974_apq8084_dsi_cfg
, &msm_dsi_6g_host_ops
},
235 {MSM_DSI_VER_MAJOR_6G
, MSM_DSI_6G_VER_MINOR_V1_3
,
236 &msm8994_dsi_cfg
, &msm_dsi_6g_host_ops
},
237 {MSM_DSI_VER_MAJOR_6G
, MSM_DSI_6G_VER_MINOR_V1_3_1
,
238 &msm8916_dsi_cfg
, &msm_dsi_6g_host_ops
},
239 {MSM_DSI_VER_MAJOR_6G
, MSM_DSI_6G_VER_MINOR_V1_4_1
,
240 &msm8996_dsi_cfg
, &msm_dsi_6g_host_ops
},
241 {MSM_DSI_VER_MAJOR_6G
, MSM_DSI_6G_VER_MINOR_V1_4_2
,
242 &msm8976_dsi_cfg
, &msm_dsi_6g_host_ops
},
243 {MSM_DSI_VER_MAJOR_6G
, MSM_DSI_6G_VER_MINOR_V2_2_0
,
244 &msm8998_dsi_cfg
, &msm_dsi_6g_v2_host_ops
},
245 {MSM_DSI_VER_MAJOR_6G
, MSM_DSI_6G_VER_MINOR_V2_2_1
,
246 &sdm845_dsi_cfg
, &msm_dsi_6g_v2_host_ops
},
247 {MSM_DSI_VER_MAJOR_6G
, MSM_DSI_6G_VER_MINOR_V2_4_1
,
248 &sc7180_dsi_cfg
, &msm_dsi_6g_v2_host_ops
},
252 const struct msm_dsi_cfg_handler
*msm_dsi_cfg_get(u32 major
, u32 minor
)
254 const struct msm_dsi_cfg_handler
*cfg_hnd
= NULL
;
257 for (i
= ARRAY_SIZE(dsi_cfg_handlers
) - 1; i
>= 0; i
--) {
258 if ((dsi_cfg_handlers
[i
].major
== major
) &&
259 (dsi_cfg_handlers
[i
].minor
== minor
)) {
260 cfg_hnd
= &dsi_cfg_handlers
[i
];