diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2006-02-02 01:12:54 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2006-02-02 01:12:54 -0500 |
commit | 18ee3610040a4c008ce08a40a5dd025241cc7e97 (patch) | |
tree | 32a996a5123726b63c31a1522f230933fb967a32 /drivers/usb/media/w9968cf.c | |
parent | e4e7b89280d1d666e2c09e5ad36cf071796c4c7e (diff) | |
parent | b4103333d7904310d34de18d85e51e3d74f00a3b (diff) |
Merge branch 'master'
Diffstat (limited to 'drivers/usb/media/w9968cf.c')
-rw-r--r-- | drivers/usb/media/w9968cf.c | 128 |
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); | |||
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); | ||