Commit cc3c2ac2 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

[media] v4l: omap4iss: Make __iss_video_get_format() return a v4l2_mbus_framefmt

The function will be used by a caller that needs the media bus format
instead of the pixel format currently returned. Move the media bus
format to pixel format conversion to the existing caller.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent a1d4eab0
...@@ -232,7 +232,8 @@ iss_video_far_end(struct iss_video *video) ...@@ -232,7 +232,8 @@ iss_video_far_end(struct iss_video *video)
} }
static int static int
__iss_video_get_format(struct iss_video *video, struct v4l2_format *format) __iss_video_get_format(struct iss_video *video,
struct v4l2_mbus_framefmt *format)
{ {
struct v4l2_subdev_format fmt; struct v4l2_subdev_format fmt;
struct v4l2_subdev *subdev; struct v4l2_subdev *subdev;
...@@ -243,6 +244,7 @@ __iss_video_get_format(struct iss_video *video, struct v4l2_format *format) ...@@ -243,6 +244,7 @@ __iss_video_get_format(struct iss_video *video, struct v4l2_format *format)
if (subdev == NULL) if (subdev == NULL)
return -EINVAL; return -EINVAL;
memset(&fmt, 0, sizeof(fmt));
fmt.pad = pad; fmt.pad = pad;
fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE; fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
...@@ -253,26 +255,29 @@ __iss_video_get_format(struct iss_video *video, struct v4l2_format *format) ...@@ -253,26 +255,29 @@ __iss_video_get_format(struct iss_video *video, struct v4l2_format *format)
if (ret) if (ret)
return ret; return ret;
format->type = video->type; *format = fmt.format;
return iss_video_mbus_to_pix(video, &fmt.format, &format->fmt.pix); return 0;
} }
static int static int
iss_video_check_format(struct iss_video *video, struct iss_video_fh *vfh) iss_video_check_format(struct iss_video *video, struct iss_video_fh *vfh)
{ {
struct v4l2_format format; struct v4l2_mbus_framefmt format;
struct v4l2_pix_format pixfmt;
int ret; int ret;
memcpy(&format, &vfh->format, sizeof(format));
ret = __iss_video_get_format(video, &format); ret = __iss_video_get_format(video, &format);
if (ret < 0) if (ret < 0)
return ret; return ret;
if (vfh->format.fmt.pix.pixelformat != format.fmt.pix.pixelformat || pixfmt.bytesperline = 0;
vfh->format.fmt.pix.height != format.fmt.pix.height || ret = iss_video_mbus_to_pix(video, &format, &pixfmt);
vfh->format.fmt.pix.width != format.fmt.pix.width ||
vfh->format.fmt.pix.bytesperline != format.fmt.pix.bytesperline || if (vfh->format.fmt.pix.pixelformat != pixfmt.pixelformat ||
vfh->format.fmt.pix.sizeimage != format.fmt.pix.sizeimage) vfh->format.fmt.pix.height != pixfmt.height ||
vfh->format.fmt.pix.width != pixfmt.width ||
vfh->format.fmt.pix.bytesperline != pixfmt.bytesperline ||
vfh->format.fmt.pix.sizeimage != pixfmt.sizeimage)
return -EINVAL; return -EINVAL;
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment