From a07b4b5edd94545dd43328476e7313fc04ffa7a4 Mon Sep 17 00:00:00 2001 From: Algea Cao Date: Wed, 28 Jul 2021 10:56:29 +0800 Subject: [PATCH] drm/rockchip: hdmi: Add hdmi drv_data features Hdmi features vary on different platforms: 1.max_tmdsclk:hdmi max tmds clock. 2.unsupported_yuv_input:hdmi only support rgb input. 3.unsupported_deep_color:deep color mode is unsupported. Signed-off-by: Algea Cao Change-Id: I77468b21960c49596c45bfef037fc5bfb3545b61 --- drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 17 +++++++++++++++++ include/drm/bridge/dw_hdmi.h | 3 +++ 2 files changed, 20 insertions(+) diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c index 796b3f96d977..f7bafff2b7fe 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c @@ -85,6 +85,10 @@ struct rockchip_hdmi { struct clk *hclk_vop; struct dw_hdmi *hdmi; struct phy *phy; + + u32 max_tmdsclk; + bool unsupported_yuv_input; + bool unsupported_deep_color; }; #define to_rockchip_hdmi(x) container_of(x, struct rockchip_hdmi, x) @@ -583,6 +587,7 @@ static const struct dw_hdmi_plat_data rk3228_hdmi_drv_data = { .phy_ops = &rk3228_hdmi_phy_ops, .phy_name = "inno_dw_hdmi_phy2", .phy_force_vendor = true, + .max_tmdsclk = 371250, }; static struct rockchip_hdmi_chip_data rk3288_chip_data = { @@ -598,6 +603,7 @@ static const struct dw_hdmi_plat_data rk3288_hdmi_drv_data = { .phy_config = rockchip_phy_config, .phy_data = &rk3288_chip_data, .tmds_n_table = rockchip_werid_tmds_n_table, + .unsupported_yuv_input = true, }; static const struct dw_hdmi_phy_ops rk3328_hdmi_phy_ops = { @@ -622,6 +628,7 @@ static const struct dw_hdmi_plat_data rk3328_hdmi_drv_data = { .phy_name = "inno_dw_hdmi_phy2", .phy_force_vendor = true, .use_drm_infoframe = true, + .max_tmdsclk = 371250, }; static struct rockchip_hdmi_chip_data rk3368_chip_data = { @@ -635,6 +642,8 @@ static const struct dw_hdmi_plat_data rk3368_hdmi_drv_data = { .cur_ctr = rockchip_cur_ctr, .phy_config = rockchip_phy_config, .phy_data = &rk3368_chip_data, + .unsupported_deep_color = true, + .max_tmdsclk = 340000, }; static struct rockchip_hdmi_chip_data rk3399_chip_data = { @@ -731,6 +740,14 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, if (encoder->possible_crtcs == 0) return -EPROBE_DEFER; + if (!plat_data->max_tmdsclk) + hdmi->max_tmdsclk = 594000; + else + hdmi->max_tmdsclk = plat_data->max_tmdsclk; + + hdmi->unsupported_yuv_input = plat_data->unsupported_yuv_input; + hdmi->unsupported_deep_color = plat_data->unsupported_deep_color; + ret = rockchip_hdmi_parse_dt(hdmi); if (ret) { DRM_DEV_ERROR(hdmi->dev, "Unable to parse OF data\n"); diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h index 5b5bb3d27028..8b8d73a58474 100644 --- a/include/drm/bridge/dw_hdmi.h +++ b/include/drm/bridge/dw_hdmi.h @@ -135,8 +135,11 @@ struct dw_hdmi_plat_data { unsigned long input_bus_format; unsigned long input_bus_encoding; + unsigned int max_tmdsclk; bool use_drm_infoframe; bool ycbcr_420_allowed; + bool unsupported_yuv_input; + bool unsupported_deep_color; /* * Private data passed to all the .mode_valid() and .configure_phy()