[PATCH] media: i2c: vd55g1: correct VD55G0 register access widths
From: fQwQf
Date: Sat Oct 10 2026 - 05:25:12 EST
The VD55G0 frame length at 0x0458 and cold-start coarse exposure at
0x042e are 16-bit registers. The current 32-bit writes also overwrite
the vertical start at 0x045a and cold-start analogue gain at 0x0430,
respectively. Use 16-bit accesses to preserve those adjacent registers.
The applied analogue gain at 0x0066 is an 8-bit register. Reading it
as 16 bits also includes the next byte in the reported gain value.
Use the access widths from the ST reference driver for all three.
Link: https://github.com/STMicroelectronics/vd55g0-linux-driver/blob/a05627b0f6d8775aa54b6fa306e91f425f2cbf9e/vd55g0.c
Signed-off-by: Jizhou Tong <fqwqf@xxxxxxxxx>
---
Incremental fix for your VD55G0 support series:
https://lore.kernel.org/all/20260918221832.323751-2-pm@xxxxxxxxxxxxxxxx/
The same register definitions are still present in your
vd55g0-camera-support-v2-9 branch at 4a04accd5f68.
Validation: ARM64 W=1 driver-object build; descriptor checks against the
ST reference driver and emulated adjacent-register/gain-read tests.
IR capture has been used on SL7 with this fix in the downstream stack.
drivers/media/i2c/vd55g1.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/media/i2c/vd55g1.c b/drivers/media/i2c/vd55g1.c
index 1a93e0fde5..b20f086f25 100644
--- a/drivers/media/i2c/vd55g1.c
+++ b/drivers/media/i2c/vd55g1.c
@@ -182,10 +182,10 @@ static const int vd55g0_reg_map[REG_MAX_INDEX] = {
[REG_MANUAL_DIGITAL_GAIN_CH2] = CCI_REG16_LE(0x0454),
[REG_MANUAL_DIGITAL_GAIN_CH3] = CCI_REG16_LE(0x0456),
[REG_APPLIED_COARSE_EXPOSURE] = CCI_REG16_LE(0x0064),
- [REG_APPLIED_ANALOG_GAIN] = CCI_REG16_LE(0x0066),
+ [REG_APPLIED_ANALOG_GAIN] = CCI_REG8(0x0066),
[REG_APPLIED_DIGITAL_GAIN] = CCI_REG16_LE(0x0068),
[REG_AE_FORCE_COLDSTART] = CCI_REG8(0x042c),
- [REG_AE_COLDSTART_COARSE_EXPOSURE] = CCI_REG32_LE(0x042e),
+ [REG_AE_COLDSTART_COARSE_EXPOSURE] = CCI_REG16_LE(0x042e),
[REG_NEXT_CTX] = CCI_REG16_LE(0x0478),
[REG_EXPOSURE_MAX_COARSE] = CCI_REG16_LE(0x096c),
[REG_CTX_REPEAT_COUNT_CTX0] = CCI_REG16_LE(0x0476),
@@ -194,7 +194,7 @@ static const int vd55g0_reg_map[REG_MAX_INDEX] = {
/* Context properties */
[REG_CTX_STRIDE] = 0x30,
[REG_CTX_EXP_MODE] = CCI_REG8(0x044c),
- [REG_CTX_FRAME_LENGTH] = CCI_REG32_LE(0x0458),
+ [REG_CTX_FRAME_LENGTH] = CCI_REG16_LE(0x0458),
[REG_CTX_X_START] = CCI_REG16_LE(0x045e),
[REG_CTX_X_END] = CCI_REG16_LE(0x0460),
[REG_CTX_Y_START] = CCI_REG16_LE(0x0462),
--
2.53.0