[PATCH 4/4] media: gc2145: Fix the RGB MBUS format
From: Maxime Ripard
Date: Thu Jun 12 2025 - 08:54:53 EST
The GalaxyCore GC2145 is an MIPI-CSI2 sensor. is an HDMI to MIPI-CSI2
bridge. Among others, it support the MIPI-CSI2 RGB565 format, listed in
the driver as MEDIA_BUS_FMT_RGB565_1X16.
Most CSI2 receiver drivers then map MEDIA_BUS_FMT_RGB565_1X16 to
V4L2_PIX_FMT_RGB565.
However, V4L2_PIX_FMT_RGB565 is defined as having its color components
in the R, G and B order, from left to right. MIPI-CSI2 however defines
the RGB565 format with blue first.
This essentially means that the R and B will be swapped compared to what
V4L2_PIX_FMT_RGB565 defines.
The proper MBUS format would be BGR565, so let's use that.
Fixes: 03cc7fefbb09 ("media: i2c: gc2145: Galaxy Core GC2145 sensor support")
Signed-off-by: Maxime Ripard <mripard@xxxxxxxxxx>
---
drivers/media/i2c/gc2145.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/i2c/gc2145.c b/drivers/media/i2c/gc2145.c
index ba02161d46e723d14e8670ef89ba10b270d7d178..12ce1c7aa0a9e028bd7d4c84356e0e166294a1f6 100644
--- a/drivers/media/i2c/gc2145.c
+++ b/drivers/media/i2c/gc2145.c
@@ -579,11 +579,11 @@ static const struct gc2145_format supported_formats[] = {
.colorspace = V4L2_COLORSPACE_SRGB,
.datatype = MIPI_CSI2_DT_YUV422_8B,
.output_fmt = 0x03,
},
{
- .code = MEDIA_BUS_FMT_RGB565_1X16,
+ .code = MEDIA_BUS_FMT_BGR565_1X16,
.colorspace = V4L2_COLORSPACE_SRGB,
.datatype = MIPI_CSI2_DT_RGB565,
.output_fmt = 0x06,
.switch_bit = true,
},
@@ -696,11 +696,11 @@ static int gc2145_init_state(struct v4l2_subdev *sd,
struct v4l2_rect *crop;
/* Initialize pad format */
format = v4l2_subdev_state_get_format(state, 0);
gc2145_update_pad_format(gc2145, &supported_modes[0], format,
- MEDIA_BUS_FMT_RGB565_1X16,
+ MEDIA_BUS_FMT_BGR565_1X16,
V4L2_COLORSPACE_SRGB);
/* Initialize crop rectangle. */
crop = v4l2_subdev_state_get_crop(state, 0);
*crop = supported_modes[0].crop;
--
2.49.0