aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2013-04-18 17:35:28 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2013-10-31 02:30:56 -0400
commitd3f884a70938b1776ba44c7b6c82f3c3fd54ccbd (patch)
tree1d243299ec9e3202c496669c30cf99c3a67c5e8a
parentb1cbab05d9adbd8d6d7afc822b809c5d47c46f94 (diff)
[media] soc-camera: switch to using the new struct v4l2_subdev_platform_data
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>
-rw-r--r--drivers/media/platform/soc_camera/soc_camera.c24
-rw-r--r--include/media/soc_camera.h17
2 files changed, 21 insertions, 20 deletions
diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c
index 387a232d95a4..e201d48de70e 100644
--- a/drivers/media/platform/soc_camera/soc_camera.c
+++ b/drivers/media/platform/soc_camera/soc_camera.c
@@ -76,8 +76,8 @@ int soc_camera_power_on(struct device *dev, struct soc_camera_subdev_desc *ssdd,
76 dev_err(dev, "Cannot enable clock: %d\n", ret); 76 dev_err(dev, "Cannot enable clock: %d\n", ret);
77 return ret; 77 return ret;
78 } 78 }
79 ret = regulator_bulk_enable(ssdd->num_regulators, 79 ret = regulator_bulk_enable(ssdd->sd_pdata.num_regulators,
80 ssdd->regulators); 80 ssdd->sd_pdata.regulators);
81 if (ret < 0) { 81 if (ret < 0) {
82 dev_err(dev, "Cannot enable regulators\n"); 82 dev_err(dev, "Cannot enable regulators\n");
83 goto eregenable; 83 goto eregenable;
@@ -95,8 +95,8 @@ int soc_camera_power_on(struct device *dev, struct soc_camera_subdev_desc *ssdd,
95 return 0; 95 return 0;
96 96
97epwron: 97epwron:
98 regulator_bulk_disable(ssdd->num_regulators, 98 regulator_bulk_disable(ssdd->sd_pdata.num_regulators,
99 ssdd->regulators); 99 ssdd->sd_pdata.regulators);
100eregenable: 100eregenable:
101 if (clk) 101 if (clk)
102 v4l2_clk_disable(clk); 102 v4l2_clk_disable(clk);
@@ -120,8 +120,8 @@ int soc_camera_power_off(struct device *dev, struct soc_camera_subdev_desc *ssdd
120 } 120 }
121 } 121 }
122 122
123 err = regulator_bulk_disable(ssdd->num_regulators, 123 err = regulator_bulk_disable(ssdd->sd_pdata.num_regulators,
124 ssdd->regulators); 124 ssdd->sd_pdata.regulators);
125 if (err < 0) { 125 if (err < 0) {
126 dev_err(dev, "Cannot disable regulators\n"); 126 dev_err(dev, "Cannot disable regulators\n");
127 ret = ret ? : err; 127 ret = ret ? : err;
@@ -137,8 +137,8 @@ EXPORT_SYMBOL(soc_camera_power_off);
137int soc_camera_power_init(struct device *dev, struct soc_camera_subdev_desc *ssdd) 137int soc_camera_power_init(struct device *dev, struct soc_camera_subdev_desc *ssdd)
138{ 138{
139 /* Should not have any effect in synchronous case */ 139 /* Should not have any effect in synchronous case */
140 return devm_regulator_bulk_get(dev, ssdd->num_regulators, 140 return devm_regulator_bulk_get(dev, ssdd->sd_pdata.num_regulators,
141 ssdd->regulators); 141 ssdd->sd_pdata.regulators);
142} 142}
143EXPORT_SYMBOL(soc_camera_power_init); 143EXPORT_SYMBOL(soc_camera_power_init);
144 144
@@ -1346,8 +1346,8 @@ static int soc_camera_i2c_init(struct soc_camera_device *icd,
1346 * soc_camera_pdrv_probe(), make sure the subdevice driver doesn't try 1346 * soc_camera_pdrv_probe(), make sure the subdevice driver doesn't try
1347 * to allocate them again. 1347 * to allocate them again.
1348 */ 1348 */
1349 ssdd->num_regulators = 0; 1349 ssdd->sd_pdata.num_regulators = 0;
1350 ssdd->regulators = NULL; 1350 ssdd->sd_pdata.regulators = NULL;
1351 shd->board_info->platform_data = ssdd; 1351 shd->board_info->platform_data = ssdd;
1352 1352
1353 snprintf(clk_name, sizeof(clk_name), "%d-%04x", 1353 snprintf(clk_name, sizeof(clk_name), "%d-%04x",
@@ -2020,8 +2020,8 @@ static int soc_camera_pdrv_probe(struct platform_device *pdev)
2020 * that case regulators are attached to the I2C device and not to the 2020 * that case regulators are attached to the I2C device and not to the
2021 * camera platform device. 2021 * camera platform device.
2022 */ 2022 */
2023 ret = devm_regulator_bulk_get(&pdev->dev, ssdd->num_regulators, 2023 ret = devm_regulator_bulk_get(&pdev->dev, ssdd->sd_pdata.num_regulators,
2024 ssdd->regulators); 2024 ssdd->sd_pdata.regulators);
2025 if (ret < 0) 2025 if (ret < 0)
2026 return ret; 2026 return ret;
2027 2027
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 34d2414f2b8c..2bb418346b1f 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -146,10 +146,6 @@ struct soc_camera_subdev_desc {
146 /* sensor driver private platform data */ 146 /* sensor driver private platform data */
147 void *drv_priv; 147 void *drv_priv;
148 148
149 /* Optional regulators that have to be managed on power on/off events */
150 struct regulator_bulk_data *regulators;
151 int num_regulators;
152
153 /* Optional callbacks to power on or off and reset the sensor */ 149 /* Optional callbacks to power on or off and reset the sensor */
154 int (*power)(struct device *, int); 150 int (*power)(struct device *, int);
155 int (*reset)(struct device *); 151 int (*reset)(struct device *);
@@ -162,6 +158,9 @@ struct soc_camera_subdev_desc {
162 int (*set_bus_param)(struct soc_camera_subdev_desc *, unsigned long flags); 158 int (*set_bus_param)(struct soc_camera_subdev_desc *, unsigned long flags);
163 unsigned long (*query_bus_param)(struct soc_camera_subdev_desc *); 159 unsigned long (*query_bus_param)(struct soc_camera_subdev_desc *);
164 void (*free_bus)(struct soc_camera_subdev_desc *); 160 void (*free_bus)(struct soc_camera_subdev_desc *);
161
162 /* Optional regulators that have to be managed on power on/off events */
163 struct v4l2_subdev_platform_data sd_pdata;
165}; 164};
166 165
167struct soc_camera_host_desc { 166struct soc_camera_host_desc {
@@ -202,10 +201,6 @@ struct soc_camera_link {
202 201
203 void *priv; 202 void *priv;
204 203
205 /* Optional regulators that have to be managed on power on/off events */
206 struct regulator_bulk_data *regulators;
207 int num_regulators;
208
209 /* Optional callbacks to power on or off and reset the sensor */ 204 /* Optional callbacks to power on or off and reset the sensor */
210 int (*power)(struct device *, int); 205 int (*power)(struct device *, int);
211 int (*reset)(struct device *); 206 int (*reset)(struct device *);
@@ -218,6 +213,12 @@ struct soc_camera_link {
218 unsigned long (*query_bus_param)(struct soc_camera_link *); 213 unsigned long (*query_bus_param)(struct soc_camera_link *);
219 void (*free_bus)(struct soc_camera_link *); 214 void (*free_bus)(struct soc_camera_link *);
220 215
216 /* Optional regulators that have to be managed on power on/off events */
217 struct regulator_bulk_data *regulators;
218 int num_regulators;
219
220 void *host_priv;
221
221 /* 222 /*
222 * Host part - keep at bottom and compatible to 223 * Host part - keep at bottom and compatible to
223 * struct soc_camera_host_desc 224 * struct soc_camera_host_desc