media: atomisp-ov2680: Fix ov2680_set_fmt() messing up high exposure settings
For exposure settings > (lines_per_frame - vts_margin) the VTS register needs to be programmed to (exposure + vts_margin) rather then being set to lines_per_frame. The res->regs register array was clobbering this higher setting causing high exposure settings to not work. Fix this by letting ov2680_set_fmt() calculate the vts value, instead of hardcoding it. This is the last in a series of fixes which fixes exposure and gain settings not working, with this everything works, so drop the comment that it does not work. Link: https://lore.kernel.org/linux-media/20211107171549.267583-12-hdegoede@redhat.com Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
committed by
Mauro Carvalho Chehab
parent
4492289c31
commit
29400b5063
@@ -387,7 +387,6 @@ static long ov2680_s_exposure(struct v4l2_subdev *sd,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
// EXPOSURE CONTROL DISABLED FOR INITIAL CHECKIN, TUNING DOESN'T WORK
|
||||
return ov2680_set_exposure(sd, coarse_itg, analog_gain, digital_gain);
|
||||
}
|
||||
|
||||
@@ -825,7 +824,7 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd,
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
struct camera_mipi_info *ov2680_info = NULL;
|
||||
struct ov2680_resolution *res;
|
||||
int ret = 0;
|
||||
int vts, ret = 0;
|
||||
|
||||
dev_dbg(&client->dev, "%s: %s: pad: %d, fmt: %p\n",
|
||||
__func__,
|
||||
@@ -870,6 +869,16 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd,
|
||||
dev_err(&client->dev,
|
||||
"ov2680 write resolution register err: %d\n", ret);
|
||||
|
||||
/* If necessary increase the VTS to match exposure + MARGIN */
|
||||
if (dev->exposure > vts - OV2680_INTEGRATION_TIME_MARGIN)
|
||||
vts = dev->exposure + OV2680_INTEGRATION_TIME_MARGIN;
|
||||
else
|
||||
vts = dev->res->lines_per_frame;
|
||||
|
||||
ret = ov2680_write_reg(client, 2, OV2680_TIMING_VTS_H, vts);
|
||||
if (ret)
|
||||
dev_err(&client->dev, "ov2680 write vts err: %d\n", ret);
|
||||
|
||||
ret = ov2680_get_intg_factor(client, ov2680_info, res);
|
||||
if (ret) {
|
||||
dev_err(&client->dev, "failed to get integration factor\n");
|
||||
|
||||
@@ -302,8 +302,6 @@ static struct ov2680_reg const ov2680_QCIF_30fps[] = {
|
||||
{0x380b, 0xa0},
|
||||
{0x380c, 0x06},
|
||||
{0x380d, 0xb0},
|
||||
{0x380e, 0x02},
|
||||
{0x380f, 0x84},
|
||||
{0x3810, 0x00},
|
||||
{0x3811, 0x04},
|
||||
{0x3812, 0x00},
|
||||
@@ -345,8 +343,6 @@ static struct ov2680_reg const ov2680_CIF_30fps[] = {
|
||||
{0x380b, 0x30},
|
||||
{0x380c, 0x06},
|
||||
{0x380d, 0xb0},
|
||||
{0x380e, 0x02},
|
||||
{0x380f, 0x84},
|
||||
{0x3810, 0x00},
|
||||
{0x3811, 0x04},
|
||||
{0x3812, 0x00},
|
||||
@@ -386,8 +382,6 @@ static struct ov2680_reg const ov2680_QVGA_30fps[] = {
|
||||
{0x380b, 0x00},
|
||||
{0x380c, 0x06},
|
||||
{0x380d, 0xb0},
|
||||
{0x380e, 0x02},
|
||||
{0x380f, 0x84},
|
||||
{0x3810, 0x00},
|
||||
{0x3811, 0x04},
|
||||
{0x3812, 0x00},
|
||||
@@ -427,8 +421,6 @@ static struct ov2680_reg const ov2680_656x496_30fps[] = {
|
||||
{0x380b, 0xf0},
|
||||
{0x380c, 0x06},
|
||||
{0x380d, 0xb0},
|
||||
{0x380e, 0x02},
|
||||
{0x380f, 0x84},
|
||||
{0x3810, 0x00},
|
||||
{0x3811, 0x04},
|
||||
{0x3812, 0x00},
|
||||
@@ -468,8 +460,6 @@ static struct ov2680_reg const ov2680_720x592_30fps[] = {
|
||||
{0x380b, 0x50}, // Y_OUTPUT_SIZE;
|
||||
{0x380c, 0x06},
|
||||
{0x380d, 0xac}, // HTS;
|
||||
{0x380e, 0x02},
|
||||
{0x380f, 0x84}, // VTS;
|
||||
{0x3810, 0x00},
|
||||
{0x3811, 0x00},
|
||||
{0x3812, 0x00},
|
||||
@@ -511,8 +501,6 @@ static struct ov2680_reg const ov2680_800x600_30fps[] = {
|
||||
{0x380b, 0x58},
|
||||
{0x380c, 0x06},
|
||||
{0x380d, 0xac},
|
||||
{0x380e, 0x02},
|
||||
{0x380f, 0x84},
|
||||
{0x3810, 0x00},
|
||||
{0x3811, 0x00},
|
||||
{0x3812, 0x00},
|
||||
@@ -552,8 +540,6 @@ static struct ov2680_reg const ov2680_720p_30fps[] = {
|
||||
{0x380b, 0xe0},
|
||||
{0x380c, 0x06},
|
||||
{0x380d, 0xa8},
|
||||
{0x380e, 0x05},
|
||||
{0x380f, 0x0e},
|
||||
{0x3810, 0x00},
|
||||
{0x3811, 0x08},
|
||||
{0x3812, 0x00},
|
||||
@@ -593,8 +579,6 @@ static struct ov2680_reg const ov2680_1296x976_30fps[] = {
|
||||
{0x380b, 0xd0},
|
||||
{0x380c, 0x06},
|
||||
{0x380d, 0xa8},
|
||||
{0x380e, 0x05},
|
||||
{0x380f, 0x0e},
|
||||
{0x3810, 0x00},
|
||||
{0x3811, 0x08},
|
||||
{0x3812, 0x00},
|
||||
@@ -634,8 +618,6 @@ static struct ov2680_reg const ov2680_1456x1096_30fps[] = {
|
||||
{0x380b, 0x48},
|
||||
{0x380c, 0x06},
|
||||
{0x380d, 0xa8},
|
||||
{0x380e, 0x05},
|
||||
{0x380f, 0x0e},
|
||||
{0x3810, 0x00},
|
||||
{0x3811, 0x08},
|
||||
{0x3812, 0x00},
|
||||
@@ -677,8 +659,6 @@ static struct ov2680_reg const ov2680_1616x916_30fps[] = {
|
||||
{0x380b, 0x94},
|
||||
{0x380c, 0x06},
|
||||
{0x380d, 0xa8},
|
||||
{0x380e, 0x05},
|
||||
{0x380f, 0x0e},
|
||||
{0x3810, 0x00},
|
||||
{0x3811, 0x00},
|
||||
{0x3812, 0x00},
|
||||
@@ -719,8 +699,6 @@ static struct ov2680_reg const ov2680_1616x1082_30fps[] = {
|
||||
{0x380b, 0x3a},
|
||||
{0x380c, 0x06},
|
||||
{0x380d, 0xa8},
|
||||
{0x380e, 0x05},
|
||||
{0x380f, 0x0e},
|
||||
{0x3810, 0x00},
|
||||
{0x3811, 0x00},
|
||||
{0x3812, 0x00},
|
||||
@@ -760,8 +738,6 @@ static struct ov2680_reg const ov2680_1616x1216_30fps[] = {
|
||||
{0x380b, 0xc0},//c0},
|
||||
{0x380c, 0x06},
|
||||
{0x380d, 0xa8},
|
||||
{0x380e, 0x05},
|
||||
{0x380f, 0x0e},
|
||||
{0x3810, 0x00},
|
||||
{0x3811, 0x00},
|
||||
{0x3812, 0x00},
|
||||
|
||||
Reference in New Issue
Block a user