From f474e5b012027a20a72fe15e64ecd4075607f229 Mon Sep 17 00:00:00 2001 From: WeiYong Bi Date: Tue, 25 Apr 2017 08:38:50 +0800 Subject: [PATCH] drm/rockchip: dw_hdmi: Add support for rk3368 Change-Id: I6a49447a5edd53013ed81875f351089793914f77 Signed-off-by: WeiYong Bi --- .../bindings/display/rockchip/dw_hdmi-rockchip.txt | 1 + drivers/gpu/drm/bridge/dw-hdmi.c | 2 +- drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 12 ++++++++++++ include/drm/bridge/dw_hdmi.h | 10 +++++++++- 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/display/rockchip/dw_hdmi-rockchip.txt b/Documentation/devicetree/bindings/display/rockchip/dw_hdmi-rockchip.txt index 5936883df121..351c94be2dfa 100644 --- a/Documentation/devicetree/bindings/display/rockchip/dw_hdmi-rockchip.txt +++ b/Documentation/devicetree/bindings/display/rockchip/dw_hdmi-rockchip.txt @@ -3,6 +3,7 @@ Rockchip specific extensions to the Synopsys Designware HDMI Required properties: - compatible: "rockchip,rk3288-dw-hdmi", + "rockchip,rk3368-dw-hdmi", "rockchip,rk3399-dw-hdmi"; - reg: Physical base address and length of the controller's registers. - clocks: phandle to hdmi iahb and isfr clocks. diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c b/drivers/gpu/drm/bridge/dw-hdmi.c index afbb6c83ac46..a76a3b1c6d3e 100644 --- a/drivers/gpu/drm/bridge/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/dw-hdmi.c @@ -1281,7 +1281,7 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi, unsigned char prep, * to enable mpll pre-divider. */ if (hdmi->hdmi_data.enc_in_format == YCBCR420 && - hdmi->dev_type == RK3399_HDMI) + (hdmi->dev_type == RK3399_HDMI || hdmi->dev_type == RK3368_HDMI)) hdmi_phy_i2c_write(hdmi, mpll_config->res[res_idx].cpce | 4, 0x06); else diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c index 81af1747566b..66a220005cbb 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c @@ -404,6 +404,14 @@ static const struct dw_hdmi_plat_data rk3288_hdmi_drv_data = { .tmds_n_table = rockchip_werid_tmds_n_table, }; +static const struct dw_hdmi_plat_data rk3368_hdmi_drv_data = { + .mode_valid = dw_hdmi_rockchip_mode_valid, + .mpll_cfg = rockchip_mpll_cfg, + .cur_ctr = rockchip_cur_ctr, + .phy_config = rockchip_phy_config, + .dev_type = RK3368_HDMI, +}; + static const struct dw_hdmi_plat_data rk3399_hdmi_drv_data = { .mode_valid = dw_hdmi_rockchip_mode_valid, .mpll_cfg = rockchip_mpll_cfg, @@ -416,6 +424,10 @@ static const struct of_device_id dw_hdmi_rockchip_dt_ids[] = { { .compatible = "rockchip,rk3288-dw-hdmi", .data = &rk3288_hdmi_drv_data }, + { + .compatible = "rockchip,rk3368-dw-hdmi", + .data = &rk3368_hdmi_drv_data + }, { .compatible = "rockchip,rk3399-dw-hdmi", .data = &rk3399_hdmi_drv_data }, diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h index f06e2be0c0e9..696b84994ae5 100644 --- a/include/drm/bridge/dw_hdmi.h +++ b/include/drm/bridge/dw_hdmi.h @@ -25,6 +25,7 @@ enum dw_hdmi_devtype { IMX6Q_HDMI, IMX6DL_HDMI, RK3288_HDMI, + RK3368_HDMI, RK3399_HDMI, }; @@ -67,7 +68,14 @@ struct dw_hdmi_plat_data { static inline bool is_rockchip(enum dw_hdmi_devtype dev_type) { - return dev_type == RK3288_HDMI || dev_type == RK3399_HDMI; + switch (dev_type) { + case RK3288_HDMI: + case RK3368_HDMI: + case RK3399_HDMI: + return true; + default: + return false; + } } void dw_hdmi_unbind(struct device *dev, struct device *master, void *data); -- 2.34.1