From ea7b98682a062bcba766e89fcd119d0981fed38e 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 (cherry picked from commit 3c87c18fcf94c393ff6786ac138390768da2edb7) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3228151 GVS: buildbot_gerritrpt Reviewed-by: Addarsh Srivastava Reviewed-by: Bitan Biswas --- 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 91a86309..a9cf963f 100644 --- a/drivers/media/i2c/imx390_mode_tbls.h +++ b/drivers/media/i2c/imx390_mode_tbls.h @@ -21,7 +21,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}, @@ -69,17 +70,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}, @@ -106,7 +107,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}, @@ -230,19 +231,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}, @@ -966,9 +965,6 @@ static const imx390_reg imx390_mode1_linear_1920x1080_raw12[] = { {0x2CAA, 0x01}, {0x2D39, 0x0E}, {0x2D54, 0x00}, - - {0x2E18, 0x0}, - {0x2D5B, 0x58}, {0x3000, 0x00}, {0x3001, 0x00}, @@ -1007,12 +1003,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}, @@ -3219,7 +3216,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}, }; @@ -7126,14 +7125,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, }; @@ -7168,6 +7167,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__ */