From: Hans de Goede Date: Mon, 2 Jan 2023 21:02:04 +0000 (+0100) Subject: media: atomisp: ov2680: Fix window settings and enable window for all resolutions X-Git-Tag: v6.6.7~3400^2~2^2~72 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1c08b2faa88fbcf813a700120ffe89bc2c8c567c;p=platform%2Fkernel%2Flinux-starfive.git media: atomisp: ov2680: Fix window settings and enable window for all resolutions 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 Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/staging/media/atomisp/i2c/ov2680.h b/drivers/staging/media/atomisp/i2c/ov2680.h index 4d1fa05..d753919 100644 --- a/drivers/staging/media/atomisp/i2c/ov2680.h +++ b/drivers/staging/media/atomisp/i2c/ov2680.h @@ -318,11 +318,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}, @@ -357,11 +357,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}, @@ -396,11 +396,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}, @@ -435,11 +435,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}, @@ -473,7 +473,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}, @@ -512,7 +512,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}, @@ -554,11 +554,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}, @@ -593,11 +593,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}, @@ -632,11 +632,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}, @@ -754,7 +754,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},