diff options
Diffstat (limited to 'drivers/media/video/m5mols/m5mols_core.c')
-rw-r--r-- | drivers/media/video/m5mols/m5mols_core.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/drivers/media/video/m5mols/m5mols_core.c b/drivers/media/video/m5mols/m5mols_core.c index 05ab3700647..e0f09e53180 100644 --- a/drivers/media/video/m5mols/m5mols_core.c +++ b/drivers/media/video/m5mols/m5mols_core.c | |||
@@ -334,7 +334,7 @@ int m5mols_mode(struct m5mols_info *info, u8 mode) | |||
334 | int ret = -EINVAL; | 334 | int ret = -EINVAL; |
335 | u8 reg; | 335 | u8 reg; |
336 | 336 | ||
337 | if (mode < REG_PARAMETER && mode > REG_CAPTURE) | 337 | if (mode < REG_PARAMETER || mode > REG_CAPTURE) |
338 | return ret; | 338 | return ret; |
339 | 339 | ||
340 | ret = m5mols_read_u8(sd, SYSTEM_SYSMODE, ®); | 340 | ret = m5mols_read_u8(sd, SYSTEM_SYSMODE, ®); |
@@ -511,9 +511,6 @@ static int m5mols_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, | |||
511 | struct m5mols_info *info = to_m5mols(sd); | 511 | struct m5mols_info *info = to_m5mols(sd); |
512 | struct v4l2_mbus_framefmt *format; | 512 | struct v4l2_mbus_framefmt *format; |
513 | 513 | ||
514 | if (fmt->pad != 0) | ||
515 | return -EINVAL; | ||
516 | |||
517 | format = __find_format(info, fh, fmt->which, info->res_type); | 514 | format = __find_format(info, fh, fmt->which, info->res_type); |
518 | if (!format) | 515 | if (!format) |
519 | return -EINVAL; | 516 | return -EINVAL; |
@@ -532,9 +529,6 @@ static int m5mols_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, | |||
532 | u32 resolution = 0; | 529 | u32 resolution = 0; |
533 | int ret; | 530 | int ret; |
534 | 531 | ||
535 | if (fmt->pad != 0) | ||
536 | return -EINVAL; | ||
537 | |||
538 | ret = __find_resolution(sd, format, &type, &resolution); | 532 | ret = __find_resolution(sd, format, &type, &resolution); |
539 | if (ret < 0) | 533 | if (ret < 0) |
540 | return ret; | 534 | return ret; |
@@ -543,13 +537,14 @@ static int m5mols_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, | |||
543 | if (!sfmt) | 537 | if (!sfmt) |
544 | return 0; | 538 | return 0; |
545 | 539 | ||
546 | *sfmt = m5mols_default_ffmt[type]; | 540 | |
547 | sfmt->width = format->width; | 541 | format->code = m5mols_default_ffmt[type].code; |
548 | sfmt->height = format->height; | 542 | format->colorspace = V4L2_COLORSPACE_JPEG; |
543 | format->field = V4L2_FIELD_NONE; | ||
549 | 544 | ||
550 | if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) { | 545 | if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) { |
546 | *sfmt = *format; | ||
551 | info->resolution = resolution; | 547 | info->resolution = resolution; |
552 | info->code = format->code; | ||
553 | info->res_type = type; | 548 | info->res_type = type; |
554 | } | 549 | } |
555 | 550 | ||
@@ -626,13 +621,14 @@ static int m5mols_start_monitor(struct m5mols_info *info) | |||
626 | static int m5mols_s_stream(struct v4l2_subdev *sd, int enable) | 621 | static int m5mols_s_stream(struct v4l2_subdev *sd, int enable) |
627 | { | 622 | { |
628 | struct m5mols_info *info = to_m5mols(sd); | 623 | struct m5mols_info *info = to_m5mols(sd); |
624 | u32 code = info->ffmt[info->res_type].code; | ||
629 | 625 | ||
630 | if (enable) { | 626 | if (enable) { |
631 | int ret = -EINVAL; | 627 | int ret = -EINVAL; |
632 | 628 | ||
633 | if (is_code(info->code, M5MOLS_RESTYPE_MONITOR)) | 629 | if (is_code(code, M5MOLS_RESTYPE_MONITOR)) |
634 | ret = m5mols_start_monitor(info); | 630 | ret = m5mols_start_monitor(info); |
635 | if (is_code(info->code, M5MOLS_RESTYPE_CAPTURE)) | 631 | if (is_code(code, M5MOLS_RESTYPE_CAPTURE)) |
636 | ret = m5mols_start_capture(info); | 632 | ret = m5mols_start_capture(info); |
637 | 633 | ||
638 | return ret; | 634 | return ret; |