|
@@ -1669,6 +1669,7 @@ static int vpfe_s_crop(struct file *file, void *priv,
|
|
|
const struct v4l2_crop *crop)
|
|
|
{
|
|
|
struct vpfe_device *vpfe_dev = video_drvdata(file);
|
|
|
+ struct v4l2_rect rect = crop->c;
|
|
|
int ret = 0;
|
|
|
|
|
|
v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_s_crop\n");
|
|
@@ -1684,7 +1685,7 @@ static int vpfe_s_crop(struct file *file, void *priv,
|
|
|
if (ret)
|
|
|
return ret;
|
|
|
|
|
|
- if (crop->c.top < 0 || crop->c.left < 0) {
|
|
|
+ if (rect.top < 0 || rect.left < 0) {
|
|
|
v4l2_err(&vpfe_dev->v4l2_dev,
|
|
|
"doesn't support negative values for top & left\n");
|
|
|
ret = -EINVAL;
|
|
@@ -1692,26 +1693,26 @@ static int vpfe_s_crop(struct file *file, void *priv,
|
|
|
}
|
|
|
|
|
|
/* adjust the width to 16 pixel boundary */
|
|
|
- crop->c.width = ((crop->c.width + 15) & ~0xf);
|
|
|
+ rect.width = ((rect.width + 15) & ~0xf);
|
|
|
|
|
|
/* make sure parameters are valid */
|
|
|
- if ((crop->c.left + crop->c.width >
|
|
|
+ if ((rect.left + rect.width >
|
|
|
vpfe_dev->std_info.active_pixels) ||
|
|
|
- (crop->c.top + crop->c.height >
|
|
|
+ (rect.top + rect.height >
|
|
|
vpfe_dev->std_info.active_lines)) {
|
|
|
v4l2_err(&vpfe_dev->v4l2_dev, "Error in S_CROP params\n");
|
|
|
ret = -EINVAL;
|
|
|
goto unlock_out;
|
|
|
}
|
|
|
- ccdc_dev->hw_ops.set_image_window(&crop->c);
|
|
|
- vpfe_dev->fmt.fmt.pix.width = crop->c.width;
|
|
|
- vpfe_dev->fmt.fmt.pix.height = crop->c.height;
|
|
|
+ ccdc_dev->hw_ops.set_image_window(&rect);
|
|
|
+ vpfe_dev->fmt.fmt.pix.width = rect.width;
|
|
|
+ vpfe_dev->fmt.fmt.pix.height = rect.height;
|
|
|
vpfe_dev->fmt.fmt.pix.bytesperline =
|
|
|
ccdc_dev->hw_ops.get_line_length();
|
|
|
vpfe_dev->fmt.fmt.pix.sizeimage =
|
|
|
vpfe_dev->fmt.fmt.pix.bytesperline *
|
|
|
vpfe_dev->fmt.fmt.pix.height;
|
|
|
- vpfe_dev->crop = crop->c;
|
|
|
+ vpfe_dev->crop = rect;
|
|
|
unlock_out:
|
|
|
mutex_unlock(&vpfe_dev->lock);
|
|
|
return ret;
|