Commit 0edbc24c authored by Tomas Winkler's avatar Tomas Winkler Committed by Greg Kroah-Hartman

staging/easycap: make OSS compilation optional instead of ALSA

OSS is deprecated yet currently it is reported to be more stable
therefore we keep it but make it optional
Revert the conditional compilation:
	add  CONFIG_EASYCAP_OSS and kill EASYCAP_NEEDS_ALSA
move oss-only code from easycap_sound.c to easycap_sound_oss.c

Cc: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 5c0c6c39
config EASYCAP config EASYCAP
tristate "EasyCAP USB ID 05e1:0408 support" tristate "EasyCAP USB ID 05e1:0408 support"
depends on USB && VIDEO_DEV && SND depends on USB && VIDEO_DEV && SOUND
---help--- ---help---
This is an integrated audio/video driver for EasyCAP cards with This is an integrated audio/video driver for EasyCAP cards with
...@@ -15,6 +15,18 @@ config EASYCAP ...@@ -15,6 +15,18 @@ config EASYCAP
To compile this driver as a module, choose M here: the To compile this driver as a module, choose M here: the
module will be called easycap module will be called easycap
config EASYCAP_OSS
bool "OSS (DEPRECATED)"
depends on EASYCAP && SOUND_OSS_CORE
---help---
Say 'Y' if you prefer Open Sound System (OSS) interface
This will disable Advanced Linux Sound Architecture (ALSA) binding.
Once binding to ALSA interface will be stable this option will be
removed.
config EASYCAP_DEBUG config EASYCAP_DEBUG
bool "Enable EasyCAP driver debugging" bool "Enable EasyCAP driver debugging"
depends on EASYCAP depends on EASYCAP
......
easycap-objs := easycap_main.o easycap_low.o easycap_sound.o \ easycap-objs := easycap_main.o
easycap_ioctl.o easycap_settings.o easycap_testcard.o easycap-objs += easycap_low.o
easycap-objs += easycap_ioctl.o
easycap-objs += easycap_settings.o
easycap-objs += easycap_testcard.o
easycap-objs += easycap_sound.o
easycap-$(CONFIG_EASYCAP_OSS) += easycap_sound_oss.o
obj-$(CONFIG_EASYCAP) += easycap.o obj-$(CONFIG_EASYCAP) += easycap.o
...@@ -8,5 +13,4 @@ ccflags-y += -DEASYCAP_IS_VIDEODEV_CLIENT ...@@ -8,5 +13,4 @@ ccflags-y += -DEASYCAP_IS_VIDEODEV_CLIENT
ccflags-y += -DEASYCAP_NEEDS_V4L2_DEVICE_H ccflags-y += -DEASYCAP_NEEDS_V4L2_DEVICE_H
ccflags-y += -DEASYCAP_NEEDS_V4L2_FOPS ccflags-y += -DEASYCAP_NEEDS_V4L2_FOPS
ccflags-y += -DEASYCAP_NEEDS_UNLOCKED_IOCTL ccflags-y += -DEASYCAP_NEEDS_UNLOCKED_IOCTL
ccflags-y += -DEASYCAP_NEEDS_ALSA
...@@ -59,9 +59,9 @@ ...@@ -59,9 +59,9 @@
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#undef EASYCAP_TESTCARD #undef EASYCAP_TESTCARD
#if (!defined(EASYCAP_NEEDS_ALSA)) #ifdef CONFIG_EASYCAP_OSS
#undef EASYCAP_TESTTONE #undef EASYCAP_TESTTONE
#endif /*EASYCAP_NEEDS_ALSA*/ #endif /* CONFIG_EASYCAP_OSS */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/errno.h> #include <linux/errno.h>
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/types.h> #include <linux/types.h>
#if defined(EASYCAP_NEEDS_ALSA) #ifndef CONFIG_EASYCAP_OSS
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/sound.h> #include <linux/sound.h>
#include <sound/core.h> #include <sound/core.h>
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
#include <sound/info.h> #include <sound/info.h>
#include <sound/initval.h> #include <sound/initval.h>
#include <sound/control.h> #include <sound/control.h>
#endif /*EASYCAP_NEEDS_ALSA*/ #endif /* !CONFIG_EASYCAP_OSS */
/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
#if defined(EASYCAP_IS_VIDEODEV_CLIENT) #if defined(EASYCAP_IS_VIDEODEV_CLIENT)
#include <media/v4l2-dev.h> #include <media/v4l2-dev.h>
...@@ -445,7 +445,7 @@ __s16 oldaudio; ...@@ -445,7 +445,7 @@ __s16 oldaudio;
* ALSA * ALSA
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if defined(EASYCAP_NEEDS_ALSA) #ifndef CONFIG_EASYCAP_OSS
struct snd_pcm_hardware alsa_hardware; struct snd_pcm_hardware alsa_hardware;
struct snd_card *psnd_card; struct snd_card *psnd_card;
struct snd_pcm *psnd_pcm; struct snd_pcm *psnd_pcm;
...@@ -453,7 +453,7 @@ __s16 oldaudio; ...@@ -453,7 +453,7 @@ __s16 oldaudio;
int dma_fill; int dma_fill;
int dma_next; int dma_next;
int dma_read; int dma_read;
#endif /*EASYCAP_NEEDS_ALSA*/ #endif /* !CONFIG_EASYCAP_OSS */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* /*
* SOUND PROPERTIES * SOUND PROPERTIES
...@@ -537,7 +537,7 @@ int adjust_volume(struct easycap *, int); ...@@ -537,7 +537,7 @@ int adjust_volume(struct easycap *, int);
* AUDIO FUNCTION PROTOTYPES * AUDIO FUNCTION PROTOTYPES
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if defined(EASYCAP_NEEDS_ALSA) #ifndef CONFIG_EASYCAP_OSS
int easycap_alsa_probe(struct easycap *); int easycap_alsa_probe(struct easycap *);
void easycap_alsa_complete(struct urb *); void easycap_alsa_complete(struct urb *);
...@@ -553,7 +553,7 @@ int easycap_alsa_trigger(struct snd_pcm_substream *, int); ...@@ -553,7 +553,7 @@ int easycap_alsa_trigger(struct snd_pcm_substream *, int);
snd_pcm_uframes_t easycap_alsa_pointer(struct snd_pcm_substream *); snd_pcm_uframes_t easycap_alsa_pointer(struct snd_pcm_substream *);
struct page *easycap_alsa_page(struct snd_pcm_substream *, unsigned long); struct page *easycap_alsa_page(struct snd_pcm_substream *, unsigned long);
#else #else /* CONFIG_EASYCAP_OSS */
void easyoss_complete(struct urb *); void easyoss_complete(struct urb *);
ssize_t easyoss_read(struct file *, char __user *, size_t, loff_t *); ssize_t easyoss_read(struct file *, char __user *, size_t, loff_t *);
int easyoss_open(struct inode *, struct file *); int easyoss_open(struct inode *, struct file *);
...@@ -564,7 +564,8 @@ int easyoss_ioctl(struct inode *, struct file *, unsigned int, ...@@ -564,7 +564,8 @@ int easyoss_ioctl(struct inode *, struct file *, unsigned int,
unsigned long); unsigned long);
unsigned int easyoss_poll(struct file *, poll_table *); unsigned int easyoss_poll(struct file *, poll_table *);
void easyoss_delete(struct kref *); void easyoss_delete(struct kref *);
#endif /*EASYCAP_NEEDS_ALSA*/ #endif /* !CONFIG_EASYCAP_OSS */
int easycap_sound_setup(struct easycap *); int easycap_sound_setup(struct easycap *);
int submit_audio_urbs(struct easycap *); int submit_audio_urbs(struct easycap *);
int kill_audio_urbs(struct easycap *); int kill_audio_urbs(struct easycap *);
...@@ -715,13 +716,13 @@ extern struct easycap_format easycap_format[]; ...@@ -715,13 +716,13 @@ extern struct easycap_format easycap_format[];
extern struct v4l2_queryctrl easycap_control[]; extern struct v4l2_queryctrl easycap_control[];
extern struct usb_driver easycap_usb_driver; extern struct usb_driver easycap_usb_driver;
extern struct easycap_dongle easycapdc60_dongle[]; extern struct easycap_dongle easycapdc60_dongle[];
#if defined(EASYCAP_NEEDS_ALSA) #ifndef CONFIG_EASYCAP_OSS
extern struct snd_pcm_ops easycap_alsa_ops; extern struct snd_pcm_ops easycap_alsa_ops;
extern struct snd_pcm_hardware easycap_pcm_hardware; extern struct snd_pcm_hardware easycap_pcm_hardware;
extern struct snd_card *psnd_card; extern struct snd_card *psnd_card;
#else #else /* CONFIG_EASYCAP_OSS */
extern struct usb_class_driver easyoss_class; extern struct usb_class_driver easyoss_class;
extern const struct file_operations easyoss_fops; extern const struct file_operations easyoss_fops;
#endif /*EASYCAP_NEEDS_ALSA*/ #endif /* !CONFIG_EASYCAP_OSS */
#endif /* !__EASYCAP_H__ */ #endif /* !__EASYCAP_H__ */
...@@ -2517,7 +2517,7 @@ JOM(4, "unlocked easycapdc60_dongle[%i].mutex_video\n", kd); ...@@ -2517,7 +2517,7 @@ JOM(4, "unlocked easycapdc60_dongle[%i].mutex_video\n", kd);
return 0; return 0;
} }
/*****************************************************************************/ /*****************************************************************************/
#if !defined(EASYCAP_NEEDS_ALSA) #ifdef CONFIG_EASYCAP_OSS
/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
#if ((defined(EASYCAP_IS_VIDEODEV_CLIENT)) || \ #if ((defined(EASYCAP_IS_VIDEODEV_CLIENT)) || \
(defined(EASYCAP_NEEDS_UNLOCKED_IOCTL))) (defined(EASYCAP_NEEDS_UNLOCKED_IOCTL)))
...@@ -2821,6 +2821,6 @@ default: { ...@@ -2821,6 +2821,6 @@ default: {
mutex_unlock(&easycapdc60_dongle[kd].mutex_audio); mutex_unlock(&easycapdc60_dongle[kd].mutex_audio);
return 0; return 0;
} }
#endif /*EASYCAP_NEEDS_ALSA*/ #endif /* CONFIG_EASYCAP_OSS */
/*****************************************************************************/ /*****************************************************************************/
...@@ -962,7 +962,7 @@ for (k = 0; k < AUDIO_ISOC_BUFFER_MANY; k++) { ...@@ -962,7 +962,7 @@ for (k = 0; k < AUDIO_ISOC_BUFFER_MANY; k++) {
JOM(4, "easyoss_delete(): isoc audio buffers freed: %i pages\n", JOM(4, "easyoss_delete(): isoc audio buffers freed: %i pages\n",
m * (0x01 << AUDIO_ISOC_ORDER)); m * (0x01 << AUDIO_ISOC_ORDER));
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if !defined(EASYCAP_NEEDS_ALSA) #ifdef CONFIG_EASYCAP_OSS
JOM(4, "freeing audio buffers.\n"); JOM(4, "freeing audio buffers.\n");
gone = 0; gone = 0;
for (k = 0; k < peasycap->audio_buffer_page_many; k++) { for (k = 0; k < peasycap->audio_buffer_page_many; k++) {
...@@ -974,7 +974,7 @@ for (k = 0; k < peasycap->audio_buffer_page_many; k++) { ...@@ -974,7 +974,7 @@ for (k = 0; k < peasycap->audio_buffer_page_many; k++) {
} }
} }
JOM(4, "easyoss_delete(): audio buffers freed: %i pages\n", gone); JOM(4, "easyoss_delete(): audio buffers freed: %i pages\n", gone);
#endif /*!EASYCAP_NEEDS_ALSA*/ #endif /* CONFIG_EASYCAP_OSS */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
JOM(4, "freeing easycap structure.\n"); JOM(4, "freeing easycap structure.\n");
allocation_video_urb = peasycap->allocation_video_urb; allocation_video_urb = peasycap->allocation_video_urb;
...@@ -4350,7 +4350,7 @@ case 2: { ...@@ -4350,7 +4350,7 @@ case 2: {
INIT_LIST_HEAD(&(peasycap->urb_audio_head)); INIT_LIST_HEAD(&(peasycap->urb_audio_head));
peasycap->purb_audio_head = &(peasycap->urb_audio_head); peasycap->purb_audio_head = &(peasycap->urb_audio_head);
#if !defined(EASYCAP_NEEDS_ALSA) #ifdef CONFIG_EASYCAP_OSS
JOM(4, "allocating an audio buffer\n"); JOM(4, "allocating an audio buffer\n");
JOM(4, ".... scattered over %i pages\n", JOM(4, ".... scattered over %i pages\n",
peasycap->audio_buffer_page_many); peasycap->audio_buffer_page_many);
...@@ -4375,7 +4375,7 @@ case 2: { ...@@ -4375,7 +4375,7 @@ case 2: {
peasycap->audio_fill = 0; peasycap->audio_fill = 0;
peasycap->audio_read = 0; peasycap->audio_read = 0;
JOM(4, "allocation of audio buffer done: %i pages\n", k); JOM(4, "allocation of audio buffer done: %i pages\n", k);
#endif /*!EASYCAP_NEEDS_ALSA*/ #endif /* CONFIG_EASYCAP_OSS */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
JOM(4, "allocating %i isoc audio buffers of size %i\n", JOM(4, "allocating %i isoc audio buffers of size %i\n",
AUDIO_ISOC_BUFFER_MANY, peasycap->audio_isoc_buffer_size); AUDIO_ISOC_BUFFER_MANY, peasycap->audio_isoc_buffer_size);
...@@ -4450,11 +4450,11 @@ case 2: { ...@@ -4450,11 +4450,11 @@ case 2: {
"peasycap->audio_isoc_buffer[.].pgo;\n"); "peasycap->audio_isoc_buffer[.].pgo;\n");
JOM(4, " purb->transfer_buffer_length = %i;\n", JOM(4, " purb->transfer_buffer_length = %i;\n",
peasycap->audio_isoc_buffer_size); peasycap->audio_isoc_buffer_size);
#if defined(EASYCAP_NEEDS_ALSA) #ifdef CONFIG_EASYCAP_OSS
JOM(4, " purb->complete = easycap_alsa_complete;\n");
#else
JOM(4, " purb->complete = easyoss_complete;\n"); JOM(4, " purb->complete = easyoss_complete;\n");
#endif /*EASYCAP_NEEDS_ALSA*/ #else /* CONFIG_EASYCAP_OSS */
JOM(4, " purb->complete = easycap_alsa_complete;\n");
#endif /* CONFIG_EASYCAP_OSS */
JOM(4, " purb->context = peasycap;\n"); JOM(4, " purb->context = peasycap;\n");
JOM(4, " purb->start_frame = 0;\n"); JOM(4, " purb->start_frame = 0;\n");
JOM(4, " purb->number_of_packets = %i;\n", JOM(4, " purb->number_of_packets = %i;\n",
...@@ -4477,11 +4477,11 @@ case 2: { ...@@ -4477,11 +4477,11 @@ case 2: {
purb->transfer_buffer = peasycap->audio_isoc_buffer[k].pgo; purb->transfer_buffer = peasycap->audio_isoc_buffer[k].pgo;
purb->transfer_buffer_length = purb->transfer_buffer_length =
peasycap->audio_isoc_buffer_size; peasycap->audio_isoc_buffer_size;
#if defined(EASYCAP_NEEDS_ALSA) #ifdef CONFIG_EASYCAP_OSS
purb->complete = easycap_alsa_complete;
#else
purb->complete = easyoss_complete; purb->complete = easyoss_complete;
#endif /*EASYCAP_NEEDS_ALSA*/ #else /* CONFIG_EASYCAP_OSS */
purb->complete = easycap_alsa_complete;
#endif /* CONFIG_EASYCAP_OSS */
purb->context = peasycap; purb->context = peasycap;
purb->start_frame = 0; purb->start_frame = 0;
purb->number_of_packets = peasycap->audio_isoc_framesperdesc; purb->number_of_packets = peasycap->audio_isoc_framesperdesc;
...@@ -4504,7 +4504,7 @@ case 2: { ...@@ -4504,7 +4504,7 @@ case 2: {
* THE AUDIO DEVICE CAN BE REGISTERED NOW, AS IT IS READY. * THE AUDIO DEVICE CAN BE REGISTERED NOW, AS IT IS READY.
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if defined(EASYCAP_NEEDS_ALSA) #ifndef CONFIG_EASYCAP_OSS
JOM(4, "initializing ALSA card\n"); JOM(4, "initializing ALSA card\n");
rc = easycap_alsa_probe(peasycap); rc = easycap_alsa_probe(peasycap);
...@@ -4518,7 +4518,7 @@ case 2: { ...@@ -4518,7 +4518,7 @@ case 2: {
(peasycap->registered_audio)++; (peasycap->registered_audio)++;
} }
#else /*EASYCAP_NEEDS_ALSA*/ #else /* CONFIG_EASYCAP_OSS */
rc = usb_register_dev(pusb_interface, &easyoss_class); rc = usb_register_dev(pusb_interface, &easyoss_class);
if (0 != rc) { if (0 != rc) {
SAY("ERROR: usb_register_dev() failed\n"); SAY("ERROR: usb_register_dev() failed\n");
...@@ -4536,7 +4536,7 @@ case 2: { ...@@ -4536,7 +4536,7 @@ case 2: {
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
SAM("easyoss attached to minor #%d\n", pusb_interface->minor); SAM("easyoss attached to minor #%d\n", pusb_interface->minor);
#endif /*EASYCAP_NEEDS_ALSA*/ #endif /* CONFIG_EASYCAP_OSS */
break; break;
} }
...@@ -4774,7 +4774,7 @@ case 2: { ...@@ -4774,7 +4774,7 @@ case 2: {
JOM(4, "locked easycapdc60_dongle[%i].mutex_audio\n", kd); JOM(4, "locked easycapdc60_dongle[%i].mutex_audio\n", kd);
} else } else
SAY("ERROR: %i=kd is bad: cannot lock dongle\n", kd); SAY("ERROR: %i=kd is bad: cannot lock dongle\n", kd);
#if defined(EASYCAP_NEEDS_ALSA) #ifndef CONFIG_EASYCAP_OSS
...@@ -4786,12 +4786,12 @@ case 2: { ...@@ -4786,12 +4786,12 @@ case 2: {
} }
#else /*EASYCAP_NEEDS_ALSA*/ #else /* CONFIG_EASYCAP_OSS */
usb_deregister_dev(pusb_interface, &easyoss_class); usb_deregister_dev(pusb_interface, &easyoss_class);
(peasycap->registered_audio)--; (peasycap->registered_audio)--;
JOM(4, "intf[%i]: usb_deregister_dev()\n", bInterfaceNumber); JOM(4, "intf[%i]: usb_deregister_dev()\n", bInterfaceNumber);
SAM("easyoss detached from minor #%d\n", minor); SAM("easyoss detached from minor #%d\n", minor);
#endif /*EASYCAP_NEEDS_ALSA*/ #endif /* CONFIG_EASYCAP_OSS */
if (0 <= kd && DONGLE_MANY > kd) { if (0 <= kd && DONGLE_MANY > kd) {
mutex_unlock(&easycapdc60_dongle[kd].mutex_audio); mutex_unlock(&easycapdc60_dongle[kd].mutex_audio);
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment