diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2010-05-09 06:07:35 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-10-20 23:04:37 -0400 |
commit | db7b5460405c399e5444d2a1d313f43cf4072801 (patch) | |
tree | 239a2a543def79433eb176de95f387dba936941e /drivers | |
parent | 838119138ee2ebcb0dcc3bad808a403c29910cd5 (diff) |
V4L/DVB: tvp7002: add support for enum/try/g/s_mbus_fmt
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/tvp7002.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/drivers/media/video/tvp7002.c b/drivers/media/video/tvp7002.c index 48f5c76ab521..45eb19fca078 100644 --- a/drivers/media/video/tvp7002.c +++ b/drivers/media/video/tvp7002.c | |||
@@ -695,6 +695,37 @@ static int tvp7002_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc) | |||
695 | } | 695 | } |
696 | 696 | ||
697 | /* | 697 | /* |
698 | * tvp7002_mbus_fmt() - V4L2 decoder interface handler for try/s/g_mbus_fmt | ||
699 | * @sd: pointer to standard V4L2 sub-device structure | ||
700 | * @f: pointer to mediabus format structure | ||
701 | * | ||
702 | * Negotiate the image capture size and mediabus format. | ||
703 | * There is only one possible format, so this single function works for | ||
704 | * get, set and try. | ||
705 | */ | ||
706 | static int tvp7002_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *f) | ||
707 | { | ||
708 | struct tvp7002 *device = to_tvp7002(sd); | ||
709 | struct v4l2_dv_enum_preset e_preset; | ||
710 | int error; | ||
711 | |||
712 | /* Calculate height and width based on current standard */ | ||
713 | error = v4l_fill_dv_preset_info(device->current_preset->preset, &e_preset); | ||
714 | if (error) | ||
715 | return error; | ||
716 | |||
717 | f->width = e_preset.width; | ||
718 | f->height = e_preset.height; | ||
719 | f->code = V4L2_MBUS_FMT_YUYV10_1X20; | ||
720 | f->field = device->current_preset->scanmode; | ||
721 | f->colorspace = device->current_preset->color_space; | ||
722 | |||
723 | v4l2_dbg(1, debug, sd, "MBUS_FMT: Width - %d, Height - %d", | ||
724 | f->width, f->height); | ||
725 | return 0; | ||
726 | } | ||
727 | |||
728 | /* | ||
698 | * tvp7002_try_fmt_cap() - V4L2 decoder interface handler for try_fmt | 729 | * tvp7002_try_fmt_cap() - V4L2 decoder interface handler for try_fmt |
699 | * @sd: pointer to standard V4L2 sub-device structure | 730 | * @sd: pointer to standard V4L2 sub-device structure |
700 | * @f: pointer to standard V4L2 VIDIOC_TRY_FMT ioctl structure | 731 | * @f: pointer to standard V4L2 VIDIOC_TRY_FMT ioctl structure |
@@ -913,6 +944,25 @@ static int tvp7002_enum_fmt(struct v4l2_subdev *sd, | |||
913 | } | 944 | } |
914 | 945 | ||
915 | /* | 946 | /* |
947 | * tvp7002_enum_mbus_fmt() - Enum supported mediabus formats | ||
948 | * @sd: pointer to standard V4L2 sub-device structure | ||
949 | * @index: format index | ||
950 | * @code: pointer to mediabus format | ||
951 | * | ||
952 | * Enumerate supported mediabus formats. | ||
953 | */ | ||
954 | |||
955 | static int tvp7002_enum_mbus_fmt(struct v4l2_subdev *sd, unsigned index, | ||
956 | enum v4l2_mbus_pixelcode *code) | ||
957 | { | ||
958 | /* Check requested format index is within range */ | ||
959 | if (index) | ||
960 | return -EINVAL; | ||
961 | *code = V4L2_MBUS_FMT_YUYV10_1X20; | ||
962 | return 0; | ||
963 | } | ||
964 | |||
965 | /* | ||
916 | * tvp7002_s_stream() - V4L2 decoder i/f handler for s_stream | 966 | * tvp7002_s_stream() - V4L2 decoder i/f handler for s_stream |
917 | * @sd: pointer to standard V4L2 sub-device structure | 967 | * @sd: pointer to standard V4L2 sub-device structure |
918 | * @enable: streaming enable or disable | 968 | * @enable: streaming enable or disable |
@@ -1030,6 +1080,10 @@ static const struct v4l2_subdev_video_ops tvp7002_video_ops = { | |||
1030 | .g_fmt = tvp7002_g_fmt, | 1080 | .g_fmt = tvp7002_g_fmt, |
1031 | .s_fmt = tvp7002_s_fmt, | 1081 | .s_fmt = tvp7002_s_fmt, |
1032 | .enum_fmt = tvp7002_enum_fmt, | 1082 | .enum_fmt = tvp7002_enum_fmt, |
1083 | .g_mbus_fmt = tvp7002_mbus_fmt, | ||
1084 | .try_mbus_fmt = tvp7002_mbus_fmt, | ||
1085 | .s_mbus_fmt = tvp7002_mbus_fmt, | ||
1086 | .enum_mbus_fmt = tvp7002_enum_mbus_fmt, | ||
1033 | }; | 1087 | }; |
1034 | 1088 | ||
1035 | /* V4L2 top level operation handlers */ | 1089 | /* V4L2 top level operation handlers */ |