aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/sh_mobile_ceu_camera.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c
index 325f50d0adee..61f37012b4f8 100644
--- a/drivers/media/video/sh_mobile_ceu_camera.c
+++ b/drivers/media/video/sh_mobile_ceu_camera.c
@@ -1348,7 +1348,7 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd,
1348 struct device *dev = icd->dev.parent; 1348 struct device *dev = icd->dev.parent;
1349 struct v4l2_mbus_framefmt mf; 1349 struct v4l2_mbus_framefmt mf;
1350 unsigned int scale_cam_h, scale_cam_v, scale_ceu_h, scale_ceu_v, 1350 unsigned int scale_cam_h, scale_cam_v, scale_ceu_h, scale_ceu_v,
1351 out_width, out_height, scale_h, scale_v; 1351 out_width, out_height;
1352 int interm_width, interm_height; 1352 int interm_width, interm_height;
1353 u32 capsr, cflcr; 1353 u32 capsr, cflcr;
1354 int ret; 1354 int ret;
@@ -1406,10 +1406,6 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd,
1406 scale_ceu_h = calc_scale(interm_width, &out_width); 1406 scale_ceu_h = calc_scale(interm_width, &out_width);
1407 scale_ceu_v = calc_scale(interm_height, &out_height); 1407 scale_ceu_v = calc_scale(interm_height, &out_height);
1408 1408
1409 /* Calculate camera scales */
1410 scale_h = calc_generic_scale(cam_rect->width, out_width);
1411 scale_v = calc_generic_scale(cam_rect->height, out_height);
1412
1413 dev_geo(dev, "5: CEU scales %u:%u\n", scale_ceu_h, scale_ceu_v); 1409 dev_geo(dev, "5: CEU scales %u:%u\n", scale_ceu_h, scale_ceu_v);
1414 1410
1415 /* Apply CEU scales. */ 1411 /* Apply CEU scales. */
@@ -1421,8 +1417,8 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd,
1421 1417
1422 icd->user_width = out_width; 1418 icd->user_width = out_width;
1423 icd->user_height = out_height; 1419 icd->user_height = out_height;
1424 cam->ceu_left = scale_down(rect->left - cam_rect->left, scale_h) & ~1; 1420 cam->ceu_left = scale_down(rect->left - cam_rect->left, scale_cam_h) & ~1;
1425 cam->ceu_top = scale_down(rect->top - cam_rect->top, scale_v) & ~1; 1421 cam->ceu_top = scale_down(rect->top - cam_rect->top, scale_cam_v) & ~1;
1426 1422
1427 /* 6. Use CEU cropping to crop to the new window. */ 1423 /* 6. Use CEU cropping to crop to the new window. */
1428 sh_mobile_ceu_set_rect(icd); 1424 sh_mobile_ceu_set_rect(icd);
@@ -1433,7 +1429,7 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd,
1433 icd->user_width, icd->user_height, 1429 icd->user_width, icd->user_height,
1434 cam->ceu_left, cam->ceu_top); 1430 cam->ceu_left, cam->ceu_top);
1435 1431
1436 /* Restore capture */ 1432 /* Restore capture. The CE bit can be cleared by the hardware */
1437 if (pcdev->active) 1433 if (pcdev->active)
1438 capsr |= 1; 1434 capsr |= 1;
1439 capture_restore(pcdev, capsr); 1435 capture_restore(pcdev, capsr);