mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 01:10:04 +00:00
media: ov5640: report correct frame rate to user
In commit 3145efcdb4
("media: ov5640: Rework timings programming"),
it defines max_fps field in ov5640_mode_info structure to store maximum
frame rate supported by each mode. But in ov5640_try_frame_interval(), it
assumes the maximum frame rate supported by all modes is 60. But actually,
only VGA support it. For others, the maximum frame rate supported is 30.
So correct it by taking the maximum frame rate supported by each mode as
the initialization value of the local variable maxfps.
Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
parent
1b584f20d9
commit
f33b56d370
1 changed files with 12 additions and 10 deletions
|
@ -2715,20 +2715,20 @@ static int ov5640_sensor_resume(struct device *dev)
|
|||
|
||||
static int ov5640_try_frame_interval(struct ov5640_dev *sensor,
|
||||
struct v4l2_fract *fi,
|
||||
u32 width, u32 height)
|
||||
const struct ov5640_mode_info *mode_info)
|
||||
{
|
||||
const struct ov5640_mode_info *mode;
|
||||
const struct ov5640_mode_info *mode = mode_info;
|
||||
enum ov5640_frame_rate rate = OV5640_15_FPS;
|
||||
int minfps, maxfps, best_fps, fps;
|
||||
int i;
|
||||
|
||||
minfps = ov5640_framerates[OV5640_15_FPS];
|
||||
maxfps = ov5640_framerates[OV5640_60_FPS];
|
||||
maxfps = ov5640_framerates[mode->max_fps];
|
||||
|
||||
if (fi->numerator == 0) {
|
||||
fi->denominator = maxfps;
|
||||
fi->numerator = 1;
|
||||
rate = OV5640_60_FPS;
|
||||
rate = mode->max_fps;
|
||||
goto find_mode;
|
||||
}
|
||||
|
||||
|
@ -2749,7 +2749,7 @@ static int ov5640_try_frame_interval(struct ov5640_dev *sensor,
|
|||
fi->denominator = best_fps;
|
||||
|
||||
find_mode:
|
||||
mode = ov5640_find_mode(sensor, width, height, false);
|
||||
mode = ov5640_find_mode(sensor, mode->width, mode->height, false);
|
||||
return mode ? rate : -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -3554,6 +3554,7 @@ static int ov5640_enum_frame_interval(
|
|||
struct v4l2_subdev_frame_interval_enum *fie)
|
||||
{
|
||||
struct ov5640_dev *sensor = to_ov5640_dev(sd);
|
||||
const struct ov5640_mode_info *mode;
|
||||
struct v4l2_fract tpf;
|
||||
int ret;
|
||||
|
||||
|
@ -3562,11 +3563,14 @@ static int ov5640_enum_frame_interval(
|
|||
if (fie->index >= OV5640_NUM_FRAMERATES)
|
||||
return -EINVAL;
|
||||
|
||||
mode = ov5640_find_mode(sensor, fie->width, fie->height, false);
|
||||
if (!mode)
|
||||
return -EINVAL;
|
||||
|
||||
tpf.numerator = 1;
|
||||
tpf.denominator = ov5640_framerates[fie->index];
|
||||
|
||||
ret = ov5640_try_frame_interval(sensor, &tpf,
|
||||
fie->width, fie->height);
|
||||
ret = ov5640_try_frame_interval(sensor, &tpf, mode);
|
||||
if (ret < 0)
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -3605,9 +3609,7 @@ static int ov5640_s_frame_interval(struct v4l2_subdev *sd,
|
|||
|
||||
mode = sensor->current_mode;
|
||||
|
||||
frame_rate = ov5640_try_frame_interval(sensor, &fi->interval,
|
||||
mode->width,
|
||||
mode->height);
|
||||
frame_rate = ov5640_try_frame_interval(sensor, &fi->interval, mode);
|
||||
if (frame_rate < 0) {
|
||||
/* Always return a valid frame interval value */
|
||||
fi->interval = sensor->frame_interval;
|
||||
|
|
Loading…
Reference in a new issue