aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/pxa_camera.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/pxa_camera.c')
-rw-r--r--drivers/media/video/pxa_camera.c34
1 files changed, 7 insertions, 27 deletions
diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c
index f60de40fd21f..46e0d8ad880f 100644
--- a/drivers/media/video/pxa_camera.c
+++ b/drivers/media/video/pxa_camera.c
@@ -163,13 +163,6 @@
163 CICR0_EOFM | CICR0_FOM) 163 CICR0_EOFM | CICR0_FOM)
164 164
165/* 165/*
166 * YUV422P picture size should be a multiple of 16, so the heuristic aligns
167 * height, width on 4 byte boundaries to reach the 16 multiple for the size.
168 */
169#define YUV422P_X_Y_ALIGN 4
170#define YUV422P_SIZE_ALIGN YUV422P_X_Y_ALIGN * YUV422P_X_Y_ALIGN
171
172/*
173 * Structures 166 * Structures
174 */ 167 */
175enum pxa_camera_active_dma { 168enum pxa_camera_active_dma {
@@ -1398,28 +1391,15 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd,
1398 return -EINVAL; 1391 return -EINVAL;
1399 } 1392 }
1400 1393
1401 /* limit to pxa hardware capabilities */
1402 if (pix->height < 32)
1403 pix->height = 32;
1404 if (pix->height > 2048)
1405 pix->height = 2048;
1406 if (pix->width < 48)
1407 pix->width = 48;
1408 if (pix->width > 2048)
1409 pix->width = 2048;
1410 pix->width &= ~0x01;
1411
1412 /* 1394 /*
1413 * YUV422P planar format requires images size to be a 16 bytes 1395 * Limit to pxa hardware capabilities. YUV422P planar format requires
1414 * multiple. If not, zeros will be inserted between Y and U planes, and 1396 * images size to be a multiple of 16 bytes. If not, zeros will be
1415 * U and V planes, and YUV422P standard would be violated. 1397 * inserted between Y and U planes, and U and V planes, which violates
1398 * the YUV422P standard.
1416 */ 1399 */
1417 if (xlate->host_fmt->fourcc == V4L2_PIX_FMT_YUV422P) { 1400 v4l_bound_align_image(&pix->width, 48, 2048, 1,
1418 if (!IS_ALIGNED(pix->width * pix->height, YUV422P_SIZE_ALIGN)) 1401 &pix->height, 32, 2048, 0,
1419 pix->height = ALIGN(pix->height, YUV422P_X_Y_ALIGN); 1402 xlate->host_fmt->fourcc == V4L2_PIX_FMT_YUV422P ? 4 : 0);
1420 if (!IS_ALIGNED(pix->width * pix->height, YUV422P_SIZE_ALIGN))
1421 pix->width = ALIGN(pix->width, YUV422P_X_Y_ALIGN);
1422 }
1423 1403
1424 pix->bytesperline = pix->width * 1404 pix->bytesperline = pix->width *
1425 DIV_ROUND_UP(xlate->host_fmt->depth, 8); 1405 DIV_ROUND_UP(xlate->host_fmt->depth, 8);