Re: [RFC 2/5] media: v4l2-ctrl: Document V4L2_CID_LOCATION

From: Laurent Pinchart
Date: Thu Aug 15 2019 - 09:20:05 EST


On Thu, Aug 15, 2019 at 04:15:10PM +0300, Sakari Ailus wrote:
> On Thu, Aug 15, 2019 at 04:10:53PM +0300, Laurent Pinchart wrote:
> > On Thu, Aug 15, 2019 at 04:08:49PM +0300, Sakari Ailus wrote:
> >> On Thu, Aug 15, 2019 at 03:59:38PM +0300, Laurent Pinchart wrote:
> >>> On Thu, Aug 15, 2019 at 10:00:25AM +0300, Sakari Ailus wrote:
> >>>> On Wed, Aug 14, 2019 at 10:28:12PM +0200, Jacopo Mondi wrote:
> >>>>> Add documentation for the V4L2_CID_LOCATION camera control. The newly
> >>>>> added read-only control reports the camera device mounting position.
> >>>>>
> >>>>> Signed-off-by: Jacopo Mondi <jacopo@xxxxxxxxxx>
> >>>>> ---
> >>>>> .../media/uapi/v4l/ext-ctrls-camera.rst | 23 +++++++++++++++++++
> >>>>> 1 file changed, 23 insertions(+)
> >>>>>
> >>>>> diff --git a/Documentation/media/uapi/v4l/ext-ctrls-camera.rst b/Documentation/media/uapi/v4l/ext-ctrls-camera.rst
> >>>>> index 51c1d5c9eb00..fc0a02eee6d4 100644
> >>>>> --- a/Documentation/media/uapi/v4l/ext-ctrls-camera.rst
> >>>>> +++ b/Documentation/media/uapi/v4l/ext-ctrls-camera.rst
> >>>>> @@ -510,6 +510,29 @@ enum v4l2_scene_mode -
> >>>>> value down. A value of zero stops the motion if one is in progress
> >>>>> and has no effect otherwise.
> >>>>>
> >>>>> +``V4L2_CID_LOCATION (integer)``
> >>>>> + This read-only control describes the camera location by reporting its
> >>>>> + mounting position on the device where the camera is installed. This
> >>>>> + control is particularly meaningful for devices which have a well defined
> >>>>> + orientation, such as phones, laptops and portable devices as the camera
> >>>>> + location is expressed as a position relative to the device intended
> >>>>> + usage position. In example, a camera installed on the user-facing side
> >>>>
> >>>> s/In/For/
> >>>>
> >>>>> + of a phone device is said to be installed in the ``V4L2_LOCATION_FRONT``
> >>>>> + position.
> >>>>> +
> >>>>> +
> >>>>> +
> >>>>> +.. flat-table::
> >>>>> + :header-rows: 0
> >>>>> + :stub-columns: 0
> >>>>> +
> >>>>> + * - ``V4L2_LOCATION_FRONT``
> >>>>> + - The camera device is located on the front side of the device.
> >>>>> + * - ``V4L2_LOCATION_BACK``
> >>>>> + - The camera device is located on the back side of the device.
> >>>>> +
> >>>>> +
> >>>>> +
> >>>>> .. [#f1]
> >>>>> This control may be changed to a menu control in the future, if more
> >>>>> options are required.
> >>>>
> >>>> There's an effective limit of 64 for menus. ACPI has less than ten
> >>>> different locations for a device, I think 64 will be enough here.
> >>>>
> >>>> So I'd be actually in favour of switching to a menu.
> >>>
> >>> Why ? As you explained yourself, it's a static read-only control, all it
> >>> needs to report is a single value.
> >>
> >> Yes. That's true. It wasn't meant for this but it's nevertheless a
> >> convenient API to get that information, both as integer and string.
> >
> > But why is that needed ? The integer seems enough to me.
>
> Because it's a qualitative control, not a quantitative one.

And ? :-) The integer values are defined in the V4L2 spec, they map to a
usage, and a name can easily be derived from that in userspace if
desired.

--
Regards,

Laurent Pinchart