All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/13] R-Car VSP improvements for v4.7 - Round 2
@ 2016-04-25 21:36 Laurent Pinchart
  2016-04-25 21:36 ` [PATCH v2 01/13] dt-bindings: Add Renesas R-Car FCP DT bindings Laurent Pinchart
                   ` (12 more replies)
  0 siblings, 13 replies; 26+ messages in thread
From: Laurent Pinchart @ 2016-04-25 21:36 UTC (permalink / raw)
  To: linux-media; +Cc: linux-renesas-soc, devicetree, dri-devel, Dave Airlie

Hello,

This patch series is the second version of the second (and most probably last)
round of vsp1 driver improvements for v4.7. In particular, it enables runtime
PM support (03/13 and 04/13), adds support for the FCP (01/13, 02/13 and
05/13), prepare for HGO (histogram) support (06/13 to 09/13) and update the
API towards the DRM driver (10/13 to 13/13).

The FCP is a companion module of video processing modules in the Renesas R-Car
Gen3 SoCs. It provides data compression and decompression, data caching, and
conversion of AXI transaction in order to reduce the memory bandwidth. The FCP
driver is not meant to be used standalone but provides an API to the video
processing modules to control the FCP.

The API towards the DRM driver is updated to store all configuration
parameters in a structure in order to improve readability and make future
updates easier. This series contain two R-Car DU DRM patches that update the
DU DRM driver to the new API. They would normally be merged through Dave
Airlie's tree, but due to dependencies on VSP1 patches queued up for v4.7 Dave
agreed to get them merged through the linux-media tree (hence his Acked-by for
the two patches). They should not conflict with any patch queued up for v4.7
through Dave's tree.

Note that patch 10/13 adds some macro magic to make the API transition easier.
Depending on your taste you will find the implementation beautiful or ugly,
but in any case patch 13/13 removes the macros and inline wrapper.

The code is based on top of the latest linux-media master branch. For
convenience I've pushed the patches to the following git tree branch.
patches on top of the latest Linux media master branch to

        git://linuxtv.org/pinchartl/media.git vsp1/next

Changes since v1:

- Fixed typos
- Made rcar_fcp_enable() return a status
- Dropped the unneeded dependency on PM for the VSP driver

Cc: devicetree@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: Dave Airlie <airlied@redhat.com>

Laurent Pinchart (13):
  dt-bindings: Add Renesas R-Car FCP DT bindings
  v4l: Add Renesas R-Car FCP driver
  v4l: vsp1: Implement runtime PM support
  v4l: vsp1: Don't handle clocks manually
  v4l: vsp1: Add FCP support
  v4l: vsp1: Add output node value to routing table
  v4l: vsp1: Replace container_of() with dedicated macro
  v4l: vsp1: Make vsp1_entity_get_pad_compose() more generic
  v4l: vsp1: Move frame sequence number from video node to pipeline
  v4l: vsp1: Group DRM RPF parameters in a structure
  drm: rcar-du: Add alpha support for VSP planes
  drm: rcar-du: Add Z-order support for VSP planes
  v4l: vsp1: Remove deprecated DRM API

 .../devicetree/bindings/media/renesas,fcp.txt      |  31 ++++
 .../devicetree/bindings/media/renesas,vsp1.txt     |   5 +
 MAINTAINERS                                        |  10 ++
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c              |  45 ++---
 drivers/gpu/drm/rcar-du/rcar_du_vsp.h              |   2 +
 drivers/media/platform/Kconfig                     |  14 ++
 drivers/media/platform/Makefile                    |   1 +
 drivers/media/platform/rcar-fcp.c                  | 181 +++++++++++++++++++++
 drivers/media/platform/vsp1/vsp1.h                 |   6 +-
 drivers/media/platform/vsp1/vsp1_drm.c             |  68 ++++----
 drivers/media/platform/vsp1/vsp1_drv.c             | 120 +++++++-------
 drivers/media/platform/vsp1/vsp1_entity.c          |  86 +++++++---
 drivers/media/platform/vsp1/vsp1_entity.h          |  12 +-
 drivers/media/platform/vsp1/vsp1_pipe.c            |   4 +-
 drivers/media/platform/vsp1/vsp1_pipe.h            |   2 +
 drivers/media/platform/vsp1/vsp1_rpf.c             |   7 +-
 drivers/media/platform/vsp1/vsp1_video.c           |   4 +-
 drivers/media/platform/vsp1/vsp1_video.h           |   1 -
 include/media/rcar-fcp.h                           |  37 +++++
 include/media/vsp1.h                               |  29 ++--
 20 files changed, 494 insertions(+), 171 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/renesas,fcp.txt
 create mode 100644 drivers/media/platform/rcar-fcp.c
 create mode 100644 include/media/rcar-fcp.h

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH v2 01/13] dt-bindings: Add Renesas R-Car FCP DT bindings
  2016-04-25 21:36 [PATCH v2 00/13] R-Car VSP improvements for v4.7 - Round 2 Laurent Pinchart
@ 2016-04-25 21:36 ` Laurent Pinchart
  2016-04-28  2:54   ` Rob Herring
       [not found]   ` <1461620198-13428-2-git-send-email-laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
  2016-04-25 21:36 ` [PATCH v2 02/13] v4l: Add Renesas R-Car FCP driver Laurent Pinchart
                   ` (11 subsequent siblings)
  12 siblings, 2 replies; 26+ messages in thread
From: Laurent Pinchart @ 2016-04-25 21:36 UTC (permalink / raw)
  To: linux-media; +Cc: linux-renesas-soc, devicetree

The FCP is a companion module of video processing modules in the Renesas
R-Car Gen3 SoCs. It provides data compression and decompression, data
caching, and conversion of AXI transactions in order to reduce the
memory bandwidth.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 .../devicetree/bindings/media/renesas,fcp.txt      | 31 ++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/renesas,fcp.txt

Cc: devicetree@vger.kernel.org

diff --git a/Documentation/devicetree/bindings/media/renesas,fcp.txt b/Documentation/devicetree/bindings/media/renesas,fcp.txt
new file mode 100644
index 000000000000..0c72ca24379f
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/renesas,fcp.txt
@@ -0,0 +1,31 @@
+Renesas R-Car Frame Compression Processor (FCP)
+-----------------------------------------------
+
+The FCP is a companion module of video processing modules in the Renesas R-Car
+Gen3 SoCs. It provides data compression and decompression, data caching, and
+conversion of AXI transactions in order to reduce the memory bandwidth.
+
+There are three types of FCP whose configuration and behaviour highly depend
+on the module they are paired with.
+
+ - compatible: Must be one or more of the following
+
+   - "renesas,r8a7795-fcpv" for R8A7795 (R-Car H3) compatible 'FCP for VSP'
+   - "renesas,fcpv" for generic compatible 'FCP for VSP'
+
+   When compatible with the generic version, nodes must list the
+   SoC-specific version corresponding to the platform first, followed by the
+   family-specific and/or generic versions.
+
+ - reg: the register base and size for the device registers
+ - clocks: Reference to the functional clock
+
+
+Device node example
+-------------------
+
+	fcpvd1: fcp@fea2f000 {
+		compatible = "renesas,r8a7795-fcpv", "renesas,fcpv";
+		reg = <0 0xfea2f000 0 0x200>;
+		clocks = <&cpg CPG_MOD 602>;
+	};
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2 02/13] v4l: Add Renesas R-Car FCP driver
  2016-04-25 21:36 [PATCH v2 00/13] R-Car VSP improvements for v4.7 - Round 2 Laurent Pinchart
  2016-04-25 21:36 ` [PATCH v2 01/13] dt-bindings: Add Renesas R-Car FCP DT bindings Laurent Pinchart
@ 2016-04-25 21:36 ` Laurent Pinchart
  2016-04-25 21:36 ` [PATCH v2 03/13] v4l: vsp1: Implement runtime PM support Laurent Pinchart
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Laurent Pinchart @ 2016-04-25 21:36 UTC (permalink / raw)
  To: linux-media; +Cc: linux-renesas-soc

The FCP is a companion module of video processing modules in the
Renesas R-Car Gen3 SoCs. It provides data compression and decompression,
data caching, and conversion of AXI transactions in order to reduce the
memory bandwidth.

The driver is not meant to be used standalone but provides an API to the
video processing modules to control the FCP.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 MAINTAINERS                       |  10 +++
 drivers/media/platform/Kconfig    |  13 +++
 drivers/media/platform/Makefile   |   1 +
 drivers/media/platform/rcar-fcp.c | 181 ++++++++++++++++++++++++++++++++++++++
 include/media/rcar-fcp.h          |  37 ++++++++
 5 files changed, 242 insertions(+)
 create mode 100644 drivers/media/platform/rcar-fcp.c
 create mode 100644 include/media/rcar-fcp.h

diff --git a/MAINTAINERS b/MAINTAINERS
index bfcb7ea42e20..88513e3eb35b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7049,6 +7049,16 @@ L:	linux-iio@vger.kernel.org
 S:	Maintained
 F:	drivers/iio/potentiometer/mcp4531.c
 
+MEDIA DRIVERS FOR RENESAS - FCP
+M:	Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+L:	linux-media@vger.kernel.org
+L:	linux-renesas-soc@vger.kernel.org
+T:	git git://linuxtv.org/media_tree.git
+S:	Supported
+F:	Documentation/devicetree/bindings/media/renesas,fcp.txt
+F:	drivers/media/platform/rcar-fcp.c
+F:	include/media/rcar-fcp.h
+
 MEDIA DRIVERS FOR RENESAS - VSP1
 M:	Laurent Pinchart <laurent.pinchart@ideasonboard.com>
 L:	linux-media@vger.kernel.org
diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index 84e041c0a70e..f453910050be 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -247,6 +247,19 @@ config VIDEO_RENESAS_JPU
 	  To compile this driver as a module, choose M here: the module
 	  will be called rcar_jpu.
 
+config VIDEO_RENESAS_FCP
+	tristate "Renesas Frame Compression Processor"
+	depends on ARCH_RENESAS || COMPILE_TEST
+	depends on OF
+	---help---
+	  This is a driver for the Renesas Frame Compression Processor (FCP).
+	  The FCP is a companion module of video processing modules in the
+	  Renesas R-Car Gen3 SoCs. It handles memory access for the codec,
+	  VSP and FDP modules.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called rcar-fcp.
+
 config VIDEO_RENESAS_VSP1
 	tristate "Renesas VSP1 Video Processing Engine"
 	depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && HAS_DMA
diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile
index bbb7bd1eb268..befc4f97057c 100644
--- a/drivers/media/platform/Makefile
+++ b/drivers/media/platform/Makefile
@@ -46,6 +46,7 @@ obj-$(CONFIG_VIDEO_SH_VOU)		+= sh_vou.o
 
 obj-$(CONFIG_SOC_CAMERA)		+= soc_camera/
 
+obj-$(CONFIG_VIDEO_RENESAS_FCP) 	+= rcar-fcp.o
 obj-$(CONFIG_VIDEO_RENESAS_JPU) 	+= rcar_jpu.o
 obj-$(CONFIG_VIDEO_RENESAS_VSP1)	+= vsp1/
 
diff --git a/drivers/media/platform/rcar-fcp.c b/drivers/media/platform/rcar-fcp.c
new file mode 100644
index 000000000000..6a7bcc3028b1
--- /dev/null
+++ b/drivers/media/platform/rcar-fcp.c
@@ -0,0 +1,181 @@
+/*
+ * rcar-fcp.c  --  R-Car Frame Compression Processor Driver
+ *
+ * Copyright (C) 2016 Renesas Electronics Corporation
+ *
+ * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/device.h>
+#include <linux/list.h>
+#include <linux/module.h>
+#include <linux/mutex.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+#include <linux/slab.h>
+
+#include <media/rcar-fcp.h>
+
+struct rcar_fcp_device {
+	struct list_head list;
+	struct device *dev;
+};
+
+static LIST_HEAD(fcp_devices);
+static DEFINE_MUTEX(fcp_lock);
+
+/* -----------------------------------------------------------------------------
+ * Public API
+ */
+
+/**
+ * rcar_fcp_get - Find and acquire a reference to an FCP instance
+ * @np: Device node of the FCP instance
+ *
+ * Search the list of registered FCP instances for the instance corresponding to
+ * the given device node.
+ *
+ * Return a pointer to the FCP instance, or an ERR_PTR if the instance can't be
+ * found.
+ */
+struct rcar_fcp_device *rcar_fcp_get(const struct device_node *np)
+{
+	struct rcar_fcp_device *fcp;
+
+	mutex_lock(&fcp_lock);
+
+	list_for_each_entry(fcp, &fcp_devices, list) {
+		if (fcp->dev->of_node != np)
+			continue;
+
+		/*
+		 * Make sure the module won't be unloaded behind our back. This
+		 * is a poor man's safety net, the module should really not be
+		 * unloaded while FCP users can be active.
+		 */
+		if (!try_module_get(fcp->dev->driver->owner))
+			fcp = NULL;
+
+		goto done;
+	}
+
+	fcp = ERR_PTR(-EPROBE_DEFER);
+
+done:
+	mutex_unlock(&fcp_lock);
+	return fcp;
+}
+EXPORT_SYMBOL_GPL(rcar_fcp_get);
+
+/**
+ * rcar_fcp_put - Release a reference to an FCP instance
+ * @fcp: The FCP instance
+ *
+ * Release the FCP instance acquired by a call to rcar_fcp_get().
+ */
+void rcar_fcp_put(struct rcar_fcp_device *fcp)
+{
+	if (fcp)
+		module_put(fcp->dev->driver->owner);
+}
+EXPORT_SYMBOL_GPL(rcar_fcp_put);
+
+/**
+ * rcar_fcp_enable - Enable an FCP
+ * @fcp: The FCP instance
+ *
+ * Before any memory access through an FCP is performed by a module, the FCP
+ * must be enabled by a call to this function. The enable calls are reference
+ * counted, each successful call must be followed by one rcar_fcp_disable()
+ * call when no more memory transfer can occur through the FCP.
+ *
+ * Return 0 on success or a negative error code if an error occurs. The enable
+ * reference count isn't increased when this function returns an error.
+ */
+int rcar_fcp_enable(struct rcar_fcp_device *fcp)
+{
+	if (!fcp)
+		return 0;
+
+	return pm_runtime_get_sync(fcp->dev);
+}
+EXPORT_SYMBOL_GPL(rcar_fcp_enable);
+
+/**
+ * rcar_fcp_disable - Disable an FCP
+ * @fcp: The FCP instance
+ *
+ * This function is the counterpart of rcar_fcp_enable(). As enable calls are
+ * reference counted a disable call may not disable the FCP synchronously.
+ */
+void rcar_fcp_disable(struct rcar_fcp_device *fcp)
+{
+	if (fcp)
+		pm_runtime_put(fcp->dev);
+}
+EXPORT_SYMBOL_GPL(rcar_fcp_disable);
+
+/* -----------------------------------------------------------------------------
+ * Platform Driver
+ */
+
+static int rcar_fcp_probe(struct platform_device *pdev)
+{
+	struct rcar_fcp_device *fcp;
+
+	fcp = devm_kzalloc(&pdev->dev, sizeof(*fcp), GFP_KERNEL);
+	if (fcp == NULL)
+		return -ENOMEM;
+
+	fcp->dev = &pdev->dev;
+
+	pm_runtime_enable(&pdev->dev);
+
+	mutex_lock(&fcp_lock);
+	list_add_tail(&fcp->list, &fcp_devices);
+	mutex_unlock(&fcp_lock);
+
+	platform_set_drvdata(pdev, fcp);
+
+	return 0;
+}
+
+static int rcar_fcp_remove(struct platform_device *pdev)
+{
+	struct rcar_fcp_device *fcp = platform_get_drvdata(pdev);
+
+	mutex_lock(&fcp_lock);
+	list_del(&fcp->list);
+	mutex_unlock(&fcp_lock);
+
+	pm_runtime_disable(&pdev->dev);
+
+	return 0;
+}
+
+static const struct of_device_id rcar_fcp_of_match[] = {
+	{ .compatible = "renesas,fcpv" },
+	{ },
+};
+
+static struct platform_driver rcar_fcp_platform_driver = {
+	.probe		= rcar_fcp_probe,
+	.remove		= rcar_fcp_remove,
+	.driver		= {
+		.name	= "rcar-fcp",
+		.of_match_table = rcar_fcp_of_match,
+		.suppress_bind_attrs = true,
+	},
+};
+
+module_platform_driver(rcar_fcp_platform_driver);
+
+MODULE_ALIAS("rcar-fcp");
+MODULE_AUTHOR("Laurent Pinchart <laurent.pinchart@ideasonboard.com>");
+MODULE_DESCRIPTION("Renesas FCP Driver");
+MODULE_LICENSE("GPL");
diff --git a/include/media/rcar-fcp.h b/include/media/rcar-fcp.h
new file mode 100644
index 000000000000..4c7fc77eaf29
--- /dev/null
+++ b/include/media/rcar-fcp.h
@@ -0,0 +1,37 @@
+/*
+ * rcar-fcp.h  --  R-Car Frame Compression Processor Driver
+ *
+ * Copyright (C) 2016 Renesas Electronics Corporation
+ *
+ * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+#ifndef __MEDIA_RCAR_FCP_H__
+#define __MEDIA_RCAR_FCP_H__
+
+struct device_node;
+struct rcar_fcp_device;
+
+#if IS_ENABLED(CONFIG_VIDEO_RENESAS_FCP)
+struct rcar_fcp_device *rcar_fcp_get(const struct device_node *np);
+void rcar_fcp_put(struct rcar_fcp_device *fcp);
+int rcar_fcp_enable(struct rcar_fcp_device *fcp);
+void rcar_fcp_disable(struct rcar_fcp_device *fcp);
+#else
+static inline struct rcar_fcp_device *rcar_fcp_get(const struct device_node *np)
+{
+	return ERR_PTR(-ENOENT);
+}
+static inline void rcar_fcp_put(struct rcar_fcp_device *fcp) { }
+static inline int rcar_fcp_enable(struct rcar_fcp_device *fcp)
+{
+	return -ENOSYS;
+}
+static inline void rcar_fcp_disable(struct rcar_fcp_device *fcp) { }
+#endif
+
+#endif /* __MEDIA_RCAR_FCP_H__ */
-- 
2.7.3


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2 03/13] v4l: vsp1: Implement runtime PM support
  2016-04-25 21:36 [PATCH v2 00/13] R-Car VSP improvements for v4.7 - Round 2 Laurent Pinchart
  2016-04-25 21:36 ` [PATCH v2 01/13] dt-bindings: Add Renesas R-Car FCP DT bindings Laurent Pinchart
  2016-04-25 21:36 ` [PATCH v2 02/13] v4l: Add Renesas R-Car FCP driver Laurent Pinchart
@ 2016-04-25 21:36 ` Laurent Pinchart
  2016-04-25 21:36 ` [PATCH v2 04/13] v4l: vsp1: Don't handle clocks manually Laurent Pinchart
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Laurent Pinchart @ 2016-04-25 21:36 UTC (permalink / raw)
  To: linux-media; +Cc: linux-renesas-soc

Replace the manual refcount and clock management code by runtime PM.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/media/platform/vsp1/vsp1.h      |   3 -
 drivers/media/platform/vsp1/vsp1_drv.c  | 101 ++++++++++++++++----------------
 drivers/media/platform/vsp1/vsp1_pipe.c |   2 +-
 3 files changed, 53 insertions(+), 53 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1.h b/drivers/media/platform/vsp1/vsp1.h
index 46738b6c5f72..9e09bce43cf3 100644
--- a/drivers/media/platform/vsp1/vsp1.h
+++ b/drivers/media/platform/vsp1/vsp1.h
@@ -64,9 +64,6 @@ struct vsp1_device {
 	void __iomem *mmio;
 	struct clk *clock;
 
-	struct mutex lock;
-	int ref_count;
-
 	struct vsp1_bru *bru;
 	struct vsp1_hsit *hsi;
 	struct vsp1_hsit *hst;
diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c
index e2d779fac0eb..d6abc7f1216a 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -19,6 +19,7 @@
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/videodev2.h>
 
 #include <media/v4l2-subdev.h>
@@ -462,35 +463,16 @@ static int vsp1_device_init(struct vsp1_device *vsp1)
 /*
  * vsp1_device_get - Acquire the VSP1 device
  *
- * Increment the VSP1 reference count and initialize the device if the first
- * reference is taken.
+ * Make sure the device is not suspended and initialize it if needed.
  *
  * Return 0 on success or a negative error code otherwise.
  */
 int vsp1_device_get(struct vsp1_device *vsp1)
 {
-	int ret = 0;
-
-	mutex_lock(&vsp1->lock);
-	if (vsp1->ref_count > 0)
-		goto done;
-
-	ret = clk_prepare_enable(vsp1->clock);
-	if (ret < 0)
-		goto done;
-
-	ret = vsp1_device_init(vsp1);
-	if (ret < 0) {
-		clk_disable_unprepare(vsp1->clock);
-		goto done;
-	}
-
-done:
-	if (!ret)
-		vsp1->ref_count++;
+	int ret;
 
-	mutex_unlock(&vsp1->lock);
-	return ret;
+	ret = pm_runtime_get_sync(vsp1->dev);
+	return ret < 0 ? ret : 0;
 }
 
 /*
@@ -501,12 +483,7 @@ done:
  */
 void vsp1_device_put(struct vsp1_device *vsp1)
 {
-	mutex_lock(&vsp1->lock);
-
-	if (--vsp1->ref_count == 0)
-		clk_disable_unprepare(vsp1->clock);
-
-	mutex_unlock(&vsp1->lock);
+	pm_runtime_put_sync(vsp1->dev);
 }
 
 /* -----------------------------------------------------------------------------
@@ -518,37 +495,55 @@ static int vsp1_pm_suspend(struct device *dev)
 {
 	struct vsp1_device *vsp1 = dev_get_drvdata(dev);
 
-	WARN_ON(mutex_is_locked(&vsp1->lock));
+	vsp1_pipelines_suspend(vsp1);
+	pm_runtime_force_suspend(vsp1->dev);
 
-	if (vsp1->ref_count == 0)
-		return 0;
+	return 0;
+}
 
-	vsp1_pipelines_suspend(vsp1);
+static int vsp1_pm_resume(struct device *dev)
+{
+	struct vsp1_device *vsp1 = dev_get_drvdata(dev);
 
-	clk_disable_unprepare(vsp1->clock);
+	pm_runtime_force_resume(vsp1->dev);
+	vsp1_pipelines_resume(vsp1);
 
 	return 0;
 }
+#endif
 
-static int vsp1_pm_resume(struct device *dev)
+static int vsp1_pm_runtime_suspend(struct device *dev)
 {
 	struct vsp1_device *vsp1 = dev_get_drvdata(dev);
 
-	WARN_ON(mutex_is_locked(&vsp1->lock));
+	clk_disable_unprepare(vsp1->clock);
 
-	if (vsp1->ref_count == 0)
-		return 0;
+	return 0;
+}
 
-	clk_prepare_enable(vsp1->clock);
+static int vsp1_pm_runtime_resume(struct device *dev)
+{
+	struct vsp1_device *vsp1 = dev_get_drvdata(dev);
+	int ret;
 
-	vsp1_pipelines_resume(vsp1);
+	ret = clk_prepare_enable(vsp1->clock);
+	if (ret < 0)
+		return ret;
+
+	if (vsp1->info) {
+		ret = vsp1_device_init(vsp1);
+		if (ret < 0) {
+			clk_disable_unprepare(vsp1->clock);
+			return ret;
+		}
+	}
 
 	return 0;
 }
-#endif
 
 static const struct dev_pm_ops vsp1_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(vsp1_pm_suspend, vsp1_pm_resume)
+	SET_RUNTIME_PM_OPS(vsp1_pm_runtime_suspend, vsp1_pm_runtime_resume, NULL)
 };
 
 /* -----------------------------------------------------------------------------
@@ -640,10 +635,11 @@ static int vsp1_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	vsp1->dev = &pdev->dev;
-	mutex_init(&vsp1->lock);
 	INIT_LIST_HEAD(&vsp1->entities);
 	INIT_LIST_HEAD(&vsp1->videos);
 
+	platform_set_drvdata(pdev, vsp1);
+
 	/* I/O, IRQ and clock resources */
 	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	vsp1->mmio = devm_ioremap_resource(&pdev->dev, io);
@@ -670,12 +666,14 @@ static int vsp1_probe(struct platform_device *pdev)
 	}
 
 	/* Configure device parameters based on the version register. */
-	ret = clk_prepare_enable(vsp1->clock);
+	pm_runtime_enable(&pdev->dev);
+
+	ret = pm_runtime_get_sync(&pdev->dev);
 	if (ret < 0)
-		return ret;
+		goto done;
 
 	version = vsp1_read(vsp1, VI6_IP_VERSION);
-	clk_disable_unprepare(vsp1->clock);
+	pm_runtime_put_sync(&pdev->dev);
 
 	for (i = 0; i < ARRAY_SIZE(vsp1_device_infos); ++i) {
 		if ((version & VI6_IP_VERSION_MODEL_MASK) ==
@@ -687,7 +685,8 @@ static int vsp1_probe(struct platform_device *pdev)
 
 	if (!vsp1->info) {
 		dev_err(&pdev->dev, "unsupported IP version 0x%08x\n", version);
-		return -ENXIO;
+		ret = -ENXIO;
+		goto done;
 	}
 
 	dev_dbg(&pdev->dev, "IP version 0x%08x\n", version);
@@ -696,12 +695,14 @@ static int vsp1_probe(struct platform_device *pdev)
 	ret = vsp1_create_entities(vsp1);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "failed to create entities\n");
-		return ret;
+		goto done;
 	}
 
-	platform_set_drvdata(pdev, vsp1);
+done:
+	if (ret)
+		pm_runtime_disable(&pdev->dev);
 
-	return 0;
+	return ret;
 }
 
 static int vsp1_remove(struct platform_device *pdev)
@@ -710,6 +711,8 @@ static int vsp1_remove(struct platform_device *pdev)
 
 	vsp1_destroy_entities(vsp1);
 
+	pm_runtime_disable(&pdev->dev);
+
 	return 0;
 }
 
diff --git a/drivers/media/platform/vsp1/vsp1_pipe.c b/drivers/media/platform/vsp1/vsp1_pipe.c
index 4f3b4a1d028a..0c1dc80eb304 100644
--- a/drivers/media/platform/vsp1/vsp1_pipe.c
+++ b/drivers/media/platform/vsp1/vsp1_pipe.c
@@ -383,7 +383,7 @@ void vsp1_pipelines_resume(struct vsp1_device *vsp1)
 {
 	unsigned int i;
 
-	/* Resume pipeline all running pipelines. */
+	/* Resume all running pipelines. */
 	for (i = 0; i < vsp1->info->wpf_count; ++i) {
 		struct vsp1_rwpf *wpf = vsp1->wpf[i];
 		struct vsp1_pipeline *pipe;
-- 
2.7.3


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2 04/13] v4l: vsp1: Don't handle clocks manually
  2016-04-25 21:36 [PATCH v2 00/13] R-Car VSP improvements for v4.7 - Round 2 Laurent Pinchart
                   ` (2 preceding siblings ...)
  2016-04-25 21:36 ` [PATCH v2 03/13] v4l: vsp1: Implement runtime PM support Laurent Pinchart
@ 2016-04-25 21:36 ` Laurent Pinchart
  2016-04-25 21:36 ` [PATCH v2 05/13] v4l: vsp1: Add FCP support Laurent Pinchart
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Laurent Pinchart @ 2016-04-25 21:36 UTC (permalink / raw)
  To: linux-media; +Cc: linux-renesas-soc

The power domain performs functional clock handling when using runtime
PM, there's no need to enable and disable the clock manually.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/media/platform/vsp1/vsp1.h     |  1 -
 drivers/media/platform/vsp1/vsp1_drv.c | 20 ++------------------
 2 files changed, 2 insertions(+), 19 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1.h b/drivers/media/platform/vsp1/vsp1.h
index 9e09bce43cf3..37cc05e34de0 100644
--- a/drivers/media/platform/vsp1/vsp1.h
+++ b/drivers/media/platform/vsp1/vsp1.h
@@ -62,7 +62,6 @@ struct vsp1_device {
 	const struct vsp1_device_info *info;
 
 	void __iomem *mmio;
-	struct clk *clock;
 
 	struct vsp1_bru *bru;
 	struct vsp1_hsit *hsi;
diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c
index d6abc7f1216a..13907d4f08af 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -514,10 +514,6 @@ static int vsp1_pm_resume(struct device *dev)
 
 static int vsp1_pm_runtime_suspend(struct device *dev)
 {
-	struct vsp1_device *vsp1 = dev_get_drvdata(dev);
-
-	clk_disable_unprepare(vsp1->clock);
-
 	return 0;
 }
 
@@ -526,16 +522,10 @@ static int vsp1_pm_runtime_resume(struct device *dev)
 	struct vsp1_device *vsp1 = dev_get_drvdata(dev);
 	int ret;
 
-	ret = clk_prepare_enable(vsp1->clock);
-	if (ret < 0)
-		return ret;
-
 	if (vsp1->info) {
 		ret = vsp1_device_init(vsp1);
-		if (ret < 0) {
-			clk_disable_unprepare(vsp1->clock);
+		if (ret < 0)
 			return ret;
-		}
 	}
 
 	return 0;
@@ -640,18 +630,12 @@ static int vsp1_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, vsp1);
 
-	/* I/O, IRQ and clock resources */
+	/* I/O and IRQ resources (clock managed by the clock PM domain) */
 	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	vsp1->mmio = devm_ioremap_resource(&pdev->dev, io);
 	if (IS_ERR(vsp1->mmio))
 		return PTR_ERR(vsp1->mmio);
 
-	vsp1->clock = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(vsp1->clock)) {
-		dev_err(&pdev->dev, "failed to get clock\n");
-		return PTR_ERR(vsp1->clock);
-	}
-
 	irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 	if (!irq) {
 		dev_err(&pdev->dev, "missing IRQ\n");
-- 
2.7.3


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2 05/13] v4l: vsp1: Add FCP support
  2016-04-25 21:36 [PATCH v2 00/13] R-Car VSP improvements for v4.7 - Round 2 Laurent Pinchart
                   ` (3 preceding siblings ...)
  2016-04-25 21:36 ` [PATCH v2 04/13] v4l: vsp1: Don't handle clocks manually Laurent Pinchart
@ 2016-04-25 21:36 ` Laurent Pinchart
  2016-06-17 11:07   ` Mauro Carvalho Chehab
  2016-04-25 21:36 ` [PATCH v2 06/13] v4l: vsp1: Add output node value to routing table Laurent Pinchart
                   ` (7 subsequent siblings)
  12 siblings, 1 reply; 26+ messages in thread
From: Laurent Pinchart @ 2016-04-25 21:36 UTC (permalink / raw)
  To: linux-media; +Cc: linux-renesas-soc

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              | 21 ++++++++++++++++++++-
 4 files changed, 28 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 f453910050be..a3304466e628 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -264,6 +264,7 @@ config VIDEO_RENESAS_VSP1
 	tristate "Renesas VSP1 Video Processing Engine"
 	depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && HAS_DMA
 	depends on (ARCH_RENESAS && OF) || COMPILE_TEST
+	depends on !ARM64 || VIDEO_RENESAS_FCP
 	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 37cc05e34de0..7cb0f5e428df 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_drm;
 struct vsp1_entity;
@@ -62,6 +63,7 @@ struct vsp1_device {
 	const struct vsp1_device_info *info;
 
 	void __iomem *mmio;
+	struct rcar_fcp_device *fcp;
 
 	struct vsp1_bru *bru;
 	struct vsp1_hsit *hsi;
diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c
index 13907d4f08af..e655639af7e2 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -22,6 +22,7 @@
 #include <linux/pm_runtime.h>
 #include <linux/videodev2.h>
 
+#include <media/rcar-fcp.h>
 #include <media/v4l2-subdev.h>
 
 #include "vsp1.h"
@@ -514,6 +515,10 @@ static int vsp1_pm_resume(struct device *dev)
 
 static int vsp1_pm_runtime_suspend(struct device *dev)
 {
+	struct vsp1_device *vsp1 = dev_get_drvdata(dev);
+
+	rcar_fcp_disable(vsp1->fcp);
+
 	return 0;
 }
 
@@ -528,7 +533,7 @@ static int vsp1_pm_runtime_resume(struct device *dev)
 			return ret;
 	}
 
-	return 0;
+	return rcar_fcp_enable(vsp1->fcp);
 }
 
 static const struct dev_pm_ops vsp1_pm_ops = {
@@ -614,6 +619,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;
@@ -649,6 +655,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. */
 	pm_runtime_enable(&pdev->dev);
 
@@ -694,6 +712,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);
 
 	pm_runtime_disable(&pdev->dev);
 
-- 
2.7.3


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2 06/13] v4l: vsp1: Add output node value to routing table
  2016-04-25 21:36 [PATCH v2 00/13] R-Car VSP improvements for v4.7 - Round 2 Laurent Pinchart
                   ` (4 preceding siblings ...)
  2016-04-25 21:36 ` [PATCH v2 05/13] v4l: vsp1: Add FCP support Laurent Pinchart
@ 2016-04-25 21:36 ` Laurent Pinchart
  2016-04-25 21:36 ` [PATCH v2 07/13] v4l: vsp1: Replace container_of() with dedicated macro Laurent Pinchart
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Laurent Pinchart @ 2016-04-25 21:36 UTC (permalink / raw)
  To: linux-media; +Cc: linux-renesas-soc

The output node value indicates the value to be used in a sampling point
register to use the node as the source of histogram data.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/media/platform/vsp1/vsp1_entity.c | 52 ++++++++++++++++++++-----------
 drivers/media/platform/vsp1/vsp1_entity.h |  6 +++-
 2 files changed, 39 insertions(+), 19 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_entity.c b/drivers/media/platform/vsp1/vsp1_entity.c
index 3d070bcc6053..6a96ea77de69 100644
--- a/drivers/media/platform/vsp1/vsp1_entity.c
+++ b/drivers/media/platform/vsp1/vsp1_entity.c
@@ -274,28 +274,44 @@ int vsp1_entity_link_setup(struct media_entity *entity,
  * Initialization
  */
 
+#define VSP1_ENTITY_ROUTE(ent)						\
+	{ VSP1_ENTITY_##ent, 0, VI6_DPR_##ent##_ROUTE,			\
+	  { VI6_DPR_NODE_##ent }, VI6_DPR_NODE_##ent }
+
+#define VSP1_ENTITY_ROUTE_RPF(idx)					\
+	{ VSP1_ENTITY_RPF, idx, VI6_DPR_RPF_ROUTE(idx),			\
+	  { 0, }, VI6_DPR_NODE_RPF(idx) }
+
+#define VSP1_ENTITY_ROUTE_UDS(idx)					\
+	{ VSP1_ENTITY_UDS, idx, VI6_DPR_UDS_ROUTE(idx),			\
+	  { VI6_DPR_NODE_UDS(idx) }, VI6_DPR_NODE_UDS(idx) }
+
+#define VSP1_ENTITY_ROUTE_WPF(idx)					\
+	{ VSP1_ENTITY_WPF, idx, 0,					\
+	  { VI6_DPR_NODE_WPF(idx) }, VI6_DPR_NODE_WPF(idx) }
+
 static const struct vsp1_route vsp1_routes[] = {
 	{ VSP1_ENTITY_BRU, 0, VI6_DPR_BRU_ROUTE,
 	  { VI6_DPR_NODE_BRU_IN(0), VI6_DPR_NODE_BRU_IN(1),
 	    VI6_DPR_NODE_BRU_IN(2), VI6_DPR_NODE_BRU_IN(3),
-	    VI6_DPR_NODE_BRU_IN(4) } },
-	{ VSP1_ENTITY_HSI, 0, VI6_DPR_HSI_ROUTE, { VI6_DPR_NODE_HSI, } },
-	{ VSP1_ENTITY_HST, 0, VI6_DPR_HST_ROUTE, { VI6_DPR_NODE_HST, } },
-	{ VSP1_ENTITY_LIF, 0, 0, { VI6_DPR_NODE_LIF, } },
-	{ VSP1_ENTITY_LUT, 0, VI6_DPR_LUT_ROUTE, { VI6_DPR_NODE_LUT, } },
-	{ VSP1_ENTITY_RPF, 0, VI6_DPR_RPF_ROUTE(0), { 0, } },
-	{ VSP1_ENTITY_RPF, 1, VI6_DPR_RPF_ROUTE(1), { 0, } },
-	{ VSP1_ENTITY_RPF, 2, VI6_DPR_RPF_ROUTE(2), { 0, } },
-	{ VSP1_ENTITY_RPF, 3, VI6_DPR_RPF_ROUTE(3), { 0, } },
-	{ VSP1_ENTITY_RPF, 4, VI6_DPR_RPF_ROUTE(4), { 0, } },
-	{ VSP1_ENTITY_SRU, 0, VI6_DPR_SRU_ROUTE, { VI6_DPR_NODE_SRU, } },
-	{ VSP1_ENTITY_UDS, 0, VI6_DPR_UDS_ROUTE(0), { VI6_DPR_NODE_UDS(0), } },
-	{ VSP1_ENTITY_UDS, 1, VI6_DPR_UDS_ROUTE(1), { VI6_DPR_NODE_UDS(1), } },
-	{ VSP1_ENTITY_UDS, 2, VI6_DPR_UDS_ROUTE(2), { VI6_DPR_NODE_UDS(2), } },
-	{ VSP1_ENTITY_WPF, 0, 0, { VI6_DPR_NODE_WPF(0), } },
-	{ VSP1_ENTITY_WPF, 1, 0, { VI6_DPR_NODE_WPF(1), } },
-	{ VSP1_ENTITY_WPF, 2, 0, { VI6_DPR_NODE_WPF(2), } },
-	{ VSP1_ENTITY_WPF, 3, 0, { VI6_DPR_NODE_WPF(3), } },
+	    VI6_DPR_NODE_BRU_IN(4) }, VI6_DPR_NODE_BRU_OUT },
+	VSP1_ENTITY_ROUTE(HSI),
+	VSP1_ENTITY_ROUTE(HST),
+	{ VSP1_ENTITY_LIF, 0, 0, { VI6_DPR_NODE_LIF, }, VI6_DPR_NODE_LIF },
+	VSP1_ENTITY_ROUTE(LUT),
+	VSP1_ENTITY_ROUTE_RPF(0),
+	VSP1_ENTITY_ROUTE_RPF(1),
+	VSP1_ENTITY_ROUTE_RPF(2),
+	VSP1_ENTITY_ROUTE_RPF(3),
+	VSP1_ENTITY_ROUTE_RPF(4),
+	VSP1_ENTITY_ROUTE(SRU),
+	VSP1_ENTITY_ROUTE_UDS(0),
+	VSP1_ENTITY_ROUTE_UDS(1),
+	VSP1_ENTITY_ROUTE_UDS(2),
+	VSP1_ENTITY_ROUTE_WPF(0),
+	VSP1_ENTITY_ROUTE_WPF(1),
+	VSP1_ENTITY_ROUTE_WPF(2),
+	VSP1_ENTITY_ROUTE_WPF(3),
 };
 
 int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity,
diff --git a/drivers/media/platform/vsp1/vsp1_entity.h b/drivers/media/platform/vsp1/vsp1_entity.h
index 69eff4e17350..aaab05f4952c 100644
--- a/drivers/media/platform/vsp1/vsp1_entity.h
+++ b/drivers/media/platform/vsp1/vsp1_entity.h
@@ -42,17 +42,21 @@ enum vsp1_entity_type {
  * @index: Entity index this routing entry is associated with
  * @reg: Output routing configuration register
  * @inputs: Target node value for each input
+ * @output: Target node value for entity output
  *
  * Each $vsp1_route entry describes routing configuration for the entity
  * specified by the entry's @type and @index. @reg indicates the register that
  * holds output routing configuration for the entity, and the @inputs array
- * store the target node value for each input of the entity.
+ * store the target node value for each input of the entity. The @output field
+ * stores the target node value of the entity output when used as a source for
+ * histogram generation.
  */
 struct vsp1_route {
 	enum vsp1_entity_type type;
 	unsigned int index;
 	unsigned int reg;
 	unsigned int inputs[VSP1_ENTITY_MAX_INPUTS];
+	unsigned int output;
 };
 
 /**
-- 
2.7.3


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2 07/13] v4l: vsp1: Replace container_of() with dedicated macro
  2016-04-25 21:36 [PATCH v2 00/13] R-Car VSP improvements for v4.7 - Round 2 Laurent Pinchart
                   ` (5 preceding siblings ...)
  2016-04-25 21:36 ` [PATCH v2 06/13] v4l: vsp1: Add output node value to routing table Laurent Pinchart
@ 2016-04-25 21:36 ` Laurent Pinchart
  2016-04-25 21:36 ` [PATCH v2 08/13] v4l: vsp1: Make vsp1_entity_get_pad_compose() more generic Laurent Pinchart
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Laurent Pinchart @ 2016-04-25 21:36 UTC (permalink / raw)
  To: linux-media; +Cc: linux-renesas-soc

Add a macro to cast from a struct media_entity to a struct vsp1_entity
to replace the manual implementations.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/media/platform/vsp1/vsp1_entity.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_entity.c b/drivers/media/platform/vsp1/vsp1_entity.c
index 6a96ea77de69..f60d7926d53f 100644
--- a/drivers/media/platform/vsp1/vsp1_entity.c
+++ b/drivers/media/platform/vsp1/vsp1_entity.c
@@ -22,6 +22,12 @@
 #include "vsp1_dl.h"
 #include "vsp1_entity.h"
 
+static inline struct vsp1_entity *
+media_entity_to_vsp1_entity(struct media_entity *entity)
+{
+	return container_of(entity, struct vsp1_entity, subdev.entity);
+}
+
 void vsp1_entity_route_setup(struct vsp1_entity *source,
 			     struct vsp1_dl_list *dl)
 {
@@ -30,7 +36,7 @@ void vsp1_entity_route_setup(struct vsp1_entity *source,
 	if (source->route->reg == 0)
 		return;
 
-	sink = container_of(source->sink, struct vsp1_entity, subdev.entity);
+	sink = media_entity_to_vsp1_entity(source->sink);
 	vsp1_dl_list_write(dl, source->route->reg,
 			   sink->route->inputs[source->sink_pad]);
 }
@@ -252,7 +258,7 @@ int vsp1_entity_link_setup(struct media_entity *entity,
 	if (!(local->flags & MEDIA_PAD_FL_SOURCE))
 		return 0;
 
-	source = container_of(local->entity, struct vsp1_entity, subdev.entity);
+	source = media_entity_to_vsp1_entity(local->entity);
 
 	if (!source->route)
 		return 0;
-- 
2.7.3


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2 08/13] v4l: vsp1: Make vsp1_entity_get_pad_compose() more generic
  2016-04-25 21:36 [PATCH v2 00/13] R-Car VSP improvements for v4.7 - Round 2 Laurent Pinchart
                   ` (6 preceding siblings ...)
  2016-04-25 21:36 ` [PATCH v2 07/13] v4l: vsp1: Replace container_of() with dedicated macro Laurent Pinchart
@ 2016-04-25 21:36 ` Laurent Pinchart
  2016-04-26 18:09   ` Sergei Shtylyov
  2016-04-25 21:36 ` [PATCH v2 09/13] v4l: vsp1: Move frame sequence number from video node to pipeline Laurent Pinchart
                   ` (4 subsequent siblings)
  12 siblings, 1 reply; 26+ messages in thread
From: Laurent Pinchart @ 2016-04-25 21:36 UTC (permalink / raw)
  To: linux-media; +Cc: linux-renesas-soc

Turn the helper into a function that can retrieve crop and compose
selection rectangles.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/media/platform/vsp1/vsp1_entity.c | 24 ++++++++++++++++++++----
 drivers/media/platform/vsp1/vsp1_entity.h |  6 +++---
 drivers/media/platform/vsp1/vsp1_rpf.c    |  7 ++++---
 3 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_entity.c b/drivers/media/platform/vsp1/vsp1_entity.c
index f60d7926d53f..8c49a74381a1 100644
--- a/drivers/media/platform/vsp1/vsp1_entity.c
+++ b/drivers/media/platform/vsp1/vsp1_entity.c
@@ -87,12 +87,28 @@ vsp1_entity_get_pad_format(struct vsp1_entity *entity,
 	return v4l2_subdev_get_try_format(&entity->subdev, cfg, pad);
 }
 
+/**
+ * vsp1_entity_get_pad_selection - Get a pad selection from storage for entity
+ * @entity: the entity
+ * @cfg: the configuration storage
+ * @pad: the pad number
+ * @target: the selection target
+ *
+ * Return the selection rectangle stored in the given configuration for an
+ * entity's pad. The configuration can be an ACTIVE or TRY configuration. The
+ * selection target can be COMPOSE or CROP.
+ */
 struct v4l2_rect *
-vsp1_entity_get_pad_compose(struct vsp1_entity *entity,
-			    struct v4l2_subdev_pad_config *cfg,
-			    unsigned int pad)
+vsp1_entity_get_pad_selection(struct vsp1_entity *entity,
+			      struct v4l2_subdev_pad_config *cfg,
+			      unsigned int pad, unsigned int target)
 {
-	return v4l2_subdev_get_try_compose(&entity->subdev, cfg, pad);
+	if (target == V4L2_SEL_TGT_COMPOSE)
+		return v4l2_subdev_get_try_compose(&entity->subdev, cfg, pad);
+	else if (target == V4L2_SEL_TGT_CROP)
+		return v4l2_subdev_get_try_crop(&entity->subdev, cfg, pad);
+	else
+		return NULL;
 }
 
 /*
diff --git a/drivers/media/platform/vsp1/vsp1_entity.h b/drivers/media/platform/vsp1/vsp1_entity.h
index aaab05f4952c..a240fc1c59a6 100644
--- a/drivers/media/platform/vsp1/vsp1_entity.h
+++ b/drivers/media/platform/vsp1/vsp1_entity.h
@@ -122,9 +122,9 @@ vsp1_entity_get_pad_format(struct vsp1_entity *entity,
 			   struct v4l2_subdev_pad_config *cfg,
 			   unsigned int pad);
 struct v4l2_rect *
-vsp1_entity_get_pad_compose(struct vsp1_entity *entity,
-			    struct v4l2_subdev_pad_config *cfg,
-			    unsigned int pad);
+vsp1_entity_get_pad_selection(struct vsp1_entity *entity,
+			      struct v4l2_subdev_pad_config *cfg,
+			      unsigned int pad, unsigned int target);
 int vsp1_entity_init_cfg(struct v4l2_subdev *subdev,
 			 struct v4l2_subdev_pad_config *cfg);
 
diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c b/drivers/media/platform/vsp1/vsp1_rpf.c
index 49168db3f529..64dfbddf2aba 100644
--- a/drivers/media/platform/vsp1/vsp1_rpf.c
+++ b/drivers/media/platform/vsp1/vsp1_rpf.c
@@ -130,9 +130,10 @@ static void rpf_configure(struct vsp1_entity *entity,
 	if (pipe->bru) {
 		const struct v4l2_rect *compose;
 
-		compose = vsp1_entity_get_pad_compose(pipe->bru,
-						      pipe->bru->config,
-						      rpf->bru_input);
+		compose = vsp1_entity_get_pad_selection(pipe->bru,
+							pipe->bru->config,
+							rpf->bru_input,
+							V4L2_SEL_TGT_COMPOSE);
 		left = compose->left;
 		top = compose->top;
 	}
-- 
2.7.3


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2 09/13] v4l: vsp1: Move frame sequence number from video node to pipeline
  2016-04-25 21:36 [PATCH v2 00/13] R-Car VSP improvements for v4.7 - Round 2 Laurent Pinchart
                   ` (7 preceding siblings ...)
  2016-04-25 21:36 ` [PATCH v2 08/13] v4l: vsp1: Make vsp1_entity_get_pad_compose() more generic Laurent Pinchart
@ 2016-04-25 21:36 ` Laurent Pinchart
  2016-04-25 21:36 ` [PATCH v2 10/13] v4l: vsp1: Group DRM RPF parameters in a structure Laurent Pinchart
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Laurent Pinchart @ 2016-04-25 21:36 UTC (permalink / raw)
  To: linux-media; +Cc: linux-renesas-soc

The frame sequence number is global to the pipeline, there's no need to
store copies in each video node.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/media/platform/vsp1/vsp1_pipe.c  | 2 ++
 drivers/media/platform/vsp1/vsp1_pipe.h  | 2 ++
 drivers/media/platform/vsp1/vsp1_video.c | 4 +---
 drivers/media/platform/vsp1/vsp1_video.h | 1 -
 4 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_pipe.c b/drivers/media/platform/vsp1/vsp1_pipe.c
index 0c1dc80eb304..be47c8a1a812 100644
--- a/drivers/media/platform/vsp1/vsp1_pipe.c
+++ b/drivers/media/platform/vsp1/vsp1_pipe.c
@@ -286,6 +286,8 @@ void vsp1_pipeline_frame_end(struct vsp1_pipeline *pipe)
 
 	if (pipe->frame_end)
 		pipe->frame_end(pipe);
+
+	pipe->sequence++;
 }
 
 /*
diff --git a/drivers/media/platform/vsp1/vsp1_pipe.h b/drivers/media/platform/vsp1/vsp1_pipe.h
index 7b56113511dd..febc62f99d6d 100644
--- a/drivers/media/platform/vsp1/vsp1_pipe.h
+++ b/drivers/media/platform/vsp1/vsp1_pipe.h
@@ -67,6 +67,7 @@ enum vsp1_pipeline_state {
  * @kref: pipeline reference count
  * @stream_count: number of streaming video nodes
  * @buffers_ready: bitmask of RPFs and WPFs with at least one buffer available
+ * @sequence: frame sequence number
  * @num_inputs: number of RPFs
  * @inputs: array of RPFs in the pipeline (indexed by RPF index)
  * @output: WPF at the output of the pipeline
@@ -90,6 +91,7 @@ struct vsp1_pipeline {
 	struct kref kref;
 	unsigned int stream_count;
 	unsigned int buffers_ready;
+	unsigned int sequence;
 
 	unsigned int num_inputs;
 	struct vsp1_rwpf *inputs[VSP1_MAX_RPF];
diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c
index a9aec5c0bec6..34aa6427662d 100644
--- a/drivers/media/platform/vsp1/vsp1_video.c
+++ b/drivers/media/platform/vsp1/vsp1_video.c
@@ -219,7 +219,7 @@ vsp1_video_complete_buffer(struct vsp1_video *video)
 
 	spin_unlock_irqrestore(&video->irqlock, flags);
 
-	done->buf.sequence = video->sequence++;
+	done->buf.sequence = pipe->sequence;
 	done->buf.vb2_buf.timestamp = ktime_get_ns();
 	for (i = 0; i < done->buf.vb2_buf.num_planes; ++i)
 		vb2_set_plane_payload(&done->buf.vb2_buf, i,
@@ -805,8 +805,6 @@ vsp1_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type)
 	if (video->queue.owner && video->queue.owner != file->private_data)
 		return -EBUSY;
 
-	video->sequence = 0;
-
 	/* Get a pipeline for the video node and start streaming on it. No link
 	 * touching an entity in the pipeline can be activated or deactivated
 	 * once streaming is started.
diff --git a/drivers/media/platform/vsp1/vsp1_video.h b/drivers/media/platform/vsp1/vsp1_video.h
index 867b00807c46..1595fd587fbc 100644
--- a/drivers/media/platform/vsp1/vsp1_video.h
+++ b/drivers/media/platform/vsp1/vsp1_video.h
@@ -49,7 +49,6 @@ struct vsp1_video {
 	void *alloc_ctx;
 	spinlock_t irqlock;
 	struct list_head irqqueue;
-	unsigned int sequence;
 };
 
 static inline struct vsp1_video *to_vsp1_video(struct video_device *vdev)
-- 
2.7.3


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2 10/13] v4l: vsp1: Group DRM RPF parameters in a structure
  2016-04-25 21:36 [PATCH v2 00/13] R-Car VSP improvements for v4.7 - Round 2 Laurent Pinchart
                   ` (8 preceding siblings ...)
  2016-04-25 21:36 ` [PATCH v2 09/13] v4l: vsp1: Move frame sequence number from video node to pipeline Laurent Pinchart
@ 2016-04-25 21:36 ` Laurent Pinchart
  2016-04-25 21:36 ` [PATCH v2 11/13] drm: rcar-du: Add alpha support for VSP planes Laurent Pinchart
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Laurent Pinchart @ 2016-04-25 21:36 UTC (permalink / raw)
  To: linux-media; +Cc: linux-renesas-soc

The vsp1_du_atomic_update_ext() function takes 7 RPF configuration
parameters, and more will likely be added later. This makes the code
difficult to read and error-prone as multiple parameters have the same
type.

Make the API safer and easier to extend in the future by grouping all
parameters in a structure. Use macro magic to ease the transition to the
new function by allowing the old and new functions to be called using
the same name. The macros and static inline wrapper will be removed as
soon as the caller is updated.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/media/platform/vsp1/vsp1_drm.c | 68 +++++++++++++++-------------------
 include/media/vsp1.h                   | 47 ++++++++++++++++-------
 2 files changed, 64 insertions(+), 51 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_drm.c b/drivers/media/platform/vsp1/vsp1_drm.c
index fc4bbc401e67..fef53ecefe25 100644
--- a/drivers/media/platform/vsp1/vsp1_drm.c
+++ b/drivers/media/platform/vsp1/vsp1_drm.c
@@ -230,42 +230,33 @@ EXPORT_SYMBOL_GPL(vsp1_du_atomic_begin);
  * vsp1_du_atomic_update - Setup one RPF input of the VSP pipeline
  * @dev: the VSP device
  * @rpf_index: index of the RPF to setup (0-based)
- * @pixelformat: V4L2 pixel format for the RPF memory input
- * @pitch: number of bytes per line in the image stored in memory
- * @mem: DMA addresses of the memory buffers (one per plane)
- * @src: the source crop rectangle for the RPF
- * @dst: the destination compose rectangle for the BRU input
- * @alpha: global alpha value for the input
- * @zpos: the Z-order position of the input
+ * @cfg: the RPF configuration
  *
- * Configure the VSP to perform composition of the image referenced by @mem
- * through RPF @rpf_index, using the @src crop rectangle and the @dst
+ * Configure the VSP to perform image composition through RPF @rpf_index as
+ * described by the @cfg configuration. The image to compose is referenced by
+ * @cfg.mem and composed using the @cfg.src crop rectangle and the @cfg.dst
  * composition rectangle. The Z-order is configurable with higher @zpos values
  * displayed on top.
  *
- * Image format as stored in memory is expressed as a V4L2 @pixelformat value.
- * As a special case, setting the pixel format to 0 will disable the RPF. The
- * @pitch, @mem, @src and @dst parameters are ignored in that case. Calling the
+ * If the @cfg configuration is NULL, the RPF will be disabled. Calling the
  * function on a disabled RPF is allowed.
  *
- * The memory pitch is configurable to allow for padding at end of lines, or
- * simple for images that extend beyond the crop rectangle boundaries. The
- * @pitch value is expressed in bytes and applies to all planes for multiplanar
- * formats.
+ * Image format as stored in memory is expressed as a V4L2 @cfg.pixelformat
+ * value. The memory pitch is configurable to allow for padding at end of lines,
+ * or simply for images that extend beyond the crop rectangle boundaries. The
+ * @cfg.pitch value is expressed in bytes and applies to all planes for
+ * multiplanar formats.
  *
  * The source memory buffer is referenced by the DMA address of its planes in
- * the @mem array. Up to two planes are supported. The second plane DMA address
- * is ignored for formats using a single plane.
+ * the @cfg.mem array. Up to two planes are supported. The second plane DMA
+ * address is ignored for formats using a single plane.
  *
  * This function isn't reentrant, the caller needs to serialize calls.
  *
  * Return 0 on success or a negative error code on failure.
  */
-int vsp1_du_atomic_update_ext(struct device *dev, unsigned int rpf_index,
-			      u32 pixelformat, unsigned int pitch,
-			      dma_addr_t mem[2], const struct v4l2_rect *src,
-			      const struct v4l2_rect *dst, unsigned int alpha,
-			      unsigned int zpos)
+int __vsp1_du_atomic_update(struct device *dev, unsigned int rpf_index,
+			    const struct vsp1_du_atomic_config *cfg)
 {
 	struct vsp1_device *vsp1 = dev_get_drvdata(dev);
 	const struct vsp1_format_info *fmtinfo;
@@ -276,7 +267,7 @@ int vsp1_du_atomic_update_ext(struct device *dev, unsigned int rpf_index,
 
 	rpf = vsp1->rpf[rpf_index];
 
-	if (pixelformat == 0) {
+	if (!cfg) {
 		dev_dbg(vsp1->dev, "%s: RPF%u: disable requested\n", __func__,
 			rpf_index);
 
@@ -287,38 +278,39 @@ int vsp1_du_atomic_update_ext(struct device *dev, unsigned int rpf_index,
 	dev_dbg(vsp1->dev,
 		"%s: RPF%u: (%u,%u)/%ux%u -> (%u,%u)/%ux%u (%08x), pitch %u dma { %pad, %pad } zpos %u\n",
 		__func__, rpf_index,
-		src->left, src->top, src->width, src->height,
-		dst->left, dst->top, dst->width, dst->height,
-		pixelformat, pitch, &mem[0], &mem[1], zpos);
+		cfg->src.left, cfg->src.top, cfg->src.width, cfg->src.height,
+		cfg->dst.left, cfg->dst.top, cfg->dst.width, cfg->dst.height,
+		cfg->pixelformat, cfg->pitch, &cfg->mem[0], &cfg->mem[1],
+		cfg->zpos);
 
 	/* Store the format, stride, memory buffer address, crop and compose
 	 * rectangles and Z-order position and for the input.
 	 */
-	fmtinfo = vsp1_get_format_info(pixelformat);
+	fmtinfo = vsp1_get_format_info(cfg->pixelformat);
 	if (!fmtinfo) {
 		dev_dbg(vsp1->dev, "Unsupport pixel format %08x for RPF\n",
-			pixelformat);
+			cfg->pixelformat);
 		return -EINVAL;
 	}
 
 	rpf->fmtinfo = fmtinfo;
 	rpf->format.num_planes = fmtinfo->planes;
-	rpf->format.plane_fmt[0].bytesperline = pitch;
-	rpf->format.plane_fmt[1].bytesperline = pitch;
-	rpf->alpha = alpha;
+	rpf->format.plane_fmt[0].bytesperline = cfg->pitch;
+	rpf->format.plane_fmt[1].bytesperline = cfg->pitch;
+	rpf->alpha = cfg->alpha;
 
-	rpf->mem.addr[0] = mem[0];
-	rpf->mem.addr[1] = mem[1];
+	rpf->mem.addr[0] = cfg->mem[0];
+	rpf->mem.addr[1] = cfg->mem[1];
 	rpf->mem.addr[2] = 0;
 
-	vsp1->drm->inputs[rpf_index].crop = *src;
-	vsp1->drm->inputs[rpf_index].compose = *dst;
-	vsp1->drm->inputs[rpf_index].zpos = zpos;
+	vsp1->drm->inputs[rpf_index].crop = cfg->src;
+	vsp1->drm->inputs[rpf_index].compose = cfg->dst;
+	vsp1->drm->inputs[rpf_index].zpos = cfg->zpos;
 	vsp1->drm->inputs[rpf_index].enabled = true;
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(vsp1_du_atomic_update_ext);
+EXPORT_SYMBOL_GPL(__vsp1_du_atomic_update);
 
 static int vsp1_du_setup_rpf_pipe(struct vsp1_device *vsp1,
 				  struct vsp1_rwpf *rpf, unsigned int bru_input)
diff --git a/include/media/vsp1.h b/include/media/vsp1.h
index 3e654a0455bd..ea8ad7537057 100644
--- a/include/media/vsp1.h
+++ b/include/media/vsp1.h
@@ -14,31 +14,52 @@
 #define __MEDIA_VSP1_H__
 
 #include <linux/types.h>
+#include <linux/videodev2.h>
 
 struct device;
-struct v4l2_rect;
 
 int vsp1_du_init(struct device *dev);
 
 int vsp1_du_setup_lif(struct device *dev, unsigned int width,
 		      unsigned int height);
 
+struct vsp1_du_atomic_config {
+	u32 pixelformat;
+	unsigned int pitch;
+	dma_addr_t mem[2];
+	struct v4l2_rect src;
+	struct v4l2_rect dst;
+	unsigned int alpha;
+	unsigned int zpos;
+};
+
 void vsp1_du_atomic_begin(struct device *dev);
-int vsp1_du_atomic_update_ext(struct device *dev, unsigned int rpf,
-			      u32 pixelformat, unsigned int pitch,
-			      dma_addr_t mem[2], const struct v4l2_rect *src,
-			      const struct v4l2_rect *dst, unsigned int alpha,
-			      unsigned int zpos);
+int __vsp1_du_atomic_update(struct device *dev, unsigned int rpf,
+			    const struct vsp1_du_atomic_config *cfg);
 void vsp1_du_atomic_flush(struct device *dev);
 
-static inline int vsp1_du_atomic_update(struct device *dev,
-					unsigned int rpf_index, u32 pixelformat,
-					unsigned int pitch, dma_addr_t mem[2],
-					const struct v4l2_rect *src,
-					const struct v4l2_rect *dst)
+static inline int vsp1_du_atomic_update_old(struct device *dev,
+	unsigned int rpf, u32 pixelformat, unsigned int pitch,
+	dma_addr_t mem[2], const struct v4l2_rect *src,
+	const struct v4l2_rect *dst)
 {
-	return vsp1_du_atomic_update_ext(dev, rpf_index, pixelformat, pitch,
-					 mem, src, dst, 255, 0);
+	struct vsp1_du_atomic_config cfg = {
+		.pixelformat = pixelformat,
+		.pitch = pitch,
+		.mem[0] = mem[0],
+		.mem[1] = mem[1],
+		.src = *src,
+		.dst = *dst,
+		.alpha = 255,
+		.zpos = 0,
+	};
+
+	return __vsp1_du_atomic_update(dev, rpf, &cfg);
 }
 
+#define _vsp1_du_atomic_update(_1, _2, _3, _4, _5, _6, _7, f, ...) f
+#define vsp1_du_atomic_update(...) \
+	_vsp1_du_atomic_update(__VA_ARGS__, vsp1_du_atomic_update_old, 0, 0, \
+			       0, __vsp1_du_atomic_update)(__VA_ARGS__)
+
 #endif /* __MEDIA_VSP1_H__ */
-- 
2.7.3


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2 11/13] drm: rcar-du: Add alpha support for VSP planes
  2016-04-25 21:36 [PATCH v2 00/13] R-Car VSP improvements for v4.7 - Round 2 Laurent Pinchart
                   ` (9 preceding siblings ...)
  2016-04-25 21:36 ` [PATCH v2 10/13] v4l: vsp1: Group DRM RPF parameters in a structure Laurent Pinchart
@ 2016-04-25 21:36 ` Laurent Pinchart
  2016-04-25 21:36 ` [PATCH v2 12/13] drm: rcar-du: Add Z-order " Laurent Pinchart
  2016-04-25 21:36 ` [PATCH v2 13/13] v4l: vsp1: Remove deprecated DRM API Laurent Pinchart
  12 siblings, 0 replies; 26+ messages in thread
From: Laurent Pinchart @ 2016-04-25 21:36 UTC (permalink / raw)
  To: linux-media; +Cc: linux-renesas-soc, dri-devel

Make the global alpha multiplier of VSP planes configurable through the
alpha property, exactly as for the native DU planes.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 38 +++++++++++++++++------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

Cc: dri-devel@lists.freedesktop.org

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
index de7ef041182b..8c89a6401542 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
@@ -148,40 +148,41 @@ static void rcar_du_vsp_plane_setup(struct rcar_du_vsp_plane *plane)
 	struct rcar_du_vsp_plane_state *state =
 		to_rcar_vsp_plane_state(plane->plane.state);
 	struct drm_framebuffer *fb = plane->plane.state->fb;
-	struct v4l2_rect src;
-	struct v4l2_rect dst;
-	dma_addr_t paddr[2] = { 0, };
-	u32 pixelformat = 0;
+	struct vsp1_du_atomic_config cfg = {
+		.pixelformat = 0,
+		.pitch = fb->pitches[0],
+		.alpha = state->alpha,
+		.zpos = 0,
+	};
 	unsigned int i;
 
-	src.left = state->state.src_x >> 16;
-	src.top = state->state.src_y >> 16;
-	src.width = state->state.src_w >> 16;
-	src.height = state->state.src_h >> 16;
+	cfg.src.left = state->state.src_x >> 16;
+	cfg.src.top = state->state.src_y >> 16;
+	cfg.src.width = state->state.src_w >> 16;
+	cfg.src.height = state->state.src_h >> 16;
 
-	dst.left = state->state.crtc_x;
-	dst.top = state->state.crtc_y;
-	dst.width = state->state.crtc_w;
-	dst.height = state->state.crtc_h;
+	cfg.dst.left = state->state.crtc_x;
+	cfg.dst.top = state->state.crtc_y;
+	cfg.dst.width = state->state.crtc_w;
+	cfg.dst.height = state->state.crtc_h;
 
 	for (i = 0; i < state->format->planes; ++i) {
 		struct drm_gem_cma_object *gem;
 
 		gem = drm_fb_cma_get_gem_obj(fb, i);
-		paddr[i] = gem->paddr + fb->offsets[i];
+		cfg.mem[i] = gem->paddr + fb->offsets[i];
 	}
 
 	for (i = 0; i < ARRAY_SIZE(formats_kms); ++i) {
 		if (formats_kms[i] == state->format->fourcc) {
-			pixelformat = formats_v4l2[i];
+			cfg.pixelformat = formats_v4l2[i];
 			break;
 		}
 	}
 
-	WARN_ON(!pixelformat);
+	WARN_ON(!cfg.pixelformat);
 
-	vsp1_du_atomic_update(plane->vsp->vsp, plane->index, pixelformat,
-			      fb->pitches[0], paddr, &src, &dst);
+	vsp1_du_atomic_update(plane->vsp->vsp, plane->index, &cfg);
 }
 
 static int rcar_du_vsp_plane_atomic_check(struct drm_plane *plane,
@@ -220,8 +221,7 @@ static void rcar_du_vsp_plane_atomic_update(struct drm_plane *plane,
 	if (plane->state->crtc)
 		rcar_du_vsp_plane_setup(rplane);
 	else
-		vsp1_du_atomic_update(rplane->vsp->vsp, rplane->index, 0, 0, 0,
-				      NULL, NULL);
+		vsp1_du_atomic_update(rplane->vsp->vsp, rplane->index, NULL);
 }
 
 static const struct drm_plane_helper_funcs rcar_du_vsp_plane_helper_funcs = {
-- 
2.7.3


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2 12/13] drm: rcar-du: Add Z-order support for VSP planes
  2016-04-25 21:36 [PATCH v2 00/13] R-Car VSP improvements for v4.7 - Round 2 Laurent Pinchart
                   ` (10 preceding siblings ...)
  2016-04-25 21:36 ` [PATCH v2 11/13] drm: rcar-du: Add alpha support for VSP planes Laurent Pinchart
@ 2016-04-25 21:36 ` Laurent Pinchart
  2016-04-25 21:36 ` [PATCH v2 13/13] v4l: vsp1: Remove deprecated DRM API Laurent Pinchart
  12 siblings, 0 replies; 26+ messages in thread
From: Laurent Pinchart @ 2016-04-25 21:36 UTC (permalink / raw)
  To: linux-media; +Cc: linux-renesas-soc, dri-devel

Make the Z-order of VSP planes configurable through the zpos property,
exactly as for the native DU planes.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 11 ++++++++---
 drivers/gpu/drm/rcar-du/rcar_du_vsp.h |  2 ++
 2 files changed, 10 insertions(+), 3 deletions(-)

Cc: dri-devel@lists.freedesktop.org

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
index 8c89a6401542..4927fb3b8554 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
@@ -152,7 +152,7 @@ static void rcar_du_vsp_plane_setup(struct rcar_du_vsp_plane *plane)
 		.pixelformat = 0,
 		.pitch = fb->pitches[0],
 		.alpha = state->alpha,
-		.zpos = 0,
+		.zpos = state->zpos,
 	};
 	unsigned int i;
 
@@ -180,8 +180,6 @@ static void rcar_du_vsp_plane_setup(struct rcar_du_vsp_plane *plane)
 		}
 	}
 
-	WARN_ON(!cfg.pixelformat);
-
 	vsp1_du_atomic_update(plane->vsp->vsp, plane->index, &cfg);
 }
 
@@ -269,6 +267,7 @@ static void rcar_du_vsp_plane_reset(struct drm_plane *plane)
 		return;
 
 	state->alpha = 255;
+	state->zpos = plane->type == DRM_PLANE_TYPE_PRIMARY ? 0 : 1;
 
 	plane->state = &state->state;
 	plane->state->plane = plane;
@@ -283,6 +282,8 @@ static int rcar_du_vsp_plane_atomic_set_property(struct drm_plane *plane,
 
 	if (property == rcdu->props.alpha)
 		rstate->alpha = val;
+	else if (property == rcdu->props.zpos)
+		rstate->zpos = val;
 	else
 		return -EINVAL;
 
@@ -299,6 +300,8 @@ static int rcar_du_vsp_plane_atomic_get_property(struct drm_plane *plane,
 
 	if (property == rcdu->props.alpha)
 		*val = rstate->alpha;
+	else if (property == rcdu->props.zpos)
+		*val = rstate->zpos;
 	else
 		return -EINVAL;
 
@@ -378,6 +381,8 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp)
 
 		drm_object_attach_property(&plane->plane.base,
 					   rcdu->props.alpha, 255);
+		drm_object_attach_property(&plane->plane.base,
+					   rcdu->props.zpos, 1);
 	}
 
 	return 0;
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.h b/drivers/gpu/drm/rcar-du/rcar_du_vsp.h
index df3bf3805c69..510dcc9c6816 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.h
+++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.h
@@ -44,6 +44,7 @@ static inline struct rcar_du_vsp_plane *to_rcar_vsp_plane(struct drm_plane *p)
  * @state: base DRM plane state
  * @format: information about the pixel format used by the plane
  * @alpha: value of the plane alpha property
+ * @zpos: value of the plane zpos property
  */
 struct rcar_du_vsp_plane_state {
 	struct drm_plane_state state;
@@ -51,6 +52,7 @@ struct rcar_du_vsp_plane_state {
 	const struct rcar_du_format_info *format;
 
 	unsigned int alpha;
+	unsigned int zpos;
 };
 
 static inline struct rcar_du_vsp_plane_state *
-- 
2.7.3


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2 13/13] v4l: vsp1: Remove deprecated DRM API
  2016-04-25 21:36 [PATCH v2 00/13] R-Car VSP improvements for v4.7 - Round 2 Laurent Pinchart
                   ` (11 preceding siblings ...)
  2016-04-25 21:36 ` [PATCH v2 12/13] drm: rcar-du: Add Z-order " Laurent Pinchart
@ 2016-04-25 21:36 ` Laurent Pinchart
  12 siblings, 0 replies; 26+ messages in thread
From: Laurent Pinchart @ 2016-04-25 21:36 UTC (permalink / raw)
  To: linux-media; +Cc: linux-renesas-soc

The DRM driver has switched to the new API, remove the deprecated macros
and inline wrapper.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/media/platform/vsp1/vsp1_drm.c |  6 +++---
 include/media/vsp1.h                   | 28 ++--------------------------
 2 files changed, 5 insertions(+), 29 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_drm.c b/drivers/media/platform/vsp1/vsp1_drm.c
index fef53ecefe25..14730119687f 100644
--- a/drivers/media/platform/vsp1/vsp1_drm.c
+++ b/drivers/media/platform/vsp1/vsp1_drm.c
@@ -255,8 +255,8 @@ EXPORT_SYMBOL_GPL(vsp1_du_atomic_begin);
  *
  * Return 0 on success or a negative error code on failure.
  */
-int __vsp1_du_atomic_update(struct device *dev, unsigned int rpf_index,
-			    const struct vsp1_du_atomic_config *cfg)
+int vsp1_du_atomic_update(struct device *dev, unsigned int rpf_index,
+			  const struct vsp1_du_atomic_config *cfg)
 {
 	struct vsp1_device *vsp1 = dev_get_drvdata(dev);
 	const struct vsp1_format_info *fmtinfo;
@@ -310,7 +310,7 @@ int __vsp1_du_atomic_update(struct device *dev, unsigned int rpf_index,
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(__vsp1_du_atomic_update);
+EXPORT_SYMBOL_GPL(vsp1_du_atomic_update);
 
 static int vsp1_du_setup_rpf_pipe(struct vsp1_device *vsp1,
 				  struct vsp1_rwpf *rpf, unsigned int bru_input)
diff --git a/include/media/vsp1.h b/include/media/vsp1.h
index ea8ad7537057..9322d9775fb7 100644
--- a/include/media/vsp1.h
+++ b/include/media/vsp1.h
@@ -34,32 +34,8 @@ struct vsp1_du_atomic_config {
 };
 
 void vsp1_du_atomic_begin(struct device *dev);
-int __vsp1_du_atomic_update(struct device *dev, unsigned int rpf,
-			    const struct vsp1_du_atomic_config *cfg);
+int vsp1_du_atomic_update(struct device *dev, unsigned int rpf,
+			  const struct vsp1_du_atomic_config *cfg);
 void vsp1_du_atomic_flush(struct device *dev);
 
-static inline int vsp1_du_atomic_update_old(struct device *dev,
-	unsigned int rpf, u32 pixelformat, unsigned int pitch,
-	dma_addr_t mem[2], const struct v4l2_rect *src,
-	const struct v4l2_rect *dst)
-{
-	struct vsp1_du_atomic_config cfg = {
-		.pixelformat = pixelformat,
-		.pitch = pitch,
-		.mem[0] = mem[0],
-		.mem[1] = mem[1],
-		.src = *src,
-		.dst = *dst,
-		.alpha = 255,
-		.zpos = 0,
-	};
-
-	return __vsp1_du_atomic_update(dev, rpf, &cfg);
-}
-
-#define _vsp1_du_atomic_update(_1, _2, _3, _4, _5, _6, _7, f, ...) f
-#define vsp1_du_atomic_update(...) \
-	_vsp1_du_atomic_update(__VA_ARGS__, vsp1_du_atomic_update_old, 0, 0, \
-			       0, __vsp1_du_atomic_update)(__VA_ARGS__)
-
 #endif /* __MEDIA_VSP1_H__ */
-- 
2.7.3


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 08/13] v4l: vsp1: Make vsp1_entity_get_pad_compose() more generic
  2016-04-25 21:36 ` [PATCH v2 08/13] v4l: vsp1: Make vsp1_entity_get_pad_compose() more generic Laurent Pinchart
@ 2016-04-26 18:09   ` Sergei Shtylyov
  2016-04-27 15:26     ` Laurent Pinchart
  0 siblings, 1 reply; 26+ messages in thread
From: Sergei Shtylyov @ 2016-04-26 18:09 UTC (permalink / raw)
  To: Laurent Pinchart, linux-media; +Cc: linux-renesas-soc

Hello.

On 04/26/2016 12:36 AM, Laurent Pinchart wrote:

> Turn the helper into a function that can retrieve crop and compose
> selection rectangles.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
>   drivers/media/platform/vsp1/vsp1_entity.c | 24 ++++++++++++++++++++----
>   drivers/media/platform/vsp1/vsp1_entity.h |  6 +++---
>   drivers/media/platform/vsp1/vsp1_rpf.c    |  7 ++++---
>   3 files changed, 27 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/media/platform/vsp1/vsp1_entity.c b/drivers/media/platform/vsp1/vsp1_entity.c
> index f60d7926d53f..8c49a74381a1 100644
> --- a/drivers/media/platform/vsp1/vsp1_entity.c
> +++ b/drivers/media/platform/vsp1/vsp1_entity.c
> @@ -87,12 +87,28 @@ vsp1_entity_get_pad_format(struct vsp1_entity *entity,
>   	return v4l2_subdev_get_try_format(&entity->subdev, cfg, pad);
>   }
>
> +/**
> + * vsp1_entity_get_pad_selection - Get a pad selection from storage for entity
> + * @entity: the entity
> + * @cfg: the configuration storage
> + * @pad: the pad number
> + * @target: the selection target
> + *
> + * Return the selection rectangle stored in the given configuration for an
> + * entity's pad. The configuration can be an ACTIVE or TRY configuration. The
> + * selection target can be COMPOSE or CROP.
> + */
>   struct v4l2_rect *
> -vsp1_entity_get_pad_compose(struct vsp1_entity *entity,
> -			    struct v4l2_subdev_pad_config *cfg,
> -			    unsigned int pad)
> +vsp1_entity_get_pad_selection(struct vsp1_entity *entity,
> +			      struct v4l2_subdev_pad_config *cfg,
> +			      unsigned int pad, unsigned int target)
>   {
> -	return v4l2_subdev_get_try_compose(&entity->subdev, cfg, pad);
> +	if (target == V4L2_SEL_TGT_COMPOSE)
> +		return v4l2_subdev_get_try_compose(&entity->subdev, cfg, pad);
> +	else if (target == V4L2_SEL_TGT_CROP)
> +		return v4l2_subdev_get_try_crop(&entity->subdev, cfg, pad);
> +	else
> +		return NULL;

    How about *switch* instead?

[...]

MBR, Sergei


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 08/13] v4l: vsp1: Make vsp1_entity_get_pad_compose() more generic
  2016-04-26 18:09   ` Sergei Shtylyov
@ 2016-04-27 15:26     ` Laurent Pinchart
  0 siblings, 0 replies; 26+ messages in thread
From: Laurent Pinchart @ 2016-04-27 15:26 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: Laurent Pinchart, linux-media, linux-renesas-soc

Hi Sergei,

On Tuesday 26 Apr 2016 21:09:10 Sergei Shtylyov wrote:
> On 04/26/2016 12:36 AM, Laurent Pinchart wrote:
> > Turn the helper into a function that can retrieve crop and compose
> > selection rectangles.
> > 
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> > 
> >   drivers/media/platform/vsp1/vsp1_entity.c | 24 ++++++++++++++++++++----
> >   drivers/media/platform/vsp1/vsp1_entity.h |  6 +++---
> >   drivers/media/platform/vsp1/vsp1_rpf.c    |  7 ++++---
> >   3 files changed, 27 insertions(+), 10 deletions(-)
> > 
> > diff --git a/drivers/media/platform/vsp1/vsp1_entity.c
> > b/drivers/media/platform/vsp1/vsp1_entity.c index
> > f60d7926d53f..8c49a74381a1 100644
> > --- a/drivers/media/platform/vsp1/vsp1_entity.c
> > +++ b/drivers/media/platform/vsp1/vsp1_entity.c
> > @@ -87,12 +87,28 @@ vsp1_entity_get_pad_format(struct vsp1_entity *entity,
> > 
> >   	return v4l2_subdev_get_try_format(&entity->subdev, cfg, pad);
> >   
> >   }
> > 
> > +/**
> > + * vsp1_entity_get_pad_selection - Get a pad selection from storage for
> > entity + * @entity: the entity
> > + * @cfg: the configuration storage
> > + * @pad: the pad number
> > + * @target: the selection target
> > + *
> > + * Return the selection rectangle stored in the given configuration for
> > an
> > + * entity's pad. The configuration can be an ACTIVE or TRY configuration.
> > The + * selection target can be COMPOSE or CROP.
> > + */
> > 
> >   struct v4l2_rect *
> > 
> > -vsp1_entity_get_pad_compose(struct vsp1_entity *entity,
> > -			    struct v4l2_subdev_pad_config *cfg,
> > -			    unsigned int pad)
> > +vsp1_entity_get_pad_selection(struct vsp1_entity *entity,
> > +			      struct v4l2_subdev_pad_config *cfg,
> > +			      unsigned int pad, unsigned int target)
> > 
> >   {
> > 
> > -	return v4l2_subdev_get_try_compose(&entity->subdev, cfg, pad);
> > +	if (target == V4L2_SEL_TGT_COMPOSE)
> > +		return v4l2_subdev_get_try_compose(&entity->subdev, cfg, pad);
> > +	else if (target == V4L2_SEL_TGT_CROP)
> > +		return v4l2_subdev_get_try_crop(&entity->subdev, cfg, pad);
> > +	else
> > +		return NULL;
> 
>     How about *switch* instead?

That's certainly an option. It don't think it would make a big difference, but 
I'll change it nonetheless. I won't post a new of the series now just for that 
change though, but I'll include it when I'll do.

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 01/13] dt-bindings: Add Renesas R-Car FCP DT bindings
  2016-04-25 21:36 ` [PATCH v2 01/13] dt-bindings: Add Renesas R-Car FCP DT bindings Laurent Pinchart
@ 2016-04-28  2:54   ` Rob Herring
  2016-04-28  6:36     ` Laurent Pinchart
       [not found]   ` <1461620198-13428-2-git-send-email-laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
  1 sibling, 1 reply; 26+ messages in thread
From: Rob Herring @ 2016-04-28  2:54 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: linux-media, linux-renesas-soc, devicetree

On Tue, Apr 26, 2016 at 12:36:26AM +0300, Laurent Pinchart wrote:
> The FCP is a companion module of video processing modules in the Renesas
> R-Car Gen3 SoCs. It provides data compression and decompression, data
> caching, and conversion of AXI transactions in order to reduce the
> memory bandwidth.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
>  .../devicetree/bindings/media/renesas,fcp.txt      | 31 ++++++++++++++++++++++
>  1 file changed, 31 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/media/renesas,fcp.txt
> 
> Cc: devicetree@vger.kernel.org
> 
> diff --git a/Documentation/devicetree/bindings/media/renesas,fcp.txt b/Documentation/devicetree/bindings/media/renesas,fcp.txt
> new file mode 100644
> index 000000000000..0c72ca24379f
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/renesas,fcp.txt
> @@ -0,0 +1,31 @@
> +Renesas R-Car Frame Compression Processor (FCP)
> +-----------------------------------------------
> +
> +The FCP is a companion module of video processing modules in the Renesas R-Car
> +Gen3 SoCs. It provides data compression and decompression, data caching, and
> +conversion of AXI transactions in order to reduce the memory bandwidth.
> +
> +There are three types of FCP whose configuration and behaviour highly depend
> +on the module they are paired with.

3 types?, but I only see one compatible and no relationship with said 
module described.

Rob

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 01/13] dt-bindings: Add Renesas R-Car FCP DT bindings
  2016-04-28  2:54   ` Rob Herring
@ 2016-04-28  6:36     ` Laurent Pinchart
  2016-04-28  8:00         ` Geert Uytterhoeven
  0 siblings, 1 reply; 26+ messages in thread
From: Laurent Pinchart @ 2016-04-28  6:36 UTC (permalink / raw)
  To: Rob Herring; +Cc: Laurent Pinchart, linux-media, linux-renesas-soc, devicetree

Hi Rob,

On Wednesday 27 Apr 2016 21:54:29 Rob Herring wrote:
> On Tue, Apr 26, 2016 at 12:36:26AM +0300, Laurent Pinchart wrote:
> > The FCP is a companion module of video processing modules in the Renesas
> > R-Car Gen3 SoCs. It provides data compression and decompression, data
> > caching, and conversion of AXI transactions in order to reduce the
> > memory bandwidth.
> > 
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> > 
> >  .../devicetree/bindings/media/renesas,fcp.txt      | 31
> >  ++++++++++++++++++++++ 1 file changed, 31 insertions(+)
> >  create mode 100644
> >  Documentation/devicetree/bindings/media/renesas,fcp.txt
> > 
> > Cc: devicetree@vger.kernel.org
> > 
> > diff --git a/Documentation/devicetree/bindings/media/renesas,fcp.txt
> > b/Documentation/devicetree/bindings/media/renesas,fcp.txt new file mode
> > 100644
> > index 000000000000..0c72ca24379f
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/media/renesas,fcp.txt
> > @@ -0,0 +1,31 @@
> > +Renesas R-Car Frame Compression Processor (FCP)
> > +-----------------------------------------------
> > +
> > +The FCP is a companion module of video processing modules in the Renesas
> > R-Car +Gen3 SoCs. It provides data compression and decompression, data
> > caching, and +conversion of AXI transactions in order to reduce the
> > memory bandwidth. +
> > +There are three types of FCP whose configuration and behaviour highly
> > depend +on the module they are paired with.
> 
> 3 types?, but I only see one compatible and no relationship with said
> module described.

The bindings currently support a single type, as that's all the driver 
currently supports and I'm not comfortable merging bindings without at least 
one test implementation. Should I clarify that with something as "These DT 
bindings currently support the "FCP for Video" type only" ?

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 01/13] dt-bindings: Add Renesas R-Car FCP DT bindings
  2016-04-28  6:36     ` Laurent Pinchart
@ 2016-04-28  8:00         ` Geert Uytterhoeven
  0 siblings, 0 replies; 26+ messages in thread
From: Geert Uytterhoeven @ 2016-04-28  8:00 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Rob Herring, Laurent Pinchart, Linux Media Mailing List,
	linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On Thu, Apr 28, 2016 at 8:36 AM, Laurent Pinchart
<laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org> wrote:
>> > diff --git a/Documentation/devicetree/bindings/media/renesas,fcp.txt
>> > b/Documentation/devicetree/bindings/media/renesas,fcp.txt new file mode
>> > 100644
>> > index 000000000000..0c72ca24379f
>> > --- /dev/null
>> > +++ b/Documentation/devicetree/bindings/media/renesas,fcp.txt
>> > @@ -0,0 +1,31 @@
>> > +Renesas R-Car Frame Compression Processor (FCP)
>> > +-----------------------------------------------
>> > +
>> > +The FCP is a companion module of video processing modules in the Renesas
>> > R-Car +Gen3 SoCs. It provides data compression and decompression, data
>> > caching, and +conversion of AXI transactions in order to reduce the
>> > memory bandwidth. +
>> > +There are three types of FCP whose configuration and behaviour highly
>> > depend +on the module they are paired with.
>>
>> 3 types?, but I only see one compatible and no relationship with said
>> module described.
>
> The bindings currently support a single type, as that's all the driver
> currently supports and I'm not comfortable merging bindings without at least
> one test implementation. Should I clarify that with something as "These DT
> bindings currently support the "FCP for Video" type only" ?

Yes please.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 01/13] dt-bindings: Add Renesas R-Car FCP DT bindings
@ 2016-04-28  8:00         ` Geert Uytterhoeven
  0 siblings, 0 replies; 26+ messages in thread
From: Geert Uytterhoeven @ 2016-04-28  8:00 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Rob Herring, Laurent Pinchart, Linux Media Mailing List,
	linux-renesas-soc, devicetree

On Thu, Apr 28, 2016 at 8:36 AM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
>> > diff --git a/Documentation/devicetree/bindings/media/renesas,fcp.txt
>> > b/Documentation/devicetree/bindings/media/renesas,fcp.txt new file mode
>> > 100644
>> > index 000000000000..0c72ca24379f
>> > --- /dev/null
>> > +++ b/Documentation/devicetree/bindings/media/renesas,fcp.txt
>> > @@ -0,0 +1,31 @@
>> > +Renesas R-Car Frame Compression Processor (FCP)
>> > +-----------------------------------------------
>> > +
>> > +The FCP is a companion module of video processing modules in the Renesas
>> > R-Car +Gen3 SoCs. It provides data compression and decompression, data
>> > caching, and +conversion of AXI transactions in order to reduce the
>> > memory bandwidth. +
>> > +There are three types of FCP whose configuration and behaviour highly
>> > depend +on the module they are paired with.
>>
>> 3 types?, but I only see one compatible and no relationship with said
>> module described.
>
> The bindings currently support a single type, as that's all the driver
> currently supports and I'm not comfortable merging bindings without at least
> one test implementation. Should I clarify that with something as "These DT
> bindings currently support the "FCP for Video" type only" ?

Yes please.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH v2.1] dt-bindings: Add Renesas R-Car FCP DT bindings
  2016-04-25 21:36 ` [PATCH v2 01/13] dt-bindings: Add Renesas R-Car FCP DT bindings Laurent Pinchart
@ 2016-05-11 12:36       ` Laurent Pinchart
       [not found]   ` <1461620198-13428-2-git-send-email-laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
  1 sibling, 0 replies; 26+ messages in thread
From: Laurent Pinchart @ 2016-05-11 12:36 UTC (permalink / raw)
  To: linux-media-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
	Geert Uytterhoeven

The FCP is a companion module of video processing modules in the Renesas
R-Car Gen3 SoCs. It provides data compression and decompression, data
caching, and conversion of AXI transactions in order to reduce the
memory bandwidth.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
---
 .../devicetree/bindings/media/renesas,fcp.txt      | 32 ++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/renesas,fcp.txt

diff --git a/Documentation/devicetree/bindings/media/renesas,fcp.txt b/Documentation/devicetree/bindings/media/renesas,fcp.txt
new file mode 100644
index 000000000000..6a12960609d8
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/renesas,fcp.txt
@@ -0,0 +1,32 @@
+Renesas R-Car Frame Compression Processor (FCP)
+-----------------------------------------------
+
+The FCP is a companion module of video processing modules in the Renesas R-Car
+Gen3 SoCs. It provides data compression and decompression, data caching, and
+conversion of AXI transactions in order to reduce the memory bandwidth.
+
+There are three types of FCP: FCP for Codec (FCPC), FCP for VSP (FCPV) and FCP
+for FDP (FCPF). Their configuration and behaviour depend on the module they
+are paired with. These DT bindings currently support the FCPV only.
+
+ - compatible: Must be one or more of the following
+
+   - "renesas,r8a7795-fcpv" for R8A7795 (R-Car H3) compatible 'FCP for VSP'
+   - "renesas,fcpv" for generic compatible 'FCP for VSP'
+
+   When compatible with the generic version, nodes must list the
+   SoC-specific version corresponding to the platform first, followed by the
+   family-specific and/or generic versions.
+
+ - reg: the register base and size for the device registers
+ - clocks: Reference to the functional clock
+
+
+Device node example
+-------------------
+
+	fcpvd1: fcp@fea2f000 {
+		compatible = "renesas,r8a7795-fcpv", "renesas,fcpv";
+		reg = <0 0xfea2f000 0 0x200>;
+		clocks = <&cpg CPG_MOD 602>;
+	};
-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2.1] dt-bindings: Add Renesas R-Car FCP DT bindings
@ 2016-05-11 12:36       ` Laurent Pinchart
  0 siblings, 0 replies; 26+ messages in thread
From: Laurent Pinchart @ 2016-05-11 12:36 UTC (permalink / raw)
  To: linux-media
  Cc: linux-renesas-soc, devicetree, Rob Herring, Geert Uytterhoeven

The FCP is a companion module of video processing modules in the Renesas
R-Car Gen3 SoCs. It provides data compression and decompression, data
caching, and conversion of AXI transactions in order to reduce the
memory bandwidth.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 .../devicetree/bindings/media/renesas,fcp.txt      | 32 ++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/renesas,fcp.txt

diff --git a/Documentation/devicetree/bindings/media/renesas,fcp.txt b/Documentation/devicetree/bindings/media/renesas,fcp.txt
new file mode 100644
index 000000000000..6a12960609d8
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/renesas,fcp.txt
@@ -0,0 +1,32 @@
+Renesas R-Car Frame Compression Processor (FCP)
+-----------------------------------------------
+
+The FCP is a companion module of video processing modules in the Renesas R-Car
+Gen3 SoCs. It provides data compression and decompression, data caching, and
+conversion of AXI transactions in order to reduce the memory bandwidth.
+
+There are three types of FCP: FCP for Codec (FCPC), FCP for VSP (FCPV) and FCP
+for FDP (FCPF). Their configuration and behaviour depend on the module they
+are paired with. These DT bindings currently support the FCPV only.
+
+ - compatible: Must be one or more of the following
+
+   - "renesas,r8a7795-fcpv" for R8A7795 (R-Car H3) compatible 'FCP for VSP'
+   - "renesas,fcpv" for generic compatible 'FCP for VSP'
+
+   When compatible with the generic version, nodes must list the
+   SoC-specific version corresponding to the platform first, followed by the
+   family-specific and/or generic versions.
+
+ - reg: the register base and size for the device registers
+ - clocks: Reference to the functional clock
+
+
+Device node example
+-------------------
+
+	fcpvd1: fcp@fea2f000 {
+		compatible = "renesas,r8a7795-fcpv", "renesas,fcpv";
+		reg = <0 0xfea2f000 0 0x200>;
+		clocks = <&cpg CPG_MOD 602>;
+	};
-- 
Regards,

Laurent Pinchart


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH v2.1] dt-bindings: Add Renesas R-Car FCP DT bindings
  2016-05-11 12:36       ` Laurent Pinchart
  (?)
@ 2016-05-11 12:38       ` Geert Uytterhoeven
  -1 siblings, 0 replies; 26+ messages in thread
From: Geert Uytterhoeven @ 2016-05-11 12:38 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Linux Media Mailing List, linux-renesas-soc, devicetree, Rob Herring

On Wed, May 11, 2016 at 2:36 PM, Laurent Pinchart
<laurent.pinchart+renesas@ideasonboard.com> wrote:
> The FCP is a companion module of video processing modules in the Renesas
> R-Car Gen3 SoCs. It provides data compression and decompression, data
> caching, and conversion of AXI transactions in order to reduce the
> memory bandwidth.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2.1] dt-bindings: Add Renesas R-Car FCP DT bindings
  2016-05-11 12:36       ` Laurent Pinchart
  (?)
  (?)
@ 2016-05-11 13:05       ` Rob Herring
  -1 siblings, 0 replies; 26+ messages in thread
From: Rob Herring @ 2016-05-11 13:05 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-media, linux-renesas-soc, devicetree, Geert Uytterhoeven

On Wed, May 11, 2016 at 03:36:30PM +0300, Laurent Pinchart wrote:
> The FCP is a companion module of video processing modules in the Renesas
> R-Car Gen3 SoCs. It provides data compression and decompression, data
> caching, and conversion of AXI transactions in order to reduce the
> memory bandwidth.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
>  .../devicetree/bindings/media/renesas,fcp.txt      | 32 ++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/media/renesas,fcp.txt

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 05/13] v4l: vsp1: Add FCP support
  2016-04-25 21:36 ` [PATCH v2 05/13] v4l: vsp1: Add FCP support Laurent Pinchart
@ 2016-06-17 11:07   ` Mauro Carvalho Chehab
  2016-06-17 14:35     ` Laurent Pinchart
  0 siblings, 1 reply; 26+ messages in thread
From: Mauro Carvalho Chehab @ 2016-06-17 11:07 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: linux-media, linux-renesas-soc

Em Tue, 26 Apr 2016 00:36:30 +0300
Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> escreveu:

> 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              | 21 ++++++++++++++++++++-
>  4 files changed, 28 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 f453910050be..a3304466e628 100644
> --- a/drivers/media/platform/Kconfig
> +++ b/drivers/media/platform/Kconfig
> @@ -264,6 +264,7 @@ config VIDEO_RENESAS_VSP1
>  	tristate "Renesas VSP1 Video Processing Engine"
>  	depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && HAS_DMA
>  	depends on (ARCH_RENESAS && OF) || COMPILE_TEST
> +	depends on !ARM64 || VIDEO_RENESAS_FCP

It sounds that this will break compile-test on ARM64 for no good reason.

Thanks,
Mauro

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 05/13] v4l: vsp1: Add FCP support
  2016-06-17 11:07   ` Mauro Carvalho Chehab
@ 2016-06-17 14:35     ` Laurent Pinchart
  0 siblings, 0 replies; 26+ messages in thread
From: Laurent Pinchart @ 2016-06-17 14:35 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: Laurent Pinchart, linux-media, linux-renesas-soc

Hi Mauro,

Thank you for the review.

On Friday 17 Jun 2016 08:07:23 Mauro Carvalho Chehab wrote:
> Em Tue, 26 Apr 2016 00:36:30 +0300
> 
> Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> escreveu:
> > 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              | 21 +++++++++++++++-
> >  4 files changed, 28 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 f453910050be..a3304466e628 100644
> > --- a/drivers/media/platform/Kconfig
> > +++ b/drivers/media/platform/Kconfig
> > @@ -264,6 +264,7 @@ config VIDEO_RENESAS_VSP1
> >  	tristate "Renesas VSP1 Video Processing Engine"
> >  	depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && HAS_DMA
> >  	depends on (ARCH_RENESAS && OF) || COMPILE_TEST
> > +	depends on !ARM64 || VIDEO_RENESAS_FCP
> 
> It sounds that this will break compile-test on ARM64 for no good reason.

On ARM64 the VSP driver requires FCP support, you can still compile-test it 
without any problem as long as you enable VIDEO_RENESAS_FCP.

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2016-06-17 14:35 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-25 21:36 [PATCH v2 00/13] R-Car VSP improvements for v4.7 - Round 2 Laurent Pinchart
2016-04-25 21:36 ` [PATCH v2 01/13] dt-bindings: Add Renesas R-Car FCP DT bindings Laurent Pinchart
2016-04-28  2:54   ` Rob Herring
2016-04-28  6:36     ` Laurent Pinchart
2016-04-28  8:00       ` Geert Uytterhoeven
2016-04-28  8:00         ` Geert Uytterhoeven
     [not found]   ` <1461620198-13428-2-git-send-email-laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
2016-05-11 12:36     ` [PATCH v2.1] " Laurent Pinchart
2016-05-11 12:36       ` Laurent Pinchart
2016-05-11 12:38       ` Geert Uytterhoeven
2016-05-11 13:05       ` Rob Herring
2016-04-25 21:36 ` [PATCH v2 02/13] v4l: Add Renesas R-Car FCP driver Laurent Pinchart
2016-04-25 21:36 ` [PATCH v2 03/13] v4l: vsp1: Implement runtime PM support Laurent Pinchart
2016-04-25 21:36 ` [PATCH v2 04/13] v4l: vsp1: Don't handle clocks manually Laurent Pinchart
2016-04-25 21:36 ` [PATCH v2 05/13] v4l: vsp1: Add FCP support Laurent Pinchart
2016-06-17 11:07   ` Mauro Carvalho Chehab
2016-06-17 14:35     ` Laurent Pinchart
2016-04-25 21:36 ` [PATCH v2 06/13] v4l: vsp1: Add output node value to routing table Laurent Pinchart
2016-04-25 21:36 ` [PATCH v2 07/13] v4l: vsp1: Replace container_of() with dedicated macro Laurent Pinchart
2016-04-25 21:36 ` [PATCH v2 08/13] v4l: vsp1: Make vsp1_entity_get_pad_compose() more generic Laurent Pinchart
2016-04-26 18:09   ` Sergei Shtylyov
2016-04-27 15:26     ` Laurent Pinchart
2016-04-25 21:36 ` [PATCH v2 09/13] v4l: vsp1: Move frame sequence number from video node to pipeline Laurent Pinchart
2016-04-25 21:36 ` [PATCH v2 10/13] v4l: vsp1: Group DRM RPF parameters in a structure Laurent Pinchart
2016-04-25 21:36 ` [PATCH v2 11/13] drm: rcar-du: Add alpha support for VSP planes Laurent Pinchart
2016-04-25 21:36 ` [PATCH v2 12/13] drm: rcar-du: Add Z-order " Laurent Pinchart
2016-04-25 21:36 ` [PATCH v2 13/13] v4l: vsp1: Remove deprecated DRM API Laurent Pinchart

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.