]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: i2c: ov01a10: Fix analogue gain range
authorHans de Goede <hansg@kernel.org>
Tue, 14 Oct 2025 17:40:11 +0000 (19:40 +0200)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Tue, 13 Jan 2026 11:28:48 +0000 (12:28 +0100)
A analogue maximum gain of 0xffff / 65525 seems unlikely and testing
indeed shows that the gain control wraps-around at 16383, so set the
maximum gain to 0x3fff / 16383.

The minimum gain of 0x100 is correct. Setting bits 8-11 to 0x0 results
in the same gain values as setting these bits to 0x1, with bits 0-7
still increasing the gain when going from 0x000 - 0x0ff in the exact
same range as when going from 0x100 - 0x1ff.

Fixes: 0827b58dabff ("media: i2c: add ov01a10 image sensor driver")
Cc: stable@vger.kernel.org
Signed-off-by: Hans de Goede <hansg@kernel.org>
Tested-by: Mehdi Djait <mehdi.djait@linux.intel.com> # Dell XPS 9315
Reviewed-by: Mehdi Djait <mehdi.djait@linux.intel.com>
[Sakari Ailus: mention analogue gain and update the limit from 4096.]
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/i2c/ov01a10.c

index 0b1a1ecfffd0ea642066d9bcd658c891057fe10c..834ca46acb75fe1a2bf130615480d8fe53b9e88e 100644 (file)
@@ -48,7 +48,7 @@
 /* analog gain controls */
 #define OV01A10_REG_ANALOG_GAIN                0x3508
 #define OV01A10_ANAL_GAIN_MIN          0x100
-#define OV01A10_ANAL_GAIN_MAX          0xffff
+#define OV01A10_ANAL_GAIN_MAX          0x3fff
 #define OV01A10_ANAL_GAIN_STEP         1
 
 /* digital gain controls */