Commit 0e4c180d authored by Sergio Aguirre's avatar Sergio Aguirre Committed by Mauro Carvalho Chehab

[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: default avatarSergio Aguirre <saaguirre@ti.com>
Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 4be22b6a
...@@ -389,6 +389,8 @@ static int soc_camera_set_fmt(struct soc_camera_device *icd, ...@@ -389,6 +389,8 @@ static int soc_camera_set_fmt(struct soc_camera_device *icd,
icd->user_width = pix->width; icd->user_width = pix->width;
icd->user_height = pix->height; icd->user_height = pix->height;
icd->bytesperline = pix->bytesperline;
icd->sizeimage = pix->sizeimage;
icd->colorspace = pix->colorspace; icd->colorspace = pix->colorspace;
icd->field = pix->field; icd->field = pix->field;
if (ici->ops->init_videobuf) if (ici->ops->init_videobuf)
...@@ -661,14 +663,11 @@ static int soc_camera_g_fmt_vid_cap(struct file *file, void *priv, ...@@ -661,14 +663,11 @@ static int soc_camera_g_fmt_vid_cap(struct file *file, void *priv,
pix->width = icd->user_width; pix->width = icd->user_width;
pix->height = icd->user_height; pix->height = icd->user_height;
pix->bytesperline = icd->bytesperline;
pix->sizeimage = icd->sizeimage;
pix->field = icd->field; pix->field = icd->field;
pix->pixelformat = icd->current_fmt->host_fmt->fourcc; 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; 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", dev_dbg(&icd->dev, "current_fmt->fourcc: 0x%08x\n",
icd->current_fmt->host_fmt->fourcc); icd->current_fmt->host_fmt->fourcc);
return 0; return 0;
......
...@@ -30,6 +30,8 @@ struct soc_camera_device { ...@@ -30,6 +30,8 @@ struct soc_camera_device {
struct device *pdev; /* Platform device */ struct device *pdev; /* Platform device */
s32 user_width; s32 user_width;
s32 user_height; s32 user_height;
u32 bytesperline; /* for padding, zero if unused */
u32 sizeimage;
enum v4l2_colorspace colorspace; enum v4l2_colorspace colorspace;
unsigned char iface; /* Host number */ unsigned char iface; /* Host number */
unsigned char devnum; /* Device number per host */ unsigned char devnum; /* Device number per host */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment