diff options
| author | Hans Verkuil <hans.verkuil@cisco.com> | 2013-08-15 07:02:40 -0400 |
|---|---|---|
| committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2013-08-24 03:26:05 -0400 |
| commit | 0216dc2fe666b5cedba54df4c0be6ddc8eb352e1 (patch) | |
| tree | 3a6c54c2ab4d66ff1ebcb401a7f19c8546e5d3f2 | |
| parent | f3b33ede51903e6cc211d9f0bdecc65646b71f17 (diff) | |
[media] v4l2-dv-timings: add v4l2_print_dv_timings helper
Drivers often have to log the contents of a dv_timings struct. Adding
this helper will make it easier for drivers to do so.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
| -rw-r--r-- | drivers/media/v4l2-core/v4l2-dv-timings.c | 49 | ||||
| -rw-r--r-- | include/media/v4l2-dv-timings.h | 9 |
2 files changed, 58 insertions, 0 deletions
diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c b/drivers/media/v4l2-core/v4l2-dv-timings.c index 72cf2240bac4..917e58ce1f18 100644 --- a/drivers/media/v4l2-core/v4l2-dv-timings.c +++ b/drivers/media/v4l2-core/v4l2-dv-timings.c | |||
| @@ -223,6 +223,55 @@ bool v4l_match_dv_timings(const struct v4l2_dv_timings *t1, | |||
| 223 | } | 223 | } |
| 224 | EXPORT_SYMBOL_GPL(v4l_match_dv_timings); | 224 | EXPORT_SYMBOL_GPL(v4l_match_dv_timings); |
| 225 | 225 | ||
| 226 | void v4l2_print_dv_timings(const char *dev_prefix, const char *prefix, | ||
| 227 | const struct v4l2_dv_timings *t, bool detailed) | ||
| 228 | { | ||
| 229 | const struct v4l2_bt_timings *bt = &t->bt; | ||
| 230 | u32 htot, vtot; | ||
| 231 | |||
| 232 | if (t->type != V4L2_DV_BT_656_1120) | ||
| 233 | return; | ||
| 234 | |||
| 235 | htot = V4L2_DV_BT_FRAME_WIDTH(bt); | ||
| 236 | vtot = V4L2_DV_BT_FRAME_HEIGHT(bt); | ||
| 237 | |||
| 238 | if (prefix == NULL) | ||
| 239 | prefix = ""; | ||
| 240 | |||
| 241 | pr_info("%s: %s%ux%u%s%u (%ux%u)\n", dev_prefix, prefix, | ||
| 242 | bt->width, bt->height, bt->interlaced ? "i" : "p", | ||
| 243 | (htot * vtot) > 0 ? ((u32)bt->pixelclock / (htot * vtot)) : 0, | ||
| 244 | htot, vtot); | ||
| 245 | |||
| 246 | if (!detailed) | ||
| 247 | return; | ||
| 248 | |||
| 249 | pr_info("%s: horizontal: fp = %u, %ssync = %u, bp = %u\n", | ||
| 250 | dev_prefix, bt->hfrontporch, | ||
| 251 | (bt->polarities & V4L2_DV_HSYNC_POS_POL) ? "+" : "-", | ||
| 252 | bt->hsync, bt->hbackporch); | ||
| 253 | pr_info("%s: vertical: fp = %u, %ssync = %u, bp = %u\n", | ||
| 254 | dev_prefix, bt->vfrontporch, | ||
| 255 | (bt->polarities & V4L2_DV_VSYNC_POS_POL) ? "+" : "-", | ||
| 256 | bt->vsync, bt->vbackporch); | ||
| 257 | pr_info("%s: pixelclock: %llu\n", dev_prefix, bt->pixelclock); | ||
| 258 | pr_info("%s: flags (0x%x):%s%s%s%s\n", dev_prefix, bt->flags, | ||
| 259 | (bt->flags & V4L2_DV_FL_REDUCED_BLANKING) ? | ||
| 260 | " REDUCED_BLANKING" : "", | ||
| 261 | (bt->flags & V4L2_DV_FL_CAN_REDUCE_FPS) ? | ||
| 262 | " CAN_REDUCE_FPS" : "", | ||
| 263 | (bt->flags & V4L2_DV_FL_REDUCED_FPS) ? | ||
| 264 | " REDUCED_FPS" : "", | ||
| 265 | (bt->flags & V4L2_DV_FL_HALF_LINE) ? | ||
| 266 | " HALF_LINE" : ""); | ||
| 267 | pr_info("%s: standards (0x%x):%s%s%s%s\n", dev_prefix, bt->standards, | ||
| 268 | (bt->standards & V4L2_DV_BT_STD_CEA861) ? " CEA" : "", | ||
| 269 | (bt->standards & V4L2_DV_BT_STD_DMT) ? " DMT" : "", | ||
| 270 | (bt->standards & V4L2_DV_BT_STD_CVT) ? " CVT" : "", | ||
| 271 | (bt->standards & V4L2_DV_BT_STD_GTF) ? " GTF" : ""); | ||
| 272 | } | ||
| 273 | EXPORT_SYMBOL_GPL(v4l2_print_dv_timings); | ||
| 274 | |||
| 226 | /* | 275 | /* |
| 227 | * CVT defines | 276 | * CVT defines |
| 228 | * Based on Coordinated Video Timings Standard | 277 | * Based on Coordinated Video Timings Standard |
diff --git a/include/media/v4l2-dv-timings.h b/include/media/v4l2-dv-timings.h index 4c7bb5491658..696e5c2fd176 100644 --- a/include/media/v4l2-dv-timings.h +++ b/include/media/v4l2-dv-timings.h | |||
| @@ -76,6 +76,15 @@ bool v4l_match_dv_timings(const struct v4l2_dv_timings *measured, | |||
| 76 | const struct v4l2_dv_timings *standard, | 76 | const struct v4l2_dv_timings *standard, |
| 77 | unsigned pclock_delta); | 77 | unsigned pclock_delta); |
| 78 | 78 | ||
| 79 | /** v4l2_print_dv_timings() - log the contents of a dv_timings struct | ||
| 80 | * @dev_prefix:device prefix for each log line. | ||
| 81 | * @prefix: additional prefix for each log line, may be NULL. | ||
| 82 | * @t: the timings data. | ||
| 83 | * @detailed: if true, give a detailed log. | ||
| 84 | */ | ||
| 85 | void v4l2_print_dv_timings(const char *dev_prefix, const char *prefix, | ||
| 86 | const struct v4l2_dv_timings *t, bool detailed); | ||
| 87 | |||
| 79 | /** v4l2_detect_cvt - detect if the given timings follow the CVT standard | 88 | /** 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. | 89 | * @frame_height - the total height of the frame (including blanking) in lines. |
| 81 | * @hfreq - the horizontal frequency in Hz. | 90 | * @hfreq - the horizontal frequency in Hz. |
