Skip to content

Commit aef13fd

Browse files
jernejskmripard
authored andcommitted
drm/sun4i: DW HDMI PHY: Add support for second PLL
Some DW HDMI PHYs, like those found in A64 and R40 SoCs, can select between two clock parents. Add code which reads second PLL from DT. 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-19-jernej.skrabec@siol.net
1 parent 09f380e commit aef13fd

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ struct sun8i_hdmi_phy;
147147

148148
struct sun8i_hdmi_phy_variant {
149149
bool has_phy_clk;
150+
bool has_second_pll;
150151
void (*phy_init)(struct sun8i_hdmi_phy *phy);
151152
void (*phy_disable)(struct dw_hdmi *hdmi,
152153
struct sun8i_hdmi_phy *phy);
@@ -160,6 +161,7 @@ struct sun8i_hdmi_phy {
160161
struct clk *clk_mod;
161162
struct clk *clk_phy;
162163
struct clk *clk_pll0;
164+
struct clk *clk_pll1;
163165
unsigned int rcal;
164166
struct regmap *regs;
165167
struct reset_control *rst_phy;

drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -482,10 +482,19 @@ int sun8i_hdmi_phy_probe(struct sun8i_dw_hdmi *hdmi, struct device_node *node)
482482
goto err_put_clk_mod;
483483
}
484484

485+
if (phy->variant->has_second_pll) {
486+
phy->clk_pll1 = of_clk_get_by_name(node, "pll-1");
487+
if (IS_ERR(phy->clk_pll1)) {
488+
dev_err(dev, "Could not get pll-1 clock\n");
489+
ret = PTR_ERR(phy->clk_pll1);
490+
goto err_put_clk_pll0;
491+
}
492+
}
493+
485494
ret = sun8i_phy_clk_create(phy, dev);
486495
if (ret) {
487496
dev_err(dev, "Couldn't create the PHY clock\n");
488-
goto err_put_clk_pll0;
497+
goto err_put_clk_pll1;
489498
}
490499

491500
clk_prepare_enable(phy->clk_phy);
@@ -528,9 +537,10 @@ int sun8i_hdmi_phy_probe(struct sun8i_dw_hdmi *hdmi, struct device_node *node)
528537
reset_control_put(phy->rst_phy);
529538
err_disable_clk_phy:
530539
clk_disable_unprepare(phy->clk_phy);
540+
err_put_clk_pll1:
541+
clk_put(phy->clk_pll1);
531542
err_put_clk_pll0:
532-
if (phy->variant->has_phy_clk)
533-
clk_put(phy->clk_pll0);
543+
clk_put(phy->clk_pll0);
534544
err_put_clk_mod:
535545
clk_put(phy->clk_mod);
536546
err_put_clk_bus:
@@ -551,8 +561,8 @@ void sun8i_hdmi_phy_remove(struct sun8i_dw_hdmi *hdmi)
551561

552562
reset_control_put(phy->rst_phy);
553563

554-
if (phy->variant->has_phy_clk)
555-
clk_put(phy->clk_pll0);
564+
clk_put(phy->clk_pll0);
565+
clk_put(phy->clk_pll1);
556566
clk_put(phy->clk_mod);
557567
clk_put(phy->clk_bus);
558568
}

0 commit comments

Comments
 (0)