From 9de0d047cde7b094c2a0d71aaf84b2be39faf5d4 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Wed, 17 Jun 2026 11:13:07 +0100
Subject: [PATCH] media: rp1-cfe-downstream: Allow for repacking in RGB/BGR fix

Commit 67f3a617a8bc ("media: rp1-cfe-downstream: Fix RGB format /
mbus code association") missed the handling of the unpacked and
compressed output formats in the same way the original Unicam patch
did. Fix it.

Fixes: 67f3a617a8bc ("media: rp1-cfe-downstream: Fix RGB format / mbus code association")
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
 drivers/media/platform/raspberrypi/rp1_cfe/cfe.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/media/platform/raspberrypi/rp1_cfe/cfe.c
+++ b/drivers/media/platform/raspberrypi/rp1_cfe/cfe.c
@@ -1694,7 +1694,9 @@ static int cfe_video_link_validate(struc
 			return -EINVAL;
 		}
 
-		if (fmt->fourcc != pix_fmt->pixelformat) {
+		if (fmt->fourcc != pix_fmt->pixelformat &&
+		    fmt->remap[CFE_REMAP_16BIT] != pix_fmt->pixelformat &&
+		    fmt->remap[CFE_REMAP_COMPRESSED] != pix_fmt->pixelformat)  {
 			if ((pix_fmt->pixelformat == V4L2_PIX_FMT_BGR24 &&
 			     remote_fmt->code == MEDIA_BUS_FMT_BGR888_1X24) ||
 			    (pix_fmt->pixelformat == V4L2_PIX_FMT_RGB24 &&
