public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Fabio Estevam <fabio.estevam@nxp.com>
To: <p.zabel@pengutronix.de>
Cc: <airlied@linux.ie>, <dri-devel@lists.freedesktop.org>,
	<marcel.ziswiler@toradex.com>, <lw@karo-electronics.de>,
	<chris.ruehl@gtsys.com.hk>, Fabio Estevam <fabio.estevam@nxp.com>,
	<stable@vger.kernel.org>
Subject: [PATCH] Revert "drm/imx: Remove of_node assignment from ipuv3-crtc driver probe"
Date: Tue, 17 May 2016 14:11:32 -0300	[thread overview]
Message-ID: <1463505092-28018-1-git-send-email-fabio.estevam@nxp.com> (raw)

Commit 407c9eba789767 ("drm/imx: Remove of_node assignment from ipuv3-crtc
driver probe") causes the IPU to be non-functional, so better to 
revert it to avoid such regression.

This reverts commit 407c9eba789767feb68b42eb2d65db68584e06c0.

Cc: <stable@vger.kernel.org> # 4.4.x
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
 drivers/gpu/drm/imx/ipuv3-crtc.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c
index dee8e8b..006753d 100644
--- a/drivers/gpu/drm/imx/ipuv3-crtc.c
+++ b/drivers/gpu/drm/imx/ipuv3-crtc.c
@@ -520,6 +520,28 @@ err_put_resources:
 	return ret;
 }
 
+static struct device_node *ipu_drm_get_port_by_id(struct device_node *parent,
+						  int port_id)
+{
+	struct device_node *port;
+	int id, ret;
+
+	port = of_get_child_by_name(parent, "port");
+	while (port) {
+		ret = of_property_read_u32(port, "reg", &id);
+		if (!ret && id == port_id)
+			return port;
+
+		do {
+			port = of_get_next_child(parent, port);
+			if (!port)
+				return NULL;
+		} while (of_node_cmp(port->name, "port"));
+	}
+
+	return NULL;
+}
+
 static int ipu_drm_bind(struct device *dev, struct device *master, void *data)
 {
 	struct ipu_client_platformdata *pdata = dev->platform_data;
@@ -562,11 +584,23 @@ static const struct component_ops ipu_crtc_ops = {
 static int ipu_drm_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
+	struct ipu_client_platformdata *pdata = dev->platform_data;
 	int ret;
 
 	if (!dev->platform_data)
 		return -EINVAL;
 
+	if (!dev->of_node) {
+		/* Associate crtc device with the corresponding DI port node */
+		dev->of_node = ipu_drm_get_port_by_id(dev->parent->of_node,
+						      pdata->di + 2);
+		if (!dev->of_node) {
+			dev_err(dev, "missing port@%d node in %s\n",
+				pdata->di + 2, dev->parent->of_node->full_name);
+			return -ENODEV;
+		}
+	}
+
 	ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
 	if (ret)
 		return ret;
-- 
1.9.1


             reply	other threads:[~2016-05-17 17:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-17 17:11 Fabio Estevam [this message]
2016-05-18  1:02 ` [PATCH] Revert "drm/imx: Remove of_node assignment from ipuv3-crtc driver probe" Chris Ruehl
2016-05-18  8:38   ` Philipp Zabel
2016-05-18 10:51     ` Fabio Estevam
2016-05-18 12:48       ` Philipp Zabel

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=1463505092-28018-1-git-send-email-fabio.estevam@nxp.com \
    --to=fabio.estevam@nxp.com \
    --cc=airlied@linux.ie \
    --cc=chris.ruehl@gtsys.com.hk \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=lw@karo-electronics.de \
    --cc=marcel.ziswiler@toradex.com \
    --cc=p.zabel@pengutronix.de \
    --cc=stable@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox