From: Philipp Zabel <p.zabel@pengutronix.de>
To: Akshay Bhat <akshay.bhat@timesys.com>
Cc: airlied@linux.ie, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org,
Steve Longerbeam <steve_longerbeam@mentor.com>
Subject: Re: [PATCH v2] drm/imx: imx-ldb: Add DDC support
Date: Wed, 27 Apr 2016 11:14:10 +0200 [thread overview]
Message-ID: <1461748450.4044.18.camel@pengutronix.de> (raw)
In-Reply-To: <1461692430-3976-1-git-send-email-akshay.bhat@timesys.com>
Hi Akshay,
Am Dienstag, den 26.04.2016, 13:40 -0400 schrieb Akshay Bhat:
> 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 found this patch to add DDC support to imx-ldb at:
> https://patchwork.kernel.org/patch/5207231/
>
> Looks like it never made it to the upstream kernel.
> I have rebased this on 4.6-rc5 and tested the same.
Thanks for picking this up. Please also update the binding docs in
Documentation/devicetree/bindings/display/imx/ldb.txt.
> Thanks,
> Akshay
>
> v1 -> v2:
> Rebase to 4.6-rc5
> Add check for channel->panel before fallback to display-timings node
>
> drivers/gpu/drm/imx/imx-ldb.c | 38 ++++++++++++++++++++++++++++++--------
> 1 file changed, 30 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
> index a58eee5..67706c9 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);
> @@ -554,6 +558,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 *port;
> + struct device_node *ddc_node;
For alphabetic and/or aesthetic reasons, would you mind moving this up
one line?
> ret = of_property_read_u32(child, "reg", &i);
> if (ret || i < 0 || i > 1)
> @@ -595,14 +600,30 @@ 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);
If channel->ddc is NULL after this, we should probably warn.
> + of_node_put(ddc_node);
> + }
> +
> + 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 +668,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);
> }
> }
>
regards
Philipp
prev parent reply other threads:[~2016-04-27 9:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-26 17:40 Akshay Bhat
2016-04-27 9:14 ` Philipp Zabel [this message]
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=1461748450.4044.18.camel@pengutronix.de \
--to=p.zabel@pengutronix.de \
--cc=airlied@linux.ie \
--cc=akshay.bhat@timesys.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=steve_longerbeam@mentor.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®