Changeset 250


Ignore:
Timestamp:
Aug 27, 2007, 7:41:50 PM (18 years ago)
Author:
Brendan Oakley
Message:

Merged to ALSA 0.9.5

Location:
GPL/branches/alsa-resync1/alsa-kernel
Files:
2 added
1 deleted
52 edited

Legend:

Unmodified
Added
Removed
  • GPL/branches/alsa-resync1/alsa-kernel/core/control.c

    r210 r250  
    12951295 */
    12961296
    1297 #ifdef TARGET_OS2
    12981297static struct file_operations snd_ctl_f_ops =
    12991298{
    1300 #ifdef LINUX_2_3
    1301     THIS_MODULE,
    1302 #endif
    1303     0,
    1304     snd_ctl_read,
    1305     0,0,
    1306     snd_ctl_poll,
    1307     snd_ctl_ioctl,
    1308     0,
    1309     snd_ctl_open,0,
    1310     snd_ctl_release,
    1311     0,
    1312     snd_ctl_fasync,
    1313     0,0,0
     1299#ifndef TARGET_OS2
     1300        .owner =        THIS_MODULE,
     1301#endif /* !TARGET_OS2 */
     1302        .read =         snd_ctl_read,
     1303        .open =         snd_ctl_open,
     1304        .release =      snd_ctl_release,
     1305        .poll =         snd_ctl_poll,
     1306        .ioctl =        snd_ctl_ioctl,
     1307        .fasync =       snd_ctl_fasync,
    13141308};
    13151309
     
    13191313        .f_ops =        &snd_ctl_f_ops,
    13201314};
    1321 
    1322 #else
    1323 static struct file_operations snd_ctl_f_ops =
    1324 {
    1325 #ifdef LINUX_2_3
    1326 owner:          THIS_MODULE,
    1327 #endif
    1328     read:               snd_ctl_read,
    1329     open:               snd_ctl_open,
    1330     release:    snd_ctl_release,
    1331     poll:               snd_ctl_poll,
    1332     ioctl:              snd_ctl_ioctl,
    1333     fasync:             snd_ctl_fasync,
    1334 };
    1335 
    1336 static snd_minor_t snd_ctl_reg =
    1337 {
    1338 comment:        "ctl",
    1339     f_ops:              &snd_ctl_f_ops,
    1340 };
    1341 #endif
    13421315
    13431316/*
  • GPL/branches/alsa-resync1/alsa-kernel/core/info.c

    r246 r250  
    4646    static char *reserved[] =
    4747    {
    48                 "dev",
    4948        "version",
    5049        "meminfo",
     
    124123
    125124static struct proc_dir_entry *snd_proc_root = NULL;
    126 struct proc_dir_entry *snd_proc_dev = NULL;
    127125snd_info_entry_t *snd_seq_root = NULL;
    128126#ifdef CONFIG_SND_OSSEMUL
     
    283281        p = PDE(inode);
    284282    entry = p == NULL ? NULL : (snd_info_entry_t *)p->data;
    285     if (entry == NULL) {
     283        if (entry == NULL || entry->disconnected) {
    286284        up(&info_mutex);
    287285        return -ENODEV;
     
    506504}
    507505
    508 #ifdef TARGET_OS2
    509506static struct file_operations snd_info_entry_operations =
    510507{
    511 #ifdef LINUX_2_3
    512     THIS_MODULE,
    513 #endif
    514     snd_info_entry_llseek,
    515     snd_info_entry_read,
    516     snd_info_entry_write,
    517     0,
    518     snd_info_entry_poll,
    519     snd_info_entry_ioctl,
    520     snd_info_entry_mmap,
    521     0,
    522     //  snd_info_entry_open,
    523     0,
    524     snd_info_entry_release,
    525     0,0,0,0,0
    526 };
    527 #else
    528 static struct file_operations snd_info_entry_operations =
    529 {
    530 #ifndef LINUX_2_2
     508#ifndef TARGET_OS2
    531509        .owner =        THIS_MODULE,
    532 #endif
     510#endif /* !TARGET_OS2 */
    533511        .llseek =       snd_info_entry_llseek,
    534512        .read =         snd_info_entry_read,
     
    537515        .ioctl =        snd_info_entry_ioctl,
    538516        .mmap =         snd_info_entry_mmap,
     517#ifndef TARGET_OS2
    539518        .open =         snd_info_entry_open,
     519#endif /* !TARGET_OS2 */
    540520        .release =      snd_info_entry_release,
    541521};
    542 
    543 #ifdef LINUX_2_2
    544 static struct inode_operations snd_info_entry_inode_operations =
    545 {
    546     &snd_info_entry_operations, /* default sound info directory file-ops */
    547 };
    548 
    549 static struct inode_operations snd_info_device_inode_operations =
    550 {
    551     &snd_fops,          /* default sound info directory file-ops */
    552 };
    553 #endif  /* LINUX_2_2 */
    554 
    555 static int snd_info_card_readlink(struct dentry *dentry,
    556                                   char *buffer, int buflen)
    557 {
    558         char *s = PDE(dentry->d_inode)->data;
    559 #ifndef LINUX_2_2
    560     return vfs_readlink(dentry, buffer, buflen, s);
    561 #else
    562     int len;
    563 
    564     if (s == NULL)
    565         return -EIO;
    566     len = strlen(s);
    567     if (len > buflen)
    568         len = buflen;
    569     if (copy_to_user(buffer, s, len))
    570         return -EFAULT;
    571     return len;
    572 #endif
    573 }
    574 
    575 #ifndef LINUX_2_2
    576 static int snd_info_card_followlink(struct dentry *dentry,
    577                                     struct nameidata *nd)
    578 {
    579         char *s = PDE(dentry->d_inode)->data;
    580     return vfs_follow_link(nd, s);
    581 }
    582 #else
    583 static struct dentry *snd_info_card_followlink(struct dentry *dentry,
    584                                                struct dentry *base,
    585                                                unsigned int follow)
    586 {
    587         char *s = PDE(dentry->d_inode)->data;
    588     return lookup_dentry(s, base, follow);
    589 }
    590 #endif
    591 
    592 #ifdef LINUX_2_2
    593 static struct file_operations snd_info_card_link_operations =
    594 {
    595     NULL
    596 };
    597 #endif
    598 
    599 struct inode_operations snd_info_card_link_inode_operations =
    600 {
    601 #ifdef LINUX_2_2
    602         .default_file_ops =     &snd_info_card_link_operations,
    603 #endif
    604         .readlink =             snd_info_card_readlink,
    605         .follow_link =          snd_info_card_followlink,
    606 };
    607 #endif //TARGET_OS2
    608522
    609523/**
     
    636550        return -ENOMEM;
    637551    snd_proc_root = p;
    638         p = snd_create_proc_entry("dev", S_IFDIR | S_IRUGO | S_IXUGO, snd_proc_root);
    639         if (p == NULL)
    640                 return -ENOMEM;
    641         snd_proc_dev = p;
    642552#ifdef CONFIG_SND_OSSEMUL
    643553    {
     
    667577#endif
    668578    snd_info_version_init();
    669 #ifdef CONFIG_SND_DEBUG_MEMORY
    670579    snd_memory_info_init();
    671 #endif
    672580    snd_minor_info_init();
    673 #ifdef CONFIG_SND_OSSEMUL
    674581    snd_minor_info_oss_init();
    675 #endif
    676582    snd_card_info_init();
    677583    return 0;
     
    681587{
    682588    snd_card_info_done();
    683 #ifdef CONFIG_SND_OSSEMUL
    684589    snd_minor_info_oss_done();
    685 #endif
    686590    snd_minor_info_done();
    687 #ifdef CONFIG_SND_DEBUG_MEMORY
    688591    snd_memory_info_done();
    689 #endif
    690592    snd_info_version_done();
    691593    if (snd_proc_root) {
     
    698600                        snd_info_unregister(snd_oss_root);
    699601#endif
    700                 snd_remove_proc_entry(snd_proc_root, snd_proc_dev);
    701602        snd_remove_proc_entry(&proc_root, snd_proc_root);
    702603    }
     
    968869 * Returns zero if successful, or a negative error code on failure.
    969870 */
    970 //#ifndef TARGET_OS2
    971871int snd_card_proc_new(snd_card_t *card, const char *name,
    972872                      snd_info_entry_t **entryp)
    973873{
    974874    static snd_device_ops_t ops = {
    975         /*.dev_free = */snd_info_dev_free_entry,
    976         /*.dev_register =*/ snd_info_dev_register_entry,
    977         /*.dev_disconnect = */snd_info_dev_disconnect_entry,
    978         /*.dev_unregister = */snd_info_dev_unregister_entry
     875        .dev_free = snd_info_dev_free_entry,
     876        .dev_register = snd_info_dev_register_entry,
     877        .dev_disconnect = snd_info_dev_disconnect_entry,
     878        .dev_unregister = snd_info_dev_unregister_entry
    979879    };
    980880    snd_info_entry_t *entry;
     
    992892    return 0;
    993893}
    994 //#endif
    995894
    996895/**
     
    1031930        return -ENOMEM;
    1032931    }
    1033 #ifndef LINUX_2_2
    1034932    p->owner = entry->module;
    1035 #endif
    1036 
    1037933#ifndef TARGET_OS2
    1038     if (!S_ISDIR(entry->mode)) {
    1039 #ifndef LINUX_2_2
     934        if (!S_ISDIR(entry->mode))
    1040935        p->proc_fops = &snd_info_entry_operations;
    1041 #else
    1042         p->ops = &snd_info_entry_inode_operations;
    1043 #endif
    1044     }
    1045936#endif
    1046937    p->size = entry->size;
  • GPL/branches/alsa-resync1/alsa-kernel/core/init.c

    r222 r250  
    2727#include <linux/time.h>
    2828#include <linux/ctype.h>
    29 #ifndef TARGET_OS2 // TODO: implement linux/workqueue.h
    30 #include <linux/workqueue.h>
    31 #endif /* !TARGET_OS2 */
    3229#include <sound/core.h>
    3330#include <sound/control.h>
     
    208205
    209206                memset(f_ops, 0, sizeof(*f_ops));
    210 #ifdef LINUX_2_3
     207#ifndef TARGET_OS2
    211208                f_ops->owner = file->f_op->owner;
    212 #endif
     209#endif /* !TARGET_OS2 */
    213210                f_ops->release = file->f_op->release;
    214211                f_ops->poll = snd_disconnect_poll;
  • GPL/branches/alsa-resync1/alsa-kernel/core/pcm_lib.c

    r210 r250  
    7070        if (frames > runtime->silence_size)
    7171            frames = runtime->silence_size;
     72                else
     73                        frames = runtime->silence_threshold;
    7274    } else {
    7375        if (new_hw_ptr == ULONG_MAX) {  /* initialization */
  • GPL/branches/alsa-resync1/alsa-kernel/core/pcm_native.c

    r246 r250  
    15681568    inode = file->f_dentry->d_inode;
    15691569    if (!S_ISCHR(inode->i_mode) ||
    1570         MAJOR(inode->i_rdev) != CONFIG_SND_MAJOR) {
     1570            major(inode->i_rdev) != snd_major) {
    15711571        fput(file);
    15721572        return 0;
    15731573    }
    1574     minor = MINOR(inode->i_rdev);
    1575     if (minor >= 256 ||
     1574        minor = minor(inode->i_rdev);
     1575        if (minor >= 256 ||
    15761576        minor % SNDRV_MINOR_DEVICES < SNDRV_MINOR_PCM_PLAYBACK) {
    15771577        fput(file);
     
    21052105int snd_pcm_open(struct inode *inode, struct file *file)
    21062106{
    2107     int cardnum = SNDRV_MINOR_CARD(MINOR(inode->i_rdev));
    2108     int device = SNDRV_MINOR_DEVICE(MINOR(inode->i_rdev));
     2107        int cardnum = SNDRV_MINOR_CARD(minor(inode->i_rdev));
     2108        int device = SNDRV_MINOR_DEVICE(minor(inode->i_rdev));
    21092109    int err;
    21102110    snd_pcm_t *pcm;
     
    32923292
    32933293static struct file_operations snd_pcm_f_ops_playback = {
    3294 #ifdef LINUX_2_3
     3294#ifndef TARGET_OS2
    32953295    .owner =    THIS_MODULE,
    3296 #endif
     3296#endif /* !TARGET_OS2 */
    32973297    .write =    snd_pcm_write,
    3298 #ifdef LINUX_2_3
     3298#ifndef TARGET_OS2
    32993299    .writev =   snd_pcm_writev,
    3300 #endif
     3300#endif /* !TARGET_OS2 */
    33013301    .open =     snd_pcm_open,
    33023302    .release =  snd_pcm_release,
    33033303    .poll =     snd_pcm_playback_poll,
    33043304    .ioctl =    snd_pcm_playback_ioctl,
    3305 #ifdef LINUX_2_3
     3305#ifndef TARGET_OS2
    33063306    .compat_ioctl = snd_pcm_ioctl_compat,
    33073307    .mmap =             snd_pcm_mmap,
    3308 #endif
     3308    .fasync =   snd_pcm_fasync,
     3309#endif
     3310};
     3311
     3312static struct file_operations snd_pcm_f_ops_capture = {
    33093313#ifndef TARGET_OS2
    3310     .fasync =   snd_pcm_fasync,
    3311 #endif
    3312 };
    3313 
    3314 static struct file_operations snd_pcm_f_ops_capture = {
    3315 #ifdef LINUX_2_3
    33163314    .owner =    THIS_MODULE,
    3317 #endif
     3315#endif /* !TARGET_OS2 */
    33183316    .read =             snd_pcm_read,
    3319 #ifdef LINUX_2_3
     3317#ifndef TARGET_OS2
    33203318    .readv =    snd_pcm_readv,
    3321 #endif
     3319#endif /* !TARGET_OS2 */
    33223320    .open =             snd_pcm_open,
    33233321    .release =  snd_pcm_release,
    33243322    .poll =             snd_pcm_capture_poll,
    33253323    .ioctl =    snd_pcm_capture_ioctl,
    3326 #ifdef LINUX_2_3
     3324#ifndef TARGET_OS2
    33273325    .ioctl = snd_pcm_ioctl_compat,
    33283326    .mmap =             snd_pcm_mmap,
    3329 #endif
    3330 #ifndef TARGET_OS2
    33313327    .fasync =   snd_pcm_fasync,
    33323328#endif
  • GPL/branches/alsa-resync1/alsa-kernel/core/rawmidi.c

    r206 r250  
    14671467}
    14681468
    1469 #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
     1469#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE))
    14701470static void snd_rawmidi_dev_seq_free(snd_seq_device_t *device)
    14711471{
     
    15421542    }
    15431543    rmidi->proc_entry = entry;
    1544 #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
     1544#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE))
    15451545    if (!rmidi->ops || !rmidi->ops->dev_register) { /* own registration mechanism */
    15461546        if (snd_seq_device_new(rmidi->card, rmidi->device, SNDRV_SEQ_DEV_ID_MIDISYNTH, 0, &rmidi->seq_dev) >= 0) {
     
    15971597    snd_unregister_device(SNDRV_DEVICE_TYPE_RAWMIDI, rmidi->card, rmidi->device);
    15981598    up(&register_mutex);
    1599 #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
     1599#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE))
    16001600    if (rmidi->seq_dev) {
    16011601        snd_device_free(rmidi->card, rmidi->seq_dev);
  • GPL/branches/alsa-resync1/alsa-kernel/core/sound.c

    r246 r250  
    164164}
    165165
    166 #ifdef TARGET_OS2
    167166struct file_operations snd_fops =
    168167{
    169     0,0,0,0,0,0,0,
    170     snd_open,0,0,0,0,0,0,0
    171 };
    172 #else
    173 struct file_operations snd_fops =
    174 {
    175 #ifndef LINUX_2_2
     168#ifndef TARGET_OS2
    176169        .owner =        THIS_MODULE,
    177 #endif
     170#endif /* !TARGET_OS2 */
    178171        .open =         snd_open
    179172};
    180 #endif
    181173
    182174static int snd_kernel_minor(int type, struct snd_card * card, int dev)
  • GPL/branches/alsa-resync1/alsa-kernel/drivers/dummy.c

    r246 r250  
    2222#include <linux/version.h>
    2323#include <linux/init.h>
    24 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 0)
     24#ifndef TARGET_OS2 //TODO: Implement linux/jiffies.h
    2525#include <linux/jiffies.h>
    26 #else
    27 #include <linux/sched.h>
    28 #endif
     26#endif /* !TARGET_OS2 */
    2927#include <linux/slab.h>
    3028#include <linux/time.h>
     
    6058#define MAX_BUFFER_SIZE         (256 * 1024)
    6159#define USE_FORMATS             SNDRV_PCM_FMTBIT_S32_LE
    62 #define USE_CHANNELS_MIN        12
    63 #define USE_CHANNELS_MAX        12
     60#define USE_CHANNELS_MIN        10
     61#define USE_CHANNELS_MAX        10
    6462#define USE_PERIODS_MIN         1
    6563#define USE_PERIODS_MAX         1024
  • GPL/branches/alsa-resync1/alsa-kernel/include/sound/ad1848.h

    r246 r250  
    121121#define AD1848_HW_CS4248        0x0003  /* CS4248 chip */
    122122#define AD1848_HW_CMI8330       0x0004  /* CMI8330 chip */
     123#define AD1848_HW_THINKPAD      0x0005  /* Thinkpad 360/750/755 */
     124
     125/* IBM Thinkpad specific stuff */
     126#define AD1848_THINKPAD_CTL_PORT1               0x15e8
     127#define AD1848_THINKPAD_CTL_PORT2               0x15e9
     128#define AD1848_THINKPAD_CS4248_ENABLE_BIT       0x02
    123129
    124130struct _snd_ad1848 {
     
    142148        int dma_size;
    143149        int thinkpad_flag;              /* Thinkpad CS4248 needs some extra help */
     150        int thinkpad_flag;              /* Thinkpad CS4248 needs some extra help */
     151#ifdef CONFIG_PM
     152        struct pm_dev *thinkpad_pmstate;
     153#endif
    144154
    145155        spinlock_t reg_lock;
  • GPL/branches/alsa-resync1/alsa-kernel/include/sound/adriver.h

    r246 r250  
    5151#include <linux/module.h>
    5252
     53#ifdef CONFIG_HAVE_OLD_REQUEST_MODULE
     54#include <linux/kmod.h>
     55#undef request_module
     56void snd_compat_request_module(const char *name, ...);
     57#define request_module(name, args...) snd_compat_request_module(name, ##args)
     58#endif
     59
     60#ifndef TARGET_OS2
     61#include <linux/compiler.h>
     62#endif /* !TARGET_OS2 */
     63#ifndef __user
     64#define __user
     65#endif
     66
    5367#ifdef CONFIG_PCI
    5468#include <linux/pci.h>
     
    7185#include <linux/init.h>
    7286#include <linux/pm.h>
     87#include <asm/page.h>
    7388#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 3)
    7489#define pci_set_dma_mask(pci, mask) pci->dma_mask = mask
     
    109124#endif
    110125
    111 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 3)
     126#include <linux/sched.h>
     127#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 3) && !defined(need_resched)
    112128#define need_resched() (current->need_resched)
    113129#endif
     
    136152
    137153#if defined(CONFIG_ISAPNP) || (defined(CONFIG_ISAPNP_MODULE) && defined(MODULE))
    138 #if (defined(CONFIG_ISAPNP_KERNEL) && defined(ALSA_BUILD)) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 3, 30) && !defined(ALSA_BUILD))
    139 #include <linux/isapnp.h>
    140 #define isapnp_dev pci_dev
    141 #define isapnp_card pci_bus
    142 #else
    143154#ifdef TARGET_OS2
    144155#include "isapnp.h"
    145156#else /* !TARGET_OS2 */
    146157#include <linux/isapnp.h>
    147 #endif /* TARGET_OS2 */
     158#endif /* !TARGET_OS2 */
     159#ifndef CONFIG_PNP
     160#define CONFIG_PNP
     161#endif
     162#if (defined(CONFIG_ISAPNP_KERNEL) && defined(ALSA_BUILD)) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 3, 30) && !defined(ALSA_BUILD))
     163#define isapnp_dev pci_dev
     164#define isapnp_card pci_bus
    148165#endif
    149166#undef __ISAPNP__
    150167#define __ISAPNP__
     168#else
     169#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
     170#undef CONFIG_PNP
     171#endif
    151172#endif
    152173
     
    159180#endif
    160181
    161 /* no vsnprintf yet? */
    162 /* FIXME: the version number is not sure.. at least it exists already on 2.4.10 */
    163 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 10) && !TARGET_OS2
    164 #define snprintf(buf,size,fmt,args...) sprintf(buf,fmt,##args)
    165 #define vsnprintf(buf,size,fmt,args) vsprintf(buf,fmt,args)
     182#if !defined CONFIG_HAVE_STRLCPY && !defined TARGET_OS2
     183size_t snd_compat_strlcpy(char *dest, const char *src, size_t size);
     184#define strlcpy(dest, src, size) snd_compat_strlcpy(dest, src, size)
     185size_t snd_compat_strlcat(char *dest, const char *src, size_t size);
     186#define strlcat(dest, src, size) snd_compat_strlcat(dest, src, size)
     187#endif
     188
     189#if !defined CONFIG_HAVE_SNPRINTF && !defined TARGET_OS2
     190#include <stdarg.h>
     191int snd_compat_snprintf(char * buf, size_t size, const char * fmt, ...);
     192int snd_compat_vsnprintf(char *buf, size_t size, const char *fmt, va_list args);
     193#define snprintf(buf,size,fmt,args...) snd_compat_snprintf(buf,size,fmt,##args)
     194#define vsnprintf(buf,size,fmt,args) snd_compat_vsnprintf(buf,size,fmt,args)
    166195#endif
    167196
  • GPL/branches/alsa-resync1/alsa-kernel/include/sound/ak4xxx-adda.h

    r246 r250  
    3838};
    3939
     40#define AK4XXX_IMAGE_SIZE       (AK4XXX_MAX_CHIPS * 16) /* 64 bytes */
     41
    4042struct snd_akm4xxx {
    4143        snd_card_t *card;
    4244        unsigned int num_adcs;                          /* AK4524 or AK4528 ADCs */
    4345        unsigned int num_dacs;                          /* AK4524 or AK4528 DACs */
    44         unsigned char images[AK4XXX_MAX_CHIPS][16];     /* saved register image */
     46        unsigned char images[AK4XXX_IMAGE_SIZE];        /* saved register image */
    4547        unsigned char ipga_gain[AK4XXX_MAX_CHIPS][2];   /* saved register image for IPGA (AK4528) */
    4648        unsigned long private_value[AK4XXX_MAX_CHIPS];  /* helper for driver */
     
    5961int snd_akm4xxx_build_controls(akm4xxx_t *ak);
    6062
     63#define snd_akm4xxx_get(ak,chip,reg) (ak)->images[(chip) * 16 + (reg)]
     64#define snd_akm4xxx_set(ak,chip,reg,val) ((ak)->images[(chip) * 16 + (reg)] = (val))
     65#define snd_akm4xxx_get_ipga(ak,chip,reg) (ak)->ipga_gain[chip][(reg)-4]
     66#define snd_akm4xxx_set_ipga(ak,chip,reg,val) ((ak)->ipga_gain[chip][(reg)-4] = (val))
     67
    6168#endif /* __SOUND_AK4XXX_ADDA_H */
  • GPL/branches/alsa-resync1/alsa-kernel/include/sound/compat_22.h

    r234 r250  
    9090
    9191/* Some distributions use modified kill_fasync */
     92#ifdef CONFIG_OLD_KILL_FASYNC
    9293#include <linux/fs.h>
    9394#undef kill_fasync
    9495#define kill_fasync(fp, sig, band) snd_wrapper_kill_fasync(fp, sig, band)
    9596void snd_wrapper_kill_fasync(struct fasync_struct **, int, int);
     97#endif
    9698
    9799/* this is identical with tq_struct but the "routine" field is renamed to "func" */
  • GPL/branches/alsa-resync1/alsa-kernel/include/sound/core.h

    r246 r250  
    2525#include <linux/sched.h>                /* wake_up() */
    2626#include <asm/semaphore.h>
    27 #ifndef TARGET_OS2 //TODO: implement linux/rwsem.h
     27#ifndef TARGET_OS2 //TODO: implement linux/rwsem.h, workqueue.h
    2828#include <linux/rwsem.h>                /* struct rw_semaphore */
     29#include <linux/workqueue.h>            /* struct workqueue_struct */
    2930#endif /* !TARGET_OS2 */
    3031#include <sound/typedefs.h>
     
    213214        int device;                     /* device number */
    214215        const char *comment;            /* for /proc/asound/devices */
    215         snd_info_entry_t *dev;          /* for /proc/asound/dev */
    216216        struct file_operations *f_ops;  /* file operations */
    217217        char name[1];
     
    241241
    242242#ifdef CONFIG_SND_OSSEMUL
    243 
    244243int snd_minor_info_oss_init(void);
    245244int snd_minor_info_oss_done(void);
    246 
    247245int snd_oss_init_module(void);
    248 
     246#else
     247#define snd_minor_info_oss_init() /*NOP*/
     248#define snd_minor_info_oss_done() /*NOP*/
     249#define snd_oss_init_module() /*NOP*/
    249250#endif
    250251
     
    269270#define kstrdup(s, flags)  snd_hidden_kstrdup(s, flags)
    270271#else
     272#define snd_memory_init() /*NOP*/
     273#define snd_memory_done() /*NOP*/
     274#define snd_memory_info_init() /*NOP*/
     275#define snd_memory_info_done() /*NOP*/
    271276#define kmalloc_nocheck(size, flags) kmalloc(size, flags)
    272277#define vmalloc_nocheck(size) vmalloc(size)
  • GPL/branches/alsa-resync1/alsa-kernel/include/sound/hdsp.h

    r246 r250  
    2525        Digiface,
    2626        Multiface,
     27        H9652,
    2728        Undefined,
    2829} HDSP_IO_Type;
  • GPL/branches/alsa-resync1/alsa-kernel/include/sound/initval.h

    r246 r250  
    8787#define SNDRV_DEFAULT_ENABLE    { 1, [1 ... (SNDRV_CARDS-1)] = 0 }
    8888#define SNDRV_DEFAULT_ENABLE_PNP { [0 ... (SNDRV_CARDS-1)] = 1 }
    89 #ifdef __ISAPNP__
     89#ifdef CONFIG_PNP
    9090#define SNDRV_DEFAULT_ENABLE_ISAPNP SNDRV_DEFAULT_ENABLE_PNP
    9191#else
  • GPL/branches/alsa-resync1/alsa-kernel/include/sound/mpu401.h

    r77 r250  
    9292        spinlock_t timer_lock;
    9393       
     94        atomic_t rx_loop;
     95        atomic_t tx_loop;
     96
    9497        struct timer_list timer;
    9598
  • GPL/branches/alsa-resync1/alsa-kernel/include/sound/ymfpci.h

    r36 r250  
    2626#include "rawmidi.h"
    2727#include "ac97_codec.h"
     28#ifndef TARGET_OS2 //TODO: Implement linux/gameport.h
     29#include <linux/gameport.h>
     30#endif /* !TARGET_OS2 */
    2831
    2932#ifndef PCI_VENDOR_ID_YAMAHA
  • GPL/branches/alsa-resync1/alsa-kernel/isa/ad1848/ad1848.c

    r212 r250  
    4747static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;        /* 5,7,9,11,12,15 */
    4848static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;       /* 0,1,3,5,6,7 */
     49static int thinkpad[SNDRV_CARDS];                       /* Thinkpad special case */
    4950
    5051MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
     
    6667MODULE_PARM_DESC(dma1, "DMA1 # for AD1848 driver.");
    6768MODULE_PARM_SYNTAX(dma1, SNDRV_DMA_DESC);
     69MODULE_PARM(thinkpad, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
     70MODULE_PARM_DESC(thinkpad, "Enable only for the onboard CS4248 of IBM Thinkpad 360/750/755 series.");
     71MODULE_PARM_SYNTAX(thinkpad,  SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
    6872
    6973static snd_card_t *snd_ad1848_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
     
    7882
    7983        if (port[dev] == SNDRV_AUTO_PORT) {
    80                 snd_printk("specify port\n");
     84                snd_printk(KERN_ERR "ad1848: specify port\n");
    8185                return -EINVAL;
    8286        }
    8387        if (irq[dev] == SNDRV_AUTO_IRQ) {
    84                 snd_printk("specify irq\n");
     88                snd_printk(KERN_ERR "ad1848: specify irq\n");
    8589                return -EINVAL;
    8690        }
    8791        if (dma1[dev] == SNDRV_AUTO_DMA) {
    88                 snd_printk("specify dma1\n");
     92                snd_printk(KERN_ERR "ad1848: specify dma1\n");
    8993                return -EINVAL;
    9094        }
     
    97101                                     irq[dev],
    98102                                     dma1[dev],
    99                                      AD1848_HW_DETECT,
     103                                     thinkpad[dev] ? AD1848_HW_THINKPAD : AD1848_HW_DETECT,
    100104                                     &chip)) < 0) {
    101105                snd_card_free(card);
     
    116120        sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d",
    117121                pcm->name, chip->port, irq[dev], dma1[dev]);
     122
     123        if (thinkpad[dev]) {
     124                strcat(card->longname, " [Thinkpad]");
     125        }
    118126
    119127        if ((err = snd_card_register(card)) < 0) {
     
    169177               get_option(&str,(int *)&port[nr_dev]) == 2 &&
    170178               get_option(&str,&irq[nr_dev]) == 2 &&
    171                get_option(&str,&dma1[nr_dev]) == 2);
     179               get_option(&str,&dma1[nr_dev]) == 2 &&
     180               get_option(&str,&thinkpad[nr_dev]) == 2);
    172181        nr_dev++;
    173182        return 1;
  • GPL/branches/alsa-resync1/alsa-kernel/isa/ad1848/ad1848_lib.c

    r246 r250  
    625625
    626626 */
     627
     628static void snd_ad1848_thinkpad_twiddle(ad1848_t *chip, int on) {
     629
     630        int tmp;
     631
     632        if (!chip->thinkpad_flag) return;
     633
     634        outb(0x1c, AD1848_THINKPAD_CTL_PORT1);
     635        tmp = inb(AD1848_THINKPAD_CTL_PORT2);
     636
     637        if (on)
     638                /* turn it on */
     639                tmp |= AD1848_THINKPAD_CS4248_ENABLE_BIT;
     640        else
     641                /* turn it off */
     642                tmp &= ~AD1848_THINKPAD_CS4248_ENABLE_BIT;
     643       
     644        outb(tmp, AD1848_THINKPAD_CTL_PORT2);
     645
     646}
     647
     648#ifdef CONFIG_PM
     649static void snd_ad1848_suspend(ad1848_t *chip) {
     650
     651        snd_card_t *card = chip->card;
     652
     653        if (card->power_state == SNDRV_CTL_POWER_D3hot)
     654                return;
     655
     656        snd_pcm_suspend_all(chip->pcm);
     657        /* FIXME: save registers? */
     658
     659        if (chip->thinkpad_flag)
     660                snd_ad1848_thinkpad_twiddle(chip, 0);
     661
     662        snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
     663}
     664
     665static void snd_ad1848_resume(ad1848_t *chip) {
     666
     667        snd_card_t *card = chip->card;
     668
     669        if (card->power_state == SNDRV_CTL_POWER_D0)
     670                return;
     671
     672        if (chip->thinkpad_flag)
     673                snd_ad1848_thinkpad_twiddle(chip, 1);
     674
     675        /* FIXME: restore registers? */
     676
     677        snd_power_change_state(card, SNDRV_CTL_POWER_D0);
     678}
     679
     680/* callback for control API */
     681static int snd_ad1848_set_power_state(snd_card_t *card, unsigned int power_state)
     682{
     683        ad1848_t *chip = (ad1848_t *) card->power_state_private_data;
     684        switch (power_state) {
     685        case SNDRV_CTL_POWER_D0:
     686        case SNDRV_CTL_POWER_D1:
     687        case SNDRV_CTL_POWER_D2:
     688                snd_ad1848_resume(chip);
     689                break;
     690        case SNDRV_CTL_POWER_D3hot:
     691        case SNDRV_CTL_POWER_D3cold:
     692                snd_ad1848_suspend(chip);
     693                break;
     694        default:
     695                return -EINVAL;
     696        }
     697        return 0;
     698}
     699
     700static int snd_ad1848_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data)
     701{
     702        ad1848_t *chip = snd_magic_cast(ad1848_t, dev->data, return 0);
     703
     704        switch (rqst) {
     705        case PM_SUSPEND:
     706                snd_ad1848_suspend(chip);
     707                break;
     708        case PM_RESUME:
     709                snd_ad1848_resume(chip);
     710                break;
     711        }
     712        return 0;
     713}
     714
     715#endif /* CONFIG_PM */
    627716
    628717static int snd_ad1848_probe(ad1848_t * chip)
     
    800889static int snd_ad1848_free(ad1848_t *chip)
    801890{
     891#ifdef CONFIG_PM
     892        if (chip->thinkpad_pmstate)
     893                pm_unregister(chip->thinkpad_pmstate);
     894#endif
    802895        if (chip->res_port) {
    803896                release_resource(chip->res_port);
     
    870963        }
    871964        chip->dma = dma;
     965
     966        if (hardware == AD1848_HW_THINKPAD) {
     967                chip->thinkpad_flag = 1;
     968                chip->hardware = AD1848_HW_DETECT; /* reset */
     969                snd_ad1848_thinkpad_twiddle(chip, 1);
     970#ifdef CONFIG_PM
     971                chip->thinkpad_pmstate = pm_register(PM_ISA_DEV, 0, snd_ad1848_pm_callback);
     972                if (chip->thinkpad_pmstate) {
     973                        chip->thinkpad_pmstate->data = chip;
     974                        card->set_power_state = snd_ad1848_set_power_state; /* callback */
     975                        card->power_state_private_data = chip;
     976                }
     977#endif
     978        }
    872979
    873980        if (snd_ad1848_probe(chip) < 0) {
     
    11491256        if (! ctl)
    11501257                return -ENOMEM;
    1151         strncpy(ctl->id.name, name, sizeof(ctl->id.name)-1);
     1258        strlcpy(ctl->id.name, name, sizeof(ctl->id.name));
    11521259        ctl->id.index = index;
    11531260        ctl->private_value = value;
  • GPL/branches/alsa-resync1/alsa-kernel/isa/azt2320.c

    r246 r250  
    1 
    21/*
    32    card-azt2320.c - driver for Aztech Systems AZT2320 based soundcards.
     
    106105
    107106struct snd_card_azt2320 {
    108 #ifdef CONFIG_PNP
    109107        int dev_no;
    110108        struct pnp_dev *dev;
    111109        struct pnp_dev *devmpu;
    112 #endif  /* CONFIG_PNP */
    113110};
    114111
  • GPL/branches/alsa-resync1/alsa-kernel/isa/cs423x/cs4231_lib.c

    r246 r250  
    14021402        switch (rqst) {
    14031403        case PM_SUSPEND:
    1404                 if (chip->suspend)
     1404                if (chip->suspend) {
     1405                        snd_pcm_suspend_all(chip->pcm);
    14051406                        (*chip->suspend)(chip);
     1407                }
    14061408                break;
    14071409        case PM_RESUME:
  • GPL/branches/alsa-resync1/alsa-kernel/isa/cs423x/cs4236.c

    r246 r250  
    309309        int err;
    310310
     311        if (!cfg)
     312                return -ENOMEM;
     313
    311314        acard->wss = pnp_request_card_device(card, id->devs[0].id, NULL);
    312315        if (acard->wss == NULL) {
     
    393396                err = pnp_activate_dev(pdev);
    394397                if (err < 0) {
    395                         kfree(cfg);
    396398                        printk(KERN_ERR IDENT " MPU401 PnP configure failed for WSS (out of resources?)\n");
    397399                        mpu_port[dev] = SNDRV_AUTO_PORT;
     
    410412        return 0;
    411413}
    412 #endif
     414#endif /* CONFIG_PNP */
    413415
    414416static void snd_card_cs4236_free(snd_card_t *card)
  • GPL/branches/alsa-resync1/alsa-kernel/isa/cs423x/cs4236_lib.c

    r224 r250  
    285285
    286286        if (!(chip->hardware & CS4231_HW_CS4236B_MASK)) {
    287                 snd_printk("CS4236+: MODE3 and extended registers not available, hardware=0x%lx\n",chip->hardware);
     287                snd_printk("CS4236+: MODE3 and extended registers not available, hardware=0x%x\n",chip->hardware);
    288288                snd_device_free(card, chip);
    289289                return -ENODEV;
  • GPL/branches/alsa-resync1/alsa-kernel/isa/dt019x.c

    r246 r250  
    128128                pnp_resource_change(&cfg->port_resource[0], port[dev], 16);
    129129        if (dma8[dev] != SNDRV_AUTO_DMA)
    130                 pnp_resource_change(&cfg->dma_resource[0], dma8[dev],
    131                         1);
     130                pnp_resource_change(&cfg->dma_resource[0], dma8[dev], 1);
    132131        if (irq[dev] != SNDRV_AUTO_IRQ)
    133132                pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1);
     
    159158                        snd_printk(KERN_ERR PFX "DT-019X MPU401 the requested resources are invalid, using auto config\n");
    160159                err = pnp_activate_dev(pdev);
    161                 if (err < 0)
     160                if (err < 0) {
     161                        pnp_release_card_device(pdev);
     162                        snd_printk(KERN_ERR PFX "DT-019X MPU401 pnp configure failure, skipping\n");
    162163                        goto __mpu_error;
     164                }
    163165                mpu_port[dev] = pnp_port_start(pdev, 0);
    164166                mpu_irq[dev] = pnp_irq(pdev, 0);
     
    166168                                mpu_port[dev],mpu_irq[dev]);
    167169        } else {
    168                 __mpu_error:
    169                 if (pdev) {
    170                         pnp_release_card_device(pdev);
    171                         snd_printk(KERN_ERR PFX "DT-019X MPU401 pnp configure failure, skipping\n");
    172                 }
     170        __mpu_error:
    173171                acard->devmpu = NULL;
    174172                mpu_port[dev] = -1;
     
    183181                        snd_printk(KERN_ERR PFX "DT-019X OPL3 the requested resources are invalid, using auto config\n");
    184182                err = pnp_activate_dev(pdev);
    185                 if (err < 0)
     183                if (err < 0) {
     184                        pnp_release_card_device(pdev);
     185                        snd_printk(KERN_ERR PFX "DT-019X OPL3 pnp configure failure, skipping\n");
    186186                        goto __fm_error;
     187                }
    187188                fm_port[dev] = pnp_port_start(pdev, 0);
    188189                snd_printdd("dt019x: found OPL3 synth: port=0x%lx\n",fm_port[dev]);
    189190        } else {
    190                 __fm_error:
    191                 if (pdev) {
    192                         pnp_release_card_device(pdev);
    193                         snd_printk(KERN_ERR PFX "DT-019X OPL3 pnp configure failure, skipping\n");
    194                 }
     191        __fm_error:
    195192                acard->devopl = NULL;
    196193                fm_port[dev] = -1;
  • GPL/branches/alsa-resync1/alsa-kernel/isa/gus/gus_main.c

    r210 r250  
    115115        if (gus->gf1.res_port2 == NULL)
    116116                goto __hw_end;
    117 #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
     117#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE))
    118118        if (gus->seq_dev) {
    119119                snd_device_free(gus->card, gus->seq_dev);
     
    443443        if ((err = snd_gus_init_dma_irq(gus, 1)) < 0)
    444444                return err;
    445 #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
     445#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE))
    446446        if (snd_seq_device_new(gus->card, 1, SNDRV_SEQ_DEV_ID_GUS,
    447447                               sizeof(snd_gus_card_t*), &gus->seq_dev) >= 0) {
  • GPL/branches/alsa-resync1/alsa-kernel/isa/gus/gus_synth.c

    r224 r250  
    193193                                                   &callbacks,
    194194                                                   SNDRV_SEQ_PORT_CAP_WRITE | SNDRV_SEQ_PORT_CAP_SUBS_WRITE,
    195                                                    SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC |
    196                                                    SNDRV_SEQ_PORT_TYPE_MIDI_GM |
    197                                                    SNDRV_SEQ_PORT_TYPE_MIDI_GS |
    198195                                                   SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE |
    199196                                                   SNDRV_SEQ_PORT_TYPE_SYNTH,
  • GPL/branches/alsa-resync1/alsa-kernel/isa/gus/interwave.c

    r246 r250  
    770770        if (request_irq(xirq, snd_interwave_interrupt, SA_INTERRUPT, "InterWave", (void *)iwcard)) {
    771771                snd_card_free(card);
    772                 snd_printk("unable to grab IRQ %d\n", irq);
     772                snd_printk("unable to grab IRQ %d\n", xirq);
    773773                return -EBUSY;
    774774        }
  • GPL/branches/alsa-resync1/alsa-kernel/isa/opl3sa2.c

    r246 r250  
    612612        if (sb_port[dev] != SNDRV_AUTO_PORT)
    613613                pnp_resource_change(&cfg->port_resource[0], sb_port[dev], 16);
     614        if (wss_port[dev] != SNDRV_AUTO_PORT)
    614615                pnp_resource_change(&cfg->port_resource[1], wss_port[dev], 8);
    615616        if (fm_port[dev] != SNDRV_AUTO_PORT)
     
    631632        if (err < 0) {
    632633                kfree(cfg);
    633                 snd_printk(KERN_ERR "PnP configure failure (out of resources?)\n");
     634                snd_printk(KERN_ERR "PnP configure failure (out of resources?) err = %d\n", err);
    634635                return -EBUSY;
    635636        }
  • GPL/branches/alsa-resync1/alsa-kernel/isa/opti9xx/opti92x-ad1848.c

    r246 r250  
    4444#include <sound/mpu401.h>
    4545#include <sound/opl3.h>
    46 #ifdef USE_OPL4
    4746#ifndef OPTi93X
    48 #include "opl4.h" /* <sound/opl4.h> */
    49 #endif
     47#include <sound/opl4.h>
    5048#endif
    5149#define SNDRV_LEGACY_FIND_FREE_IRQ
     
    280278#ifdef CONFIG_PNP
    281279
    282 #define ISAPNP_OPTI9XX(_va, _vb, _vc, _device, _fa, _fb, _fc, _audio, _mpu401) \
    283         { \
    284                 ISAPNP_CARD_ID(_va, _vb, _vc, _device), \
    285                 .devs = { ISAPNP_DEVICE_ID(_fa, _fb, _fc, _audio), \
    286                         ISAPNP_DEVICE_ID(_fa, _fb, _fc, _mpu401), } \
    287         }
    288 
    289280static struct pnp_card_device_id snd_opti9xx_pnpids[] = {
    290281#ifndef OPTi93X
     
    21132104        if (chip->fm_port > 0) {
    21142105                opl3_t *opl3 = NULL;
    2115 #ifdef USE_OPL4
    21162106#ifndef OPTi93X
    21172107                if (chip->hardware == OPTi9XX_HW_82C928 ||
     
    21322122                }
    21332123#endif  /* !OPTi93X */
    2134 #endif
    21352124                if (!opl3 && snd_opl3_create(card,
    21362125                                             chip->fm_port,
     
    22032192        int cards, error;
    22042193
     2194#ifdef CONFIG_PNP
    22052195        cards = pnp_register_card_driver(&opti9xx_pnpc_driver);
     2196#else
     2197        cards = 0;
     2198#endif
    22062199        if (cards == 0 && (error = snd_card_opti9xx_probe(NULL, NULL)) < 0) {
    22072200#ifdef CONFIG_PNP
  • GPL/branches/alsa-resync1/alsa-kernel/isa/sb/emu8000.c

    r224 r250  
    11391139                return err;
    11401140        }
    1141 #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
     1141#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE))
    11421142        if (snd_seq_device_new(card, index, SNDRV_SEQ_DEV_ID_EMU8000,
    11431143                               sizeof(emu8000_t*), &awe) >= 0) {
     
    11451145                *(emu8000_t**)SNDRV_SEQ_DEVICE_ARGPTR(awe) = hw;
    11461146        }
     1147#else
     1148        awe = NULL;
    11471149#endif
    11481150        if (awe_ret)
  • GPL/branches/alsa-resync1/alsa-kernel/isa/sb/es968.c

    r246 r250  
    122122        if (err < 0) {
    123123                snd_printk(KERN_ERR PFX "AUDIO pnp configure failure\n");
     124                kfree(cfg);
    124125                return err;
    125126        }
  • GPL/branches/alsa-resync1/alsa-kernel/isa/sb/sb16.c

    r246 r250  
    6767#endif
    6868
    69 #if defined(SNDRV_SBAWE) && (defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE))
     69#if defined(SNDRV_SBAWE) && (defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE)))
    7070#define SNDRV_SBAWE_EMU8000
    7171#endif
     
    275275#endif
    276276
     277#ifdef CONFIG_PNP
     278
    277279static int __devinit snd_card_sb16_pnp(int dev, struct snd_card_sb16 *acard,
    278280                                       struct pnp_card_link *card,
     
    365367}
    366368
     369#endif /* CONFIG_PNP */
     370
    367371static int __init snd_sb16_probe(int dev,
    368372                                 struct pnp_card_link *pcard,
     
    389393        return -ENOMEM;
    390394        acard = (struct snd_card_sb16 *) card->private_data;
     395#ifdef CONFIG_PNP
    391396        if (isapnp[dev]) {
    392397                if ((err = snd_card_sb16_pnp(dev, acard, pcard, pid))) {
     
    395400                }
    396401        }
     402#endif
    397403
    398404        xirq = irq[dev];
  • GPL/branches/alsa-resync1/alsa-kernel/isa/sb/sb16_csp.c

    r224 r250  
    392392
    393393            /* fill in codec header */
    394             strncpy(p->codec_name, info.codec_name, sizeof(p->codec_name) - 1);
    395             p->codec_name[sizeof(p->codec_name) - 1] = 0;
     394                        strlcpy(p->codec_name, info.codec_name, sizeof(p->codec_name));
    396395            p->func_nr = func_nr;
    397396            p->mode = LE_SHORT(funcdesc_h.flags_play_rec);
  • GPL/branches/alsa-resync1/alsa-kernel/isa/sb/sb8_midi.c

    r246 r250  
    2222 *   Fixed typo in snd_sb8dsp_midi_new_device which prevented midi from
    2323 *   working.
     24 *
     25 * Sun May 11 12:34:56 UTC 2003 Clemens Ladisch <clemens@ladisch.de>
     26 *   Added full duplex UART mode for DSP version 2.0 and later.
    2427 */
    2528
     
    4144
    4245    if (chip == NULL || (rmidi = chip->rmidi) == NULL) {
    43         inb(SBP(chip, READ));   /* ack interrupt */
     46                inb(SBP(chip, DATA_AVAIL));     /* ack interrupt */
    4447                return IRQ_NONE;
    4548    }
     
    4851        if (inb(SBP(chip, DATA_AVAIL)) & 0x80) {
    4952            byte = inb(SBP(chip, READ));
     53                        if (chip->open & SB_OPEN_MIDI_INPUT_TRIGGER) {
    5054            spin_unlock(&chip->midi_input_lock);
    5155            snd_rawmidi_receive(chip->midi_substream_input, &byte, 1);
     
    5357            spin_unlock(&chip->midi_input_lock);
    5458        }
     59                } else {
     60                        spin_unlock(&chip->midi_input_lock);
     61                }
    5562    }
    5663        return IRQ_HANDLED;
     
    6572    unsigned long flags;
    6673    sb_t *chip;
    67 
    68     chip = snd_magic_cast(sb_t, substream->rmidi->private_data, return -ENXIO);
    69     spin_lock_irqsave(&chip->open_lock, flags);
    70     if (chip->open) {
     74        unsigned int valid_open_flags;
     75
     76        chip = snd_magic_cast(sb_t, substream->rmidi->private_data, return -ENXIO);
     77        valid_open_flags = chip->hardware >= SB_HW_20
     78                ? SB_OPEN_MIDI_OUTPUT | SB_OPEN_MIDI_OUTPUT_TRIGGER : 0;
     79        spin_lock_irqsave(&chip->open_lock, flags);
     80        if (chip->open & ~valid_open_flags) {
    7181        spin_unlock_irqrestore(&chip->open_lock, flags);
    7282        return -EAGAIN;
     
    7787        spin_unlock_irqrestore(&chip->open_lock, flags);
    7888        snd_sbdsp_reset(chip);          /* reset DSP */
     89                if (chip->hardware >= SB_HW_20)
     90                        snd_sbdsp_command(chip, SB_DSP_MIDI_UART_IRQ);
    7991    } else {
    8092        spin_unlock_irqrestore(&chip->open_lock, flags);
     
    8799    unsigned long flags;
    88100    sb_t *chip;
    89 
    90     chip = substream->rmidi->private_data;
    91     spin_lock_irqsave(&chip->open_lock, flags);
    92     if (chip->open) {
     101        unsigned int valid_open_flags;
     102
     103    chip = substream->rmidi->private_data;
     104        valid_open_flags = chip->hardware >= SB_HW_20
     105                ? SB_OPEN_MIDI_INPUT | SB_OPEN_MIDI_INPUT_TRIGGER : 0;
     106        spin_lock_irqsave(&chip->open_lock, flags);
     107        if (chip->open & ~valid_open_flags) {
    93108        spin_unlock_irqrestore(&chip->open_lock, flags);
    94109        return -EAGAIN;
     
    99114        spin_unlock_irqrestore(&chip->open_lock, flags);
    100115        snd_sbdsp_reset(chip);          /* reset DSP */
     116                if (chip->hardware >= SB_HW_20)
     117                        snd_sbdsp_command(chip, SB_DSP_MIDI_UART_IRQ);
    101118    } else {
    102119        spin_unlock_irqrestore(&chip->open_lock, flags);
     
    112129    chip = substream->rmidi->private_data;
    113130    spin_lock_irqsave(&chip->open_lock, flags);
    114     chip->open &= ~(SB_OPEN_MIDI_INPUT | SB_OPEN_MIDI_TRIGGER);
     131        chip->open &= ~(SB_OPEN_MIDI_INPUT | SB_OPEN_MIDI_INPUT_TRIGGER);
    115132    chip->midi_substream_input = NULL;
    116133    if (!(chip->open & SB_OPEN_MIDI_OUTPUT)) {
     
    130147    chip = substream->rmidi->private_data;
    131148    spin_lock_irqsave(&chip->open_lock, flags);
    132     chip->open &= ~SB_OPEN_MIDI_OUTPUT;
     149        chip->open &= ~(SB_OPEN_MIDI_OUTPUT | SB_OPEN_MIDI_OUTPUT_TRIGGER);
    133150    chip->midi_substream_output = NULL;
    134151    if (!(chip->open & SB_OPEN_MIDI_INPUT)) {
     
    149166    spin_lock_irqsave(&chip->open_lock, flags);
    150167    if (up) {
    151         if (!(chip->open & SB_OPEN_MIDI_TRIGGER)) {
     168                if (!(chip->open & SB_OPEN_MIDI_INPUT_TRIGGER)) {
     169                        if (chip->hardware < SB_HW_20)
    152170            snd_sbdsp_command(chip, SB_DSP_MIDI_INPUT_IRQ);
    153             chip->open |= SB_OPEN_MIDI_TRIGGER;
    154         }
    155     } else {
    156         if (chip->open & SB_OPEN_MIDI_TRIGGER) {
     171                        chip->open |= SB_OPEN_MIDI_INPUT_TRIGGER;
     172                }
     173        } else {
     174                if (chip->open & SB_OPEN_MIDI_INPUT_TRIGGER) {
     175                        if (chip->hardware < SB_HW_20)
    157176            snd_sbdsp_command(chip, SB_DSP_MIDI_INPUT_IRQ);
    158             chip->open &= ~SB_OPEN_MIDI_TRIGGER;
     177                        chip->open &= ~SB_OPEN_MIDI_INPUT_TRIGGER;
    159178        }
    160179    }
     
    173192    while (max-- > 0) {
    174193        spin_lock_irqsave(&chip->open_lock, flags);
    175         if (snd_rawmidi_transmit(substream, &byte, 1) != 1) {
    176             chip->open &= ~SB_OPEN_MIDI_TRIGGER;
     194                if (snd_rawmidi_transmit_peek(substream, &byte, 1) != 1) {
     195                        chip->open &= ~SB_OPEN_MIDI_OUTPUT_TRIGGER;
    177196            del_timer(&chip->midi_timer);
    178197            spin_unlock_irqrestore(&chip->open_lock, flags);
    179             return;
    180         }
     198                        break;
     199                }
     200                if (chip->hardware >= SB_HW_20) {
     201                        int timeout = 8;
     202                        while ((inb(SBP(chip, STATUS)) & 0x80) != 0 && --timeout > 0)
     203                                ;
     204                        if (timeout == 0) {
     205                                /* Tx FIFO full - try again later */
     206                                spin_unlock_irqrestore(&chip->open_lock, flags);
     207                                break;
     208                        }
     209                        outb(byte, SBP(chip, WRITE));
     210                } else {
    181211        snd_sbdsp_command(chip, SB_DSP_MIDI_OUTPUT);
    182212        snd_sbdsp_command(chip, byte);
     213                }
     214                snd_rawmidi_transmit_ack(substream, 1);
    183215        spin_unlock_irqrestore(&chip->open_lock, flags);
    184216    }
     
    206238    spin_lock_irqsave(&chip->open_lock, flags);
    207239    if (up) {
    208         if (!(chip->open & SB_OPEN_MIDI_TRIGGER)) {
     240                if (!(chip->open & SB_OPEN_MIDI_OUTPUT_TRIGGER)) {
    209241                        init_timer(&chip->midi_timer);
    210242            chip->midi_timer.function = snd_sb8dsp_midi_output_timer;
     
    212244            chip->midi_timer.expires = 1 + jiffies;
    213245            add_timer(&chip->midi_timer);
    214             chip->open |= SB_OPEN_MIDI_TRIGGER;
    215         }
    216     } else {
    217         if (chip->open & SB_OPEN_MIDI_TRIGGER) {
    218             chip->open &= ~SB_OPEN_MIDI_TRIGGER;
     246                        chip->open |= SB_OPEN_MIDI_OUTPUT_TRIGGER;
     247                }
     248        } else {
     249                if (chip->open & SB_OPEN_MIDI_OUTPUT_TRIGGER) {
     250                        chip->open &= ~SB_OPEN_MIDI_OUTPUT_TRIGGER;
    219251        }
    220252    }
     
    255287    snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_sb8dsp_midi_output);
    256288    snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &snd_sb8dsp_midi_input);
    257     rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | SNDRV_RAWMIDI_INFO_DUPLEX;
     289        rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT;
     290        if (chip->hardware >= SB_HW_20)
     291                rmidi->info_flags |= SNDRV_RAWMIDI_INFO_DUPLEX;
    258292    rmidi->private_data = chip;
    259293    chip->rmidi = rmidi;
  • GPL/branches/alsa-resync1/alsa-kernel/isa/wavefront/wavefront.c

    r246 r250  
    180180
    181181        if (cs4232_pcm_port[dev] != SNDRV_AUTO_PORT)
     182                pnp_resource_change(&cfg->port_resource[0], cs4232_pcm_port[dev], 4);
    182183        if (fm_port[dev] != SNDRV_AUTO_PORT)
    183184                pnp_resource_change(&cfg->port_resource[1], fm_port[dev], 4);
  • GPL/branches/alsa-resync1/alsa-kernel/pci/cs4281.c

    r212 r250  
    2727#include <linux/pci.h>
    2828#include <linux/slab.h>
     29#ifndef TARGET_OS2 //TODO: Implement linux/gameport.h
     30#include <linux/gameport.h>
     31#endif /* TARGET_OS2 */
    2932#include <sound/core.h>
    3033#include <sound/control.h>
     
    3639#include <sound/initval.h>
    3740
    38 #ifndef LINUX_2_2
    39 #include <linux/gameport.h>
    40 #endif
    4141
    4242MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
     
    12471247 */
    12481248
    1249 #ifndef LINUX_2_2
     1249#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
    12501250
    12511251typedef struct snd_cs4281_gameport {
     
    13421342static int snd_cs4281_free(cs4281_t *chip)
    13431343{
    1344 #ifndef LINUX_2_2
     1344#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
    13451345    if (chip->gameport) {
    13461346        gameport_unregister_port(&chip->gameport->info);
     
    17301730    chip->uartm |= CS4281_MODE_OUTPUT;
    17311731    chip->midcr |= BA0_MIDCR_TXE;
    1732     chip->midi_input = substream;
     1732        chip->midi_output = substream;
    17331733    if (!(chip->uartm & CS4281_MODE_INPUT)) {
    17341734        snd_cs4281_midi_reset(chip);
     
    19131913    /* EOI to the PCI part... reenables interrupts */
    19141914    snd_cs4281_pokeBA0(chip, BA0_HICR, BA0_HICR_EOI);
     1915
    19151916    return IRQ_HANDLED;
    19161917
     
    19911992        return err;
    19921993    }
    1993 #ifndef LINUX_2_2
     1994#ifndef TARGET_OS2
    19941995    snd_cs4281_gameport(chip);
    1995 #endif
     1996#endif /* !TARGET_OS2 */
    19961997    strcpy(card->driver, "CS4281");
    19971998    strcpy(card->shortname, "Cirrus Logic CS4281");
  • GPL/branches/alsa-resync1/alsa-kernel/pci/es1968.c

    r212 r250  
    667667}
    668668
     669#define big_mdelay(msec) do {\
     670        set_current_state(TASK_UNINTERRUPTIBLE);\
     671        schedule_timeout(((msec) * HZ + 999) / 1000);\
     672} while (0)
     673       
    669674/* Wait for the codec bus to be free */
    670675static int snd_es1968_ac97_wait(es1968_t *chip)
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ak4xxx.c

    r246 r250  
    2828#include <linux/init.h>
    2929#include <sound/core.h>
     30#include <sound/initval.h>
    3031#include "ice1712.h"
     32
     33MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
     34MODULE_DESCRIPTION("ICEnsemble ICE17xx <-> AK4xxx AD/DA chip interface");
     35MODULE_LICENSE("GPL");
     36MODULE_CLASSES("{sound}");
    3137
    3238static void snd_ice1712_akm4xxx_lock(akm4xxx_t *ak, int chip)
     
    98104        }
    99105
    100         /* save the data */
    101         if (ak->type == SND_AK4524 || ak->type == SND_AK4528) {
    102                 if ((addr != 0x04 && addr != 0x05) || (data & 0x80) == 0)
    103                         ak->images[chip][addr] = data;
    104                 else
    105                         ak->ipga_gain[chip][addr-4] = data;
    106         } else {
    107                 /* AK4529, or else */
    108                 ak->images[chip][addr] = data;
    109         }
    110        
    111106        if (priv->cs_mask == priv->cs_addr) {
    112107                if (priv->cif) {
     
    180175        return 0;
    181176}
     177
     178EXPORT_SYMBOL(snd_ice1712_akm4xxx_init);
     179EXPORT_SYMBOL(snd_ice1712_akm4xxx_free);
     180EXPORT_SYMBOL(snd_ice1712_akm4xxx_build_controls);
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ews.c

    r246 r250  
    390390 */
    391391
     392/* 6fire specific */
     393#define PCF9554_REG_INPUT      0
     394#define PCF9554_REG_OUTPUT     1
     395#define PCF9554_REG_POLARITY   2
     396#define PCF9554_REG_CONFIG     3
     397
     398static int snd_ice1712_6fire_write_pca(ice1712_t *ice, unsigned char reg, unsigned char data);
     399
    392400static int __devinit snd_ice1712_ews_init(ice1712_t *ice)
    393401{
     
    426434                        return err;
    427435                }
     436                snd_ice1712_6fire_write_pca(ice, PCF9554_REG_CONFIG, 0x80);
    428437                break;
    429438        case ICE1712_SUBDEVICE_EWS88MT:
     
    450459                if ((err = snd_ice1712_init_cs8427(ice, CS8427_BASE_ADDR)) < 0)
    451460                        return err;
     461                snd_cs8427_reg_write(ice->cs8427, CS8427_REG_RECVERRMASK, CS8427_UNLOCK | CS8427_CONF | CS8427_BIP | CS8427_PAR);
    452462                break;
    453463        case ICE1712_SUBDEVICE_DMX6FIRE:
    454464                if ((err = snd_ice1712_init_cs8427(ice, ICE1712_6FIRE_CS8427_ADDR)) < 0)
    455465                        return err;
     466                snd_cs8427_reg_write(ice->cs8427, CS8427_REG_RECVERRMASK, CS8427_UNLOCK | CS8427_CONF | CS8427_BIP | CS8427_PAR);
    456467                break;
    457468        case ICE1712_SUBDEVICE_EWS88MT:
     
    750761 * DMX 6Fire specific controls
    751762 */
    752 
    753 #define PCF9554_REG_INPUT       0
    754 #define PCF9554_REG_OUTPUT      1
    755 #define PCF9554_REG_POLARITY    2
    756 #define PCF9554_REG_CONFIG      3
    757763
    758764static int snd_ice1712_6fire_read_pca(ice1712_t *ice, unsigned char reg)
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ice1712.c

    r246 r250  
    119119
    120120/*
    121  *  AK4xxx stuff
    122  */
    123 
    124 #include "ak4xxx.c"
    125 
    126 /*
    127121 *  Basic I/O
    128122 */
     
    305299{
    306300        snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, data);
     301        inb(ICEREG(ice, DATA)); /* dummy read for pci-posting */
    307302}
    308303
     
    310305{
    311306        snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, data);
     307        inb(ICEREG(ice, DATA)); /* dummy read for pci-posting */
    312308}
    313309
     
    320316{
    321317        snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, val);
     318        inb(ICEREG(ice, DATA)); /* dummy read for pci-posting */
    322319}
    323320
     
    667664                return 0;
    668665        ptr = runtime->buffer_size - inw(ice->ddma_port + 4);
     666        if (ptr == runtime->buffer_size)
     667                ptr = 0;
    669668        return bytes_to_frames(substream->runtime, ptr);
    670669}
     
    684683        ptr = snd_ice1712_ds_read(ice, substream->number * 2, addr) -
    685684                ice->playback_con_virt_addr[substream->number];
     685        if (ptr == substream->runtime->buffer_size)
     686                ptr = 0;
    686687        return bytes_to_frames(substream->runtime, ptr);
    687688}
     
    695696                return 0;
    696697        ptr = inl(ICEREG(ice, CONCAP_ADDR)) - ice->capture_con_virt_addr;
     698        if (ptr == substream->runtime->buffer_size)
     699                ptr = 0;
    697700        return bytes_to_frames(substream->runtime, ptr);
    698701}
     
    11051108                return 0;
    11061109        ptr = ice->playback_pro_size - (inw(ICEMT(ice, PLAYBACK_SIZE)) << 2);
     1110        if (ptr == substream->runtime->buffer_size)
     1111                ptr = 0;
    11071112        return bytes_to_frames(substream->runtime, ptr);
    11081113}
     
    11161121                return 0;
    11171122        ptr = ice->capture_pro_size - (inw(ICEMT(ice, CAPTURE_SIZE)) << 2);
     1123        if (ptr == substream->runtime->buffer_size)
     1124                ptr = 0;
    11181125        return bytes_to_frames(substream->runtime, ptr);
    11191126}
     
    21522159{
    21532160        int dev = 0xa0;         /* EEPROM device address */
    2154         unsigned int i;
     2161        unsigned int i, size;
    21552162
    21562163        if ((inb(ICEREG(ice, I2C_CTRL)) & ICE1712_I2C_EEPROM) == 0) {
     
    21632170                                (snd_ice1712_read_i2c(ice, dev, 0x03) << 24);
    21642171        ice->eeprom.size = snd_ice1712_read_i2c(ice, dev, 0x04);
    2165         if (ice->eeprom.size > 32) {
     2172        if (ice->eeprom.size < 6)
     2173                ice->eeprom.size = 32; /* FIXME: any cards without the correct size? */
     2174        else if (ice->eeprom.size > 32) {
    21662175                snd_printk("invalid EEPROM (size = %i)\n", ice->eeprom.size);
    21672176                return -EIO;
     
    21722181                /* return -EIO; */
    21732182        }
    2174         for (i = 0; i < ice->eeprom.size; i++)
     2183        size = ice->eeprom.size - 6;
     2184        for (i = 0; i < size; i++)
    21752185                ice->eeprom.data[i] = snd_ice1712_read_i2c(ice, dev, i + 6);
    21762186
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ice1712.h

    r246 r250  
    457457        int (*build_controls)(ice1712_t *);
    458458        int no_mpu401: 1;
     459        unsigned int eeprom_size;
     460        unsigned char *eeprom_data;
    459461};
    460462
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ice1724.c

    r246 r250  
    4343#include "amp.h"
    4444#include "revo.h"
     45#include "aureon.h"
    4546
    4647MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
     
    5152               REVO_DEVICE_DESC
    5253               AMP_AUDIO2000_DEVICE_DESC
     54               AUREON_DEVICE_DESC
    5355                "{VIA,VT1724},"
    5456                "{ICEnsemble,Generic ICE1724},"
     
    8991
    9092/*
    91  *  AK4xxx stuff
    92  */
    93 
    94 #include "ak4xxx.c"
    95 
    96 /*
    9793 *  Basic I/O
    9894 */
     
    123119                if (!(old_cmd & VT1724_AC97_READY))
    124120                        continue;
    125                 return 0;
    126         }
     121                return old_cmd;
     122        }
     123        snd_printd(KERN_ERR "snd_vt1724_ac97_ready: timeout\n");
    127124        return old_cmd;
    128125}
     
    134131                if ((inb(ICEMT1724(ice, AC97_CMD)) & bit) == 0)
    135132                        return 0;
     133        snd_printd(KERN_ERR "snd_vt1724_ac97_wait_bit: timeout\n");
    136134        return -EIO;
    137135}
     
    145143
    146144        old_cmd = snd_vt1724_ac97_ready(ice);
     145        old_cmd &= ~VT1724_AC97_ID_MASK;
     146        old_cmd |= ac97->num;
    147147        outb(reg, ICEMT1724(ice, AC97_INDEX));
    148148        outw(val, ICEMT1724(ice, AC97_DATA));
    149         old_cmd &= ~(VT1724_AC97_PBK_VSR | VT1724_AC97_CAP_VSR);
    150149        outb(old_cmd | VT1724_AC97_WRITE, ICEMT1724(ice, AC97_CMD));
    151150        snd_vt1724_ac97_wait_bit(ice, VT1724_AC97_WRITE);
     
    158157
    159158        old_cmd = snd_vt1724_ac97_ready(ice);
     159        old_cmd &= ~VT1724_AC97_ID_MASK;
     160        old_cmd |= ac97->num;
    160161        outb(reg, ICEMT1724(ice, AC97_INDEX));
    161162        outb(old_cmd | VT1724_AC97_READ, ICEMT1724(ice, AC97_CMD));
     
    174175{
    175176        outl(data, ICEREG1724(ice, GPIO_DIRECTION));
     177        inw(ICEREG1724(ice, GPIO_DIRECTION)); /* dummy read for pci-posting */
    176178}
    177179
     
    181183        outw(data, ICEREG1724(ice, GPIO_WRITE_MASK));
    182184        outb((data >> 16) & 0xff, ICEREG1724(ice, GPIO_WRITE_MASK_22));
     185        inw(ICEREG1724(ice, GPIO_WRITE_MASK)); /* dummy read for pci-posting */
    183186}
    184187
     
    187190        outw(data, ICEREG1724(ice, GPIO_DATA));
    188191        outb(data >> 16, ICEREG1724(ice, GPIO_DATA_22));
     192        inw(ICEREG1724(ice, GPIO_DATA)); /* dummy read for pci-posting */
    189193}
    190194
     
    417421                if (val != old) {
    418422                        outb(val, ICEMT1724(ice, I2S_FORMAT));
    419                         /* FIXME: is this revo only? */
    420                         /* assert PRST# to converters; MT05 bit 7 */
    421                         outb(inb(ICEMT1724(ice, AC97_CMD)) | 0x80, ICEMT1724(ice, AC97_CMD));
    422                         spin_unlock_irqrestore(&ice->reg_lock, flags);
    423                         mdelay(5);
    424                         spin_lock_irqsave(&ice->reg_lock, flags);
    425                         /* deassert PRST# */
    426                         outb(inb(ICEMT1724(ice, AC97_CMD)) & ~0x80, ICEMT1724(ice, AC97_CMD));
     423                        if (ice->eeprom.subvendor == VT1724_SUBDEVICE_REVOLUTION71) {
     424                                /* FIXME: is this revo only? */
     425                                /* assert PRST# to converters; MT05 bit 7 */
     426                                outb(inb(ICEMT1724(ice, AC97_CMD)) | 0x80, ICEMT1724(ice, AC97_CMD));
     427                                spin_unlock_irqrestore(&ice->reg_lock, flags);
     428                                mdelay(5);
     429                                spin_lock_irqsave(&ice->reg_lock, flags);
     430                                /* deassert PRST# */
     431                                outb(inb(ICEMT1724(ice, AC97_CMD)) & ~0x80, ICEMT1724(ice, AC97_CMD));
     432                        }
    427433                }
    428434        }
     
    885891        if (! (ice->eeprom.data[ICE_EEP2_ACLINK] & VT1724_CFG_PRO_I2S)) {
    886892                ac97_t ac97;
     893                /* cold reset */
     894                outb(inb(ICEMT1724(ice, AC97_CMD)) | 0x80, ICEMT1724(ice, AC97_CMD));
     895                mdelay(5); /* FIXME */
     896                outb(inb(ICEMT1724(ice, AC97_CMD)) & ~0x80, ICEMT1724(ice, AC97_CMD));
     897
    887898                memset(&ac97, 0, sizeof(ac97));
    888899                ac97.write = snd_vt1724_ac97_write;
     
    15411552 */
    15421553
     1554static struct snd_ice1712_card_info no_matched __devinitdata;
     1555
     1556static struct snd_ice1712_card_info *card_tables[] __devinitdata = {
     1557        snd_vt1724_revo_cards,
     1558        snd_vt1724_amp_cards,
     1559        snd_vt1724_aureon_cards,
     1560        0,
     1561};
     1562
     1563
     1564/*
     1565 */
     1566
    15431567static unsigned char __devinit snd_vt1724_read_i2c(ice1712_t *ice,
    15441568                                                 unsigned char dev,
     
    15561580{
    15571581        int dev = 0xa0;         /* EEPROM device address */
    1558         unsigned int i;
     1582        unsigned int i, size;
     1583        struct snd_ice1712_card_info **tbl, *c;
    15591584
    15601585        if ((inb(ICEREG1724(ice, I2C_CTRL)) & VT1724_I2C_EEPROM) == 0) {
     
    15661591                                (snd_vt1724_read_i2c(ice, dev, 0x02) << 16) |
    15671592                                (snd_vt1724_read_i2c(ice, dev, 0x03) << 24);
     1593
     1594        /* if the EEPROM is given by the driver, use it */
     1595        for (tbl = card_tables; *tbl; tbl++) {
     1596                for (c = *tbl; c->subvendor; c++) {
     1597                        if (c->subvendor == ice->eeprom.subvendor) {
     1598                                if (! c->eeprom_size || ! c->eeprom_data)
     1599                                        goto found;
     1600                                snd_printdd("using the defined eeprom..\n");
     1601                                ice->eeprom.version = 2;
     1602                                ice->eeprom.size = c->eeprom_size + 6;
     1603                                memcpy(ice->eeprom.data, c->eeprom_data, c->eeprom_size);
     1604                                goto read_skipped;
     1605                        }
     1606                }
     1607        }
     1608
     1609 found:
    15681610        ice->eeprom.size = snd_vt1724_read_i2c(ice, dev, 0x04);
    1569         if (ice->eeprom.size > 32) {
     1611        if (ice->eeprom.size < 6)
     1612                ice->eeprom.size = 32;
     1613        else if (ice->eeprom.size > 32) {
    15701614                snd_printk("invalid EEPROM (size = %i)\n", ice->eeprom.size);
    15711615                return -EIO;
     
    15761620                // return -EIO;
    15771621        }
    1578         for (i = 0; i < ice->eeprom.size; i++)
     1622        size = ice->eeprom.size - 6;
     1623        for (i = 0; i < size; i++)
    15791624                ice->eeprom.data[i] = snd_vt1724_read_i2c(ice, dev, i + 6);
    15801625
     1626 read_skipped:
    15811627        ice->eeprom.gpiomask = eeprom_triple(ice, ICE_EEP2_GPIO_MASK);
    15821628        ice->eeprom.gpiostate = eeprom_triple(ice, ICE_EEP2_GPIO_STATE);
     
    18041850 */
    18051851
    1806 static struct snd_ice1712_card_info no_matched __devinitdata;
    1807 
    1808 static struct snd_ice1712_card_info *card_tables[] __devinitdata = {
    1809         snd_vt1724_revo_cards,
    1810         snd_vt1724_amp_cards,
    1811         0,
    1812 };
    1813 
    1814 
    18151852static int __devinit snd_vt1724_probe(struct pci_dev *pci,
    18161853                                      const struct pci_device_id *pci_id)
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/makefile.os2

    r246 r250  
    1515FILE1    = ak4xxx.obj delta.obj ews.obj hoontech.obj ice1712.obj
    1616FILE2    = ice1724.obj revo.obj
    17 FILE3    =
     17FILE3    = aureon.obj
    1818FILE4    =
    1919FILE5    =
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/revo.c

    r246 r250  
    6060                shift = 3;
    6161        }
    62         tmp = ak->images[0][reg];
     62        tmp = snd_akm4xxx_get(ak, 0, reg);
    6363        old = (tmp >> shift) & 0x03;
    6464        if (old == dfs)
     
    6767        /* reset DFS */
    6868        snd_akm4xxx_reset(ak, 1);
    69         tmp = ak->images[0][reg];
     69        tmp = snd_akm4xxx_get(ak, 0, reg);
    7070        tmp &= ~(0x03 << shift);
    7171        tmp |= dfs << shift;
     
    122122{
    123123        akm4xxx_t *ak;
     124        int err;
    124125
    125126        /* determine I2C, DACs and ADCs */
     
    140141        switch (ice->eeprom.subvendor) {
    141142        case VT1724_SUBDEVICE_REVOLUTION71:
    142                 snd_ice1712_akm4xxx_init(ak, &akm_revo_front, &akm_revo_front_priv, ice);
    143                 snd_ice1712_akm4xxx_init(ak + 1, &akm_revo_surround, &akm_revo_surround_priv, ice);
     143                if ((err = snd_ice1712_akm4xxx_init(ak, &akm_revo_front, &akm_revo_front_priv, ice)) < 0)
     144                        return err;
     145                if ((err = snd_ice1712_akm4xxx_init(ak + 1, &akm_revo_surround, &akm_revo_surround_priv, ice)) < 0)
     146                        return err;
    144147                /* unmute all codecs */
    145148                snd_ice1712_gpio_write_bits(ice, VT1724_REVO_MUTE, VT1724_REVO_MUTE);
  • GPL/branches/alsa-resync1/alsa-kernel/pci/korg1212/korg1212.c

    r246 r250  
    11451145
    11461146        if (!doorbellValue)
    1147                 return IRQ_HANDLED;
     1147                return IRQ_NONE;
    11481148
    11491149        spin_lock(&korg1212->lock);
     
    12191219
    12201220        spin_unlock(&korg1212->lock);
     1221
    12211222        return IRQ_HANDLED;
    12221223}
  • GPL/branches/alsa-resync1/alsa-kernel/pci/maestro3.c

    r212 r250  
    4444#include <sound/control.h>
    4545#include <sound/pcm.h>
     46#include <sound/mpu401.h>
    4647#include <sound/ac97_codec.h>
    4748#define SNDRV_GET_ID
     
    10551056 */
    10561057
     1058#define big_mdelay(msec) do {\
     1059        set_current_state(TASK_UNINTERRUPTIBLE);\
     1060        schedule_timeout(((msec) * HZ) / 1000);\
     1061} while (0)
     1062       
    10571063inline static void snd_m3_outw(m3_t *chip, u16 value, unsigned long reg)
    10581064{
  • GPL/branches/alsa-resync1/alsa-kernel/pci/rme96.c

    r246 r250  
    807807        switch (mode) {
    808808        case RME96_CLOCKMODE_SLAVE:
     809                /* AutoSync */
    809810                rme96->wcreg &= ~RME96_WCR_MASTER;
    810811                rme96->areg &= ~RME96_AR_WSEL;
    811812                break;
    812813        case RME96_CLOCKMODE_MASTER:
     814                /* Internal */
    813815                rme96->wcreg |= RME96_WCR_MASTER;
    814816                rme96->areg &= ~RME96_AR_WSEL;
     
    13191321
    13201322        runtime->hw = snd_rme96_capture_adat_info;
    1321         if (snd_rme96_getinputtype(rme96) != RME96_INPUT_ANALOG) {
     1323        if (snd_rme96_getinputtype(rme96) == RME96_INPUT_ANALOG) {
    13221324                /* makes no sense to use analog input. Note that analog
    13231325                   expension cards AEB4/8-I are RME96_INPUT_INTERNAL */
     
    18631865        }
    18641866        if (rme96->areg & RME96_AR_WSEL) {
    1865                 snd_iprintf(buffer, "  clock mode: word clock\n");
     1867                snd_iprintf(buffer, "  sample clock source: word clock\n");
    18661868        } else if (rme96->wcreg & RME96_WCR_MASTER) {
    1867                 snd_iprintf(buffer, "  clock mode: master\n");
     1869                snd_iprintf(buffer, "  sample clock source: internal\n");
    18681870        } else if (snd_rme96_getinputtype(rme96) == RME96_INPUT_ANALOG) {
    1869                 snd_iprintf(buffer, "  clock mode: slave (master anyway due to analog input setting)\n");
     1871                snd_iprintf(buffer, "  sample clock source: autosync (internal anyway due to analog input setting)\n");
    18701872        } else if (snd_rme96_capture_getrate(rme96, &n) < 0) {
    1871                 snd_iprintf(buffer, "  clock mode: slave (master anyway due to no valid signal)\n");
     1873                snd_iprintf(buffer, "  sample clock source: autosync (internal anyway due to no valid signal)\n");
    18721874        } else {
    1873                 snd_iprintf(buffer, "  clock mode: slave\n");
     1875                snd_iprintf(buffer, "  sample clock source: autosync\n");
    18741876        }
    18751877        if (rme96->wcreg & RME96_WCR_PRO) {
     
    21022104snd_rme96_info_clockmode_control(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
    21032105{
    2104         static char *texts[3] = { "Slave", "Master", "Wordclock" };
     2106        static char *texts[3] = { "AutoSync", "Internal", "Word" };
    21052107       
    21062108        uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
     
    24252427{
    24262428        .iface =        SNDRV_CTL_ELEM_IFACE_PCM,
    2427         .name =         "Clock Mode",
     2429        .name =         "Sample Clock Source",
    24282430        .info =         snd_rme96_info_clockmode_control,
    24292431        .get =          snd_rme96_get_clockmode_control,
  • GPL/branches/alsa-resync1/alsa-kernel/pci/rme9652/hdsp.c

    r246 r250  
    2323
    2424#include <sound/driver.h>
     25#include <linux/init.h>
    2526#include <linux/delay.h>
    2627#include <linux/interrupt.h>
     
    7677#define MULTIFACE_SS_CHANNELS    18
    7778#define MULTIFACE_DS_CHANNELS    14
     79#define H9652_DS_CHANNELS        26
     80#define H9652_SS_CHANNELS        14
    7881
    7982/* Write registers. These are defined as byte-offsets from the iobase value.
     
    8588#define HDSP_interruptConfirmation      96
    8689#define HDSP_outputEnable               128
    87 #define HDSP_jtagReg                    256
     90#define HDSP_control2Reg                256
    8891#define HDSP_midiDataOut0               352
    8992#define HDSP_midiDataOut1               356
     
    121124#define HDSP_IO_EXTENT     5192
    122125
    123 /* jtag register bits */
     126/* control2 register bits */
    124127
    125128#define HDSP_TMS                0x01
     
    134137#define HDSP_BIGENDIAN_MODE     0x200
    135138#define HDSP_RD_MULTIPLE        0x400
     139#define HDSP_9652_ENABLE_MIXER  0x800
    136140
    137141#define HDSP_S_PROGRAM          (HDSP_PROGRAM|HDSP_CONFIG_MODE_0)
     
    359363        struct tasklet_struct midi_tasklet;
    360364        int                   precise_ptr;
    361         u32                   control_register;          /* cached value */
     365        u32                   control_register;      /* cached value */
     366        u32                   control2_register;     /* cached value */
    362367        u32                   creg_spdif;
    363368        u32                   creg_spdif_stream;
    364         char                 *card_name;                    /* digiface/multiface */
     369        char                 *card_name;             /* digiface/multiface */
    365370        HDSP_IO_Type          io_type;               /* ditto, but for code use */
    366371        unsigned short        firmware_rev;
    367372        unsigned short        state;                 /* stores state bits */
    368373        u32                   firmware_cache[24413]; /* this helps recover from accidental iobox power failure */
    369         size_t                period_bytes;         /* guess what this is */
     374        size_t                period_bytes;          /* guess what this is */
    370375        unsigned char         ds_channels;
    371376        unsigned char         ss_channels;          /* different for multiface/digiface */
     
    434439
    435440#ifdef HDSP_PREALLOCATE_MEMORY
    436 extern void *snd_hammerfall_get_buffer(struct pci_dev *, dma_addr_t *dmaaddr);
    437 extern void snd_hammerfall_free_buffer(struct pci_dev *, void *ptr);
     441static void *snd_hammerfall_get_buffer(struct pci_dev *pci, size_t size, dma_addr_t *addrp, int capture)
     442{
     443        struct snd_dma_device pdev;
     444        struct snd_dma_buffer dmbuf;
     445
     446        snd_dma_device_pci(&pdev, pci, capture);
     447        dmbuf.bytes = 0;
     448        if (! snd_dma_get_reserved(&pdev, &dmbuf)) {
     449                if (snd_dma_alloc_pages(&pdev, size, &dmbuf) < 0)
     450                        return NULL;
     451                snd_dma_set_reserved(&pdev, &dmbuf);
     452        }
     453        *addrp = dmbuf.addr;
     454        return dmbuf.area;
     455}
     456
     457static void snd_hammerfall_free_buffer(struct pci_dev *pci, size_t size, void *ptr, dma_addr_t addr, int capture)
     458{
     459        struct snd_dma_device dev;
     460        snd_dma_device_pci(&dev, pci, capture);
     461        snd_dma_free_reserved(&dev);
     462}
     463
     464#else
     465static void *snd_hammerfall_get_buffer(struct pci_dev *pci, size_t size, dma_addr_t *addrp, int capture)
     466{
     467        return snd_malloc_pci_pages(pci, size, addrp);
     468}
     469
     470static void snd_hammerfall_free_buffer(struct pci_dev *pci, size_t size, void *ptr, dma_addr_t addr, int capture)
     471{
     472        snd_free_pci_pages(pci, size, ptr, addr);
     473}
    438474#endif
    439475
     
    453489static int __devinit snd_hdsp_create_alsa_devices(snd_card_t *card, hdsp_t *hdsp);
    454490static int __devinit snd_hdsp_create_pcm(snd_card_t *card, hdsp_t *hdsp);
    455 static inline int snd_hdsp_initialize_input_enable (hdsp_t *hdsp);
     491static inline int snd_hdsp_enable_io (hdsp_t *hdsp);
    456492static inline void snd_hdsp_initialize_midi_flush (hdsp_t *hdsp);
    457493static inline void snd_hdsp_initialize_channels (hdsp_t *hdsp);
     
    461497static int snd_hdsp_set_defaults(hdsp_t *hdsp);
    462498
    463 static inline int hdsp_is_9652 (hdsp_t *hdsp)
    464 {
    465         switch (hdsp->firmware_rev) {
    466         case 0x64:
    467         case 0x65:
    468         case 0x68:
    469                 return 1;
    470         default:
    471                 return 0;
    472         }
    473 }
    474 
    475499static inline int hdsp_playback_to_output_key (hdsp_t *hdsp, int in, int out)
    476500{
     
    505529static inline int hdsp_check_for_iobox (hdsp_t *hdsp)
    506530{
     531
     532        if (hdsp->io_type == H9652) return 0;
    507533        if (hdsp_read (hdsp, HDSP_statusRegister) & HDSP_ConfigError) {
    508534                snd_printk ("Hammerfall-DSP: no Digiface or Multiface connected!\n");
     
    511537        }
    512538        return 0;
     539
    513540}
    514541
     
    522549                snd_printk ("loading firmware\n");
    523550
    524                 hdsp_write (hdsp, HDSP_jtagReg, HDSP_S_PROGRAM);
     551                hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_PROGRAM);
    525552                hdsp_write (hdsp, HDSP_fifoData, 0);
    526553               
     
    530557                }
    531558               
    532                 hdsp_write (hdsp, HDSP_jtagReg, HDSP_S_LOAD);
     559                hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_LOAD);
    533560               
    534561                for (i = 0; i < 24413; ++i) {
     
    545572                }
    546573
    547                 hdsp_write (hdsp, HDSP_jtagReg, 0);
     574#ifdef SNDRV_BIG_ENDIAN
     575                hdsp->control2_register = HDSP_BIGENDIAN_MODE;
     576#else
     577                hdsp->control2_register = 0;
     578#endif
     579                hdsp_write (hdsp, HDSP_control2Reg, hdsp->control2_register);
    548580                snd_printk ("finished firmware loading\n");
    549581               
     
    575607        }
    576608
    577         if ((err = snd_hdsp_initialize_input_enable(hdsp)) < 0) {
     609        if ((err = snd_hdsp_enable_io(hdsp)) < 0) {
    578610                return err;
    579611        }
     
    581613        if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) {
    582614       
    583                 hdsp_write (hdsp, HDSP_jtagReg, HDSP_PROGRAM);
     615                hdsp_write (hdsp, HDSP_control2Reg, HDSP_PROGRAM);
    584616                hdsp_write (hdsp, HDSP_fifoData, 0);
    585617                if (hdsp_fifo_wait (hdsp, 0, HDSP_SHORT_WAIT) < 0) {
     
    587619                }
    588620
    589                 hdsp_write (hdsp, HDSP_jtagReg, HDSP_S_LOAD);
     621                hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_LOAD);
    590622                hdsp_write (hdsp, HDSP_fifoData, 0);
    591623
    592624                if (hdsp_fifo_wait (hdsp, 0, HDSP_SHORT_WAIT)) {
    593625                        hdsp->io_type = Multiface;
    594                         hdsp_write (hdsp, HDSP_jtagReg, HDSP_VERSION_BIT);
    595                         hdsp_write (hdsp, HDSP_jtagReg, HDSP_S_LOAD);
     626                        hdsp_write (hdsp, HDSP_control2Reg, HDSP_VERSION_BIT);
     627                        hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_LOAD);
    596628                        hdsp_fifo_wait (hdsp, 0, HDSP_SHORT_WAIT);
    597629                } else {
     
    658690        unsigned int ad;
    659691
    660         if (hdsp_is_9652 (hdsp)) {
    661 
    662                 if ((ad = addr/2) < 676) {
    663 
    664                         /* from martin björnsen:
    665 
    666                            "You can only write dwords to the
    667                            mixer memory which contain two
    668                            mixer values in the low and high
    669                            word. So if you want to change
    670                            value 0 you have to read value 1
    671                            from the cache and write both to
    672                            the first dword in the mixer
    673                            memory."
    674                         */
    675 
    676                         hdsp->mixer_matrix[addr] = data;
    677                         hdsp_write (hdsp, 1024 + ad,
    678                                     (hdsp->mixer_matrix[(addr&0x7fe)+1] << 16) +
    679                                     hdsp->mixer_matrix[addr&0x7fe]);
    680                         return 0;
    681                 } else {
    682                         return -1;
    683                 }
     692        if (addr >= HDSP_MATRIX_MIXER_SIZE)
     693                return -1;
    684694               
     695        if (hdsp->io_type == H9652) {
     696
     697                /* from martin björnsen:
     698                   
     699                   "You can only write dwords to the
     700                   mixer memory which contain two
     701                   mixer values in the low and high
     702                   word. So if you want to change
     703                   value 0 you have to read value 1
     704                   from the cache and write both to
     705                   the first dword in the mixer
     706                   memory."
     707                */
     708
     709                hdsp->mixer_matrix[addr] = data;
     710
     711                /* `addr' addresses a 16-bit wide address, but
     712                   the address space accessed via hdsp_write
     713                   uses byte offsets. put another way, addr
     714                   varies from 0 to 1351, but to access the
     715                   corresponding memory location, we need
     716                   to access 0 to 2703 ...
     717                */
     718
     719                hdsp_write (hdsp, 4096 + (addr*2),
     720                            (hdsp->mixer_matrix[(addr&0x7fe)+1] << 16) +
     721                            hdsp->mixer_matrix[addr&0x7fe]);
     722               
     723                return 0;
    685724
    686725        } else {
    687                 if (addr >= HDSP_MATRIX_MIXER_SIZE)
    688                         return -1;
    689                
     726
    690727                ad = (addr << 16) + data;
    691728               
     
    830867        int rate_bits;
    831868
     869        /* ASSUMPTION: hdsp->lock is either help, or
     870           there is no need for it (e.g. during module
     871           initialization).
     872        */
     873       
    832874        if (!(hdsp->control_register & HDSP_ClockModeMaster)) {
    833875                if (called_internally) {
     
    861903           is to flag rate changes in the read/write routines.  */
    862904
    863         spin_lock_irq(&hdsp->lock);
    864 
    865905        switch (rate) {
    866906        case 32000:
     
    901941                break;
    902942        default:
    903                 spin_unlock_irq(&hdsp->lock);
    904943                return -EINVAL;
    905944        }
     
    909948                            hdsp->capture_pid,
    910949                            hdsp->playback_pid);
    911                 spin_unlock_irq(&hdsp->lock);
    912950                return -EBUSY;
    913951        }
     
    925963                        break;
    926964                case Digiface:
     965                case H9652:
    927966                        hdsp->channel_map = channel_map_df_ss;
    928967                        break;
     
    939978        }
    940979
    941         spin_unlock_irq(&hdsp->lock);
    942980        return 0;
    943981}
     
    11321170        hdsp_midi_t *hmidi;
    11331171        unsigned long flags;
     1172        u32 ie;
    11341173
    11351174        hmidi = (hdsp_midi_t *) substream->rmidi->private_data;
    11361175        hdsp = hmidi->hdsp;
     1176        ie = hmidi->id ? HDSP_Midi1InterruptEnable : HDSP_Midi0InterruptEnable;
    11371177        spin_lock_irqsave (&hdsp->lock, flags);
    11381178        if (up) {
    1139                 snd_hdsp_flush_midi_input (hdsp, hmidi->id);
    1140                 if (hmidi->id)
    1141                         hdsp->control_register |= HDSP_Midi1InterruptEnable;
    1142                 else
    1143                         hdsp->control_register |= HDSP_Midi0InterruptEnable;
     1179                if (!(hdsp->control_register & ie)) {
     1180                        snd_hdsp_flush_midi_input (hdsp, hmidi->id);
     1181                        hdsp->control_register |= ie;
     1182                }
    11441183        } else {
    1145                 if (hmidi->id)
    1146                         hdsp->control_register &= ~HDSP_Midi1InterruptEnable;
    1147                 else
    1148                         hdsp->control_register &= ~HDSP_Midi0InterruptEnable;
     1184                hdsp->control_register &= ~ie;
    11491185        }
    11501186
     
    20052041        uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
    20062042        uinfo->count = 1;
    2007         uinfo->value.enumerated.items = (hdsp->io_type == Digiface) ? 6 : 4;
     2043
     2044        switch (hdsp->io_type) {
     2045        case Digiface:
     2046        case H9652:
     2047                uinfo->value.enumerated.items = 6;
     2048                break;
     2049        case Multiface:
     2050                uinfo->value.enumerated.items = 4;
     2051        default:
     2052                uinfo->value.enumerated.items = 0;
     2053                break;
     2054        }
     2055               
    20082056        if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
    20092057                uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
     
    20292077        if (!snd_hdsp_use_is_exclusive(hdsp))
    20302078                return -EBUSY;
    2031         max = (hdsp->io_type == Digiface) ? 6 : 4;
     2079
     2080        switch (hdsp->io_type) {
     2081        case Digiface:
     2082        case H9652:
     2083                max = 6;
     2084                break;
     2085        case Multiface:
     2086                max = 4;
     2087                break;
     2088        default:
     2089                return -EIO;
     2090        }
     2091
    20322092        val = ucontrol->value.enumerated.item[0] % max;
    20332093        spin_lock_irqsave(&hdsp->lock, flags);
     
    24972557
    24982558        offset = ucontrol->id.index - 1;
    2499         snd_assert(offset >= 0 || offset < ((hdsp->io_type == Digiface) ? 3 : 1), return -EINVAL);
     2559        snd_assert(offset >= 0);
     2560
     2561        switch (hdsp->io_type) {
     2562        case Digiface:
     2563        case H9652:
     2564                if (offset >= 3)
     2565                        return -EINVAL;
     2566                break;
     2567        case Multiface:
     2568                if (offset >= 1)
     2569                        return -EINVAL;
     2570                break;
     2571        default:
     2572                return -EIO;
     2573        }
     2574
    25002575        ucontrol->value.enumerated.item[0] = hdsp_adat_sync_check(hdsp, offset);
    25012576        return 0;
     
    25942669
    25952670        for (idx = 0; idx < HDSP_CONTROLS; idx++) {
    2596                 if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_hdsp_controls[idx], hdsp))) < 0)
     2671                if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_hdsp_controls[idx], hdsp))) < 0) {
    25972672                        return err;
     2673                }
    25982674                if (idx == 1)   /* IEC958 (S/PDIF) Stream */
    25992675                        hdsp->spdif_ctl = kctl;
     
    26032679        snd_hdsp_adat_sync_check.name = "ADAT Lock Status";
    26042680
    2605         if (hdsp->io_type == Digiface) {
     2681        switch (hdsp->io_type) {
     2682        case Digiface:
    26062683                limit = DIGIFACE_SS_CHANNELS;
    2607         } else {
     2684                break;
     2685        case H9652:
     2686                limit = H9652_SS_CHANNELS;
     2687                break;
     2688        case Multiface:
    26082689                limit = MULTIFACE_SS_CHANNELS;
     2690                break;
     2691        default:
     2692                return -EIO;
    26092693        }
    26102694       
     
    26282712                return err;
    26292713        }       
    2630         if (hdsp->io_type == Digiface) {
     2714        if (hdsp->io_type == Digiface || hdsp->io_type == H9652) {
    26312715                for (idx = 1; idx < 3; ++idx) {
    26322716                        snd_hdsp_adat_sync_check.index = idx+1;
     
    26822766                    hdsp->irq, hdsp->port, hdsp->iobase);
    26832767        snd_iprintf(buffer, "Control register: 0x%x\n", hdsp->control_register);
     2768        snd_iprintf(buffer, "Control2 register: 0x%x\n", hdsp->control2_register);
    26842769        snd_iprintf(buffer, "Status register: 0x%x\n", status);
    26852770        snd_iprintf(buffer, "Status2 register: 0x%x\n", status2);
     
    28552940        switch (hdsp->io_type) {
    28562941        case Digiface:
     2942        case H9652:
    28572943                x = status & HDSP_Sync1;
    28582944                if (status & HDSP_Lock1) {
     
    29143000{
    29153001        if (hdsp->capture_buffer_unaligned) {
    2916 #ifndef HDSP_PREALLOCATE_MEMORY
    2917                 snd_free_pci_pages(hdsp->pci,
    2918                                    HDSP_DMA_AREA_BYTES,
    2919                                    hdsp->capture_buffer_unaligned,
    2920                                    hdsp->capture_buffer_addr);
    2921 #else
    2922                 snd_hammerfall_free_buffer(hdsp->pci, hdsp->capture_buffer_unaligned);
    2923 #endif
     3002                snd_hammerfall_free_buffer(hdsp->pci, HDSP_DMA_AREA_BYTES,
     3003                                           hdsp->capture_buffer_unaligned,
     3004                                           hdsp->capture_buffer_addr, 1);
    29243005        }
    29253006
    29263007        if (hdsp->playback_buffer_unaligned) {
    2927 #ifndef HDSP_PREALLOCATE_MEMORY
    2928                 snd_free_pci_pages(hdsp->pci,
    2929                                    HDSP_DMA_AREA_BYTES,
    2930                                    hdsp->playback_buffer_unaligned,
    2931                                    hdsp->playback_buffer_addr);
    2932 #else
    2933                 snd_hammerfall_free_buffer(hdsp->pci, hdsp->playback_buffer_unaligned);
    2934 #endif
     3008                snd_hammerfall_free_buffer(hdsp->pci, HDSP_DMA_AREA_BYTES,
     3009                                           hdsp->playback_buffer_unaligned,
     3010                                           hdsp->playback_buffer_addr, 0);
    29353011        }
    29363012}
     
    29423018        unsigned long pb_bus, cb_bus;
    29433019
    2944 #ifndef HDSP_PREALLOCATE_MEMORY
    2945         cb = snd_malloc_pci_pages(hdsp->pci, HDSP_DMA_AREA_BYTES, &cb_addr);
    2946         pb = snd_malloc_pci_pages(hdsp->pci, HDSP_DMA_AREA_BYTES, &pb_addr);
    2947 #else
    2948         cb = snd_hammerfall_get_buffer(hdsp->pci, &cb_addr);
    2949         pb = snd_hammerfall_get_buffer(hdsp->pci, &pb_addr);
    2950 #endif
     3020        cb = snd_hammerfall_get_buffer(hdsp->pci, HDSP_DMA_AREA_BYTES, &cb_addr, 1);
     3021        pb = snd_hammerfall_get_buffer(hdsp->pci, HDSP_DMA_AREA_BYTES, &pb_addr, 0);
    29513022
    29523023        if (cb == 0 || pb == 0) {
    29533024                if (cb) {
    2954 #ifdef HDSP_PREALLOCATE_MEMORY
    2955                         snd_hammerfall_free_buffer(hdsp->pci, cb);
    2956 #else
    2957                         snd_free_pci_pages(hdsp->pci, HDSP_DMA_AREA_BYTES, cb, cb_addr);
    2958 #endif
     3025                        snd_hammerfall_free_buffer(hdsp->pci, HDSP_DMA_AREA_BYTES, cb, cb_addr, 1);
    29593026                }
    29603027                if (pb) {
    2961 #ifdef HDSP_PREALLOCATE_MEMORY
    2962                         snd_hammerfall_free_buffer(hdsp->pci, pb);
    2963 #else
    2964                         snd_free_pci_pages(hdsp->pci, HDSP_DMA_AREA_BYTES, pb, pb_addr);
    2965 #endif
     3028                        snd_hammerfall_free_buffer(hdsp->pci, HDSP_DMA_AREA_BYTES, pb, pb_addr, 0);
    29663029                }
    29673030
     
    30263089        }
    30273090
    3028         for (i = 0; i < (hdsp_is_9652(hdsp) ? 1352 : HDSP_MATRIX_MIXER_SIZE); i++) {
     3091        for (i = 0; i < (hdsp->io_type == H9652 ? 1352 : HDSP_MATRIX_MIXER_SIZE); i++) {
    30293092                if (hdsp_write_gain (hdsp, i, MINUS_INFINITY_GAIN)) {
    30303093                        return -EIO;
     
    30323095        }
    30333096       
    3034         if (!hdsp_is_9652(hdsp) && line_outs_monitor[hdsp->dev]) {
     3097        if ((hdsp->io_type != H9652) && line_outs_monitor[hdsp->dev]) {
    30353098               
    30363099                snd_printk ("sending all inputs and playback streams to line outs.\n");
     
    32923355         */
    32933356
     3357        spin_lock_irq(&hdsp->lock);
    32943358        if ((err = hdsp_set_rate(hdsp, params_rate(params), 0)) < 0) {
     3359                spin_unlock_irq(&hdsp->lock);
    32953360                _snd_pcm_hw_param_setempty(params, SNDRV_PCM_HW_PARAM_RATE);
    32963361                return err;
     3362        } else {
     3363                spin_unlock_irq(&hdsp->lock);
    32973364        }
    32983365
     
    37843851                break;
    37853852        case SNDRV_HDSP_IOCTL_GET_VERSION:
    3786                 if (hdsp_is_9652(hdsp)) return -EINVAL;
     3853                if (hdsp->io_type == H9652) return -EINVAL;
    37873854                if (hdsp->io_type == Undefined) {
    37883855                        if ((err = hdsp_get_iobox_version(hdsp)) < 0) {
     
    37973864                break;
    37983865        case SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE:
    3799                 if (hdsp_is_9652(hdsp)) return -EINVAL;
     3866                if (hdsp->io_type == H9652) return -EINVAL;
    38003867                /* SNDRV_HDSP_IOCTL_GET_VERSION must have been called */
    38013868                if (hdsp->io_type == Undefined) return -EINVAL;
     
    39053972}
    39063973
    3907 static inline int snd_hdsp_initialize_input_enable (hdsp_t *hdsp)
     3974static inline void snd_hdsp_9652_enable_mixer (hdsp_t *hdsp)
     3975{
     3976        hdsp->control2_register |= HDSP_9652_ENABLE_MIXER;
     3977        hdsp_write (hdsp, HDSP_control2Reg, hdsp->control2_register);
     3978}
     3979
     3980static inline void snd_hdsp_9652_disable_mixer (hdsp_t *hdsp)
     3981{
     3982        hdsp->control2_register &= ~HDSP_9652_ENABLE_MIXER;
     3983        hdsp_write (hdsp, HDSP_control2Reg, hdsp->control2_register);
     3984}
     3985
     3986static inline int snd_hdsp_enable_io (hdsp_t *hdsp)
    39083987{
    39093988        int i;
     
    39234002static inline void snd_hdsp_initialize_channels(hdsp_t *hdsp)
    39244003{
    3925         if (hdsp->io_type == Digiface) {
     4004        switch (hdsp->io_type) {
     4005        case Digiface:
    39264006                hdsp->card_name = "RME Hammerfall DSP + Digiface";
    39274007                hdsp->ss_channels = DIGIFACE_SS_CHANNELS;
    39284008                hdsp->ds_channels = DIGIFACE_DS_CHANNELS;
    3929         } else {
     4009                break;
     4010
     4011        case H9652:
     4012                hdsp->card_name = "RME Hammerfall HDSP 9652";
     4013                hdsp->ss_channels = H9652_SS_CHANNELS;
     4014                hdsp->ds_channels = H9652_DS_CHANNELS;
     4015                break;
     4016
     4017        case Multiface:
    39304018                hdsp->card_name = "RME Hammerfall DSP + Multiface";
    39314019                hdsp->ss_channels = MULTIFACE_SS_CHANNELS;
    39324020                hdsp->ds_channels = MULTIFACE_DS_CHANNELS;
     4021
     4022        default:
     4023                /* should never get here */
     4024                break;
    39334025        }
    39344026}
     
    39384030        snd_hdsp_flush_midi_input (hdsp, 0);
    39394031        snd_hdsp_flush_midi_input (hdsp, 1);
    3940 
    3941 #ifdef SNDRV_BIG_ENDIAN
    3942         hdsp_write(hdsp, HDSP_jtagReg, HDSP_BIGENDIAN_MODE);
    3943 #endif
    39444032}
    39454033
     
    40024090        int err;
    40034091        int i;
     4092        int is_9652 = 0;
    40044093
    40054094        hdsp->irq = -1;
     
    40284117        strcpy(card->driver, "H-DSP");
    40294118        strcpy(card->mixername, "Xilinx FPGA");
    4030        
     4119
    40314120        switch (hdsp->firmware_rev & 0xff) {
    40324121        case 0xa:
     
    40344123                hdsp->card_name = "RME Hammerfall DSP";
    40354124                break;
     4125
    40364126        case 0x64:
    40374127        case 0x65:
    40384128        case 0x68:
    40394129                hdsp->card_name = "RME HDSP 9652";
    4040                 break;
     4130                is_9652 = 1;
     4131                break;
     4132
    40414133        default:
    40424134                return -ENODEV;
    40434135        }
    40444136
    4045         if ((err = pci_enable_device(pci)) < 0)
     4137        if ((err = pci_enable_device(pci)) < 0) {
    40464138                return err;
     4139        }
    40474140
    40484141        pci_set_master(hdsp->pci);
     
    40724165        }
    40734166       
    4074         if (hdsp_is_9652(hdsp)) {
    4075                
    4076                 if ((err = snd_hdsp_initialize_input_enable(hdsp)) != 0) {
    4077                         return err;
    4078                 }
    4079 
    4080                 hdsp->io_type = Digiface;               
    4081        
    4082                 hdsp->ss_channels = DIGIFACE_SS_CHANNELS;
    4083                 hdsp->ds_channels = DIGIFACE_DS_CHANNELS;
    4084        
    4085                 snd_hdsp_initialize_midi_flush(hdsp);
    4086        
     4167        if (!is_9652 && hdsp_check_for_iobox (hdsp)) {
     4168                /* no iobox connected, we defer initialization */
     4169                snd_printk("card initialization pending : waiting for firmware\n");
    40874170                if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) {
    40884171                        return err;
    40894172                }
    4090 
    4091         } else {
    4092        
    4093                 if (hdsp_check_for_iobox (hdsp)) {
    4094                         /* no iobox connected, we defer initialization */
    4095                         snd_printk("card initialization pending : waiting for firmware\n");
    4096                         if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) {
    4097                                 return err;
    4098                         }
    4099                         return 0;
    4100                 }
    4101 
    4102                 if ((err = snd_hdsp_initialize_input_enable(hdsp)) != 0) {
    4103                         return err;
    4104                 }
    4105                
    4106                 if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) {
    4107                         snd_printk("card initialization pending : waiting for firmware\n");
    4108                         if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) {
    4109                                 return err;
    4110                         }
    41114173                return 0;
    4112                 }
    4113                
    4114                 snd_printk("Firmware already loaded, initializing card.\n");
    4115 
    4116                 if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1) {
    4117                         hdsp->io_type = Multiface;
    4118                 } else {
    4119                         hdsp->io_type = Digiface;
    4120                 }
    4121                
     4174        }
     4175       
     4176        if ((err = snd_hdsp_enable_io(hdsp)) != 0) {
     4177                return err;
     4178        }
     4179       
     4180        if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) {
     4181                snd_printk("card initialization pending : waiting for firmware\n");
    41224182                if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) {
    41234183                        return err;
    41244184                }
    4125                
    4126                 snd_hdsp_initialize_channels(hdsp);
    4127                
    4128                 snd_hdsp_initialize_midi_flush(hdsp);
    4129                
    4130         }
    4131        
     4185                return 0;
     4186        }
     4187       
     4188        snd_printk("Firmware already loaded, initializing card.\n");
     4189       
     4190        if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1) {
     4191                hdsp->io_type = Multiface;
     4192        } else {
     4193                hdsp->io_type = Digiface;
     4194        }
     4195
     4196        if (is_9652) {
     4197                hdsp->io_type = H9652;
     4198                snd_hdsp_9652_enable_mixer (hdsp);
     4199        }
     4200
     4201        if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) {
     4202                return err;
     4203        }
     4204       
     4205        snd_hdsp_initialize_channels(hdsp);
     4206        snd_hdsp_initialize_midi_flush(hdsp);
     4207
    41324208        hdsp->state |= HDSP_FirmwareLoaded;     
    4133        
     4209
    41344210        if ((err = snd_hdsp_create_alsa_devices(card, hdsp)) < 0) {
    41354211                return err;
    41364212        }
    4137        
     4213
    41384214        return 0;       
    41394215}
     
    42024278        sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name,
    42034279                hdsp->port, hdsp->irq);
    4204        
     4280
    42054281        if ((err = snd_card_register(card)) < 0) {
    42064282                snd_card_free(card);
  • GPL/branches/alsa-resync1/alsa-kernel/pci/rme9652/makefile.os2

    r207 r250  
    1313#
    1414#===================================================================
    15 FILE1    = hammerfall_mem.obj rme9652.obj hdsp.obj
     15FILE1    = rme9652.obj hdsp.obj
    1616FILE2    =
    1717FILE3    =
  • GPL/branches/alsa-resync1/alsa-kernel/pci/rme9652/rme9652.c

    r246 r250  
    310310
    311311#ifdef RME9652_PREALLOCATE_MEMORY
    312 extern void *snd_hammerfall_get_buffer(struct pci_dev *, dma_addr_t *dmaaddr);
    313 extern void snd_hammerfall_free_buffer(struct pci_dev *, void *ptr);
     312static void *snd_hammerfall_get_buffer(struct pci_dev *pci, size_t size, dma_addr_t *addrp, int capture)
     313{
     314        struct snd_dma_device pdev;
     315        struct snd_dma_buffer dmbuf;
     316
     317        snd_dma_device_pci(&pdev, pci, capture);
     318        dmbuf.bytes = 0;
     319        if (! snd_dma_get_reserved(&pdev, &dmbuf)) {
     320                if (snd_dma_alloc_pages(&pdev, size, &dmbuf) < 0)
     321                        return NULL;
     322                snd_dma_set_reserved(&pdev, &dmbuf);
     323        }
     324        *addrp = dmbuf.addr;
     325        return dmbuf.area;
     326}
     327
     328static void snd_hammerfall_free_buffer(struct pci_dev *pci, size_t size, void *ptr, dma_addr_t addr, int capture)
     329{
     330        struct snd_dma_device dev;
     331        snd_dma_device_pci(&dev, pci, capture);
     332        snd_dma_free_reserved(&dev);
     333}
     334
     335#else
     336static void *snd_hammerfall_get_buffer(struct pci_dev *pci, size_t size, dma_addr_t *addrp, int capture)
     337{
     338        return snd_malloc_pci_pages(pci, size, addrp);
     339}
     340
     341static void snd_hammerfall_free_buffer(struct pci_dev *pci, size_t size, void *ptr, dma_addr_t addr, int capture)
     342{
     343        snd_free_pci_pages(pci, size, ptr, addr);
     344}
    314345#endif
     346
    315347
    316348static struct pci_device_id snd_rme9652_ids[] __devinitdata = {
     
    18101842{
    18111843        if (rme9652->capture_buffer_unaligned) {
    1812 #ifndef RME9652_PREALLOCATE_MEMORY
    1813                 snd_free_pci_pages(rme9652->pci,
    1814                                    RME9652_DMA_AREA_BYTES,
    1815                                    rme9652->capture_buffer_unaligned,
    1816                                    rme9652->capture_buffer_addr);
    1817 #else
    1818                 snd_hammerfall_free_buffer(rme9652->pci, rme9652->capture_buffer_unaligned);
    1819 #endif
     1844                snd_hammerfall_free_buffer(rme9652->pci, RME9652_DMA_AREA_BYTES,
     1845                                           rme9652->capture_buffer_unaligned,
     1846                                           rme9652->capture_buffer_addr, 1);
    18201847        }
    18211848
    18221849        if (rme9652->playback_buffer_unaligned) {
    1823 #ifndef RME9652_PREALLOCATE_MEMORY
    1824                 snd_free_pci_pages(rme9652->pci,
    1825                                    RME9652_DMA_AREA_BYTES,
    1826                                    rme9652->playback_buffer_unaligned,
    1827                                    rme9652->playback_buffer_addr);
    1828 #else
    1829                 snd_hammerfall_free_buffer(rme9652->pci, rme9652->playback_buffer_unaligned);
    1830 #endif
     1850                snd_hammerfall_free_buffer(rme9652->pci, RME9652_DMA_AREA_BYTES,
     1851                                           rme9652->playback_buffer_unaligned,
     1852                                           rme9652->playback_buffer_addr, 0);
    18311853        }
    18321854}
     
    18551877        unsigned long pb_bus, cb_bus;
    18561878
    1857 #ifndef RME9652_PREALLOCATE_MEMORY
    1858         cb = snd_malloc_pci_pages(rme9652->pci, RME9652_DMA_AREA_BYTES, &cb_addr);
    1859         pb = snd_malloc_pci_pages(rme9652->pci, RME9652_DMA_AREA_BYTES, &pb_addr);
    1860 #else
    1861         cb = snd_hammerfall_get_buffer(rme9652->pci, &cb_addr);
    1862         pb = snd_hammerfall_get_buffer(rme9652->pci, &pb_addr);
    1863 #endif
     1879        cb = snd_hammerfall_get_buffer(rme9652->pci, RME9652_DMA_AREA_BYTES, &cb_addr, 1);
     1880        pb = snd_hammerfall_get_buffer(rme9652->pci, RME9652_DMA_AREA_BYTES, &pb_addr, 0);
    18641881
    18651882        if (cb == 0 || pb == 0) {
    18661883                if (cb) {
    1867 #ifdef RME9652_PREALLOCATE_MEMORY
    1868                         snd_hammerfall_free_buffer(rme9652->pci, cb);
    1869 #else
    1870                         snd_free_pci_pages(rme9652->pci, RME9652_DMA_AREA_BYTES, cb, cb_addr);
    1871 #endif
     1884                        snd_hammerfall_free_buffer(rme9652->pci, RME9652_DMA_AREA_BYTES, cb, cb_addr, 1);
    18721885                }
    18731886                if (pb) {
    1874 #ifdef RME9652_PREALLOCATE_MEMORY
    1875                         snd_hammerfall_free_buffer(rme9652->pci, pb);
    1876 #else
    1877                         snd_free_pci_pages(rme9652->pci, RME9652_DMA_AREA_BYTES, pb, pb_addr);
    1878 #endif
     1887                        snd_hammerfall_free_buffer(rme9652->pci, RME9652_DMA_AREA_BYTES, pb, pb_addr, 0);
    18791888                }
    18801889
  • GPL/branches/alsa-resync1/alsa-kernel/pci/sonicvibes.c

    r246 r250  
    260260        snd_kcontrol_t *master_volume;
    261261
    262 #if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)
     262#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
    263263        struct gameport gameport;
    264264#endif
     
    11941194static int snd_sonicvibes_free(sonicvibes_t *sonic)
    11951195{
    1196 #if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)
     1196#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
    11971197        if (sonic->gameport.io)
    11981198                gameport_unregister_port(&sonic->gameport);
     
    14981498                return err;
    14991499        }
    1500 #if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)
     1500#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
    15011501        sonic->gameport.io = sonic->game_port;
    15021502        gameport_register_port(&sonic->gameport);
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ymfpci/ymfpci_main.c

    r246 r250  
    23162316    init_waitqueue_head(&chip->interrupt_sleep);
    23172317    atomic_set(&chip->interrupt_sleep_count, 0);
     2318#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
     2319        init_MUTEX(&chip->joystick_mutex);
     2320#endif
    23182321    chip->card = card;
    23192322    chip->pci = pci;
Note: See TracChangeset for help on using the changeset viewer.