From: <linux-kernel-dev@beckhoff.com>
To: dri-devel@lists.freedesktop.org
Subject: [RFC] drm/imx: parallel-display: add ddc support
Date: Fri, 27 Nov 2015 12:42:51 +0100 [thread overview]
Message-ID: <1448624571-21924-1-git-send-email-linux-kernel-dev@beckhoff.com> (raw)
From: Patrick Brünn <p.bruenn@beckhoff.com>
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@beckhoff.com>
---
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@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
reply other threads:[~2015-11-27 11:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1448624571-21924-1-git-send-email-linux-kernel-dev@beckhoff.com \
--to=linux-kernel-dev@beckhoff.com \
--cc=dri-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.