diff options
Diffstat (limited to 'drivers/media/video/cx231xx/cx231xx-cards.c')
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-cards.c | 246 |
1 files changed, 141 insertions, 105 deletions
diff --git a/drivers/media/video/cx231xx/cx231xx-cards.c b/drivers/media/video/cx231xx/cx231xx-cards.c index 588f3e8f028b..f49230d170e6 100644 --- a/drivers/media/video/cx231xx/cx231xx-cards.c +++ b/drivers/media/video/cx231xx/cx231xx-cards.c | |||
@@ -261,6 +261,9 @@ struct cx231xx_board cx231xx_boards[] = { | |||
261 | .agc_analog_digital_select_gpio = 0x1c, | 261 | .agc_analog_digital_select_gpio = 0x1c, |
262 | .gpio_pin_status_mask = 0x4001000, | 262 | .gpio_pin_status_mask = 0x4001000, |
263 | .norm = V4L2_STD_PAL, | 263 | .norm = V4L2_STD_PAL, |
264 | .no_alt_vanc = 1, | ||
265 | .external_av = 1, | ||
266 | .has_417 = 1, | ||
264 | 267 | ||
265 | .input = {{ | 268 | .input = {{ |
266 | .type = CX231XX_VMUX_COMPOSITE1, | 269 | .type = CX231XX_VMUX_COMPOSITE1, |
@@ -357,19 +360,19 @@ struct cx231xx_board cx231xx_boards[] = { | |||
357 | .type = CX231XX_VMUX_TELEVISION, | 360 | .type = CX231XX_VMUX_TELEVISION, |
358 | .vmux = CX231XX_VIN_3_1, | 361 | .vmux = CX231XX_VIN_3_1, |
359 | .amux = CX231XX_AMUX_VIDEO, | 362 | .amux = CX231XX_AMUX_VIDEO, |
360 | .gpio = 0, | 363 | .gpio = NULL, |
361 | }, { | 364 | }, { |
362 | .type = CX231XX_VMUX_COMPOSITE1, | 365 | .type = CX231XX_VMUX_COMPOSITE1, |
363 | .vmux = CX231XX_VIN_2_1, | 366 | .vmux = CX231XX_VIN_2_1, |
364 | .amux = CX231XX_AMUX_LINE_IN, | 367 | .amux = CX231XX_AMUX_LINE_IN, |
365 | .gpio = 0, | 368 | .gpio = NULL, |
366 | }, { | 369 | }, { |
367 | .type = CX231XX_VMUX_SVIDEO, | 370 | .type = CX231XX_VMUX_SVIDEO, |
368 | .vmux = CX231XX_VIN_1_1 | | 371 | .vmux = CX231XX_VIN_1_1 | |
369 | (CX231XX_VIN_1_2 << 8) | | 372 | (CX231XX_VIN_1_2 << 8) | |
370 | CX25840_SVIDEO_ON, | 373 | CX25840_SVIDEO_ON, |
371 | .amux = CX231XX_AMUX_LINE_IN, | 374 | .amux = CX231XX_AMUX_LINE_IN, |
372 | .gpio = 0, | 375 | .gpio = NULL, |
373 | } }, | 376 | } }, |
374 | }, | 377 | }, |
375 | [CX231XX_BOARD_HAUPPAUGE_USBLIVE2] = { | 378 | [CX231XX_BOARD_HAUPPAUGE_USBLIVE2] = { |
@@ -382,18 +385,20 @@ struct cx231xx_board cx231xx_boards[] = { | |||
382 | .agc_analog_digital_select_gpio = 0x0c, | 385 | .agc_analog_digital_select_gpio = 0x0c, |
383 | .gpio_pin_status_mask = 0x4001000, | 386 | .gpio_pin_status_mask = 0x4001000, |
384 | .norm = V4L2_STD_NTSC, | 387 | .norm = V4L2_STD_NTSC, |
388 | .no_alt_vanc = 1, | ||
389 | .external_av = 1, | ||
385 | .input = {{ | 390 | .input = {{ |
386 | .type = CX231XX_VMUX_COMPOSITE1, | 391 | .type = CX231XX_VMUX_COMPOSITE1, |
387 | .vmux = CX231XX_VIN_2_1, | 392 | .vmux = CX231XX_VIN_2_1, |
388 | .amux = CX231XX_AMUX_LINE_IN, | 393 | .amux = CX231XX_AMUX_LINE_IN, |
389 | .gpio = 0, | 394 | .gpio = NULL, |
390 | }, { | 395 | }, { |
391 | .type = CX231XX_VMUX_SVIDEO, | 396 | .type = CX231XX_VMUX_SVIDEO, |
392 | .vmux = CX231XX_VIN_1_1 | | 397 | .vmux = CX231XX_VIN_1_1 | |
393 | (CX231XX_VIN_1_2 << 8) | | 398 | (CX231XX_VIN_1_2 << 8) | |
394 | CX25840_SVIDEO_ON, | 399 | CX25840_SVIDEO_ON, |
395 | .amux = CX231XX_AMUX_LINE_IN, | 400 | .amux = CX231XX_AMUX_LINE_IN, |
396 | .gpio = 0, | 401 | .gpio = NULL, |
397 | } }, | 402 | } }, |
398 | }, | 403 | }, |
399 | [CX231XX_BOARD_PV_PLAYTV_USB_HYBRID] = { | 404 | [CX231XX_BOARD_PV_PLAYTV_USB_HYBRID] = { |
@@ -420,21 +425,50 @@ struct cx231xx_board cx231xx_boards[] = { | |||
420 | .type = CX231XX_VMUX_TELEVISION, | 425 | .type = CX231XX_VMUX_TELEVISION, |
421 | .vmux = CX231XX_VIN_3_1, | 426 | .vmux = CX231XX_VIN_3_1, |
422 | .amux = CX231XX_AMUX_VIDEO, | 427 | .amux = CX231XX_AMUX_VIDEO, |
423 | .gpio = 0, | 428 | .gpio = NULL, |
424 | }, { | 429 | }, { |
425 | .type = CX231XX_VMUX_COMPOSITE1, | 430 | .type = CX231XX_VMUX_COMPOSITE1, |
426 | .vmux = CX231XX_VIN_2_1, | 431 | .vmux = CX231XX_VIN_2_1, |
427 | .amux = CX231XX_AMUX_LINE_IN, | 432 | .amux = CX231XX_AMUX_LINE_IN, |
428 | .gpio = 0, | 433 | .gpio = NULL, |
429 | }, { | 434 | }, { |
430 | .type = CX231XX_VMUX_SVIDEO, | 435 | .type = CX231XX_VMUX_SVIDEO, |
431 | .vmux = CX231XX_VIN_1_1 | | 436 | .vmux = CX231XX_VIN_1_1 | |
432 | (CX231XX_VIN_1_2 << 8) | | 437 | (CX231XX_VIN_1_2 << 8) | |
433 | CX25840_SVIDEO_ON, | 438 | CX25840_SVIDEO_ON, |
434 | .amux = CX231XX_AMUX_LINE_IN, | 439 | .amux = CX231XX_AMUX_LINE_IN, |
435 | .gpio = 0, | 440 | .gpio = NULL, |
436 | } }, | 441 | } }, |
437 | }, | 442 | }, |
443 | [CX231XX_BOARD_PV_XCAPTURE_USB] = { | ||
444 | .name = "Pixelview Xcapture USB", | ||
445 | .tuner_type = TUNER_ABSENT, | ||
446 | .decoder = CX231XX_AVDECODER, | ||
447 | .output_mode = OUT_MODE_VIP11, | ||
448 | .demod_xfer_mode = 0, | ||
449 | .ctl_pin_status_mask = 0xFFFFFFC4, | ||
450 | .agc_analog_digital_select_gpio = 0x0c, | ||
451 | .gpio_pin_status_mask = 0x4001000, | ||
452 | .norm = V4L2_STD_NTSC, | ||
453 | .no_alt_vanc = 1, | ||
454 | .external_av = 1, | ||
455 | .dont_use_port_3 = 1, | ||
456 | |||
457 | .input = {{ | ||
458 | .type = CX231XX_VMUX_COMPOSITE1, | ||
459 | .vmux = CX231XX_VIN_2_1, | ||
460 | .amux = CX231XX_AMUX_LINE_IN, | ||
461 | .gpio = NULL, | ||
462 | }, { | ||
463 | .type = CX231XX_VMUX_SVIDEO, | ||
464 | .vmux = CX231XX_VIN_1_1 | | ||
465 | (CX231XX_VIN_1_2 << 8) | | ||
466 | CX25840_SVIDEO_ON, | ||
467 | .amux = CX231XX_AMUX_LINE_IN, | ||
468 | .gpio = NULL, | ||
469 | } | ||
470 | }, | ||
471 | }, | ||
438 | }; | 472 | }; |
439 | const unsigned int cx231xx_bcount = ARRAY_SIZE(cx231xx_boards); | 473 | const unsigned int cx231xx_bcount = ARRAY_SIZE(cx231xx_boards); |
440 | 474 | ||
@@ -464,6 +498,8 @@ struct usb_device_id cx231xx_id_table[] = { | |||
464 | .driver_info = CX231XX_BOARD_HAUPPAUGE_USBLIVE2}, | 498 | .driver_info = CX231XX_BOARD_HAUPPAUGE_USBLIVE2}, |
465 | {USB_DEVICE_VER(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD, 0x4000, 0x4001), | 499 | {USB_DEVICE_VER(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD, 0x4000, 0x4001), |
466 | .driver_info = CX231XX_BOARD_PV_PLAYTV_USB_HYBRID}, | 500 | .driver_info = CX231XX_BOARD_PV_PLAYTV_USB_HYBRID}, |
501 | {USB_DEVICE(USB_VID_PIXELVIEW, 0x5014), | ||
502 | .driver_info = CX231XX_BOARD_PV_XCAPTURE_USB}, | ||
467 | {}, | 503 | {}, |
468 | }; | 504 | }; |
469 | 505 | ||
@@ -772,7 +808,7 @@ static int cx231xx_init_dev(struct cx231xx **devhandle, struct usb_device *udev, | |||
772 | /* Reset other chips required if they are tied up with GPIO pins */ | 808 | /* Reset other chips required if they are tied up with GPIO pins */ |
773 | cx231xx_add_into_devlist(dev); | 809 | cx231xx_add_into_devlist(dev); |
774 | 810 | ||
775 | if (dev->model == CX231XX_BOARD_CNXT_VIDEO_GRABBER) { | 811 | if (dev->board.has_417) { |
776 | printk(KERN_INFO "attach 417 %d\n", dev->model); | 812 | printk(KERN_INFO "attach 417 %d\n", dev->model); |
777 | if (cx231xx_417_register(dev) < 0) { | 813 | if (cx231xx_417_register(dev) < 0) { |
778 | printk(KERN_ERR | 814 | printk(KERN_ERR |
@@ -844,110 +880,110 @@ static int cx231xx_usb_probe(struct usb_interface *interface, | |||
844 | udev = usb_get_dev(interface_to_usbdev(interface)); | 880 | udev = usb_get_dev(interface_to_usbdev(interface)); |
845 | ifnum = interface->altsetting[0].desc.bInterfaceNumber; | 881 | ifnum = interface->altsetting[0].desc.bInterfaceNumber; |
846 | 882 | ||
847 | if (ifnum == 1) { | 883 | /* |
848 | /* | 884 | * Interface number 0 - IR interface (handled by mceusb driver) |
849 | * Interface number 0 - IR interface | 885 | * Interface number 1 - AV interface (handled by this driver) |
850 | */ | 886 | */ |
851 | /* Check to see next free device and mark as used */ | 887 | if (ifnum != 1) |
852 | nr = find_first_zero_bit(&cx231xx_devused, CX231XX_MAXBOARDS); | 888 | return -ENODEV; |
853 | cx231xx_devused |= 1 << nr; | ||
854 | |||
855 | if (nr >= CX231XX_MAXBOARDS) { | ||
856 | cx231xx_err(DRIVER_NAME | ||
857 | ": 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 | 889 | ||
893 | /* store the current interface */ | 890 | /* Check to see next free device and mark as used */ |
894 | lif = interface; | 891 | nr = find_first_zero_bit(&cx231xx_devused, CX231XX_MAXBOARDS); |
892 | cx231xx_devused |= 1 << nr; | ||
895 | 893 | ||
896 | /*mode_tv: digital=1 or analog=0*/ | 894 | if (nr >= CX231XX_MAXBOARDS) { |
897 | dev->mode_tv = 0; | 895 | cx231xx_err(DRIVER_NAME |
896 | ": Supports only %i cx231xx boards.\n", CX231XX_MAXBOARDS); | ||
897 | cx231xx_devused &= ~(1 << nr); | ||
898 | return -ENOMEM; | ||
899 | } | ||
898 | 900 | ||
899 | dev->USE_ISO = transfer_mode; | 901 | /* allocate memory for our device state and initialize it */ |
902 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | ||
903 | if (dev == NULL) { | ||
904 | cx231xx_err(DRIVER_NAME ": out of memory!\n"); | ||
905 | cx231xx_devused &= ~(1 << nr); | ||
906 | return -ENOMEM; | ||
907 | } | ||
900 | 908 | ||
901 | switch (udev->speed) { | 909 | snprintf(dev->name, 29, "cx231xx #%d", nr); |
902 | case USB_SPEED_LOW: | 910 | dev->devno = nr; |
903 | speed = "1.5"; | 911 | dev->model = id->driver_info; |
904 | break; | 912 | dev->video_mode.alt = -1; |
905 | case USB_SPEED_UNKNOWN: | 913 | |
906 | case USB_SPEED_FULL: | 914 | dev->interface_count++; |
907 | speed = "12"; | 915 | /* reset gpio dir and value */ |
908 | break; | 916 | dev->gpio_dir = 0; |
909 | case USB_SPEED_HIGH: | 917 | dev->gpio_val = 0; |
910 | speed = "480"; | 918 | dev->xc_fw_load_done = 0; |
911 | break; | 919 | dev->has_alsa_audio = 1; |
912 | default: | 920 | dev->power_mode = -1; |
913 | speed = "unknown"; | 921 | atomic_set(&dev->devlist_count, 0); |
914 | } | 922 | |
923 | /* 0 - vbi ; 1 -sliced cc mode */ | ||
924 | dev->vbi_or_sliced_cc_mode = 0; | ||
925 | |||
926 | /* get maximum no.of IAD interfaces */ | ||
927 | assoc_desc = udev->actconfig->intf_assoc[0]; | ||
928 | dev->max_iad_interface_count = assoc_desc->bInterfaceCount; | ||
929 | |||
930 | /* init CIR module TBD */ | ||
931 | |||
932 | /* store the current interface */ | ||
933 | lif = interface; | ||
934 | |||
935 | /*mode_tv: digital=1 or analog=0*/ | ||
936 | dev->mode_tv = 0; | ||
937 | |||
938 | dev->USE_ISO = transfer_mode; | ||
939 | |||
940 | switch (udev->speed) { | ||
941 | case USB_SPEED_LOW: | ||
942 | speed = "1.5"; | ||
943 | break; | ||
944 | case USB_SPEED_UNKNOWN: | ||
945 | case USB_SPEED_FULL: | ||
946 | speed = "12"; | ||
947 | break; | ||
948 | case USB_SPEED_HIGH: | ||
949 | speed = "480"; | ||
950 | break; | ||
951 | default: | ||
952 | speed = "unknown"; | ||
953 | } | ||
915 | 954 | ||
916 | if (udev->manufacturer) | 955 | if (udev->manufacturer) |
917 | strlcpy(descr, udev->manufacturer, sizeof(descr)); | 956 | strlcpy(descr, udev->manufacturer, sizeof(descr)); |
918 | 957 | ||
919 | if (udev->product) { | 958 | if (udev->product) { |
920 | if (*descr) | ||
921 | strlcat(descr, " ", sizeof(descr)); | ||
922 | strlcat(descr, udev->product, sizeof(descr)); | ||
923 | } | ||
924 | if (*descr) | 959 | if (*descr) |
925 | strlcat(descr, " ", sizeof(descr)); | 960 | strlcat(descr, " ", sizeof(descr)); |
926 | 961 | strlcat(descr, udev->product, sizeof(descr)); | |
927 | cx231xx_info("New device %s@ %s Mbps " | 962 | } |
928 | "(%04x:%04x) with %d interfaces\n", | 963 | if (*descr) |
929 | descr, | 964 | strlcat(descr, " ", sizeof(descr)); |
930 | speed, | 965 | |
931 | le16_to_cpu(udev->descriptor.idVendor), | 966 | cx231xx_info("New device %s@ %s Mbps " |
932 | le16_to_cpu(udev->descriptor.idProduct), | 967 | "(%04x:%04x) with %d interfaces\n", |
933 | dev->max_iad_interface_count); | 968 | descr, |
934 | 969 | speed, | |
935 | /* store the interface 0 back */ | 970 | le16_to_cpu(udev->descriptor.idVendor), |
936 | lif = udev->actconfig->interface[0]; | 971 | le16_to_cpu(udev->descriptor.idProduct), |
937 | 972 | dev->max_iad_interface_count); | |
938 | /* increment interface count */ | 973 | |
939 | dev->interface_count++; | 974 | /* store the interface 0 back */ |
940 | 975 | lif = udev->actconfig->interface[0]; | |
941 | /* get device number */ | 976 | |
942 | nr = dev->devno; | 977 | /* increment interface count */ |
943 | 978 | dev->interface_count++; | |
944 | assoc_desc = udev->actconfig->intf_assoc[0]; | 979 | |
945 | if (assoc_desc->bFirstInterface != ifnum) { | 980 | /* get device number */ |
946 | cx231xx_err(DRIVER_NAME ": Not found " | 981 | nr = dev->devno; |
947 | "matching IAD interface\n"); | 982 | |
948 | return -ENODEV; | 983 | assoc_desc = udev->actconfig->intf_assoc[0]; |
949 | } | 984 | if (assoc_desc->bFirstInterface != ifnum) { |
950 | } else { | 985 | cx231xx_err(DRIVER_NAME ": Not found " |
986 | "matching IAD interface\n"); | ||
951 | return -ENODEV; | 987 | return -ENODEV; |
952 | } | 988 | } |
953 | 989 | ||