From: Vladimir Zapolskiy vladimir.zapolskiy@linaro.org
[ Upstream commit bfbd5aa5347fbd11ade188b316b800bfb27d9e22 ]
The OmniVision OG01A1B image sensor is a monochrome sensor, it supports 8-bit and 10-bit RAW output formats only.
That said the planar greyscale Y8/Y10 media formats are more appropriate for the sensor instead of the originally and arbitrary selected SGRBG one, since there is no red, green or blue color components.
Signed-off-by: Vladimir Zapolskiy vladimir.zapolskiy@linaro.org Signed-off-by: Sakari Ailus sakari.ailus@linux.intel.com Signed-off-by: Hans Verkuil hverkuil+cisco@kernel.org Signed-off-by: Sasha Levin sashal@kernel.org ---
LLM Generated explanations, may be completely bogus:
YES
- Problem fixed: The sensor is monochrome, but the driver advertised a Bayer RAW10 bus code. This is incorrect and can cause wrong pipeline negotiation and processing (e.g., debayering on a non-CFA stream). - Precise fix: Three small, contained changes switch the media bus code from Bayer to monochrome: - Default pad format: `fmt->code = MEDIA_BUS_FMT_Y10_1X10;` in `og01a1b_update_pad_format` (drivers/media/i2c/og01a1b.c:685). - Advertised code enumeration: `code->code = MEDIA_BUS_FMT_Y10_1X10;` in `og01a1b_enum_mbus_code` (drivers/media/i2c/og01a1b.c:827). - Frame-size enumeration input check: `fse->code != MEDIA_BUS_FMT_Y10_1X10` (drivers/media/i2c/og01a1b.c:839). - Scope and risk: The changes are limited to format reporting in this sensor subdev; no register programming, timing, or streaming logic is touched. The on-wire MIPI CSI-2 data type remains RAW10; this is a representational fix, not a hardware/protocol change. - User impact: Correctly reporting monochrome Y10 avoids erroneous color processing and enables proper link validation with components that expect grayscale formats. Many bridge/ISP drivers already support `MEDIA_BUS_FMT_Y10_1X10`, minimizing regression risk. - Compatibility: The driver’s single supported mode is 10-bit, and the code already reflects 10-bit depth, so Y10 is consistent with current capabilities. There’s no API/ABI change visible to V4L2 capture nodes; this is subdev pad-format metadata. - Stable criteria alignment: - Important bug fix (wrong format reported for a monochrome sensor). - Small, surgical change (three lines). - No architectural or cross-subsystem churn. - Low regression risk; aligns with established handling of monochrome sensors. - Confined to one i2c/media driver file (`drivers/media/i2c/og01a1b.c`).
Given the correctness improvement, minimal scope, and low risk, this is a good candidate for stable backport.
drivers/media/i2c/og01a1b.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/media/i2c/og01a1b.c b/drivers/media/i2c/og01a1b.c index 78d5d406e4b72..b7d0b677975d5 100644 --- a/drivers/media/i2c/og01a1b.c +++ b/drivers/media/i2c/og01a1b.c @@ -682,7 +682,7 @@ static void og01a1b_update_pad_format(const struct og01a1b_mode *mode, { fmt->width = mode->width; fmt->height = mode->height; - fmt->code = MEDIA_BUS_FMT_SGRBG10_1X10; + fmt->code = MEDIA_BUS_FMT_Y10_1X10; fmt->field = V4L2_FIELD_NONE; }
@@ -828,7 +828,7 @@ static int og01a1b_enum_mbus_code(struct v4l2_subdev *sd, if (code->index > 0) return -EINVAL;
- code->code = MEDIA_BUS_FMT_SGRBG10_1X10; + code->code = MEDIA_BUS_FMT_Y10_1X10;
return 0; } @@ -840,7 +840,7 @@ static int og01a1b_enum_frame_size(struct v4l2_subdev *sd, if (fse->index >= ARRAY_SIZE(supported_modes)) return -EINVAL;
- if (fse->code != MEDIA_BUS_FMT_SGRBG10_1X10) + if (fse->code != MEDIA_BUS_FMT_Y10_1X10) return -EINVAL;
fse->min_width = supported_modes[fse->index].width;