[PATCH] ALSA update for 2.5.5-pre1
authorJaroslav Kysela <perex@suse.cz>
Tue, 19 Feb 2002 06:35:21 +0000 (22:35 -0800)
committerJaroslav Kysela <perex@suse.cz>
Tue, 19 Feb 2002 06:35:21 +0000 (22:35 -0800)
this is a sync with the current ALSA CVS tree (last code
modification: (Sun Feb 17 17:46:41 2002 UTC)) and 2.5.5-pre1 code and
contains:

- ALSA code version 0.9.0beta11
- Config.in files updated (separated associated drivers to submenus)
- global sound/Makefile fixes
- added inclusion of missing header files for alpha architecture
- fixed power functions (bad locking)
- fixed copy_to_user calls (removed them from spinlocks)
- fixed freeing of resource structures
- fixed AD1816A driver (inverted volume controls)
- added new functions to allocate ISA DMA memory (cleanups in ISA drivers)
- updated ISA PnP detection in wavefront driver
- added joystick support for VIA686
- updated ES1968 (Maestro2) driver
- moved joystick support for YMFPCI to the control interface
- updated Korg1212 driver

187 files changed:
include/sound/asound.h
include/sound/core.h
include/sound/cs46xx.h
include/sound/emu8000.h
include/sound/emux_synth.h
include/sound/gus.h
include/sound/opl3.h
include/sound/pcm.h
include/sound/pcm_params.h
include/sound/seq_kernel.h
include/sound/trident.h
include/sound/version.h
include/sound/wavefront.h
include/sound/ymfpci.h
sound/Config.in
sound/Makefile
sound/core/Config.in
sound/core/control.c
sound/core/device.c
sound/core/hwdep.c
sound/core/info.c
sound/core/info_oss.c
sound/core/init.c
sound/core/isadma.c
sound/core/memory.c
sound/core/misc.c
sound/core/oss/copy.c
sound/core/oss/io.c
sound/core/oss/linear.c
sound/core/oss/mixer_oss.c
sound/core/oss/mulaw.c
sound/core/oss/pcm_oss.c
sound/core/oss/pcm_plugin.c
sound/core/oss/rate.c
sound/core/oss/route.c
sound/core/pcm.c
sound/core/pcm_lib.c
sound/core/pcm_memory.c
sound/core/pcm_misc.c
sound/core/pcm_native.c
sound/core/pcm_timer.c
sound/core/rawmidi.c
sound/core/rtctimer.c
sound/core/seq/instr/ainstr_fm.c
sound/core/seq/instr/ainstr_gf1.c
sound/core/seq/instr/ainstr_iw.c
sound/core/seq/instr/ainstr_simple.c
sound/core/seq/oss/seq_oss_device.h
sound/core/seq/seq_clientmgr.c
sound/core/seq/seq_device.c
sound/core/seq/seq_fifo.c
sound/core/seq/seq_instr.c
sound/core/seq/seq_lock.h
sound/core/seq/seq_memory.c
sound/core/seq/seq_midi.c
sound/core/seq/seq_midi_emul.c
sound/core/seq/seq_midi_event.c
sound/core/seq/seq_ports.c
sound/core/seq/seq_prioq.c
sound/core/seq/seq_queue.c
sound/core/seq/seq_timer.c
sound/core/seq/seq_virmidi.c
sound/core/sound.c
sound/core/sound_oss.c
sound/core/timer.c
sound/drivers/Config.in
sound/drivers/dummy.c
sound/drivers/mpu401/mpu401.c
sound/drivers/mpu401/mpu401_uart.c
sound/drivers/mtpav.c
sound/drivers/opl3/opl3_lib.c
sound/drivers/opl3/opl3_oss.c
sound/drivers/serial-u16550.c
sound/drivers/virmidi.c
sound/i2c/cs8427.c
sound/i2c/i2c.c
sound/i2c/tea6330t.c
sound/isa/Config.in
sound/isa/ad1816a/ad1816a.c
sound/isa/ad1816a/ad1816a_lib.c
sound/isa/ad1848/ad1848.c
sound/isa/ad1848/ad1848_lib.c
sound/isa/als100.c
sound/isa/azt2320.c
sound/isa/cmi8330.c
sound/isa/cs423x/cs4231.c
sound/isa/cs423x/cs4231_lib.c
sound/isa/cs423x/cs4236.c
sound/isa/cs423x/cs4236_lib.c
sound/isa/dt0197h.c
sound/isa/es1688/es1688.c
sound/isa/es1688/es1688_lib.c
sound/isa/es18xx.c
sound/isa/gus/gus_dma.c
sound/isa/gus/gus_dram.c
sound/isa/gus/gus_instr.c
sound/isa/gus/gus_io.c
sound/isa/gus/gus_main.c
sound/isa/gus/gus_mem.c
sound/isa/gus/gus_mem_proc.c
sound/isa/gus/gus_mixer.c
sound/isa/gus/gus_pcm.c
sound/isa/gus/gus_reset.c
sound/isa/gus/gus_sample.c
sound/isa/gus/gus_simple.c
sound/isa/gus/gus_synth.c
sound/isa/gus/gus_timer.c
sound/isa/gus/gus_uart.c
sound/isa/gus/gus_volume.c
sound/isa/gus/gusclassic.c
sound/isa/gus/gusextreme.c
sound/isa/gus/gusmax.c
sound/isa/gus/interwave.c
sound/isa/opl3sa2.c
sound/isa/opti9xx/opti92x-ad1848.c
sound/isa/sb/emu8000.c
sound/isa/sb/emu8000_local.h
sound/isa/sb/es968.c
sound/isa/sb/sb16.c
sound/isa/sb/sb16_csp.c
sound/isa/sb/sb16_main.c
sound/isa/sb/sb8.c
sound/isa/sb/sb8_main.c
sound/isa/sb/sb8_midi.c
sound/isa/sb/sb_common.c
sound/isa/sb/sb_mixer.c
sound/isa/sgalaxy.c
sound/isa/wavefront/wavefront.c
sound/isa/wavefront/wavefront_fx.c
sound/isa/wavefront/wavefront_midi.c
sound/isa/wavefront/wavefront_synth.c
sound/last.c
sound/pci/Config.in
sound/pci/ac97/Makefile
sound/pci/ac97/ac97_codec.c
sound/pci/ac97/ak4531_codec.c
sound/pci/ali5451/ali5451.c
sound/pci/als4000.c
sound/pci/cmipci.c
sound/pci/cs4281.c
sound/pci/cs46xx/cs46xx.c
sound/pci/cs46xx/cs46xx_lib.c
sound/pci/emu10k1/emu10k1.c
sound/pci/emu10k1/emu10k1_callback.c
sound/pci/emu10k1/emu10k1_main.c
sound/pci/emu10k1/emu10k1_synth_local.h
sound/pci/emu10k1/emufx.c
sound/pci/emu10k1/emumixer.c
sound/pci/emu10k1/emumpu401.c
sound/pci/emu10k1/emupcm.c
sound/pci/emu10k1/emuproc.c
sound/pci/emu10k1/io.c
sound/pci/emu10k1/irq.c
sound/pci/emu10k1/memory.c
sound/pci/emu10k1/voice.c
sound/pci/ens1370.c
sound/pci/es1938.c
sound/pci/es1968.c
sound/pci/fm801.c
sound/pci/ice1712.c
sound/pci/intel8x0.c
sound/pci/korg1212/korg1212.c
sound/pci/maestro3.c
sound/pci/nm256/nm256.c
sound/pci/rme96.c
sound/pci/rme9652/rme9652.c
sound/pci/sonicvibes.c
sound/pci/trident/trident.c
sound/pci/trident/trident_main.c
sound/pci/trident/trident_memory.c
sound/pci/trident/trident_synth.c
sound/pci/via686.c
sound/pci/via8233.c
sound/pci/ymfpci/ymfpci.c
sound/pci/ymfpci/ymfpci_main.c
sound/ppc/Config.in
sound/ppc/awacs.c
sound/ppc/pmac.c
sound/ppc/tumbler.c
sound/synth/emux/emux.c
sound/synth/emux/emux_effect.c
sound/synth/emux/emux_proc.c
sound/synth/emux/emux_seq.c
sound/synth/emux/emux_synth.c
sound/synth/emux/emux_voice.h
sound/synth/emux/soundfont.c
sound/synth/util_mem.c

index f613dbd..013e59f 100644 (file)
 #define __SOUND_ASOUND_H
 
 #if defined(LINUX) || defined(__LINUX__) || defined(__linux__)
+
 #include <linux/ioctl.h>
+
+#ifdef __KERNEL__
+
+#include <linux/types.h>
+#include <asm/byteorder.h>
+
+#if  __LITTLE_ENDIAN == 1234
+#define SNDRV_LITTLE_ENDIAN
+#elif __BIG_ENDIAN == 4321
+#define SNDRV_BIG_ENDIAN
+#else
+#error "Unsupported endian..."
+#endif
+
+#else /* !__KERNEL__ */
+
 #include <endian.h>
 #if __BYTE_ORDER == __LITTLE_ENDIAN
 #define SNDRV_LITTLE_ENDIAN
 #else
 #error "Unsupported endian..."
 #endif
-#endif
+
+#endif /* __KERNEL **/
+
+#endif /* LINUX */
+
 #ifndef __KERNEL__
 #include <sys/time.h>
 #include <sys/types.h>
index e216c6b..ebd845c 100644 (file)
@@ -132,7 +132,7 @@ struct _snd_card {
        int (*set_power_state) (snd_card_t *card, unsigned int state);
        void *power_state_private_data;
        unsigned int power_state;       /* power state */
-       unsigned int power_lock;        /* power lock */
+       struct semaphore power_lock;    /* power lock */
        wait_queue_head_t power_sleep;
 #endif
 
@@ -143,22 +143,17 @@ struct _snd_card {
 };
 
 #ifdef CONFIG_PM
-static inline void snd_power_lock(snd_card_t *card, int can_schedule)
+static inline void snd_power_lock(snd_card_t *card)
 {
-       while (test_and_set_bit(0, &card->power_lock)) {
-               if (can_schedule) {
-                       set_current_state(TASK_INTERRUPTIBLE);
-                        schedule_timeout(1);
-               }
-       }
+       down(&card->power_lock);
 }
 
 static inline void snd_power_unlock(snd_card_t *card)
 {
-       clear_bit(0, &card->power_lock);
+       up(&card->power_lock);
 }
 
-void snd_power_wait(snd_card_t *card, int can_schedule);
+void snd_power_wait(snd_card_t *card);
 
 static inline unsigned int snd_power_get_state(snd_card_t *card)
 {
@@ -171,9 +166,9 @@ static inline void snd_power_change_state(snd_card_t *card, unsigned int state)
        wake_up(&card->power_sleep);
 }
 #else
-#define snd_power_lock(card, can_schedule) do { ; } while (0)
+#define snd_power_lock(card) do { ; } while (0)
 #define snd_power_unlock(card) do { ; } while (0)
-#define snd_power_wait(card, can_schedule) do { ; } while (0)
+#define snd_power_wait(card) do { ; } while (0)
 #define snd_power_get_state(card) SNDRV_CTL_POWER_D0
 #define snd_power_change_state(card, state) do { ; } while (0)
 #endif
@@ -236,18 +231,26 @@ void *snd_hidden_vmalloc(unsigned long size);
 void snd_hidden_vfree(void *obj);
 #define kmalloc(size, flags) snd_hidden_kmalloc(size, flags)
 #define kfree(obj) snd_hidden_kfree(obj)
+#define kfree_nocheck(obj) snd_wrapper_kfree(obj)
 #define vmalloc(size) snd_hidden_vmalloc(size)
 #define vfree(obj) snd_hidden_vfree(obj)
+#else
+#define kfree_nocheck(obj) kfree(obj)
 #endif
 void *snd_kcalloc(size_t size, int flags);
 char *snd_kmalloc_strdup(const char *string, int flags);
 void *snd_malloc_pages(unsigned long size, unsigned int dma_flags);
 void *snd_malloc_pages_fallback(unsigned long size, unsigned int dma_flags, unsigned long *res_size);
 void snd_free_pages(void *ptr, unsigned long size);
+#ifdef CONFIG_ISA
+void *snd_malloc_isa_pages(unsigned long size, dma_addr_t *dma_addr);
+void *snd_malloc_isa_pages_fallback(unsigned long size, dma_addr_t *dma_addr, unsigned long *res_size);
+#define snd_free_isa_pages(size, ptr, dma_addr) snd_free_pages(ptr, size)
+#endif
 #ifdef CONFIG_PCI
-void *snd_malloc_pci_pages(struct pci_dev *pci, unsigned long size, dma_addr_t *dmaaddr);
-void *snd_malloc_pci_pages_fallback(struct pci_dev *pci, unsigned long size, dma_addr_t *dmaaddr, unsigned long *res_size);
-void snd_free_pci_pages(struct pci_dev *pci, unsigned long size, void *ptr, dma_addr_t dmaaddr);
+void *snd_malloc_pci_pages(struct pci_dev *pci, unsigned long size, dma_addr_t *dma_addr);
+void *snd_malloc_pci_pages_fallback(struct pci_dev *pci, unsigned long size, dma_addr_t *dma_addr, unsigned long *res_size);
+void snd_free_pci_pages(struct pci_dev *pci, unsigned long size, void *ptr, dma_addr_t dma_addr);
 #endif
 int copy_to_user_fromio(void *dst, unsigned long src, size_t count);
 int copy_from_user_toio(unsigned long dst, const void *src, size_t count);
@@ -282,7 +285,7 @@ int snd_device_free_all(snd_card_t *card, snd_device_cmd_t cmd);
 
 #define DMA_MODE_NO_ENABLE     0x0100
 
-void snd_dma_program(unsigned long dma, const void *buf, unsigned int size, unsigned short mode);
+void snd_dma_program(unsigned long dma, unsigned long addr, unsigned int size, unsigned short mode);
 void snd_dma_disable(unsigned long dma);
 unsigned int snd_dma_residue(unsigned long dma);
 
index 97176de..f900efa 100644 (file)
@@ -1713,8 +1713,8 @@ int snd_cs46xx_mixer(cs46xx_t *chip);
 int snd_cs46xx_midi(cs46xx_t *chip, int device, snd_rawmidi_t **rmidi);
 
 #ifdef CONFIG_PM
-void snd_cs46xx_suspend(cs46xx_t *chip, int can_schedule);
-void snd_cs46xx_resume(cs46xx_t *chip, int can_schedule);
+void snd_cs46xx_suspend(cs46xx_t *chip);
+void snd_cs46xx_resume(cs46xx_t *chip);
 #endif
 
 #endif /* __SOUND_CS46XX_H */
index abd21a6..78d8475 100644 (file)
@@ -21,8 +21,6 @@
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
-#include "driver.h"
-#include "core.h"
 #include "emux_synth.h"
 #include "seq_kernel.h"
 
index 25c4339..09ce125 100644 (file)
@@ -21,8 +21,6 @@
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
-#include "driver.h"
-#include "core.h"
 #include "seq_kernel.h"
 #include "seq_device.h"
 #include "soundfont.h"
index c24de2d..2e84f26 100644 (file)
@@ -216,6 +216,7 @@ typedef struct _snd_gf1_mem {
 
 typedef struct snd_gf1_dma_block {
        void *buffer;           /* buffer in computer's RAM */
+       unsigned long buf_addr; /* buffer address */
        unsigned int addr;      /* address in onboard memory */
        unsigned int count;     /* count in bytes */
        unsigned int cmd;       /* DMA command (format) */
@@ -605,7 +606,7 @@ int snd_gf1_mem_proc_done(snd_gus_card_t * gus);
 /* gus_dma.c */
 
 void snd_gf1_dma_program(snd_gus_card_t * gus, unsigned int addr,
-                        const void *buf, unsigned int count,
+                        unsigned long buf_addr, unsigned int count,
                         unsigned int cmd);
 void snd_gf1_dma_ack(snd_gus_card_t * gus);
 int snd_gf1_dma_init(snd_gus_card_t * gus);
index d2cf59f..c3c6218 100644 (file)
@@ -52,6 +52,7 @@
  */
 
 #include "driver.h"
+#include <linux/time.h>
 #include "core.h"
 #include "hwdep.h"
 #include "timer.h"
index 945313c..3d24d3c 100644 (file)
@@ -832,11 +832,9 @@ int snd_pcm_lib_free_pages(snd_pcm_substream_t *substream);
 
 #ifdef CONFIG_ISA
 int snd_pcm_lib_preallocate_isa_pages(snd_pcm_substream_t *substream,
-                                     size_t size, size_t max,
-                                     unsigned int flags);
+                                     size_t size, size_t max);
 int snd_pcm_lib_preallocate_isa_pages_for_all(snd_pcm_t *pcm,
-                                             size_t size, size_t max,
-                                             unsigned int flags);
+                                             size_t size, size_t max);
 #endif
 #ifdef CONFIG_PCI
 int snd_pcm_lib_preallocate_pci_pages(struct pci_dev *pci,
index 769d873..9d00865 100644 (file)
@@ -22,6 +22,8 @@
  *
  */
 
+#include <linux/bitops.h>
+
 extern int snd_pcm_hw_param_mask(snd_pcm_substream_t *pcm, snd_pcm_hw_params_t *params,
                                 snd_pcm_hw_param_t var, const snd_mask_t *val);
 extern unsigned int snd_pcm_hw_param_value_min(const snd_pcm_hw_params_t *params,
index a0e6302..69a7acf 100644 (file)
@@ -21,6 +21,7 @@
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  *
  */
+#include <linux/time.h>
 #include "asequencer.h"
 
 typedef sndrv_seq_tick_time_t snd_seq_tick_time_t;
index 572cc32..1d8b1c3 100644 (file)
@@ -469,8 +469,8 @@ int snd_trident_synth_copy_from_user(trident_t *trident, snd_util_memblk_t *blk,
 
 /* Power Management */
 #ifdef CONFIG_PM
-void snd_trident_suspend(trident_t *trident, int can_schedule);
-void snd_trident_resume(trident_t *trident, int can_schedule);
+void snd_trident_suspend(trident_t *trident);
+void snd_trident_resume(trident_t *trident);
 #endif
 
 #endif /* __SOUND_TRIDENT_H */
index cb3edc7..eac7e72 100644 (file)
@@ -1,2 +1,3 @@
 /* include/version.h.  Generated automatically by configure.  */
-#define CONFIG_SND_VERSION "0.9.0beta10"
+#define CONFIG_SND_VERSION "0.9.0beta11"
+#define CONFIG_SND_DATE " (Tue Feb 19 08:14:59 2002 UTC)"
index 1062084..79ff3b4 100644 (file)
    between a 16-bit view of the world and a 32-bit one. 
  */   
 
-typedef short INT16;
-typedef unsigned short UINT16;
-typedef int INT32;
-typedef unsigned int UINT32;
-typedef char CHAR8;
-typedef unsigned char UCHAR8;
+#ifndef __KERNEL__
+/* keep them for compatibility */
+typedef short s16;
+typedef unsigned short u16;
+typedef int s32;
+typedef unsigned int u32;
+typedef char s8;
+typedef unsigned char u8;
+typedef s16 INT16;
+typedef u16 UINT16;
+typedef s32 INT32;
+typedef u32 UINT32;
+typedef s8 CHAR8;
+typedef u8 UCHAR8;
+#endif
 
 /* Pseudo-commands not part of the WaveFront command set.
    These are used for various driver controls and direct
@@ -197,111 +206,111 @@ typedef unsigned char UCHAR8;
 
 struct wf_envelope
 {
-    UCHAR8 attack_time:7;
-    UCHAR8 Unused1:1;
+    u8 attack_time:7;
+    u8 Unused1:1;
 
-    UCHAR8 decay1_time:7;
-    UCHAR8 Unused2:1;
+    u8 decay1_time:7;
+    u8 Unused2:1;
 
-    UCHAR8 decay2_time:7;
-    UCHAR8 Unused3:1;
+    u8 decay2_time:7;
+    u8 Unused3:1;
 
-    UCHAR8 sustain_time:7;
-    UCHAR8 Unused4:1;
+    u8 sustain_time:7;
+    u8 Unused4:1;
 
-    UCHAR8 release_time:7;
-    UCHAR8 Unused5:1;
+    u8 release_time:7;
+    u8 Unused5:1;
 
-    UCHAR8 release2_time:7;
-    UCHAR8 Unused6:1;
+    u8 release2_time:7;
+    u8 Unused6:1;
 
-    CHAR8 attack_level;
-    CHAR8 decay1_level;
-    CHAR8 decay2_level;
-    CHAR8 sustain_level;
-    CHAR8 release_level;
+    s8 attack_level;
+    s8 decay1_level;
+    s8 decay2_level;
+    s8 sustain_level;
+    s8 release_level;
 
-    UCHAR8 attack_velocity:7;
-    UCHAR8 Unused7:1;
+    u8 attack_velocity:7;
+    u8 Unused7:1;
 
-    UCHAR8 volume_velocity:7;
-    UCHAR8 Unused8:1;
+    u8 volume_velocity:7;
+    u8 Unused8:1;
 
-    UCHAR8 keyboard_scaling:7;
-    UCHAR8 Unused9:1;
+    u8 keyboard_scaling:7;
+    u8 Unused9:1;
 };
 typedef struct wf_envelope wavefront_envelope;
 
 struct wf_lfo
 {
-    UCHAR8 sample_number;
+    u8 sample_number;
 
-    UCHAR8 frequency:7;
-    UCHAR8 Unused1:1;
+    u8 frequency:7;
+    u8 Unused1:1;
 
-    UCHAR8 am_src:4;
-    UCHAR8 fm_src:4;
+    u8 am_src:4;
+    u8 fm_src:4;
 
-    CHAR8 fm_amount;
-    CHAR8 am_amount;
-    CHAR8 start_level;
-    CHAR8 end_level;
+    s8 fm_amount;
+    s8 am_amount;
+    s8 start_level;
+    s8 end_level;
 
-    UCHAR8 ramp_delay:7;
-    UCHAR8 wave_restart:1; /* for LFO2 only */
+    u8 ramp_delay:7;
+    u8 wave_restart:1; /* for LFO2 only */
 
-    UCHAR8 ramp_time:7;
-    UCHAR8 Unused2:1;
+    u8 ramp_time:7;
+    u8 Unused2:1;
 };
 typedef struct wf_lfo wavefront_lfo;
 
 struct wf_patch
 {
-    INT16  frequency_bias;         /*  ** THIS IS IN MOTOROLA FORMAT!! ** */
+    s16  frequency_bias;         /*  ** THIS IS IN MOTOROLA FORMAT!! ** */
 
-    UCHAR8 amplitude_bias:7;
-    UCHAR8 Unused1:1;
+    u8 amplitude_bias:7;
+    u8 Unused1:1;
 
-    UCHAR8 portamento:7;
-    UCHAR8 Unused2:1;
+    u8 portamento:7;
+    u8 Unused2:1;
 
-    UCHAR8 sample_number;
+    u8 sample_number;
 
-    UCHAR8 pitch_bend:4;
-    UCHAR8 sample_msb:1;
-    UCHAR8 Unused3:3;
+    u8 pitch_bend:4;
+    u8 sample_msb:1;
+    u8 Unused3:3;
 
-    UCHAR8 mono:1;
-    UCHAR8 retrigger:1;
-    UCHAR8 nohold:1;
-    UCHAR8 restart:1;
-    UCHAR8 filterconfig:2; /* SDK says "not used" */
-    UCHAR8 reuse:1;
-    UCHAR8 reset_lfo:1;    
+    u8 mono:1;
+    u8 retrigger:1;
+    u8 nohold:1;
+    u8 restart:1;
+    u8 filterconfig:2; /* SDK says "not used" */
+    u8 reuse:1;
+    u8 reset_lfo:1;    
 
-    UCHAR8 fm_src2:4;
-    UCHAR8 fm_src1:4;   
+    u8 fm_src2:4;
+    u8 fm_src1:4;   
 
-    CHAR8 fm_amount1;
-    CHAR8 fm_amount2;
+    s8 fm_amount1;
+    s8 fm_amount2;
 
-    UCHAR8 am_src:4;
-    UCHAR8 Unused4:4;
+    u8 am_src:4;
+    u8 Unused4:4;
 
-    CHAR8 am_amount;
+    s8 am_amount;
 
-    UCHAR8 fc1_mode:4;
-    UCHAR8 fc2_mode:4;
+    u8 fc1_mode:4;
+    u8 fc2_mode:4;
 
-    CHAR8 fc1_mod_amount;
-    CHAR8 fc1_keyboard_scaling;
-    CHAR8 fc1_bias;
-    CHAR8 fc2_mod_amount;
-    CHAR8 fc2_keyboard_scaling;
-    CHAR8 fc2_bias;
+    s8 fc1_mod_amount;
+    s8 fc1_keyboard_scaling;
+    s8 fc1_bias;
+    s8 fc2_mod_amount;
+    s8 fc2_keyboard_scaling;
+    s8 fc2_bias;
 
-    UCHAR8 randomizer:7;
-    UCHAR8 Unused5:1;
+    u8 randomizer:7;
+    u8 Unused5:1;
 
     struct wf_envelope envelope1;
     struct wf_envelope envelope2;
@@ -312,18 +321,18 @@ typedef struct wf_patch wavefront_patch;
 
 struct wf_layer
 {
-    UCHAR8 patch_number;
+    u8 patch_number;
 
-    UCHAR8 mix_level:7;
-    UCHAR8 mute:1;
+    u8 mix_level:7;
+    u8 mute:1;
 
-    UCHAR8 split_point:7;
-    UCHAR8 play_below:1;
+    u8 split_point:7;
+    u8 play_below:1;
 
-    UCHAR8 pan_mod_src:2;
-    UCHAR8 pan_or_mod:1;
-    UCHAR8 pan:4;
-    UCHAR8 split_type:1;
+    u8 pan_mod_src:2;
+    u8 pan_or_mod:1;
+    u8 pan:4;
+    u8 split_type:1;
 };
 typedef struct wf_layer wavefront_layer;
 
@@ -335,9 +344,9 @@ typedef struct wf_program wavefront_program;
 
 struct wf_sample_offset
 {
-    INT32 Fraction:4;
-    INT32 Integer:20;
-    INT32 Unused:8;
+    s32 Fraction:4;
+    s32 Integer:20;
+    s32 Unused:8;
 };
 typedef struct wf_sample_offset wavefront_sample_offset;          
      
@@ -429,38 +438,38 @@ typedef struct wf_sample {
     struct wf_sample_offset loopStartOffset;
     struct wf_sample_offset loopEndOffset;
     struct wf_sample_offset sampleEndOffset;
-    INT16 FrequencyBias;
-    UCHAR8 SampleResolution:2;  /* sample_format */
-    UCHAR8 Unused1:1;
-    UCHAR8 Loop:1;
-    UCHAR8 Bidirectional:1;
-    UCHAR8 Unused2:1;
-    UCHAR8 Reverse:1;
-    UCHAR8 Unused3:1;
+    s16 FrequencyBias;
+    u8 SampleResolution:2;  /* sample_format */
+    u8 Unused1:1;
+    u8 Loop:1;
+    u8 Bidirectional:1;
+    u8 Unused2:1;
+    u8 Reverse:1;
+    u8 Unused3:1;
 } wavefront_sample;
 
 typedef struct wf_multisample {
-    INT16 NumberOfSamples;   /* log2 of the number of samples */
-    INT16 SampleNumber[NUM_MIDIKEYS];
+    s16 NumberOfSamples;   /* log2 of the number of samples */
+    s16 SampleNumber[NUM_MIDIKEYS];
 } wavefront_multisample;
 
 typedef struct wf_alias {
-    INT16 OriginalSample __attribute__ ((packed));
+    s16 OriginalSample __attribute__ ((packed));
 
     struct wf_sample_offset sampleStartOffset __attribute__ ((packed));
     struct wf_sample_offset loopStartOffset __attribute__ ((packed));
     struct wf_sample_offset sampleEndOffset __attribute__ ((packed));
     struct wf_sample_offset loopEndOffset __attribute__ ((packed));
 
-    INT16  FrequencyBias __attribute__ ((packed));
+    s16  FrequencyBias __attribute__ ((packed));
 
-    UCHAR8 SampleResolution:2  __attribute__ ((packed));
-    UCHAR8 Unused1:1  __attribute__ ((packed));
-    UCHAR8 Loop:1 __attribute__ ((packed));
-    UCHAR8 Bidirectional:1  __attribute__ ((packed));
-    UCHAR8 Unused2:1 __attribute__ ((packed));
-    UCHAR8 Reverse:1 __attribute__ ((packed));
-    UCHAR8 Unused3:1 __attribute__ ((packed)); 
+    u8 SampleResolution:2  __attribute__ ((packed));
+    u8 Unused1:1  __attribute__ ((packed));
+    u8 Loop:1 __attribute__ ((packed));
+    u8 Bidirectional:1  __attribute__ ((packed));
+    u8 Unused2:1 __attribute__ ((packed));
+    u8 Reverse:1 __attribute__ ((packed));
+    u8 Unused3:1 __attribute__ ((packed)); 
     
     /* This structure is meant to be padded only to 16 bits on their
        original. Of course, whoever wrote their documentation didn't
@@ -471,19 +480,19 @@ typedef struct wf_alias {
        standard 16->32 bit issues.
     */
 
-    UCHAR8 sixteen_bit_padding __attribute__ ((packed));
+    u8 sixteen_bit_padding __attribute__ ((packed));
 } wavefront_alias;
 
 typedef struct wf_drum {
-    UCHAR8 PatchNumber;
-    UCHAR8 MixLevel:7;
-    UCHAR8 Unmute:1;
-    UCHAR8 Group:4;
-    UCHAR8 Unused1:4;
-    UCHAR8 PanModSource:2;
-    UCHAR8 PanModulated:1;
-    UCHAR8 PanAmount:4;
-    UCHAR8 Unused2:1;
+    u8 PatchNumber;
+    u8 MixLevel:7;
+    u8 Unmute:1;
+    u8 Group:4;
+    u8 Unused1:4;
+    u8 PanModSource:2;
+    u8 PanModulated:1;
+    u8 PanAmount:4;
+    u8 Unused2:1;
 } wavefront_drum;
 
 typedef struct wf_drumkit {
@@ -491,7 +500,7 @@ typedef struct wf_drumkit {
 } wavefront_drumkit;
 
 typedef struct wf_channel_programs {
-    UCHAR8 Program[NUM_MIDICHANNELS];
+    u8 Program[NUM_MIDICHANNELS];
 } wavefront_channel_programs;
 
 /* How to get MIDI channel status from the data returned by
@@ -522,15 +531,15 @@ typedef struct wf_patch_info {
        only, and are unused by the current user-level library.
     */
 
-    INT16   key;               /* Use WAVEFRONT_PATCH here */
-    UINT16  devno;             /* fill in when sending */
-    UCHAR8  subkey;            /* WF_ST_{SAMPLE,ALIAS,etc.} */
+    s16   key;               /* Use WAVEFRONT_PATCH here */
+    u16  devno;             /* fill in when sending */
+    u8  subkey;            /* WF_ST_{SAMPLE,ALIAS,etc.} */
 
 #define WAVEFRONT_FIND_FREE_SAMPLE_SLOT 999
 
-    UINT16  number;            /* patch/sample/prog number */
+    u16  number;            /* patch/sample/prog number */
 
-    UINT32  size;              /* size of any data included in 
+    u32  size;              /* size of any data included in 
                                  one of the fields in `hdrptr', or
                                  as `dataptr'.
 
@@ -546,7 +555,7 @@ typedef struct wf_patch_info {
 
                               */
     wavefront_any *hdrptr;      /* user-space ptr to hdr bytes */
-    UINT16 *dataptr;            /* actual sample data */
+    u16 *dataptr;            /* actual sample data */
 
     wavefront_any hdr;          /* kernel-space copy of hdr bytes */         
 } wavefront_patch_info;
index bab03cc..113f8a2 100644 (file)
@@ -285,6 +285,7 @@ struct _snd_ymfpci {
        struct resource *res_reg_area;
 
        unsigned short old_legacy_ctrl;
+       unsigned int joystick_port;
 
        void *work_ptr;
        dma_addr_t work_ptr_addr;
@@ -355,13 +356,14 @@ int snd_ymfpci_pcm2(ymfpci_t *chip, int device, snd_pcm_t **rpcm);
 int snd_ymfpci_pcm_spdif(ymfpci_t *chip, int device, snd_pcm_t **rpcm);
 int snd_ymfpci_pcm_4ch(ymfpci_t *chip, int device, snd_pcm_t **rpcm);
 int snd_ymfpci_mixer(ymfpci_t *chip);
+int snd_ymfpci_joystick(ymfpci_t *chip);
 
 int snd_ymfpci_voice_alloc(ymfpci_t *chip, ymfpci_voice_type_t type, int pair, ymfpci_voice_t **rvoice);
 int snd_ymfpci_voice_free(ymfpci_t *chip, ymfpci_voice_t *pvoice);
 
 #ifdef CONFIG_PM
-void snd_ymfpci_suspend(ymfpci_t *chip, int can_schedule);
-void snd_ymfpci_resume(ymfpci_t *chip, int can_schedule);
+void snd_ymfpci_suspend(ymfpci_t *chip);
+void snd_ymfpci_resume(ymfpci_t *chip);
 #endif
 
 #endif /* __SOUND_YMFPCI_H */
index 0f8cb6b..2ff9b9f 100644 (file)
@@ -4,7 +4,7 @@
 mainmenu_option next_comment
 comment 'Open Sound System'
 
-tristate 'Open Sound System' CONFIG_SOUND_PRIME
+dep_tristate 'Open Sound System' CONFIG_SOUND_PRIME $CONFIG_SOUND
 if [ "$CONFIG_SOUND_PRIME" != "n" ]; then
   source sound/oss/Config.in
 fi
@@ -14,18 +14,18 @@ endmenu
 mainmenu_option next_comment
 comment 'Advanced Linux Sound Architecture'
 
-tristate 'Advanced Linux Sound Architecture' CONFIG_SND
+dep_tristate 'Advanced Linux Sound Architecture' CONFIG_SND $CONFIG_SOUND
 if [ "$CONFIG_SND" != "n" ]; then
   source sound/core/Config.in
   source sound/drivers/Config.in
 fi
-if [ "$CONFIG_SND" != "n" -a "$CONFIG_ISA" == "y" ]; then
+if [ "$CONFIG_SND" != "n" -a "$CONFIG_ISA" = "y" ]; then
   source sound/isa/Config.in
 fi
-if [ "$CONFIG_SND" != "n" -a "$CONFIG_PCI" == "y" ]; then
+if [ "$CONFIG_SND" != "n" -a "$CONFIG_PCI" = "y" ]; then
   source sound/pci/Config.in
 fi
-if [ "$CONFIG_SND" != "n" -a "$CONFIG_PPC" == "y" ]; then
+if [ "$CONFIG_SND" != "n" -a "$CONFIG_PPC" = "y" ]; then
   source sound/ppc/Config.in
 fi
 
index 291554b..5f8ab02 100644 (file)
@@ -13,9 +13,12 @@ ifeq ($(CONFIG_SOUND_PRIME),y)
   obj-y += oss/sounddrivers.o
 endif
 
-subdir-$(CONFIG_SND) += core i2c drivers isa pci ppc synth
+_subdirs := core i2c drivers isa pci ppc synth
+
+subdir-$(CONFIG_SND) += $(_subdirs)
 
 ifeq ($(CONFIG_SND),y)
+  subdir-m += $(_subdirs)
   obj-y += core/core.o i2c/_i2c.o
   obj-y += drivers/drivers.o \
           drivers/mpu401/_mpu401.o \
index 3f44f54..bd5bf6c 100644 (file)
@@ -1,21 +1,21 @@
 # ALSA soundcard-configuration
 
-dep_tristate 'RTC Timer support' CONFIG_SND_RTCTIMER $CONFIG_SND
-dep_tristate 'Sequencer support' CONFIG_SND_SEQUENCER $CONFIG_SND
+dep_tristate '  RTC Timer support' CONFIG_SND_RTCTIMER $CONFIG_SND
+dep_tristate '  Sequencer support' CONFIG_SND_SEQUENCER $CONFIG_SND
 if [ "$CONFIG_SND_SEQUENCER" != "n" ]; then
-  dep_tristate 'Sequencer dummy client' CONFIG_SND_SEQ_DUMMY $CONFIG_SND_SEQUENCER
+  dep_tristate '  Sequencer dummy client' CONFIG_SND_SEQ_DUMMY $CONFIG_SND_SEQUENCER
 fi
-bool 'OSS API emulation' CONFIG_SND_OSSEMUL $CONFIG_SND
+bool '  OSS API emulation' CONFIG_SND_OSSEMUL $CONFIG_SND
 if [ "$CONFIG_SND_OSSEMUL" = "y" ]; then
-  dep_tristate 'OSS Mixer API' CONFIG_SND_MIXER_OSS $CONFIG_SND
-  dep_tristate 'OSS PCM API' CONFIG_SND_PCM_OSS $CONFIG_SND
+  dep_tristate '    OSS Mixer API' CONFIG_SND_MIXER_OSS $CONFIG_SND
+  dep_tristate '    OSS PCM API' CONFIG_SND_PCM_OSS $CONFIG_SND
   if [ "$CONFIG_SND_SEQUENCER" != "n" ]; then
-    dep_tristate 'OSS Sequencer API' CONFIG_SND_SEQUENCER_OSS $CONFIG_SND_SEQUENCER
+    dep_tristate '    OSS Sequencer API' CONFIG_SND_SEQUENCER_OSS $CONFIG_SND_SEQUENCER
   fi
 fi
-bool 'Debug' CONFIG_SND_DEBUG
+bool '  Debug' CONFIG_SND_DEBUG
 if [ "$CONFIG_SND_DEBUG" = "y" ]; then
-  bool 'Debug memory' CONFIG_SND_DEBUG_MEMORY
-  bool 'Debug full' CONFIG_SND_DEBUG_FULL
-  bool 'Debug detection' CONFIG_SND_DEBUG_DETECT
+  bool '    Debug memory' CONFIG_SND_DEBUG_MEMORY
+  bool '    Debug full' CONFIG_SND_DEBUG_FULL
+  bool '    Debug detection' CONFIG_SND_DEBUG_DETECT
 fi
index 5d103e3..840b563 100644 (file)
@@ -22,6 +22,9 @@
 #define __NO_VERSION__
 #include <sound/driver.h>
 #include <linux/interrupt.h>
+#include <linux/slab.h>
+#include <linux/vmalloc.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/minors.h>
 #include <sound/info.h>
@@ -338,32 +341,45 @@ static int snd_ctl_elem_list(snd_card_t *card, snd_ctl_elem_list_t *_list)
        struct list_head *plist;
        snd_ctl_elem_list_t list;
        snd_kcontrol_t *kctl;
-       snd_ctl_elem_id_t *id;
+       snd_ctl_elem_id_t *dst, *id;
        int offset, space;
        
        if (copy_from_user(&list, _list, sizeof(list)))
                return -EFAULT;
        offset = list.offset;
        space = list.space;
-       read_lock(&card->control_rwlock);
-       list.count = card->controls_count;
-       plist = card->controls.next;
-       while (offset-- > 0 && plist != &card->controls)
-               plist = plist->next;
-       list.used = 0;
-       id = list.pids;
-       while (space > 0 && plist != &card->controls) {
-               kctl = snd_kcontrol(plist);
-               if (copy_to_user(id, &kctl->id, sizeof(*id))) {
-                       read_unlock(&card->control_rwlock);
-                       return -EFAULT;
+       /* try limit maximum space */
+       if (space > 16384)
+               return -ENOMEM;
+       if (space > 0) {
+               /* allocate temporary buffer for atomic operation */
+               dst = vmalloc(space * sizeof(snd_ctl_elem_id_t));
+               if (dst == NULL)
+                       return -ENOMEM;
+               read_lock(&card->control_rwlock);
+               list.count = card->controls_count;
+               plist = card->controls.next;
+               while (offset-- > 0 && plist != &card->controls)
+                       plist = plist->next;
+               list.used = 0;
+               id = dst;
+               while (space > 0 && plist != &card->controls) {
+                       kctl = snd_kcontrol(plist);
+                       memcpy(id, &kctl->id, sizeof(snd_ctl_elem_id_t));
+                       id++;
+                       plist = plist->next;
+                       space--;
+                       list.used++;
                }
-               id++;
-               plist = plist->next;
-               space--;
-               list.used++;
+               read_unlock(&card->control_rwlock);
+               if (list.used > 0 && copy_to_user(list.pids, dst, list.used * sizeof(snd_ctl_elem_id_t)))
+                       return -EFAULT;
+               vfree(dst);
+       } else {
+               read_lock(&card->control_rwlock);
+               list.count = card->controls_count;
+               read_unlock(&card->control_rwlock);
        }
-       read_unlock(&card->control_rwlock);
        if (copy_to_user(_list, &list, sizeof(list)))
                return -EFAULT;
        return 0;
@@ -662,12 +678,14 @@ static ssize_t snd_ctl_read(struct file *file, char *buffer, size_t count, loff_
                ev.type = SNDRV_CTL_EVENT_ELEM;
                ev.data.elem.mask = kev->mask;
                ev.data.elem.id = kev->id;
+               list_del(&kev->list);
+               spin_unlock_irq(&ctl->read_lock);
+               kfree(kev);
                if (copy_to_user(buffer, &ev, sizeof(snd_ctl_event_t))) {
                        err = -EFAULT;
                        goto __end;
                }
-               list_del(&kev->list);
-               kfree(kev);
+               spin_lock_irq(&ctl->read_lock);
                buffer += sizeof(snd_ctl_event_t);
                count -= sizeof(snd_ctl_event_t);
                result += sizeof(snd_ctl_event_t);
index 6c78fc6..a5d8efa 100644 (file)
@@ -21,6 +21,8 @@
 
 #define __NO_VERSION__
 #include <sound/driver.h>
+#include <linux/slab.h>
+#include <linux/time.h>
 #include <sound/core.h>
 
 int snd_device_new(snd_card_t *card, snd_device_type_t type,
index b5d0774..5a860ea 100644 (file)
  */
 
 #include <sound/driver.h>
-#include <sound/core.h>
 #include <linux/major.h>
 #include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/time.h>
+#include <sound/core.h>
 #include <sound/control.h>
 #include <sound/minors.h>
 #include <sound/hwdep.h>
index 2d43323..32874e2 100644 (file)
@@ -22,6 +22,8 @@
 #define __NO_VERSION__
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/vmalloc.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/minors.h>
 #include <sound/info.h>
@@ -276,7 +278,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file)
        int mode, err;
 
        down(&info_mutex);
-       p = (struct proc_dir_entry *) inode->u.generic_ip;
+       p = PDE(inode);
        entry = p == NULL ? NULL : (snd_info_entry_t *)p->data;
        if (entry == NULL) {
                up(&info_mutex);
@@ -539,7 +541,7 @@ static struct inode_operations snd_info_device_inode_operations =
 static int snd_info_card_readlink(struct dentry *dentry,
                                  char *buffer, int buflen)
 {
-        char *s = ((struct proc_dir_entry *) dentry->d_inode->u.generic_ip)->data;
+        char *s = PDE(dentry->d_inode)->data;
 #ifndef LINUX_2_2
        return vfs_readlink(dentry, buffer, buflen, s);
 #else
@@ -560,7 +562,7 @@ static int snd_info_card_readlink(struct dentry *dentry,
 static int snd_info_card_followlink(struct dentry *dentry,
                                    struct nameidata *nd)
 {
-        char *s = ((struct proc_dir_entry *) dentry->d_inode->u.generic_ip)->data;
+        char *s = PDE(dentry->d_inode)->data;
         return vfs_follow_link(nd, s);
 }
 #else
@@ -568,7 +570,7 @@ static struct dentry *snd_info_card_followlink(struct dentry *dentry,
                                               struct dentry *base,
                                               unsigned int follow)
 {
-       char *s = ((struct proc_dir_entry *) dentry->d_inode->u.generic_ip)->data;
+       char *s = PDE(dentry->d_inode)->data;
        return lookup_dentry(s, base, follow);
 }
 #endif
@@ -843,7 +845,7 @@ static void snd_info_device_fill_inode(struct inode *inode, int fill)
                return;
        }
        MOD_INC_USE_COUNT;
-       de = (struct proc_dir_entry *) inode->u.generic_ip;
+       de = PDE(inode);
        if (de == NULL)
                return;
        entry = (snd_info_entry_t *) de->data;
@@ -999,7 +1001,7 @@ static void snd_info_version_read(snd_info_entry_t *entry, snd_info_buffer_t * b
        static char *kernel_version = UTS_RELEASE;
 
        snd_iprintf(buffer,
-                   "Advanced Linux Sound Architecture Driver Version " CONFIG_SND_VERSION ".\n"
+                   "Advanced Linux Sound Architecture Driver Version " CONFIG_SND_VERSION CONFIG_SND_DATE ".\n"
                    "Compiled on " __DATE__ " for kernel %s"
 #ifdef __SMP__
                    " (SMP)"
index 2966b0a..940882f 100644 (file)
@@ -21,6 +21,8 @@
 
 #define __NO_VERSION__
 #include <sound/driver.h>
+#include <linux/slab.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/minors.h>
 #include <sound/info.h>
index 450ac65..6d35d52 100644 (file)
@@ -22,6 +22,8 @@
 #define __NO_VERSION__
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/info.h>
@@ -87,6 +89,7 @@ snd_card_t *snd_card_new(int idx, const char *xid,
        INIT_LIST_HEAD(&card->controls);
        INIT_LIST_HEAD(&card->ctl_files);
 #ifdef CONFIG_PM
+       init_MUTEX(&card->power_lock);
        init_waitqueue_head(&card->power_sleep);
 #endif
        /* the control interface cannot be accessed from the user space until */
@@ -278,7 +281,7 @@ int snd_component_add(snd_card_t *card, const char *component)
 
 #ifdef CONFIG_PM
 /* the power lock must be active before call */
-void snd_power_wait(snd_card_t *card, int can_schedule)
+void snd_power_wait(snd_card_t *card)
 {
        wait_queue_t wait;
 
@@ -287,6 +290,6 @@ void snd_power_wait(snd_card_t *card, int can_schedule)
        snd_power_unlock(card);
        schedule_timeout(30 * HZ);
        remove_wait_queue(&card->power_sleep, &wait);
-       snd_power_lock(card, can_schedule);
+       snd_power_lock(card);
 }
 #endif /* CONFIG_PM */
index d176970..2961c74 100644 (file)
@@ -38,7 +38,7 @@
  */
  
 void snd_dma_program(unsigned long dma,
-                    const void *buf, unsigned int size,
+                    unsigned long addr, unsigned int size,
                      unsigned short mode)
 {
        unsigned long flags;
@@ -47,7 +47,7 @@ void snd_dma_program(unsigned long dma,
        disable_dma(dma);
        clear_dma_ff(dma);
        set_dma_mode(dma, mode);
-       set_dma_addr(dma, isa_virt_to_bus((void *) buf));
+       set_dma_addr(dma, addr);
        set_dma_count(dma, size);
        if (!(mode & DMA_MODE_NO_ENABLE))
                enable_dma(dma);
index f701aa3..0f051ef 100644 (file)
@@ -24,6 +24,8 @@
 #include <asm/io.h>
 #include <asm/uaccess.h>
 #include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/info.h>
 
@@ -314,19 +316,79 @@ void snd_free_pages(void *ptr, unsigned long size)
 #endif
 }
 
+#ifdef CONFIG_ISA
+
+#ifndef CONFIG_ISA_USE_PCI_ALLOC_CONSISTENT
+#ifdef CONFIG_PCI
+#define CONFIG_ISA_USE_PCI_ALLOC_CONSISTENT
+#endif
+#endif
+
+void *snd_malloc_isa_pages(unsigned long size, dma_addr_t *dma_addr)
+{
+       void *dma_area;
+
+#ifndef CONFIG_ISA_USE_PCI_ALLOC_CONSISTENT
+       dma_area = snd_malloc_pages(size, GFP_ATOMIC|GFP_DMA);
+       *dma_addr = dma_area ? isa_virt_to_bus(dma_area) : 0UL;
+#else
+       {
+               int pg;
+               for (pg = 0; PAGE_SIZE * (1 << pg) < size; pg++);
+               dma_area = pci_alloc_consistent(NULL, size, dma_addr);
+               if (dma_area != NULL) {
+                       mem_map_t *page = virt_to_page(dma_area);
+                       mem_map_t *last_page = page + (1 << pg);
+                       while (page < last_page)
+                               SetPageReserved(page++);
+#ifdef CONFIG_SND_DEBUG_MEMORY
+                       snd_alloc_pages += 1 << pg;
+#endif
+               }
+       }
+#endif
+       return dma_area;
+}
+
+void *snd_malloc_isa_pages_fallback(unsigned long size,
+                                   dma_addr_t *dma_addr,
+                                   unsigned long *res_size)
+{
+       void *dma_area;
+
+#ifndef CONFIG_ISA_USE_PCI_ALLOC_CONSISTENT
+       dma_area = snd_malloc_pages_fallback(size, GFP_ATOMIC|GFP_DMA, res_size);
+       *dma_addr = dma_area ? isa_virt_to_bus(dma_area) : 0UL;
+       return dma_area;
+#else
+       snd_assert(size > 0, return NULL);
+       snd_assert(res_size != NULL, return NULL);
+       do {
+               if ((dma_area = snd_malloc_isa_pages(size, dma_addr)) != NULL) {
+                       *res_size = size;
+                       return dma_area;
+               }
+               size >>= 1;
+       } while (size >= PAGE_SIZE);
+       return NULL;
+#endif
+}
+
+#endif
+
 #ifdef CONFIG_PCI
 
 void *snd_malloc_pci_pages(struct pci_dev *pci,
                           unsigned long size,
-                          dma_addr_t *dmaaddr)
+                          dma_addr_t *dma_addr)
 {
        int pg;
        void *res;
 
        snd_assert(size > 0, return NULL);
-       snd_assert(dmaaddr != NULL, return NULL);
+       snd_assert(dma_addr != NULL, return NULL);
        for (pg = 0; PAGE_SIZE * (1 << pg) < size; pg++);
-       res = pci_alloc_consistent(pci, PAGE_SIZE * (1 << pg), dmaaddr);
+       res = pci_alloc_consistent(pci, PAGE_SIZE * (1 << pg), dma_addr);
        if (res != NULL) {
                mem_map_t *page = virt_to_page(res);
                mem_map_t *last_page = page + (1 << pg);
@@ -339,15 +401,16 @@ void *snd_malloc_pci_pages(struct pci_dev *pci,
        return res;
 }
 
-void *snd_malloc_pci_pages_fallback(struct pci_dev *pci, unsigned long size,
-                                   dma_addr_t *dmaaddr,
+void *snd_malloc_pci_pages_fallback(struct pci_dev *pci,
+                                   unsigned long size,
+                                   dma_addr_t *dma_addr,
                                    unsigned long *res_size)
 {
        void *res;
 
        snd_assert(res_size != NULL, return NULL);
        do {
-               if ((res = snd_malloc_pci_pages(pci, size, dmaaddr)) != NULL) {
+               if ((res = snd_malloc_pci_pages(pci, size, dma_addr)) != NULL) {
                        *res_size = size;
                        return res;
                }
@@ -356,7 +419,10 @@ void *snd_malloc_pci_pages_fallback(struct pci_dev *pci, unsigned long size,
        return NULL;
 }
 
-void snd_free_pci_pages(struct pci_dev *pci, unsigned long size, void *ptr, dma_addr_t dmaaddr)
+void snd_free_pci_pages(struct pci_dev *pci,
+                       unsigned long size,
+                       void *ptr,
+                       dma_addr_t dma_addr)
 {
        int pg;
        mem_map_t *page, *last_page;
@@ -368,7 +434,7 @@ void snd_free_pci_pages(struct pci_dev *pci, unsigned long size, void *ptr, dma_
        last_page = page + (1 << pg);
        while (page < last_page)
                ClearPageReserved(page++);
-       pci_free_consistent(pci, PAGE_SIZE * (1 << pg), ptr, dmaaddr);
+       pci_free_consistent(pci, PAGE_SIZE * (1 << pg), ptr, dma_addr);
 #ifdef CONFIG_SND_DEBUG_MEMORY
        snd_alloc_pages -= 1 << pg;
 #endif
index 8b6bc02..195552a 100644 (file)
@@ -22,6 +22,8 @@
 #define __NO_VERSION__
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/sched.h>
+#include <linux/time.h>
 #include <sound/core.h>
 
 int snd_task_name(struct task_struct *task, char *name, size_t size)
index 50095e4..b8ca19c 100644 (file)
@@ -21,6 +21,7 @@
 
 #define __NO_VERSION__
 #include <sound/driver.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include "pcm_plugin.h"
index 938737a..0719603 100644 (file)
@@ -21,6 +21,7 @@
   
 #define __NO_VERSION__
 #include <sound/driver.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include "pcm_plugin.h"
index 67dfcaf..64ec214 100644 (file)
@@ -22,6 +22,7 @@
 
 #define __NO_VERSION__
 #include <sound/driver.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include "pcm_plugin.h"
index 1a8e645..bb4057b 100644 (file)
@@ -21,6 +21,8 @@
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/minors.h>
 #include <sound/control.h>
index d81f03a..4d36574 100644 (file)
@@ -23,6 +23,7 @@
   
 #define __NO_VERSION__
 #include <sound/driver.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include "pcm_plugin.h"
index 62630cd..57bcaa9 100644 (file)
@@ -25,6 +25,9 @@
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/time.h>
+#include <linux/vmalloc.h>
 #include <sound/core.h>
 #include <sound/minors.h>
 #include <sound/pcm.h>
@@ -1203,7 +1206,9 @@ static int snd_pcm_oss_get_odelay(snd_pcm_oss_file_t *pcm_oss_file)
        if (runtime->oss.params || runtime->oss.prepare)
                return 0;
        err = snd_pcm_kernel_playback_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, &delay);
-       if (err < 0)
+       if (err == -EPIPE)
+               delay = 0;      /* hack for broken OSS applications */
+       else if (err < 0)
                return err;
        return snd_pcm_oss_bytes(substream, delay);
 }
@@ -1764,8 +1769,11 @@ static int snd_pcm_oss_ioctl(struct inode *inode, struct file *file,
                return -EIO;
        case SNDCTL_DSP_GETODELAY:
                res = snd_pcm_oss_get_odelay(pcm_oss_file);
-               if (res < 0)
+               if (res < 0) {
+                       /* it's for sure, some broken apps don't check for error codes */
+                       put_user(0, (int *)arg);
                        return res;
+               }
                return put_user(res, (int *)arg) ? -EFAULT : 0;
        case SNDCTL_DSP_PROFILE:
                return 0;       /* silently ignore */
index 1df4d09..24134a9 100644 (file)
@@ -26,6 +26,9 @@
 
 #define __NO_VERSION__
 #include <sound/driver.h>
+#include <linux/slab.h>
+#include <linux/time.h>
+#include <linux/vmalloc.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include "pcm_plugin.h"
index 0c00911..646663a 100644 (file)
   
 #define __NO_VERSION__
 #include <sound/driver.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include "pcm_plugin.h"
 
 #define SHIFT  11
 #define BITS   (1<<SHIFT)
-#define MASK   (BITS-1)
+#define R_MASK (BITS-1)
 
 /*
  *  Basic rate conversion plugin
@@ -108,19 +109,19 @@ static void resample_expand(snd_pcm_plugin_t *plugin,
                dst_step = dst_channels[channel].area.step / 8;
                src_frames1 = src_frames;
                dst_frames1 = dst_frames;
-               if (pos & ~MASK) {
+               if (pos & ~R_MASK) {
                        get_s16_end = &&after_get1;
                        goto *get;
                after_get1:
-                       pos &= MASK;
+                       pos &= R_MASK;
                        S1 = S2;
                        S2 = sample;
                        src += src_step;
-                       src_frames--;
+                       src_frames1--;
                }
                while (dst_frames1-- > 0) {
-                       if (pos & ~MASK) {
-                               pos &= MASK;
+                       if (pos & ~R_MASK) {
+                               pos &= R_MASK;
                                S1 = S2;
                                if (src_frames1-- > 0) {
                                        get_s16_end = &&after_get2;
@@ -203,8 +204,8 @@ static void resample_shrink(snd_pcm_plugin_t *plugin,
                                S2 = sample;
                                src += src_step;
                        }
-                       if (pos & ~MASK) {
-                               pos &= MASK;
+                       if (pos & ~R_MASK) {
+                               pos &= R_MASK;
                                val = S1 + ((S2 - S1) * (signed int)pos) / BITS;
                                if (val < -32768)
                                        val = -32768;
index 125744e..d50eb06 100644 (file)
@@ -21,6 +21,8 @@
 
 #define __NO_VERSION__
 #include <sound/driver.h>
+#include <linux/slab.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include "pcm_plugin.h"
@@ -58,7 +60,7 @@ struct ttable_dst {
 };
 
 struct route_private_data {
-       enum {UINT32=0, UINT64=1, FLOAT=2} sum_type;
+       enum {R_UINT32=0, R_UINT64=1, R_FLOAT=2} sum_type;
        int get, put;
        int conv;
        int src_sample_size;
@@ -558,12 +560,12 @@ int snd_pcm_plugin_build_route(snd_pcm_plug_t *plug,
        data->conv = conv_index(src_format->format, dst_format->format);
 
 #if ROUTE_PLUGIN_USE_FLOAT
-       data->sum_type = FLOAT;
+       data->sum_type = R_FLOAT;
 #else
        if (snd_pcm_format_width(src_format->format) == 32)
-               data->sum_type = UINT64;
+               data->sum_type = R_UINT64;
        else
-               data->sum_type = UINT32;
+               data->sum_type = R_UINT32;
 #endif
        data->src_sample_size = snd_pcm_format_width(src_format->format) / 8;
 
index 3dcd485..28f79db 100644 (file)
@@ -21,6 +21,8 @@
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/minors.h>
 #include <sound/pcm.h>
@@ -376,6 +378,9 @@ static void snd_pcm_substream_proc_status_read(snd_info_entry_t *entry, snd_info
        snd_iprintf(buffer, "delay       : %ld\n", status.delay);
        snd_iprintf(buffer, "avail       : %ld\n", status.avail);
        snd_iprintf(buffer, "avail_max   : %ld\n", status.avail_max);
+       snd_iprintf(buffer, "-----\n");
+       snd_iprintf(buffer, "hw_ptr      : %ld\n", runtime->status->hw_ptr);
+       snd_iprintf(buffer, "appl_ptr    : %ld\n", runtime->control->appl_ptr);
 }
 
 static int snd_pcm_stream_proc_init(snd_pcm_str_t *pstr)
@@ -565,7 +570,7 @@ static int snd_pcm_new_stream(snd_pcm_t *pcm,
                        return err;
                }
                substream->dma_type = SNDRV_PCM_DMA_TYPE_ISA;
-               substream->dma_private = (void *)(unsigned long)GFP_KERNEL;
+               substream->dma_private = NULL;
                spin_lock_init(&substream->timer_lock);
                prev = substream;
        }
index 161812e..3bedabf 100644 (file)
@@ -22,6 +22,8 @@
 
 #define __NO_VERSION__
 #include <sound/driver.h>
+#include <linux/slab.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/info.h>
index e213e4e..dfc207c 100644 (file)
 #define __NO_VERSION__
 #include <sound/driver.h>
 #include <asm/io.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/info.h>
 #include <sound/initval.h>
 
-#ifdef CONFIG_ISA
-#define HAVE_ISA_VIRT_TO_BUS
-#endif
-
 static int snd_preallocate_dma = 1;
 MODULE_PARM(snd_preallocate_dma, "i");
 MODULE_PARM_DESC(snd_preallocate_dma, "Preallocate DMA memory when the PCM devices are initialized.");
@@ -43,17 +40,20 @@ MODULE_PARM_SYNTAX(snd_maximum_substreams, SNDRV_BOOLEAN_TRUE_DESC);
 
 static int snd_minimum_buffer = 16384;
 
+
 static void snd_pcm_lib_preallocate_dma_free(snd_pcm_substream_t *substream)
 {
        if (substream->dma_area == NULL)
                return;
        switch (substream->dma_type) {
        case SNDRV_PCM_DMA_TYPE_CONTINUOUS:
-#ifdef HAVE_ISA_VIRT_TO_BUS
-       case SNDRV_PCM_DMA_TYPE_ISA:
-#endif
                snd_free_pages(substream->dma_area, substream->dma_bytes);
                break;
+#ifdef CONFIG_ISA
+       case SNDRV_PCM_DMA_TYPE_ISA:
+               snd_free_isa_pages(substream->dma_bytes, substream->dma_area, substream->dma_addr);
+               break;
+#endif
 #ifdef CONFIG_PCI
        case SNDRV_PCM_DMA_TYPE_PCI:
                snd_free_pci_pages((struct pci_dev *)substream->dma_private, substream->dma_bytes, substream->dma_area, substream->dma_addr);
@@ -119,10 +119,9 @@ static void snd_pcm_lib_preallocate_proc_write(snd_info_entry_t *entry,
                                dma_area = snd_malloc_pages(size, (unsigned int)((unsigned long)substream->dma_private & 0xffffffff));
                                dma_addr = 0UL;         /* not valid */
                                break;
-#ifdef HAVE_ISA_VIRT_TO_BUS
+#ifdef CONFIG_ISA
                        case SNDRV_PCM_DMA_TYPE_ISA:
-                               dma_area = snd_malloc_pages(size, (unsigned int)((unsigned long)substream->dma_private & 0xffffffff));
-                               dma_addr = isa_virt_to_bus(dma_area);
+                               dma_area = snd_malloc_isa_pages(size, &dma_addr);
                                break;
 #endif
 #ifdef CONFIG_PCI
@@ -168,10 +167,9 @@ static int snd_pcm_lib_preallocate_pages1(snd_pcm_substream_t *substream,
                        dma_area = snd_malloc_pages_fallback(size, (unsigned int)((unsigned long)substream->dma_private & 0xffffffff), &rsize);
                        dma_addr = 0UL;         /* not valid */
                        break;
-#ifdef HAVE_ISA_VIRT_TO_BUS
+#ifdef CONFIG_ISA
                case SNDRV_PCM_DMA_TYPE_ISA:
-                       dma_area = snd_malloc_pages_fallback(size, (unsigned int)((unsigned long)substream->dma_private & 0xffffffff), &rsize);
-                       dma_addr = isa_virt_to_bus(dma_area);
+                       dma_area = snd_malloc_isa_pages_fallback(size, &dma_addr, &rsize);
                        break;
 #endif
 #ifdef CONFIG_PCI
@@ -212,14 +210,9 @@ int snd_pcm_lib_preallocate_pages(snd_pcm_substream_t *substream,
                                      size_t size, size_t max,
                                      unsigned int flags)
 {
-#ifdef HAVE_ISA_VIRT_TO_BUS
        substream->dma_type = SNDRV_PCM_DMA_TYPE_CONTINUOUS;
        substream->dma_private = (void *)(unsigned long)flags;
        return snd_pcm_lib_preallocate_pages1(substream, size, max);
-#else
-       snd_printk("this host has no isa_virt_to_bus!\n");
-       return -ENXIO;
-#endif
 }
 
 int snd_pcm_lib_preallocate_pages_for_all(snd_pcm_t *pcm,
@@ -231,36 +224,29 @@ int snd_pcm_lib_preallocate_pages_for_all(snd_pcm_t *pcm,
 
        for (stream = 0; stream < 2; stream++)
                for (substream = pcm->streams[stream].substream; substream; substream = substream->next)
-                       if ((err = snd_pcm_lib_preallocate_isa_pages(substream, size, max, flags)) < 0)
+                       if ((err = snd_pcm_lib_preallocate_pages(substream, size, max, flags)) < 0)
                                return err;
        return 0;
 }
 
 #ifdef CONFIG_ISA
 int snd_pcm_lib_preallocate_isa_pages(snd_pcm_substream_t *substream,
-                                     size_t size, size_t max,
-                                     unsigned int flags)
+                                     size_t size, size_t max)
 {
-#ifdef HAVE_ISA_VIRT_TO_BUS
        substream->dma_type = SNDRV_PCM_DMA_TYPE_ISA;
-       substream->dma_private = (void *)(unsigned long)flags;
+       substream->dma_private = NULL;
        return snd_pcm_lib_preallocate_pages1(substream, size, max);
-#else
-       snd_printk("this host has no isa_virt_to_bus!\n");
-       return -ENXIO;
-#endif
 }
 
 int snd_pcm_lib_preallocate_isa_pages_for_all(snd_pcm_t *pcm,
-                                             size_t size, size_t max,
-                                             unsigned int flags)
+                                             size_t size, size_t max)
 {
        snd_pcm_substream_t *substream;
        int stream, err;
 
        for (stream = 0; stream < 2; stream++)
                for (substream = pcm->streams[stream].substream; substream; substream = substream->next)
-                       if ((err = snd_pcm_lib_preallocate_isa_pages(substream, size, max, flags)) < 0)
+                       if ((err = snd_pcm_lib_preallocate_isa_pages(substream, size, max)) < 0)
                                return err;
        return 0;
 }
@@ -288,10 +274,13 @@ int snd_pcm_lib_malloc_pages(snd_pcm_substream_t *substream, size_t size)
                dma_addr = substream->dma_addr;
        } else {
                switch (substream->dma_type) {
-#ifdef HAVE_ISA_VIRT_TO_BUS
-               case SNDRV_PCM_DMA_TYPE_ISA:
+               case SNDRV_PCM_DMA_TYPE_CONTINUOUS:
                        dma_area = snd_malloc_pages(size, (unsigned int)((unsigned long)substream->dma_private & 0xffffffff));
-                       dma_addr = isa_virt_to_bus(dma_area);
+                       dma_addr = 0UL;         /* not valid */
+                       break;
+#ifdef CONFIG_ISA
+               case SNDRV_PCM_DMA_TYPE_ISA:
+                       dma_area = snd_malloc_isa_pages(size, &dma_addr); 
                        break;
 #endif
 #ifdef CONFIG_PCI
@@ -322,9 +311,9 @@ int snd_pcm_lib_free_pages(snd_pcm_substream_t *substream)
                return 0;
        if (runtime->dma_area != substream->dma_area) {
                switch (substream->dma_type) {
-#ifdef HAVE_ISA_VIRT_TO_BUS
+#ifdef CONFIG_ISA
                case SNDRV_PCM_DMA_TYPE_ISA:
-                       snd_free_pages(runtime->dma_area, runtime->dma_bytes);
+                       snd_free_isa_pages(runtime->dma_bytes, runtime->dma_area, runtime->dma_addr);
                        break;
 #endif
 #ifdef CONFIG_PCI
index 9c87715..a43ba60 100644 (file)
@@ -21,6 +21,7 @@
   
 #define __NO_VERSION__
 #include <sound/driver.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #define bswap_16 swab16
index 4cacd5f..3cacd99 100644 (file)
@@ -23,6 +23,8 @@
 #include <sound/driver.h>
 #include <linux/mm.h>
 #include <linux/file.h>
+#include <linux/slab.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/info.h>
@@ -810,13 +812,13 @@ static int snd_pcm_resume(snd_pcm_substream_t *substream)
        snd_card_t *card = substream->pcm->card;
        int res;
 
-       snd_power_lock(card, 1);
+       snd_power_lock(card);
        while (snd_power_get_state(card) != SNDRV_CTL_POWER_D0) {
                if (substream->ffile->f_flags & O_NONBLOCK) {
                        res = -EAGAIN;
                        goto _power_unlock;
                }
-               snd_power_wait(card, 1);
+               snd_power_wait(card);
        }
 
        _SND_PCM_ACTION(resume, substream, 0, res, 1);
@@ -908,13 +910,13 @@ int snd_pcm_prepare(snd_pcm_substream_t *substream)
 {
        int res;
        snd_card_t *card = substream->pcm->card;
-       snd_power_lock(card, 1);
+       snd_power_lock(card);
        while (snd_power_get_state(card) != SNDRV_CTL_POWER_D0) {
                if (substream->ffile->f_flags & O_NONBLOCK) {
                        res = -EAGAIN;
                        goto _power_unlock;
                }
-               snd_power_wait(card, 1);
+               snd_power_wait(card);
        }
 
        _SND_PCM_ACTION(prepare, substream, 0, res, 0);
@@ -959,7 +961,7 @@ static int snd_pcm_playback_drain(snd_pcm_substream_t * substream)
        runtime = substream->runtime;
        card = substream->pcm->card;
 
-       snd_power_lock(card, 1);
+       snd_power_lock(card);
        spin_lock_irq(&runtime->lock);
        switch (runtime->status->state) {
        case SNDRV_PCM_STATE_PAUSED:
@@ -975,7 +977,7 @@ static int snd_pcm_playback_drain(snd_pcm_substream_t * substream)
                                goto _end;
                        }
                        spin_unlock_irq(&runtime->lock);
-                       snd_power_wait(card, 1);
+                       snd_power_wait(card);
                        spin_lock_irq(&runtime->lock);
                }
                goto _xrun_recovery;
@@ -1065,7 +1067,7 @@ static int snd_pcm_playback_drop(snd_pcm_substream_t *substream)
        snd_pcm_runtime_t *runtime = substream->runtime;
        snd_card_t *card = substream->pcm->card;
        int res = 0;
-       snd_power_lock(card, 1);
+       snd_power_lock(card);
        spin_lock_irq(&runtime->lock);
        switch (runtime->status->state) {
        case SNDRV_PCM_STATE_OPEN:
@@ -1095,7 +1097,7 @@ static int snd_pcm_playback_drop(snd_pcm_substream_t *substream)
                                goto _end;
                        }
                        spin_unlock_irq(&runtime->lock);
-                       snd_power_wait(card, 1);
+                       snd_power_wait(card);
                        spin_lock_irq(&runtime->lock);
                }
                goto _xrun_recovery;
@@ -1112,7 +1114,7 @@ static int snd_pcm_capture_drain(snd_pcm_substream_t * substream)
        snd_pcm_runtime_t *runtime = substream->runtime;
        snd_card_t *card = substream->pcm->card;
        int res = 0;
-       snd_power_lock(card, 1);
+       snd_power_lock(card);
        spin_lock_irq(&runtime->lock);
        switch (runtime->status->state) {
        case SNDRV_PCM_STATE_OPEN:
@@ -1148,7 +1150,7 @@ static int snd_pcm_capture_drain(snd_pcm_substream_t * substream)
                                goto _end;
                        }
                        spin_unlock_irq(&runtime->lock);
-                       snd_power_wait(card, 1);
+                       snd_power_wait(card);
                        spin_lock_irq(&runtime->lock);
                }
                goto _xrun_recovery;
@@ -1164,7 +1166,7 @@ static int snd_pcm_capture_drop(snd_pcm_substream_t * substream)
        snd_pcm_runtime_t *runtime = substream->runtime;
        snd_card_t *card = substream->pcm->card;
        int res = 0;
-       snd_power_lock(card, 1);
+       snd_power_lock(card);
        spin_lock_irq(&runtime->lock);
        switch (runtime->status->state) {
        case SNDRV_PCM_STATE_OPEN:
@@ -1185,7 +1187,7 @@ static int snd_pcm_capture_drop(snd_pcm_substream_t * substream)
                                goto _end;
                        }
                        spin_unlock_irq(&runtime->lock);
-                       snd_power_wait(card, 1);
+                       snd_power_wait(card);
                        spin_lock_irq(&runtime->lock);
                }
                /* Fall through */
@@ -1880,24 +1882,25 @@ static int snd_pcm_playback_delay(snd_pcm_substream_t *substream, snd_pcm_sframe
        spin_lock_irq(&runtime->lock);
        switch (runtime->status->state) {
        case SNDRV_PCM_STATE_RUNNING:
+       case SNDRV_PCM_STATE_DRAINING:
                if (snd_pcm_update_hw_ptr(substream) >= 0) {
                        n = snd_pcm_playback_hw_avail(runtime);
                        if (put_user(n, res))
                                err = -EFAULT;
                        break;
+               } else {
+                       err = SNDRV_PCM_STATE_RUNNING ? -EPIPE : -EBADFD;
                }
-               /* Fall through */
-       case SNDRV_PCM_STATE_XRUN:
-               err = -EPIPE;
                break;
-       case SNDRV_PCM_STATE_DRAINING:
-               if (snd_pcm_update_hw_ptr(substream) >= 0) {
+       case SNDRV_PCM_STATE_SUSPENDED:
+               if (runtime->status->suspended_state == SNDRV_PCM_STATE_RUNNING) {
                        n = snd_pcm_playback_hw_avail(runtime);
                        if (put_user(n, res))
                                err = -EFAULT;
-                       break;
+               } else {
+                       err = -EBADFD;
                }
-               /* Fall through */
+               break;
        default:
                err = -EBADFD;
                break;
@@ -1924,6 +1927,15 @@ static int snd_pcm_capture_delay(snd_pcm_substream_t *substream, snd_pcm_sframes
        case SNDRV_PCM_STATE_XRUN:
                err = -EPIPE;
                break;
+       case SNDRV_PCM_STATE_SUSPENDED:
+               if (runtime->status->suspended_state == SNDRV_PCM_STATE_RUNNING) {
+                       n = snd_pcm_capture_avail(runtime);
+                       if (put_user(n, res))
+                               err = -EFAULT;
+               } else {
+                       err = -EBADFD;
+               }
+               break;
        default:
                err = -EBADFD;
                break;
index 69346b5..72568ce 100644 (file)
@@ -21,6 +21,7 @@
 
 #define __NO_VERSION__
 #include <sound/driver.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/timer.h>
index 0054daa..18f6815 100644 (file)
 #include <sound/core.h>
 #include <linux/major.h>
 #include <linux/init.h>
+#include <linux/sched.h>
+#include <linux/slab.h>
+#include <linux/time.h>
+#include <linux/wait.h>
 #include <sound/rawmidi.h>
 #include <sound/info.h>
 #include <sound/control.h>
index 1773614..db1452c 100644 (file)
@@ -30,6 +30,7 @@
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/timer.h>
 #include <sound/info.h>
index 2d6b885..17bf651 100644 (file)
@@ -20,6 +20,7 @@
  
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/sched.h>
 #include <sound/core.h>
 #include <sound/ainstr_fm.h>
 #include <sound/initval.h>
index 48c66aa..c2b8f96 100644 (file)
@@ -20,6 +20,8 @@
  
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/sched.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/ainstr_gf1.h>
 #include <sound/initval.h>
index a3cc91e..8c21d06 100644 (file)
@@ -20,6 +20,8 @@
  
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/sched.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/ainstr_iw.h>
 #include <sound/initval.h>
index ff96101..8cd604f 100644 (file)
@@ -20,6 +20,8 @@
  
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/sched.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/ainstr_simple.h>
 #include <sound/initval.h>
index 20cb799..78dd40c 100644 (file)
 #define __SEQ_OSS_DEVICE_H
 
 #include <sound/driver.h>
+#include <linux/time.h>
+#include <linux/wait.h>
+#include <linux/slab.h>
+#include <linux/sched.h>
 #include <sound/core.h>
 #include <sound/seq_oss.h>
 #include <sound/rawmidi.h>
index 05afbf6..88be3ab 100644 (file)
@@ -24,6 +24,7 @@
 #define __NO_VERSION__
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/minors.h>
 #include <linux/kmod.h>
@@ -540,6 +541,8 @@ static int snd_seq_deliver_single_event(client_t *client,
        int result = -ENOENT;
        int direct, quoted = 0;
 
+       direct = snd_seq_ev_is_direct(event);
+
        dest = get_event_dest_client(event, filter);
        if (dest == NULL)
                goto __skip;
@@ -553,8 +556,6 @@ static int snd_seq_deliver_single_event(client_t *client,
                goto __skip;
        }
                
-       direct = snd_seq_ev_is_direct(event);
-
        /* expand the quoted event */
        if (event->type == SNDRV_SEQ_EVENT_KERNEL_QUOTE) {
                quoted = 1;
@@ -587,7 +588,7 @@ static int snd_seq_deliver_single_event(client_t *client,
        if (dest)
                snd_seq_client_unlock(dest);
 
-       if (result < 0) {
+       if (result < 0 && !direct) {
                if (quoted) {
                        /* return directly to the original source */
                        dest = snd_seq_client_use_ptr(event->source.client);
index c3195b8..793bc16 100644 (file)
@@ -43,6 +43,7 @@
 #include <sound/seq_device.h>
 #include <sound/initval.h>
 #include <linux/kmod.h>
+#include <linux/slab.h>
 
 MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>");
 MODULE_DESCRIPTION("ALSA sequencer device management");
index d2c1db0..94dd203 100644 (file)
@@ -22,6 +22,7 @@
 #define __NO_VERSION__
 #include <sound/driver.h>
 #include <sound/core.h>
+#include <linux/slab.h>
 #include "seq_fifo.h"
 #include "seq_lock.h"
 
index 25383dc..c7bb683 100644 (file)
@@ -20,6 +20,7 @@
  
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include "seq_clientmgr.h"
 #include <sound/seq_instr.h>
index 0d2e2f5..79080ce 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef __SND_SEQ_LOCK_H
 #define __SND_SEQ_LOCK_H
 
+#include <linux/sched.h>
+
 #if defined(__SMP__) || defined(CONFIG_SND_DEBUG)
 
 typedef atomic_t snd_use_lock_t;
index 629acca..5a6e21d 100644 (file)
@@ -23,6 +23,8 @@
 #define __NO_VERSION__
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/vmalloc.h>
 #include <sound/core.h>
 
 #include <sound/seq_kernel.h>
index a51f08f..d451eff 100644 (file)
@@ -28,6 +28,7 @@ Possible options for midisynth module:
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/rawmidi.h>
 #include <sound/seq_kernel.h>
@@ -137,7 +138,7 @@ static int event_process_midi(snd_seq_event_t * ev, int direct,
        snd_assert(msynth != NULL, return -EINVAL);
        substream = msynth->output_rfile.output;
        if (substream == NULL)
-               return -EINVAL;
+               return -ENODEV;
        if (ev->type == SNDRV_SEQ_EVENT_SYSEX) {        /* special case, to save space */
                if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARIABLE) {
                        /* invalid event */
index 1f3a121..eeaf4c0 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/seq_kernel.h>
 #include <sound/seq_midi_emul.h>
index f5217db..b3ced94 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include <sound/driver.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/seq_kernel.h>
 #include <sound/seq_midi_event.h>
index c568730..9452ae2 100644 (file)
@@ -23,6 +23,7 @@
 #define __NO_VERSION__
 #include <sound/driver.h>
 #include <sound/core.h>
+#include <linux/slab.h>
 #include "seq_system.h"
 #include "seq_ports.h"
 #include "seq_clientmgr.h"
index e1789d9..713dae0 100644 (file)
@@ -21,6 +21,8 @@
 
 #define __NO_VERSION__
 #include <sound/driver.h>
+#include <linux/time.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include "seq_timer.h"
 #include "seq_prioq.h"
index b806e91..5299350 100644 (file)
@@ -38,6 +38,7 @@
 #define __NO_VERSION__
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 
 #include "seq_memory.h"
index 0464431..8c712d3 100644 (file)
@@ -23,6 +23,7 @@
 #define __NO_VERSION__
 #include <sound/driver.h>
 #include <sound/core.h>
+#include <linux/slab.h>
 #include "seq_timer.h"
 #include "seq_queue.h"
 #include "seq_info.h"
index 33617ad..55b0068 100644 (file)
@@ -37,6 +37,9 @@
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/wait.h>
+#include <linux/sched.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/rawmidi.h>
 #include <sound/info.h>
index 10aaa51..583266f 100644 (file)
@@ -21,6 +21,8 @@
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/minors.h>
 #include <sound/info.h>
@@ -347,7 +349,7 @@ static int __init alsa_sound_init(void)
        }
 #endif
 #ifndef MODULE
-       printk("Advanced Linux Sound Architecture Driver Version " CONFIG_SND_VERSION ".\n");
+       printk("Advanced Linux Sound Architecture Driver Version " CONFIG_SND_VERSION CONFIG_SND_DATE ".\n");
 #endif
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) && defined(CONFIG_APM)
        pm_init();
@@ -424,6 +426,10 @@ EXPORT_SYMBOL(snd_kmalloc_strdup);
 EXPORT_SYMBOL(snd_malloc_pages);
 EXPORT_SYMBOL(snd_malloc_pages_fallback);
 EXPORT_SYMBOL(snd_free_pages);
+#ifdef CONFIG_ISA
+EXPORT_SYMBOL(snd_malloc_isa_pages);
+EXPORT_SYMBOL(snd_malloc_isa_pages_fallback);
+#endif
 #ifdef CONFIG_PCI
 EXPORT_SYMBOL(snd_malloc_pci_pages);
 EXPORT_SYMBOL(snd_malloc_pci_pages_fallback);
index 7018c12..c3c3630 100644 (file)
 #error "Enable the OSS soundcore multiplexer (CONFIG_SOUND) in the kernel."
 #endif
 
-#include <sound/core.h>
 #include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/time.h>
+#include <sound/core.h>
 #include <sound/minors.h>
 #include <sound/info.h>
 #include <linux/sound.h>
index 3282415..0c63397 100644 (file)
@@ -22,6 +22,8 @@
 #include <sound/driver.h>
 #include <linux/delay.h>
 #include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/timer.h>
 #include <sound/control.h>
index c32be89..76e1cd7 100644 (file)
@@ -1,7 +1,12 @@
 # ALSA generic drivers
 
+mainmenu_option next_comment
+comment 'Generic devices'
+
 dep_tristate 'Dummy (/dev/null) soundcard' CONFIG_SND_DUMMY $CONFIG_SND
 dep_tristate 'Virtual MIDI soundcard' CONFIG_SND_VIRMIDI $CONFIG_SND $CONFIG_SND_SEQUENCER
 dep_tristate 'MOTU MidiTimePiece AV multiport MIDI' CONFIG_SND_MTPAV $CONFIG_SND
 dep_tristate 'UART16550 - MIDI only driver' CONFIG_SND_SERIAL_U16550 $CONFIG_SND
 dep_tristate 'Generic MPU-401 UART driver' CONFIG_SND_MPU401 $CONFIG_SND
+
+endmenu
index 9b9a3b4..6a6d8fe 100644 (file)
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/sched.h>
+#include <linux/slab.h>
+#include <linux/time.h>
+#include <linux/wait.h>
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/pcm.h>
index ed286f5..37deb36 100644 (file)
@@ -21,6 +21,9 @@
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/wait.h>
+#include <linux/sched.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/mpu401.h>
 #define SNDRV_GET_ID
index 7bed317..8993ade 100644 (file)
@@ -27,6 +27,7 @@
 #include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/mpu401.h>
 
@@ -365,7 +366,7 @@ static void snd_mpu401_uart_free(snd_rawmidi_t *rmidi)
                free_irq(mpu->irq, (void *) mpu);
        if (mpu->res) {
                release_resource(mpu->res);
-               kfree(mpu->res);
+               kfree_nocheck(mpu->res);
        }
        snd_magic_kfree(mpu);
 }
index e7c6af2..48ceaf1 100644 (file)
@@ -53,6 +53,7 @@
 #include <sound/driver.h>
 #include <asm/io.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #define SNDRV_GET_ID
 #include <sound/initval.h>
@@ -89,13 +90,13 @@ MODULE_PARM_DESC(snd_id, "ID string for MotuMTPAV MIDI.");
 MODULE_PARM_SYNTAX(snd_id, SNDRV_ID_DESC);
 MODULE_PARM(snd_port, "l");
 MODULE_PARM_DESC(snd_port, "Parallel port # for MotuMTPAV MIDI.");
-MODULE_PARM_SYNTAX(snd_port, "allows:{{0x378},{0x278}},dialog:list");
+MODULE_PARM_SYNTAX(snd_port, SNDRV_ENABLED ",allows:{{0x378},{0x278}},dialog:list");
 MODULE_PARM(snd_irq, "i");
 MODULE_PARM_DESC(snd_irq, "Parallel IRQ # for MotuMTPAV MIDI.");
-MODULE_PARM_SYNTAX(snd_irq,  "allows:{{7},{5}},dialog:list");
+MODULE_PARM_SYNTAX(snd_irq,  SNDRV_ENABLED ",allows:{{7},{5}},dialog:list");
 MODULE_PARM(snd_hwports, "i");
 MODULE_PARM_DESC(snd_hwports, "Hardware ports # for MotuMTPAV MIDI.");
-MODULE_PARM_SYNTAX(snd_hwports, "allows:{{1,8}},dialog:list");
+MODULE_PARM_SYNTAX(snd_hwports, SNDRV_ENABLED ",allows:{{1,8}},dialog:list");
 
 /*
  *      defines
@@ -712,7 +713,7 @@ static void free_mtpav(mtpav_t * crd)
                free_irq(crd->irq, (void *)crd);
        if (crd->res_port) {
                release_resource(crd->res_port);
-               kfree(crd->res_port);
+               kfree_nocheck(crd->res_port);
        }
        if (crd != NULL)
                kfree(crd);
index 22eca04..8f8400b 100644 (file)
@@ -27,6 +27,7 @@
 #include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/minors.h>
 
 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>, Hannu Savolainen 1993-1996, Rob Hooft");
@@ -351,11 +352,11 @@ static int snd_opl3_free(opl3_t *opl3)
 {
        if (opl3->res_l_port) {
                release_resource(opl3->res_l_port);
-               kfree(opl3->res_l_port);
+               kfree_nocheck(opl3->res_l_port);
        }
        if (opl3->res_r_port) {
                release_resource(opl3->res_r_port);
-               kfree(opl3->res_r_port);
+               kfree_nocheck(opl3->res_r_port);
        }
        snd_magic_kfree(opl3);
        return 0;
index 442f2fe..669e33a 100644 (file)
@@ -20,6 +20,7 @@
 
 #define __NO_VERSION__
 #include "opl3_voice.h"
+#include <linux/slab.h>
 
 static int snd_opl3_open_seq_oss(snd_seq_oss_arg_t *arg, void *closure);
 static int snd_opl3_close_seq_oss(snd_seq_oss_arg_t *arg);
index 1abf707..4801f7b 100644 (file)
 #include <sound/driver.h>
 #include <asm/io.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/rawmidi.h>
 #define SNDRV_GET_ID
@@ -747,7 +748,7 @@ static int snd_uart16550_free(snd_uart16550_t *uart)
                free_irq(uart->irq, (void *)uart);
        if (uart->res_base) {
                release_resource(uart->res_base);
-               kfree(uart->res_base);
+               kfree_nocheck(uart->res_base);
        }
        snd_magic_kfree(uart);
        return 0;
index cd48558..06d1f71 100644 (file)
@@ -43,6 +43,8 @@
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/wait.h>
+#include <linux/sched.h>
 #include <sound/core.h>
 #include <sound/seq_kernel.h>
 #include <sound/seq_virmidi.h>
index 8303494..823290b 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 #include <sound/driver.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/pcm.h>
index 2a8ecdf..6bc7a90 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/i2c.h>
 
index 0c48bce..0441d30 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/tea6330t.h>
 
index eb53379..9fc46d6 100644 (file)
@@ -1,5 +1,8 @@
 # ALSA ISA drivers
 
+mainmenu_option next_comment
+comment 'ISA devices'
+
 dep_tristate 'Analog Devices SoundPort AD1816A' CONFIG_SND_AD1816A $CONFIG_SND
 dep_tristate 'Generic AD1848/CS4248 driver' CONFIG_SND_AD1848 $CONFIG_SND
 dep_tristate 'Generic Cirrus Logic CS4231 driver' CONFIG_SND_CS4231 $CONFIG_SND
@@ -20,7 +23,7 @@ dep_tristate 'Sound Blaster 1.0/2.0/Pro (8-bit)' CONFIG_SND_SB8 $CONFIG_SND
 dep_tristate 'Sound Blaster 16 (PnP)' CONFIG_SND_SB16 $CONFIG_SND
 dep_tristate 'Sound Blaster AWE (32,64) (PnP)' CONFIG_SND_SBAWE $CONFIG_SND
 if [ "$CONFIG_SND_SB16" != "n" -o "$CONFIG_SND_SBAWE" != "n" ]; then
-  dep_bool 'Sound Blaster 16/AWE CSP support' CONFIG_SND_SB16_CSP
+  bool '  Sound Blaster 16/AWE CSP support' CONFIG_SND_SB16_CSP
 fi
 dep_tristate 'Turtle Beach Maui,Tropez,Tropez+ (Wavefront)' CONFIG_SND_WAVEFRONT $CONFIG_SND
 dep_tristate 'Avance Logic ALS100/ALS120' CONFIG_SND_ALS100 $CONFIG_SND
@@ -29,3 +32,5 @@ dep_tristate 'C-Media CMI8330' CONFIG_SND_CMI8330 $CONFIG_SND
 dep_tristate 'Diamond Technologies DT-0197H' CONFIG_SND_DT0197H $CONFIG_SND
 dep_tristate 'Yamaha OPL3-SA2/SA3' CONFIG_SND_OPL3SA2 $CONFIG_SND
 dep_tristate 'Aztech Sound Galaxy' CONFIG_SND_SGALAXY $CONFIG_SND
+
+endmenu
index ad31a14..d3fb937 100644 (file)
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/time.h>
+#include <linux/wait.h>
+#ifndef LINUX_ISAPNP_H
+#include <linux/isapnp.h>
+#define isapnp_card pci_bus
+#define isapnp_dev pci_dev
+#endif
 #include <sound/core.h>
 #define SNDRV_GET_ID
 #include <sound/initval.h>
index 4b1fb93..2688d1b 100644 (file)
@@ -23,6 +23,7 @@
 #include <asm/dma.h>
 #include <linux/delay.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/ad1816a.h>
 
@@ -240,7 +241,7 @@ static int snd_ad1816a_playback_prepare(snd_pcm_substream_t *substream)
        snd_ad1816a_out_mask(chip, AD1816A_PLAYBACK_CONFIG,
                AD1816A_PLAYBACK_ENABLE | AD1816A_PLAYBACK_PIO, 0x00);
 
-       snd_dma_program(chip->dma1, runtime->dma_area, size,
+       snd_dma_program(chip->dma1, runtime->dma_addr, size,
                        DMA_MODE_WRITE | DMA_AUTOINIT);
 
        snd_ad1816a_write(chip, AD1816A_PLAYBACK_SAMPLE_RATE, runtime->rate);
@@ -269,7 +270,7 @@ static int snd_ad1816a_capture_prepare(snd_pcm_substream_t *substream)
        snd_ad1816a_out_mask(chip, AD1816A_CAPTURE_CONFIG,
                AD1816A_CAPTURE_ENABLE | AD1816A_CAPTURE_PIO, 0x00);
 
-       snd_dma_program(chip->dma2, runtime->dma_area, size,
+       snd_dma_program(chip->dma2, runtime->dma_addr, size,
                        DMA_MODE_READ | DMA_AUTOINIT);
 
        snd_ad1816a_write(chip, AD1816A_CAPTURE_SAMPLE_RATE, runtime->rate);
@@ -446,6 +447,7 @@ static int snd_ad1816a_playback_open(snd_pcm_substream_t *substream)
        runtime->hw = snd_ad1816a_playback;
        snd_pcm_limit_isa_dma_size(chip->dma1, &runtime->hw.buffer_bytes_max);
        snd_pcm_limit_isa_dma_size(chip->dma1, &runtime->hw.period_bytes_max);
+       chip->playback_substream = substream;
        return 0;
 }
 
@@ -461,6 +463,7 @@ static int snd_ad1816a_capture_open(snd_pcm_substream_t *substream)
        runtime->hw = snd_ad1816a_capture;
        snd_pcm_limit_isa_dma_size(chip->dma2, &runtime->hw.buffer_bytes_max);
        snd_pcm_limit_isa_dma_size(chip->dma2, &runtime->hw.period_bytes_max);
+       chip->capture_substream = substream;
        return 0;
 }
 
@@ -531,7 +534,7 @@ static int snd_ad1816a_free(ad1816a_t *chip)
 {
        if (chip->res_port) {
                release_resource(chip->res_port);
-               kfree(chip->res_port);
+               kfree_nocheck(chip->res_port);
        }
        if (chip->irq >= 0)
                free_irq(chip->irq, (void *) chip);
@@ -673,7 +676,7 @@ int snd_ad1816a_pcm(ad1816a_t *chip, int device, snd_pcm_t **rpcm)
        strcpy(pcm->name, snd_ad1816a_chip_id(chip));
        snd_ad1816a_init(chip);
 
-       snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024, GFP_KERNEL|GFP_DMA);
+       snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024);
 
        chip->pcm = pcm;
        if (rpcm)
@@ -892,26 +895,26 @@ static int snd_ad1816a_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_
 
 static snd_kcontrol_new_t snd_ad1816a_controls[] = {
 AD1816A_DOUBLE("Master Playback Switch", AD1816A_MASTER_ATT, 15, 7, 1, 1),
-AD1816A_DOUBLE("Master Playback Volume", AD1816A_MASTER_ATT, 8, 0, 31, 0),
+AD1816A_DOUBLE("Master Playback Volume", AD1816A_MASTER_ATT, 8, 0, 31, 1),
 AD1816A_DOUBLE("PCM Playback Switch", AD1816A_VOICE_ATT, 15, 7, 1, 1),
-AD1816A_DOUBLE("PCM Playback Volume", AD1816A_VOICE_ATT, 8, 0, 63, 0),
+AD1816A_DOUBLE("PCM Playback Volume", AD1816A_VOICE_ATT, 8, 0, 63, 1),
 AD1816A_DOUBLE("Line Playback Switch", AD1816A_LINE_GAIN_ATT, 15, 7, 1, 1),
-AD1816A_DOUBLE("Line Playback Volume", AD1816A_LINE_GAIN_ATT, 8, 0, 31, 0),
+AD1816A_DOUBLE("Line Playback Volume", AD1816A_LINE_GAIN_ATT, 8, 0, 31, 1),
 AD1816A_DOUBLE("CD Playback Switch", AD1816A_CD_GAIN_ATT, 15, 7, 1, 1),
-AD1816A_DOUBLE("CD Playback Volume", AD1816A_CD_GAIN_ATT, 8, 0, 31, 0),
+AD1816A_DOUBLE("CD Playback Volume", AD1816A_CD_GAIN_ATT, 8, 0, 31, 1),
 AD1816A_DOUBLE("Synth Playback Switch", AD1816A_SYNTH_GAIN_ATT, 15, 7, 1, 1),
-AD1816A_DOUBLE("Synth Playback Volume", AD1816A_SYNTH_GAIN_ATT, 8, 0, 31, 0),
+AD1816A_DOUBLE("Synth Playback Volume", AD1816A_SYNTH_GAIN_ATT, 8, 0, 31, 1),
 AD1816A_DOUBLE("FM Playback Switch", AD1816A_FM_ATT, 15, 7, 1, 1),
-AD1816A_DOUBLE("FM Playback Volume", AD1816A_FM_ATT, 8, 0, 63, 0),
+AD1816A_DOUBLE("FM Playback Volume", AD1816A_FM_ATT, 8, 0, 63, 1),
 AD1816A_SINGLE("Mic Playback Switch", AD1816A_MIC_GAIN_ATT, 15, 1, 1),
-AD1816A_SINGLE("Mic Playback Volume", AD1816A_MIC_GAIN_ATT, 8, 63, 0),
+AD1816A_SINGLE("Mic Playback Volume", AD1816A_MIC_GAIN_ATT, 8, 63, 1),
 AD1816A_SINGLE("Mic Boost", AD1816A_MIC_GAIN_ATT, 14, 1, 0),
 AD1816A_DOUBLE("Video Playback Switch", AD1816A_VID_GAIN_ATT, 15, 7, 1, 1),
-AD1816A_DOUBLE("Video Playback Volume", AD1816A_VID_GAIN_ATT, 8, 0, 31, 0),
+AD1816A_DOUBLE("Video Playback Volume", AD1816A_VID_GAIN_ATT, 8, 0, 31, 1),
 AD1816A_SINGLE("Phone Capture Switch", AD1816A_PHONE_IN_GAIN_ATT, 15, 1, 1),
-AD1816A_SINGLE("Phone Capture Volume", AD1816A_PHONE_IN_GAIN_ATT, 0, 31, 0),
+AD1816A_SINGLE("Phone Capture Volume", AD1816A_PHONE_IN_GAIN_ATT, 0, 15, 1),
 AD1816A_SINGLE("Phone Playback Switch", AD1816A_PHONE_OUT_ATT, 7, 1, 1),
-AD1816A_SINGLE("Phone Playback Volume", AD1816A_PHONE_OUT_ATT, 0, 31, 0),
+AD1816A_SINGLE("Phone Playback Volume", AD1816A_PHONE_OUT_ATT, 0, 31, 1),
 {
        iface: SNDRV_CTL_ELEM_IFACE_MIXER,
        name: "Capture Source",
index ca73b7e..6ec594a 100644 (file)
@@ -22,6 +22,9 @@
  */
 
 #include <sound/driver.h>
+#include <linux/init.h>
+#include <linux/time.h>
+#include <linux/wait.h>
 #include <sound/core.h>
 #include <sound/ad1848.h>
 #define SNDRV_GET_ID
index 03f5046..9e69d06 100644 (file)
@@ -24,6 +24,7 @@
 #include <asm/io.h>
 #include <asm/dma.h>
 #include <linux/delay.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/ad1848.h>
 
@@ -525,7 +526,7 @@ static int snd_ad1848_playback_prepare(snd_pcm_substream_t * substream)
 
        chip->dma_size = size;
        chip->image[AD1848_IFACE_CTRL] &= ~(AD1848_PLAYBACK_ENABLE | AD1848_PLAYBACK_PIO);
-       snd_dma_program(chip->dma, runtime->dma_area, size, DMA_MODE_WRITE | DMA_AUTOINIT);
+       snd_dma_program(chip->dma, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT);
        count = snd_ad1848_get_count(chip->image[AD1848_DATA_FORMAT], count) - 1;
        spin_lock_irqsave(&chip->reg_lock, flags);
        snd_ad1848_out(chip, AD1848_DATA_LWR_CNT, (unsigned char) count);
@@ -569,7 +570,7 @@ static int snd_ad1848_capture_prepare(snd_pcm_substream_t * substream)
 
        chip->dma_size = size;
        chip->image[AD1848_IFACE_CTRL] &= ~(AD1848_CAPTURE_ENABLE | AD1848_CAPTURE_PIO);
-       snd_dma_program(chip->dma, runtime->dma_area, size, DMA_MODE_READ | DMA_AUTOINIT);
+       snd_dma_program(chip->dma, runtime->dma_addr, size, DMA_MODE_READ | DMA_AUTOINIT);
        count = snd_ad1848_get_count(chip->image[AD1848_DATA_FORMAT], count) - 1;
        spin_lock_irqsave(&chip->reg_lock, flags);
        snd_ad1848_out(chip, AD1848_DATA_LWR_CNT, (unsigned char) count);
@@ -786,7 +787,7 @@ static int snd_ad1848_free(ad1848_t *chip)
 {
        if (chip->res_port) {
                release_resource(chip->res_port);
-               kfree(chip->res_port);
+               kfree_nocheck(chip->res_port);
        }
        if (chip->irq >= 0)
                free_irq(chip->irq, (void *) chip);
@@ -915,7 +916,7 @@ int snd_ad1848_pcm(ad1848_t *chip, int device, snd_pcm_t **rpcm)
        pcm->info_flags = SNDRV_PCM_INFO_HALF_DUPLEX;
        strcpy(pcm->name, snd_ad1848_chip_id(chip));
 
-       snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, chip->dma > 3 ? 128*1024 : 64*1024, GFP_KERNEL|GFP_DMA);
+       snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, chip->dma > 3 ? 128*1024 : 64*1024);
 
        chip->pcm = pcm;
        if (rpcm)
index 77ee191..920209f 100644 (file)
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/wait.h>
+#include <linux/sched.h>
+#include <linux/time.h>
+#ifndef LINUX_ISAPNP_H
+#include <linux/isapnp.h>
+#define isapnp_card pci_bus
+#define isapnp_dev pci_dev
+#endif
 #include <sound/core.h>
 #define SNDRV_GET_ID
 #include <sound/initval.h>
index f6d4c19..98c2d41 100644 (file)
 #include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/init.h>
+#include <linux/time.h>
+#include <linux/wait.h>
+#ifndef LINUX_ISAPNP_H
+#include <linux/isapnp.h>
+#define isapnp_card pci_bus
+#define isapnp_dev pci_dev
+#endif
 #include <sound/core.h>
 #define SNDRV_GET_ID
 #include <sound/initval.h>
index 4e2ef12..c9ed3cb 100644 (file)
@@ -45,6 +45,7 @@
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/ad1848.h>
 #include <sound/sb.h>
index 53fe54b..75ec75c 100644 (file)
@@ -22,6 +22,8 @@
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/time.h>
+#include <linux/wait.h>
 #include <sound/core.h>
 #include <sound/cs4231.h>
 #include <sound/mpu401.h>
index 6c4637f..659a549 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/delay.h>
 #include <linux/pm.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/cs4231.h>
 
@@ -837,7 +838,7 @@ static int snd_cs4231_playback_prepare(snd_pcm_substream_t * substream)
        spin_lock_irqsave(&chip->reg_lock, flags);
        chip->p_dma_size = size;
        chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_PLAYBACK_ENABLE | CS4231_PLAYBACK_PIO);
-       snd_dma_program(chip->dma1, runtime->dma_area, size, DMA_MODE_WRITE | DMA_AUTOINIT);
+       snd_dma_program(chip->dma1, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT);
        count = snd_cs4231_get_count(chip->image[CS4231_PLAYBK_FORMAT], count) - 1;
        snd_cs4231_out(chip, CS4231_PLY_LWR_CNT, (unsigned char) count);
        snd_cs4231_out(chip, CS4231_PLY_UPR_CNT, (unsigned char) (count >> 8));
@@ -879,7 +880,7 @@ static int snd_cs4231_capture_prepare(snd_pcm_substream_t * substream)
        spin_lock_irqsave(&chip->reg_lock, flags);
        chip->c_dma_size = size;
        chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_RECORD_ENABLE | CS4231_RECORD_PIO);
-       snd_dma_program(chip->dma2, runtime->dma_area, size, DMA_MODE_READ | DMA_AUTOINIT);
+       snd_dma_program(chip->dma2, runtime->dma_addr, size, DMA_MODE_READ | DMA_AUTOINIT);
        count = snd_cs4231_get_count(chip->image[CS4231_REC_FORMAT], count) - 1;
        if (chip->single_dma && chip->hardware != CS4231_HW_INTERWAVE) {
                snd_cs4231_out(chip, CS4231_PLY_LWR_CNT, (unsigned char) count);
@@ -1330,11 +1331,11 @@ static int snd_cs4231_free(cs4231_t *chip)
 {
        if (chip->res_port) {
                release_resource(chip->res_port);
-               kfree(chip->res_port);
+               kfree_nocheck(chip->res_port);
        }
        if (chip->res_cport) {
                release_resource(chip->res_cport);
-               kfree(chip->res_port);
+               kfree_nocheck(chip->res_port);
        }
        if (chip->irq >= 0) {
                disable_irq(chip->irq);
@@ -1531,7 +1532,7 @@ int snd_cs4231_pcm(cs4231_t *chip, int device, snd_pcm_t **rpcm)
                pcm->info_flags |= SNDRV_PCM_INFO_JOINT_DUPLEX;
        strcpy(pcm->name, snd_cs4231_chip_id(chip));
 
-       snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024, GFP_KERNEL|GFP_DMA);
+       snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024);
 
        chip->pcm = pcm;
        if (rpcm)
index 00e74ca..5f3f80b 100644 (file)
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/slab.h>
+#ifndef LINUX_ISAPNP_H
+#include <linux/isapnp.h>
+#define isapnp_card pci_bus
+#define isapnp_dev pci_dev
+#endif
 #include <sound/core.h>
 #include <sound/cs4231.h>
 #include <sound/mpu401.h>
@@ -387,7 +393,7 @@ static void snd_card_cs4236_free(snd_card_t *card)
 #endif
                if (acard->res_sb_port) {
                        release_resource(acard->res_sb_port);
-                       kfree(acard->res_sb_port);
+                       kfree_nocheck(acard->res_sb_port);
                }
        }
 }
index 65c6960..cceebb1 100644 (file)
@@ -83,6 +83,8 @@
 #include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/init.h>
+#include <linux/time.h>
+#include <linux/wait.h>
 #include <sound/core.h>
 #include <sound/cs4231.h>
 #include <sound/asoundef.h>
index 68396bc..93d23d0 100644 (file)
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/sched.h>
+#include <linux/wait.h>
+#ifndef LINUX_ISAPNP_H
+#include <linux/isapnp.h>
+#define isapnp_card pci_bus
+#define isapnp_dev pci_dev
+#endif
 #include <sound/core.h>
 #define SNDRV_GET_ID
 #include <sound/initval.h>
index 7e38583..40b2aa3 100644 (file)
@@ -22,6 +22,8 @@
 #include <sound/driver.h>
 #include <asm/dma.h>
 #include <linux/init.h>
+#include <linux/time.h>
+#include <linux/wait.h>
 #include <sound/core.h>
 #include <sound/es1688.h>
 #include <sound/mpu401.h>
index feb651a..3102bf1 100644 (file)
@@ -23,6 +23,8 @@
 #include <asm/io.h>
 #include <asm/dma.h>
 #include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/es1688.h>
 #include <sound/initval.h>
@@ -405,7 +407,7 @@ static int snd_es1688_playback_prepare(snd_pcm_substream_t * substream)
        spin_unlock_irqrestore(&chip->reg_lock, flags);
        /* --- */
        count = -count;
-       snd_dma_program(chip->dma8, runtime->dma_area, size, DMA_MODE_WRITE | DMA_AUTOINIT);
+       snd_dma_program(chip->dma8, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT);
        spin_lock_irqsave(&chip->reg_lock, flags);
        snd_es1688_write(chip, 0xa4, (unsigned char) count);
        snd_es1688_write(chip, 0xa5, (unsigned char) (count >> 8));
@@ -462,7 +464,7 @@ static int snd_es1688_capture_prepare(snd_pcm_substream_t * substream)
        spin_unlock_irqrestore(&chip->reg_lock, flags);
        /* --- */
        count = -count;
-       snd_dma_program(chip->dma8, runtime->dma_area, size, DMA_MODE_READ | DMA_AUTOINIT);
+       snd_dma_program(chip->dma8, runtime->dma_addr, size, DMA_MODE_READ | DMA_AUTOINIT);
        spin_lock_irqsave(&chip->reg_lock, flags);
        snd_es1688_write(chip, 0xa4, (unsigned char) count);
        snd_es1688_write(chip, 0xa5, (unsigned char) (count >> 8));
@@ -604,6 +606,7 @@ static int snd_es1688_free(es1688_t *chip)
        if (chip->res_port) {
                snd_es1688_init(chip, 0);
                release_resource(chip->res_port);
+               kfree_nocheck(chip->res_port);
        }
        if (chip->irq >= 0)
                free_irq(chip->irq, (void *) chip);
@@ -742,10 +745,10 @@ int snd_es1688_pcm(es1688_t * chip, int device, snd_pcm_t ** rpcm)
        sprintf(pcm->name, snd_es1688_chip_id(chip));
        chip->pcm = pcm;
 
-       snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, 64*1024, GFP_KERNEL|GFP_DMA);
+       snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, 64*1024);
 
        if (rpcm)
-               *rpcm = NULL;
+               *rpcm = pcm;
        return 0;
 }
 
index f864bdb..61f4aba 100644 (file)
 #include <asm/io.h>
 #include <asm/dma.h>
 #include <linux/init.h>
+#include <linux/pm.h>
+#include <linux/slab.h>
+#ifndef LINUX_ISAPNP_H
+#include <linux/isapnp.h>
+#define isapnp_card pci_bus
+#define isapnp_dev pci_dev
+#endif
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/pcm.h>
@@ -116,6 +123,10 @@ struct _snd_es18xx {
        spinlock_t reg_lock;
        spinlock_t mixer_lock;
        spinlock_t ctrl_lock;
+#ifdef CONFIG_PM
+       struct pm_dev *pm_dev;
+       unsigned char pm_reg;
+#endif
 };
 
 #define AUDIO1_IRQ     0x01
@@ -136,6 +147,15 @@ struct _snd_es18xx {
 #define ES18XX_MUTEREC 0x0400  /* Record source can be muted */
 #define ES18XX_CONTROL 0x0800  /* Has control ports */
 
+/* Power Management */
+#define ES18XX_PM      0x07
+#define ES18XX_PM_GPO0 0x01
+#define ES18XX_PM_GPO1 0x02
+#define ES18XX_PM_PDR  0x03
+#define ES18XX_PM_ANA  0x04
+#define ES18XX_PM_FM   0x06
+#define ES18XX_PM_SUS  0x08
+
 typedef struct _snd_es18xx es18xx_t;
 
 #define chip_t es18xx_t
@@ -463,7 +483,7 @@ static int snd_es18xx_playback1_prepare(es18xx_t *chip,
                              (snd_pcm_format_unsigned(runtime->format) ? 0x00 : 0x04));
 
         /* Set DMA controller */
-        snd_dma_program(chip->dma2, runtime->dma_area, size, DMA_MODE_WRITE | DMA_AUTOINIT);
+        snd_dma_program(chip->dma2, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT);
 
        return 0;
 }
@@ -575,7 +595,7 @@ static int snd_es18xx_capture_prepare(snd_pcm_substream_t *substream)
                          (snd_pcm_format_unsigned(runtime->format) ? 0x00 : 0x20));
 
         /* Set DMA controler */
-        snd_dma_program(chip->dma1, runtime->dma_area, size, DMA_MODE_READ | DMA_AUTOINIT);
+        snd_dma_program(chip->dma1, runtime->dma_addr, size, DMA_MODE_READ | DMA_AUTOINIT);
 
        return 0;
 }
@@ -638,7 +658,7 @@ static int snd_es18xx_playback2_prepare(es18xx_t *chip,
                          (snd_pcm_format_unsigned(runtime->format) ? 0x00 : 0x20));
 
         /* Set DMA controler */
-        snd_dma_program(chip->dma1, runtime->dma_area, size, DMA_MODE_WRITE | DMA_AUTOINIT);
+        snd_dma_program(chip->dma1, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT);
 
        return 0;
 }
@@ -1580,26 +1600,105 @@ int __init snd_es18xx_pcm(es18xx_t *chip, int device, snd_pcm_t ** rpcm)
        sprintf(pcm->name, "ESS AudioDrive ES%x", chip->version);
         chip->pcm = pcm;
 
-       snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024, GFP_KERNEL|GFP_DMA);
+       snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024);
 
         if (rpcm)
                *rpcm = pcm;
        return 0;
 }
 
+/* Power Management support functions */
+#ifdef CONFIG_PM
+static void snd_es18xx_suspend(es18xx_t *chip)
+{
+       snd_card_t *card = chip->card;
+
+       snd_power_lock(card);
+       if (card->power_state == SNDRV_CTL_POWER_D3hot)
+               goto __skip;
+
+       snd_pcm_suspend_all(chip->pcm);
+
+       /* power down */
+       chip->pm_reg = (unsigned char)snd_es18xx_read(chip, ES18XX_PM);
+       chip->pm_reg |= (ES18XX_PM_FM | ES18XX_PM_SUS);
+       snd_es18xx_write(chip, ES18XX_PM, chip->pm_reg);
+       snd_es18xx_write(chip, ES18XX_PM, chip->pm_reg ^= ES18XX_PM_SUS);
+
+       snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
+      __skip:
+       snd_power_unlock(card);
+}
+
+static void snd_es18xx_resume(es18xx_t *chip)
+{
+       snd_card_t *card = chip->card;
+
+       snd_power_lock(card);
+       if (card->power_state == SNDRV_CTL_POWER_D0)
+               goto __skip;
+
+       /* restore PM register, we won't wake till (not 0x07) i/o activity though */
+       snd_es18xx_write(chip, ES18XX_PM, chip->pm_reg ^= ES18XX_PM_FM);
+
+       snd_power_change_state(card, SNDRV_CTL_POWER_D0);
+      __skip:
+       snd_power_unlock(card);
+}
+
+/* callback for control API */
+static int snd_es18xx_set_power_state(snd_card_t *card, unsigned int power_state)
+{
+       es18xx_t *chip = (es18xx_t *) card->power_state_private_data;
+       switch (power_state) {
+       case SNDRV_CTL_POWER_D0:
+       case SNDRV_CTL_POWER_D1:
+       case SNDRV_CTL_POWER_D2:
+               snd_es18xx_resume(chip);
+               break;
+       case SNDRV_CTL_POWER_D3hot:
+       case SNDRV_CTL_POWER_D3cold:
+               snd_es18xx_suspend(chip);
+               break;
+       default:
+               return -EINVAL;
+       }
+       return 0;
+}
+
+static int snd_es18xx_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data)
+{
+       es18xx_t *chip = snd_magic_cast(es18xx_t, dev->data, return 0);
+
+       switch (rqst) {
+       case PM_SUSPEND:
+               snd_es18xx_suspend(chip);
+               break;
+       case PM_RESUME:
+               snd_es18xx_resume(chip);
+               break;
+       }
+       return 0;
+}
+#endif /* CONFIG_PM */
+
 static int snd_es18xx_free(es18xx_t *chip)
 {
+#ifdef CONFIG_PM
+       if (chip->pm_dev)
+               pm_unregister(chip->pm_dev);
+#endif
        if (chip->res_port) {
                release_resource(chip->res_port);
-               kfree(chip->res_port);
+               kfree_nocheck(chip->res_port);
        }
        if (chip->res_ctrl_port) {
                release_resource(chip->res_ctrl_port);
-               kfree(chip->res_ctrl_port);
+               kfree_nocheck(chip->res_ctrl_port);
        }
        if (chip->res_mpu_port) {
                release_resource(chip->res_mpu_port);
-               kfree(chip->res_mpu_port);
+               kfree_nocheck(chip->res_mpu_port);
        }
        if (chip->irq >= 0)
                free_irq(chip->irq, (void *) chip);
@@ -2066,6 +2165,17 @@ static int __init snd_audiodrive_probe(int dev)
                }
                chip->rmidi = rmidi;
        }
+
+#ifdef CONFIG_PM
+       /* Power Management */
+       chip->pm_dev = pm_register(PM_ISA_DEV, 0, snd_es18xx_pm_callback);
+       if (chip->pm_dev) {
+               chip->pm_dev->data = chip;
+               /* set control api callback */
+               card->set_power_state = snd_es18xx_set_power_state;
+               card->power_state_private_data = chip;
+       }
+#endif
        sprintf(card->driver, "ES%x", chip->version);
        sprintf(card->shortname, "ESS AudioDrive ES%x", chip->version);
        sprintf(card->longname, "%s at 0x%lx, irq %d, dma1 %d, dma2 %d",
index 1b64044..3281bda 100644 (file)
@@ -22,6 +22,7 @@
 #define __NO_VERSION__
 #include <sound/driver.h>
 #include <asm/dma.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/gus.h>
 
@@ -37,7 +38,7 @@ void snd_gf1_dma_ack(snd_gus_card_t * gus)
 
 void snd_gf1_dma_program(snd_gus_card_t * gus,
                         unsigned int addr,
-                        const void *buf,
+                        unsigned long buf_addr,
                         unsigned int count,
                         unsigned int cmd)
 {
@@ -76,7 +77,7 @@ void snd_gf1_dma_program(snd_gus_card_t * gus,
                count &= ~1;    /* align */
        }
        snd_gf1_dma_ack(gus);
-       snd_dma_program(gus->gf1.dma1, buf, count, dma_cmd & SNDRV_GF1_DMA_READ ? DMA_MODE_READ : DMA_MODE_WRITE);
+       snd_dma_program(gus->gf1.dma1, buf_addr, count, dma_cmd & SNDRV_GF1_DMA_READ ? DMA_MODE_READ : DMA_MODE_WRITE);
 #if 0
        snd_printk("address = 0x%x, count = 0x%x, dma_cmd = 0x%x\n", address << 1, count, dma_cmd);
 #endif
@@ -140,7 +141,7 @@ static void snd_gf1_dma_interrupt(snd_gus_card_t * gus)
        }
        block = snd_gf1_dma_next_block(gus);
        spin_unlock(&gus->dma_lock);
-       snd_gf1_dma_program(gus, block->addr, block->buffer, block->count, (unsigned short) block->cmd);
+       snd_gf1_dma_program(gus, block->addr, block->buf_addr, block->count, (unsigned short) block->cmd);
        kfree(block);
 #if 0
        printk("program dma (IRQ) - addr = 0x%x, buffer = 0x%lx, count = 0x%x, cmd = 0x%x\n", addr, (long) buffer, count, cmd);
@@ -235,7 +236,7 @@ int snd_gf1_dma_transfer_block(snd_gus_card_t * gus,
                spin_unlock_irqrestore(&gus->dma_lock, flags);
                if (block == NULL)
                        return 0;
-               snd_gf1_dma_program(gus, block->addr, block->buffer, block->count, (unsigned short) block->cmd);
+               snd_gf1_dma_program(gus, block->addr, block->buf_addr, block->count, (unsigned short) block->cmd);
                kfree(block);
                return 0;
        }
index 290611a..7c45422 100644 (file)
@@ -21,6 +21,7 @@
 
 #define __NO_VERSION__
 #include <sound/driver.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/gus.h>
 #include <sound/info.h>
index 0d66fb5..99164cc 100644 (file)
@@ -21,6 +21,7 @@
 
 #define __NO_VERSION__
 #include <sound/driver.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/gus.h>
 
index 7c815dc..b271f14 100644 (file)
@@ -22,6 +22,7 @@
 #define __NO_VERSION__
 #include <sound/driver.h>
 #include <linux/delay.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/gus.h>
 
index a0a29e0..262f2c1 100644 (file)
@@ -22,6 +22,8 @@
 #include <sound/driver.h>
 #include <asm/dma.h>
 #include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/gus.h>
 #include <sound/control.h>
@@ -122,11 +124,11 @@ static int snd_gus_free(snd_gus_card_t *gus)
       __hw_end:
        if (gus->gf1.res_port1) {
                release_resource(gus->gf1.res_port1);
-               kfree(gus->gf1.res_port1);
+               kfree_nocheck(gus->gf1.res_port1);
        }
        if (gus->gf1.res_port2) {
                release_resource(gus->gf1.res_port2);
-               kfree(gus->gf1.res_port2);
+               kfree_nocheck(gus->gf1.res_port2);
        }
        if (gus->gf1.irq >= 0)
                free_irq(gus->gf1.irq, (void *) gus);
index 348842f..cfcbeae 100644 (file)
@@ -21,6 +21,7 @@
 
 #define __NO_VERSION__
 #include <sound/driver.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/gus.h>
 #include <sound/info.h>
index cf326fb..066c8d6 100644 (file)
@@ -21,6 +21,7 @@
 
 #define __NO_VERSION__
 #include <sound/driver.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/gus.h>
 #include <sound/info.h>
index 354102e..6e50190 100644 (file)
@@ -21,6 +21,8 @@
 
 #define __NO_VERSION__
 #include <sound/driver.h>
+#include <linux/time.h>
+#include <linux/wait.h>
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/gus.h>
index 7e75e13..6954f91 100644 (file)
@@ -28,6 +28,7 @@
 #define __NO_VERSION__
 #include <sound/driver.h>
 #include <asm/dma.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/gus.h>
@@ -93,6 +94,7 @@ static int snd_gf1_pcm_block_change(snd_pcm_substream_t * substream,
                block.cmd |= SNDRV_GF1_DMA_16BIT;
        block.addr = addr & ~31;
        block.buffer = runtime->dma_area + offset;
+       block.buf_addr = runtime->dma_addr + offset;
        block.count = count;
        block.private_data = pcmp;
        block.ack = snd_gf1_pcm_block_change_ack;
@@ -570,7 +572,7 @@ static int snd_gf1_pcm_capture_prepare(snd_pcm_substream_t * substream)
        snd_gf1_i_write8(gus, SNDRV_GF1_GB_RECORD_RATE, runtime->rate_den - 2);
        snd_gf1_i_write8(gus, SNDRV_GF1_GB_REC_DMA_CONTROL, 0); /* disable sampling */
        snd_gf1_i_look8(gus, SNDRV_GF1_GB_REC_DMA_CONTROL);     /* Sampling Control Register */
-       snd_dma_program(gus->gf1.dma2, &runtime->dma_area, gus->c_period_size, DMA_MODE_READ);
+       snd_dma_program(gus->gf1.dma2, runtime->dma_addr, gus->c_period_size, DMA_MODE_READ);
        return 0;
 }
 
@@ -860,7 +862,7 @@ int snd_gf1_pcm_new(snd_gus_card_t * gus, int pcm_dev, int control_index, snd_pc
        snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_gf1_pcm_playback_ops);
 
        for (substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; substream; substream = substream->next)
-               snd_pcm_lib_preallocate_isa_pages(substream, 64*1024, gus->gf1.dma1 > 3 ? 128*1024 : 64*1024, GFP_KERNEL|GFP_DMA);
+               snd_pcm_lib_preallocate_isa_pages(substream, 64*1024, gus->gf1.dma1 > 3 ? 128*1024 : 64*1024);
        
        pcm->info_flags = 0;
        pcm->dev_subclass = SNDRV_PCM_SUBCLASS_GENERIC_MIX;
@@ -868,7 +870,7 @@ int snd_gf1_pcm_new(snd_gus_card_t * gus, int pcm_dev, int control_index, snd_pc
                snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_gf1_pcm_capture_ops);
                if (gus->gf1.dma2 == gus->gf1.dma1)
                        pcm->info_flags |= SNDRV_PCM_INFO_HALF_DUPLEX;
-               snd_pcm_lib_preallocate_isa_pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream, 64*1024, gus->gf1.dma2 > 3 ? 128*1024 : 64*1024, GFP_KERNEL|GFP_DMA);
+               snd_pcm_lib_preallocate_isa_pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream, 64*1024, gus->gf1.dma2 > 3 ? 128*1024 : 64*1024);
        }
        strcpy(pcm->name, pcm->id);
        if (gus->interwave) {
index 53c0982..3ad688a 100644 (file)
@@ -22,6 +22,7 @@
 #include <sound/driver.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/gus.h>
 
index 4bddddc..b38f434 100644 (file)
@@ -21,6 +21,7 @@
 
 #define __NO_VERSION__
 #include <sound/driver.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/gus.h>
 
index c514721..b0f9f08 100644 (file)
@@ -21,6 +21,7 @@
 
 #define __NO_VERSION__
 #include <sound/driver.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/gus.h>
 #include "gus_tables.h"
index 310ed31..d65fe7b 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/gus.h>
 #include <sound/seq_device.h>
index 628738c..290d45d 100644 (file)
@@ -23,6 +23,7 @@
 
 #define __NO_VERSION__
 #include <sound/driver.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/gus.h>
 
index d862e53..814b81e 100644 (file)
@@ -23,6 +23,7 @@
 #include <sound/driver.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/gus.h>
 
index a5ad3cb..665d9cb 100644 (file)
@@ -20,6 +20,7 @@
 
 #define __NO_VERSION__
 #include <sound/driver.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/gus.h>
 #define __GUS_TABLES_ALLOC__
index 8ace303..701a321 100644 (file)
@@ -22,6 +22,8 @@
 #include <sound/driver.h>
 #include <asm/dma.h>
 #include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/gus.h>
 #define SNDRV_LEGACY_AUTO_PROBE
index fb72dde..37ea104 100644 (file)
@@ -22,6 +22,8 @@
 #include <sound/driver.h>
 #include <asm/dma.h>
 #include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/gus.h>
 #include <sound/es1688.h>
index b0ce30b..1553e12 100644 (file)
@@ -22,6 +22,8 @@
 #include <sound/driver.h>
 #include <asm/dma.h>
 #include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/gus.h>
 #include <sound/cs4231.h>
index f8e7868..68d54e1 100644 (file)
 #include <asm/dma.h>
 #include <linux/delay.h>
 #include <linux/init.h>
+#include <linux/slab.h>
+#ifndef LINUX_ISAPNP_H
+#include <linux/isapnp.h>
+#define isapnp_card pci_bus
+#define isapnp_dev pci_dev
+#endif
 #include <sound/core.h>
 #include <sound/gus.h>
 #include <sound/cs4231.h>
@@ -688,7 +694,7 @@ static void snd_interwave_free(snd_card_t *card)
 #ifdef SNDRV_STB
        if (iwcard->i2c_res) {
                release_resource(iwcard->i2c_res);
-               kfree(iwcard->i2c_res);
+               kfree_nocheck(iwcard->i2c_res);
        }
 #endif
        if (iwcard->irq >= 0)
index eb1632a..c92701d 100644 (file)
 #include <asm/io.h>
 #include <linux/init.h>
 #include <linux/pm.h>
+#include <linux/slab.h>
+#ifndef LINUX_ISAPNP_H
+#include <linux/isapnp.h>
+#define isapnp_card pci_bus
+#define isapnp_dev pci_dev
+#endif
 #include <sound/core.h>
 #include <sound/cs4231.h>
 #include <sound/mpu401.h>
@@ -540,11 +546,11 @@ static int __init snd_opl3sa2_mixer(opl3sa2_t *chip)
 
 /* Power Management support functions */
 #ifdef CONFIG_PM
-static void snd_opl3sa2_suspend(opl3sa2_t *chip, int can_schedule)
+static void snd_opl3sa2_suspend(opl3sa2_t *chip)
 {
        snd_card_t *card = chip->card;
 
-       snd_power_lock(card, can_schedule);
+       snd_power_lock(card);
        if (card->power_state == SNDRV_CTL_POWER_D3hot)
                goto __skip;
 
@@ -560,12 +566,12 @@ static void snd_opl3sa2_suspend(opl3sa2_t *chip, int can_schedule)
        snd_power_unlock(card);
 }
 
-static void snd_opl3sa2_resume(opl3sa2_t *chip, int can_schedule)
+static void snd_opl3sa2_resume(opl3sa2_t *chip)
 {
        snd_card_t *card = chip->card;
        int i;
 
-       snd_power_lock(card, can_schedule);
+       snd_power_lock(card);
        if (card->power_state == SNDRV_CTL_POWER_D0)
                goto __skip;
 
@@ -597,11 +603,11 @@ static int snd_opl3sa2_set_power_state(snd_card_t *card, unsigned int power_stat
        case SNDRV_CTL_POWER_D0:
        case SNDRV_CTL_POWER_D1:
        case SNDRV_CTL_POWER_D2:
-               snd_opl3sa2_resume(chip, 1);
+               snd_opl3sa2_resume(chip);
                break;
        case SNDRV_CTL_POWER_D3hot:
        case SNDRV_CTL_POWER_D3cold:
-               snd_opl3sa2_suspend(chip, 1);
+               snd_opl3sa2_suspend(chip);
                break;
        default:
                return -EINVAL;
@@ -615,10 +621,10 @@ static int snd_opl3sa2_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *
 
        switch (rqst) {
        case PM_SUSPEND:
-               snd_opl3sa2_suspend(chip, 0);
+               snd_opl3sa2_suspend(chip);
                break;
        case PM_RESUME:
-               snd_opl3sa2_resume(chip, 0);
+               snd_opl3sa2_resume(chip);
                break;
        }
        return 0;
@@ -699,7 +705,7 @@ static int snd_opl3sa2_free(opl3sa2_t *chip)
                free_irq(chip->irq, (void *)chip);
        if (chip->res_port) {
                release_resource(chip->res_port);
-               kfree(chip->res_port);
+               kfree_nocheck(chip->res_port);
        }
        snd_magic_kfree(chip);
        return 0;
index f122123..ea99fc5 100644 (file)
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 */
 
+
 #include <sound/driver.h>
 #include <asm/io.h>
 #include <asm/dma.h>
 #include <linux/delay.h>
 #include <linux/init.h>
+#include <linux/slab.h>
+#ifndef LINUX_ISAPNP_H
+#include <linux/isapnp.h>
+#define isapnp_card pci_bus
+#define isapnp_dev pci_dev
+#endif
 #include <sound/core.h>
 #ifdef CS4231
 #include <sound/cs4231.h>
@@ -1021,7 +1028,7 @@ static int snd_opti93x_playback_prepare(snd_pcm_substream_t * substream)
                OPTi93X_PLAYBACK_ENABLE | OPTi93X_PLAYBACK_PIO,
                ~(OPTi93X_PLAYBACK_ENABLE | OPTi93X_PLAYBACK_PIO));
 
-       snd_dma_program(chip->dma1, runtime->dma_area, size,
+       snd_dma_program(chip->dma1, runtime->dma_addr, size,
                DMA_MODE_WRITE | DMA_AUTOINIT);
 
        format = snd_opti93x_get_freq(runtime->rate);
@@ -1054,7 +1061,7 @@ static int snd_opti93x_capture_prepare(snd_pcm_substream_t *substream)
                OPTi93X_CAPTURE_ENABLE | OPTi93X_CAPTURE_PIO,
                (unsigned char)~(OPTi93X_CAPTURE_ENABLE | OPTi93X_CAPTURE_PIO));
 
-       snd_dma_program(chip->dma2, runtime->dma_area, size,
+       snd_dma_program(chip->dma2, runtime->dma_addr, size,
                DMA_MODE_READ | DMA_AUTOINIT);
 
        format = snd_opti93x_get_freq(runtime->rate);
@@ -1243,7 +1250,7 @@ static int snd_opti93x_free(opti93x_t *chip)
 {
        if (chip->res_port) {
                release_resource(chip->res_port);
-               kfree(chip->res_port);
+               kfree_nocheck(chip->res_port);
        }
        if (chip->dma1 >= 0) {
                disable_dma(chip->dma1);
@@ -1377,7 +1384,7 @@ int snd_opti93x_pcm(opti93x_t *codec, int device, snd_pcm_t **rpcm)
 
        strcpy(pcm->name, snd_opti93x_chip_id(codec));
 
-       snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, codec->dma1 > 3 || codec->dma2 > 3 ? 128*1024 : 64*1024, GFP_KERNEL|GFP_DMA);
+       snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, codec->dma1 > 3 || codec->dma2 > 3 ? 128*1024 : 64*1024);
 
        codec->pcm = pcm;
        if (rpcm)
@@ -1889,7 +1896,7 @@ static void snd_card_opti9xx_free(snd_card_t *card)
 #endif /* __ISAPNP__ */
                if (chip->res_mc_base) {
                        release_resource(chip->res_mc_base);
-                       kfree(chip->res_mc_base);
+                       kfree_nocheck(chip->res_mc_base);
                }
        }
 }
index 0832385..61f4a01 100644 (file)
  */
 
 #define __NO_VERSION__
+#include <sound/driver.h>
+#include <linux/wait.h>
+#include <linux/sched.h>
+#include <linux/slab.h>
+#include <sound/core.h>
 #include <sound/emu8000.h>
 #include <sound/emu8000_reg.h>
 #include <asm/io.h>
@@ -1058,15 +1063,15 @@ static int snd_emu8000_free(emu8000_t *hw)
 {
        if (hw->res_port1) {
                release_resource(hw->res_port1);
-               kfree(hw->res_port1);
+               kfree_nocheck(hw->res_port1);
        }
        if (hw->res_port2) {
                release_resource(hw->res_port2);
-               kfree(hw->res_port2);
+               kfree_nocheck(hw->res_port2);
        }
        if (hw->res_port3) {
                release_resource(hw->res_port3);
-               kfree(hw->res_port3);
+               kfree_nocheck(hw->res_port3);
        }
        snd_magic_kfree(hw);
        return 0;
index e53c1aa..12e64e3 100644 (file)
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
+#include <sound/driver.h>
+#include <linux/wait.h>
+#include <linux/sched.h>
+#include <linux/slab.h>
+#include <sound/core.h>
 #include <sound/emu8000.h>
 #include <sound/emu8000_reg.h>
 
index d8bae77..bd9bace 100644 (file)
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/time.h>
+#ifndef LINUX_ISAPNP_H
+#include <linux/isapnp.h>
+#define isapnp_card pci_bus
+#define isapnp_dev pci_dev
+#endif
 #include <sound/core.h>
 #define SNDRV_GET_ID
 #include <sound/initval.h>
index 40b5f20..b57b0bd 100644 (file)
 #include <sound/driver.h>
 #include <asm/dma.h>
 #include <linux/init.h>
+#include <linux/slab.h>
+#ifndef LINUX_ISAPNP_H
+#include <linux/isapnp.h>
+#define isapnp_card pci_bus
+#define isapnp_dev pci_dev
+#endif
 #include <sound/core.h>
 #include <sound/sb.h>
 #include <sound/sb16_csp.h>
@@ -350,7 +356,7 @@ static void snd_sb16_free(snd_card_t *card)
                return;
        if (acard->fm_res) {
                release_resource(acard->fm_res);
-               kfree(acard->fm_res);
+               kfree_nocheck(acard->fm_res);
        }
 #ifdef __ISAPNP__
        snd_sb16_deactivate(acard);
index c773a36..9d6ed68 100644 (file)
@@ -26,6 +26,7 @@
 #include <sound/driver.h>
 #include <linux/delay.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/info.h>
@@ -41,14 +42,11 @@ MODULE_CLASSES("{sound}");
 
 #ifdef SNDRV_LITTLE_ENDIAN
 #define CSP_HDR_VALUE(a,b,c,d) ((a) | ((b)<<8) | ((c)<<16) | ((d)<<24))
-#define LE_SHORT(v)            (v)
-#define LE_INT(v)              (v)
 #else
-#include <byteswap.h>
 #define CSP_HDR_VALUE(a,b,c,d) ((d) | ((c)<<8) | ((b)<<16) | ((a)<<24))
-#define LE_SHORT(v)            bswap_16(v)
-#define LE_INT(v)              bswap_32(v)
 #endif
+#define LE_SHORT(v)            le16_to_cpu(v)
+#define LE_INT(v)              le32_to_cpu(v)
 
 #define RIFF_HEADER    CSP_HDR_VALUE('R', 'I', 'F', 'F')
 #define CSP__HEADER    CSP_HDR_VALUE('C', 'S', 'P', ' ')
@@ -320,7 +318,7 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t * mcode
                return -EFAULT;
        if ((file_h.name != RIFF_HEADER) ||
            (LE_INT(file_h.len) >= SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE - sizeof(file_h))) {
-               snd_printd(__FUNCTION__ ": Invalid RIFF header\n");
+               snd_printd("%s: Invalid RIFF header\n", __FUNCTION__);
                return -EINVAL;
        }
        data_ptr += sizeof(file_h);
@@ -329,7 +327,7 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t * mcode
        if (copy_from_user(&item_type, data_ptr, sizeof(item_type)))
                return -EFAULT;
        if (item_type != CSP__HEADER) {
-               snd_printd(__FUNCTION__ ": Invalid RIFF file type\n");
+               snd_printd("%s: Invalid RIFF file type\n", __FUNCTION__);
                return -EINVAL;
        }
        data_ptr += sizeof (item_type);
@@ -384,7 +382,7 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t * mcode
                                return -EFAULT;
 
                        if (code_h.name != MAIN_HEADER) {
-                               snd_printd(__FUNCTION__ ": Missing 'main' microcode\n");
+                               snd_printd("%s: Missing 'main' microcode\n", __FUNCTION__);
                                return -EINVAL;
                        }
                        data_ptr += sizeof(code_h);
@@ -428,7 +426,8 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t * mcode
                        default:        /* other codecs are unsupported */
                                p->acc_format = p->acc_width = p->acc_rates = 0;
                                p->mode = 0;
-                               snd_printd(__FUNCTION__ ": Unsupported CSP codec type: 0x%04x\n",
+                               snd_printd("%s: Unsupported CSP codec type: 0x%04x\n",
+                                          __FUNCTION__,
                                           LE_SHORT(funcdesc_h.VOC_type));
                                return -EINVAL;
                        }
@@ -447,7 +446,7 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t * mcode
                        return 0;
                }
        }
-       snd_printd(__FUNCTION__ ": Function #%d not found\n", info.func_req);
+       snd_printd("%s: Function #%d not found\n", __FUNCTION__, info.func_req);
        return -EINVAL;
 }
 
@@ -601,7 +600,7 @@ static int get_version(sb_t *chip)
 static int snd_sb_csp_check_version(snd_sb_csp_t * p)
 {
        if (p->version < 0x10 || p->version > 0x1f) {
-               snd_printd(__FUNCTION__ ": Invalid CSP version: 0x%x\n", p->version);
+               snd_printd("%s: Invalid CSP version: 0x%x\n", __FUNCTION__, p->version);
                return 1;
        }
        return 0;
@@ -620,7 +619,7 @@ static int snd_sb_csp_load(snd_sb_csp_t * p, const unsigned char *buf, int size,
        spin_lock_irqsave(&p->chip->reg_lock, flags);
        snd_sbdsp_command(p->chip, 0x01);       /* CSP download command */
        if (snd_sbdsp_get_byte(p->chip)) {
-               snd_printd(__FUNCTION__ ": Download command failed\n");
+               snd_printd("%s: Download command failed\n", __FUNCTION__);
                goto __fail;
        }
        /* Send CSP low byte (size - 1) */
@@ -665,7 +664,7 @@ static int snd_sb_csp_load(snd_sb_csp_t * p, const unsigned char *buf, int size,
                        udelay (10);
                }
                if (status != 0x55) {
-                       snd_printd(__FUNCTION__ ": Microcode initialization failed\n");
+                       snd_printd("%s: Microcode initialization failed\n", __FUNCTION__);
                        goto __fail;
                }
        } else {
@@ -780,19 +779,19 @@ static int snd_sb_csp_start(snd_sb_csp_t * p, int sample_width, int channels)
        unsigned long flags;
 
        if (!(p->running & (SNDRV_SB_CSP_ST_LOADED | SNDRV_SB_CSP_ST_AUTO))) {
-               snd_printd(__FUNCTION__ ": Microcode not loaded\n");
+               snd_printd("%s: Microcode not loaded\n", __FUNCTION__);
                return -ENXIO;
        }
        if (p->running & SNDRV_SB_CSP_ST_RUNNING) {
-               snd_printd(__FUNCTION__ ": CSP already running\n");
+               snd_printd("%s: CSP already running\n", __FUNCTION__);
                return -EBUSY;
        }
        if (!(sample_width & p->acc_width)) {
-               snd_printd(__FUNCTION__ ": Unsupported PCM sample width\n");
+               snd_printd("%s: Unsupported PCM sample width\n", __FUNCTION__);
                return -EINVAL;
        }
        if (!(channels & p->acc_channels)) {
-               snd_printd(__FUNCTION__ ": Invalid number of channels\n");
+               snd_printd("%s: Invalid number of channels\n", __FUNCTION__);
                return -EINVAL;
        }
 
@@ -814,11 +813,11 @@ static int snd_sb_csp_start(snd_sb_csp_t * p, int sample_width, int channels)
                s_type |= 0x22; /* 00dX 00dX    (d = 1 if 8 bit samples) */
 
        if (set_codec_parameter(p->chip, 0x81, s_type)) {
-               snd_printd(__FUNCTION__ ": Set sample type command failed\n");
+               snd_printd("%s: Set sample type command failed\n", __FUNCTION__);
                goto __fail;
        }
        if (set_codec_parameter(p->chip, 0x80, 0x00)) {
-               snd_printd(__FUNCTION__ ": Codec start command failed\n");
+               snd_printd("%s: Codec start command failed\n", __FUNCTION__);
                goto __fail;
        }
        p->run_width = sample_width;
index a5ded25..0d59af5 100644 (file)
@@ -31,6 +31,7 @@
 #include <asm/io.h>
 #include <asm/dma.h>
 #include <linux/init.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/sb.h>
 #include <sound/sb16_csp.h>
@@ -269,7 +270,7 @@ static int snd_sb16_playback_prepare(snd_pcm_substream_t * substream)
        snd_sb16_setup_rate(chip, runtime->rate, SNDRV_PCM_STREAM_PLAYBACK);
        size = chip->p_dma_size = snd_pcm_lib_buffer_bytes(substream);
        dma = (chip->mode & SB_MODE_PLAYBACK_8) ? chip->dma8 : chip->dma16;
-       snd_dma_program(dma, runtime->dma_area, size, DMA_MODE_WRITE | DMA_AUTOINIT);
+       snd_dma_program(dma, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT);
 
        count = snd_pcm_lib_period_bytes(substream);
        spin_lock_irqsave(&chip->reg_lock, flags);
@@ -336,7 +337,7 @@ static int snd_sb16_capture_prepare(snd_pcm_substream_t * substream)
        snd_sb16_setup_rate(chip, runtime->rate, SNDRV_PCM_STREAM_CAPTURE);
        size = chip->c_dma_size = snd_pcm_lib_buffer_bytes(substream);
        dma = (chip->mode & SB_MODE_CAPTURE_8) ? chip->dma8 : chip->dma16;
-       snd_dma_program(dma, runtime->dma_area, size, DMA_MODE_READ | DMA_AUTOINIT);
+       snd_dma_program(dma, runtime->dma_addr, size, DMA_MODE_READ | DMA_AUTOINIT);
 
        count = snd_pcm_lib_period_bytes(substream);
        spin_lock_irqsave(&chip->reg_lock, flags);
@@ -870,7 +871,7 @@ int snd_sb16dsp_pcm(sb_t * chip, int device, snd_pcm_t ** rpcm)
 
        snd_ctl_add(card, snd_ctl_new1(&snd_sb16_dma_control, chip));
 
-       snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, 128*1024, GFP_KERNEL|GFP_DMA);
+       snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, 128*1024);
 
        if (rpcm)
                *rpcm = pcm;
index ea79d00..320b9fa 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/sb.h>
 #include <sound/opl3.h>
@@ -89,7 +90,7 @@ static void snd_sb8_free(snd_card_t *card)
                return;
        if (acard->fm_res) {
                release_resource(acard->fm_res);
-               kfree(acard->fm_res);
+               kfree_nocheck(acard->fm_res);
        }
 }
 
index 816c860..9a283c6 100644 (file)
@@ -34,6 +34,7 @@
 #include <asm/io.h>
 #include <asm/dma.h>
 #include <linux/init.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/sb.h>
 
@@ -147,7 +148,7 @@ static int snd_sb8_playback_prepare(snd_pcm_substream_t * substream)
                /* Soundblaster hardware programming reference guide, 3-23 */
                snd_sbdsp_command(chip, SB_DSP_DMA8_EXIT);
                runtime->dma_area[0] = 0x80;
-               snd_dma_program(chip->dma8, runtime->dma_area, 1, DMA_MODE_WRITE);
+               snd_dma_program(chip->dma8, runtime->dma_addr, 1, DMA_MODE_WRITE);
                /* force interrupt */
                chip->mode = SB_MODE_HALT;
                snd_sbdsp_command(chip, SB_DSP_OUTPUT);
@@ -174,7 +175,7 @@ static int snd_sb8_playback_prepare(snd_pcm_substream_t * substream)
                snd_sbdsp_command(chip, count >> 8);
        }
        spin_unlock_irqrestore(&chip->reg_lock, flags);
-       snd_dma_program(chip->dma8, runtime->dma_area,
+       snd_dma_program(chip->dma8, runtime->dma_addr,
                        size, DMA_MODE_WRITE | DMA_AUTOINIT);
        return 0;
 }
@@ -286,7 +287,7 @@ static int snd_sb8_capture_prepare(snd_pcm_substream_t * substream)
                snd_sbdsp_command(chip, count >> 8);
        }
        spin_unlock_irqrestore(&chip->reg_lock, flags);
-       snd_dma_program(chip->dma8, runtime->dma_area,
+       snd_dma_program(chip->dma8, runtime->dma_addr,
                        size, DMA_MODE_READ | DMA_AUTOINIT);
        return 0;
 }
@@ -533,7 +534,7 @@ int snd_sb8dsp_pcm(sb_t *chip, int device, snd_pcm_t ** rpcm)
        snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_sb8_playback_ops);
        snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_sb8_capture_ops);
 
-       snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, 64*1024, GFP_KERNEL|GFP_DMA);
+       snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, 64*1024);
 
        if (rpcm)
                *rpcm = pcm;
index b6c7f75..deb8386 100644 (file)
@@ -26,6 +26,7 @@
 #define __NO_VERSION__
 #include <sound/driver.h>
 #include <asm/io.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/sb.h>
 
index 1c5bad9..22da20b 100644 (file)
@@ -25,6 +25,7 @@
 #include <asm/dma.h>
 #include <linux/delay.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/sb.h>
 #include <sound/initval.h>
@@ -51,7 +52,7 @@ int snd_sbdsp_command(sb_t *chip, unsigned char val)
                        outb(val, SBP(chip, COMMAND));
                        return 1;
                }
-       snd_printd(__FUNCTION__ " [0x%lx]: timeout (0x%x)\n", chip->port, val);
+       snd_printd("%s [0x%lx]: timeout (0x%x)\n", __FUNCTION__, chip->port, val);
        return 0;
 }
 
@@ -68,7 +69,7 @@ int snd_sbdsp_get_byte(sb_t *chip)
                        return val;
                }
        }
-       snd_printd(__FUNCTION__ " [0x%lx]: timeout\n", chip->port);
+       snd_printd("%s [0x%lx]: timeout\n", __FUNCTION__, chip->port);
        return -ENODEV;
 }
 
@@ -87,7 +88,7 @@ int snd_sbdsp_reset(sb_t *chip)
                        else
                                break;
                }
-       snd_printdd(__FUNCTION__ " [0x%lx] failed...\n", chip->port);
+       snd_printdd("%s [0x%lx] failed...\n", __FUNCTION__, chip->port);
        return -ENODEV;
 }
 
@@ -176,11 +177,11 @@ static int snd_sbdsp_free(sb_t *chip)
 {
        if (chip->res_port) {
                release_resource(chip->res_port);
-               kfree(chip->res_port);
+               kfree_nocheck(chip->res_port);
        }
        if (chip->res_alt_port) {
                release_resource(chip->res_alt_port);
-               kfree(chip->res_alt_port);
+               kfree_nocheck(chip->res_alt_port);
        }
        if (chip->irq >= 0)
                free_irq(chip->irq, (void *) chip);
index efa1baf..340e0d8 100644 (file)
@@ -23,6 +23,7 @@
 #include <sound/driver.h>
 #include <asm/io.h>
 #include <linux/delay.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/sb.h>
 #include <sound/control.h>
index 853e461..09ddf37 100644 (file)
@@ -24,6 +24,8 @@
 #include <sound/driver.h>
 #include <asm/dma.h>
 #include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/sb.h>
 #include <sound/ad1848.h>
index b311054..59164bf 100644 (file)
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/slab.h>
+#ifndef LINUX_ISAPNP_H
+#include <linux/isapnp.h>
+#define isapnp_card pci_bus
+#define isapnp_dev pci_dev
+#endif
 #include <sound/core.h>
 #define SNDRV_GET_ID
 #include <sound/initval.h>
@@ -47,10 +53,9 @@ static int snd_cs4232_mpu_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 9,11,12,15 */
 static long snd_ics2115_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
 static int snd_ics2115_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;    /* 2,9,11,12,15 */
 static long snd_fm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;         /* PnP setup */
-static long snd_control_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
-static long snd_wss_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;        /* PnP setup */
 static int snd_dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;      /* 0,1,3,5,6,7 */
 static int snd_dma2[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;      /* 0,1,3,5,6,7 */
+static int snd_use_cs4232_midi[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; 
 
 MODULE_PARM(snd_index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
 MODULE_PARM_SYNTAX(snd_index, "Index value for WaveFront soundcard.");
@@ -92,9 +97,9 @@ MODULE_PARM_SYNTAX(snd_ics2115_port, SNDRV_PORT12_DESC);
 MODULE_PARM(snd_fm_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
 MODULE_PARM_DESC(snd_fm_port, "FM port #.");
 MODULE_PARM_SYNTAX(snd_fm_port, SNDRV_PORT12_DESC);
-MODULE_PARM(snd_wss_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
-MODULE_PARM_DESC(snd_wss_port, "Windows Sound System port #.");
-MODULE_PARM_SYNTAX(snd_wss_port, SNDRV_PORT12_DESC);
+MODULE_PARM(snd_use_cs4232_midi, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+MODULE_PARM_DESC(snd_use_cs4232_midi, "Use CS4232 MPU-401 interface (inaccessibly located inside your computer)");
+MODULE_PARM_SYNTAX(snd_use_cs4232_midi, SNDRV_ENABLED ",allows use of CS4323 MPU-401 interface");
 
 static snd_card_t *snd_wavefront_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
 
@@ -130,10 +135,10 @@ snd_wavefront_isapnp (int dev, snd_wavefront_card_t *acard)
        struct isapnp_card *card = snd_wavefront_isapnp_cards[dev];
        struct isapnp_dev *pdev;
        int tmp;
-       
+
        /* Check for each logical device. */
 
-       /* "windows sound system" has id 0 */
+       /* CS4232 chip (aka "windows sound system") is logical device 0 */
 
        acard->wss = isapnp_find_dev(card, id->devs[0].vendor, id->devs[0].function, NULL);
        if (acard->wss->active) {
@@ -141,66 +146,67 @@ snd_wavefront_isapnp (int dev, snd_wavefront_card_t *acard)
                return -EBUSY;
        }
 
-       /* control interface has id 1 */
-
-       acard->ctrl = isapnp_find_dev(card, id->devs[1].vendor, id->devs[1].function, NULL);
-       if (acard->ctrl->active) {
-               acard->wss = acard->ctrl = NULL;
-               return -EBUSY;
-       }
-
-       /* synth has id 3 */
+       /* there is a game port at logical device 1, but we ignore it completely */
 
-       acard->synth = isapnp_find_dev(card, id->devs[3].vendor, id->devs[3].function, NULL);
-       if (acard->synth->active) {
-               acard->wss = acard->ctrl = acard->synth = NULL;
-               return -EBUSY;
-       }
+       /* the control interface is logical device 2, but we ignore it
+          completely. in fact, nobody even seems to know what it
+          does.
+       */
 
-       /* Only configure the CS4232 MIDI interface is its been
-          requested. It has id 2.
+       /* Only configure the CS4232 MIDI interface if its been
+          specifically requested. It is logical device 3.
        */
 
-       if (snd_cs4232_mpu_port[dev] != SNDRV_AUTO_PORT) {
+       if (snd_use_cs4232_midi[dev]) {
                acard->mpu = isapnp_find_dev(card, id->devs[2].vendor, id->devs[2].function, NULL);
                if (acard->mpu->active) {
-                       acard->wss = acard->ctrl = acard->synth = acard->mpu = NULL;
+                       acard->wss = acard->synth = acard->mpu = NULL;
                        return -EBUSY;
                }
        }
 
+       /* The ICS2115 synth is logical device 4 */
+
+       acard->synth = isapnp_find_dev(card, id->devs[3].vendor, id->devs[3].function, NULL);
+       if (acard->synth->active) {
+               acard->wss = acard->synth = NULL;
+               return -EBUSY;
+       }
+
        /* PCM/FM initialization */
 
        pdev = acard->wss;
 
        if ((tmp = pdev->prepare (pdev)) < 0) {
                if (tmp == -EBUSY) {
-                       snd_printk ("ISA PnP configuration appears to have been "
-                                   "done. Restart the isa-pnp module.\n");
+                       snd_printk ("ISA PnP configuration appears to have "
+                                   "been done. Restart the isapnp module.\n");
                        return 0;
                }
-                                   
                snd_printk ("isapnp WSS preparation failed\n");
                return -EAGAIN;
        }
 
+       /* An interesting note from the Tropez+ FAQ:
+
+          Q. [Ports] Why is the base address of the WSS I/O ports off by 4?
+
+          A. WSS I/O requires a block of 8 I/O addresses ("ports"). Of these, the first
+          4 are used to identify and configure the board. With the advent of PnP,
+          these first 4 addresses have become obsolete, and software applications
+          only use the last 4 addresses to control the codec chip. Therefore, the
+          base address setting "skips past" the 4 unused addresses.
+
+       */
+
        if (snd_cs4232_pcm_port[dev] != SNDRV_AUTO_PORT)
                isapnp_resource_change(&pdev->resource[0], snd_cs4232_pcm_port[dev], 4);
        if (snd_fm_port[dev] != SNDRV_AUTO_PORT)
                isapnp_resource_change(&pdev->resource[1], snd_fm_port[dev], 4);
-       if (snd_wss_port[dev] != SNDRV_AUTO_PORT)
-               isapnp_resource_change(&pdev->resource[2], snd_wss_port[dev], 4);
-
-       if (snd_ics2115_port[dev] != SNDRV_AUTO_PORT)
-               isapnp_resource_change(&pdev->resource[3], snd_ics2115_port[dev], 8);
-       if (snd_ics2115_irq[dev] != SNDRV_AUTO_IRQ)
-               isapnp_resource_change(&pdev->irq_resource[3], snd_ics2115_irq[dev], 1);
-
        if (snd_dma1[dev] != SNDRV_AUTO_DMA)
                isapnp_resource_change(&pdev->dma_resource[0], snd_dma1[dev], 1);
        if (snd_dma2[dev] != SNDRV_AUTO_DMA)
                isapnp_resource_change(&pdev->dma_resource[1], snd_dma2[dev], 1);
-
        if (snd_cs4232_pcm_irq[dev] != SNDRV_AUTO_IRQ)
                isapnp_resource_change(&pdev->irq_resource[0], snd_cs4232_pcm_irq[dev], 1);
 
@@ -211,93 +217,51 @@ snd_wavefront_isapnp (int dev, snd_wavefront_card_t *acard)
 
        snd_cs4232_pcm_port[dev] = pdev->resource[0].start;
        snd_fm_port[dev] = pdev->resource[1].start;
-       snd_wss_port[dev] = pdev->resource[2].start;
-
-       snd_ics2115_port[dev] = pdev->resource[3].start;
-       snd_ics2115_irq[dev] = pdev->irq_resource[3].start;
-
        snd_dma1[dev] = pdev->dma_resource[0].start;
-       snd_dma2[dev] = pdev->dma_resource[1].start == 4 ? -1 : pdev->dma_resource[1].start;
-
+       snd_dma2[dev] = pdev->dma_resource[1].start;
        snd_cs4232_pcm_irq[dev] = pdev->irq_resource[0].start;
 
-       snd_printk ("CS4232: port=0x%lx, fm port=0x%lx, wss port=0x%lx\n"
-                   "CS4232: dma1=%i, dma2=%i, irq=%i\n"
-                   "ICS2115: port=0x%lx, irq=%i\n", 
-                   snd_cs4232_pcm_port[dev], snd_fm_port[dev], snd_wss_port[dev],
-                   snd_dma1[dev], snd_dma2[dev], snd_cs4232_pcm_irq[dev],
-                   snd_ics2115_port[dev], 
-                   snd_ics2115_irq[dev]);
-       
-       /* CTRL initialization */
-
-       if (snd_control_port[dev] != SNDRV_AUTO_PORT) {
-
-               pdev = acard->ctrl;
+       /* Synth initialization */
 
-               if (pdev->prepare(pdev)<0) {
-                       acard->wss->deactivate(acard->wss);
-                       snd_printk ("isapnp CTRL preparation failed\n");
-                       return -EAGAIN;
-               }
-               
-               if (snd_control_port[dev] != SNDRV_AUTO_PORT)
-                       isapnp_resource_change(&pdev->resource[0], snd_control_port[dev], 8);
-               
-               if (pdev->activate(pdev)<0) {
-                       snd_printk("isapnp CTRL activation failed\n");
-                       acard->wss->deactivate(acard->wss);
-                       return -EBUSY;
+       pdev = acard->synth;
+       
+       if ((tmp = pdev->prepare(pdev))<0) {
+               if (tmp == -EBUSY) {
+                       snd_printk ("ISA PnP configuration appears to have "
+                                   "been done. Restart the isapnp module.\n");
                }
-               
-               snd_control_port[dev] = pdev->resource[0].start;
-               snd_printk ("isapnp CTRL: control port=0x%lx\n", 
-                           snd_control_port[dev]);
+               acard->wss->deactivate(acard->wss);
+               snd_printk ("ICS2115 synth preparation failed\n");
+               return -EAGAIN;
        }
-
-       /* Synth initialization */
-
        if (snd_ics2115_port[dev] != SNDRV_AUTO_PORT) {
-
-               pdev = acard->synth;
-
-               if (pdev->prepare(pdev)<0) {
-                       acard->wss->deactivate(acard->wss);
-                       if (acard->ctrl)
-                               acard->ctrl->deactivate(acard->ctrl);
-                       snd_printk ("ICS2115 synth preparation failed\n");
-                       return -EAGAIN;
-               }
+               isapnp_resource_change(&pdev->resource[0], snd_ics2115_port[dev], 16);
+       }
                
-               isapnp_resource_change(&pdev->resource[0], snd_ics2115_port[dev], 8);
-               if (snd_ics2115_irq[dev] != SNDRV_AUTO_IRQ) 
-                       isapnp_resource_change(&pdev->irq_resource[0], snd_ics2115_irq[dev], 1);
+       if (snd_ics2115_port[dev] != SNDRV_AUTO_IRQ) {
+               isapnp_resource_change(&pdev->irq_resource[0], snd_ics2115_irq[dev], 1);
+       }
 
-               if (pdev->activate(pdev)<0) {
-                       snd_printk("synth configuration failed\n");
-                       acard->wss->deactivate(acard->wss);
-                       if (acard->ctrl)
-                               acard->ctrl->deactivate(acard->ctrl);
-                       return -EBUSY;
-               }
-               
-               snd_ics2115_port[dev] = pdev->resource[0].start;
-               snd_ics2115_irq[dev] = pdev->irq_resource[0].start;
+       if (pdev->activate(pdev)<0) {
+               snd_printk("isapnp activation for ICS2115 failed\n");
+               acard->wss->deactivate(acard->wss);
+               return -EBUSY;
        }
 
+       snd_ics2115_port[dev] = pdev->resource[0].start;
+       snd_ics2115_irq[dev] = pdev->irq_resource[0].start;
+
        /* CS4232 MPU initialization. Configure this only if
           explicitly requested, since its physically inaccessible and
           consumes another IRQ.
        */
 
-       if (snd_cs4232_mpu_port[dev] != SNDRV_AUTO_PORT) {
+       if (snd_use_cs4232_midi[dev]) {
 
                pdev = acard->mpu;
 
                if (pdev->prepare(pdev)<0) {
                        acard->wss->deactivate(acard->wss);
-                       if (acard->ctrl)
-                               acard->ctrl->deactivate(acard->ctrl);
                        if (acard->synth)
                                acard->synth->deactivate(acard->synth);
                        snd_printk ("CS4232 MPU preparation failed\n");
@@ -322,6 +286,15 @@ snd_wavefront_isapnp (int dev, snd_wavefront_card_t *acard)
                            snd_cs4232_mpu_irq[dev]);
        }
 
+       snd_printdd ("CS4232: pcm port=0x%lx, fm port=0x%lx, dma1=%i, dma2=%i, irq=%i\nICS2115: port=0x%lx, irq=%i\n", 
+                   snd_cs4232_pcm_port[dev], 
+                   snd_fm_port[dev],
+                   snd_dma1[dev], 
+                   snd_dma2[dev], 
+                   snd_cs4232_pcm_irq[dev],
+                   snd_ics2115_port[dev], 
+                   snd_ics2115_irq[dev]);
+       
        return 0;
 }
 
@@ -472,7 +445,7 @@ snd_wavefront_free(snd_card_t *card)
 #endif
                if (acard->wavefront.res_base != NULL) {
                        release_resource(acard->wavefront.res_base);
-                       kfree(acard->wavefront.res_base);
+                       kfree_nocheck(acard->wavefront.res_base);
                }
                if (acard->wavefront.irq > 0)
                        free_irq(acard->wavefront.irq, (void *)acard);
@@ -529,8 +502,7 @@ snd_wavefront_probe (int dev)
 
 #ifdef __ISAPNP__
        if (snd_isapnp[dev] && snd_wavefront_isapnp (dev, acard) < 0) {
-               if (snd_cs4232_pcm_port[dev] == SNDRV_AUTO_PORT ||
-                   snd_control_port[dev] == SNDRV_AUTO_PORT) {
+               if (snd_cs4232_pcm_port[dev] == SNDRV_AUTO_PORT) {
                        snd_printk ("isapnp detection failed\n");
                        snd_card_free (card);
                        return -ENODEV;
@@ -542,7 +514,7 @@ snd_wavefront_probe (int dev)
 
        if ((err = snd_cs4231_create (card,
                                      snd_cs4232_pcm_port[dev],
-                                     snd_control_port[dev],
+                                     -1,
                                      snd_cs4232_pcm_irq[dev],
                                      snd_dma1[dev],
                                      snd_dma2[dev],
@@ -792,8 +764,9 @@ module_exit(alsa_card_wavefront_exit)
                            snd_cs4232_pcm_port,snd_cs4232_pcm_irq,
                            snd_cs4232_mpu_port,snd_cs4232_mpu_irq,
                            snd_ics2115_port,snd_ics2115_irq,
-                           snd_fm_port,snd_control_port,snd_wss_port,
-                           snd_dma1,snd_dma2 */
+                           snd_fm_port,
+                           snd_dma1,snd_dma2,
+                           snd_use_cs4232_midi */
 
 static int __init alsa_card_wavefront_setup(char *str)
 {
@@ -812,10 +785,9 @@ static int __init alsa_card_wavefront_setup(char *str)
               get_option(&str,(int *)&snd_ics2115_port[nr_dev]) == 2 &&
               get_option(&str,&snd_ics2115_irq[nr_dev]) == 2 &&
               get_option(&str,(int *)&snd_fm_port[nr_dev]) == 2 &&
-              get_option(&str,(int *)&snd_control_port[nr_dev]) == 2 &&
-              get_option(&str,(int *)&snd_wss_port[nr_dev]) == 2 &&
               get_option(&str,&snd_dma1[nr_dev]) == 2 &&
-              get_option(&str,&snd_dma2[nr_dev]) == 2);
+              get_option(&str,&snd_dma2[nr_dev]) == 2 &&
+              get_option(&str,&snd_use_cs4232_midi[nr_dev]) == 2);
        nr_dev++;
        return 1;
 }
index 849148f..12e1cac 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 1998-1999 by Paul Barton-Davis <pbd@op.net>
+ *  Copyright (c) 1998-2002 by Paul Davis <pbd@op.net>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
 #include <sound/driver.h>
 #include <asm/io.h>
 #include <linux/init.h>
+#include <linux/time.h>
+#include <linux/wait.h>
 #include <sound/core.h>
 #include <sound/snd_wavefront.h>
 #include <sound/yss225.h>
 #include <sound/initval.h>
 
 #if 0
-MODULE_AUTHOR("Paul Barton-Davis <pbd@op.net>");
+MODULE_AUTHOR("Paul Davis <pbd@op.net>");
 MODULE_DESCRIPTION("ALSA driver for Turtle Beach Tropez+ YSS225 FX Processor");
 MODULE_LICENSE("GPL");
 MODULE_CLASSES("{sound}");
@@ -711,7 +713,7 @@ snd_wavefront_fx_start (snd_wavefront_t *dev)
 
 /* wierd stuff, derived from port I/O tracing with dosemu */
 
-unsigned char page_zero[] = {
+static unsigned char page_zero[] __initdata = {
 0x01, 0x7c, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0x00,
 0x11, 0x00, 0x20, 0x00, 0x32, 0x00, 0x40, 0x00, 0x13, 0x00, 0x00,
 0x00, 0x14, 0x02, 0x76, 0x00, 0x60, 0x00, 0x80, 0x02, 0x00, 0x00,
@@ -738,7 +740,7 @@ unsigned char page_zero[] = {
 0x1d, 0x02, 0xdf
 };    
 
-unsigned char page_one[] = {
+static unsigned char page_one[] __initdata = {
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x19, 0x00,
 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xd8, 0x00, 0x00,
 0x02, 0x20, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x01,
@@ -765,7 +767,7 @@ unsigned char page_one[] = {
 0x60, 0x00, 0x1b
 };
 
-unsigned char page_two[] = {
+static unsigned char page_two[] __initdata = {
 0xc4, 0x00, 0x44, 0x07, 0x44, 0x00, 0x40, 0x25, 0x01, 0x06, 0xc4,
 0x07, 0x40, 0x25, 0x01, 0x00, 0x46, 0x46, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -780,7 +782,7 @@ unsigned char page_two[] = {
 0x46, 0x05, 0x46, 0x07, 0x46, 0x07, 0x44
 };
 
-unsigned char page_three[] = {
+static unsigned char page_three[] __initdata = {
 0x07, 0x40, 0x00, 0x00, 0x00, 0x47, 0x00, 0x40, 0x00, 0x40, 0x06,
 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -795,7 +797,7 @@ unsigned char page_three[] = {
 0x02, 0x00, 0x42, 0x00, 0xc0, 0x00, 0x40
 };
 
-unsigned char page_four[] = {
+static unsigned char page_four[] __initdata = {
 0x63, 0x03, 0x26, 0x02, 0x2c, 0x00, 0x24, 0x00, 0x2e, 0x02, 0x02,
 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -810,7 +812,7 @@ unsigned char page_four[] = {
 0x02, 0x62, 0x02, 0x20, 0x01, 0x21, 0x01
 };
 
-unsigned char page_six[] = {
+static unsigned char page_six[] __initdata = {
 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x06, 0x00,
 0x00, 0x08, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x0e,
 0x00, 0x00, 0x10, 0x00, 0x00, 0x12, 0x00, 0x00, 0x14, 0x00, 0x00,
@@ -831,7 +833,7 @@ unsigned char page_six[] = {
 0x80, 0x00, 0x7e, 0x80, 0x80
 };
 
-unsigned char page_seven[] = {
+static unsigned char page_seven[] __initdata = {
 0x0f, 0xff, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x02, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x0f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00,
 0x08, 0x00, 0x00, 0x00, 0x0f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x0f,
@@ -858,7 +860,7 @@ unsigned char page_seven[] = {
 0x00, 0x02, 0x00
 };
 
-unsigned char page_zero_v2[] = {
+static unsigned char page_zero_v2[] __initdata = {
 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -870,7 +872,7 @@ unsigned char page_zero_v2[] = {
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 };
 
-unsigned char page_one_v2[] = {
+static unsigned char page_one_v2[] __initdata = {
 0x01, 0xc0, 0x01, 0xfa, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -882,21 +884,21 @@ unsigned char page_one_v2[] = {
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 };
 
-unsigned char page_two_v2[] = {
+static unsigned char page_two_v2[] __initdata = {
 0x46, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00
 };
-unsigned char page_three_v2[] = {
+static unsigned char page_three_v2[] __initdata = {
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00
 };
-unsigned char page_four_v2[] = {
+static unsigned char page_four_v2[] __initdata = {
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -904,7 +906,7 @@ unsigned char page_four_v2[] = {
 0x00, 0x00, 0x00, 0x00
 };
 
-unsigned char page_seven_v2[] = {
+static unsigned char page_seven_v2[] __initdata = {
 0x0f, 0xff, 0x0f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -915,7 +917,8 @@ unsigned char page_seven_v2[] = {
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 };
-unsigned char mod_v2[] = {
+
+static unsigned char mod_v2[] __initdata = {
 0x01, 0x00, 0x02, 0x00, 0x01, 0x01, 0x02, 0x00, 0x01, 0x02, 0x02,
 0x00, 0x01, 0x03, 0x02, 0x00, 0x01, 0x04, 0x02, 0x00, 0x01, 0x05,
 0x02, 0x00, 0x01, 0x06, 0x02, 0x00, 0x01, 0x07, 0x02, 0x00, 0xb0,
@@ -945,7 +948,7 @@ unsigned char mod_v2[] = {
 0x02, 0x01, 0x01, 0x04, 0x02, 0x01, 0x01, 0x05, 0x02, 0x01, 0x01,
 0x06, 0x02, 0x01, 0x01, 0x07, 0x02, 0x01
 };
-unsigned char coefficients[] = {
+static unsigned char coefficients[] __initdata = {
 0x07, 0x46, 0x00, 0x00, 0x07, 0x49, 0x00, 0x00, 0x00, 0x4b, 0x03,
 0x11, 0x00, 0x4d, 0x01, 0x32, 0x07, 0x46, 0x00, 0x00, 0x07, 0x49,
 0x00, 0x00, 0x07, 0x40, 0x00, 0x00, 0x07, 0x41, 0x00, 0x00, 0x01,
@@ -981,14 +984,14 @@ unsigned char coefficients[] = {
 0x06, 0x6c, 0x4c, 0x6c, 0x06, 0x50, 0x52, 0xe2, 0x06, 0x42, 0x02,
 0xba
 };
-unsigned char coefficients2[] = {
+static unsigned char coefficients2[] __initdata = {
 0x07, 0x46, 0x00, 0x00, 0x07, 0x49, 0x00, 0x00, 0x07, 0x45, 0x0f,
 0xff, 0x07, 0x48, 0x0f, 0xff, 0x07, 0x7b, 0x04, 0xcc, 0x07, 0x7d,
 0x04, 0xcc, 0x07, 0x7c, 0x00, 0x00, 0x07, 0x7e, 0x00, 0x00, 0x07,
 0x46, 0x00, 0x00, 0x07, 0x49, 0x00, 0x00, 0x07, 0x47, 0x00, 0x00,
 0x07, 0x4a, 0x00, 0x00, 0x07, 0x4c, 0x00, 0x00, 0x07, 0x4e, 0x00, 0x00
 };
-unsigned char coefficients3[] = { 
+static unsigned char coefficients3[] __initdata = { 
 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x28, 0x00, 0x51, 0x00,
 0x51, 0x00, 0x7a, 0x00, 0x7a, 0x00, 0xa3, 0x00, 0xa3, 0x00, 0xcc,
 0x00, 0xcc, 0x00, 0xf5, 0x00, 0xf5, 0x01, 0x1e, 0x01, 0x1e, 0x01,
index eb555c3..b54c717 100644 (file)
@@ -51,6 +51,8 @@
 #include <sound/driver.h>
 #include <asm/io.h>
 #include <linux/init.h>
+#include <linux/time.h>
+#include <linux/wait.h>
 #include <sound/core.h>
 #include <sound/snd_wavefront.h>
 
index bc5b9b9..b356878 100644 (file)
@@ -25,6 +25,9 @@
 #include <asm/io.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/time.h>
+#include <linux/wait.h>
 #include <sound/core.h>
 #include <sound/snd_wavefront.h>
 #include <sound/initval.h>
@@ -905,7 +908,7 @@ wavefront_freemem (snd_wavefront_t *dev)
 static int
 wavefront_send_sample (snd_wavefront_t *dev, 
                       wavefront_patch_info *header,
-                      UINT16 *dataptr,
+                      u16 *dataptr,
                       int data_is_unsigned)
 
 {
@@ -918,9 +921,9 @@ wavefront_send_sample (snd_wavefront_t *dev,
           divided by 2.
         */
 
-       UINT16 sample_short;
-       UINT32 length;
-       UINT16 *data_end = 0;
+       u16 sample_short;
+       u32 length;
+       u16 *data_end = 0;
        unsigned int i;
        const int max_blksize = 4096/2;
        unsigned int written;
@@ -1070,13 +1073,13 @@ wavefront_send_sample (snd_wavefront_t *dev,
           but the offset only uses 24 bits.
        */
 
-       shptr = munge_int32 (*((UINT32 *) &header->hdr.s.sampleStartOffset),
+       shptr = munge_int32 (*((u32 *) &header->hdr.s.sampleStartOffset),
                             shptr, 4);
-       shptr = munge_int32 (*((UINT32 *) &header->hdr.s.loopStartOffset),
+       shptr = munge_int32 (*((u32 *) &header->hdr.s.loopStartOffset),
                             shptr, 4);
-       shptr = munge_int32 (*((UINT32 *) &header->hdr.s.loopEndOffset),
+       shptr = munge_int32 (*((u32 *) &header->hdr.s.loopEndOffset),
                             shptr, 4);
-       shptr = munge_int32 (*((UINT32 *) &header->hdr.s.sampleEndOffset),
+       shptr = munge_int32 (*((u32 *) &header->hdr.s.sampleEndOffset),
                             shptr, 4);
        
        /* This one is truly wierd. What kind of wierdo decided that in
@@ -1482,11 +1485,11 @@ WaveFront: hardware-dependent interface
 ***********************************************************************/
 
 static void
-process_sample_hdr (UCHAR8 *buf)
+process_sample_hdr (u8 *buf)
 
 {
        wavefront_sample s;
-       UCHAR8 *ptr;
+       u8 *ptr;
 
        ptr = buf;
 
@@ -1497,11 +1500,11 @@ process_sample_hdr (UCHAR8 *buf)
           something very similar in the reverse direction.
        */
 
-       *((UINT32 *) &s.sampleStartOffset) = demunge_int32 (ptr, 4); ptr += 4;
-       *((UINT32 *) &s.loopStartOffset) = demunge_int32 (ptr, 4); ptr += 4;
-       *((UINT32 *) &s.loopEndOffset) = demunge_int32 (ptr, 4); ptr += 4;
-       *((UINT32 *) &s.sampleEndOffset) = demunge_int32 (ptr, 4); ptr += 4;
-       *((UINT32 *) &s.FrequencyBias) = demunge_int32 (ptr, 3); ptr += 3;
+       *((u32 *) &s.sampleStartOffset) = demunge_int32 (ptr, 4); ptr += 4;
+       *((u32 *) &s.loopStartOffset) = demunge_int32 (ptr, 4); ptr += 4;
+       *((u32 *) &s.loopEndOffset) = demunge_int32 (ptr, 4); ptr += 4;
+       *((u32 *) &s.sampleEndOffset) = demunge_int32 (ptr, 4); ptr += 4;
+       *((u32 *) &s.FrequencyBias) = demunge_int32 (ptr, 3); ptr += 3;
 
        s.SampleResolution = *ptr & 0x3;
        s.Loop = *ptr & 0x8;
@@ -1568,7 +1571,7 @@ wavefront_synth_control (snd_wavefront_card_t *acard,
                return 0;
 
        case WFC_UPLOAD_PATCH:
-               munge_int32 (*((UINT32 *) wc->wbuf), patchnumbuf, 2);
+               munge_int32 (*((u32 *) wc->wbuf), patchnumbuf, 2);
                memcpy (wc->wbuf, patchnumbuf, 2);
                break;
 
@@ -1800,65 +1803,6 @@ wavefront_should_cause_interrupt (snd_wavefront_t *dev,
        restore_flags (flags);
 }
 
-int
-snd_wavefront_detect_irq (snd_wavefront_t *dev) 
-
-{
-       int i;
-       int possible_irqs[] = { 5, 9, 12, 15, -1 };
-
-       /* Note: according to the PnP dump, 7 and 11 are possible too, but the
-          WaveFront SDK doesn't tell us how to set the card to use them.  
-       */
-
-       snd_printk ("autodetecting WaveFront IRQ\n");
-
-       for (i = 0; possible_irqs[i] > 0; i++) {
-               if (snd_wavefront_check_irq (dev, possible_irqs[i]) == 0) {
-                       snd_printk ("autodetected IRQ %d\n", 
-                                   possible_irqs[i]);
-                       return possible_irqs[i];
-               }
-       }
-
-       return -1;
-}
-
-int
-snd_wavefront_check_irq (snd_wavefront_t *dev, int irq)
-
-{
-       int bits;
-       unsigned long irq_mask;
-       short reported_irq;
-
-       bits = snd_wavefront_interrupt_bits (irq);
-
-       irq_mask = probe_irq_on ();
-
-       outb (0x0, dev->control_port); 
-       outb (0x80 | 0x40 | bits, dev->data_port);      
-       wavefront_should_cause_interrupt(dev, 0x80|0x40|0x10|0x1,
-                                        dev->control_port,
-                                        (reset_time*HZ)/100);
-
-       reported_irq = probe_irq_off (irq_mask);
-
-       if (reported_irq == 0) {
-               snd_printk ("No unassigned interrupts detected "
-                           "after h/w reset\n");
-               return -1;
-       } else if (reported_irq < 0) {
-               snd_printk ("Multiple unassigned interrupts detected "
-                           "after h/w reset\n");
-               return -1;
-       } else if (reported_irq != irq) {
-               return -1;
-       }
-
-       return 0; /* OK */
-}
-
 static int
 wavefront_reset_to_cleanliness (snd_wavefront_t *dev)
 
@@ -2306,8 +2250,6 @@ EXPORT_SYMBOL(snd_wavefront_synth_open);
 EXPORT_SYMBOL(snd_wavefront_synth_release);
 EXPORT_SYMBOL(snd_wavefront_internal_interrupt);
 EXPORT_SYMBOL(snd_wavefront_interrupt_bits);
-EXPORT_SYMBOL(snd_wavefront_detect_irq);
-EXPORT_SYMBOL(snd_wavefront_check_irq);
 EXPORT_SYMBOL(snd_wavefront_start);
 EXPORT_SYMBOL(snd_wavefront_detect);
 EXPORT_SYMBOL(snd_wavefront_cmd);
index 495de7e..ec5416a 100644 (file)
@@ -23,8 +23,6 @@
 #include <sound/driver.h>
 #include <sound/core.h>
 
-#ifndef MODULE
-
 static int __init alsa_sound_last_init(void)
 {
        int idx, ok = 0;
@@ -40,6 +38,4 @@ static int __init alsa_sound_last_init(void)
        return 0;
 }
 
-module_init(alsa_sound_last_init)
-
-#endif /* MODULE */
+__initcall(alsa_sound_last_init);
index f7718db..4621e02 100644 (file)
@@ -1,7 +1,13 @@
 # ALSA PCI drivers
 
+mainmenu_option next_comment
+comment 'PCI devices'
+
 dep_tristate 'ALi PCI Audio M5451' CONFIG_SND_ALI5451 $CONFIG_SND
 dep_tristate 'Cirrus Logic (Sound Fusion) CS4280/CS461x/CS462x/CS463x' CONFIG_SND_CS46XX $CONFIG_SND
+if [ "$CONFIG_SND_CS46XX" != "n" ]; then
+  bool       '  Cirrus Logic (Sound Fusion) MMAP support for OSS' CONFIG_SND_CS46XX_ACCEPT_VALID
+fi
 dep_tristate 'EMU10K1 (SB Live!, E-mu APS)' CONFIG_SND_EMU10K1 $CONFIG_SND
 dep_tristate 'Korg 1212 IO' CONFIG_SND_KORG1212 $CONFIG_SND
 dep_tristate 'NeoMagic NM256AV/ZX' CONFIG_SND_NM256 $CONFIG_SND
@@ -22,3 +28,5 @@ dep_tristate 'Intel i810/i820/i830/i840/MX440 integrated audio' CONFIG_SND_INTEL
 dep_tristate 'S3 SonicVibes' CONFIG_SND_SONICVIBES $CONFIG_SND
 dep_tristate 'VIA 82C686A/B South Bridge' CONFIG_SND_VIA686 $CONFIG_SND
 dep_tristate 'VIA 8233 South Bridge' CONFIG_SND_VIA8233 $CONFIG_SND
+
+endmenu
index 6847742..313fd35 100644 (file)
@@ -21,7 +21,7 @@ obj-$(CONFIG_SND_FM801) += snd-ac97-codec.o
 obj-$(CONFIG_SND_ICE1712) += snd-ac97-codec.o
 obj-$(CONFIG_SND_INTEL8X0) += snd-ac97-codec.o
 obj-$(CONFIG_SND_MAESTRO3) += snd-ac97-codec.o
-obj-$(CONFIG_SND_VIA686A) += snd-ac97-codec.o
+obj-$(CONFIG_SND_VIA686) += snd-ac97-codec.o
 obj-$(CONFIG_SND_VIA8233) += snd-ac97-codec.o
 obj-$(CONFIG_SND_ALI5451) += snd-ac97-codec.o
 obj-$(CONFIG_SND_CS46XX) += snd-ac97-codec.o
index e5fecef..b8a2bf1 100644 (file)
@@ -25,6 +25,7 @@
 #include <sound/driver.h>
 #include <linux/delay.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/ac97_codec.h>
index be13f11..fb38790 100644 (file)
@@ -22,6 +22,7 @@
 #include <sound/driver.h>
 #include <linux/delay.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/ak4531_codec.h>
 
index 3ed7eec..200e61a 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/info.h>
@@ -1972,7 +1973,7 @@ static int snd_ali_free(ali_t * codec)
                free_irq(codec->irq, (void *)codec);
        if (codec->res_port) {
                release_resource(codec->res_port);
-               kfree(codec->res_port);
+               kfree_nocheck(codec->res_port);
        }
 #ifdef CONFIG_PM
        if (codec->image)
index 832247a..8732200 100644 (file)
@@ -47,6 +47,7 @@
 #include <sound/driver.h>
 #include <asm/io.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/rawmidi.h>
@@ -602,7 +603,7 @@ static int __devinit snd_card_als4k_probe(struct pci_dev *pci,
                            sizeof( snd_card_als4000_t ) );
        if (card == NULL) {
                release_resource(res_gcr_port);
-               kfree(res_gcr_port);
+               kfree_nocheck(res_gcr_port);
                return -ENOMEM;
        }
 
@@ -619,7 +620,7 @@ static int __devinit snd_card_als4k_probe(struct pci_dev *pci,
                                    SB_HW_ALS4000,
                                    &chip)) < 0) {
                release_resource(res_gcr_port);
-               kfree(res_gcr_port);
+               kfree_nocheck(res_gcr_port);
                snd_card_free(card);
                return err;
        }
index 5700eac..f60ca9a 100644 (file)
@@ -21,6 +21,7 @@
 #include <asm/io.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/info.h>
 #include <sound/control.h>
@@ -61,10 +62,10 @@ MODULE_PARM_DESC(snd_enable, "Enable C-Media PCI soundcard.");
 MODULE_PARM_SYNTAX(snd_enable, SNDRV_ENABLE_DESC);
 MODULE_PARM(snd_mpu_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
 MODULE_PARM_DESC(snd_mpu_port, "MPU-401 port.");
-MODULE_PARM_SYNTAX(snd_mpu_port, "allows:{{-1},{0x330},{0x320},{0x310},{0x300}},dialog:list");
+MODULE_PARM_SYNTAX(snd_mpu_port, SNDRV_ENABLED ",allows:{{-1},{0x330},{0x320},{0x310},{0x300}},dialog:list");
 MODULE_PARM(snd_fm_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
 MODULE_PARM_DESC(snd_fm_port, "FM port.");
-MODULE_PARM_SYNTAX(snd_fm_port, "allows:{{-1},{0x388},{0x3c8},{0x3e0},{0x3e8}},dialog:list");
+MODULE_PARM_SYNTAX(snd_fm_port, SNDRV_ENABLED ",allows:{{-1},{0x388},{0x3c8},{0x3e0},{0x3e8}},dialog:list");
 
 #ifndef PCI_DEVICE_ID_CMEDIA_CM8738
 #define PCI_DEVICE_ID_CMEDIA_CM8738    0x0111
@@ -2448,7 +2449,7 @@ static int snd_cmipci_free(cmipci_t *cm)
        }
        if (cm->res_iobase) {
                release_resource(cm->res_iobase);
-               kfree(cm->res_iobase);
+               kfree_nocheck(cm->res_iobase);
        }
        snd_magic_kfree(cm);
        return 0;
@@ -2678,7 +2679,7 @@ static int __devinit snd_cmipci_probe(struct pci_dev *pci,
                cm->iobase,
                cm->irq);
 
-       snd_printd("%s is detected\n", card->longname);
+       //snd_printd("%s is detected\n", card->longname);
 
        if ((err = snd_card_register(card)) < 0) {
                snd_card_free(card);
index ea0f6d5..5d0e561 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/pcm.h>
@@ -1220,11 +1221,11 @@ static int snd_cs4281_free(cs4281_t *chip)
                iounmap((void *) chip->ba1);
        if (chip->ba0_res) {
                release_resource(chip->ba0_res);
-               kfree(chip->ba0_res);
+               kfree_nocheck(chip->ba0_res);
        }
        if (chip->ba1_res) {
                release_resource(chip->ba1_res);
-               kfree(chip->ba1_res);
+               kfree_nocheck(chip->ba1_res);
        }
        if (chip->irq >= 0)
                free_irq(chip->irq, (void *)chip);
index 4698df1..14d4981 100644 (file)
@@ -26,6 +26,7 @@
 */
 
 #include <sound/driver.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/cs46xx.h>
 #define SNDRV_GET_ID
@@ -62,10 +63,10 @@ MODULE_PARM_DESC(snd_enable, "Enable CS46xx soundcard.");
 MODULE_PARM_SYNTAX(snd_enable, SNDRV_ENABLE_DESC);
 MODULE_PARM(snd_external_amp, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
 MODULE_PARM_DESC(snd_external_amp, "Force to enable external amplifer.");
-MODULE_PARM_SYNTAX(snd_external_amp, SNDRV_BOOLEAN_FALSE_DESC);
+MODULE_PARM_SYNTAX(snd_external_amp, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
 MODULE_PARM(snd_thinkpad, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
 MODULE_PARM_DESC(snd_thinkpad, "Force to enable Thinkpad's CLKRUN control.");
-MODULE_PARM_SYNTAX(snd_thinkpad, SNDRV_BOOLEAN_FALSE_DESC);
+MODULE_PARM_SYNTAX(snd_thinkpad, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
 
 static struct pci_device_id snd_cs46xx_ids[] __devinitdata = {
         { 0x1013, 0x6001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, },   /* CS4280 */
@@ -134,25 +135,25 @@ static int __devinit snd_card_cs46xx_probe(struct pci_dev *pci,
 static int snd_card_cs46xx_suspend(struct pci_dev *pci, u32 state)
 {
        cs46xx_t *chip = snd_magic_cast(cs46xx_t, pci_get_drvdata(pci), return -ENXIO);
-       snd_cs46xx_suspend(chip, 0);
+       snd_cs46xx_suspend(chip);
        return 0;
 }
 static int snd_card_cs46xx_resume(struct pci_dev *pci)
 {
        cs46xx_t *chip = snd_magic_cast(cs46xx_t, pci_get_drvdata(pci), return -ENXIO);
-       snd_cs46xx_resume(chip, 0);
+       snd_cs46xx_resume(chip);
        return 0;
 }
 #else
 static void snd_card_cs46xx_suspend(struct pci_dev *pci)
 {
        cs46xx_t *chip = snd_magic_cast(cs46xx_t, pci_get_drvdata(pci), return);
-       snd_cs46xx_suspend(chip, 0);
+       snd_cs46xx_suspend(chip);
 }
 static void snd_card_cs46xx_resume(struct pci_dev *pci)
 {
        cs46xx_t *chip = snd_magic_cast(cs46xx_t, pci_get_drvdata(pci), return);
-       snd_cs46xx_resume(chip, 0);
+       snd_cs46xx_resume(chip);
 }
 #endif
 #endif
index b16b2e7..083a2b7 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/delay.h>
 #include <linux/pm.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/info.h>
@@ -48,7 +49,7 @@
  */
 
 #if 0
-#define ACCEPT_VALID           /* REQUIRED ONLY FOR OSS EMULATION */
+#define SND_CONFIG_CS46XX_ACCEPT_VALID         /* REQUIRED ONLY FOR OSS EMULATION */
 #endif
 
 #define CS46XX_BA0_SIZE                0x1000
@@ -1048,7 +1049,7 @@ static void snd_cs46xx_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 static snd_pcm_hardware_t snd_cs46xx_playback =
 {
        info:                   (SNDRV_PCM_INFO_MMAP |
-#ifdef ACCEPT_VALID
+#ifdef SND_CONFIG_CS46XX_ACCEPT_VALID
                                /* NOT TRUE!!! OSS REQUIRES IT */
                                 SNDRV_PCM_INFO_MMAP_VALID | 
 #endif
@@ -1074,7 +1075,7 @@ static snd_pcm_hardware_t snd_cs46xx_playback =
 static snd_pcm_hardware_t snd_cs46xx_capture =
 {
        info:                   (SNDRV_PCM_INFO_MMAP |
-#ifdef ACCEPT_VALID
+#ifdef SND_CONFIG_CS46XX_ACCEPT_VALID
                                 /* NOT TRUE!!! OSS REQUIRES IT */
                                 SNDRV_PCM_INFO_MMAP_VALID |
 #endif
@@ -1652,7 +1653,7 @@ static int snd_cs46xx_free(cs46xx_t *chip)
                        iounmap((void *) region->remap_addr);
                if (region->resource) {
                        release_resource(region->resource);
-                       kfree(region->resource);
+                       kfree_nocheck(region->resource);
                }
        }
        if (chip->irq >= 0)
@@ -2079,11 +2080,11 @@ static struct cs_card_type __initdata cards[] = {
  * APM support
  */
 #ifdef CONFIG_PM
-void snd_cs46xx_suspend(cs46xx_t *chip, int can_schedule)
+void snd_cs46xx_suspend(cs46xx_t *chip)
 {
        snd_card_t *card = chip->card;
 
-       snd_power_lock(card, can_schedule);
+       snd_power_lock(card);
        if (card->power_state == SNDRV_CTL_POWER_D3hot)
                goto __skip;
        snd_pcm_suspend_all(chip->pcm);
@@ -2095,12 +2096,12 @@ void snd_cs46xx_suspend(cs46xx_t *chip, int can_schedule)
        snd_power_unlock(card);
 }
 
-void snd_cs46xx_resume(cs46xx_t *chip, int can_schedule)
+void snd_cs46xx_resume(cs46xx_t *chip)
 {
        snd_card_t *card = chip->card;
        int amp_saved;
 
-       snd_power_lock(card, can_schedule);
+       snd_power_lock(card);
        if (card->power_state == SNDRV_CTL_POWER_D0)
                goto __skip;
 
@@ -2143,11 +2144,11 @@ static int snd_cs46xx_set_power_state(snd_card_t *card, unsigned int power_state
        case SNDRV_CTL_POWER_D0:
        case SNDRV_CTL_POWER_D1:
        case SNDRV_CTL_POWER_D2:
-               snd_cs46xx_resume(chip, 1);
+               snd_cs46xx_resume(chip);
                break;
        case SNDRV_CTL_POWER_D3hot:
        case SNDRV_CTL_POWER_D3cold:
-               snd_cs46xx_suspend(chip, 1);
+               snd_cs46xx_suspend(chip);
                break;
        default:
                return -EINVAL;
index 594cb19..e7e501d 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/emu10k1.h>
 #define SNDRV_GET_ID
index e96d6e9..427fa44 100644 (file)
@@ -24,7 +24,7 @@
 
 /* voice status */
 enum {
-       V_OFF=0, V_RELEASED, V_PLAYING, V_END
+       V_FREE=0, V_OFF, V_RELEASED, V_PLAYING, V_END
 };
 
 /* Keeps track of what we are finding */
@@ -235,8 +235,9 @@ lookup_voices(snd_emux_t *emu, emu10k1_t *hw, best_voice_t *best, int active_onl
                        if (vp->ch < 0) {
                                if (active_only)
                                        continue;
-                       }
-                       bp = best + V_OFF;
+                               bp = best + V_FREE;
+                       } else
+                               bp = best + V_OFF;
                }
                else if (state == SNDRV_EMUX_ST_RELEASED ||
                         state == SNDRV_EMUX_ST_PENDING) {
@@ -255,7 +256,7 @@ lookup_voices(snd_emux_t *emu, emu10k1_t *hw, best_voice_t *best, int active_onl
                        continue;
 
                /* check if sample is finished playing (non-looping only) */
-               if (bp != best + V_OFF &&
+               if (bp != best + V_OFF && bp != best + V_FREE &&
                    (vp->reg.sample_mode & SNDRV_SFNT_SAMPLE_SINGLESHOT)) {
                        val = snd_emu10k1_ptr_read(hw, CCCA_CURRADDR, vp->ch);
                        if (val >= vp->reg.loopstart)
index 34eb468..241361a 100644 (file)
@@ -29,6 +29,8 @@
 #include <sound/driver.h>
 #include <linux/delay.h>
 #include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/vmalloc.h>
 #include <sound/core.h>
 #include <sound/emu10k1.h>
 
@@ -503,7 +505,7 @@ static int snd_emu10k1_free(emu10k1_t *emu)
                vfree(emu->page_addr_table);
        if (emu->res_port) {
                release_resource(emu->res_port);
-               kfree(emu->res_port);
+               kfree_nocheck(emu->res_port);
        }
        if (emu->irq >= 0)
                free_irq(emu->irq, (void *)emu);
index 22f1932..96711ff 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 #include <sound/driver.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/emu10k1_synth.h>
 
index 98630bd..96c3a83 100644 (file)
@@ -28,6 +28,7 @@
 #define __NO_VERSION__
 #include <sound/driver.h>
 #include <linux/delay.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/emu10k1.h>
 
index 282d1a2..9ff7078 100644 (file)
@@ -28,6 +28,7 @@
 
 #define __NO_VERSION__
 #include <sound/driver.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/emu10k1.h>
 
index 497e0c8..70646f7 100644 (file)
@@ -21,6 +21,7 @@
 
 #define __NO_VERSION__
 #include <sound/driver.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/emu10k1.h>
 
index 899d4a2..44037bb 100644 (file)
@@ -27,6 +27,8 @@
 
 #define __NO_VERSION__
 #include <sound/driver.h>
+#include <linux/slab.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/emu10k1.h>
 
index ee6e9a8..d128b33 100644 (file)
@@ -27,6 +27,7 @@
 
 #define __NO_VERSION__
 #include <sound/driver.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/emu10k1.h>
 
index 1c2725b..50dd734 100644 (file)
@@ -27,6 +27,7 @@
 
 #define __NO_VERSION__
 #include <sound/driver.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/emu10k1.h>
 
index 8f25c67..a258082 100644 (file)
@@ -27,6 +27,7 @@
 
 #define __NO_VERSION__
 #include <sound/driver.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/emu10k1.h>
 
index f1f402a..b5d8834 100644 (file)
@@ -23,6 +23,7 @@
 
 #define __NO_VERSION__
 #include <sound/driver.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/emu10k1.h>
 
index 1138978..0bf503d 100644 (file)
@@ -27,6 +27,7 @@
 
 #define __NO_VERSION__
 #include <sound/driver.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/emu10k1.h>
 
index cad266f..9d6df8b 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/pcm.h>
@@ -1411,8 +1412,8 @@ static int snd_es1371_joystick_addr_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_
         uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
         uinfo->count = 1;
         uinfo->value.enumerated.items = 3;
-       if (uinfo->value.enumerated.item > 3)
-               uinfo->value.enumerated.item = 3;
+       if (uinfo->value.enumerated.item >= 3)
+               uinfo->value.enumerated.item = 2;
        sprintf(uinfo->value.enumerated.name, "port 0x%x", (uinfo->value.enumerated.item * 8) + 0x200);
         return 0;
 }
@@ -1524,7 +1525,7 @@ static int snd_ensoniq_free(ensoniq_t *ensoniq)
 #endif
        if (ensoniq->res_port) {
                release_resource(ensoniq->res_port);
-               kfree(ensoniq->res_port);
+               kfree_nocheck(ensoniq->res_port);
        }
        if (ensoniq->irq >= 0)
                free_irq(ensoniq->irq, (void *)ensoniq);
index f22e4a3..e8a254a 100644 (file)
@@ -50,6 +50,7 @@
 #include <sound/driver.h>
 #include <asm/io.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/pcm.h>
@@ -1330,23 +1331,23 @@ static int snd_es1938_free(es1938_t *chip)
 #endif
        if (chip->res_io_port) {
                release_resource(chip->res_io_port);
-               kfree(chip->res_io_port);
+               kfree_nocheck(chip->res_io_port);
        }
        if (chip->res_sb_port) {
                release_resource(chip->res_sb_port);
-               kfree(chip->res_sb_port);
+               kfree_nocheck(chip->res_sb_port);
        }
        if (chip->res_vc_port) {
                release_resource(chip->res_vc_port);
-               kfree(chip->res_vc_port);
+               kfree_nocheck(chip->res_vc_port);
        }
        if (chip->res_mpu_port) {
                release_resource(chip->res_mpu_port);
-               kfree(chip->res_mpu_port);
+               kfree_nocheck(chip->res_mpu_port);
        }
        if (chip->res_game_port) {
                release_resource(chip->res_game_port);
-               kfree(chip->res_game_port);
+               kfree_nocheck(chip->res_game_port);
        }
        if (chip->irq >= 0)
                free_irq(chip->irq, (void *)chip);
index d172e95..aa0bdc5 100644 (file)
@@ -99,8 +99,8 @@
 #include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
-#include <linux/reboot.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/mpu401.h>
@@ -126,7 +126,6 @@ static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;      /* Index 1-MAX */
 static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;  /* ID for this card */
 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
 static int snd_total_bufsize[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1024 };
-static int snd_midi_enable[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0 };
 static int snd_pcm_substreams_p[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 4 };
 static int snd_pcm_substreams_c[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1 };
 static int snd_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
@@ -143,9 +142,6 @@ MODULE_PARM_SYNTAX(snd_enable, SNDRV_ENABLE_DESC);
 MODULE_PARM(snd_total_bufsize, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
 MODULE_PARM_DESC(snd_total_bufsize, "Total buffer size in kB.");
 MODULE_PARM_SYNTAX(snd_total_bufsize, SNDRV_ENABLED ",allows:{{1,4096}},skill:advanced");
-MODULE_PARM(snd_midi_enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
-MODULE_PARM_DESC(snd_midi_enable, "Midi enabled for " CARD_NAME " soundcard.");
-MODULE_PARM_SYNTAX(snd_midi_enable, SNDRV_ENABLED "," SNDRV_ENABLE_DESC);
 MODULE_PARM(snd_pcm_substreams_p, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
 MODULE_PARM_DESC(snd_pcm_substreams_p, "PCM Playback substreams for " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(snd_pcm_substreams_p, SNDRV_ENABLED ",allows:{{1,8}}");
@@ -543,8 +539,6 @@ struct snd_esschan {
 
 struct snd_es1968 {
        /* Module Config */
-       int midi_enabled;                       /* bool */
-
        int total_bufsize;                      /* in bytes */
 
        int playback_streams, capture_streams;
@@ -735,12 +729,12 @@ static void apu_data_set(es1968_t *chip, u16 data)
 static void __apu_set_register(es1968_t *chip, u16 channel, u8 reg, u16 data)
 {
        snd_assert(channel < NR_APUS, return);
-       reg |= (channel << 4);
-       apu_index_set(chip, reg);
-       apu_data_set(chip, data);
 #ifdef CONFIG_PM
        chip->apu_map[channel][reg] = data;
 #endif
+       reg |= (channel << 4);
+       apu_index_set(chip, reg);
+       apu_data_set(chip, data);
 }
 
 inline static void apu_set_register(es1968_t *chip, u16 channel, u8 reg, u16 data)
@@ -1034,14 +1028,16 @@ static void snd_es1968_pcm_stop(es1968_t *chip, esschan_t *es)
 
 /* set the wavecache control reg */
 static void snd_es1968_program_wavecache(es1968_t *chip, esschan_t *es,
-                                        int channel, u32 addr)
+                                        int channel, u32 addr, int capture)
 {
        u32 tmpval = (addr - 0x10) & 0xFFF8;
 
-       if (!(es->fmt & ESS_FMT_16BIT))
-               tmpval |= 4;    /* 8bit */
-       if (es->fmt & ESS_FMT_STEREO)
-               tmpval |= 2;    /* stereo */
+       if (! capture) {
+               if (!(es->fmt & ESS_FMT_16BIT))
+                       tmpval |= 4;    /* 8bit */
+               if (es->fmt & ESS_FMT_STEREO)
+                       tmpval |= 2;    /* stereo */
+       }
 
        /* set the wavecache control reg */
        wave_set_register(chip, es->apu[channel] << 3, tmpval);
@@ -1070,7 +1066,7 @@ static void snd_es1968_playback_setup(es1968_t *chip, esschan_t *es,
        for (channel = 0; channel <= high_apu; channel++) {
                apu = es->apu[channel];
 
-               snd_es1968_program_wavecache(chip, es, channel, es->memory->addr);
+               snd_es1968_program_wavecache(chip, es, channel, es->memory->addr, 0);
 
                /* Offset to PCMBAR */
                pa = es->memory->addr;
@@ -1217,7 +1213,7 @@ static void snd_es1968_capture_setup(es1968_t *chip, esschan_t *es,
                }
 
                /* set the wavecache control reg */
-               snd_es1968_program_wavecache(chip, es, channel, pa);
+               snd_es1968_program_wavecache(chip, es, channel, pa, 1);
 
                /* Offset to PCMBAR */
                pa -= chip->dma_buf_addr;
@@ -1243,10 +1239,9 @@ static void snd_es1968_capture_setup(es1968_t *chip, esschan_t *es,
                apu_set_register(chip, apu, 5, pa & 0xFFFF);
                apu_set_register(chip, apu, 6, (pa + bsize) & 0xFFFF);
                apu_set_register(chip, apu, 7, bsize);
-#if 1
+#if 0
                if (es->fmt & ESS_FMT_STEREO) /* ??? really ??? */
-                       apu_set_register(chip, es->apu[channel], 7,
-                                        bsize - 1);
+                       apu_set_register(chip, apu, 7, bsize - 1);
 #endif
 
                /* clear effects/env.. */
@@ -1429,7 +1424,7 @@ static int calc_available_memory_size(es1968_t *chip)
        }
        up(&chip->memory_mutex);
        if (max_size >= 128*1024)
-               max_size = 128*1024 - 2;
+               max_size = 127*1024;
        return max_size;
 }
 
@@ -1512,7 +1507,7 @@ snd_es1968_init_dmabuf(es1968_t *chip)
        esm_memory_t *chunk;
        chip->dma_buf = snd_malloc_pci_pages_fallback(chip->pci, chip->total_bufsize,
                                                      &chip->dma_buf_addr, &chip->dma_buf_size);
-       //snd_printd("es1968: allocated buffer size %ld\n", chip->dma_buf_size);
+       //snd_printd("es1968: allocated buffer size %ld at %p\n", chip->dma_buf_size, chip->dma_buf);
        if (chip->dma_buf == NULL) {
                snd_printk("es1968: can't allocate dma pages for size %d\n",
                           chip->total_bufsize);
@@ -1836,8 +1831,16 @@ static void __devinit es1968_measure_clock(es1968_t *chip)
        snd_es1968_trigger_apu(chip, apu, 0x10); /* 16bit mono */
        do_gettimeofday(&start_time);
        spin_unlock_irqrestore(&chip->reg_lock, flags);
+#if 0
        set_current_state(TASK_UNINTERRUPTIBLE);
        schedule_timeout(HZ / 20); /* 50 msec */
+#else
+       /* FIXME:
+        * schedule() above may be too inaccurate and the pointer can
+        * overlap the boundary..
+        */
+       mdelay(50);
+#endif
        spin_lock_irqsave(&chip->reg_lock, flags);
        offset = __apu_get_register(chip, apu, 5);
        do_gettimeofday(&stop_time);
@@ -1859,9 +1862,11 @@ static void __devinit es1968_measure_clock(es1968_t *chip)
        } else {
                offset *= 1000;
                offset = (offset / t) * 1000 + ((offset % t) * 1000) / t;
-               if (offset < 47500 || offset > 48500)
-                       chip->clock = (chip->clock * offset) / 48000;
-               snd_printd("setting clock to %d\n", chip->clock);
+               if (offset < 47500 || offset > 48500) {
+                       if (offset >= 40000 && offset <= 50000)
+                               chip->clock = (chip->clock * offset) / 48000;
+               }
+               printk(KERN_INFO "es1968: clocking to %d\n", chip->clock);
        }
        snd_es1968_free_memory(chip, memory);
        snd_es1968_free_apu_pair(chip, apu);
@@ -2323,12 +2328,7 @@ static void snd_es1968_chip_init(es1968_t *chip)
        outb(0, iobase + ASSP_CONTROL_C);       /* M: Disable ASSP, ASSP IRQ's and FM Port */
 
        /* Enable IRQ's */
-
-       if (chip->midi_enabled)
-               w = ESM_HIRQ_DSIE | ESM_HIRQ_MPU401;
-       else
-               w = ESM_HIRQ_DSIE;
-
+       w = ESM_HIRQ_DSIE | ESM_HIRQ_MPU401;
        outw(w, iobase + ESM_PORT_HOST_IRQ);
 
        /*
@@ -2404,11 +2404,11 @@ static void snd_es1968_chip_init(es1968_t *chip)
 /*
  * PM support
  */
-static void es1968_suspend(es1968_t *chip, int can_schedule)
+static void es1968_suspend(es1968_t *chip)
 {
        snd_card_t *card = chip->card;
 
-       snd_power_lock(card, can_schedule);
+       snd_power_lock(card);
        if (card->power_state == SNDRV_CTL_POWER_D3hot)
                goto __skip;
 
@@ -2419,11 +2419,11 @@ static void es1968_suspend(es1968_t *chip, int can_schedule)
        snd_power_unlock(card);
 }
 
-static void es1968_resume(es1968_t *chip, int can_schedule)
+static void es1968_resume(es1968_t *chip)
 {
        snd_card_t *card = chip->card;
 
-       snd_power_lock(card, can_schedule);
+       snd_power_lock(card);
        if (card->power_state == SNDRV_CTL_POWER_D0)
                goto __skip;
 
@@ -2452,25 +2452,25 @@ static void es1968_resume(es1968_t *chip, int can_schedule)
 static int snd_es1968_suspend(struct pci_dev *dev, u32 state)
 {
        es1968_t *chip = snd_magic_cast(es1968_t, pci_get_drvdata(dev), return -ENXIO);
-       es1968_suspend(chip, 0);
+       es1968_suspend(chip);
        return 0;
 }
 static int snd_es1968_resume(struct pci_dev *dev)
 {
        es1968_t *chip = snd_magic_cast(es1968_t, pci_get_drvdata(dev), return -ENXIO);
-       es1968_resume(chip, 0);
+       es1968_resume(chip);
        return 0;
 }
 #else
 static void snd_es1968_suspend(struct pci_dev *dev)
 {
        es1968_t *chip = snd_magic_cast(es1968_t, pci_get_drvdata(dev), return);
-       es1968_suspend(chip, 0);
+       es1968_suspend(chip);
 }
 static void snd_es1968_resume(struct pci_dev *dev)
 {
        es1968_t *chip = snd_magic_cast(es1968_t, pci_get_drvdata(dev), return);
-       es1968_resume(chip, 0);
+       es1968_resume(chip);
 }
 #endif
 
@@ -2482,11 +2482,11 @@ static int snd_es1968_set_power_state(snd_card_t *card, unsigned int power_state
        case SNDRV_CTL_POWER_D0:
        case SNDRV_CTL_POWER_D1:
        case SNDRV_CTL_POWER_D2:
-               es1968_resume(chip, 1);
+               es1968_resume(chip);
                break;
        case SNDRV_CTL_POWER_D3hot:
        case SNDRV_CTL_POWER_D3cold:
-               es1968_suspend(chip, 1);
+               es1968_suspend(chip);
                break;
        default:
                return -EINVAL;
@@ -2503,7 +2503,7 @@ static int snd_es1968_free(es1968_t *chip)
        chip->master_volume = NULL;
        if (chip->res_io_port) {
                release_resource(chip->res_io_port);
-               kfree(chip->res_io_port);
+               kfree_nocheck(chip->res_io_port);
        }
        if (chip->irq >= 0)
                free_irq(chip->irq, (void *)chip);
@@ -2519,7 +2519,6 @@ static int snd_es1968_dev_free(snd_device_t *device)
 
 static int __devinit snd_es1968_create(snd_card_t * card,
                                    struct pci_dev *pci,
-                                   int midi_enabled,
                                    int total_bufsize,
                                    int play_streams,
                                    int capt_streams,
@@ -2559,7 +2558,6 @@ static int __devinit snd_es1968_create(snd_card_t * card,
        chip->card = card;
        chip->pci = pci;
        chip->irq = -1;
-       chip->midi_enabled = midi_enabled;
        chip->total_bufsize = total_bufsize;    /* in bytes */
        chip->playback_streams = play_streams;
        chip->capture_streams = capt_streams;
@@ -2608,31 +2606,6 @@ static int __devinit snd_es1968_create(snd_card_t * card,
        return 0;
 }
 
-/* *************
-   * Midi Part *
-   *************/
-static int __devinit
-snd_es1968_midi(es1968_t *chip, int device, snd_rawmidi_t ** rawmidi)
-{
-       unsigned long mpu_port;
-       int err;
-       snd_rawmidi_t *rm;
-
-       rm = NULL;
-
-       mpu_port = chip->io_port + ESM_MPU401_PORT;
-
-       err = snd_mpu401_uart_new(chip->card, device,
-                                 MPU401_HW_MPU401,
-                                 mpu_port, 1, chip->irq, 0, &rm);
-       if (err < 0)
-               return err;
-
-       chip->rmidi = rm;
-       if (rawmidi)
-               *rawmidi = rm;
-       return 0;
-}
 
 /*
  * joystick
@@ -2711,7 +2684,6 @@ static int __devinit snd_es1968_probe(struct pci_dev *pci,
        if (snd_total_bufsize[dev] > 4096)
                snd_total_bufsize[dev] = 4096;
        if ((err = snd_es1968_create(card, pci,
-                                    snd_midi_enable[dev],
                                     snd_total_bufsize[dev] * 1024, /* in bytes */
                                     snd_pcm_substreams_p[dev], 
                                     snd_pcm_substreams_c[dev],
@@ -2745,11 +2717,10 @@ static int __devinit snd_es1968_probe(struct pci_dev *pci,
                return err;
        }
 
-       if (snd_midi_enable[dev]) {
-               if ((err = snd_es1968_midi(chip, 0, NULL)) < 0) {
-                       snd_card_free(card);
-                       return err;
-               }
+       if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401,
+                                      chip->io_port + ESM_MPU401_PORT, 1,
+                                      chip->irq, 0, &chip->rmidi)) < 0) {
+               printk(KERN_INFO "es1968: skipping MPU-401 MIDI support..\n");
        }
 
        /* card switches */
@@ -2762,7 +2733,8 @@ static int __devinit snd_es1968_probe(struct pci_dev *pci,
        }
 
        chip->clock = snd_clock[dev];
-       es1968_measure_clock(chip);
+       if (! chip->clock)
+               es1968_measure_clock(chip);
 
        sprintf(card->longname, "%s at 0x%lx, irq %i",
                card->shortname, chip->io_port, chip->irq);
@@ -2840,7 +2812,7 @@ module_exit(alsa_card_es1968_exit)
 #ifndef MODULE
 
 /* format is: snd-es1968=snd_enable,snd_index,snd_id,
-                        snd_total_bufsize,snd_midi_enable,
+                        snd_total_bufsize,
                         snd_pcm_substreams_p,
                         snd_pcm_substreams_c,
                         snd_clock
@@ -2856,7 +2828,6 @@ static int __init alsa_card_es1968_setup(char *str)
               get_option(&str,&snd_index[nr_dev]) == 2 &&
               get_id(&str,&snd_id[nr_dev]) == 2 &&
               get_option(&str,&snd_total_bufsize[nr_dev]) == 2 &&
-              get_option(&str,&snd_midi_enable[nr_dev]) == 2 &&
               get_option(&str,&snd_pcm_substreams_p[nr_dev]) == 2 &&
               get_option(&str,&snd_pcm_substreams_c[nr_dev]) == 2 &&
               get_option(&str,&snd_clock[nr_dev]) == 2);
index 3b4418b..469f537 100644 (file)
@@ -23,6 +23,7 @@
 #include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/ac97_codec.h>
@@ -878,7 +879,7 @@ static int snd_fm801_free(fm801_t *chip)
       __end_hw:
        if (chip->res_port) {
                release_resource(chip->res_port);
-               kfree(chip->res_port);
+               kfree_nocheck(chip->res_port);
        }
        if (chip->irq >= 0)
                free_irq(chip->irq, (void *)chip);
index 370e0db..71cf791 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/pcm.h>
@@ -62,6 +63,7 @@ MODULE_DEVICES("{{Hoontech SoundTrack DSP 24},"
                "{TerraTec,EWX 24/96},"
                "{TerraTec,EWS 88MT},"
                "{TerraTec,EWS 88D},"
+               "{TerraTec,DMX 6Fire},"
                "{ICEnsemble,Generic ICE1712},"
                "{ICEnsemble,Generic Envy24}}");
 
@@ -81,7 +83,7 @@ MODULE_PARM_DESC(snd_enable, "Enable ICE1712 soundcard.");
 MODULE_PARM_SYNTAX(snd_enable, SNDRV_ENABLE_DESC);
 MODULE_PARM(snd_omni, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
 MODULE_PARM_DESC(snd_omni, "Enable Midiman M-Audio Delta Omni I/O support.");
-MODULE_PARM_SYNTAX(snd_omni, SNDRV_ENABLE_DESC);
+MODULE_PARM_SYNTAX(snd_omni, SNDRV_ENABLED "," SNDRV_ENABLE_DESC);
 
 #ifndef PCI_VENDOR_ID_ICE
 #define PCI_VENDOR_ID_ICE              0x1412
@@ -4048,8 +4050,8 @@ static int __init snd_ice1712_build_controls(ice1712_t *ice)
                err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_6fire_led, ice));
                if (err < 0)
                        return err;
-               break;
 #endif
+               break;
        }
 
        return 0;
@@ -4070,19 +4072,19 @@ static int snd_ice1712_free(ice1712_t *ice)
                free_irq(ice->irq, (void *) ice);
        if (ice->res_port) {
                release_resource(ice->res_port);
-               kfree(ice->res_port);
+               kfree_nocheck(ice->res_port);
        }
        if (ice->res_ddma_port) {
                release_resource(ice->res_ddma_port);
-               kfree(ice->res_ddma_port);
+               kfree_nocheck(ice->res_ddma_port);
        }
        if (ice->res_dmapath_port) {
                release_resource(ice->res_dmapath_port);
-               kfree(ice->res_dmapath_port);
+               kfree_nocheck(ice->res_dmapath_port);
        }
        if (ice->res_profi_port) {
                release_resource(ice->res_profi_port);
-               kfree(ice->res_profi_port);
+               kfree_nocheck(ice->res_profi_port);
        }
        snd_magic_kfree(ice);
        return 0;
index 8433c2c..a22598c 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/ac97_codec.h>
@@ -54,7 +55,7 @@ MODULE_DEVICES("{{Intel,82801AA},"
 static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
 static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;  /* ID for this card */
 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
-static int snd_ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 48000};
+static int snd_ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
 
 MODULE_PARM(snd_index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
 MODULE_PARM_DESC(snd_index, "Index value for Intel i8x0 soundcard.");
@@ -66,8 +67,8 @@ MODULE_PARM(snd_enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
 MODULE_PARM_DESC(snd_enable, "Enable Intel i8x0 soundcard.");
 MODULE_PARM_SYNTAX(snd_enable, SNDRV_ENABLE_DESC);
 MODULE_PARM(snd_ac97_clock, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
-MODULE_PARM_DESC(snd_ac97_clock, "AC'97 codec clock (default 48000Hz).");
-MODULE_PARM_SYNTAX(snd_ac97_clock, SNDRV_ENABLED ",default:48000");
+MODULE_PARM_DESC(snd_ac97_clock, "AC'97 codec clock (0 = auto-detect).");
+MODULE_PARM_SYNTAX(snd_ac97_clock, SNDRV_ENABLED ",default:0");
 
 /*
  *  Direct registers
@@ -177,10 +178,10 @@ MODULE_PARM_SYNTAX(snd_ac97_clock, SNDRV_ENABLED ",default:48000");
 
 typedef struct {
        unsigned long reg_offset;
-       unsigned int *bdbar;                    /* CPU address */
-       dma_addr_t bdbar_addr;                  /* PCI bus address */
-        snd_pcm_substream_t *substream;
-        dma_addr_t physbuf;
+       u32 *bdbar;                     /* CPU address (32bit) */
+       unsigned int bdbar_addr;                /* PCI bus address (32bit) */
+       snd_pcm_substream_t *substream;
+       unsigned int physbuf;                   /* physical address (32bit) */
         unsigned int size;
         unsigned int fragsize;
         unsigned int fragsize1;
@@ -225,6 +226,7 @@ struct _snd_intel8x0 {
 
        int multi4: 1,
            multi6: 1;
+       int in_ac97_init: 1;
 
        ac97_t *ac97;
        ac97_t *ac97sec;
@@ -233,7 +235,7 @@ struct _snd_intel8x0 {
        spinlock_t ac97_lock;
        snd_info_entry_t *proc_entry;
        
-       unsigned int *bdbars;
+       u32 *bdbars;
        dma_addr_t bdbars_addr;
        
        unsigned int reg_pi_sr;
@@ -298,8 +300,10 @@ static void snd_intel8x0_codec_write(ac97_t *ac97,
        intel8x0_t *chip = snd_magic_cast(intel8x0_t, ac97->private_data, return);
        
        spin_lock(&chip->ac97_lock);
-       if (snd_intel8x0_codec_semaphore(chip, ac97->num) < 0)
-               snd_printk("codec_write %d: semaphore is not ready for register 0x%x\n", ac97->num, reg);
+       if (snd_intel8x0_codec_semaphore(chip, ac97->num) < 0) {
+               if (! chip->in_ac97_init)
+                       snd_printk("codec_write %d: semaphore is not ready for register 0x%x\n", ac97->num, reg);
+       }
        outw(val, chip->port + reg + ac97->num * 0x80);
        spin_unlock(&chip->ac97_lock);
 }
@@ -313,14 +317,16 @@ static unsigned short snd_intel8x0_codec_read(ac97_t *ac97,
 
        spin_lock(&chip->ac97_lock);
        if (snd_intel8x0_codec_semaphore(chip, ac97->num) < 0) {
-               snd_printk("codec_read %d: semaphore is not ready for register 0x%x\n", ac97->num, reg);
+               if (! chip->in_ac97_init)
+                       snd_printk("codec_read %d: semaphore is not ready for register 0x%x\n", ac97->num, reg);
                res = 0xffff;
        } else {
                res = inw(chip->port + reg + ac97->num * 0x80);
                if ((tmp = inl(ICHREG(chip, GLOB_STA))) & ICH_RCS) {
                        /* reset RCS and preserve other R/WC bits */
                        outl(tmp & ~(ICH_SRI|ICH_PRI|ICH_GSCI), ICHREG(chip, GLOB_STA));
-                       snd_printk("codec_read %d: read timeout for register 0x%x\n", ac97->num, reg);
+                       if (! chip->in_ac97_init)
+                               snd_printk("codec_read %d: read timeout for register 0x%x\n", ac97->num, reg);
                        res = 0xffff;
                }
        }
@@ -363,7 +369,7 @@ static int snd_intel8x0_trigger(intel8x0_t *chip, ichdev_t *ichdev, int cmd)
 static void snd_intel8x0_setup_periods(intel8x0_t *chip, ichdev_t *ichdev) 
 {
        int idx;
-       unsigned int *bdbar = ichdev->bdbar;
+       u32 *bdbar = ichdev->bdbar;
        unsigned long port = chip->bmport + ichdev->reg_offset;
        int shiftlen = (chip->device_type == DEVICE_SIS) ? 0 : 1;
 
@@ -741,7 +747,7 @@ static int __devinit snd_intel8x0_pcm(intel8x0_t *chip, int device, snd_pcm_t **
        pcm->private_data = chip;
        pcm->private_free = snd_intel8x0_pcm_free;
        pcm->info_flags = 0;
-       strcpy(pcm->name, "Intel ICH");
+       strcpy(pcm->name, chip->card->shortname);
        chip->pcm = pcm;
 
        snd_pcm_lib_preallocate_pci_pages_for_all(chip->pci, pcm, 64*1024, 128*1024);
@@ -881,7 +887,7 @@ static int __devinit snd_intel8x0_pcm_mic(intel8x0_t *chip, int device, snd_pcm_
        pcm->private_data = chip;
        pcm->private_free = snd_intel8x0_pcm_mic_free;
        pcm->info_flags = 0;
-       strcpy(pcm->name, "Intel ICH - MIC ADC");
+       sprintf(pcm->name, "%s - MIC ADC", chip->card->shortname);
 
        chip->pcm_mic = pcm;    
        if (rpcm)
@@ -918,6 +924,7 @@ static int __devinit snd_intel8x0_mixer(intel8x0_t *chip, int ac97_clock)
        ac97_t ac97;
        int err;
 
+       chip->in_ac97_init = 1;
        memset(&ac97, 0, sizeof(ac97));
        ac97.write = snd_intel8x0_codec_write;
        ac97.read = snd_intel8x0_codec_read;
@@ -946,6 +953,7 @@ static int __devinit snd_intel8x0_mixer(intel8x0_t *chip, int ac97_clock)
                    (chip->ac97sec && (chip->ac97sec->scaps & AC97_SCAP_CENTER_LFE_DAC)))
                        chip->multi6 = 1;
        }
+       chip->in_ac97_init = 0;
        return 0;
 }
 
@@ -1056,14 +1064,14 @@ static int snd_intel8x0_free(intel8x0_t *chip)
        synchronize_irq();
       __hw_end:
        if (chip->bdbars)
-               snd_free_pci_pages(chip->pci, 3 * sizeof(unsigned int) * ICH_MAX_FRAGS * 2, chip->bdbars, chip->bdbars_addr);
+               snd_free_pci_pages(chip->pci, 3 * sizeof(u32) * ICH_MAX_FRAGS * 2, chip->bdbars, chip->bdbars_addr);
        if (chip->res_port) {
                release_resource(chip->res_port);
-               kfree(chip->res_port);
+               kfree_nocheck(chip->res_port);
        }
        if (chip->res_bmport) {
                release_resource(chip->res_bmport);
-               kfree(chip->res_bmport);
+               kfree_nocheck(chip->res_bmport);
        }
        if (chip->irq >= 0)
                free_irq(chip->irq, (void *)chip);
@@ -1075,11 +1083,11 @@ static int snd_intel8x0_free(intel8x0_t *chip)
 /*
  * power management
  */
-static void intel8x0_suspend(intel8x0_t *chip, int can_schedule)
+static void intel8x0_suspend(intel8x0_t *chip)
 {
        snd_card_t *card = chip->card;
 
-       snd_power_lock(card, can_schedule);
+       snd_power_lock(card);
        if (card->power_state == SNDRV_CTL_POWER_D3hot)
                goto __skip;
 
@@ -1091,11 +1099,11 @@ static void intel8x0_suspend(intel8x0_t *chip, int can_schedule)
        snd_power_unlock(card);
 }
 
-static void intel8x0_resume(intel8x0_t *chip, int can_schedule)
+static void intel8x0_resume(intel8x0_t *chip)
 {
        snd_card_t *card = chip->card;
 
-       snd_power_lock(card, can_schedule);
+       snd_power_lock(card);
        if (card->power_state == SNDRV_CTL_POWER_D0)
                goto __skip;
 
@@ -1113,25 +1121,25 @@ static void intel8x0_resume(intel8x0_t *chip, int can_schedule)
 static int snd_intel8x0_suspend(struct pci_dev *dev, u32 state)
 {
        intel8x0_t *chip = snd_magic_cast(intel8x0_t, pci_get_drvdata(dev), return -ENXIO);
-       intel8x0_suspend(chip, 0);
+       intel8x0_suspend(chip);
        return 0;
 }
 static int snd_intel8x0_resume(struct pci_dev *dev)
 {
        intel8x0_t *chip = snd_magic_cast(intel8x0_t, pci_get_drvdata(dev), return -ENXIO);
-       intel8x0_resume(chip, 0);
+       intel8x0_resume(chip);
        return 0;
 }
 #else
 static void snd_intel8x0_suspend(struct pci_dev *dev)
 {
        intel8x0_t *chip = snd_magic_cast(intel8x0_t, pci_get_drvdata(dev), return);
-       intel8x0_suspend(chip, 0);
+       intel8x0_suspend(chip);
 }
 static void snd_intel8x0_resume(struct pci_dev *dev)
 {
        intel8x0_t *chip = snd_magic_cast(intel8x0_t, pci_get_drvdata(dev), return);
-       intel8x0_resume(chip, 0);
+       intel8x0_resume(chip);
 }
 #endif
 
@@ -1143,11 +1151,11 @@ static int snd_intel8x0_set_power_state(snd_card_t *card, unsigned int power_sta
        case SNDRV_CTL_POWER_D0:
        case SNDRV_CTL_POWER_D1:
        case SNDRV_CTL_POWER_D2:
-               intel8x0_resume(chip, 1);
+               intel8x0_resume(chip);
                break;
        case SNDRV_CTL_POWER_D3hot:
        case SNDRV_CTL_POWER_D3cold:
-               intel8x0_suspend(chip, 1);
+               intel8x0_suspend(chip);
                break;
        default:
                return -EINVAL;
@@ -1187,8 +1195,13 @@ static void __devinit intel8x0_measure_ac97_clock(intel8x0_t *chip)
        outb(ICH_IOCE | ICH_STARTBM, port + ICH_REG_PI_CR); /* trigger */
        do_gettimeofday(&start_time);
        spin_unlock_irqrestore(&chip->reg_lock, flags);
+#if 0
        set_current_state(TASK_UNINTERRUPTIBLE);
        schedule_timeout(HZ / 20);
+#else
+       /* FIXME: schedule() can take too long time and overlap the boundary.. */
+       mdelay(50);
+#endif
        spin_lock_irqsave(&chip->reg_lock, flags);
        /* check the position */
        pos = chip->playback.fragsize1;
@@ -1217,9 +1230,10 @@ static void __devinit intel8x0_measure_ac97_clock(intel8x0_t *chip)
        }
        pos = (pos / 4) * 1000;
        pos = (pos / t) * 1000 + ((pos % t) * 1000) / t;
-       if (pos && (pos > 48500 || pos < 47500)) {
+       if ((pos > 40000 && pos < 47500) ||
+           (pos > 48500 && pos < 50000)) {
                chip->ac97->clock = (chip->ac97->clock * 48000) / pos;
-               snd_printd("setting clocking to %d\n", chip->ac97->clock);
+               printk(KERN_INFO "intel8x0: clocking to %d\n", chip->ac97->clock);
        }
 }
 
@@ -1239,6 +1253,7 @@ static int __devinit snd_intel8x0_create(snd_card_t * card,
        static snd_device_ops_t ops = {
                dev_free:       snd_intel8x0_dev_free,
        };
+       char name[32];
 
        *r_intel8x0 = NULL;
 
@@ -1255,18 +1270,20 @@ static int __devinit snd_intel8x0_create(snd_card_t * card,
        chip->pci = pci;
        chip->irq = -1;
        chip->port = pci_resource_start(pci, 0);
-       if ((chip->res_port = request_region(chip->port, 256, "Intel ICH - AC'97")) == NULL) {
+       sprintf(name, "%s - AC'97", card->shortname);
+       if ((chip->res_port = request_region(chip->port, 256, name)) == NULL) {
                snd_intel8x0_free(chip);
                snd_printk("unable to grab ports 0x%lx-0x%lx\n", chip->port, chip->port + 256 - 1);
                return -EBUSY;
        }
+       sprintf(name, "%s - Controller", card->shortname);
        chip->bmport = pci_resource_start(pci, 1);
-       if ((chip->res_bmport = request_region(chip->bmport, 64, "Intel ICH - Controller")) == NULL) {
+       if ((chip->res_bmport = request_region(chip->bmport, 64, name)) == NULL) {
                snd_intel8x0_free(chip);
                snd_printk("unable to grab ports 0x%lx-0x%lx\n", chip->bmport, chip->bmport + 64 - 1);
                return -EBUSY;
        }
-       if (request_irq(pci->irq, snd_intel8x0_interrupt, SA_INTERRUPT|SA_SHIRQ, "Intel ICH", (void *)chip)) {
+       if (request_irq(pci->irq, snd_intel8x0_interrupt, SA_INTERRUPT|SA_SHIRQ, card->shortname, (void *)chip)) {
                snd_intel8x0_free(chip);
                snd_printk("unable to grab IRQ %d\n", pci->irq);
                return -EBUSY;
@@ -1296,19 +1313,27 @@ static int __devinit snd_intel8x0_create(snd_card_t * card,
 
        /* allocate buffer descriptor lists */
        /* the start of each lists must be aligned to 8 bytes */
-       chip->bdbars = (unsigned int *)snd_malloc_pci_pages(pci, 3 * sizeof(unsigned int) * ICH_MAX_FRAGS * 2, &chip->bdbars_addr);
+       chip->bdbars = (u32 *)snd_malloc_pci_pages(pci, 3 * sizeof(unsigned int) * ICH_MAX_FRAGS * 2, &chip->bdbars_addr);
        if (chip->bdbars == NULL) {
                snd_intel8x0_free(chip);
                return -ENOMEM;
        }
        /* tables must be aligned to 8 bytes here, but the kernel pages
-          are much bigger, so we don't care */
-       chip->playback.bdbar = chip->bdbars;
-       chip->playback.bdbar_addr = chip->bdbars_addr;
+          are much bigger, so we don't care (on i386) */
+#ifndef __i386__
+       /* .. not sure on other architectures, so we check now. */
+       if (chip->bdbars_addr & ~((dma_addr_t)0xffffffff | 0x07)) {
+               snd_printk("invalid i/o port address %lx\n", (unsigned long)chip->bdbars_addr);
+               snd_intel8x0_free(chip);
+               return -ENOMEM;
+       }
+#endif
+       chip->playback.bdbar = chip->bdbars; /* crop to 32bit */
+       chip->playback.bdbar_addr = (unsigned int)chip->bdbars_addr;
        chip->capture.bdbar = chip->playback.bdbar + ICH_MAX_FRAGS * 2;
-       chip->capture.bdbar_addr = chip->playback.bdbar_addr + sizeof(unsigned int) * ICH_MAX_FRAGS * 2;
+       chip->capture.bdbar_addr = chip->playback.bdbar_addr + sizeof(u32) * ICH_MAX_FRAGS * 2;
        chip->capture_mic.bdbar = chip->capture.bdbar + ICH_MAX_FRAGS * 2;
-       chip->capture_mic.bdbar_addr = chip->capture.bdbar_addr + sizeof(unsigned int) * ICH_MAX_FRAGS * 2;
+       chip->capture_mic.bdbar_addr = chip->capture.bdbar_addr + sizeof(u32) * ICH_MAX_FRAGS * 2;
 
        if ((err = snd_intel8x0_chip_init(chip)) < 0) {
                snd_intel8x0_free(chip);
@@ -1338,7 +1363,7 @@ static struct shortname_table {
        { PCI_DEVICE_ID_INTEL_440MX, "Intel 440MX" },
        { PCI_DEVICE_ID_INTEL_ICH3, "Intel ICH3" },
        { PCI_DEVICE_ID_SI_7012, "SiS SI7012" },
-       { PCI_DEVICE_ID_NVIDIA_MCP_AUDIO, "NVidia NForce Audio" },
+       { PCI_DEVICE_ID_NVIDIA_MCP_AUDIO, "NVidia NForce" },
        { 0, 0 },
 };
 
@@ -1362,6 +1387,15 @@ static int __devinit snd_intel8x0_probe(struct pci_dev *pci,
        if (card == NULL)
                return -ENOMEM;
 
+       strcpy(card->driver, "ICH");
+       strcpy(card->shortname, "Intel ICH");
+       for (name = shortnames; name->id; name++) {
+               if (pci->device == name->id) {
+                       strcpy(card->shortname, name->s);
+                       break;
+               }
+       }
+
        if ((err = snd_intel8x0_create(card, pci, id->driver_data, &chip)) < 0) {
                snd_card_free(card);
                return err;
@@ -1382,19 +1416,10 @@ static int __devinit snd_intel8x0_probe(struct pci_dev *pci,
                }
        }
        
-       strcpy(card->driver, "ICH");
-       strcpy(card->shortname, "Intel ICH");
-       for (name = shortnames; name->id; name++) {
-               if (chip->pci->device == name->id) {
-                       strcpy(card->shortname, name->s);
-                       break;
-               }
-       }
-
        sprintf(card->longname, "%s at 0x%lx, irq %i",
                card->shortname, chip->port, chip->irq);
 
-       if (chip->ac97->clock == 48000)
+       if (! snd_ac97_clock[dev])
                intel8x0_measure_ac97_clock(chip);
 
        if ((err = snd_card_register(card)) < 0) {
index c06f2bc..e7cdc34 100644 (file)
@@ -23,6 +23,7 @@
 #include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/info.h>
 #include <sound/control.h>
@@ -165,9 +166,11 @@ typedef enum {
 
 #define K1212_CHANNELS         16
 #define K1212_FRAME_SIZE        (sizeof(KorgAudioFrame))
+#define K1212_MAX_SAMPLES      (kPlayBufferFrames*kNumBuffers)
+#define K1212_PERIODS          (K1212_BUF_SIZE/K1212_BLOCK_SIZE)
+#define K1212_PERIOD_BYTES     (K1212_BLOCK_SIZE)
 #define K1212_BLOCK_SIZE        (K1212_FRAME_SIZE*kPlayBufferFrames)
 #define K1212_BUF_SIZE          (K1212_BLOCK_SIZE*kNumBuffers)
-#define K1212_MAX_SAMPLES      (kPlayBufferFrames*kNumBuffers)
 
 #define k1212MinADCSens     0x7f
 #define k1212MaxADCSens     0x00
@@ -273,7 +276,7 @@ typedef struct KorgSharedBuffer {
    KorgAudioBuffer   playDataBufs[kNumBuffers];
    KorgAudioBuffer   recordDataBufs[kNumBuffers];
 #endif
-   u16               volumeData[kAudioChannels];
+   short             volumeData[kAudioChannels];
    u32               cardCommand;
    u16               routeData [kAudioChannels];
    u32               AdatTimeCode;                 // ADAT timecode value
@@ -1060,7 +1063,7 @@ static void snd_korg1212_interrupt(int irq, void *dev_id, struct pt_regs *regs)
         switch (doorbellValue) {
                 case K1212_DB_DSPDownloadDone:
 #ifdef DEBUG
-                        PRINTK("DEBUG: IRQ count - %ld, %x, [%s].\n", korg1212->irqcount, doorbellValue, stateName[korg1212->cardState]);
+                        PRINTK("DEBUG: IRQ DNLD count - %ld, %x, [%s].\n", korg1212->irqcount, doorbellValue, stateName[korg1212->cardState]);
 #endif
                         if (korg1212->cardState == K1212_STATE_DSP_IN_PROCESS) {
                                         snd_korg1212_setCardState(korg1212, K1212_STATE_DSP_COMPLETE);
@@ -1073,7 +1076,7 @@ static void snd_korg1212_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                 // ------------------------------------------------------------------------
                 case K1212_ISRCODE_DMAERROR:
 #ifdef DEBUG
-                        PRINTK("DEBUG: IRQ count - %ld, %x, [%s].\n", korg1212->irqcount, doorbellValue, stateName[korg1212->cardState]);
+                        PRINTK("DEBUG: IRQ DMAE count - %ld, %x, [%s].\n", korg1212->irqcount, doorbellValue, stateName[korg1212->cardState]);
 #endif
                         writel(0, &korg1212->sharedBufferPtr->cardCommand);
                         break;
@@ -1084,12 +1087,16 @@ static void snd_korg1212_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                 // ------------------------------------------------------------------------
                 case K1212_ISRCODE_CARDSTOPPED:
 #ifdef DEBUG
-                        PRINTK("DEBUG: IRQ count - %ld, %x, [%s].\n", korg1212->irqcount, doorbellValue, stateName[korg1212->cardState]);
+                        PRINTK("DEBUG: IRQ CSTP count - %ld, %x, [%s].\n", korg1212->irqcount, doorbellValue, stateName[korg1212->cardState]);
 #endif
                         writel(0, &korg1212->sharedBufferPtr->cardCommand);
                         break;
 
                 default:
+#ifdef XDEBUG
+                        PRINTK("DEBUG: IRQ DFLT count - %ld, %x, cpos=%d [%s].\n", korg1212->irqcount, doorbellValue, 
+                               korg1212->currentBuffer, stateName[korg1212->cardState]);
+#endif
                         if ((korg1212->cardState > K1212_STATE_SETUP) || korg1212->idleMonitorOn) {
                                 korg1212->currentBuffer++;
 
@@ -1157,10 +1164,10 @@ static snd_pcm_hardware_t snd_korg1212_playback_info =
         channels_min:        K1212_CHANNELS,
         channels_max:        K1212_CHANNELS,
         buffer_bytes_max:    K1212_BUF_SIZE,
-        period_bytes_min:    K1212_BLOCK_SIZE,
-        period_bytes_max:    K1212_BLOCK_SIZE,
-        periods_min:         K1212_BUF_SIZE / K1212_BLOCK_SIZE,
-        periods_max:         K1212_BUF_SIZE / K1212_BLOCK_SIZE,
+        period_bytes_min:    K1212_PERIOD_BYTES,
+        period_bytes_max:    K1212_PERIOD_BYTES,
+        periods_min:         K1212_PERIODS,
+        periods_max:         K1212_PERIODS,
         fifo_size:           0,
 };
 
@@ -1177,10 +1184,10 @@ static snd_pcm_hardware_t snd_korg1212_capture_info =
         channels_min:        K1212_CHANNELS,
         channels_max:        K1212_CHANNELS,
         buffer_bytes_max:    K1212_BUF_SIZE,
-        period_bytes_min:    K1212_BLOCK_SIZE,
-        period_bytes_max:    K1212_BLOCK_SIZE,
-        periods_min:         K1212_BUF_SIZE / K1212_BLOCK_SIZE,
-        periods_max:         K1212_BUF_SIZE / K1212_BLOCK_SIZE,
+        period_bytes_min:    K1212_PERIOD_BYTES,
+        period_bytes_max:    K1212_PERIOD_BYTES,
+        periods_min:         K1212_PERIODS,
+        periods_max:         K1212_PERIODS,
         fifo_size:           0,
 };
 
@@ -1195,7 +1202,7 @@ static void snd_korg1212_free_pcm(snd_pcm_t *pcm)
         korg1212->pcm16 = NULL;
 }
 
-static unsigned int period_bytes[] = { K1212_BLOCK_SIZE };
+static unsigned int period_bytes[] = { K1212_PERIOD_BYTES };
 
 #define PERIOD_BYTES sizeof(period_bytes) / sizeof(period_bytes[0])
 
@@ -1226,7 +1233,7 @@ static int snd_korg1212_playback_open(snd_pcm_substream_t *substream)
        runtime->dma_bytes = K1212_BUF_SIZE;
 
         korg1212->playback_substream = substream;
-        korg1212->periodsize = K1212_BLOCK_SIZE;
+        korg1212->periodsize = K1212_PERIODS;
 
         spin_unlock_irqrestore(&korg1212->lock, flags);
 
@@ -1256,7 +1263,7 @@ static int snd_korg1212_capture_open(snd_pcm_substream_t *substream)
        runtime->dma_bytes = K1212_BUF_SIZE;
 
         korg1212->capture_substream = substream;
-        korg1212->periodsize = K1212_BLOCK_SIZE;
+        korg1212->periodsize = K1212_PERIODS;
 
         spin_unlock_irqrestore(&korg1212->lock, flags);
 
@@ -1383,7 +1390,7 @@ static int snd_korg1212_prepare(snd_pcm_substream_t *substream)
 
         snd_korg1212_SetupForPlay(korg1212);
 
-        korg1212->currentBuffer = kNumBuffers;
+        korg1212->currentBuffer = -1;
 
         spin_unlock_irqrestore(&korg1212->lock, flags);
         return 0;
@@ -1395,7 +1402,7 @@ static int snd_korg1212_trigger(snd_pcm_substream_t *substream,
         korg1212_t *korg1212 = _snd_pcm_substream_chip(substream);
 
 #ifdef DEBUG
-               PRINTK("DEBUG: snd_korg1212_trigger [%s]\n", stateName[korg1212->cardState]);
+               PRINTK("DEBUG: snd_korg1212_trigger [%s] cmd=%d\n", stateName[korg1212->cardState], cmd);
 #endif
 
         switch (cmd) {
@@ -1418,7 +1425,12 @@ static int snd_korg1212_trigger(snd_pcm_substream_t *substream,
 static snd_pcm_uframes_t snd_korg1212_pointer(snd_pcm_substream_t *substream)
 {
         korg1212_t *korg1212 = _snd_pcm_substream_chip(substream);
-        snd_pcm_uframes_t pos = korg1212->currentBuffer * kPlayBufferFrames;
+        snd_pcm_uframes_t pos;
+
+       if (korg1212->currentBuffer < 0)
+               return 0;
+
+       pos = korg1212->currentBuffer * kPlayBufferFrames;
 
 #ifdef XDEBUG
                PRINTK("DEBUG: snd_korg1212_pointer [%s] %ld\n", stateName[korg1212->cardState], pos);
@@ -1515,15 +1527,8 @@ static snd_pcm_ops_t snd_korg1212_capture_ops = {
 
 static int snd_korg1212_control_phase_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
 {
-        static char * texts[] = { "Inverted", "Mute", "Not Inverted" };
-
-       uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
-       uinfo->count = kAudioChannels;
-       uinfo->value.enumerated.items = 3;
-       if (uinfo->value.enumerated.item > 2) {
-               uinfo->value.enumerated.item = 2;
-       }
-       strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
+       uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
+       uinfo->count = (kcontrol->private_value >= 8) ? 2 : 1;
        return 0;
 }
 
@@ -1531,12 +1536,14 @@ static int snd_korg1212_control_phase_get(snd_kcontrol_t *kcontrol, snd_ctl_elem
 {
        korg1212_t *korg1212 = _snd_kcontrol_chip(kcontrol);
        unsigned long flags;
-        int i;
+       int i = kcontrol->private_value;
 
        spin_lock_irqsave(&korg1212->lock, flags);
 
-        for (i=0; i<kAudioChannels; i++)
-                u->value.enumerated.item[i] = korg1212->volumePhase[i] + 1;
+        u->value.integer.value[0] = korg1212->volumePhase[i];
+
+       if (i >= 8) 
+               u->value.integer.value[1] = korg1212->volumePhase[i+1];
 
         spin_unlock_irqrestore(&korg1212->lock, flags);
 
@@ -1552,13 +1559,30 @@ static int snd_korg1212_control_phase_put(snd_kcontrol_t *kcontrol, snd_ctl_elem
 
        spin_lock_irqsave(&korg1212->lock, flags);
 
-        for (i=0; i<kAudioChannels; i++)
-                if (u->value.integer.value[i] != korg1212->volumePhase[i]) {
-                        korg1212->volumePhase[i] = u->value.enumerated.item[i] - 1;
-                       val = u->value.integer.value[i] * korg1212->volumePhase[i];
-                        korg1212->sharedBufferPtr->volumeData[i] = val;
-                        change = 1;
-                }
+       i = kcontrol->private_value;
+
+       korg1212->volumePhase[i] = u->value.integer.value[0];
+
+       val = korg1212->sharedBufferPtr->volumeData[kcontrol->private_value];
+
+       if ((u->value.integer.value[0] > 0) != (val < 0)) {
+               val = abs(val) * (korg1212->volumePhase[i] > 0 ? -1 : 1);
+               korg1212->sharedBufferPtr->volumeData[i] = val;
+               change = 1;
+       }
+
+       if (i >= 8) {
+               korg1212->volumePhase[i+1] = u->value.integer.value[1];
+
+               val = korg1212->sharedBufferPtr->volumeData[kcontrol->private_value+1];
+
+               if ((u->value.integer.value[1] > 0) != (val < 0)) {
+                       val = abs(val) * (korg1212->volumePhase[i+1] > 0 ? -1 : 1);
+                       korg1212->sharedBufferPtr->volumeData[i+1] = val;
+                       change = 1;
+               }
+       }
+
        spin_unlock_irqrestore(&korg1212->lock, flags);
 
         return change;
@@ -1567,7 +1591,7 @@ static int snd_korg1212_control_phase_put(snd_kcontrol_t *kcontrol, snd_ctl_elem
 static int snd_korg1212_control_volume_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
 {
         uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
-        uinfo->count = kAudioChannels;
+       uinfo->count = (kcontrol->private_value >= 8) ? 2 : 1;
         uinfo->value.integer.min = k1212MinVolume;
        uinfo->value.integer.max = k1212MaxVolume;
         return 0;
@@ -1581,8 +1605,11 @@ static int snd_korg1212_control_volume_get(snd_kcontrol_t *kcontrol, snd_ctl_ele
 
        spin_lock_irqsave(&korg1212->lock, flags);
 
-        for (i=0; i<kAudioChannels; i++)
-                u->value.integer.value[i] = korg1212->sharedBufferPtr->volumeData[i] & 0x7fff;
+       i = kcontrol->private_value;
+        u->value.integer.value[0] = abs(korg1212->sharedBufferPtr->volumeData[i]);
+
+       if (i >= 8) 
+                u->value.integer.value[1] = abs(korg1212->sharedBufferPtr->volumeData[i+1]);
 
         spin_unlock_irqrestore(&korg1212->lock, flags);
 
@@ -1599,12 +1626,24 @@ static int snd_korg1212_control_volume_put(snd_kcontrol_t *kcontrol, snd_ctl_ele
 
        spin_lock_irqsave(&korg1212->lock, flags);
 
-        for (i=0; i<kAudioChannels; i++)
-                if (u->value.integer.value[i] != (korg1212->sharedBufferPtr->volumeData[i] & 0x7fff)) {
-                       val = u->value.integer.value[i] * korg1212->volumePhase[i];
-                        korg1212->sharedBufferPtr->volumeData[i] = val;
-                        change = 1;
-                }
+       i = kcontrol->private_value;
+
+       if (u->value.integer.value[0] != abs(korg1212->sharedBufferPtr->volumeData[i])) {
+               val = korg1212->volumePhase[i] > 0 ? -1 : 1;
+               val *= u->value.integer.value[0];
+               korg1212->sharedBufferPtr->volumeData[i] = val;
+               change = 1;
+       }
+
+       if (i >= 8) {
+               if (u->value.integer.value[1] != abs(korg1212->sharedBufferPtr->volumeData[i+1])) {
+                       val = korg1212->volumePhase[i+1] > 0 ? -1 : 1;
+                       val *= u->value.integer.value[1];
+                       korg1212->sharedBufferPtr->volumeData[i+1] = val;
+                       change = 1;
+               }
+       }
+
        spin_unlock_irqrestore(&korg1212->lock, flags);
 
         return change;
@@ -1613,7 +1652,7 @@ static int snd_korg1212_control_volume_put(snd_kcontrol_t *kcontrol, snd_ctl_ele
 static int snd_korg1212_control_route_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
 {
        uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
-       uinfo->count = kAudioChannels;
+       uinfo->count = (kcontrol->private_value >= 8) ? 2 : 1;
        uinfo->value.enumerated.items = kAudioChannels;
        if (uinfo->value.enumerated.item > kAudioChannels-1) {
                uinfo->value.enumerated.item = kAudioChannels-1;
@@ -1630,8 +1669,11 @@ static int snd_korg1212_control_route_get(snd_kcontrol_t *kcontrol, snd_ctl_elem
 
        spin_lock_irqsave(&korg1212->lock, flags);
 
-        for (i=0; i<kAudioChannels; i++)
-                u->value.enumerated.item[i] = korg1212->sharedBufferPtr->routeData[i];
+       i = kcontrol->private_value;
+       u->value.enumerated.item[0] = korg1212->sharedBufferPtr->routeData[i];
+
+       if (i >= 8) 
+               u->value.enumerated.item[1] = korg1212->sharedBufferPtr->routeData[i+1];
 
         spin_unlock_irqrestore(&korg1212->lock, flags);
 
@@ -1642,16 +1684,24 @@ static int snd_korg1212_control_route_put(snd_kcontrol_t *kcontrol, snd_ctl_elem
 {
        korg1212_t *korg1212 = _snd_kcontrol_chip(kcontrol);
        unsigned long flags;
-        int change = 0;
-        int i;
+        int change = 0, i;
 
        spin_lock_irqsave(&korg1212->lock, flags);
 
-        for (i=0; i<kAudioChannels; i++)
-                if (u->value.enumerated.item[i] != korg1212->sharedBufferPtr->volumeData[i]) {
-                        korg1212->sharedBufferPtr->routeData[i] = u->value.enumerated.item[i];
-                        change = 1;
-                }
+       i = kcontrol->private_value;
+
+       if (u->value.enumerated.item[0] != korg1212->sharedBufferPtr->volumeData[i]) {
+               korg1212->sharedBufferPtr->routeData[i] = u->value.enumerated.item[0];
+               change = 1;
+       }
+
+       if (i >= 8) {
+               if (u->value.enumerated.item[1] != korg1212->sharedBufferPtr->volumeData[i+1]) {
+                       korg1212->sharedBufferPtr->routeData[i+1] = u->value.enumerated.item[1];
+                       change = 1;
+               }
+       }
+
        spin_unlock_irqrestore(&korg1212->lock, flags);
 
         return change;
@@ -1661,8 +1711,8 @@ static int snd_korg1212_control_analog_info(snd_kcontrol_t *kcontrol, snd_ctl_el
 {
         uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
         uinfo->count = 2;
-        uinfo->value.integer.min = k1212MinADCSens;
-       uinfo->value.integer.max = k1212MaxADCSens;
+        uinfo->value.integer.min = k1212MaxADCSens;
+       uinfo->value.integer.max = k1212MinADCSens;
         return 0;
 }
 
@@ -1746,8 +1796,41 @@ static int snd_korg1212_control_sync_put(snd_kcontrol_t * kcontrol, snd_ctl_elem
        return change;
 }
 
+#define MON_MIXER(ord,c_name)                                                                  \
+        {                                                                                      \
+                access:                SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_WRITE,       \
+                iface:          SNDRV_CTL_ELEM_IFACE_MIXER,                                    \
+                name:          c_name " Monitor Volume",                                               \
+                info:          snd_korg1212_control_volume_info,                               \
+                get:           snd_korg1212_control_volume_get,                                \
+                put:           snd_korg1212_control_volume_put,                                \
+               private_value:  ord,                                                            \
+        },                                                                                      \
+        {                                                                                      \
+                access:                SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_WRITE,       \
+                iface:          SNDRV_CTL_ELEM_IFACE_MIXER,                                    \
+                name:          c_name " Monitor Route",                                                \
+                info:          snd_korg1212_control_route_info,                                \
+                get:           snd_korg1212_control_route_get,                                 \
+                put:           snd_korg1212_control_route_put,                                 \
+               private_value:  ord,                                                            \
+        },                                                                                      \
+        {                                                                                      \
+                access:                SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_WRITE,       \
+                iface:          SNDRV_CTL_ELEM_IFACE_PCM,                                      \
+                name:          c_name " Monitor Phase Invert",                                         \
+                info:          snd_korg1212_control_phase_info,                                \
+                get:           snd_korg1212_control_phase_get,                                 \
+                put:           snd_korg1212_control_phase_put,                                 \
+               private_value:  ord,                                                            \
+        }
+
 static snd_kcontrol_new_t snd_korg1212_controls[] = {
-        {
+        MON_MIXER(8, "Analog"),
+       MON_MIXER(10, "SPDIF"), 
+        MON_MIXER(0, "ADAT-1"), MON_MIXER(1, "ADAT-2"), MON_MIXER(2, "ADAT-3"), MON_MIXER(3, "ADAT-4"),
+        MON_MIXER(4, "ADAT-5"), MON_MIXER(5, "ADAT-6"), MON_MIXER(6, "ADAT-7"), MON_MIXER(7, "ADAT-8"),
+       {
                 access:                SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_WRITE,
                 iface:          SNDRV_CTL_ELEM_IFACE_PCM,
                 name:          "Sync Source",
@@ -1758,31 +1841,7 @@ static snd_kcontrol_new_t snd_korg1212_controls[] = {
         {
                 access:                SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_WRITE,
                 iface:          SNDRV_CTL_ELEM_IFACE_MIXER,
-                name:          "Monitor Volume",
-                info:          snd_korg1212_control_volume_info,
-                get:           snd_korg1212_control_volume_get,
-                put:           snd_korg1212_control_volume_put,
-        },
-        {
-                access:                SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_WRITE,
-                iface:          SNDRV_CTL_ELEM_IFACE_PCM,
-                name:          "Monitor Phase",
-                info:          snd_korg1212_control_phase_info,
-                get:           snd_korg1212_control_phase_get,
-                put:           snd_korg1212_control_phase_put,
-        },
-        {
-                access:                SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_WRITE,
-                iface:          SNDRV_CTL_ELEM_IFACE_MIXER,
-                name:          "Monitor Route",
-                info:          snd_korg1212_control_route_info,
-                get:           snd_korg1212_control_route_get,
-                put:           snd_korg1212_control_route_put,
-        },
-        {
-                access:                SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_WRITE,
-                iface:          SNDRV_CTL_ELEM_IFACE_MIXER,
-                name:          "ADC Sensibility",
+                name:          "ADC Attenuation",
                 info:          snd_korg1212_control_analog_info,
                 get:           snd_korg1212_control_analog_get,
                 put:           snd_korg1212_control_analog_put,
@@ -1867,7 +1926,7 @@ static int __init snd_korg1212_create(korg1212_t *korg1212)
         korg1212->rightADCInSens = k1212MaxADCSens;
 
         for (i=0; i<kAudioChannels; i++)
-                korg1212->volumePhase[i] = 1;
+                korg1212->volumePhase[i] = 0;
 
         if ((err = pci_enable_device(pci)) < 0)
                 return err;
@@ -2117,17 +2176,17 @@ snd_korg1212_free(void *private_data)
         }
         if (korg1212->res_iomem != NULL) {
                 release_resource(korg1212->res_iomem);
-                kfree(korg1212->res_iomem);
+                kfree_nocheck(korg1212->res_iomem);
                 korg1212->res_iomem = NULL;
         }
         if (korg1212->res_ioport != NULL) {
                 release_resource(korg1212->res_ioport);
-                kfree(korg1212->res_ioport);
+                kfree_nocheck(korg1212->res_ioport);
                 korg1212->res_ioport = NULL;
         }
         if (korg1212->res_iomem2 != NULL) {
                 release_resource(korg1212->res_iomem2);
-                kfree(korg1212->res_iomem2);
+                kfree_nocheck(korg1212->res_iomem2);
                 korg1212->res_iomem2 = NULL;
         }
 
index 03cd684..c417429 100644 (file)
@@ -35,8 +35,9 @@
 #include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
-#include <linux/reboot.h>
 #include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/vmalloc.h>
 #include <sound/core.h>
 #include <sound/info.h>
 #include <sound/control.h>
@@ -2306,7 +2307,7 @@ static int snd_m3_free(m3_t *chip)
 
        if (chip->iobase_res) {
                release_resource(chip->iobase_res);
-               kfree(chip->iobase_res);
+               kfree_nocheck(chip->iobase_res);
        }
        if (chip->irq >= 0)
                free_irq(chip->irq, (void *)chip);
@@ -2321,12 +2322,12 @@ static int snd_m3_free(m3_t *chip)
  */
 #ifdef CONFIG_PM
 
-static void m3_suspend(m3_t *chip, int can_schedule)
+static void m3_suspend(m3_t *chip)
 {
        snd_card_t *card = chip->card;
        int i, index;
 
-       snd_power_lock(card, can_schedule);
+       snd_power_lock(card);
        if (card->power_state == SNDRV_CTL_POWER_D3hot)
                goto __skip;
 
@@ -2353,12 +2354,12 @@ static void m3_suspend(m3_t *chip, int can_schedule)
        snd_power_unlock(card);
 }
 
-static void m3_resume(m3_t *chip, int can_schedule)
+static void m3_resume(m3_t *chip)
 {
        snd_card_t *card = chip->card;
        int i, index;
 
-       snd_power_lock(card, can_schedule);
+       snd_power_lock(card);
        if (card->power_state == SNDRV_CTL_POWER_D0)
                goto __skip;
 
@@ -2399,25 +2400,25 @@ static void m3_resume(m3_t *chip, int can_schedule)
 static int snd_m3_suspend(struct pci_dev *pci, u32 state)
 {
        m3_t *chip = snd_magic_cast(m3_t, pci_get_drvdata(pci), return -ENXIO);
-       m3_suspend(chip, 0);
+       m3_suspend(chip);
        return 0;
 }
 static int snd_m3_resume(struct pci_dev *pci)
 {
        m3_t *chip = snd_magic_cast(m3_t, pci_get_drvdata(pci), return -ENXIO);
-       m3_resume(chip, 0);
+       m3_resume(chip);
        return 0;
 }
 #else
 static void snd_m3_suspend(struct pci_dev *pci)
 {
        m3_t *chip = snd_magic_cast(m3_t, pci_get_drvdata(pci), return);
-       m3_suspend(chip, 0);
+       m3_suspend(chip);
 }
 static void snd_m3_resume(struct pci_dev *pci)
 {
        m3_t *chip = snd_magic_cast(m3_t, pci_get_drvdata(pci), return);
-       m3_resume(chip, 0);
+       m3_resume(chip);
 }
 #endif
 
@@ -2429,11 +2430,11 @@ static int snd_m3_set_power_state(snd_card_t *card, unsigned int power_state)
        case SNDRV_CTL_POWER_D0:
        case SNDRV_CTL_POWER_D1:
        case SNDRV_CTL_POWER_D2:
-               m3_resume(chip, 1);
+               m3_resume(chip);
                break;
        case SNDRV_CTL_POWER_D3hot:
        case SNDRV_CTL_POWER_D3cold:
-               m3_suspend(chip, 1);
+               m3_suspend(chip);
                break;
        default:
                return -EINVAL;
index fd7b4b2..7deb659 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/info.h>
 #include <sound/control.h>
@@ -1256,11 +1257,11 @@ snd_nm256_peek_for_sig(nm256_t *chip)
  * APM event handler, so the card is properly reinitialized after a power
  * event.
  */
-static void nm256_suspend(nm256_t *chip, int can_schedule)
+static void nm256_suspend(nm256_t *chip)
 {
        snd_card_t *card = chip->card;
 
-       snd_power_lock(card, can_schedule);
+       snd_power_lock(card);
        if (card->power_state == SNDRV_CTL_POWER_D3hot)
                goto __skip;
 
@@ -1271,11 +1272,11 @@ static void nm256_suspend(nm256_t *chip, int can_schedule)
        snd_power_unlock(card);
 }
 
-static void nm256_resume(nm256_t *chip, int can_schedule)
+static void nm256_resume(nm256_t *chip)
 {
        snd_card_t *card = chip->card;
 
-       snd_power_lock(card, can_schedule);
+       snd_power_lock(card);
        if (card->power_state == SNDRV_CTL_POWER_D0)
                goto __skip;
 
@@ -1295,25 +1296,25 @@ static void nm256_resume(nm256_t *chip, int can_schedule)
 static int snd_nm256_suspend(struct pci_dev *dev, u32 state)
 {
        nm256_t *chip = snd_magic_cast(nm256_t, pci_get_drvdata(dev), return -ENXIO);
-       nm256_suspend(chip, 0);
+       nm256_suspend(chip);
        return 0;
 }
 static int snd_nm256_resume(struct pci_dev *dev)
 {
        nm256_t *chip = snd_magic_cast(nm256_t, pci_get_drvdata(dev), return -ENXIO);
-       nm256_resume(chip, 0);
+       nm256_resume(chip);
        return 0;
 }
 #else
 static void snd_nm256_suspend(struct pci_dev *dev)
 {
        nm256_t *chip = snd_magic_cast(nm256_t, pci_get_drvdata(dev), return);
-       nm256_suspend(chip, 0);
+       nm256_suspend(chip);
 }
 static void snd_nm256_resume(struct pci_dev *dev)
 {
        nm256_t *chip = snd_magic_cast(nm256_t, pci_get_drvdata(dev), return);
-       nm256_resume(chip, 0);
+       nm256_resume(chip);
 }
 #endif
 
@@ -1325,11 +1326,11 @@ static int snd_nm256_set_power_state(snd_card_t *card, unsigned int power_state)
        case SNDRV_CTL_POWER_D0:
        case SNDRV_CTL_POWER_D1:
        case SNDRV_CTL_POWER_D2:
-               nm256_resume(chip, 1);
+               nm256_resume(chip);
                break;
        case SNDRV_CTL_POWER_D3hot:
        case SNDRV_CTL_POWER_D3cold:
-               nm256_suspend(chip, 1);
+               nm256_suspend(chip);
                break;
        default:
                return -EINVAL;
@@ -1354,11 +1355,11 @@ static int snd_nm256_free(nm256_t *chip)
                iounmap((void *) chip->buffer);
        if (chip->res_cport) {
                release_resource(chip->res_cport);
-               kfree(chip->res_cport);
+               kfree_nocheck(chip->res_cport);
        }
        if (chip->res_buffer) {
                release_resource(chip->res_buffer);
-               kfree(chip->res_buffer);
+               kfree_nocheck(chip->res_buffer);
        }
        if (chip->irq >= 0)
                free_irq(chip->irq, (void*)chip);
index cfb10c4..31446b1 100644 (file)
@@ -27,6 +27,7 @@
 #include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/info.h>
 #include <sound/control.h>
@@ -835,8 +836,8 @@ snd_rme96_setinputtype(rme96_t *rme96,
                        RME96_WCR_INP_1;
                break;
        case RME96_INPUT_XLR:
-               if (rme96->pci->device != PCI_DEVICE_ID_DIGI96_8_PAD_OR_PST ||
-                   rme96->pci->device != PCI_DEVICE_ID_DIGI96_8_PRO ||
+               if ((rme96->pci->device != PCI_DEVICE_ID_DIGI96_8_PAD_OR_PST &&
+                    rme96->pci->device != PCI_DEVICE_ID_DIGI96_8_PRO) ||
                    (rme96->pci->device == PCI_DEVICE_ID_DIGI96_8_PAD_OR_PST &&
                     rme96->rev > 4))
                {
@@ -1561,7 +1562,7 @@ snd_rme96_free(void *private_data)
        }
        if (rme96->res_port != NULL) {
                release_resource(rme96->res_port);
-               kfree(rme96->res_port);
+               kfree_nocheck(rme96->res_port);
                rme96->res_port = NULL;
        }
 }
index 8c14245..9d8d1ab 100644 (file)
@@ -24,6 +24,7 @@
 #include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/pcm.h>
@@ -49,7 +50,7 @@ MODULE_PARM_DESC(snd_enable, "Enable/disable specific RME96{52,36} soundcards.")
 MODULE_PARM_SYNTAX(snd_enable, SNDRV_ENABLE_DESC);
 MODULE_PARM(snd_precise_ptr, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
 MODULE_PARM_DESC(snd_precise_ptr, "Enable precise pointer (doesn't work reliably).");
-MODULE_PARM_SYNTAX(snd_precise_ptr, SNDRV_BOOLEAN_FALSE_DESC);
+MODULE_PARM_SYNTAX(snd_precise_ptr, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
 MODULE_AUTHOR("Paul Davis <pbd@op.net>, Winfried Ritsch");
 MODULE_DESCRIPTION("RME Digi9652/Digi9636");
 MODULE_LICENSE("GPL");
@@ -1849,7 +1850,7 @@ static int snd_rme9652_free(rme9652_t *rme9652)
                iounmap((void *) rme9652->iobase);
        if (rme9652->res_port) {
                release_resource(rme9652->res_port);
-               kfree(rme9652->res_port);
+               kfree_nocheck(rme9652->res_port);
        }
        if (rme9652->irq >= 0)
                free_irq(rme9652->irq, (void *)rme9652);
@@ -1911,8 +1912,13 @@ static int __init snd_rme9652_initialize_memory(rme9652_t *rme9652)
        rme9652_write(rme9652, RME9652_rec_buffer, cb_bus);
        rme9652_write(rme9652, RME9652_play_buffer, pb_bus);
 
+#if 0 // not all architectures have this macro
        rme9652->capture_buffer = bus_to_virt(cb_bus);
        rme9652->playback_buffer = bus_to_virt(pb_bus);
+#else
+       rme9652->capture_buffer += cb_bus - cb_addr;
+       rme9652->playback_buffer += pb_bus - pb_addr;
+#endif
 
        return 0;
 }
index 3caed22..a3316e7 100644 (file)
@@ -26,6 +26,7 @@
 #include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/info.h>
@@ -1214,27 +1215,27 @@ static int snd_sonicvibes_free(sonicvibes_t *sonic)
        pci_write_config_dword(sonic->pci, 0x48, sonic->dmac_port);
        if (sonic->res_sb_port) {
                release_resource(sonic->res_sb_port);
-               kfree(sonic->res_sb_port);
+               kfree_nocheck(sonic->res_sb_port);
        }
        if (sonic->res_enh_port) {
                release_resource(sonic->res_enh_port);
-               kfree(sonic->res_enh_port);
+               kfree_nocheck(sonic->res_enh_port);
        }
        if (sonic->res_synth_port) {
                release_resource(sonic->res_synth_port);
-               kfree(sonic->res_synth_port);
+               kfree_nocheck(sonic->res_synth_port);
        }
        if (sonic->res_midi_port) {
                release_resource(sonic->res_midi_port);
-               kfree(sonic->res_midi_port);
+               kfree_nocheck(sonic->res_midi_port);
        }
        if (sonic->res_dmaa) {
                release_resource(sonic->res_dmaa);
-               kfree(sonic->res_dmaa);
+               kfree_nocheck(sonic->res_dmaa);
        }
        if (sonic->res_dmac) {
                release_resource(sonic->res_dmac);
-               kfree(sonic->res_dmac);
+               kfree_nocheck(sonic->res_dmac);
        }
        if (sonic->irq >= 0)
                free_irq(sonic->irq, (void *)sonic);
index 6ffd36f..a352379 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/trident.h>
 #define SNDRV_GET_ID
@@ -182,25 +183,25 @@ static void __devexit snd_trident_remove(struct pci_dev *pci)
 static int snd_card_trident_suspend(struct pci_dev *pci, u32 state)
 {
        trident_t *chip = snd_magic_cast(trident_t, pci_get_drvdata(pci), return -ENXIO);
-       snd_trident_suspend(chip, 0);
+       snd_trident_suspend(chip);
        return 0;
 }
 static int snd_card_trident_resume(struct pci_dev *pci)
 {
        trident_t *chip = snd_magic_cast(trident_t, pci_get_drvdata(pci), return -ENXIO);
-       snd_trident_resume(chip, 0);
+       snd_trident_resume(chip);
        return 0;
 }
 #else
 static void snd_card_trident_suspend(struct pci_dev *pci)
 {
        trident_t *chip = snd_magic_cast(trident_t, pci_get_drvdata(pci), return);
-       snd_trident_suspend(chip, 0);
+       snd_trident_suspend(chip);
 }
 static void snd_card_trident_resume(struct pci_dev *pci)
 {
        trident_t *chip = snd_magic_cast(trident_t, pci_get_drvdata(pci), return);
-       snd_trident_resume(chip, 0);
+       snd_trident_resume(chip);
 }
 #endif
 #endif
index f7f89b4..afeeeb1 100644 (file)
@@ -30,6 +30,8 @@
 #include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/vmalloc.h>
 #include <sound/core.h>
 #include <sound/info.h>
 #include <sound/control.h>
@@ -3336,7 +3338,7 @@ int snd_trident_free(trident_t *trident)
                free_irq(trident->irq, (void *)trident);
        if (trident->res_port) {
                release_resource(trident->res_port);
-               kfree(trident->res_port);
+               kfree_nocheck(trident->res_port);
        }
        snd_magic_kfree(trident);
        return 0;
@@ -3556,11 +3558,11 @@ void snd_trident_clear_voices(trident_t * trident, unsigned short v_min, unsigne
 
 #ifdef CONFIG_PM
 
-void snd_trident_suspend(trident_t *trident, int can_schedule)
+void snd_trident_suspend(trident_t *trident)
 {
        snd_card_t *card = trident->card;
 
-       snd_power_lock(card, can_schedule);
+       snd_power_lock(card);
        if (card->power_state == SNDRV_CTL_POWER_D3hot)
                goto __skip;
        snd_pcm_suspend_all(trident->pcm);
@@ -3580,11 +3582,11 @@ void snd_trident_suspend(trident_t *trident, int can_schedule)
        snd_power_unlock(card);
 }
 
-void snd_trident_resume(trident_t *trident, int can_schedule)
+void snd_trident_resume(trident_t *trident)
 {
        snd_card_t *card = trident->card;
 
-       snd_power_lock(card, can_schedule);
+       snd_power_lock(card);
        if (card->power_state == SNDRV_CTL_POWER_D0)
                goto __skip;
        switch (trident->device) {
@@ -3607,11 +3609,11 @@ static int snd_trident_set_power_state(snd_card_t *card, unsigned int power_stat
         case SNDRV_CTL_POWER_D0:
         case SNDRV_CTL_POWER_D1:
         case SNDRV_CTL_POWER_D2:
-               snd_trident_resume(chip, 1);
+               snd_trident_resume(chip);
                 break;
        case SNDRV_CTL_POWER_D3hot:
         case SNDRV_CTL_POWER_D3cold:
-               snd_trident_suspend(chip, 1);
+               snd_trident_suspend(chip);
                break;
         default:
                return -EINVAL;
index c2b8404..8aeea0a 100644 (file)
@@ -26,6 +26,7 @@
 #define __NO_VERSION__
 #include <sound/driver.h>
 #include <asm/io.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/trident.h>
 
@@ -64,6 +65,7 @@
 #define get_aligned_page(offset)       ((offset) >> 13)
 #define aligned_page_offset(page)      ((page) << 13)
 #define page_to_ptr(trident,page)      __tlb_to_ptr(trident, (page) << 1)
+#define page_to_addr(trident,page)     __tlb_to_addr(trident, (page) << 1)
 
 /* fill TLB entries -- we need to fill two entries */
 static inline void set_tlb_bus(trident_t *trident, int page, unsigned long ptr, dma_addr_t addr)
index a9e5a64..4c3d353 100644 (file)
@@ -22,6 +22,7 @@
 #include <sound/driver.h>
 #include <asm/io.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/trident.h>
 #include <sound/seq_device.h>
index 9b4e50e..9378a6a 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/info.h>
@@ -44,7 +45,6 @@ static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;        /* Index 0-MAX */
 static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;  /* ID for this card */
 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
 static long snd_mpu_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -1};
-static int snd_joystick[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -1};
 static int snd_ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 48000};
 
 MODULE_PARM(snd_index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
@@ -62,9 +62,6 @@ MODULE_PARM_SYNTAX(snd_mpu_port, SNDRV_PORT_DESC);
 MODULE_PARM(snd_ac97_clock, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
 MODULE_PARM_DESC(snd_ac97_clock, "AC'97 codec clock (default 48000Hz).");
 MODULE_PARM_SYNTAX(snd_ac97_clock, SNDRV_ENABLED ",default:48000");
-MODULE_PARM(snd_joystick, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
-MODULE_PARM_DESC(snd_joystick, "Joystick support.");
-MODULE_PARM_SYNTAX(snd_joystick, SNDRV_ENABLED "," SNDRV_ENABLE_DESC);
 
 /*
  *  Direct registers
@@ -823,6 +820,53 @@ static int __devinit snd_via686a_mixer(via686a_t *chip)
 }
 
 /*
+ * joystick
+ */
+
+static int snd_via686a_joystick_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
+{
+       uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
+       uinfo->count = 1;
+       uinfo->value.integer.min = 0;
+       uinfo->value.integer.max = 1;
+       return 0;
+}
+
+static int snd_via686a_joystick_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+{
+       via686a_t *chip = snd_kcontrol_chip(kcontrol);
+       u16 val;
+
+       pci_read_config_word(chip->pci, 0x42, &val);
+       ucontrol->value.integer.value[0] = (val & 0x08) ? 1 : 0;
+       return 0;
+}
+
+static int snd_via686a_joystick_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+{
+       via686a_t *chip = snd_kcontrol_chip(kcontrol);
+       u16 val, oval;
+
+       pci_read_config_word(chip->pci, 0x42, &oval);
+       val = oval & ~0x08;
+       if (ucontrol->value.integer.value[0])
+               val |= 0x08;
+       if (val != oval) {
+               pci_write_config_word(chip->pci, 0x42, val);
+               return 1;
+       }
+       return 0;
+}
+
+static snd_kcontrol_new_t snd_via686a_joystick_control __devinitdata = {
+       name: "Joystick",
+       iface: SNDRV_CTL_ELEM_IFACE_CARD,
+       info: snd_via686a_joystick_info,
+       get: snd_via686a_joystick_get,
+       put: snd_via686a_joystick_put,
+};
+
+/*
  *
  */
 
@@ -947,7 +991,7 @@ static int snd_via686a_free(via686a_t *chip)
                snd_free_pci_pages(chip->pci, 3 * sizeof(unsigned int) * VIA_MAX_FRAGS * 2, chip->tables, chip->tables_addr);
        if (chip->res_port) {
                release_resource(chip->res_port);
-               kfree(chip->res_port);
+               kfree_nocheck(chip->res_port);
        }
        if (chip->irq >= 0)
                free_irq(chip->irq, (void *)chip);
@@ -1094,8 +1138,9 @@ static int __devinit snd_via686a_probe(struct pci_dev *pci,
 #endif
 
        legacy |= 0x40;         /* disable MIDI */
+       legacy &= ~0x08;        /* disable joystick */
        if (chip->revision >= 0x20) {
-               if (snd_joystick[dev] > 0 || check_region(pci_resource_start(pci, 2), 4)) {
+               if (check_region(pci_resource_start(pci, 2), 4)) {
                        rev_h = 0;
                        legacy &= ~0x80;        /* disable PCI I/O 2 */
                } else {
@@ -1105,9 +1150,6 @@ static int __devinit snd_via686a_probe(struct pci_dev *pci,
        }
        pci_write_config_byte(pci, 0x42, legacy);
        pci_write_config_byte(pci, 0x43, legacy_cfg);
-       if (snd_joystick[dev] > 0) {
-               legacy |= 8;
-       }
        if (rev_h && snd_mpu_port[dev] >= 0x200) {      /* force MIDI */
                legacy |= 0x02; /* enable MPU */
                pci_write_config_dword(pci, 0x18, (snd_mpu_port[dev] & 0xfffc) | 0x01);
@@ -1156,6 +1198,13 @@ static int __devinit snd_via686a_probe(struct pci_dev *pci,
                ;
        }
        
+       /* card switches */
+       err = snd_ctl_add(card, snd_ctl_new1(&snd_via686a_joystick_control, chip));
+       if (err < 0) {
+               snd_card_free(card);
+               return err;
+       }
+
        strcpy(card->driver, "VIA686A");
        strcpy(card->shortname, "VIA 82C686A/B");
        
@@ -1208,7 +1257,7 @@ module_exit(alsa_card_via686a_exit)
 #ifndef MODULE
 
 /* format is: snd-via686a=snd_enable,snd_index,snd_id,
-                         snd_mpu_port,snd_joystick,snd_ac97_clock */
+                         snd_mpu_port,snd_ac97_clock */
 
 static int __init alsa_card_via686a_setup(char *str)
 {
@@ -1220,7 +1269,6 @@ static int __init alsa_card_via686a_setup(char *str)
               get_option(&str,&snd_index[nr_dev]) == 2 &&
               get_id(&str,&snd_id[nr_dev]) == 2 &&
               get_option(&str,(int *)&snd_mpu_port[nr_dev]) == 2 &&
-              get_option(&str,&snd_joystick[nr_dev]) == 2 &&
               get_option(&str,&snd_ac97_clock[nr_dev]) == 2);
        nr_dev++;
        return 1;
index ecfbe55..7ee583a 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/info.h>
@@ -713,7 +714,7 @@ static int snd_via8233_free(via8233_t *chip)
                                   chip->tables_addr);
        if (chip->res_port) {
                release_resource(chip->res_port);
-               kfree(chip->res_port);
+               kfree_nocheck(chip->res_port);
        }
        if (chip->irq >= 0)
                free_irq(chip->irq, (void *)chip);
index 391fa63..66c2059 100644 (file)
@@ -20,8 +20,8 @@
  */
 
 #include <sound/driver.h>
-#include <linux/reboot.h>
 #include <linux/init.h>
+#include <linux/time.h>
 #include <sound/core.h>
 #include <sound/ymfpci.h>
 #include <sound/mpu401.h>
@@ -47,7 +47,6 @@ static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
 static long snd_fm_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -1};
 static long snd_mpu_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -1};
-static long snd_joystick_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -1 };
 
 MODULE_PARM(snd_index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
 MODULE_PARM_DESC(snd_index, "Index value for the Yamaha DS-XG PCI soundcard.");
@@ -64,9 +63,6 @@ MODULE_PARM_SYNTAX(snd_mpu_port, SNDRV_ENABLED);
 MODULE_PARM(snd_fm_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
 MODULE_PARM_DESC(snd_fm_port, "FM OPL-3 Port.");
 MODULE_PARM_SYNTAX(snd_fm_port, SNDRV_ENABLED);
-MODULE_PARM(snd_joystick_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
-MODULE_PARM_DESC(snd_joystick_port, "Joystick Port.");
-MODULE_PARM_SYNTAX(snd_joystick_port, SNDRV_ENABLED);
 
 static struct pci_device_id snd_ymfpci_ids[] __devinitdata = {
         { 0x1073, 0x0004, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, },   /* YMF724 */
@@ -133,15 +129,6 @@ static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci,
                        pci_write_config_word(pci, PCIR_DSXG_MPU401BASE, snd_mpu_port[dev]);
                        snd_printd("MPU401 supported on 0x%lx\n", snd_mpu_port[dev]);
                }
-               if (snd_joystick_port[dev] < 0)
-                       snd_joystick_port[dev] = pci_resource_start(pci, 2);
-               else if (check_region(snd_joystick_port[dev], 4))
-                       snd_joystick_port[dev] = -1;
-               if (snd_joystick_port[dev] >= 0) {
-                       snd_printd("joystick supported on 0x%lx\n", snd_joystick_port[dev]);
-                       legacy_ctrl |= 4;
-                       pci_write_config_word(pci, PCIR_DSXG_JOYBASE, snd_joystick_port[dev]);
-               }
        } else {
                switch (snd_fm_port[dev]) {
                case 0x388: legacy_ctrl2 |= 0; break;
@@ -170,29 +157,15 @@ static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci,
                        legacy_ctrl2 &= ~(3 << 4);
                        snd_mpu_port[dev] = -1;
                }
-               switch (snd_joystick_port[dev]) {
-               case 0x201: legacy_ctrl2 |= 0 << 6; break;
-               case 0x202: legacy_ctrl2 |= 1 << 6; break;
-               case 0x204: legacy_ctrl2 |= 2 << 6; break;
-               case 0x205: legacy_ctrl2 |= 3 << 6; break;
-               default: snd_joystick_port[dev] = -1; break;
-               }
-               if (snd_joystick_port[dev] > 0 && check_region(snd_joystick_port[dev], 2) == 0) {
-                       legacy_ctrl |= 4;
-                       snd_printd("joystick supported on 0x%lx\n", snd_joystick_port[dev]);
-               } else {
-                       legacy_ctrl2 &= ~(3 << 6);
-                       snd_joystick_port[dev] = -1;
-               }
        }
        if (snd_mpu_port[dev] > 0) {
                legacy_ctrl |= 0x10; /* MPU401 irq enable */
                legacy_ctrl2 |= 1 << 15; /* IMOD */
        }
        pci_read_config_word(pci, PCIR_DSXG_LEGACY, &old_legacy_ctrl);
-       snd_printdd("legacy_ctrl = 0x%x\n", legacy_ctrl);
+       //snd_printdd("legacy_ctrl = 0x%x\n", legacy_ctrl);
        pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl);
-       snd_printdd("legacy_ctrl2 = 0x%x\n", legacy_ctrl2);
+       //snd_printdd("legacy_ctrl2 = 0x%x\n", legacy_ctrl2);
        pci_write_config_word(pci, PCIR_DSXG_ELEGACY, legacy_ctrl2);
        if ((err = snd_ymfpci_create(card, pci,
                                     old_legacy_ctrl,
@@ -224,8 +197,10 @@ static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci,
                if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_YMFPCI,
                                               snd_mpu_port[dev], 0,
                                               pci->irq, 0, &chip->rawmidi)) < 0) {
-                       snd_card_free(card);
-                       return err;
+                       printk(KERN_INFO "ymfpci: cannot initialize MPU401 at 0x%lx, skipping...\n", snd_mpu_port[dev]);
+               } else {
+                       legacy_ctrl &= ~0x10; /* disable MPU401 irq */
+                       pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl);
                }
        }
        if (snd_fm_port[dev] > 0) {
@@ -233,13 +208,15 @@ static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci,
                                           snd_fm_port[dev],
                                           snd_fm_port[dev] + 2,
                                           OPL3_HW_OPL3, 0, &opl3)) < 0) {
+                       printk(KERN_INFO "ymfpci: cannot initialize FM OPL3 at 0x%lx, skipping...\n", snd_fm_port[dev]);
+               } else if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
                        snd_card_free(card);
+                       snd_printk("cannot create opl3 hwdep\n");
                        return err;
                }
-               if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
-                       snd_card_free(card);
-                       return err;
-               }
+       }
+       if ((err = snd_ymfpci_joystick(chip)) < 0) {
+               printk(KERN_INFO "ymfpci: cannot initialize joystick, skipping...\n");
        }
        strcpy(card->driver, str);
        sprintf(card->shortname, "Yamaha DS-XG PCI (%s)", str);
@@ -262,25 +239,25 @@ static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci,
 static int snd_card_ymfpci_suspend(struct pci_dev *pci, u32 state)
 {
        ymfpci_t *chip = snd_magic_cast(ymfpci_t, pci_get_drvdata(pci), return -ENXIO);
-       snd_ymfpci_suspend(chip, 0);
+       snd_ymfpci_suspend(chip);
        return 0;
 }
 static int snd_card_ymfpci_resume(struct pci_dev *pci)
 {
        ymfpci_t *chip = snd_magic_cast(ymfpci_t, pci_get_drvdata(pci), return -ENXIO);
-       snd_ymfpci_resume(chip, 0);
+       snd_ymfpci_resume(chip);
        return 0;
 }
 #else
 static void snd_card_ymfpci_suspend(struct pci_dev *pci)
 {
        ymfpci_t *chip = snd_magic_cast(ymfpci_t, pci_get_drvdata(pci), return);
-       snd_ymfpci_suspend(chip, 0);
+       snd_ymfpci_suspend(chip);
 }
 static void snd_card_ymfpci_resume(struct pci_dev *pci)
 {
        ymfpci_t *chip = snd_magic_cast(ymfpci_t, pci_get_drvdata(pci), return);
-       snd_ymfpci_resume(chip, 0);
+       snd_ymfpci_resume(chip);
 }
 #endif
 #endif
index 7b2c5dd..4c6dd27 100644 (file)
@@ -29,6 +29,7 @@
 #include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/info.h>
@@ -1508,6 +1509,124 @@ int __devinit snd_ymfpci_mixer(ymfpci_t *chip)
        return 0;
 }
 
+
+/*
+ * joystick support
+ */
+
+static int ymfpci_joystick_ports[4] = {
+       0x201, 0x202, 0x204, 0x205
+};
+
+static void setup_joystick_base(ymfpci_t *chip)
+{
+       if (chip->pci->device >= 0x0010) /* YMF 744/754 */
+               pci_write_config_word(chip->pci, PCIR_DSXG_JOYBASE,
+                                     ymfpci_joystick_ports[chip->joystick_port]);
+       else {
+               u16 legacy_ctrl2;
+               pci_read_config_word(chip->pci, PCIR_DSXG_ELEGACY, &legacy_ctrl2);
+               legacy_ctrl2 &= ~(3 << 6);
+               legacy_ctrl2 |= chip->joystick_port << 6;
+               pci_write_config_word(chip->pci, PCIR_DSXG_ELEGACY, legacy_ctrl2);
+       }
+}
+
+static int snd_ymfpci_joystick_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
+{
+       uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
+       uinfo->count = 1;
+       uinfo->value.integer.min = 0;
+       uinfo->value.integer.max = 1;
+       return 0;
+}
+
+static int snd_ymfpci_joystick_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+{
+       ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
+       u16 val;
+
+       pci_read_config_word(chip->pci, PCIR_DSXG_LEGACY, &val);
+       ucontrol->value.integer.value[0] = (val & 0x04) ? 1 : 0;
+       return 0;
+}
+
+static int snd_ymfpci_joystick_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+{
+       ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
+       u16 val, oval;
+
+       pci_read_config_word(chip->pci, PCIR_DSXG_LEGACY, &oval);
+       val = oval & ~0x04;
+       if (ucontrol->value.integer.value[0])
+               val |= 0x04;
+       if (val != oval) {
+               setup_joystick_base(chip);
+               pci_write_config_word(chip->pci, PCIR_DSXG_LEGACY, val);
+               return 1;
+       }
+       return 0;
+}
+
+static int snd_ymfpci_joystick_addr_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
+{
+        uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
+        uinfo->count = 1;
+        uinfo->value.enumerated.items = 4;
+       if (uinfo->value.enumerated.item >= 4)
+               uinfo->value.enumerated.item = 3;
+       sprintf(uinfo->value.enumerated.name, "port 0x%x", ymfpci_joystick_ports[uinfo->value.enumerated.item]);
+        return 0;
+}
+
+static int snd_ymfpci_joystick_addr_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+{
+       ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
+       ucontrol->value.integer.value[0] = chip->joystick_port;
+       return 0;
+}
+
+static int snd_ymfpci_joystick_addr_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+{
+       ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
+       if (ucontrol->value.integer.value[0] != chip->joystick_port) {
+               snd_assert(ucontrol->value.integer.value[0] >= 0 && ucontrol->value.integer.value[0] < 4, return -EINVAL);
+               chip->joystick_port = ucontrol->value.integer.value[0];
+               setup_joystick_base(chip);
+               return 1;
+       }
+       return 0;
+}
+
+static snd_kcontrol_new_t snd_ymfpci_control_joystick __devinitdata = {
+       name: "Joystick",
+       iface: SNDRV_CTL_ELEM_IFACE_CARD,
+       info: snd_ymfpci_joystick_info,
+       get: snd_ymfpci_joystick_get,
+       put: snd_ymfpci_joystick_put,
+};
+
+static snd_kcontrol_new_t snd_ymfpci_control_joystick_addr __devinitdata = {
+       name: "Joystick Address",
+       iface: SNDRV_CTL_ELEM_IFACE_CARD,
+       info: snd_ymfpci_joystick_addr_info,
+       get: snd_ymfpci_joystick_addr_get,
+       put: snd_ymfpci_joystick_addr_put,
+};
+
+int __devinit snd_ymfpci_joystick(ymfpci_t *chip)
+{
+       int err;
+
+       chip->joystick_port = 0; /* default */
+       if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_ymfpci_control_joystick, chip))) < 0)
+               return err;
+       if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_ymfpci_control_joystick_addr, chip))) < 0)
+               return err;
+       return 0;
+}
+
+
 /*
  *  proc interface
  */
@@ -1765,7 +1884,7 @@ static int snd_ymfpci_free(ymfpci_t *chip)
                free_irq(chip->irq, (void *)chip);
        if (chip->res_reg_area) {
                release_resource(chip->res_reg_area);
-               kfree(chip->res_reg_area);
+               kfree_nocheck(chip->res_reg_area);
        }
 
        pci_write_config_word(chip->pci, 0x40, chip->old_legacy_ctrl);
@@ -1809,12 +1928,12 @@ static int saved_regs_index[] = {
 };
 #define YDSXGR_NUM_SAVED_REGS  (sizeof(saved_regs_index)/sizeof(saved_regs_index[0]))
 
-void snd_ymfpci_suspend(ymfpci_t *chip, int can_schedule)
+void snd_ymfpci_suspend(ymfpci_t *chip)
 {
        snd_card_t *card = chip->card;
        int i;
        
-       snd_power_lock(card, can_schedule);
+       snd_power_lock(card);
        if (card->power_state == SNDRV_CTL_POWER_D3hot)
                goto __skip;
        snd_pcm_suspend_all(chip->pcm);
@@ -1831,12 +1950,12 @@ void snd_ymfpci_suspend(ymfpci_t *chip, int can_schedule)
        snd_power_unlock(card);
 }
 
-void snd_ymfpci_resume(ymfpci_t *chip, int can_schedule)
+void snd_ymfpci_resume(ymfpci_t *chip)
 {
        snd_card_t *card = chip->card;
        int i;
 
-       snd_power_lock(card, can_schedule);
+       snd_power_lock(card);
 
        if (card->power_state == SNDRV_CTL_POWER_D0)
                goto __skip;
@@ -1873,11 +1992,11 @@ static int snd_ymfpci_set_power_state(snd_card_t *card, unsigned int power_state
        case SNDRV_CTL_POWER_D0:
        case SNDRV_CTL_POWER_D1:
        case SNDRV_CTL_POWER_D2:
-               snd_ymfpci_resume(chip, 1);
+               snd_ymfpci_resume(chip);
                break;
        case SNDRV_CTL_POWER_D3hot:
        case SNDRV_CTL_POWER_D3cold:
-               snd_ymfpci_suspend(chip, 1);
+               snd_ymfpci_suspend(chip);
                break;
        default:
                return -EINVAL;
index e90ff1c..0a9cb4e 100644 (file)
@@ -1,3 +1,8 @@
 # ALSA PowerMac drivers
 
+mainmenu_option next_comment
+comment 'ALSA PowerMac devices'
+
 dep_tristate 'PowerMac (AWACS, DACA, Burgundy, Tumbler, Keywest)' CONFIG_SND_POWERMAC $CONFIG_SND
+
+endmenu
index 61ef392..b2a0389 100644 (file)
@@ -357,9 +357,11 @@ snd_pmac_awacs_init(pmac_t *chip)
                snd_pmac_awacs_write_reg(chip, 7, 0);
        }
 
+#ifdef CONFIG_PMAC_PBOOK
        /* Recalibrate chip */
        if (chip->model == PMAC_SCREAMER)
                screamer_recalibrate(chip);
+#endif
 
        if (chip->model <= PMAC_SCREAMER && chip->revision == 0) {
                chip->revision =
index c4a7a4a..36ca68f 100644 (file)
@@ -24,6 +24,7 @@
 #include <sound/driver.h>
 #include <asm/io.h>
 #include <linux/init.h>
+#include <linux/delay.h>
 #include <sound/core.h>
 #include "pmac.h"
 #include <sound/pcm_params.h>
index 541b09e..68b9283 100644 (file)
@@ -22,6 +22,7 @@
 #define __NO_VERSION__
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/delay.h>
 #include <sound/core.h>
 #include "pmac.h"
 
index ba69e8f..0189daf 100644 (file)
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
+#include <sound/driver.h>
+#include <linux/wait.h>
+#include <linux/sched.h>
+#include <linux/slab.h>
+#include <sound/core.h>
 #include <sound/emux_synth.h>
 #include <linux/init.h>
 #include "emux_voice.h"
index 769d2dd..deceab6 100644 (file)
@@ -24,6 +24,7 @@
 
 #define __NO_VERSION__
 #include "emux_voice.h"
+#include <linux/slab.h>
 
 #ifdef SNDRV_EMUX_USE_RAW_EFFECT
 /*
index 5578a53..7b8576d 100644 (file)
  */
 
 #define __NO_VERSION__
+#include <sound/driver.h>
+#include <linux/wait.h>
+#include <linux/sched.h>
+#include <linux/slab.h>
+#include <sound/core.h>
 #include <sound/emux_synth.h>
 #include <sound/info.h>
 #include "emux_voice.h"
index 3ba03d0..df2b772 100644 (file)
@@ -21,6 +21,7 @@
 
 #define __NO_VERSION__
 #include "emux_voice.h"
+#include <linux/slab.h>
 
 
 /* Prototypes for static functions */
index cf2f34a..7c4a972 100644 (file)
@@ -540,11 +540,13 @@ update_voice(snd_emux_t *emu, snd_emux_voice_t *vp, int update)
 }
 
 
+#if 0 // not used
 /* table for volume target calculation */
 static unsigned short voltarget[16] = { 
        0xEAC0, 0xE0C8, 0xD740, 0xCE20, 0xC560, 0xBD08, 0xB500, 0xAD58,
        0xA5F8, 0x9EF0, 0x9830, 0x91C0, 0x8B90, 0x85A8, 0x8000, 0x7A90
 };
+#endif
 
 #define LO_BYTE(v)     ((v) & 0xff)
 #define HI_BYTE(v)     (((v) >> 8) & 0xff)
index cf81f6d..5876a83 100644 (file)
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
+#include <sound/driver.h>
+#include <linux/wait.h>
+#include <linux/sched.h>
+#include <sound/core.h>
 #include <sound/emux_synth.h>
 
 /* Prototypes for emux_seq.c */
index 896b756..1018b03 100644 (file)
@@ -28,6 +28,7 @@
 #define __NO_VERSION__
 #include <sound/driver.h>
 #include <asm/uaccess.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/soundfont.h>
 
index 39cb093..00679af 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/util_mem.h>