Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Prashant Laddha and committed by
Mauro Carvalho Chehab
227da85e 4366dfef

+6 -3
+6 -3
drivers/media/v4l2-core/v4l2-dv-timings.c
··· 256 256 { 257 257 const struct v4l2_bt_timings *bt = &t->bt; 258 258 u32 htot, vtot; 259 + u32 fps; 259 260 260 261 if (t->type != V4L2_DV_BT_656_1120) 261 262 return; ··· 266 265 if (bt->interlaced) 267 266 vtot /= 2; 268 267 268 + fps = (htot * vtot) > 0 ? div_u64((100 * (u64)bt->pixelclock), 269 + (htot * vtot)) : 0; 270 + 269 271 if (prefix == NULL) 270 272 prefix = ""; 271 273 272 - pr_info("%s: %s%ux%u%s%u (%ux%u)\n", dev_prefix, prefix, 274 + pr_info("%s: %s%ux%u%s%u.%u (%ux%u)\n", dev_prefix, prefix, 273 275 bt->width, bt->height, bt->interlaced ? "i" : "p", 274 - (htot * vtot) > 0 ? ((u32)bt->pixelclock / (htot * vtot)) : 0, 275 - htot, vtot); 276 + fps / 100, fps % 100, htot, vtot); 276 277 277 278 if (!detailed) 278 279 return;