diff options
Diffstat (limited to 'drivers/media/video/mt9v011.c')
-rw-r--r-- | drivers/media/video/mt9v011.c | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/drivers/media/video/mt9v011.c b/drivers/media/video/mt9v011.c index 72e55be0b4ab..f5e778d5ca9f 100644 --- a/drivers/media/video/mt9v011.c +++ b/drivers/media/video/mt9v011.c | |||
@@ -392,27 +392,25 @@ static int mt9v011_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) | |||
392 | return 0; | 392 | return 0; |
393 | } | 393 | } |
394 | 394 | ||
395 | static int mt9v011_enum_fmt(struct v4l2_subdev *sd, struct v4l2_fmtdesc *fmt) | 395 | static int mt9v011_enum_mbus_fmt(struct v4l2_subdev *sd, unsigned index, |
396 | enum v4l2_mbus_pixelcode *code) | ||
396 | { | 397 | { |
397 | if (fmt->index > 0) | 398 | if (index > 0) |
398 | return -EINVAL; | 399 | return -EINVAL; |
399 | 400 | ||
400 | fmt->flags = 0; | 401 | *code = V4L2_MBUS_FMT_SGRBG8_1X8; |
401 | strcpy(fmt->description, "8 bpp Bayer GRGR..BGBG"); | ||
402 | fmt->pixelformat = V4L2_PIX_FMT_SGRBG8; | ||
403 | |||
404 | return 0; | 402 | return 0; |
405 | } | 403 | } |
406 | 404 | ||
407 | static int mt9v011_try_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) | 405 | static int mt9v011_try_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *fmt) |
408 | { | 406 | { |
409 | struct v4l2_pix_format *pix = &fmt->fmt.pix; | 407 | if (fmt->code != V4L2_MBUS_FMT_SGRBG8_1X8) |
410 | |||
411 | if (pix->pixelformat != V4L2_PIX_FMT_SGRBG8) | ||
412 | return -EINVAL; | 408 | return -EINVAL; |
413 | 409 | ||
414 | v4l_bound_align_image(&pix->width, 48, 639, 1, | 410 | v4l_bound_align_image(&fmt->width, 48, 639, 1, |
415 | &pix->height, 32, 480, 1, 0); | 411 | &fmt->height, 32, 480, 1, 0); |
412 | fmt->field = V4L2_FIELD_NONE; | ||
413 | fmt->colorspace = V4L2_COLORSPACE_SRGB; | ||
416 | 414 | ||
417 | return 0; | 415 | return 0; |
418 | } | 416 | } |
@@ -455,18 +453,17 @@ static int mt9v011_s_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *parms) | |||
455 | return 0; | 453 | return 0; |
456 | } | 454 | } |
457 | 455 | ||
458 | static int mt9v011_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) | 456 | static int mt9v011_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *fmt) |
459 | { | 457 | { |
460 | struct v4l2_pix_format *pix = &fmt->fmt.pix; | ||
461 | struct mt9v011 *core = to_mt9v011(sd); | 458 | struct mt9v011 *core = to_mt9v011(sd); |
462 | int rc; | 459 | int rc; |
463 | 460 | ||
464 | rc = mt9v011_try_fmt(sd, fmt); | 461 | rc = mt9v011_try_mbus_fmt(sd, fmt); |
465 | if (rc < 0) | 462 | if (rc < 0) |
466 | return -EINVAL; | 463 | return -EINVAL; |
467 | 464 | ||
468 | core->width = pix->width; | 465 | core->width = fmt->width; |
469 | core->height = pix->height; | 466 | core->height = fmt->height; |
470 | 467 | ||
471 | set_res(sd); | 468 | set_res(sd); |
472 | 469 | ||
@@ -549,9 +546,9 @@ static const struct v4l2_subdev_core_ops mt9v011_core_ops = { | |||
549 | }; | 546 | }; |
550 | 547 | ||
551 | static const struct v4l2_subdev_video_ops mt9v011_video_ops = { | 548 | static const struct v4l2_subdev_video_ops mt9v011_video_ops = { |
552 | .enum_fmt = mt9v011_enum_fmt, | 549 | .enum_mbus_fmt = mt9v011_enum_mbus_fmt, |
553 | .try_fmt = mt9v011_try_fmt, | 550 | .try_mbus_fmt = mt9v011_try_mbus_fmt, |
554 | .s_fmt = mt9v011_s_fmt, | 551 | .s_mbus_fmt = mt9v011_s_mbus_fmt, |
555 | .g_parm = mt9v011_g_parm, | 552 | .g_parm = mt9v011_g_parm, |
556 | .s_parm = mt9v011_s_parm, | 553 | .s_parm = mt9v011_s_parm, |
557 | }; | 554 | }; |