diff options
-rw-r--r-- | Documentation/usb/w9968cf.txt | 30 | ||||
-rw-r--r-- | drivers/usb/media/w9968cf.c | 128 | ||||
-rw-r--r-- | drivers/usb/media/w9968cf.h | 1 | ||||
-rw-r--r-- | drivers/usb/media/w9968cf_vpp.h | 3 |
4 files changed, 6 insertions, 156 deletions
diff --git a/Documentation/usb/w9968cf.txt b/Documentation/usb/w9968cf.txt index 18a47738d56c..9d46cd0b19e3 100644 --- a/Documentation/usb/w9968cf.txt +++ b/Documentation/usb/w9968cf.txt | |||
@@ -57,16 +57,12 @@ based cameras should be supported as well. | |||
57 | The driver is divided into two modules: the basic one, "w9968cf", is needed for | 57 | The driver is divided into two modules: the basic one, "w9968cf", is needed for |
58 | the supported devices to work; the second one, "w9968cf-vpp", is an optional | 58 | the supported devices to work; the second one, "w9968cf-vpp", is an optional |
59 | module, which provides some useful video post-processing functions like video | 59 | module, which provides some useful video post-processing functions like video |
60 | decoding, up-scaling and colour conversions. Once the driver is installed, | 60 | decoding, up-scaling and colour conversions. |
61 | every time an application tries to open a recognized device, "w9968cf" checks | ||
62 | the presence of the "w9968cf-vpp" module and loads it automatically by default. | ||
63 | 61 | ||
64 | Please keep in mind that official kernels do not include the second module for | 62 | Note that the official kernels do neither include nor support the second |
65 | performance purposes. However it is always recommended to download and install | 63 | module for performance purposes. Therefore, it is always recommended to |
66 | the latest and complete release of the driver, replacing the existing one, if | 64 | download and install the latest and complete release of the driver, |
67 | present: it will be still even possible not to load the "w9968cf-vpp" module at | 65 | replacing the existing one, if present. |
68 | all, if you ever want to. Another important missing feature of the version in | ||
69 | the official Linux 2.4 kernels is the writeable /proc filesystem interface. | ||
70 | 66 | ||
71 | The latest and full-featured version of the W996[87]CF driver can be found at: | 67 | The latest and full-featured version of the W996[87]CF driver can be found at: |
72 | http://www.linux-projects.org. Please refer to the documentation included in | 68 | http://www.linux-projects.org. Please refer to the documentation included in |
@@ -201,22 +197,6 @@ Note: The kernel must be compiled with the CONFIG_KMOD option | |||
201 | enabled for the 'ovcamchip' module to be loaded and for | 197 | enabled for the 'ovcamchip' module to be loaded and for |
202 | this parameter to be present. | 198 | this parameter to be present. |
203 | ------------------------------------------------------------------------------- | 199 | ------------------------------------------------------------------------------- |
204 | Name: vppmod_load | ||
205 | Type: bool | ||
206 | Syntax: <0|1> | ||
207 | Description: Automatic 'w9968cf-vpp' module loading: 0 disabled, 1 enabled. | ||
208 | If enabled, every time an application attempts to open a | ||
209 | camera, 'insmod' searches for the video post-processing module | ||
210 | in the system and loads it automatically (if present). | ||
211 | The optional 'w9968cf-vpp' module adds extra image manipulation | ||
212 | capabilities to the 'w9968cf' module,like software up-scaling, | ||
213 | colour conversions and video decompression for very high frame | ||
214 | rates. | ||
215 | Default: 1 | ||
216 | Note: The kernel must be compiled with the CONFIG_KMOD option | ||
217 | enabled for the 'w9968cf-vpp' module to be loaded and for | ||
218 | this parameter to be present. | ||
219 | ------------------------------------------------------------------------------- | ||
220 | Name: simcams | 200 | Name: simcams |
221 | Type: int | 201 | Type: int |
222 | Syntax: <n> | 202 | Syntax: <n> |
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); | |||
62 | MODULE_SUPPORTED_DEVICE("Video"); | 62 | MODULE_SUPPORTED_DEVICE("Video"); |
63 | 63 | ||
64 | static int ovmod_load = W9968CF_OVMOD_LOAD; | 64 | static int ovmod_load = W9968CF_OVMOD_LOAD; |
65 | static int vppmod_load = W9968CF_VPPMOD_LOAD; | ||
66 | static unsigned short simcams = W9968CF_SIMCAMS; | 65 | static unsigned short simcams = W9968CF_SIMCAMS; |
67 | static short video_nr[]={[0 ... W9968CF_MAX_DEVICES-1] = -1}; /*-1=first free*/ | 66 | static short video_nr[]={[0 ... W9968CF_MAX_DEVICES-1] = -1}; /*-1=first free*/ |
68 | static unsigned int packet_size[] = {[0 ... W9968CF_MAX_DEVICES-1] = | 67 | static 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 |
109 | module_param(ovmod_load, bool, 0644); | 108 | module_param(ovmod_load, bool, 0644); |
110 | module_param(vppmod_load, bool, 0444); | ||
111 | #endif | 109 | #endif |
112 | module_param(simcams, ushort, 0644); | 110 | module_param(simcams, ushort, 0644); |
113 | module_param_array(video_nr, short, ¶m_nv[0], 0444); | 111 | module_param_array(video_nr, short, ¶m_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"); |
153 | MODULE_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 |
166 | MODULE_PARM_DESC(simcams, | 152 | MODULE_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); | |||
492 | static void w9968cf_pop_frame(struct w9968cf_device*,struct w9968cf_frame_t**); | 478 | static void w9968cf_pop_frame(struct w9968cf_device*,struct w9968cf_frame_t**); |
493 | static void w9968cf_release_resources(struct w9968cf_device*); | 479 | static void w9968cf_release_resources(struct w9968cf_device*); |
494 | 480 | ||
495 | /* Intermodule communication */ | ||
496 | static int w9968cf_vppmod_detect(struct w9968cf_device*); | ||
497 | static 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 | ||
2767 | deallocate_memory: | 2747 | deallocate_memory: |
2768 | w9968cf_deallocate_memory(cam); | 2748 | w9968cf_deallocate_memory(cam); |
2769 | out: | ||
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 | ||
3684 | static 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 | |||
3709 | out: | ||
3710 | up(&w9968cf_vppmod_lock); | ||
3711 | return 0; | ||
3712 | } | ||
3713 | |||
3714 | |||
3715 | static 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 | |||
3730 | int 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 | |||
3749 | int 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 | |||
3778 | out: | ||
3779 | KDBG(2, "Video post-processing module unregistered") | ||
3780 | return 0; | ||
3781 | } | ||
3782 | |||
3783 | |||
3784 | static int __init w9968cf_module_init(void) | 3661 | static 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) | |||
3810 | module_init(w9968cf_module_init); | 3687 | module_init(w9968cf_module_init); |
3811 | module_exit(w9968cf_module_exit); | 3688 | module_exit(w9968cf_module_exit); |
3812 | 3689 | ||
3813 | |||
3814 | EXPORT_SYMBOL(w9968cf_vppmod_register); | ||
3815 | EXPORT_SYMBOL(w9968cf_vppmod_deregister); | ||
diff --git a/drivers/usb/media/w9968cf.h b/drivers/usb/media/w9968cf.h index 8acbfe205bc7..47a6ff794171 100644 --- a/drivers/usb/media/w9968cf.h +++ b/drivers/usb/media/w9968cf.h | |||
@@ -195,7 +195,6 @@ enum w9968cf_vpp_flag { | |||
195 | }; | 195 | }; |
196 | 196 | ||
197 | static struct w9968cf_vpp_t* w9968cf_vpp; | 197 | static struct w9968cf_vpp_t* w9968cf_vpp; |
198 | static DECLARE_MUTEX(w9968cf_vppmod_lock); | ||
199 | static DECLARE_WAIT_QUEUE_HEAD(w9968cf_vppmod_wait); | 198 | static DECLARE_WAIT_QUEUE_HEAD(w9968cf_vppmod_wait); |
200 | 199 | ||
201 | static LIST_HEAD(w9968cf_dev_list); /* head of V4L registered cameras list */ | 200 | static LIST_HEAD(w9968cf_dev_list); /* head of V4L registered cameras list */ |
diff --git a/drivers/usb/media/w9968cf_vpp.h b/drivers/usb/media/w9968cf_vpp.h index 3f5317dc4c29..f3b91b782671 100644 --- a/drivers/usb/media/w9968cf_vpp.h +++ b/drivers/usb/media/w9968cf_vpp.h | |||
@@ -37,7 +37,4 @@ struct w9968cf_vpp_t { | |||
37 | u8 busy; /* read-only flag: module is/is not in use */ | 37 | u8 busy; /* read-only flag: module is/is not in use */ |
38 | }; | 38 | }; |
39 | 39 | ||
40 | extern int w9968cf_vppmod_register(struct w9968cf_vpp_t*); | ||
41 | extern int w9968cf_vppmod_deregister(struct w9968cf_vpp_t*); | ||
42 | |||
43 | #endif /* _W9968CF_VPP_H_ */ | 40 | #endif /* _W9968CF_VPP_H_ */ |