From: Steve Longerbeam steve_longerbeam@mentor.com
Add support for reading EDID over Display Data Channel. If no DDC adapter is available, falls back to hardcoded EDID or display-timings node as before.
Signed-off-by: Steve Longerbeam steve_longerbeam@mentor.com Signed-off-by: Akshay Bhat akshay.bhat@timesys.com Acked-by: Philipp Zabel p.zabel@pengutronix.de ---
Hi Philipp,
I have addressed all your comments on v2 Patch.
Thanks, Akshay
v3: Move ddc_node pointer definition Warn and perform a probe deferral on failing to get ddc i2c adapter by node
v2: Rebase to 4.6-rc5 Add check for channel->panel before fallback to display-timings node
drivers/gpu/drm/imx/imx-ldb.c | 42 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c index a58eee5..f506e8d 100644 --- a/drivers/gpu/drm/imx/imx-ldb.c +++ b/drivers/gpu/drm/imx/imx-ldb.c @@ -59,6 +59,7 @@ struct imx_ldb_channel { struct drm_encoder encoder; struct drm_panel *panel; struct device_node *child; + struct i2c_adapter *ddc; int chno; void *edid; int edid_len; @@ -107,6 +108,9 @@ static int imx_ldb_connector_get_modes(struct drm_connector *connector) return num_modes; }
+ if (!imx_ldb_ch->edid && imx_ldb_ch->ddc) + imx_ldb_ch->edid = drm_get_edid(connector, imx_ldb_ch->ddc); + if (imx_ldb_ch->edid) { drm_mode_connector_update_edid_property(connector, imx_ldb_ch->edid); @@ -553,6 +557,7 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data)
for_each_child_of_node(np, child) { struct imx_ldb_channel *channel; + struct device_node *ddc_node; struct device_node *port;
ret = of_property_read_u32(child, "reg", &i); @@ -595,14 +600,34 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data) } }
- edidp = of_get_property(child, "edid", &channel->edid_len); - if (edidp) { - channel->edid = kmemdup(edidp, channel->edid_len, - GFP_KERNEL); - } else if (!channel->panel) { - ret = of_get_drm_display_mode(child, &channel->mode, 0); - if (!ret) - channel->mode_valid = 1; + ddc_node = of_parse_phandle(child, "ddc-i2c-bus", 0); + if (ddc_node) { + channel->ddc = of_find_i2c_adapter_by_node(ddc_node); + of_node_put(ddc_node); + if (!channel->ddc) { + dev_warn(dev, "failed to get ddc i2c adapter\n"); + return -EPROBE_DEFER; + } + } + + if (!channel->ddc) { + /* if no DDC available, fallback to hardcoded EDID */ + dev_dbg(dev, "no ddc available\n"); + + edidp = of_get_property(child, "edid", + &channel->edid_len); + if (edidp) { + channel->edid = kmemdup(edidp, + channel->edid_len, + GFP_KERNEL); + } else if (!channel->panel) { + /* fallback to display-timings node */ + ret = of_get_drm_display_mode(child, + &channel->mode, + 0); + if (!ret) + channel->mode_valid = 1; + } }
channel->bus_format = of_get_bus_format(dev, child); @@ -647,6 +672,7 @@ static void imx_ldb_unbind(struct device *dev, struct device *master, channel->encoder.funcs->destroy(&channel->encoder);
kfree(channel->edid); + i2c_put_adapter(channel->ddc); } }
Document the ddc-i2c-bus property used by imx-ldb driver to read EDID information via I2C interface.
Signed-off-by: Akshay Bhat akshay.bhat@timesys.com ---
v3: Newly added.
Documentation/devicetree/bindings/display/imx/ldb.txt | 1 + 1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/display/imx/ldb.txt b/Documentation/devicetree/bindings/display/imx/ldb.txt index 0a175d9..a407462 100644 --- a/Documentation/devicetree/bindings/display/imx/ldb.txt +++ b/Documentation/devicetree/bindings/display/imx/ldb.txt @@ -62,6 +62,7 @@ Required properties: display-timings are used instead.
Optional properties (required if display-timings are used): + - ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing - display-timings : A node that describes the display timings as defined in Documentation/devicetree/bindings/display/display-timing.txt. - fsl,data-mapping : should be "spwg" or "jeida"
On Wed, Apr 27, 2016 at 04:23:34PM -0400, Akshay Bhat wrote:
Document the ddc-i2c-bus property used by imx-ldb driver to read EDID information via I2C interface.
Signed-off-by: Akshay Bhat akshay.bhat@timesys.com
v3: Newly added.
Documentation/devicetree/bindings/display/imx/ldb.txt | 1 + 1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/display/imx/ldb.txt b/Documentation/devicetree/bindings/display/imx/ldb.txt index 0a175d9..a407462 100644 --- a/Documentation/devicetree/bindings/display/imx/ldb.txt +++ b/Documentation/devicetree/bindings/display/imx/ldb.txt @@ -62,6 +62,7 @@ Required properties: display-timings are used instead.
Optional properties (required if display-timings are used):
The required part doesn't make sense if you add this, but...
- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
Really, this should be part of a connector node since i2c goes from the i2c controller to a connector and is not part of the display controller.
- display-timings : A node that describes the display timings as defined in Documentation/devicetree/bindings/display/display-timing.txt.
- fsl,data-mapping : should be "spwg" or "jeida"
-- 2.8.1
Am Donnerstag, den 28.04.2016, 16:48 -0500 schrieb Rob Herring:
On Wed, Apr 27, 2016 at 04:23:34PM -0400, Akshay Bhat wrote:
Document the ddc-i2c-bus property used by imx-ldb driver to read EDID information via I2C interface.
Signed-off-by: Akshay Bhat akshay.bhat@timesys.com
v3: Newly added.
Documentation/devicetree/bindings/display/imx/ldb.txt | 1 + 1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/display/imx/ldb.txt b/Documentation/devicetree/bindings/display/imx/ldb.txt index 0a175d9..a407462 100644 --- a/Documentation/devicetree/bindings/display/imx/ldb.txt +++ b/Documentation/devicetree/bindings/display/imx/ldb.txt @@ -62,6 +62,7 @@ Required properties: display-timings are used instead.
Optional properties (required if display-timings are used):
The required part doesn't make sense if you add this, but...
- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
Really, this should be part of a connector node since i2c goes from the i2c controller to a connector and is not part of the display controller.
If the ddc i2c bus does indeed go through a connector, yes. Would that warrant a generic "lvds-connector" binding for all those different types of internal LVDS connectors?
regards Philipp
On Fri, Apr 29, 2016 at 09:44:12AM +0200, Philipp Zabel wrote:
Am Donnerstag, den 28.04.2016, 16:48 -0500 schrieb Rob Herring:
On Wed, Apr 27, 2016 at 04:23:34PM -0400, Akshay Bhat wrote:
Document the ddc-i2c-bus property used by imx-ldb driver to read EDID information via I2C interface.
Signed-off-by: Akshay Bhat akshay.bhat@timesys.com
v3: Newly added.
Documentation/devicetree/bindings/display/imx/ldb.txt | 1 + 1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/display/imx/ldb.txt b/Documentation/devicetree/bindings/display/imx/ldb.txt index 0a175d9..a407462 100644 --- a/Documentation/devicetree/bindings/display/imx/ldb.txt +++ b/Documentation/devicetree/bindings/display/imx/ldb.txt @@ -62,6 +62,7 @@ Required properties: display-timings are used instead.
Optional properties (required if display-timings are used):
The required part doesn't make sense if you add this, but...
- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
Really, this should be part of a connector node since i2c goes from the i2c controller to a connector and is not part of the display controller.
If the ddc i2c bus does indeed go through a connector, yes. Would that warrant a generic "lvds-connector" binding for all those different types of internal LVDS connectors?
Probably an overkill for that case. It could be part of the panel node, but I'm reluctant to define a 3rd way. So this is fine as is.
Acked-by: Rob Herring robh@kernel.org
Rob
dri-devel@lists.freedesktop.org