From: Patrick Brünn <p.bruenn@xxxxxxxxxxxx> Add ddc-i2c-bus as an additional source to read edid. If you convert the 24-bit parallel-display signal to DVI and combine it with I2C, you can connect DVI-D displays to your imx powered devices. An example for this setup is the CX9020 Embedded PC. Signed-off-by: Patrick Brünn <p.bruenn@xxxxxxxxxxxx> --- drivers/gpu/drm/imx/parallel-display.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/gpu/drm/imx/parallel-display.c b/drivers/gpu/drm/imx/parallel-display.c index b4deb9c..32b745a 100644 --- a/drivers/gpu/drm/imx/parallel-display.c +++ b/drivers/gpu/drm/imx/parallel-display.c @@ -15,6 +15,7 @@ #include <linux/component.h> #include <linux/module.h> +#include <linux/i2c.h> #include <drm/drmP.h> #include <drm/drm_fb_helper.h> #include <drm/drm_crtc_helper.h> @@ -38,6 +39,7 @@ struct imx_parallel_display { int mode_valid; struct drm_display_mode mode; struct drm_panel *panel; + struct i2c_adapter *ddc; }; static enum drm_connector_status imx_pd_connector_detect( @@ -52,6 +54,16 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector) struct device_node *np = imxpd->dev->of_node; int num_modes = 0; + if (imxpd->ddc) { + kfree(imxpd->edid); + imxpd->edid = drm_get_edid(connector, imxpd->ddc); + drm_mode_connector_update_edid_property(connector, imxpd->edid); + num_modes = drm_add_edid_modes(connector, imxpd->edid); + if (num_modes > 0) + return num_modes; + } + + if (imxpd->panel && imxpd->panel->funcs && imxpd->panel->funcs->get_modes) { num_modes = imxpd->panel->funcs->get_modes(imxpd->panel); @@ -90,6 +102,16 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector) return num_modes; } +static enum drm_mode_status imx_pd_connector_mode_valid(struct drm_connector *connector, + struct drm_display_mode *mode) +{ + static const int IMX53_MAX_PIXEL_CLOCK_KHZ = 170000; + + if (mode->clock > IMX53_MAX_PIXEL_CLOCK_KHZ) + return MODE_CLOCK_HIGH; + return MODE_OK; +} + static struct drm_encoder *imx_pd_connector_best_encoder( struct drm_connector *connector) { @@ -153,6 +175,7 @@ static struct drm_connector_funcs imx_pd_connector_funcs = { static struct drm_connector_helper_funcs imx_pd_connector_helper_funcs = { .get_modes = imx_pd_connector_get_modes, + .mode_valid = imx_pd_connector_mode_valid, .best_encoder = imx_pd_connector_best_encoder, }; @@ -209,6 +232,7 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data) { struct drm_device *drm = data; struct device_node *np = dev->of_node; + struct device_node *ddc_node; struct device_node *port; const u8 *edidp; struct imx_parallel_display *imxpd; @@ -219,6 +243,12 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data) if (!imxpd) return -ENOMEM; + ddc_node = of_parse_phandle(np, "ddc-i2c-bus", 0); + if (ddc_node) { + imxpd->ddc = of_find_i2c_adapter_by_node(ddc_node); + of_node_put(ddc_node); + } + edidp = of_get_property(np, "edid", &imxpd->edid_len); if (edidp) imxpd->edid = kmemdup(edidp, imxpd->edid_len, GFP_KERNEL); -- 1.9.1 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/dri-devel