* soc-camera: Why are exposure and gain handled via special cases?
@ 2009-06-08 16:31 Jonathan Cameron
2009-06-08 17:53 ` Guennadi Liakhovetski
0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Cameron @ 2009-06-08 16:31 UTC (permalink / raw)
To: Linux Media Mailing List
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?
Thanks,
Jonathan
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: soc-camera: Why are exposure and gain handled via special cases?
2009-06-08 16:31 soc-camera: Why are exposure and gain handled via special cases? Jonathan Cameron
@ 2009-06-08 17:53 ` Guennadi Liakhovetski
0 siblings, 0 replies; 2+ messages in thread
From: Guennadi Liakhovetski @ 2009-06-08 17:53 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: Linux Media Mailing List
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/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-06-08 17:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-08 16:31 soc-camera: Why are exposure and gain handled via special cases? Jonathan Cameron
2009-06-08 17:53 ` Guennadi Liakhovetski
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.