summaryrefslogtreecommitdiffstats
path: root/drivers/media/v4l2-core/v4l2-dv-timings.c
diff options
context:
space:
mode:
authorPrashant Laddha <prladdha@cisco.com>2015-04-22 19:32:37 +0200
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-05-01 12:15:38 +0200
commit9c3f205252f8ae2af9794d68bcbfc49fb0812ccf (patch)
tree666028cb369ccd6d0db108b855fef01791a9fa2d /drivers/media/v4l2-core/v4l2-dv-timings.c
parent[media] v4l2-dv-timings: add sanity checks in cvt,gtf calculations (diff)
downloadlinux-9c3f205252f8ae2af9794d68bcbfc49fb0812ccf.tar.xz
linux-9c3f205252f8ae2af9794d68bcbfc49fb0812ccf.zip
[media] v4l2-dv-timings: replace hsync magic number with a macro
This change will not change timing calculation. In CVT generator spreadsheet the nominal value of hsync (as a percentage of line) is 8 percent. Cc: Martin Bugge <marbugge@cisco.com> 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.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c b/drivers/media/v4l2-core/v4l2-dv-timings.c
index 4e09792038ed..37f0d6f89878 100644
--- a/drivers/media/v4l2-core/v4l2-dv-timings.c
+++ b/drivers/media/v4l2-core/v4l2-dv-timings.c
@@ -313,6 +313,7 @@ EXPORT_SYMBOL_GPL(v4l2_print_dv_timings);
#define CVT_MIN_V_BPORCH 7 /* lines */
#define CVT_MIN_V_PORCH_RND 3 /* lines */
#define CVT_MIN_VSYNC_BP 550 /* min time of vsync + back porch (us) */
+#define CVT_HSYNC_PERCENT 8 /* nominal hsync as percentage of line */
/* Normal blanking for CVT uses GTF to calculate horizontal blanking */
#define CVT_CELL_GRAN 8 /* character cell granularity */
@@ -442,7 +443,7 @@ bool v4l2_detect_cvt(unsigned frame_height, unsigned hfreq, unsigned vsync,
h_bp = h_blank / 2;
frame_width = image_width + h_blank;
- hsync = frame_width * 8 / 100;
+ hsync = frame_width * CVT_HSYNC_PERCENT / 100;
hsync = (hsync / CVT_CELL_GRAN) * CVT_CELL_GRAN;
h_fp = h_blank - hsync - h_bp;
}