Commit c2fc8096 authored by Hans Verkuil's avatar Hans Verkuil Committed by 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: default avatarHans Verkuil <hverkuil@xs4all.nl>
Reviewed-by: default avatarVaibhav Hiremath <hvaibhav@ti.com>
Tested-by: default avatarVaibhav Hiremath <hvaibhav@ti.com>
Acked-by: default avatarVaibhav Hiremath <hvaibhav@ti.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent a75ffc12
...@@ -89,8 +89,6 @@ static int tvp514x_s_stream(struct v4l2_subdev *sd, int enable); ...@@ -89,8 +89,6 @@ static int tvp514x_s_stream(struct v4l2_subdev *sd, int enable);
* @ver: Chip version * @ver: Chip version
* @streaming: TVP5146/47 decoder streaming - enabled or disabled. * @streaming: TVP5146/47 decoder streaming - enabled or disabled.
* @pix: Current pixel format * @pix: Current pixel format
* @num_fmts: Number of formats
* @fmt_list: Format list
* @current_std: Current standard * @current_std: Current standard
* @num_stds: Number of standards * @num_stds: Number of standards
* @std_list: Standards list * @std_list: Standards list
...@@ -106,8 +104,6 @@ struct tvp514x_decoder { ...@@ -106,8 +104,6 @@ struct tvp514x_decoder {
int streaming; int streaming;
struct v4l2_pix_format pix; struct v4l2_pix_format pix;
int num_fmts;
const struct v4l2_fmtdesc *fmt_list;
enum tvp514x_std current_std; enum tvp514x_std current_std;
int num_stds; int num_stds;
...@@ -960,27 +956,18 @@ tvp514x_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) ...@@ -960,27 +956,18 @@ tvp514x_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
static int static int
tvp514x_enum_fmt_cap(struct v4l2_subdev *sd, struct v4l2_fmtdesc *fmt) tvp514x_enum_fmt_cap(struct v4l2_subdev *sd, struct v4l2_fmtdesc *fmt)
{ {
struct tvp514x_decoder *decoder = to_decoder(sd); if (fmt == NULL || fmt->index)
int index;
if (fmt == NULL)
return -EINVAL;
index = fmt->index;
if ((index >= decoder->num_fmts) || (index < 0))
/* Index out of bound */
return -EINVAL; return -EINVAL;
if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
/* only capture is supported */ /* only capture is supported */
return -EINVAL; return -EINVAL;
memcpy(fmt, &decoder->fmt_list[index], /* only one format */
sizeof(struct v4l2_fmtdesc)); fmt->flags = 0;
strlcpy(fmt->description, "8-bit UYVY 4:2:2 Format",
v4l2_dbg(1, debug, sd, "Current FMT: index - %d (%s)", sizeof(fmt->description));
decoder->fmt_list[index].index, fmt->pixelformat = V4L2_PIX_FMT_UYVY;
decoder->fmt_list[index].description);
return 0; return 0;
} }
...@@ -997,7 +984,6 @@ static int ...@@ -997,7 +984,6 @@ static int
tvp514x_try_fmt_cap(struct v4l2_subdev *sd, struct v4l2_format *f) tvp514x_try_fmt_cap(struct v4l2_subdev *sd, struct v4l2_format *f)
{ {
struct tvp514x_decoder *decoder = to_decoder(sd); struct tvp514x_decoder *decoder = to_decoder(sd);
int ifmt;
struct v4l2_pix_format *pix; struct v4l2_pix_format *pix;
enum tvp514x_std current_std; enum tvp514x_std current_std;
...@@ -1013,28 +999,18 @@ tvp514x_try_fmt_cap(struct v4l2_subdev *sd, struct v4l2_format *f) ...@@ -1013,28 +999,18 @@ tvp514x_try_fmt_cap(struct v4l2_subdev *sd, struct v4l2_format *f)
/* Calculate height and width based on current standard */ /* Calculate height and width based on current standard */
current_std = decoder->current_std; current_std = decoder->current_std;
pix->pixelformat = V4L2_PIX_FMT_UYVY;
pix->width = decoder->std_list[current_std].width; pix->width = decoder->std_list[current_std].width;
pix->height = decoder->std_list[current_std].height; 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->field = V4L2_FIELD_INTERLACED;
pix->bytesperline = pix->width * 2; pix->bytesperline = pix->width * 2;
pix->sizeimage = pix->bytesperline * pix->height; pix->sizeimage = pix->bytesperline * pix->height;
pix->colorspace = V4L2_COLORSPACE_SMPTE170M; pix->colorspace = V4L2_COLORSPACE_SMPTE170M;
pix->priv = 0; 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", "Width - %d, Height - %d",
decoder->fmt_list[ifmt].description, pix->bytesperline, pix->bytesperline,
pix->width, pix->height); pix->width, pix->height);
return 0; return 0;
} }
...@@ -1254,9 +1230,6 @@ static const struct v4l2_subdev_ops tvp514x_ops = { ...@@ -1254,9 +1230,6 @@ static const struct v4l2_subdev_ops tvp514x_ops = {
static struct tvp514x_decoder tvp514x_dev = { static struct tvp514x_decoder tvp514x_dev = {
.streaming = 0, .streaming = 0,
.fmt_list = tvp514x_fmt_list,
.num_fmts = ARRAY_SIZE(tvp514x_fmt_list),
.pix = { .pix = {
/* Default to NTSC 8-bit YUV 422 */ /* Default to NTSC 8-bit YUV 422 */
.width = NTSC_NUM_ACTIVE_PIXELS, .width = NTSC_NUM_ACTIVE_PIXELS,
......
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