[RFC PATCH 3/8] v4l2: move dv-timings related code to v4l2-dv-timings.c

2013-07-29 Thread Hans Verkuil
From: Hans Verkuil 

v4l2-common.c contained a bunch of dv-timings related functions.
Move that to the new v4l2-dv-timings.c which is a more appropriate
place for them.

There aren't many drivers that do HDTV, so it is a good idea to separate
common code related to that into a module of its own.

Signed-off-by: Hans Verkuil 
---
 drivers/media/i2c/ad9389b.c   |   1 +
 drivers/media/i2c/adv7604.c   |   1 +
 drivers/media/i2c/ths8200.c   |   1 +
 drivers/media/usb/hdpvr/hdpvr-video.c |   1 +
 drivers/media/v4l2-core/v4l2-common.c | 357 -
 drivers/media/v4l2-core/v4l2-dv-timings.c | 358 +-
 include/media/v4l2-common.h   |  13 --
 include/media/v4l2-dv-timings.h   |  59 +
 8 files changed, 420 insertions(+), 371 deletions(-)

diff --git a/drivers/media/i2c/ad9389b.c b/drivers/media/i2c/ad9389b.c
index ba4364d..2fa8d72 100644
--- a/drivers/media/i2c/ad9389b.c
+++ b/drivers/media/i2c/ad9389b.c
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 1d675b5..181a6c3 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -38,6 +38,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 static int debug;
diff --git a/drivers/media/i2c/ths8200.c b/drivers/media/i2c/ths8200.c
index 8a29810..aef7c0e 100644
--- a/drivers/media/i2c/ths8200.c
+++ b/drivers/media/i2c/ths8200.c
@@ -21,6 +21,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 
diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c 
b/drivers/media/usb/hdpvr/hdpvr-video.c
index 4f8567a..9c67b6e 100644
--- a/drivers/media/usb/hdpvr/hdpvr-video.c
+++ b/drivers/media/usb/hdpvr/hdpvr-video.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include "hdpvr.h"
diff --git a/drivers/media/v4l2-core/v4l2-common.c 
b/drivers/media/v4l2-core/v4l2-common.c
index a95e5e2..037d7a5 100644
--- a/drivers/media/v4l2-core/v4l2-common.c
+++ b/drivers/media/v4l2-core/v4l2-common.c
@@ -495,363 +495,6 @@ void v4l_bound_align_image(u32 *w, unsigned int wmin, 
unsigned int wmax,
 }
 EXPORT_SYMBOL_GPL(v4l_bound_align_image);
 
-/**
- * v4l_match_dv_timings - check if two timings match
- * @t1 - compare this v4l2_dv_timings struct...
- * @t2 - with this struct.
- * @pclock_delta - the allowed pixelclock deviation.
- *
- * Compare t1 with t2 with a given margin of error for the pixelclock.
- */
-bool v4l_match_dv_timings(const struct v4l2_dv_timings *t1,
- const struct v4l2_dv_timings *t2,
- unsigned pclock_delta)
-{
-   if (t1->type != t2->type || t1->type != V4L2_DV_BT_656_1120)
-   return false;
-   if (t1->bt.width == t2->bt.width &&
-   t1->bt.height == t2->bt.height &&
-   t1->bt.interlaced == t2->bt.interlaced &&
-   t1->bt.polarities == t2->bt.polarities &&
-   t1->bt.pixelclock >= t2->bt.pixelclock - pclock_delta &&
-   t1->bt.pixelclock <= t2->bt.pixelclock + pclock_delta &&
-   t1->bt.hfrontporch == t2->bt.hfrontporch &&
-   t1->bt.vfrontporch == t2->bt.vfrontporch &&
-   t1->bt.vsync == t2->bt.vsync &&
-   t1->bt.vbackporch == t2->bt.vbackporch &&
-   (!t1->bt.interlaced ||
-   (t1->bt.il_vfrontporch == t2->bt.il_vfrontporch &&
-t1->bt.il_vsync == t2->bt.il_vsync &&
-t1->bt.il_vbackporch == t2->bt.il_vbackporch)))
-   return true;
-   return false;
-}
-EXPORT_SYMBOL_GPL(v4l_match_dv_timings);
-
-/*
- * CVT defines
- * Based on Coordinated Video Timings Standard
- * version 1.1 September 10, 2003
- */
-
-#define CVT_PXL_CLK_GRAN   25  /* pixel clock granularity */
-
-/* Normal blanking */
-#define CVT_MIN_V_BPORCH   7   /* lines */
-#define CVT_MIN_V_PORCH_RND3   /* lines */
-#define CVT_MIN_VSYNC_BP   550 /* min time of vsync + back porch (us) 
*/
-
-/* Normal blanking for CVT uses GTF to calculate horizontal blanking */
-#define CVT_CELL_GRAN  8   /* character cell granularity */
-#define CVT_M  600 /* blanking formula gradient */
-#define CVT_C  40  /* blanking formula offset */
-#define CVT_K  128 /* blanking formula scaling factor */
-#define CVT_J  20  /* blanking formula scaling factor */
-#define CVT_C_PRIME (((CVT_C - CVT_J) * CVT_K / 256) + CVT_J)
-#define CVT_M_PRIME (CVT_K * CVT_M / 256)
-
-/* Reduced Blanking */
-#define CVT_RB_MIN_V_BPORCH7   /* lines  */
-#define CVT_RB_V_FPORCH3   /* lines  */
-#define CVT_RB_MIN_V_BLANK   460 /* us */
-#define CVT_RB_H_SYNC 32   /* pixels */
-#define CVT_RB_H_BPORCH   80   /* pixels */
-#define CVT_RB_H_BLANK   160   /* pixels */
-
-/** v4l2_dete

Re: [RFC PATCH 3/8] v4l2: move dv-timings related code to v4l2-dv-timings.c

2013-08-04 Thread Prabhakar Lad
Hi Hans,

Thanks for the patch.

On Mon, Jul 29, 2013 at 6:10 PM, Hans Verkuil  wrote:
> From: Hans Verkuil 
>
> v4l2-common.c contained a bunch of dv-timings related functions.
> Move that to the new v4l2-dv-timings.c which is a more appropriate
> place for them.
>
> There aren't many drivers that do HDTV, so it is a good idea to separate
> common code related to that into a module of its own.
>
> Signed-off-by: Hans Verkuil 

Acked-by: Lad, Prabhakar 

Regards,
--Prabhakar Lad
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html