From 4f9944c95eb69ef9ebbc8fe6eceaf1de43ab122d Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Thu, 21 Dec 2023 18:01:59 +0000 Subject: [PATCH 0813/1085] media: i2c: adv7180: Use MEDIA_BUS_FMT_UYVY8_1X16 for CSI2 output CSI2 devices are meant to use the 1Xnn formats rather than 2Xnn such as MEDIA_BUS_FMT_UYVY8_2X8. For devices with ADV7180_FLAG_MIPI_CSI2 set, use MEDIA_BUS_FMT_UYVY8_1X16. Signed-off-by: Dave Stevenson --- drivers/media/i2c/adv7180.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) --- a/drivers/media/i2c/adv7180.c +++ b/drivers/media/i2c/adv7180.c @@ -723,10 +723,15 @@ static int adv7180_enum_mbus_code(struct struct v4l2_subdev_state *sd_state, struct v4l2_subdev_mbus_code_enum *code) { + struct adv7180_state *state = to_state(sd); + if (code->index != 0) return -EINVAL; - code->code = MEDIA_BUS_FMT_UYVY8_2X8; + if (state->chip_info->flags & ADV7180_FLAG_MIPI_CSI2) + code->code = MEDIA_BUS_FMT_UYVY8_1X16; + else + code->code = MEDIA_BUS_FMT_UYVY8_2X8; return 0; } @@ -736,7 +741,10 @@ static int adv7180_mbus_fmt(struct v4l2_ { struct adv7180_state *state = to_state(sd); - fmt->code = MEDIA_BUS_FMT_UYVY8_2X8; + if (state->chip_info->flags & ADV7180_FLAG_MIPI_CSI2) + fmt->code = MEDIA_BUS_FMT_UYVY8_1X16; + else + fmt->code = MEDIA_BUS_FMT_UYVY8_2X8; fmt->colorspace = V4L2_COLORSPACE_SMPTE170M; fmt->width = 720; fmt->height = state->curr_norm & V4L2_STD_525_60 ? 480 : 576;