mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Balakrishnan Sambath <balakrishnan.s@microchip.com>
To: <ehristev@kernel.org>
Cc: <linux-kernel@vger.kernel.org>,
	Balamanikandan Gunasundar
	<balamanikandan.gunasundar@microchip.com>,
	Balakrishnan Sambath <balakrishnan.s@microchip.com>
Subject: [PATCH 05/15] media: microchip-isc: bypass SAMA7G5 pipeline for Bayer output
Date: Wed, 2 Dec 2026 12:46:11 +0530	[thread overview]
Message-ID: <20261202-isc-series-v1-v1-5-4e2f17c0271c@microchip.com> (raw)
In-Reply-To: <20261202-isc-series-v1-v1-0-4e2f17c0271c@microchip.com>

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@microchip.com>
Signed-off-by: Balamanikandan Gunasundar <balamanikandan.gunasundar@microchip.com>
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
---
 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


  parent reply	other threads:[~2026-12-02  7:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  7:16 [PATCH 00/15] media: microchip-isc: fix SAMA7G5 image pipeline and AWB Balakrishnan Sambath
2026-12-02  7:16 ` [PATCH 01/15] dt-bindings: media: microchip,xisc: add SAM9X7 compatible Balakrishnan Sambath
2026-12-02  7:16 ` [PATCH 02/15] media: microchip-isc: set SAM9X7 maximum resolution per SoC Balakrishnan Sambath
2026-12-02  7:16 ` [PATCH 03/15] media: microchip-isc: fix DPC black level scale Balakrishnan Sambath
2026-12-02  7:16 ` [PATCH 04/15] media: microchip-isc: enable black level correction on SAMA7G5 Balakrishnan Sambath
2026-12-02  7:16 ` Balakrishnan Sambath [this message]
2026-12-02  7:16 ` [PATCH 06/15] media: microchip-isc: add gamma 1.8 and 2.4 curves for SAMA7G5 Balakrishnan Sambath
2026-12-02  7:16 ` [PATCH 07/15] media: microchip-isc: fix CBHS register names Balakrishnan Sambath
2026-12-02  7:16 ` [PATCH 08/15] media: microchip-isc: add SAMA7G5 hue and saturation controls Balakrishnan Sambath
2026-12-02  7:16 ` [PATCH 09/15] media: microchip-isc: fix histogram bin index for AWB Balakrishnan Sambath
2026-12-02  7:16 ` [PATCH 10/15] media: microchip-isc: trim outliers in the AWB average Balakrishnan Sambath
2026-12-02  7:16 ` [PATCH 11/15] media: microchip-isc: skip AWB on near-empty channels Balakrishnan Sambath
2026-12-02  7:16 ` [PATCH 12/15] media: microchip-isc: do the AWB gain product in 64 bits Balakrishnan Sambath
2026-12-02  7:16 ` [PATCH 13/15] media: microchip-isc: smooth AWB gains with an EMA filter Balakrishnan Sambath
2026-12-02  7:16 ` [PATCH 14/15] media: microchip-isc: use an unsigned contrast range Balakrishnan Sambath
2026-12-02  7:16 ` [PATCH 15/15] media: microchip-isc: add driver documentation Balakrishnan Sambath

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261202-isc-series-v1-v1-5-4e2f17c0271c@microchip.com \
    --to=balakrishnan.s@microchip.com \
    --cc=balamanikandan.gunasundar@microchip.com \
    --cc=ehristev@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®