summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/msm/dsi/dsi_cfg.c
blob: e0bd452a9f1e69c01f636a698e2a404cc0df62f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2015, The Linux Foundation. All rights reserved.
 */

#include "dsi_cfg.h"

static const char * const dsi_v2_bus_clk_names[] = {
	"core_mmss", "iface", "bus",
};

static const struct regulator_bulk_data apq8064_dsi_regulators[] = {
	{ .supply = "vdda", .init_load_uA = 100000 },	/* 1.2 V */
	{ .supply = "avdd", .init_load_uA = 10000 },	/* 3.0 V */
	{ .supply = "vddio", .init_load_uA = 100000 },	/* 1.8 V */
};

static const struct msm_dsi_config apq8064_dsi_cfg = {
	.io_offset = 0,
	.regulator_data = apq8064_dsi_regulators,
	.num_regulators = ARRAY_SIZE(apq8064_dsi_regulators),
	.bus_clk_names = dsi_v2_bus_clk_names,
	.num_bus_clks = ARRAY_SIZE(dsi_v2_bus_clk_names),
	.io_start = { 0x4700000, 0x5800000 },
	.num_dsi = 2,
};

static const char * const dsi_6g_bus_clk_names[] = {
	"mdp_core", "iface", "bus", "core_mmss",
};

static const struct regulator_bulk_data msm8974_apq8084_regulators[] = {
	{ .supply = "vdd", .init_load_uA = 150000 },	/* 3.0 V */
	{ .supply = "vdda", .init_load_uA = 100000 },	/* 1.2 V */
	{ .supply = "vddio", .init_load_uA = 100000 },	/* 1.8 V */
};

static const struct msm_dsi_config msm8974_apq8084_dsi_cfg = {
	.io_offset = DSI_6G_REG_SHIFT,
	.regulator_data = msm8974_apq8084_regulators,
	.num_regulators = ARRAY_SIZE(msm8974_apq8084_regulators),
	.bus_clk_names = dsi_6g_bus_clk_names,
	.num_bus_clks = ARRAY_SIZE(dsi_6g_bus_clk_names),
	.io_start = { 0xfd922800, 0xfd922b00 },
	.num_dsi = 2,
};

static const char * const dsi_8916_bus_clk_names[] = {
	"mdp_core", "iface", "bus",
};

static const struct regulator_bulk_data msm8916_dsi_regulators[] = {
	{ .supply = "vdda", .init_load_uA = 100000 },	/* 1.2 V */
	{ .supply = "vddio", .init_load_uA = 100000 },	/* 1.8 V */
};

static const struct msm_dsi_config msm8916_dsi_cfg = {
	.io_offset = DSI_6G_REG_SHIFT,
	.regulator_data = msm8916_dsi_regulators,
	.num_regulators = ARRAY_SIZE(msm8916_dsi_regulators),
	.bus_clk_names = dsi_8916_bus_clk_names,
	.num_bus_clks = ARRAY_SIZE(dsi_8916_bus_clk_names),
	.io_start = { 0x1a98000 },
	.num_dsi = 1,
};

static const char * const dsi_8976_bus_clk_names[] = {
	"mdp_core", "iface", "bus",
};

static const struct regulator_bulk_data msm8976_dsi_regulators[] = {
	{ .supply = "vdda", .init_load_uA = 100000 },	/* 1.2 V */
	{ .supply = "vddio", .init_load_uA = 100000 },	/* 1.8 V */
};

static const struct msm_dsi_config msm8976_dsi_cfg = {
	.io_offset = DSI_6G_REG_SHIFT,
	.regulator_data = msm8976_dsi_regulators,
	.num_regulators = ARRAY_SIZE(msm8976_dsi_regulators),
	.bus_clk_names = dsi_8976_bus_clk_names,
	.num_bus_clks = ARRAY_SIZE(dsi_8976_bus_clk_names),
	.io_start = { 0x1a94000, 0x1a96000 },
	.num_dsi = 2,
};

static const struct regulator_bulk_data msm8994_dsi_regulators[] = {
	{ .supply = "vdda", .init_load_uA = 100000 },	/* 1.25 V */
	{ .supply = "vddio", .init_load_uA = 100000 },	/* 1.8 V */
	{ .supply = "vcca", .init_load_uA = 10000 },	/* 1.0 V */
	{ .supply = "vdd", .init_load_uA = 100000 },	/* 1.8 V */
	{ .supply = "lab_reg", .init_load_uA = -1 },
	{ .supply = "ibb_reg", .init_load_uA = -1 },
};

static const struct msm_dsi_config msm8994_dsi_cfg = {
	.io_offset = DSI_6G_REG_SHIFT,
	.regulator_data = msm8994_dsi_regulators,
	.num_regulators = ARRAY_SIZE(msm8994_dsi_regulators),
	.bus_clk_names = dsi_6g_bus_clk_names,
	.num_bus_clks = ARRAY_SIZE(dsi_6g_bus_clk_names),
	.io_start = { 0xfd998000, 0xfd9a0000 },
	.num_dsi = 2,
};

static const char * const dsi_8996_bus_clk_names[] = {
	"mdp_core", "iface", "bus", "core_mmss",
};

static const struct regulator_bulk_data msm8996_dsi_regulators[] = {
	{ .supply = "vdda", .init_load_uA = 18160 },	/* 1.25 V */
	{ .supply = "vcca", .init_load_uA = 17000 },	/* 0.925 V */
	{ .supply = "vddio", .init_load_uA = 100000 },	/* 1.8 V */
};

static const struct msm_dsi_config msm8996_dsi_cfg = {
	.io_offset = DSI_6G_REG_SHIFT,
	.regulator_data = msm8996_dsi_regulators,
	.num_regulators = ARRAY_SIZE(msm8996_dsi_regulators),
	.bus_clk_names = dsi_8996_bus_clk_names,
	.num_bus_clks = ARRAY_SIZE(dsi_8996_bus_clk_names),
	.io_start = { 0x994000, 0x996000 },
	.num_dsi = 2,
};

static const char * const dsi_msm8998_bus_clk_names[] = {
	"iface", "bus", "core",
};

static const struct regulator_bulk_data msm8998_dsi_regulators[] = {
	{ .supply = "vdd", .init_load_uA = 367000 },	/* 0.9 V */
	{ .supply = "vdda", .init_load_uA = 62800 },	/* 1.2 V */
};

static const struct msm_dsi_config msm8998_dsi_cfg = {
	.io_offset = DSI_6G_REG_SHIFT,
	.regulator_data = msm8998_dsi_regulators,
	.num_regulators = ARRAY_SIZE(msm8998_dsi_regulators),
	.bus_clk_names = dsi_msm8998_bus_clk_names,
	.num_bus_clks = ARRAY_SIZE(dsi_msm8998_bus_clk_names),
	.io_start = { 0xc994000, 0xc996000 },
	.num_dsi = 2,
};

static const char * const dsi_sdm660_bus_clk_names[] = {
	"iface", "bus", "core", "core_mmss",
};

static const struct regulator_bulk_data sdm660_dsi_regulators[] = {
	{ .supply = "vdda", .init_load_uA = 12560 },	/* 1.2 V */
};

static const struct msm_dsi_config sdm660_dsi_cfg = {
	.io_offset = DSI_6G_REG_SHIFT,
	.regulator_data = sdm660_dsi_regulators,
	.num_regulators = ARRAY_SIZE(sdm660_dsi_regulators),
	.bus_clk_names = dsi_sdm660_bus_clk_names,
	.num_bus_clks = ARRAY_SIZE(dsi_sdm660_bus_clk_names),
	.io_start = { 0xc994000, 0xc996000 },
	.num_dsi = 2,
};

static const char * const dsi_sdm845_bus_clk_names[] = {
	"iface", "bus",
};

static const char * const dsi_sc7180_bus_clk_names[] = {
	"iface", "bus",
};

static const struct regulator_bulk_data sdm845_dsi_regulators[] = {
	{ .supply = "vdda", .init_load_uA = 21800 },	/* 1.2 V */
};

static const struct msm_dsi_config sdm845_dsi_cfg = {
	.io_offset = DSI_6G_REG_SHIFT,
	.regulator_data = sdm845_dsi_regulators,
	.num_regulators = ARRAY_SIZE(sdm845_dsi_regulators),
	.bus_clk_names = dsi_sdm845_bus_clk_names,
	.num_bus_clks = ARRAY_SIZE(dsi_sdm845_bus_clk_names),
	.io_start = { 0xae94000, 0xae96000 },
	.num_dsi = 2,
};

static const struct regulator_bulk_data sc7180_dsi_regulators[] = {
	{ .supply = "vdda", .init_load_uA = 21800 },	/* 1.2 V */
};

static const struct msm_dsi_config sc7180_dsi_cfg = {
	.io_offset = DSI_6G_REG_SHIFT,
	.regulator_data = sc7180_dsi_regulators,
	.num_regulators = ARRAY_SIZE(sc7180_dsi_regulators),
	.bus_clk_names = dsi_sc7180_bus_clk_names,
	.num_bus_clks = ARRAY_SIZE(dsi_sc7180_bus_clk_names),
	.io_start = { 0xae94000 },
	.num_dsi = 1,
};

static const char * const dsi_sc7280_bus_clk_names[] = {
	"iface", "bus",
};

static const struct regulator_bulk_data sc7280_dsi_regulators[] = {
	{ .supply = "vdda", .init_load_uA = 8350 },	/* 1.2 V */
};

static const struct msm_dsi_config sc7280_dsi_cfg = {
	.io_offset = DSI_6G_REG_SHIFT,
	.regulator_data = sc7280_dsi_regulators,
	.num_regulators = ARRAY_SIZE(sc7280_dsi_regulators),
	.bus_clk_names = dsi_sc7280_bus_clk_names,
	.num_bus_clks = ARRAY_SIZE(dsi_sc7280_bus_clk_names),
	.io_start = { 0xae94000, 0xae96000 },
	.num_dsi = 2,
};

static const char * const dsi_qcm2290_bus_clk_names[] = {
	"iface", "bus",
};

static const struct regulator_bulk_data qcm2290_dsi_cfg_regulators[] = {
	{ .supply = "vdda", .init_load_uA = 21800 },	/* 1.2 V */
};

static const struct msm_dsi_config qcm2290_dsi_cfg = {
	.io_offset = DSI_6G_REG_SHIFT,
	.regulator_data = qcm2290_dsi_cfg_regulators,
	.num_regulators = ARRAY_SIZE(qcm2290_dsi_cfg_regulators),
	.bus_clk_names = dsi_qcm2290_bus_clk_names,
	.num_bus_clks = ARRAY_SIZE(dsi_qcm2290_bus_clk_names),
	.io_start = { 0x5e94000 },
	.num_dsi = 1,
};

static const struct msm_dsi_host_cfg_ops msm_dsi_v2_host_ops = {
	.link_clk_set_rate = dsi_link_clk_set_rate_v2,
	.link_clk_enable = dsi_link_clk_enable_v2,
	.link_clk_disable = dsi_link_clk_disable_v2,
	.clk_init_ver = dsi_clk_init_v2,
	.tx_buf_alloc = dsi_tx_buf_alloc_v2,
	.tx_buf_get = dsi_tx_buf_get_v2,
	.tx_buf_put = NULL,
	.dma_base_get = dsi_dma_base_get_v2,
	.calc_clk_rate = dsi_calc_clk_rate_v2,
};

static const struct msm_dsi_host_cfg_ops msm_dsi_6g_host_ops = {
	.link_clk_set_rate = dsi_link_clk_set_rate_6g,
	.link_clk_enable = dsi_link_clk_enable_6g,
	.link_clk_disable = dsi_link_clk_disable_6g,
	.clk_init_ver = NULL,
	.tx_buf_alloc = dsi_tx_buf_alloc_6g,
	.tx_buf_get = dsi_tx_buf_get_6g,
	.tx_buf_put = dsi_tx_buf_put_6g,
	.dma_base_get = dsi_dma_base_get_6g,
	.calc_clk_rate = dsi_calc_clk_rate_6g,
};

static const struct msm_dsi_host_cfg_ops msm_dsi_6g_v2_host_ops = {
	.link_clk_set_rate = dsi_link_clk_set_rate_6g,
	.link_clk_enable = dsi_link_clk_enable_6g,
	.link_clk_disable = dsi_link_clk_disable_6g,
	.clk_init_ver = dsi_clk_init_6g_v2,
	.tx_buf_alloc = dsi_tx_buf_alloc_6g,
	.tx_buf_get = dsi_tx_buf_get_6g,
	.tx_buf_put = dsi_tx_buf_put_6g,
	.dma_base_get = dsi_dma_base_get_6g,
	.calc_clk_rate = dsi_calc_clk_rate_6g,
};

static const struct msm_dsi_cfg_handler dsi_cfg_handlers[] = {
	{MSM_DSI_VER_MAJOR_V2, MSM_DSI_V2_VER_MINOR_8064,
		&apq8064_dsi_cfg, &msm_dsi_v2_host_ops},
	{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_0,
		&msm8974_apq8084_dsi_cfg, &msm_dsi_6g_host_ops},
	{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_1,
		&msm8974_apq8084_dsi_cfg, &msm_dsi_6g_host_ops},
	{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_1_1,
		&msm8974_apq8084_dsi_cfg, &msm_dsi_6g_host_ops},
	{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_2,
		&msm8974_apq8084_dsi_cfg, &msm_dsi_6g_host_ops},
	{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_3,
		&msm8994_dsi_cfg, &msm_dsi_6g_host_ops},
	{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_3_1,
		&msm8916_dsi_cfg, &msm_dsi_6g_host_ops},
	{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_4_1,
		&msm8996_dsi_cfg, &msm_dsi_6g_host_ops},
	{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_4_2,
		&msm8976_dsi_cfg, &msm_dsi_6g_host_ops},
	{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_1_0,
		&sdm660_dsi_cfg, &msm_dsi_6g_v2_host_ops},
	{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_2_0,
		&msm8998_dsi_cfg, &msm_dsi_6g_v2_host_ops},
	{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_2_1,
		&sdm845_dsi_cfg, &msm_dsi_6g_v2_host_ops},
	{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_3_0,
		&sdm845_dsi_cfg, &msm_dsi_6g_v2_host_ops},
	{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_4_0,
		&sdm845_dsi_cfg, &msm_dsi_6g_v2_host_ops},
	{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_4_1,
		&sc7180_dsi_cfg, &msm_dsi_6g_v2_host_ops},
	{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_5_0,
		&sc7280_dsi_cfg, &msm_dsi_6g_v2_host_ops},
};

const struct msm_dsi_cfg_handler *msm_dsi_cfg_get(u32 major, u32 minor)
{
	const struct msm_dsi_cfg_handler *cfg_hnd = NULL;
	int i;

	for (i = ARRAY_SIZE(dsi_cfg_handlers) - 1; i >= 0; i--) {
		if ((dsi_cfg_handlers[i].major == major) &&
			(dsi_cfg_handlers[i].minor == minor)) {
			cfg_hnd = &dsi_cfg_handlers[i];
			break;
		}
	}

	return cfg_hnd;
}

/*  Non autodetect configs */
const struct msm_dsi_cfg_handler qcm2290_dsi_cfg_handler = {
	.cfg = &qcm2290_dsi_cfg,
	.ops = &msm_dsi_6g_v2_host_ops,
};