summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@suse.cz>2003-01-27 19:43:41 +0100
committerJaroslav Kysela <perex@suse.cz>2003-01-27 19:43:41 +0100
commit191c011abbb58966ab1ec30421e082f9802f2c8d (patch)
tree0923e50f05c5dd972e558700dad623034c9f4ad6
parent6a3354a951d40d2f8e98317626eb3f88a4952818 (diff)
ALSA update
- removed some 2.2 code - PCM - fixed memory leak for 24-bit samples - gameport cleanups (CS4231, ENS1370/1371, SonicVibes, Trident) - VIA82xx - fixed current pointer calculation - sound_firmware - fixed errno problem - USB - moved out compatibility code
-rw-r--r--Documentation/sound/alsa/ALSA-Configuration.txt3
-rw-r--r--Documentation/sound/alsa/CMIPCI.txt15
-rw-r--r--include/sound/version.h2
-rw-r--r--sound/core/control.c11
-rw-r--r--sound/core/info.c9
-rw-r--r--sound/core/init.c6
-rw-r--r--sound/core/ioctl32/ioctl32.c7
-rw-r--r--sound/core/oss/mixer_oss.c9
-rw-r--r--sound/core/oss/pcm_oss.c11
-rw-r--r--sound/core/pcm_misc.c1
-rw-r--r--sound/core/pcm_native.c11
-rw-r--r--sound/core/rawmidi.c9
-rw-r--r--sound/core/rtctimer.c2
-rw-r--r--sound/core/seq/oss/seq_oss_init.c6
-rw-r--r--sound/core/seq/oss/seq_oss_midi.c1
-rw-r--r--sound/core/seq/seq_clientmgr.c7
-rw-r--r--sound/core/timer.c6
-rw-r--r--sound/drivers/serial-u16550.c29
-rw-r--r--sound/isa/gus/gus_main.c6
-rw-r--r--sound/isa/wavefront/wavefront_fx.c6
-rw-r--r--sound/isa/wavefront/wavefront_synth.c6
-rw-r--r--sound/pci/Kconfig4
-rw-r--r--sound/pci/ac97/ac97_codec.c13
-rw-r--r--sound/pci/ali5451/ali5451.c2
-rw-r--r--sound/pci/cs4281.c14
-rw-r--r--sound/pci/cs46xx/cs46xx_lib.c12
-rw-r--r--sound/pci/ens1370.c10
-rw-r--r--sound/pci/es1938.c10
-rw-r--r--sound/pci/fm801.c74
-rw-r--r--sound/pci/intel8x0.c7
-rw-r--r--sound/pci/rme9652/hammerfall_mem.c7
-rw-r--r--sound/pci/sonicvibes.c10
-rw-r--r--sound/pci/trident/trident_main.c10
-rw-r--r--sound/pci/via82xx.c66
-rw-r--r--sound/ppc/keywest.c1
-rw-r--r--sound/sound_firmware.c21
-rw-r--r--sound/synth/emux/emux_seq.c7
-rw-r--r--sound/usb/usbaudio.c42
-rw-r--r--sound/usb/usbaudio.h4
-rw-r--r--sound/usb/usbmidi.c24
40 files changed, 224 insertions, 277 deletions
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt
index 9acb5a3ef5d5..264bb1368ec8 100644
--- a/Documentation/sound/alsa/ALSA-Configuration.txt
+++ b/Documentation/sound/alsa/ALSA-Configuration.txt
@@ -748,7 +748,8 @@ Module parameters
Module snd-rme32
----------------
- Module for RME Digi32, Digi32/8 and Digi32 PRO soundcards.
+ Module for RME Digi32, Digi32 Pro and Digi32/8 (Sek'd Prodif32,
+ Prodif96 and Prodif Gold) soundcards.
Module supports up to 8 cards.
diff --git a/Documentation/sound/alsa/CMIPCI.txt b/Documentation/sound/alsa/CMIPCI.txt
index 582781b64b13..dc717523f865 100644
--- a/Documentation/sound/alsa/CMIPCI.txt
+++ b/Documentation/sound/alsa/CMIPCI.txt
@@ -82,9 +82,15 @@ as you like and set the format S16LE. For example, for playback with
and use the interleaved 4 channel data.
-There is a control switch, "Line-In As Bass". As you can imagine from
-its name, the line-in jack is used for the bass (5th and 6th channels)
-output.
+There are some control switchs affecting to the speaker connections:
+
+"Line-In As Rear" - As mentioned above, the line-in jack is used
+ for the rear (3th and 4th channels) output.
+"Line-In As Bass" - The line-in jack is used for the bass (5th
+ and 6th channels) output.
+"Mic As Center/LFE" - The mic jack is used for the bass output.
+ If this switch is on, you cannot use a microphone as a capture
+ source, of course.
Digital I/O
@@ -134,8 +140,7 @@ Additionally there are relevant control switches:
(see the next section).
"IEC958 In Select" - Select SPDIF input, the internal CD-in (false)
- and the external input (true). This switch appears only on
- the chip models 039 or later.
+ and the external input (true).
"IEC958 Loop" - SPDIF input data is loop back into SPDIF
output (aka bypass)
diff --git a/include/sound/version.h b/include/sound/version.h
index a0166739358d..a4c7d9a7cd3a 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.0rc6"
-#define CONFIG_SND_DATE " (Tue Dec 17 19:01:13 2002 UTC)"
+#define CONFIG_SND_DATE " (Thu Dec 26 11:57:42 2002 UTC)"
diff --git a/sound/core/control.c b/sound/core/control.c
index 85a0a656c5b8..31173c043e10 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -48,9 +48,6 @@ static int snd_ctl_open(struct inode *inode, struct file *file)
snd_ctl_file_t *ctl;
int err;
-#ifdef LINUX_2_2
- MOD_INC_USE_COUNT;
-#endif
card = snd_cards[cardnum];
if (!card) {
err = -ENODEV;
@@ -82,13 +79,10 @@ static int snd_ctl_open(struct inode *inode, struct file *file)
return 0;
__error:
- module_put(card->module);
+ module_put(card->module);
__error2:
snd_card_file_remove(card, file);
__error1:
-#ifdef LINUX_2_2
- MOD_DEC_USE_COUNT;
-#endif
return err;
}
@@ -131,9 +125,6 @@ static int snd_ctl_release(struct inode *inode, struct file *file)
snd_magic_kfree(ctl);
module_put(card->module);
snd_card_file_remove(card, file);
-#ifdef LINUX_2_2
- MOD_DEC_USE_COUNT;
-#endif
return 0;
}
diff --git a/sound/core/info.c b/sound/core/info.c
index 45bf36503596..b4e85fb69c21 100644
--- a/sound/core/info.c
+++ b/sound/core/info.c
@@ -293,9 +293,6 @@ static int snd_info_entry_open(struct inode *inode, struct file *file)
up(&info_mutex);
return -ENODEV;
}
-#ifdef LINUX_2_2
- MOD_INC_USE_COUNT;
-#endif
if (!try_module_get(entry->module)) {
err = -EFAULT;
goto __error1;
@@ -403,9 +400,6 @@ static int snd_info_entry_open(struct inode *inode, struct file *file)
__error:
module_put(entry->module);
__error1:
-#ifdef LINUX_2_2
- MOD_DEC_USE_COUNT;
-#endif
up(&info_mutex);
return err;
}
@@ -445,9 +439,6 @@ static int snd_info_entry_release(struct inode *inode, struct file *file)
break;
}
module_put(entry->module);
-#ifdef LINUX_2_2
- MOD_DEC_USE_COUNT;
-#endif
snd_magic_kfree(data);
return 0;
}
diff --git a/sound/core/init.c b/sound/core/init.c
index bc320cb1d2bd..26aa3d323c12 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -292,15 +292,17 @@ int snd_card_free(snd_card_t * card)
static void snd_card_free_thread(void * __card)
{
snd_card_t *card = __card;
- struct module * module;
+ struct module * module = card->module;
- if (!try_module_get(module = card->module)) {
+ if (!try_module_get(module)) {
snd_printk(KERN_ERR "unable to lock toplevel module for card %i in free thread\n", card->number);
module = NULL;
}
wait_event(card->shutdown_sleep, card->files == NULL);
+
snd_card_free(card);
+
module_put(module);
}
diff --git a/sound/core/ioctl32/ioctl32.c b/sound/core/ioctl32/ioctl32.c
index c8183837f8b0..4c2e37a01ee4 100644
--- a/sound/core/ioctl32/ioctl32.c
+++ b/sound/core/ioctl32/ioctl32.c
@@ -249,14 +249,17 @@ static int get_ctl_type(struct file *file, snd_ctl_elem_id_t *id)
ctl = snd_magic_cast(snd_ctl_file_t, file->private_data, return -ENXIO);
+ read_lock(&ctl->card->control_rwlock);
kctl = snd_ctl_find_id(ctl->card, id);
- if (! kctl)
+ if (! kctl) {
+ read_unlock(&ctl->card->control_rwlock);
return -ENXIO;
-
+ }
info.id = *id;
err = kctl->info(kctl, &info);
if (err >= 0)
err = info.type;
+ read_unlock(&ctl->card->control_rwlock);
return err;
}
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c
index c4c6d4d3ff59..63c69c5519a4 100644
--- a/sound/core/oss/mixer_oss.c
+++ b/sound/core/oss/mixer_oss.c
@@ -56,14 +56,8 @@ static int snd_mixer_oss_open(struct inode *inode, struct file *file)
fmixer->card = card;
fmixer->mixer = card->mixer_oss;
file->private_data = fmixer;
-#ifdef LINUX_2_2
- MOD_INC_USE_COUNT;
-#endif
if (!try_module_get(card->module)) {
kfree(fmixer);
-#ifdef LINUX_2_2
- MOD_DEC_USE_COUNT;
-#endif
snd_card_file_remove(card, file);
return -EFAULT;
}
@@ -77,9 +71,6 @@ static int snd_mixer_oss_release(struct inode *inode, struct file *file)
if (file->private_data) {
fmixer = (snd_mixer_oss_file_t *) file->private_data;
module_put(fmixer->card->module);
-#ifdef LINUX_2_2
- MOD_DEC_USE_COUNT;
-#endif
snd_card_file_remove(fmixer->card, file);
kfree(fmixer);
}
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index 4c7d5c33f134..ac284d748d3d 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -1540,9 +1540,6 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file)
device = SNDRV_MINOR_OSS_DEVICE(minor) == SNDRV_MINOR_OSS_PCM1 ?
adsp_map[cardnum] : dsp_map[cardnum];
-#ifdef LINUX_2_2
- MOD_INC_USE_COUNT;
-#endif
pcm = snd_pcm_devices[(cardnum * SNDRV_PCM_DEVICES) + device];
if (pcm == NULL) {
err = -ENODEV;
@@ -1611,13 +1608,10 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file)
return err;
__error:
- module_put(pcm->card->module);
+ module_put(pcm->card->module);
__error2:
snd_card_file_remove(pcm->card, file);
__error1:
-#ifdef LINUX_2_2
- MOD_DEC_USE_COUNT;
-#endif
return err;
}
@@ -1640,9 +1634,6 @@ static int snd_pcm_oss_release(struct inode *inode, struct file *file)
wake_up(&pcm->open_wait);
module_put(pcm->card->module);
snd_card_file_remove(pcm->card, file);
-#ifdef LINUX_2_2
- MOD_DEC_USE_COUNT;
-#endif
return 0;
}
diff --git a/sound/core/pcm_misc.c b/sound/core/pcm_misc.c
index cb6a8ca8895d..38a87b6d69eb 100644
--- a/sound/core/pcm_misc.c
+++ b/sound/core/pcm_misc.c
@@ -497,6 +497,7 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int
#endif
}
}
+ break;
}
case 32: {
u_int32_t silence = snd_pcm_format_silence_64(format);
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 405fe698896e..ce21615f6c92 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -76,6 +76,8 @@ static inline void snd_leave_user(mm_segment_t fs)
set_fs(fs);
}
+
+
int snd_pcm_info(snd_pcm_substream_t * substream, snd_pcm_info_t *info)
{
snd_pcm_runtime_t * runtime;
@@ -1779,9 +1781,6 @@ int snd_pcm_open(struct inode *inode, struct file *file)
snd_pcm_file_t *pcm_file;
wait_queue_t wait;
-#ifdef LINUX_2_2
- MOD_INC_USE_COUNT;
-#endif
snd_runtime_check(device >= SNDRV_MINOR_PCM_PLAYBACK && device < SNDRV_MINOR_DEVICES, return -ENXIO);
pcm = snd_pcm_devices[(cardnum * SNDRV_PCM_DEVICES) + (device % SNDRV_MINOR_PCMS)];
if (pcm == NULL) {
@@ -1829,9 +1828,6 @@ int snd_pcm_open(struct inode *inode, struct file *file)
__error2:
snd_card_file_remove(pcm->card, file);
__error1:
-#ifdef LINUX_2_2
- MOD_DEC_USE_COUNT;
-#endif
return err;
}
@@ -1857,9 +1853,6 @@ int snd_pcm_release(struct inode *inode, struct file *file)
wake_up(&pcm->open_wait);
module_put(pcm->card->module);
snd_card_file_remove(pcm->card, file);
-#ifdef LINUX_2_2
- MOD_DEC_USE_COUNT;
-#endif
return 0;
}
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index 301445309d17..061cb55fa1e1 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -181,9 +181,6 @@ int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice,
if (rfile)
rfile->input = rfile->output = NULL;
-#ifdef LINUX_2_2
- MOD_INC_USE_COUNT;
-#endif
rmidi = snd_rawmidi_devices[(cardnum * SNDRV_RAWMIDI_DEVICES) + device];
if (rmidi == NULL) {
err = -ENODEV;
@@ -342,9 +339,6 @@ int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice,
module_put(rmidi->card->module);
up(&rmidi->open_mutex);
__error1:
-#ifdef LINUX_2_2
- MOD_DEC_USE_COUNT;
-#endif
return err;
}
@@ -499,9 +493,6 @@ int snd_rawmidi_kernel_release(snd_rawmidi_file_t * rfile)
}
up(&rmidi->open_mutex);
module_put(rmidi->card->module);
-#ifdef LINUX_2_2
- MOD_DEC_USE_COUNT;
-#endif
return 0;
}
diff --git a/sound/core/rtctimer.c b/sound/core/rtctimer.c
index a2ef3839cb19..7b30c7ac513b 100644
--- a/sound/core/rtctimer.c
+++ b/sound/core/rtctimer.c
@@ -83,7 +83,6 @@ rtctimer_open(snd_timer_t *t)
if (err < 0)
return err;
t->private_data = &rtc_task;
- MOD_INC_USE_COUNT;
return 0;
}
@@ -95,7 +94,6 @@ rtctimer_close(snd_timer_t *t)
rtc_unregister(rtc);
t->private_data = NULL;
}
- MOD_DEC_USE_COUNT;
return 0;
}
diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c
index efc14b72a4c0..2d632ecd64c1 100644
--- a/sound/core/seq/oss/seq_oss_init.c
+++ b/sound/core/seq/oss/seq_oss_init.c
@@ -275,9 +275,6 @@ snd_seq_oss_open(struct file *file, int level)
client_table[dp->index] = dp;
num_clients++;
-#ifdef LINUX_2_2
- MOD_INC_USE_COUNT;
-#endif
debug_printk(("open done\n"));
@@ -434,9 +431,6 @@ snd_seq_oss_release(seq_oss_devinfo_t *dp)
if (dp->queue >= 0)
delete_seq_queue(dp);
-#ifdef LINUX_2_2
- MOD_DEC_USE_COUNT;
-#endif
debug_printk(("release done\n"));
}
diff --git a/sound/core/seq/oss/seq_oss_midi.c b/sound/core/seq/oss/seq_oss_midi.c
index a1d481e483db..8c98a6b4ef38 100644
--- a/sound/core/seq/oss/seq_oss_midi.c
+++ b/sound/core/seq/oss/seq_oss_midi.c
@@ -217,7 +217,6 @@ snd_seq_oss_midi_check_new_port(snd_seq_port_info_t *pinfo)
midi_devs[mdev->seq_device] = mdev;
spin_unlock_irqrestore(&register_lock, flags);
- /*MOD_INC_USE_COUNT;*/
return 0;
}
diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
index 7b5aa6687266..6df90a100613 100644
--- a/sound/core/seq/seq_clientmgr.c
+++ b/sound/core/seq/seq_clientmgr.c
@@ -339,10 +339,6 @@ static int snd_seq_open(struct inode *inode, struct file *file)
/* make others aware this new client */
snd_seq_system_client_ev_client_start(c);
-#ifdef LINUX_2_2
- MOD_INC_USE_COUNT;
-#endif
-
return 0;
}
@@ -358,9 +354,6 @@ static int snd_seq_release(struct inode *inode, struct file *file)
kfree(client);
}
-#ifdef LINUX_2_2
- MOD_DEC_USE_COUNT;
-#endif
return 0;
}
diff --git a/sound/core/timer.c b/sound/core/timer.c
index b386bdeb48c8..e39e4f22ab43 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -942,9 +942,6 @@ static int snd_timer_user_open(struct inode *inode, struct file *file)
return -ENOMEM;
}
file->private_data = tu;
-#ifdef LINUX_2_2
- MOD_INC_USE_COUNT;
-#endif
return 0;
}
@@ -961,9 +958,6 @@ static int snd_timer_user_release(struct inode *inode, struct file *file)
kfree(tu->queue);
snd_magic_kfree(tu);
}
-#ifdef LINUX_2_2
- MOD_DEC_USE_COUNT;
-#endif
return 0;
}
diff --git a/sound/drivers/serial-u16550.c b/sound/drivers/serial-u16550.c
index 60e64ff05563..b99f5154f00a 100644
--- a/sound/drivers/serial-u16550.c
+++ b/sound/drivers/serial-u16550.c
@@ -322,17 +322,20 @@ static void snd_uart16550_buffer_timer(unsigned long data)
* return 0 if found
* return negative error if not found
*/
-static int __init snd_uart16550_detect(unsigned int io_base)
+static int __init snd_uart16550_detect(snd_uart16550_t *uart)
{
+ unsigned long io_base = uart->base;
int ok;
unsigned char c;
- if (check_region(io_base, 8))
- return -EBUSY;
-
/* Do some vague tests for the presence of the uart */
- if (io_base == 0)
+ if (io_base == 0) {
return -ENODEV; /* Not configured */
+ }
+
+ uart->res_base = request_region(io_base, 8, "Serial MIDI");
+ if (uart->res_base == NULL)
+ return -EBUSY;
ok = 1; /* uart detected unless one of the following tests should fail */
/* 8 data-bits, 1 stop-bit, parity off, DLAB = 0 */
@@ -766,11 +769,13 @@ static int __init snd_uart16550_create(snd_card_t * card,
uart->card = card;
spin_lock_init(&uart->open_lock);
uart->irq = -1;
- if ((uart->res_base = request_region(iobase, 8, "Serial MIDI")) == NULL) {
- snd_printk("unable to grab ports 0x%lx-0x%lx\n", iobase, iobase + 8 - 1);
- return -EBUSY;
- }
uart->base = iobase;
+
+ if ((err = snd_uart16550_detect(uart)) <= 0) {
+ printk(KERN_ERR "no UART detected at 0x%lx\n", iobase);
+ return err;
+ }
+
if (irq >= 0) {
if (request_irq(irq, snd_uart16550_interrupt,
SA_INTERRUPT, "Serial MIDI", (void *) uart)) {
@@ -888,12 +893,6 @@ static int __init snd_serial_probe(int dev)
strcpy(card->driver, "Serial");
strcpy(card->shortname, "Serial midi (uart16550A)");
- if ((err = snd_uart16550_detect(port[dev])) <= 0) {
- snd_card_free(card);
- printk(KERN_ERR "no UART detected at 0x%lx\n", (long)port[dev]);
- return err;
- }
-
if ((err = snd_uart16550_create(card,
port[dev],
irq[dev],
diff --git a/sound/isa/gus/gus_main.c b/sound/isa/gus/gus_main.c
index 7a9adec95248..7ff31280b1f9 100644
--- a/sound/isa/gus/gus_main.c
+++ b/sound/isa/gus/gus_main.c
@@ -41,18 +41,14 @@ static int snd_gus_init_dma_irq(snd_gus_card_t * gus, int latches);
int snd_gus_use_inc(snd_gus_card_t * gus)
{
- MOD_INC_USE_COUNT;
- if (!try_module_get(gus->card->module)) {
- MOD_DEC_USE_COUNT;
+ if (!try_module_get(gus->card->module))
return 0;
- }
return 1;
}
void snd_gus_use_dec(snd_gus_card_t * gus)
{
module_put(gus->card->module);
- MOD_DEC_USE_COUNT;
}
static int snd_gus_joystick_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
diff --git a/sound/isa/wavefront/wavefront_fx.c b/sound/isa/wavefront/wavefront_fx.c
index a9de8cb5dff2..b1b1962fc55a 100644
--- a/sound/isa/wavefront/wavefront_fx.c
+++ b/sound/isa/wavefront/wavefront_fx.c
@@ -144,11 +144,8 @@ int
snd_wavefront_fx_open (snd_hwdep_t *hw, struct file *file)
{
- MOD_INC_USE_COUNT;
- if (!try_module_get(hw->card->module)) {
- MOD_DEC_USE_COUNT;
+ if (!try_module_get(hw->card->module))
return -EFAULT;
- }
file->private_data = hw;
return 0;
}
@@ -158,7 +155,6 @@ snd_wavefront_fx_release (snd_hwdep_t *hw, struct file *file)
{
module_put(hw->card->module);
- MOD_DEC_USE_COUNT;
return 0;
}
diff --git a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c
index 88b88d23c3fd..359457d549dd 100644
--- a/sound/isa/wavefront/wavefront_synth.c
+++ b/sound/isa/wavefront/wavefront_synth.c
@@ -1603,11 +1603,8 @@ int
snd_wavefront_synth_open (snd_hwdep_t *hw, struct file *file)
{
- MOD_INC_USE_COUNT;
- if (!try_module_get(hw->card->module)) {
- MOD_DEC_USE_COUNT;
+ if (!try_module_get(hw->card->module))
return -EFAULT;
- }
file->private_data = hw;
return 0;
}
@@ -1617,7 +1614,6 @@ snd_wavefront_synth_release (snd_hwdep_t *hw, struct file *file)
{
module_put(hw->card->module);
- MOD_DEC_USE_COUNT;
return 0;
}
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig
index d675b5103c8b..d5bca86c637e 100644
--- a/sound/pci/Kconfig
+++ b/sound/pci/Kconfig
@@ -51,8 +51,8 @@ config SND_RME32
tristate "RME Digi32, 32/8, 32 PRO"
depends on SND
help
- Say 'Y' or 'M' to include support for RME Digi32, Digi32/8 and
- Digi32 PRO audio devices.
+ Say 'Y' or 'M' to include support for RME Digi32, Digi32 PRO and
+ Digi32/8 (Sek'd Prodif32, Prodif96 and Prodif Gold) audio devices.
config SND_RME96
tristate "RME Digi96, 96/8, 96/8 PRO"
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index 19f155712df4..a02b6e8ef8f5 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -671,6 +671,11 @@ AC97_DOUBLE("Surround Playback Switch", AC97_SURROUND_MASTER, 15, 7, 1, 1),
AC97_DOUBLE("Surround Playback Volume", AC97_SURROUND_MASTER, 8, 0, 31, 1),
};
+static const snd_kcontrol_new_t snd_ac97_sigmatel_surround[2] = {
+AC97_SINGLE("Sigmatel Surround Playback Switch", AC97_HEADPHONE, 15, 1, 1),
+AC97_DOUBLE("Sigmatel Surround Playback Volume", AC97_HEADPHONE, 8, 0, 31, 1)
+};
+
static const snd_kcontrol_new_t snd_ac97_sigmatel_controls[] = {
AC97_SINGLE("Sigmatel DAC 6dB Attenuate", AC97_SIGMATEL_ANALOG, 1, 1, 0),
AC97_SINGLE("Sigmatel ADC 6dB Attenuate", AC97_SIGMATEL_ANALOG, 0, 1, 0)
@@ -1236,6 +1241,7 @@ static snd_kcontrol_t *snd_ac97_cnew(const snd_kcontrol_new_t *_template, ac97_t
static int snd_ac97_mixer_build(snd_card_t * card, ac97_t * ac97)
{
snd_kcontrol_t *kctl;
+ const snd_kcontrol_new_t *knew;
int err, idx;
unsigned char max;
@@ -1291,10 +1297,11 @@ static int snd_ac97_mixer_build(snd_card_t * card, ac97_t * ac97)
}
/* build headphone controls */
- if (snd_ac97_try_volume_mix(ac97, AC97_HEADPHONE)) {
- if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_headphone[0], ac97))) < 0)
+ if (snd_ac97_try_volume_mix(ac97, AC97_HEADPHONE) || ac97->id == AC97_ID_STAC9708) {
+ knew = ac97->id == AC97_ID_STAC9708 ? snd_ac97_sigmatel_surround : snd_ac97_controls_headphone;
+ if ((err = snd_ctl_add(card, snd_ac97_cnew(knew, ac97))) < 0)
return err;
- if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_headphone[1], ac97))) < 0)
+ if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(knew + 1, ac97))) < 0)
return err;
snd_ac97_change_volume_params1(ac97, AC97_HEADPHONE, &max);
kctl->private_value &= ~(0xff << 16);
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index 2f426d67dd05..f05aeb5fbb5a 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -67,7 +67,7 @@ MODULE_PARM_DESC(pcm_channels, "PCM Channels");
MODULE_PARM_SYNTAX(pcm_channels, SNDRV_ENABLED ",default:32,allows:{{1,32}}");
/*
- * Debug part definitions
+ * Debug part definations
*/
//#define ALI_DEBUG
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c
index 3185a948c546..a9468e9e127c 100644
--- a/sound/pci/cs4281.c
+++ b/sound/pci/cs4281.c
@@ -26,6 +26,7 @@
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/slab.h>
+#include <linux/gameport.h>
#include <sound/core.h>
#include <sound/control.h>
#include <sound/pcm.h>
@@ -35,9 +36,6 @@
#define SNDRV_GET_ID
#include <sound/initval.h>
-#ifndef LINUX_2_2
-#include <linux/gameport.h>
-#endif
MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
MODULE_DESCRIPTION("Cirrus Logic CS4281");
@@ -1309,7 +1307,7 @@ static void snd_cs4281_proc_done(cs4281_t * chip)
* joystick support
*/
-#ifndef LINUX_2_2
+#if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)
typedef struct snd_cs4281_gameport {
struct gameport info;
@@ -1399,7 +1397,9 @@ static void __devinit snd_cs4281_gameport(cs4281_t *chip)
gameport_register_port(&gp->info);
}
-#endif /* !LINUX_2_2 */
+#else
+#define snd_cs4281_gameport(chip) /*NOP*/
+#endif /* CONFIG_GAMEPORT || CONFIG_GAMEPORT_MODULE */
/*
@@ -1408,7 +1408,7 @@ static void __devinit snd_cs4281_gameport(cs4281_t *chip)
static int snd_cs4281_free(cs4281_t *chip)
{
-#ifndef LINUX_2_2
+#if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)
if (chip->gameport) {
gameport_unregister_port(&chip->gameport->info);
kfree(chip->gameport);
@@ -2041,9 +2041,7 @@ static int __devinit snd_cs4281_probe(struct pci_dev *pci,
snd_card_free(card);
return err;
}
-#ifndef LINUX_2_2
snd_cs4281_gameport(chip);
-#endif
strcpy(card->driver, "CS4281");
strcpy(card->shortname, "Cirrus Logic CS4281");
sprintf(card->longname, "%s at 0x%lx, irq %d",
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
index 03bd93443ec5..d4a97f58c4dd 100644
--- a/sound/pci/cs46xx/cs46xx_lib.c
+++ b/sound/pci/cs46xx/cs46xx_lib.c
@@ -52,14 +52,12 @@
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/slab.h>
+#include <linux/gameport.h>
#include <sound/core.h>
#include <sound/control.h>
#include <sound/info.h>
#include <sound/cs46xx.h>
-#ifndef LINUX_2_2
-#include <linux/gameport.h>
-#endif
#include <asm/io.h>
@@ -2740,7 +2738,7 @@ int __devinit snd_cs46xx_midi(cs46xx_t *chip, int device, snd_rawmidi_t **rrawmi
* gameport interface
*/
-#ifndef LINUX_2_2
+#if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)
typedef struct snd_cs46xx_gameport {
struct gameport info;
@@ -2824,13 +2822,13 @@ void __devinit snd_cs46xx_gameport(cs46xx_t *chip)
gameport_register_port(&gp->info);
}
-#else /* LINUX_2_2 */
+#else
void __devinit snd_cs46xx_gameport(cs46xx_t *chip)
{
}
-#endif /* !LINUX_2_2 */
+#endif /* CONFIG_GAMEPORT */
/*
* proc interface
@@ -2972,7 +2970,7 @@ static int snd_cs46xx_free(cs46xx_t *chip)
if (chip->active_ctrl)
chip->active_ctrl(chip, 1);
-#ifndef LINUX_2_2
+#if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)
if (chip->gameport) {
gameport_unregister_port(&chip->gameport->info);
kfree(chip->gameport);
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index 8ae6d3756ea5..1b3c1f7b3036 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -405,8 +405,10 @@ struct _snd_ensoniq {
dma_addr_t bugbuf_addr;
#endif
+#if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)
struct gameport gameport;
struct semaphore joy_sem; // gameport configuration semaphore
+#endif
};
static void snd_audiopci_interrupt(int irq, void *dev_id, struct pt_regs *regs);
@@ -1576,6 +1578,7 @@ static int __devinit snd_ensoniq_1370_mixer(ensoniq_t * ensoniq)
* General Switches...
*/
+#if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)
/* MQ: gameport driver connectivity */
#define ENSONIQ_JOY_CONTROL(xname, mask) \
{ .iface = SNDRV_CTL_ELEM_IFACE_CARD, .name = xname, .info = snd_ensoniq_control_info, \
@@ -1693,6 +1696,7 @@ static snd_kcontrol_new_t snd_es1371_joystick_addr __devinitdata =
ES1371_JOYSTICK_ADDR("Joystick Address");
#endif /* CHIP1371 */
+#endif /* CONFIG_GAMEPORT */
/*
@@ -1749,8 +1753,10 @@ static void snd_ensoniq_proc_done(ensoniq_t * ensoniq)
static int snd_ensoniq_free(ensoniq_t *ensoniq)
{
+#if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)
if (ensoniq->ctrl & ES_JYSTK_EN)
snd_ensoniq_joy_disable(ensoniq);
+#endif
snd_ensoniq_proc_done(ensoniq);
if (ensoniq->irq < 0)
goto __hw_end;
@@ -1831,7 +1837,6 @@ static int __devinit snd_ensoniq_create(snd_card_t * card,
if (ensoniq == NULL)
return -ENOMEM;
spin_lock_init(&ensoniq->reg_lock);
- init_MUTEX(&ensoniq->joy_sem);
ensoniq->card = card;
ensoniq->pci = pci;
ensoniq->irq = -1;
@@ -1946,11 +1951,14 @@ static int __devinit snd_ensoniq_create(snd_card_t * card,
outb(ensoniq->uartc = 0x00, ES_REG(ensoniq, UART_CONTROL));
outb(0x00, ES_REG(ensoniq, UART_RES));
outl(ensoniq->cssr, ES_REG(ensoniq, STATUS));
+#if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)
+ init_MUTEX(&ensoniq->joy_sem);
#ifdef CHIP1371
snd_ctl_add(card, snd_ctl_new1(&snd_es1371_joystick_addr, ensoniq));
#endif
snd_ctl_add(card, snd_ctl_new1(&snd_ensoniq_control_joystick, ensoniq));
ensoniq->gameport.io = 0x200; // FIXME: is ES1371 configured like this above ?
+#endif
synchronize_irq(ensoniq->irq);
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, ensoniq, &ops)) < 0) {
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c
index 268e4ac18f48..0b91028e2768 100644
--- a/sound/pci/es1938.c
+++ b/sound/pci/es1938.c
@@ -52,6 +52,7 @@
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/slab.h>
+#include <linux/gameport.h>
#include <sound/core.h>
#include <sound/control.h>
#include <sound/pcm.h>
@@ -59,9 +60,6 @@
#include <sound/mpu401.h>
#define SNDRV_GET_ID
#include <sound/initval.h>
-#ifndef LINUX_2_2
-#include <linux/gameport.h>
-#endif
#include <asm/io.h>
@@ -248,7 +246,7 @@ struct _snd_es1938 {
spinlock_t mixer_lock;
snd_info_entry_t *proc_entry;
-#ifndef LINUX_2_2
+#if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)
struct gameport gameport;
#endif
};
@@ -1328,7 +1326,7 @@ ES1938_SINGLE("Mic Boost (+26dB)", 0, 0x7d, 3, 1, 0)
static int snd_es1938_free(es1938_t *chip)
{
-#ifndef LINUX_2_2
+#if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)
if (chip->gameport.io)
gameport_unregister_port(&chip->gameport);
#endif
@@ -1645,7 +1643,7 @@ static int __devinit snd_es1938_probe(struct pci_dev *pci,
chip->mpu_port, 1, chip->irq, 0, &chip->rmidi) < 0) {
printk(KERN_ERR "es1938: unable to initialize MPU-401\n");
}
-#ifndef LINUX_2_2
+#if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)
chip->gameport.io = chip->game_port;
gameport_register_port(&chip->gameport);
#endif
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
index 1b9216c6b758..88cd1dac6d1b 100644
--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -312,48 +312,66 @@ static int snd_fm801_playback_trigger(snd_pcm_substream_t * substream,
int cmd)
{
fm801_t *chip = snd_pcm_substream_chip(substream);
- int result = 0;
spin_lock(&chip->reg_lock);
- if (cmd == SNDRV_PCM_TRIGGER_START) {
+ switch (cmd) {
+ case SNDRV_PCM_TRIGGER_START:
chip->ply_ctrl &= ~(FM801_BUF1_LAST |
FM801_BUF2_LAST |
FM801_PAUSE);
chip->ply_ctrl |= FM801_START |
FM801_IMMED_STOP;
- outw(chip->ply_ctrl, FM801_REG(chip, PLY_CTRL));
- } else if (cmd == SNDRV_PCM_TRIGGER_STOP) {
- chip->ply_ctrl &= ~FM801_START;
- outw(chip->ply_ctrl, FM801_REG(chip, PLY_CTRL));
- } else {
- result = -EINVAL;
+ break;
+ case SNDRV_PCM_TRIGGER_STOP:
+ chip->ply_ctrl &= ~(FM801_START | FM801_PAUSE);
+ break;
+ case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
+ chip->ply_ctrl |= FM801_PAUSE;
+ break;
+ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
+ chip->ply_ctrl &= ~FM801_PAUSE;
+ break;
+ default:
+ spin_unlock(&chip->reg_lock);
+ snd_BUG();
+ return -EINVAL;
}
+ outw(chip->ply_ctrl, FM801_REG(chip, PLY_CTRL));
spin_unlock(&chip->reg_lock);
- return result;
+ return 0;
}
static int snd_fm801_capture_trigger(snd_pcm_substream_t * substream,
int cmd)
{
fm801_t *chip = snd_pcm_substream_chip(substream);
- int result = 0;
spin_lock(&chip->reg_lock);
- if (cmd == SNDRV_PCM_TRIGGER_START) {
+ switch (cmd) {
+ case SNDRV_PCM_TRIGGER_START:
chip->cap_ctrl &= ~(FM801_BUF1_LAST |
FM801_BUF2_LAST |
FM801_PAUSE);
chip->cap_ctrl |= FM801_START |
FM801_IMMED_STOP;
- outw(chip->cap_ctrl, FM801_REG(chip, CAP_CTRL));
- } else if (cmd == SNDRV_PCM_TRIGGER_STOP) {
- chip->cap_ctrl &= ~FM801_START;
- outw(chip->cap_ctrl, FM801_REG(chip, CAP_CTRL));
- } else {
- result = -EINVAL;
+ break;
+ case SNDRV_PCM_TRIGGER_STOP:
+ chip->cap_ctrl &= ~(FM801_START | FM801_PAUSE);
+ break;
+ case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
+ chip->cap_ctrl |= FM801_PAUSE;
+ break;
+ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
+ chip->cap_ctrl &= ~FM801_PAUSE;
+ break;
+ default:
+ spin_unlock(&chip->reg_lock);
+ snd_BUG();
+ return -EINVAL;
}
+ outw(chip->cap_ctrl, FM801_REG(chip, CAP_CTRL));
spin_unlock(&chip->reg_lock);
- return result;
+ return 0;
}
static int snd_fm801_hw_params(snd_pcm_substream_t * substream,
@@ -470,8 +488,11 @@ static void snd_fm801_interrupt(int irq, void *dev_id, struct pt_regs *regs)
unsigned int tmp;
status = inw(FM801_REG(chip, IRQ_STATUS));
- if ((status & (FM801_IRQ_PLAYBACK|FM801_IRQ_CAPTURE|FM801_IRQ_MPU|FM801_IRQ_VOLUME)) == 0)
+ status &= FM801_IRQ_PLAYBACK|FM801_IRQ_CAPTURE|FM801_IRQ_MPU|FM801_IRQ_VOLUME;
+ if (! status)
return;
+ /* ack first */
+ outw(status, FM801_REG(chip, IRQ_STATUS));
if (chip->pcm && (status & FM801_IRQ_PLAYBACK) && chip->playback_substream) {
spin_lock(&chip->reg_lock);
chip->ply_buf++;
@@ -483,7 +504,6 @@ static void snd_fm801_interrupt(int irq, void *dev_id, struct pt_regs *regs)
(chip->ply_buf & 1) ?
FM801_REG(chip, PLY_BUF1) :
FM801_REG(chip, PLY_BUF2));
- outw(FM801_IRQ_PLAYBACK, FM801_REG(chip, IRQ_STATUS));
spin_unlock(&chip->reg_lock);
snd_pcm_period_elapsed(chip->playback_substream);
}
@@ -498,24 +518,20 @@ static void snd_fm801_interrupt(int irq, void *dev_id, struct pt_regs *regs)
(chip->cap_buf & 1) ?
FM801_REG(chip, CAP_BUF1) :
FM801_REG(chip, CAP_BUF2));
- outw(FM801_IRQ_CAPTURE, FM801_REG(chip, IRQ_STATUS));
spin_unlock(&chip->reg_lock);
snd_pcm_period_elapsed(chip->capture_substream);
}
- if ((status & FM801_IRQ_MPU) && chip->rmidi != NULL) {
+ if (chip->rmidi && (status & FM801_IRQ_MPU))
snd_mpu401_uart_interrupt(irq, chip->rmidi->private_data, regs);
- outw(FM801_IRQ_MPU, FM801_REG(chip, IRQ_STATUS));
- }
- if (status & FM801_IRQ_VOLUME) {
- /* TODO */
- outw(FM801_IRQ_VOLUME, FM801_REG(chip, IRQ_STATUS));
- }
+ if (status & FM801_IRQ_VOLUME)
+ ;/* TODO */
}
static snd_pcm_hardware_t snd_fm801_playback =
{
.info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER |
+ SNDRV_PCM_INFO_PAUSE |
SNDRV_PCM_INFO_MMAP_VALID),
.formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE,
.rates = SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_8000_48000,
@@ -535,6 +551,7 @@ static snd_pcm_hardware_t snd_fm801_capture =
{
.info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER |
+ SNDRV_PCM_INFO_PAUSE |
SNDRV_PCM_INFO_MMAP_VALID),
.formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE,
.rates = SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_8000_48000,
@@ -822,6 +839,7 @@ FM801_SINGLE("AC97 18-bit Switch", FM801_CODEC_CTRL, 10, 1, 0),
FM801_SINGLE("IEC958 Capture Switch", FM801_I2S_MODE, 8, 1, 0),
FM801_SINGLE("IEC958 Raw Data Playback Switch", FM801_I2S_MODE, 9, 1, 0),
FM801_SINGLE("IEC958 Raw Data Capture Switch", FM801_I2S_MODE, 10, 1, 0),
+FM801_SINGLE("IEC958 Playback Switch", FM801_GEN_CTRL, 2, 1, 0),
};
static void snd_fm801_mixer_free_ac97(ac97_t *ac97)
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index bf051b78385c..392178381d5e 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -131,6 +131,9 @@ MODULE_PARM_SYNTAX(mpu_port, SNDRV_ENABLED ",allows:{{0},{0x330},{0x300}},dialog
#ifndef PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO
#define PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO 0x006a
#endif
+#ifndef PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO
+#define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO 0x00da
+#endif
enum { DEVICE_INTEL, DEVICE_INTEL_ICH4, DEVICE_SIS, DEVICE_ALI };
@@ -388,6 +391,7 @@ static struct pci_device_id snd_intel8x0_ids[] __devinitdata = {
{ 0x1039, 0x7012, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_SIS }, /* SI7012 */
{ 0x10de, 0x01b1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* NFORCE */
{ 0x10de, 0x006a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* NFORCE2 */
+ { 0x10de, 0x00da, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* NFORCE3 */
{ 0x1022, 0x746d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* AMD8111 */
{ 0x1022, 0x7445, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* AMD768 */
{ 0x10b9, 0x5455, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_ALI }, /* Ali5455 */
@@ -2247,7 +2251,7 @@ static int __devinit snd_intel8x0_create(snd_card_t * card,
chip->bdbars_count = 3;
if (device_type == DEVICE_INTEL_ICH4 || device_type == DEVICE_ALI)
chip->bdbars_count = 6;
- chip->bdbars = (u32 *)snd_malloc_pci_pages(pci, chip->bdbars_count * sizeof(unsigned int) * ICH_MAX_FRAGS * 2, &chip->bdbars_addr);
+ chip->bdbars = (u32 *)snd_malloc_pci_pages(pci, chip->bdbars_count * sizeof(u32) * ICH_MAX_FRAGS * 2, &chip->bdbars_addr);
if (chip->bdbars == NULL) {
snd_intel8x0_free(chip);
return -ENOMEM;
@@ -2304,6 +2308,7 @@ static struct shortname_table {
{ PCI_DEVICE_ID_SI_7012, "SiS SI7012" },
{ PCI_DEVICE_ID_NVIDIA_MCP_AUDIO, "NVidia NForce" },
{ PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO, "NVidia NForce2" },
+ { PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO, "NVidia NForce3" },
{ 0x746d, "AMD AMD8111" },
{ 0x7445, "AMD AMD768" },
{ 0x5455, "ALi M5455" },
diff --git a/sound/pci/rme9652/hammerfall_mem.c b/sound/pci/rme9652/hammerfall_mem.c
index 2705ca915220..067ce2c18fb0 100644
--- a/sound/pci/rme9652/hammerfall_mem.c
+++ b/sound/pci/rme9652/hammerfall_mem.c
@@ -25,7 +25,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- $Id: hammerfall_mem.c,v 1.5 2002/11/04 09:11:42 perex Exp $
+ $Id: hammerfall_mem.c,v 1.6 2002/12/19 15:59:18 tiwai Exp $
Tue Oct 17 2000 Jaroslav Kysela <perex@suse.cz>
@@ -150,9 +150,10 @@ void *snd_hammerfall_get_buffer (struct pci_dev *pcidev, dma_addr_t *dmaaddr)
for (i = 0; i < NBUFS; i++) {
rbuf = &hammerfall_buffers[i];
if (rbuf->flags == HAMMERFALL_BUF_ALLOCATED) {
+ if (! try_module_get(THIS_MODULE))
+ return NULL;
rbuf->flags |= HAMMERFALL_BUF_USED;
rbuf->pci = pcidev;
- MOD_INC_USE_COUNT;
*dmaaddr = rbuf->addr;
return rbuf->buf;
}
@@ -169,8 +170,8 @@ void snd_hammerfall_free_buffer (struct pci_dev *pcidev, void *addr)
for (i = 0; i < NBUFS; i++) {
rbuf = &hammerfall_buffers[i];
if (rbuf->buf == addr && rbuf->pci == pcidev) {
- MOD_DEC_USE_COUNT;
rbuf->flags &= ~HAMMERFALL_BUF_USED;
+ module_put(THIS_MODULE);
return;
}
}
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c
index 7a883d517208..5f1767c27cf0 100644
--- a/sound/pci/sonicvibes.c
+++ b/sound/pci/sonicvibes.c
@@ -28,6 +28,7 @@
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/slab.h>
+#include <linux/gameport.h>
#include <sound/core.h>
#include <sound/pcm.h>
@@ -37,9 +38,6 @@
#include <sound/opl3.h>
#define SNDRV_GET_ID
#include <sound/initval.h>
-#ifndef LINUX_2_2
-#include <linux/gameport.h>
-#endif
#include <asm/io.h>
@@ -257,7 +255,7 @@ struct _snd_sonicvibes {
snd_kcontrol_t *master_mute;
snd_kcontrol_t *master_volume;
-#ifndef LINUX_2_2
+#if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)
struct gameport gameport;
#endif
};
@@ -1208,7 +1206,7 @@ SONICVIBES_SINGLE("Joystick Speed", 0, SV_IREG_GAME_PORT, 1, 15, 0);
static int snd_sonicvibes_free(sonicvibes_t *sonic)
{
-#ifndef LINUX_2_2
+#if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)
if (sonic->gameport.io)
gameport_unregister_port(&sonic->gameport);
#endif
@@ -1512,7 +1510,7 @@ static int __devinit snd_sonic_probe(struct pci_dev *pci,
snd_card_free(card);
return err;
}
-#ifndef LINUX_2_2
+#if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)
sonic->gameport.io = sonic->game_port;
gameport_register_port(&sonic->gameport);
#endif
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c
index c0e7811e086a..0e3496c3c7e0 100644
--- a/sound/pci/trident/trident_main.c
+++ b/sound/pci/trident/trident_main.c
@@ -34,15 +34,13 @@
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
+#include <linux/gameport.h>
#include <sound/core.h>
#include <sound/info.h>
#include <sound/control.h>
#include <sound/trident.h>
#include <sound/asoundef.h>
-#ifndef LINUX_2_2
-#include <linux/gameport.h>
-#endif
#include <asm/io.h>
@@ -2987,7 +2985,7 @@ static int __devinit snd_trident_mixer(trident_t * trident, int pcm_spdif_device
/*
* gameport interface
*/
-#ifndef LINUX_2_2
+#if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)
typedef struct snd_trident_gameport {
struct gameport info;
@@ -3076,7 +3074,7 @@ void __devinit snd_trident_gameport(trident_t *chip)
void __devinit snd_trident_gameport(trident_t *chip)
{
}
-#endif
+#endif /* CONFIG_GAMEPORT */
/*
* SiS reset routine
@@ -3482,7 +3480,7 @@ int __devinit snd_trident_create(snd_card_t * card,
int snd_trident_free(trident_t *trident)
{
-#ifndef LINUX_2_2
+#if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)
if (trident->gameport) {
gameport_unregister_port(&trident->gameport->info);
kfree(trident->gameport);
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index 8e431d5066fb..8a0f92d265fd 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -40,6 +40,10 @@
#define SNDRV_GET_ID
#include <sound/initval.h>
+#if 0
+#define POINTER_DEBUG
+#endif
+
MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
MODULE_DESCRIPTION("VIA VT82xx audio");
MODULE_LICENSE("GPL");
@@ -198,6 +202,9 @@ typedef struct {
u32 *table; /* physical address + flag */
dma_addr_t table_addr;
struct snd_via_sg_table *idx_table;
+ unsigned int lastpos;
+ unsigned int bufsize;
+ unsigned int bufsize2;
} viadev_t;
@@ -208,9 +215,9 @@ typedef struct {
*/
static int build_via_table(viadev_t *dev, snd_pcm_substream_t *substream,
struct pci_dev *pci,
- int periods, int fragsize)
+ unsigned int periods, unsigned int fragsize)
{
- int i, idx, ofs, rest;
+ unsigned int i, idx, ofs, rest;
struct snd_sg_buf *sgbuf = snd_magic_cast(snd_pcm_sgbuf_t, substream->dma_private, return -EINVAL);
if (! dev->table) {
@@ -237,8 +244,13 @@ static int build_via_table(viadev_t *dev, snd_pcm_substream_t *substream,
* over page boundary.
*/
do {
- int r;
+ unsigned int r;
unsigned int flag;
+
+ if (idx >= VIA_TABLE_SIZE) {
+ snd_printk(KERN_ERR "via82xx: too much table size!\n");
+ return -EINVAL;
+ }
dev->table[idx << 1] = cpu_to_le32((u32)snd_pcm_sgbuf_get_addr(sgbuf, ofs));
r = PAGE_SIZE - (ofs % PAGE_SIZE);
if (rest < r)
@@ -257,13 +269,11 @@ static int build_via_table(viadev_t *dev, snd_pcm_substream_t *substream,
dev->idx_table[idx].size = r;
ofs += r;
idx++;
- if (idx >= VIA_TABLE_SIZE) {
- snd_printk(KERN_ERR "via82xx: too much table size!\n");
- return -EINVAL;
- }
} while (rest > 0);
}
dev->tbl_entries = idx;
+ dev->bufsize = periods * fragsize;
+ dev->bufsize2 = dev->bufsize / 2;
return 0;
}
@@ -439,6 +449,7 @@ static void snd_via82xx_channel_reset(via82xx_t *chip, viadev_t *viadev)
outb(0x03, port + VIA_REG_OFFSET_STATUS);
outb(0x00, port + VIA_REG_OFFSET_TYPE); /* for via686 */
outl(0, port + VIA_REG_OFFSET_CURR_PTR);
+ viadev->lastpos = 0;
}
static int snd_via82xx_trigger(via82xx_t *chip, viadev_t *viadev, int cmd)
@@ -641,19 +652,22 @@ static int snd_via82xx_capture_prepare(snd_pcm_substream_t * substream)
static inline unsigned int snd_via82xx_cur_ptr(via82xx_t *chip, viadev_t *viadev)
{
- unsigned int val, ptr, count;
-
+ unsigned int val, ptr, count, res;
+
snd_assert(viadev->tbl_entries, return 0);
if (!(inb(VIAREG(chip, OFFSET_STATUS) + viadev->reg_offset) & VIA_REG_STAT_ACTIVE))
return 0;
- count = inl(VIAREG(chip, OFFSET_CURR_COUNT) + viadev->reg_offset) & 0xffffff;
+ spin_lock(&chip->reg_lock);
+
switch (chip->chip_type) {
case TYPE_VIA686:
+ count &= 0xffffff;
/* The via686a does not have the current index register,
* so we need to calculate the index from CURR_PTR.
*/
ptr = inl(VIAREG(chip, OFFSET_CURR_PTR) + viadev->reg_offset);
+ count = inl(VIAREG(chip, OFFSET_CURR_COUNT) + viadev->reg_offset) & 0xffffff;
if (ptr <= (unsigned int)viadev->table_addr)
val = 0;
else /* CURR_PTR holds the address + 8 */
@@ -662,14 +676,37 @@ static inline unsigned int snd_via82xx_cur_ptr(via82xx_t *chip, viadev_t *viadev
case TYPE_VIA8233:
default:
- /* ah, this register makes life easier for us here. */
- val = inb(VIAREG(chip, OFFSET_CURR_INDEX) + viadev->reg_offset) % viadev->tbl_entries;
+ count = inl(VIAREG(chip, OFFSET_CURR_COUNT) + viadev->reg_offset);
+ val = count >> 24;
+ count &= 0xffffff;
break;
}
/* convert to the linear position */
- return viadev->idx_table[val].offset +
- viadev->idx_table[val].size - count;
+ ptr = viadev->idx_table[val].size;
+ res = viadev->idx_table[val].offset + ptr - count;
+
+ if (ptr < count || (res < viadev->lastpos && (res >= viadev->bufsize2 || viadev->lastpos < viadev->bufsize2))) {
+#ifdef POINTER_DEBUG
+ printk("fail: val = %i/%i, lastpos = 0x%x, bufsize2 = 0x%x, offsize = 0x%x, size = 0x%x, count = 0x%x\n", val, viadev->tbl_entries, viadev->lastpos, viadev->bufsize2, viadev->idx_table[val].offset, viadev->idx_table[val].size, count);
+#endif
+ /* VIA8233 count register returns full size when end of buffer is reached */
+ if (ptr != count) {
+ snd_printk("invalid via82xx_cur_ptr, using last valid pointer\n");
+ res = viadev->lastpos;
+ } else {
+ res = viadev->idx_table[val].offset + ptr;
+ if (res < viadev->lastpos && (res >= viadev->bufsize2 || viadev->lastpos < viadev->bufsize2)) {
+ snd_printk("invalid via82xx_cur_ptr (2), using last valid pointer\n");
+ res = viadev->lastpos;
+ }
+ }
+ }
+
+ viadev->lastpos = res;
+ spin_unlock(&chip->reg_lock);
+
+ return res;
}
static snd_pcm_uframes_t snd_via82xx_playback_pointer(snd_pcm_substream_t * substream)
@@ -1224,7 +1261,6 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
return err;
}
-
if (snd_via82xx_mixer(chip) < 0) {
snd_card_free(card);
return err;
diff --git a/sound/ppc/keywest.c b/sound/ppc/keywest.c
index b9f3e96741ce..52b95a8079d3 100644
--- a/sound/ppc/keywest.c
+++ b/sound/ppc/keywest.c
@@ -22,6 +22,7 @@
#include <sound/driver.h>
#include <linux/init.h>
#include <linux/i2c.h>
+#include <linux/delay.h>
#include <linux/i2c-dev.h>
#include <linux/slab.h>
#include <sound/core.h>
diff --git a/sound/sound_firmware.c b/sound/sound_firmware.c
index cfd9a322e463..f6e57a3e18f6 100644
--- a/sound/sound_firmware.c
+++ b/sound/sound_firmware.c
@@ -9,39 +9,40 @@
static int do_mod_firmware_load(const char *fn, char **fp)
{
- int fd;
+ struct file* filp;
long l;
char *dp;
+ loff_t pos;
- fd = open(fn, 0, 0);
- if (fd == -1)
+ filp = filp_open(fn, 0, 0);
+ if (IS_ERR(filp))
{
printk(KERN_INFO "Unable to load '%s'.\n", fn);
return 0;
}
- l = lseek(fd, 0L, 2);
+ l = filp->f_dentry->d_inode->i_size;
if (l <= 0 || l > 131072)
{
printk(KERN_INFO "Invalid firmware '%s'\n", fn);
- sys_close(fd);
+ filp_close(filp, current->files);
return 0;
}
- lseek(fd, 0L, 0);
dp = vmalloc(l);
if (dp == NULL)
{
printk(KERN_INFO "Out of memory loading '%s'.\n", fn);
- sys_close(fd);
+ filp_close(filp, current->files);
return 0;
}
- if (read(fd, dp, l) != l)
+ pos = 0;
+ if (vfs_read(filp, dp, l, &pos) != l)
{
printk(KERN_INFO "Failed to read '%s'.\n", fn);
vfree(dp);
- sys_close(fd);
+ filp_close(filp, current->files);
return 0;
}
- close(fd);
+ filp_close(filp, current->files);
*fp = dp;
return (int) l;
}
diff --git a/sound/synth/emux/emux_seq.c b/sound/synth/emux/emux_seq.c
index a06961482fa5..5855b356fd53 100644
--- a/sound/synth/emux/emux_seq.c
+++ b/sound/synth/emux/emux_seq.c
@@ -59,9 +59,6 @@ static snd_midi_op_t emux_ops = {
SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE)
/*
- */
-
-/*
* Initialise the EMUX Synth by creating a client and registering
* a series of ports.
* Each of the ports will contain the 16 midi channels. Applications
@@ -292,11 +289,11 @@ snd_emux_inc_count(snd_emux_t *emu)
void
snd_emux_dec_count(snd_emux_t *emu)
{
- module_put(emu->ops.owner);
+ module_put(emu->card->module);
emu->used--;
if (emu->used <= 0)
snd_emux_terminate_all(emu);
- module_put(emu->card->module);
+ module_put(emu->ops.owner);
}
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index bc1d7f7b18de..66e2c95adb32 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -526,11 +526,7 @@ static struct snd_urb_ops audio_urb_ops[2] = {
/*
* complete callback from data urb
*/
-#ifndef OLD_USB
static void snd_complete_urb(struct urb *urb, struct pt_regs *regs)
-#else
-static void snd_complete_urb(struct urb *urb)
-#endif
{
snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context;
snd_usb_substream_t *subs = ctx->subs;
@@ -555,11 +551,7 @@ static void snd_complete_urb(struct urb *urb)
/*
* complete callback from sync urb
*/
-#ifndef OLD_USB
static void snd_complete_sync_urb(struct urb *urb, struct pt_regs *regs)
-#else
-static void snd_complete_sync_urb(struct urb *urb)
-#endif
{
snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context;
snd_usb_substream_t *subs = ctx->subs;
@@ -881,7 +873,7 @@ static int init_substream_urbs(snd_usb_substream_t *subs, snd_pcm_runtime_t *run
u->urb->transfer_flags = URB_ISO_ASAP | UNLINK_FLAGS;
u->urb->number_of_packets = u->packets;
u->urb->context = u;
- u->urb->complete = (usb_complete_t)snd_complete_urb;
+ u->urb->complete = snd_usb_complete_callback(snd_complete_urb);
}
if (subs->syncpipe) {
@@ -903,7 +895,7 @@ static int init_substream_urbs(snd_usb_substream_t *subs, snd_pcm_runtime_t *run
u->urb->transfer_flags = URB_ISO_ASAP | UNLINK_FLAGS;
u->urb->number_of_packets = u->packets;
u->urb->context = u;
- u->urb->complete = (usb_complete_t)snd_complete_sync_urb;
+ u->urb->complete = snd_usb_complete_callback(snd_complete_sync_urb);
}
}
return 0;
@@ -1325,11 +1317,7 @@ void *snd_usb_find_csint_desc(void *buffer, int buflen, void *after, u8 dsubtype
* entry point for linux usb interface
*/
-#ifdef 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);
-#else
+#ifndef OLD_USB
static int usb_audio_probe(struct usb_interface *intf,
const struct usb_device_id *id);
static void usb_audio_disconnect(struct usb_interface *intf);
@@ -2295,25 +2283,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr)
}
}
-
-#ifdef OLD_USB
-
-/*
- * 2.4 USB kernel API
- */
-static void *usb_audio_probe(struct usb_device *dev, unsigned int ifnum,
- const struct usb_device_id *id)
-{
- return snd_usb_audio_probe(dev, usb_ifnum_to_if(dev, ifnum), id);
-}
-
-static void usb_audio_disconnect(struct usb_device *dev, void *ptr)
-{
- snd_usb_audio_disconnect(dev, ptr);
-}
-
-#else
-
+#ifndef OLD_USB
/*
* new 2.5 USB kernel API
*/
@@ -2323,7 +2293,7 @@ static int usb_audio_probe(struct usb_interface *intf,
void *chip;
chip = snd_usb_audio_probe(interface_to_usbdev(intf), intf, id);
if (chip) {
- usb_set_intfdata(intf, chip);
+ dev_set_drvdata(&intf->dev, chip);
return 0;
} else
return -EIO;
@@ -2332,7 +2302,7 @@ static int usb_audio_probe(struct usb_interface *intf,
static void usb_audio_disconnect(struct usb_interface *intf)
{
snd_usb_audio_disconnect(interface_to_usbdev(intf),
- usb_get_intfdata(intf));
+ dev_get_drvdata(&intf->dev));
}
#endif
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
index de9bdb965a7c..2160937c9036 100644
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -208,4 +208,8 @@ int snd_usb_create_midi_interface(snd_usb_audio_t *chip, struct usb_interface *i
#define usb_pipe_needs_resubmit(pipe) 1
#endif
+#ifndef snd_usb_complete_callback
+#define snd_usb_complete_callback(x) (x)
+#endif
+
#endif /* __USBAUDIO_H */
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c
index a8a184b922bc..10e71356d5de 100644
--- a/sound/usb/usbmidi.c
+++ b/sound/usb/usbmidi.c
@@ -172,11 +172,7 @@ static void snd_usbmidi_input_packet(snd_usb_midi_in_endpoint_t* ep,
/*
* Processes the data read from the device.
*/
-#ifndef OLD_USB
static void snd_usbmidi_in_urb_complete(struct urb* urb, struct pt_regs *regs)
-#else
-static void snd_usbmidi_in_urb_complete(struct urb* urb)
-#endif
{
snd_usb_midi_in_endpoint_t* ep = snd_magic_cast(snd_usb_midi_in_endpoint_t, urb->context, return);
@@ -201,11 +197,7 @@ static void snd_usbmidi_in_urb_complete(struct urb* urb)
/*
* Converts the data read from a Midiman device to standard USB MIDI packets.
*/
-#ifndef OLD_USB
static void snd_usbmidi_in_midiman_complete(struct urb* urb, struct pt_regs *regs)
-#else
-static void snd_usbmidi_in_midiman_complete(struct urb* urb)
-#endif
{
if (urb->status == 0) {
uint8_t* buffer = (uint8_t*)urb->transfer_buffer;
@@ -231,18 +223,10 @@ static void snd_usbmidi_in_midiman_complete(struct urb* urb)
}
}
}
-#ifndef OLD_USB
snd_usbmidi_in_urb_complete(urb, regs);
-#else
- snd_usbmidi_in_urb_complete(urb);
-#endif
}
-#ifndef OLD_USB
static void snd_usbmidi_out_urb_complete(struct urb* urb, struct pt_regs *regs)
-#else
-static void snd_usbmidi_out_urb_complete(struct urb* urb)
-#endif
{
snd_usb_midi_out_endpoint_t* ep = snd_magic_cast(snd_usb_midi_out_endpoint_t, urb->context, return);
@@ -606,11 +590,11 @@ static int snd_usbmidi_in_endpoint_create(snd_usb_midi_t* umidi,
}
if (int_epd)
usb_fill_int_urb(ep->urb, umidi->chip->dev, pipe, buffer, length,
- (usb_complete_t)snd_usbmidi_in_urb_complete,
+ snd_usb_complete_callback(snd_usbmidi_in_urb_complete),
ep, int_epd->bInterval);
else
usb_fill_bulk_urb(ep->urb, umidi->chip->dev, pipe, buffer, length,
- (usb_complete_t)snd_usbmidi_in_urb_complete,
+ snd_usb_complete_callback(snd_usbmidi_in_urb_complete),
ep);
rep->in = ep;
@@ -677,7 +661,7 @@ static int snd_usbmidi_out_endpoint_create(snd_usb_midi_t* umidi,
}
usb_fill_bulk_urb(ep->urb, umidi->chip->dev, pipe, buffer,
ep->max_transfer,
- (usb_complete_t)snd_usbmidi_out_urb_complete, ep);
+ snd_usb_complete_callback(snd_usbmidi_out_urb_complete), ep);
spin_lock_init(&ep->buffer_lock);
tasklet_init(&ep->tasklet, snd_usbmidi_out_tasklet, (unsigned long)ep);
@@ -967,7 +951,7 @@ static int snd_usbmidi_create_endpoints_midiman(snd_usb_midi_t* umidi,
err = snd_usbmidi_in_endpoint_create(umidi, &ep_info, &umidi->endpoints[0]);
if (err < 0)
return err;
- umidi->endpoints[0].in->urb->complete = (usb_complete_t)snd_usbmidi_in_midiman_complete;
+ umidi->endpoints[0].in->urb->complete = snd_usb_complete_callback(snd_usbmidi_in_midiman_complete);
if (endpoint->out_cables > 0x0001) {
ep_info.epnum = get_endpoint(hostif, 4)->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;