aboutsummaryrefslogtreecommitdiffstats
path: root/include/media
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2013-07-29 07:40:56 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2013-08-18 07:16:54 -0400
commit2576415846bcbad3c0a6885fc44f950837106364 (patch)
tree99772fbb135740430c638fc3eb6aa91f0a6f751a /include/media
parentb18787ed1ce32eb0c2ce2323220abd4ed93c4b97 (diff)
[media] v4l2: move dv-timings related code to v4l2-dv-timings.c
v4l2-common.c contained a bunch of dv-timings related functions. Move that to the new v4l2-dv-timings.c which is a more appropriate place for them. There aren't many drivers that do HDTV, so it is a good idea to separate common code related to that into a module of its own. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'include/media')
-rw-r--r--include/media/v4l2-common.h13
-rw-r--r--include/media/v4l2-dv-timings.h59
2 files changed, 59 insertions, 13 deletions
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 015ff82da73c..0e1d01056f16 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -201,19 +201,6 @@ const struct v4l2_frmsize_discrete *v4l2_find_nearest_format(
201 const struct v4l2_discrete_probe *probe, 201 const struct v4l2_discrete_probe *probe,
202 s32 width, s32 height); 202 s32 width, s32 height);
203 203
204bool v4l_match_dv_timings(const struct v4l2_dv_timings *t1,
205 const struct v4l2_dv_timings *t2,
206 unsigned pclock_delta);
207
208bool v4l2_detect_cvt(unsigned frame_height, unsigned hfreq, unsigned vsync,
209 u32 polarities, struct v4l2_dv_timings *fmt);
210
211bool v4l2_detect_gtf(unsigned frame_height, unsigned hfreq, unsigned vsync,
212 u32 polarities, struct v4l2_fract aspect,
213 struct v4l2_dv_timings *fmt);
214
215struct v4l2_fract v4l2_calc_aspect_ratio(u8 hor_landscape, u8 vert_portrait);
216
217void v4l2_get_timestamp(struct timeval *tv); 204void v4l2_get_timestamp(struct timeval *tv);
218 205
219#endif /* V4L2_COMMON_H_ */ 206#endif /* V4L2_COMMON_H_ */
diff --git a/include/media/v4l2-dv-timings.h b/include/media/v4l2-dv-timings.h
index 41075fa02a96..4c7bb5491658 100644
--- a/include/media/v4l2-dv-timings.h
+++ b/include/media/v4l2-dv-timings.h
@@ -64,4 +64,63 @@ bool v4l2_find_dv_timings_cap(struct v4l2_dv_timings *t,
64 const struct v4l2_dv_timings_cap *cap, 64 const struct v4l2_dv_timings_cap *cap,
65 unsigned pclock_delta); 65 unsigned pclock_delta);
66 66
67/** v4l_match_dv_timings() - do two timings match?
68 * @measured: the measured timings data.
69 * @standard: the timings according to the standard.
70 * @pclock_delta: maximum delta in Hz between standard->pixelclock and
71 * the measured timings.
72 *
73 * Returns true if the two timings match, returns false otherwise.
74 */
75bool v4l_match_dv_timings(const struct v4l2_dv_timings *measured,
76 const struct v4l2_dv_timings *standard,
77 unsigned pclock_delta);
78
79/** v4l2_detect_cvt - detect if the given timings follow the CVT standard
80 * @frame_height - the total height of the frame (including blanking) in lines.
81 * @hfreq - the horizontal frequency in Hz.
82 * @vsync - the height of the vertical sync in lines.
83 * @polarities - the horizontal and vertical polarities (same as struct
84 * v4l2_bt_timings polarities).
85 * @fmt - the resulting timings.
86 *
87 * This function will attempt to detect if the given values correspond to a
88 * valid CVT format. If so, then it will return true, and fmt will be filled
89 * in with the found CVT timings.
90 */
91bool v4l2_detect_cvt(unsigned frame_height, unsigned hfreq, unsigned vsync,
92 u32 polarities, struct v4l2_dv_timings *fmt);
93
94/** v4l2_detect_gtf - detect if the given timings follow the GTF standard
95 * @frame_height - the total height of the frame (including blanking) in lines.
96 * @hfreq - the horizontal frequency in Hz.
97 * @vsync - the height of the vertical sync in lines.
98 * @polarities - the horizontal and vertical polarities (same as struct
99 * v4l2_bt_timings polarities).
100 * @aspect - preferred aspect ratio. GTF has no method of determining the
101 * aspect ratio in order to derive the image width from the
102 * image height, so it has to be passed explicitly. Usually
103 * the native screen aspect ratio is used for this. If it
104 * is not filled in correctly, then 16:9 will be assumed.
105 * @fmt - the resulting timings.
106 *
107 * This function will attempt to detect if the given values correspond to a
108 * valid GTF format. If so, then it will return true, and fmt will be filled
109 * in with the found GTF timings.
110 */
111bool v4l2_detect_gtf(unsigned frame_height, unsigned hfreq, unsigned vsync,
112 u32 polarities, struct v4l2_fract aspect,
113 struct v4l2_dv_timings *fmt);
114
115/** v4l2_calc_aspect_ratio - calculate the aspect ratio based on bytes
116 * 0x15 and 0x16 from the EDID.
117 * @hor_landscape - byte 0x15 from the EDID.
118 * @vert_portrait - byte 0x16 from the EDID.
119 *
120 * Determines the aspect ratio from the EDID.
121 * See VESA Enhanced EDID standard, release A, rev 2, section 3.6.2:
122 * "Horizontal and Vertical Screen Size or Aspect Ratio"
123 */
124struct v4l2_fract v4l2_calc_aspect_ratio(u8 hor_landscape, u8 vert_portrait);
125
67#endif 126#endif