aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/media/w9968cf.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/media/w9968cf.c')
-rw-r--r--drivers/usb/media/w9968cf.c128
1 files changed, 1 insertions, 127 deletions
diff --git a/drivers/usb/media/w9968cf.c b/drivers/usb/media/w9968cf.c
index bff9434c8e55..9937fc64c8bf 100644
--- a/drivers/usb/media/w9968cf.c
+++ b/drivers/usb/media/w9968cf.c
@@ -62,7 +62,6 @@ MODULE_LICENSE(W9968CF_MODULE_LICENSE);
62MODULE_SUPPORTED_DEVICE("Video"); 62MODULE_SUPPORTED_DEVICE("Video");
63 63
64static int ovmod_load = W9968CF_OVMOD_LOAD; 64static int ovmod_load = W9968CF_OVMOD_LOAD;
65static int vppmod_load = W9968CF_VPPMOD_LOAD;
66static unsigned short simcams = W9968CF_SIMCAMS; 65static unsigned short simcams = W9968CF_SIMCAMS;
67static short video_nr[]={[0 ... W9968CF_MAX_DEVICES-1] = -1}; /*-1=first free*/ 66static short video_nr[]={[0 ... W9968CF_MAX_DEVICES-1] = -1}; /*-1=first free*/
68static unsigned int packet_size[] = {[0 ... W9968CF_MAX_DEVICES-1] = 67static unsigned int packet_size[] = {[0 ... W9968CF_MAX_DEVICES-1] =
@@ -107,7 +106,6 @@ static unsigned int param_nv[24]; /* number of values per parameter */
107 106
108#ifdef CONFIG_KMOD 107#ifdef CONFIG_KMOD
109module_param(ovmod_load, bool, 0644); 108module_param(ovmod_load, bool, 0644);
110module_param(vppmod_load, bool, 0444);
111#endif 109#endif
112module_param(simcams, ushort, 0644); 110module_param(simcams, ushort, 0644);
113module_param_array(video_nr, short, &param_nv[0], 0444); 111module_param_array(video_nr, short, &param_nv[0], 0444);
@@ -150,18 +148,6 @@ MODULE_PARM_DESC(ovmod_load,
150 "\ninto memory." 148 "\ninto memory."
151 "\nDefault value is "__MODULE_STRING(W9968CF_OVMOD_LOAD)"." 149 "\nDefault value is "__MODULE_STRING(W9968CF_OVMOD_LOAD)"."
152 "\n"); 150 "\n");
153MODULE_PARM_DESC(vppmod_load,
154 "\n<0|1> Automatic 'w9968cf-vpp' module loading."
155 "\n0 disabled, 1 enabled."
156 "\nIf enabled, every time an application attempts to open a"
157 "\ncamera, 'insmod' searches for the video post-processing"
158 "\nmodule in the system and loads it automatically (if"
159 "\npresent). The optional 'w9968cf-vpp' module adds extra"
160 "\n image manipulation functions to the 'w9968cf' module,like"
161 "\nsoftware up-scaling,colour conversions and video decoding"
162 "\nfor very high frame rates."
163 "\nDefault value is "__MODULE_STRING(W9968CF_VPPMOD_LOAD)"."
164 "\n");
165#endif 151#endif
166MODULE_PARM_DESC(simcams, 152MODULE_PARM_DESC(simcams,
167 "\n<n> Number of cameras allowed to stream simultaneously." 153 "\n<n> Number of cameras allowed to stream simultaneously."
@@ -492,10 +478,6 @@ static void w9968cf_push_frame(struct w9968cf_device*, u8 f_num);
492static void w9968cf_pop_frame(struct w9968cf_device*,struct w9968cf_frame_t**); 478static void w9968cf_pop_frame(struct w9968cf_device*,struct w9968cf_frame_t**);
493static void w9968cf_release_resources(struct w9968cf_device*); 479static void w9968cf_release_resources(struct w9968cf_device*);
494 480
495/* Intermodule communication */
496static int w9968cf_vppmod_detect(struct w9968cf_device*);
497static void w9968cf_vppmod_release(struct w9968cf_device*);
498
499 481
500 482
501/**************************************************************************** 483/****************************************************************************
@@ -2737,9 +2719,7 @@ static int w9968cf_open(struct inode* inode, struct file* filp)
2737 cam->streaming = 0; 2719 cam->streaming = 0;
2738 cam->misconfigured = 0; 2720 cam->misconfigured = 0;
2739 2721
2740 if (!w9968cf_vpp) 2722 w9968cf_adjust_configuration(cam);
2741 if ((err = w9968cf_vppmod_detect(cam)))
2742 goto out;
2743 2723
2744 if ((err = w9968cf_allocate_memory(cam))) 2724 if ((err = w9968cf_allocate_memory(cam)))
2745 goto deallocate_memory; 2725 goto deallocate_memory;
@@ -2766,7 +2746,6 @@ static int w9968cf_open(struct inode* inode, struct file* filp)
2766 2746
2767deallocate_memory: 2747deallocate_memory:
2768 w9968cf_deallocate_memory(cam); 2748 w9968cf_deallocate_memory(cam);
2769out:
2770 DBG(2, "Failed to open the video device") 2749 DBG(2, "Failed to open the video device")
2771 up(&cam->dev_sem); 2750 up(&cam->dev_sem);
2772 up_read(&w9968cf_disconnect); 2751 up_read(&w9968cf_disconnect);
@@ -2784,8 +2763,6 @@ static int w9968cf_release(struct inode* inode, struct file* filp)
2784 2763
2785 w9968cf_stop_transfer(cam); 2764 w9968cf_stop_transfer(cam);
2786 2765
2787 w9968cf_vppmod_release(cam);
2788
2789 if (cam->disconnected) { 2766 if (cam->disconnected) {
2790 w9968cf_release_resources(cam); 2767 w9968cf_release_resources(cam);
2791 up(&cam->dev_sem); 2768 up(&cam->dev_sem);
@@ -3681,106 +3658,6 @@ static struct usb_driver w9968cf_usb_driver = {
3681 * Module init, exit and intermodule communication * 3658 * Module init, exit and intermodule communication *
3682 ****************************************************************************/ 3659 ****************************************************************************/
3683 3660
3684static int w9968cf_vppmod_detect(struct w9968cf_device* cam)
3685{
3686 if (!w9968cf_vpp)
3687 if (vppmod_load)
3688 request_module("w9968cf-vpp");
3689
3690 down(&w9968cf_vppmod_lock);
3691
3692 if (!w9968cf_vpp) {
3693 DBG(4, "Video post-processing module not detected")
3694 w9968cf_adjust_configuration(cam);
3695 goto out;
3696 }
3697
3698 if (!try_module_get(w9968cf_vpp->owner)) {
3699 DBG(1, "Couldn't increment the reference count of "
3700 "the video post-processing module")
3701 up(&w9968cf_vppmod_lock);
3702 return -ENOSYS;
3703 }
3704
3705 w9968cf_vpp->busy++;
3706
3707 DBG(5, "Video post-processing module detected")
3708
3709out:
3710 up(&w9968cf_vppmod_lock);
3711 return 0;
3712}
3713
3714
3715static void w9968cf_vppmod_release(struct w9968cf_device* cam)
3716{
3717 down(&w9968cf_vppmod_lock);
3718
3719 if (w9968cf_vpp && w9968cf_vpp->busy) {
3720 module_put(w9968cf_vpp->owner);
3721 w9968cf_vpp->busy--;
3722 wake_up(&w9968cf_vppmod_wait);
3723 DBG(5, "Video post-processing module released")
3724 }
3725
3726 up(&w9968cf_vppmod_lock);
3727}
3728
3729
3730int w9968cf_vppmod_register(struct w9968cf_vpp_t* vpp)
3731{
3732 down(&w9968cf_vppmod_lock);
3733
3734 if (w9968cf_vpp) {
3735 KDBG(1, "Video post-processing module already registered")
3736 up(&w9968cf_vppmod_lock);
3737 return -EINVAL;
3738 }
3739
3740 w9968cf_vpp = vpp;
3741 w9968cf_vpp->busy = 0;
3742
3743 KDBG(2, "Video post-processing module registered")
3744 up(&w9968cf_vppmod_lock);
3745 return 0;
3746}
3747
3748
3749int w9968cf_vppmod_deregister(struct w9968cf_vpp_t* vpp)
3750{
3751 down(&w9968cf_vppmod_lock);
3752
3753 if (!w9968cf_vpp) {
3754 up(&w9968cf_vppmod_lock);
3755 return -EINVAL;
3756 }
3757
3758 if (w9968cf_vpp != vpp) {
3759 KDBG(1, "Only the owner can unregister the video "
3760 "post-processing module")
3761 up(&w9968cf_vppmod_lock);
3762 return -EINVAL;
3763 }
3764
3765 if (w9968cf_vpp->busy) {
3766 KDBG(2, "Video post-processing module busy. Wait for it to be "
3767 "released...")
3768 up(&w9968cf_vppmod_lock);
3769 wait_event(w9968cf_vppmod_wait, !w9968cf_vpp->busy);
3770 w9968cf_vpp = NULL;
3771 goto out;
3772 }
3773
3774 w9968cf_vpp = NULL;
3775
3776 up(&w9968cf_vppmod_lock);
3777
3778out:
3779 KDBG(2, "Video post-processing module unregistered")
3780 return 0;
3781}
3782
3783
3784static int __init w9968cf_module_init(void) 3661static int __init w9968cf_module_init(void)
3785{ 3662{
3786 int err; 3663 int err;
@@ -3810,6 +3687,3 @@ static void __exit w9968cf_module_exit(void)
3810module_init(w9968cf_module_init); 3687module_init(w9968cf_module_init);
3811module_exit(w9968cf_module_exit); 3688module_exit(w9968cf_module_exit);
3812 3689
3813
3814EXPORT_SYMBOL(w9968cf_vppmod_register);
3815EXPORT_SYMBOL(w9968cf_vppmod_deregister);