forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c
....@@ -1,14 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * 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.
124 */
135
146 #include "dsi_phy.h"
....@@ -47,14 +39,9 @@
4739 DSI_28nm_PHY_TIMING_CTRL_11_TRIG3_CMD(0));
4840 }
4941
50
-static void dsi_28nm_phy_regulator_ctrl(struct msm_dsi_phy *phy, bool enable)
42
+static void dsi_28nm_phy_regulator_enable_dcdc(struct msm_dsi_phy *phy)
5143 {
5244 void __iomem *base = phy->reg_base;
53
-
54
- if (!enable) {
55
- dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CAL_PWR_CFG, 0);
56
- return;
57
- }
5845
5946 dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_0, 0x0);
6047 dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CAL_PWR_CFG, 1);
....@@ -64,6 +51,39 @@
6451 dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_1, 0x9);
6552 dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_0, 0x7);
6653 dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_4, 0x20);
54
+ dsi_phy_write(phy->base + REG_DSI_28nm_PHY_LDO_CNTRL, 0x00);
55
+}
56
+
57
+static void dsi_28nm_phy_regulator_enable_ldo(struct msm_dsi_phy *phy)
58
+{
59
+ void __iomem *base = phy->reg_base;
60
+
61
+ dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_0, 0x0);
62
+ dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CAL_PWR_CFG, 0);
63
+ dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_5, 0x7);
64
+ dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_3, 0);
65
+ dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_2, 0x1);
66
+ dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_1, 0x1);
67
+ dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_4, 0x20);
68
+
69
+ if (phy->cfg->type == MSM_DSI_PHY_28NM_LP)
70
+ dsi_phy_write(phy->base + REG_DSI_28nm_PHY_LDO_CNTRL, 0x05);
71
+ else
72
+ dsi_phy_write(phy->base + REG_DSI_28nm_PHY_LDO_CNTRL, 0x0d);
73
+}
74
+
75
+static void dsi_28nm_phy_regulator_ctrl(struct msm_dsi_phy *phy, bool enable)
76
+{
77
+ if (!enable) {
78
+ dsi_phy_write(phy->reg_base +
79
+ REG_DSI_28nm_PHY_REGULATOR_CAL_PWR_CFG, 0);
80
+ return;
81
+ }
82
+
83
+ if (phy->regulator_ldo_mode)
84
+ dsi_28nm_phy_regulator_enable_ldo(phy);
85
+ else
86
+ dsi_28nm_phy_regulator_enable_dcdc(phy);
6787 }
6888
6989 static int dsi_28nm_phy_enable(struct msm_dsi_phy *phy, int src_pll_id,
....@@ -76,7 +96,7 @@
7696 DBG("");
7797
7898 if (msm_dsi_dphy_timing_calc(timing, clk_req)) {
79
- dev_err(&phy->pdev->dev,
99
+ DRM_DEV_ERROR(&phy->pdev->dev,
80100 "%s: D-PHY timing calculation failed\n", __func__);
81101 return -EINVAL;
82102 }
....@@ -84,8 +104,6 @@
84104 dsi_phy_write(base + REG_DSI_28nm_PHY_STRENGTH_0, 0xff);
85105
86106 dsi_28nm_phy_regulator_ctrl(phy, true);
87
-
88
- dsi_phy_write(base + REG_DSI_28nm_PHY_LDO_CNTRL, 0x00);
89107
90108 dsi_28nm_dphy_set_timing(phy, timing);
91109
....@@ -150,6 +168,24 @@
150168 .num_dsi_phy = 2,
151169 };
152170
171
+const struct msm_dsi_phy_cfg dsi_phy_28nm_hpm_famb_cfgs = {
172
+ .type = MSM_DSI_PHY_28NM_HPM,
173
+ .src_pll_truthtable = { {true, true}, {false, true} },
174
+ .reg_cfg = {
175
+ .num = 1,
176
+ .regs = {
177
+ {"vddio", 100000, 100},
178
+ },
179
+ },
180
+ .ops = {
181
+ .enable = dsi_28nm_phy_enable,
182
+ .disable = dsi_28nm_phy_disable,
183
+ .init = msm_dsi_phy_init_common,
184
+ },
185
+ .io_start = { 0x1a94400, 0x1a96400 },
186
+ .num_dsi_phy = 2,
187
+};
188
+
153189 const struct msm_dsi_phy_cfg dsi_phy_28nm_lp_cfgs = {
154190 .type = MSM_DSI_PHY_28NM_LP,
155191 .src_pll_truthtable = { {true, true}, {true, true} },