aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/v4l2-common.c47
-rw-r--r--include/media/v4l2-common.h2
2 files changed, 48 insertions, 1 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);
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 1c25b10da34b..1c7b259f341c 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -212,5 +212,5 @@ void v4l_bound_align_image(unsigned int *w, unsigned int wmin,
212 unsigned int *h, unsigned int hmin, 212 unsigned int *h, unsigned int hmin,
213 unsigned int hmax, unsigned int halign, 213 unsigned int hmax, unsigned int halign,
214 unsigned int salign); 214 unsigned int salign);
215 215int v4l_fill_dv_preset_info(u32 preset, struct v4l2_dv_enum_preset *info);
216#endif /* V4L2_COMMON_H_ */ 216#endif /* V4L2_COMMON_H_ */