[PATCH v3 12/15] media: microchip-isc: reset pipeline state on kernel AWB enable

From: Balakrishnan Sambath

Date: Wed May 13 2026 - 03:19:49 EST


gamma_lut_override and cc_coeff[] persist across control writes. When
kernel AWB is enabled after userspace has customized the gamma curve or
color correction matrix, the stale settings produce incorrect color.

Clear gamma_lut_override and reset cc_coeff[] to identity when
V4L2_CID_AUTO_WHITE_BALANCE is set to 1.

Signed-off-by: Balakrishnan Sambath <balakrishnan.s@xxxxxxxxxxxxx>
---
.../platform/microchip/microchip-isc-base.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/drivers/media/platform/microchip/microchip-isc-base.c
index 04c53ec18fdd..28957c2169b7 100644
--- a/drivers/media/platform/microchip/microchip-isc-base.c
+++ b/drivers/media/platform/microchip/microchip-isc-base.c
@@ -1728,10 +1728,22 @@ static int isc_s_awb_ctrl(struct v4l2_ctrl *ctrl)

switch (ctrl->id) {
case V4L2_CID_AUTO_WHITE_BALANCE:
- if (ctrl->val == 1)
+ if (ctrl->val == 1) {
ctrls->awb = ISC_WB_AUTO;
- else
+ /*
+ * Reset gamma and CC to defaults when enabling kernel
+ * AWB so it starts with a clean pipeline.
+ */
+ ctrls->gamma_lut_override = false;
+ memset(ctrls->cc_coeff, 0, sizeof(ctrls->cc_coeff));
+ ctrls->cc_coeff[0] = 256; /* RR */
+ ctrls->cc_coeff[4] = 256; /* GG */
+ ctrls->cc_coeff[8] = 256; /* BB */
+ memset(ctrls->cc_offset, 0, sizeof(ctrls->cc_offset));
+ ctrls->cc_dirty = true;
+ } else {
ctrls->awb = ISC_WB_NONE;
+ }

/* configure the controls with new values from v4l2 */
if (ctrl->cluster[ISC_CTRL_R_GAIN]->is_new)
--
2.34.1