Changeset 351

Show
Ignore:
Timestamp:
04/21/08 11:41:48 (7 months ago)
Author:
psmedley
Message:

Add fixes for Via 823x chipsets

Location:
GPL/branches/uniaud32-2.0
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • GPL/branches/uniaud32-2.0/alsa-kernel/core/memalloc.c

    r324 r351  
    250250#ifdef CONFIG_HAS_DMA 
    251251/* allocate the coherent DMA pages */ 
     252#ifndef TARGET_OS2 
    252253static void *snd_malloc_dev_pages(struct device *dev, size_t size, dma_addr_t *dma) 
     254#else 
     255void *snd_malloc_dev_pages(struct device *dev, size_t size, dma_addr_t *dma) 
     256#endif 
    253257{ 
    254258        int pg; 
     
    271275 
    272276/* free the coherent DMA pages */ 
     277#ifndef TARGET_OS2 
    273278static void snd_free_dev_pages(struct device *dev, size_t size, void *ptr, 
     279#else 
     280void snd_free_dev_pages(struct device *dev, size_t size, void *ptr, 
     281#endif 
    274282                               dma_addr_t dma) 
    275283{ 
     
    340348                        struct snd_dma_buffer *dmab) 
    341349{ 
     350#ifdef DEBUG 
     351    dprintf(("snd_dma_alloc_pages with size = %d",size)); 
     352#endif 
    342353        snd_assert(size > 0, return -ENXIO); 
    343354        snd_assert(dmab != NULL, return -ENXIO); 
  • GPL/branches/uniaud32-2.0/alsa-kernel/core/sgbuf.c

    r305 r351  
    3333#define sgbuf_align_table(tbl)  ALIGN((tbl), SGBUF_TBL_ALIGN) 
    3434 
     35#ifndef TARGET_OS2 
    3536int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab) 
    3637{ 
     
    6364        return 0; 
    6465} 
     66#else 
     67/* base this fn on the one in Uniaud 1.1.4 */ 
     68int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab) 
     69{ 
     70        struct snd_sg_buf *sgbuf = dmab->private_data; 
     71 
     72        sgbuf_shrink(sgbuf, 0); 
     73        if (sgbuf->table) 
     74                kfree(sgbuf->table); 
     75        sgbuf->table = NULL; 
     76        if (sgbuf->page_table) 
     77                kfree(sgbuf->page_table); 
     78        kfree(sgbuf); 
     79        dmab->private_data = NULL; 
     80         
     81        return 0; 
     82} 
     83 
     84/* 
     85 * shrink to the given pages. 
     86 * free the unused pages 
     87 */ 
     88static void sgbuf_shrink(struct snd_sg_buf *sgbuf, int pages) 
     89{ 
     90        snd_assert(sgbuf, return); 
     91        if (! sgbuf->table) 
     92                return; 
     93        while (sgbuf->pages > pages) { 
     94                sgbuf->pages--; 
     95                snd_free_dev_pages(sgbuf->dev, PAGE_SIZE, 
     96                                   sgbuf->table[sgbuf->pages].buf, 
     97                                   sgbuf->table[sgbuf->pages].addr); 
     98        } 
     99} 
     100#endif 
    65101 
    66102void *snd_malloc_sgbuf_pages(struct device *device, 
     
    71107        unsigned int i, pages; 
    72108        struct snd_dma_buffer tmpb; 
     109#ifdef TARGET_OS2 
     110        void *ptr; 
     111        dma_addr_t addr; 
     112#endif 
     113 
     114#ifdef DEBUG 
     115        dprintf(("snd_malloc_sgbuf_pages. size %x",size)); 
     116#endif 
    73117 
    74118        dmab->area = NULL; 
    75119        dmab->addr = 0; 
    76120        dmab->private_data = sgbuf = kzalloc(sizeof(*sgbuf), GFP_KERNEL); 
    77         if (! sgbuf) 
     121        if (! sgbuf) { 
     122#ifdef DEBUG 
     123                dprintf(("snd_malloc_sgbuf_pages failed: error allocating sgbuf")); 
     124#endif 
    78125                return NULL; 
     126        } 
    79127        sgbuf->dev = device; 
    80128        pages = snd_sgbuf_aligned_pages(size); 
    81129        sgbuf->tblsize = sgbuf_align_table(pages); 
    82130        sgbuf->table = kcalloc(sgbuf->tblsize, sizeof(*sgbuf->table), GFP_KERNEL); 
    83         if (! sgbuf->table) 
     131        if (! sgbuf->table) { 
     132#ifdef DEBUG 
     133                dprintf(("snd_malloc_sgbuf_pages failed: error allocating sgbuf->table")); 
     134#endif 
    84135                goto _failed; 
     136        } 
    85137        sgbuf->page_table = kcalloc(sgbuf->tblsize, sizeof(*sgbuf->page_table), GFP_KERNEL); 
    86         if (! sgbuf->page_table) 
     138        if (! sgbuf->page_table) { 
     139#ifdef DEBUG 
     140                dprintf(("snd_malloc_sgbuf_pages failed: error allocating sgbuf->page_table")); 
     141#endif 
    87142                goto _failed; 
     143        } 
    88144 
     145#ifdef DEBUG 
     146            dprintf(("allocating %d pages",pages)); 
     147#endif 
     148#ifndef TARGET_OS2 
    89149        /* allocate each page */ 
    90150        for (i = 0; i < pages; i++) { 
     
    107167        if (! dmab->area) 
    108168                goto _failed; 
     169#else 
     170            ptr = snd_malloc_dev_pages(sgbuf->dev, size, &addr); 
     171            if (! ptr) 
     172                goto _failed; 
     173 
     174            /* allocate each page */ 
     175            while (sgbuf->pages < pages) { 
     176                mem_map_t *page; 
     177 
     178                sgbuf->table[sgbuf->pages].buf = (char*)ptr + PAGE_SIZE*sgbuf->pages; 
     179                sgbuf->table[sgbuf->pages].addr = addr + PAGE_SIZE*sgbuf->pages; 
     180                page = (mem_map_t *)virt_to_page((int)sgbuf->table[sgbuf->pages].buf); 
     181                sgbuf->page_table[sgbuf->pages] = page; 
     182                SetPageReserved(page); 
     183                sgbuf->pages++; 
     184            } 
     185 
     186            memset(ptr,0,size); 
     187 
     188            dmab->area = ptr; 
     189            sgbuf->size = size; 
     190#endif 
    109191        return dmab->area; 
    110192 
  • GPL/branches/uniaud32-2.0/alsa-kernel/core/sound_oss.c

    r333 r351  
    9898 
    9999int snd_register_oss_device(int type, struct snd_card *card, int dev, 
     100#ifndef TARGET_OS2 
    100101                            const struct file_operations *f_ops, void *private_data, 
     102#else 
     103                            struct file_operations *f_ops, void *private_data, 
     104#endif 
    101105                            const char *name) 
    102106{ 
  • GPL/branches/uniaud32-2.0/alsa-kernel/include/sound/config.h

    r335 r351  
    140140#endif 
    141141#ifndef virt_to_page 
    142 //#define virt_to_page(x) (&mem_map[MAP_NR(x)]) 
     142#define virt_to_page(x) (&mem_map[MAP_NR(x)]) 
    143143#endif 
    144144#define snd_request_region request_region 
     
    298298#define CONFIG_PM 
    299299#define CONFIG_HAVE_PCI_DEV_PRESENT 
     300#define CONFIG_SND_DEBUG_DETECT 
    300301#define CONFIG_SYSFS_DEPRECATED 
    301302#undef interrupt 
  • GPL/branches/uniaud32-2.0/alsa-kernel/include/sound/core.h

    r324 r351  
    282282#ifdef CONFIG_SND_OSSEMUL 
    283283int snd_register_oss_device(int type, struct snd_card *card, int dev, 
     284#ifndef TARGET_OS2 
    284285                            const struct file_operations *f_ops, void *private_data, 
     286#else 
     287                            struct file_operations *f_ops, void *private_data, 
     288#endif 
    285289                            const char *name); 
    286290int snd_unregister_oss_device(int type, struct snd_card *card, int dev); 
  • GPL/branches/uniaud32-2.0/alsa-kernel/pci/via82xx.c

    r305 r351  
    24062406        w = snd_pci_quirk_lookup(pci, dxs_whitelist); 
    24072407        if (w) { 
    2408 #ifndef TARGET_OS2 
    24092408                snd_printdd(KERN_INFO "via82xx: DXS white list for %s found\n", 
    24102409                            w->name); 
    2411 #endif 
    24122410                return w->value; 
    24132411        } 
  • GPL/branches/uniaud32-2.0/include/linux/sched.h

    r314 r351  
    55 
    66#include <asm/param.h>  /* for HZ */ 
     7#include <asm/atomic.h>  
    78 
    89#define TASK_RUNNING            0