summaryrefslogtreecommitdiffstats
path: root/drivers/media/v4l2-core/v4l2-dv-timings.c
diff options
context:
space:
mode:
authorPrashant Laddha2015-06-12 13:48:10 +0200
committerMauro Carvalho Chehab2015-07-06 13:25:53 +0200
commit227da85e775065c81e222f443e8379aba4d3f668 (patch)
tree99f9cc1ac3172d8c3aef852e92097decd6683c8f /drivers/media/v4l2-core/v4l2-dv-timings.c
parent[media] media/v4l2-ctrls: Code cleanout validate_new() (diff)
downloadkernel-qcow2-linux-227da85e775065c81e222f443e8379aba4d3f668.tar.gz
kernel-qcow2-linux-227da85e775065c81e222f443e8379aba4d3f668.tar.xz
kernel-qcow2-linux-227da85e775065c81e222f443e8379aba4d3f668.zip
[media] v4l2-dv-timings: print refresh rate with better precision
In many cases, refresh rate is not exact integer. In such cases, fraction was lost and it used to print, say, 59 in case of 59.94. Now, capturing the fraction up to 2 decimal places. Signed-off-by: Prashant Laddha <prladdha@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/v4l2-core/v4l2-dv-timings.c')
-rw-r--r--drivers/media/v4l2-core/v4l2-dv-timings.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c b/drivers/media/v4l2-core/v4l2-dv-timings.c
index 2c7b9fdfa0af..6a83d6191684 100644
--- a/drivers/media/v4l2-core/v4l2-dv-timings.c
+++ b/drivers/media/v4l2-core/v4l2-dv-timings.c
@@ -256,6 +256,7 @@ void v4l2_print_dv_timings(const char *dev_prefix, const char *prefix,
{
const struct v4l2_bt_timings *bt = &t->bt;
u32 htot, vtot;
+ u32 fps;
if (t->type != V4L2_DV_BT_656_1120)
return;
@@ -265,13 +266,15 @@ void v4l2_print_dv_timings(const char *dev_prefix, const char *prefix,
if (bt->interlaced)
vtot /= 2;
+ fps = (htot * vtot) > 0 ? div_u64((100 * (u64)bt->pixelclock),
+ (htot * vtot)) : 0;
+
if (prefix == NULL)
prefix = "";
- pr_info("%s: %s%ux%u%s%u (%ux%u)\n", dev_prefix, prefix,
+ pr_info("%s: %s%ux%u%s%u.%u (%ux%u)\n", dev_prefix, prefix,
bt->width, bt->height, bt->interlaced ? "i" : "p",
- (htot * vtot) > 0 ? ((u32)bt->pixelclock / (htot * vtot)) : 0,
- htot, vtot);
+ fps / 100, fps % 100, htot, vtot);
if (!detailed)
return;