summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@suse.cz>2002-10-04 19:49:22 +0200
committerJaroslav Kysela <perex@suse.cz>2002-10-04 19:49:22 +0200
commit0f8328bc361590cfff60da8fca696fbe5887550d (patch)
tree5c4557d10d2a5ecedf96fb5d2dbcbf0d42b29ea6
parent706e54557b43681eae8eb0443eab33262f603127 (diff)
ALSA
- DEVFS cleanup - removal of compatibility code for 2.2 and 2.4 kernels - fixed sgalaxy driver (save_flags/cli/restore_flags removal) - USB Audio driver - added the missing dev_set_drvdata() for 2.5 API - simplified the conexistence of old and new USB APIs - don't skip the active capture urbs - added the debug print for active capture urbs - don't change runtime->rate even if the current rate is not same - check the bandwidth for urbs (for tests only, now commented out)
-rw-r--r--include/sound/version.h2
-rw-r--r--sound/core/info.c6
-rw-r--r--sound/core/sound.c9
-rw-r--r--sound/isa/sgalaxy.c21
-rw-r--r--sound/usb/usbaudio.c93
5 files changed, 70 insertions, 61 deletions
diff --git a/include/sound/version.h b/include/sound/version.h
index bafde4fbc070..ba48af7a3099 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
/* include/version.h. Generated automatically by configure. */
#define CONFIG_SND_VERSION "0.9.0rc3"
-#define CONFIG_SND_DATE " (Tue Oct 01 14:40:23 2002 UTC)"
+#define CONFIG_SND_DATE " (Fri Oct 04 13:09:13 2002 UTC)"
diff --git a/sound/core/info.c b/sound/core/info.c
index 750bf080115e..96dbae13331d 100644
--- a/sound/core/info.c
+++ b/sound/core/info.c
@@ -960,7 +960,6 @@ void snd_info_free_device(snd_info_entry_t * entry)
{
#ifdef CONFIG_DEVFS_FS
char dname[32];
- devfs_handle_t master;
#endif
snd_runtime_check(entry, return);
@@ -970,12 +969,7 @@ void snd_info_free_device(snd_info_entry_t * entry)
#ifdef CONFIG_DEVFS_FS
if (entry->p && strncmp(entry->name, "controlC", 8)) {
sprintf(dname, "snd/%s", entry->name);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
- master = devfs_find_handle(NULL, dname, strlen(dname), 0, 0, DEVFS_SPECIAL_CHR, 0);
- devfs_unregister(master);
-#else
devfs_find_and_unregister(NULL, dname, 0, 0, DEVFS_SPECIAL_CHR, 0);
-#endif
}
#endif
snd_info_free_entry(entry);
diff --git a/sound/core/sound.c b/sound/core/sound.c
index 7fbf2bd70dfb..6a7056336c57 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -358,21 +358,12 @@ static int __init alsa_sound_init(void)
static void __exit alsa_sound_exit(void)
{
#ifdef CONFIG_DEVFS_FS
- devfs_handle_t master;
char controlname[24];
short controlnum;
for (controlnum = 0; controlnum < snd_cards_limit; controlnum++) {
sprintf(controlname, "snd/controlC%d", controlnum);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
- master = devfs_find_handle(NULL, controlname, strlen(controlname), 0, 0, DEVFS_SPECIAL_CHR, 0);
- devfs_unregister(master);
-#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- master = devfs_find_handle(NULL, controlname, 0, 0, DEVFS_SPECIAL_CHR, 0);
- devfs_unregister(master);
-#else
devfs_find_and_unregister(NULL, controlname, 0, 0, DEVFS_SPECIAL_CHR, 0);
-#endif
}
#endif
diff --git a/sound/isa/sgalaxy.c b/sound/isa/sgalaxy.c
index 5626a5519b07..7e2378eefeb8 100644
--- a/sound/isa/sgalaxy.c
+++ b/sound/isa/sgalaxy.c
@@ -26,6 +26,7 @@
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/time.h>
+#include <linux/irq.h>
#include <sound/core.h>
#include <sound/sb.h>
#include <sound/ad1848.h>
@@ -110,6 +111,10 @@ static int __init snd_sgalaxy_sbdsp_command(unsigned long port, unsigned char va
return 0;
}
+static void snd_sgalaxy_dummy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+{
+}
+
static int __init snd_sgalaxy_setup_wss(unsigned long port, int irq, int dma)
{
static int interrupt_bits[] = {-1, -1, -1, -1, -1, -1, -1, 0x08, -1,
@@ -117,8 +122,6 @@ static int __init snd_sgalaxy_setup_wss(unsigned long port, int irq, int dma)
static int dma_bits[] = {1, 2, 0, 3};
int tmp, tmp1;
- unsigned long flags;
-
if ((tmp = inb(port + 3)) == 0xff)
{
snd_printdd("I/O address dead (0x%lx)\n", port);
@@ -140,20 +143,20 @@ static int __init snd_sgalaxy_setup_wss(unsigned long port, int irq, int dma)
snd_printdd("sgalaxy - setting up IRQ/DMA for WSS\n");
#endif
- save_flags(flags);
- cli();
-
/* initialize IRQ for WSS codec */
tmp = interrupt_bits[irq % 16];
- if (tmp < 0) {
- restore_flags(flags);
+ if (tmp < 0)
return -EINVAL;
- }
+
+ if (request_irq(irq, snd_sgalaxy_dummy_interrupt, SA_INTERRUPT, "sgalaxy", NULL))
+ return -EIO;
+
outb(tmp | 0x40, port);
tmp1 = dma_bits[dma % 4];
outb(tmp | tmp1, port);
- restore_flags(flags);
+ free_irq(irq, NULL);
+
return 0;
}
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index 67b4ffc6934e..a14cd743d913 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -284,6 +284,16 @@ static int prepare_capture_urb(snd_usb_substream_t *subs,
urb->transfer_buffer = ctx->buf;
urb->transfer_buffer_length = offs;
urb->interval = 1;
+#if 0 // for check
+ if (! urb->bandwidth) {
+ int bustime;
+ bustime = usb_check_bandwidth(urb->dev, urb);
+ if (bustime < 0)
+ return bustime;
+ printk("urb %d: bandwidth = %d (packets = %d)\n", ctx->index, bustime, urb->number_of_packets);
+ usb_claim_bandwidth(urb->dev, urb, bustime, 1);
+ }
+#endif // for check
return 0;
}
@@ -305,8 +315,10 @@ static int retire_capture_urb(snd_usb_substream_t *subs,
for (i = 0; i < urb->number_of_packets; i++) {
cp = (unsigned char *)urb->transfer_buffer + urb->iso_frame_desc[i].offset;
- if (urb->iso_frame_desc[i].status) /* active? hmm, skip this */
- continue;
+ if (urb->iso_frame_desc[i].status) {
+ snd_printd(KERN_ERR "frame %d active: %d\n", i, urb->iso_frame_desc[i].status);
+ // continue;
+ }
len = urb->iso_frame_desc[i].actual_length / stride;
if (! len)
continue;
@@ -1009,6 +1021,7 @@ static int set_format(snd_usb_substream_t *subs, snd_pcm_runtime_t *runtime)
}
/* if endpoint has sampling rate control, set it */
if (fmt->attributes & EP_CS_ATTR_SAMPLE_RATE) {
+ int crate;
data[0] = runtime->rate;
data[1] = runtime->rate >> 8;
data[2] = runtime->rate >> 16;
@@ -1026,8 +1039,11 @@ static int set_format(snd_usb_substream_t *subs, snd_pcm_runtime_t *runtime)
dev->devnum, subs->interface, fmt->altsetting, ep);
return err;
}
- runtime->rate = data[0] | (data[1] << 8) | (data[2] << 16);
- // printk("ok, getting back rate to %d\n", runtime->rate);
+ crate = data[0] | (data[1] << 8) | (data[2] << 16);
+ if (crate != runtime->rate) {
+ snd_printd(KERN_WARNING "current rate %d is different from the runtime rate %d\n", crate, runtime->rate);
+ // runtime->rate = crate;
+ }
}
/* always fill max packet size */
if (fmt->attributes & EP_CS_ATTR_FILL_MAX)
@@ -1292,14 +1308,16 @@ void *snd_usb_find_csint_desc(void *buffer, int buflen, void *after, u8 dsubtype
* entry point for linux usb interface
*/
-#ifndef OLD_USB
+static void * _usb_audio_probe(struct usb_device *dev, unsigned int ifnum,
+ const struct usb_device_id *id);
+static void _usb_audio_disconnect(struct usb_device *dev, void *ptr);
+#ifdef OLD_USB
+#define usb_audio_probe _usb_audio_probe
+#define usb_audio_disconnect _usb_audio_disconnect
+#else
static int usb_audio_probe(struct usb_interface *intf,
const struct usb_device_id *id);
static void usb_audio_disconnect(struct usb_interface *intf);
-#else
-static void * usb_audio_probe(usb_device *dev, unsigned int ifnum,
- const struct usb_device_id *id);
-static void usb_audio_disconnect(struct usb_device *dev, void *ptr);
#endif
static struct usb_device_id usb_audio_ids [] = {
@@ -2050,18 +2068,9 @@ static int alloc_desc_buffer(struct usb_device *dev, int index, unsigned char **
* only at the first time. the successive calls of this function will
* append the pcm interface to the corresponding card.
*/
-#ifndef OLD_USB
-static int usb_audio_probe(struct usb_interface *intf,
- const struct usb_device_id *id)
-#else
-static void *usb_audio_probe(struct usb_device *dev, unsigned int ifnum,
+static void *_usb_audio_probe(struct usb_device *dev, unsigned int ifnum,
const struct usb_device_id *id)
-#endif
{
-#ifndef OLD_USB
- struct usb_device *dev = interface_to_usbdev(intf);
- int ifnum = intf->altsetting->bInterfaceNumber;
-#endif
struct usb_config_descriptor *config = dev->actconfig;
const snd_usb_audio_quirk_t *quirk = (const snd_usb_audio_quirk_t *)id->driver_info;
unsigned char *buffer;
@@ -2143,37 +2152,21 @@ static void *usb_audio_probe(struct usb_device *dev, unsigned int ifnum,
chip->num_interfaces++;
up(&register_mutex);
kfree(buffer);
-#ifndef OLD_USB
- return 0;
-#else
return chip;
-#endif
__error:
up(&register_mutex);
kfree(buffer);
__err_val:
-#ifndef OLD_USB
- return -EIO;
-#else
return NULL;
-#endif
}
-
/*
* we need to take care of counter, since disconnection can be called also
* many times as well as usb_audio_probe().
*/
-#ifndef OLD_USB
-static void usb_audio_disconnect(struct usb_interface *intf)
-#else
-static void usb_audio_disconnect(struct usb_device *dev, void *ptr)
-#endif
+static void _usb_audio_disconnect(struct usb_device *dev, void *ptr)
{
-#ifndef OLD_USB
- void *ptr = dev_get_drvdata(&intf->dev);
-#endif
snd_usb_audio_t *chip;
if (ptr == (void *)-1)
@@ -2185,6 +2178,34 @@ static void usb_audio_disconnect(struct usb_device *dev, void *ptr)
snd_card_free(chip->card);
}
+
+#ifndef OLD_USB
+/*
+ * new 2.5 USB kernel API
+ */
+
+static int usb_audio_probe(struct usb_interface *intf,
+ const struct usb_device_id *id)
+{
+ void *chip;
+ chip = _usb_audio_probe(interface_to_usbdev(intf),
+ intf->altsetting->bInterfaceNumber, id);
+ if (chip) {
+ dev_set_drvdata(&intf->dev, chip);
+ return 0;
+ } else
+ return -EIO;
+}
+
+static void usb_audio_disconnect(struct usb_interface *intf)
+{
+ _usb_audio_disconnect(interface_to_usbdev(intf),
+ dev_get_drvdata(&intf->dev));
+}
+#endif
+
+
+
static int __init snd_usb_audio_init(void)
{
usb_register(&usb_audio_driver);