aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/soc_camera.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2009-08-25 10:53:23 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-09-18 23:19:20 -0400
commit96c75399544838e1752001c8abdde36dd459cf8f (patch)
treead2dfa46e1f83d3b9b3de07f835618b15b90b0a5 /drivers/media/video/soc_camera.c
parenta4c56fd8892e51d675f7665ddee4fd9d7e5c2cc3 (diff)
V4L/DVB (12536): soc-camera: remove .gain and .exposure struct soc_camera_device members
This makes the soc-camera interface for V4L2 subdevices thinner yet. Handle gain and exposure internally in each driver just like all other controls. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/soc_camera.c')
-rw-r--r--drivers/media/video/soc_camera.c33
1 files changed, 11 insertions, 22 deletions
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c
index 27921162514c..e8248ba0c03c 100644
--- a/drivers/media/video/soc_camera.c
+++ b/drivers/media/video/soc_camera.c
@@ -327,7 +327,9 @@ static int soc_camera_set_fmt(struct soc_camera_file *icf,
327static int soc_camera_open(struct file *file) 327static int soc_camera_open(struct file *file)
328{ 328{
329 struct video_device *vdev = video_devdata(file); 329 struct video_device *vdev = video_devdata(file);
330 struct soc_camera_device *icd = container_of(vdev->parent, struct soc_camera_device, dev); 330 struct soc_camera_device *icd = container_of(vdev->parent,
331 struct soc_camera_device,
332 dev);
331 struct soc_camera_link *icl = to_soc_camera_link(icd); 333 struct soc_camera_link *icl = to_soc_camera_link(icd);
332 struct soc_camera_host *ici; 334 struct soc_camera_host *ici;
333 struct soc_camera_file *icf; 335 struct soc_camera_file *icf;
@@ -349,7 +351,10 @@ static int soc_camera_open(struct file *file)
349 goto emgi; 351 goto emgi;
350 } 352 }
351 353
352 /* Protect against icd->ops->remove() until we module_get() both drivers. */ 354 /*
355 * Protect against icd->ops->remove() until we module_get() both
356 * drivers.
357 */
353 mutex_lock(&icd->video_lock); 358 mutex_lock(&icd->video_lock);
354 359
355 icf->icd = icd; 360 icf->icd = icd;
@@ -670,19 +675,6 @@ static int soc_camera_g_ctrl(struct file *file, void *priv,
670 675
671 WARN_ON(priv != file->private_data); 676 WARN_ON(priv != file->private_data);
672 677
673 switch (ctrl->id) {
674 case V4L2_CID_GAIN:
675 if (icd->gain == (unsigned short)~0)
676 return -EINVAL;
677 ctrl->value = icd->gain;
678 return 0;
679 case V4L2_CID_EXPOSURE:
680 if (icd->exposure == (unsigned short)~0)
681 return -EINVAL;
682 ctrl->value = icd->exposure;
683 return 0;
684 }
685
686 if (ici->ops->get_ctrl) { 678 if (ici->ops->get_ctrl) {
687 ret = ici->ops->get_ctrl(icd, ctrl); 679 ret = ici->ops->get_ctrl(icd, ctrl);
688 if (ret != -ENOIOCTLCMD) 680 if (ret != -ENOIOCTLCMD)
@@ -944,7 +936,10 @@ static int soc_camera_probe(struct device *dev)
944 if (ret < 0) 936 if (ret < 0)
945 goto eadddev; 937 goto eadddev;
946 938
947 /* FIXME: this is racy, have to use driver-binding notification */ 939 /*
940 * FIXME: this is racy, have to use driver-binding notification,
941 * when it is available
942 */
948 control = to_soc_camera_control(icd); 943 control = to_soc_camera_control(icd);
949 if (!control || !control->driver || !dev_get_drvdata(control) || 944 if (!control || !control->driver || !dev_get_drvdata(control) ||
950 !try_module_get(control->driver->owner)) { 945 !try_module_get(control->driver->owner)) {
@@ -1279,7 +1274,6 @@ static int video_dev_create(struct soc_camera_device *icd)
1279 */ 1274 */
1280static int soc_camera_video_start(struct soc_camera_device *icd) 1275static int soc_camera_video_start(struct soc_camera_device *icd)
1281{ 1276{
1282 const struct v4l2_queryctrl *qctrl;
1283 int ret; 1277 int ret;
1284 1278
1285 if (!icd->dev.parent) 1279 if (!icd->dev.parent)
@@ -1297,11 +1291,6 @@ static int soc_camera_video_start(struct soc_camera_device *icd)
1297 return ret; 1291 return ret;
1298 } 1292 }
1299 1293
1300 qctrl = soc_camera_find_qctrl(icd->ops, V4L2_CID_GAIN);
1301 icd->gain = qctrl ? qctrl->default_value : (unsigned short)~0;
1302 qctrl = soc_camera_find_qctrl(icd->ops, V4L2_CID_EXPOSURE);
1303 icd->exposure = qctrl ? qctrl->default_value : (unsigned short)~0;
1304
1305 return 0; 1294 return 0;
1306} 1295}
1307 1296