diff options
| author | Jaroslav Kysela <perex@suse.cz> | 2003-01-27 20:31:11 +0100 |
|---|---|---|
| committer | Jaroslav Kysela <perex@suse.cz> | 2003-01-27 20:31:11 +0100 |
| commit | b8038484bf9c60e6e8669d098bb705deda099445 (patch) | |
| tree | e9cb19e14bffab7ab8b84ad1341be1c91c841bec /include | |
| parent | 191c011abbb58966ab1ec30421e082f9802f2c8d (diff) | |
ALSA update
- added DocBook documentation
- added many source comments
- simplified proc style interface (per card)
- updated PCM scatter-gather routines
- moved PM locking outside callbacks
Diffstat (limited to 'include')
| -rw-r--r-- | include/sound/ac97_codec.h | 4 | ||||
| -rw-r--r-- | include/sound/ad1848.h | 1 | ||||
| -rw-r--r-- | include/sound/ak4531_codec.h | 1 | ||||
| -rw-r--r-- | include/sound/core.h | 3 | ||||
| -rw-r--r-- | include/sound/cs46xx.h | 2 | ||||
| -rw-r--r-- | include/sound/emu10k1.h | 21 | ||||
| -rw-r--r-- | include/sound/gus.h | 8 | ||||
| -rw-r--r-- | include/sound/info.h | 16 | ||||
| -rw-r--r-- | include/sound/pcm.h | 12 | ||||
| -rw-r--r-- | include/sound/pcm_sgbuf.h | 3 | ||||
| -rw-r--r-- | include/sound/sb.h | 1 | ||||
| -rw-r--r-- | include/sound/sb16_csp.h | 1 | ||||
| -rw-r--r-- | include/sound/sndmagic.h | 56 | ||||
| -rw-r--r-- | include/sound/trident.h | 6 | ||||
| -rw-r--r-- | include/sound/version.h | 2 |
15 files changed, 95 insertions, 42 deletions
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h index fd6c403d0828..47e5e67e990e 100644 --- a/include/sound/ac97_codec.h +++ b/include/sound/ac97_codec.h @@ -196,6 +196,8 @@ #define AC97_CXR_SPDIF_AC3 0x2 /* specific - ALC */ +#define AC97_ALC650_SURR_DAC_VOL 0x64 +#define AC97_ALC650_LFE_DAC_VOL 0x66 #define AC97_ALC650_MULTICH 0x6a #define AC97_ALC650_CLOCK 0x7a @@ -235,8 +237,6 @@ struct _snd_ac97 { unsigned short (*read) (ac97_t *ac97, unsigned short reg); void (*wait) (ac97_t *ac97); void (*init) (ac97_t *ac97); - snd_info_entry_t *proc_entry; - snd_info_entry_t *proc_regs_entry; void *private_data; void (*private_free) (ac97_t *ac97); /* --- */ diff --git a/include/sound/ad1848.h b/include/sound/ad1848.h index 9ae8eb32db5f..18f1fec77e2d 100644 --- a/include/sound/ad1848.h +++ b/include/sound/ad1848.h @@ -162,6 +162,7 @@ int snd_ad1848_create(snd_card_t * card, ad1848_t ** chip); int snd_ad1848_pcm(ad1848_t * chip, int device, snd_pcm_t **rpcm); +const snd_pcm_ops_t *snd_ad1848_get_pcm_ops(int direction); int snd_ad1848_mixer(ad1848_t * chip); void snd_ad1848_interrupt(int irq, void *dev_id, struct pt_regs *regs); diff --git a/include/sound/ak4531_codec.h b/include/sound/ak4531_codec.h index bf8294d6722c..ad7b52bc2627 100644 --- a/include/sound/ak4531_codec.h +++ b/include/sound/ak4531_codec.h @@ -68,7 +68,6 @@ typedef struct _snd_ak4531 ak4531_t; struct _snd_ak4531 { void (*write) (ak4531_t *ak4531, unsigned short reg, unsigned short val); - snd_info_entry_t *proc_entry; void *private_data; void (*private_free) (ak4531_t *ak4531); /* --- */ diff --git a/include/sound/core.h b/include/sound/core.h index 9d705453eca1..68b3a692eff7 100644 --- a/include/sound/core.h +++ b/include/sound/core.h @@ -55,6 +55,7 @@ typedef enum { SNDRV_DEV_TIMER, SNDRV_DEV_SEQUENCER, SNDRV_DEV_HWDEP, + SNDRV_DEV_INFO, SNDRV_DEV_LOWLEVEL = (2*SNDRV_DEV_TYPE_RANGE_SIZE) } snd_device_type_t; @@ -281,6 +282,8 @@ void snd_free_pages(void *ptr, unsigned long size); void *snd_malloc_pci_pages(struct pci_dev *pci, unsigned long size, dma_addr_t *dma_addr); void *snd_malloc_pci_pages_fallback(struct pci_dev *pci, unsigned long size, dma_addr_t *dma_addr, unsigned long *res_size); void snd_free_pci_pages(struct pci_dev *pci, unsigned long size, void *ptr, dma_addr_t dma_addr); +void *snd_malloc_pci_page(struct pci_dev *pci, dma_addr_t *dma_addr); +#define snd_free_pci_page(pci,ptr,addr) snd_free_pci_pages(pci,PAGE_SIZE,ptr,addr) #endif #ifdef CONFIG_SBUS void *snd_malloc_sbus_pages(struct sbus_dev *sdev, unsigned long size, dma_addr_t *dma_addr); diff --git a/include/sound/cs46xx.h b/include/sound/cs46xx.h index dc849a634aec..f60ea070bacd 100644 --- a/include/sound/cs46xx.h +++ b/include/sound/cs46xx.h @@ -1673,7 +1673,6 @@ typedef struct { unsigned long remap_addr; unsigned long size; struct resource *resource; - void *proc_entry; } snd_cs46xx_region_t; struct _snd_cs46xx { @@ -1726,7 +1725,6 @@ struct _snd_cs46xx { spinlock_t reg_lock; unsigned int midcr; unsigned int uartm; - snd_info_entry_t *proc_entry; int amplifier; void (*amplifier_ctrl)(cs46xx_t *, int); diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h index 7d6b34144c0d..afdb277148c0 100644 --- a/include/sound/emu10k1.h +++ b/include/sound/emu10k1.h @@ -25,12 +25,11 @@ #ifdef __KERNEL__ -#include "pcm.h" -#include "pcm_sgbuf.h" -#include "rawmidi.h" -#include "hwdep.h" -#include "ac97_codec.h" -#include "util_mem.h" +#include <sound/pcm.h> +#include <sound/rawmidi.h> +#include <sound/hwdep.h> +#include <sound/ac97_codec.h> +#include <sound/util_mem.h> #include <asm/io.h> #ifndef PCI_VENDOR_ID_CREATIVE @@ -993,13 +992,6 @@ struct _snd_emu10k1 { emu10k1_midi_t midi2; /* for audigy */ unsigned int efx_voices_mask[2]; - - snd_info_entry_t *proc_entry; - snd_info_entry_t *proc_entry_fx8010_gpr; - snd_info_entry_t *proc_entry_fx8010_tram_data; - snd_info_entry_t *proc_entry_fx8010_tram_addr; - snd_info_entry_t *proc_entry_fx8010_code; - snd_info_entry_t *proc_entry_fx8010_iblocks; }; int snd_emu10k1_create(snd_card_t * card, @@ -1045,7 +1037,7 @@ unsigned int snd_emu10k1_rate_to_pitch(unsigned int rate); unsigned char snd_emu10k1_sum_vol_attn(unsigned int value); /* memory allocation */ -snd_util_memblk_t *snd_emu10k1_alloc_pages(emu10k1_t *emu, struct snd_sg_buf *sgbuf); +snd_util_memblk_t *snd_emu10k1_alloc_pages(emu10k1_t *emu, snd_pcm_substream_t *substream); int snd_emu10k1_free_pages(emu10k1_t *emu, snd_util_memblk_t *blk); snd_util_memblk_t *snd_emu10k1_synth_alloc(emu10k1_t *emu, unsigned int size); int snd_emu10k1_synth_free(emu10k1_t *emu, snd_util_memblk_t *blk); @@ -1063,7 +1055,6 @@ int snd_emu10k1_audigy_midi(emu10k1_t * emu); /* proc interface */ int snd_emu10k1_proc_init(emu10k1_t * emu); -int snd_emu10k1_proc_done(emu10k1_t * emu); #endif /* __KERNEL__ */ diff --git a/include/sound/gus.h b/include/sound/gus.h index 2e84f2687588..a896bf9ff626 100644 --- a/include/sound/gus.h +++ b/include/sound/gus.h @@ -210,7 +210,6 @@ typedef struct _snd_gf1_mem { snd_gf1_bank_info_t banks_16[4]; snd_gf1_mem_block_t *first; snd_gf1_mem_block_t *last; - snd_info_entry_t *info_entry; struct semaphore memory_mutex; } snd_gf1_mem_t; @@ -332,8 +331,6 @@ struct _snd_gf1 { unsigned int rom_banks; /* GUS's ROM banks */ snd_gf1_mem_t mem_alloc; - snd_info_entry_t *ram_entries[4]; - snd_info_entry_t *rom_entries[4]; /* registers */ unsigned short reg_page; @@ -452,9 +449,6 @@ struct _snd_gus_card { int timer_dev; /* timer device */ struct _snd_gf1 gf1; /* gf1 specific variables */ -#ifdef CONFIG_SND_DEBUG - snd_info_entry_t *irq_entry; -#endif snd_pcm_t *pcm; snd_pcm_substream_t *pcm_cap_substream; unsigned int c_dma_size; @@ -601,7 +595,6 @@ int snd_gf1_mem_done(snd_gus_card_t * gus); /* gus_mem_proc.c */ int snd_gf1_mem_proc_init(snd_gus_card_t * gus); -int snd_gf1_mem_proc_done(snd_gus_card_t * gus); /* gus_dma.c */ @@ -676,7 +669,6 @@ int snd_gus_initialize(snd_gus_card_t * gus); void snd_gus_interrupt(int irq, void *dev_id, struct pt_regs *regs); #ifdef CONFIG_SND_DEBUG void snd_gus_irq_profile_init(snd_gus_card_t *gus); -void snd_gus_irq_profile_done(snd_gus_card_t *gus); #endif /* gus_uart.c */ diff --git a/include/sound/info.h b/include/sound/info.h index 6984c6e736dc..c9bb51aedb04 100644 --- a/include/sound/info.h +++ b/include/sound/info.h @@ -141,6 +141,19 @@ struct proc_dir_entry *snd_create_proc_entry(const char *name, mode_t mode, void snd_remove_proc_entry(struct proc_dir_entry *parent, struct proc_dir_entry *de); +/* for card drivers */ +int snd_card_proc_new(snd_card_t *card, const char *name, snd_info_entry_t **entryp); + +inline static void snd_info_set_text_ops(snd_info_entry_t *entry, + void *private_data, + void (*read)(snd_info_entry_t *, snd_info_buffer_t *)) +{ + entry->private_data = private_data; + entry->c.text.read_size = 1024; + entry->c.text.read = read; +} + + #else #define snd_seq_root NULL @@ -169,6 +182,9 @@ static inline struct proc_dir_entry *snd_create_proc_entry(const char *name, mod static inline void snd_remove_proc_entry(struct proc_dir_entry *parent, struct proc_dir_entry *de) { ; } +#define snd_card_proc_new(card,name,entryp) 0 /* always success */ +#define snd_info_set_text_ops(entry,private_data,read) /*NOP*/ + #endif /* diff --git a/include/sound/pcm.h b/include/sound/pcm.h index d97f7e751d9a..0bc5fef9456e 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h @@ -50,7 +50,7 @@ typedef struct sndrv_pcm_mmap_status snd_pcm_mmap_status_t; typedef struct sndrv_pcm_mmap_control snd_pcm_mmap_control_t; typedef struct sndrv_mask snd_mask_t; -#define _snd_pcm_substream_chip(substream) ((substream)->pcm->private_data) +#define _snd_pcm_substream_chip(substream) ((substream)->private_data) #define snd_pcm_substream_chip(substream) snd_magic_cast1(chip_t, _snd_pcm_substream_chip(substream), return -ENXIO) #define _snd_pcm_chip(pcm) ((pcm)->private_data) #define snd_pcm_chip(pcm) snd_magic_cast1(chip_t, _snd_pcm_chip(pcm), return -ENXIO) @@ -120,10 +120,11 @@ typedef struct _snd_pcm_ops { #define SNDRV_PCM_TRIGGER_SUSPEND 5 #define SNDRV_PCM_TRIGGER_RESUME 6 -#define SNDRV_PCM_DMA_TYPE_CONTINUOUS 0 /* continuous no-DMA memory */ -#define SNDRV_PCM_DMA_TYPE_ISA 1 /* ISA continuous */ -#define SNDRV_PCM_DMA_TYPE_PCI 2 /* PCI continuous */ -#define SNDRV_PCM_DMA_TYPE_SBUS 3 /* SBUS continuous */ +#define SNDRV_PCM_DMA_TYPE_UNKNOWN 0 /* not defined */ +#define SNDRV_PCM_DMA_TYPE_CONTINUOUS 1 /* continuous no-DMA memory */ +#define SNDRV_PCM_DMA_TYPE_ISA 2 /* ISA continuous */ +#define SNDRV_PCM_DMA_TYPE_PCI 3 /* PCI continuous */ +#define SNDRV_PCM_DMA_TYPE_SBUS 4 /* SBUS continuous */ /* If you change this don't forget to change rates[] table in pcm_native.c */ #define SNDRV_PCM_RATE_5512 (1<<0) /* 5512Hz */ @@ -363,6 +364,7 @@ struct _snd_pcm_runtime { struct _snd_pcm_substream { snd_pcm_t *pcm; snd_pcm_str_t *pstr; + void *private_data; /* copied from pcm->private_data */ int number; char name[32]; /* substream name */ int stream; /* stream (direction) */ diff --git a/include/sound/pcm_sgbuf.h b/include/sound/pcm_sgbuf.h index bc6474559c57..e5dda1d053af 100644 --- a/include/sound/pcm_sgbuf.h +++ b/include/sound/pcm_sgbuf.h @@ -63,5 +63,8 @@ int snd_pcm_sgbuf_ops_copy_capture(snd_pcm_substream_t *substream, int channel, int snd_pcm_sgbuf_ops_silence(snd_pcm_substream_t *substream, int channel, snd_pcm_uframes_t hwoff, snd_pcm_uframes_t count); struct page *snd_pcm_sgbuf_ops_page(snd_pcm_substream_t *substream, unsigned long offset); +#define _snd_pcm_substream_sgbuf(substream) ((substream)->dma_private) +#define snd_pcm_substream_sgbuf(substream) snd_magic_cast(snd_pcm_sgbuf_t, _snd_pcm_substream_sgbuf(substream), return -ENXIO) + #endif /* __SOUND_PCM_SGBUF_H */ diff --git a/include/sound/sb.h b/include/sound/sb.h index 53f243b7bf64..4b9b902e9ea7 100644 --- a/include/sound/sb.h +++ b/include/sound/sb.h @@ -305,6 +305,7 @@ int snd_sb8dsp_midi(sb_t *chip, int device, snd_rawmidi_t ** rrawmidi); /* sb16_init.c */ int snd_sb16dsp_pcm(sb_t *chip, int device, snd_pcm_t ** rpcm); +const snd_pcm_ops_t *snd_sb16dsp_get_pcm_ops(int direction); int snd_sb16dsp_configure(sb_t *chip); /* sb16.c */ void snd_sb16dsp_interrupt(int irq, void *dev_id, struct pt_regs *regs); diff --git a/include/sound/sb16_csp.h b/include/sound/sb16_csp.h index dfdb71dc6a7d..eb8368b56b16 100644 --- a/include/sound/sb16_csp.h +++ b/include/sound/sb16_csp.h @@ -159,7 +159,6 @@ struct snd_sb_csp { snd_kcontrol_t *qsound_space; struct semaphore access_mutex; /* locking */ - snd_info_entry_t *proc; /* proc interface */ }; int snd_sb_csp_new(sb_t *chip, int device, snd_hwdep_t ** rhwdep); diff --git a/include/sound/sndmagic.h b/include/sound/sndmagic.h index 83495c4ce9e5..560f248b9cdf 100644 --- a/include/sound/sndmagic.h +++ b/include/sound/sndmagic.h @@ -27,10 +27,45 @@ void *_snd_magic_kcalloc(unsigned long magic, size_t size, int flags); void *_snd_magic_kmalloc(unsigned long magic, size_t size, int flags); -void snd_magic_kfree(void *ptr); -#define snd_magic_kcalloc(type, extra, flags) (type *) _snd_magic_kcalloc(type##_magic, sizeof(type) + extra, flags) -#define snd_magic_kmalloc(type, extra, flags) (type *) _snd_magic_kmalloc(type##_magic, sizeof(type) + extra, flags) +/** + * snd_magic_kmalloc - allocate a record with a magic-prefix + * @type: the type to allocate a record (like xxx_t) + * @extra: the extra size to allocate in bytes + * @flags: the allocation condition (GFP_XXX) + * + * Allocates a record of the given type with the extra space and + * returns its pointer. The allocated record has a secret magic-key + * to be checked via snd_magic_cast() for safe casts. + * + * The allocated pointer must be released via snd_magic_kfree(). + * + * The "struct xxx" style cannot be used as the type argument + * because the magic-key constant is generated from the type-name + * string. + */ +#define snd_magic_kmalloc(type, extra, flags) \ + (type *) _snd_magic_kmalloc(type##_magic, sizeof(type) + extra, flags) +/** + * snd_magic_kcalloc - allocate a record with a magic-prefix and initialize + * @type: the type to allocate a record (like xxx_t) + * @extra: the extra size to allocate in bytes + * @flags: the allocation condition (GFP_XXX) + * + * Works like snd_magic_kmalloc() but this clears the area with zero + * automatically. + */ +#define snd_magic_kcalloc(type, extra, flags) \ + (type *) _snd_magic_kcalloc(type##_magic, sizeof(type) + extra, flags) + +/** + * snd_magic_kfree - release the allocated area + * @ptr: the pointer allocated via snd_magic_kmalloc() or snd_magic_kcalloc() + * + * Releases the memory area allocated via snd_magic_kmalloc() or + * snd_magic_kcalloc() function. + */ +void snd_magic_kfree(void *ptr); static inline unsigned long _snd_magic_value(void *obj) { @@ -44,7 +79,19 @@ static inline int _snd_magic_bad(void *obj, unsigned long magic) #define snd_magic_cast1(t, expr, cmd) snd_magic_cast(t, expr, cmd) -#define snd_magic_cast(type, ptr, action...) (type *) ({\ +/** + * snd_magic_cast - check and cast the magic-allocated pointer + * @type: the type of record to cast + * @ptr: the magic-allocated pointer + * @action...: the action to do if failed + * + * This macro provides a safe cast for the given type, which was + * allocated via snd_magic_kmalloc() or snd_magic_kcallc(). + * If the pointer is invalid, i.e. the cast-type doesn't match, + * the action arguments are called with a debug message. + */ +#define snd_magic_cast(type, ptr, action...) \ + (type *) ({\ void *__ptr = ptr;\ unsigned long __magic = _snd_magic_value(__ptr);\ if (__magic != type##_magic) {\ @@ -64,6 +111,7 @@ static inline int _snd_magic_bad(void *obj, unsigned long magic) #define snd_pcm_sgbuf_t_magic 0xa15a0107 #define snd_info_private_data_t_magic 0xa15a0201 +#define snd_info_entry_t_magic 0xa15a0202 #define snd_ctl_file_t_magic 0xa15a0301 #define snd_kcontrol_t_magic 0xa15a0302 #define snd_rawmidi_t_magic 0xa15a0401 diff --git a/include/sound/trident.h b/include/sound/trident.h index bf4ed45f1a63..f4f4042f6e7f 100644 --- a/include/sound/trident.h +++ b/include/sound/trident.h @@ -431,7 +431,8 @@ struct _snd_trident { int ChanPCM; /* max number of PCM channels */ int ChanPCMcnt; /* actual number of PCM channels */ - int ac97_detect; /* 1 = AC97 in detection phase */ + unsigned int ac97_detect: 1; /* 1 = AC97 in detection phase */ + unsigned int in_suspend: 1; /* 1 during suspend/resume */ struct _snd_4dwave synth; /* synth specific variables */ @@ -452,7 +453,6 @@ struct _snd_trident { snd_trident_pcm_mixer_t pcm_mixer[32]; spinlock_t reg_lock; - snd_info_entry_t *proc_entry; struct snd_trident_gameport *gameport; }; @@ -479,7 +479,7 @@ void snd_trident_write_voice_regs(trident_t * trident, snd_trident_voice_t *voic void snd_trident_clear_voices(trident_t * trident, unsigned short v_min, unsigned short v_max); /* TLB memory allocation */ -snd_util_memblk_t *snd_trident_alloc_pages(trident_t *trident, void *pages, dma_addr_t addr, unsigned long size); +snd_util_memblk_t *snd_trident_alloc_pages(trident_t *trident, snd_pcm_substream_t *substream); int snd_trident_free_pages(trident_t *trident, snd_util_memblk_t *blk); snd_util_memblk_t *snd_trident_synth_alloc(trident_t *trident, unsigned int size); int snd_trident_synth_free(trident_t *trident, snd_util_memblk_t *blk); diff --git a/include/sound/version.h b/include/sound/version.h index a4c7d9a7cd3a..323f4e184ed5 100644 --- a/include/sound/version.h +++ b/include/sound/version.h @@ -1,3 +1,3 @@ /* include/version.h. Generated automatically by configure. */ #define CONFIG_SND_VERSION "0.9.0rc6" -#define CONFIG_SND_DATE " (Thu Dec 26 11:57:42 2002 UTC)" +#define CONFIG_SND_DATE " (Wed Jan 08 17:04:59 2003 UTC)" |
