@@ -23,6 +23,7 @@
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/rational.h>
+#include <linux/hdmi.h>
#include <linux/videodev2.h>
#include <linux/v4l2-dv-timings.h>
#include <media/v4l2-dv-timings.h>
@@ -381,6 +382,23 @@ struct v4l2_fract v4l2_dv_timings_aspect_ratio(const struct v4l2_dv_timings *t)
}
EXPORT_SYMBOL_GPL(v4l2_dv_timings_aspect_ratio);
+u8 v4l2_dv_timings_cea861_aspect_ratio(const struct v4l2_dv_timings *t)
+{
+ unsigned int w = t->bt.width;
+ unsigned int h = t->bt.height;
+
+ if (t->bt.flags & V4L2_DV_FL_HAS_PICTURE_ASPECT) {
+ w = t->bt.picture_aspect.numerator;
+ h = t->bt.picture_aspect.denominator;
+ }
+ if (w * 3 == h * 4)
+ return HDMI_PICTURE_ASPECT_4_3;
+ if (w * 9 == h * 16)
+ return HDMI_PICTURE_ASPECT_16_9;
+ return HDMI_PICTURE_ASPECT_NONE;
+}
+EXPORT_SYMBOL_GPL(v4l2_dv_timings_cea861_aspect_ratio);
+
/*
* CVT defines
* Based on Coordinated Video Timings Standard
@@ -203,6 +203,14 @@ struct v4l2_fract v4l2_calc_aspect_ratio(u8 hor_landscape, u8 vert_portrait);
*/
struct v4l2_fract v4l2_dv_timings_aspect_ratio(const struct v4l2_dv_timings *t);
+/**
+ * v4l2_dv_timings_cea861_aspect_ratio() - return CEA-861 picture aspect ratio
+ * @t: the timings data.
+ *
+ * Returns the CEA-861 picture aspect ratio value (AVI InfoFrame bits M0+M1)
+ */
+u8 v4l2_dv_timings_cea861_aspect_ratio(const struct v4l2_dv_timings *t);
+
/*
* reduce_fps - check if conditions for reduced fps are true.
* bt - v4l2 timing structure