Skip to contentSkip to conversation

soc_camera: initial of code

PATCH In review Ben Dooks 4 participants 10 messages Apr 14, 2014 – Jun 6, 2014

Subsystems (2)
lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

PATCH v3 7/7 soc_camera: initial of code

Add initial support for OF based soc-camera devices that may be used by any of the soc-camera drivers. The driver itself will need converting to use OF.

These changes allow the soc-camera driver to do the connecting of any async capable v4l2 device to the soc-camera driver. This has currently been tested on the Renesas Lager board.

---
Changes since v1:

- Updated to make the i2c mclk name compatible with other drivers. The issue of having mclk which is not part of the drivers/clk interface is something that can be dealt with separately.

---
 drivers/media/platform/soc_camera/soc_camera.c | 117 ++++++++++++++++++++++++-
 1 file changed, 116 insertions(+), 1 deletion(-)
drivers/media/platform/soc_camera/soc_camera.c +116 -1
index 4b8c024..c50ec5c 100644
@@ -36,6 +36,7 @@
 #include <media/v4l2-common.h>
 #include <media/v4l2-ioctl.h>
 #include <media/v4l2-dev.h>
+#include <media/v4l2-of.h>
 #include <media/videobuf-core.h>
 #include <media/videobuf2-core.h>
 
@@ -1579,6 +1580,118 @@ static void scan_async_host(struct soc_camera_host *ici)
 #define scan_async_host(ici)		do {} while (0)
 #endif
 
+#ifdef CONFIG_OF
+static int soc_of_bind(struct soc_camera_host *ici,
+		       struct device_node *ep,
+		       struct device_node *remote)
+{
+	struct soc_camera_device *icd;
+	struct soc_camera_desc sdesc = {.host_desc.bus_id = ici->nr,};
+	struct soc_camera_async_client *sasc;
+	struct soc_camera_async_subdev *sasd;
+	struct v4l2_async_subdev **asd_array;
+	struct i2c_client *client;
+	char clk_name[V4L2_SUBDEV_NAME_SIZE];
+	int ret;
+
+	/* alloacte a new subdev and add match info to it */
+	sasd = devm_kzalloc(ici->v4l2_dev.dev, sizeof(*sasd), GFP_KERNEL);
+	if (!sasd)
+		return -ENOMEM;
+
+	asd_array = devm_kzalloc(ici->v4l2_dev.dev,
+				 sizeof(struct v4l2_async_subdev **),
+				 GFP_KERNEL);
+	if (!asd_array)
+		return -ENOMEM;
+
+	sasd->asd.match.of.node = remote;
+	sasd->asd.match_type = V4L2_ASYNC_MATCH_OF;
+	asd_array[0] = &sasd->asd;
+
+	/* Or shall this be managed by the soc-camera device? */
+	sasc = devm_kzalloc(ici->v4l2_dev.dev, sizeof(*sasc), GFP_KERNEL);
+	if (!sasc)
+		return -ENOMEM;
+
+	/* HACK: just need a != NULL */
+	sdesc.host_desc.board_info = ERR_PTR(-ENODATA);
+
+	ret = soc_camera_dyn_pdev(&sdesc, sasc);
+	if (ret < 0)
+		return ret;
+
+	sasc->sensor = &sasd->asd;
+
+	icd = soc_camera_add_pdev(sasc);
+	if (!icd) {
+		platform_device_put(sasc->pdev);
+		return -ENOMEM;
+	}
+
+	sasc->notifier.subdevs = asd_array;
+	sasc->notifier.num_subdevs = 1;
+	sasc->notifier.bound = soc_camera_async_bound;
+	sasc->notifier.unbind = soc_camera_async_unbind;
+	sasc->notifier.complete = soc_camera_async_complete;
+
+	icd->sasc = sasc;
+	icd->parent = ici->v4l2_dev.dev;
+
+	client = of_find_i2c_device_by_node(remote);
+
+	if (client)
+		snprintf(clk_name, sizeof(clk_name), "%d-%04x",
+			 client->adapter->nr, client->addr);
+	else
+		snprintf(clk_name, sizeof(clk_name), "of-%s",
+			 of_node_full_name(remote));
+
+	icd->clk = v4l2_clk_register(&soc_camera_clk_ops, clk_name, "mclk", icd);
+	if (IS_ERR(icd->clk)) {
+		ret = PTR_ERR(icd->clk);
+		goto eclkreg;
+	}
+
+	ret = v4l2_async_notifier_register(&ici->v4l2_dev, &sasc->notifier);
+	if (!ret)
+		return 0;
+
+eclkreg:
+	icd->clk = NULL;
+	platform_device_unregister(sasc->pdev);
+	dev_err(ici->v4l2_dev.dev, "group probe failed: %d\n", ret);
+
+	return ret;
+}
+
+static inline void scan_of_host(struct soc_camera_host *ici)
+{
+	struct device_node *np = ici->v4l2_dev.dev->of_node;
+	struct device_node *epn = NULL;
+	struct device_node *ren;
+
+	while (true) {
+		epn = v4l2_of_get_next_endpoint(np, epn);
+		if (!epn)
+			break;
+
+		ren = v4l2_of_get_remote_port(epn);
+		if (!ren) {
+			pr_info("%s: no remote for %s\n",
+				__func__,  of_node_full_name(epn));
+			continue;
+		}
+
+		/* so we now have a remote node to connect */
+		soc_of_bind(ici, epn, ren->parent);
+	}
+}
+
+#else
+static inline void scan_of_host(struct soc_camera_host *ici) { }
+#endif
+
 /* Called during host-driver probe */
 static int soc_camera_probe(struct soc_camera_host *ici,
 			    struct soc_camera_device *icd)
@@ -1830,7 +1943,9 @@ int soc_camera_host_register(struct soc_camera_host *ici)
 	mutex_init(&ici->host_lock);
 	mutex_init(&ici->clk_lock);
 
-	if (ici->asd_sizes)
+	if (ici->v4l2_dev.dev->of_node)
+		scan_of_host(ici);
+	else if (ici->asd_sizes)
 		/*
 		 * No OF, host with a list of subdevices. Don't try to mix
 		 * modes by initialising some groups statically and some
Signature · 1 line
1.9.1
Tested-by on v3 7/7
#1 lore raw

Hi, Ben

Quoted 9 lines · Ben Dooks

Add initial support for OF based soc-camera devices that may be used by any of the soc-camera drivers. The driver itself will need converting to use OF.

These changes allow the soc-camera driver to do the connecting of any async capable v4l2 device to the soc-camera driver. This has currently been tested on the Renesas Lager board.

Thanks for your patch. I tested with atmel-isi DT and ov2640. It works perfectly.

Best Regards,
Josh Wu

Quoted 153 lines

---
Changes since v1:

- Updated to make the i2c mclk name compatible with other drivers. The issue of having mclk which is not part of the drivers/clk interface is something that can be dealt with separately.

---
  drivers/media/platform/soc_camera/soc_camera.c | 117 ++++++++++++++++++++++++-
  1 file changed, 116 insertions(+), 1 deletion(-)
drivers/media/platform/soc_camera/soc_camera.c +116 -1
index 4b8c024..c50ec5c 100644
@@ -36,6 +36,7 @@
  #include <media/v4l2-common.h>
  #include <media/v4l2-ioctl.h>
  #include <media/v4l2-dev.h>
+#include <media/v4l2-of.h>
  #include <media/videobuf-core.h>
  #include <media/videobuf2-core.h>
 
@@ -1579,6 +1580,118 @@ static void scan_async_host(struct soc_camera_host *ici)
  #define scan_async_host(ici)		do {} while (0)
  #endif
 
+#ifdef CONFIG_OF
+static int soc_of_bind(struct soc_camera_host *ici,
+		       struct device_node *ep,
+		       struct device_node *remote)
+{
+	struct soc_camera_device *icd;
+	struct soc_camera_desc sdesc = {.host_desc.bus_id = ici->nr,};
+	struct soc_camera_async_client *sasc;
+	struct soc_camera_async_subdev *sasd;
+	struct v4l2_async_subdev **asd_array;
+	struct i2c_client *client;
+	char clk_name[V4L2_SUBDEV_NAME_SIZE];
+	int ret;
+
+	/* alloacte a new subdev and add match info to it */
+	sasd = devm_kzalloc(ici->v4l2_dev.dev, sizeof(*sasd), GFP_KERNEL);
+	if (!sasd)
+		return -ENOMEM;
+
+	asd_array = devm_kzalloc(ici->v4l2_dev.dev,
+				 sizeof(struct v4l2_async_subdev **),
+				 GFP_KERNEL);
+	if (!asd_array)
+		return -ENOMEM;
+
+	sasd->asd.match.of.node = remote;
+	sasd->asd.match_type = V4L2_ASYNC_MATCH_OF;
+	asd_array[0] = &sasd->asd;
+
+	/* Or shall this be managed by the soc-camera device? */
+	sasc = devm_kzalloc(ici->v4l2_dev.dev, sizeof(*sasc), GFP_KERNEL);
+	if (!sasc)
+		return -ENOMEM;
+
+	/* HACK: just need a != NULL */
+	sdesc.host_desc.board_info = ERR_PTR(-ENODATA);
+
+	ret = soc_camera_dyn_pdev(&sdesc, sasc);
+	if (ret < 0)
+		return ret;
+
+	sasc->sensor = &sasd->asd;
+
+	icd = soc_camera_add_pdev(sasc);
+	if (!icd) {
+		platform_device_put(sasc->pdev);
+		return -ENOMEM;
+	}
+
+	sasc->notifier.subdevs = asd_array;
+	sasc->notifier.num_subdevs = 1;
+	sasc->notifier.bound = soc_camera_async_bound;
+	sasc->notifier.unbind = soc_camera_async_unbind;
+	sasc->notifier.complete = soc_camera_async_complete;
+
+	icd->sasc = sasc;
+	icd->parent = ici->v4l2_dev.dev;
+
+	client = of_find_i2c_device_by_node(remote);
+
+	if (client)
+		snprintf(clk_name, sizeof(clk_name), "%d-%04x",
+			 client->adapter->nr, client->addr);
+	else
+		snprintf(clk_name, sizeof(clk_name), "of-%s",
+			 of_node_full_name(remote));
+
+	icd->clk = v4l2_clk_register(&soc_camera_clk_ops, clk_name, "mclk", icd);
+	if (IS_ERR(icd->clk)) {
+		ret = PTR_ERR(icd->clk);
+		goto eclkreg;
+	}
+
+	ret = v4l2_async_notifier_register(&ici->v4l2_dev, &sasc->notifier);
+	if (!ret)
+		return 0;
+
+eclkreg:
+	icd->clk = NULL;
+	platform_device_unregister(sasc->pdev);
+	dev_err(ici->v4l2_dev.dev, "group probe failed: %d\n", ret);
+
+	return ret;
+}
+
+static inline void scan_of_host(struct soc_camera_host *ici)
+{
+	struct device_node *np = ici->v4l2_dev.dev->of_node;
+	struct device_node *epn = NULL;
+	struct device_node *ren;
+
+	while (true) {
+		epn = v4l2_of_get_next_endpoint(np, epn);
+		if (!epn)
+			break;
+
+		ren = v4l2_of_get_remote_port(epn);
+		if (!ren) {
+			pr_info("%s: no remote for %s\n",
+				__func__,  of_node_full_name(epn));
+			continue;
+		}
+
+		/* so we now have a remote node to connect */
+		soc_of_bind(ici, epn, ren->parent);
+	}
+}
+
+#else
+static inline void scan_of_host(struct soc_camera_host *ici) { }
+#endif
+
  /* Called during host-driver probe */
  static int soc_camera_probe(struct soc_camera_host *ici,
  			    struct soc_camera_device *icd)
@@ -1830,7 +1943,9 @@ int soc_camera_host_register(struct soc_camera_host *ici)
  	mutex_init(&ici->host_lock);
  	mutex_init(&ici->clk_lock);
 
-	if (ici->asd_sizes)
+	if (ici->v4l2_dev.dev->of_node)
+		scan_of_host(ici);
+	else if (ici->asd_sizes)
  		/*
  		 * No OF, host with a list of subdevices. Don't try to mix
  		 * modes by initialising some groups statically and some
author
#2 lore raw
In reply to Ben Dooks
Quoted 11 lines · Josh Wu

Hi, Ben

Quoted 8 lines · Ben Dooks

Add initial support for OF based soc-camera devices that may be used by any of the soc-camera drivers. The driver itself will need converting to use OF.

These changes allow the soc-camera driver to do the connecting of any async capable v4l2 device to the soc-camera driver. This has currently been tested on the Renesas Lager board.

Quoted 8 lines
Quoted 1 line

Thanks for your patch. I tested with atmel-isi DT and ov2640. It works perfectly.

Best Regards,
Josh Wu

Thanks, I only have a limited set of hardware here to test with.

If there is no more feedback, could this be added to the appropriate next tree along with the rcar-vin updates please?

Signature · 2 lines
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius
#3 lore raw
In reply to Ben Dooks

Hi Ben,

Quoted 12 lines · Ben Dooks
Quoted 11 lines · Josh Wu

Hi, Ben

Quoted 8 lines · Ben Dooks

Add initial support for OF based soc-camera devices that may be used by any of the soc-camera drivers. The driver itself will need converting to use OF.

These changes allow the soc-camera driver to do the connecting of any async capable v4l2 device to the soc-camera driver. This has currently been tested on the Renesas Lager board.

Quoted 8 lines
Quoted 8 lines
Quoted 1 line

Thanks for your patch. I tested with atmel-isi DT and ov2640. It works perfectly.

Best Regards,
Josh Wu

Thanks for testing, Josh!

Quoted 4 lines

Thanks, I only have a limited set of hardware here to test with.

If there is no more feedback, could this be added to the appropriate next tree along with the rcar-vin updates please?

I'll be away this coming weekend, so, this will have to wait _at least_ until the one after, possibly more. But yes, I'll have a look at the patches and either comment on them or queue for 3.16.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#4 lore raw
In reply to Ben Dooks

Hi Josh,

Quoted 11 lines · Josh Wu

Hi, Ben

Quoted 8 lines · Ben Dooks

Add initial support for OF based soc-camera devices that may be used by any of the soc-camera drivers. The driver itself will need converting to use OF.

These changes allow the soc-camera driver to do the connecting of any async capable v4l2 device to the soc-camera driver. This has currently been tested on the Renesas Lager board.

Quoted 5 lines
Quoted 1 line

Thanks for your patch. I tested with atmel-isi DT and ov2640. It works perfectly.

Thanks for testing. Do I understand correctly, that v2 of your patch set "atmel-isi: Add DT support for Atmel ISI driver" sent on 25 March works on top of these patches from Ben and I can review them together for 3.16?

Thanks
Guennadi

Quoted 150 lines

Best Regards,
Josh Wu

Quoted 147 lines

---
Changes since v1:

- Updated to make the i2c mclk name compatible with other drivers. The issue of having mclk which is not part of the drivers/clk interface is something that can be dealt with separately.

---
  drivers/media/platform/soc_camera/soc_camera.c | 117
++++++++++++++++++++++++-
  1 file changed, 116 insertions(+), 1 deletion(-)
drivers/media/platform/soc_camera/soc_camera.c +1 -0
index 4b8c024..c50ec5c 100644
@@ -36,6 +36,7 @@
  #include <media/v4l2-common.h>
  #include <media/v4l2-ioctl.h>
  #include <media/v4l2-dev.h>
+#include <media/v4l2-of.h>
  #include <media/videobuf-core.h>
  #include <media/videobuf2-core.h>
  @@ -1579,6 +1580,118 @@ static void scan_async_host(struct soc_camera_host

*ici)
#define scan_async_host(ici) do {} while (0)
#endif
+#ifdef CONFIG_OF

drivers/media/platform/soc_camera/soc_camera.c +67 -0
+static int soc_of_bind(struct soc_camera_host *ici,
+		       struct device_node *ep,
+		       struct device_node *remote)
+{
+	struct soc_camera_device *icd;
+	struct soc_camera_desc sdesc = {.host_desc.bus_id = ici->nr,};
+	struct soc_camera_async_client *sasc;
+	struct soc_camera_async_subdev *sasd;
+	struct v4l2_async_subdev **asd_array;
+	struct i2c_client *client;
+	char clk_name[V4L2_SUBDEV_NAME_SIZE];
+	int ret;
+
+	/* alloacte a new subdev and add match info to it */
+	sasd = devm_kzalloc(ici->v4l2_dev.dev, sizeof(*sasd), GFP_KERNEL);
+	if (!sasd)
+		return -ENOMEM;
+
+	asd_array = devm_kzalloc(ici->v4l2_dev.dev,
+				 sizeof(struct v4l2_async_subdev **),
+				 GFP_KERNEL);
+	if (!asd_array)
+		return -ENOMEM;
+
+	sasd->asd.match.of.node = remote;
+	sasd->asd.match_type = V4L2_ASYNC_MATCH_OF;
+	asd_array[0] = &sasd->asd;
+
+	/* Or shall this be managed by the soc-camera device? */
+	sasc = devm_kzalloc(ici->v4l2_dev.dev, sizeof(*sasc), GFP_KERNEL);
+	if (!sasc)
+		return -ENOMEM;
+
+	/* HACK: just need a != NULL */
+	sdesc.host_desc.board_info = ERR_PTR(-ENODATA);
+
+	ret = soc_camera_dyn_pdev(&sdesc, sasc);
+	if (ret < 0)
+		return ret;
+
+	sasc->sensor = &sasd->asd;
+
+	icd = soc_camera_add_pdev(sasc);
+	if (!icd) {
+		platform_device_put(sasc->pdev);
+		return -ENOMEM;
+	}
+
+	sasc->notifier.subdevs = asd_array;
+	sasc->notifier.num_subdevs = 1;
+	sasc->notifier.bound = soc_camera_async_bound;
+	sasc->notifier.unbind = soc_camera_async_unbind;
+	sasc->notifier.complete = soc_camera_async_complete;
+
+	icd->sasc = sasc;
+	icd->parent = ici->v4l2_dev.dev;
+
+	client = of_find_i2c_device_by_node(remote);
+
+	if (client)
+		snprintf(clk_name, sizeof(clk_name), "%d-%04x",
+			 client->adapter->nr, client->addr);
+	else
+		snprintf(clk_name, sizeof(clk_name), "of-%s",
+			 of_node_full_name(remote));
+
+	icd->clk = v4l2_clk_register(&soc_camera_clk_ops, clk_name, "mclk",

icd);

drivers/media/platform/soc_camera/soc_camera.c +44 -0
+	if (IS_ERR(icd->clk)) {
+		ret = PTR_ERR(icd->clk);
+		goto eclkreg;
+	}
+
+	ret = v4l2_async_notifier_register(&ici->v4l2_dev, &sasc->notifier);
+	if (!ret)
+		return 0;
+
+eclkreg:
+	icd->clk = NULL;
+	platform_device_unregister(sasc->pdev);
+	dev_err(ici->v4l2_dev.dev, "group probe failed: %d\n", ret);
+
+	return ret;
+}
+
+static inline void scan_of_host(struct soc_camera_host *ici)
+{
+	struct device_node *np = ici->v4l2_dev.dev->of_node;
+	struct device_node *epn = NULL;
+	struct device_node *ren;
+
+	while (true) {
+		epn = v4l2_of_get_next_endpoint(np, epn);
+		if (!epn)
+			break;
+
+		ren = v4l2_of_get_remote_port(epn);
+		if (!ren) {
+			pr_info("%s: no remote for %s\n",
+				__func__,  of_node_full_name(epn));
+			continue;
+		}
+
+		/* so we now have a remote node to connect */
+		soc_of_bind(ici, epn, ren->parent);
+	}
+}
+
+#else
+static inline void scan_of_host(struct soc_camera_host *ici) { }
+#endif
+
  /* Called during host-driver probe */
  static int soc_camera_probe(struct soc_camera_host *ici,
  			    struct soc_camera_device *icd)
@@ -1830,7 +1943,9 @@ int soc_camera_host_register(struct soc_camera_host
 *ici)
  	mutex_init(&ici->host_lock);
Quoted 9 lines

drivers/media/platform/soc_camera/soc_camera.c int soc_camera_host_register(struct soc_camera_host *ici) · line 1951

Quoted 8 lines
drivers/media/platform/soc_camera/soc_camera.c +3 -0
  	mutex_init(&ici->clk_lock);
  -	if (ici->asd_sizes)
+	if (ici->v4l2_dev.dev->of_node)
+		scan_of_host(ici);
+	else if (ici->asd_sizes)
  		/*
  		 * No OF, host with a list of subdevices. Don't try to mix
  		 * modes by initialising some groups statically and some

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#5 lore raw
In reply to Ben Dooks

Hi, Guennadi

Quoted 15 lines · Guennadi Liakhovetski

Hi Josh,

Quoted 11 lines · Josh Wu

Hi, Ben

Quoted 8 lines · Ben Dooks

Add initial support for OF based soc-camera devices that may be used by any of the soc-camera drivers. The driver itself will need converting to use OF.

These changes allow the soc-camera driver to do the connecting of any async capable v4l2 device to the soc-camera driver. This has currently been tested on the Renesas Lager board.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Thanks for your patch. I tested with atmel-isi DT and ov2640. It works perfectly.

Thanks for testing. Do I understand correctly, that v2 of your patch set "atmel-isi: Add DT support for Atmel ISI driver" sent on 25 March works on top of these patches from Ben and I can review them together for 3.16?

Yes, I tested this Ben's Soc_camera DT patch with my v2 atmel-isi DT patches.
That would be great if you can review them together. Thanks.

Best Regards,
Josh Wu

Quoted 166 lines

Thanks
Guennadi

Quoted 150 lines

Best Regards,
Josh Wu

Quoted 147 lines

---
Changes since v1:

- Updated to make the i2c mclk name compatible with other drivers. The issue of having mclk which is not part of the drivers/clk interface is something that can be dealt with separately.

---
   drivers/media/platform/soc_camera/soc_camera.c | 117
++++++++++++++++++++++++-
   1 file changed, 116 insertions(+), 1 deletion(-)
drivers/media/platform/soc_camera/soc_camera.c +1 -0
index 4b8c024..c50ec5c 100644
@@ -36,6 +36,7 @@
   #include <media/v4l2-common.h>
   #include <media/v4l2-ioctl.h>
   #include <media/v4l2-dev.h>
+#include <media/v4l2-of.h>
   #include <media/videobuf-core.h>
   #include <media/videobuf2-core.h>
   @@ -1579,6 +1580,118 @@ static void scan_async_host(struct soc_camera_host

*ici)

   #define scan_async_host(ici)		do {} while (0)
   #endif
   +#ifdef CONFIG_OF
drivers/media/platform/soc_camera/soc_camera.c +67 -0
+static int soc_of_bind(struct soc_camera_host *ici,
+		       struct device_node *ep,
+		       struct device_node *remote)
+{
+	struct soc_camera_device *icd;
+	struct soc_camera_desc sdesc = {.host_desc.bus_id = ici->nr,};
+	struct soc_camera_async_client *sasc;
+	struct soc_camera_async_subdev *sasd;
+	struct v4l2_async_subdev **asd_array;
+	struct i2c_client *client;
+	char clk_name[V4L2_SUBDEV_NAME_SIZE];
+	int ret;
+
+	/* alloacte a new subdev and add match info to it */
+	sasd = devm_kzalloc(ici->v4l2_dev.dev, sizeof(*sasd), GFP_KERNEL);
+	if (!sasd)
+		return -ENOMEM;
+
+	asd_array = devm_kzalloc(ici->v4l2_dev.dev,
+				 sizeof(struct v4l2_async_subdev **),
+				 GFP_KERNEL);
+	if (!asd_array)
+		return -ENOMEM;
+
+	sasd->asd.match.of.node = remote;
+	sasd->asd.match_type = V4L2_ASYNC_MATCH_OF;
+	asd_array[0] = &sasd->asd;
+
+	/* Or shall this be managed by the soc-camera device? */
+	sasc = devm_kzalloc(ici->v4l2_dev.dev, sizeof(*sasc), GFP_KERNEL);
+	if (!sasc)
+		return -ENOMEM;
+
+	/* HACK: just need a != NULL */
+	sdesc.host_desc.board_info = ERR_PTR(-ENODATA);
+
+	ret = soc_camera_dyn_pdev(&sdesc, sasc);
+	if (ret < 0)
+		return ret;
+
+	sasc->sensor = &sasd->asd;
+
+	icd = soc_camera_add_pdev(sasc);
+	if (!icd) {
+		platform_device_put(sasc->pdev);
+		return -ENOMEM;
+	}
+
+	sasc->notifier.subdevs = asd_array;
+	sasc->notifier.num_subdevs = 1;
+	sasc->notifier.bound = soc_camera_async_bound;
+	sasc->notifier.unbind = soc_camera_async_unbind;
+	sasc->notifier.complete = soc_camera_async_complete;
+
+	icd->sasc = sasc;
+	icd->parent = ici->v4l2_dev.dev;
+
+	client = of_find_i2c_device_by_node(remote);
+
+	if (client)
+		snprintf(clk_name, sizeof(clk_name), "%d-%04x",
+			 client->adapter->nr, client->addr);
+	else
+		snprintf(clk_name, sizeof(clk_name), "of-%s",
+			 of_node_full_name(remote));
+
+	icd->clk = v4l2_clk_register(&soc_camera_clk_ops, clk_name, "mclk",

icd);

drivers/media/platform/soc_camera/soc_camera.c +44 -0
+	if (IS_ERR(icd->clk)) {
+		ret = PTR_ERR(icd->clk);
+		goto eclkreg;
+	}
+
+	ret = v4l2_async_notifier_register(&ici->v4l2_dev, &sasc->notifier);
+	if (!ret)
+		return 0;
+
+eclkreg:
+	icd->clk = NULL;
+	platform_device_unregister(sasc->pdev);
+	dev_err(ici->v4l2_dev.dev, "group probe failed: %d\n", ret);
+
+	return ret;
+}
+
+static inline void scan_of_host(struct soc_camera_host *ici)
+{
+	struct device_node *np = ici->v4l2_dev.dev->of_node;
+	struct device_node *epn = NULL;
+	struct device_node *ren;
+
+	while (true) {
+		epn = v4l2_of_get_next_endpoint(np, epn);
+		if (!epn)
+			break;
+
+		ren = v4l2_of_get_remote_port(epn);
+		if (!ren) {
+			pr_info("%s: no remote for %s\n",
+				__func__,  of_node_full_name(epn));
+			continue;
+		}
+
+		/* so we now have a remote node to connect */
+		soc_of_bind(ici, epn, ren->parent);
+	}
+}
+
+#else
+static inline void scan_of_host(struct soc_camera_host *ici) { }
+#endif
+
   /* Called during host-driver probe */
   static int soc_camera_probe(struct soc_camera_host *ici,
   			    struct soc_camera_device *icd)
@@ -1830,7 +1943,9 @@ int soc_camera_host_register(struct soc_camera_host
 *ici)
   	mutex_init(&ici->host_lock);
Quoted 8 lines

drivers/media/platform/soc_camera/soc_camera.c int soc_camera_host_register(struct soc_camera_host *ici) · line 1951

Quoted 8 lines
drivers/media/platform/soc_camera/soc_camera.c +3 -0
   	mutex_init(&ici->clk_lock);
   -	if (ici->asd_sizes)
+	if (ici->v4l2_dev.dev->of_node)
+		scan_of_host(ici);
+	else if (ici->asd_sizes)
   		/*
   		 * No OF, host with a list of subdevices. Don't try to mix
   		 * modes by initialising some groups statically and some

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#6 lore raw
In reply to Ben Dooks
Quoted 45 lines · Ben Dooks

Add initial support for OF based soc-camera devices that may be used by any of the soc-camera drivers. The driver itself will need converting to use OF.

These changes allow the soc-camera driver to do the connecting of any async capable v4l2 device to the soc-camera driver. This has currently been tested on the Renesas Lager board.

---
Changes since v1:

- Updated to make the i2c mclk name compatible with other drivers. The issue of having mclk which is not part of the drivers/clk interface is something that can be dealt with separately.

---
 drivers/media/platform/soc_camera/soc_camera.c | 117 ++++++++++++++++++++++++-
 1 file changed, 116 insertions(+), 1 deletion(-)
drivers/media/platform/soc_camera/soc_camera.c +10 -0
index 4b8c024..c50ec5c 100644
@@ -36,6 +36,7 @@
 #include <media/v4l2-common.h>
 #include <media/v4l2-ioctl.h>
 #include <media/v4l2-dev.h>
+#include <media/v4l2-of.h>
 #include <media/videobuf-core.h>
 #include <media/videobuf2-core.h>
 
@@ -1579,6 +1580,118 @@ static void scan_async_host(struct soc_camera_host *ici)
 #define scan_async_host(ici)		do {} while (0)
 #endif
 
+#ifdef CONFIG_OF
+static int soc_of_bind(struct soc_camera_host *ici,
+		       struct device_node *ep,
+		       struct device_node *remote)
+{
+	struct soc_camera_device *icd;
+	struct soc_camera_desc sdesc = {.host_desc.bus_id = ici->nr,};
+	struct soc_camera_async_client *sasc;
+	struct soc_camera_async_subdev *sasd;

drivers/media/platform/soc_camera/soc_camera.c static void scan_async_host(struct soc_camera_host *ici) · line 1601

Quoted 10 lines
drivers/media/platform/soc_camera/soc_camera.c +10 -0
+	struct v4l2_async_subdev **asd_array;
+	struct i2c_client *client;
+	char clk_name[V4L2_SUBDEV_NAME_SIZE];
+	int ret;
+
+	/* alloacte a new subdev and add match info to it */
+	sasd = devm_kzalloc(ici->v4l2_dev.dev, sizeof(*sasd), GFP_KERNEL);
+	if (!sasd)
+		return -ENOMEM;
+

I think I set a bad example to follow :) Please, have a look at this:

http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/77490

Maybe it would be good to do the same here?

drivers/media/platform/soc_camera/soc_camera.c static void scan_async_host(struct soc_camera_host *ici) · line 1604

Quoted 3 lines
drivers/media/platform/soc_camera/soc_camera.c +3 -0
+	asd_array = devm_kzalloc(ici->v4l2_dev.dev,
+				 sizeof(struct v4l2_async_subdev **),
+				 GFP_KERNEL);

is that a correct size?...

drivers/media/platform/soc_camera/soc_camera.c static void scan_async_host(struct soc_camera_host *ici) · line 1615

Quoted 11 lines
drivers/media/platform/soc_camera/soc_camera.c +11 -0
+	if (!asd_array)
+		return -ENOMEM;
+
+	sasd->asd.match.of.node = remote;
+	sasd->asd.match_type = V4L2_ASYNC_MATCH_OF;
+	asd_array[0] = &sasd->asd;
+
+	/* Or shall this be managed by the soc-camera device? */
+	sasc = devm_kzalloc(ici->v4l2_dev.dev, sizeof(*sasc), GFP_KERNEL);
+	if (!sasc)
+		return -ENOMEM;

And a third one... I think it's already worth a new struct with these three objects in it to allocate it in one go?

Quoted 8 lines
drivers/media/platform/soc_camera/soc_camera.c +8 -0
+
+	/* HACK: just need a != NULL */
+	sdesc.host_desc.board_info = ERR_PTR(-ENODATA);
+
+	ret = soc_camera_dyn_pdev(&sdesc, sasc);
+	if (ret < 0)
+		return ret;
+

drivers/media/platform/soc_camera/soc_camera.c static void scan_async_host(struct soc_camera_host *ici) · line 1633

Quoted 10 lines
drivers/media/platform/soc_camera/soc_camera.c +10 -0
+	sasc->sensor = &sasd->asd;
+
+	icd = soc_camera_add_pdev(sasc);
+	if (!icd) {
+		platform_device_put(sasc->pdev);
+		return -ENOMEM;
+	}
+
+	sasc->notifier.subdevs = asd_array;
+	sasc->notifier.num_subdevs = 1;

Hm, see below...

Quoted 25 lines
drivers/media/platform/soc_camera/soc_camera.c +25 -0
+	sasc->notifier.bound = soc_camera_async_bound;
+	sasc->notifier.unbind = soc_camera_async_unbind;
+	sasc->notifier.complete = soc_camera_async_complete;
+
+	icd->sasc = sasc;
+	icd->parent = ici->v4l2_dev.dev;
+
+	client = of_find_i2c_device_by_node(remote);
+
+	if (client)
+		snprintf(clk_name, sizeof(clk_name), "%d-%04x",
+			 client->adapter->nr, client->addr);
+	else
+		snprintf(clk_name, sizeof(clk_name), "of-%s",
+			 of_node_full_name(remote));
+
+	icd->clk = v4l2_clk_register(&soc_camera_clk_ops, clk_name, "mclk", icd);
+	if (IS_ERR(icd->clk)) {
+		ret = PTR_ERR(icd->clk);
+		goto eclkreg;
+	}
+
+	ret = v4l2_async_notifier_register(&ici->v4l2_dev, &sasc->notifier);
+	if (!ret)
+		return 0;

drivers/media/platform/soc_camera/soc_camera.c static void scan_async_host(struct soc_camera_host *ici) · line 1668

Quoted 10 lines
drivers/media/platform/soc_camera/soc_camera.c +10 -0
+
+eclkreg:
+	icd->clk = NULL;
+	platform_device_unregister(sasc->pdev);
+	dev_err(ici->v4l2_dev.dev, "group probe failed: %d\n", ret);
+
+	return ret;
+}
+
+static inline void scan_of_host(struct soc_camera_host *ici)

You don't need "inline" in the C code - the compiler will decide by itself.

drivers/media/platform/soc_camera/soc_camera.c static void scan_async_host(struct soc_camera_host *ici) · line 1679

Quoted 11 lines
drivers/media/platform/soc_camera/soc_camera.c +11 -0
+{
+	struct device_node *np = ici->v4l2_dev.dev->of_node;
+	struct device_node *epn = NULL;
+	struct device_node *ren;
+
+	while (true) {
+		epn = v4l2_of_get_next_endpoint(np, epn);
+		if (!epn)
+			break;
+
+		ren = v4l2_of_get_remote_port(epn);

Please, rebase on top of current -next. You'll probably use of_graph_get_next_endpoint() and of_graph_get_remote_port() respectively.

drivers/media/platform/soc_camera/soc_camera.c static void scan_async_host(struct soc_camera_host *ici) · line 1687

Quoted 8 lines
drivers/media/platform/soc_camera/soc_camera.c +8 -0
+		if (!ren) {
+			pr_info("%s: no remote for %s\n",
+				__func__,  of_node_full_name(epn));
+			continue;
+		}
+
+		/* so we now have a remote node to connect */
+		soc_of_bind(ici, epn, ren->parent);

Hm, I think, this isn't quite correct. If the documented DT layout in Documentation/devicetree/bindings/media/video-interfaces.txt hasn't changed, a port can have several endpoints. And I think you have to collect them all into your asd_array[] to form a group to have soc_camera_async_complete() called only when all endpoints have been bound.

If you think it's too difficult with no real-life use case, you can limit support to one endpoint per port, but please make this explicit and error out with a suitable message if more than one endpoint is present.

drivers/media/platform/soc_camera/soc_camera.c static void scan_async_host(struct soc_camera_host *ici) · line 1692

Quoted 5 lines
drivers/media/platform/soc_camera/soc_camera.c +5 -0
+	}
+}
+
+#else
+static inline void scan_of_host(struct soc_camera_host *ici) { }

Also no need for inline.

Quoted 19 lines
drivers/media/platform/soc_camera/soc_camera.c +5 -1
+#endif
+
 /* Called during host-driver probe */
 static int soc_camera_probe(struct soc_camera_host *ici,
 			    struct soc_camera_device *icd)
@@ -1830,7 +1943,9 @@ int soc_camera_host_register(struct soc_camera_host *ici)
 	mutex_init(&ici->host_lock);
 	mutex_init(&ici->clk_lock);
 
-	if (ici->asd_sizes)
+	if (ici->v4l2_dev.dev->of_node)
+		scan_of_host(ici);
+	else if (ici->asd_sizes)
 		/*
 		 * No OF, host with a list of subdevices. Don't try to mix
 		 * modes by initialising some groups statically and some
Signature · 1 line
1.9.1

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

author
#7 lore raw
In reply to Ben Dooks
Quoted 11 lines · Guennadi Liakhovetski
Quoted 9 lines · Ben Dooks

Add initial support for OF based soc-camera devices that may be used by any of the soc-camera drivers. The driver itself will need converting to use OF.

These changes allow the soc-camera driver to do the connecting of any async capable v4l2 device to the soc-camera driver. This has currently been tested on the Renesas Lager board.

Thankyou for the feedback. I will try and get this sorted over the weekend as I have been travelling and away from code.

Quoted 204 lines
Quoted 36 lines

---
Changes since v1:

- Updated to make the i2c mclk name compatible with other drivers. The issue of having mclk which is not part of the drivers/clk interface is something that can be dealt with separately.

---
  drivers/media/platform/soc_camera/soc_camera.c | 117 ++++++++++++++++++++++++-
  1 file changed, 116 insertions(+), 1 deletion(-)
drivers/media/platform/soc_camera/soc_camera.c +10 -0
index 4b8c024..c50ec5c 100644
@@ -36,6 +36,7 @@
  #include <media/v4l2-common.h>
  #include <media/v4l2-ioctl.h>
  #include <media/v4l2-dev.h>
+#include <media/v4l2-of.h>
  #include <media/videobuf-core.h>
  #include <media/videobuf2-core.h>
 
@@ -1579,6 +1580,118 @@ static void scan_async_host(struct soc_camera_host *ici)
  #define scan_async_host(ici)		do {} while (0)
  #endif
 
+#ifdef CONFIG_OF
+static int soc_of_bind(struct soc_camera_host *ici,
+		       struct device_node *ep,
+		       struct device_node *remote)
+{
+	struct soc_camera_device *icd;
+	struct soc_camera_desc sdesc = {.host_desc.bus_id = ici->nr,};
+	struct soc_camera_async_client *sasc;
+	struct soc_camera_async_subdev *sasd;

drivers/media/platform/soc_camera/soc_camera.c static void scan_async_host(struct soc_camera_host *ici) · line 1601

Quoted 10 lines
drivers/media/platform/soc_camera/soc_camera.c +10 -0
+	struct v4l2_async_subdev **asd_array;
+	struct i2c_client *client;
+	char clk_name[V4L2_SUBDEV_NAME_SIZE];
+	int ret;
+
+	/* alloacte a new subdev and add match info to it */
+	sasd = devm_kzalloc(ici->v4l2_dev.dev, sizeof(*sasd), GFP_KERNEL);
+	if (!sasd)
+		return -ENOMEM;
+

I think I set a bad example to follow :) Please, have a look at this:

http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/77490

Maybe it would be good to do the same here?

drivers/media/platform/soc_camera/soc_camera.c static void scan_async_host(struct soc_camera_host *ici) · line 1604

Quoted 3 lines
drivers/media/platform/soc_camera/soc_camera.c +3 -0
+	asd_array = devm_kzalloc(ici->v4l2_dev.dev,
+				 sizeof(struct v4l2_async_subdev **),
+				 GFP_KERNEL);

is that a correct size?...

drivers/media/platform/soc_camera/soc_camera.c static void scan_async_host(struct soc_camera_host *ici) · line 1615

Quoted 11 lines
drivers/media/platform/soc_camera/soc_camera.c +11 -0
+	if (!asd_array)
+		return -ENOMEM;
+
+	sasd->asd.match.of.node = remote;
+	sasd->asd.match_type = V4L2_ASYNC_MATCH_OF;
+	asd_array[0] = &sasd->asd;
+
+	/* Or shall this be managed by the soc-camera device? */
+	sasc = devm_kzalloc(ici->v4l2_dev.dev, sizeof(*sasc), GFP_KERNEL);
+	if (!sasc)
+		return -ENOMEM;

And a third one... I think it's already worth a new struct with these three objects in it to allocate it in one go?

Quoted 8 lines
drivers/media/platform/soc_camera/soc_camera.c +8 -0
+
+	/* HACK: just need a != NULL */
+	sdesc.host_desc.board_info = ERR_PTR(-ENODATA);
+
+	ret = soc_camera_dyn_pdev(&sdesc, sasc);
+	if (ret < 0)
+		return ret;
+

drivers/media/platform/soc_camera/soc_camera.c static void scan_async_host(struct soc_camera_host *ici) · line 1633

Quoted 10 lines
drivers/media/platform/soc_camera/soc_camera.c +10 -0
+	sasc->sensor = &sasd->asd;
+
+	icd = soc_camera_add_pdev(sasc);
+	if (!icd) {
+		platform_device_put(sasc->pdev);
+		return -ENOMEM;
+	}
+
+	sasc->notifier.subdevs = asd_array;
+	sasc->notifier.num_subdevs = 1;

Hm, see below...

Quoted 25 lines
drivers/media/platform/soc_camera/soc_camera.c +25 -0
+	sasc->notifier.bound = soc_camera_async_bound;
+	sasc->notifier.unbind = soc_camera_async_unbind;
+	sasc->notifier.complete = soc_camera_async_complete;
+
+	icd->sasc = sasc;
+	icd->parent = ici->v4l2_dev.dev;
+
+	client = of_find_i2c_device_by_node(remote);
+
+	if (client)
+		snprintf(clk_name, sizeof(clk_name), "%d-%04x",
+			 client->adapter->nr, client->addr);
+	else
+		snprintf(clk_name, sizeof(clk_name), "of-%s",
+			 of_node_full_name(remote));
+
+	icd->clk = v4l2_clk_register(&soc_camera_clk_ops, clk_name, "mclk", icd);
+	if (IS_ERR(icd->clk)) {
+		ret = PTR_ERR(icd->clk);
+		goto eclkreg;
+	}
+
+	ret = v4l2_async_notifier_register(&ici->v4l2_dev, &sasc->notifier);
+	if (!ret)
+		return 0;

drivers/media/platform/soc_camera/soc_camera.c static void scan_async_host(struct soc_camera_host *ici) · line 1668

Quoted 10 lines
drivers/media/platform/soc_camera/soc_camera.c +10 -0
+
+eclkreg:
+	icd->clk = NULL;
+	platform_device_unregister(sasc->pdev);
+	dev_err(ici->v4l2_dev.dev, "group probe failed: %d\n", ret);
+
+	return ret;
+}
+
+static inline void scan_of_host(struct soc_camera_host *ici)

You don't need "inline" in the C code - the compiler will decide by itself.

drivers/media/platform/soc_camera/soc_camera.c static void scan_async_host(struct soc_camera_host *ici) · line 1679

Quoted 11 lines
drivers/media/platform/soc_camera/soc_camera.c +11 -0
+{
+	struct device_node *np = ici->v4l2_dev.dev->of_node;
+	struct device_node *epn = NULL;
+	struct device_node *ren;
+
+	while (true) {
+		epn = v4l2_of_get_next_endpoint(np, epn);
+		if (!epn)
+			break;
+
+		ren = v4l2_of_get_remote_port(epn);

Please, rebase on top of current -next. You'll probably use of_graph_get_next_endpoint() and of_graph_get_remote_port() respectively.

drivers/media/platform/soc_camera/soc_camera.c static void scan_async_host(struct soc_camera_host *ici) · line 1687

Quoted 8 lines
drivers/media/platform/soc_camera/soc_camera.c +8 -0
+		if (!ren) {
+			pr_info("%s: no remote for %s\n",
+				__func__,  of_node_full_name(epn));
+			continue;
+		}
+
+		/* so we now have a remote node to connect */
+		soc_of_bind(ici, epn, ren->parent);

Hm, I think, this isn't quite correct. If the documented DT layout in Documentation/devicetree/bindings/media/video-interfaces.txt hasn't changed, a port can have several endpoints. And I think you have to collect them all into your asd_array[] to form a group to have soc_camera_async_complete() called only when all endpoints have been bound.

If you think it's too difficult with no real-life use case, you can limit support to one endpoint per port, but please make this explicit and error out with a suitable message if more than one endpoint is present.

drivers/media/platform/soc_camera/soc_camera.c static void scan_async_host(struct soc_camera_host *ici) · line 1692

Quoted 5 lines
drivers/media/platform/soc_camera/soc_camera.c +5 -0
+	}
+}
+
+#else
+static inline void scan_of_host(struct soc_camera_host *ici) { }

Also no need for inline.

Quoted 17 lines
drivers/media/platform/soc_camera/soc_camera.c +5 -2
+#endif
+
  /* Called during host-driver probe */
  static int soc_camera_probe(struct soc_camera_host *ici,
  			    struct soc_camera_device *icd)
@@ -1830,7 +1943,9 @@ int soc_camera_host_register(struct soc_camera_host *ici)
  	mutex_init(&ici->host_lock);
  	mutex_init(&ici->clk_lock);
 
-	if (ici->asd_sizes)
+	if (ici->v4l2_dev.dev->of_node)
+		scan_of_host(ici);
+	else if (ici->asd_sizes)
  		/*
  		 * No OF, host with a list of subdevices. Don't try to mix
  		 * modes by initialising some groups statically and some
--
Quoted 2 lines

1.9.1

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

Signature · 2 lines
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius
#8 lore raw
In reply to Ben Dooks

Hi Ben,

An additional note:

Quoted 21 lines · Guennadi Liakhovetski
Quoted 19 lines · Ben Dooks

Add initial support for OF based soc-camera devices that may be used by any of the soc-camera drivers. The driver itself will need converting to use OF.

These changes allow the soc-camera driver to do the connecting of any async capable v4l2 device to the soc-camera driver. This has currently been tested on the Renesas Lager board.

---
Changes since v1:

- Updated to make the i2c mclk name compatible with other drivers. The issue of having mclk which is not part of the drivers/clk interface is something that can be dealt with separately.

---
 drivers/media/platform/soc_camera/soc_camera.c | 117 ++++++++++++++++++++++++-
 1 file changed, 116 insertions(+), 1 deletion(-)

[snip]

Quoted 6 lines
Quoted 6 lines
drivers/media/platform/soc_camera/soc_camera.c +6 -0
+{
+	struct device_node *np = ici->v4l2_dev.dev->of_node;
+	struct device_node *epn = NULL;
+	struct device_node *ren;
+
+	while (true) {
Quoted 8 lines

drivers/media/platform/soc_camera/soc_camera.c static void scan_async_host(struct soc_camera_host *ici) · line 1679

Quoted 5 lines
drivers/media/platform/soc_camera/soc_camera.c +5 -0
+		epn = v4l2_of_get_next_endpoint(np, epn);
+		if (!epn)
+			break;
+
+		ren = v4l2_of_get_remote_port(epn);

Please, rebase on top of current -next. You'll probably use of_graph_get_next_endpoint() and of_graph_get_remote_port() respectively.

While at it, I think it would be good to also add a call to v4l2_of_parse_endpoint() to your patch. I think the atmel-isi driver can make use of some endpoint parsing results immediately.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#9 lore raw
In reply to Ben Dooks

Hello.

Quoted 24 lines · Ben Dooks

Add initial support for OF based soc-camera devices that may be used by any of the soc-camera drivers. The driver itself will need converting to use OF.

These changes allow the soc-camera driver to do the connecting of any async capable v4l2 device to the soc-camera driver. This has currently been tested on the Renesas Lager board.

---
Changes since v1:

- Updated to make the i2c mclk name compatible with other drivers. The issue of having mclk which is not part of the drivers/clk interface is something that can be dealt with separately.

---
  drivers/media/platform/soc_camera/soc_camera.c | 117 ++++++++++++++++++++++++-
  1 file changed, 116 insertions(+), 1 deletion(-)
drivers/media/platform/soc_camera/soc_camera.c +0 -0
index 4b8c024..c50ec5c 100644

[...]

Quoted 9 lines
drivers/media/platform/soc_camera/soc_camera.c +5 -0
@@ -1579,6 +1580,118 @@ static void scan_async_host(struct soc_camera_host *ici)
  #define scan_async_host(ici)		do {} while (0)
  #endif
 
+#ifdef CONFIG_OF
+static int soc_of_bind(struct soc_camera_host *ici,
+		       struct device_node *ep,
+		       struct device_node *remote)
+{

drivers/media/platform/soc_camera/soc_camera.c static void scan_async_host(struct soc_camera_host *ici) · line 1597

Quoted 10 lines
drivers/media/platform/soc_camera/soc_camera.c +10 -0
+	struct soc_camera_device *icd;
+	struct soc_camera_desc sdesc = {.host_desc.bus_id = ici->nr,};
+	struct soc_camera_async_client *sasc;
+	struct soc_camera_async_subdev *sasd;
+	struct v4l2_async_subdev **asd_array;
+	struct i2c_client *client;
+	char clk_name[V4L2_SUBDEV_NAME_SIZE];
+	int ret;
+
+	/* alloacte a new subdev and add match info to it */

s/alloacte/allocate/

drivers/media/platform/soc_camera/soc_camera.c static void scan_async_host(struct soc_camera_host *ici) · line 1603

Quoted 6 lines
drivers/media/platform/soc_camera/soc_camera.c +6 -0
+	sasd = devm_kzalloc(ici->v4l2_dev.dev, sizeof(*sasd), GFP_KERNEL);
+	if (!sasd)
+		return -ENOMEM;
+
+	asd_array = devm_kzalloc(ici->v4l2_dev.dev,
+				 sizeof(struct v4l2_async_subdev **),

Hm, is this a correct size indeed?

drivers/media/platform/soc_camera/soc_camera.c static void scan_async_host(struct soc_camera_host *ici) · line 1605

Quoted 2 lines
drivers/media/platform/soc_camera/soc_camera.c +2 -0
+	client = of_find_i2c_device_by_node(remote);
+

I don't think empty line is needed here...

drivers/media/platform/soc_camera/soc_camera.c static void scan_async_host(struct soc_camera_host *ici) · line 1648

Quoted 6 lines
drivers/media/platform/soc_camera/soc_camera.c +6 -0
+	if (client)
+		snprintf(clk_name, sizeof(clk_name), "%d-%04x",
+			 client->adapter->nr, client->addr);
+	else
+		snprintf(clk_name, sizeof(clk_name), "of-%s",
+			 of_node_full_name(remote));

[...]

WBR, Sergei