{"id":10910,"url":"https://patchwork.libcamera.org/api/1.1/patches/10910/?format=json","web_url":"https://patchwork.libcamera.org/patch/10910/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210120102937.200745-1-jacopo@jmondi.org>","date":"2021-01-20T10:29:37","name":"[libcamera-devel,v2.1,02/11] libcamera: camera_sensor: Make V4L2_CID_EXPOSURE mandatory","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"fd9fcdd1a2e04b4538923d234ba5f2761aa51644","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/1.1/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":{"id":15,"url":"https://patchwork.libcamera.org/api/1.1/users/15/?format=json","username":"jmondi","first_name":"Jacopo","last_name":"Mondi","email":"jacopo@jmondi.org"},"mbox":"https://patchwork.libcamera.org/patch/10910/mbox/","series":[{"id":1588,"url":"https://patchwork.libcamera.org/api/1.1/series/1588/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1588","date":"2021-01-20T10:29:37","name":null,"version":1,"mbox":"https://patchwork.libcamera.org/series/1588/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/10910/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/10910/checks/","tags":{},"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 00ADDC0F2A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 20 Jan 2021 10:29:24 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C271868194;\n\tWed, 20 Jan 2021 11:29:23 +0100 (CET)","from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net\n\t[217.70.183.196])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 115696817D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 Jan 2021 11:29:22 +0100 (CET)","from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay4-d.mail.gandi.net (Postfix) with ESMTPSA id CF137E0005\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 Jan 2021 10:29:21 +0000 (UTC)"],"X-Originating-IP":"93.34.118.233","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 20 Jan 2021 11:29:37 +0100","Message-Id":"<20210120102937.200745-1-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.29.2","In-Reply-To":"<20210119143711.153517-3-jacopo@jmondi.org>","References":"<20210119143711.153517-3-jacopo@jmondi.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v2.1 02/11] libcamera: camera_sensor: Make\n\tV4L2_CID_EXPOSURE mandatory","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>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Add the V4L2_CID_EXPOSURE control to the list of mandatory controls the\nsensor driver has to report and document this new requirement.\n\nWhile at it, re-sort the mandatory V4L2 controls in alphabetical\norder in the CameraSensor class and remove the above comment as\nthe usage of the controls is better reported in the documentation.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n Documentation/sensor_driver_requirements.rst | 11 ++++++++++-\n src/libcamera/camera_sensor.cpp              |  5 ++---\n 2 files changed, 12 insertions(+), 4 deletions(-)\n\n--\n2.29.2","diff":"diff --git a/Documentation/sensor_driver_requirements.rst b/Documentation/sensor_driver_requirements.rst\nindex 1dc8c890d16d..c45d5a7ae61b 100644\n--- a/Documentation/sensor_driver_requirements.rst\n+++ b/Documentation/sensor_driver_requirements.rst\n@@ -24,13 +24,22 @@ The sensor driver is assumed to be fully compliant with the V4L2 specification.\n\n The sensor driver shall support the following V4L2 controls:\n\n+* `V4L2_CID_EXPOSURE`_\n * `V4L2_CID_HBLANK`_\n * `V4L2_CID_PIXEL_RATE`_\n\n+.. _V4L2_CID_EXPOSURE: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/control.html\n .. _V4L2_CID_HBLANK: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/ext-ctrls-image-source.html\n .. _V4L2_CID_PIXEL_RATE: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/ext-ctrls-image-process.html\n\n-Both controls are used to compute the sensor output timings.\n+The `EXPOSURE` control shall report the image integration time in number of\n+lines. While V4L2 doesn't specify a unit for the `EXPOSURE` control, libcamera\n+requires it to be expressed as a number of image lines. Camera sensor drivers\n+that do not comply with this requirement will need to be adapted or will produce\n+incorrect results.\n+\n+The `HBLANK` and `PIXEL_RATE` controls are used to compute the sensor output\n+timings.\n\n Optional Requirements\n ---------------------\ndiff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex 9abb9d330664..ca33c0094088 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -239,12 +239,11 @@ int CameraSensor::validateSensorDriver()\n \t/*\n \t * Make sure the sensor driver supports the mandatory controls\n \t * required by the CameraSensor class.\n-\t * - V4L2_CID_PIXEL_RATE is used to calculate the sensor timings\n-\t * - V4L2_CID_HBLANK is used to calculate the line length\n \t */\n \tconst std::vector<uint32_t> mandatoryControls{\n-\t\tV4L2_CID_PIXEL_RATE,\n+\t\tV4L2_CID_EXPOSURE,\n \t\tV4L2_CID_HBLANK,\n+\t\tV4L2_CID_PIXEL_RATE,\n \t};\n\n \tControlList ctrls = subdev_->getControls(mandatoryControls);\n","prefixes":["libcamera-devel","v2.1","02/11"]}