Ignore:
Timestamp:
Apr 21, 2008, 2:52:19 AM (17 years ago)
Author:
Brendan Oakley
Message:

alsa-resync1 branch merged to ALSA 1.0.4

Location:
GPL/branches/alsa-resync1/alsa-kernel
Files:
52 edited

Legend:

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

    r281 r348  
    8686                strlcpy(card->id, xid, sizeof(card->id));
    8787        }
     88        err = 0;
    8889        write_lock(&snd_card_rwlock);
    8990        if (idx < 0) {
     
    101102        } else if (idx < snd_ecards_limit) {
    102103                if (snd_cards_lock & (1 << idx))
    103                         idx = -1;       /* invalid */
     104                        err = -ENODEV;  /* invalid */
    104105        } else if (idx < SNDRV_CARDS)
    105106                snd_ecards_limit = idx + 1; /* increase the limit */
    106107        else
    107                 idx = -1;
    108         if (idx < 0) {
     108                err = -ENODEV;
     109        if (idx < 0 || err < 0) {
    109110                write_unlock(&snd_card_rwlock);
    110                 if (idx >= snd_ecards_limit)
    111                         snd_printk(KERN_ERR "card %i is out of range (0-%i)\n", idx, snd_ecards_limit-1);
     111                snd_printk(KERN_ERR "cannot find the slot for index %d (range 0-%i)\n", idx, snd_ecards_limit - 1);
    112112                goto __error;
    113113        }
  • GPL/branches/alsa-resync1/alsa-kernel/core/memalloc.c

    r206 r348  
    2727#include <linux/proc_fs.h>
    2828#include <sound/memalloc.h>
     29#ifdef CONFIG_SBUS
     30#include <asm/sbus.h>
     31#endif
    2932
    3033
     
    6568#ifdef CONFIG_PCI
    6669#if defined(__i386__) || defined(__ppc__) || defined(__x86_64__)
    67 #define HACK_PCI_ALLOC_CONSISTENT
    68 
    69 /*
    70  * A hack to allocate large buffers via pci_alloc_consistent()
    71  *
    72  * since pci_alloc_consistent always tries GFP_DMA when the requested
     70
     71/*
     72 * A hack to allocate large buffers via dma_alloc_coherent()
     73 *
     74 * since dma_alloc_coherent always tries GFP_DMA when the requested
    7375 * pci memory region is below 32bit, it happens quite often that even
    7476 * 2 order of pages cannot be allocated.
     
    7880 * with the requested region, then realloate with the original dma_mask
    7981 * again.
    80  */
    81 
    82 static void *snd_pci_hack_alloc_consistent(struct pci_dev *hwdev, size_t size,
    83                                     dma_addr_t *dma_handle)
     82 *
     83 * Really, we want to move this type of thing into dma_alloc_coherent()
     84 * so dma_mask doesn't have to be messed with.
     85 */
     86
     87static void *snd_dma_hack_alloc_coherent(struct device *dev, size_t size,
     88                                         dma_addr_t *dma_handle, int flags)
    8489{
    8590        void *ret;
    86         u64 dma_mask, cdma_mask;
    87         unsigned long mask;
    88 
    89         if (hwdev == NULL)
    90                 return pci_alloc_consistent(hwdev, size, dma_handle);
    91         dma_mask = hwdev->dma_mask;
    92         cdma_mask = hwdev->consistent_dma_mask;
    93         mask = (unsigned long)dma_mask && (unsigned long)cdma_mask;
    94         hwdev->dma_mask = 0xffffffff; /* do without masking */
    95         hwdev->consistent_dma_mask = 0xffffffff; /* do without masking */
    96         ret = pci_alloc_consistent(hwdev, size, dma_handle);
    97         hwdev->dma_mask = dma_mask; /* restore */
    98         hwdev->consistent_dma_mask = cdma_mask; /* restore */
     91        u64 dma_mask;
     92
     93        if (dev == NULL || !dev->dma_mask)
     94                return dma_alloc_coherent(dev, size, dma_handle, flags);
     95        dma_mask = *dev->dma_mask;
     96        *dev->dma_mask = 0xffffffff;    /* do without masking */
     97        ret = dma_alloc_coherent(dev, size, dma_handle, flags);
     98        *dev->dma_mask = dma_mask;      /* restore */
    9999        if (ret) {
    100100                /* obtained address is out of range? */
    101                 if (((unsigned long)*dma_handle + size - 1) & ~mask) {
     101                if (((unsigned long)*dma_handle + size - 1) & ~dma_mask) {
    102102                        /* reallocate with the proper mask */
    103                         pci_free_consistent(hwdev, size, ret, *dma_handle);
    104                         ret = pci_alloc_consistent(hwdev, size, dma_handle);
     103                        dma_free_coherent(dev, size, ret, *dma_handle);
     104                        ret = dma_alloc_coherent(dev, size, dma_handle, flags);
    105105                }
    106106        } else {
    107107                /* wish to success now with the proper mask... */
    108                 if (mask != 0xffffffffUL)
    109                         ret = pci_alloc_consistent(hwdev, size, dma_handle);
     108                if (dma_mask != 0xffffffffUL)
     109                        ret = dma_alloc_coherent(dev, size, dma_handle, flags);
    110110        }
    111111        return ret;
    112112}
    113113
    114 /* redefine pci_alloc_consistent for some architectures */
    115 #undef pci_alloc_consistent
    116 #define pci_alloc_consistent snd_pci_hack_alloc_consistent
     114/* redefine dma_alloc_coherent for some architectures */
     115#undef dma_alloc_coherent
     116#define dma_alloc_coherent snd_dma_hack_alloc_coherent
    117117
    118118#endif /* arch */
     
    395395 * Returns the pointer of the buffer, or NULL if no enoguh memory.
    396396 */
    397 void *snd_malloc_pages(unsigned long size, unsigned int dma_flags)
     397void *snd_malloc_pages(size_t size, unsigned int dma_flags)
    398398{
    399399    int pg;
     
    416416 * Releases the buffer allocated via snd_malloc_pages().
    417417 */
    418 void snd_free_pages(void *ptr, unsigned long size)
     418void snd_free_pages(void *ptr, size_t size)
    419419{
    420420    int pg;
     
    721721        {0 }, /* terminator */
    722722};
     723
     724/*
     725 * compose a snd_dma_device struct for the PCI device
     726 */
     727static inline void snd_dma_device_pci(struct snd_dma_device *dev, struct pci_dev *pci, unsigned int id)
     728{
     729        memset(dev, 0, sizeof(*dev));
     730        dev->type = SNDRV_DMA_TYPE_DEV;
     731        dev->dev = snd_dma_pci_data(pci);
     732        dev->id = id;
     733}
    723734
    724735static void __init preallocate_cards(void)
     
    846857 */
    847858EXPORT_SYMBOL(snd_dma_alloc_pages);
     859EXPORT_SYMBOL(snd_dma_alloc_pages_fallback);
    848860EXPORT_SYMBOL(snd_dma_free_pages);
     861
    849862EXPORT_SYMBOL(snd_dma_get_reserved);
    850863EXPORT_SYMBOL(snd_dma_free_reserved);
     
    854867EXPORT_SYMBOL(snd_malloc_pages_fallback);
    855868EXPORT_SYMBOL(snd_free_pages);
    856 #if defined(CONFIG_ISA) && ! defined(CONFIG_PCI)
    857 EXPORT_SYMBOL(snd_malloc_isa_pages);
    858 EXPORT_SYMBOL(snd_malloc_isa_pages_fallback);
    859 #endif
    860 #ifdef CONFIG_PCI
    861 EXPORT_SYMBOL(snd_malloc_pci_pages);
    862 EXPORT_SYMBOL(snd_malloc_pci_pages_fallback);
    863 EXPORT_SYMBOL(snd_malloc_pci_page);
    864 EXPORT_SYMBOL(snd_free_pci_pages);
    865 EXPORT_SYMBOL(snd_malloc_sgbuf_pages);
    866 EXPORT_SYMBOL(snd_free_sgbuf_pages);
    867 #endif
    868 #ifdef CONFIG_SBUS
    869 EXPORT_SYMBOL(snd_malloc_sbus_pages);
    870 EXPORT_SYMBOL(snd_malloc_sbus_pages_fallback);
    871 EXPORT_SYMBOL(snd_free_sbus_pages);
    872 #endif
    873 
  • GPL/branches/alsa-resync1/alsa-kernel/core/pcm.c

    r300 r348  
    406406    char line[64];
    407407    if (!snd_info_get_line(buffer, line, sizeof(line)))
    408         pstr->xrun_debug = !!simple_strtoul(line, NULL, 10);
     408                pstr->xrun_debug = simple_strtoul(line, NULL, 10);
    409409}
    410410#endif
  • GPL/branches/alsa-resync1/alsa-kernel/core/pcm_lib.c

    r290 r348  
    188188                                   substream->pcm->device,
    189189                                   substream->stream ? 'c' : 'p');
     190                        if (substream->pstr->xrun_debug > 1)
    190191                        dump_stack();
    191192                }
     
    219220        if ((snd_pcm_uframes_t)delta < runtime->buffer_size / 2) {
    220221#ifdef CONFIG_SND_DEBUG
    221             if (runtime->periods > 1)
     222                        if (runtime->periods > 1 && substream->pstr->xrun_debug) {
    222223                snd_printd(KERN_ERR "Unexpected hw_pointer value [1] (stream = %i, delta: -%ld, max jitter = %ld): wrong interrupt acknowledge?\n", substream->stream, (long) delta, runtime->buffer_size / 2);
     224                                if (substream->pstr->xrun_debug > 1)
     225                                        dump_stack();
     226                        }
    223227#endif
    224228            return 0;
     
    261265        if ((snd_pcm_uframes_t)delta < runtime->buffer_size / 2) {
    262266#ifdef CONFIG_SND_DEBUG
    263             if (runtime->periods > 2)
     267                        if (runtime->periods > 2 && substream->pstr->xrun_debug) {
    264268                snd_printd(KERN_ERR "Unexpected hw_pointer value [2] (stream = %i, delta: -%ld, max jitter = %ld): wrong interrupt acknowledge?\n", substream->stream, (long) delta, runtime->buffer_size / 2);
     269                                if (substream->pstr->xrun_debug > 1)
     270                                        dump_stack();
     271                        }
    265272#endif
    266273            return 0;
     
    26892696EXPORT_SYMBOL(snd_pcm_lib_preallocate_pages);
    26902697EXPORT_SYMBOL(snd_pcm_lib_preallocate_pages_for_all);
     2698EXPORT_SYMBOL(snd_pcm_sgbuf_ops_page);
    26912699EXPORT_SYMBOL(snd_pcm_lib_malloc_pages);
    26922700EXPORT_SYMBOL(snd_pcm_lib_free_pages);
    2693 #ifdef CONFIG_ISA
    2694 EXPORT_SYMBOL(snd_pcm_lib_preallocate_isa_pages);
    2695 EXPORT_SYMBOL(snd_pcm_lib_preallocate_isa_pages_for_all);
    2696 #endif
    2697 #ifdef CONFIG_PCI
    2698 EXPORT_SYMBOL(snd_pcm_lib_preallocate_pci_pages);
    2699 EXPORT_SYMBOL(snd_pcm_lib_preallocate_pci_pages_for_all);
    2700 EXPORT_SYMBOL(snd_pcm_lib_preallocate_sg_pages);
    2701 EXPORT_SYMBOL(snd_pcm_lib_preallocate_sg_pages_for_all);
    2702 EXPORT_SYMBOL(snd_pcm_sgbuf_ops_page);
    2703 #endif
    2704 #ifdef CONFIG_SBUS
    2705 EXPORT_SYMBOL(snd_pcm_lib_preallocate_sbus_pages);
    2706 EXPORT_SYMBOL(snd_pcm_lib_preallocate_sbus_pages_for_all);
    2707 #endif
  • GPL/branches/alsa-resync1/alsa-kernel/core/sgbuf.c

    r206 r348  
    2020 */
    2121
     22#include <linux/config.h>
     23#include <linux/slab.h>
     24#include <linux/mm.h>
     25#include <linux/vmalloc.h>
    2226#ifdef TARGET_OS2
    23 #include <sound/driver.h>
    24 #include <sound/core.h>
    2527#include <sound/info.h>
    2628#endif /* TARGET_OS2 */
     
    3133#define sgbuf_align_table(tbl)  ((((tbl) + SGBUF_TBL_ALIGN - 1) / SGBUF_TBL_ALIGN) * SGBUF_TBL_ALIGN)
    3234
    33 /*
    34  * shrink to the given pages.
    35  * free the unused pages
    36  */
    37 static void sgbuf_shrink(struct snd_sg_buf *sgbuf, int pages)
     35int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab)
    3836{
    39         snd_assert(sgbuf, return);
    40         if (! sgbuf->table)
    41                 return;
    42         while (sgbuf->pages > pages) {
    43                 sgbuf->pages--;
    44                 snd_free_pci_pages(sgbuf->pci, PAGE_SIZE,
    45                                    sgbuf->table[sgbuf->pages].buf,
    46                                    sgbuf->table[sgbuf->pages].addr);
    47         }
     37        struct snd_sg_buf *sgbuf = dmab->private_data;
     38        struct snd_dma_buffer tmpb;
     39        int i;
     40
     41        if (! sgbuf)
     42                return -EINVAL;
     43
     44        for (i = 0; i < sgbuf->pages; i++) {
     45                tmpb.area = sgbuf->table[i].buf;
     46                tmpb.addr = sgbuf->table[i].addr;
     47                tmpb.bytes = PAGE_SIZE;
     48                snd_dma_free_pages(&tmpb);
     49        }
     50#ifndef TARGET_OS2
     51        if (dmab->area)
     52                vunmap(dmab->area);
     53#endif
     54        dmab->area = NULL;
     55
     56        if (sgbuf->table)
     57                kfree(sgbuf->table);
     58        if (sgbuf->page_table)
     59                kfree(sgbuf->page_table);
     60        kfree(sgbuf);
     61        dmab->private_data = NULL;
     62       
     63        return 0;
    4864}
    4965
    50 /**
    51  * snd_malloc_sgbuf_pages - allocate the pages for the PCI SG buffer
    52  * @pci: the pci device pointer
    53  * @size: the requested buffer size in bytes
    54  * @dmab: the buffer record to store
    55  *
    56  * Initializes the SG-buffer table and allocates the buffer pages
    57  * for the given size.
    58  * The pages are mapped to the virtually continuous memory.
    59  *
    60  * This function is usually called from the middle-level functions such as
    61  * snd_pcm_lib_malloc_pages().
    62  *
    63  * Returns the mapped virtual address of the buffer if allocation was
    64  * successful, or NULL at error.
    65  */
    66 void *snd_malloc_sgbuf_pages(struct pci_dev *pci,
    67                              size_t size,
    68                              struct snd_dma_buffer *dmab,
     66void *snd_malloc_sgbuf_pages(const struct snd_dma_device *dev,
     67                             size_t size, struct snd_dma_buffer *dmab,
    6968                             size_t *res_size)
    7069{
    7170        struct snd_sg_buf *sgbuf;
    72         unsigned int pages;
    73         void *ptr;
    74         dma_addr_t addr;
     71        unsigned int i, pages;
     72        struct snd_dma_buffer tmpb;
    7573
    7674#ifdef DEBUG
     
    8987        }
    9088        memset(sgbuf, 0, sizeof(*sgbuf));
    91         sgbuf->pci = pci;
     89        sgbuf->dev = *dev;
     90        sgbuf->dev.type = SNDRV_DMA_TYPE_DEV;
    9291        pages = snd_sgbuf_aligned_pages(size);
    9392        sgbuf->tblsize = sgbuf_align_table(pages);
     
    9897            dprintf(("snd_malloc_sgbuf_pages failed: error allocating sgbuf->table"));
    9998#endif
    100             return NULL;
     99                goto _failed;
    101100        }
    102101        memset(sgbuf->table, 0, sizeof(*sgbuf->table) * sgbuf->tblsize);
     
    107106            dprintf(("snd_malloc_sgbuf_pages failed: error allocating sgbuf->page_table"));
    108107#endif
    109             return NULL;
     108                goto _failed;
    110109        }
    111110        memset(sgbuf->page_table, 0, sizeof(*sgbuf->page_table) * sgbuf->tblsize);
     
    114113            dprintf(("allocating %d pages",pages));
    115114#endif
    116             ptr = snd_malloc_pci_pages(sgbuf->pci, size, &addr);
    117             if (! ptr)
    118                 goto _failed;
    119115
    120116            /* allocate each page */
    121             while (sgbuf->pages < pages) {
    122                 mem_map_t *page;
    123 
    124                 sgbuf->table[sgbuf->pages].buf = (char*)ptr + PAGE_SIZE*sgbuf->pages;
    125                 sgbuf->table[sgbuf->pages].addr = addr + PAGE_SIZE*sgbuf->pages;
    126                 page = (mem_map_t *)virt_to_page((int)sgbuf->table[sgbuf->pages].buf);
    127                 sgbuf->page_table[sgbuf->pages] = page;
    128                 SetPageReserved(page);
     117        for (i = 0; i < pages; i++) {
     118                if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV,sgbuf->dev.dev, PAGE_SIZE, &tmpb) < 0) {
     119                        if (res_size == NULL)
     120                                goto _failed;
     121                        *res_size = size = sgbuf->pages * PAGE_SIZE;
     122                        break;
     123                }
     124                sgbuf->table[i].buf = tmpb.area;
     125                sgbuf->table[i].addr = tmpb.addr;
     126                sgbuf->page_table[i] = virt_to_page(tmpb.area);
    129127                sgbuf->pages++;
    130128            }
    131129
    132             memset(ptr,0,size);
    133 
    134             dmab->area = ptr;
    135130            sgbuf->size = size;
     131#ifndef TARGET_OS2
     132        dmab->area = vmap(sgbuf->page_table, sgbuf->pages, VM_MAP, PAGE_KERNEL);
     133#else
     134        dmab->area = NULL;
     135#endif
     136        if (! dmab->area)
     137                goto _failed;
    136138            return dmab->area;
    137139
     
    144146        return NULL;
    145147}
    146 
    147 
    148 /**
    149  * snd_free_sgbuf_pages - free the sg buffer
    150  * @dmab: buffer record
    151  *
    152  * Releases the pages and the SG-buffer table.
    153  *
    154  * This function is called usually from the middle-level function
    155  * such as snd_pcm_lib_free_pages().
    156  *
    157  * Returns zero if successful, or a negative error code on failure.
    158  */
    159 int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab)
    160 {
    161         struct snd_sg_buf *sgbuf = dmab->private_data;
    162 
    163         sgbuf_shrink(sgbuf, 0);
    164         if (sgbuf->table)
    165                 kfree(sgbuf->table);
    166         sgbuf->table = NULL;
    167         if (sgbuf->page_table)
    168                 kfree(sgbuf->page_table);
    169         kfree(sgbuf);
    170         dmab->private_data = NULL;
    171        
    172         return 0;
    173 }
    174 
    175 
  • GPL/branches/alsa-resync1/alsa-kernel/drivers/dummy.c

    r277 r348  
    358358    if (dpcm == NULL)
    359359        return -ENOMEM;
    360     if ((runtime->dma_area = snd_malloc_pages_fallback(MAX_BUFFER_SIZE, GFP_KERNEL, (unsigned long *) &runtime->dma_bytes)) == NULL) {
     360    if ((runtime->dma_area = snd_malloc_pages_fallback(MAX_BUFFER_SIZE, GFP_KERNEL, &runtime->dma_bytes)) == NULL) {
    361361        kfree(dpcm);
    362362        return -ENOMEM;
     
    393393    if (dpcm == NULL)
    394394        return -ENOMEM;
    395     if ((runtime->dma_area = snd_malloc_pages_fallback(MAX_BUFFER_SIZE, GFP_KERNEL, (unsigned long *) &runtime->dma_bytes)) == NULL) {
     395    if ((runtime->dma_area = snd_malloc_pages_fallback(MAX_BUFFER_SIZE, GFP_KERNEL, &runtime->dma_bytes)) == NULL) {
    396396        kfree(dpcm);
    397397        return -ENOMEM;
  • GPL/branches/alsa-resync1/alsa-kernel/drivers/mpu401/mpu401.c

    r212 r348  
    22 *  Driver for generic MPU-401 boards (UART mode only)
    33 *  Copyright (c) by Jaroslav Kysela <perex@suse.cz>
     4 *
     5 *  ACPI PnP Copyright (c) 2004 by Clemens Ladisch <clemens@ladisch.de>
     6 *  based on 8250_acpi.c
     7 *  Copyright (c) 2002-2003 Matthew Wilcox for Hewlett-Packard
     8 *  Copyright (C) 2004 Hewlett-Packard Co
     9 *       Bjorn Helgaas <bjorn.helgaas@hp.com>
    410 *
    511 *
     
    2228#include <sound/driver.h>
    2329#include <linux/init.h>
    24 #include <linux/wait.h>
    25 #include <linux/sched.h>
    26 #include <linux/slab.h>
     30#ifdef CONFIG_ACPI_BUS
     31#include <acpi/acpi_bus.h>
     32#endif
    2733#include <sound/core.h>
    2834#include <sound/mpu401.h>
    2935#define SNDRV_GET_ID
    3036#include <sound/initval.h>
    31 #include <linux/delay.h>
     37
     38#ifdef CONFIG_ACPI_BUS
     39#define USE_ACPI_PNP
     40#endif
    3241
    3342MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
     
    3948static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;       /* ID for this card */
    4049static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE;  /* Enable this card */
     50#ifdef USE_ACPI_PNP
     51static int acpipnp[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = 1 };
     52#endif
    4153static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;     /* MPU-401 port number */
    4254static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;        /* MPU-401 IRQ */
     
    5466MODULE_PARM_DESC(enable, "Enable MPU-401 device.");
    5567MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
     68#ifdef USE_ACPI_PNP
     69MODULE_PARM(acpipnp, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
     70MODULE_PARM_DESC(acpipnp, "ACPI PnP detection for MPU-401 device.");
     71MODULE_PARM_SYNTAX(acpipnp, SNDRV_ENABLED "," SNDRV_BOOLEAN_TRUE_DESC);
     72#endif
    5673MODULE_PARM(port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
    5774MODULE_PARM_DESC(port, "Port # for MPU-401 device.");
     
    6683#endif
    6784
    68 static snd_card_t *snd_mpu401_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
    69 
    70 static int __init snd_card_mpu401_probe(int dev)
     85#ifndef CONFIG_ACPI_BUS
     86struct acpi_device;
     87#endif
     88
     89static snd_card_t *snd_mpu401_legacy_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
     90static int cards;
     91
     92#ifdef USE_ACPI_PNP
     93
     94static int acpi_driver_registered;
     95
     96struct mpu401_resources {
     97        unsigned long port;
     98        int irq;
     99};
     100
     101static acpi_status __devinit snd_mpu401_acpi_resource(struct acpi_resource *res,
     102                                                      void *data)
     103{
     104        struct mpu401_resources *resources = (struct mpu401_resources *)data;
     105
     106        if (res->id == ACPI_RSTYPE_IRQ) {
     107                if (res->data.irq.number_of_interrupts > 0) {
     108#ifdef CONFIG_IA64
     109                        resources->irq = acpi_register_irq(res->data.irq.interrupts[0],
     110                                                           res->data.irq.active_high_low,
     111                                                           res->data.irq.edge_level);
     112#else
     113                        resources->irq = res->data.irq.interrupts[0];
     114#endif
     115                }
     116        } else if (res->id == ACPI_RSTYPE_IO) {
     117                if (res->data.io.range_length >= 2) {
     118                        resources->port = res->data.io.min_base_address;
     119                }
     120        }
     121        return AE_OK;
     122}
     123
     124static int __devinit snd_mpu401_acpi_pnp(int dev, struct acpi_device *device)
     125{
     126        struct mpu401_resources res;
     127        acpi_status status;
     128
     129        res.port = SNDRV_AUTO_PORT;
     130        res.irq = SNDRV_AUTO_IRQ;
     131        status = acpi_walk_resources(device->handle, METHOD_NAME__CRS,
     132                                     snd_mpu401_acpi_resource, &res);
     133        if (ACPI_FAILURE(status))
     134                return -ENODEV;
     135        if (res.port == SNDRV_AUTO_PORT || res.irq == SNDRV_AUTO_IRQ) {
     136                snd_printk(KERN_ERR "no port or irq in %s _CRS\n",
     137                           acpi_device_bid(device));
     138                return -ENODEV;
     139        }
     140        port[dev] = res.port;
     141        irq[dev] = res.irq;
     142        return 0;
     143}
     144
     145#endif /* USE_ACPI_PNP */
     146
     147static int __devinit snd_card_mpu401_probe(int dev, struct acpi_device *device)
    71148{
    72149        snd_card_t *card;
    73150        int err;
    74151
     152#ifdef USE_ACPI_PNP
     153        if (!device) {
     154#endif
    75155        if (port[dev] == SNDRV_AUTO_PORT) {
    76                 snd_printk("specify port\n");
     156                        snd_printk(KERN_ERR "specify port\n");
    77157                return -EINVAL;
    78158        }
    79159        if (irq[dev] == SNDRV_AUTO_IRQ) {
    80                 snd_printk("specify or disable IRQ port\n");
     160                        snd_printk(KERN_ERR "specify or disable IRQ port\n");
    81161                return -EINVAL;
    82162        }
     163#ifdef USE_ACPI_PNP
     164        }
     165#endif
     166
     167#ifdef USE_ACPI_PNP
     168        if (device && (err = snd_mpu401_acpi_pnp(dev, device)) < 0)
     169                return err;
     170#endif
    83171
    84172        card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
    85173        if (card == NULL)
    86174                return -ENOMEM;
    87         if (snd_mpu401_uart_new(card, 0,
    88 #ifdef CONFIG_X86_PC9800
    89                                 pc98ii[dev] ? MPU401_HW_PC98II :
    90 #endif
    91                                 MPU401_HW_MPU401,
    92                                 port[dev], 0,
    93                                 irq[dev], irq[dev] >= 0 ? SA_INTERRUPT : 0, NULL) < 0) {
    94                 printk(KERN_ERR "MPU401 not detected at 0x%lx\n", port[dev]);
    95                 snd_card_free(card);
    96                 return -ENODEV;
    97         }
    98175        strcpy(card->driver, "MPU-401 UART");
    99176        strcpy(card->shortname, card->driver);
     
    104181                strcat(card->longname, "polled");
    105182        }
     183#ifdef USE_ACPI_PNP
     184        if (device) {
     185                strcat(card->longname, ", bus id ");
     186                strlcat(card->longname, acpi_device_bid(device), sizeof(card->longname));
     187        }
     188#endif
     189        if (snd_mpu401_uart_new(card, 0,
     190#ifdef CONFIG_X86_PC9800
     191                                pc98ii[dev] ? MPU401_HW_PC98II :
     192#endif
     193                                MPU401_HW_MPU401,
     194                                port[dev], 0,
     195                                irq[dev], irq[dev] >= 0 ? SA_INTERRUPT : 0, NULL) < 0) {
     196                printk(KERN_ERR "MPU401 not detected at 0x%lx\n", port[dev]);
     197                snd_card_free(card);
     198                return -ENODEV;
     199        }
    106200        if ((err = snd_card_register(card)) < 0) {
    107201                snd_card_free(card);
    108202                return err;
    109203        }
    110         snd_mpu401_cards[dev] = card;
     204#ifdef USE_ACPI_PNP
     205        if (device)
     206                acpi_driver_data(device) = card;
     207        else
     208#endif
     209                snd_mpu401_legacy_cards[dev] = card;
     210        ++cards;
    111211        return 0;
    112212}
    113213
     214#ifdef USE_ACPI_PNP
     215
     216static int __devinit snd_mpu401_acpi_add(struct acpi_device *device)
     217{
     218        static int dev;
     219        int err;
     220
     221        for ( ; dev < SNDRV_CARDS; ++dev) {
     222                if (!enable[dev] || !acpipnp[dev])
     223                        continue;
     224                err = snd_card_mpu401_probe(dev, device);
     225                if (err < 0)
     226                        return err;
     227                ++dev;
     228                return 0;
     229        }
     230        return -ENODEV;
     231}
     232
     233static int __devexit snd_mpu401_acpi_remove(struct acpi_device *device,
     234                                            int type)
     235{
     236        snd_card_t *card;
     237
     238        if (!device)
     239                return -EINVAL;
     240        card = (snd_card_t *)acpi_driver_data(device);
     241        if (!card)
     242                return -EINVAL;
     243
     244        snd_card_disconnect(card);
     245        snd_card_free_in_thread(card);
     246        acpi_driver_data(device) = NULL;
     247        return 0;
     248}
     249
     250static struct acpi_driver snd_mpu401_acpi_driver = {
     251        .name = "MPU-401 Driver",
     252        .class = "mpu401",
     253        .ids = "PNPB006",
     254        .ops = {
     255                .add = snd_mpu401_acpi_add,
     256                .remove = __devexit_p(snd_mpu401_acpi_remove),
     257        },
     258};
     259
     260#endif /* USE_ACPI_PNP */
     261
    114262static int __init alsa_card_mpu401_init(void)
    115263{
    116         int dev, cards = 0;
    117 
     264        int dev;
     265
     266#ifdef USE_ACPI_PNP
     267        if (acpi_bus_register_driver(&snd_mpu401_acpi_driver) >= 0)
     268                acpi_driver_registered = 1;
     269#endif
    118270        for (dev = 0; dev < SNDRV_CARDS; dev++) {
    119271                if (!enable[dev])
    120272                        continue;
    121                 if (snd_card_mpu401_probe(dev) >= 0)
    122                         cards++;
     273#ifdef USE_ACPI_PNP
     274                if (acpipnp[dev] && acpi_driver_registered)
     275                        continue;
     276#endif
     277                snd_card_mpu401_probe(dev, NULL);
    123278        }
    124279        if (!cards) {
     
    126281                printk(KERN_ERR "MPU-401 device not found or device busy\n");
    127282#endif
     283#ifdef USE_ACPI_PNP
     284                if (acpi_driver_registered)
     285                        acpi_bus_unregister_driver(&snd_mpu401_acpi_driver);
     286#endif
    128287                return -ENODEV;
    129288        }
     
    135294        int idx;
    136295
     296#ifdef USE_ACPI_PNP
     297        if (acpi_driver_registered)
     298                acpi_bus_unregister_driver(&snd_mpu401_acpi_driver);
     299#endif
    137300        for (idx = 0; idx < SNDRV_CARDS; idx++)
    138                 snd_card_free(snd_mpu401_cards[idx]);
     301                snd_card_free(snd_mpu401_legacy_cards[idx]);
    139302}
    140303
     
    144307#ifndef MODULE
    145308
    146 /* format is: snd-mpu401=enable,index,id,port,irq */
     309/* format is: snd-mpu401=enable,index,id,acpipnp[,pc98ii],port,irq */
    147310
    148311static int __init alsa_card_mpu401_setup(char *str)
    149312{
    150313        static unsigned __initdata nr_dev = 0;
     314        int __attribute__ ((__unused__)) pnp = INT_MAX;
    151315
    152316        if (nr_dev >= SNDRV_CARDS)
     
    155319               get_option(&str,&index[nr_dev]) == 2 &&
    156320               get_id(&str,&id[nr_dev]) == 2 &&
     321               get_option(&str,&pnp) == 2 &&
    157322#ifdef CONFIG_X86_PC9800
    158323               get_option(&str,&pc98ii[nr_dev]) == 2 &&
     
    160325               get_option_long(&str,&port[nr_dev]) == 2 &&
    161326               get_option(&str,&irq[nr_dev]) == 2);
     327#ifdef USE_ACPI_PNP
     328        if (pnp != INT_MAX)
     329                acpipnp[nr_dev] = pnp;
     330#endif
    162331        nr_dev++;
    163332        return 1;
  • GPL/branches/alsa-resync1/alsa-kernel/drivers/serial-u16550.c

    r290 r348  
    352352
    353353    /* Do some vague tests for the presence of the uart */
    354         if (io_base == 0) {
     354        if (io_base == 0 || io_base == SNDRV_AUTO_PORT) {
    355355        return -ENODEV; /* Not configured */
    356356        }
     
    830830        }
    831831
    832     if (irq >= 0) {
     832        if (irq >= 0 && irq != SNDRV_AUTO_IRQ) {
    833833        if (request_irq(irq, snd_uart16550_interrupt,
    834834                        SA_INTERRUPT, "Serial MIDI", (void *) uart)) {
    835             uart->irq = -1;
    836835            snd_printk("irq %d busy. Using Polling.\n", irq);
    837836        } else {
  • GPL/branches/alsa-resync1/alsa-kernel/include/sound/adriver.h

    r300 r348  
    5858#endif
    5959
     60#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
    6061#ifndef TARGET_OS2
    6162#include <linux/compiler.h>
     
    6566#endif
    6667
    67 #ifdef CONFIG_PCI
     68/* for compat layer */
    6869#include <linux/pci.h>
    69 #endif
    7070
    7171#ifndef __iomem
     
    181181#endif
    182182
    183 #if !defined CONFIG_HAVE_STRLCPY && !defined TARGET_OS2
     183#endif /* < 2.6.0 */
     184
     185#ifndef TARGET_OS2
     186#ifndef CONFIG_HAVE_STRLCPY
    184187size_t snd_compat_strlcpy(char *dest, const char *src, size_t size);
    185188#define strlcpy(dest, src, size) snd_compat_strlcpy(dest, src, size)
     
    188191#endif
    189192
    190 #if !defined CONFIG_HAVE_SNPRINTF && !defined TARGET_OS2
     193#ifndef CONFIG_HAVE_SNPRINTF
    191194#include <stdarg.h>
    192195int snd_compat_snprintf(char * buf, size_t size, const char * fmt, ...);
     
    196199#endif
    197200
    198 #ifndef TARGET_OS2
    199201#ifndef CONFIG_HAVE_SCNPRINTF
    200202#define scnprintf(buf,size,fmt,args...) snprintf(buf,size,fmt,##args)
     
    332334#endif
    333335
     336#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
     337#define snd_dma_pci_data(pci)   ((struct device *)(pci))
     338#define snd_dma_isa_data()      NULL
     339#define snd_dma_sbus_data(sbus) ((struct device *)(sbus))
     340#define snd_dma_continuous_data(x)      ((struct device *)(unsigned long)(x))
     341#endif
     342
    334343/* pm_message_t type */
    335344#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 11)
  • GPL/branches/alsa-resync1/alsa-kernel/include/sound/compat_22.h

    r290 r348  
    1010#include <linux/pagemap.h>
    1111#include <linux/ioport.h>
     12
     13#ifndef likely
     14#if __GNUC__ == 2 && __GNUC_MINOR__ < 96
     15#define __builtin_expect(x, expected_value) (x)
     16#endif
     17#define likely(x)       __builtin_expect((x),1)
     18#define unlikely(x)     __builtin_expect((x),0)
     19#endif
    1220
    1321#if defined(SND_NEED_USB_WRAPPER) && (defined(CONFIG_USB) || defined(CONFIG_USB_MODULE))
     
    220228int snd_compat_release_resource(struct resource *resource);
    221229
    222 #if 0
    223 //#ifdef CONFIG_PCI
     230/* these functions are used for ISA buffer allocation, too, so they stay
     231 * outside of CONFIG_PCI
     232 */
     233#define pci_alloc_consistent snd_pci_compat_alloc_consistent
     234#define pci_free_consistent snd_pci_compat_free_consistent
     235void *snd_pci_compat_alloc_consistent(struct pci_dev *, long, dma_addr_t *);
     236void snd_pci_compat_free_consistent(struct pci_dev *, long, void *, dma_addr_t);
     237
     238#ifdef CONFIG_PCI
    224239
    225240/* New-style probing supporting hot-pluggable devices */
     
    242257//#define pci_set_power_state snd_pci_compat_set_power_state
    243258
    244 #define pci_alloc_consistent snd_pci_compat_alloc_consistent
    245 #define pci_free_consistent snd_pci_compat_free_consistent
    246259#define pci_dma_supported snd_pci_compat_dma_supported
    247260
     
    308321void snd_pci_compat_disable_device(struct pci_dev *dev);
    309322int snd_pci_compat_find_capability(struct pci_dev *dev, int cap);
    310 void *snd_pci_compat_alloc_consistent(struct pci_dev *, long, dma_addr_t *);
    311 void snd_pci_compat_free_consistent(struct pci_dev *, long, void *, dma_addr_t);
    312323int snd_pci_compat_dma_supported(struct pci_dev *, dma_addr_t mask);
    313324unsigned long snd_pci_compat_get_dma_mask(struct pci_dev *);
     
    477488        unsigned long name[((bits)+BITS_PER_LONG-1)/BITS_PER_LONG]
    478489#endif
    479 #ifndef __user
    480 #define __user
    481 #endif
    482490
    483491/**
  • GPL/branches/alsa-resync1/alsa-kernel/include/sound/core.h

    r299 r348  
    279279void *snd_kcalloc(size_t size, int flags);
    280280char *snd_kmalloc_strdup(const char *string, int flags);
    281 void *snd_malloc_pages(unsigned long size, unsigned int dma_flags);
    282 void *snd_malloc_pages_fallback(unsigned long size, unsigned int dma_flags, unsigned long *res_size);
    283281int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size_t count);
    284282int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size_t count);
  • GPL/branches/alsa-resync1/alsa-kernel/include/sound/memalloc.h

    r222 r348  
    2525#define __SOUND_MEMALLOC_H
    2626
    27 #include <linux/pci.h>
    28 #ifdef CONFIG_SBUS
    29 #include <asm/sbus.h>
    30 #endif
     27struct device;
    3128
    3229#if 0
     
    6259#define SNDRV_DMA_TYPE_DEV              2       /* generic device continuous */
    6360#define SNDRV_DMA_TYPE_DEV_SG           3       /* generic device SG-buffer */
    64 #ifdef TARGET_OS2 // Provide old types until 1.0.4
    65 #define SNDRV_DMA_TYPE_ISA              2       /* ISA continuous */
    66 #define SNDRV_DMA_TYPE_PCI              3       /* PCI continuous */
    67 #endif /* TARGET_OS2 */
    6861#define SNDRV_DMA_TYPE_SBUS             4       /* SBUS continuous */
    69 #define SNDRV_DMA_TYPE_PCI_SG           5       /* PCI SG-buffer */
    70 
    71 #ifdef CONFIG_PCI
    72 #if 0
    73 /*
    74  * compose a snd_dma_device struct for the PCI device
    75  */
    76 static inline void snd_dma_device_pci(struct snd_dma_device *dev, struct pci_dev *pci, unsigned int id)
    77 {
    78         memset(dev, 0, sizeof(*dev));
    79         dev->type = SNDRV_DMA_TYPE_PCI;
    80         dev->dev.pci = pci;
    81         dev->id = id;
    82 }
    83 #endif
    84 #endif
    8562
    8663#define __GFP_NOWARN    0
     
    9774};
    9875
    99 /* allocate/release a buffer */
    100 int snd_dma_alloc_pages(int type, struct device *dev, size_t size,
    101                         struct snd_dma_buffer *dmab);
    102 int snd_dma_alloc_pages_fallback(int type, struct device *dev, size_t size,
    103                                  struct snd_dma_buffer *dmab);
    104 void snd_dma_free_pages(struct snd_dma_buffer *dmab);
    105 
    106 /* buffer-preservation managements */
    107 #define snd_dma_pci_buf_id(pci) (((unsigned int)(pci)->vendor << 16) | (pci)->device)
    108 size_t snd_dma_get_reserved_buf(struct snd_dma_buffer *dmab, unsigned int id);
    109 int snd_dma_reserve_buf(struct snd_dma_buffer *dmab, unsigned int id);
    110 
    11176/*
    112  * Generic memory allocators
    113  */
    114 
    115 /*
    116  * continuous pages
    117  */
    118 void *snd_malloc_pages(unsigned long size, unsigned int gfp_flags);
    119 void snd_free_pages(void *ptr, unsigned long  size);
    120 
    121 #ifdef CONFIG_PCI
    122 /*
    123  * PCI continuous pages
    124  */
    125 void *snd_malloc_pci_pages(struct pci_dev *pci, size_t size, dma_addr_t *dma_addr);
    126 void *snd_malloc_pci_pages_fallback(struct pci_dev *pci, size_t size, dma_addr_t *dma_addr, size_t *res_size);
    127 void snd_free_pci_pages(struct pci_dev *pci, size_t size, void *ptr, dma_addr_t dma_addr);
    128 /* one page allocation */
    129 void *snd_malloc_pci_page(struct pci_dev *pci, dma_addr_t *dma_addr);
    130 #define snd_free_pci_page(pci,ptr,addr) snd_free_pci_pages(pci,PAGE_SIZE,ptr,addr)
    131 #endif
    132 
    133 #ifdef CONFIG_SBUS
    134 /*
    135  * SBUS continuous pages
    136  */
    137 void *snd_malloc_sbus_pages(struct sbus_dev *sdev, size_t size, dma_addr_t *dma_addr);
    138 void *snd_malloc_sbus_pages_fallback(struct sbus_dev *sdev, size_t size, dma_addr_t *dma_addr, size_t *res_size);
    139 void snd_free_sbus_pages(struct sbus_dev *sdev, size_t size, void *ptr, dma_addr_t dma_addr);
    140 #endif
    141 
    142 #ifdef CONFIG_ISA
    143 /*
    144  * ISA continuous pages
    145  */
    146 void *snd_malloc_isa_pages(size_t size, dma_addr_t *dma_addr);
    147 void *snd_malloc_isa_pages_fallback(size_t size, dma_addr_t *dma_addr, size_t *res_size);
    148 void snd_free_isa_pages(size_t size, void *ptr, dma_addr_t addr);
    149 #ifdef CONFIG_PCI
    150 #define snd_malloc_isa_pages(size, dma_addr) snd_malloc_pci_pages(NULL, size, dma_addr)
    151 #define snd_malloc_isa_pages_fallback(size, dma_addr, res_size) snd_malloc_pci_pages_fallback(NULL, size, dma_addr, res_size)
    152 #define snd_free_isa_pages(size, ptr, dma_addr) snd_free_pci_pages(NULL, size, ptr, dma_addr)
    153 #else /* !CONFIG_PCI */
    154 #define snd_free_isa_pages(size, ptr, dma_addr) snd_free_pages(ptr, size)
    155 #endif /* CONFIG_PCI */
    156 #endif /* CONFIG_ISA */
    157 
    158 #ifdef CONFIG_PCI
    159 /*
    160  * Scatter-Gather PCI pages
     77 * Scatter-Gather generic device pages
    16178 */
    16279struct snd_sg_page {
     
    17188        struct snd_sg_page *table;      /* address table */
    17289        struct page **page_table;       /* page table (for vmap/vunmap) */
    173         struct pci_dev *pci;
     90        struct snd_dma_device dev;
    17491};
    17592
     
    189106        return sgbuf->table[offset >> PAGE_SHIFT].addr + offset % PAGE_SIZE;
    190107}
    191 #endif /* CONFIG_PCI */
     108
     109
     110/* allocate/release a buffer */
     111int snd_dma_alloc_pages(int type, struct device *dev, size_t size,
     112                        struct snd_dma_buffer *dmab);
     113int snd_dma_alloc_pages_fallback(int type, struct device *dev, size_t size,
     114                                 struct snd_dma_buffer *dmab);
     115void snd_dma_free_pages(struct snd_dma_buffer *dmab);
     116
     117/* buffer-preservation managements */
     118#define snd_dma_pci_buf_id(pci) (((unsigned int)(pci)->vendor << 16) | (pci)->device)
     119size_t snd_dma_get_reserved_buf(struct snd_dma_buffer *dmab, unsigned int id);
     120int snd_dma_reserve_buf(struct snd_dma_buffer *dmab, unsigned int id);
     121
     122/* basic memory allocation functions */
     123void *snd_malloc_pages(size_t size, unsigned int gfp_flags);
     124void *snd_malloc_pages_fallback(size_t size, unsigned int gfp_flags, size_t *res_size);
     125void snd_free_pages(void *ptr, size_t size);
    192126
    193127#endif /* __SOUND_MEMALLOC_H */
     128
  • GPL/branches/alsa-resync1/alsa-kernel/include/sound/version.h

    r300 r348  
    11/* include/version.h.  Generated by configure.  */
    2 #define CONFIG_SND_VERSION "1.0.3"
     2#define CONFIG_SND_VERSION "1.0.4"
    33#define CONFIG_SND_DATE ""
  • GPL/branches/alsa-resync1/alsa-kernel/isa/ad1816a/ad1816a_lib.c

    r290 r348  
    685685        snd_ad1816a_init(chip);
    686686
    687         snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024);
     687        snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
     688                                              snd_dma_isa_data(),
     689                                              64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024);
    688690
    689691        chip->pcm = pcm;
  • GPL/branches/alsa-resync1/alsa-kernel/isa/ad1848/ad1848_lib.c

    r290 r348  
    10441044        strcpy(pcm->name, snd_ad1848_chip_id(chip));
    10451045
    1046         snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, chip->dma > 3 ? 128*1024 : 64*1024);
     1046        snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
     1047                                              snd_dma_isa_data(),
     1048                                              64*1024, chip->dma > 3 ? 128*1024 : 64*1024);
    10471049
    10481050        chip->pcm = pcm;
  • GPL/branches/alsa-resync1/alsa-kernel/isa/cmi8330.c

    r290 r348  
    443443        snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &chip->streams[SNDRV_PCM_STREAM_CAPTURE].ops);
    444444
    445         snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, 128*1024);
     445        snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
     446                                              snd_dma_isa_data(),
     447                                              64*1024, 128*1024);
    446448        chip->pcm = pcm;
    447449
  • GPL/branches/alsa-resync1/alsa-kernel/isa/cs423x/cs4231_lib.c

    r290 r348  
    16541654
    16551655#ifdef LEGACY_SUPPORT
    1656         snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024);
     1656        snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
     1657                                              snd_dma_isa_data(),
     1658                                              64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024);
    16571659#else
    16581660#  ifdef EBUS_SUPPORT
    16591661        if (chip->ebus_flag) {
    1660                 snd_pcm_lib_preallocate_pci_pages_for_all(chip->dev_u.pdev, pcm,
     1662                snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_PCI,
     1663                                                      chip->dev_u.pdev,
    16611664                                                          64*1024, 128*1024);
    16621665        } else {
    16631666#  endif
    16641667#  ifdef SBUS_SUPPORT
    1665                 snd_pcm_lib_preallocate_sbus_pages_for_all(chip->dev_u.sdev, pcm,
     1668                snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_SBUS,
     1669                                                      chip->dev_u.sdev,
    16661670                                                           64*1024, 128*1024);
    16671671#  endif
  • GPL/branches/alsa-resync1/alsa-kernel/isa/dt019x.c

    r290 r348  
    144144        dma8[dev] = pnp_dma(pdev, 0);
    145145        irq[dev] = pnp_irq(pdev, 0);
    146         snd_printdd("dt019x: found audio interface: port=0x%lx, irq=0x%lx, dma=0x%lx\n",
     146        snd_printdd("dt019x: found audio interface: port=0x%lx, irq=0x%x, dma=0x%x\n",
    147147                        port[dev],irq[dev],dma8[dev]);
    148148
     
    165165                mpu_port[dev] = pnp_port_start(pdev, 0);
    166166                mpu_irq[dev] = pnp_irq(pdev, 0);
    167                 snd_printdd("dt019x: found MPU-401: port=0x%lx, irq=0x%lx\n",
     167                snd_printdd("dt019x: found MPU-401: port=0x%lx, irq=0x%x\n",
    168168                                mpu_port[dev],mpu_irq[dev]);
    169169        } else {
     
    323323
    324324#ifdef MODULE
    325         if (!cards)
     325        if (!cards) {
     326                pnp_unregister_card_driver(&dt019x_pnpc_driver);
    326327                snd_printk(KERN_ERR "no DT-019X / ALS-007 based soundcards found\n");
     328        }
    327329#endif
    328330        return cards ? 0 : -ENODEV;
  • GPL/branches/alsa-resync1/alsa-kernel/isa/es1688/es1688.c

    r300 r348  
    187187{
    188188        static unsigned long possible_ports[] = {0x220, 0x240, 0x260, -1};
    189         int dev, cards = 0;
     189        int dev, cards = 0, i;
    190190
    191191        for (dev = cards = 0; dev < SNDRV_CARDS && enable[dev]; dev++) {
     
    195195                        cards++;
    196196        }
    197         cards += snd_legacy_auto_probe(possible_ports, snd_audiodrive_legacy_auto_probe);
     197        i = snd_legacy_auto_probe(possible_ports, snd_audiodrive_legacy_auto_probe);
     198        if (i > 0)
     199                cards += i;
     200
    198201        if (!cards) {
    199202#ifdef MODULE
  • GPL/branches/alsa-resync1/alsa-kernel/isa/es1688/es1688_lib.c

    r290 r348  
    753753        chip->pcm = pcm;
    754754
    755         snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, 64*1024);
     755        snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
     756                                              snd_dma_isa_data(),
     757                                              64*1024, 64*1024);
    756758
    757759        if (rpcm)
  • GPL/branches/alsa-resync1/alsa-kernel/isa/es18xx.c

    r290 r348  
    15991599        chip->pcm = pcm;
    16001600
    1601         snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024);
     1601        snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
     1602                                              snd_dma_isa_data(),
     1603                                              64*1024,
     1604                                              chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024);
    16021605
    16031606        if (rpcm)
     
    22372240{
    22382241        static unsigned long possible_ports[] = {0x220, 0x240, 0x260, 0x280, -1};
    2239         int dev, cards = 0;
     2242        int dev, cards = 0, i;
    22402243
    22412244        /* legacy non-auto cards at first */
     
    22512254        }
    22522255        /* legacy auto configured cards */
    2253         cards += snd_legacy_auto_probe(possible_ports, snd_audiodrive_probe_legacy_port);
     2256        i = snd_legacy_auto_probe(possible_ports, snd_audiodrive_probe_legacy_port);
     2257        if (i > 0)
     2258                cards += i;
     2259
    22542260#ifdef CONFIG_PNP
    22552261        /* ISA PnP cards at last */
    2256         cards += pnp_register_card_driver(&es18xx_pnpc_driver);
     2262        i = pnp_register_card_driver(&es18xx_pnpc_driver);
     2263        if (i > 0)
     2264                cards += i;
     2265
    22572266#endif
    22582267        if(!cards) {
  • GPL/branches/alsa-resync1/alsa-kernel/isa/gus/gus_pcm.c

    r281 r348  
    875875
    876876        for (substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; substream; substream = substream->next)
    877                 snd_pcm_lib_preallocate_isa_pages(substream, 64*1024, gus->gf1.dma1 > 3 ? 128*1024 : 64*1024);
     877                snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV,
     878                                              snd_dma_isa_data(),
     879                                              64*1024, gus->gf1.dma1 > 3 ? 128*1024 : 64*1024);
    878880       
    879881        pcm->info_flags = 0;
     
    883885                if (gus->gf1.dma2 == gus->gf1.dma1)
    884886                        pcm->info_flags |= SNDRV_PCM_INFO_HALF_DUPLEX;
    885                 snd_pcm_lib_preallocate_isa_pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream, 64*1024, gus->gf1.dma2 > 3 ? 128*1024 : 64*1024);
     887                snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream,
     888                                              SNDRV_DMA_TYPE_DEV, snd_dma_isa_data(),
     889                                              64*1024, gus->gf1.dma2 > 3 ? 128*1024 : 64*1024);
    886890        }
    887891        strcpy(pcm->name, pcm->id);
  • GPL/branches/alsa-resync1/alsa-kernel/isa/gus/gusclassic.c

    r277 r348  
    246246{
    247247        static unsigned long possible_ports[] = {0x220, 0x230, 0x240, 0x250, 0x260, -1};
    248         int dev, cards;
     248        int dev, cards, i;
    249249
    250250        for (dev = cards = 0; dev < SNDRV_CARDS && enable[dev]; dev++) {
     
    254254                        cards++;
    255255        }
    256         cards += snd_legacy_auto_probe(possible_ports, snd_gusclassic_legacy_auto_probe);
     256        i = snd_legacy_auto_probe(possible_ports, snd_gusclassic_legacy_auto_probe);
     257        if (i > 0)
     258                cards += i;
     259
    257260        if (!cards) {
    258261#ifdef MODULE
  • GPL/branches/alsa-resync1/alsa-kernel/isa/gus/gusextreme.c

    r277 r348  
    233233        if (xgf1_irq == SNDRV_AUTO_IRQ) {
    234234                if ((xgf1_irq = snd_legacy_find_free_irq(possible_gf1_irqs)) < 0) {
    235                         snd_card_free(card);
    236235                        snd_printk("unable to find a free IRQ for GF1\n");
    237                         return -EBUSY;
     236                        err = -EBUSY;
     237                        goto out;
    238238                }
    239239        }
     
    241241        if (xess_irq == SNDRV_AUTO_IRQ) {
    242242                if ((xess_irq = snd_legacy_find_free_irq(possible_ess_irqs)) < 0) {
    243                         snd_card_free(card);
    244243                        snd_printk("unable to find a free IRQ for ES1688\n");
    245                         return -EBUSY;
     244                        err = -EBUSY;
     245                        goto out;
    246246                }
    247247        }
     
    254254        if (xgf1_dma == SNDRV_AUTO_DMA) {
    255255                if ((xgf1_dma = snd_legacy_find_free_dma(possible_gf1_dmas)) < 0) {
    256                         snd_card_free(card);
    257256                        snd_printk("unable to find a free DMA for GF1\n");
    258                         return -EBUSY;
     257                        err = -EBUSY;
     258                        goto out;
    259259                }
    260260        }
     
    262262        if (xess_dma == SNDRV_AUTO_DMA) {
    263263                if ((xess_dma = snd_legacy_find_free_dma(possible_ess_dmas)) < 0) {
    264                         snd_card_free(card);
    265264                        snd_printk("unable to find a free DMA for ES1688\n");
    266                         return -EBUSY;
     265                        err = -EBUSY;
     266                        goto out;
    267267                }
    268268        }
     
    270270        if ((err = snd_es1688_create(card, port[dev], mpu_port[dev],
    271271                                     xess_irq, xmpu_irq, xess_dma,
    272                                      ES1688_HW_1688, &es1688)) < 0) {
    273                 snd_card_free(card);
    274                 return err;
    275         }
     272                                     ES1688_HW_1688, &es1688)) < 0)
     273                goto out;
    276274        if (gf1_port[dev] < 0)
    277275                gf1_port[dev] = port[dev] + 0x20;
     
    283281                                  0, channels[dev],
    284282                                  pcm_channels[dev], 0,
    285                                   &gus)) < 0) {
    286                 snd_card_free(card);
    287                 return err;
    288         }
    289         if ((err = snd_gusextreme_detect(dev, card, gus, es1688)) < 0) {
    290                 snd_card_free(card);
    291                 return err;
    292         }
     283                                  &gus)) < 0)
     284                goto out;
     285
     286        if ((err = snd_gusextreme_detect(dev, card, gus, es1688)) < 0)
     287                goto out;
     288
    293289        snd_gusextreme_init(dev, gus);
    294         if ((err = snd_gus_initialize(gus)) < 0) {
    295                 snd_card_free(card);
    296                 return err;
    297         }
     290        if ((err = snd_gus_initialize(gus)) < 0)
     291                goto out;
     292
    298293        if (!gus->ess_flag) {
    299294                snd_printdd("GUS Extreme soundcard was not detected at 0x%lx\n", gus->gf1.port);
    300                 snd_card_free(card);
    301                 return -ENODEV;
    302         }
    303         if ((err = snd_es1688_pcm(es1688, 0, NULL)) < 0) {
    304                 snd_card_free(card);
    305                 return err;
    306         }
    307         if ((err = snd_es1688_mixer(es1688)) < 0) {
    308                 snd_card_free(card);
    309                 return err;
    310         }
     295                err = -ENODEV;
     296                goto out;
     297        }
     298        if ((err = snd_es1688_pcm(es1688, 0, NULL)) < 0)
     299                goto out;
     300
     301        if ((err = snd_es1688_mixer(es1688)) < 0)
     302                goto out;
     303
    311304        snd_component_add(card, "ES1688");
    312305        if (pcm_channels[dev] > 0) {
    313                 if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0) {
    314                         snd_card_free(card);
    315                         return err;
    316                 }
    317         }
    318         if ((err = snd_gf1_new_mixer(gus)) < 0) {
    319                 snd_card_free(card);
    320                 return err;
    321         }
    322         if ((err = snd_gusextreme_mixer(es1688)) < 0) {
    323                 snd_card_free(card);
    324                 return err;
    325         }
     306                if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0)
     307                        goto out;
     308                }
     309        if ((err = snd_gf1_new_mixer(gus)) < 0)
     310                goto out;
     311
     312        if ((err = snd_gusextreme_mixer(es1688)) < 0)
     313                goto out;
    326314
    327315        if (snd_opl3_create(card, es1688->port, es1688->port + 2,
     
    329317                printk(KERN_ERR "gusextreme: opl3 not detected at 0x%lx\n", es1688->port);
    330318        } else {
    331                 if ((err = snd_opl3_hwdep_new(opl3, 0, 2, NULL)) < 0) {
    332                         snd_card_free(card);
    333                         return err;
    334                 }
    335         }
    336 
    337         if (es1688->mpu_port >= 0x300) {
    338                 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_ES1688,
     319                if ((err = snd_opl3_hwdep_new(opl3, 0, 2, NULL)) < 0)
     320                        goto out;
     321                }
     322
     323        if (es1688->mpu_port >= 0x300 &&
     324            (err = snd_mpu401_uart_new(card, 0, MPU401_HW_ES1688,
    339325                                               es1688->mpu_port, 0,
    340326                                               xmpu_irq,
    341327                                               SA_INTERRUPT,
    342                                                NULL)) < 0) {
    343                         snd_card_free(card);
    344                         return err;
    345                 }
    346         }
     328                                               NULL)) < 0)
     329                goto out;
    347330
    348331        sprintf(card->longname, "Gravis UltraSound Extreme at 0x%lx, irq %i&%i, dma %i&%i",
    349332                es1688->port, xgf1_irq, xess_irq, xgf1_dma, xess_dma);
    350         if ((err = snd_card_register(card)) < 0) {
    351                 snd_card_free(card);
    352                 return err;
    353         }
     333        if ((err = snd_card_register(card)) < 0)
     334                goto out;
     335
    354336        snd_gusextreme_cards[dev] = card;
    355337        return 0;
     338
     339      out:
     340        snd_card_free(card);
     341        return err;
    356342}
    357343
     
    376362{
    377363        static unsigned long possible_ports[] = {0x220, 0x240, 0x260, -1};
    378         int dev, cards;
     364        int dev, cards, i;
    379365
    380366        for (dev = cards = 0; dev < SNDRV_CARDS && enable[dev] > 0; dev++) {
     
    384370                        cards++;
    385371        }
    386         cards += snd_legacy_auto_probe(possible_ports, snd_gusextreme_legacy_auto_probe);
     372        i = snd_legacy_auto_probe(possible_ports, snd_gusextreme_legacy_auto_probe);
     373        if (i > 0)
     374                cards += i;
     375
    387376        if (!cards) {
    388377#ifdef MODULE
  • GPL/branches/alsa-resync1/alsa-kernel/isa/gus/gusmax.c

    r277 r348  
    386386{
    387387        static unsigned long possible_ports[] = {0x220, 0x230, 0x240, 0x250, 0x260, -1};
    388         int dev, cards;
     388        int dev, cards, i;
    389389
    390390        for (dev = cards = 0; dev < SNDRV_CARDS && enable[dev] > 0; dev++) {
     
    394394                        cards++;
    395395        }
    396         cards += snd_legacy_auto_probe(possible_ports, snd_gusmax_legacy_auto_probe);
     396        i = snd_legacy_auto_probe(possible_ports, snd_gusmax_legacy_auto_probe);
     397        if (i > 0)
     398                cards += i;
     399
    397400        if (!cards) {
    398401#ifdef MODULE
  • GPL/branches/alsa-resync1/alsa-kernel/isa/gus/interwave.c

    r300 r348  
    942942static int __init alsa_card_interwave_init(void)
    943943{
    944         int cards = 0;
     944        int cards = 0, i;
    945945        static long possible_ports[] = {0x210, 0x220, 0x230, 0x240, 0x250, 0x260, -1};
    946946        int dev;
     
    962962        }
    963963        /* legacy auto configured cards */
    964         cards += snd_legacy_auto_probe(possible_ports, snd_interwave_probe_legacy_port);
     964        i = snd_legacy_auto_probe(possible_ports, snd_interwave_probe_legacy_port);
     965        if (i > 0)
     966                cards += i;
    965967#ifdef CONFIG_PNP
    966968        /* ISA PnP cards */
    967         cards += pnp_register_card_driver(&interwave_pnpc_driver);
     969        i = pnp_register_card_driver(&interwave_pnpc_driver);
     970        if (i > 0)
     971                cards += i;
    968972#endif
    969973
  • GPL/branches/alsa-resync1/alsa-kernel/isa/opti9xx/opti92x-ad1848.c

    r290 r348  
    312312{
    313313        while (*port_table != -1) {
    314                 if (!check_region(*port_table, size))
     314                struct resource *res;
     315                if ((res = request_region(*port_table, size, "ALSA test")) != NULL) {
     316                        release_resource(res);
     317                        kfree_nocheck(res);
    315318                        return *port_table;
     319                }
    316320                port_table++;
    317321        }
     
    14001404        strcpy(pcm->name, snd_opti93x_chip_id(codec));
    14011405
    1402         snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, codec->dma1 > 3 || codec->dma2 > 3 ? 128*1024 : 64*1024);
     1406        snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
     1407                                              snd_dma_isa_data(),
     1408                                              64*1024, codec->dma1 > 3 || codec->dma2 > 3 ? 128*1024 : 64*1024);
    14031409
    14041410        codec->pcm = pcm;
     
    16731679                        return err;
    16741680
    1675                 if (check_region(chip->mc_base, chip->mc_base_size))
     1681                if ((chip->res_mc_base = request_region(chip->mc_base, chip->mc_base_size, "OPTi9xx MC")) == NULL)
    16761682                        continue;
    16771683
     
    16801686                        if (value == snd_opti9xx_read(chip, OPTi9XX_MC_REG(1)))
    16811687                                return 1;
     1688
     1689                release_resource(chip->res_mc_base);
     1690                kfree_nocheck(chip->res_mc_base);
     1691                chip->res_mc_base = NULL;
     1692
    16821693        }
    16831694#else   /* OPTi93X */
     
    16891700                        return err;
    16901701
    1691                 if (check_region(chip->mc_base, chip->mc_base_size))
     1702                if ((chip->res_mc_base = request_region(chip->mc_base, chip->mc_base_size, "OPTi9xx MC")) == NULL)
    16921703                        continue;
    16931704
     
    17021713                if (snd_opti9xx_read(chip, OPTi9XX_MC_REG(7)) == 0xff - value)
    17031714                        return 1;
     1715
     1716                release_resource(chip->res_mc_base);
     1717                kfree_nocheck(chip->res_mc_base);
     1718                chip->res_mc_base = NULL;
    17041719        }
    17051720#endif  /* OPTi93X */
     
    19852000#endif  /* CONFIG_PNP */
    19862001
    1987         if ((chip->res_mc_base = request_region(chip->mc_base, chip->mc_base_size, "OPTi9xx MC")) == NULL) {
     2002        if (! chip->res_mc_base &&
     2003            (chip->res_mc_base = request_region(chip->mc_base, chip->mc_base_size, "OPTi9xx MC")) == NULL) {
    19882004                snd_card_free(card);
    19892005                return -ENOMEM;
  • GPL/branches/alsa-resync1/alsa-kernel/isa/sb/es968.c

    r290 r348  
    226226static int __init alsa_card_es968_init(void)
    227227{
    228         int res = pnp_register_card_driver(&es968_pnpc_driver);
    229         if (res == 0)
    230         {
     228        int cards = pnp_register_card_driver(&es968_pnpc_driver);
     229#ifdef MODULE
     230        if (cards == 0) {
    231231                pnp_unregister_card_driver(&es968_pnpc_driver);
    232 #ifdef MODULE
    233232                snd_printk(KERN_ERR "no ES968 based soundcards found\n");
     233        }
    234234#endif
    235         }
    236         return res < 0 ? res : 0;
     235        return cards ? 0 : -ENODEV;
    237236}
    238237
  • GPL/branches/alsa-resync1/alsa-kernel/isa/sb/sb16.c

    r290 r348  
    644644    static int __init alsa_card_sb16_init(void)
    645645    {
    646         int dev, cards = 0;
     646        int dev, cards = 0, i;
    647647        static unsigned long possible_ports[] = {0x220, 0x240, 0x260, 0x280, -1};
    648648
     
    664664        }
    665665        /* legacy auto configured cards */
    666         cards += snd_legacy_auto_probe(possible_ports, snd_sb16_probe_legacy_port);
     666        i = snd_legacy_auto_probe(possible_ports, snd_sb16_probe_legacy_port);
     667        if (i > 0)
     668                cards += i;
     669
    667670#ifdef CONFIG_PNP
    668671        /* PnP cards at last */
    669         cards += pnp_register_card_driver(&sb16_pnpc_driver);
     672        i = pnp_register_card_driver(&sb16_pnpc_driver);
     673        if (i >0)
     674                cards += i;
    670675#endif
    671676
  • GPL/branches/alsa-resync1/alsa-kernel/isa/sb/sb16_main.c

    r246 r348  
    882882                pcm->info_flags = SNDRV_PCM_INFO_HALF_DUPLEX;
    883883
    884         snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, 128*1024);
     884        snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
     885                                              snd_dma_isa_data(),
     886                                              64*1024, 128*1024);
    885887
    886888    if (rpcm)
  • GPL/branches/alsa-resync1/alsa-kernel/isa/sb/sb8.c

    r277 r348  
    200200{
    201201    static unsigned long possible_ports[] = {0x220, 0x240, 0x260, -1};
    202     int dev, cards;
     202        int dev, cards, i;
    203203
    204204        for (dev = cards = 0; dev < SNDRV_CARDS && enable[dev]; dev++) {
     
    208208            cards++;
    209209    }
    210     cards += snd_legacy_auto_probe(possible_ports, snd_card_sb8_legacy_auto_probe);
     210        i = snd_legacy_auto_probe(possible_ports, snd_card_sb8_legacy_auto_probe);
     211        if (i > 0)
     212                cards += i;
     213
    211214    if (!cards) {
    212215#ifdef MODULE
  • GPL/branches/alsa-resync1/alsa-kernel/isa/sb/sb8_main.c

    r246 r348  
    536536    snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_sb8_capture_ops);
    537537
    538         snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, 64*1024);
     538        snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
     539                                              snd_dma_isa_data(),
     540                                              64*1024, 64*1024);
    539541
    540542    if (rpcm)
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ac97/ac97_patch.c

    r290 r348  
    21612161        unsigned short misc;
    21622162
     2163        patch_ad1881(ac97);
    21632164        ac97->build_ops = &patch_ad1985_build_ops;
    21642165        misc = snd_ac97_read(ac97, AC97_AD_MISC);
  • GPL/branches/alsa-resync1/alsa-kernel/pci/emu10k1/emu10k1.c

    r256 r348  
    101101static struct pci_device_id snd_emu10k1_ids[] = {
    102102    { 0x1102, 0x0002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },        /* EMU10K1 */
     103#if 0 /* FIXME: not working! */
    103104        { 0x1102, 0x0006, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },    /* Dell OEM version (EMU10K1) */
     105#endif
    104106    { 0x1102, 0x0004, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1 },        /* Audigy */
    105107    { 0x1102, 0x0008, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1 },    /* Audigy 2 Value SB0400 */
  • GPL/branches/alsa-resync1/alsa-kernel/pci/emu10k1/emu10k1_callback.c

    r84 r348  
    428428                /* invalidate maps */
    429429                temp = ((unsigned int)hw->silent_page.addr << 1) | MAP_PTI_MASK;
    430 //              temp = ((unsigned int)hw->silent_page_dmaaddr << 1) | MAP_PTI_MASK;
    431430                snd_emu10k1_ptr_write(hw, MAPA, ch, temp);
    432431                snd_emu10k1_ptr_write(hw, MAPB, ch, temp);
  • GPL/branches/alsa-resync1/alsa-kernel/pci/emu10k1/emufx.c

    r207 r348  
    3030
    3131#include <sound/driver.h>
     32#include <linux/pci.h>
    3233#include <linux/delay.h>
    3334#include <linux/slab.h>
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/aureon.c

    r281 r348  
    410410        unsigned int i;
    411411
    412         if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AUREON51_SKY)
     412        if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AUREON51_SKY) {
    413413                ice->num_total_dacs = 6;
    414         else
     414                ice->num_total_adcs = 6;
     415        } else {
    415416                ice->num_total_dacs = 8;
     417                ice->num_total_adcs = 8;
     418        }
    416419
    417420        /* to remeber the register values */
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/delta.c

    r300 r348  
    9191                break;
    9292        case ICE1712_SUBDEVICE_AUDIOPHILE:
     93        case ICE1712_SUBDEVICE_DELTA410:
    9394                tmp |= ICE1712_DELTA_AP_CCLK | ICE1712_DELTA_AP_CS_CODEC;
    9495                tmp &= ~ICE1712_DELTA_AP_CS_DIGITAL;
     
    113114                break;
    114115        case ICE1712_SUBDEVICE_AUDIOPHILE:
     116        case ICE1712_SUBDEVICE_DELTA410:
    115117                tmp |= ICE1712_DELTA_AP_CS_DIGITAL;
    116118                break;
     
    512514        case ICE1712_SUBDEVICE_AUDIOPHILE:
    513515                ice->num_total_dacs = 2;
     516                ice->num_total_adcs = 2;
    514517                break;
    515518        case ICE1712_SUBDEVICE_DELTA410:
    516519                ice->num_total_dacs = 8;
     520                ice->num_total_adcs = 2;
    517521                break;
    518522        case ICE1712_SUBDEVICE_DELTA44:
    519523        case ICE1712_SUBDEVICE_DELTA66:
    520524                ice->num_total_dacs = ice->omni ? 8 : 4;
     525                ice->num_total_adcs = ice->omni ? 8 : 4;
    521526                break;
    522527        case ICE1712_SUBDEVICE_DELTA1010:
    523528        case ICE1712_SUBDEVICE_DELTA1010LT:
    524529                ice->num_total_dacs = 8;
     530                ice->num_total_adcs = 8;
    525531                break;
    526532        case ICE1712_SUBDEVICE_VX442:
    527533                ice->num_total_dacs = 4;
     534                ice->num_total_adcs = 4;
    528535                break;
    529536        }
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ews.c

    r250 r348  
    407407        case ICE1712_SUBDEVICE_EWX2496:
    408408                ice->num_total_dacs = 2;
     409                ice->num_total_adcs = 2;
    409410                break; 
    410411        case ICE1712_SUBDEVICE_EWS88MT:
    411412        case ICE1712_SUBDEVICE_EWS88MT_NEW:
    412413                ice->num_total_dacs = 8;
     414                ice->num_total_adcs = 8;
    413415                break;
    414416        case ICE1712_SUBDEVICE_EWS88D:
     
    416418        case ICE1712_SUBDEVICE_DMX6FIRE:
    417419                ice->num_total_dacs = 6;
     420                ice->num_total_adcs = 6;
    418421                break;
    419422        }
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/hoontech.c

    r256 r348  
    154154
    155155        ice->num_total_dacs = 8;
     156        ice->num_total_adcs = 8;
    156157
    157158        ice->hoontech_boxbits[0] =
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ice1712.c

    r300 r348  
    8383static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;              /* Enable this card */
    8484static int omni[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 0};   /* Delta44 & 66 Omni I/O support */
     85static int cs8427_timeout[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 500}; /* CS8427 S/PDIF transciever reset timeout value in msec */
    8586
    8687MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
     
    9697MODULE_PARM_DESC(omni, "Enable Midiman M-Audio Delta Omni I/O support.");
    9798MODULE_PARM_SYNTAX(omni, SNDRV_ENABLED "," SNDRV_ENABLE_DESC);
     99MODULE_PARM(cs8427_timeout, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
     100MODULE_PARM_DESC(cs8427_timeout, "Define reset timeout for cs8427 chip in msec resolution.");
     101MODULE_PARM_SYNTAX(cs8427_timeout, SNDRV_ENABLED ", allows:{{1,1000}},default=500,skill:advanced");
    98102
    99103#ifndef PCI_VENDOR_ID_ICE
     
    387391        int err;
    388392
    389         if ((err = snd_cs8427_create(ice->i2c, addr, &ice->cs8427)) < 0) {
     393        if ((err = snd_cs8427_create(ice->i2c, addr,
     394                                     (ice->cs8427_timeout * HZ) / 1000,
     395                                     &ice->cs8427)) < 0) {
    390396                snd_printk("CS8427 initialization failed\n");
    391397                return err;
     
    887893        ice->pcm = pcm;
    888894
    889         snd_pcm_lib_preallocate_pci_pages_for_all(ice->pci, pcm, 64*1024, 64*1024);
     895        snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
     896                                              snd_dma_pci_data(ice->pci), 64*1024, 64*1024);
    890897
    891898        if (rpcm)
     
    923930        ice->pcm_ds = pcm;
    924931
    925         snd_pcm_lib_preallocate_pci_pages_for_all(ice->pci, pcm, 64*1024, 128*1024);
     932        snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
     933                                              snd_dma_pci_data(ice->pci), 64*1024, 128*1024);
    926934
    927935        if (rpcm)
     
    12701278        strcpy(pcm->name, "ICE1712 multi");
    12711279
    1272         snd_pcm_lib_preallocate_pci_pages_for_all(ice->pci, pcm, 256*1024, 256*1024);
     1280        snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
     1281                                              snd_dma_pci_data(ice->pci), 256*1024, 256*1024);
    12731282
    12741283        ice->pcm_pro = pcm;
     
    13821391
    13831392
    1384 static snd_kcontrol_new_t snd_ice1712_multi_ctrls[] __devinitdata = {
     1393static snd_kcontrol_new_t snd_ice1712_multi_playback_ctrls[] __devinitdata = {
    13851394        {
    13861395                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
     
    14011410                .count = 10,
    14021411        },
    1403         {
     1412};
     1413
     1414static snd_kcontrol_new_t snd_ice1712_multi_capture_analog_switch __devinitdata = {
    14041415                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
    1405                 .name = "Multi Capture Switch",
     1416        .name = "H/W Multi Capture Switch",
    14061417                .info = snd_ice1712_pro_mixer_switch_info,
    14071418                .get = snd_ice1712_pro_mixer_switch_get,
    14081419                .put = snd_ice1712_pro_mixer_switch_put,
    14091420                .private_value = 10,
    1410                 .count = 10,
    1411         },
    1412         {
     1421};
     1422
     1423static snd_kcontrol_new_t snd_ice1712_multi_capture_spdif_switch __devinitdata = {
    14131424                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
    1414                 .name = "Multi Capture Volume",
     1425        .name = "IEC958 Multi Capture Switch",
     1426        .info = snd_ice1712_pro_mixer_switch_info,
     1427        .get = snd_ice1712_pro_mixer_switch_get,
     1428        .put = snd_ice1712_pro_mixer_switch_put,
     1429        .private_value = 18,
     1430        .count = 2,
     1431};
     1432
     1433static snd_kcontrol_new_t snd_ice1712_multi_capture_analog_volume __devinitdata = {
     1434        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
     1435        .name = "H/W Multi Capture Volume",
    14151436                .info = snd_ice1712_pro_mixer_volume_info,
    14161437                .get = snd_ice1712_pro_mixer_volume_get,
    14171438                .put = snd_ice1712_pro_mixer_volume_put,
    14181439                .private_value = 10,
    1419                 .count = 10,
    1420         },
     1440};
     1441
     1442static snd_kcontrol_new_t snd_ice1712_multi_capture_spdif_volume __devinitdata = {
     1443        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
     1444        .name = "IEC958 Multi Capture Volume",
     1445        .info = snd_ice1712_pro_mixer_volume_info,
     1446        .get = snd_ice1712_pro_mixer_volume_get,
     1447        .put = snd_ice1712_pro_mixer_volume_put,
     1448        .private_value = 18,
     1449        .count = 2,
    14211450};
    14221451
     
    14281457
    14291458        /* multi-channel mixer */
    1430         for (idx = 0; idx < ARRAY_SIZE(snd_ice1712_multi_ctrls); idx++) {
    1431                 err = snd_ctl_add(card, snd_ctl_new1(&snd_ice1712_multi_ctrls[idx], ice));
     1459        for (idx = 0; idx < ARRAY_SIZE(snd_ice1712_multi_playback_ctrls); idx++) {
     1460                err = snd_ctl_add(card, snd_ctl_new1(&snd_ice1712_multi_playback_ctrls[idx], ice));
    14321461                if (err < 0)
    14331462                        return err;
    14341463        }
    14351464       
     1465        if (ice->num_total_adcs > 0) {
     1466                snd_kcontrol_new_t tmp = snd_ice1712_multi_capture_analog_switch;
     1467                tmp.count = ice->num_total_adcs;
     1468                err = snd_ctl_add(card, snd_ctl_new1(&tmp, ice));
     1469                if (err < 0)
     1470                        return err;
     1471        }
     1472
     1473        err = snd_ctl_add(card, snd_ctl_new1(&snd_ice1712_multi_capture_spdif_switch, ice));
     1474        if (err < 0)
     1475                return err;
     1476
     1477        if (ice->num_total_adcs > 0) {
     1478                snd_kcontrol_new_t tmp = snd_ice1712_multi_capture_analog_volume;
     1479                tmp.count = ice->num_total_adcs;
     1480                err = snd_ctl_add(card, snd_ctl_new1(&tmp, ice));
     1481                if (err < 0)
     1482                        return err;
     1483        }
     1484
     1485        err = snd_ctl_add(card, snd_ctl_new1(&snd_ice1712_multi_capture_spdif_volume, ice));
     1486        if (err < 0)
     1487                return err;
     1488
    14361489        /* initialize volumes */
    1437         for (idx = 0; idx < 20; idx++) {
     1490        for (idx = 0; idx < 10; idx++) {
    14381491                ice->pro_volumes[idx] = 0x80008000;     /* mute */
    14391492                snd_ice1712_update_volume(ice, idx);
    14401493        }
     1494        for (idx = 10; idx < 10 + ice->num_total_adcs; idx++) {
     1495                ice->pro_volumes[idx] = 0x80008000;     /* mute */
     1496                snd_ice1712_update_volume(ice, idx);
     1497        }
     1498        for (idx = 18; idx < 20; idx++) {
     1499                ice->pro_volumes[idx] = 0x80008000;     /* mute */
     1500                snd_ice1712_update_volume(ice, idx);
     1501        }
    14411502        return 0;
    14421503}
     
    14511512{
    14521513        int err;
     1514        ac97_t ac97;
     1515        ac97_bus_t bus, *pbus;
    14531516
    14541517        if (ice_has_con_ac97(ice)) {
    1455                 ac97_bus_t bus, *pbus;
    1456                 ac97_t ac97;
    14571518                memset(&bus, 0, sizeof(bus));
    14581519                bus.write = snd_ice1712_ac97_write;
     
    14731534
    14741535        if (! (ice->eeprom.data[ICE_EEP1_ACLINK] & ICE1712_CFG_PRO_I2S)) {
    1475                 ac97_bus_t bus, *pbus;
    1476                 ac97_t ac97;
    14771536                memset(&bus, 0, sizeof(bus));
    14781537                bus.write = snd_ice1712_pro_ac97_write;
     
    23502409                                     struct pci_dev *pci,
    23512410                                     int omni,
     2411                                        int cs8427_timeout,
    23522412                                     ice1712_t ** r_ice1712)
    23532413{
     
    23742434                return -ENOMEM;
    23752435        ice->omni = omni ? 1 : 0;
     2436        if (cs8427_timeout < 1)
     2437                cs8427_timeout = 1;
     2438        else if (cs8427_timeout > 1000)
     2439                cs8427_timeout = 1000;
     2440        ice->cs8427_timeout = cs8427_timeout;
    23762441        spin_lock_init(&ice->reg_lock);
    23772442        init_MUTEX(&ice->gpio_mutex);
     
    24932558        strcpy(card->shortname, "ICEnsemble ICE1712");
    24942559       
    2495         if ((err = snd_ice1712_create(card, pci, omni[dev], &ice)) < 0) {
     2560        if ((err = snd_ice1712_create(card, pci, omni[dev], cs8427_timeout[dev], &ice)) < 0) {
    24962561                snd_card_free(card);
    24972562                return err;
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ice1712.h

    r300 r348  
    331331        unsigned int vt1724: 1;
    332332        unsigned int num_total_dacs;    /* total DACs */
     333        unsigned int num_total_adcs;    /* total ADCs */
    333334        unsigned char hoontech_boxbits[4];
    334335        unsigned int hoontech_config;
     
    346347        snd_i2c_device_t *cs8404;       /* CS8404A I2C device */
    347348        snd_i2c_device_t *cs8427;       /* CS8427 I2C device */
     349        unsigned int cs8427_timeout;    /* CS8427 reset timeout in HZ/100 */
    348350        snd_i2c_device_t *i2cdevs[2];   /* additional i2c devices */
    349351       
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ice1724.c

    r300 r348  
    757757        strcpy(pcm->name, "ICE1724");
    758758
    759         snd_pcm_lib_preallocate_pci_pages_for_all(ice->pci, pcm, 256*1024, 256*1024);
     759        snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
     760                                              snd_dma_pci_data(ice->pci), 256*1024, 256*1024);
    760761
    761762        ice->pcm_pro = pcm;
     
    911912        strcpy(pcm->name, "ICE1724 IEC958");
    912913
    913         snd_pcm_lib_preallocate_pci_pages_for_all(ice->pci, pcm, 64*1024, 64*1024);
     914        snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
     915                                              snd_dma_pci_data(ice->pci), 64*1024, 64*1024);
    914916
    915917        ice->pcm = pcm;
     
    10321034        strcpy(pcm->name, "ICE1724 Surround PCM");
    10331035
    1034         snd_pcm_lib_preallocate_pci_pages_for_all(ice->pci, pcm, 64*1024, 64*1024);
     1036        snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
     1037                                              snd_dma_pci_data(ice->pci), 64*1024, 64*1024);
    10351038
    10361039        ice->pcm_ds = pcm;
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/revo.c

    r262 r348  
    129129        case VT1724_SUBDEVICE_REVOLUTION71:
    130130                ice->num_total_dacs = 8;
     131                ice->num_total_adcs = 4;
    131132                break;
    132133        default:
  • GPL/branches/alsa-resync1/alsa-kernel/pci/intel8x0.c

    r300 r348  
    108108MODULE_PARM(ac97_quirk, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
    109109MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware.");
    110 MODULE_PARM_SYNTAX(ac97_quirk, SNDRV_ENABLED ",allows:{{-1,3}},dialog:list,default:-1");
     110MODULE_PARM_SYNTAX(ac97_quirk, SNDRV_ENABLED ",allows:{{-1,4}},dialog:list,default:-1");
    111111#ifdef SUPPORT_JOYSTICK
    112112MODULE_PARM(joystick, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
     
    862862
    863863    if ((status & chip->int_sta_mask) == 0) {
    864         static int err_count = 10;
    865864        if (status) {
    866865            /* ack */
     
    29822981        /* workaround for 440MX */
    29832982        if (chip->fix_nocache)
    2984                 fill_nocache(chip->bdbars, chip->bdbars_count * sizeof(u32) * ICH_MAX_FRAGS * 2, 1);
     2983                fill_nocache(chip->bdbars.area, chip->bdbars.bytes, 1);
    29852984    int_sta_masks = 0;
    29862985    for (i = 0; i < chip->bdbars_count; i++) {
     
    32373236    pci_read_config_word(pci, 0xe6, &val);
    32383237#ifdef SUPPORT_JOYSTICK
     3238        val &= ~0x100;
    32393239    if (joystick[dev]) {
    32403240        if (! request_region(ich_gameport.io, 8, "ICH gameport")) {
     
    32493249#endif
    32503250#ifdef SUPPORT_MIDI
     3251        val &= ~0x20;
    32513252    if (mpu_port[dev] > 0) {
    32523253        if (mpu_port[dev] == 0x300 || mpu_port[dev] == 0x330) {
  • GPL/branches/alsa-resync1/alsa-kernel/pci/korg1212/korg1212.c

    r290 r348  
    348348        struct resource *res_iomem2;
    349349
     350        struct snd_dma_device dma_dev;
     351
     352        struct snd_dma_buffer dma_dsp;
     353        struct snd_dma_buffer dma_play;
     354        struct snd_dma_buffer dma_rec;
     355        struct snd_dma_buffer dma_shared;
     356
    350357        u32 dspCodeSize;
    351         u32 dspMemPhy;          // DSP memory block handle (Physical Address)
    352         void * dspMemPtr;       //            block memory (Virtual Address)
    353358
    354359        u32 DataBufsSize;
     
    358363
    359364        KorgSharedBuffer * sharedBufferPtr;
     365
    360366        u32 RecDataPhy;
    361367        u32 PlayDataPhy;
     
    12391245        snd_korg1212_setCardState(korg1212, K1212_STATE_DSP_IN_PROCESS);
    12401246
    1241         memcpy(korg1212->dspMemPtr, dspCode, korg1212->dspCodeSize);
     1247        memcpy(korg1212->dma_dsp.area, dspCode, korg1212->dspCodeSize);
    12421248
    12431249        rc = snd_korg1212_Send1212Command(korg1212, K1212_DB_StartDSPDownload,
    1244                                      UpperWordSwap(korg1212->dspMemPhy),
     1250                                     UpperWordSwap(korg1212->dma_dsp.addr),
    12451251                                     0, 0, 0);
    12461252
     
    21352141        // free up memory resources used for the DSP download.
    21362142        // ----------------------------------------------------
    2137         if (korg1212->dspMemPtr) {
    2138                 snd_free_pci_pages(korg1212->pci, korg1212->dspCodeSize,
    2139                                    korg1212->dspMemPtr, (dma_addr_t)korg1212->dspMemPhy);
    2140                 korg1212->dspMemPhy = 0;
    2141                 korg1212->dspMemPtr = 0;
    2142                 korg1212->dspCodeSize = 0;
     2143        if (korg1212->dma_dsp.area) {
     2144                snd_dma_free_pages(&korg1212->dma_dev, &korg1212->dma_dsp);
     2145                korg1212->dma_dsp.area = NULL;
    21432146        }
    21442147
     
    21482151        // free up memory resources used for the Play/Rec Buffers
    21492152        // ------------------------------------------------------
    2150         if (korg1212->playDataBufsPtr) {
    2151                 snd_free_pci_pages(korg1212->pci, korg1212->DataBufsSize,
    2152                                    korg1212->playDataBufsPtr, (dma_addr_t)korg1212->PlayDataPhy);
    2153                 korg1212->PlayDataPhy = 0;
    2154                 korg1212->playDataBufsPtr = NULL;
    2155         }
    2156 
    2157         if (korg1212->recordDataBufsPtr) {
    2158                 snd_free_pci_pages(korg1212->pci, korg1212->DataBufsSize,
    2159                                    korg1212->recordDataBufsPtr, (dma_addr_t)korg1212->RecDataPhy);
    2160                 korg1212->RecDataPhy = 0;
    2161                 korg1212->recordDataBufsPtr = NULL;
     2153        if (korg1212->dma_play.area) {
     2154                snd_dma_free_pages(&korg1212->dma_dev, &korg1212->dma_play);
     2155                korg1212->dma_play.area = NULL;
     2156        }
     2157
     2158        if (korg1212->dma_rec.area) {
     2159                snd_dma_free_pages(&korg1212->dma_dev, &korg1212->dma_rec);
     2160                korg1212->dma_rec.area = NULL;
    21622161        }
    21632162
     
    21672166        // free up memory resources used for the Shared Buffers
    21682167        // ----------------------------------------------------
    2169         if (korg1212->sharedBufferPtr) {
    2170                 snd_free_pci_pages(korg1212->pci, (u32) sizeof(KorgSharedBuffer),
    2171                                    korg1212->sharedBufferPtr, (dma_addr_t)korg1212->sharedBufferPhy);
    2172                 korg1212->sharedBufferPhy = 0;
    2173                 korg1212->sharedBufferPtr = NULL;
     2168        if (korg1212->dma_shared.area) {
     2169                snd_dma_free_pages(&korg1212->dma_dev, &korg1212->dma_shared);
     2170                korg1212->dma_shared.area = NULL;
    21742171        }
    21752172       
     
    21942191        unsigned int i;
    21952192        unsigned ioport_size, iomem_size, iomem2_size;
    2196         dma_addr_t phys_addr;
    21972193        korg1212_t * korg1212;
    21982194
     
    23332329#endif
    23342330
    2335         korg1212->sharedBufferPtr = (KorgSharedBuffer *) snd_malloc_pci_pages(korg1212->pci, sizeof(KorgSharedBuffer), &phys_addr);
    2336         korg1212->sharedBufferPhy = (unsigned long)phys_addr;
    2337 
    2338         if (korg1212->sharedBufferPtr == NULL) {
     2331        memset(&korg1212->dma_dev, 0, sizeof(korg1212->dma_dev));
     2332        korg1212->dma_dev.type = SNDRV_DMA_TYPE_DEV;
     2333        korg1212->dma_dev.dev = snd_dma_pci_data(korg1212->pci);
     2334
     2335        if (snd_dma_alloc_pages(&korg1212->dma_dev, sizeof(KorgSharedBuffer), &korg1212->dma_shared) < 0) {
    23392336                snd_printk(KERN_ERR "can not allocate shared buffer memory (%Zd bytes)\n", sizeof(KorgSharedBuffer));
    23402337                return -ENOMEM;
    23412338        }
     2339        korg1212->sharedBufferPtr = (KorgSharedBuffer *)korg1212->dma_shared.area;
     2340        korg1212->sharedBufferPhy = korg1212->dma_shared.addr;
    23422341
    23432342#if K1212_DEBUG_LEVEL > 0
     
    23492348        korg1212->DataBufsSize = sizeof(KorgAudioBuffer) * kNumBuffers;
    23502349
    2351         korg1212->playDataBufsPtr = (KorgAudioBuffer *) snd_malloc_pci_pages(korg1212->pci, korg1212->DataBufsSize, &phys_addr);
    2352         korg1212->PlayDataPhy = (u32)phys_addr;
    2353 
    2354         if (korg1212->playDataBufsPtr == NULL) {
     2350        if (snd_dma_alloc_pages(&korg1212->dma_dev, korg1212->DataBufsSize, &korg1212->dma_play) < 0) {
    23552351                snd_printk(KERN_ERR "can not allocate play data buffer memory (%d bytes)\n", korg1212->DataBufsSize);
    23562352                return -ENOMEM;
    23572353        }
     2354        korg1212->playDataBufsPtr = (KorgAudioBuffer *)korg1212->dma_play.area;
     2355        korg1212->PlayDataPhy = korg1212->dma_play.addr;
    23582356
    23592357#if K1212_DEBUG_LEVEL > 0
     
    23622360#endif
    23632361
    2364         korg1212->recordDataBufsPtr = (KorgAudioBuffer *) snd_malloc_pci_pages(korg1212->pci, korg1212->DataBufsSize, &phys_addr);
    2365         korg1212->RecDataPhy = (u32)phys_addr;
    2366 
    2367         if (korg1212->recordDataBufsPtr == NULL) {
     2362        if (snd_dma_alloc_pages(&korg1212->dma_dev, korg1212->DataBufsSize, &korg1212->dma_rec) < 0) {
    23682363                snd_printk(KERN_ERR "can not allocate record data buffer memory (%d bytes)\n", korg1212->DataBufsSize);
    23692364                return -ENOMEM;
    23702365        }
     2366        korg1212->recordDataBufsPtr = (KorgAudioBuffer *)korg1212->dma_rec.area;
     2367        korg1212->RecDataPhy = korg1212->dma_rec.addr;
    23712368
    23722369#if K1212_DEBUG_LEVEL > 0
    23732370        K1212_DEBUG_PRINTK("K1212_DEBUG: Record Data Area = 0x%p (0x%08x), %d bytes\n",
    2374                 korg1212->recordDataBufsPtr, korg1212->RecDataPhy, korg1212->DataBufsSize);
     2371                korg1212->recordDataBufsPtr, korg1212->RecDataBufsPhy, korg1212->DataBufsSize);
    23752372#endif
    23762373
     
    23932390                offsetof(KorgSharedBuffer, AdatTimeCode);
    23942391
    2395         korg1212->dspMemPtr = snd_malloc_pci_pages(korg1212->pci, korg1212->dspCodeSize, &phys_addr);
    2396         korg1212->dspMemPhy = (u32)phys_addr;
    2397 
    2398         if (korg1212->dspMemPtr == NULL) {
     2392        if (snd_dma_alloc_pages(&korg1212->dma_dev, korg1212->dspCodeSize, &korg1212->dma_dsp) < 0) {
    23992393                snd_printk(KERN_ERR "can not allocate dsp code memory (%d bytes)\n", korg1212->dspCodeSize);
    24002394                return -ENOMEM;
     
    24032397#if K1212_DEBUG_LEVEL > 0
    24042398        K1212_DEBUG_PRINTK("K1212_DEBUG: DSP Code area = 0x%p (0x%08x) %d bytes [%s]\n",
    2405                    korg1212->dspMemPtr, korg1212->dspMemPhy, korg1212->dspCodeSize,
     2399                   korg1212->dma_dsp.area, korg1212->dma_dsp.addr, korg1212->dspCodeSize,
    24062400                   stateName[korg1212->cardState]);
    24072401#endif
     
    24262420               "RoutingTablePhy = %08x L[%08x]\n"
    24272421               "AdatTimeCodePhy = %08x L[%08x]\n",
    2428                korg1212->dspMemPhy,       UpperWordSwap(korg1212->dspMemPhy),
     2422               korg1212->dma_dsp.addr,    UpperWordSwap(korg1212->dma_dsp.addr),
    24292423               korg1212->PlayDataPhy,     LowerWordSwap(korg1212->PlayDataPhy),
    24302424               korg1212->RecDataPhy,      LowerWordSwap(korg1212->RecDataPhy),
  • GPL/branches/alsa-resync1/alsa-kernel/pci/rme96.c

    r290 r348  
    17191719        rme96->spdif_pcm->info_flags = 0;
    17201720
    1721         snd_pcm_lib_preallocate_pages_for_all(rme96->spdif_pcm, RME96_BUFFER_SIZE, RME96_BUFFER_SIZE, GFP_KERNEL);
     1721        snd_pcm_lib_preallocate_pages_for_all(rme96->spdif_pcm,
     1722                                              SNDRV_DMA_TYPE_CONTINUOUS,
     1723                                              snd_dma_continuous_data(GFP_KERNEL),
     1724                                              RME96_BUFFER_SIZE,
     1725                                              RME96_BUFFER_SIZE);
    17221726
    17231727        /* set up ALSA pcm device for ADAT */
     
    17391743                rme96->adat_pcm->info_flags = 0;
    17401744
    1741                 snd_pcm_lib_preallocate_pages_for_all(rme96->adat_pcm, RME96_BUFFER_SIZE, RME96_BUFFER_SIZE, GFP_KERNEL);
     1745                snd_pcm_lib_preallocate_pages_for_all(rme96->adat_pcm,
     1746                                                      SNDRV_DMA_TYPE_CONTINUOUS,
     1747                                                      snd_dma_continuous_data(GFP_KERNEL),
     1748                                                      RME96_BUFFER_SIZE,
     1749                                                      RME96_BUFFER_SIZE);
    17421750        }
    17431751
  • GPL/branches/alsa-resync1/alsa-kernel/pci/rme9652/hdsp.c

    r300 r348  
    570570        struct snd_dma_buffer dmbuf;
    571571
    572         snd_dma_device_pci(&pdev, pci, capture);
     572        memset(&pdev, 0, sizeof(pdev));
     573        pdev.type = SNDRV_DMA_TYPE_DEV;
     574        pdev.dev = snd_dma_pci_data(pci);
     575        pdev.id = capture;
    573576        dmbuf.bytes = 0;
    574577        if (! snd_dma_get_reserved(&pdev, &dmbuf)) {
     
    583586static void snd_hammerfall_free_buffer(struct pci_dev *pci, size_t size, void *ptr, dma_addr_t addr, int capture)
    584587{
    585         struct snd_dma_device dev;
    586         snd_dma_device_pci(&dev, pci, capture);
    587         snd_dma_free_reserved(&dev);
     588        struct snd_dma_device pdev;
     589
     590        memset(&pdev, 0, sizeof(pdev));
     591        pdev.type = SNDRV_DMA_TYPE_DEV;
     592        pdev.dev = snd_dma_pci_data(pci);
     593        pdev.id = capture;
     594        snd_dma_free_reserved(&pdev);
    588595}
    589596
  • GPL/branches/alsa-resync1/alsa-kernel/pci/rme9652/rme9652.c

    r290 r348  
    315315        struct snd_dma_buffer dmbuf;
    316316
    317         snd_dma_device_pci(&pdev, pci, capture);
     317        memset(&pdev, 0, sizeof(pdev));
     318        pdev.type = SNDRV_DMA_TYPE_DEV;
     319        pdev.dev = snd_dma_pci_data(pci);
     320        pdev.id = capture;
    318321        dmbuf.bytes = 0;
    319322        if (! snd_dma_get_reserved(&pdev, &dmbuf)) {
     
    328331static void snd_hammerfall_free_buffer(struct pci_dev *pci, size_t size, void *ptr, dma_addr_t addr, int capture)
    329332{
    330         struct snd_dma_device dev;
    331         snd_dma_device_pci(&dev, pci, capture);
    332         snd_dma_free_reserved(&dev);
     333        struct snd_dma_device pdev;
     334
     335        memset(&pdev, 0, sizeof(pdev));
     336        pdev.type = SNDRV_DMA_TYPE_DEV;
     337        pdev.dev = snd_dma_pci_data(pci);
     338        pdev.id = capture;
     339        snd_dma_free_reserved(&pdev);
    333340}
    334341
  • GPL/branches/alsa-resync1/alsa-kernel/pci/sonicvibes.c

    r290 r348  
    891891        sonic->pcm = pcm;
    892892
    893         snd_pcm_lib_preallocate_pci_pages_for_all(sonic->pci, pcm, 64*1024, 128*1024);
     893        snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
     894                                              snd_dma_pci_data(sonic->pci), 64*1024, 128*1024);
    894895
    895896        if (rpcm)
  • GPL/branches/alsa-resync1/alsa-kernel/pci/trident/trident_main.c

    r290 r348  
    35803580    }
    35813581    trident->irq = pci->irq;
     3582
     3583        memset(&trident->dma_dev, 0, sizeof(trident->dma_dev));
     3584        trident->dma_dev.type = SNDRV_DMA_TYPE_DEV;
     3585        trident->dma_dev.dev = snd_dma_pci_data(pci);
    35823586
    35833587    /* allocate 16k-aligned TLB for NX cards */
  • GPL/branches/alsa-resync1/alsa-kernel/pci/trident/trident_memory.c

    r210 r348  
    8080    __set_tlb_bus(trident, page, (unsigned long)trident->tlb.silent_page.area, trident->tlb.silent_page.addr);
    8181    __set_tlb_bus(trident, page+1, (unsigned long)trident->tlb.silent_page.area, trident->tlb.silent_page.addr);
    82 //      __set_tlb_bus(trident, page, (unsigned long)trident->tlb.silent_page, trident->tlb.silent_page_dmaaddr);
    83 //      __set_tlb_bus(trident, page+1, (unsigned long)trident->tlb.silent_page, trident->tlb.silent_page_dmaaddr);
    8482}
    8583
     
    116114        for (i = 0; i < UNIT_PAGES; i++, page++)
    117115            __set_tlb_bus(trident, page, (unsigned long)trident->tlb.silent_page.area, trident->tlb.silent_page.addr);
    118             //    __set_tlb_bus(trident, page, (unsigned long)trident->tlb.silent_page, trident->tlb.silent_page_dmaaddr);
    119116}
    120117
Note: See TracChangeset for help on using the changeset viewer.