diff options
Diffstat (limited to 'drivers/media/video/em28xx/em28xx-cards.c')
-rw-r--r-- | drivers/media/video/em28xx/em28xx-cards.c | 81 |
1 files changed, 6 insertions, 75 deletions
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 9fd8cc7dbb23..20a7e24de6fb 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c | |||
@@ -69,6 +69,8 @@ struct em28xx_hash_table { | |||
69 | unsigned int tuner; | 69 | unsigned int tuner; |
70 | }; | 70 | }; |
71 | 71 | ||
72 | static void em28xx_pre_card_setup(struct em28xx *dev); | ||
73 | |||
72 | /* | 74 | /* |
73 | * Reset sequences for analog/digital modes | 75 | * Reset sequences for analog/digital modes |
74 | */ | 76 | */ |
@@ -2361,7 +2363,7 @@ static int em28xx_hint_sensor(struct em28xx *dev) | |||
2361 | /* Since em28xx_pre_card_setup() requires a proper dev->model, | 2363 | /* Since em28xx_pre_card_setup() requires a proper dev->model, |
2362 | * this won't work for boards with generic PCI IDs | 2364 | * this won't work for boards with generic PCI IDs |
2363 | */ | 2365 | */ |
2364 | void em28xx_pre_card_setup(struct em28xx *dev) | 2366 | static void em28xx_pre_card_setup(struct em28xx *dev) |
2365 | { | 2367 | { |
2366 | /* Set the initial XCLK and I2C clock values based on the board | 2368 | /* Set the initial XCLK and I2C clock values based on the board |
2367 | definition */ | 2369 | definition */ |
@@ -2661,55 +2663,7 @@ static int em28xx_hint_board(struct em28xx *dev) | |||
2661 | return -1; | 2663 | return -1; |
2662 | } | 2664 | } |
2663 | 2665 | ||
2664 | /* ----------------------------------------------------------------------- */ | 2666 | static void em28xx_card_setup(struct em28xx *dev) |
2665 | void em28xx_register_i2c_ir(struct em28xx *dev) | ||
2666 | { | ||
2667 | /* Leadtek winfast tv USBII deluxe can find a non working IR-device */ | ||
2668 | /* at address 0x18, so if that address is needed for another board in */ | ||
2669 | /* the future, please put it after 0x1f. */ | ||
2670 | struct i2c_board_info info; | ||
2671 | const unsigned short addr_list[] = { | ||
2672 | 0x1f, 0x30, 0x47, I2C_CLIENT_END | ||
2673 | }; | ||
2674 | |||
2675 | if (disable_ir) | ||
2676 | return; | ||
2677 | |||
2678 | memset(&info, 0, sizeof(struct i2c_board_info)); | ||
2679 | memset(&dev->init_data, 0, sizeof(dev->init_data)); | ||
2680 | strlcpy(info.type, "ir_video", I2C_NAME_SIZE); | ||
2681 | |||
2682 | /* detect & configure */ | ||
2683 | switch (dev->model) { | ||
2684 | case EM2800_BOARD_TERRATEC_CINERGY_200: | ||
2685 | case EM2820_BOARD_TERRATEC_CINERGY_250: | ||
2686 | dev->init_data.ir_codes = RC_MAP_EM_TERRATEC; | ||
2687 | dev->init_data.get_key = em28xx_get_key_terratec; | ||
2688 | dev->init_data.name = "i2c IR (EM28XX Terratec)"; | ||
2689 | break; | ||
2690 | case EM2820_BOARD_PINNACLE_USB_2: | ||
2691 | dev->init_data.ir_codes = RC_MAP_PINNACLE_GREY; | ||
2692 | dev->init_data.get_key = em28xx_get_key_pinnacle_usb_grey; | ||
2693 | dev->init_data.name = "i2c IR (EM28XX Pinnacle PCTV)"; | ||
2694 | break; | ||
2695 | case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2: | ||
2696 | dev->init_data.ir_codes = RC_MAP_HAUPPAUGE; | ||
2697 | dev->init_data.get_key = em28xx_get_key_em_haup; | ||
2698 | dev->init_data.name = "i2c IR (EM2840 Hauppauge)"; | ||
2699 | break; | ||
2700 | case EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE: | ||
2701 | dev->init_data.ir_codes = RC_MAP_WINFAST_USBII_DELUXE; | ||
2702 | dev->init_data.get_key = em28xx_get_key_winfast_usbii_deluxe; | ||
2703 | dev->init_data.name = "i2c IR (EM2820 Winfast TV USBII Deluxe)"; | ||
2704 | break; | ||
2705 | } | ||
2706 | |||
2707 | if (dev->init_data.name) | ||
2708 | info.platform_data = &dev->init_data; | ||
2709 | i2c_new_probed_device(&dev->i2c_adap, &info, addr_list, NULL); | ||
2710 | } | ||
2711 | |||
2712 | void em28xx_card_setup(struct em28xx *dev) | ||
2713 | { | 2667 | { |
2714 | /* | 2668 | /* |
2715 | * If the device can be a webcam, seek for a sensor. | 2669 | * If the device can be a webcam, seek for a sensor. |
@@ -2849,13 +2803,6 @@ void em28xx_card_setup(struct em28xx *dev) | |||
2849 | break; | 2803 | break; |
2850 | } | 2804 | } |
2851 | 2805 | ||
2852 | #if defined(CONFIG_MODULES) && defined(MODULE) | ||
2853 | if (dev->board.has_ir_i2c && !disable_ir) | ||
2854 | request_module("ir-kbd-i2c"); | ||
2855 | #endif | ||
2856 | if (dev->board.has_snapshot_button) | ||
2857 | em28xx_register_snapshot_button(dev); | ||
2858 | |||
2859 | if (dev->board.valid == EM28XX_BOARD_NOT_VALIDATED) { | 2806 | if (dev->board.valid == EM28XX_BOARD_NOT_VALIDATED) { |
2860 | em28xx_errdev("\n\n"); | 2807 | em28xx_errdev("\n\n"); |
2861 | em28xx_errdev("The support for this board weren't " | 2808 | em28xx_errdev("The support for this board weren't " |
@@ -2929,9 +2876,6 @@ void em28xx_card_setup(struct em28xx *dev) | |||
2929 | } | 2876 | } |
2930 | 2877 | ||
2931 | em28xx_tuner_setup(dev); | 2878 | em28xx_tuner_setup(dev); |
2932 | |||
2933 | if(!disable_ir) | ||
2934 | em28xx_ir_init(dev); | ||
2935 | } | 2879 | } |
2936 | 2880 | ||
2937 | 2881 | ||
@@ -2948,6 +2892,8 @@ static void request_module_async(struct work_struct *work) | |||
2948 | 2892 | ||
2949 | if (dev->board.has_dvb) | 2893 | if (dev->board.has_dvb) |
2950 | request_module("em28xx-dvb"); | 2894 | request_module("em28xx-dvb"); |
2895 | if (dev->board.has_ir_i2c && !disable_ir) | ||
2896 | request_module("em28xx-rc"); | ||
2951 | } | 2897 | } |
2952 | 2898 | ||
2953 | static void request_modules(struct em28xx *dev) | 2899 | static void request_modules(struct em28xx *dev) |
@@ -2972,12 +2918,6 @@ static void flush_request_modules(struct em28xx *dev) | |||
2972 | */ | 2918 | */ |
2973 | void em28xx_release_resources(struct em28xx *dev) | 2919 | void em28xx_release_resources(struct em28xx *dev) |
2974 | { | 2920 | { |
2975 | if (dev->sbutton_input_dev) | ||
2976 | em28xx_deregister_snapshot_button(dev); | ||
2977 | |||
2978 | if (dev->ir) | ||
2979 | em28xx_ir_fini(dev); | ||
2980 | |||
2981 | /*FIXME: I2C IR should be disconnected */ | 2921 | /*FIXME: I2C IR should be disconnected */ |
2982 | 2922 | ||
2983 | em28xx_release_analog_resources(dev); | 2923 | em28xx_release_analog_resources(dev); |
@@ -3005,9 +2945,6 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev, | |||
3005 | dev->udev = udev; | 2945 | dev->udev = udev; |
3006 | mutex_init(&dev->ctrl_urb_lock); | 2946 | mutex_init(&dev->ctrl_urb_lock); |
3007 | spin_lock_init(&dev->slock); | 2947 | spin_lock_init(&dev->slock); |
3008 | init_waitqueue_head(&dev->open); | ||
3009 | init_waitqueue_head(&dev->wait_frame); | ||
3010 | init_waitqueue_head(&dev->wait_stream); | ||
3011 | 2948 | ||
3012 | dev->em28xx_write_regs = em28xx_write_regs; | 2949 | dev->em28xx_write_regs = em28xx_write_regs; |
3013 | dev->em28xx_read_reg = em28xx_read_reg; | 2950 | dev->em28xx_read_reg = em28xx_read_reg; |
@@ -3140,9 +3077,7 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev, | |||
3140 | 3077 | ||
3141 | /* init video dma queues */ | 3078 | /* init video dma queues */ |
3142 | INIT_LIST_HEAD(&dev->vidq.active); | 3079 | INIT_LIST_HEAD(&dev->vidq.active); |
3143 | INIT_LIST_HEAD(&dev->vidq.queued); | ||
3144 | INIT_LIST_HEAD(&dev->vbiq.active); | 3080 | INIT_LIST_HEAD(&dev->vbiq.active); |
3145 | INIT_LIST_HEAD(&dev->vbiq.queued); | ||
3146 | 3081 | ||
3147 | if (dev->board.has_msp34xx) { | 3082 | if (dev->board.has_msp34xx) { |
3148 | /* Send a reset to other chips via gpio */ | 3083 | /* Send a reset to other chips via gpio */ |
@@ -3447,8 +3382,6 @@ static void em28xx_usb_disconnect(struct usb_interface *interface) | |||
3447 | resources */ | 3382 | resources */ |
3448 | mutex_lock(&dev->lock); | 3383 | mutex_lock(&dev->lock); |
3449 | 3384 | ||
3450 | wake_up_interruptible_all(&dev->open); | ||
3451 | |||
3452 | v4l2_device_disconnect(&dev->v4l2_dev); | 3385 | v4l2_device_disconnect(&dev->v4l2_dev); |
3453 | 3386 | ||
3454 | if (dev->users) { | 3387 | if (dev->users) { |
@@ -3460,8 +3393,6 @@ static void em28xx_usb_disconnect(struct usb_interface *interface) | |||
3460 | dev->state |= DEV_MISCONFIGURED; | 3393 | dev->state |= DEV_MISCONFIGURED; |
3461 | em28xx_uninit_isoc(dev, dev->mode); | 3394 | em28xx_uninit_isoc(dev, dev->mode); |
3462 | dev->state |= DEV_DISCONNECTED; | 3395 | dev->state |= DEV_DISCONNECTED; |
3463 | wake_up_interruptible(&dev->wait_frame); | ||
3464 | wake_up_interruptible(&dev->wait_stream); | ||
3465 | } else { | 3396 | } else { |
3466 | dev->state |= DEV_DISCONNECTED; | 3397 | dev->state |= DEV_DISCONNECTED; |
3467 | em28xx_release_resources(dev); | 3398 | em28xx_release_resources(dev); |