From: Umang Jain <umang.jain@ideasonboard.com>
To: linux-media@vger.kernel.org
Cc: libcamera-devel@lists.libcamera.org,
Umang Jain <umang.jain@ideasonboard.com>
Subject: [PATCH 2/2] media: imx258: Limit the max analogue gain to 480
Date: Fri, 23 Jul 2021 16:52:33 +0530 [thread overview]
Message-ID: <20210723112233.1361319-3-umang.jain@ideasonboard.com> (raw)
In-Reply-To: <20210723112233.1361319-1-umang.jain@ideasonboard.com>
The range for analog gain mentioned in the datasheet is [0, 480].
The real gain formula mentioned in the datasheet is:
Gain = 512 / (512 – X)
Hence, values larger than 511 clearly makes no sense. The gain
register field is also documented to be of 9-bits in the datasheet.
Certainly, it is enough to infer that, the kernel driver currently
advertises an arbitrary analog gain max. Fix it by rectifying the
value as per the data sheet i.e. 480.
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
---
drivers/media/i2c/imx258.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/i2c/imx258.c b/drivers/media/i2c/imx258.c
index 4e695096e5d0..81cdf37216ca 100644
--- a/drivers/media/i2c/imx258.c
+++ b/drivers/media/i2c/imx258.c
@@ -47,7 +47,7 @@
/* Analog gain control */
#define IMX258_REG_ANALOG_GAIN 0x0204
#define IMX258_ANA_GAIN_MIN 0
-#define IMX258_ANA_GAIN_MAX 0x1fff
+#define IMX258_ANA_GAIN_MAX 480
#define IMX258_ANA_GAIN_STEP 1
#define IMX258_ANA_GAIN_DEFAULT 0x0
--
2.31.1
next prev parent reply other threads:[~2021-07-23 11:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-23 11:22 [PATCH 0/2] IMX258 driver fixes Umang Jain
2021-07-23 11:22 ` [PATCH 1/2] media: imx258: Rectify mismatch of VTS value Umang Jain
2021-07-23 11:50 ` Laurent Pinchart
2021-07-26 2:20 ` Bingbu Cao
2021-07-23 11:22 ` Umang Jain [this message]
2021-07-23 11:44 ` [libcamera-devel] [PATCH 2/2] media: imx258: Limit the max analogue gain to 480 Laurent Pinchart
2021-07-23 11:52 ` Laurent Pinchart
2021-07-23 12:29 ` Krzysztof Kozlowski
2021-07-23 12:36 ` Dave Stevenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210723112233.1361319-3-umang.jain@ideasonboard.com \
--to=umang.jain@ideasonboard.com \
--cc=libcamera-devel@lists.libcamera.org \
--cc=linux-media@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.