aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/davinci/vpfe_capture.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2010-08-07 05:49:33 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-10-20 23:04:37 -0400
commitd3ca77595f4b1f17a6d41a89f942fea2b3b17d0c (patch)
tree297ffc191eca55222eae861b7a0edefa2b02fc50 /drivers/media/video/davinci/vpfe_capture.c
parentdb7b5460405c399e5444d2a1d313f43cf4072801 (diff)
V4L/DVB: vpfe_capture: convert to new mediabus API
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/davinci/vpfe_capture.c')
-rw-r--r--drivers/media/video/davinci/vpfe_capture.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/drivers/media/video/davinci/vpfe_capture.c b/drivers/media/video/davinci/vpfe_capture.c
index 1c2588247289..b39112517dfb 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}