.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * 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 | 4 | */ |
---|
13 | 5 | |
---|
14 | 6 | #include "dsi_phy.h" |
---|
.. | .. |
---|
47 | 39 | DSI_28nm_PHY_TIMING_CTRL_11_TRIG3_CMD(0)); |
---|
48 | 40 | } |
---|
49 | 41 | |
---|
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) |
---|
51 | 43 | { |
---|
52 | 44 | 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 | | - } |
---|
58 | 45 | |
---|
59 | 46 | dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_0, 0x0); |
---|
60 | 47 | dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CAL_PWR_CFG, 1); |
---|
.. | .. |
---|
64 | 51 | dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_1, 0x9); |
---|
65 | 52 | dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_0, 0x7); |
---|
66 | 53 | 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); |
---|
67 | 87 | } |
---|
68 | 88 | |
---|
69 | 89 | static int dsi_28nm_phy_enable(struct msm_dsi_phy *phy, int src_pll_id, |
---|
.. | .. |
---|
76 | 96 | DBG(""); |
---|
77 | 97 | |
---|
78 | 98 | if (msm_dsi_dphy_timing_calc(timing, clk_req)) { |
---|
79 | | - dev_err(&phy->pdev->dev, |
---|
| 99 | + DRM_DEV_ERROR(&phy->pdev->dev, |
---|
80 | 100 | "%s: D-PHY timing calculation failed\n", __func__); |
---|
81 | 101 | return -EINVAL; |
---|
82 | 102 | } |
---|
.. | .. |
---|
84 | 104 | dsi_phy_write(base + REG_DSI_28nm_PHY_STRENGTH_0, 0xff); |
---|
85 | 105 | |
---|
86 | 106 | dsi_28nm_phy_regulator_ctrl(phy, true); |
---|
87 | | - |
---|
88 | | - dsi_phy_write(base + REG_DSI_28nm_PHY_LDO_CNTRL, 0x00); |
---|
89 | 107 | |
---|
90 | 108 | dsi_28nm_dphy_set_timing(phy, timing); |
---|
91 | 109 | |
---|
.. | .. |
---|
150 | 168 | .num_dsi_phy = 2, |
---|
151 | 169 | }; |
---|
152 | 170 | |
---|
| 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 | + |
---|
153 | 189 | const struct msm_dsi_phy_cfg dsi_phy_28nm_lp_cfgs = { |
---|
154 | 190 | .type = MSM_DSI_PHY_28NM_LP, |
---|
155 | 191 | .src_pll_truthtable = { {true, true}, {true, true} }, |
---|