Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/msm/dsi: Implement qcom, dsi-phy-regulator-ldo-mode for 28nm PHY

The DSI PHY regulator supports two regulator modes: LDO and DCDC.
This mode can be selected using the "qcom,dsi-phy-regulator-ldo-mode"
device tree property.

However, at the moment only the 20nm PHY driver actually implements
that option. Add a check in the 28nm PHY driver to program the
registers correctly for LDO mode.

Tested-by: Nikita Travkin <nikitos.tr@gmail.com> # l8150
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20191023165617.28738-1-stephan@gerhold.net

authored by

Stephan Gerhold and committed by
Sean Paul
49c4868a 8856c506

+34 -8
+34 -8
drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c
··· 39 39 DSI_28nm_PHY_TIMING_CTRL_11_TRIG3_CMD(0)); 40 40 } 41 41 42 - 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) 43 43 { 44 44 void __iomem *base = phy->reg_base; 45 - 46 - if (!enable) { 47 - dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CAL_PWR_CFG, 0); 48 - return; 49 - } 50 45 51 46 dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_0, 0x0); 52 47 dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CAL_PWR_CFG, 1); ··· 51 56 dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_1, 0x9); 52 57 dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_0, 0x7); 53 58 dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_4, 0x20); 59 + dsi_phy_write(phy->base + REG_DSI_28nm_PHY_LDO_CNTRL, 0x00); 60 + } 61 + 62 + static void dsi_28nm_phy_regulator_enable_ldo(struct msm_dsi_phy *phy) 63 + { 64 + void __iomem *base = phy->reg_base; 65 + 66 + dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_0, 0x0); 67 + dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CAL_PWR_CFG, 0); 68 + dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_5, 0x7); 69 + dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_3, 0); 70 + dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_2, 0x1); 71 + dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_1, 0x1); 72 + dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_4, 0x20); 73 + 74 + if (phy->cfg->type == MSM_DSI_PHY_28NM_LP) 75 + dsi_phy_write(phy->base + REG_DSI_28nm_PHY_LDO_CNTRL, 0x05); 76 + else 77 + dsi_phy_write(phy->base + REG_DSI_28nm_PHY_LDO_CNTRL, 0x0d); 78 + } 79 + 80 + static void dsi_28nm_phy_regulator_ctrl(struct msm_dsi_phy *phy, bool enable) 81 + { 82 + if (!enable) { 83 + dsi_phy_write(phy->reg_base + 84 + REG_DSI_28nm_PHY_REGULATOR_CAL_PWR_CFG, 0); 85 + return; 86 + } 87 + 88 + if (phy->regulator_ldo_mode) 89 + dsi_28nm_phy_regulator_enable_ldo(phy); 90 + else 91 + dsi_28nm_phy_regulator_enable_dcdc(phy); 54 92 } 55 93 56 94 static int dsi_28nm_phy_enable(struct msm_dsi_phy *phy, int src_pll_id, ··· 104 76 dsi_phy_write(base + REG_DSI_28nm_PHY_STRENGTH_0, 0xff); 105 77 106 78 dsi_28nm_phy_regulator_ctrl(phy, true); 107 - 108 - dsi_phy_write(base + REG_DSI_28nm_PHY_LDO_CNTRL, 0x00); 109 79 110 80 dsi_28nm_dphy_set_timing(phy, timing); 111 81