Changeset 92


Ignore:
Timestamp:
May 2, 2007, 7:13:43 AM (14 years ago)
Author:
Brendan Oakley
Message:

Merged 0.9.0beta6 to 0.9.0beta12. Fixed a few compilation errors.
Left include/sound/driver.h at beta9 until I figure out why it contains
so many modifications to sections that were removed in beta10.
Does not yet build. Needs more fixing.
Added a few new files that were in the copy Paul gave me to work from.

Location:
GPL/branches/alsa-resync1/alsa-kernel
Files:
4 added
60 edited

Legend:

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

    r84 r92  
    1616 *   You should have received a copy of the GNU General Public License
    1717 *   along with this program; if not, write to the Free Software
    18  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    19  *
    20  */
    21 
     18 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
     19 *
     20 */
     21
     22#define __NO_VERSION__
    2223#include <sound/driver.h>
     24#include <linux/interrupt.h>
     25#include <linux/slab.h>
     26#include <linux/vmalloc.h>
     27#include <linux/time.h>
     28#include <sound/core.h>
    2329#include <sound/minors.h>
    2430#include <sound/info.h>
     
    4349static int snd_ctl_open(struct inode *inode, struct file *file)
    4450{
    45     int cardnum = SNDRV_MINOR_CARD(MINOR(inode->i_rdev));
    46     unsigned long flags;
    47     struct snd_card *card;
    48     struct snd_ctl_file *ctl;
    49     int err;
    50 
    51     card = snd_cards[cardnum];
    52     if (!card) {
    53         err = -ENODEV;
    54         goto __error1;
    55     }
    56     err = snd_card_file_add(card, file);
    57     if (err < 0) {
    58         err = -ENODEV;
    59         goto __error1;
    60     }
    61     if (!try_module_get(card->module)) {
    62         err = -EFAULT;
    63         goto __error2;
    64     }
    65     ctl = kcalloc(1, sizeof(*ctl), GFP_KERNEL);
    66     if (ctl == NULL) {
    67         err = -ENOMEM;
    68         goto __error;
    69     }
    70     INIT_LIST_HEAD(&ctl->events);
    71     init_waitqueue_head(&ctl->change_sleep);
    72     spin_lock_init(&ctl->read_lock);
    73     ctl->card = card;
    74     ctl->pid = current->pid;
    75     file->private_data = ctl;
    76     write_lock_irqsave(&card->ctl_files_rwlock, flags);
    77     list_add_tail(&ctl->list, &card->ctl_files);
    78     write_unlock_irqrestore(&card->ctl_files_rwlock, flags);
    79     return 0;
     51        int cardnum = SNDRV_MINOR_CARD(minor(inode->i_rdev));
     52        unsigned long flags;
     53        struct snd_card *card;
     54        struct snd_ctl_file *ctl;
     55        int err;
     56
     57        card = snd_cards[cardnum];
     58        if (!card) {
     59                err = -ENODEV;
     60                goto __error1;
     61        }
     62        err = snd_card_file_add(card, file);
     63        if (err < 0) {
     64                err = -ENODEV;
     65                goto __error1;
     66        }
     67        if (!try_module_get(card->module)) {
     68                err = -EFAULT;
     69                goto __error2;
     70        }
     71        ctl = kcalloc(1, sizeof(*ctl), GFP_KERNEL);
     72        if (ctl == NULL) {
     73                err = -ENOMEM;
     74                goto __error;
     75        }
     76        INIT_LIST_HEAD(&ctl->events);
     77        init_waitqueue_head(&ctl->change_sleep);
     78        spin_lock_init(&ctl->read_lock);
     79        ctl->card = card;
     80        ctl->pid = current->pid;
     81        file->private_data = ctl;
     82        write_lock_irqsave(&card->ctl_files_rwlock, flags);
     83        list_add_tail(&ctl->list, &card->ctl_files);
     84        write_unlock_irqrestore(&card->ctl_files_rwlock, flags);
     85        return 0;
    8086
    8187__error:
     
    8490    snd_card_file_remove(card, file);
    8591__error1:
    86     return err;
     92        return err;
    8793}
    8894
     
    9096{
    9197    struct snd_kctl_event *cread;
    92 
    93     spin_lock(&ctl->read_lock);
    94     while (!list_empty(&ctl->events)) {
    95         cread = snd_kctl_event(ctl->events.next);
    96         list_del(&cread->list);
    97         kfree(cread);
    98     }
    99     spin_unlock(&ctl->read_lock);
     98       
     99        spin_lock(&ctl->read_lock);
     100        while (!list_empty(&ctl->events)) {
     101                cread = snd_kctl_event(ctl->events.next);
     102                list_del(&cread->list);
     103                kfree(cread);
     104        }
     105        spin_unlock(&ctl->read_lock);
    100106}
    101107
    102108static int snd_ctl_release(struct inode *inode, struct file *file)
    103109{
    104     unsigned long flags;
    105     struct list_head *list;
    106     struct snd_card *card;
    107     struct snd_ctl_file *ctl;
    108     struct snd_kcontrol *control;
    109     unsigned int idx;
    110 
    111     ctl = file->private_data;
    112     fasync_helper(-1, file, 0, &ctl->fasync);
    113     file->private_data = NULL;
    114     card = ctl->card;
    115     write_lock_irqsave(&card->ctl_files_rwlock, flags);
    116     list_del(&ctl->list);
    117     write_unlock_irqrestore(&card->ctl_files_rwlock, flags);
    118     down_write(&card->controls_rwsem);
    119     list_for_each(list, &card->controls) {
    120         control = snd_kcontrol(list);
    121         for (idx = 0; idx < control->count; idx++)
    122             if (control->vd[idx].owner == ctl)
    123                 control->vd[idx].owner = NULL;
    124     }
    125     up_write(&card->controls_rwsem);
    126     snd_ctl_empty_read_queue(ctl);
    127     kfree(ctl);
    128     module_put(card->module);
    129     snd_card_file_remove(card, file);
    130     return 0;
     110        unsigned long flags;
     111        struct list_head *list;
     112        struct snd_card *card;
     113        struct snd_ctl_file *ctl;
     114        struct snd_kcontrol *control;
     115        unsigned int idx;
     116
     117        ctl = file->private_data;
     118        fasync_helper(-1, file, 0, &ctl->fasync);
     119        file->private_data = NULL;
     120        card = ctl->card;
     121        write_lock_irqsave(&card->ctl_files_rwlock, flags);
     122        list_del(&ctl->list);
     123        write_unlock_irqrestore(&card->ctl_files_rwlock, flags);
     124        down_write(&card->controls_rwsem);
     125        list_for_each(list, &card->controls) {
     126                control = snd_kcontrol(list);
     127                for (idx = 0; idx < control->count; idx++)
     128                        if (control->vd[idx].owner == ctl)
     129                                control->vd[idx].owner = NULL;
     130        }
     131        up_write(&card->controls_rwsem);
     132        snd_ctl_empty_read_queue(ctl);
     133        kfree(ctl);
     134        module_put(card->module);
     135        snd_card_file_remove(card, file);
     136        return 0;
    131137}
    132138
    133139void snd_ctl_notify(struct snd_card *card, unsigned int mask, struct snd_ctl_elem_id *id)
    134140{
    135     unsigned long flags;
    136     struct list_head *flist;
    137     struct snd_ctl_file *ctl;
    138     struct snd_kctl_event *ev;
    139 
    140     snd_runtime_check(card != NULL && id != NULL, return);
    141 
    142     control_id_changed = id->numid;
    143     card_id_changed = card->number;
    144     //        printk("ctl id %i changed\n", id->numid);
    145     read_lock(&card->ctl_files_rwlock);
     141        unsigned long flags;
     142        struct list_head *flist;
     143        struct snd_ctl_file *ctl;
     144        struct snd_kctl_event *ev;
     145       
     146        snd_runtime_check(card != NULL && id != NULL, return);
     147
     148        control_id_changed = id->numid;
     149        card_id_changed = card->number;
     150        //        printk("ctl id %i changed\n", id->numid);
     151        read_lock(&card->ctl_files_rwlock);
    146152#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
    147     card->mixer_oss_change_count++;
     153        card->mixer_oss_change_count++;
    148154#endif
    149     list_for_each(flist, &card->ctl_files) {
     155        list_for_each(flist, &card->ctl_files) {
    150156        struct list_head *elist;
    151157        ctl = snd_ctl_file(flist);
     
    166172            list_add_tail(&ev->list, &ctl->events);
    167173        } else {
    168             snd_printk("No memory available to allocate event\n");
    169         }
     174                        snd_printk(KERN_ERR "No memory available to allocate event\n");
     175                }
    170176        _found:
    171177        wake_up(&ctl->change_sleep);
     
    338344    }
    339345#endif
    340     list_add_tail(&kcontrol->list, &card->controls);
     346        list_add_tail(&kcontrol->list, &card->controls);
    341347    card->controls_count += kcontrol->count;
    342     kcontrol->id.numid = card->last_numid + 1;
    343     card->last_numid += kcontrol->count;
    344     up_write(&card->controls_rwsem);
    345     for (idx = 0; idx < kcontrol->count; idx++, id.index++, id.numid++)
    346         snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_ADD, &id);
    347     return 0;
     348        kcontrol->id.numid = card->last_numid + 1;
     349        card->last_numid += kcontrol->count;
     350        up_write(&card->controls_rwsem);
     351        for (idx = 0; idx < kcontrol->count; idx++, id.index++, id.numid++)
     352        snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_ADD, &id);
     353        return 0;
    348354
    349355error:
    350356    snd_ctl_free_one(kcontrol);
    351     return err;
     357        return err;
    352358}
    353359
  • GPL/branches/alsa-resync1/alsa-kernel/core/device.c

    r34 r92  
    1616 *   You should have received a copy of the GNU General Public License
    1717 *   along with this program; if not, write to the Free Software
    18  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    19  *
    20  */
    21 
     18 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
     19 *
     20 */
     21
     22#define __NO_VERSION__
    2223#include <sound/driver.h>
     24#include <linux/slab.h>
     25#include <linux/time.h>
     26#include <sound/core.h>
    2327
    2428/**
     
    8488                    dev->ops->dev_unregister) {
    8589                        if (dev->ops->dev_unregister(dev))
    86                                 snd_printk("device unregister failure\n");
     90                                snd_printk(KERN_ERR "device unregister failure\n");
    8791                } else {
    8892                        if (dev->ops->dev_free) {
    8993                                if (dev->ops->dev_free(dev))
    90                                         snd_printk("device free failure\n");
     94                                        snd_printk(KERN_ERR "device free failure\n");
    9195                        }
    9296                }
  • GPL/branches/alsa-resync1/alsa-kernel/core/info.c

    r32 r92  
    2020 */
    2121
     22#define __NO_VERSION__
    2223#include <sound/driver.h>
     24#include <linux/init.h>
     25#include <linux/vmalloc.h>
     26#include <linux/time.h>
     27#ifndef TARGET_OS2 /* Introduced in version 0.9.0beta12, not present */
     28#include <linux/smp_lock.h>
     29#endif /* TARGET_OS2 */
     30#include <sound/core.h>
    2331#include <sound/minors.h>
    2432#include <sound/info.h>
    2533#include <sound/version.h>
    26 #include <stdarg.h>
     34#include <linux/proc_fs.h>
    2735#ifdef CONFIG_DEVFS_FS
    2836#include <linux/devfs_fs_kernel.h>
    2937#endif
     38#include <stdarg.h>
    3039
    3140#define min(x,y) (x < y ? x : y )
     
    3948    static char *reserved[] =
    4049    {
     50                "dev",
    4151        "version",
    4252        "meminfo",
     
    4454        "detect",
    4555        "devices",
    46         "oss",
     56                "oss-devices",
    4757        "cards",
    4858        "timers",
     
    166176                                       data->file_private_data,
    167177                                       file, offset, orig);
    168             goto out;
    169         }
    170         break;
    171     }
    172     ret = -ENXIO;
     178                        goto out;
     179                }
     180                break;
     181        }
     182        ret = -ENXIO;
    173183out:
    174184#ifndef TARGET_OS2
    175     unlock_kernel();
    176 #endif
    177     return ret;
     185        unlock_kernel();
     186#endif
     187        return ret;
    178188}
    179189
     
    272282
    273283    down(&info_mutex);
    274     p = (struct proc_dir_entry *) inode->u.generic_ip;
     284        p = PDE(inode);
    275285    entry = p == NULL ? NULL : (snd_info_entry_t *)p->data;
    276286    if (entry == NULL) {
     
    278288        return -ENODEV;
    279289    }
    280 #ifndef LINUX_2_3
     290#ifdef LINUX_2_2
    281291    MOD_INC_USE_COUNT;
    282292#endif
     
    415425                entry->c.text.write(entry, data->wbuffer);
    416426                if (data->wbuffer->error) {
    417                     snd_printk("data write error to %s (%i)\n",
     427                                        snd_printk(KERN_WARNING "data write error to %s (%i)\n",
    418428                               entry->name,
    419429                               data->wbuffer->error);
     
    525535static struct file_operations snd_info_entry_operations =
    526536{
    527 #ifdef LINUX_2_3
     537#ifndef LINUX_2_2
    528538owner:          THIS_MODULE,
    529539#endif
     
    538548};
    539549
    540 #ifndef LINUX_2_3
     550#ifdef LINUX_2_2
    541551static struct inode_operations snd_info_entry_inode_operations =
    542552{
     
    548558    &snd_fops,          /* default sound info directory file-ops */
    549559};
    550 #endif  /* LINUX_2_3 */
     560#endif  /* LINUX_2_2 */
    551561
    552562static int snd_info_card_readlink(struct dentry *dentry,
    553563                                  char *buffer, int buflen)
    554564{
    555     char *s = ((struct proc_dir_entry *) dentry->d_inode->u.generic_ip)->data;
    556 #ifdef LINUX_2_3
     565        char *s = PDE(dentry->d_inode)->data;
     566#ifndef LINUX_2_2
    557567    return vfs_readlink(dentry, buffer, buflen, s);
    558568#else
     
    570580}
    571581
    572 #ifdef LINUX_2_3
     582#ifndef LINUX_2_2
    573583static int snd_info_card_followlink(struct dentry *dentry,
    574584                                    struct nameidata *nd)
    575585{
    576     char *s = ((struct proc_dir_entry *) dentry->d_inode->u.generic_ip)->data;
     586        char *s = PDE(dentry->d_inode)->data;
    577587    return vfs_follow_link(nd, s);
    578588}
     
    582592                                               unsigned int follow)
    583593{
    584     char *s = ((struct proc_dir_entry *) dentry->d_inode->u.generic_ip)->data;
     594        char *s = PDE(dentry->d_inode)->data;
    585595    return lookup_dentry(s, base, follow);
    586596}
    587597#endif
    588598
    589 #ifndef LINUX_2_3
     599#ifdef LINUX_2_2
    590600static struct file_operations snd_info_card_link_operations =
    591601{
     
    596606struct inode_operations snd_info_card_link_inode_operations =
    597607{
    598 #ifndef LINUX_2_3
     608#ifdef LINUX_2_2
    599609default_file_ops:       &snd_info_card_link_operations,
    600610#endif
     
    683693    snd_info_version_done();
    684694    if (snd_proc_root) {
    685 #ifdef CONFIG_SND_SEQUENCER
     695#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
    686696        if (snd_seq_root)
    687697            snd_info_unregister(snd_seq_root);
     
    10191029        return -ENOMEM;
    10201030    }
    1021 #ifdef LINUX_2_3
     1031#ifndef LINUX_2_2
    10221032    p->owner = entry->module;
    10231033#endif
     
    10251035#ifndef TARGET_OS2
    10261036    if (!S_ISDIR(entry->mode)) {
    1027 #ifdef LINUX_2_3
     1037#ifndef LINUX_2_2
    10281038        p->proc_fops = &snd_info_entry_operations;
    10291039#else
     
    10721082
    10731083    snd_iprintf(buffer,
    1074                 "Advanced Linux Sound Architecture Driver Version " CONFIG_SND_VERSION ".\n"
     1084                    "Advanced Linux Sound Architecture Driver Version " CONFIG_SND_VERSION CONFIG_SND_DATE ".\n"
    10751085                "Compiled on " __DATE__ " for kernel %s"
    10761086#ifdef __SMP__
  • GPL/branches/alsa-resync1/alsa-kernel/core/init.c

    r34 r92  
    102102                write_unlock(&snd_card_rwlock);
    103103                if (idx >= snd_ecards_limit)
    104                         snd_printk("card %i is out of range (0-%i)\n", idx, snd_ecards_limit-1);
     104                        snd_printk(KERN_ERR "card %i is out of range (0-%i)\n", idx, snd_ecards_limit-1);
    105105                goto __error;
    106106        }
     
    277277#endif
    278278        if (snd_device_free_all(card, SNDRV_DEV_CMD_PRE) < 0) {
    279                 snd_printk("unable to free all devices (pre)\n");
     279                snd_printk(KERN_ERR "unable to free all devices (pre)\n");
    280280                /* Fatal, but this situation should never occur */
    281281        }
    282282        if (snd_device_free_all(card, SNDRV_DEV_CMD_NORMAL) < 0) {
    283                 snd_printk("unable to free all devices (normal)\n");
     283                snd_printk(KERN_ERR "unable to free all devices (normal)\n");
    284284                /* Fatal, but this situation should never occur */
    285285        }
    286286        if (snd_ctl_unregister(card) < 0) {
    287                 snd_printk("unable to unregister control minors\n");
     287                snd_printk(KERN_ERR "unable to unregister control minors\n");
    288288                /* Not fatal error */
    289289        }
    290290        if (snd_device_free_all(card, SNDRV_DEV_CMD_POST) < 0) {
    291                 snd_printk("unable to free all devices (post)\n");
     291                snd_printk(KERN_ERR "unable to free all devices (post)\n");
    292292                /* Fatal, but this situation should never occur */
    293293        }
  • GPL/branches/alsa-resync1/alsa-kernel/core/memory.c

    r73 r92  
    2121 */
    2222
     23#define __NO_VERSION__
    2324#include <sound/driver.h>
     25#include <asm/io.h>
     26#include <asm/uaccess.h>
     27#include <linux/init.h>
     28#include <linux/slab.h>
     29#include <linux/time.h>
     30#include <sound/core.h>
    2431#include <sound/info.h>
    2532#include <sound/memalloc.h>
     
    6168void snd_memory_done(void)
    6269{
    63     struct list_head *head;
    64     struct snd_alloc_track *t;
    65     if (snd_alloc_pages > 0)
    66         snd_printk("Not freed snd_alloc_pages = %li\n", snd_alloc_pages);
    67     if (snd_alloc_kmalloc > 0)
    68         snd_printk("Not freed snd_alloc_kmalloc = %li\n", snd_alloc_kmalloc);
    69     if (snd_alloc_vmalloc > 0)
    70         snd_printk("Not freed snd_alloc_vmalloc = %li\n", snd_alloc_vmalloc);
    71     list_for_each_prev(head, &snd_alloc_kmalloc_list) {
    72         t = list_entry(head, struct snd_alloc_track, list);
    73         if (t->magic != KMALLOC_MAGIC) {
    74             snd_printk("Corrupted kmalloc\n");
    75             break;
    76         }
    77         snd_printk("kmalloc(%ld) from %p not freed\n", (long) t->size, t->caller);
    78     }
    79     list_for_each_prev(head, &snd_alloc_vmalloc_list) {
    80         t = list_entry(head, struct snd_alloc_track, list);
    81         if (t->magic != VMALLOC_MAGIC) {
    82             snd_printk("Corrupted vmalloc\n");
    83             break;
    84         }
    85         snd_printk("vmalloc(%ld) from %p not freed\n", (long) t->size, t->caller);
    86     }
     70        struct list_head *head;
     71        struct snd_alloc_track *t;
     72        if (snd_alloc_pages > 0)
     73                snd_printk(KERN_ERR "Not freed snd_alloc_pages = %li\n", snd_alloc_pages);
     74        if (snd_alloc_kmalloc > 0)
     75                snd_printk(KERN_ERR "Not freed snd_alloc_kmalloc = %li\n", snd_alloc_kmalloc);
     76        if (snd_alloc_vmalloc > 0)
     77                snd_printk(KERN_ERR "Not freed snd_alloc_vmalloc = %li\n", snd_alloc_vmalloc);
     78        list_for_each_prev(head, &snd_alloc_kmalloc_list) {
     79                t = list_entry(head, struct snd_alloc_track, list);
     80                if (t->magic != KMALLOC_MAGIC) {
     81                        snd_printk(KERN_ERR "Corrupted kmalloc\n");
     82                        break;
     83                }
     84                snd_printk(KERN_ERR "kmalloc(%ld) from %p not freed\n", (long) t->size, t->caller);
     85        }
     86        list_for_each_prev(head, &snd_alloc_vmalloc_list) {
     87                t = list_entry(head, struct snd_alloc_track, list);
     88                if (t->magic != VMALLOC_MAGIC) {
     89                        snd_printk(KERN_ERR "Corrupted vmalloc\n");
     90                        break;
     91                }
     92                snd_printk(KERN_ERR "vmalloc(%ld) from %p not freed\n", (long) t->size, t->caller);
     93        }
    8794}
    8895
    8996void *__snd_kmalloc(size_t size, int flags, void *caller)
    9097{
    91     unsigned long cpu_flags;
    92     struct snd_alloc_track *t;
    93     void *ptr;
    94 
    95     ptr = snd_wrapper_kmalloc(size + sizeof(struct snd_alloc_track), flags);
    96     if (ptr != NULL) {
    97         t = (struct snd_alloc_track *)ptr;
    98         t->magic = KMALLOC_MAGIC;
    99         t->caller = caller;
    100         spin_lock_irqsave(&snd_alloc_kmalloc_lock, cpu_flags);
    101         list_add_tail(&t->list, &snd_alloc_kmalloc_list);
    102         spin_unlock_irqrestore(&snd_alloc_kmalloc_lock, cpu_flags);
    103         t->size = size;
    104         snd_alloc_kmalloc += size;
    105         ptr = t->data;
    106     }
    107     return ptr;
     98        unsigned long cpu_flags;
     99        struct snd_alloc_track *t;
     100        void *ptr;
     101       
     102        ptr = snd_wrapper_kmalloc(size + sizeof(struct snd_alloc_track), flags);
     103        if (ptr != NULL) {
     104                t = (struct snd_alloc_track *)ptr;
     105                t->magic = KMALLOC_MAGIC;
     106                t->caller = caller;
     107                spin_lock_irqsave(&snd_alloc_kmalloc_lock, cpu_flags);
     108                list_add_tail(&t->list, &snd_alloc_kmalloc_list);
     109                spin_unlock_irqrestore(&snd_alloc_kmalloc_lock, cpu_flags);
     110                t->size = size;
     111                snd_alloc_kmalloc += size;
     112                ptr = t->data;
     113        }
     114        return ptr;
    108115}
    109116
     
    111118void *snd_hidden_kmalloc(size_t size, int flags)
    112119{
    113     return _snd_kmalloc(size, flags);
     120        return _snd_kmalloc(size, flags);
    114121}
    115122
     
    127134void snd_hidden_kfree(const void *obj)
    128135{
    129     unsigned long flags;
    130     struct snd_alloc_track *t;
    131     if (obj == NULL) {
    132         snd_printk("null kfree (called from %p)\n", __builtin_return_address(0));
    133         return;
    134     }
    135     t = snd_alloc_track_entry(obj);
    136     if (t->magic != KMALLOC_MAGIC) {
    137         snd_printk("bad kfree (called from %p)\n", __builtin_return_address(0));
    138         return;
    139     }
    140     spin_lock_irqsave(&snd_alloc_kmalloc_lock, flags);
    141     list_del(&t->list);
    142     spin_unlock_irqrestore(&snd_alloc_kmalloc_lock, flags);
    143     t->magic = 0;
    144     snd_alloc_kmalloc -= t->size;
    145     obj = t;
    146     snd_wrapper_kfree(obj);
     136        unsigned long flags;
     137        struct snd_alloc_track *t;
     138        if (obj == NULL) {
     139                snd_printk(KERN_WARNING "null kfree (called from %p)\n", __builtin_return_address(0));
     140                return;
     141        }
     142        t = snd_alloc_track_entry(obj);
     143        if (t->magic != KMALLOC_MAGIC) {
     144                snd_printk(KERN_WARNING "bad kfree (called from %p)\n", __builtin_return_address(0));
     145                return;
     146        }
     147        spin_lock_irqsave(&snd_alloc_kmalloc_lock, flags);
     148        list_del(&t->list);
     149        spin_unlock_irqrestore(&snd_alloc_kmalloc_lock, flags);
     150        t->magic = 0;
     151        snd_alloc_kmalloc -= t->size;
     152        obj = t;
     153        snd_wrapper_kfree(obj);
    147154}
    148155
    149156void *snd_hidden_vmalloc(unsigned long size)
    150157{
    151     void *ptr;
    152     ptr = snd_wrapper_vmalloc(size + sizeof(struct snd_alloc_track));
    153     if (ptr) {
    154         struct snd_alloc_track *t = (struct snd_alloc_track *)ptr;
    155         t->magic = VMALLOC_MAGIC;
    156         t->caller = __builtin_return_address(0);
    157         spin_lock(&snd_alloc_vmalloc_lock);
    158         list_add_tail(&t->list, &snd_alloc_vmalloc_list);
    159         spin_unlock(&snd_alloc_vmalloc_lock);
    160         t->size = size;
    161         snd_alloc_vmalloc += size;
    162         ptr = t->data;
    163     }
    164     return ptr;
     158        void *ptr;
     159        ptr = snd_wrapper_vmalloc(size + sizeof(struct snd_alloc_track));
     160        if (ptr) {
     161                struct snd_alloc_track *t = (struct snd_alloc_track *)ptr;
     162                t->magic = VMALLOC_MAGIC;
     163                t->caller = __builtin_return_address(0);
     164                spin_lock(&snd_alloc_vmalloc_lock);
     165                list_add_tail(&t->list, &snd_alloc_vmalloc_list);
     166                spin_unlock(&snd_alloc_vmalloc_lock);
     167                t->size = size;
     168                snd_alloc_vmalloc += size;
     169                ptr = t->data;
     170        }
     171        return ptr;
    165172}
    166173
    167174void snd_hidden_vfree(void *obj)
    168175{
    169     struct snd_alloc_track *t;
    170     if (obj == NULL) {
    171         snd_printk("null vfree (called from %p)\n", __builtin_return_address(0));
    172         return;
    173     }
    174     t = snd_alloc_track_entry(obj);
    175     if (t->magic != VMALLOC_MAGIC) {
    176         snd_printk("bad vfree (called from %p)\n", __builtin_return_address(0));
    177         return;
    178     }
    179     spin_lock(&snd_alloc_vmalloc_lock);
    180     list_del(&t->list);
    181     spin_unlock(&snd_alloc_vmalloc_lock);
    182     t->magic = 0;
    183     snd_alloc_vmalloc -= t->size;
    184     obj = t;
    185     snd_wrapper_vfree(obj);
     176        struct snd_alloc_track *t;
     177        if (obj == NULL) {
     178                snd_printk(KERN_WARNING "null vfree (called from %p)\n", __builtin_return_address(0));
     179                return;
     180        }
     181        t = snd_alloc_track_entry(obj);
     182        if (t->magic != VMALLOC_MAGIC) {
     183                snd_printk(KERN_ERR "bad vfree (called from %p)\n", __builtin_return_address(0));
     184                return;
     185        }
     186        spin_lock(&snd_alloc_vmalloc_lock);
     187        list_del(&t->list);
     188        spin_unlock(&snd_alloc_vmalloc_lock);
     189        t->magic = 0;
     190        snd_alloc_vmalloc -= t->size;
     191        obj = t;
     192        snd_wrapper_vfree(obj);
    186193}
    187194
    188195static void snd_memory_info_read(snd_info_entry_t *entry, snd_info_buffer_t * buffer)
    189196{
    190     long pages = snd_alloc_pages >> (PAGE_SHIFT-12);
    191     snd_iprintf(buffer, "pages  : %li bytes (%li pages per %likB)\n", pages * PAGE_SIZE, pages, PAGE_SIZE / 1024);
    192     snd_iprintf(buffer, "kmalloc: %li bytes\n", snd_alloc_kmalloc);
    193     snd_iprintf(buffer, "vmalloc: %li bytes\n", snd_alloc_vmalloc);
     197        long pages = snd_alloc_pages >> (PAGE_SHIFT-12);
     198        snd_iprintf(buffer, "pages  : %li bytes (%li pages per %likB)\n", pages * PAGE_SIZE, pages, PAGE_SIZE / 1024);
     199        snd_iprintf(buffer, "kmalloc: %li bytes\n", snd_alloc_kmalloc);
     200        snd_iprintf(buffer, "vmalloc: %li bytes\n", snd_alloc_vmalloc);
    194201}
    195202
    196203int __init snd_memory_info_init(void)
    197204{
    198     snd_info_entry_t *entry;
    199 
    200     entry = snd_info_create_module_entry(THIS_MODULE, "meminfo", NULL);
    201     if (entry) {
    202         entry->content = SNDRV_INFO_CONTENT_TEXT;
    203         entry->c.text.read_size = 256;
    204         entry->c.text.read = snd_memory_info_read;
    205         if (snd_info_register(entry) < 0) {
    206             snd_info_free_entry(entry);
    207             entry = NULL;
    208         }
    209     }
    210     snd_memory_info_entry = entry;
    211     return 0;
     205        snd_info_entry_t *entry;
     206
     207        entry = snd_info_create_module_entry(THIS_MODULE, "meminfo", NULL);
     208        if (entry) {
     209                entry->content = SNDRV_INFO_CONTENT_TEXT;
     210                entry->c.text.read_size = 256;
     211                entry->c.text.read = snd_memory_info_read;
     212                if (snd_info_register(entry) < 0) {
     213                        snd_info_free_entry(entry);
     214                        entry = NULL;
     215                }
     216        }
     217        snd_memory_info_entry = entry;
     218        return 0;
    212219}
    213220
    214221int __exit snd_memory_info_done(void)
    215222{
    216     if (snd_memory_info_entry)
    217         snd_info_unregister(snd_memory_info_entry);
    218     return 0;
     223        if (snd_memory_info_entry)
     224                snd_info_unregister(snd_memory_info_entry);
     225        return 0;
    219226}
    220227#else
  • GPL/branches/alsa-resync1/alsa-kernel/core/misc.c

    r86 r92  
    2121
    2222#include <sound/driver.h>
    23 #include <sound/firmware.h>
     23#include <linux/firmware.h>
    2424int snd_task_name(struct task_struct *task, char *name, size_t size)
    2525{
     
    541541}
    542542
     543#if 0
    543544void flush_workqueue(struct workqueue_struct *wq)
    544545{
     
    561562        }
    562563}
     564#endif
    563565
    564566void destroy_workqueue(struct workqueue_struct *wq)
    565567{
     568#if 0
    566569    flush_workqueue(wq);
    567 #if 0
    568570        kill_proc(wq->task_pid, SIGKILL, 1);
    569571        if (wq->task_pid >= 0)
     
    686688}
    687689
    688 int request_firmware(const struct firmware **fw, const char *name)
     690int request_firmware(const struct firmware **fw, const char *name,
     691                     struct device *device)
    689692{
    690693        struct firmware *firmware;
  • GPL/branches/alsa-resync1/alsa-kernel/core/pcm.c

    r34 r92  
    2121
    2222#include <sound/driver.h>
     23#include <linux/init.h>
     24#include <linux/slab.h>
     25#include <linux/time.h>
     26#include <sound/core.h>
    2327#include <sound/minors.h>
    2428#include <sound/pcm.h>
     
    564568int snd_pcm_new_stream(snd_pcm_t *pcm, int stream, int substream_count)
    565569{
    566     int idx, err;
     570        int idx, err;
    567571    snd_pcm_str_t *pstr = &pcm->streams[stream];
    568572    struct snd_pcm_substream *substream, *prev;
    569573
    570574#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
    571     init_MUTEX(&pstr->oss.setup_mutex);
     575        init_MUTEX(&pstr->oss.setup_mutex);
    572576#endif
    573     pstr->stream = stream;
    574     pstr->pcm = pcm;
    575     pstr->substream_count = substream_count;
    576     pstr->reg = &snd_pcm_reg[stream];
    577     if (substream_count > 0) {
    578         err = snd_pcm_stream_proc_init(pstr);
    579         if (err < 0)
    580             return err;
    581     }
    582     prev = NULL;
    583     for (idx = 0, prev = NULL; idx < substream_count; idx++) {
    584         substream = (struct snd_pcm_substream *)kzalloc(sizeof(*substream), GFP_KERNEL);
    585         if (substream == NULL)
    586             return -ENOMEM;
    587         substream->pcm = pcm;
    588         substream->pstr = pstr;
    589         substream->number = idx;
    590         substream->stream = stream;
    591         sprintf(substream->name, "subdevice #%i", idx);
    592         substream->buffer_bytes_max = UINT_MAX;
    593         if (prev == NULL)
    594             pstr->substream = substream;
    595         else
    596             prev->next = substream;
    597         err = snd_pcm_substream_proc_init(substream);
    598         if (err < 0) {
    599             kfree(substream);
    600             return err;
    601         }
    602         substream->group = &substream->self_group;
    603         spin_lock_init(&substream->self_group.lock);
    604         INIT_LIST_HEAD(&substream->self_group.substreams);
    605         list_add_tail(&substream->link_list, &substream->self_group.substreams);
    606         spin_lock_init(&substream->timer_lock);
    607         prev = substream;
    608     }
    609     return 0;
    610 }
     577        pstr->stream = stream;
     578        pstr->pcm = pcm;
     579        pstr->substream_count = substream_count;
     580        pstr->reg = &snd_pcm_reg[stream];
     581        if (substream_count > 0) {
     582                err = snd_pcm_stream_proc_init(pstr);
     583                if (err < 0)
     584                        return err;
     585        }
     586        prev = NULL;
     587        for (idx = 0, prev = NULL; idx < substream_count; idx++) {
     588                substream = (struct snd_pcm_substream *)kzalloc(sizeof(*substream), GFP_KERNEL);
     589                if (substream == NULL)
     590                        return -ENOMEM;
     591                substream->pcm = pcm;
     592                substream->pstr = pstr;
     593                substream->number = idx;
     594                substream->stream = stream;
     595                sprintf(substream->name, "subdevice #%i", idx);
     596                substream->buffer_bytes_max = UINT_MAX;
     597                if (prev == NULL)
     598                        pstr->substream = substream;
     599                else
     600                        prev->next = substream;
     601                err = snd_pcm_substream_proc_init(substream);
     602                if (err < 0) {
     603                        kfree(substream);
     604                        return err;
     605                }
     606                substream->group = &substream->self_group;
     607                spin_lock_init(&substream->self_group.lock);
     608                INIT_LIST_HEAD(&substream->self_group.substreams);
     609                list_add_tail(&substream->link_list, &substream->self_group.substreams);
     610                spin_lock_init(&substream->timer_lock);
     611                prev = substream;
     612        }
     613        return 0;
     614}                               
    611615
    612616/**
     
    627631 */
    628632int snd_pcm_new(snd_card_t * card, char *id, int device,
    629                 int playback_count, int capture_count,
    630                 snd_pcm_t ** rpcm)
    631 {
    632     snd_pcm_t *pcm;
    633     int err;
    634     static snd_device_ops_t ops = {
    635         snd_pcm_dev_free,
    636         snd_pcm_dev_register,
    637         snd_pcm_dev_disconnect,
    638         snd_pcm_dev_unregister
    639     };
    640 
    641     snd_assert(rpcm != NULL, return -EINVAL);
    642     *rpcm = NULL;
    643     snd_assert(card != NULL, return -ENXIO);
    644     pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
    645     if (pcm == NULL)
    646         return -ENOMEM;
    647     pcm->card = card;
    648     pcm->device = device;
    649     if (id) {
    650         strlcpy(pcm->id, id, sizeof(pcm->id));
    651     }
    652     if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK, playback_count)) < 0) {
    653         snd_pcm_free(pcm);
    654         return err;
    655     }
    656     if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, capture_count)) < 0) {
    657         snd_pcm_free(pcm);
     633                int playback_count, int capture_count,
     634                snd_pcm_t ** rpcm)
     635{
     636        snd_pcm_t *pcm;
     637        int err;
     638        static snd_device_ops_t ops = {
     639                snd_pcm_dev_free,
     640                snd_pcm_dev_register,
     641                snd_pcm_dev_disconnect,
     642                snd_pcm_dev_unregister
     643        };
     644
     645        snd_assert(rpcm != NULL, return -EINVAL);
     646        *rpcm = NULL;
     647        snd_assert(card != NULL, return -ENXIO);
     648        pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
     649        if (pcm == NULL)
     650                return -ENOMEM;
     651        pcm->card = card;
     652        pcm->device = device;
     653        if (id) {
     654                strlcpy(pcm->id, id, sizeof(pcm->id));
     655        }
     656        if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK, playback_count)) < 0) {
     657                snd_pcm_free(pcm);
     658                return err;
     659        }
     660        if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, capture_count)) < 0) {
     661                snd_pcm_free(pcm);
    658662        return err;
    659663    }
  • GPL/branches/alsa-resync1/alsa-kernel/core/rawmidi.c

    r34 r92  
    2020 */
    2121
    22 #define SNDRV_MAIN_OBJECT_FILE
    2322#include <sound/driver.h>
     23#include <sound/core.h>
     24#include <linux/major.h>
     25#include <linux/init.h>
     26#include <linux/sched.h>
     27#include <linux/slab.h>
     28#include <linux/time.h>
     29#include <linux/wait.h>
    2430#include <sound/rawmidi.h>
    2531#include <sound/info.h>
     
    346352static int snd_rawmidi_open(struct inode *inode, struct file *file)
    347353{
    348     int major = MAJOR(inode->i_rdev);
     354        int maj = major(inode->i_rdev);
    349355    int cardnum;
    350356    snd_card_t *card;
     
    359365
    360366    printk("rawmidi open\n");
    361     switch (major) {
     367    switch (maj) {
    362368    case CONFIG_SND_MAJOR:
    363369        cardnum = SNDRV_MINOR_CARD(MINOR(inode->i_rdev));
     
    382388        return -ENODEV;
    383389#ifdef CONFIG_SND_OSSEMUL
    384     if (major == SOUND_MAJOR && !rmidi->ossreg)
     390        if (maj == SOUND_MAJOR && !rmidi->ossreg)
    385391        return -ENXIO;
    386392#endif
     
    392398        return -ENODEV;
    393399    fflags = snd_rawmidi_file_flags(file);
    394     if ((file->f_flags & O_APPEND) || major != CONFIG_SND_MAJOR) /* OSS emul? */
     400        if ((file->f_flags & O_APPEND) || maj != CONFIG_SND_MAJOR) /* OSS emul? */
    395401        fflags |= SNDRV_RAWMIDI_LFLG_APPEND;
    396402    fflags |= SNDRV_RAWMIDI_LFLG_NOOPENLOCK;
     
    781787#ifdef CONFIG_SND_DEBUG
    782788    default:
    783         snd_printk("rawmidi: unknown command = 0x%x\n", cmd);
     789                snd_printk(KERN_WARNING "rawmidi: unknown command = 0x%x\n", cmd);
    784790#endif
    785791    }
     
    14541460}
    14551461
    1456 #ifdef CONFIG_SND_SEQUENCER
     1462#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
    14571463static void snd_rawmidi_dev_seq_free(snd_seq_device_t *device)
    14581464{
     
    14821488                                   rmidi->card, rmidi->device,
    14831489                                   &snd_rawmidi_reg, name)) < 0) {
    1484         snd_printk("unable to register rawmidi device %i:%i\n", rmidi->card->number, rmidi->device);
     1490                snd_printk(KERN_ERR "unable to register rawmidi device %i:%i\n", rmidi->card->number, rmidi->device);
    14851491        snd_rawmidi_devices[idx] = NULL;
    14861492        up(&register_mutex);
     
    14991505        if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIDI,
    15001506                                    rmidi->card, 0, &snd_rawmidi_reg, name) < 0) {
    1501             snd_printk("unable to register OSS rawmidi device %i:%i\n", rmidi->card->number, 0);
     1507                        snd_printk(KERN_ERR "unable to register OSS rawmidi device %i:%i\n", rmidi->card->number, 0);
    15021508        } else {
    15031509            rmidi->ossreg++;
     
    15101516        if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIDI,
    15111517                                    rmidi->card, 1, &snd_rawmidi_reg, name) < 0) {
    1512             snd_printk("unable to register OSS rawmidi device %i:%i\n", rmidi->card->number, 1);
     1518                        snd_printk(KERN_ERR "unable to register OSS rawmidi device %i:%i\n", rmidi->card->number, 1);
    15131519        } else {
    15141520            rmidi->ossreg++;
     
    15291535    }
    15301536    rmidi->proc_entry = entry;
    1531 #ifdef CONFIG_SND_SEQUENCER
     1537#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
    15321538    if (!rmidi->ops || !rmidi->ops->dev_register) { /* own registration mechanism */
    15331539        if (snd_seq_device_new(rmidi->card, rmidi->device, SNDRV_SEQ_DEV_ID_MIDISYNTH, 0, &rmidi->seq_dev) >= 0) {
     
    15841590    snd_unregister_device(SNDRV_DEVICE_TYPE_RAWMIDI, rmidi->card, rmidi->device);
    15851591    up(&register_mutex);
    1586 #ifdef CONFIG_SND_SEQUENCER
     1592#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
    15871593    if (rmidi->seq_dev) {
    15881594        snd_device_free(rmidi->card, rmidi->seq_dev);
     
    16231629    { int i;
    16241630        /* check device map table */
    1625         for (i = 0; i < SNDRV_CARDS; i++) {
    1626             if (midi_map[i] < 0 || midi_map[i] >= SNDRV_RAWMIDI_DEVICES) {
    1627                 snd_printk(KERN_ERR "invalid midi_map[%d] = %d\n", i, midi_map[i]);
    1628                 midi_map[i] = 0;
    1629             }
    1630             if (amidi_map[i] < 0 || amidi_map[i] >= SNDRV_RAWMIDI_DEVICES) {
    1631                 snd_printk(KERN_ERR "invalid amidi_map[%d] = %d\n", i, amidi_map[i]);
    1632                 amidi_map[i] = 1;
    1633             }
     1631                for (i = 0; i < SNDRV_CARDS; i++) {
     1632                        if (midi_map[i] < 0 || midi_map[i] >= SNDRV_RAWMIDI_DEVICES) {
     1633                                snd_printk(KERN_ERR "invalid midi_map[%d] = %d\n", i, midi_map[i]);
     1634                                midi_map[i] = 0;
     1635                        }
     1636                        if (amidi_map[i] < 0 || amidi_map[i] >= SNDRV_RAWMIDI_DEVICES) {
     1637                                snd_printk(KERN_ERR "invalid amidi_map[%d] = %d\n", i, amidi_map[i]);
     1638                                amidi_map[i] = 1;
     1639                        }
    16341640        }
    16351641    }
  • GPL/branches/alsa-resync1/alsa-kernel/core/rtctimer.c

    r32 r92  
    1717 *   You should have received a copy of the GNU General Public License
    1818 *   along with this program; if not, write to the Free Software
    19  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     19 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    2020 *
    2121 *
     
    2929 */
    3030
    31 #define SNDRV_MAIN_OBJECT_FILE
    3231#include <sound/driver.h>
     32#include <linux/init.h>
     33#include <linux/time.h>
     34#include <sound/core.h>
    3335#include <sound/timer.h>
    3436#include <sound/info.h>
     
    124126
    125127#ifdef USE_TASKLET
    126 static void rtctimer_interrupt2(void *private_data)
    127 {
    128         snd_timer_t *timer = private_data;
     128static void rtctimer_interrupt2(unsigned long private_data)
     129{
     130        snd_timer_t *timer = (snd_timer_t *)private_data;
    129131        snd_assert(timer != NULL, return);
    130132        do {
     
    151153
    152154        if (rtctimer_freq < 2 || rtctimer_freq > 8192) {
    153                 snd_printk("rtctimer: invalid frequency %d\n", rtctimer_freq);
     155                snd_printk(KERN_ERR "rtctimer: invalid frequency %d\n", rtctimer_freq);
    154156                return -EINVAL;
    155157        }
     
    157159                ;
    158160        if (rtctimer_freq != order) {
    159                 snd_printk("rtctimer: invalid frequency %d\n", rtctimer_freq);
     161                snd_printk(KERN_ERR "rtctimer: invalid frequency %d\n", rtctimer_freq);
    160162                return -EINVAL;
    161163        }
     
    167169
    168170#ifdef USE_TASKLET
    169         tasklet_init(&rtc_tq, rtctimer_interrupt2, timer);
     171        tasklet_init(&rtc_tq, rtctimer_interrupt2, (unsigned long)timer);
    170172#endif /* USE_TASKLET */
    171173
     
    213215MODULE_PARM_DESC(rtctimer_freq, "timer frequency in Hz");
    214216
     217MODULE_LICENSE("GPL");
     218
     219EXPORT_NO_SYMBOLS;
     220
    215221#endif /* CONFIG_RTC || CONFIG_RTC_MODULE */
  • GPL/branches/alsa-resync1/alsa-kernel/core/timer.c

    r34 r92  
    18731873    snd_timer_proc_entry = entry;
    18741874    if ((err = snd_timer_register_system()) < 0)
    1875         snd_printk("unable to register system timer (%i)\n", err);
     1875                snd_printk(KERN_ERR "unable to register system timer (%i)\n", err);
    18761876    if ((err = snd_register_device(SNDRV_DEVICE_TYPE_TIMER,
    18771877                                   NULL, 0, &snd_timer_reg, "timer"))<0)
    1878         snd_printk("unable to register timer device (%i)\n", err);
     1878                snd_printk(KERN_ERR "unable to register timer device (%i)\n", err);
    18791879    return 0;
    18801880}
  • GPL/branches/alsa-resync1/alsa-kernel/drivers/dummy.c

    r32 r92  
    1515 *   You should have received a copy of the GNU General Public License
    1616 *   along with this program; if not, write to the Free Software
    17  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     17 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    1818 *
    1919 */
    2020
    21 #define SNDRV_MAIN_OBJECT_FILE
    2221#include <sound/driver.h>
     22#include <linux/init.h>
     23#include <linux/sched.h>
     24#include <linux/slab.h>
     25#include <linux/time.h>
     26#include <linux/wait.h>
     27#include <sound/core.h>
    2328#include <sound/control.h>
    2429#include <sound/pcm.h>
     
    2631#define SNDRV_GET_ID
    2732#include <sound/initval.h>
     33
     34EXPORT_NO_SYMBOLS;
    2835
    2936MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
     
    609616        if (snd_card_dummy_probe(dev) < 0) {
    610617#ifdef MODULE
    611             snd_printk("Dummy soundcard #%i not found or device busy\n", dev + 1);
     618                        printk(KERN_ERR "Dummy soundcard #%i not found or device busy\n", dev + 1);
    612619#endif
    613620            break;
     
    617624    if (!cards) {
    618625#ifdef MODULE
    619         snd_printk("Dummy soundcard not found or device busy\n");
     626                printk(KERN_ERR "Dummy soundcard not found or device busy\n");
    620627#endif
    621628        return -ENODEV;
     
    637644#ifndef MODULE
    638645
    639 /* format is: snd-card-dummy=snd_enable,snd_index,snd_id,
     646/* format is: snd-dummy=snd_enable,snd_index,snd_id,
    640647 snd_pcm_devs,snd_pcm_substreams */
    641648
  • GPL/branches/alsa-resync1/alsa-kernel/drivers/mpu401/mpu401.c

    r32 r92  
    2020 */
    2121
    22 #define SNDRV_MAIN_OBJECT_FILE
    2322#include <sound/driver.h>
     23#include <linux/init.h>
     24#include <linux/wait.h>
     25#include <linux/sched.h>
     26#include <linux/slab.h>
     27#include <sound/core.h>
    2428#include <sound/mpu401.h>
    2529#define SNDRV_GET_ID
    2630#include <sound/initval.h>
     31#include <linux/delay.h>
     32
     33EXPORT_NO_SYMBOLS;
    2734
    2835MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
     
    119126        if (!cards) {
    120127#ifdef MODULE
    121                 snd_printk("MPU-401 device not found or device busy\n");
     128                printk(KERN_ERR "MPU-401 device not found or device busy\n");
    122129#endif
    123130                return -ENODEV;
     
    139146#ifndef MODULE
    140147
    141 /* format is: snd-mpu401=enable,index,id,port,irq */
     148/* format is: snd-mpu401=snd_enable,snd_index,snd_id,snd_port,snd_irq */
    142149
    143150static int __init alsa_card_mpu401_setup(char *str)
  • GPL/branches/alsa-resync1/alsa-kernel/drivers/mtpav.c

    r32 r92  
    1717 *      You should have received a copy of the GNU General Public License
    1818 *      along with this program; if not, write to the Free Software
    19  *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     19 *      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    2020 *
    2121 *
     
    5151 */
    5252
    53 #define SNDRV_MAIN_OBJECT_FILE
    5453#include <sound/driver.h>
     54#include <asm/io.h>
     55#include <linux/init.h>
     56#include <linux/slab.h>
     57#include <sound/core.h>
    5558#define SNDRV_GET_ID
    5659#include <sound/initval.h>
    5760#include <sound/rawmidi.h>
     61#include <linux/delay.h>
    5862
    5963/*
     
    6165 */
    6266EXPORT_NO_SYMBOLS;
     67
     68MODULE_AUTHOR("Michael T. Mayers");
    6369MODULE_DESCRIPTION("MOTU MidiTimePiece AV multiport MIDI");
     70MODULE_LICENSE("GPL");
    6471MODULE_CLASSES("{sound}");
    6572MODULE_DEVICES("{{MOTU,MidiTimePiece AV multiport MIDI}}");
     
    8491MODULE_PARM(snd_port, "l");
    8592MODULE_PARM_DESC(snd_port, "Parallel port # for MotuMTPAV MIDI.");
    86 MODULE_PARM_SYNTAX(snd_port, "allows:{{0x378},{0x278}},dialog:list");
     93MODULE_PARM_SYNTAX(snd_port, SNDRV_ENABLED ",allows:{{0x378},{0x278}},dialog:list");
    8794MODULE_PARM(snd_irq, "i");
    8895MODULE_PARM_DESC(snd_irq, "Parallel IRQ # for MotuMTPAV MIDI.");
    89 MODULE_PARM_SYNTAX(snd_irq,  "allows:{{7},{5}},dialog:list");
     96MODULE_PARM_SYNTAX(snd_irq,  SNDRV_ENABLED ",allows:{{7},{5}},dialog:list");
    9097MODULE_PARM(snd_hwports, "i");
    9198MODULE_PARM_DESC(snd_hwports, "Hardware ports # for MotuMTPAV MIDI.");
    92 MODULE_PARM_SYNTAX(snd_hwports, "allows:{{1,8}},dialog:list");
     99MODULE_PARM_SYNTAX(snd_hwports, SNDRV_ENABLED ",allows:{{1,8}},dialog:list");
    93100
    94101/*
     
    721728        if (crd->irq >= 0)
    722729                free_irq(crd->irq, (void *)crd);
    723         if (crd->res_port)
     730        if (crd->res_port) {
    724731                release_resource(crd->res_port);
     732                kfree_nocheck(crd->res_port);
     733        }
    725734        if (crd != NULL)
    726735                kfree(crd);
     
    769778        snd_mtpav_portscan(mtp_card);
    770779
    771         snd_printk("Motu MidiTimePiece on parallel port irq: %d ioport: 0x%lx\n", snd_irq, snd_port);
     780        printk(KERN_INFO "Motu MidiTimePiece on parallel port irq: %d ioport: 0x%lx\n", snd_irq, snd_port);
    772781
    773782        return 0;
     
    799808#ifndef MODULE
    800809
    801 /* format is: snd-card-mtpav=snd_enable,snd_index,snd_id,
     810/* format is: snd-mtpav=snd_enable,snd_index,snd_id,
    802811                             snd_port,snd_irq,snd_hwports */
    803812
     
    815824}
    816825
    817 __setup("snd-card-mtpav=", alsa_card_mtpav_setup);
     826__setup("snd-mtpav=", alsa_card_mtpav_setup);
    818827
    819828#endif /* ifndef MODULE */
  • GPL/branches/alsa-resync1/alsa-kernel/drivers/serial-u16550.c

    r34 r92  
    88 *   This code is based on the code from ALSA 0.5.9, but heavily rewritten.
    99 *
    10  * Sat Mar 31 17:27:57 PST 2001 tim.mann@compaq.com
     10 * Sat Mar 31 17:27:57 PST 2001 tim.mann@compaq.com 
    1111 *      Added support for the Midiator MS-124T and for the MS-124W in
    1212 *      Single Addressed (S/A) or Multiple Burst (M/B) mode, with
    1313 *      power derived either parasitically from the serial port or
    1414 *      from a separate power supply.
    15  *
     15 * 
    1616 *      The new snd_adaptor module parameter allows you to select
    1717 *      either the default Roland Soundcanvas support (0), which was
     
    2121 *      Midiator MS-124W, you must set the physical M-S and A-B
    2222 *      switches on the Midiator to match the driver mode you select.
    23  *
     23 * 
    2424 *      - In Roland Soundcanvas mode, multiple ALSA raw MIDI
    2525 *      substreams are supported (midiCnD0-midiCnD15).  Whenever you
     
    9999 *   You should have received a copy of the GNU General Public License
    100100 *   along with this program; if not, write to the Free Software
    101  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     101 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    102102 *
    103103 */
    104104
    105 
    106 #define SNDRV_MAIN_OBJECT_FILE
    107 
    108105#include <sound/driver.h>
     106#include <asm/io.h>
     107#include <linux/init.h>
     108#include <linux/slab.h>
     109#include <sound/core.h>
    109110#include <sound/rawmidi.h>
    110111#define SNDRV_GET_ID
     
    115116EXPORT_NO_SYMBOLS;
    116117MODULE_DESCRIPTION("MIDI serial");
     118MODULE_LICENSE("GPL");
    117119MODULE_CLASSES("{sound}");
    118120MODULE_DEVICES("{{ALSA, MIDI serial}}");
     
    769771    if (uart->irq >= 0)
    770772        free_irq(uart->irq, (void *)uart);
    771     if (uart->res_base)
     773        if (uart->res_base) {
    772774        release_resource(uart->res_base);
    773     kfree(uart);
     775                kfree_nocheck(uart->res_base);
     776        }
     777        snd_magic_kfree(uart);
    774778    return 0;
    775779};
     
    918922    if ((err = snd_uart16550_detect(snd_port[dev])) <= 0) {
    919923        snd_card_free(card);
    920         snd_printk("no UART detected at 0x%lx\n", (long)snd_port[dev]);
     924                printk(KERN_ERR "no UART detected at 0x%lx\n", (long)snd_port[dev]);
    921925        return err;
    922926    }
     
    967971    if (cards == 0) {
    968972#ifdef MODULE
    969         snd_printk("serial midi soundcard not found or device busy\n");
     973                printk(KERN_ERR "serial midi soundcard not found or device busy\n");
    970974#endif
    971975        return -ENODEV;
     
    989993#ifndef MODULE
    990994
    991 /* format is: snd-card-serial=snd_enable,snd_index,snd_id,
     995/* format is: snd-serial=snd_enable,snd_index,snd_id,
    992996 snd_port,snd_irq,snd_speed,snd_base,snd_outs */
    993997
     
    10111015}
    10121016
    1013 __setup("snd-card-serial=", alsa_card_serial_setup);
     1017__setup("snd-serial=", alsa_card_serial_setup);
    10141018
    10151019#endif /* ifndef MODULE */
  • GPL/branches/alsa-resync1/alsa-kernel/drivers/virmidi.c

    r32 r92  
    1616 *   You should have received a copy of the GNU General Public License
    1717 *   along with this program; if not, write to the Free Software
    18  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     18 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    1919 *
    2020 */
     
    3030 *
    3131 * Typical usage is like following:
    32  * - Load snd-card-virmidi module.
    33  *      # modprobe snd-card-virmidi snd_index=2
     32 * - Load snd-virmidi module.
     33 *      # modprobe snd-virmidi snd_index=2
    3434 *   Then, sequencer clients 72:0 to 75:0 will be created, which are
    3535 *   mapped from /dev/snd/midiC1D0 to /dev/snd/midiC1D3, respectively.
     
    4242 */
    4343
    44 #define SNDRV_MAIN_OBJECT_FILE
    4544#include <sound/driver.h>
     45#include <linux/init.h>
     46#include <linux/wait.h>
     47#include <linux/sched.h>
     48#include <sound/core.h>
    4649#include <sound/seq_kernel.h>
    4750#include <sound/seq_virmidi.h>
     
    5053
    5154EXPORT_NO_SYMBOLS;
     55
     56MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>");
    5257MODULE_DESCRIPTION("Dummy soundcard for virtual rawmidi devices");
     58MODULE_LICENSE("GPL");
    5359MODULE_CLASSES("{sound}");
    5460MODULE_DEVICES("{{ALSA,Virtual rawmidi device}}");
     
    136142        if (snd_card_virmidi_probe(dev) < 0) {
    137143#ifdef MODULE
    138             snd_printk("Card-VirMIDI #%i not found or device busy\n", dev + 1);
     144                        printk(KERN_ERR "Card-VirMIDI #%i not found or device busy\n", dev + 1);
    139145#endif
    140146            break;
     
    144150    if (!cards) {
    145151#ifdef MODULE
    146         snd_printk("Card-VirMIDI soundcard not found or device busy\n");
     152                printk(KERN_ERR "Card-VirMIDI soundcard not found or device busy\n");
    147153#endif
    148154        return -ENODEV;
     
    164170#ifndef MODULE
    165171
    166 /* format is: snd-card-virmidi=snd_enable,snd_index,snd_id,snd_midi_devs */
     172/* format is: snd-virmidi=snd_enable,snd_index,snd_id,snd_midi_devs */
    167173
    168174static int __init alsa_card_virmidi_setup(char *str)
     
    180186}
    181187
    182 __setup("snd-card-virmidi=", alsa_card_virmidi_setup);
     188__setup("snd-virmidi=", alsa_card_virmidi_setup);
    183189
    184190#endif /* ifndef MODULE */
  • GPL/branches/alsa-resync1/alsa-kernel/include/sound/driver.h

    r86 r92  
    106106#include <linux/kernel.h>
    107107#include <linux/sched.h>
     108#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 7)
    108109#include <linux/malloc.h>
     110#else
     111#include <linux/slab.h>
     112#endif
    109113#include <linux/delay.h>
     114#include <linux/bitops.h>
    110115
    111116#include <linux/ioport.h>
     
    136141#endif
    137142#include "compat_22.h"
    138 #endif
     143#endif /* LINUX_2_2 */
     144
    139145#ifdef LINUX_2_3
    140146#include <linux/init.h>
     
    166172#define pci_alloc_consistent snd_pci_hack_alloc_consistent
    167173#endif /* i386 or ppc */
     174#ifndef list_for_each_safe
     175#define list_for_each_safe(pos, n, head) \
     176        for (pos = (head)->next, n = pos->next; pos != (head); pos = n, n = pos->next)
     177#endif
    168178#endif
    169179
     
    180190#endif
    181191
     192#ifndef MODULE_LICENSE
     193#define MODULE_LICENSE(license)
    182194#ifndef PCI_D0
    183195#define PCI_D0     0
     
    227239#define schedule_work(w) snd_compat_schedule_work(w)
    228240
    229 /* Name change */
     241/* Typedef's */
    230242typedef struct timeval snd_timestamp_t;
    231243#ifndef TARGET_OS2
  • GPL/branches/alsa-resync1/alsa-kernel/include/sound/initval.h

    r32 r92  
    1 #ifndef __INITVAL_H
    2 #define __INITVAL_H
     1#ifndef __SOUND_INITVAL_H
     2#define __SOUND_INITVAL_H
    33
    44/*
     
    1818 *   You should have received a copy of the GNU General Public License
    1919 *   along with this program; if not, write to the Free Software
    20  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     20 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    2121 *
    2222 */
     
    7373#define SNDRV_DEFAULT_ENABLE    { 1,1,1,1,1,1,1,1 }
    7474#define SNDRV_DEFAULT_ENABLE_PNP        SNDRV_DEFAULT_ENABLE
     75#define SNDRV_DEFAULT_ENABLE_ISAPNP SNDRV_DEFAULT_ENABLE_PNP
    7576#define SNDRV_DEFAULT_PORT      { REPEAT_SNDRV(-1) }
    7677#define SNDRV_DEFAULT_IRQ       { REPEAT_SNDRV(SNDRV_AUTO_IRQ) }
     
    8586#define SNDRV_DEFAULT_STR       { [0 ... (SNDRV_CARDS-1)] = NULL }
    8687#define SNDRV_DEFAULT_ENABLE    { 1, [1 ... (SNDRV_CARDS-1)] = 0 }
     88#define SNDRV_DEFAULT_ENABLE_PNP { [0 ... (SNDRV_CARDS-1)] = 1 }
     89#ifdef __ISAPNP__
     90#define SNDRV_DEFAULT_ENABLE_ISAPNP SNDRV_DEFAULT_ENABLE_PNP
     91#else
     92#define SNDRV_DEFAULT_ENABLE_ISAPNP SNDRV_DEFAULT_ENABLE
     93#endif
    8794#define SNDRV_DEFAULT_PORT      { SNDRV_AUTO_PORT, [1 ... (SNDRV_CARDS-1)] = -1 }
    8895#define SNDRV_DEFAULT_IRQ       { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_IRQ }
     
    196203#endif
    197204
    198 #endif                          /* __INITVAL_H */
     205#endif /* __SOUND_INITVAL_H */
  • GPL/branches/alsa-resync1/alsa-kernel/include/sound/pcm_params.h

    r32 r92  
    1 #ifndef __PCM_PARAMS_H
    2 #define __PCM_PARAMS_H
     1#ifndef __SOUND_PCM_PARAMS_H
     2#define __SOUND_PCM_PARAMS_H
    33
    44/*
     
    1919 *   You should have received a copy of the GNU General Public License
    2020 *   along with this program; if not, write to the Free Software
    21  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     21 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    2222 *
    2323 */
     
    363363#undef assert
    364364
    365 #endif
     365#endif /* __SOUND_PCM_PARAMS_H */
     366
  • GPL/branches/alsa-resync1/alsa-kernel/include/sound/version.h

    r32 r92  
    22 *  Configuration header file for compilation of the ALSA driver
    33 */
     4#define CONFIG_SND_DATE "04-29-2007"
    45
    56#ifndef __ALSA_VERSION_H__
  • GPL/branches/alsa-resync1/alsa-kernel/isa/ad1816a/ad1816a.c

    r32 r92  
    1616    You should have received a copy of the GNU General Public License
    1717    along with this program; if not, write to the Free Software
    18     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     18    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    1919*/
    2020
    21 #define SNDRV_MAIN_OBJECT_FILE
    2221#include <sound/driver.h>
     22#include <linux/init.h>
     23#include <linux/time.h>
     24#include <linux/wait.h>
     25#ifndef LINUX_ISAPNP_H
     26#include <linux/isapnp.h>
     27#define isapnp_card pci_bus
     28#define isapnp_dev pci_dev
     29#endif
     30#include <sound/core.h>
    2331#define SNDRV_GET_ID
    2432#include <sound/initval.h>
     
    2937#define chip_t ad1816a_t
    3038
     39#define PFX "ad1816a: "
     40
    3141EXPORT_NO_SYMBOLS;
     42MODULE_AUTHOR("Massimo Piccioni <dafastidio@libero.it>");
    3243MODULE_DESCRIPTION("AD1816A, AD1815");
     44MODULE_LICENSE("GPL");
    3345MODULE_CLASSES("{sound}");
    3446MODULE_DEVICES("{{Highscreen,Sound-Boostar 16 3D},"
     
    3648                "{Analog Devices,AD1816A},"
    3749                "{TerraTec,Base 64},"
    38                 "{Aztech/Newcom SC-16 3D}}");
     50                "{TerraTec,AudioSystem EWS64S},"
     51                "{Aztech/Newcom SC-16 3D},"
     52                "{Shark Predator ISA}}");
    3953
    4054static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;  /* Index 1-MAX */
    4155static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;   /* ID for this card */
    42 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE;      /* Enable this card */
     56static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP;       /* Enable this card */
    4357static long snd_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
    4458static long snd_mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;     /* PnP setup */
     
    121135        /* Analog Devices AD1816A - Terratec Base 64 */
    122136        ISAPNP_AD1816A('T','E','R',0x1411,'A','D','S',0x7180,0x7181),
     137        /* Analog Devices AD1816A - Terratec AudioSystem EWS64S */
     138        ISAPNP_AD1816A('T','E','R',0x1112,'A','D','S',0x7180,0x7181),
    123139        /* Analog Devices AD1816A - Aztech/Newcom SC-16 3D */
    124140        ISAPNP_AD1816A('A','Z','T',0x1022,'A','Z','T',0x1018,0x2002),
     141        /* Shark Predator ISA - added by Ken Arromdee */
     142        ISAPNP_AD1816A('S','M','M',0x7180,'A','D','S',0x7180,0x7181),
    125143        { ISAPNP_CARD_END, }
    126144};
     
    170188
    171189        if (pdev->activate(pdev) < 0) {
    172                 snd_printk("AUDIO isapnp configure failure\n");
     190                printk(KERN_ERR PFX "AUDIO isapnp configure failure\n");
    173191                return -EBUSY;
    174192        }
     
    196214        if (pdev->activate(pdev) < 0) {
    197215                /* not fatal error */
    198                 snd_printk("MPU-401 isapnp configure failure\n");
     216                printk(KERN_ERR PFX "MPU-401 isapnp configure failure\n");
    199217                snd_mpu_port[dev] = -1;
    200218                acard->devmpu = NULL;
     
    251269        }
    252270#else
    253         snd_printk("you have to enable ISA PnP support.\n");
     271        printk(KERN_ERR PFX "you have to enable ISA PnP support.\n");
    254272        return -ENOSYS;
    255273#endif  /* __ISAPNP__ */
     
    278296                                        snd_mpu_port[dev], 0, snd_mpu_irq[dev], SA_INTERRUPT,
    279297                                        NULL) < 0)
    280                         snd_printk("no MPU-401 device at 0x%lx.\n", snd_mpu_port[dev]);
     298                        printk(KERN_ERR PFX "no MPU-401 device at 0x%lx.\n", snd_mpu_port[dev]);
    281299        }
    282300
     
    285303                                    snd_fm_port[dev], snd_fm_port[dev] + 2,
    286304                                    OPL3_HW_AUTO, 0, &opl3) < 0) {
    287                         snd_printk("no OPL device at 0x%lx-0x%lx.\n", snd_fm_port[dev], snd_fm_port[dev] + 2);
     305                        printk(KERN_ERR PFX "no OPL device at 0x%lx-0x%lx.\n", snd_fm_port[dev], snd_fm_port[dev] + 2);
    288306                } else {
    289307                        if ((error = snd_opl3_timer_new(opl3, 1, 2)) < 0) {
     
    340358        cards += isapnp_probe_cards(snd_ad1816a_pnpids, snd_ad1816a_isapnp_detect);
    341359#else
    342         snd_printk("you have to enable ISA PnP support.\n");
     360        printk(KERN_ERR PFX "you have to enable ISA PnP support.\n");
    343361#endif
    344362#ifdef MODULE
    345363        if (!cards)
    346                 snd_printk("no AD1816A based soundcards found.\n");
     364                printk(KERN_ERR "no AD1816A based soundcards found.\n");
    347365#endif  /* MODULE */
    348366        return cards ? 0 : -ENODEV;
     
    362380#ifndef MODULE
    363381
    364 /* format is: snd-card-ad1816a=snd_enable,snd_index,snd_id,snd_port,
     382/* format is: snd-ad1816a=snd_enable,snd_index,snd_id,snd_port,
    365383                               snd_mpu_port,snd_fm_port,snd_irq,snd_mpu_irq,
    366384                               snd_dma1,snd_dma2 */
     
    386404}
    387405
    388 __setup("snd-card-ad1816a=", alsa_card_ad1816a_setup);
     406__setup("snd-ad1816a=", alsa_card_ad1816a_setup);
    389407
    390408#endif /* ifndef MODULE */
  • GPL/branches/alsa-resync1/alsa-kernel/isa/ad1816a/ad1816a_lib.c

    r32 r92  
    1616    You should have received a copy of the GNU General Public License
    1717    along with this program; if not, write to the Free Software
    18     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     18    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    1919*/
    2020
    21 #define SNDRV_MAIN_OBJECT_FILE
    2221#include <sound/driver.h>
     22#include <asm/io.h>
     23#include <asm/dma.h>
     24#include <linux/delay.h>
     25#include <linux/init.h>
     26#include <linux/slab.h>
     27#include <sound/core.h>
    2328#include <sound/ad1816a.h>
     29
     30MODULE_AUTHOR("Massimo Piccioni <dafastidio@libero.it>");
     31MODULE_DESCRIPTION("lowlevel code for Analog Devices AD1816A chip");
     32MODULE_LICENSE("GPL");
    2433
    2534#define chip_t ad1816a_t
     
    233242                AD1816A_PLAYBACK_ENABLE | AD1816A_PLAYBACK_PIO, 0x00);
    234243
    235         snd_dma_program(chip->dma1, runtime->dma_area, size,
     244        snd_dma_program(chip->dma1, runtime->dma_addr, size,
    236245                        DMA_MODE_WRITE | DMA_AUTOINIT);
    237246
     
    262271                AD1816A_CAPTURE_ENABLE | AD1816A_CAPTURE_PIO, 0x00);
    263272
    264         snd_dma_program(chip->dma2, runtime->dma_area, size,
     273        snd_dma_program(chip->dma2, runtime->dma_addr, size,
    265274                        DMA_MODE_READ | DMA_AUTOINIT);
    266275
     
    490499        snd_pcm_limit_isa_dma_size(chip->dma1, &runtime->hw.buffer_bytes_max);
    491500        snd_pcm_limit_isa_dma_size(chip->dma1, &runtime->hw.period_bytes_max);
     501        chip->playback_substream = substream;
    492502        return 0;
    493503}
     
    505515        snd_pcm_limit_isa_dma_size(chip->dma2, &runtime->hw.buffer_bytes_max);
    506516        snd_pcm_limit_isa_dma_size(chip->dma2, &runtime->hw.period_bytes_max);
     517        chip->capture_substream = substream;
    507518        return 0;
    508519}
     
    573584static int snd_ad1816a_free(ad1816a_t *chip)
    574585{
    575         if (chip->res_port)
     586        if (chip->res_port) {
    576587                release_resource(chip->res_port);
     588                kfree_nocheck(chip->res_port);
     589        }
    577590        if (chip->irq >= 0)
    578591                free_irq(chip->irq, (void *) chip);
     
    745758        snd_ad1816a_init(chip);
    746759
    747         snd_pcm_lib_preallocate_pages_for_all(pcm, 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024, GFP_KERNEL|GFP_DMA);
     760        snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024);
    748761
    749762        chip->pcm = pcm;
     
    978991static snd_kcontrol_new_t snd_ad1816a_controls[] = {
    979992AD1816A_DOUBLE("Master Playback Switch", AD1816A_MASTER_ATT, 15, 7, 1, 1),
    980 AD1816A_DOUBLE("Master Playback Volume", AD1816A_MASTER_ATT, 8, 0, 31, 0),
     993AD1816A_DOUBLE("Master Playback Volume", AD1816A_MASTER_ATT, 8, 0, 31, 1),
    981994AD1816A_DOUBLE("PCM Playback Switch", AD1816A_VOICE_ATT, 15, 7, 1, 1),
    982 AD1816A_DOUBLE("PCM Playback Volume", AD1816A_VOICE_ATT, 8, 0, 63, 0),
     995AD1816A_DOUBLE("PCM Playback Volume", AD1816A_VOICE_ATT, 8, 0, 63, 1),
    983996AD1816A_DOUBLE("Line Playback Switch", AD1816A_LINE_GAIN_ATT, 15, 7, 1, 1),
    984 AD1816A_DOUBLE("Line Playback Volume", AD1816A_LINE_GAIN_ATT, 8, 0, 31, 0),
     997AD1816A_DOUBLE("Line Playback Volume", AD1816A_LINE_GAIN_ATT, 8, 0, 31, 1),
    985998AD1816A_DOUBLE("CD Playback Switch", AD1816A_CD_GAIN_ATT, 15, 7, 1, 1),
    986 AD1816A_DOUBLE("CD Playback Volume", AD1816A_CD_GAIN_ATT, 8, 0, 31, 0),
     999AD1816A_DOUBLE("CD Playback Volume", AD1816A_CD_GAIN_ATT, 8, 0, 31, 1),
    9871000AD1816A_DOUBLE("Synth Playback Switch", AD1816A_SYNTH_GAIN_ATT, 15, 7, 1, 1),
    988 AD1816A_DOUBLE("Synth Playback Volume", AD1816A_SYNTH_GAIN_ATT, 8, 0, 31, 0),
     1001AD1816A_DOUBLE("Synth Playback Volume", AD1816A_SYNTH_GAIN_ATT, 8, 0, 31, 1),
    9891002AD1816A_DOUBLE("FM Playback Switch", AD1816A_FM_ATT, 15, 7, 1, 1),
    990 AD1816A_DOUBLE("FM Playback Volume", AD1816A_FM_ATT, 8, 0, 63, 0),
     1003AD1816A_DOUBLE("FM Playback Volume", AD1816A_FM_ATT, 8, 0, 63, 1),
    9911004AD1816A_SINGLE("Mic Playback Switch", AD1816A_MIC_GAIN_ATT, 15, 1, 1),
    992 AD1816A_SINGLE("Mic Playback Volume", AD1816A_MIC_GAIN_ATT, 8, 63, 0),
     1005AD1816A_SINGLE("Mic Playback Volume", AD1816A_MIC_GAIN_ATT, 8, 63, 1),
    9931006AD1816A_SINGLE("Mic Boost", AD1816A_MIC_GAIN_ATT, 14, 1, 0),
    9941007AD1816A_DOUBLE("Video Playback Switch", AD1816A_VID_GAIN_ATT, 15, 7, 1, 1),
    995 AD1816A_DOUBLE("Video Playback Volume", AD1816A_VID_GAIN_ATT, 8, 0, 31, 0),
     1008AD1816A_DOUBLE("Video Playback Volume", AD1816A_VID_GAIN_ATT, 8, 0, 31, 1),
    9961009AD1816A_SINGLE("Phone Capture Switch", AD1816A_PHONE_IN_GAIN_ATT, 15, 1, 1),
    997 AD1816A_SINGLE("Phone Capture Volume", AD1816A_PHONE_IN_GAIN_ATT, 0, 31, 0),
     1010AD1816A_SINGLE("Phone Capture Volume", AD1816A_PHONE_IN_GAIN_ATT, 0, 15, 1),
    9981011AD1816A_SINGLE("Phone Playback Switch", AD1816A_PHONE_OUT_ATT, 7, 1, 1),
    999 AD1816A_SINGLE("Phone Playback Volume", AD1816A_PHONE_OUT_ATT, 0, 31, 0),
     1012AD1816A_SINGLE("Phone Playback Volume", AD1816A_PHONE_OUT_ATT, 0, 31, 1),
    10001013{
    10011014#ifdef TARGET_OS2
  • GPL/branches/alsa-resync1/alsa-kernel/isa/ad1848/ad1848.c

    r32 r92  
    1818 *   You should have received a copy of the GNU General Public License
    1919 *   along with this program; if not, write to the Free Software
    20  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     20 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    2121 *
    2222 */
    2323
    24 #define SNDRV_MAIN_OBJECT_FILE
    2524#include <sound/driver.h>
     25#include <linux/init.h>
     26#include <linux/time.h>
     27#include <linux/wait.h>
     28#include <sound/core.h>
    2629#include <sound/ad1848.h>
    2730#define SNDRV_GET_ID
     
    3134
    3235EXPORT_NO_SYMBOLS;
     36MODULE_AUTHOR("Tugrul Galatali <galatalt@stuy.edu>, Jaroslav Kysela <perex@suse.cz>");
    3337MODULE_DESCRIPTION("AD1848/AD1847/CS4248");
     38MODULE_LICENSE("GPL");
    3439MODULE_CLASSES("{sound}");
    3540MODULE_DEVICES("{{Analog Devices,AD1848},"
     
    131136        if (!cards) {
    132137#ifdef MODULE
    133                 snd_printk("AD1848 soundcard not found or device busy\n");
     138                printk(KERN_ERR "AD1848 soundcard not found or device busy\n");
    134139#endif
    135140                return -ENODEV;
     
    151156#ifndef MODULE
    152157
    153 /* format is: snd-card-ad1848=snd_enable,snd_index,snd_id,snd_port,
     158/* format is: snd-ad1848=snd_enable,snd_index,snd_id,snd_port,
    154159                              snd_irq,snd_dma1 */
    155160
     
    170175}
    171176
    172 __setup("snd-card-ad1848=", alsa_card_ad1848_setup);
     177__setup("snd-ad1848=", alsa_card_ad1848_setup);
    173178
    174179#endif /* ifndef MODULE */
  • GPL/branches/alsa-resync1/alsa-kernel/isa/ad1848/ad1848_lib.c

    r32 r92  
    1616 *   You should have received a copy of the GNU General Public License
    1717 *   along with this program; if not, write to the Free Software
    18  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     18 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    1919 *
    2020 */
     
    2222#define SNDRV_MAIN_OBJECT_FILE
    2323#include <sound/driver.h>
     24#include <asm/io.h>
     25#include <asm/dma.h>
     26#include <linux/delay.h>
     27#include <linux/slab.h>
     28#include <sound/core.h>
    2429#include <sound/ad1848.h>
     30
     31MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
     32MODULE_DESCRIPTION("Routines for control of AD1848/AD1847/CS4248");
     33MODULE_LICENSE("GPL");
    2534
    2635#define chip_t ad1848_t
     
    114123}
    115124
    116 static void snd_ad1848_dout(ad1848_t *chip,
     125void snd_ad1848_dout(ad1848_t *chip,
    117126                            unsigned char reg,
    118127                            unsigned char value)
     
    127136}
    128137
    129 static unsigned char snd_ad1848_in(ad1848_t *chip, unsigned char reg)
     138unsigned char snd_ad1848_in(ad1848_t *chip, unsigned char reg)
    130139{
    131140        int timeout;
     
    172181 */
    173182
    174 static void snd_ad1848_mce_up(ad1848_t *chip)
     183void snd_ad1848_mce_up(ad1848_t *chip)
    175184{
    176185        unsigned long flags;
     
    193202}
    194203
    195 static void snd_ad1848_mce_down(ad1848_t *chip)
     204void snd_ad1848_mce_down(ad1848_t *chip)
    196205{
    197206        unsigned long flags;
     
    292301                }
    293302                snd_ad1848_out(chip, AD1848_IFACE_CTRL, chip->image[AD1848_IFACE_CTRL] |= what);
     303                chip->mode |= AD1848_MODE_RUNNING;
    294304        } else if (cmd == SNDRV_PCM_TRIGGER_STOP) {
    295305                if (!(chip->image[AD1848_IFACE_CTRL] & what)) {
     
    298308                }
    299309                snd_ad1848_out(chip, AD1848_IFACE_CTRL, chip->image[AD1848_IFACE_CTRL] &= ~what);
     310                chip->mode &= ~AD1848_MODE_RUNNING;
    300311        } else {
    301312                result = -EINVAL;
     
    524535        chip->dma_size = size;
    525536        chip->image[AD1848_IFACE_CTRL] &= ~(AD1848_PLAYBACK_ENABLE | AD1848_PLAYBACK_PIO);
    526         snd_dma_program(chip->dma, runtime->dma_area, size, DMA_MODE_WRITE | DMA_AUTOINIT);
     537        snd_dma_program(chip->dma, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT);
    527538        count = snd_ad1848_get_count(chip->image[AD1848_DATA_FORMAT], count) - 1;
    528539        spin_lock_irqsave(&chip->reg_lock, flags);
     
    568579        chip->dma_size = size;
    569580        chip->image[AD1848_IFACE_CTRL] &= ~(AD1848_CAPTURE_ENABLE | AD1848_CAPTURE_PIO);
    570         snd_dma_program(chip->dma, runtime->dma_area, size, DMA_MODE_READ | DMA_AUTOINIT);
     581        snd_dma_program(chip->dma, runtime->dma_addr, size, DMA_MODE_READ | DMA_AUTOINIT);
    571582        count = snd_ad1848_get_count(chip->image[AD1848_DATA_FORMAT], count) - 1;
    572583        spin_lock_irqsave(&chip->reg_lock, flags);
     
    581592        ad1848_t *chip = snd_magic_cast(ad1848_t, dev_id, return);
    582593
    583         if ((chip->mode & AD1848_MODE_PLAY) && chip->playback_substream)
     594        if ((chip->mode & AD1848_MODE_PLAY) && chip->playback_substream &&
     595            (chip->mode & AD1848_MODE_RUNNING))
    584596                snd_pcm_period_elapsed(chip->playback_substream);
    585         if ((chip->mode & AD1848_MODE_CAPTURE) && chip->capture_substream)
     597        if ((chip->mode & AD1848_MODE_CAPTURE) && chip->capture_substream &&
     598            (chip->mode & AD1848_MODE_RUNNING))
    586599                snd_pcm_period_elapsed(chip->capture_substream);
    587600        outb(0, AD1848P(chip, STATUS)); /* clear global interrupt bit */
     
    821834static int snd_ad1848_free(ad1848_t *chip)
    822835{
    823         if (chip->res_port)
     836        if (chip->res_port) {
    824837                release_resource(chip->res_port);
     838                kfree_nocheck(chip->res_port);
     839        }
    825840        if (chip->irq >= 0)
    826841                free_irq(chip->irq, (void *) chip);
     
    980995        strcpy(pcm->name, snd_ad1848_chip_id(chip));
    981996
    982         snd_pcm_lib_preallocate_pages_for_all(pcm, 64*1024, chip->dma > 3 ? 128*1024 : 64*1024, GFP_KERNEL|GFP_DMA);
     997        snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, chip->dma > 3 ? 128*1024 : 64*1024);
    983998
    984999        chip->pcm = pcm;
     
    9951010{
    9961011        static char *texts[4] = {
    997                 "Line1", "Aux", "Line2", "Mix"
     1012                "Line", "Aux", "Mic", "Mix"
    9981013        };
    9991014
     
    11721187AD1848_DOUBLE("Aux Playback Switch", 1, AD1848_AUX2_LEFT_INPUT, AD1848_AUX2_RIGHT_INPUT, 7, 7, 1, 1),
    11731188AD1848_DOUBLE("Aux Playback Volume", 1, AD1848_AUX2_LEFT_INPUT, AD1848_AUX2_RIGHT_INPUT, 0, 0, 31, 1),
    1174 AD1848_DOUBLE("Capture Volume", 0, AD1848_LEFT_INPUT, AD1848_LEFT_INPUT, 0, 0, 15, 0),
     1189AD1848_DOUBLE("Capture Volume", 0, AD1848_LEFT_INPUT, AD1848_RIGHT_INPUT, 0, 0, 15, 0),
    11751190{
    11761191#ifdef TARGET_OS2
     
    12121227}
    12131228
     1229EXPORT_SYMBOL(snd_ad1848_in);
    12141230EXPORT_SYMBOL(snd_ad1848_out);
     1231EXPORT_SYMBOL(snd_ad1848_dout);
     1232EXPORT_SYMBOL(snd_ad1848_mce_up);
     1233EXPORT_SYMBOL(snd_ad1848_mce_down);
    12151234EXPORT_SYMBOL(snd_ad1848_interrupt);
    12161235EXPORT_SYMBOL(snd_ad1848_create);
  • GPL/branches/alsa-resync1/alsa-kernel/isa/als100.c

    r32 r92  
    1818    You should have received a copy of the GNU General Public License
    1919    along with this program; if not, write to the Free Software
    20     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     20    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    2121*/
    2222
    2323#define SNDRV_MAIN_OBJECT_FILE
    2424#include <sound/driver.h>
     25#include <linux/init.h>
     26#include <linux/wait.h>
     27#include <linux/sched.h>
     28#include <linux/time.h>
     29#include <sound/core.h>
    2530#define SNDRV_GET_ID
    2631#include <sound/initval.h>
     
    3136#define chip_t sb_t
    3237
     38#define PFX "als100: "
     39
    3340EXPORT_NO_SYMBOLS;
     41
     42MODULE_AUTHOR("Massimo Piccioni <dafastidio@libero.it>");
    3443MODULE_DESCRIPTION("Avance Logic ALS1X0");
     44MODULE_LICENSE("GPL");
    3545MODULE_CLASSES("{sound}");
    3646MODULE_DEVICES("{{Avance Logic,ALS100 - PRO16PNP},"
    3747                "{Avance Logic,ALS110},"
     48                "{Avance Logic,ALS120},"
     49                "{Avance Logic,ALS200},"
    3850                "{3D Melody,MF1000},"
    3951                "{Digimate,3D Sound},"
     
    122134        /* ALS120 */
    123135        ISAPNP_ALS100('A','L','S',0x0120,0x2001,0x2001,0x2001),
     136        /* ALS200 */
     137        ISAPNP_ALS100('A','L','S',0x0200,0x0020,0x0020,0x0001),
    124138        /* RTL3000 */
    125139        ISAPNP_ALS100('R','T','L',0x3000,0x2001,0x2001,0x2001),
     
    173187
    174188        if (pdev->activate(pdev)<0) {
    175                 snd_printk("AUDIO isapnp configure failure\n");
     189                printk(KERN_ERR PFX "AUDIO isapnp configure failure\n");
    176190                return -EBUSY;
    177191        }
     
    196210
    197211        if (pdev->activate(pdev)<0) {
    198                 snd_printk("MPU-401 isapnp configure failure\n");
     212                printk(KERN_ERR PFX "MPU-401 isapnp configure failure\n");
    199213                snd_mpu_port[dev] = -1;
    200214                acard->devmpu = NULL;
     
    214228
    215229        if (pdev->activate(pdev)<0) {
    216                 snd_printk("OPL isapnp configure failure\n");
     230                printk(KERN_ERR PFX "OPL isapnp configure failure\n");
    217231                snd_fm_port[dev] = -1;
    218232                acard->devopl = NULL;
     
    272286        }
    273287#else
    274         snd_printk("you have to enable PnP support ...\n");
     288        printk(KERN_ERR PFX "you have to enable PnP support ...\n");
    275289        snd_card_free(card);
    276290        return -ENOSYS;
     
    302316                                        snd_mpu_irq[dev], SA_INTERRUPT,
    303317                                        NULL) < 0)
    304                         snd_printk("no MPU-401 device at 0x%lx\n", snd_mpu_port[dev]);
     318                        printk(KERN_ERR PFX "no MPU-401 device at 0x%lx\n", snd_mpu_port[dev]);
    305319        }
    306320
     
    309323                                    snd_fm_port[dev], snd_fm_port[dev] + 2,
    310324                                    OPL3_HW_AUTO, 0, &opl3) < 0) {
    311                         snd_printk("no OPL device at 0x%lx-0x%lx\n",
     325                        printk(KERN_ERR PFX "no OPL device at 0x%lx-0x%lx\n",
    312326                                snd_fm_port[dev], snd_fm_port[dev] + 2);
    313327                } else {
     
    365379        cards += isapnp_probe_cards(snd_als100_pnpids, snd_als100_isapnp_detect);
    366380#else
    367         snd_printk("you have to enable ISA PnP support.\n");
     381        printk(KERN_ERR PFX "you have to enable ISA PnP support.\n");
    368382#endif
    369383#ifdef MODULE
    370384        if (!cards)
    371                 snd_printk("no ALS100 based soundcards found\n");
     385                printk(KERN_ERR "no ALS100 based soundcards found\n");
    372386#endif
    373387        return cards ? 0 : -ENODEV;
     
    387401#ifndef MODULE
    388402
    389 /* format is: snd-card-als100=snd_enable,snd_index,snd_id,snd_port,
     403/* format is: snd-als100=snd_enable,snd_index,snd_id,snd_port,
    390404                              snd_mpu_port,snd_fm_port,snd_irq,snd_mpu_irq,
    391405                              snd_dma8,snd_dma16 */
     
    411425}
    412426
    413 __setup("snd-card-als100=", alsa_card_als100_setup);
     427__setup("snd-als100=", alsa_card_als100_setup);
    414428
    415429#endif /* ifndef MODULE */
  • GPL/branches/alsa-resync1/alsa-kernel/isa/azt2320.c

    r32 r92  
    1616    You should have received a copy of the GNU General Public License
    1717    along with this program; if not, write to the Free Software
    18     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     18    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    1919*/
    2020
     
    3131*/
    3232
    33 #define SNDRV_MAIN_OBJECT_FILE
    3433#include <sound/driver.h>
     34#include <asm/io.h>
     35#include <linux/delay.h>
     36#include <linux/init.h>
     37#include <linux/time.h>
     38#include <linux/wait.h>
     39#include <sound/core.h>
    3540#define SNDRV_GET_ID
    3641#include <sound/initval.h>
     
    4146#define chip_t cs4231_t
    4247
     48#define PFX "azt2320: "
     49
    4350EXPORT_NO_SYMBOLS;
     51
     52MODULE_AUTHOR("Massimo Piccioni <dafastidio@libero.it>");
    4453MODULE_DESCRIPTION("Aztech Systems AZT2320");
     54MODULE_LICENSE("GPL");
    4555MODULE_CLASSES("{sound}");
    4656MODULE_DEVICES("{{Aztech Systems,PRO16V},"
     
    188198
    189199        if (pdev->activate(pdev) < 0) {
    190                 snd_printk("AUDIO isapnp configure failure\n");
     200                printk(KERN_ERR PFX "AUDIO isapnp configure failure\n");
    191201                return -EBUSY;
    192202        }
     
    214224        if (pdev->activate(pdev) < 0) {
    215225                /* not fatal error */
    216                 snd_printk("MPU-401 isapnp configure failure\n");
     226                printk(KERN_ERR PFX "MPU-401 isapnp configure failure\n");
    217227                snd_mpu_port[dev] = -1;
    218228                acard->devmpu = NULL;
     
    326336                                snd_mpu_irq[dev], SA_INTERRUPT,
    327337                                NULL) < 0)
    328                         snd_printk("no MPU-401 device at 0x%lx\n",
     338                        printk(KERN_ERR PFX "no MPU-401 device at 0x%lx\n",
    329339                                snd_mpu_port[dev]);
    330340        }
     
    334344                                    snd_fm_port[dev], snd_fm_port[dev] + 2,
    335345                                    OPL3_HW_AUTO, 0, &opl3) < 0) {
    336                         snd_printk("no OPL device at 0x%lx-0x%lx\n",
     346                        printk(KERN_ERR PFX "no OPL device at 0x%lx-0x%lx\n",
    337347                                snd_fm_port[dev], snd_fm_port[dev] + 2);
    338348                } else {
     
    390400        cards += isapnp_probe_cards(snd_azt2320_pnpids, snd_azt2320_isapnp_detect);
    391401#else
    392         snd_printk("you have to enable ISA PnP support.\n");
     402        printk(KERN_ERR PFX "you have to enable ISA PnP support.\n");
    393403#endif
    394404#ifdef MODULE
    395405        if (!cards)
    396                 snd_printk("no AZT2320 based soundcards found\n");
     406                printk(KERN_ERR "no AZT2320 based soundcards found\n");
    397407#endif
    398408        return cards ? 0 : -ENODEV;
     
    412422#ifndef MODULE
    413423
    414 /* format is: snd-card-azt2320=snd_enable,snd_index,snd_id,snd_port,
     424/* format is: snd-azt2320=snd_enable,snd_index,snd_id,snd_port,
    415425                               snd_wss_port,snd_mpu_port,snd_fm_port,
    416426                               snd_irq,snd_mpu_irq,snd_dma1,snd_dma2 */
     
    436446}
    437447
    438 __setup("snd-card-azt2320=", alsa_card_azt2320_setup);
     448__setup("snd-azt2320=", alsa_card_azt2320_setup);
    439449
    440450#endif /* ifndef MODULE */
  • GPL/branches/alsa-resync1/alsa-kernel/isa/cmi8330.c

    r32 r92  
    1616 *   You should have received a copy of the GNU General Public License
    1717 *   along with this program; if not, write to the Free Software
    18  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     18 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    1919 *
    2020 */
     
    4444 */
    4545
    46 #define SNDRV_MAIN_OBJECT_FILE
    47 
    4846#include <sound/driver.h>
     47#include <linux/init.h>
     48#include <linux/slab.h>
     49#include <sound/core.h>
    4950#include <sound/ad1848.h>
    5051#include <sound/sb.h>
     
    5354
    5455EXPORT_NO_SYMBOLS;
     56
     57MODULE_AUTHOR("George Talusan <gstalusan@uwaterloo.ca>");
    5558MODULE_DESCRIPTION("C-Media CMI8330");
     59MODULE_LICENSE("GPL");
    5660MODULE_CLASSES("{sound}");
    5761MODULE_DEVICES("{{C-Media,CMI8330,isapnp:{CMI0001,@@@0001,@X@0001}}}");
     
    7579static int snd_wssdma[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;
    7680
    77 MODULE_AUTHOR("George Talusan <gstalusan@uwaterloo.ca>");
    7881MODULE_PARM(snd_index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
    7982MODULE_PARM_DESC(snd_index, "Index value for CMI8330 soundcard.");
     
    499502        if (!cards) {
    500503#ifdef MODULE
    501                 snd_printk("CMI8330 not found or device busy\n");
     504                printk(KERN_ERR "CMI8330 not found or device busy\n");
    502505#endif
    503506                return -ENODEV;
     
    511514#ifndef MODULE
    512515
    513 /* format is: snd-card-cmi8330=snd_enable,snd_index,snd_id,snd_isapnp,
     516/* format is: snd-cmi8330=snd_enable,snd_index,snd_id,snd_isapnp,
    514517                               snd_sbport,snd_sbirq,
    515518                               snd_sbdma8,snd_sbdma16,
     
    532535               get_option(&str,&snd_sbdma8[nr_dev]) == 2 &&
    533536               get_option(&str,&snd_sbdma16[nr_dev]) == 2 &&
    534                get_option(&str,&snd_wssport[nr_dev]) == 2 &&
     537               get_option(&str,(int *)&snd_wssport[nr_dev]) == 2 &&
    535538               get_option(&str,&snd_wssirq[nr_dev]) == 2 &&
    536539               get_option(&str,&snd_wssdma[nr_dev]) == 2);
     
    543546}
    544547
    545 __setup("snd-card-cmi8330=", alsa_card_cmi8330_setup);
     548__setup("snd-cmi8330=", alsa_card_cmi8330_setup);
    546549
    547550#endif /* ifndef MODULE */
  • GPL/branches/alsa-resync1/alsa-kernel/isa/cs423x/cs4231.c

    r32 r92  
    1717 *   You should have received a copy of the GNU General Public License
    1818 *   along with this program; if not, write to the Free Software
    19  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     19 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    2020 *
    2121 */
    2222
    23 #define SNDRV_MAIN_OBJECT_FILE
    2423#include <sound/driver.h>
     24#include <linux/init.h>
     25#include <linux/time.h>
     26#include <linux/wait.h>
     27#include <sound/core.h>
    2528#include <sound/cs4231.h>
    2629#include <sound/mpu401.h>
     
    3134
    3235EXPORT_NO_SYMBOLS;
     36
     37MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
    3338MODULE_DESCRIPTION("Generic CS4231");
     39MODULE_LICENSE("GPL");
    3440MODULE_CLASSES("{sound}");
    3541MODULE_DEVICES("{{Crystal Semiconductors,CS4231}}");
     
    130136                                        snd_mpu_irq[dev], SA_INTERRUPT,
    131137                                        NULL) < 0)
    132                         snd_printk("MPU401 not detected\n");
     138                        printk(KERN_ERR "cs4231: MPU401 not detected\n");
    133139        }
    134140        strcpy(card->driver, "CS4231");
     
    156162        if (!cards) {
    157163#ifdef MODULE
    158                 snd_printk("CS4231 soundcard not found or device busy\n");
     164                printk(KERN_ERR "CS4231 soundcard not found or device busy\n");
    159165#endif
    160166                return -ENODEV;
     
    176182#ifndef MODULE
    177183
    178 /* format is: snd-card-cs4231=snd_enable,snd_index,snd_id,
     184/* format is: snd-cs4231=snd_enable,snd_index,snd_id,
    179185                              snd_port,snd_mpu_port,snd_irq,snd_mpu_irq,
    180186                              snd_dma1,snd_dma2 */
     
    201207}
    202208
    203 __setup("snd-card-cs4231=", alsa_card_cs4231_setup);
     209__setup("snd-cs4231=", alsa_card_cs4231_setup);
    204210
    205211#endif /* ifndef MODULE */
  • GPL/branches/alsa-resync1/alsa-kernel/isa/cs423x/cs4231_lib.c

    r32 r92  
    2121 *   You should have received a copy of the GNU General Public License
    2222 *   along with this program; if not, write to the Free Software
    23  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     23 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    2424 *
    2525 */
    2626
    27 #define SNDRV_MAIN_OBJECT_FILE
    2827#include <sound/driver.h>
     28#include <asm/io.h>
     29#include <asm/dma.h>
     30#include <asm/irq.h>
     31#include <linux/delay.h>
     32#include <linux/pm.h>
     33#include <linux/init.h>
     34#include <linux/slab.h>
     35#include <sound/core.h>
    2936#include <sound/cs4231.h>
     37
     38MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
     39MODULE_DESCRIPTION("Routines for control of CS4231(A)/CS4232/InterWave & compatible chips");
     40MODULE_LICENSE("GPL");
    3041
    3142#define chip_t cs4231_t
     
    743754        chip->image[CS4231_PIN_CTRL] &= ~CS4231_IRQ_ENABLE;
    744755        snd_cs4231_out(chip, CS4231_PIN_CTRL, chip->image[CS4231_PIN_CTRL]);
    745         spin_unlock_irqrestore(&chip->reg_lock, flags);
    746756
    747757        /* now disable record & playback */
    748758
    749         spin_lock_irqsave(&chip->reg_lock, flags);
    750759        if (chip->image[CS4231_IFACE_CTRL] & (CS4231_PLAYBACK_ENABLE | CS4231_PLAYBACK_PIO |
    751760                                               CS4231_RECORD_ENABLE | CS4231_RECORD_PIO)) {
     
    849858        unsigned int count = snd_pcm_lib_period_bytes(substream);
    850859
     860        spin_lock_irqsave(&chip->reg_lock, flags);
    851861        chip->p_dma_size = size;
    852862        chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_PLAYBACK_ENABLE | CS4231_PLAYBACK_PIO);
    853         snd_dma_program(chip->dma1, runtime->dma_area, size, DMA_MODE_WRITE | DMA_AUTOINIT);
     863        snd_dma_program(chip->dma1, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT);
    854864        count = snd_cs4231_get_count(chip->image[CS4231_PLAYBK_FORMAT], count) - 1;
    855         spin_lock_irqsave(&chip->reg_lock, flags);
    856865        snd_cs4231_out(chip, CS4231_PLY_LWR_CNT, (unsigned char) count);
    857866        snd_cs4231_out(chip, CS4231_PLY_UPR_CNT, (unsigned char) (count >> 8));
     
    891900        unsigned int count = snd_pcm_lib_period_bytes(substream);
    892901
     902        spin_lock_irqsave(&chip->reg_lock, flags);
    893903        chip->c_dma_size = size;
    894904        chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_RECORD_ENABLE | CS4231_RECORD_PIO);
    895         snd_dma_program(chip->dma2, runtime->dma_area, size, DMA_MODE_READ | DMA_AUTOINIT);
     905        snd_dma_program(chip->dma2, runtime->dma_addr, size, DMA_MODE_READ | DMA_AUTOINIT);
    896906        count = snd_cs4231_get_count(chip->image[CS4231_REC_FORMAT], count) - 1;
    897         spin_lock_irqsave(&chip->reg_lock, flags);
    898907        if (chip->single_dma && chip->hardware != CS4231_HW_INTERWAVE) {
    899908                snd_cs4231_out(chip, CS4231_PLY_LWR_CNT, (unsigned char) count);
     
    13581367        }
    13591368        snd_cs4231_busy_wait(chip);
    1360         return;
     1369        spin_unlock_irqrestore(&chip->reg_lock, flags);
    13611370#endif
    13621371}
     
    13831392static int snd_cs4231_free(cs4231_t *chip)
    13841393{
    1385         if (chip->res_port)
     1394        if (chip->res_port) {
    13861395                release_resource(chip->res_port);
    1387         if (chip->res_cport)
     1396                kfree_nocheck(chip->res_port);
     1397        }
     1398        if (chip->res_cport) {
    13881399                release_resource(chip->res_cport);
     1400                kfree_nocheck(chip->res_cport);
     1401        }
    13891402        if (chip->irq >= 0) {
    13901403                disable_irq(chip->irq);
     
    16121625        strcpy(pcm->name, snd_cs4231_chip_id(chip));
    16131626
    1614         snd_pcm_lib_preallocate_pages_for_all(pcm, 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024, GFP_KERNEL|GFP_DMA);
     1627        snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024);
    16151628
    16161629        chip->pcm = pcm;
  • GPL/branches/alsa-resync1/alsa-kernel/isa/cs423x/cs4236.c

    r32 r92  
    1616 *   You should have received a copy of the GNU General Public License
    1717 *   along with this program; if not, write to the Free Software
    18  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     18 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    1919 *
    2020 */
    2121
    22 #define SNDRV_MAIN_OBJECT_FILE
    2322#include <sound/driver.h>
     23#include <linux/init.h>
     24#include <linux/slab.h>
     25#ifndef LINUX_ISAPNP_H
     26#include <linux/isapnp.h>
     27#define isapnp_card pci_bus
     28#define isapnp_dev pci_dev
     29#endif
     30#include <sound/core.h>
    2431#include <sound/cs4231.h>
    2532#include <sound/mpu401.h>
     
    3138
    3239EXPORT_NO_SYMBOLS;
     40MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
     41MODULE_LICENSE("GPL");
     42MODULE_CLASSES("{sound}");
    3343#ifdef CS4232
    3444MODULE_DESCRIPTION("Cirrus Logic CS4232");
    35 MODULE_CLASSES("{sound}");
    3645MODULE_DEVICES("{{Turtle Beach,TBS-2000},"
    3746                "{Turtle Beach,Tropez Plus},"
    3847                "{SIC CrystalWave 32},"
    39                 "{HP,Omnibook 5500}},"
    40                 "{TerraTec,Maestro 32/96}");
     48                "{Hewlett Packard,Omnibook 5500},"
     49                "{TerraTec,Maestro 32/96},"
     50                "{Philips,PCA70PS}}");
    4151#else
    4252MODULE_DESCRIPTION("Cirrus Logic CS4235-9");
    43 MODULE_CLASSES("{sound}");
    4453MODULE_DEVICES("{{Crystal Semiconductors,CS4235},"
    4554                "{Crystal Semiconductors,CS4236},"
     
    4756                "{Crystal Semiconductors,CS4238},"
    4857                "{Crystal Semiconductors,CS4239},"
     58                "{Acer,AW37},"
     59                "{Acer,AW35/Pro},"
     60                "{Crystal,3D},"
     61                "{Crystal Computer,TidalWave128},"
     62                "{Dell,Optiplex GX1},"
     63                "{Dell,Workstation 400 sound},"
     64                "{EliteGroup,P5TX-LA sound},"
     65                "{Gallant,SC-70P},"
     66                "{Gateway,E1000 Onboard CS4236B},"
    4967                "{Genius,Sound Maker 3DJ},"
    5068                "{Hewlett Packard,HP6330 sound},"
    51                 "{Crystal Computer,TidalWave128},"
    52                 "{Acer,AW37},"
    53                 "{EliteGroup,P5TX-LA sound},"
    54                 "{Crystal,3D},"
     69                "{IBM,PC 300PL sound},"
     70                "{IBM,Aptiva 2137 E24},"
     71                "{IBM,IntelliStation M Pro},"
     72                "{Intel,Marlin Spike Mobo CS4235},"
     73                "{Guillemot,MaxiSound 16 PnP},"
     74                "{NewClear,3D},"
     75                "{TerraTec,AudioSystem EWS64L/XL},"
    5576                "{Typhoon Soundsystem,CS4236B},"
    56                 "{TerraTec, AudioSystem EWS64XL},"
    57                 "{NewClear,3D},"
    58                 "{Dell,Optiplex GX1},"
    59                 "{Dell,Workstation 400 sound},"
    6077                "{Turtle Beach,Malibu},"
    61                 "{Crystal Semiconductors,CS4235},"
    62                 "{IBM,Adaptiva 2137 E24},"
    63                 "{Maxi Sound,16 PnP},"
    64                 "{Gallant,SC-70P},"
    65                 "{Acer,AW37/Pro},"
    66                 "{Acer,AW35/Pro},"
    67                 "{Intel, Marlin Spike Mobo CS4235},"
    68                 "{IBM,IntelliStation M Pro}}");
     78                "{Unknown,Digital PC 5000 Onboard}}");
    6979#endif
    7080
     
    7787static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;  /* Index 0-MAX */
    7888static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;   /* ID for this card */
    79 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE;      /* Enable this card */
     89static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */
    8090#ifdef __ISAPNP__
    8191#ifdef TARGET_OS2
     
    200210#ifdef CS4232
    201211static struct isapnp_card_id snd_card_pnpids[] __devinitdata = {
     212        /* Philips PCA70PS */
     213        ISAPNP_CS4232_1('C','S','C',0x0d32,0x0000,0x0010,0xb006),
     214        /* TerraTec Maestro 32/96 (CS4232) */
     215        ISAPNP_CS4232('C','S','C',0x1a32,0x0000,0x0010,0x0003),
    202216        /* HP Omnibook 5500 onboard */
    203217        ISAPNP_CS4232('C','S','C',0x4232,0x0000,0x0002,0x0003),
     
    208222        /* SIC CrystalWave 32 (CS4232) */
    209223        ISAPNP_CS4232('C','S','C',0xf032,0x0000,0x0010,0x0003),
    210         /* TerraTec Maestro 32/96 (CS4232) */
    211         ISAPNP_CS4232('C','S','C',0x1a32,0x0000,0x0010,0x0003),
    212224        /* --- */
    213225        { ISAPNP_CARD_END, }    /* end */
     
    221233        /* Genius Sound Maker 3DJ - CS4237B */
    222234        ISAPNP_CS4232('C','S','C',0x0437,0x0000,0x0010,0x0003),
     235        /* Digital PC 5000 Onboard - CS4236B */
     236        ISAPNP_CS4232_WOMPU('C','S','C',0x0735,0x0000,0x0010),
    223237        /* some uknown CS4236B */
    224238        ISAPNP_CS4232('C','S','C',0x0b35,0x0000,0x0010,0x0003),
    225239        /* CS4235 on mainboard without MPU */
    226240        ISAPNP_CS4232_WOMPU('C','S','C',0x1425,0x0100,0x0110),
     241        /* Gateway E1000 Onboard CS4236B */
     242        ISAPNP_CS4232('C','S','C',0x1335,0x0000,0x0010,0x0003),
    227243        /* HP 6330 Onboard sound */
    228244        ISAPNP_CS4232('C','S','C',0x1525,0x0100,0x0110,0x0103),
     
    253269        /* CS4235 - onboard */
    254270        ISAPNP_CS4232('C','S','C',0x8025,0x0100,0x0110,0x0103),
     271        /* IBM PC 300PL Onboard - CS4236B */
     272        ISAPNP_CS4232_WOMPU('C','S','C',0xe836,0x0000,0x0010),
    255273        /* IBM Aptiva 2137 E24 Onboard - CS4237B */
    256274        ISAPNP_CS4232('C','S','C',0x8037,0x0000,0x0010,0x0003),
    257         /* Maxi Sound 16 PnP - CS4236B */
     275        /* IBM IntelliStation M Pro motherboard */
     276        ISAPNP_CS4232_WOMPU('C','S','C',0xc835,0x0000,0x0010),
     277        /* Guillemot MaxiSound 16 PnP - CS4236B */
    258278        ISAPNP_CS4232('C','S','C',0x9836,0x0000,0x0010,0x0003),
    259279        /* Gallant SC-70P */
    260280        ISAPNP_CS4232('C','S','C',0x9837,0x0000,0x0010,0x0003),
    261         /* IBM IntelliStation M Pro motherboard */
    262         ISAPNP_CS4232_WOMPU('C','S','C',0xc835,0x0000,0x0010),
    263281        /* ACER AW37/Pro - CS4235 */
    264282        ISAPNP_CS4232('C','S','C',0xd925,0x0000,0x0010,0x0003),
     
    319337                isapnp_resource_change(&pdev->dma_resource[1], snd_dma2[dev] < 0 ? 4 : snd_dma2[dev], 1);
    320338        if (pdev->activate(pdev)<0) {
    321                 snd_printk(IDENT " isapnp configure failed for WSS (out of resources?)\n");
     339                printk(KERN_ERR IDENT " isapnp configure failed for WSS (out of resources?)\n");
    322340                return -EBUSY;
    323341        }
     
    341359                isapnp_resource_change(&pdev->resource[0], snd_cport[dev], 8);
    342360        if (pdev->activate(pdev)<0) {
    343                 snd_printk(IDENT " isapnp configure failed for control (out of resources?)\n");
     361                printk(KERN_ERR IDENT " isapnp configure failed for control (out of resources?)\n");
    344362                acard->wss->deactivate(acard->wss);
    345363                return -EBUSY;
     
    361379                if (pdev->activate(pdev)<0) {
    362380                        snd_mpu_port[dev] = SNDRV_AUTO_PORT;
    363                         snd_printk(IDENT " isapnp configure failed for MPU (out of resources?)\n");
     381                        snd_mpu_irq[dev] = SNDRV_AUTO_IRQ;
     382                        printk(KERN_ERR IDENT " isapnp configure failed for MPU (out of resources?)\n");
    364383                } else {
    365384                        snd_mpu_port[dev] = pdev->resource[0].start;
     385                        if (pdev->irq_resource[0].flags & IORESOURCE_IRQ) {
    366386                        snd_mpu_irq[dev] = pdev->irq_resource[0].start;
     387                        } else {
     388                                snd_mpu_irq[dev] = -1;  /* disable interrupt */
     389                        }
    367390                }
    368391                snd_printdd("isapnp MPU: port=0x%lx, irq=%i\n", snd_mpu_port[dev], snd_mpu_irq[dev]);
     
    396419                snd_card_cs4236_deactivate(acard);
    397420#endif
    398                 if (acard->res_sb_port)
     421                if (acard->res_sb_port) {
    399422                        release_resource(acard->res_sb_port);
     423                        kfree_nocheck(acard->res_sb_port);
     424                }
    400425        }
    401426}
     
    432457#ifdef __ISAPNP__
    433458        if (snd_isapnp[dev] && (err = snd_card_cs4236_isapnp(dev, acard))<0) {
    434                 snd_printk("isapnp detection failed and probing for " IDENT " is not supported\n");
     459                printk(KERN_ERR "isapnp detection failed and probing for " IDENT " is not supported\n");
    435460                snd_card_free(card);
    436461                return -ENXIO;
     
    445470        if (snd_sb_port[dev] != SNDRV_AUTO_PORT)
    446471                if ((acard->res_sb_port = request_region(snd_sb_port[dev], 16, IDENT " SB")) == NULL) {
    447                         snd_printk("unable to register SB port at 0x%lx\n", snd_sb_port[dev]);
     472                        printk(KERN_ERR IDENT ": unable to register SB port at 0x%lx\n", snd_sb_port[dev]);
    448473                        snd_card_free(card);
    449474                        return -ENOMEM;
     
    504529                                    snd_fm_port[dev], snd_fm_port[dev] + 2,
    505530                                    OPL3_HW_OPL3_CS, 0, &opl3) < 0) {
    506                         snd_printk(IDENT ": OPL3 not detected\n");
     531                        printk(KERN_ERR IDENT ": OPL3 not detected\n");
    507532                } else {
    508533                        if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
     
    516541                if (snd_mpu401_uart_new(card, 0, MPU401_HW_CS4232,
    517542                                        snd_mpu_port[dev], 0,
    518                                         snd_mpu_irq[dev], SA_INTERRUPT, NULL) < 0)
    519                         snd_printk(IDENT ": MPU401 not detected\n");
     543                                        snd_mpu_irq[dev],
     544                                        snd_mpu_irq[dev] >= 0 ? SA_INTERRUPT : 0, NULL) < 0)
     545                        printk(KERN_ERR IDENT ": MPU401 not detected\n");
    520546        }
    521547        strcpy(card->driver, pcm->name);
     
    577603        if (!cards) {
    578604#ifdef MODULE
    579                 snd_printk(IDENT " soundcard not found or device busy\n");
     605                printk(KERN_ERR IDENT " soundcard not found or device busy\n");
    580606#endif
    581607                return -ENODEV;
     
    597623#ifndef MODULE
    598624
    599 /* format is: snd-card-cs4232=snd_enable,snd_index,snd_id,snd_isapnp,snd_port,
     625/* format is: snd-cs4232=snd_enable,snd_index,snd_id,snd_isapnp,snd_port,
    600626                              snd_cport,snd_mpu_port,snd_fm_port,snd_sb_port,
    601627                              snd_irq,snd_mpu_irq,snd_dma1,snd_dma1_size,
    602628                              snd_dma2,snd_dma2_size */
    603 /* format is: snd-card-cs4236=snd_enable,snd_index,snd_id,snd_isapnp,snd_port,
     629/* format is: snd-cs4236=snd_enable,snd_index,snd_id,snd_isapnp,snd_port,
    604630                              snd_cport,snd_mpu_port,snd_fm_port,snd_sb_port,
    605631                              snd_irq,snd_mpu_irq,snd_dma1,snd_dma1_size,
     
    635661
    636662#ifdef CS4232
    637 __setup("snd-card-cs4232=", alsa_card_cs423x_setup);
     663__setup("snd-cs4232=", alsa_card_cs423x_setup);
    638664#else /* CS4236 */
    639 __setup("snd-card-cs4236=", alsa_card_cs423x_setup);
     665__setup("snd-cs4236=", alsa_card_cs423x_setup);
    640666#endif
    641667
  • GPL/branches/alsa-resync1/alsa-kernel/isa/dt0197h.c

    r32 r92  
    1616    You should have received a copy of the GNU General Public License
    1717    along with this program; if not, write to the Free Software
    18     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     18    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    1919*/
    2020
    21 #define SNDRV_MAIN_OBJECT_FILE
    2221#include <sound/driver.h>
     22#include <linux/init.h>
     23#include <linux/sched.h>
     24#include <linux/wait.h>
     25#include <sound/core.h>
    2326#define SNDRV_GET_ID
    2427#include <sound/initval.h>
     
    2932#define chip_t sb_t
    3033
     34#define PFX "dt0197h: "
     35
    3136EXPORT_NO_SYMBOLS;
     37
     38MODULE_AUTHOR("Massimo Piccioni <dafastidio@libero.it>");
    3239MODULE_DESCRIPTION("Diamond Technologies DT-0197H");
     40MODULE_LICENSE("GPL");
    3341MODULE_CLASSES("{sound}");
    3442MODULE_DEVICES("{{Diamond Technologies,DT-0197H}}");
     
    147155
    148156        if (pdev->activate(pdev)<0) {
    149                 snd_printk("AUDIO isapnp configure failure\n");
     157                printk(KERN_ERR PFX "AUDIO isapnp configure failure\n");
    150158                return -EBUSY;
    151159        }
     
    167175
    168176        if (pdev->activate(pdev)<0) {
    169                 snd_printk("MPU-401 isapnp configure failure\n");
     177                printk(KERN_ERR PFX "MPU-401 isapnp configure failure\n");
    170178                snd_mpu_port[dev] = -1;
    171179                acard->devmpu = NULL;
     
    183191
    184192        if (pdev->activate(pdev)<0) {
    185                 snd_printk("OPL isapnp configure failure\n");
     193                printk(KERN_ERR PFX "OPL isapnp configure failure\n");
    186194                snd_fm_port[dev] = -1;
    187195                acard->devopl = NULL;
     
    241249        }
    242250#else
    243         snd_printk("you have to enable PnP support ...\n");
     251        printk(KERN_ERR PFX "you have to enable PnP support ...\n");
    244252        snd_card_free(card);
    245253        return -ENOSYS;
     
    273281                                        SA_INTERRUPT,
    274282                                        NULL) < 0)
    275                         snd_printk("no MPU-401 device at 0x%lx ?\n",
     283                        printk(KERN_ERR PFX "no MPU-401 device at 0x%lx ?\n",
    276284                                snd_mpu_port[dev]);
    277285        }
     
    282290                                    snd_fm_port[dev] + 2,
    283291                                    OPL3_HW_AUTO, 0, &opl3) < 0) {
    284                         snd_printk("no OPL device at 0x%lx-0x%lx ?\n",
     292                        printk(KERN_ERR PFX "no OPL device at 0x%lx-0x%lx ?\n",
    285293                                snd_fm_port[dev], snd_fm_port[dev] + 2);
    286294                } else {
     
    338346        cards += isapnp_probe_cards(snd_dt0197h_pnpids, snd_dt0197h_isapnp_detect);
    339347#else
    340         snd_printk("you have to enable ISA PnP support.\n");
     348        printk(KERN_ERR PFX "you have to enable ISA PnP support.\n");
    341349#endif
    342350#ifdef MODULE
    343351        if (!cards)
    344                 snd_printk("no DT-0197H based soundcards found\n");
     352                printk(KERN_ERR "no DT-0197H based soundcards found\n");
    345353#endif
    346354        return cards ? 0 : -ENODEV;
     
    360368#ifndef MODULE
    361369
    362 /* format is: snd-card-dt0197h=snd_enable,snd_index,snd_id,snd_isapnp,
     370/* format is: snd-dt0197h=snd_enable,snd_index,snd_id,snd_isapnp,
    363371                               snd_port,snd_mpu_port,snd_fm_port,
    364372                               snd_irq,snd_mpu_irq,snd_dma8,snd_dma8_size */
     
    383391}
    384392
    385 __setup("snd-card-dt0197h=", alsa_card_dt0197h_setup);
     393__setup("snd-dt0197h=", alsa_card_dt0197h_setup);
    386394
    387395#endif /* ifndef MODULE */
  • GPL/branches/alsa-resync1/alsa-kernel/isa/es1688/es1688.c

    r32 r92  
    1616 *   You should have received a copy of the GNU General Public License
    1717 *   along with this program; if not, write to the Free Software
    18  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     18 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    1919 *
    2020 */
    2121
    22 #define SNDRV_MAIN_OBJECT_FILE
    2322#include <sound/driver.h>
     23#include <asm/dma.h>
     24#include <linux/init.h>
     25#include <linux/time.h>
     26#include <linux/wait.h>
     27#include <sound/core.h>
    2428#include <sound/es1688.h>
    2529#include <sound/mpu401.h>
     
    3438
    3539EXPORT_NO_SYMBOLS;
     40
     41MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
    3642MODULE_DESCRIPTION("ESS ESx688 AudioDrive");
     43MODULE_LICENSE("GPL");
    3744MODULE_CLASSES("{sound}");
    3845MODULE_DEVICES("{{ESS,ES688 PnP AudioDrive,pnp:ESS0100},"
     
    131138
    132139        if ((snd_opl3_create(card, chip->port, chip->port + 2, OPL3_HW_OPL3, 0, &opl3)) < 0) {
    133                 snd_printk("opl3 not detected at 0x%lx\n", chip->port);
     140                printk(KERN_ERR "es1688: opl3 not detected at 0x%lx\n", chip->port);
    134141        } else {
    135142                if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
     
    212219#ifndef MODULE
    213220
    214 /* format is: snd-card-es1688=snd_enable,snd_index,snd_id,
     221/* format is: snd-es1688=snd_enable,snd_index,snd_id,
    215222                              snd_port,snd_mpu_port,
    216223                              snd_irq,snd_mpu_irq,
     
    235242}
    236243
    237 __setup("snd-card-es1688=", alsa_card_es1688_setup);
     244__setup("snd-es1688=", alsa_card_es1688_setup);
    238245
    239246#endif /* ifndef MODULE */
  • GPL/branches/alsa-resync1/alsa-kernel/isa/es1688/es1688_lib.c

    r32 r92  
    1616 *   You should have received a copy of the GNU General Public License
    1717 *   along with this program; if not, write to the Free Software
    18  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     18 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    1919 *
    2020 */
    2121
    22 #define SNDRV_MAIN_OBJECT_FILE
    2322#include <sound/driver.h>
     23#include <asm/io.h>
     24#include <asm/dma.h>
     25#include <linux/init.h>
     26#include <linux/delay.h>
     27#include <linux/slab.h>
     28#include <sound/core.h>
    2429#include <sound/es1688.h>
     30#include <sound/initval.h>
     31
     32MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
     33MODULE_DESCRIPTION("ESS ESx688 lowlevel module");
     34MODULE_CLASSES("{sound}");
     35MODULE_LICENSE("GPL");
    2536
    2637#define chip_t es1688_t
     
    419430        /* --- */
    420431        count = -count;
    421         snd_dma_program(chip->dma8, runtime->dma_area, size, DMA_MODE_WRITE | DMA_AUTOINIT);
     432        snd_dma_program(chip->dma8, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT);
    422433        spin_lock_irqsave(&chip->reg_lock, flags);
    423434        snd_es1688_write(chip, 0xa4, (unsigned char) count);
     
    476487        /* --- */
    477488        count = -count;
    478         snd_dma_program(chip->dma8, runtime->dma_area, size, DMA_MODE_READ | DMA_AUTOINIT);
     489        snd_dma_program(chip->dma8, runtime->dma_addr, size, DMA_MODE_READ | DMA_AUTOINIT);
    479490        spin_lock_irqsave(&chip->reg_lock, flags);
    480491        snd_es1688_write(chip, 0xa4, (unsigned char) count);
     
    656667                snd_es1688_init(chip, 0);
    657668                release_resource(chip->res_port);
     669                kfree_nocheck(chip->res_port);
    658670        }
    659671        if (chip->irq >= 0)
     
    823835        chip->pcm = pcm;
    824836
    825         snd_pcm_lib_preallocate_pages_for_all(pcm, 64*1024, 64*1024, GFP_KERNEL|GFP_DMA);
     837        snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, 64*1024);
    826838
    827839        if (rpcm)
    828                 *rpcm = NULL;
     840                *rpcm = pcm;
    829841        return 0;
    830842}
  • GPL/branches/alsa-resync1/alsa-kernel/isa/es18xx.c

    r32 r92  
    1717 *   You should have received a copy of the GNU General Public License
    1818 *   along with this program; if not, write to the Free Software
    19  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     19 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    2020 *
    2121 */
     
    6565
    6666
    67 #define SNDRV_MAIN_OBJECT_FILE
    6867#include <sound/driver.h>
     68#include <asm/io.h>
     69#include <asm/dma.h>
     70#include <linux/init.h>
     71#include <linux/pm.h>
     72#include <linux/slab.h>
     73#ifndef LINUX_ISAPNP_H
     74#include <linux/isapnp.h>
     75#define isapnp_card pci_bus
     76#define isapnp_dev pci_dev
     77#endif
     78#include <sound/core.h>
    6979#include <sound/control.h>
    7080#include <sound/pcm.h>
     
    7686#define SNDRV_GET_ID
    7787#include <sound/initval.h>
     88
     89#define PFX "es18xx: "
    7890
    7991struct _snd_es18xx {
     
    114126        spinlock_t mixer_lock;
    115127        spinlock_t ctrl_lock;
     128#ifdef CONFIG_PM
     129        struct pm_dev *pm_dev;
     130        unsigned char pm_reg;
     131#endif
    116132};
    117133
     
    133149#define ES18XX_MUTEREC  0x0400  /* Record source can be muted */
    134150#define ES18XX_CONTROL  0x0800  /* Has control ports */
     151
     152/* Power Management */
     153#define ES18XX_PM       0x07
     154#define ES18XX_PM_GPO0  0x01
     155#define ES18XX_PM_GPO1  0x02
     156#define ES18XX_PM_PDR   0x03
     157#define ES18XX_PM_ANA   0x04
     158#define ES18XX_PM_FM    0x06
     159#define ES18XX_PM_SUS   0x08
    135160
    136161typedef struct _snd_es18xx es18xx_t;
     
    502527
    503528        /* Set DMA controller */
    504         snd_dma_program(chip->dma2, runtime->dma_area, size, DMA_MODE_WRITE | DMA_AUTOINIT);
     529        snd_dma_program(chip->dma2, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT);
    505530
    506531        return 0;
     
    614639
    615640        /* Set DMA controler */
    616         snd_dma_program(chip->dma1, runtime->dma_area, size, DMA_MODE_READ | DMA_AUTOINIT);
     641        snd_dma_program(chip->dma1, runtime->dma_addr, size, DMA_MODE_READ | DMA_AUTOINIT);
    617642
    618643        return 0;
     
    677702
    678703        /* Set DMA controler */
    679         snd_dma_program(chip->dma1, runtime->dma_area, size, DMA_MODE_WRITE | DMA_AUTOINIT);
     704        snd_dma_program(chip->dma1, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT);
    680705
    681706        return 0;
     
    16201645{
    16211646        if (snd_es18xx_identify(chip) < 0) {
    1622                 snd_printk("[0x%lx] ESS chip not found\n", chip->port);
     1647                printk(KERN_ERR PFX "[0x%lx] ESS chip not found\n", chip->port);
    16231648                return -ENODEV;
    16241649        }
     
    17361761        chip->pcm = pcm;
    17371762
    1738         snd_pcm_lib_preallocate_pages_for_all(pcm, 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024, GFP_KERNEL|GFP_DMA);
     1763        snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024);
    17391764
    17401765        if (rpcm)
     
    17431768}
    17441769
     1770/* Power Management support functions */
     1771#ifdef CONFIG_PM
     1772static void snd_es18xx_suspend(es18xx_t *chip)
     1773{
     1774        snd_card_t *card = chip->card;
     1775
     1776        snd_power_lock(card);
     1777        if (card->power_state == SNDRV_CTL_POWER_D3hot)
     1778                goto __skip;
     1779
     1780        snd_pcm_suspend_all(chip->pcm);
     1781
     1782        /* power down */
     1783        chip->pm_reg = (unsigned char)snd_es18xx_read(chip, ES18XX_PM);
     1784        chip->pm_reg |= (ES18XX_PM_FM | ES18XX_PM_SUS);
     1785        snd_es18xx_write(chip, ES18XX_PM, chip->pm_reg);
     1786        snd_es18xx_write(chip, ES18XX_PM, chip->pm_reg ^= ES18XX_PM_SUS);
     1787
     1788        snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
     1789      __skip:
     1790        snd_power_unlock(card);
     1791}
     1792
     1793static void snd_es18xx_resume(es18xx_t *chip)
     1794{
     1795        snd_card_t *card = chip->card;
     1796
     1797        snd_power_lock(card);
     1798        if (card->power_state == SNDRV_CTL_POWER_D0)
     1799                goto __skip;
     1800
     1801        /* restore PM register, we won't wake till (not 0x07) i/o activity though */
     1802        snd_es18xx_write(chip, ES18XX_PM, chip->pm_reg ^= ES18XX_PM_FM);
     1803
     1804        snd_power_change_state(card, SNDRV_CTL_POWER_D0);
     1805      __skip:
     1806        snd_power_unlock(card);
     1807}
     1808
     1809/* callback for control API */
     1810static int snd_es18xx_set_power_state(snd_card_t *card, unsigned int power_state)
     1811{
     1812        es18xx_t *chip = (es18xx_t *) card->power_state_private_data;
     1813        switch (power_state) {
     1814        case SNDRV_CTL_POWER_D0:
     1815        case SNDRV_CTL_POWER_D1:
     1816        case SNDRV_CTL_POWER_D2:
     1817                snd_es18xx_resume(chip);
     1818                break;
     1819        case SNDRV_CTL_POWER_D3hot:
     1820        case SNDRV_CTL_POWER_D3cold:
     1821                snd_es18xx_suspend(chip);
     1822                break;
     1823        default:
     1824                return -EINVAL;
     1825        }
     1826        return 0;
     1827}
     1828
     1829static int snd_es18xx_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data)
     1830{
     1831        es18xx_t *chip = snd_magic_cast(es18xx_t, dev->data, return 0);
     1832
     1833        switch (rqst) {
     1834        case PM_SUSPEND:
     1835                snd_es18xx_suspend(chip);
     1836                break;
     1837        case PM_RESUME:
     1838                snd_es18xx_resume(chip);
     1839                break;
     1840        }
     1841        return 0;
     1842}
     1843#endif /* CONFIG_PM */
     1844
    17451845static int snd_es18xx_free(es18xx_t *chip)
    17461846{
    1747         if (chip->res_port)
     1847#ifdef CONFIG_PM
     1848        if (chip->pm_dev)
     1849                pm_unregister(chip->pm_dev);
     1850#endif
     1851        if (chip->res_port) {
    17481852                release_resource(chip->res_port);
    1749         if (chip->res_ctrl_port)
     1853                kfree_nocheck(chip->res_port);
     1854        }
     1855        if (chip->res_ctrl_port) {
    17501856                release_resource(chip->res_ctrl_port);
    1751         if (chip->res_mpu_port)
     1857                kfree_nocheck(chip->res_ctrl_port);
     1858        }
     1859        if (chip->res_mpu_port) {
    17521860                release_resource(chip->res_mpu_port);
     1861                kfree_nocheck(chip->res_mpu_port);
     1862        }
    17531863        if (chip->irq >= 0)
    17541864                free_irq(chip->irq, (void *) chip);
     
    18091919        if ((chip->res_port = request_region(port, 16, "ES18xx")) == NULL) {
    18101920                snd_es18xx_free(chip);
    1811                 snd_printk("unable to grap ports 0x%lx-0x%lx\n", port, port + 16 - 1);
     1921                printk(KERN_ERR PFX "unable to grap ports 0x%lx-0x%lx\n", port, port + 16 - 1);
    18121922                return -EBUSY;
    18131923        }
     
    18211931        if (request_irq(irq, snd_es18xx_interrupt, SA_INTERRUPT, "ES18xx", (void *) chip)) {
    18221932                snd_es18xx_free(chip);
    1823                 snd_printk("unable to grap IRQ %d\n", irq);
     1933                printk(KERN_ERR PFX "unable to grap IRQ %d\n", irq);
    18241934                return -EBUSY;
    18251935        }
     
    18281938        if (request_dma(dma1, "ES18xx DMA 1")) {
    18291939                snd_es18xx_free(chip);
    1830                 snd_printk("unable to grap DMA1 %d\n", dma1);
     1940                printk(KERN_ERR PFX "unable to grap DMA1 %d\n", dma1);
    18311941                return -EBUSY;
    18321942        }
     
    18351945        if (request_dma(dma2, "ES18xx DMA 2")) {
    18361946                snd_es18xx_free(chip);
    1837                 snd_printk("unable to grap DMA2 %d\n", dma2);
     1947                printk(KERN_ERR PFX "unable to grap DMA2 %d\n", dma2);
    18381948                return -EBUSY;
    18391949        }
     
    19092019                if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_micpre1_control, chip))) < 0)
    19102020                        return err;
     2021                break;
    19112022        case 0x1869:
    19122023        case 0x1879:
    19132024                if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_micpre2_control, chip))) < 0)
    19142025                        return err;
     2026                break;
    19152027        }
    19162028        if (chip->caps & ES18XX_SPATIALIZER) {
     
    19432055
    19442056EXPORT_NO_SYMBOLS;
     2057MODULE_AUTHOR("Christian Fischbach <fishbach@pool.informatik.rwth-aachen.de>, Abramo Bagnara <abramo@alsa-project.org>"); 
    19452058MODULE_DESCRIPTION("ESS ES18xx AudioDrive");
     2059MODULE_LICENSE("GPL");
    19462060MODULE_CLASSES("{sound}");
    19472061MODULE_DEVICES("{{ESS,ES1868 PnP AudioDrive},"
     
    19512065                "{ESS,ES1887 PnP AudioDrive},"
    19522066                "{ESS,ES1888 PnP AudioDrive},"
    1953                 "{ESS,ES1887 AudioDrive}"
     2067                "{ESS,ES1887 AudioDrive},"
    19542068                "{ESS,ES1888 AudioDrive}}");
    19552069
    19562070static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;  /* Index 0-MAX */
    19572071static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;   /* ID for this card */
    1958 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE;      /* Enable this card */
     2072static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */
    19592073#ifdef __ISAPNP__
    19602074#ifdef TARGET_OS2
     
    20832197                return -EAGAIN;
    20842198        if (acard->devc->activate(acard->devc)<0) {
    2085                 snd_printk("isapnp control configure failure (out of resources?)\n");
     2199                printk(KERN_ERR PFX "isapnp control configure failure (out of resources?)\n");
    20862200                return -EAGAIN;
    20872201        }
     
    21062220                isapnp_resource_change(&pdev->irq_resource[0], snd_irq[dev], 1);
    21072221        if (pdev->activate(pdev)<0) {
    2108                 snd_printk("isapnp configure failure (out of resources?)\n");
     2222                printk(KERN_ERR PFX "isapnp configure failure (out of resources?)\n");
    21092223                acard->devc->deactivate(acard->devc);
    21102224                return -EBUSY;
     
    22222336
    22232337        if (snd_opl3_create(card, chip->fm_port, chip->fm_port + 2, OPL3_HW_OPL3, 0, &opl3) < 0) {
    2224                 snd_printk("opl3 not detected at 0x%lx\n", chip->port);
     2338                printk(KERN_ERR PFX "opl3 not detected at 0x%lx\n", chip->port);
    22252339        } else {
    22262340                if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
     
    22302344        }
    22312345
    2232         if (snd_mpu_port[dev] > SNDRV_AUTO_PORT) {
     2346        if (snd_mpu_port[dev] != SNDRV_AUTO_PORT) {
    22332347                if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_ES18XX,
    22342348                                               chip->mpu_port, 0,
     
    22402354                chip->rmidi = rmidi;
    22412355        }
     2356
     2357#ifdef CONFIG_PM
     2358        /* Power Management */
     2359        chip->pm_dev = pm_register(PM_ISA_DEV, 0, snd_es18xx_pm_callback);
     2360        if (chip->pm_dev) {
     2361                chip->pm_dev->data = chip;
     2362                /* set control api callback */
     2363                card->set_power_state = snd_es18xx_set_power_state;
     2364                card->power_state_private_data = chip;
     2365        }
     2366#endif
    22422367        sprintf(card->driver, "ES%x", chip->version);
    22432368        sprintf(card->shortname, "ESS AudioDrive ES%x", chip->version);
     
    23232448        if(!cards) {
    23242449#ifdef MODULE
    2325                 snd_printk("ESS AudioDrive ES18xx soundcard not found or device busy\n");
     2450                printk(KERN_ERR "ESS AudioDrive ES18xx soundcard not found or device busy\n");
    23262451#endif
    23272452                return -ENODEV;
     
    23432468#ifndef MODULE
    23442469
    2345 /* format is: snd-card-es18xx=snd_enable,snd_index,snd_id,snd_isapnp,
     2470/* format is: snd-es18xx=snd_enable,snd_index,snd_id,snd_isapnp,
    23462471                              snd_port,snd_mpu_port,snd_fm_port,snd_irq,
    23472472                              snd_dma1,snd_dma2 */
     
    23722497}
    23732498
    2374 __setup("snd-card-es18xx=", alsa_card_es18xx_setup);
     2499__setup("snd-es18xx=", alsa_card_es18xx_setup);
    23752500
    23762501#endif /* ifndef MODULE */
  • GPL/branches/alsa-resync1/alsa-kernel/isa/gus/gus_pcm.c

    r32 r92  
    2222 *   You should have received a copy of the GNU General Public License
    2323 *   along with this program; if not, write to the Free Software
    24  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     24 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    2525 *
    2626 */
    2727
     28#define __NO_VERSION__
    2829#include <sound/driver.h>
     30#include <asm/dma.h>
     31#include <linux/slab.h>
     32#include <sound/core.h>
    2933#include <sound/control.h>
    3034#include <sound/gus.h>
     
    9195        block.addr = addr & ~31;
    9296        block.buffer = runtime->dma_area + offset;
     97        block.buf_addr = runtime->dma_addr + offset;
    9398        block.count = count;
    9499        block.private_data = pcmp;
     
    582587        snd_gf1_i_write8(gus, SNDRV_GF1_GB_REC_DMA_CONTROL, 0); /* disable sampling */
    583588        snd_gf1_i_look8(gus, SNDRV_GF1_GB_REC_DMA_CONTROL);     /* Sampling Control Register */
    584         snd_dma_program(gus->gf1.dma2, &runtime->dma_area, gus->c_period_size, DMA_MODE_READ);
     589        snd_dma_program(gus->gf1.dma2, runtime->dma_addr, gus->c_period_size, DMA_MODE_READ);
    585590        return 0;
    586591}
     
    925930        snd_pcm_t *pcm;
    926931        snd_pcm_substream_t *substream;
    927         int err;
     932        int capture, err;
    928933
    929934        if (rpcm)
    930935                *rpcm = NULL;
    931936        card = gus->card;
     937        capture = !gus->interwave && !gus->ess_flag && !gus->ace_flag ? 1 : 0;
    932938        err = snd_pcm_new(card,
    933939                          gus->interwave ? "AMD InterWave" : "GF1",
    934940                          pcm_dev,
    935941                          gus->gf1.pcm_channels / 2,
    936                           !gus->interwave && !gus->ess_flag ? 1 : 0,
     942                          capture,
    937943                          &pcm);
    938944        if (err < 0)
     
    944950
    945951        for (substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; substream; substream = substream->next)
    946                 snd_pcm_lib_preallocate_pages(substream, 64*1024, gus->gf1.dma1 > 3 ? 128*1024 : 64*1024, GFP_KERNEL|GFP_DMA);
     952                snd_pcm_lib_preallocate_isa_pages(substream, 64*1024, gus->gf1.dma1 > 3 ? 128*1024 : 64*1024);
    947953       
    948954        pcm->info_flags = 0;
    949955        pcm->dev_subclass = SNDRV_PCM_SUBCLASS_GENERIC_MIX;
    950         if (gus->interwave && !gus->ess_flag && !gus->ace_flag) {
    951                 /* capture setup */
     956        if (capture) {
    952957                snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_gf1_pcm_capture_ops);
    953958                if (gus->gf1.dma2 == gus->gf1.dma1)
    954959                        pcm->info_flags |= SNDRV_PCM_INFO_HALF_DUPLEX;
    955                 snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream, 64*1024, gus->gf1.dma2 > 3 ? 128*1024 : 64*1024, GFP_KERNEL|GFP_DMA);
     960                snd_pcm_lib_preallocate_isa_pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream, 64*1024, gus->gf1.dma2 > 3 ? 128*1024 : 64*1024);
    956961        }
    957962        strcpy(pcm->name, pcm->id);
  • GPL/branches/alsa-resync1/alsa-kernel/isa/gus/gusclassic.c

    r32 r92  
    1616 *   You should have received a copy of the GNU General Public License
    1717 *   along with this program; if not, write to the Free Software
    18  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     18 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    1919 *
    2020 */
    2121
    22 #define SNDRV_MAIN_OBJECT_FILE
    2322#include <sound/driver.h>
     23#include <asm/dma.h>
     24#include <linux/init.h>
     25#include <linux/delay.h>
     26#include <linux/time.h>
     27#include <sound/core.h>
    2428#include <sound/gus.h>
    2529#define SNDRV_LEGACY_AUTO_PROBE
     
    3034
    3135EXPORT_NO_SYMBOLS;
     36
     37MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
    3238MODULE_DESCRIPTION("Gravis UltraSound Classic");
     39MODULE_LICENSE("GPL");
    3340MODULE_CLASSES("{sound}");
    3441MODULE_DEVICES("{{Gravis,UltraSound Classic}}");
     
    252259        if (!cards) {
    253260#ifdef MODULE
    254                 snd_printk("GUS Classic soundcard not found or device busy\n");
     261                printk(KERN_ERR "GUS Classic soundcard not found or device busy\n");
    255262#endif
    256263                return -ENODEV;
     
    272279#ifndef MODULE
    273280
    274 /* format is: snd-card-gusclassic=snd_enable,snd_index,snd_id,
     281/* format is: snd-gusclassic=snd_enable,snd_index,snd_id,
    275282                                  snd_port,snd_irq,
    276283                                  snd_dma1,snd_dma2,
     
    298305}
    299306
    300 __setup("snd-card-gusclassic=", alsa_card_gusclassic_setup);
     307__setup("snd-gusclassic=", alsa_card_gusclassic_setup);
    301308
    302309#endif /* ifndef MODULE */
  • GPL/branches/alsa-resync1/alsa-kernel/isa/gus/gusextreme.c

    r32 r92  
    1616 *   You should have received a copy of the GNU General Public License
    1717 *   along with this program; if not, write to the Free Software
    18  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     18 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    1919 *
    2020 */
    2121
    22 #define SNDRV_MAIN_OBJECT_FILE
    2322#include <sound/driver.h>
     23#include <asm/dma.h>
     24#include <linux/init.h>
     25#include <linux/delay.h>
     26#include <linux/time.h>
     27#include <sound/core.h>
    2428#include <sound/gus.h>
    2529#include <sound/es1688.h>
     
    3337
    3438EXPORT_NO_SYMBOLS;
     39
     40MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
    3541MODULE_DESCRIPTION("Gravis UltraSound Extreme");
     42MODULE_LICENSE("GPL");
    3643MODULE_CLASSES("{sound}");
    3744MODULE_DEVICES("{{Gravis,UltraSound Extreme}}");
     
    322329        if (snd_opl3_create(card, es1688->port, es1688->port + 2,
    323330                            OPL3_HW_OPL3, 0, &opl3) < 0) {
    324                 snd_printk("opl3 not detected at 0x%lx\n", es1688->port);
     331                printk(KERN_ERR "gusextreme: opl3 not detected at 0x%lx\n", es1688->port);
    325332        } else {
    326333                if ((err = snd_opl3_hwdep_new(opl3, 0, 2, NULL)) < 0) {
     
    382389        if (!cards) {
    383390#ifdef MODULE
    384                 snd_printk("GUS Extreme soundcard not found or device busy\n");
     391                printk(KERN_ERR "GUS Extreme soundcard not found or device busy\n");
    385392#endif
    386393                return -ENODEV;
     
    409416#ifndef MODULE
    410417
    411 /* format is: snd-card-gusextreme=snd_enable,snd_index,snd_id,
     418/* format is: snd-gusextreme=snd_enable,snd_index,snd_id,
    412419                                  snd_port,snd_gf1_port,snd_mpu_port,
    413420                                  snd_irq,snd_gf1_irq,snd_mpu_irq,
     
    437444}
    438445
    439 __setup("snd-card-gusextreme=", alsa_card_gusextreme_setup);
     446__setup("snd-gusextreme=", alsa_card_gusextreme_setup);
    440447
    441448#endif /* ifndef MODULE */
  • GPL/branches/alsa-resync1/alsa-kernel/isa/gus/gusmax.c

    r32 r92  
    1616 *   You should have received a copy of the GNU General Public License
    1717 *   along with this program; if not, write to the Free Software
    18  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     18 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    1919 *
    2020 */
    2121
    22 #define SNDRV_MAIN_OBJECT_FILE
    2322#include <sound/driver.h>
     23#include <asm/dma.h>
     24#include <linux/init.h>
     25#include <linux/delay.h>
     26#include <linux/time.h>
     27#include <sound/core.h>
    2428#include <sound/gus.h>
    2529#include <sound/cs4231.h>
     
    3135
    3236EXPORT_NO_SYMBOLS;
     37
     38MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
    3339MODULE_DESCRIPTION("Gravis UltraSound MAX");
     40MODULE_LICENSE("GPL");
    3441MODULE_CLASSES("{sound}");
    3542MODULE_DEVICES("{{Gravis,UltraSound MAX}}");
     
    293300        if (!gus->max_flag) {
    294301                snd_card_free(card);
    295                 snd_printk("GUS MAX soundcard was not detected at 0x%lx\n", gus->gf1.port);
     302                printk(KERN_ERR "GUS MAX soundcard was not detected at 0x%lx\n", gus->gf1.port);
    296303                return -ENODEV;
    297304        }
     
    299306        if (request_irq(irq, snd_gusmax_interrupt, SA_INTERRUPT, "GUS MAX", (void *)maxcard)) {
    300307                snd_card_free(card);
    301                 snd_printk("unable to grab IRQ %d\n", irq);
     308                printk(KERN_ERR "gusmax: unable to grab IRQ %d\n", irq);
    302309                return -EBUSY;
    303310        }
     
    388395        if (!cards) {
    389396#ifdef MODULE
    390                 snd_printk("GUS MAX soundcard not found or device busy\n");
     397                printk(KERN_ERR "GUS MAX soundcard not found or device busy\n");
    391398#endif
    392399                return -ENODEV;
     
    408415#ifndef MODULE
    409416
    410 /* format is: snd-card-gusmax=snd_enable,snd_index,snd_id,
     417/* format is: snd-gusmax=snd_enable,snd_index,snd_id,
    411418                              snd_port,snd_irq,
    412419                              snd_dma1,snd_dma2,
     
    434441}
    435442
    436 __setup("snd-card-gusmax=", alsa_card_gusmax_setup);
     443__setup("snd-gusmax=", alsa_card_gusmax_setup);
    437444
    438445#endif /* ifndef MODULE */
  • GPL/branches/alsa-resync1/alsa-kernel/isa/gus/interwave.c

    r32 r92  
    1616 *   You should have received a copy of the GNU General Public License
    1717 *   along with this program; if not, write to the Free Software
    18  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     18 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    1919 *
    2020 *   1999/07/22         Erik Inge Bolso <knan@mo.himolde.no>
     
    2323 */
    2424
    25 #define SNDRV_MAIN_OBJECT_FILE
    2625#include <sound/driver.h>
     26#include <asm/dma.h>
     27#include <linux/delay.h>
     28#include <linux/init.h>
     29#include <linux/slab.h>
     30#ifndef LINUX_ISAPNP_H
     31#include <linux/isapnp.h>
     32#define isapnp_card pci_bus
     33#define isapnp_dev pci_dev
     34#endif
     35#include <sound/core.h>
    2736#include <sound/gus.h>
    2837#include <sound/cs4231.h>
     
    3746
    3847EXPORT_NO_SYMBOLS;
     48MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
     49MODULE_CLASSES("{sound}");
     50MODULE_LICENSE("GPL");
    3951#ifndef SNDRV_STB
    4052MODULE_DESCRIPTION("AMD InterWave");
    41 MODULE_CLASSES("{sound}");
    4253MODULE_DEVICES("{{Gravis,UltraSound Plug & Play},"
    4354                "{STB,SoundRage32},"
     
    4758#else
    4859MODULE_DESCRIPTION("AMD InterWave STB with TEA6330T");
    49 MODULE_CLASSES("{sound}");
    5060MODULE_DEVICES("{{AMD,InterWave STB with TEA6330T}}");
    5161#endif
     
    5363static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;  /* Index 0-MAX */
    5464static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;   /* ID for this card */
    55 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE;      /* Enable this card */
     65static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */
    5666#ifdef __ISAPNP__
    5767#ifdef TARGET_OS2
     
    212222}
    213223
    214 static int snd_interwave_i2c_getdataline(snd_i2c_bus_t *bus)
     224static int snd_interwave_i2c_getclockline(snd_i2c_bus_t *bus)
    215225{
    216226        unsigned long port = bus->private_value;
    217227        unsigned char res;
    218228
     229        res = inb(port) & 1;
     230#if 0
     231        printk("i2c_getclockline - 0x%lx -> %i\n", port, res);
     232#endif
     233        return res;
     234}
     235
     236static int snd_interwave_i2c_getdataline(snd_i2c_bus_t *bus, int ack)
     237{
     238        unsigned long port = bus->private_value;
     239        unsigned char res;
     240
     241        if (ack)
     242                udelay(10);
    219243        res = (inb(port) & 2) >> 1;
    220244#if 0
     
    224248}
    225249
     250static snd_i2c_bit_ops_t snd_interwave_i2c_bit_ops = {
     251        setlines: snd_interwave_i2c_setlines,
     252        getclock: snd_interwave_i2c_getclockline,
     253        getdata:  snd_interwave_i2c_getdataline,
     254};
     255
    226256static int __init snd_interwave_detect_stb(struct snd_interwave *iwcard,
    227257                                           snd_gus_card_t * gus, int dev,
     
    231261        snd_i2c_bus_t *bus;
    232262        snd_card_t *card = iwcard->card;
    233         unsigned long flags;
    234263        char name[32];
    235264        int err;
     
    254283        }
    255284        sprintf(name, "InterWave-%i", card->number);
    256         if ((err = snd_i2c_bus_create(card, name, &bus)) < 0)
     285        if ((err = snd_i2c_bus_create(card, name, NULL, &bus)) < 0)
    257286                return err;
    258287        bus->private_value = port;
    259         bus->i2c_setlines = snd_interwave_i2c_setlines;
    260         bus->i2c_getdataline = snd_interwave_i2c_getdataline;
    261         SNDRV_LOCK_I2C_BUS(bus);
    262         snd_i2c_reset(bus);
    263 #if 0
    264         {
    265                 int idx, ack;
    266                 for (idx = 0; idx < 256; idx += 2) {
    267                         snd_i2c_start(bus);
    268                         ack = snd_i2c_sendbyte(bus, idx, 0);
    269                         snd_i2c_stop(bus);
    270                         if (!ack) {
    271                                 printk("i2c: scanning bus %s: found device at addr=0x%x\n",
    272                                        bus->name, idx);
    273                         }
    274                 }
    275         }
    276 #endif
    277         SNDRV_UNLOCK_I2C_BUS(bus);
     288        bus->hw_ops.bit = &snd_interwave_i2c_bit_ops;
    278289        if ((err = snd_tea6330t_detect(bus, 0)) < 0)
    279290                return err;
     
    707718#endif
    708719#ifdef SNDRV_STB
    709         if (iwcard->i2c_res)
     720        if (iwcard->i2c_res) {
    710721                release_resource(iwcard->i2c_res);
     722                kfree_nocheck(iwcard->i2c_res);
     723        }
    711724#endif
    712725        if (iwcard->irq >= 0)
     
    961974                }
    962975#ifdef MODULE
    963                 snd_printk("InterWave soundcard #%i not found at 0x%lx or device busy\n", dev, snd_port[dev]);
     976                printk(KERN_ERR "InterWave soundcard #%i not found at 0x%lx or device busy\n", dev, snd_port[dev]);
    964977#endif
    965978        }
     
    973986        if (!cards) {
    974987#ifdef MODULE
    975                 snd_printk("InterWave soundcard not found or device busy\n");
     988                printk(KERN_ERR "InterWave soundcard not found or device busy\n");
    976989#endif
    977990                return -ENODEV;
     
    9931006#ifndef MODULE
    9941007
    995 /* format is: snd-card-interwave=snd_enable,snd_index,snd_id,snd_isapnp,
     1008/* format is: snd-interwave=snd_enable,snd_index,snd_id,snd_isapnp,
    9961009                                 snd_port[,snd_port_tc],snd_irq,
    9971010                                 snd_dma1,snd_dma2,
     
    10301043
    10311044#ifndef SNDRV_STB
    1032 __setup("snd-card-interwave=", alsa_card_interwave_setup);
    1033 #else
    1034 __setup("snd-card-interwave-stb=", alsa_card_interwave_setup);
     1045__setup("snd-interwave=", alsa_card_interwave_setup);
     1046#else
     1047__setup("snd-interwave-stb=", alsa_card_interwave_setup);
    10351048#endif
    10361049
  • GPL/branches/alsa-resync1/alsa-kernel/isa/opl3sa2.c

    r32 r92  
    1616 *   You should have received a copy of the GNU General Public License
    1717 *   along with this program; if not, write to the Free Software
    18  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     18 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    1919 *
    2020 */
    2121
    22 #define SNDRV_MAIN_OBJECT_FILE
    2322#include <sound/driver.h>
     23#include <asm/io.h>
     24#include <linux/init.h>
     25#include <linux/pm.h>
     26#include <linux/slab.h>
     27#ifndef LINUX_ISAPNP_H
     28#include <linux/isapnp.h>
     29#define isapnp_card pci_bus
     30#define isapnp_dev pci_dev
     31#endif
     32#include <sound/core.h>
    2433#include <sound/cs4231.h>
    2534#include <sound/mpu401.h>
     
    2938
    3039EXPORT_NO_SYMBOLS;
     40
     41MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
    3142MODULE_DESCRIPTION("Yamaha OPL3SA2+");
     43MODULE_LICENSE("GPL");
    3244MODULE_CLASSES("{sound}");
    3345MODULE_DEVICES("{{Yamaha,YMF719E-S},"
     
    3951static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;  /* Index 0-MAX */
    4052static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;   /* ID for this card */
    41 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE;      /* Enable this card */
     53static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */
    4254#ifdef __ISAPNP__
    4355#ifdef TARGET_OS2
     
    101113MODULE_PARM_SYNTAX(snd_opl3sa3_ymode, SNDRV_ENABLED ",allows:{{0,3}},dialog:list");  /* SL Added */
    102114
    103 struct snd_opl3sa {
     115/* control ports */
     116#define OPL3SA2_PM_CTRL         0x01
     117#define OPL3SA2_SYS_CTRL                0x02
     118#define OPL3SA2_IRQ_CONFIG      0x03
     119#define OPL3SA2_IRQ_STATUS      0x04
     120#define OPL3SA2_DMA_CONFIG      0x06
     121#define OPL3SA2_MASTER_LEFT     0x07
     122#define OPL3SA2_MASTER_RIGHT    0x08
     123#define OPL3SA2_MIC             0x09
     124#define OPL3SA2_MISC            0x0A
     125
     126/* opl3sa3 only */
     127#define OPL3SA3_DGTL_DOWN       0x12
     128#define OPL3SA3_ANLG_DOWN       0x13
     129#define OPL3SA3_WIDE            0x14
     130#define OPL3SA3_BASS            0x15
     131#define OPL3SA3_TREBLE          0x16
     132
     133/* power management bits */
     134#define OPL3SA2_PM_ADOWN                0x20
     135#define OPL3SA2_PM_PSV          0x04           
     136#define OPL3SA2_PM_PDN          0x02
     137#define OPL3SA2_PM_PDX          0x01
     138
     139#define OPL3SA2_PM_D0   0x00
     140#define OPL3SA2_PM_D3   (OPL3SA2_PM_ADOWN|OPL3SA2_PM_PSV|OPL3SA2_PM_PDN|OPL3SA2_PM_PDX)
     141
     142typedef struct snd_opl3sa2 opl3sa2_t;
     143#define chip_t opl3sa2_t
     144
     145struct snd_opl3sa2 {
    104146        snd_card_t *card;
    105147        int version;            /* 2 or 3 */
     
    119161        snd_kcontrol_t *master_switch;
    120162        snd_kcontrol_t *master_volume;
     163#ifdef CONFIG_PM
     164        struct pm_dev *pm_dev;
     165        void (*cs4231_suspend)(cs4231_t *);
     166        void (*cs4231_resume)(cs4231_t *);
     167#endif
    121168};
    122169
    123 static snd_card_t *snd_opl3sa_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
     170static snd_card_t *snd_opl3sa2_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
    124171
    125172#ifdef __ISAPNP__
     
    159206#endif /* __ISAPNP__ */
    160207
    161 static unsigned char snd_opl3sa_read(unsigned long port, unsigned char reg)
    162 {
    163         unsigned long flags;
     208
     209/* read control port (w/o spinlock) */
     210static unsigned char __snd_opl3sa2_read(opl3sa2_t *chip, unsigned char reg)
     211{
    164212        unsigned char result;
    165 
    166         save_flags(flags);
    167         cli();
    168213#if 0
    169214        outb(0x1d, port);       /* password */
    170215        printk("read [0x%lx] = 0x%x\n", port, inb(port));
    171216#endif
    172         outb(reg, port);        /* register */
    173         result = inb(port + 1);
    174         restore_flags(flags);
     217        outb(reg, chip->port);  /* register */
     218        result = inb(chip->port + 1);
    175219#if 0
    176220        printk("read [0x%lx] = 0x%x [0x%x]\n", port, result, inb(port));
     
    179223}
    180224
    181 static void snd_opl3sa_write(unsigned long port,
    182                              unsigned char reg, unsigned char value)
     225/* read control port (with spinlock) */
     226static unsigned char snd_opl3sa2_read(opl3sa2_t *chip, unsigned char reg)
    183227{
    184228        unsigned long flags;
    185 
    186         save_flags(flags);
    187         cli();
     229        unsigned char result;
     230
     231        spin_lock_irqsave(&chip->reg_lock, flags);
     232        result = __snd_opl3sa2_read(chip, reg);
     233        spin_unlock_irqrestore(&chip->reg_lock, flags);
     234        return result;
     235}
     236
     237/* write control port (w/o spinlock) */
     238static void __snd_opl3sa2_write(opl3sa2_t *chip, unsigned char reg, unsigned char value)
     239{
    188240#if 0
    189241        outb(0x1d, port);       /* password */
    190242#endif
    191         outb(reg, port);        /* register */
    192         outb(value, port + 1);
    193         restore_flags(flags);
    194 }
    195 
    196 static int __init snd_opl3sa_detect(struct snd_opl3sa *oplcard)
     243        outb(reg, chip->port);  /* register */
     244        outb(value, chip->port + 1);
     245        chip->ctlregs[reg] = value;
     246}
     247
     248/* write control port (with spinlock) */
     249static void snd_opl3sa2_write(opl3sa2_t *chip, unsigned char reg, unsigned char value)
     250{
     251        unsigned long flags;
     252        spin_lock_irqsave(&chip->reg_lock, flags);
     253        __snd_opl3sa2_write(chip, reg, value);
     254        spin_unlock_irqrestore(&chip->reg_lock, flags);
     255}
     256
     257static int __init snd_opl3sa2_detect(opl3sa2_t *chip)
    197258{
    198259        snd_card_t *card;
     
    201262        char str[2];
    202263
    203         card = oplcard->card;
    204         port = oplcard->port;
    205         if ((oplcard->res_port = request_region(port, 2, "OPL3-SA control")) == NULL)
     264        card = chip->card;
     265        port = chip->port;
     266        if ((chip->res_port = request_region(port, 2, "OPL3-SA control")) == NULL)
    206267                return -EBUSY;
    207         // snd_printk("REG 0A = 0x%x\n", snd_opl3sa_read(port, 0x0a));
    208         oplcard->version = 0;
    209         tmp = snd_opl3sa_read(port, 0x0a);
     268        // snd_printk("REG 0A = 0x%x\n", snd_opl3sa2_read(chip, 0x0a));
     269        chip->version = 0;
     270        tmp = snd_opl3sa2_read(chip, OPL3SA2_MISC);
    210271        if (tmp == 0xff) {
    211272                snd_printd("OPL3-SA [0x%lx] detect = 0x%x\n", port, tmp);
     
    214275        switch (tmp & 0x07) {
    215276        case 0x01:
    216                 oplcard->version = 2;
     277                chip->version = 2; /* YMF711 */
    217278                break;
    218279        default:
    219                 oplcard->version = 3;
     280                chip->version = 3;
    220281                /* 0x02 - standard */
    221282                /* 0x03 - YM715B */
     
    224285                break;
    225286        }
    226         str[0] = oplcard->version + '0';
     287        str[0] = chip->version + '0';
    227288        str[1] = 0;
    228289        strcat(card->shortname, str);
    229         snd_opl3sa_write(port, 0x0a, tmp ^ 7);
    230         if ((tmp1 = snd_opl3sa_read(port, 0x0a)) != tmp) {
     290        snd_opl3sa2_write(chip, OPL3SA2_MISC, tmp ^ 7);
     291        if ((tmp1 = snd_opl3sa2_read(chip, OPL3SA2_MISC)) != tmp) {
    231292                snd_printd("OPL3-SA [0x%lx] detect (1) = 0x%x (0x%x)\n", port, tmp, tmp1);
    232293                return -ENODEV;
    233294        }
    234295        /* try if the MIC register is accesible */
    235         tmp = snd_opl3sa_read(port, 0x09);
    236         snd_opl3sa_write(port, 0x09, 0x8a);
    237         if (((tmp1 = snd_opl3sa_read(port, 0x09)) & 0x9f) != 0x8a) {
     296        tmp = snd_opl3sa2_read(chip, OPL3SA2_MIC);
     297        snd_opl3sa2_write(chip, OPL3SA2_MIC, 0x8a);
     298        if (((tmp1 = snd_opl3sa2_read(chip, OPL3SA2_MIC)) & 0x9f) != 0x8a) {
    238299                snd_printd("OPL3-SA [0x%lx] detect (2) = 0x%x (0x%x)\n", port, tmp, tmp1);
    239300                return -ENODEV;
    240301        }
    241         snd_opl3sa_write(port, 0x09, 0x9f);
     302        snd_opl3sa2_write(chip, OPL3SA2_MIC, 0x9f);
    242303        /* initialization */
    243         snd_opl3sa_write(port, 0x01, 0x00);     /* Power Management - default */
    244         if (oplcard->version > 2) {   /* SL Added */
    245                 snd_opl3sa_write(port, 0x02, (oplcard->ymode << 4)); /* SL Modified - System Control - ymode is bits 4&5 (of 0 to 7) on all but opl3sa2 versions */
    246         } else { /* SL Added */
    247                 snd_opl3sa_write(port, 0x02, 0x00);     /* SL Modified - System Control - default for opl3sa2 versions */
    248         } /* SL Added */
    249         snd_opl3sa_write(port, 0x03, 0x0d);     /* Interrupt Channel Configuration - IRQ A = OPL3 + MPU + WSS */
    250         if (oplcard->single_dma) {
    251                 snd_opl3sa_write(port, 0x06, 0x03);     /* DMA Configuration - DMA A = WSS-R + WSS-P */
     304        /* Power Management - full on */
     305        snd_opl3sa2_write(chip, OPL3SA2_PM_CTRL, OPL3SA2_PM_D0);
     306        if (chip->version > 2) {
     307                /* ymode is bits 4&5 (of 0 to 7) on all but opl3sa2 versions */
     308                snd_opl3sa2_write(chip, OPL3SA2_SYS_CTRL, (chip->ymode << 4));
    252309        } else {
    253                 snd_opl3sa_write(port, 0x06, 0x21);     /* DMA Configuration - DMA B = WSS-R, DMA A = WSS-P */
    254         }
    255         snd_opl3sa_write(port, 0x0a, 0x80 | (tmp & 7)); /* Miscellaneous - default */
    256         if (oplcard->version > 2) {
    257                 snd_opl3sa_write(port, 0x12, 0x00);     /* Digital Block Partial Power Down - default */
    258                 snd_opl3sa_write(port, 0x13, 0x00);     /* Analog Block Partial Power Down - default */
    259         }
    260         return 0;
    261 }
    262 
    263 static void snd_opl3sa_interrupt(int irq, void *dev_id, struct pt_regs *regs)
     310                /* default for opl3sa2 versions */
     311                snd_opl3sa2_write(chip, OPL3SA2_SYS_CTRL, 0x00);
     312        }
     313        snd_opl3sa2_write(chip, OPL3SA2_IRQ_CONFIG, 0x0d);      /* Interrupt Channel Configuration - IRQ A = OPL3 + MPU + WSS */
     314        if (chip->single_dma) {
     315                snd_opl3sa2_write(chip, OPL3SA2_DMA_CONFIG, 0x03);      /* DMA Configuration - DMA A = WSS-R + WSS-P */
     316        } else {
     317                snd_opl3sa2_write(chip, OPL3SA2_DMA_CONFIG, 0x21);      /* DMA Configuration - DMA B = WSS-R, DMA A = WSS-P */
     318        }
     319        snd_opl3sa2_write(chip, OPL3SA2_MISC, 0x80 | (tmp & 7));        /* Miscellaneous - default */
     320        if (chip->version > 2) {
     321                snd_opl3sa2_write(chip, OPL3SA3_DGTL_DOWN, 0x00);       /* Digital Block Partial Power Down - default */
     322                snd_opl3sa2_write(chip, OPL3SA3_ANLG_DOWN, 0x00);       /* Analog Block Partial Power Down - default */
     323        }
     324        return 0;
     325}
     326
     327static void snd_opl3sa2_interrupt(int irq, void *dev_id, struct pt_regs *regs)
    264328{
    265329        unsigned short status;
    266         struct snd_opl3sa *oplcard = (struct snd_opl3sa *) dev_id;
    267 
    268         if (oplcard == NULL || oplcard->card == NULL)
     330        opl3sa2_t *chip = dev_id;
     331
     332        if (chip == NULL || chip->card == NULL)
    269333                return;
    270334
    271         spin_lock(&oplcard->reg_lock);
    272         outb(0x04, oplcard->port);      /* register - Interrupt IRQ-A status */
    273         status = inb(oplcard->port + 1);
    274         spin_unlock(&oplcard->reg_lock);
     335        status = snd_opl3sa2_read(chip, OPL3SA2_IRQ_STATUS);
    275336
    276337        if (status & 0x20)
    277                 snd_opl3_interrupt(oplcard->synth);
    278 
    279         if ((status & 0x10) && oplcard->rmidi != NULL)
    280                 snd_mpu401_uart_interrupt(irq, oplcard->rmidi->private_data, regs);
     338                snd_opl3_interrupt(chip->synth);
     339
     340        if ((status & 0x10) && chip->rmidi != NULL)
     341                snd_mpu401_uart_interrupt(irq, chip->rmidi->private_data, regs);
    281342
    282343        if (status & 0x07)      /* TI,CI,PI */
    283                 snd_cs4231_interrupt(irq, oplcard->cs4231, regs);
    284 
    285         if (status & 0x40) {
     344                snd_cs4231_interrupt(irq, chip->cs4231, regs);
     345
     346        if (status & 0x40) { /* hardware volume change */
    286347                /* reading from Master Lch register at 0x07 clears this bit */
    287                 snd_opl3sa_read(oplcard->port, 0x08);
    288                 snd_opl3sa_read(oplcard->port, 0x07);
    289                 snd_ctl_notify(oplcard->card, SNDRV_CTL_EVENT_MASK_VALUE, &oplcard->master_switch->id);
    290                 snd_ctl_notify(oplcard->card, SNDRV_CTL_EVENT_MASK_VALUE, &oplcard->master_volume->id);
     348                snd_opl3sa2_read(chip, OPL3SA2_MASTER_RIGHT);
     349                snd_opl3sa2_read(chip, OPL3SA2_MASTER_LEFT);
     350                if (chip->master_switch && chip->master_volume) {
     351                        snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->master_switch->id);
     352                        snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->master_volume->id);
     353                }
    291354        }
    292355}
    293356
    294357#ifdef TARGET_OS2
    295 #define OPL3SA_SINGLE(xname, xindex, reg, shift, mask, invert) \
     358#define OPL3SA2_SINGLE(xname, xindex, reg, shift, mask, invert) \
    296359{ SNDRV_CTL_ELEM_IFACE_MIXER, 0, 0, xname, xindex, \
    297   0, 0, snd_opl3sa_info_single, \
    298   snd_opl3sa_get_single, snd_opl3sa_put_single, \
     360  0, 0, snd_opl3sa2_info_single, \
     361  snd_opl3sa2_get_single, snd_opl3sa2_put_single, \
    299362  reg | (shift << 8) | (mask << 16) | (invert << 24) }
    300363
    301364#else
    302 #define OPL3SA_SINGLE(xname, xindex, reg, shift, mask, invert) \
     365#define OPL3SA2_SINGLE(xname, xindex, reg, shift, mask, invert) \
    303366{ iface: SNDRV_CTL_ELEM_IFACE_MIXER, name: xname, index: xindex, \
    304   info: snd_opl3sa_info_single, \
    305   get: snd_opl3sa_get_single, put: snd_opl3sa_put_single, \
     367  info: snd_opl3sa2_info_single, \
     368  get: snd_opl3sa2_get_single, put: snd_opl3sa2_put_single, \
    306369  private_value: reg | (shift << 8) | (mask << 16) | (invert << 24) }
    307370#endif
    308371
    309 static int snd_opl3sa_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
     372static int snd_opl3sa2_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
    310373{
    311374        int mask = (kcontrol->private_value >> 16) & 0xff;
     
    318381}
    319382
    320 int snd_opl3sa_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
    321 {
    322         struct snd_opl3sa *oplcard = (struct snd_opl3sa *)_snd_kcontrol_chip(kcontrol);
     383int snd_opl3sa2_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
     384{
     385        opl3sa2_t *chip = snd_kcontrol_chip(kcontrol);
    323386        unsigned long flags;
    324387        int reg = kcontrol->private_value & 0xff;
     
    327390        int invert = (kcontrol->private_value >> 24) & 0xff;
    328391
    329         spin_lock_irqsave(&oplcard->reg_lock, flags);
    330         ucontrol->value.integer.value[0] = (oplcard->ctlregs[reg] >> shift) & mask;
    331         spin_unlock_irqrestore(&oplcard->reg_lock, flags);
     392        spin_lock_irqsave(&chip->reg_lock, flags);
     393        ucontrol->value.integer.value[0] = (chip->ctlregs[reg] >> shift) & mask;
     394        spin_unlock_irqrestore(&chip->reg_lock, flags);
    332395        if (invert)
    333396                ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0];
     
    335398}
    336399
    337 int snd_opl3sa_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
    338 {
    339         struct snd_opl3sa *oplcard = (struct snd_opl3sa *)_snd_kcontrol_chip(kcontrol);
     400int snd_opl3sa2_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
     401{
     402        opl3sa2_t *chip = snd_kcontrol_chip(kcontrol);
    340403        unsigned long flags;
    341404        int reg = kcontrol->private_value & 0xff;
     
    350413                val = mask - val;
    351414        val <<= shift;
    352         spin_lock_irqsave(&oplcard->reg_lock, flags);
    353         oval = oplcard->ctlregs[reg];
     415        spin_lock_irqsave(&chip->reg_lock, flags);
     416        oval = chip->ctlregs[reg];
    354417        val = (oval & ~(mask << shift)) | val;
    355418        change = val != oval;
    356         snd_opl3sa_write(oplcard->port, reg, oplcard->ctlregs[reg] = val);
    357         spin_unlock_irqrestore(&oplcard->reg_lock, flags);
     419        __snd_opl3sa2_write(chip, reg, val);
     420        spin_unlock_irqrestore(&chip->reg_lock, flags);
    358421        return change;
    359422}
    360423
    361424#ifdef TARGET_OS2
    362 #define OPL3SA_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \
     425#define OPL3SA2_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \
    363426{ SNDRV_CTL_ELEM_IFACE_MIXER, 0, 0, xname, xindex, \
    364   0, 0, snd_opl3sa_info_double, \
    365   snd_opl3sa_get_double, snd_opl3sa_put_double, \
     427  0, 0, snd_opl3sa2_info_double, \
     428  snd_opl3sa2_get_double, snd_opl3sa2_put_double, \
    366429  left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) }
    367430
    368431#else
    369 #define OPL3SA_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \
     432#define OPL3SA2_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \
    370433{ iface: SNDRV_CTL_ELEM_IFACE_MIXER, name: xname, index: xindex, \
    371   info: snd_opl3sa_info_double, \
    372   get: snd_opl3sa_get_double, put: snd_opl3sa_put_double, \
     434  info: snd_opl3sa2_info_double, \
     435  get: snd_opl3sa2_get_double, put: snd_opl3sa2_put_double, \
    373436  private_value: left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) }
    374437#endif
    375438
    376 int snd_opl3sa_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
     439int snd_opl3sa2_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
    377440{
    378441        int mask = (kcontrol->private_value >> 24) & 0xff;
     
    385448}
    386449
    387 int snd_opl3sa_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
    388 {
    389         struct snd_opl3sa *oplcard = (struct snd_opl3sa *)_snd_kcontrol_chip(kcontrol);
     450int snd_opl3sa2_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
     451{
     452        opl3sa2_t *chip = snd_kcontrol_chip(kcontrol);
    390453        unsigned long flags;
    391454        int left_reg = kcontrol->private_value & 0xff;
     
    396459        int invert = (kcontrol->private_value >> 22) & 1;
    397460       
    398         spin_lock_irqsave(&oplcard->reg_lock, flags);
    399         ucontrol->value.integer.value[0] = (oplcard->ctlregs[left_reg] >> shift_left) & mask;
    400         ucontrol->value.integer.value[1] = (oplcard->ctlregs[right_reg] >> shift_right) & mask;
    401         spin_unlock_irqrestore(&oplcard->reg_lock, flags);
     461        spin_lock_irqsave(&chip->reg_lock, flags);
     462        ucontrol->value.integer.value[0] = (chip->ctlregs[left_reg] >> shift_left) & mask;
     463        ucontrol->value.integer.value[1] = (chip->ctlregs[right_reg] >> shift_right) & mask;
     464        spin_unlock_irqrestore(&chip->reg_lock, flags);
    402465        if (invert) {
    403466                ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0];
     
    407470}
    408471
    409 int snd_opl3sa_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
    410 {
    411         struct snd_opl3sa *oplcard = (struct snd_opl3sa *)_snd_kcontrol_chip(kcontrol);
     472int snd_opl3sa2_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
     473{
     474        opl3sa2_t *chip = snd_kcontrol_chip(kcontrol);
    412475        unsigned long flags;
    413476        int left_reg = kcontrol->private_value & 0xff;
     
    428491        val1 <<= shift_left;
    429492        val2 <<= shift_right;
    430         spin_lock_irqsave(&oplcard->reg_lock, flags);
     493        spin_lock_irqsave(&chip->reg_lock, flags);
    431494        if (left_reg != right_reg) {
    432                 oval1 = oplcard->ctlregs[left_reg];
    433                 oval2 = oplcard->ctlregs[right_reg];
     495                oval1 = chip->ctlregs[left_reg];
     496                oval2 = chip->ctlregs[right_reg];
    434497                val1 = (oval1 & ~(mask << shift_left)) | val1;
    435498                val2 = (oval2 & ~(mask << shift_right)) | val2;
    436499                change = val1 != oval1 || val2 != oval2;
    437                 snd_opl3sa_write(oplcard->port, left_reg, oplcard->ctlregs[left_reg] = val1);
    438                 snd_opl3sa_write(oplcard->port, right_reg, oplcard->ctlregs[right_reg] = val2);
     500                __snd_opl3sa2_write(chip, left_reg, val1);
     501                __snd_opl3sa2_write(chip, right_reg, val2);
    439502        } else {
    440                 oval1 = oplcard->ctlregs[left_reg];
     503                oval1 = chip->ctlregs[left_reg];
    441504                val1 = (oval1 & ~((mask << shift_left) | (mask << shift_right))) | val1 | val2;
    442505                change = val1 != oval1;
    443                 snd_opl3sa_write(oplcard->port, left_reg, oplcard->ctlregs[left_reg] = val1);
    444         }
    445         spin_unlock_irqrestore(&oplcard->reg_lock, flags);
     506                __snd_opl3sa2_write(chip, left_reg, val1);
     507        }
     508        spin_unlock_irqrestore(&chip->reg_lock, flags);
    446509        return change;
    447510}
    448511
    449 #define OPL3SA_CONTROLS (sizeof(snd_opl3sa_controls)/sizeof(snd_kcontrol_new_t))
    450 
    451 static snd_kcontrol_new_t snd_opl3sa_controls[] = {
    452 OPL3SA_DOUBLE("Master Playback Switch", 0, 0x07, 0x08, 7, 7, 1, 1),
    453 OPL3SA_DOUBLE("Master Playback Volume", 0, 0x07, 0x08, 0, 0, 15, 1),
    454 OPL3SA_SINGLE("Mic Playback Switch", 0, 0x09, 7, 1, 1),
    455 OPL3SA_SINGLE("Mic Playback Volume", 0, 0x09, 0, 31, 1)
     512#define OPL3SA2_CONTROLS (sizeof(snd_opl3sa2_controls)/sizeof(snd_kcontrol_new_t))
     513
     514static snd_kcontrol_new_t snd_opl3sa2_controls[] = {
     515OPL3SA2_DOUBLE("Master Playback Switch", 0, 0x07, 0x08, 7, 7, 1, 1),
     516OPL3SA2_DOUBLE("Master Playback Volume", 0, 0x07, 0x08, 0, 0, 15, 1),
     517OPL3SA2_SINGLE("Mic Playback Switch", 0, 0x09, 7, 1, 1),
     518OPL3SA2_SINGLE("Mic Playback Volume", 0, 0x09, 0, 31, 1)
    456519};
    457520
    458 #define OPL3SA_TONE_CONTROLS (sizeof(snd_opl3sa_tone_controls)/sizeof(snd_kcontrol_new_t))
    459 
    460 static snd_kcontrol_new_t snd_opl3sa_tone_controls[] = {
    461 OPL3SA_DOUBLE("3D Control - Wide", 0, 0x14, 0x14, 4, 0, 7, 0),
    462 OPL3SA_DOUBLE("Tone Control - Bass", 0, 0x15, 0x15, 4, 0, 7, 0),
    463 OPL3SA_DOUBLE("Tone Control - Treble", 0, 0x16, 0x16, 4, 0, 7, 0)
     521#define OPL3SA2_TONE_CONTROLS (sizeof(snd_opl3sa2_tone_controls)/sizeof(snd_kcontrol_new_t))
     522
     523static snd_kcontrol_new_t snd_opl3sa2_tone_controls[] = {
     524OPL3SA2_DOUBLE("3D Control - Wide", 0, 0x14, 0x14, 4, 0, 7, 0),
     525OPL3SA2_DOUBLE("Tone Control - Bass", 0, 0x15, 0x15, 4, 0, 7, 0),
     526OPL3SA2_DOUBLE("Tone Control - Treble", 0, 0x16, 0x16, 4, 0, 7, 0)
    464527};
    465528
    466 static void snd_opl3sa_master_free(snd_kcontrol_t *kcontrol)
    467 {
    468         struct snd_opl3sa *oplcard = (struct snd_opl3sa *)_snd_kcontrol_chip(kcontrol);
    469        
    470         oplcard->master_switch = NULL;
    471         oplcard->master_volume = NULL;
    472 }
    473 
    474 static int __init snd_opl3sa_mixer(struct snd_opl3sa *oplcard)
    475 {
    476         snd_card_t *card = oplcard->card;
     529static void snd_opl3sa2_master_free(snd_kcontrol_t *kcontrol)
     530{
     531        opl3sa2_t *chip = _snd_kcontrol_chip(kcontrol);
     532        chip->master_switch = NULL;
     533        chip->master_volume = NULL;
     534}
     535
     536static int __init snd_opl3sa2_mixer(opl3sa2_t *chip)
     537{
     538        snd_card_t *card = chip->card;
    477539        snd_ctl_elem_id_t id1, id2;
    478540        snd_kcontrol_t *kctl;
     
    501563                return err;
    502564        /* add OPL3SA2 controls */
    503         for (idx = 0; idx < OPL3SA_CONTROLS; idx++) {
    504                 if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_opl3sa_controls[idx], oplcard))) < 0)
     565        for (idx = 0; idx < OPL3SA2_CONTROLS; idx++) {
     566                if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_opl3sa2_controls[idx], chip))) < 0)
    505567                        return err;
    506568                switch (idx) {
    507                 case 0: oplcard->master_switch = kctl; kctl->private_free = snd_opl3sa_master_free; break;
    508                 case 1: oplcard->master_volume = kctl; kctl->private_free = snd_opl3sa_master_free; break;
     569                case 0: chip->master_switch = kctl; kctl->private_free = snd_opl3sa2_master_free; break;
     570                case 1: chip->master_volume = kctl; kctl->private_free = snd_opl3sa2_master_free; break;
    509571                }
    510572        }
    511         if (oplcard->version > 2) {
    512                 for (idx = 0; idx < OPL3SA_TONE_CONTROLS; idx++)
    513                         if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_opl3sa_tone_controls[idx], oplcard))) < 0)
     573        if (chip->version > 2) {
     574                for (idx = 0; idx < OPL3SA2_TONE_CONTROLS; idx++)
     575                        if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_opl3sa2_tone_controls[idx], chip))) < 0)
    514576                                return err;
    515577        }
     
    517579}
    518580
    519 #ifdef __ISAPNP__
    520 static int __init snd_opl3sa_isapnp(int dev, struct snd_opl3sa *oplcard)
     581/* Power Management support functions */
     582#ifdef CONFIG_PM
     583static void snd_opl3sa2_suspend(opl3sa2_t *chip)
     584{
     585        snd_card_t *card = chip->card;
     586
     587        snd_power_lock(card);
     588        if (card->power_state == SNDRV_CTL_POWER_D3hot)
     589                goto __skip;
     590
     591        /* FIXME: is this order ok? */
     592        chip->cs4231_suspend(chip->cs4231);
     593        snd_pcm_suspend_all(chip->cs4231->pcm);
     594
     595        /* power down */
     596        snd_opl3sa2_write(chip, OPL3SA2_PM_CTRL, OPL3SA2_PM_D3);
     597
     598        snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
     599      __skip:
     600        snd_power_unlock(card);
     601}
     602
     603static void snd_opl3sa2_resume(opl3sa2_t *chip)
     604{
     605        snd_card_t *card = chip->card;
     606        int i;
     607
     608        snd_power_lock(card);
     609        if (card->power_state == SNDRV_CTL_POWER_D0)
     610                goto __skip;
     611
     612        /* power up */
     613        snd_opl3sa2_write(chip, OPL3SA2_PM_CTRL, OPL3SA2_PM_D0);
     614
     615        /* restore registers */
     616        for (i = 2; i <= 0x0a; i++) {
     617                if (i != OPL3SA2_IRQ_STATUS)
     618                        snd_opl3sa2_write(chip, i, chip->ctlregs[i]);
     619        }
     620        if (chip->version > 2) {
     621                for (i = 0x12; i <= 0x16; i++)
     622                        snd_opl3sa2_write(chip, i, chip->ctlregs[i]);
     623        }
     624        /* restore cs4231 */
     625        chip->cs4231_resume(chip->cs4231);
     626
     627        snd_power_change_state(card, SNDRV_CTL_POWER_D0);
     628      __skip:
     629        snd_power_unlock(card);
     630}
     631
     632/* callback for control API */
     633static int snd_opl3sa2_set_power_state(snd_card_t *card, unsigned int power_state)
     634{
     635        opl3sa2_t *chip = (opl3sa2_t *) card->pm_private_data;
     636        switch (power_state) {
     637        case SNDRV_CTL_POWER_D0:
     638        case SNDRV_CTL_POWER_D1:
     639        case SNDRV_CTL_POWER_D2:
     640                snd_opl3sa2_resume(chip);
     641                break;
     642        case SNDRV_CTL_POWER_D3hot:
     643        case SNDRV_CTL_POWER_D3cold:
     644                snd_opl3sa2_suspend(chip);
     645                break;
     646        default:
     647                return -EINVAL;
     648        }
     649        return 0;
     650}
     651
     652static int snd_opl3sa2_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data)
     653{
     654        opl3sa2_t *chip = snd_magic_cast(opl3sa2_t, dev->data, return 0);
     655
     656        switch (rqst) {
     657        case PM_SUSPEND:
     658                snd_opl3sa2_suspend(chip);
     659                break;
     660        case PM_RESUME:
     661                snd_opl3sa2_resume(chip);
     662                break;
     663        }
     664        return 0;
     665}
     666
     667#endif /* CONFIG_PM */
     668
     669#ifdef __ISAPNP__
     670static int __init snd_opl3sa2_isapnp(int dev, opl3sa2_t *chip)
    521671{
    522672        const struct isapnp_card_id *id = snd_opl3sa2_isapnp_id[dev];
     
    524674        struct isapnp_dev *pdev;
    525675
    526         oplcard->dev = isapnp_find_dev(card, id->devs[0].vendor, id->devs[0].function, NULL);
    527         if (oplcard->dev->active) {
    528                 oplcard->dev = NULL;
     676        chip->dev = isapnp_find_dev(card, id->devs[0].vendor, id->devs[0].function, NULL);
     677        if (chip->dev->active) {
     678                chip->dev = NULL;
    529679                return -EBUSY;
    530680        }
    531681        /* PnP initialization */
    532         pdev = oplcard->dev;
     682        pdev = chip->dev;
    533683        if (pdev->prepare(pdev)<0)
    534684                return -EAGAIN;
     
    568718}
    569719
    570 static void snd_opl3sa_deactivate(struct snd_opl3sa *oplcard)
    571 {
    572         if (oplcard->dev) {
    573                 oplcard->dev->deactivate(oplcard->dev);
    574                 oplcard->dev = NULL;
     720static void snd_opl3sa2_deactivate(opl3sa2_t *chip)
     721{
     722        if (chip->dev) {
     723                chip->dev->deactivate(chip->dev);
     724                chip->dev = NULL;
    575725        }
    576726}
    577727#endif /* __ISAPNP__ */
    578728
    579 static void snd_card_opl3sa2_free(snd_card_t *card)
    580 {
    581         struct snd_opl3sa *acard = (struct snd_opl3sa *)card->private_data;
    582 
    583         if (acard) {
    584 #ifdef __ISAPNP__
    585                 snd_opl3sa_deactivate(acard);
    586 #endif
    587                 if (acard->irq >= 0)
    588                         free_irq(acard->irq, (void *)acard);
    589                 if (acard->res_port)
    590                         release_resource(acard->res_port);
    591         }
    592 }
    593 
    594 static int __init snd_opl3sa_probe(int dev)
     729static int snd_opl3sa2_free(opl3sa2_t *chip)
     730{
     731#ifdef __ISAPNP__
     732        snd_opl3sa2_deactivate(chip);
     733#endif
     734#ifdef CONFIG_PM
     735        if (chip->pm_dev)
     736                pm_unregister(chip->pm_dev);
     737#endif
     738        if (chip->irq >= 0)
     739                free_irq(chip->irq, (void *)chip);
     740        if (chip->res_port) {
     741                release_resource(chip->res_port);
     742                kfree_nocheck(chip->res_port);
     743        }
     744        snd_magic_kfree(chip);
     745        return 0;
     746}
     747
     748static int snd_opl3sa2_dev_free(snd_device_t *device)
     749{
     750        opl3sa2_t *chip = snd_magic_cast(opl3sa2_t, device->device_data, return -ENXIO);
     751        return snd_opl3sa2_free(chip);
     752}
     753
     754static int __init snd_opl3sa2_probe(int dev)
    595755{
    596756        int irq, dma1, dma2;
    597757        snd_card_t *card;
    598         struct snd_opl3sa *oplcard;
     758        struct snd_opl3sa2 *chip;
    599759        cs4231_t *cs4231;
    600760        opl3_t *opl3;
     761        static snd_device_ops_t ops = {
     762                dev_free:       snd_opl3sa2_dev_free,
     763        };
    601764        int err;
    602765
     
    623786        }
    624787#endif
    625         card = snd_card_new(snd_index[dev], snd_id[dev], THIS_MODULE,
    626                             sizeof(struct snd_opl3sa));
     788        card = snd_card_new(snd_index[dev], snd_id[dev], THIS_MODULE, 0);
    627789        if (card == NULL)
    628790                return -ENOMEM;
    629         oplcard = (struct snd_opl3sa *)card->private_data;
    630         oplcard->irq = -1;
    631         card->private_free = snd_card_opl3sa2_free;
    632791        strcpy(card->driver, "OPL3SA2");
    633792        strcpy(card->shortname, "Yamaha OPL3-SA2");
    634 #ifdef __ISAPNP__
    635         if (snd_isapnp[dev] && snd_opl3sa_isapnp(dev, oplcard) < 0) {
    636                 snd_card_free(card);
    637                 return -EBUSY;
    638         }
    639 #endif
    640         oplcard->ymode = snd_opl3sa3_ymode[dev] & 0x03 ; /* SL Added - initialise this card from supplied (or default) parameter*/
    641         oplcard->card = card;
    642         oplcard->port = snd_port[dev];
     793        chip = snd_magic_kcalloc(opl3sa2_t, 0, GFP_KERNEL);
     794        if (chip == NULL) {
     795                err = -ENOMEM;
     796                goto __error;
     797        }
     798        chip->irq = -1;
     799        if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0)
     800                goto __error;
     801#ifdef __ISAPNP__
     802        if (snd_isapnp[dev] && (err = snd_opl3sa2_isapnp(dev, chip)) < 0)
     803                goto __error;
     804#endif
     805        chip->ymode = snd_opl3sa3_ymode[dev] & 0x03 ; /* initialise this card from supplied (or default) parameter*/
     806        chip->card = card;
     807        chip->port = snd_port[dev];
    643808        irq = snd_irq[dev];
    644809        dma1 = snd_dma1[dev];
    645810        dma2 = snd_dma2[dev];
    646811        if (dma2 < 0)
    647                 oplcard->single_dma = 1;
    648         if ((snd_opl3sa_detect(oplcard)) < 0) {
    649                 snd_card_free(card);
    650                 return -ENODEV;
    651         }
    652         if (request_irq(irq, snd_opl3sa_interrupt, SA_INTERRUPT, "OPL3-SA2/3", (void *)oplcard)) {
    653                 snd_card_free(card);
    654                 return -ENODEV;
    655         }
    656         oplcard->irq = irq;
     812                chip->single_dma = 1;
     813        if ((err = snd_opl3sa2_detect(chip)) < 0)
     814                goto __error;
     815        if (request_irq(irq, snd_opl3sa2_interrupt, SA_INTERRUPT, "OPL3-SA2/3", (void *)chip)) {
     816                err = -ENODEV;
     817                goto __error;
     818        }
     819        chip->irq = irq;
    657820        if ((err = snd_cs4231_create(card,
    658821                                     snd_wss_port[dev] + 4, -1,
     
    662825                                     &cs4231)) < 0) {
    663826                snd_printd("Oops, WSS not detected at 0x%lx\n", snd_wss_port[dev] + 4);
    664                 snd_card_free(card);
    665                 return err;
    666         }
    667         oplcard->cs4231 = cs4231;
    668         if ((err = snd_cs4231_pcm(cs4231, 0, NULL)) < 0) {
    669                 snd_card_free(card);
    670                 return err;
    671         }
    672         if ((err = snd_cs4231_mixer(cs4231)) < 0) {
    673                 snd_card_free(card);
    674                 return err;
    675         }
    676         if ((err = snd_opl3sa_mixer(oplcard)) < 0) {
    677                 snd_card_free(card);
    678                 return err;
    679         }
    680         if ((err = snd_cs4231_timer(cs4231, 0, NULL)) < 0) {
    681                 snd_card_free(card);
    682                 return err;
    683         }
     827                goto __error;
     828        }
     829        chip->cs4231 = cs4231;
     830        if ((err = snd_cs4231_pcm(cs4231, 0, NULL)) < 0)
     831                goto __error;
     832        if ((err = snd_cs4231_mixer(cs4231)) < 0)
     833                goto __error;
     834        if ((err = snd_opl3sa2_mixer(chip)) < 0)
     835                goto __error;
     836        if ((err = snd_cs4231_timer(cs4231, 0, NULL)) < 0)
     837                goto __error;
    684838        if (snd_fm_port[dev] >= 0x340 && snd_fm_port[dev] < 0x400) {
    685839                if ((err = snd_opl3_create(card, snd_fm_port[dev],
    686840                                           snd_fm_port[dev] + 2,
    687                                            OPL3_HW_OPL3, 0, &opl3)) < 0) {
    688                         snd_card_free(card);
    689                         return err;
    690                 }
    691                 if ((err = snd_opl3_timer_new(opl3, 1, 2)) < 0) {
    692                         snd_card_free(card);
    693                         return err;
    694                 }
    695                 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, &oplcard->synth)) < 0) {
    696                         snd_card_free(card);
    697                         return err;
    698                 }
     841                                           OPL3_HW_OPL3, 0, &opl3)) < 0)
     842                        goto __error;
     843                if ((err = snd_opl3_timer_new(opl3, 1, 2)) < 0)
     844                        goto __error;
     845                if ((err = snd_opl3_hwdep_new(opl3, 0, 1, &chip->synth)) < 0)
     846                        goto __error;
    699847        }
    700848        if (snd_midi_port[dev] >= 0x300 && snd_midi_port[dev] < 0x340) {
    701849                if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_OPL3SA2,
    702850                                               snd_midi_port[dev], 0,
    703                                                irq, 0, &oplcard->rmidi)) < 0) {
    704                         snd_card_free(card);
    705                         return err;
    706                 }
    707         }
     851                                               irq, 0, &chip->rmidi)) < 0)
     852                        goto __error;
     853        }
     854#ifdef CONFIG_PM
     855        /* Power Management */
     856        chip->pm_dev = pm_register(PM_ISA_DEV, 0, snd_opl3sa2_pm_callback);
     857        if (chip->pm_dev) {
     858                chip->pm_dev->data = chip;
     859                /* remember callbacks for cs4231 - they are called inside
     860                 * opl3sa2 pm callback
     861                 */
     862                chip->cs4231_suspend = chip->cs4231->suspend;
     863                chip->cs4231_resume = chip->cs4231->resume;
     864                /* now clear callbacks for cs4231 */
     865                chip->cs4231->suspend = NULL;
     866                chip->cs4231->resume = NULL;
     867                /* set control api callback */
     868                card->set_power_state = snd_opl3sa2_set_power_state;
     869                card->pm_private_data = chip;
     870        }
     871#endif
     872
    708873        sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d",
    709                 card->shortname, oplcard->port, irq, dma1);
     874                card->shortname, chip->port, irq, dma1);
    710875        if (dma2 >= 0)
    711876                sprintf(card->longname + strlen(card->longname), "&%d", dma2);
    712877
    713         if ((err = snd_card_register(card)) < 0) {
    714                 snd_card_free(card);
    715                 return err;
    716         }
    717         snd_opl3sa_cards[dev] = card;
    718         return 0;
     878        if ((err = snd_card_register(card)) < 0)
     879                goto __error;
     880
     881        snd_opl3sa2_cards[dev] = card;
     882        return 0;
     883
     884 __error:
     885        snd_card_free(card);
     886        return err;
    719887}
    720888
     
    731899                snd_opl3sa2_isapnp_cards[dev] = card;
    732900                snd_opl3sa2_isapnp_id[dev] = id;
    733                 res = snd_opl3sa_probe(dev);
     901                res = snd_opl3sa2_probe(dev);
    734902                if (res < 0)
    735903                        return res;
     
    752920                        continue;
    753921#endif
    754                 if (snd_opl3sa_probe(dev) >= 0)
     922                if (snd_opl3sa2_probe(dev) >= 0)
    755923                        cards++;
    756924        }
     
    760928        if (!cards) {
    761929#ifdef MODULE
    762                 snd_printk("Yamaha OPL3-SA soundcard not found or device busy\n");
     930                printk(KERN_ERR "Yamaha OPL3-SA soundcard not found or device busy\n");
    763931#endif
    764932                return -ENODEV;
     
    772940
    773941        for (idx = 0; idx < SNDRV_CARDS; idx++)
    774                 snd_card_free(snd_opl3sa_cards[idx]);
     942                snd_card_free(snd_opl3sa2_cards[idx]);
    775943}
    776944
     
    780948#ifndef MODULE
    781949
    782 /* format is: snd-card-opl3sa2=snd_enable,snd_index,snd_id,snd_isapnp,
     950/* format is: snd-opl3sa2=snd_enable,snd_index,snd_id,snd_isapnp,
    783951                               snd_port,snd_sb_port,snd_wss_port,snd_fm_port,
    784952                               snd_midi_port,snd_irq,snd_dma1,snd_dma2,
     
    813981}
    814982
    815 __setup("snd-card-opl3sa2=", alsa_card_opl3sa2_setup);
     983__setup("snd-opl3sa2=", alsa_card_opl3sa2_setup);
    816984
    817985#endif /* ifndef MODULE */
  • GPL/branches/alsa-resync1/alsa-kernel/isa/opti9xx/opti92x-ad1848.c

    r32 r92  
    2020    You should have received a copy of the GNU General Public License
    2121    along with this program; if not, write to the Free Software
    22     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     22    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    2323*/
    2424
    25 #define SNDRV_MAIN_OBJECT_FILE
     25
    2626#include <sound/driver.h>
     27#include <asm/io.h>
     28#include <asm/dma.h>
     29#include <linux/delay.h>
     30#include <linux/init.h>
     31#include <linux/slab.h>
     32#ifndef LINUX_ISAPNP_H
     33#include <linux/isapnp.h>
     34#define isapnp_card pci_bus
     35#define isapnp_dev pci_dev
     36#endif
     37#include <sound/core.h>
    2738#ifdef CS4231
    2839#include <sound/cs4231.h>
     
    4455
    4556EXPORT_NO_SYMBOLS;
     57MODULE_AUTHOR("Massimo Piccioni <dafastidio@libero.it>");
     58MODULE_CLASSES("{sound}");
     59MODULE_LICENSE("GPL");
    4660#ifdef OPTi93X
    4761MODULE_DESCRIPTION("OPTi93X");
    48 MODULE_CLASSES("{sound}");
    4962MODULE_DEVICES("{{OPTi,82C931/3}}");
    5063#else   /* OPTi93X */
    5164#ifdef CS4231
    5265MODULE_DESCRIPTION("OPTi92X - CS4231");
    53 MODULE_CLASSES("{sound}");
    5466MODULE_DEVICES("{{OPTi,82C924 (CS4231)},"
    5567                "{OPTi,82C925 (CS4231)}}");
    5668#else   /* CS4231 */
    5769MODULE_DESCRIPTION("OPTi92X - AD1848");
    58 MODULE_CLASSES("{sound}");
    5970MODULE_DEVICES("{{OPTi,82C924 (AD1848)},"
    60                 "{OPTi,82C925 (AD1848)}}");
     71                "{OPTi,82C925 (AD1848)},"
     72                "{OAK,Mozart}}");
    6173#endif  /* CS4231 */
    6274#endif  /* OPTi93X */
     
    10341046                ~(OPTi93X_PLAYBACK_ENABLE | OPTi93X_PLAYBACK_PIO));
    10351047
    1036         snd_dma_program(chip->dma1, runtime->dma_area, size,
     1048        snd_dma_program(chip->dma1, runtime->dma_addr, size,
    10371049                DMA_MODE_WRITE | DMA_AUTOINIT);
    10381050
     
    10671079                (unsigned char)~(OPTi93X_CAPTURE_ENABLE | OPTi93X_CAPTURE_PIO));
    10681080
    1069         snd_dma_program(chip->dma2, runtime->dma_area, size,
     1081        snd_dma_program(chip->dma2, runtime->dma_addr, size,
    10701082                DMA_MODE_READ | DMA_AUTOINIT);
    10711083
     
    12921304static int snd_opti93x_free(opti93x_t *chip)
    12931305{
    1294         if (chip->res_port)
     1306        if (chip->res_port) {
    12951307                release_resource(chip->res_port);
     1308                kfree_nocheck(chip->res_port);
     1309        }
    12961310        if (chip->dma1 >= 0) {
    12971311                disable_dma(chip->dma1);
     
    14581472        strcpy(pcm->name, snd_opti93x_chip_id(codec));
    14591473
    1460         snd_pcm_lib_preallocate_pages_for_all(pcm, 64*1024, codec->dma1 > 3 || codec->dma2 > 3 ? 128*1024 : 64*1024, GFP_KERNEL|GFP_DMA);
     1474        snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, codec->dma1 > 3 || codec->dma2 > 3 ? 128*1024 : 64*1024);
    14611475
    14621476        codec->pcm = pcm;
     
    17161730
    17171731        snd_assert(chip != NULL && chip->card != NULL, return -EINVAL);
     1732
    17181733        card = chip->card;
    17191734
     
    19912006                snd_card_opti9xx_deactivate(chip);
    19922007#endif  /* __ISAPNP__ */
    1993                 if (chip->res_mc_base)
     2008                if (chip->res_mc_base) {
    19942009                        release_resource(chip->res_mc_base);
     2010                        kfree_nocheck(chip->res_mc_base);
     2011                }
    19952012        }
    19962013}
     
    22492266#ifdef MODULE
    22502267#ifdef OPTi93X
    2251                 snd_printk("no OPTi 82C93x soundcard found\n");
    2252 #else
    2253                 snd_printk("no OPTi 82C92x soundcard found\n");
     2268                printk(KERN_ERR "no OPTi 82C93x soundcard found\n");
     2269#else
     2270                printk(KERN_ERR "no OPTi 82C92x soundcard found\n");
    22542271#endif  /* OPTi93X */
    22552272#endif
     
    22702287#ifndef MODULE
    22712288
    2272 /* format is: snd-card-opti9xx=snd_enable,snd_index,snd_id,snd_isapnp,
     2289/* format is: snd-opti9xx=snd_enable,snd_index,snd_id,snd_isapnp,
    22732290                               snd_port,snd_mpu_port,snd_fm_port,
    22742291                               snd_irq,snd_mpu_irq,
     
    23032320
    23042321#if defined(OPTi93X)
    2305 __setup("snd-card-opti93x=", alsa_card_opti9xx_setup);
     2322__setup("snd-opti93x=", alsa_card_opti9xx_setup);
    23062323#elif defined(CS4231)
    2307 __setup("snd-card-opti92x-cs4231=", alsa_card_opti9xx_setup);
    2308 #else
    2309 __setup("snd-card-opti92x-ad1848=", alsa_card_opti9xx_setup);
     2324__setup("snd-opti92x-cs4231=", alsa_card_opti9xx_setup);
     2325#else
     2326__setup("snd-opti92x-ad1848=", alsa_card_opti9xx_setup);
    23102327#endif
    23112328
  • GPL/branches/alsa-resync1/alsa-kernel/isa/sb/es968.c

    r32 r92  
    1818 You should have received a copy of the GNU General Public License
    1919 along with this program; if not, write to the Free Software
    20  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     20    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    2121 */
    2222
    23 #define SNDRV_MAIN_OBJECT_FILE
    2423#include <sound/driver.h>
     24#include <linux/init.h>
     25#include <linux/time.h>
     26#ifndef LINUX_ISAPNP_H
     27#include <linux/isapnp.h>
     28#define isapnp_card pci_bus
     29#define isapnp_dev pci_dev
     30#endif
     31#include <sound/core.h>
    2532#define SNDRV_GET_ID
    2633#include <sound/initval.h>
    2734#include <sound/sb.h>
    2835
     36#define chip_t sb_t
     37
    2938EXPORT_NO_SYMBOLS;
     39
     40MODULE_AUTHOR("Massimo Piccioni <dafastidio@libero.it>");
    3041MODULE_DESCRIPTION("ESS AudioDrive ES968");
     42MODULE_LICENSE("GPL");
    3143MODULE_CLASSES("{sound}");
    3244MODULE_DEVICES("{{ESS,AudioDrive ES968}}");
     
    3446static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;  /* Index 0-MAX */
    3547static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;   /* ID for this card */
    36 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE;      /* Enable this card */
     48static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */
    3749static long snd_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
    3850static int snd_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;    /* Pnp setup */
     
    93105                                     struct pt_regs *regs)
    94106{
    95     sb_t *chip = dev_id;
     107        sb_t *chip = snd_magic_cast(sb_t, dev_id, return);
    96108
    97109    if (chip->open & SB_OPEN_PCM) {
     
    272284#ifndef MODULE
    273285
    274 /* format is: snd-card-es968=snd_enable,snd_index,snd_id,
     286/* format is: snd-es968=snd_enable,snd_index,snd_id,
    275287 snd_port,snd_irq,snd_dma1 */
    276288
     
    291303}
    292304
    293 __setup("snd-card-es968=", alsa_card_es968_setup);
     305__setup("snd-es968=", alsa_card_es968_setup);
    294306
    295307#endif /* ifndef MODULE */
  • GPL/branches/alsa-resync1/alsa-kernel/isa/sb/sb16.c

    r32 r92  
    1616 *   You should have received a copy of the GNU General Public License
    1717 *   along with this program; if not, write to the Free Software
    18  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     18 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    1919 *
    2020 */
    2121
    22 #define SNDRV_MAIN_OBJECT_FILE
    2322#include <sound/driver.h>
     23#include <asm/dma.h>
     24#include <linux/init.h>
     25#include <linux/slab.h>
     26#ifndef LINUX_ISAPNP_H
     27#include <linux/isapnp.h>
     28#define isapnp_card pci_bus
     29#define isapnp_dev pci_dev
     30#endif
     31#include <sound/core.h>
    2432#include <sound/sb.h>
    2533#include <sound/sb16_csp.h>
     
    3442#include <sound/initval.h>
    3543
     44#define chip_t sb_t
     45
     46#ifdef SNDRV_SBAWE
     47#define PFX "sbawe: "
     48#else
     49#define PFX "sb16: "
     50#endif
     51
     52#ifndef SNDRV_SBAWE
    3653EXPORT_NO_SYMBOLS;
     54#endif
     55
     56MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
     57MODULE_LICENSE("GPL");
     58MODULE_CLASSES("{sound}");
    3759#ifndef SNDRV_SBAWE
    3860MODULE_DESCRIPTION("Sound Blaster 16");
    39 MODULE_CLASSES("{sound}");
    4061MODULE_DEVICES("{{Creative Labs,SB 16},"
    4162               "{Creative Labs,SB Vibra16S},"
     
    4566#else
    4667MODULE_DESCRIPTION("Sound Blaster AWE");
    47 MODULE_CLASSES("{sound}");
    4868MODULE_DEVICES("{{Creative Labs,SB AWE 32},"
    4969               "{Creative Labs,SB AWE 64},"
     
    5575#endif
    5676
    57 #if defined(SNDRV_SBAWE) && defined(CONFIG_SND_SEQUENCER) && defined(CONFIG_SND_SYNTH_EMU8000)
     77#if defined(SNDRV_SBAWE) && (defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE))
    5878#define SNDRV_SBAWE_EMU8000
    5979#endif
     
    6181static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;  /* Index 0-MAX */
    6282static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;   /* ID for this card */
    63 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE;      /* Enable this card */
     83static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */
    6484#ifdef __ISAPNP__
    6585#ifdef TARGET_OS2
     
    139159MODULE_PARM(snd_mic_agc, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
    140160MODULE_PARM_DESC(snd_mic_agc, "Mic Auto-Gain-Control switch.");
    141 MODULE_PARM_SYNTAX(snd_mic_agcm, SNDRV_ENABLED "," SNDRV_BOOLEAN_TRUE_DESC);
     161MODULE_PARM_SYNTAX(snd_mic_agc, SNDRV_ENABLED "," SNDRV_BOOLEAN_TRUE_DESC);
    142162#ifdef CONFIG_SND_SB16_CSP
    143163MODULE_PARM(snd_csp, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
     
    212232    ISAPNP_SB16('C','T','L',0x002b,0x0031),
    213233    /* Sound Blaster 16 PnP */
    214     ISAPNP_SB16('C','T','L',0x002c,0x0031),
     234        ISAPNP_SB16('C','T','L',0x002c,0x0031),
    215235    /* Sound Blaster Vibra16S */
    216236    ISAPNP_SB16('C','T','L',0x0051,0x0001),
     
    264284    /* Sound Blaster AWE 64 PnP */
    265285    ISAPNP_SBAWE('C','T','L',0x00e4,0x0045,0x0022),
     286        /* Sound Blaster AWE 64 PnP */
     287        ISAPNP_SBAWE('C','T','L',0x00e9,0x0045,0x0022),
    266288    /* Sound Blaster 16 PnP (AWE) */
    267289    ISAPNP_SBAWE('C','T','L',0x00ed,0x0041,0x0070),
     
    295317        return -EBUSY;
    296318    }
    297 #endif
     319#endif 
    298320    /* Audio initialization */
    299321    pdev = acard->dev;
     
    313335        isapnp_resource_change(&pdev->irq_resource[0], snd_irq[dev], 1);
    314336    if (pdev->activate(pdev) < 0) {
    315         snd_printk("isapnp configure failure (out of resources?)\n");
     337                printk(KERN_ERR PFX "isapnp configure failure (out of resources?)\n");
    316338        return -EBUSY;
    317339    }
     
    333355        return -EAGAIN;
    334356    }
    335     if (snd_awe_port[dev] != SNDRV_AUTO_PORT)
     357        if (snd_awe_port[dev] != SNDRV_AUTO_PORT) {
    336358        isapnp_resource_change(&pdev->resource[0], snd_awe_port[dev], 4);
     359