[PATCH 34/57] media: atomisp: ov2680: Fix window settings and enable window for all resolutions

Hans de Goede
2023-01-23T12:55:09Z

By default the ov2680 automatically sets the window to match the outputsize
and automatically adjusts it to keep the bayer pattern stable when enabling
hflip/vflip.

This does not work for the 1616x1216 mode because there is no room to
adjust the window there. To make flipping work in the 1616 wide modes the
register lists for those modes set bit 0 of 0x5708 (manual_win_en) to 1 and
ov2680_set_bayer_order() updates the bayer-order on the pad to match.

But ov2680_set_bayer_order() is always called, so when enabling flipping
on modes with a width of less then 1616 now results in the wrong bayer
order being reported on the pad since the sensor is auto-adjusting
the window in this case.

Specify the correct (== output-size) window-size in all resolutions
register-list and always set the manual_win_en bit, so that the bayer order
is changed on hflip/vflip enable on all resolutions.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/staging/media/atomisp/i2c/ov2680.h | 76 +++++++++++-----------
1 file changed, 38 insertions(+), 38 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/ov2680.h b/drivers/staging/media/atomisp/i2c/ov2680.h
index 45526477b612..54978ff9348c 100644
--- a/drivers/staging/media/atomisp/i2c/ov2680.h
+++ b/drivers/staging/media/atomisp/i2c/ov2680.h
@@ -316,11 +316,11 @@ static struct ov2680_reg const ov2680_QCIF_30fps[] = {
{0x4008, 0x00},
{0x4009, 0x03},
{0x5081, 0x41},
- {0x5708, 0x00}, //add for full size flip off and mirror off 2014/09/11
- {0x5704, 0x10},
- {0x5705, 0xa0},
- {0x5706, 0x0c},
- {0x5707, 0x78},
+ {0x5708, 0x01}, //add for full size flip off and mirror off 2014/09/11
+ {0x5704, 0x00},
+ {0x5705, 0xc0},
+ {0x5706, 0x00},
+ {0x5707, 0xa0},
{0x3820, 0xc2},
{0x3821, 0x01},
// {0x5090, 0x0c},
@@ -355,11 +355,11 @@ static struct ov2680_reg const ov2680_CIF_30fps[] = {
{0x4008, 0x00},
{0x4009, 0x03},
{0x5081, 0x41},
- {0x5708, 0x00}, //add for full size flip off and mirror off 2014/09/11
- {0x5704, 0x10},
- {0x5705, 0xa0},
- {0x5706, 0x0c},
- {0x5707, 0x78},
+ {0x5708, 0x01}, //add for full size flip off and mirror off 2014/09/11
+ {0x5704, 0x01},
+ {0x5705, 0x70},
+ {0x5706, 0x01},
+ {0x5707, 0x30},
{0x3820, 0xc2},
{0x3821, 0x01},
// {0x5090, 0x0c},
@@ -394,11 +394,11 @@ static struct ov2680_reg const ov2680_QVGA_30fps[] = {
{0x4008, 0x00},
{0x4009, 0x03},
{0x5081, 0x41},
- {0x5708, 0x00}, //add for full size flip off and mirror off 2014/09/11
- {0x5704, 0x10},
- {0x5705, 0xa0},
- {0x5706, 0x0c},
- {0x5707, 0x78},
+ {0x5708, 0x01}, //add for full size flip off and mirror off 2014/09/11
+ {0x5704, 0x01},
+ {0x5705, 0x50},
+ {0x5706, 0x01},
+ {0x5707, 0x00},
{0x3820, 0xc2},
{0x3821, 0x01},
// {0x5090, 0x0c},
@@ -433,11 +433,11 @@ static struct ov2680_reg const ov2680_656x496_30fps[] = {
{0x4008, 0x00},
{0x4009, 0x03},
{0x5081, 0x41},
- {0x5708, 0x00}, //add for full size flip off and mirror off 2014/09/11
- {0x5704, 0x10},
- {0x5705, 0xa0},
- {0x5706, 0x0c},
- {0x5707, 0x78},
+ {0x5708, 0x01}, //add for full size flip off and mirror off 2014/09/11
+ {0x5704, 0x02},
+ {0x5705, 0x90},
+ {0x5706, 0x01},
+ {0x5707, 0xf0},
{0x3820, 0xc2},
{0x3821, 0x01},
// {0x5090, 0x0c},
@@ -471,7 +471,7 @@ static struct ov2680_reg const ov2680_720x592_30fps[] = {
{0x3815, 0x31},
{0x4008, 0x00},
{0x4009, 0x03},
- {0x5708, 0x00},
+ {0x5708, 0x01},
{0x5704, 0x02},
{0x5705, 0xd0}, // X_WIN;
{0x5706, 0x02},
@@ -510,7 +510,7 @@ static struct ov2680_reg const ov2680_800x600_30fps[] = {
{0x3813, 0x00},
{0x3814, 0x31},
{0x3815, 0x31},
- {0x5708, 0x00},
+ {0x5708, 0x01},
{0x5704, 0x03},
{0x5705, 0x20},
{0x5706, 0x02},
@@ -552,11 +552,11 @@ static struct ov2680_reg const ov2680_720p_30fps[] = {
{0x4008, 0x02},
{0x4009, 0x09},
{0x5081, 0x41},
- {0x5708, 0x00}, //add for full size flip off and mirror off 2014/09/11
- {0x5704, 0x10},
- {0x5705, 0xa0},
- {0x5706, 0x0c},
- {0x5707, 0x78},
+ {0x5708, 0x01}, //add for full size flip off and mirror off 2014/09/11
+ {0x5704, 0x05},
+ {0x5705, 0x10},
+ {0x5706, 0x02},
+ {0x5707, 0xe0},
{0x3820, 0xc0},
{0x3821, 0x00},
// {0x5090, 0x0c},
@@ -591,11 +591,11 @@ static struct ov2680_reg const ov2680_1296x976_30fps[] = {
{0x4008, 0x02},
{0x4009, 0x09},
{0x5081, 0x41},
- {0x5708, 0x00}, //add for full size flip off and mirror off 2014/09/11
- {0x5704, 0x10},
- {0x5705, 0xa0},
- {0x5706, 0x0c},
- {0x5707, 0x78},
+ {0x5708, 0x01}, //add for full size flip off and mirror off 2014/09/11
+ {0x5704, 0x05},
+ {0x5705, 0x10},
+ {0x5706, 0x03},
+ {0x5707, 0xd0},
{0x3820, 0xc0},
{0x3821, 0x00}, //mirror/flip
// {0x5090, 0x0c},
@@ -630,11 +630,11 @@ static struct ov2680_reg const ov2680_1456x1096_30fps[] = {
{0x4008, 0x02},
{0x4009, 0x09},
{0x5081, 0x41},
- {0x5708, 0x00}, //add for full size flip off and mirror off 2014/09/11
- {0x5704, 0x10},
- {0x5705, 0xa0},
- {0x5706, 0x0c},
- {0x5707, 0x78},
+ {0x5708, 0x01}, //add for full size flip off and mirror off 2014/09/11
+ {0x5704, 0x05},
+ {0x5705, 0xb0},
+ {0x5706, 0x04},
+ {0x5707, 0x48},
{0x3820, 0xc0},
{0x3821, 0x00},
// {0x5090, 0x0c},
@@ -752,7 +752,7 @@ static struct ov2680_reg const ov2680_1616x1216_30fps[] = {
{0x5704, 0x06},
{0x5705, 0x50},
{0x5706, 0x04},
- {0x5707, 0xcc},
+ {0x5707, 0xc0},
{0x3820, 0xc0},
{0x3821, 0x00},
// {0x5090, 0x0C},
--
2.39.0