summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergio Aguirre <saaguirre@ti.com>2011-03-08 01:49:48 +0100
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-03-22 23:41:55 +0100
commit0e4c180d3e2cc11e248f29d4c604b6194739d05a (patch)
treecb505788e38273b39a190fdd7080ea8e9c1e2af5
parent[media] rc: interim support for 32-bit NEC-ish scancodes (diff)
downloadlinux-0e4c180d3e2cc11e248f29d4c604b6194739d05a.tar.xz
linux-0e4c180d3e2cc11e248f29d4c604b6194739d05a.zip
[media] v4l: soc-camera: Store negotiated buffer settings
This fixes the problem in which a host driver sets a personalized sizeimage or bytesperline field, and gets ignored when doing G_FMT. Signed-off-by: Sergio Aguirre <saaguirre@ti.com> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/soc_camera.c9
-rw-r--r--include/media/soc_camera.h2
2 files changed, 6 insertions, 5 deletions
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c
index fa80a4a914d4..07525e74c4b4 100644
--- a/drivers/media/video/soc_camera.c
+++ b/drivers/media/video/soc_camera.c
@@ -389,6 +389,8 @@ static int soc_camera_set_fmt(struct soc_camera_device *icd,
icd->user_width = pix->width;
icd->user_height = pix->height;
+ icd->bytesperline = pix->bytesperline;
+ icd->sizeimage = pix->sizeimage;
icd->colorspace = pix->colorspace;
icd->field = pix->field;
if (ici->ops->init_videobuf)
@@ -661,14 +663,11 @@ static int soc_camera_g_fmt_vid_cap(struct file *file, void *priv,
pix->width = icd->user_width;
pix->height = icd->user_height;
+ pix->bytesperline = icd->bytesperline;
+ pix->sizeimage = icd->sizeimage;
pix->field = icd->field;
pix->pixelformat = icd->current_fmt->host_fmt->fourcc;
- pix->bytesperline = soc_mbus_bytes_per_line(pix->width,
- icd->current_fmt->host_fmt);
pix->colorspace = icd->colorspace;
- if (pix->bytesperline < 0)
- return pix->bytesperline;
- pix->sizeimage = pix->height * pix->bytesperline;
dev_dbg(&icd->dev, "current_fmt->fourcc: 0x%08x\n",
icd->current_fmt->host_fmt->fourcc);
return 0;
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 6e96b2657b5c..f80b5372baf3 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -30,6 +30,8 @@ struct soc_camera_device {
struct device *pdev; /* Platform device */
s32 user_width;
s32 user_height;
+ u32 bytesperline; /* for padding, zero if unused */
+ u32 sizeimage;
enum v4l2_colorspace colorspace;
unsigned char iface; /* Host number */
unsigned char devnum; /* Device number per host */