Re: soc-camera: Why are exposure and gain handled via special cases?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 8 Jun 2009, Jonathan Cameron wrote:

> Hi All,
> 
> Whilst working on merging the various ov7670 drivers posted
> recently, I came across the following in soc-camera:
> 
> static int soc_camera_g_ctrl(struct file *file, void *priv,
> 			     struct v4l2_control *ctrl)
> {
> 	struct soc_camera_file *icf = file->private_data;
> 	struct soc_camera_device *icd = icf->icd;
> 	struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
> 
> 	WARN_ON(priv != file->private_data);
> 
> 	switch (ctrl->id) {
> 	case V4L2_CID_GAIN:
> 		if (icd->gain == (unsigned short)~0)
> 			return -EINVAL;
> 		ctrl->value = icd->gain;
> 		return 0;
> 	case V4L2_CID_EXPOSURE:
> 		if (icd->exposure == (unsigned short)~0)
> 			return -EINVAL;
> 		ctrl->value = icd->exposure;
> 		return 0;
> 	}
> 
> 	return v4l2_device_call_until_err(&ici->v4l2_dev, (__u32)icd, core, g_ctrl, ctrl);
> }
> 
> Why are these two cases and only these two handled by soc-camera rather than being passed
> on to the drivers?

In the case of statically configured gain and exposure it is the easiest 
to cache the last configured value and just return it when requested. At 
the time I wrote that code I wasn't sure what to return if autoexposure or 
autogain were configured. In the beginning these two controls actually 
also were implemented individually, but their implementation was 
identical, so, I united them. If this is becomming a problem now, we can 
revert it.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux