Commit 7f67c587 authored by Benoit Parrot's avatar Benoit Parrot Committed by Mauro Carvalho Chehab

[media] media: ti-vpe: cal: Fix unreachable code in enum_frame_interval

As reported, the current cal_enum_frameintervals() is confusing
and does not have the intended behavior.
Fix this by re-implementing to properly propagate the enum_frame_interval
request to the subdevice.

[mchehab@osg.samsung.com: remove a now bogus "ret = 0" statement]
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reported-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: default avatarBenoit Parrot <bparrot@ti.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent e76bea9a
...@@ -1201,42 +1201,25 @@ static int cal_enum_frameintervals(struct file *file, void *priv, ...@@ -1201,42 +1201,25 @@ static int cal_enum_frameintervals(struct file *file, void *priv,
{ {
struct cal_ctx *ctx = video_drvdata(file); struct cal_ctx *ctx = video_drvdata(file);
const struct cal_fmt *fmt; const struct cal_fmt *fmt;
struct v4l2_subdev_frame_size_enum fse; struct v4l2_subdev_frame_interval_enum fie = {
.index = fival->index,
.width = fival->width,
.height = fival->height,
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
int ret; int ret;
if (fival->index)
return -EINVAL;
fmt = find_format_by_pix(ctx, fival->pixel_format); fmt = find_format_by_pix(ctx, fival->pixel_format);
if (!fmt) if (!fmt)
return -EINVAL; return -EINVAL;
/* check for valid width/height */ fie.code = fmt->code;
ret = 0; ret = v4l2_subdev_call(ctx->sensor, pad, enum_frame_interval,
fse.pad = 0; NULL, &fie);
fse.code = fmt->code; if (ret)
fse.which = V4L2_SUBDEV_FORMAT_ACTIVE; return ret;
for (fse.index = 0; ; fse.index++) {
ret = v4l2_subdev_call(ctx->sensor, pad, enum_frame_size,
NULL, &fse);
if (ret)
return -EINVAL;
if ((fival->width == fse.max_width) &&
(fival->height == fse.max_height))
break;
else if ((fival->width >= fse.min_width) &&
(fival->width <= fse.max_width) &&
(fival->height >= fse.min_height) &&
(fival->height <= fse.max_height))
break;
return -EINVAL;
}
fival->type = V4L2_FRMIVAL_TYPE_DISCRETE; fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
fival->discrete.numerator = 1; fival->discrete = fie.interval;
fival->discrete.denominator = 30;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment