~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/media/video/cx231xx/cx231xx-cards.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
261
261
                .agc_analog_digital_select_gpio = 0x1c,
262
262
                .gpio_pin_status_mask = 0x4001000,
263
263
                .norm = V4L2_STD_PAL,
 
264
                .no_alt_vanc = 1,
 
265
                .external_av = 1,
 
266
                .has_417 = 1,
264
267
 
265
268
                .input = {{
266
269
                                .type = CX231XX_VMUX_COMPOSITE1,
357
360
                        .type = CX231XX_VMUX_TELEVISION,
358
361
                        .vmux = CX231XX_VIN_3_1,
359
362
                        .amux = CX231XX_AMUX_VIDEO,
360
 
                        .gpio = 0,
 
363
                        .gpio = NULL,
361
364
                }, {
362
365
                        .type = CX231XX_VMUX_COMPOSITE1,
363
366
                        .vmux = CX231XX_VIN_2_1,
364
367
                        .amux = CX231XX_AMUX_LINE_IN,
365
 
                        .gpio = 0,
 
368
                        .gpio = NULL,
366
369
                }, {
367
370
                        .type = CX231XX_VMUX_SVIDEO,
368
371
                        .vmux = CX231XX_VIN_1_1 |
369
372
                                (CX231XX_VIN_1_2 << 8) |
370
373
                                CX25840_SVIDEO_ON,
371
374
                        .amux = CX231XX_AMUX_LINE_IN,
372
 
                        .gpio = 0,
 
375
                        .gpio = NULL,
373
376
                } },
374
377
        },
375
378
        [CX231XX_BOARD_HAUPPAUGE_USBLIVE2] = {
382
385
                .agc_analog_digital_select_gpio = 0x0c,
383
386
                .gpio_pin_status_mask = 0x4001000,
384
387
                .norm = V4L2_STD_NTSC,
385
 
                .input = {{
386
 
                        .type = CX231XX_VMUX_COMPOSITE1,
387
 
                        .vmux = CX231XX_VIN_2_1,
388
 
                        .amux = CX231XX_AMUX_LINE_IN,
389
 
                        .gpio = 0,
390
 
                }, {
391
 
                        .type = CX231XX_VMUX_SVIDEO,
392
 
                        .vmux = CX231XX_VIN_1_1 |
393
 
                                (CX231XX_VIN_1_2 << 8) |
394
 
                                CX25840_SVIDEO_ON,
395
 
                        .amux = CX231XX_AMUX_LINE_IN,
396
 
                        .gpio = 0,
 
388
                .no_alt_vanc = 1,
 
389
                .external_av = 1,
 
390
                .input = {{
 
391
                        .type = CX231XX_VMUX_COMPOSITE1,
 
392
                        .vmux = CX231XX_VIN_2_1,
 
393
                        .amux = CX231XX_AMUX_LINE_IN,
 
394
                        .gpio = NULL,
 
395
                }, {
 
396
                        .type = CX231XX_VMUX_SVIDEO,
 
397
                        .vmux = CX231XX_VIN_1_1 |
 
398
                                (CX231XX_VIN_1_2 << 8) |
 
399
                                CX25840_SVIDEO_ON,
 
400
                        .amux = CX231XX_AMUX_LINE_IN,
 
401
                        .gpio = NULL,
 
402
                } },
 
403
        },
 
404
        [CX231XX_BOARD_KWORLD_UB430_USB_HYBRID] = {
 
405
                .name = "Kworld UB430 USB Hybrid",
 
406
                .tuner_type = TUNER_NXP_TDA18271,
 
407
                .tuner_addr = 0x60,
 
408
                .decoder = CX231XX_AVDECODER,
 
409
                .output_mode = OUT_MODE_VIP11,
 
410
                .demod_xfer_mode = 0,
 
411
                .ctl_pin_status_mask = 0xFFFFFFC4,
 
412
                .agc_analog_digital_select_gpio = 0x11, /* According with PV cxPolaris.inf file */
 
413
                .tuner_sif_gpio = -1,
 
414
                .tuner_scl_gpio = -1,
 
415
                .tuner_sda_gpio = -1,
 
416
                .gpio_pin_status_mask = 0x4001000,
 
417
                .tuner_i2c_master = 2,
 
418
                .demod_i2c_master = 1,
 
419
                .ir_i2c_master = 2,
 
420
                .has_dvb = 1,
 
421
                .demod_addr = 0x10,
 
422
                .norm = V4L2_STD_PAL_M,
 
423
                .input = {{
 
424
                        .type = CX231XX_VMUX_TELEVISION,
 
425
                        .vmux = CX231XX_VIN_3_1,
 
426
                        .amux = CX231XX_AMUX_VIDEO,
 
427
                        .gpio = NULL,
 
428
                }, {
 
429
                        .type = CX231XX_VMUX_COMPOSITE1,
 
430
                        .vmux = CX231XX_VIN_2_1,
 
431
                        .amux = CX231XX_AMUX_LINE_IN,
 
432
                        .gpio = NULL,
 
433
                }, {
 
434
                        .type = CX231XX_VMUX_SVIDEO,
 
435
                        .vmux = CX231XX_VIN_1_1 |
 
436
                                (CX231XX_VIN_1_2 << 8) |
 
437
                                CX25840_SVIDEO_ON,
 
438
                        .amux = CX231XX_AMUX_LINE_IN,
 
439
                        .gpio = NULL,
397
440
                } },
398
441
        },
399
442
        [CX231XX_BOARD_PV_PLAYTV_USB_HYBRID] = {
420
463
                        .type = CX231XX_VMUX_TELEVISION,
421
464
                        .vmux = CX231XX_VIN_3_1,
422
465
                        .amux = CX231XX_AMUX_VIDEO,
423
 
                        .gpio = 0,
424
 
                }, {
425
 
                        .type = CX231XX_VMUX_COMPOSITE1,
426
 
                        .vmux = CX231XX_VIN_2_1,
427
 
                        .amux = CX231XX_AMUX_LINE_IN,
428
 
                        .gpio = 0,
429
 
                }, {
430
 
                        .type = CX231XX_VMUX_SVIDEO,
431
 
                        .vmux = CX231XX_VIN_1_1 |
432
 
                                (CX231XX_VIN_1_2 << 8) |
433
 
                                CX25840_SVIDEO_ON,
434
 
                        .amux = CX231XX_AMUX_LINE_IN,
435
 
                        .gpio = 0,
 
466
                        .gpio = NULL,
 
467
                }, {
 
468
                        .type = CX231XX_VMUX_COMPOSITE1,
 
469
                        .vmux = CX231XX_VIN_2_1,
 
470
                        .amux = CX231XX_AMUX_LINE_IN,
 
471
                        .gpio = NULL,
 
472
                }, {
 
473
                        .type = CX231XX_VMUX_SVIDEO,
 
474
                        .vmux = CX231XX_VIN_1_1 |
 
475
                                (CX231XX_VIN_1_2 << 8) |
 
476
                                CX25840_SVIDEO_ON,
 
477
                        .amux = CX231XX_AMUX_LINE_IN,
 
478
                        .gpio = NULL,
 
479
                } },
 
480
        },
 
481
        [CX231XX_BOARD_PV_XCAPTURE_USB] = {
 
482
                .name = "Pixelview Xcapture USB",
 
483
                .tuner_type = TUNER_ABSENT,
 
484
                .decoder = CX231XX_AVDECODER,
 
485
                .output_mode = OUT_MODE_VIP11,
 
486
                .demod_xfer_mode = 0,
 
487
                .ctl_pin_status_mask = 0xFFFFFFC4,
 
488
                .agc_analog_digital_select_gpio = 0x0c,
 
489
                .gpio_pin_status_mask = 0x4001000,
 
490
                .norm = V4L2_STD_NTSC,
 
491
                .no_alt_vanc = 1,
 
492
                .external_av = 1,
 
493
                .dont_use_port_3 = 1,
 
494
 
 
495
                .input = {{
 
496
                                .type = CX231XX_VMUX_COMPOSITE1,
 
497
                                .vmux = CX231XX_VIN_2_1,
 
498
                                .amux = CX231XX_AMUX_LINE_IN,
 
499
                                .gpio = NULL,
 
500
                        }, {
 
501
                                .type = CX231XX_VMUX_SVIDEO,
 
502
                                .vmux = CX231XX_VIN_1_1 |
 
503
                                        (CX231XX_VIN_1_2 << 8) |
 
504
                                        CX25840_SVIDEO_ON,
 
505
                                .amux = CX231XX_AMUX_LINE_IN,
 
506
                                .gpio = NULL,
 
507
                        }
 
508
                },
 
509
        },
 
510
 
 
511
        [CX231XX_BOARD_ICONBIT_U100] = {
 
512
                .name = "Iconbit Analog Stick U100 FM",
 
513
                .tuner_type = TUNER_ABSENT,
 
514
                .decoder = CX231XX_AVDECODER,
 
515
                .output_mode = OUT_MODE_VIP11,
 
516
                .demod_xfer_mode = 0,
 
517
                .ctl_pin_status_mask = 0xFFFFFFC4,
 
518
                .agc_analog_digital_select_gpio = 0x1C,
 
519
                .gpio_pin_status_mask = 0x4001000,
 
520
 
 
521
                .input = {{
 
522
                        .type = CX231XX_VMUX_COMPOSITE1,
 
523
                        .vmux = CX231XX_VIN_2_1,
 
524
                        .amux = CX231XX_AMUX_LINE_IN,
 
525
                        .gpio = NULL,
 
526
                }, {
 
527
                        .type = CX231XX_VMUX_SVIDEO,
 
528
                        .vmux = CX231XX_VIN_1_1 |
 
529
                                (CX231XX_VIN_1_2 << 8) |
 
530
                                CX25840_SVIDEO_ON,
 
531
                        .amux = CX231XX_AMUX_LINE_IN,
 
532
                        .gpio = NULL,
436
533
                } },
437
534
        },
438
535
};
464
561
         .driver_info = CX231XX_BOARD_HAUPPAUGE_USBLIVE2},
465
562
        {USB_DEVICE_VER(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD, 0x4000, 0x4001),
466
563
         .driver_info = CX231XX_BOARD_PV_PLAYTV_USB_HYBRID},
 
564
        {USB_DEVICE(USB_VID_PIXELVIEW, 0x5014),
 
565
         .driver_info = CX231XX_BOARD_PV_XCAPTURE_USB},
 
566
        {USB_DEVICE(0x1b80, 0xe424),
 
567
         .driver_info = CX231XX_BOARD_KWORLD_UB430_USB_HYBRID},
 
568
        {USB_DEVICE(0x1f4d, 0x0237),
 
569
         .driver_info = CX231XX_BOARD_ICONBIT_U100},
467
570
        {},
468
571
};
469
572
 
772
875
        /* Reset other chips required if they are tied up with GPIO pins */
773
876
        cx231xx_add_into_devlist(dev);
774
877
 
775
 
        if (dev->model == CX231XX_BOARD_CNXT_VIDEO_GRABBER) {
 
878
        if (dev->board.has_417) {
776
879
                printk(KERN_INFO "attach 417 %d\n", dev->model);
777
880
                if (cx231xx_417_register(dev) < 0) {
778
881
                        printk(KERN_ERR
844
947
        udev = usb_get_dev(interface_to_usbdev(interface));
845
948
        ifnum = interface->altsetting[0].desc.bInterfaceNumber;
846
949
 
847
 
        if (ifnum == 1) {
848
 
                /*
849
 
                 * Interface number 0 - IR interface
850
 
                 */
851
 
                /* Check to see next free device and mark as used */
852
 
                nr = find_first_zero_bit(&cx231xx_devused, CX231XX_MAXBOARDS);
853
 
                cx231xx_devused |= 1 << nr;
854
 
 
855
 
                if (nr >= CX231XX_MAXBOARDS) {
856
 
                        cx231xx_err(DRIVER_NAME
 
950
        /*
 
951
         * Interface number 0 - IR interface (handled by mceusb driver)
 
952
         * Interface number 1 - AV interface (handled by this driver)
 
953
         */
 
954
        if (ifnum != 1)
 
955
                return -ENODEV;
 
956
 
 
957
        /* Check to see next free device and mark as used */
 
958
        nr = find_first_zero_bit(&cx231xx_devused, CX231XX_MAXBOARDS);
 
959
        cx231xx_devused |= 1 << nr;
 
960
 
 
961
        if (nr >= CX231XX_MAXBOARDS) {
 
962
                cx231xx_err(DRIVER_NAME
857
963
                 ": Supports only %i cx231xx boards.\n", CX231XX_MAXBOARDS);
858
 
                        cx231xx_devused &= ~(1 << nr);
859
 
                        return -ENOMEM;
860
 
                }
861
 
 
862
 
                /* allocate memory for our device state and initialize it */
863
 
                dev = kzalloc(sizeof(*dev), GFP_KERNEL);
864
 
                if (dev == NULL) {
865
 
                        cx231xx_err(DRIVER_NAME ": out of memory!\n");
866
 
                        cx231xx_devused &= ~(1 << nr);
867
 
                        return -ENOMEM;
868
 
                }
869
 
 
870
 
                snprintf(dev->name, 29, "cx231xx #%d", nr);
871
 
                dev->devno = nr;
872
 
                dev->model = id->driver_info;
873
 
                dev->video_mode.alt = -1;
874
 
                dev->interface_count++;
875
 
 
876
 
                /* reset gpio dir and value */
877
 
                dev->gpio_dir = 0;
878
 
                dev->gpio_val = 0;
879
 
                dev->xc_fw_load_done = 0;
880
 
                dev->has_alsa_audio = 1;
881
 
                dev->power_mode = -1;
882
 
                atomic_set(&dev->devlist_count, 0);
883
 
 
884
 
                /* 0 - vbi ; 1 -sliced cc mode */
885
 
                dev->vbi_or_sliced_cc_mode = 0;
886
 
 
887
 
                /* get maximum no.of IAD interfaces */
888
 
                assoc_desc = udev->actconfig->intf_assoc[0];
889
 
                dev->max_iad_interface_count = assoc_desc->bInterfaceCount;
890
 
 
891
 
                /* init CIR module TBD */
892
 
 
893
 
                /* store the current interface */
894
 
                lif = interface;
895
 
 
896
 
                /*mode_tv: digital=1 or analog=0*/
897
 
                dev->mode_tv = 0;
898
 
 
899
 
                dev->USE_ISO = transfer_mode;
900
 
 
901
 
                switch (udev->speed) {
902
 
                case USB_SPEED_LOW:
903
 
                        speed = "1.5";
904
 
                        break;
905
 
                case USB_SPEED_UNKNOWN:
906
 
                case USB_SPEED_FULL:
907
 
                        speed = "12";
908
 
                        break;
909
 
                case USB_SPEED_HIGH:
910
 
                        speed = "480";
911
 
                        break;
912
 
                default:
913
 
                        speed = "unknown";
914
 
                }
915
 
 
916
 
                if (udev->manufacturer)
917
 
                        strlcpy(descr, udev->manufacturer, sizeof(descr));
918
 
 
919
 
                if (udev->product) {
920
 
                        if (*descr)
921
 
                                strlcat(descr, " ", sizeof(descr));
922
 
                        strlcat(descr, udev->product, sizeof(descr));
923
 
                }
 
964
                cx231xx_devused &= ~(1 << nr);
 
965
                return -ENOMEM;
 
966
        }
 
967
 
 
968
        /* allocate memory for our device state and initialize it */
 
969
        dev = kzalloc(sizeof(*dev), GFP_KERNEL);
 
970
        if (dev == NULL) {
 
971
                cx231xx_err(DRIVER_NAME ": out of memory!\n");
 
972
                cx231xx_devused &= ~(1 << nr);
 
973
                return -ENOMEM;
 
974
        }
 
975
 
 
976
        snprintf(dev->name, 29, "cx231xx #%d", nr);
 
977
        dev->devno = nr;
 
978
        dev->model = id->driver_info;
 
979
        dev->video_mode.alt = -1;
 
980
 
 
981
        dev->interface_count++;
 
982
        /* reset gpio dir and value */
 
983
        dev->gpio_dir = 0;
 
984
        dev->gpio_val = 0;
 
985
        dev->xc_fw_load_done = 0;
 
986
        dev->has_alsa_audio = 1;
 
987
        dev->power_mode = -1;
 
988
        atomic_set(&dev->devlist_count, 0);
 
989
 
 
990
        /* 0 - vbi ; 1 -sliced cc mode */
 
991
        dev->vbi_or_sliced_cc_mode = 0;
 
992
 
 
993
        /* get maximum no.of IAD interfaces */
 
994
        assoc_desc = udev->actconfig->intf_assoc[0];
 
995
        dev->max_iad_interface_count = assoc_desc->bInterfaceCount;
 
996
 
 
997
        /* init CIR module TBD */
 
998
 
 
999
        /* store the current interface */
 
1000
        lif = interface;
 
1001
 
 
1002
        /*mode_tv: digital=1 or analog=0*/
 
1003
        dev->mode_tv = 0;
 
1004
 
 
1005
        dev->USE_ISO = transfer_mode;
 
1006
 
 
1007
        switch (udev->speed) {
 
1008
        case USB_SPEED_LOW:
 
1009
                speed = "1.5";
 
1010
                break;
 
1011
        case USB_SPEED_UNKNOWN:
 
1012
        case USB_SPEED_FULL:
 
1013
                speed = "12";
 
1014
                break;
 
1015
        case USB_SPEED_HIGH:
 
1016
                speed = "480";
 
1017
                break;
 
1018
        default:
 
1019
                speed = "unknown";
 
1020
        }
 
1021
 
 
1022
        if (udev->manufacturer)
 
1023
                strlcpy(descr, udev->manufacturer, sizeof(descr));
 
1024
 
 
1025
        if (udev->product) {
924
1026
                if (*descr)
925
1027
                        strlcat(descr, " ", sizeof(descr));
926
 
 
927
 
                cx231xx_info("New device %s@ %s Mbps "
928
 
                     "(%04x:%04x) with %d interfaces\n",
929
 
                     descr,
930
 
                     speed,
931
 
                     le16_to_cpu(udev->descriptor.idVendor),
932
 
                     le16_to_cpu(udev->descriptor.idProduct),
933
 
                     dev->max_iad_interface_count);
934
 
 
935
 
                /* store the interface 0 back */
936
 
                lif = udev->actconfig->interface[0];
937
 
 
938
 
                /* increment interface count */
939
 
                dev->interface_count++;
940
 
 
941
 
                /* get device number */
942
 
                nr = dev->devno;
943
 
 
944
 
                assoc_desc = udev->actconfig->intf_assoc[0];
945
 
                if (assoc_desc->bFirstInterface != ifnum) {
946
 
                        cx231xx_err(DRIVER_NAME ": Not found "
947
 
                                    "matching IAD interface\n");
948
 
                        return -ENODEV;
949
 
                }
950
 
        } else {
 
1028
                strlcat(descr, udev->product, sizeof(descr));
 
1029
        }
 
1030
        if (*descr)
 
1031
                strlcat(descr, " ", sizeof(descr));
 
1032
 
 
1033
        cx231xx_info("New device %s@ %s Mbps "
 
1034
             "(%04x:%04x) with %d interfaces\n",
 
1035
             descr,
 
1036
             speed,
 
1037
             le16_to_cpu(udev->descriptor.idVendor),
 
1038
             le16_to_cpu(udev->descriptor.idProduct),
 
1039
             dev->max_iad_interface_count);
 
1040
 
 
1041
        /* store the interface 0 back */
 
1042
        lif = udev->actconfig->interface[0];
 
1043
 
 
1044
        /* increment interface count */
 
1045
        dev->interface_count++;
 
1046
 
 
1047
        /* get device number */
 
1048
        nr = dev->devno;
 
1049
 
 
1050
        assoc_desc = udev->actconfig->intf_assoc[0];
 
1051
        if (assoc_desc->bFirstInterface != ifnum) {
 
1052
                cx231xx_err(DRIVER_NAME ": Not found "
 
1053
                            "matching IAD interface\n");
951
1054
                return -ENODEV;
952
1055
        }
953
1056