[PATCH] media: i2c: ov13858: Set the colorspace in the pad format

From: George Neacsu via B4 Relay

Date: Fri Oct 16 2026 - 07:33:18 EST


From: George Neacsu <geocausa@xxxxxxxxx>

ov13858_update_pad_format() and the try format set in open() fill in the
size, code and field but leave the colorspace fields at zero, so the
sensor reports V4L2_COLORSPACE_DEFAULT. v4l2-compliance flags that: on
the Intel Surface Pro 11, Active VIDIOC_SUBDEV_S_FMT fails through the
media device. Report a raw colorspace, as imx355 and imx219 do.

Tested on the Snapdragon Surface Pro 11, with this driver built against
the 7.1 kernel the machine runs: the sensor reports Raw / None / 601 /
full range, streams 4224x3136 at 29.9 fps, and v4l2-compliance passes
46 of 46 on the subdev.

Reported-by: Sergey Lebedev <lsa.uz@xxxxx>
Closes: https://lore.kernel.org/all/20261016070018.11932-1-lsa.uz@xxxxx/
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: George Neacsu <geocausa@xxxxxxxxx>
---
Sergey found this while testing the ov13858 device tree series on the
Intel Surface Pro 11. It is independent of that series and applies to
linux-next on its own.
---
drivers/media/i2c/ov13858.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/media/i2c/ov13858.c b/drivers/media/i2c/ov13858.c
index 5a49fa0ec..5be3d0888 100644
--- a/drivers/media/i2c/ov13858.c
+++ b/drivers/media/i2c/ov13858.c
@@ -1168,6 +1168,10 @@ static int ov13858_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
try_fmt->height = ov13858->cur_mode->height;
try_fmt->code = MEDIA_BUS_FMT_SGRBG10_1X10;
try_fmt->field = V4L2_FIELD_NONE;
+ try_fmt->colorspace = V4L2_COLORSPACE_RAW;
+ try_fmt->ycbcr_enc = V4L2_YCBCR_ENC_601;
+ try_fmt->quantization = V4L2_QUANTIZATION_FULL_RANGE;
+ try_fmt->xfer_func = V4L2_XFER_FUNC_NONE;

/* No crop or compose */
mutex_unlock(&ov13858->mutex);
@@ -1348,6 +1352,10 @@ static void ov13858_update_pad_format(const struct ov13858_mode *mode,
fmt->format.height = mode->height;
fmt->format.code = MEDIA_BUS_FMT_SGRBG10_1X10;
fmt->format.field = V4L2_FIELD_NONE;
+ fmt->format.colorspace = V4L2_COLORSPACE_RAW;
+ fmt->format.ycbcr_enc = V4L2_YCBCR_ENC_601;
+ fmt->format.quantization = V4L2_QUANTIZATION_FULL_RANGE;
+ fmt->format.xfer_func = V4L2_XFER_FUNC_NONE;
}

static int ov13858_do_get_pad_format(struct ov13858 *ov13858,

---
base-commit: b810335a0699d1810683796b0e3ffe8827ddfe6c
change-id: 20261016-ov13858-colorspace-b1204e3ad06d

Best regards,
--
George Neacsu <geocausa@xxxxxxxxx>