From: Sergey Lebedev <lsa.uz@pm.me>
To: Sakari Ailus <sakari.ailus@linux.intel.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Hans de Goede <hansg@kernel.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2] media: i2c: ov13858: cap analogue gain at 15.5x
Date: Fri, 02 Oct 2026 09:35:14 +0000 [thread overview]
Message-ID: <20261002093507.43584-1-lsa.uz@pm.me> (raw)
The analogue gain control is advertised up to 0x1fff, but the gain only
follows it up to 0x7c0. Measured on raw Bayer at fixed exposure, on a
Surface Pro 11:
register requested measured
1984 15.5x 14.23x
2047 15.99x 13.71x
2048 16x 7.54x
8191 64x 14.28x
At 0x800 the gain halves, and above it the gain repeats values from below
0x800, so an auto exposure loop that raises the gain can get less signal
back. Cap the control at 0x7c0, as ov13b10 and ov08x40 do.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Sergey Lebedev <lsa.uz@pm.me>
---
v2:
- Commit message shortened.
- Assisted-by added, per Documentation/process/coding-assistants.rst.
The code is v1's, byte for byte. Tested on a Surface Pro 11 with
libcamera's software ISP: image quality is unchanged, since 0x7c0 and
0x1fff reach about the same gain.
v1: https://lore.kernel.org/all/20260831180746.68878-1-lsa.uz@pm.me/
drivers/media/i2c/ov13858.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/i2c/ov13858.c b/drivers/media/i2c/ov13858.c
index de2b79a9a0e..27273d589cb 100644
--- a/drivers/media/i2c/ov13858.c
+++ b/drivers/media/i2c/ov13858.c
@@ -63,7 +63,7 @@
/* Analog gain control */
#define OV13858_REG_ANALOG_GAIN 0x3508
#define OV13858_ANA_GAIN_MIN 0
-#define OV13858_ANA_GAIN_MAX 0x1fff
+#define OV13858_ANA_GAIN_MAX 0x07c0
#define OV13858_ANA_GAIN_STEP 1
#define OV13858_ANA_GAIN_DEFAULT 0x80
--
2.54.0 (Apple Git-157)
reply other threads:[~2026-10-02 9:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261002093507.43584-1-lsa.uz@pm.me \
--to=lsa.uz@pm.me \
--cc=hansg@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox