提交 c2fc8096 编写于 作者: H Hans Verkuil 提交者: Mauro Carvalho Chehab

V4L/DVB: tvp514x: there is only one supported format, so simplify the code

Get rid of unnecessary code since this driver supports only one
pixel format. Removing this code will make the transition to the
mbus API easier as well.
Signed-off-by: NHans Verkuil <hverkuil@xs4all.nl>
Reviewed-by: NVaibhav Hiremath <hvaibhav@ti.com>
Tested-by: NVaibhav Hiremath <hvaibhav@ti.com>
Acked-by: NVaibhav Hiremath <hvaibhav@ti.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 a75ffc12
......@@ -89,8 +89,6 @@ static int tvp514x_s_stream(struct v4l2_subdev *sd, int enable);
* @ver: Chip version
* @streaming: TVP5146/47 decoder streaming - enabled or disabled.
* @pix: Current pixel format
* @num_fmts: Number of formats
* @fmt_list: Format list
* @current_std: Current standard
* @num_stds: Number of standards
* @std_list: Standards list
......@@ -106,8 +104,6 @@ struct tvp514x_decoder {
int streaming;
struct v4l2_pix_format pix;
int num_fmts;
const struct v4l2_fmtdesc *fmt_list;
enum tvp514x_std current_std;
int num_stds;
......@@ -960,27 +956,18 @@ tvp514x_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
static int
tvp514x_enum_fmt_cap(struct v4l2_subdev *sd, struct v4l2_fmtdesc *fmt)
{
struct tvp514x_decoder *decoder = to_decoder(sd);
int index;
if (fmt == NULL)
return -EINVAL;
index = fmt->index;
if ((index >= decoder->num_fmts) || (index < 0))
/* Index out of bound */
if (fmt == NULL || fmt->index)
return -EINVAL;
if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
/* only capture is supported */
return -EINVAL;
memcpy(fmt, &decoder->fmt_list[index],
sizeof(struct v4l2_fmtdesc));
v4l2_dbg(1, debug, sd, "Current FMT: index - %d (%s)",
decoder->fmt_list[index].index,
decoder->fmt_list[index].description);
/* only one format */
fmt->flags = 0;
strlcpy(fmt->description, "8-bit UYVY 4:2:2 Format",
sizeof(fmt->description));
fmt->pixelformat = V4L2_PIX_FMT_UYVY;
return 0;
}
......@@ -997,7 +984,6 @@ static int
tvp514x_try_fmt_cap(struct v4l2_subdev *sd, struct v4l2_format *f)
{
struct tvp514x_decoder *decoder = to_decoder(sd);
int ifmt;
struct v4l2_pix_format *pix;
enum tvp514x_std current_std;
......@@ -1013,28 +999,18 @@ tvp514x_try_fmt_cap(struct v4l2_subdev *sd, struct v4l2_format *f)
/* Calculate height and width based on current standard */
current_std = decoder->current_std;
pix->pixelformat = V4L2_PIX_FMT_UYVY;
pix->width = decoder->std_list[current_std].width;
pix->height = decoder->std_list[current_std].height;
for (ifmt = 0; ifmt < decoder->num_fmts; ifmt++) {
if (pix->pixelformat ==
decoder->fmt_list[ifmt].pixelformat)
break;
}
if (ifmt == decoder->num_fmts)
/* None of the format matched, select default */
ifmt = 0;
pix->pixelformat = decoder->fmt_list[ifmt].pixelformat;
pix->field = V4L2_FIELD_INTERLACED;
pix->bytesperline = pix->width * 2;
pix->sizeimage = pix->bytesperline * pix->height;
pix->colorspace = V4L2_COLORSPACE_SMPTE170M;
pix->priv = 0;
v4l2_dbg(1, debug, sd, "Try FMT: pixelformat - %s, bytesperline - %d"
v4l2_dbg(1, debug, sd, "Try FMT: bytesperline - %d"
"Width - %d, Height - %d",
decoder->fmt_list[ifmt].description, pix->bytesperline,
pix->bytesperline,
pix->width, pix->height);
return 0;
}
......@@ -1254,9 +1230,6 @@ static const struct v4l2_subdev_ops tvp514x_ops = {
static struct tvp514x_decoder tvp514x_dev = {
.streaming = 0,
.fmt_list = tvp514x_fmt_list,
.num_fmts = ARRAY_SIZE(tvp514x_fmt_list),
.pix = {
/* Default to NTSC 8-bit YUV 422 */
.width = NTSC_NUM_ACTIVE_PIXELS,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册