Ignore:
Timestamp:
Apr 19, 2025, 8:08:37 PM (4 months ago)
Author:
David Azarewicz
Message:

Merge in changes from 6.6-LTS branch.
Fixed additional 25+ problems.

Location:
GPL/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk

  • GPL/trunk/alsa-kernel/include/sound/memalloc.h

    r717 r772  
    1010#define __SOUND_MEMALLOC_H
    1111
     12#include <linux/dma-direction.h>
    1213#include <asm/page.h>
    1314
    1415struct device;
    1516struct vm_area_struct;
     17struct sg_table;
    1618
    1719/*
     
    2022struct snd_dma_device {
    2123        int type;                       /* SNDRV_DMA_TYPE_XXX */
     24        enum dma_data_direction dir;    /* DMA direction */
     25        bool need_sync;                 /* explicit sync needed? */
    2226        struct device *dev;             /* generic device */
    2327};
    24 
    25 #define snd_dma_continuous_data(x)      ((struct device *)(__force unsigned long)(x))
    26 
    2728
    2829/*
     
    3334#define SNDRV_DMA_TYPE_DEV              2       /* generic device continuous */
    3435#define SNDRV_DMA_TYPE_DEV_WC           5       /* continuous write-combined */
    35 #ifdef CONFIG_SND_DMA_SGBUF
    36 #define SNDRV_DMA_TYPE_DEV_SG           3       /* generic device SG-buffer */
    37 #define SNDRV_DMA_TYPE_DEV_WC_SG        6       /* SG write-combined */
    38 #else
    39 #define SNDRV_DMA_TYPE_DEV_SG   SNDRV_DMA_TYPE_DEV /* no SG-buf support */
    40 #define SNDRV_DMA_TYPE_DEV_WC_SG        SNDRV_DMA_TYPE_DEV_WC
    41 #endif
    4236#ifdef CONFIG_GENERIC_ALLOCATOR
    4337#define SNDRV_DMA_TYPE_DEV_IRAM         4       /* generic device iram-buffer */
     
    4640#endif
    4741#define SNDRV_DMA_TYPE_VMALLOC          7       /* vmalloc'ed buffer */
     42#define SNDRV_DMA_TYPE_NONCONTIG        8       /* non-coherent SG buffer */
     43#define SNDRV_DMA_TYPE_NONCOHERENT      9       /* non-coherent buffer */
     44#ifdef CONFIG_SND_DMA_SGBUF
     45#define SNDRV_DMA_TYPE_DEV_SG           SNDRV_DMA_TYPE_NONCONTIG
     46#define SNDRV_DMA_TYPE_DEV_WC_SG        6       /* SG write-combined */
     47#else
     48#define SNDRV_DMA_TYPE_DEV_SG   SNDRV_DMA_TYPE_DEV /* no SG-buf support */
     49#define SNDRV_DMA_TYPE_DEV_WC_SG        SNDRV_DMA_TYPE_DEV_WC
     50#endif
     51/* fallback types, don't use those directly */
     52#ifdef CONFIG_SND_DMA_SGBUF
     53#define SNDRV_DMA_TYPE_DEV_SG_FALLBACK          10
     54#define SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK       11
     55#endif
    4856
    4957/*
     
    6775
    6876/* allocate/release a buffer */
    69 int snd_dma_alloc_pages(int type, struct device *dev, size_t size,
    70                         struct snd_dma_buffer *dmab);
     77int snd_dma_alloc_dir_pages(int type, struct device *dev,
     78                            enum dma_data_direction dir, size_t size,
     79                            struct snd_dma_buffer *dmab);
     80
     81static inline int snd_dma_alloc_pages(int type, struct device *dev,
     82                                      size_t size, struct snd_dma_buffer *dmab)
     83{
     84        return snd_dma_alloc_dir_pages(type, dev, DMA_BIDIRECTIONAL, size, dmab);
     85}
     86
    7187int snd_dma_alloc_pages_fallback(int type, struct device *dev, size_t size,
    7288                                 struct snd_dma_buffer *dmab);
     
    7490int snd_dma_buffer_mmap(struct snd_dma_buffer *dmab,
    7591                        struct vm_area_struct *area);
     92
     93enum snd_dma_sync_mode { SNDRV_DMA_SYNC_CPU, SNDRV_DMA_SYNC_DEVICE };
     94#ifdef CONFIG_HAS_DMA
     95void snd_dma_buffer_sync(struct snd_dma_buffer *dmab,
     96                         enum snd_dma_sync_mode mode);
     97#else
     98static inline void snd_dma_buffer_sync(struct snd_dma_buffer *dmab,
     99                                       enum snd_dma_sync_mode mode) {}
     100#endif
    76101
    77102dma_addr_t snd_sgbuf_get_addr(struct snd_dma_buffer *dmab, size_t offset);
     
    81106
    82107/* device-managed memory allocator */
    83 struct snd_dma_buffer *snd_devm_alloc_pages(struct device *dev, int type,
    84                                             size_t size);
     108struct snd_dma_buffer *snd_devm_alloc_dir_pages(struct device *dev, int type,
     109                                                enum dma_data_direction dir,
     110                                                size_t size);
     111
     112static inline struct snd_dma_buffer *
     113snd_devm_alloc_pages(struct device *dev, int type, size_t size)
     114{
     115        return snd_devm_alloc_dir_pages(dev, type, DMA_BIDIRECTIONAL, size);
     116}
     117
     118static inline struct sg_table *
     119snd_dma_noncontig_sg_table(struct snd_dma_buffer *dmab)
     120{
     121        return dmab->private_data;
     122}
     123
    85124#ifdef TARGET_OS2
    86125int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab);
Note: See TracChangeset for help on using the changeset viewer.