[PATCH 05/15] media: microchip-isc: bypass SAMA7G5 pipeline for Bayer output

From: Balakrishnan Sambath

Date: Wed Dec 02 2026 - 02:16:33 EST


The default case of isc_try_configure_pipeline() selects WB_ENABLE and
DPC_BLCENABLE for raw Bayer input, so a Bayer output no longer carries the
sensor data a software ISP expects.

Clear bits_pipeline in isc_sama7g5_adapt_pipeline() for the outputs flagged
raw, the 8, 10 and 12 bit SBGGR, SGBRG, SGRBG and SRGGB formats. The
default case is shared with SAMA5D2 and SAM9X60, so it stays as is. Y10 is
not flagged raw and keeps WB and black level correction like GREY and Y16.

The histogram and awb_work are armed from ctrls.awb and the sensor mbus
code only. Also test WB_ENABLE in bits_pipeline, else the HISDONE interrupt
keeps firing per frame with the WB stage bypassed. Keep the one-shot
do_white_balance button inactive in that case as well.

Co-developed-by: Balamanikandan Gunasundar <balamanikandan.gunasundar@xxxxxxxxxxxxx>
Signed-off-by: Balamanikandan Gunasundar <balamanikandan.gunasundar@xxxxxxxxxxxxx>
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@xxxxxxxxxxxxx>
---
drivers/media/platform/microchip/microchip-isc-base.c | 7 +++++--
drivers/media/platform/microchip/microchip-sama7g5-isc.c | 12 ++++++++++++
2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/drivers/media/platform/microchip/microchip-isc-base.c
index 963d5fd53b58..4cbdc43da715 100644
--- a/drivers/media/platform/microchip/microchip-isc-base.c
+++ b/drivers/media/platform/microchip/microchip-isc-base.c
@@ -316,8 +316,9 @@ static int isc_configure(struct isc_device *isc)
/*
* The current implemented histogram is available for RAW R, B, GB, GR
* channels. We need to check if sensor is outputting RAW BAYER
+ * and that the pipeline still has the WB stage.
*/
- if (isc->ctrls.awb &&
+ if (isc->ctrls.awb && (pipeline & WB_ENABLE) &&
ISC_IS_FORMAT_RAW(isc->config.sd_format->mbus_code))
isc_set_histogram(isc, true);
else
@@ -387,7 +388,8 @@ static int isc_start_streaming(struct vb2_queue *vq, unsigned int count)
spin_unlock_irqrestore(&isc->dma_queue_lock, flags);

/* if we streaming from RAW, we can do one-shot white balance adj */
- if (ISC_IS_FORMAT_RAW(isc->config.sd_format->mbus_code))
+ if (ISC_IS_FORMAT_RAW(isc->config.sd_format->mbus_code) &&
+ (isc->config.bits_pipeline & WB_ENABLE))
v4l2_ctrl_activate(isc->do_wb_ctrl, true);

return 0;
@@ -1539,6 +1541,7 @@ static int isc_s_awb_ctrl(struct v4l2_ctrl *ctrl)

/* if we have autowhitebalance on, start histogram procedure */
if (ctrls->awb == ISC_WB_AUTO &&
+ (isc->config.bits_pipeline & WB_ENABLE) &&
vb2_is_streaming(&isc->vb2_vidq) &&
ISC_IS_FORMAT_RAW(isc->config.sd_format->mbus_code))
isc_set_histogram(isc, true);
diff --git a/drivers/media/platform/microchip/microchip-sama7g5-isc.c b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
index 6950509372a5..80bd0fd3716d 100644
--- a/drivers/media/platform/microchip/microchip-sama7g5-isc.c
+++ b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
@@ -335,6 +335,18 @@ static void isc_sama7g5_config_rlp(struct isc_device *isc)

static void isc_sama7g5_adapt_pipeline(struct isc_device *isc)
{
+ const struct isc_format *fmt;
+ u32 i;
+
+ for (i = 0; i < isc->controller_formats_size; i++) {
+ fmt = &isc->controller_formats[i];
+ if (fmt->fourcc == isc->try_config.fourcc && fmt->raw) {
+ /* Bayer out reaches the software ISP unmodified */
+ isc->try_config.bits_pipeline = 0x0;
+ return;
+ }
+ }
+
isc->try_config.bits_pipeline &= ISC_SAMA7G5_PIPELINE;
}


--
2.34.1