All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
To: linux-media@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org
Subject: [PATCH/RFC 5/9] v4l: vsp1: Add FCP support
Date: Fri, 12 Feb 2016 04:00:46 +0200	[thread overview]
Message-ID: <1455242450-24493-6-git-send-email-laurent.pinchart+renesas@ideasonboard.com> (raw)
In-Reply-To: <1455242450-24493-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com>

On some platforms the VSP performs memory accesses through an FCP. When
that's the case get a reference to the FCP from the VSP DT node and
enable/disable it at runtime as needed.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 .../devicetree/bindings/media/renesas,vsp1.txt     |  5 +++++
 drivers/media/platform/Kconfig                     |  1 +
 drivers/media/platform/vsp1/vsp1.h                 |  2 ++
 drivers/media/platform/vsp1/vsp1_drv.c             | 24 +++++++++++++++++++++-
 4 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/media/renesas,vsp1.txt b/Documentation/devicetree/bindings/media/renesas,vsp1.txt
index 627405abd144..9b695bcbf219 100644
--- a/Documentation/devicetree/bindings/media/renesas,vsp1.txt
+++ b/Documentation/devicetree/bindings/media/renesas,vsp1.txt
@@ -14,6 +14,11 @@ Required properties:
   - interrupts: VSP interrupt specifier.
   - clocks: A phandle + clock-specifier pair for the VSP functional clock.
 
+Optional properties:
+
+  - renesas,fcp: A phandle referencing the FCP that handles memory accesses
+                 for the VSP. Not needed on Gen2, mandatory on Gen3.
+
 
 Example: R8A7790 (R-Car H2) VSP1-S node
 
diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index cbb4e5735bf8..b12502555544 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -272,6 +272,7 @@ config VIDEO_RENESAS_VSP1
 	tristate "Renesas VSP1 Video Processing Engine"
 	depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && HAS_DMA
 	depends on (ARCH_SHMOBILE && OF) || COMPILE_TEST
+	depends on m || VIDEO_RENESAS_FCP != m
 	select VIDEOBUF2_DMA_CONTIG
 	---help---
 	  This is a V4L2 driver for the Renesas VSP1 video processing engine.
diff --git a/drivers/media/platform/vsp1/vsp1.h b/drivers/media/platform/vsp1/vsp1.h
index 910d6b8e8b50..4316766c6489 100644
--- a/drivers/media/platform/vsp1/vsp1.h
+++ b/drivers/media/platform/vsp1/vsp1.h
@@ -25,6 +25,7 @@
 
 struct clk;
 struct device;
+struct rcar_fcp_device;
 
 struct vsp1_dl;
 struct vsp1_drm;
@@ -63,6 +64,7 @@ struct vsp1_device {
 
 	void __iomem *mmio;
 	struct clk *clock;
+	struct rcar_fcp_device *fcp;
 
 	struct mutex lock;
 	int ref_count;
diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c
index da43e3f35610..f1b8343cc166 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -21,6 +21,7 @@
 #include <linux/platform_device.h>
 #include <linux/videodev2.h>
 
+#include <media/rcar-fcp.h>
 #include <media/v4l2-subdev.h>
 
 #include "vsp1.h"
@@ -491,8 +492,11 @@ int vsp1_device_get(struct vsp1_device *vsp1)
 	if (ret < 0)
 		goto done;
 
+	rcar_fcp_enable(vsp1->fcp);
+
 	ret = vsp1_device_init(vsp1);
 	if (ret < 0) {
+		rcar_fcp_disable(vsp1->fcp);
 		clk_disable_unprepare(vsp1->clock);
 		goto done;
 	}
@@ -515,8 +519,10 @@ void vsp1_device_put(struct vsp1_device *vsp1)
 {
 	mutex_lock(&vsp1->lock);
 
-	if (--vsp1->ref_count == 0)
+	if (--vsp1->ref_count == 0) {
+		rcar_fcp_disable(vsp1->fcp);
 		clk_disable_unprepare(vsp1->clock);
+	}
 
 	mutex_unlock(&vsp1->lock);
 }
@@ -537,6 +543,7 @@ static int vsp1_pm_suspend(struct device *dev)
 
 	vsp1_pipelines_suspend(vsp1);
 
+	rcar_fcp_disable(vsp1->fcp);
 	clk_disable_unprepare(vsp1->clock);
 
 	return 0;
@@ -552,6 +559,7 @@ static int vsp1_pm_resume(struct device *dev)
 		return 0;
 
 	clk_prepare_enable(vsp1->clock);
+	rcar_fcp_enable(vsp1->fcp);
 
 	vsp1_pipelines_resume(vsp1);
 
@@ -633,6 +641,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = {
 static int vsp1_probe(struct platform_device *pdev)
 {
 	struct vsp1_device *vsp1;
+	struct device_node *fcp_node;
 	struct resource *irq;
 	struct resource *io;
 	unsigned int i;
@@ -673,6 +682,18 @@ static int vsp1_probe(struct platform_device *pdev)
 		return ret;
 	}
 
+	/* FCP (optional) */
+	fcp_node = of_parse_phandle(pdev->dev.of_node, "renesas,fcp", 0);
+	if (fcp_node) {
+		vsp1->fcp = rcar_fcp_get(fcp_node);
+		of_node_put(fcp_node);
+		if (IS_ERR(vsp1->fcp)) {
+			dev_dbg(&pdev->dev, "FCP not found (%ld)\n",
+				PTR_ERR(vsp1->fcp));
+			return PTR_ERR(vsp1->fcp);
+		}
+	}
+
 	/* Configure device parameters based on the version register. */
 	ret = clk_prepare_enable(vsp1->clock);
 	if (ret < 0)
@@ -713,6 +734,7 @@ static int vsp1_remove(struct platform_device *pdev)
 	struct vsp1_device *vsp1 = platform_get_drvdata(pdev);
 
 	vsp1_destroy_entities(vsp1);
+	rcar_fcp_put(vsp1->fcp);
 
 	return 0;
 }
-- 
2.4.10


  parent reply	other threads:[~2016-02-12  2:00 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-12  2:00 [PATCH/RFC 0/9] FCP support for Renesas video cores Laurent Pinchart
2016-02-12  2:00 ` [PATCH/RFC 1/9] clk: shmobile: r8a7795: Add FCP clocks Laurent Pinchart
2016-02-15  9:22   ` Geert Uytterhoeven
2016-02-15 12:26     ` Laurent Pinchart
2016-02-26 10:55   ` Laurent Pinchart
2016-03-01  1:03     ` Kuninori Morimoto
2016-03-03  0:17       ` Kuninori Morimoto
2016-03-03  6:52         ` Laurent Pinchart
2016-03-03  7:19           ` Kuninori Morimoto
2016-03-03  7:31             ` Laurent Pinchart
2016-03-03  8:37               ` Kuninori Morimoto
2016-03-03 10:49                 ` Laurent Pinchart
2016-03-03 11:56                   ` Geert Uytterhoeven
2016-03-03 12:04                     ` Laurent Pinchart
2016-04-12  6:27       ` Kuninori Morimoto
2016-02-12  2:00 ` [PATCH/RFC 2/9] clk: shmobile: r8a7795: Add LVDS module clock Laurent Pinchart
2016-02-15  9:24   ` Geert Uytterhoeven
2016-02-15 12:27     ` Laurent Pinchart
2016-02-12  2:00 ` [PATCH/RFC 3/9] v4l: Add Renesas R-Car FCP driver Laurent Pinchart
2016-02-15  9:32   ` Geert Uytterhoeven
2016-02-15 12:35     ` Laurent Pinchart
2016-02-26 13:20       ` Geert Uytterhoeven
2016-02-12  2:00 ` [PATCH/RFC 4/9] v4l: vsp1: VSPD instances have no LUT on Gen3 Laurent Pinchart
2016-02-12  2:00 ` Laurent Pinchart [this message]
2016-02-12  2:00 ` [PATCH/RFC 6/9] ARM64: renesas: r8a7795: Add FCPV nodes Laurent Pinchart
2016-02-15  9:45   ` Geert Uytterhoeven
2016-02-15 12:50     ` Laurent Pinchart
2016-02-12  2:00 ` [PATCH/RFC 7/9] ARM64: renesas: r8a7795: Add VSP instances Laurent Pinchart
2016-02-15  9:58   ` Geert Uytterhoeven
2016-02-15 12:53     ` Laurent Pinchart
2016-02-12  2:00 ` [PATCH/RFC 8/9] ARM64: renesas: r8a7795: Add DU device to DT Laurent Pinchart
2016-02-12  2:00 ` [PATCH/RFC 9/9] ARM64: renesas: salvator-x: Enable DU Laurent Pinchart

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=1455242450-24493-6-git-send-email-laurent.pinchart+renesas@ideasonboard.com \
    --to=laurent.pinchart+renesas@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@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 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.