Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 219038
b: refs/heads/master
c: d3ca775
h: refs/heads/master
v: v3
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Oct 21, 2010
1 parent 8a6a585 commit 273436d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: db7b5460405c399e5444d2a1d313f43cf4072801
refs/heads/master: d3ca77595f4b1f17a6d41a89f942fea2b3b17d0c
36 changes: 21 additions & 15 deletions trunk/drivers/media/video/davinci/vpfe_capture.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ static int vpfe_config_ccdc_image_format(struct vpfe_device *vpfe_dev)
* For a given standard, this functions sets up the default
* pix format & crop values in the vpfe device and ccdc. It first
* starts with defaults based values from the standard table.
* It then checks if sub device support g_fmt and then override the
* It then checks if sub device support g_mbus_fmt and then override the
* values based on that.Sets crop values to match with scan resolution
* starting at 0,0. It calls vpfe_config_ccdc_image_format() set the
* values in ccdc
Expand All @@ -379,6 +379,8 @@ static int vpfe_config_image_format(struct vpfe_device *vpfe_dev,
const v4l2_std_id *std_id)
{
struct vpfe_subdev_info *sdinfo = vpfe_dev->current_subdev;
struct v4l2_mbus_framefmt mbus_fmt;
struct v4l2_pix_format *pix = &vpfe_dev->fmt.fmt.pix;
int i, ret = 0;

for (i = 0; i < ARRAY_SIZE(vpfe_standards); i++) {
Expand All @@ -403,29 +405,36 @@ static int vpfe_config_image_format(struct vpfe_device *vpfe_dev,
vpfe_dev->crop.left = 0;
vpfe_dev->crop.width = vpfe_dev->std_info.active_pixels;
vpfe_dev->crop.height = vpfe_dev->std_info.active_lines;
vpfe_dev->fmt.fmt.pix.width = vpfe_dev->crop.width;
vpfe_dev->fmt.fmt.pix.height = vpfe_dev->crop.height;
pix->width = vpfe_dev->crop.width;
pix->height = vpfe_dev->crop.height;

/* first field and frame format based on standard frame format */
if (vpfe_dev->std_info.frame_format) {
vpfe_dev->fmt.fmt.pix.field = V4L2_FIELD_INTERLACED;
pix->field = V4L2_FIELD_INTERLACED;
/* assume V4L2_PIX_FMT_UYVY as default */
vpfe_dev->fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_UYVY;
pix->pixelformat = V4L2_PIX_FMT_UYVY;
v4l2_fill_mbus_format(&mbus_fmt, pix,
V4L2_MBUS_FMT_YUYV10_2X10);
} else {
vpfe_dev->fmt.fmt.pix.field = V4L2_FIELD_NONE;
pix->field = V4L2_FIELD_NONE;
/* assume V4L2_PIX_FMT_SBGGR8 */
vpfe_dev->fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_SBGGR8;
pix->pixelformat = V4L2_PIX_FMT_SBGGR8;
v4l2_fill_mbus_format(&mbus_fmt, pix,
V4L2_MBUS_FMT_SBGGR8_1X8);
}

/* if sub device supports g_fmt, override the defaults */
/* if sub device supports g_mbus_fmt, override the defaults */
ret = v4l2_device_call_until_err(&vpfe_dev->v4l2_dev,
sdinfo->grp_id, video, g_fmt, &vpfe_dev->fmt);
sdinfo->grp_id, video, g_mbus_fmt, &mbus_fmt);

if (ret && ret != -ENOIOCTLCMD) {
v4l2_err(&vpfe_dev->v4l2_dev,
"error in getting g_fmt from sub device\n");
"error in getting g_mbus_fmt from sub device\n");
return ret;
}
v4l2_fill_pix_format(pix, &mbus_fmt);
pix->bytesperline = pix->width * 2;
pix->sizeimage = pix->bytesperline * pix->height;

/* Sets the values in CCDC */
ret = vpfe_config_ccdc_image_format(vpfe_dev);
Expand All @@ -434,11 +443,8 @@ static int vpfe_config_image_format(struct vpfe_device *vpfe_dev,

/* Update the values of sizeimage and bytesperline */
if (!ret) {
vpfe_dev->fmt.fmt.pix.bytesperline =
ccdc_dev->hw_ops.get_line_length();
vpfe_dev->fmt.fmt.pix.sizeimage =
vpfe_dev->fmt.fmt.pix.bytesperline *
vpfe_dev->fmt.fmt.pix.height;
pix->bytesperline = ccdc_dev->hw_ops.get_line_length();
pix->sizeimage = pix->bytesperline * pix->height;
}
return ret;
}
Expand Down

0 comments on commit 273436d

Please sign in to comment.