From patchwork Tue Aug 10 09:38:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 76268 Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1mDODO-009XuX-HJ; Tue, 10 Aug 2021 09:38:38 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239225AbhHJJin (ORCPT + 1 other); Tue, 10 Aug 2021 05:38:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237707AbhHJJin (ORCPT ); Tue, 10 Aug 2021 05:38:43 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5692BC0613D3 for ; Tue, 10 Aug 2021 02:38:21 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id h14so25354569wrx.10 for ; Tue, 10 Aug 2021 02:38:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7mqS3/0u9zikzgyiq6RTjXlJna72qnR7Oy4JzUDb+vQ=; b=eK+/pQDtg/O4CCL3Q8zyl5W4TGawZlm2FSHVhPaq8AiRHEJy3txlRfVlDJY6sFsYga TaM1tMpy8GYs+SzJbk6aBUvKakOIgy22JTGgG7Bo4izMRmcpcsu8o7ljTqfJUvKNVIG5 dPJV3p8Ple6UzRQPDnDSzKoVY6Co1MqioNlInDZKEWOzkZ8f8wV5kpNf1o6fWDlvnf6K QWfUuEewO5jsNTwrwFt7bv/ti/L7ExVgpggHhSocIJGfmP2/8EXQ5zZA5rEzbnfxwt4y A/7FvyPJoW1RH9JJnsix5KzM6io/f1Wv/L3pLnA3Lqcdn0Z0KAIReoicUwt4WWlZN9Cq ++Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7mqS3/0u9zikzgyiq6RTjXlJna72qnR7Oy4JzUDb+vQ=; b=nSI0/0bKxRqBj2WZ/t27xcAgqf27gSm0KL+LvDVB4wrJAsM/8sFxgs9OxBoXlPwLyI lUaReCQQtsgNIlT3if53Dzhd+cSxXaoXyMVWrWPEqzu9upVePvXLY+4KWXnkXqmjFOCO 43xVFs16Elz8aYHGGc9JxPHT4whG/vcFVO7SNlJnNFKsROWJb7ELDaUmWapGHDODFOBF /bUD4mQGyoDZsjNpOah+knp+m+iZcZSZAAJhyso/xumow0PtHALHBpRSlJbOC+6oPlXi Tz1PJpUaRthGOJO/YBF8A6G76IneGO4EyP/fzveCubsQQtpFHy4w/gJ7Nm1Y0t2tbEhM f21w== X-Gm-Message-State: AOAM531QcKTB6Vuw5FIQX7Lry8jQGG+7+N0wlJHcFc1YdGrHyn/zOOLX bWUytYsJMcAUAQylffvtUBfR906KB3kdBQ== X-Google-Smtp-Source: ABdhPJxW+WsPsdIUYlw2s73Jn3tWxkJfDeRSrLUEaeKO7DI8sU9f2zpgGqjl/xGQpgd7K82FLHlchA== X-Received: by 2002:a5d:5343:: with SMTP id t3mr17470257wrv.273.1628588299756; Tue, 10 Aug 2021 02:38:19 -0700 (PDT) Received: from davidp-xps-13.pitowers.org ([2a00:1098:3142:14:c482:80d:24db:a016]) by smtp.gmail.com with ESMTPSA id x12sm22933385wrt.35.2021.08.10.02.38.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Aug 2021 02:38:19 -0700 (PDT) From: David Plowman To: linux-media@vger.kernel.org, Hans Verkuil , sakari.ailus@iki.fi, Laurent Pinchart , Kieran Bingham , Mauro Carvalho Chehab Cc: David Plowman Subject: [PATCH v5 1/2] media: v4l2-ctrls: Add V4L2_CID_NOTIFY_GAINS control Date: Tue, 10 Aug 2021 10:38:10 +0100 Message-Id: <20210810093811.7205-2-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210810093811.7205-1-david.plowman@raspberrypi.com> References: <20210810093811.7205-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-LSpam-Score: -3.2 (---) X-LSpam-Report: No, score=-3.2 required=5.0 tests=BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_LOW=-0.7 autolearn=ham autolearn_force=no We add a new control V4L2_CID_NOTIFY_GAINS which allows the sensor to be notified what gains will be applied to the different colour channels by subsequent processing (such as by an ISP), even though the sensor will not apply any of these gains itself. For Bayer sensors this will be an array control taking 4 values which are the 4 gains arranged in the fixed order B, Gb, Gr and R, irrespective of the exact Bayer order of the sensor itself. The use of an array makes it straightforward to extend this control to non-Bayer sensors (for example, sensors with an RGBW pattern) in future. The units are in all cases linear with the default value indicating a gain of exactly 1. For example, if the default value were reported as 128 then the value 256 would represent a gain of exactly 2. Signed-off-by: David Plowman Reviewed-by: Laurent Pinchart --- drivers/media/v4l2-core/v4l2-ctrls-defs.c | 1 + include/uapi/linux/v4l2-controls.h | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c index 421300e13a41..f87053c83249 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c @@ -1107,6 +1107,7 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_TEST_PATTERN_GREENR: return "Green (Red) Pixel Value"; case V4L2_CID_TEST_PATTERN_BLUE: return "Blue Pixel Value"; case V4L2_CID_TEST_PATTERN_GREENB: return "Green (Blue) Pixel Value"; + case V4L2_CID_NOTIFY_GAINS: return "Notify Gains"; /* Image processing controls */ /* Keep the order of the 'case's the same as in v4l2-controls.h! */ diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 5532b5f68493..133e20444939 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -1118,6 +1118,7 @@ enum v4l2_jpeg_chroma_subsampling { #define V4L2_CID_TEST_PATTERN_BLUE (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 6) #define V4L2_CID_TEST_PATTERN_GREENB (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 7) #define V4L2_CID_UNIT_CELL_SIZE (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 8) +#define V4L2_CID_NOTIFY_GAINS (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 9) /* Image processing controls */ From patchwork Tue Aug 10 09:38:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 76269 Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1mDODX-009XuX-J8; Tue, 10 Aug 2021 09:38:43 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239227AbhHJJio (ORCPT + 1 other); Tue, 10 Aug 2021 05:38:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239216AbhHJJin (ORCPT ); Tue, 10 Aug 2021 05:38:43 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 037BBC0613D3 for ; Tue, 10 Aug 2021 02:38:22 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id m12so25350606wru.12 for ; Tue, 10 Aug 2021 02:38:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mEFn88oQtUiILjfkUfL7wKDJQwdHKA6Siy5/iZNttrQ=; b=QzsuJ7H045SRY+EKr7KX+4IRGwTs9JMdOkQ64BNZI0N4uLnv3uxoCvRaRayH0Lt+hX AqSIbtUx797FV8NmaJYC5r8TekxIkwJMacyl/GJHtvWmhmp+BFeDkCkLt0D9hqg/smHy IlKfs8u0gG58/O9r/OgzJAQwk0LK87lnuYgeQqT/0q8+EySFtQBrpL5wWOvytEfeLaZ3 3+4jG0z6zacEpQvb12LZIdn8PF1+O1HPd4cGPjZmr98MVXzfbOsid9FZyMPlYvWjPz+o MZKJfEyFE50J1hZ/bHCGvms05HIAHCnxlmRlgqmbLeoHYuxLi7mh6VzbHGm/Pzc0Nj6U Unew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mEFn88oQtUiILjfkUfL7wKDJQwdHKA6Siy5/iZNttrQ=; b=Ne0hJg+uRPlzXOP0rN1dUhy9IITYKobWb3GSZ8tEAbFeJJN08Kf1mMNGARRrFTaRDR WE3xnrHHkJerJR4fsJ0A7KJXgMrTCyJ4lClwm/2kLon5VaIePO/cna49KmV8qidaOBx9 clmkH8vszCpeHlhTyFLIFifWcG5w76iDn5w2T8h374PDaE6QtSRBHAmaNvcNpgpHIgbN 1irQNBGz7KjGHfHAUvECIrLILJlrk3Seo7If9yYvZ8WqRKHSzsTLMVd8QJ2ue5y4/reL IzWcXuniADcKkM1BohMgGn2DoQ0xPBYth93tG2TGUVIyzER622tBLj/iLyVpQTgoYx+n Hy2Q== X-Gm-Message-State: AOAM5330/ol7CF73Lmrn2Fcqts5S0PFpLf+ZFShfCoftaYp9rOziOXIM LibwKD8jNF0f3VZbY+/ywiJtZp6AAMwlbQ== X-Google-Smtp-Source: ABdhPJznPBrdmduAZtyEzIr2neWbFPCSV6eg85IP8r545GvhmxvK81C8XlQATjLyQKFfn7bCb0znFA== X-Received: by 2002:adf:a309:: with SMTP id c9mr12402364wrb.99.1628588300388; Tue, 10 Aug 2021 02:38:20 -0700 (PDT) Received: from davidp-xps-13.pitowers.org ([2a00:1098:3142:14:c482:80d:24db:a016]) by smtp.gmail.com with ESMTPSA id x12sm22933385wrt.35.2021.08.10.02.38.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Aug 2021 02:38:19 -0700 (PDT) From: David Plowman To: linux-media@vger.kernel.org, Hans Verkuil , sakari.ailus@iki.fi, Laurent Pinchart , Kieran Bingham , Mauro Carvalho Chehab Cc: David Plowman Subject: [PATCH v5 2/2] media: v4l2-ctrls: Document V4L2_CID_NOTIFY_GAINS control Date: Tue, 10 Aug 2021 10:38:11 +0100 Message-Id: <20210810093811.7205-3-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210810093811.7205-1-david.plowman@raspberrypi.com> References: <20210810093811.7205-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-LSpam-Score: -3.2 (---) X-LSpam-Report: No, score=-3.2 required=5.0 tests=BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_LOW=-0.7 autolearn=ham autolearn_force=no Add documentation for the V4L2_CID_NOTIFY_GAINS control. This control is required by sensors that need to know what colour gains will be applied to pixels by downstream processing (such as by an ISP), though the sensor does not apply these gains itself. Signed-off-by: David Plowman Reviewed-by: Laurent Pinchart --- .../media/v4l/ext-ctrls-image-source.rst | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst index de43f5c8486d..ba83cc0867d2 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst @@ -72,3 +72,23 @@ Image Source Control IDs * - __u32 - ``height`` - Height of the area. + +``V4L2_CID_NOTIFY_GAINS (integer array)`` + The sensor is notified what gains will be applied to the different + colour channels by subsequent processing (such as by an ISP). The + sensor is merely informed of these values in case it performs + processing that requires them, but it does not apply them itself to + the output pixels. + + The use of an array allows this control to be extended to sensors + with, for example, non-Bayer CFAs (colour filter arrays). + + Currently it is defined only for Bayer sensors, and is an array + control taking 4 gain values, being the gains for each of the + Bayer channels. The gains are always in the order B, Gb, Gr and R, + irrespective of the exact Bayer order of the sensor itself. + + The units for the gain values are linear, with the default value + representing a gain of exactly 1. For example, if this default value + is reported as being (say) 128, then a value of 256 would represent + a gain of exactly 2.