]> git.hungrycats.org Git - linux/commitdiff
ALSA update
authorJaroslav Kysela <perex@suse.cz>
Sat, 8 Feb 2003 22:11:54 +0000 (23:11 +0100)
committerJaroslav Kysela <perex@suse.cz>
Sat, 8 Feb 2003 22:11:54 +0000 (23:11 +0100)
  - cmipci driver cleanups (ac3 & surround)
  - replaced snd_dma_residue() with snd_dma_pointer()
  - GCC 3.3 warnings removal
  - timer interface
    - recoded using tasklet
    - improved slave timer locking (should be much faster)
    - added async support
  - improved ioctl32 wrapper functions
  - fixed Makefile problems (synth modules were build for not selected driver)
  - AC97 codec
    - improved SPSA control
    - moved reset function outside the main init code
    - improved ALC650 initialization
  - USB driver
    - added quirk for Roland XV-2020

122 files changed:
Documentation/sound/alsa/ALSA-Configuration.txt
Documentation/sound/alsa/CMIPCI.txt
include/sound/core.h
include/sound/cs46xx_dsp_scb_types.h
include/sound/cs46xx_dsp_spos.h
include/sound/mixer_oss.h
include/sound/pcm_params.h
include/sound/seq_kernel.h
include/sound/sndmagic.h
include/sound/timer.h
include/sound/version.h
sound/core/device.c
sound/core/hwdep.c
sound/core/info.c
sound/core/init.c
sound/core/ioctl32/ioctl32.c
sound/core/ioctl32/ioctl32.h
sound/core/ioctl32/pcm32.c
sound/core/ioctl32/rawmidi32.c
sound/core/ioctl32/seq32.c
sound/core/ioctl32/timer32.c
sound/core/isadma.c
sound/core/oss/mixer_oss.c
sound/core/oss/pcm_oss.c
sound/core/oss/pcm_plugin.c
sound/core/pcm.c
sound/core/pcm_lib.c
sound/core/pcm_memory.c
sound/core/pcm_native.c
sound/core/pcm_sgbuf.c
sound/core/rawmidi.c
sound/core/rtctimer.c
sound/core/seq/Makefile
sound/core/seq/instr/Makefile
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/seq_clientmgr.c
sound/core/seq/seq_device.c
sound/core/seq/seq_instr.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_queue.c
sound/core/seq/seq_queue.h
sound/core/seq/seq_timer.c
sound/core/seq/seq_timer.h
sound/core/sound.c
sound/core/timer.c
sound/drivers/dummy.c
sound/drivers/mtpav.c
sound/drivers/opl3/opl3_oss.c
sound/drivers/opl3/opl3_seq.c
sound/i2c/cs8427.c
sound/i2c/tea6330t.c
sound/isa/ad1816a/ad1816a_lib.c
sound/isa/ad1848/ad1848_lib.c
sound/isa/cmi8330.c
sound/isa/cs423x/cs4231_lib.c
sound/isa/cs423x/cs4236.c
sound/isa/cs423x/cs4236_lib.c
sound/isa/es1688/es1688_lib.c
sound/isa/es18xx.c
sound/isa/gus/Makefile
sound/isa/gus/gus_mem.c
sound/isa/gus/gus_mixer.c
sound/isa/gus/gus_pcm.c
sound/isa/gus/gus_synth.c
sound/isa/gus/interwave.c
sound/isa/opti9xx/opti92x-ad1848.c
sound/isa/sb/Makefile
sound/isa/sb/emu8000.c
sound/isa/sb/emu8000_pcm.c
sound/isa/sb/sb16_main.c
sound/isa/sb/sb8_main.c
sound/isa/sgalaxy.c
sound/isa/wavefront/wavefront_fx.c
sound/isa/wavefront/wavefront_synth.c
sound/pci/ac97/ac97_codec.c
sound/pci/ac97/ac97_patch.c
sound/pci/ac97/ak4531_codec.c
sound/pci/ali5451/ali5451.c
sound/pci/cmipci.c
sound/pci/cs4281.c
sound/pci/cs46xx/cs46xx_lib.c
sound/pci/cs46xx/dsp_spos.c
sound/pci/cs46xx/dsp_spos_scb_lib.c
sound/pci/emu10k1/emufx.c
sound/pci/ens1370.c
sound/pci/es1938.c
sound/pci/es1968.c
sound/pci/fm801.c
sound/pci/ice1712/ak4524.c
sound/pci/ice1712/amp.c
sound/pci/ice1712/ews.c
sound/pci/ice1712/ice1712.c
sound/pci/ice1712/ice1712.h
sound/pci/intel8x0.c
sound/pci/korg1212/korg1212.c
sound/pci/maestro3.c
sound/pci/nm256/nm256.c
sound/pci/rme32.c
sound/pci/rme96.c
sound/pci/rme9652/hdsp.c
sound/pci/rme9652/rme9652.c
sound/pci/sonicvibes.c
sound/pci/trident/Makefile
sound/pci/trident/trident_main.c
sound/pci/trident/trident_synth.c
sound/pci/via82xx.c
sound/pci/ymfpci/ymfpci_main.c
sound/ppc/powermac.c
sound/synth/emux/Makefile
sound/synth/emux/emux_oss.c
sound/synth/emux/emux_seq.c
sound/synth/emux/soundfont.c
sound/usb/usbaudio.c
sound/usb/usbmidi.c
sound/usb/usbmixer.c
sound/usb/usbquirks.h

index 264bb1368ec83db0bc9000627bb43ed072a19596..dddadd2cdc2d590c1a316a6f2a867602b4a8a1c0 100644 (file)
@@ -213,6 +213,8 @@ Module parameters
 
     mpu_port   - 0x300 (default),0x310,0x320,0x330, -1 (diable)
     fm_port     - 0x388 (default), -1 (disable)
+    soft_ac3    - Sofware-conversion of raw SPDIF packets (model 033 only)
+                  (default = 1)
 
     Module supports autoprobe and multiple chips (max 8).
     
index dc717523f865e30b7d56ddfd1630e324653a94e8..1bac907e360a69b7d100c7e686a61826bc608f20 100644 (file)
@@ -20,7 +20,7 @@ There are slight difference between two DACs.
 
 - The first DAC supports U8 and S16LE formats, while the second DAC
   supports only S16LE.
-- The second DAC supports only two channel stereo.
+- The seconde DAC supports only two channel stereo.
 
 Please note that the CM8x38 DAC doesn't support continuous playback
 rate but only fixed rates: 5512, 8000, 11025, 16000, 22050, 32000,
@@ -65,15 +65,20 @@ When the multi-channel is supported, the driver name has a suffix
 "-MC" such like "CMI8738-MC6".  You can check this name from
 /proc/asound/cards.
 
-When the 4/6-ch output is enabled, the front DAC accepts up to 6 (or
-4) channels.  This is different from the dual DACs described in the
-previous section.  While the dual DAC supports two different rates or
+When the 4/6-ch output is enabled, the second DAC accepts up to 6 (or
+4) channels.  While the dual DAC supports two different rates or
 formats, the 4/6-ch playback supports only the same condition for all
-channels.
+channels.  Since the multi-channel playback mode uses both DACs, you
+cannot operate with full-duplex.
 
-For using 4/6 channel playback, you need to specify the PCM channels
-as you like and set the format S16LE.  For example, for playback with
-4 channels,
+The 4.0 and 5.1 modes are defined as the pcm "surround40" and "surround51"
+in alsa-lib.  For example, you can play a WAV file with 6 channels like
+
+       % aplay -Dsurround51 sixchannels.wav
+
+For programmin the 4/6 channel playback, you need to specify the PCM
+channels as you like and set the format S16LE.  For example, for playback
+with 4 channels,
 
        snd_pcm_hw_params_set_access(pcm, hw, SND_PCM_ACCESS_RW_INTERLEAVED);
            // or mmap if you like
@@ -175,6 +180,11 @@ Similarly the following switches are off: "IEC958 Mix Analog" and
 "IEC958 Loop".  The switches are resumed after closing the SPDIF PCM
 device automatically to the previous state.
 
+On the model 033, AC3 is implemented by the software conversion in
+the driver.  This prevents the mmap support.  If you need mmap
+support, pass the "soft_ac3=0" module option.  This doesn't matter
+on the newer models.
+
 
 ANALOG MIXER INTERFACE
 ----------------------
index 7a3e4676d2c3012ab2177d5652ad6c7582cd8a4a..f8fe118316661debbaa16552b1b49619d57a80a8 100644 (file)
@@ -346,7 +346,7 @@ int snd_device_free_all(snd_card_t *card, snd_device_cmd_t cmd);
 
 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);
+unsigned int snd_dma_pointer(unsigned long dma, unsigned int size);
 
 /* misc.c */
 
index 30457420de51e2afcd96b0d9d9aa6a6c648c991b..f5543e774bd1a5552f772fda15dccbee2acaa41f 100644 (file)
@@ -248,12 +248,12 @@ typedef struct _mix2_ostream_spb_t
           insure that the fractional error is always
           positive)
        */
-       long outTripletsPerFrame;
+       u32 outTripletsPerFrame;
 
        /* 16b.16b integer.frac accumulated number of
           output triplets since the start of group 
        */
-       long accumOutTriplets;  
+       u32 accumOutTriplets;  
 } mix2_ostream_spb_t;
 
 /* SCB for Timing master algorithm */
@@ -569,10 +569,10 @@ typedef struct _vari_decimate_scb_t {
        u32  vdec_input_buf_strm_config;
        /* inputBufStrmConfig: rsConfig for the input buffer to the decimator
           (buffer size = 64 dwords) */
-       long  vdec_coef_increment;
+       u32  vdec_coef_increment;
        /* coefIncrement = - 128.0 / decimationFactor (as a 32Q15 number) */
 
-       long  vdec_accumphi;
+       u32  vdec_accumphi;
        /* accumPhi: accumulated fractional phase increment (6.26) */
 
        u16 vdec_exp_vol_change_rate;
index 1522a61ba85c75b098d6352ee482bdc8fbf8b804..14710ff45bdada465e2828ca89aee9a48d4f9256 100644 (file)
@@ -196,8 +196,8 @@ typedef struct _dsp_spos_instance_t {
        u16 spdif_input_volume_left;
        /* spdif channel status,
           left right and user validity bits */
-       int spdif_csuv_default;
-       int spdif_csuv_stream;
+       unsigned int spdif_csuv_default;
+       unsigned int spdif_csuv_stream;
 
        /* SPDIF input sample rate converter */
        dsp_scb_descriptor_t * spdif_in_src;
index d88e1621097d1c126ccda79df8a2981baff8aec2..a2fbad2b8c40b4de0eb2a7c594c274beff2eba38 100644 (file)
@@ -31,8 +31,8 @@ typedef int (*snd_mixer_oss_get_volume_t)(snd_mixer_oss_file_t *fmixer, snd_mixe
 typedef int (*snd_mixer_oss_put_volume_t)(snd_mixer_oss_file_t *fmixer, snd_mixer_oss_slot_t *chn, int left, int right);
 typedef int (*snd_mixer_oss_get_recsrc_t)(snd_mixer_oss_file_t *fmixer, snd_mixer_oss_slot_t *chn, int *active);
 typedef int (*snd_mixer_oss_put_recsrc_t)(snd_mixer_oss_file_t *fmixer, snd_mixer_oss_slot_t *chn, int active);
-typedef int (*snd_mixer_oss_get_recsrce_t)(snd_mixer_oss_file_t *fmixer, int *active_index);
-typedef int (*snd_mixer_oss_put_recsrce_t)(snd_mixer_oss_file_t *fmixer, int active_index);
+typedef int (*snd_mixer_oss_get_recsrce_t)(snd_mixer_oss_file_t *fmixer, unsigned int *active_index);
+typedef int (*snd_mixer_oss_put_recsrce_t)(snd_mixer_oss_file_t *fmixer, unsigned int active_index);
 
 #define SNDRV_OSS_MAX_MIXERS   32
 
index 31684a78e0b24758226ce036d48175629385d4b8..60b0e92e26f30d923aab6a2cc0562aa34aa68769 100644 (file)
@@ -129,7 +129,7 @@ INLINE void snd_mask_reset(snd_mask_t *mask, unsigned int val)
 
 INLINE void snd_mask_set_range(snd_mask_t *mask, unsigned int from, unsigned int to)
 {
-       int i;
+       unsigned int i;
        assert(to <= SNDRV_MASK_BITS && from <= to);
        for (i = from; i <= to; i++)
                mask->bits[MASK_OFS(i)] |= MASK_BIT(i);
@@ -137,7 +137,7 @@ INLINE void snd_mask_set_range(snd_mask_t *mask, unsigned int from, unsigned int
 
 INLINE void snd_mask_reset_range(snd_mask_t *mask, unsigned int from, unsigned int to)
 {
-       int i;
+       unsigned int i;
        assert(to <= SNDRV_MASK_BITS && from <= to);
        for (i = from; i <= to; i++)
                mask->bits[MASK_OFS(i)] &= ~MASK_BIT(i);
index 6b0793562393b7cca69b5d1429df3d5879940990..347d7e9f3e74e264447d68e5f37589de1e6ecb42 100644 (file)
@@ -174,7 +174,7 @@ snd_seq_port_callback_t *snd_port_alloc_callback(void);
 
 /* port attach/detach */
 int snd_seq_event_port_attach(int client, snd_seq_port_callback_t *pcbp,
-                             int cap, int type, char *portname);
+                             int cap, int type, int midi_channels, char *portname);
 int snd_seq_event_port_detach(int client, int port);
 
 #endif /* __SOUND_SEQ_KERNEL_H */
index 560f248b9cdf1ffdabaad76907baf8355f0b0e95..3734c468875fefc1d092ef627851bd1cdb180b2b 100644 (file)
@@ -69,7 +69,7 @@ void snd_magic_kfree(void *ptr);
 
 static inline unsigned long _snd_magic_value(void *obj)
 {
-       return obj == NULL ? -1 : *(((unsigned long *)obj) - 1);
+       return obj == NULL ? (unsigned long)-1 : *(((unsigned long *)obj) - 1);
 }
 
 static inline int _snd_magic_bad(void *obj, unsigned long magic)
index 62df3ec5888b184766464f85e5f8fcfef74cf992..079c33f27c745e2018a8dbd2591ecd6f57a23588 100644 (file)
@@ -45,17 +45,19 @@ typedef struct sndrv_timer_read snd_timer_read_t;
 #define SNDRV_TIMER_HW_STOP    0x00000002      /* call stop before start */
 #define SNDRV_TIMER_HW_SLAVE   0x00000004      /* only slave timer (variable resolution) */
 #define SNDRV_TIMER_HW_FIRST   0x00000008      /* first tick can be incomplete */
+#define SNDRV_TIMER_HW_TASKLET 0x00000010      /* timer is called from tasklet */
 
-#define SNDRV_TIMER_IFLG_SLAVE 0x00000001
-#define SNDRV_TIMER_IFLG_RUNNING       0x00000002
-#define SNDRV_TIMER_IFLG_START 0x00000004
-#define SNDRV_TIMER_IFLG_AUTO  0x00000008      /* auto restart */
+#define SNDRV_TIMER_IFLG_SLAVE   0x00000001
+#define SNDRV_TIMER_IFLG_RUNNING  0x00000002
+#define SNDRV_TIMER_IFLG_START   0x00000004
+#define SNDRV_TIMER_IFLG_AUTO    0x00000008    /* auto restart */
+#define SNDRV_TIMER_IFLG_FAST    0x00000010    /* fast callback (do not use tasklet) */
+#define SNDRV_TIMER_IFLG_CALLBACK 0x00000020   /* timer callback is active */
 
-#define SNDRV_TIMER_FLG_SYSTEM 0x00000001      /* system timer */
-#define SNDRV_TIMER_FLG_CHANGE 0x00000002
-#define SNDRV_TIMER_FLG_RESCHED        0x00000004      /* need reschedule */
+#define SNDRV_TIMER_FLG_CHANGE 0x00000001
+#define SNDRV_TIMER_FLG_RESCHED        0x00000002      /* need reschedule */
 
-typedef void (*snd_timer_callback_t) (snd_timer_instance_t * timeri, unsigned long ticks, unsigned long resolution, void *data);
+typedef void (*snd_timer_callback_t) (snd_timer_instance_t * timeri, unsigned long ticks, unsigned long resolution);
 
 struct _snd_timer_hardware {
        /* -- must be filled with low-level driver */
@@ -87,6 +89,9 @@ struct _snd_timer {
        struct list_head device_list;
        struct list_head open_list_head;
        struct list_head active_list_head;
+       struct list_head ack_list_head;
+       struct list_head sack_list_head; /* slow ack list head */
+       struct tasklet_struct task_queue;
 };
 
 struct _snd_timer_instance {
@@ -97,17 +102,19 @@ struct _snd_timer_instance {
        void (*private_free) (snd_timer_instance_t *ti);
        snd_timer_callback_t callback;
        void *callback_data;
-       unsigned long ticks;
-       unsigned long cticks;
+       unsigned long ticks;            /* auto-load ticks when expired */
+       unsigned long cticks;           /* current ticks */
+       unsigned long pticks;           /* accumulated ticks for callback */
+       unsigned long resolution;       /* current resolution for tasklet */
        unsigned long lost;             /* lost ticks */
        snd_timer_slave_class_t slave_class;
        unsigned int slave_id;
        struct list_head open_list;
        struct list_head active_list;
+       struct list_head ack_list;
        struct list_head slave_list_head;
        struct list_head slave_active_head;
        snd_timer_instance_t *master;
-       atomic_t in_use;                /* don't free */
 };
 
 /*
@@ -128,7 +135,6 @@ extern int snd_timer_set_resolution(snd_timer_instance_t * timeri, unsigned long
 extern unsigned long snd_timer_resolution(snd_timer_instance_t * timeri);
 extern int snd_timer_start(snd_timer_instance_t * timeri, unsigned int ticks);
 extern int snd_timer_stop(snd_timer_instance_t * timeri);
-extern int snd_timer_del(snd_timer_instance_t * timeri);
 extern int snd_timer_continue(snd_timer_instance_t * timeri);
 
 extern void snd_timer_interrupt(snd_timer_t * timer, unsigned long ticks_left);
index 77c9885943ebc06e62052d15181b033a1c22f09e..23460ba889016dc88fc6f13daf779becb3ad55d0 100644 (file)
@@ -1,3 +1,3 @@
-/* include/version.h.  Generated automatically by configure.  */
-#define CONFIG_SND_VERSION "0.9.0rc6"
-#define CONFIG_SND_DATE " (Tue Jan 28 12:17:23 2003 UTC)"
+/* include/version.h.  Generated by configure.  */
+#define CONFIG_SND_VERSION "0.9.0rc7"
+#define CONFIG_SND_DATE " (Sat Feb 08 17:33:25 2003 UTC)"
index 2665fb1e4974b7387de20efd4e17ab21233790a2..538daeb9e78bd4013e4d530d1b7d9255b8741bee 100644 (file)
@@ -221,7 +221,8 @@ int snd_device_free_all(snd_card_t *card, snd_device_cmd_t cmd)
 {
        snd_device_t *dev;
        struct list_head *list;
-       int err, range_low, range_high;
+       int err;
+       unsigned int range_low, range_high;
 
        snd_assert(card != NULL, return -ENXIO);
        range_low = cmd * SNDRV_DEV_TYPE_RANGE_SIZE;
index be0245dbfdf0c65663d38bd1c2f04dd7cbee058f..5826ea7d54191c58504f60ce5db73c644cb5cbf0 100644 (file)
@@ -334,7 +334,7 @@ static int snd_hwdep_dev_register(snd_device_t *device)
        if ((err = snd_register_device(SNDRV_DEVICE_TYPE_HWDEP,
                                       hwdep->card, hwdep->device,
                                       &snd_hwdep_reg, name)) < 0) {
-               snd_printk(KERN_ERR "unable to register hardware dependent device %i:%i\n",
+               snd_printk(KERN_ERR "unable to register hardware dependant device %i:%i\n",
                           hwdep->card->number, hwdep->device);
                snd_hwdep_devices[idx] = NULL;
                up(&register_mutex);
index 816e01bc6780c3b8e882c17be9f3d6a71327b105..d972daaaa3a819fa5f94240b298ba122673324a1 100644 (file)
@@ -796,20 +796,20 @@ int snd_info_get_line(snd_info_buffer_t * buffer, char *line, int len)
        while (--len > 0) {
                c = *buffer->curr++;
                if (c == '\n') {
-                       if ((buffer->curr - buffer->buffer) >= buffer->size) {
+                       if ((buffer->curr - buffer->buffer) >= (long)buffer->size) {
                                buffer->stop = 1;
                        }
                        break;
                }
                *line++ = c;
-               if ((buffer->curr - buffer->buffer) >= buffer->size) {
+               if ((buffer->curr - buffer->buffer) >= (long)buffer->size) {
                        buffer->stop = 1;
                        break;
                }
        }
        while (c != '\n' && !buffer->stop) {
                c = *buffer->curr++;
-               if ((buffer->curr - buffer->buffer) >= buffer->size) {
+               if ((buffer->curr - buffer->buffer) >= (long)buffer->size) {
                        buffer->stop = 1;
                }
        }
index f1b40b70d9e485a95c4c3cc4a4cd61b1db929324..937a21060dd8aced10f85691a716e29006c87e87 100644 (file)
@@ -352,7 +352,7 @@ static void choose_default_id(snd_card_t * card)
                id++;
        }
        id = card->id;
-       while (*spos != '\0' && id - card->id < sizeof(card->id) - 1) {
+       while (*spos != '\0' && (size_t)(id - card->id) < sizeof(card->id) - 1) {
                if (isalnum(*spos))
                        *id++ = *spos;
                spos++;
@@ -379,12 +379,12 @@ static void choose_default_id(snd_card_t * card)
                len = strlen(id);
                if (idx_flag)
                        id[len-1]++;
-               else if (len <= sizeof(card->id) - 3) {
+               else if ((size_t)len <= sizeof(card->id) - 3) {
                        strcat(id, "_1");
                        idx_flag++;
                } else {
                        spos = id + len - 2;
-                       if (len <= sizeof(card->id) - 2)
+                       if ((size_t)len <= sizeof(card->id) - 2)
                                spos++;
                        *spos++ = '_';
                        *spos++ = '1';
index ba03e6620a256b0885a7ce4a8af717df28e30385..0f0e4e911cea4dc8cce907abb1474cfc70892384 100644 (file)
@@ -70,6 +70,17 @@ void snd_ioctl32_unregister(struct ioctl32_mapper *mappers)
 }
 
 
+/*
+ * compatible wrapper
+ */
+int snd_ioctl32_compat(unsigned int fd, unsigned int cmd, unsigned long arg, struct file *filp)
+{
+       if (! filp->f_op || ! filp->f_op->ioctl)
+               return -ENOTTY;
+       return filp->f_op->ioctl(filp->f_dentry->d_inode, filp, cmd, arg);
+}
+
+
 /*
  * Controls
  */
@@ -381,22 +392,22 @@ enum {
 
 static struct ioctl32_mapper control_mappers[] = {
        /* controls (without rawmidi, hwdep, timer releated ones) */
-       { SNDRV_CTL_IOCTL_PVERSION, NULL },
-       { SNDRV_CTL_IOCTL_CARD_INFO , NULL },
+       MAP_COMPAT(SNDRV_CTL_IOCTL_PVERSION),
+       MAP_COMPAT(SNDRV_CTL_IOCTL_CARD_INFO),
        { SNDRV_CTL_IOCTL_ELEM_LIST32, AP(ctl_elem_list) },
        { SNDRV_CTL_IOCTL_ELEM_INFO32, AP(ctl_elem_info) },
        { SNDRV_CTL_IOCTL_ELEM_READ32, AP(ctl_elem_read) },
        { SNDRV_CTL_IOCTL_ELEM_WRITE32, AP(ctl_elem_write) },
-       { SNDRV_CTL_IOCTL_ELEM_LOCK, NULL },
-       { SNDRV_CTL_IOCTL_ELEM_UNLOCK, NULL },
-       { SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS, NULL },
-       { SNDRV_CTL_IOCTL_HWDEP_INFO, NULL },
-       { SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE, NULL },
-       { SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE, NULL },
-       { SNDRV_CTL_IOCTL_PCM_INFO, NULL },
-       { SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE, NULL },
-       { SNDRV_CTL_IOCTL_POWER, NULL },
-       { SNDRV_CTL_IOCTL_POWER_STATE, NULL },
+       MAP_COMPAT(SNDRV_CTL_IOCTL_ELEM_LOCK),
+       MAP_COMPAT(SNDRV_CTL_IOCTL_ELEM_UNLOCK),
+       MAP_COMPAT(SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS),
+       MAP_COMPAT(SNDRV_CTL_IOCTL_HWDEP_INFO),
+       MAP_COMPAT(SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE),
+       MAP_COMPAT(SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE),
+       MAP_COMPAT(SNDRV_CTL_IOCTL_PCM_INFO),
+       MAP_COMPAT(SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE),
+       MAP_COMPAT(SNDRV_CTL_IOCTL_POWER),
+       MAP_COMPAT(SNDRV_CTL_IOCTL_POWER_STATE),
        { 0 }
 };
 
index c7ad6d1406d2a77fdf9d8fd54787157fb4906025..e59d382102fff8306a413a4091c10caef8f4a11e 100644 (file)
@@ -69,6 +69,7 @@ static int _snd_ioctl32_##type(unsigned int fd, unsigned int cmd, unsigned long
        oldseg = get_fs();\
        set_fs(KERNEL_DS);\
        err = file->f_op->ioctl(file->f_dentry->d_inode, file, native_ctl, (unsigned long)&data);\
+       set_fs(oldseg);\
        if (err < 0) \
                return err;\
        if (native_ctl & (_IOC_READ << _IOC_DIRSHIFT)) {\
@@ -101,6 +102,7 @@ static int _snd_ioctl32_##type(unsigned int fd, unsigned int cmd, unsigned long
        oldseg = get_fs();\
        set_fs(KERNEL_DS);\
        err = file->f_op->ioctl(file->f_dentry->d_inode, file, native_ctl, (unsigned long)data);\
+       set_fs(oldseg);\
        if (err < 0) \
                goto __end;\
        err = 0;\
@@ -122,6 +124,7 @@ static int snd_ioctl32_##name(unsigned int fd, unsigned int cmd, unsigned long a
        return _snd_ioctl32_##type(fd, cmd, arg, file, native_ctl);\
 }
 
+#define MAP_COMPAT(ctl) { ctl, snd_ioctl32_compat }
 
 struct ioctl32_mapper {
        unsigned int cmd;
@@ -129,6 +132,8 @@ struct ioctl32_mapper {
        int registered;
 };
 
+int snd_ioctl32_compat(unsigned int, unsigned int, unsigned long, struct file *);
+
 int snd_ioctl32_register(struct ioctl32_mapper *mappers);
 void snd_ioctl32_unregister(struct ioctl32_mapper *mappers);
 
index a0ff92ff41b1c6be8a061367ee9764ed6cd0b82a..b08e10759de7977df6fef338903e6ada10c4e6c8 100644 (file)
@@ -72,7 +72,7 @@ struct sndrv_pcm_hw_params32 {
 
 #define CVT_sndrv_pcm_hw_params()\
 {\
-       int i;\
+       unsigned int i;\
        COPY(flags);\
        for (i = 0; i < numberof(dst->masks); i++)\
                COPY(masks[i]);\
@@ -423,32 +423,32 @@ enum {
 };
 
 struct ioctl32_mapper pcm_mappers[] = {
-       { SNDRV_PCM_IOCTL_PVERSION, NULL },
-       { SNDRV_PCM_IOCTL_INFO, NULL },
+       MAP_COMPAT(SNDRV_PCM_IOCTL_PVERSION),
+       MAP_COMPAT(SNDRV_PCM_IOCTL_INFO),
        { SNDRV_PCM_IOCTL_HW_REFINE32, AP(pcm_hw_refine) },
        { SNDRV_PCM_IOCTL_HW_PARAMS32, AP(pcm_hw_params) },
        { SNDRV_PCM_IOCTL_HW_REFINE_OLD32, AP(pcm_hw_refine_old) },
        { SNDRV_PCM_IOCTL_HW_PARAMS_OLD32, AP(pcm_hw_params_old) },
-       { SNDRV_PCM_IOCTL_HW_FREE, NULL },
+       MAP_COMPAT(SNDRV_PCM_IOCTL_HW_FREE),
        { SNDRV_PCM_IOCTL_SW_PARAMS32, AP(pcm_sw_params) },
        { SNDRV_PCM_IOCTL_STATUS32, AP(pcm_status) },
        { SNDRV_PCM_IOCTL_DELAY32, AP(pcm_delay) },
        { SNDRV_PCM_IOCTL_CHANNEL_INFO32, AP(pcm_channel_info) },
-       { SNDRV_PCM_IOCTL_PREPARE, NULL },
-       { SNDRV_PCM_IOCTL_RESET, NULL },
-       { SNDRV_PCM_IOCTL_START, NULL },
-       { SNDRV_PCM_IOCTL_DROP, NULL },
-       { SNDRV_PCM_IOCTL_DRAIN, NULL },
-       { SNDRV_PCM_IOCTL_PAUSE, NULL },
+       MAP_COMPAT(SNDRV_PCM_IOCTL_PREPARE),
+       MAP_COMPAT(SNDRV_PCM_IOCTL_RESET),
+       MAP_COMPAT(SNDRV_PCM_IOCTL_START),
+       MAP_COMPAT(SNDRV_PCM_IOCTL_DROP),
+       MAP_COMPAT(SNDRV_PCM_IOCTL_DRAIN),
+       MAP_COMPAT(SNDRV_PCM_IOCTL_PAUSE),
        { SNDRV_PCM_IOCTL_REWIND32, AP(pcm_rewind) },
-       { SNDRV_PCM_IOCTL_RESUME, NULL },
-       { SNDRV_PCM_IOCTL_XRUN, NULL },
+       MAP_COMPAT(SNDRV_PCM_IOCTL_RESUME),
+       MAP_COMPAT(SNDRV_PCM_IOCTL_XRUN),
        { SNDRV_PCM_IOCTL_WRITEI_FRAMES32, AP(pcm_writei) },
        { SNDRV_PCM_IOCTL_READI_FRAMES32, AP(pcm_readi) },
        { SNDRV_PCM_IOCTL_WRITEN_FRAMES32, AP(pcm_writen) },
        { SNDRV_PCM_IOCTL_READN_FRAMES32, AP(pcm_readn) },
-       { SNDRV_PCM_IOCTL_LINK, NULL },
-       { SNDRV_PCM_IOCTL_UNLINK, NULL },
+       MAP_COMPAT(SNDRV_PCM_IOCTL_LINK),
+       MAP_COMPAT(SNDRV_PCM_IOCTL_UNLINK),
 
        { 0 },
 };
index 31b3319fba7a3450072cc871edb145a2e8d0d1ab..0c8d70081a5e75ae736e509e2247ba5393fc11ff 100644 (file)
@@ -78,16 +78,16 @@ enum {
 };
 
 struct ioctl32_mapper rawmidi_mappers[] = {
-       { SNDRV_RAWMIDI_IOCTL_PVERSION, NULL },
-       { SNDRV_RAWMIDI_IOCTL_INFO, NULL },
+       MAP_COMPAT(SNDRV_RAWMIDI_IOCTL_PVERSION),
+       MAP_COMPAT(SNDRV_RAWMIDI_IOCTL_INFO),
        { SNDRV_RAWMIDI_IOCTL_PARAMS32, AP(rawmidi_params) },
        { SNDRV_RAWMIDI_IOCTL_STATUS32, AP(rawmidi_status) },
-       { SNDRV_RAWMIDI_IOCTL_DROP, NULL },
-       { SNDRV_RAWMIDI_IOCTL_DRAIN, NULL },
+       MAP_COMPAT(SNDRV_RAWMIDI_IOCTL_DROP),
+       MAP_COMPAT(SNDRV_RAWMIDI_IOCTL_DRAIN),
 
-       { SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE, NULL },
-       { SNDRV_CTL_IOCTL_RAWMIDI_INFO, NULL },
-       { SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE, NULL },
+       MAP_COMPAT(SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE),
+       MAP_COMPAT(SNDRV_CTL_IOCTL_RAWMIDI_INFO),
+       MAP_COMPAT(SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE),
 
        { 0 },
 };
index 1d396554b7ba45fedb450d978816ae99b1eda7c4..19c12cee8f6cd84c1e9faa3bd7a4f6b4e88b3055 100644 (file)
@@ -79,36 +79,36 @@ enum {
 };
 
 struct ioctl32_mapper seq_mappers[] = {
-       { SNDRV_SEQ_IOCTL_PVERSION, NULL },
-       { SNDRV_SEQ_IOCTL_CLIENT_ID, NULL },
-       { SNDRV_SEQ_IOCTL_SYSTEM_INFO, NULL },
-       { SNDRV_SEQ_IOCTL_GET_CLIENT_INFO, NULL },
-       { SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, NULL },
+       MAP_COMPAT(SNDRV_SEQ_IOCTL_PVERSION),
+       MAP_COMPAT(SNDRV_SEQ_IOCTL_CLIENT_ID),
+       MAP_COMPAT(SNDRV_SEQ_IOCTL_SYSTEM_INFO),
+       MAP_COMPAT(SNDRV_SEQ_IOCTL_GET_CLIENT_INFO),
+       MAP_COMPAT(SNDRV_SEQ_IOCTL_SET_CLIENT_INFO),
        { SNDRV_SEQ_IOCTL_CREATE_PORT32, AP(create_port) },
        { SNDRV_SEQ_IOCTL_DELETE_PORT32, AP(delete_port) },
        { SNDRV_SEQ_IOCTL_GET_PORT_INFO32, AP(get_port_info) },
        { SNDRV_SEQ_IOCTL_SET_PORT_INFO32, AP(set_port_info) },
-       { SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT, NULL },
-       { SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT, NULL },
-       { SNDRV_SEQ_IOCTL_CREATE_QUEUE, NULL },
-       { SNDRV_SEQ_IOCTL_DELETE_QUEUE, NULL },
-       { SNDRV_SEQ_IOCTL_GET_QUEUE_INFO, NULL },
-       { SNDRV_SEQ_IOCTL_SET_QUEUE_INFO, NULL },
-       { SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE, NULL },
-       { SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS, NULL },
-       { SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO, NULL },
-       { SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO, NULL },
-       { SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER, NULL },
-       { SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER, NULL },
-       { SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT, NULL },
-       { SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT, NULL },
-       { SNDRV_SEQ_IOCTL_GET_CLIENT_POOL, NULL },
-       { SNDRV_SEQ_IOCTL_SET_CLIENT_POOL, NULL },
-       { SNDRV_SEQ_IOCTL_REMOVE_EVENTS, NULL },
-       { SNDRV_SEQ_IOCTL_QUERY_SUBS, NULL },
-       { SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION, NULL },
-       { SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT, NULL },
+       MAP_COMPAT(SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT),
+       MAP_COMPAT(SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT),
+       MAP_COMPAT(SNDRV_SEQ_IOCTL_CREATE_QUEUE),
+       MAP_COMPAT(SNDRV_SEQ_IOCTL_DELETE_QUEUE),
+       MAP_COMPAT(SNDRV_SEQ_IOCTL_GET_QUEUE_INFO),
+       MAP_COMPAT(SNDRV_SEQ_IOCTL_SET_QUEUE_INFO),
+       MAP_COMPAT(SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE),
+       MAP_COMPAT(SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS),
+       MAP_COMPAT(SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO),
+       MAP_COMPAT(SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO),
+       MAP_COMPAT(SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER),
+       MAP_COMPAT(SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER),
+       MAP_COMPAT(SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT),
+       MAP_COMPAT(SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT),
+       MAP_COMPAT(SNDRV_SEQ_IOCTL_GET_CLIENT_POOL),
+       MAP_COMPAT(SNDRV_SEQ_IOCTL_SET_CLIENT_POOL),
+       MAP_COMPAT(SNDRV_SEQ_IOCTL_REMOVE_EVENTS),
+       MAP_COMPAT(SNDRV_SEQ_IOCTL_QUERY_SUBS),
+       MAP_COMPAT(SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION),
+       MAP_COMPAT(SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT),
        { SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT32, AP(query_next_port) },
-       { SNDRV_SEQ_IOCTL_RUNNING_MODE, NULL },
+       MAP_COMPAT(SNDRV_SEQ_IOCTL_RUNNING_MODE),
        { 0 },
 };
index 1672e0342ec42bdddc848e4161c979a34bbb115a..b1ac122b361c650ee25903473ee7d406ff14979d 100644 (file)
@@ -87,14 +87,14 @@ enum {
 };
 
 struct ioctl32_mapper timer_mappers[] = {
-       { SNDRV_TIMER_IOCTL_PVERSION, NULL },
-       { SNDRV_TIMER_IOCTL_NEXT_DEVICE, NULL },
-       { SNDRV_TIMER_IOCTL_SELECT, NULL },
+       MAP_COMPAT(SNDRV_TIMER_IOCTL_PVERSION),
+       MAP_COMPAT(SNDRV_TIMER_IOCTL_NEXT_DEVICE),
+       MAP_COMPAT(SNDRV_TIMER_IOCTL_SELECT),
        { SNDRV_TIMER_IOCTL_INFO32, AP(timer_info) },
-       { SNDRV_TIMER_IOCTL_PARAMS, NULL },
+       MAP_COMPAT(SNDRV_TIMER_IOCTL_PARAMS),
        { SNDRV_TIMER_IOCTL_STATUS32, AP(timer_status) },
-       { SNDRV_TIMER_IOCTL_START, NULL },
-       { SNDRV_TIMER_IOCTL_STOP, NULL },
-       { SNDRV_TIMER_IOCTL_CONTINUE, NULL },
+       MAP_COMPAT(SNDRV_TIMER_IOCTL_START),
+       MAP_COMPAT(SNDRV_TIMER_IOCTL_STOP),
+       MAP_COMPAT(SNDRV_TIMER_IOCTL_CONTINUE),
        { 0 },
 };
index 48f355397df29fc516901383157825e7243ca229..54bd57b3122dc89b19692d370a6f511d069a908c 100644 (file)
@@ -73,12 +73,13 @@ void snd_dma_disable(unsigned long dma)
 }
 
 /**
- * snd_dma_residue - return the residue count of the given DMA
+ * snd_dma_pointer - return the current pointer to DMA transfer buffer in bytes
  * @dma: the dma number
+ * @size: the dma transfer size
  *
- * Returns the residue count of the given DMA transfer.
+ * Returns the current pointer in DMA tranfer buffer in bytes
  */
-unsigned int snd_dma_residue(unsigned long dma)
+unsigned int snd_dma_pointer(unsigned long dma, unsigned int size)
 {
        unsigned long flags;
        unsigned int result;
@@ -91,5 +92,9 @@ unsigned int snd_dma_residue(unsigned long dma)
        if (!isa_dma_bridge_buggy)
                enable_dma(dma);
        release_dma_lock(flags);
-       return result;
+#ifdef CONFIG_SND_DEBUG
+       if (result > size)
+               snd_printk(KERN_ERR "pointer (0x%x) for DMA #%ld is greater than transfer size (0x%x)\n", result, dma, size);
+#endif
+       return result >= size ? 0 : result;
 }
index 63c69c5519a49111f6dcdb083dd4a749670ab69e..c4cc66429179f157cd13e85ffd63d824b1e7a0b8 100644 (file)
@@ -464,7 +464,7 @@ static int snd_mixer_oss_recsrce_get(snd_card_t *card, int slot)
 struct slot {
        unsigned int signature;
        unsigned int present;
-       int channels;
+       unsigned int channels;
        snd_kcontrol_t *kcontrol[SNDRV_MIXER_OSS_ITEM_COUNT];
        unsigned int capture_item;
        struct snd_mixer_oss_assign_table *assigned;
@@ -732,7 +732,7 @@ static int snd_mixer_oss_put_recsrc1_route(snd_mixer_oss_file_t *fmixer,
        return 0;
 }
 
-static int snd_mixer_oss_get_recsrc2(snd_mixer_oss_file_t *fmixer, int *active_index)
+static int snd_mixer_oss_get_recsrc2(snd_mixer_oss_file_t *fmixer, unsigned int *active_index)
 {
        snd_card_t *card = fmixer->card;
        snd_mixer_oss_t *mixer = fmixer->mixer;
@@ -778,7 +778,7 @@ static int snd_mixer_oss_get_recsrc2(snd_mixer_oss_file_t *fmixer, int *active_i
        return err;
 }
 
-static int snd_mixer_oss_put_recsrc2(snd_mixer_oss_file_t *fmixer, int active_index)
+static int snd_mixer_oss_put_recsrc2(snd_mixer_oss_file_t *fmixer, unsigned int active_index)
 {
        snd_card_t *card = fmixer->card;
        snd_mixer_oss_t *mixer = fmixer->mixer;
@@ -787,7 +787,8 @@ static int snd_mixer_oss_put_recsrc2(snd_mixer_oss_file_t *fmixer, int active_in
        struct slot *slot = NULL;
        snd_ctl_elem_info_t *uinfo;
        snd_ctl_elem_value_t *uctl;
-       int err, idx;
+       int err;
+       unsigned int idx;
 
        uinfo = snd_kcalloc(sizeof(*uinfo), GFP_KERNEL);
        uctl = snd_kcalloc(sizeof(*uctl), GFP_KERNEL);
@@ -1155,7 +1156,7 @@ static void snd_mixer_oss_build(snd_mixer_oss_t *mixer)
        static struct snd_mixer_oss_assign_table fm_table = {
                SOUND_MIXER_SYNTH,      "FM",                   0
        };
-       int idx;
+       unsigned int idx;
        
        for (idx = 0; idx < sizeof(table) / sizeof(struct snd_mixer_oss_assign_table); idx++)
                snd_mixer_oss_build_input(mixer, &table[idx], 0);
index 292af9f829f1eeec2b01f97b4275cf6656153ce5..11f232f3f10f1ab7c90a10823a7c14f09a6a7e38 100644 (file)
@@ -252,11 +252,11 @@ static int snd_pcm_oss_period_size(snd_pcm_substream_t *substream,
 }
 
 static int choose_rate(snd_pcm_substream_t *substream,
-                      snd_pcm_hw_params_t *params, int best_rate)
+                      snd_pcm_hw_params_t *params, unsigned int best_rate)
 {
        snd_interval_t *it;
        snd_pcm_hw_params_t *save;
-       int rate;
+       unsigned int rate;
 
        save = kmalloc(sizeof(*save), GFP_KERNEL);
        if (save == NULL)
@@ -274,7 +274,7 @@ static int choose_rate(snd_pcm_substream_t *substream,
                        ret = snd_pcm_hw_param_set(substream, params,
                                                   SNDRV_PCM_HW_PARAM_RATE,
                                                   rate, 0);
-                       if (ret == rate) {
+                       if (ret == (int)rate) {
                                kfree(save);
                                return rate;
                        }
@@ -716,7 +716,7 @@ static ssize_t snd_pcm_oss_write1(snd_pcm_substream_t *substream, const char *bu
                                tmp = runtime->oss.period_bytes - runtime->oss.buffer_used;
                        if (tmp > 0) {
                                if (copy_from_user(runtime->oss.buffer + runtime->oss.buffer_used, buf, tmp))
-                                       return xfer > 0 ? xfer : -EFAULT;
+                                       return xfer > 0 ? (snd_pcm_sframes_t)xfer : -EFAULT;
                        }
                        runtime->oss.buffer_used += tmp;
                        buf += tmp;
@@ -725,14 +725,14 @@ static ssize_t snd_pcm_oss_write1(snd_pcm_substream_t *substream, const char *bu
                        if (runtime->oss.buffer_used == runtime->oss.period_bytes) {
                                tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer, runtime->oss.period_bytes, 1);
                                if (tmp <= 0)
-                                       return xfer > 0 ? xfer : tmp;
+                                       return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
                                runtime->oss.bytes += tmp;
                                runtime->oss.buffer_used = 0;
                        }
                } else {
                        tmp = snd_pcm_oss_write2(substream, (char *)buf, runtime->oss.period_bytes, 0);
                        if (tmp <= 0)
-                               return xfer > 0 ? xfer : tmp;
+                               return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
                        runtime->oss.bytes += tmp;
                        buf += tmp;
                        bytes -= tmp;
@@ -788,7 +788,7 @@ static ssize_t snd_pcm_oss_read1(snd_pcm_substream_t *substream, char *buf, size
                        if (runtime->oss.buffer_used == 0) {
                                tmp = snd_pcm_oss_read2(substream, runtime->oss.buffer, runtime->oss.period_bytes, 1);
                                if (tmp <= 0)
-                                       return xfer > 0 ? xfer : tmp;
+                                       return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
                                runtime->oss.bytes += tmp;
                                runtime->oss.buffer_used = runtime->oss.period_bytes;
                        }
@@ -796,7 +796,7 @@ static ssize_t snd_pcm_oss_read1(snd_pcm_substream_t *substream, char *buf, size
                        if ((size_t) tmp > runtime->oss.buffer_used)
                                tmp = runtime->oss.buffer_used;
                        if (copy_to_user(buf, runtime->oss.buffer + (runtime->oss.period_bytes - runtime->oss.buffer_used), tmp))
-                               return xfer > 0 ? xfer : -EFAULT;
+                               return xfer > 0 ? (snd_pcm_sframes_t)xfer : -EFAULT;
                        buf += tmp;
                        bytes -= tmp;
                        xfer += tmp;
@@ -804,7 +804,7 @@ static ssize_t snd_pcm_oss_read1(snd_pcm_substream_t *substream, char *buf, size
                } else {
                        tmp = snd_pcm_oss_read2(substream, (char *)buf, runtime->oss.period_bytes, 0);
                        if (tmp <= 0)
-                               return xfer > 0 ? xfer : tmp;
+                               return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
                        runtime->oss.bytes += tmp;
                        buf += tmp;
                        bytes -= tmp;
@@ -927,7 +927,7 @@ static int snd_pcm_oss_get_rate(snd_pcm_oss_file_t *pcm_oss_file)
        return substream->runtime->oss.rate;
 }
 
-static int snd_pcm_oss_set_channels(snd_pcm_oss_file_t *pcm_oss_file, int channels)
+static int snd_pcm_oss_set_channels(snd_pcm_oss_file_t *pcm_oss_file, unsigned int channels)
 {
        int idx;
        if (channels < 1)
@@ -2151,7 +2151,7 @@ static void register_oss_dsp(snd_pcm_t *pcm, int index)
 static int snd_pcm_oss_register_minor(snd_pcm_t * pcm)
 {
        pcm->oss.reg = 0;
-       if (dsp_map[pcm->card->number] == pcm->device) {
+       if (dsp_map[pcm->card->number] == (int)pcm->device) {
                char name[128];
                int duplex;
                register_oss_dsp(pcm, 0);
@@ -2167,7 +2167,7 @@ static int snd_pcm_oss_register_minor(snd_pcm_t * pcm)
                pcm->oss.reg++;
                pcm->oss.reg_mask |= 1;
        }
-       if (adsp_map[pcm->card->number] == pcm->device) {
+       if (adsp_map[pcm->card->number] == (int)pcm->device) {
                register_oss_dsp(pcm, 1);
                pcm->oss.reg++;
                pcm->oss.reg_mask |= 2;
@@ -2200,7 +2200,7 @@ static int snd_pcm_oss_unregister_minor(snd_pcm_t * pcm)
 {
        snd_pcm_oss_disconnect_minor(pcm);
        if (pcm->oss.reg) {
-               if (dsp_map[pcm->card->number] == pcm->device) {
+               if (dsp_map[pcm->card->number] == (int)pcm->device) {
 #ifdef SNDRV_OSS_INFO_DEV_AUDIO
                        snd_oss_info_unregister(SNDRV_OSS_INFO_DEV_AUDIO, pcm->card->number);
 #endif
index 027314f56345c7fba3aad8656772a9a393c17b36..cfeb97127bf985be59d1386f878f44c026dba662 100644 (file)
@@ -811,7 +811,7 @@ snd_pcm_sframes_t snd_pcm_plug_read_transfer(snd_pcm_plug_t *plug, snd_pcm_plugi
                        }
                        frames = err;
                        if (!plugin->prev) {
-                               if ((err = snd_pcm_plug_capture_disable_useless_channels(plug, dst_channels, dst_channels_final) < 0))
+                               if ((err = snd_pcm_plug_capture_disable_useless_channels(plug, dst_channels, dst_channels_final)) < 0)
                                        return err;
                        }
                } else {
index d9383e69f19cca65e3772554e2dbdcec55f189ce..6ea8398d2525feb5ddaf3a9c18fb62bb281ee7cc 100644 (file)
@@ -105,7 +105,7 @@ static int snd_pcm_control_ioctl(snd_card_t * card,
                        if (subdevice >= pstr->substream_count)
                                return -ENXIO;
                        for (substream = pstr->substream; substream; substream = substream->next)
-                               if (substream->number == subdevice)
+                               if (substream->number == (int)subdevice)
                                        break;
                        if (substream == NULL)
                                return -ENXIO;
index efabbb4efabcdddd45b33814e6ee9ebd9fda08ce..7699c3ce1eeba42812ad5b327d22da0ceb202eee 100644 (file)
@@ -119,7 +119,7 @@ int snd_pcm_update_hw_ptr_interrupt(snd_pcm_substream_t *substream)
 
        delta = hw_ptr_interrupt - new_hw_ptr;
        if (delta > 0) {
-               if (delta < runtime->buffer_size / 2) {
+               if ((snd_pcm_uframes_t)delta < runtime->buffer_size / 2) {
                        snd_printd("Unexpected hw_pointer value (stream = %i, delta: -%ld, max jitter = %ld): wrong interrupt acknowledge?\n", substream->stream, (long) delta, runtime->buffer_size / 2);
                        return 0;
                }
@@ -183,7 +183,7 @@ int snd_pcm_update_hw_ptr(snd_pcm_substream_t *substream)
 
        delta = old_hw_ptr - new_hw_ptr;
        if (delta > 0) {
-               if (delta < runtime->buffer_size / 2) {
+               if ((snd_pcm_uframes_t)delta < runtime->buffer_size / 2) {
                        snd_printd("Unexpected hw_pointer value (stream = %i, delta: -%ld, max jitter = %ld): wrong interrupt acknowledge?\n", substream->stream, (long) delta, runtime->buffer_size / 2);
                        return 0;
                }
@@ -1013,7 +1013,7 @@ static int snd_pcm_hw_rule_msbits(snd_pcm_hw_params_t *params,
                                  snd_pcm_hw_rule_t *rule)
 {
        unsigned int l = (unsigned long) rule->private;
-       unsigned int width = l & 0xffff;
+       int width = l & 0xffff;
        unsigned int msbits = l >> 16;
        snd_interval_t *i = hw_param_interval(params, SNDRV_PCM_HW_PARAM_SAMPLE_BITS);
        if (snd_interval_single(i) && snd_interval_value(i) == width)
@@ -1830,13 +1830,17 @@ int snd_pcm_capture_ready(snd_pcm_substream_t *substream)
  * snd_pcm_playback_data - check whether any data exists on the playback buffer
  * @substream: the pcm substream instance
  *
- * Checks whether any data exists on the playback buffer.
+ * Checks whether any data exists on the playback buffer. If stop_threshold
+ * is bigger or equal to boundary, then this function returns always non-zero.
  *
  * Returns non-zero if exists, or zero if not.
  */
 int snd_pcm_playback_data(snd_pcm_substream_t *substream)
 {
        snd_pcm_runtime_t *runtime = substream->runtime;
+       
+       if (runtime->stop_threshold >= runtime->boundary)
+               return 1;
        return snd_pcm_playback_avail(runtime) < runtime->buffer_size;
 }
 
@@ -1901,7 +1905,7 @@ void snd_pcm_tick_prepare(snd_pcm_substream_t *substream)
                    runtime->silenced_size < runtime->buffer_size) {
                        snd_pcm_sframes_t noise_dist;
                        noise_dist = snd_pcm_playback_hw_avail(runtime) + runtime->silenced_size;
-                       snd_assert(noise_dist <= runtime->silence_threshold, );
+                       snd_assert(noise_dist <= (snd_pcm_sframes_t)runtime->silence_threshold, );
                        frames = noise_dist - runtime->silence_threshold;
                }
                avail = snd_pcm_playback_avail(runtime);
@@ -1910,12 +1914,12 @@ void snd_pcm_tick_prepare(snd_pcm_substream_t *substream)
        }
        if (avail < runtime->control->avail_min) {
                snd_pcm_sframes_t n = runtime->control->avail_min - avail;
-               if (n > 0 && frames > n)
+               if (n > 0 && frames > (snd_pcm_uframes_t)n)
                        frames = n;
        }
        if (avail < runtime->buffer_size) {
                snd_pcm_sframes_t n = runtime->buffer_size - avail;
-               if (n > 0 && frames > n)
+               if (n > 0 && frames > (snd_pcm_uframes_t)n)
                        frames = n;
        }
        if (frames == ULONG_MAX) {
@@ -2157,7 +2161,7 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(snd_pcm_substream_t *substream,
                size -= frames;
                xfer += frames;
                if (runtime->status->state == SNDRV_PCM_STATE_PREPARED &&
-                   snd_pcm_playback_hw_avail(runtime) >= runtime->start_threshold) {
+                   snd_pcm_playback_hw_avail(runtime) >= (snd_pcm_sframes_t)runtime->start_threshold) {
                        err = snd_pcm_start(substream);
                        if (err < 0)
                                goto _end_unlock;
@@ -2169,7 +2173,7 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(snd_pcm_substream_t *substream,
  _end_unlock:
        spin_unlock_irq(&runtime->lock);
  _end:
-       return xfer > 0 ? xfer : err;
+       return xfer > 0 ? (snd_pcm_sframes_t)xfer : err;
 }
 
 snd_pcm_sframes_t snd_pcm_lib_write(snd_pcm_substream_t *substream, const void *buf, snd_pcm_uframes_t size)
@@ -2455,7 +2459,7 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream, void
  _end_unlock:
        spin_unlock_irq(&runtime->lock);
  _end:
-       return xfer > 0 ? xfer : err;
+       return xfer > 0 ? (snd_pcm_sframes_t)xfer : err;
 }
 
 snd_pcm_sframes_t snd_pcm_lib_read(snd_pcm_substream_t *substream, void *buf, snd_pcm_uframes_t size)
index b923bfffe51e83504c04ca24bad17d5ac0750a6f..57baf0335f8fc247891170bb194cf90a81e89968 100644 (file)
@@ -40,7 +40,7 @@ MODULE_PARM(maximum_substreams, "i");
 MODULE_PARM_DESC(maximum_substreams, "Maximum substreams with preallocated DMA memory.");
 MODULE_PARM_SYNTAX(maximum_substreams, SNDRV_BOOLEAN_TRUE_DESC);
 
-const static int snd_minimum_buffer = 16384;
+const static size_t snd_minimum_buffer = 16384;
 
 
 /*
index 9b220abfcc9684742e07862053b73b2cca83a2ca..896fc1409b6ab26584ba4f038c7e2c6cb899d2a2 100644 (file)
@@ -1911,7 +1911,7 @@ snd_pcm_sframes_t snd_pcm_playback_rewind(snd_pcm_substream_t *substream, snd_pc
                ret = 0;
                goto __end;
        }
-       if (frames > hw_avail)
+       if (frames > (snd_pcm_uframes_t)hw_avail)
                frames = hw_avail;
        else
                frames -= frames % runtime->xfer_align;
@@ -1960,7 +1960,7 @@ snd_pcm_sframes_t snd_pcm_capture_rewind(snd_pcm_substream_t *substream, snd_pcm
                ret = 0;
                goto __end;
        }
-       if (frames > hw_avail)
+       if (frames > (snd_pcm_uframes_t)hw_avail)
                frames = hw_avail;
        else
                frames -= frames % runtime->xfer_align;
@@ -2740,7 +2740,7 @@ int snd_pcm_mmap_data(snd_pcm_substream_t *substream, struct file *file,
        offset = area->vm_offset;
 #endif
        dma_bytes = PAGE_ALIGN(runtime->dma_bytes);
-       if (size > dma_bytes)
+       if ((size_t)size > dma_bytes)
                return -EINVAL;
        if (offset > dma_bytes - size)
                return -EINVAL;
index 3125e109033d116e433765f2ac9389957f91d8d6..98e4a30f852ada5c9ed018fe04e1b3c2c3c1f461 100644 (file)
@@ -166,7 +166,7 @@ struct page *snd_pcm_sgbuf_ops_page(snd_pcm_substream_t *substream, unsigned lon
        struct snd_sg_buf *sgbuf = snd_magic_cast(snd_pcm_sgbuf_t, substream->dma_private, return NULL);
 
        unsigned int idx = offset >> PAGE_SHIFT;
-       if (idx >= sgbuf->pages)
+       if (idx >= (unsigned int)sgbuf->pages)
                return NULL;
        return sgbuf->page_table[idx];
 }
index 17376907b20fe7c8101a32e19b79e06f46bd90bb..84161c3181afd7b0d13ae3d3a685e0891d69f8a6 100644 (file)
@@ -196,7 +196,7 @@ int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice,
                        err = -ENXIO;
                        goto __error;
                }
-               if (subdevice >= 0 && subdevice >= rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substream_count) {
+               if (subdevice >= 0 && (unsigned int)subdevice >= rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substream_count) {
                        err = -ENODEV;
                        goto __error;
                }
@@ -211,7 +211,7 @@ int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice,
                        err = -ENXIO;
                        goto __error;
                }
-               if (subdevice >= 0 && subdevice >= rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substream_count) {
+               if (subdevice >= 0 && (unsigned int)subdevice >= rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substream_count) {
                        err = -ENODEV;
                        goto __error;
                }
@@ -562,7 +562,7 @@ int snd_rawmidi_info_select(snd_card_t *card, snd_rawmidi_info_t *info)
                return -ENXIO;
        list_for_each(list, &pstr->substreams) {
                substream = list_entry(list, snd_rawmidi_substream_t, list);
-               if (substream->number == info->subdevice)
+               if ((unsigned int)substream->number == info->subdevice)
                        return snd_rawmidi_info(substream, info);
        }
        return -ENXIO;
@@ -851,7 +851,7 @@ int snd_rawmidi_receive(snd_rawmidi_substream_t * substream, const unsigned char
                count1 = runtime->buffer_size - runtime->hw_ptr;
                if (count1 > count)
                        count1 = count;
-               if (count1 > runtime->buffer_size - runtime->avail)
+               if (count1 > (int)(runtime->buffer_size - runtime->avail))
                        count1 = runtime->buffer_size - runtime->avail;
                memcpy(runtime->buffer + runtime->hw_ptr, buffer, count1);
                runtime->hw_ptr += count1;
@@ -862,7 +862,7 @@ int snd_rawmidi_receive(snd_rawmidi_substream_t * substream, const unsigned char
                if (count > 0) {
                        buffer += count1;
                        count1 = count;
-                       if (count1 > runtime->buffer_size - runtime->avail) {
+                       if (count1 > (int)(runtime->buffer_size - runtime->avail)) {
                                count1 = runtime->buffer_size - runtime->avail;
                                runtime->xruns = count - count1;
                        }
@@ -896,7 +896,7 @@ static long snd_rawmidi_kernel_read1(snd_rawmidi_substream_t *substream,
                if (count1 > count)
                        count1 = count;
                spin_lock_irqsave(&runtime->lock, flags);
-               if (count1 > runtime->avail)
+               if (count1 > (int)runtime->avail)
                        count1 = runtime->avail;
                if (kernel) {
                        memcpy(buf + result, runtime->buffer + runtime->appl_ptr, count1);
@@ -1031,7 +1031,7 @@ int snd_rawmidi_transmit_peek(snd_rawmidi_substream_t * substream, unsigned char
                count1 = runtime->buffer_size - runtime->hw_ptr;
                if (count1 > count)
                        count1 = count;
-               if (count1 > runtime->buffer_size - runtime->avail)
+               if (count1 > (int)(runtime->buffer_size - runtime->avail))
                        count1 = runtime->buffer_size - runtime->avail;
                memcpy(buffer, runtime->buffer + runtime->hw_ptr, count1);
                count -= count1;
@@ -1112,7 +1112,7 @@ static long snd_rawmidi_kernel_write1(snd_rawmidi_substream_t * substream, const
        result = 0;
        spin_lock_irqsave(&runtime->lock, flags);
        if (substream->append) {
-               if (runtime->avail < count) {
+               if ((long)runtime->avail < count) {
                        spin_unlock_irqrestore(&runtime->lock, flags);
                        return -EAGAIN;
                }
@@ -1121,7 +1121,7 @@ static long snd_rawmidi_kernel_write1(snd_rawmidi_substream_t * substream, const
                count1 = runtime->buffer_size - runtime->appl_ptr;
                if (count1 > count)
                        count1 = count;
-               if (count1 > runtime->avail)
+               if (count1 > (long)runtime->avail)
                        count1 = runtime->avail;
                if (kernel) {
                        memcpy(runtime->buffer + runtime->appl_ptr, buf, count1);
@@ -1195,7 +1195,7 @@ static ssize_t snd_rawmidi_write(struct file *file, const char *buf, size_t coun
                        continue;
                result += count1;
                buf += count1;
-               if (count1 < count && (file->f_flags & O_NONBLOCK))
+               if ((size_t)count1 < count && (file->f_flags & O_NONBLOCK))
                        break;
                count -= count1;
        }
@@ -1480,7 +1480,7 @@ static int snd_rawmidi_dev_register(snd_device_t *device)
        }
 #ifdef CONFIG_SND_OSSEMUL
        rmidi->ossreg = 0;
-       if (rmidi->device == midi_map[rmidi->card->number]) {
+       if ((int)rmidi->device == midi_map[rmidi->card->number]) {
                if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIDI,
                                            rmidi->card, 0, &snd_rawmidi_reg, name) < 0) {
                        snd_printk(KERN_ERR "unable to register OSS rawmidi device %i:%i\n", rmidi->card->number, 0);
@@ -1491,7 +1491,7 @@ static int snd_rawmidi_dev_register(snd_device_t *device)
 #endif
                }
        }
-       if (rmidi->device == amidi_map[rmidi->card->number]) {
+       if ((int)rmidi->device == amidi_map[rmidi->card->number]) {
                if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIDI,
                                            rmidi->card, 1, &snd_rawmidi_reg, name) < 0) {
                        snd_printk(KERN_ERR "unable to register OSS rawmidi device %i:%i\n", rmidi->card->number, 1);
@@ -1554,13 +1554,13 @@ static int snd_rawmidi_dev_unregister(snd_device_t *device)
        }
 #ifdef CONFIG_SND_OSSEMUL
        if (rmidi->ossreg) {
-               if (rmidi->device == midi_map[rmidi->card->number]) {
+               if ((int)rmidi->device == midi_map[rmidi->card->number]) {
                        snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_MIDI, rmidi->card, 0);
 #ifdef SNDRV_OSS_INFO_DEV_MIDI
                        snd_oss_info_unregister(SNDRV_OSS_INFO_DEV_MIDI, rmidi->card->number);
 #endif
                }
-               if (rmidi->device == amidi_map[rmidi->card->number])
+               if ((int)rmidi->device == amidi_map[rmidi->card->number])
                        snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_MIDI, rmidi->card, 1);
                rmidi->ossreg = 0;
        }
index 7b30c7ac513bbb6f604de5d1f2cbbe4a4e36076e..24a03e45d234dfeee87c0e161ca1d90b7461e2d1 100644 (file)
@@ -37,9 +37,6 @@
 #include <linux/mc146818rtc.h>
 #endif
 
-/* use tasklet for interrupt handling */
-#define USE_TASKLET
-
 #define RTC_FREQ       1024            /* default frequency */
 #define NANO_SEC       1000000000L     /* 10^9 in sec */
 
@@ -69,10 +66,6 @@ static snd_timer_t *rtctimer;
 static atomic_t rtc_inc = ATOMIC_INIT(0);
 static rtc_task_t rtc_task;
 
-/* tasklet */
-#ifdef USE_TASKLET
-static struct tasklet_struct rtc_tq;
-#endif
 
 static int
 rtctimer_open(snd_timer_t *t)
@@ -122,31 +115,13 @@ rtctimer_stop(snd_timer_t *timer)
  */
 static void rtctimer_interrupt(void *private_data)
 {
-       atomic_inc(&rtc_inc);
-#ifdef USE_TASKLET
-       tasklet_hi_schedule(&rtc_tq);
-#else
-       {
-               int ticks = atomic_read(&rtc_inc);
-               snd_timer_interrupt((snd_timer_t*)private_data, ticks);
-               atomic_sub(ticks, &rtc_inc);
-       }
-#endif /* USE_TASKLET */
-}
-
-#ifdef USE_TASKLET
-static void rtctimer_interrupt2(unsigned long private_data)
-{
-       snd_timer_t *timer = (snd_timer_t *)private_data;
        int ticks;
 
-       snd_assert(timer != NULL, return);
-       do {
-               ticks = atomic_read(&rtc_inc);
-               snd_timer_interrupt(timer, ticks);
-       } while (!atomic_sub_and_test(ticks, &rtc_inc));
+       atomic_inc(&rtc_inc);
+       ticks = atomic_read(&rtc_inc);
+       snd_timer_interrupt((snd_timer_t*)private_data, ticks);
+       atomic_sub(ticks, &rtc_inc);
 }
-#endif /* USE_TASKLET */
 
 
 /*
@@ -173,10 +148,6 @@ static int __init rtctimer_init(void)
        if (err < 0)
                return err;
 
-#ifdef USE_TASKLET
-       tasklet_init(&rtc_tq, rtctimer_interrupt2, (unsigned long)timer);
-#endif /* USE_TASKLET */
-
        strcpy(timer->name, "RTC timer");
        timer->hw = rtc_hw;
        timer->hw.resolution = NANO_SEC / rtctimer_freq;
index abed6d88a5dfafa087ec968afe89e11fb6f774e5..db626012befe994c300e1ef233a42d7484252fe9 100644 (file)
@@ -28,7 +28,7 @@ OPL3_OBJS = snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o
 #   <empty string> - CONFIG_SND_SEQUENCER is undefined
 #   otherwise parameter #1 value
 #
-sequencer := $(if $(subst y,,$(CONFIG_SND_SEQUENCER)),m,$(if $(CONFIG_SND_SEQUENCER),$(1)))
+sequencer = $(if $(subst y,,$(CONFIG_SND_SEQUENCER)),$(if $(1),m),$(if $(CONFIG_SND_SEQUENCER),$(1)))
 
 obj-$(CONFIG_SND_SEQUENCER) += snd-seq.o snd-seq-device.o
 ifeq ($(CONFIG_SND_SEQUENCER_OSS),y)
index 9310692d9b2d1d6ef7a0c271095121927206e543..2cf6908060e745cf4f23a373a4b602cd682f1731 100644 (file)
@@ -14,7 +14,7 @@ snd-ainstr-iw-objs := ainstr_iw.o
 #   <empty string> - CONFIG_SND_SEQUENCER is undefined
 #   otherwise parameter #1 value
 #
-sequencer := $(if $(subst y,,$(CONFIG_SND_SEQUENCER)),m,$(if $(CONFIG_SND_SEQUENCER),$(1)))
+sequencer = $(if $(subst y,,$(CONFIG_SND_SEQUENCER)),$(if $(1),m),$(if $(CONFIG_SND_SEQUENCER),$(1)))
 
 # Toplevel Module Dependency
 obj-$(call sequencer,$(CONFIG_SND_ALS100)) += snd-ainstr-fm.o
index 17bf651517180ed32ce8ca60be004066dfa8538a..aabb0c2bb3dfb4aa816a4dd77b53fbdf816ae5e2 100644 (file)
@@ -44,7 +44,7 @@ static int snd_seq_fm_put(void *private_data, snd_seq_kinstr_t *instr,
        if (cmd != SNDRV_SEQ_INSTR_PUT_CMD_CREATE)
                return -EINVAL;
        /* copy instrument data */
-       if (len < sizeof(ix))
+       if (len < (long)sizeof(ix))
                return -EINVAL;
        if (copy_from_user(&ix, instr_data, sizeof(ix)))
                return -EFAULT;
@@ -85,7 +85,7 @@ static int snd_seq_fm_get(void *private_data, snd_seq_kinstr_t *instr,
        
        if (cmd != SNDRV_SEQ_INSTR_GET_CMD_FULL)
                return -EINVAL;
-       if (len < sizeof(ix))
+       if (len < (long)sizeof(ix))
                return -ENOMEM;
        memset(&ix, 0, sizeof(ix));
        ip = (fm_instrument_t *)KINSTR_DATA(instr);
index c2b8f966ab66ceba189d5eeaa0f3c4dc076a2e2a..d1029dfdd76216c694b46b1ce0ecb249d585b8e5 100644 (file)
@@ -58,7 +58,7 @@ static int snd_seq_gf1_copy_wave_from_stream(snd_gf1_ops_t *ops,
        unsigned int real_size;
        
        gfp_mask = atomic ? GFP_ATOMIC : GFP_KERNEL;
-       if (*len < sizeof(xp))
+       if (*len < (long)sizeof(xp))
                return -EINVAL;
        if (copy_from_user(&xp, *data, sizeof(xp)))
                return -EFAULT;
@@ -95,7 +95,7 @@ static int snd_seq_gf1_copy_wave_from_stream(snd_gf1_ops_t *ops,
        wp->scale_frequency = le16_to_cpu(xp.scale_frequency);
        wp->scale_factor = le16_to_cpu(xp.scale_factor);
        real_size = snd_seq_gf1_size(wp->size, wp->format);
-       if (real_size > *len) {
+       if ((long)real_size > *len) {
                kfree(wp);
                return -ENOMEM;
        }
@@ -152,7 +152,7 @@ static int snd_seq_gf1_put(void *private_data, snd_seq_kinstr_t *instr,
                return -EINVAL;
        gfp_mask = atomic ? GFP_ATOMIC : GFP_KERNEL;
        /* copy instrument data */
-       if (len < sizeof(ix))
+       if (len < (long)sizeof(ix))
                return -EINVAL;
        if (copy_from_user(&ix, instr_data, sizeof(ix)))
                return -EFAULT;
@@ -168,7 +168,7 @@ static int snd_seq_gf1_put(void *private_data, snd_seq_kinstr_t *instr,
        ip->effect2 = ix.effect2;
        ip->effect2_depth = ix.effect2_depth;
        /* copy layers */
-       while (len > sizeof(__u32)) {
+       while (len > (long)sizeof(__u32)) {
                __u32 stype;
 
                if (copy_from_user(&stype, instr_data, sizeof(stype)))
@@ -202,7 +202,7 @@ static int snd_seq_gf1_copy_wave_to_stream(snd_gf1_ops_t *ops,
        unsigned int real_size;
        
        for (wp = ip->wave; wp; wp = wp->next) {
-               if (*len < sizeof(xp))
+               if (*len < (long)sizeof(xp))
                        return -ENOMEM;
                memset(&xp, 0, sizeof(xp));
                xp.stype = GF1_STRU_WAVE;
@@ -238,7 +238,7 @@ static int snd_seq_gf1_copy_wave_to_stream(snd_gf1_ops_t *ops,
                *data += sizeof(xp);
                *len -= sizeof(xp);
                real_size = snd_seq_gf1_size(wp->size, wp->format);
-               if (*len < real_size)
+               if (*len < (long)real_size)
                        return -ENOMEM;
                if (ops->get_sample) {
                        err = ops->get_sample(ops->private_data, wp,
@@ -261,7 +261,7 @@ static int snd_seq_gf1_get(void *private_data, snd_seq_kinstr_t *instr,
        
        if (cmd != SNDRV_SEQ_INSTR_GET_CMD_FULL)
                return -EINVAL;
-       if (len < sizeof(ix))
+       if (len < (long)sizeof(ix))
                return -ENOMEM;
        memset(&ix, 0, sizeof(ix));
        ip = (gf1_instrument_t *)KINSTR_DATA(instr);
index 8c21d06e37db5a83a20980c23fcdf68b7a74a694..fd654683c4093f22c373ce482ab37d8483a670c7 100644 (file)
@@ -76,7 +76,7 @@ static int snd_seq_iwffff_copy_env_from_stream(__u32 req_stype,
        ep->index = ex->index;
        rp_last = NULL;
        while (1) {
-               if (*len < sizeof(__u32))
+               if (*len < (long)sizeof(__u32))
                        return -EINVAL;
                if (copy_from_user(&stype, data, sizeof(stype)))
                        return -EFAULT;
@@ -87,7 +87,7 @@ static int snd_seq_iwffff_copy_env_from_stream(__u32 req_stype,
                            stype == IWFFFF_STRU_ENV_RECV)
                                return 0;
                }
-               if (*len < sizeof(rx))
+               if (*len < (long)sizeof(rx))
                        return -EINVAL;
                if (copy_from_user(&rx, *data, sizeof(rx)))
                        return -EFAULT;
@@ -136,7 +136,7 @@ static int snd_seq_iwffff_copy_wave_from_stream(snd_iwffff_ops_t *ops,
        unsigned int real_size;
        
        gfp_mask = atomic ? GFP_ATOMIC : GFP_KERNEL;
-       if (*len < sizeof(xp))
+       if (*len < (long)sizeof(xp))
                return -EINVAL;
        if (copy_from_user(&xp, *data, sizeof(xp)))
                return -EFAULT;
@@ -162,7 +162,7 @@ static int snd_seq_iwffff_copy_wave_from_stream(snd_iwffff_ops_t *ops,
        wp->high_note = xp.high_note;
        real_size = snd_seq_iwffff_size(wp->size, wp->format);
        if (!(wp->format & IWFFFF_WAVE_ROM)) {
-               if (real_size > *len) {
+               if ((long)real_size > *len) {
                        kfree(wp);
                        return -ENOMEM;
                }
@@ -243,7 +243,7 @@ static int snd_seq_iwffff_put(void *private_data, snd_seq_kinstr_t *instr,
                return -EINVAL;
        gfp_mask = atomic ? GFP_ATOMIC : GFP_KERNEL;
        /* copy instrument data */
-       if (len < sizeof(ix))
+       if (len < (long)sizeof(ix))
                return -EINVAL;
        if (copy_from_user(&ix, instr_data, sizeof(ix)))
                return -EFAULT;
@@ -262,7 +262,7 @@ static int snd_seq_iwffff_put(void *private_data, snd_seq_kinstr_t *instr,
        /* copy layers */
        prev_lp = NULL;
        while (len > 0) {
-               if (len < sizeof(iwffff_xlayer_t)) {
+               if (len < (long)sizeof(iwffff_xlayer_t)) {
                        snd_seq_iwffff_instr_free(ops, ip, atomic);
                        return -EINVAL;
                }
@@ -315,7 +315,7 @@ static int snd_seq_iwffff_put(void *private_data, snd_seq_kinstr_t *instr,
                        snd_seq_iwffff_instr_free(ops, ip, atomic);
                        return err;
                }
-               while (len > sizeof(__u32)) {
+               while (len > (long)sizeof(__u32)) {
                        __u32 stype;
 
                        if (copy_from_user(&stype, instr_data, sizeof(stype)))
@@ -363,7 +363,7 @@ static int snd_seq_iwffff_copy_env_to_stream(__u32 req_stype,
        ex->mode = ep->mode;
        ex->index = ep->index;
        for (rp = ep->record; rp; rp = rp->next) {
-               if (*len < sizeof(rx))
+               if (*len < (long)sizeof(rx))
                        return -ENOMEM;
                memset(&rx, 0, sizeof(rx));
                rx.stype = req_stype;
@@ -405,7 +405,7 @@ static int snd_seq_iwffff_copy_wave_to_stream(snd_iwffff_ops_t *ops,
        unsigned int real_size;
        
        for (wp = lp->wave; wp; wp = wp->next) {
-               if (*len < sizeof(xp))
+               if (*len < (long)sizeof(xp))
                        return -ENOMEM;
                memset(&xp, 0, sizeof(xp));
                xp.stype = IWFFFF_STRU_WAVE;
@@ -431,7 +431,7 @@ static int snd_seq_iwffff_copy_wave_to_stream(snd_iwffff_ops_t *ops,
                *len -= sizeof(xp);
                real_size = snd_seq_iwffff_size(wp->size, wp->format);
                if (!(wp->format & IWFFFF_WAVE_ROM)) {
-                       if (*len < real_size)
+                       if (*len < (long)real_size)
                                return -ENOMEM;
                }
                if (ops->get_sample) {
@@ -461,7 +461,7 @@ static int snd_seq_iwffff_get(void *private_data, snd_seq_kinstr_t *instr,
        
        if (cmd != SNDRV_SEQ_INSTR_GET_CMD_FULL)
                return -EINVAL;
-       if (len < sizeof(ix))
+       if (len < (long)sizeof(ix))
                return -ENOMEM;
        memset(&ix, 0, sizeof(ix));
        ip = (iwffff_instrument_t *)KINSTR_DATA(instr);
@@ -478,7 +478,7 @@ static int snd_seq_iwffff_get(void *private_data, snd_seq_kinstr_t *instr,
        instr_data += sizeof(ix);
        len -= sizeof(ix);
        for (lp = ip->layer; lp; lp = lp->next) {
-               if (len < sizeof(lx))
+               if (len < (long)sizeof(lx))
                        return -ENOMEM;
                memset(&lx, 0, sizeof(lx));
                lx.stype = IWFFFF_STRU_LAYER;
index 8cd604fb5da0a4706a02824bf57ff7521b52ad17..575b1e86b4b8953985ba67a1d1de9bf4b298a380 100644 (file)
@@ -67,7 +67,7 @@ static int snd_seq_simple_put(void *private_data, snd_seq_kinstr_t *instr,
                return -EINVAL;
        gfp_mask = atomic ? GFP_ATOMIC : GFP_KERNEL;
        /* copy instrument data */
-       if (len < sizeof(ix))
+       if (len < (long)sizeof(ix))
                return -EINVAL;
        if (copy_from_user(&ix, instr_data, sizeof(ix)))
                return -EFAULT;
@@ -91,7 +91,7 @@ static int snd_seq_simple_put(void *private_data, snd_seq_kinstr_t *instr,
        ip->effect2 = ix.effect2;
        ip->effect2_depth = ix.effect2_depth;
        real_size = snd_seq_simple_size(ip->size, ip->format);
-       if (len < real_size)
+       if (len < (long)real_size)
                return -EINVAL;
        if (ops->put_sample) {
                err = ops->put_sample(ops->private_data, ip,
@@ -113,7 +113,7 @@ static int snd_seq_simple_get(void *private_data, snd_seq_kinstr_t *instr,
        
        if (cmd != SNDRV_SEQ_INSTR_GET_CMD_FULL)
                return -EINVAL;
-       if (len < sizeof(ix))
+       if (len < (long)sizeof(ix))
                return -ENOMEM;
        memset(&ix, 0, sizeof(ix));
        ip = (simple_instrument_t *)KINSTR_DATA(instr);
@@ -137,7 +137,7 @@ static int snd_seq_simple_get(void *private_data, snd_seq_kinstr_t *instr,
        instr_data += sizeof(ix);
        len -= sizeof(ix);
        real_size = snd_seq_simple_size(ip->size, ip->format);
-       if (len < real_size)
+       if (len < (long)real_size)
                return -ENOMEM;
        if (ops->get_sample) {
                err = ops->get_sample(ops->private_data, ip,
index 6df90a100613b63e1d33616a1f9f507562f2fdf4..d80105812850b18e20b3a22362211d3e2d25b6a0 100644 (file)
@@ -1006,7 +1006,7 @@ static ssize_t snd_seq_write(struct file *file, const char *buf, size_t count, l
 
                if (snd_seq_ev_is_variable(&event)) {
                        int extlen = event.data.ext.len & ~SNDRV_SEQ_EXT_MASK;
-                       if (extlen + len > count) {
+                       if ((size_t)(extlen + len) > count) {
                                /* back out, will get an error this time or next */
                                err = -EINVAL;
                                break;
index 88f030ccb4fc5626d81512cb9bad747713aee835..f10d02b438afd5bdf3f5ca1a05a21c5659f17982 100644 (file)
@@ -19,7 +19,7 @@
  *
  *----------------------------------------------------------------
  *
- * This device handler separates the card driver module from sequencer
+ * This device handler seperates the card driver module from sequencer
  * stuff (sequencer core, synth drivers, etc), so that user can avoid
  * to spend unnecessary resources e.g. if he needs only listening to
  * MP3s.
index 891aec5f2175c485d1003007a1bb10049306b02e..97e5b740816d97467389e5cf41da743853af7b58 100644 (file)
@@ -145,7 +145,7 @@ void snd_seq_instr_list_free(snd_seq_kinstr_list_t **list_ptr)
 
 static int instr_free_compare(snd_seq_kinstr_t *instr,
                              snd_seq_instr_header_t *ifree,
-                             int client)
+                             unsigned int client)
 {
        switch (ifree->cmd) {
        case SNDRV_SEQ_INSTR_FREE_CMD_ALL:
@@ -193,7 +193,7 @@ int snd_seq_instr_list_free_cond(snd_seq_kinstr_list_t *list,
                instr = list->hash[idx];
                prev = flist = NULL;
                while (instr) {
-                       while (instr && instr_free_compare(instr, ifree, client)) {
+                       while (instr && instr_free_compare(instr, ifree, (unsigned int)client)) {
                                prev = instr;
                                instr = instr->next;
                        }
index 79a047cc99cb5b84855b68a38da5efd9c00a94b9..29bf81ff69127dfffbaa191834efebffcb3e89f8 100644 (file)
@@ -280,7 +280,8 @@ snd_seq_midisynth_register_port(snd_seq_device_t *dev)
        seq_midisynth_t *msynth, *ms;
        snd_seq_port_info_t port;
        snd_rawmidi_info_t info;
-       int newclient = 0, p, ports;
+       int newclient = 0;
+       unsigned int p, ports;
        snd_seq_client_callback_t callbacks;
        snd_seq_port_callback_t pcallbacks;
        snd_seq_client_info_t inf;
index 0bc8ee757b05e14593fa0d4ff143bf1a38fd346e..9886d137bfe82ef28402720b4ff6f2347c9ce055 100644 (file)
@@ -60,7 +60,7 @@ static void reset_all_channels(snd_midi_channel_set_t *chset);
 
 
 /*
- * Process an event in a driver independent way.  This means dealing
+ * Process an event in a driver independant way.  This means dealing
  * with RPN, NRPN, SysEx etc that are defined for common midi applications
  * such as GM, GS and XG.
  * There modes that this module will run in are:
@@ -258,7 +258,7 @@ note_off(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan, int note, int
 }
 
 /*
- * Do all driver independent operations for this controler and pass
+ * Do all driver independant operations for this controler and pass
  * events that need to take place immediately to the driver.
  */
 static void
@@ -506,7 +506,7 @@ sysex(snd_midi_op_t *ops, void *private, unsigned char *buf, int len, snd_midi_c
        len--;
 
        /* GM on */
-       if (len >= sizeof(gm_on_macro) &&
+       if (len >= (int)sizeof(gm_on_macro) &&
            memcmp(buf, gm_on_macro, sizeof(gm_on_macro)) == 0) {
                if (chset->midi_mode != SNDRV_MIDI_MODE_GS &&
                    chset->midi_mode != SNDRV_MIDI_MODE_XG) {
@@ -568,7 +568,7 @@ sysex(snd_midi_op_t *ops, void *private, unsigned char *buf, int len, snd_midi_c
        }
 
        /* XG on */
-       else if (len >= sizeof(xg_on_macro) &&
+       else if (len >= (int)sizeof(xg_on_macro) &&
                 memcmp(buf, xg_on_macro, sizeof(xg_on_macro)) == 0) {
                int i;
                chset->midi_mode = SNDRV_MIDI_MODE_XG;
index 6455548bec10fbeefdc46e1542273b8d0ab04de7..5c06159b201a527550c3a9143a68e4d15cb18e44 100644 (file)
@@ -108,8 +108,6 @@ static struct extra_event_list_t {
        /*{SNDRV_SEQ_EVENT_REGPARAM, extra_decode_rpn},*/
 };
 
-#define numberof(ary)  (sizeof(ary)/sizeof(ary[0]))
-
 /*
  *  new/delete record
  */
@@ -349,16 +347,16 @@ static void songpos_event(snd_midi_event_t *dev, snd_seq_event_t *ev)
  */
 long snd_midi_event_decode(snd_midi_event_t *dev, unsigned char *buf, long count, snd_seq_event_t *ev)
 {
-       int cmd, type;
+       unsigned int cmd, type;
 
        if (ev->type == SNDRV_SEQ_EVENT_NONE)
                return -ENOENT;
 
-       for (type = 0; type < numberof(status_event); type++) {
+       for (type = 0; type < ARRAY_SIZE(status_event); type++) {
                if (ev->type == status_event[type].event)
                        goto __found;
        }
-       for (type = 0; type < numberof(extra_event); type++) {
+       for (type = 0; type < ARRAY_SIZE(extra_event); type++) {
                if (ev->type == extra_event[type].event)
                        return extra_event[type].decode(dev, buf, count, ev);
        }
index d6654a1ab33682782d58886133062ad502f35659..113c889c9ab1e2e88ee8570b1a687590cf8684ce 100644 (file)
@@ -610,8 +610,7 @@ subscribers_t *snd_seq_port_get_subscription(port_subs_info_t *src_grp,
 /* exported */
 int snd_seq_event_port_attach(int client,
                              snd_seq_port_callback_t *pcbp,
-                             int cap,
-                             int type,
+                             int cap, int type, int midi_channels,
                              char *portname)
 {
        snd_seq_port_info_t portinfo;
@@ -628,6 +627,7 @@ int snd_seq_event_port_attach(int client,
        portinfo.capability = cap;
        portinfo.type = type;
        portinfo.kernel = pcbp;
+       portinfo.midi_channels = midi_channels;
 
        /* Create it */
        ret = snd_seq_kernel_client_ctl(client,
index ee15208790871f764d9c8bd1fd6aa554688a1ba6..b16f02b0026ce52d67134144a3b76eafffd84fd9 100644 (file)
@@ -47,8 +47,6 @@
 #include "seq_timer.h"
 #include "seq_info.h"
 
-static void snd_seq_check_queue_in_tasklet(unsigned long private_data);
-
 /* list of allocated queues */
 static queue_t *queue_list[SNDRV_SEQ_MAX_QUEUES];
 static spinlock_t queue_list_lock = SPIN_LOCK_UNLOCKED;
@@ -123,7 +121,6 @@ static queue_t *queue_new(int owner, int locked)
        spin_lock_init(&q->check_lock);
        init_MUTEX(&q->timer_mutex);
        snd_use_lock_init(&q->use_lock);
-       tasklet_init(&q->taskq, snd_seq_check_queue_in_tasklet, (unsigned long)q);
        q->queue = -1;
 
        q->tickq = snd_seq_prioq_new();
@@ -148,7 +145,7 @@ static queue_t *queue_new(int owner, int locked)
 static void queue_delete(queue_t *q)
 {
        /* stop and release the timer */
-       snd_seq_timer_stop(q->timer, 0);
+       snd_seq_timer_stop(q->timer);
        snd_seq_timer_close(q);
        /* wait until access free */
        snd_use_lock_sync(&q->use_lock);
@@ -258,8 +255,6 @@ queue_t *snd_seq_queue_find_name(char *name)
 void snd_seq_check_queue(queue_t *q, int atomic, int hop)
 {
        unsigned long flags;
-       int dequeue;
-       int rc;
        snd_seq_event_cell_t *cell;
 
        if (q == NULL)
@@ -275,27 +270,13 @@ void snd_seq_check_queue(queue_t *q, int atomic, int hop)
        q->check_blocked = 1;
        spin_unlock_irqrestore(&q->check_lock, flags);
 
-       if (atomic)
-               dequeue = SNDRV_SEQ_MAX_DEQUEUE;
-       else
-               dequeue = 0x7fffffff; /* XXX */
-
       __again:
        /* Process tick queue... */
-
-       /* limit the number of elements dequeued per pass to save the machine from lockups */
-       while (dequeue > 0) {
-
-               cell = snd_seq_prioq_cell_peek(q->tickq);
-               if (cell == NULL)
-                       break;
+       while ((cell = snd_seq_prioq_cell_peek(q->tickq)) != NULL) {
                if (snd_seq_compare_tick_time(&q->timer->tick.cur_tick, &cell->event.time.tick)) {
                        cell = snd_seq_prioq_cell_out(q->tickq);
-                       if (cell != NULL) {
-                               rc = snd_seq_dispatch_event(cell, atomic, hop);
-                               if (rc > 0)
-                                       dequeue -= rc;
-                       }
+                       if (cell)
+                               snd_seq_dispatch_event(cell, atomic, hop);
                } else {
                        /* event remains in the queue */
                        break;
@@ -304,20 +285,11 @@ void snd_seq_check_queue(queue_t *q, int atomic, int hop)
 
 
        /* Process time queue... */
-
-       /* limit the number of elements dequeued per pass to save the machine from lockups */
-       while (dequeue > 0) {
-               cell = snd_seq_prioq_cell_peek(q->timeq);
-               if (cell == NULL)
-                       break;
+       while ((cell = snd_seq_prioq_cell_peek(q->timeq)) != NULL) {
                if (snd_seq_compare_real_time(&q->timer->cur_time, &cell->event.time.time)) {
                        cell = snd_seq_prioq_cell_out(q->timeq);
-                       if (cell != NULL) {
-                               rc = snd_seq_dispatch_event(cell, atomic, hop);
-                               if (rc > 0)
-                                       dequeue -= rc;
-                       }
-
+                       if (cell)
+                               snd_seq_dispatch_event(cell, atomic, hop);
                } else {
                        /* event remains in the queue */
                        break;
@@ -326,23 +298,15 @@ void snd_seq_check_queue(queue_t *q, int atomic, int hop)
 
        /* free lock */
        spin_lock_irqsave(&q->check_lock, flags);
-       if (q->check_again && dequeue > 0) {
+       if (q->check_again) {
                q->check_again = 0;
                spin_unlock_irqrestore(&q->check_lock, flags);
                goto __again;
        }
        q->check_blocked = 0;
-       if (dequeue <= 0 && atomic)
-               tasklet_hi_schedule(&q->taskq);
        spin_unlock_irqrestore(&q->check_lock, flags);
 }
 
-/* tasklet */
-static void snd_seq_check_queue_in_tasklet(unsigned long private_data)
-{
-       queue_t *q = (queue_t *)private_data;
-       snd_seq_check_queue(q, 0, 0);
-}
 
 /* enqueue a event to singe queue */
 int snd_seq_enqueue_event(snd_seq_event_cell_t *cell, int atomic, int hop)
@@ -606,7 +570,7 @@ void snd_seq_queue_client_termination(int client)
                spin_unlock_irqrestore(&q->owner_lock, flags);
                if (q->owner == client) {
                        if (q->timer->running)
-                               snd_seq_timer_stop(q->timer, 0);
+                               snd_seq_timer_stop(q->timer);
                        snd_seq_timer_reset(q->timer);
                }
                queuefree(q);
@@ -716,17 +680,17 @@ void snd_seq_queue_process_event(queue_t *q, snd_seq_event_t *ev, int from_timer
        case SNDRV_SEQ_EVENT_START:
                snd_seq_prioq_leave(q->tickq, ev->source.client, 1);
                snd_seq_prioq_leave(q->timeq, ev->source.client, 1);
-               if (! snd_seq_timer_start(q->timer, atomic))
+               if (! snd_seq_timer_start(q->timer))
                        queue_broadcast_event(q, ev, from_timer_port, atomic, hop);
                break;
 
        case SNDRV_SEQ_EVENT_CONTINUE:
-               if (! snd_seq_timer_continue(q->timer, atomic))
+               if (! snd_seq_timer_continue(q->timer))
                        queue_broadcast_event(q, ev, from_timer_port, atomic, hop);
                break;
 
        case SNDRV_SEQ_EVENT_STOP:
-               snd_seq_timer_stop(q->timer, atomic);
+               snd_seq_timer_stop(q->timer);
                queue_broadcast_event(q, ev, from_timer_port, atomic, hop);
                break;
 
index 686223c8f0f2ffee6172758f0893314e870da75d..7aacbf265427ebdd28bbf0a29e7a08fb4f49c360 100644 (file)
@@ -57,8 +57,6 @@ struct _snd_seq_queue {
        struct semaphore timer_mutex;
 
        snd_use_lock_t use_lock;
-
-       struct tasklet_struct taskq;
 };
 
 
index 0f29289fa1afd049d98c70f0ccc6282fa50d3988..a18c7107c2a90bc9455e7874dc2865628707bfcd 100644 (file)
@@ -88,7 +88,7 @@ void snd_seq_timer_delete(seq_timer_t **tmr)
        t->running = 0;
 
        /* reset time */
-       snd_seq_timer_stop(t, 0);
+       snd_seq_timer_stop(t);
        snd_seq_timer_reset(t);
 
        kfree(t);
@@ -133,10 +133,10 @@ void snd_seq_timer_reset(seq_timer_t * tmr)
 /* called by timer interrupt routine. the period time since previous invocation is passed */
 static void snd_seq_timer_interrupt(snd_timer_instance_t *timeri,
                                    unsigned long resolution,
-                                   unsigned long ticks, void *data)
+                                   unsigned long ticks)
 {
        unsigned long flags;
-       queue_t *q = (queue_t *)data;
+       queue_t *q = (queue_t *)timeri->callback_data;
        seq_timer_t *tmr;
 
        if (q == NULL)
@@ -180,7 +180,7 @@ int snd_seq_timer_set_tempo(seq_timer_t * tmr, int tempo)
        if (tempo <= 0)
                return -EINVAL;
        spin_lock_irqsave(&tmr->lock, flags);
-       if (tempo != tmr->tempo) {
+       if ((unsigned int)tempo != tmr->tempo) {
                tmr->tempo = tempo;
                snd_seq_timer_set_tick_resolution(&tmr->tick, tmr->tempo, tmr->ppq, 1);
        }
@@ -312,17 +312,14 @@ int snd_seq_timer_close(queue_t *q)
        return 0;
 }
 
-int snd_seq_timer_stop(seq_timer_t * tmr, int in_callback)
+int snd_seq_timer_stop(seq_timer_t * tmr)
 {
        if (! tmr->timeri)
                return -EINVAL;
        if (!tmr->running)
                return 0;
        tmr->running = 0;
-       if (in_callback)
-               snd_timer_del(tmr->timeri);
-       else
-               snd_timer_stop(tmr->timeri);
+       snd_timer_stop(tmr->timeri);
        return 0;
 }
 
@@ -348,12 +345,12 @@ static int initialize_timer(seq_timer_t *tmr)
        return 0;
 }
 
-int snd_seq_timer_start(seq_timer_t * tmr, int in_callback)
+int snd_seq_timer_start(seq_timer_t * tmr)
 {
        if (! tmr->timeri)
                return -EINVAL;
        if (tmr->running)
-               snd_seq_timer_stop(tmr, in_callback);
+               snd_seq_timer_stop(tmr);
        snd_seq_timer_reset(tmr);
        if (initialize_timer(tmr) < 0)
                return -EINVAL;
@@ -363,7 +360,7 @@ int snd_seq_timer_start(seq_timer_t * tmr, int in_callback)
        return 0;
 }
 
-int snd_seq_timer_continue(seq_timer_t * tmr, int in_callback)
+int snd_seq_timer_continue(seq_timer_t * tmr)
 {
        if (! tmr->timeri)
                return -EINVAL;
index 4484ef50fb24d2e4fbbea4291d59a740ee885562..662067f44cedf8a042a76a6bb2286380a7ac53a6 100644 (file)
@@ -127,9 +127,9 @@ int snd_seq_timer_midi_open(queue_t *q);
 int snd_seq_timer_midi_close(queue_t *q);
 void snd_seq_timer_defaults(seq_timer_t *tmr);
 void snd_seq_timer_reset(seq_timer_t *tmr);
-int snd_seq_timer_stop(seq_timer_t *tmr, int in_callback);
-int snd_seq_timer_start(seq_timer_t *tmr, int in_callback);
-int snd_seq_timer_continue(seq_timer_t *tmr, int in_callback);
+int snd_seq_timer_stop(seq_timer_t *tmr);
+int snd_seq_timer_start(seq_timer_t *tmr);
+int snd_seq_timer_continue(seq_timer_t *tmr);
 int snd_seq_timer_set_tempo(seq_timer_t *tmr, int tempo);
 int snd_seq_timer_set_ppq(seq_timer_t *tmr, int ppq);
 int snd_seq_timer_set_position_tick(seq_timer_t *tmr, snd_seq_tick_time_t position);
index 51da3f2e7ef9ac16c870afb38ce2c2d44c133694..a9f8f1f6900d81b99301d3663e5b6c346d7145f2 100644 (file)
@@ -478,7 +478,7 @@ EXPORT_SYMBOL(snd_device_free_all);
 #ifdef CONFIG_ISA
 EXPORT_SYMBOL(snd_dma_program);
 EXPORT_SYMBOL(snd_dma_disable);
-EXPORT_SYMBOL(snd_dma_residue);
+EXPORT_SYMBOL(snd_dma_pointer);
 #endif
   /* info.c */
 #ifdef CONFIG_PROC_FS
index e39e4f22ab4373f1e04038ca4cdbad707f7eb091..647726e539e7350331de5f34a1f696a9872e69a5 100644 (file)
@@ -60,6 +60,7 @@ typedef struct {
        snd_timer_read_t *queue;
        spinlock_t qlock;
        wait_queue_head_t qchange_sleep;
+       struct fasync_struct *fasync;
 } snd_timer_user_t;
 
 /* list of timers */
@@ -97,9 +98,9 @@ static snd_timer_instance_t *snd_timer_instance_new(char *owner, snd_timer_t *ti
        }
        INIT_LIST_HEAD(&timeri->open_list);
        INIT_LIST_HEAD(&timeri->active_list);
+       INIT_LIST_HEAD(&timeri->ack_list);
        INIT_LIST_HEAD(&timeri->slave_list_head);
        INIT_LIST_HEAD(&timeri->slave_active_head);
-       timeri->in_use = (atomic_t)ATOMIC_INIT(0);
 
        timeri->timer = timer;
        if (timer && timer->card && !try_module_get(timer->card->module)) {
@@ -185,7 +186,10 @@ static void snd_timer_check_slave(snd_timer_instance_t *slave)
                            slave->slave_id == master->slave_id) {
                                list_del(&slave->open_list);
                                list_add_tail(&slave->open_list, &master->slave_list_head);
+                               spin_lock_irq(&slave_active_lock);
                                slave->master = master;
+                               slave->timer = master->timer;
+                               spin_unlock_irq(&slave_active_lock);
                                return;
                        }
                }
@@ -202,7 +206,6 @@ static void snd_timer_check_master(snd_timer_instance_t *master)
 {
        snd_timer_instance_t *slave;
        struct list_head *p, *n;
-       unsigned long flags;
 
        /* check all pending slaves */
        list_for_each_safe(p, n, &snd_timer_slave_list) {
@@ -211,12 +214,12 @@ static void snd_timer_check_master(snd_timer_instance_t *master)
                    slave->slave_id == master->slave_id) {
                        list_del(p);
                        list_add_tail(p, &master->slave_list_head);
-                       spin_lock_irqsave(&slave_active_lock, flags);
-                       /* protected here so that timer_start() doesn't start
-                        * this slave yet.
-                        */
+                       spin_lock_irq(&slave_active_lock);
                        slave->master = master;
-                       spin_unlock_irqrestore(&slave_active_lock, flags);
+                       slave->timer = master->timer;
+                       if (slave->flags & SNDRV_TIMER_IFLG_RUNNING)
+                               list_add_tail(&slave->active_list, &master->slave_active_head);
+                       spin_unlock_irq(&slave_active_lock);
                }
        }
 }
@@ -275,6 +278,7 @@ snd_timer_instance_t *snd_timer_open(char *owner, snd_timer_id_t *tid,
        return timeri;
 }
 
+static int _snd_timer_stop(snd_timer_instance_t * timeri, int keep_flag);
 
 /*
  * close a timer instance
@@ -282,7 +286,6 @@ snd_timer_instance_t *snd_timer_open(char *owner, snd_timer_id_t *tid,
 int snd_timer_close(snd_timer_instance_t * timeri)
 {
        snd_timer_t *timer = NULL;
-       unsigned long flags;
        struct list_head *p, *n;
        snd_timer_instance_t *slave;
 
@@ -303,13 +306,13 @@ int snd_timer_close(snd_timer_instance_t * timeri)
                /* remove slave links */
                list_for_each_safe(p, n, &timeri->slave_list_head) {
                        slave = (snd_timer_instance_t *)list_entry(p, snd_timer_instance_t, open_list);
+                       spin_lock_irq(&slave_active_lock);
+                       _snd_timer_stop(slave, 1);
                        list_del(p);
                        list_add_tail(p, &snd_timer_slave_list);
-                       spin_lock_irqsave(&slave_active_lock, flags);
-                       slave->flags &= ~SNDRV_TIMER_IFLG_RUNNING;
-                       list_del_init(&slave->active_list);
                        slave->master = NULL;
-                       spin_unlock_irqrestore(&slave_active_lock, flags);
+                       slave->timer = NULL;
+                       spin_unlock_irq(&slave_active_lock);
                }
                up(&register_mutex);
        }
@@ -366,6 +369,9 @@ static int snd_timer_start_slave(snd_timer_instance_t *timeri)
        return 1; /* delayed start */
 }
 
+/*
+ *  start the timer instance
+ */ 
 int snd_timer_start(snd_timer_instance_t * timeri, unsigned int ticks)
 {
        snd_timer_t *timer;
@@ -381,96 +387,59 @@ int snd_timer_start(snd_timer_instance_t * timeri, unsigned int ticks)
                return -EINVAL;
        spin_lock_irqsave(&timer->lock, flags);
        timeri->ticks = timeri->cticks = ticks;
+       timeri->pticks = 0;
        result = snd_timer_start1(timer, timeri, ticks);
        spin_unlock_irqrestore(&timer->lock, flags);
        return result;
 }
 
-/*
- * stop the timer instance.
- *
- * do not call this from the timer callback!
- */
-int snd_timer_stop(snd_timer_instance_t * timeri)
+static int _snd_timer_stop(snd_timer_instance_t * timeri, int keep_flag)
 {
        snd_timer_t *timer;
        unsigned long flags;
 
        snd_assert(timeri != NULL, return -ENXIO);
 
-       if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) {
-               spin_lock_irqsave(&slave_active_lock, flags);
-               if (timeri->flags & SNDRV_TIMER_IFLG_RUNNING) {
-                       timeri->flags &= ~SNDRV_TIMER_IFLG_RUNNING;
-                       list_del_init(&timeri->active_list);
-               }
-               spin_unlock_irqrestore(&slave_active_lock, flags);
-               return 0;
-       }
 
        timer = timeri->timer;
        if (! timer)
                return -EINVAL;
        spin_lock_irqsave(&timer->lock, flags);
-       while (atomic_read(&timeri->in_use)) {
+       list_del_init(&timeri->ack_list);
+       /* wait until the callback is finished */
+       while (timeri->flags & SNDRV_TIMER_IFLG_CALLBACK) {
                spin_unlock_irqrestore(&timer->lock, flags);
                udelay(10);
                spin_lock_irqsave(&timer->lock, flags);
        }
-       if (timeri->flags & SNDRV_TIMER_IFLG_RUNNING) {
-               timeri->flags &= ~SNDRV_TIMER_IFLG_RUNNING;
-               list_del_init(&timeri->active_list);
-               if (!(--timer->running)) {
-                       timer->hw.stop(timer);
-                       if (timer->flags & SNDRV_TIMER_FLG_RESCHED) {
-                               timer->flags &= ~SNDRV_TIMER_FLG_RESCHED;
-                               snd_timer_reschedule(timer, 0);
-                               if (timer->flags & SNDRV_TIMER_FLG_CHANGE) {
-                                       timer->flags &= ~SNDRV_TIMER_FLG_CHANGE;
-                                       timer->hw.start(timer);
-                               }
+       list_del_init(&timeri->active_list);
+       if ((timeri->flags & SNDRV_TIMER_IFLG_RUNNING) &&
+           !(timeri->flags & SNDRV_TIMER_IFLG_SLAVE) &&
+           !(--timer->running)) {
+               timer->hw.stop(timer);
+               if (timer->flags & SNDRV_TIMER_FLG_RESCHED) {
+                       timer->flags &= ~SNDRV_TIMER_FLG_RESCHED;
+                       snd_timer_reschedule(timer, 0);
+                       if (timer->flags & SNDRV_TIMER_FLG_CHANGE) {
+                               timer->flags &= ~SNDRV_TIMER_FLG_CHANGE;
+                               timer->hw.start(timer);
                        }
                }
-       } else if (timeri->flags & SNDRV_TIMER_IFLG_START) {
-               timeri->flags &= ~SNDRV_TIMER_IFLG_START;
-               list_del_init(&timeri->active_list);
        }
+       if (!keep_flag)
+               timeri->flags &= ~(SNDRV_TIMER_IFLG_RUNNING|SNDRV_TIMER_IFLG_START);
        spin_unlock_irqrestore(&timer->lock, flags);
        return 0;
 }
 
 /*
- * delete the timer instance from active list.
+ * stop the timer instance.
  *
- * call this from the timer callback only!
+ * do not call this from the timer callback!
  */
-int snd_timer_del(snd_timer_instance_t * timeri)
+int snd_timer_stop(snd_timer_instance_t * timeri)
 {
-       snd_timer_t *timer;
-
-       snd_assert(timeri != NULL, return -ENXIO);
-
-       if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) {
-               timeri->flags &= ~SNDRV_TIMER_IFLG_RUNNING;
-               list_del_init(&timeri->active_list);
-               return 0;
-       }
-
-       timer = timeri->timer;
-       if (! timer)
-               return -EINVAL;
-       spin_lock(&timer->lock);
-       if (timeri->flags & SNDRV_TIMER_IFLG_RUNNING) {
-               timeri->flags &= ~SNDRV_TIMER_IFLG_RUNNING;
-               list_del_init(&timeri->active_list);
-               if (!(--timer->running))
-                       timer->hw.stop(timer);
-       } else if (timeri->flags & SNDRV_TIMER_IFLG_START) {
-               timeri->flags &= ~SNDRV_TIMER_IFLG_START;
-               list_del_init(&timeri->active_list);
-       }
-       spin_unlock(&timer->lock);
-       return 0;
+       return _snd_timer_stop(timeri, 0);
 }
 
 /*
@@ -492,6 +461,7 @@ int snd_timer_continue(snd_timer_instance_t * timeri)
        spin_lock_irqsave(&timer->lock, flags);
        if (!timeri->cticks)
                timeri->cticks = 1;
+       timeri->pticks = 0;
        result = snd_timer_start1(timer, timeri, timer->sticks);
        spin_unlock_irqrestore(&timer->lock, flags);
        return result;
@@ -532,6 +502,39 @@ static void snd_timer_reschedule(snd_timer_t * timer, unsigned long ticks_left)
        timer->sticks = ticks;
 }
 
+/*
+ * timer tasklet
+ *
+ */
+static void snd_timer_tasklet(unsigned long arg)
+{
+       snd_timer_t *timer = (snd_timer_t *) arg;
+       snd_timer_instance_t *ti;
+       struct list_head *p;
+       unsigned long resolution, ticks;
+
+       spin_lock(&timer->lock);
+       /* now process all callbacks */
+       while (!list_empty(&timer->sack_list_head)) {
+               p = timer->sack_list_head.next;         /* get first item */
+               ti = (snd_timer_instance_t *)list_entry(p, snd_timer_instance_t, ack_list);
+
+               /* remove from ack_list and make empty */
+               list_del_init(p);
+               
+               ticks = ti->pticks;
+               ti->pticks = 0;
+               resolution = ti->resolution;
+
+               ti->flags |= SNDRV_TIMER_IFLG_CALLBACK;
+               spin_unlock(&timer->lock);
+               if (ti->callback)
+                       ti->callback(ti, resolution, ticks);
+               spin_lock(&timer->lock);
+               ti->flags &= ~SNDRV_TIMER_IFLG_CALLBACK;
+       }
+       spin_unlock(&timer->lock);
+}
 
 /*
  * timer interrupt
@@ -542,35 +545,63 @@ static void snd_timer_reschedule(snd_timer_t * timer, unsigned long ticks_left)
 void snd_timer_interrupt(snd_timer_t * timer, unsigned long ticks_left)
 {
        snd_timer_instance_t *ti, *ts;
-       unsigned long resolution;
-       LIST_HEAD(done_list_head);
+       unsigned long resolution, ticks;
        struct list_head *p, *q, *n;
+       int use_tasklet = 0;
 
        if (timer == NULL)
                return;
+
        spin_lock(&timer->lock);
+
+       /* remember the current resolution */
+       if (timer->hw.c_resolution)
+               resolution = timer->hw.c_resolution(timer);
+       else
+               resolution = timer->hw.resolution;
+
        /* loop for all active instances
         * here we cannot use list_for_each because the active_list of a processed
         * instance is relinked to done_list_head before callback is called.
         */
        list_for_each_safe(p, n, &timer->active_list_head) {
                ti = (snd_timer_instance_t *)list_entry(p, snd_timer_instance_t, active_list);
-               if (ti->flags & SNDRV_TIMER_IFLG_RUNNING) {
-                       if (ti->cticks < ticks_left)
-                               ti->cticks = 0;
-                       else
-                               ti->cticks -= ticks_left;
-                       if (!ti->cticks) { /* expired */
-                               if (ti->flags & SNDRV_TIMER_IFLG_AUTO) {
-                                       ti->cticks = ti->ticks;
+               if (!(ti->flags & SNDRV_TIMER_IFLG_RUNNING))
+                       continue;
+               ti->pticks += ticks_left;
+               ti->resolution = resolution;
+               if (ti->cticks < ticks_left)
+                       ti->cticks = 0;
+               else
+                       ti->cticks -= ticks_left;
+               if (ti->cticks) /* not expired */
+                       continue;
+               if (ti->flags & SNDRV_TIMER_IFLG_AUTO) {
+                       ti->cticks = ti->ticks;
+               } else {
+                       ti->flags &= ~SNDRV_TIMER_IFLG_RUNNING;
+                       if (--timer->running)
+                               list_del(p);
+               }
+               if (list_empty(&ti->ack_list)) {
+                       if ((timer->hw.flags & SNDRV_TIMER_HW_TASKLET) ||
+                           (ti->flags & SNDRV_TIMER_IFLG_FAST)) {
+                               list_add_tail(&ti->ack_list, &timer->ack_list_head);
+                       } else {
+                               list_add_tail(&ti->ack_list, &timer->sack_list_head);
+                       }
+               }
+               list_for_each(q, &ti->slave_active_head) {
+                       ts = (snd_timer_instance_t *)list_entry(q, snd_timer_instance_t, active_list);
+                       ts->pticks = ti->pticks;
+                       ts->resolution = resolution;
+                       if (list_empty(&ts->ack_list)) {
+                               if ((timer->hw.flags & SNDRV_TIMER_HW_TASKLET) ||
+                                   (ti->flags & SNDRV_TIMER_IFLG_FAST)) {
+                                       list_add_tail(&ts->ack_list, &timer->ack_list_head);
                                } else {
-                                       ti->flags &= ~SNDRV_TIMER_IFLG_RUNNING;
-                                       timer->running--;
+                                       list_add_tail(&ts->ack_list, &timer->sack_list_head);
                                }
-                               /* relink to done_list */
-                               list_del(p);
-                               list_add_tail(p, &done_list_head);
-                               atomic_inc(&ti->in_use);
                        }
                }
        }
@@ -591,36 +622,32 @@ void snd_timer_interrupt(snd_timer_t * timer, unsigned long ticks_left)
                timer->hw.stop(timer);
        }
 
-       /* remember the current resolution */
-       if (timer->hw.c_resolution)
-               resolution = timer->hw.c_resolution(timer);
-       else
-               resolution = timer->hw.resolution;
+       /* now process all fast callbacks */
+       while (!list_empty(&timer->ack_list_head)) {
+               p = timer->ack_list_head.next;          /* get first item */
+               ti = (snd_timer_instance_t *)list_entry(p, snd_timer_instance_t, ack_list);
+               
+               /* remove from ack_list and make empty */
+               list_del_init(p);
+               
+               ticks = ti->pticks;
+               ti->pticks = 0;
 
-       /* now process all callbacks */
-       list_for_each_safe(p, n, &done_list_head) {
-               ti = (snd_timer_instance_t *)list_entry(p, snd_timer_instance_t, active_list);
-               /* append to active_list */
-               list_del(p);
-               if (ti->flags & SNDRV_TIMER_IFLG_RUNNING)
-                       list_add_tail(p, &timer->active_list_head);
+               ti->flags |= SNDRV_TIMER_IFLG_CALLBACK;
                spin_unlock(&timer->lock);
                if (ti->callback)
-                       ti->callback(ti, resolution, ti->ticks, ti->callback_data);
-               spin_lock(&slave_active_lock);
-               /* call callbacks of slaves */
-               list_for_each(q, &ti->slave_active_head) {
-                       ts = (snd_timer_instance_t *)list_entry(q, snd_timer_instance_t, active_list);
-                       if (ts->callback)
-                               ts->callback(ts, resolution, ti->ticks, ts->callback_data);
-               }
-               spin_unlock(&slave_active_lock);
+                       ti->callback(ti, resolution, ticks);
                spin_lock(&timer->lock);
-               atomic_dec(&ti->in_use);
+               ti->flags &= ~SNDRV_TIMER_IFLG_CALLBACK;
        }
+
+       /* do we have any slow callbacks? */
+       use_tasklet = !list_empty(&timer->sack_list_head);
        spin_unlock(&timer->lock);
-}
 
+       if (use_tasklet)
+               tasklet_hi_schedule(&timer->task_queue);
+}
 
 /*
 
@@ -651,7 +678,10 @@ int snd_timer_new(snd_card_t *card, char *id, snd_timer_id_t *tid, snd_timer_t *
        INIT_LIST_HEAD(&timer->device_list);
        INIT_LIST_HEAD(&timer->open_list_head);
        INIT_LIST_HEAD(&timer->active_list_head);
+       INIT_LIST_HEAD(&timer->ack_list_head);
+       INIT_LIST_HEAD(&timer->sack_list_head);
        spin_lock_init(&timer->lock);
+       tasklet_init(&timer->task_queue, snd_timer_tasklet, (unsigned long)timer);
        if (card != NULL) {
                if ((err = snd_device_new(card, SNDRV_DEV_TIMER, timer, &ops)) < 0) {
                        snd_timer_free(timer);
@@ -815,7 +845,7 @@ static int snd_timer_s_stop(snd_timer_t * timer)
 
 static struct _snd_timer_hardware snd_timer_system =
 {
-       .flags =        SNDRV_TIMER_HW_FIRST,
+       .flags =        SNDRV_TIMER_HW_FIRST | SNDRV_TIMER_HW_TASKLET,
        .resolution =   1000000000L / HZ,
        .ticks =        10000000L,
        .start =        snd_timer_s_start,
@@ -904,23 +934,26 @@ static void snd_timer_proc_read(snd_info_entry_t *entry,
 
 static void snd_timer_user_interrupt(snd_timer_instance_t *timeri,
                                     unsigned long resolution,
-                                    unsigned long ticks,
-                                    void *data)
+                                    unsigned long ticks)
 {
-       unsigned long flags;
-       snd_timer_user_t *tu = snd_magic_cast(snd_timer_user_t, data, return);
+       snd_timer_user_t *tu = snd_magic_cast(snd_timer_user_t, timeri->callback_data, return);
        snd_timer_read_t *r;
+       int _wake = 0;
        
+       spin_lock(&tu->qlock);
        if (tu->qused >= tu->queue_size) {
                tu->overrun++;
        } else {
-               spin_lock_irqsave(&tu->qlock, flags);
                r = &tu->queue[tu->qtail++];
                tu->qtail %= tu->queue_size;
                r->resolution = resolution;
                r->ticks = ticks;
                tu->qused++;
-               spin_unlock_irqrestore(&tu->qlock, flags);
+               _wake++;
+       }
+       spin_unlock(&tu->qlock);
+       if (_wake) {
+               kill_fasync(&tu->fasync, SIGIO, POLL_IN);
                wake_up(&tu->qchange_sleep);
        }
 }
@@ -952,6 +985,7 @@ static int snd_timer_user_release(struct inode *inode, struct file *file)
        if (file->private_data) {
                tu = snd_magic_cast(snd_timer_user_t, file->private_data, return -ENXIO);
                file->private_data = NULL;
+               fasync_helper(-1, file, 0, &tu->fasync);
                if (tu->timeri)
                        snd_timer_close(tu->timeri);
                if (tu->queue)
@@ -1086,6 +1120,7 @@ static int snd_timer_user_tselect(struct file *file, snd_timer_select_t *_tselec
                tselect.id.dev_sclass = SNDRV_TIMER_SCLASS_APPLICATION;
        if ((tu->timeri = snd_timer_open(str, &tselect.id, current->pid)) == NULL)
                return -ENODEV;
+       tu->timeri->flags |= SNDRV_TIMER_IFLG_FAST;
        tu->timeri->callback = snd_timer_user_interrupt;
        tu->timeri->callback_data = (void *)tu;
        return 0;
@@ -1145,7 +1180,7 @@ static int snd_timer_user_params(struct file *file, snd_timer_params_t *_params)
                tu->timeri->flags &= ~SNDRV_TIMER_IFLG_AUTO;
        }
        spin_unlock_irqrestore(&t->lock, flags);
-       if (params.queue_size > 0 && tu->queue_size != params.queue_size) {
+       if (params.queue_size > 0 && (unsigned int)tu->queue_size != params.queue_size) {
                tr = (snd_timer_read_t *)kmalloc(params.queue_size * sizeof(snd_timer_read_t), GFP_KERNEL);
                if (tr) {
                        kfree(tu->queue);
@@ -1247,6 +1282,18 @@ static int snd_timer_user_ioctl(struct inode *inode, struct file *file,
        return -ENOTTY;
 }
 
+static int snd_timer_user_fasync(int fd, struct file * file, int on)
+{
+       snd_timer_user_t *tu;
+       int err;
+       
+       tu = snd_magic_cast(snd_timer_user_t, file->private_data, return -ENXIO);
+       err = fasync_helper(fd, file, on, &tu->fasync);
+        if (err < 0)
+               return err;
+       return 0;
+}
+
 static ssize_t snd_timer_user_read(struct file *file, char *buffer, size_t count, loff_t *offset)
 {
        snd_timer_user_t *tu;
@@ -1254,8 +1301,8 @@ static ssize_t snd_timer_user_read(struct file *file, char *buffer, size_t count
        int  err = 0;
        
        tu = snd_magic_cast(snd_timer_user_t, file->private_data, return -ENXIO);
+       spin_lock_irq(&tu->qlock);
        while (count - result >= sizeof(snd_timer_read_t)) {
-               spin_lock_irq(&tu->qlock);
                while (!tu->qused) {
                        wait_queue_t wait;
 
@@ -1269,7 +1316,7 @@ static ssize_t snd_timer_user_read(struct file *file, char *buffer, size_t count
                        init_waitqueue_entry(&wait, current);
                        add_wait_queue(&tu->qchange_sleep, &wait);
 
-                       spin_unlock(&tu->qlock);
+                       spin_unlock_irq(&tu->qlock);
                        schedule();
                        spin_lock_irq(&tu->qlock);
 
@@ -1291,11 +1338,12 @@ static ssize_t snd_timer_user_read(struct file *file, char *buffer, size_t count
                }
 
                tu->qhead %= tu->queue_size;
-               spin_lock_irq(&tu->qlock);
-               tu->qused--;
-               spin_unlock_irq(&tu->qlock);
+
                result += sizeof(snd_timer_read_t);
                buffer += sizeof(snd_timer_read_t);
+
+               spin_lock_irq(&tu->qlock);
+               tu->qused--;
        }
        return result > 0 ? result : err;
 }
@@ -1326,6 +1374,7 @@ static struct file_operations snd_timer_f_ops =
        .release =      snd_timer_user_release,
        .poll =         snd_timer_user_poll,
        .ioctl =        snd_timer_user_ioctl,
+       .fasync =       snd_timer_user_fasync,
 };
 
 static snd_minor_t snd_timer_reg =
@@ -1393,7 +1442,6 @@ EXPORT_SYMBOL(snd_timer_close);
 EXPORT_SYMBOL(snd_timer_resolution);
 EXPORT_SYMBOL(snd_timer_start);
 EXPORT_SYMBOL(snd_timer_stop);
-EXPORT_SYMBOL(snd_timer_del);
 EXPORT_SYMBOL(snd_timer_continue);
 EXPORT_SYMBOL(snd_timer_new);
 EXPORT_SYMBOL(snd_timer_global_new);
index a1fb58dd2bacbdd89ace6ebc52a3eb2d9c979193..31dde5a92689a8df1a6940aafd27b1a57d5dcaa7 100644 (file)
@@ -520,7 +520,8 @@ DUMMY_CAPSRC("CD Capture Switch", 0, MIXER_ADDR_MASTER)
 int __init snd_card_dummy_new_mixer(snd_card_dummy_t * dummy)
 {
        snd_card_t *card = dummy->card;
-       int idx, err;
+       unsigned int idx;
+       int err;
 
        snd_assert(dummy != NULL, return -EINVAL);
        spin_lock_init(&dummy->mixer_lock);
index 73aa429cedbd23bea40129fbc2b67041db3a9699..71ae482028603b90c82b166916fe3b2f483130b7 100644 (file)
@@ -503,7 +503,7 @@ static void snd_mtpav_inmidi_process(mtpav_t *mcrd, u8 inbyte)
 {
        mtpav_port_t *portp;
 
-       if (mcrd->inmidiport > mcrd->num_ports * 2 + MTPAV_PIDX_BROADCAST)
+       if ((int)mcrd->inmidiport > mcrd->num_ports * 2 + MTPAV_PIDX_BROADCAST)
                return;
 
        portp = &mcrd->ports[mcrd->inmidiport];
index d270babec90a5b9e24523a4faf1e5a33a52d33b3..3ae66068b1756ce3886de012547f0d2883ee986b 100644 (file)
@@ -101,6 +101,7 @@ static int snd_opl3_oss_create_port(opl3_t * opl3)
                                                          SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC |
                                                          SNDRV_SEQ_PORT_TYPE_MIDI_GM |
                                                          SNDRV_SEQ_PORT_TYPE_SYNTH,
+                                                         voices,
                                                          name);
        if (opl3->oss_chset->port < 0) {
                snd_midi_channel_free_set(opl3->oss_chset);
@@ -228,7 +229,7 @@ static int snd_opl3_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format,
 
                mm_segment_t fs;
 
-               if (count < sizeof(sbi)) {
+               if (count < (int)sizeof(sbi)) {
                        snd_printk("FM Error: Patch record too short\n");
                        return -EINVAL;
                }
index c1f8429679f3cf8b694961b41a3f7844d7a68022..1a8b098a49f2aaeea12c0f9867881c83724aaf48 100644 (file)
@@ -204,6 +204,7 @@ static int snd_opl3_synth_create_port(opl3_t * opl3)
                                                      SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC |
                                                      SNDRV_SEQ_PORT_TYPE_MIDI_GM |
                                                      SNDRV_SEQ_PORT_TYPE_SYNTH,
+                                                     16,
                                                      name);
        if (opl3->chset->port < 0) {
                snd_midi_channel_free_set(opl3->chset);
index b2e218e71cbd5f307ce4a46058a852afcba3696c..9be22bad31d05cccd4517dd353add58ec23b71c8 100644 (file)
@@ -396,7 +396,8 @@ int snd_cs8427_iec958_build(snd_i2c_device_t *cs8427,
 {
        cs8427_t *chip = snd_magic_cast(cs8427_t, cs8427->private_data, return -ENXIO);
        snd_kcontrol_t *kctl;
-       int idx, err;
+       unsigned int idx;
+       int err;
 
        snd_assert(play_substream && cap_substream, return -EINVAL);
        for (idx = 0; idx < CONTROLS; idx++) {
index 5c05354890150fa5c3b3875bc33b4755aedb5574..8b0b1bb3cb383bc547cf147056e07f645de4cd98 100644 (file)
@@ -281,7 +281,8 @@ int snd_tea6330t_update_mixer(snd_card_t * card,
        snd_i2c_device_t *device;
        tea6330t_t *tea;
        snd_kcontrol_new_t *knew;
-       int idx, err = -ENOMEM;
+       unsigned int idx;
+       int err = -ENOMEM;
        u8 default_treble, default_bass;
        unsigned char bytes[7];
 
index 6e3edc72488972ec5ef61003d0e0f0f206c53c86..c962965545c1788066c640180e8bf2ef2cf54eaa 100644 (file)
@@ -296,7 +296,7 @@ static snd_pcm_uframes_t snd_ad1816a_playback_pointer(snd_pcm_substream_t *subst
        size_t ptr;
        if (!(chip->mode & AD1816A_MODE_PLAYBACK))
                return 0;
-       ptr = chip->p_dma_size - snd_dma_residue(chip->dma1);
+       ptr = snd_dma_pointer(chip->dma1, chip->p_dma_size);
        return bytes_to_frames(substream->runtime, ptr);
 }
 
@@ -306,7 +306,7 @@ static snd_pcm_uframes_t snd_ad1816a_capture_pointer(snd_pcm_substream_t *substr
        size_t ptr;
        if (!(chip->mode & AD1816A_MODE_CAPTURE))
                return 0;
-       ptr = chip->c_dma_size - snd_dma_residue(chip->dma2);
+       ptr = snd_dma_pointer(chip->dma2, chip->c_dma_size);
        return bytes_to_frames(substream->runtime, ptr);
 }
 
@@ -934,7 +934,8 @@ AD1816A_SINGLE("3D Control - Level", AD1816A_3D_PHAT_CTRL, 0, 15, 0),
 int snd_ad1816a_mixer(ad1816a_t *chip)
 {
        snd_card_t *card;
-       int err, idx;
+       unsigned int idx;
+       int err;
 
        snd_assert(chip != NULL && chip->card != NULL, return -EINVAL);
 
index 0a5a5a58daf2756417d65d3eb79539eb41c61802..840c448079f98aa8b4e52239bf1a5eacb81aac9c 100644 (file)
@@ -605,7 +605,7 @@ static snd_pcm_uframes_t snd_ad1848_playback_pointer(snd_pcm_substream_t * subst
        
        if (!(chip->image[AD1848_IFACE_CTRL] & AD1848_PLAYBACK_ENABLE))
                return 0;
-       ptr = chip->dma_size - snd_dma_residue(chip->dma);
+       ptr = snd_dma_pointer(chip->dma, chip->dma_size);
        return bytes_to_frames(substream->runtime, ptr);
 }
 
@@ -616,7 +616,7 @@ static snd_pcm_uframes_t snd_ad1848_capture_pointer(snd_pcm_substream_t * substr
 
        if (!(chip->image[AD1848_IFACE_CTRL] & AD1848_CAPTURE_ENABLE))
                return 0;
-       ptr = chip->dma_size - snd_dma_residue(chip->dma);
+       ptr = snd_dma_pointer(chip->dma, chip->dma_size);
        return bytes_to_frames(substream->runtime, ptr);
 }
 
@@ -1178,7 +1178,8 @@ int snd_ad1848_mixer(ad1848_t *chip)
 {
        snd_card_t *card;
        snd_pcm_t *pcm;
-       int err, idx;
+       unsigned int idx;
+       int err;
 
        snd_assert(chip != NULL && chip->pcm != NULL, return -EINVAL);
 
index 890434a42622501cf0fda5873cad8908ee606537..5ad8f334fd73fef3c68212c7eb910489aecba75f 100644 (file)
@@ -285,7 +285,8 @@ static int __init cmi8330_add_sb_mixers(sb_t *chip)
 
 static int __init snd_cmi8330_mixer(snd_card_t *card, struct snd_cmi8330 *acard)
 {
-       int idx, err;
+       unsigned int idx;
+       int err;
 
        strcpy(card->mixername, "CMI8330/C3D");
 
index 7aeaf531df9755cd61b25c951d553446281338c8..dc563e7528c149187a24571cd464bed03ff9a78a 100644 (file)
@@ -999,7 +999,7 @@ static snd_pcm_uframes_t snd_cs4231_playback_pointer(snd_pcm_substream_t * subst
 
        if (!(chip->image[CS4231_IFACE_CTRL] & CS4231_PLAYBACK_ENABLE))
                return 0;
-       ptr = chip->p_dma_size - snd_dma_residue(chip->dma1);
+       ptr = snd_dma_pointer(chip->dma1, chip->p_dma_size);
        return bytes_to_frames(substream->runtime, ptr);
 }
 
@@ -1010,7 +1010,7 @@ static snd_pcm_uframes_t snd_cs4231_capture_pointer(snd_pcm_substream_t * substr
        
        if (!(chip->image[CS4231_IFACE_CTRL] & CS4231_RECORD_ENABLE))
                return 0;
-       ptr = chip->c_dma_size - snd_dma_residue(chip->dma2);
+       ptr = snd_dma_pointer(chip->dma2, chip->c_dma_size);
        return bytes_to_frames(substream->runtime, ptr);
 }
 #endif /* LEGACY_SUPPORT */
@@ -1903,7 +1903,8 @@ CS4231_SINGLE("Loopback Capture Volume", 0, CS4231_LOOPBACK, 2, 63, 1)
 int snd_cs4231_mixer(cs4231_t *chip)
 {
        snd_card_t *card;
-       int err, idx;
+       unsigned int idx;
+       int err;
 
        snd_assert(chip != NULL && chip->pcm != NULL, return -EINVAL);
 
index 7ff8546cbdd8bf9f1379ccbff14d6514fe34da46..13def629b11bac6dc2dfd2760b4a7c06c5cad628 100644 (file)
@@ -328,7 +328,7 @@ static int __init snd_card_cs4236_isapnp(int dev, struct snd_card_cs4236 *acard)
        sb_port[dev] = pdev->resource[2].start;
        irq[dev] = pdev->irq_resource[0].start;
        dma1[dev] = pdev->dma_resource[0].start;
-       dma2[dev] = pdev->dma_resource[1].start == 4 ? -1 : pdev->dma_resource[1].start;
+       dma2[dev] = pdev->dma_resource[1].start == 4 ? -1 : (int)pdev->dma_resource[1].start;
        snd_printdd("isapnp WSS: wss port=0x%lx, fm port=0x%lx, sb port=0x%lx\n",
                        port[dev], fm_port[dev], sb_port[dev]);
        snd_printdd("isapnp WSS: irq=%i, dma1=%i, dma2=%i\n",
index f66ed095675729144eda53318d68fbb5544c8884..0aa6d72c863d11a83fa44bc6ba0e2f19de7183d2 100644 (file)
@@ -270,7 +270,8 @@ int snd_cs4236_create(snd_card_t * card,
 {
        cs4231_t *chip;
        unsigned char ver1, ver2;
-       int err, reg;
+       unsigned int reg;
+       int err;
 
        *rchip = NULL;
        if (hardware == CS4231_HW_DETECT)
@@ -908,7 +909,8 @@ CS4236_SINGLEC("3D Control - IEC958", 0, 3, 5, 1, 0)
 int snd_cs4236_mixer(cs4231_t *chip)
 {
        snd_card_t *card;
-       int err, idx, count;
+       unsigned int idx, count;
+       int err;
        snd_kcontrol_new_t *kcontrol;
 
        snd_assert(chip != NULL && chip->card != NULL, return -EINVAL);
@@ -942,7 +944,7 @@ int snd_cs4236_mixer(cs4231_t *chip)
                kcontrol = snd_cs4236_3d_controls_cs4238;
                break;
        default:
-               count = -1;
+               count = 0;
                kcontrol = NULL;
        }
        for (idx = 0; idx < count; idx++, kcontrol++) {
index c9b4d3701f2df0ed3639450f94caf0b957feec16..5d8ceba7a2e98bfb422ff0bc7f8d79c014978e3e 100644 (file)
@@ -346,7 +346,7 @@ static int snd_es1688_trigger(es1688_t *chip, int cmd, unsigned char value)
        }
 #if 0
        printk("trigger: val = 0x%x, value = 0x%x\n", val, value);
-       printk("trigger: residue = 0x%x\n", get_dma_residue(chip->dma8));
+       printk("trigger: pointer = 0x%x\n", snd_dma_pointer(chip->dma8, chip->dma_size));
 #endif
        snd_es1688_write(chip, 0xb8, (val & 0xf0) | value);
        spin_unlock(&chip->reg_lock);
@@ -501,7 +501,7 @@ static snd_pcm_uframes_t snd_es1688_playback_pointer(snd_pcm_substream_t * subst
        
        if (chip->trigger_value != 0x05)
                return 0;
-       ptr = chip->dma_size - snd_dma_residue(chip->dma8);
+       ptr = snd_dma_pointer(chip->dma8, chip->dma_size);
        return bytes_to_frames(substream->runtime, ptr);
 }
 
@@ -512,7 +512,7 @@ static snd_pcm_uframes_t snd_es1688_capture_pointer(snd_pcm_substream_t * substr
        
        if (chip->trigger_value != 0x0f)
                return 0;
-       ptr = chip->dma_size - snd_dma_residue(chip->dma8);
+       ptr = snd_dma_pointer(chip->dma8, chip->dma_size);
        return bytes_to_frames(substream->runtime, ptr);
 }
 
@@ -1014,7 +1014,8 @@ static unsigned char snd_es1688_init_table[][2] = {
 int snd_es1688_mixer(es1688_t *chip)
 {
        snd_card_t *card;
-       int err, idx;
+       unsigned int idx;
+       int err;
        unsigned char reg, val;
 
        snd_assert(chip != NULL && chip->card != NULL, return -EINVAL);
index 31442b641067156cdccc8e9becd48dd0a820a3d7..73eb6d753efd95e83cdf268f394d7beb78dc7e3b 100644 (file)
@@ -801,12 +801,12 @@ static snd_pcm_uframes_t snd_es18xx_playback_pointer(snd_pcm_substream_t * subst
        if (substream->number == 0 && (chip->caps & ES18XX_PCM2)) {
                if (!(chip->active & DAC2))
                        return 0;
-               pos = chip->dma2_size - snd_dma_residue(chip->dma2);
+               pos = snd_dma_pointer(chip->dma2, chip->dma2_size);
                return pos >> chip->dma2_shift;
        } else {
                if (!(chip->active & DAC1))
                        return 0;
-               pos = chip->dma1_size - snd_dma_residue(chip->dma1);
+               pos = snd_dma_pointer(chip->dma1, chip->dma1_size);
                return pos >> chip->dma1_shift;
        }
 }
@@ -818,7 +818,7 @@ static snd_pcm_uframes_t snd_es18xx_capture_pointer(snd_pcm_substream_t * substr
 
         if (!(chip->active & ADC1))
                 return 0;
-       pos = chip->dma1_size - snd_dma_residue(chip->dma1);
+       pos = snd_dma_pointer(chip->dma1, chip->dma1_size);
        return pos >> chip->dma1_shift;
 }
 
@@ -1786,14 +1786,14 @@ static int __init snd_es18xx_new_device(snd_card_t * card,
 static int __init snd_es18xx_mixer(es18xx_t *chip)
 {
        snd_card_t *card;
-       int err, idx;
+       int err;
+       unsigned int idx;
 
        card = chip->card;
 
        strcpy(card->mixername, chip->pcm->name);
 
-       for (idx = 0; idx < sizeof(snd_es18xx_base_controls) / 
-                    sizeof(snd_es18xx_base_controls[0]); idx++) {
+       for (idx = 0; idx < ARRAY_SIZE(snd_es18xx_base_controls); idx++) {
                snd_kcontrol_t *kctl;
                kctl = snd_ctl_new1(&snd_es18xx_base_controls[idx], chip);
                if (chip->caps & ES18XX_HWV) {
@@ -1812,14 +1812,12 @@ static int __init snd_es18xx_mixer(es18xx_t *chip)
                        return err;
        }
        if (chip->caps & ES18XX_PCM2) {
-               for (idx = 0; idx < sizeof(snd_es18xx_pcm2_controls) / 
-                            sizeof(snd_es18xx_pcm2_controls[0]); idx++) {
+               for (idx = 0; idx < ARRAY_SIZE(snd_es18xx_pcm2_controls); idx++) {
                        if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_pcm2_controls[idx], chip))) < 0)
                                return err;
                } 
        } else {
-               for (idx = 0; idx < sizeof(snd_es18xx_pcm1_controls) / 
-                            sizeof(snd_es18xx_pcm1_controls[0]); idx++) {
+               for (idx = 0; idx < ARRAY_SIZE(snd_es18xx_pcm1_controls); idx++) {
                        if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_pcm1_controls[idx], chip))) < 0)
                                return err;
                }
@@ -1830,8 +1828,7 @@ static int __init snd_es18xx_mixer(es18xx_t *chip)
                        return err;
        }
        if (chip->caps & ES18XX_RECMIX) {
-               for (idx = 0; idx < sizeof(snd_es18xx_recmix_controls) / 
-                            sizeof(snd_es18xx_recmix_controls[0]); idx++) {
+               for (idx = 0; idx < ARRAY_SIZE(snd_es18xx_recmix_controls); idx++) {
                        if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_recmix_controls[idx], chip))) < 0)
                                return err;
                }
@@ -1848,15 +1845,13 @@ static int __init snd_es18xx_mixer(es18xx_t *chip)
                break;
        }
        if (chip->caps & ES18XX_SPATIALIZER) {
-               for (idx = 0; idx < sizeof(snd_es18xx_spatializer_controls) / 
-                            sizeof(snd_es18xx_spatializer_controls[0]); idx++) {
+               for (idx = 0; idx < ARRAY_SIZE(snd_es18xx_spatializer_controls); idx++) {
                        if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_spatializer_controls[idx], chip))) < 0)
                                return err;
                }
        }
        if (chip->caps & ES18XX_HWV) {
-               for (idx = 0; idx < sizeof(snd_es18xx_hw_volume_controls) / 
-                            sizeof(snd_es18xx_hw_volume_controls[0]); idx++) {
+               for (idx = 0; idx < ARRAY_SIZE(snd_es18xx_hw_volume_controls); idx++) {
                        snd_kcontrol_t *kctl;
                        kctl = snd_ctl_new1(&snd_es18xx_hw_volume_controls[idx], chip);
                        if (idx == 0)
index 12a48b252066fada17057066a0e408bc37483b1a..00df354fd4b477062ac901939de983908d474e79 100644 (file)
@@ -23,7 +23,7 @@ snd-interwave-stb-objs := interwave-stb.o
 #   <empty string> - CONFIG_SND_SEQUENCER is undefined
 #   otherwise parameter #1 value
 #
-sequencer := $(if $(subst y,,$(CONFIG_SND_SEQUENCER)),m,$(if $(CONFIG_SND_SEQUENCER),$(1)))
+sequencer = $(if $(subst y,,$(CONFIG_SND_SEQUENCER)),$(if $(1),m),$(if $(CONFIG_SND_SEQUENCER),$(1)))
 
 # Toplevel Module Dependency
 obj-$(CONFIG_SND_GUSCLASSIC) += snd-gusclassic.o snd-gus-lib.o
index b20cac1f6e6a14a54b6851839ed6962ce8bc8a14..1f97b575abfc152a85f59a6cc902a40f0cd86be0 100644 (file)
@@ -169,7 +169,7 @@ static int snd_gf1_mem_find(snd_gf1_mem_t * alloc,
                if (ptr1 >= ptr2)
                        continue;
                size1 = ptr2 - ptr1;
-               if (size <= size1) {
+               if ((int)size <= size1) {
                        block->ptr = ptr1;
                        block->size = size;
                        return 0;
@@ -196,7 +196,7 @@ snd_gf1_mem_block_t *snd_gf1_mem_alloc(snd_gf1_mem_t * alloc, int owner,
        if (share_id != NULL) {
                nblock = snd_gf1_mem_share(alloc, share_id);
                if (nblock != NULL) {
-                       if (size != nblock->size) {
+                       if (size != (int)nblock->size) {
                                /* TODO: remove in the future */
                                snd_printk("snd_gf1_mem_alloc - share: sizes differ\n");
                                goto __std;
index 192c78bf49b94f9a71b6ef5a2542a3f0ee8bd9e8..651071a4be88ed207f96258d10d842ec8fdb2110 100644 (file)
@@ -172,7 +172,8 @@ ICS_DOUBLE("CD Playback Volume", 0, SNDRV_ICS_CD_DEV)
 int snd_gf1_new_mixer(snd_gus_card_t * gus)
 {
        snd_card_t *card;
-       int idx, err, max;
+       unsigned int idx, max;
+       int err;
 
        snd_assert(gus != NULL, return -EINVAL);
        card = gus->card;
index 5f5cfdf8cc68c61f8ca263d0e6f2c69839fd6057..16874a5f4d52f37a33b18114a8256e5fffd06667 100644 (file)
@@ -48,7 +48,7 @@ typedef struct {
        snd_gus_card_t * gus;
        snd_pcm_substream_t * substream;
        spinlock_t lock;
-       int voices;
+       unsigned int voices;
        snd_gus_voice_t *pvoices[2];
        unsigned int memory;
        unsigned short flags;
@@ -186,7 +186,7 @@ static void snd_gf1_pcm_interrupt_wave(snd_gus_card_t * gus, snd_gus_voice_t *pv
        gus_pcm_private_t * pcmp;
        snd_pcm_runtime_t * runtime;
        unsigned char voice_ctrl, ramp_ctrl;
-       int idx;
+       unsigned int idx;
        unsigned int end, step;
 
        if (!pvoice->private_data) {
@@ -600,7 +600,7 @@ static int snd_gf1_pcm_capture_trigger(snd_pcm_substream_t * substream,
 static snd_pcm_uframes_t snd_gf1_pcm_capture_pointer(snd_pcm_substream_t * substream)
 {
        snd_gus_card_t *gus = snd_pcm_substream_chip(substream);
-       int pos = gus->c_period_size - snd_dma_residue(gus->gf1.dma2);
+       int pos = snd_dma_pointer(gus->gf1.dma2, gus->c_period_size);
        pos = bytes_to_frames(substream->runtime, (gus->c_pos + pos) % gus->c_dma_size);
        return pos;
 }
@@ -766,7 +766,8 @@ static int snd_gf1_pcm_volume_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_
 {
        snd_gus_card_t *gus = snd_kcontrol_chip(kcontrol);
        unsigned long flags;
-       int change, idx;
+       int change;
+       unsigned int idx;
        unsigned short val1, val2, vol;
        gus_pcm_private_t *pcmp;
        snd_gus_voice_t *pvoice;
index 8206f23ab749fe6f8fa4aefb1ac9864f3a91f884..eee2abda5d91e12ff9ebc6d2dced6e9b35012859 100644 (file)
@@ -51,7 +51,7 @@ static int snd_gus_synth_use(void *private_data, snd_seq_port_subscribe_t *info)
        snd_gus_port_t * port = (snd_gus_port_t *)private_data;
        snd_gus_card_t * gus = port->gus;
        snd_gus_voice_t * voice;
-       int idx;
+       unsigned int idx;
 
        if (info->voices > 32)
                return -EINVAL;
@@ -133,7 +133,7 @@ static void snd_gus_synth_instr_notify(void *private_data,
                                       snd_seq_kinstr_t *instr,
                                       int what)
 {
-       int idx;
+       unsigned int idx;
        snd_gus_card_t *gus = snd_magic_cast(snd_gus_card_t, private_data, return);
        snd_gus_voice_t *pvoice;
        unsigned long flags;
@@ -197,6 +197,7 @@ static int snd_gus_synth_create_port(snd_gus_card_t * gus, int idx)
                                                   SNDRV_SEQ_PORT_TYPE_MIDI_GS |
                                                   SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE |
                                                   SNDRV_SEQ_PORT_TYPE_SYNTH,
+                                                  16,
                                                   name);
        if (p->chset->port < 0) {
                result = p->chset->port;
index 9b237a877edb0319650bf32efaf1203ca883a79d..de1342b7ec3d6d91f52fdacbc5896d472d63f962 100644 (file)
@@ -544,7 +544,8 @@ static int __init snd_interwave_mixer(cs4231_t *chip)
 {
        snd_card_t *card = chip->card;
        snd_ctl_elem_id_t id1, id2;
-       int idx, err;
+       unsigned int idx;
+       int err;
 
        memset(&id1, 0, sizeof(id1));
        memset(&id2, 0, sizeof(id2));
index f82c65805fc973b1c7f096b13079fc71bd3891f3..622e57bb44145cc668f3e2adbafcf1aa6a40a826 100644 (file)
@@ -842,7 +842,7 @@ static unsigned char bits[] = {  0x01,  0x0f,  0x00,  0x0e,  0x03,  0x02,
 
 static unsigned char snd_opti93x_get_freq(unsigned int rate)
 {
-       int i;
+       unsigned int i;
 
        for (i = 0; i < RATES; i++) {
                if (rate == rates[i])
@@ -1100,7 +1100,7 @@ static snd_pcm_uframes_t snd_opti93x_playback_pointer(snd_pcm_substream_t *subst
        if (!(chip->image[OPTi93X_IFACE_CONF] & OPTi93X_PLAYBACK_ENABLE))
                return 0;
 
-       ptr = chip->p_dma_size - snd_dma_residue(chip->dma1);
+       ptr = snd_dma_pointer(chip->dma1, chip->p_dma_size);
        return bytes_to_frames(substream->runtime, ptr);
 }
 
@@ -1112,7 +1112,7 @@ static snd_pcm_uframes_t snd_opti93x_capture_pointer(snd_pcm_substream_t *substr
        if (!(chip->image[OPTi93X_IFACE_CONF] & OPTi93X_CAPTURE_ENABLE))
                return 0;
 
-       ptr = chip->c_dma_size - snd_dma_residue(chip->dma2);
+       ptr = snd_dma_pointer(chip->dma2, chip->c_dma_size);
        return bytes_to_frames(substream->runtime, ptr);
 }
 
@@ -1635,7 +1635,8 @@ int snd_opti93x_mixer(opti93x_t *chip)
 {
        snd_card_t *card;
        snd_kcontrol_new_t knew;
-       int err, idx;
+       int err;
+       unsigned int idx;
 
        snd_assert(chip != NULL && chip->card != NULL, return -EINVAL);
 
index 101fe314af80a4119e61e31697f9a44b264e0de0..fd9d9c5726fc303ccdd36221617013a8002e051f 100644 (file)
@@ -19,7 +19,7 @@ snd-es968-objs := es968.o
 #   <empty string> - CONFIG_SND_SEQUENCER is undefined
 #   otherwise parameter #1 value
 #
-sequencer := $(if $(subst y,,$(CONFIG_SND_SEQUENCER)),m,$(if $(CONFIG_SND_SEQUENCER),$(1)))
+sequencer = $(if $(subst y,,$(CONFIG_SND_SEQUENCER)),$(if $(1),m),$(if $(CONFIG_SND_SEQUENCER),$(1)))
 
 # Toplevel Module Dependency
 obj-$(CONFIG_SND_ALS100) += snd-sb16-dsp.o snd-sb-common.o
index 28943586588124fb3dab3d96cfd11488e07fe652..b1a69c16919956158f0c44b48463db4c6807b642 100644 (file)
@@ -662,7 +662,7 @@ snd_emu8000_load_chorus_fx(emu8000_t *emu, int mode, const void *buf, long len)
                snd_printk(KERN_WARNING "illegal chorus mode %d for uploading\n", mode);
                return -EINVAL;
        }
-       if (len < sizeof(rec) || copy_from_user(&rec, buf, sizeof(rec)))
+       if (len < (long)sizeof(rec) || copy_from_user(&rec, buf, sizeof(rec)))
                return -EFAULT;
        chorus_parm[mode] = rec;
        chorus_defined[mode] = 1;
@@ -790,7 +790,7 @@ snd_emu8000_load_reverb_fx(emu8000_t *emu, int mode, const void *buf, long len)
                snd_printk(KERN_WARNING "illegal reverb mode %d for uploading\n", mode);
                return -EINVAL;
        }
-       if (len < sizeof(rec) || copy_from_user(&rec, buf, sizeof(rec)))
+       if (len < (long)sizeof(rec) || copy_from_user(&rec, buf, sizeof(rec)))
                return -EFAULT;
        reverb_parm[mode] = rec;
        reverb_defined[mode] = 1;
index c01d3ceaad6554934ae5c94c21751e317f5fe07d..3720ae66457009b1c07a32fe31a6c979fea611bf 100644 (file)
@@ -215,7 +215,7 @@ static void emu8k_pcm_timer_func(unsigned long data)
        add_timer(&rec->timer);
 
        /* update period */
-       if (rec->period_pos >= rec->period_size) {
+       if (rec->period_pos >= (int)rec->period_size) {
                rec->period_pos %= rec->period_size;
                spin_unlock(&rec->timer_lock);
                snd_pcm_period_elapsed(rec->substream);
index 4b4ce71593e8901ae402b77748c098556f889577..76b50b58618d4bacdd88f8c046b6fe3af5865c1a 100644 (file)
@@ -60,7 +60,7 @@ static void snd_sb16_csp_playback_prepare(sb_t *chip, snd_pcm_runtime_t *runtime
                if (csp->running & SNDRV_SB_CSP_ST_LOADED) {
                        /* manually loaded codec */
                        if ((csp->mode & SNDRV_SB_CSP_MODE_DSP_WRITE) &&
-                           ((1 << runtime->format) == csp->acc_format)) {
+                           ((1U << runtime->format) == csp->acc_format)) {
                                /* Supported runtime PCM format for playback */
                                if (csp->ops.csp_use(csp) == 0) {
                                        /* If CSP was successfully acquired */
@@ -108,7 +108,7 @@ static void snd_sb16_csp_capture_prepare(sb_t *chip, snd_pcm_runtime_t *runtime)
                if (csp->running & SNDRV_SB_CSP_ST_LOADED) {
                        /* manually loaded codec */
                        if ((csp->mode & SNDRV_SB_CSP_MODE_DSP_READ) &&
-                           ((1 << runtime->format) == csp->acc_format)) {
+                           ((1U << runtime->format) == csp->acc_format)) {
                                /* Supported runtime PCM format for capture */
                                if (csp->ops.csp_use(csp) == 0) {
                                        /* If CSP was successfully acquired */
@@ -451,7 +451,7 @@ static snd_pcm_uframes_t snd_sb16_playback_pointer(snd_pcm_substream_t * substre
        size_t ptr;
 
        dma = (chip->mode & SB_MODE_PLAYBACK_8) ? chip->dma8 : chip->dma16;
-       ptr = chip->p_dma_size - snd_dma_residue(dma);
+       ptr = snd_dma_pointer(dma, chip->p_dma_size);
        return bytes_to_frames(substream->runtime, ptr);
 }
 
@@ -462,7 +462,7 @@ static snd_pcm_uframes_t snd_sb16_capture_pointer(snd_pcm_substream_t * substrea
        size_t ptr;
 
        dma = (chip->mode & SB_MODE_CAPTURE_8) ? chip->dma8 : chip->dma16;
-       ptr = chip->c_dma_size - snd_dma_residue(dma);
+       ptr = snd_dma_pointer(dma, chip->c_dma_size);
        return bytes_to_frames(substream->runtime, ptr);
 }
 
index 91259fc955e52dd5899e8bba1752d25517c36ea3..c420358100c9bd7ac4ca2c987902e383ddbf7e75 100644 (file)
@@ -365,7 +365,7 @@ static snd_pcm_uframes_t snd_sb8_playback_pointer(snd_pcm_substream_t * substrea
 
        if (chip->mode != SB_MODE_PLAYBACK_8)
                return 0;
-       ptr = chip->p_dma_size - snd_dma_residue(chip->dma8);
+       ptr = snd_dma_pointer(chip->dma8, chip->p_dma_size);
        return bytes_to_frames(substream->runtime, ptr);
 }
 
@@ -376,7 +376,7 @@ static snd_pcm_uframes_t snd_sb8_capture_pointer(snd_pcm_substream_t * substream
 
        if (chip->mode != SB_MODE_CAPTURE_8)
                return 0;
-       ptr = chip->c_dma_size - snd_dma_residue(chip->dma8);
+       ptr = snd_dma_pointer(chip->dma8, chip->c_dma_size);
        return bytes_to_frames(substream->runtime, ptr);
 }
 
index a99bb045fb1f323b496cf4e2d45c77a0b62e23c7..4729cb672168329d014e73c0e92c68721cd238f0 100644 (file)
@@ -186,7 +186,8 @@ static int __init snd_sgalaxy_mixer(ad1848_t *chip)
 {
        snd_card_t *card = chip->card;
        snd_ctl_elem_id_t id1, id2;
-       int idx, err;
+       unsigned int idx;
+       int err;
 
        memset(&id1, 0, sizeof(id1));
        memset(&id2, 0, sizeof(id2));
index b1b1962fc55af3b2d4c31b707af4cb4aeedb2785..1fce6b4f60a8637c228149b8942bd94e494e79b2 100644 (file)
@@ -195,7 +195,7 @@ snd_wavefront_fx_ioctl (snd_hwdep_t *sdev, struct file *file,
                } else if (r.data[2] == 1) {
                        pd = (unsigned short *) &r.data[3];
                } else {
-                       if (r.data[2] > sizeof (page_data)) {
+                       if (r.data[2] > (long)sizeof (page_data)) {
                                snd_printk ("cannot write "
                                            "> 255 bytes to FX\n");
                                return -EIO;
index 359457d549ddadbec6e7290d8dec27a704d4d4d4..a3b5048e5aa68e170a4e8578477b2ff04b0eef3f 100644 (file)
@@ -877,7 +877,7 @@ wavefront_send_sample (snd_wavefront_t *dev,
        u32 length;
        u16 *data_end = 0;
        unsigned int i;
-       const int max_blksize = 4096/2;
+       const unsigned int max_blksize = 4096/2;
        unsigned int written;
        unsigned int blocksize;
        int dma_ack;
@@ -944,7 +944,7 @@ wavefront_send_sample (snd_wavefront_t *dev,
        if (header->size) {
                dev->freemem = wavefront_freemem (dev);
 
-               if (dev->freemem < header->size) {
+               if (dev->freemem < (int)header->size) {
                        snd_printk ("insufficient memory to "
                                    "load %d byte sample.\n",
                                    header->size);
index b262a07ede5e07c0fddec73e3171f6e698b48b51..ec83a2ba55d5abcb784cb536e82d0478f85b271a 100644 (file)
@@ -67,6 +67,7 @@ static const ac97_codec_id_t snd_ac97_codec_id_vendors[] = {
 { 0x434d4900, 0xffffff00, "C-Media Electronics", NULL },
 { 0x43525900, 0xffffff00, "Cirrus Logic",      NULL },
 { 0x43585400, 0xffffff00, "Conexant",           NULL },
+{ 0x44543000, 0xffffff00, "Diamond Technology", NULL },
 { 0x454d4300, 0xffffff00, "eMicro",            NULL },
 { 0x45838300, 0xffffff00, "ESS Technology",    NULL },
 { 0x48525300, 0xffffff00, "Intersil",          NULL },
@@ -120,6 +121,7 @@ static const ac97_codec_id_t snd_ac97_codec_ids[] = {
 { 0x43525960, 0xfffffff8, "CS4291",            NULL },
 { 0x43585421, 0xffffffff, "HSD11246",          NULL }, // SmartMC II
 { 0x43585428, 0xfffffff8, "Cx20468",           patch_conexant }, // SmartAMC fixme: the mask might be different
+{ 0x44543031, 0xfffffff0, "DT0398",            NULL },
 { 0x454d4328, 0xffffffff, "28028",             NULL },  // same as TR28028?
 { 0x45838308, 0xffffffff, "ESS1988",           NULL },
 { 0x48525300, 0xffffff00, "HMP9701",           NULL },
@@ -849,6 +851,36 @@ static int snd_ac97_spdif_default_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_val
        return change;
 }
 
+static int snd_ac97_put_spsa(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+{
+       ac97_t *ac97 = snd_kcontrol_chip(kcontrol);
+       int reg = kcontrol->private_value & 0xff;
+       int shift = (kcontrol->private_value >> 8) & 0xff;
+       int mask = (kcontrol->private_value >> 16) & 0xff;
+       // int invert = (kcontrol->private_value >> 24) & 0xff;
+       unsigned short value, old, new;
+
+       value = (ucontrol->value.integer.value[0] & mask);
+
+       mask <<= shift;
+       value <<= shift;
+       spin_lock(&ac97->reg_lock);
+       old = ac97->regs[reg];
+       new = (old & ~mask) | value;
+       spin_unlock(&ac97->reg_lock);
+
+       if (old != new) {
+               int change;
+               unsigned short extst = ac97->regs[AC97_EXTENDED_STATUS];
+               snd_ac97_update_bits(ac97, AC97_EXTENDED_STATUS, AC97_EA_SPDIF, 0); /* turn off */
+               change = snd_ac97_update_bits(ac97, reg, mask, value);
+               if (extst & AC97_EA_SPDIF)
+                       snd_ac97_update_bits(ac97, AC97_EXTENDED_STATUS, AC97_EA_SPDIF, AC97_EA_SPDIF); /* turn on again */
+               return change;
+       }
+       return 0;
+}
+
 static const snd_kcontrol_new_t snd_ac97_controls_spdif[5] = {
        {
                .access = SNDRV_CTL_ELEM_ACCESS_READ,
@@ -873,7 +905,15 @@ static const snd_kcontrol_new_t snd_ac97_controls_spdif[5] = {
        },
 
        AC97_SINGLE(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH),AC97_EXTENDED_STATUS, 2, 1, 0),
-       AC97_SINGLE(SNDRV_CTL_NAME_IEC958("",PLAYBACK,NONE) "AC97-SPSA",AC97_EXTENDED_STATUS, 4, 3, 0)
+       // AC97_SINGLE(SNDRV_CTL_NAME_IEC958("",PLAYBACK,NONE) "AC97-SPSA",AC97_EXTENDED_STATUS, 4, 3, 0)
+       {
+               .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,NONE) "AC97-SPSA",
+               .info = snd_ac97_info_single,
+               .get = snd_ac97_get_single,
+               .put = snd_ac97_put_spsa,
+               .private_value = AC97_EXTENDED_STATUS | (4 << 8) | (3 << 16) | (0 << 24),
+       },
 };
 
 static const snd_kcontrol_new_t snd_ac97_cirrus_controls_spdif[2] = {
@@ -995,9 +1035,6 @@ static const snd_kcontrol_new_t snd_ac97_controls_alc650[] = {
        /* 8: reserved */
        AC97_SINGLE("Line-In As Surround", AC97_ALC650_MULTICH, 9, 1, 0),
        AC97_SINGLE("Mic As Center/LFE", AC97_ALC650_MULTICH, 10, 1, 0),
-       AC97_SINGLE("IEC958 Capture Switch", AC97_ALC650_MULTICH, 11, 1, 0),
-       AC97_SINGLE("Analog to IEC958 Output", AC97_ALC650_MULTICH, 12, 1, 0),
-       AC97_SINGLE("IEC958 Input Monitor", AC97_ALC650_MULTICH, 13, 1, 0),
 #if 0 /* always set in patch_alc650 */
        AC97_SINGLE("IEC958 Input Clock Enable", AC97_ALC650_CLOCK, 0, 1, 0),
        AC97_SINGLE("IEC958 Input Pin Enable", AC97_ALC650_CLOCK, 1, 1, 0),
@@ -1008,6 +1045,12 @@ static const snd_kcontrol_new_t snd_ac97_controls_alc650[] = {
 #endif
 };
 
+static const snd_kcontrol_new_t snd_ac97_spdif_controls_alc650[] = {
+       AC97_SINGLE("IEC958 Capture Switch", AC97_ALC650_MULTICH, 11, 1, 0),
+       AC97_SINGLE("Analog to IEC958 Output", AC97_ALC650_MULTICH, 12, 1, 0),
+       AC97_SINGLE("IEC958 Input Monitor", AC97_ALC650_MULTICH, 13, 1, 0),
+};
+
 /* The following snd_ac97_ymf753_... items added by David Shust (dshust@shustring.com) */
 
 /* It is possible to indicate to the Yamaha YMF753 the type of speakers being used. */
@@ -1303,7 +1346,8 @@ static int snd_ac97_mixer_build(snd_card_t * card, ac97_t * ac97)
 {
        snd_kcontrol_t *kctl;
        const snd_kcontrol_new_t *knew;
-       int err, idx;
+       int err;
+       unsigned int idx;
        unsigned char max;
 
        /* build master controls */
@@ -1658,6 +1702,11 @@ static int snd_ac97_mixer_build(snd_card_t * card, ac97_t * ac97)
                for (idx = 0; idx < ARRAY_SIZE(snd_ac97_controls_alc650); idx++)
                        if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_alc650[idx], ac97))) < 0)
                                return err;
+               if (ac97->ext_id & AC97_EI_SPDIF) {
+                       for (idx = 0; idx < ARRAY_SIZE(snd_ac97_spdif_controls_alc650); idx++)
+                               if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_spdif_controls_alc650[idx], ac97))) < 0)
+                                       return err;
+               }
                break;
        case AC97_ID_VT1616:
                if (snd_ac97_try_bit(ac97, 0x5a, 9))
@@ -1748,6 +1797,39 @@ static void snd_ac97_get_name(ac97_t *ac97, unsigned int id, char *name)
 }
 
 
+/* wait for a while until registers are accessible after RESET
+ * return 0 if ok, negative not ready
+ */
+static int ac97_reset_wait(ac97_t *ac97, int timeout, int with_modem)
+{
+       signed long end_time;
+       end_time = jiffies + timeout;
+       do {
+               unsigned short ext_mid;
+               
+               /* use preliminary reads to settle the communication */
+               snd_ac97_read(ac97, AC97_RESET);
+               snd_ac97_read(ac97, AC97_VENDOR_ID1);
+               snd_ac97_read(ac97, AC97_VENDOR_ID2);
+               /* modem? */
+               if (with_modem) {
+                       ext_mid = snd_ac97_read(ac97, AC97_EXTENDED_MID);
+                       if (ext_mid != 0xffff && (ext_mid & 1) != 0)
+                               return 0;
+               }
+               /* because the PCM or MASTER volume registers can be modified,
+                * the REC_GAIN register is used for tests
+                */
+               /* test if we can write to the record gain volume register */
+               snd_ac97_write_cache(ac97, AC97_REC_GAIN, 0x8a05);
+               if (snd_ac97_read(ac97, AC97_REC_GAIN) == 0x8a05)
+                       return 0;
+               set_current_state(TASK_UNINTERRUPTIBLE);
+               schedule_timeout(HZ/100);
+       } while (time_after_eq(end_time, jiffies));
+       return -ENODEV;
+}
+
 /**
  * snd_ac97_mixer - create an AC97 codec component
  * @card: the card instance
@@ -1803,32 +1885,12 @@ int snd_ac97_mixer(snd_card_t * card, ac97_t * _ac97, ac97_t ** rac97)
                ac97->wait(ac97);
        else {
                udelay(50);
-
-               /* it's necessary to wait awhile until registers are accessible after RESET */
-               /* because the PCM or MASTER volume registers can be modified, */
-               /* the REC_GAIN register is used for tests */
-               end_time = jiffies + HZ;
-               do {
-                       unsigned short ext_mid;
-               
-                       /* use preliminary reads to settle the communication */
-                       snd_ac97_read(ac97, AC97_RESET);
-                       snd_ac97_read(ac97, AC97_VENDOR_ID1);
-                       snd_ac97_read(ac97, AC97_VENDOR_ID2);
-                       /* modem? */
-                       ext_mid = snd_ac97_read(ac97, AC97_EXTENDED_MID);
-                       if (ext_mid != 0xffff && (ext_mid & 1) != 0)
-                               goto __access_ok;
-                       /* test if we can write to the record gain volume register */
-                       snd_ac97_write_cache(ac97, AC97_REC_GAIN, 0x8a05);
-                       if ((err = snd_ac97_read(ac97, AC97_REC_GAIN)) == 0x8a05)
-                               goto __access_ok;
-                       set_current_state(TASK_UNINTERRUPTIBLE);
-                       schedule_timeout(HZ/100);
-               } while (time_after_eq(end_time, jiffies));
-               snd_printk("AC'97 %d:%d does not respond - RESET [REC_GAIN = 0x%x]\n", ac97->num, ac97->addr, err);
-               snd_ac97_free(ac97);
-               return -ENXIO;
+               if (ac97_reset_wait(ac97, HZ/2, 0) < 0 &&
+                   ac97_reset_wait(ac97, HZ/2, 1) < 0) {
+                       snd_printk("AC'97 %d:%d does not respond - RESET [REC_GAIN = 0x%x]\n", ac97->num, ac97->addr, err);
+                       snd_ac97_free(ac97);
+                       return -ENXIO;
+               }
        }
       __access_ok:
        ac97->id = snd_ac97_read(ac97, AC97_VENDOR_ID1) << 16;
index 61940d00d5f9efbd33871908abcedc73dcf9e5b3..1a1e48fce32244f94fe88f9405e99c77e094a8ad 100644 (file)
@@ -355,13 +355,19 @@ int patch_alc650(ac97_t * ac97)
 {
        unsigned short val;
 
-       /* enable spdif in */
-       snd_ac97_write_cache(ac97, AC97_ALC650_CLOCK,
-                            snd_ac97_read(ac97, AC97_ALC650_CLOCK) | 0x03);
+       /* check spdif */
+       val = snd_ac97_read(ac97, AC97_EXTENDED_STATUS);
+       if (val & AC97_EA_SPCV) {
+               /* enable spdif in */
+               snd_ac97_write_cache(ac97, AC97_ALC650_CLOCK,
+                                    snd_ac97_read(ac97, AC97_ALC650_CLOCK) | 0x03);
+       } else
+               ac97->ext_id &= ~AC97_EI_SPDIF; /* disable extended-id */
+
        val = snd_ac97_read(ac97, AC97_ALC650_MULTICH);
        val &= ~0xc000; /* slot: 3,4,7,8,6,9 */
-       snd_ac97_write_cache(ac97, AC97_ALC650_MULTICH,
-                            val | 0x03);
+       snd_ac97_write_cache(ac97, AC97_ALC650_MULTICH, val | 0x03);
+
        /* full DAC volume */
        snd_ac97_write_cache(ac97, AC97_ALC650_SURR_DAC_VOL, 0x0808);
        snd_ac97_write_cache(ac97, AC97_ALC650_LFE_DAC_VOL, 0x0808);
index 18e1731d9bcfec3d1efded0bf93b0b7482ecec35..2c1b545ba51e98b00145a25a0eea7a56b1a35739 100644 (file)
@@ -357,7 +357,8 @@ static u8 snd_ak4531_initial_map[0x19 + 1] = {
 
 int snd_ak4531_mixer(snd_card_t * card, ak4531_t * _ak4531, ak4531_t ** rak4531)
 {
-       int idx, err;
+       unsigned int idx;
+       int err;
        ak4531_t * ak4531;
        static snd_device_ops_t ops = {
                .dev_free =     snd_ak4531_dev_free,
index e88a74e78f4b9f76ad02b5c99ddd0a59eaa397e7..6e6976857df9ab9035af5f683422fead7ecf422c 100644 (file)
@@ -79,7 +79,7 @@ MODULE_PARM_SYNTAX(pcm_channels, SNDRV_ENABLED ",default:32,allows:{{1,32}}");
 #endif
 
 /*
- *  Constants definition
+ *  Constants defination
  */
 
 #ifndef PCI_VENDOR_ID_ALI
@@ -529,7 +529,8 @@ static int snd_ali_reset_5451(ali_t *codec)
                udelay(5000);
        }
 
-       snd_printk(KERN_WARNING "ali5451: reset time out\n");
+       /* non-fatal if you have a non PM capable codec */
+       /* snd_printk(KERN_WARNING "ali5451: reset time out\n"); */
        return 0;
 }
 
@@ -1850,7 +1851,8 @@ static void snd_ali_mixer_free_ac97(ac97_t *ac97)
 static int __devinit snd_ali_mixer(ali_t * codec)
 {
        ac97_t ac97;
-       int err, idx;
+       unsigned int idx;
+       int err;
 
        memset(&ac97, 0, sizeof(ac97));
        ac97.write = snd_ali_codec_write;
@@ -2088,12 +2090,12 @@ static int __devinit snd_ali_create(snd_card_t * card,
        /* enable PCI device */
        if ((err = pci_enable_device(pci)) < 0)
                return err;
-       /* check, if we can restrict PCI DMA transfers to 30 bits */
-       if (!pci_dma_supported(pci, 0x3fffffff)) {
-               snd_printk("architecture does not support 30bit PCI busmaster DMA\n");
+       /* check, if we can restrict PCI DMA transfers to 31 bits */
+       if (!pci_dma_supported(pci, 0x7fffffff)) {
+               snd_printk("architecture does not support 31bit PCI busmaster DMA\n");
                return -ENXIO;
        }
-       pci_set_dma_mask(pci, 0x3fffffff);
+       pci_set_dma_mask(pci, 0x7fffffff);
 
        if ((codec = snd_magic_kcalloc(ali_t, 0, GFP_KERNEL)) == NULL)
                return -ENOMEM;
index 0b20f34f11b1c23b9804f4375ed5f779018b9607..97c1cf5cdf73c1fb18965b727d3166bf0887b86f 100644 (file)
@@ -372,8 +372,10 @@ MODULE_PARM_SYNTAX(soft_ac3, SNDRV_ENABLED "," SNDRV_BOOLEAN_TRUE_DESC);
 #define CM_OPEN_DAC    0x10
 #define CM_OPEN_ADC    0x20
 #define CM_OPEN_SPDIF  0x40
+#define CM_OPEN_MCHAN  0x80
 #define CM_OPEN_PLAYBACK       (CM_CH_PLAY | CM_OPEN_DAC)
 #define CM_OPEN_PLAYBACK2      (CM_CH_CAPT | CM_OPEN_DAC)
+#define CM_OPEN_PLAYBACK_MULTI (CM_CH_PLAY | CM_OPEN_DAC | CM_OPEN_MCHAN)
 #define CM_OPEN_CAPTURE                (CM_CH_CAPT | CM_OPEN_ADC)
 #define CM_OPEN_SPDIF_PLAYBACK (CM_CH_PLAY | CM_OPEN_DAC | CM_OPEN_SPDIF)
 #define CM_OPEN_SPDIF_CAPTURE  (CM_CH_CAPT | CM_OPEN_ADC | CM_OPEN_SPDIF)
@@ -425,7 +427,7 @@ static const struct cmipci_mixer_auto_switches cm_saved_mixer[] = {
        // {"IEC958 Out To DAC", 1}, // no longer used
        {"IEC958 Loop", 0},
 };
-#define CM_SAVED_MIXERS                (sizeof(cm_saved_mixer)/sizeof(cm_saved_mixer[0]))
+#define CM_SAVED_MIXERS                ARRAY_SIZE(cm_saved_mixer)
 
 struct snd_stru_cmipci {
        snd_card_t *card;
@@ -558,13 +560,12 @@ static void snd_cmipci_clear_bit_b(cmipci_t *cm, unsigned int cmd, unsigned char
  * calculate frequency
  */
 
-static int rates[] = { 5512, 11025, 22050, 44100, 8000, 16000, 32000, 48000 };
-#define RATES (sizeof(rates) / sizeof(rates[0]))
+static unsigned int rates[] = { 5512, 11025, 22050, 44100, 8000, 16000, 32000, 48000 };
 
 static unsigned int snd_cmipci_rate_freq(unsigned int rate)
 {
-       int i;
-       for (i = 0; i < RATES; i++) {
+       unsigned int i;
+       for (i = 0; i < ARRAY_SIZE(rates); i++) {
                if (rates[i] == rate)
                        return i;
        }
@@ -644,6 +645,23 @@ static int snd_cmipci_hw_params(snd_pcm_substream_t * substream,
        return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
 }
 
+static int snd_cmipci_playback2_hw_params(snd_pcm_substream_t * substream,
+                                         snd_pcm_hw_params_t * hw_params)
+{
+       cmipci_t *cm = snd_pcm_substream_chip(substream);
+       if (params_channels(hw_params) > 2) {
+               down(&cm->open_mutex);
+               if (cm->opened[CM_CH_PLAY]) {
+                       up(&cm->open_mutex);
+                       return -EBUSY;
+               }
+               /* reserve the channel A */
+               cm->opened[CM_CH_PLAY] = CM_OPEN_PLAYBACK_MULTI;
+               up(&cm->open_mutex);
+       }
+       return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
+}
+
 static void snd_cmipci_ch_reset(cmipci_t *cm, int ch)
 {
        int reset = CM_RST_CH0 << (cm->channel[ch].ch);
@@ -747,6 +765,11 @@ static int snd_cmipci_pcm_prepare(cmipci_t *cm, cmipci_pcm_t *rec,
        rec->period_size = runtime->period_size << rec->shift;
        rec->dma_size <<= rec->ac3_shift;
        rec->period_size <<= rec->ac3_shift;
+       if (runtime->channels > 2) {
+               /* multi-channels */
+               rec->dma_size = (rec->dma_size * runtime->channels) / 2;
+               rec->period_size = (rec->period_size * runtime->channels) / 2;
+       }
 
        spin_lock_irqsave(&cm->reg_lock, flags);
 
@@ -756,7 +779,7 @@ static int snd_cmipci_pcm_prepare(cmipci_t *cm, cmipci_pcm_t *rec,
        /* program sample counts */
        reg = rec->ch ? CM_REG_CH1_FRAME2 : CM_REG_CH0_FRAME2;
        snd_cmipci_write_w(cm, reg, rec->dma_size - 1);
-       snd_cmipci_write_w(cm, reg + 2, rec->period_size); /* FIXME: or period_size-1 ?? */
+       snd_cmipci_write_w(cm, reg + 2, rec->period_size - 1);
 
        /* set adc/dac flag */
        val = rec->ch ? CM_CHADC1 : CM_CHADC0;
@@ -868,6 +891,8 @@ static snd_pcm_uframes_t snd_cmipci_pcm_pointer(cmipci_t *cm, cmipci_pcm_t *rec,
        ptr = bytes_to_frames(substream->runtime, ptr);
 #endif
        ptr >>= rec->ac3_shift;
+       if (substream->runtime->channels > 2)
+               ptr = (ptr * 2) / substream->runtime->channels;
        return ptr;
 }
 
@@ -1403,7 +1428,7 @@ static snd_kcontrol_new_t snd_cmipci_spdif_stream __devinitdata =
 static void save_mixer_state(cmipci_t *cm)
 {
        if (! cm->mixer_insensitive) {
-               int i;
+               unsigned int i;
                for (i = 0; i < CM_SAVED_MIXERS; i++) {
                        snd_kcontrol_t *ctl = cm->mixer_res_ctl[i];
                        if (ctl) {
@@ -1431,7 +1456,7 @@ static void save_mixer_state(cmipci_t *cm)
 static void restore_mixer_state(cmipci_t *cm)
 {
        if (cm->mixer_insensitive) {
-               int i;
+               unsigned int i;
                cm->mixer_insensitive = 0; /* at first clear this;
                                              otherwise the changes will be ignored */
                for (i = 0; i < CM_SAVED_MIXERS; i++) {
@@ -1787,9 +1812,11 @@ static void close_device_check(cmipci_t *cm, int mode)
 
        down(&cm->open_mutex);
        if (cm->opened[ch] == mode) {
-               snd_cmipci_ch_reset(cm, ch);
-               cm->channel[ch].running = 0;
-               cm->channel[ch].substream = NULL;
+               if (cm->channel[ch].substream) {
+                       snd_cmipci_ch_reset(cm, ch);
+                       cm->channel[ch].running = 0;
+                       cm->channel[ch].substream = NULL;
+               }
                cm->opened[ch] = 0;
                if (! cm->channel[ch].is_dac) {
                        /* enable dual DAC mode again */
@@ -1814,13 +1841,6 @@ static int snd_cmipci_playback_open(snd_pcm_substream_t *substream)
        if ((err = open_device_check(cm, CM_OPEN_PLAYBACK, substream)) < 0)
                return err;
        runtime->hw = snd_cmipci_playback;
-       if (cm->can_multi_ch) {
-               runtime->hw.channels_max = cm->max_channels;
-               if (cm->max_channels == 4)
-                       snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, &hw_constraints_channels_4);
-               else
-                       snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, &hw_constraints_channels_6);
-       }
        snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, 0, 0x10000);
        return 0;
 }
@@ -1847,7 +1867,18 @@ static int snd_cmipci_playback2_open(snd_pcm_substream_t *substream)
        if ((err = open_device_check(cm, CM_OPEN_PLAYBACK2, substream)) < 0) /* use channel B */
                return err;
        runtime->hw = snd_cmipci_playback2;
-       snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, 0, 0x10000);
+       down(&cm->open_mutex);
+       if (! cm->opened[CM_CH_PLAY]) {
+               if (cm->can_multi_ch) {
+                       runtime->hw.channels_max = cm->max_channels;
+                       if (cm->max_channels == 4)
+                               snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, &hw_constraints_channels_4);
+                       else
+                               snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, &hw_constraints_channels_6);
+               }
+               snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, 0, 0x10000);
+       }
+       up(&cm->open_mutex);
        return 0;
 }
 
@@ -1904,6 +1935,7 @@ static int snd_cmipci_playback2_close(snd_pcm_substream_t * substream)
 {
        cmipci_t *cm = snd_pcm_substream_chip(substream);
        close_device_check(cm, CM_OPEN_PLAYBACK2);
+       close_device_check(cm, CM_OPEN_PLAYBACK_MULTI);
        return 0;
 }
 
@@ -1951,7 +1983,7 @@ static snd_pcm_ops_t snd_cmipci_playback2_ops = {
        .open =         snd_cmipci_playback2_open,
        .close =        snd_cmipci_playback2_close,
        .ioctl =        snd_pcm_lib_ioctl,
-       .hw_params =    snd_cmipci_hw_params,
+       .hw_params =    snd_cmipci_playback2_hw_params,
        .hw_free =      snd_cmipci_hw_free,
        .prepare =      snd_cmipci_capture_prepare,     /* channel B */
        .trigger =      snd_cmipci_capture_trigger,     /* channel B */
@@ -2661,7 +2693,8 @@ static int __devinit snd_cmipci_mixer_new(cmipci_t *cm, int pcm_spdif_device)
        snd_card_t *card;
        snd_kcontrol_new_t *sw;
        snd_kcontrol_t *kctl;
-       int idx, err;
+       unsigned int idx;
+       int err;
 
        snd_assert(cm != NULL && cm->card != NULL, return -EINVAL);
 
@@ -3053,7 +3086,7 @@ static int __devinit snd_cmipci_create(snd_card_t *card, struct pci_dev *pci,
                return err;
        }
 #ifdef USE_VAR48KRATE
-       for (val = 0; val < RATES; val++)
+       for (val = 0; val < ARRAY_SIZE(rates); val++)
                snd_cmipci_set_pll(cm, rates[val], val);
 
        /*
index 11207a67b87e86005dfab1ec024fb75239ec2911..27bd2a2aed8d882e16c8e63d3e354308756d30af 100644 (file)
@@ -2054,7 +2054,7 @@ static void cs4281_suspend(cs4281_t *chip)
 {
        snd_card_t *card = chip->card;
        u32 ulCLK;
-       int i;
+       unsigned int i;
 
        if (card->power_state == SNDRV_CTL_POWER_D3hot)
                return;
@@ -2095,7 +2095,7 @@ static void cs4281_suspend(cs4281_t *chip)
 static void cs4281_resume(cs4281_t *chip)
 {
        snd_card_t *card = chip->card;
-       int i;
+       unsigned int i;
        u32 ulCLK;
 
        if (card->power_state == SNDRV_CTL_POWER_D0)
index 4d42fef9d1627f396cf7ce7384b9275dc011a103..b1cfe9efd920340de58e3c72c453ca57cc8b3d55 100644 (file)
@@ -698,7 +698,7 @@ static int snd_cs46xx_playback_transfer(snd_pcm_substream_t *substream,
                size_t hw_to_end = buffer_size - cpcm->hw_data;
                size_t sw_to_end = cpcm->sw_bufsize - cpcm->sw_data;
                size_t bytes = buffer_size - cpcm->hw_ready;
-               if (cpcm->sw_ready < bytes)
+               if (cpcm->sw_ready < (int)bytes)
                        bytes = cpcm->sw_ready;
                if (hw_to_end < bytes)
                        bytes = hw_to_end;
@@ -708,7 +708,7 @@ static int snd_cs46xx_playback_transfer(snd_pcm_substream_t *substream,
                       runtime->dma_area + cpcm->sw_data,
                       bytes);
                cpcm->hw_data += bytes;
-               if (cpcm->hw_data == buffer_size)
+               if ((int)cpcm->hw_data == buffer_size)
                        cpcm->hw_data = 0;
                cpcm->sw_data += bytes;
                if (cpcm->sw_data == cpcm->sw_bufsize)
@@ -734,11 +734,11 @@ static int snd_cs46xx_capture_transfer(snd_pcm_substream_t *substream,
        chip->capt.sw_ready -= frames << chip->capt.shift;
        chip->capt.appl_ptr = runtime->control->appl_ptr + frames;
        while (chip->capt.hw_ready > 0 && 
-              chip->capt.sw_ready < chip->capt.sw_bufsize) {
+              chip->capt.sw_ready < (int)chip->capt.sw_bufsize) {
                size_t hw_to_end = buffer_size - chip->capt.hw_data;
                size_t sw_to_end = chip->capt.sw_bufsize - chip->capt.sw_data;
                size_t bytes = chip->capt.sw_bufsize - chip->capt.sw_ready;
-               if (chip->capt.hw_ready < bytes)
+               if (chip->capt.hw_ready < (int)bytes)
                        bytes = chip->capt.hw_ready;
                if (hw_to_end < bytes)
                        bytes = hw_to_end;
@@ -748,7 +748,7 @@ static int snd_cs46xx_capture_transfer(snd_pcm_substream_t *substream,
                       chip->capt.hw_area + chip->capt.hw_data,
                       bytes);
                chip->capt.hw_data += bytes;
-               if (chip->capt.hw_data == buffer_size)
+               if ((int)chip->capt.hw_data == buffer_size)
                        chip->capt.hw_data = 0;
                chip->capt.sw_data += bytes;
                if (chip->capt.sw_data == chip->capt.sw_bufsize)
@@ -993,7 +993,7 @@ static int _cs46xx_adjust_sample_rate (cs46xx_t *chip, cs46xx_pcm_t *cpcm,
                cpcm->pcm_channel->sample_rate = sample_rate;
        } else
        /* if sample rate is changed */
-       if (cpcm->pcm_channel->sample_rate != sample_rate) {
+       if ((int)cpcm->pcm_channel->sample_rate != sample_rate) {
                int unlinked = cpcm->pcm_channel->unlinked;
                cs46xx_dsp_destroy_pcm_channel (chip,cpcm->pcm_channel);
 
@@ -2048,7 +2048,7 @@ static int snd_herc_spdif_select_put(snd_kcontrol_t *kcontrol,
 
        /* checking diff from the EGPIO direction register 
           should be enough */
-       return (val1 != snd_cs46xx_peekBA0(chip, BA0_EGPIODR));
+       return (val1 != (int)snd_cs46xx_peekBA0(chip, BA0_EGPIODR));
 }
 
 
@@ -2091,7 +2091,7 @@ static int snd_cs46xx_spdif_default_put(snd_kcontrol_t * kcontrol,
                (1 << 13) | (1 << 12);
 
 
-       change = ins->spdif_csuv_default != val;
+       change = (unsigned int)ins->spdif_csuv_default != val;
        ins->spdif_csuv_default = val;
 
        if ( !(ins->spdif_status_out & DSP_SPDIF_STATUS_PLAYBACK_OPEN) )
@@ -2409,7 +2409,7 @@ int __devinit snd_cs46xx_mixer(cs46xx_t *chip)
        ac97_t ac97;
        snd_ctl_elem_id_t id;
        int err;
-       int idx;
+       unsigned int idx;
 
        /* detect primary codec */
        chip->nr_ac97_codecs = 0;
@@ -2487,17 +2487,10 @@ int __devinit snd_cs46xx_mixer(cs46xx_t *chip)
 
  _end:
 
-       /* dosoundcard specific mixer setup */
-       if (chip->mixer_init) {
-               snd_printdd ("calling chip->mixer_init(chip);\n");
-               chip->mixer_init(chip);
-       }
-    
 #endif /* CONFIG_SND_CS46XX_NEW_DSP */
 
        /* add cs4630 mixer controls */
-       for (idx = 0; idx < sizeof(snd_cs46xx_controls) / 
-                    sizeof(snd_cs46xx_controls[0]); idx++) {
+       for (idx = 0; idx < ARRAY_SIZE(snd_cs46xx_controls); idx++) {
                snd_kcontrol_t *kctl;
                kctl = snd_ctl_new1(&snd_cs46xx_controls[idx], chip);
                if ((err = snd_ctl_add(card, kctl)) < 0)
@@ -2510,6 +2503,17 @@ int __devinit snd_cs46xx_mixer(cs46xx_t *chip)
        strcpy(id.name, "External Amplifier Power Down");
        chip->eapd_switch = snd_ctl_find_id(chip->card, &id);
     
+       /* turn on amplifier */
+       chip->amplifier_ctrl(chip, 1);
+
+#ifdef CONFIG_SND_CS46XX_NEW_DSP
+       /* do soundcard specific mixer setup */
+       if (chip->mixer_init) {
+               snd_printdd ("calling chip->mixer_init(chip);\n");
+               chip->mixer_init(chip);
+       }
+#endif
+    
        return 0;
 }
 
@@ -2793,7 +2797,7 @@ static long snd_cs46xx_io_read(snd_info_entry_t *entry, void *file_private_data,
        snd_cs46xx_region_t *region = (snd_cs46xx_region_t *)entry->private_data;
        
        size = count;
-       if (file->f_pos + size > region->size)
+       if (file->f_pos + (size_t)size > region->size)
                size = region->size - file->f_pos;
        if (size > 0) {
                char *tmp;
@@ -3496,7 +3500,8 @@ static void voyetra_mixer_init (cs46xx_t *chip)
 static void hercules_mixer_init (cs46xx_t *chip)
 {
 #ifdef CONFIG_SND_CS46XX_NEW_DSP
-       int idx,err;
+       unsigned int idx;
+       int err;
        snd_card_t *card = chip->card;
 #endif
 
@@ -3506,8 +3511,7 @@ static void hercules_mixer_init (cs46xx_t *chip)
        snd_printdd ("initializing Hercules mixer\n");
 
 #ifdef CONFIG_SND_CS46XX_NEW_DSP
-       for (idx = 0 ; idx < sizeof(snd_hercules_controls) / 
-                    sizeof(snd_hercules_controls[0]) ; idx++) {
+       for (idx = 0 ; idx < ARRAY_SIZE(snd_hercules_controls); idx++) {
                snd_kcontrol_t *kctl;
 
                kctl = snd_ctl_new1(&snd_hercules_controls[idx], chip);
@@ -3621,21 +3625,88 @@ struct cs_card_type
 };
 
 static struct cs_card_type __devinitdata cards[] = {
-       {0x1489, 0x7001, "Genius Soundmaker 128 value", NULL, amp_none, NULL, NULL},
-       {0x5053, 0x3357, "Voyetra", NULL, amp_voyetra, NULL, voyetra_mixer_init},
-       {0x1071, 0x6003, "Mitac MI6020/21", NULL, amp_voyetra, NULL, NULL},
-       {0x14AF, 0x0050, "Hercules Game Theatre XP", NULL, amp_hercules, NULL, hercules_mixer_init},
-       {0x1681, 0x0050, "Hercules Game Theatre XP", NULL, amp_hercules, NULL, hercules_mixer_init},
-       {0x1681, 0x0051, "Hercules Game Theatre XP", NULL, amp_hercules, NULL, hercules_mixer_init},
-       {0x1681, 0x0052, "Hercules Game Theatre XP", NULL, amp_hercules, NULL, hercules_mixer_init},
-       {0x1681, 0x0053, "Hercules Game Theatre XP", NULL, amp_hercules, NULL, hercules_mixer_init},
-       {0x1681, 0x0054, "Hercules Game Theatre XP", NULL, amp_hercules, NULL, hercules_mixer_init},
+       {
+               .vendor = 0x1489,
+               .id = 0x7001,
+               .name = "Genius Soundmaker 128 value",
+               /* nothing special */
+       },
+       {
+               .vendor = 0x5053,
+               .id = 0x3357,
+               .name = "Voyetra",
+               .amp = amp_voyetra,
+               .mixer_init = voyetra_mixer_init
+       },
+       {
+               .vendor = 0x1071,
+               .id = 0x6003,
+               .name = "Mitac MI6020/21",
+               .amp = amp_voyetra
+       },
+       {
+               .vendor = 0x14AF,
+               .id = 0x0050,
+               .name = "Hercules Game Theatre XP",
+               .amp = amp_hercules,
+               .mixer_init = hercules_mixer_init
+       },
+       {
+               .vendor = 0x1681,
+               .id = 0x0050,
+               .name = "Hercules Game Theatre XP",
+               .amp = amp_hercules,
+               .mixer_init = hercules_mixer_init
+       },
+       {
+               .vendor = 0x1681,
+               .id = 0x0051,
+               .name = "Hercules Game Theatre XP",
+               .amp = amp_hercules,
+               .mixer_init = hercules_mixer_init
+       },
+       {
+               .vendor = 0x1681,
+               .id = 0x0052,
+               .name = "Hercules Game Theatre XP",
+               .amp = amp_hercules,
+               .mixer_init = hercules_mixer_init
+       },
+       {
+               .vendor = 0x1681,
+               .id = 0x0053,
+               .name = "Hercules Game Theatre XP",
+               .amp = amp_hercules,
+               .mixer_init = hercules_mixer_init
+       },
+       {
+               .vendor = 0x1681,
+               .id = 0x0054,
+               .name = "Hercules Game Theatre XP",
+               .amp = amp_hercules,
+               .mixer_init = hercules_mixer_init
+       },
        /* Not sure if the 570 needs the clkrun hack */
-       {PCI_VENDOR_ID_IBM, 0x0132, "Thinkpad 570", clkrun_init, NULL, clkrun_hack, NULL},
-       {PCI_VENDOR_ID_IBM, 0x0153, "Thinkpad 600X/A20/T20", clkrun_init, NULL, clkrun_hack, NULL},
-       {PCI_VENDOR_ID_IBM, 0x1010, "Thinkpad 600E (unsupported)", NULL, NULL, NULL, NULL},
-       {0, 0, "Card without SSID set", NULL, NULL, NULL, NULL },
-       {0, 0, NULL, NULL, NULL, NULL, NULL}
+       {
+               .vendor = PCI_VENDOR_ID_IBM,
+               .id = 0x0132,
+               .name = "Thinkpad 570",
+               .init = clkrun_init,
+               .active = clkrun_hack
+       },
+       {
+               .vendor = PCI_VENDOR_ID_IBM,
+               .id = 0x0153,
+               .name = "Thinkpad 600X/A20/T20",
+               .init = clkrun_init,
+               .active = clkrun_hack
+       },
+       {
+               .vendor = PCI_VENDOR_ID_IBM,
+               .id = 0x1010,
+               .name = "Thinkpad 600E (unsupported)"
+       },
+       {} /* terminator */
 };
 
 
@@ -3758,8 +3829,8 @@ int __devinit snd_cs46xx_create(snd_card_t * card,
        chip->irq = -1;
        chip->ba0_addr = pci_resource_start(pci, 0);
        chip->ba1_addr = pci_resource_start(pci, 1);
-       if (chip->ba0_addr == 0 || chip->ba0_addr == ~0 ||
-           chip->ba1_addr == 0 || chip->ba1_addr == ~0) {
+       if (chip->ba0_addr == 0 || chip->ba0_addr == (unsigned long)~0 ||
+           chip->ba1_addr == 0 || chip->ba1_addr == (unsigned long)~0) {
                snd_cs46xx_free(chip);
                snd_printk("wrong address(es) - ba0 = 0x%lx, ba1 = 0x%lx\n", chip->ba0_addr, chip->ba1_addr);
                return -ENOMEM;
@@ -3829,20 +3900,20 @@ int __devinit snd_cs46xx_create(snd_card_t * card,
        for (idx = 0; idx < 5; idx++) {
                region = &chip->region.idx[idx];
                if ((region->resource = request_mem_region(region->base, region->size, region->name)) == NULL) {
-                       snd_cs46xx_free(chip);
                        snd_printk("unable to request memory region 0x%lx-0x%lx\n", region->base, region->base + region->size - 1);
+                       snd_cs46xx_free(chip);
                        return -EBUSY;
                }
                region->remap_addr = (unsigned long) ioremap_nocache(region->base, region->size);
                if (region->remap_addr == 0) {
-                       snd_cs46xx_free(chip);
                        snd_printk("%s ioremap problem\n", region->name);
+                       snd_cs46xx_free(chip);
                        return -ENOMEM;
                }
        }
        if (request_irq(pci->irq, snd_cs46xx_interrupt, SA_INTERRUPT|SA_SHIRQ, "CS46XX", (void *) chip)) {
-               snd_cs46xx_free(chip);
                snd_printk("unable to grab IRQ %d\n", pci->irq);
+               snd_cs46xx_free(chip);
                return -EBUSY;
        }
        chip->irq = pci->irq;
@@ -3873,9 +3944,6 @@ int __devinit snd_cs46xx_create(snd_card_t * card,
                return err;
        }
        
-       /* turn on amplifier */
-       chip->amplifier_ctrl(chip, 1);
-
        chip->active_ctrl(chip, -1); /* disable CLKRUN */
 
        *rchip = chip;
index 50bae3c9c9e4b8eb6d950352eb562068274feaac..825a76909bc185bf781c8da8f785438d04fab605 100644 (file)
@@ -54,7 +54,7 @@ static wide_opcode_t wide_opcodes[] = {
 
 static int shadow_and_reallocate_code (cs46xx_t * chip,u32 * data,u32 size, u32 overlay_begin_address)
 {
-       int i = 0,j, nreallocated = 0;
+       unsigned int i = 0, j, nreallocated = 0;
        u32 hival,loval,address;
        u32 mop_operands,mop_type,wide_op;
        dsp_spos_instance_t * ins = chip->dsp_spos_instance;
@@ -569,7 +569,7 @@ static void cs46xx_dsp_proc_parameter_dump_read (snd_info_entry_t *entry, snd_in
 {
        cs46xx_t *chip = snd_magic_cast(cs46xx_t, entry->private_data, return);
        /*dsp_spos_instance_t * ins = chip->dsp_spos_instance; */
-       int i,col = 0;
+       unsigned int i,col = 0;
        unsigned long dst = chip->region.idx[1].remap_addr + DSP_PARAMETER_BYTE_OFFSET;
        symbol_entry_t * symbol; 
 
@@ -585,7 +585,7 @@ static void cs46xx_dsp_proc_parameter_dump_read (snd_info_entry_t *entry, snd_in
                }
 
                if (col == 0) {
-                       snd_iprintf(buffer, "%04X ",i / sizeof(u32));
+                       snd_iprintf(buffer, "%04X ", i / (unsigned int)sizeof(u32));
                }
 
                snd_iprintf(buffer,"%08X ",readl(dst + i));
index ba47a98fd200bf2b2e0a95274bc8d78c453d8497..1642b7bebb8d0339b5d0d76150a45916fd41cd6b 100644 (file)
@@ -162,7 +162,7 @@ static void _dsp_unlink_scb (cs46xx_t *chip,dsp_scb_descriptor_t * scb)
 
 static void _dsp_clear_sample_buffer (cs46xx_t *chip, u32 sample_buffer_addr, int dword_count) 
 {
-       u32 dst = chip->region.idx[2].remap_addr + sample_buffer_addr;
+       unsigned long dst = chip->region.idx[2].remap_addr + sample_buffer_addr;
        int i;
   
        for (i = 0; i < dword_count ; ++i ) {
index f64cca8fa0f210f94a1d889b05837f1024cfff04..f49710c9e1496c8a4fc2252a2f4d722d113b52fa 100644 (file)
@@ -329,7 +329,7 @@ static int snd_emu10k1_gpr_ctl_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value
        emu10k1_t *emu = snd_kcontrol_chip(kcontrol);
        snd_emu10k1_fx8010_ctl_t *ctl = (snd_emu10k1_fx8010_ctl_t *)kcontrol->private_value;
        unsigned long flags;
-       int i;
+       unsigned int i;
        
        spin_lock_irqsave(&emu->reg_lock, flags);
        for (i = 0; i < ctl->vcount; i++)
@@ -344,7 +344,8 @@ static int snd_emu10k1_gpr_ctl_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value
        snd_emu10k1_fx8010_ctl_t *ctl = (snd_emu10k1_fx8010_ctl_t *)kcontrol->private_value;
        unsigned long flags;
        unsigned int nval, val;
-       int i, j, change = 0;
+       unsigned int i, j;
+       int change = 0;
        
        spin_lock_irqsave(&emu->reg_lock, flags);
        for (i = 0; i < ctl->vcount; i++) {
@@ -572,7 +573,7 @@ static int snd_emu10k1_fx8010_playback_hw_free(snd_pcm_substream_t * substream)
 {
        emu10k1_t *emu = snd_pcm_substream_chip(substream);
        snd_emu10k1_fx8010_pcm_t *pcm = &emu->fx8010.pcm[substream->number];
-       int i;
+       unsigned int i;
 
        for (i = 0; i < pcm->channels; i++)
                snd_emu10k1_ptr_write(emu, TANKMEMADDRREGBASE + 0x80 + pcm->etram[i], 0, 0);
@@ -585,7 +586,7 @@ static int snd_emu10k1_fx8010_playback_prepare(snd_pcm_substream_t * substream)
        emu10k1_t *emu = snd_pcm_substream_chip(substream);
        snd_pcm_runtime_t *runtime = substream->runtime;
        snd_emu10k1_fx8010_pcm_t *pcm = &emu->fx8010.pcm[substream->number];
-       int i;
+       unsigned int i;
        
        // printk("prepare: etram_pages = 0x%p, dma_area = 0x%x, buffer_size = 0x%x (0x%x)\n", emu->fx8010.etram_pages, runtime->dma_area, runtime->buffer_size, runtime->buffer_size << 2);
        pcm->sw_data = pcm->sw_io = pcm->sw_ready = 0;
@@ -914,7 +915,7 @@ static snd_emu10k1_fx8010_ctl_t *snd_emu10k1_look_for_ctl(emu10k1_t *emu, snd_ct
 
 static int snd_emu10k1_verify_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icode)
 {
-       int i;
+       unsigned int i;
        snd_ctl_elem_id_t *_id, id;
        emu10k1_fx8010_control_gpr_t *_gctl, gctl;
        
@@ -958,7 +959,7 @@ static void snd_emu10k1_ctl_private_free(snd_kcontrol_t *kctl)
 
 static void snd_emu10k1_add_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icode)
 {
-       int i, j;
+       unsigned int i, j;
        emu10k1_fx8010_control_gpr_t *_gctl, gctl;
        snd_emu10k1_fx8010_ctl_t *ctl, nctl;
        snd_kcontrol_new_t knew;
@@ -1020,7 +1021,7 @@ static void snd_emu10k1_add_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icod
 
 static void snd_emu10k1_del_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icode)
 {
-       int i;
+       unsigned int i;
        snd_ctl_elem_id_t *_id, id;
        snd_emu10k1_fx8010_ctl_t *ctl;
        
@@ -1036,7 +1037,7 @@ static void snd_emu10k1_del_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icod
 
 static int snd_emu10k1_list_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icode)
 {
-       int i = 0, j;
+       unsigned int i = 0, j;
        unsigned int total = 0;
        emu10k1_fx8010_control_gpr_t *_gctl, gctl;
        snd_emu10k1_fx8010_ctl_t *ctl;
@@ -1123,7 +1124,8 @@ static int snd_emu10k1_icode_peek(emu10k1_t *emu, emu10k1_fx8010_code_t *icode)
 
 static int snd_emu10k1_ipcm_poke(emu10k1_t *emu, emu10k1_fx8010_pcm_t *ipcm)
 {
-       int err = 0, i;
+       unsigned int i;
+       int err = 0;
        snd_emu10k1_fx8010_pcm_t *pcm;
 
        if (ipcm->substream >= EMU10K1_FX8010_PCM_COUNT)
@@ -1167,7 +1169,8 @@ static int snd_emu10k1_ipcm_poke(emu10k1_t *emu, emu10k1_fx8010_pcm_t *ipcm)
 
 static int snd_emu10k1_ipcm_peek(emu10k1_t *emu, emu10k1_fx8010_pcm_t *ipcm)
 {
-       int err = 0, i;
+       unsigned int i;
+       int err = 0;
        snd_emu10k1_fx8010_pcm_t *pcm;
 
        if (ipcm->substream >= EMU10K1_FX8010_PCM_COUNT)
index 7f368f59473144faf9a472e52bb5af3dd0ef2157..8c9d81336df111b55a0657623c2f562e91a74057 100644 (file)
@@ -1623,7 +1623,8 @@ static int __devinit snd_ensoniq_1370_mixer(ensoniq_t * ensoniq)
 {
        snd_card_t *card = ensoniq->card;
        ak4531_t ak4531;
-       int err, idx;
+       unsigned int idx;
+       int err;
 
        /* try reset AK4531 */
        outw(ES_1370_CODEC_WRITE(AK4531_RESET, 0x02), ES_REG(ensoniq, 1370_CODEC));
@@ -1657,7 +1658,7 @@ static int __devinit snd_ensoniq_1370_mixer(ensoniq_t * ensoniq)
 
 static int snd_ensoniq_joy_enable(ensoniq_t *ensoniq)
 {
-       static int last_jiffies = 0;
+       static unsigned long last_jiffies = 0;
        unsigned long flags;
 
        if (!request_region(ensoniq->gameport.io, 8, "ens137x: gameport")) {
index 4de0e08b524c59dde577c397c1884473cc1c7d40..b1bf302f27af05cbcae8357e087ecc73c1e2b632 100644 (file)
@@ -1341,6 +1341,8 @@ ES1938_SINGLE("Mic Boost (+26dB)", 0, 0x7d, 3, 1, 0)
 
 static int snd_es1938_free(es1938_t *chip)
 {
+       /*if (chip->rmidi)
+         snd_es1938_mixer_bits(chip, ESSSB_IREG_MPU401CONTROL, 0x40, 0);*/
 #if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)
        if (chip->gameport.io)
                gameport_unregister_port(&chip->gameport);
@@ -1540,9 +1542,7 @@ static void snd_es1938_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 
        /* MPU401 */
        if (status & 0x80) {
-               /* ack */
-               snd_es1938_mixer_bits(chip, ESSSB_IREG_MPU401CONTROL, 0x40, 0);
-               printk("midi interrupt..\n");
+               // snd_es1938_mixer_bits(chip, ESSSB_IREG_MPU401CONTROL, 0x40, 0); /* ack? */
                if (chip->rmidi)
                        snd_mpu401_uart_interrupt(irq, chip->rmidi->private_data, regs);
        }
@@ -1554,7 +1554,8 @@ static int __devinit snd_es1938_mixer(snd_pcm_t *pcm)
 {
        snd_card_t *card;
        es1938_t *chip;
-       int err, idx;
+       unsigned int idx;
+       int err;
 
        snd_assert(pcm != NULL && pcm->card != NULL, return -EINVAL);
 
@@ -1563,8 +1564,7 @@ static int __devinit snd_es1938_mixer(snd_pcm_t *pcm)
 
        strcpy(card->mixername, pcm->name);
 
-       for (idx = 0; idx < sizeof(snd_es1938_controls) / 
-                    sizeof(snd_es1938_controls[0]); idx++) {
+       for (idx = 0; idx < ARRAY_SIZE(snd_es1938_controls); idx++) {
                snd_kcontrol_t *kctl;
                kctl = snd_ctl_new1(&snd_es1938_controls[idx], chip);
                switch (idx) {
@@ -1650,7 +1650,9 @@ static int __devinit snd_es1938_probe(struct pci_dev *pci,
        if (snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401,
                                chip->mpu_port, 1, chip->irq, 0, &chip->rmidi) < 0) {
                printk(KERN_ERR "es1938: unable to initialize MPU-401\n");
-       }
+       } /*else
+           snd_es1938_mixer_bits(chip, ESSSB_IREG_MPU401CONTROL, 0x40, 0x40);*/
+
 #if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)
        chip->gameport.io = chip->game_port;
        gameport_register_port(&chip->gameport);
index d27a8d2a73e4589d3169d7527ed02ae847c9f7c3..e538634f169dda14030e24f33e19c047a4c2995e 100644 (file)
@@ -1414,7 +1414,7 @@ static snd_pcm_hardware_t snd_es1968_capture = {
    * DMA memory management *
    *************************/
 
-/* Because the Maestro can only take adresses relative to the PCM base adress
+/* Because the Maestro can only take addresses relative to the PCM base adress
    register :( */
 
 static int calc_available_memory_size(es1968_t *chip)
@@ -2668,7 +2668,7 @@ static int snd_es1968_joystick_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_
        val = oval & ~0x04;
        if (ucontrol->value.integer.value[0])
                val |= 0x04;
-       if (val != oval); {
+       if (val != oval) {
                pci_write_config_word(chip->pci, ESM_LEGACY_AUDIO_CONTROL, val);
                return 1;
        }
@@ -2695,7 +2695,8 @@ static int __devinit snd_es1968_probe(struct pci_dev *pci,
        static int dev;
        snd_card_t *card;
        es1968_t *chip;
-       int i, err;
+       unsigned int i;
+       int err;
 
        if (dev >= SNDRV_CARDS)
                return -ENODEV;
index 88cd1dac6d1b9e7b646f955b5f5c5702c36a1e36..1d6e115315ff52254855fdd4f46c7651089c2f7f 100644 (file)
@@ -130,7 +130,7 @@ struct _snd_fm801 {
        struct resource *res_port;
        unsigned int multichannel: 1,   /* multichannel support */
                     secondary: 1;      /* secondary codec */
-       unsigned char secondary_addr;   /* addres of the secondary codec */
+       unsigned char secondary_addr;   /* address of the secondary codec */
 
        unsigned short ply_ctrl; /* playback control */
        unsigned short cap_ctrl; /* capture control */
@@ -293,7 +293,7 @@ static snd_pcm_hw_constraint_list_t hw_constraints_channels = {
  *  Sample rate routines
  */
 
-static unsigned short snd_fm801_rate_bits(int rate)
+static unsigned short snd_fm801_rate_bits(unsigned int rate)
 {
        unsigned int idx;
 
@@ -855,7 +855,8 @@ static void snd_fm801_mixer_free_ac97(ac97_t *ac97)
 static int __devinit snd_fm801_mixer(fm801_t *chip)
 {
        ac97_t ac97;
-       int err, i;
+       unsigned int i;
+       int err;
 
        memset(&ac97, 0, sizeof(ac97));
        ac97.write = snd_fm801_codec_write;
index 37894701cd0985acce283cf56e8b9a74e7fd34fe..d64ea96d016d6705a59d51d90011ebd23f4d41d9 100644 (file)
@@ -112,7 +112,7 @@ void snd_ice1712_ak4524_write(ice1712_t *ice, int chip,
 
 void snd_ice1712_ak4524_reset(ice1712_t *ice, int state)
 {
-       int chip;
+       unsigned int chip;
        unsigned char reg;
        ak4524_t *ak = &ice->ak4524;
        
@@ -341,7 +341,8 @@ static int snd_ice1712_ak4524_deemphasis_put(snd_kcontrol_t *kcontrol, snd_ctl_e
 
 int __devinit snd_ice1712_ak4524_build_controls(ice1712_t *ice)
 {
-       int err, idx;
+       unsigned int idx;
+       int err;
        ak4524_t *ak = &ice->ak4524;
 
        for (idx = 0; idx < ak->num_dacs; ++idx) {
index 95c088c78b710448f708aec9c58a0f90aef00e73..bc1ad3735cba7a2a0c5374b555da7aebbc95aa15 100644 (file)
@@ -46,6 +46,7 @@ static int __devinit snd_vt1724_amp_add_controls(ice1712_t *ice)
 {
        /* we use pins 39 and 41 of the VT1616 for left and right read outputs */
        snd_ac97_write_cache(ice->ac97, 0x5a, snd_ac97_read(ice->ac97, 0x5a) & ~0x8000);
+       return 0;
 }
 
 
index ca121c7fae72e15cfe67b5b89ee49b28ef42c382..b15edd83151c33bf3afb3977f3cea0a7e82b3bd9 100644 (file)
@@ -851,7 +851,8 @@ static snd_kcontrol_new_t snd_ice1712_6fire_controls[] __devinitdata = {
 
 static int __devinit snd_ice1712_ews_add_controls(ice1712_t *ice)
 {
-       int err, idx;
+       unsigned int idx;
+       int err;
        snd_kcontrol_t *kctl;
        
        /* all terratec cards have spdif */
@@ -873,7 +874,7 @@ static int __devinit snd_ice1712_ews_add_controls(ice1712_t *ice)
        /* card specific controls */
        switch (ice->eeprom.subvendor) {
        case ICE1712_SUBDEVICE_EWX2496:
-               for (idx = 0; idx < sizeof(snd_ice1712_ewx2496_controls)/sizeof(snd_ice1712_ewx2496_controls[0]); idx++) {
+               for (idx = 0; idx < ARRAY_SIZE(snd_ice1712_ewx2496_controls); idx++) {
                        err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_ewx2496_controls[idx], ice));
                        if (err < 0)
                                return err;
@@ -892,14 +893,14 @@ static int __devinit snd_ice1712_ews_add_controls(ice1712_t *ice)
                        return err;
                break;
        case ICE1712_SUBDEVICE_EWS88D:
-               for (idx = 0; idx < sizeof(snd_ice1712_ews88d_controls)/sizeof(snd_ice1712_ews88d_controls[0]); idx++) {
+               for (idx = 0; idx < ARRAY_SIZE(snd_ice1712_ews88d_controls); idx++) {
                        err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_ews88d_controls[idx], ice));
                        if (err < 0)
                                return err;
                }
                break;
        case ICE1712_SUBDEVICE_DMX6FIRE:
-               for (idx = 0; idx < sizeof(snd_ice1712_6fire_controls)/sizeof(snd_ice1712_6fire_controls[0]); idx++) {
+               for (idx = 0; idx < ARRAY_SIZE(snd_ice1712_6fire_controls); idx++) {
                        err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_6fire_controls[idx], ice));
                        if (err < 0)
                                return err;
index 5c5120904532866c48799d6d4e7b4fc9fd2b6dbf..59baf54342790b085440cc1260d32e5f43362466 100644 (file)
@@ -107,9 +107,13 @@ MODULE_PARM_SYNTAX(omni, SNDRV_ENABLED "," SNDRV_ENABLE_DESC);
 #define PCI_DEVICE_ID_VT1724           0x1724
 #endif
 
+enum {
+       TYPE_ICE1712, TYPE_VT1724
+};
+
 static struct pci_device_id snd_ice1712_ids[] __devinitdata = {
-       { PCI_VENDOR_ID_ICE, PCI_DEVICE_ID_ICE_1712, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, },   /* ICE1712 */
-       { PCI_VENDOR_ID_ICE, PCI_DEVICE_ID_VT1724, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, },     /* VT1724 */
+       { PCI_VENDOR_ID_ICE, PCI_DEVICE_ID_ICE_1712, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TYPE_ICE1712 },   /* ICE1712 */
+       { PCI_VENDOR_ID_ICE, PCI_DEVICE_ID_VT1724, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TYPE_VT1724 },    /* VT1724 */
        { 0, }
 };
 
@@ -2701,9 +2705,10 @@ static int snd_ice1712_dev_free(snd_device_t *device)
 }
 
 static int __devinit snd_ice1712_create(snd_card_t * card,
-                                    struct pci_dev *pci,
-                                    int omni,
-                                    ice1712_t ** r_ice1712)
+                                       struct pci_dev *pci,
+                                       int vt1724,
+                                       int omni,
+                                       ice1712_t ** r_ice1712)
 {
        ice1712_t *ice;
        int err;
@@ -2717,7 +2722,7 @@ static int __devinit snd_ice1712_create(snd_card_t * card,
        if ((err = pci_enable_device(pci)) < 0)
                return err;
        /* VT1724 does not have 28bit DMA transfer limit */
-       if (pci->device==PCI_DEVICE_ID_ICE_1712) {
+       if (! vt1724) {
                /* check, if we can restrict PCI DMA transfers to 28 bits */
                if (!pci_dma_supported(pci, 0x0fffffff)) {
                        snd_printk("architecture does not support 28bit PCI busmaster DMA\n");
@@ -2725,13 +2730,13 @@ static int __devinit snd_ice1712_create(snd_card_t * card,
                }
                pci_set_dma_mask(pci, 0x0fffffff);
        }
-       else pci_set_dma_mask(pci, 0xffffffff); 
+       else
+               pci_set_dma_mask(pci, 0xffffffff); 
 
        ice = snd_magic_kcalloc(ice1712_t, 0, GFP_KERNEL);
        if (ice == NULL)
                return -ENOMEM;
-       if (pci->device==PCI_DEVICE_ID_VT1724)
-               ice->vt1724=1;
+       ice->vt1724 = vt1724 ? 1 : 0;
        ice->omni = omni ? 1 : 0;
        spin_lock_init(&ice->reg_lock);
        init_MUTEX(&ice->gpio_mutex);
@@ -2873,6 +2878,7 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci,
        snd_card_t *card;
        ice1712_t *ice;
        int pcm_dev = 0, err;
+       int chip_type;
        struct snd_ice1712_card_info **tbl, *c;
 
        if (dev >= SNDRV_CARDS)
@@ -2886,7 +2892,8 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci,
        if (card == NULL)
                return -ENOMEM;
 
-       if (pci->device==PCI_DEVICE_ID_ICE_1712) {
+       chip_type = pci_id->driver_data;
+       if (chip_type == TYPE_ICE1712) {
                strcpy(card->driver, "ICE1712");
                strcpy(card->shortname, "ICEnsemble ICE1712");
        } else {
@@ -2894,7 +2901,7 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci,
                strcpy(card->shortname, "ICEnsemble ICE1724");
        }
        
-       if ((err = snd_ice1712_create(card, pci, omni[dev], &ice)) < 0) {
+       if ((err = snd_ice1712_create(card, pci, chip_type, omni[dev], &ice)) < 0) {
                snd_card_free(card);
                return err;
        }
index acbc30293ee5c1dfc16eb3e7afaa4fdeda9fe15c..5b3badf4c14688814dc78c5fb464770eee5370d6 100644 (file)
@@ -237,8 +237,8 @@ typedef struct {
 } ice1712_eeprom_t;
 
 struct snd_ak4524 {
-       int num_adcs;                   /* AK4524 or AK4528 ADCs */
-       int num_dacs;                   /* AK4524 or AK4528 DACs */
+       unsigned int num_adcs;          /* AK4524 or AK4528 ADCs */
+       unsigned int num_dacs;          /* AK4524 or AK4528 DACs */
        unsigned char images[4][16];
        unsigned char ipga_gain[4][2];
        /* */
@@ -323,7 +323,7 @@ struct _snd_ice1712 {
 
        unsigned int pro_volumes[20];
        int omni: 1;                    /* Delta Omni I/O */
-       int num_total_dacs;             /* total DACs */
+       unsigned int num_total_dacs;    /* total DACs */
        unsigned char hoontech_boxbits[4];
        unsigned int hoontech_config;
        unsigned short hoontech_boxconfig[4];
index fbc584055520ec3a40aff94aa4e14a2fbc3802f1..703865c5362d6e6048d04ba0bdad46f002d81643 100644 (file)
@@ -711,7 +711,7 @@ static void snd_intel8x0_interrupt(int irq, void *dev_id, struct pt_regs *regs)
        intel8x0_t *chip = snd_magic_cast(intel8x0_t, dev_id, return);
        ichdev_t *ichdev;
        unsigned int status;
-       int i;
+       unsigned int i;
 
        spin_lock(&chip->reg_lock);
        status = igetdword(chip, chip->int_sta_reg);
@@ -1851,7 +1851,8 @@ static int snd_intel8x0_ali_chip_init(intel8x0_t *chip)
 
 static int snd_intel8x0_chip_init(intel8x0_t *chip)
 {
-       int i, err;
+       unsigned int i;
+       int err;
        
        if (chip->device_type != DEVICE_ALI)
                err = snd_intel8x0_ich_chip_init(chip);
@@ -1876,7 +1877,7 @@ static int snd_intel8x0_chip_init(intel8x0_t *chip)
 
 static int snd_intel8x0_free(intel8x0_t *chip)
 {
-       int i;
+       unsigned int i;
 
        if (chip->irq < 0)
                goto __hw_end;
@@ -2129,7 +2130,8 @@ static int __devinit snd_intel8x0_create(snd_card_t * card,
                                         intel8x0_t ** r_intel8x0)
 {
        intel8x0_t *chip;
-       int err, i;
+       int err;
+       unsigned int i;
        unsigned int int_sta_masks;
        ichdev_t *ichdev;
        static snd_device_ops_t ops = {
index 1e6ef1efaf3bb04bb164fbd5c89867fac924d21f..07406465bc49cb4ff9602180cb98d0bb2e1561a6 100644 (file)
@@ -1703,13 +1703,13 @@ static int snd_korg1212_control_route_put(snd_kcontrol_t *kcontrol, snd_ctl_elem
 
        i = kcontrol->private_value;
 
-       if (u->value.enumerated.item[0] != korg1212->sharedBufferPtr->volumeData[i]) {
+       if (u->value.enumerated.item[0] != (unsigned int)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]) {
+               if (u->value.enumerated.item[1] != (unsigned int)korg1212->sharedBufferPtr->volumeData[i+1]) {
                        korg1212->sharedBufferPtr->routeData[i+1] = u->value.enumerated.item[1];
                        change = 1;
                }
@@ -1905,7 +1905,7 @@ static int __devinit snd_korg1212_create(korg1212_t *korg1212)
 {
         struct pci_dev *pci = korg1212->pci;
         int err;
-        int i;
+        unsigned int i;
        unsigned ioport_size, iomem_size, iomem2_size;
        dma_addr_t phys_addr;
 
index 003f7de25dffbb6b02506b4b5d88783ae59cb05f..48a38672addb72730a3044a17dcdd89c4270decc 100644 (file)
@@ -1328,7 +1328,7 @@ static struct play_vals {
 static void
 snd_m3_playback_setup(m3_t *chip, m3_dma_t *s, snd_pcm_substream_t *subs)
 {
-       int i;
+       unsigned int i;
 
        /*
         * some per client initializers
@@ -1355,7 +1355,7 @@ snd_m3_playback_setup(m3_t *chip, m3_dma_t *s, snd_pcm_substream_t *subs)
        /*
         * set an armload of static initializers
         */
-       for (i = 0 ; i < (sizeof(pv) / sizeof(pv[0])) ; i++) 
+       for (i = 0; i < ARRAY_SIZE(pv); i++) 
                snd_m3_assp_write(chip, MEMTYPE_INTERNAL_DATA,
                                  s->inst.data + pv[i].addr, pv[i].val);
 }
@@ -1394,7 +1394,7 @@ static struct rec_vals {
 static void
 snd_m3_capture_setup(m3_t *chip, m3_dma_t *s, snd_pcm_substream_t *subs)
 {
-       int i;
+       unsigned int i;
 
        /*
         * some per client initializers
@@ -1413,7 +1413,7 @@ snd_m3_capture_setup(m3_t *chip, m3_dma_t *s, snd_pcm_substream_t *subs)
        /*
         * set an armload of static initializers
         */
-       for (i = 0 ; i < (sizeof(rv) / sizeof(rv[0])) ; i++) 
+       for (i = 0; i < ARRAY_SIZE(rv); i++) 
                snd_m3_assp_write(chip, MEMTYPE_INTERNAL_DATA,
                                  s->inst.data + rv[i].addr, rv[i].val);
 }
@@ -2121,7 +2121,7 @@ static u16 minisrc_lpf[MINISRC_LPF_LEN] = {
 
 static void snd_m3_assp_init(m3_t *chip)
 {
-       int i;
+       unsigned int i;
 
        /* zero kernel data */
        for (i = 0; i < (REV_B_DATA_MEMORY_UNIT_LENGTH * NUM_UNITS_KERNEL_DATA) / 2; i++)
index 2336a659f89ab2d2be9d869481c5c6d3f002b392..d865bd8910ff5c1e3452afd00b7fb3a16fbea8c2 100644 (file)
@@ -405,7 +405,7 @@ snd_nm256_load_coefficient(nm256_t *chip, int stream, int number)
 
 
 /* The actual rates supported by the card. */
-static int samplerates[8] = {
+static unsigned int samplerates[8] = {
        8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000,
 };
 #define NUM_SAMPLERATES (sizeof(samplerates) / sizeof(samplerates[0]))
@@ -419,9 +419,9 @@ static snd_pcm_hw_constraint_list_t constraints_rates = {
  * return the index of the target rate
  */
 static int
-snd_nm256_fixed_rate(int rate)
+snd_nm256_fixed_rate(unsigned int rate)
 {
-       int i;
+       unsigned int i;
        for (i = 0; i < NUM_SAMPLERATES; i++) {
                if (rate == samplerates[i])
                        return i;
@@ -1533,7 +1533,7 @@ snd_nm256_create(snd_card_t *card, struct pci_dev *pci,
        if ((err = snd_nm256_pcm(chip, 0)) < 0)
                goto __error;
        
-       if ((err = snd_nm256_mixer(chip) < 0))
+       if ((err = snd_nm256_mixer(chip)) < 0)
                goto __error;
 
        // pci_set_master(pci); /* needed? */
index cdea96b7a73e42a4ea6584250ce4c88c949657c6..52ef21cdd02e8295ad6bb57984884ec5a68024c9 100644 (file)
@@ -685,7 +685,7 @@ snd_rme32_playback_hw_params(snd_pcm_substream_t * substream,
        if ((rme32->rcreg & RME32_RCR_KMODE) &&
            (rate = snd_rme32_capture_getrate(rme32, &dummy)) > 0) {
                /* AutoSync */
-               if (params_rate(params) != rate) {
+               if ((int)params_rate(params) != rate) {
                        spin_unlock_irq(&rme32->lock);
                        return -EIO;
                }
@@ -750,7 +750,7 @@ snd_rme32_capture_hw_params(snd_pcm_substream_t * substream,
                return err;
        }
        if ((rate = snd_rme32_capture_getrate(rme32, &isadat)) > 0) {
-                if (params_rate(params) != rate) {
+                if ((int)params_rate(params) != rate) {
                         spin_unlock_irqrestore(&rme32->lock, flags);
                         return -EIO;                    
                 }
@@ -1633,7 +1633,7 @@ snd_rme32_get_inputtype_control(snd_kcontrol_t * kcontrol,
 {
        rme32_t *rme32 = _snd_kcontrol_chip(kcontrol);
        unsigned long flags;
-       int items = 3;
+       unsigned int items = 3;
 
        spin_lock_irqsave(&rme32->lock, flags);
        ucontrol->value.enumerated.item[0] = snd_rme32_getinputtype(rme32);
@@ -1681,7 +1681,7 @@ snd_rme32_put_inputtype_control(snd_kcontrol_t * kcontrol,
        val = ucontrol->value.enumerated.item[0] % items;
 
        spin_lock_irqsave(&rme32->lock, flags);
-       change = val != snd_rme32_getinputtype(rme32);
+       change = val != (unsigned int)snd_rme32_getinputtype(rme32);
        snd_rme32_setinputtype(rme32, val);
        spin_unlock_irqrestore(&rme32->lock, flags);
        return change;
@@ -1729,7 +1729,7 @@ snd_rme32_put_clockmode_control(snd_kcontrol_t * kcontrol,
 
        val = ucontrol->value.enumerated.item[0] % 3;
        spin_lock_irqsave(&rme32->lock, flags);
-       change = val != snd_rme32_getclockmode(rme32);
+       change = val != (unsigned int)snd_rme32_getclockmode(rme32);
        snd_rme32_setclockmode(rme32, val);
        spin_unlock_irqrestore(&rme32->lock, flags);
        return change;
index 5986e8e9e015a8fb5d62134c4946418f1e3c84ab..7dac42ec1396ff19470376b77e67c9c8c4cae9e9 100644 (file)
@@ -311,6 +311,9 @@ static int
 snd_rme96_create_switches(snd_card_t *card,
                          rme96_t *rme96);
 
+static int
+snd_rme96_getinputtype(rme96_t *rme96);
+
 static inline unsigned int
 snd_rme96_playback_ptr(rme96_t *rme96)
 {
@@ -679,6 +682,7 @@ snd_rme96_playback_getrate(rme96_t *rme96)
        int rate, dummy;
 
        if (!(rme96->wcreg & RME96_WCR_MASTER) &&
+            snd_rme96_getinputtype(rme96) != RME96_INPUT_ANALOG &&
            (rate = snd_rme96_capture_getrate(rme96, &dummy)) > 0)
        {
                /* slave clock */
@@ -992,10 +996,11 @@ snd_rme96_playback_hw_params(snd_pcm_substream_t *substream,
                return err;
        spin_lock_irqsave(&rme96->lock, flags);
        if (!(rme96->wcreg & RME96_WCR_MASTER) &&
+            snd_rme96_getinputtype(rme96) != RME96_INPUT_ANALOG &&
            (rate = snd_rme96_capture_getrate(rme96, &dummy)) > 0)
        {
                 /* slave clock */
-                if (params_rate(params) != rate) {
+                if ((int)params_rate(params) != rate) {
                        spin_unlock_irqrestore(&rme96->lock, flags);
                        return -EIO;                    
                 }
@@ -1059,17 +1064,8 @@ snd_rme96_capture_hw_params(snd_pcm_substream_t *substream,
                        spin_unlock_irqrestore(&rme96->lock, flags);
                        return err;
                }
-       }
-       snd_rme96_setframelog(rme96, params_channels(params), 0);
-       if (rme96->playback_periodsize != 0) {
-               if (params_period_size(params) << rme96->capture_frlog !=
-                   rme96->playback_periodsize)
-               {
-                       spin_unlock_irqrestore(&rme96->lock, flags);
-                       return -EBUSY;
-               }
        } else if ((rate = snd_rme96_capture_getrate(rme96, &isadat)) > 0) {
-                if (params_rate(params) != rate) {
+                if ((int)params_rate(params) != rate) {
                        spin_unlock_irqrestore(&rme96->lock, flags);
                        return -EIO;                    
                 }
@@ -1080,6 +1076,15 @@ snd_rme96_capture_hw_params(snd_pcm_substream_t *substream,
                        return -EIO;
                 }
         }
+       snd_rme96_setframelog(rme96, params_channels(params), 0);
+       if (rme96->playback_periodsize != 0) {
+               if (params_period_size(params) << rme96->capture_frlog !=
+                   rme96->playback_periodsize)
+               {
+                       spin_unlock_irqrestore(&rme96->lock, flags);
+                       return -EBUSY;
+               }
+       }
        rme96->capture_periodsize =
                params_period_size(params) << rme96->capture_frlog;
        snd_rme96_set_period_properties(rme96, rme96->capture_periodsize);
@@ -1209,6 +1214,7 @@ snd_rme96_playback_spdif_open(snd_pcm_substream_t *substream)
 
        runtime->hw = snd_rme96_playback_spdif_info;
        if (!(rme96->wcreg & RME96_WCR_MASTER) &&
+            snd_rme96_getinputtype(rme96) != RME96_INPUT_ANALOG &&
            (rate = snd_rme96_capture_getrate(rme96, &dummy)) > 0)
        {
                 /* slave clock */
@@ -1237,7 +1243,9 @@ snd_rme96_capture_spdif_open(snd_pcm_substream_t *substream)
        snd_pcm_set_sync(substream);
 
        runtime->hw = snd_rme96_capture_spdif_info;
-        if ((rate = snd_rme96_capture_getrate(rme96, &isadat)) > 0) {
+        if (snd_rme96_getinputtype(rme96) != RME96_INPUT_ANALOG &&
+            (rate = snd_rme96_capture_getrate(rme96, &isadat)) > 0)
+        {
                 if (isadat) {
                         return -EIO;
                 }
@@ -1285,6 +1293,7 @@ snd_rme96_playback_adat_open(snd_pcm_substream_t *substream)
        
        runtime->hw = snd_rme96_playback_adat_info;
        if (!(rme96->wcreg & RME96_WCR_MASTER) &&
+            snd_rme96_getinputtype(rme96) != RME96_INPUT_ANALOG &&
            (rate = snd_rme96_capture_getrate(rme96, &dummy)) > 0)
        {
                 /* slave clock */
@@ -1308,6 +1317,11 @@ snd_rme96_capture_adat_open(snd_pcm_substream_t *substream)
        snd_pcm_set_sync(substream);
 
        runtime->hw = snd_rme96_capture_adat_info;
+        if (snd_rme96_getinputtype(rme96) != RME96_INPUT_ANALOG) {
+                /* makes no sense to use analog input. Note that analog
+                   expension cards AEB4/8-I are RME96_INPUT_INTERNAL */
+                return -EIO;
+        }
         if ((rate = snd_rme96_capture_getrate(rme96, &isadat)) > 0) {
                 if (!isadat) {
                         return -EIO;
@@ -1850,6 +1864,10 @@ snd_rme96_proc_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer)
                snd_iprintf(buffer, "  clock mode: word clock\n");
        } else if (rme96->wcreg & RME96_WCR_MASTER) {
                snd_iprintf(buffer, "  clock mode: master\n");
+       } else if (snd_rme96_getinputtype(rme96) == RME96_INPUT_ANALOG) {
+               snd_iprintf(buffer, "  clock mode: slave (master anyway due to analog input setting)\n");
+       } else if (snd_rme96_capture_getrate(rme96, &n) < 0) {
+               snd_iprintf(buffer, "  clock mode: slave (master anyway due to no valid signal)\n");
        } else {
                snd_iprintf(buffer, "  clock mode: slave\n");
        }
@@ -1995,7 +2013,7 @@ snd_rme96_get_inputtype_control(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
 {
        rme96_t *rme96 = _snd_kcontrol_chip(kcontrol);
        unsigned long flags;
-       int items = 3;
+       unsigned int items = 3;
        
        spin_lock_irqsave(&rme96->lock, flags);
        ucontrol->value.enumerated.item[0] = snd_rme96_getinputtype(rme96);
@@ -2067,7 +2085,7 @@ snd_rme96_put_inputtype_control(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
        }
        
        spin_lock_irqsave(&rme96->lock, flags);
-       change = val != snd_rme96_getinputtype(rme96);
+       change = (int)val != snd_rme96_getinputtype(rme96);
        snd_rme96_setinputtype(rme96, val);
        spin_unlock_irqrestore(&rme96->lock, flags);
        return change;
@@ -2108,7 +2126,7 @@ snd_rme96_put_clockmode_control(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
        
        val = ucontrol->value.enumerated.item[0] % 3;
        spin_lock_irqsave(&rme96->lock, flags);
-       change = val != snd_rme96_getclockmode(rme96);
+       change = (int)val != snd_rme96_getclockmode(rme96);
        snd_rme96_setclockmode(rme96, val);
        spin_unlock_irqrestore(&rme96->lock, flags);
        return change;
@@ -2149,7 +2167,8 @@ snd_rme96_put_attenuation_control(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_
        
        val = ucontrol->value.enumerated.item[0] % 4;
        spin_lock_irqsave(&rme96->lock, flags);
-       change = val != snd_rme96_getattenuation(rme96);
+
+       change = (int)val != snd_rme96_getattenuation(rme96);
        snd_rme96_setattenuation(rme96, val);
        spin_unlock_irqrestore(&rme96->lock, flags);
        return change;
@@ -2190,7 +2209,7 @@ snd_rme96_put_montracks_control(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
        
        val = ucontrol->value.enumerated.item[0] % 4;
        spin_lock_irqsave(&rme96->lock, flags);
-       change = val != snd_rme96_getmontracks(rme96);
+       change = (int)val != snd_rme96_getmontracks(rme96);
        snd_rme96_setmontracks(rme96, val);
        spin_unlock_irqrestore(&rme96->lock, flags);
        return change;
index 30859a768ea5ec48841cab07d227645b89eb5dff..0269449aab6ce28429950784ac14cfcea71b9cf8 100644 (file)
@@ -461,7 +461,7 @@ static inline int hdsp_fifo_wait(hdsp_t *hdsp, int count, int timeout)
        */
        
        for (i = 0; i < timeout; i++)
-               if ((hdsp_read (hdsp, HDSP_fifoStatus) & 0xff) <= count)
+               if ((int)(hdsp_read (hdsp, HDSP_fifoStatus) & 0xff) <= count)
                        return 0;
 
        snd_printk ("wait for FIFO status <= %d failed after %d iterations\n",
@@ -844,7 +844,6 @@ static int snd_hdsp_midi_output_write (hdsp_midi_t *hmidi)
 {
        unsigned long flags;
        int n_pending;
-       int clear_timer = 0;
        int to_write;
        int i;
        unsigned char buf[128];
@@ -856,23 +855,15 @@ static int snd_hdsp_midi_output_write (hdsp_midi_t *hmidi)
        if (hmidi->output) {
                if (!snd_rawmidi_transmit_empty (hmidi->output)) {
                        if ((n_pending = snd_hdsp_midi_output_possible (hmidi->hdsp, hmidi->id)) > 0) {
-                               if (n_pending > sizeof (buf))
+                               if (n_pending > (int)sizeof (buf))
                                        n_pending = sizeof (buf);
                                
                                if ((to_write = snd_rawmidi_transmit (hmidi->output, buf, n_pending)) > 0) {
                                        for (i = 0; i < to_write; ++i) 
                                                snd_hdsp_midi_write_byte (hmidi->hdsp, hmidi->id, buf[i]);
-                               } else {
-                                       clear_timer = 1;
                                }
                        }
-               } else {
-                       clear_timer = 1;
                }
-
-               if (clear_timer && hmidi->istimer && --hmidi->istimer <= 0) {
-                       del_timer(&hmidi->timer);
-               } 
        }
 
        spin_unlock_irqrestore (&hmidi->lock, flags);
@@ -890,7 +881,7 @@ static int snd_hdsp_midi_input_read (hdsp_midi_t *hmidi)
 
        if ((n_pending = snd_hdsp_midi_input_available (hmidi->hdsp, hmidi->id)) > 0) {
                if (hmidi->input) {
-                       if (n_pending > sizeof (buf)) {
+                       if (n_pending > (int)sizeof (buf)) {
                                n_pending = sizeof (buf);
                        }
                        for (i = 0; i < n_pending; ++i) {
@@ -980,6 +971,8 @@ static void snd_hdsp_midi_output_trigger(snd_rawmidi_substream_t * substream, in
                }
        }
        spin_unlock_irqrestore (&hmidi->lock, flags);
+       if (up)
+               snd_hdsp_midi_output_write(hmidi);
 }
 
 static int snd_hdsp_midi_input_open(snd_rawmidi_substream_t * substream)
@@ -1296,7 +1289,7 @@ static int snd_hdsp_put_spdif_out(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_
                return -EBUSY;
        val = ucontrol->value.integer.value[0] & 1;
        spin_lock_irqsave(&hdsp->lock, flags);
-       change = val != hdsp_spdif_out(hdsp);
+       change = (int)val != hdsp_spdif_out(hdsp);
        hdsp_set_spdif_output(hdsp, val);
        spin_unlock_irqrestore(&hdsp->lock, flags);
        return change;
@@ -1411,7 +1404,7 @@ static int snd_hdsp_put_sync_pref(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_
        max = hdsp->ss_channels == (hdsp->type == Digiface) ? 7 : 6;
        val = ucontrol->value.enumerated.item[0] % max;
        spin_lock_irqsave(&hdsp->lock, flags);
-       change = val != hdsp_sync_pref(hdsp);
+       change = (int)val != hdsp_sync_pref(hdsp);
        hdsp_set_sync_pref(hdsp, val);
        spin_unlock_irqrestore(&hdsp->lock, flags);
        return change;
@@ -1515,7 +1508,7 @@ static int snd_hdsp_put_line_out(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
                return -EBUSY;
        val = ucontrol->value.integer.value[0] & 1;
        spin_lock_irqsave(&hdsp->lock, flags);
-       change = val != hdsp_line_out(hdsp);
+       change = (int)val != hdsp_line_out(hdsp);
        hdsp_set_line_output(hdsp, val);
        spin_unlock_irqrestore(&hdsp->lock, flags);
        return change;
@@ -1584,7 +1577,8 @@ static int snd_hdsp_put_mixer(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *
        gain = ucontrol->value.integer.value[2];
 
        spin_lock_irqsave(&hdsp->lock, flags);
-       if ((change = gain != hdsp_read_gain(hdsp, addr)))
+       change = gain != hdsp_read_gain(hdsp, addr);
+       if (change)
                hdsp_write_gain(hdsp, addr, gain);
        spin_unlock_irqrestore(&hdsp->lock, flags);
        return change;
@@ -1662,7 +1656,8 @@ static int snd_hdsp_put_playback_mixer(snd_kcontrol_t * kcontrol, snd_ctl_elem_v
 
 
        spin_lock_irqsave(&hdsp->lock, flags);
-       if ((change = gain != hdsp_read_gain(hdsp, addr)))
+       change = gain != hdsp_read_gain(hdsp, addr);
+       if (change)
                hdsp_write_gain(hdsp, addr, gain);
        spin_unlock_irqrestore(&hdsp->lock, flags);
        return change;
@@ -1834,7 +1829,8 @@ static snd_kcontrol_new_t snd_hdsp_playback_rms = HDSP_RMS_PLAYBACK;
 
 int snd_hdsp_create_controls(snd_card_t *card, hdsp_t *hdsp)
 {
-       int idx, err, limit;
+       unsigned int idx, limit;
+       int err;
        snd_kcontrol_t *kctl;
 
        for (idx = 0; idx < HDSP_CONTROLS; idx++) {
@@ -2402,7 +2398,7 @@ static int snd_hdsp_hw_params(snd_pcm_substream_t *substream,
                   that matter are the same.
                 */
 
-               if (params_rate(params) != hdsp_system_sample_rate(hdsp)) {
+               if ((int)params_rate(params) != hdsp_system_sample_rate(hdsp)) {
                        spin_unlock_irq(&hdsp->lock);
                        _snd_pcm_hw_param_setempty(params, SNDRV_PCM_HW_PARAM_RATE);
                        return -EBUSY;
@@ -2578,9 +2574,9 @@ static snd_pcm_hardware_t snd_hdsp_playback_subinfo =
        .rate_max =             96000,
        .channels_min =         14,
        .channels_max =         HDSP_MAX_CHANNELS,
-       .buffer_bytes_max =     1024*1024,
-       .period_bytes_min =     1,
-       .period_bytes_max =     1024*1024,
+       .buffer_bytes_max =     HDSP_CHANNEL_BUFFER_BYTES * HDSP_MAX_CHANNELS,
+       .period_bytes_min =     (64 * 4) *10,
+       .period_bytes_max =     (8192 * 4) * HDSP_MAX_CHANNELS,
        .periods_min =          2,
        .periods_max =          2,
        .fifo_size =            0,
@@ -2603,9 +2599,9 @@ static snd_pcm_hardware_t snd_hdsp_capture_subinfo =
        .rate_max =             96000,
        .channels_min =         14,
        .channels_max =         HDSP_MAX_CHANNELS,
-       .buffer_bytes_max =     1024*1024,
-       .period_bytes_min =     1,
-       .period_bytes_max =     1024*1024,
+       .buffer_bytes_max =     HDSP_CHANNEL_BUFFER_BYTES * HDSP_MAX_CHANNELS,
+       .period_bytes_min =     (64 * 4) * 10,
+       .period_bytes_max =     (8192 * 4) * HDSP_MAX_CHANNELS,
        .periods_min =          2,
        .periods_max =          2,
        .fifo_size =            0,
index 646b925100a27ce9b9f824c4ba4ad163419bd45b..0d59f7b55f165dce71abc2c08d543b7772c1b0b3 100644 (file)
@@ -374,7 +374,7 @@ static inline void rme9652_compute_period_size(rme9652_t *rme9652)
 static snd_pcm_uframes_t rme9652_hw_pointer(rme9652_t *rme9652)
 {
        int status;
-       int offset, frag;
+       unsigned int offset, frag;
        snd_pcm_uframes_t period_size = rme9652->period_bytes / 4;
        snd_pcm_sframes_t delta;
 
@@ -389,7 +389,7 @@ static snd_pcm_uframes_t rme9652_hw_pointer(rme9652_t *rme9652)
 
        delta = rme9652->prev_hw_offset - offset;
        delta &= 0xffff;
-       if (delta <= rme9652->max_jitter * 4)
+       if (delta <= (snd_pcm_sframes_t)rme9652->max_jitter * 4)
                offset = rme9652->prev_hw_offset;
        else
                rme9652->prev_hw_offset = offset;
@@ -1102,7 +1102,7 @@ static int snd_rme9652_put_spdif_out(snd_kcontrol_t * kcontrol, snd_ctl_elem_val
                return -EBUSY;
        val = ucontrol->value.integer.value[0] & 1;
        spin_lock_irqsave(&rme9652->lock, flags);
-       change = val != rme9652_spdif_out(rme9652);
+       change = (int)val != rme9652_spdif_out(rme9652);
        rme9652_set_spdif_output(rme9652, val);
        spin_unlock_irqrestore(&rme9652->lock, flags);
        return change;
@@ -1189,7 +1189,7 @@ static int snd_rme9652_put_sync_mode(snd_kcontrol_t * kcontrol, snd_ctl_elem_val
        
        val = ucontrol->value.enumerated.item[0] % 3;
        spin_lock_irqsave(&rme9652->lock, flags);
-       change = val != rme9652_sync_mode(rme9652);
+       change = (int)val != rme9652_sync_mode(rme9652);
        rme9652_set_sync_mode(rme9652, val);
        spin_unlock_irqrestore(&rme9652->lock, flags);
        return change;
@@ -1286,7 +1286,7 @@ static int snd_rme9652_put_sync_pref(snd_kcontrol_t * kcontrol, snd_ctl_elem_val
        max = rme9652->ss_channels == RME9652_NCHANNELS ? 4 : 3;
        val = ucontrol->value.enumerated.item[0] % max;
        spin_lock_irqsave(&rme9652->lock, flags);
-       change = val != rme9652_sync_pref(rme9652);
+       change = (int)val != rme9652_sync_pref(rme9652);
        rme9652_set_sync_pref(rme9652, val);
        spin_unlock_irqrestore(&rme9652->lock, flags);
        return change;
@@ -1600,7 +1600,8 @@ RME9652_ADAT1_IN("ADAT1 Input Source", 0);
 
 int snd_rme9652_create_controls(snd_card_t *card, rme9652_t *rme9652)
 {
-       int idx, err;
+       unsigned int idx;
+       int err;
        snd_kcontrol_t *kctl;
 
        for (idx = 0; idx < RME9652_CONTROLS; idx++) {
@@ -2095,7 +2096,7 @@ static int snd_rme9652_hw_params(snd_pcm_substream_t *substream,
                   that matter are the same.
                 */
 
-               if (params_rate(params) !=
+               if ((int)params_rate(params) !=
                    rme9652_adat_sample_rate(rme9652)) {
                        spin_unlock_irq(&rme9652->lock);
                        _snd_pcm_hw_param_setempty(params, SNDRV_PCM_HW_PARAM_RATE);
@@ -2267,9 +2268,9 @@ static snd_pcm_hardware_t snd_rme9652_playback_subinfo =
        .rate_max =             96000,
        .channels_min =         10,
        .channels_max =         26,
-       .buffer_bytes_max =     1024*1024,
-       .period_bytes_min =     1,
-       .period_bytes_max =     1024*1024,
+       .buffer_bytes_max =     RME9652_CHANNEL_BUFFER_BYTES * 26,
+       .period_bytes_min =     (64 * 4) * 10,
+       .period_bytes_max =     (8192 * 4) * 26,
        .periods_min =          2,
        .periods_max =          2,
        .fifo_size =            0,
@@ -2290,9 +2291,9 @@ static snd_pcm_hardware_t snd_rme9652_capture_subinfo =
        .rate_max =             96000,
        .channels_min =         10,
        .channels_max =         26,
-       .buffer_bytes_max =     1024*1024,
-       .period_bytes_min =     1,
-       .period_bytes_max =     1024*1024,
+       .buffer_bytes_max =     RME9652_CHANNEL_BUFFER_BYTES *26,
+       .period_bytes_min =     (64 * 4) * 10,
+       .period_bytes_max =     (8192 * 4) * 26,
        .periods_min =          2,
        .periods_max =          2,
        .fifo_size =            0,
index ecc1be3df90f9f48eb7b75aa094f778f1146fbb4..f8604cb08a8d647409aca9651b3b5d92fd4447e4 100644 (file)
@@ -1119,7 +1119,8 @@ static int __devinit snd_sonicvibes_mixer(sonicvibes_t * sonic)
 {
        snd_card_t *card;
        snd_kcontrol_t *kctl;
-       int idx, err;
+       unsigned int idx;
+       int err;
 
        snd_assert(sonic != NULL && sonic->card != NULL, return -EINVAL);
        card = sonic->card;
@@ -1418,7 +1419,8 @@ static int __devinit snd_sonicvibes_midi(sonicvibes_t * sonic, snd_rawmidi_t * r
        mpu401_t * mpu = snd_magic_cast(mpu401_t, rmidi->private_data, return -ENXIO);
        snd_card_t *card = sonic->card;
        snd_rawmidi_str_t *dir;
-       int idx, err;
+       unsigned int idx;
+       int err;
 
        mpu->private_data = sonic;
        mpu->open_input = snd_sonicvibes_midi_input_open;
index 4650f77a3060ff856192c780ab2027b71592e22e..65bc5b703239f000ec86cf19b7b8433f427ae0b1 100644 (file)
@@ -12,7 +12,7 @@ snd-trident-synth-objs := trident_synth.o
 #   <empty string> - CONFIG_SND_SEQUENCER is undefined
 #   otherwise parameter #1 value
 #
-sequencer := $(if $(subst y,,$(CONFIG_SND_SEQUENCER)),m,$(if $(CONFIG_SND_SEQUENCER),$(1)))
+sequencer = $(if $(subst y,,$(CONFIG_SND_SEQUENCER)),$(if $(1),m),$(if $(CONFIG_SND_SEQUENCER),$(1)))
 
 # Toplevel Module Dependency
 obj-$(CONFIG_SND_TRIDENT) += snd-trident.o
index 5c604e727e540210e1482254fef8a32ff0c3734f..4d296912f542a431ad5528211a592edd1fd7d0bd 100644 (file)
@@ -1577,11 +1577,11 @@ static snd_pcm_uframes_t snd_trident_playback_pointer(snd_pcm_substream_t * subs
                cso = (unsigned int) inl(TRID_REG(trident, CH_NX_DELTA_CSO)) & 0x00ffffff;
        }
 
-       if (++cso > runtime->buffer_size)
-               cso = runtime->buffer_size;
-
        spin_unlock(&trident->reg_lock);
 
+       if (++cso >= runtime->buffer_size)
+               cso = 0;
+
        return cso;
 }
 
@@ -1609,7 +1609,8 @@ static snd_pcm_uframes_t snd_trident_capture_pointer(snd_pcm_substream_t * subst
        result = inw(TRID_REG(trident, T4D_SBBL_SBCL));
        if (runtime->channels > 1)
                result >>= 1;
-       result = runtime->buffer_size - result;
+       if (result > 0)
+               result = runtime->buffer_size - result;
 
        // printk("capture result = 0x%x, cso = 0x%x\n", result, cso);
 
@@ -3670,10 +3671,10 @@ static void snd_trident_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                        delta = (int)stimer - (int)voice->stimer;
                        if (delta < 0)
                                delta = -delta;
-                       if (delta < voice->spurious_threshold) {
+                       if ((unsigned int)delta < voice->spurious_threshold) {
                                /* do some statistics here */
                                trident->spurious_irq_count++;
-                               if (trident->spurious_irq_max_delta < delta)
+                               if (trident->spurious_irq_max_delta < (unsigned int)delta)
                                        trident->spurious_irq_max_delta = delta;
                                continue;
                        }
index b8eea1db4a2da704cdf4f9eea1285fce7b2996cc..e1340f24c88f179fe9007779f24eccf39afed69d 100644 (file)
@@ -392,7 +392,7 @@ static void sample_volume(trident_t * trident, snd_trident_voice_t * voice, snd_
                                        break;
                } else {                        /* attenuate right (pan left) */
                        for (voice->Pan = 0; voice->Pan < 63; voice->Pan++ ) 
-                               if (volume->lr >= pan_table[voice->Pan] )
+                               if ((unsigned int)volume->lr >= pan_table[voice->Pan] )
                                        break;
                        voice->Pan |= 0x40;
                }
@@ -746,7 +746,7 @@ static int snd_trident_synth_use(void *private_data, snd_seq_port_subscribe_t *
        snd_trident_port_t *port = (snd_trident_port_t *) private_data;
        trident_t *trident = port->trident;
        snd_trident_voice_t *voice;
-       int idx;
+       unsigned int idx;
        unsigned long flags;
 
        if (info->voices > 32)
@@ -909,6 +909,7 @@ static int snd_trident_synth_create_port(trident_t * trident, int idx)
                                                   SNDRV_SEQ_PORT_TYPE_MIDI_GS |
                                                   SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE |
                                                   SNDRV_SEQ_PORT_TYPE_SYNTH,
+                                                  16,
                                                   name);
        if (p->chset->port < 0) {
                result = p->chset->port;
index c4827f02330d9aab116553a6e5256677e621d6d7..64bf0e46267f9a99f0a9cbf9c3583367f2f4cf96 100644 (file)
@@ -88,7 +88,7 @@ MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
 MODULE_PARM(mpu_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
 MODULE_PARM_DESC(mpu_port, "MPU-401 port.");
 MODULE_PARM_SYNTAX(mpu_port, SNDRV_PORT_DESC);
-MODULE_PARM(ac97_clock, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+MODULE_PARM(ac97_clock, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
 MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (default 48000Hz).");
 MODULE_PARM_SYNTAX(ac97_clock, SNDRV_ENABLED ",default:48000");
 
@@ -101,6 +101,14 @@ MODULE_PARM_SYNTAX(ac97_clock, SNDRV_ENABLED ",default:48000");
 #define PCI_DEVICE_ID_VIA_8233_5       0x3059
 #endif
 
+/* revision numbers for via686 */
+#define VIA_REV_686_A          0x10
+#define VIA_REV_686_B          0x11
+#define VIA_REV_686_C          0x12
+#define VIA_REV_686_D          0x13
+#define VIA_REV_686_E          0x14
+#define VIA_REV_686_H          0x20
+
 /* revision numbers for via8233 */
 #define VIA_REV_PRE_8233       0x10    /* not in market */
 #define VIA_REV_8233C          0x20    /* 2 rec, 4 pb, 1 multi-pb */
@@ -113,6 +121,7 @@ MODULE_PARM_SYNTAX(ac97_clock, SNDRV_ENABLED ",default:48000");
  */
 
 #define VIAREG(via, x) ((via)->port + VIA_REG_##x)
+#define VIADEV_REG(viadev, x) ((viadev)->port + VIA_REG_##x)
 
 /* common offsets */
 #define VIA_REG_OFFSET_STATUS          0x00    /* byte - channel status */
@@ -180,21 +189,51 @@ DEFINE_VIA_REGSET(FM, 0x20);
 #define   VIA_REG_AC97_CMD_MASK                0x7e
 #define   VIA_REG_AC97_DATA_SHIFT      0
 #define   VIA_REG_AC97_DATA_MASK       0xffff
+
 #define VIA_REG_SGD_SHADOW             0x84    /* dword */
+/* via686 */
+#define   VIA_REG_SGD_STAT_PB_FLAG     (1<<0)
+#define   VIA_REG_SGD_STAT_CP_FLAG     (1<<1)
+#define   VIA_REG_SGD_STAT_FM_FLAG     (1<<2)
+#define   VIA_REG_SGD_STAT_PB_EOL      (1<<4)
+#define   VIA_REG_SGD_STAT_CP_EOL      (1<<5)
+#define   VIA_REG_SGD_STAT_FM_EOL      (1<<6)
+#define   VIA_REG_SGD_STAT_PB_STOP     (1<<8)
+#define   VIA_REG_SGD_STAT_CP_STOP     (1<<9)
+#define   VIA_REG_SGD_STAT_FM_STOP     (1<<10)
+#define   VIA_REG_SGD_STAT_PB_ACTIVE   (1<<12)
+#define   VIA_REG_SGD_STAT_CP_ACTIVE   (1<<13)
+#define   VIA_REG_SGD_STAT_FM_ACTIVE   (1<<14)
+/* via8233 */
+#define   VIA8233_REG_SGD_STAT_FLAG    (1<<0)
+#define   VIA8233_REG_SGD_STAT_EOL     (1<<1)
+#define   VIA8233_REG_SGD_STAT_STOP    (1<<2)
+#define   VIA8233_REG_SGD_STAT_ACTIVE  (1<<3)
+#define   VIA8233_REG_SGD_SDX0_SHIFT   0
+#define   VIA8233_REG_SGD_SDX1_SHIFT   4
+#define   VIA8233_REG_SGD_SDX2_SHIFT   8
+#define   VIA8233_REG_SGD_SDX3_SHIFT   12
+#define   VIA8233_REG_SGD_MCHAN_SHIFT  16
+#define   VIA8233_REG_SGD_REC0_SHIFT   24
+#define   VIA8233_REG_SGD_REC1_SHIFT   28
+
+#define VIA_REG_GPI_STATUS             0x88
+#define VIA_REG_GPI_INTR               0x8c
 
 /* multi-channel and capture registers for via8233 */
 DEFINE_VIA_REGSET(MULTPLAY, 0x40);
 DEFINE_VIA_REGSET(CAPTURE_8233, 0x60);
 
 /* via8233-specific registers */
-#define VIA_REG_PLAYBACK_VOLUME_L      0x02    /* byte */
-#define VIA_REG_PLAYBACK_VOLUME_R      0x03    /* byte */
-#define VIA_REG_MULTPLAY_FORMAT                0x42    /* byte - format and channels */
+#define VIA_REG_OFS_PLAYBACK_VOLUME_L  0x02    /* byte */
+#define VIA_REG_OFS_PLAYBACK_VOLUME_R  0x03    /* byte */
+#define VIA_REG_OFS_MULTPLAY_FORMAT    0x02    /* byte - format and channels */
 #define   VIA_REG_MULTPLAY_FMT_8BIT    0x00
 #define   VIA_REG_MULTPLAY_FMT_16BIT   0x80
 #define   VIA_REG_MULTPLAY_FMT_CH_MASK 0x70    /* # channels << 4 (valid = 1,2,4,6) */
-#define VIA_REG_CAPTURE_FIFO           0x62    /* byte - bit 6 = fifo  enable */
+#define VIA_REG_OFS_CAPTURE_FIFO       0x62    /* byte - bit 6 = fifo  enable */
 #define   VIA_REG_CAPTURE_FIFO_ENABLE  0x40
+
 #define VIA_REG_CAPTURE_CHANNEL                0x63    /* byte - input select */
 #define   VIA_REG_CAPTURE_CHANNEL_MIC  0x4
 #define   VIA_REG_CAPTURE_CHANNEL_LINE 0
@@ -203,6 +242,46 @@ DEFINE_VIA_REGSET(CAPTURE_8233, 0x60);
 #define VIA_TBL_BIT_FLAG       0x40000000
 #define VIA_TBL_BIT_EOL                0x80000000
 
+/* pci space */
+#define VIA_ACLINK_STAT                0x40
+#define  VIA_ACLINK_C11_READY  0x20
+#define  VIA_ACLINK_C10_READY  0x10
+#define  VIA_ACLINK_C01_READY  0x04 /* secondary codec ready */
+#define  VIA_ACLINK_LOWPOWER   0x02 /* low-power state */
+#define  VIA_ACLINK_C00_READY  0x01 /* primary codec ready */
+#define VIA_ACLINK_CTRL                0x41
+#define  VIA_ACLINK_CTRL_ENABLE        0x80 /* 0: disable, 1: enable */
+#define  VIA_ACLINK_CTRL_RESET 0x40 /* 0: assert, 1: de-assert */
+#define  VIA_ACLINK_CTRL_SYNC  0x20 /* 0: release SYNC, 1: force SYNC hi */
+#define  VIA_ACLINK_CTRL_SDO   0x10 /* 0: release SDO, 1: force SDO hi */
+#define  VIA_ACLINK_CTRL_VRA   0x08 /* 0: disable VRA, 1: enable VRA */
+#define  VIA_ACLINK_CTRL_PCM   0x04 /* 0: disable PCM, 1: enable PCM */
+#define  VIA_ACLINK_CTRL_FM    0x02 /* via686 only */
+#define  VIA_ACLINK_CTRL_SB    0x01 /* via686 only */
+#define  VIA_ACLINK_CTRL_INIT  (VIA_ACLINK_CTRL_ENABLE|\
+                                VIA_ACLINK_CTRL_RESET|\
+                                VIA_ACLINK_CTRL_PCM|\
+                                VIA_ACLINK_CTRL_VRA)
+#define VIA_FUNC_ENABLE                0x42
+#define  VIA_FUNC_MIDI_PNP     0x80 /* FIXME: it's 0x40 in the datasheet! */
+#define  VIA_FUNC_MIDI_IRQMASK 0x40 /* FIXME: not documented! */
+#define  VIA_FUNC_RX2C_WRITE   0x20
+#define  VIA_FUNC_SB_FIFO_EMPTY        0x10
+#define  VIA_FUNC_ENABLE_GAME  0x08
+#define  VIA_FUNC_ENABLE_FM    0x04
+#define  VIA_FUNC_ENABLE_MIDI  0x02
+#define  VIA_FUNC_ENABLE_SB    0x01
+#define VIA_PNP_CONTROL                0x43
+#define VIA_FM_NMI_CTRL                0x48
+#define VIA8233_VOLCHG_CTRL    0x48
+#define VIA8233_SPDIF_CTRL     0x49
+#define  VIA8233_SPDIF_DX3     0x08
+#define  VIA8233_SPDIF_SLOT_MASK       0x03
+#define  VIA8233_SPDIF_SLOT_1011       0x00
+#define  VIA8233_SPDIF_SLOT_34         0x01
+#define  VIA8233_SPDIF_SLOT_78         0x02
+#define  VIA8233_SPDIF_SLOT_69         0x03
+
 /*
  */
 
@@ -223,6 +302,7 @@ struct snd_via_sg_table {
 
 struct via_dev {
        unsigned int reg_offset;
+       unsigned long port;
        int direction;  /* playback = 0, capture = 1 */
         snd_pcm_substream_t *substream;
        int running;
@@ -324,7 +404,8 @@ static void clean_via_table(viadev_t *dev, snd_pcm_substream_t *substream,
 /*
  */
 
-enum { TYPE_VIA686 = 1, TYPE_VIA8233 };
+enum { TYPE_CARD_VIA686 = 1, TYPE_CARD_VIA8233 };
+enum { TYPE_VIA686, TYPE_VIA8233, TYPE_VIA8233A };
 
 #define VIA_MAX_DEVS   7       /* 4 playback, 1 multi, 2 capture */
 
@@ -345,11 +426,15 @@ struct _snd_via82xx {
        unsigned char old_legacy;
        unsigned char old_legacy_cfg;
 
+       unsigned char playback_volume[2]; /* for VIA8233/C/8235; default = 0 */
+
+       unsigned int intr_mask; /* SGD_SHADOW mask to check interrupts */
+
        struct pci_dev *pci;
        snd_card_t *card;
 
-       int num_devs;
-       int playback_devno, multi_devno, capture_devno;
+       unsigned int num_devs;
+       unsigned int playback_devno, multi_devno, capture_devno;
        viadev_t devs[VIA_MAX_DEVS];
        struct via_rate_lock rates[2]; /* playback and capture */
 
@@ -365,8 +450,8 @@ struct _snd_via82xx {
 };
 
 static struct pci_device_id snd_via82xx_ids[] __devinitdata = {
-       { 0x1106, 0x3058, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TYPE_VIA686, }, /* 686A */
-       { 0x1106, 0x3059, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TYPE_VIA8233, },        /* VT8233 */
+       { 0x1106, 0x3058, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TYPE_CARD_VIA686, },    /* 686A */
+       { 0x1106, 0x3059, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TYPE_CARD_VIA8233, },   /* VT8233 */
        { 0, }
 };
 
@@ -474,16 +559,15 @@ static unsigned short snd_via82xx_codec_read(ac97_t *ac97, unsigned short reg)
 
 static void snd_via82xx_channel_reset(via82xx_t *chip, viadev_t *viadev)
 {
-       unsigned long port = chip->port + viadev->reg_offset;
-
-       outb(VIA_REG_CTRL_PAUSE | VIA_REG_CTRL_TERMINATE | VIA_REG_CTRL_RESET, port + VIA_REG_OFFSET_CONTROL);
+       outb(VIA_REG_CTRL_PAUSE | VIA_REG_CTRL_TERMINATE | VIA_REG_CTRL_RESET,
+            VIADEV_REG(viadev, OFFSET_CONTROL));
        udelay(50);
        /* disable interrupts */
-       outb(0x00, port + VIA_REG_OFFSET_CONTROL);
+       outb(0x00, VIADEV_REG(viadev, OFFSET_CONTROL));
        /* clear interrupts */
-       outb(0x03, port + VIA_REG_OFFSET_STATUS);
-       outb(0x00, port + VIA_REG_OFFSET_TYPE); /* for via686 */
-       outl(0, port + VIA_REG_OFFSET_CURR_PTR);
+       outb(0x03, VIADEV_REG(viadev, OFFSET_STATUS));
+       outb(0x00, VIADEV_REG(viadev, OFFSET_TYPE)); /* for via686 */
+       // outl(0, VIADEV_REG(viadev, OFFSET_CURR_PTR));
        viadev->lastpos = 0;
 }
 
@@ -496,29 +580,30 @@ static void snd_via82xx_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 {
        via82xx_t *chip = snd_magic_cast(via82xx_t, dev_id, return);
        unsigned int status;
-       int i;
+       unsigned int i;
 
        spin_lock(&chip->reg_lock);
-       if (chip->chip_type == TYPE_VIA686) {
-               /* check mpu401 interrupt */
-               status = inl(VIAREG(chip, SGD_SHADOW));
-               if ((status & 0x00000077) == 0) {
-                       spin_unlock(&chip->reg_lock);
-                       if (chip->rmidi != NULL)
-                               snd_mpu401_uart_interrupt(irq, chip->rmidi->private_data, regs);
-                       return;
-               }
+       status = inl(VIAREG(chip, SGD_SHADOW));
+       if (! (status & chip->intr_mask)) {
+               spin_unlock(&chip->reg_lock);
+               if (chip->rmidi)
+                       /* check mpu401 interrupt */
+                       snd_mpu401_uart_interrupt(irq, chip->rmidi->private_data, regs);
+               return;
        }
+
        /* check status for each stream */
        for (i = 0; i < chip->num_devs; i++) {
                viadev_t *viadev = &chip->devs[i];
-               if (inb(chip->port + viadev->reg_offset) & (VIA_REG_STAT_EOL|VIA_REG_STAT_FLAG)) {
-                       outb(VIA_REG_STAT_FLAG | VIA_REG_STAT_EOL, VIAREG(chip, OFFSET_STATUS) + viadev->reg_offset);
-                       if (viadev->substream && viadev->running) {
-                               spin_unlock(&chip->reg_lock);
-                               snd_pcm_period_elapsed(viadev->substream);
-                               spin_lock(&chip->reg_lock);
-                       }
+               unsigned char status = inb(VIADEV_REG(viadev, OFFSET_STATUS));
+               status &= (VIA_REG_STAT_EOL|VIA_REG_STAT_FLAG);
+               if (! status)
+                       continue;
+               outb(status, VIADEV_REG(viadev, OFFSET_STATUS)); /* ack */
+               if (viadev->substream && viadev->running) {
+                       spin_unlock(&chip->reg_lock);
+                       snd_pcm_period_elapsed(viadev->substream);
+                       spin_lock(&chip->reg_lock);
                }
        }
        spin_unlock(&chip->reg_lock);
@@ -536,9 +621,8 @@ static int snd_via82xx_pcm_trigger(snd_pcm_substream_t * substream, int cmd)
        via82xx_t *chip = snd_pcm_substream_chip(substream);
        viadev_t *viadev = (viadev_t *)substream->runtime->private_data;
        unsigned char val;
-       unsigned long port = chip->port + viadev->reg_offset;
 
-       if (chip->chip_type == TYPE_VIA8233)
+       if (chip->chip_type != TYPE_VIA686)
                val = VIA_REG_CTRL_INT;
        else
                val = 0;
@@ -561,7 +645,7 @@ static int snd_via82xx_pcm_trigger(snd_pcm_substream_t * substream, int cmd)
        default:
                return -EINVAL;
        }
-       outb(val, port + VIA_REG_OFFSET_CONTROL);
+       outb(val, VIADEV_REG(viadev, OFFSET_CONTROL));
        if (cmd == SNDRV_PCM_TRIGGER_STOP)
                snd_via82xx_channel_reset(chip, viadev);
        return 0;
@@ -615,15 +699,15 @@ static snd_pcm_uframes_t snd_via686_pcm_pointer(snd_pcm_substream_t *substream)
        unsigned int idx, ptr, count, res;
 
        snd_assert(viadev->tbl_entries, return 0);
-       if (!(inb(VIAREG(chip, OFFSET_STATUS) + viadev->reg_offset) & VIA_REG_STAT_ACTIVE))
+       if (!(inb(VIADEV_REG(viadev, OFFSET_STATUS)) & VIA_REG_STAT_ACTIVE))
                return 0;
 
        spin_lock(&chip->reg_lock);
-       count = inl(VIAREG(chip, OFFSET_CURR_COUNT) + viadev->reg_offset) & 0xffffff;
+       count = inl(VIADEV_REG(viadev, OFFSET_CURR_COUNT)) & 0xffffff;
        /* The via686a does not have the current index register,
         * so we need to calculate the index from CURR_PTR.
         */
-       ptr = inl(VIAREG(chip, OFFSET_CURR_PTR) + viadev->reg_offset);
+       ptr = inl(VIADEV_REG(viadev, OFFSET_CURR_PTR));
        if (ptr <= (unsigned int)viadev->table_addr)
                idx = 0;
        else /* CURR_PTR holds the address + 8 */
@@ -644,13 +728,20 @@ static snd_pcm_uframes_t snd_via8233_pcm_pointer(snd_pcm_substream_t *substream)
        unsigned int idx, count, res;
        
        snd_assert(viadev->tbl_entries, return 0);
-       if (!(inb(VIAREG(chip, OFFSET_STATUS) + viadev->reg_offset) & VIA_REG_STAT_ACTIVE))
+       if (!(inb(VIADEV_REG(viadev, OFFSET_STATUS)) & VIA_REG_STAT_ACTIVE))
                return 0;
        spin_lock(&chip->reg_lock);
-       count = inl(VIAREG(chip, OFFSET_CURR_COUNT) + viadev->reg_offset);
+       count = inl(VIADEV_REG(viadev, OFFSET_CURR_COUNT));
        idx = count >> 24;
-       count &= 0xffffff;
-       res = calc_linear_pos(viadev, idx, count);
+       if (idx >= viadev->tbl_entries) {
+#ifdef POINTER_DEBUG
+               printk("fail: invalid idx = %i/%i\n", idx, viadev->tbl_entries);
+#endif
+               res = viadev->lastpos;
+       } else {
+               count &= 0xffffff;
+               res = calc_linear_pos(viadev, idx, count);
+       }
        spin_unlock(&chip->reg_lock);
 
        return bytes_to_frames(substream->runtime, res);
@@ -695,22 +786,31 @@ static int snd_via82xx_hw_free(snd_pcm_substream_t * substream)
 }
 
 
+/*
+ * set up the table pointer
+ */
+static void snd_via82xx_set_table_ptr(via82xx_t *chip, viadev_t *viadev)
+{
+       snd_via82xx_codec_ready(chip, 0);
+       outl((u32)viadev->table_addr, VIADEV_REG(viadev, OFFSET_TABLE_PTR));
+       udelay(20);
+       snd_via82xx_codec_ready(chip, 0);
+}
+
 /*
  * prepare callback for playback and capture on via686
  */
 static void via686_setup_format(via82xx_t *chip, viadev_t *viadev, snd_pcm_runtime_t *runtime)
 {
-       unsigned long port = chip->port + viadev->reg_offset;
-
        snd_via82xx_channel_reset(chip, viadev);
        /* this must be set after channel_reset */
-       outl((u32)viadev->table_addr, port + VIA_REG_OFFSET_TABLE_PTR);
+       snd_via82xx_set_table_ptr(chip, viadev);
        outb(VIA_REG_TYPE_AUTOSTART |
             (runtime->format == SNDRV_PCM_FORMAT_S16_LE ? VIA_REG_TYPE_16BIT : 0) |
             (runtime->channels > 1 ? VIA_REG_TYPE_STEREO : 0) |
             ((viadev->reg_offset & 0x10) == 0 ? VIA_REG_TYPE_INT_LSAMPLE : 0) |
             VIA_REG_TYPE_INT_EOL |
-            VIA_REG_TYPE_INT_FLAG, port + VIA_REG_OFFSET_TYPE);
+            VIA_REG_TYPE_INT_FLAG, VIADEV_REG(viadev, OFFSET_TYPE));
 }
 
 static int snd_via686_playback_prepare(snd_pcm_substream_t *substream)
@@ -763,7 +863,6 @@ static int snd_via8233_playback_prepare(snd_pcm_substream_t *substream)
 {
        via82xx_t *chip = snd_pcm_substream_chip(substream);
        viadev_t *viadev = (viadev_t *)substream->runtime->private_data;
-       unsigned long port = chip->port + viadev->reg_offset;
        snd_pcm_runtime_t *runtime = substream->runtime;
        int rate_changed;
        u32 rbits;
@@ -777,14 +876,16 @@ static int snd_via8233_playback_prepare(snd_pcm_substream_t *substream)
        rbits = (0xfffff / 48000) * runtime->rate + ((0xfffff % 48000) * runtime->rate) / 48000;
        snd_assert((rbits & ~0xfffff) == 0, return -EINVAL);
        snd_via82xx_channel_reset(chip, viadev);
-       outl((u32)viadev->table_addr, port + VIA_REG_OFFSET_TABLE_PTR);
-       outb(0 , VIAREG(chip, PLAYBACK_VOLUME_L));
-       outb(0 , VIAREG(chip, PLAYBACK_VOLUME_R));
+       snd_via82xx_set_table_ptr(chip, viadev);
+       outb(chip->playback_volume[0], VIADEV_REG(viadev, OFS_PLAYBACK_VOLUME_L));
+       outb(chip->playback_volume[1], VIADEV_REG(viadev, OFS_PLAYBACK_VOLUME_R));
        outl((runtime->format == SNDRV_PCM_FORMAT_S16_LE ? VIA8233_REG_TYPE_16BIT : 0) | /* format */
             (runtime->channels > 1 ? VIA8233_REG_TYPE_STEREO : 0) | /* stereo */
             rbits | /* rate */
             0xff000000,    /* STOP index is never reached */
-            port + VIA_REG_OFFSET_STOP_IDX);
+            VIADEV_REG(viadev, OFFSET_STOP_IDX));
+       udelay(20);
+       snd_via82xx_codec_ready(chip, 0);
        return 0;
 }
 
@@ -795,7 +896,6 @@ static int snd_via8233_multi_prepare(snd_pcm_substream_t *substream)
 {
        via82xx_t *chip = snd_pcm_substream_chip(substream);
        viadev_t *viadev = (viadev_t *)substream->runtime->private_data;
-       unsigned long port = chip->port + viadev->reg_offset;
        snd_pcm_runtime_t *runtime = substream->runtime;
        unsigned int slots;
        int fmt;
@@ -807,11 +907,11 @@ static int snd_via8233_multi_prepare(snd_pcm_substream_t *substream)
        snd_ac97_set_rate(chip->ac97, AC97_PCM_LFE_DAC_RATE, runtime->rate);
        snd_ac97_set_rate(chip->ac97, AC97_SPDIF, runtime->rate);
        snd_via82xx_channel_reset(chip, viadev);
-       outl((u32)viadev->table_addr, port + VIA_REG_OFFSET_TABLE_PTR);
+       snd_via82xx_set_table_ptr(chip, viadev);
 
        fmt = (runtime->format == SNDRV_PCM_FORMAT_S16_LE) ? VIA_REG_MULTPLAY_FMT_16BIT : VIA_REG_MULTPLAY_FMT_8BIT;
        fmt |= runtime->channels << 4;
-       outb(fmt, port + VIA_REG_OFFSET_TYPE);
+       outb(fmt, VIADEV_REG(viadev, OFS_MULTPLAY_FORMAT));
        /* set sample number to slot 3, 4, 7, 8, 6, 9 */
        /* corresponding to FL, FR, RL, RR, C, LFE ?? */
        switch (runtime->channels) {
@@ -824,7 +924,9 @@ static int snd_via8233_multi_prepare(snd_pcm_substream_t *substream)
        default: slots = 0; break;
        }
        /* STOP index is never reached */
-       outl(0xff000000 | slots, port + VIA_REG_OFFSET_STOP_IDX);
+       outl(0xff000000 | slots, VIADEV_REG(viadev, OFFSET_STOP_IDX));
+       udelay(20);
+       snd_via82xx_codec_ready(chip, 0);
        return 0;
 }
 
@@ -835,19 +937,20 @@ static int snd_via8233_capture_prepare(snd_pcm_substream_t *substream)
 {
        via82xx_t *chip = snd_pcm_substream_chip(substream);
        viadev_t *viadev = (viadev_t *)substream->runtime->private_data;
-       unsigned long port = chip->port + viadev->reg_offset;
        snd_pcm_runtime_t *runtime = substream->runtime;
 
        if (via_lock_rate(&chip->rates[1], runtime->rate) < 0)
                return -EINVAL;
        snd_ac97_set_rate(chip->ac97, AC97_PCM_LR_ADC_RATE, runtime->rate);
        snd_via82xx_channel_reset(chip, viadev);
-       outl((u32)viadev->table_addr, port + VIA_REG_OFFSET_TABLE_PTR);
-       outb(VIA_REG_CAPTURE_FIFO_ENABLE, VIAREG(chip, CAPTURE_FIFO));
+       snd_via82xx_set_table_ptr(chip, viadev);
+       outb(VIA_REG_CAPTURE_FIFO_ENABLE, VIADEV_REG(viadev, OFS_CAPTURE_FIFO));
        outl((runtime->format == SNDRV_PCM_FORMAT_S16_LE ? VIA8233_REG_TYPE_16BIT : 0) |
             (runtime->channels > 1 ? VIA8233_REG_TYPE_STEREO : 0) |
             0xff000000,    /* STOP index is never reached */
-            port + VIA_REG_OFFSET_STOP_IDX);
+            VIADEV_REG(viadev, OFFSET_STOP_IDX));
+       udelay(20);
+       snd_via82xx_codec_ready(chip, 0);
        return 0;
 }
 
@@ -950,7 +1053,7 @@ static int snd_via8233_multi_open(snd_pcm_substream_t * substream)
        if ((err = snd_via82xx_pcm_open(chip, viadev, substream)) < 0)
                return err;
        substream->runtime->hw.channels_max = 6;
-       if (chip->revision == VIA_REV_8233A)
+       if (chip->chip_type == TYPE_VIA8233A)
                snd_pcm_hw_constraint_list(substream->runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, &hw_constraints_channels);
        return 0;
 }
@@ -1055,6 +1158,13 @@ static snd_pcm_ops_t snd_via8233_capture_ops = {
 };
 
 
+static void init_viadev(via82xx_t *chip, int idx, unsigned int reg_offset, int direction)
+{
+       chip->devs[idx].reg_offset = reg_offset;
+       chip->devs[idx].direction = direction;
+       chip->devs[idx].port = chip->port + reg_offset;
+}
+
 /*
  * create pcm instances for VIA8233, 8233C and 8235 (not 8233A)
  */
@@ -1067,6 +1177,7 @@ static int __devinit snd_via8233_pcm_new(via82xx_t *chip)
        chip->multi_devno = 4;          /* x 1 */
        chip->capture_devno = 5;        /* x 2 */
        chip->num_devs = 7;
+       chip->intr_mask = 0x33033333; /* FLAG|EOL for rec0-1, mc, sdx0-3 */
 
        /* PCM #0:  4 DSX playbacks and 1 capture */
        err = snd_pcm_new(chip->card, chip->card->shortname, 0, 4, 1, &pcm);
@@ -1077,13 +1188,10 @@ static int __devinit snd_via8233_pcm_new(via82xx_t *chip)
        pcm->private_data = chip;
        strcpy(pcm->name, chip->card->shortname);
        /* set up playbacks */
-       for (i = 0; i < 4; i++) {
-               chip->devs[i].reg_offset = 0x10 * i;
-               chip->devs[i].direction = 0;
-       }
+       for (i = 0; i < 4; i++)
+               init_viadev(chip, i, 0x10 * i, 0);
        /* capture */
-       chip->devs[chip->capture_devno].reg_offset = VIA_REG_CAPTURE_8233_STATUS;
-       chip->devs[chip->capture_devno].direction = 1;
+       init_viadev(chip, chip->capture_devno, VIA_REG_CAPTURE_8233_STATUS, 1);
 
        if ((err = snd_pcm_lib_preallocate_sg_pages_for_all(chip->pci, pcm)) < 0)
                return err;
@@ -1097,11 +1205,9 @@ static int __devinit snd_via8233_pcm_new(via82xx_t *chip)
        pcm->private_data = chip;
        strcpy(pcm->name, chip->card->shortname);
        /* set up playback */
-       chip->devs[chip->multi_devno].reg_offset = VIA_REG_MULTPLAY_STATUS;
-       chip->devs[chip->multi_devno].direction = 0;
+       init_viadev(chip, chip->multi_devno, VIA_REG_MULTPLAY_STATUS, 0);
        /* set up capture */
-       chip->devs[chip->capture_devno + 1].reg_offset = VIA_REG_CAPTURE_8233_STATUS + 0x10;
-       chip->devs[chip->capture_devno + 1].direction = 1;
+       init_viadev(chip, chip->capture_devno + 1, VIA_REG_CAPTURE_8233_STATUS + 0x10, 1);
 
        if ((err = snd_pcm_lib_preallocate_sg_pages_for_all(chip->pci, pcm)) < 0)
                return err;
@@ -1117,10 +1223,11 @@ static int __devinit snd_via8233a_pcm_new(via82xx_t *chip)
        snd_pcm_t *pcm;
        int err;
 
-       chip->playback_devno = 0;
-       chip->multi_devno = 1;
+       chip->multi_devno = 0;
+       chip->playback_devno = 1;
        chip->capture_devno = 2;
        chip->num_devs = 3;
+       chip->intr_mask = 0x03033000; /* FLAG|EOL for rec0, mc, sdx3 */
 
        /* PCM #0:  multi-channel playback and capture */
        err = snd_pcm_new(chip->card, chip->card->shortname, 0, 1, 1, &pcm);
@@ -1131,11 +1238,9 @@ static int __devinit snd_via8233a_pcm_new(via82xx_t *chip)
        pcm->private_data = chip;
        strcpy(pcm->name, chip->card->shortname);
        /* set up playback */
-       chip->devs[chip->multi_devno].reg_offset = VIA_REG_MULTPLAY_STATUS;
-       chip->devs[chip->multi_devno].direction = 0;
+       init_viadev(chip, chip->multi_devno, VIA_REG_MULTPLAY_STATUS, 0);
        /* capture */
-       chip->devs[chip->capture_devno].reg_offset = VIA_REG_CAPTURE_8233_STATUS;
-       chip->devs[chip->capture_devno].direction = 1;
+       init_viadev(chip, chip->capture_devno, VIA_REG_CAPTURE_8233_STATUS, 1);
 
        if ((err = snd_pcm_lib_preallocate_sg_pages_for_all(chip->pci, pcm)) < 0)
                return err;
@@ -1148,8 +1253,7 @@ static int __devinit snd_via8233a_pcm_new(via82xx_t *chip)
        pcm->private_data = chip;
        strcpy(pcm->name, chip->card->shortname);
        /* set up playback */
-       chip->devs[chip->playback_devno].reg_offset = 0x30;
-       chip->devs[chip->playback_devno].direction = 0;
+       init_viadev(chip, chip->playback_devno, 0x30, 0);
 
        if ((err = snd_pcm_lib_preallocate_sg_pages_for_all(chip->pci, pcm)) < 0)
                return err;
@@ -1168,6 +1272,7 @@ static int __devinit snd_via686_pcm_new(via82xx_t *chip)
        chip->playback_devno = 0;
        chip->capture_devno = 1;
        chip->num_devs = 2;
+       chip->intr_mask = 0x77; /* FLAG | EOL for PB, CP, FM */
 
        err = snd_pcm_new(chip->card, chip->card->shortname, 0, 1, 1, &pcm);
        if (err < 0)
@@ -1176,10 +1281,8 @@ static int __devinit snd_via686_pcm_new(via82xx_t *chip)
        snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_via686_capture_ops);
        pcm->private_data = chip;
        strcpy(pcm->name, chip->card->shortname);
-       chip->devs[0].reg_offset = VIA_REG_PLAYBACK_STATUS;
-       chip->devs[0].direction = 0;
-       chip->devs[1].reg_offset = VIA_REG_CAPTURE_STATUS;
-       chip->devs[1].direction = 1;
+       init_viadev(chip, 0, VIA_REG_PLAYBACK_STATUS, 0);
+       init_viadev(chip, 1, VIA_REG_CAPTURE_STATUS, 1);
 
        if ((err = snd_pcm_lib_preallocate_sg_pages_for_all(chip->pci, pcm)) < 0)
                return err;
@@ -1254,8 +1357,8 @@ static int snd_via8233_dxs3_spdif_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_val
        via82xx_t *chip = snd_kcontrol_chip(kcontrol);
        u8 val;
 
-       pci_read_config_byte(chip->pci, 0x49, &val);
-       ucontrol->value.integer.value[0] = (val & 0x08) ? 1 : 0;
+       pci_read_config_byte(chip->pci, VIA8233_SPDIF_CTRL, &val);
+       ucontrol->value.integer.value[0] = (val & VIA8233_SPDIF_DX3) ? 1 : 0;
        return 0;
 }
 
@@ -1264,12 +1367,12 @@ static int snd_via8233_dxs3_spdif_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_val
        via82xx_t *chip = snd_kcontrol_chip(kcontrol);
        u8 val, oval;
 
-       pci_read_config_byte(chip->pci, 0x49, &oval);
-       val = oval & ~0x08;
+       pci_read_config_byte(chip->pci, VIA8233_SPDIF_CTRL, &oval);
+       val = oval & ~VIA8233_SPDIF_DX3;
        if (ucontrol->value.integer.value[0])
-               val |= 0x08;
+               val |= VIA8233_SPDIF_DX3;
        if (val != oval) {
-               pci_write_config_byte(chip->pci, 0x49, val);
+               pci_write_config_byte(chip->pci, VIA8233_SPDIF_CTRL, val);
                return 1;
        }
        return 0;
@@ -1283,6 +1386,48 @@ static snd_kcontrol_new_t snd_via8233_dxs3_spdif_control __devinitdata = {
        .put = snd_via8233_dxs3_spdif_put,
 };
 
+static int snd_via8233_dxs_volume_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
+{
+       uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
+       uinfo->count = 2;
+       uinfo->value.integer.min = 0;
+       uinfo->value.integer.max = 0xff;
+       return 0;
+}
+
+static int snd_via8233_dxs_volume_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+{
+       via82xx_t *chip = snd_kcontrol_chip(kcontrol);
+       ucontrol->value.integer.value[0] = 0xff - chip->playback_volume[0];
+       ucontrol->value.integer.value[1] = 0xff - chip->playback_volume[1];
+       return 0;
+}
+
+static int snd_via8233_dxs_volume_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+{
+       via82xx_t *chip = snd_kcontrol_chip(kcontrol);
+       unsigned char val;
+       int change;
+
+       val = 0xff - ucontrol->value.integer.value[0];
+       change = val != chip->playback_volume[0];
+       if (val)
+               chip->playback_volume[0] = val;
+       val = 0xff - ucontrol->value.integer.value[1];
+       change |= val != chip->playback_volume[1];
+       if (val)
+               chip->playback_volume[1] = val;
+       return change;
+}
+
+static snd_kcontrol_new_t snd_via8233_dxs_volume_control __devinitdata = {
+       .name = "VIA DXS Playback Volume",
+       .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+       .info = snd_via8233_dxs_volume_info,
+       .get = snd_via8233_dxs_volume_get,
+       .put = snd_via8233_dxs_volume_put,
+};
+
 /*
  */
 
@@ -1306,6 +1451,12 @@ static int __devinit snd_via82xx_mixer_new(via82xx_t *chip)
        ac97.clock = chip->ac97_clock;
        if ((err = snd_ac97_mixer(chip->card, &ac97, &chip->ac97)) < 0)
                return err;
+
+       if (chip->chip_type != TYPE_VIA686) {
+               /* use slot 10/11 */
+               snd_ac97_update_bits(chip->ac97, AC97_EXTENDED_STATUS, 0x03 << 4, 0x03 << 4);
+       }
+
        return 0;
 }
 
@@ -1327,8 +1478,8 @@ static int snd_via82xx_joystick_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value
        via82xx_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;
+       pci_read_config_word(chip->pci, VIA_FUNC_ENABLE, &val);
+       ucontrol->value.integer.value[0] = (val & VIA_FUNC_ENABLE_GAME) ? 1 : 0;
        return 0;
 }
 
@@ -1337,12 +1488,12 @@ static int snd_via82xx_joystick_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value
        via82xx_t *chip = snd_kcontrol_chip(kcontrol);
        u16 val, oval;
 
-       pci_read_config_word(chip->pci, 0x42, &oval);
-       val = oval & ~0x08;
+       pci_read_config_word(chip->pci, VIA_FUNC_ENABLE, &oval);
+       val = oval & ~VIA_FUNC_ENABLE_GAME;
        if (ucontrol->value.integer.value[0])
-               val |= 0x08;
+               val |= VIA_FUNC_ENABLE_GAME;
        if (val != oval) {
-               pci_write_config_word(chip->pci, 0x42, val);
+               pci_write_config_word(chip->pci, VIA_FUNC_ENABLE, val);
                return 1;
        }
        return 0;
@@ -1365,7 +1516,7 @@ static int snd_via8233_init_misc(via82xx_t *chip, int dev)
        int i, err, caps;
        unsigned char val;
 
-       caps = chip->revision == VIA_REV_8233A ? 1 : 2;
+       caps = chip->chip_type == TYPE_VIA8233A ? 1 : 2;
        for (i = 0; i < caps; i++) {
                snd_via8233_capture_source.index = i;
                err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_via8233_capture_source, chip));
@@ -1373,13 +1524,16 @@ static int snd_via8233_init_misc(via82xx_t *chip, int dev)
                        return err;
        }
        err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_via8233_dxs3_spdif_control, chip));
+       if (err < 0)
+               return err;
+       err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_via8233_dxs_volume_control, chip));
        if (err < 0)
                return err;
 
        /* select spdif data slot 10/11 */
-       pci_read_config_byte(chip->pci, 0x49, &val);
-       val &= ~0x03;
-       pci_write_config_byte(chip->pci, 0x49, val);
+       pci_read_config_byte(chip->pci, VIA8233_SPDIF_CTRL, &val);
+       val = (val & ~VIA8233_SPDIF_SLOT_MASK) | VIA8233_SPDIF_SLOT_1011;
+       pci_write_config_byte(chip->pci, VIA8233_SPDIF_CTRL, val);
 
        return 0;
 }
@@ -1391,65 +1545,62 @@ static int snd_via686_init_misc(via82xx_t *chip, int dev)
 
        legacy = chip->old_legacy;
        legacy_cfg = chip->old_legacy_cfg;
-       legacy |= 0x40;         /* disable MIDI */
-       legacy &= ~0x08;        /* disable joystick */
-       if (chip->revision >= 0x20) {
-               if (check_region(pci_resource_start(chip->pci, 2), 4)) {
-                       rev_h = 0;
-                       legacy &= ~0x80;        /* disable PCI I/O 2 */
-               } else {
-                       rev_h = 1;
-                       legacy |= 0x80;         /* enable PCI I/O 2 */
-               }
+       legacy |= VIA_FUNC_MIDI_IRQMASK;        /* FIXME: correct? (disable MIDI) */
+       legacy &= ~VIA_FUNC_ENABLE_GAME;        /* disable joystick */
+       if (chip->revision >= VIA_REV_686_H) {
+               rev_h = 1;
+               if (check_region(pci_resource_start(chip->pci, 2), 4))
+                       legacy &= ~VIA_FUNC_MIDI_PNP;   /* disable PCI I/O 2 */
+               else
+                       legacy |= VIA_FUNC_MIDI_PNP;    /* enable PCI I/O 2 */
        }
-       pci_write_config_byte(chip->pci, 0x42, legacy);
-       pci_write_config_byte(chip->pci, 0x43, legacy_cfg);
-       if (rev_h && mpu_port[dev] >= 0x200) {  /* force MIDI */
-               legacy |= 0x02; /* enable MPU */
-               pci_write_config_dword(chip->pci, 0x18, (mpu_port[dev] & 0xfffc) | 0x01);
-       } else {
-               if (rev_h && (legacy & 0x02)) {
+       pci_write_config_byte(chip->pci, VIA_FUNC_ENABLE, legacy);
+       pci_write_config_byte(chip->pci, VIA_PNP_CONTROL, legacy_cfg);
+       if (rev_h) {
+               if (mpu_port[dev] >= 0x200) {   /* force MIDI */
+                       pci_write_config_dword(chip->pci, 0x18, (mpu_port[dev] & 0xfffc) | 0x01);
+               } else if (legacy & VIA_FUNC_MIDI_PNP) {
                        mpu_port[dev] = pci_resource_start(chip->pci, 2);
                        if (mpu_port[dev] < 0x200)      /* bad value */
-                               legacy &= ~0x02;        /* disable MIDI */
-               } else {
-                       switch (mpu_port[dev]) {        /* force MIDI */
-                       case 0x300:
-                       case 0x310:
-                       case 0x320:
-                       case 0x330:
-                               legacy_cfg &= ~(3 << 2);
-                               legacy_cfg |= (mpu_port[dev] & 0x0030) >> 2;
-                               legacy |= 0x02;
-                               break;
-                       default:                        /* no, use BIOS settings */
-                               if (legacy & 0x02)
-                                       mpu_port[dev] = 0x300 + ((legacy_cfg & 0x000c) << 2);
-                       }
+                               legacy &= ~VIA_FUNC_ENABLE_MIDI;        /* disable MIDI */
+               }
+               if (mpu_port[dev] >= 0x200)
+                       legacy |= VIA_FUNC_ENABLE_MIDI;
+               else
+                       legacy &= ~VIA_FUNC_ENABLE_MIDI;
+       } else {
+               switch (mpu_port[dev]) {        /* force MIDI */
+               case 0x300:
+               case 0x310:
+               case 0x320:
+               case 0x330:
+                       legacy_cfg &= ~(3 << 2);
+                       legacy_cfg |= (mpu_port[dev] & 0x0030) >> 2;
+                       legacy |= VIA_FUNC_ENABLE_MIDI;
+                       break;
+               default:                        /* no, use BIOS settings */
+                       if (legacy & VIA_FUNC_ENABLE_MIDI)
+                               mpu_port[dev] = 0x300 + ((legacy_cfg & 0x000c) << 2);
+                       break;
                }
        }
-       pci_write_config_byte(chip->pci, 0x42, legacy);
-       pci_write_config_byte(chip->pci, 0x43, legacy_cfg);
-       if (legacy & 0x02) {
+       if (legacy & VIA_FUNC_ENABLE_MIDI) {
                if (check_region(mpu_port[dev], 2)) {
                        printk(KERN_WARNING "unable to get MPU-401 port at 0x%lx, skipping\n", mpu_port[dev]);
-                       legacy &= ~0x02;
-                       pci_write_config_byte(chip->pci, 0x42, legacy);
-                       goto __skip_mpu;
-               }
-               if (snd_mpu401_uart_new(chip->card, 0, MPU401_HW_VIA686A,
-                                       mpu_port[dev], 0,
-                                       chip->irq, 0,
-                                       &chip->rmidi) < 0) {
+                       legacy &= ~VIA_FUNC_ENABLE_MIDI;
+               } else if (snd_mpu401_uart_new(chip->card, 0, MPU401_HW_VIA686A,
+                                              mpu_port[dev], 0,
+                                              chip->irq, 0,
+                                              &chip->rmidi) < 0) {
                        printk(KERN_WARNING "unable to initialize MPU-401 at 0x%lx, skipping\n", mpu_port[dev]);
-                       legacy &= ~0x02;
-                       pci_write_config_byte(chip->pci, 0x42, legacy);
-                       goto __skip_mpu;
+                       legacy &= ~VIA_FUNC_ENABLE_MIDI;
                }
-               legacy &= ~0x40;        /* enable MIDI interrupt */
-               pci_write_config_byte(chip->pci, 0x42, legacy);
-       __skip_mpu:
-               ;
+       }
+       pci_write_config_byte(chip->pci, VIA_FUNC_ENABLE, legacy);
+       pci_write_config_byte(chip->pci, VIA_PNP_CONTROL, legacy_cfg);
+       if (legacy & VIA_FUNC_ENABLE_MIDI) {
+               legacy &= ~VIA_FUNC_MIDI_IRQMASK;       /* enable MIDI interrupt */
+               pci_write_config_byte(chip->pci, VIA_FUNC_ENABLE, legacy);
        }
        
        /* card switches */
@@ -1474,40 +1625,46 @@ static int __devinit snd_via82xx_chip_init(via82xx_t *chip)
 #if 0 /* broken on K7M? */
        if (chip->chip_type == TYPE_VIA686)
                /* disable all legacy ports */
-               pci_write_config_byte(chip->pci, 0x42, 0);
+               pci_write_config_byte(chip->pci, VIA_FUNC_ENABLE, 0);
 #endif
-       pci_read_config_byte(chip->pci, 0x40, &pval);
-       if (! (pval & 0x01)) { /* codec not ready? */
+       pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval);
+       if (! (pval & VIA_ACLINK_C00_READY)) { /* codec not ready? */
                /* deassert ACLink reset, force SYNC */
-               pci_write_config_byte(chip->pci, 0x41, 0xe0);
+               pci_write_config_byte(chip->pci, VIA_ACLINK_CTRL,
+                                     VIA_ACLINK_CTRL_ENABLE |
+                                     VIA_ACLINK_CTRL_RESET |
+                                     VIA_ACLINK_CTRL_SYNC);
+               udelay(100);
+#if 1 /* FIXME: should we do full reset here for all chip models? */
+               pci_write_config_byte(chip->pci, VIA_ACLINK_CTRL, 0x00);
                udelay(100);
+#else
                /* deassert ACLink reset, force SYNC (warm AC'97 reset) */
-               pci_write_config_byte(chip->pci, 0x41, 0x60);
+               pci_write_config_byte(chip->pci, VIA_ACLINK_CTRL,
+                                     VIA_ACLINK_CTRL_RESET|VIA_ACLINK_CTRL_SYNC);
                udelay(2);
-               /* pci_write_config_byte(chip->pci, 0x41, 0x00);
-                  udelay(100);
-               */
+#endif
                /* ACLink on, deassert ACLink reset, VSR, SGD data out */
                /* note - FM data out has trouble with non VRA codecs !! */
-               pci_write_config_byte(chip->pci, 0x41, 0xcc);
+               pci_write_config_byte(chip->pci, VIA_ACLINK_CTRL, VIA_ACLINK_CTRL_INIT);
                udelay(100);
        }
        
        /* Make sure VRA is enabled, in case we didn't do a
         * complete codec reset, above */
-       pci_read_config_byte(chip->pci, 0x41, &pval);
-       if ((pval & 0xcc) != 0xcc) {
+       pci_read_config_byte(chip->pci, VIA_ACLINK_CTRL, &pval);
+       if ((pval & VIA_ACLINK_CTRL_INIT) != VIA_ACLINK_CTRL_INIT) {
                /* ACLink on, deassert ACLink reset, VSR, SGD data out */
                /* note - FM data out has trouble with non VRA codecs !! */
-               pci_write_config_byte(chip->pci, 0x41, 0xcc);
+               pci_write_config_byte(chip->pci, VIA_ACLINK_CTRL, VIA_ACLINK_CTRL_INIT);
                udelay(100);
        }
 
        /* wait until codec ready */
        max_count = ((3 * HZ) / 4) + 1;
        do {
-               pci_read_config_byte(chip->pci, 0x40, &pval);
-               if (pval & 0x01) /* primary codec ready */
+               pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval);
+               if (pval & VIA_ACLINK_C00_READY) /* primary codec ready */
                        break;
                set_current_state(TASK_UNINTERRUPTIBLE);
                schedule_timeout(1);
@@ -1544,9 +1701,9 @@ static int __devinit snd_via82xx_chip_init(via82xx_t *chip)
 
        if (chip->chip_type == TYPE_VIA686) {
                /* route FM trap to IRQ, disable FM trap */
-               pci_write_config_byte(chip->pci, 0x48, 0);
+               pci_write_config_byte(chip->pci, VIA_FM_NMI_CTRL, 0);
                /* disable all GPI interrupts */
-               outl(0, chip->port + 0x8c);
+               outl(0, VIAREG(chip, GPI_INTR));
        }
 
        return 0;
@@ -1554,7 +1711,7 @@ static int __devinit snd_via82xx_chip_init(via82xx_t *chip)
 
 static int snd_via82xx_free(via82xx_t *chip)
 {
-       int i;
+       unsigned int i;
 
        if (chip->irq < 0)
                goto __end_hw;
@@ -1570,8 +1727,8 @@ static int snd_via82xx_free(via82xx_t *chip)
        if (chip->irq >= 0)
                free_irq(chip->irq, (void *)chip);
        if (chip->chip_type == TYPE_VIA686) {
-               pci_write_config_byte(chip->pci, 0x42, chip->old_legacy);
-               pci_write_config_byte(chip->pci, 0x43, chip->old_legacy_cfg);
+               pci_write_config_byte(chip->pci, VIA_FUNC_ENABLE, chip->old_legacy);
+               pci_write_config_byte(chip->pci, VIA_PNP_CONTROL, chip->old_legacy_cfg);
        }
        snd_magic_kfree(chip);
        return 0;
@@ -1586,6 +1743,7 @@ static int snd_via82xx_dev_free(snd_device_t *device)
 static int __devinit snd_via82xx_create(snd_card_t * card,
                                        struct pci_dev *pci,
                                        int chip_type,
+                                       int revision,
                                        unsigned int ac97_clock,
                                        via82xx_t ** r_via)
 {
@@ -1602,6 +1760,7 @@ static int __devinit snd_via82xx_create(snd_card_t * card,
                return -ENOMEM;
 
        chip->chip_type = chip_type;
+       chip->revision = revision;
 
        spin_lock_init(&chip->reg_lock);
        spin_lock_init(&chip->ac97_lock);
@@ -1611,8 +1770,8 @@ static int __devinit snd_via82xx_create(snd_card_t * card,
        chip->pci = pci;
        chip->irq = -1;
 
-       pci_read_config_byte(pci, 0x42, &chip->old_legacy);
-       pci_read_config_byte(pci, 0x43, &chip->old_legacy_cfg);
+       pci_read_config_byte(pci, VIA_FUNC_ENABLE, &chip->old_legacy);
+       pci_read_config_byte(pci, VIA_PNP_CONTROL, &chip->old_legacy_cfg);
 
        chip->port = pci_resource_start(pci, 0);
        if ((chip->res_port = request_region(chip->port, 256, card->driver)) == NULL) {
@@ -1629,7 +1788,6 @@ static int __devinit snd_via82xx_create(snd_card_t * card,
        chip->irq = pci->irq;
        if (ac97_clock >= 8000 && ac97_clock <= 48000)
                chip->ac97_clock = ac97_clock;
-       pci_read_config_byte(pci, PCI_REVISION_ID, &chip->revision);
        synchronize_irq(chip->irq);
 
        if ((err = snd_via82xx_chip_init(chip)) < 0) {
@@ -1651,6 +1809,19 @@ static int __devinit snd_via82xx_create(snd_card_t * card,
        return 0;
 }
 
+struct via823x_info {
+       int revision;
+       char *name;
+       int type;
+};
+static struct via823x_info via823x_cards[] __devinitdata = {
+       { VIA_REV_PRE_8233, "VIA 8233-Pre", TYPE_VIA8233 },
+       { VIA_REV_8233C, "VIA 8233C", TYPE_VIA8233 },
+       { VIA_REV_8233, "VIA 8233", TYPE_VIA8233 },
+       { VIA_REV_8233A, "VIA 8233A", TYPE_VIA8233A },
+       { VIA_REV_8235, "VIA 8235", TYPE_VIA8233 },
+};
+
 static int __devinit snd_via82xx_probe(struct pci_dev *pci,
                                       const struct pci_device_id *pci_id)
 {
@@ -1658,8 +1829,9 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
        snd_card_t *card;
        via82xx_t *chip;
        unsigned char revision;
-       int chip_type;
-       int i, err;
+       int chip_type = 0, card_type;
+       unsigned int i;
+       int err;
 
        if (dev >= SNDRV_CARDS)
                return -ENODEV;
@@ -1672,29 +1844,36 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
        if (card == NULL)
                return -ENOMEM;
 
-       chip_type = pci_id->driver_data;
+       card_type = pci_id->driver_data;
        pci_read_config_byte(pci, PCI_REVISION_ID, &revision);
-       switch (chip_type) {
-       case TYPE_VIA686:
+       switch (card_type) {
+       case TYPE_CARD_VIA686:
                strcpy(card->driver, "VIA686A");
-               strcpy(card->shortname, "VIA 82C686A/B");
+               sprintf(card->shortname, "VIA 82C686A/B rev%x", revision);
+               chip_type = TYPE_VIA686;
                break;
-       case TYPE_VIA8233:
-               if (revision == VIA_REV_8233A) {
+       case TYPE_CARD_VIA8233:
+               chip_type = TYPE_VIA8233;
+               sprintf(card->shortname, "VIA 823x rev%x", revision);
+               for (i = 0; i < ARRAY_SIZE(via823x_cards); i++) {
+                       if (revision == via823x_cards[i].revision) {
+                               chip_type = via823x_cards[i].type;
+                               strcpy(card->shortname, via823x_cards[i].name);
+                               break;
+                       }
+               }
+               if (chip_type == VIA_REV_8233A)
                        strcpy(card->driver, "VIA8233A");
-                       strcpy(card->shortname, "VIA 8233A");
-               } else {
+               else
                        strcpy(card->driver, "VIA8233");
-                       strcpy(card->shortname, "VIA 8233/C");
-               }
                break;
        default:
-               snd_printk(KERN_ERR "invalid chip type %d\n", chip_type);
+               snd_printk(KERN_ERR "invalid card type %d\n", card_type);
                err = -EINVAL;
                goto __error;
        }
                
-       if ((err = snd_via82xx_create(card, pci, chip_type, ac97_clock[dev], &chip)) < 0)
+       if ((err = snd_via82xx_create(card, pci, chip_type, revision, ac97_clock[dev], &chip)) < 0)
                goto __error;
 
        if ((err = snd_via82xx_mixer_new(chip)) < 0)
@@ -1705,7 +1884,7 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
                    (err = snd_via686_init_misc(chip, dev)) < 0)
                        goto __error;
        } else {
-               if (revision == VIA_REV_8233A) {
+               if (chip_type == VIA_REV_8233A) {
                        if ((err = snd_via8233a_pcm_new(chip)) < 0)
                                goto __error;
                } else {
@@ -1792,4 +1971,3 @@ static int __init alsa_card_via82xx_setup(char *str)
 __setup("snd-via82xx=", alsa_card_via82xx_setup);
 
 #endif /* ifndef MODULE */
index d42113fc202cb5a779ec3a928a15d81c015095e0..8941690af0412bb7aa81038aa9b0973705422a3e 100644 (file)
@@ -624,7 +624,7 @@ static int snd_ymfpci_playback_prepare(snd_pcm_substream_t * substream)
        // ymfpci_t *chip = snd_pcm_substream_chip(substream);
        snd_pcm_runtime_t *runtime = substream->runtime;
        ymfpci_pcm_t *ypcm = snd_magic_cast(ymfpci_pcm_t, runtime->private_data, return -ENXIO);
-       int nvoice;
+       unsigned int nvoice;
 
        ypcm->period_size = runtime->period_size;
        ypcm->buffer_size = runtime->buffer_size;
@@ -1662,7 +1662,8 @@ int __devinit snd_ymfpci_mixer(ymfpci_t *chip, int rear_switch)
 {
        ac97_t ac97;
        snd_kcontrol_t *kctl;
-       int err, idx;
+       unsigned int idx;
+       int err;
 
        memset(&ac97, 0, sizeof(ac97));
        ac97.write = snd_ymfpci_codec_write;
@@ -1774,16 +1775,16 @@ static int snd_ymfpci_joystick_addr_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_
 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;
+       ucontrol->value.enumerated.item[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];
+       if (ucontrol->value.enumerated.item[0] != chip->joystick_port) {
+               snd_assert(ucontrol->value.enumerated.item[0] >= 0 && ucontrol->value.enumerated.item[0] < 4, return -EINVAL);
+               chip->joystick_port = ucontrol->value.enumerated.item[0];
                setup_joystick_base(chip);
                return 1;
        }
@@ -2114,7 +2115,7 @@ static int saved_regs_index[] = {
 void snd_ymfpci_suspend(ymfpci_t *chip)
 {
        snd_card_t *card = chip->card;
-       int i;
+       unsigned int i;
        
        if (card->power_state == SNDRV_CTL_POWER_D3hot)
                return;
@@ -2133,7 +2134,7 @@ void snd_ymfpci_suspend(ymfpci_t *chip)
 void snd_ymfpci_resume(ymfpci_t *chip)
 {
        snd_card_t *card = chip->card;
-       int i;
+       unsigned int i;
 
        if (card->power_state == SNDRV_CTL_POWER_D0)
                return;
index aeff8fc66d1380d2d24f301d6c42aee42d598d54..510d9b422226b92c582e87dd01fb6540a9e3f1fc 100644 (file)
@@ -151,7 +151,7 @@ __error:
 static int __init alsa_card_pmac_init(void)
 {
        int err;
-       if ((err = snd_pmac_probe() < 0)) {
+       if ((err = snd_pmac_probe()) < 0) {
 #ifdef MODULE
                printk(KERN_ERR "no PMac soundchip found\n");
 #endif
index 40f5bdd143fd1a5f275e5bcb48b25c99c9638010..c0d75218d7f96803f3a25f4980babbc624fe34d5 100644 (file)
@@ -13,7 +13,7 @@ snd-emux-synth-objs := emux.o emux_synth.o emux_seq.o emux_nrpn.o \
 #   <empty string> - CONFIG_SND_SEQUENCER is undefined
 #   otherwise parameter #1 value
 #
-sequencer := $(if $(subst y,,$(CONFIG_SND_SEQUENCER)),m,$(if $(CONFIG_SND_SEQUENCER),$(1)))
+sequencer = $(if $(subst y,,$(CONFIG_SND_SEQUENCER)),$(if $(1),m),$(if $(CONFIG_SND_SEQUENCER),$(1)))
 
 # Toplevel Module Dependencies
 obj-$(call sequencer,$(CONFIG_SND_SBAWE)) += snd-emux-synth.o
index d72fec3dbc87317c3ea7ae239e400d116b81b4ae..3db41a7c1181fe31ad44f499fc3967694ce95eeb 100644 (file)
@@ -219,7 +219,7 @@ snd_emux_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format,
                                                 SF_CLIENT_NO(p->chset.port));
        else if (format == SNDRV_OSS_SOUNDFONT_PATCH) {
                soundfont_patch_info_t patch;
-               if (count < sizeof(patch))
+               if (count < (int)sizeof(patch))
                        rc = -EINVAL;
                if (copy_from_user(&patch, buf, sizeof(patch)))
                        rc = -EFAULT;
index 5855b356fd532a8d2dd71516b54bcdba31e57349..bc7cd38c9b990de7e58b5bb8ba2ecf770cd59d91 100644 (file)
@@ -176,7 +176,7 @@ snd_emux_create_port(snd_emux_t *emu, char *name,
        }
 
        p->chset.port = snd_seq_event_port_attach(emu->client, callback,
-                                                 cap, type, name);
+                                                 cap, type, max_channels, name);
 
        return p;
 }
index bb99eb67f76ed21cfd770c2c8a458ee2d9222d72..114a624e52835ba92ab2a38677916df1516e4c79 100644 (file)
@@ -122,7 +122,7 @@ snd_soundfont_load(snd_sf_list_t *sflist, const void *data, long count, int clie
        unsigned long flags;
        int  rc;
 
-       if (count < sizeof(patch)) {
+       if (count < (long)sizeof(patch)) {
                snd_printk("patch record too small %ld\n", count);
                return -EINVAL;
        }
@@ -406,7 +406,7 @@ load_map(snd_sf_list_t *sflist, const void *data, int count)
        soundfont_voice_map_t map;
 
        /* get the link info */
-       if (count < sizeof(map))
+       if (count < (int)sizeof(map))
                return -EINVAL;
        if (copy_from_user(&map, data, sizeof(map)))
                return -EFAULT;
@@ -509,7 +509,7 @@ load_info(snd_sf_list_t *sflist, const void *data, long count)
        if (is_special_type(sf->type))
                return -EINVAL;
 
-       if (count < sizeof(hdr)) {
+       if (count < (long)sizeof(hdr)) {
                printk("Soundfont error: invalid patch zone length\n");
                return -EINVAL;
        }
@@ -524,7 +524,7 @@ load_info(snd_sf_list_t *sflist, const void *data, long count)
                return -EINVAL;
        }
 
-       if (count < sizeof(soundfont_voice_info_t)*hdr.nvoices) {
+       if (count < (long)sizeof(soundfont_voice_info_t)*hdr.nvoices) {
                printk("Soundfont Error: patch length(%ld) is smaller than nvoices(%d)\n",
                       count, hdr.nvoices);
                return -EINVAL;
@@ -926,7 +926,7 @@ load_guspatch(snd_sf_list_t *sflist, const char *data, long count, int client)
        int note, sample_id;
        int rc;
 
-       if (count < sizeof(patch)) {
+       if (count < (long)sizeof(patch)) {
                snd_printk("patch record too small %ld\n", count);
                return -EINVAL;
        }
index 1f0303df05bf96d07e9bc33c93d4523f233139de..ce35d0e3dc4505c9c8a63fcf36b3ad182cecdcd8 100644 (file)
@@ -110,7 +110,7 @@ typedef struct snd_urb_ctx snd_urb_ctx_t;
 struct audioformat {
        struct list_head list;
        snd_pcm_format_t format;        /* format type */
-       int channels;                   /* # channels */
+       unsigned int channels;          /* # channels */
        int iface;                      /* interface number */
        unsigned char altsetting;       /* corresponding alternate setting */
        unsigned char altset_idx;       /* array index of altenate setting */
@@ -118,9 +118,9 @@ struct audioformat {
        unsigned char endpoint;         /* endpoint */
        unsigned char ep_attr;          /* endpoint attributes */
        unsigned int rates;             /* rate bitmasks */
-       int rate_min, rate_max;         /* min/max rates */
-       int nr_rates;                   /* number of rate table entries */
-       int *rate_table;                /* rate table */
+       unsigned int rate_min, rate_max;        /* min/max rates */
+       unsigned int nr_rates;          /* number of rate table entries */
+       unsigned int *rate_table;       /* rate table */
 };
 
 struct snd_urb_ctx {
@@ -162,21 +162,21 @@ struct snd_usb_substream {
 
        unsigned int running: 1;        /* running status */
 
-       int hwptr;                      /* free frame position in the buffer (only for playback) */
-       int hwptr_done;                 /* processed frame position in the buffer */
-       int transfer_sched;             /* scheduled frames since last period (for playback) */
-       int transfer_done;              /* processed frames since last period update */
+       unsigned int hwptr;                     /* free frame position in the buffer (only for playback) */
+       unsigned int hwptr_done;                        /* processed frame position in the buffer */
+       unsigned int transfer_sched;            /* scheduled frames since last period (for playback) */
+       unsigned int transfer_done;             /* processed frames since last period update */
        unsigned long active_mask;      /* bitmask of active urbs */
        unsigned long unlink_mask;      /* bitmask of unlinked urbs */
 
-       int nurbs;                      /* # urbs */
+       unsigned int nurbs;                     /* # urbs */
        snd_urb_ctx_t dataurb[MAX_URBS];        /* data urb table */
        snd_urb_ctx_t syncurb[SYNC_URBS];       /* sync urb table */
        char syncbuf[SYNC_URBS * NRPACKS * 3]; /* sync buffer; it's so small - let's get static */
        char *tmpbuf;                   /* temporary buffer for playback */
 
        u64 formats;                    /* format bitmasks (all or'ed) */
-       int num_formats;                /* number of supported audio formats (list) */
+       unsigned int num_formats;               /* number of supported audio formats (list) */
        struct list_head fmt_list;      /* format list */
        spinlock_t lock;
 
@@ -314,7 +314,8 @@ static int retire_capture_urb(snd_usb_substream_t *subs,
 {
        unsigned long flags;
        unsigned char *cp;
-       int stride, i, len, oldptr;
+       int i;
+       unsigned int stride, len, oldptr;
 
        stride = runtime->frame_bits >> 3;
 
@@ -337,8 +338,8 @@ static int retire_capture_urb(snd_usb_substream_t *subs,
                spin_unlock_irqrestore(&subs->lock, flags);
                /* copy a data chunk */
                if (oldptr + len > runtime->buffer_size) {
-                       int cnt = runtime->buffer_size - oldptr;
-                       int blen = cnt * stride;
+                       unsigned int cnt = runtime->buffer_size - oldptr;
+                       unsigned int blen = cnt * stride;
                        memcpy(runtime->dma_area + oldptr * stride, cp, blen);
                        memcpy(runtime->dma_area, cp + blen, len * stride - blen);
                } else {
@@ -389,7 +390,8 @@ static int retire_playback_sync_urb(snd_usb_substream_t *subs,
                                    snd_pcm_runtime_t *runtime,
                                    struct urb *urb)
 {
-       unsigned int f, i, found;
+       int i;
+       unsigned int f, found;
        unsigned char *cp = urb->transfer_buffer;
        unsigned long flags;
 
@@ -429,7 +431,7 @@ static int prepare_playback_urb(snd_usb_substream_t *subs,
                                struct urb *urb)
 {
        int i, stride, offs;
-       int counts;
+       unsigned int counts;
        unsigned long flags;
        snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context;
 
@@ -543,7 +545,7 @@ static void snd_complete_urb(struct urb *urb, struct pt_regs *regs)
                return;
        if (! subs->running) /* can be stopped during retire callback */
                return;
-       if ((err = subs->ops.prepare(subs, substream->runtime, urb) < 0) ||
+       if ((err = subs->ops.prepare(subs, substream->runtime, urb)) < 0 ||
            (err = usb_submit_urb(urb, GFP_ATOMIC)) < 0) {
                snd_printd(KERN_ERR "cannot submit urb (err = %d)\n", err);
                snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN);
@@ -584,7 +586,8 @@ static void snd_complete_sync_urb(struct urb *urb, struct pt_regs *regs)
  */
 static int deactivate_urbs(snd_usb_substream_t *subs)
 {
-       int i, alive;
+       unsigned int i;
+       int alive;
 
        subs->running = 0;
 
@@ -625,7 +628,8 @@ static int deactivate_urbs(snd_usb_substream_t *subs)
  */
 static int start_urbs(snd_usb_substream_t *subs, snd_pcm_runtime_t *runtime)
 {
-       int i, err;
+       unsigned int i;
+       int err;
 
        for (i = 0; i < subs->nurbs; i++) {
                snd_assert(subs->dataurb[i].urb, return -EINVAL);
@@ -676,7 +680,8 @@ static int start_urbs(snd_usb_substream_t *subs, snd_pcm_runtime_t *runtime)
 static int wait_clear_urbs(snd_usb_substream_t *subs)
 {
        int timeout = HZ;
-       int i, alive;
+       unsigned int i;
+       int alive;
 
        do {
                alive = 0;
@@ -777,9 +782,9 @@ static void release_substream_urbs(snd_usb_substream_t *subs)
  */
 static int init_substream_urbs(snd_usb_substream_t *subs, snd_pcm_runtime_t *runtime)
 {
-       int maxsize, n, i;
+       unsigned int maxsize, n, i;
        int is_playback = subs->direction == SNDRV_PCM_STREAM_PLAYBACK;
-       int npacks[MAX_URBS], total_packs;
+       unsigned int npacks[MAX_URBS], total_packs;
 
        /* calculate the frequency in 10.14 format */
        subs->freqn = subs->freqm = get_usb_rate(runtime->rate);
@@ -925,7 +930,7 @@ static struct audioformat *find_format(snd_usb_substream_t *subs, snd_pcm_runtim
                if (fp->rates & SNDRV_PCM_RATE_CONTINUOUS)
                        return fp;
                else {
-                       int i;
+                       unsigned int i;
                        for (i = 0; i < fp->nr_rates; i++)
                                if (fp->rate_table[i] == runtime->rate)
                                        return fp;
@@ -1069,8 +1074,8 @@ static int set_format(snd_usb_substream_t *subs, snd_pcm_runtime_t *runtime)
                        return -EINVAL;
                }
                ep = get_endpoint(alts, 1)->bEndpointAddress;
-               if ((is_playback && ep != (get_endpoint(alts, 0)->bSynchAddress | USB_DIR_IN)) ||
-                   (! is_playback && ep != (get_endpoint(alts, 0)->bSynchAddress & ~USB_DIR_IN))) {
+               if ((is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress | USB_DIR_IN)) ||
+                   (! is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress & ~USB_DIR_IN))) {
                        snd_printk(KERN_ERR "%d:%d:%d : invalid synch pipe\n",
                                   dev->devnum, fmt->iface, fmt->altsetting);
                        return -EINVAL;
@@ -1210,7 +1215,8 @@ static int hw_rule_rate(snd_pcm_hw_params_t *params,
        snd_usb_substream_t *subs = rule->private;
        struct list_head *p;
        snd_interval_t *it = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
-       int rmin, rmax, changed;
+       unsigned int rmin, rmax;
+       int changed;
        
        hwc_debug("hw_rule_rate: (%d,%d)\n", it->min, it->max);
        changed = 0;
@@ -1263,7 +1269,8 @@ static int hw_rule_channels(snd_pcm_hw_params_t *params,
        snd_usb_substream_t *subs = rule->private;
        struct list_head *p;
        snd_interval_t *it = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
-       int rmin, rmax, changed;
+       unsigned int rmin, rmax;
+       int changed;
        
        hwc_debug("hw_rule_channels: (%d,%d)\n", it->min, it->max);
        changed = 0;
@@ -1647,7 +1654,7 @@ static void proc_dump_substream_formats(snd_usb_substream_t *subs, snd_info_buff
                        snd_iprintf(buffer, "    Rates: %d - %d (continous)\n",
                                    fp->rate_min, fp->rate_max);
                } else {
-                       int i;
+                       unsigned int i;
                        snd_iprintf(buffer, "    Rates: ");
                        for (i = 0; i < fp->nr_rates; i++) {
                                if (i > 0)
@@ -1662,7 +1669,7 @@ static void proc_dump_substream_formats(snd_usb_substream_t *subs, snd_info_buff
 static void proc_dump_substream_status(snd_usb_substream_t *subs, snd_info_buffer_t *buffer)
 {
        if (subs->running) {
-               int i;
+               unsigned int i;
                snd_iprintf(buffer, "  Status: Running\n");
                snd_iprintf(buffer, "    Interface = %d\n", subs->interface);
                snd_iprintf(buffer, "    Altset = %d\n", subs->format);
@@ -2045,7 +2052,7 @@ static int parse_audio_endpoints(snd_usb_audio_t *chip, unsigned char *buffer, i
                         */
                        int r, idx, c;
                        /* this table corresponds to the SNDRV_PCM_RATE_XXX bit */
-                       static int conv_rates[] = {
+                       static unsigned int conv_rates[] = {
                                5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000,
                                64000, 88200, 96000, 176400, 192000
                        };
@@ -2059,7 +2066,7 @@ static int parse_audio_endpoints(snd_usb_audio_t *chip, unsigned char *buffer, i
                        fp->nr_rates = nr_rates;
                        fp->rate_min = fp->rate_max = combine_triple(&fmt[8]);
                        for (r = 0, idx = 8; r < nr_rates; r++, idx += 3) {
-                               int rate = fp->rate_table[r] = combine_triple(&fmt[idx]);
+                               unsigned int rate = fp->rate_table[r] = combine_triple(&fmt[idx]);
                                if (rate < fp->rate_min)
                                        fp->rate_min = rate;
                                else if (rate > fp->rate_max)
@@ -2149,7 +2156,7 @@ static int snd_usb_create_streams(snd_usb_audio_t *chip, int ctrlif,
                                snd_printk(KERN_ERR "%d:%u:%d: cannot create sequencer device\n", dev->devnum, ctrlif, j);
                                continue;
                        }
-                       usb_driver_claim_interface(&usb_audio_driver, iface, (void *)-1);
+                       usb_driver_claim_interface(&usb_audio_driver, iface, (void *)-1L);
                        continue;
                }
                if (altsd->bInterfaceClass != USB_CLASS_AUDIO ||
@@ -2160,7 +2167,7 @@ static int snd_usb_create_streams(snd_usb_audio_t *chip, int ctrlif,
                }
                if (! parse_audio_endpoints(chip, buffer, buflen, j)) {
                        usb_set_interface(dev, j, 0); /* reset the current interface */
-                       usb_driver_claim_interface(&usb_audio_driver, iface, (void *)-1);
+                       usb_driver_claim_interface(&usb_audio_driver, iface, (void *)-1L);
                }
        }
 
@@ -2224,7 +2231,7 @@ static int create_composite_quirk(snd_usb_audio_t *chip,
                if (err < 0)
                        return err;
                if (quirk->ifnum != probed_ifnum)
-                       usb_driver_claim_interface(&usb_audio_driver, iface, (void *)-1);
+                       usb_driver_claim_interface(&usb_audio_driver, iface, (void *)-1L);
        }
        return 0;
 }
@@ -2520,7 +2527,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr)
        snd_card_t *card;
        struct list_head *p;
 
-       if (ptr == (void *)-1)
+       if (ptr == (void *)-1L)
                return;
 
        chip = snd_magic_cast(snd_usb_audio_t, ptr, return);
index 4061ca6171aa6e62f3da082a596562f4bfb93b1e..37fc2d69e7ef2326883e15fa3b17f7b00c3f756e 100644 (file)
@@ -821,7 +821,7 @@ static int snd_usbmidi_get_ms_info(snd_usb_midi_t* umidi,
                    ms_ep->bDescriptorType != USB_DT_CS_ENDPOINT ||
                    ms_ep->bDescriptorSubtype != MS_GENERAL)
                        continue;
-               if ((ep->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK) == USB_DIR_OUT) {
+               if ((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT) {
                        if (endpoints[epidx].out_ep) {
                                if (++epidx >= MIDI_MAX_ENDPOINTS) {
                                        printk(KERN_WARNING "snd-usb-midi: too many endpoints\n");
index 1458c5180f88f2f936549ad9157727f2327286f2..7b5276c1611fdd529ac865f6eb44e8dc2d94b73b 100644 (file)
@@ -751,7 +751,8 @@ static void build_feature_ctl(mixer_build_t *state, unsigned char *desc,
                              unsigned int ctl_mask, int control,
                              usb_audio_term_t *iterm, int unitid)
 {
-       int len = 0, mapped_name = 0;
+       unsigned int len = 0;
+       int mapped_name = 0;
        int nameid = desc[desc[0] - 1];
        snd_kcontrol_t *kctl;
        usb_mixer_elem_info_t *cval;
@@ -927,9 +928,9 @@ static void build_mixer_unit_ctl(mixer_build_t *state, unsigned char *desc,
                                 int in_ch, int unitid)
 {
        usb_mixer_elem_info_t *cval;
-       int num_ins = desc[4];
-       int num_outs = desc[5 + num_ins];
-       int i, len;
+       unsigned int num_ins = desc[4];
+       unsigned int num_outs = desc[5 + num_ins];
+       unsigned int i, len;
        snd_kcontrol_t *kctl;
        usb_audio_term_t iterm;
 
@@ -1240,7 +1241,7 @@ static int mixer_ctl_selector_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
        uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
        uinfo->count = 1;
        uinfo->value.enumerated.items = cval->max;
-       if (uinfo->value.enumerated.item >= cval->max)
+       if ((int)uinfo->value.enumerated.item >= cval->max)
                uinfo->value.enumerated.item = cval->max - 1;
        strcpy(uinfo->value.enumerated.name, itemlist[uinfo->value.enumerated.item]);
        return 0;
@@ -1325,8 +1326,9 @@ static void usb_mixer_selector_elem_free(snd_kcontrol_t *kctl)
  */
 static int parse_audio_selector_unit(mixer_build_t *state, int unitid, unsigned char *desc)
 {
-       int num_ins = desc[4];
-       int i, err, nameid, len;
+       unsigned int num_ins = desc[4];
+       unsigned int i, nameid, len;
+       int err;
        usb_mixer_elem_info_t *cval;
        snd_kcontrol_t *kctl;
        char **namelist;
index ffd9347b9eb71fc1acabb56195f3041fcd2c851d..b87c34c0c921b577bc6bff3607c4943a6ddaf6f0 100644 (file)
                }
        }
 },
+{
+       USB_DEVICE(0x0582, 0x002d),
+       .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) {
+               .vendor_name = "Roland",
+               .product_name = "XV-2020",
+               .ifnum = 0,
+               .type = QUIRK_MIDI_FIXED_ENDPOINT,
+               .data = & (const snd_usb_midi_endpoint_info_t) {
+                       .out_cables = 0x0001,
+                       .in_cables  = 0x0001
+               }
+       }
+},
 {
        USB_DEVICE(0x0582, 0x0033),
        .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) {