linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [media] imx: switch from V4L2 OF to V4L2 fwnode API
@ 2017-05-04 13:37 Philipp Zabel
  2017-05-04 21:55 ` Sakari Ailus
  2017-06-07  1:00 ` Steve Longerbeam
  0 siblings, 2 replies; 4+ messages in thread
From: Philipp Zabel @ 2017-05-04 13:37 UTC (permalink / raw)
  To: linux-media; +Cc: Steve Longerbeam, Sakari Ailus, kernel, Philipp Zabel

Switch from the v4l2_of_ APIs to the v4l2_fwnode_ APIs so this driver
can work if the patch "v4l: Switch from V4L2 OF not V4L2 fwnode API"
is applied before it. Tested against
https://git.linuxtv.org/sailus/media_tree.git/log/?h=v4l2-acpi-merge

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/staging/media/imx/imx-media-capture.c |  2 +-
 drivers/staging/media/imx/imx-media-csi.c     | 10 +++++-----
 drivers/staging/media/imx/imx-media-dev.c     | 19 ++++++++++---------
 drivers/staging/media/imx/imx-media-fim.c     |  1 -
 drivers/staging/media/imx/imx-media-of.c      |  6 ++++--
 drivers/staging/media/imx/imx-media.h         |  4 ++--
 drivers/staging/media/imx/imx6-mipi-csi2.c    |  9 +++++----
 7 files changed, 27 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/media/imx/imx-media-capture.c b/drivers/staging/media/imx/imx-media-capture.c
index 8b28dbc21566c..ddab4c249da25 100644
--- a/drivers/staging/media/imx/imx-media-capture.c
+++ b/drivers/staging/media/imx/imx-media-capture.c
@@ -21,8 +21,8 @@
 #include <media/v4l2-ctrls.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-event.h>
+#include <media/v4l2-fwnode.h>
 #include <media/v4l2-ioctl.h>
-#include <media/v4l2-of.h>
 #include <media/v4l2-mc.h>
 #include <media/v4l2-subdev.h>
 #include <media/videobuf2-dma-contig.h>
diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c
index 447c597111852..fdf90dc7d212e 100644
--- a/drivers/staging/media/imx/imx-media-csi.c
+++ b/drivers/staging/media/imx/imx-media-csi.c
@@ -17,8 +17,8 @@
 #include <media/v4l2-ctrls.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-event.h>
+#include <media/v4l2-fwnode.h>
 #include <media/v4l2-mc.h>
-#include <media/v4l2-of.h>
 #include <media/v4l2-subdev.h>
 #include <media/videobuf2-dma-contig.h>
 #include <video/imx-ipu-v3.h>
@@ -307,7 +307,7 @@ static void csi_idmac_unsetup_vb2_buf(struct csi_priv *priv,
 static int csi_idmac_setup_channel(struct csi_priv *priv)
 {
 	struct imx_media_video_dev *vdev = priv->vdev;
-	struct v4l2_of_endpoint *sensor_ep;
+	struct v4l2_fwnode_endpoint *sensor_ep;
 	struct v4l2_mbus_framefmt *infmt;
 	struct ipu_image image;
 	u32 passthrough_bits;
@@ -557,7 +557,7 @@ static int csi_setup(struct csi_priv *priv)
 {
 	struct v4l2_mbus_framefmt *infmt, *outfmt;
 	struct v4l2_mbus_config sensor_mbus_cfg;
-	struct v4l2_of_endpoint *sensor_ep;
+	struct v4l2_fwnode_endpoint *sensor_ep;
 	struct v4l2_mbus_framefmt if_fmt;
 	const struct csi_skip_desc *skip;
 
@@ -957,7 +957,7 @@ static int csi_link_validate(struct v4l2_subdev *sd,
 {
 	struct csi_priv *priv = v4l2_get_subdevdata(sd);
 	const struct imx_media_pixfmt *incc;
-	struct v4l2_of_endpoint *sensor_ep;
+	struct v4l2_fwnode_endpoint *sensor_ep;
 	struct imx_media_subdev *sensor;
 	bool is_csi2;
 	int ret;
@@ -1066,7 +1066,7 @@ static void csi_try_crop(struct csi_priv *priv,
 			 struct v4l2_mbus_framefmt *infmt,
 			 struct imx_media_subdev *sensor)
 {
-	struct v4l2_of_endpoint *sensor_ep;
+	struct v4l2_fwnode_endpoint *sensor_ep;
 
 	sensor_ep = &sensor->sensor_ep;
 
diff --git a/drivers/staging/media/imx/imx-media-dev.c b/drivers/staging/media/imx/imx-media-dev.c
index d149d2f222f10..488c4d24783d9 100644
--- a/drivers/staging/media/imx/imx-media-dev.c
+++ b/drivers/staging/media/imx/imx-media-dev.c
@@ -40,14 +40,15 @@ imx_media_find_async_subdev(struct imx_media_dev *imxmd,
 			    struct device_node *np,
 			    const char *devname)
 {
+	struct fwnode_handle *fwnode = np ? of_fwnode_handle(np) : NULL;
 	struct imx_media_subdev *imxsd;
 	int i;
 
 	for (i = 0; i < imxmd->subdev_notifier.num_subdevs; i++) {
 		imxsd = &imxmd->subdev[i];
 		switch (imxsd->asd.match_type) {
-		case V4L2_ASYNC_MATCH_OF:
-			if (np && imxsd->asd.match.of.node == np)
+		case V4L2_ASYNC_MATCH_FWNODE:
+			if (fwnode && imxsd->asd.match.fwnode.fwnode == fwnode)
 				return imxsd;
 			break;
 		case V4L2_ASYNC_MATCH_DEVNAME:
@@ -65,8 +66,8 @@ imx_media_find_async_subdev(struct imx_media_dev *imxmd,
 
 /*
  * Adds a subdev to the async subdev list. If np is non-NULL, adds
- * the async as a V4L2_ASYNC_MATCH_OF match type, otherwise as a
- * V4L2_ASYNC_MATCH_DEVNAME match type using the dev_name of the
+ * the async as a V4L2_ASYNC_MATCH_FWNODE match type, otherwise as
+ * a V4L2_ASYNC_MATCH_DEVNAME match type using the dev_name of the
  * given platform_device. This is called during driver load when
  * forming the async subdev list.
  */
@@ -101,8 +102,8 @@ imx_media_add_async_subdev(struct imx_media_dev *imxmd,
 
 	asd = &imxsd->asd;
 	if (np) {
-		asd->match_type = V4L2_ASYNC_MATCH_OF;
-		asd->match.of.node = np;
+		asd->match_type = V4L2_ASYNC_MATCH_FWNODE;
+		asd->match.fwnode.fwnode = of_fwnode_handle(np);
 	} else {
 		asd->match_type = V4L2_ASYNC_MATCH_DEVNAME;
 		strncpy(imxsd->devname, devname, sizeof(imxsd->devname));
@@ -114,7 +115,7 @@ imx_media_add_async_subdev(struct imx_media_dev *imxmd,
 	imxmd->subdev_notifier.num_subdevs++;
 
 	dev_dbg(imxmd->md.dev, "%s: added %s, match type %s\n",
-		__func__, np ? np->name : devname, np ? "OF" : "DEVNAME");
+		__func__, np ? np->name : devname, np ? "FWNODE" : "DEVNAME");
 
 	return imxsd;
 }
@@ -194,11 +195,11 @@ static int imx_media_subdev_bound(struct v4l2_async_notifier *notifier,
 				  struct v4l2_async_subdev *asd)
 {
 	struct imx_media_dev *imxmd = notifier2dev(notifier);
+	struct device_node *np = to_of_node(dev_fwnode(sd->dev));
 	struct imx_media_subdev *imxsd;
 	int ret = -EINVAL;
 
-	imxsd = imx_media_find_async_subdev(imxmd, sd->of_node,
-					    dev_name(sd->dev));
+	imxsd = imx_media_find_async_subdev(imxmd, np, dev_name(sd->dev));
 	if (!imxsd)
 		goto out;
 
diff --git a/drivers/staging/media/imx/imx-media-fim.c b/drivers/staging/media/imx/imx-media-fim.c
index bd738ac9af8db..2cc7011cac036 100644
--- a/drivers/staging/media/imx/imx-media-fim.c
+++ b/drivers/staging/media/imx/imx-media-fim.c
@@ -13,7 +13,6 @@
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <media/v4l2-ctrls.h>
-#include <media/v4l2-of.h>
 #include <media/v4l2-subdev.h>
 #include <media/imx.h>
 #include "imx-media.h"
diff --git a/drivers/staging/media/imx/imx-media-of.c b/drivers/staging/media/imx/imx-media-of.c
index 1c7426fed979e..9e576ce8a0875 100644
--- a/drivers/staging/media/imx/imx-media-of.c
+++ b/drivers/staging/media/imx/imx-media-of.c
@@ -13,9 +13,10 @@
 #include <linux/of_platform.h>
 #include <media/v4l2-ctrls.h>
 #include <media/v4l2-device.h>
-#include <media/v4l2-of.h>
+#include <media/v4l2-fwnode.h>
 #include <media/v4l2-subdev.h>
 #include <media/videobuf2-dma-contig.h>
+#include <linux/of_graph.h>
 #include <video/imx-ipu-v3.h>
 #include "imx-media.h"
 
@@ -41,7 +42,8 @@ static void of_parse_sensor(struct imx_media_dev *imxmd,
 
 	endpoint = of_graph_get_next_endpoint(sensor_np, NULL);
 	if (endpoint) {
-		v4l2_of_parse_endpoint(endpoint, &sensor->sensor_ep);
+		v4l2_fwnode_endpoint_parse(of_fwnode_handle(endpoint),
+					   &sensor->sensor_ep);
 		of_node_put(endpoint);
 	}
 }
diff --git a/drivers/staging/media/imx/imx-media.h b/drivers/staging/media/imx/imx-media.h
index 76b3d364275b3..3d7e8bb90e239 100644
--- a/drivers/staging/media/imx/imx-media.h
+++ b/drivers/staging/media/imx/imx-media.h
@@ -13,7 +13,7 @@
 
 #include <media/v4l2-ctrls.h>
 #include <media/v4l2-device.h>
-#include <media/v4l2-of.h>
+#include <media/v4l2-fwnode.h>
 #include <media/v4l2-subdev.h>
 #include <media/videobuf2-dma-contig.h>
 #include <video/imx-ipu-v3.h>
@@ -149,7 +149,7 @@ struct imx_media_subdev {
 	char devname[32];
 
 	/* if this is a sensor */
-	struct v4l2_of_endpoint sensor_ep;
+	struct v4l2_fwnode_endpoint sensor_ep;
 };
 
 struct imx_media_dev {
diff --git a/drivers/staging/media/imx/imx6-mipi-csi2.c b/drivers/staging/media/imx/imx6-mipi-csi2.c
index 4f778b7ef51c5..bb3150887ac08 100644
--- a/drivers/staging/media/imx/imx6-mipi-csi2.c
+++ b/drivers/staging/media/imx/imx6-mipi-csi2.c
@@ -14,9 +14,10 @@
 #include <linux/iopoll.h>
 #include <linux/irq.h>
 #include <linux/module.h>
+#include <linux/of_graph.h>
 #include <linux/platform_device.h>
 #include <media/v4l2-device.h>
-#include <media/v4l2-of.h>
+#include <media/v4l2-fwnode.h>
 #include <media/v4l2-subdev.h>
 #include "imx-media.h"
 
@@ -43,7 +44,7 @@ struct csi2_dev {
 	struct clk             *pllref_clk;
 	struct clk             *pix_clk; /* what is this? */
 	void __iomem           *base;
-	struct v4l2_of_bus_mipi_csi2 bus;
+	struct v4l2_fwnode_bus_mipi_csi2 bus;
 
 	/* lock to protect all members below */
 	struct mutex lock;
@@ -560,7 +561,7 @@ static int csi2_parse_endpoints(struct csi2_dev *csi2)
 {
 	struct device_node *node = csi2->dev->of_node;
 	struct device_node *epnode;
-	struct v4l2_of_endpoint ep;
+	struct v4l2_fwnode_endpoint ep;
 
 	epnode = of_graph_get_endpoint_by_regs(node, 0, -1);
 	if (!epnode) {
@@ -568,7 +569,7 @@ static int csi2_parse_endpoints(struct csi2_dev *csi2)
 		return -EINVAL;
 	}
 
-	v4l2_of_parse_endpoint(epnode, &ep);
+	v4l2_fwnode_endpoint_parse(of_fwnode_handle(epnode), &ep);
 	of_node_put(epnode);
 
 	if (ep.bus_type != V4L2_MBUS_CSI2) {
-- 
2.11.0

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

* Re: [PATCH] [media] imx: switch from V4L2 OF to V4L2 fwnode API
  2017-05-04 13:37 [PATCH] [media] imx: switch from V4L2 OF to V4L2 fwnode API Philipp Zabel
@ 2017-05-04 21:55 ` Sakari Ailus
  2017-06-07  1:00 ` Steve Longerbeam
  1 sibling, 0 replies; 4+ messages in thread
From: Sakari Ailus @ 2017-05-04 21:55 UTC (permalink / raw)
  To: Philipp Zabel; +Cc: linux-media, Steve Longerbeam, kernel

Hi Philipp,

Thanks for the patch!

On Thu, May 04, 2017 at 03:37:30PM +0200, Philipp Zabel wrote:
...
> @@ -194,11 +195,11 @@ static int imx_media_subdev_bound(struct v4l2_async_notifier *notifier,
>  				  struct v4l2_async_subdev *asd)
>  {
>  	struct imx_media_dev *imxmd = notifier2dev(notifier);
> +	struct device_node *np = to_of_node(dev_fwnode(sd->dev));

dev_fwnode(sd->dev) isn't necessarily the same as sd->fwnode. How about
to_of_node(sd->fwnode) instead?

I realised I had left both v4l2_subdev->of_node and v4l2_subdev->fwnode;
v4l2_subdev->of_node is unused. I'll remove it.

The other changes seem good to me.

>  	struct imx_media_subdev *imxsd;
>  	int ret = -EINVAL;
>  
> -	imxsd = imx_media_find_async_subdev(imxmd, sd->of_node,
> -					    dev_name(sd->dev));
> +	imxsd = imx_media_find_async_subdev(imxmd, np, dev_name(sd->dev));
>  	if (!imxsd)
>  		goto out;
>  

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ailus@iki.fi	XMPP: sailus@retiisi.org.uk

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

* Re: [PATCH] [media] imx: switch from V4L2 OF to V4L2 fwnode API
  2017-05-04 13:37 [PATCH] [media] imx: switch from V4L2 OF to V4L2 fwnode API Philipp Zabel
  2017-05-04 21:55 ` Sakari Ailus
@ 2017-06-07  1:00 ` Steve Longerbeam
  2017-06-07  9:37   ` Philipp Zabel
  1 sibling, 1 reply; 4+ messages in thread
From: Steve Longerbeam @ 2017-06-07  1:00 UTC (permalink / raw)
  To: Philipp Zabel, linux-media; +Cc: Sakari Ailus, kernel

Hi Philipp,

v4l2_fwnode patch has been merged to mediatree, so I've applied this
to my imx-media-staging-md-v16 branch, thanks for the patch!

However before I can submit version 8 of the patchset, the video-mux
driver also needs conversion. Can you submit a version 8 of your
video-mux patchset (your last was v7) containing the switch to
v4l2-fwnode, and I will incorporate into the imx-media v8 patchset.

Thanks!
Steve


On 05/04/2017 06:37 AM, Philipp Zabel wrote:
> Switch from the v4l2_of_ APIs to the v4l2_fwnode_ APIs so this driver
> can work if the patch "v4l: Switch from V4L2 OF not V4L2 fwnode API"
> is applied before it. Tested against
> https://git.linuxtv.org/sailus/media_tree.git/log/?h=v4l2-acpi-merge
> 
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> ---
>   drivers/staging/media/imx/imx-media-capture.c |  2 +-
>   drivers/staging/media/imx/imx-media-csi.c     | 10 +++++-----
>   drivers/staging/media/imx/imx-media-dev.c     | 19 ++++++++++---------
>   drivers/staging/media/imx/imx-media-fim.c     |  1 -
>   drivers/staging/media/imx/imx-media-of.c      |  6 ++++--
>   drivers/staging/media/imx/imx-media.h         |  4 ++--
>   drivers/staging/media/imx/imx6-mipi-csi2.c    |  9 +++++----
>   7 files changed, 27 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/staging/media/imx/imx-media-capture.c b/drivers/staging/media/imx/imx-media-capture.c
> index 8b28dbc21566c..ddab4c249da25 100644
> --- a/drivers/staging/media/imx/imx-media-capture.c
> +++ b/drivers/staging/media/imx/imx-media-capture.c
> @@ -21,8 +21,8 @@
>   #include <media/v4l2-ctrls.h>
>   #include <media/v4l2-device.h>
>   #include <media/v4l2-event.h>
> +#include <media/v4l2-fwnode.h>
>   #include <media/v4l2-ioctl.h>
> -#include <media/v4l2-of.h>
>   #include <media/v4l2-mc.h>
>   #include <media/v4l2-subdev.h>
>   #include <media/videobuf2-dma-contig.h>
> diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c
> index 447c597111852..fdf90dc7d212e 100644
> --- a/drivers/staging/media/imx/imx-media-csi.c
> +++ b/drivers/staging/media/imx/imx-media-csi.c
> @@ -17,8 +17,8 @@
>   #include <media/v4l2-ctrls.h>
>   #include <media/v4l2-device.h>
>   #include <media/v4l2-event.h>
> +#include <media/v4l2-fwnode.h>
>   #include <media/v4l2-mc.h>
> -#include <media/v4l2-of.h>
>   #include <media/v4l2-subdev.h>
>   #include <media/videobuf2-dma-contig.h>
>   #include <video/imx-ipu-v3.h>
> @@ -307,7 +307,7 @@ static void csi_idmac_unsetup_vb2_buf(struct csi_priv *priv,
>   static int csi_idmac_setup_channel(struct csi_priv *priv)
>   {
>   	struct imx_media_video_dev *vdev = priv->vdev;
> -	struct v4l2_of_endpoint *sensor_ep;
> +	struct v4l2_fwnode_endpoint *sensor_ep;
>   	struct v4l2_mbus_framefmt *infmt;
>   	struct ipu_image image;
>   	u32 passthrough_bits;
> @@ -557,7 +557,7 @@ static int csi_setup(struct csi_priv *priv)
>   {
>   	struct v4l2_mbus_framefmt *infmt, *outfmt;
>   	struct v4l2_mbus_config sensor_mbus_cfg;
> -	struct v4l2_of_endpoint *sensor_ep;
> +	struct v4l2_fwnode_endpoint *sensor_ep;
>   	struct v4l2_mbus_framefmt if_fmt;
>   	const struct csi_skip_desc *skip;
>   
> @@ -957,7 +957,7 @@ static int csi_link_validate(struct v4l2_subdev *sd,
>   {
>   	struct csi_priv *priv = v4l2_get_subdevdata(sd);
>   	const struct imx_media_pixfmt *incc;
> -	struct v4l2_of_endpoint *sensor_ep;
> +	struct v4l2_fwnode_endpoint *sensor_ep;
>   	struct imx_media_subdev *sensor;
>   	bool is_csi2;
>   	int ret;
> @@ -1066,7 +1066,7 @@ static void csi_try_crop(struct csi_priv *priv,
>   			 struct v4l2_mbus_framefmt *infmt,
>   			 struct imx_media_subdev *sensor)
>   {
> -	struct v4l2_of_endpoint *sensor_ep;
> +	struct v4l2_fwnode_endpoint *sensor_ep;
>   
>   	sensor_ep = &sensor->sensor_ep;
>   
> diff --git a/drivers/staging/media/imx/imx-media-dev.c b/drivers/staging/media/imx/imx-media-dev.c
> index d149d2f222f10..488c4d24783d9 100644
> --- a/drivers/staging/media/imx/imx-media-dev.c
> +++ b/drivers/staging/media/imx/imx-media-dev.c
> @@ -40,14 +40,15 @@ imx_media_find_async_subdev(struct imx_media_dev *imxmd,
>   			    struct device_node *np,
>   			    const char *devname)
>   {
> +	struct fwnode_handle *fwnode = np ? of_fwnode_handle(np) : NULL;
>   	struct imx_media_subdev *imxsd;
>   	int i;
>   
>   	for (i = 0; i < imxmd->subdev_notifier.num_subdevs; i++) {
>   		imxsd = &imxmd->subdev[i];
>   		switch (imxsd->asd.match_type) {
> -		case V4L2_ASYNC_MATCH_OF:
> -			if (np && imxsd->asd.match.of.node == np)
> +		case V4L2_ASYNC_MATCH_FWNODE:
> +			if (fwnode && imxsd->asd.match.fwnode.fwnode == fwnode)
>   				return imxsd;
>   			break;
>   		case V4L2_ASYNC_MATCH_DEVNAME:
> @@ -65,8 +66,8 @@ imx_media_find_async_subdev(struct imx_media_dev *imxmd,
>   
>   /*
>    * Adds a subdev to the async subdev list. If np is non-NULL, adds
> - * the async as a V4L2_ASYNC_MATCH_OF match type, otherwise as a
> - * V4L2_ASYNC_MATCH_DEVNAME match type using the dev_name of the
> + * the async as a V4L2_ASYNC_MATCH_FWNODE match type, otherwise as
> + * a V4L2_ASYNC_MATCH_DEVNAME match type using the dev_name of the
>    * given platform_device. This is called during driver load when
>    * forming the async subdev list.
>    */
> @@ -101,8 +102,8 @@ imx_media_add_async_subdev(struct imx_media_dev *imxmd,
>   
>   	asd = &imxsd->asd;
>   	if (np) {
> -		asd->match_type = V4L2_ASYNC_MATCH_OF;
> -		asd->match.of.node = np;
> +		asd->match_type = V4L2_ASYNC_MATCH_FWNODE;
> +		asd->match.fwnode.fwnode = of_fwnode_handle(np);
>   	} else {
>   		asd->match_type = V4L2_ASYNC_MATCH_DEVNAME;
>   		strncpy(imxsd->devname, devname, sizeof(imxsd->devname));
> @@ -114,7 +115,7 @@ imx_media_add_async_subdev(struct imx_media_dev *imxmd,
>   	imxmd->subdev_notifier.num_subdevs++;
>   
>   	dev_dbg(imxmd->md.dev, "%s: added %s, match type %s\n",
> -		__func__, np ? np->name : devname, np ? "OF" : "DEVNAME");
> +		__func__, np ? np->name : devname, np ? "FWNODE" : "DEVNAME");
>   
>   	return imxsd;
>   }
> @@ -194,11 +195,11 @@ static int imx_media_subdev_bound(struct v4l2_async_notifier *notifier,
>   				  struct v4l2_async_subdev *asd)
>   {
>   	struct imx_media_dev *imxmd = notifier2dev(notifier);
> +	struct device_node *np = to_of_node(dev_fwnode(sd->dev));
>   	struct imx_media_subdev *imxsd;
>   	int ret = -EINVAL;
>   
> -	imxsd = imx_media_find_async_subdev(imxmd, sd->of_node,
> -					    dev_name(sd->dev));
> +	imxsd = imx_media_find_async_subdev(imxmd, np, dev_name(sd->dev));
>   	if (!imxsd)
>   		goto out;
>   
> diff --git a/drivers/staging/media/imx/imx-media-fim.c b/drivers/staging/media/imx/imx-media-fim.c
> index bd738ac9af8db..2cc7011cac036 100644
> --- a/drivers/staging/media/imx/imx-media-fim.c
> +++ b/drivers/staging/media/imx/imx-media-fim.c
> @@ -13,7 +13,6 @@
>   #include <linux/platform_device.h>
>   #include <linux/slab.h>
>   #include <media/v4l2-ctrls.h>
> -#include <media/v4l2-of.h>
>   #include <media/v4l2-subdev.h>
>   #include <media/imx.h>
>   #include "imx-media.h"
> diff --git a/drivers/staging/media/imx/imx-media-of.c b/drivers/staging/media/imx/imx-media-of.c
> index 1c7426fed979e..9e576ce8a0875 100644
> --- a/drivers/staging/media/imx/imx-media-of.c
> +++ b/drivers/staging/media/imx/imx-media-of.c
> @@ -13,9 +13,10 @@
>   #include <linux/of_platform.h>
>   #include <media/v4l2-ctrls.h>
>   #include <media/v4l2-device.h>
> -#include <media/v4l2-of.h>
> +#include <media/v4l2-fwnode.h>
>   #include <media/v4l2-subdev.h>
>   #include <media/videobuf2-dma-contig.h>
> +#include <linux/of_graph.h>
>   #include <video/imx-ipu-v3.h>
>   #include "imx-media.h"
>   
> @@ -41,7 +42,8 @@ static void of_parse_sensor(struct imx_media_dev *imxmd,
>   
>   	endpoint = of_graph_get_next_endpoint(sensor_np, NULL);
>   	if (endpoint) {
> -		v4l2_of_parse_endpoint(endpoint, &sensor->sensor_ep);
> +		v4l2_fwnode_endpoint_parse(of_fwnode_handle(endpoint),
> +					   &sensor->sensor_ep);
>   		of_node_put(endpoint);
>   	}
>   }
> diff --git a/drivers/staging/media/imx/imx-media.h b/drivers/staging/media/imx/imx-media.h
> index 76b3d364275b3..3d7e8bb90e239 100644
> --- a/drivers/staging/media/imx/imx-media.h
> +++ b/drivers/staging/media/imx/imx-media.h
> @@ -13,7 +13,7 @@
>   
>   #include <media/v4l2-ctrls.h>
>   #include <media/v4l2-device.h>
> -#include <media/v4l2-of.h>
> +#include <media/v4l2-fwnode.h>
>   #include <media/v4l2-subdev.h>
>   #include <media/videobuf2-dma-contig.h>
>   #include <video/imx-ipu-v3.h>
> @@ -149,7 +149,7 @@ struct imx_media_subdev {
>   	char devname[32];
>   
>   	/* if this is a sensor */
> -	struct v4l2_of_endpoint sensor_ep;
> +	struct v4l2_fwnode_endpoint sensor_ep;
>   };
>   
>   struct imx_media_dev {
> diff --git a/drivers/staging/media/imx/imx6-mipi-csi2.c b/drivers/staging/media/imx/imx6-mipi-csi2.c
> index 4f778b7ef51c5..bb3150887ac08 100644
> --- a/drivers/staging/media/imx/imx6-mipi-csi2.c
> +++ b/drivers/staging/media/imx/imx6-mipi-csi2.c
> @@ -14,9 +14,10 @@
>   #include <linux/iopoll.h>
>   #include <linux/irq.h>
>   #include <linux/module.h>
> +#include <linux/of_graph.h>
>   #include <linux/platform_device.h>
>   #include <media/v4l2-device.h>
> -#include <media/v4l2-of.h>
> +#include <media/v4l2-fwnode.h>
>   #include <media/v4l2-subdev.h>
>   #include "imx-media.h"
>   
> @@ -43,7 +44,7 @@ struct csi2_dev {
>   	struct clk             *pllref_clk;
>   	struct clk             *pix_clk; /* what is this? */
>   	void __iomem           *base;
> -	struct v4l2_of_bus_mipi_csi2 bus;
> +	struct v4l2_fwnode_bus_mipi_csi2 bus;
>   
>   	/* lock to protect all members below */
>   	struct mutex lock;
> @@ -560,7 +561,7 @@ static int csi2_parse_endpoints(struct csi2_dev *csi2)
>   {
>   	struct device_node *node = csi2->dev->of_node;
>   	struct device_node *epnode;
> -	struct v4l2_of_endpoint ep;
> +	struct v4l2_fwnode_endpoint ep;
>   
>   	epnode = of_graph_get_endpoint_by_regs(node, 0, -1);
>   	if (!epnode) {
> @@ -568,7 +569,7 @@ static int csi2_parse_endpoints(struct csi2_dev *csi2)
>   		return -EINVAL;
>   	}
>   
> -	v4l2_of_parse_endpoint(epnode, &ep);
> +	v4l2_fwnode_endpoint_parse(of_fwnode_handle(epnode), &ep);
>   	of_node_put(epnode);
>   
>   	if (ep.bus_type != V4L2_MBUS_CSI2) {
> 

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

* Re: [PATCH] [media] imx: switch from V4L2 OF to V4L2 fwnode API
  2017-06-07  1:00 ` Steve Longerbeam
@ 2017-06-07  9:37   ` Philipp Zabel
  0 siblings, 0 replies; 4+ messages in thread
From: Philipp Zabel @ 2017-06-07  9:37 UTC (permalink / raw)
  To: Steve Longerbeam; +Cc: linux-media, Sakari Ailus, kernel

On Tue, 2017-06-06 at 18:00 -0700, Steve Longerbeam wrote:
> Hi Philipp,
> 
> v4l2_fwnode patch has been merged to mediatree, so I've applied this
> to my imx-media-staging-md-v16 branch, thanks for the patch!
> 
> However before I can submit version 8 of the patchset, the video-mux
> driver also needs conversion. Can you submit a version 8 of your
> video-mux patchset (your last was v7) containing the switch to
> v4l2-fwnode, and I will incorporate into the imx-media v8 patchset.
> 
> Thanks!
> Steve

I removed the V4L2 OF API dependency from the video-mux driver, so it
works unchanged after the V4L2 fwnode API merge. But I had not yet sent
v8 with the documentation changes suggested by Sakari. Fixed now.

regards
Philipp

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

end of thread, other threads:[~2017-06-07  9:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-04 13:37 [PATCH] [media] imx: switch from V4L2 OF to V4L2 fwnode API Philipp Zabel
2017-05-04 21:55 ` Sakari Ailus
2017-06-07  1:00 ` Steve Longerbeam
2017-06-07  9:37   ` Philipp Zabel

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).