Skip to content

Commit 09f380e

Browse files
jernejskmripard
authored andcommitted
drm/sun4i: Don't change clock bits in DW HDMI PHY driver
DW HDMI PHY driver and PHY clock driver share same registers. Make sure that DW HDMI PHY setup code doesn't change any clock related bits. During initialization, set PHY PLL parent bit to 0. Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net> Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180625120304.7543-18-jernej.skrabec@siol.net
1 parent 09773c5 commit 09f380e

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
#define SUN8I_HDMI_PHY_PLL_CFG1_LDO2_EN BIT(29)
9999
#define SUN8I_HDMI_PHY_PLL_CFG1_LDO1_EN BIT(28)
100100
#define SUN8I_HDMI_PHY_PLL_CFG1_HV_IS_33 BIT(27)
101-
#define SUN8I_HDMI_PHY_PLL_CFG1_CKIN_SEL BIT(26)
101+
#define SUN8I_HDMI_PHY_PLL_CFG1_CKIN_SEL_MSK BIT(26)
102102
#define SUN8I_HDMI_PHY_PLL_CFG1_PLLEN BIT(25)
103103
#define SUN8I_HDMI_PHY_PLL_CFG1_LDO_VSET(x) ((x) << 22)
104104
#define SUN8I_HDMI_PHY_PLL_CFG1_UNKNOWN(x) ((x) << 20)

drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,13 @@ static int sun8i_hdmi_phy_config_h3(struct dw_hdmi *hdmi,
183183
regmap_update_bits(phy->regs, SUN8I_HDMI_PHY_ANA_CFG1_REG,
184184
SUN8I_HDMI_PHY_ANA_CFG1_TXEN_MASK, 0);
185185

186-
regmap_write(phy->regs, SUN8I_HDMI_PHY_PLL_CFG1_REG, pll_cfg1_init);
186+
/*
187+
* NOTE: We have to be careful not to overwrite PHY parent
188+
* clock selection bit and clock divider.
189+
*/
190+
regmap_update_bits(phy->regs, SUN8I_HDMI_PHY_PLL_CFG1_REG,
191+
(u32)~SUN8I_HDMI_PHY_PLL_CFG1_CKIN_SEL_MSK,
192+
pll_cfg1_init);
187193
regmap_update_bits(phy->regs, SUN8I_HDMI_PHY_PLL_CFG2_REG,
188194
(u32)~SUN8I_HDMI_PHY_PLL_CFG2_PREDIV_MSK,
189195
pll_cfg2_init);
@@ -352,6 +358,10 @@ static void sun8i_hdmi_phy_init_h3(struct sun8i_hdmi_phy *phy)
352358
SUN8I_HDMI_PHY_ANA_CFG3_SCLEN |
353359
SUN8I_HDMI_PHY_ANA_CFG3_SDAEN);
354360

361+
/* reset PHY PLL clock parent */
362+
regmap_update_bits(phy->regs, SUN8I_HDMI_PHY_PLL_CFG1_REG,
363+
SUN8I_HDMI_PHY_PLL_CFG1_CKIN_SEL_MSK, 0);
364+
355365
/* set HW control of CEC pins */
356366
regmap_write(phy->regs, SUN8I_HDMI_PHY_CEC_REG, 0);
357367

0 commit comments

Comments
 (0)