[{"id":26862,"web_url":"https://patchwork.libcamera.org/comment/26862/","msgid":"<CAPY8ntArOOqPQzvkJrQEyuVFfb6j8x6WODTMHOn1qHPU588mbQ@mail.gmail.com>","date":"2023-04-06T15:16:42","subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","submitter":{"id":27,"url":"https://patchwork.libcamera.org/api/people/27/","name":"Dave Stevenson","email":"dave.stevenson@raspberrypi.com"},"content":"Hi Michael\n\nThanks for the patch.\n\nI've got a personal interest here as I'd love to be able to control a\ncouple of CCTV lenses that I have. Those have standard motors with\npotentiometers for position feedback, not stepper motors, but\notherwise have the same limitations of slow movement.\n\nOn Thu, 6 Apr 2023 at 15:31, Michael Riesch via B4 Relay via\nlibcamera-devel <libcamera-devel@lists.libcamera.org> wrote:\n>\n> From: Michael Riesch <michael.riesch@wolfvision.net>\n>\n> Add the controls V4L2_CID_FOCUS_STATUS and V4L2_CID_ZOOM_STATUS that report\n> the status of the zoom lens group and the focus lens group, respectively.\n> The returned data structure contains the current position of the lens group\n> as well as movement indication flags.\n>\n> Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>\n> ---\n>  .../userspace-api/media/v4l/ext-ctrls-camera.rst   | 48 ++++++++++++++++++++++\n>  drivers/media/v4l2-core/v4l2-ctrls-core.c          |  9 ++++\n>  drivers/media/v4l2-core/v4l2-ctrls-defs.c          |  7 ++++\n>  include/media/v4l2-ctrls.h                         |  2 +\n>  include/uapi/linux/v4l2-controls.h                 | 13 ++++++\n>  include/uapi/linux/videodev2.h                     |  2 +\n>  6 files changed, 81 insertions(+)\n>\n> diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst\n> index daa4f40869f8..3a270bc63f1a 100644\n> --- a/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst\n> +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst\n> @@ -149,6 +149,30 @@ enum v4l2_exposure_metering -\n>      to the camera, negative values towards infinity. This is a\n>      write-only control.\n>\n> +``V4L2_CID_FOCUS_STATUS (struct)``\n> +    The current status of the focus lens group. This is a read-only control.\n> +    The returned data structure contains the current position and movement\n> +    indication flags. The unit of the current position is undefined. Positive\n> +    values move the focus closer to the camera, negative values towards\n> +    infinity. The possible flags are described in the table below.\n\nThe units are undefined, but positive and negative mean something with\nrespect to some unspecified focal distance represented by 0. That\nseems a little odd.\n\nI was going to suggest that it seems to make sense to follow the same\nunits as V4L2_CID_FOCUS_ABSOLUTE, but on reading that description in\n[1] it's the same text.\nI suspect there was a little too much copy/paste from\nV4L2_CID_FOCUS_RELATIVE, or the intent was that increasing the value\nbrings the focus closer, and decreasing moves it towards infinity.\n\nIf we did specify that it was the same units as\nV4L2_CID_FOCUS_ABSOLUTE, then what would that mean for use with\nV4L2_CID_FOCUS_RELATIVE? Then again the only user of _RELATIVE appears\nto be ov5693 with atomisp and that just maps it onto _ABSOLUTE, so\npotentially it's redundant and could be deprecated.\n\n[1] https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/ext-ctrls-camera.html\n\n> +\n> +.. tabularcolumns:: |p{6.8cm}|p{10.7cm}|\n> +\n> +.. flat-table::\n> +    :header-rows:  0\n> +    :stub-columns: 0\n> +\n> +    * - ``V4L2_LENS_STATUS_IDLE``\n> +      - Focus lens group is at rest.\n> +    * - ``V4L2_LENS_STATUS_BUSY``\n> +      - Focus lens group is moving.\n> +    * - ``V4L2_LENS_STATUS_REACHED``\n> +      - Focus lens group has reached its target position.\n> +    * - ``V4L2_LENS_STATUS_FAILED``\n> +      - Focus lens group has failed to reach its target position. The driver\n> +       will not transition from this state until another action is performed\n> +       by an application.\n\nWhen would the lens state transition from V4L2_LENS_STATUS_REACHED to\nV4L2_LENS_STATUS_IDLE?\nIf it's reached the position then it is at rest, and being at rest is\nthe definition of V4L2_LENS_STATUS_IDLE.\nLikewise the lens always has a target position based on the control\nvalue, so it's always at V4L2_LENS_STATUS_REACHED when it's not\nmoving.\nIs there a need to have 2 states?\n\nIf the position is the same units as V4L2_CID_FOCUS_ABSOLUTE, then do\nyou leave the determination of state to the application?\n\n>  ``V4L2_CID_FOCUS_AUTO (boolean)``\n>      Enables continuous automatic focus adjustments. The effect of manual\n>      focus adjustments while this feature is enabled is undefined,\n> @@ -239,6 +263,30 @@ enum v4l2_auto_focus_range -\n>      movement. A negative value moves the zoom lens group towards the\n>      wide-angle direction. The zoom speed unit is driver-specific.\n>\n> +``V4L2_CID_ZOOM_STATUS (struct)``\n> +    The current status of the zoom lens group. This is a read-only control.\n> +    The returned data structure contains the current position and movement\n> +    indication flags. The unit of the current position is driver-specific and\n> +    its value should be a positive integer. The possible flags are described\n> +    in the table below.\n> +\n> +.. tabularcolumns:: |p{6.8cm}|p{10.7cm}|\n> +\n> +.. flat-table::\n> +    :header-rows:  0\n> +    :stub-columns: 0\n> +\n> +    * - ``V4L2_LENS_STATUS_IDLE``\n> +      - Zoom lens group is at rest.\n> +    * - ``V4L2_LENS_STATUS_BUSY``\n> +      - Zoom lens group is moving.\n> +    * - ``V4L2_LENS_STATUS_REACHED``\n> +      - Zoom lens group has reached its target position.\n> +    * - ``V4L2_LENS_STATUS_FAILED``\n> +      - Zoom lens group has failed to reach its target position. The driver will\n> +       not transition from this state until another action is performed by an\n> +       application.\n> +\n>  ``V4L2_CID_IRIS_ABSOLUTE (integer)``\n>      This control sets the camera's aperture to the specified value. The\n>      unit is undefined. Larger values open the iris wider, smaller values\n> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-core.c b/drivers/media/v4l2-core/v4l2-ctrls-core.c\n> index 29169170880a..f6ad30f311c5 100644\n> --- a/drivers/media/v4l2-core/v4l2-ctrls-core.c\n> +++ b/drivers/media/v4l2-core/v4l2-ctrls-core.c\n> @@ -350,6 +350,9 @@ void v4l2_ctrl_type_op_log(const struct v4l2_ctrl *ctrl)\n>         case V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS:\n>                 pr_cont(\"HEVC_DECODE_PARAMS\");\n>                 break;\n> +       case V4L2_CTRL_TYPE_LENS_STATUS:\n> +               pr_cont(\"LENS_STATUS\");\n> +               break;\n>         default:\n>                 pr_cont(\"unknown type %d\", ctrl->type);\n>                 break;\n> @@ -918,6 +921,9 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx,\n>                         return -EINVAL;\n>                 break;\n>\n> +       case V4L2_CTRL_TYPE_LENS_STATUS:\n> +               break;\n> +\n>         default:\n>                 return -EINVAL;\n>         }\n> @@ -1605,6 +1611,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl,\n>         case V4L2_CTRL_TYPE_AREA:\n>                 elem_size = sizeof(struct v4l2_area);\n>                 break;\n> +       case V4L2_CTRL_TYPE_LENS_STATUS:\n> +               elem_size = sizeof(struct v4l2_ctrl_lens_status);\n> +               break;\n>         default:\n>                 if (type < V4L2_CTRL_COMPOUND_TYPES)\n>                         elem_size = sizeof(s32);\n> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c\n> index 564fedee2c88..9b26a3aa9e9c 100644\n> --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c\n> +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c\n> @@ -1044,6 +1044,8 @@ const char *v4l2_ctrl_get_name(u32 id)\n>         case V4L2_CID_CAMERA_ORIENTATION:       return \"Camera Orientation\";\n>         case V4L2_CID_CAMERA_SENSOR_ROTATION:   return \"Camera Sensor Rotation\";\n>         case V4L2_CID_HDR_SENSOR_MODE:          return \"HDR Sensor Mode\";\n> +       case V4L2_CID_FOCUS_STATUS:             return \"Focus, Status\";\n> +       case V4L2_CID_ZOOM_STATUS:              return \"Zoom, Status\";\n\nIs there a need for the comma in the text strings?\n\nCheers\n  Dave\n\n>\n>         /* FM Radio Modulator controls */\n>         /* Keep the order of the 'case's the same as in v4l2-controls.h! */\n> @@ -1593,6 +1595,11 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,\n>                 *flags |= V4L2_CTRL_FLAG_WRITE_ONLY |\n>                           V4L2_CTRL_FLAG_EXECUTE_ON_WRITE;\n>                 break;\n> +       case V4L2_CID_FOCUS_STATUS:\n> +       case V4L2_CID_ZOOM_STATUS:\n> +               *type = V4L2_CTRL_TYPE_LENS_STATUS;\n> +               *flags |= V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_VOLATILE;\n> +               break;\n>         case V4L2_CID_FLASH_STROBE_STATUS:\n>         case V4L2_CID_AUTO_FOCUS_STATUS:\n>         case V4L2_CID_FLASH_READY:\n> diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h\n> index e59d9a234631..f7273ffc20c9 100644\n> --- a/include/media/v4l2-ctrls.h\n> +++ b/include/media/v4l2-ctrls.h\n> @@ -52,6 +52,7 @@ struct video_device;\n>   * @p_hdr10_cll:               Pointer to an HDR10 Content Light Level structure.\n>   * @p_hdr10_mastering:         Pointer to an HDR10 Mastering Display structure.\n>   * @p_area:                    Pointer to an area.\n> + * @p_lens_status:             Pointer to a lens status structure.\n>   * @p:                         Pointer to a compound value.\n>   * @p_const:                   Pointer to a constant compound value.\n>   */\n> @@ -81,6 +82,7 @@ union v4l2_ctrl_ptr {\n>         struct v4l2_ctrl_hdr10_cll_info *p_hdr10_cll;\n>         struct v4l2_ctrl_hdr10_mastering_display *p_hdr10_mastering;\n>         struct v4l2_area *p_area;\n> +       struct v4l2_ctrl_lens_status *p_lens_status;\n>         void *p;\n>         const void *p_const;\n>  };\n> diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h\n> index 5e80daa4ffe0..8b037467ba9a 100644\n> --- a/include/uapi/linux/v4l2-controls.h\n> +++ b/include/uapi/linux/v4l2-controls.h\n> @@ -993,6 +993,19 @@ enum v4l2_auto_focus_range {\n>\n>  #define V4L2_CID_HDR_SENSOR_MODE               (V4L2_CID_CAMERA_CLASS_BASE+36)\n>\n> +struct v4l2_ctrl_lens_status {\n> +       __u32 flags;\n> +       __s32 current_position;\n> +};\n> +\n> +#define V4L2_LENS_STATUS_IDLE                  (0 << 0)\n> +#define V4L2_LENS_STATUS_BUSY                  (1 << 0)\n> +#define V4L2_LENS_STATUS_REACHED               (1 << 1)\n> +#define V4L2_LENS_STATUS_FAILED                        (1 << 2)\n> +\n> +#define V4L2_CID_FOCUS_STATUS                  (V4L2_CID_CAMERA_CLASS_BASE + 37)\n> +#define V4L2_CID_ZOOM_STATUS                   (V4L2_CID_CAMERA_CLASS_BASE + 38)\n> +\n>  /* FM Modulator class control IDs */\n>\n>  #define V4L2_CID_FM_TX_CLASS_BASE              (V4L2_CTRL_CLASS_FM_TX | 0x900)\n> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h\n> index 17a9b975177a..256c21c68720 100644\n> --- a/include/uapi/linux/videodev2.h\n> +++ b/include/uapi/linux/videodev2.h\n> @@ -1888,6 +1888,8 @@ enum v4l2_ctrl_type {\n>         V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS        = 0x0272,\n>         V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX      = 0x0273,\n>         V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS       = 0x0274,\n> +\n> +       V4L2_CTRL_TYPE_LENS_STATUS              = 0x0300,\n>  };\n>\n>  /*  Used in the VIDIOC_QUERYCTRL ioctl for querying controls */\n>\n> --\n> 2.30.2\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 0AB2EBD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  6 Apr 2023 15:17:02 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7A1A06277E;\n\tThu,  6 Apr 2023 17:17:01 +0200 (CEST)","from mail-ua1-x930.google.com (mail-ua1-x930.google.com\n\t[IPv6:2607:f8b0:4864:20::930])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7EA9E603A4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  6 Apr 2023 17:16:59 +0200 (CEST)","by mail-ua1-x930.google.com with SMTP id p91so10920574uap.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 06 Apr 2023 08:16:59 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1680794221;\n\tbh=ZRAEAvu9W5x1MGNSMqzOsmi2lrE6AEWw7/uME0yWsr0=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=cQtqSgoiTKUFZR2fSi5WNiuxSWSqsjBGjYr4PMEYK7E/IOFLaez3WBbpF6FCpm5/Q\n\tjUmoOijJ3uGYrUGx+792tV9dnmflkfNCypQDw2pDQxXj+BfzAKXW6hgDIswNbZb44W\n\tf5EoD6yVAsBilXR+xjgvwgOBOFJ4wDleHrnS1N+LpGsp4yT8xz7QnWkJrqluM4QMAW\n\t8znSSLytsWMryvV5ddIgWfpik4lbXipRy1G7ldBC/X/W0ACooJYgLlH5+K1050/+VF\n\tV0TXECFSX3OAlzZoEGH6I4CqCBsytlEcLd5SAP829ZT3APe7vnfBaO0YFuuglkpBWB\n\tcbo+l/7RsagWw==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1680794218;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date:message-id:reply-to;\n\tbh=Dg6TNa2vuEo6vYvQjhHJtmhbqHNEPTWF/K/ZgZoahhs=;\n\tb=NJAZS8c1olUUiKSGDc7+qwuZjEfCd4rrJH9E3ERCLLmiydyXhFp0FPr3JMQg0o3K9x\n\tmal9+G031qFGrc3FBkIOGnIg7nlgznYx/D5MW5aKxwinwZFD+KrtcNwskvZ9d4ZeXQTS\n\tsOUYYRBJwfHceUqm8nnvnWj3HIoIMES9d3w/FZBtKAVFjZIdHZjVPlr7QDLLj9FUiAMV\n\tqIuOy85QXFEnu/RQcYju5uYonoQmXig4/uXXmUwystgCgs5fNF9EAVsouK+EiScfWpGC\n\tsAMdiyUtR8IIk6IUxJLzYBzFDqXaiH39vuZM850RqRT1ukoOGxri6Exlp/saR5wtRc+g\n\twaEg=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"NJAZS8c1\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112; t=1680794218;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=Dg6TNa2vuEo6vYvQjhHJtmhbqHNEPTWF/K/ZgZoahhs=;\n\tb=e9TYfD8Ok1xxdH7RXix89jAd0U3077rl5C/5/aKmGU0e9Ib9kpnfPLxPp/OZPTJpny\n\troXethAdNqdZTDhHWbvOu7s/qLiNLt6pUCzoq1opKc6PQJi1FYMu65zuBjiYTYaL8dsx\n\tNe9xINGG6njxkPAnI13SCCGZLko7Nzt4TEuhQsyX6jHRP/btvBvVe4AiIWUGa+G1VEdb\n\tCvNgyS3oc2RdFKiAW60IChEVvqqgZg65YLnJbMeaV3wbWs8ZogavKNAqd4z14HwMj0yO\n\tdFYfYYxjxEZVy3yvLCr+SfsThd9J/1mjXC10m5bDPJdjK0SzrYOJefg8KxNL20YjzvQ6\n\t3WwQ==","X-Gm-Message-State":"AAQBX9ewlSfXGNf7E7NdAIE+eS28rQZr1csl5Byt7qSonosjrzrH90GC\n\tLNI0qZaac4BfsZvxCJP4dXX9Fc0K6zSsluzmgdgPrQ==","X-Google-Smtp-Source":"AKy350Yq/RNSiWTZPYCNZkw4exmVOf8gYNbaIuv4psde+ACRoxCkOzCPCv2vygU6rC5dnsWlipPczVB6GgwF11j0MLg=","X-Received":"by 2002:a1f:b688:0:b0:43c:5f0e:2399 with SMTP id\n\tg130-20020a1fb688000000b0043c5f0e2399mr7039754vkf.1.1680794218209;\n\tThu, 06 Apr 2023 08:16:58 -0700 (PDT)","MIME-Version":"1.0","References":"<20230406-feature-controls-lens-v1-0-543189a680de@wolfvision.net>\n\t<20230406-feature-controls-lens-v1-1-543189a680de@wolfvision.net>","In-Reply-To":"<20230406-feature-controls-lens-v1-1-543189a680de@wolfvision.net>","Date":"Thu, 6 Apr 2023 16:16:42 +0100","Message-ID":"<CAPY8ntArOOqPQzvkJrQEyuVFfb6j8x6WODTMHOn1qHPU588mbQ@mail.gmail.com>","To":"michael.riesch@wolfvision.net","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Dave Stevenson via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Dave Stevenson <dave.stevenson@raspberrypi.com>","Cc":"linux-kernel@vger.kernel.org,\n\tMatthias Fend <Matthias.Fend@wolfvision.net>, \n\tlibcamera-devel@lists.libcamera.org,\n\tSakari Ailus <sakari.ailus@linux.intel.com>,\n\tMauro Carvalho Chehab <mchehab@kernel.org>, Michael Riesch via B4 Relay\n\t<devnull+michael.riesch.wolfvision.net@kernel.org>, \n\tlinux-media@vger.kernel.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26865,"web_url":"https://patchwork.libcamera.org/comment/26865/","msgid":"<0f1baf5e-2ff6-e10b-5c3e-0a82c71d0ce6@wolfvision.net>","date":"2023-04-11T17:33:26","subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","submitter":{"id":135,"url":"https://patchwork.libcamera.org/api/people/135/","name":"Michael Riesch","email":"michael.riesch@wolfvision.net"},"content":"Hi Dave,\n\nOn 4/6/23 17:16, Dave Stevenson wrote:\n> Hi Michael\n> \n> Thanks for the patch.\n> \n> I've got a personal interest here as I'd love to be able to control a\n> couple of CCTV lenses that I have. Those have standard motors with\n> potentiometers for position feedback, not stepper motors, but\n> otherwise have the same limitations of slow movement.\n\nThat's great to hear :-) Thank you for your feedback!\n\n> On Thu, 6 Apr 2023 at 15:31, Michael Riesch via B4 Relay via\n> libcamera-devel <libcamera-devel@lists.libcamera.org> wrote:\n>>\n>> From: Michael Riesch <michael.riesch@wolfvision.net>\n>>\n>> Add the controls V4L2_CID_FOCUS_STATUS and V4L2_CID_ZOOM_STATUS that report\n>> the status of the zoom lens group and the focus lens group, respectively.\n>> The returned data structure contains the current position of the lens group\n>> as well as movement indication flags.\n>>\n>> Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>\n>> ---\n>>  .../userspace-api/media/v4l/ext-ctrls-camera.rst   | 48 ++++++++++++++++++++++\n>>  drivers/media/v4l2-core/v4l2-ctrls-core.c          |  9 ++++\n>>  drivers/media/v4l2-core/v4l2-ctrls-defs.c          |  7 ++++\n>>  include/media/v4l2-ctrls.h                         |  2 +\n>>  include/uapi/linux/v4l2-controls.h                 | 13 ++++++\n>>  include/uapi/linux/videodev2.h                     |  2 +\n>>  6 files changed, 81 insertions(+)\n>>\n>> diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst\n>> index daa4f40869f8..3a270bc63f1a 100644\n>> --- a/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst\n>> +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst\n>> @@ -149,6 +149,30 @@ enum v4l2_exposure_metering -\n>>      to the camera, negative values towards infinity. This is a\n>>      write-only control.\n>>\n>> +``V4L2_CID_FOCUS_STATUS (struct)``\n>> +    The current status of the focus lens group. This is a read-only control.\n>> +    The returned data structure contains the current position and movement\n>> +    indication flags. The unit of the current position is undefined. Positive\n>> +    values move the focus closer to the camera, negative values towards\n>> +    infinity. The possible flags are described in the table below.\n> \n> The units are undefined, but positive and negative mean something with\n> respect to some unspecified focal distance represented by 0. That\n> seems a little odd.\n> \n> I was going to suggest that it seems to make sense to follow the same\n> units as V4L2_CID_FOCUS_ABSOLUTE, but on reading that description in\n> [1] it's the same text.\n> I suspect there was a little too much copy/paste from\n> V4L2_CID_FOCUS_RELATIVE, or the intent was that increasing the value\n> brings the focus closer, and decreasing moves it towards infinity.\n> \n> If we did specify that it was the same units as\n> V4L2_CID_FOCUS_ABSOLUTE, then what would that mean for use with\n> V4L2_CID_FOCUS_RELATIVE? Then again the only user of _RELATIVE appears\n> to be ov5693 with atomisp and that just maps it onto _ABSOLUTE, so\n> potentially it's redundant and could be deprecated.\n> \n> [1] https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/ext-ctrls-camera.html\n\nI think we agree that the _STATUS controls should use the same unit as\nthe corresponding _ABSOLUTE control, whatever that may be.\n\nThen, the question is whether the description of FOCUS_ABSOLUTE needs to\nbe revised. I would agree that the intention probably was: \"Larger\nvalues move the focus closer to the camera, smaller values move the\nfocus to infinity.\" (cf. the phrasing in the description of IRIS_ABSOLUTE).\n\nIt would be interesting to know whether zero and negative values are\n(intentionally?) included. Since they are not explicitly excluded, my\ndriver exposes the position of the lens in motor steps to the user\nspace. If the values were (supposed to be) restricted to positive values\nlike ZOOM_ABSOLUTE, this would not be allowed of course.\n\nAs to the relation to _RELATIVE, I think it should be clear that all\ncontrols should act on the same scale and I don't see any problems here.\nHowever, feel free to point out what I am missing :-)\n\n>> +\n>> +.. tabularcolumns:: |p{6.8cm}|p{10.7cm}|\n>> +\n>> +.. flat-table::\n>> +    :header-rows:  0\n>> +    :stub-columns: 0\n>> +\n>> +    * - ``V4L2_LENS_STATUS_IDLE``\n>> +      - Focus lens group is at rest.\n>> +    * - ``V4L2_LENS_STATUS_BUSY``\n>> +      - Focus lens group is moving.\n>> +    * - ``V4L2_LENS_STATUS_REACHED``\n>> +      - Focus lens group has reached its target position.\n>> +    * - ``V4L2_LENS_STATUS_FAILED``\n>> +      - Focus lens group has failed to reach its target position. The driver\n>> +       will not transition from this state until another action is performed\n>> +       by an application.\n> \n> When would the lens state transition from V4L2_LENS_STATUS_REACHED to\n> V4L2_LENS_STATUS_IDLE?\n> If it's reached the position then it is at rest, and being at rest is\n> the definition of V4L2_LENS_STATUS_IDLE.\n> Likewise the lens always has a target position based on the control\n> value, so it's always at V4L2_LENS_STATUS_REACHED when it's not\n> moving.\n> Is there a need to have 2 states?\n\nGood point, I need to reconsider that (and possibly remove one of those\nstates).\n\n> If the position is the same units as V4L2_CID_FOCUS_ABSOLUTE, then do\n> you leave the determination of state to the application?\n\nI am afraid I don't quite follow.\n\nBut FWIW the application should read out the flags to find out whether\nthe lens is moving and, if this is not the case, whether the last move\ncommand (FOCUS_ABSOLUTE or FOCUS_RELATIVE) has succeeded or failed. The\nfailed state is important as there might be the possibility that\ndepending on the zoom lens position certain focus positions are not\navailable (and vice versa).\n\n>>  ``V4L2_CID_FOCUS_AUTO (boolean)``\n>>      Enables continuous automatic focus adjustments. The effect of manual\n>>      focus adjustments while this feature is enabled is undefined,\n>> @@ -239,6 +263,30 @@ enum v4l2_auto_focus_range -\n>>      movement. A negative value moves the zoom lens group towards the\n>>      wide-angle direction. The zoom speed unit is driver-specific.\n>>\n>> +``V4L2_CID_ZOOM_STATUS (struct)``\n>> +    The current status of the zoom lens group. This is a read-only control.\n>> +    The returned data structure contains the current position and movement\n>> +    indication flags. The unit of the current position is driver-specific and\n>> +    its value should be a positive integer. The possible flags are described\n>> +    in the table below.\n>> +\n>> +.. tabularcolumns:: |p{6.8cm}|p{10.7cm}|\n>> +\n>> +.. flat-table::\n>> +    :header-rows:  0\n>> +    :stub-columns: 0\n>> +\n>> +    * - ``V4L2_LENS_STATUS_IDLE``\n>> +      - Zoom lens group is at rest.\n>> +    * - ``V4L2_LENS_STATUS_BUSY``\n>> +      - Zoom lens group is moving.\n>> +    * - ``V4L2_LENS_STATUS_REACHED``\n>> +      - Zoom lens group has reached its target position.\n>> +    * - ``V4L2_LENS_STATUS_FAILED``\n>> +      - Zoom lens group has failed to reach its target position. The driver will\n>> +       not transition from this state until another action is performed by an\n>> +       application.\n>> +\n>>  ``V4L2_CID_IRIS_ABSOLUTE (integer)``\n>>      This control sets the camera's aperture to the specified value. The\n>>      unit is undefined. Larger values open the iris wider, smaller values\n>> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-core.c b/drivers/media/v4l2-core/v4l2-ctrls-core.c\n>> index 29169170880a..f6ad30f311c5 100644\n>> --- a/drivers/media/v4l2-core/v4l2-ctrls-core.c\n>> +++ b/drivers/media/v4l2-core/v4l2-ctrls-core.c\n>> @@ -350,6 +350,9 @@ void v4l2_ctrl_type_op_log(const struct v4l2_ctrl *ctrl)\n>>         case V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS:\n>>                 pr_cont(\"HEVC_DECODE_PARAMS\");\n>>                 break;\n>> +       case V4L2_CTRL_TYPE_LENS_STATUS:\n>> +               pr_cont(\"LENS_STATUS\");\n>> +               break;\n>>         default:\n>>                 pr_cont(\"unknown type %d\", ctrl->type);\n>>                 break;\n>> @@ -918,6 +921,9 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx,\n>>                         return -EINVAL;\n>>                 break;\n>>\n>> +       case V4L2_CTRL_TYPE_LENS_STATUS:\n>> +               break;\n>> +\n>>         default:\n>>                 return -EINVAL;\n>>         }\n>> @@ -1605,6 +1611,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl,\n>>         case V4L2_CTRL_TYPE_AREA:\n>>                 elem_size = sizeof(struct v4l2_area);\n>>                 break;\n>> +       case V4L2_CTRL_TYPE_LENS_STATUS:\n>> +               elem_size = sizeof(struct v4l2_ctrl_lens_status);\n>> +               break;\n>>         default:\n>>                 if (type < V4L2_CTRL_COMPOUND_TYPES)\n>>                         elem_size = sizeof(s32);\n>> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c\n>> index 564fedee2c88..9b26a3aa9e9c 100644\n>> --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c\n>> +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c\n>> @@ -1044,6 +1044,8 @@ const char *v4l2_ctrl_get_name(u32 id)\n>>         case V4L2_CID_CAMERA_ORIENTATION:       return \"Camera Orientation\";\n>>         case V4L2_CID_CAMERA_SENSOR_ROTATION:   return \"Camera Sensor Rotation\";\n>>         case V4L2_CID_HDR_SENSOR_MODE:          return \"HDR Sensor Mode\";\n>> +       case V4L2_CID_FOCUS_STATUS:             return \"Focus, Status\";\n>> +       case V4L2_CID_ZOOM_STATUS:              return \"Zoom, Status\";\n> \n> Is there a need for the comma in the text strings?\n\nNot sure, actually. Some other strings used commas. Monkey see, monkey do.\n\nBest regards,\nMichael\n\n> \n> Cheers\n>   Dave\n> \n>>\n>>         /* FM Radio Modulator controls */\n>>         /* Keep the order of the 'case's the same as in v4l2-controls.h! */\n>> @@ -1593,6 +1595,11 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,\n>>                 *flags |= V4L2_CTRL_FLAG_WRITE_ONLY |\n>>                           V4L2_CTRL_FLAG_EXECUTE_ON_WRITE;\n>>                 break;\n>> +       case V4L2_CID_FOCUS_STATUS:\n>> +       case V4L2_CID_ZOOM_STATUS:\n>> +               *type = V4L2_CTRL_TYPE_LENS_STATUS;\n>> +               *flags |= V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_VOLATILE;\n>> +               break;\n>>         case V4L2_CID_FLASH_STROBE_STATUS:\n>>         case V4L2_CID_AUTO_FOCUS_STATUS:\n>>         case V4L2_CID_FLASH_READY:\n>> diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h\n>> index e59d9a234631..f7273ffc20c9 100644\n>> --- a/include/media/v4l2-ctrls.h\n>> +++ b/include/media/v4l2-ctrls.h\n>> @@ -52,6 +52,7 @@ struct video_device;\n>>   * @p_hdr10_cll:               Pointer to an HDR10 Content Light Level structure.\n>>   * @p_hdr10_mastering:         Pointer to an HDR10 Mastering Display structure.\n>>   * @p_area:                    Pointer to an area.\n>> + * @p_lens_status:             Pointer to a lens status structure.\n>>   * @p:                         Pointer to a compound value.\n>>   * @p_const:                   Pointer to a constant compound value.\n>>   */\n>> @@ -81,6 +82,7 @@ union v4l2_ctrl_ptr {\n>>         struct v4l2_ctrl_hdr10_cll_info *p_hdr10_cll;\n>>         struct v4l2_ctrl_hdr10_mastering_display *p_hdr10_mastering;\n>>         struct v4l2_area *p_area;\n>> +       struct v4l2_ctrl_lens_status *p_lens_status;\n>>         void *p;\n>>         const void *p_const;\n>>  };\n>> diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h\n>> index 5e80daa4ffe0..8b037467ba9a 100644\n>> --- a/include/uapi/linux/v4l2-controls.h\n>> +++ b/include/uapi/linux/v4l2-controls.h\n>> @@ -993,6 +993,19 @@ enum v4l2_auto_focus_range {\n>>\n>>  #define V4L2_CID_HDR_SENSOR_MODE               (V4L2_CID_CAMERA_CLASS_BASE+36)\n>>\n>> +struct v4l2_ctrl_lens_status {\n>> +       __u32 flags;\n>> +       __s32 current_position;\n>> +};\n>> +\n>> +#define V4L2_LENS_STATUS_IDLE                  (0 << 0)\n>> +#define V4L2_LENS_STATUS_BUSY                  (1 << 0)\n>> +#define V4L2_LENS_STATUS_REACHED               (1 << 1)\n>> +#define V4L2_LENS_STATUS_FAILED                        (1 << 2)\n>> +\n>> +#define V4L2_CID_FOCUS_STATUS                  (V4L2_CID_CAMERA_CLASS_BASE + 37)\n>> +#define V4L2_CID_ZOOM_STATUS                   (V4L2_CID_CAMERA_CLASS_BASE + 38)\n>> +\n>>  /* FM Modulator class control IDs */\n>>\n>>  #define V4L2_CID_FM_TX_CLASS_BASE              (V4L2_CTRL_CLASS_FM_TX | 0x900)\n>> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h\n>> index 17a9b975177a..256c21c68720 100644\n>> --- a/include/uapi/linux/videodev2.h\n>> +++ b/include/uapi/linux/videodev2.h\n>> @@ -1888,6 +1888,8 @@ enum v4l2_ctrl_type {\n>>         V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS        = 0x0272,\n>>         V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX      = 0x0273,\n>>         V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS       = 0x0274,\n>> +\n>> +       V4L2_CTRL_TYPE_LENS_STATUS              = 0x0300,\n>>  };\n>>\n>>  /*  Used in the VIDIOC_QUERYCTRL ioctl for querying controls */\n>>\n>> --\n>> 2.30.2\n>>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 59005C0F2A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 11 Apr 2023 17:33:34 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CE144627B8;\n\tTue, 11 Apr 2023 19:33:33 +0200 (CEST)","from EUR04-DB3-obe.outbound.protection.outlook.com\n\t(mail-db3eur04on062b.outbound.protection.outlook.com\n\t[IPv6:2a01:111:f400:fe0c::62b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7FE4961EC1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 11 Apr 2023 19:33:31 +0200 (CEST)","from DU0PR08MB9155.eurprd08.prod.outlook.com (2603:10a6:10:416::5)\n\tby AS8PR08MB9930.eurprd08.prod.outlook.com (2603:10a6:20b:564::18)\n\twith Microsoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.36;\n\tTue, 11 Apr 2023 17:33:29 +0000","from DU0PR08MB9155.eurprd08.prod.outlook.com\n\t([fe80::77dd:14e4:a772:d85f]) by\n\tDU0PR08MB9155.eurprd08.prod.outlook.com\n\t([fe80::77dd:14e4:a772:d85f%4]) with mapi id 15.20.6277.038;\n\tTue, 11 Apr 2023 17:33:29 +0000"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1681234413;\n\tbh=DyGxMvU8Dob9iP5FTQ37Scq+gE3FJRydyYYMakWJb5w=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=oSoRawKgu3e4Ma3vYiTrXt2LK+b5DLDNM/6fbufbCGdmHkUBHRl6zurGfuTn14qvI\n\tRa9XZuRLQVPDoHX6Qo5+3oWEyrsXRCPqkjPrvHiMhY/+x9HEH00wL6dawUwyhgYRjB\n\t/oKqQIXq2uxUJD4pFqVsnRxG3w7ho8xHPG3iIZofpZ7dk8ykaXpBPQoJpzytZDc0N9\n\tt3bBXnjG98yg/8VprtONiv5cAY8qUKu9F1qwvgM62rEM51oA3tv2GwzPkazYJJzoO2\n\tPBE39qqyeUAtNe2NM6R0VWX6xNdKTtEGVNpWYGMkdvWOUIU5kCuu3bTnm3UQ1A250s\n\tEz6QqxuUHQg5A==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net;\n\ts=selector2;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n\tbh=ldvx1DI3OLHJpQDqNsi3uASe2B01bNf+ldlnXjrQOC4=;\n\tb=paeAhCNlsqZWyPx4PPnDyJYL3MP9l2L9FR7t+ae+yRCje5+OS/DMbz51Yx/HOn10ubGGY8YHjFHdgUDt8tOeIHuGHjc5lZstpXxRNumqBZIzSWHv+sXAraWzfp7TAbNDwonGSH1RulraCaffKpA7WPacV1is3C7WFirV2CBvlh8="],"Authentication-Results":["lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=wolfvision.net\n\theader.i=@wolfvision.net\n\theader.b=\"paeAhCNl\"; dkim-atps=neutral","dkim=none (message not signed)\n\theader.d=none;dmarc=none action=none header.from=wolfvision.net;"],"ARC-Seal":"i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;\n\tb=mcwGr1Oz5EO1i6laoi0BDO8lx90HyyDmKlXpw99+VxCH8zo8BQrK9GM6Evb4yFVp+/GUtJ+boR78Bi8YDxY7soMrqDv6cR8psPWgaxH0yf47SCo/CJ20n3KEVFkRSZr4tlNqRdEuZybvLUaXFonzy7+NkkGVZNDRvjvBCARJlxYjeDObJYzY7OQAN63Su71VBiobVFoUFpl3jqDGB9Suo4gBv9/uZU8Jtmivo+uI+HxYQqxFmLIpiJ5PcAi2rsKjhxm5u0cXHm2cTTilyyVE7Ke74KjcbuG6XWl5esifyUFur5UQ8u/8WlywuQiNsisxZ0uxX56r7u1h+1gaIuU8lA==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n\ts=arcselector9901;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;\n\tbh=ldvx1DI3OLHJpQDqNsi3uASe2B01bNf+ldlnXjrQOC4=;\n\tb=E93GyHzwPMFyf1lVkG0zrX9teqclYose2gYcDvJTlwz1ZfPMLsP2liMgwy2e+WOdRTl1LVAlJW2uGbe4Eb6Bo+KuU/jRMFM3Lx5jS2dg4ZhayVVp/lmkXon4oYcQTTLNXEquJjrFKkSUB5hNoutfmYO3u+dEjNeCWKk8Ktq83zZJxcZx/qyt48XjfwF/ZAomJgoTV7Rpqg7+bBs6xgBCoIPtZI/pBWqwIKCSnFVZzvxHzsuwVVQj2MbOB4xqtsC75d4UEhGz0lFdlrzJGfQ6B+6AbHdIiZ+CReUriuJT6TIiU2iulXs1XxMfLbYNZLgHRU/XleNBYNYDdQw/MH6nhw==","ARC-Authentication-Results":"i=1; mx.microsoft.com 1; spf=pass\n\tsmtp.mailfrom=wolfvision.net; dmarc=pass action=none\n\theader.from=wolfvision.net; dkim=pass header.d=wolfvision.net;\n\tarc=none","Message-ID":"<0f1baf5e-2ff6-e10b-5c3e-0a82c71d0ce6@wolfvision.net>","Date":"Tue, 11 Apr 2023 19:33:26 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101\n\tThunderbird/102.9.0","Content-Language":"en-US","To":"Dave Stevenson <dave.stevenson@raspberrypi.com>","References":"<20230406-feature-controls-lens-v1-0-543189a680de@wolfvision.net>\n\t<20230406-feature-controls-lens-v1-1-543189a680de@wolfvision.net>\n\t<CAPY8ntArOOqPQzvkJrQEyuVFfb6j8x6WODTMHOn1qHPU588mbQ@mail.gmail.com>","Organization":"WolfVision GmbH","In-Reply-To":"<CAPY8ntArOOqPQzvkJrQEyuVFfb6j8x6WODTMHOn1qHPU588mbQ@mail.gmail.com>","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"7bit","X-ClientProxiedBy":"VI1PR0302CA0018.eurprd03.prod.outlook.com\n\t(2603:10a6:800:e9::28) To DU0PR08MB9155.eurprd08.prod.outlook.com\n\t(2603:10a6:10:416::5)","MIME-Version":"1.0","X-MS-PublicTrafficType":"Email","X-MS-TrafficTypeDiagnostic":"DU0PR08MB9155:EE_|AS8PR08MB9930:EE_","X-MS-Office365-Filtering-Correlation-Id":"055c5067-1127-46d7-d2ed-08db3ab2dd38","X-MS-Exchange-SenderADCheck":"1","X-MS-Exchange-AntiSpam-Relay":"0","X-Microsoft-Antispam":"BCL:0;","X-Microsoft-Antispam-Message-Info":"7vVxJq7TO6yfHAgSj8ueUaEPffz6G8P3ETdZvlRCrrOYjVv5J4LLG1qSH+fcNl1GIQYi6QKkv53ixuYKftPFv8nRnIEgw2ZKtJR14JSz7etbxS6GzRn/EI+eKuSW4cCQca7TFA5HfYnGeJE/yJYNfbqph3WyuN3wxr9HD3PsdTJ8l73l9v0C9ZAExAC2EH2ZWtPs80TQDHlg7b4NDt+p5YaWEzlpVAXrgmWbtgNd2JtmP7QepOmDhp05ExqaCZu8TC58jrVjEqQnBX1OijvzvDkOA4GI0n9ZkBs/zoHxhjP9Fiur1ad7zYJtQEjzXlPv7ogsaAUN6iUKZHwrF0Suaypta8lIQBw1kklKQm05uSRBfIj3Dgcf0vBCn7sGymowKbm5p8C0hTAu0tjRyRtherZRoXEkTQ35OtWE64bzy7YpZBxuepHvy/Y+ZTTb/o1DrqazEOhANt74luojLhmXOgTyCUVgL+6Yhc92MK+yuIURnrTEPUUxJy4a+0TDTgSdEahcuqWrbjcAJ/2JWB/uMEahOnBIHEUkT2eP/YjyvCHKfORN7upLsUKBdCUWPiesGZ+d/9ILyLx0ZbwpT+bxgovt4tUQ17zFMcUfQe48N/n8/RdI9U179EB7DzCVqs0OYbXdtWJoN7oNwBDTj1vEDQ==","X-Forefront-Antispam-Report":"CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;\n\tIPV:NLI; SFV:NSPM; H:DU0PR08MB9155.eurprd08.prod.outlook.com; PTR:;\n\tCAT:NONE; \n\tSFS:(13230028)(4636009)(346002)(136003)(39850400004)(396003)(366004)(376002)(451199021)(478600001)(36916002)(53546011)(26005)(316002)(6506007)(186003)(44832011)(54906003)(2906002)(966005)(30864003)(5660300002)(4326008)(66946007)(8676002)(6666004)(6916009)(66476007)(6486002)(41300700001)(8936002)(66556008)(31696002)(83380400001)(86362001)(36756003)(6512007)(2616005)(38100700002)(31686004)(45980500001)(43740500002);\n\tDIR:OUT; SFP:1101; ","X-MS-Exchange-AntiSpam-MessageData-ChunkCount":"1","X-MS-Exchange-AntiSpam-MessageData-0":"=?utf-8?q?Wvy0DuhX7BeBEOZJLC5j3mvus?=\n\t=?utf-8?q?UBigiUM2zEzkE7zvtCqcSPPOBv79JDTU1+dMp5W3aXv0pq2OKHKkBEpG?=\n\t=?utf-8?q?7ZF8vmCZjJykFjLQqTV/NRzNgzFxJ/YEi6+yqse9QalLG6S3gFnGdsrK?=\n\t=?utf-8?q?/aA5VCWNkTgjGZ1LqcnOXQ5003l3HyT3Q4LUxxXp72MrBXfcVif/EboD?=\n\t=?utf-8?q?4YxOXjpVHpWu01YyFmWXg+KpJtPM64uB3+q87oZ10P6q9Cq/mVOFdXFx?=\n\t=?utf-8?q?Dx0xTBirisBEKQCZ3pNw8tCpv8nf+qNdgPCFrJe/iqy7TitEsEN8VPjL?=\n\t=?utf-8?q?C6GuyVc8XM5S+TeOFtPEnOeuig1r3+04kS9Z7YzA5CPAfC4vZGA9Xruu?=\n\t=?utf-8?q?cE6JIhNVqotjY6ieipvDjp5VxBYc7BKLfjMi/YvFShnqdXQ88dLfnltL?=\n\t=?utf-8?q?7y8HW1WLQdWhYII6qSUpE0jyc2MkZlHTJUjPfCi5lO6+l4K1J/VKg7VW?=\n\t=?utf-8?q?f+mpkxAKHQW6v4NHKH59Wquii0PaZ4wVMX+w9y9emaaQVff1l1cOuGnQ?=\n\t=?utf-8?q?lPZ2r5GAN0CLJzyGRdHBEIIN7D9vNT11rbZHQCTuKiTFoKpb5Y1iZa98?=\n\t=?utf-8?q?QeXbBJtW9Ac+O93iUR/CRT35ZsZPuEeaxSbG4SGDsYgPKovizPKZCm8l?=\n\t=?utf-8?q?0SI3xpCpV/W6WBXthoePZx0ol6NppF9oyZ8oiDo6t6cfNCOwi1lZalGZ?=\n\t=?utf-8?q?fEmPeMkRWT2uhLzDeIbBJTBq7sqBvaGZr73eMrFV/HWtZ2WgQO8QBaWk?=\n\t=?utf-8?q?3UcikkAyd6zSiEstU07EbouTAOpvlrnpxMH3yuP/rmZcOc/1ymSgwAzG?=\n\t=?utf-8?q?qKHf6yQTMNpRwkWElt/d9M3z7IW7bbBrn+V/dX7a2B9/ApOW0Gn41waJ?=\n\t=?utf-8?q?cYPKXcZ3qjbRK9Xg1xNTJLZ0T9MDdXBDfK0VX71LFU/t3CNzLNfYYxli?=\n\t=?utf-8?q?LrMSJ9lnmT5vgnLUFchXcGzev9esynfFxUuP4uoEP0NDdAevNpzyxDy4?=\n\t=?utf-8?q?edUwdtj1i7J8BLveETbdqdeWfBpUv12L2ilmMZIvjH0zKNFUh3dWy8R7?=\n\t=?utf-8?q?apb4hvZuBzlKl2XgQcgIiZRDoslLBP31qfUKL+USv9ElGAChHUffzDZ2?=\n\t=?utf-8?q?sr6OeBVHVPZbgpt46/thR3kiiIpRZL22NLUnGBV6wdz5N72huD8A577U?=\n\t=?utf-8?q?oQV4VsnIJkC0aRaZFCzNq2ox5rcf8vEBXRglBmOBVtdznqjVoDQwkemh?=\n\t=?utf-8?q?zWcRUG0UFLhtHpMoe06oaqjbtdwzQKT4EG0JoaL0eeQKbgDvvx9Bxac2?=\n\t=?utf-8?q?mMgsdwilqCsYqY2+wyL/dbad6uBJRWXXhUAChnKwEHzPNOzLXvVfEaQ5?=\n\t=?utf-8?q?PwcH4pCgfyZluqM5OlT8JrU6f34VZ9BrT9g6SeyoBtAqhxj263nTfozN?=\n\t=?utf-8?q?VYuLPX5IUYBEeZUABYnvX7kkCI8xQu2fZINBQ3UEbZdISCQ07ED+Tdy+?=\n\t=?utf-8?q?Sk4g5HpKQjq/j+b29rZOog9pAvetwEFJIlpMKhw8X4zQEDCP8X2ffJmV?=\n\t=?utf-8?q?zT6ONFP9aM3cipFL/vFkJ1bBRzLEAVSuJoKhNjQcnfGyWUIzB++O8DJg?=\n\t=?utf-8?q?WLQysXNDSBhokLDku18PEfWYDLCpmBklakO2PtYETmOHBv5rVXwn9UGt?=\n\t=?utf-8?q?kJCY4STKyql/scXRiPenkLjqPN1/w=3D=3D?=","X-OriginatorOrg":"wolfvision.net","X-MS-Exchange-CrossTenant-Network-Message-Id":"055c5067-1127-46d7-d2ed-08db3ab2dd38","X-MS-Exchange-CrossTenant-AuthSource":"DU0PR08MB9155.eurprd08.prod.outlook.com","X-MS-Exchange-CrossTenant-AuthAs":"Internal","X-MS-Exchange-CrossTenant-OriginalArrivalTime":"11 Apr 2023 17:33:29.4456\n\t(UTC)","X-MS-Exchange-CrossTenant-FromEntityHeader":"Hosted","X-MS-Exchange-CrossTenant-Id":"e94ec9da-9183-471e-83b3-51baa8eb804f","X-MS-Exchange-CrossTenant-MailboxType":"HOSTED","X-MS-Exchange-CrossTenant-UserPrincipalName":"aHOj2RyJ7u2J23q8WznPN9m/d4EF2t+PRNJUDCm2mYJAhMJjIxamVulgQCWMW6p8jBeKkyJ9GxHjycwgYzdjxIjxlVpUU1OuR4pXP7d48LA=","X-MS-Exchange-Transport-CrossTenantHeadersStamped":"AS8PR08MB9930","Subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Michael Riesch via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Michael Riesch <michael.riesch@wolfvision.net>","Cc":"linux-kernel@vger.kernel.org,\n\tMatthias Fend <Matthias.Fend@wolfvision.net>, \n\tlibcamera-devel@lists.libcamera.org,\n\tSakari Ailus <sakari.ailus@linux.intel.com>,\n\tMauro Carvalho Chehab <mchehab@kernel.org>, Michael Riesch via B4 Relay\n\t<devnull+michael.riesch.wolfvision.net@kernel.org>, \n\tlinux-media@vger.kernel.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26866,"web_url":"https://patchwork.libcamera.org/comment/26866/","msgid":"<CAPY8ntAjBEFfeV6nnQs34Y22QM-irT13ALDv4ksP8AYK=jWsKg@mail.gmail.com>","date":"2023-04-11T18:15:37","subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","submitter":{"id":27,"url":"https://patchwork.libcamera.org/api/people/27/","name":"Dave Stevenson","email":"dave.stevenson@raspberrypi.com"},"content":"Hi Michael\n\nOn Tue, 11 Apr 2023 at 18:33, Michael Riesch\n<michael.riesch@wolfvision.net> wrote:\n>\n> Hi Dave,\n>\n> On 4/6/23 17:16, Dave Stevenson wrote:\n> > Hi Michael\n> >\n> > Thanks for the patch.\n> >\n> > I've got a personal interest here as I'd love to be able to control a\n> > couple of CCTV lenses that I have. Those have standard motors with\n> > potentiometers for position feedback, not stepper motors, but\n> > otherwise have the same limitations of slow movement.\n>\n> That's great to hear :-) Thank you for your feedback!\n>\n> > On Thu, 6 Apr 2023 at 15:31, Michael Riesch via B4 Relay via\n> > libcamera-devel <libcamera-devel@lists.libcamera.org> wrote:\n> >>\n> >> From: Michael Riesch <michael.riesch@wolfvision.net>\n> >>\n> >> Add the controls V4L2_CID_FOCUS_STATUS and V4L2_CID_ZOOM_STATUS that report\n> >> the status of the zoom lens group and the focus lens group, respectively.\n> >> The returned data structure contains the current position of the lens group\n> >> as well as movement indication flags.\n> >>\n> >> Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>\n> >> ---\n> >>  .../userspace-api/media/v4l/ext-ctrls-camera.rst   | 48 ++++++++++++++++++++++\n> >>  drivers/media/v4l2-core/v4l2-ctrls-core.c          |  9 ++++\n> >>  drivers/media/v4l2-core/v4l2-ctrls-defs.c          |  7 ++++\n> >>  include/media/v4l2-ctrls.h                         |  2 +\n> >>  include/uapi/linux/v4l2-controls.h                 | 13 ++++++\n> >>  include/uapi/linux/videodev2.h                     |  2 +\n> >>  6 files changed, 81 insertions(+)\n> >>\n> >> diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst\n> >> index daa4f40869f8..3a270bc63f1a 100644\n> >> --- a/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst\n> >> +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst\n> >> @@ -149,6 +149,30 @@ enum v4l2_exposure_metering -\n> >>      to the camera, negative values towards infinity. This is a\n> >>      write-only control.\n> >>\n> >> +``V4L2_CID_FOCUS_STATUS (struct)``\n> >> +    The current status of the focus lens group. This is a read-only control.\n> >> +    The returned data structure contains the current position and movement\n> >> +    indication flags. The unit of the current position is undefined. Positive\n> >> +    values move the focus closer to the camera, negative values towards\n> >> +    infinity. The possible flags are described in the table below.\n> >\n> > The units are undefined, but positive and negative mean something with\n> > respect to some unspecified focal distance represented by 0. That\n> > seems a little odd.\n> >\n> > I was going to suggest that it seems to make sense to follow the same\n> > units as V4L2_CID_FOCUS_ABSOLUTE, but on reading that description in\n> > [1] it's the same text.\n> > I suspect there was a little too much copy/paste from\n> > V4L2_CID_FOCUS_RELATIVE, or the intent was that increasing the value\n> > brings the focus closer, and decreasing moves it towards infinity.\n> >\n> > If we did specify that it was the same units as\n> > V4L2_CID_FOCUS_ABSOLUTE, then what would that mean for use with\n> > V4L2_CID_FOCUS_RELATIVE? Then again the only user of _RELATIVE appears\n> > to be ov5693 with atomisp and that just maps it onto _ABSOLUTE, so\n> > potentially it's redundant and could be deprecated.\n> >\n> > [1] https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/ext-ctrls-camera.html\n>\n> I think we agree that the _STATUS controls should use the same unit as\n> the corresponding _ABSOLUTE control, whatever that may be.\n>\n> Then, the question is whether the description of FOCUS_ABSOLUTE needs to\n> be revised. I would agree that the intention probably was: \"Larger\n> values move the focus closer to the camera, smaller values move the\n> focus to infinity.\" (cf. the phrasing in the description of IRIS_ABSOLUTE).\n>\n> It would be interesting to know whether zero and negative values are\n> (intentionally?) included. Since they are not explicitly excluded, my\n> driver exposes the position of the lens in motor steps to the user\n> space. If the values were (supposed to be) restricted to positive values\n> like ZOOM_ABSOLUTE, this would not be allowed of course.\n>\n> As to the relation to _RELATIVE, I think it should be clear that all\n> controls should act on the same scale and I don't see any problems here.\n> However, feel free to point out what I am missing :-)\n>\n> >> +\n> >> +.. tabularcolumns:: |p{6.8cm}|p{10.7cm}|\n> >> +\n> >> +.. flat-table::\n> >> +    :header-rows:  0\n> >> +    :stub-columns: 0\n> >> +\n> >> +    * - ``V4L2_LENS_STATUS_IDLE``\n> >> +      - Focus lens group is at rest.\n> >> +    * - ``V4L2_LENS_STATUS_BUSY``\n> >> +      - Focus lens group is moving.\n> >> +    * - ``V4L2_LENS_STATUS_REACHED``\n> >> +      - Focus lens group has reached its target position.\n> >> +    * - ``V4L2_LENS_STATUS_FAILED``\n> >> +      - Focus lens group has failed to reach its target position. The driver\n> >> +       will not transition from this state until another action is performed\n> >> +       by an application.\n> >\n> > When would the lens state transition from V4L2_LENS_STATUS_REACHED to\n> > V4L2_LENS_STATUS_IDLE?\n> > If it's reached the position then it is at rest, and being at rest is\n> > the definition of V4L2_LENS_STATUS_IDLE.\n> > Likewise the lens always has a target position based on the control\n> > value, so it's always at V4L2_LENS_STATUS_REACHED when it's not\n> > moving.\n> > Is there a need to have 2 states?\n>\n> Good point, I need to reconsider that (and possibly remove one of those\n> states).\n>\n> > If the position is the same units as V4L2_CID_FOCUS_ABSOLUTE, then do\n> > you leave the determination of state to the application?\n>\n> I am afraid I don't quite follow.\n\nIf the application sets V4L2_CID_FOCUS_ABSOLUTE to 42, and\nV4L2_CID_FOCUS_STATUS returns that the position is now 42, then the\napplication knows that the lens has reached the requested position. If\nthe two controls return different values then the lens is still\nmoving.\nWhat new information does adding an additional status flag give you?\n\n(Thinking aloud) I guess you have got my case where your readback is\nvia an ADC so that the position may fluctuate slightly due to\nconversion noise. The control loop for applying power to the motors\nwill presumably stop at some point and stop trying to adjust the\nposition, so potentially it could be the state returned from that\ncontrol loop. However the noisy ADC position could also be solved by\nthe position being returned by the control loop instead of giving the\nraw value.\n\n> But FWIW the application should read out the flags to find out whether\n> the lens is moving and, if this is not the case, whether the last move\n> command (FOCUS_ABSOLUTE or FOCUS_RELATIVE) has succeeded or failed. The\n> failed state is important as there might be the possibility that\n> depending on the zoom lens position certain focus positions are not\n> available (and vice versa).\n\nHow would you configure those kinds of restrictions in the kernel\ndriver? Is the kernel driver the best place to do it (so many things\nare being kicked back to userspace these days)?\nIf it is to be done in the kernel, then shouldn't eg changing the zoom\nposition alter the ranges advertised for the relevant focus controls?\nIf the ranges aren't updated, where should that out-of-range lens\nmovement leave the lens?\n\n  Dave\n\n> >>  ``V4L2_CID_FOCUS_AUTO (boolean)``\n> >>      Enables continuous automatic focus adjustments. The effect of manual\n> >>      focus adjustments while this feature is enabled is undefined,\n> >> @@ -239,6 +263,30 @@ enum v4l2_auto_focus_range -\n> >>      movement. A negative value moves the zoom lens group towards the\n> >>      wide-angle direction. The zoom speed unit is driver-specific.\n> >>\n> >> +``V4L2_CID_ZOOM_STATUS (struct)``\n> >> +    The current status of the zoom lens group. This is a read-only control.\n> >> +    The returned data structure contains the current position and movement\n> >> +    indication flags. The unit of the current position is driver-specific and\n> >> +    its value should be a positive integer. The possible flags are described\n> >> +    in the table below.\n> >> +\n> >> +.. tabularcolumns:: |p{6.8cm}|p{10.7cm}|\n> >> +\n> >> +.. flat-table::\n> >> +    :header-rows:  0\n> >> +    :stub-columns: 0\n> >> +\n> >> +    * - ``V4L2_LENS_STATUS_IDLE``\n> >> +      - Zoom lens group is at rest.\n> >> +    * - ``V4L2_LENS_STATUS_BUSY``\n> >> +      - Zoom lens group is moving.\n> >> +    * - ``V4L2_LENS_STATUS_REACHED``\n> >> +      - Zoom lens group has reached its target position.\n> >> +    * - ``V4L2_LENS_STATUS_FAILED``\n> >> +      - Zoom lens group has failed to reach its target position. The driver will\n> >> +       not transition from this state until another action is performed by an\n> >> +       application.\n> >> +\n> >>  ``V4L2_CID_IRIS_ABSOLUTE (integer)``\n> >>      This control sets the camera's aperture to the specified value. The\n> >>      unit is undefined. Larger values open the iris wider, smaller values\n> >> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-core.c b/drivers/media/v4l2-core/v4l2-ctrls-core.c\n> >> index 29169170880a..f6ad30f311c5 100644\n> >> --- a/drivers/media/v4l2-core/v4l2-ctrls-core.c\n> >> +++ b/drivers/media/v4l2-core/v4l2-ctrls-core.c\n> >> @@ -350,6 +350,9 @@ void v4l2_ctrl_type_op_log(const struct v4l2_ctrl *ctrl)\n> >>         case V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS:\n> >>                 pr_cont(\"HEVC_DECODE_PARAMS\");\n> >>                 break;\n> >> +       case V4L2_CTRL_TYPE_LENS_STATUS:\n> >> +               pr_cont(\"LENS_STATUS\");\n> >> +               break;\n> >>         default:\n> >>                 pr_cont(\"unknown type %d\", ctrl->type);\n> >>                 break;\n> >> @@ -918,6 +921,9 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx,\n> >>                         return -EINVAL;\n> >>                 break;\n> >>\n> >> +       case V4L2_CTRL_TYPE_LENS_STATUS:\n> >> +               break;\n> >> +\n> >>         default:\n> >>                 return -EINVAL;\n> >>         }\n> >> @@ -1605,6 +1611,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl,\n> >>         case V4L2_CTRL_TYPE_AREA:\n> >>                 elem_size = sizeof(struct v4l2_area);\n> >>                 break;\n> >> +       case V4L2_CTRL_TYPE_LENS_STATUS:\n> >> +               elem_size = sizeof(struct v4l2_ctrl_lens_status);\n> >> +               break;\n> >>         default:\n> >>                 if (type < V4L2_CTRL_COMPOUND_TYPES)\n> >>                         elem_size = sizeof(s32);\n> >> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c\n> >> index 564fedee2c88..9b26a3aa9e9c 100644\n> >> --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c\n> >> +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c\n> >> @@ -1044,6 +1044,8 @@ const char *v4l2_ctrl_get_name(u32 id)\n> >>         case V4L2_CID_CAMERA_ORIENTATION:       return \"Camera Orientation\";\n> >>         case V4L2_CID_CAMERA_SENSOR_ROTATION:   return \"Camera Sensor Rotation\";\n> >>         case V4L2_CID_HDR_SENSOR_MODE:          return \"HDR Sensor Mode\";\n> >> +       case V4L2_CID_FOCUS_STATUS:             return \"Focus, Status\";\n> >> +       case V4L2_CID_ZOOM_STATUS:              return \"Zoom, Status\";\n> >\n> > Is there a need for the comma in the text strings?\n>\n> Not sure, actually. Some other strings used commas. Monkey see, monkey do.\n>\n> Best regards,\n> Michael\n>\n> >\n> > Cheers\n> >   Dave\n> >\n> >>\n> >>         /* FM Radio Modulator controls */\n> >>         /* Keep the order of the 'case's the same as in v4l2-controls.h! */\n> >> @@ -1593,6 +1595,11 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,\n> >>                 *flags |= V4L2_CTRL_FLAG_WRITE_ONLY |\n> >>                           V4L2_CTRL_FLAG_EXECUTE_ON_WRITE;\n> >>                 break;\n> >> +       case V4L2_CID_FOCUS_STATUS:\n> >> +       case V4L2_CID_ZOOM_STATUS:\n> >> +               *type = V4L2_CTRL_TYPE_LENS_STATUS;\n> >> +               *flags |= V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_VOLATILE;\n> >> +               break;\n> >>         case V4L2_CID_FLASH_STROBE_STATUS:\n> >>         case V4L2_CID_AUTO_FOCUS_STATUS:\n> >>         case V4L2_CID_FLASH_READY:\n> >> diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h\n> >> index e59d9a234631..f7273ffc20c9 100644\n> >> --- a/include/media/v4l2-ctrls.h\n> >> +++ b/include/media/v4l2-ctrls.h\n> >> @@ -52,6 +52,7 @@ struct video_device;\n> >>   * @p_hdr10_cll:               Pointer to an HDR10 Content Light Level structure.\n> >>   * @p_hdr10_mastering:         Pointer to an HDR10 Mastering Display structure.\n> >>   * @p_area:                    Pointer to an area.\n> >> + * @p_lens_status:             Pointer to a lens status structure.\n> >>   * @p:                         Pointer to a compound value.\n> >>   * @p_const:                   Pointer to a constant compound value.\n> >>   */\n> >> @@ -81,6 +82,7 @@ union v4l2_ctrl_ptr {\n> >>         struct v4l2_ctrl_hdr10_cll_info *p_hdr10_cll;\n> >>         struct v4l2_ctrl_hdr10_mastering_display *p_hdr10_mastering;\n> >>         struct v4l2_area *p_area;\n> >> +       struct v4l2_ctrl_lens_status *p_lens_status;\n> >>         void *p;\n> >>         const void *p_const;\n> >>  };\n> >> diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h\n> >> index 5e80daa4ffe0..8b037467ba9a 100644\n> >> --- a/include/uapi/linux/v4l2-controls.h\n> >> +++ b/include/uapi/linux/v4l2-controls.h\n> >> @@ -993,6 +993,19 @@ enum v4l2_auto_focus_range {\n> >>\n> >>  #define V4L2_CID_HDR_SENSOR_MODE               (V4L2_CID_CAMERA_CLASS_BASE+36)\n> >>\n> >> +struct v4l2_ctrl_lens_status {\n> >> +       __u32 flags;\n> >> +       __s32 current_position;\n> >> +};\n> >> +\n> >> +#define V4L2_LENS_STATUS_IDLE                  (0 << 0)\n> >> +#define V4L2_LENS_STATUS_BUSY                  (1 << 0)\n> >> +#define V4L2_LENS_STATUS_REACHED               (1 << 1)\n> >> +#define V4L2_LENS_STATUS_FAILED                        (1 << 2)\n> >> +\n> >> +#define V4L2_CID_FOCUS_STATUS                  (V4L2_CID_CAMERA_CLASS_BASE + 37)\n> >> +#define V4L2_CID_ZOOM_STATUS                   (V4L2_CID_CAMERA_CLASS_BASE + 38)\n> >> +\n> >>  /* FM Modulator class control IDs */\n> >>\n> >>  #define V4L2_CID_FM_TX_CLASS_BASE              (V4L2_CTRL_CLASS_FM_TX | 0x900)\n> >> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h\n> >> index 17a9b975177a..256c21c68720 100644\n> >> --- a/include/uapi/linux/videodev2.h\n> >> +++ b/include/uapi/linux/videodev2.h\n> >> @@ -1888,6 +1888,8 @@ enum v4l2_ctrl_type {\n> >>         V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS        = 0x0272,\n> >>         V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX      = 0x0273,\n> >>         V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS       = 0x0274,\n> >> +\n> >> +       V4L2_CTRL_TYPE_LENS_STATUS              = 0x0300,\n> >>  };\n> >>\n> >>  /*  Used in the VIDIOC_QUERYCTRL ioctl for querying controls */\n> >>\n> >> --\n> >> 2.30.2\n> >>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 0BBC4BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 11 Apr 2023 18:15:57 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6BBF5627B8;\n\tTue, 11 Apr 2023 20:15:56 +0200 (CEST)","from mail-vs1-xe2f.google.com (mail-vs1-xe2f.google.com\n\t[IPv6:2607:f8b0:4864:20::e2f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C607161EC1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 11 Apr 2023 20:15:54 +0200 (CEST)","by mail-vs1-xe2f.google.com with SMTP id z13so8347309vss.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 11 Apr 2023 11:15:54 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1681236956;\n\tbh=UeGhomhECH/pNa39bXRL/L5KOaYRUpHGE3hYFK1xcKs=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=JI1m0qt9KtJJOI3A9Pz+NgVrEHxY/LrKoDLE/tMuKCEOJUaXmW10uqV8MALctEqSG\n\txlDCG4yF8h3VRFlQz/BL/CcWXzrfDAgTIQmXKNP3tWNCsNtamXa5fkpbpFjg/g/kWt\n\tRTNY2s9X5oFZHlYsUp1wIN4jQsp8uX2KRNgbJfaZE96atv5EjkjDIvpe382JdUyuGy\n\t5dHND0QO6dsy6/FeLfeP3NwZV0o9cjezQeRqN8qGnfwIfkdAMFbE+Hv9wfukHFpV1P\n\tDCpqAd09alZDUJjHCxCav8K6Qd/0N+Wfc5ByLKsNNXMAZ/GBWd1Gyd6X1G1b1QY1sx\n\tWmCvpg0J3Aw7A==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1681236953;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date:message-id:reply-to;\n\tbh=Q4S0xEvdunaSL+zbPuHJ5s3VFMKCKqJuiCI0S2OKaZQ=;\n\tb=UqGNkOJYNaelzGuQIlv0PKOFymJDD1+EaLAj9dZk28ZbmoJI+chXaQjStdXmChjrHG\n\trTNJ4xExqR5SZTnqg6FKlEh2rhllsJNsbrX8XKCr2Pe/gQlkIc5sWErriUfEqhdpMHMj\n\tRadFlz2zYGU2zQQEeu9ZAmQCy01vtm/UfzcU6kqlMdRaFxvIO/5v2pJ29UyitdWHm5sY\n\tXcjrVFGv+Q3HhCLt0xM91jyuKoYcTAWsmN/juLA6s05mSvmsQaOouOqO5YfAlzYvqbda\n\tXUMslwuq9A5d3+JdRCi3AoqdF5qSjc8Tjnbmhny9bpOU6sUPBkInBDJNGBqtwx85bLHL\n\tQtVQ=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"UqGNkOJY\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112; t=1681236953;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=Q4S0xEvdunaSL+zbPuHJ5s3VFMKCKqJuiCI0S2OKaZQ=;\n\tb=Gm6hRXg8qtWHy95qXClFMhZ5QflQEVrArfHgfLZvzfL4lUkW/8Y3mZgdozwhiu8NBK\n\tW+M63RmybSxuviQJ6IEsbO5wdca60xPgA4VIDkD0YDqXgrnc7h4SBOxLduhsg4o8D+ag\n\ttsyYoojwxOL1lP/3crCmRZGFvD8rKxuS23n8/nfxFDqqJSkzsVsoKU7LRBz8vwNP9Qou\n\tb8xPxiLMgz4L+yM+QDXbcFq2L0cC8YDR+I0/o5J5qdWVDP/M0rMY7tnu4fNuTlvFjz+0\n\t6XUOo981LjUTUN3ZtGCPQmBdBUkxuEKmijZQP9FuYnq7l28LMlZOCRFQwaVQYGlzGVFY\n\tsh6w==","X-Gm-Message-State":"AAQBX9dHZnyIJm1yXYgyJno84gmtI9JLnqlLWVuupiWHzMiYSbIZ/Ver\n\tuY3WIEaAZq7HtoEVLYcpoVd+3fWixY905rl+aKnShg==","X-Google-Smtp-Source":"AKy350YNBQvST6HxVAb5F4t2LRcDW1VfpL6yfV+1u51w69zx3nOIujTSOtNcVdPDw5YP5EMOaDdFd+ZjNw35GyrADkw=","X-Received":"by 2002:a67:d589:0:b0:42c:47fa:5b86 with SMTP id\n\tm9-20020a67d589000000b0042c47fa5b86mr6738867vsj.1.1681236953446;\n\tTue, 11 Apr 2023 11:15:53 -0700 (PDT)","MIME-Version":"1.0","References":"<20230406-feature-controls-lens-v1-0-543189a680de@wolfvision.net>\n\t<20230406-feature-controls-lens-v1-1-543189a680de@wolfvision.net>\n\t<CAPY8ntArOOqPQzvkJrQEyuVFfb6j8x6WODTMHOn1qHPU588mbQ@mail.gmail.com>\n\t<0f1baf5e-2ff6-e10b-5c3e-0a82c71d0ce6@wolfvision.net>","In-Reply-To":"<0f1baf5e-2ff6-e10b-5c3e-0a82c71d0ce6@wolfvision.net>","Date":"Tue, 11 Apr 2023 19:15:37 +0100","Message-ID":"<CAPY8ntAjBEFfeV6nnQs34Y22QM-irT13ALDv4ksP8AYK=jWsKg@mail.gmail.com>","To":"Michael Riesch <michael.riesch@wolfvision.net>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Dave Stevenson via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Dave Stevenson <dave.stevenson@raspberrypi.com>","Cc":"linux-kernel@vger.kernel.org,\n\tMatthias Fend <Matthias.Fend@wolfvision.net>, \n\tlibcamera-devel@lists.libcamera.org,\n\tSakari Ailus <sakari.ailus@linux.intel.com>,\n\tMauro Carvalho Chehab <mchehab@kernel.org>, Michael Riesch via B4 Relay\n\t<devnull+michael.riesch.wolfvision.net@kernel.org>, \n\tlinux-media@vger.kernel.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26867,"web_url":"https://patchwork.libcamera.org/comment/26867/","msgid":"<3ab7bfc4-aaae-2e39-b420-40ad8d71dda4@wolfvision.net>","date":"2023-04-12T08:00:26","subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","submitter":{"id":135,"url":"https://patchwork.libcamera.org/api/people/135/","name":"Michael Riesch","email":"michael.riesch@wolfvision.net"},"content":"Hi Dave,\n\nOn 4/11/23 20:15, Dave Stevenson wrote:\n> Hi Michael\n> \n> On Tue, 11 Apr 2023 at 18:33, Michael Riesch\n> <michael.riesch@wolfvision.net> wrote:\n>>\n>> Hi Dave,\n>>\n>> On 4/6/23 17:16, Dave Stevenson wrote:\n>>> Hi Michael\n>>>\n>>> Thanks for the patch.\n>>>\n>>> I've got a personal interest here as I'd love to be able to control a\n>>> couple of CCTV lenses that I have. Those have standard motors with\n>>> potentiometers for position feedback, not stepper motors, but\n>>> otherwise have the same limitations of slow movement.\n>>\n>> That's great to hear :-) Thank you for your feedback!\n>>\n>>> On Thu, 6 Apr 2023 at 15:31, Michael Riesch via B4 Relay via\n>>> libcamera-devel <libcamera-devel@lists.libcamera.org> wrote:\n>>>>\n>>>> From: Michael Riesch <michael.riesch@wolfvision.net>\n>>>>\n>>>> Add the controls V4L2_CID_FOCUS_STATUS and V4L2_CID_ZOOM_STATUS that report\n>>>> the status of the zoom lens group and the focus lens group, respectively.\n>>>> The returned data structure contains the current position of the lens group\n>>>> as well as movement indication flags.\n>>>>\n>>>> Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>\n>>>> ---\n>>>>  .../userspace-api/media/v4l/ext-ctrls-camera.rst   | 48 ++++++++++++++++++++++\n>>>>  drivers/media/v4l2-core/v4l2-ctrls-core.c          |  9 ++++\n>>>>  drivers/media/v4l2-core/v4l2-ctrls-defs.c          |  7 ++++\n>>>>  include/media/v4l2-ctrls.h                         |  2 +\n>>>>  include/uapi/linux/v4l2-controls.h                 | 13 ++++++\n>>>>  include/uapi/linux/videodev2.h                     |  2 +\n>>>>  6 files changed, 81 insertions(+)\n>>>>\n>>>> diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst\n>>>> index daa4f40869f8..3a270bc63f1a 100644\n>>>> --- a/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst\n>>>> +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst\n>>>> @@ -149,6 +149,30 @@ enum v4l2_exposure_metering -\n>>>>      to the camera, negative values towards infinity. This is a\n>>>>      write-only control.\n>>>>\n>>>> +``V4L2_CID_FOCUS_STATUS (struct)``\n>>>> +    The current status of the focus lens group. This is a read-only control.\n>>>> +    The returned data structure contains the current position and movement\n>>>> +    indication flags. The unit of the current position is undefined. Positive\n>>>> +    values move the focus closer to the camera, negative values towards\n>>>> +    infinity. The possible flags are described in the table below.\n>>>\n>>> The units are undefined, but positive and negative mean something with\n>>> respect to some unspecified focal distance represented by 0. That\n>>> seems a little odd.\n>>>\n>>> I was going to suggest that it seems to make sense to follow the same\n>>> units as V4L2_CID_FOCUS_ABSOLUTE, but on reading that description in\n>>> [1] it's the same text.\n>>> I suspect there was a little too much copy/paste from\n>>> V4L2_CID_FOCUS_RELATIVE, or the intent was that increasing the value\n>>> brings the focus closer, and decreasing moves it towards infinity.\n>>>\n>>> If we did specify that it was the same units as\n>>> V4L2_CID_FOCUS_ABSOLUTE, then what would that mean for use with\n>>> V4L2_CID_FOCUS_RELATIVE? Then again the only user of _RELATIVE appears\n>>> to be ov5693 with atomisp and that just maps it onto _ABSOLUTE, so\n>>> potentially it's redundant and could be deprecated.\n>>>\n>>> [1] https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/ext-ctrls-camera.html\n>>\n>> I think we agree that the _STATUS controls should use the same unit as\n>> the corresponding _ABSOLUTE control, whatever that may be.\n>>\n>> Then, the question is whether the description of FOCUS_ABSOLUTE needs to\n>> be revised. I would agree that the intention probably was: \"Larger\n>> values move the focus closer to the camera, smaller values move the\n>> focus to infinity.\" (cf. the phrasing in the description of IRIS_ABSOLUTE).\n>>\n>> It would be interesting to know whether zero and negative values are\n>> (intentionally?) included. Since they are not explicitly excluded, my\n>> driver exposes the position of the lens in motor steps to the user\n>> space. If the values were (supposed to be) restricted to positive values\n>> like ZOOM_ABSOLUTE, this would not be allowed of course.\n>>\n>> As to the relation to _RELATIVE, I think it should be clear that all\n>> controls should act on the same scale and I don't see any problems here.\n>> However, feel free to point out what I am missing :-)\n>>\n>>>> +\n>>>> +.. tabularcolumns:: |p{6.8cm}|p{10.7cm}|\n>>>> +\n>>>> +.. flat-table::\n>>>> +    :header-rows:  0\n>>>> +    :stub-columns: 0\n>>>> +\n>>>> +    * - ``V4L2_LENS_STATUS_IDLE``\n>>>> +      - Focus lens group is at rest.\n>>>> +    * - ``V4L2_LENS_STATUS_BUSY``\n>>>> +      - Focus lens group is moving.\n>>>> +    * - ``V4L2_LENS_STATUS_REACHED``\n>>>> +      - Focus lens group has reached its target position.\n>>>> +    * - ``V4L2_LENS_STATUS_FAILED``\n>>>> +      - Focus lens group has failed to reach its target position. The driver\n>>>> +       will not transition from this state until another action is performed\n>>>> +       by an application.\n>>>\n>>> When would the lens state transition from V4L2_LENS_STATUS_REACHED to\n>>> V4L2_LENS_STATUS_IDLE?\n>>> If it's reached the position then it is at rest, and being at rest is\n>>> the definition of V4L2_LENS_STATUS_IDLE.\n>>> Likewise the lens always has a target position based on the control\n>>> value, so it's always at V4L2_LENS_STATUS_REACHED when it's not\n>>> moving.\n>>> Is there a need to have 2 states?\n>>\n>> Good point, I need to reconsider that (and possibly remove one of those\n>> states).\n>>\n>>> If the position is the same units as V4L2_CID_FOCUS_ABSOLUTE, then do\n>>> you leave the determination of state to the application?\n>>\n>> I am afraid I don't quite follow.\n> \n> If the application sets V4L2_CID_FOCUS_ABSOLUTE to 42, and\n> V4L2_CID_FOCUS_STATUS returns that the position is now 42, then the\n> application knows that the lens has reached the requested position. If\n> the two controls return different values then the lens is still\n> moving.\n> What new information does adding an additional status flag give you?\n\nI can think of two situations:\n\n - Hardware error: the lens stops at 40 (for whatever reason). Since 40\n   != 42 the lens is still moving, although a hardware error has occured\n   that may need recovery or at least reporting.\n\n - Different controls: If moving = (V4L2_CID_FOCUS_ABSOLUTE == current),\n   then what happens if the application performs a\n   V4L2_CID_FOCUS_RELATIVE with -3? current should reach 39,\n   V4L2_CID_FOCUS_ABSOLUTE is still at 42, the lens is still moving from\n   the application's point of view.\n\nDon't get me wrong, a simple control that reports the current position\nwould be way easier. But I feel that we may regret this in the future.\nAlso, I would not use two separate controls \"current\" and \"flags/status\"\nin order to avoid non-atomic access patterns.\n\n> (Thinking aloud) I guess you have got my case where your readback is\n> via an ADC so that the position may fluctuate slightly due to\n> conversion noise. The control loop for applying power to the motors\n> will presumably stop at some point and stop trying to adjust the\n> position, so potentially it could be the state returned from that\n> control loop. However the noisy ADC position could also be solved by\n> the position being returned by the control loop instead of giving the\n> raw value.\n\nWith stepper motors the readback is not that noisy, but in any case the\nflags field allows an underlying controller to signal certain conditions\nwithout relying on the exact value of the current position. I think that\nis a plus, especially for noisy readback.\n\n>> But FWIW the application should read out the flags to find out whether\n>> the lens is moving and, if this is not the case, whether the last move\n>> command (FOCUS_ABSOLUTE or FOCUS_RELATIVE) has succeeded or failed. The\n>> failed state is important as there might be the possibility that\n>> depending on the zoom lens position certain focus positions are not\n>> available (and vice versa).\n> \n> How would you configure those kinds of restrictions in the kernel\n> driver? Is the kernel driver the best place to do it (so many things\n> are being kicked back to userspace these days)?\n\nIn our case we have a hardware controller that needs to handle the\nrestrictions anyway in order to avoid mechanical damage. The kernel\ndriver is only responsible for reading out the controller status and\ntransforming it into the V4L2 control.\n\nI am not sure how any restrictions can be reliably handled in software,\nhence I don't have a strong opinion on whether this is done in kernel or\nuser space.\n\n> If it is to be done in the kernel, then shouldn't eg changing the zoom\n> position alter the ranges advertised for the relevant focus controls?\n\nWhile it should be possible to update the minimum and maximum of e.g.,\nFOCUS_ABSOLUTE, I am not sure whether the interface is designed for\nfrequent re-reading of the range.\n\n> If the ranges aren't updated, where should that out-of-range lens\n> movement leave the lens?\n\nThis is up to the hardware controller, but I would guess it typically\nstops one step before disaster. Wherever that may be, the error\ncondition and the current position can be read out via this new STATUS\ncontrol.\n\nDoes this sound good so far?\n\nBest regards,\nMichael\n\n> \n>   Dave\n> \n>>>>  ``V4L2_CID_FOCUS_AUTO (boolean)``\n>>>>      Enables continuous automatic focus adjustments. The effect of manual\n>>>>      focus adjustments while this feature is enabled is undefined,\n>>>> @@ -239,6 +263,30 @@ enum v4l2_auto_focus_range -\n>>>>      movement. A negative value moves the zoom lens group towards the\n>>>>      wide-angle direction. The zoom speed unit is driver-specific.\n>>>>\n>>>> +``V4L2_CID_ZOOM_STATUS (struct)``\n>>>> +    The current status of the zoom lens group. This is a read-only control.\n>>>> +    The returned data structure contains the current position and movement\n>>>> +    indication flags. The unit of the current position is driver-specific and\n>>>> +    its value should be a positive integer. The possible flags are described\n>>>> +    in the table below.\n>>>> +\n>>>> +.. tabularcolumns:: |p{6.8cm}|p{10.7cm}|\n>>>> +\n>>>> +.. flat-table::\n>>>> +    :header-rows:  0\n>>>> +    :stub-columns: 0\n>>>> +\n>>>> +    * - ``V4L2_LENS_STATUS_IDLE``\n>>>> +      - Zoom lens group is at rest.\n>>>> +    * - ``V4L2_LENS_STATUS_BUSY``\n>>>> +      - Zoom lens group is moving.\n>>>> +    * - ``V4L2_LENS_STATUS_REACHED``\n>>>> +      - Zoom lens group has reached its target position.\n>>>> +    * - ``V4L2_LENS_STATUS_FAILED``\n>>>> +      - Zoom lens group has failed to reach its target position. The driver will\n>>>> +       not transition from this state until another action is performed by an\n>>>> +       application.\n>>>> +\n>>>>  ``V4L2_CID_IRIS_ABSOLUTE (integer)``\n>>>>      This control sets the camera's aperture to the specified value. The\n>>>>      unit is undefined. Larger values open the iris wider, smaller values\n>>>> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-core.c b/drivers/media/v4l2-core/v4l2-ctrls-core.c\n>>>> index 29169170880a..f6ad30f311c5 100644\n>>>> --- a/drivers/media/v4l2-core/v4l2-ctrls-core.c\n>>>> +++ b/drivers/media/v4l2-core/v4l2-ctrls-core.c\n>>>> @@ -350,6 +350,9 @@ void v4l2_ctrl_type_op_log(const struct v4l2_ctrl *ctrl)\n>>>>         case V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS:\n>>>>                 pr_cont(\"HEVC_DECODE_PARAMS\");\n>>>>                 break;\n>>>> +       case V4L2_CTRL_TYPE_LENS_STATUS:\n>>>> +               pr_cont(\"LENS_STATUS\");\n>>>> +               break;\n>>>>         default:\n>>>>                 pr_cont(\"unknown type %d\", ctrl->type);\n>>>>                 break;\n>>>> @@ -918,6 +921,9 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx,\n>>>>                         return -EINVAL;\n>>>>                 break;\n>>>>\n>>>> +       case V4L2_CTRL_TYPE_LENS_STATUS:\n>>>> +               break;\n>>>> +\n>>>>         default:\n>>>>                 return -EINVAL;\n>>>>         }\n>>>> @@ -1605,6 +1611,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl,\n>>>>         case V4L2_CTRL_TYPE_AREA:\n>>>>                 elem_size = sizeof(struct v4l2_area);\n>>>>                 break;\n>>>> +       case V4L2_CTRL_TYPE_LENS_STATUS:\n>>>> +               elem_size = sizeof(struct v4l2_ctrl_lens_status);\n>>>> +               break;\n>>>>         default:\n>>>>                 if (type < V4L2_CTRL_COMPOUND_TYPES)\n>>>>                         elem_size = sizeof(s32);\n>>>> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c\n>>>> index 564fedee2c88..9b26a3aa9e9c 100644\n>>>> --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c\n>>>> +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c\n>>>> @@ -1044,6 +1044,8 @@ const char *v4l2_ctrl_get_name(u32 id)\n>>>>         case V4L2_CID_CAMERA_ORIENTATION:       return \"Camera Orientation\";\n>>>>         case V4L2_CID_CAMERA_SENSOR_ROTATION:   return \"Camera Sensor Rotation\";\n>>>>         case V4L2_CID_HDR_SENSOR_MODE:          return \"HDR Sensor Mode\";\n>>>> +       case V4L2_CID_FOCUS_STATUS:             return \"Focus, Status\";\n>>>> +       case V4L2_CID_ZOOM_STATUS:              return \"Zoom, Status\";\n>>>\n>>> Is there a need for the comma in the text strings?\n>>\n>> Not sure, actually. Some other strings used commas. Monkey see, monkey do.\n>>\n>> Best regards,\n>> Michael\n>>\n>>>\n>>> Cheers\n>>>   Dave\n>>>\n>>>>\n>>>>         /* FM Radio Modulator controls */\n>>>>         /* Keep the order of the 'case's the same as in v4l2-controls.h! */\n>>>> @@ -1593,6 +1595,11 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,\n>>>>                 *flags |= V4L2_CTRL_FLAG_WRITE_ONLY |\n>>>>                           V4L2_CTRL_FLAG_EXECUTE_ON_WRITE;\n>>>>                 break;\n>>>> +       case V4L2_CID_FOCUS_STATUS:\n>>>> +       case V4L2_CID_ZOOM_STATUS:\n>>>> +               *type = V4L2_CTRL_TYPE_LENS_STATUS;\n>>>> +               *flags |= V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_VOLATILE;\n>>>> +               break;\n>>>>         case V4L2_CID_FLASH_STROBE_STATUS:\n>>>>         case V4L2_CID_AUTO_FOCUS_STATUS:\n>>>>         case V4L2_CID_FLASH_READY:\n>>>> diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h\n>>>> index e59d9a234631..f7273ffc20c9 100644\n>>>> --- a/include/media/v4l2-ctrls.h\n>>>> +++ b/include/media/v4l2-ctrls.h\n>>>> @@ -52,6 +52,7 @@ struct video_device;\n>>>>   * @p_hdr10_cll:               Pointer to an HDR10 Content Light Level structure.\n>>>>   * @p_hdr10_mastering:         Pointer to an HDR10 Mastering Display structure.\n>>>>   * @p_area:                    Pointer to an area.\n>>>> + * @p_lens_status:             Pointer to a lens status structure.\n>>>>   * @p:                         Pointer to a compound value.\n>>>>   * @p_const:                   Pointer to a constant compound value.\n>>>>   */\n>>>> @@ -81,6 +82,7 @@ union v4l2_ctrl_ptr {\n>>>>         struct v4l2_ctrl_hdr10_cll_info *p_hdr10_cll;\n>>>>         struct v4l2_ctrl_hdr10_mastering_display *p_hdr10_mastering;\n>>>>         struct v4l2_area *p_area;\n>>>> +       struct v4l2_ctrl_lens_status *p_lens_status;\n>>>>         void *p;\n>>>>         const void *p_const;\n>>>>  };\n>>>> diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h\n>>>> index 5e80daa4ffe0..8b037467ba9a 100644\n>>>> --- a/include/uapi/linux/v4l2-controls.h\n>>>> +++ b/include/uapi/linux/v4l2-controls.h\n>>>> @@ -993,6 +993,19 @@ enum v4l2_auto_focus_range {\n>>>>\n>>>>  #define V4L2_CID_HDR_SENSOR_MODE               (V4L2_CID_CAMERA_CLASS_BASE+36)\n>>>>\n>>>> +struct v4l2_ctrl_lens_status {\n>>>> +       __u32 flags;\n>>>> +       __s32 current_position;\n>>>> +};\n>>>> +\n>>>> +#define V4L2_LENS_STATUS_IDLE                  (0 << 0)\n>>>> +#define V4L2_LENS_STATUS_BUSY                  (1 << 0)\n>>>> +#define V4L2_LENS_STATUS_REACHED               (1 << 1)\n>>>> +#define V4L2_LENS_STATUS_FAILED                        (1 << 2)\n>>>> +\n>>>> +#define V4L2_CID_FOCUS_STATUS                  (V4L2_CID_CAMERA_CLASS_BASE + 37)\n>>>> +#define V4L2_CID_ZOOM_STATUS                   (V4L2_CID_CAMERA_CLASS_BASE + 38)\n>>>> +\n>>>>  /* FM Modulator class control IDs */\n>>>>\n>>>>  #define V4L2_CID_FM_TX_CLASS_BASE              (V4L2_CTRL_CLASS_FM_TX | 0x900)\n>>>> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h\n>>>> index 17a9b975177a..256c21c68720 100644\n>>>> --- a/include/uapi/linux/videodev2.h\n>>>> +++ b/include/uapi/linux/videodev2.h\n>>>> @@ -1888,6 +1888,8 @@ enum v4l2_ctrl_type {\n>>>>         V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS        = 0x0272,\n>>>>         V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX      = 0x0273,\n>>>>         V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS       = 0x0274,\n>>>> +\n>>>> +       V4L2_CTRL_TYPE_LENS_STATUS              = 0x0300,\n>>>>  };\n>>>>\n>>>>  /*  Used in the VIDIOC_QUERYCTRL ioctl for querying controls */\n>>>>\n>>>> --\n>>>> 2.30.2\n>>>>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 104B9C0F2A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 12 Apr 2023 08:00:35 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 68D6B627B8;\n\tWed, 12 Apr 2023 10:00:34 +0200 (CEST)","from EUR03-DBA-obe.outbound.protection.outlook.com\n\t(mail-dbaeur03on20626.outbound.protection.outlook.com\n\t[IPv6:2a01:111:f400:fe1a::626])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4CC56627B1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 12 Apr 2023 10:00:32 +0200 (CEST)","from DU0PR08MB9155.eurprd08.prod.outlook.com (2603:10a6:10:416::5)\n\tby AS8PR08MB10315.eurprd08.prod.outlook.com\n\t(2603:10a6:20b:5c0::19) with Microsoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38;\n\tWed, 12 Apr 2023 08:00:29 +0000","from DU0PR08MB9155.eurprd08.prod.outlook.com\n\t([fe80::77dd:14e4:a772:d85f]) by\n\tDU0PR08MB9155.eurprd08.prod.outlook.com\n\t([fe80::77dd:14e4:a772:d85f%4]) with mapi id 15.20.6277.038;\n\tWed, 12 Apr 2023 08:00:28 +0000"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1681286434;\n\tbh=AhYL8Dd8muWqk4SntuJVvS9TgHROcoELzTG+TfmoM+o=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=A0uQfCnwBimO4OCxJEDbuwHk8s7Mgi4f/z6H6r/7DXNECRSQGrT1mwJfBQFrDkU5r\n\t5kqYH+UaHtMcVVF37xZk9T1PwoZijX7NIXeJcxPKlIA5nbhlF86Pjv9CW/CdShGx0i\n\t9VbRZ0veg7BGdysQwAopBRPvxkv/WFmYzgwNo/nEcZ+g+0dGWN1x1spPnqugDJdvmt\n\tCeneY2WmgpZOVRHSq91jE/2FY6XBG2en5oOCzLCzrJmY8EE0k6Ku7VOhSMWlnR0vS+\n\tFjHXFrp8RyuB9a0i1KH/qjJHXoFefgiybLrSIzZ6CF5yVAWlWaL+eydSR+dIQTy1f/\n\t7PprZ3HpszHzg==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net;\n\ts=selector2;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n\tbh=8747tjrli3rlMy4OFgJp8BNdJCnB0LO5HKIL7tZx13c=;\n\tb=ErrTzRsQqfHmucVtTG9WfI90NO0fG+Cy8JictieKf1HEqWbfKR1XMn91USAUAhkG5/Mjh7EpI3Tz/MFkD+mDPKz+DsZsx8gsbKhMYzoVINDLTkMjrhYOFiJLoLndRldCv6GdjiGMTyAQmqdotI1Zt8rb7AQO5HZqcP1eTZsGn8o="],"Authentication-Results":["lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=wolfvision.net\n\theader.i=@wolfvision.net\n\theader.b=\"ErrTzRsQ\"; dkim-atps=neutral","dkim=none (message not signed)\n\theader.d=none;dmarc=none action=none header.from=wolfvision.net;"],"ARC-Seal":"i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;\n\tb=AWS0eSmhWTe9lQjkf0YF6j/Nd2qaju1aCfyRxxjQaR/56bAPCdwxfFDYYyQiJ768HN66sl80ZdOk3u+yZs2bEiDrTHZ8PhRBQMTFRVGL1VzqzFMofgmRDD8i5jJBHBls4qe0j5kzAfsTU4mgSR1LSYVZZXxd/Dk2oHKzoAMXsdN2BfqPydO77J4HHKnFgdkDUePif67UlqcKVkjGrLcirYC5vmNm43HIFb+Et0rVojp6tnDLHKVYx1ky8xSkczcJDsOEBpb+R7oi1iJBTBD/LfAzPFvmSf3mUecLq8X/4nGIkw5h/14+VuAxFj6yFRHAsDnNqBs7jg88nlPjJ9yvKA==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n\ts=arcselector9901;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;\n\tbh=8747tjrli3rlMy4OFgJp8BNdJCnB0LO5HKIL7tZx13c=;\n\tb=mdmriRSBrSiQiC9W0YrJzC7x2duuh8V3W0jixulVx2xsTybqrLUnroDGhWpJXHRXJZlR7WKstlAenaD7LeMvUV9IxEZPJEKDccp2d5KHnRTEvrFXcLMJfKQcwuucSvV1GtRDOXLo7Bz/IFOlqbljBJtohiDpbQJsEbHC0/fwyOhFetgTaHC9K9e9f9c8z9uGo8xMmuB4JoG1lqrJiqia36BYZkTOaXC7Hy+6+ZqDpBTNQAKMxSoDkm/WbiTQBl+OWXNbW6ClSVQnXaLSYdhMUpSt+w9G0bE5LqqZvb3ReYUGX3Tmoz4yBSCQDyCnaJukIfkgO8OjMfTyyc++7+Ofdw==","ARC-Authentication-Results":"i=1; mx.microsoft.com 1; spf=pass\n\tsmtp.mailfrom=wolfvision.net; dmarc=pass action=none\n\theader.from=wolfvision.net; dkim=pass header.d=wolfvision.net;\n\tarc=none","Message-ID":"<3ab7bfc4-aaae-2e39-b420-40ad8d71dda4@wolfvision.net>","Date":"Wed, 12 Apr 2023 10:00:26 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101\n\tThunderbird/102.9.0","Content-Language":"en-US","To":"Dave Stevenson <dave.stevenson@raspberrypi.com>","References":"<20230406-feature-controls-lens-v1-0-543189a680de@wolfvision.net>\n\t<20230406-feature-controls-lens-v1-1-543189a680de@wolfvision.net>\n\t<CAPY8ntArOOqPQzvkJrQEyuVFfb6j8x6WODTMHOn1qHPU588mbQ@mail.gmail.com>\n\t<0f1baf5e-2ff6-e10b-5c3e-0a82c71d0ce6@wolfvision.net>\n\t<CAPY8ntAjBEFfeV6nnQs34Y22QM-irT13ALDv4ksP8AYK=jWsKg@mail.gmail.com>","Organization":"WolfVision GmbH","In-Reply-To":"<CAPY8ntAjBEFfeV6nnQs34Y22QM-irT13ALDv4ksP8AYK=jWsKg@mail.gmail.com>","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"7bit","X-ClientProxiedBy":"VI1PR08CA0219.eurprd08.prod.outlook.com\n\t(2603:10a6:802:15::28) To DU0PR08MB9155.eurprd08.prod.outlook.com\n\t(2603:10a6:10:416::5)","MIME-Version":"1.0","X-MS-PublicTrafficType":"Email","X-MS-TrafficTypeDiagnostic":"DU0PR08MB9155:EE_|AS8PR08MB10315:EE_","X-MS-Office365-Filtering-Correlation-Id":"868cc8f4-6302-48aa-38d9-08db3b2bfb04","X-MS-Exchange-SenderADCheck":"1","X-MS-Exchange-AntiSpam-Relay":"0","X-Microsoft-Antispam":"BCL:0;","X-Microsoft-Antispam-Message-Info":"64NJgCXZKbAlhEHeGBuGUJP9Xt50yffIMQ6J4OBinNxG/lcQghag1cfD8t9aXUSFfBRGR/Gqzu6eGVeEJ19zgYe7W0rgryHmpWZEg/C7CPzjNbK+hLPjTnnXEkOCMHEnhr3uvHc3q3vvrDxNaoZrYJQJeTf+w/a4arutAY2PO8hTQkjw3kUOtJ/47C8NH00Dn/of8FzTdqAsxwuct8+dovYKqaT/fux0D1Uatign1EzjFcPTo2b1dMSlwV/QTyKCO+UFR6WC7PXKqofIHnP5d1DMbrUqdQi0zMD66iCjPoyhwtQc4Au//JdDilv58bwTweTb0a4c1qiOnVEZ2ELu3wrMv24lN2FtluZ36AOdQwixijdmC/OTFBZc7P6nRWGkLQNZxFrkL1dWkWkVcFAqt5CfRnMTW3UiRQqWIypYQr/khbEpQwrpSNrsUuS55Iwziw8gEHEayOja7PejmV7simm0iWZA/qn/ihKAcbMtXOmi8wbYvXrdgFBSmuG6M76ZWphCxHMmCjGJXitzoAREX/lDESiX4+0MaesYTPNJFffDwrs8AknW/k6CrsAI+2kKSvfu+R+rAeXvYnn5Uv/T2eaUJIx239Aznh5teN+V4vs/EWYF6Db5RJo+yhJePPd/KnaUvVt0+JqiRzJYedTlYA==","X-Forefront-Antispam-Report":"CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;\n\tIPV:NLI; SFV:NSPM; H:DU0PR08MB9155.eurprd08.prod.outlook.com; PTR:;\n\tCAT:NONE; \n\tSFS:(13230028)(4636009)(376002)(346002)(366004)(39850400004)(396003)(136003)(451199021)(5660300002)(44832011)(30864003)(6486002)(966005)(8936002)(53546011)(26005)(6506007)(6512007)(2906002)(83380400001)(186003)(36756003)(2616005)(38100700002)(86362001)(31696002)(478600001)(41300700001)(6916009)(66556008)(4326008)(66946007)(8676002)(66476007)(36916002)(316002)(31686004)(54906003)(43740500002)(45980500001);\n\tDIR:OUT; SFP:1101; ","X-MS-Exchange-AntiSpam-MessageData-ChunkCount":"1","X-MS-Exchange-AntiSpam-MessageData-0":"=?utf-8?q?EU/sFkGoSWRyJCtD0rB+R7Mwk?=\n\t=?utf-8?q?X+flCcg7+E/MzKwJeoChEoR/Mdu5rWby3eOvbd8gwdnTktmtoFNlJQiE?=\n\t=?utf-8?q?mcTBmrgyzExJwiRmPdhhzh8zWplNxKd4qFBUyV3aMe/0gNiRYAcM5nmX?=\n\t=?utf-8?q?LKhaFrpIF0ARWE1Guypadqtax0n9oNRZdGgAMLIOW+DvSlP94omLASIz?=\n\t=?utf-8?q?VCLiJJJTgPwqlpwab4AeFufuIU5VLhFrc+TegFzC95olkUXJiPA1lq13?=\n\t=?utf-8?q?ABnS0gjZjMZBjynxHjPa94xAUkYgk7JPT42H30WxfK2vOrD5FjBw5Hq5?=\n\t=?utf-8?q?wz4fM9NyyYOY2f1EHYe42MiRTj0esK+YUWg1Wlb09jnV4LIvRqWVHBGV?=\n\t=?utf-8?q?h6cTncIJWsPVyYJEXn/ac2WQ8WR9c1fCDYpb0qugBoVhZkftOxZui8ey?=\n\t=?utf-8?q?INkELHYJepDb9tNUTR4pPApIo3CXr+JNX4LmKPSsgSnckrzPamPMUfPO?=\n\t=?utf-8?q?fR0cPVFp5shrvmC2FsuISZ6U3mlox+s0MGA/fQ5nyscXxIAzZhGSWB5n?=\n\t=?utf-8?q?eAlGPRsuB7wQtVtUL+Y9BHkhNGYCaN1p8WXL9ZqGdCphxk3Kwm48a4ZL?=\n\t=?utf-8?q?JLQOUXOnfFjVdYAsKv0KdGMucnMT8YQcFARTkp6bq5PimNvoHjA+dDQQ?=\n\t=?utf-8?q?7SLhQwJoqniLobeiBmWLODGPIW2YBddnHD72hdXOpWn4yM3/CFP0Bb1J?=\n\t=?utf-8?q?IxpcGM/qyb+C+IJUBxSyRECcYf7z+YtmYtxJmq9txTeL6D/qUggxh5Og?=\n\t=?utf-8?q?EiPClChwGRCQv0MWngDk95pnm6U8spX1V1jBZ5l+Z1riCYdZ6vviqRz6?=\n\t=?utf-8?q?J6qxbIC6XAiNfS6ZhNmU0ckdsn5cBSj5BRN1k51WYQMVHsBlSVXcdDH8?=\n\t=?utf-8?q?e3BTfnlGOV4xAjea72sIC+sHMdWntX2gncukmtcbAODpIVoug+XkItjm?=\n\t=?utf-8?q?t+PfyCt15OIMH3jtLPE8JAZp7jjzxgmmVFn1cRuVwfoYx3Fot2OVM/ql?=\n\t=?utf-8?q?CzY5fMnQWjWRLBL2E8/E2WQxByslGFMTkCp7rZJeAl1MmxlXsPweKOq3?=\n\t=?utf-8?q?SUhMFVPTkC7RldZqMT6hqF3H0j79KobzgiKSAljr9mlmIaTXEMJxqGqv?=\n\t=?utf-8?q?LAWBqDeUvbJ4G93I05ju9ngm1jORGAk7+n4KMGAVEpkiOk8y4x7EJTxS?=\n\t=?utf-8?q?903NEnSBz0kRCmgbY4/6DS5l7qlX4cQ3TI1un9iUJ62aANVbCfl3Ulxi?=\n\t=?utf-8?q?do6iM8kK24dwY9kSbLD1nkgRcTO6dXSbHK40/svRyIQ1powdW/+fukOx?=\n\t=?utf-8?q?3/0zZgXHgrpmmwxK80hdirdCLivY5th+V2do019FSVGNON04NzjfBdy2?=\n\t=?utf-8?q?2mZT58zN+St3ySQoKzjmWBqaULkUW+qLWqav1BzbJRfXJhWf03I3RGuU?=\n\t=?utf-8?q?MP6q0VPdLjbO1q6+EYrweNJpGXcEbLsZ5zQ6DvCAa5k0FI3vHLf8QCyG?=\n\t=?utf-8?q?fmuZ76cZ0AxGnHzMJx8LugrgKNQQ/xjqiLpPsKTXmmkqixmhvcM6mTB0?=\n\t=?utf-8?q?wCZitb0yV1VtqKyfcLfLztWWZIXwFbrBhbpcD6zCuLrrty5nopmrF/MD?=\n\t=?utf-8?q?D6wYlUQcGAixFGwRgjDsUJMcLpLSp4f+7mp5BcNE6ZlwQz9p+hQoiIOP?=\n\t=?utf-8?q?JGis5umVo+WAQCInE+i6b6sD9IbwA=3D=3D?=","X-OriginatorOrg":"wolfvision.net","X-MS-Exchange-CrossTenant-Network-Message-Id":"868cc8f4-6302-48aa-38d9-08db3b2bfb04","X-MS-Exchange-CrossTenant-AuthSource":"DU0PR08MB9155.eurprd08.prod.outlook.com","X-MS-Exchange-CrossTenant-AuthAs":"Internal","X-MS-Exchange-CrossTenant-OriginalArrivalTime":"12 Apr 2023 08:00:28.5406\n\t(UTC)","X-MS-Exchange-CrossTenant-FromEntityHeader":"Hosted","X-MS-Exchange-CrossTenant-Id":"e94ec9da-9183-471e-83b3-51baa8eb804f","X-MS-Exchange-CrossTenant-MailboxType":"HOSTED","X-MS-Exchange-CrossTenant-UserPrincipalName":"04/f0qji6MOcKRZKu/idnLJKc9xfO6pjUIcPwNy+LOiAzETVWb6h1k9eV00w/brJ8J6ng5g8dtYdGOhaYXnrsPyM7g4TWaWn6qhUMKYrnA4=","X-MS-Exchange-Transport-CrossTenantHeadersStamped":"AS8PR08MB10315","Subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Michael Riesch via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Michael Riesch <michael.riesch@wolfvision.net>","Cc":"linux-kernel@vger.kernel.org,\n\tMatthias Fend <Matthias.Fend@wolfvision.net>, \n\tlibcamera-devel@lists.libcamera.org,\n\tSakari Ailus <sakari.ailus@linux.intel.com>,\n\tMauro Carvalho Chehab <mchehab@kernel.org>, Michael Riesch via B4 Relay\n\t<devnull+michael.riesch.wolfvision.net@kernel.org>, \n\tlinux-media@vger.kernel.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26869,"web_url":"https://patchwork.libcamera.org/comment/26869/","msgid":"<ZDaa+qhoZxZ5ymxL@kekkonen.localdomain>","date":"2023-04-12T11:50:18","subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","submitter":{"id":37,"url":"https://patchwork.libcamera.org/api/people/37/","name":"Sakari Ailus","email":"sakari.ailus@linux.intel.com"},"content":"Hi Michael,\n\nOn Wed, Apr 12, 2023 at 10:00:26AM +0200, Michael Riesch wrote:\n>  - Different controls: If moving = (V4L2_CID_FOCUS_ABSOLUTE == current),\n>    then what happens if the application performs a\n>    V4L2_CID_FOCUS_RELATIVE with -3? current should reach 39,\n>    V4L2_CID_FOCUS_ABSOLUTE is still at 42, the lens is still moving from\n>    the application's point of view.\n\nWould there be a reason to implement both of these controls in a single\ndriver? AFAIU, the relative one should be used if there absolute value\nisn't known to the driver.","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 73403C0F2A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 12 Apr 2023 11:50:38 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9E9F5627B8;\n\tWed, 12 Apr 2023 13:50:37 +0200 (CEST)","from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8F8AE61EBF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 12 Apr 2023 13:50:30 +0200 (CEST)","from fmsmga004.fm.intel.com ([10.253.24.48])\n\tby fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; \n\t12 Apr 2023 04:50:22 -0700","from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com)\n\t([10.237.72.44]) by fmsmga004-auth.fm.intel.com with\n\tESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2023 04:50:20 -0700","from kekkonen.localdomain (localhost [IPv6:::1])\n\tby kekkonen.fi.intel.com (Postfix) with SMTP id 06736120D2E;\n\tWed, 12 Apr 2023 14:50:18 +0300 (EEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1681300237;\n\tbh=eJguQgfPrCzOL1UinkrZOLLmdKnj7zrU8lo6WlYHIEs=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=PHF8jI8yHxxJ6cQ6BsvH5KKVQj3HPOnuU0PuX1Wa3bUnCUV5eDaXk9rrPd0qZP11o\n\tMeqJnOo1t5FBuC7U21+iX9YwWc/CteuiUDAhPrcjx2sdUWvcDRtBuDLmNW0Wi88OtA\n\tdttaB78UikphNxlJa40MTbL15XIZ98NFiabbLxVL0Ta88lpoJ0eYUrK018lwXXOvpY\n\tAXaxnmN0DH2IEjl7ruAYPeXZrSVWUngZbeQ90762G3ESbGqplzYfXYQPLZm51qRPyO\n\tnCtl30TWcyNwDYd+n4ZWLH6D3NMBKtAOlkYURZV0nHWAuQB61RgMUIV4EVtAPCgakN\n\tPVnFOFuWhhCMw==","v=1; a=rsa-sha256; c=relaxed/simple;\n\td=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n\tt=1681300235; x=1712836235;\n\th=date:from:to:cc:subject:message-id:references:\n\tmime-version:in-reply-to;\n\tbh=eJguQgfPrCzOL1UinkrZOLLmdKnj7zrU8lo6WlYHIEs=;\n\tb=VBnNEFhG7OQFu3aA+hKmcbmoLjFHAvjwpecM9sumdE0Yz3r5Gk3iRLTm\n\tmZC0L3ENUzyuVYEyejkcMXhlARXzf2OmRjRnd+RnUAGL2VQq0G1Lg7KG2\n\tCvjgDMN2+YvAWKlrlPJs+470dJayk+Z9ZhdvNvlDQZr5OK+8Gpx6auFrK\n\tlRmZXxbMDyG+wylO1erRpxTMOLJ9Jz/UJNX+P3UOB/4HpPHwocCFDuP7n\n\te9aPdCUryqrFMy3j7ZpoFQn/NdhLIwwycXMcgYrbhWktlbDxzJiwhdHrf\n\tljrbYxWUkw0popIJKQGy7ISGAR65e5129PS5vc0FfLyP+EncOth60S/Ko w==;"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=intel.com header.i=@intel.com\n\theader.b=\"VBnNEFhG\"; dkim-atps=neutral","X-IronPort-AV":["E=McAfee;i=\"6600,9927,10677\"; a=\"341362753\"","E=Sophos;i=\"5.98,339,1673942400\"; d=\"scan'208\";a=\"341362753\"","E=McAfee;i=\"6600,9927,10677\"; a=\"758207430\"","E=Sophos;i=\"5.98,339,1673942400\"; d=\"scan'208\";a=\"758207430\""],"X-ExtLoop1":"1","Date":"Wed, 12 Apr 2023 14:50:18 +0300","To":"Michael Riesch <michael.riesch@wolfvision.net>","Message-ID":"<ZDaa+qhoZxZ5ymxL@kekkonen.localdomain>","References":"<20230406-feature-controls-lens-v1-0-543189a680de@wolfvision.net>\n\t<20230406-feature-controls-lens-v1-1-543189a680de@wolfvision.net>\n\t<CAPY8ntArOOqPQzvkJrQEyuVFfb6j8x6WODTMHOn1qHPU588mbQ@mail.gmail.com>\n\t<0f1baf5e-2ff6-e10b-5c3e-0a82c71d0ce6@wolfvision.net>\n\t<CAPY8ntAjBEFfeV6nnQs34Y22QM-irT13ALDv4ksP8AYK=jWsKg@mail.gmail.com>\n\t<3ab7bfc4-aaae-2e39-b420-40ad8d71dda4@wolfvision.net>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<3ab7bfc4-aaae-2e39-b420-40ad8d71dda4@wolfvision.net>","Subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Sakari Ailus via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Sakari Ailus <sakari.ailus@linux.intel.com>","Cc":"linux-kernel@vger.kernel.org,\n\tMatthias Fend <Matthias.Fend@wolfvision.net>, \n\tlibcamera-devel@lists.libcamera.org,\n\tMauro Carvalho Chehab <mchehab@kernel.org>, Michael Riesch via B4 Relay\n\t<devnull+michael.riesch.wolfvision.net@kernel.org>, \n\tlinux-media@vger.kernel.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26870,"web_url":"https://patchwork.libcamera.org/comment/26870/","msgid":"<8fe5c9c5-6eb0-86ae-9e5d-fbaa72be25fe@wolfvision.net>","date":"2023-04-12T11:57:36","subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","submitter":{"id":135,"url":"https://patchwork.libcamera.org/api/people/135/","name":"Michael Riesch","email":"michael.riesch@wolfvision.net"},"content":"Hi Sakari,\n\nOn 4/12/23 13:50, Sakari Ailus wrote:\n> Hi Michael,\n> \n> On Wed, Apr 12, 2023 at 10:00:26AM +0200, Michael Riesch wrote:\n>>  - Different controls: If moving = (V4L2_CID_FOCUS_ABSOLUTE == current),\n>>    then what happens if the application performs a\n>>    V4L2_CID_FOCUS_RELATIVE with -3? current should reach 39,\n>>    V4L2_CID_FOCUS_ABSOLUTE is still at 42, the lens is still moving from\n>>    the application's point of view.\n> \n> Would there be a reason to implement both of these controls in a single\n> driver? AFAIU, the relative one should be used if there absolute value\n> isn't known to the driver.\n\nProbably not, but on the other hand there is nothing the prevents a\ndriver developer from doing so, right? Point is that should there be a\ndriver which does implement both controls, we are in trouble AFAIU.\n\nBest regards,\nMichael","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 59D67BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 12 Apr 2023 11:57:44 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A4DB762754;\n\tWed, 12 Apr 2023 13:57:43 +0200 (CEST)","from EUR01-HE1-obe.outbound.protection.outlook.com\n\t(mail-he1eur01on062c.outbound.protection.outlook.com\n\t[IPv6:2a01:111:f400:fe1e::62c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B1B9561EBF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 12 Apr 2023 13:57:41 +0200 (CEST)","from DU0PR08MB9155.eurprd08.prod.outlook.com (2603:10a6:10:416::5)\n\tby GV2PR08MB8076.eurprd08.prod.outlook.com (2603:10a6:150:7a::14)\n\twith Microsoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38;\n\tWed, 12 Apr 2023 11:57:38 +0000","from DU0PR08MB9155.eurprd08.prod.outlook.com\n\t([fe80::77dd:14e4:a772:d85f]) by\n\tDU0PR08MB9155.eurprd08.prod.outlook.com\n\t([fe80::77dd:14e4:a772:d85f%4]) with mapi id 15.20.6277.038;\n\tWed, 12 Apr 2023 11:57:38 +0000"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1681300663;\n\tbh=pic2qQoXEv0/AefYpUQuXcxqyXZxRWmDvAOGs45BtMs=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=rNXrTVBjnNdicUJOKeSsHd0NMleE+0zcWwn8XukFHv3WhpJWCwxkVGuHjQyi8ze/z\n\t0Deo0EQYtm/Rx4fH0RpXdRNC1XwjzmV65odzu88QzOx62CT+ET0F8oRMUQiUlxxp4g\n\tf1pMQL0wQqvJlXsYzCY6aPdE1UcMhZzR2ptu6vm/+/QqjGfbYHRq3TyHdFv36Pw/e/\n\t7Ww4njfA+FY17GRPRXnsMF+YPs8C8t/jKlrrbbK0vk6KkqDjWr5bu5sxTQ8lc6Qkos\n\tkOfnIja12mz6uPBFJ/Bmu9ekG+R2gIWrWe4tyxEYsyTrCYqhU+rV1WZlrejUKSDX1n\n\t69u1En72Tp0Pg==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net;\n\ts=selector2;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n\tbh=ggl+rPwLCtwKP7eyHLvj+vpcJ3IiUI0obGJOxcvOuXA=;\n\tb=o+tiwQbyn5x71GFkt4ZvizWp15ePRADZYJWtzQKvco1mFfaZIgJXXMBUc+bnBBzHW3Oz5yfxbvCA5v5sJ5+wa1BDmmV5xemcPqKviIZKEyio0lyjVMXE7Da2xKRHGegOwChfgGhhvrbZcxz+iu1Ld2rmmlGklVGRPexTlxRmBB4="],"Authentication-Results":["lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=wolfvision.net\n\theader.i=@wolfvision.net\n\theader.b=\"o+tiwQby\"; dkim-atps=neutral","dkim=none (message not signed)\n\theader.d=none;dmarc=none action=none header.from=wolfvision.net;"],"ARC-Seal":"i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;\n\tb=dVuHAEq2xD+SOUxOyQjiNvlcq0JhSt/DuD7VES6VYspklV1RakoG8hkHzGlcoYCc2GzlK16ITPEzs5qG5DVHMNBdZazTfAUEtzPF5MIvl7I4piR+fHBI3lD4nZ7rveLJvl+Rg68fOKILugpBw/6nv+RjYOOab8A6MBKrsEKuaJx5Z2lRSCiZC6rNkd1KjfKoznkg3Mn0zdkoStfZizV4PWuroKnlsMpYs92U9kgj9kqLU7jzmunihZhGCz79EdQbwtgnVZPiMCFqkFINQXADozwwpWFl9EKBZxCwyPZw6uCTbCIetuZQ5SeXC1AXaGq2ifVOwjp/ertx7kWpCJepMg==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n\ts=arcselector9901;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;\n\tbh=ggl+rPwLCtwKP7eyHLvj+vpcJ3IiUI0obGJOxcvOuXA=;\n\tb=T2WhgKBJnflAR2bhoxj77mEIE0QqvQaHPr51kHRBHBGj6HMrL2Nx8FxoPpldLCiwJDV2M9gPFVC2+AyT9LkdFDHiFUlGTkQhg91u5TQ0lNauQebwn5fcQWC/ALvFv58T3STC/pkqFwPiw7tnjw8MC7BMDQnGrOnfrMEbwFZY0s2O3LdP9L3Dqw/V7D9E1HsHCmviJRCnCwWskPfRLYD3qIcdopv32hPXgNQbyUod4JJQu8PEfLq0PrtO4swGmgxACLLv9cWR7LKLhl0+zwoaeFcb5p3OR1GWW+O+lOIC5oyF9m4egwdMswWKWxDyfRzFqe+9F30MgaE78jEuYpl4tw==","ARC-Authentication-Results":"i=1; mx.microsoft.com 1; spf=pass\n\tsmtp.mailfrom=wolfvision.net; dmarc=pass action=none\n\theader.from=wolfvision.net; dkim=pass header.d=wolfvision.net;\n\tarc=none","Message-ID":"<8fe5c9c5-6eb0-86ae-9e5d-fbaa72be25fe@wolfvision.net>","Date":"Wed, 12 Apr 2023 13:57:36 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101\n\tThunderbird/102.9.0","Content-Language":"en-US","To":"Sakari Ailus <sakari.ailus@linux.intel.com>","References":"<20230406-feature-controls-lens-v1-0-543189a680de@wolfvision.net>\n\t<20230406-feature-controls-lens-v1-1-543189a680de@wolfvision.net>\n\t<CAPY8ntArOOqPQzvkJrQEyuVFfb6j8x6WODTMHOn1qHPU588mbQ@mail.gmail.com>\n\t<0f1baf5e-2ff6-e10b-5c3e-0a82c71d0ce6@wolfvision.net>\n\t<CAPY8ntAjBEFfeV6nnQs34Y22QM-irT13ALDv4ksP8AYK=jWsKg@mail.gmail.com>\n\t<3ab7bfc4-aaae-2e39-b420-40ad8d71dda4@wolfvision.net>\n\t<ZDaa+qhoZxZ5ymxL@kekkonen.localdomain>","Organization":"WolfVision GmbH","In-Reply-To":"<ZDaa+qhoZxZ5ymxL@kekkonen.localdomain>","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"7bit","X-ClientProxiedBy":"VI1PR0501CA0042.eurprd05.prod.outlook.com\n\t(2603:10a6:800:60::28) To DU0PR08MB9155.eurprd08.prod.outlook.com\n\t(2603:10a6:10:416::5)","MIME-Version":"1.0","X-MS-PublicTrafficType":"Email","X-MS-TrafficTypeDiagnostic":"DU0PR08MB9155:EE_|GV2PR08MB8076:EE_","X-MS-Office365-Filtering-Correlation-Id":"86b6efd6-65a8-4d83-8c7e-08db3b4d1ca5","X-MS-Exchange-SenderADCheck":"1","X-MS-Exchange-AntiSpam-Relay":"0","X-Microsoft-Antispam":"BCL:0;","X-Microsoft-Antispam-Message-Info":"IFtqGz4VYpOZNb3B6ozSKtaDlpEbsMMkYow4g8ua7+ZtpRj1JclJD/z3v+Danab6A7tbdbm8dF3YbfuiNFWHMe+Mo+p8wwk5eJY7LdN/PecFR/jQ7oXzyB5Wb8yJFOpx2pJV6D3AgjwngtOLwqWfLxhJBcpZU8ElpcoPyck++1xt5SYlq9hY9aIvs4RI5xafDvEvfKgyG+UxrA2A/R3ZUdSUOx28ddLexeBn3kq+sbkOAYhX8zUp7eB4bf/fBSZOMSQ6HjUV8Kb5R+G/jPQ9EWEpzwyDCm6Q/zhaCKCfK0yTvaWZz2GlD0xgkxo1BsgBws0ocXjKlBgg5eGgfiOJW9LMSgmVefaoTQepqpT04YtcAZdfxDFS81vz0S+dMlkTQp5BbmKZbJ/3dcLQpPFcGOEZe2aXbnyBp3kwBNQYw1wqOgiwNy5McNWwZq7OmTKWGVYPsMxC03GN/A1KG6AJGGpB2ozUQSdrWjo4E/EenENl1MqKYewHayXd2QfBMubOHDLMMNFlEpI+e6zrFDnqCLdneqrIq59+17U3ro3LwI3zebDWTQDh1AVLPpdMoPA306uvhNTT2sQaJXWgOTVtKusHV6RkA3iRXA65VXoZxanUgl6/IWyJeLavAHnqUNYXrSBy+9HQpEwO3n+XeO1R6Q==","X-Forefront-Antispam-Report":"CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;\n\tIPV:NLI; SFV:NSPM; H:DU0PR08MB9155.eurprd08.prod.outlook.com; PTR:;\n\tCAT:NONE; \n\tSFS:(13230028)(4636009)(346002)(376002)(136003)(396003)(366004)(39850400004)(451199021)(36756003)(86362001)(31696002)(316002)(6486002)(41300700001)(8676002)(36916002)(4326008)(66476007)(54906003)(6916009)(478600001)(66556008)(66946007)(5660300002)(8936002)(2906002)(4744005)(44832011)(186003)(38100700002)(6512007)(6506007)(26005)(2616005)(53546011)(31686004)(45980500001)(43740500002);\n\tDIR:OUT; SFP:1101; ","X-MS-Exchange-AntiSpam-MessageData-ChunkCount":"1","X-MS-Exchange-AntiSpam-MessageData-0":"=?utf-8?q?HgrALDkmi2ad42k9GE1Rr1WSx?=\n\t=?utf-8?q?jYoEZEb/NnyjXeNJCu2kvoXdJtziK+aym54lvSx7qp0O3iK3AImWpxKO?=\n\t=?utf-8?q?y7H3Pm7Pwhr4ebdIZR5OcDbUDHypE3iO+QUvZTer90RTGbWWhTc2VN6D?=\n\t=?utf-8?q?KyWaxt3stPzGqJcezHYsWS+9SKLauK3VvkxCJQmEt+0m36lq2wfu2ySa?=\n\t=?utf-8?q?dTCiZQL4TWUbsooklEwZf4wtgYm0xFttD3oo7XRaeRUGRUYqYZevePW0?=\n\t=?utf-8?q?T81m0ObPXafio+Oy/OixcTceKR7oGSr3J8q6sa2apaz8LWfNE+Pl2BI/?=\n\t=?utf-8?q?dgGpoSvqf9IrWPmIYSeuMIEIo6WFw95kWdL7uJ6Z8OLHLpWr5BWNkdJq?=\n\t=?utf-8?q?qTm5Kylx0JjAMJzZHeiK1zqzjmRuiqa9aYgnTxSy3uuLoQBqMIDUbaHZ?=\n\t=?utf-8?q?bykd//2JdmvuUIUBRbDpGJ7YqthS0SKsmzLM5eLn2f/SY3jxzXhGj5lJ?=\n\t=?utf-8?q?wR/tUB5e3gU9iEXIJ3EfEOakl6h+/S2HaCd1B/855dG0tBonmTz1pq8+?=\n\t=?utf-8?q?r/SmIPNdmr5/aAe+1kW9iwFykwNGdl7ScrXcrFeiOYIDBY2Y4f3XeXc6?=\n\t=?utf-8?q?KK6kV3xg57eL+F1oSCOl+oqvtn3+KSFtvEJDkcTuKNMhyzcuDaakC7rL?=\n\t=?utf-8?q?u9pooVtUe2dx1W8gbSlAJY3H8y3sg4+l8/p0TXRe7MPUl+ZhDYZhd14I?=\n\t=?utf-8?q?UZhnwWT20ZV1TwS22gkSm1Rmcfu6Tdeb5UJ+ZamGSNUJNviy6Qqjvygi?=\n\t=?utf-8?q?oRjTxxeEvq7HCmRsaHseGxvu1Q5J220/Y9wkTte+H1xhf4tzK2olaL9R?=\n\t=?utf-8?q?KhiYqjR78ZGH578LPDyTWeD6x42DxXeqYCFaR3JWmOGcPamgfVkr/J4T?=\n\t=?utf-8?q?iSzgEdxdmH/a+21gYoD2qioAEG0qPVdgem7RBX6LpbwmmKM/rKcMzwwr?=\n\t=?utf-8?q?kG1CDluAT7/1keCno20JBpLxujQ2OxrdqmII8L7wHH7J+dul9vQZ64lV?=\n\t=?utf-8?q?SYptfDbxCBzg2MsB9YKixKjTlGAH1NxRVTX8sT5kJ8jpX39pNspcYUh8?=\n\t=?utf-8?q?mEOSxxuPgNhFNX+2SCMiHO1Uubz/Xj/3OJJM2ggf7ORvhcdHdFfO2SyI?=\n\t=?utf-8?q?v0C3tMBo5oQEyv3hJnA5QHPY8xJOZjere7G9adjUs0nfbmsir2ZJa1rr?=\n\t=?utf-8?q?c5GlqHEr1y1Y/bXb347gfTbdNpv+EqmxYXAinz87NvNOL3lJPgP8elaq?=\n\t=?utf-8?q?nnndacn1VHtmwz8lrquxLqH8JP/Tni+hT1VTid9IMZsB33Lk9OdH2c8A?=\n\t=?utf-8?q?OGA3udggOX9Q08YlyN9lgzkS+lO8RQLFfLx9Ac+XVFPBrOWaeyiVEgYZ?=\n\t=?utf-8?q?XItWnAl90DIhC6znqa1NIN/y2oxC0oHUPskCLT6bxUbY9TRe93UP7w0Z?=\n\t=?utf-8?q?fWARtNBpQ+875F0qsWCgAPj7pyZ2gQ1aad07xa/GUd6BalxOxrNfMMTO?=\n\t=?utf-8?q?qqhQRgKA8OqqD3OOVYxT3LDdqCsD1kvMBm8lgdQjM2C28e/y3R26Mxwk?=\n\t=?utf-8?q?Sur/Ywt5crtRWB16X3LnQv6LEIPOAkJF51tH2LvcYv5FIdytvXWy9sVY?=\n\t=?utf-8?q?98mw/pHbXWLPdBGy5AfCnfe4pl7JkLtXiDOGn8IbTsYHsdKIB0J3eqe2?=\n\t=?utf-8?q?4uB8xIVXAs9yuEaszjVj0G5OcDMWg=3D=3D?=","X-OriginatorOrg":"wolfvision.net","X-MS-Exchange-CrossTenant-Network-Message-Id":"86b6efd6-65a8-4d83-8c7e-08db3b4d1ca5","X-MS-Exchange-CrossTenant-AuthSource":"DU0PR08MB9155.eurprd08.prod.outlook.com","X-MS-Exchange-CrossTenant-AuthAs":"Internal","X-MS-Exchange-CrossTenant-OriginalArrivalTime":"12 Apr 2023 11:57:38.3765\n\t(UTC)","X-MS-Exchange-CrossTenant-FromEntityHeader":"Hosted","X-MS-Exchange-CrossTenant-Id":"e94ec9da-9183-471e-83b3-51baa8eb804f","X-MS-Exchange-CrossTenant-MailboxType":"HOSTED","X-MS-Exchange-CrossTenant-UserPrincipalName":"0vGarHXEyGttMNr4wm8d+T2b0kNY+af8kBU4AJCCU+L6eaixMh2QPo5GtQPhLb8NScm2XUQGTrlA+y0AvmYFXJxvIqlqc5UFNyAumX7GFlM=","X-MS-Exchange-Transport-CrossTenantHeadersStamped":"GV2PR08MB8076","Subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Michael Riesch via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Michael Riesch <michael.riesch@wolfvision.net>","Cc":"linux-kernel@vger.kernel.org,\n\tMatthias Fend <Matthias.Fend@wolfvision.net>, \n\tlibcamera-devel@lists.libcamera.org,\n\tMauro Carvalho Chehab <mchehab@kernel.org>, Michael Riesch via B4 Relay\n\t<devnull+michael.riesch.wolfvision.net@kernel.org>, \n\tlinux-media@vger.kernel.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26871,"web_url":"https://patchwork.libcamera.org/comment/26871/","msgid":"<ZDaemghP0HQSw3Fo@kekkonen.localdomain>","date":"2023-04-12T12:05:46","subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","submitter":{"id":37,"url":"https://patchwork.libcamera.org/api/people/37/","name":"Sakari Ailus","email":"sakari.ailus@linux.intel.com"},"content":"Hi Michael,\n\nOn Wed, Apr 12, 2023 at 01:57:36PM +0200, Michael Riesch wrote:\n> Hi Sakari,\n> \n> On 4/12/23 13:50, Sakari Ailus wrote:\n> > Hi Michael,\n> > \n> > On Wed, Apr 12, 2023 at 10:00:26AM +0200, Michael Riesch wrote:\n> >>  - Different controls: If moving = (V4L2_CID_FOCUS_ABSOLUTE == current),\n> >>    then what happens if the application performs a\n> >>    V4L2_CID_FOCUS_RELATIVE with -3? current should reach 39,\n> >>    V4L2_CID_FOCUS_ABSOLUTE is still at 42, the lens is still moving from\n> >>    the application's point of view.\n> > \n> > Would there be a reason to implement both of these controls in a single\n> > driver? AFAIU, the relative one should be used if there absolute value\n> > isn't known to the driver.\n> \n> Probably not, but on the other hand there is nothing the prevents a\n> driver developer from doing so, right? Point is that should there be a\n> driver which does implement both controls, we are in trouble AFAIU.\n\nI think the documentation should be improved in this regard.\n\nAlso cc Hans.","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 55195C0F2A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 12 Apr 2023 12:05:57 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B3EC1627B8;\n\tWed, 12 Apr 2023 14:05:56 +0200 (CEST)","from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 74E5961EBF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 12 Apr 2023 14:05:53 +0200 (CEST)","from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; \n\t12 Apr 2023 05:05:51 -0700","from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com)\n\t([10.237.72.44]) by fmsmga002-auth.fm.intel.com with\n\tESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2023 05:05:49 -0700","from kekkonen.localdomain (localhost [IPv6:::1])\n\tby kekkonen.fi.intel.com (Postfix) with SMTP id 5FBC1120D2E;\n\tWed, 12 Apr 2023 15:05:46 +0300 (EEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1681301156;\n\tbh=iNHXn7Y7088Jm9D91nEHAacZ/cTLuLTbGyvLMhXVDd0=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=ER6Q0p70kpT/yiqEhuv4goM53tsO4twYIjC60Hb/mI+pXXih3jCrl81bxeMEgeGIP\n\t6oR3ivVw6hy35xuvr7P4cvmJx6mg8fcU0vw9voGR8PuO3s2wWzcXRrsOanMxj1OL6W\n\t7y3Iu1R9NZ2RGOe9OZ/3tMOEVkfjuuQ47GP3yyoO68KfjsQ9kQdTExb7gtoE75++1t\n\tUWC1Fmz2k4b3c59SpPXk1wIehuKhMBQ9NR+0ChSQqDeNNMQUs++OTVI9aMu/or+Wq2\n\tD5WvntBbnHer1unf2bHLimGIkiCVM81Y70v8vzK1UWEKiPBgLLRXeVgpLffNnXRyiT\n\tl+EakX7LtdGkA==","v=1; a=rsa-sha256; c=relaxed/simple;\n\td=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n\tt=1681301153; x=1712837153;\n\th=date:from:to:cc:subject:message-id:references:\n\tmime-version:in-reply-to;\n\tbh=iNHXn7Y7088Jm9D91nEHAacZ/cTLuLTbGyvLMhXVDd0=;\n\tb=cXbrlEsceLCdBAWxIJVtLFHqUE01/KWPCJ8yR4jtf2Nlu+AtFgUcmEOL\n\tAx2pWYLq6RoUm/X3MIsj4eEiNq9Dpjd4Hop4H+se4ef9fJbDJ/Kqe6M+f\n\tL4DAHmzNeAJZMzrDlay8Wjqz7KLufwUcbFdg6PC7Jc7GaUA7oPU5FASKd\n\tO7BEs1pZ+GGW19PEGKpCkLaiob7g/NPfY000YJ39K+pHOckZZ5S7mcEug\n\tdLMkOm+j+8n2YOR6xiuZ/RdmEJA1a8NrCmBLzS/uGlAgT2DiV/ULdDAx5\n\tJ9No/Xa//68O5sAFR9e+V3CL9kCMUhtegSk8IJ7kccbETtC6k/NhSRxau A==;"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=intel.com header.i=@intel.com\n\theader.b=\"cXbrlEsc\"; dkim-atps=neutral","X-IronPort-AV":["E=McAfee;i=\"6600,9927,10677\"; a=\"332568302\"","E=Sophos;i=\"5.98,339,1673942400\"; d=\"scan'208\";a=\"332568302\"","E=McAfee;i=\"6600,9927,10677\"; a=\"800290120\"","E=Sophos;i=\"5.98,339,1673942400\"; d=\"scan'208\";a=\"800290120\""],"X-ExtLoop1":"1","Date":"Wed, 12 Apr 2023 15:05:46 +0300","To":"Michael Riesch <michael.riesch@wolfvision.net>","Message-ID":"<ZDaemghP0HQSw3Fo@kekkonen.localdomain>","References":"<20230406-feature-controls-lens-v1-0-543189a680de@wolfvision.net>\n\t<20230406-feature-controls-lens-v1-1-543189a680de@wolfvision.net>\n\t<CAPY8ntArOOqPQzvkJrQEyuVFfb6j8x6WODTMHOn1qHPU588mbQ@mail.gmail.com>\n\t<0f1baf5e-2ff6-e10b-5c3e-0a82c71d0ce6@wolfvision.net>\n\t<CAPY8ntAjBEFfeV6nnQs34Y22QM-irT13ALDv4ksP8AYK=jWsKg@mail.gmail.com>\n\t<3ab7bfc4-aaae-2e39-b420-40ad8d71dda4@wolfvision.net>\n\t<ZDaa+qhoZxZ5ymxL@kekkonen.localdomain>\n\t<8fe5c9c5-6eb0-86ae-9e5d-fbaa72be25fe@wolfvision.net>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<8fe5c9c5-6eb0-86ae-9e5d-fbaa72be25fe@wolfvision.net>","Subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Sakari Ailus via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Sakari Ailus <sakari.ailus@linux.intel.com>","Cc":"linux-kernel@vger.kernel.org, hverkuil@xs4all.nl,\n\tMatthias Fend <Matthias.Fend@wolfvision.net>,\n\tlibcamera-devel@lists.libcamera.org,\n\tMauro Carvalho Chehab <mchehab@kernel.org>, Michael Riesch via B4 Relay\n\t<devnull+michael.riesch.wolfvision.net@kernel.org>, \n\tlinux-media@vger.kernel.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26872,"web_url":"https://patchwork.libcamera.org/comment/26872/","msgid":"<77d91964-de0a-8bd4-12d9-bc16110cfa7c@wolfvision.net>","date":"2023-04-12T13:43:26","subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","submitter":{"id":135,"url":"https://patchwork.libcamera.org/api/people/135/","name":"Michael Riesch","email":"michael.riesch@wolfvision.net"},"content":"Hi Sakari,\n\nOn 4/12/23 14:05, Sakari Ailus wrote:\n> Hi Michael,\n> \n> On Wed, Apr 12, 2023 at 01:57:36PM +0200, Michael Riesch wrote:\n>> Hi Sakari,\n>>\n>> On 4/12/23 13:50, Sakari Ailus wrote:\n>>> Hi Michael,\n>>>\n>>> On Wed, Apr 12, 2023 at 10:00:26AM +0200, Michael Riesch wrote:\n>>>>  - Different controls: If moving = (V4L2_CID_FOCUS_ABSOLUTE == current),\n>>>>    then what happens if the application performs a\n>>>>    V4L2_CID_FOCUS_RELATIVE with -3? current should reach 39,\n>>>>    V4L2_CID_FOCUS_ABSOLUTE is still at 42, the lens is still moving from\n>>>>    the application's point of view.\n>>>\n>>> Would there be a reason to implement both of these controls in a single\n>>> driver? AFAIU, the relative one should be used if there absolute value\n>>> isn't known to the driver.\n>>\n>> Probably not, but on the other hand there is nothing the prevents a\n>> driver developer from doing so, right? Point is that should there be a\n>> driver which does implement both controls, we are in trouble AFAIU.\n> \n> I think the documentation should be improved in this regard.\n\nThe documentation of which control exactly? And what items should be added?\n\nThanks for the pointers!\n\nBest regards,\nMichael\n\n> \n> Also cc Hans.\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id E4459BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 12 Apr 2023 13:43:34 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 36F2262754;\n\tWed, 12 Apr 2023 15:43:34 +0200 (CEST)","from EUR05-VI1-obe.outbound.protection.outlook.com\n\t(mail-vi1eur05on2061c.outbound.protection.outlook.com\n\t[IPv6:2a01:111:f400:7d00::61c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6CB6561EBF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 12 Apr 2023 15:43:32 +0200 (CEST)","from DU0PR08MB9155.eurprd08.prod.outlook.com (2603:10a6:10:416::5)\n\tby DB4PR08MB9288.eurprd08.prod.outlook.com (2603:10a6:10:3f4::12)\n\twith Microsoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38;\n\tWed, 12 Apr 2023 13:43:29 +0000","from DU0PR08MB9155.eurprd08.prod.outlook.com\n\t([fe80::77dd:14e4:a772:d85f]) by\n\tDU0PR08MB9155.eurprd08.prod.outlook.com\n\t([fe80::77dd:14e4:a772:d85f%4]) with mapi id 15.20.6277.038;\n\tWed, 12 Apr 2023 13:43:29 +0000"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1681307014;\n\tbh=iYGTvfCWCh7hssjr5fhRrenurNpKnQuKllsmFtTEbjw=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=qCPwk3PRinFeSHH2DNsswYBuKv1YVfhTtdMGpGFal8G4JXkeik9WOtPsmYTV1U+Y/\n\tQp5aPzJHJSx5BQVAJmAJMRAX+Y6dcEE9h280gq+AI2occHV6CO4u5k4QVlWMkIbdVg\n\tYUNUrNhugBjKMvqOPOtYzcdrDfos69jcPTW51JELYteppmHXVffklXjsnNgNiWK5vl\n\tW13+4z4ahm10mr49xB2s3n9xuyXTrvx6wFYp1MANsrnu/nRh+B39q551x9dGZXKEJS\n\tCB7riqL94BvkO+HJ7cyVEioy5+4hzDbjEANXDCXoAU9S39Yl4vPkHw0CLfyYfTtHPy\n\tlIn3LQXXpNGtQ==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net;\n\ts=selector2;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n\tbh=pZm0lkw6e+YNwYph5V8s63DooepVU7rJOtqyrjT4wGM=;\n\tb=EIWhOO1CQJb1/GYBzWItsvu9UrMBjwYpe8yegdNBBMYnTPTG8GFz2HprtaZGiv00FFeamHguG2zbcukbtRFsTFXtAEb0sADUgFKhtpnU4rhI7YxdNDxgmqhuuAsxLJLpCwTHClx1GuBWpSYxFFQRJmwKj5sJocR9suyDmtjeVFY="],"Authentication-Results":["lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=wolfvision.net\n\theader.i=@wolfvision.net\n\theader.b=\"EIWhOO1C\"; dkim-atps=neutral","dkim=none (message not signed)\n\theader.d=none;dmarc=none action=none header.from=wolfvision.net;"],"ARC-Seal":"i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;\n\tb=L1W7d2VZXfMyWbaL+QpXDn0fnSFyIi1lgcuu1o5wnCDz4+y6sDKlNJEGZGviztQaSoP6fUdAcWGheNK+2dLDDJrTwYakZeoc+77R5w/olTjX5bHNy5DoXvb1YISS+I5if7h9/F+z313lQ5RSWztvB9QZ3hFs62XFA69bpItCLzQTcZUYurlMVOtQKeXnGH9MSrGR02VW7Ii+AqNA4YZDZrbfKYtjdD9iCgOngpTVaV2x52r+mFJoQxxYMp/myeJwIFV5x5ZxXhv0Adgtjr8kPHUzPsUVlp2XP7rVKgSoew2HY5UucDn0ngSLpOzTkK+9g6DDZ3Sys3Evm4ssS506AA==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n\ts=arcselector9901;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;\n\tbh=pZm0lkw6e+YNwYph5V8s63DooepVU7rJOtqyrjT4wGM=;\n\tb=aj5QNpUalpOEbpKjDqYd894Xs4ubbDJndJ1+Tgdgf06qUXFe3lubphCUndHC3lKc4bA7TrH2oNumrQkld0ElCeT4ABmo5yjB9A8e1SbDQxOoMahqF2/DZi5osomYiuB1cLv4hPXYM8YucgHaOK/D8T7quCe5MhnUlEoN6P1KT98PyyFSks35oz9pszCzOL0galDlC5gY2LQfigu4utW/rSh5TOJTZtEv/1aNPKnZHN8oE7rmoJKQY/4+bqxaG1ZvbOyfHNRc36azGmukAznIPVqMeLBtb7UHO3ICCO6qxm68GO69kcE2QqnjbyFCYEUCCXFkds4xGgFHt0aHbxFymA==","ARC-Authentication-Results":"i=1; mx.microsoft.com 1; spf=pass\n\tsmtp.mailfrom=wolfvision.net; dmarc=pass action=none\n\theader.from=wolfvision.net; dkim=pass header.d=wolfvision.net;\n\tarc=none","Message-ID":"<77d91964-de0a-8bd4-12d9-bc16110cfa7c@wolfvision.net>","Date":"Wed, 12 Apr 2023 15:43:26 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101\n\tThunderbird/102.9.0","Content-Language":"en-US","To":"Sakari Ailus <sakari.ailus@linux.intel.com>","References":"<20230406-feature-controls-lens-v1-0-543189a680de@wolfvision.net>\n\t<20230406-feature-controls-lens-v1-1-543189a680de@wolfvision.net>\n\t<CAPY8ntArOOqPQzvkJrQEyuVFfb6j8x6WODTMHOn1qHPU588mbQ@mail.gmail.com>\n\t<0f1baf5e-2ff6-e10b-5c3e-0a82c71d0ce6@wolfvision.net>\n\t<CAPY8ntAjBEFfeV6nnQs34Y22QM-irT13ALDv4ksP8AYK=jWsKg@mail.gmail.com>\n\t<3ab7bfc4-aaae-2e39-b420-40ad8d71dda4@wolfvision.net>\n\t<ZDaa+qhoZxZ5ymxL@kekkonen.localdomain>\n\t<8fe5c9c5-6eb0-86ae-9e5d-fbaa72be25fe@wolfvision.net>\n\t<ZDaemghP0HQSw3Fo@kekkonen.localdomain>","Organization":"WolfVision GmbH","In-Reply-To":"<ZDaemghP0HQSw3Fo@kekkonen.localdomain>","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"7bit","X-ClientProxiedBy":"VI1PR0401CA0024.eurprd04.prod.outlook.com\n\t(2603:10a6:800:4a::34) To DU0PR08MB9155.eurprd08.prod.outlook.com\n\t(2603:10a6:10:416::5)","MIME-Version":"1.0","X-MS-PublicTrafficType":"Email","X-MS-TrafficTypeDiagnostic":"DU0PR08MB9155:EE_|DB4PR08MB9288:EE_","X-MS-Office365-Filtering-Correlation-Id":"87c83fa3-8ab2-46fe-8462-08db3b5be629","X-MS-Exchange-SenderADCheck":"1","X-MS-Exchange-AntiSpam-Relay":"0","X-Microsoft-Antispam":"BCL:0;","X-Microsoft-Antispam-Message-Info":"hkf5Xbc0LbCltnbTamdEBwSpg93mOE4fwHcn+8QeYnE1E6+y/tHc4nbDwTXdSKYe0rIUtM9z8xogV9D4UgVfTrx7O4EQpdmSJncL0OWMTALmGU8CJNnSKJiW8sTj7LTfTANOTwGAHgS+wbg9VEVoyjcpSTE/1NB0EPl+8HOjxZZSwzlSoDosx3l78FgtBxktJdgN9QiGj1Sy66+50behC4/X/GdxKYVKl+j8EfdIMLDQir0Mj0I6wJvNAmXtpc1MeiLv5DnwPODyEcm0rW/yvPY3EC1fE4WSTo5iBIU+gECRlFavUmOlBygwGW54xj1pp3hq38nNta0jVGrMLSR7eJP2RBu+VimiWLMVXJaIK7F/avuKMYU+QF3rVJA0+rD8q4oHzVmdK3vMmB6HkyXTf6U20JXk3l4kydmIu7kMG2n25uIUosIqbA3qQ1aUqU1gWttLkVxF6eHs4k/EFLdKZVAIc0gOvc1jpNOYbsfmWwUhlKeUHG813cvWtC6acPhRRECyAQmtU80EeY2nj/yM2rV6IWOnzCwhfj571pwF+IWY7Kg1B3uV7vc/CNK8cYK45ztCg58dPw1GTabn7uBGa7tWVo3oEvHznUeZqpfdu2ELGZS+//b1CRMjkB/qXORn3ocQUH4A+D2VwSB2Jg27Vw==","X-Forefront-Antispam-Report":"CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;\n\tIPV:NLI; SFV:NSPM; H:DU0PR08MB9155.eurprd08.prod.outlook.com; PTR:;\n\tCAT:NONE; \n\tSFS:(13230028)(4636009)(366004)(39840400004)(376002)(346002)(396003)(136003)(451199021)(6666004)(8936002)(36916002)(44832011)(6486002)(5660300002)(86362001)(4326008)(31696002)(66556008)(6916009)(53546011)(66476007)(66946007)(8676002)(478600001)(38100700002)(316002)(31686004)(54906003)(2906002)(6506007)(6512007)(2616005)(186003)(41300700001)(36756003)(26005)(45980500001)(43740500002);\n\tDIR:OUT; SFP:1101; ","X-MS-Exchange-AntiSpam-MessageData-ChunkCount":"1","X-MS-Exchange-AntiSpam-MessageData-0":"=?utf-8?q?xToA4oCysw5MOHvV4GTvtYZ43?=\n\t=?utf-8?q?nZgRT8Gg4zQiBb4n5MiZnVEVdj+MosydTan5f10VhzzOM0RMYQkFG3Gl?=\n\t=?utf-8?q?MWfuZ6niC7JDCmJVoP8ewrC7oK+XK6QRm3XdLDKJImVTBMmXH/EdL3Vz?=\n\t=?utf-8?q?ffVolCtirtF4KuJjTi6C7IK1ghsKSfGrGyl2bLUhJhuLgLCFEK/1de+K?=\n\t=?utf-8?q?ZLbldc5FI/QBZWfv6mKsre0Ua9qpC3JVa3XAwLsllzGwGgH0VbEtb+I8?=\n\t=?utf-8?q?mHYkU6tY+nS3zCIILyg9OkK3LLXyPJxHYj7mG9RCINARZvkHMH+gOejY?=\n\t=?utf-8?q?8S1+OEAoQ+iGy+x5LzYSM2o8xfPR903gC9KTUhnQEeqEOHkGZ2hkis5S?=\n\t=?utf-8?q?SDvkcqGYWrNrGs98jPOQcjXrQ6ED0MIMvUT+8rIiyctK0824y+tICblv?=\n\t=?utf-8?q?AXXdIFbAt3z108WnLjVNMRzfMCE8mIvX3Nf4EasJ0UN2OpsNxoMbAxbn?=\n\t=?utf-8?q?gw5nNff5WG1JdZiUv5ngQbS5cjqYcPrJyBKBu4DxNlJhfSSUnh5nLTt/?=\n\t=?utf-8?q?9H0qugHYKKFZf5RNgssII7WWR2F996q6r9GxtwPvemHLEEY9f4j1Yxel?=\n\t=?utf-8?q?JsaKxZCHHryWum6cqsCPQg3IxYcdHgJMMi+UMMeYT/xV7XO1VREVeTXm?=\n\t=?utf-8?q?ylPyq8xTO3yywbvb+sW+WmU2N8r5PeTVHGYMvCqgUPddkQMhHYVqzriA?=\n\t=?utf-8?q?KTk5gvWHU1C+tQZUhavdwwmexS4Gglh3sl/unH5zT+KzCT0MBJBqTC1G?=\n\t=?utf-8?q?NqqrdQDANgVZlzNC9dX6MpBc/YJycojG3vPDAiKBobAoNu3KPK+O7fO4?=\n\t=?utf-8?q?p3GKHPgHKGqECM9CB7axhAWtlnlo5nlVcVtqvMaWoKKRAwfUPEhIA9Yz?=\n\t=?utf-8?q?kLdaR2LJpx6AlR2ItOSf8UOkdIcsyEjkVL5Cb00DJz6c+R9/8nTMv/eY?=\n\t=?utf-8?q?thaai+bYPsaopUMaZvy2zafjJTWK+diZY9gYJDxBTLJVdjFmZxYZ3I3U?=\n\t=?utf-8?q?SdIryaRpH3ELurqMqQU3xhWtqFDptwZ5SKQEHKfh72mO0qKQppxLHfvz?=\n\t=?utf-8?q?K0++l24SHHyU49RxZwICvpJ+nM8spnflX7UEhUMBQ87GmXET2TlVRx72?=\n\t=?utf-8?q?Tw1lvHBuMUn2UIctC4MnVws1ZqeCPafxzDl4/VyZodpgFiVsx70aKnUF?=\n\t=?utf-8?q?Gz5tUcQRV+VFW7k63FPwx8QnmQ+4CQx/LN4JEZ9b0lYMY0VhbrUmnhsl?=\n\t=?utf-8?q?x8RTsguPkHTrboWMK5RWhPa/YG5oswTav0xZ5WvUwr7BaI8tr0zU7aUC?=\n\t=?utf-8?q?vmB+rKb6lc4+T/ISNU6JyVrMRJ/veykM17yh54tpx4bRNiq1f2I+OJRf?=\n\t=?utf-8?q?d+66dfoTVFISz0E8g8q9RjdNqIT6j/s11FgmdQUhLI6AiPla/vD/87rC?=\n\t=?utf-8?q?zkOpktXdJEe9rpj+okJb3s1RAWLNn6WSEBbdMtgvKdIAHiXYWhB2ZbV/?=\n\t=?utf-8?q?VCzdTrzQp21GCVtLFmH562zk4+qrmLfYwuqmufvz7DFfyATs1DKfMcmw?=\n\t=?utf-8?q?gm0i3AwjheXesO7XhpLpSAU8AQgdaJxfXGm8cezs8Fhfpe8poCyXlsOl?=\n\t=?utf-8?q?4eyfiNG8qCmMNNbW8Nvz6JIva0pPUJH7rVoYXf7M/zkuJUmHkzxbPbud?=\n\t=?utf-8?q?QRXaObqVr9uIb2cY/xLkkQQC9d4DIeiKqkLwFu0gy4bJ+UtfxY=3D?=","X-OriginatorOrg":"wolfvision.net","X-MS-Exchange-CrossTenant-Network-Message-Id":"87c83fa3-8ab2-46fe-8462-08db3b5be629","X-MS-Exchange-CrossTenant-AuthSource":"DU0PR08MB9155.eurprd08.prod.outlook.com","X-MS-Exchange-CrossTenant-AuthAs":"Internal","X-MS-Exchange-CrossTenant-OriginalArrivalTime":"12 Apr 2023 13:43:29.4332\n\t(UTC)","X-MS-Exchange-CrossTenant-FromEntityHeader":"Hosted","X-MS-Exchange-CrossTenant-Id":"e94ec9da-9183-471e-83b3-51baa8eb804f","X-MS-Exchange-CrossTenant-MailboxType":"HOSTED","X-MS-Exchange-CrossTenant-UserPrincipalName":"TZi/jaHXebmoWbp6cFSt0jXGwqGDrzuJzTMAC0GOUoIVEMVDecPndSiCEBU5FrmDhCnLIGKxrSIZ6LYb6LDpzKE8NCgCsH6EGy3jZZ1Vzz8=","X-MS-Exchange-Transport-CrossTenantHeadersStamped":"DB4PR08MB9288","Subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Michael Riesch via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Michael Riesch <michael.riesch@wolfvision.net>","Cc":"linux-kernel@vger.kernel.org, hverkuil@xs4all.nl,\n\tMatthias Fend <Matthias.Fend@wolfvision.net>,\n\tlibcamera-devel@lists.libcamera.org,\n\tMauro Carvalho Chehab <mchehab@kernel.org>, Michael Riesch via B4 Relay\n\t<devnull+michael.riesch.wolfvision.net@kernel.org>, \n\tlinux-media@vger.kernel.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26873,"web_url":"https://patchwork.libcamera.org/comment/26873/","msgid":"<CAPY8ntCNuvgmF37kDvVh1kuepbLqy2hWcz9HOi8iub9trHmi2g@mail.gmail.com>","date":"2023-04-12T13:55:56","subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","submitter":{"id":27,"url":"https://patchwork.libcamera.org/api/people/27/","name":"Dave Stevenson","email":"dave.stevenson@raspberrypi.com"},"content":"Hi Michael\n\nOn Wed, 12 Apr 2023 at 09:00, Michael Riesch\n<michael.riesch@wolfvision.net> wrote:\n>\n> Hi Dave,\n>\n> On 4/11/23 20:15, Dave Stevenson wrote:\n> > Hi Michael\n> >\n> > On Tue, 11 Apr 2023 at 18:33, Michael Riesch\n> > <michael.riesch@wolfvision.net> wrote:\n> >>\n> >> Hi Dave,\n> >>\n> >> On 4/6/23 17:16, Dave Stevenson wrote:\n> >>> Hi Michael\n> >>>\n> >>> Thanks for the patch.\n> >>>\n> >>> I've got a personal interest here as I'd love to be able to control a\n> >>> couple of CCTV lenses that I have. Those have standard motors with\n> >>> potentiometers for position feedback, not stepper motors, but\n> >>> otherwise have the same limitations of slow movement.\n> >>\n> >> That's great to hear :-) Thank you for your feedback!\n> >>\n> >>> On Thu, 6 Apr 2023 at 15:31, Michael Riesch via B4 Relay via\n> >>> libcamera-devel <libcamera-devel@lists.libcamera.org> wrote:\n> >>>>\n> >>>> From: Michael Riesch <michael.riesch@wolfvision.net>\n> >>>>\n> >>>> Add the controls V4L2_CID_FOCUS_STATUS and V4L2_CID_ZOOM_STATUS that report\n> >>>> the status of the zoom lens group and the focus lens group, respectively.\n> >>>> The returned data structure contains the current position of the lens group\n> >>>> as well as movement indication flags.\n> >>>>\n> >>>> Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>\n> >>>> ---\n> >>>>  .../userspace-api/media/v4l/ext-ctrls-camera.rst   | 48 ++++++++++++++++++++++\n> >>>>  drivers/media/v4l2-core/v4l2-ctrls-core.c          |  9 ++++\n> >>>>  drivers/media/v4l2-core/v4l2-ctrls-defs.c          |  7 ++++\n> >>>>  include/media/v4l2-ctrls.h                         |  2 +\n> >>>>  include/uapi/linux/v4l2-controls.h                 | 13 ++++++\n> >>>>  include/uapi/linux/videodev2.h                     |  2 +\n> >>>>  6 files changed, 81 insertions(+)\n> >>>>\n> >>>> diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst\n> >>>> index daa4f40869f8..3a270bc63f1a 100644\n> >>>> --- a/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst\n> >>>> +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst\n> >>>> @@ -149,6 +149,30 @@ enum v4l2_exposure_metering -\n> >>>>      to the camera, negative values towards infinity. This is a\n> >>>>      write-only control.\n> >>>>\n> >>>> +``V4L2_CID_FOCUS_STATUS (struct)``\n> >>>> +    The current status of the focus lens group. This is a read-only control.\n> >>>> +    The returned data structure contains the current position and movement\n> >>>> +    indication flags. The unit of the current position is undefined. Positive\n> >>>> +    values move the focus closer to the camera, negative values towards\n> >>>> +    infinity. The possible flags are described in the table below.\n> >>>\n> >>> The units are undefined, but positive and negative mean something with\n> >>> respect to some unspecified focal distance represented by 0. That\n> >>> seems a little odd.\n> >>>\n> >>> I was going to suggest that it seems to make sense to follow the same\n> >>> units as V4L2_CID_FOCUS_ABSOLUTE, but on reading that description in\n> >>> [1] it's the same text.\n> >>> I suspect there was a little too much copy/paste from\n> >>> V4L2_CID_FOCUS_RELATIVE, or the intent was that increasing the value\n> >>> brings the focus closer, and decreasing moves it towards infinity.\n> >>>\n> >>> If we did specify that it was the same units as\n> >>> V4L2_CID_FOCUS_ABSOLUTE, then what would that mean for use with\n> >>> V4L2_CID_FOCUS_RELATIVE? Then again the only user of _RELATIVE appears\n> >>> to be ov5693 with atomisp and that just maps it onto _ABSOLUTE, so\n> >>> potentially it's redundant and could be deprecated.\n> >>>\n> >>> [1] https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/ext-ctrls-camera.html\n> >>\n> >> I think we agree that the _STATUS controls should use the same unit as\n> >> the corresponding _ABSOLUTE control, whatever that may be.\n> >>\n> >> Then, the question is whether the description of FOCUS_ABSOLUTE needs to\n> >> be revised. I would agree that the intention probably was: \"Larger\n> >> values move the focus closer to the camera, smaller values move the\n> >> focus to infinity.\" (cf. the phrasing in the description of IRIS_ABSOLUTE).\n> >>\n> >> It would be interesting to know whether zero and negative values are\n> >> (intentionally?) included. Since they are not explicitly excluded, my\n> >> driver exposes the position of the lens in motor steps to the user\n> >> space. If the values were (supposed to be) restricted to positive values\n> >> like ZOOM_ABSOLUTE, this would not be allowed of course.\n> >>\n> >> As to the relation to _RELATIVE, I think it should be clear that all\n> >> controls should act on the same scale and I don't see any problems here.\n> >> However, feel free to point out what I am missing :-)\n> >>\n> >>>> +\n> >>>> +.. tabularcolumns:: |p{6.8cm}|p{10.7cm}|\n> >>>> +\n> >>>> +.. flat-table::\n> >>>> +    :header-rows:  0\n> >>>> +    :stub-columns: 0\n> >>>> +\n> >>>> +    * - ``V4L2_LENS_STATUS_IDLE``\n> >>>> +      - Focus lens group is at rest.\n> >>>> +    * - ``V4L2_LENS_STATUS_BUSY``\n> >>>> +      - Focus lens group is moving.\n> >>>> +    * - ``V4L2_LENS_STATUS_REACHED``\n> >>>> +      - Focus lens group has reached its target position.\n> >>>> +    * - ``V4L2_LENS_STATUS_FAILED``\n> >>>> +      - Focus lens group has failed to reach its target position. The driver\n> >>>> +       will not transition from this state until another action is performed\n> >>>> +       by an application.\n> >>>\n> >>> When would the lens state transition from V4L2_LENS_STATUS_REACHED to\n> >>> V4L2_LENS_STATUS_IDLE?\n> >>> If it's reached the position then it is at rest, and being at rest is\n> >>> the definition of V4L2_LENS_STATUS_IDLE.\n> >>> Likewise the lens always has a target position based on the control\n> >>> value, so it's always at V4L2_LENS_STATUS_REACHED when it's not\n> >>> moving.\n> >>> Is there a need to have 2 states?\n> >>\n> >> Good point, I need to reconsider that (and possibly remove one of those\n> >> states).\n> >>\n> >>> If the position is the same units as V4L2_CID_FOCUS_ABSOLUTE, then do\n> >>> you leave the determination of state to the application?\n> >>\n> >> I am afraid I don't quite follow.\n> >\n> > If the application sets V4L2_CID_FOCUS_ABSOLUTE to 42, and\n> > V4L2_CID_FOCUS_STATUS returns that the position is now 42, then the\n> > application knows that the lens has reached the requested position. If\n> > the two controls return different values then the lens is still\n> > moving.\n> > What new information does adding an additional status flag give you?\n>\n> I can think of two situations:\n>\n>  - Hardware error: the lens stops at 40 (for whatever reason). Since 40\n>    != 42 the lens is still moving, although a hardware error has occured\n>    that may need recovery or at least reporting.\n\nAre you thinking of the lens drive having totally failed, or just that\nthe requested position is out of the achievable range?\n\nLooking at the flash controls[1], hardware failures are handled by\nV4L2_CID_FLASH_FAULT as a separate control.\n\n[1] https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/ext-ctrls-flash.html\n\n>  - Different controls: If moving = (V4L2_CID_FOCUS_ABSOLUTE == current),\n>    then what happens if the application performs a\n>    V4L2_CID_FOCUS_RELATIVE with -3? current should reach 39,\n>    V4L2_CID_FOCUS_ABSOLUTE is still at 42, the lens is still moving from\n>    the application's point of view.\n\nV4L2_CID_FOCUS_RELATIVE really ought to die IMHO, or at least work in\nco-operation with V4L2_CID_FOCUS_ABSOLUTE such that the absolute\ncurrent position can always be retrieved.\n\nUsing _RELATIVE to set a position that is outside of the range defined\nby _ABSOLUTE is meaningless. Any call to S_CTRL on _RELATIVE almost\nhas to be followed by a call to G_CTRL _ABSOLUTE to know the final\nresult, so why not just make a S_CTRL _ABSOLUTE call in the first\nplace.\n\nI guess _RELATIVE may have uses in the case where there is no\nread-back of the position at all, but in that case I don't see a way\nthat your new controls could be implemented.\n\n> Don't get me wrong, a simple control that reports the current position\n> would be way easier. But I feel that we may regret this in the future.\n> Also, I would not use two separate controls \"current\" and \"flags/status\"\n> in order to avoid non-atomic access patterns.\n\nI have no fixed views, but overcomplicating things is generally bad news.\n\n> > (Thinking aloud) I guess you have got my case where your readback is\n> > via an ADC so that the position may fluctuate slightly due to\n> > conversion noise. The control loop for applying power to the motors\n> > will presumably stop at some point and stop trying to adjust the\n> > position, so potentially it could be the state returned from that\n> > control loop. However the noisy ADC position could also be solved by\n> > the position being returned by the control loop instead of giving the\n> > raw value.\n>\n> With stepper motors the readback is not that noisy, but in any case the\n> flags field allows an underlying controller to signal certain conditions\n> without relying on the exact value of the current position. I think that\n> is a plus, especially for noisy readback.\n>\n> >> But FWIW the application should read out the flags to find out whether\n> >> the lens is moving and, if this is not the case, whether the last move\n> >> command (FOCUS_ABSOLUTE or FOCUS_RELATIVE) has succeeded or failed. The\n> >> failed state is important as there might be the possibility that\n> >> depending on the zoom lens position certain focus positions are not\n> >> available (and vice versa).\n> >\n> > How would you configure those kinds of restrictions in the kernel\n> > driver? Is the kernel driver the best place to do it (so many things\n> > are being kicked back to userspace these days)?\n>\n> In our case we have a hardware controller that needs to handle the\n> restrictions anyway in order to avoid mechanical damage. The kernel\n> driver is only responsible for reading out the controller status and\n> transforming it into the V4L2 control.\n\nHow does userspace know what the valid ranges are? Do you end up with\nthe same restrictions having to be coded in both your controller and\nuserspace, or are you relying on the driver reporting back this error\nstatus with userspace not knowing by how much it got it wrong by?\n\n> I am not sure how any restrictions can be reliably handled in software,\n> hence I don't have a strong opinion on whether this is done in kernel or\n> user space.\n>\n> > If it is to be done in the kernel, then shouldn't eg changing the zoom\n> > position alter the ranges advertised for the relevant focus controls?\n>\n> While it should be possible to update the minimum and maximum of e.g.,\n> FOCUS_ABSOLUTE, I am not sure whether the interface is designed for\n> frequent re-reading of the range.\n\nThere's nothing in there that stops you, and several hooks to help you.\nUpdating V4L2_CID_VBLANK on most raw sensors will update the range on\nV4L2_CID_EXPOSURE, as the exposure period can't be longer than the\nframe period. It would be similar that each change to ZOOM_ABSOLUTE\nwould result in a range adjustment to FOCUS_ABSOLUTE.\nUserspace can also use VIDIOC_SUBSCRIBE_EVENT to subscribe to any\nupdates in controls, so it gets told automatically of any updates.\n\n> > If the ranges aren't updated, where should that out-of-range lens\n> > movement leave the lens?\n>\n> This is up to the hardware controller, but I would guess it typically\n> stops one step before disaster. Wherever that may be, the error\n> condition and the current position can be read out via this new STATUS\n> control.\n>\n> Does this sound good so far?\n\nSounds reasonable, but I'm not the gatekeeper (that would be Sakari or\nLaurent), and I'm just expressing my views based on the lenses I've\nencountered.\nAll of my lenses have a single drive for focus, a single drive for\nzoom, and where there are multiple elements they are all connected\nmechanically. Your setup sounds far more complex and is likely to need\na more extensive driver, but it'd be nice to not unnecessarily\novercomplicate the interface.\n\n  Dave\n\n> Best regards,\n> Michael\n>\n> >\n> >   Dave\n> >\n> >>>>  ``V4L2_CID_FOCUS_AUTO (boolean)``\n> >>>>      Enables continuous automatic focus adjustments. The effect of manual\n> >>>>      focus adjustments while this feature is enabled is undefined,\n> >>>> @@ -239,6 +263,30 @@ enum v4l2_auto_focus_range -\n> >>>>      movement. A negative value moves the zoom lens group towards the\n> >>>>      wide-angle direction. The zoom speed unit is driver-specific.\n> >>>>\n> >>>> +``V4L2_CID_ZOOM_STATUS (struct)``\n> >>>> +    The current status of the zoom lens group. This is a read-only control.\n> >>>> +    The returned data structure contains the current position and movement\n> >>>> +    indication flags. The unit of the current position is driver-specific and\n> >>>> +    its value should be a positive integer. The possible flags are described\n> >>>> +    in the table below.\n> >>>> +\n> >>>> +.. tabularcolumns:: |p{6.8cm}|p{10.7cm}|\n> >>>> +\n> >>>> +.. flat-table::\n> >>>> +    :header-rows:  0\n> >>>> +    :stub-columns: 0\n> >>>> +\n> >>>> +    * - ``V4L2_LENS_STATUS_IDLE``\n> >>>> +      - Zoom lens group is at rest.\n> >>>> +    * - ``V4L2_LENS_STATUS_BUSY``\n> >>>> +      - Zoom lens group is moving.\n> >>>> +    * - ``V4L2_LENS_STATUS_REACHED``\n> >>>> +      - Zoom lens group has reached its target position.\n> >>>> +    * - ``V4L2_LENS_STATUS_FAILED``\n> >>>> +      - Zoom lens group has failed to reach its target position. The driver will\n> >>>> +       not transition from this state until another action is performed by an\n> >>>> +       application.\n> >>>> +\n> >>>>  ``V4L2_CID_IRIS_ABSOLUTE (integer)``\n> >>>>      This control sets the camera's aperture to the specified value. The\n> >>>>      unit is undefined. Larger values open the iris wider, smaller values\n> >>>> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-core.c b/drivers/media/v4l2-core/v4l2-ctrls-core.c\n> >>>> index 29169170880a..f6ad30f311c5 100644\n> >>>> --- a/drivers/media/v4l2-core/v4l2-ctrls-core.c\n> >>>> +++ b/drivers/media/v4l2-core/v4l2-ctrls-core.c\n> >>>> @@ -350,6 +350,9 @@ void v4l2_ctrl_type_op_log(const struct v4l2_ctrl *ctrl)\n> >>>>         case V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS:\n> >>>>                 pr_cont(\"HEVC_DECODE_PARAMS\");\n> >>>>                 break;\n> >>>> +       case V4L2_CTRL_TYPE_LENS_STATUS:\n> >>>> +               pr_cont(\"LENS_STATUS\");\n> >>>> +               break;\n> >>>>         default:\n> >>>>                 pr_cont(\"unknown type %d\", ctrl->type);\n> >>>>                 break;\n> >>>> @@ -918,6 +921,9 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx,\n> >>>>                         return -EINVAL;\n> >>>>                 break;\n> >>>>\n> >>>> +       case V4L2_CTRL_TYPE_LENS_STATUS:\n> >>>> +               break;\n> >>>> +\n> >>>>         default:\n> >>>>                 return -EINVAL;\n> >>>>         }\n> >>>> @@ -1605,6 +1611,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl,\n> >>>>         case V4L2_CTRL_TYPE_AREA:\n> >>>>                 elem_size = sizeof(struct v4l2_area);\n> >>>>                 break;\n> >>>> +       case V4L2_CTRL_TYPE_LENS_STATUS:\n> >>>> +               elem_size = sizeof(struct v4l2_ctrl_lens_status);\n> >>>> +               break;\n> >>>>         default:\n> >>>>                 if (type < V4L2_CTRL_COMPOUND_TYPES)\n> >>>>                         elem_size = sizeof(s32);\n> >>>> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c\n> >>>> index 564fedee2c88..9b26a3aa9e9c 100644\n> >>>> --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c\n> >>>> +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c\n> >>>> @@ -1044,6 +1044,8 @@ const char *v4l2_ctrl_get_name(u32 id)\n> >>>>         case V4L2_CID_CAMERA_ORIENTATION:       return \"Camera Orientation\";\n> >>>>         case V4L2_CID_CAMERA_SENSOR_ROTATION:   return \"Camera Sensor Rotation\";\n> >>>>         case V4L2_CID_HDR_SENSOR_MODE:          return \"HDR Sensor Mode\";\n> >>>> +       case V4L2_CID_FOCUS_STATUS:             return \"Focus, Status\";\n> >>>> +       case V4L2_CID_ZOOM_STATUS:              return \"Zoom, Status\";\n> >>>\n> >>> Is there a need for the comma in the text strings?\n> >>\n> >> Not sure, actually. Some other strings used commas. Monkey see, monkey do.\n> >>\n> >> Best regards,\n> >> Michael\n> >>\n> >>>\n> >>> Cheers\n> >>>   Dave\n> >>>\n> >>>>\n> >>>>         /* FM Radio Modulator controls */\n> >>>>         /* Keep the order of the 'case's the same as in v4l2-controls.h! */\n> >>>> @@ -1593,6 +1595,11 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,\n> >>>>                 *flags |= V4L2_CTRL_FLAG_WRITE_ONLY |\n> >>>>                           V4L2_CTRL_FLAG_EXECUTE_ON_WRITE;\n> >>>>                 break;\n> >>>> +       case V4L2_CID_FOCUS_STATUS:\n> >>>> +       case V4L2_CID_ZOOM_STATUS:\n> >>>> +               *type = V4L2_CTRL_TYPE_LENS_STATUS;\n> >>>> +               *flags |= V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_VOLATILE;\n> >>>> +               break;\n> >>>>         case V4L2_CID_FLASH_STROBE_STATUS:\n> >>>>         case V4L2_CID_AUTO_FOCUS_STATUS:\n> >>>>         case V4L2_CID_FLASH_READY:\n> >>>> diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h\n> >>>> index e59d9a234631..f7273ffc20c9 100644\n> >>>> --- a/include/media/v4l2-ctrls.h\n> >>>> +++ b/include/media/v4l2-ctrls.h\n> >>>> @@ -52,6 +52,7 @@ struct video_device;\n> >>>>   * @p_hdr10_cll:               Pointer to an HDR10 Content Light Level structure.\n> >>>>   * @p_hdr10_mastering:         Pointer to an HDR10 Mastering Display structure.\n> >>>>   * @p_area:                    Pointer to an area.\n> >>>> + * @p_lens_status:             Pointer to a lens status structure.\n> >>>>   * @p:                         Pointer to a compound value.\n> >>>>   * @p_const:                   Pointer to a constant compound value.\n> >>>>   */\n> >>>> @@ -81,6 +82,7 @@ union v4l2_ctrl_ptr {\n> >>>>         struct v4l2_ctrl_hdr10_cll_info *p_hdr10_cll;\n> >>>>         struct v4l2_ctrl_hdr10_mastering_display *p_hdr10_mastering;\n> >>>>         struct v4l2_area *p_area;\n> >>>> +       struct v4l2_ctrl_lens_status *p_lens_status;\n> >>>>         void *p;\n> >>>>         const void *p_const;\n> >>>>  };\n> >>>> diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h\n> >>>> index 5e80daa4ffe0..8b037467ba9a 100644\n> >>>> --- a/include/uapi/linux/v4l2-controls.h\n> >>>> +++ b/include/uapi/linux/v4l2-controls.h\n> >>>> @@ -993,6 +993,19 @@ enum v4l2_auto_focus_range {\n> >>>>\n> >>>>  #define V4L2_CID_HDR_SENSOR_MODE               (V4L2_CID_CAMERA_CLASS_BASE+36)\n> >>>>\n> >>>> +struct v4l2_ctrl_lens_status {\n> >>>> +       __u32 flags;\n> >>>> +       __s32 current_position;\n> >>>> +};\n> >>>> +\n> >>>> +#define V4L2_LENS_STATUS_IDLE                  (0 << 0)\n> >>>> +#define V4L2_LENS_STATUS_BUSY                  (1 << 0)\n> >>>> +#define V4L2_LENS_STATUS_REACHED               (1 << 1)\n> >>>> +#define V4L2_LENS_STATUS_FAILED                        (1 << 2)\n> >>>> +\n> >>>> +#define V4L2_CID_FOCUS_STATUS                  (V4L2_CID_CAMERA_CLASS_BASE + 37)\n> >>>> +#define V4L2_CID_ZOOM_STATUS                   (V4L2_CID_CAMERA_CLASS_BASE + 38)\n> >>>> +\n> >>>>  /* FM Modulator class control IDs */\n> >>>>\n> >>>>  #define V4L2_CID_FM_TX_CLASS_BASE              (V4L2_CTRL_CLASS_FM_TX | 0x900)\n> >>>> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h\n> >>>> index 17a9b975177a..256c21c68720 100644\n> >>>> --- a/include/uapi/linux/videodev2.h\n> >>>> +++ b/include/uapi/linux/videodev2.h\n> >>>> @@ -1888,6 +1888,8 @@ enum v4l2_ctrl_type {\n> >>>>         V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS        = 0x0272,\n> >>>>         V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX      = 0x0273,\n> >>>>         V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS       = 0x0274,\n> >>>> +\n> >>>> +       V4L2_CTRL_TYPE_LENS_STATUS              = 0x0300,\n> >>>>  };\n> >>>>\n> >>>>  /*  Used in the VIDIOC_QUERYCTRL ioctl for querying controls */\n> >>>>\n> >>>> --\n> >>>> 2.30.2\n> >>>>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 3AD98C0F2A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 12 Apr 2023 13:56:18 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A8AD962754;\n\tWed, 12 Apr 2023 15:56:17 +0200 (CEST)","from mail-ua1-x92e.google.com (mail-ua1-x92e.google.com\n\t[IPv6:2607:f8b0:4864:20::92e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1640E61EBF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 12 Apr 2023 15:56:16 +0200 (CEST)","by mail-ua1-x92e.google.com with SMTP id bh10so9330031uab.13\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 12 Apr 2023 06:56:16 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1681307777;\n\tbh=azSBk5roEvVMJOo87kUB1mKeWceM/RbNGwaUldgb1f0=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=Hyvs9HJ9TVsVc/IFElin1+WUoFpP7oSZnSkr++UL57GyZKwqvsE2Lj5NmyCte8a/u\n\tXuegJrBuPucSkOhYsKezqInJ7OLUPPU4zEMpS7Jmvi1I1RKepYTwECOUd33tEBUmwH\n\tlxgyPzrwv6Fz3ko7UbpMwnynYaZCwWdFQnfHzK2LMQHyulRfRi2tJyW/mP1J4b6IRs\n\tLxxbk4EMIA2T6Rszni9bbidyMVzclgGdhcdaE3HN8ytTktqVxCYtgJ20kQxRwjmf59\n\tVbdDnwegV8Bb6ZlXHTm+uwIItsTkZdJSfwQTQoZqhb4sMp6mQcJizVz4jJ56UQz1uj\n\tsVdlBRnBM/upA==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1681307775;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date:message-id:reply-to;\n\tbh=V76eATIt34s3wc/nCwEAYWCHGgwXGLQ0Gsjr/w1FnI8=;\n\tb=RzHp4YkuO2e1biK5DgN/RdrA+lFmREwYNZkInmcVOXoW5fRWoN4/vlTnpTW6nslhKy\n\tmTaXaOVU1jR0fylElzo9PRAWl2vsjSv3JsNkg9E1uJxnKuEV0QZ45nSjC8TKu9VxJERu\n\tq1uI7UfpUz6doBOgcidWXycwVXBuXNDS15s7rOJjT5H2nHBEoHyBE0E4oZJvUrbl0osh\n\tQoYr9qVN82DqDzegPyi3muEbYHGPPbYyfLh2zKfHKSPw+cVc8ecXockb75SfaP+GQ0E/\n\tYbCjzHf0dXwIXQfwBS9DBQujC/Xy9uGaeRN6Lfk75WNFmaXUnSoKfnwDpSAgcP3MCfPG\n\t1Xqg=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"RzHp4Yku\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112; t=1681307775;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=V76eATIt34s3wc/nCwEAYWCHGgwXGLQ0Gsjr/w1FnI8=;\n\tb=1i9JeRKkop8IS3C3LPr7I2tlYO0DhPbfcg3Z21wkyuLU5IMA0teBja1JIOJWvixTRT\n\tv/2xYRR7HPebOTo2VyEzxTp3Q9ntSvUbiN1KNzV9Qci9LQLQBjffnlRCSeoIA3rAwwQf\n\tymlLTdOPMa4DbmiYo0HSounW7j/aFzRouLgoXVYlKHAER24sxNHkrf1gFckKRyNbdlnb\n\t8tuH4JaYkE30Jcj3w3URp32k6UONlwz8gfdU2nLV4fUuKIGAuamnT36rc+A+3EDwzYGm\n\twdgPVbMrp866u1/ZEwXqlA815PjU6hEWh8K+8Cl7Qz+5h+j6Awh/qcbHH9T/jIhp1x0w\n\tRQDg==","X-Gm-Message-State":"AAQBX9dJN3B0h29Lb7QI1owFrwrLkuKKDstbT/vwwqxkM/CAiS6QD3dN\n\t0800Dpy9o57eK6368itCU92lTs9OS1v7+v285IDTug==","X-Google-Smtp-Source":"AKy350YmflJyx577Hsj3epdx3z96RtWf1ldjX4nI/S+2Qo57dIQslwLCIb1E7ajs02CiaafuO+NmxqlXqOG/kY92i/I=","X-Received":"by 2002:a1f:b607:0:b0:43f:b0aa:62a9 with SMTP id\n\tg7-20020a1fb607000000b0043fb0aa62a9mr1351422vkf.1.1681307773455;\n\tWed, 12 Apr 2023 06:56:13 -0700 (PDT)","MIME-Version":"1.0","References":"<20230406-feature-controls-lens-v1-0-543189a680de@wolfvision.net>\n\t<20230406-feature-controls-lens-v1-1-543189a680de@wolfvision.net>\n\t<CAPY8ntArOOqPQzvkJrQEyuVFfb6j8x6WODTMHOn1qHPU588mbQ@mail.gmail.com>\n\t<0f1baf5e-2ff6-e10b-5c3e-0a82c71d0ce6@wolfvision.net>\n\t<CAPY8ntAjBEFfeV6nnQs34Y22QM-irT13ALDv4ksP8AYK=jWsKg@mail.gmail.com>\n\t<3ab7bfc4-aaae-2e39-b420-40ad8d71dda4@wolfvision.net>","In-Reply-To":"<3ab7bfc4-aaae-2e39-b420-40ad8d71dda4@wolfvision.net>","Date":"Wed, 12 Apr 2023 14:55:56 +0100","Message-ID":"<CAPY8ntCNuvgmF37kDvVh1kuepbLqy2hWcz9HOi8iub9trHmi2g@mail.gmail.com>","To":"Michael Riesch <michael.riesch@wolfvision.net>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Dave Stevenson via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Dave Stevenson <dave.stevenson@raspberrypi.com>","Cc":"linux-kernel@vger.kernel.org,\n\tMatthias Fend <Matthias.Fend@wolfvision.net>, \n\tlibcamera-devel@lists.libcamera.org,\n\tSakari Ailus <sakari.ailus@linux.intel.com>,\n\tMauro Carvalho Chehab <mchehab@kernel.org>, Michael Riesch via B4 Relay\n\t<devnull+michael.riesch.wolfvision.net@kernel.org>, \n\tlinux-media@vger.kernel.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26874,"web_url":"https://patchwork.libcamera.org/comment/26874/","msgid":"<ZDbChgZJHVaaX3/x@kekkonen.localdomain>","date":"2023-04-12T14:39:02","subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","submitter":{"id":37,"url":"https://patchwork.libcamera.org/api/people/37/","name":"Sakari Ailus","email":"sakari.ailus@linux.intel.com"},"content":"Hi Michael,\n\nOn Wed, Apr 12, 2023 at 03:43:26PM +0200, Michael Riesch wrote:\n> Hi Sakari,\n> \n> On 4/12/23 14:05, Sakari Ailus wrote:\n> > Hi Michael,\n> > \n> > On Wed, Apr 12, 2023 at 01:57:36PM +0200, Michael Riesch wrote:\n> >> Hi Sakari,\n> >>\n> >> On 4/12/23 13:50, Sakari Ailus wrote:\n> >>> Hi Michael,\n> >>>\n> >>> On Wed, Apr 12, 2023 at 10:00:26AM +0200, Michael Riesch wrote:\n> >>>>  - Different controls: If moving = (V4L2_CID_FOCUS_ABSOLUTE == current),\n> >>>>    then what happens if the application performs a\n> >>>>    V4L2_CID_FOCUS_RELATIVE with -3? current should reach 39,\n> >>>>    V4L2_CID_FOCUS_ABSOLUTE is still at 42, the lens is still moving from\n> >>>>    the application's point of view.\n> >>>\n> >>> Would there be a reason to implement both of these controls in a single\n> >>> driver? AFAIU, the relative one should be used if there absolute value\n> >>> isn't known to the driver.\n> >>\n> >> Probably not, but on the other hand there is nothing the prevents a\n> >> driver developer from doing so, right? Point is that should there be a\n> >> driver which does implement both controls, we are in trouble AFAIU.\n> > \n> > I think the documentation should be improved in this regard.\n> \n> The documentation of which control exactly? And what items should be added?\n\nBoth V4L2_CID_FOCUS_ABSOLUTE and V4L2_CID_FOCUS_RELATIVE. For the former,\nthe sentence \"Positive values set the focus closer to the camera, negative\nvalues towards infinity.\" doesn't make much sense in the context. For the\nlatter, what I mentioned earlier, i.e. this should be only implemented if\nthe absolute value isn't known. It's not a driver's job to do simple\narithmetics for the user space.\n\nIn fact, it appears that no driver is using V4L2_CID_FOCUS_RELATIVE at the\nmoment. So we could as well deprecate it (or remove from documentation\naltogether).","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id E3C62BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 12 Apr 2023 14:39:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3F804627B8;\n\tWed, 12 Apr 2023 16:39:11 +0200 (CEST)","from mga17.intel.com (mga17.intel.com [192.55.52.151])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 988D161EBF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 12 Apr 2023 16:39:09 +0200 (CEST)","from orsmga003.jf.intel.com ([10.7.209.27])\n\tby fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; \n\t12 Apr 2023 07:39:07 -0700","from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com)\n\t([10.237.72.44]) by orsmga003-auth.jf.intel.com with\n\tESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2023 07:39:05 -0700","from kekkonen.localdomain (localhost [IPv6:::1])\n\tby kekkonen.fi.intel.com (Postfix) with SMTP id 7EF49120D2E;\n\tWed, 12 Apr 2023 17:39:02 +0300 (EEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1681310351;\n\tbh=DZ+4bqcOwGArNUff5c6q4WqLlSztJS1TSKOKE8pP2P4=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=M1Jc8sy76824sm46H1HxVhCevSIIsfpCt9ZakZMTNceHkBPGzJt/PniMhkQ78JRC8\n\tevxiUlS8LUt1aHcSXSSpAXBRDaVFG4/HpO6UJiJnrk4+5EJOqYMCW82qztvSaqz+XA\n\tqJMwV6koQ1o4V1ZSkTWIxwk1gGJ4/2dWCoYz5uHoNDaL5drpddKD/AmkTC1XjpnPHm\n\tiPQpub8QycGwoRsvzICuB4y84bpz2aNylG7iU84DMyboU4ux31eiCYF2wwZjCCrYGj\n\tW45DaIUtWqfqzvzVgg/fpG3wwLST0diwkYP9nXI30dRuilSse0QZ+CPBH8XwRL5kb0\n\to/jZOfol2x0Ig==","v=1; a=rsa-sha256; c=relaxed/simple;\n\td=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n\tt=1681310349; x=1712846349;\n\th=date:from:to:cc:subject:message-id:references:\n\tmime-version:in-reply-to;\n\tbh=DZ+4bqcOwGArNUff5c6q4WqLlSztJS1TSKOKE8pP2P4=;\n\tb=NFbU0lN+kFFYJzZWK1MCEbKb2no7YqwKEIWRwS7KDi53b2LPGdu8FctW\n\tl2xKHCT5iidqRjo9WKgGC1iRerBI2hx50nUVC/HTDH1Rg+/IziP8dfnBN\n\tA+ZqsSWKbmlZuWkup7Tm677S8V0+fL1dH3tt6fZdSRKLpAkgyAM8An4CI\n\tfBfLoZbm0VaGoqfhMvKz445dxpuxiJuhV5Hmh7TYCcX6bHh8uL23sXDQd\n\tDM7VuRZOl7XH+AYTb2MEBe+YEVtwDYcbTNLGKJOvaOmiMqQ5ukl5n2V//\n\tTAwm50863EWsDVxRa6ikkYhTdiLpKc+QjWcvTq3Bymj+Y+2snqeitP0L8 w==;"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=intel.com header.i=@intel.com\n\theader.b=\"NFbU0lN+\"; dkim-atps=neutral","X-IronPort-AV":["E=McAfee;i=\"6600,9927,10678\"; a=\"324277259\"","E=Sophos;i=\"5.98,339,1673942400\"; d=\"scan'208\";a=\"324277259\"","E=McAfee;i=\"6600,9927,10678\"; a=\"639258064\"","E=Sophos;i=\"5.98,339,1673942400\"; d=\"scan'208\";a=\"639258064\""],"X-ExtLoop1":"1","Date":"Wed, 12 Apr 2023 17:39:02 +0300","To":"Michael Riesch <michael.riesch@wolfvision.net>","Message-ID":"<ZDbChgZJHVaaX3/x@kekkonen.localdomain>","References":"<20230406-feature-controls-lens-v1-0-543189a680de@wolfvision.net>\n\t<20230406-feature-controls-lens-v1-1-543189a680de@wolfvision.net>\n\t<CAPY8ntArOOqPQzvkJrQEyuVFfb6j8x6WODTMHOn1qHPU588mbQ@mail.gmail.com>\n\t<0f1baf5e-2ff6-e10b-5c3e-0a82c71d0ce6@wolfvision.net>\n\t<CAPY8ntAjBEFfeV6nnQs34Y22QM-irT13ALDv4ksP8AYK=jWsKg@mail.gmail.com>\n\t<3ab7bfc4-aaae-2e39-b420-40ad8d71dda4@wolfvision.net>\n\t<ZDaa+qhoZxZ5ymxL@kekkonen.localdomain>\n\t<8fe5c9c5-6eb0-86ae-9e5d-fbaa72be25fe@wolfvision.net>\n\t<ZDaemghP0HQSw3Fo@kekkonen.localdomain>\n\t<77d91964-de0a-8bd4-12d9-bc16110cfa7c@wolfvision.net>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<77d91964-de0a-8bd4-12d9-bc16110cfa7c@wolfvision.net>","Subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Sakari Ailus via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Sakari Ailus <sakari.ailus@linux.intel.com>","Cc":"linux-kernel@vger.kernel.org, hverkuil@xs4all.nl,\n\tMatthias Fend <Matthias.Fend@wolfvision.net>,\n\tlibcamera-devel@lists.libcamera.org,\n\tMauro Carvalho Chehab <mchehab@kernel.org>, Michael Riesch via B4 Relay\n\t<devnull+michael.riesch.wolfvision.net@kernel.org>, \n\tlinux-media@vger.kernel.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26875,"web_url":"https://patchwork.libcamera.org/comment/26875/","msgid":"<CAPY8ntCH7JGoKhF2igXUb1WKQgq+rppVjcqUds=oz-TOzL8uWg@mail.gmail.com>","date":"2023-04-12T14:57:41","subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","submitter":{"id":27,"url":"https://patchwork.libcamera.org/api/people/27/","name":"Dave Stevenson","email":"dave.stevenson@raspberrypi.com"},"content":"Hi Sakari\n\nOn Wed, 12 Apr 2023 at 15:39, Sakari Ailus <sakari.ailus@linux.intel.com> wrote:\n>\n> Hi Michael,\n>\n> On Wed, Apr 12, 2023 at 03:43:26PM +0200, Michael Riesch wrote:\n> > Hi Sakari,\n> >\n> > On 4/12/23 14:05, Sakari Ailus wrote:\n> > > Hi Michael,\n> > >\n> > > On Wed, Apr 12, 2023 at 01:57:36PM +0200, Michael Riesch wrote:\n> > >> Hi Sakari,\n> > >>\n> > >> On 4/12/23 13:50, Sakari Ailus wrote:\n> > >>> Hi Michael,\n> > >>>\n> > >>> On Wed, Apr 12, 2023 at 10:00:26AM +0200, Michael Riesch wrote:\n> > >>>>  - Different controls: If moving = (V4L2_CID_FOCUS_ABSOLUTE == current),\n> > >>>>    then what happens if the application performs a\n> > >>>>    V4L2_CID_FOCUS_RELATIVE with -3? current should reach 39,\n> > >>>>    V4L2_CID_FOCUS_ABSOLUTE is still at 42, the lens is still moving from\n> > >>>>    the application's point of view.\n> > >>>\n> > >>> Would there be a reason to implement both of these controls in a single\n> > >>> driver? AFAIU, the relative one should be used if there absolute value\n> > >>> isn't known to the driver.\n> > >>\n> > >> Probably not, but on the other hand there is nothing the prevents a\n> > >> driver developer from doing so, right? Point is that should there be a\n> > >> driver which does implement both controls, we are in trouble AFAIU.\n> > >\n> > > I think the documentation should be improved in this regard.\n> >\n> > The documentation of which control exactly? And what items should be added?\n>\n> Both V4L2_CID_FOCUS_ABSOLUTE and V4L2_CID_FOCUS_RELATIVE. For the former,\n> the sentence \"Positive values set the focus closer to the camera, negative\n> values towards infinity.\" doesn't make much sense in the context. For the\n> latter, what I mentioned earlier, i.e. this should be only implemented if\n> the absolute value isn't known. It's not a driver's job to do simple\n> arithmetics for the user space.\n>\n> In fact, it appears that no driver is using V4L2_CID_FOCUS_RELATIVE at the\n> moment. So we could as well deprecate it (or remove from documentation\n> altogether).\n\nAtomisp and ov5693 are using it, but only to manipulate the value\nbehind V4L2_CID_FOCUS_ABSOLUTE. I don't know why elixir.bootlin.com\nisn't picking up those references.\n\nhttps://github.com/torvalds/linux/blob/master/drivers/staging/media/atomisp/pci/atomisp_ioctl.c#L1766\nhttps://github.com/torvalds/linux/blob/master/drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c#L966\n\n  Dave","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id EE855C0F2A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 12 Apr 2023 14:58:01 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2388161EBF;\n\tWed, 12 Apr 2023 16:58:01 +0200 (CEST)","from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com\n\t[IPv6:2607:f8b0:4864:20::62b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9723161EBF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 12 Apr 2023 16:57:59 +0200 (CEST)","by mail-pl1-x62b.google.com with SMTP id 21so3483527plg.12\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 12 Apr 2023 07:57:59 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1681311481;\n\tbh=EVVNDc+I1qK71TjLAEs7F7Fdrn4ld/JN3gnAGV4yHNQ=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=MhENY6U9x1gvrhMEab1icQ5NgWU7C1dNBvf09JKJZLVpvsWJ001UbZD/kzr28M/gn\n\t1Y+bPAOayTYTOxhmpvO/wj2IkDduPy4tV//VcKMMnh+/NZiKatkaIL36DGJK3qLycZ\n\tx3KXigEHIWU+0xtKWOL4xzNndzmMpysfXti5sjCKHrhn30X9xH3ZPgzjKZPFU2FR1i\n\tiRb3vFCy2EfiaDgdI+9vduC8k+oYlJHGuYU3yc3pDR2iLoA5GfxxpU1U1l60EdX0XD\n\tMKLj1B6/JSLotGbH/Wp4w39f+wxi33uRHm1ZD30Bz9OdoHPf7+Z7e14Rhgu4qZayVz\n\tvB1UX/kEKwDdQ==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1681311478;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date:message-id:reply-to;\n\tbh=AOKR8Lz3kBZgqVb/OenB7evT3Akr/P4smMGFj0QIOY8=;\n\tb=gZvmIjIEHDpRGgNSyhQ86rTPD+s4DrasSAXS0wE4CxImy3hlC1GyTaX3hxe87HTAX8\n\tGWce9VJXYwEAst7g78JCbzm1FQu3ZpLHp7LmJaECJRb0pZXo5uaEU8IC2Okvj7RFBO4q\n\t9wHOifzkmuk+nF27ibKh7XbThNjfWtyENGJn1aotJlwh1NoshhYMzLyv36fefKLtSM9n\n\tNIvhkdhmGwG9qajhB1YJK662myTyO2g+9FVhNjFpT1ZIw34IdTrDCuC75g7E3IEh4h+J\n\tuvvVM3j2+uIlhH4+yPHC7PKtXi9YDa0TqGnqlc8KmL1Eazy81vrGTXQa6hr4kXES/GLP\n\tbiXg=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"gZvmIjIE\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112; t=1681311478;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=AOKR8Lz3kBZgqVb/OenB7evT3Akr/P4smMGFj0QIOY8=;\n\tb=fonmejvIPLidwJrgpe2KXrdblnofy94uk3UAYgMvf71+/ae81AUGzPgaYxZcFQjf56\n\tX4ZtaT7sboJ5pNuv4q3PwGWYWU23dNgB1xHujtpv6wpGwpuuViTrVyjD5mONU4NyemYJ\n\t8i0z7nJTLXpHbhFFuVDsyD9ZWGmEkBrxqQRIhL1XzVJVzFlh8TFQAtzaoQpFYxmtKic0\n\txBfKA3Rm/aY3Agdqw8CAZEVzLFC5nGgVNMTVPgmuvseeRsDxi4hg4v8MShYOfMLXHWwx\n\tmlyVUb8ODr1Mf5WFMdCKtsdrGX6jx/n0nQvHpI5jG+QTfGlMwrcsWqzMlXKAIEKD3j/j\n\tb4pA==","X-Gm-Message-State":"AAQBX9cSdv+GZgIaDV30PNZeGwpy0+dtB5qRo4H6D/5UPWkwO9jh/OxI\n\ty790lbizHXG0yLTrrml7Yorq+YmyxenuhvbbpMx0Hw==","X-Google-Smtp-Source":"AKy350ZYD4NP8Wfaf7X1KUVN//Ob7xD0plHgJWTtVpg6jEykpInoOJhi1zGs4U5cVd7hDRTQAlbAB90k5Pd68UX4I/M=","X-Received":"by 2002:a17:90a:ae07:b0:246:7023:2ee6 with SMTP id\n\tt7-20020a17090aae0700b0024670232ee6mr2275329pjq.8.1681311477987;\n\tWed, 12 Apr 2023 07:57:57 -0700 (PDT)","MIME-Version":"1.0","References":"<20230406-feature-controls-lens-v1-0-543189a680de@wolfvision.net>\n\t<20230406-feature-controls-lens-v1-1-543189a680de@wolfvision.net>\n\t<CAPY8ntArOOqPQzvkJrQEyuVFfb6j8x6WODTMHOn1qHPU588mbQ@mail.gmail.com>\n\t<0f1baf5e-2ff6-e10b-5c3e-0a82c71d0ce6@wolfvision.net>\n\t<CAPY8ntAjBEFfeV6nnQs34Y22QM-irT13ALDv4ksP8AYK=jWsKg@mail.gmail.com>\n\t<3ab7bfc4-aaae-2e39-b420-40ad8d71dda4@wolfvision.net>\n\t<ZDaa+qhoZxZ5ymxL@kekkonen.localdomain>\n\t<8fe5c9c5-6eb0-86ae-9e5d-fbaa72be25fe@wolfvision.net>\n\t<ZDaemghP0HQSw3Fo@kekkonen.localdomain>\n\t<77d91964-de0a-8bd4-12d9-bc16110cfa7c@wolfvision.net>\n\t<ZDbChgZJHVaaX3/x@kekkonen.localdomain>","In-Reply-To":"<ZDbChgZJHVaaX3/x@kekkonen.localdomain>","Date":"Wed, 12 Apr 2023 15:57:41 +0100","Message-ID":"<CAPY8ntCH7JGoKhF2igXUb1WKQgq+rppVjcqUds=oz-TOzL8uWg@mail.gmail.com>","To":"Sakari Ailus <sakari.ailus@linux.intel.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Dave Stevenson via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Dave Stevenson <dave.stevenson@raspberrypi.com>","Cc":"linux-kernel@vger.kernel.org, hverkuil@xs4all.nl,\n\tMatthias Fend <Matthias.Fend@wolfvision.net>,\n\tlibcamera-devel@lists.libcamera.org,\n\tMauro Carvalho Chehab <mchehab@kernel.org>, Michael Riesch via B4 Relay\n\t<devnull+michael.riesch.wolfvision.net@kernel.org>, \n\tlinux-media@vger.kernel.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26876,"web_url":"https://patchwork.libcamera.org/comment/26876/","msgid":"<ZDbKU5kwcb7RGeCo@kekkonen.localdomain>","date":"2023-04-12T15:12:19","subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","submitter":{"id":37,"url":"https://patchwork.libcamera.org/api/people/37/","name":"Sakari Ailus","email":"sakari.ailus@linux.intel.com"},"content":"Hi Dave, Michael,\n\nOn Wed, Apr 12, 2023 at 02:55:56PM +0100, Dave Stevenson wrote:\n> > > If the ranges aren't updated, where should that out-of-range lens\n> > > movement leave the lens?\n> >\n> > This is up to the hardware controller, but I would guess it typically\n> > stops one step before disaster. Wherever that may be, the error\n> > condition and the current position can be read out via this new STATUS\n> > control.\n> >\n> > Does this sound good so far?\n> \n> Sounds reasonable, but I'm not the gatekeeper (that would be Sakari or\n> Laurent), and I'm just expressing my views based on the lenses I've\n> encountered.\n> All of my lenses have a single drive for focus, a single drive for\n> zoom, and where there are multiple elements they are all connected\n> mechanically. Your setup sounds far more complex and is likely to need\n> a more extensive driver, but it'd be nice to not unnecessarily\n> overcomplicate the interface.\n\nCould we also have a driver that uses these new controls?\n\nThe controls themselves appear reasonable to me as well. I guess there are\nchanges to be made based on the discussion?","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 3993EBD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 12 Apr 2023 15:12:30 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id ACF80627B8;\n\tWed, 12 Apr 2023 17:12:29 +0200 (CEST)","from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 52C9E61EBF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 12 Apr 2023 17:12:27 +0200 (CEST)","from orsmga007.jf.intel.com ([10.7.209.58])\n\tby fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; \n\t12 Apr 2023 08:12:24 -0700","from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com)\n\t([10.237.72.44]) by orsmga007-auth.jf.intel.com with\n\tESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2023 08:12:22 -0700","from kekkonen.localdomain (localhost [IPv6:::1])\n\tby kekkonen.fi.intel.com (Postfix) with SMTP id D0A5611F78C;\n\tWed, 12 Apr 2023 18:12:19 +0300 (EEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1681312349;\n\tbh=ritMmFWx/EQv07wbQLyVpyzAhqQ3TR59ZTTAlw28V1U=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=Hw8w749OO4aC9PXC5viDse6kCyAbisbBPQx8oVXxx7kV9tsFvfhZmkVm7pS00kYIB\n\toDP+qbq12EyqaavYF/uIWYPLweeIKlltO+9dW+UEmjmMkMQ0Rr2fE9nCS/NwxNPhlK\n\tAzqMmb4Q/P44qahaMl4HvH9AjAiPVnzfXXEHgoKzd4zLEruadZfL58qQ+Bc+eiRziS\n\tfaFgQ4Uw4GP+GVC5EPg+OTcDCeJj7FoMUOcfWLMfsq4EFVZl22nCZrKRt61Y9nkN6C\n\tXegZfTi9L7BEJFTCcDS+R9TtYw60kCSZ0LS0aFRd0G7O/BQwgEDol89x5974tQgAZy\n\tlbgcqGHzVMrHA==","v=1; a=rsa-sha256; c=relaxed/simple;\n\td=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n\tt=1681312347; x=1712848347;\n\th=date:from:to:cc:subject:message-id:references:\n\tmime-version:in-reply-to;\n\tbh=ritMmFWx/EQv07wbQLyVpyzAhqQ3TR59ZTTAlw28V1U=;\n\tb=Jw7GsZ4dcWI3JFlHRbOOmfdw8mQnBKCeIETHewHqtdC5teM4vB9CK+Yt\n\tr0IOrSIBJxIQT6968v6F9TD6ZaXTVB7Hhz/aS+TFxo4Y7T+rI/F5JmZwU\n\tmlSAmDSjQXidTDwgtzhPFBs6/wUgNh0e6vYkNXEFLfBIqLAZiL/eFQ4uN\n\tYo+LjhETk6msD76vVJeWWNp8Sf28QX/JQaVxKUIsn3qDM0XfOm/D8nFA1\n\tEf6CZnv/vzor2j0PgHzqz/wANMqp+Lvo5QB0hoNOm8bTHCERVzmjt0iko\n\t7R3AQQXlO1Z6otFWLXVSGoq24ay7kZz5ibcT9Ax9NGFj7iV3DmI6V7rq9 A==;"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=intel.com header.i=@intel.com\n\theader.b=\"Jw7GsZ4d\"; dkim-atps=neutral","X-IronPort-AV":["E=McAfee;i=\"6600,9927,10678\"; a=\"341419661\"","E=Sophos;i=\"5.98,339,1673942400\"; d=\"scan'208\";a=\"341419661\"","E=McAfee;i=\"6600,9927,10678\"; a=\"682501553\"","E=Sophos;i=\"5.98,339,1673942400\"; d=\"scan'208\";a=\"682501553\""],"X-ExtLoop1":"1","Date":"Wed, 12 Apr 2023 18:12:19 +0300","To":"Dave Stevenson <dave.stevenson@raspberrypi.com>","Message-ID":"<ZDbKU5kwcb7RGeCo@kekkonen.localdomain>","References":"<20230406-feature-controls-lens-v1-0-543189a680de@wolfvision.net>\n\t<20230406-feature-controls-lens-v1-1-543189a680de@wolfvision.net>\n\t<CAPY8ntArOOqPQzvkJrQEyuVFfb6j8x6WODTMHOn1qHPU588mbQ@mail.gmail.com>\n\t<0f1baf5e-2ff6-e10b-5c3e-0a82c71d0ce6@wolfvision.net>\n\t<CAPY8ntAjBEFfeV6nnQs34Y22QM-irT13ALDv4ksP8AYK=jWsKg@mail.gmail.com>\n\t<3ab7bfc4-aaae-2e39-b420-40ad8d71dda4@wolfvision.net>\n\t<CAPY8ntCNuvgmF37kDvVh1kuepbLqy2hWcz9HOi8iub9trHmi2g@mail.gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<CAPY8ntCNuvgmF37kDvVh1kuepbLqy2hWcz9HOi8iub9trHmi2g@mail.gmail.com>","Subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Sakari Ailus via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Sakari Ailus <sakari.ailus@linux.intel.com>","Cc":"linux-kernel@vger.kernel.org,\n\tMatthias Fend <Matthias.Fend@wolfvision.net>, \n\tlibcamera-devel@lists.libcamera.org,\n\tMauro Carvalho Chehab <mchehab@kernel.org>, Michael Riesch via B4 Relay\n\t<devnull+michael.riesch.wolfvision.net@kernel.org>, \n\tlinux-media@vger.kernel.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26886,"web_url":"https://patchwork.libcamera.org/comment/26886/","msgid":"<3d7b078e-0777-f850-6b95-9dfbff236653@wolfvision.net>","date":"2023-04-17T08:29:50","subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","submitter":{"id":135,"url":"https://patchwork.libcamera.org/api/people/135/","name":"Michael Riesch","email":"michael.riesch@wolfvision.net"},"content":"Hi Dave,\n\nOn 4/12/23 15:55, Dave Stevenson wrote:\n> Hi Michael\n> \n> On Wed, 12 Apr 2023 at 09:00, Michael Riesch\n> <michael.riesch@wolfvision.net> wrote:\n>>\n>> Hi Dave,\n>>\n>> On 4/11/23 20:15, Dave Stevenson wrote:\n>>> Hi Michael\n>>>\n>>> On Tue, 11 Apr 2023 at 18:33, Michael Riesch\n>>> <michael.riesch@wolfvision.net> wrote:\n>>>>\n>>>> Hi Dave,\n>>>>\n>>>> On 4/6/23 17:16, Dave Stevenson wrote:\n>>>>> Hi Michael\n>>>>>\n>>>>> Thanks for the patch.\n>>>>>\n>>>>> I've got a personal interest here as I'd love to be able to control a\n>>>>> couple of CCTV lenses that I have. Those have standard motors with\n>>>>> potentiometers for position feedback, not stepper motors, but\n>>>>> otherwise have the same limitations of slow movement.\n>>>>\n>>>> That's great to hear :-) Thank you for your feedback!\n>>>>\n>>>>> On Thu, 6 Apr 2023 at 15:31, Michael Riesch via B4 Relay via\n>>>>> libcamera-devel <libcamera-devel@lists.libcamera.org> wrote:\n>>>>>>\n>>>>>> From: Michael Riesch <michael.riesch@wolfvision.net>\n>>>>>>\n>>>>>> Add the controls V4L2_CID_FOCUS_STATUS and V4L2_CID_ZOOM_STATUS that report\n>>>>>> the status of the zoom lens group and the focus lens group, respectively.\n>>>>>> The returned data structure contains the current position of the lens group\n>>>>>> as well as movement indication flags.\n>>>>>>\n>>>>>> Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>\n>>>>>> ---\n>>>>>>  .../userspace-api/media/v4l/ext-ctrls-camera.rst   | 48 ++++++++++++++++++++++\n>>>>>>  drivers/media/v4l2-core/v4l2-ctrls-core.c          |  9 ++++\n>>>>>>  drivers/media/v4l2-core/v4l2-ctrls-defs.c          |  7 ++++\n>>>>>>  include/media/v4l2-ctrls.h                         |  2 +\n>>>>>>  include/uapi/linux/v4l2-controls.h                 | 13 ++++++\n>>>>>>  include/uapi/linux/videodev2.h                     |  2 +\n>>>>>>  6 files changed, 81 insertions(+)\n>>>>>>\n>>>>>> diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst\n>>>>>> index daa4f40869f8..3a270bc63f1a 100644\n>>>>>> --- a/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst\n>>>>>> +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst\n>>>>>> @@ -149,6 +149,30 @@ enum v4l2_exposure_metering -\n>>>>>>      to the camera, negative values towards infinity. This is a\n>>>>>>      write-only control.\n>>>>>>\n>>>>>> +``V4L2_CID_FOCUS_STATUS (struct)``\n>>>>>> +    The current status of the focus lens group. This is a read-only control.\n>>>>>> +    The returned data structure contains the current position and movement\n>>>>>> +    indication flags. The unit of the current position is undefined. Positive\n>>>>>> +    values move the focus closer to the camera, negative values towards\n>>>>>> +    infinity. The possible flags are described in the table below.\n>>>>>\n>>>>> The units are undefined, but positive and negative mean something with\n>>>>> respect to some unspecified focal distance represented by 0. That\n>>>>> seems a little odd.\n>>>>>\n>>>>> I was going to suggest that it seems to make sense to follow the same\n>>>>> units as V4L2_CID_FOCUS_ABSOLUTE, but on reading that description in\n>>>>> [1] it's the same text.\n>>>>> I suspect there was a little too much copy/paste from\n>>>>> V4L2_CID_FOCUS_RELATIVE, or the intent was that increasing the value\n>>>>> brings the focus closer, and decreasing moves it towards infinity.\n>>>>>\n>>>>> If we did specify that it was the same units as\n>>>>> V4L2_CID_FOCUS_ABSOLUTE, then what would that mean for use with\n>>>>> V4L2_CID_FOCUS_RELATIVE? Then again the only user of _RELATIVE appears\n>>>>> to be ov5693 with atomisp and that just maps it onto _ABSOLUTE, so\n>>>>> potentially it's redundant and could be deprecated.\n>>>>>\n>>>>> [1] https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/ext-ctrls-camera.html\n>>>>\n>>>> I think we agree that the _STATUS controls should use the same unit as\n>>>> the corresponding _ABSOLUTE control, whatever that may be.\n>>>>\n>>>> Then, the question is whether the description of FOCUS_ABSOLUTE needs to\n>>>> be revised. I would agree that the intention probably was: \"Larger\n>>>> values move the focus closer to the camera, smaller values move the\n>>>> focus to infinity.\" (cf. the phrasing in the description of IRIS_ABSOLUTE).\n>>>>\n>>>> It would be interesting to know whether zero and negative values are\n>>>> (intentionally?) included. Since they are not explicitly excluded, my\n>>>> driver exposes the position of the lens in motor steps to the user\n>>>> space. If the values were (supposed to be) restricted to positive values\n>>>> like ZOOM_ABSOLUTE, this would not be allowed of course.\n>>>>\n>>>> As to the relation to _RELATIVE, I think it should be clear that all\n>>>> controls should act on the same scale and I don't see any problems here.\n>>>> However, feel free to point out what I am missing :-)\n>>>>\n>>>>>> +\n>>>>>> +.. tabularcolumns:: |p{6.8cm}|p{10.7cm}|\n>>>>>> +\n>>>>>> +.. flat-table::\n>>>>>> +    :header-rows:  0\n>>>>>> +    :stub-columns: 0\n>>>>>> +\n>>>>>> +    * - ``V4L2_LENS_STATUS_IDLE``\n>>>>>> +      - Focus lens group is at rest.\n>>>>>> +    * - ``V4L2_LENS_STATUS_BUSY``\n>>>>>> +      - Focus lens group is moving.\n>>>>>> +    * - ``V4L2_LENS_STATUS_REACHED``\n>>>>>> +      - Focus lens group has reached its target position.\n>>>>>> +    * - ``V4L2_LENS_STATUS_FAILED``\n>>>>>> +      - Focus lens group has failed to reach its target position. The driver\n>>>>>> +       will not transition from this state until another action is performed\n>>>>>> +       by an application.\n>>>>>\n>>>>> When would the lens state transition from V4L2_LENS_STATUS_REACHED to\n>>>>> V4L2_LENS_STATUS_IDLE?\n>>>>> If it's reached the position then it is at rest, and being at rest is\n>>>>> the definition of V4L2_LENS_STATUS_IDLE.\n>>>>> Likewise the lens always has a target position based on the control\n>>>>> value, so it's always at V4L2_LENS_STATUS_REACHED when it's not\n>>>>> moving.\n>>>>> Is there a need to have 2 states?\n>>>>\n>>>> Good point, I need to reconsider that (and possibly remove one of those\n>>>> states).\n>>>>\n>>>>> If the position is the same units as V4L2_CID_FOCUS_ABSOLUTE, then do\n>>>>> you leave the determination of state to the application?\n>>>>\n>>>> I am afraid I don't quite follow.\n>>>\n>>> If the application sets V4L2_CID_FOCUS_ABSOLUTE to 42, and\n>>> V4L2_CID_FOCUS_STATUS returns that the position is now 42, then the\n>>> application knows that the lens has reached the requested position. If\n>>> the two controls return different values then the lens is still\n>>> moving.\n>>> What new information does adding an additional status flag give you?\n>>\n>> I can think of two situations:\n>>\n>>  - Hardware error: the lens stops at 40 (for whatever reason). Since 40\n>>    != 42 the lens is still moving, although a hardware error has occured\n>>    that may need recovery or at least reporting.\n> \n> Are you thinking of the lens drive having totally failed, or just that\n> the requested position is out of the achievable range?\n\nI would say the latter. At least one of our optics (with one focus lens\nand two zoom lenses) exhibits nontrivial constraints for the range of\nthe individual lenses.\n\n> Looking at the flash controls[1], hardware failures are handled by\n> V4L2_CID_FLASH_FAULT as a separate control.\n> \n> [1] https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/ext-ctrls-flash.html\n> \n>>  - Different controls: If moving = (V4L2_CID_FOCUS_ABSOLUTE == current),\n>>    then what happens if the application performs a\n>>    V4L2_CID_FOCUS_RELATIVE with -3? current should reach 39,\n>>    V4L2_CID_FOCUS_ABSOLUTE is still at 42, the lens is still moving from\n>>    the application's point of view.\n> \n> V4L2_CID_FOCUS_RELATIVE really ought to die IMHO, or at least work in\n> co-operation with V4L2_CID_FOCUS_ABSOLUTE such that the absolute\n> current position can always be retrieved.\n> \n> Using _RELATIVE to set a position that is outside of the range defined\n> by _ABSOLUTE is meaningless. Any call to S_CTRL on _RELATIVE almost\n> has to be followed by a call to G_CTRL _ABSOLUTE to know the final\n> result, so why not just make a S_CTRL _ABSOLUTE call in the first\n> place.\n> \n> I guess _RELATIVE may have uses in the case where there is no\n> read-back of the position at all, but in that case I don't see a way\n> that your new controls could be implemented.\n\nI am quite neutral to this. We don't plan to use the _RELATIVE controls\nand if you want to get rid of them there won't be any objections from\nour side.\n\nIf the drivers should only implement either ABSOLUTE or RELATIVE then\nsituation I described above is not an issue, of course.\n\n>> Don't get me wrong, a simple control that reports the current position\n>> would be way easier. But I feel that we may regret this in the future.\n>> Also, I would not use two separate controls \"current\" and \"flags/status\"\n>> in order to avoid non-atomic access patterns.\n> \n> I have no fixed views, but overcomplicating things is generally bad news.\n> \n>>> (Thinking aloud) I guess you have got my case where your readback is\n>>> via an ADC so that the position may fluctuate slightly due to\n>>> conversion noise. The control loop for applying power to the motors\n>>> will presumably stop at some point and stop trying to adjust the\n>>> position, so potentially it could be the state returned from that\n>>> control loop. However the noisy ADC position could also be solved by\n>>> the position being returned by the control loop instead of giving the\n>>> raw value.\n>>\n>> With stepper motors the readback is not that noisy, but in any case the\n>> flags field allows an underlying controller to signal certain conditions\n>> without relying on the exact value of the current position. I think that\n>> is a plus, especially for noisy readback.\n>>\n>>>> But FWIW the application should read out the flags to find out whether\n>>>> the lens is moving and, if this is not the case, whether the last move\n>>>> command (FOCUS_ABSOLUTE or FOCUS_RELATIVE) has succeeded or failed. The\n>>>> failed state is important as there might be the possibility that\n>>>> depending on the zoom lens position certain focus positions are not\n>>>> available (and vice versa).\n>>>\n>>> How would you configure those kinds of restrictions in the kernel\n>>> driver? Is the kernel driver the best place to do it (so many things\n>>> are being kicked back to userspace these days)?\n>>\n>> In our case we have a hardware controller that needs to handle the\n>> restrictions anyway in order to avoid mechanical damage. The kernel\n>> driver is only responsible for reading out the controller status and\n>> transforming it into the V4L2 control.\n> \n> How does userspace know what the valid ranges are? Do you end up with\n> the same restrictions having to be coded in both your controller and\n> userspace, or are you relying on the driver reporting back this error\n> status with userspace not knowing by how much it got it wrong by?\n\nMaybe I should clarify a bit the use cases here. Most of the time the\nZOOM_ABSOLUTE and FOCUS_ABSOLUTE controls will be used to operate the\noptics. Here, AFAIK there should not be any constraints (or at least,\nthey are handled by the lens controller hardware) and user space can\npick any value between the minimum and maximum of the respective control.\n\nThe situation is more complicated for the calibration. Here, individual\nlenses can be moved and may be subject to certain constraints. Before\nthe calibration, the limits may be unknown or estimated. Then, one\napproach could be to set the target position of a lens to INT_MAX and\nread back the status. The error status plus the current position could\nthen yield the actual limit.\n\nNote that such calibration techniques are very specialized use cases,\nbut with the proposed API it should be possible to cover several\ndifferent approaches.\n\n>> I am not sure how any restrictions can be reliably handled in software,\n>> hence I don't have a strong opinion on whether this is done in kernel or\n>> user space.\n>>\n>>> If it is to be done in the kernel, then shouldn't eg changing the zoom\n>>> position alter the ranges advertised for the relevant focus controls?\n>>\n>> While it should be possible to update the minimum and maximum of e.g.,\n>> FOCUS_ABSOLUTE, I am not sure whether the interface is designed for\n>> frequent re-reading of the range.\n> \n> There's nothing in there that stops you, and several hooks to help you.\n> Updating V4L2_CID_VBLANK on most raw sensors will update the range on\n> V4L2_CID_EXPOSURE, as the exposure period can't be longer than the\n> frame period. It would be similar that each change to ZOOM_ABSOLUTE\n> would result in a range adjustment to FOCUS_ABSOLUTE.\n> Userspace can also use VIDIOC_SUBSCRIBE_EVENT to subscribe to any\n> updates in controls, so it gets told automatically of any updates.\n\nOK, maybe we'll give this some more thought!\n\nThanks a lot for your comments!\n\nBest regards,\nMichael\n\n>>> If the ranges aren't updated, where should that out-of-range lens\n>>> movement leave the lens?\n>>\n>> This is up to the hardware controller, but I would guess it typically\n>> stops one step before disaster. Wherever that may be, the error\n>> condition and the current position can be read out via this new STATUS\n>> control.\n>>\n>> Does this sound good so far?\n> \n> Sounds reasonable, but I'm not the gatekeeper (that would be Sakari or\n> Laurent), and I'm just expressing my views based on the lenses I've\n> encountered.\n> All of my lenses have a single drive for focus, a single drive for\n> zoom, and where there are multiple elements they are all connected\n> mechanically. Your setup sounds far more complex and is likely to need\n> a more extensive driver, but it'd be nice to not unnecessarily\n> overcomplicate the interface.\n> \n>   Dave\n> \n>> Best regards,\n>> Michael\n>>\n>>>\n>>>   Dave\n>>>\n>>>>>>  ``V4L2_CID_FOCUS_AUTO (boolean)``\n>>>>>>      Enables continuous automatic focus adjustments. The effect of manual\n>>>>>>      focus adjustments while this feature is enabled is undefined,\n>>>>>> @@ -239,6 +263,30 @@ enum v4l2_auto_focus_range -\n>>>>>>      movement. A negative value moves the zoom lens group towards the\n>>>>>>      wide-angle direction. The zoom speed unit is driver-specific.\n>>>>>>\n>>>>>> +``V4L2_CID_ZOOM_STATUS (struct)``\n>>>>>> +    The current status of the zoom lens group. This is a read-only control.\n>>>>>> +    The returned data structure contains the current position and movement\n>>>>>> +    indication flags. The unit of the current position is driver-specific and\n>>>>>> +    its value should be a positive integer. The possible flags are described\n>>>>>> +    in the table below.\n>>>>>> +\n>>>>>> +.. tabularcolumns:: |p{6.8cm}|p{10.7cm}|\n>>>>>> +\n>>>>>> +.. flat-table::\n>>>>>> +    :header-rows:  0\n>>>>>> +    :stub-columns: 0\n>>>>>> +\n>>>>>> +    * - ``V4L2_LENS_STATUS_IDLE``\n>>>>>> +      - Zoom lens group is at rest.\n>>>>>> +    * - ``V4L2_LENS_STATUS_BUSY``\n>>>>>> +      - Zoom lens group is moving.\n>>>>>> +    * - ``V4L2_LENS_STATUS_REACHED``\n>>>>>> +      - Zoom lens group has reached its target position.\n>>>>>> +    * - ``V4L2_LENS_STATUS_FAILED``\n>>>>>> +      - Zoom lens group has failed to reach its target position. The driver will\n>>>>>> +       not transition from this state until another action is performed by an\n>>>>>> +       application.\n>>>>>> +\n>>>>>>  ``V4L2_CID_IRIS_ABSOLUTE (integer)``\n>>>>>>      This control sets the camera's aperture to the specified value. The\n>>>>>>      unit is undefined. Larger values open the iris wider, smaller values\n>>>>>> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-core.c b/drivers/media/v4l2-core/v4l2-ctrls-core.c\n>>>>>> index 29169170880a..f6ad30f311c5 100644\n>>>>>> --- a/drivers/media/v4l2-core/v4l2-ctrls-core.c\n>>>>>> +++ b/drivers/media/v4l2-core/v4l2-ctrls-core.c\n>>>>>> @@ -350,6 +350,9 @@ void v4l2_ctrl_type_op_log(const struct v4l2_ctrl *ctrl)\n>>>>>>         case V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS:\n>>>>>>                 pr_cont(\"HEVC_DECODE_PARAMS\");\n>>>>>>                 break;\n>>>>>> +       case V4L2_CTRL_TYPE_LENS_STATUS:\n>>>>>> +               pr_cont(\"LENS_STATUS\");\n>>>>>> +               break;\n>>>>>>         default:\n>>>>>>                 pr_cont(\"unknown type %d\", ctrl->type);\n>>>>>>                 break;\n>>>>>> @@ -918,6 +921,9 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx,\n>>>>>>                         return -EINVAL;\n>>>>>>                 break;\n>>>>>>\n>>>>>> +       case V4L2_CTRL_TYPE_LENS_STATUS:\n>>>>>> +               break;\n>>>>>> +\n>>>>>>         default:\n>>>>>>                 return -EINVAL;\n>>>>>>         }\n>>>>>> @@ -1605,6 +1611,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl,\n>>>>>>         case V4L2_CTRL_TYPE_AREA:\n>>>>>>                 elem_size = sizeof(struct v4l2_area);\n>>>>>>                 break;\n>>>>>> +       case V4L2_CTRL_TYPE_LENS_STATUS:\n>>>>>> +               elem_size = sizeof(struct v4l2_ctrl_lens_status);\n>>>>>> +               break;\n>>>>>>         default:\n>>>>>>                 if (type < V4L2_CTRL_COMPOUND_TYPES)\n>>>>>>                         elem_size = sizeof(s32);\n>>>>>> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c\n>>>>>> index 564fedee2c88..9b26a3aa9e9c 100644\n>>>>>> --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c\n>>>>>> +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c\n>>>>>> @@ -1044,6 +1044,8 @@ const char *v4l2_ctrl_get_name(u32 id)\n>>>>>>         case V4L2_CID_CAMERA_ORIENTATION:       return \"Camera Orientation\";\n>>>>>>         case V4L2_CID_CAMERA_SENSOR_ROTATION:   return \"Camera Sensor Rotation\";\n>>>>>>         case V4L2_CID_HDR_SENSOR_MODE:          return \"HDR Sensor Mode\";\n>>>>>> +       case V4L2_CID_FOCUS_STATUS:             return \"Focus, Status\";\n>>>>>> +       case V4L2_CID_ZOOM_STATUS:              return \"Zoom, Status\";\n>>>>>\n>>>>> Is there a need for the comma in the text strings?\n>>>>\n>>>> Not sure, actually. Some other strings used commas. Monkey see, monkey do.\n>>>>\n>>>> Best regards,\n>>>> Michael\n>>>>\n>>>>>\n>>>>> Cheers\n>>>>>   Dave\n>>>>>\n>>>>>>\n>>>>>>         /* FM Radio Modulator controls */\n>>>>>>         /* Keep the order of the 'case's the same as in v4l2-controls.h! */\n>>>>>> @@ -1593,6 +1595,11 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,\n>>>>>>                 *flags |= V4L2_CTRL_FLAG_WRITE_ONLY |\n>>>>>>                           V4L2_CTRL_FLAG_EXECUTE_ON_WRITE;\n>>>>>>                 break;\n>>>>>> +       case V4L2_CID_FOCUS_STATUS:\n>>>>>> +       case V4L2_CID_ZOOM_STATUS:\n>>>>>> +               *type = V4L2_CTRL_TYPE_LENS_STATUS;\n>>>>>> +               *flags |= V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_VOLATILE;\n>>>>>> +               break;\n>>>>>>         case V4L2_CID_FLASH_STROBE_STATUS:\n>>>>>>         case V4L2_CID_AUTO_FOCUS_STATUS:\n>>>>>>         case V4L2_CID_FLASH_READY:\n>>>>>> diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h\n>>>>>> index e59d9a234631..f7273ffc20c9 100644\n>>>>>> --- a/include/media/v4l2-ctrls.h\n>>>>>> +++ b/include/media/v4l2-ctrls.h\n>>>>>> @@ -52,6 +52,7 @@ struct video_device;\n>>>>>>   * @p_hdr10_cll:               Pointer to an HDR10 Content Light Level structure.\n>>>>>>   * @p_hdr10_mastering:         Pointer to an HDR10 Mastering Display structure.\n>>>>>>   * @p_area:                    Pointer to an area.\n>>>>>> + * @p_lens_status:             Pointer to a lens status structure.\n>>>>>>   * @p:                         Pointer to a compound value.\n>>>>>>   * @p_const:                   Pointer to a constant compound value.\n>>>>>>   */\n>>>>>> @@ -81,6 +82,7 @@ union v4l2_ctrl_ptr {\n>>>>>>         struct v4l2_ctrl_hdr10_cll_info *p_hdr10_cll;\n>>>>>>         struct v4l2_ctrl_hdr10_mastering_display *p_hdr10_mastering;\n>>>>>>         struct v4l2_area *p_area;\n>>>>>> +       struct v4l2_ctrl_lens_status *p_lens_status;\n>>>>>>         void *p;\n>>>>>>         const void *p_const;\n>>>>>>  };\n>>>>>> diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h\n>>>>>> index 5e80daa4ffe0..8b037467ba9a 100644\n>>>>>> --- a/include/uapi/linux/v4l2-controls.h\n>>>>>> +++ b/include/uapi/linux/v4l2-controls.h\n>>>>>> @@ -993,6 +993,19 @@ enum v4l2_auto_focus_range {\n>>>>>>\n>>>>>>  #define V4L2_CID_HDR_SENSOR_MODE               (V4L2_CID_CAMERA_CLASS_BASE+36)\n>>>>>>\n>>>>>> +struct v4l2_ctrl_lens_status {\n>>>>>> +       __u32 flags;\n>>>>>> +       __s32 current_position;\n>>>>>> +};\n>>>>>> +\n>>>>>> +#define V4L2_LENS_STATUS_IDLE                  (0 << 0)\n>>>>>> +#define V4L2_LENS_STATUS_BUSY                  (1 << 0)\n>>>>>> +#define V4L2_LENS_STATUS_REACHED               (1 << 1)\n>>>>>> +#define V4L2_LENS_STATUS_FAILED                        (1 << 2)\n>>>>>> +\n>>>>>> +#define V4L2_CID_FOCUS_STATUS                  (V4L2_CID_CAMERA_CLASS_BASE + 37)\n>>>>>> +#define V4L2_CID_ZOOM_STATUS                   (V4L2_CID_CAMERA_CLASS_BASE + 38)\n>>>>>> +\n>>>>>>  /* FM Modulator class control IDs */\n>>>>>>\n>>>>>>  #define V4L2_CID_FM_TX_CLASS_BASE              (V4L2_CTRL_CLASS_FM_TX | 0x900)\n>>>>>> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h\n>>>>>> index 17a9b975177a..256c21c68720 100644\n>>>>>> --- a/include/uapi/linux/videodev2.h\n>>>>>> +++ b/include/uapi/linux/videodev2.h\n>>>>>> @@ -1888,6 +1888,8 @@ enum v4l2_ctrl_type {\n>>>>>>         V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS        = 0x0272,\n>>>>>>         V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX      = 0x0273,\n>>>>>>         V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS       = 0x0274,\n>>>>>> +\n>>>>>> +       V4L2_CTRL_TYPE_LENS_STATUS              = 0x0300,\n>>>>>>  };\n>>>>>>\n>>>>>>  /*  Used in the VIDIOC_QUERYCTRL ioctl for querying controls */\n>>>>>>\n>>>>>> --\n>>>>>> 2.30.2\n>>>>>>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 8B3D0BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 17 Apr 2023 08:29:59 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CBD7F627B8;\n\tMon, 17 Apr 2023 10:29:58 +0200 (CEST)","from EUR05-AM6-obe.outbound.protection.outlook.com\n\t(mail-am6eur05on2060b.outbound.protection.outlook.com\n\t[IPv6:2a01:111:f400:7e1b::60b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 06CE7603A1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 17 Apr 2023 10:29:57 +0200 (CEST)","from DU0PR08MB9155.eurprd08.prod.outlook.com (2603:10a6:10:416::5)\n\tby PAXPR08MB6432.eurprd08.prod.outlook.com (2603:10a6:102:154::12)\n\twith Microsoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.45;\n\tMon, 17 Apr 2023 08:29:53 +0000","from DU0PR08MB9155.eurprd08.prod.outlook.com\n\t([fe80::77dd:14e4:a772:d85f]) by\n\tDU0PR08MB9155.eurprd08.prod.outlook.com\n\t([fe80::77dd:14e4:a772:d85f%4]) with mapi id 15.20.6298.045;\n\tMon, 17 Apr 2023 08:29:53 +0000"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1681720198;\n\tbh=Vobe7BQBZemoo9XDo3yyYYaNQe9a/2MOJdEt900LzJo=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=Pk5pTJVt0gQdrUsJFHz4HcnbjznhRxFqcKnWVYpV8QLmaj24RSArSqlnqFzL5urpF\n\tbNMKAuptCFWEcgevNfwJ7714bGVGH7yPmkNbxv9y3AKFibeCencF5G47Af87miM9C3\n\tqL+NndK+mcPscPAjV5nKJpBicrS6zFwGXgfCRr6FxRGZvrn5g42MKSe6inZfJ8xCHh\n\tZe+J/BDY10u/e1KjpMxC+THSkTDN8YknmYWUtxWJqA5oLMs7OgKeYz+94sdWSroJe2\n\twvPSOQdLdBhXQaII6clZgdsGSPaGy9TsRxWrnaE85NbpPm6iE3tnEU3OvZstQJyyIH\n\t2teskME1mZXzQ==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net;\n\ts=selector2;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n\tbh=KsCWQht1eGUOk/0KyMsKVHpH6LvoJeGDeRLLZfirIiM=;\n\tb=sIHDD1Kr/kf3JfDas3BvdKpw6rYlcidJ9Ocj0j0CA33lhxQ66McRcZwD5VGSQNuEGdNXrmkc4W5RmXSWcnzivDbcRZy6mvDFzKN/85Ue8mZ1T2deqAH/G2AQK2kYRWkOQEwARwGS+XIU+xWXKxbqfFjTMHx+YVSemanh08eRSHA="],"Authentication-Results":["lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=wolfvision.net\n\theader.i=@wolfvision.net\n\theader.b=\"sIHDD1Kr\"; dkim-atps=neutral","dkim=none (message not signed)\n\theader.d=none;dmarc=none action=none header.from=wolfvision.net;"],"ARC-Seal":"i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;\n\tb=EU4+plG9V82D9DKgnS/N2VTTMLpgAR1d5Rt2xF6PTCon0hNKHWCeNS+iNyoAU2uBuo/SYJVx389LE8whpxnUZNr8mG831yJrlFJCg2YkZdYUyoiCUbA3yZW1Y7Za7qXe5vvu5/q8+DEulDHp0ccTTZ6AS77kNQk2a2wL+7Cg7mIO7cpd70FBwT/IpZqtoxKdRx1sDAbuRzg/KlvmxaYDGcFUIaijJ5HQfijZoiFHLZyOjRaJb7OBl7jr618/Q1Pn8ymEXyl5e0JxV2A8QsGIYZzbtfCSg1clykry9xRnS8iHx5JOKm6J8vJRLSCIAF7bn6J9V+vtaY/6cVksRhkydw==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n\ts=arcselector9901;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;\n\tbh=KsCWQht1eGUOk/0KyMsKVHpH6LvoJeGDeRLLZfirIiM=;\n\tb=Waq1Kud3xfoMiBg5LwlsX7cko9JOFpGwAxJ81G7lrCg6+PRgYDV7/DRJb7AkWDcDdvGOidLaKRtc9rLdOAYcPtzumRLnAlLy5z1IUBYTk7J5AT80NmyX6WmB5c1LmU3fLBdtkHikSw0tSDq3dvzrFicS18S5rU4P/wrQi2L83WGy/uplgZyNNdZrewSqWdVQx3AyU8zemaEPxlzjWT4V8aL1Iyj/pX4d9D9nlp2VAykJfWKS7L5C/VtnAiDb0GqnBE+GlnftS6g7H+Hb+olxCLccEWYDk0au9lu1zSrpWFpgO0Bw5L2+E8Vx6Jo7MhzTuKwWkb5m7E4SZmpeo9aPPQ==","ARC-Authentication-Results":"i=1; mx.microsoft.com 1; spf=pass\n\tsmtp.mailfrom=wolfvision.net; dmarc=pass action=none\n\theader.from=wolfvision.net; dkim=pass header.d=wolfvision.net;\n\tarc=none","Message-ID":"<3d7b078e-0777-f850-6b95-9dfbff236653@wolfvision.net>","Date":"Mon, 17 Apr 2023 10:29:50 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101\n\tThunderbird/102.9.0","Content-Language":"en-US","To":"Dave Stevenson <dave.stevenson@raspberrypi.com>","References":"<20230406-feature-controls-lens-v1-0-543189a680de@wolfvision.net>\n\t<20230406-feature-controls-lens-v1-1-543189a680de@wolfvision.net>\n\t<CAPY8ntArOOqPQzvkJrQEyuVFfb6j8x6WODTMHOn1qHPU588mbQ@mail.gmail.com>\n\t<0f1baf5e-2ff6-e10b-5c3e-0a82c71d0ce6@wolfvision.net>\n\t<CAPY8ntAjBEFfeV6nnQs34Y22QM-irT13ALDv4ksP8AYK=jWsKg@mail.gmail.com>\n\t<3ab7bfc4-aaae-2e39-b420-40ad8d71dda4@wolfvision.net>\n\t<CAPY8ntCNuvgmF37kDvVh1kuepbLqy2hWcz9HOi8iub9trHmi2g@mail.gmail.com>","In-Reply-To":"<CAPY8ntCNuvgmF37kDvVh1kuepbLqy2hWcz9HOi8iub9trHmi2g@mail.gmail.com>","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"7bit","X-ClientProxiedBy":"ZR0P278CA0124.CHEP278.PROD.OUTLOOK.COM\n\t(2603:10a6:910:20::21) To DU0PR08MB9155.eurprd08.prod.outlook.com\n\t(2603:10a6:10:416::5)","MIME-Version":"1.0","X-MS-PublicTrafficType":"Email","X-MS-TrafficTypeDiagnostic":"DU0PR08MB9155:EE_|PAXPR08MB6432:EE_","X-MS-Office365-Filtering-Correlation-Id":"43b92f9b-23c9-44db-ab48-08db3f1deaeb","X-MS-Exchange-SenderADCheck":"1","X-MS-Exchange-AntiSpam-Relay":"0","X-Microsoft-Antispam":"BCL:0;","X-Microsoft-Antispam-Message-Info":"PpNMXzkIoUSAUyEynidn+oKYFIqWk6P6pGrWTd3ODixQ214HXsp5/k/odFHN+vsjBYW5oXZKDlqglo+3u1Eq/1zlyqoweMTqNbY+ieDPXrjtyfQWWkzq7SXv9Ng2KXiTyU3GIndGO41pdVqv//SRLy6xt7Zw+zdjnc5/dfhA7uU4iMfQY71V9N8ZBszUh3Tl5z5cT+nGhc8+HbfmrZMflQlDO7nEIt37nVBq9fwqIRYC1blSfK1cQEgB0r8bSD1fjZnCkLCij/LgDDMHvl7dZWeajXSG8RDjKNkeh93qIHZPhazgB7Ta65cA5OwWgl1jMmzbh3NOVzQQUGPH4WQBmhREuFGQQXNXGApef9D0q2cmQ5A4wf6zzwCS91XNDq07e4O0BHEVDYEIcz9hZ4XamnGuy/Pt3GzwvH0hC7sjEG+AJKLwyJRa5CslsVWGPWy3r+mH1/QjZLC9TeVyWYjHQFUk7uN7DwjHe81BiSlEMGkMHg6qFYRp7mwEARgmtSvTSYoNIaG56AiMDZHr32EAI4tgHqJ573bCNS63L6vdDTFgSLAboMO1ynimtq9QuRwPQmNXNhfxFui5lt4J/UUGi4/+rZvKepaSKVKeYnKFfM3LDqOIKYXG7UikI11k5uE++yrfV1qYuDhc38e+4JK9kbheLacRJUCLo638ST23Dab0jdgLHtvXiAIfP+2BeTWV","X-Forefront-Antispam-Report":"CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;\n\tIPV:NLI; SFV:NSPM; H:DU0PR08MB9155.eurprd08.prod.outlook.com; PTR:;\n\tCAT:NONE; \n\tSFS:(13230028)(4636009)(346002)(136003)(39840400004)(396003)(366004)(376002)(451199021)(38100700002)(8676002)(8936002)(44832011)(5660300002)(2906002)(30864003)(36756003)(86362001)(31696002)(478600001)(6486002)(54906003)(31686004)(186003)(2616005)(966005)(6506007)(6512007)(53546011)(66946007)(66476007)(83380400001)(316002)(41300700001)(4326008)(6916009)(66556008)(43740500002)(45980500001);\n\tDIR:OUT; SFP:1101; ","X-MS-Exchange-AntiSpam-MessageData-ChunkCount":"1","X-MS-Exchange-AntiSpam-MessageData-0":"=?utf-8?q?6vMo2uQ+7ei7oQV2pn89TD+sd?=\n\t=?utf-8?q?M8XMAtUrLqaJ+Lh5TaAB/w1+DwMvSqSHjoEP5RJSX2NeesG6wez6adqu?=\n\t=?utf-8?q?42m1dw3cHqimMuCfstIX3hYBlKSmm89UVRU8OG4HeSLZt90k74Kz8P8b?=\n\t=?utf-8?q?64xTeYlZc2UJs0mdEnZh2vffjlAcglDHM4eXwfgL4ZiB50QJjdLHiuG8?=\n\t=?utf-8?q?ld/QrKHZU6X/FluEFtZ+8kaoUPqQ+raeC0LKHXPP6BdJ8+tVMoSC9QOD?=\n\t=?utf-8?q?uQVp5sQcFOcMSQtkEXDEcsm3qqZDXrR/tHL8Fcwx2JQda/hMbBushsqK?=\n\t=?utf-8?q?CC1jRt0DQl3cDqfiVlchhMQ4Wdv6bC+qXzwYxQ3zUfT2kFn2C19gl6AI?=\n\t=?utf-8?q?2y8uyXdw1eSScww/FWuV6olt571fMfWeleAOq6yoXTToSwJ621oY/zpi?=\n\t=?utf-8?q?AEI483+GpRNqLvWxFwCzRyaeGa+UgkvNzBqDk9wNKk5IqNG0TzoCNLrb?=\n\t=?utf-8?q?U0KkneHcj6GDhC4hLTtm8qdLVet9z+TpEF+gBBu7e4ZcMjrZetHnlMw7?=\n\t=?utf-8?q?hHlawOgJsDB8k+l/mcLTdwt4/uJj2UVJnuwVrqyRNNVb22yE6ZpoLSJK?=\n\t=?utf-8?q?NEvh5UVV/yOsvCJbTxjTcMHpWepSH5rGVSTs+pGN9X00omjpY8Oq2HGo?=\n\t=?utf-8?q?+7Jf9Bs8ii/6KeGVWywL1nVe1r4X0RxqZWck8t8cQPBGjekKqfdC6dqk?=\n\t=?utf-8?q?CXRD5gbV1CQ9noU9J+GkO1WwhJrFsnaB3ZspvOR78cuFMt2LdQjLE15Y?=\n\t=?utf-8?q?VtjbeHsv3dTZqBEFMZBX9Hy/4noQrq0XLCwEamF320/zcPQv8X7irod3?=\n\t=?utf-8?q?WiDFYSzhMFNCtCC3Uy7g63wFiGyq5tE6BklrDxnCs1FOC3hX/77DGIke?=\n\t=?utf-8?q?8QGvZa0sBcbxQfKV7uQyeklHAG3+wZxWeFsgPyl6ISEGeoD27qV6oQI0?=\n\t=?utf-8?q?5FM4IkoKUKO1ebHodz6gow0R+0N4nngjE6DmzRLsnuOtAUvQpFIL1ZaS?=\n\t=?utf-8?q?/2pUhmIxkCxhyovq/n2s9/4fCv6R39ck3+p08M8MxWoNXu0uKN9OjVVY?=\n\t=?utf-8?q?LdC2E8soqDuS4fi2TPMoFYW9I0hhmUhmWZgd4DEqUXjbA62XtxLKWh9d?=\n\t=?utf-8?q?zeLNmkeyLx0wXfwyll7UNwOwWLE3SeAMqVgpbvmWq1i+y9GCG7nqNxTj?=\n\t=?utf-8?q?/9doei4J8QoO19JnaNZwv2O+VNxEFlZHZHJ+rYVWmqRZfsMmvmvYr0FO?=\n\t=?utf-8?q?8YteMHBJrXyzhWr+3fcjsHLoRy1Us7OlSSxALKT4+9C2EaaIuWn1rPhj?=\n\t=?utf-8?q?uYsclvFyUVDXRwmc6z0ZYzBkIXtvIli0cHYeQVdt+qKEucIbcED8yDla?=\n\t=?utf-8?q?/kyqzRhLYt0rZVDcMn3FfEuK/2hHlnEyvCDrKXkcj7fSuzwkSlkGsmw/?=\n\t=?utf-8?q?Esq1O7EhFBKCNbJjrrOHAsx2xVUAHn8ackaZCLQwJIonFkdQ4QLMi53q?=\n\t=?utf-8?q?87H+4Egf7HIctIm5gbvAnip18hZmNMWc6t9rKiGupJ22dMsE+27WoZwE?=\n\t=?utf-8?q?mJKDHQd938X5FdVGl3cYHn3w5S3rXY3y8zwisjSuWT3S6bSRAkFlKdcG?=\n\t=?utf-8?q?sgNVX5H7kb6tr4e3lmVVAObdgEp8f3bhjMvjgCC4XfNp+Ledq/PHZhyw?=\n\t=?utf-8?q?ScCYKLTMhW3czlgPoYrbdm8lWIigwMnc2BFE2hsr2BDWROQ9OpCskF/E?=\n\t=?utf-8?q?YSi/GpKxa489toFzN/vNp4XT44YBF4c+oH5ug=3D=3D?=","X-OriginatorOrg":"wolfvision.net","X-MS-Exchange-CrossTenant-Network-Message-Id":"43b92f9b-23c9-44db-ab48-08db3f1deaeb","X-MS-Exchange-CrossTenant-AuthSource":"DU0PR08MB9155.eurprd08.prod.outlook.com","X-MS-Exchange-CrossTenant-AuthAs":"Internal","X-MS-Exchange-CrossTenant-OriginalArrivalTime":"17 Apr 2023 08:29:53.2343\n\t(UTC)","X-MS-Exchange-CrossTenant-FromEntityHeader":"Hosted","X-MS-Exchange-CrossTenant-Id":"e94ec9da-9183-471e-83b3-51baa8eb804f","X-MS-Exchange-CrossTenant-MailboxType":"HOSTED","X-MS-Exchange-CrossTenant-UserPrincipalName":"LHbMNfTpgoZ84YOJAiz3qlvEjuTG3HDpikZBbVfGSqI5LV3zgsqq+rH9ajno85DcEZAfuI7n1C0AMHzf09vrd3KKn18o64uZ7uF7SqkalB0=","X-MS-Exchange-Transport-CrossTenantHeadersStamped":"PAXPR08MB6432","Subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Michael Riesch via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Michael Riesch <michael.riesch@wolfvision.net>","Cc":"linux-kernel@vger.kernel.org,\n\tMatthias Fend <Matthias.Fend@wolfvision.net>, \n\tlibcamera-devel@lists.libcamera.org,\n\tSakari Ailus <sakari.ailus@linux.intel.com>,\n\tMauro Carvalho Chehab <mchehab@kernel.org>, Michael Riesch via B4 Relay\n\t<devnull+michael.riesch.wolfvision.net@kernel.org>, \n\tlinux-media@vger.kernel.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26888,"web_url":"https://patchwork.libcamera.org/comment/26888/","msgid":"<ccae3994-3b1b-4050-ea34-98f97cf886e0@wolfvision.net>","date":"2023-04-17T12:38:20","subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","submitter":{"id":135,"url":"https://patchwork.libcamera.org/api/people/135/","name":"Michael Riesch","email":"michael.riesch@wolfvision.net"},"content":"Hi Sakari,\n\nOn 4/12/23 17:12, Sakari Ailus wrote:\n> Hi Dave, Michael,\n> \n> On Wed, Apr 12, 2023 at 02:55:56PM +0100, Dave Stevenson wrote:\n>>>> If the ranges aren't updated, where should that out-of-range lens\n>>>> movement leave the lens?\n>>>\n>>> This is up to the hardware controller, but I would guess it typically\n>>> stops one step before disaster. Wherever that may be, the error\n>>> condition and the current position can be read out via this new STATUS\n>>> control.\n>>>\n>>> Does this sound good so far?\n>>\n>> Sounds reasonable, but I'm not the gatekeeper (that would be Sakari or\n>> Laurent), and I'm just expressing my views based on the lenses I've\n>> encountered.\n>> All of my lenses have a single drive for focus, a single drive for\n>> zoom, and where there are multiple elements they are all connected\n>> mechanically. Your setup sounds far more complex and is likely to need\n>> a more extensive driver, but it'd be nice to not unnecessarily\n>> overcomplicate the interface.\n> \n> Could we also have a driver that uses these new controls?\n\nIf you are referring to the driver for our custom lens controller, then\nI have to say that it is under development and simply not ready for\nrelease yet. Also, the decision has not yet been made whether or not\nthis will be an open-source driver.\n\nA different approach could be the adaptation of the vimc-lens driver,\nwhich currently only supports FOCUS_ABSOLUTE. But this would raise\nseveral implementation questions and at least for me this would be a\nnontrivial task.\n\nIs it required to have a driver for this interface (in the sense that\nthe patches cannot be accepted otherwise)?\n\n> The controls themselves appear reasonable to me as well. I guess there are\n> changes to be made based on the discussion?\n\nI'd summarize that whether or not the status controls are compound\ncontrols of the type V4L2_CTRL_TYPE_LENS_STATUS is the open question.\n\nAs a potential follow-up question I recently asked myself if the struct\nv4l2_ctrl_lens_status should contain trailing reserved bytes for future\nextension (no idea, though, what this could be).\n\nAlternatively, we could come up with \"V4L2_CID_FOCUS_CURRENT (integer)\"\nfor the current position and \"V4L2_CID_FOCUS_STATUS (bitmask)\" (and add\nfurther controls when they are needed. Here, we lose atomicity but maybe\nthis can be ignored. One could assume that all relevant controls are\nread out with a single ioctl which provides at least some level of\natomicity.\n\nAny comments and/or recommendations to this open question would be much\nappreciated.\n\nOther review comments will be incorporated in the next iteration of this\nseries as well, but they are quite straightforward.\n\nBest regards,\nMichael","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id EB800BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 17 Apr 2023 12:38:27 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3340C61EBA;\n\tMon, 17 Apr 2023 14:38:27 +0200 (CEST)","from EUR01-HE1-obe.outbound.protection.outlook.com\n\t(mail-he1eur01on060a.outbound.protection.outlook.com\n\t[IPv6:2a01:111:f400:fe1e::60a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 007AC603A3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 17 Apr 2023 14:38:24 +0200 (CEST)","from DU0PR08MB9155.eurprd08.prod.outlook.com (2603:10a6:10:416::5)\n\tby PA4PR08MB5936.eurprd08.prod.outlook.com (2603:10a6:102:f1::23)\n\twith Microsoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.30;\n\tMon, 17 Apr 2023 12:38:22 +0000","from DU0PR08MB9155.eurprd08.prod.outlook.com\n\t([fe80::77dd:14e4:a772:d85f]) by\n\tDU0PR08MB9155.eurprd08.prod.outlook.com\n\t([fe80::77dd:14e4:a772:d85f%4]) with mapi id 15.20.6298.045;\n\tMon, 17 Apr 2023 12:38:22 +0000"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1681735107;\n\tbh=vq1eVorWvl106mE8Ucc0r1pctM91qVlOBqYtCyZruPw=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=Zz9UK1Mpa3GYGscZXAQyREPfihL6TWyWSbnC972maClFWn//oDdnQY3f6ztHLBMyB\n\tl2+j9dmyhXKjFeEcoAVRtsNHTL+KJ8lQ4avn7CYNzuFaoDWfni71GmRqPXLsVEbVpU\n\tYO6e3ndgUdT4p+5vI1Usm5ZUaMSvr1pHti4yIogHdzlwZt6UqCEZxoAV+KyzK/SIBj\n\tSczou9pv1dqX6rBJE9ZNJRY/Sy38KpJMJ9WqiMT3zvb0TmU+lrbYpY8s5ZCVTLNX8Y\n\tcLl+3N8C/C8dviWzF+QUlJozSBlFthhKr1CwtzId2i5BivLZF8gbgCbdpI61nOvm5o\n\tiMdzAZSl9YQqw==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net;\n\ts=selector2;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n\tbh=bOrcjaTiPlsuwJocR7ykoIe/ZKGwLwqAoRXN6G2T6Dw=;\n\tb=sjAiPhD4Fi32wbl5esPfT2ZfpXalj+FJZygcykugTdNHDKb39XnRWCiuMH/PGKH9qiRVFE/4YQg6GJFaBOnbxtt278n0p6wGYBoK2iOwIm8qA3v02W0+BXj6HXLQlNMttQso/CK2VzwVIhlxr8gNC/Z7BdblxCu/sVb5TJejd4E="],"Authentication-Results":["lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=wolfvision.net\n\theader.i=@wolfvision.net\n\theader.b=\"sjAiPhD4\"; dkim-atps=neutral","dkim=none (message not signed)\n\theader.d=none;dmarc=none action=none header.from=wolfvision.net;"],"ARC-Seal":"i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;\n\tb=c/kAqe46GPlTlTTztecN0A+e7AHck1zm1Pu9CTMhHLAarWv8ux1v4cHzwDXdXmePaSSmCQSb6AiN9wC0oxnRQPfU3vZe2RZ8ok80MTqRNPjAXVmjJ22vFsp+620DHiwLohN8DUaCIUzr4KZxQ52oOkReGbMuD8RE8jVZKeRHaqr6BQkhlSyXIYh8DPxYJ5HRqIVPYLoNTWQmIUe4fI8QtZe1ZWc6ikEkjp/xIHp5SFN/z+ZixvNL+/EAB7hJUdIZAfsZvo8LU0P2AcLyiB+1wzynWn03a5EhMmTKokMW9uSoaSKOCcvTTC0vgdmyuDxA4h6+c+z6ql1NrzfHs23ZLA==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n\ts=arcselector9901;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;\n\tbh=bOrcjaTiPlsuwJocR7ykoIe/ZKGwLwqAoRXN6G2T6Dw=;\n\tb=gPT4mhbwC+66EiXYOFz/UiVQq9TwGvloKpqL63CNrpPTBooyZK+5eHrJNqTeZPpmG/NCXNAuhpDqhqf5cVL3XYtn0Ya17I0dYpX52EqvBEdnnY74D+2TqwfiTJ6JGLPuivot9JCFNqh0Kqo0HddJ1+7UNE43DUnctEhemnE0LLGmHotoe5+msP/LLtv86KsRgAMv9U2TB7KmJZCTcW3sCQUv3YaVRYmskrTolSM5OPkuJ6tcG+n8vhHaj0xle/GgLd0WhWq4qhuRFyZwKmKau9Ek/EKsxKECcmrgrDFS85tyHN795CMFT5P5p1bJ766LAigE5AUVGK9pPFn6Leg9GQ==","ARC-Authentication-Results":"i=1; mx.microsoft.com 1; spf=pass\n\tsmtp.mailfrom=wolfvision.net; dmarc=pass action=none\n\theader.from=wolfvision.net; dkim=pass header.d=wolfvision.net;\n\tarc=none","Message-ID":"<ccae3994-3b1b-4050-ea34-98f97cf886e0@wolfvision.net>","Date":"Mon, 17 Apr 2023 14:38:20 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101\n\tThunderbird/102.9.0","Content-Language":"en-US","To":"Sakari Ailus <sakari.ailus@linux.intel.com>,\n\tDave Stevenson <dave.stevenson@raspberrypi.com>","References":"<20230406-feature-controls-lens-v1-0-543189a680de@wolfvision.net>\n\t<20230406-feature-controls-lens-v1-1-543189a680de@wolfvision.net>\n\t<CAPY8ntArOOqPQzvkJrQEyuVFfb6j8x6WODTMHOn1qHPU588mbQ@mail.gmail.com>\n\t<0f1baf5e-2ff6-e10b-5c3e-0a82c71d0ce6@wolfvision.net>\n\t<CAPY8ntAjBEFfeV6nnQs34Y22QM-irT13ALDv4ksP8AYK=jWsKg@mail.gmail.com>\n\t<3ab7bfc4-aaae-2e39-b420-40ad8d71dda4@wolfvision.net>\n\t<CAPY8ntCNuvgmF37kDvVh1kuepbLqy2hWcz9HOi8iub9trHmi2g@mail.gmail.com>\n\t<ZDbKU5kwcb7RGeCo@kekkonen.localdomain>","In-Reply-To":"<ZDbKU5kwcb7RGeCo@kekkonen.localdomain>","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"7bit","X-ClientProxiedBy":"ZR2P278CA0006.CHEP278.PROD.OUTLOOK.COM\n\t(2603:10a6:910:50::12) To DU0PR08MB9155.eurprd08.prod.outlook.com\n\t(2603:10a6:10:416::5)","MIME-Version":"1.0","X-MS-PublicTrafficType":"Email","X-MS-TrafficTypeDiagnostic":"DU0PR08MB9155:EE_|PA4PR08MB5936:EE_","X-MS-Office365-Filtering-Correlation-Id":"6fd3abd5-3f68-4a27-e92a-08db3f40a155","X-MS-Exchange-SenderADCheck":"1","X-MS-Exchange-AntiSpam-Relay":"0","X-Microsoft-Antispam":"BCL:0;","X-Microsoft-Antispam-Message-Info":"glYV16OrWYIBaLduXbxwcWo3d1+1AqjFl0IXvwaXCatOP8jT07fgxnSFANVCaZVhETEhikiuxsdseeNknHuOj172rQk16laxE8KF6RFEls1HwC3X4WPraM79kPD8hMYLh9PQNxAHW2+yXeNWWGOZHLV4eHWMjNBRhz2gl5sv2cjgCitAsjASafGCJq64Uq1WgZVlCFxu/1vldGaKeak99n6D6aj+kDq9Dq6y1ea/qcHrttRnhEWjSGuY7e3yTftUBZXJa6lUbdJqd4T58WlRTma5BPvLemkPO1KHekwPLRfCTQsuamy4waN4c+utKlfI/z9ygwITja35eBJl2nLg39c8roPZO3BIVmLDbHJqpGSDunVYa5VV1pSmTPsw/NRlvEOO0L8U79L9Oq0I1UfpX1ijV7Lh2w32yY+zxkGv3Q8tDGjo3W79CIPGHIq0wFSbVPS3gdToLOuziwv75jGusf7xLv6QCeXKKralE6S+WfLOclTW0QznbQbIvXtLbuA2JdosnoF/uOOGzHR3k7RSiYFVZzHsfx8qQsMCmCHy05rcjHTJ3Fv7rEpI4+asCkUfjyJI/6LTz7EKCg+TTHMVMoUvCwryG1rqvONNsUinLVQzViH1CW8TDXu2b0wtglzM/jfT3CyE1y6Renyg7D+kLg==","X-Forefront-Antispam-Report":"CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;\n\tIPV:NLI; SFV:NSPM; H:DU0PR08MB9155.eurprd08.prod.outlook.com; PTR:;\n\tCAT:NONE; \n\tSFS:(13230028)(4636009)(376002)(366004)(39840400004)(396003)(346002)(136003)(451199021)(44832011)(83380400001)(41300700001)(5660300002)(2616005)(31686004)(2906002)(38100700002)(53546011)(6512007)(6506007)(8936002)(186003)(8676002)(6486002)(66556008)(36756003)(4326008)(478600001)(66946007)(86362001)(66476007)(54906003)(110136005)(31696002)(316002)(43740500002)(45980500001);\n\tDIR:OUT; SFP:1101; ","X-MS-Exchange-AntiSpam-MessageData-ChunkCount":"1","X-MS-Exchange-AntiSpam-MessageData-0":"=?utf-8?q?+OW4GtQthBPd/ltFjamj/alDh?=\n\t=?utf-8?q?+/nwCNuP8e/ctoAewVRghhdZGnOtA/RH/p4+qxwe2LIdGwunqcQfv4YL?=\n\t=?utf-8?q?iS2lk1nd+0dPTA/oevuas1q2R8Al1QvCfB2sZwIDsz3s20C1cw3orPvV?=\n\t=?utf-8?q?GF6oLLb5F5Dh2zJc0jl/WtIe7mxAdboFbuV+D6hwPYknGWCMajyzXiMp?=\n\t=?utf-8?q?UvrHCJ5bMZEnZwWhUlZLRwDdWWSkesAhKkoNn/iNGjZ/v0ClmSPJUVqU?=\n\t=?utf-8?q?NsdsJPz4ytZrKMtxb8QJAGMh/Dsm3wqkHj0A8B8DILaT9NfHs36ODNve?=\n\t=?utf-8?q?nx60UpLnZBje1Ton/A1jsFp6kSKQVX3WywwGHzSBPZxOS6ufVRsKmj/y?=\n\t=?utf-8?q?mIv7a65pnnQBdAI57J2y7ZvuE3jFB+/Vx/ivb7Fop68owJmTPC787CW1?=\n\t=?utf-8?q?qFMB1Bsza69Vi/Ov9dtGA59XDYLKPMWgfBQ7evYqqNykpS2L1PQ6PJ8A?=\n\t=?utf-8?q?ukbJG2ZehCRCd72y/ub8tNBQ64ow2V0/jdIPkkxyvGHDAi04RDAm0+Dd?=\n\t=?utf-8?q?59Kow5aTts1nmLzweHVVPynCvxMpmcSrAfR8j6kZpI8e51EJpzv0bh0v?=\n\t=?utf-8?q?pHtDGwEpR7vgx17P7x6RT6o1oVt5RABay529TV0gGFp0JVNxmguKwGq9?=\n\t=?utf-8?q?fWgBTeMlCz+tkjQ6CXLV2mMGmob3a7CTDHnGiPaaXVb6MG+DZyRpmFb6?=\n\t=?utf-8?q?OqQP9TN/1V+Nqe6r9/TrCwsNytAsbhPbrESaFOPG6IyOW7CtF/5pYk8+?=\n\t=?utf-8?q?DIgmeN/H7EjoNEhOqVgFKMtF4HJiGbAaok+UinpAo5j3t332ZDddmMw8?=\n\t=?utf-8?q?Juo937Z3I55PUBPgtD39DpX5WRIByYd+Pa+nizH+IWfP+R2mEVvBTkmu?=\n\t=?utf-8?q?8RinNNAcExkjmJ37TmBuUpDR1Z/umOBSn2STZumw8vfJ5CeyYTW7/pKj?=\n\t=?utf-8?q?FfhF611NkmFl4woGiA9Lj80r/NJClAYYizYcUdYugs9XnFuxSnqNAO7Y?=\n\t=?utf-8?q?/ttxkTF5idhJ2AurJAIqGhsFu55MKv7+MxgrCdutDqUrsP4e8pO1inFD?=\n\t=?utf-8?q?WTFC+A1mPCkoM++oC9lyRa7UKDDV386rK2jWcJlNUp3xq1NK/Qaf9FRw?=\n\t=?utf-8?q?AbcDkKqvxM0lsZGd5SRxF2Mn0D01+RSzGaYIpnPOW20cLz4LjHiuG7o6?=\n\t=?utf-8?q?RURM7wQpl/0rM1Zq/TL/coQYAuKm/aG3ReWX0pYF4cHim5rm15eIWdLy?=\n\t=?utf-8?q?q5CnmFeXZNJ3sZNcgzd7ApcYIHdDesSFeGvAL+hg3x26CuCe9HYwrQ8b?=\n\t=?utf-8?q?BnsHVTW/civkTV9gE7wVA3v0vGmq6wKV9WuY4sISGViJHG3uN82YKdc9?=\n\t=?utf-8?q?ff+JGwRUrluSvLPEMEGLjDftBmhMw/vU3cVeHjoXRjYwpRH8EMrmFVfd?=\n\t=?utf-8?q?0+Vut/D+1dAcu1mLeU24yMIrxkvfmlP9XIbb7mWAWc3fy96TlTSL1ICh?=\n\t=?utf-8?q?9mW04vT46FLzEP0xmuG3V4P94/ZyrJ6vYNkOH++RV7tSVX68264SGm9h?=\n\t=?utf-8?q?GruTE9nRfvr3etiAHfyLTR9/S16XxXaCx6H6RzeQ/N60VQoLyw8g45wr?=\n\t=?utf-8?q?UQ2MyPxZyuKgfGDRrvQHe6Caazft4kPy48y8+N6OBMriltweZBwqFB2w?=\n\t=?utf-8?q?TP6t3Sw8r2kCdgumsjIWw+lT6vmHQB1L6f8WSYffNkdLSKr9mlFGeOxw?=\n\t=?utf-8?q?0f1BM0+ctfmzaxMaJjSp/q7ifwKfMfJTMR+6A=3D=3D?=","X-OriginatorOrg":"wolfvision.net","X-MS-Exchange-CrossTenant-Network-Message-Id":"6fd3abd5-3f68-4a27-e92a-08db3f40a155","X-MS-Exchange-CrossTenant-AuthSource":"DU0PR08MB9155.eurprd08.prod.outlook.com","X-MS-Exchange-CrossTenant-AuthAs":"Internal","X-MS-Exchange-CrossTenant-OriginalArrivalTime":"17 Apr 2023 12:38:22.1916\n\t(UTC)","X-MS-Exchange-CrossTenant-FromEntityHeader":"Hosted","X-MS-Exchange-CrossTenant-Id":"e94ec9da-9183-471e-83b3-51baa8eb804f","X-MS-Exchange-CrossTenant-MailboxType":"HOSTED","X-MS-Exchange-CrossTenant-UserPrincipalName":"w94QlELEcV0BlAz3juQvKECylqOpGkGVgUKV+tX+W4V+PS54Ot04Hd19+2xnLRceBjobPFPxFUKLJpQJVIlBDPs9th+hbeGhEbAc8ixYD2M=","X-MS-Exchange-Transport-CrossTenantHeadersStamped":"PA4PR08MB5936","Subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Michael Riesch via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Michael Riesch <michael.riesch@wolfvision.net>","Cc":"linux-kernel@vger.kernel.org,\n\tMatthias Fend <Matthias.Fend@wolfvision.net>, \n\tlibcamera-devel@lists.libcamera.org,\n\tMauro Carvalho Chehab <mchehab@kernel.org>, Michael Riesch via B4 Relay\n\t<devnull+michael.riesch.wolfvision.net@kernel.org>, \n\tlinux-media@vger.kernel.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26904,"web_url":"https://patchwork.libcamera.org/comment/26904/","msgid":"<ZD+t5QYH20Y8+8MV@kekkonen.localdomain>","date":"2023-04-19T09:01:25","subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","submitter":{"id":37,"url":"https://patchwork.libcamera.org/api/people/37/","name":"Sakari Ailus","email":"sakari.ailus@linux.intel.com"},"content":"Hi Michael,\n\nOn Mon, Apr 17, 2023 at 02:38:20PM +0200, Michael Riesch wrote:\n> Hi Sakari,\n> \n> On 4/12/23 17:12, Sakari Ailus wrote:\n> > Hi Dave, Michael,\n> > \n> > On Wed, Apr 12, 2023 at 02:55:56PM +0100, Dave Stevenson wrote:\n> >>>> If the ranges aren't updated, where should that out-of-range lens\n> >>>> movement leave the lens?\n> >>>\n> >>> This is up to the hardware controller, but I would guess it typically\n> >>> stops one step before disaster. Wherever that may be, the error\n> >>> condition and the current position can be read out via this new STATUS\n> >>> control.\n> >>>\n> >>> Does this sound good so far?\n> >>\n> >> Sounds reasonable, but I'm not the gatekeeper (that would be Sakari or\n> >> Laurent), and I'm just expressing my views based on the lenses I've\n> >> encountered.\n> >> All of my lenses have a single drive for focus, a single drive for\n> >> zoom, and where there are multiple elements they are all connected\n> >> mechanically. Your setup sounds far more complex and is likely to need\n> >> a more extensive driver, but it'd be nice to not unnecessarily\n> >> overcomplicate the interface.\n> > \n> > Could we also have a driver that uses these new controls?\n> \n> If you are referring to the driver for our custom lens controller, then\n> I have to say that it is under development and simply not ready for\n> release yet. Also, the decision has not yet been made whether or not\n> this will be an open-source driver.\n> \n> A different approach could be the adaptation of the vimc-lens driver,\n> which currently only supports FOCUS_ABSOLUTE. But this would raise\n> several implementation questions and at least for me this would be a\n> nontrivial task.\n> \n> Is it required to have a driver for this interface (in the sense that\n> the patches cannot be accepted otherwise)?\n\nThat has been traditionally required, and a virtual driver isn't usually\nconsidered enough. There are at least two reasons for this. The first one\nbeing that if the driver isn't reviewable and targetting upstream it may be\ndifficult to figure out whether the interface changes are the right ones\nfor that driver. This is perhaps a lesser concern here. Secondly, there is\nalso unwillingness to add interface elements that might never be supported\nby the kernel itself --- this is effectively just dead code.\n\nAlso cc Hans and Laurent.\n\n> \n> > The controls themselves appear reasonable to me as well. I guess there are\n> > changes to be made based on the discussion?\n> \n> I'd summarize that whether or not the status controls are compound\n> controls of the type V4L2_CTRL_TYPE_LENS_STATUS is the open question.\n> \n> As a potential follow-up question I recently asked myself if the struct\n> v4l2_ctrl_lens_status should contain trailing reserved bytes for future\n> extension (no idea, though, what this could be).\n> \n> Alternatively, we could come up with \"V4L2_CID_FOCUS_CURRENT (integer)\"\n> for the current position and \"V4L2_CID_FOCUS_STATUS (bitmask)\" (and add\n> further controls when they are needed. Here, we lose atomicity but maybe\n> this can be ignored. One could assume that all relevant controls are\n> read out with a single ioctl which provides at least some level of\n> atomicity.\n\nThere might be something that could be done in the control framework to\naddress this. But it's not something that can be expected to happen soon.\n\nI'd perhaps keep them separate, not to make it a compound control just for\nthe access reason. But I certainly don't have a strong opinion about it.\n\n> \n> Any comments and/or recommendations to this open question would be much\n> appreciated.\n> \n> Other review comments will be incorporated in the next iteration of this\n> series as well, but they are quite straightforward.","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 25C46BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 19 Apr 2023 09:01:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8D084627B7;\n\tWed, 19 Apr 2023 11:01:35 +0200 (CEST)","from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 16A45627B1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 19 Apr 2023 11:01:32 +0200 (CEST)","from fmsmga008.fm.intel.com ([10.253.24.58])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; \n\t19 Apr 2023 02:01:31 -0700","from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com)\n\t([10.237.72.44]) by fmsmga008-auth.fm.intel.com with\n\tESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2023 02:01:28 -0700","from kekkonen.localdomain (localhost [IPv6:::1])\n\tby kekkonen.fi.intel.com (Postfix) with SMTP id D7E2311FAD0;\n\tWed, 19 Apr 2023 12:01:25 +0300 (EEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1681894895;\n\tbh=IiznyOV15KEk7yghNEwufQGnmpRCJqkzx0uQeGij21E=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=cXuxA7cc7hvRDyiz3dc7vLf5iQYRCKsTkh0HArkLbj7laoi2jJa3A2Ps+RP1Sd4WZ\n\tZC6i9MQxuqjw7PHmqwK6lFyarLe3AxfcngnQh2W6SnH/We3P2AqOxjNDTesl6RN/L2\n\tXVkHLBZp4Q+FizUXAkqPbHApXzwGgU2Z1Uw2MdWQoeMM6OJQhvDu4PMKd/Rhl2u/Wt\n\tO76C1h8Txfusz5kGeTiAmNWFHaLwnR1OEIKdcTGUALYuUyEtiHNfHXdDdIRYDvoDY9\n\t/vKUOUelrQNb33mvsCKnYr4OdGqJBQ0pGSBSBFtgTy4vZgM0Tey+dh+0g0CckMsaO4\n\t8l+8E57uIcZaQ==","v=1; a=rsa-sha256; c=relaxed/simple;\n\td=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n\tt=1681894893; x=1713430893;\n\th=date:from:to:cc:subject:message-id:references:\n\tmime-version:in-reply-to;\n\tbh=IiznyOV15KEk7yghNEwufQGnmpRCJqkzx0uQeGij21E=;\n\tb=Niag3KKb0M9OqytM6WYpDpbo1AJSq7yA9Jt9t+XLres8PfivgOIgZ9OG\n\tGTKLlUkHdPLrcw1bVhGkznqV/pL7wFgQ0iltQyWp1UcLbK63Ci79mvrOl\n\tfHhY3SfZSYSs3/TJGID91ejVFIKcwIUNsbpKwXL+g1yuCDUxQdpa38zAP\n\tgCsOSWZTkCBA5ye2psfiVYJfIjM8eJVflaDyisM5cTQZkB9GKh/bpBz2L\n\tSqPUeGx7y4cdTdDpv/uoa9Mrt5OoT7ecomW/8oNDL774EmdAhs+6I2t1T\n\tIiJdUzsP673uHZJ43rEyTYYZW3uvCuZjODPIMFOkQcsmsLx8sfGPDRYxZ w==;"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=intel.com header.i=@intel.com\n\theader.b=\"Niag3KKb\"; dkim-atps=neutral","X-IronPort-AV":["E=McAfee;i=\"6600,9927,10684\"; a=\"373276201\"","E=Sophos;i=\"5.99,208,1677571200\"; d=\"scan'208\";a=\"373276201\"","E=McAfee;i=\"6600,9927,10684\"; a=\"756028824\"","E=Sophos;i=\"5.99,208,1677571200\"; d=\"scan'208\";a=\"756028824\""],"X-ExtLoop1":"1","Date":"Wed, 19 Apr 2023 12:01:25 +0300","To":"Michael Riesch <michael.riesch@wolfvision.net>","Message-ID":"<ZD+t5QYH20Y8+8MV@kekkonen.localdomain>","References":"<20230406-feature-controls-lens-v1-0-543189a680de@wolfvision.net>\n\t<20230406-feature-controls-lens-v1-1-543189a680de@wolfvision.net>\n\t<CAPY8ntArOOqPQzvkJrQEyuVFfb6j8x6WODTMHOn1qHPU588mbQ@mail.gmail.com>\n\t<0f1baf5e-2ff6-e10b-5c3e-0a82c71d0ce6@wolfvision.net>\n\t<CAPY8ntAjBEFfeV6nnQs34Y22QM-irT13ALDv4ksP8AYK=jWsKg@mail.gmail.com>\n\t<3ab7bfc4-aaae-2e39-b420-40ad8d71dda4@wolfvision.net>\n\t<CAPY8ntCNuvgmF37kDvVh1kuepbLqy2hWcz9HOi8iub9trHmi2g@mail.gmail.com>\n\t<ZDbKU5kwcb7RGeCo@kekkonen.localdomain>\n\t<ccae3994-3b1b-4050-ea34-98f97cf886e0@wolfvision.net>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<ccae3994-3b1b-4050-ea34-98f97cf886e0@wolfvision.net>","Subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Sakari Ailus via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Sakari Ailus <sakari.ailus@linux.intel.com>","Cc":"linux-kernel@vger.kernel.org, hverkuil@xs4all.nl,\n\tMatthias Fend <Matthias.Fend@wolfvision.net>,\n\tlibcamera-devel@lists.libcamera.org,\n\tMauro Carvalho Chehab <mchehab@kernel.org>, Michael Riesch via B4 Relay\n\t<devnull+michael.riesch.wolfvision.net@kernel.org>, \n\tlinux-media@vger.kernel.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26906,"web_url":"https://patchwork.libcamera.org/comment/26906/","msgid":"<45fea085-54c3-157e-6459-adaaf1edebf5@wolfvision.net>","date":"2023-04-19T11:24:58","subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","submitter":{"id":135,"url":"https://patchwork.libcamera.org/api/people/135/","name":"Michael Riesch","email":"michael.riesch@wolfvision.net"},"content":"Hi Sakari,\n\nOn 4/19/23 11:01, Sakari Ailus wrote:\n> Hi Michael,\n> \n> On Mon, Apr 17, 2023 at 02:38:20PM +0200, Michael Riesch wrote:\n>> Hi Sakari,\n>>\n>> On 4/12/23 17:12, Sakari Ailus wrote:\n>>> Hi Dave, Michael,\n>>>\n>>> On Wed, Apr 12, 2023 at 02:55:56PM +0100, Dave Stevenson wrote:\n>>>>>> If the ranges aren't updated, where should that out-of-range lens\n>>>>>> movement leave the lens?\n>>>>>\n>>>>> This is up to the hardware controller, but I would guess it typically\n>>>>> stops one step before disaster. Wherever that may be, the error\n>>>>> condition and the current position can be read out via this new STATUS\n>>>>> control.\n>>>>>\n>>>>> Does this sound good so far?\n>>>>\n>>>> Sounds reasonable, but I'm not the gatekeeper (that would be Sakari or\n>>>> Laurent), and I'm just expressing my views based on the lenses I've\n>>>> encountered.\n>>>> All of my lenses have a single drive for focus, a single drive for\n>>>> zoom, and where there are multiple elements they are all connected\n>>>> mechanically. Your setup sounds far more complex and is likely to need\n>>>> a more extensive driver, but it'd be nice to not unnecessarily\n>>>> overcomplicate the interface.\n>>>\n>>> Could we also have a driver that uses these new controls?\n>>\n>> If you are referring to the driver for our custom lens controller, then\n>> I have to say that it is under development and simply not ready for\n>> release yet. Also, the decision has not yet been made whether or not\n>> this will be an open-source driver.\n>>\n>> A different approach could be the adaptation of the vimc-lens driver,\n>> which currently only supports FOCUS_ABSOLUTE. But this would raise\n>> several implementation questions and at least for me this would be a\n>> nontrivial task.\n>>\n>> Is it required to have a driver for this interface (in the sense that\n>> the patches cannot be accepted otherwise)?\n> \n> That has been traditionally required, and a virtual driver isn't usually\n> considered enough. There are at least two reasons for this. The first one\n> being that if the driver isn't reviewable and targetting upstream it may be\n> difficult to figure out whether the interface changes are the right ones\n> for that driver. This is perhaps a lesser concern here. Secondly, there is\n> also unwillingness to add interface elements that might never be supported\n> by the kernel itself --- this is effectively just dead code.\n> \n> Also cc Hans and Laurent.\n\nI understand your concerns. Cc: Alexander and Dieter\n\nWe aim to be an open-source friendly company. If you are OK with us\nsubmitting a driver that targets very custom hardware that is only\navailable in integrated form in our products (and not, for instance,\navailable for sale as a standalone device), then we are prepared to\nsubmit the driver sources for consideration for inclusion in mainline\nLinux. Would this be acceptable?\n\nAs I already stated above, it will take us some time to prepare\neverything in a form that is suitable for submission. Now should I\nsubmit the next iteration(s) of the series at hand as RFC or as regular\npatch series?\n\n>>> The controls themselves appear reasonable to me as well. I guess there are\n>>> changes to be made based on the discussion?\n>>\n>> I'd summarize that whether or not the status controls are compound\n>> controls of the type V4L2_CTRL_TYPE_LENS_STATUS is the open question.\n>>\n>> As a potential follow-up question I recently asked myself if the struct\n>> v4l2_ctrl_lens_status should contain trailing reserved bytes for future\n>> extension (no idea, though, what this could be).\n>>\n>> Alternatively, we could come up with \"V4L2_CID_FOCUS_CURRENT (integer)\"\n>> for the current position and \"V4L2_CID_FOCUS_STATUS (bitmask)\" (and add\n>> further controls when they are needed. Here, we lose atomicity but maybe\n>> this can be ignored. One could assume that all relevant controls are\n>> read out with a single ioctl which provides at least some level of\n>> atomicity.\n> \n> There might be something that could be done in the control framework to\n> address this. But it's not something that can be expected to happen soon.\n> \n> I'd perhaps keep them separate, not to make it a compound control just for\n> the access reason. But I certainly don't have a strong opinion about it.\n\nAfter some further considerations, and following Dave's and your\ncomments, I'll keep them separate.\n\nDiscussion to be continued with v2.\n\nBest regards,\nMichael\n\n> \n>>\n>> Any comments and/or recommendations to this open question would be much\n>> appreciated.\n>>\n>> Other review comments will be incorporated in the next iteration of this\n>> series as well, but they are quite straightforward.\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 7FC98BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 19 Apr 2023 11:25:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CF461627B1;\n\tWed, 19 Apr 2023 13:25:07 +0200 (CEST)","from EUR05-AM6-obe.outbound.protection.outlook.com\n\t(mail-am6eur05on2060c.outbound.protection.outlook.com\n\t[IPv6:2a01:111:f400:7e1b::60c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 46006603A1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 19 Apr 2023 13:25:05 +0200 (CEST)","from DU0PR08MB9155.eurprd08.prod.outlook.com (2603:10a6:10:416::5)\n\tby AS2PR08MB10225.eurprd08.prod.outlook.com\n\t(2603:10a6:20b:64e::12) with Microsoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.21;\n\tWed, 19 Apr 2023 11:25:00 +0000","from DU0PR08MB9155.eurprd08.prod.outlook.com\n\t([fe80::77dd:14e4:a772:d85f]) by\n\tDU0PR08MB9155.eurprd08.prod.outlook.com\n\t([fe80::77dd:14e4:a772:d85f%4]) with mapi id 15.20.6298.045;\n\tWed, 19 Apr 2023 11:25:00 +0000"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1681903507;\n\tbh=nVm+YGukLcgDl0X8/UY+HhUrzbtihk/knyeowE0Sz+U=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=SWrkiKZ9N3gn85jsb0E8pKrdxBIhg7v16+2kPaPPS5vc0qPfAGLkpLqFvzKO3mxa2\n\tcIBzqzdX984U2xjIkLQpIioGN85RBStJ3QSE8FJL+rwVxoNqU6vJuVuZdpLG8jjhpK\n\tLcNM9BA0OA2imriWwAxGTU/eiNaCbr5yhququk38c+0owOh7JH1VhpPhHsup3tW8v2\n\t6U5AteR5+YIxAMON0jsbRa7fahuVn/vqBkuPKMScor4S6t+ILIvk/s0uazD72bb4fn\n\tc95R8MjPXyy24Xb1wn5x7QGDhasnbxBzG1RD6sgygYxpICcdoDTVP4lQmsWdK0l52L\n\t1Dsc6bka6KBsQ==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net;\n\ts=selector2;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n\tbh=KqGQ28GhXp86LpWccVJ/t3TOTQwgHc8zZMVSYaSj8EA=;\n\tb=cNYZcjfzkbByEzxiP8sxmbvN3oga+YQnOkUIkAlHQuDd0Jd4iKbMYgeqBEsObFB/48QoSyr2YXpbP2Q7qVCmPlVY+FV8JboMlSY5LueJte+SQM8KDEu6uU+0uYPNE7c0EDm50VXv9/vWpvnpz5NGrsgybniXZyMLCnSRsigJQio="],"Authentication-Results":["lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=wolfvision.net\n\theader.i=@wolfvision.net\n\theader.b=\"cNYZcjfz\"; dkim-atps=neutral","dkim=none (message not signed)\n\theader.d=none;dmarc=none action=none header.from=wolfvision.net;"],"ARC-Seal":"i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;\n\tb=GfEdWWJjtOXOts3BFXPNx+VtnV2bGcL0H5kLWnVYV5tbcWHIy9pB9n1o2mswgAMtifpF6z4GOdKIUBLRschZvIo7oZcQ5q4t0suW2mb5KdykQ2tdh+PIp77tAD/8C0Rbk4dGoPAD9mdr1bAfStr21N12Gf4vWLAnctU6/91jluIjNKc54s90MfoKCzzI/43aZOdK7IRXVZzHoldvv6fsEfEeGWsEG9aDlXwjwj9BW0IEdJKBqE5wjzMlmyoORdi9p+rhNSU+7u2qC02ClypUe3ctvWNlFvU54aazFcpKg/Fol9sfxhid/ogwa38Nfd24bLPgjrjkrp/wmvby5kwf4g==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n\ts=arcselector9901;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;\n\tbh=KqGQ28GhXp86LpWccVJ/t3TOTQwgHc8zZMVSYaSj8EA=;\n\tb=CSw0cVhlv7rcR0PGDq8B7Rq7y8Ch4JtEqUsrNn3r3FoDEAeO6xQQyLL/tOaVl4tvWUwg4Fzo+huEvPLYzyl7E7E+fqTX3B2ueI2Wx2HJFyTjM0Gu2e10YEnUImTiABuRi25f78UvbGSNSGTMBTAEKNfdLN0vqJ4GaOnhSabPk7j/AaF7wjvL1e4UwiJ9ow/LYcOnhcpt+7xZ0XNHYNlhZK5c2WuxDPp1ydDFsfH/epmSyZCr76uaIEd1fSNgIEG0EgpH8nNkBJIl2UafbSWuCmJivZ5NbGbxp6lnbC9fJ3y6/eGl8u+tOmsyzSlil+/sU7d1Dl3rN8FvInratwykhQ==","ARC-Authentication-Results":"i=1; mx.microsoft.com 1; spf=pass\n\tsmtp.mailfrom=wolfvision.net; dmarc=pass action=none\n\theader.from=wolfvision.net; dkim=pass header.d=wolfvision.net;\n\tarc=none","Message-ID":"<45fea085-54c3-157e-6459-adaaf1edebf5@wolfvision.net>","Date":"Wed, 19 Apr 2023 13:24:58 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101\n\tThunderbird/102.9.0","Content-Language":"en-US","To":"Sakari Ailus <sakari.ailus@linux.intel.com>","References":"<20230406-feature-controls-lens-v1-0-543189a680de@wolfvision.net>\n\t<20230406-feature-controls-lens-v1-1-543189a680de@wolfvision.net>\n\t<CAPY8ntArOOqPQzvkJrQEyuVFfb6j8x6WODTMHOn1qHPU588mbQ@mail.gmail.com>\n\t<0f1baf5e-2ff6-e10b-5c3e-0a82c71d0ce6@wolfvision.net>\n\t<CAPY8ntAjBEFfeV6nnQs34Y22QM-irT13ALDv4ksP8AYK=jWsKg@mail.gmail.com>\n\t<3ab7bfc4-aaae-2e39-b420-40ad8d71dda4@wolfvision.net>\n\t<CAPY8ntCNuvgmF37kDvVh1kuepbLqy2hWcz9HOi8iub9trHmi2g@mail.gmail.com>\n\t<ZDbKU5kwcb7RGeCo@kekkonen.localdomain>\n\t<ccae3994-3b1b-4050-ea34-98f97cf886e0@wolfvision.net>\n\t<ZD+t5QYH20Y8+8MV@kekkonen.localdomain>","Organization":"WolfVision GmbH","In-Reply-To":"<ZD+t5QYH20Y8+8MV@kekkonen.localdomain>","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"7bit","X-ClientProxiedBy":"VI1P194CA0030.EURP194.PROD.OUTLOOK.COM\n\t(2603:10a6:803:3c::19) To DU0PR08MB9155.eurprd08.prod.outlook.com\n\t(2603:10a6:10:416::5)","MIME-Version":"1.0","X-MS-PublicTrafficType":"Email","X-MS-TrafficTypeDiagnostic":"DU0PR08MB9155:EE_|AS2PR08MB10225:EE_","X-MS-Office365-Filtering-Correlation-Id":"b162616f-1a95-450b-b1cd-08db40c8b692","X-MS-Exchange-SenderADCheck":"1","X-MS-Exchange-AntiSpam-Relay":"0","X-Microsoft-Antispam":"BCL:0;","X-Microsoft-Antispam-Message-Info":"wfugEc0Umo3bAKwVdUBFXLEvYouQhM0UYTDpFaKvieAxBCjvDcMQLoFC2kYFKve4Q1cfcjofBMB93GOjLV5iRUJCF6Mg3jgizQTtFNx1qcyI+RC4ZWQIr+C492gqtXEcgJo5QBzj+N4RVXZNzLig/xPuyGAyGsI9PvQ9YKZqSwJRHLlHomct1fh3uk88yoFLv4RLmbl76rDbGW3Xr8oYfi+beeVNm37SREMDP4KTaxtdE4MQ8yj+GUgE7NCjVZNTjZwDpBJbkXQIBtHv4qo+MzQwLBh9C/2FmjFz7CWIHGSinl34hHKmAGm0YhCoUC+TShiIZeZNrAiW7PaFD7h5pNOTF+Z/6/VUXdGWjVfssad8rzIkgmVlxxtbCsskTyMrFHDbysk3gflMVxkfQpPpDq6iIEcFCoCm9XntN7l5K/mq4NrtzVxTzBdqEeItj5bcGfrSwaXXgDcCJyGGlF8u6PuKjaRfLaKorPJZKgRN7KnB4upserZjhF8LC/rg8w3DYuqFz65x3IEKGk3zQWgaC2XSn1lLBkFWNgG3iDWSReuDxhsb4uLa6uHuk4KWTRsV+E+yzwVFyGi9VLoAyKMA8WuAMJYMPcUZfPTWMeEJjItWp8wj51C2kPIRbShuzqtp+YR95LJux8azU37h6nkoZA==","X-Forefront-Antispam-Report":"CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;\n\tIPV:NLI; SFV:NSPM; H:DU0PR08MB9155.eurprd08.prod.outlook.com; PTR:;\n\tCAT:NONE; \n\tSFS:(13230028)(4636009)(39850400004)(136003)(396003)(376002)(346002)(366004)(451199021)(5660300002)(44832011)(8936002)(8676002)(2906002)(36756003)(38100700002)(31686004)(36916002)(6486002)(107886003)(6512007)(6506007)(478600001)(31696002)(53546011)(54906003)(186003)(26005)(2616005)(41300700001)(66946007)(6916009)(66556008)(66476007)(316002)(86362001)(4326008)(83380400001)(45980500001)(43740500002);\n\tDIR:OUT; SFP:1101; ","X-MS-Exchange-AntiSpam-MessageData-ChunkCount":"1","X-MS-Exchange-AntiSpam-MessageData-0":"=?utf-8?q?W5o81il7yI6TQ7LuMIJa22lJ/?=\n\t=?utf-8?q?Hf8hxdUqXA5OOx9KBaGg2V8nmU3wbCyZGNe/N0X2OMLytGIFq9Nlxzbl?=\n\t=?utf-8?q?8g6nTABb1JUsQ88jHWcEERvfCvoTZm2O6LSEx9A+0o0eCfo3Nr5NUMMG?=\n\t=?utf-8?q?gMvytORcZnZXT+qqVNnReRdCy1ra4/XEjX3vJ41qvff3tnE2w0141EvX?=\n\t=?utf-8?q?HL4vgx0LTfaxdJ/tT++XeqUwuCEKQdGikHq6LbxjVno8YqxWSKjLyUoQ?=\n\t=?utf-8?q?q4DcDrY5wYRm/NQkFM0CLYsGZSeKaFar/Zh2TRp1Bsbmag/TJ6Ishrk5?=\n\t=?utf-8?q?1MxQ2zEVFsfI6x46PEZr5lHTyEZUpe/CJkLvsxHzjBx1szZF8bcLLPg3?=\n\t=?utf-8?q?FW04I1gv81th6SLEgqahIgD/DBYXDKuam9DwYH1Nf4HEq0mB2ywU2Zqd?=\n\t=?utf-8?q?UX3wReLRktVWlKhVmi1POESV6WjTvWp8Rz23aGfPE6eusUmAMv2i2iMq?=\n\t=?utf-8?q?ISTIcT/8dAek70n7SgzfP+gmQd2Q+lTEC2/KsogiLlpZOvqVAj6LVUlz?=\n\t=?utf-8?q?hfApQS0CHu94XY7uULf8OG95IePzT+ipnKlC9yCSbAEGZRLXrc5VYtoI?=\n\t=?utf-8?q?r1VDllX8pRiCpCVnZFNfLLNIM7QzOkr6HdVtBNRcwa1ao6plZTNcNbs1?=\n\t=?utf-8?q?mwlimgR2KV81jPIj3h1aTqKWuQCtBIKsAle4sNlXXAaVh8wDqqPaz97I?=\n\t=?utf-8?q?bc1QrRpku7jcktLKE4+wOegrN5wViLVaw7/c3U1+OqzGuulR4bLmykuw?=\n\t=?utf-8?q?s4uDBzU+9/1jjssdHBcABUtFTusy03Rc4rZ4JoGwT4hcPGGJSS4nJ1En?=\n\t=?utf-8?q?JFXA9+SL3AQ/YpzpMt4Bo7w15KW44p7Nus5xsm2Lfqmy3InQyuuqDbAK?=\n\t=?utf-8?q?Kx7caAQX+cfJTel/Zhzm1nwyZvL3+YZg36T6wzc3ppCIRO2oO5/m9cN8?=\n\t=?utf-8?q?LVIUCvlvZ+C1RQ4QA65fA3hnGdRiplKGZ0sdTDH3avy88zySYboSJCD+?=\n\t=?utf-8?q?KX8OnYKgrtRnjvRAs9nv3LwuCRDmuV+ULuFuj9vcuiL/HoGBB2HdWOec?=\n\t=?utf-8?q?yVhCP6/g7O6G+9qgbk/8YmujmF81+HLyW2dO0mkhkTYBO7x6hJRnH0LL?=\n\t=?utf-8?q?kd7hPQZcR+EOgLgosVTuFuNod1jMaLe5vky4BzMpEroh1U7xf1Qksv+S?=\n\t=?utf-8?q?NLBJS2TnqRdmuXOWcG6T42TBuZZiQs+rI8eHA4VryCUSmMxRQ/Yh02uT?=\n\t=?utf-8?q?ZPGaMavYJVMyG4Vv+UvgdCs/K5h3A5wkuIYmOThvFTqcVtZNmW4M9FnG?=\n\t=?utf-8?q?RGfn8Gfmlv2ZPLq/MwM6b2OY2tc0jLU6WwKE7TksSsOTacTDDwGOXTli?=\n\t=?utf-8?q?5hop/GrNTPfoBChSmdxdx6ogiS9UjHDzMYR6CaG3b8ioevKW+zd4QxpS?=\n\t=?utf-8?q?xeLdicH/TYwdSO+ovWmEs397qUpUUv6kO74xPbwdP/Ym26oVh9E5djWP?=\n\t=?utf-8?q?Vwet4yYLmGzGykelyt8R9cvwShRH5H+J5nDbLWxIess5mvEpYOi7imnU?=\n\t=?utf-8?q?OtucIg7mzT4sRsl96s//FIQsd01URZCvQrfiIChTMgbK3YDt5M4tKqne?=\n\t=?utf-8?q?NuIbBY2Ygc/+Zc/RSjnd9hlEoNSN7sJa6Df782Wt4XEBeTvy2yIxv759?=\n\t=?utf-8?q?go1tr/Tsr8gQinp/q6iqIlWIwqtxA=3D=3D?=","X-OriginatorOrg":"wolfvision.net","X-MS-Exchange-CrossTenant-Network-Message-Id":"b162616f-1a95-450b-b1cd-08db40c8b692","X-MS-Exchange-CrossTenant-AuthSource":"DU0PR08MB9155.eurprd08.prod.outlook.com","X-MS-Exchange-CrossTenant-AuthAs":"Internal","X-MS-Exchange-CrossTenant-OriginalArrivalTime":"19 Apr 2023 11:25:00.5959\n\t(UTC)","X-MS-Exchange-CrossTenant-FromEntityHeader":"Hosted","X-MS-Exchange-CrossTenant-Id":"e94ec9da-9183-471e-83b3-51baa8eb804f","X-MS-Exchange-CrossTenant-MailboxType":"HOSTED","X-MS-Exchange-CrossTenant-UserPrincipalName":"2FmzuprboSnWWMs2sWKMpYWBhglPg7q3WmEjcs9dOSdG2SvYrtc7EP8delyH7ra+SFTbOpYr4u8sjpXPqRHd9vX+Ntp/Rb9Vp/8nVSSbitc=","X-MS-Exchange-Transport-CrossTenantHeadersStamped":"AS2PR08MB10225","Subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Michael Riesch via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Michael Riesch <michael.riesch@wolfvision.net>","Cc":"Dieter Mathis <Dieter.Mathis@wolfvision.net>,\n\tlinux-kernel@vger.kernel.org, \n\thverkuil@xs4all.nl, Matthias Fend <Matthias.Fend@wolfvision.net>,\n\tlibcamera-devel@lists.libcamera.org,\n\tAlexander Brotzge <Alexander.Brotzge@wolfvision.net>,\n\tMauro Carvalho Chehab <mchehab@kernel.org>, Michael Riesch via B4 Relay\n\t<devnull+michael.riesch.wolfvision.net@kernel.org>, \n\tlinux-media@vger.kernel.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26908,"web_url":"https://patchwork.libcamera.org/comment/26908/","msgid":"<CAPY8ntAYiCVM7gr2pU12CEDtRfTZOVYn0t-CPD7FA9DDq+mz4w@mail.gmail.com>","date":"2023-04-19T12:49:18","subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","submitter":{"id":27,"url":"https://patchwork.libcamera.org/api/people/27/","name":"Dave Stevenson","email":"dave.stevenson@raspberrypi.com"},"content":"Hi Michael\n\nOn Wed, 19 Apr 2023 at 12:25, Michael Riesch\n<michael.riesch@wolfvision.net> wrote:\n>\n> Hi Sakari,\n>\n> On 4/19/23 11:01, Sakari Ailus wrote:\n> > Hi Michael,\n> >\n> > On Mon, Apr 17, 2023 at 02:38:20PM +0200, Michael Riesch wrote:\n> >> Hi Sakari,\n> >>\n> >> On 4/12/23 17:12, Sakari Ailus wrote:\n> >>> Hi Dave, Michael,\n> >>>\n> >>> On Wed, Apr 12, 2023 at 02:55:56PM +0100, Dave Stevenson wrote:\n> >>>>>> If the ranges aren't updated, where should that out-of-range lens\n> >>>>>> movement leave the lens?\n> >>>>>\n> >>>>> This is up to the hardware controller, but I would guess it typically\n> >>>>> stops one step before disaster. Wherever that may be, the error\n> >>>>> condition and the current position can be read out via this new STATUS\n> >>>>> control.\n> >>>>>\n> >>>>> Does this sound good so far?\n> >>>>\n> >>>> Sounds reasonable, but I'm not the gatekeeper (that would be Sakari or\n> >>>> Laurent), and I'm just expressing my views based on the lenses I've\n> >>>> encountered.\n> >>>> All of my lenses have a single drive for focus, a single drive for\n> >>>> zoom, and where there are multiple elements they are all connected\n> >>>> mechanically. Your setup sounds far more complex and is likely to need\n> >>>> a more extensive driver, but it'd be nice to not unnecessarily\n> >>>> overcomplicate the interface.\n> >>>\n> >>> Could we also have a driver that uses these new controls?\n> >>\n> >> If you are referring to the driver for our custom lens controller, then\n> >> I have to say that it is under development and simply not ready for\n> >> release yet. Also, the decision has not yet been made whether or not\n> >> this will be an open-source driver.\n> >>\n> >> A different approach could be the adaptation of the vimc-lens driver,\n> >> which currently only supports FOCUS_ABSOLUTE. But this would raise\n> >> several implementation questions and at least for me this would be a\n> >> nontrivial task.\n> >>\n> >> Is it required to have a driver for this interface (in the sense that\n> >> the patches cannot be accepted otherwise)?\n> >\n> > That has been traditionally required, and a virtual driver isn't usually\n> > considered enough. There are at least two reasons for this. The first one\n> > being that if the driver isn't reviewable and targetting upstream it may be\n> > difficult to figure out whether the interface changes are the right ones\n> > for that driver. This is perhaps a lesser concern here. Secondly, there is\n> > also unwillingness to add interface elements that might never be supported\n> > by the kernel itself --- this is effectively just dead code.\n> >\n> > Also cc Hans and Laurent.\n>\n> I understand your concerns. Cc: Alexander and Dieter\n>\n> We aim to be an open-source friendly company. If you are OK with us\n> submitting a driver that targets very custom hardware that is only\n> available in integrated form in our products (and not, for instance,\n> available for sale as a standalone device), then we are prepared to\n> submit the driver sources for consideration for inclusion in mainline\n> Linux. Would this be acceptable?\n\nMy plan with the motor drive is far simpler with a Pi RP2040\nmicrocontroller on I2C running an ADC for the potentiometers, PWM for\nmotor control, and a PID loop driving it. The MCU code will be open\nsource.\nIt is a spare time project rather than work, so I can't guarantee\ntimescales, but I'll see if I can find some time to progress it.\n\n(It could all be driven from the kernel with ADC and PWM, but I don't\nsee such a driver being accepted. Offloading it to an MCU seems to be\nthe easier option).\n\n> As I already stated above, it will take us some time to prepare\n> everything in a form that is suitable for submission. Now should I\n> submit the next iteration(s) of the series at hand as RFC or as regular\n> patch series?\n>\n> >>> The controls themselves appear reasonable to me as well. I guess there are\n> >>> changes to be made based on the discussion?\n> >>\n> >> I'd summarize that whether or not the status controls are compound\n> >> controls of the type V4L2_CTRL_TYPE_LENS_STATUS is the open question.\n> >>\n> >> As a potential follow-up question I recently asked myself if the struct\n> >> v4l2_ctrl_lens_status should contain trailing reserved bytes for future\n> >> extension (no idea, though, what this could be).\n> >>\n> >> Alternatively, we could come up with \"V4L2_CID_FOCUS_CURRENT (integer)\"\n> >> for the current position and \"V4L2_CID_FOCUS_STATUS (bitmask)\" (and add\n> >> further controls when they are needed. Here, we lose atomicity but maybe\n> >> this can be ignored. One could assume that all relevant controls are\n> >> read out with a single ioctl which provides at least some level of\n> >> atomicity.\n\nVIDIOC_G_EXT_CTRLS should allow you to read multiple controls in one ioctl call.\nIt would be multiple calls to your g_volatile_ctrl handler, so\npotentially multiple I2C calls to your lens controller.\nThere is the option of cluster controls, but I think that is largely\nonly applicable for setting controls rather than reading them.\n\n  Dave\n\n> > There might be something that could be done in the control framework to\n> > address this. But it's not something that can be expected to happen soon.\n> >\n> > I'd perhaps keep them separate, not to make it a compound control just for\n> > the access reason. But I certainly don't have a strong opinion about it.\n>\n> After some further considerations, and following Dave's and your\n> comments, I'll keep them separate.\n>\n> Discussion to be continued with v2.\n>\n> Best regards,\n> Michael\n>\n> >\n> >>\n> >> Any comments and/or recommendations to this open question would be much\n> >> appreciated.\n> >>\n> >> Other review comments will be incorporated in the next iteration of this\n> >> series as well, but they are quite straightforward.\n> >","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id DFAE9BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 19 Apr 2023 12:49:37 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0D62C627B1;\n\tWed, 19 Apr 2023 14:49:37 +0200 (CEST)","from mail-vs1-xe2e.google.com (mail-vs1-xe2e.google.com\n\t[IPv6:2607:f8b0:4864:20::e2e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3D12D603A1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 19 Apr 2023 14:49:35 +0200 (CEST)","by mail-vs1-xe2e.google.com with SMTP id f39so4292841vsv.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 19 Apr 2023 05:49:35 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1681908577;\n\tbh=Akoqf03OHzs5A61cnRaA0zLAiVoomHQcCa/PfaoCLsc=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=oJp0aCglLDcPufo9Cu1txsjR9f3MQV/gC88cAN2do1k72bumlj1iCWjZy4cfthi2W\n\tTXyLy0dgaiswILMLBBrCudYkNVtd6cgXCdzDwWTBBEnco3e68d47BYj2x8uUJVFBxo\n\t77QuigDJS7FWJdvJJF4tOFglO+pflPnPav5ayVbmvkJgf8NNiJQqkKrdw6pwlO0BBu\n\tkwKHzWtHmDjrV2EX5Fruh/cO7wVhVwynvklUfPnhdO6GLKOB36cKEnHBLe/UMlMwdF\n\t0qWPlTj0H5P1+xhpqNGugyAZC91cLQodaCTbLqsbM2wst75RQNE/voKu/vrSoH4NiP\n\t0w4tpTydtOCEQ==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1681908574; x=1684500574;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date:message-id:reply-to;\n\tbh=w9ZPopfYb851oejNmrAcF7O0IByv+Fq2MPAPsJJ/DqQ=;\n\tb=RT7+HX3qWB3xYcDjZFMsz6lztVqMmovaSB2+eFCV8Nzl5nAQ1Vz585FD3QMl/Sw+ZV\n\tdcR5RKk8OjDOYIuYxqEeZgMZRPACYkBFCvQoPfsU3pFNTc3LzpB6owfYwVaZS5Ar/bL7\n\tmHtOK4e0H7uv8Ys6coMENmrNr66T3gNbMes97xmdbau/bPANiVaiB1YgyWlYmi+EfSzf\n\tgDwwqLXdcQKpcSeeEk87vAPVfqi9La6sic8Oubx5NR7ItiddnTO/rN5MgXZJMhOopnLY\n\tv4cGnN91EtXKuUuxRUQvDl1qtieuvgbEXnidmfe2j5DCiZXH8gANBZhwBXZaBhhLap9p\n\tlxyw=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"RT7+HX3q\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20221208; t=1681908574; x=1684500574;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=w9ZPopfYb851oejNmrAcF7O0IByv+Fq2MPAPsJJ/DqQ=;\n\tb=aP6KBqXBMkn6HwPqUXPWJc6/v24MsYD3vrm63wJT3FV3gypkr0p35GqNFqcPL4h8pb\n\tscSj5pUQ2mLm75Wpx9uzCIjIOtAIK/v82Kt74RqA23gmApHCZ9aXC6nHPejb+OQDRFvG\n\ttJA7zzBuv8o55AKr4da0++AR/7VRmRnTiWxOpXmNGld8tD0rAVOf2u95zQXDwsfpHQgA\n\tnhFlpE+FnFP5F2ZrLrQz5kS2IplbVxojedNwuGnNVpyRDuClHH14PKrNi0MxyxvW1nGk\n\tdQUmqYhYXLgfm3jytOCJN42bvgXPdRG09C6ONBxb8blzBpGccU3MqGmHHKAIAN+KV3DP\n\tzpzA==","X-Gm-Message-State":"AAQBX9eWbgBeJAAB9d1Tw40t2KrxjImLFDddrrdH/AVpMW2yenkboL/X\n\tIv+MK+12TnjfsYs1xHDQ7ADLs8l5UyDlEtSaM2NsmX0GFEi7GvbzUgc=","X-Google-Smtp-Source":"AKy350aq1mhGLE4hoHadZ/gc4EutmzjUTgZamR0AicY3syq8d/SzTnWNCtDlNqSDaz2Uiq3lekb/FJ6jmGHzVvJ+dLg=","X-Received":"by 2002:a05:6102:3003:b0:42f:e8d9:989 with SMTP id\n\ts3-20020a056102300300b0042fe8d90989mr4668084vsa.14.1681908573976;\n\tWed, 19 Apr 2023 05:49:33 -0700 (PDT)","MIME-Version":"1.0","References":"<20230406-feature-controls-lens-v1-0-543189a680de@wolfvision.net>\n\t<20230406-feature-controls-lens-v1-1-543189a680de@wolfvision.net>\n\t<CAPY8ntArOOqPQzvkJrQEyuVFfb6j8x6WODTMHOn1qHPU588mbQ@mail.gmail.com>\n\t<0f1baf5e-2ff6-e10b-5c3e-0a82c71d0ce6@wolfvision.net>\n\t<CAPY8ntAjBEFfeV6nnQs34Y22QM-irT13ALDv4ksP8AYK=jWsKg@mail.gmail.com>\n\t<3ab7bfc4-aaae-2e39-b420-40ad8d71dda4@wolfvision.net>\n\t<CAPY8ntCNuvgmF37kDvVh1kuepbLqy2hWcz9HOi8iub9trHmi2g@mail.gmail.com>\n\t<ZDbKU5kwcb7RGeCo@kekkonen.localdomain>\n\t<ccae3994-3b1b-4050-ea34-98f97cf886e0@wolfvision.net>\n\t<ZD+t5QYH20Y8+8MV@kekkonen.localdomain>\n\t<45fea085-54c3-157e-6459-adaaf1edebf5@wolfvision.net>","In-Reply-To":"<45fea085-54c3-157e-6459-adaaf1edebf5@wolfvision.net>","Date":"Wed, 19 Apr 2023 13:49:18 +0100","Message-ID":"<CAPY8ntAYiCVM7gr2pU12CEDtRfTZOVYn0t-CPD7FA9DDq+mz4w@mail.gmail.com>","To":"Michael Riesch <michael.riesch@wolfvision.net>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Dave Stevenson via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Dave Stevenson <dave.stevenson@raspberrypi.com>","Cc":"Dieter Mathis <Dieter.Mathis@wolfvision.net>,\n\tlinux-kernel@vger.kernel.org, \n\thverkuil@xs4all.nl, Matthias Fend <Matthias.Fend@wolfvision.net>,\n\tlibcamera-devel@lists.libcamera.org,\n\tSakari Ailus <sakari.ailus@linux.intel.com>,\n\tAlexander Brotzge <Alexander.Brotzge@wolfvision.net>,\n\tMauro Carvalho Chehab <mchehab@kernel.org>, Michael Riesch via B4 Relay\n\t<devnull+michael.riesch.wolfvision.net@kernel.org>, \n\tlinux-media@vger.kernel.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26933,"web_url":"https://patchwork.libcamera.org/comment/26933/","msgid":"<ZEbfEPeNCS9hBBnP@kekkonen.localdomain>","date":"2023-04-24T19:57:04","subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","submitter":{"id":37,"url":"https://patchwork.libcamera.org/api/people/37/","name":"Sakari Ailus","email":"sakari.ailus@linux.intel.com"},"content":"Hi Michael,\n\nOn Wed, Apr 19, 2023 at 01:24:58PM +0200, Michael Riesch wrote:\n> Hi Sakari,\n> \n> On 4/19/23 11:01, Sakari Ailus wrote:\n> > Hi Michael,\n> > \n> > On Mon, Apr 17, 2023 at 02:38:20PM +0200, Michael Riesch wrote:\n> >> Hi Sakari,\n> >>\n> >> On 4/12/23 17:12, Sakari Ailus wrote:\n> >>> Hi Dave, Michael,\n> >>>\n> >>> On Wed, Apr 12, 2023 at 02:55:56PM +0100, Dave Stevenson wrote:\n> >>>>>> If the ranges aren't updated, where should that out-of-range lens\n> >>>>>> movement leave the lens?\n> >>>>>\n> >>>>> This is up to the hardware controller, but I would guess it typically\n> >>>>> stops one step before disaster. Wherever that may be, the error\n> >>>>> condition and the current position can be read out via this new STATUS\n> >>>>> control.\n> >>>>>\n> >>>>> Does this sound good so far?\n> >>>>\n> >>>> Sounds reasonable, but I'm not the gatekeeper (that would be Sakari or\n> >>>> Laurent), and I'm just expressing my views based on the lenses I've\n> >>>> encountered.\n> >>>> All of my lenses have a single drive for focus, a single drive for\n> >>>> zoom, and where there are multiple elements they are all connected\n> >>>> mechanically. Your setup sounds far more complex and is likely to need\n> >>>> a more extensive driver, but it'd be nice to not unnecessarily\n> >>>> overcomplicate the interface.\n> >>>\n> >>> Could we also have a driver that uses these new controls?\n> >>\n> >> If you are referring to the driver for our custom lens controller, then\n> >> I have to say that it is under development and simply not ready for\n> >> release yet. Also, the decision has not yet been made whether or not\n> >> this will be an open-source driver.\n> >>\n> >> A different approach could be the adaptation of the vimc-lens driver,\n> >> which currently only supports FOCUS_ABSOLUTE. But this would raise\n> >> several implementation questions and at least for me this would be a\n> >> nontrivial task.\n> >>\n> >> Is it required to have a driver for this interface (in the sense that\n> >> the patches cannot be accepted otherwise)?\n> > \n> > That has been traditionally required, and a virtual driver isn't usually\n> > considered enough. There are at least two reasons for this. The first one\n> > being that if the driver isn't reviewable and targetting upstream it may be\n> > difficult to figure out whether the interface changes are the right ones\n> > for that driver. This is perhaps a lesser concern here. Secondly, there is\n> > also unwillingness to add interface elements that might never be supported\n> > by the kernel itself --- this is effectively just dead code.\n> > \n> > Also cc Hans and Laurent.\n> \n> I understand your concerns. Cc: Alexander and Dieter\n> \n> We aim to be an open-source friendly company. If you are OK with us\n> submitting a driver that targets very custom hardware that is only\n> available in integrated form in our products (and not, for instance,\n> available for sale as a standalone device), then we are prepared to\n> submit the driver sources for consideration for inclusion in mainline\n> Linux. Would this be acceptable?\n\nHow easily can you run your own kernel on this thing?\n\nA somewhat close comparison point to this would be mobile phones that come\nwith raw camera sensors that often are found nowhere else except on that\nvery phone model. These are not always very easy to use actually. It is\nalso true that these sensors _could_ be found elsewhere and sometimes are.\n\nI wonder what others think.\n\n> \n> As I already stated above, it will take us some time to prepare\n> everything in a form that is suitable for submission. Now should I\n> submit the next iteration(s) of the series at hand as RFC or as regular\n> patch series?\n\nRFC perhaps, unless it comes with a driver? It doesn't necessarily matter\nmuch in the end. Sometimes what was labelled as RFC gets merged as-is, at\nother times there are 20 versions of what was labelled as PATCH to begin\nwith.\n\n> \n> >>> The controls themselves appear reasonable to me as well. I guess there are\n> >>> changes to be made based on the discussion?\n> >>\n> >> I'd summarize that whether or not the status controls are compound\n> >> controls of the type V4L2_CTRL_TYPE_LENS_STATUS is the open question.\n> >>\n> >> As a potential follow-up question I recently asked myself if the struct\n> >> v4l2_ctrl_lens_status should contain trailing reserved bytes for future\n> >> extension (no idea, though, what this could be).\n> >>\n> >> Alternatively, we could come up with \"V4L2_CID_FOCUS_CURRENT (integer)\"\n> >> for the current position and \"V4L2_CID_FOCUS_STATUS (bitmask)\" (and add\n> >> further controls when they are needed. Here, we lose atomicity but maybe\n> >> this can be ignored. One could assume that all relevant controls are\n> >> read out with a single ioctl which provides at least some level of\n> >> atomicity.\n> > \n> > There might be something that could be done in the control framework to\n> > address this. But it's not something that can be expected to happen soon.\n> > \n> > I'd perhaps keep them separate, not to make it a compound control just for\n> > the access reason. But I certainly don't have a strong opinion about it.\n> \n> After some further considerations, and following Dave's and your\n> comments, I'll keep them separate.\n> \n> Discussion to be continued with v2.","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 1087EBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 24 Apr 2023 19:57:24 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1A49E627D1;\n\tMon, 24 Apr 2023 21:57:23 +0200 (CEST)","from mga12.intel.com (mga12.intel.com [192.55.52.136])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id ADBC961EB2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Apr 2023 21:57:20 +0200 (CEST)","from fmsmga006.fm.intel.com ([10.253.24.20])\n\tby fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; \n\t24 Apr 2023 12:57:10 -0700","from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com)\n\t([10.237.72.44]) by fmsmga006-auth.fm.intel.com with\n\tESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2023 12:57:07 -0700","from kekkonen.localdomain (localhost [IPv6:::1])\n\tby kekkonen.fi.intel.com (Postfix) with SMTP id 6433911FAD0;\n\tMon, 24 Apr 2023 22:57:04 +0300 (EEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1682366243;\n\tbh=G+deS8h8FoffVbs4vbkzCb9zdDbBYPFKIFtYSNJTiYo=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=s2nMDlXXvZ0kXGZ/mEEEPdmQdNfB2b0Dfx+EBukogXH0lgiPYCbYnZrxUgkAIeci3\n\twPhbi3X+Fd4wGSSDml0KwHKWEm+GINXiXeukmWldcps8vOTvXKL5x4qzzxZUaziwMf\n\tRLPWJ5NVvASGjwhtrTvl9rkDTpVSBT/xxAUFDTeyGWjKKAIznZ4frVfpNv4OesjGmb\n\t7iKww89ql1eDTVr4HJ0BdarpIS9/X+LvIa9UdRXSsyrKzV6TaWHz3KqtGO9LDM9d9n\n\tTYt+z4nBzaOYFYI9I9vUGCOhFQhJjhRQSrdkpeTeRZHW0T/D4mYLTV0upzKzsmz5hT\n\tE+3V7pNSsjCHA==","v=1; a=rsa-sha256; c=relaxed/simple;\n\td=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n\tt=1682366240; x=1713902240;\n\th=date:from:to:cc:subject:message-id:references:\n\tmime-version:in-reply-to;\n\tbh=G+deS8h8FoffVbs4vbkzCb9zdDbBYPFKIFtYSNJTiYo=;\n\tb=INdKeowq8uPHeI1TI/xCtaxTl/JRBBLQ3+YOQnAYDDkyLbi8rWKkQw3R\n\t/WYcjoBrVSab+0ZZtyYYYem2iZHTsa5iSRnVEjffrd72hyyKrBYXkBMyf\n\t9PJERHUJzl5tZvpwXd3k4qLUDhQN4TiVLysBuSYh8FVJXDOwYuDru9OHY\n\tZKe/wD8QkiMVlFTjI6bFKNSQ9/2f23TXpHbXLKRi5PDxDOkuCA2T/8y2r\n\tpEYxeXw3+qDTYw3E0dtWXTvKJHu+vloe9nbFPlyEO8s5PbVgL+WaxKpM0\n\tlhaVl59NhM+0I4bqOd0xY5kU90qzoJVQDl5Z9m0bQdRPsf53nGsg5Pswt A==;"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=intel.com header.i=@intel.com\n\theader.b=\"INdKeowq\"; dkim-atps=neutral","X-IronPort-AV":["E=McAfee;i=\"6600,9927,10690\"; a=\"326156763\"","E=Sophos;i=\"5.99,223,1677571200\"; d=\"scan'208\";a=\"326156763\"","E=McAfee;i=\"6600,9927,10690\"; a=\"939463928\"","E=Sophos;i=\"5.99,223,1677571200\"; d=\"scan'208\";a=\"939463928\""],"X-ExtLoop1":"1","Date":"Mon, 24 Apr 2023 22:57:04 +0300","To":"Michael Riesch <michael.riesch@wolfvision.net>","Message-ID":"<ZEbfEPeNCS9hBBnP@kekkonen.localdomain>","References":"<20230406-feature-controls-lens-v1-1-543189a680de@wolfvision.net>\n\t<CAPY8ntArOOqPQzvkJrQEyuVFfb6j8x6WODTMHOn1qHPU588mbQ@mail.gmail.com>\n\t<0f1baf5e-2ff6-e10b-5c3e-0a82c71d0ce6@wolfvision.net>\n\t<CAPY8ntAjBEFfeV6nnQs34Y22QM-irT13ALDv4ksP8AYK=jWsKg@mail.gmail.com>\n\t<3ab7bfc4-aaae-2e39-b420-40ad8d71dda4@wolfvision.net>\n\t<CAPY8ntCNuvgmF37kDvVh1kuepbLqy2hWcz9HOi8iub9trHmi2g@mail.gmail.com>\n\t<ZDbKU5kwcb7RGeCo@kekkonen.localdomain>\n\t<ccae3994-3b1b-4050-ea34-98f97cf886e0@wolfvision.net>\n\t<ZD+t5QYH20Y8+8MV@kekkonen.localdomain>\n\t<45fea085-54c3-157e-6459-adaaf1edebf5@wolfvision.net>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<45fea085-54c3-157e-6459-adaaf1edebf5@wolfvision.net>","Subject":"Re: [libcamera-devel] [PATCH RFC 1/4] media: v4l2-ctrls: add lens\n\tgroup status controls for zoom and focus","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Sakari Ailus via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Sakari Ailus <sakari.ailus@linux.intel.com>","Cc":"Dieter Mathis <Dieter.Mathis@wolfvision.net>,\n\tlinux-kernel@vger.kernel.org, \n\thverkuil@xs4all.nl, Matthias Fend <Matthias.Fend@wolfvision.net>,\n\tlibcamera-devel@lists.libcamera.org,\n\tAlexander Brotzge <Alexander.Brotzge@wolfvision.net>,\n\tMauro Carvalho Chehab <mchehab@kernel.org>, Michael Riesch via B4 Relay\n\t<devnull+michael.riesch.wolfvision.net@kernel.org>, \n\tlinux-media@vger.kernel.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]