...
 
......@@ -1927,6 +1927,38 @@ static int onsemi_enum_mbus_code(struct v4l2_subdev *sd,
return 0;
}
static int onsemi_enum_frame_size(struct v4l2_subdev *sd,
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_frame_size_enum *fse)
{
struct onsemi_core *onsemi = sd_to_onsemi(sd);
struct onsemi_v4l_parm *parm = onsemi->v4l_parm;
struct onsemi_businfo const *info;
unsigned int max_w;
unsigned int max_h;
if (fse->index > 0)
return -EINVAL;
info = onsemi_get_businfo(onsemi, fse->pad);
if (!info)
return -EINVAL;
/* TODO: check fse->code? */
max_w = onsemi->limits->x.max - onsemi->limits->x.min + 1;
max_h = onsemi->limits->y.max - onsemi->limits->y.min + 1;
max_w /= parm->x_scale;
max_h /= parm->y_scale;
fse->min_width = 2; /* TODO: calculate this value somehow */
fse->max_width = max_w;
fse->min_height = 2; /* TODO: calculate this value somehow */
fse->max_height = max_h;
return 0;
}
static int onsemi_mbus_to_bpp(struct onsemi_core const *onsemi,
struct onsemi_businfo const *info,
unsigned int code, unsigned int *bpp)
......@@ -2239,6 +2271,7 @@ static int onsemi_get_selection(struct v4l2_subdev *sd,
mutex_unlock(&onsemi->lock);
break;
case V4L2_SEL_TGT_CROP_DEFAULT:
case V4L2_SEL_TGT_CROP_BOUNDS:
s->r = (struct v4l2_rect) {
.left = limits->x.min,
......@@ -2794,6 +2827,7 @@ static struct v4l2_subdev_video_ops const onsemi_subdev_video_ops = {
};
static struct v4l2_subdev_pad_ops const onsemi_subdev_pad_ops = {
.enum_frame_size = onsemi_enum_frame_size,
.enum_mbus_code = onsemi_enum_mbus_code,
.set_fmt = onsemi_set_fmt,
.get_fmt = onsemi_get_fmt,
......
......@@ -1880,7 +1880,7 @@ static int mx6s_vidioc_enum_framesizes(struct file *file, void *priv,
return 0;
}
fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE;
fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE;
fsize->stepwise.min_width = fse.min_width;
fsize->stepwise.max_width = fse.max_width;
fsize->stepwise.min_height = fse.min_height;
......