[media] soc-camera: switch to using the new struct v4l2_subdev_platform_data
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Thu, 18 Apr 2013 21:35:28 +0000 (18:35 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Thu, 31 Oct 2013 06:30:56 +0000 (04:30 -0200)
This prepares soc-camera to use struct v4l2_subdev_platform_data for its
subdevice-facing API, which would allow subdevice driver re-use.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/platform/soc_camera/soc_camera.c
include/media/soc_camera.h

index 387a232d95a4b63d74a9e3d2ef8030d8cdfee08c..e201d48de70e974599a7819f93ccf9bccd94422a 100644 (file)
@@ -76,8 +76,8 @@ int soc_camera_power_on(struct device *dev, struct soc_camera_subdev_desc *ssdd,
                dev_err(dev, "Cannot enable clock: %d\n", ret);
                return ret;
        }
-       ret = regulator_bulk_enable(ssdd->num_regulators,
-                                       ssdd->regulators);
+       ret = regulator_bulk_enable(ssdd->sd_pdata.num_regulators,
+                                   ssdd->sd_pdata.regulators);
        if (ret < 0) {
                dev_err(dev, "Cannot enable regulators\n");
                goto eregenable;
@@ -95,8 +95,8 @@ int soc_camera_power_on(struct device *dev, struct soc_camera_subdev_desc *ssdd,
        return 0;
 
 epwron:
-       regulator_bulk_disable(ssdd->num_regulators,
-                              ssdd->regulators);
+       regulator_bulk_disable(ssdd->sd_pdata.num_regulators,
+                              ssdd->sd_pdata.regulators);
 eregenable:
        if (clk)
                v4l2_clk_disable(clk);
@@ -120,8 +120,8 @@ int soc_camera_power_off(struct device *dev, struct soc_camera_subdev_desc *ssdd
                }
        }
 
-       err = regulator_bulk_disable(ssdd->num_regulators,
-                                    ssdd->regulators);
+       err = regulator_bulk_disable(ssdd->sd_pdata.num_regulators,
+                                    ssdd->sd_pdata.regulators);
        if (err < 0) {
                dev_err(dev, "Cannot disable regulators\n");
                ret = ret ? : err;
@@ -137,8 +137,8 @@ EXPORT_SYMBOL(soc_camera_power_off);
 int soc_camera_power_init(struct device *dev, struct soc_camera_subdev_desc *ssdd)
 {
        /* Should not have any effect in synchronous case */
-       return devm_regulator_bulk_get(dev, ssdd->num_regulators,
-                                      ssdd->regulators);
+       return devm_regulator_bulk_get(dev, ssdd->sd_pdata.num_regulators,
+                                      ssdd->sd_pdata.regulators);
 }
 EXPORT_SYMBOL(soc_camera_power_init);
 
@@ -1346,8 +1346,8 @@ static int soc_camera_i2c_init(struct soc_camera_device *icd,
         * soc_camera_pdrv_probe(), make sure the subdevice driver doesn't try
         * to allocate them again.
         */
-       ssdd->num_regulators = 0;
-       ssdd->regulators = NULL;
+       ssdd->sd_pdata.num_regulators = 0;
+       ssdd->sd_pdata.regulators = NULL;
        shd->board_info->platform_data = ssdd;
 
        snprintf(clk_name, sizeof(clk_name), "%d-%04x",
@@ -2020,8 +2020,8 @@ static int soc_camera_pdrv_probe(struct platform_device *pdev)
         * that case regulators are attached to the I2C device and not to the
         * camera platform device.
         */
-       ret = devm_regulator_bulk_get(&pdev->dev, ssdd->num_regulators,
-                                     ssdd->regulators);
+       ret = devm_regulator_bulk_get(&pdev->dev, ssdd->sd_pdata.num_regulators,
+                                     ssdd->sd_pdata.regulators);
        if (ret < 0)
                return ret;
 
index 34d2414f2b8c0a6207fb3d4dfe2c34d644f7d6aa..2bb418346b1f606b2546695cebc142e1615ae910 100644 (file)
@@ -146,10 +146,6 @@ struct soc_camera_subdev_desc {
        /* sensor driver private platform data */
        void *drv_priv;
 
-       /* Optional regulators that have to be managed on power on/off events */
-       struct regulator_bulk_data *regulators;
-       int num_regulators;
-
        /* Optional callbacks to power on or off and reset the sensor */
        int (*power)(struct device *, int);
        int (*reset)(struct device *);
@@ -162,6 +158,9 @@ struct soc_camera_subdev_desc {
        int (*set_bus_param)(struct soc_camera_subdev_desc *, unsigned long flags);
        unsigned long (*query_bus_param)(struct soc_camera_subdev_desc *);
        void (*free_bus)(struct soc_camera_subdev_desc *);
+
+       /* Optional regulators that have to be managed on power on/off events */
+       struct v4l2_subdev_platform_data sd_pdata;
 };
 
 struct soc_camera_host_desc {
@@ -202,10 +201,6 @@ struct soc_camera_link {
 
        void *priv;
 
-       /* Optional regulators that have to be managed on power on/off events */
-       struct regulator_bulk_data *regulators;
-       int num_regulators;
-
        /* Optional callbacks to power on or off and reset the sensor */
        int (*power)(struct device *, int);
        int (*reset)(struct device *);
@@ -218,6 +213,12 @@ struct soc_camera_link {
        unsigned long (*query_bus_param)(struct soc_camera_link *);
        void (*free_bus)(struct soc_camera_link *);
 
+       /* Optional regulators that have to be managed on power on/off events */
+       struct regulator_bulk_data *regulators;
+       int num_regulators;
+
+       void *host_priv;
+
        /*
         * Host part - keep at bottom and compatible to
         * struct soc_camera_host_desc