devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/6] v4l: vsp1: Add DT support
       [not found] <1394047444-30077-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com>
@ 2014-03-05 19:30 ` Laurent Pinchart
  2014-03-25 12:18   ` Laurent Pinchart
                     ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Laurent Pinchart @ 2014-03-05 19:30 UTC (permalink / raw)
  To: linux-media; +Cc: linux-sh, devicetree

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 .../devicetree/bindings/media/renesas,vsp1.txt     | 51 +++++++++++++++++++++
 drivers/media/platform/vsp1/vsp1_drv.c             | 52 ++++++++++++++++++----
 2 files changed, 95 insertions(+), 8 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/renesas,vsp1.txt

(With the DT mailing list CC'ed this time, sorry about that)

diff --git a/Documentation/devicetree/bindings/media/renesas,vsp1.txt b/Documentation/devicetree/bindings/media/renesas,vsp1.txt
new file mode 100644
index 0000000..3b828d4
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/renesas,vsp1.txt
@@ -0,0 +1,51 @@
+* Renesas VSP1 Video Processing Engine
+
+The VSP1 is a video processing engine that supports up-/down-scaling, alpha
+blending, color space conversion and various other image processing features.
+It can be found in the Renesas R-Car second generation SoCs.
+
+Required properties:
+
+  - compatible: Must contain "renesas,vsp1"
+
+  - reg: Base address and length of the registers block for the VSP1.
+  - interrupt-parent, interrupts: Specifier for the VSP1 interrupt.
+
+  - clocks: A list of phandle + clock-specifier pairs for the main VSP1 clock
+    and the optional auxiliary RT clock if needed. VSP1 instances that need an
+    auxiliary RT clock must specify the clock-names property.
+
+  - renesas,#rpf: Number of Read Pixel Formatter (RPF) modules in the VSP1.
+  - renesas,#uds: Number of Up Down Scaler (UDS) modules in the VSP1.
+  - renesas,#wpf: Number of Write Pixel Formatter (WPF) modules in the VSP1.
+
+
+Optional properties:
+
+  - clock-names: When the VSP1 requires an auxiliary RT clock this property
+    must be present and must contain "", "rt".
+
+  - renesas,has-lif: Boolean, indicates that the LCD Interface (LIF) module is
+    available.
+  - renesas,has-lut: Boolean, indicates that the Look Up Table (LUT) module is
+    available.
+  - renesas,has-sru: Boolean, indicates that the Super Resolution Unit (SRU)
+    module is available.
+
+
+Example: R8A7790 (R-Car H2) VSP1-S node
+
+	vsp1@fe928000 {
+		compatible = "renesas,vsp1";
+		reg = <0 0xfe928000 0 0x8000>;
+		interrupts = <0 267 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&mstp1_clks R8A7790_CLK_VSP1_SY>,
+			 <&mstp1_clks R8A7790_CLK_VSP1_RT>;
+		clock-names = "", "rt";
+
+		renesas,has-lut;
+		renesas,has-sru;
+		renesas,#rpf = <5>;
+		renesas,#uds = <3>;
+		renesas,#wpf = <4>;
+	};
diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c
index 5f774cc..b75ca84 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -16,6 +16,7 @@
 #include <linux/device.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/videodev2.h>
 
@@ -458,34 +459,59 @@ static const struct dev_pm_ops vsp1_pm_ops = {
  * Platform Driver
  */
 
-static struct vsp1_platform_data *
-vsp1_get_platform_data(struct platform_device *pdev)
+static int vsp1_validate_platform_data(struct platform_device *pdev,
+				       struct vsp1_platform_data *pdata)
 {
-	struct vsp1_platform_data *pdata = pdev->dev.platform_data;
-
 	if (pdata == NULL) {
 		dev_err(&pdev->dev, "missing platform data\n");
-		return NULL;
+		return -EINVAL;
 	}
 
 	if (pdata->rpf_count <= 0 || pdata->rpf_count > VPS1_MAX_RPF) {
 		dev_err(&pdev->dev, "invalid number of RPF (%u)\n",
 			pdata->rpf_count);
-		return NULL;
+		return -EINVAL;
 	}
 
 	if (pdata->uds_count <= 0 || pdata->uds_count > VPS1_MAX_UDS) {
 		dev_err(&pdev->dev, "invalid number of UDS (%u)\n",
 			pdata->uds_count);
-		return NULL;
+		return -EINVAL;
 	}
 
 	if (pdata->wpf_count <= 0 || pdata->wpf_count > VPS1_MAX_WPF) {
 		dev_err(&pdev->dev, "invalid number of WPF (%u)\n",
 			pdata->wpf_count);
-		return NULL;
+		return -EINVAL;
 	}
 
+	return 0;
+}
+
+static struct vsp1_platform_data *
+vsp1_get_platform_data(struct platform_device *pdev)
+{
+	struct device_node *np = pdev->dev.of_node;
+	struct vsp1_platform_data *pdata;
+
+	if (!IS_ENABLED(CONFIG_OF) || np == NULL)
+		return pdev->dev.platform_data;
+
+	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+	if (pdata == NULL)
+		return NULL;
+
+	if (of_property_read_bool(np, "renesas,has-lif"))
+		pdata->features |= VSP1_HAS_LIF;
+	if (of_property_read_bool(np, "renesas,has-lut"))
+		pdata->features |= VSP1_HAS_LUT;
+	if (of_property_read_bool(np, "renesas,has-sru"))
+		pdata->features |= VSP1_HAS_SRU;
+
+	of_property_read_u32(np, "renesas,#rpf", &pdata->rpf_count);
+	of_property_read_u32(np, "renesas,#uds", &pdata->uds_count);
+	of_property_read_u32(np, "renesas,#wpf", &pdata->wpf_count);
+
 	return pdata;
 }
 
@@ -508,6 +534,10 @@ static int vsp1_probe(struct platform_device *pdev)
 	if (vsp1->pdata == NULL)
 		return -ENODEV;
 
+	ret = vsp1_validate_platform_data(pdev, vsp1->pdata);
+	if (ret < 0)
+		return ret;
+
 	/* I/O, IRQ and clock resources */
 	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	vsp1->mmio = devm_ioremap_resource(&pdev->dev, io);
@@ -557,6 +587,11 @@ static int vsp1_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct of_device_id vsp1_of_match[] = {
+	{ .compatible = "renesas,vsp1" },
+	{ },
+};
+
 static struct platform_driver vsp1_platform_driver = {
 	.probe		= vsp1_probe,
 	.remove		= vsp1_remove,
@@ -564,6 +599,7 @@ static struct platform_driver vsp1_platform_driver = {
 		.owner	= THIS_MODULE,
 		.name	= "vsp1",
 		.pm	= &vsp1_pm_ops,
+		.of_match_table = of_match_ptr(vsp1_of_match),
 	},
 };
 
-- 
1.8.3.2


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

* Re: [PATCH 4/6] v4l: vsp1: Add DT support
  2014-03-05 19:30 ` [PATCH 4/6] v4l: vsp1: Add DT support Laurent Pinchart
@ 2014-03-25 12:18   ` Laurent Pinchart
  2014-04-10 23:04     ` Simon Horman
  2014-04-08 16:16   ` [PATCH v3 " Laurent Pinchart
  2014-04-08 16:46   ` [PATCH v4 4.1/6] v4l: vsp1: Add DT bindings documentation Laurent Pinchart
  2 siblings, 1 reply; 8+ messages in thread
From: Laurent Pinchart @ 2014-03-25 12:18 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: linux-media, linux-sh, devicetree

Hello,

Gentle ping. I'll send a pull request in a week if I don't receive any comment 
on the DT bindings in the meantime.

On Wednesday 05 March 2014 20:30:27 Laurent Pinchart wrote:
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
>  .../devicetree/bindings/media/renesas,vsp1.txt     | 51 +++++++++++++++++++
>  drivers/media/platform/vsp1/vsp1_drv.c             | 52 +++++++++++++++----
>  2 files changed, 95 insertions(+), 8 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/media/renesas,vsp1.txt
> 
> (With the DT mailing list CC'ed this time, sorry about that)
> 
> diff --git a/Documentation/devicetree/bindings/media/renesas,vsp1.txt
> b/Documentation/devicetree/bindings/media/renesas,vsp1.txt new file mode
> 100644
> index 0000000..3b828d4
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/renesas,vsp1.txt
> @@ -0,0 +1,51 @@
> +* Renesas VSP1 Video Processing Engine
> +
> +The VSP1 is a video processing engine that supports up-/down-scaling, alpha
> +blending, color space conversion and various other image processing
> features.
> +It can be found in the Renesas R-Car second generation SoCs.
> +
> +Required properties:
> +
> +  - compatible: Must contain "renesas,vsp1"
> +
> +  - reg: Base address and length of the registers block for the VSP1.
> +  - interrupt-parent, interrupts: Specifier for the VSP1 interrupt.
> +
> +  - clocks: A list of phandle + clock-specifier pairs for the main VSP1
> clock
> +    and the optional auxiliary RT clock if needed. VSP1 instances that need
> an
> +    auxiliary RT clock must specify the clock-names property.
> +
> +  - renesas,#rpf: Number of Read Pixel Formatter (RPF) modules in the VSP1.
> +  - renesas,#uds: Number of Up Down Scaler (UDS) modules in the VSP1.
> +  - renesas,#wpf: Number of Write Pixel Formatter (WPF) modules in the
> VSP1.
> +
> +
> +Optional properties:
> +
> +  - clock-names: When the VSP1 requires an auxiliary RT clock this property
> +    must be present and must contain "", "rt".
> +
> +  - renesas,has-lif: Boolean, indicates that the LCD Interface (LIF) module
> is
> +    available.
> +  - renesas,has-lut: Boolean, indicates that the Look Up Table (LUT) module
> is
> +    available.
> +  - renesas,has-sru: Boolean, indicates that the Super Resolution Unit
> (SRU)
> +    module is available.
> +
> +
> +Example: R8A7790 (R-Car H2) VSP1-S node
> +
> +	vsp1@fe928000 {
> +		compatible = "renesas,vsp1";
> +		reg = <0 0xfe928000 0 0x8000>;
> +		interrupts = <0 267 IRQ_TYPE_LEVEL_HIGH>;
> +		clocks = <&mstp1_clks R8A7790_CLK_VSP1_SY>,
> +			 <&mstp1_clks R8A7790_CLK_VSP1_RT>;
> +		clock-names = "", "rt";
> +
> +		renesas,has-lut;
> +		renesas,has-sru;
> +		renesas,#rpf = <5>;
> +		renesas,#uds = <3>;
> +		renesas,#wpf = <4>;
> +	};
> diff --git a/drivers/media/platform/vsp1/vsp1_drv.c
> b/drivers/media/platform/vsp1/vsp1_drv.c index 5f774cc..b75ca84 100644
> --- a/drivers/media/platform/vsp1/vsp1_drv.c
> +++ b/drivers/media/platform/vsp1/vsp1_drv.c
> @@ -16,6 +16,7 @@
>  #include <linux/device.h>
>  #include <linux/interrupt.h>
>  #include <linux/module.h>
> +#include <linux/of.h>
>  #include <linux/platform_device.h>
>  #include <linux/videodev2.h>
> 
> @@ -458,34 +459,59 @@ static const struct dev_pm_ops vsp1_pm_ops = {
>   * Platform Driver
>   */
> 
> -static struct vsp1_platform_data *
> -vsp1_get_platform_data(struct platform_device *pdev)
> +static int vsp1_validate_platform_data(struct platform_device *pdev,
> +				       struct vsp1_platform_data *pdata)
>  {
> -	struct vsp1_platform_data *pdata = pdev->dev.platform_data;
> -
>  	if (pdata == NULL) {
>  		dev_err(&pdev->dev, "missing platform data\n");
> -		return NULL;
> +		return -EINVAL;
>  	}
> 
>  	if (pdata->rpf_count <= 0 || pdata->rpf_count > VPS1_MAX_RPF) {
>  		dev_err(&pdev->dev, "invalid number of RPF (%u)\n",
>  			pdata->rpf_count);
> -		return NULL;
> +		return -EINVAL;
>  	}
> 
>  	if (pdata->uds_count <= 0 || pdata->uds_count > VPS1_MAX_UDS) {
>  		dev_err(&pdev->dev, "invalid number of UDS (%u)\n",
>  			pdata->uds_count);
> -		return NULL;
> +		return -EINVAL;
>  	}
> 
>  	if (pdata->wpf_count <= 0 || pdata->wpf_count > VPS1_MAX_WPF) {
>  		dev_err(&pdev->dev, "invalid number of WPF (%u)\n",
>  			pdata->wpf_count);
> -		return NULL;
> +		return -EINVAL;
>  	}
> 
> +	return 0;
> +}
> +
> +static struct vsp1_platform_data *
> +vsp1_get_platform_data(struct platform_device *pdev)
> +{
> +	struct device_node *np = pdev->dev.of_node;
> +	struct vsp1_platform_data *pdata;
> +
> +	if (!IS_ENABLED(CONFIG_OF) || np == NULL)
> +		return pdev->dev.platform_data;
> +
> +	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
> +	if (pdata == NULL)
> +		return NULL;
> +
> +	if (of_property_read_bool(np, "renesas,has-lif"))
> +		pdata->features |= VSP1_HAS_LIF;
> +	if (of_property_read_bool(np, "renesas,has-lut"))
> +		pdata->features |= VSP1_HAS_LUT;
> +	if (of_property_read_bool(np, "renesas,has-sru"))
> +		pdata->features |= VSP1_HAS_SRU;
> +
> +	of_property_read_u32(np, "renesas,#rpf", &pdata->rpf_count);
> +	of_property_read_u32(np, "renesas,#uds", &pdata->uds_count);
> +	of_property_read_u32(np, "renesas,#wpf", &pdata->wpf_count);
> +
>  	return pdata;
>  }
> 
> @@ -508,6 +534,10 @@ static int vsp1_probe(struct platform_device *pdev)
>  	if (vsp1->pdata == NULL)
>  		return -ENODEV;
> 
> +	ret = vsp1_validate_platform_data(pdev, vsp1->pdata);
> +	if (ret < 0)
> +		return ret;
> +
>  	/* I/O, IRQ and clock resources */
>  	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	vsp1->mmio = devm_ioremap_resource(&pdev->dev, io);
> @@ -557,6 +587,11 @@ static int vsp1_remove(struct platform_device *pdev)
>  	return 0;
>  }
> 
> +static const struct of_device_id vsp1_of_match[] = {
> +	{ .compatible = "renesas,vsp1" },
> +	{ },
> +};
> +
>  static struct platform_driver vsp1_platform_driver = {
>  	.probe		= vsp1_probe,
>  	.remove		= vsp1_remove,
> @@ -564,6 +599,7 @@ static struct platform_driver vsp1_platform_driver = {
>  		.owner	= THIS_MODULE,
>  		.name	= "vsp1",
>  		.pm	= &vsp1_pm_ops,
> +		.of_match_table = of_match_ptr(vsp1_of_match),
>  	},
>  };

-- 
Regards,

Laurent Pinchart


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

* [PATCH v3 4/6] v4l: vsp1: Add DT support
  2014-03-05 19:30 ` [PATCH 4/6] v4l: vsp1: Add DT support Laurent Pinchart
  2014-03-25 12:18   ` Laurent Pinchart
@ 2014-04-08 16:16   ` Laurent Pinchart
  2014-04-08 16:26     ` Sylwester Nawrocki
  2014-04-08 16:46   ` [PATCH v4 4.1/6] v4l: vsp1: Add DT bindings documentation Laurent Pinchart
  2 siblings, 1 reply; 8+ messages in thread
From: Laurent Pinchart @ 2014-04-08 16:16 UTC (permalink / raw)
  To: linux-media; +Cc: devicetree, Sylwester Nawrocki

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 .../devicetree/bindings/media/renesas,vsp1.txt     | 43 ++++++++++++++++++
 drivers/media/platform/vsp1/vsp1_drv.c             | 52 ++++++++++++++++++----
 2 files changed, 87 insertions(+), 8 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/renesas,vsp1.txt

Hi,

This is the second last call (I'm perfectly aware of the logic flaw in this
sentence, thank you :-)) for DT bindings review, with a small change to the
bindings wording compared to v2. I plan to send a pull request at the end of
the week.

Changes since v2:

- Remove the interrupt-parent property
- Drop of_match_ptr() as the table is always compiled in

Changes since v1:

- Drop the clock-names property, as the VSP1 uses a single clock

diff --git a/Documentation/devicetree/bindings/media/renesas,vsp1.txt b/Documentation/devicetree/bindings/media/renesas,vsp1.txt
new file mode 100644
index 0000000..87fe08a
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/renesas,vsp1.txt
@@ -0,0 +1,43 @@
+* Renesas VSP1 Video Processing Engine
+
+The VSP1 is a video processing engine that supports up-/down-scaling, alpha
+blending, color space conversion and various other image processing features.
+It can be found in the Renesas R-Car second generation SoCs.
+
+Required properties:
+
+  - compatible: Must contain "renesas,vsp1"
+
+  - reg: Base address and length of the registers block for the VSP1.
+  - interrupts: VSP1 interrupt specifier.
+  - clocks: A phandle + clock-specifier pair for the VSP1 functional clock.
+
+  - renesas,#rpf: Number of Read Pixel Formatter (RPF) modules in the VSP1.
+  - renesas,#uds: Number of Up Down Scaler (UDS) modules in the VSP1.
+  - renesas,#wpf: Number of Write Pixel Formatter (WPF) modules in the VSP1.
+
+
+Optional properties:
+
+  - renesas,has-lif: Boolean, indicates that the LCD Interface (LIF) module is
+    available.
+  - renesas,has-lut: Boolean, indicates that the Look Up Table (LUT) module is
+    available.
+  - renesas,has-sru: Boolean, indicates that the Super Resolution Unit (SRU)
+    module is available.
+
+
+Example: R8A7790 (R-Car H2) VSP1-S node
+
+	vsp1@fe928000 {
+		compatible = "renesas,vsp1";
+		reg = <0 0xfe928000 0 0x8000>;
+		interrupts = <0 267 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&mstp1_clks R8A7790_CLK_VSP1_S>;
+
+		renesas,has-lut;
+		renesas,has-sru;
+		renesas,#rpf = <5>;
+		renesas,#uds = <3>;
+		renesas,#wpf = <4>;
+	};
diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c
index 28e1de3..c69ee06 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -16,6 +16,7 @@
 #include <linux/device.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/videodev2.h>
 
@@ -431,34 +432,59 @@ static const struct dev_pm_ops vsp1_pm_ops = {
  * Platform Driver
  */
 
-static struct vsp1_platform_data *
-vsp1_get_platform_data(struct platform_device *pdev)
+static int vsp1_validate_platform_data(struct platform_device *pdev,
+				       struct vsp1_platform_data *pdata)
 {
-	struct vsp1_platform_data *pdata = pdev->dev.platform_data;
-
 	if (pdata == NULL) {
 		dev_err(&pdev->dev, "missing platform data\n");
-		return NULL;
+		return -EINVAL;
 	}
 
 	if (pdata->rpf_count <= 0 || pdata->rpf_count > VPS1_MAX_RPF) {
 		dev_err(&pdev->dev, "invalid number of RPF (%u)\n",
 			pdata->rpf_count);
-		return NULL;
+		return -EINVAL;
 	}
 
 	if (pdata->uds_count <= 0 || pdata->uds_count > VPS1_MAX_UDS) {
 		dev_err(&pdev->dev, "invalid number of UDS (%u)\n",
 			pdata->uds_count);
-		return NULL;
+		return -EINVAL;
 	}
 
 	if (pdata->wpf_count <= 0 || pdata->wpf_count > VPS1_MAX_WPF) {
 		dev_err(&pdev->dev, "invalid number of WPF (%u)\n",
 			pdata->wpf_count);
-		return NULL;
+		return -EINVAL;
 	}
 
+	return 0;
+}
+
+static struct vsp1_platform_data *
+vsp1_get_platform_data(struct platform_device *pdev)
+{
+	struct device_node *np = pdev->dev.of_node;
+	struct vsp1_platform_data *pdata;
+
+	if (!IS_ENABLED(CONFIG_OF) || np == NULL)
+		return pdev->dev.platform_data;
+
+	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+	if (pdata == NULL)
+		return NULL;
+
+	if (of_property_read_bool(np, "renesas,has-lif"))
+		pdata->features |= VSP1_HAS_LIF;
+	if (of_property_read_bool(np, "renesas,has-lut"))
+		pdata->features |= VSP1_HAS_LUT;
+	if (of_property_read_bool(np, "renesas,has-sru"))
+		pdata->features |= VSP1_HAS_SRU;
+
+	of_property_read_u32(np, "renesas,#rpf", &pdata->rpf_count);
+	of_property_read_u32(np, "renesas,#uds", &pdata->uds_count);
+	of_property_read_u32(np, "renesas,#wpf", &pdata->wpf_count);
+
 	return pdata;
 }
 
@@ -481,6 +507,10 @@ static int vsp1_probe(struct platform_device *pdev)
 	if (vsp1->pdata == NULL)
 		return -ENODEV;
 
+	ret = vsp1_validate_platform_data(pdev, vsp1->pdata);
+	if (ret < 0)
+		return ret;
+
 	/* I/O, IRQ and clock resources */
 	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	vsp1->mmio = devm_ioremap_resource(&pdev->dev, io);
@@ -527,6 +557,11 @@ static int vsp1_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct of_device_id vsp1_of_match[] = {
+	{ .compatible = "renesas,vsp1" },
+	{ },
+};
+
 static struct platform_driver vsp1_platform_driver = {
 	.probe		= vsp1_probe,
 	.remove		= vsp1_remove,
@@ -534,6 +569,7 @@ static struct platform_driver vsp1_platform_driver = {
 		.owner	= THIS_MODULE,
 		.name	= "vsp1",
 		.pm	= &vsp1_pm_ops,
+		.of_match_table = vsp1_of_match,
 	},
 };
 
-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 4/6] v4l: vsp1: Add DT support
  2014-04-08 16:16   ` [PATCH v3 " Laurent Pinchart
@ 2014-04-08 16:26     ` Sylwester Nawrocki
  0 siblings, 0 replies; 8+ messages in thread
From: Sylwester Nawrocki @ 2014-04-08 16:26 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: linux-media, devicetree

Hi Laurent,

On 08/04/14 18:16, Laurent Pinchart wrote:

It may be worth to split DT binding documentation and the driver changes
into separate patches, and perhaps add some commit description here.
Either way fell free to stick:

Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>

> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
>
> ---
>  .../devicetree/bindings/media/renesas,vsp1.txt     | 43 ++++++++++++++++++
>  drivers/media/platform/vsp1/vsp1_drv.c             | 52 ++++++++++++++++++----
>  2 files changed, 87 insertions(+), 8 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/media/renesas,vsp1.txt
> 
> Hi,
> 
> This is the second last call (I'm perfectly aware of the logic flaw in this
> sentence, thank you :-)) for DT bindings review, with a small change to the
> bindings wording compared to v2. I plan to send a pull request at the end of
> the week.
> 
> Changes since v2:
> 
> - Remove the interrupt-parent property
> - Drop of_match_ptr() as the table is always compiled in
> 
> Changes since v1:
> 
> - Drop the clock-names property, as the VSP1 uses a single clock
> 
> diff --git a/Documentation/devicetree/bindings/media/renesas,vsp1.txt b/Documentation/devicetree/bindings/media/renesas,vsp1.txt
> new file mode 100644
> index 0000000..87fe08a
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/renesas,vsp1.txt
> @@ -0,0 +1,43 @@
> +* Renesas VSP1 Video Processing Engine
> +
> +The VSP1 is a video processing engine that supports up-/down-scaling, alpha
> +blending, color space conversion and various other image processing features.
> +It can be found in the Renesas R-Car second generation SoCs.
> +
> +Required properties:
> +
> +  - compatible: Must contain "renesas,vsp1"
> +
> +  - reg: Base address and length of the registers block for the VSP1.
> +  - interrupts: VSP1 interrupt specifier.
> +  - clocks: A phandle + clock-specifier pair for the VSP1 functional clock.
> +
> +  - renesas,#rpf: Number of Read Pixel Formatter (RPF) modules in the VSP1.
> +  - renesas,#uds: Number of Up Down Scaler (UDS) modules in the VSP1.
> +  - renesas,#wpf: Number of Write Pixel Formatter (WPF) modules in the VSP1.
> +
> +
> +Optional properties:
> +
> +  - renesas,has-lif: Boolean, indicates that the LCD Interface (LIF) module is
> +    available.
> +  - renesas,has-lut: Boolean, indicates that the Look Up Table (LUT) module is
> +    available.
> +  - renesas,has-sru: Boolean, indicates that the Super Resolution Unit (SRU)
> +    module is available.
> +
> +
> +Example: R8A7790 (R-Car H2) VSP1-S node
> +
> +	vsp1@fe928000 {
> +		compatible = "renesas,vsp1";
> +		reg = <0 0xfe928000 0 0x8000>;
> +		interrupts = <0 267 IRQ_TYPE_LEVEL_HIGH>;
> +		clocks = <&mstp1_clks R8A7790_CLK_VSP1_S>;
> +
> +		renesas,has-lut;
> +		renesas,has-sru;
> +		renesas,#rpf = <5>;
> +		renesas,#uds = <3>;
> +		renesas,#wpf = <4>;
> +	};
> diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c
> index 28e1de3..c69ee06 100644
> --- a/drivers/media/platform/vsp1/vsp1_drv.c
> +++ b/drivers/media/platform/vsp1/vsp1_drv.c
> @@ -16,6 +16,7 @@
>  #include <linux/device.h>
>  #include <linux/interrupt.h>
>  #include <linux/module.h>
> +#include <linux/of.h>
>  #include <linux/platform_device.h>
>  #include <linux/videodev2.h>
>  
> @@ -431,34 +432,59 @@ static const struct dev_pm_ops vsp1_pm_ops = {
>   * Platform Driver
>   */
>  
> -static struct vsp1_platform_data *
> -vsp1_get_platform_data(struct platform_device *pdev)
> +static int vsp1_validate_platform_data(struct platform_device *pdev,
> +				       struct vsp1_platform_data *pdata)
>  {
> -	struct vsp1_platform_data *pdata = pdev->dev.platform_data;
> -
>  	if (pdata == NULL) {
>  		dev_err(&pdev->dev, "missing platform data\n");
> -		return NULL;
> +		return -EINVAL;
>  	}
>  
>  	if (pdata->rpf_count <= 0 || pdata->rpf_count > VPS1_MAX_RPF) {
>  		dev_err(&pdev->dev, "invalid number of RPF (%u)\n",
>  			pdata->rpf_count);
> -		return NULL;
> +		return -EINVAL;
>  	}
>  
>  	if (pdata->uds_count <= 0 || pdata->uds_count > VPS1_MAX_UDS) {
>  		dev_err(&pdev->dev, "invalid number of UDS (%u)\n",
>  			pdata->uds_count);
> -		return NULL;
> +		return -EINVAL;
>  	}
>  
>  	if (pdata->wpf_count <= 0 || pdata->wpf_count > VPS1_MAX_WPF) {
>  		dev_err(&pdev->dev, "invalid number of WPF (%u)\n",
>  			pdata->wpf_count);
> -		return NULL;
> +		return -EINVAL;
>  	}
>  
> +	return 0;
> +}
> +
> +static struct vsp1_platform_data *
> +vsp1_get_platform_data(struct platform_device *pdev)
> +{
> +	struct device_node *np = pdev->dev.of_node;
> +	struct vsp1_platform_data *pdata;
> +
> +	if (!IS_ENABLED(CONFIG_OF) || np == NULL)
> +		return pdev->dev.platform_data;
> +
> +	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
> +	if (pdata == NULL)
> +		return NULL;
> +
> +	if (of_property_read_bool(np, "renesas,has-lif"))
> +		pdata->features |= VSP1_HAS_LIF;
> +	if (of_property_read_bool(np, "renesas,has-lut"))
> +		pdata->features |= VSP1_HAS_LUT;
> +	if (of_property_read_bool(np, "renesas,has-sru"))
> +		pdata->features |= VSP1_HAS_SRU;
> +
> +	of_property_read_u32(np, "renesas,#rpf", &pdata->rpf_count);
> +	of_property_read_u32(np, "renesas,#uds", &pdata->uds_count);
> +	of_property_read_u32(np, "renesas,#wpf", &pdata->wpf_count);
> +
>  	return pdata;
>  }
>  
> @@ -481,6 +507,10 @@ static int vsp1_probe(struct platform_device *pdev)
>  	if (vsp1->pdata == NULL)
>  		return -ENODEV;
>  
> +	ret = vsp1_validate_platform_data(pdev, vsp1->pdata);
> +	if (ret < 0)
> +		return ret;
> +
>  	/* I/O, IRQ and clock resources */
>  	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	vsp1->mmio = devm_ioremap_resource(&pdev->dev, io);
> @@ -527,6 +557,11 @@ static int vsp1_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> +static const struct of_device_id vsp1_of_match[] = {
> +	{ .compatible = "renesas,vsp1" },
> +	{ },
> +};
> +
>  static struct platform_driver vsp1_platform_driver = {
>  	.probe		= vsp1_probe,
>  	.remove		= vsp1_remove,
> @@ -534,6 +569,7 @@ static struct platform_driver vsp1_platform_driver = {
>  		.owner	= THIS_MODULE,
>  		.name	= "vsp1",
>  		.pm	= &vsp1_pm_ops,
> +		.of_match_table = vsp1_of_match,
>  	},
>  };

--
Regards,
Sylwester

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

* [PATCH v4 4.1/6] v4l: vsp1: Add DT bindings documentation
  2014-03-05 19:30 ` [PATCH 4/6] v4l: vsp1: Add DT support Laurent Pinchart
  2014-03-25 12:18   ` Laurent Pinchart
  2014-04-08 16:16   ` [PATCH v3 " Laurent Pinchart
@ 2014-04-08 16:46   ` Laurent Pinchart
  2 siblings, 0 replies; 8+ messages in thread
From: Laurent Pinchart @ 2014-04-08 16:46 UTC (permalink / raw)
  To: linux-media; +Cc: devicetree, Sylwester Nawrocki

All parameters supplied through platform data can now be passed through
the device tree.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
---
 .../devicetree/bindings/media/renesas,vsp1.txt     | 43 ++++++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/renesas,vsp1.txt

Changes since v3:

- Split DT bindings documentation and support in the driver to seperate patches
- Add a more verbose commit message

Changes since v2:

- Remove the interrupt-parent property
- Drop of_match_ptr() as the table is always compiled in

Changes since v1:

- Drop the clock-names property, as the VSP1 uses a single clock

diff --git a/Documentation/devicetree/bindings/media/renesas,vsp1.txt b/Documentation/devicetree/bindings/media/renesas,vsp1.txt
new file mode 100644
index 0000000..87fe08a
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/renesas,vsp1.txt
@@ -0,0 +1,43 @@
+* Renesas VSP1 Video Processing Engine
+
+The VSP1 is a video processing engine that supports up-/down-scaling, alpha
+blending, color space conversion and various other image processing features.
+It can be found in the Renesas R-Car second generation SoCs.
+
+Required properties:
+
+  - compatible: Must contain "renesas,vsp1"
+
+  - reg: Base address and length of the registers block for the VSP1.
+  - interrupts: VSP1 interrupt specifier.
+  - clocks: A phandle + clock-specifier pair for the VSP1 functional clock.
+
+  - renesas,#rpf: Number of Read Pixel Formatter (RPF) modules in the VSP1.
+  - renesas,#uds: Number of Up Down Scaler (UDS) modules in the VSP1.
+  - renesas,#wpf: Number of Write Pixel Formatter (WPF) modules in the VSP1.
+
+
+Optional properties:
+
+  - renesas,has-lif: Boolean, indicates that the LCD Interface (LIF) module is
+    available.
+  - renesas,has-lut: Boolean, indicates that the Look Up Table (LUT) module is
+    available.
+  - renesas,has-sru: Boolean, indicates that the Super Resolution Unit (SRU)
+    module is available.
+
+
+Example: R8A7790 (R-Car H2) VSP1-S node
+
+	vsp1@fe928000 {
+		compatible = "renesas,vsp1";
+		reg = <0 0xfe928000 0 0x8000>;
+		interrupts = <0 267 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&mstp1_clks R8A7790_CLK_VSP1_S>;
+
+		renesas,has-lut;
+		renesas,has-sru;
+		renesas,#rpf = <5>;
+		renesas,#uds = <3>;
+		renesas,#wpf = <4>;
+	};
-- 
1.8.3.2

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

* Re: [PATCH 4/6] v4l: vsp1: Add DT support
  2014-03-25 12:18   ` Laurent Pinchart
@ 2014-04-10 23:04     ` Simon Horman
  2014-04-10 23:37       ` Laurent Pinchart
  0 siblings, 1 reply; 8+ messages in thread
From: Simon Horman @ 2014-04-10 23:04 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: Laurent Pinchart, linux-media, linux-sh, devicetree

On Tue, Mar 25, 2014 at 01:18:22PM +0100, Laurent Pinchart wrote:
> Hello,
> 
> Gentle ping. I'll send a pull request in a week if I don't receive any comment 
> on the DT bindings in the meantime.

Hi Laurent,

one way or another can you let me know if/when the bindings are
accepted and I'll queue-up the shmobile patches.

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

* Re: [PATCH 4/6] v4l: vsp1: Add DT support
  2014-04-10 23:04     ` Simon Horman
@ 2014-04-10 23:37       ` Laurent Pinchart
  2014-04-11  0:04         ` Simon Horman
  0 siblings, 1 reply; 8+ messages in thread
From: Laurent Pinchart @ 2014-04-10 23:37 UTC (permalink / raw)
  To: Simon Horman, linux-media; +Cc: linux-sh, devicetree

Hi Simon,

On Friday 11 April 2014 08:04:18 Simon Horman wrote:
> On Tue, Mar 25, 2014 at 01:18:22PM +0100, Laurent Pinchart wrote:
> > Hello,
> > 
> > Gentle ping. I'll send a pull request in a week if I don't receive any
> > comment on the DT bindings in the meantime.
> 
> Hi Laurent,
> 
> one way or another can you let me know if/when the bindings are accepted and
> I'll queue-up the shmobile patches.

Sure. The DT bindings have been acked and I've sent a pull request. I'll let 
you know when the patches get pulled, until then there's no guarantee that the 
bindings won't change.

-- 
Regards,

Laurent Pinchart


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

* Re: [PATCH 4/6] v4l: vsp1: Add DT support
  2014-04-10 23:37       ` Laurent Pinchart
@ 2014-04-11  0:04         ` Simon Horman
  0 siblings, 0 replies; 8+ messages in thread
From: Simon Horman @ 2014-04-11  0:04 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: linux-media, linux-sh, devicetree

On Fri, Apr 11, 2014 at 01:37:11AM +0200, Laurent Pinchart wrote:
> Hi Simon,
> 
> On Friday 11 April 2014 08:04:18 Simon Horman wrote:
> > On Tue, Mar 25, 2014 at 01:18:22PM +0100, Laurent Pinchart wrote:
> > > Hello,
> > > 
> > > Gentle ping. I'll send a pull request in a week if I don't receive any
> > > comment on the DT bindings in the meantime.
> > 
> > Hi Laurent,
> > 
> > one way or another can you let me know if/when the bindings are accepted and
> > I'll queue-up the shmobile patches.
> 
> Sure. The DT bindings have been acked and I've sent a pull request. I'll
> let you know when the patches get pulled, until then there's no guarantee
> that the bindings won't change.

Thanks, got it.

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

end of thread, other threads:[~2014-04-11  0:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1394047444-30077-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com>
2014-03-05 19:30 ` [PATCH 4/6] v4l: vsp1: Add DT support Laurent Pinchart
2014-03-25 12:18   ` Laurent Pinchart
2014-04-10 23:04     ` Simon Horman
2014-04-10 23:37       ` Laurent Pinchart
2014-04-11  0:04         ` Simon Horman
2014-04-08 16:16   ` [PATCH v3 " Laurent Pinchart
2014-04-08 16:26     ` Sylwester Nawrocki
2014-04-08 16:46   ` [PATCH v4 4.1/6] v4l: vsp1: Add DT bindings documentation Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).