]> err.no Git - linux-2.6/blobdiff - drivers/media/video/cx18/cx18-driver.c
V4L/DVB (8167): cx18: set correct audio inputs for tuner and line-in 2.
[linux-2.6] / drivers / media / video / cx18 / cx18-driver.c
index 0dd4e05299706f83171de37a47ea801fbf8939b9..2f4909a325402fb3442008a1c137caa76f185c07 100644 (file)
@@ -120,6 +120,7 @@ MODULE_PARM_DESC(cardtype,
                 "\t\t\t 2 = Hauppauge HVR 1600 (Samsung memory)\n"
                 "\t\t\t 3 = Compro VideoMate H900\n"
                 "\t\t\t 4 = Yuan MPC718\n"
+                "\t\t\t 5 = Conexant Raptor PAL/SECAM\n"
                 "\t\t\t 0 = Autodetect (default)\n"
                 "\t\t\t-1 = Ignore this card\n\t\t");
 MODULE_PARM_DESC(pal, "Set PAL standard: B, G, H, D, K, I, M, N, Nc, 60");
@@ -435,7 +436,7 @@ static int __devinit cx18_init_struct1(struct cx18 *cx)
                (cx->params.video_temporal_filter_mode << 1) |
                (cx->params.video_median_filter_type << 2);
        cx->params.port = CX2341X_PORT_MEMORY;
-       cx->params.capabilities = CX2341X_CAP_HAS_SLICED_VBI;
+       cx->params.capabilities = 0;
        init_waitqueue_head(&cx->cap_w);
        init_waitqueue_head(&cx->mb_apu_waitq);
        init_waitqueue_head(&cx->mb_cpu_waitq);
@@ -614,7 +615,7 @@ static int __devinit cx18_probe(struct pci_dev *dev,
        cx18_cards[cx18_cards_active] = cx;
        cx->dev = dev;
        cx->num = cx18_cards_active++;
-       snprintf(cx->name, sizeof(cx->name) - 1, "cx18-%d", cx->num);
+       snprintf(cx->name, sizeof(cx->name), "cx18-%d", cx->num);
        CX18_INFO("Initializing card #%d\n", cx->num);
 
        spin_unlock(&cx18_cards_lock);
@@ -670,7 +671,7 @@ static int __devinit cx18_probe(struct pci_dev *dev,
        cx18_init_power(cx, 1);
        cx18_init_memory(cx);
 
-       cx->scb = (struct cx18_scb *)(cx->enc_mem + SCB_OFFSET);
+       cx->scb = (struct cx18_scb __iomem *)(cx->enc_mem + SCB_OFFSET);
        cx18_init_scb(cx);
 
        cx18_gpio_init(cx);
@@ -721,6 +722,12 @@ static int __devinit cx18_probe(struct pci_dev *dev,
        /* if no tuner was found, then pick the first tuner in the card list */
        if (cx->options.tuner == -1 && cx->card->tuners[0].std) {
                cx->std = cx->card->tuners[0].std;
+               if (cx->std & V4L2_STD_PAL)
+                       cx->std = V4L2_STD_PAL_BG | V4L2_STD_PAL_H;
+               else if (cx->std & V4L2_STD_NTSC)
+                       cx->std = V4L2_STD_NTSC_M;
+               else if (cx->std & V4L2_STD_SECAM)
+                       cx->std = V4L2_STD_SECAM_L;
                cx->options.tuner = cx->card->tuners[0].tuner;
        }
        if (cx->options.radio == -1)
@@ -751,17 +758,6 @@ static int __devinit cx18_probe(struct pci_dev *dev,
        if (cx->options.radio > 0)
                cx->v4l2_cap |= V4L2_CAP_RADIO;
 
-       retval = cx18_streams_setup(cx);
-       if (retval) {
-               CX18_ERR("Error %d setting up streams\n", retval);
-               goto free_irq;
-       }
-       retval = cx18_streams_register(cx);
-       if (retval) {
-               CX18_ERR("Error %d registering devices\n", retval);
-               goto free_streams;
-       }
-
        if (cx->options.tuner > -1) {
                struct tuner_setup setup;
 
@@ -788,7 +784,16 @@ static int __devinit cx18_probe(struct pci_dev *dev,
           are not. */
        cx->tuner_std = cx->std;
 
-       cx18_init_on_first_open(cx);
+       retval = cx18_streams_setup(cx);
+       if (retval) {
+               CX18_ERR("Error %d setting up streams\n", retval);
+               goto free_irq;
+       }
+       retval = cx18_streams_register(cx);
+       if (retval) {
+               CX18_ERR("Error %d registering devices\n", retval);
+               goto free_streams;
+       }
 
        CX18_INFO("Initialized card #%d: %s\n", cx->num, cx->card_name);
 
@@ -820,6 +825,9 @@ int cx18_init_on_first_open(struct cx18 *cx)
        int video_input;
        int fw_retry_count = 3;
        struct v4l2_frequency vf;
+       struct cx18_open_id fh;
+
+       fh.cx = cx;
 
        if (test_bit(CX18_F_I_FAILED, &cx->i_flags))
                return -ENXIO;
@@ -871,13 +879,13 @@ int cx18_init_on_first_open(struct cx18 *cx)
 
        video_input = cx->active_input;
        cx->active_input++;     /* Force update of input */
-       cx18_v4l2_ioctls(cx, NULL, VIDIOC_S_INPUT, &video_input);
+       cx18_s_input(NULL, &fh, video_input);
 
        /* Let the VIDIOC_S_STD ioctl do all the work, keeps the code
           in one place. */
        cx->std++;              /* Force full standard initialization */
-       cx18_v4l2_ioctls(cx, NULL, VIDIOC_S_STD, &cx->tuner_std);
-       cx18_v4l2_ioctls(cx, NULL, VIDIOC_S_FREQUENCY, &vf);
+       cx18_s_std(NULL, &fh, &cx->tuner_std);
+       cx18_s_frequency(NULL, &fh, &vf);
        return 0;
 }
 
@@ -889,7 +897,7 @@ static void cx18_remove(struct pci_dev *pci_dev)
 
        /* Stop all captures */
        CX18_DEBUG_INFO("Stopping all streams\n");
-       if (atomic_read(&cx->capturing) > 0)
+       if (atomic_read(&cx->tot_capturing) > 0)
                cx18_stop_all_captures(cx);
 
        /* Interrupts */