diff options
-rw-r--r-- | drivers/staging/media/atomisp/pci/atomisp_cmd.c | 5 | ||||
-rw-r--r-- | drivers/staging/media/atomisp/pci/atomisp_cmd.h | 4 | ||||
-rw-r--r-- | drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 18 |
3 files changed, 19 insertions, 8 deletions
diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c index 5c984edfb3fc..68550cd49a83 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -3691,9 +3691,8 @@ static void atomisp_fill_pix_format(struct v4l2_pix_format *f, } /* Get sensor padding values for the non padded width x height resolution */ -static void atomisp_get_padding(struct atomisp_device *isp, - u32 width, u32 height, - u32 *padding_w, u32 *padding_h) +void atomisp_get_padding(struct atomisp_device *isp, u32 width, u32 height, + u32 *padding_w, u32 *padding_h) { struct atomisp_input_subdev *input = &isp->inputs[isp->asd.input_curr]; struct v4l2_rect native_rect = input->native_rect; diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.h b/drivers/staging/media/atomisp/pci/atomisp_cmd.h index c9a587b34e70..8305161d2062 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.h +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.h @@ -250,6 +250,10 @@ int atomisp_makeup_css_parameters(struct atomisp_sub_device *asd, int atomisp_compare_grid(struct atomisp_sub_device *asd, struct atomisp_grid_info *atomgrid); +/* Get sensor padding values for the non padded width x height resolution */ +void atomisp_get_padding(struct atomisp_device *isp, u32 width, u32 height, + u32 *padding_w, u32 *padding_h); + /* This function looks up the closest available resolution. */ int atomisp_try_fmt(struct atomisp_device *isp, struct v4l2_pix_format *f, const struct atomisp_format_bridge **fmt_ret, diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index 279493af6e0d..d2174156573a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -703,7 +703,8 @@ static int atomisp_s_input(struct file *file, void *fh, unsigned int input) */ static int atomisp_enum_framesizes_crop_inner(struct atomisp_device *isp, struct v4l2_frmsizeenum *fsize, - struct v4l2_rect *active, + const struct v4l2_rect *active, + const struct v4l2_rect *native, int *valid_sizes) { static const struct v4l2_frmsize_discrete frame_sizes[] = { @@ -716,11 +717,15 @@ static int atomisp_enum_framesizes_crop_inner(struct atomisp_device *isp, { 800, 600 }, { 640, 480 }, }; + u32 padding_w, padding_h; int i; for (i = 0; i < ARRAY_SIZE(frame_sizes); i++) { - if (frame_sizes[i].width > active->width || - frame_sizes[i].height > active->height) + atomisp_get_padding(isp, frame_sizes[i].width, frame_sizes[i].height, + &padding_w, &padding_h); + + if ((frame_sizes[i].width + padding_w) > native->width || + (frame_sizes[i].height + padding_h) > native->height) continue; /* @@ -748,9 +753,10 @@ static int atomisp_enum_framesizes_crop(struct atomisp_device *isp, { struct atomisp_input_subdev *input = &isp->inputs[isp->asd.input_curr]; struct v4l2_rect active = input->active_rect; + struct v4l2_rect native = input->native_rect; int ret, valid_sizes = 0; - ret = atomisp_enum_framesizes_crop_inner(isp, fsize, &active, &valid_sizes); + ret = atomisp_enum_framesizes_crop_inner(isp, fsize, &active, &native, &valid_sizes); if (ret == 0) return 0; @@ -759,8 +765,10 @@ static int atomisp_enum_framesizes_crop(struct atomisp_device *isp, active.width /= 2; active.height /= 2; + native.width /= 2; + native.height /= 2; - return atomisp_enum_framesizes_crop_inner(isp, fsize, &active, &valid_sizes); + return atomisp_enum_framesizes_crop_inner(isp, fsize, &active, &native, &valid_sizes); } static int atomisp_enum_framesizes(struct file *file, void *priv, |