[PATCH] media: atomisp: ov2722: Report SGRBG10 consistently as media bus code
From: Volodymyr Chapman
Date: Mon Nov 16 2026 - 12:32:02 EST
ov2722_set_fmt() returns MEDIA_BUS_FMT_SGRBG10_1X10, while
ov2722_get_fmt(), ov2722_enum_mbus_code() and the format initialised in
ov2722_probe() all use MEDIA_BUS_FMT_SBGGR10_1X10.
atomisp propagates the code returned by set_fmt() to the sink pad of the
CSI-2 receiver, but link validation compares that pad against the
sensor's get_fmt(). Since link validation runs on every stream start,
the mismatch makes streaming fail unconditionally:
atomisp-isp2 0000:00:03.0: Error starting mc pipeline: -32
and VIDIOC_STREAMON returns -EPIPE.
The sensor registers atomisp_bayer_order_grbg as its platform data, and
because the platform data sets an input format, atomisp configures the
ISP's Bayer order from mipi_info->raw_bayer_order rather than from the
media bus code. Changing the platform data to BGGR as an experiment
produced a nearly colourless image, while GRBG produces correct colours,
so GRBG is the order the sensor actually outputs with this driver's
register settings. Use MEDIA_BUS_FMT_SGRBG10_1X10 everywhere.
The Bayer order does not depend on the platform: the driver passes
atomisp_bayer_order_grbg to gmin_camera_platform_data() itself, and the
board specific data which atomisp reads from EFI variables, its DMI tables
or ACPI only sets the CSI port, lane count and clock. All three sensor
modes program the same mirror and flip settings (0x3820 = 0x80,
0x3821 = 0x06), an even horizontal crop start and the same vertical crop
start, so they all output GRBG.
Tested on a Lenovo ThinkPad 10 (20C3, Atom Z3795, BIOS GWET50WW 1.50)
with the ISP configured as PCI device 00:03.0, using this driver built
out of tree against a 7.2.15 kernel. Before the change VIDIOC_STREAMON
fails with -EPIPE; after it, 1616x1076 YUYV frames are captured with
correct colours, and YUV420 frames in all three modes (1916x1076,
1616x1076 and 1436x1076) have correct colours too. v4l2-compliance on
/dev/video0 goes from 8 to 7 failures (the streaming test now passes);
the results for the ov2722 subdev are unchanged.
The problem was found, and this patch and changelog drafted, with the
help of an AI coding assistant (Claude); the testing above was done on
the hardware by the submitter.
Fixes: 1c3432df2339 ("media: atomisp: Call media_pipeline_alloc_start() in stream start")
Signed-off-by: Volodymyr Chapman <volodymyrchapman@xxxxxxxxx>
---
drivers/staging/media/atomisp/i2c/atomisp-ov2722.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c b/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c
index 2a8c3ee77..4d0ab2555 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c
@@ -711,7 +711,7 @@ static int ov2722_get_fmt(struct v4l2_subdev *sd,
fmt->width = dev->res->width;
fmt->height = dev->res->height;
- fmt->code = MEDIA_BUS_FMT_SBGGR10_1X10;
+ fmt->code = MEDIA_BUS_FMT_SGRBG10_1X10;
return 0;
}
@@ -851,7 +851,7 @@ static int ov2722_enum_mbus_code(struct v4l2_subdev *sd,
if (code->index >= MAX_FMTS)
return -EINVAL;
- code->code = MEDIA_BUS_FMT_SBGGR10_1X10;
+ code->code = MEDIA_BUS_FMT_SGRBG10_1X10;
return 0;
}
@@ -976,7 +976,7 @@ static int ov2722_probe(struct i2c_client *client)
dev->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
dev->pad.flags = MEDIA_PAD_FL_SOURCE;
- dev->format.code = MEDIA_BUS_FMT_SBGGR10_1X10;
+ dev->format.code = MEDIA_BUS_FMT_SGRBG10_1X10;
dev->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
ret = media_entity_pads_init(&dev->sd.entity, 1, &dev->pad);
base-commit: 3fc9303dba01676c2090768126e5327e341b7761
--
2.43.0