xref: /openbmc/linux/drivers/gpu/drm/msm/dsi/dsi_cfg.c (revision bc5aa3a0)
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 static const char * const dsi_v2_bus_clk_names[] = {
17 	"core_mmss_clk", "iface_clk", "bus_clk",
18 };
19 
20 static const struct msm_dsi_config apq8064_dsi_cfg = {
21 	.io_offset = 0,
22 	.reg_cfg = {
23 		.num = 3,
24 		.regs = {
25 			{"vdda", 100000, 100},	/* 1.2 V */
26 			{"avdd", 10000, 100},	/* 3.0 V */
27 			{"vddio", 100000, 100},	/* 1.8 V */
28 		},
29 	},
30 	.bus_clk_names = dsi_v2_bus_clk_names,
31 	.num_bus_clks = ARRAY_SIZE(dsi_v2_bus_clk_names),
32 	.io_start = { 0x4700000, 0x5800000 },
33 	.num_dsi = 2,
34 };
35 
36 static const char * const dsi_6g_bus_clk_names[] = {
37 	"mdp_core_clk", "iface_clk", "bus_clk", "core_mmss_clk",
38 };
39 
40 static const struct msm_dsi_config msm8974_apq8084_dsi_cfg = {
41 	.io_offset = DSI_6G_REG_SHIFT,
42 	.reg_cfg = {
43 		.num = 4,
44 		.regs = {
45 			{"gdsc", -1, -1},
46 			{"vdd", 150000, 100},	/* 3.0 V */
47 			{"vdda", 100000, 100},	/* 1.2 V */
48 			{"vddio", 100000, 100},	/* 1.8 V */
49 		},
50 	},
51 	.bus_clk_names = dsi_6g_bus_clk_names,
52 	.num_bus_clks = ARRAY_SIZE(dsi_6g_bus_clk_names),
53 	.io_start = { 0xfd922800, 0xfd922b00 },
54 	.num_dsi = 2,
55 };
56 
57 static const char * const dsi_8916_bus_clk_names[] = {
58 	"mdp_core_clk", "iface_clk", "bus_clk",
59 };
60 
61 static const struct msm_dsi_config msm8916_dsi_cfg = {
62 	.io_offset = DSI_6G_REG_SHIFT,
63 	.reg_cfg = {
64 		.num = 3,
65 		.regs = {
66 			{"gdsc", -1, -1},
67 			{"vdda", 100000, 100},	/* 1.2 V */
68 			{"vddio", 100000, 100},	/* 1.8 V */
69 		},
70 	},
71 	.bus_clk_names = dsi_8916_bus_clk_names,
72 	.num_bus_clks = ARRAY_SIZE(dsi_8916_bus_clk_names),
73 	.io_start = { 0x1a98000 },
74 	.num_dsi = 1,
75 };
76 
77 static const struct msm_dsi_config msm8994_dsi_cfg = {
78 	.io_offset = DSI_6G_REG_SHIFT,
79 	.reg_cfg = {
80 		.num = 7,
81 		.regs = {
82 			{"gdsc", -1, -1},
83 			{"vdda", 100000, 100},	/* 1.25 V */
84 			{"vddio", 100000, 100},	/* 1.8 V */
85 			{"vcca", 10000, 100},	/* 1.0 V */
86 			{"vdd", 100000, 100},	/* 1.8 V */
87 			{"lab_reg", -1, -1},
88 			{"ibb_reg", -1, -1},
89 		},
90 	},
91 	.bus_clk_names = dsi_6g_bus_clk_names,
92 	.num_bus_clks = ARRAY_SIZE(dsi_6g_bus_clk_names),
93 	.io_start = { 0xfd998000, 0xfd9a0000 },
94 	.num_dsi = 2,
95 };
96 
97 static const struct msm_dsi_cfg_handler dsi_cfg_handlers[] = {
98 	{MSM_DSI_VER_MAJOR_V2, MSM_DSI_V2_VER_MINOR_8064, &apq8064_dsi_cfg},
99 	{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_0,
100 						&msm8974_apq8084_dsi_cfg},
101 	{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_1,
102 						&msm8974_apq8084_dsi_cfg},
103 	{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_1_1,
104 						&msm8974_apq8084_dsi_cfg},
105 	{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_2,
106 						&msm8974_apq8084_dsi_cfg},
107 	{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_3, &msm8994_dsi_cfg},
108 	{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_3_1, &msm8916_dsi_cfg},
109 };
110 
111 const struct msm_dsi_cfg_handler *msm_dsi_cfg_get(u32 major, u32 minor)
112 {
113 	const struct msm_dsi_cfg_handler *cfg_hnd = NULL;
114 	int i;
115 
116 	for (i = ARRAY_SIZE(dsi_cfg_handlers) - 1; i >= 0; i--) {
117 		if ((dsi_cfg_handlers[i].major == major) &&
118 			(dsi_cfg_handlers[i].minor == minor)) {
119 			cfg_hnd = &dsi_cfg_handlers[i];
120 			break;
121 		}
122 	}
123 
124 	return cfg_hnd;
125 }
126 
127