From patchwork Tue Aug 28 07:55:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe De Muyter X-Patchwork-Id: 10578019 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8F63E14BD for ; Tue, 28 Aug 2018 08:03:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BDCC2237D for ; Tue, 28 Aug 2018 08:03:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F851284F1; Tue, 28 Aug 2018 08:03:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 47EDD2237D for ; Tue, 28 Aug 2018 08:03:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727087AbeH1LxX (ORCPT ); Tue, 28 Aug 2018 07:53:23 -0400 Received: from smtp2.macqel.be ([109.135.2.61]:62581 "EHLO smtp2.macqel.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726997AbeH1LxW (ORCPT ); Tue, 28 Aug 2018 07:53:22 -0400 X-Greylist: delayed 448 seconds by postgrey-1.27 at vger.kernel.org; Tue, 28 Aug 2018 07:53:21 EDT Received: from localhost (localhost [127.0.0.1]) by smtp2.macqel.be (Postfix) with ESMTP id 93A77130D3E; Tue, 28 Aug 2018 09:55:27 +0200 (CEST) X-Virus-Scanned: amavisd-new at macqel.be Received: from smtp2.macqel.be ([127.0.0.1]) by localhost (mail.macqel.be [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qLU1kMk+CEIE; Tue, 28 Aug 2018 09:55:26 +0200 (CEST) Received: from perdita.MACQEL (perdita.macqel [10.1.40.53]) by smtp2.macqel.be (Postfix) with ESMTP id DF244130D0E; Tue, 28 Aug 2018 09:55:25 +0200 (CEST) Received: from perdita.MACQEL (localhost [127.0.0.1]) by perdita.MACQEL (8.14.4/8.14.4/SuSE Linux 0.8) with ESMTP id w7S7tNEv008705; Tue, 28 Aug 2018 09:55:25 +0200 Received: (from p6@localhost) by perdita.MACQEL (8.14.4/8.14.4/Submit) id w7S7tNAV008696; Tue, 28 Aug 2018 09:55:23 +0200 X-Authentication-Warning: perdita.MACQEL: p6 set sender to phdm@macq.eu using -f From: Philippe De Muyter To: linux-media@vger.kernel.org Cc: Philippe De Muyter Subject: [PATCH] media: v4l2-subdev.h: allow V4L2_FRMIVAL_TYPE_CONTINUOUS & _STEPWISE Date: Tue, 28 Aug 2018 09:55:07 +0200 Message-Id: <1535442907-8659-1-git-send-email-phdm@macqel.be> X-Mailer: git-send-email 1.8.4 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP add max_interval and step_interval to struct v4l2_subdev_frame_interval_enum. When filled correctly by the sensor driver, those fields must be used as follows by the intermediate level : struct v4l2_frmivalenum *fival; struct v4l2_subdev_frame_interval_enum fie; if (fie.max_interval.numerator == 0) { fival->type = V4L2_FRMIVAL_TYPE_DISCRETE; fival->discrete = fie.interval; } else if (fie.step_interval.numerator == 0) { fival->type = V4L2_FRMIVAL_TYPE_CONTINUOUS; fival->stepwise.min = fie.interval; fival->stepwise.max = fie.max_interval; } else { fival->type = V4L2_FRMIVAL_TYPE_STEPWISE; fival->stepwise.min = fie.interval; fival->stepwise.max = fie.max_interval; fival->stepwise.step = fie.step_interval; } Signed-off-by: Philippe De Muyter --- .../uapi/v4l/vidioc-subdev-enum-frame-interval.rst | 39 +++++++++++++++++++++- include/uapi/linux/v4l2-subdev.h | 4 ++- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-interval.rst b/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-interval.rst index 1bfe386..acc516e 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-interval.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-interval.rst @@ -51,6 +51,37 @@ EINVAL error code if one of the input fields is invalid. All frame intervals are enumerable by beginning at index zero and incrementing by one until ``EINVAL`` is returned. +If the sub-device can work only at the fixed set of frame intervals, +driver must enumerate them with increasing indexes, by only filling +the ``interval`` field. If the sub-device can work with a continuous +range of frame intervals, driver must only return success for index 0 +and fill ``interval`` with the minimum interval, ``max_interval`` with +the maximum interval, and ``step_interval`` with 0 or the step between +the possible intervals. + +Callers are expected to use the returned information as follows : + +.. code-block:: c + + struct v4l2_frmivalenum * fival; + struct v4l2_subdev_frame_interval_enum fie; + + if (fie.max_interval.numerator == 0) { + fival->type = V4L2_FRMIVAL_TYPE_DISCRETE; + fival->discrete = fie.interval; + } else if (fie.step_interval.numerator == 0) { + fival->type = V4L2_FRMIVAL_TYPE_CONTINUOUS; + fival->stepwise.min = fie.interval; + fival->stepwise.max = fie.max_interval; + } else { + fival->type = V4L2_FRMIVAL_TYPE_STEPWISE; + fival->stepwise.min = fie.interval; + fival->stepwise.max = fie.max_interval; + fival->stepwise.step = fie.step_interval; + } + +.. code-block:: c + Available frame intervals may depend on the current 'try' formats at other pads of the sub-device, as well as on the current active links. See :ref:`VIDIOC_SUBDEV_G_FMT` for more @@ -92,8 +123,14 @@ multiple pads of the same sub-device is not defined. - ``which`` - Frame intervals to be enumerated, from enum :ref:`v4l2_subdev_format_whence `. + * - struct :c:type:`v4l2_fract` + - ``max_interval`` + - Maximum period, in seconds, between consecutive video frames, or 0. + * - struct :c:type:`v4l2_fract` + - ``step_interval`` + - Frame interval step size, in seconds, or 0. * - __u32 - - ``reserved``\ [8] + - ``reserved``\ [4] - Reserved for future extensions. Applications and drivers must set the array to zero. diff --git a/include/uapi/linux/v4l2-subdev.h b/include/uapi/linux/v4l2-subdev.h index 03970ce..c944644 100644 --- a/include/uapi/linux/v4l2-subdev.h +++ b/include/uapi/linux/v4l2-subdev.h @@ -128,7 +128,9 @@ struct v4l2_subdev_frame_interval_enum { __u32 height; struct v4l2_fract interval; __u32 which; - __u32 reserved[8]; + struct v4l2_fract max_interval; + struct v4l2_fract step_interval; + __u32 reserved[4]; }; /**