aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/pxa_camera.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2012-03-21 07:03:21 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-05-15 15:08:22 -0400
commit2b61d46e2c44568886bc099f8085aefc7107e372 (patch)
treee948595df69c6e9ad5c22a3bc00e93fb0a8ef93d /drivers/media/video/pxa_camera.c
parent584943aa0692fea9ec3356c7d4677dd7a225cdef (diff)
[media] soc_camera: Use soc_camera_device::sizeimage to compute buffer sizes
Instead of computing the buffer size manually in the videobuf queue setup and buffer prepare callbacks, use the previously negotiated soc_camera_device::sizeimage value. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/pxa_camera.c')
-rw-r--r--drivers/media/video/pxa_camera.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c
index 5a413f4427e0..6130abe31c43 100644
--- a/drivers/media/video/pxa_camera.c
+++ b/drivers/media/video/pxa_camera.c
@@ -241,15 +241,10 @@ static int pxa_videobuf_setup(struct videobuf_queue *vq, unsigned int *count,
241 unsigned int *size) 241 unsigned int *size)
242{ 242{
243 struct soc_camera_device *icd = vq->priv_data; 243 struct soc_camera_device *icd = vq->priv_data;
244 int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width,
245 icd->current_fmt->host_fmt);
246
247 if (bytes_per_line < 0)
248 return bytes_per_line;
249 244
250 dev_dbg(icd->parent, "count=%d, size=%d\n", *count, *size); 245 dev_dbg(icd->parent, "count=%d, size=%d\n", *count, *size);
251 246
252 *size = bytes_per_line * icd->user_height; 247 *size = icd->sizeimage;
253 248
254 if (0 == *count) 249 if (0 == *count)
255 *count = 32; 250 *count = 32;
@@ -435,11 +430,6 @@ static int pxa_videobuf_prepare(struct videobuf_queue *vq,
435 struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb); 430 struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb);
436 int ret; 431 int ret;
437 int size_y, size_u = 0, size_v = 0; 432 int size_y, size_u = 0, size_v = 0;
438 int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width,
439 icd->current_fmt->host_fmt);
440
441 if (bytes_per_line < 0)
442 return bytes_per_line;
443 433
444 dev_dbg(dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, 434 dev_dbg(dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
445 vb, vb->baddr, vb->bsize); 435 vb, vb->baddr, vb->bsize);
@@ -474,7 +464,7 @@ static int pxa_videobuf_prepare(struct videobuf_queue *vq,
474 vb->state = VIDEOBUF_NEEDS_INIT; 464 vb->state = VIDEOBUF_NEEDS_INIT;
475 } 465 }
476 466
477 vb->size = bytes_per_line * vb->height; 467 vb->size = icd->sizeimage;
478 if (0 != vb->baddr && vb->bsize < vb->size) { 468 if (0 != vb->baddr && vb->bsize < vb->size) {
479 ret = -EINVAL; 469 ret = -EINVAL;
480 goto out; 470 goto out;