Commit 83811913 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

V4L/DVB: tvp514x: add support for enum/g/try/s_mbus_fmt

Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 0edc4afb
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <media/v4l2-device.h> #include <media/v4l2-device.h>
#include <media/v4l2-common.h> #include <media/v4l2-common.h>
#include <media/v4l2-mediabus.h>
#include <media/v4l2-chip-ident.h> #include <media/v4l2-chip-ident.h>
#include <media/tvp514x.h> #include <media/tvp514x.h>
...@@ -928,6 +929,25 @@ tvp514x_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) ...@@ -928,6 +929,25 @@ tvp514x_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
return err; return err;
} }
/**
* tvp514x_enum_mbus_fmt() - V4L2 decoder interface handler for enum_mbus_fmt
* @sd: pointer to standard V4L2 sub-device structure
* @index: index of pixelcode to retrieve
* @code: receives the pixelcode
*
* Enumerates supported mediabus formats
*/
static int
tvp514x_enum_mbus_fmt(struct v4l2_subdev *sd, unsigned index,
enum v4l2_mbus_pixelcode *code)
{
if (index)
return -EINVAL;
*code = V4L2_MBUS_FMT_YUYV10_2X10;
return 0;
}
/** /**
* tvp514x_enum_fmt_cap() - V4L2 decoder interface handler for enum_fmt * tvp514x_enum_fmt_cap() - V4L2 decoder interface handler for enum_fmt
* @sd: pointer to standard V4L2 sub-device structure * @sd: pointer to standard V4L2 sub-device structure
...@@ -953,6 +973,36 @@ tvp514x_enum_fmt_cap(struct v4l2_subdev *sd, struct v4l2_fmtdesc *fmt) ...@@ -953,6 +973,36 @@ tvp514x_enum_fmt_cap(struct v4l2_subdev *sd, struct v4l2_fmtdesc *fmt)
return 0; return 0;
} }
/**
* tvp514x_mbus_fmt_cap() - V4L2 decoder interface handler for try/s/g_mbus_fmt
* @sd: pointer to standard V4L2 sub-device structure
* @f: pointer to the mediabus format structure
*
* Negotiates the image capture size and mediabus format.
*/
static int
tvp514x_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *f)
{
struct tvp514x_decoder *decoder = to_decoder(sd);
enum tvp514x_std current_std;
if (f == NULL)
return -EINVAL;
/* Calculate height and width based on current standard */
current_std = decoder->current_std;
f->code = V4L2_MBUS_FMT_YUYV10_2X10;
f->width = decoder->std_list[current_std].width;
f->height = decoder->std_list[current_std].height;
f->field = V4L2_FIELD_INTERLACED;
f->colorspace = V4L2_COLORSPACE_SMPTE170M;
v4l2_dbg(1, debug, sd, "MBUS_FMT: Width - %d, Height - %d\n",
f->width, f->height);
return 0;
}
/** /**
* tvp514x_fmt_cap() - V4L2 decoder interface handler for try/s/g_fmt * tvp514x_fmt_cap() - V4L2 decoder interface handler for try/s/g_fmt
* @sd: pointer to standard V4L2 sub-device structure * @sd: pointer to standard V4L2 sub-device structure
...@@ -1135,6 +1185,10 @@ static const struct v4l2_subdev_video_ops tvp514x_video_ops = { ...@@ -1135,6 +1185,10 @@ static const struct v4l2_subdev_video_ops tvp514x_video_ops = {
.g_fmt = tvp514x_fmt_cap, .g_fmt = tvp514x_fmt_cap,
.try_fmt = tvp514x_fmt_cap, .try_fmt = tvp514x_fmt_cap,
.s_fmt = tvp514x_fmt_cap, .s_fmt = tvp514x_fmt_cap,
.enum_mbus_fmt = tvp514x_enum_mbus_fmt,
.g_mbus_fmt = tvp514x_mbus_fmt,
.try_mbus_fmt = tvp514x_mbus_fmt,
.s_mbus_fmt = tvp514x_mbus_fmt,
.g_parm = tvp514x_g_parm, .g_parm = tvp514x_g_parm,
.s_parm = tvp514x_s_parm, .s_parm = tvp514x_s_parm,
.s_stream = tvp514x_s_stream, .s_stream = tvp514x_s_stream,
......
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