Commit 3406639e authored by Hans de Goede's avatar Hans de Goede Committed by Mauro Carvalho Chehab
Browse files

media: atomisp: ov2680: Use defines for fps, lines-per-frame and skip-frames



The fps, lines-per-frame and skip-frames values are the same for all
resolutions, use defines for these.

The ov2680_res_preview[] incorrectly sets fps to 60 for some low-res
modes, this is incorrect with the current fixed (resolution independent)
lines-per-frame value.

Note this not drop the now no longer used fps, lines-per-frame and
skip-frames struct ov2680_resolution members. The entire struct is going
away in the next patches so that would just cause unnecessary changes.

Reviewed-by: default avatarAndy Shevchenko <andy@kernel.org>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 06118885
Loading
Loading
Loading
Loading
+4 −12
Original line number Diff line number Diff line
@@ -678,11 +678,8 @@ static int ov2680_s_config(struct v4l2_subdev *sd,
static int ov2680_g_frame_interval(struct v4l2_subdev *sd,
				   struct v4l2_subdev_frame_interval *interval)
{
	struct ov2680_device *dev = to_ov2680_sensor(sd);

	interval->interval.numerator = 1;
	interval->interval.denominator = dev->res->fps;

	interval->interval.denominator = OV2680_FPS;
	return 0;
}

@@ -726,8 +723,8 @@ static int ov2680_enum_frame_interval(struct v4l2_subdev *sd,
	    fie->which > V4L2_SUBDEV_FORMAT_ACTIVE)
		return -EINVAL;

	fract.denominator = ov2680_res_preview[fie->index].fps;
	fract.numerator = 1;
	fract.denominator = OV2680_FPS;

	fie->interval = fract;

@@ -736,12 +733,7 @@ static int ov2680_enum_frame_interval(struct v4l2_subdev *sd,

static int ov2680_g_skip_frames(struct v4l2_subdev *sd, u32 *frames)
{
	struct ov2680_device *dev = to_ov2680_sensor(sd);

	mutex_lock(&dev->input_lock);
	*frames = dev->res->skip_frames;
	mutex_unlock(&dev->input_lock);

	*frames = OV2680_SKIP_FRAMES;
	return 0;
}

@@ -785,7 +777,7 @@ static int ov2680_init_controls(struct ov2680_device *sensor)
	const struct v4l2_ctrl_ops *ops = &ov2680_ctrl_ops;
	struct ov2680_ctrls *ctrls = &sensor->ctrls;
	struct v4l2_ctrl_handler *hdl = &ctrls->handler;
	int exp_max = sensor->res->lines_per_frame - OV2680_INTEGRATION_TIME_MARGIN;
	int exp_max = OV2680_LINES_PER_FRAME - OV2680_INTEGRATION_TIME_MARGIN;

	v4l2_ctrl_handler_init(hdl, 4);

+2 −0
Original line number Diff line number Diff line
@@ -38,6 +38,8 @@
/* 1704 * 1294 * 30fps = 66MHz pixel clock */
#define OV2680_PIXELS_PER_LINE			1704
#define OV2680_LINES_PER_FRAME			1294
#define OV2680_FPS				30
#define OV2680_SKIP_FRAMES			3

/* If possible send 16 extra rows / lines to the ISP as padding */
#define OV2680_END_MARGIN			16