[PATCH 16/18] media: microchip-isc: enable userspace histogram statistics export

Balamanikandan Gunasundar balamanikandan.gunasundar at microchip.com
Thu Oct 9 08:52:49 PDT 2025


From: Balakrishnan Sambath <balakrishnan.s at microchip.com>

Export raw histogram data to userspace only when all 4 Bayer channels
are ready and userspace has active listeners. Also continue AWB work as
long as userspace listeners are active.

Signed-off-by: Balakrishnan Sambath <balakrishnan.s at microchip.com>
Signed-off-by: Balamanikandan Gunasundar <balamanikandan.gunasundar at microchip.com>
---
 drivers/media/platform/microchip/microchip-isc-base.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/drivers/media/platform/microchip/microchip-isc-base.c
index cafd05244db2..6c937a20fce0 100644
--- a/drivers/media/platform/microchip/microchip-isc-base.c
+++ b/drivers/media/platform/microchip/microchip-isc-base.c
@@ -1450,6 +1450,15 @@ static void isc_awb_work(struct work_struct *w)
 	if (hist_id != ISC_HIS_CFG_MODE_B) {
 		hist_id++;
 	} else {
+		/* All 4 channels processed - notify userspace */
+		if (isc_stats_active(&isc->stats))
+			isc_stats_isr(&isc->stats);
+		else
+			dev_info(isc->dev, "No active userspace listeners\n");
+	}
+
+	/* Continue with AWB processing only if AWB is enabled */
+	if (ctrls->awb != ISC_WB_NONE) {
 		isc_wb_update(ctrls);
 		hist_id = ISC_HIS_CFG_MODE_GR;
 	}
@@ -1499,7 +1508,7 @@ static void isc_awb_work(struct work_struct *w)
 	mutex_lock(&isc->awb_mutex);
 
 	/* streaming is not active anymore */
-	if (isc->stop) {
+	if (isc->stop && !isc_stats_active(&isc->stats)) {
 		mutex_unlock(&isc->awb_mutex);
 		return;
 	}
-- 
2.34.1




More information about the linux-arm-kernel mailing list