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

Configure Feed

Select the types of activity you want to include in your feed.

drm/rockchip: dw_hdmi: introduce the VPLL clock setting

For RK3399 HDMI, there is an external clock need for HDMI PHY,
and it should keep the same clock rate with VOP DCLK.

VPLL have supported the clock for HDMI PHY, but there is no
clock divider bewteen VPLL and HDMI PHY. So we need to set the
VPLL rate manually in HDMI driver.

Signed-off-by: Yakir Yang <ykk@rock-chips.com>
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
Acked-by: Rob Herring <robh@kernel.org>

Mark Yao 5e3bc6d1 6445e394

+25 -2
+1 -1
Documentation/devicetree/bindings/display/rockchip/dw_hdmi-rockchip.txt
··· 32 32 I2C master controller. 33 33 - clock-names: See dw_hdmi.txt. The "cec" clock is optional. 34 34 - clock-names: May contain "cec" as defined in dw_hdmi.txt. 35 - 35 + - clock-names: May contain "vpll", external clock for some hdmi phy. 36 36 37 37 Example: 38 38
+24 -1
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
··· 7 7 * (at your option) any later version. 8 8 */ 9 9 10 + #include <linux/clk.h> 11 + #include <linux/mfd/syscon.h> 10 12 #include <linux/module.h> 11 13 #include <linux/platform_device.h> 12 - #include <linux/mfd/syscon.h> 13 14 #include <linux/regmap.h> 15 + 14 16 #include <drm/drm_of.h> 15 17 #include <drm/drmP.h> 16 18 #include <drm/drm_crtc_helper.h> ··· 46 44 struct regmap *regmap; 47 45 struct drm_encoder encoder; 48 46 const struct rockchip_hdmi_chip_data *chip_data; 47 + struct clk *vpll_clk; 49 48 }; 50 49 51 50 #define to_rockchip_hdmi(x) container_of(x, struct rockchip_hdmi, x) ··· 163 160 static int rockchip_hdmi_parse_dt(struct rockchip_hdmi *hdmi) 164 161 { 165 162 struct device_node *np = hdmi->dev->of_node; 163 + int ret; 166 164 167 165 hdmi->regmap = syscon_regmap_lookup_by_phandle(np, "rockchip,grf"); 168 166 if (IS_ERR(hdmi->regmap)) { 169 167 dev_err(hdmi->dev, "Unable to get rockchip,grf\n"); 170 168 return PTR_ERR(hdmi->regmap); 169 + } 170 + 171 + hdmi->vpll_clk = devm_clk_get(hdmi->dev, "vpll"); 172 + if (PTR_ERR(hdmi->vpll_clk) == -ENOENT) { 173 + hdmi->vpll_clk = NULL; 174 + } else if (PTR_ERR(hdmi->vpll_clk) == -EPROBE_DEFER) { 175 + return -EPROBE_DEFER; 176 + } else if (IS_ERR(hdmi->vpll_clk)) { 177 + dev_err(hdmi->dev, "failed to get grf clock\n"); 178 + return PTR_ERR(hdmi->vpll_clk); 179 + } 180 + 181 + ret = clk_prepare_enable(hdmi->vpll_clk); 182 + if (ret) { 183 + dev_err(hdmi->dev, "Failed to enable HDMI vpll: %d\n", ret); 184 + return ret; 171 185 } 172 186 173 187 return 0; ··· 229 209 struct drm_display_mode *mode, 230 210 struct drm_display_mode *adj_mode) 231 211 { 212 + struct rockchip_hdmi *hdmi = to_rockchip_hdmi(encoder); 213 + 214 + clk_set_rate(hdmi->vpll_clk, adj_mode->clock * 1000); 232 215 } 233 216 234 217 static void dw_hdmi_rockchip_encoder_enable(struct drm_encoder *encoder)