mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3] media: i2c: ov13858: cap analogue gain at 15.5x
@ 2026-11-29  9:04 Sergey Lebedev
  0 siblings, 0 replies; only message in thread
From: Sergey Lebedev @ 2026-11-29  9:04 UTC (permalink / raw)
  To: Sakari Ailus, Mauro Carvalho Chehab
  Cc: Hans de Goede, Emfox Zhou, linux-media, linux-kernel

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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-29  9:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-29  9:04 [PATCH v3] media: i2c: ov13858: cap analogue gain at 15.5x Sergey Lebedev

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®