drm: exynos: hdmi: add support for pixel clock limitation
authorTomasz Stanislawski <t.stanislaws@samsung.com>
Thu, 19 Dec 2013 15:24:07 +0000 (16:24 +0100)
committerMarek Szyprowski <m.szyprowski@samsung.com>
Thu, 15 May 2014 05:27:13 +0000 (07:27 +0200)
Adds support for limitation of maximal pixel clock of HDMI
signal. This feature is needed on boards that contains
lines or bridges with frequency limitations.

Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
Change-Id: I4cc38e995feeaca77b73e9ea0197d67f99d57715

drivers/gpu/drm/exynos/exynos_hdmi.c
include/media/s5p_hdmi.h

index 87c3f42..a48cf75 100644 (file)
@@ -201,6 +201,7 @@ struct hdmi_context {
        struct hdmi_resources           res;
 
        int                             hpd_gpio;
+       u32                             max_pixel_clock;
 
        enum hdmi_type                  type;
 };
@@ -801,6 +802,8 @@ static int hdmi_check_mode(void *ctx, struct drm_display_mode *mode)
                (mode->flags & DRM_MODE_FLAG_INTERLACE) ? true :
                false, mode->clock * 1000);
 
+       if (mode->clock * 1000 > hdata->max_pixel_clock)
+               return -E2BIG;
        ret = hdmi_find_phy_conf(hdata, mode->clock * 1000);
        if (ret < 0)
                return ret;
@@ -1868,6 +1871,8 @@ static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata
                return NULL;
        }
 
+       of_property_read_u32(np, "max-pixel-clock", &pd->max_pixel_clock);
+
        return pd;
 }
 #else
@@ -1934,6 +1939,11 @@ static int hdmi_probe(struct platform_device *pdev)
                return -EINVAL;
        }
 
+       if (!pdata->max_pixel_clock) {
+               DRM_LOG("max-pixel-clock is zero, using INF\n");
+               pdata->max_pixel_clock = ULONG_MAX;
+       }
+
        drm_hdmi_ctx = devm_kzalloc(dev, sizeof(*drm_hdmi_ctx),
                                                                GFP_KERNEL);
        if (!drm_hdmi_ctx)
@@ -1964,6 +1974,7 @@ static int hdmi_probe(struct platform_device *pdev)
        }
 
        hdata->hpd_gpio = pdata->hpd_gpio;
+       hdata->max_pixel_clock = pdata->max_pixel_clock;
        hdata->dev = dev;
 
        ret = hdmi_resources_init(hdata);
index 181642b..7272d65 100644 (file)
@@ -31,6 +31,7 @@ struct s5p_hdmi_platform_data {
        int mhl_bus;
        struct i2c_board_info *mhl_info;
        int hpd_gpio;
+       u32 max_pixel_clock;
 };
 
 #endif /* S5P_HDMI_H */