public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sylwester Nawrocki <snjw23@gmail.com>
Cc: linux-media@vger.kernel.org, Sakari Ailus <sakari.ailus@iki.fi>,
	Hans Verkuil <hverkuil@xs4all.nl>,
	Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
Subject: Re: [PATCH/RFC][DRAFT] V4L: Add camera auto focus controls
Date: Thu, 01 Mar 2012 23:30:16 +0100	[thread overview]
Message-ID: <1441235.tcAt0gpJAF@avalon> (raw)
In-Reply-To: <4F4A6493.1080004@gmail.com>

Hi Sylwester,

On Sunday 26 February 2012 17:57:55 Sylwester Nawrocki wrote:
> On 01/16/2012 10:33 PM, Sylwester Nawrocki wrote:
> > diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
> > index 012a296..0808b12 100644
> > --- a/include/linux/videodev2.h
> > +++ b/include/linux/videodev2.h
> > @@ -1662,6 +1662,34 @@ enum  v4l2_exposure_auto_type {
> > 
> >   #define V4L2_CID_IRIS_ABSOLUTE			(V4L2_CID_CAMERA_CLASS_BASE+17)
> >   #define V4L2_CID_IRIS_RELATIVE			(V4L2_CID_CAMERA_CLASS_BASE+18)
> > 
> > +#define V4L2_CID_AUTO_FOCUS_START		(V4L2_CID_CAMERA_CLASS_BASE+19)
> > +#define V4L2_CID_AUTO_FOCUS_STOP		(V4L2_CID_CAMERA_CLASS_BASE+20)
> > +#define V4L2_CID_AUTO_FOCUS_STATUS		(V4L2_CID_CAMERA_CLASS_BASE+21)
> > +enum v4l2_auto_focus_status {
> > +	V4L2_AUTO_FOCUS_STATUS_IDLE		= 0,
> > +	V4L2_AUTO_FOCUS_STATUS_BUSY		= 1,
> > +	V4L2_AUTO_FOCUS_STATUS_SUCCESS		= 2,
> > +	V4L2_AUTO_FOCUS_STATUS_FAIL		= 3,
> > +};
> > +
> > +#define V4L2_CID_AUTO_FOCUS_DISTANCE		(V4L2_CID_CAMERA_CLASS_BASE+22)
> > +enum v4l2_auto_focus_distance {
> > +	V4L2_AUTO_FOCUS_DISTANCE_NORMAL		= 0,
> > +	V4L2_AUTO_FOCUS_DISTANCE_MACRO		= 1,
> > +	V4L2_AUTO_FOCUS_DISTANCE_INFINITY	= 2,
> > +};
> > +
> > +#define V4L2_CID_AUTO_FOCUS_SELECTION		
(V4L2_CID_CAMERA_CLASS_BASE+23)
> > +enum v4l2_auto_focus_selection {
> > +	V4L2_AUTO_FOCUS_SELECTION_NORMAL	= 0,
> > +	V4L2_AUTO_FOCUS_SELECTION_SPOT		= 1,
> > +	V4L2_AUTO_FOCUS_SELECTION_RECTANGLE	= 2,
> > +};
> 
> I'd like to ask your advice, I've found those two above controls
> rather painful in use. After changing V4L2_CID_AUTO_FOCUS_SELECTION to
> 
> #define V4L2_CID_AUTO_FOCUS_AREA		(V4L2_CID_CAMERA_CLASS_BASE+23)
> enum v4l2_auto_focus_selection {
> 	V4L2_AUTO_FOCUS_SELECTION_ALL		= 0,
> 	V4L2_AUTO_FOCUS_SELECTION_SPOT		= 1,
> 	V4L2_AUTO_FOCUS_SELECTION_RECTANGLE	= 2,
> };
> 
> I tried use them with the M-5MOLS sensor driver where there is only
> one register for setting following automatic focus modes:
> 
> NORMAL AUTO (single-shot),
> MACRO,
> INFINITY,
> SPOT,
> FACE_DETECTION
> 
> The issue is that when V4L2_CID_AUTO_FOCUS_AREA is set to for example
> V4L2_AUTO_FOCUS_SELECTION_SPOT, none of the menu entries of
> V4L2_CID_AUTO_FOCUS_DISTANCE is valid.
> 
> So it would really be better to use single control for automatic focus
> mode. A private control could handle that. But there will be more than
> one sensor driver needing such a control, so I thought about an
> additional header, e.g. samsung_camera.h in include/linux/ that would
> define reguired control IDs and menus in the camera class private id
> range.
> 
> What do you think about it ?

One option would be to disable the focus area control when the focus distance 
is set to a value different than normal (or the other way around). Control 
change events could be used to report that to userspace. Would that work with 
your hardware ?

-- 
Regards,

Laurent Pinchart


  parent reply	other threads:[~2012-03-01 22:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-16 21:33 [PATCH/RFC][DRAFT] V4L: Add camera auto focus controls Sylwester Nawrocki
2012-02-26 16:57 ` Sylwester Nawrocki
2012-02-26 17:10   ` Sylwester Nawrocki
2012-03-01 22:30   ` Laurent Pinchart [this message]
2012-03-01 23:26     ` Sylwester Nawrocki
2012-03-02 18:17       ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1441235.tcAt0gpJAF@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@iki.fi \
    --cc=snjw23@gmail.com \
    --cc=sylvester.nawrocki@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox