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>, Emfox Zhou <emfox@debian.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v3] media: i2c: ov13858: cap analogue gain at 15.5x
Date: Sun, 29 Nov 2026 09:04:19 +0000 [thread overview]
Message-ID: <20261129090413.57128-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.
Tested-by: Emfox Zhou <emfox@debian.org>
Signed-off-by: Sergey Lebedev <lsa.uz@pm.me>
---
v3:
- Assisted-by dropped; see the note on tool use below. The code is
v2's, byte for byte.
- Emfox Zhou's Tested-by from the v2 thread (Surface Pro 8, Tiger Lake,
IPU6). With libcamera's auto exposure he saw the gain park at 63.99x
without the patch and settle at 15.5x with it.
v2: https://lore.kernel.org/all/20261002093507.43584-1-lsa.uz@pm.me/
v1: https://lore.kernel.org/all/20260831180746.68878-1-lsa.uz@pm.me/
Tool use, per Documentation/process/generated-content.rst (Assisted-by
tags in commits were dropped in 7.4-rc1):
* My contributions to this series were prepared with Claude Code
(claude-opus-5-5); work by others in it is their own.
* This replaces any Assisted-by tags in earlier versions.
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 c086d529253..394f0fe097f 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
reply other threads:[~2026-11-29 9:04 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=20261129090413.57128-1-lsa.uz@pm.me \
--to=lsa.uz@pm.me \
--cc=emfox@debian.org \
--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
all inboxes | Powered by JetHome®