openwrt/target/linux/bcm27xx/patches-5.15/950-0349-media-i2c-imx477-R...

198 lines
4.5 KiB
Diff

From 43568d1ac29fbbdc812a52a82f6ec1cd5ff6d6e6 Mon Sep 17 00:00:00 2001
From: Naushir Patuck <naush@raspberrypi.com>
Date: Thu, 18 Feb 2021 15:23:11 +0000
Subject: [PATCH] media: i2c: imx477: Replace existing 1012x760 mode
The existing 1012x760 120 fps mode has significant IQ problem using
the internal sensor scaler. Replace this mode with a 1332x990 120 fps
mode instead. This new mode has a smaller field of view, but does not
suffer from the bad IQ of the original mode.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
---
drivers/media/i2c/imx477.c | 97 ++++++++++++++++++++------------------
1 file changed, 50 insertions(+), 47 deletions(-)
--- a/drivers/media/i2c/imx477.c
+++ b/drivers/media/i2c/imx477.c
@@ -770,7 +770,7 @@ static const struct imx477_reg mode_2028
};
/* 4x4 binned. 120fps */
-static const struct imx477_reg mode_1012x760_regs[] = {
+static const struct imx477_reg mode_1332x990_regs[] = {
{0x420b, 0x01},
{0x990c, 0x00},
{0x990d, 0x08},
@@ -786,28 +786,31 @@ static const struct imx477_reg mode_1012
{0x0112, 0x0a},
{0x0113, 0x0a},
{0x0114, 0x01},
- {0x0342, 0x14},
- {0x0343, 0x60},
+ {0x0342, 0x1a},
+ {0x0343, 0x08},
+ {0x0340, 0x04},
+ {0x0341, 0x1a},
{0x0344, 0x00},
{0x0345, 0x00},
- {0x0346, 0x00},
- {0x0347, 0x00},
+ {0x0346, 0x02},
+ {0x0347, 0x10},
{0x0348, 0x0f},
- {0x0349, 0xd3},
- {0x034a, 0x0b},
- {0x034b, 0xdf},
+ {0x0349, 0xd7},
+ {0x034a, 0x09},
+ {0x034b, 0xcf},
{0x00e3, 0x00},
{0x00e4, 0x00},
{0x00fc, 0x0a},
{0x00fd, 0x0a},
{0x00fe, 0x0a},
{0x00ff, 0x0a},
+ {0xe013, 0x00},
{0x0220, 0x00},
{0x0221, 0x11},
{0x0381, 0x01},
{0x0383, 0x01},
{0x0385, 0x01},
- {0x0387, 0x03},
+ {0x0387, 0x01},
{0x0900, 0x01},
{0x0901, 0x22},
{0x0902, 0x02},
@@ -831,29 +834,29 @@ static const struct imx477_reg mode_1012
{0x936d, 0x5f},
{0x9304, 0x03},
{0x9305, 0x80},
- {0x9e9a, 0x3f},
- {0x9e9b, 0x3f},
- {0x9e9c, 0x3f},
- {0x9e9d, 0x27},
- {0x9e9e, 0x27},
- {0x9e9f, 0x27},
+ {0x9e9a, 0x2f},
+ {0x9e9b, 0x2f},
+ {0x9e9c, 0x2f},
+ {0x9e9d, 0x00},
+ {0x9e9e, 0x00},
+ {0x9e9f, 0x00},
{0xa2a9, 0x27},
{0xa2b7, 0x03},
- {0x0401, 0x01},
+ {0x0401, 0x00},
{0x0404, 0x00},
- {0x0405, 0x20},
- {0x0408, 0x00},
- {0x0409, 0x00},
+ {0x0405, 0x10},
+ {0x0408, 0x01},
+ {0x0409, 0x5c},
{0x040a, 0x00},
{0x040b, 0x00},
- {0x040c, 0x07},
- {0x040d, 0xea},
- {0x040e, 0x02},
- {0x040f, 0xf8},
- {0x034c, 0x03},
- {0x034d, 0xf4},
- {0x034e, 0x02},
- {0x034f, 0xf8},
+ {0x040c, 0x05},
+ {0x040d, 0x34},
+ {0x040e, 0x03},
+ {0x040f, 0xde},
+ {0x034c, 0x05},
+ {0x034d, 0x34},
+ {0x034e, 0x03},
+ {0x034f, 0xde},
{0x0301, 0x05},
{0x0303, 0x02},
{0x0305, 0x02},
@@ -870,21 +873,21 @@ static const struct imx477_reg mode_1012
{0x0822, 0x00},
{0x0823, 0x00},
{0x080a, 0x00},
- {0x080b, 0x6f},
+ {0x080b, 0x7f},
{0x080c, 0x00},
- {0x080d, 0x3f},
+ {0x080d, 0x4f},
{0x080e, 0x00},
- {0x080f, 0xff},
+ {0x080f, 0x77},
{0x0810, 0x00},
- {0x0811, 0x4f},
+ {0x0811, 0x5f},
{0x0812, 0x00},
- {0x0813, 0x47},
+ {0x0813, 0x57},
{0x0814, 0x00},
- {0x0815, 0x37},
- {0x0816, 0x00},
- {0x0817, 0xe7},
+ {0x0815, 0x4f},
+ {0x0816, 0x01},
+ {0x0817, 0x27},
{0x0818, 0x00},
- {0x0819, 0x2f},
+ {0x0819, 0x3f},
{0xe04c, 0x00},
{0xe04d, 0x5f},
{0xe04e, 0x00},
@@ -893,7 +896,7 @@ static const struct imx477_reg mode_1012
{0x3e37, 0x00},
{0x3f50, 0x00},
{0x3f56, 0x00},
- {0x3f57, 0x96},
+ {0x3f57, 0xbf},
};
/* Mode configs */
@@ -974,9 +977,9 @@ static const struct imx477_mode supporte
static const struct imx477_mode supported_modes_10bit[] = {
{
- /* 720P 120fps. 4x4 binned */
- .width = 1012,
- .height = 760,
+ /* 120fps. 2x2 binned and cropped */
+ .width = 1332,
+ .height = 990,
.line_length_pix = 0x1460,
.crop = {
/*
@@ -987,10 +990,10 @@ static const struct imx477_mode supporte
* rectangle once the driver is expanded to represent
* its processing blocks with multiple subdevs.
*/
- .left = IMX477_PIXEL_ARRAY_LEFT + 4,
- .top = IMX477_PIXEL_ARRAY_TOP,
- .width = 4052,
- .height = 3040,
+ .left = IMX477_PIXEL_ARRAY_LEFT + 696,
+ .top = IMX477_PIXEL_ARRAY_TOP + 528,
+ .width = 2664,
+ .height = 1980,
},
.timeperframe_min = {
.numerator = 100,
@@ -998,11 +1001,11 @@ static const struct imx477_mode supporte
},
.timeperframe_default = {
.numerator = 100,
- .denominator = 60000
+ .denominator = 12000
},
.reg_list = {
- .num_of_regs = ARRAY_SIZE(mode_1012x760_regs),
- .regs = mode_1012x760_regs,
+ .num_of_regs = ARRAY_SIZE(mode_1332x990_regs),
+ .regs = mode_1332x990_regs,
}
}
};