@@ -1015,3 +1015,138 @@ void v4l_bound_align_image(u32 *w, unsigned int wmin, unsigned int wmax,
}
}
EXPORT_SYMBOL_GPL(v4l_bound_align_image);
+
+/**
+ * v4l_fill_dv_preset_info - fill description of a digital video preset
+ * @preset - preset value
+ * @info - pointer to struct v4l2_dv_enum_preset
+ *
+ * drivers can use this helper function to fill description of dv preset
+ * in info.
+ */
+int v4l_fill_dv_preset_info(u32 preset, struct v4l2_dv_enum_preset *info)
+{
+ static const struct v4l2_dv_enum_preset dv_presets[] = {
+ {
+ .preset = V4L2_DV_480P59_94,
+ .name = "480p@59.94",
+ .width = 720,
+ .height = 480,
+ },
+ {
+ .preset = V4L2_DV_576P50,
+ .name = "576p@50",
+ .width = 720,
+ .height = 576,
+ },
+ {
+ .preset = V4L2_DV_720P24,
+ .name = "720p@24",
+ .width = 1280,
+ .height = 720,
+ },
+ {
+ .preset = V4L2_DV_720P25,
+ .name = "720p@25",
+ .width = 1280,
+ .height = 720,
+ },
+ {
+ .preset = V4L2_DV_720P30,
+ .name = "720p@30",
+ .width = 1280,
+ .height = 720,
+ },
+ {
+ .preset = V4L2_DV_720P50,
+ .name = "720p@50",
+ .width = 1280,
+ .height = 720,
+ },
+ {
+ .preset = V4L2_DV_720P59_94,
+ .name = "720p@59.94",
+ .width = 1280,
+ .height = 720,
+ },
+ {
+ .preset = V4L2_DV_720P60,
+ .name = "720p@60",
+ .width = 1280,
+ .height = 720,
+ },
+ {
+ .preset = V4L2_DV_1080I29_97,
+ .name = "1080i@29.97",
+ .width = 1920,
+ .height = 1080,
+ },
+ {
+ .preset = V4L2_DV_1080I30,
+ .name = "1080i@30",
+ .width = 1920,
+ .height = 1080,
+ },
+ {
+ .preset = V4L2_DV_1080I25,
+ .name = "1080i@25",
+ .width = 1920,
+ .height = 1080,
+ },
+ {
+ .preset = V4L2_DV_1080I50,
+ .name = "1080i@50",
+ .width = 1920,
+ .height = 1080,
+ },
+ {
+ .preset = V4L2_DV_1080I60,
+ .name = "1080i@60",
+ .width = 1920,
+ .height = 1080,
+ },
+ {
+ .preset = V4L2_DV_1080P24,
+ .name = "1080p@24",
+ .width = 1920,
+ .height = 1080,
+ },
+ {
+ .preset = V4L2_DV_1080P25,
+ .name = "1080p@25",
+ .width = 1920,
+ .height = 1080,
+ },
+ {
+ .preset = V4L2_DV_1080P30,
+ .name = "1080p@30",
+ .width = 1920,
+ .height = 1080,
+ },
+ {
+ .preset = V4L2_DV_1080P50,
+ .name = "1080p@50",
+ .width = 1920,
+ .height = 1080,
+ },
+ {
+ .preset = V4L2_DV_1080P60,
+ .name = "1080p@60",
+ .width = 1920,
+ .height = 1080,
+ },
+ };
+ int i;
+
+ if (info == NULL)
+ return -EINVAL;
+
+ for (i = 0; i < ARRAY_SIZE(dv_presets); i++) {
+ if (preset == dv_presets[i].preset) {
+ memcpy(info, &dv_presets[i], sizeof(*info));
+ return 0;
+ }
+ }
+ return -EINVAL;
+}
+EXPORT_SYMBOL_GPL(v4l_fill_dv_preset_info);
@@ -213,4 +213,5 @@ void v4l_bound_align_image(unsigned int *w, unsigned int wmin,
unsigned int hmax, unsigned int halign,
unsigned int salign);
+int v4l_fill_dv_preset_info(u32 preset, struct v4l2_dv_enum_preset *info);
#endif /* V4L2_COMMON_H_ */