media: atmel: atmel-isc-base: add wb debug messages
authorEugen Hristev <eugen.hristev@microchip.com>
Mon, 13 Dec 2021 13:49:35 +0000 (14:49 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Sun, 23 Jan 2022 20:18:44 +0000 (21:18 +0100)
Add debug messages that make it easier to debug white balance algorithm.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/platform/atmel/atmel-isc-base.c

index 3a9e047419608ec0c5b6f0a3c0ae351f392e238f..d92ffc07418f2ed869d620b90fe7879245e6a867 100644 (file)
@@ -1289,10 +1289,15 @@ static void isc_hist_count(struct isc_device *isc, u32 *min, u32 *max)
 
        if (!*min)
                *min = 1;
+
+       v4l2_dbg(1, debug, &isc->v4l2_dev,
+                "isc wb: hist_id %u, hist_count %u",
+                ctrls->hist_id, *hist_count);
 }
 
 static void isc_wb_update(struct isc_ctrls *ctrls)
 {
+       struct isc_device *isc = container_of(ctrls, struct isc_device, ctrls);
        u32 *hist_count = &ctrls->hist_count[0];
        u32 c, offset[4];
        u64 avg = 0;
@@ -1309,6 +1314,9 @@ static void isc_wb_update(struct isc_ctrls *ctrls)
                (u64)hist_count[ISC_HIS_CFG_MODE_GB];
        avg >>= 1;
 
+       v4l2_dbg(1, debug, &isc->v4l2_dev,
+                "isc wb: green components average %llu\n", avg);
+
        /* Green histogram is null, nothing to do */
        if (!avg)
                return;
@@ -1361,9 +1369,15 @@ static void isc_wb_update(struct isc_ctrls *ctrls)
                else
                        gw_gain[c] = 1 << 9;
 
+               v4l2_dbg(1, debug, &isc->v4l2_dev,
+                        "isc wb: component %d, s_gain %u, gw_gain %u\n",
+                        c, s_gain[c], gw_gain[c]);
                /* multiply both gains and adjust for decimals */
                ctrls->gain[c] = s_gain[c] * gw_gain[c];
                ctrls->gain[c] >>= 9;
+               v4l2_dbg(1, debug, &isc->v4l2_dev,
+                        "isc wb: component %d, final gain %u\n",
+                        c, ctrls->gain[c]);
        }
 }
 
@@ -1387,6 +1401,10 @@ static void isc_awb_work(struct work_struct *w)
                return;
 
        isc_hist_count(isc, &min, &max);
+
+       v4l2_dbg(1, debug, &isc->v4l2_dev,
+                "isc wb mode %d: hist min %u , max %u\n", hist_id, min, max);
+
        ctrls->hist_minmax[hist_id][HIST_MIN_INDEX] = min;
        ctrls->hist_minmax[hist_id][HIST_MAX_INDEX] = max;