linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Tretter <m.tretter@pengutronix.de>
To: linux-media@vger.kernel.org
Cc: p.zabel@pengutronix.de, Michael Tretter <m.tretter@pengutronix.de>
Subject: [PATCH 5/9] [media] coda: get VDOA device using dt phandle
Date: Thu,  8 Dec 2016 16:24:12 +0100	[thread overview]
Message-ID: <20161208152416.16031-5-m.tretter@pengutronix.de> (raw)
In-Reply-To: <20161208152416.16031-1-m.tretter@pengutronix.de>

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
 drivers/media/platform/coda/coda-common.c | 43 +++++++++++++++++++++++++++++++
 drivers/media/platform/coda/coda.h        |  1 +
 2 files changed, 44 insertions(+)

diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
index e0184194..1adb6f3 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -41,6 +41,7 @@
 #include <media/videobuf2-vmalloc.h>
 
 #include "coda.h"
+#include "imx-vdoa.h"
 
 #define CODA_NAME		"coda"
 
@@ -66,6 +67,10 @@ static int disable_tiling;
 module_param(disable_tiling, int, 0644);
 MODULE_PARM_DESC(disable_tiling, "Disable tiled frame buffers");
 
+static int disable_vdoa;
+module_param(disable_vdoa, int, 0644);
+MODULE_PARM_DESC(disable_vdoa, "Disable Video Data Order Adapter tiled to raster-scan conversion");
+
 void coda_write(struct coda_dev *dev, u32 data, u32 reg)
 {
 	v4l2_dbg(2, coda_debug, &dev->v4l2_dev,
@@ -325,6 +330,34 @@ const char *coda_product_name(int product)
 	}
 }
 
+static struct vdoa_data *coda_get_vdoa_data(struct device_node *np,
+					    const char *name)
+{
+	struct device_node *vdoa_node;
+	struct platform_device *vdoa_pdev;
+	struct vdoa_data *vdoa_data;
+
+	vdoa_node = of_parse_phandle(np, name, 0);
+	if (!vdoa_node)
+		return NULL;
+
+	vdoa_pdev = of_find_device_by_node(vdoa_node);
+	if (!vdoa_pdev) {
+		vdoa_data = NULL;
+		goto out;
+	}
+
+	vdoa_data = platform_get_drvdata(vdoa_pdev);
+	if (!vdoa_data)
+		vdoa_data = ERR_PTR(-EPROBE_DEFER);
+
+out:
+	if (vdoa_node)
+		of_node_put(vdoa_node);
+
+	return vdoa_data;
+}
+
 /*
  * V4L2 ioctl() operations.
  */
@@ -2256,6 +2289,16 @@ static int coda_probe(struct platform_device *pdev)
 	}
 	dev->iram_pool = pool;
 
+	/* Get VDOA from device tree if available */
+	if (!disable_tiling && !disable_vdoa) {
+		dev->vdoa = coda_get_vdoa_data(np, "vdoa");
+		if (PTR_ERR(dev->vdoa) == -EPROBE_DEFER)
+			return -EPROBE_DEFER;
+		if (!dev->vdoa)
+			dev_info(&pdev->dev,
+				 "vdoa not available; not using tiled intermediate format");
+	}
+
 	ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev);
 	if (ret)
 		return ret;
diff --git a/drivers/media/platform/coda/coda.h b/drivers/media/platform/coda/coda.h
index 53f9666..ae202dc 100644
--- a/drivers/media/platform/coda/coda.h
+++ b/drivers/media/platform/coda/coda.h
@@ -75,6 +75,7 @@ struct coda_dev {
 	struct platform_device	*plat_dev;
 	const struct coda_devtype *devtype;
 	int			firmware;
+	struct vdoa_data	*vdoa;
 
 	void __iomem		*regs_base;
 	struct clk		*clk_per;
-- 
2.10.2


  parent reply	other threads:[~2016-12-08 15:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-08 15:24 [PATCH 1/9] ARM: dts: imx6qdl: Add VDOA compatible and clocks properties Michael Tretter
2016-12-08 15:24 ` [PATCH 2/9] [media] coda: add i.MX6 VDOA driver Michael Tretter
2016-12-08 15:24 ` [PATCH 3/9] ARM: dts: imx6qdl: Add VDOA phandle to CODA node Michael Tretter
2016-12-08 15:24 ` [PATCH 4/9] [media] coda: correctly set capture compose rectangle Michael Tretter
2016-12-08 15:24 ` Michael Tretter [this message]
2016-12-08 15:50   ` [PATCH 5/9] [media] coda: get VDOA device using dt phandle Philipp Zabel
2016-12-08 15:24 ` [PATCH 6/9] [media] coda: add debug output about tiling Michael Tretter
2016-12-08 15:24 ` [PATCH 7/9] [media] coda: fix frame index to returned error Michael Tretter
2016-12-08 15:53   ` Philipp Zabel
2016-12-08 15:24 ` [PATCH 8/9] [media] coda: use VDOA for un-tiling custom macroblock format Michael Tretter
2016-12-08 15:58   ` Philipp Zabel
2016-12-08 15:24 ` [PATCH 9/9] [media] coda: support YUYV output if VDOA is used Michael Tretter
2016-12-08 16:00   ` 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=20161208152416.16031-5-m.tretter@pengutronix.de \
    --to=m.tretter@pengutronix.de \
    --cc=linux-media@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).