...
 
Commits (3)
......@@ -224,6 +224,13 @@ static int ar0144_fill_limits(struct onsemi_core *onsemi,
.max = 768000000,
};
limits->default_crop = (struct v4l2_rect) {
.left = 4,
.top = 4,
.width = 1280,
.height = 800,
};
rc = 0;
out:
......
......@@ -1934,8 +1934,8 @@ static int onsemi_enum_frame_size(struct v4l2_subdev *sd,
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;
unsigned int w;
unsigned int h;
if (fse->index > 0)
return -EINVAL;
......@@ -1944,17 +1944,16 @@ static int onsemi_enum_frame_size(struct v4l2_subdev *sd,
if (!info)
return -EINVAL;
/* TODO: check fse->code? */
w = parm->crop.width;
w /= parm->x_scale;
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;
h = parm->crop.height;
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;
fse->min_width = w;
fse->max_width = w;
fse->min_height = h;
fse->max_height = h;
return 0;
}
......@@ -2272,6 +2271,9 @@ static int onsemi_get_selection(struct v4l2_subdev *sd,
break;
case V4L2_SEL_TGT_CROP_DEFAULT:
s->r = limits->default_crop;
break;
case V4L2_SEL_TGT_CROP_BOUNDS:
s->r = (struct v4l2_rect) {
.left = limits->x.min,
......
......@@ -92,6 +92,8 @@ struct onsemi_limits {
struct onsemi_range pix_clk;
struct onsemi_range op_clk;
struct v4l2_rect default_crop;
struct onsemi_range f_serial;
};
......