]> err.no Git - linux-2.6/blobdiff - drivers/media/video/cx18/cx18-av-vbi.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb
[linux-2.6] / drivers / media / video / cx18 / cx18-av-vbi.c
index d09f1daf4ebff978c3cb5401d912aa584542556e..02fdf57bb678f1faf5ed0f1671ee435bd1db252b 100644 (file)
@@ -83,150 +83,6 @@ static int decode_vps(u8 *dst, u8 *p)
        return err & 0xf0;
 }
 
-void cx18_av_vbi_setup(struct cx18 *cx)
-{
-       struct cx18_av_state *state = &cx->av_state;
-       v4l2_std_id std = state->std;
-       int hblank, hactive, burst, vblank, vactive, sc;
-       int vblank656, src_decimation;
-       int luma_lpf, uv_lpf, comb;
-       u32 pll_int, pll_frac, pll_post;
-
-       /* datasheet startup, step 8d */
-       if (std & ~V4L2_STD_NTSC)
-               cx18_av_write(cx, 0x49f, 0x11);
-       else
-               cx18_av_write(cx, 0x49f, 0x14);
-
-       if (std & V4L2_STD_625_50) {
-               hblank = 0x084;
-               hactive = 0x2d0;
-               burst = 0x5d;
-               vblank = 0x024;
-               vactive = 0x244;
-               vblank656 = 0x28;
-               src_decimation = 0x21f;
-
-               luma_lpf = 2;
-               if (std & V4L2_STD_SECAM) {
-                       uv_lpf = 0;
-                       comb = 0;
-                       sc = 0x0a425f;
-               } else if (std == V4L2_STD_PAL_Nc) {
-                       uv_lpf = 1;
-                       comb = 0x20;
-                       sc = 556453;
-               } else {
-                       uv_lpf = 1;
-                       comb = 0x20;
-                       sc = 0x0a8263;
-               }
-       } else {
-               hactive = 720;
-               hblank = 122;
-               vactive = 487;
-               luma_lpf = 1;
-               uv_lpf = 1;
-
-               src_decimation = 0x21f;
-               if (std == V4L2_STD_PAL_60) {
-                       vblank = 26;
-                       vblank656 = 26;
-                       burst = 0x5b;
-                       luma_lpf = 2;
-                       comb = 0x20;
-                       sc = 0x0a8263;
-               } else if (std == V4L2_STD_PAL_M) {
-                       vblank = 20;
-                       vblank656 = 24;
-                       burst = 0x61;
-                       comb = 0x20;
-
-                       sc = 555452;
-               } else {
-                       vblank = 26;
-                       vblank656 = 26;
-                       burst = 0x5b;
-                       comb = 0x66;
-                       sc = 556063;
-               }
-       }
-
-       /* DEBUG: Displays configured PLL frequency */
-       pll_int = cx18_av_read(cx, 0x108);
-       pll_frac = cx18_av_read4(cx, 0x10c) & 0x1ffffff;
-       pll_post = cx18_av_read(cx, 0x109);
-       CX18_DEBUG_INFO("PLL regs = int: %u, frac: %u, post: %u\n",
-                       pll_int, pll_frac, pll_post);
-
-       if (pll_post) {
-               int fin, fsc;
-               int pll = 28636363L * ((((u64)pll_int) << 25) + pll_frac);
-
-               pll >>= 25;
-               pll /= pll_post;
-               CX18_DEBUG_INFO("PLL = %d.%06d MHz\n",
-                                       pll / 1000000, pll % 1000000);
-               CX18_DEBUG_INFO("PLL/8 = %d.%06d MHz\n",
-                                       pll / 8000000, (pll / 8) % 1000000);
-
-               fin = ((u64)src_decimation * pll) >> 12;
-               CX18_DEBUG_INFO("ADC Sampling freq = %d.%06d MHz\n",
-                                       fin / 1000000, fin % 1000000);
-
-               fsc = (((u64)sc) * pll) >> 24L;
-               CX18_DEBUG_INFO("Chroma sub-carrier freq = %d.%06d MHz\n",
-                                       fsc / 1000000, fsc % 1000000);
-
-               CX18_DEBUG_INFO("hblank %i, hactive %i, "
-                       "vblank %i , vactive %i, vblank656 %i, src_dec %i,"
-                       "burst 0x%02x, luma_lpf %i, uv_lpf %i, comb 0x%02x,"
-                       " sc 0x%06x\n",
-                       hblank, hactive, vblank, vactive, vblank656,
-                       src_decimation, burst, luma_lpf, uv_lpf, comb, sc);
-       }
-
-       /* Sets horizontal blanking delay and active lines */
-       cx18_av_write(cx, 0x470, hblank);
-       cx18_av_write(cx, 0x471, 0xff & (((hblank >> 8) & 0x3) |
-                                               (hactive << 4)));
-       cx18_av_write(cx, 0x472, hactive >> 4);
-
-       /* Sets burst gate delay */
-       cx18_av_write(cx, 0x473, burst);
-
-       /* Sets vertical blanking delay and active duration */
-       cx18_av_write(cx, 0x474, vblank);
-       cx18_av_write(cx, 0x475, 0xff & (((vblank >> 8) & 0x3) |
-                                               (vactive << 4)));
-       cx18_av_write(cx, 0x476, vactive >> 4);
-       cx18_av_write(cx, 0x477, vblank656);
-
-       /* Sets src decimation rate */
-       cx18_av_write(cx, 0x478, 0xff & src_decimation);
-       cx18_av_write(cx, 0x479, 0xff & (src_decimation >> 8));
-
-       /* Sets Luma and UV Low pass filters */
-       cx18_av_write(cx, 0x47a, luma_lpf << 6 | ((uv_lpf << 4) & 0x30));
-
-       /* Enables comb filters */
-       cx18_av_write(cx, 0x47b, comb);
-
-       /* Sets SC Step*/
-       cx18_av_write(cx, 0x47c, sc);
-       cx18_av_write(cx, 0x47d, 0xff & sc >> 8);
-       cx18_av_write(cx, 0x47e, 0xff & sc >> 16);
-
-       /* Sets VBI parameters */
-       if (std & V4L2_STD_625_50) {
-               cx18_av_write(cx, 0x47f, 0x01);
-               state->vbi_line_offset = 5;
-       } else {
-               cx18_av_write(cx, 0x47f, 0x00);
-               state->vbi_line_offset = 8;
-       }
-}
-
 int cx18_av_vbi(struct cx18 *cx, unsigned int cmd, void *arg)
 {
        struct cx18_av_state *state = &cx->av_state;
@@ -292,8 +148,8 @@ int cx18_av_vbi(struct cx18 *cx, unsigned int cmd, void *arg)
                        /* raw VBI */
                        memset(svbi, 0, sizeof(*svbi));
 
-                       /* Setup VBI */
-                       cx18_av_vbi_setup(cx);
+                       /* Setup standard */
+                       cx18_av_std_setup(cx);
 
                        /* VBI Offset */
                        cx18_av_write(cx, 0x47f, vbi_offset);
@@ -304,8 +160,8 @@ int cx18_av_vbi(struct cx18 *cx, unsigned int cmd, void *arg)
                for (x = 0; x <= 23; x++)
                        lcr[x] = 0x00;
 
-               /* Setup VBI */
-               cx18_av_vbi_setup(cx);
+               /* Setup standard */
+               cx18_av_std_setup(cx);
 
                /* Sliced VBI */
                cx18_av_write(cx, 0x404, 0x32); /* Ancillary data */