Instead of expecting subdevice drivers to have a standard type as their
platform data, use the new .pdata member of struct v4l2_subdev. This allows
the use of arbitrary subdevice drivers with soc-camera in asynchronous
mode.

Signed-off-by: Guennadi Liakhovetski <g.liakhovet...@gmx.de>
---
 drivers/media/i2c/soc_camera/imx074.c          |    1 +
 drivers/media/platform/soc_camera/soc_camera.c |   10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/soc_camera/imx074.c 
b/drivers/media/i2c/soc_camera/imx074.c
index 23de859..321496a 100644
--- a/drivers/media/i2c/soc_camera/imx074.c
+++ b/drivers/media/i2c/soc_camera/imx074.c
@@ -457,6 +457,7 @@ static int imx074_probe(struct i2c_client *client,
        priv->fmt       = &imx074_colour_fmts[0];
 
        priv->subdev.dev = &client->dev;
+       priv->subdev.pdata = &ssdd->sd_pdata;
 
        priv->clk = v4l2_clk_get(&client->dev, "mclk");
        if (IS_ERR(priv->clk)) {
diff --git a/drivers/media/platform/soc_camera/soc_camera.c 
b/drivers/media/platform/soc_camera/soc_camera.c
index c06e660..3113287 100644
--- a/drivers/media/platform/soc_camera/soc_camera.c
+++ b/drivers/media/platform/soc_camera/soc_camera.c
@@ -1363,6 +1363,11 @@ static int soc_camera_i2c_init(struct soc_camera_device 
*icd,
                return -ENODEV;
        }
 
+       /*
+        * Only soc-camera originated subdevice drivers can be used in
+        * synchronous mode. They all use struct soc_camera_subdev_desc for
+        * platform data.
+        */
        shd->board_info->platform_data = &sdesc->subdev_desc;
 
        snprintf(clk_name, sizeof(clk_name), "%d-%04x",
@@ -1438,8 +1443,9 @@ static int soc_camera_async_bound(struct 
v4l2_async_notifier *notifier,
                 */
                if (client) {
                        struct soc_camera_desc *sdesc = to_soc_camera_desc(icd);
-                       struct soc_camera_subdev_desc *ssdd =
-                               soc_camera_i2c_to_desc(client);
+                       struct v4l2_subdev_platform_data *sd_pdata = 
sd->sd_pdata;
+                       struct soc_camera_subdev_desc *ssdd = sd_pdata ?
+                               sd_pdata->host_priv : NULL;
                        if (ssdd) {
                                memcpy(&sdesc->subdev_desc, ssdd,
                                       sizeof(sdesc->subdev_desc));
-- 
1.7.2.5

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

Reply via email to