From 3c87c18fcf94c393ff6786ac138390768da2edb7 Mon Sep 17 00:00:00 2001 From: Ankur Pawar Date: Wed, 29 May 2024 14:31:54 +0000 Subject: [PATCH] media: i2c: fix IMX390 SDR mode corruption Bottom two lines in IMX390 SDR mode are completely black. Fix issue in SDR mode table. Also change the image resolution to 1936x1096. Last two line are removed by disabling SMPG(Safety Mechanism Pattern Generator) using register 0x2DFC, 0x2E24. Bug 4505240 Change-Id: I92047ea83d20f1b4ca4e712718051a9c6e69cfcb Signed-off-by: Ankur Pawar Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3147214 GVS: buildbot_gerritrpt Reviewed-by: Praveen AC Reviewed-by: Laxman Dewangan --- drivers/media/i2c/imx390_mode_tbls.h | 51 ++++++++++++++-------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/drivers/media/i2c/imx390_mode_tbls.h b/drivers/media/i2c/imx390_mode_tbls.h index a1d162c9..71c4d3ee 100644 --- a/drivers/media/i2c/imx390_mode_tbls.h +++ b/drivers/media/i2c/imx390_mode_tbls.h @@ -20,7 +20,8 @@ */ #define imx390_reg struct reg_8 -static const imx390_reg imx390_mode1_linear_1920x1080_raw12[] = { +static const imx390_reg imx390_mode1_linear_1936x1096_raw12[] = { + {0x0000, 0x01}, {0x000C, 0x7F}, {0x000D, 0x01}, {0x000E, 0x00}, @@ -68,17 +69,17 @@ static const imx390_reg imx390_mode1_linear_1920x1080_raw12[] = { {0x0068, 0x00}, {0x0069, 0x00}, {0x006A, 0x00}, - {0x0078, 0x01}, - {0x007C, 0x08}, + {0x0078, 0x00}, + {0x007C, 0x00}, {0x007D, 0x00}, - {0x0080, 0x08}, + {0x0080, 0x00}, {0x0081, 0x00}, {0x00F4, 0x1C}, {0x00F5, 0xF8}, {0x00F6, 0x01}, {0x00F8, 0x03}, - {0x00F9, 0x00}, - {0x00FA, 0x01}, + {0x00F9, 0x01}, + {0x00FA, 0x00}, {0x00FB, 0x02}, {0x0114, 0x00}, {0x0115, 0x01}, @@ -105,7 +106,7 @@ static const imx390_reg imx390_mode1_linear_1920x1080_raw12[] = { {0x0132, 0x00}, {0x0133, 0xDA}, {0x013A, 0x00}, - {0x013B, 0x01}, + {0x013B, 0x01}, /* 00--PWL-HDR, 01--linear mode */ {0x013C, 0x00}, {0x013D, 0x00}, {0x013E, 0x00}, @@ -229,19 +230,17 @@ static const imx390_reg imx390_mode1_linear_1920x1080_raw12[] = { {0x0390, 0x00}, {0x0391, 0x00}, {0x0392, 0x00}, - {0x03C0, 0x01}, + {0x03C0, 0x00}, {0x2000, 0x55}, {0x2001, 0x55}, {0x2002, 0x55}, {0x2003, 0x05}, {0x2004, 0x02}, - {0x2008, 0x65}, - {0x2009, 0x04}, {0x200A, 0x00}, - {0x200C, 0x30}, - {0x200D, 0x11}, + {0x200C, 0x98}, + {0x200D, 0x08}, {0x2010, 0x04}, - {0x2014, 0x01}, + {0x2014, 0x00}, {0x2018, 0x02}, {0x2019, 0x04}, {0x201A, 0x00}, @@ -965,9 +964,6 @@ static const imx390_reg imx390_mode1_linear_1920x1080_raw12[] = { {0x2CAA, 0x01}, {0x2D39, 0x0E}, {0x2D54, 0x00}, - - {0x2E18, 0x0}, - {0x2D5B, 0x58}, {0x3000, 0x00}, {0x3001, 0x00}, @@ -1006,12 +1002,13 @@ static const imx390_reg imx390_mode1_linear_1920x1080_raw12[] = { {0x3375, 0x00}, {0x3376, 0x01}, {0x3377, 0x00}, - {0x3410, 0x80},/* crop_h_size */ - {0x3411, 0x07}, - {0x3418, 0x34},/* crop_v_size */ - {0x3419, 0x04}, - {0x3450, 0x00},/* use continuous clock */ - {0x34A0, 0x00}, + {0x3410, 0x90}, /* crop_h_size */ + {0x3411, 0x07}, /* 0x790 = 1936 */ + {0x3418, 0x48}, /* crop_v_size */ + {0x3419, 0x04}, /* 0x448 = 1096 */ + + {0x3450, 0x00}, /* use continuous clock */ + {0X34A0, 0x73}, {0x34C0, 0xD3}, {0x34C1, 0x00}, {0x34C2, 0xD3}, @@ -3218,7 +3215,9 @@ static const imx390_reg imx390_mode1_linear_1920x1080_raw12[] = { {0x45D5, 0xA9}, {0x45D6, 0xA7}, {0x45D7, 0xAC}, - + {0x2DFC, 0x00}, /* Rear 4line SMPG Disable */ + {0x2E24, 0x01}, /* Rear 4line SMPG data type as Null */ + {0x0000, 0x00}, {IMX390_TABLE_END, 0x00}, }; @@ -7125,14 +7124,14 @@ static const imx390_reg imx390_start[] = { */ enum { IMX390_MODE_4000X3000, - IMX390_MODE_linear_1920X1080, + IMX390_MODE_linear_1936x1096, IMX390_MODE_START_STREAM, IMX390_MODE_STOP_STREAM }; static const imx390_reg *mode_table[] = { [IMX390_MODE_4000X3000] = imx390_mode1_4000x3000_raw10, - [IMX390_MODE_linear_1920X1080] = imx390_mode1_linear_1920x1080_raw12, + [IMX390_MODE_linear_1936x1096] = imx390_mode1_linear_1936x1096_raw12, [IMX390_MODE_START_STREAM] = imx390_start, [IMX390_MODE_STOP_STREAM] = imx390_stop, }; @@ -7167,6 +7166,6 @@ static const int imx390_240_fr[] = { static const struct camera_common_frmfmt imx390_frmfmt[] = { {{1936, 1096}, imx390_30_fr, 1, 0, IMX390_MODE_4000X3000}, - {{1920, 1080}, imx390_30_fr, 1, 0, IMX390_MODE_linear_1920X1080}, + {{1936, 1096}, imx390_30_fr, 1, 0, IMX390_MODE_linear_1936x1096}, }; #endif /* __IMX390_I2C_TABLES__ */