diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/tvp514x.c | 45 |
1 files changed, 9 insertions, 36 deletions
diff --git a/drivers/media/video/tvp514x.c b/drivers/media/video/tvp514x.c index b802da713114..cb4284384133 100644 --- a/drivers/media/video/tvp514x.c +++ b/drivers/media/video/tvp514x.c | |||
@@ -89,8 +89,6 @@ static int tvp514x_s_stream(struct v4l2_subdev *sd, int enable); | |||
89 | * @ver: Chip version | 89 | * @ver: Chip version |
90 | * @streaming: TVP5146/47 decoder streaming - enabled or disabled. | 90 | * @streaming: TVP5146/47 decoder streaming - enabled or disabled. |
91 | * @pix: Current pixel format | 91 | * @pix: Current pixel format |
92 | * @num_fmts: Number of formats | ||
93 | * @fmt_list: Format list | ||
94 | * @current_std: Current standard | 92 | * @current_std: Current standard |
95 | * @num_stds: Number of standards | 93 | * @num_stds: Number of standards |
96 | * @std_list: Standards list | 94 | * @std_list: Standards list |
@@ -106,8 +104,6 @@ struct tvp514x_decoder { | |||
106 | int streaming; | 104 | int streaming; |
107 | 105 | ||
108 | struct v4l2_pix_format pix; | 106 | struct v4l2_pix_format pix; |
109 | int num_fmts; | ||
110 | const struct v4l2_fmtdesc *fmt_list; | ||
111 | 107 | ||
112 | enum tvp514x_std current_std; | 108 | enum tvp514x_std current_std; |
113 | int num_stds; | 109 | int num_stds; |
@@ -960,27 +956,18 @@ tvp514x_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) | |||
960 | static int | 956 | static int |
961 | tvp514x_enum_fmt_cap(struct v4l2_subdev *sd, struct v4l2_fmtdesc *fmt) | 957 | tvp514x_enum_fmt_cap(struct v4l2_subdev *sd, struct v4l2_fmtdesc *fmt) |
962 | { | 958 | { |
963 | struct tvp514x_decoder *decoder = to_decoder(sd); | 959 | if (fmt == NULL || fmt->index) |
964 | int index; | ||
965 | |||
966 | if (fmt == NULL) | ||
967 | return -EINVAL; | ||
968 | |||
969 | index = fmt->index; | ||
970 | if ((index >= decoder->num_fmts) || (index < 0)) | ||
971 | /* Index out of bound */ | ||
972 | return -EINVAL; | 960 | return -EINVAL; |
973 | 961 | ||
974 | if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 962 | if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
975 | /* only capture is supported */ | 963 | /* only capture is supported */ |
976 | return -EINVAL; | 964 | return -EINVAL; |
977 | 965 | ||
978 | memcpy(fmt, &decoder->fmt_list[index], | 966 | /* only one format */ |
979 | sizeof(struct v4l2_fmtdesc)); | 967 | fmt->flags = 0; |
980 | 968 | strlcpy(fmt->description, "8-bit UYVY 4:2:2 Format", | |
981 | v4l2_dbg(1, debug, sd, "Current FMT: index - %d (%s)", | 969 | sizeof(fmt->description)); |
982 | decoder->fmt_list[index].index, | 970 | fmt->pixelformat = V4L2_PIX_FMT_UYVY; |
983 | decoder->fmt_list[index].description); | ||
984 | return 0; | 971 | return 0; |
985 | } | 972 | } |
986 | 973 | ||
@@ -997,7 +984,6 @@ static int | |||
997 | tvp514x_try_fmt_cap(struct v4l2_subdev *sd, struct v4l2_format *f) | 984 | tvp514x_try_fmt_cap(struct v4l2_subdev *sd, struct v4l2_format *f) |
998 | { | 985 | { |
999 | struct tvp514x_decoder *decoder = to_decoder(sd); | 986 | struct tvp514x_decoder *decoder = to_decoder(sd); |
1000 | int ifmt; | ||
1001 | struct v4l2_pix_format *pix; | 987 | struct v4l2_pix_format *pix; |
1002 | enum tvp514x_std current_std; | 988 | enum tvp514x_std current_std; |
1003 | 989 | ||
@@ -1013,28 +999,18 @@ tvp514x_try_fmt_cap(struct v4l2_subdev *sd, struct v4l2_format *f) | |||
1013 | /* Calculate height and width based on current standard */ | 999 | /* Calculate height and width based on current standard */ |
1014 | current_std = decoder->current_std; | 1000 | current_std = decoder->current_std; |
1015 | 1001 | ||
1002 | pix->pixelformat = V4L2_PIX_FMT_UYVY; | ||
1016 | pix->width = decoder->std_list[current_std].width; | 1003 | pix->width = decoder->std_list[current_std].width; |
1017 | pix->height = decoder->std_list[current_std].height; | 1004 | pix->height = decoder->std_list[current_std].height; |
1018 | |||
1019 | for (ifmt = 0; ifmt < decoder->num_fmts; ifmt++) { | ||
1020 | if (pix->pixelformat == | ||
1021 | decoder->fmt_list[ifmt].pixelformat) | ||
1022 | break; | ||
1023 | } | ||
1024 | if (ifmt == decoder->num_fmts) | ||
1025 | /* None of the format matched, select default */ | ||
1026 | ifmt = 0; | ||
1027 | pix->pixelformat = decoder->fmt_list[ifmt].pixelformat; | ||
1028 | |||
1029 | pix->field = V4L2_FIELD_INTERLACED; | 1005 | pix->field = V4L2_FIELD_INTERLACED; |
1030 | pix->bytesperline = pix->width * 2; | 1006 | pix->bytesperline = pix->width * 2; |
1031 | pix->sizeimage = pix->bytesperline * pix->height; | 1007 | pix->sizeimage = pix->bytesperline * pix->height; |
1032 | pix->colorspace = V4L2_COLORSPACE_SMPTE170M; | 1008 | pix->colorspace = V4L2_COLORSPACE_SMPTE170M; |
1033 | pix->priv = 0; | 1009 | pix->priv = 0; |
1034 | 1010 | ||
1035 | v4l2_dbg(1, debug, sd, "Try FMT: pixelformat - %s, bytesperline - %d" | 1011 | v4l2_dbg(1, debug, sd, "Try FMT: bytesperline - %d" |
1036 | "Width - %d, Height - %d", | 1012 | "Width - %d, Height - %d", |
1037 | decoder->fmt_list[ifmt].description, pix->bytesperline, | 1013 | pix->bytesperline, |
1038 | pix->width, pix->height); | 1014 | pix->width, pix->height); |
1039 | return 0; | 1015 | return 0; |
1040 | } | 1016 | } |
@@ -1254,9 +1230,6 @@ static const struct v4l2_subdev_ops tvp514x_ops = { | |||
1254 | static struct tvp514x_decoder tvp514x_dev = { | 1230 | static struct tvp514x_decoder tvp514x_dev = { |
1255 | .streaming = 0, | 1231 | .streaming = 0, |
1256 | 1232 | ||
1257 | .fmt_list = tvp514x_fmt_list, | ||
1258 | .num_fmts = ARRAY_SIZE(tvp514x_fmt_list), | ||
1259 | |||
1260 | .pix = { | 1233 | .pix = { |
1261 | /* Default to NTSC 8-bit YUV 422 */ | 1234 | /* Default to NTSC 8-bit YUV 422 */ |
1262 | .width = NTSC_NUM_ACTIVE_PIXELS, | 1235 | .width = NTSC_NUM_ACTIVE_PIXELS, |