Thread (31 messages) 31 messages, 5 authors, 2025-11-10
STALE67d

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

From: Balamanikandan Gunasundar <hidden>
Date: 2025-10-09 15:55:51
Also in: linux-arm-kernel, linux-media, lkml
Subsystem: media input infrastructure (v4l/dvb), microchip isc driver, the rest · Maintainers: Mauro Carvalho Chehab, Eugen Hristev, Linus Torvalds

From: Balakrishnan Sambath <redacted>

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 <redacted>
Signed-off-by: Balamanikandan Gunasundar <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help