build/patch/kernel/archive/sunxi-6.1/patches.megous/media-i2c-imx258-Don-t-flip-the-image-and-fix-the-mbus-format.patch

85 lines
2.7 KiB
Diff
Raw Normal View History

From 9a787e003e66814af0048285fcd2d49b5463402a Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Wed, 25 May 2022 22:27:04 +0200
Subject: [PATCH 351/389] media: i2c: imx258: Don't flip the image and fix the
mbus format
This is the format at the output according to the tests.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/media/i2c/imx258.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/media/i2c/imx258.c b/drivers/media/i2c/imx258.c
index db9abd9c41c6..0639fd6a62b8 100644
--- a/drivers/media/i2c/imx258.c
+++ b/drivers/media/i2c/imx258.c
@@ -75,14 +75,16 @@
/* Orientation */
#define REG_MIRROR_FLIP_CONTROL 0x0101
-#define REG_CONFIG_MIRROR_FLIP 0x03
-#define REG_CONFIG_FLIP_TEST_PATTERN 0x02
+#define REG_CONFIG_MIRROR_FLIP 0x00
+#define REG_CONFIG_FLIP_TEST_PATTERN 0x00
/* Input clock frequency in Hz */
#define IMX258_INPUT_CLOCK_FREQ_MIN 24000000
#define IMX258_INPUT_CLOCK_FREQ 24000000
#define IMX258_INPUT_CLOCK_FREQ_MAX 24000000
+#define IMX258_MBUS_FORMAT MEDIA_BUS_FMT_SRGGB10_1X10
+
/* regs */
#define PLL_MULT_DRIV 0x0310
#define IVTPXCK_DIV 0x0301
@@ -819,7 +821,7 @@ static int imx258_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
/* Initialize try_fmt */
try_fmt->width = supported_modes[0].width;
try_fmt->height = supported_modes[0].height;
- try_fmt->code = MEDIA_BUS_FMT_SGRBG10_1X10;
+ try_fmt->code = IMX258_MBUS_FORMAT;
try_fmt->field = V4L2_FIELD_NONE;
return 0;
@@ -931,7 +933,7 @@ static int imx258_enum_mbus_code(struct v4l2_subdev *sd,
if (code->index > 0)
return -EINVAL;
- code->code = MEDIA_BUS_FMT_SGRBG10_1X10;
+ code->code = IMX258_MBUS_FORMAT;
return 0;
}
@@ -943,7 +945,7 @@ static int imx258_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 != IMX258_MBUS_FORMAT)
return -EINVAL;
fse->min_width = supported_modes[fse->index].width;
@@ -959,7 +961,7 @@ static void imx258_update_pad_format(const struct imx258_mode *mode,
{
fmt->format.width = mode->width;
fmt->format.height = mode->height;
- fmt->format.code = MEDIA_BUS_FMT_SGRBG10_1X10;
+ fmt->format.code = IMX258_MBUS_FORMAT;
fmt->format.field = V4L2_FIELD_NONE;
}
@@ -1007,7 +1009,7 @@ static int imx258_set_pad_format(struct v4l2_subdev *sd,
mutex_lock(&imx258->mutex);
/* Only one raw bayer(GBRG) order is supported */
- fmt->format.code = MEDIA_BUS_FMT_SGRBG10_1X10;
+ fmt->format.code = IMX258_MBUS_FORMAT;
mode = v4l2_find_nearest_size(supported_modes,
ARRAY_SIZE(supported_modes), width, height,
--
2.35.3