[media] cx88: implemented luma notch filter control
authoristvan_v@mailbox.hu <istvan_v@mailbox.hu>
Mon, 11 Jul 2011 14:07:43 +0000 (11:07 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 27 Jul 2011 20:56:01 +0000 (17:56 -0300)
The following patch adds a new control that makes it possible to set the
luma notch filter type to finetune picture quality.

Signed-off-by: Istvan Varga <istvan_v@mailbox.hu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/cx88/cx88-core.c
drivers/media/video/cx88/cx88-video.c

index 20ad809568cf757342f4f23077f434cb98317b76..fbcaa1c5b09da7b43b7f54024a56c4ba7297e55f 100644 (file)
@@ -636,6 +636,9 @@ int cx88_reset(struct cx88_core *core)
        cx_write(MO_PCI_INTSTAT,   0xFFFFFFFF); // Clear PCI int
        cx_write(MO_INT1_STAT,     0xFFFFFFFF); // Clear RISC int
 
+       /* set default notch filter */
+       cx_andor(MO_HTOTAL, 0x1800, (HLNotchFilter4xFsc << 11));
+
        /* Reset on-board parts */
        cx_write(MO_SRST_IO, 0);
        msleep(10);
@@ -994,10 +997,10 @@ int cx88_set_tvnorm(struct cx88_core *core, v4l2_std_id norm)
        // htotal
        tmp64 = norm_htotal(norm) * (u64)vdec_clock;
        do_div(tmp64, fsc8);
-       htotal = (u32)tmp64 | (HLNotchFilter4xFsc << 11);
+       htotal = (u32)tmp64;
        dprintk(1,"set_tvnorm: MO_HTOTAL        0x%08x [old=0x%08x,htotal=%d]\n",
                htotal, cx_read(MO_HTOTAL), (u32)tmp64);
-       cx_write(MO_HTOTAL, htotal);
+       cx_andor(MO_HTOTAL, 0x07ff, htotal);
 
        // vbi stuff, set vbi offset to 10 (for 20 Clk*2 pixels), this makes
        // the effective vbi offset ~244 samples, the same as the Bt8x8
index 516aa6ec1e826650531f145ffa24edb01991c337..60d28fdd77911c286a1d9ec365aa37e976f5cdee 100644 (file)
@@ -261,6 +261,20 @@ static const struct cx88_ctrl cx8800_ctls[] = {
                .reg                   = MO_INPUT_FORMAT,
                .mask                  = 1 << 9,
                .shift                 = 9,
+       }, {
+               .v = {
+                       .id            = V4L2_CID_BAND_STOP_FILTER,
+                       .name          = "Notch filter",
+                       .minimum       = 0,
+                       .maximum       = 3,
+                       .step          = 1,
+                       .default_value = 0x0,
+                       .type          = V4L2_CTRL_TYPE_INTEGER,
+               },
+               .off                   = 0,
+               .reg                   = MO_HTOTAL,
+               .mask                  = 3 << 11,
+               .shift                 = 11,
        }, {
        /* --- audio --- */
                .v = {
@@ -320,6 +334,7 @@ const u32 cx88_user_ctrls[] = {
        V4L2_CID_SHARPNESS,
        V4L2_CID_CHROMA_AGC,
        V4L2_CID_COLOR_KILLER,
+       V4L2_CID_BAND_STOP_FILTER,
        0
 };
 EXPORT_SYMBOL(cx88_user_ctrls);