[PATCH 14/15] media: microchip-isc: use an unsigned contrast range
From: Balakrishnan Sambath
Date: Wed Dec 02 2026 - 02:16:59 EST
ISC_CBC_CONTRAST holds an unsigned 12-bit value (CONTRAST bits 11 to 0,
ISC_CBC_CONTRAST_MASK), but V4L2_CID_CONTRAST was registered as
-2048..2047 on both SAMA5D2 and SAMA7G5. A negative value is masked
into the upper half of the field, so contrast=-1 programs 0xfff and
the frame clips to white. Register the control as 0..4095 on both.
The defaults stay at 256 on SAMA5D2 (DS60001476B, section 52.6.44)
and 16 on SAMA7G5. On sama7g5ek with an imx219 at 640x480 YUYV the mean
luma of a fixed scene is 33.3, 67.9 and 134.8 at 4, 8 and 16, and every
pixel clips at 256. The SAMA7G5 (section 43.7.61) and SAM9X7 (section
52.7.61) datasheets describe the field as 0-4-8, which does not match
this scale. The SAMA5D2 unity value of 256 is datasheet-only and has
not been measured on hardware.
VIDIOC_QUERYCTRL now reports a minimum of 0 and a maximum of 4095
instead of -2048 and 2047. The V4L2 core clamps a negative request to 0
where the old range let it through to the register.
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@xxxxxxxxxxxxx>
---
drivers/media/platform/microchip/microchip-sama5d2-isc.c | 2 +-
drivers/media/platform/microchip/microchip-sama7g5-isc.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/microchip/microchip-sama5d2-isc.c b/drivers/media/platform/microchip/microchip-sama5d2-isc.c
index ef2a0e6d7167..7e5187fed363 100644
--- a/drivers/media/platform/microchip/microchip-sama5d2-isc.c
+++ b/drivers/media/platform/microchip/microchip-sama5d2-isc.c
@@ -266,7 +266,7 @@ static void isc_sama5d2_config_ctrls(struct isc_device *isc,
ctrls->contrast = 256;
isc->contrast_ctrl = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_CONTRAST,
- -2048, 2047, 1, 256);
+ 0, 4095, 1, 256);
}
static void isc_sama5d2_config_dpc(struct isc_device *isc)
diff --git a/drivers/media/platform/microchip/microchip-sama7g5-isc.c b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
index aec88775d09d..cc65db891ec7 100644
--- a/drivers/media/platform/microchip/microchip-sama7g5-isc.c
+++ b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
@@ -293,7 +293,7 @@ static void isc_sama7g5_config_ctrls(struct isc_device *isc,
ctrls->contrast = 16;
isc->contrast_ctrl = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_CONTRAST,
- -2048, 2047, 1, 16);
+ 0, 4095, 1, 16);
}
static void isc_sama7g5_config_dpc(struct isc_device *isc)
--
2.34.1