xref: /openbmc/linux/drivers/gpu/drm/msm/dsi/dsi_cfg.c (revision d248b61f)
1 /*
2  * Copyright (c) 2015, The Linux Foundation. All rights reserved.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 and
6  * only version 2 as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  */
13 
14 #include "dsi_cfg.h"
15 
16 /* DSI v2 has not been supported by now */
17 static const struct msm_dsi_config dsi_v2_cfg = {
18 	.io_offset = 0,
19 };
20 
21 static const struct msm_dsi_config msm8974_apq8084_dsi_cfg = {
22 	.io_offset = DSI_6G_REG_SHIFT,
23 	.reg_cfg = {
24 		.num = 4,
25 		.regs = {
26 			{"gdsc", -1, -1, -1, -1},
27 			{"vdd", 3000000, 3000000, 150000, 100},
28 			{"vdda", 1200000, 1200000, 100000, 100},
29 			{"vddio", 1800000, 1800000, 100000, 100},
30 		},
31 	},
32 };
33 
34 static const struct msm_dsi_config msm8916_dsi_cfg = {
35 	.io_offset = DSI_6G_REG_SHIFT,
36 	.reg_cfg = {
37 		.num = 4,
38 		.regs = {
39 			{"gdsc", -1, -1, -1, -1},
40 			{"vdd", 2850000, 2850000, 100000, 100},
41 			{"vdda", 1200000, 1200000, 100000, 100},
42 			{"vddio", 1800000, 1800000, 100000, 100},
43 		},
44 	},
45 };
46 
47 static const struct msm_dsi_config msm8994_dsi_cfg = {
48 	.io_offset = DSI_6G_REG_SHIFT,
49 	.reg_cfg = {
50 		.num = 7,
51 		.regs = {
52 			{"gdsc", -1, -1, -1, -1},
53 			{"vdda", 1250000, 1250000, 100000, 100},
54 			{"vddio", 1800000, 1800000, 100000, 100},
55 			{"vcca", 1000000, 1000000, 10000, 100},
56 			{"vdd", 1800000, 1800000, 100000, 100},
57 			{"lab_reg", -1, -1, -1, -1},
58 			{"ibb_reg", -1, -1, -1, -1},
59 		},
60 	}
61 };
62 
63 static const struct msm_dsi_cfg_handler dsi_cfg_handlers[] = {
64 	{MSM_DSI_VER_MAJOR_V2, U32_MAX, &dsi_v2_cfg},
65 	{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_0,
66 						&msm8974_apq8084_dsi_cfg},
67 	{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_1,
68 						&msm8974_apq8084_dsi_cfg},
69 	{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_1_1,
70 						&msm8974_apq8084_dsi_cfg},
71 	{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_2,
72 						&msm8974_apq8084_dsi_cfg},
73 	{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_3, &msm8994_dsi_cfg},
74 	{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_3_1, &msm8916_dsi_cfg},
75 };
76 
77 const struct msm_dsi_cfg_handler *msm_dsi_cfg_get(u32 major, u32 minor)
78 {
79 	const struct msm_dsi_cfg_handler *cfg_hnd = NULL;
80 	int i;
81 
82 	for (i = ARRAY_SIZE(dsi_cfg_handlers) - 1; i >= 0; i--) {
83 		if ((dsi_cfg_handlers[i].major == major) &&
84 			(dsi_cfg_handlers[i].minor == minor)) {
85 			cfg_hnd = &dsi_cfg_handlers[i];
86 			break;
87 		}
88 	}
89 
90 	return cfg_hnd;
91 }
92 
93