V4L/DVB: tvp7002.c: Add support for enum_dv_presets
authorMats Randgaard <mats.randgaard@tandberg.com>
Wed, 5 May 2010 08:21:24 +0000 (05:21 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 19 May 2010 15:59:02 +0000 (12:59 -0300)
Implement enum_dv_presets in tvp7002.

Signed-off-by: Mats Randgaard <mats.randgaard@tandberg.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/tvp7002.c

index f650f0d125eb656f11286bbfd954d54011ab531f..6ebbf1759187f73a2cd4415a7da1c493f233eb21 100644 (file)
@@ -991,6 +991,23 @@ static int tvp7002_log_status(struct v4l2_subdev *sd)
        return 0;
 }
 
+/*
+ * tvp7002_enum_dv_presets() - Enum supported digital video formats
+ * @sd: pointer to standard V4L2 sub-device structure
+ * @preset: pointer to format struct
+ *
+ * Enumerate supported digital video formats.
+ */
+static int tvp7002_enum_dv_presets(struct v4l2_subdev *sd,
+               struct v4l2_dv_enum_preset *preset)
+{
+       /* Check requested format index is within range */
+       if (preset->index >= NUM_PRESETS)
+               return -EINVAL;
+
+       return v4l_fill_dv_preset_info(tvp7002_presets[preset->index].preset, preset);
+}
+
 /* V4L2 core operation handlers */
 static const struct v4l2_subdev_core_ops tvp7002_core_ops = {
        .g_chip_ident = tvp7002_g_chip_ident,
@@ -1006,6 +1023,7 @@ static const struct v4l2_subdev_core_ops tvp7002_core_ops = {
 
 /* Specific video subsystem operation handlers */
 static const struct v4l2_subdev_video_ops tvp7002_video_ops = {
+       .enum_dv_presets = tvp7002_enum_dv_presets,
        .s_dv_preset = tvp7002_s_dv_preset,
        .query_dv_preset = tvp7002_query_dv_preset,
        .s_stream = tvp7002_s_stream,