diff options
Diffstat (limited to 'include/media/v4l2-dv-timings.h')
-rw-r--r-- | include/media/v4l2-dv-timings.h | 141 |
1 files changed, 82 insertions, 59 deletions
diff --git a/include/media/v4l2-dv-timings.h b/include/media/v4l2-dv-timings.h index eecd3102a618..b6130b50a0f1 100644 --- a/include/media/v4l2-dv-timings.h +++ b/include/media/v4l2-dv-timings.h | |||
@@ -23,11 +23,14 @@ | |||
23 | 23 | ||
24 | #include <linux/videodev2.h> | 24 | #include <linux/videodev2.h> |
25 | 25 | ||
26 | /** v4l2_dv_timings_presets: list of all dv_timings presets. | 26 | /** |
27 | * v4l2_dv_timings_presets: list of all dv_timings presets. | ||
27 | */ | 28 | */ |
28 | extern const struct v4l2_dv_timings v4l2_dv_timings_presets[]; | 29 | extern const struct v4l2_dv_timings v4l2_dv_timings_presets[]; |
29 | 30 | ||
30 | /** v4l2_check_dv_timings_fnc - timings check callback | 31 | /** |
32 | * v4l2_check_dv_timings_fnc - timings check callback | ||
33 | * | ||
31 | * @t: the v4l2_dv_timings struct. | 34 | * @t: the v4l2_dv_timings struct. |
32 | * @handle: a handle from the driver. | 35 | * @handle: a handle from the driver. |
33 | * | 36 | * |
@@ -35,86 +38,101 @@ extern const struct v4l2_dv_timings v4l2_dv_timings_presets[]; | |||
35 | */ | 38 | */ |
36 | typedef bool v4l2_check_dv_timings_fnc(const struct v4l2_dv_timings *t, void *handle); | 39 | typedef bool v4l2_check_dv_timings_fnc(const struct v4l2_dv_timings *t, void *handle); |
37 | 40 | ||
38 | /** v4l2_valid_dv_timings() - are these timings valid? | 41 | /** |
39 | * @t: the v4l2_dv_timings struct. | 42 | * v4l2_valid_dv_timings() - are these timings valid? |
40 | * @cap: the v4l2_dv_timings_cap capabilities. | 43 | * |
41 | * @fnc: callback to check if this timing is OK. May be NULL. | 44 | * @t: the v4l2_dv_timings struct. |
42 | * @fnc_handle: a handle that is passed on to @fnc. | 45 | * @cap: the v4l2_dv_timings_cap capabilities. |
43 | * | 46 | * @fnc: callback to check if this timing is OK. May be NULL. |
44 | * Returns true if the given dv_timings struct is supported by the | 47 | * @fnc_handle: a handle that is passed on to @fnc. |
45 | * hardware capabilities and the callback function (if non-NULL), returns | 48 | * |
46 | * false otherwise. | 49 | * Returns true if the given dv_timings struct is supported by the |
47 | */ | 50 | * hardware capabilities and the callback function (if non-NULL), returns |
51 | * false otherwise. | ||
52 | */ | ||
48 | bool v4l2_valid_dv_timings(const struct v4l2_dv_timings *t, | 53 | bool v4l2_valid_dv_timings(const struct v4l2_dv_timings *t, |
49 | const struct v4l2_dv_timings_cap *cap, | 54 | const struct v4l2_dv_timings_cap *cap, |
50 | v4l2_check_dv_timings_fnc fnc, | 55 | v4l2_check_dv_timings_fnc fnc, |
51 | void *fnc_handle); | 56 | void *fnc_handle); |
52 | 57 | ||
53 | /** v4l2_enum_dv_timings_cap() - Helper function to enumerate possible DV timings based on capabilities | 58 | /** |
54 | * @t: the v4l2_enum_dv_timings struct. | 59 | * v4l2_enum_dv_timings_cap() - Helper function to enumerate possible DV |
55 | * @cap: the v4l2_dv_timings_cap capabilities. | 60 | * timings based on capabilities |
56 | * @fnc: callback to check if this timing is OK. May be NULL. | 61 | * |
57 | * @fnc_handle: a handle that is passed on to @fnc. | 62 | * @t: the v4l2_enum_dv_timings struct. |
58 | * | 63 | * @cap: the v4l2_dv_timings_cap capabilities. |
59 | * This enumerates dv_timings using the full list of possible CEA-861 and DMT | 64 | * @fnc: callback to check if this timing is OK. May be NULL. |
60 | * timings, filtering out any timings that are not supported based on the | 65 | * @fnc_handle: a handle that is passed on to @fnc. |
61 | * hardware capabilities and the callback function (if non-NULL). | 66 | * |
62 | * | 67 | * This enumerates dv_timings using the full list of possible CEA-861 and DMT |
63 | * If a valid timing for the given index is found, it will fill in @t and | 68 | * timings, filtering out any timings that are not supported based on the |
64 | * return 0, otherwise it returns -EINVAL. | 69 | * hardware capabilities and the callback function (if non-NULL). |
65 | */ | 70 | * |
71 | * If a valid timing for the given index is found, it will fill in @t and | ||
72 | * return 0, otherwise it returns -EINVAL. | ||
73 | */ | ||
66 | int v4l2_enum_dv_timings_cap(struct v4l2_enum_dv_timings *t, | 74 | int v4l2_enum_dv_timings_cap(struct v4l2_enum_dv_timings *t, |
67 | const struct v4l2_dv_timings_cap *cap, | 75 | const struct v4l2_dv_timings_cap *cap, |
68 | v4l2_check_dv_timings_fnc fnc, | 76 | v4l2_check_dv_timings_fnc fnc, |
69 | void *fnc_handle); | 77 | void *fnc_handle); |
70 | 78 | ||
71 | /** v4l2_find_dv_timings_cap() - Find the closest timings struct | 79 | /** |
72 | * @t: the v4l2_enum_dv_timings struct. | 80 | * v4l2_find_dv_timings_cap() - Find the closest timings struct |
73 | * @cap: the v4l2_dv_timings_cap capabilities. | 81 | * |
74 | * @pclock_delta: maximum delta between t->pixelclock and the timing struct | 82 | * @t: the v4l2_enum_dv_timings struct. |
75 | * under consideration. | 83 | * @cap: the v4l2_dv_timings_cap capabilities. |
76 | * @fnc: callback to check if a given timings struct is OK. May be NULL. | 84 | * @pclock_delta: maximum delta between t->pixelclock and the timing struct |
77 | * @fnc_handle: a handle that is passed on to @fnc. | 85 | * under consideration. |
78 | * | 86 | * @fnc: callback to check if a given timings struct is OK. May be NULL. |
79 | * This function tries to map the given timings to an entry in the | 87 | * @fnc_handle: a handle that is passed on to @fnc. |
80 | * full list of possible CEA-861 and DMT timings, filtering out any timings | 88 | * |
81 | * that are not supported based on the hardware capabilities and the callback | 89 | * This function tries to map the given timings to an entry in the |
82 | * function (if non-NULL). | 90 | * full list of possible CEA-861 and DMT timings, filtering out any timings |
83 | * | 91 | * that are not supported based on the hardware capabilities and the callback |
84 | * On success it will fill in @t with the found timings and it returns true. | 92 | * function (if non-NULL). |
85 | * On failure it will return false. | 93 | * |
86 | */ | 94 | * On success it will fill in @t with the found timings and it returns true. |
95 | * On failure it will return false. | ||
96 | */ | ||
87 | bool v4l2_find_dv_timings_cap(struct v4l2_dv_timings *t, | 97 | bool v4l2_find_dv_timings_cap(struct v4l2_dv_timings *t, |
88 | const struct v4l2_dv_timings_cap *cap, | 98 | const struct v4l2_dv_timings_cap *cap, |
89 | unsigned pclock_delta, | 99 | unsigned pclock_delta, |
90 | v4l2_check_dv_timings_fnc fnc, | 100 | v4l2_check_dv_timings_fnc fnc, |
91 | void *fnc_handle); | 101 | void *fnc_handle); |
92 | 102 | ||
93 | /** v4l2_match_dv_timings() - do two timings match? | 103 | /** |
94 | * @measured: the measured timings data. | 104 | * v4l2_match_dv_timings() - do two timings match? |
95 | * @standard: the timings according to the standard. | 105 | * |
96 | * @pclock_delta: maximum delta in Hz between standard->pixelclock and | 106 | * @measured: the measured timings data. |
97 | * the measured timings. | 107 | * @standard: the timings according to the standard. |
98 | * | 108 | * @pclock_delta: maximum delta in Hz between standard->pixelclock and |
99 | * Returns true if the two timings match, returns false otherwise. | 109 | * the measured timings. |
100 | */ | 110 | * |
111 | * Returns true if the two timings match, returns false otherwise. | ||
112 | */ | ||
101 | bool v4l2_match_dv_timings(const struct v4l2_dv_timings *measured, | 113 | bool v4l2_match_dv_timings(const struct v4l2_dv_timings *measured, |
102 | const struct v4l2_dv_timings *standard, | 114 | const struct v4l2_dv_timings *standard, |
103 | unsigned pclock_delta); | 115 | unsigned pclock_delta); |
104 | 116 | ||
105 | /** v4l2_print_dv_timings() - log the contents of a dv_timings struct | 117 | /** |
106 | * @dev_prefix:device prefix for each log line. | 118 | * v4l2_print_dv_timings() - log the contents of a dv_timings struct |
107 | * @prefix: additional prefix for each log line, may be NULL. | 119 | * @dev_prefix:device prefix for each log line. |
108 | * @t: the timings data. | 120 | * @prefix: additional prefix for each log line, may be NULL. |
109 | * @detailed: if true, give a detailed log. | 121 | * @t: the timings data. |
110 | */ | 122 | * @detailed: if true, give a detailed log. |
123 | */ | ||
111 | void v4l2_print_dv_timings(const char *dev_prefix, const char *prefix, | 124 | void v4l2_print_dv_timings(const char *dev_prefix, const char *prefix, |
112 | const struct v4l2_dv_timings *t, bool detailed); | 125 | const struct v4l2_dv_timings *t, bool detailed); |
113 | 126 | ||
114 | /** v4l2_detect_cvt - detect if the given timings follow the CVT standard | 127 | /** |
128 | * v4l2_detect_cvt - detect if the given timings follow the CVT standard | ||
129 | * | ||
115 | * @frame_height - the total height of the frame (including blanking) in lines. | 130 | * @frame_height - the total height of the frame (including blanking) in lines. |
116 | * @hfreq - the horizontal frequency in Hz. | 131 | * @hfreq - the horizontal frequency in Hz. |
117 | * @vsync - the height of the vertical sync in lines. | 132 | * @vsync - the height of the vertical sync in lines. |
133 | * @active_width - active width of image (does not include blanking). This | ||
134 | * information is needed only in case of version 2 of reduced blanking. | ||
135 | * In other cases, this parameter does not have any effect on timings. | ||
118 | * @polarities - the horizontal and vertical polarities (same as struct | 136 | * @polarities - the horizontal and vertical polarities (same as struct |
119 | * v4l2_bt_timings polarities). | 137 | * v4l2_bt_timings polarities). |
120 | * @interlaced - if this flag is true, it indicates interlaced format | 138 | * @interlaced - if this flag is true, it indicates interlaced format |
@@ -125,9 +143,12 @@ void v4l2_print_dv_timings(const char *dev_prefix, const char *prefix, | |||
125 | * in with the found CVT timings. | 143 | * in with the found CVT timings. |
126 | */ | 144 | */ |
127 | bool v4l2_detect_cvt(unsigned frame_height, unsigned hfreq, unsigned vsync, | 145 | bool v4l2_detect_cvt(unsigned frame_height, unsigned hfreq, unsigned vsync, |
128 | u32 polarities, bool interlaced, struct v4l2_dv_timings *fmt); | 146 | unsigned active_width, u32 polarities, bool interlaced, |
147 | struct v4l2_dv_timings *fmt); | ||
129 | 148 | ||
130 | /** v4l2_detect_gtf - detect if the given timings follow the GTF standard | 149 | /** |
150 | * v4l2_detect_gtf - detect if the given timings follow the GTF standard | ||
151 | * | ||
131 | * @frame_height - the total height of the frame (including blanking) in lines. | 152 | * @frame_height - the total height of the frame (including blanking) in lines. |
132 | * @hfreq - the horizontal frequency in Hz. | 153 | * @hfreq - the horizontal frequency in Hz. |
133 | * @vsync - the height of the vertical sync in lines. | 154 | * @vsync - the height of the vertical sync in lines. |
@@ -149,8 +170,10 @@ bool v4l2_detect_gtf(unsigned frame_height, unsigned hfreq, unsigned vsync, | |||
149 | u32 polarities, bool interlaced, struct v4l2_fract aspect, | 170 | u32 polarities, bool interlaced, struct v4l2_fract aspect, |
150 | struct v4l2_dv_timings *fmt); | 171 | struct v4l2_dv_timings *fmt); |
151 | 172 | ||
152 | /** v4l2_calc_aspect_ratio - calculate the aspect ratio based on bytes | 173 | /** |
174 | * v4l2_calc_aspect_ratio - calculate the aspect ratio based on bytes | ||
153 | * 0x15 and 0x16 from the EDID. | 175 | * 0x15 and 0x16 from the EDID. |
176 | * | ||
154 | * @hor_landscape - byte 0x15 from the EDID. | 177 | * @hor_landscape - byte 0x15 from the EDID. |
155 | * @vert_portrait - byte 0x16 from the EDID. | 178 | * @vert_portrait - byte 0x16 from the EDID. |
156 | * | 179 | * |