forked from Minki/linux
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: Hans Verkuil <hverkuil@xs4all.nl> Reviewed-by: Vaibhav Hiremath <hvaibhav@ti.com> Tested-by: Vaibhav Hiremath <hvaibhav@ti.com> Acked-by: Vaibhav Hiremath <hvaibhav@ti.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
a75ffc1246
commit
c2fc80961f
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user