aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMuralidharan Karicheri <m-karicheri2@ti.com>2009-12-10 02:39:47 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-15 21:18:47 -0500
commit2e535ed5a16b8cc23301f3d26cfd49f3091aadcc (patch)
tree5542313815668b4d8a42059abff6912244327d82 /drivers/media
parent579e7d60ba0035228aadad69eb2ffeb138c51311 (diff)
V4L/DVB (13618): v4l2: Adding helper function to get dv preset description
This patch adds a helper function to get description of a digital video preset added by the video timing API. This will be useful for drivers implementing the above API. Signed-off-by: Muralidharan Karicheri <m-karicheri2@ti.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/v4l2-common.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index e8e5affbabce..36b5cb86fb57 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -1024,3 +1024,50 @@ void v4l_bound_align_image(u32 *w, unsigned int wmin, unsigned int wmax,
1024 } 1024 }
1025} 1025}
1026EXPORT_SYMBOL_GPL(v4l_bound_align_image); 1026EXPORT_SYMBOL_GPL(v4l_bound_align_image);
1027
1028/**
1029 * v4l_fill_dv_preset_info - fill description of a digital video preset
1030 * @preset - preset value
1031 * @info - pointer to struct v4l2_dv_enum_preset
1032 *
1033 * drivers can use this helper function to fill description of dv preset
1034 * in info.
1035 */
1036int v4l_fill_dv_preset_info(u32 preset, struct v4l2_dv_enum_preset *info)
1037{
1038 static const struct v4l2_dv_preset_info {
1039 u16 width;
1040 u16 height;
1041 const char *name;
1042 } dv_presets[] = {
1043 { 0, 0, "Invalid" }, /* V4L2_DV_INVALID */
1044 { 720, 480, "480p@59.94" }, /* V4L2_DV_480P59_94 */
1045 { 720, 576, "576p@50" }, /* V4L2_DV_576P50 */
1046 { 1280, 720, "720p@24" }, /* V4L2_DV_720P24 */
1047 { 1280, 720, "720p@25" }, /* V4L2_DV_720P25 */
1048 { 1280, 720, "720p@30" }, /* V4L2_DV_720P30 */
1049 { 1280, 720, "720p@50" }, /* V4L2_DV_720P50 */
1050 { 1280, 720, "720p@59.94" }, /* V4L2_DV_720P59_94 */
1051 { 1280, 720, "720p@60" }, /* V4L2_DV_720P60 */
1052 { 1920, 1080, "1080i@29.97" }, /* V4L2_DV_1080I29_97 */
1053 { 1920, 1080, "1080i@30" }, /* V4L2_DV_1080I30 */
1054 { 1920, 1080, "1080i@25" }, /* V4L2_DV_1080I25 */
1055 { 1920, 1080, "1080i@50" }, /* V4L2_DV_1080I50 */
1056 { 1920, 1080, "1080i@60" }, /* V4L2_DV_1080I60 */
1057 { 1920, 1080, "1080p@24" }, /* V4L2_DV_1080P24 */
1058 { 1920, 1080, "1080p@25" }, /* V4L2_DV_1080P25 */
1059 { 1920, 1080, "1080p@30" }, /* V4L2_DV_1080P30 */
1060 { 1920, 1080, "1080p@50" }, /* V4L2_DV_1080P50 */
1061 { 1920, 1080, "1080p@60" }, /* V4L2_DV_1080P60 */
1062 };
1063
1064 if (info == NULL || preset >= ARRAY_SIZE(dv_presets))
1065 return -EINVAL;
1066
1067 info->preset = preset;
1068 info->width = dv_presets[preset].width;
1069 info->height = dv_presets[preset].height;
1070 strlcpy(info->name, dv_presets[preset].name, sizeof(info->name));
1071 return 0;
1072}
1073EXPORT_SYMBOL_GPL(v4l_fill_dv_preset_info);