diff options
Diffstat (limited to 'drivers/media/video/davinci/vpfe_capture.c')
-rw-r--r-- | drivers/media/video/davinci/vpfe_capture.c | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/drivers/media/video/davinci/vpfe_capture.c b/drivers/media/video/davinci/vpfe_capture.c index 1c2588247289..d8e38cc4ec40 100644 --- a/drivers/media/video/davinci/vpfe_capture.c +++ b/drivers/media/video/davinci/vpfe_capture.c | |||
@@ -370,7 +370,7 @@ static int vpfe_config_ccdc_image_format(struct vpfe_device *vpfe_dev) | |||
370 | * For a given standard, this functions sets up the default | 370 | * For a given standard, this functions sets up the default |
371 | * pix format & crop values in the vpfe device and ccdc. It first | 371 | * pix format & crop values in the vpfe device and ccdc. It first |
372 | * starts with defaults based values from the standard table. | 372 | * starts with defaults based values from the standard table. |
373 | * It then checks if sub device support g_fmt and then override the | 373 | * It then checks if sub device support g_mbus_fmt and then override the |
374 | * values based on that.Sets crop values to match with scan resolution | 374 | * values based on that.Sets crop values to match with scan resolution |
375 | * starting at 0,0. It calls vpfe_config_ccdc_image_format() set the | 375 | * starting at 0,0. It calls vpfe_config_ccdc_image_format() set the |
376 | * values in ccdc | 376 | * values in ccdc |
@@ -379,6 +379,8 @@ static int vpfe_config_image_format(struct vpfe_device *vpfe_dev, | |||
379 | const v4l2_std_id *std_id) | 379 | const v4l2_std_id *std_id) |
380 | { | 380 | { |
381 | struct vpfe_subdev_info *sdinfo = vpfe_dev->current_subdev; | 381 | struct vpfe_subdev_info *sdinfo = vpfe_dev->current_subdev; |
382 | struct v4l2_mbus_framefmt mbus_fmt; | ||
383 | struct v4l2_pix_format *pix = &vpfe_dev->fmt.fmt.pix; | ||
382 | int i, ret = 0; | 384 | int i, ret = 0; |
383 | 385 | ||
384 | for (i = 0; i < ARRAY_SIZE(vpfe_standards); i++) { | 386 | for (i = 0; i < ARRAY_SIZE(vpfe_standards); i++) { |
@@ -403,29 +405,36 @@ static int vpfe_config_image_format(struct vpfe_device *vpfe_dev, | |||
403 | vpfe_dev->crop.left = 0; | 405 | vpfe_dev->crop.left = 0; |
404 | vpfe_dev->crop.width = vpfe_dev->std_info.active_pixels; | 406 | vpfe_dev->crop.width = vpfe_dev->std_info.active_pixels; |
405 | vpfe_dev->crop.height = vpfe_dev->std_info.active_lines; | 407 | vpfe_dev->crop.height = vpfe_dev->std_info.active_lines; |
406 | vpfe_dev->fmt.fmt.pix.width = vpfe_dev->crop.width; | 408 | pix->width = vpfe_dev->crop.width; |
407 | vpfe_dev->fmt.fmt.pix.height = vpfe_dev->crop.height; | 409 | pix->height = vpfe_dev->crop.height; |
408 | 410 | ||
409 | /* first field and frame format based on standard frame format */ | 411 | /* first field and frame format based on standard frame format */ |
410 | if (vpfe_dev->std_info.frame_format) { | 412 | if (vpfe_dev->std_info.frame_format) { |
411 | vpfe_dev->fmt.fmt.pix.field = V4L2_FIELD_INTERLACED; | 413 | pix->field = V4L2_FIELD_INTERLACED; |
412 | /* assume V4L2_PIX_FMT_UYVY as default */ | 414 | /* assume V4L2_PIX_FMT_UYVY as default */ |
413 | vpfe_dev->fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_UYVY; | 415 | pix->pixelformat = V4L2_PIX_FMT_UYVY; |
416 | v4l2_fill_mbus_format(&mbus_fmt, pix, | ||
417 | V4L2_MBUS_FMT_YUYV10_2X10); | ||
414 | } else { | 418 | } else { |
415 | vpfe_dev->fmt.fmt.pix.field = V4L2_FIELD_NONE; | 419 | pix->field = V4L2_FIELD_NONE; |
416 | /* assume V4L2_PIX_FMT_SBGGR8 */ | 420 | /* assume V4L2_PIX_FMT_SBGGR8 */ |
417 | vpfe_dev->fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_SBGGR8; | 421 | pix->pixelformat = V4L2_PIX_FMT_SBGGR8; |
422 | v4l2_fill_mbus_format(&mbus_fmt, pix, | ||
423 | V4L2_MBUS_FMT_SBGGR8_1X8); | ||
418 | } | 424 | } |
419 | 425 | ||
420 | /* if sub device supports g_fmt, override the defaults */ | 426 | /* if sub device supports g_mbus_fmt, override the defaults */ |
421 | ret = v4l2_device_call_until_err(&vpfe_dev->v4l2_dev, | 427 | ret = v4l2_device_call_until_err(&vpfe_dev->v4l2_dev, |
422 | sdinfo->grp_id, video, g_fmt, &vpfe_dev->fmt); | 428 | sdinfo->grp_id, video, g_mbus_fmt, &mbus_fmt); |
423 | 429 | ||
424 | if (ret && ret != -ENOIOCTLCMD) { | 430 | if (ret && ret != -ENOIOCTLCMD) { |
425 | v4l2_err(&vpfe_dev->v4l2_dev, | 431 | v4l2_err(&vpfe_dev->v4l2_dev, |
426 | "error in getting g_fmt from sub device\n"); | 432 | "error in getting g_mbus_fmt from sub device\n"); |
427 | return ret; | 433 | return ret; |
428 | } | 434 | } |
435 | v4l2_fill_pix_format(pix, &mbus_fmt); | ||
436 | pix->bytesperline = pix->width * 2; | ||
437 | pix->sizeimage = pix->bytesperline * pix->height; | ||
429 | 438 | ||
430 | /* Sets the values in CCDC */ | 439 | /* Sets the values in CCDC */ |
431 | ret = vpfe_config_ccdc_image_format(vpfe_dev); | 440 | ret = vpfe_config_ccdc_image_format(vpfe_dev); |
@@ -434,11 +443,8 @@ static int vpfe_config_image_format(struct vpfe_device *vpfe_dev, | |||
434 | 443 | ||
435 | /* Update the values of sizeimage and bytesperline */ | 444 | /* Update the values of sizeimage and bytesperline */ |
436 | if (!ret) { | 445 | if (!ret) { |
437 | vpfe_dev->fmt.fmt.pix.bytesperline = | 446 | pix->bytesperline = ccdc_dev->hw_ops.get_line_length(); |
438 | ccdc_dev->hw_ops.get_line_length(); | 447 | pix->sizeimage = pix->bytesperline * pix->height; |
439 | vpfe_dev->fmt.fmt.pix.sizeimage = | ||
440 | vpfe_dev->fmt.fmt.pix.bytesperline * | ||
441 | vpfe_dev->fmt.fmt.pix.height; | ||
442 | } | 448 | } |
443 | return ret; | 449 | return ret; |
444 | } | 450 | } |
@@ -1366,7 +1372,7 @@ static int vpfe_reqbufs(struct file *file, void *priv, | |||
1366 | req_buf->type, | 1372 | req_buf->type, |
1367 | vpfe_dev->fmt.fmt.pix.field, | 1373 | vpfe_dev->fmt.fmt.pix.field, |
1368 | sizeof(struct videobuf_buffer), | 1374 | sizeof(struct videobuf_buffer), |
1369 | fh); | 1375 | fh, NULL); |
1370 | 1376 | ||
1371 | fh->io_allowed = 1; | 1377 | fh->io_allowed = 1; |
1372 | vpfe_dev->io_usrs = 1; | 1378 | vpfe_dev->io_usrs = 1; |
@@ -1980,7 +1986,7 @@ static __init int vpfe_probe(struct platform_device *pdev) | |||
1980 | vpfe_dev->sd[i] = | 1986 | vpfe_dev->sd[i] = |
1981 | v4l2_i2c_new_subdev_board(&vpfe_dev->v4l2_dev, | 1987 | v4l2_i2c_new_subdev_board(&vpfe_dev->v4l2_dev, |
1982 | i2c_adap, | 1988 | i2c_adap, |
1983 | sdinfo->name, | 1989 | NULL, |
1984 | &sdinfo->board_info, | 1990 | &sdinfo->board_info, |
1985 | NULL); | 1991 | NULL); |
1986 | if (vpfe_dev->sd[i]) { | 1992 | if (vpfe_dev->sd[i]) { |