diff options
Diffstat (limited to 'sound/isa/gus')
-rw-r--r-- | sound/isa/gus/gus_dma.c | 24 | ||||
-rw-r--r-- | sound/isa/gus/gus_dram.c | 8 | ||||
-rw-r--r-- | sound/isa/gus/gus_instr.c | 42 | ||||
-rw-r--r-- | sound/isa/gus/gus_io.c | 72 | ||||
-rw-r--r-- | sound/isa/gus/gus_irq.c | 16 | ||||
-rw-r--r-- | sound/isa/gus/gus_main.c | 54 | ||||
-rw-r--r-- | sound/isa/gus/gus_mem.c | 64 | ||||
-rw-r--r-- | sound/isa/gus/gus_mem_proc.c | 26 | ||||
-rw-r--r-- | sound/isa/gus/gus_mixer.c | 28 | ||||
-rw-r--r-- | sound/isa/gus/gus_pcm.c | 202 | ||||
-rw-r--r-- | sound/isa/gus/gus_reset.c | 54 | ||||
-rw-r--r-- | sound/isa/gus/gus_sample.c | 42 | ||||
-rw-r--r-- | sound/isa/gus/gus_simple.c | 86 | ||||
-rw-r--r-- | sound/isa/gus/gus_synth.c | 90 | ||||
-rw-r--r-- | sound/isa/gus/gus_timer.c | 44 | ||||
-rw-r--r-- | sound/isa/gus/gus_uart.c | 38 | ||||
-rw-r--r-- | sound/isa/gus/gus_volume.c | 4 | ||||
-rw-r--r-- | sound/isa/gus/gusclassic.c | 136 | ||||
-rw-r--r-- | sound/isa/gus/gusextreme.c | 150 | ||||
-rw-r--r-- | sound/isa/gus/gusmax.c | 153 | ||||
-rw-r--r-- | sound/isa/gus/interwave.c | 368 |
21 files changed, 917 insertions, 784 deletions
diff --git a/sound/isa/gus/gus_dma.c b/sound/isa/gus/gus_dma.c index ef1b2e9832e..930f4bc56f3 100644 --- a/sound/isa/gus/gus_dma.c +++ b/sound/isa/gus/gus_dma.c @@ -25,7 +25,7 @@ #include <sound/core.h> #include <sound/gus.h> -static void snd_gf1_dma_ack(snd_gus_card_t * gus) +static void snd_gf1_dma_ack(struct snd_gus_card * gus) { unsigned long flags; @@ -35,7 +35,7 @@ static void snd_gf1_dma_ack(snd_gus_card_t * gus) spin_unlock_irqrestore(&gus->reg_lock, flags); } -static void snd_gf1_dma_program(snd_gus_card_t * gus, +static void snd_gf1_dma_program(struct snd_gus_card * gus, unsigned int addr, unsigned long buf_addr, unsigned int count, @@ -91,9 +91,9 @@ static void snd_gf1_dma_program(snd_gus_card_t * gus, spin_unlock_irqrestore(&gus->reg_lock, flags); } -static snd_gf1_dma_block_t *snd_gf1_dma_next_block(snd_gus_card_t * gus) +static struct snd_gf1_dma_block *snd_gf1_dma_next_block(struct snd_gus_card * gus) { - snd_gf1_dma_block_t *block; + struct snd_gf1_dma_block *block; /* PCM block have bigger priority than synthesizer one */ if (gus->gf1.dma_data_pcm) { @@ -123,9 +123,9 @@ static snd_gf1_dma_block_t *snd_gf1_dma_next_block(snd_gus_card_t * gus) } -static void snd_gf1_dma_interrupt(snd_gus_card_t * gus) +static void snd_gf1_dma_interrupt(struct snd_gus_card * gus) { - snd_gf1_dma_block_t *block; + struct snd_gf1_dma_block *block; snd_gf1_dma_ack(gus); if (gus->gf1.dma_ack) @@ -147,7 +147,7 @@ static void snd_gf1_dma_interrupt(snd_gus_card_t * gus) #endif } -int snd_gf1_dma_init(snd_gus_card_t * gus) +int snd_gf1_dma_init(struct snd_gus_card * gus) { down(&gus->dma_mutex); gus->gf1.dma_shared++; @@ -164,9 +164,9 @@ int snd_gf1_dma_init(snd_gus_card_t * gus) return 0; } -int snd_gf1_dma_done(snd_gus_card_t * gus) +int snd_gf1_dma_done(struct snd_gus_card * gus) { - snd_gf1_dma_block_t *block; + struct snd_gf1_dma_block *block; down(&gus->dma_mutex); gus->gf1.dma_shared--; @@ -189,13 +189,13 @@ int snd_gf1_dma_done(snd_gus_card_t * gus) return 0; } -int snd_gf1_dma_transfer_block(snd_gus_card_t * gus, - snd_gf1_dma_block_t * __block, +int snd_gf1_dma_transfer_block(struct snd_gus_card * gus, + struct snd_gf1_dma_block * __block, int atomic, int synth) { unsigned long flags; - snd_gf1_dma_block_t *block; + struct snd_gf1_dma_block *block; block = kmalloc(sizeof(*block), atomic ? GFP_ATOMIC : GFP_KERNEL); if (block == NULL) { diff --git a/sound/isa/gus/gus_dram.c b/sound/isa/gus/gus_dram.c index 22120b868b5..f22fe7967fc 100644 --- a/sound/isa/gus/gus_dram.c +++ b/sound/isa/gus/gus_dram.c @@ -26,7 +26,7 @@ #include <sound/info.h> -static int snd_gus_dram_poke(snd_gus_card_t *gus, char __user *_buffer, +static int snd_gus_dram_poke(struct snd_gus_card *gus, char __user *_buffer, unsigned int address, unsigned int size) { unsigned long flags; @@ -57,13 +57,13 @@ static int snd_gus_dram_poke(snd_gus_card_t *gus, char __user *_buffer, } -int snd_gus_dram_write(snd_gus_card_t *gus, char __user *buffer, +int snd_gus_dram_write(struct snd_gus_card *gus, char __user *buffer, unsigned int address, unsigned int size) { return snd_gus_dram_poke(gus, buffer, address, size); } -static int snd_gus_dram_peek(snd_gus_card_t *gus, char __user *_buffer, +static int snd_gus_dram_peek(struct snd_gus_card *gus, char __user *_buffer, unsigned int address, unsigned int size, int rom) { @@ -95,7 +95,7 @@ static int snd_gus_dram_peek(snd_gus_card_t *gus, char __user *_buffer, return 0; } -int snd_gus_dram_read(snd_gus_card_t *gus, char __user *buffer, +int snd_gus_dram_read(struct snd_gus_card *gus, char __user *buffer, unsigned int address, unsigned int size, int rom) { diff --git a/sound/isa/gus/gus_instr.c b/sound/isa/gus/gus_instr.c index 591a9a17feb..d0c38e1856e 100644 --- a/sound/isa/gus/gus_instr.c +++ b/sound/isa/gus/gus_instr.c @@ -28,11 +28,11 @@ * */ -int snd_gus_iwffff_put_sample(void *private_data, iwffff_wave_t *wave, +int snd_gus_iwffff_put_sample(void *private_data, struct iwffff_wave *wave, char __user *data, long len, int atomic) { - snd_gus_card_t *gus = private_data; - snd_gf1_mem_block_t *block; + struct snd_gus_card *gus = private_data; + struct snd_gf1_mem_block *block; int err; if (wave->format & IWFFFF_WAVE_ROM) @@ -58,19 +58,19 @@ int snd_gus_iwffff_put_sample(void *private_data, iwffff_wave_t *wave, return 0; } -int snd_gus_iwffff_get_sample(void *private_data, iwffff_wave_t *wave, +int snd_gus_iwffff_get_sample(void *private_data, struct iwffff_wave *wave, char __user *data, long len, int atomic) { - snd_gus_card_t *gus = private_data; + struct snd_gus_card *gus = private_data; return snd_gus_dram_read(gus, data, wave->address.memory, wave->size, wave->format & IWFFFF_WAVE_ROM ? 1 : 0); } -int snd_gus_iwffff_remove_sample(void *private_data, iwffff_wave_t *wave, +int snd_gus_iwffff_remove_sample(void *private_data, struct iwffff_wave *wave, int atomic) { - snd_gus_card_t *gus = private_data; + struct snd_gus_card *gus = private_data; if (wave->format & IWFFFF_WAVE_ROM) return 0; /* it's probably ok - verify the address? */ @@ -81,11 +81,11 @@ int snd_gus_iwffff_remove_sample(void *private_data, iwffff_wave_t *wave, * */ -int snd_gus_gf1_put_sample(void *private_data, gf1_wave_t *wave, +int snd_gus_gf1_put_sample(void *private_data, struct gf1_wave *wave, char __user *data, long len, int atomic) { - snd_gus_card_t *gus = private_data; - snd_gf1_mem_block_t *block; + struct snd_gus_card *gus = private_data; + struct snd_gf1_mem_block *block; int err; if (wave->format & GF1_WAVE_STEREO) @@ -109,18 +109,18 @@ int snd_gus_gf1_put_sample(void *private_data, gf1_wave_t *wave, return 0; } -int snd_gus_gf1_get_sample(void *private_data, gf1_wave_t *wave, +int snd_gus_gf1_get_sample(void *private_data, struct gf1_wave *wave, char __user *data, long len, int atomic) { - snd_gus_card_t *gus = private_data; + struct snd_gus_card *gus = private_data; return snd_gus_dram_read(gus, data, wave->address.memory, wave->size, 0); } -int snd_gus_gf1_remove_sample(void *private_data, gf1_wave_t *wave, +int snd_gus_gf1_remove_sample(void *private_data, struct gf1_wave *wave, int atomic) { - snd_gus_card_t *gus = private_data; + struct snd_gus_card *gus = private_data; return snd_gf1_mem_free(&gus->gf1.mem_alloc, wave->address.memory); } @@ -129,11 +129,11 @@ int snd_gus_gf1_remove_sample(void *private_data, gf1_wave_t *wave, * */ -int snd_gus_simple_put_sample(void *private_data, simple_instrument_t *instr, +int snd_gus_simple_put_sample(void *private_data, struct simple_instrument *instr, char __user *data, long len, int atomic) { - snd_gus_card_t *gus = private_data; - snd_gf1_mem_block_t *block; + struct snd_gus_card *gus = private_data; + struct snd_gf1_mem_block *block; int err; if (instr->format & SIMPLE_WAVE_STEREO) @@ -156,18 +156,18 @@ int snd_gus_simple_put_sample(void *private_data, simple_instrument_t *instr, return 0; } -int snd_gus_simple_get_sample(void *private_data, simple_instrument_t *instr, +int snd_gus_simple_get_sample(void *private_data, struct simple_instrument *instr, char __user *data, long len, int atomic) { - snd_gus_card_t *gus = private_data; + struct snd_gus_card *gus = private_data; return snd_gus_dram_read(gus, data, instr->address.memory, instr->size, 0); } -int snd_gus_simple_remove_sample(void *private_data, simple_instrument_t *instr, +int snd_gus_simple_remove_sample(void *private_data, struct simple_instrument *instr, int atomic) { - snd_gus_card_t *gus = private_data; + struct snd_gus_card *gus = private_data; return snd_gf1_mem_free(&gus->gf1.mem_alloc, instr->address.memory); } diff --git a/sound/isa/gus/gus_io.c b/sound/isa/gus/gus_io.c index 8d5752b2378..9b1fe292de4 100644 --- a/sound/isa/gus/gus_io.c +++ b/sound/isa/gus/gus_io.c @@ -25,7 +25,7 @@ #include <sound/core.h> #include <sound/gus.h> -void snd_gf1_delay(snd_gus_card_t * gus) +void snd_gf1_delay(struct snd_gus_card * gus) { int i; @@ -44,7 +44,7 @@ void snd_gf1_delay(snd_gus_card_t * gus) * big UltraClick (tm) elimination... */ -static inline void __snd_gf1_ctrl_stop(snd_gus_card_t * gus, unsigned char reg) +static inline void __snd_gf1_ctrl_stop(struct snd_gus_card * gus, unsigned char reg) { unsigned char value; @@ -58,7 +58,7 @@ static inline void __snd_gf1_ctrl_stop(snd_gus_card_t * gus, unsigned char reg) mb(); } -static inline void __snd_gf1_write8(snd_gus_card_t * gus, +static inline void __snd_gf1_write8(struct snd_gus_card * gus, unsigned char reg, unsigned char data) { @@ -68,7 +68,7 @@ static inline void __snd_gf1_write8(snd_gus_card_t * gus, mb(); } -static inline unsigned char __snd_gf1_look8(snd_gus_card_t * gus, +static inline unsigned char __snd_gf1_look8(struct snd_gus_card * gus, unsigned char reg) { outb(reg, gus->gf1.reg_regsel); @@ -76,7 +76,7 @@ static inline unsigned char __snd_gf1_look8(snd_gus_card_t * gus, return inb(gus->gf1.reg_data8); } -static inline void __snd_gf1_write16(snd_gus_card_t * gus, +static inline void __snd_gf1_write16(struct snd_gus_card * gus, unsigned char reg, unsigned int data) { outb(reg, gus->gf1.reg_regsel); @@ -85,7 +85,7 @@ static inline void __snd_gf1_write16(snd_gus_card_t * gus, mb(); } -static inline unsigned short __snd_gf1_look16(snd_gus_card_t * gus, +static inline unsigned short __snd_gf1_look16(struct snd_gus_card * gus, unsigned char reg) { outb(reg, gus->gf1.reg_regsel); @@ -93,7 +93,7 @@ static inline unsigned short __snd_gf1_look16(snd_gus_card_t * gus, return inw(gus->gf1.reg_data16); } -static inline void __snd_gf1_adlib_write(snd_gus_card_t * gus, +static inline void __snd_gf1_adlib_write(struct snd_gus_card * gus, unsigned char reg, unsigned char data) { outb(reg, gus->gf1.reg_timerctrl); @@ -104,7 +104,7 @@ static inline void __snd_gf1_adlib_write(snd_gus_card_t * gus, inb(gus->gf1.reg_timerctrl); } -static inline void __snd_gf1_write_addr(snd_gus_card_t * gus, unsigned char reg, +static inline void __snd_gf1_write_addr(struct snd_gus_card * gus, unsigned char reg, unsigned int addr, int w_16bit) { if (gus->gf1.enh_mode) { @@ -117,7 +117,7 @@ static inline void __snd_gf1_write_addr(snd_gus_card_t * gus, unsigned char reg, __snd_gf1_write16(gus, reg + 1, (unsigned short) (addr << 5)); } -static inline unsigned int __snd_gf1_read_addr(snd_gus_card_t * gus, +static inline unsigned int __snd_gf1_read_addr(struct snd_gus_card * gus, unsigned char reg, short w_16bit) { unsigned int res; @@ -138,49 +138,49 @@ static inline unsigned int __snd_gf1_read_addr(snd_gus_card_t * gus, * ======================================================================= */ -void snd_gf1_ctrl_stop(snd_gus_card_t * gus, unsigned char reg) +void snd_gf1_ctrl_stop(struct snd_gus_card * gus, unsigned char reg) { __snd_gf1_ctrl_stop(gus, reg); } -void snd_gf1_write8(snd_gus_card_t * gus, +void snd_gf1_write8(struct snd_gus_card * gus, unsigned char reg, unsigned char data) { __snd_gf1_write8(gus, reg, data); } -unsigned char snd_gf1_look8(snd_gus_card_t * gus, unsigned char reg) +unsigned char snd_gf1_look8(struct snd_gus_card * gus, unsigned char reg) { return __snd_gf1_look8(gus, reg); } -void snd_gf1_write16(snd_gus_card_t * gus, +void snd_gf1_write16(struct snd_gus_card * gus, unsigned char reg, unsigned int data) { __snd_gf1_write16(gus, reg, data); } -unsigned short snd_gf1_look16(snd_gus_card_t * gus, unsigned char reg) +unsigned short snd_gf1_look16(struct snd_gus_card * gus, unsigned char reg) { return __snd_gf1_look16(gus, reg); } -void snd_gf1_adlib_write(snd_gus_card_t * gus, +void snd_gf1_adlib_write(struct snd_gus_card * gus, unsigned char reg, unsigned char data) { __snd_gf1_adlib_write(gus, reg, data); } -void snd_gf1_write_addr(snd_gus_card_t * gus, unsigned char reg, +void snd_gf1_write_addr(struct snd_gus_card * gus, unsigned char reg, unsigned int addr, short w_16bit) { __snd_gf1_write_addr(gus, reg, addr, w_16bit); } -unsigned int snd_gf1_read_addr(snd_gus_card_t * gus, +unsigned int snd_gf1_read_addr(struct snd_gus_card * gus, unsigned char reg, short w_16bit) { @@ -191,7 +191,7 @@ unsigned int snd_gf1_read_addr(snd_gus_card_t * gus, */ -void snd_gf1_i_ctrl_stop(snd_gus_card_t * gus, unsigned char reg) +void snd_gf1_i_ctrl_stop(struct snd_gus_card * gus, unsigned char reg) { unsigned long flags; @@ -200,7 +200,7 @@ void snd_gf1_i_ctrl_stop(snd_gus_card_t * gus, unsigned char reg) spin_unlock_irqrestore(&gus->reg_lock, flags); } -void snd_gf1_i_write8(snd_gus_card_t * gus, +void snd_gf1_i_write8(struct snd_gus_card * gus, unsigned char reg, unsigned char data) { @@ -211,7 +211,7 @@ void snd_gf1_i_write8(snd_gus_card_t * gus, spin_unlock_irqrestore(&gus->reg_lock, flags); } -unsigned char snd_gf1_i_look8(snd_gus_card_t * gus, unsigned char reg) +unsigned char snd_gf1_i_look8(struct snd_gus_card * gus, unsigned char reg) { unsigned long flags; unsigned char res; @@ -222,7 +222,7 @@ unsigned char snd_gf1_i_look8(snd_gus_card_t * gus, unsigned char reg) return res; } -void snd_gf1_i_write16(snd_gus_card_t * gus, +void snd_gf1_i_write16(struct snd_gus_card * gus, unsigned char reg, unsigned int data) { @@ -233,7 +233,7 @@ void snd_gf1_i_write16(snd_gus_card_t * gus, spin_unlock_irqrestore(&gus->reg_lock, flags); } -unsigned short snd_gf1_i_look16(snd_gus_card_t * gus, unsigned char reg) +unsigned short snd_gf1_i_look16(struct snd_gus_card * gus, unsigned char reg) { unsigned long flags; unsigned short res; @@ -246,7 +246,7 @@ unsigned short snd_gf1_i_look16(snd_gus_card_t * gus, unsigned char reg) #if 0 -void snd_gf1_i_adlib_write(snd_gus_card_t * gus, +void snd_gf1_i_adlib_write(struct snd_gus_card * gus, unsigned char reg, unsigned char data) { @@ -257,7 +257,7 @@ void snd_gf1_i_adlib_write(snd_gus_card_t * gus, spin_unlock_irqrestore(&gus->reg_lock, flags); } -void snd_gf1_i_write_addr(snd_gus_card_t * gus, unsigned char reg, +void snd_gf1_i_write_addr(struct snd_gus_card * gus, unsigned char reg, unsigned int addr, short w_16bit) { unsigned long flags; @@ -270,7 +270,7 @@ void snd_gf1_i_write_addr(snd_gus_card_t * gus, unsigned char reg, #endif /* 0 */ #ifdef CONFIG_SND_DEBUG -static unsigned int snd_gf1_i_read_addr(snd_gus_card_t * gus, +static unsigned int snd_gf1_i_read_addr(struct snd_gus_card * gus, unsigned char reg, short w_16bit) { unsigned int res; @@ -287,7 +287,7 @@ static unsigned int snd_gf1_i_read_addr(snd_gus_card_t * gus, */ -void snd_gf1_dram_addr(snd_gus_card_t * gus, unsigned int addr) +void snd_gf1_dram_addr(struct snd_gus_card * gus, unsigned int addr) { outb(0x43, gus->gf1.reg_regsel); mb(); @@ -299,7 +299,7 @@ void snd_gf1_dram_addr(snd_gus_card_t * gus, unsigned int addr) mb(); } -void snd_gf1_poke(snd_gus_card_t * gus, unsigned int addr, unsigned char data) +void snd_gf1_poke(struct snd_gus_card * gus, unsigned int addr, unsigned char data) { unsigned long flags; @@ -316,7 +316,7 @@ void snd_gf1_poke(snd_gus_card_t * gus, unsigned int addr, unsigned char data) spin_unlock_irqrestore(&gus->reg_lock, flags); } -unsigned char snd_gf1_peek(snd_gus_card_t * gus, unsigned int addr) +unsigned char snd_gf1_peek(struct snd_gus_card * gus, unsigned int addr) { unsigned long flags; unsigned char res; @@ -337,7 +337,7 @@ unsigned char snd_gf1_peek(snd_gus_card_t * gus, unsigned int addr) #if 0 -void snd_gf1_pokew(snd_gus_card_t * gus, unsigned int addr, unsigned short data) +void snd_gf1_pokew(struct snd_gus_card * gus, unsigned int addr, unsigned short data) { unsigned long flags; @@ -360,7 +360,7 @@ void snd_gf1_pokew(snd_gus_card_t * gus, unsigned int addr, unsigned short data) spin_unlock_irqrestore(&gus->reg_lock, flags); } -unsigned short snd_gf1_peekw(snd_gus_card_t * gus, unsigned int addr) +unsigned short snd_gf1_peekw(struct snd_gus_card * gus, unsigned int addr) { unsigned long flags; unsigned short res; @@ -385,7 +385,7 @@ unsigned short snd_gf1_peekw(snd_gus_card_t * gus, unsigned int addr) return res; } -void snd_gf1_dram_setmem(snd_gus_card_t * gus, unsigned int addr, +void snd_gf1_dram_setmem(struct snd_gus_card * gus, unsigned int addr, unsigned short value, unsigned int count) { unsigned long port; @@ -415,7 +415,7 @@ void snd_gf1_dram_setmem(snd_gus_card_t * gus, unsigned int addr, #endif /* 0 */ -void snd_gf1_select_active_voices(snd_gus_card_t * gus) +void snd_gf1_select_active_voices(struct snd_gus_card * gus) { unsigned short voices; @@ -443,7 +443,7 @@ void snd_gf1_select_active_voices(snd_gus_card_t * gus) #ifdef CONFIG_SND_DEBUG -void snd_gf1_print_voice_registers(snd_gus_card_t * gus) +void snd_gf1_print_voice_registers(struct snd_gus_card * gus) { unsigned char mode; int voice, ctrl; @@ -477,7 +477,7 @@ void snd_gf1_print_voice_registers(snd_gus_card_t * gus) #if 0 -void snd_gf1_print_global_registers(snd_gus_card_t * gus) +void snd_gf1_print_global_registers(struct snd_gus_card * gus) { unsigned char global_mode = 0x00; @@ -504,7 +504,7 @@ void snd_gf1_print_global_registers(snd_gus_card_t * gus) } } -void snd_gf1_print_setup_registers(snd_gus_card_t * gus) +void snd_gf1_print_setup_registers(struct snd_gus_card * gus) { printk(KERN_INFO " -S- mix control = 0x%x\n", inb(GUSP(gus, MIXCNTRLREG))); printk(KERN_INFO " -S- IRQ status = 0x%x\n", inb(GUSP(gus, IRQSTAT))); @@ -523,7 +523,7 @@ void snd_gf1_print_setup_registers(snd_gus_card_t * gus) } } -void snd_gf1_peek_print_block(snd_gus_card_t * gus, unsigned int addr, int count, int w_16bit) +void snd_gf1_peek_print_block(struct snd_gus_card * gus, unsigned int addr, int count, int w_16bit) { if (!w_16bit) { while (count-- > 0) diff --git a/sound/isa/gus/gus_irq.c b/sound/isa/gus/gus_irq.c index 1e2a15eb810..c19ba2910b7 100644 --- a/sound/isa/gus/gus_irq.c +++ b/sound/isa/gus/gus_irq.c @@ -32,7 +32,7 @@ irqreturn_t snd_gus_interrupt(int irq, void *dev_id, struct pt_regs *regs) { - snd_gus_card_t * gus = dev_id; + struct snd_gus_card * gus = dev_id; unsigned char status; int loop = 100; int handled = 0; @@ -54,7 +54,7 @@ __again: if (status & (0x20 | 0x40)) { unsigned int already, _current_; unsigned char voice_status, voice; - snd_gus_voice_t *pvoice; + struct snd_gus_voice *pvoice; already = 0; while (((voice_status = snd_gf1_i_read8(gus, SNDRV_GF1_GB_VOICES_IRQ)) & 0xc0) != 0xc0) { @@ -107,11 +107,11 @@ __again: } #ifdef CONFIG_SND_DEBUG -static void snd_gus_irq_info_read(snd_info_entry_t *entry, - snd_info_buffer_t * buffer) +static void snd_gus_irq_info_read(struct snd_info_entry *entry, + struct snd_info_buffer *buffer) { - snd_gus_card_t *gus; - snd_gus_voice_t *pvoice; + struct snd_gus_card *gus; + struct snd_gus_voice *pvoice; int idx; gus = entry->private_data; @@ -131,9 +131,9 @@ static void snd_gus_irq_info_read(snd_info_entry_t *entry, } } -void snd_gus_irq_profile_init(snd_gus_card_t *gus) +void snd_gus_irq_profile_init(struct snd_gus_card *gus) { - snd_info_entry_t *entry; + struct snd_info_entry *entry; if (! snd_card_proc_new(gus->card, "gusirq", &entry)) snd_info_set_text_ops(entry, gus, 1024, snd_gus_irq_info_read); diff --git a/sound/isa/gus/gus_main.c b/sound/isa/gus/gus_main.c index 4f57ff4ab35..6d15b3d18a8 100644 --- a/sound/isa/gus/gus_main.c +++ b/sound/isa/gus/gus_main.c @@ -35,21 +35,21 @@ MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); MODULE_DESCRIPTION("Routines for Gravis UltraSound soundcards"); MODULE_LICENSE("GPL"); -static int snd_gus_init_dma_irq(snd_gus_card_t * gus, int latches); +static int snd_gus_init_dma_irq(struct snd_gus_card * gus, int latches); -int snd_gus_use_inc(snd_gus_card_t * gus) +int snd_gus_use_inc(struct snd_gus_card * gus) { if (!try_module_get(gus->card->module)) return 0; return 1; } -void snd_gus_use_dec(snd_gus_card_t * gus) +void snd_gus_use_dec(struct snd_gus_card * gus) { module_put(gus->card->module); } -static int snd_gus_joystick_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) +static int snd_gus_joystick_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 1; @@ -58,17 +58,17 @@ static int snd_gus_joystick_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * return 0; } -static int snd_gus_joystick_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_gus_joystick_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - snd_gus_card_t *gus = snd_kcontrol_chip(kcontrol); + struct snd_gus_card *gus = snd_kcontrol_chip(kcontrol); ucontrol->value.integer.value[0] = gus->joystick_dac & 31; return 0; } -static int snd_gus_joystick_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_gus_joystick_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - snd_gus_card_t *gus = snd_kcontrol_chip(kcontrol); + struct snd_gus_card *gus = snd_kcontrol_chip(kcontrol); unsigned long flags; int change; unsigned char nval; @@ -82,7 +82,7 @@ static int snd_gus_joystick_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t return change; } -static snd_kcontrol_new_t snd_gus_joystick_control = { +static struct snd_kcontrol_new snd_gus_joystick_control = { .iface = SNDRV_CTL_ELEM_IFACE_CARD, .name = "Joystick Speed", .info = snd_gus_joystick_info, @@ -90,7 +90,7 @@ static snd_kcontrol_new_t snd_gus_joystick_control = { .put = snd_gus_joystick_put }; -static void snd_gus_init_control(snd_gus_card_t *gus) +static void snd_gus_init_control(struct snd_gus_card *gus) { if (!gus->ace_flag) snd_ctl_add(gus->card, snd_ctl_new1(&snd_gus_joystick_control, gus)); @@ -100,7 +100,7 @@ static void snd_gus_init_control(snd_gus_card_t *gus) * */ -static int snd_gus_free(snd_gus_card_t *gus) +static int snd_gus_free(struct snd_gus_card *gus) { if (gus->gf1.res_port2 == NULL) goto __hw_end; @@ -129,24 +129,24 @@ static int snd_gus_free(snd_gus_card_t *gus) return 0; } -static int snd_gus_dev_free(snd_device_t *device) +static int snd_gus_dev_free(struct snd_device *device) { - snd_gus_card_t *gus = device->device_data; + struct snd_gus_card *gus = device->device_data; return snd_gus_free(gus); } -int snd_gus_create(snd_card_t * card, +int snd_gus_create(struct snd_card *card, unsigned long port, int irq, int dma1, int dma2, int timer_dev, int voices, int pcm_channels, int effect, - snd_gus_card_t **rgus) + struct snd_gus_card **rgus) { - snd_gus_card_t *gus; + struct snd_gus_card *gus; int err; - static snd_device_ops_t ops = { + static struct snd_device_ops ops = { .dev_free = snd_gus_dev_free, }; @@ -238,7 +238,7 @@ int snd_gus_create(snd_card_t * card, * Memory detection routine for plain GF1 soundcards */ -static int snd_gus_detect_memory(snd_gus_card_t * gus) +static int snd_gus_detect_memory(struct snd_gus_card * gus) { int l, idx, local; unsigned char d; @@ -273,9 +273,9 @@ static int snd_gus_detect_memory(snd_gus_card_t * gus) return 0; /* some memory were detected */ } -static int snd_gus_init_dma_irq(snd_gus_card_t * gus, int latches) +static int snd_gus_init_dma_irq(struct snd_gus_card * gus, int latches) { - snd_card_t *card; + struct snd_card *card; unsigned long flags; int irq, dma1, dma2; static unsigned char irqs[16] = @@ -360,11 +360,11 @@ static int snd_gus_init_dma_irq(snd_gus_card_t * gus, int latches) return 0; } -static int snd_gus_check_version(snd_gus_card_t * gus) +static int snd_gus_check_version(struct snd_gus_card * gus) { unsigned long flags; unsigned char val, rev; - snd_card_t *card; + struct snd_card *card; card = gus->card; spin_lock_irqsave(&gus->reg_lock, flags); @@ -409,14 +409,14 @@ static int snd_gus_check_version(snd_gus_card_t * gus) } #if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE)) -static void snd_gus_seq_dev_free(snd_seq_device_t *seq_dev) +static void snd_gus_seq_dev_free(struct snd_seq_device *seq_dev) { - snd_gus_card_t *gus = seq_dev->private_data; + struct snd_gus_card *gus = seq_dev->private_data; gus->seq_dev = NULL; } #endif -int snd_gus_initialize(snd_gus_card_t *gus) +int snd_gus_initialize(struct snd_gus_card *gus) { int err; @@ -432,9 +432,9 @@ int snd_gus_initialize(snd_gus_card_t *gus) return err; #if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE)) if (snd_seq_device_new(gus->card, 1, SNDRV_SEQ_DEV_ID_GUS, - sizeof(snd_gus_card_t*), &gus->seq_dev) >= 0) { + sizeof(struct snd_gus_card *), &gus->seq_dev) >= 0) { strcpy(gus->seq_dev->name, "GUS"); - *(snd_gus_card_t**)SNDRV_SEQ_DEVICE_ARGPTR(gus->seq_dev) = gus; + *(struct snd_gus_card **)SNDRV_SEQ_DEVICE_ARGPTR(gus->seq_dev) = gus; gus->seq_dev->private_data = gus; gus->seq_dev->private_free = snd_gus_seq_dev_free; } diff --git a/sound/isa/gus/gus_mem.c b/sound/isa/gus/gus_mem.c index 2e23f2a8c62..e8bdb860a19 100644 --- a/sound/isa/gus/gus_mem.c +++ b/sound/isa/gus/gus_mem.c @@ -27,11 +27,11 @@ #include <sound/info.h> #ifdef CONFIG_SND_DEBUG -static void snd_gf1_mem_info_read(snd_info_entry_t *entry, - snd_info_buffer_t * buffer); +static void snd_gf1_mem_info_read(struct snd_info_entry *entry, + struct snd_info_buffer *buffer); #endif -void snd_gf1_mem_lock(snd_gf1_mem_t * alloc, int xup) +void snd_gf1_mem_lock(struct snd_gf1_mem * alloc, int xup) { if (!xup) { down(&alloc->memory_mutex); @@ -40,12 +40,12 @@ void snd_gf1_mem_lock(snd_gf1_mem_t * alloc, int xup) } } -static snd_gf1_mem_block_t *snd_gf1_mem_xalloc(snd_gf1_mem_t * alloc, - snd_gf1_mem_block_t * block) +static struct snd_gf1_mem_block *snd_gf1_mem_xalloc(struct snd_gf1_mem * alloc, + struct snd_gf1_mem_block * block) { - snd_gf1_mem_block_t *pblock, *nblock; + struct snd_gf1_mem_block *pblock, *nblock; - nblock = (snd_gf1_mem_block_t *) kmalloc(sizeof(snd_gf1_mem_block_t), GFP_KERNEL); + nblock = kmalloc(sizeof(struct snd_gf1_mem_block), GFP_KERNEL); if (nblock == NULL) return NULL; *nblock = *block; @@ -76,7 +76,7 @@ static snd_gf1_mem_block_t *snd_gf1_mem_xalloc(snd_gf1_mem_t * alloc, return nblock; } -int snd_gf1_mem_xfree(snd_gf1_mem_t * alloc, snd_gf1_mem_block_t * block) +int snd_gf1_mem_xfree(struct snd_gf1_mem * alloc, struct snd_gf1_mem_block * block) { if (block->share) { /* ok.. shared block */ block->share--; @@ -106,10 +106,10 @@ int snd_gf1_mem_xfree(snd_gf1_mem_t * alloc, snd_gf1_mem_block_t * block) return 0; } -static snd_gf1_mem_block_t *snd_gf1_mem_look(snd_gf1_mem_t * alloc, +static struct snd_gf1_mem_block *snd_gf1_mem_look(struct snd_gf1_mem * alloc, unsigned int address) { - snd_gf1_mem_block_t *block; + struct snd_gf1_mem_block *block; for (block = alloc->first; block; block = block->next) { if (block->ptr == address) { @@ -119,10 +119,10 @@ static snd_gf1_mem_block_t *snd_gf1_mem_look(snd_gf1_mem_t * alloc, return NULL; } -static snd_gf1_mem_block_t *snd_gf1_mem_share(snd_gf1_mem_t * alloc, +static struct snd_gf1_mem_block *snd_gf1_mem_share(struct snd_gf1_mem * alloc, unsigned int *share_id) { - snd_gf1_mem_block_t *block; + struct snd_gf1_mem_block *block; if (!share_id[0] && !share_id[1] && !share_id[2] && !share_id[3]) @@ -133,14 +133,14 @@ static snd_gf1_mem_block_t *snd_gf1_mem_share(snd_gf1_mem_t * alloc, return NULL; } -static int snd_gf1_mem_find(snd_gf1_mem_t * alloc, - snd_gf1_mem_block_t * block, +static int snd_gf1_mem_find(struct snd_gf1_mem * alloc, + struct snd_gf1_mem_block * block, unsigned int size, int w_16, int align) { - snd_gf1_bank_info_t *info = w_16 ? alloc->banks_16 : alloc->banks_8; + struct snd_gf1_bank_info *info = w_16 ? alloc->banks_16 : alloc->banks_8; unsigned int idx, boundary; int size1; - snd_gf1_mem_block_t *pblock; + struct snd_gf1_mem_block *pblock; unsigned int ptr1, ptr2; align--; @@ -186,11 +186,11 @@ static int snd_gf1_mem_find(snd_gf1_mem_t * alloc, return -ENOMEM; } -snd_gf1_mem_block_t *snd_gf1_mem_alloc(snd_gf1_mem_t * alloc, int owner, +struct snd_gf1_mem_block *snd_gf1_mem_alloc(struct snd_gf1_mem * alloc, int owner, char *name, int size, int w_16, int align, unsigned int *share_id) { - snd_gf1_mem_block_t block, *nblock; + struct snd_gf1_mem_block block, *nblock; snd_gf1_mem_lock(alloc, 0); if (share_id != NULL) { @@ -220,10 +220,10 @@ snd_gf1_mem_block_t *snd_gf1_mem_alloc(snd_gf1_mem_t * alloc, int owner, return nblock; } -int snd_gf1_mem_free(snd_gf1_mem_t * alloc, unsigned int address) +int snd_gf1_mem_free(struct snd_gf1_mem * alloc, unsigned int address) { int result; - snd_gf1_mem_block_t *block; + struct snd_gf1_mem_block *block; snd_gf1_mem_lock(alloc, 0); if ((block = snd_gf1_mem_look(alloc, address)) != NULL) { @@ -235,12 +235,12 @@ int snd_gf1_mem_free(snd_gf1_mem_t * alloc, unsigned int address) return -EINVAL; } -int snd_gf1_mem_init(snd_gus_card_t * gus) +int snd_gf1_mem_init(struct snd_gus_card * gus) { - snd_gf1_mem_t *alloc; - snd_gf1_mem_block_t block; + struct snd_gf1_mem *alloc; + struct snd_gf1_mem_block block; #ifdef CONFIG_SND_DEBUG - snd_info_entry_t *entry; + struct snd_info_entry *entry; #endif alloc = &gus->gf1.mem_alloc; @@ -272,10 +272,10 @@ int snd_gf1_mem_init(snd_gus_card_t * gus) return 0; } -int snd_gf1_mem_done(snd_gus_card_t * gus) +int snd_gf1_mem_done(struct snd_gus_card * gus) { - snd_gf1_mem_t *alloc; - snd_gf1_mem_block_t *block, *nblock; + struct snd_gf1_mem *alloc; + struct snd_gf1_mem_block *block, *nblock; alloc = &gus->gf1.mem_alloc; block = alloc->first; @@ -288,12 +288,12 @@ int snd_gf1_mem_done(snd_gus_card_t * gus) } #ifdef CONFIG_SND_DEBUG -static void snd_gf1_mem_info_read(snd_info_entry_t *entry, - snd_info_buffer_t * buffer) +static void snd_gf1_mem_info_read(struct snd_info_entry *entry, + struct snd_info_buffer *buffer) { - snd_gus_card_t *gus; - snd_gf1_mem_t *alloc; - snd_gf1_mem_block_t *block; + struct snd_gus_card *gus; + struct snd_gf1_mem *alloc; + struct snd_gf1_mem_block *block; unsigned int total, used; int i; diff --git a/sound/isa/gus/gus_mem_proc.c b/sound/isa/gus/gus_mem_proc.c index 7f96ac237f3..4080255007d 100644 --- a/sound/isa/gus/gus_mem_proc.c +++ b/sound/isa/gus/gus_mem_proc.c @@ -25,20 +25,20 @@ #include <sound/gus.h> #include <sound/info.h> -typedef struct gus_proc_private { +struct gus_proc_private { int rom; /* data are in ROM */ unsigned int address; unsigned int size; - snd_gus_card_t * gus; -} gus_proc_private_t; + struct snd_gus_card * gus; +}; -static long snd_gf1_mem_proc_dump(snd_info_entry_t *entry, void *file_private_data, +static long snd_gf1_mem_proc_dump(struct snd_info_entry *entry, void *file_private_data, struct file *file, char __user *buf, unsigned long count, unsigned long pos) { long size; - gus_proc_private_t *priv = entry->private_data; - snd_gus_card_t *gus = priv->gus; + struct gus_proc_private *priv = entry->private_data; + struct snd_gus_card *gus = priv->gus; int err; size = count; @@ -52,13 +52,13 @@ static long snd_gf1_mem_proc_dump(snd_info_entry_t *entry, void *file_private_da return 0; } -static long long snd_gf1_mem_proc_llseek(snd_info_entry_t *entry, +static long long snd_gf1_mem_proc_llseek(struct snd_info_entry *entry, void *private_file_data, struct file *file, long long offset, int orig) { - gus_proc_private_t *priv = entry->private_data; + struct gus_proc_private *priv = entry->private_data; switch (orig) { case 0: /* SEEK_SET */ @@ -78,9 +78,9 @@ static long long snd_gf1_mem_proc_llseek(snd_info_entry_t *entry, return file->f_pos; } -static void snd_gf1_mem_proc_free(snd_info_entry_t *entry) +static void snd_gf1_mem_proc_free(struct snd_info_entry *entry) { - gus_proc_private_t *priv = entry->private_data; + struct gus_proc_private *priv = entry->private_data; kfree(priv); } @@ -89,12 +89,12 @@ static struct snd_info_entry_ops snd_gf1_mem_proc_ops = { .llseek = snd_gf1_mem_proc_llseek, }; -int snd_gf1_mem_proc_init(snd_gus_card_t * gus) +int snd_gf1_mem_proc_init(struct snd_gus_card * gus) { int idx; char name[16]; - gus_proc_private_t *priv; - snd_info_entry_t *entry; + struct gus_proc_private *priv; + struct snd_info_entry *entry; for (idx = 0; idx < 4; idx++) { if (gus->gf1.mem_alloc.banks_8[idx].size > 0) { diff --git a/sound/isa/gus/gus_mixer.c b/sound/isa/gus/gus_mixer.c index a051094d510..acc25a29720 100644 --- a/sound/isa/gus/gus_mixer.c +++ b/sound/isa/gus/gus_mixer.c @@ -36,7 +36,7 @@ .get = snd_gf1_get_single, .put = snd_gf1_put_single, \ .private_value = shift | (invert << 8) } -static int snd_gf1_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) +static int snd_gf1_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; uinfo->count = 1; @@ -45,9 +45,9 @@ static int snd_gf1_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * u return 0; } -static int snd_gf1_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_gf1_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - snd_gus_card_t *gus = snd_kcontrol_chip(kcontrol); + struct snd_gus_card *gus = snd_kcontrol_chip(kcontrol); int shift = kcontrol->private_value & 0xff; int invert = (kcontrol->private_value >> 8) & 1; @@ -57,9 +57,9 @@ static int snd_gf1_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * return 0; } -static int snd_gf1_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_gf1_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - snd_gus_card_t *gus = snd_kcontrol_chip(kcontrol); + struct snd_gus_card *gus = snd_kcontrol_chip(kcontrol); unsigned long flags; int shift = kcontrol->private_value & 0xff; int invert = (kcontrol->private_value >> 8) & 1; @@ -86,7 +86,7 @@ static int snd_gf1_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * .get = snd_ics_get_double, .put = snd_ics_put_double, \ .private_value = addr } -static int snd_ics_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) +static int snd_ics_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 2; @@ -95,9 +95,9 @@ static int snd_ics_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * u return 0; } -static int snd_ics_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_ics_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - snd_gus_card_t *gus = snd_kcontrol_chip(kcontrol); + struct snd_gus_card *gus = snd_kcontrol_chip(kcontrol); unsigned long flags; int addr = kcontrol->private_value & 0xff; unsigned char left, right; @@ -111,9 +111,9 @@ static int snd_ics_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * return 0; } -static int snd_ics_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_ics_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - snd_gus_card_t *gus = snd_kcontrol_chip(kcontrol); + struct snd_gus_card *gus = snd_kcontrol_chip(kcontrol); unsigned long flags; int addr = kcontrol->private_value & 0xff; int change; @@ -146,13 +146,13 @@ static int snd_ics_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * return change; } -static snd_kcontrol_new_t snd_gf1_controls[] = { +static struct snd_kcontrol_new snd_gf1_controls[] = { GF1_SINGLE("Master Playback Switch", 0, 1, 1), GF1_SINGLE("Line Switch", 0, 0, 1), GF1_SINGLE("Mic Switch", 0, 2, 0) }; -static snd_kcontrol_new_t snd_ics_controls[] = { +static struct snd_kcontrol_new snd_ics_controls[] = { GF1_SINGLE("Master Playback Switch", 0, 1, 1), ICS_DOUBLE("Master Playback Volume", 0, SNDRV_ICS_MASTER_DEV), ICS_DOUBLE("Synth Playback Volume", 0, SNDRV_ICS_GF1_DEV), @@ -163,9 +163,9 @@ ICS_DOUBLE("Mic Playback Volume", 0, SNDRV_ICS_MIC_DEV), ICS_DOUBLE("CD Playback Volume", 0, SNDRV_ICS_CD_DEV) }; -int snd_gf1_new_mixer(snd_gus_card_t * gus) +int snd_gf1_new_mixer(struct snd_gus_card * gus) { - snd_card_t *card; + struct snd_card *card; unsigned int idx, max; int err; diff --git a/sound/isa/gus/gus_pcm.c b/sound/isa/gus/gus_pcm.c index 1cc89fb67bf..d0829393ec8 100644 --- a/sound/isa/gus/gus_pcm.c +++ b/sound/isa/gus/gus_pcm.c @@ -42,12 +42,12 @@ #define SNDRV_GF1_PCM_PFLG_ACTIVE (1<<0) #define SNDRV_GF1_PCM_PFLG_NEUTRAL (2<<0) -typedef struct { - snd_gus_card_t * gus; - snd_pcm_substream_t * substream; +struct gus_pcm_private { + struct snd_gus_card * gus; + struct snd_pcm_substream *substream; spinlock_t lock; unsigned int voices; - snd_gus_voice_t *pvoices[2]; + struct snd_gus_voice *pvoices[2]; unsigned int memory; unsigned short flags; unsigned char voice_ctrl, ramp_ctrl; @@ -58,13 +58,13 @@ typedef struct { wait_queue_head_t sleep; atomic_t dma_count; int final_volume; -} gus_pcm_private_t; +}; static int snd_gf1_pcm_use_dma = 1; -static void snd_gf1_pcm_block_change_ack(snd_gus_card_t * gus, void *private_data) +static void snd_gf1_pcm_block_change_ack(struct snd_gus_card * gus, void *private_data) { - gus_pcm_private_t *pcmp = private_data; + struct gus_pcm_private *pcmp = private_data; if (pcmp) { atomic_dec(&pcmp->dma_count); @@ -72,14 +72,14 @@ static void snd_gf1_pcm_block_change_ack(snd_gus_card_t * gus, void *private_dat } } -static int snd_gf1_pcm_block_change(snd_pcm_substream_t * substream, +static int snd_gf1_pcm_block_change(struct snd_pcm_substream *substream, unsigned int offset, unsigned int addr, unsigned int count) { - snd_gf1_dma_block_t block; - snd_pcm_runtime_t *runtime = substream->runtime; - gus_pcm_private_t *pcmp = runtime->private_data; + struct snd_gf1_dma_block block; + struct snd_pcm_runtime *runtime = substream->runtime; + struct gus_pcm_private *pcmp = runtime->private_data; count += offset & 31; offset &= ~31; @@ -101,11 +101,11 @@ static int snd_gf1_pcm_block_change(snd_pcm_substream_t * substream, return 0; } -static void snd_gf1_pcm_trigger_up(snd_pcm_substream_t * substream) +static void snd_gf1_pcm_trigger_up(struct snd_pcm_substream *substream) { - snd_pcm_runtime_t *runtime = substream->runtime; - gus_pcm_private_t *pcmp = runtime->private_data; - snd_gus_card_t * gus = pcmp->gus; + struct snd_pcm_runtime *runtime = substream->runtime; + struct gus_pcm_private *pcmp = runtime->private_data; + struct snd_gus_card * gus = pcmp->gus; unsigned long flags; unsigned char voice_ctrl, ramp_ctrl; unsigned short rate; @@ -179,10 +179,11 @@ static void snd_gf1_pcm_trigger_up(snd_pcm_substream_t * substream) spin_unlock_irqrestore(&gus->reg_lock, flags); } -static void snd_gf1_pcm_interrupt_wave(snd_gus_card_t * gus, snd_gus_voice_t *pvoice) +static void snd_gf1_pcm_interrupt_wave(struct snd_gus_card * gus, + struct snd_gus_voice *pvoice) { - gus_pcm_private_t * pcmp; - snd_pcm_runtime_t * runtime; + struct gus_pcm_private * pcmp; + struct snd_pcm_runtime *runtime; unsigned char voice_ctrl, ramp_ctrl; unsigned int idx; unsigned int end, step; @@ -261,11 +262,12 @@ static void snd_gf1_pcm_interrupt_wave(snd_gus_card_t * gus, snd_gus_voice_t *pv #endif } -static void snd_gf1_pcm_interrupt_volume(snd_gus_card_t * gus, snd_gus_voice_t * pvoice) +static void snd_gf1_pcm_interrupt_volume(struct snd_gus_card * gus, + struct snd_gus_voice * pvoice) { unsigned short vol; int cvoice; - gus_pcm_private_t *pcmp = pvoice->private_data; + struct gus_pcm_private *pcmp = pvoice->private_data; /* stop ramp, but leave rollover bit untouched */ spin_lock(&gus->reg_lock); @@ -289,11 +291,11 @@ static void snd_gf1_pcm_interrupt_volume(snd_gus_card_t * gus, snd_gus_voice_t * spin_unlock(&gus->reg_lock); } -static void snd_gf1_pcm_volume_change(snd_gus_card_t * gus) +static void snd_gf1_pcm_volume_change(struct snd_gus_card * gus) { } -static int snd_gf1_pcm_poke_block(snd_gus_card_t *gus, unsigned char *buf, +static int snd_gf1_pcm_poke_block(struct snd_gus_card *gus, unsigned char *buf, unsigned int pos, unsigned int count, int w16, int invert) { @@ -341,14 +343,14 @@ static int snd_gf1_pcm_poke_block(snd_gus_card_t *gus, unsigned char *buf, return 0; } -static int snd_gf1_pcm_playback_copy(snd_pcm_substream_t *substream, +static int snd_gf1_pcm_playback_copy(struct snd_pcm_substream *substream, int voice, snd_pcm_uframes_t pos, void __user *src, snd_pcm_uframes_t count) { - snd_pcm_runtime_t *runtime = substream->runtime; - gus_pcm_private_t *pcmp = runtime->private_data; + struct snd_pcm_runtime *runtime = substream->runtime; + struct gus_pcm_private *pcmp = runtime->private_data; unsigned int bpos, len; bpos = samples_to_bytes(runtime, pos) + (voice * (pcmp->dma_size / 2)); @@ -360,7 +362,7 @@ static int snd_gf1_pcm_playback_copy(snd_pcm_substream_t *substream, if (snd_gf1_pcm_use_dma && len > 32) { return snd_gf1_pcm_block_change(substream, bpos, pcmp->memory + bpos, len); } else { - snd_gus_card_t *gus = pcmp->gus; + struct snd_gus_card *gus = pcmp->gus; int err, w16, invert; w16 = (snd_pcm_format_width(runtime->format) == 16); @@ -371,13 +373,13 @@ static int snd_gf1_pcm_playback_copy(snd_pcm_substream_t *substream, return 0; } -static int snd_gf1_pcm_playback_silence(snd_pcm_substream_t *substream, +static int snd_gf1_pcm_playback_silence(struct snd_pcm_substream *substream, int voice, snd_pcm_uframes_t pos, snd_pcm_uframes_t count) { - snd_pcm_runtime_t *runtime = substream->runtime; - gus_pcm_private_t *pcmp = runtime->private_data; + struct snd_pcm_runtime *runtime = substream->runtime; + struct gus_pcm_private *pcmp = runtime->private_data; unsigned int bpos, len; bpos = samples_to_bytes(runtime, pos) + (voice * (pcmp->dma_size / 2)); @@ -388,7 +390,7 @@ static int snd_gf1_pcm_playback_silence(snd_pcm_substream_t *substream, if (snd_gf1_pcm_use_dma && len > 32) { return snd_gf1_pcm_block_change(substream, bpos, pcmp->memory + bpos, len); } else { - snd_gus_card_t *gus = pcmp->gus; + struct snd_gus_card *gus = pcmp->gus; int err, w16, invert; w16 = (snd_pcm_format_width(runtime->format) == 16); @@ -399,18 +401,18 @@ static int snd_gf1_pcm_playback_silence(snd_pcm_substream_t *substream, return 0; } -static int snd_gf1_pcm_playback_hw_params(snd_pcm_substream_t * substream, - snd_pcm_hw_params_t * hw_params) +static int snd_gf1_pcm_playback_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *hw_params) { - snd_gus_card_t *gus = snd_pcm_substream_chip(substream); - snd_pcm_runtime_t *runtime = substream->runtime; - gus_pcm_private_t *pcmp = runtime->private_data; + struct snd_gus_card *gus = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; + struct gus_pcm_private *pcmp = runtime->private_data; int err; if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0) return err; if (err > 0) { /* change */ - snd_gf1_mem_block_t *block; + struct snd_gf1_mem_block *block; if (pcmp->memory > 0) { snd_gf1_mem_free(&gus->gf1.mem_alloc, pcmp->memory); pcmp->memory = 0; @@ -448,10 +450,10 @@ static int snd_gf1_pcm_playback_hw_params(snd_pcm_substream_t * substream, return 0; } -static int snd_gf1_pcm_playback_hw_free(snd_pcm_substream_t * substream) +static int snd_gf1_pcm_playback_hw_free(struct snd_pcm_substream *substream) { - snd_pcm_runtime_t *runtime = substream->runtime; - gus_pcm_private_t *pcmp = runtime->private_data; + struct snd_pcm_runtime *runtime = substream->runtime; + struct gus_pcm_private *pcmp = runtime->private_data; snd_pcm_lib_free_pages(substream); if (pcmp->pvoices[0]) { @@ -469,10 +471,10 @@ static int snd_gf1_pcm_playback_hw_free(snd_pcm_substream_t * substream) return 0; } -static int snd_gf1_pcm_playback_prepare(snd_pcm_substream_t * substream) +static int snd_gf1_pcm_playback_prepare(struct snd_pcm_substream *substream) { - snd_pcm_runtime_t *runtime = substream->runtime; - gus_pcm_private_t *pcmp = runtime->private_data; + struct snd_pcm_runtime *runtime = substream->runtime; + struct gus_pcm_private *pcmp = runtime->private_data; pcmp->bpos = 0; pcmp->dma_size = snd_pcm_lib_buffer_bytes(substream); @@ -481,12 +483,12 @@ static int snd_gf1_pcm_playback_prepare(snd_pcm_substream_t * substream) return 0; } -static int snd_gf1_pcm_playback_trigger(snd_pcm_substream_t * substream, +static int snd_gf1_pcm_playback_trigger(struct snd_pcm_substream *substream, int cmd) { - snd_gus_card_t *gus = snd_pcm_substream_chip(substream); - snd_pcm_runtime_t *runtime = substream->runtime; - gus_pcm_private_t *pcmp = runtime->private_data; + struct snd_gus_card *gus = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; + struct gus_pcm_private *pcmp = runtime->private_data; int voice; if (cmd == SNDRV_PCM_TRIGGER_START) { @@ -507,11 +509,11 @@ static int snd_gf1_pcm_playback_trigger(snd_pcm_substream_t * substream, return 0; } -static snd_pcm_uframes_t snd_gf1_pcm_playback_pointer(snd_pcm_substream_t * substream) +static snd_pcm_uframes_t snd_gf1_pcm_playback_pointer(struct snd_pcm_substream *substream) { - snd_gus_card_t *gus = snd_pcm_substream_chip(substream); - snd_pcm_runtime_t *runtime = substream->runtime; - gus_pcm_private_t *pcmp = runtime->private_data; + struct snd_gus_card *gus = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; + struct gus_pcm_private *pcmp = runtime->private_data; unsigned int pos; unsigned char voice_ctrl; @@ -529,22 +531,22 @@ static snd_pcm_uframes_t snd_gf1_pcm_playback_pointer(snd_pcm_substream_t * subs return pos; } -static ratnum_t clock = { +static struct snd_ratnum clock = { .num = 9878400/16, .den_min = 2, .den_max = 257, .den_step = 1, }; -static snd_pcm_hw_constraint_ratnums_t hw_constraints_clocks = { +static struct snd_pcm_hw_constraint_ratnums hw_constraints_clocks = { .nrats = 1, .rats = &clock, }; -static int snd_gf1_pcm_capture_hw_params(snd_pcm_substream_t * substream, - snd_pcm_hw_params_t * hw_params) +static int snd_gf1_pcm_capture_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *hw_params) { - snd_gus_card_t *gus = snd_pcm_substream_chip(substream); + struct snd_gus_card *gus = snd_pcm_substream_chip(substream); gus->c_dma_size = params_buffer_bytes(hw_params); gus->c_period_size = params_period_bytes(hw_params); @@ -559,15 +561,15 @@ static int snd_gf1_pcm_capture_hw_params(snd_pcm_substream_t * substream, return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); } -static int snd_gf1_pcm_capture_hw_free(snd_pcm_substream_t * substream) +static int snd_gf1_pcm_capture_hw_free(struct snd_pcm_substream *substream) { return snd_pcm_lib_free_pages(substream); } -static int snd_gf1_pcm_capture_prepare(snd_pcm_substream_t * substream) +static int snd_gf1_pcm_capture_prepare(struct snd_pcm_substream *substream) { - snd_gus_card_t *gus = snd_pcm_substream_chip(substream); - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_gus_card *gus = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; snd_gf1_i_write8(gus, SNDRV_GF1_GB_RECORD_RATE, runtime->rate_den - 2); snd_gf1_i_write8(gus, SNDRV_GF1_GB_REC_DMA_CONTROL, 0); /* disable sampling */ @@ -576,10 +578,10 @@ static int snd_gf1_pcm_capture_prepare(snd_pcm_substream_t * substream) return 0; } -static int snd_gf1_pcm_capture_trigger(snd_pcm_substream_t * substream, +static int snd_gf1_pcm_capture_trigger(struct snd_pcm_substream *substream, int cmd) { - snd_gus_card_t *gus = snd_pcm_substream_chip(substream); + struct snd_gus_card *gus = snd_pcm_substream_chip(substream); int val; if (cmd == SNDRV_PCM_TRIGGER_START) { @@ -597,15 +599,15 @@ static int snd_gf1_pcm_capture_trigger(snd_pcm_substream_t * substream, return 0; } -static snd_pcm_uframes_t snd_gf1_pcm_capture_pointer(snd_pcm_substream_t * substream) +static snd_pcm_uframes_t snd_gf1_pcm_capture_pointer(struct snd_pcm_substream *substream) { - snd_gus_card_t *gus = snd_pcm_substream_chip(substream); + struct snd_gus_card *gus = snd_pcm_substream_chip(substream); int pos = snd_dma_pointer(gus->gf1.dma2, gus->c_period_size); pos = bytes_to_frames(substream->runtime, (gus->c_pos + pos) % gus->c_dma_size); return pos; } -static void snd_gf1_pcm_interrupt_dma_read(snd_gus_card_t * gus) +static void snd_gf1_pcm_interrupt_dma_read(struct snd_gus_card * gus) { snd_gf1_i_write8(gus, SNDRV_GF1_GB_REC_DMA_CONTROL, 0); /* disable sampling */ snd_gf1_i_look8(gus, SNDRV_GF1_GB_REC_DMA_CONTROL); /* Sampling Control Register */ @@ -617,7 +619,7 @@ static void snd_gf1_pcm_interrupt_dma_read(snd_gus_card_t * gus) } } -static snd_pcm_hardware_t snd_gf1_pcm_playback = +static struct snd_pcm_hardware snd_gf1_pcm_playback = { .info = SNDRV_PCM_INFO_NONINTERLEAVED, .formats = (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U8 | @@ -635,7 +637,7 @@ static snd_pcm_hardware_t snd_gf1_pcm_playback = .fifo_size = 0, }; -static snd_pcm_hardware_t snd_gf1_pcm_capture = +static struct snd_pcm_hardware snd_gf1_pcm_capture = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP_VALID), @@ -653,16 +655,16 @@ static snd_pcm_hardware_t snd_gf1_pcm_capture = .fifo_size = 0, }; -static void snd_gf1_pcm_playback_free(snd_pcm_runtime_t *runtime) +static void snd_gf1_pcm_playback_free(struct snd_pcm_runtime *runtime) { kfree(runtime->private_data); } -static int snd_gf1_pcm_playback_open(snd_pcm_substream_t *substream) +static int snd_gf1_pcm_playback_open(struct snd_pcm_substream *substream) { - gus_pcm_private_t *pcmp; - snd_gus_card_t *gus = snd_pcm_substream_chip(substream); - snd_pcm_runtime_t *runtime = substream->runtime; + struct gus_pcm_private *pcmp; + struct snd_gus_card *gus = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; int err; pcmp = kzalloc(sizeof(*pcmp), GFP_KERNEL); @@ -690,11 +692,11 @@ static int snd_gf1_pcm_playback_open(snd_pcm_substream_t *substream) return 0; } -static int snd_gf1_pcm_playback_close(snd_pcm_substream_t * substream) +static int snd_gf1_pcm_playback_close(struct snd_pcm_substream *substream) { - snd_gus_card_t *gus = snd_pcm_substream_chip(substream); - snd_pcm_runtime_t *runtime = substream->runtime; - gus_pcm_private_t *pcmp = runtime->private_data; + struct snd_gus_card *gus = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; + struct gus_pcm_private *pcmp = runtime->private_data; if (!wait_event_timeout(pcmp->sleep, (atomic_read(&pcmp->dma_count) <= 0), 2*HZ)) snd_printk(KERN_ERR "gf1 pcm - serious DMA problem\n"); @@ -703,10 +705,10 @@ static int snd_gf1_pcm_playback_close(snd_pcm_substream_t * substream) return 0; } -static int snd_gf1_pcm_capture_open(snd_pcm_substream_t * substream) +static int snd_gf1_pcm_capture_open(struct snd_pcm_substream *substream) { - snd_pcm_runtime_t *runtime = substream->runtime; - snd_gus_card_t *gus = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; + struct snd_gus_card *gus = snd_pcm_substream_chip(substream); gus->gf1.interrupt_handler_dma_read = snd_gf1_pcm_interrupt_dma_read; gus->pcm_cap_substream = substream; @@ -718,23 +720,16 @@ static int snd_gf1_pcm_capture_open(snd_pcm_substream_t * substream) return 0; } -static int snd_gf1_pcm_capture_close(snd_pcm_substream_t * substream) +static int snd_gf1_pcm_capture_close(struct snd_pcm_substream *substream) { - snd_gus_card_t *gus = snd_pcm_substream_chip(substream); + struct snd_gus_card *gus = snd_pcm_substream_chip(substream); gus->pcm_cap_substream = NULL; snd_gf1_set_default_handlers(gus, SNDRV_GF1_HANDLER_DMA_READ); return 0; } -static void snd_gf1_pcm_free(snd_pcm_t *pcm) -{ - snd_gus_card_t *gus = pcm->private_data; - gus->pcm = NULL; - snd_pcm_lib_preallocate_free_for_all(pcm); -} - -static int snd_gf1_pcm_volume_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) +static int snd_gf1_pcm_volume_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 2; @@ -743,9 +738,9 @@ static int snd_gf1_pcm_volume_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t return 0; } -static int snd_gf1_pcm_volume_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_gf1_pcm_volume_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - snd_gus_card_t *gus = snd_kcontrol_chip(kcontrol); + struct snd_gus_card *gus = snd_kcontrol_chip(kcontrol); unsigned long flags; spin_lock_irqsave(&gus->pcm_volume_level_lock, flags); @@ -755,15 +750,15 @@ static int snd_gf1_pcm_volume_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_ return 0; } -static int snd_gf1_pcm_volume_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_gf1_pcm_volume_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - snd_gus_card_t *gus = snd_kcontrol_chip(kcontrol); + struct snd_gus_card *gus = snd_kcontrol_chip(kcontrol); unsigned long flags; int change; unsigned int idx; unsigned short val1, val2, vol; - gus_pcm_private_t *pcmp; - snd_gus_voice_t *pvoice; + struct gus_pcm_private *pcmp; + struct snd_gus_voice *pvoice; val1 = ucontrol->value.integer.value[0] & 127; val2 = ucontrol->value.integer.value[1] & 127; @@ -797,7 +792,7 @@ static int snd_gf1_pcm_volume_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_ return change; } -static snd_kcontrol_new_t snd_gf1_pcm_volume_control = +static struct snd_kcontrol_new snd_gf1_pcm_volume_control = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "PCM Playback Volume", @@ -806,7 +801,7 @@ static snd_kcontrol_new_t snd_gf1_pcm_volume_control = .put = snd_gf1_pcm_volume_put }; -static snd_kcontrol_new_t snd_gf1_pcm_volume_control1 = +static struct snd_kcontrol_new snd_gf1_pcm_volume_control1 = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "GPCM Playback Volume", @@ -815,7 +810,7 @@ static snd_kcontrol_new_t snd_gf1_pcm_volume_control1 = .put = snd_gf1_pcm_volume_put }; -static snd_pcm_ops_t snd_gf1_pcm_playback_ops = { +static struct snd_pcm_ops snd_gf1_pcm_playback_ops = { .open = snd_gf1_pcm_playback_open, .close = snd_gf1_pcm_playback_close, .ioctl = snd_pcm_lib_ioctl, @@ -828,7 +823,7 @@ static snd_pcm_ops_t snd_gf1_pcm_playback_ops = { .silence = snd_gf1_pcm_playback_silence, }; -static snd_pcm_ops_t snd_gf1_pcm_capture_ops = { +static struct snd_pcm_ops snd_gf1_pcm_capture_ops = { .open = snd_gf1_pcm_capture_open, .close = snd_gf1_pcm_capture_close, .ioctl = snd_pcm_lib_ioctl, @@ -839,12 +834,12 @@ static snd_pcm_ops_t snd_gf1_pcm_capture_ops = { .pointer = snd_gf1_pcm_capture_pointer, }; -int snd_gf1_pcm_new(snd_gus_card_t * gus, int pcm_dev, int control_index, snd_pcm_t ** rpcm) +int snd_gf1_pcm_new(struct snd_gus_card * gus, int pcm_dev, int control_index, struct snd_pcm ** rpcm) { - snd_card_t *card; - snd_kcontrol_t *kctl; - snd_pcm_t *pcm; - snd_pcm_substream_t *substream; + struct snd_card *card; + struct snd_kcontrol *kctl; + struct snd_pcm *pcm; + struct snd_pcm_substream *substream; int capture, err; if (rpcm) @@ -860,7 +855,6 @@ int snd_gf1_pcm_new(snd_gus_card_t * gus, int pcm_dev, int control_index, snd_pc if (err < 0) return err; pcm->private_data = gus; - pcm->private_free = snd_gf1_pcm_free; /* playback setup */ snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_gf1_pcm_playback_ops); diff --git a/sound/isa/gus/gus_reset.c b/sound/isa/gus/gus_reset.c index 90710969ef7..b263655c411 100644 --- a/sound/isa/gus/gus_reset.c +++ b/sound/isa/gus/gus_reset.c @@ -25,52 +25,52 @@ #include <sound/core.h> #include <sound/gus.h> -extern void snd_gf1_timers_init(snd_gus_card_t * gus); -extern void snd_gf1_timers_done(snd_gus_card_t * gus); -extern int snd_gf1_synth_init(snd_gus_card_t * gus); -extern void snd_gf1_synth_done(snd_gus_card_t * gus); +extern void snd_gf1_timers_init(struct snd_gus_card * gus); +extern void snd_gf1_timers_done(struct snd_gus_card * gus); +extern int snd_gf1_synth_init(struct snd_gus_card * gus); +extern void snd_gf1_synth_done(struct snd_gus_card * gus); /* * ok.. default interrupt handlers... */ -static void snd_gf1_default_interrupt_handler_midi_out(snd_gus_card_t * gus) +static void snd_gf1_default_interrupt_handler_midi_out(struct snd_gus_card * gus) { snd_gf1_uart_cmd(gus, gus->gf1.uart_cmd &= ~0x20); } -static void snd_gf1_default_interrupt_handler_midi_in(snd_gus_card_t * gus) +static void snd_gf1_default_interrupt_handler_midi_in(struct snd_gus_card * gus) { snd_gf1_uart_cmd(gus, gus->gf1.uart_cmd &= ~0x80); } -static void snd_gf1_default_interrupt_handler_timer1(snd_gus_card_t * gus) +static void snd_gf1_default_interrupt_handler_timer1(struct snd_gus_card * gus) { snd_gf1_i_write8(gus, SNDRV_GF1_GB_SOUND_BLASTER_CONTROL, gus->gf1.timer_enabled &= ~4); } -static void snd_gf1_default_interrupt_handler_timer2(snd_gus_card_t * gus) +static void snd_gf1_default_interrupt_handler_timer2(struct snd_gus_card * gus) { snd_gf1_i_write8(gus, SNDRV_GF1_GB_SOUND_BLASTER_CONTROL, gus->gf1.timer_enabled &= ~8); } -static void snd_gf1_default_interrupt_handler_wave_and_volume(snd_gus_card_t * gus, snd_gus_voice_t * voice) +static void snd_gf1_default_interrupt_handler_wave_and_volume(struct snd_gus_card * gus, struct snd_gus_voice * voice) { snd_gf1_i_ctrl_stop(gus, 0x00); snd_gf1_i_ctrl_stop(gus, 0x0d); } -static void snd_gf1_default_interrupt_handler_dma_write(snd_gus_card_t * gus) +static void snd_gf1_default_interrupt_handler_dma_write(struct snd_gus_card * gus) { snd_gf1_i_write8(gus, 0x41, 0x00); } -static void snd_gf1_default_interrupt_handler_dma_read(snd_gus_card_t * gus) +static void snd_gf1_default_interrupt_handler_dma_read(struct snd_gus_card * gus) { snd_gf1_i_write8(gus, 0x49, 0x00); } -void snd_gf1_set_default_handlers(snd_gus_card_t * gus, unsigned int what) +void snd_gf1_set_default_handlers(struct snd_gus_card * gus, unsigned int what) { if (what & SNDRV_GF1_HANDLER_MIDI_OUT) gus->gf1.interrupt_handler_midi_out = snd_gf1_default_interrupt_handler_midi_out; @@ -81,7 +81,7 @@ void snd_gf1_set_default_handlers(snd_gus_card_t * gus, unsigned int what) if (what & SNDRV_GF1_HANDLER_TIMER2) gus->gf1.interrupt_handler_timer2 = snd_gf1_default_interrupt_handler_timer2; if (what & SNDRV_GF1_HANDLER_VOICE) { - snd_gus_voice_t *voice; + struct snd_gus_voice *voice; voice = &gus->gf1.voices[what & 0xffff]; voice->handler_wave = @@ -99,7 +99,7 @@ void snd_gf1_set_default_handlers(snd_gus_card_t * gus, unsigned int what) */ -static void snd_gf1_clear_regs(snd_gus_card_t * gus) +static void snd_gf1_clear_regs(struct snd_gus_card * gus) { unsigned long flags; @@ -111,7 +111,7 @@ static void snd_gf1_clear_regs(snd_gus_card_t * gus) spin_unlock_irqrestore(&gus->reg_lock, flags); } -static void snd_gf1_look_regs(snd_gus_card_t * gus) +static void snd_gf1_look_regs(struct snd_gus_card * gus) { unsigned long flags; @@ -127,7 +127,7 @@ static void snd_gf1_look_regs(snd_gus_card_t * gus) * put selected GF1 voices to initial stage... */ -void snd_gf1_smart_stop_voice(snd_gus_card_t * gus, unsigned short voice) +void snd_gf1_smart_stop_voice(struct snd_gus_card * gus, unsigned short voice) { unsigned long flags; @@ -141,7 +141,7 @@ void snd_gf1_smart_stop_voice(snd_gus_card_t * gus, unsigned short voice) spin_unlock_irqrestore(&gus->reg_lock, flags); } -void snd_gf1_stop_voice(snd_gus_card_t * gus, unsigned short voice) +void snd_gf1_stop_voice(struct snd_gus_card * gus, unsigned short voice) { unsigned long flags; @@ -161,7 +161,7 @@ void snd_gf1_stop_voice(snd_gus_card_t * gus, unsigned short voice) #endif } -static void snd_gf1_clear_voices(snd_gus_card_t * gus, unsigned short v_min, +static void snd_gf1_clear_voices(struct snd_gus_card * gus, unsigned short v_min, unsigned short v_max) { unsigned long flags; @@ -203,7 +203,7 @@ static void snd_gf1_clear_voices(snd_gus_card_t * gus, unsigned short v_min, } } -void snd_gf1_stop_voices(snd_gus_card_t * gus, unsigned short v_min, unsigned short v_max) +void snd_gf1_stop_voices(struct snd_gus_card * gus, unsigned short v_min, unsigned short v_max) { unsigned long flags; short i, ramp_ok; @@ -232,8 +232,8 @@ void snd_gf1_stop_voices(snd_gus_card_t * gus, unsigned short v_min, unsigned sh snd_gf1_clear_voices(gus, v_min, v_max); } -static void snd_gf1_alloc_voice_use(snd_gus_card_t * gus, - snd_gus_voice_t * pvoice, +static void snd_gf1_alloc_voice_use(struct snd_gus_card * gus, + struct snd_gus_voice * pvoice, int type, int client, int port) { pvoice->use = 1; @@ -255,9 +255,9 @@ static void snd_gf1_alloc_voice_use(snd_gus_card_t * gus, } } -snd_gus_voice_t *snd_gf1_alloc_voice(snd_gus_card_t * gus, int type, int client, int port) +struct snd_gus_voice *snd_gf1_alloc_voice(struct snd_gus_card * gus, int type, int client, int port) { - snd_gus_voice_t *pvoice; + struct snd_gus_voice *pvoice; unsigned long flags; int idx; @@ -289,10 +289,10 @@ snd_gus_voice_t *snd_gf1_alloc_voice(snd_gus_card_t * gus, int type, int client, return NULL; } -void snd_gf1_free_voice(snd_gus_card_t * gus, snd_gus_voice_t *voice) +void snd_gf1_free_voice(struct snd_gus_card * gus, struct snd_gus_voice *voice) { unsigned long flags; - void (*private_free)(snd_gus_voice_t *voice); + void (*private_free)(struct snd_gus_voice *voice); void *private_data; if (voice == NULL || !voice->use) @@ -317,7 +317,7 @@ void snd_gf1_free_voice(snd_gus_card_t * gus, snd_gus_voice_t *voice) * call this function only by start of driver */ -int snd_gf1_start(snd_gus_card_t * gus) +int snd_gf1_start(struct snd_gus_card * gus) { unsigned long flags; unsigned int i; @@ -400,7 +400,7 @@ int snd_gf1_start(snd_gus_card_t * gus) * call this function only by shutdown of driver */ -int snd_gf1_stop(snd_gus_card_t * gus) +int snd_gf1_stop(struct snd_gus_card * gus) { snd_gf1_i_write8(gus, SNDRV_GF1_GB_SOUND_BLASTER_CONTROL, 0); /* stop all timers */ snd_gf1_stop_voices(gus, 0, 31); /* stop all voices */ diff --git a/sound/isa/gus/gus_sample.c b/sound/isa/gus/gus_sample.c index 4290e03acd5..9e0c55ab25b 100644 --- a/sound/isa/gus/gus_sample.c +++ b/sound/isa/gus/gus_sample.c @@ -28,9 +28,9 @@ * */ -static void select_instrument(snd_gus_card_t * gus, snd_gus_voice_t * v) +static void select_instrument(struct snd_gus_card * gus, struct snd_gus_voice * v) { - snd_seq_kinstr_t *instr; + struct snd_seq_kinstr *instr; #if 0 printk("select instrument: cluster = %li, std = 0x%x, bank = %i, prg = %i\n", @@ -53,7 +53,8 @@ static void select_instrument(snd_gus_card_t * gus, snd_gus_voice_t * v) * */ -static void event_sample(snd_seq_event_t *ev, snd_gus_port_t *p, snd_gus_voice_t *v) +static void event_sample(struct snd_seq_event *ev, struct snd_gus_port *p, + struct snd_gus_voice *v) { if (v->sample_ops && v->sample_ops->sample_stop) v->sample_ops->sample_stop(p->gus, v, SAMPLE_STOP_IMMEDIATELY); @@ -67,7 +68,8 @@ static void event_sample(snd_seq_event_t *ev, snd_gus_port_t *p, snd_gus_voice_t select_instrument(p->gus, v); } -static void event_cluster(snd_seq_event_t *ev, snd_gus_port_t *p, snd_gus_voice_t *v) +static void event_cluster(struct snd_seq_event *ev, struct snd_gus_port *p, + struct snd_gus_voice *v) { if (v->sample_ops && v->sample_ops->sample_stop) v->sample_ops->sample_stop(p->gus, v, SAMPLE_STOP_IMMEDIATELY); @@ -75,50 +77,58 @@ static void event_cluster(snd_seq_event_t *ev, snd_gus_port_t *p, snd_gus_voice_ select_instrument(p->gus, v); } -static void event_start(snd_seq_event_t *ev, snd_gus_port_t *p, snd_gus_voice_t *v) +static void event_start(struct snd_seq_event *ev, struct snd_gus_port *p, + struct snd_gus_voice *v) { if (v->sample_ops && v->sample_ops->sample_start) v->sample_ops->sample_start(p->gus, v, ev->data.sample.param.position); } -static void event_stop(snd_seq_event_t *ev, snd_gus_port_t *p, snd_gus_voice_t *v) +static void event_stop(struct snd_seq_event *ev, struct snd_gus_port *p, + struct snd_gus_voice *v) { if (v->sample_ops && v->sample_ops->sample_stop) v->sample_ops->sample_stop(p->gus, v, ev->data.sample.param.stop_mode); } -static void event_freq(snd_seq_event_t *ev, snd_gus_port_t *p, snd_gus_voice_t *v) +static void event_freq(struct snd_seq_event *ev, struct snd_gus_port *p, + struct snd_gus_voice *v) { if (v->sample_ops && v->sample_ops->sample_freq) v->sample_ops->sample_freq(p->gus, v, ev->data.sample.param.frequency); } -static void event_volume(snd_seq_event_t *ev, snd_gus_port_t *p, snd_gus_voice_t *v) +static void event_volume(struct snd_seq_event *ev, struct snd_gus_port *p, + struct snd_gus_voice *v) { if (v->sample_ops && v->sample_ops->sample_volume) v->sample_ops->sample_volume(p->gus, v, &ev->data.sample.param.volume); } -static void event_loop(snd_seq_event_t *ev, snd_gus_port_t *p, snd_gus_voice_t *v) +static void event_loop(struct snd_seq_event *ev, struct snd_gus_port *p, + struct snd_gus_voice *v) { if (v->sample_ops && v->sample_ops->sample_loop) v->sample_ops->sample_loop(p->gus, v, &ev->data.sample.param.loop); } -static void event_position(snd_seq_event_t *ev, snd_gus_port_t *p, snd_gus_voice_t *v) +static void event_position(struct snd_seq_event *ev, struct snd_gus_port *p, + struct snd_gus_voice *v) { if (v->sample_ops && v->sample_ops->sample_pos) v->sample_ops->sample_pos(p->gus, v, ev->data.sample.param.position); } -static void event_private1(snd_seq_event_t *ev, snd_gus_port_t *p, snd_gus_voice_t *v) +static void event_private1(struct snd_seq_event *ev, struct snd_gus_port *p, + struct snd_gus_voice *v) { if (v->sample_ops && v->sample_ops->sample_private1) v->sample_ops->sample_private1(p->gus, v, (unsigned char *)&ev->data.sample.param.raw8); } -typedef void (gus_sample_event_handler_t)(snd_seq_event_t *ev, snd_gus_port_t *p, snd_gus_voice_t *v); - +typedef void (gus_sample_event_handler_t)(struct snd_seq_event *ev, + struct snd_gus_port *p, + struct snd_gus_voice *v); static gus_sample_event_handler_t *gus_sample_event_handlers[9] = { event_sample, event_cluster, @@ -131,11 +141,11 @@ static gus_sample_event_handler_t *gus_sample_event_handlers[9] = { event_private1 }; -void snd_gus_sample_event(snd_seq_event_t *ev, snd_gus_port_t *p) +void snd_gus_sample_event(struct snd_seq_event *ev, struct snd_gus_port *p) { int idx, voice; - snd_gus_card_t *gus = p->gus; - snd_gus_voice_t *v; + struct snd_gus_card *gus = p->gus; + struct snd_gus_voice *v; unsigned long flags; idx = ev->type - SNDRV_SEQ_EVENT_SAMPLE; diff --git a/sound/isa/gus/gus_simple.c b/sound/isa/gus/gus_simple.c index dfed85b58b3..dcad6ed0198 100644 --- a/sound/isa/gus/gus_simple.c +++ b/sound/isa/gus/gus_simple.c @@ -29,19 +29,19 @@ * */ -static void interrupt_wave(snd_gus_card_t *gus, snd_gus_voice_t *voice); -static void interrupt_volume(snd_gus_card_t *gus, snd_gus_voice_t *voice); -static void interrupt_effect(snd_gus_card_t *gus, snd_gus_voice_t *voice); - -static void sample_start(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_position_t position); -static void sample_stop(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_stop_mode_t mode); -static void sample_freq(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_frequency_t freq); -static void sample_volume(snd_gus_card_t *card, snd_gus_voice_t *voice, snd_seq_ev_volume_t *volume); -static void sample_loop(snd_gus_card_t *card, snd_gus_voice_t *voice, snd_seq_ev_loop_t *loop); -static void sample_pos(snd_gus_card_t *card, snd_gus_voice_t *voice, snd_seq_position_t position); -static void sample_private1(snd_gus_card_t *card, snd_gus_voice_t *voice, unsigned char *data); - -static snd_gus_sample_ops_t sample_ops = { +static void interrupt_wave(struct snd_gus_card *gus, struct snd_gus_voice *voice); +static void interrupt_volume(struct snd_gus_card *gus, struct snd_gus_voice *voice); +static void interrupt_effect(struct snd_gus_card *gus, struct snd_gus_voice *voice); + +static void sample_start(struct snd_gus_card *gus, struct snd_gus_voice *voice, snd_seq_position_t position); +static void sample_stop(struct snd_gus_card *gus, struct snd_gus_voice *voice, int mode); +static void sample_freq(struct snd_gus_card *gus, struct snd_gus_voice *voice, snd_seq_frequency_t freq); +static void sample_volume(struct snd_gus_card *card, struct snd_gus_voice *voice, struct snd_seq_ev_volume *volume); +static void sample_loop(struct snd_gus_card *card, struct snd_gus_voice *voice, struct snd_seq_ev_loop *loop); +static void sample_pos(struct snd_gus_card *card, struct snd_gus_voice *voice, snd_seq_position_t position); +static void sample_private1(struct snd_gus_card *card, struct snd_gus_voice *voice, unsigned char *data); + +static struct snd_gus_sample_ops sample_ops = { sample_start, sample_stop, sample_freq, @@ -53,13 +53,13 @@ static snd_gus_sample_ops_t sample_ops = { #if 0 -static void note_stop(snd_gus_card_t *gus, snd_gus_voice_t *voice, int wait); -static void note_wait(snd_gus_card_t *gus, snd_gus_voice_t *voice); -static void note_off(snd_gus_card_t *gus, snd_gus_voice_t *voice); -static void note_volume(snd_gus_card_t *card, snd_gus_voice_t *voice); -static void note_pitchbend(snd_gus_card_t *card, snd_gus_voice_t *voice); -static void note_vibrato(snd_gus_card_t *card, snd_gus_voice_t *voice); -static void note_tremolo(snd_gus_card_t *card, snd_gus_voice_t *voice); +static void note_stop(struct snd_gus_card *gus, struct snd_gus_voice *voice, int wait); +static void note_wait(struct snd_gus_card *gus, struct snd_gus_voice *voice); +static void note_off(struct snd_gus_card *gus, struct snd_gus_voice *voice); +static void note_volume(struct snd_gus_card *card, struct snd_gus_voice *voice); +static void note_pitchbend(struct snd_gus_card *card, struct snd_gus_voice *voice); +static void note_vibrato(struct snd_gus_card *card, struct snd_gus_voice *voice); +static void note_tremolo(struct snd_gus_card *card, struct snd_gus_voice *voice); static struct snd_gus_note_handlers note_commands = { note_stop, @@ -71,7 +71,7 @@ static struct snd_gus_note_handlers note_commands = { note_tremolo }; -static void chn_trigger_down(snd_gus_card_t *card, ultra_channel_t *channel, ultra_instrument_t *instrument, unsigned char note, unsigned char velocity, unsigned char priority ); +static void chn_trigger_down(struct snd_gus_card *card, ultra_channel_t *channel, ultra_instrument_t *instrument, unsigned char note, unsigned char velocity, unsigned char priority ); static void chn_trigger_up( ultra_card_t *card, ultra_note_t *note ); static void chn_control( ultra_card_t *card, ultra_channel_t *channel, unsigned short p1, unsigned short p2 ); @@ -83,14 +83,14 @@ static struct ULTRA_STRU_INSTRUMENT_CHANNEL_COMMANDS channel_commands = { #endif -static void do_volume_envelope(snd_gus_card_t *card, snd_gus_voice_t *voice); -static void do_pan_envelope(snd_gus_card_t *card, snd_gus_voice_t *voice); +static void do_volume_envelope(struct snd_gus_card *card, struct snd_gus_voice *voice); +static void do_pan_envelope(struct snd_gus_card *card, struct snd_gus_voice *voice); /* * */ -static void interrupt_wave(snd_gus_card_t *gus, snd_gus_voice_t *voice) +static void interrupt_wave(struct snd_gus_card *gus, struct snd_gus_voice *voice) { spin_lock(&gus->event_lock); snd_gf1_stop_voice(gus, voice->number); @@ -102,7 +102,7 @@ static void interrupt_wave(snd_gus_card_t *gus, snd_gus_voice_t *voice) spin_unlock(&gus->event_lock); } -static void interrupt_volume(snd_gus_card_t *gus, snd_gus_voice_t *voice) +static void interrupt_volume(struct snd_gus_card *gus, struct snd_gus_voice *voice) { spin_lock(&gus->event_lock); if (voice->flags & SNDRV_GF1_VFLG_RUNNING) @@ -112,7 +112,7 @@ static void interrupt_volume(snd_gus_card_t *gus, snd_gus_voice_t *voice) spin_unlock(&gus->event_lock); } -static void interrupt_effect(snd_gus_card_t *gus, snd_gus_voice_t *voice) +static void interrupt_effect(struct snd_gus_card *gus, struct snd_gus_voice *voice) { spin_lock(&gus->event_lock); if ((voice->flags & (SNDRV_GF1_VFLG_RUNNING|SNDRV_GF1_VFLG_EFFECT_TIMER1)) == @@ -125,7 +125,7 @@ static void interrupt_effect(snd_gus_card_t *gus, snd_gus_voice_t *voice) * */ -static void do_volume_envelope(snd_gus_card_t *gus, snd_gus_voice_t *voice) +static void do_volume_envelope(struct snd_gus_card *gus, struct snd_gus_voice *voice) { unsigned short next, rate, old_volume; int program_next_ramp; @@ -229,7 +229,7 @@ static void do_volume_envelope(snd_gus_card_t *gus, snd_gus_voice_t *voice) } } -static void do_pan_envelope(snd_gus_card_t *gus, snd_gus_voice_t *voice) +static void do_pan_envelope(struct snd_gus_card *gus, struct snd_gus_voice *voice) { unsigned long flags; unsigned char old_pan; @@ -276,7 +276,7 @@ static void do_pan_envelope(snd_gus_card_t *gus, snd_gus_voice_t *voice) #endif } -static void set_enhanced_pan(snd_gus_card_t *gus, snd_gus_voice_t *voice, unsigned short pan) +static void set_enhanced_pan(struct snd_gus_card *gus, struct snd_gus_voice *voice, unsigned short pan) { unsigned long flags; unsigned short vlo, vro; @@ -307,13 +307,13 @@ static void set_enhanced_pan(snd_gus_card_t *gus, snd_gus_voice_t *voice, unsign * */ -static void sample_start(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_position_t position) +static void sample_start(struct snd_gus_card *gus, struct snd_gus_voice *voice, snd_seq_position_t position) { unsigned long flags; unsigned int begin, addr, addr_end, addr_start; int w_16; - simple_instrument_t *simple; - snd_seq_kinstr_t *instr; + struct simple_instrument *simple; + struct snd_seq_kinstr *instr; instr = snd_seq_instr_find(gus->gf1.ilist, &voice->instr, 0, 1); if (instr == NULL) @@ -397,7 +397,7 @@ static void sample_start(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_po snd_seq_instr_free_use(gus->gf1.ilist, instr); } -static void sample_stop(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_stop_mode_t mode) +static void sample_stop(struct snd_gus_card *gus, struct snd_gus_voice *voice, int mode) { unsigned char control; unsigned long flags; @@ -433,7 +433,7 @@ static void sample_stop(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_sto } } -static void sample_freq(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_frequency_t freq) +static void sample_freq(struct snd_gus_card *gus, struct snd_gus_voice *voice, snd_seq_frequency_t freq) { unsigned long flags; @@ -444,7 +444,7 @@ static void sample_freq(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_fre spin_unlock_irqrestore(&gus->reg_lock, flags); } -static void sample_volume(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_ev_volume_t *volume) +static void sample_volume(struct snd_gus_card *gus, struct snd_gus_voice *voice, struct snd_seq_ev_volume *volume) { if (volume->volume >= 0) { volume->volume &= 0x3fff; @@ -471,13 +471,13 @@ static void sample_volume(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_e } } -static void sample_loop(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_ev_loop_t *loop) +static void sample_loop(struct snd_gus_card *gus, struct snd_gus_voice *voice, struct snd_seq_ev_loop *loop) { unsigned long flags; int w_16 = voice->control & 0x04; unsigned int begin, addr_start, addr_end; - simple_instrument_t *simple; - snd_seq_kinstr_t *instr; + struct simple_instrument *simple; + struct snd_seq_kinstr *instr; #if 0 printk("voice_loop: start = 0x%x, end = 0x%x\n", loop->start, loop->end); @@ -500,13 +500,13 @@ static void sample_loop(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_ev_ snd_seq_instr_free_use(gus->gf1.ilist, instr); } -static void sample_pos(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_position_t position) +static void sample_pos(struct snd_gus_card *gus, struct snd_gus_voice *voice, snd_seq_position_t position) { unsigned long flags; int w_16 = voice->control & 0x04; unsigned int begin, addr; - simple_instrument_t *simple; - snd_seq_kinstr_t *instr; + struct simple_instrument *simple; + struct snd_seq_kinstr *instr; #if 0 printk("voice_loop: start = 0x%x, end = 0x%x\n", loop->start, loop->end); @@ -537,7 +537,7 @@ static unsigned char get_effects_mask( ultra_card_t *card, int value ) #endif -static void sample_private1(snd_gus_card_t *card, snd_gus_voice_t *voice, unsigned char *data) +static void sample_private1(struct snd_gus_card *card, struct snd_gus_voice *voice, unsigned char *data) { #if 0 unsigned long flags; @@ -624,7 +624,7 @@ static void chn_control( ultra_card_t *card, ultra_channel_t *channel, unsigned #endif -void snd_gf1_simple_init(snd_gus_voice_t *voice) +void snd_gf1_simple_init(struct snd_gus_voice *voice) { voice->handler_wave = interrupt_wave; voice->handler_volume = interrupt_volume; diff --git a/sound/isa/gus/gus_synth.c b/sound/isa/gus/gus_synth.c index f51c386ee19..85a1b051f09 100644 --- a/sound/isa/gus/gus_synth.c +++ b/sound/isa/gus/gus_synth.c @@ -34,10 +34,10 @@ MODULE_LICENSE("GPL"); * */ -static void snd_gus_synth_free_voices(snd_gus_card_t * gus, int client, int port) +static void snd_gus_synth_free_voices(struct snd_gus_card * gus, int client, int port) { int idx; - snd_gus_voice_t * voice; + struct snd_gus_voice * voice; for (idx = 0; idx < 32; idx++) { voice = &gus->gf1.voices[idx]; @@ -46,11 +46,11 @@ static void snd_gus_synth_free_voices(snd_gus_card_t * gus, int client, int port } } -static int snd_gus_synth_use(void *private_data, snd_seq_port_subscribe_t *info) +static int snd_gus_synth_use(void *private_data, struct snd_seq_port_subscribe *info) { - snd_gus_port_t * port = (snd_gus_port_t *)private_data; - snd_gus_card_t * gus = port->gus; - snd_gus_voice_t * voice; + struct snd_gus_port * port = private_data; + struct snd_gus_card * gus = port->gus; + struct snd_gus_voice * voice; unsigned int idx; if (info->voices > 32) @@ -74,10 +74,10 @@ static int snd_gus_synth_use(void *private_data, snd_seq_port_subscribe_t *info) return 0; } -static int snd_gus_synth_unuse(void *private_data, snd_seq_port_subscribe_t *info) +static int snd_gus_synth_unuse(void *private_data, struct snd_seq_port_subscribe *info) { - snd_gus_port_t * port = (snd_gus_port_t *)private_data; - snd_gus_card_t * gus = port->gus; + struct snd_gus_port * port = private_data; + struct snd_gus_card * gus = port->gus; down(&gus->register_mutex); snd_gus_synth_free_voices(gus, info->sender.client, info->sender.port); @@ -90,19 +90,19 @@ static int snd_gus_synth_unuse(void *private_data, snd_seq_port_subscribe_t *inf * */ -static void snd_gus_synth_free_private_instruments(snd_gus_port_t *p, int client) +static void snd_gus_synth_free_private_instruments(struct snd_gus_port *p, int client) { - snd_seq_instr_header_t ifree; + struct snd_seq_instr_header ifree; memset(&ifree, 0, sizeof(ifree)); ifree.cmd = SNDRV_SEQ_INSTR_FREE_CMD_PRIVATE; snd_seq_instr_list_free_cond(p->gus->gf1.ilist, &ifree, client, 0); } -static int snd_gus_synth_event_input(snd_seq_event_t *ev, int direct, +static int snd_gus_synth_event_input(struct snd_seq_event *ev, int direct, void *private_data, int atomic, int hop) { - snd_gus_port_t * p = (snd_gus_port_t *) private_data; + struct snd_gus_port * p = private_data; snd_assert(p != NULL, return -EINVAL); if (ev->type >= SNDRV_SEQ_EVENT_SAMPLE && @@ -131,12 +131,12 @@ static int snd_gus_synth_event_input(snd_seq_event_t *ev, int direct, } static void snd_gus_synth_instr_notify(void *private_data, - snd_seq_kinstr_t *instr, + struct snd_seq_kinstr *instr, int what) { unsigned int idx; - snd_gus_card_t *gus = private_data; - snd_gus_voice_t *pvoice; + struct snd_gus_card *gus = private_data; + struct snd_gus_voice *pvoice; unsigned long flags; spin_lock_irqsave(&gus->event_lock, flags); @@ -160,16 +160,16 @@ static void snd_gus_synth_instr_notify(void *private_data, static void snd_gus_synth_free_port(void *private_data) { - snd_gus_port_t * p = (snd_gus_port_t *)private_data; + struct snd_gus_port * p = private_data; if (p) snd_midi_channel_free_set(p->chset); } -static int snd_gus_synth_create_port(snd_gus_card_t * gus, int idx) +static int snd_gus_synth_create_port(struct snd_gus_card * gus, int idx) { - snd_gus_port_t * p; - snd_seq_port_callback_t callbacks; + struct snd_gus_port * p; + struct snd_seq_port_callback callbacks; char name[32]; int result; @@ -210,46 +210,28 @@ static int snd_gus_synth_create_port(snd_gus_card_t * gus, int idx) * */ -static int snd_gus_synth_new_device(snd_seq_device_t *dev) +static int snd_gus_synth_new_device(struct snd_seq_device *dev) { - snd_gus_card_t *gus; + struct snd_gus_card *gus; int client, i; - snd_seq_client_callback_t callbacks; - snd_seq_client_info_t *cinfo; - snd_seq_port_subscribe_t sub; - snd_iwffff_ops_t *iwops; - snd_gf1_ops_t *gf1ops; - snd_simple_ops_t *simpleops; - - gus = *(snd_gus_card_t**)SNDRV_SEQ_DEVICE_ARGPTR(dev); + struct snd_seq_port_subscribe sub; + struct snd_iwffff_ops *iwops; + struct snd_gf1_ops *gf1ops; + struct snd_simple_ops *simpleops; + + gus = *(struct snd_gus_card **)SNDRV_SEQ_DEVICE_ARGPTR(dev); if (gus == NULL) return -EINVAL; init_MUTEX(&gus->register_mutex); gus->gf1.seq_client = -1; - cinfo = kmalloc(sizeof(*cinfo), GFP_KERNEL); - if (! cinfo) - return -ENOMEM; - /* allocate new client */ - memset(&callbacks, 0, sizeof(callbacks)); - callbacks.private_data = gus; - callbacks.allow_output = callbacks.allow_input = 1; client = gus->gf1.seq_client = - snd_seq_create_kernel_client(gus->card, 1, &callbacks); - if (client < 0) { - kfree(cinfo); + snd_seq_create_kernel_client(gus->card, 1, gus->interwave ? + "AMD InterWave" : "GF1"); + if (client < 0) return client; - } - - /* change name of client */ - memset(cinfo, 0, sizeof(*cinfo)); - cinfo->client = client; - cinfo->type = KERNEL_CLIENT; - sprintf(cinfo->name, gus->interwave ? "AMD InterWave" : "GF1"); - snd_seq_kernel_client_ctl(client, SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, cinfo); - kfree(cinfo); for (i = 0; i < 4; i++) snd_gus_synth_create_port(gus, i); @@ -293,11 +275,11 @@ static int snd_gus_synth_new_device(snd_seq_device_t *dev) return 0; } -static int snd_gus_synth_delete_device(snd_seq_device_t *dev) +static int snd_gus_synth_delete_device(struct snd_seq_device *dev) { - snd_gus_card_t *gus; + struct snd_gus_card *gus; - gus = *(snd_gus_card_t**)SNDRV_SEQ_DEVICE_ARGPTR(dev); + gus = *(struct snd_gus_card **)SNDRV_SEQ_DEVICE_ARGPTR(dev); if (gus == NULL) return -EINVAL; @@ -312,13 +294,13 @@ static int snd_gus_synth_delete_device(snd_seq_device_t *dev) static int __init alsa_gus_synth_init(void) { - static snd_seq_dev_ops_t ops = { + static struct snd_seq_dev_ops ops = { snd_gus_synth_new_device, snd_gus_synth_delete_device }; return snd_seq_device_register_driver(SNDRV_SEQ_DEV_ID_GUS, &ops, - sizeof(snd_gus_card_t*)); + sizeof(struct snd_gus_card *)); } static void __exit alsa_gus_synth_exit(void) diff --git a/sound/isa/gus/gus_timer.c b/sound/isa/gus/gus_timer.c index 9876603ff6c..a43b662f17c 100644 --- a/sound/isa/gus/gus_timer.c +++ b/sound/isa/gus/gus_timer.c @@ -30,12 +30,12 @@ * Timer 1 - 80us */ -static int snd_gf1_timer1_start(snd_timer_t * timer) +static int snd_gf1_timer1_start(struct snd_timer * timer) { unsigned long flags; unsigned char tmp; unsigned int ticks; - snd_gus_card_t *gus; + struct snd_gus_card *gus; gus = snd_timer_chip(timer); spin_lock_irqsave(&gus->reg_lock, flags); @@ -48,11 +48,11 @@ static int snd_gf1_timer1_start(snd_timer_t * timer) return 0; } -static int snd_gf1_timer1_stop(snd_timer_t * timer) +static int snd_gf1_timer1_stop(struct snd_timer * timer) { unsigned long flags; unsigned char tmp; - snd_gus_card_t *gus; + struct snd_gus_card *gus; gus = snd_timer_chip(timer); spin_lock_irqsave(&gus->reg_lock, flags); @@ -66,12 +66,12 @@ static int snd_gf1_timer1_stop(snd_timer_t * timer) * Timer 2 - 320us */ -static int snd_gf1_timer2_start(snd_timer_t * timer) +static int snd_gf1_timer2_start(struct snd_timer * timer) { unsigned long flags; unsigned char tmp; unsigned int ticks; - snd_gus_card_t *gus; + struct snd_gus_card *gus; gus = snd_timer_chip(timer); spin_lock_irqsave(&gus->reg_lock, flags); @@ -84,11 +84,11 @@ static int snd_gf1_timer2_start(snd_timer_t * timer) return 0; } -static int snd_gf1_timer2_stop(snd_timer_t * timer) +static int snd_gf1_timer2_stop(struct snd_timer * timer) { unsigned long flags; unsigned char tmp; - snd_gus_card_t *gus; + struct snd_gus_card *gus; gus = snd_timer_chip(timer); spin_lock_irqsave(&gus->reg_lock, flags); @@ -102,18 +102,18 @@ static int snd_gf1_timer2_stop(snd_timer_t * timer) */ -static void snd_gf1_interrupt_timer1(snd_gus_card_t * gus) +static void snd_gf1_interrupt_timer1(struct snd_gus_card * gus) { - snd_timer_t *timer = gus->gf1.timer1; + struct snd_timer *timer = gus->gf1.timer1; if (timer == NULL) return; snd_timer_interrupt(timer, timer->sticks); } -static void snd_gf1_interrupt_timer2(snd_gus_card_t * gus) +static void snd_gf1_interrupt_timer2(struct snd_gus_card * gus) { - snd_timer_t *timer = gus->gf1.timer2; + struct snd_timer *timer = gus->gf1.timer2; if (timer == NULL) return; @@ -124,7 +124,7 @@ static void snd_gf1_interrupt_timer2(snd_gus_card_t * gus) */ -static struct _snd_timer_hardware snd_gf1_timer1 = +static struct snd_timer_hardware snd_gf1_timer1 = { .flags = SNDRV_TIMER_HW_STOP, .resolution = 80000, @@ -133,7 +133,7 @@ static struct _snd_timer_hardware snd_gf1_timer1 = .stop = snd_gf1_timer1_stop, }; -static struct _snd_timer_hardware snd_gf1_timer2 = +static struct snd_timer_hardware snd_gf1_timer2 = { .flags = SNDRV_TIMER_HW_STOP, .resolution = 320000, @@ -142,22 +142,22 @@ static struct _snd_timer_hardware snd_gf1_timer2 = .stop = snd_gf1_timer2_stop, }; -static void snd_gf1_timer1_free(snd_timer_t *timer) +static void snd_gf1_timer1_free(struct snd_timer *timer) { - snd_gus_card_t *gus = timer->private_data; + struct snd_gus_card *gus = timer->private_data; gus->gf1.timer1 = NULL; } -static void snd_gf1_timer2_free(snd_timer_t *timer) +static void snd_gf1_timer2_free(struct snd_timer *timer) { - snd_gus_card_t *gus = timer->private_data; + struct snd_gus_card *gus = timer->private_data; gus->gf1.timer2 = NULL; } -void snd_gf1_timers_init(snd_gus_card_t * gus) +void snd_gf1_timers_init(struct snd_gus_card * gus) { - snd_timer_t *timer; - snd_timer_id_t tid; + struct snd_timer *timer; + struct snd_timer_id tid; if (gus->gf1.timer1 != NULL || gus->gf1.timer2 != NULL) return; @@ -190,7 +190,7 @@ void snd_gf1_timers_init(snd_gus_card_t * gus) gus->gf1.timer2 = timer; } -void snd_gf1_timers_done(snd_gus_card_t * gus) +void snd_gf1_timers_done(struct snd_gus_card * gus) { snd_gf1_set_default_handlers(gus, SNDRV_GF1_HANDLER_TIMER1 | SNDRV_GF1_HANDLER_TIMER2); if (gus->gf1.timer1) { diff --git a/sound/isa/gus/gus_uart.c b/sound/isa/gus/gus_uart.c index fbc95e99105..654290a8b21 100644 --- a/sound/isa/gus/gus_uart.c +++ b/sound/isa/gus/gus_uart.c @@ -26,7 +26,7 @@ #include <sound/core.h> #include <sound/gus.h> -static void snd_gf1_interrupt_midi_in(snd_gus_card_t * gus) +static void snd_gf1_interrupt_midi_in(struct snd_gus_card * gus) { int count; unsigned char stat, data, byte; @@ -61,7 +61,7 @@ static void snd_gf1_interrupt_midi_in(snd_gus_card_t * gus) } } -static void snd_gf1_interrupt_midi_out(snd_gus_card_t * gus) +static void snd_gf1_interrupt_midi_out(struct snd_gus_card * gus) { char byte; unsigned long flags; @@ -81,7 +81,7 @@ static void snd_gf1_interrupt_midi_out(snd_gus_card_t * gus) spin_unlock_irqrestore(&gus->uart_cmd_lock, flags); } -static void snd_gf1_uart_reset(snd_gus_card_t * gus, int close) +static void snd_gf1_uart_reset(struct snd_gus_card * gus, int close) { snd_gf1_uart_cmd(gus, 0x03); /* reset */ if (!close && gus->uart_enable) { @@ -90,10 +90,10 @@ static void snd_gf1_uart_reset(snd_gus_card_t * gus, int close) } } -static int snd_gf1_uart_output_open(snd_rawmidi_substream_t * substream) +static int snd_gf1_uart_output_open(struct snd_rawmidi_substream *substream) { unsigned long flags; - snd_gus_card_t *gus; + struct snd_gus_card *gus; gus = substream->rmidi->private_data; spin_lock_irqsave(&gus->uart_cmd_lock, flags); @@ -109,10 +109,10 @@ static int snd_gf1_uart_output_open(snd_rawmidi_substream_t * substream) return 0; } -static int snd_gf1_uart_input_open(snd_rawmidi_substream_t * substream) +static int snd_gf1_uart_input_open(struct snd_rawmidi_substream *substream) { unsigned long flags; - snd_gus_card_t *gus; + struct snd_gus_card *gus; int i; gus = substream->rmidi->private_data; @@ -136,10 +136,10 @@ static int snd_gf1_uart_input_open(snd_rawmidi_substream_t * substream) return 0; } -static int snd_gf1_uart_output_close(snd_rawmidi_substream_t * substream) +static int snd_gf1_uart_output_close(struct snd_rawmidi_substream *substream) { unsigned long flags; - snd_gus_card_t *gus; + struct snd_gus_card *gus; gus = substream->rmidi->private_data; spin_lock_irqsave(&gus->uart_cmd_lock, flags); @@ -151,10 +151,10 @@ static int snd_gf1_uart_output_close(snd_rawmidi_substream_t * substream) return 0; } -static int snd_gf1_uart_input_close(snd_rawmidi_substream_t * substream) +static int snd_gf1_uart_input_close(struct snd_rawmidi_substream *substream) { unsigned long flags; - snd_gus_card_t *gus; + struct snd_gus_card *gus; gus = substream->rmidi->private_data; spin_lock_irqsave(&gus->uart_cmd_lock, flags); @@ -166,9 +166,9 @@ static int snd_gf1_uart_input_close(snd_rawmidi_substream_t * substream) return 0; } -static void snd_gf1_uart_input_trigger(snd_rawmidi_substream_t * substream, int up) +static void snd_gf1_uart_input_trigger(struct snd_rawmidi_substream *substream, int up) { - snd_gus_card_t *gus; + struct snd_gus_card *gus; unsigned long flags; gus = substream->rmidi->private_data; @@ -184,10 +184,10 @@ static void snd_gf1_uart_input_trigger(snd_rawmidi_substream_t * substream, int spin_unlock_irqrestore(&gus->uart_cmd_lock, flags); } -static void snd_gf1_uart_output_trigger(snd_rawmidi_substream_t * substream, int up) +static void snd_gf1_uart_output_trigger(struct snd_rawmidi_substream *substream, int up) { unsigned long flags; - snd_gus_card_t *gus; + struct snd_gus_card *gus; char byte; int timeout; @@ -222,23 +222,23 @@ static void snd_gf1_uart_output_trigger(snd_rawmidi_substream_t * substream, int spin_unlock_irqrestore(&gus->uart_cmd_lock, flags); } -static snd_rawmidi_ops_t snd_gf1_uart_output = +static struct snd_rawmidi_ops snd_gf1_uart_output = { .open = snd_gf1_uart_output_open, .close = snd_gf1_uart_output_close, .trigger = snd_gf1_uart_output_trigger, }; -static snd_rawmidi_ops_t snd_gf1_uart_input = +static struct snd_rawmidi_ops snd_gf1_uart_input = { .open = snd_gf1_uart_input_open, .close = snd_gf1_uart_input_close, .trigger = snd_gf1_uart_input_trigger, }; -int snd_gf1_rawmidi_new(snd_gus_card_t * gus, int device, snd_rawmidi_t ** rrawmidi) +int snd_gf1_rawmidi_new(struct snd_gus_card * gus, int device, struct snd_rawmidi ** rrawmidi) { - snd_rawmidi_t *rmidi; + struct snd_rawmidi *rmidi; int err; if (rrawmidi) diff --git a/sound/isa/gus/gus_volume.c b/sound/isa/gus/gus_volume.c index b3382fec529..dbbc0a6d765 100644 --- a/sound/isa/gus/gus_volume.c +++ b/sound/isa/gus/gus_volume.c @@ -72,7 +72,7 @@ unsigned int snd_gf1_gvol_to_lvol_raw(unsigned short gf1_vol) return rvol | (m >> (8 - e)); } -unsigned int snd_gf1_calc_ramp_rate(snd_gus_card_t * gus, +unsigned int snd_gf1_calc_ramp_rate(struct snd_gus_card * gus, unsigned short start, unsigned short end, unsigned int us) @@ -112,7 +112,7 @@ unsigned int snd_gf1_calc_ramp_rate(snd_gus_card_t * gus, #endif /* 0 */ -unsigned short snd_gf1_translate_freq(snd_gus_card_t * gus, unsigned int freq16) +unsigned short snd_gf1_translate_freq(struct snd_gus_card * gus, unsigned int freq16) { freq16 >>= 3; if (freq16 < 50) diff --git a/sound/isa/gus/gusclassic.c b/sound/isa/gus/gusclassic.c index 39cef38835c..d1165b96fa3 100644 --- a/sound/isa/gus/gusclassic.c +++ b/sound/isa/gus/gusclassic.c @@ -20,14 +20,15 @@ */ #include <sound/driver.h> -#include <asm/dma.h> #include <linux/init.h> +#include <linux/err.h> +#include <linux/platform_device.h> #include <linux/delay.h> #include <linux/time.h> #include <linux/moduleparam.h> +#include <asm/dma.h> #include <sound/core.h> #include <sound/gus.h> -#define SNDRV_LEGACY_AUTO_PROBE #define SNDRV_LEGACY_FIND_FREE_IRQ #define SNDRV_LEGACY_FIND_FREE_DMA #include <sound/initval.h> @@ -70,11 +71,12 @@ MODULE_PARM_DESC(channels, "GF1 channels for GUS Classic driver."); module_param_array(pcm_channels, int, NULL, 0444); MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for GUS Classic driver."); -static snd_card_t *snd_gusclassic_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; +static struct platform_device *devices[SNDRV_CARDS]; + #define PFX "gusclassic: " -static int __init snd_gusclassic_detect(snd_gus_card_t * gus) +static int __init snd_gusclassic_detect(struct snd_gus_card * gus) { unsigned char d; @@ -93,7 +95,7 @@ static int __init snd_gusclassic_detect(snd_gus_card_t * gus) return 0; } -static void __init snd_gusclassic_init(int dev, snd_gus_card_t * gus) +static void __init snd_gusclassic_init(int dev, struct snd_gus_card * gus) { gus->equal_irq = 0; gus->codec_flag = 0; @@ -101,20 +103,19 @@ static void __init snd_gusclassic_init(int dev, snd_gus_card_t * gus) gus->joystick_dac = joystick_dac[dev]; } -static int __init snd_gusclassic_probe(int dev) +static int __init snd_gusclassic_probe(struct platform_device *pdev) { + int dev = pdev->id; static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, 4, -1}; static int possible_dmas[] = {5, 6, 7, 1, 3, -1}; int xirq, xdma1, xdma2; - snd_card_t *card; - struct snd_gusclassic *guscard; - snd_gus_card_t *gus = NULL; + struct snd_card *card; + struct snd_gus_card *gus = NULL; int err; card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); if (card == NULL) return -ENOMEM; - guscard = (struct snd_gusclassic *)card->private_data; if (pcm_channels[dev] < 2) pcm_channels[dev] = 2; @@ -143,12 +144,31 @@ static int __init snd_gusclassic_probe(int dev) } } - - if ((err = snd_gus_create(card, - port[dev], - xirq, xdma1, xdma2, - 0, channels[dev], pcm_channels[dev], - 0, &gus)) < 0) + if (port[dev] != SNDRV_AUTO_PORT) { + err = snd_gus_create(card, + port[dev], + xirq, xdma1, xdma2, + 0, channels[dev], pcm_channels[dev], + 0, &gus); + } else { + /* auto-probe legacy ports */ + static unsigned long possible_ports[] = { + 0x220, 0x230, 0x240, 0x250, 0x260, + }; + int i; + for (i = 0; i < ARRAY_SIZE(possible_ports); i++) { + err = snd_gus_create(card, + possible_ports[i], + xirq, xdma1, xdma2, + 0, channels[dev], pcm_channels[dev], + 0, &gus); + if (err >= 0) { + port[dev] = possible_ports[i]; + break; + } + } + } + if (err < 0) goto _err; if ((err = snd_gusclassic_detect(gus)) < 0) @@ -178,13 +198,12 @@ static int __init snd_gusclassic_probe(int dev) if (dma2 >= 0) sprintf(card->longname + strlen(card->longname), "&%d", xdma2); - if ((err = snd_card_set_generic_dev(card)) < 0) - goto _err; + snd_card_set_dev(card, &pdev->dev); if ((err = snd_card_register(card)) < 0) goto _err; - snd_gusclassic_cards[dev] = card; + platform_set_drvdata(pdev, card); return 0; _err: @@ -192,53 +211,70 @@ static int __init snd_gusclassic_probe(int dev) return err; } -static int __init snd_gusclassic_legacy_auto_probe(unsigned long xport) +static int snd_gusclassic_remove(struct platform_device *devptr) { - static int dev; - int res; - - for ( ; dev < SNDRV_CARDS; dev++) { - if (!enable[dev] || port[dev] != SNDRV_AUTO_PORT) - continue; - port[dev] = xport; - res = snd_gusclassic_probe(dev); - if (res < 0) - port[dev] = SNDRV_AUTO_PORT; - return res; - } - return -ENODEV; + snd_card_free(platform_get_drvdata(devptr)); + platform_set_drvdata(devptr, NULL); + return 0; +} + +#define GUSCLASSIC_DRIVER "snd_gusclassic" + +static struct platform_driver snd_gusclassic_driver = { + .probe = snd_gusclassic_probe, + .remove = snd_gusclassic_remove, + /* FIXME: suspend/resume */ + .driver = { + .name = GUSCLASSIC_DRIVER + }, +}; + +static void __init_or_module snd_gusclassic_unregister_all(void) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(devices); ++i) + platform_device_unregister(devices[i]); + platform_driver_unregister(&snd_gusclassic_driver); } static int __init alsa_card_gusclassic_init(void) { - static unsigned long possible_ports[] = {0x220, 0x230, 0x240, 0x250, 0x260, -1}; - int dev, cards, i; - - for (dev = cards = 0; dev < SNDRV_CARDS && enable[dev]; dev++) { - if (port[dev] == SNDRV_AUTO_PORT) - continue; - if (snd_gusclassic_probe(dev) >= 0) - cards++; - } - i = snd_legacy_auto_probe(possible_ports, snd_gusclassic_legacy_auto_probe); - if (i > 0) - cards += i; + int i, cards, err; + + err = platform_driver_register(&snd_gusclassic_driver); + if (err < 0) + return err; + cards = 0; + for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + struct platform_device *device; + device = platform_device_register_simple(GUSCLASSIC_DRIVER, + i, NULL, 0); + if (IS_ERR(device)) { + err = PTR_ERR(device); + goto errout; + } + devices[i] = device; + cards++; + } if (!cards) { #ifdef MODULE printk(KERN_ERR "GUS Classic soundcard not found or device busy\n"); #endif - return -ENODEV; + err = -ENODEV; + goto errout; } return 0; + + errout: + snd_gusclassic_unregister_all(); + return err; } static void __exit alsa_card_gusclassic_exit(void) { - int idx; - - for (idx = 0; idx < SNDRV_CARDS; idx++) - snd_card_free(snd_gusclassic_cards[idx]); + snd_gusclassic_unregister_all(); } module_init(alsa_card_gusclassic_init) diff --git a/sound/isa/gus/gusextreme.c b/sound/isa/gus/gusextreme.c index d2e7cb1df53..239f16e6b9e 100644 --- a/sound/isa/gus/gusextreme.c +++ b/sound/isa/gus/gusextreme.c @@ -20,11 +20,13 @@ */ #include <sound/driver.h> -#include <asm/dma.h> #include <linux/init.h> +#include <linux/err.h> +#include <linux/platform_device.h> #include <linux/delay.h> #include <linux/time.h> #include <linux/moduleparam.h> +#include <asm/dma.h> #include <sound/core.h> #include <sound/gus.h> #include <sound/es1688.h> @@ -85,14 +87,15 @@ MODULE_PARM_DESC(channels, "GF1 channels for GUS Extreme driver."); module_param_array(pcm_channels, int, NULL, 0444); MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for GUS Extreme driver."); -static snd_card_t *snd_gusextreme_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; +struct platform_device *devices[SNDRV_CARDS]; + #define PFX "gusextreme: " static int __init snd_gusextreme_detect(int dev, - snd_card_t * card, - snd_gus_card_t * gus, - es1688_t *es1688) + struct snd_card *card, + struct snd_gus_card * gus, + struct snd_es1688 *es1688) { unsigned long flags; unsigned char d; @@ -139,15 +142,15 @@ static int __init snd_gusextreme_detect(int dev, return 0; } -static void __init snd_gusextreme_init(int dev, snd_gus_card_t * gus) +static void __init snd_gusextreme_init(int dev, struct snd_gus_card * gus) { gus->joystick_dac = joystick_dac[dev]; } -static int __init snd_gusextreme_mixer(es1688_t *chip) +static int __init snd_gusextreme_mixer(struct snd_es1688 *chip) { - snd_card_t *card = chip->card; - snd_ctl_elem_id_t id1, id2; + struct snd_card *card = chip->card; + struct snd_ctl_elem_id id1, id2; int err; memset(&id1, 0, sizeof(id1)); @@ -166,24 +169,23 @@ static int __init snd_gusextreme_mixer(es1688_t *chip) return 0; } -static int __init snd_gusextreme_probe(int dev) +static int __init snd_gusextreme_probe(struct platform_device *pdev) { + int dev = pdev->id; static int possible_ess_irqs[] = {5, 9, 10, 7, -1}; static int possible_ess_dmas[] = {1, 3, 0, -1}; static int possible_gf1_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1}; static int possible_gf1_dmas[] = {5, 6, 7, 1, 3, -1}; int xgf1_irq, xgf1_dma, xess_irq, xmpu_irq, xess_dma; - snd_card_t *card; - struct snd_gusextreme *acard; - snd_gus_card_t *gus; - es1688_t *es1688; - opl3_t *opl3; + struct snd_card *card; + struct snd_gus_card *gus; + struct snd_es1688 *es1688; + struct snd_opl3 *opl3; int err; card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); if (card == NULL) return -ENOMEM; - acard = (struct snd_gusextreme *)card->private_data; xgf1_irq = gf1_irq[dev]; if (xgf1_irq == SNDRV_AUTO_IRQ) { @@ -223,10 +225,29 @@ static int __init snd_gusextreme_probe(int dev) } } - if ((err = snd_es1688_create(card, port[dev], mpu_port[dev], - xess_irq, xmpu_irq, xess_dma, - ES1688_HW_1688, &es1688)) < 0) + if (port[dev] != SNDRV_AUTO_PORT) { + err = snd_es1688_create(card, port[dev], mpu_port[dev], + xess_irq, xmpu_irq, xess_dma, + ES1688_HW_1688, &es1688); + } else { + /* auto-probe legacy ports */ + static unsigned long possible_ports[] = {0x220, 0x240, 0x260}; + int i; + for (i = 0; i < ARRAY_SIZE(possible_ports); i++) { + err = snd_es1688_create(card, + possible_ports[i], + mpu_port[dev], + xess_irq, xmpu_irq, xess_dma, + ES1688_HW_1688, &es1688); + if (err >= 0) { + port[dev] = possible_ports[i]; + break; + } + } + } + if (err < 0) goto out; + if (gf1_port[dev] < 0) gf1_port[dev] = port[dev] + 0x20; if ((err = snd_gus_create(card, @@ -287,13 +308,12 @@ static int __init snd_gusextreme_probe(int dev) sprintf(card->longname, "Gravis UltraSound Extreme at 0x%lx, irq %i&%i, dma %i&%i", es1688->port, xgf1_irq, xess_irq, xgf1_dma, xess_dma); - if ((err = snd_card_set_generic_dev(card)) < 0) - goto out; + snd_card_set_dev(card, &pdev->dev); if ((err = snd_card_register(card)) < 0) goto out; - snd_gusextreme_cards[dev] = card; + platform_set_drvdata(pdev, card); return 0; out: @@ -301,60 +321,70 @@ static int __init snd_gusextreme_probe(int dev) return err; } -static int __init snd_gusextreme_legacy_auto_probe(unsigned long xport) +static int snd_gusextreme_remove(struct platform_device *devptr) +{ + snd_card_free(platform_get_drvdata(devptr)); + platform_set_drvdata(devptr, NULL); + return 0; +} + +#define GUSEXTREME_DRIVER "snd_gusextreme" + +static struct platform_driver snd_gusextreme_driver = { + .probe = snd_gusextreme_probe, + .remove = snd_gusextreme_remove, + /* FIXME: suspend/resume */ + .driver = { + .name = GUSEXTREME_DRIVER + }, +}; + +static void __init_or_module snd_gusextreme_unregister_all(void) { - static int dev; - int res; - - for ( ; dev < SNDRV_CARDS; dev++) { - if (!enable[dev] || port[dev] != SNDRV_AUTO_PORT) - continue; - port[dev] = xport; - res = snd_gusextreme_probe(dev); - if (res < 0) - port[dev] = SNDRV_AUTO_PORT; - return res; - } - return -ENODEV; + int i; + + for (i = 0; i < ARRAY_SIZE(devices); ++i) + platform_device_unregister(devices[i]); + platform_driver_unregister(&snd_gusextreme_driver); } static int __init alsa_card_gusextreme_init(void) { - static unsigned long possible_ports[] = {0x220, 0x240, 0x260, -1}; - int dev, cards, i; - - for (dev = cards = 0; dev < SNDRV_CARDS && enable[dev] > 0; dev++) { - if (port[dev] == SNDRV_AUTO_PORT) - continue; - if (snd_gusextreme_probe(dev) >= 0) - cards++; - } - i = snd_legacy_auto_probe(possible_ports, snd_gusextreme_legacy_auto_probe); - if (i > 0) - cards += i; + int i, cards, err; + + err = platform_driver_register(&snd_gusextreme_driver); + if (err < 0) + return err; + cards = 0; + for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + struct platform_device *device; + device = platform_device_register_simple(GUSEXTREME_DRIVER, + i, NULL, 0); + if (IS_ERR(device)) { + err = PTR_ERR(device); + goto errout; + } + devices[i] = device; + cards++; + } if (!cards) { #ifdef MODULE printk(KERN_ERR "GUS Extreme soundcard not found or device busy\n"); #endif - return -ENODEV; + err = -ENODEV; + goto errout; } return 0; + + errout: + snd_gusextreme_unregister_all(); + return err; } static void __exit alsa_card_gusextreme_exit(void) { - int idx; - snd_card_t *card; - struct snd_gusextreme *acard; - - for (idx = 0; idx < SNDRV_CARDS; idx++) { - card = snd_gusextreme_cards[idx]; - if (card == NULL) - continue; - acard = (struct snd_gusextreme *)card->private_data; - snd_card_free(snd_gusextreme_cards[idx]); - } + snd_gusextreme_unregister_all(); } module_init(alsa_card_gusextreme_init) diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c index 0bb44b51934..d4d2b2a517d 100644 --- a/sound/isa/gus/gusmax.c +++ b/sound/isa/gus/gusmax.c @@ -20,15 +20,16 @@ */ #include <sound/driver.h> -#include <asm/dma.h> #include <linux/init.h> +#include <linux/err.h> +#include <linux/platform_device.h> #include <linux/delay.h> #include <linux/time.h> #include <linux/moduleparam.h> +#include <asm/dma.h> #include <sound/core.h> #include <sound/gus.h> #include <sound/cs4231.h> -#define SNDRV_LEGACY_AUTO_PROBE #define SNDRV_LEGACY_FIND_FREE_IRQ #define SNDRV_LEGACY_FIND_FREE_DMA #include <sound/initval.h> @@ -71,20 +72,20 @@ MODULE_PARM_DESC(channels, "Used GF1 channels for GUS MAX driver."); module_param_array(pcm_channels, int, NULL, 0444); MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for GUS MAX driver."); +static struct platform_device *devices[SNDRV_CARDS]; + struct snd_gusmax { int irq; - snd_card_t *card; - snd_gus_card_t *gus; - cs4231_t *cs4231; + struct snd_card *card; + struct snd_gus_card *gus; + struct snd_cs4231 *cs4231; unsigned short gus_status_reg; unsigned short pcm_status_reg; }; -static snd_card_t *snd_gusmax_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; - #define PFX "gusmax: " -static int __init snd_gusmax_detect(snd_gus_card_t * gus) +static int __init snd_gusmax_detect(struct snd_gus_card * gus) { unsigned char d; @@ -126,7 +127,7 @@ static irqreturn_t snd_gusmax_interrupt(int irq, void *dev_id, struct pt_regs *r return IRQ_RETVAL(handled); } -static void __init snd_gusmax_init(int dev, snd_card_t * card, snd_gus_card_t * gus) +static void __init snd_gusmax_init(int dev, struct snd_card *card, struct snd_gus_card * gus) { gus->equal_irq = 1; gus->codec_flag = 1; @@ -144,10 +145,10 @@ static void __init snd_gusmax_init(int dev, snd_card_t * card, snd_gus_card_t * #define CS4231_PRIVATE( left, right, shift, mute ) \ ((left << 24)|(right << 16)|(shift<<8)|mute) -static int __init snd_gusmax_mixer(cs4231_t *chip) +static int __init snd_gusmax_mixer(struct snd_cs4231 *chip) { - snd_card_t *card = chip->card; - snd_ctl_elem_id_t id1, id2; + struct snd_card *card = chip->card; + struct snd_ctl_elem_id id1, id2; int err; memset(&id1, 0, sizeof(id1)); @@ -193,7 +194,7 @@ static int __init snd_gusmax_mixer(cs4231_t *chip) return 0; } -static void snd_gusmax_free(snd_card_t *card) +static void snd_gusmax_free(struct snd_card *card) { struct snd_gusmax *maxcard = (struct snd_gusmax *)card->private_data; @@ -203,14 +204,15 @@ static void snd_gusmax_free(snd_card_t *card) free_irq(maxcard->irq, (void *)maxcard); } -static int __init snd_gusmax_probe(int dev) +static int __init snd_gusmax_probe(struct platform_device *pdev) { + int dev = pdev->id; static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1}; static int possible_dmas[] = {5, 6, 7, 1, 3, -1}; int xirq, xdma1, xdma2, err; - snd_card_t *card; - snd_gus_card_t *gus = NULL; - cs4231_t *cs4231; + struct snd_card *card; + struct snd_gus_card *gus = NULL; + struct snd_cs4231 *cs4231; struct snd_gusmax *maxcard; card = snd_card_new(index[dev], id[dev], THIS_MODULE, @@ -247,12 +249,32 @@ static int __init snd_gusmax_probe(int dev) } } - if ((err = snd_gus_create(card, - port[dev], - -xirq, xdma1, xdma2, - 0, channels[dev], - pcm_channels[dev], - 0, &gus)) < 0) + if (port[dev] != SNDRV_AUTO_PORT) { + err = snd_gus_create(card, + port[dev], + -xirq, xdma1, xdma2, + 0, channels[dev], + pcm_channels[dev], + 0, &gus); + } else { + static unsigned long possible_ports[] = { + 0x220, 0x230, 0x240, 0x250, 0x260 + }; + int i; + for (i = 0; i < ARRAY_SIZE(possible_ports); i++) { + err = snd_gus_create(card, + possible_ports[i], + -xirq, xdma1, xdma2, + 0, channels[dev], + pcm_channels[dev], + 0, &gus); + if (err >= 0) { + port[dev] = possible_ports[i]; + break; + } + } + } + if (err < 0) goto _err; if ((err = snd_gusmax_detect(gus)) < 0) @@ -310,15 +332,15 @@ static int __init snd_gusmax_probe(int dev) if (xdma2 >= 0) sprintf(card->longname + strlen(card->longname), "&%i", xdma2); - if ((err = snd_card_set_generic_dev(card)) < 0) - goto _err; + snd_card_set_dev(card, &pdev->dev); if ((err = snd_card_register(card)) < 0) goto _err; maxcard->gus = gus; maxcard->cs4231 = cs4231; - snd_gusmax_cards[dev] = card; + + platform_set_drvdata(pdev, card); return 0; _err: @@ -326,53 +348,70 @@ static int __init snd_gusmax_probe(int dev) return err; } -static int __init snd_gusmax_legacy_auto_probe(unsigned long xport) +static int snd_gusmax_remove(struct platform_device *devptr) { - static int dev; - int res; - - for ( ; dev < SNDRV_CARDS; dev++) { - if (!enable[dev] || port[dev] != SNDRV_AUTO_PORT) - continue; - port[dev] = xport; - res = snd_gusmax_probe(dev); - if (res < 0) - port[dev] = SNDRV_AUTO_PORT; - return res; - } - return -ENODEV; + snd_card_free(platform_get_drvdata(devptr)); + platform_set_drvdata(devptr, NULL); + return 0; +} + +#define GUSMAX_DRIVER "snd_gusmax" + +static struct platform_driver snd_gusmax_driver = { + .probe = snd_gusmax_probe, + .remove = snd_gusmax_remove, + /* FIXME: suspend/resume */ + .driver = { + .name = GUSMAX_DRIVER + }, +}; + +static void __init_or_module snd_gusmax_unregister_all(void) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(devices); ++i) + platform_device_unregister(devices[i]); + platform_driver_unregister(&snd_gusmax_driver); } static int __init alsa_card_gusmax_init(void) { - static unsigned long possible_ports[] = {0x220, 0x230, 0x240, 0x250, 0x260, -1}; - int dev, cards, i; - - for (dev = cards = 0; dev < SNDRV_CARDS && enable[dev] > 0; dev++) { - if (port[dev] == SNDRV_AUTO_PORT) - continue; - if (snd_gusmax_probe(dev) >= 0) - cards++; - } - i = snd_legacy_auto_probe(possible_ports, snd_gusmax_legacy_auto_probe); - if (i > 0) - cards += i; + int i, cards, err; + err = platform_driver_register(&snd_gusmax_driver); + if (err < 0) + return err; + + cards = 0; + for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + struct platform_device *device; + device = platform_device_register_simple(GUSMAX_DRIVER, + i, NULL, 0); + if (IS_ERR(device)) { + err = PTR_ERR(device); + goto errout; + } + devices[i] = device; + cards++; + } if (!cards) { #ifdef MODULE printk(KERN_ERR "GUS MAX soundcard not found or device busy\n"); #endif - return -ENODEV; + err = -ENODEV; + goto errout; } return 0; + + errout: + snd_gusmax_unregister_all(); + return err; } static void __exit alsa_card_gusmax_exit(void) { - int idx; - - for (idx = 0; idx < SNDRV_CARDS; idx++) - snd_card_free(snd_gusmax_cards[idx]); + snd_gusmax_unregister_all(); } module_init(alsa_card_gusmax_init) diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c index f703a9f4257..9838d992b10 100644 --- a/sound/isa/gus/interwave.c +++ b/sound/isa/gus/interwave.c @@ -23,19 +23,20 @@ */ #include <sound/driver.h> -#include <asm/dma.h> -#include <linux/delay.h> #include <linux/init.h> +#include <linux/err.h> +#include <linux/platform_device.h> +#include <linux/delay.h> #include <linux/slab.h> #include <linux/pnp.h> #include <linux/moduleparam.h> +#include <asm/dma.h> #include <sound/core.h> #include <sound/gus.h> #include <sound/cs4231.h> #ifdef SNDRV_STB #include <sound/tea6330t.h> #endif -#define SNDRV_LEGACY_AUTO_PROBE #define SNDRV_LEGACY_FIND_FREE_IRQ #define SNDRV_LEGACY_FIND_FREE_DMA #include <sound/initval.h> @@ -75,8 +76,12 @@ static int effect[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; #ifdef SNDRV_STB #define PFX "interwave-stb: " +#define INTERWAVE_DRIVER "snd_interwave_stb" +#define INTERWAVE_PNP_DRIVER "interwave-stb" #else #define PFX "interwave: " +#define INTERWAVE_DRIVER "snd_interwave" +#define INTERWAVE_PNP_DRIVER "interwave" #endif module_param_array(index, int, NULL, 0444); @@ -110,11 +115,14 @@ MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for InterWave driver."); module_param_array(effect, int, NULL, 0444); MODULE_PARM_DESC(effect, "Effects enable for InterWave driver."); +static struct platform_device *platform_devices[SNDRV_CARDS]; +static int pnp_registered; + struct snd_interwave { int irq; - snd_card_t *card; - snd_gus_card_t *gus; - cs4231_t *cs4231; + struct snd_card *card; + struct snd_gus_card *gus; + struct snd_cs4231 *cs4231; #ifdef SNDRV_STB struct resource *i2c_res; #endif @@ -128,7 +136,6 @@ struct snd_interwave { #endif }; -static snd_card_t *snd_interwave_legacy[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; #ifdef CONFIG_PNP @@ -160,7 +167,7 @@ MODULE_DEVICE_TABLE(pnp_card, snd_interwave_pnpids); #ifdef SNDRV_STB -static void snd_interwave_i2c_setlines(snd_i2c_bus_t *bus, int ctrl, int data) +static void snd_interwave_i2c_setlines(struct snd_i2c_bus *bus, int ctrl, int data) { unsigned long port = bus->private_value; @@ -171,7 +178,7 @@ static void snd_interwave_i2c_setlines(snd_i2c_bus_t *bus, int ctrl, int data) udelay(10); } -static int snd_interwave_i2c_getclockline(snd_i2c_bus_t *bus) +static int snd_interwave_i2c_getclockline(struct snd_i2c_bus *bus) { unsigned long port = bus->private_value; unsigned char res; @@ -183,7 +190,7 @@ static int snd_interwave_i2c_getclockline(snd_i2c_bus_t *bus) return res; } -static int snd_interwave_i2c_getdataline(snd_i2c_bus_t *bus, int ack) +static int snd_interwave_i2c_getdataline(struct snd_i2c_bus *bus, int ack) { unsigned long port = bus->private_value; unsigned char res; @@ -197,19 +204,19 @@ static int snd_interwave_i2c_getdataline(snd_i2c_bus_t *bus, int ack) return res; } -static snd_i2c_bit_ops_t snd_interwave_i2c_bit_ops = { +static struct snd_i2c_bit_ops snd_interwave_i2c_bit_ops = { .setlines = snd_interwave_i2c_setlines, .getclock = snd_interwave_i2c_getclockline, .getdata = snd_interwave_i2c_getdataline, }; static int __devinit snd_interwave_detect_stb(struct snd_interwave *iwcard, - snd_gus_card_t * gus, int dev, - snd_i2c_bus_t **rbus) + struct snd_gus_card * gus, int dev, + struct snd_i2c_bus **rbus) { unsigned long port; - snd_i2c_bus_t *bus; - snd_card_t *card = iwcard->card; + struct snd_i2c_bus *bus; + struct snd_card *card = iwcard->card; char name[32]; int err; @@ -246,10 +253,10 @@ static int __devinit snd_interwave_detect_stb(struct snd_interwave *iwcard, #endif static int __devinit snd_interwave_detect(struct snd_interwave *iwcard, - snd_gus_card_t * gus, + struct snd_gus_card * gus, int dev #ifdef SNDRV_STB - , snd_i2c_bus_t **rbus + , struct snd_i2c_bus **rbus #endif ) { @@ -314,7 +321,7 @@ static irqreturn_t snd_interwave_interrupt(int irq, void *dev_id, struct pt_regs return IRQ_RETVAL(handled); } -static void __devinit snd_interwave_reset(snd_gus_card_t * gus) +static void __devinit snd_interwave_reset(struct snd_gus_card * gus) { snd_gf1_write8(gus, SNDRV_GF1_GB_RESET, 0x00); udelay(160); @@ -322,7 +329,7 @@ static void __devinit snd_interwave_reset(snd_gus_card_t * gus) udelay(160); } -static void __devinit snd_interwave_bank_sizes(snd_gus_card_t * gus, int *sizes) +static void __devinit snd_interwave_bank_sizes(struct snd_gus_card * gus, int *sizes) { unsigned int idx; unsigned int local; @@ -371,7 +378,7 @@ struct rom_hdr { /* 511 */ unsigned char csum; }; -static void __devinit snd_interwave_detect_memory(snd_gus_card_t * gus) +static void __devinit snd_interwave_detect_memory(struct snd_gus_card * gus) { static unsigned int lmc[13] = { @@ -470,7 +477,7 @@ static void __devinit snd_interwave_detect_memory(snd_gus_card_t * gus) snd_interwave_reset(gus); } -static void __devinit snd_interwave_init(int dev, snd_gus_card_t * gus) +static void __devinit snd_interwave_init(int dev, struct snd_gus_card * gus) { unsigned long flags; @@ -492,17 +499,17 @@ static void __devinit snd_interwave_init(int dev, snd_gus_card_t * gus) } -static snd_kcontrol_new_t snd_interwave_controls[] = { +static struct snd_kcontrol_new snd_interwave_controls[] = { CS4231_DOUBLE("Master Playback Switch", 0, CS4231_LINE_LEFT_OUTPUT, CS4231_LINE_RIGHT_OUTPUT, 7, 7, 1, 1), CS4231_DOUBLE("Master Playback Volume", 0, CS4231_LINE_LEFT_OUTPUT, CS4231_LINE_RIGHT_OUTPUT, 0, 0, 31, 1), CS4231_DOUBLE("Mic Playback Switch", 0, CS4231_LEFT_MIC_INPUT, CS4231_RIGHT_MIC_INPUT, 7, 7, 1, 1), CS4231_DOUBLE("Mic Playback Volume", 0, CS4231_LEFT_MIC_INPUT, CS4231_RIGHT_MIC_INPUT, 0, 0, 31, 1) }; -static int __devinit snd_interwave_mixer(cs4231_t *chip) +static int __devinit snd_interwave_mixer(struct snd_cs4231 *chip) { - snd_card_t *card = chip->card; - snd_ctl_elem_id_t id1, id2; + struct snd_card *card = chip->card; + struct snd_ctl_elem_id id1, id2; unsigned int idx; int err; @@ -631,9 +638,9 @@ static int __devinit snd_interwave_pnp(int dev, struct snd_interwave *iwcard, } #endif /* CONFIG_PNP */ -static void snd_interwave_free(snd_card_t *card) +static void snd_interwave_free(struct snd_card *card) { - struct snd_interwave *iwcard = (struct snd_interwave *)card->private_data; + struct snd_interwave *iwcard = card->private_data; if (iwcard == NULL) return; @@ -644,76 +651,52 @@ static void snd_interwave_free(snd_card_t *card) free_irq(iwcard->irq, (void *)iwcard); } -static int __devinit snd_interwave_probe(int dev, struct pnp_card_link *pcard, - const struct pnp_card_device_id *pid) +static struct snd_card *snd_interwave_card_new(int dev) { - static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1}; - static int possible_dmas[] = {0, 1, 3, 5, 6, 7, -1}; - int xirq, xdma1, xdma2; - snd_card_t *card; + struct snd_card *card; struct snd_interwave *iwcard; - cs4231_t *cs4231; - snd_gus_card_t *gus; -#ifdef SNDRV_STB - snd_i2c_bus_t *i2c_bus; -#endif - snd_pcm_t *pcm; - char *str; - int err; card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct snd_interwave)); if (card == NULL) - return -ENOMEM; - iwcard = (struct snd_interwave *)card->private_data; + return NULL; + iwcard = card->private_data; iwcard->card = card; iwcard->irq = -1; card->private_free = snd_interwave_free; -#ifdef CONFIG_PNP - if (isapnp[dev]) { - if ((err = snd_interwave_pnp(dev, iwcard, pcard, pid)) < 0) - goto _err; - snd_card_set_dev(card, &pcard->card->dev); - } + return card; +} + +static int __devinit snd_interwave_probe(struct snd_card *card, int dev) +{ + int xirq, xdma1, xdma2; + struct snd_interwave *iwcard = card->private_data; + struct snd_cs4231 *cs4231; + struct snd_gus_card *gus; +#ifdef SNDRV_STB + struct snd_i2c_bus *i2c_bus; #endif + struct snd_pcm *pcm; + char *str; + int err; + xirq = irq[dev]; - if (xirq == SNDRV_AUTO_IRQ) { - if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { - snd_printk(KERN_ERR PFX "unable to find a free IRQ\n"); - err = -EBUSY; - goto _err; - } - } xdma1 = dma1[dev]; - if (xdma1 == SNDRV_AUTO_DMA) { - if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) { - snd_printk(KERN_ERR PFX "unable to find a free DMA1\n"); - err = -EBUSY; - goto _err; - } - } xdma2 = dma2[dev]; - if (xdma2 == SNDRV_AUTO_DMA) { - if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) { - snd_printk(KERN_ERR PFX "unable to find a free DMA2\n"); - err = -EBUSY; - goto _err; - } - } if ((err = snd_gus_create(card, port[dev], -xirq, xdma1, xdma2, 0, 32, pcm_channels[dev], effect[dev], &gus)) < 0) - goto _err; + return err; if ((err = snd_interwave_detect(iwcard, gus, dev #ifdef SNDRV_STB , &i2c_bus #endif )) < 0) - goto _err; + return err; iwcard->gus_status_reg = gus->gf1.reg_irqstat; iwcard->pcm_status_reg = gus->gf1.port + 0x10c + 2; @@ -721,12 +704,12 @@ static int __devinit snd_interwave_probe(int dev, struct pnp_card_link *pcard, snd_interwave_init(dev, gus); snd_interwave_detect_memory(gus); if ((err = snd_gus_initialize(gus)) < 0) - goto _err; + return err; - if (request_irq(xirq, snd_interwave_interrupt, SA_INTERRUPT, "InterWave", (void *)iwcard)) { + if (request_irq(xirq, snd_interwave_interrupt, SA_INTERRUPT, + "InterWave", iwcard)) { snd_printk(KERN_ERR PFX "unable to grab IRQ %d\n", xirq); - err = -EBUSY; - goto _err; + return -EBUSY; } iwcard->irq = xirq; @@ -738,30 +721,30 @@ static int __devinit snd_interwave_probe(int dev, struct pnp_card_link *pcard, CS4231_HWSHARE_DMA1 | CS4231_HWSHARE_DMA2, &cs4231)) < 0) - goto _err; + return err; if ((err = snd_cs4231_pcm(cs4231, 0, &pcm)) < 0) - goto _err; + return err; sprintf(pcm->name + strlen(pcm->name), " rev %c", gus->revision + 'A'); strcat(pcm->name, " (codec)"); if ((err = snd_cs4231_timer(cs4231, 2, NULL)) < 0) - goto _err; + return err; if ((err = snd_cs4231_mixer(cs4231)) < 0) - goto _err; + return err; if (pcm_channels[dev] > 0) { if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0) - goto _err; + return err; } if ((err = snd_interwave_mixer(cs4231)) < 0) - goto _err; + return err; #ifdef SNDRV_STB { - snd_ctl_elem_id_t id1, id2; + struct snd_ctl_elem_id id1, id2; memset(&id1, 0, sizeof(id1)); memset(&id2, 0, sizeof(id2)); id1.iface = id2.iface = SNDRV_CTL_ELEM_IFACE_MIXER; @@ -769,19 +752,19 @@ static int __devinit snd_interwave_probe(int dev, struct pnp_card_link *pcard, strcpy(id2.name, id1.name); id2.index = 1; if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0) - goto _err; + return err; strcpy(id1.name, "Master Playback Volume"); strcpy(id2.name, id1.name); if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0) - goto _err; + return err; if ((err = snd_tea6330t_update_mixer(card, i2c_bus, 0, 1)) < 0) - goto _err; + return err; } #endif gus->uart_enable = midi[dev]; if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0) - goto _err; + return err; #ifndef SNDRV_STB str = "AMD InterWave"; @@ -800,139 +783,198 @@ static int __devinit snd_interwave_probe(int dev, struct pnp_card_link *pcard, if (xdma2 >= 0) sprintf(card->longname + strlen(card->longname), "&%d", xdma2); - if ((err = snd_card_set_generic_dev(card)) < 0) - goto _err; - if ((err = snd_card_register(card)) < 0) - goto _err; + return err; iwcard->cs4231 = cs4231; iwcard->gus = gus; - if (pcard) - pnp_set_card_drvdata(pcard, card); - else - snd_interwave_legacy[dev++] = card; return 0; +} - _err: - snd_card_free(card); - return err; +static int __init snd_interwave_nonpnp_probe1(int dev, struct platform_device *devptr) +{ + struct snd_card *card; + int err; + + card = snd_interwave_card_new(dev); + if (! card) + return -ENOMEM; + + snd_card_set_dev(card, &devptr->dev); + if ((err = snd_interwave_probe(card, dev)) < 0) { + snd_card_free(card); + return err; + } + platform_set_drvdata(devptr, card); + return 0; } -static int __devinit snd_interwave_probe_legacy_port(unsigned long xport) +static int __init snd_interwave_nonpnp_probe(struct platform_device *pdev) { - static int dev; - int res; + int dev = pdev->id; + int err; + static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1}; + static int possible_dmas[] = {0, 1, 3, 5, 6, 7, -1}; - for ( ; dev < SNDRV_CARDS; dev++) { - if (!enable[dev] || port[dev] != SNDRV_AUTO_PORT) - continue; -#ifdef CONFIG_PNP - if (isapnp[dev]) - continue; -#endif - port[dev] = xport; - res = snd_interwave_probe(dev, NULL, NULL); - if (res < 0) - port[dev] = SNDRV_AUTO_PORT; - return res; + if (irq[dev] == SNDRV_AUTO_IRQ) { + if ((irq[dev] = snd_legacy_find_free_irq(possible_irqs)) < 0) { + snd_printk(KERN_ERR PFX "unable to find a free IRQ\n"); + return -EBUSY; + } } - return -ENODEV; + if (dma1[dev] == SNDRV_AUTO_DMA) { + if ((dma1[dev] = snd_legacy_find_free_dma(possible_dmas)) < 0) { + snd_printk(KERN_ERR PFX "unable to find a free DMA1\n"); + return -EBUSY; + } + } + if (dma2[dev] == SNDRV_AUTO_DMA) { + if ((dma2[dev] = snd_legacy_find_free_dma(possible_dmas)) < 0) { + snd_printk(KERN_ERR PFX "unable to find a free DMA2\n"); + return -EBUSY; + } + } + + if (port[dev] != SNDRV_AUTO_PORT) + return snd_interwave_nonpnp_probe1(dev, pdev); + else { + static long possible_ports[] = {0x210, 0x220, 0x230, 0x240, 0x250, 0x260}; + int i; + for (i = 0; i < ARRAY_SIZE(possible_ports); i++) { + port[dev] = possible_ports[i]; + err = snd_interwave_nonpnp_probe1(dev, pdev); + if (! err) + return 0; + } + return err; + } +} + +static int __devexit snd_interwave_nonpnp_remove(struct platform_device *devptr) +{ + snd_card_free(platform_get_drvdata(devptr)); + platform_set_drvdata(devptr, NULL); + return 0; } +static struct platform_driver snd_interwave_driver = { + .probe = snd_interwave_nonpnp_probe, + .remove = __devexit_p(snd_interwave_nonpnp_remove), + /* FIXME: suspend,resume */ + .driver = { + .name = INTERWAVE_DRIVER + }, +}; + #ifdef CONFIG_PNP -static int __devinit snd_interwave_pnp_detect(struct pnp_card_link *card, - const struct pnp_card_device_id *id) +static int __devinit snd_interwave_pnp_detect(struct pnp_card_link *pcard, + const struct pnp_card_device_id *pid) { static int dev; + struct snd_card *card; int res; for ( ; dev < SNDRV_CARDS; dev++) { - if (!enable[dev] || !isapnp[dev]) - continue; - res = snd_interwave_probe(dev, card, id); - if (res < 0) - return res; - dev++; - return 0; - } - - return -ENODEV; + if (enable[dev] && isapnp[dev]) + break; + } + if (dev >= SNDRV_CARDS) + return -ENODEV; + + card = snd_interwave_card_new(dev); + if (! card) + return -ENOMEM; + + if ((res = snd_interwave_pnp(dev, card->private_data, pcard, pid)) < 0) { + snd_card_free(card); + return res; + } + snd_card_set_dev(card, &pcard->card->dev); + if ((res = snd_interwave_probe(card, dev)) < 0) { + snd_card_free(card); + return res; + } + pnp_set_card_drvdata(pcard, card); + dev++; + return 0; } static void __devexit snd_interwave_pnp_remove(struct pnp_card_link * pcard) { - snd_card_t *card = (snd_card_t *) pnp_get_card_drvdata(pcard); - - snd_card_disconnect(card); - snd_card_free_in_thread(card); + snd_card_free(pnp_get_card_drvdata(pcard)); + pnp_set_card_drvdata(pcard, NULL); } static struct pnp_card_driver interwave_pnpc_driver = { .flags = PNP_DRIVER_RES_DISABLE, - .name = "interwave", + .name = INTERWAVE_PNP_DRIVER, .id_table = snd_interwave_pnpids, .probe = snd_interwave_pnp_detect, .remove = __devexit_p(snd_interwave_pnp_remove), + /* FIXME: suspend,resume */ }; #endif /* CONFIG_PNP */ +static void __init_or_module snd_interwave_unregister_all(void) +{ + int i; + + if (pnp_registered) + pnp_unregister_card_driver(&interwave_pnpc_driver); + for (i = 0; i < ARRAY_SIZE(platform_devices); ++i) + platform_device_unregister(platform_devices[i]); + platform_driver_unregister(&snd_interwave_driver); +} + static int __init alsa_card_interwave_init(void) { - int cards = 0, i; - static long possible_ports[] = {0x210, 0x220, 0x230, 0x240, 0x250, 0x260, -1}; - int dev; + int i, err, cards = 0; - for (dev = 0; dev < SNDRV_CARDS; dev++) { - if (!enable[dev] || port[dev] == SNDRV_AUTO_PORT) - continue; + if ((err = platform_driver_register(&snd_interwave_driver)) < 0) + return err; + + for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + struct platform_device *device; #ifdef CONFIG_PNP - if (isapnp[dev]) + if (isapnp[i]) continue; #endif - if (!snd_interwave_probe(dev, NULL, NULL)) { - cards++; - continue; + device = platform_device_register_simple(INTERWAVE_DRIVER, + i, NULL, 0); + if (IS_ERR(device)) { + err = PTR_ERR(device); + goto errout; } -#ifdef MODULE - printk(KERN_ERR "InterWave soundcard #%i not found at 0x%lx or device busy\n", dev, port[dev]); -#endif + platform_devices[i] = device; + cards++; } - /* legacy auto configured cards */ - i = snd_legacy_auto_probe(possible_ports, snd_interwave_probe_legacy_port); - if (i > 0) - cards += i; -#ifdef CONFIG_PNP + /* ISA PnP cards */ i = pnp_register_card_driver(&interwave_pnpc_driver); - if (i > 0) + if (i >= 0) { + pnp_registered = 1; cards += i; -#endif + } if (!cards) { -#ifdef CONFIG_PNP - pnp_unregister_card_driver(&interwave_pnpc_driver); -#endif #ifdef MODULE printk(KERN_ERR "InterWave soundcard not found or device busy\n"); #endif - return -ENODEV; + err = -ENODEV; + goto errout; } return 0; + + errout: + snd_interwave_unregister_all(); + return err; } static void __exit alsa_card_interwave_exit(void) { - int dev; - -#ifdef CONFIG_PNP - /* PnP cards first */ - pnp_unregister_card_driver(&interwave_pnpc_driver); -#endif - for (dev = 0; dev < SNDRV_CARDS; dev++) - snd_card_free(snd_interwave_legacy[dev]); + snd_interwave_unregister_all(); } module_init(alsa_card_interwave_init) |