From 224a033252bba46c5c8b5df625f5e781ca138f48 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 30 Oct 2007 11:49:22 +0100 Subject: [ALSA] opl3 - Use hwdep for patch loading Use the hwdep device for loading OPL2/3 patch data instead of the messy sequencer instrument layer. Due to this change, the sbiload program should be updated, too. Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- include/sound/asound_fm.h | 19 ++++++++++++++++ include/sound/opl3.h | 58 ++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 74 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/sound/asound_fm.h b/include/sound/asound_fm.h index 8fbcab7cc73b..c2a4b967d5be 100644 --- a/include/sound/asound_fm.h +++ b/include/sound/asound_fm.h @@ -104,6 +104,8 @@ struct snd_dm_fm_params { #define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int) /* for OPL3 only */ #define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int) +/* SBI patch management */ +#define SNDRV_DM_FM_IOCTL_CLEAR_PATCHES _IO ('H', 0x40) #define SNDRV_DM_FM_OSS_IOCTL_RESET 0x20 #define SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE 0x21 @@ -112,4 +114,21 @@ struct snd_dm_fm_params { #define SNDRV_DM_FM_OSS_IOCTL_SET_MODE 0x24 #define SNDRV_DM_FM_OSS_IOCTL_SET_OPL 0x25 +/* + * Patch Record - fixed size for write + */ + +#define FM_KEY_SBI "SBI\032" +#define FM_KEY_2OP "2OP\032" +#define FM_KEY_4OP "4OP\032" + +struct sbi_patch { + unsigned char prog; + unsigned char bank; + char key[4]; + char name[25]; + char extension[7]; + unsigned char data[32]; +}; + #endif /* __SOUND_ASOUND_FM_H */ diff --git a/include/sound/opl3.h b/include/sound/opl3.h index 1d14b3f82393..7ee865d6236f 100644 --- a/include/sound/opl3.h +++ b/include/sound/opl3.h @@ -63,7 +63,7 @@ #include "seq_oss_legacy.h" #endif #include "seq_device.h" -#include "ainstr_fm.h" +#include "asound_fm.h" /* * Register numbers for the global registers @@ -239,6 +239,47 @@ struct snd_opl3; +/* + * Instrument record, aka "Patch" + */ + +/* FM operator */ +struct fm_operator { + unsigned char am_vib; + unsigned char ksl_level; + unsigned char attack_decay; + unsigned char sustain_release; + unsigned char wave_select; +} __attribute__((packed)); + +/* Instrument data */ +struct fm_instrument { + struct fm_operator op[4]; + unsigned char feedback_connection[2]; + unsigned char echo_delay; + unsigned char echo_atten; + unsigned char chorus_spread; + unsigned char trnsps; + unsigned char fix_dur; + unsigned char modes; + unsigned char fix_key; +}; + +/* type */ +#define FM_PATCH_OPL2 0x01 /* OPL2 2 operators FM instrument */ +#define FM_PATCH_OPL3 0x02 /* OPL3 4 operators FM instrument */ + +/* Instrument record */ +struct fm_patch { + unsigned char prog; + unsigned char bank; + unsigned char type; + struct fm_instrument inst; + char name[24]; + struct fm_patch *next; +}; + + /* * A structure to keep track of each hardware voice */ @@ -297,8 +338,8 @@ struct snd_opl3 { struct snd_midi_channel_set * oss_chset; #endif - struct snd_seq_kinstr_ops fm_ops; - struct snd_seq_kinstr_list *ilist; +#define OPL3_PATCH_HASH_SIZE 32 + struct fm_patch *patch_table[OPL3_PATCH_HASH_SIZE]; struct snd_opl3_voice voices[MAX_OPL3_VOICES]; /* Voices (OPL3 'channel') */ int use_time; /* allocation counter */ @@ -333,8 +374,19 @@ int snd_opl3_hwdep_new(struct snd_opl3 * opl3, int device, int seq_device, int snd_opl3_open(struct snd_hwdep * hw, struct file *file); int snd_opl3_ioctl(struct snd_hwdep * hw, struct file *file, unsigned int cmd, unsigned long arg); +long snd_opl3_write(struct snd_hwdep *hw, const char __user *buf, long count, + loff_t *offset); int snd_opl3_release(struct snd_hwdep * hw, struct file *file); void snd_opl3_reset(struct snd_opl3 * opl3); +int snd_opl3_load_patch(struct snd_opl3 *opl3, + int prog, int bank, int type, + const char *name, + const unsigned char *ext, + const unsigned char *data); +struct fm_patch *snd_opl3_find_patch(struct snd_opl3 *opl3, int prog, int bank, + int create_patch); +void snd_opl3_clear_patches(struct snd_opl3 *opl3); + #endif /* __SOUND_OPL3_H */ -- cgit v1.2.3 From 05c1afe75fcebf456017ec186811cf1599f4360e Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 30 Oct 2007 11:59:15 +0100 Subject: [ALSA] opl3 - simplify exclusive access lock Use the exclusive access lock in hwdep instead of the own one. Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- include/sound/opl3.h | 2 -- sound/drivers/opl3/opl3_lib.c | 2 +- sound/drivers/opl3/opl3_seq.c | 19 +++++++++++-------- sound/drivers/opl3/opl3_synth.c | 14 -------------- 4 files changed, 12 insertions(+), 25 deletions(-) (limited to 'include') diff --git a/include/sound/opl3.h b/include/sound/opl3.h index 7ee865d6236f..eea584b7bfc5 100644 --- a/include/sound/opl3.h +++ b/include/sound/opl3.h @@ -320,7 +320,6 @@ struct snd_opl3 { spinlock_t reg_lock; struct snd_card *card; /* The card that this belongs to */ - int used; /* usage flag - exclusive */ unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */ unsigned char rhythm; /* percussion mode flag */ unsigned char max_voices; /* max number of voices */ @@ -353,7 +352,6 @@ struct snd_opl3 { int sys_timer_status; /* system timer run status */ spinlock_t sys_timer_lock; /* Lock for system timer access */ #endif - struct mutex access_mutex; /* locking */ }; /* opl3.c */ diff --git a/sound/drivers/opl3/opl3_lib.c b/sound/drivers/opl3/opl3_lib.c index a657da922b4d..a1270841290b 100644 --- a/sound/drivers/opl3/opl3_lib.c +++ b/sound/drivers/opl3/opl3_lib.c @@ -361,7 +361,6 @@ int snd_opl3_new(struct snd_card *card, opl3->hardware = hardware; spin_lock_init(&opl3->reg_lock); spin_lock_init(&opl3->timer_lock); - mutex_init(&opl3->access_mutex); if ((err = snd_device_new(card, SNDRV_DEV_CODEC, opl3, &ops)) < 0) { snd_opl3_free(opl3); @@ -497,6 +496,7 @@ int snd_opl3_hwdep_new(struct snd_opl3 * opl3, return err; } hw->private_data = opl3; + hw->exclusive = 1; #ifdef CONFIG_SND_OSSEMUL if (device == 0) { hw->oss_type = SNDRV_OSS_DEVICE_TYPE_DMFM; diff --git a/sound/drivers/opl3/opl3_seq.c b/sound/drivers/opl3/opl3_seq.c index ff6da16b9178..6fd60b7e5805 100644 --- a/sound/drivers/opl3/opl3_seq.c +++ b/sound/drivers/opl3/opl3_seq.c @@ -51,14 +51,15 @@ void snd_opl3_synth_use_dec(struct snd_opl3 * opl3) int snd_opl3_synth_setup(struct snd_opl3 * opl3) { int idx; + struct snd_hwdep *hwdep = opl3->hwdep; - mutex_lock(&opl3->access_mutex); - if (opl3->used) { - mutex_unlock(&opl3->access_mutex); + mutex_lock(&hwdep->open_mutex); + if (hwdep->used) { + mutex_unlock(&hwdep->open_mutex); return -EBUSY; } - opl3->used++; - mutex_unlock(&opl3->access_mutex); + hwdep->used++; + mutex_unlock(&hwdep->open_mutex); snd_opl3_reset(opl3); @@ -91,9 +92,11 @@ void snd_opl3_synth_cleanup(struct snd_opl3 * opl3) spin_unlock_irqrestore(&opl3->sys_timer_lock, flags); snd_opl3_reset(opl3); - mutex_lock(&opl3->access_mutex); - opl3->used--; - mutex_unlock(&opl3->access_mutex); + hwdep = opl3->hwdep; + mutex_lock(&hwdep->open_mutex); + hwdep->used--; + mutex_unlock(&hwdep->open_mutex); + wake_up(&hwdep->open_wait); } static int snd_opl3_synth_use(void *private_data, struct snd_seq_port_subscribe * info) diff --git a/sound/drivers/opl3/opl3_synth.c b/sound/drivers/opl3/opl3_synth.c index d55eefce44c1..a7bf7a4b1f85 100644 --- a/sound/drivers/opl3/opl3_synth.c +++ b/sound/drivers/opl3/opl3_synth.c @@ -76,16 +76,6 @@ static int snd_opl3_set_connection(struct snd_opl3 * opl3, int connection); */ int snd_opl3_open(struct snd_hwdep * hw, struct file *file) { - struct snd_opl3 *opl3 = hw->private_data; - - mutex_lock(&opl3->access_mutex); - if (opl3->used) { - mutex_unlock(&opl3->access_mutex); - return -EAGAIN; - } - opl3->used++; - mutex_unlock(&opl3->access_mutex); - return 0; } @@ -185,10 +175,6 @@ int snd_opl3_release(struct snd_hwdep * hw, struct file *file) struct snd_opl3 *opl3 = hw->private_data; snd_opl3_reset(opl3); - mutex_lock(&opl3->access_mutex); - opl3->used--; - mutex_unlock(&opl3->access_mutex); - return 0; } -- cgit v1.2.3 From e5723b41abe559bafc52591dcf8ee19cc131d3a1 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 30 Oct 2007 12:17:17 +0100 Subject: [ALSA] Remove sequencer instrument layer Remove sequencer instrument layer from the tree. This mechanism hasn't been used much with the actual devices. The only reasonable user was OPL3 loader, and now it was rewritten to use hwdep instead. So, let's remove the rest of rotten codes. Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- include/sound/ainstr_fm.h | 134 ----- include/sound/ainstr_gf1.h | 229 -------- include/sound/ainstr_iw.h | 384 ------------- include/sound/ainstr_simple.h | 159 ------ include/sound/asequencer.h | 242 +------- include/sound/gus.h | 63 --- include/sound/seq_instr.h | 110 ---- include/sound/trident.h | 22 - sound/core/seq/Makefile | 8 +- sound/core/seq/instr/Makefile | 23 - sound/core/seq/instr/ainstr_fm.c | 155 ----- sound/core/seq/instr/ainstr_gf1.c | 359 ------------ sound/core/seq/instr/ainstr_iw.c | 623 --------------------- sound/core/seq/instr/ainstr_simple.c | 215 ------- sound/core/seq/seq_clientmgr.c | 3 +- sound/core/seq/seq_instr.c | 655 ---------------------- sound/core/seq/seq_midi_emul.c | 7 - sound/isa/gus/Makefile | 12 - sound/isa/gus/gus_main.c | 23 - sound/isa/gus/gus_sample.c | 165 ------ sound/isa/gus/gus_simple.c | 634 --------------------- sound/isa/gus/gus_synth.c | 314 ----------- sound/pci/trident/Makefile | 10 - sound/pci/trident/trident.c | 7 - sound/pci/trident/trident_main.c | 28 - sound/pci/trident/trident_synth.c | 1024 ---------------------------------- 26 files changed, 5 insertions(+), 5603 deletions(-) delete mode 100644 include/sound/ainstr_fm.h delete mode 100644 include/sound/ainstr_gf1.h delete mode 100644 include/sound/ainstr_iw.h delete mode 100644 include/sound/ainstr_simple.h delete mode 100644 include/sound/seq_instr.h delete mode 100644 sound/core/seq/instr/Makefile delete mode 100644 sound/core/seq/instr/ainstr_fm.c delete mode 100644 sound/core/seq/instr/ainstr_gf1.c delete mode 100644 sound/core/seq/instr/ainstr_iw.c delete mode 100644 sound/core/seq/instr/ainstr_simple.c delete mode 100644 sound/core/seq/seq_instr.c delete mode 100644 sound/isa/gus/gus_sample.c delete mode 100644 sound/isa/gus/gus_simple.c delete mode 100644 sound/isa/gus/gus_synth.c delete mode 100644 sound/pci/trident/trident_synth.c (limited to 'include') diff --git a/include/sound/ainstr_fm.h b/include/sound/ainstr_fm.h deleted file mode 100644 index c4afb1f121fe..000000000000 --- a/include/sound/ainstr_fm.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Advanced Linux Sound Architecture - * - * FM (OPL2/3) Instrument Format - * Copyright (c) 2000 Uros Bizjak - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef __SOUND_AINSTR_FM_H -#define __SOUND_AINSTR_FM_H - -#ifndef __KERNEL__ -#include -#include -#endif - -/* - * share types (share ID 1) - */ - -#define FM_SHARE_FILE 0 - -/* - * FM operator - */ - -struct fm_operator { - unsigned char am_vib; - unsigned char ksl_level; - unsigned char attack_decay; - unsigned char sustain_release; - unsigned char wave_select; -}; - -/* - * Instrument - */ - -#define FM_PATCH_OPL2 0x01 /* OPL2 2 operators FM instrument */ -#define FM_PATCH_OPL3 0x02 /* OPL3 4 operators FM instrument */ - -struct fm_instrument { - unsigned int share_id[4]; /* share id - zero = no sharing */ - unsigned char type; /* instrument type */ - - struct fm_operator op[4]; - unsigned char feedback_connection[2]; - - unsigned char echo_delay; - unsigned char echo_atten; - unsigned char chorus_spread; - unsigned char trnsps; - unsigned char fix_dur; - unsigned char modes; - unsigned char fix_key; -}; - -/* - * - * Kernel <-> user space - * Hardware (CPU) independent section - * - * * = zero or more - * + = one or more - * - * fm_xinstrument FM_STRU_INSTR - * - */ - -#define FM_STRU_INSTR __cpu_to_be32(('I'<<24)|('N'<<16)|('S'<<8)|'T') - -/* - * FM operator - */ - -struct fm_xoperator { - __u8 am_vib; - __u8 ksl_level; - __u8 attack_decay; - __u8 sustain_release; - __u8 wave_select; -}; - -/* - * Instrument - */ - -struct fm_xinstrument { - __u32 stype; /* structure type */ - - __u32 share_id[4]; /* share id - zero = no sharing */ - __u8 type; /* instrument type */ - - struct fm_xoperator op[4]; /* fm operators */ - __u8 feedback_connection[2]; - - __u8 echo_delay; - __u8 echo_atten; - __u8 chorus_spread; - __u8 trnsps; - __u8 fix_dur; - __u8 modes; - __u8 fix_key; -}; - -#ifdef __KERNEL__ - -#include "seq_instr.h" - -int snd_seq_fm_init(struct snd_seq_kinstr_ops * ops, - struct snd_seq_kinstr_ops * next); - -#endif - -/* typedefs for compatibility to user-space */ -typedef struct fm_xoperator fm_xoperator_t; -typedef struct fm_xinstrument fm_xinstrument_t; - -#endif /* __SOUND_AINSTR_FM_H */ diff --git a/include/sound/ainstr_gf1.h b/include/sound/ainstr_gf1.h deleted file mode 100644 index b62b665c69c6..000000000000 --- a/include/sound/ainstr_gf1.h +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Advanced Linux Sound Architecture - * - * GF1 (GUS) Patch Instrument Format - * Copyright (c) 1994-99 by Jaroslav Kysela - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef __SOUND_AINSTR_GF1_H -#define __SOUND_AINSTR_GF1_H - -#ifndef __KERNEL__ -#include -#include -#endif - -/* - * share types (share ID 1) - */ - -#define GF1_SHARE_FILE 0 - -/* - * wave formats - */ - -#define GF1_WAVE_16BIT 0x0001 /* 16-bit wave */ -#define GF1_WAVE_UNSIGNED 0x0002 /* unsigned wave */ -#define GF1_WAVE_INVERT 0x0002 /* same as unsigned wave */ -#define GF1_WAVE_BACKWARD 0x0004 /* backward mode (maybe used for reverb or ping-ping loop) */ -#define GF1_WAVE_LOOP 0x0008 /* loop mode */ -#define GF1_WAVE_BIDIR 0x0010 /* bidirectional mode */ -#define GF1_WAVE_STEREO 0x0100 /* stereo mode */ -#define GF1_WAVE_ULAW 0x0200 /* uLaw compression mode */ - -/* - * Wavetable definitions - */ - -struct gf1_wave { - unsigned int share_id[4]; /* share id - zero = no sharing */ - unsigned int format; /* wave format */ - - struct { - unsigned int number; /* some other ID for this instrument */ - unsigned int memory; /* begin of waveform in onboard memory */ - unsigned char *ptr; /* pointer to waveform in system memory */ - } address; - - unsigned int size; /* size of waveform in samples */ - unsigned int start; /* start offset in samples * 16 (lowest 4 bits - fraction) */ - unsigned int loop_start; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */ - unsigned int loop_end; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */ - unsigned short loop_repeat; /* loop repeat - 0 = forever */ - - unsigned char flags; /* GF1 patch flags */ - unsigned char pad; - unsigned int sample_rate; /* sample rate in Hz */ - unsigned int low_frequency; /* low frequency range */ - unsigned int high_frequency; /* high frequency range */ - unsigned int root_frequency; /* root frequency range */ - signed short tune; - unsigned char balance; - unsigned char envelope_rate[6]; - unsigned char envelope_offset[6]; - unsigned char tremolo_sweep; - unsigned char tremolo_rate; - unsigned char tremolo_depth; - unsigned char vibrato_sweep; - unsigned char vibrato_rate; - unsigned char vibrato_depth; - unsigned short scale_frequency; - unsigned short scale_factor; /* 0-2048 or 0-2 */ - - struct gf1_wave *next; -}; - -/* - * Instrument - */ - -#define IWFFFF_EXCLUDE_NONE 0x0000 /* exclusion mode - none */ -#define IWFFFF_EXCLUDE_SINGLE 0x0001 /* exclude single - single note from the instrument group */ -#define IWFFFF_EXCLUDE_MULTIPLE 0x0002 /* exclude multiple - stop only same note from this instrument */ - -#define IWFFFF_EFFECT_NONE 0 -#define IWFFFF_EFFECT_REVERB 1 -#define IWFFFF_EFFECT_CHORUS 2 -#define IWFFFF_EFFECT_ECHO 3 - -struct gf1_instrument { - unsigned short exclusion; - unsigned short exclusion_group; /* 0 - none, 1-65535 */ - - unsigned char effect1; /* effect 1 */ - unsigned char effect1_depth; /* 0-127 */ - unsigned char effect2; /* effect 2 */ - unsigned char effect2_depth; /* 0-127 */ - - struct gf1_wave *wave; /* first waveform */ -}; - -/* - * - * Kernel <-> user space - * Hardware (CPU) independent section - * - * * = zero or more - * + = one or more - * - * gf1_xinstrument IWFFFF_STRU_INSTR - * +gf1_xwave IWFFFF_STRU_WAVE - * - */ - -#define GF1_STRU_WAVE __cpu_to_be32(('W'<<24)|('A'<<16)|('V'<<8)|'E') -#define GF1_STRU_INSTR __cpu_to_be32(('I'<<24)|('N'<<16)|('S'<<8)|'T') - -/* - * Wavetable definitions - */ - -struct gf1_xwave { - __u32 stype; /* structure type */ - - __u32 share_id[4]; /* share id - zero = no sharing */ - __u32 format; /* wave format */ - - __u32 size; /* size of waveform in samples */ - __u32 start; /* start offset in samples * 16 (lowest 4 bits - fraction) */ - __u32 loop_start; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */ - __u32 loop_end; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */ - __u16 loop_repeat; /* loop repeat - 0 = forever */ - - __u8 flags; /* GF1 patch flags */ - __u8 pad; - __u32 sample_rate; /* sample rate in Hz */ - __u32 low_frequency; /* low frequency range */ - __u32 high_frequency; /* high frequency range */ - __u32 root_frequency; /* root frequency range */ - __s16 tune; - __u8 balance; - __u8 envelope_rate[6]; - __u8 envelope_offset[6]; - __u8 tremolo_sweep; - __u8 tremolo_rate; - __u8 tremolo_depth; - __u8 vibrato_sweep; - __u8 vibrato_rate; - __u8 vibrato_depth; - __u16 scale_frequency; - __u16 scale_factor; /* 0-2048 or 0-2 */ -}; - -/* - * Instrument - */ - -struct gf1_xinstrument { - __u32 stype; - - __u16 exclusion; - __u16 exclusion_group; /* 0 - none, 1-65535 */ - - __u8 effect1; /* effect 1 */ - __u8 effect1_depth; /* 0-127 */ - __u8 effect2; /* effect 2 */ - __u8 effect2_depth; /* 0-127 */ -}; - -/* - * Instrument info - */ - -#define GF1_INFO_ENVELOPE (1<<0) -#define GF1_INFO_TREMOLO (1<<1) -#define GF1_INFO_VIBRATO (1<<2) - -struct gf1_info { - unsigned char flags; /* supported wave flags */ - unsigned char pad[3]; - unsigned int features; /* supported features */ - unsigned int max8_len; /* maximum 8-bit wave length */ - unsigned int max16_len; /* maximum 16-bit wave length */ -}; - -#ifdef __KERNEL__ - -#include "seq_instr.h" - -struct snd_gf1_ops { - void *private_data; - int (*info)(void *private_data, struct gf1_info *info); - int (*put_sample)(void *private_data, struct gf1_wave *wave, - char __user *data, long len, int atomic); - int (*get_sample)(void *private_data, struct gf1_wave *wave, - char __user *data, long len, int atomic); - int (*remove_sample)(void *private_data, struct gf1_wave *wave, - int atomic); - void (*notify)(void *private_data, struct snd_seq_kinstr *instr, int what); - struct snd_seq_kinstr_ops kops; -}; - -int snd_seq_gf1_init(struct snd_gf1_ops *ops, - void *private_data, - struct snd_seq_kinstr_ops *next); - -#endif - -/* typedefs for compatibility to user-space */ -typedef struct gf1_xwave gf1_xwave_t; -typedef struct gf1_xinstrument gf1_xinstrument_t; - -#endif /* __SOUND_AINSTR_GF1_H */ diff --git a/include/sound/ainstr_iw.h b/include/sound/ainstr_iw.h deleted file mode 100644 index 11bd25082600..000000000000 --- a/include/sound/ainstr_iw.h +++ /dev/null @@ -1,384 +0,0 @@ -/* - * Advanced Linux Sound Architecture - * - * InterWave FFFF Instrument Format - * Copyright (c) 1994-99 by Jaroslav Kysela - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef __SOUND_AINSTR_IW_H -#define __SOUND_AINSTR_IW_H - -#ifndef __KERNEL__ -#include -#include -#endif - -/* - * share types (share ID 1) - */ - -#define IWFFFF_SHARE_FILE 0 - -/* - * wave formats - */ - -#define IWFFFF_WAVE_16BIT 0x0001 /* 16-bit wave */ -#define IWFFFF_WAVE_UNSIGNED 0x0002 /* unsigned wave */ -#define IWFFFF_WAVE_INVERT 0x0002 /* same as unsigned wave */ -#define IWFFFF_WAVE_BACKWARD 0x0004 /* backward mode (maybe used for reverb or ping-ping loop) */ -#define IWFFFF_WAVE_LOOP 0x0008 /* loop mode */ -#define IWFFFF_WAVE_BIDIR 0x0010 /* bidirectional mode */ -#define IWFFFF_WAVE_ULAW 0x0020 /* uLaw compressed wave */ -#define IWFFFF_WAVE_RAM 0x0040 /* wave is _preloaded_ in RAM (it is used for ROM simulation) */ -#define IWFFFF_WAVE_ROM 0x0080 /* wave is in ROM */ -#define IWFFFF_WAVE_STEREO 0x0100 /* wave is stereo */ - -/* - * Wavetable definitions - */ - -struct iwffff_wave { - unsigned int share_id[4]; /* share id - zero = no sharing */ - unsigned int format; /* wave format */ - - struct { - unsigned int number; /* some other ID for this wave */ - unsigned int memory; /* begin of waveform in onboard memory */ - unsigned char *ptr; /* pointer to waveform in system memory */ - } address; - - unsigned int size; /* size of waveform in samples */ - unsigned int start; /* start offset in samples * 16 (lowest 4 bits - fraction) */ - unsigned int loop_start; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */ - unsigned int loop_end; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */ - unsigned short loop_repeat; /* loop repeat - 0 = forever */ - unsigned int sample_ratio; /* sample ratio (44100 * 1024 / rate) */ - unsigned char attenuation; /* 0 - 127 (no corresponding midi controller) */ - unsigned char low_note; /* lower frequency range for this waveform */ - unsigned char high_note; /* higher frequency range for this waveform */ - unsigned char pad; - - struct iwffff_wave *next; -}; - -/* - * Layer - */ - -#define IWFFFF_LFO_SHAPE_TRIANGLE 0 -#define IWFFFF_LFO_SHAPE_POSTRIANGLE 1 - -struct iwffff_lfo { - unsigned short freq; /* (0-2047) 0.01Hz - 21.5Hz */ - signed short depth; /* volume +- (0-255) 0.48675dB/step */ - signed short sweep; /* 0 - 950 deciseconds */ - unsigned char shape; /* see to IWFFFF_LFO_SHAPE_XXXX */ - unsigned char delay; /* 0 - 255 deciseconds */ -}; - -#define IWFFFF_ENV_FLAG_RETRIGGER 0x0001 /* flag - retrigger */ - -#define IWFFFF_ENV_MODE_ONE_SHOT 0x0001 /* mode - one shot */ -#define IWFFFF_ENV_MODE_SUSTAIN 0x0002 /* mode - sustain */ -#define IWFFFF_ENV_MODE_NO_SUSTAIN 0x0003 /* mode - no sustain */ - -#define IWFFFF_ENV_INDEX_VELOCITY 0x0001 /* index - velocity */ -#define IWFFFF_ENV_INDEX_FREQUENCY 0x0002 /* index - frequency */ - -struct iwffff_env_point { - unsigned short offset; - unsigned short rate; -}; - -struct iwffff_env_record { - unsigned short nattack; - unsigned short nrelease; - unsigned short sustain_offset; - unsigned short sustain_rate; - unsigned short release_rate; - unsigned char hirange; - unsigned char pad; - struct iwffff_env_record *next; - /* points are stored here */ - /* count of points = nattack + nrelease */ -}; - -struct iwffff_env { - unsigned char flags; - unsigned char mode; - unsigned char index; - unsigned char pad; - struct iwffff_env_record *record; -}; - -#define IWFFFF_LAYER_FLAG_RETRIGGER 0x0001 /* retrigger */ - -#define IWFFFF_LAYER_VELOCITY_TIME 0x0000 /* velocity mode = time */ -#define IWFFFF_LAYER_VELOCITY_RATE 0x0001 /* velocity mode = rate */ - -#define IWFFFF_LAYER_EVENT_KUP 0x0000 /* layer event - key up */ -#define IWFFFF_LAYER_EVENT_KDOWN 0x0001 /* layer event - key down */ -#define IWFFFF_LAYER_EVENT_RETRIG 0x0002 /* layer event - retrigger */ -#define IWFFFF_LAYER_EVENT_LEGATO 0x0003 /* layer event - legato */ - -struct iwffff_layer { - unsigned char flags; - unsigned char velocity_mode; - unsigned char layer_event; - unsigned char low_range; /* range for layer based */ - unsigned char high_range; /* on either velocity or frequency */ - unsigned char pan; /* pan offset from CC1 (0 left - 127 right) */ - unsigned char pan_freq_scale; /* position based on frequency (0-127) */ - unsigned char attenuation; /* 0-127 (no corresponding midi controller) */ - struct iwffff_lfo tremolo; /* tremolo effect */ - struct iwffff_lfo vibrato; /* vibrato effect */ - unsigned short freq_scale; /* 0-2048, 1024 is equal to semitone scaling */ - unsigned char freq_center; /* center for keyboard frequency scaling */ - unsigned char pad; - struct iwffff_env penv; /* pitch envelope */ - struct iwffff_env venv; /* volume envelope */ - - struct iwffff_wave *wave; - struct iwffff_layer *next; -}; - -/* - * Instrument - */ - -#define IWFFFF_EXCLUDE_NONE 0x0000 /* exclusion mode - none */ -#define IWFFFF_EXCLUDE_SINGLE 0x0001 /* exclude single - single note from the instrument group */ -#define IWFFFF_EXCLUDE_MULTIPLE 0x0002 /* exclude multiple - stop only same note from this instrument */ - -#define IWFFFF_LAYER_NONE 0x0000 /* not layered */ -#define IWFFFF_LAYER_ON 0x0001 /* layered */ -#define IWFFFF_LAYER_VELOCITY 0x0002 /* layered by velocity */ -#define IWFFFF_LAYER_FREQUENCY 0x0003 /* layered by frequency */ - -#define IWFFFF_EFFECT_NONE 0 -#define IWFFFF_EFFECT_REVERB 1 -#define IWFFFF_EFFECT_CHORUS 2 -#define IWFFFF_EFFECT_ECHO 3 - -struct iwffff_instrument { - unsigned short exclusion; - unsigned short layer_type; - unsigned short exclusion_group; /* 0 - none, 1-65535 */ - - unsigned char effect1; /* effect 1 */ - unsigned char effect1_depth; /* 0-127 */ - unsigned char effect2; /* effect 2 */ - unsigned char effect2_depth; /* 0-127 */ - - struct iwffff_layer *layer; /* first layer */ -}; - -/* - * - * Kernel <-> user space - * Hardware (CPU) independent section - * - * * = zero or more - * + = one or more - * - * iwffff_xinstrument IWFFFF_STRU_INSTR - * +iwffff_xlayer IWFFFF_STRU_LAYER - * *iwffff_xenv_record IWFFFF_STRU_ENV_RECT (tremolo) - * *iwffff_xenv_record IWFFFF_STRU_EVN_RECT (vibrato) - * +iwffff_xwave IWFFFF_STRU_WAVE - * - */ - -#define IWFFFF_STRU_WAVE __cpu_to_be32(('W'<<24)|('A'<<16)|('V'<<8)|'E') -#define IWFFFF_STRU_ENV_RECP __cpu_to_be32(('E'<<24)|('N'<<16)|('R'<<8)|'P') -#define IWFFFF_STRU_ENV_RECV __cpu_to_be32(('E'<<24)|('N'<<16)|('R'<<8)|'V') -#define IWFFFF_STRU_LAYER __cpu_to_be32(('L'<<24)|('A'<<16)|('Y'<<8)|'R') -#define IWFFFF_STRU_INSTR __cpu_to_be32(('I'<<24)|('N'<<16)|('S'<<8)|'T') - -/* - * Wavetable definitions - */ - -struct iwffff_xwave { - __u32 stype; /* structure type */ - - __u32 share_id[4]; /* share id - zero = no sharing */ - - __u32 format; /* wave format */ - __u32 offset; /* offset to ROM (address) */ - - __u32 size; /* size of waveform in samples */ - __u32 start; /* start offset in samples * 16 (lowest 4 bits - fraction) */ - __u32 loop_start; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */ - __u32 loop_end; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */ - __u16 loop_repeat; /* loop repeat - 0 = forever */ - __u32 sample_ratio; /* sample ratio (44100 * 1024 / rate) */ - __u8 attenuation; /* 0 - 127 (no corresponding midi controller) */ - __u8 low_note; /* lower frequency range for this waveform */ - __u8 high_note; /* higher frequency range for this waveform */ - __u8 pad; -}; - -/* - * Layer - */ - -struct iwffff_xlfo { - __u16 freq; /* (0-2047) 0.01Hz - 21.5Hz */ - __s16 depth; /* volume +- (0-255) 0.48675dB/step */ - __s16 sweep; /* 0 - 950 deciseconds */ - __u8 shape; /* see to ULTRA_IW_LFO_SHAPE_XXXX */ - __u8 delay; /* 0 - 255 deciseconds */ -}; - -struct iwffff_xenv_point { - __u16 offset; - __u16 rate; -}; - -struct iwffff_xenv_record { - __u32 stype; - __u16 nattack; - __u16 nrelease; - __u16 sustain_offset; - __u16 sustain_rate; - __u16 release_rate; - __u8 hirange; - __u8 pad; - /* points are stored here.. */ - /* count of points = nattack + nrelease */ -}; - -struct iwffff_xenv { - __u8 flags; - __u8 mode; - __u8 index; - __u8 pad; -}; - -struct iwffff_xlayer { - __u32 stype; - __u8 flags; - __u8 velocity_mode; - __u8 layer_event; - __u8 low_range; /* range for layer based */ - __u8 high_range; /* on either velocity or frequency */ - __u8 pan; /* pan offset from CC1 (0 left - 127 right) */ - __u8 pan_freq_scale; /* position based on frequency (0-127) */ - __u8 attenuation; /* 0-127 (no corresponding midi controller) */ - struct iwffff_xlfo tremolo; /* tremolo effect */ - struct iwffff_xlfo vibrato; /* vibrato effect */ - __u16 freq_scale; /* 0-2048, 1024 is equal to semitone scaling */ - __u8 freq_center; /* center for keyboard frequency scaling */ - __u8 pad; - struct iwffff_xenv penv; /* pitch envelope */ - struct iwffff_xenv venv; /* volume envelope */ -}; - -/* - * Instrument - */ - -struct iwffff_xinstrument { - __u32 stype; - - __u16 exclusion; - __u16 layer_type; - __u16 exclusion_group; /* 0 - none, 1-65535 */ - - __u8 effect1; /* effect 1 */ - __u8 effect1_depth; /* 0-127 */ - __u8 effect2; /* effect 2 */ - __u8 effect2_depth; /* 0-127 */ -}; - -/* - * ROM support - * InterWave ROMs are Little-Endian (x86) - */ - -#define IWFFFF_ROM_HDR_SIZE 512 - -struct iwffff_rom_header { - __u8 iwave[8]; - __u8 revision; - __u8 series_number; - __u8 series_name[16]; - __u8 date[10]; - __u16 vendor_revision_major; - __u16 vendor_revision_minor; - __u32 rom_size; - __u8 copyright[128]; - __u8 vendor_name[64]; - __u8 description[128]; -}; - -/* - * Instrument info - */ - -#define IWFFFF_INFO_LFO_VIBRATO (1<<0) -#define IWFFFF_INFO_LFO_VIBRATO_SHAPE (1<<1) -#define IWFFFF_INFO_LFO_TREMOLO (1<<2) -#define IWFFFF_INFO_LFO_TREMOLO_SHAPE (1<<3) - -struct iwffff_info { - unsigned int format; /* supported format bits */ - unsigned int effects; /* supported effects (1 << IWFFFF_EFFECT*) */ - unsigned int lfos; /* LFO effects */ - unsigned int max8_len; /* maximum 8-bit wave length */ - unsigned int max16_len; /* maximum 16-bit wave length */ -}; - -#ifdef __KERNEL__ - -#include "seq_instr.h" - -struct snd_iwffff_ops { - void *private_data; - int (*info)(void *private_data, struct iwffff_info *info); - int (*put_sample)(void *private_data, struct iwffff_wave *wave, - char __user *data, long len, int atomic); - int (*get_sample)(void *private_data, struct iwffff_wave *wave, - char __user *data, long len, int atomic); - int (*remove_sample)(void *private_data, struct iwffff_wave *wave, - int atomic); - void (*notify)(void *private_data, struct snd_seq_kinstr *instr, int what); - struct snd_seq_kinstr_ops kops; -}; - -int snd_seq_iwffff_init(struct snd_iwffff_ops *ops, - void *private_data, - struct snd_seq_kinstr_ops *next); - -#endif - -/* typedefs for compatibility to user-space */ -typedef struct iwffff_xwave iwffff_xwave_t; -typedef struct iwffff_xlfo iwffff_xlfo_t; -typedef struct iwffff_xenv_point iwffff_xenv_point_t; -typedef struct iwffff_xenv_record iwffff_xenv_record_t; -typedef struct iwffff_xenv iwffff_xenv_t; -typedef struct iwffff_xlayer iwffff_xlayer_t; -typedef struct iwffff_xinstrument iwffff_xinstrument_t; -typedef struct iwffff_rom_header iwffff_rom_header_t; -typedef struct iwffff_info iwffff_info_t; - -#endif /* __SOUND_AINSTR_IW_H */ diff --git a/include/sound/ainstr_simple.h b/include/sound/ainstr_simple.h deleted file mode 100644 index da08e7287557..000000000000 --- a/include/sound/ainstr_simple.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Advanced Linux Sound Architecture - * - * Simple (MOD player) Instrument Format - * Copyright (c) 1994-99 by Jaroslav Kysela - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef __SOUND_AINSTR_SIMPLE_H -#define __SOUND_AINSTR_SIMPLE_H - -#ifndef __KERNEL__ -#include -#include -#endif - -/* - * share types (share ID 1) - */ - -#define SIMPLE_SHARE_FILE 0 - -/* - * wave formats - */ - -#define SIMPLE_WAVE_16BIT 0x0001 /* 16-bit wave */ -#define SIMPLE_WAVE_UNSIGNED 0x0002 /* unsigned wave */ -#define SIMPLE_WAVE_INVERT 0x0002 /* same as unsigned wave */ -#define SIMPLE_WAVE_BACKWARD 0x0004 /* backward mode (maybe used for reverb or ping-ping loop) */ -#define SIMPLE_WAVE_LOOP 0x0008 /* loop mode */ -#define SIMPLE_WAVE_BIDIR 0x0010 /* bidirectional mode */ -#define SIMPLE_WAVE_STEREO 0x0100 /* stereo wave */ -#define SIMPLE_WAVE_ULAW 0x0200 /* uLaw compression mode */ - -/* - * instrument effects - */ - -#define SIMPLE_EFFECT_NONE 0 -#define SIMPLE_EFFECT_REVERB 1 -#define SIMPLE_EFFECT_CHORUS 2 -#define SIMPLE_EFFECT_ECHO 3 - -/* - * instrument info - */ - -struct simple_instrument_info { - unsigned int format; /* supported format bits */ - unsigned int effects; /* supported effects (1 << SIMPLE_EFFECT_*) */ - unsigned int max8_len; /* maximum 8-bit wave length */ - unsigned int max16_len; /* maximum 16-bit wave length */ -}; - -/* - * Instrument - */ - -struct simple_instrument { - unsigned int share_id[4]; /* share id - zero = no sharing */ - unsigned int format; /* wave format */ - - struct { - unsigned int number; /* some other ID for this instrument */ - unsigned int memory; /* begin of waveform in onboard memory */ - unsigned char *ptr; /* pointer to waveform in system memory */ - } address; - - unsigned int size; /* size of waveform in samples */ - unsigned int start; /* start offset in samples * 16 (lowest 4 bits - fraction) */ - unsigned int loop_start; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */ - unsigned int loop_end; /* loop end offset in samples * 16 (lowest 4 bits - fraction) */ - unsigned short loop_repeat; /* loop repeat - 0 = forever */ - - unsigned char effect1; /* effect 1 */ - unsigned char effect1_depth; /* 0-127 */ - unsigned char effect2; /* effect 2 */ - unsigned char effect2_depth; /* 0-127 */ -}; - -/* - * - * Kernel <-> user space - * Hardware (CPU) independent section - * - * * = zero or more - * + = one or more - * - * simple_xinstrument SIMPLE_STRU_INSTR - * - */ - -#define SIMPLE_STRU_INSTR __cpu_to_be32(('I'<<24)|('N'<<16)|('S'<<8)|'T') - -/* - * Instrument - */ - -struct simple_xinstrument { - __u32 stype; - - __u32 share_id[4]; /* share id - zero = no sharing */ - __u32 format; /* wave format */ - - __u32 size; /* size of waveform in samples */ - __u32 start; /* start offset in samples * 16 (lowest 4 bits - fraction) */ - __u32 loop_start; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */ - __u32 loop_end; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */ - __u16 loop_repeat; /* loop repeat - 0 = forever */ - - __u8 effect1; /* effect 1 */ - __u8 effect1_depth; /* 0-127 */ - __u8 effect2; /* effect 2 */ - __u8 effect2_depth; /* 0-127 */ -}; - -#ifdef __KERNEL__ - -#include "seq_instr.h" - -struct snd_simple_ops { - void *private_data; - int (*info)(void *private_data, struct simple_instrument_info *info); - int (*put_sample)(void *private_data, struct simple_instrument *instr, - char __user *data, long len, int atomic); - int (*get_sample)(void *private_data, struct simple_instrument *instr, - char __user *data, long len, int atomic); - int (*remove_sample)(void *private_data, struct simple_instrument *instr, - int atomic); - void (*notify)(void *private_data, struct snd_seq_kinstr *instr, int what); - struct snd_seq_kinstr_ops kops; -}; - -int snd_seq_simple_init(struct snd_simple_ops *ops, - void *private_data, - struct snd_seq_kinstr_ops *next); - -#endif - -/* typedefs for compatibility to user-space */ -typedef struct simple_xinstrument simple_xinstrument_t; - -#endif /* __SOUND_AINSTR_SIMPLE_H */ diff --git a/include/sound/asequencer.h b/include/sound/asequencer.h index 64daccbe8b29..1505e6d5ef82 100644 --- a/include/sound/asequencer.h +++ b/include/sound/asequencer.h @@ -110,18 +110,7 @@ #define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */ #define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */ -/** synthesizer events - * event data type = snd_seq_eve_sample_control - */ -#define SNDRV_SEQ_EVENT_SAMPLE 70 /* sample select */ -#define SNDRV_SEQ_EVENT_SAMPLE_CLUSTER 71 /* sample cluster select */ -#define SNDRV_SEQ_EVENT_SAMPLE_START 72 /* voice start */ -#define SNDRV_SEQ_EVENT_SAMPLE_STOP 73 /* voice stop */ -#define SNDRV_SEQ_EVENT_SAMPLE_FREQ 74 /* playback frequency */ -#define SNDRV_SEQ_EVENT_SAMPLE_VOLUME 75 /* volume and balance */ -#define SNDRV_SEQ_EVENT_SAMPLE_LOOP 76 /* sample loop */ -#define SNDRV_SEQ_EVENT_SAMPLE_POSITION 77 /* sample position */ -#define SNDRV_SEQ_EVENT_SAMPLE_PRIVATE1 78 /* private (hardware dependent) event */ +/* 70-89: synthesizer events - obsoleted */ /** user-defined events with fixed length * event data type = any @@ -137,28 +126,7 @@ #define SNDRV_SEQ_EVENT_USR8 98 #define SNDRV_SEQ_EVENT_USR9 99 -/** instrument layer - * variable length data can be passed directly to the driver - */ -#define SNDRV_SEQ_EVENT_INSTR_BEGIN 100 /* begin of instrument management */ -#define SNDRV_SEQ_EVENT_INSTR_END 101 /* end of instrument management */ -#define SNDRV_SEQ_EVENT_INSTR_INFO 102 /* instrument interface info */ -#define SNDRV_SEQ_EVENT_INSTR_INFO_RESULT 103 /* result */ -#define SNDRV_SEQ_EVENT_INSTR_FINFO 104 /* get format info */ -#define SNDRV_SEQ_EVENT_INSTR_FINFO_RESULT 105 /* get format info */ -#define SNDRV_SEQ_EVENT_INSTR_RESET 106 /* reset instrument memory */ -#define SNDRV_SEQ_EVENT_INSTR_STATUS 107 /* instrument interface status */ -#define SNDRV_SEQ_EVENT_INSTR_STATUS_RESULT 108 /* result */ -#define SNDRV_SEQ_EVENT_INSTR_PUT 109 /* put instrument to port */ -#define SNDRV_SEQ_EVENT_INSTR_GET 110 /* get instrument from port */ -#define SNDRV_SEQ_EVENT_INSTR_GET_RESULT 111 /* result */ -#define SNDRV_SEQ_EVENT_INSTR_FREE 112 /* free instrument(s) */ -#define SNDRV_SEQ_EVENT_INSTR_LIST 113 /* instrument list */ -#define SNDRV_SEQ_EVENT_INSTR_LIST_RESULT 114 /* result */ -#define SNDRV_SEQ_EVENT_INSTR_CLUSTER 115 /* cluster parameters */ -#define SNDRV_SEQ_EVENT_INSTR_CLUSTER_GET 116 /* get cluster parameters */ -#define SNDRV_SEQ_EVENT_INSTR_CLUSTER_RESULT 117 /* result */ -#define SNDRV_SEQ_EVENT_INSTR_CHANGE 118 /* instrument change */ +/* 100-118: instrument layer - obsoleted */ /* 119-129: reserved */ /* 130-139: variable length events @@ -258,78 +226,6 @@ struct snd_seq_ev_ext { void *ptr; /* pointer to data (note: maybe 64-bit) */ } __attribute__((packed)); -/* Instrument cluster type */ -typedef unsigned int snd_seq_instr_cluster_t; - -/* Instrument type */ -struct snd_seq_instr { - snd_seq_instr_cluster_t cluster; - unsigned int std; /* the upper byte means a private instrument (owner - client #) */ - unsigned short bank; - unsigned short prg; -}; - - /* sample number */ -struct snd_seq_ev_sample { - unsigned int std; - unsigned short bank; - unsigned short prg; -}; - - /* sample cluster */ -struct snd_seq_ev_cluster { - snd_seq_instr_cluster_t cluster; -}; - - /* sample position */ -typedef unsigned int snd_seq_position_t; /* playback position (in samples) * 16 */ - - /* sample stop mode */ -enum { - SAMPLE_STOP_IMMEDIATELY = 0, /* terminate playing immediately */ - SAMPLE_STOP_VENVELOPE = 1, /* finish volume envelope */ - SAMPLE_STOP_LOOP = 2 /* terminate loop and finish wave */ -}; - - /* sample frequency */ -typedef int snd_seq_frequency_t; /* playback frequency in HZ * 16 */ - - /* sample volume control; if any value is set to -1 == do not change */ -struct snd_seq_ev_volume { - signed short volume; /* range: 0-16383 */ - signed short lr; /* left-right balance; range: 0-16383 */ - signed short fr; /* front-rear balance; range: 0-16383 */ - signed short du; /* down-up balance; range: 0-16383 */ -}; - - /* simple loop redefinition */ -struct snd_seq_ev_loop { - unsigned int start; /* loop start (in samples) * 16 */ - unsigned int end; /* loop end (in samples) * 16 */ -}; - -struct snd_seq_ev_sample_control { - unsigned char channel; - unsigned char unused1, unused2, unused3; /* pad */ - union { - struct snd_seq_ev_sample sample; - struct snd_seq_ev_cluster cluster; - snd_seq_position_t position; - int stop_mode; - snd_seq_frequency_t frequency; - struct snd_seq_ev_volume volume; - struct snd_seq_ev_loop loop; - unsigned char raw8[8]; - } param; -}; - - - -/* INSTR_BEGIN event */ -struct snd_seq_ev_instr_begin { - int timeout; /* zero = forever, otherwise timeout in ms */ -}; - struct snd_seq_result { int event; /* processed event type */ int result; @@ -399,8 +295,6 @@ struct snd_seq_event { struct snd_seq_addr addr; struct snd_seq_connect connect; struct snd_seq_result result; - struct snd_seq_ev_instr_begin instr_begin; - struct snd_seq_ev_sample_control sample; struct snd_seq_ev_quote quote; } data; }; @@ -441,8 +335,6 @@ struct snd_seq_event_bounce { #define snd_seq_ev_is_user_type(ev) ((ev)->type >= 90 && (ev)->type < 99) /* fixed length events: 0-99 */ #define snd_seq_ev_is_fixed_type(ev) ((ev)->type < 100) -/* instrument layer events: 100-129 */ -#define snd_seq_ev_is_instr_type(ev) ((ev)->type >= 100 && (ev)->type < 130) /* variable length events: 130-139 */ #define snd_seq_ev_is_variable_type(ev) ((ev)->type >= 130 && (ev)->type < 140) /* reserved for kernel */ @@ -737,136 +629,6 @@ struct snd_seq_query_subs { }; -/* - * Instrument abstraction layer - * - based on events - */ - -/* instrument types */ -#define SNDRV_SEQ_INSTR_ATYPE_DATA 0 /* instrument data */ -#define SNDRV_SEQ_INSTR_ATYPE_ALIAS 1 /* instrument alias */ - -/* instrument ASCII identifiers */ -#define SNDRV_SEQ_INSTR_ID_DLS1 "DLS1" -#define SNDRV_SEQ_INSTR_ID_DLS2 "DLS2" -#define SNDRV_SEQ_INSTR_ID_SIMPLE "Simple Wave" -#define SNDRV_SEQ_INSTR_ID_SOUNDFONT "SoundFont" -#define SNDRV_SEQ_INSTR_ID_GUS_PATCH "GUS Patch" -#define SNDRV_SEQ_INSTR_ID_INTERWAVE "InterWave FFFF" -#define SNDRV_SEQ_INSTR_ID_OPL2_3 "OPL2/3 FM" -#define SNDRV_SEQ_INSTR_ID_OPL4 "OPL4" - -/* instrument types */ -#define SNDRV_SEQ_INSTR_TYPE0_DLS1 (1<<0) /* MIDI DLS v1 */ -#define SNDRV_SEQ_INSTR_TYPE0_DLS2 (1<<1) /* MIDI DLS v2 */ -#define SNDRV_SEQ_INSTR_TYPE1_SIMPLE (1<<0) /* Simple Wave */ -#define SNDRV_SEQ_INSTR_TYPE1_SOUNDFONT (1<<1) /* EMU SoundFont */ -#define SNDRV_SEQ_INSTR_TYPE1_GUS_PATCH (1<<2) /* Gravis UltraSound Patch */ -#define SNDRV_SEQ_INSTR_TYPE1_INTERWAVE (1<<3) /* InterWave FFFF */ -#define SNDRV_SEQ_INSTR_TYPE2_OPL2_3 (1<<0) /* Yamaha OPL2/3 FM */ -#define SNDRV_SEQ_INSTR_TYPE2_OPL4 (1<<1) /* Yamaha OPL4 */ - -/* put commands */ -#define SNDRV_SEQ_INSTR_PUT_CMD_CREATE 0 -#define SNDRV_SEQ_INSTR_PUT_CMD_REPLACE 1 -#define SNDRV_SEQ_INSTR_PUT_CMD_MODIFY 2 -#define SNDRV_SEQ_INSTR_PUT_CMD_ADD 3 -#define SNDRV_SEQ_INSTR_PUT_CMD_REMOVE 4 - -/* get commands */ -#define SNDRV_SEQ_INSTR_GET_CMD_FULL 0 -#define SNDRV_SEQ_INSTR_GET_CMD_PARTIAL 1 - -/* query flags */ -#define SNDRV_SEQ_INSTR_QUERY_FOLLOW_ALIAS (1<<0) - -/* free commands */ -#define SNDRV_SEQ_INSTR_FREE_CMD_ALL 0 -#define SNDRV_SEQ_INSTR_FREE_CMD_PRIVATE 1 -#define SNDRV_SEQ_INSTR_FREE_CMD_CLUSTER 2 -#define SNDRV_SEQ_INSTR_FREE_CMD_SINGLE 3 - -/* size of ROM/RAM */ -typedef unsigned int snd_seq_instr_size_t; - -/* INSTR_INFO */ - -struct snd_seq_instr_info { - int result; /* operation result */ - unsigned int formats[8]; /* bitmap of supported formats */ - int ram_count; /* count of RAM banks */ - snd_seq_instr_size_t ram_sizes[16]; /* size of RAM banks */ - int rom_count; /* count of ROM banks */ - snd_seq_instr_size_t rom_sizes[8]; /* size of ROM banks */ - char reserved[128]; -}; - -/* INSTR_STATUS */ - -struct snd_seq_instr_status { - int result; /* operation result */ - snd_seq_instr_size_t free_ram[16]; /* free RAM in banks */ - int instrument_count; /* count of downloaded instruments */ - char reserved[128]; -}; - -/* INSTR_FORMAT_INFO */ - -struct snd_seq_instr_format_info { - char format[16]; /* format identifier - SNDRV_SEQ_INSTR_ID_* */ - unsigned int len; /* max data length (without this structure) */ -}; - -struct snd_seq_instr_format_info_result { - int result; /* operation result */ - char format[16]; /* format identifier */ - unsigned int len; /* filled data length (without this structure) */ -}; - -/* instrument data */ -struct snd_seq_instr_data { - char name[32]; /* instrument name */ - char reserved[16]; /* for the future use */ - int type; /* instrument type */ - union { - char format[16]; /* format identifier */ - struct snd_seq_instr alias; - } data; -}; - -/* INSTR_PUT/GET, data are stored in one block (extended), header + data */ - -struct snd_seq_instr_header { - union { - struct snd_seq_instr instr; - snd_seq_instr_cluster_t cluster; - } id; /* instrument identifier */ - unsigned int cmd; /* get/put/free command */ - unsigned int flags; /* query flags (only for get) */ - unsigned int len; /* real instrument data length (without header) */ - int result; /* operation result */ - char reserved[16]; /* for the future */ - struct snd_seq_instr_data data; /* instrument data (for put/get result) */ -}; - -/* INSTR_CLUSTER_SET */ - -struct snd_seq_instr_cluster_set { - snd_seq_instr_cluster_t cluster; /* cluster identifier */ - char name[32]; /* cluster name */ - int priority; /* cluster priority */ - char reserved[64]; /* for the future use */ -}; - -/* INSTR_CLUSTER_GET */ - -struct snd_seq_instr_cluster_get { - snd_seq_instr_cluster_t cluster; /* cluster identifier */ - char name[32]; /* cluster name */ - int priority; /* cluster priority */ - char reserved[64]; /* for the future use */ -}; - /* * IOCTL commands */ diff --git a/include/sound/gus.h b/include/sound/gus.h index e5433d8b78bc..841bb8df38c1 100644 --- a/include/sound/gus.h +++ b/include/sound/gus.h @@ -27,13 +27,8 @@ #include "timer.h" #include "seq_midi_emul.h" #include "seq_device.h" -#include "ainstr_iw.h" -#include "ainstr_gf1.h" -#include "ainstr_simple.h" #include -#define SNDRV_SEQ_DEV_ID_GUS "gus-synth" - /* IO ports */ #define GUSP(gus, x) ((gus)->gf1.port + SNDRV_g_u_s_##x) @@ -234,16 +229,6 @@ struct snd_gus_port { struct snd_gus_voice; -struct snd_gus_sample_ops { - void (*sample_start)(struct snd_gus_card *gus, struct snd_gus_voice *voice, snd_seq_position_t position); - void (*sample_stop)(struct snd_gus_card *gus, struct snd_gus_voice *voice, int mode); - void (*sample_freq)(struct snd_gus_card *gus, struct snd_gus_voice *voice, snd_seq_frequency_t freq); - void (*sample_volume)(struct snd_gus_card *gus, struct snd_gus_voice *voice, struct snd_seq_ev_volume *volume); - void (*sample_loop)(struct snd_gus_card *card, struct snd_gus_voice *voice, struct snd_seq_ev_loop *loop); - void (*sample_pos)(struct snd_gus_card *card, struct snd_gus_voice *voice, snd_seq_position_t position); - void (*sample_private1)(struct snd_gus_card *card, struct snd_gus_voice *voice, unsigned char *data); -}; - #define SNDRV_GF1_VOICE_TYPE_PCM 0 #define SNDRV_GF1_VOICE_TYPE_SYNTH 1 #define SNDRV_GF1_VOICE_TYPE_MIDI 2 @@ -284,12 +269,8 @@ struct snd_gus_voice { struct snd_gus_sample_ops *sample_ops; - struct snd_seq_instr instr; - /* running status / registers */ - struct snd_seq_ev_volume sample_volume; - unsigned short fc_register; unsigned short fc_lfo; unsigned short gf1_volume; @@ -382,10 +363,6 @@ struct snd_gf1 { int seq_client; struct snd_gus_port seq_ports[4]; - struct snd_seq_kinstr_list *ilist; - struct snd_iwffff_ops iwffff_ops; - struct snd_gf1_ops gf1_ops; - struct snd_simple_ops simple_ops; /* timer */ @@ -458,8 +435,6 @@ struct snd_gus_card { struct snd_rawmidi_substream *midi_substream_output; struct snd_rawmidi_substream *midi_substream_input; - struct snd_seq_device *seq_dev; - spinlock_t reg_lock; spinlock_t voice_alloc; spinlock_t active_voice_lock; @@ -647,48 +622,10 @@ void snd_gus_irq_profile_init(struct snd_gus_card *gus); int snd_gf1_rawmidi_new(struct snd_gus_card * gus, int device, struct snd_rawmidi **rrawmidi); -#if 0 -extern void snd_engine_instrument_register(unsigned short mode, - struct _SND_INSTRUMENT_VOICE_COMMANDS *voice_cmds, - struct _SND_INSTRUMENT_NOTE_COMMANDS *note_cmds, - struct _SND_INSTRUMENT_CHANNEL_COMMANDS *channel_cmds); -extern int snd_engine_instrument_register_ask(unsigned short mode); -#endif - /* gus_dram.c */ int snd_gus_dram_write(struct snd_gus_card *gus, char __user *ptr, unsigned int addr, unsigned int size); int snd_gus_dram_read(struct snd_gus_card *gus, char __user *ptr, unsigned int addr, unsigned int size, int rom); -#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE) - -/* gus_sample.c */ -void snd_gus_sample_event(struct snd_seq_event *ev, struct snd_gus_port *p); - -/* gus_simple.c */ -void snd_gf1_simple_init(struct snd_gus_voice *voice); - -/* gus_instr.c */ -int snd_gus_iwffff_put_sample(void *private_data, struct iwffff_wave *wave, - char __user *data, long len, int atomic); -int snd_gus_iwffff_get_sample(void *private_data, struct iwffff_wave *wave, - char __user *data, long len, int atomic); -int snd_gus_iwffff_remove_sample(void *private_data, struct iwffff_wave *wave, - int atomic); -int snd_gus_gf1_put_sample(void *private_data, struct gf1_wave *wave, - char __user *data, long len, int atomic); -int snd_gus_gf1_get_sample(void *private_data, struct gf1_wave *wave, - char __user *data, long len, int atomic); -int snd_gus_gf1_remove_sample(void *private_data, struct gf1_wave *wave, - int atomic); -int snd_gus_simple_put_sample(void *private_data, struct simple_instrument *instr, - char __user *data, long len, int atomic); -int snd_gus_simple_get_sample(void *private_data, struct simple_instrument *instr, - char __user *data, long len, int atomic); -int snd_gus_simple_remove_sample(void *private_data, struct simple_instrument *instr, - int atomic); - -#endif /* CONFIG_SND_SEQUENCER */ - #endif /* __SOUND_GUS_H */ diff --git a/include/sound/seq_instr.h b/include/sound/seq_instr.h deleted file mode 100644 index 93b0c51df5b0..000000000000 --- a/include/sound/seq_instr.h +++ /dev/null @@ -1,110 +0,0 @@ -#ifndef __SOUND_SEQ_INSTR_H -#define __SOUND_SEQ_INSTR_H - -/* - * Main kernel header file for the ALSA sequencer - * Copyright (c) 1999 by Jaroslav Kysela - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -#include "seq_kernel.h" - -/* Instrument cluster */ -struct snd_seq_kcluster { - snd_seq_instr_cluster_t cluster; - char name[32]; - int priority; - struct snd_seq_kcluster *next; -}; - -/* return pointer to private data */ -#define KINSTR_DATA(kinstr) (void *)(((char *)kinstr) + sizeof(struct snd_seq_kinstr)) - -/* Instrument structure */ -struct snd_seq_kinstr { - struct snd_seq_instr instr; - char name[32]; - int type; /* instrument type */ - int use; /* use count */ - int busy; /* not useable */ - int add_len; /* additional length */ - struct snd_seq_kinstr_ops *ops; /* operations */ - struct snd_seq_kinstr *next; -}; - -#define SNDRV_SEQ_INSTR_HASH_SIZE 32 - -/* Instrument flags */ -#define SNDRV_SEQ_INSTR_FLG_DIRECT (1<<0) /* accept only direct events */ - -/* List of all instruments */ -struct snd_seq_kinstr_list { - struct snd_seq_kinstr *hash[SNDRV_SEQ_INSTR_HASH_SIZE]; - int count; /* count of all instruments */ - - struct snd_seq_kcluster *chash[SNDRV_SEQ_INSTR_HASH_SIZE]; - int ccount; /* count of all clusters */ - - int owner; /* current owner of the instrument list */ - unsigned int flags; - - spinlock_t lock; - spinlock_t ops_lock; - struct mutex ops_mutex; - unsigned long ops_flags; -}; - -#define SNDRV_SEQ_INSTR_NOTIFY_REMOVE 0 -#define SNDRV_SEQ_INSTR_NOTIFY_CHANGE 1 - -struct snd_seq_kinstr_ops { - void *private_data; - long add_len; /* additional length */ - char *instr_type; - int (*info)(void *private_data, char *info_data, long len); - int (*put)(void *private_data, struct snd_seq_kinstr *kinstr, - char __user *instr_data, long len, int atomic, int cmd); - int (*get)(void *private_data, struct snd_seq_kinstr *kinstr, - char __user *instr_data, long len, int atomic, int cmd); - int (*get_size)(void *private_data, struct snd_seq_kinstr *kinstr, long *size); - int (*remove)(void *private_data, struct snd_seq_kinstr *kinstr, int atomic); - void (*notify)(void *private_data, struct snd_seq_kinstr *kinstr, int what); - struct snd_seq_kinstr_ops *next; -}; - - -/* instrument operations */ -struct snd_seq_kinstr_list *snd_seq_instr_list_new(void); -void snd_seq_instr_list_free(struct snd_seq_kinstr_list **list); -int snd_seq_instr_list_free_cond(struct snd_seq_kinstr_list *list, - struct snd_seq_instr_header *ifree, - int client, - int atomic); -struct snd_seq_kinstr *snd_seq_instr_find(struct snd_seq_kinstr_list *list, - struct snd_seq_instr *instr, - int exact, - int follow_alias); -void snd_seq_instr_free_use(struct snd_seq_kinstr_list *list, - struct snd_seq_kinstr *instr); -int snd_seq_instr_event(struct snd_seq_kinstr_ops *ops, - struct snd_seq_kinstr_list *list, - struct snd_seq_event *ev, - int client, - int atomic, - int hop); - -#endif /* __SOUND_SEQ_INSTR_H */ diff --git a/include/sound/trident.h b/include/sound/trident.h index 9752243241e5..9f191a0a1e19 100644 --- a/include/sound/trident.h +++ b/include/sound/trident.h @@ -26,19 +26,12 @@ #include "pcm.h" #include "mpu401.h" #include "ac97_codec.h" -#include "seq_midi_emul.h" -#include "seq_device.h" #include "util_mem.h" -//#include "ainstr_iw.h" -//#include "ainstr_gf1.h" -#include "ainstr_simple.h" #define TRIDENT_DEVICE_ID_DX ((PCI_VENDOR_ID_TRIDENT<<16)|PCI_DEVICE_ID_TRIDENT_4DWAVE_DX) #define TRIDENT_DEVICE_ID_NX ((PCI_VENDOR_ID_TRIDENT<<16)|PCI_DEVICE_ID_TRIDENT_4DWAVE_NX) #define TRIDENT_DEVICE_ID_SI7018 ((PCI_VENDOR_ID_SI<<16)|PCI_DEVICE_ID_SI_7018) -#define SNDRV_SEQ_DEV_ID_TRIDENT "trident-synth" - #define SNDRV_TRIDENT_VOICE_TYPE_PCM 0 #define SNDRV_TRIDENT_VOICE_TYPE_SYNTH 1 #define SNDRV_TRIDENT_VOICE_TYPE_MIDI 2 @@ -257,16 +250,6 @@ struct snd_trident; struct snd_trident_voice; struct snd_trident_pcm_mixer; -struct snd_trident_sample_ops { - void (*sample_start)(struct snd_trident *gus, struct snd_trident_voice *voice, snd_seq_position_t position); - void (*sample_stop)(struct snd_trident *gus, struct snd_trident_voice *voice, int mode); - void (*sample_freq)(struct snd_trident *gus, struct snd_trident_voice *voice, snd_seq_frequency_t freq); - void (*sample_volume)(struct snd_trident *gus, struct snd_trident_voice *voice, struct snd_seq_ev_volume *volume); - void (*sample_loop)(struct snd_trident *card, struct snd_trident_voice *voice, struct snd_seq_ev_loop *loop); - void (*sample_pos)(struct snd_trident *card, struct snd_trident_voice *voice, snd_seq_position_t position); - void (*sample_private1)(struct snd_trident *card, struct snd_trident_voice *voice, unsigned char *data); -}; - struct snd_trident_port { struct snd_midi_channel_set * chset; struct snd_trident * trident; @@ -300,7 +283,6 @@ struct snd_trident_voice { unsigned char port; unsigned char index; - struct snd_seq_instr instr; struct snd_trident_sample_ops *sample_ops; /* channel parameters */ @@ -354,9 +336,6 @@ struct snd_4dwave { int seq_client; struct snd_trident_port seq_ports[4]; - struct snd_simple_ops simple_ops; - struct snd_seq_kinstr_list *ilist; - struct snd_trident_voice voices[64]; int ChanSynthCount; /* number of allocated synth channels */ @@ -416,7 +395,6 @@ struct snd_trident { struct snd_pcm *foldback; /* Foldback PCM */ struct snd_pcm *spdif; /* SPDIF PCM */ struct snd_rawmidi *rmidi; - struct snd_seq_device *seq_dev; struct snd_ac97_bus *ac97_bus; struct snd_ac97 *ac97; diff --git a/sound/core/seq/Makefile b/sound/core/seq/Makefile index ceef14afee30..069593717fba 100644 --- a/sound/core/seq/Makefile +++ b/sound/core/seq/Makefile @@ -3,7 +3,6 @@ # Copyright (c) 1999 by Jaroslav Kysela # -obj-$(CONFIG_SND) += instr/ ifeq ($(CONFIG_SND_SEQUENCER_OSS),y) obj-$(CONFIG_SND_SEQUENCER) += oss/ endif @@ -15,7 +14,6 @@ snd-seq-objs := seq.o seq_lock.o seq_clientmgr.o seq_memory.o seq_queue.o \ snd-seq-midi-objs := seq_midi.o snd-seq-midi-emul-objs := seq_midi_emul.o snd-seq-midi-event-objs := seq_midi_event.o -snd-seq-instr-objs := seq_instr.o snd-seq-dummy-objs := seq_dummy.o snd-seq-virmidi-objs := seq_virmidi.o @@ -36,9 +34,7 @@ obj-$(CONFIG_SND_SEQ_DUMMY) += snd-seq-dummy.o # Toplevel Module Dependency obj-$(CONFIG_SND_VIRMIDI) += snd-seq-virmidi.o snd-seq-midi-event.o obj-$(call sequencer,$(CONFIG_SND_RAWMIDI)) += snd-seq-midi.o snd-seq-midi-event.o -obj-$(call sequencer,$(CONFIG_SND_OPL3_LIB)) += snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o -obj-$(call sequencer,$(CONFIG_SND_OPL4_LIB)) += snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o -obj-$(call sequencer,$(CONFIG_SND_GUS_SYNTH)) += snd-seq-midi-emul.o snd-seq-instr.o +obj-$(call sequencer,$(CONFIG_SND_OPL3_LIB)) += snd-seq-midi-event.o snd-seq-midi-emul.o +obj-$(call sequencer,$(CONFIG_SND_OPL4_LIB)) += snd-seq-midi-event.o snd-seq-midi-emul.o obj-$(call sequencer,$(CONFIG_SND_SBAWE)) += snd-seq-midi-emul.o snd-seq-virmidi.o obj-$(call sequencer,$(CONFIG_SND_EMU10K1)) += snd-seq-midi-emul.o snd-seq-virmidi.o -obj-$(call sequencer,$(CONFIG_SND_TRIDENT)) += snd-seq-midi-emul.o snd-seq-instr.o diff --git a/sound/core/seq/instr/Makefile b/sound/core/seq/instr/Makefile deleted file mode 100644 index 608960364813..000000000000 --- a/sound/core/seq/instr/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -# -# Makefile for ALSA -# Copyright (c) 1999 by Jaroslav Kysela -# - -snd-ainstr-fm-objs := ainstr_fm.o -snd-ainstr-simple-objs := ainstr_simple.o -snd-ainstr-gf1-objs := ainstr_gf1.o -snd-ainstr-iw-objs := ainstr_iw.o - -# -# this function returns: -# "m" - CONFIG_SND_SEQUENCER is m -# - CONFIG_SND_SEQUENCER is undefined -# otherwise parameter #1 value -# -sequencer = $(if $(subst y,,$(CONFIG_SND_SEQUENCER)),$(if $(1),m),$(if $(CONFIG_SND_SEQUENCER),$(1))) - -# Toplevel Module Dependency -obj-$(call sequencer,$(CONFIG_SND_OPL3_LIB)) += snd-ainstr-fm.o -obj-$(call sequencer,$(CONFIG_SND_OPL4_LIB)) += snd-ainstr-fm.o -obj-$(call sequencer,$(CONFIG_SND_GUS_SYNTH)) += snd-ainstr-gf1.o snd-ainstr-simple.o snd-ainstr-iw.o -obj-$(call sequencer,$(CONFIG_SND_TRIDENT)) += snd-ainstr-simple.o diff --git a/sound/core/seq/instr/ainstr_fm.c b/sound/core/seq/instr/ainstr_fm.c deleted file mode 100644 index f80fab8f2ed1..000000000000 --- a/sound/core/seq/instr/ainstr_fm.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - * FM (OPL2/3) Instrument routines - * Copyright (c) 2000 Uros Bizjak - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include -#include -#include -#include -#include -#include - -MODULE_AUTHOR("Uros Bizjak "); -MODULE_DESCRIPTION("Advanced Linux Sound Architecture FM Instrument support."); -MODULE_LICENSE("GPL"); - -static int snd_seq_fm_put(void *private_data, struct snd_seq_kinstr *instr, - char __user *instr_data, long len, int atomic, int cmd) -{ - struct fm_instrument *ip; - struct fm_xinstrument ix; - int idx; - - if (cmd != SNDRV_SEQ_INSTR_PUT_CMD_CREATE) - return -EINVAL; - /* copy instrument data */ - if (len < (long)sizeof(ix)) - return -EINVAL; - if (copy_from_user(&ix, instr_data, sizeof(ix))) - return -EFAULT; - if (ix.stype != FM_STRU_INSTR) - return -EINVAL; - ip = (struct fm_instrument *)KINSTR_DATA(instr); - ip->share_id[0] = le32_to_cpu(ix.share_id[0]); - ip->share_id[1] = le32_to_cpu(ix.share_id[1]); - ip->share_id[2] = le32_to_cpu(ix.share_id[2]); - ip->share_id[3] = le32_to_cpu(ix.share_id[3]); - ip->type = ix.type; - for (idx = 0; idx < 4; idx++) { - ip->op[idx].am_vib = ix.op[idx].am_vib; - ip->op[idx].ksl_level = ix.op[idx].ksl_level; - ip->op[idx].attack_decay = ix.op[idx].attack_decay; - ip->op[idx].sustain_release = ix.op[idx].sustain_release; - ip->op[idx].wave_select = ix.op[idx].wave_select; - } - for (idx = 0; idx < 2; idx++) { - ip->feedback_connection[idx] = ix.feedback_connection[idx]; - } - ip->echo_delay = ix.echo_delay; - ip->echo_atten = ix.echo_atten; - ip->chorus_spread = ix.chorus_spread; - ip->trnsps = ix.trnsps; - ip->fix_dur = ix.fix_dur; - ip->modes = ix.modes; - ip->fix_key = ix.fix_key; - return 0; -} - -static int snd_seq_fm_get(void *private_data, struct snd_seq_kinstr *instr, - char __user *instr_data, long len, int atomic, - int cmd) -{ - struct fm_instrument *ip; - struct fm_xinstrument ix; - int idx; - - if (cmd != SNDRV_SEQ_INSTR_GET_CMD_FULL) - return -EINVAL; - if (len < (long)sizeof(ix)) - return -ENOMEM; - memset(&ix, 0, sizeof(ix)); - ip = (struct fm_instrument *)KINSTR_DATA(instr); - ix.stype = FM_STRU_INSTR; - ix.share_id[0] = cpu_to_le32(ip->share_id[0]); - ix.share_id[1] = cpu_to_le32(ip->share_id[1]); - ix.share_id[2] = cpu_to_le32(ip->share_id[2]); - ix.share_id[3] = cpu_to_le32(ip->share_id[3]); - ix.type = ip->type; - for (idx = 0; idx < 4; idx++) { - ix.op[idx].am_vib = ip->op[idx].am_vib; - ix.op[idx].ksl_level = ip->op[idx].ksl_level; - ix.op[idx].attack_decay = ip->op[idx].attack_decay; - ix.op[idx].sustain_release = ip->op[idx].sustain_release; - ix.op[idx].wave_select = ip->op[idx].wave_select; - } - for (idx = 0; idx < 2; idx++) { - ix.feedback_connection[idx] = ip->feedback_connection[idx]; - } - if (copy_to_user(instr_data, &ix, sizeof(ix))) - return -EFAULT; - ix.echo_delay = ip->echo_delay; - ix.echo_atten = ip->echo_atten; - ix.chorus_spread = ip->chorus_spread; - ix.trnsps = ip->trnsps; - ix.fix_dur = ip->fix_dur; - ix.modes = ip->modes; - ix.fix_key = ip->fix_key; - return 0; -} - -static int snd_seq_fm_get_size(void *private_data, struct snd_seq_kinstr *instr, - long *size) -{ - *size = sizeof(struct fm_xinstrument); - return 0; -} - -int snd_seq_fm_init(struct snd_seq_kinstr_ops *ops, - struct snd_seq_kinstr_ops *next) -{ - memset(ops, 0, sizeof(*ops)); - // ops->private_data = private_data; - ops->add_len = sizeof(struct fm_instrument); - ops->instr_type = SNDRV_SEQ_INSTR_ID_OPL2_3; - ops->put = snd_seq_fm_put; - ops->get = snd_seq_fm_get; - ops->get_size = snd_seq_fm_get_size; - // ops->remove = snd_seq_fm_remove; - // ops->notify = snd_seq_fm_notify; - ops->next = next; - return 0; -} - -/* - * Init part - */ - -static int __init alsa_ainstr_fm_init(void) -{ - return 0; -} - -static void __exit alsa_ainstr_fm_exit(void) -{ -} - -module_init(alsa_ainstr_fm_init) -module_exit(alsa_ainstr_fm_exit) - -EXPORT_SYMBOL(snd_seq_fm_init); diff --git a/sound/core/seq/instr/ainstr_gf1.c b/sound/core/seq/instr/ainstr_gf1.c deleted file mode 100644 index 49400262b1eb..000000000000 --- a/sound/core/seq/instr/ainstr_gf1.c +++ /dev/null @@ -1,359 +0,0 @@ -/* - * GF1 (GUS) Patch - Instrument routines - * Copyright (c) 1999 by Jaroslav Kysela - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include -#include -#include -#include -#include -#include -#include - -MODULE_AUTHOR("Jaroslav Kysela "); -MODULE_DESCRIPTION("Advanced Linux Sound Architecture GF1 (GUS) Patch support."); -MODULE_LICENSE("GPL"); - -static unsigned int snd_seq_gf1_size(unsigned int size, unsigned int format) -{ - unsigned int result = size; - - if (format & GF1_WAVE_16BIT) - result <<= 1; - if (format & GF1_WAVE_STEREO) - result <<= 1; - return format; -} - -static int snd_seq_gf1_copy_wave_from_stream(struct snd_gf1_ops *ops, - struct gf1_instrument *ip, - char __user **data, - long *len, - int atomic) -{ - struct gf1_wave *wp, *prev; - struct gf1_xwave xp; - int err; - gfp_t gfp_mask; - unsigned int real_size; - - gfp_mask = atomic ? GFP_ATOMIC : GFP_KERNEL; - if (*len < (long)sizeof(xp)) - return -EINVAL; - if (copy_from_user(&xp, *data, sizeof(xp))) - return -EFAULT; - *data += sizeof(xp); - *len -= sizeof(xp); - wp = kzalloc(sizeof(*wp), gfp_mask); - if (wp == NULL) - return -ENOMEM; - wp->share_id[0] = le32_to_cpu(xp.share_id[0]); - wp->share_id[1] = le32_to_cpu(xp.share_id[1]); - wp->share_id[2] = le32_to_cpu(xp.share_id[2]); - wp->share_id[3] = le32_to_cpu(xp.share_id[3]); - wp->format = le32_to_cpu(xp.format); - wp->size = le32_to_cpu(xp.size); - wp->start = le32_to_cpu(xp.start); - wp->loop_start = le32_to_cpu(xp.loop_start); - wp->loop_end = le32_to_cpu(xp.loop_end); - wp->loop_repeat = le16_to_cpu(xp.loop_repeat); - wp->flags = xp.flags; - wp->sample_rate = le32_to_cpu(xp.sample_rate); - wp->low_frequency = le32_to_cpu(xp.low_frequency); - wp->high_frequency = le32_to_cpu(xp.high_frequency); - wp->root_frequency = le32_to_cpu(xp.root_frequency); - wp->tune = le16_to_cpu(xp.tune); - wp->balance = xp.balance; - memcpy(wp->envelope_rate, xp.envelope_rate, 6); - memcpy(wp->envelope_offset, xp.envelope_offset, 6); - wp->tremolo_sweep = xp.tremolo_sweep; - wp->tremolo_rate = xp.tremolo_rate; - wp->tremolo_depth = xp.tremolo_depth; - wp->vibrato_sweep = xp.vibrato_sweep; - wp->vibrato_rate = xp.vibrato_rate; - wp->vibrato_depth = xp.vibrato_depth; - wp->scale_frequency = le16_to_cpu(xp.scale_frequency); - wp->scale_factor = le16_to_cpu(xp.scale_factor); - real_size = snd_seq_gf1_size(wp->size, wp->format); - if ((long)real_size > *len) { - kfree(wp); - return -ENOMEM; - } - if (ops->put_sample) { - err = ops->put_sample(ops->private_data, wp, - *data, real_size, atomic); - if (err < 0) { - kfree(wp); - return err; - } - } - *data += real_size; - *len -= real_size; - prev = ip->wave; - if (prev) { - while (prev->next) prev = prev->next; - prev->next = wp; - } else { - ip->wave = wp; - } - return 0; -} - -static void snd_seq_gf1_wave_free(struct snd_gf1_ops *ops, - struct gf1_wave *wave, - int atomic) -{ - if (ops->remove_sample) - ops->remove_sample(ops->private_data, wave, atomic); - kfree(wave); -} - -static void snd_seq_gf1_instr_free(struct snd_gf1_ops *ops, - struct gf1_instrument *ip, - int atomic) -{ - struct gf1_wave *wave; - - while ((wave = ip->wave) != NULL) { - ip->wave = wave->next; - snd_seq_gf1_wave_free(ops, wave, atomic); - } -} - -static int snd_seq_gf1_put(void *private_data, struct snd_seq_kinstr *instr, - char __user *instr_data, long len, int atomic, - int cmd) -{ - struct snd_gf1_ops *ops = private_data; - struct gf1_instrument *ip; - struct gf1_xinstrument ix; - int err; - gfp_t gfp_mask; - - if (cmd != SNDRV_SEQ_INSTR_PUT_CMD_CREATE) - return -EINVAL; - gfp_mask = atomic ? GFP_ATOMIC : GFP_KERNEL; - /* copy instrument data */ - if (len < (long)sizeof(ix)) - return -EINVAL; - if (copy_from_user(&ix, instr_data, sizeof(ix))) - return -EFAULT; - if (ix.stype != GF1_STRU_INSTR) - return -EINVAL; - instr_data += sizeof(ix); - len -= sizeof(ix); - ip = (struct gf1_instrument *)KINSTR_DATA(instr); - ip->exclusion = le16_to_cpu(ix.exclusion); - ip->exclusion_group = le16_to_cpu(ix.exclusion_group); - ip->effect1 = ix.effect1; - ip->effect1_depth = ix.effect1_depth; - ip->effect2 = ix.effect2; - ip->effect2_depth = ix.effect2_depth; - /* copy layers */ - while (len > (long)sizeof(__u32)) { - __u32 stype; - - if (copy_from_user(&stype, instr_data, sizeof(stype))) - return -EFAULT; - if (stype != GF1_STRU_WAVE) { - snd_seq_gf1_instr_free(ops, ip, atomic); - return -EINVAL; - } - err = snd_seq_gf1_copy_wave_from_stream(ops, - ip, - &instr_data, - &len, - atomic); - if (err < 0) { - snd_seq_gf1_instr_free(ops, ip, atomic); - return err; - } - } - return 0; -} - -static int snd_seq_gf1_copy_wave_to_stream(struct snd_gf1_ops *ops, - struct gf1_instrument *ip, - char __user **data, - long *len, - int atomic) -{ - struct gf1_wave *wp; - struct gf1_xwave xp; - int err; - unsigned int real_size; - - for (wp = ip->wave; wp; wp = wp->next) { - if (*len < (long)sizeof(xp)) - return -ENOMEM; - memset(&xp, 0, sizeof(xp)); - xp.stype = GF1_STRU_WAVE; - xp.share_id[0] = cpu_to_le32(wp->share_id[0]); - xp.share_id[1] = cpu_to_le32(wp->share_id[1]); - xp.share_id[2] = cpu_to_le32(wp->share_id[2]); - xp.share_id[3] = cpu_to_le32(wp->share_id[3]); - xp.format = cpu_to_le32(wp->format); - xp.size = cpu_to_le32(wp->size); - xp.start = cpu_to_le32(wp->start); - xp.loop_start = cpu_to_le32(wp->loop_start); - xp.loop_end = cpu_to_le32(wp->loop_end); - xp.loop_repeat = cpu_to_le32(wp->loop_repeat); - xp.flags = wp->flags; - xp.sample_rate = cpu_to_le32(wp->sample_rate); - xp.low_frequency = cpu_to_le32(wp->low_frequency); - xp.high_frequency = cpu_to_le32(wp->high_frequency); - xp.root_frequency = cpu_to_le32(wp->root_frequency); - xp.tune = cpu_to_le16(wp->tune); - xp.balance = wp->balance; - memcpy(xp.envelope_rate, wp->envelope_rate, 6); - memcpy(xp.envelope_offset, wp->envelope_offset, 6); - xp.tremolo_sweep = wp->tremolo_sweep; - xp.tremolo_rate = wp->tremolo_rate; - xp.tremolo_depth = wp->tremolo_depth; - xp.vibrato_sweep = wp->vibrato_sweep; - xp.vibrato_rate = wp->vibrato_rate; - xp.vibrato_depth = wp->vibrato_depth; - xp.scale_frequency = cpu_to_le16(wp->scale_frequency); - xp.scale_factor = cpu_to_le16(wp->scale_factor); - if (copy_to_user(*data, &xp, sizeof(xp))) - return -EFAULT; - *data += sizeof(xp); - *len -= sizeof(xp); - real_size = snd_seq_gf1_size(wp->size, wp->format); - if (*len < (long)real_size) - return -ENOMEM; - if (ops->get_sample) { - err = ops->get_sample(ops->private_data, wp, - *data, real_size, atomic); - if (err < 0) - return err; - } - *data += wp->size; - *len -= wp->size; - } - return 0; -} - -static int snd_seq_gf1_get(void *private_data, struct snd_seq_kinstr *instr, - char __user *instr_data, long len, int atomic, - int cmd) -{ - struct snd_gf1_ops *ops = private_data; - struct gf1_instrument *ip; - struct gf1_xinstrument ix; - - if (cmd != SNDRV_SEQ_INSTR_GET_CMD_FULL) - return -EINVAL; - if (len < (long)sizeof(ix)) - return -ENOMEM; - memset(&ix, 0, sizeof(ix)); - ip = (struct gf1_instrument *)KINSTR_DATA(instr); - ix.stype = GF1_STRU_INSTR; - ix.exclusion = cpu_to_le16(ip->exclusion); - ix.exclusion_group = cpu_to_le16(ip->exclusion_group); - ix.effect1 = cpu_to_le16(ip->effect1); - ix.effect1_depth = cpu_to_le16(ip->effect1_depth); - ix.effect2 = ip->effect2; - ix.effect2_depth = ip->effect2_depth; - if (copy_to_user(instr_data, &ix, sizeof(ix))) - return -EFAULT; - instr_data += sizeof(ix); - len -= sizeof(ix); - return snd_seq_gf1_copy_wave_to_stream(ops, - ip, - &instr_data, - &len, - atomic); -} - -static int snd_seq_gf1_get_size(void *private_data, struct snd_seq_kinstr *instr, - long *size) -{ - long result; - struct gf1_instrument *ip; - struct gf1_wave *wp; - - *size = 0; - ip = (struct gf1_instrument *)KINSTR_DATA(instr); - result = sizeof(struct gf1_xinstrument); - for (wp = ip->wave; wp; wp = wp->next) { - result += sizeof(struct gf1_xwave); - result += wp->size; - } - *size = result; - return 0; -} - -static int snd_seq_gf1_remove(void *private_data, - struct snd_seq_kinstr *instr, - int atomic) -{ - struct snd_gf1_ops *ops = private_data; - struct gf1_instrument *ip; - - ip = (struct gf1_instrument *)KINSTR_DATA(instr); - snd_seq_gf1_instr_free(ops, ip, atomic); - return 0; -} - -static void snd_seq_gf1_notify(void *private_data, - struct snd_seq_kinstr *instr, - int what) -{ - struct snd_gf1_ops *ops = private_data; - - if (ops->notify) - ops->notify(ops->private_data, instr, what); -} - -int snd_seq_gf1_init(struct snd_gf1_ops *ops, - void *private_data, - struct snd_seq_kinstr_ops *next) -{ - memset(ops, 0, sizeof(*ops)); - ops->private_data = private_data; - ops->kops.private_data = ops; - ops->kops.add_len = sizeof(struct gf1_instrument); - ops->kops.instr_type = SNDRV_SEQ_INSTR_ID_GUS_PATCH; - ops->kops.put = snd_seq_gf1_put; - ops->kops.get = snd_seq_gf1_get; - ops->kops.get_size = snd_seq_gf1_get_size; - ops->kops.remove = snd_seq_gf1_remove; - ops->kops.notify = snd_seq_gf1_notify; - ops->kops.next = next; - return 0; -} - -/* - * Init part - */ - -static int __init alsa_ainstr_gf1_init(void) -{ - return 0; -} - -static void __exit alsa_ainstr_gf1_exit(void) -{ -} - -module_init(alsa_ainstr_gf1_init) -module_exit(alsa_ainstr_gf1_exit) - -EXPORT_SYMBOL(snd_seq_gf1_init); diff --git a/sound/core/seq/instr/ainstr_iw.c b/sound/core/seq/instr/ainstr_iw.c deleted file mode 100644 index 6c40eb73fa9f..000000000000 --- a/sound/core/seq/instr/ainstr_iw.c +++ /dev/null @@ -1,623 +0,0 @@ -/* - * IWFFFF - AMD InterWave (tm) - Instrument routines - * Copyright (c) 1999 by Jaroslav Kysela - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include -#include -#include -#include -#include -#include -#include - -MODULE_AUTHOR("Jaroslav Kysela "); -MODULE_DESCRIPTION("Advanced Linux Sound Architecture IWFFFF support."); -MODULE_LICENSE("GPL"); - -static unsigned int snd_seq_iwffff_size(unsigned int size, unsigned int format) -{ - unsigned int result = size; - - if (format & IWFFFF_WAVE_16BIT) - result <<= 1; - if (format & IWFFFF_WAVE_STEREO) - result <<= 1; - return result; -} - -static void snd_seq_iwffff_copy_lfo_from_stream(struct iwffff_lfo *fp, - struct iwffff_xlfo *fx) -{ - fp->freq = le16_to_cpu(fx->freq); - fp->depth = le16_to_cpu(fx->depth); - fp->sweep = le16_to_cpu(fx->sweep); - fp->shape = fx->shape; - fp->delay = fx->delay; -} - -static int snd_seq_iwffff_copy_env_from_stream(__u32 req_stype, - struct iwffff_layer *lp, - struct iwffff_env *ep, - struct iwffff_xenv *ex, - char __user **data, - long *len, - gfp_t gfp_mask) -{ - __u32 stype; - struct iwffff_env_record *rp, *rp_last; - struct iwffff_xenv_record rx; - struct iwffff_env_point *pp; - struct iwffff_xenv_point px; - int points_size, idx; - - ep->flags = ex->flags; - ep->mode = ex->mode; - ep->index = ex->index; - rp_last = NULL; - while (1) { - if (*len < (long)sizeof(__u32)) - return -EINVAL; - if (copy_from_user(&stype, *data, sizeof(stype))) - return -EFAULT; - if (stype == IWFFFF_STRU_WAVE) - return 0; - if (req_stype != stype) { - if (stype == IWFFFF_STRU_ENV_RECP || - stype == IWFFFF_STRU_ENV_RECV) - return 0; - } - if (*len < (long)sizeof(rx)) - return -EINVAL; - if (copy_from_user(&rx, *data, sizeof(rx))) - return -EFAULT; - *data += sizeof(rx); - *len -= sizeof(rx); - points_size = (le16_to_cpu(rx.nattack) + le16_to_cpu(rx.nrelease)) * 2 * sizeof(__u16); - if (points_size > *len) - return -EINVAL; - rp = kzalloc(sizeof(*rp) + points_size, gfp_mask); - if (rp == NULL) - return -ENOMEM; - rp->nattack = le16_to_cpu(rx.nattack); - rp->nrelease = le16_to_cpu(rx.nrelease); - rp->sustain_offset = le16_to_cpu(rx.sustain_offset); - rp->sustain_rate = le16_to_cpu(rx.sustain_rate); - rp->release_rate = le16_to_cpu(rx.release_rate); - rp->hirange = rx.hirange; - pp = (struct iwffff_env_point *)(rp + 1); - for (idx = 0; idx < rp->nattack + rp->nrelease; idx++) { - if (copy_from_user(&px, *data, sizeof(px))) - return -EFAULT; - *data += sizeof(px); - *len -= sizeof(px); - pp->offset = le16_to_cpu(px.offset); - pp->rate = le16_to_cpu(px.rate); - } - if (ep->record == NULL) { - ep->record = rp; - } else { - rp_last = rp; - } - rp_last = rp; - } - return 0; -} - -static int snd_seq_iwffff_copy_wave_from_stream(struct snd_iwffff_ops *ops, - struct iwffff_layer *lp, - char __user **data, - long *len, - int atomic) -{ - struct iwffff_wave *wp, *prev; - struct iwffff_xwave xp; - int err; - gfp_t gfp_mask; - unsigned int real_size; - - gfp_mask = atomic ? GFP_ATOMIC : GFP_KERNEL; - if (*len < (long)sizeof(xp)) - return -EINVAL; - if (copy_from_user(&xp, *data, sizeof(xp))) - return -EFAULT; - *data += sizeof(xp); - *len -= sizeof(xp); - wp = kzalloc(sizeof(*wp), gfp_mask); - if (wp == NULL) - return -ENOMEM; - wp->share_id[0] = le32_to_cpu(xp.share_id[0]); - wp->share_id[1] = le32_to_cpu(xp.share_id[1]); - wp->share_id[2] = le32_to_cpu(xp.share_id[2]); - wp->share_id[3] = le32_to_cpu(xp.share_id[3]); - wp->format = le32_to_cpu(xp.format); - wp->address.memory = le32_to_cpu(xp.offset); - wp->size = le32_to_cpu(xp.size); - wp->start = le32_to_cpu(xp.start); - wp->loop_start = le32_to_cpu(xp.loop_start); - wp->loop_end = le32_to_cpu(xp.loop_end); - wp->loop_repeat = le16_to_cpu(xp.loop_repeat); - wp->sample_ratio = le32_to_cpu(xp.sample_ratio); - wp->attenuation = xp.attenuation; - wp->low_note = xp.low_note; - wp->high_note = xp.high_note; - real_size = snd_seq_iwffff_size(wp->size, wp->format); - if (!(wp->format & IWFFFF_WAVE_ROM)) { - if ((long)real_size > *len) { - kfree(wp); - return -ENOMEM; - } - } - if (ops->put_sample) { - err = ops->put_sample(ops->private_data, wp, - *data, real_size, atomic); - if (err < 0) { - kfree(wp); - return err; - } - } - if (!(wp->format & IWFFFF_WAVE_ROM)) { - *data += real_size; - *len -= real_size; - } - prev = lp->wave; - if (prev) { - while (prev->next) prev = prev->next; - prev->next = wp; - } else { - lp->wave = wp; - } - return 0; -} - -static void snd_seq_iwffff_env_free(struct snd_iwffff_ops *ops, - struct iwffff_env *env, - int atomic) -{ - struct iwffff_env_record *rec; - - while ((rec = env->record) != NULL) { - env->record = rec->next; - kfree(rec); - } -} - -static void snd_seq_iwffff_wave_free(struct snd_iwffff_ops *ops, - struct iwffff_wave *wave, - int atomic) -{ - if (ops->remove_sample) - ops->remove_sample(ops->private_data, wave, atomic); - kfree(wave); -} - -static void snd_seq_iwffff_instr_free(struct snd_iwffff_ops *ops, - struct iwffff_instrument *ip, - int atomic) -{ - struct iwffff_layer *layer; - struct iwffff_wave *wave; - - while ((layer = ip->layer) != NULL) { - ip->layer = layer->next; - snd_seq_iwffff_env_free(ops, &layer->penv, atomic); - snd_seq_iwffff_env_free(ops, &layer->venv, atomic); - while ((wave = layer->wave) != NULL) { - layer->wave = wave->next; - snd_seq_iwffff_wave_free(ops, wave, atomic); - } - kfree(layer); - } -} - -static int snd_seq_iwffff_put(void *private_data, struct snd_seq_kinstr *instr, - char __user *instr_data, long len, int atomic, - int cmd) -{ - struct snd_iwffff_ops *ops = private_data; - struct iwffff_instrument *ip; - struct iwffff_xinstrument ix; - struct iwffff_layer *lp, *prev_lp; - struct iwffff_xlayer lx; - int err; - gfp_t gfp_mask; - - if (cmd != SNDRV_SEQ_INSTR_PUT_CMD_CREATE) - return -EINVAL; - gfp_mask = atomic ? GFP_ATOMIC : GFP_KERNEL; - /* copy instrument data */ - if (len < (long)sizeof(ix)) - return -EINVAL; - if (copy_from_user(&ix, instr_data, sizeof(ix))) - return -EFAULT; - if (ix.stype != IWFFFF_STRU_INSTR) - return -EINVAL; - instr_data += sizeof(ix); - len -= sizeof(ix); - ip = (struct iwffff_instrument *)KINSTR_DATA(instr); - ip->exclusion = le16_to_cpu(ix.exclusion); - ip->layer_type = le16_to_cpu(ix.layer_type); - ip->exclusion_group = le16_to_cpu(ix.exclusion_group); - ip->effect1 = ix.effect1; - ip->effect1_depth = ix.effect1_depth; - ip->effect2 = ix.effect2; - ip->effect2_depth = ix.effect2_depth; - /* copy layers */ - prev_lp = NULL; - while (len > 0) { - if (len < (long)sizeof(struct iwffff_xlayer)) { - snd_seq_iwffff_instr_free(ops, ip, atomic); - return -EINVAL; - } - if (copy_from_user(&lx, instr_data, sizeof(lx))) - return -EFAULT; - instr_data += sizeof(lx); - len -= sizeof(lx); - if (lx.stype != IWFFFF_STRU_LAYER) { - snd_seq_iwffff_instr_free(ops, ip, atomic); - return -EINVAL; - } - lp = kzalloc(sizeof(*lp), gfp_mask); - if (lp == NULL) { - snd_seq_iwffff_instr_free(ops, ip, atomic); - return -ENOMEM; - } - if (prev_lp) { - prev_lp->next = lp; - } else { - ip->layer = lp; - } - prev_lp = lp; - lp->flags = lx.flags; - lp->velocity_mode = lx.velocity_mode; - lp->layer_event = lx.layer_event; - lp->low_range = lx.low_range; - lp->high_range = lx.high_range; - lp->pan = lx.pan; - lp->pan_freq_scale = lx.pan_freq_scale; - lp->attenuation = lx.attenuation; - snd_seq_iwffff_copy_lfo_from_stream(&lp->tremolo, &lx.tremolo); - snd_seq_iwffff_copy_lfo_from_stream(&lp->vibrato, &lx.vibrato); - lp->freq_scale = le16_to_cpu(lx.freq_scale); - lp->freq_center = lx.freq_center; - err = snd_seq_iwffff_copy_env_from_stream(IWFFFF_STRU_ENV_RECP, - lp, - &lp->penv, &lx.penv, - &instr_data, &len, - gfp_mask); - if (err < 0) { - snd_seq_iwffff_instr_free(ops, ip, atomic); - return err; - } - err = snd_seq_iwffff_copy_env_from_stream(IWFFFF_STRU_ENV_RECV, - lp, - &lp->venv, &lx.venv, - &instr_data, &len, - gfp_mask); - if (err < 0) { - snd_seq_iwffff_instr_free(ops, ip, atomic); - return err; - } - while (len > (long)sizeof(__u32)) { - __u32 stype; - - if (copy_from_user(&stype, instr_data, sizeof(stype))) - return -EFAULT; - if (stype != IWFFFF_STRU_WAVE) - break; - err = snd_seq_iwffff_copy_wave_from_stream(ops, - lp, - &instr_data, - &len, - atomic); - if (err < 0) { - snd_seq_iwffff_instr_free(ops, ip, atomic); - return err; - } - } - } - return 0; -} - -static void snd_seq_iwffff_copy_lfo_to_stream(struct iwffff_xlfo *fx, - struct iwffff_lfo *fp) -{ - fx->freq = cpu_to_le16(fp->freq); - fx->depth = cpu_to_le16(fp->depth); - fx->sweep = cpu_to_le16(fp->sweep); - fp->shape = fx->shape; - fp->delay = fx->delay; -} - -static int snd_seq_iwffff_copy_env_to_stream(__u32 req_stype, - struct iwffff_layer *lp, - struct iwffff_xenv *ex, - struct iwffff_env *ep, - char __user **data, - long *len) -{ - struct iwffff_env_record *rp; - struct iwffff_xenv_record rx; - struct iwffff_env_point *pp; - struct iwffff_xenv_point px; - int points_size, idx; - - ex->flags = ep->flags; - ex->mode = ep->mode; - ex->index = ep->index; - for (rp = ep->record; rp; rp = rp->next) { - if (*len < (long)sizeof(rx)) - return -ENOMEM; - memset(&rx, 0, sizeof(rx)); - rx.stype = req_stype; - rx.nattack = cpu_to_le16(rp->nattack); - rx.nrelease = cpu_to_le16(rp->nrelease); - rx.sustain_offset = cpu_to_le16(rp->sustain_offset); - rx.sustain_rate = cpu_to_le16(rp->sustain_rate); - rx.release_rate = cpu_to_le16(rp->release_rate); - rx.hirange = cpu_to_le16(rp->hirange); - if (copy_to_user(*data, &rx, sizeof(rx))) - return -EFAULT; - *data += sizeof(rx); - *len -= sizeof(rx); - points_size = (rp->nattack + rp->nrelease) * 2 * sizeof(__u16); - if (*len < points_size) - return -ENOMEM; - pp = (struct iwffff_env_point *)(rp + 1); - for (idx = 0; idx < rp->nattack + rp->nrelease; idx++) { - px.offset = cpu_to_le16(pp->offset); - px.rate = cpu_to_le16(pp->rate); - if (copy_to_user(*data, &px, sizeof(px))) - return -EFAULT; - *data += sizeof(px); - *len -= sizeof(px); - } - } - return 0; -} - -static int snd_seq_iwffff_copy_wave_to_stream(struct snd_iwffff_ops *ops, - struct iwffff_layer *lp, - char __user **data, - long *len, - int atomic) -{ - struct iwffff_wave *wp; - struct iwffff_xwave xp; - int err; - unsigned int real_size; - - for (wp = lp->wave; wp; wp = wp->next) { - if (*len < (long)sizeof(xp)) - return -ENOMEM; - memset(&xp, 0, sizeof(xp)); - xp.stype = IWFFFF_STRU_WAVE; - xp.share_id[0] = cpu_to_le32(wp->share_id[0]); - xp.share_id[1] = cpu_to_le32(wp->share_id[1]); - xp.share_id[2] = cpu_to_le32(wp->share_id[2]); - xp.share_id[3] = cpu_to_le32(wp->share_id[3]); - xp.format = cpu_to_le32(wp->format); - if (wp->format & IWFFFF_WAVE_ROM) - xp.offset = cpu_to_le32(wp->address.memory); - xp.size = cpu_to_le32(wp->size); - xp.start = cpu_to_le32(wp->start); - xp.loop_start = cpu_to_le32(wp->loop_start); - xp.loop_end = cpu_to_le32(wp->loop_end); - xp.loop_repeat = cpu_to_le32(wp->loop_repeat); - xp.sample_ratio = cpu_to_le32(wp->sample_ratio); - xp.attenuation = wp->attenuation; - xp.low_note = wp->low_note; - xp.high_note = wp->high_note; - if (copy_to_user(*data, &xp, sizeof(xp))) - return -EFAULT; - *data += sizeof(xp); - *len -= sizeof(xp); - real_size = snd_seq_iwffff_size(wp->size, wp->format); - if (!(wp->format & IWFFFF_WAVE_ROM)) { - if (*len < (long)real_size) - return -ENOMEM; - } - if (ops->get_sample) { - err = ops->get_sample(ops->private_data, wp, - *data, real_size, atomic); - if (err < 0) - return err; - } - if (!(wp->format & IWFFFF_WAVE_ROM)) { - *data += real_size; - *len -= real_size; - } - } - return 0; -} - -static int snd_seq_iwffff_get(void *private_data, struct snd_seq_kinstr *instr, - char __user *instr_data, long len, int atomic, int cmd) -{ - struct snd_iwffff_ops *ops = private_data; - struct iwffff_instrument *ip; - struct iwffff_xinstrument ix; - struct iwffff_layer *lp; - struct iwffff_xlayer lx; - char __user *layer_instr_data; - int err; - - if (cmd != SNDRV_SEQ_INSTR_GET_CMD_FULL) - return -EINVAL; - if (len < (long)sizeof(ix)) - return -ENOMEM; - memset(&ix, 0, sizeof(ix)); - ip = (struct iwffff_instrument *)KINSTR_DATA(instr); - ix.stype = IWFFFF_STRU_INSTR; - ix.exclusion = cpu_to_le16(ip->exclusion); - ix.layer_type = cpu_to_le16(ip->layer_type); - ix.exclusion_group = cpu_to_le16(ip->exclusion_group); - ix.effect1 = cpu_to_le16(ip->effect1); - ix.effect1_depth = cpu_to_le16(ip->effect1_depth); - ix.effect2 = ip->effect2; - ix.effect2_depth = ip->effect2_depth; - if (copy_to_user(instr_data, &ix, sizeof(ix))) - return -EFAULT; - instr_data += sizeof(ix); - len -= sizeof(ix); - for (lp = ip->layer; lp; lp = lp->next) { - if (len < (long)sizeof(lx)) - return -ENOMEM; - memset(&lx, 0, sizeof(lx)); - lx.stype = IWFFFF_STRU_LAYER; - lx.flags = lp->flags; - lx.velocity_mode = lp->velocity_mode; - lx.layer_event = lp->layer_event; - lx.low_range = lp->low_range; - lx.high_range = lp->high_range; - lx.pan = lp->pan; - lx.pan_freq_scale = lp->pan_freq_scale; - lx.attenuation = lp->attenuation; - snd_seq_iwffff_copy_lfo_to_stream(&lx.tremolo, &lp->tremolo); - snd_seq_iwffff_copy_lfo_to_stream(&lx.vibrato, &lp->vibrato); - layer_instr_data = instr_data; - instr_data += sizeof(lx); - len -= sizeof(lx); - err = snd_seq_iwffff_copy_env_to_stream(IWFFFF_STRU_ENV_RECP, - lp, - &lx.penv, &lp->penv, - &instr_data, &len); - if (err < 0) - return err; - err = snd_seq_iwffff_copy_env_to_stream(IWFFFF_STRU_ENV_RECV, - lp, - &lx.venv, &lp->venv, - &instr_data, &len); - if (err < 0) - return err; - /* layer structure updating is now finished */ - if (copy_to_user(layer_instr_data, &lx, sizeof(lx))) - return -EFAULT; - err = snd_seq_iwffff_copy_wave_to_stream(ops, - lp, - &instr_data, - &len, - atomic); - if (err < 0) - return err; - } - return 0; -} - -static long snd_seq_iwffff_env_size_in_stream(struct iwffff_env *ep) -{ - long result = 0; - struct iwffff_env_record *rp; - - for (rp = ep->record; rp; rp = rp->next) { - result += sizeof(struct iwffff_xenv_record); - result += (rp->nattack + rp->nrelease) * 2 * sizeof(__u16); - } - return 0; -} - -static long snd_seq_iwffff_wave_size_in_stream(struct iwffff_layer *lp) -{ - long result = 0; - struct iwffff_wave *wp; - - for (wp = lp->wave; wp; wp = wp->next) { - result += sizeof(struct iwffff_xwave); - if (!(wp->format & IWFFFF_WAVE_ROM)) - result += wp->size; - } - return result; -} - -static int snd_seq_iwffff_get_size(void *private_data, struct snd_seq_kinstr *instr, - long *size) -{ - long result; - struct iwffff_instrument *ip; - struct iwffff_layer *lp; - - *size = 0; - ip = (struct iwffff_instrument *)KINSTR_DATA(instr); - result = sizeof(struct iwffff_xinstrument); - for (lp = ip->layer; lp; lp = lp->next) { - result += sizeof(struct iwffff_xlayer); - result += snd_seq_iwffff_env_size_in_stream(&lp->penv); - result += snd_seq_iwffff_env_size_in_stream(&lp->venv); - result += snd_seq_iwffff_wave_size_in_stream(lp); - } - *size = result; - return 0; -} - -static int snd_seq_iwffff_remove(void *private_data, - struct snd_seq_kinstr *instr, - int atomic) -{ - struct snd_iwffff_ops *ops = private_data; - struct iwffff_instrument *ip; - - ip = (struct iwffff_instrument *)KINSTR_DATA(instr); - snd_seq_iwffff_instr_free(ops, ip, atomic); - return 0; -} - -static void snd_seq_iwffff_notify(void *private_data, - struct snd_seq_kinstr *instr, - int what) -{ - struct snd_iwffff_ops *ops = private_data; - - if (ops->notify) - ops->notify(ops->private_data, instr, what); -} - -int snd_seq_iwffff_init(struct snd_iwffff_ops *ops, - void *private_data, - struct snd_seq_kinstr_ops *next) -{ - memset(ops, 0, sizeof(*ops)); - ops->private_data = private_data; - ops->kops.private_data = ops; - ops->kops.add_len = sizeof(struct iwffff_instrument); - ops->kops.instr_type = SNDRV_SEQ_INSTR_ID_INTERWAVE; - ops->kops.put = snd_seq_iwffff_put; - ops->kops.get = snd_seq_iwffff_get; - ops->kops.get_size = snd_seq_iwffff_get_size; - ops->kops.remove = snd_seq_iwffff_remove; - ops->kops.notify = snd_seq_iwffff_notify; - ops->kops.next = next; - return 0; -} - -/* - * Init part - */ - -static int __init alsa_ainstr_iw_init(void) -{ - return 0; -} - -static void __exit alsa_ainstr_iw_exit(void) -{ -} - -module_init(alsa_ainstr_iw_init) -module_exit(alsa_ainstr_iw_exit) - -EXPORT_SYMBOL(snd_seq_iwffff_init); diff --git a/sound/core/seq/instr/ainstr_simple.c b/sound/core/seq/instr/ainstr_simple.c deleted file mode 100644 index 78f68bee24fe..000000000000 --- a/sound/core/seq/instr/ainstr_simple.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Simple (MOD player) - Instrument routines - * Copyright (c) 1999 by Jaroslav Kysela - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include -#include -#include -#include -#include -#include -#include - -MODULE_AUTHOR("Jaroslav Kysela "); -MODULE_DESCRIPTION("Advanced Linux Sound Architecture Simple Instrument support."); -MODULE_LICENSE("GPL"); - -static unsigned int snd_seq_simple_size(unsigned int size, unsigned int format) -{ - unsigned int result = size; - - if (format & SIMPLE_WAVE_16BIT) - result <<= 1; - if (format & SIMPLE_WAVE_STEREO) - result <<= 1; - return result; -} - -static void snd_seq_simple_instr_free(struct snd_simple_ops *ops, - struct simple_instrument *ip, - int atomic) -{ - if (ops->remove_sample) - ops->remove_sample(ops->private_data, ip, atomic); -} - -static int snd_seq_simple_put(void *private_data, struct snd_seq_kinstr *instr, - char __user *instr_data, long len, - int atomic, int cmd) -{ - struct snd_simple_ops *ops = private_data; - struct simple_instrument *ip; - struct simple_xinstrument ix; - int err; - gfp_t gfp_mask; - unsigned int real_size; - - if (cmd != SNDRV_SEQ_INSTR_PUT_CMD_CREATE) - return -EINVAL; - gfp_mask = atomic ? GFP_ATOMIC : GFP_KERNEL; - /* copy instrument data */ - if (len < (long)sizeof(ix)) - return -EINVAL; - if (copy_from_user(&ix, instr_data, sizeof(ix))) - return -EFAULT; - if (ix.stype != SIMPLE_STRU_INSTR) - return -EINVAL; - instr_data += sizeof(ix); - len -= sizeof(ix); - ip = (struct simple_instrument *)KINSTR_DATA(instr); - ip->share_id[0] = le32_to_cpu(ix.share_id[0]); - ip->share_id[1] = le32_to_cpu(ix.share_id[1]); - ip->share_id[2] = le32_to_cpu(ix.share_id[2]); - ip->share_id[3] = le32_to_cpu(ix.share_id[3]); - ip->format = le32_to_cpu(ix.format); - ip->size = le32_to_cpu(ix.size); - ip->start = le32_to_cpu(ix.start); - ip->loop_start = le32_to_cpu(ix.loop_start); - ip->loop_end = le32_to_cpu(ix.loop_end); - ip->loop_repeat = le16_to_cpu(ix.loop_repeat); - ip->effect1 = ix.effect1; - ip->effect1_depth = ix.effect1_depth; - ip->effect2 = ix.effect2; - ip->effect2_depth = ix.effect2_depth; - real_size = snd_seq_simple_size(ip->size, ip->format); - if (len < (long)real_size) - return -EINVAL; - if (ops->put_sample) { - err = ops->put_sample(ops->private_data, ip, - instr_data, real_size, atomic); - if (err < 0) - return err; - } - return 0; -} - -static int snd_seq_simple_get(void *private_data, struct snd_seq_kinstr *instr, - char __user *instr_data, long len, - int atomic, int cmd) -{ - struct snd_simple_ops *ops = private_data; - struct simple_instrument *ip; - struct simple_xinstrument ix; - int err; - unsigned int real_size; - - if (cmd != SNDRV_SEQ_INSTR_GET_CMD_FULL) - return -EINVAL; - if (len < (long)sizeof(ix)) - return -ENOMEM; - memset(&ix, 0, sizeof(ix)); - ip = (struct simple_instrument *)KINSTR_DATA(instr); - ix.stype = SIMPLE_STRU_INSTR; - ix.share_id[0] = cpu_to_le32(ip->share_id[0]); - ix.share_id[1] = cpu_to_le32(ip->share_id[1]); - ix.share_id[2] = cpu_to_le32(ip->share_id[2]); - ix.share_id[3] = cpu_to_le32(ip->share_id[3]); - ix.format = cpu_to_le32(ip->format); - ix.size = cpu_to_le32(ip->size); - ix.start = cpu_to_le32(ip->start); - ix.loop_start = cpu_to_le32(ip->loop_start); - ix.loop_end = cpu_to_le32(ip->loop_end); - ix.loop_repeat = cpu_to_le32(ip->loop_repeat); - ix.effect1 = cpu_to_le16(ip->effect1); - ix.effect1_depth = cpu_to_le16(ip->effect1_depth); - ix.effect2 = ip->effect2; - ix.effect2_depth = ip->effect2_depth; - if (copy_to_user(instr_data, &ix, sizeof(ix))) - return -EFAULT; - instr_data += sizeof(ix); - len -= sizeof(ix); - real_size = snd_seq_simple_size(ip->size, ip->format); - if (len < (long)real_size) - return -ENOMEM; - if (ops->get_sample) { - err = ops->get_sample(ops->private_data, ip, - instr_data, real_size, atomic); - if (err < 0) - return err; - } - return 0; -} - -static int snd_seq_simple_get_size(void *private_data, struct snd_seq_kinstr *instr, - long *size) -{ - struct simple_instrument *ip; - - ip = (struct simple_instrument *)KINSTR_DATA(instr); - *size = sizeof(struct simple_xinstrument) + snd_seq_simple_size(ip->size, ip->format); - return 0; -} - -static int snd_seq_simple_remove(void *private_data, - struct snd_seq_kinstr *instr, - int atomic) -{ - struct snd_simple_ops *ops = private_data; - struct simple_instrument *ip; - - ip = (struct simple_instrument *)KINSTR_DATA(instr); - snd_seq_simple_instr_free(ops, ip, atomic); - return 0; -} - -static void snd_seq_simple_notify(void *private_data, - struct snd_seq_kinstr *instr, - int what) -{ - struct snd_simple_ops *ops = private_data; - - if (ops->notify) - ops->notify(ops->private_data, instr, what); -} - -int snd_seq_simple_init(struct snd_simple_ops *ops, - void *private_data, - struct snd_seq_kinstr_ops *next) -{ - memset(ops, 0, sizeof(*ops)); - ops->private_data = private_data; - ops->kops.private_data = ops; - ops->kops.add_len = sizeof(struct simple_instrument); - ops->kops.instr_type = SNDRV_SEQ_INSTR_ID_SIMPLE; - ops->kops.put = snd_seq_simple_put; - ops->kops.get = snd_seq_simple_get; - ops->kops.get_size = snd_seq_simple_get_size; - ops->kops.remove = snd_seq_simple_remove; - ops->kops.notify = snd_seq_simple_notify; - ops->kops.next = next; - return 0; -} - -/* - * Init part - */ - -static int __init alsa_ainstr_simple_init(void) -{ - return 0; -} - -static void __exit alsa_ainstr_simple_exit(void) -{ -} - -module_init(alsa_ainstr_simple_init) -module_exit(alsa_ainstr_simple_exit) - -EXPORT_SYMBOL(snd_seq_simple_init); diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c index 2e3fa25ab19f..69421ca68167 100644 --- a/sound/core/seq/seq_clientmgr.c +++ b/sound/core/seq/seq_clientmgr.c @@ -966,8 +966,7 @@ static int check_event_type_and_length(struct snd_seq_event *ev) return -EINVAL; break; case SNDRV_SEQ_EVENT_LENGTH_VARUSR: - if (! snd_seq_ev_is_instr_type(ev) || - ! snd_seq_ev_is_direct(ev)) + if (! snd_seq_ev_is_direct(ev)) return -EINVAL; break; } diff --git a/sound/core/seq/seq_instr.c b/sound/core/seq/seq_instr.c deleted file mode 100644 index 9a6fd56c9109..000000000000 --- a/sound/core/seq/seq_instr.c +++ /dev/null @@ -1,655 +0,0 @@ -/* - * Generic Instrument routines for ALSA sequencer - * Copyright (c) 1999 by Jaroslav Kysela - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include -#include -#include -#include -#include "seq_clientmgr.h" -#include -#include - -MODULE_AUTHOR("Jaroslav Kysela "); -MODULE_DESCRIPTION("Advanced Linux Sound Architecture sequencer instrument library."); -MODULE_LICENSE("GPL"); - - -static void snd_instr_lock_ops(struct snd_seq_kinstr_list *list) -{ - if (!(list->flags & SNDRV_SEQ_INSTR_FLG_DIRECT)) { - spin_lock_irqsave(&list->ops_lock, list->ops_flags); - } else { - mutex_lock(&list->ops_mutex); - } -} - -static void snd_instr_unlock_ops(struct snd_seq_kinstr_list *list) -{ - if (!(list->flags & SNDRV_SEQ_INSTR_FLG_DIRECT)) { - spin_unlock_irqrestore(&list->ops_lock, list->ops_flags); - } else { - mutex_unlock(&list->ops_mutex); - } -} - -static struct snd_seq_kinstr *snd_seq_instr_new(int add_len, int atomic) -{ - struct snd_seq_kinstr *instr; - - instr = kzalloc(sizeof(struct snd_seq_kinstr) + add_len, atomic ? GFP_ATOMIC : GFP_KERNEL); - if (instr == NULL) - return NULL; - instr->add_len = add_len; - return instr; -} - -static int snd_seq_instr_free(struct snd_seq_kinstr *instr, int atomic) -{ - int result = 0; - - if (instr == NULL) - return -EINVAL; - if (instr->ops && instr->ops->remove) - result = instr->ops->remove(instr->ops->private_data, instr, 1); - if (!result) - kfree(instr); - return result; -} - -struct snd_seq_kinstr_list *snd_seq_instr_list_new(void) -{ - struct snd_seq_kinstr_list *list; - - list = kzalloc(sizeof(struct snd_seq_kinstr_list), GFP_KERNEL); - if (list == NULL) - return NULL; - spin_lock_init(&list->lock); - spin_lock_init(&list->ops_lock); - mutex_init(&list->ops_mutex); - list->owner = -1; - return list; -} - -void snd_seq_instr_list_free(struct snd_seq_kinstr_list **list_ptr) -{ - struct snd_seq_kinstr_list *list; - struct snd_seq_kinstr *instr; - struct snd_seq_kcluster *cluster; - int idx; - unsigned long flags; - - if (list_ptr == NULL) - return; - list = *list_ptr; - *list_ptr = NULL; - if (list == NULL) - return; - - for (idx = 0; idx < SNDRV_SEQ_INSTR_HASH_SIZE; idx++) { - while ((instr = list->hash[idx]) != NULL) { - list->hash[idx] = instr->next; - list->count--; - spin_lock_irqsave(&list->lock, flags); - while (instr->use) { - spin_unlock_irqrestore(&list->lock, flags); - schedule_timeout_uninterruptible(1); - spin_lock_irqsave(&list->lock, flags); - } - spin_unlock_irqrestore(&list->lock, flags); - if (snd_seq_instr_free(instr, 0)<0) - snd_printk(KERN_WARNING "instrument free problem\n"); - } - while ((cluster = list->chash[idx]) != NULL) { - list->chash[idx] = cluster->next; - list->ccount--; - kfree(cluster); - } - } - kfree(list); -} - -static int instr_free_compare(struct snd_seq_kinstr *instr, - struct snd_seq_instr_header *ifree, - unsigned int client) -{ - switch (ifree->cmd) { - case SNDRV_SEQ_INSTR_FREE_CMD_ALL: - /* all, except private for other clients */ - if ((instr->instr.std & 0xff000000) == 0) - return 0; - if (((instr->instr.std >> 24) & 0xff) == client) - return 0; - return 1; - case SNDRV_SEQ_INSTR_FREE_CMD_PRIVATE: - /* all my private instruments */ - if ((instr->instr.std & 0xff000000) == 0) - return 1; - if (((instr->instr.std >> 24) & 0xff) == client) - return 0; - return 1; - case SNDRV_SEQ_INSTR_FREE_CMD_CLUSTER: - /* all my private instruments */ - if ((instr->instr.std & 0xff000000) == 0) { - if (instr->instr.cluster == ifree->id.cluster) - return 0; - return 1; - } - if (((instr->instr.std >> 24) & 0xff) == client) { - if (instr->instr.cluster == ifree->id.cluster) - return 0; - } - return 1; - } - return 1; -} - -int snd_seq_instr_list_free_cond(struct snd_seq_kinstr_list *list, - struct snd_seq_instr_header *ifree, - int client, - int atomic) -{ - struct snd_seq_kinstr *instr, *prev, *next, *flist; - int idx; - unsigned long flags; - - snd_instr_lock_ops(list); - for (idx = 0; idx < SNDRV_SEQ_INSTR_HASH_SIZE; idx++) { - spin_lock_irqsave(&list->lock, flags); - instr = list->hash[idx]; - prev = flist = NULL; - while (instr) { - while (instr && instr_free_compare(instr, ifree, (unsigned int)client)) { - prev = instr; - instr = instr->next; - } - if (instr == NULL) - continue; - if (instr->ops && instr->ops->notify) - instr->ops->notify(instr->ops->private_data, instr, SNDRV_SEQ_INSTR_NOTIFY_REMOVE); - next = instr->next; - if (prev == NULL) { - list->hash[idx] = next; - } else { - prev->next = next; - } - list->count--; - instr->next = flist; - flist = instr; - instr = next; - } - spin_unlock_irqrestore(&list->lock, flags); - while (flist) { - instr = flist; - flist = instr->next; - while (instr->use) { - schedule_timeout_uninterruptible(1); - barrier(); - } - if (snd_seq_instr_free(instr, atomic)<0) - snd_printk(KERN_WARNING "instrument free problem\n"); - instr = next; - } - } - snd_instr_unlock_ops(list); - return 0; -} - -static int compute_hash_instr_key(struct snd_seq_instr *instr) -{ - int result; - - result = instr->bank | (instr->prg << 16); - result += result >> 24; - result += result >> 16; - result += result >> 8; - return result & (SNDRV_SEQ_INSTR_HASH_SIZE-1); -} - -#if 0 -static int compute_hash_cluster_key(snd_seq_instr_cluster_t cluster) -{ - int result; - - result = cluster; - result += result >> 24; - result += result >> 16; - result += result >> 8; - return result & (SNDRV_SEQ_INSTR_HASH_SIZE-1); -} -#endif - -static int compare_instr(struct snd_seq_instr *i1, struct snd_seq_instr *i2, int exact) -{ - if (exact) { - if (i1->cluster != i2->cluster || - i1->bank != i2->bank || - i1->prg != i2->prg) - return 1; - if ((i1->std & 0xff000000) != (i2->std & 0xff000000)) - return 1; - if (!(i1->std & i2->std)) - return 1; - return 0; - } else { - unsigned int client_check; - - if (i2->cluster && i1->cluster != i2->cluster) - return 1; - client_check = i2->std & 0xff000000; - if (client_check) { - if ((i1->std & 0xff000000) != client_check) - return 1; - } else { - if ((i1->std & i2->std) != i2->std) - return 1; - } - return i1->bank != i2->bank || i1->prg != i2->prg; - } -} - -struct snd_seq_kinstr *snd_seq_instr_find(struct snd_seq_kinstr_list *list, - struct snd_seq_instr *instr, - int exact, - int follow_alias) -{ - unsigned long flags; - int depth = 0; - struct snd_seq_kinstr *result; - - if (list == NULL || instr == NULL) - return NULL; - spin_lock_irqsave(&list->lock, flags); - __again: - result = list->hash[compute_hash_instr_key(instr)]; - while (result) { - if (!compare_instr(&result->instr, instr, exact)) { - if (follow_alias && (result->type == SNDRV_SEQ_INSTR_ATYPE_ALIAS)) { - instr = (struct snd_seq_instr *)KINSTR_DATA(result); - if (++depth > 10) - goto __not_found; - goto __again; - } - result->use++; - spin_unlock_irqrestore(&list->lock, flags); - return result; - } - result = result->next; - } - __not_found: - spin_unlock_irqrestore(&list->lock, flags); - return NULL; -} - -void snd_seq_instr_free_use(struct snd_seq_kinstr_list *list, - struct snd_seq_kinstr *instr) -{ - unsigned long flags; - - if (list == NULL || instr == NULL) - return; - spin_lock_irqsave(&list->lock, flags); - if (instr->use <= 0) { - snd_printk(KERN_ERR "free_use: fatal!!! use = %i, name = '%s'\n", instr->use, instr->name); - } else { - instr->use--; - } - spin_unlock_irqrestore(&list->lock, flags); -} - -static struct snd_seq_kinstr_ops *instr_ops(struct snd_seq_kinstr_ops *ops, - char *instr_type) -{ - while (ops) { - if (!strcmp(ops->instr_type, instr_type)) - return ops; - ops = ops->next; - } - return NULL; -} - -static int instr_result(struct snd_seq_event *ev, - int type, int result, - int atomic) -{ - struct snd_seq_event sev; - - memset(&sev, 0, sizeof(sev)); - sev.type = SNDRV_SEQ_EVENT_RESULT; - sev.flags = SNDRV_SEQ_TIME_STAMP_REAL | SNDRV_SEQ_EVENT_LENGTH_FIXED | - SNDRV_SEQ_PRIORITY_NORMAL; - sev.source = ev->dest; - sev.dest = ev->source; - sev.data.result.event = type; - sev.data.result.result = result; -#if 0 - printk("instr result - type = %i, result = %i, queue = %i, source.client:port = %i:%i, dest.client:port = %i:%i\n", - type, result, - sev.queue, - sev.source.client, sev.source.port, - sev.dest.client, sev.dest.port); -#endif - return snd_seq_kernel_client_dispatch(sev.source.client, &sev, atomic, 0); -} - -static int instr_begin(struct snd_seq_kinstr_ops *ops, - struct snd_seq_kinstr_list *list, - struct snd_seq_event *ev, - int atomic, int hop) -{ - unsigned long flags; - - spin_lock_irqsave(&list->lock, flags); - if (list->owner >= 0 && list->owner != ev->source.client) { - spin_unlock_irqrestore(&list->lock, flags); - return instr_result(ev, SNDRV_SEQ_EVENT_INSTR_BEGIN, -EBUSY, atomic); - } - list->owner = ev->source.client; - spin_unlock_irqrestore(&list->lock, flags); - return instr_result(ev, SNDRV_SEQ_EVENT_INSTR_BEGIN, 0, atomic); -} - -static int instr_end(struct snd_seq_kinstr_ops *ops, - struct snd_seq_kinstr_list *list, - struct snd_seq_event *ev, - int atomic, int hop) -{ - unsigned long flags; - - /* TODO: timeout handling */ - spin_lock_irqsave(&list->lock, flags); - if (list->owner == ev->source.client) { - list->owner = -1; - spin_unlock_irqrestore(&list->lock, flags); - return instr_result(ev, SNDRV_SEQ_EVENT_INSTR_END, 0, atomic); - } - spin_unlock_irqrestore(&list->lock, flags); - return instr_result(ev, SNDRV_SEQ_EVENT_INSTR_END, -EINVAL, atomic); -} - -static int instr_info(struct snd_seq_kinstr_ops *ops, - struct snd_seq_kinstr_list *list, - struct snd_seq_event *ev, - int atomic, int hop) -{ - return -ENXIO; -} - -static int instr_format_info(struct snd_seq_kinstr_ops *ops, - struct snd_seq_kinstr_list *list, - struct snd_seq_event *ev, - int atomic, int hop) -{ - return -ENXIO; -} - -static int instr_reset(struct snd_seq_kinstr_ops *ops, - struct snd_seq_kinstr_list *list, - struct snd_seq_event *ev, - int atomic, int hop) -{ - return -ENXIO; -} - -static int instr_status(struct snd_seq_kinstr_ops *ops, - struct snd_seq_kinstr_list *list, - struct snd_seq_event *ev, - int atomic, int hop) -{ - return -ENXIO; -} - -static int instr_put(struct snd_seq_kinstr_ops *ops, - struct snd_seq_kinstr_list *list, - struct snd_seq_event *ev, - int atomic, int hop) -{ - unsigned long flags; - struct snd_seq_instr_header put; - struct snd_seq_kinstr *instr; - int result = -EINVAL, len, key; - - if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARUSR) - goto __return; - - if (ev->data.ext.len < sizeof(struct snd_seq_instr_header)) - goto __return; - if (copy_from_user(&put, (void __user *)ev->data.ext.ptr, - sizeof(struct snd_seq_instr_header))) { - result = -EFAULT; - goto __return; - } - snd_instr_lock_ops(list); - if (put.id.instr.std & 0xff000000) { /* private instrument */ - put.id.instr.std &= 0x00ffffff; - put.id.instr.std |= (unsigned int)ev->source.client << 24; - } - if ((instr = snd_seq_instr_find(list, &put.id.instr, 1, 0))) { - snd_seq_instr_free_use(list, instr); - snd_instr_unlock_ops(list); - result = -EBUSY; - goto __return; - } - ops = instr_ops(ops, put.data.data.format); - if (ops == NULL) { - snd_instr_unlock_ops(list); - goto __return; - } - len = ops->add_len; - if (put.data.type == SNDRV_SEQ_INSTR_ATYPE_ALIAS) - len = sizeof(struct snd_seq_instr); - instr = snd_seq_instr_new(len, atomic); - if (instr == NULL) { - snd_instr_unlock_ops(list); - result = -ENOMEM; - goto __return; - } - instr->ops = ops; - instr->instr = put.id.instr; - strlcpy(instr->name, put.data.name, sizeof(instr->name)); - instr->type = put.data.type; - if (instr->type == SNDRV_SEQ_INSTR_ATYPE_DATA) { - result = ops->put(ops->private_data, - instr, - (void __user *)ev->data.ext.ptr + sizeof(struct snd_seq_instr_header), - ev->data.ext.len - sizeof(struct snd_seq_instr_header), - atomic, - put.cmd); - if (result < 0) { - snd_seq_instr_free(instr, atomic); - snd_instr_unlock_ops(list); - goto __return; - } - } - key = compute_hash_instr_key(&instr->instr); - spin_lock_irqsave(&list->lock, flags); - instr->next = list->hash[key]; - list->hash[key] = instr; - list->count++; - spin_unlock_irqrestore(&list->lock, flags); - snd_instr_unlock_ops(list); - result = 0; - __return: - instr_result(ev, SNDRV_SEQ_EVENT_INSTR_PUT, result, atomic); - return result; -} - -static int instr_get(struct snd_seq_kinstr_ops *ops, - struct snd_seq_kinstr_list *list, - struct snd_seq_event *ev, - int atomic, int hop) -{ - return -ENXIO; -} - -static int instr_free(struct snd_seq_kinstr_ops *ops, - struct snd_seq_kinstr_list *list, - struct snd_seq_event *ev, - int atomic, int hop) -{ - struct snd_seq_instr_header ifree; - struct snd_seq_kinstr *instr, *prev; - int result = -EINVAL; - unsigned long flags; - unsigned int hash; - - if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARUSR) - goto __return; - - if (ev->data.ext.len < sizeof(struct snd_seq_instr_header)) - goto __return; - if (copy_from_user(&ifree, (void __user *)ev->data.ext.ptr, - sizeof(struct snd_seq_instr_header))) { - result = -EFAULT; - goto __return; - } - if (ifree.cmd == SNDRV_SEQ_INSTR_FREE_CMD_ALL || - ifree.cmd == SNDRV_SEQ_INSTR_FREE_CMD_PRIVATE || - ifree.cmd == SNDRV_SEQ_INSTR_FREE_CMD_CLUSTER) { - result = snd_seq_instr_list_free_cond(list, &ifree, ev->dest.client, atomic); - goto __return; - } - if (ifree.cmd == SNDRV_SEQ_INSTR_FREE_CMD_SINGLE) { - if (ifree.id.instr.std & 0xff000000) { - ifree.id.instr.std &= 0x00ffffff; - ifree.id.instr.std |= (unsigned int)ev->source.client << 24; - } - hash = compute_hash_instr_key(&ifree.id.instr); - snd_instr_lock_ops(list); - spin_lock_irqsave(&list->lock, flags); - instr = list->hash[hash]; - prev = NULL; - while (instr) { - if (!compare_instr(&instr->instr, &ifree.id.instr, 1)) - goto __free_single; - prev = instr; - instr = instr->next; - } - result = -ENOENT; - spin_unlock_irqrestore(&list->lock, flags); - snd_instr_unlock_ops(list); - goto __return; - - __free_single: - if (prev) { - prev->next = instr->next; - } else { - list->hash[hash] = instr->next; - } - if (instr->ops && instr->ops->notify) - instr->ops->notify(instr->ops->private_data, instr, - SNDRV_SEQ_INSTR_NOTIFY_REMOVE); - while (instr->use) { - spin_unlock_irqrestore(&list->lock, flags); - schedule_timeout_uninterruptible(1); - spin_lock_irqsave(&list->lock, flags); - } - spin_unlock_irqrestore(&list->lock, flags); - result = snd_seq_instr_free(instr, atomic); - snd_instr_unlock_ops(list); - goto __return; - } - - __return: - instr_result(ev, SNDRV_SEQ_EVENT_INSTR_FREE, result, atomic); - return result; -} - -static int instr_list(struct snd_seq_kinstr_ops *ops, - struct snd_seq_kinstr_list *list, - struct snd_seq_event *ev, - int atomic, int hop) -{ - return -ENXIO; -} - -static int instr_cluster(struct snd_seq_kinstr_ops *ops, - struct snd_seq_kinstr_list *list, - struct snd_seq_event *ev, - int atomic, int hop) -{ - return -ENXIO; -} - -int snd_seq_instr_event(struct snd_seq_kinstr_ops *ops, - struct snd_seq_kinstr_list *list, - struct snd_seq_event *ev, - int client, - int atomic, - int hop) -{ - int direct = 0; - - snd_assert(ops != NULL && list != NULL && ev != NULL, return -EINVAL); - if (snd_seq_ev_is_direct(ev)) { - direct = 1; - switch (ev->type) { - case SNDRV_SEQ_EVENT_INSTR_BEGIN: - return instr_begin(ops, list, ev, atomic, hop); - case SNDRV_SEQ_EVENT_INSTR_END: - return instr_end(ops, list, ev, atomic, hop); - } - } - if ((list->flags & SNDRV_SEQ_INSTR_FLG_DIRECT) && !direct) - return -EINVAL; - switch (ev->type) { - case SNDRV_SEQ_EVENT_INSTR_INFO: - return instr_info(ops, list, ev, atomic, hop); - case SNDRV_SEQ_EVENT_INSTR_FINFO: - return instr_format_info(ops, list, ev, atomic, hop); - case SNDRV_SEQ_EVENT_INSTR_RESET: - return instr_reset(ops, list, ev, atomic, hop); - case SNDRV_SEQ_EVENT_INSTR_STATUS: - return instr_status(ops, list, ev, atomic, hop); - case SNDRV_SEQ_EVENT_INSTR_PUT: - return instr_put(ops, list, ev, atomic, hop); - case SNDRV_SEQ_EVENT_INSTR_GET: - return instr_get(ops, list, ev, atomic, hop); - case SNDRV_SEQ_EVENT_INSTR_FREE: - return instr_free(ops, list, ev, atomic, hop); - case SNDRV_SEQ_EVENT_INSTR_LIST: - return instr_list(ops, list, ev, atomic, hop); - case SNDRV_SEQ_EVENT_INSTR_CLUSTER: - return instr_cluster(ops, list, ev, atomic, hop); - } - return -EINVAL; -} - -/* - * Init part - */ - -static int __init alsa_seq_instr_init(void) -{ - return 0; -} - -static void __exit alsa_seq_instr_exit(void) -{ -} - -module_init(alsa_seq_instr_init) -module_exit(alsa_seq_instr_exit) - -EXPORT_SYMBOL(snd_seq_instr_list_new); -EXPORT_SYMBOL(snd_seq_instr_list_free); -EXPORT_SYMBOL(snd_seq_instr_list_free_cond); -EXPORT_SYMBOL(snd_seq_instr_find); -EXPORT_SYMBOL(snd_seq_instr_free_use); -EXPORT_SYMBOL(snd_seq_instr_event); diff --git a/sound/core/seq/seq_midi_emul.c b/sound/core/seq/seq_midi_emul.c index 17b3e6f13ca3..6645fc544621 100644 --- a/sound/core/seq/seq_midi_emul.c +++ b/sound/core/seq/seq_midi_emul.c @@ -229,13 +229,6 @@ snd_midi_process_event(struct snd_midi_op *ops, case SNDRV_SEQ_EVENT_PORT_START: case SNDRV_SEQ_EVENT_PORT_EXIT: case SNDRV_SEQ_EVENT_PORT_CHANGE: - case SNDRV_SEQ_EVENT_SAMPLE: - case SNDRV_SEQ_EVENT_SAMPLE_START: - case SNDRV_SEQ_EVENT_SAMPLE_STOP: - case SNDRV_SEQ_EVENT_SAMPLE_FREQ: - case SNDRV_SEQ_EVENT_SAMPLE_VOLUME: - case SNDRV_SEQ_EVENT_SAMPLE_LOOP: - case SNDRV_SEQ_EVENT_SAMPLE_POSITION: case SNDRV_SEQ_EVENT_ECHO: not_yet: default: diff --git a/sound/isa/gus/Makefile b/sound/isa/gus/Makefile index df3d59f25f5e..6cd4ee03754a 100644 --- a/sound/isa/gus/Makefile +++ b/sound/isa/gus/Makefile @@ -9,7 +9,6 @@ snd-gus-lib-objs := gus_main.o \ gus_pcm.o gus_mixer.o \ gus_uart.o \ gus_reset.o -snd-gus-synth-objs := gus_synth.o gus_sample.o gus_simple.o gus_instr.o snd-gusclassic-objs := gusclassic.o snd-gusextreme-objs := gusextreme.o @@ -17,20 +16,9 @@ snd-gusmax-objs := gusmax.o snd-interwave-objs := interwave.o snd-interwave-stb-objs := interwave-stb.o -# -# this function returns: -# "m" - CONFIG_SND_SEQUENCER is m -# - CONFIG_SND_SEQUENCER is undefined -# otherwise parameter #1 value -# -sequencer = $(if $(subst y,,$(CONFIG_SND_SEQUENCER)),$(if $(1),m),$(if $(CONFIG_SND_SEQUENCER),$(1))) - # Toplevel Module Dependency obj-$(CONFIG_SND_GUSCLASSIC) += snd-gusclassic.o snd-gus-lib.o obj-$(CONFIG_SND_GUSMAX) += snd-gusmax.o snd-gus-lib.o obj-$(CONFIG_SND_GUSEXTREME) += snd-gusextreme.o snd-gus-lib.o obj-$(CONFIG_SND_INTERWAVE) += snd-interwave.o snd-gus-lib.o obj-$(CONFIG_SND_INTERWAVE_STB) += snd-interwave-stb.o snd-gus-lib.o -obj-$(call sequencer,$(CONFIG_SND_GUS_SYNTH)) += snd-gus-synth.o - -obj-m := $(sort $(obj-m)) diff --git a/sound/isa/gus/gus_main.c b/sound/isa/gus/gus_main.c index b14d5d6d9a32..e4453e5e5c23 100644 --- a/sound/isa/gus/gus_main.c +++ b/sound/isa/gus/gus_main.c @@ -104,12 +104,6 @@ static int snd_gus_free(struct snd_gus_card *gus) { if (gus->gf1.res_port2 == NULL) goto __hw_end; -#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE)) - if (gus->seq_dev) { - snd_device_free(gus->card, gus->seq_dev); - gus->seq_dev = NULL; - } -#endif snd_gf1_stop(gus); snd_gus_init_dma_irq(gus, 0); __hw_end: @@ -408,14 +402,6 @@ static int snd_gus_check_version(struct snd_gus_card * gus) return 0; } -#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE)) -static void snd_gus_seq_dev_free(struct snd_seq_device *seq_dev) -{ - struct snd_gus_card *gus = seq_dev->private_data; - gus->seq_dev = NULL; -} -#endif - int snd_gus_initialize(struct snd_gus_card *gus) { int err; @@ -430,15 +416,6 @@ int snd_gus_initialize(struct snd_gus_card *gus) } if ((err = snd_gus_init_dma_irq(gus, 1)) < 0) 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(struct snd_gus_card *), &gus->seq_dev) >= 0) { - strcpy(gus->seq_dev->name, "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; - } -#endif snd_gf1_start(gus); gus->initialized = 1; return 0; diff --git a/sound/isa/gus/gus_sample.c b/sound/isa/gus/gus_sample.c deleted file mode 100644 index cba0829a7106..000000000000 --- a/sound/isa/gus/gus_sample.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Routines for Gravis UltraSound soundcards - Sample support - * Copyright (c) by Jaroslav Kysela - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include -#include -#include -#include - -/* - * - */ - -static void select_instrument(struct snd_gus_card * gus, struct snd_gus_voice * v) -{ - struct snd_seq_kinstr *instr; - -#if 0 - printk("select instrument: cluster = %li, std = 0x%x, bank = %i, prg = %i\n", - v->instr.cluster, - v->instr.std, - v->instr.bank, - v->instr.prg); -#endif - instr = snd_seq_instr_find(gus->gf1.ilist, &v->instr, 0, 1); - if (instr != NULL) { - if (instr->ops) { - if (!strcmp(instr->ops->instr_type, SNDRV_SEQ_INSTR_ID_SIMPLE)) - snd_gf1_simple_init(v); - } - snd_seq_instr_free_use(gus->gf1.ilist, instr); - } -} - -/* - * - */ - -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); - v->instr.std = ev->data.sample.param.sample.std; - if (v->instr.std & 0xff000000) { /* private instrument */ - v->instr.std &= 0x00ffffff; - v->instr.std |= (unsigned int)ev->source.client << 24; - } - v->instr.bank = ev->data.sample.param.sample.bank; - v->instr.prg = ev->data.sample.param.sample.prg; - select_instrument(p->gus, 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); - v->instr.cluster = ev->data.sample.param.cluster.cluster; - select_instrument(p->gus, 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(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(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(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(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(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(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)(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, - event_start, - event_stop, - event_freq, - event_volume, - event_loop, - event_position, - event_private1 -}; - -void snd_gus_sample_event(struct snd_seq_event *ev, struct snd_gus_port *p) -{ - int idx, voice; - struct snd_gus_card *gus = p->gus; - struct snd_gus_voice *v; - unsigned long flags; - - idx = ev->type - SNDRV_SEQ_EVENT_SAMPLE; - if (idx < 0 || idx > 8) - return; - for (voice = 0; voice < 32; voice++) { - v = &gus->gf1.voices[voice]; - if (v->use && v->client == ev->source.client && - v->port == ev->source.port && - v->index == ev->data.sample.channel) { - spin_lock_irqsave(&gus->event_lock, flags); - gus_sample_event_handlers[idx](ev, p, v); - spin_unlock_irqrestore(&gus->event_lock, flags); - return; - } - } -} diff --git a/sound/isa/gus/gus_simple.c b/sound/isa/gus/gus_simple.c deleted file mode 100644 index 39d121e2c8c4..000000000000 --- a/sound/isa/gus/gus_simple.c +++ /dev/null @@ -1,634 +0,0 @@ -/* - * Routines for Gravis UltraSound soundcards - Simple instrument handlers - * Copyright (c) by Jaroslav Kysela - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include -#include -#include -#include -#include "gus_tables.h" - -/* - * - */ - -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, - sample_volume, - sample_loop, - sample_pos, - sample_private1 -}; - -#if 0 - -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, - note_wait, - note_off, - note_volume, - note_pitchbend, - note_vibrato, - note_tremolo -}; - -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 ); - -static struct ULTRA_STRU_INSTRUMENT_CHANNEL_COMMANDS channel_commands = { - chn_trigger_down, - chn_trigger_up, - chn_control -}; - -#endif - -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(struct snd_gus_card *gus, struct snd_gus_voice *voice) -{ - spin_lock(&gus->event_lock); - snd_gf1_stop_voice(gus, voice->number); - spin_lock(&gus->reg_lock); - snd_gf1_select_voice(gus, voice->number); - snd_gf1_write16(gus, SNDRV_GF1_VW_VOLUME, 0); - spin_unlock(&gus->reg_lock); - voice->flags &= ~SNDRV_GF1_VFLG_RUNNING; - spin_unlock(&gus->event_lock); -} - -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) - do_volume_envelope(gus, voice); - else - snd_gf1_stop_voice(gus, voice->number); - spin_unlock(&gus->event_lock); -} - -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)) == - (SNDRV_GF1_VFLG_RUNNING|SNDRV_GF1_VFLG_EFFECT_TIMER1)) - do_pan_envelope(gus, voice); - spin_unlock(&gus->event_lock); -} - -/* - * - */ - -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; - unsigned long flags; - - if (!gus->gf1.volume_ramp) { - spin_lock_irqsave(&gus->reg_lock, flags); - snd_gf1_select_voice(gus, voice->number); - snd_gf1_ctrl_stop(gus, SNDRV_GF1_VB_VOLUME_CONTROL); - snd_gf1_write16(gus, SNDRV_GF1_VW_VOLUME, voice->gf1_volume); - /* printk("gf1_volume = 0x%x\n", voice->gf1_volume); */ - spin_unlock_irqrestore(&gus->reg_lock, flags); - return; - } - program_next_ramp = 0; - rate = next = 0; - while (1) { - program_next_ramp = 0; - rate = next = 0; - switch (voice->venv_state) { - case VENV_BEFORE: - voice->venv_state = VENV_ATTACK; - voice->venv_value_next = 0; - spin_lock_irqsave(&gus->reg_lock, flags); - snd_gf1_select_voice(gus, voice->number); - snd_gf1_ctrl_stop(gus, SNDRV_GF1_VB_VOLUME_CONTROL); - snd_gf1_write16(gus, SNDRV_GF1_VW_VOLUME, SNDRV_GF1_MIN_VOLUME); - spin_unlock_irqrestore(&gus->reg_lock, flags); - break; - case VENV_ATTACK: - voice->venv_state = VENV_SUSTAIN; - program_next_ramp++; - next = 255; - rate = gus->gf1.volume_ramp; - break; - case VENV_SUSTAIN: - voice->venv_state = VENV_RELEASE; - spin_lock_irqsave(&gus->reg_lock, flags); - snd_gf1_select_voice(gus, voice->number); - snd_gf1_ctrl_stop(gus, SNDRV_GF1_VB_VOLUME_CONTROL); - snd_gf1_write16(gus, SNDRV_GF1_VW_VOLUME, ((int)voice->gf1_volume * (int)voice->venv_value_next) / 255); - spin_unlock_irqrestore(&gus->reg_lock, flags); - return; - case VENV_RELEASE: - voice->venv_state = VENV_DONE; - program_next_ramp++; - next = 0; - rate = gus->gf1.volume_ramp; - break; - case VENV_DONE: - snd_gf1_stop_voice(gus, voice->number); - voice->flags &= ~SNDRV_GF1_VFLG_RUNNING; - return; - case VENV_VOLUME: - program_next_ramp++; - next = voice->venv_value_next; - rate = gus->gf1.volume_ramp; - voice->venv_state = voice->venv_state_prev; - break; - } - voice->venv_value_next = next; - if (!program_next_ramp) - continue; - spin_lock_irqsave(&gus->reg_lock, flags); - snd_gf1_select_voice(gus, voice->number); - snd_gf1_ctrl_stop(gus, SNDRV_GF1_VB_VOLUME_CONTROL); - old_volume = snd_gf1_read16(gus, SNDRV_GF1_VW_VOLUME) >> 8; - if (!rate) { - spin_unlock_irqrestore(&gus->reg_lock, flags); - continue; - } - next = (((int)voice->gf1_volume * (int)next) / 255) >> 8; - if (old_volume < SNDRV_GF1_MIN_OFFSET) - old_volume = SNDRV_GF1_MIN_OFFSET; - if (next < SNDRV_GF1_MIN_OFFSET) - next = SNDRV_GF1_MIN_OFFSET; - if (next > SNDRV_GF1_MAX_OFFSET) - next = SNDRV_GF1_MAX_OFFSET; - if (old_volume == next) { - spin_unlock_irqrestore(&gus->reg_lock, flags); - continue; - } - voice->volume_control &= ~0xc3; - voice->volume_control |= 0x20; - if (old_volume > next) { - snd_gf1_write8(gus, SNDRV_GF1_VB_VOLUME_START, next); - snd_gf1_write8(gus, SNDRV_GF1_VB_VOLUME_END, old_volume); - voice->volume_control |= 0x40; - } else { - snd_gf1_write8(gus, SNDRV_GF1_VB_VOLUME_START, old_volume); - snd_gf1_write8(gus, SNDRV_GF1_VB_VOLUME_END, next); - } - snd_gf1_write8(gus, SNDRV_GF1_VB_VOLUME_RATE, rate); - snd_gf1_write8(gus, SNDRV_GF1_VB_VOLUME_CONTROL, voice->volume_control); - if (!gus->gf1.enh_mode) { - snd_gf1_delay(gus); - snd_gf1_write8(gus, SNDRV_GF1_VB_VOLUME_CONTROL, voice->volume_control); - } - spin_unlock_irqrestore(&gus->reg_lock, flags); - return; - } -} - -static void do_pan_envelope(struct snd_gus_card *gus, struct snd_gus_voice *voice) -{ - unsigned long flags; - unsigned char old_pan; - -#if 0 - snd_gf1_select_voice(gus, voice->number); - printk(" -%i- do_pan_envelope - flags = 0x%x (0x%x -> 0x%x)\n", - voice->number, - voice->flags, - voice->gf1_pan, - snd_gf1_i_read8(gus, SNDRV_GF1_VB_PAN) & 0x0f); -#endif - if (gus->gf1.enh_mode) { - voice->flags &= ~(SNDRV_GF1_VFLG_EFFECT_TIMER1|SNDRV_GF1_VFLG_PAN); - return; - } - if (!gus->gf1.smooth_pan) { - spin_lock_irqsave(&gus->reg_lock, flags); - snd_gf1_select_voice(gus, voice->number); - snd_gf1_write8(gus, SNDRV_GF1_VB_PAN, voice->gf1_pan); - spin_unlock_irqrestore(&gus->reg_lock, flags); - return; - } - if (!(voice->flags & SNDRV_GF1_VFLG_PAN)) /* before */ - voice->flags |= SNDRV_GF1_VFLG_EFFECT_TIMER1|SNDRV_GF1_VFLG_PAN; - spin_lock_irqsave(&gus->reg_lock, flags); - snd_gf1_select_voice(gus, voice->number); - old_pan = snd_gf1_read8(gus, SNDRV_GF1_VB_PAN) & 0x0f; - if (old_pan > voice->gf1_pan ) - old_pan--; - if (old_pan < voice->gf1_pan) - old_pan++; - snd_gf1_write8(gus, SNDRV_GF1_VB_PAN, old_pan); - spin_unlock_irqrestore(&gus->reg_lock, flags); - if (old_pan == voice->gf1_pan) /* the goal was reached */ - voice->flags &= ~(SNDRV_GF1_VFLG_EFFECT_TIMER1|SNDRV_GF1_VFLG_PAN); -#if 0 - snd_gf1_select_voice(gus, voice->number); - printk(" -%i- (1) do_pan_envelope - flags = 0x%x (0x%x -> 0x%x)\n", - voice->number, - voice->flags, - voice->gf1_pan, - snd_gf1_i_read8(gus, GF1_VB_PAN) & 0x0f); -#endif -} - -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; - - vlo = SNDRV_GF1_ATTEN((SNDRV_GF1_ATTEN_TABLE_SIZE-1) - pan); - vro = SNDRV_GF1_ATTEN(pan); - if (pan != SNDRV_GF1_ATTEN_TABLE_SIZE - 1 && pan != 0) { - vlo >>= 1; - vro >>= 1; - } - vlo <<= 4; - vro <<= 4; -#if 0 - printk("vlo = 0x%x (0x%x), vro = 0x%x (0x%x)\n", - vlo, snd_gf1_i_read16(gus, GF1_VW_OFFSET_LEFT), - vro, snd_gf1_i_read16(gus, GF1_VW_OFFSET_RIGHT)); -#endif - spin_lock_irqsave(&gus->reg_lock, flags); - snd_gf1_select_voice(gus, voice->number); - snd_gf1_write16(gus, SNDRV_GF1_VW_OFFSET_LEFT_FINAL, vlo); - snd_gf1_write16(gus, SNDRV_GF1_VW_OFFSET_RIGHT_FINAL, vro); - spin_unlock_irqrestore(&gus->reg_lock, flags); - voice->vlo = vlo; - voice->vro = vro; -} - -/* - * - */ - -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; - struct simple_instrument *simple; - struct snd_seq_kinstr *instr; - - instr = snd_seq_instr_find(gus->gf1.ilist, &voice->instr, 0, 1); - if (instr == NULL) - return; - voice->instr = instr->instr; /* copy ID to speedup aliases */ - simple = KINSTR_DATA(instr); - begin = simple->address.memory << 4; - w_16 = simple->format & SIMPLE_WAVE_16BIT ? 0x04 : 0; - addr_start = simple->loop_start; - if (simple->format & SIMPLE_WAVE_LOOP) { - addr_end = simple->loop_end; - } else { - addr_end = (simple->size << 4) - (w_16 ? 40 : 24); - } - if (simple->format & SIMPLE_WAVE_BACKWARD) { - addr = simple->loop_end; - if (position < simple->loop_end) - addr -= position; - } else { - addr = position; - } - voice->control = 0x00; - voice->mode = 0x20; /* enable offset registers */ - if (simple->format & SIMPLE_WAVE_16BIT) - voice->control |= 0x04; - if (simple->format & SIMPLE_WAVE_BACKWARD) - voice->control |= 0x40; - if (simple->format & SIMPLE_WAVE_LOOP) { - voice->control |= 0x08; - } else { - voice->control |= 0x20; - } - if (simple->format & SIMPLE_WAVE_BIDIR) - voice->control |= 0x10; - if (simple->format & SIMPLE_WAVE_ULAW) - voice->mode |= 0x40; - if (w_16) { - addr = ((addr << 1) & ~0x1f) | (addr & 0x0f); - addr_start = ((addr_start << 1) & ~0x1f) | (addr_start & 0x0f); - addr_end = ((addr_end << 1) & ~0x1f) | (addr_end & 0x0f); - } - addr += begin; - addr_start += begin; - addr_end += begin; - snd_gf1_stop_voice(gus, voice->number); - spin_lock_irqsave(&gus->reg_lock, flags); - snd_gf1_select_voice(gus, voice->number); - snd_gf1_write16(gus, SNDRV_GF1_VW_FREQUENCY, voice->fc_register + voice->fc_lfo); - voice->venv_state = VENV_BEFORE; - voice->volume_control = 0x03; - snd_gf1_write_addr(gus, SNDRV_GF1_VA_START, addr_start, w_16); - snd_gf1_write_addr(gus, SNDRV_GF1_VA_END, addr_end, w_16); - snd_gf1_write_addr(gus, SNDRV_GF1_VA_CURRENT, addr, w_16); - if (!gus->gf1.enh_mode) { - snd_gf1_write8(gus, SNDRV_GF1_VB_PAN, voice->gf1_pan); - } else { - snd_gf1_write16(gus, SNDRV_GF1_VW_OFFSET_LEFT, voice->vlo); - snd_gf1_write16(gus, SNDRV_GF1_VW_OFFSET_LEFT_FINAL, voice->vlo); - snd_gf1_write16(gus, SNDRV_GF1_VW_OFFSET_RIGHT, voice->vro); - snd_gf1_write16(gus, SNDRV_GF1_VW_OFFSET_RIGHT_FINAL, voice->vro); - snd_gf1_write8(gus, SNDRV_GF1_VB_ACCUMULATOR, voice->effect_accumulator); - snd_gf1_write16(gus, SNDRV_GF1_VW_EFFECT_VOLUME, voice->gf1_effect_volume); - snd_gf1_write16(gus, SNDRV_GF1_VW_EFFECT_VOLUME_FINAL, voice->gf1_effect_volume); - } - spin_unlock_irqrestore(&gus->reg_lock, flags); - do_volume_envelope(gus, voice); - spin_lock_irqsave(&gus->reg_lock, flags); - snd_gf1_select_voice(gus, voice->number); - if (gus->gf1.enh_mode) - snd_gf1_write8(gus, SNDRV_GF1_VB_MODE, voice->mode); - snd_gf1_write8(gus, SNDRV_GF1_VB_ADDRESS_CONTROL, voice->control); - if (!gus->gf1.enh_mode) { - snd_gf1_delay(gus); - snd_gf1_write8(gus, SNDRV_GF1_VB_ADDRESS_CONTROL, voice->control ); - } - spin_unlock_irqrestore(&gus->reg_lock, flags); -#if 0 - snd_gf1_print_voice_registers(gus); -#endif - voice->flags |= SNDRV_GF1_VFLG_RUNNING; - snd_seq_instr_free_use(gus->gf1.ilist, instr); -} - -static void sample_stop(struct snd_gus_card *gus, struct snd_gus_voice *voice, int mode) -{ - unsigned char control; - unsigned long flags; - - if (!(voice->flags & SNDRV_GF1_VFLG_RUNNING)) - return; - switch (mode) { - default: - if (gus->gf1.volume_ramp > 0) { - if (voice->venv_state < VENV_RELEASE) { - voice->venv_state = VENV_RELEASE; - do_volume_envelope(gus, voice); - } - } - if (mode != SAMPLE_STOP_VENVELOPE) { - snd_gf1_stop_voice(gus, voice->number); - spin_lock_irqsave(&gus->reg_lock, flags); - snd_gf1_select_voice(gus, voice->number); - snd_gf1_write16(gus, SNDRV_GF1_VW_VOLUME, SNDRV_GF1_MIN_VOLUME); - spin_unlock_irqrestore(&gus->reg_lock, flags); - voice->flags &= ~SNDRV_GF1_VFLG_RUNNING; - } - break; - case SAMPLE_STOP_LOOP: /* disable loop only */ - spin_lock_irqsave(&gus->reg_lock, flags); - snd_gf1_select_voice(gus, voice->number); - control = snd_gf1_read8(gus, SNDRV_GF1_VB_ADDRESS_CONTROL); - control &= ~(0x83 | 0x04); - control |= 0x20; - snd_gf1_write8(gus, SNDRV_GF1_VB_ADDRESS_CONTROL, control); - spin_unlock_irqrestore(&gus->reg_lock, flags); - break; - } -} - -static void sample_freq(struct snd_gus_card *gus, struct snd_gus_voice *voice, snd_seq_frequency_t freq) -{ - unsigned long flags; - - spin_lock_irqsave(&gus->reg_lock, flags); - voice->fc_register = snd_gf1_translate_freq(gus, freq); - snd_gf1_select_voice(gus, voice->number); - snd_gf1_write16(gus, SNDRV_GF1_VW_FREQUENCY, voice->fc_register + voice->fc_lfo); - spin_unlock_irqrestore(&gus->reg_lock, flags); -} - -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; - voice->gf1_volume = snd_gf1_lvol_to_gvol_raw(volume->volume << 2) << 4; - voice->venv_state_prev = VENV_SUSTAIN; - voice->venv_state = VENV_VOLUME; - do_volume_envelope(gus, voice); - } - if (volume->lr >= 0) { - volume->lr &= 0x3fff; - if (!gus->gf1.enh_mode) { - voice->gf1_pan = (volume->lr >> 10) & 15; - if (!gus->gf1.full_range_pan) { - if (voice->gf1_pan == 0) - voice->gf1_pan++; - if (voice->gf1_pan == 15) - voice->gf1_pan--; - } - voice->flags &= ~SNDRV_GF1_VFLG_PAN; /* before */ - do_pan_envelope(gus, voice); - } else { - set_enhanced_pan(gus, voice, volume->lr >> 7); - } - } -} - -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; - 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); -#endif - instr = snd_seq_instr_find(gus->gf1.ilist, &voice->instr, 0, 1); - if (instr == NULL) - return; - voice->instr = instr->instr; /* copy ID to speedup aliases */ - simple = KINSTR_DATA(instr); - begin = simple->address.memory; - addr_start = loop->start; - addr_end = loop->end; - addr_start = (((addr_start << 1) & ~0x1f) | (addr_start & 0x0f)) + begin; - addr_end = (((addr_end << 1) & ~0x1f) | (addr_end & 0x0f)) + begin; - spin_lock_irqsave(&gus->reg_lock, flags); - snd_gf1_select_voice(gus, voice->number); - snd_gf1_write_addr(gus, SNDRV_GF1_VA_START, addr_start, w_16); - snd_gf1_write_addr(gus, SNDRV_GF1_VA_END, addr_end, w_16); - spin_unlock_irqrestore(&gus->reg_lock, flags); - snd_seq_instr_free_use(gus->gf1.ilist, instr); -} - -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; - 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); -#endif - instr = snd_seq_instr_find(gus->gf1.ilist, &voice->instr, 0, 1); - if (instr == NULL) - return; - voice->instr = instr->instr; /* copy ID to speedup aliases */ - simple = KINSTR_DATA(instr); - begin = simple->address.memory; - addr = (((position << 1) & ~0x1f) | (position & 0x0f)) + begin; - spin_lock_irqsave(&gus->reg_lock, flags); - snd_gf1_select_voice(gus, voice->number); - snd_gf1_write_addr(gus, SNDRV_GF1_VA_CURRENT, addr, w_16); - spin_unlock_irqrestore(&gus->reg_lock, flags); - snd_seq_instr_free_use(gus->gf1.ilist, instr); -} - -#if 0 - -static unsigned char get_effects_mask( ultra_card_t *card, int value ) -{ - if ( value > 7 ) return 0; - if ( card -> gf1.effects && card -> gf1.effects -> chip_type == ULTRA_EFFECT_CHIP_INTERWAVE ) - return card -> gf1.effects -> chip.interwave.voice_output[ value ]; - return 0; -} - -#endif - -static void sample_private1(struct snd_gus_card *card, struct snd_gus_voice *voice, unsigned char *data) -{ -#if 0 - unsigned long flags; - unsigned char uc; - - switch ( *data ) { - case ULTRA_PRIV1_IW_EFFECT: - uc = get_effects_mask( card, ultra_get_byte( data, 4 ) ); - uc |= get_effects_mask( card, ultra_get_byte( data, 4 ) >> 4 ); - uc |= get_effects_mask( card, ultra_get_byte( data, 5 ) ); - uc |= get_effects_mask( card, ultra_get_byte( data, 5 ) >> 4 ); - voice -> data.simple.effect_accumulator = uc; - voice -> data.simple.effect_volume = ultra_translate_voice_volume( card, ultra_get_word( data, 2 ) ) << 4; - if ( !card -> gf1.enh_mode ) return; - if ( voice -> flags & VFLG_WAIT_FOR_START ) return; - if ( voice -> flags & VFLG_RUNNING ) - { - CLI( &flags ); - gf1_select_voice( card, voice -> number ); - ultra_write8( card, GF1_VB_ACCUMULATOR, voice -> data.simple.effect_accumulator ); - ultra_write16( card, GF1_VW_EFFECT_VOLUME_FINAL, voice -> data.simple.effect_volume ); - STI( &flags ); - } - break; - case ULTRA_PRIV1_IW_LFO: - ultra_lfo_command( card, voice -> number, data ); - } -#endif -} - -#if 0 - -/* - * - */ - -static void note_stop( ultra_card_t *card, ultra_voice_t *voice, int wait ) -{ -} - -static void note_wait( ultra_card_t *card, ultra_voice_t *voice ) -{ -} - -static void note_off( ultra_card_t *card, ultra_voice_t *voice ) -{ -} - -static void note_volume( ultra_card_t *card, ultra_voice_t *voice ) -{ -} - -static void note_pitchbend( ultra_card_t *card, ultra_voice_t *voice ) -{ -} - -static void note_vibrato( ultra_card_t *card, ultra_voice_t *voice ) -{ -} - -static void note_tremolo( ultra_card_t *card, ultra_voice_t *voice ) -{ -} - -/* - * - */ - -static void chn_trigger_down( ultra_card_t *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 ) -{ -} - -/* - * - */ - -#endif - -void snd_gf1_simple_init(struct snd_gus_voice *voice) -{ - voice->handler_wave = interrupt_wave; - voice->handler_volume = interrupt_volume; - voice->handler_effect = interrupt_effect; - voice->volume_change = NULL; - voice->sample_ops = &sample_ops; -} diff --git a/sound/isa/gus/gus_synth.c b/sound/isa/gus/gus_synth.c deleted file mode 100644 index 2c2051782aa2..000000000000 --- a/sound/isa/gus/gus_synth.c +++ /dev/null @@ -1,314 +0,0 @@ -/* - * Routines for Gravis UltraSound soundcards - Synthesizer - * Copyright (c) by Jaroslav Kysela - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include -#include -#include -#include -#include -#include - -MODULE_AUTHOR("Jaroslav Kysela "); -MODULE_DESCRIPTION("Routines for Gravis UltraSound soundcards - Synthesizer"); -MODULE_LICENSE("GPL"); - -/* - * - */ - -static void snd_gus_synth_free_voices(struct snd_gus_card * gus, int client, int port) -{ - int idx; - struct snd_gus_voice * voice; - - for (idx = 0; idx < 32; idx++) { - voice = &gus->gf1.voices[idx]; - if (voice->use && voice->client == client && voice->port == port) - snd_gf1_free_voice(gus, voice); - } -} - -static int snd_gus_synth_use(void *private_data, struct snd_seq_port_subscribe *info) -{ - 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) - return -EINVAL; - mutex_lock(&gus->register_mutex); - if (!snd_gus_use_inc(gus)) { - mutex_unlock(&gus->register_mutex); - return -EFAULT; - } - for (idx = 0; idx < info->voices; idx++) { - voice = snd_gf1_alloc_voice(gus, SNDRV_GF1_VOICE_TYPE_SYNTH, info->sender.client, info->sender.port); - if (voice == NULL) { - snd_gus_synth_free_voices(gus, info->sender.client, info->sender.port); - snd_gus_use_dec(gus); - mutex_unlock(&gus->register_mutex); - return -EBUSY; - } - voice->index = idx; - } - mutex_unlock(&gus->register_mutex); - return 0; -} - -static int snd_gus_synth_unuse(void *private_data, struct snd_seq_port_subscribe *info) -{ - struct snd_gus_port * port = private_data; - struct snd_gus_card * gus = port->gus; - - mutex_lock(&gus->register_mutex); - snd_gus_synth_free_voices(gus, info->sender.client, info->sender.port); - snd_gus_use_dec(gus); - mutex_unlock(&gus->register_mutex); - return 0; -} - -/* - * - */ - -static void snd_gus_synth_free_private_instruments(struct snd_gus_port *p, int client) -{ - 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(struct snd_seq_event *ev, int direct, - void *private_data, int atomic, int hop) -{ - struct snd_gus_port * p = private_data; - - snd_assert(p != NULL, return -EINVAL); - if (ev->type >= SNDRV_SEQ_EVENT_SAMPLE && - ev->type <= SNDRV_SEQ_EVENT_SAMPLE_PRIVATE1) { - snd_gus_sample_event(ev, p); - return 0; - } - if (ev->source.client == SNDRV_SEQ_CLIENT_SYSTEM && - ev->source.port == SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE) { - if (ev->type == SNDRV_SEQ_EVENT_CLIENT_EXIT) { - snd_gus_synth_free_private_instruments(p, ev->data.addr.client); - return 0; - } - } - if (direct) { - if (ev->type >= SNDRV_SEQ_EVENT_INSTR_BEGIN) { - snd_seq_instr_event(&p->gus->gf1.iwffff_ops.kops, - p->gus->gf1.ilist, - ev, - p->gus->gf1.seq_client, - atomic, hop); - return 0; - } - } - return 0; -} - -static void snd_gus_synth_instr_notify(void *private_data, - struct snd_seq_kinstr *instr, - int what) -{ - unsigned int idx; - struct snd_gus_card *gus = private_data; - struct snd_gus_voice *pvoice; - unsigned long flags; - - spin_lock_irqsave(&gus->event_lock, flags); - for (idx = 0; idx < 32; idx++) { - pvoice = &gus->gf1.voices[idx]; - if (pvoice->use && !memcmp(&pvoice->instr, &instr->instr, sizeof(pvoice->instr))) { - if (pvoice->sample_ops && pvoice->sample_ops->sample_stop) { - pvoice->sample_ops->sample_stop(gus, pvoice, SAMPLE_STOP_IMMEDIATELY); - } else { - snd_gf1_stop_voice(gus, pvoice->number); - pvoice->flags &= ~SNDRV_GF1_VFLG_RUNNING; - } - } - } - spin_unlock_irqrestore(&gus->event_lock, flags); -} - -/* - * - */ - -static void snd_gus_synth_free_port(void *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(struct snd_gus_card * gus, int idx) -{ - struct snd_gus_port * p; - struct snd_seq_port_callback callbacks; - char name[32]; - int result; - - p = &gus->gf1.seq_ports[idx]; - p->chset = snd_midi_channel_alloc_set(16); - if (p->chset == NULL) - return -ENOMEM; - p->chset->private_data = p; - p->gus = gus; - p->client = gus->gf1.seq_client; - - memset(&callbacks, 0, sizeof(callbacks)); - callbacks.owner = THIS_MODULE; - callbacks.use = snd_gus_synth_use; - callbacks.unuse = snd_gus_synth_unuse; - callbacks.event_input = snd_gus_synth_event_input; - callbacks.private_free = snd_gus_synth_free_port; - callbacks.private_data = p; - - sprintf(name, "%s port %i", gus->interwave ? "AMD InterWave" : "GF1", idx); - p->chset->port = snd_seq_event_port_attach(gus->gf1.seq_client, - &callbacks, - SNDRV_SEQ_PORT_CAP_WRITE | SNDRV_SEQ_PORT_CAP_SUBS_WRITE, - SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE | - SNDRV_SEQ_PORT_TYPE_SYNTH | - SNDRV_SEQ_PORT_TYPE_HARDWARE | - SNDRV_SEQ_PORT_TYPE_SYNTHESIZER, - 16, 0, - name); - if (p->chset->port < 0) { - result = p->chset->port; - snd_gus_synth_free_port(p); - return result; - } - p->port = p->chset->port; - return 0; -} - -/* - * - */ - -static int snd_gus_synth_new_device(struct snd_seq_device *dev) -{ - struct snd_gus_card *gus; - int client, i; - 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; - - mutex_init(&gus->register_mutex); - gus->gf1.seq_client = -1; - - /* allocate new client */ - client = gus->gf1.seq_client = - snd_seq_create_kernel_client(gus->card, 1, gus->interwave ? - "AMD InterWave" : "GF1"); - if (client < 0) - return client; - - for (i = 0; i < 4; i++) - snd_gus_synth_create_port(gus, i); - - gus->gf1.ilist = snd_seq_instr_list_new(); - if (gus->gf1.ilist == NULL) { - snd_seq_delete_kernel_client(client); - gus->gf1.seq_client = -1; - return -ENOMEM; - } - gus->gf1.ilist->flags = SNDRV_SEQ_INSTR_FLG_DIRECT; - - simpleops = &gus->gf1.simple_ops; - snd_seq_simple_init(simpleops, gus, NULL); - simpleops->put_sample = snd_gus_simple_put_sample; - simpleops->get_sample = snd_gus_simple_get_sample; - simpleops->remove_sample = snd_gus_simple_remove_sample; - simpleops->notify = snd_gus_synth_instr_notify; - - gf1ops = &gus->gf1.gf1_ops; - snd_seq_gf1_init(gf1ops, gus, &simpleops->kops); - gf1ops->put_sample = snd_gus_gf1_put_sample; - gf1ops->get_sample = snd_gus_gf1_get_sample; - gf1ops->remove_sample = snd_gus_gf1_remove_sample; - gf1ops->notify = snd_gus_synth_instr_notify; - - iwops = &gus->gf1.iwffff_ops; - snd_seq_iwffff_init(iwops, gus, &gf1ops->kops); - iwops->put_sample = snd_gus_iwffff_put_sample; - iwops->get_sample = snd_gus_iwffff_get_sample; - iwops->remove_sample = snd_gus_iwffff_remove_sample; - iwops->notify = snd_gus_synth_instr_notify; - - memset(&sub, 0, sizeof(sub)); - sub.sender.client = SNDRV_SEQ_CLIENT_SYSTEM; - sub.sender.port = SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE; - sub.dest.client = client; - sub.dest.port = 0; - snd_seq_kernel_client_ctl(client, SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT, &sub); - - return 0; -} - -static int snd_gus_synth_delete_device(struct snd_seq_device *dev) -{ - struct snd_gus_card *gus; - - gus = *(struct snd_gus_card **)SNDRV_SEQ_DEVICE_ARGPTR(dev); - if (gus == NULL) - return -EINVAL; - - if (gus->gf1.seq_client >= 0) { - snd_seq_delete_kernel_client(gus->gf1.seq_client); - gus->gf1.seq_client = -1; - } - if (gus->gf1.ilist) - snd_seq_instr_list_free(&gus->gf1.ilist); - return 0; -} - -static int __init alsa_gus_synth_init(void) -{ - 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(struct snd_gus_card *)); -} - -static void __exit alsa_gus_synth_exit(void) -{ - snd_seq_device_unregister_driver(SNDRV_SEQ_DEV_ID_GUS); -} - -module_init(alsa_gus_synth_init) -module_exit(alsa_gus_synth_exit) diff --git a/sound/pci/trident/Makefile b/sound/pci/trident/Makefile index 65f2c218324c..88676b50f385 100644 --- a/sound/pci/trident/Makefile +++ b/sound/pci/trident/Makefile @@ -4,16 +4,6 @@ # snd-trident-objs := trident.o trident_main.o trident_memory.o -snd-trident-synth-objs := trident_synth.o - -# -# this function returns: -# "m" - CONFIG_SND_SEQUENCER is m -# - CONFIG_SND_SEQUENCER is undefined -# otherwise parameter #1 value -# -sequencer = $(if $(subst y,,$(CONFIG_SND_SEQUENCER)),$(if $(1),m),$(if $(CONFIG_SND_SEQUENCER),$(1))) # Toplevel Module Dependency obj-$(CONFIG_SND_TRIDENT) += snd-trident.o -obj-$(call sequencer,$(CONFIG_SND_TRIDENT)) += snd-trident-synth.o diff --git a/sound/pci/trident/trident.c b/sound/pci/trident/trident.c index 84884567df6a..6193c7e4d798 100644 --- a/sound/pci/trident/trident.c +++ b/sound/pci/trident/trident.c @@ -155,13 +155,6 @@ static int __devinit snd_trident_probe(struct pci_dev *pci, return err; } -#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE)) - if ((err = snd_trident_attach_synthesizer(trident)) < 0) { - snd_card_free(card); - return err; - } -#endif - snd_trident_create_gameport(trident); if ((err = snd_card_register(card)) < 0) { diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c index a235e034a690..59a319568ae5 100644 --- a/sound/pci/trident/trident_main.c +++ b/sound/pci/trident/trident_main.c @@ -3313,12 +3313,6 @@ static void snd_trident_proc_read(struct snd_info_entry *entry, snd_iprintf(buffer, "Memory Free : %d\n", snd_util_mem_avail(trident->tlb.memhdr)); } } -#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE)) - snd_iprintf(buffer,"\nWavetable Synth\n"); - snd_iprintf(buffer, "Memory Maximum : %d\n", trident->synth.max_size); - snd_iprintf(buffer, "Memory Used : %d\n", trident->synth.current_size); - snd_iprintf(buffer, "Memory Free : %d\n", (trident->synth.max_size-trident->synth.current_size)); -#endif } static void __devinit snd_trident_proc_init(struct snd_trident * trident) @@ -3815,28 +3809,6 @@ static irqreturn_t snd_trident_interrupt(int irq, void *dev_id) return IRQ_HANDLED; } -/*--------------------------------------------------------------------------- - snd_trident_attach_synthesizer - - Description: Attach synthesizer hooks - - Paramters: trident - device specific private data for 4DWave card - - Returns: None. - - ---------------------------------------------------------------------------*/ -int snd_trident_attach_synthesizer(struct snd_trident *trident) -{ -#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE)) - if (snd_seq_device_new(trident->card, 1, SNDRV_SEQ_DEV_ID_TRIDENT, - sizeof(struct snd_trident *), &trident->seq_dev) >= 0) { - strcpy(trident->seq_dev->name, "4DWave"); - *(struct snd_trident **)SNDRV_SEQ_DEVICE_ARGPTR(trident->seq_dev) = trident; - } -#endif - return 0; -} - struct snd_trident_voice *snd_trident_alloc_voice(struct snd_trident * trident, int type, int client, int port) { struct snd_trident_voice *pvoice; diff --git a/sound/pci/trident/trident_synth.c b/sound/pci/trident/trident_synth.c deleted file mode 100644 index 9b7dee84743b..000000000000 --- a/sound/pci/trident/trident_synth.c +++ /dev/null @@ -1,1024 +0,0 @@ -/* - * Routines for Trident 4DWave NX/DX soundcards - Synthesizer - * Copyright (c) by Scott McNab - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -MODULE_AUTHOR("Scott McNab "); -MODULE_DESCRIPTION("Routines for Trident 4DWave NX/DX soundcards - Synthesizer"); -MODULE_LICENSE("GPL"); - -/* linear to log pan conversion table (4.2 channel attenuation format) */ -static unsigned int pan_table[63] = { - 7959, 7733, 7514, 7301, 7093, 6892, 6697, 6507, - 6322, 6143, 5968, 5799, 5634, 5475, 5319, 5168, - 5022, 4879, 4741, 4606, 4475, 4349, 4225, 4105, - 3989, 3876, 3766, 3659, 3555, 3454, 3356, 3261, - 3168, 3078, 2991, 2906, 2824, 2744, 2666, 2590, - 2517, 2445, 2376, 2308, 2243, 2179, 2117, 2057, - 1999, 1942, 1887, 1833, 1781, 1731, 1682, 1634, - 1588, 1543, 1499, 1456, 1415, 1375, 1336 -}; - -#define LOG_TABLE_SIZE 386 - -/* Linear half-attenuation to log conversion table in the format: - * {linear volume, logarithmic attenuation equivalent}, ... - * - * Provides conversion from a linear half-volume value in the range - * [0,8192] to a logarithmic attenuation value in the range 0 to 6.02dB. - * Halving the linear volume is equivalent to an additional 6dB of - * logarithmic attenuation. The algorithm used in log_from_linear() - * therefore uses this table as follows: - * - * - loop and for every time the volume is less than half the maximum - * volume (16384), add another 6dB and halve the maximum value used - * for this comparison. - * - when the volume is greater than half the maximum volume, take - * the difference of the volume to half volume (in the range [0,8192]) - * and look up the log_table[] to find the nearest entry. - * - take the logarithic component of this entry and add it to the - * resulting attenuation. - * - * Thus this routine provides a linear->log conversion for a range of - * [0,16384] using only 386 table entries - * - * Note: although this table stores log attenuation in 8.8 format, values - * were only calculated for 6 bits fractional precision, since that is - * the most precision offered by the trident hardware. - */ - -static unsigned short log_table[LOG_TABLE_SIZE*2] = -{ - 4, 0x0604, 19, 0x0600, 34, 0x05fc, - 49, 0x05f8, 63, 0x05f4, 78, 0x05f0, 93, 0x05ec, 108, 0x05e8, - 123, 0x05e4, 138, 0x05e0, 153, 0x05dc, 168, 0x05d8, 183, 0x05d4, - 198, 0x05d0, 213, 0x05cc, 228, 0x05c8, 244, 0x05c4, 259, 0x05c0, - 274, 0x05bc, 289, 0x05b8, 304, 0x05b4, 320, 0x05b0, 335, 0x05ac, - 350, 0x05a8, 366, 0x05a4, 381, 0x05a0, 397, 0x059c, 412, 0x0598, - 428, 0x0594, 443, 0x0590, 459, 0x058c, 474, 0x0588, 490, 0x0584, - 506, 0x0580, 521, 0x057c, 537, 0x0578, 553, 0x0574, 568, 0x0570, - 584, 0x056c, 600, 0x0568, 616, 0x0564, 632, 0x0560, 647, 0x055c, - 663, 0x0558, 679, 0x0554, 695, 0x0550, 711, 0x054c, 727, 0x0548, - 743, 0x0544, 759, 0x0540, 776, 0x053c, 792, 0x0538, 808, 0x0534, - 824, 0x0530, 840, 0x052c, 857, 0x0528, 873, 0x0524, 889, 0x0520, - 906, 0x051c, 922, 0x0518, 938, 0x0514, 955, 0x0510, 971, 0x050c, - 988, 0x0508, 1004, 0x0504, 1021, 0x0500, 1037, 0x04fc, 1054, 0x04f8, - 1071, 0x04f4, 1087, 0x04f0, 1104, 0x04ec, 1121, 0x04e8, 1138, 0x04e4, - 1154, 0x04e0, 1171, 0x04dc, 1188, 0x04d8, 1205, 0x04d4, 1222, 0x04d0, - 1239, 0x04cc, 1256, 0x04c8, 1273, 0x04c4, 1290, 0x04c0, 1307, 0x04bc, - 1324, 0x04b8, 1341, 0x04b4, 1358, 0x04b0, 1376, 0x04ac, 1393, 0x04a8, - 1410, 0x04a4, 1427, 0x04a0, 1445, 0x049c, 1462, 0x0498, 1479, 0x0494, - 1497, 0x0490, 1514, 0x048c, 1532, 0x0488, 1549, 0x0484, 1567, 0x0480, - 1584, 0x047c, 1602, 0x0478, 1620, 0x0474, 1637, 0x0470, 1655, 0x046c, - 1673, 0x0468, 1690, 0x0464, 1708, 0x0460, 1726, 0x045c, 1744, 0x0458, - 1762, 0x0454, 1780, 0x0450, 1798, 0x044c, 1816, 0x0448, 1834, 0x0444, - 1852, 0x0440, 1870, 0x043c, 1888, 0x0438, 1906, 0x0434, 1924, 0x0430, - 1943, 0x042c, 1961, 0x0428, 1979, 0x0424, 1997, 0x0420, 2016, 0x041c, - 2034, 0x0418, 2053, 0x0414, 2071, 0x0410, 2089, 0x040c, 2108, 0x0408, - 2127, 0x0404, 2145, 0x0400, 2164, 0x03fc, 2182, 0x03f8, 2201, 0x03f4, - 2220, 0x03f0, 2239, 0x03ec, 2257, 0x03e8, 2276, 0x03e4, 2295, 0x03e0, - 2314, 0x03dc, 2333, 0x03d8, 2352, 0x03d4, 2371, 0x03d0, 2390, 0x03cc, - 2409, 0x03c8, 2428, 0x03c4, 2447, 0x03c0, 2466, 0x03bc, 2485, 0x03b8, - 2505, 0x03b4, 2524, 0x03b0, 2543, 0x03ac, 2562, 0x03a8, 2582, 0x03a4, - 2601, 0x03a0, 2621, 0x039c, 2640, 0x0398, 2660, 0x0394, 2679, 0x0390, - 2699, 0x038c, 2718, 0x0388, 2738, 0x0384, 2758, 0x0380, 2777, 0x037c, - 2797, 0x0378, 2817, 0x0374, 2837, 0x0370, 2857, 0x036c, 2876, 0x0368, - 2896, 0x0364, 2916, 0x0360, 2936, 0x035c, 2956, 0x0358, 2976, 0x0354, - 2997, 0x0350, 3017, 0x034c, 3037, 0x0348, 3057, 0x0344, 3077, 0x0340, - 3098, 0x033c, 3118, 0x0338, 3138, 0x0334, 3159, 0x0330, 3179, 0x032c, - 3200, 0x0328, 3220, 0x0324, 3241, 0x0320, 3261, 0x031c, 3282, 0x0318, - 3303, 0x0314, 3323, 0x0310, 3344, 0x030c, 3365, 0x0308, 3386, 0x0304, - 3406, 0x0300, 3427, 0x02fc, 3448, 0x02f8, 3469, 0x02f4, 3490, 0x02f0, - 3511, 0x02ec, 3532, 0x02e8, 3553, 0x02e4, 3575, 0x02e0, 3596, 0x02dc, - 3617, 0x02d8, 3638, 0x02d4, 3660, 0x02d0, 3681, 0x02cc, 3702, 0x02c8, - 3724, 0x02c4, 3745, 0x02c0, 3767, 0x02bc, 3788, 0x02b8, 3810, 0x02b4, - 3831, 0x02b0, 3853, 0x02ac, 3875, 0x02a8, 3896, 0x02a4, 3918, 0x02a0, - 3940, 0x029c, 3962, 0x0298, 3984, 0x0294, 4006, 0x0290, 4028, 0x028c, - 4050, 0x0288, 4072, 0x0284, 4094, 0x0280, 4116, 0x027c, 4138, 0x0278, - 4160, 0x0274, 4182, 0x0270, 4205, 0x026c, 4227, 0x0268, 4249, 0x0264, - 4272, 0x0260, 4294, 0x025c, 4317, 0x0258, 4339, 0x0254, 4362, 0x0250, - 4384, 0x024c, 4407, 0x0248, 4430, 0x0244, 4453, 0x0240, 4475, 0x023c, - 4498, 0x0238, 4521, 0x0234, 4544, 0x0230, 4567, 0x022c, 4590, 0x0228, - 4613, 0x0224, 4636, 0x0220, 4659, 0x021c, 4682, 0x0218, 4705, 0x0214, - 4728, 0x0210, 4752, 0x020c, 4775, 0x0208, 4798, 0x0204, 4822, 0x0200, - 4845, 0x01fc, 4869, 0x01f8, 4892, 0x01f4, 4916, 0x01f0, 4939, 0x01ec, - 4963, 0x01e8, 4987, 0x01e4, 5010, 0x01e0, 5034, 0x01dc, 5058, 0x01d8, - 5082, 0x01d4, 5106, 0x01d0, 5130, 0x01cc, 5154, 0x01c8, 5178, 0x01c4, - 5202, 0x01c0, 5226, 0x01bc, 5250, 0x01b8, 5274, 0x01b4, 5299, 0x01b0, - 5323, 0x01ac, 5347, 0x01a8, 5372, 0x01a4, 5396, 0x01a0, 5420, 0x019c, - 5445, 0x0198, 5469, 0x0194, 5494, 0x0190, 5519, 0x018c, 5543, 0x0188, - 5568, 0x0184, 5593, 0x0180, 5618, 0x017c, 5643, 0x0178, 5668, 0x0174, - 5692, 0x0170, 5717, 0x016c, 5743, 0x0168, 5768, 0x0164, 5793, 0x0160, - 5818, 0x015c, 5843, 0x0158, 5868, 0x0154, 5894, 0x0150, 5919, 0x014c, - 5945, 0x0148, 5970, 0x0144, 5995, 0x0140, 6021, 0x013c, 6047, 0x0138, - 6072, 0x0134, 6098, 0x0130, 6124, 0x012c, 6149, 0x0128, 6175, 0x0124, - 6201, 0x0120, 6227, 0x011c, 6253, 0x0118, 6279, 0x0114, 6305, 0x0110, - 6331, 0x010c, 6357, 0x0108, 6384, 0x0104, 6410, 0x0100, 6436, 0x00fc, - 6462, 0x00f8, 6489, 0x00f4, 6515, 0x00f0, 6542, 0x00ec, 6568, 0x00e8, - 6595, 0x00e4, 6621, 0x00e0, 6648, 0x00dc, 6675, 0x00d8, 6702, 0x00d4, - 6728, 0x00d0, 6755, 0x00cc, 6782, 0x00c8, 6809, 0x00c4, 6836, 0x00c0, - 6863, 0x00bc, 6890, 0x00b8, 6917, 0x00b4, 6945, 0x00b0, 6972, 0x00ac, - 6999, 0x00a8, 7027, 0x00a4, 7054, 0x00a0, 7081, 0x009c, 7109, 0x0098, - 7136, 0x0094, 7164, 0x0090, 7192, 0x008c, 7219, 0x0088, 7247, 0x0084, - 7275, 0x0080, 7303, 0x007c, 7331, 0x0078, 7359, 0x0074, 7387, 0x0070, - 7415, 0x006c, 7443, 0x0068, 7471, 0x0064, 7499, 0x0060, 7527, 0x005c, - 7556, 0x0058, 7584, 0x0054, 7613, 0x0050, 7641, 0x004c, 7669, 0x0048, - 7698, 0x0044, 7727, 0x0040, 7755, 0x003c, 7784, 0x0038, 7813, 0x0034, - 7842, 0x0030, 7870, 0x002c, 7899, 0x0028, 7928, 0x0024, 7957, 0x0020, - 7986, 0x001c, 8016, 0x0018, 8045, 0x0014, 8074, 0x0010, 8103, 0x000c, - 8133, 0x0008, 8162, 0x0004, 8192, 0x0000 -}; - -static unsigned short lookup_volume_table( unsigned short value ) -{ - /* This code is an optimised version of: - * int i = 0; - * while( volume_table[i*2] < value ) - * i++; - * return volume_table[i*2+1]; - */ - unsigned short *ptr = log_table; - while( *ptr < value ) - ptr += 2; - return *(ptr+1); -} - -/* this function calculates a 8.8 fixed point logarithmic attenuation - * value from a linear volume value in the range 0 to 16384 */ -static unsigned short log_from_linear( unsigned short value ) -{ - if (value >= 16384) - return 0x0000; - if (value) { - unsigned short result = 0; - int v, c; - for( c = 0, v = 8192; c < 14; c++, v >>= 1 ) { - if( value >= v ) { - result += lookup_volume_table( (value - v) << c ); - return result; - } - result += 0x0605; /* 6.0205 (result of -20*log10(0.5)) */ - } - } - return 0xffff; -} - -/* - * Sample handling operations - */ - -static void sample_start(struct snd_trident * trident, struct snd_trident_voice * voice, snd_seq_position_t position); -static void sample_stop(struct snd_trident * trident, struct snd_trident_voice * voice, int mode); -static void sample_freq(struct snd_trident * trident, struct snd_trident_voice * voice, snd_seq_frequency_t freq); -static void sample_volume(struct snd_trident * trident, struct snd_trident_voice * voice, struct snd_seq_ev_volume * volume); -static void sample_loop(struct snd_trident * trident, struct snd_trident_voice * voice, struct snd_seq_ev_loop * loop); -static void sample_pos(struct snd_trident * trident, struct snd_trident_voice * voice, snd_seq_position_t position); -static void sample_private1(struct snd_trident * trident, struct snd_trident_voice * voice, unsigned char *data); - -static struct snd_trident_sample_ops sample_ops = -{ - sample_start, - sample_stop, - sample_freq, - sample_volume, - sample_loop, - sample_pos, - sample_private1 -}; - -static void snd_trident_simple_init(struct snd_trident_voice * voice) -{ - //voice->handler_wave = interrupt_wave; - //voice->handler_volume = interrupt_volume; - //voice->handler_effect = interrupt_effect; - //voice->volume_change = NULL; - voice->sample_ops = &sample_ops; -} - -static void sample_start(struct snd_trident * trident, struct snd_trident_voice * voice, snd_seq_position_t position) -{ - struct simple_instrument *simple; - struct snd_seq_kinstr *instr; - unsigned long flags; - unsigned int loop_start, loop_end, sample_start, sample_end, start_offset; - unsigned int value; - unsigned int shift = 0; - - instr = snd_seq_instr_find(trident->synth.ilist, &voice->instr, 0, 1); - if (instr == NULL) - return; - voice->instr = instr->instr; /* copy ID to speedup aliases */ - simple = KINSTR_DATA(instr); - - spin_lock_irqsave(&trident->reg_lock, flags); - - if (trident->device == TRIDENT_DEVICE_ID_SI7018) - voice->GVSel = 1; /* route to Wave volume */ - - voice->CTRL = 0; - voice->Alpha = 0; - voice->FMS = 0; - - loop_start = simple->loop_start >> 4; - loop_end = simple->loop_end >> 4; - sample_start = (simple->start + position) >> 4; - if( sample_start >= simple->size ) - sample_start = simple->start >> 4; - sample_end = simple->size; - start_offset = position >> 4; - - if (simple->format & SIMPLE_WAVE_16BIT) { - voice->CTRL |= 8; - shift++; - } - if (simple->format & SIMPLE_WAVE_STEREO) { - voice->CTRL |= 4; - shift++; - } - if (!(simple->format & SIMPLE_WAVE_UNSIGNED)) - voice->CTRL |= 2; - - voice->LBA = simple->address.memory; - - if (simple->format & SIMPLE_WAVE_LOOP) { - voice->CTRL |= 1; - voice->LBA += loop_start << shift; - if( start_offset >= loop_start ) { - voice->CSO = start_offset - loop_start; - voice->negCSO = 0; - } else { - voice->CSO = loop_start - start_offset; - voice->negCSO = 1; - } - voice->ESO = loop_end - loop_start - 1; - } else { - voice->LBA += start_offset << shift; - voice->CSO = sample_start; - voice->ESO = sample_end - 1; - voice->negCSO = 0; - } - - if (voice->flags & SNDRV_TRIDENT_VFLG_RUNNING) { - snd_trident_stop_voice(trident, voice->number); - voice->flags &= ~SNDRV_TRIDENT_VFLG_RUNNING; - } - - /* set CSO sign */ - value = inl(TRID_REG(trident, T4D_SIGN_CSO_A)); - if( voice->negCSO ) { - value |= 1 << (voice->number&31); - } else { - value &= ~(1 << (voice->number&31)); - } - outl(value,TRID_REG(trident, T4D_SIGN_CSO_A)); - - voice->Attribute = 0; - snd_trident_write_voice_regs(trident, voice); - snd_trident_start_voice(trident, voice->number); - voice->flags |= SNDRV_TRIDENT_VFLG_RUNNING; - spin_unlock_irqrestore(&trident->reg_lock, flags); - snd_seq_instr_free_use(trident->synth.ilist, instr); -} - -static void sample_stop(struct snd_trident * trident, struct snd_trident_voice * voice, int mode) -{ - unsigned long flags; - - if (!(voice->flags & SNDRV_TRIDENT_VFLG_RUNNING)) - return; - - switch (mode) { - default: - spin_lock_irqsave(&trident->reg_lock, flags); - snd_trident_stop_voice(trident, voice->number); - voice->flags &= ~SNDRV_TRIDENT_VFLG_RUNNING; - spin_unlock_irqrestore(&trident->reg_lock, flags); - break; - case SAMPLE_STOP_LOOP: /* disable loop only */ - voice->CTRL &= ~1; - spin_lock_irqsave(&trident->reg_lock, flags); - outb((unsigned char) voice->number, TRID_REG(trident, T4D_LFO_GC_CIR)); - outw((((voice->CTRL << 12) | (voice->EC & 0x0fff)) & 0xffff), CH_GVSEL_PAN_VOL_CTRL_EC); - spin_unlock_irqrestore(&trident->reg_lock, flags); - break; - } -} - -static void sample_freq(struct snd_trident * trident, struct snd_trident_voice * voice, snd_seq_frequency_t freq) -{ - unsigned long flags; - freq >>= 4; - - spin_lock_irqsave(&trident->reg_lock, flags); - if (freq == 44100) - voice->Delta = 0xeb3; - else if (freq == 8000) - voice->Delta = 0x2ab; - else if (freq == 48000) - voice->Delta = 0x1000; - else - voice->Delta = (((freq << 12) + freq) / 48000) & 0x0000ffff; - - outb((unsigned char) voice->number, TRID_REG(trident, T4D_LFO_GC_CIR)); - if (trident->device == TRIDENT_DEVICE_ID_NX) { - outb((unsigned char) voice->Delta, TRID_REG(trident, CH_NX_DELTA_CSO + 3)); - outb((unsigned char) (voice->Delta >> 8), TRID_REG(trident, CH_NX_DELTA_ESO + 3)); - } else { - outw((unsigned short) voice->Delta, TRID_REG(trident, CH_DX_ESO_DELTA)); - } - - spin_unlock_irqrestore(&trident->reg_lock, flags); -} - -static void sample_volume(struct snd_trident * trident, struct snd_trident_voice * voice, struct snd_seq_ev_volume * volume) -{ - unsigned long flags; - unsigned short value; - - spin_lock_irqsave(&trident->reg_lock, flags); - voice->GVSel = 0; /* use global music volume */ - voice->FMC = 0x03; /* fixme: can we do something useful with FMC? */ - if (volume->volume >= 0) { - volume->volume &= 0x3fff; - /* linear volume -> logarithmic attenuation conversion - * uses EC register for greater resolution (6.6 bits) than Vol register (5.3 bits) - * Vol register used when additional attenuation is required */ - voice->RVol = 0; - voice->CVol = 0; - value = log_from_linear( volume->volume ); - voice->Vol = 0; - voice->EC = (value & 0x3fff) >> 2; - if (value > 0x3fff) { - voice->EC |= 0xfc0; - if (value < 0x5f00 ) - voice->Vol = ((value >> 8) - 0x3f) << 5; - else { - voice->Vol = 0x3ff; - voice->EC = 0xfff; - } - } - } - if (volume->lr >= 0) { - volume->lr &= 0x3fff; - /* approximate linear pan by attenuating channels */ - if (volume->lr >= 0x2000) { /* attenuate left (pan right) */ - value = 0x3fff - volume->lr; - for (voice->Pan = 0; voice->Pan < 63; voice->Pan++ ) - if (value >= pan_table[voice->Pan] ) - break; - } else { /* attenuate right (pan left) */ - for (voice->Pan = 0; voice->Pan < 63; voice->Pan++ ) - if ((unsigned int)volume->lr >= pan_table[voice->Pan] ) - break; - voice->Pan |= 0x40; - } - } - outb((unsigned char) voice->number, TRID_REG(trident, T4D_LFO_GC_CIR)); - outl((voice->GVSel << 31) | ((voice->Pan & 0x0000007f) << 24) | - ((voice->Vol & 0x000000ff) << 16) | ((voice->CTRL & 0x0000000f) << 12) | - (voice->EC & 0x00000fff), TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC)); - value = ((voice->FMC & 0x03) << 14) | ((voice->RVol & 0x7f) << 7) | (voice->CVol & 0x7f); - outw(value, TRID_REG(trident, CH_DX_FMC_RVOL_CVOL)); - spin_unlock_irqrestore(&trident->reg_lock, flags); -} - -static void sample_loop(struct snd_trident * trident, struct snd_trident_voice * voice, struct snd_seq_ev_loop * loop) -{ - unsigned long flags; - struct simple_instrument *simple; - struct snd_seq_kinstr *instr; - unsigned int loop_start, loop_end; - - instr = snd_seq_instr_find(trident->synth.ilist, &voice->instr, 0, 1); - if (instr == NULL) - return; - voice->instr = instr->instr; /* copy ID to speedup aliases */ - simple = KINSTR_DATA(instr); - - loop_start = loop->start >> 4; - loop_end = loop->end >> 4; - - spin_lock_irqsave(&trident->reg_lock, flags); - - voice->LBA = simple->address.memory + loop_start; - voice->CSO = 0; - voice->ESO = loop_end - loop_start - 1; - - outb((unsigned char) voice->number, TRID_REG(trident, T4D_LFO_GC_CIR)); - outb((voice->LBA >> 16), TRID_REG(trident, CH_LBA + 2)); - outw((voice->LBA & 0xffff), TRID_REG(trident, CH_LBA)); - if (trident->device == TRIDENT_DEVICE_ID_NX) { - outb((voice->ESO >> 16), TRID_REG(trident, CH_NX_DELTA_ESO + 2)); - outw((voice->ESO & 0xffff), TRID_REG(trident, CH_NX_DELTA_ESO)); - outb((voice->CSO >> 16), TRID_REG(trident, CH_NX_DELTA_CSO + 2)); - outw((voice->CSO & 0xffff), TRID_REG(trident, CH_NX_DELTA_CSO)); - } else { - outw((voice->ESO & 0xffff), TRID_REG(trident, CH_DX_ESO_DELTA + 2)); - outw((voice->CSO & 0xffff), TRID_REG(trident, CH_DX_CSO_ALPHA_FMS + 2)); - } - - spin_unlock_irqrestore(&trident->reg_lock, flags); - snd_seq_instr_free_use(trident->synth.ilist, instr); -} - -static void sample_pos(struct snd_trident * trident, struct snd_trident_voice * voice, snd_seq_position_t position) -{ - unsigned long flags; - struct simple_instrument *simple; - struct snd_seq_kinstr *instr; - unsigned int value; - - instr = snd_seq_instr_find(trident->synth.ilist, &voice->instr, 0, 1); - if (instr == NULL) - return; - voice->instr = instr->instr; /* copy ID to speedup aliases */ - simple = KINSTR_DATA(instr); - - spin_lock_irqsave(&trident->reg_lock, flags); - - if (simple->format & SIMPLE_WAVE_LOOP) { - if( position >= simple->loop_start ) { - voice->CSO = (position - simple->loop_start) >> 4; - voice->negCSO = 0; - } else { - voice->CSO = (simple->loop_start - position) >> 4; - voice->negCSO = 1; - } - } else { - voice->CSO = position >> 4; - voice->negCSO = 0; - } - - /* set CSO sign */ - value = inl(TRID_REG(trident, T4D_SIGN_CSO_A)); - if( voice->negCSO ) { - value |= 1 << (voice->number&31); - } else { - value &= ~(1 << (voice->number&31)); - } - outl(value,TRID_REG(trident, T4D_SIGN_CSO_A)); - - - outb((unsigned char) voice->number, TRID_REG(trident, T4D_LFO_GC_CIR)); - if (trident->device == TRIDENT_DEVICE_ID_NX) { - outw((voice->CSO & 0xffff), TRID_REG(trident, CH_NX_DELTA_CSO)); - outb((voice->CSO >> 16), TRID_REG(trident, CH_NX_DELTA_CSO + 2)); - } else { - outw((voice->CSO & 0xffff), TRID_REG(trident, CH_DX_CSO_ALPHA_FMS) + 2); - } - - spin_unlock_irqrestore(&trident->reg_lock, flags); - snd_seq_instr_free_use(trident->synth.ilist, instr); -} - -static void sample_private1(struct snd_trident * trident, struct snd_trident_voice * voice, unsigned char *data) -{ -} - -/* - * Memory management / sample loading - */ - -static int snd_trident_simple_put_sample(void *private_data, - struct simple_instrument * instr, - char __user *data, long len, int atomic) -{ - struct snd_trident *trident = private_data; - int size = instr->size; - int shift = 0; - - if (instr->format & SIMPLE_WAVE_BACKWARD || - instr->format & SIMPLE_WAVE_BIDIR || - instr->format & SIMPLE_WAVE_ULAW) - return -EINVAL; /* not supported */ - - if (instr->format & SIMPLE_WAVE_16BIT) - shift++; - if (instr->format & SIMPLE_WAVE_STEREO) - shift++; - size <<= shift; - - if (trident->synth.current_size + size > trident->synth.max_size) - return -ENOMEM; - - if (!access_ok(VERIFY_READ, data, size)) - return -EFAULT; - - if (trident->tlb.entries) { - struct snd_util_memblk *memblk; - memblk = snd_trident_synth_alloc(trident, size); - if (memblk == NULL) - return -ENOMEM; - if (snd_trident_synth_copy_from_user(trident, memblk, 0, data, size) ) { - snd_trident_synth_free(trident, memblk); - return -EFAULT; - } - instr->address.ptr = (unsigned char*)memblk; - instr->address.memory = memblk->offset; - } else { - struct snd_dma_buffer dmab; - if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(trident->pci), - size, &dmab) < 0) - return -ENOMEM; - - if (copy_from_user(dmab.area, data, size)) { - snd_dma_free_pages(&dmab); - return -EFAULT; - } - instr->address.ptr = dmab.area; - instr->address.memory = dmab.addr; - } - - trident->synth.current_size += size; - return 0; -} - -static int snd_trident_simple_get_sample(void *private_data, - struct simple_instrument * instr, - char __user *data, long len, int atomic) -{ - //struct snd_trident *trident = private_data; - int size = instr->size; - int shift = 0; - - if (instr->format & SIMPLE_WAVE_16BIT) - shift++; - if (instr->format & SIMPLE_WAVE_STEREO) - shift++; - size <<= shift; - - if (!access_ok(VERIFY_WRITE, data, size)) - return -EFAULT; - - /* FIXME: not implemented yet */ - - return -EBUSY; -} - -static int snd_trident_simple_remove_sample(void *private_data, - struct simple_instrument * instr, - int atomic) -{ - struct snd_trident *trident = private_data; - int size = instr->size; - - if (instr->format & SIMPLE_WAVE_16BIT) - size <<= 1; - if (instr->format & SIMPLE_WAVE_STEREO) - size <<= 1; - - if (trident->tlb.entries) { - struct snd_util_memblk *memblk = (struct snd_util_memblk *)instr->address.ptr; - if (memblk) - snd_trident_synth_free(trident, memblk); - else - return -EFAULT; - } else { - struct snd_dma_buffer dmab; - dmab.dev.type = SNDRV_DMA_TYPE_DEV; - dmab.dev.dev = snd_dma_pci_data(trident->pci); - dmab.area = instr->address.ptr; - dmab.addr = instr->address.memory; - dmab.bytes = size; - snd_dma_free_pages(&dmab); - } - - trident->synth.current_size -= size; - if (trident->synth.current_size < 0) /* shouldn't need this check... */ - trident->synth.current_size = 0; - - return 0; -} - -static void select_instrument(struct snd_trident * trident, struct snd_trident_voice * v) -{ - struct snd_seq_kinstr *instr; - instr = snd_seq_instr_find(trident->synth.ilist, &v->instr, 0, 1); - if (instr != NULL) { - if (instr->ops) { - if (!strcmp(instr->ops->instr_type, SNDRV_SEQ_INSTR_ID_SIMPLE)) - snd_trident_simple_init(v); - } - snd_seq_instr_free_use(trident->synth.ilist, instr); - } -} - -/* - - */ - -static void event_sample(struct snd_seq_event * ev, struct snd_trident_port * p, struct snd_trident_voice * v) -{ - if (v->sample_ops && v->sample_ops->sample_stop) - v->sample_ops->sample_stop(p->trident, v, SAMPLE_STOP_IMMEDIATELY); - v->instr.std = ev->data.sample.param.sample.std; - if (v->instr.std & 0xff000000) { /* private instrument */ - v->instr.std &= 0x00ffffff; - v->instr.std |= (unsigned int)ev->source.client << 24; - } - v->instr.bank = ev->data.sample.param.sample.bank; - v->instr.prg = ev->data.sample.param.sample.prg; - select_instrument(p->trident, v); -} - -static void event_cluster(struct snd_seq_event * ev, struct snd_trident_port * p, struct snd_trident_voice * v) -{ - if (v->sample_ops && v->sample_ops->sample_stop) - v->sample_ops->sample_stop(p->trident, v, SAMPLE_STOP_IMMEDIATELY); - v->instr.cluster = ev->data.sample.param.cluster.cluster; - select_instrument(p->trident, v); -} - -static void event_start(struct snd_seq_event * ev, struct snd_trident_port * p, struct snd_trident_voice * v) -{ - if (v->sample_ops && v->sample_ops->sample_start) - v->sample_ops->sample_start(p->trident, v, ev->data.sample.param.position); -} - -static void event_stop(struct snd_seq_event * ev, struct snd_trident_port * p, struct snd_trident_voice * v) -{ - if (v->sample_ops && v->sample_ops->sample_stop) - v->sample_ops->sample_stop(p->trident, v, ev->data.sample.param.stop_mode); -} - -static void event_freq(struct snd_seq_event * ev, struct snd_trident_port * p, struct snd_trident_voice * v) -{ - if (v->sample_ops && v->sample_ops->sample_freq) - v->sample_ops->sample_freq(p->trident, v, ev->data.sample.param.frequency); -} - -static void event_volume(struct snd_seq_event * ev, struct snd_trident_port * p, struct snd_trident_voice * v) -{ - if (v->sample_ops && v->sample_ops->sample_volume) - v->sample_ops->sample_volume(p->trident, v, &ev->data.sample.param.volume); -} - -static void event_loop(struct snd_seq_event * ev, struct snd_trident_port * p, struct snd_trident_voice * v) -{ - if (v->sample_ops && v->sample_ops->sample_loop) - v->sample_ops->sample_loop(p->trident, v, &ev->data.sample.param.loop); -} - -static void event_position(struct snd_seq_event * ev, struct snd_trident_port * p, struct snd_trident_voice * v) -{ - if (v->sample_ops && v->sample_ops->sample_pos) - v->sample_ops->sample_pos(p->trident, v, ev->data.sample.param.position); -} - -static void event_private1(struct snd_seq_event * ev, struct snd_trident_port * p, struct snd_trident_voice * v) -{ - if (v->sample_ops && v->sample_ops->sample_private1) - v->sample_ops->sample_private1(p->trident, v, (unsigned char *) &ev->data.sample.param.raw8); -} - -typedef void (trident_sample_event_handler_t) (struct snd_seq_event * ev, struct snd_trident_port * p, struct snd_trident_voice * v); - -static trident_sample_event_handler_t *trident_sample_event_handlers[9] = -{ - event_sample, - event_cluster, - event_start, - event_stop, - event_freq, - event_volume, - event_loop, - event_position, - event_private1 -}; - -static void snd_trident_sample_event(struct snd_seq_event * ev, struct snd_trident_port * p) -{ - int idx, voice; - struct snd_trident *trident = p->trident; - struct snd_trident_voice *v; - unsigned long flags; - - idx = ev->type - SNDRV_SEQ_EVENT_SAMPLE; - if (idx < 0 || idx > 8) - return; - for (voice = 0; voice < 64; voice++) { - v = &trident->synth.voices[voice]; - if (v->use && v->client == ev->source.client && - v->port == ev->source.port && - v->index == ev->data.sample.channel) { - spin_lock_irqsave(&trident->event_lock, flags); - trident_sample_event_handlers[idx] (ev, p, v); - spin_unlock_irqrestore(&trident->event_lock, flags); - return; - } - } -} - -/* - - */ - -static void snd_trident_synth_free_voices(struct snd_trident * trident, int client, int port) -{ - int idx; - struct snd_trident_voice *voice; - - for (idx = 0; idx < 32; idx++) { - voice = &trident->synth.voices[idx]; - if (voice->use && voice->client == client && voice->port == port) - snd_trident_free_voice(trident, voice); - } -} - -static int snd_trident_synth_use(void *private_data, struct snd_seq_port_subscribe * info) -{ - struct snd_trident_port *port = private_data; - struct snd_trident *trident = port->trident; - struct snd_trident_voice *voice; - unsigned int idx; - unsigned long flags; - - if (info->voices > 32) - return -EINVAL; - spin_lock_irqsave(&trident->reg_lock, flags); - for (idx = 0; idx < info->voices; idx++) { - voice = snd_trident_alloc_voice(trident, SNDRV_TRIDENT_VOICE_TYPE_SYNTH, info->sender.client, info->sender.port); - if (voice == NULL) { - snd_trident_synth_free_voices(trident, info->sender.client, info->sender.port); - spin_unlock_irqrestore(&trident->reg_lock, flags); - return -EBUSY; - } - voice->index = idx; - voice->Vol = 0x3ff; - voice->EC = 0x0fff; - } -#if 0 - for (idx = 0; idx < info->midi_voices; idx++) { - port->midi_has_voices = 1; - voice = snd_trident_alloc_voice(trident, SNDRV_TRIDENT_VOICE_TYPE_MIDI, info->sender.client, info->sender.port); - if (voice == NULL) { - snd_trident_synth_free_voices(trident, info->sender.client, info->sender.port); - spin_unlock_irqrestore(&trident->reg_lock, flags); - return -EBUSY; - } - voice->Vol = 0x3ff; - voice->EC = 0x0fff; - } -#endif - spin_unlock_irqrestore(&trident->reg_lock, flags); - return 0; -} - -static int snd_trident_synth_unuse(void *private_data, struct snd_seq_port_subscribe * info) -{ - struct snd_trident_port *port = private_data; - struct snd_trident *trident = port->trident; - unsigned long flags; - - spin_lock_irqsave(&trident->reg_lock, flags); - snd_trident_synth_free_voices(trident, info->sender.client, info->sender.port); - spin_unlock_irqrestore(&trident->reg_lock, flags); - return 0; -} - -/* - - */ - -static void snd_trident_synth_free_private_instruments(struct snd_trident_port * p, int client) -{ - 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->trident->synth.ilist, &ifree, client, 0); -} - -static int snd_trident_synth_event_input(struct snd_seq_event * ev, int direct, void *private_data, int atomic, int hop) -{ - struct snd_trident_port *p = (struct snd_trident_port *) private_data; - - if (p == NULL) - return -EINVAL; - if (ev->type >= SNDRV_SEQ_EVENT_SAMPLE && - ev->type <= SNDRV_SEQ_EVENT_SAMPLE_PRIVATE1) { - snd_trident_sample_event(ev, p); - return 0; - } - if (ev->source.client == SNDRV_SEQ_CLIENT_SYSTEM && - ev->source.port == SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE) { - if (ev->type == SNDRV_SEQ_EVENT_CLIENT_EXIT) { - snd_trident_synth_free_private_instruments(p, ev->data.addr.client); - return 0; - } - } - if (direct) { - if (ev->type >= SNDRV_SEQ_EVENT_INSTR_BEGIN) { - snd_seq_instr_event(&p->trident->synth.simple_ops.kops, - p->trident->synth.ilist, ev, - p->trident->synth.seq_client, atomic, hop); - return 0; - } - } - return 0; -} - -static void snd_trident_synth_instr_notify(void *private_data, - struct snd_seq_kinstr * instr, - int what) -{ - int idx; - struct snd_trident *trident = private_data; - struct snd_trident_voice *pvoice; - unsigned long flags; - - spin_lock_irqsave(&trident->event_lock, flags); - for (idx = 0; idx < 64; idx++) { - pvoice = &trident->synth.voices[idx]; - if (pvoice->use && !memcmp(&pvoice->instr, &instr->instr, sizeof(pvoice->instr))) { - if (pvoice->sample_ops && pvoice->sample_ops->sample_stop) { - pvoice->sample_ops->sample_stop(trident, pvoice, SAMPLE_STOP_IMMEDIATELY); - } else { - snd_trident_stop_voice(trident, pvoice->number); - pvoice->flags &= ~SNDRV_TRIDENT_VFLG_RUNNING; - } - } - } - spin_unlock_irqrestore(&trident->event_lock, flags); -} - -/* - - */ - -static void snd_trident_synth_free_port(void *private_data) -{ - struct snd_trident_port *p = (struct snd_trident_port *) private_data; - - if (p) - snd_midi_channel_free_set(p->chset); -} - -static int snd_trident_synth_create_port(struct snd_trident * trident, int idx) -{ - struct snd_trident_port *p; - struct snd_seq_port_callback callbacks; - char name[32]; - char *str; - int result; - - p = &trident->synth.seq_ports[idx]; - p->chset = snd_midi_channel_alloc_set(16); - if (p->chset == NULL) - return -ENOMEM; - p->chset->private_data = p; - p->trident = trident; - p->client = trident->synth.seq_client; - - memset(&callbacks, 0, sizeof(callbacks)); - callbacks.owner = THIS_MODULE; - callbacks.use = snd_trident_synth_use; - callbacks.unuse = snd_trident_synth_unuse; - callbacks.event_input = snd_trident_synth_event_input; - callbacks.private_free = snd_trident_synth_free_port; - callbacks.private_data = p; - - str = "???"; - switch (trident->device) { - case TRIDENT_DEVICE_ID_DX: str = "Trident 4DWave-DX"; break; - case TRIDENT_DEVICE_ID_NX: str = "Trident 4DWave-NX"; break; - case TRIDENT_DEVICE_ID_SI7018: str = "SiS 7018"; break; - } - sprintf(name, "%s port %i", str, idx); - p->chset->port = snd_seq_event_port_attach(trident->synth.seq_client, - &callbacks, - SNDRV_SEQ_PORT_CAP_WRITE | SNDRV_SEQ_PORT_CAP_SUBS_WRITE, - SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE | - SNDRV_SEQ_PORT_TYPE_SYNTH | - SNDRV_SEQ_PORT_TYPE_HARDWARE | - SNDRV_SEQ_PORT_TYPE_SYNTHESIZER, - 16, 0, - name); - if (p->chset->port < 0) { - result = p->chset->port; - snd_trident_synth_free_port(p); - return result; - } - p->port = p->chset->port; - return 0; -} - -/* - - */ - -static int snd_trident_synth_new_device(struct snd_seq_device *dev) -{ - struct snd_trident *trident; - int client, i; - struct snd_seq_port_subscribe sub; - struct snd_simple_ops *simpleops; - char *str; - - trident = *(struct snd_trident **)SNDRV_SEQ_DEVICE_ARGPTR(dev); - if (trident == NULL) - return -EINVAL; - - trident->synth.seq_client = -1; - - /* allocate new client */ - str = "???"; - switch (trident->device) { - case TRIDENT_DEVICE_ID_DX: str = "Trident 4DWave-DX"; break; - case TRIDENT_DEVICE_ID_NX: str = "Trident 4DWave-NX"; break; - case TRIDENT_DEVICE_ID_SI7018: str = "SiS 7018"; break; - } - client = trident->synth.seq_client = - snd_seq_create_kernel_client(trident->card, 1, str); - if (client < 0) - return client; - - for (i = 0; i < 4; i++) - snd_trident_synth_create_port(trident, i); - - trident->synth.ilist = snd_seq_instr_list_new(); - if (trident->synth.ilist == NULL) { - snd_seq_delete_kernel_client(client); - trident->synth.seq_client = -1; - return -ENOMEM; - } - trident->synth.ilist->flags = SNDRV_SEQ_INSTR_FLG_DIRECT; - - simpleops = &trident->synth.simple_ops; - snd_seq_simple_init(simpleops, trident, NULL); - simpleops->put_sample = snd_trident_simple_put_sample; - simpleops->get_sample = snd_trident_simple_get_sample; - simpleops->remove_sample = snd_trident_simple_remove_sample; - simpleops->notify = snd_trident_synth_instr_notify; - - memset(&sub, 0, sizeof(sub)); - sub.sender.client = SNDRV_SEQ_CLIENT_SYSTEM; - sub.sender.port = SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE; - sub.dest.client = client; - sub.dest.port = 0; - snd_seq_kernel_client_ctl(client, SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT, &sub); - - return 0; -} - -static int snd_trident_synth_delete_device(struct snd_seq_device *dev) -{ - struct snd_trident *trident; - - trident = *(struct snd_trident **)SNDRV_SEQ_DEVICE_ARGPTR(dev); - if (trident == NULL) - return -EINVAL; - - if (trident->synth.seq_client >= 0) { - snd_seq_delete_kernel_client(trident->synth.seq_client); - trident->synth.seq_client = -1; - } - if (trident->synth.ilist) - snd_seq_instr_list_free(&trident->synth.ilist); - return 0; -} - -static int __init alsa_trident_synth_init(void) -{ - static struct snd_seq_dev_ops ops = - { - snd_trident_synth_new_device, - snd_trident_synth_delete_device - }; - - return snd_seq_device_register_driver(SNDRV_SEQ_DEV_ID_TRIDENT, &ops, - sizeof(struct snd_trident *)); -} - -static void __exit alsa_trident_synth_exit(void) -{ - snd_seq_device_unregister_driver(SNDRV_SEQ_DEV_ID_TRIDENT); -} - -module_init(alsa_trident_synth_init) -module_exit(alsa_trident_synth_exit) -- cgit v1.2.3 From 045765253c610cb5acebb22ae94d759f586d9521 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 30 Oct 2007 12:43:40 +0100 Subject: [ALSA] opl3 - Fix build errors I applied a wrong patch for 'opl3 - simplify exclusive access lock'. Fixed now. Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- include/sound/opl3.h | 1 + sound/drivers/opl3/opl3_lib.c | 1 + sound/drivers/opl3/opl3_seq.c | 1 + 3 files changed, 3 insertions(+) (limited to 'include') diff --git a/include/sound/opl3.h b/include/sound/opl3.h index eea584b7bfc5..d7e33ce09120 100644 --- a/include/sound/opl3.h +++ b/include/sound/opl3.h @@ -318,6 +318,7 @@ struct snd_opl3 { void *private_data; void (*private_free)(struct snd_opl3 *); + struct snd_hwdep *hwdep; spinlock_t reg_lock; struct snd_card *card; /* The card that this belongs to */ unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */ diff --git a/sound/drivers/opl3/opl3_lib.c b/sound/drivers/opl3/opl3_lib.c index a1270841290b..ebe4359047cb 100644 --- a/sound/drivers/opl3/opl3_lib.c +++ b/sound/drivers/opl3/opl3_lib.c @@ -525,6 +525,7 @@ int snd_opl3_hwdep_new(struct snd_opl3 * opl3, hw->ops.write = snd_opl3_write; hw->ops.release = snd_opl3_release; + opl3->hwdep = hw; opl3->seq_dev_num = seq_device; #if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE)) if (snd_seq_device_new(card, seq_device, SNDRV_SEQ_DEV_ID_OPL3, diff --git a/sound/drivers/opl3/opl3_seq.c b/sound/drivers/opl3/opl3_seq.c index 6fd60b7e5805..2d33f53d36b8 100644 --- a/sound/drivers/opl3/opl3_seq.c +++ b/sound/drivers/opl3/opl3_seq.c @@ -82,6 +82,7 @@ int snd_opl3_synth_setup(struct snd_opl3 * opl3) void snd_opl3_synth_cleanup(struct snd_opl3 * opl3) { unsigned long flags; + struct snd_hwdep *hwdep; /* Stop system timer */ spin_lock_irqsave(&opl3->sys_timer_lock, flags); -- cgit v1.2.3 From 85db3848c59610c47f64f67677e875abfcff1c3f Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 8 Nov 2007 09:09:58 +0100 Subject: [ALSA] Update SNDRV_HWDEP_IFACE_LAST Updated the forgotten SNDRV_HWDEP_IFACE_LAST to point the really last member. Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- include/sound/asound.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/sound/asound.h b/include/sound/asound.h index af9d11d315e9..3ad534149c06 100644 --- a/include/sound/asound.h +++ b/include/sound/asound.h @@ -95,7 +95,7 @@ enum { SNDRV_HWDEP_IFACE_HDA, /* HD-audio */ /* Don't forget to change the following: */ - SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_SB_RC + SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_HDA }; struct snd_hwdep_info { -- cgit v1.2.3 From 5dbc94791005608c57674fba04dd6b5e19ba9342 Mon Sep 17 00:00:00 2001 From: Jiri Olsa Date: Mon, 12 Nov 2007 12:15:42 +0100 Subject: [ALSA] sound: remove dead config symbol from sound code remove dead config symbols from sound code Signed-off-by: Jiri Olsa Signed-off-by: Andrew Morton Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- include/sound/cs46xx.h | 3 -- include/sound/driver.h | 4 -- sound/pci/cs46xx/cs46xx_lib.c | 99 ------------------------------------------- 3 files changed, 106 deletions(-) (limited to 'include') diff --git a/include/sound/cs46xx.h b/include/sound/cs46xx.h index 6b40ee60f4c5..e3005a674a24 100644 --- a/include/sound/cs46xx.h +++ b/include/sound/cs46xx.h @@ -1708,9 +1708,6 @@ struct snd_cs46xx { struct gameport *gameport; -#ifdef CONFIG_SND_CS46XX_DEBUG_GPIO - int current_gpio; -#endif #ifdef CONFIG_SND_CS46XX_NEW_DSP struct mutex spos_mutex; diff --git a/include/sound/driver.h b/include/sound/driver.h index 5ccb6c5feecb..1889929d1831 100644 --- a/include/sound/driver.h +++ b/include/sound/driver.h @@ -38,10 +38,6 @@ #define CONFIG_SND_MAJOR 116 #endif -#ifndef CONFIG_SND_DEBUG -#undef CONFIG_SND_DEBUG_MEMORY -#endif - #ifdef ALSA_BUILD #include "adriver.h" #endif diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c index 2c7bfc9fef61..8c44fefd15fc 100644 --- a/sound/pci/cs46xx/cs46xx_lib.c +++ b/sound/pci/cs46xx/cs46xx_lib.c @@ -2084,71 +2084,6 @@ static int snd_cs46xx_spdif_stream_put(struct snd_kcontrol *kcontrol, #endif /* CONFIG_SND_CS46XX_NEW_DSP */ -#ifdef CONFIG_SND_CS46XX_DEBUG_GPIO -static int snd_cs46xx_egpio_select_info(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_info *uinfo) -{ - uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; - uinfo->count = 1; - uinfo->value.integer.min = 0; - uinfo->value.integer.max = 8; - return 0; -} - -static int snd_cs46xx_egpio_select_get(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct snd_cs46xx *chip = snd_kcontrol_chip(kcontrol); - ucontrol->value.integer.value[0] = chip->current_gpio; - - return 0; -} - -static int snd_cs46xx_egpio_select_put(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct snd_cs46xx *chip = snd_kcontrol_chip(kcontrol); - int change = (chip->current_gpio != ucontrol->value.integer.value[0]); - chip->current_gpio = ucontrol->value.integer.value[0]; - - return change; -} - - -static int snd_cs46xx_egpio_get(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct snd_cs46xx *chip = snd_kcontrol_chip(kcontrol); - int reg = kcontrol->private_value; - - snd_printdd ("put: reg = %04x, gpio %02x\n",reg,chip->current_gpio); - ucontrol->value.integer.value[0] = - (snd_cs46xx_peekBA0(chip, reg) & (1 << chip->current_gpio)) ? 1 : 0; - - return 0; -} - -static int snd_cs46xx_egpio_put(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct snd_cs46xx *chip = snd_kcontrol_chip(kcontrol); - int reg = kcontrol->private_value; - int val = snd_cs46xx_peekBA0(chip, reg); - int oldval = val; - snd_printdd ("put: reg = %04x, gpio %02x\n",reg,chip->current_gpio); - - if (ucontrol->value.integer.value[0]) - val |= (1 << chip->current_gpio); - else - val &= ~(1 << chip->current_gpio); - - snd_cs46xx_pokeBA0(chip, reg,val); - snd_printdd ("put: val %08x oldval %08x\n",val,oldval); - - return (oldval != val); -} -#endif /* CONFIG_SND_CS46XX_DEBUG_GPIO */ - static struct snd_kcontrol_new snd_cs46xx_controls[] __devinitdata = { { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, @@ -2240,40 +2175,6 @@ static struct snd_kcontrol_new snd_cs46xx_controls[] __devinitdata = { .put = snd_cs46xx_spdif_stream_put }, -#endif -#ifdef CONFIG_SND_CS46XX_DEBUG_GPIO -{ - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "EGPIO select", - .info = snd_cs46xx_egpio_select_info, - .get = snd_cs46xx_egpio_select_get, - .put = snd_cs46xx_egpio_select_put, - .private_value = 0, -}, -{ - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "EGPIO Input/Output", - .info = snd_mixer_boolean_info, - .get = snd_cs46xx_egpio_get, - .put = snd_cs46xx_egpio_put, - .private_value = BA0_EGPIODR, -}, -{ - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "EGPIO CMOS/Open drain", - .info = snd_mixer_boolean_info, - .get = snd_cs46xx_egpio_get, - .put = snd_cs46xx_egpio_put, - .private_value = BA0_EGPIOPTR, -}, -{ - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "EGPIO On/Off", - .info = snd_mixer_boolean_info, - .get = snd_cs46xx_egpio_get, - .put = snd_cs46xx_egpio_put, - .private_value = BA0_EGPIOSR, -}, #endif }; -- cgit v1.2.3 From 6632d64b0b596b9588b607806ac6d36c8c2c9696 Mon Sep 17 00:00:00 2001 From: Pavel Hofman Date: Mon, 3 Dec 2007 12:44:28 +0100 Subject: [ALSA] switching rate in STAC9460 codec of Prodigy192 * support for switching rate in STAC9460 - using set_rate_val of the akm infrastructure * listing all STAC9460 registers in proc * disabling mpu401 device for Prodigy192 - otherwise the currently flawed mpu401 code hangs kernel when opening the midi device * removing old unused commented-out code Signed-off-by: Pavel Hofman Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- include/sound/ak4xxx-adda.h | 2 +- sound/i2c/other/ak4xxx-adda.c | 5 + sound/pci/ice1712/ice1712.h | 2 + sound/pci/ice1712/prodigy192.c | 271 ++++++++++++++++++----------------------- 4 files changed, 124 insertions(+), 156 deletions(-) (limited to 'include') diff --git a/include/sound/ak4xxx-adda.h b/include/sound/ak4xxx-adda.h index 891cf1aea8b1..6153b91cdc3e 100644 --- a/include/sound/ak4xxx-adda.h +++ b/include/sound/ak4xxx-adda.h @@ -68,7 +68,7 @@ struct snd_akm4xxx { enum { SND_AK4524, SND_AK4528, SND_AK4529, SND_AK4355, SND_AK4358, SND_AK4381, - SND_AK5365 + SND_AK5365, NON_AKM } type; /* (array) information of combined codecs */ diff --git a/sound/i2c/other/ak4xxx-adda.c b/sound/i2c/other/ak4xxx-adda.c index 39bb03add7e1..fefa1ae57ad9 100644 --- a/sound/i2c/other/ak4xxx-adda.c +++ b/sound/i2c/other/ak4xxx-adda.c @@ -293,6 +293,11 @@ void snd_akm4xxx_init(struct snd_akm4xxx *ak) case SND_AK5365: /* FIXME: any init sequence? */ return; + case NON_AKM: + /* fake value for non-akm codecs using akm infrastructure + * (e.g. of ice1724) - certainly FIXME + */ + return; default: snd_BUG(); return; diff --git a/sound/pci/ice1712/ice1712.h b/sound/pci/ice1712/ice1712.h index 3c3cac3dc08b..4dc576af506f 100644 --- a/sound/pci/ice1712/ice1712.h +++ b/sound/pci/ice1712/ice1712.h @@ -399,6 +399,8 @@ struct snd_ice1712 { } juli; struct { struct ak4114 *ak4114; + /* rate change needs atomic mute/unmute of all dacs*/ + struct mutex mute_mutex; } prodigy192; struct { struct { diff --git a/sound/pci/ice1712/prodigy192.c b/sound/pci/ice1712/prodigy192.c index 4b21d5c1c4ff..6d81a1c61d41 100644 --- a/sound/pci/ice1712/prodigy192.c +++ b/sound/pci/ice1712/prodigy192.c @@ -81,6 +81,24 @@ static inline unsigned char stac9460_get(struct snd_ice1712 *ice, int reg) /* * DAC mute control */ + +/* + * idx = STAC9460 volume register number, mute: 0 = mute, 1 = unmute + */ +static int stac9460_dac_mute(struct snd_ice1712 *ice, int idx, + unsigned char mute) +{ + unsigned char new, old; + int change; + old = stac9460_get(ice, idx); + new = (~mute << 7 & 0x80) | (old & ~0x80); + change = (new != old); + if (change) + /*printk ("Volume register 0x%02x: 0x%02x\n", idx, new);*/ + stac9460_put(ice, idx, new); + return change; +} + #define stac9460_dac_mute_info snd_ctl_boolean_mono_info static int stac9460_dac_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) @@ -101,20 +119,18 @@ static int stac9460_dac_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_e static int stac9460_dac_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); - unsigned char new, old; - int idx; - int change; + int idx, change; if (kcontrol->private_value) idx = STAC946X_MASTER_VOLUME; else idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + STAC946X_LF_VOLUME; - old = stac9460_get(ice, idx); - new = (~ucontrol->value.integer.value[0]<< 7 & 0x80) | (old & ~0x80); - change = (new != old); - if (change) - stac9460_put(ice, idx, new); - + /* due to possible conflicts with stac9460_set_rate_val, mutexing */ + mutex_lock(&ice->spec.prodigy192.mute_mutex); + /*printk("Mute put: reg 0x%02x, ctrl value: 0x%02x\n", idx, + ucontrol->value.integer.value[0]);*/ + change = stac9460_dac_mute(ice, idx, ucontrol->value.integer.value[0]); + mutex_unlock(&ice->spec.prodigy192.mute_mutex); return change; } @@ -162,6 +178,8 @@ static int stac9460_dac_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el ovol = 0x7f - (tmp & 0x7f); change = (ovol != nvol); if (change) { + ovol = (0x7f - nvol) | (tmp & 0x80); + /*printk("DAC Volume: reg 0x%02x: 0x%02x\n", idx, ovol);*/ stac9460_put(ice, idx, (0x7f - nvol) | (tmp & 0x80)); } return change; @@ -251,121 +269,6 @@ static int stac9460_adc_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el return change; } -#if 0 -/* - * Headphone Amplifier - */ -static int aureon_set_headphone_amp(struct snd_ice1712 *ice, int enable) -{ - unsigned int tmp, tmp2; - - tmp2 = tmp = snd_ice1712_gpio_read(ice); - if (enable) - tmp |= AUREON_HP_SEL; - else - tmp &= ~ AUREON_HP_SEL; - if (tmp != tmp2) { - snd_ice1712_gpio_write(ice, tmp); - return 1; - } - return 0; -} - -static int aureon_get_headphone_amp(struct snd_ice1712 *ice) -{ - unsigned int tmp = snd_ice1712_gpio_read(ice); - - return ( tmp & AUREON_HP_SEL )!= 0; -} - -#define aureon_bool_info snd_ctl_boolean_mono_info - -static int aureon_hpamp_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) -{ - struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); - - ucontrol->value.integer.value[0] = aureon_get_headphone_amp(ice); - return 0; -} - - -static int aureon_hpamp_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) -{ - struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); - - return aureon_set_headphone_amp(ice,ucontrol->value.integer.value[0]); -} - -/* - * Deemphasis - */ -static int aureon_deemp_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) -{ - struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); - ucontrol->value.integer.value[0] = (wm_get(ice, WM_DAC_CTRL2) & 0xf) == 0xf; - return 0; -} - -static int aureon_deemp_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) -{ - struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); - int temp, temp2; - temp2 = temp = wm_get(ice, WM_DAC_CTRL2); - if (ucontrol->value.integer.value[0]) - temp |= 0xf; - else - temp &= ~0xf; - if (temp != temp2) { - wm_put(ice, WM_DAC_CTRL2, temp); - return 1; - } - return 0; -} - -/* - * ADC Oversampling - */ -static int aureon_oversampling_info(struct snd_kcontrol *k, struct snd_ctl_elem_info *uinfo) -{ - static char *texts[2] = { "128x", "64x" }; - - uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; - uinfo->count = 1; - uinfo->value.enumerated.items = 2; - - if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) - uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; - strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); - - return 0; -} - -static int aureon_oversampling_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) -{ - struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); - ucontrol->value.enumerated.item[0] = (wm_get(ice, WM_MASTER) & 0x8) == 0x8; - return 0; -} - -static int aureon_oversampling_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) -{ - int temp, temp2; - struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); - - temp2 = temp = wm_get(ice, WM_MASTER); - - if (ucontrol->value.enumerated.item[0]) - temp |= 0x8; - else - temp &= ~0x8; - - if (temp != temp2) { - wm_put(ice, WM_MASTER, temp); - return 1; - } - return 0; -} -#endif static int stac9460_mic_sw_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { @@ -407,6 +310,56 @@ static int stac9460_mic_sw_put(struct snd_kcontrol *kcontrol, stac9460_put(ice, STAC946X_GENERAL_PURPOSE, new); return change; } +/* + * Handler for setting correct codec rate - called when rate change is detected + */ +static void stac9460_set_rate_val(struct snd_akm4xxx *ak, unsigned int rate) +{ + unsigned char old, new; + int idx; + unsigned char changed[7]; + struct snd_ice1712 *ice = ak->private_data[0]; + + if (rate == 0) /* no hint - S/PDIF input is master, simply return */ + return; + else if (rate <= 48000) + new = 0x08; /* 256x, base rate mode */ + else if (rate <= 96000) + new = 0x11; /* 256x, mid rate mode */ + else + new = 0x12; /* 128x, high rate mode */ + old = stac9460_get(ice, STAC946X_MASTER_CLOCKING); + if (old == new) + return; + /* change detected, setting master clock, muting first */ + /* due to possible conflicts with mute controls - mutexing */ + mutex_lock(&ice->spec.prodigy192.mute_mutex); + /* we have to remember current mute status for each DAC */ + for (idx = 0; idx < 7 ; ++idx) + changed[idx] = stac9460_dac_mute(ice, + STAC946X_MASTER_VOLUME + idx, 0); + /*printk("Rate change: %d, new MC: 0x%02x\n", rate, new);*/ + stac9460_put(ice, STAC946X_MASTER_CLOCKING, new); + udelay(10); + /* unmuting - only originally unmuted dacs - + * i.e. those changed when muting */ + for (idx = 0; idx < 7 ; ++idx) { + if (changed[idx]) + stac9460_dac_mute(ice, STAC946X_MASTER_VOLUME + idx, 1); + } + mutex_unlock(&ice->spec.prodigy192.mute_mutex); +} + +/* using akm infrastructure for setting rate of the codec */ +static struct snd_akm4xxx akmlike_stac9460 __devinitdata = { + .type = NON_AKM, /* special value */ + .num_adcs = 6, /* not used in any way, just for completeness */ + .num_dacs = 2, + .ops = { + .set_rate_val = stac9460_set_rate_val + } +}; + static const DECLARE_TLV_DB_SCALE(db_scale_dac, -19125, 75, 0); static const DECLARE_TLV_DB_SCALE(db_scale_adc, 0, 150, 0); @@ -483,39 +436,8 @@ static struct snd_kcontrol_new stac_controls[] __devinitdata = { .put = stac9460_mic_sw_put, }, -#if 0 - { - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "Capture Route", - .info = wm_adc_mux_info, - .get = wm_adc_mux_get, - .put = wm_adc_mux_put, - }, - { - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "Headphone Amplifier Switch", - .info = aureon_bool_info, - .get = aureon_hpamp_get, - .put = aureon_hpamp_put - }, - { - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "DAC Deemphasis Switch", - .info = aureon_bool_info, - .get = aureon_deemp_get, - .put = aureon_deemp_put - }, - { - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "ADC Oversampling", - .info = aureon_oversampling_info, - .get = aureon_oversampling_get, - .put = aureon_oversampling_put - }, -#endif }; - /* AK4114 - ICE1724 connections on Prodigy192 + MI/ODI/O */ /* CDTO (pin 32) -- GPIO11 pin 86 * CDTI (pin 33) -- GPIO10 pin 77 @@ -720,6 +642,27 @@ static int prodigy192_ak4114_init(struct snd_ice1712 *ice) ice, &ice->spec.prodigy192.ak4114); } +static void stac9460_proc_regs_read(struct snd_info_entry *entry, + struct snd_info_buffer *buffer) +{ + struct snd_ice1712 *ice = (struct snd_ice1712 *)entry->private_data; + int reg, val; + /* registers 0x0 - 0x14 */ + for (reg = 0; reg <= 0x15; reg++) { + val = stac9460_get(ice, reg); + snd_iprintf(buffer, "0x%02x = 0x%02x\n", reg, val); + } +} + + +static void stac9460_proc_init(struct snd_ice1712 *ice) +{ + struct snd_info_entry *entry; + if (!snd_card_proc_new(ice->card, "stac9460_codec", &entry)) + snd_info_set_text_ops(entry, ice, stac9460_proc_regs_read); +} + + static int __devinit prodigy192_add_controls(struct snd_ice1712 *ice) { unsigned int i; @@ -746,6 +689,7 @@ static int __devinit prodigy192_add_controls(struct snd_ice1712 *ice) if (err < 0) return err; } + stac9460_proc_init(ice); return 0; } @@ -778,6 +722,7 @@ static int __devinit prodigy192_init(struct snd_ice1712 *ice) { static const unsigned short stac_inits_prodigy[] = { STAC946X_RESET, 0, + STAC946X_MASTER_CLOCKING, 0x11, /* STAC946X_MASTER_VOLUME, 0, STAC946X_LF_VOLUME, 0, STAC946X_RF_VOLUME, 0, @@ -789,6 +734,7 @@ static int __devinit prodigy192_init(struct snd_ice1712 *ice) }; const unsigned short *p; int err = 0; + struct snd_akm4xxx *ak; /* prodigy 192 */ ice->num_total_dacs = 6; @@ -799,6 +745,15 @@ static int __devinit prodigy192_init(struct snd_ice1712 *ice) p = stac_inits_prodigy; for (; *p != (unsigned short)-1; p += 2) stac9460_put(ice, p[0], p[1]); + /* reusing the akm codecs infrastructure, + * for setting rate on stac9460 */ + ak = ice->akm = kmalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL); + if (!ak) + return -ENOMEM; + ice->akm_codecs = 1; + err = snd_ice1712_akm4xxx_init(ak, &akmlike_stac9460, NULL, ice); + if (err < 0) + return err; /* MI/ODI/O add on card with AK4114 */ if (prodigy192_miodio_exists(ice)) { @@ -812,6 +767,8 @@ static int __devinit prodigy192_init(struct snd_ice1712 *ice) if (err < 0) return err; + mutex_init(&ice->spec.prodigy192.mute_mutex); + return 0; } @@ -854,6 +811,10 @@ struct snd_ice1712_card_info snd_vt1724_prodigy192_cards[] __devinitdata = { .build_controls = prodigy192_add_controls, .eeprom_size = sizeof(prodigy71_eeprom), .eeprom_data = prodigy71_eeprom, + /* the current MPU401 code loops infinitely + * when opening midi device + */ + .no_mpu401 = 1, }, { } /* terminator */ }; -- cgit v1.2.3 From b751eef1fdffca5532344285f2fad0c60d2f0158 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 13 Dec 2007 10:19:42 +0100 Subject: [ALSA] Use posix clock monotonic for PCM and timer timestamps We need an accurate and continuous (monotonic) time sources to do accurate synchronization among more timing sources. This patch allows to enable monotonic timestamps for ALSA PCM devices and enables monotonic timestamps for ALSA timer devices. Signed-off-by: Jaroslav Kysela --- include/sound/asound.h | 10 ++++++++-- include/sound/pcm.h | 10 ++++++++++ sound/core/pcm_lib.c | 2 +- sound/core/pcm_native.c | 25 ++++++++++++++++++++----- sound/core/timer.c | 16 +++++++++++++--- 5 files changed, 52 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/include/sound/asound.h b/include/sound/asound.h index 3ad534149c06..475eb71d65ba 100644 --- a/include/sound/asound.h +++ b/include/sound/asound.h @@ -138,7 +138,7 @@ enum { * * *****************************************************************************/ -#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 8) +#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 9) typedef unsigned long snd_pcm_uframes_t; typedef signed long snd_pcm_sframes_t; @@ -434,10 +434,16 @@ struct snd_xfern { snd_pcm_uframes_t frames; }; +enum { + SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /* gettimeofday equivalent */ + SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, /* posix_clock_monotonic equivalent */ + SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, +}; + enum { SNDRV_PCM_IOCTL_PVERSION = _IOR('A', 0x00, int), SNDRV_PCM_IOCTL_INFO = _IOR('A', 0x01, struct snd_pcm_info), - SNDRV_PCM_IOCTL_TSTAMP = _IOW('A', 0x02, int), + SNDRV_PCM_IOCTL_TTSTAMP = _IOW('A', 0x03, int), SNDRV_PCM_IOCTL_HW_REFINE = _IOWR('A', 0x10, struct snd_pcm_hw_params), SNDRV_PCM_IOCTL_HW_PARAMS = _IOWR('A', 0x11, struct snd_pcm_hw_params), SNDRV_PCM_IOCTL_HW_FREE = _IO('A', 0x12), diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 5e9cc460075e..65f636223d39 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h @@ -323,6 +323,7 @@ struct snd_pcm_runtime { /* -- timer -- */ unsigned int timer_resolution; /* timer resolution */ + int tstamp_type; /* timestamp type */ /* -- DMA -- */ unsigned char *dma_area; /* DMA area */ @@ -952,6 +953,15 @@ void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream); void snd_pcm_timer_init(struct snd_pcm_substream *substream); void snd_pcm_timer_done(struct snd_pcm_substream *substream); +static inline void snd_pcm_gettime(struct snd_pcm_runtime *runtime, + struct timespec *tv) +{ + if (runtime->tstamp_type == SNDRV_PCM_TSTAMP_TYPE_MONOTONIC) + do_posix_clock_monotonic_gettime(tv); + else + getnstimeofday(tv); +} + /* * Memory */ diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 93d7ca502730..db3d7e934ec3 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -188,7 +188,7 @@ static inline int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *subs snd_pcm_sframes_t delta; if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_MMAP) - getnstimeofday((struct timespec *)&runtime->status->tstamp); + snd_pcm_gettime(runtime, (struct timespec *)&runtime->status->tstamp); pos = snd_pcm_update_hw_ptr_pos(substream, runtime); if (pos == SNDRV_PCM_POS_XRUN) { xrun(substream); diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 6245bdaffa68..cdeae7c46e3b 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -598,9 +598,9 @@ int snd_pcm_status(struct snd_pcm_substream *substream, if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_MMAP) status->tstamp = runtime->status->tstamp; else - getnstimeofday(&status->tstamp); + snd_pcm_gettime(runtime, &status->tstamp); } else - getnstimeofday(&status->tstamp); + snd_pcm_gettime(runtime, &status->tstamp); status->appl_ptr = runtime->control->appl_ptr; status->hw_ptr = runtime->status->hw_ptr; if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { @@ -688,7 +688,7 @@ static void snd_pcm_trigger_tstamp(struct snd_pcm_substream *substream) if (runtime->trigger_master == NULL) return; if (runtime->trigger_master == substream) { - getnstimeofday(&runtime->trigger_tstamp); + snd_pcm_gettime(runtime, &runtime->trigger_tstamp); } else { snd_pcm_trigger_tstamp(runtime->trigger_master); runtime->trigger_tstamp = runtime->trigger_master->runtime->trigger_tstamp; @@ -2519,6 +2519,21 @@ static int snd_pcm_sync_ptr(struct snd_pcm_substream *substream, return -EFAULT; return 0; } + +static int snd_pcm_tstamp(struct snd_pcm_substream *substream, int __user *_arg) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + int arg; + + if (get_user(arg, _arg)) + return -EFAULT; + if (arg < 0 || arg > SNDRV_PCM_TSTAMP_TYPE_LAST) + return -EINVAL; + runtime->tstamp_type = SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY; + if (arg == SNDRV_PCM_TSTAMP_TYPE_MONOTONIC) + runtime->tstamp_type = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC; + return 0; +} static int snd_pcm_common_ioctl1(struct file *file, struct snd_pcm_substream *substream, @@ -2531,8 +2546,8 @@ static int snd_pcm_common_ioctl1(struct file *file, return put_user(SNDRV_PCM_VERSION, (int __user *)arg) ? -EFAULT : 0; case SNDRV_PCM_IOCTL_INFO: return snd_pcm_info_user(substream, arg); - case SNDRV_PCM_IOCTL_TSTAMP: /* just for compatibility */ - return 0; + case SNDRV_PCM_IOCTL_TTSTAMP: + return snd_pcm_tstamp(substream, arg); case SNDRV_PCM_IOCTL_HW_REFINE: return snd_pcm_hw_refine_user(substream, arg); case SNDRV_PCM_IOCTL_HW_PARAMS: diff --git a/sound/core/timer.c b/sound/core/timer.c index e7dc56ca4b97..7e5fe2d91662 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -44,11 +44,14 @@ #endif static int timer_limit = DEFAULT_TIMER_LIMIT; +static int timer_tstamp_monotonic = 1; MODULE_AUTHOR("Jaroslav Kysela , Takashi Iwai "); MODULE_DESCRIPTION("ALSA timer interface"); MODULE_LICENSE("GPL"); module_param(timer_limit, int, 0444); MODULE_PARM_DESC(timer_limit, "Maximum global timers in system."); +module_param(timer_tstamp_monotonic, int, 0444); +MODULE_PARM_DESC(timer_tstamp_monotonic, "Use posix monotonic clock source for timestamps (default)."); struct snd_timer_user { struct snd_timer_instance *timeri; @@ -381,7 +384,10 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event) struct snd_timer_instance *ts; struct timespec tstamp; - getnstimeofday(&tstamp); + if (timer_tstamp_monotonic) + do_posix_clock_monotonic_gettime(&tstamp); + else + getnstimeofday(&tstamp); snd_assert(event >= SNDRV_TIMER_EVENT_START && event <= SNDRV_TIMER_EVENT_PAUSE, return); if (event == SNDRV_TIMER_EVENT_START || @@ -1182,8 +1188,12 @@ static void snd_timer_user_tinterrupt(struct snd_timer_instance *timeri, spin_unlock(&tu->qlock); return; } - if (tu->last_resolution != resolution || ticks > 0) - getnstimeofday(&tstamp); + if (tu->last_resolution != resolution || ticks > 0) { + if (timer_tstamp_monotonic) + do_posix_clock_monotonic_gettime(&tstamp); + else + getnstimeofday(&tstamp); + } if ((tu->filter & (1 << SNDRV_TIMER_EVENT_RESOLUTION)) && tu->last_resolution != resolution) { r1.event = SNDRV_TIMER_EVENT_RESOLUTION; -- cgit v1.2.3 From 36b9cdfea64650069d985c5999cb5c2b6f8b85fb Mon Sep 17 00:00:00 2001 From: Marcin Åšlusarz Date: Fri, 14 Dec 2007 12:58:45 +0100 Subject: [ALSA] info_oss: move prototype of snd_card_info_read_oss to info.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit info_oss: move prototype of snd_card_info_read_oss to info.h Signed-off-by: Marcin Åšlusarz Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- include/sound/info.h | 2 ++ sound/core/info_oss.c | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/sound/info.h b/include/sound/info.h index fecbb1ffd540..8ae72e74f898 100644 --- a/include/sound/info.h +++ b/include/sound/info.h @@ -100,8 +100,10 @@ int snd_info_minor_unregister(void); extern struct snd_info_entry *snd_seq_root; #ifdef CONFIG_SND_OSSEMUL extern struct snd_info_entry *snd_oss_root; +void snd_card_info_read_oss(struct snd_info_buffer *buffer); #else #define snd_oss_root NULL +static inline void snd_card_info_read_oss(struct snd_info_buffer *buffer) {} #endif int snd_iprintf(struct snd_info_buffer * buffer, char *fmt,...) __attribute__ ((format (printf, 2, 3))); diff --git a/sound/core/info_oss.c b/sound/core/info_oss.c index 435c9399f7a9..9e8b8163bdd4 100644 --- a/sound/core/info_oss.c +++ b/sound/core/info_oss.c @@ -66,8 +66,6 @@ int snd_oss_info_register(int dev, int num, char *string) EXPORT_SYMBOL(snd_oss_info_register); -extern void snd_card_info_read_oss(struct snd_info_buffer *buffer); - static int snd_sndstat_show_strings(struct snd_info_buffer *buf, char *id, int dev) { int idx, ok = -1; -- cgit v1.2.3 From 28e9e47384d333239a8335b439a92a13d29f91d6 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 17 Dec 2007 09:02:22 +0100 Subject: [ALSA] PCM - added back TSTAMP ioctl for PCM (for old alsa-lib binaries) Signed-off-by: Jaroslav Kysela --- include/sound/asound.h | 1 + sound/core/pcm_native.c | 2 ++ 2 files changed, 3 insertions(+) (limited to 'include') diff --git a/include/sound/asound.h b/include/sound/asound.h index 475eb71d65ba..eda5c63ea547 100644 --- a/include/sound/asound.h +++ b/include/sound/asound.h @@ -443,6 +443,7 @@ enum { enum { SNDRV_PCM_IOCTL_PVERSION = _IOR('A', 0x00, int), SNDRV_PCM_IOCTL_INFO = _IOR('A', 0x01, struct snd_pcm_info), + SNDRV_PCM_IOCTL_TSTAMP = _IOW('A', 0x02, int), SNDRV_PCM_IOCTL_TTSTAMP = _IOW('A', 0x03, int), SNDRV_PCM_IOCTL_HW_REFINE = _IOWR('A', 0x10, struct snd_pcm_hw_params), SNDRV_PCM_IOCTL_HW_PARAMS = _IOWR('A', 0x11, struct snd_pcm_hw_params), diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 7fb7c921b27d..2e7b1e63db94 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -2546,6 +2546,8 @@ static int snd_pcm_common_ioctl1(struct file *file, return put_user(SNDRV_PCM_VERSION, (int __user *)arg) ? -EFAULT : 0; case SNDRV_PCM_IOCTL_INFO: return snd_pcm_info_user(substream, arg); + case SNDRV_PCM_IOCTL_TSTAMP: /* just for compatibility */ + return 0; case SNDRV_PCM_IOCTL_TTSTAMP: return snd_pcm_tstamp(substream, arg); case SNDRV_PCM_IOCTL_HW_REFINE: -- cgit v1.2.3 From b7d2a8035a382ad268aba8c0612797b4f2625f61 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Tue, 18 Dec 2007 13:14:21 +0100 Subject: [ALSA] include/sound/: Spelling fixes Signed-off-by: Joe Perches Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- include/sound/ad1848.h | 2 +- include/sound/cs4231-regs.h | 2 +- include/sound/soc-dapm.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/sound/ad1848.h b/include/sound/ad1848.h index d04f9e78c7c1..d9aebdf6db63 100644 --- a/include/sound/ad1848.h +++ b/include/sound/ad1848.h @@ -48,7 +48,7 @@ #define AD1848_IFACE_CTRL 0x09 /* interface control - bits 7-2 MCE */ #define AD1848_PIN_CTRL 0x0a /* pin control */ #define AD1848_TEST_INIT 0x0b /* test and initialization */ -#define AD1848_MISC_INFO 0x0c /* miscellaneaous information */ +#define AD1848_MISC_INFO 0x0c /* miscellaneous information */ #define AD1848_LOOPBACK 0x0d /* loopback control */ #define AD1848_DATA_UPR_CNT 0x0e /* playback/capture upper base count */ #define AD1848_DATA_LWR_CNT 0x0f /* playback/capture lower base count */ diff --git a/include/sound/cs4231-regs.h b/include/sound/cs4231-regs.h index f1490265c9b8..e8d1f3e31f9e 100644 --- a/include/sound/cs4231-regs.h +++ b/include/sound/cs4231-regs.h @@ -45,7 +45,7 @@ #define CS4231_IFACE_CTRL 0x09 /* interface control - bits 7-2 MCE */ #define CS4231_PIN_CTRL 0x0a /* pin control */ #define CS4231_TEST_INIT 0x0b /* test and initialization */ -#define CS4231_MISC_INFO 0x0c /* miscellaneaous information */ +#define CS4231_MISC_INFO 0x0c /* miscellaneous information */ #define CS4231_LOOPBACK 0x0d /* loopback control */ #define CS4231_PLY_UPR_CNT 0x0e /* playback upper base count */ #define CS4231_PLY_LWR_CNT 0x0f /* playback lower base count */ diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 2b1ae8edc43c..b9d586442518 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h @@ -22,7 +22,7 @@ #define SND_SOC_NOPM -1 /* - * SoC dynamic audio power managment + * SoC dynamic audio power management * * We can have upto 4 power domains * 1. Codec domain - VREF, VMID -- cgit v1.2.3 From 8ace4f3c9d83fd60e7539526a3a70bf5730db8c0 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 8 Jan 2008 17:57:26 +0100 Subject: [ALSA] Remove indirect control access This patch removes the indirect control access to the control elements. The indirect access has never been used and is even broken on 32bit ioctl wrapper. Let's clean it up. The pointers still remain in snd_ctl_elem_* structs just to make sure that the struct size won't change. Once after checking the size consistency, we can get rid of them, too. Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- include/sound/asound.h | 17 ++++++++--------- sound/core/control.c | 51 ++++++++++++++++++++------------------------------ 2 files changed, 28 insertions(+), 40 deletions(-) (limited to 'include') diff --git a/include/sound/asound.h b/include/sound/asound.h index eda5c63ea547..ee753d782e2d 100644 --- a/include/sound/asound.h +++ b/include/sound/asound.h @@ -696,7 +696,7 @@ struct snd_timer_tread { * * ****************************************************************************/ -#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 4) +#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 5) struct snd_ctl_card_info { int card; /* card number */ @@ -745,8 +745,7 @@ typedef int __bitwise snd_ctl_elem_iface_t; #define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10) /* write lock owner */ #define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK (1<<28) /* kernel use a TLV callback */ #define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */ -#define SNDRV_CTL_ELEM_ACCESS_DINDIRECT (1<<30) /* indirect access for matrix dimensions in the info structure */ -#define SNDRV_CTL_ELEM_ACCESS_INDIRECT (1<<31) /* indirect access for element value in the value structure */ +/* bits 30 and 31 are obsoleted (for indirect access) */ /* for further details see the ACPI and PCI power management specification */ #define SNDRV_CTL_POWER_D0 0x0000 /* full On */ @@ -800,30 +799,30 @@ struct snd_ctl_elem_info { } value; union { unsigned short d[4]; /* dimensions */ - unsigned short *d_ptr; /* indirect */ + unsigned short *d_ptr; /* indirect - obsoleted */ } dimen; unsigned char reserved[64-4*sizeof(unsigned short)]; }; struct snd_ctl_elem_value { struct snd_ctl_elem_id id; /* W: element ID */ - unsigned int indirect: 1; /* W: use indirect pointer (xxx_ptr member) */ + unsigned int indirect: 1; /* W: indirect access - obsoleted */ union { union { long value[128]; - long *value_ptr; + long *value_ptr; /* obsoleted */ } integer; union { long long value[64]; - long long *value_ptr; + long long *value_ptr; /* obsoleted */ } integer64; union { unsigned int item[128]; - unsigned int *item_ptr; + unsigned int *item_ptr; /* obsoleted */ } enumerated; union { unsigned char data[512]; - unsigned char *data_ptr; + unsigned char *data_ptr; /* obsoleted */ } bytes; struct snd_aes_iec958 iec958; } value; /* RO */ diff --git a/sound/core/control.c b/sound/core/control.c index df0774c76f6f..c89ca0d1f3ce 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -232,8 +232,6 @@ struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new *ncontrol, access = ncontrol->access == 0 ? SNDRV_CTL_ELEM_ACCESS_READWRITE : (ncontrol->access & (SNDRV_CTL_ELEM_ACCESS_READWRITE| SNDRV_CTL_ELEM_ACCESS_INACTIVE| - SNDRV_CTL_ELEM_ACCESS_DINDIRECT| - SNDRV_CTL_ELEM_ACCESS_INDIRECT| SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE| SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK)); kctl.info = ncontrol->info; @@ -692,7 +690,7 @@ int snd_ctl_elem_read(struct snd_card *card, struct snd_ctl_elem_value *control) struct snd_kcontrol *kctl; struct snd_kcontrol_volatile *vd; unsigned int index_offset; - int result, indirect; + int result; down_read(&card->controls_rwsem); kctl = snd_ctl_find_id(card, &control->id); @@ -701,17 +699,12 @@ int snd_ctl_elem_read(struct snd_card *card, struct snd_ctl_elem_value *control) } else { index_offset = snd_ctl_get_ioff(kctl, &control->id); vd = &kctl->vd[index_offset]; - indirect = vd->access & SNDRV_CTL_ELEM_ACCESS_INDIRECT ? 1 : 0; - if (control->indirect != indirect) { - result = -EACCES; - } else { - if ((vd->access & SNDRV_CTL_ELEM_ACCESS_READ) && kctl->get != NULL) { - snd_ctl_build_ioff(&control->id, kctl, index_offset); - result = kctl->get(kctl, control); - } else { - result = -EPERM; - } - } + if ((vd->access & SNDRV_CTL_ELEM_ACCESS_READ) && + kctl->get != NULL) { + snd_ctl_build_ioff(&control->id, kctl, index_offset); + result = kctl->get(kctl, control); + } else + result = -EPERM; } up_read(&card->controls_rwsem); return result; @@ -748,7 +741,7 @@ int snd_ctl_elem_write(struct snd_card *card, struct snd_ctl_file *file, struct snd_kcontrol *kctl; struct snd_kcontrol_volatile *vd; unsigned int index_offset; - int result, indirect; + int result; down_read(&card->controls_rwsem); kctl = snd_ctl_find_id(card, &control->id); @@ -757,23 +750,19 @@ int snd_ctl_elem_write(struct snd_card *card, struct snd_ctl_file *file, } else { index_offset = snd_ctl_get_ioff(kctl, &control->id); vd = &kctl->vd[index_offset]; - indirect = vd->access & SNDRV_CTL_ELEM_ACCESS_INDIRECT ? 1 : 0; - if (control->indirect != indirect) { - result = -EACCES; + if (!(vd->access & SNDRV_CTL_ELEM_ACCESS_WRITE) || + kctl->put == NULL || + (file && vd->owner && vd->owner != file)) { + result = -EPERM; } else { - if (!(vd->access & SNDRV_CTL_ELEM_ACCESS_WRITE) || - kctl->put == NULL || - (file && vd->owner != NULL && vd->owner != file)) { - result = -EPERM; - } else { - snd_ctl_build_ioff(&control->id, kctl, index_offset); - result = kctl->put(kctl, control); - } - if (result > 0) { - up_read(&card->controls_rwsem); - snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, &control->id); - return 0; - } + snd_ctl_build_ioff(&control->id, kctl, index_offset); + result = kctl->put(kctl, control); + } + if (result > 0) { + up_read(&card->controls_rwsem); + snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, + &control->id); + return 0; } } up_read(&card->controls_rwsem); -- cgit v1.2.3 From d948035a928400ae127c873fbf771389bee18949 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 8 Jan 2008 18:05:26 +0100 Subject: [ALSA] Remove PCM xfer_align sw params The xfer_align sw_params parameter has never been used in a sane manner, and no one understands what this does exactly. The current implementation looks also buggy because it allows write of shorter size than xfer_align. So, if you do partial writes, the write isn't actually aligned at all. Removing this parameter will make some pcm_lib_* code more readable (and less buggy). Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- .../sound/alsa/DocBook/writing-an-alsa-driver.tmpl | 1 - include/sound/asound.h | 2 +- include/sound/pcm.h | 1 - sound/core/oss/pcm_oss.c | 1 - sound/core/pcm.c | 1 - sound/core/pcm_lib.c | 18 ++++-------------- sound/core/pcm_native.c | 13 ------------- 7 files changed, 5 insertions(+), 32 deletions(-) (limited to 'include') diff --git a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl index 48e4053eda12..835e320eeb4d 100644 --- a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl +++ b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl @@ -2188,7 +2188,6 @@ struct _snd_pcm_runtime { struct timespec tstamp_mode; /* mmap timestamp is updated */ unsigned int period_step; unsigned int sleep_min; /* min ticks to sleep */ - snd_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */ snd_pcm_uframes_t start_threshold; snd_pcm_uframes_t stop_threshold; snd_pcm_uframes_t silence_threshold; /* Silence filling happens when diff --git a/include/sound/asound.h b/include/sound/asound.h index ee753d782e2d..069d9120e622 100644 --- a/include/sound/asound.h +++ b/include/sound/asound.h @@ -363,7 +363,7 @@ struct snd_pcm_sw_params { unsigned int period_step; unsigned int sleep_min; /* min ticks to sleep */ snd_pcm_uframes_t avail_min; /* min avail frames for wakeup */ - snd_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */ + snd_pcm_uframes_t xfer_align; /* obsolete: xfer size need to be a multiple */ snd_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */ snd_pcm_uframes_t stop_threshold; /* min avail frames for automatic stop */ snd_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */ diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 65f636223d39..1270cbce776a 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h @@ -287,7 +287,6 @@ struct snd_pcm_runtime { int tstamp_mode; /* mmap timestamp is updated */ unsigned int period_step; unsigned int sleep_min; /* min ticks to sleep */ - snd_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */ snd_pcm_uframes_t start_threshold; snd_pcm_uframes_t stop_threshold; snd_pcm_uframes_t silence_threshold; /* Silence filling happens when diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index d0c4ceb9f0b4..be089ccd736d 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c @@ -988,7 +988,6 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream) sw_params->sleep_min = 0; sw_params->avail_min = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 1 : runtime->period_size; - sw_params->xfer_align = 1; if (atomic_read(&substream->mmap_count) || substream->oss.setup.nosilence) { sw_params->silence_threshold = 0; diff --git a/sound/core/pcm.c b/sound/core/pcm.c index cf9b9493d41d..97cb681502a3 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c @@ -389,7 +389,6 @@ static void snd_pcm_substream_proc_sw_params_read(struct snd_info_entry *entry, snd_iprintf(buffer, "period_step: %u\n", runtime->period_step); snd_iprintf(buffer, "sleep_min: %u\n", runtime->sleep_min); snd_iprintf(buffer, "avail_min: %lu\n", runtime->control->avail_min); - snd_iprintf(buffer, "xfer_align: %lu\n", runtime->xfer_align); snd_iprintf(buffer, "start_threshold: %lu\n", runtime->start_threshold); snd_iprintf(buffer, "stop_threshold: %lu\n", runtime->stop_threshold); snd_iprintf(buffer, "silence_threshold: %lu\n", runtime->silence_threshold); diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index f9f9b3fe956e..c1c1556105c0 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -1628,8 +1628,6 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(struct snd_pcm_substream *substream, if (size == 0) return 0; - if (size > runtime->xfer_align) - size -= size % runtime->xfer_align; snd_pcm_stream_lock_irq(substream); switch (runtime->status->state) { @@ -1657,9 +1655,7 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(struct snd_pcm_substream *substream, avail = snd_pcm_playback_avail(runtime); if (!avail || (snd_pcm_running(substream) && - ((avail < runtime->control->avail_min && size > avail) || - (size >= runtime->xfer_align && - avail < runtime->xfer_align)))) { + (avail < runtime->control->avail_min && size > avail))) { wait_queue_t wait; enum { READY, SIGNALED, ERROR, SUSPENDED, EXPIRED, DROPPED } state; long tout; @@ -1731,8 +1727,6 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(struct snd_pcm_substream *substream, break; } } - if (avail > runtime->xfer_align) - avail -= avail % runtime->xfer_align; frames = size > avail ? avail : size; cont = runtime->buffer_size - runtime->control->appl_ptr % runtime->buffer_size; if (frames > cont) @@ -1900,8 +1894,6 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(struct snd_pcm_substream *substream, if (size == 0) return 0; - if (size > runtime->xfer_align) - size -= size % runtime->xfer_align; snd_pcm_stream_lock_irq(substream); switch (runtime->status->state) { @@ -1936,12 +1928,12 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(struct snd_pcm_substream *substream, __draining: avail = snd_pcm_capture_avail(runtime); if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) { - if (avail < runtime->xfer_align) { + if (!avail) { err = -EPIPE; goto _end_unlock; } - } else if ((avail < runtime->control->avail_min && size > avail) || - (size >= runtime->xfer_align && avail < runtime->xfer_align)) { + } else if (avail < runtime->control->avail_min && + size > avail) { wait_queue_t wait; enum { READY, SIGNALED, ERROR, SUSPENDED, EXPIRED, DROPPED } state; long tout; @@ -2014,8 +2006,6 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(struct snd_pcm_substream *substream, break; } } - if (avail > runtime->xfer_align) - avail -= avail % runtime->xfer_align; frames = size > avail ? avail : size; cont = runtime->buffer_size - runtime->control->appl_ptr % runtime->buffer_size; if (frames > cont) diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 3fc33deabe35..3c22d78ee8f4 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -435,7 +435,6 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream, runtime->period_step = 1; runtime->sleep_min = 0; runtime->control->avail_min = runtime->period_size; - runtime->xfer_align = runtime->period_size; runtime->start_threshold = 1; runtime->stop_threshold = runtime->buffer_size; runtime->silence_threshold = 0; @@ -532,9 +531,6 @@ static int snd_pcm_sw_params(struct snd_pcm_substream *substream, return -EINVAL; if (params->avail_min == 0) return -EINVAL; - if (params->xfer_align == 0 || - params->xfer_align % runtime->min_align != 0) - return -EINVAL; if (params->silence_size >= runtime->boundary) { if (params->silence_threshold != 0) return -EINVAL; @@ -553,7 +549,6 @@ static int snd_pcm_sw_params(struct snd_pcm_substream *substream, runtime->stop_threshold = params->stop_threshold; runtime->silence_threshold = params->silence_threshold; runtime->silence_size = params->silence_size; - runtime->xfer_align = params->xfer_align; params->boundary = runtime->boundary; if (snd_pcm_running(substream)) { if (runtime->sleep_min) @@ -2239,8 +2234,6 @@ static snd_pcm_sframes_t snd_pcm_playback_rewind(struct snd_pcm_substream *subst } if (frames > (snd_pcm_uframes_t)hw_avail) frames = hw_avail; - else - frames -= frames % runtime->xfer_align; appl_ptr = runtime->control->appl_ptr - frames; if (appl_ptr < 0) appl_ptr += runtime->boundary; @@ -2289,8 +2282,6 @@ static snd_pcm_sframes_t snd_pcm_capture_rewind(struct snd_pcm_substream *substr } if (frames > (snd_pcm_uframes_t)hw_avail) frames = hw_avail; - else - frames -= frames % runtime->xfer_align; appl_ptr = runtime->control->appl_ptr - frames; if (appl_ptr < 0) appl_ptr += runtime->boundary; @@ -2340,8 +2331,6 @@ static snd_pcm_sframes_t snd_pcm_playback_forward(struct snd_pcm_substream *subs } if (frames > (snd_pcm_uframes_t)avail) frames = avail; - else - frames -= frames % runtime->xfer_align; appl_ptr = runtime->control->appl_ptr + frames; if (appl_ptr >= (snd_pcm_sframes_t)runtime->boundary) appl_ptr -= runtime->boundary; @@ -2391,8 +2380,6 @@ static snd_pcm_sframes_t snd_pcm_capture_forward(struct snd_pcm_substream *subst } if (frames > (snd_pcm_uframes_t)avail) frames = avail; - else - frames -= frames % runtime->xfer_align; appl_ptr = runtime->control->appl_ptr + frames; if (appl_ptr >= (snd_pcm_sframes_t)runtime->boundary) appl_ptr -= runtime->boundary; -- cgit v1.2.3 From 31e8960b35975ed235d283d6fb95d0e28dffded0 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 8 Jan 2008 18:09:57 +0100 Subject: [ALSA] Remove PCM sleep_min and tick The 'tick' in PCM is set (again) via sw_params. And, nobody uses this feature at all except for a command line option of aplay. (This is literally 'nobody', as I checked alsa-lib API calls in all programs in major distros.) Above all, if we need finer wake-ups for the position update, it's basically an issue that the driver should solve, not tuned by each application. Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- include/sound/pcm.h | 7 --- sound/core/oss/pcm_oss.c | 1 - sound/core/pcm.c | 11 ----- sound/core/pcm_lib.c | 113 ++--------------------------------------------- sound/core/pcm_native.c | 30 ------------- 5 files changed, 3 insertions(+), 159 deletions(-) (limited to 'include') diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 1270cbce776a..51d58ccda2d8 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h @@ -274,7 +274,6 @@ struct snd_pcm_runtime { snd_pcm_uframes_t period_size; /* period size */ unsigned int periods; /* periods */ snd_pcm_uframes_t buffer_size; /* buffer size */ - unsigned int tick_time; /* tick time */ snd_pcm_uframes_t min_align; /* Min alignment for the format */ size_t byte_align; unsigned int frame_bits; @@ -286,7 +285,6 @@ struct snd_pcm_runtime { /* -- SW params -- */ int tstamp_mode; /* mmap timestamp is updated */ unsigned int period_step; - unsigned int sleep_min; /* min ticks to sleep */ snd_pcm_uframes_t start_threshold; snd_pcm_uframes_t stop_threshold; snd_pcm_uframes_t silence_threshold; /* Silence filling happens when @@ -305,7 +303,6 @@ struct snd_pcm_runtime { /* -- locking / scheduling -- */ wait_queue_head_t sleep; - struct timer_list tick_timer; struct fasync_struct *fasync; /* -- private section -- */ @@ -810,7 +807,6 @@ static inline const struct snd_interval *hw_param_interval_c(const struct snd_pc #define params_periods(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_PERIODS)->min #define params_buffer_size(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_BUFFER_SIZE)->min #define params_buffer_bytes(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_BUFFER_BYTES)->min -#define params_tick_time(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_TICK_TIME)->min int snd_interval_refine(struct snd_interval *i, const struct snd_interval *v); @@ -908,9 +904,6 @@ int snd_pcm_capture_xrun_check(struct snd_pcm_substream *substream); int snd_pcm_playback_xrun_asap(struct snd_pcm_substream *substream); int snd_pcm_capture_xrun_asap(struct snd_pcm_substream *substream); void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_uframes_t new_hw_ptr); -void snd_pcm_tick_prepare(struct snd_pcm_substream *substream); -void snd_pcm_tick_set(struct snd_pcm_substream *substream, unsigned long ticks); -void snd_pcm_tick_elapsed(struct snd_pcm_substream *substream); void snd_pcm_period_elapsed(struct snd_pcm_substream *substream); snd_pcm_sframes_t snd_pcm_lib_write(struct snd_pcm_substream *substream, const void __user *buf, diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index be089ccd736d..f7f15e399842 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c @@ -985,7 +985,6 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream) sw_params->stop_threshold = runtime->buffer_size; sw_params->tstamp_mode = SNDRV_PCM_TSTAMP_NONE; sw_params->period_step = 1; - sw_params->sleep_min = 0; sw_params->avail_min = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 1 : runtime->period_size; if (atomic_read(&substream->mmap_count) || diff --git a/sound/core/pcm.c b/sound/core/pcm.c index 97cb681502a3..cf3af39c3514 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c @@ -359,7 +359,6 @@ static void snd_pcm_substream_proc_hw_params_read(struct snd_info_entry *entry, snd_iprintf(buffer, "rate: %u (%u/%u)\n", runtime->rate, runtime->rate_num, runtime->rate_den); snd_iprintf(buffer, "period_size: %lu\n", runtime->period_size); snd_iprintf(buffer, "buffer_size: %lu\n", runtime->buffer_size); - snd_iprintf(buffer, "tick_time: %u\n", runtime->tick_time); #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) if (substream->oss.oss) { snd_iprintf(buffer, "OSS format: %s\n", snd_pcm_oss_format_name(runtime->oss.format)); @@ -387,7 +386,6 @@ static void snd_pcm_substream_proc_sw_params_read(struct snd_info_entry *entry, } snd_iprintf(buffer, "tstamp_mode: %s\n", snd_pcm_tstamp_mode_name(runtime->tstamp_mode)); snd_iprintf(buffer, "period_step: %u\n", runtime->period_step); - snd_iprintf(buffer, "sleep_min: %u\n", runtime->sleep_min); snd_iprintf(buffer, "avail_min: %lu\n", runtime->control->avail_min); snd_iprintf(buffer, "start_threshold: %lu\n", runtime->start_threshold); snd_iprintf(buffer, "stop_threshold: %lu\n", runtime->stop_threshold); @@ -764,12 +762,6 @@ static int snd_pcm_dev_free(struct snd_device *device) return snd_pcm_free(pcm); } -static void snd_pcm_tick_timer_func(unsigned long data) -{ - struct snd_pcm_substream *substream = (struct snd_pcm_substream *) data; - snd_pcm_tick_elapsed(substream); -} - int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream, struct file *file, struct snd_pcm_substream **rsubstream) @@ -876,9 +868,6 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream, memset((void*)runtime->control, 0, size); init_waitqueue_head(&runtime->sleep); - init_timer(&runtime->tick_timer); - runtime->tick_timer.function = snd_pcm_tick_timer_func; - runtime->tick_timer.data = (unsigned long) substream; runtime->status->state = SNDRV_PCM_STATE_OPEN; diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index b406630d8fdf..f00758c2bded 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -1451,112 +1451,13 @@ int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream, EXPORT_SYMBOL(snd_pcm_lib_ioctl); -/* - * Conditions - */ - -static void snd_pcm_system_tick_set(struct snd_pcm_substream *substream, - unsigned long ticks) -{ - struct snd_pcm_runtime *runtime = substream->runtime; - if (ticks == 0) - del_timer(&runtime->tick_timer); - else { - ticks += (1000000 / HZ) - 1; - ticks /= (1000000 / HZ); - mod_timer(&runtime->tick_timer, jiffies + ticks); - } -} - -/* Temporary alias */ -void snd_pcm_tick_set(struct snd_pcm_substream *substream, unsigned long ticks) -{ - snd_pcm_system_tick_set(substream, ticks); -} - -void snd_pcm_tick_prepare(struct snd_pcm_substream *substream) -{ - struct snd_pcm_runtime *runtime = substream->runtime; - snd_pcm_uframes_t frames = ULONG_MAX; - snd_pcm_uframes_t avail, dist; - unsigned int ticks; - u_int64_t n; - u_int32_t r; - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { - if (runtime->silence_size >= runtime->boundary) { - frames = 1; - } else if (runtime->silence_size > 0 && - runtime->silence_filled < runtime->buffer_size) { - snd_pcm_sframes_t noise_dist; - noise_dist = snd_pcm_playback_hw_avail(runtime) + runtime->silence_filled; - if (noise_dist > (snd_pcm_sframes_t)runtime->silence_threshold) - frames = noise_dist - runtime->silence_threshold; - } - avail = snd_pcm_playback_avail(runtime); - } else { - avail = snd_pcm_capture_avail(runtime); - } - if (avail < runtime->control->avail_min) { - snd_pcm_sframes_t to_avail_min = - runtime->control->avail_min - avail; - if (to_avail_min > 0 && - frames > (snd_pcm_uframes_t)to_avail_min) - frames = to_avail_min; - } - if (avail < runtime->buffer_size) { - snd_pcm_sframes_t to_buffer_size = - runtime->buffer_size - avail; - if (to_buffer_size > 0 && - frames > (snd_pcm_uframes_t)to_buffer_size) - frames = to_buffer_size; - } - if (frames == ULONG_MAX) { - snd_pcm_tick_set(substream, 0); - return; - } - dist = runtime->status->hw_ptr - runtime->hw_ptr_base; - /* Distance to next interrupt */ - dist = runtime->period_size - dist % runtime->period_size; - if (dist <= frames) { - snd_pcm_tick_set(substream, 0); - return; - } - /* the base time is us */ - n = frames; - n *= 1000000; - div64_32(&n, runtime->tick_time * runtime->rate, &r); - ticks = n + (r > 0 ? 1 : 0); - if (ticks < runtime->sleep_min) - ticks = runtime->sleep_min; - snd_pcm_tick_set(substream, (unsigned long) ticks); -} - -void snd_pcm_tick_elapsed(struct snd_pcm_substream *substream) -{ - struct snd_pcm_runtime *runtime; - unsigned long flags; - - snd_assert(substream != NULL, return); - runtime = substream->runtime; - snd_assert(runtime != NULL, return); - - snd_pcm_stream_lock_irqsave(substream, flags); - if (!snd_pcm_running(substream) || - snd_pcm_update_hw_ptr(substream) < 0) - goto _end; - if (runtime->sleep_min) - snd_pcm_tick_prepare(substream); - _end: - snd_pcm_stream_unlock_irqrestore(substream, flags); -} - /** * snd_pcm_period_elapsed - update the pcm status for the next period * @substream: the pcm substream instance * * This function is called from the interrupt handler when the * PCM has processed the period size. It will update the current - * pointer, set up the tick, wake up sleepers, etc. + * pointer, wake up sleepers, etc. * * Even if more than one periods have elapsed since the last call, you * have to call this only once. @@ -1580,8 +1481,6 @@ void snd_pcm_period_elapsed(struct snd_pcm_substream *substream) if (substream->timer_running) snd_timer_interrupt(substream->timer, 1); - if (runtime->sleep_min) - snd_pcm_tick_prepare(substream); _end: snd_pcm_stream_unlock_irqrestore(substream, flags); if (runtime->transfer_ack_end) @@ -1715,7 +1614,7 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(struct snd_pcm_substream *substream, snd_pcm_uframes_t frames, appl_ptr, appl_ofs; snd_pcm_uframes_t avail; snd_pcm_uframes_t cont; - if (runtime->sleep_min == 0 && runtime->status->state == SNDRV_PCM_STATE_RUNNING) + if (runtime->status->state == SNDRV_PCM_STATE_RUNNING) snd_pcm_update_hw_ptr(substream); avail = snd_pcm_playback_avail(runtime); if (!avail) { @@ -1764,9 +1663,6 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(struct snd_pcm_substream *substream, if (err < 0) goto _end_unlock; } - if (runtime->sleep_min && - runtime->status->state == SNDRV_PCM_STATE_RUNNING) - snd_pcm_tick_prepare(substream); } _end_unlock: snd_pcm_stream_unlock_irq(substream); @@ -1923,7 +1819,7 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(struct snd_pcm_substream *substream, snd_pcm_uframes_t frames, appl_ptr, appl_ofs; snd_pcm_uframes_t avail; snd_pcm_uframes_t cont; - if (runtime->sleep_min == 0 && runtime->status->state == SNDRV_PCM_STATE_RUNNING) + if (runtime->status->state == SNDRV_PCM_STATE_RUNNING) snd_pcm_update_hw_ptr(substream); avail = snd_pcm_capture_avail(runtime); if (!avail) { @@ -1973,9 +1869,6 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(struct snd_pcm_substream *substream, offset += frames; size -= frames; xfer += frames; - if (runtime->sleep_min && - runtime->status->state == SNDRV_PCM_STATE_RUNNING) - snd_pcm_tick_prepare(substream); } _end_unlock: snd_pcm_stream_unlock_irq(substream); diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 3c22d78ee8f4..d6b4e6b6108f 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -413,7 +413,6 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream, runtime->period_size = params_period_size(params); runtime->periods = params_periods(params); runtime->buffer_size = params_buffer_size(params); - runtime->tick_time = params_tick_time(params); runtime->info = params->info; runtime->rate_num = params->rate_num; runtime->rate_den = params->rate_den; @@ -433,7 +432,6 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream, /* Default sw params */ runtime->tstamp_mode = SNDRV_PCM_TSTAMP_NONE; runtime->period_step = 1; - runtime->sleep_min = 0; runtime->control->avail_min = runtime->period_size; runtime->start_threshold = 1; runtime->stop_threshold = runtime->buffer_size; @@ -542,7 +540,6 @@ static int snd_pcm_sw_params(struct snd_pcm_substream *substream, } snd_pcm_stream_lock_irq(substream); runtime->tstamp_mode = params->tstamp_mode; - runtime->sleep_min = params->sleep_min; runtime->period_step = params->period_step; runtime->control->avail_min = params->avail_min; runtime->start_threshold = params->start_threshold; @@ -551,10 +548,6 @@ static int snd_pcm_sw_params(struct snd_pcm_substream *substream, runtime->silence_size = params->silence_size; params->boundary = runtime->boundary; if (snd_pcm_running(substream)) { - if (runtime->sleep_min) - snd_pcm_tick_prepare(substream); - else - snd_pcm_tick_set(substream, 0); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && runtime->silence_size > 0) snd_pcm_playback_silence(substream, ULONG_MAX); @@ -865,8 +858,6 @@ static void snd_pcm_post_start(struct snd_pcm_substream *substream, int state) if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && runtime->silence_size > 0) snd_pcm_playback_silence(substream, ULONG_MAX); - if (runtime->sleep_min) - snd_pcm_tick_prepare(substream); if (substream->timer) snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MSTART, &runtime->trigger_tstamp); @@ -920,7 +911,6 @@ static void snd_pcm_post_stop(struct snd_pcm_substream *substream, int state) snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MSTOP, &runtime->trigger_tstamp); runtime->status->state = state; - snd_pcm_tick_set(substream, 0); } wake_up(&runtime->sleep); } @@ -1004,12 +994,9 @@ static void snd_pcm_post_pause(struct snd_pcm_substream *substream, int push) snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MPAUSE, &runtime->trigger_tstamp); - snd_pcm_tick_set(substream, 0); wake_up(&runtime->sleep); } else { runtime->status->state = SNDRV_PCM_STATE_RUNNING; - if (runtime->sleep_min) - snd_pcm_tick_prepare(substream); if (substream->timer) snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MCONTINUE, @@ -1064,7 +1051,6 @@ static void snd_pcm_post_suspend(struct snd_pcm_substream *substream, int state) &runtime->trigger_tstamp); runtime->status->suspended_state = runtime->status->state; runtime->status->state = SNDRV_PCM_STATE_SUSPENDED; - snd_pcm_tick_set(substream, 0); wake_up(&runtime->sleep); } @@ -1167,8 +1153,6 @@ static void snd_pcm_post_resume(struct snd_pcm_substream *substream, int state) snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MRESUME, &runtime->trigger_tstamp); runtime->status->state = runtime->status->suspended_state; - if (runtime->sleep_min) - snd_pcm_tick_prepare(substream); } static struct action_ops snd_pcm_action_resume = { @@ -1997,8 +1981,6 @@ int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream) } /* FIXME: this belong to lowlevel */ - snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_TICK_TIME, - 1000000 / HZ, 1000000 / HZ); snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIOD_SIZE); return 0; @@ -2238,9 +2220,6 @@ static snd_pcm_sframes_t snd_pcm_playback_rewind(struct snd_pcm_substream *subst if (appl_ptr < 0) appl_ptr += runtime->boundary; runtime->control->appl_ptr = appl_ptr; - if (runtime->status->state == SNDRV_PCM_STATE_RUNNING && - runtime->sleep_min) - snd_pcm_tick_prepare(substream); ret = frames; __end: snd_pcm_stream_unlock_irq(substream); @@ -2286,9 +2265,6 @@ static snd_pcm_sframes_t snd_pcm_capture_rewind(struct snd_pcm_substream *substr if (appl_ptr < 0) appl_ptr += runtime->boundary; runtime->control->appl_ptr = appl_ptr; - if (runtime->status->state == SNDRV_PCM_STATE_RUNNING && - runtime->sleep_min) - snd_pcm_tick_prepare(substream); ret = frames; __end: snd_pcm_stream_unlock_irq(substream); @@ -2335,9 +2311,6 @@ static snd_pcm_sframes_t snd_pcm_playback_forward(struct snd_pcm_substream *subs if (appl_ptr >= (snd_pcm_sframes_t)runtime->boundary) appl_ptr -= runtime->boundary; runtime->control->appl_ptr = appl_ptr; - if (runtime->status->state == SNDRV_PCM_STATE_RUNNING && - runtime->sleep_min) - snd_pcm_tick_prepare(substream); ret = frames; __end: snd_pcm_stream_unlock_irq(substream); @@ -2384,9 +2357,6 @@ static snd_pcm_sframes_t snd_pcm_capture_forward(struct snd_pcm_substream *subst if (appl_ptr >= (snd_pcm_sframes_t)runtime->boundary) appl_ptr -= runtime->boundary; runtime->control->appl_ptr = appl_ptr; - if (runtime->status->state == SNDRV_PCM_STATE_RUNNING && - runtime->sleep_min) - snd_pcm_tick_prepare(substream); ret = frames; __end: snd_pcm_stream_unlock_irq(substream); -- cgit v1.2.3 From 9004acc70e8c49c50c4c7b652f906f1e0ed5709d Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 8 Jan 2008 18:13:27 +0100 Subject: [ALSA] Remove sound/driver.h This header file exists only for some hacks to adapt alsa-driver tree. It's useless for building in the kernel. Let's move a few lines in it to sound/core.h and remove it. With this patch, sound/driver.h isn't removed but has just a single compile warning to include it. This should be really killed in future. Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- .../sound/alsa/DocBook/writing-an-alsa-driver.tmpl | 2 - drivers/input/touchscreen/ucb1400_ts.c | 1 - drivers/media/video/cx88/cx88-alsa.c | 1 - drivers/media/video/saa7134/saa7134-alsa.c | 1 - drivers/media/video/saa7134/saa7134.h | 1 - drivers/usb/gadget/gmidi.c | 1 - include/asm-arm/arch-omap/eac.h | 1 - include/asm-arm/arch-omap/omap-alsa.h | 1 - include/asm-arm/arch-pxa/audio.h | 1 - include/sound/core.h | 10 +++++ include/sound/driver.h | 48 +--------------------- include/sound/opl3.h | 19 ++++----- include/sound/soc.h | 1 - sound/aoa/aoa.h | 2 - sound/aoa/soundbus/i2sbus/i2sbus-core.c | 1 - sound/aoa/soundbus/i2sbus/i2sbus-pcm.c | 3 -- sound/arm/aaci.c | 1 - sound/arm/devdma.c | 1 - sound/arm/pxa2xx-ac97.c | 1 - sound/arm/pxa2xx-pcm.c | 1 - sound/arm/sa11xx-uda1341.c | 1 - sound/core/control.c | 1 - sound/core/device.c | 1 - sound/core/hwdep.c | 1 - sound/core/info.c | 1 - sound/core/info_oss.c | 1 - sound/core/init.c | 1 - sound/core/isadma.c | 1 - sound/core/memory.c | 2 +- sound/core/misc.c | 1 - sound/core/oss/copy.c | 1 - sound/core/oss/io.c | 1 - sound/core/oss/linear.c | 1 - sound/core/oss/mixer_oss.c | 1 - sound/core/oss/mulaw.c | 1 - sound/core/oss/pcm_oss.c | 1 - sound/core/oss/pcm_plugin.c | 1 - sound/core/oss/rate.c | 1 - sound/core/oss/route.c | 1 - sound/core/pcm.c | 1 - sound/core/pcm_lib.c | 1 - sound/core/pcm_memory.c | 1 - sound/core/pcm_misc.c | 1 - sound/core/pcm_native.c | 1 - sound/core/pcm_timer.c | 1 - sound/core/rawmidi.c | 1 - sound/core/rtctimer.c | 1 - sound/core/seq/oss/seq_oss.c | 1 - sound/core/seq/oss/seq_oss_device.h | 1 - sound/core/seq/seq.c | 1 - sound/core/seq/seq_clientmgr.c | 1 - sound/core/seq/seq_device.c | 1 - sound/core/seq/seq_dummy.c | 1 - sound/core/seq/seq_fifo.c | 1 - sound/core/seq/seq_info.c | 1 - sound/core/seq/seq_lock.c | 1 - sound/core/seq/seq_memory.c | 1 - sound/core/seq/seq_midi.c | 1 - sound/core/seq/seq_midi_emul.c | 1 - sound/core/seq/seq_midi_event.c | 1 - sound/core/seq/seq_ports.c | 1 - sound/core/seq/seq_prioq.c | 1 - sound/core/seq/seq_queue.c | 1 - sound/core/seq/seq_system.c | 1 - sound/core/seq/seq_timer.c | 1 - sound/core/seq/seq_virmidi.c | 1 - sound/core/sound.c | 1 - sound/core/sound_oss.c | 2 - sound/core/timer.c | 1 - sound/drivers/dummy.c | 1 - sound/drivers/ml403-ac97cr.c | 1 - sound/drivers/mpu401/mpu401.c | 1 - sound/drivers/mpu401/mpu401_uart.c | 1 - sound/drivers/mtpav.c | 1 - sound/drivers/mts64.c | 1 - sound/drivers/pcm-indirect2.c | 2 - sound/drivers/portman2x4.c | 1 - sound/drivers/serial-u16550.c | 1 - sound/drivers/virmidi.c | 1 - sound/drivers/vx/vx_cmd.c | 1 - sound/drivers/vx/vx_core.c | 1 - sound/drivers/vx/vx_hwdep.c | 1 - sound/drivers/vx/vx_mixer.c | 1 - sound/drivers/vx/vx_pcm.c | 1 - sound/drivers/vx/vx_uer.c | 1 - sound/i2c/cs8427.c | 1 - sound/i2c/i2c.c | 1 - sound/i2c/l3/uda1341.c | 1 - sound/i2c/other/ak4114.c | 1 - sound/i2c/other/ak4117.c | 1 - sound/i2c/other/ak4xxx-adda.c | 1 - sound/i2c/other/pt2258.c | 1 - sound/i2c/other/tea575x-tuner.c | 1 - sound/i2c/tea6330t.c | 1 - sound/isa/ad1816a/ad1816a.c | 1 - sound/isa/ad1816a/ad1816a_lib.c | 1 - sound/isa/ad1848/ad1848.c | 1 - sound/isa/ad1848/ad1848_lib.c | 1 - sound/isa/adlib.c | 1 - sound/isa/als100.c | 1 - sound/isa/azt2320.c | 1 - sound/isa/cmi8330.c | 1 - sound/isa/cs423x/cs4231.c | 1 - sound/isa/cs423x/cs4231_lib.c | 1 - sound/isa/cs423x/cs4236.c | 1 - sound/isa/cs423x/cs4236_lib.c | 1 - sound/isa/dt019x.c | 1 - sound/isa/es1688/es1688.c | 1 - sound/isa/es1688/es1688_lib.c | 1 - sound/isa/es18xx.c | 1 - sound/isa/gus/gus_dma.c | 1 - sound/isa/gus/gus_dram.c | 1 - sound/isa/gus/gus_instr.c | 1 - sound/isa/gus/gus_io.c | 1 - sound/isa/gus/gus_irq.c | 1 - sound/isa/gus/gus_main.c | 1 - sound/isa/gus/gus_mem.c | 1 - sound/isa/gus/gus_mem_proc.c | 1 - sound/isa/gus/gus_mixer.c | 1 - sound/isa/gus/gus_pcm.c | 1 - sound/isa/gus/gus_reset.c | 1 - sound/isa/gus/gus_timer.c | 1 - sound/isa/gus/gus_uart.c | 1 - sound/isa/gus/gus_volume.c | 1 - sound/isa/gus/gusclassic.c | 1 - sound/isa/gus/gusextreme.c | 1 - sound/isa/gus/gusmax.c | 1 - sound/isa/gus/interwave.c | 1 - sound/isa/opl3sa2.c | 1 - sound/isa/opti9xx/miro.c | 1 - sound/isa/opti9xx/opti92x-ad1848.c | 1 - sound/isa/sb/emu8000.c | 1 - sound/isa/sb/emu8000_local.h | 1 - sound/isa/sb/es968.c | 1 - sound/isa/sb/sb16.c | 1 - sound/isa/sb/sb16_csp.c | 1 - sound/isa/sb/sb16_main.c | 1 - sound/isa/sb/sb8.c | 1 - sound/isa/sb/sb8_main.c | 1 - sound/isa/sb/sb8_midi.c | 1 - sound/isa/sb/sb_common.c | 1 - sound/isa/sb/sb_mixer.c | 1 - sound/isa/sc6000.c | 1 - sound/isa/sgalaxy.c | 1 - sound/isa/sscape.c | 1 - sound/isa/wavefront/wavefront.c | 1 - sound/isa/wavefront/wavefront_fx.c | 1 - sound/isa/wavefront/wavefront_midi.c | 1 - sound/isa/wavefront/wavefront_synth.c | 1 - sound/last.c | 1 - sound/mips/au1x00.c | 1 - sound/parisc/harmony.c | 1 - sound/pci/ac97/ac97_codec.c | 1 - sound/pci/ac97/ac97_pcm.c | 1 - sound/pci/ac97/ac97_proc.c | 1 - sound/pci/ac97/ak4531_codec.c | 1 - sound/pci/ad1889.c | 1 - sound/pci/ali5451/ali5451.c | 1 - sound/pci/als300.c | 1 - sound/pci/als4000.c | 1 - sound/pci/atiixp.c | 1 - sound/pci/atiixp_modem.c | 1 - sound/pci/au88x0/au88x0.h | 1 - sound/pci/au88x0/au88x0_game.c | 1 - sound/pci/au88x0/au88x0_mixer.c | 1 - sound/pci/au88x0/au88x0_mpu401.c | 1 - sound/pci/au88x0/au88x0_pcm.c | 1 - sound/pci/azt3328.c | 1 - sound/pci/bt87x.c | 1 - sound/pci/ca0106/ca0106_main.c | 1 - sound/pci/ca0106/ca0106_mixer.c | 1 - sound/pci/ca0106/ca0106_proc.c | 1 - sound/pci/ca0106/ca_midi.c | 1 - sound/pci/cmipci.c | 1 - sound/pci/cs4281.c | 1 - sound/pci/cs46xx/cs46xx.c | 1 - sound/pci/cs46xx/cs46xx_lib.c | 1 - sound/pci/cs46xx/dsp_spos.c | 1 - sound/pci/cs46xx/dsp_spos_scb_lib.c | 1 - sound/pci/cs5530.c | 1 - sound/pci/cs5535audio/cs5535audio.c | 1 - sound/pci/cs5535audio/cs5535audio_pcm.c | 1 - sound/pci/cs5535audio/cs5535audio_pm.c | 1 - sound/pci/echoaudio/darla20.c | 1 - sound/pci/echoaudio/darla24.c | 1 - sound/pci/echoaudio/echo3g.c | 1 - sound/pci/echoaudio/gina20.c | 1 - sound/pci/echoaudio/gina24.c | 1 - sound/pci/echoaudio/indigo.c | 1 - sound/pci/echoaudio/indigodj.c | 1 - sound/pci/echoaudio/indigoio.c | 1 - sound/pci/echoaudio/layla20.c | 1 - sound/pci/echoaudio/layla24.c | 1 - sound/pci/echoaudio/mia.c | 1 - sound/pci/echoaudio/mona.c | 1 - sound/pci/emu10k1/emu10k1.c | 1 - sound/pci/emu10k1/emu10k1_main.c | 1 - sound/pci/emu10k1/emu10k1_synth_local.h | 1 - sound/pci/emu10k1/emu10k1x.c | 1 - sound/pci/emu10k1/emufx.c | 1 - sound/pci/emu10k1/emumixer.c | 1 - sound/pci/emu10k1/emumpu401.c | 1 - sound/pci/emu10k1/emupcm.c | 1 - sound/pci/emu10k1/emuproc.c | 1 - sound/pci/emu10k1/io.c | 1 - sound/pci/emu10k1/irq.c | 1 - sound/pci/emu10k1/memory.c | 1 - sound/pci/emu10k1/p16v.c | 1 - sound/pci/emu10k1/timer.c | 1 - sound/pci/emu10k1/voice.c | 1 - sound/pci/ens1370.c | 1 - sound/pci/es1938.c | 1 - sound/pci/es1968.c | 1 - sound/pci/fm801.c | 1 - sound/pci/hda/hda_codec.c | 1 - sound/pci/hda/hda_generic.c | 1 - sound/pci/hda/hda_hwdep.c | 1 - sound/pci/hda/hda_intel.c | 1 - sound/pci/hda/hda_proc.c | 1 - sound/pci/hda/patch_analog.c | 1 - sound/pci/hda/patch_atihdmi.c | 1 - sound/pci/hda/patch_cmedia.c | 1 - sound/pci/hda/patch_conexant.c | 1 - sound/pci/hda/patch_realtek.c | 1 - sound/pci/hda/patch_si3054.c | 1 - sound/pci/hda/patch_sigmatel.c | 1 - sound/pci/hda/patch_via.c | 1 - sound/pci/ice1712/ak4xxx.c | 1 - sound/pci/ice1712/amp.c | 1 - sound/pci/ice1712/aureon.c | 1 - sound/pci/ice1712/delta.c | 1 - sound/pci/ice1712/ews.c | 1 - sound/pci/ice1712/hoontech.c | 1 - sound/pci/ice1712/ice1712.c | 1 - sound/pci/ice1712/ice1724.c | 1 - sound/pci/ice1712/juli.c | 1 - sound/pci/ice1712/phase.c | 1 - sound/pci/ice1712/pontis.c | 1 - sound/pci/ice1712/prodigy192.c | 1 - sound/pci/ice1712/revo.c | 1 - sound/pci/ice1712/se.c | 1 - sound/pci/ice1712/vt1720_mobo.c | 1 - sound/pci/ice1712/wtm.c | 1 - sound/pci/intel8x0.c | 1 - sound/pci/intel8x0m.c | 1 - sound/pci/korg1212/korg1212.c | 1 - sound/pci/maestro3.c | 1 - sound/pci/mixart/mixart.c | 1 - sound/pci/mixart/mixart_core.c | 1 - sound/pci/mixart/mixart_hwdep.c | 1 - sound/pci/mixart/mixart_mixer.c | 1 - sound/pci/nm256/nm256.c | 1 - sound/pci/oxygen/oxygen.c | 1 - sound/pci/oxygen/oxygen_io.c | 1 - sound/pci/oxygen/oxygen_lib.c | 1 - sound/pci/oxygen/oxygen_mixer.c | 1 - sound/pci/oxygen/oxygen_pcm.c | 1 - sound/pci/oxygen/virtuoso.c | 1 - sound/pci/pcxhr/pcxhr.c | 1 - sound/pci/pcxhr/pcxhr_core.c | 1 - sound/pci/pcxhr/pcxhr_hwdep.c | 1 - sound/pci/pcxhr/pcxhr_mixer.c | 1 - sound/pci/riptide/riptide.c | 1 - sound/pci/rme32.c | 1 - sound/pci/rme96.c | 1 - sound/pci/rme9652/hdsp.c | 1 - sound/pci/rme9652/hdspm.c | 1 - sound/pci/rme9652/rme9652.c | 1 - sound/pci/sis7019.c | 1 - sound/pci/sonicvibes.c | 1 - sound/pci/trident/trident.c | 1 - sound/pci/trident/trident_main.c | 1 - sound/pci/trident/trident_memory.c | 1 - sound/pci/via82xx.c | 1 - sound/pci/via82xx_modem.c | 1 - sound/pci/vx222/vx222.c | 1 - sound/pci/vx222/vx222_ops.c | 1 - sound/pci/ymfpci/ymfpci.c | 1 - sound/pci/ymfpci/ymfpci_main.c | 1 - sound/pcmcia/pdaudiocf/pdaudiocf.c | 1 - sound/pcmcia/pdaudiocf/pdaudiocf_core.c | 1 - sound/pcmcia/pdaudiocf/pdaudiocf_irq.c | 1 - sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c | 1 - sound/pcmcia/vx/vxp_mixer.c | 1 - sound/pcmcia/vx/vxp_ops.c | 1 - sound/pcmcia/vx/vxpocket.c | 1 - sound/ppc/awacs.c | 1 - sound/ppc/beep.c | 1 - sound/ppc/burgundy.c | 1 - sound/ppc/daca.c | 1 - sound/ppc/keywest.c | 1 - sound/ppc/pmac.c | 1 - sound/ppc/powermac.c | 1 - sound/ppc/snd_ps3.c | 1 - sound/ppc/tumbler.c | 1 - sound/sh/aica.c | 1 - sound/soc/at91/at91-pcm.c | 1 - sound/soc/at91/at91-ssc.c | 1 - sound/soc/at91/eti_b1_wm8731.c | 1 - sound/soc/codecs/ac97.c | 1 - sound/soc/codecs/cs4270.c | 1 - sound/soc/codecs/tlv320aic3x.c | 1 - sound/soc/codecs/wm8731.c | 1 - sound/soc/codecs/wm8750.c | 1 - sound/soc/codecs/wm8753.c | 1 - sound/soc/codecs/wm9712.c | 1 - sound/soc/pxa/corgi.c | 1 - sound/soc/pxa/poodle.c | 1 - sound/soc/pxa/pxa2xx-ac97.c | 1 - sound/soc/pxa/pxa2xx-i2s.c | 1 - sound/soc/pxa/pxa2xx-pcm.c | 1 - sound/soc/pxa/spitz.c | 1 - sound/soc/pxa/tosa.c | 1 - sound/soc/s3c24xx/ln2440sbc_alc650.c | 1 - sound/soc/s3c24xx/neo1973_wm8753.c | 1 - sound/soc/s3c24xx/s3c2443-ac97.c | 1 - sound/soc/s3c24xx/s3c24xx-i2s.c | 1 - sound/soc/s3c24xx/s3c24xx-pcm.c | 1 - sound/soc/s3c24xx/smdk2443_wm9710.c | 1 - sound/soc/sh/dma-sh7760.c | 1 - sound/soc/sh/hac.c | 1 - sound/soc/sh/sh7760-ac97.c | 1 - sound/soc/sh/ssi.c | 1 - sound/soc/soc-core.c | 1 - sound/soc/soc-dapm.c | 1 - sound/sparc/amd7930.c | 1 - sound/sparc/cs4231.c | 1 - sound/sparc/dbri.c | 1 - sound/spi/at73c213.c | 1 - sound/synth/emux/emux.c | 1 - sound/synth/emux/emux_hwdep.c | 1 - sound/synth/emux/emux_oss.c | 1 - sound/synth/emux/emux_proc.c | 1 - sound/synth/emux/emux_voice.h | 1 - sound/synth/emux/soundfont.c | 1 - sound/synth/util_mem.c | 1 - sound/usb/caiaq/caiaq-audio.c | 1 - sound/usb/caiaq/caiaq-control.c | 1 - sound/usb/caiaq/caiaq-device.c | 1 - sound/usb/caiaq/caiaq-input.c | 1 - sound/usb/caiaq/caiaq-midi.c | 1 - sound/usb/usbaudio.c | 1 - sound/usb/usbmidi.c | 1 - sound/usb/usbmixer.c | 1 - sound/usb/usx2y/usX2Yhwdep.c | 1 - sound/usb/usx2y/usbusx2y.c | 1 - sound/usb/usx2y/usbusx2yaudio.c | 1 - 347 files changed, 20 insertions(+), 408 deletions(-) (limited to 'include') diff --git a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl index 835e320eeb4d..b03df4d4795c 100644 --- a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl +++ b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl @@ -394,7 +394,6 @@ Basic Flow for PCI Drivers - Example #include #include #include @@ -751,7 +750,6 @@ #include #include #include diff --git a/drivers/input/touchscreen/ucb1400_ts.c b/drivers/input/touchscreen/ucb1400_ts.c index 7549939b9535..986a8365e37f 100644 --- a/drivers/input/touchscreen/ucb1400_ts.c +++ b/drivers/input/touchscreen/ucb1400_ts.c @@ -27,7 +27,6 @@ #include #include -#include #include #include diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c index 8735227f7e47..316b106c3511 100644 --- a/drivers/media/video/cx88/cx88-alsa.c +++ b/drivers/media/video/cx88/cx88-alsa.c @@ -33,7 +33,6 @@ #include #include -#include #include #include #include diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c index ba2531034a91..047add8f3010 100644 --- a/drivers/media/video/saa7134/saa7134-alsa.c +++ b/drivers/media/video/saa7134/saa7134-alsa.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index ce450304fb53..b88ca995fafb 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #if defined(CONFIG_VIDEO_SAA7134_DVB) || defined(CONFIG_VIDEO_SAA7134_DVB_MODULE) diff --git a/drivers/usb/gadget/gmidi.c b/drivers/usb/gadget/gmidi.c index 0689189550bc..7da7fcb05640 100644 --- a/drivers/usb/gadget/gmidi.c +++ b/drivers/usb/gadget/gmidi.c @@ -24,7 +24,6 @@ #include #include -#include #include #include #include diff --git a/include/asm-arm/arch-omap/eac.h b/include/asm-arm/arch-omap/eac.h index 6662cb02bafc..ccee3b0700b3 100644 --- a/include/asm-arm/arch-omap/eac.h +++ b/include/asm-arm/arch-omap/eac.h @@ -31,7 +31,6 @@ #include #include -#include #include /* master codec clock source */ diff --git a/include/asm-arm/arch-omap/omap-alsa.h b/include/asm-arm/arch-omap/omap-alsa.h index fcaf44c14714..faa0ed23d4ba 100644 --- a/include/asm-arm/arch-omap/omap-alsa.h +++ b/include/asm-arm/arch-omap/omap-alsa.h @@ -40,7 +40,6 @@ #ifndef __OMAP_ALSA_H #define __OMAP_ALSA_H -#include #include #include #include diff --git a/include/asm-arm/arch-pxa/audio.h b/include/asm-arm/arch-pxa/audio.h index 17eccd720136..52bbe3bc25e1 100644 --- a/include/asm-arm/arch-pxa/audio.h +++ b/include/asm-arm/arch-pxa/audio.h @@ -1,7 +1,6 @@ #ifndef __ASM_ARCH_AUDIO_H__ #define __ASM_ARCH_AUDIO_H__ -#include #include #include diff --git a/include/sound/core.h b/include/sound/core.h index 6954836487ed..4fc0235ad784 100644 --- a/include/sound/core.h +++ b/include/sound/core.h @@ -22,12 +22,22 @@ * */ +#include #include /* wake_up() */ #include /* struct mutex */ #include /* struct rw_semaphore */ #include /* pm_message_t */ #include +/* number of supported soundcards */ +#ifdef CONFIG_SND_DYNAMIC_MINORS +#define SNDRV_CARDS 32 +#else +#define SNDRV_CARDS 8 /* don't change - minor numbers */ +#endif + +#define CONFIG_SND_MAJOR 116 /* standard configuration */ + /* forward declarations */ #ifdef CONFIG_PCI struct pci_dev; diff --git a/include/sound/driver.h b/include/sound/driver.h index 1889929d1831..f0359437d01a 100644 --- a/include/sound/driver.h +++ b/include/sound/driver.h @@ -1,47 +1 @@ -#ifndef __SOUND_DRIVER_H -#define __SOUND_DRIVER_H - -/* - * Main header file for the ALSA driver - * Copyright (c) 1994-2000 by Jaroslav Kysela - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifdef ALSA_BUILD -#include "config.h" -#endif - - -/* number of supported soundcards */ -#ifdef CONFIG_SND_DYNAMIC_MINORS -#define SNDRV_CARDS 32 -#else -#define SNDRV_CARDS 8 /* don't change - minor numbers */ -#endif - -#ifndef CONFIG_SND_MAJOR /* standard configuration */ -#define CONFIG_SND_MAJOR 116 -#endif - -#ifdef ALSA_BUILD -#include "adriver.h" -#endif - -#include - -#endif /* __SOUND_DRIVER_H */ +#warning "This file is deprecated" diff --git a/include/sound/opl3.h b/include/sound/opl3.h index d7e33ce09120..a0c5febdc4ea 100644 --- a/include/sound/opl3.h +++ b/include/sound/opl3.h @@ -51,19 +51,16 @@ * */ -#include "driver.h" -#include -#include -#include "core.h" -#include "hwdep.h" -#include "timer.h" -#include "seq_midi_emul.h" +#include +#include +#include +#include #ifdef CONFIG_SND_SEQUENCER_OSS -#include "seq_oss.h" -#include "seq_oss_legacy.h" +#include +#include #endif -#include "seq_device.h" -#include "asound_fm.h" +#include +#include /* * Register numbers for the global registers diff --git a/include/sound/soc.h b/include/sound/soc.h index f47ef1f75f18..c22c65650405 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/aoa/aoa.h b/sound/aoa/aoa.h index 541b908f3cdf..e08789484e30 100644 --- a/sound/aoa/aoa.h +++ b/sound/aoa/aoa.h @@ -10,8 +10,6 @@ #define __AOA_H #include #include -/* So apparently there's a reason for requiring driver.h to be included first! */ -#include #include #include #include diff --git a/sound/aoa/soundbus/i2sbus/i2sbus-core.c b/sound/aoa/soundbus/i2sbus/i2sbus-core.c index efb9441b3acf..e6beb92c6933 100644 --- a/sound/aoa/soundbus/i2sbus/i2sbus-core.c +++ b/sound/aoa/soundbus/i2sbus/i2sbus-core.c @@ -11,7 +11,6 @@ #include #include -#include #include #include diff --git a/sound/aoa/soundbus/i2sbus/i2sbus-pcm.c b/sound/aoa/soundbus/i2sbus/i2sbus-pcm.c index e6ffea9128c7..59bacd365733 100644 --- a/sound/aoa/soundbus/i2sbus/i2sbus-pcm.c +++ b/sound/aoa/soundbus/i2sbus/i2sbus-pcm.c @@ -8,9 +8,6 @@ #include #include -/* So apparently there's a reason for requiring driver.h - * to be included first, even if I don't know it... */ -#include #include #include #include diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c index 3b73ba7d03e8..b0a474494966 100644 --- a/sound/arm/aaci.c +++ b/sound/arm/aaci.c @@ -23,7 +23,6 @@ #include #include -#include #include #include #include diff --git a/sound/arm/devdma.c b/sound/arm/devdma.c index ca3bf4ee05a3..9d1e6665b546 100644 --- a/sound/arm/devdma.c +++ b/sound/arm/devdma.c @@ -12,7 +12,6 @@ #include #include -#include #include #include diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c index d255503e7e07..5d86e6809752 100644 --- a/sound/arm/pxa2xx-ac97.c +++ b/sound/arm/pxa2xx-ac97.c @@ -18,7 +18,6 @@ #include #include -#include #include #include #include diff --git a/sound/arm/pxa2xx-pcm.c b/sound/arm/pxa2xx-pcm.c index e8cf904b8358..0ede9e4656a8 100644 --- a/sound/arm/pxa2xx-pcm.c +++ b/sound/arm/pxa2xx-pcm.c @@ -16,7 +16,6 @@ #include #include -#include #include #include #include diff --git a/sound/arm/sa11xx-uda1341.c b/sound/arm/sa11xx-uda1341.c index 81c64b09d359..0eff33ca0f79 100644 --- a/sound/arm/sa11xx-uda1341.c +++ b/sound/arm/sa11xx-uda1341.c @@ -59,7 +59,6 @@ * ***************************************************************************************************/ -#include #include #include #include diff --git a/sound/core/control.c b/sound/core/control.c index c89ca0d1f3ce..01a1a5af47bb 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/core/device.c b/sound/core/device.c index ea1a0621eefb..202dac0e4d89 100644 --- a/sound/core/device.c +++ b/sound/core/device.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c index bfd9d182b8a3..6d6589f93899 100644 --- a/sound/core/hwdep.c +++ b/sound/core/hwdep.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/core/info.c b/sound/core/info.c index 1ffd29bb4cd0..9977ec2eace3 100644 --- a/sound/core/info.c +++ b/sound/core/info.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/core/info_oss.c b/sound/core/info_oss.c index 9e8b8163bdd4..e35789a92752 100644 --- a/sound/core/info_oss.c +++ b/sound/core/info_oss.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/core/init.c b/sound/core/init.c index 48d38a79cbbb..dc06e79ca09f 100644 --- a/sound/core/init.c +++ b/sound/core/init.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/core/isadma.c b/sound/core/isadma.c index eb173cef4f05..79f0f16af339 100644 --- a/sound/core/isadma.c +++ b/sound/core/isadma.c @@ -26,7 +26,6 @@ #undef HAVE_REALLY_SLOW_DMA_CONTROLLER -#include #include #include diff --git a/sound/core/memory.c b/sound/core/memory.c index 25b0f056563e..1161158582a6 100644 --- a/sound/core/memory.c +++ b/sound/core/memory.c @@ -20,9 +20,9 @@ * */ -#include #include #include +#include /** * copy_to_user_fromio - copy data from mmio-space to user-space diff --git a/sound/core/misc.c b/sound/core/misc.c index 6cabab8cc537..102d1c36cf26 100644 --- a/sound/core/misc.c +++ b/sound/core/misc.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/core/oss/copy.c b/sound/core/oss/copy.c index d6a04c2d5a75..9ded30d0e97d 100644 --- a/sound/core/oss/copy.c +++ b/sound/core/oss/copy.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/core/oss/io.c b/sound/core/oss/io.c index 3ece39fc48db..f874f6ca3657 100644 --- a/sound/core/oss/io.c +++ b/sound/core/oss/io.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/core/oss/linear.c b/sound/core/oss/linear.c index 06f96a3e86f6..da3dbd41669e 100644 --- a/sound/core/oss/linear.c +++ b/sound/core/oss/linear.c @@ -20,7 +20,6 @@ * */ -#include #include #include #include diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c index c5a5ab9cae8c..75daed298a15 100644 --- a/sound/core/oss/mixer_oss.c +++ b/sound/core/oss/mixer_oss.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/core/oss/mulaw.c b/sound/core/oss/mulaw.c index 848db82529ed..77f96194a0ed 100644 --- a/sound/core/oss/mulaw.c +++ b/sound/core/oss/mulaw.c @@ -21,7 +21,6 @@ * */ -#include #include #include #include diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index f7f15e399842..092c2d84a9bc 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c @@ -26,7 +26,6 @@ #define OSS_DEBUG #endif -#include #include #include #include diff --git a/sound/core/oss/pcm_plugin.c b/sound/core/oss/pcm_plugin.c index 14095a927a1b..bec94138205e 100644 --- a/sound/core/oss/pcm_plugin.c +++ b/sound/core/oss/pcm_plugin.c @@ -24,7 +24,6 @@ #define PLUGIN_DEBUG #endif -#include #include #include #include diff --git a/sound/core/oss/rate.c b/sound/core/oss/rate.c index 9eb267913c38..14dfb3175d84 100644 --- a/sound/core/oss/rate.c +++ b/sound/core/oss/rate.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/core/oss/route.c b/sound/core/oss/route.c index de3ffdeaf7e3..da7ab7a3e82c 100644 --- a/sound/core/oss/route.c +++ b/sound/core/oss/route.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/core/pcm.c b/sound/core/pcm.c index cf3af39c3514..1502acd81a18 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index f00758c2bded..ed0223ca5c55 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -20,7 +20,6 @@ * */ -#include #include #include #include diff --git a/sound/core/pcm_memory.c b/sound/core/pcm_memory.c index a13e38cfd2c6..ff07b4a9992e 100644 --- a/sound/core/pcm_memory.c +++ b/sound/core/pcm_memory.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/core/pcm_misc.c b/sound/core/pcm_misc.c index b9ae6b37a61f..89b7f549bebd 100644 --- a/sound/core/pcm_misc.c +++ b/sound/core/pcm_misc.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index d6b4e6b6108f..e6e4aa87e57e 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/core/pcm_timer.c b/sound/core/pcm_timer.c index 23aa9a27e215..033a024d153a 100644 --- a/sound/core/pcm_timer.c +++ b/sound/core/pcm_timer.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index b8e700b94e59..f94694cb47f8 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/core/rtctimer.c b/sound/core/rtctimer.c index 7cd5e8f5d4ce..97b30fb4c361 100644 --- a/sound/core/rtctimer.c +++ b/sound/core/rtctimer.c @@ -20,7 +20,6 @@ * */ -#include #include #include #include diff --git a/sound/core/seq/oss/seq_oss.c b/sound/core/seq/oss/seq_oss.c index bc0992398461..777796e94490 100644 --- a/sound/core/seq/oss/seq_oss.c +++ b/sound/core/seq/oss/seq_oss.c @@ -20,7 +20,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/core/seq/oss/seq_oss_device.h b/sound/core/seq/oss/seq_oss_device.h index 9a8567c928ec..bf8d2b4cb15e 100644 --- a/sound/core/seq/oss/seq_oss_device.h +++ b/sound/core/seq/oss/seq_oss_device.h @@ -21,7 +21,6 @@ #ifndef __SEQ_OSS_DEVICE_H #define __SEQ_OSS_DEVICE_H -#include #include #include #include diff --git a/sound/core/seq/seq.c b/sound/core/seq/seq.c index 1878208a8026..ee0f8405ab35 100644 --- a/sound/core/seq/seq.c +++ b/sound/core/seq/seq.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c index 6444bd8c0fdf..f97c1ba43a28 100644 --- a/sound/core/seq/seq_clientmgr.c +++ b/sound/core/seq/seq_clientmgr.c @@ -21,7 +21,6 @@ * */ -#include #include #include #include diff --git a/sound/core/seq/seq_device.c b/sound/core/seq/seq_device.c index 37852cdace76..155dc7da4722 100644 --- a/sound/core/seq/seq_device.c +++ b/sound/core/seq/seq_device.c @@ -36,7 +36,6 @@ * */ -#include #include #include #include diff --git a/sound/core/seq/seq_dummy.c b/sound/core/seq/seq_dummy.c index e55488d1237c..f3bdc54b429a 100644 --- a/sound/core/seq/seq_dummy.c +++ b/sound/core/seq/seq_dummy.c @@ -18,7 +18,6 @@ * */ -#include #include #include #include diff --git a/sound/core/seq/seq_fifo.c b/sound/core/seq/seq_fifo.c index 6b055aed7a4b..3a94ed021bd9 100644 --- a/sound/core/seq/seq_fifo.c +++ b/sound/core/seq/seq_fifo.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include "seq_fifo.h" diff --git a/sound/core/seq/seq_info.c b/sound/core/seq/seq_info.c index 8a7fe5cca1c9..201f8106ffdd 100644 --- a/sound/core/seq/seq_info.c +++ b/sound/core/seq/seq_info.c @@ -19,7 +19,6 @@ * */ -#include #include #include diff --git a/sound/core/seq/seq_lock.c b/sound/core/seq/seq_lock.c index 1a34941d4217..54f921edda79 100644 --- a/sound/core/seq/seq_lock.c +++ b/sound/core/seq/seq_lock.c @@ -19,7 +19,6 @@ * */ -#include #include #include "seq_lock.h" diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c index a72a1945bf8a..0cf6ac477318 100644 --- a/sound/core/seq/seq_memory.c +++ b/sound/core/seq/seq_memory.c @@ -20,7 +20,6 @@ * */ -#include #include #include #include diff --git a/sound/core/seq/seq_midi.c b/sound/core/seq/seq_midi.c index 5929aaf1df9d..99b35360c506 100644 --- a/sound/core/seq/seq_midi.c +++ b/sound/core/seq/seq_midi.c @@ -26,7 +26,6 @@ Possible options for midisynth module: */ -#include #include #include #include diff --git a/sound/core/seq/seq_midi_emul.c b/sound/core/seq/seq_midi_emul.c index 6645fc544621..07c663135c62 100644 --- a/sound/core/seq/seq_midi_emul.c +++ b/sound/core/seq/seq_midi_emul.c @@ -29,7 +29,6 @@ * code in here. If there is it should be reported as a bug. */ -#include #include #include #include diff --git a/sound/core/seq/seq_midi_event.c b/sound/core/seq/seq_midi_event.c index b6820a5a73fc..8284f176a342 100644 --- a/sound/core/seq/seq_midi_event.c +++ b/sound/core/seq/seq_midi_event.c @@ -19,7 +19,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/core/seq/seq_ports.c b/sound/core/seq/seq_ports.c index b6e23ad12ab9..1c32a53d6bd8 100644 --- a/sound/core/seq/seq_ports.c +++ b/sound/core/seq/seq_ports.c @@ -20,7 +20,6 @@ * */ -#include #include #include #include "seq_system.h" diff --git a/sound/core/seq/seq_prioq.c b/sound/core/seq/seq_prioq.c index 074418617ee9..85969db576c9 100644 --- a/sound/core/seq/seq_prioq.c +++ b/sound/core/seq/seq_prioq.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c index 9b87bb0c7f33..4a48c6ee8ee8 100644 --- a/sound/core/seq/seq_queue.c +++ b/sound/core/seq/seq_queue.c @@ -35,7 +35,6 @@ * - Addition of experimental sync support. */ -#include #include #include #include diff --git a/sound/core/seq/seq_system.c b/sound/core/seq/seq_system.c index b201b76e9412..77884e62b648 100644 --- a/sound/core/seq/seq_system.c +++ b/sound/core/seq/seq_system.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include "seq_system.h" diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c index 82a5b333a963..d8fcd62e400f 100644 --- a/sound/core/seq/seq_timer.c +++ b/sound/core/seq/seq_timer.c @@ -20,7 +20,6 @@ * */ -#include #include #include #include "seq_timer.h" diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c index e11790f6debe..86e7739269ca 100644 --- a/sound/core/seq/seq_virmidi.c +++ b/sound/core/seq/seq_virmidi.c @@ -35,7 +35,6 @@ * */ -#include #include #include #include diff --git a/sound/core/sound.c b/sound/core/sound.c index 7b486c4d70db..00cca4d6e562 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c index dc73313b733a..7be51546eb9e 100644 --- a/sound/core/sound_oss.c +++ b/sound/core/sound_oss.c @@ -19,8 +19,6 @@ * */ -#include - #ifdef CONFIG_SND_OSSEMUL #if !defined(CONFIG_SOUND) && !(defined(MODULE) && defined(CONFIG_SOUND_MODULE)) diff --git a/sound/core/timer.c b/sound/core/timer.c index 7e5fe2d91662..aece465934b8 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c index e008f3c58eac..a240eaeb5c62 100644 --- a/sound/drivers/dummy.c +++ b/sound/drivers/dummy.c @@ -18,7 +18,6 @@ * */ -#include #include #include #include diff --git a/sound/drivers/ml403-ac97cr.c b/sound/drivers/ml403-ac97cr.c index 443104d23159..05a871aa7b81 100644 --- a/sound/drivers/ml403-ac97cr.c +++ b/sound/drivers/ml403-ac97cr.c @@ -33,7 +33,6 @@ * But there might still be some ... */ -#include #include #include diff --git a/sound/drivers/mpu401/mpu401.c b/sound/drivers/mpu401/mpu401.c index 1fc95dadde1d..5b996f3faba5 100644 --- a/sound/drivers/mpu401/mpu401.c +++ b/sound/drivers/mpu401/mpu401.c @@ -20,7 +20,6 @@ * */ -#include #include #include #include diff --git a/sound/drivers/mpu401/mpu401_uart.c b/sound/drivers/mpu401/mpu401_uart.c index b57f2d5a1c9d..5993864acbd3 100644 --- a/sound/drivers/mpu401/mpu401_uart.c +++ b/sound/drivers/mpu401/mpu401_uart.c @@ -28,7 +28,6 @@ * */ -#include #include #include #include diff --git a/sound/drivers/mtpav.c b/sound/drivers/mtpav.c index 40eb026c86ed..b5e1a71bb64b 100644 --- a/sound/drivers/mtpav.c +++ b/sound/drivers/mtpav.c @@ -50,7 +50,6 @@ * */ -#include #include #include #include diff --git a/sound/drivers/mts64.c b/sound/drivers/mts64.c index e12ba3d52731..f057d92fe86d 100644 --- a/sound/drivers/mts64.c +++ b/sound/drivers/mts64.c @@ -18,7 +18,6 @@ * */ -#include #include #include #include diff --git a/sound/drivers/pcm-indirect2.c b/sound/drivers/pcm-indirect2.c index 660157d49422..3c93c23e4883 100644 --- a/sound/drivers/pcm-indirect2.c +++ b/sound/drivers/pcm-indirect2.c @@ -25,8 +25,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* #dependency of sound/core.h# */ -#include /* snd_printk/d() */ #include /* struct snd_pcm_substream, struct snd_pcm_runtime, snd_pcm_uframes_t diff --git a/sound/drivers/portman2x4.c b/sound/drivers/portman2x4.c index 7e7c668eacdd..b1c047ec19af 100644 --- a/sound/drivers/portman2x4.c +++ b/sound/drivers/portman2x4.c @@ -37,7 +37,6 @@ * - ported from alsa 0.5 to 1.0 */ -#include #include #include #include diff --git a/sound/drivers/serial-u16550.c b/sound/drivers/serial-u16550.c index f4156011945f..d8aab9da97c2 100644 --- a/sound/drivers/serial-u16550.c +++ b/sound/drivers/serial-u16550.c @@ -30,7 +30,6 @@ * More documentation can be found in serial-u16550.txt. */ -#include #include #include #include diff --git a/sound/drivers/virmidi.c b/sound/drivers/virmidi.c index 915c86773c21..f79e3614079d 100644 --- a/sound/drivers/virmidi.c +++ b/sound/drivers/virmidi.c @@ -41,7 +41,6 @@ * - Run application using a midi device (eg. /dev/snd/midiC1D0) */ -#include #include #include #include diff --git a/sound/drivers/vx/vx_cmd.c b/sound/drivers/vx/vx_cmd.c index 7a221349f285..9529e3bf2866 100644 --- a/sound/drivers/vx/vx_cmd.c +++ b/sound/drivers/vx/vx_cmd.c @@ -20,7 +20,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/drivers/vx/vx_core.c b/sound/drivers/vx/vx_core.c index ed19bc17400b..99538862e342 100644 --- a/sound/drivers/vx/vx_core.c +++ b/sound/drivers/vx/vx_core.c @@ -20,7 +20,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/drivers/vx/vx_hwdep.c b/sound/drivers/vx/vx_hwdep.c index 9a8154c9416e..1dfe6948e6ff 100644 --- a/sound/drivers/vx/vx_hwdep.c +++ b/sound/drivers/vx/vx_hwdep.c @@ -20,7 +20,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/drivers/vx/vx_mixer.c b/sound/drivers/vx/vx_mixer.c index a37f0a8f17af..5a347321f8c0 100644 --- a/sound/drivers/vx/vx_mixer.c +++ b/sound/drivers/vx/vx_mixer.c @@ -20,7 +20,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/drivers/vx/vx_pcm.c b/sound/drivers/vx/vx_pcm.c index 7e65a103fbb2..fdbf86571b1f 100644 --- a/sound/drivers/vx/vx_pcm.c +++ b/sound/drivers/vx/vx_pcm.c @@ -45,7 +45,6 @@ * - scheduled action on the stream. */ -#include #include #include #include diff --git a/sound/drivers/vx/vx_uer.c b/sound/drivers/vx/vx_uer.c index 7400306b7f28..fb8932af888d 100644 --- a/sound/drivers/vx/vx_uer.c +++ b/sound/drivers/vx/vx_uer.c @@ -20,7 +20,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/i2c/cs8427.c b/sound/i2c/cs8427.c index 744366b72345..e57e9cbe6a0f 100644 --- a/sound/i2c/cs8427.c +++ b/sound/i2c/cs8427.c @@ -20,7 +20,6 @@ * */ -#include #include #include #include diff --git a/sound/i2c/i2c.c b/sound/i2c/i2c.c index 1e58a963b2a7..b1e74e40cba0 100644 --- a/sound/i2c/i2c.c +++ b/sound/i2c/i2c.c @@ -20,7 +20,6 @@ * */ -#include #include #include #include diff --git a/sound/i2c/l3/uda1341.c b/sound/i2c/l3/uda1341.c index b074fdddea55..bfa5d2c3608b 100644 --- a/sound/i2c/l3/uda1341.c +++ b/sound/i2c/l3/uda1341.c @@ -19,7 +19,6 @@ /* $Id: uda1341.c,v 1.18 2005/11/17 14:17:21 tiwai Exp $ */ -#include #include #include #include diff --git a/sound/i2c/other/ak4114.c b/sound/i2c/other/ak4114.c index facde46f957a..15061bd72776 100644 --- a/sound/i2c/other/ak4114.c +++ b/sound/i2c/other/ak4114.c @@ -20,7 +20,6 @@ * */ -#include #include #include #include diff --git a/sound/i2c/other/ak4117.c b/sound/i2c/other/ak4117.c index ee1585aec99b..f350835ade96 100644 --- a/sound/i2c/other/ak4117.c +++ b/sound/i2c/other/ak4117.c @@ -20,7 +20,6 @@ * */ -#include #include #include #include diff --git a/sound/i2c/other/ak4xxx-adda.c b/sound/i2c/other/ak4xxx-adda.c index fefa1ae57ad9..35fbbf2cb9fa 100644 --- a/sound/i2c/other/ak4xxx-adda.c +++ b/sound/i2c/other/ak4xxx-adda.c @@ -21,7 +21,6 @@ * */ -#include #include #include #include diff --git a/sound/i2c/other/pt2258.c b/sound/i2c/other/pt2258.c index 987d2c9a7a64..797d3a6687eb 100644 --- a/sound/i2c/other/pt2258.c +++ b/sound/i2c/other/pt2258.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c index 37c47fb95aca..28a4af782f5e 100644 --- a/sound/i2c/other/tea575x-tuner.c +++ b/sound/i2c/other/tea575x-tuner.c @@ -20,7 +20,6 @@ * */ -#include #include #include #include diff --git a/sound/i2c/tea6330t.c b/sound/i2c/tea6330t.c index 9bab744af0ef..0e3a9f2c5297 100644 --- a/sound/i2c/tea6330t.c +++ b/sound/i2c/tea6330t.c @@ -20,7 +20,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/ad1816a/ad1816a.c b/sound/isa/ad1816a/ad1816a.c index 994bc85376c1..68f1260b5602 100644 --- a/sound/isa/ad1816a/ad1816a.c +++ b/sound/isa/ad1816a/ad1816a.c @@ -18,7 +18,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/isa/ad1816a/ad1816a_lib.c b/sound/isa/ad1816a/ad1816a_lib.c index cf18fe4617a1..4b8dfe2e3dcb 100644 --- a/sound/isa/ad1816a/ad1816a_lib.c +++ b/sound/isa/ad1816a/ad1816a_lib.c @@ -17,7 +17,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/isa/ad1848/ad1848.c b/sound/isa/ad1848/ad1848.c index a4710b5e214c..5f5271efdc59 100644 --- a/sound/isa/ad1848/ad1848.c +++ b/sound/isa/ad1848/ad1848.c @@ -21,7 +21,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/ad1848/ad1848_lib.c b/sound/isa/ad1848/ad1848_lib.c index 9a640353350a..630c90f9ee50 100644 --- a/sound/isa/ad1848/ad1848_lib.c +++ b/sound/isa/ad1848/ad1848_lib.c @@ -20,7 +20,6 @@ */ #define SNDRV_MAIN_OBJECT_FILE -#include #include #include #include diff --git a/sound/isa/adlib.c b/sound/isa/adlib.c index d68720724c91..efa8c80d05b6 100644 --- a/sound/isa/adlib.c +++ b/sound/isa/adlib.c @@ -2,7 +2,6 @@ * AdLib FM card driver. */ -#include #include #include #include diff --git a/sound/isa/als100.c b/sound/isa/als100.c index 35e25e5878e0..f1ce30f379c9 100644 --- a/sound/isa/als100.c +++ b/sound/isa/als100.c @@ -20,7 +20,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/isa/azt2320.c b/sound/isa/azt2320.c index bfe3a255815c..154e728f592d 100644 --- a/sound/isa/azt2320.c +++ b/sound/isa/azt2320.c @@ -29,7 +29,6 @@ activation method (full-duplex audio!). */ -#include #include #include #include diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c index c166e13d17ec..4d198ec71e9b 100644 --- a/sound/isa/cmi8330.c +++ b/sound/isa/cmi8330.c @@ -43,7 +43,6 @@ * full control over both mixers. */ -#include #include #include #include diff --git a/sound/isa/cs423x/cs4231.c b/sound/isa/cs423x/cs4231.c index 13db6842eaaa..e9462b9944be 100644 --- a/sound/isa/cs423x/cs4231.c +++ b/sound/isa/cs423x/cs4231.c @@ -20,7 +20,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/cs423x/cs4231_lib.c b/sound/isa/cs423x/cs4231_lib.c index a5eb9659b519..1cd3fe33a47e 100644 --- a/sound/isa/cs423x/cs4231_lib.c +++ b/sound/isa/cs423x/cs4231_lib.c @@ -24,7 +24,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c index 0a3fece40f8b..dbe63db4bfd6 100644 --- a/sound/isa/cs423x/cs4236.c +++ b/sound/isa/cs423x/cs4236.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/cs423x/cs4236_lib.c b/sound/isa/cs423x/cs4236_lib.c index 6bd064470d4c..de71910401ea 100644 --- a/sound/isa/cs423x/cs4236_lib.c +++ b/sound/isa/cs423x/cs4236_lib.c @@ -79,7 +79,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/dt019x.c b/sound/isa/dt019x.c index ab689f948aea..a0242c3b613e 100644 --- a/sound/isa/dt019x.c +++ b/sound/isa/dt019x.c @@ -21,7 +21,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/isa/es1688/es1688.c b/sound/isa/es1688/es1688.c index 74bbc92f2e7c..f88639ea64b2 100644 --- a/sound/isa/es1688/es1688.c +++ b/sound/isa/es1688/es1688.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/es1688/es1688_lib.c b/sound/isa/es1688/es1688_lib.c index 5c26d495daa8..1e1e575b1db3 100644 --- a/sound/isa/es1688/es1688_lib.c +++ b/sound/isa/es1688/es1688_lib.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 91cb478103de..90498e4ca260 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c @@ -77,7 +77,6 @@ * needed for ZV, so maybe the datasheet is entirely wrong here. */ -#include #include #include #include diff --git a/sound/isa/gus/gus_dma.c b/sound/isa/gus/gus_dma.c index fc905141e8a5..f45f6116c77a 100644 --- a/sound/isa/gus/gus_dma.c +++ b/sound/isa/gus/gus_dma.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/gus/gus_dram.c b/sound/isa/gus/gus_dram.c index 9eaa932f6efe..fd2e2e2ed4e7 100644 --- a/sound/isa/gus/gus_dram.c +++ b/sound/isa/gus/gus_dram.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/gus/gus_instr.c b/sound/isa/gus/gus_instr.c index bf137ea72329..4dc9caf8ddcf 100644 --- a/sound/isa/gus/gus_instr.c +++ b/sound/isa/gus/gus_instr.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/gus/gus_io.c b/sound/isa/gus/gus_io.c index 3d4f899285ef..ca79878d8d8c 100644 --- a/sound/isa/gus/gus_io.c +++ b/sound/isa/gus/gus_io.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/gus/gus_irq.c b/sound/isa/gus/gus_irq.c index cd9a6f1c99e6..041894ddd014 100644 --- a/sound/isa/gus/gus_irq.c +++ b/sound/isa/gus/gus_irq.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/gus/gus_main.c b/sound/isa/gus/gus_main.c index e4453e5e5c23..cccc16c8113f 100644 --- a/sound/isa/gus/gus_main.c +++ b/sound/isa/gus/gus_main.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/gus/gus_mem.c b/sound/isa/gus/gus_mem.c index bcf4656853c4..661205c4dcea 100644 --- a/sound/isa/gus/gus_mem.c +++ b/sound/isa/gus/gus_mem.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/gus/gus_mem_proc.c b/sound/isa/gus/gus_mem_proc.c index f69a44728ebf..2803e227aec9 100644 --- a/sound/isa/gus/gus_mem_proc.c +++ b/sound/isa/gus/gus_mem_proc.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/gus/gus_mixer.c b/sound/isa/gus/gus_mixer.c index a96253e16654..ebdb33469306 100644 --- a/sound/isa/gus/gus_mixer.c +++ b/sound/isa/gus/gus_mixer.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/gus/gus_pcm.c b/sound/isa/gus/gus_pcm.c index a7971f5ffe63..99731dc97325 100644 --- a/sound/isa/gus/gus_pcm.c +++ b/sound/isa/gus/gus_pcm.c @@ -25,7 +25,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/gus/gus_reset.c b/sound/isa/gus/gus_reset.c index 20cfdb87f84a..3d1fed0c2620 100644 --- a/sound/isa/gus/gus_reset.c +++ b/sound/isa/gus/gus_reset.c @@ -18,7 +18,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/gus/gus_timer.c b/sound/isa/gus/gus_timer.c index 99eac573c414..c53727147a1a 100644 --- a/sound/isa/gus/gus_timer.c +++ b/sound/isa/gus/gus_timer.c @@ -21,7 +21,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/gus/gus_uart.c b/sound/isa/gus/gus_uart.c index e6fd9b01c492..f0af3f79b08b 100644 --- a/sound/isa/gus/gus_uart.c +++ b/sound/isa/gus/gus_uart.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/gus/gus_volume.c b/sound/isa/gus/gus_volume.c index 71a67744a14b..c3c028a4a46b 100644 --- a/sound/isa/gus/gus_volume.c +++ b/sound/isa/gus/gus_volume.c @@ -18,7 +18,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/gus/gusclassic.c b/sound/isa/gus/gusclassic.c index 29e422b00b58..8f914b37bf89 100644 --- a/sound/isa/gus/gusclassic.c +++ b/sound/isa/gus/gusclassic.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/gus/gusextreme.c b/sound/isa/gus/gusextreme.c index fc59536c918e..da13185eb0a0 100644 --- a/sound/isa/gus/gusextreme.c +++ b/sound/isa/gus/gusextreme.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c index 4922f5da08f9..f87c6236661c 100644 --- a/sound/isa/gus/gusmax.c +++ b/sound/isa/gus/gusmax.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c index 9381d1e8ad75..ca0d7ace0c75 100644 --- a/sound/isa/gus/interwave.c +++ b/sound/isa/gus/interwave.c @@ -22,7 +22,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index 125f6994bfb1..854a9f74b466 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c index c2baf4cfb958..b18d14f29db4 100644 --- a/sound/isa/opti9xx/miro.c +++ b/sound/isa/opti9xx/miro.c @@ -22,7 +22,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index 9300cf371ee8..1f9c55768439 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c @@ -23,7 +23,6 @@ */ -#include #include #include #include diff --git a/sound/isa/sb/emu8000.c b/sound/isa/sb/emu8000.c index 4eea84cfd4f4..b35be7d9a9fa 100644 --- a/sound/isa/sb/emu8000.c +++ b/sound/isa/sb/emu8000.c @@ -20,7 +20,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/isa/sb/emu8000_local.h b/sound/isa/sb/emu8000_local.h index 2ac77f10bb4e..7e87c349272f 100644 --- a/sound/isa/sb/emu8000_local.h +++ b/sound/isa/sb/emu8000_local.h @@ -21,7 +21,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/isa/sb/es968.c b/sound/isa/sb/es968.c index 3049692bcc57..c8c8e214c843 100644 --- a/sound/isa/sb/es968.c +++ b/sound/isa/sb/es968.c @@ -20,7 +20,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c index 8e1aff77b900..2c201f78ce50 100644 --- a/sound/isa/sb/sb16.c +++ b/sound/isa/sb/sb16.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/sb/sb16_csp.c b/sound/isa/sb/sb16_csp.c index 5f21aec585f6..bed29ca22239 100644 --- a/sound/isa/sb/sb16_csp.c +++ b/sound/isa/sb/sb16_csp.c @@ -23,7 +23,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/sb/sb16_main.c b/sound/isa/sb/sb16_main.c index c06754f7ee5d..f7e8192270ae 100644 --- a/sound/isa/sb/sb16_main.c +++ b/sound/isa/sb/sb16_main.c @@ -33,7 +33,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c index f933aef7d8a9..336a34277907 100644 --- a/sound/isa/sb/sb8.c +++ b/sound/isa/sb/sb8.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/sb/sb8_main.c b/sound/isa/sb/sb8_main.c index bee894b3f5c7..6304c3a89ba0 100644 --- a/sound/isa/sb/sb8_main.c +++ b/sound/isa/sb/sb8_main.c @@ -30,7 +30,6 @@ * Cleaned up and rewrote lowlevel routines. */ -#include #include #include #include diff --git a/sound/isa/sb/sb8_midi.c b/sound/isa/sb/sb8_midi.c index e56e5633411c..988a8b73475f 100644 --- a/sound/isa/sb/sb8_midi.c +++ b/sound/isa/sb/sb8_midi.c @@ -26,7 +26,6 @@ * Added full duplex UART mode for DSP version 2.0 and later. */ -#include #include #include #include diff --git a/sound/isa/sb/sb_common.c b/sound/isa/sb/sb_common.c index 176193c05101..d63c1af550de 100644 --- a/sound/isa/sb/sb_common.c +++ b/sound/isa/sb/sb_common.c @@ -20,7 +20,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/sb/sb_mixer.c b/sound/isa/sb/sb_mixer.c index 03241cd5aaef..91d14224f6b3 100644 --- a/sound/isa/sb/sb_mixer.c +++ b/sound/isa/sb/sb_mixer.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/sc6000.c b/sound/isa/sc6000.c index bc0c37956f2e..da3d152bcad4 100644 --- a/sound/isa/sc6000.c +++ b/sound/isa/sc6000.c @@ -23,7 +23,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/isa/sgalaxy.c b/sound/isa/sgalaxy.c index 922519def099..a07274ecb149 100644 --- a/sound/isa/sgalaxy.c +++ b/sound/isa/sgalaxy.c @@ -21,7 +21,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c index 1cb921d6137e..06ad7863dff5 100644 --- a/sound/isa/sscape.c +++ b/sound/isa/sscape.c @@ -21,7 +21,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c index 15c604653428..3a6c6fe1ec4d 100644 --- a/sound/isa/wavefront/wavefront.c +++ b/sound/isa/wavefront/wavefront.c @@ -19,7 +19,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/isa/wavefront/wavefront_fx.c b/sound/isa/wavefront/wavefront_fx.c index fc95a870f690..2efaa7f205aa 100644 --- a/sound/isa/wavefront/wavefront_fx.c +++ b/sound/isa/wavefront/wavefront_fx.c @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/isa/wavefront/wavefront_midi.c b/sound/isa/wavefront/wavefront_midi.c index cb3460094324..a33384a55b0f 100644 --- a/sound/isa/wavefront/wavefront_midi.c +++ b/sound/isa/wavefront/wavefront_midi.c @@ -47,7 +47,6 @@ * */ -#include #include #include #include diff --git a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c index a1ebb7c5c684..95eeca163354 100644 --- a/sound/isa/wavefront/wavefront_synth.c +++ b/sound/isa/wavefront/wavefront_synth.c @@ -20,7 +20,6 @@ * */ -#include #include #include #include diff --git a/sound/last.c b/sound/last.c index 282b0cdb0589..bdd0857b8871 100644 --- a/sound/last.c +++ b/sound/last.c @@ -20,7 +20,6 @@ */ #define SNDRV_MAIN_OBJECT_FILE -#include #include #include diff --git a/sound/mips/au1x00.c b/sound/mips/au1x00.c index 24460a558bf7..ee0741f9eb53 100644 --- a/sound/mips/au1x00.c +++ b/sound/mips/au1x00.c @@ -36,7 +36,6 @@ #include #include -#include #include #include #include diff --git a/sound/parisc/harmony.c b/sound/parisc/harmony.c index ff705c63a03a..99f5483abf2e 100644 --- a/sound/parisc/harmony.c +++ b/sound/parisc/harmony.c @@ -45,7 +45,6 @@ #include #include -#include #include #include #include diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index 6a9966df0cc9..45fd29017ddd 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c @@ -22,7 +22,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/ac97/ac97_pcm.c b/sound/pci/ac97/ac97_pcm.c index 8cbc03332b01..3674f35c4a79 100644 --- a/sound/pci/ac97/ac97_pcm.c +++ b/sound/pci/ac97/ac97_pcm.c @@ -23,7 +23,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/ac97/ac97_proc.c b/sound/pci/ac97/ac97_proc.c index fed4a2c3d8a1..060ea59d5f02 100644 --- a/sound/pci/ac97/ac97_proc.c +++ b/sound/pci/ac97/ac97_proc.c @@ -22,7 +22,6 @@ * */ -#include #include #include diff --git a/sound/pci/ac97/ak4531_codec.c b/sound/pci/ac97/ak4531_codec.c index 722de451d15f..c0c1633999ea 100644 --- a/sound/pci/ac97/ak4531_codec.c +++ b/sound/pci/ac97/ak4531_codec.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c index 98970d401be9..be9f1a276be8 100644 --- a/sound/pci/ad1889.c +++ b/sound/pci/ad1889.c @@ -40,7 +40,6 @@ #include #include -#include #include #include #include diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index 4c2bd7adf674..6a905ed9cbd6 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c @@ -25,7 +25,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/als300.c b/sound/pci/als300.c index 48cc39b771d9..0e990a735821 100644 --- a/sound/pci/als300.c +++ b/sound/pci/als300.c @@ -30,7 +30,6 @@ * to keep track of what period we are in. */ -#include #include #include #include diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c index 1190ef366a41..27ce6136ab00 100644 --- a/sound/pci/als4000.c +++ b/sound/pci/als4000.c @@ -63,7 +63,6 @@ * - power management? (card can do voice wakeup according to datasheet!!) */ -#include #include #include #include diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c index 89184a424140..e9c87f5966b3 100644 --- a/sound/pci/atiixp.c +++ b/sound/pci/atiixp.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c index ce752f84457a..a67a869180d4 100644 --- a/sound/pci/atiixp_modem.c +++ b/sound/pci/atiixp_modem.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/au88x0/au88x0.h b/sound/pci/au88x0/au88x0.h index 5ccf0b1ec670..4aad35bba11a 100644 --- a/sound/pci/au88x0/au88x0.h +++ b/sound/pci/au88x0/au88x0.h @@ -18,7 +18,6 @@ #define __SOUND_AU88X0_H #ifdef __KERNEL__ -#include #include #include #include diff --git a/sound/pci/au88x0/au88x0_game.c b/sound/pci/au88x0/au88x0_game.c index a07d1deba322..bc212f41a38a 100644 --- a/sound/pci/au88x0/au88x0_game.c +++ b/sound/pci/au88x0/au88x0_game.c @@ -30,7 +30,6 @@ * driver. (email: mjander@embedded.cl). */ -#include #include #include #include diff --git a/sound/pci/au88x0/au88x0_mixer.c b/sound/pci/au88x0/au88x0_mixer.c index c96da1dab863..c92f493d341e 100644 --- a/sound/pci/au88x0/au88x0_mixer.c +++ b/sound/pci/au88x0/au88x0_mixer.c @@ -5,7 +5,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/au88x0/au88x0_mpu401.c b/sound/pci/au88x0/au88x0_mpu401.c index 8db3d3e6f7bb..0dc8d259d1ed 100644 --- a/sound/pci/au88x0/au88x0_mpu401.c +++ b/sound/pci/au88x0/au88x0_mpu401.c @@ -21,7 +21,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/au88x0/au88x0_pcm.c b/sound/pci/au88x0/au88x0_pcm.c index 7b5baa173859..526c6c5ecf7b 100644 --- a/sound/pci/au88x0/au88x0_pcm.c +++ b/sound/pci/au88x0/au88x0_pcm.c @@ -21,7 +21,6 @@ * It remains stuck,and DMA transfers do not happen. */ #include -#include #include #include #include diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c index 36d3666a5b77..4e71a55120a0 100644 --- a/sound/pci/azt3328.c +++ b/sound/pci/azt3328.c @@ -115,7 +115,6 @@ * code (but I'm not too optimistic that doing this is possible at all) */ -#include #include #include #include diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c index 2dba752faf4e..c9a2421cf6f0 100644 --- a/sound/pci/bt87x.c +++ b/sound/pci/bt87x.c @@ -21,7 +21,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c index 31d8db9f7a4c..176e0f0e8058 100644 --- a/sound/pci/ca0106/ca0106_main.c +++ b/sound/pci/ca0106/ca0106_main.c @@ -135,7 +135,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ -#include #include #include #include diff --git a/sound/pci/ca0106/ca0106_mixer.c b/sound/pci/ca0106/ca0106_mixer.c index 3f9b5c560036..af736869d9b1 100644 --- a/sound/pci/ca0106/ca0106_mixer.c +++ b/sound/pci/ca0106/ca0106_mixer.c @@ -60,7 +60,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ -#include #include #include #include diff --git a/sound/pci/ca0106/ca0106_proc.c b/sound/pci/ca0106/ca0106_proc.c index 61f2718ae359..c62b7d10ec61 100644 --- a/sound/pci/ca0106/ca0106_proc.c +++ b/sound/pci/ca0106/ca0106_proc.c @@ -60,7 +60,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ -#include #include #include #include diff --git a/sound/pci/ca0106/ca_midi.c b/sound/pci/ca0106/ca_midi.c index ad32eff2713f..893ee4f1ea77 100644 --- a/sound/pci/ca0106/ca_midi.c +++ b/sound/pci/ca0106/ca_midi.c @@ -27,7 +27,6 @@ */ #include -#include #include #include diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index bc0a1959f920..135f30860753 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c @@ -20,7 +20,6 @@ /* Does not work. Warning may block system in capture mode */ /* #define USE_VAR48KRATE */ -#include #include #include #include diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c index 9a55f4a9739b..7556fd90d0eb 100644 --- a/sound/pci/cs4281.c +++ b/sound/pci/cs4281.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/cs46xx/cs46xx.c b/sound/pci/cs46xx/cs46xx.c index 2699cb6c2cd6..e876b3263e46 100644 --- a/sound/pci/cs46xx/cs46xx.c +++ b/sound/pci/cs46xx/cs46xx.c @@ -25,7 +25,6 @@ reloading the module may solve this. */ -#include #include #include #include diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c index 28f98bd9f743..87ddffcd9d89 100644 --- a/sound/pci/cs46xx/cs46xx_lib.c +++ b/sound/pci/cs46xx/cs46xx_lib.c @@ -45,7 +45,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/cs46xx/dsp_spos.c b/sound/pci/cs46xx/dsp_spos.c index 590b35d91df2..ccc8bedb5b1a 100644 --- a/sound/pci/cs46xx/dsp_spos.c +++ b/sound/pci/cs46xx/dsp_spos.c @@ -20,7 +20,6 @@ */ -#include #include #include #include diff --git a/sound/pci/cs46xx/dsp_spos_scb_lib.c b/sound/pci/cs46xx/dsp_spos_scb_lib.c index eded4dfeba12..2873cfe48c33 100644 --- a/sound/pci/cs46xx/dsp_spos_scb_lib.c +++ b/sound/pci/cs46xx/dsp_spos_scb_lib.c @@ -21,7 +21,6 @@ */ -#include #include #include #include diff --git a/sound/pci/cs5530.c b/sound/pci/cs5530.c index 240a0a462209..7ff8b68e997e 100644 --- a/sound/pci/cs5530.c +++ b/sound/pci/cs5530.c @@ -36,7 +36,6 @@ * same manner. */ -#include #include #include #include diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c index 2b35889787be..a0c54f0a265f 100644 --- a/sound/pci/cs5535audio/cs5535audio.c +++ b/sound/pci/cs5535audio/cs5535audio.c @@ -21,7 +21,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/cs5535audio/cs5535audio_pcm.c b/sound/pci/cs5535audio/cs5535audio_pcm.c index 21df0634af32..499e27961a30 100644 --- a/sound/pci/cs5535audio/cs5535audio_pcm.c +++ b/sound/pci/cs5535audio/cs5535audio_pcm.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/pci/cs5535audio/cs5535audio_pm.c b/sound/pci/cs5535audio/cs5535audio_pm.c index 838708f6d45e..564c33b60953 100644 --- a/sound/pci/cs5535audio/cs5535audio_pm.c +++ b/sound/pci/cs5535audio/cs5535audio_pm.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/pci/echoaudio/darla20.c b/sound/pci/echoaudio/darla20.c index 87078d3a6854..8c6db3aa3c1a 100644 --- a/sound/pci/echoaudio/darla20.c +++ b/sound/pci/echoaudio/darla20.c @@ -36,7 +36,6 @@ #define BX_NUM 10 -#include #include #include #include diff --git a/sound/pci/echoaudio/darla24.c b/sound/pci/echoaudio/darla24.c index 42b48f9d2128..04cbf3eaf05a 100644 --- a/sound/pci/echoaudio/darla24.c +++ b/sound/pci/echoaudio/darla24.c @@ -40,7 +40,6 @@ #define BX_NUM 10 -#include #include #include #include diff --git a/sound/pci/echoaudio/echo3g.c b/sound/pci/echoaudio/echo3g.c index 8dbb7ac865c1..4022e43a0053 100644 --- a/sound/pci/echoaudio/echo3g.c +++ b/sound/pci/echoaudio/echo3g.c @@ -47,7 +47,6 @@ #define BX_NUM chip->bx_num -#include #include #include #include diff --git a/sound/pci/echoaudio/gina20.c b/sound/pci/echoaudio/gina20.c index fee2d4831732..c0e64b8f52a4 100644 --- a/sound/pci/echoaudio/gina20.c +++ b/sound/pci/echoaudio/gina20.c @@ -40,7 +40,6 @@ #define BX_NUM 14 -#include #include #include #include diff --git a/sound/pci/echoaudio/gina24.c b/sound/pci/echoaudio/gina24.c index d5eae470fe9a..c36a78dd0b5e 100644 --- a/sound/pci/echoaudio/gina24.c +++ b/sound/pci/echoaudio/gina24.c @@ -46,7 +46,6 @@ #define BX_NUM 26 -#include #include #include #include diff --git a/sound/pci/echoaudio/indigo.c b/sound/pci/echoaudio/indigo.c index 40f601cd016f..0a58a7c1fd7c 100644 --- a/sound/pci/echoaudio/indigo.c +++ b/sound/pci/echoaudio/indigo.c @@ -38,7 +38,6 @@ #define BX_NUM 2 -#include #include #include #include diff --git a/sound/pci/echoaudio/indigodj.c b/sound/pci/echoaudio/indigodj.c index 771c5383210d..2db24d29332b 100644 --- a/sound/pci/echoaudio/indigodj.c +++ b/sound/pci/echoaudio/indigodj.c @@ -38,7 +38,6 @@ #define BX_NUM 4 -#include #include #include #include diff --git a/sound/pci/echoaudio/indigoio.c b/sound/pci/echoaudio/indigoio.c index 49c550defcf9..a60c0a0a89b7 100644 --- a/sound/pci/echoaudio/indigoio.c +++ b/sound/pci/echoaudio/indigoio.c @@ -39,7 +39,6 @@ #define BX_NUM 4 -#include #include #include #include diff --git a/sound/pci/echoaudio/layla20.c b/sound/pci/echoaudio/layla20.c index 8f5483a405ae..506194688995 100644 --- a/sound/pci/echoaudio/layla20.c +++ b/sound/pci/echoaudio/layla20.c @@ -45,7 +45,6 @@ #define BX_NUM 22 -#include #include #include #include diff --git a/sound/pci/echoaudio/layla24.c b/sound/pci/echoaudio/layla24.c index 0524667c02f7..e09e3ea7781e 100644 --- a/sound/pci/echoaudio/layla24.c +++ b/sound/pci/echoaudio/layla24.c @@ -47,7 +47,6 @@ #define BX_NUM 32 -#include #include #include #include diff --git a/sound/pci/echoaudio/mia.c b/sound/pci/echoaudio/mia.c index 893c7c20dd70..f3b9b45c9c1b 100644 --- a/sound/pci/echoaudio/mia.c +++ b/sound/pci/echoaudio/mia.c @@ -45,7 +45,6 @@ #define BX_NUM 8 -#include #include #include #include diff --git a/sound/pci/echoaudio/mona.c b/sound/pci/echoaudio/mona.c index 3a5d5b0020df..b05bad944901 100644 --- a/sound/pci/echoaudio/mona.c +++ b/sound/pci/echoaudio/mona.c @@ -44,7 +44,6 @@ #define BX_NUM 26 -#include #include #include #include diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c index 9680caff90c8..8354c1a83312 100644 --- a/sound/pci/emu10k1/emu10k1.c +++ b/sound/pci/emu10k1/emu10k1.c @@ -23,7 +23,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index 97c41d72a255..69f342ce9b2a 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c @@ -33,7 +33,6 @@ #include #include -#include #include #include #include diff --git a/sound/pci/emu10k1/emu10k1_synth_local.h b/sound/pci/emu10k1/emu10k1_synth_local.h index 308ddc84bb4d..25f328ff639f 100644 --- a/sound/pci/emu10k1/emu10k1_synth_local.h +++ b/sound/pci/emu10k1/emu10k1_synth_local.h @@ -20,7 +20,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c index 0030d8b84669..5512abd98bd9 100644 --- a/sound/pci/emu10k1/emu10k1x.c +++ b/sound/pci/emu10k1/emu10k1x.c @@ -29,7 +29,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ -#include #include #include #include diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c index 9bf1cd592199..c35d9e1cb6dd 100644 --- a/sound/pci/emu10k1/emufx.c +++ b/sound/pci/emu10k1/emufx.c @@ -28,7 +28,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/emu10k1/emumixer.c b/sound/pci/emu10k1/emumixer.c index ccacd7b890e8..5a38fe71e52f 100644 --- a/sound/pci/emu10k1/emumixer.c +++ b/sound/pci/emu10k1/emumixer.c @@ -30,7 +30,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/emu10k1/emumpu401.c b/sound/pci/emu10k1/emumpu401.c index 04c7cf703531..c4d76d16661e 100644 --- a/sound/pci/emu10k1/emumpu401.c +++ b/sound/pci/emu10k1/emumpu401.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c index 5ce5befc701b..cf4e3ec6530e 100644 --- a/sound/pci/emu10k1/emupcm.c +++ b/sound/pci/emu10k1/emupcm.c @@ -26,7 +26,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c index c3fb10e81c9e..bd8a47116528 100644 --- a/sound/pci/emu10k1/emuproc.c +++ b/sound/pci/emu10k1/emuproc.c @@ -28,7 +28,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/emu10k1/io.c b/sound/pci/emu10k1/io.c index 6702c15fefa3..2862e17446fe 100644 --- a/sound/pci/emu10k1/io.c +++ b/sound/pci/emu10k1/io.c @@ -25,7 +25,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/emu10k1/irq.c b/sound/pci/emu10k1/irq.c index 3c114b45e0b2..276d08c88f91 100644 --- a/sound/pci/emu10k1/irq.c +++ b/sound/pci/emu10k1/irq.c @@ -25,7 +25,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/emu10k1/memory.c b/sound/pci/emu10k1/memory.c index 48097c6bb15c..916c1dbcd53c 100644 --- a/sound/pci/emu10k1/memory.c +++ b/sound/pci/emu10k1/memory.c @@ -21,7 +21,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c index 9fd3135f3118..749a21b6bd06 100644 --- a/sound/pci/emu10k1/p16v.c +++ b/sound/pci/emu10k1/p16v.c @@ -87,7 +87,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ -#include #include #include #include diff --git a/sound/pci/emu10k1/timer.c b/sound/pci/emu10k1/timer.c index 6295b2dca785..72321e946ccc 100644 --- a/sound/pci/emu10k1/timer.c +++ b/sound/pci/emu10k1/timer.c @@ -25,7 +25,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/emu10k1/voice.c b/sound/pci/emu10k1/voice.c index 04fa8492abb0..958cb2a65a4e 100644 --- a/sound/pci/emu10k1/voice.c +++ b/sound/pci/emu10k1/voice.c @@ -28,7 +28,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c index b958f869cb13..72d85a5ae6a0 100644 --- a/sound/pci/ens1370.c +++ b/sound/pci/ens1370.c @@ -26,7 +26,6 @@ * by Kurt J. Bosch */ -#include #include #include #include diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c index fb25abe68a02..fbe3da73eaff 100644 --- a/sound/pci/es1938.c +++ b/sound/pci/es1938.c @@ -47,7 +47,6 @@ */ -#include #include #include #include diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index d69b11d1f993..25ccfce45759 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c @@ -94,7 +94,6 @@ * places. */ -#include #include #include #include diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c index 9939109f05a2..25c1087d2c00 100644 --- a/sound/pci/fm801.c +++ b/sound/pci/fm801.c @@ -20,7 +20,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index cd807194e5f1..a2b40dc372c9 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -19,7 +19,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index c957eb58de5c..f9de7c467c25 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c @@ -20,7 +20,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c index bafb7b01f5a1..2177d9af5334 100644 --- a/sound/pci/hda/hda_hwdep.c +++ b/sound/pci/hda/hda_hwdep.c @@ -18,7 +18,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index a37e8946c7b0..3ae4b4c0ba23 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -34,7 +34,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index 7df1d16d1469..4b8d64498fb1 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c @@ -21,7 +21,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include "hda_codec.h" diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 67144dce90d7..6664a0688ef5 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -19,7 +19,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/pci/hda/patch_atihdmi.c b/sound/pci/hda/patch_atihdmi.c index 78441e3592b0..9a8bb4ce3f8d 100644 --- a/sound/pci/hda/patch_atihdmi.c +++ b/sound/pci/hda/patch_atihdmi.c @@ -21,7 +21,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c index 6c54793bf424..02e31e4d95c4 100644 --- a/sound/pci/hda/patch_cmedia.c +++ b/sound/pci/hda/patch_cmedia.c @@ -21,7 +21,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index e960189a3d1b..8b8de96df138 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -20,7 +20,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 1b2ad52bc908..5e36462ac0f9 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -23,7 +23,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/pci/hda/patch_si3054.c b/sound/pci/hda/patch_si3054.c index 2a4b9609aa5c..f5e43e867edb 100644 --- a/sound/pci/hda/patch_si3054.c +++ b/sound/pci/hda/patch_si3054.c @@ -22,7 +22,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 299e02a26e58..61114cd958a4 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -24,7 +24,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index d42d8f753f11..423b4999ee4a 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c @@ -33,7 +33,6 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include #include #include #include diff --git a/sound/pci/ice1712/ak4xxx.c b/sound/pci/ice1712/ak4xxx.c index a1aba0d7d0e4..dab31b2756a6 100644 --- a/sound/pci/ice1712/ak4xxx.c +++ b/sound/pci/ice1712/ak4xxx.c @@ -21,7 +21,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/ice1712/amp.c b/sound/pci/ice1712/amp.c index 6e13d758bb5d..37564300b50d 100644 --- a/sound/pci/ice1712/amp.c +++ b/sound/pci/ice1712/amp.c @@ -21,7 +21,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/ice1712/aureon.c b/sound/pci/ice1712/aureon.c index f83ec2f565cf..337489187614 100644 --- a/sound/pci/ice1712/aureon.c +++ b/sound/pci/ice1712/aureon.c @@ -47,7 +47,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/ice1712/delta.c b/sound/pci/ice1712/delta.c index 519b5d4bbf7b..efd180b40e56 100644 --- a/sound/pci/ice1712/delta.c +++ b/sound/pci/ice1712/delta.c @@ -22,7 +22,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/ice1712/ews.c b/sound/pci/ice1712/ews.c index 75e4e5e0f1e4..6f65da48e00d 100644 --- a/sound/pci/ice1712/ews.c +++ b/sound/pci/ice1712/ews.c @@ -22,7 +22,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/ice1712/hoontech.c b/sound/pci/ice1712/hoontech.c index abcfd1da6587..b2cfba16ebdf 100644 --- a/sound/pci/ice1712/hoontech.c +++ b/sound/pci/ice1712/hoontech.c @@ -21,7 +21,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index 052fc3cb3272..47d77376bcd5 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c @@ -47,7 +47,6 @@ */ -#include #include #include #include diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index b7a1d93cf002..3147cbc9edb3 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -22,7 +22,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/ice1712/juli.c b/sound/pci/ice1712/juli.c index 1fbe3ef8e60a..1a435df423c6 100644 --- a/sound/pci/ice1712/juli.c +++ b/sound/pci/ice1712/juli.c @@ -21,7 +21,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/ice1712/phase.c b/sound/pci/ice1712/phase.c index c81efc2f8c95..718e9359e1f2 100644 --- a/sound/pci/ice1712/phase.c +++ b/sound/pci/ice1712/phase.c @@ -33,7 +33,6 @@ * CDTI may be completely blocked by 74HCT125's gate #1 controlled by GPIO 3 */ -#include #include #include #include diff --git a/sound/pci/ice1712/pontis.c b/sound/pci/ice1712/pontis.c index faefd52c1b80..4945c81e8a96 100644 --- a/sound/pci/ice1712/pontis.c +++ b/sound/pci/ice1712/pontis.c @@ -21,7 +21,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/ice1712/prodigy192.c b/sound/pci/ice1712/prodigy192.c index 6d81a1c61d41..733937807da3 100644 --- a/sound/pci/ice1712/prodigy192.c +++ b/sound/pci/ice1712/prodigy192.c @@ -54,7 +54,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/ice1712/revo.c b/sound/pci/ice1712/revo.c index d18a31e188a9..05a751c59893 100644 --- a/sound/pci/ice1712/revo.c +++ b/sound/pci/ice1712/revo.c @@ -21,7 +21,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/ice1712/se.c b/sound/pci/ice1712/se.c index 3c8b518118e9..6661f65a6f2e 100644 --- a/sound/pci/ice1712/se.c +++ b/sound/pci/ice1712/se.c @@ -22,7 +22,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/ice1712/vt1720_mobo.c b/sound/pci/ice1712/vt1720_mobo.c index 239524158fe7..7f9674b641c0 100644 --- a/sound/pci/ice1712/vt1720_mobo.c +++ b/sound/pci/ice1712/vt1720_mobo.c @@ -21,7 +21,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/ice1712/wtm.c b/sound/pci/ice1712/wtm.c index 41a153d30c51..a08d17c7e651 100644 --- a/sound/pci/ice1712/wtm.c +++ b/sound/pci/ice1712/wtm.c @@ -25,7 +25,6 @@ -#include #include #include #include diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 312373c81e7d..061072c7db03 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -26,7 +26,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c index fad806e60f36..cadda8d6b70f 100644 --- a/sound/pci/intel8x0m.c +++ b/sound/pci/intel8x0m.c @@ -23,7 +23,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c index 6586abfaa148..10c713d9ac49 100644 --- a/sound/pci/korg1212/korg1212.c +++ b/sound/pci/korg1212/korg1212.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c index 93dfedcaed86..04fa0a68416c 100644 --- a/sound/pci/maestro3.c +++ b/sound/pci/maestro3.c @@ -31,7 +31,6 @@ #define CARD_NAME "ESS Maestro3/Allegro/Canyon3D-2" #define DRIVER_NAME "Maestro3" -#include #include #include #include diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c index 880b824e24cd..3dd0c7963273 100644 --- a/sound/pci/mixart/mixart.c +++ b/sound/pci/mixart/mixart.c @@ -21,7 +21,6 @@ */ -#include #include #include #include diff --git a/sound/pci/mixart/mixart_core.c b/sound/pci/mixart/mixart_core.c index d54457317b14..785085e48353 100644 --- a/sound/pci/mixart/mixart_core.c +++ b/sound/pci/mixart/mixart_core.c @@ -20,7 +20,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include diff --git a/sound/pci/mixart/mixart_hwdep.c b/sound/pci/mixart/mixart_hwdep.c index 170781a72292..122c28efc483 100644 --- a/sound/pci/mixart/mixart_hwdep.c +++ b/sound/pci/mixart/mixart_hwdep.c @@ -20,7 +20,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/pci/mixart/mixart_mixer.c b/sound/pci/mixart/mixart_mixer.c index 5b3c224732af..6fdda1f70b25 100644 --- a/sound/pci/mixart/mixart_mixer.c +++ b/sound/pci/mixart/mixart_mixer.c @@ -20,7 +20,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c index 276c5763f0e5..7ac654e381da 100644 --- a/sound/pci/nm256/nm256.c +++ b/sound/pci/nm256/nm256.c @@ -24,7 +24,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c index bfef5aba0b9d..ba7a2a83f339 100644 --- a/sound/pci/oxygen/oxygen.c +++ b/sound/pci/oxygen/oxygen.c @@ -28,7 +28,6 @@ * GPIO 1 -> DFS1 of AK5385 */ -#include #include #include #include diff --git a/sound/pci/oxygen/oxygen_io.c b/sound/pci/oxygen/oxygen_io.c index 5f4feeaf8b3a..616087c552e2 100644 --- a/sound/pci/oxygen/oxygen_io.c +++ b/sound/pci/oxygen/oxygen_io.c @@ -17,7 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c index 6180cc858e60..2418ceb44858 100644 --- a/sound/pci/oxygen/oxygen_lib.c +++ b/sound/pci/oxygen/oxygen_lib.c @@ -17,7 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/pci/oxygen/oxygen_mixer.c b/sound/pci/oxygen/oxygen_mixer.c index e252abac004e..7208b0fb3ee5 100644 --- a/sound/pci/oxygen/oxygen_mixer.c +++ b/sound/pci/oxygen/oxygen_mixer.c @@ -17,7 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/pci/oxygen/oxygen_pcm.c b/sound/pci/oxygen/oxygen_pcm.c index ff46ba5f2774..d4a1d73718e3 100644 --- a/sound/pci/oxygen/oxygen_pcm.c +++ b/sound/pci/oxygen/oxygen_pcm.c @@ -17,7 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c index 5678dc36f9e5..6603a685ccca 100644 --- a/sound/pci/oxygen/virtuoso.c +++ b/sound/pci/oxygen/virtuoso.c @@ -30,7 +30,6 @@ * GPIO 8 -> ? (amps enable?) */ -#include #include #include #include diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c index 2d618bd7e62b..9d5bb76229a8 100644 --- a/sound/pci/pcxhr/pcxhr.c +++ b/sound/pci/pcxhr/pcxhr.c @@ -21,7 +21,6 @@ */ -#include #include #include #include diff --git a/sound/pci/pcxhr/pcxhr_core.c b/sound/pci/pcxhr/pcxhr_core.c index 0ff8dc36fde3..c4e415d07380 100644 --- a/sound/pci/pcxhr/pcxhr_core.c +++ b/sound/pci/pcxhr/pcxhr_core.c @@ -20,7 +20,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/pci/pcxhr/pcxhr_hwdep.c b/sound/pci/pcxhr/pcxhr_hwdep.c index d55d8bc90eee..e6a4bfbb91bb 100644 --- a/sound/pci/pcxhr/pcxhr_hwdep.c +++ b/sound/pci/pcxhr/pcxhr_hwdep.c @@ -20,7 +20,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/pci/pcxhr/pcxhr_mixer.c b/sound/pci/pcxhr/pcxhr_mixer.c index 4d8654575e18..aabc7bc5321e 100644 --- a/sound/pci/pcxhr/pcxhr_mixer.c +++ b/sound/pci/pcxhr/pcxhr_mixer.c @@ -21,7 +21,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c index 8e5410483e67..9408b1eeec40 100644 --- a/sound/pci/riptide/riptide.c +++ b/sound/pci/riptide/riptide.c @@ -88,7 +88,6 @@ Adopted for Windows NT driver 01/20/98 CNL */ -#include #include #include #include diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c index 1475912588e9..df184aabce84 100644 --- a/sound/pci/rme32.c +++ b/sound/pci/rme32.c @@ -69,7 +69,6 @@ */ -#include #include #include #include diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c index aff05bd15b77..fb0a4ee8bc02 100644 --- a/sound/pci/rme96.c +++ b/sound/pci/rme96.c @@ -23,7 +23,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index 67ec08cd9901..4ba9e019ad04 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c @@ -21,7 +21,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 6b1d5292fc20..9a19ae6a64d9 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -23,7 +23,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ -#include #include #include #include diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c index 1d73be692b08..a123f0e6ba23 100644 --- a/sound/pci/rme9652/rme9652.c +++ b/sound/pci/rme9652/rme9652.c @@ -20,7 +20,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c index 2f178598186d..dcd7cd010461 100644 --- a/sound/pci/sis7019.c +++ b/sound/pci/sis7019.c @@ -21,7 +21,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c index 44a7f5fad573..0d3d305b0a0b 100644 --- a/sound/pci/sonicvibes.c +++ b/sound/pci/sonicvibes.c @@ -22,7 +22,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/trident/trident.c b/sound/pci/trident/trident.c index 6193c7e4d798..d94b16ffb385 100644 --- a/sound/pci/trident/trident.c +++ b/sound/pci/trident/trident.c @@ -21,7 +21,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c index c8d5665b5782..71138ff9b310 100644 --- a/sound/pci/trident/trident_main.c +++ b/sound/pci/trident/trident_main.c @@ -27,7 +27,6 @@ * SiS7018 S/PDIF support by Thomas Winischhofer */ -#include #include #include #include diff --git a/sound/pci/trident/trident_memory.c b/sound/pci/trident/trident_memory.c index 847b8c6d5c0a..df9b487fa17e 100644 --- a/sound/pci/trident/trident_memory.c +++ b/sound/pci/trident/trident_memory.c @@ -23,7 +23,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index 18a58e43e78b..a756be661f9a 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c @@ -46,7 +46,6 @@ * - Optimize position calculation for the 823x chips. */ -#include #include #include #include diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c index 57fb9ae22f93..f5df1c79bee1 100644 --- a/sound/pci/via82xx_modem.c +++ b/sound/pci/via82xx_modem.c @@ -31,7 +31,6 @@ * modems. */ -#include #include #include #include diff --git a/sound/pci/vx222/vx222.c b/sound/pci/vx222/vx222.c index 474eac9490ae..acc352f4a441 100644 --- a/sound/pci/vx222/vx222.c +++ b/sound/pci/vx222/vx222.c @@ -18,7 +18,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/pci/vx222/vx222_ops.c b/sound/pci/vx222/vx222_ops.c index f4f0427a7420..b4bfc1acde88 100644 --- a/sound/pci/vx222/vx222_ops.c +++ b/sound/pci/vx222/vx222_ops.c @@ -20,7 +20,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c index 5c4256a4d4b9..2631a554845e 100644 --- a/sound/pci/ymfpci/ymfpci.c +++ b/sound/pci/ymfpci/ymfpci.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index c0789a50ad20..42c1eb7d35f5 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c @@ -18,7 +18,6 @@ * */ -#include #include #include #include diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c index 5f5bbea8c39a..819aaaac432f 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c @@ -18,7 +18,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_core.c b/sound/pcmcia/pdaudiocf/pdaudiocf_core.c index 484c8f9a6f1c..dfa40b0ed86d 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf_core.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf_core.c @@ -18,7 +18,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_irq.c b/sound/pcmcia/pdaudiocf/pdaudiocf_irq.c index 54543369949e..fa4b11398b1f 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf_irq.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf_irq.c @@ -18,7 +18,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include "pdaudiocf.h" #include diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c index 10afcb262d5c..01066c95580e 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c @@ -20,7 +20,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/pcmcia/vx/vxp_mixer.c b/sound/pcmcia/vx/vxp_mixer.c index bf9d3b37d6bc..a4a664259f0d 100644 --- a/sound/pcmcia/vx/vxp_mixer.c +++ b/sound/pcmcia/vx/vxp_mixer.c @@ -20,7 +20,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/pcmcia/vx/vxp_ops.c b/sound/pcmcia/vx/vxp_ops.c index 1ee0918c3b9f..157b0b539f39 100644 --- a/sound/pcmcia/vx/vxp_ops.c +++ b/sound/pcmcia/vx/vxp_ops.c @@ -20,7 +20,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c index c57e127d9ccb..706602a40600 100644 --- a/sound/pcmcia/vx/vxpocket.c +++ b/sound/pcmcia/vx/vxpocket.c @@ -19,7 +19,6 @@ */ -#include #include #include #include diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c index b15bfb6f7011..8441e780df00 100644 --- a/sound/ppc/awacs.c +++ b/sound/ppc/awacs.c @@ -20,7 +20,6 @@ */ -#include #include #include #include diff --git a/sound/ppc/beep.c b/sound/ppc/beep.c index 465dd0466b9f..baa2a7237370 100644 --- a/sound/ppc/beep.c +++ b/sound/ppc/beep.c @@ -18,7 +18,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/ppc/burgundy.c b/sound/ppc/burgundy.c index fec74e829743..1a545ac0de04 100644 --- a/sound/ppc/burgundy.c +++ b/sound/ppc/burgundy.c @@ -19,7 +19,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/ppc/daca.c b/sound/ppc/daca.c index 0c8145792d54..8432c16cd6ff 100644 --- a/sound/ppc/daca.c +++ b/sound/ppc/daca.c @@ -19,7 +19,6 @@ */ -#include #include #include #include diff --git a/sound/ppc/keywest.c b/sound/ppc/keywest.c index bb7d744faff5..6ff99ed77516 100644 --- a/sound/ppc/keywest.c +++ b/sound/ppc/keywest.c @@ -19,7 +19,6 @@ */ -#include #include #include #include diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c index 8c47bebc77c8..aada1d7dc3c4 100644 --- a/sound/ppc/pmac.c +++ b/sound/ppc/pmac.c @@ -20,7 +20,6 @@ */ -#include #include #include #include diff --git a/sound/ppc/powermac.c b/sound/ppc/powermac.c index 2264574fa06b..c936225771ba 100644 --- a/sound/ppc/powermac.c +++ b/sound/ppc/powermac.c @@ -18,7 +18,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/ppc/snd_ps3.c b/sound/ppc/snd_ps3.c index af812dc69ece..d8d0b4b2395a 100644 --- a/sound/ppc/snd_ps3.c +++ b/sound/ppc/snd_ps3.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c index d4d22e161d11..71a7a9765429 100644 --- a/sound/ppc/tumbler.c +++ b/sound/ppc/tumbler.c @@ -24,7 +24,6 @@ */ -#include #include #include #include diff --git a/sound/sh/aica.c b/sound/sh/aica.c index 12c41df255a1..d49417bf78c6 100644 --- a/sound/sh/aica.c +++ b/sound/sh/aica.c @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/at91/at91-pcm.c b/sound/soc/at91/at91-pcm.c index b39b95a47040..67c88e322fb1 100644 --- a/sound/soc/at91/at91-pcm.c +++ b/sound/soc/at91/at91-pcm.c @@ -23,7 +23,6 @@ #include #include -#include #include #include #include diff --git a/sound/soc/at91/at91-ssc.c b/sound/soc/at91/at91-ssc.c index 3d4e32cff75e..f642d2dd4ec3 100644 --- a/sound/soc/at91/at91-ssc.c +++ b/sound/soc/at91/at91-ssc.c @@ -22,7 +22,6 @@ #include #include -#include #include #include #include diff --git a/sound/soc/at91/eti_b1_wm8731.c b/sound/soc/at91/eti_b1_wm8731.c index 820a676c56bf..ad3ad9d662f8 100644 --- a/sound/soc/at91/eti_b1_wm8731.c +++ b/sound/soc/at91/eti_b1_wm8731.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/ac97.c b/sound/soc/codecs/ac97.c index 0b8a6f8b3668..242130cf1abd 100644 --- a/sound/soc/codecs/ac97.c +++ b/sound/soc/codecs/ac97.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c index 968eda37754c..bf2ab72d49bf 100644 --- a/sound/soc/codecs/cs4270.c +++ b/sound/soc/codecs/cs4270.c @@ -28,7 +28,6 @@ #include #include -#include #include #include #include diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index c075a28949f6..710e0287ef8c 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c @@ -39,7 +39,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c index 57fb95a714bf..9c33fe874928 100644 --- a/sound/soc/codecs/wm8731.c +++ b/sound/soc/codecs/wm8731.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c index f8797deaf737..77a857b997a2 100644 --- a/sound/soc/codecs/wm8750.c +++ b/sound/soc/codecs/wm8750.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c index efced934566d..e6a9b912ba1c 100644 --- a/sound/soc/codecs/wm8753.c +++ b/sound/soc/codecs/wm8753.c @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c index 427cb61f65a6..9ef8e5c9635a 100644 --- a/sound/soc/codecs/wm9712.c +++ b/sound/soc/codecs/wm9712.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/pxa/corgi.c b/sound/soc/pxa/corgi.c index 5ee51a994ac3..3f34e531bebf 100644 --- a/sound/soc/pxa/corgi.c +++ b/sound/soc/pxa/corgi.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c index 0915cf740421..5ae59bd309a3 100644 --- a/sound/soc/pxa/poodle.c +++ b/sound/soc/pxa/poodle.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c index 60e6f4677f93..815c15336255 100644 --- a/sound/soc/pxa/pxa2xx-ac97.c +++ b/sound/soc/pxa/pxa2xx-ac97.c @@ -17,7 +17,6 @@ #include #include -#include #include #include #include diff --git a/sound/soc/pxa/pxa2xx-i2s.c b/sound/soc/pxa/pxa2xx-i2s.c index 50c5c83f67db..692b90002489 100644 --- a/sound/soc/pxa/pxa2xx-i2s.c +++ b/sound/soc/pxa/pxa2xx-i2s.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/pxa/pxa2xx-pcm.c b/sound/soc/pxa/pxa2xx-pcm.c index 35e8fa3a469c..daeaa4c8b876 100644 --- a/sound/soc/pxa/pxa2xx-pcm.c +++ b/sound/soc/pxa/pxa2xx-pcm.c @@ -16,7 +16,6 @@ #include #include -#include #include #include #include diff --git a/sound/soc/pxa/spitz.c b/sound/soc/pxa/spitz.c index 4dd8f35312b3..d56709e15435 100644 --- a/sound/soc/pxa/spitz.c +++ b/sound/soc/pxa/spitz.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c index 5504e30acf14..e4d40b528ca4 100644 --- a/sound/soc/pxa/tosa.c +++ b/sound/soc/pxa/tosa.c @@ -25,7 +25,6 @@ #include #include -#include #include #include #include diff --git a/sound/soc/s3c24xx/ln2440sbc_alc650.c b/sound/soc/s3c24xx/ln2440sbc_alc650.c index ec0d1a23c18b..9ed8f2e8da10 100644 --- a/sound/soc/s3c24xx/ln2440sbc_alc650.c +++ b/sound/soc/s3c24xx/ln2440sbc_alc650.c @@ -18,7 +18,6 @@ #include #include -#include #include #include #include diff --git a/sound/soc/s3c24xx/neo1973_wm8753.c b/sound/soc/s3c24xx/neo1973_wm8753.c index bde4cdcb433f..6ee115ceb011 100644 --- a/sound/soc/s3c24xx/neo1973_wm8753.c +++ b/sound/soc/s3c24xx/neo1973_wm8753.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/s3c24xx/s3c2443-ac97.c b/sound/soc/s3c24xx/s3c2443-ac97.c index 96605b72e71c..1c1ddbf7f3c0 100644 --- a/sound/soc/s3c24xx/s3c2443-ac97.c +++ b/sound/soc/s3c24xx/s3c2443-ac97.c @@ -23,7 +23,6 @@ #include #include -#include #include #include #include diff --git a/sound/soc/s3c24xx/s3c24xx-i2s.c b/sound/soc/s3c24xx/s3c24xx-i2s.c index 9d8af3a46da8..ff99b76e71a4 100644 --- a/sound/soc/s3c24xx/s3c24xx-i2s.c +++ b/sound/soc/s3c24xx/s3c24xx-i2s.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/s3c24xx/s3c24xx-pcm.c b/sound/soc/s3c24xx/s3c24xx-pcm.c index 4107a87d4de3..290dcf12b5ae 100644 --- a/sound/soc/s3c24xx/s3c24xx-pcm.c +++ b/sound/soc/s3c24xx/s3c24xx-pcm.c @@ -24,7 +24,6 @@ #include #include -#include #include #include #include diff --git a/sound/soc/s3c24xx/smdk2443_wm9710.c b/sound/soc/s3c24xx/smdk2443_wm9710.c index d46cd811ceb3..b4a56302b9ab 100644 --- a/sound/soc/s3c24xx/smdk2443_wm9710.c +++ b/sound/soc/s3c24xx/smdk2443_wm9710.c @@ -17,7 +17,6 @@ #include #include -#include #include #include #include diff --git a/sound/soc/sh/dma-sh7760.c b/sound/soc/sh/dma-sh7760.c index cdee374b843e..7a3ce80d6727 100644 --- a/sound/soc/sh/dma-sh7760.c +++ b/sound/soc/sh/dma-sh7760.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/sh/hac.c b/sound/soc/sh/hac.c index 34b77b9fbb9c..b7b676b3d671 100644 --- a/sound/soc/sh/hac.c +++ b/sound/soc/sh/hac.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/sh/sh7760-ac97.c b/sound/soc/sh/sh7760-ac97.c index 5563f14511fa..2f91de84c5c7 100644 --- a/sound/soc/sh/sh7760-ac97.c +++ b/sound/soc/sh/sh7760-ac97.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/sh/ssi.c b/sound/soc/sh/ssi.c index b72bc316cb8e..3388bc3d62d1 100644 --- a/sound/soc/sh/ssi.c +++ b/sound/soc/sh/ssi.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index e6a67b58f296..94075256638c 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 29a546fecacf..3b8f94af7e27 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -43,7 +43,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/sparc/amd7930.c b/sound/sparc/amd7930.c index b1d431587158..0c63e0585b15 100644 --- a/sound/sparc/amd7930.c +++ b/sound/sparc/amd7930.c @@ -36,7 +36,6 @@ #include #include -#include #include #include #include diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c index f8c7a120ccbb..1c4797be72ee 100644 --- a/sound/sparc/cs4231.c +++ b/sound/sparc/cs4231.c @@ -19,7 +19,6 @@ #include -#include #include #include #include diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c index fc683174f2c7..3d00e0797b11 100644 --- a/sound/sparc/dbri.c +++ b/sound/sparc/dbri.c @@ -53,7 +53,6 @@ * other DBRI low-level stuff */ -#include #include #include #include diff --git a/sound/spi/at73c213.c b/sound/spi/at73c213.c index 5e8cf9f44ca3..89d6e9c35140 100644 --- a/sound/spi/at73c213.c +++ b/sound/spi/at73c213.c @@ -22,7 +22,6 @@ #include #include -#include #include #include #include diff --git a/sound/synth/emux/emux.c b/sound/synth/emux/emux.c index ebcac13fd397..c89d2ea594b9 100644 --- a/sound/synth/emux/emux.c +++ b/sound/synth/emux/emux.c @@ -18,7 +18,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/synth/emux/emux_hwdep.c b/sound/synth/emux/emux_hwdep.c index 9b63814c3f64..0a5391436add 100644 --- a/sound/synth/emux/emux_hwdep.c +++ b/sound/synth/emux/emux_hwdep.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/sound/synth/emux/emux_oss.c b/sound/synth/emux/emux_oss.c index 3436816727c8..f60a98ef7dec 100644 --- a/sound/synth/emux/emux_oss.c +++ b/sound/synth/emux/emux_oss.c @@ -22,7 +22,6 @@ * midi emulation. */ -#include #ifdef CONFIG_SND_SEQUENCER_OSS diff --git a/sound/synth/emux/emux_proc.c b/sound/synth/emux/emux_proc.c index 680f2b7fec20..687e6a13689e 100644 --- a/sound/synth/emux/emux_proc.c +++ b/sound/synth/emux/emux_proc.c @@ -18,7 +18,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/synth/emux/emux_voice.h b/sound/synth/emux/emux_voice.h index 0a56ca18b165..09711f84ed30 100644 --- a/sound/synth/emux/emux_voice.h +++ b/sound/synth/emux/emux_voice.h @@ -22,7 +22,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/synth/emux/soundfont.c b/sound/synth/emux/soundfont.c index 455e535933ec..36d53bd317ed 100644 --- a/sound/synth/emux/soundfont.c +++ b/sound/synth/emux/soundfont.c @@ -25,7 +25,6 @@ * of doing things so that the old sfxload utility can be used. * Everything may change when there is an alsa way of doing things. */ -#include #include #include #include diff --git a/sound/synth/util_mem.c b/sound/synth/util_mem.c index 6fc3d2b2519f..deabe5f899c4 100644 --- a/sound/synth/util_mem.c +++ b/sound/synth/util_mem.c @@ -19,7 +19,6 @@ */ #include -#include #include #include #include diff --git a/sound/usb/caiaq/caiaq-audio.c b/sound/usb/caiaq/caiaq-audio.c index bf551c08c2ec..f7e5284b8620 100644 --- a/sound/usb/caiaq/caiaq-audio.c +++ b/sound/usb/caiaq/caiaq-audio.c @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/usb/caiaq/caiaq-control.c b/sound/usb/caiaq/caiaq-control.c index 7d25f4b25534..798ca124da58 100644 --- a/sound/usb/caiaq/caiaq-control.c +++ b/sound/usb/caiaq/caiaq-control.c @@ -17,7 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/usb/caiaq/caiaq-device.c b/sound/usb/caiaq/caiaq-device.c index 48c6bedfe0f2..5cd92ae3cd16 100644 --- a/sound/usb/caiaq/caiaq-device.c +++ b/sound/usb/caiaq/caiaq-device.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/usb/caiaq/caiaq-input.c b/sound/usb/caiaq/caiaq-input.c index e6c410ab76f4..f743847a5e5a 100644 --- a/sound/usb/caiaq/caiaq-input.c +++ b/sound/usb/caiaq/caiaq-input.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/usb/caiaq/caiaq-midi.c b/sound/usb/caiaq/caiaq-midi.c index 793ca20ce349..54270328be52 100644 --- a/sound/usb/caiaq/caiaq-midi.c +++ b/sound/usb/caiaq/caiaq-midi.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index c6d628a3127c..8fa935665702 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c @@ -38,7 +38,6 @@ */ -#include #include #include #include diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c index 6330788c1c2b..750e929d5870 100644 --- a/sound/usb/usbmidi.c +++ b/sound/usb/usbmidi.c @@ -35,7 +35,6 @@ * SUCH DAMAGE. */ -#include #include #include #include diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c index 1f1e91cee3fe..89c63d073cc6 100644 --- a/sound/usb/usbmixer.c +++ b/sound/usb/usbmixer.c @@ -26,7 +26,6 @@ * */ -#include #include #include #include diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c index a1dca3441319..6495534e5bf6 100644 --- a/sound/usb/usx2y/usX2Yhwdep.c +++ b/sound/usb/usx2y/usX2Yhwdep.c @@ -20,7 +20,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c index e011fcacce92..e5981a630314 100644 --- a/sound/usb/usx2y/usbusx2y.c +++ b/sound/usb/usx2y/usbusx2y.c @@ -130,7 +130,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c index 48e9aa3f18c9..9a608fa85155 100644 --- a/sound/usb/usx2y/usbusx2yaudio.c +++ b/sound/usb/usx2y/usbusx2yaudio.c @@ -31,7 +31,6 @@ */ -#include #include #include #include -- cgit v1.2.3 From 0b4d221b8d56deefca4984d01b3a010107ae1f72 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Thu, 10 Jan 2008 14:36:20 +0100 Subject: [ALSA] soc - Add device level DAPM event Added a device level dapm event so that both the machine and codec are informed when dapm events occur. Signed-off-by: Liam Girdwood Signed-off-by: Mark Brown Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- include/sound/soc-dapm.h | 1 + include/sound/soc.h | 3 +++ sound/soc/soc-core.c | 23 +++++++++++------------ sound/soc/soc-dapm.c | 23 +++++++++++++++++++++++ 4 files changed, 38 insertions(+), 12 deletions(-) (limited to 'include') diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index b9d586442518..4158cbaa0f25 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h @@ -199,6 +199,7 @@ void snd_soc_dapm_free(struct snd_soc_device *socdev); /* dapm events */ int snd_soc_dapm_stream_event(struct snd_soc_codec *codec, char *stream, int event); +int snd_soc_dapm_device_event(struct snd_soc_device *socdev, int event); /* dapm sys fs - used by the core */ int snd_soc_dapm_sys_add(struct device *dev); diff --git a/include/sound/soc.h b/include/sound/soc.h index c22c65650405..add5f948e383 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -425,6 +425,9 @@ struct snd_soc_machine { int (*resume_pre)(struct platform_device *pdev); int (*resume_post)(struct platform_device *pdev); + /* callbacks */ + int (*dapm_event)(struct snd_soc_machine *, int event); + /* CPU <--> Codec DAI links */ struct snd_soc_dai_link *dai_link; int num_links; diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 94075256638c..bd656db347ee 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -288,15 +288,16 @@ static void close_delayed_work(struct work_struct *work) if (codec_dai->pop_wait == 1) { codec_dai->pop_wait = 0; - snd_soc_dapm_stream_event(codec, codec_dai->playback.stream_name, + snd_soc_dapm_stream_event(codec, + codec_dai->playback.stream_name, SND_SOC_DAPM_STREAM_STOP); /* power down the codec power domain if no longer active */ if (codec->active == 0) { dbg("pop wq D3 %s %s\n", codec->name, codec_dai->playback.stream_name); - if (codec->dapm_event) - codec->dapm_event(codec, SNDRV_CTL_POWER_D3hot); + snd_soc_dapm_device_event(socdev, + SNDRV_CTL_POWER_D3hot); } } } @@ -352,12 +353,12 @@ static int soc_codec_close(struct snd_pcm_substream *substream) } else { /* capture streams can be powered down now */ snd_soc_dapm_stream_event(codec, - codec_dai->capture.stream_name, SND_SOC_DAPM_STREAM_STOP); + codec_dai->capture.stream_name, + SND_SOC_DAPM_STREAM_STOP); - if (codec->active == 0 && codec_dai->pop_wait == 0){ - if (codec->dapm_event) - codec->dapm_event(codec, SNDRV_CTL_POWER_D3hot); - } + if (codec->active == 0 && codec_dai->pop_wait == 0) + snd_soc_dapm_device_event(socdev, + SNDRV_CTL_POWER_D3hot); } mutex_unlock(&pcm_mutex); @@ -432,8 +433,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) /* no delayed work - do we need to power up codec */ if (codec->dapm_state != SNDRV_CTL_POWER_D0) { - if (codec->dapm_event) - codec->dapm_event(codec, SNDRV_CTL_POWER_D1); + snd_soc_dapm_device_event(socdev, SNDRV_CTL_POWER_D1); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) snd_soc_dapm_stream_event(codec, @@ -444,8 +444,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) codec_dai->capture.stream_name, SND_SOC_DAPM_STREAM_START); - if (codec->dapm_event) - codec->dapm_event(codec, SNDRV_CTL_POWER_D0); + snd_soc_dapm_device_event(socdev, SNDRV_CTL_POWER_D0); if (codec_dai->dai_ops.digital_mute) codec_dai->dai_ops.digital_mute(codec_dai, 0); diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 3b8f94af7e27..16ebb60ed3d4 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -1278,6 +1278,29 @@ int snd_soc_dapm_stream_event(struct snd_soc_codec *codec, } EXPORT_SYMBOL_GPL(snd_soc_dapm_stream_event); +/** + * snd_soc_dapm_device_event - send a device event to the dapm core + * @socdev: audio device + * @event: device event + * + * Sends a device event to the dapm core. The core then makes any + * necessary machine or codec power changes.. + * + * Returns 0 for success else error. + */ +int snd_soc_dapm_device_event(struct snd_soc_device *socdev, int event) +{ + struct snd_soc_codec *codec = socdev->codec; + struct snd_soc_machine *machine = socdev->machine; + + if (machine->dapm_event) + machine->dapm_event(machine, event); + if (codec->dapm_event) + codec->dapm_event(codec, event); + return 0; +} +EXPORT_SYMBOL_GPL(snd_soc_dapm_device_event); + /** * snd_soc_dapm_set_endpoint - set audio endpoint status * @codec: audio codec -- cgit v1.2.3 From a7a4ac86b4754f44eb06221f3087debb4775d588 Mon Sep 17 00:00:00 2001 From: Philipp Zabel Date: Thu, 10 Jan 2008 14:37:42 +0100 Subject: [ALSA] ASoC TLV support Add TLV support to ASoC. Signed-off-by: Philipp Zabel Signed-off-by: Liam Girdwood Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- include/sound/soc-dapm.h | 24 +++++++++++++++--- include/sound/soc.h | 58 ++++++++++++++++++++++++++++++++++-------- sound/soc/soc-core.c | 66 ++++++++++++++++++++++++++++-------------------- sound/soc/soc-dapm.c | 14 +++++----- 4 files changed, 114 insertions(+), 48 deletions(-) (limited to 'include') diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 4158cbaa0f25..491f81e89847 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h @@ -131,18 +131,34 @@ .shift = wshift, .invert = winvert} /* dapm kcontrol types */ -#define SOC_DAPM_SINGLE(xname, reg, shift, mask, invert) \ +#define SOC_DAPM_SINGLE(xname, reg, shift, max, invert) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ .info = snd_soc_info_volsw, \ .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ - .private_value = SOC_SINGLE_VALUE(reg, shift, mask, invert) } -#define SOC_DAPM_DOUBLE(xname, reg, shift_left, shift_right, mask, invert, \ + .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } +#define SOC_DAPM_DOUBLE(xname, reg, shift_left, shift_right, max, invert, \ power) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ .info = snd_soc_info_volsw, \ .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ .private_value = (reg) | ((shift_left) << 8) | ((shift_right) << 12) |\ - ((mask) << 16) | ((invert) << 24) } + ((max) << 16) | ((invert) << 24) } +#define SOC_DAPM_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \ +{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ + .info = snd_soc_info_volsw, \ + .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_READWRITE,\ + .tlv.p = (tlv_array), \ + .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ + .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } +#define SOC_DAPM_DOUBLE_TLV(xname, reg, shift_left, shift_right, max, invert, \ + power, tlv_array) \ +{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ + .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_READWRITE,\ + .tlv.p = (tlv_array), \ + .info = snd_soc_info_volsw, \ + .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ + .private_value = (reg) | ((shift_left) << 8) | ((shift_right) << 12) |\ + ((max) << 16) | ((invert) << 24) } #define SOC_DAPM_ENUM(xname, xenum) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ .info = snd_soc_info_enum_double, \ diff --git a/include/sound/soc.h b/include/sound/soc.h index add5f948e383..0afcdfe42a46 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -26,27 +26,53 @@ /* * Convenience kcontrol builders */ -#define SOC_SINGLE_VALUE(reg,shift,mask,invert) ((reg) | ((shift) << 8) |\ - ((shift) << 12) | ((mask) << 16) | ((invert) << 24)) -#define SOC_SINGLE_VALUE_EXT(reg,mask,invert) ((reg) | ((mask) << 16) |\ +#define SOC_SINGLE_VALUE(reg, shift, max, invert) ((reg) | ((shift) << 8) |\ + ((shift) << 12) | ((max) << 16) | ((invert) << 24)) +#define SOC_SINGLE_VALUE_EXT(reg, max, invert) ((reg) | ((max) << 16) |\ ((invert) << 31)) -#define SOC_SINGLE(xname, reg, shift, mask, invert) \ +#define SOC_SINGLE(xname, reg, shift, max, invert) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ .put = snd_soc_put_volsw, \ - .private_value = SOC_SINGLE_VALUE(reg, shift, mask, invert) } -#define SOC_DOUBLE(xname, reg, shift_left, shift_right, mask, invert) \ + .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } +#define SOC_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \ +{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ + .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ + SNDRV_CTL_ELEM_ACCESS_READWRITE,\ + .tlv.p = (tlv_array), \ + .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ + .put = snd_soc_put_volsw, \ + .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } +#define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \ .put = snd_soc_put_volsw, \ .private_value = (reg) | ((shift_left) << 8) | \ - ((shift_right) << 12) | ((mask) << 16) | ((invert) << 24) } -#define SOC_DOUBLE_R(xname, reg_left, reg_right, shift, mask, invert) \ + ((shift_right) << 12) | ((max) << 16) | ((invert) << 24) } +#define SOC_DOUBLE_R(xname, reg_left, reg_right, shift, max, invert) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ .info = snd_soc_info_volsw_2r, \ .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \ .private_value = (reg_left) | ((shift) << 8) | \ - ((mask) << 12) | ((invert) << 20) | ((reg_right) << 24) } + ((max) << 12) | ((invert) << 20) | ((reg_right) << 24) } +#define SOC_DOUBLE_TLV(xname, reg, shift_left, shift_right, max, invert, tlv_array) \ +{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ + .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ + SNDRV_CTL_ELEM_ACCESS_READWRITE,\ + .tlv.p = (tlv_array), \ + .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \ + .put = snd_soc_put_volsw, \ + .private_value = (reg) | ((shift_left) << 8) | \ + ((shift_right) << 12) | ((max) << 16) | ((invert) << 24) } +#define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, shift, max, invert, tlv_array) \ +{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ + .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ + SNDRV_CTL_ELEM_ACCESS_READWRITE,\ + .tlv.p = (tlv_array), \ + .info = snd_soc_info_volsw_2r, \ + .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \ + .private_value = (reg_left) | ((shift) << 8) | \ + ((max) << 12) | ((invert) << 20) | ((reg_right) << 24) } #define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xtexts) \ { .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ .mask = xmask, .texts = xtexts } @@ -103,10 +129,22 @@ #define SND_SOC_DAIFMT_CONT (0 << 4) /* continuous clock */ #define SND_SOC_DAIFMT_GATED (1 << 4) /* clock is gated when not Tx/Rx */ +/* + * DAI Sync + * Synchronous LR (Left Right) clocks and Frame signals. + */ +#define SND_SOC_DAIFMT_SYNC (0 << 5) /* Tx FRM = Rx FRM */ +#define SND_SOC_DAIFMT_ASYNC (1 << 5) /* Tx FRM ~ Rx FRM */ + +/* + * TDM + */ +#define SND_SOC_DAIFMT_TDM (1 << 6) + /* * DAI hardware signal inversions */ -#define SND_SOC_DAIFMT_NB_NF (0 << 8) /* normal bit clock + frame */ +#define SND_SOC_DAIFMT_NB_NF (0 << 8) /* normal bclk + frm */ #define SND_SOC_DAIFMT_NB_IF (1 << 8) /* normal bclk + inv frm */ #define SND_SOC_DAIFMT_IB_NF (2 << 8) /* invert bclk + nor frm */ #define SND_SOC_DAIFMT_IB_IF (3 << 8) /* invert bclk + frm */ diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index bd656db347ee..e748b00466b7 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1213,7 +1213,6 @@ struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template, memcpy(&template, _template, sizeof(template)); if (long_name) template.name = long_name; - template.access = SNDRV_CTL_ELEM_ACCESS_READWRITE; template.index = 0; return snd_ctl_new1(&template, data); @@ -1348,13 +1347,16 @@ EXPORT_SYMBOL_GPL(snd_soc_info_enum_ext); int snd_soc_info_volsw_ext(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - int mask = kcontrol->private_value; + int max = kcontrol->private_value; + + if (max == 1) + uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; + else + uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; - uinfo->type = - mask == 1 ? SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 1; uinfo->value.integer.min = 0; - uinfo->value.integer.max = mask; + uinfo->value.integer.max = max; return 0; } EXPORT_SYMBOL_GPL(snd_soc_info_volsw_ext); @@ -1371,15 +1373,18 @@ EXPORT_SYMBOL_GPL(snd_soc_info_volsw_ext); int snd_soc_info_volsw(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - int mask = (kcontrol->private_value >> 16) & 0xff; + int max = (kcontrol->private_value >> 16) & 0xff; int shift = (kcontrol->private_value >> 8) & 0x0f; int rshift = (kcontrol->private_value >> 12) & 0x0f; - uinfo->type = - mask == 1 ? SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER; + if (max == 1) + uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; + else + uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; + uinfo->count = shift == rshift ? 1 : 2; uinfo->value.integer.min = 0; - uinfo->value.integer.max = mask; + uinfo->value.integer.max = max; return 0; } EXPORT_SYMBOL_GPL(snd_soc_info_volsw); @@ -1400,7 +1405,8 @@ int snd_soc_get_volsw(struct snd_kcontrol *kcontrol, int reg = kcontrol->private_value & 0xff; int shift = (kcontrol->private_value >> 8) & 0x0f; int rshift = (kcontrol->private_value >> 12) & 0x0f; - int mask = (kcontrol->private_value >> 16) & 0xff; + int max = (kcontrol->private_value >> 16) & 0xff; + int mask = (1 << fls(max)) - 1; int invert = (kcontrol->private_value >> 24) & 0x01; ucontrol->value.integer.value[0] = @@ -1410,10 +1416,10 @@ int snd_soc_get_volsw(struct snd_kcontrol *kcontrol, (snd_soc_read(codec, reg) >> rshift) & mask; if (invert) { ucontrol->value.integer.value[0] = - mask - ucontrol->value.integer.value[0]; + max - ucontrol->value.integer.value[0]; if (shift != rshift) ucontrol->value.integer.value[1] = - mask - ucontrol->value.integer.value[1]; + max - ucontrol->value.integer.value[1]; } return 0; @@ -1436,25 +1442,24 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol, int reg = kcontrol->private_value & 0xff; int shift = (kcontrol->private_value >> 8) & 0x0f; int rshift = (kcontrol->private_value >> 12) & 0x0f; - int mask = (kcontrol->private_value >> 16) & 0xff; + int max = (kcontrol->private_value >> 16) & 0xff; + int mask = (1 << fls(max)) - 1; int invert = (kcontrol->private_value >> 24) & 0x01; - int err; unsigned short val, val2, val_mask; val = (ucontrol->value.integer.value[0] & mask); if (invert) - val = mask - val; + val = max - val; val_mask = mask << shift; val = val << shift; if (shift != rshift) { val2 = (ucontrol->value.integer.value[1] & mask); if (invert) - val2 = mask - val2; + val2 = max - val2; val_mask |= mask << rshift; val |= val2 << rshift; } - err = snd_soc_update_bits(codec, reg, val_mask, val); - return err; + return snd_soc_update_bits(codec, reg, val_mask, val); } EXPORT_SYMBOL_GPL(snd_soc_put_volsw); @@ -1471,13 +1476,16 @@ EXPORT_SYMBOL_GPL(snd_soc_put_volsw); int snd_soc_info_volsw_2r(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - int mask = (kcontrol->private_value >> 12) & 0xff; + int max = (kcontrol->private_value >> 12) & 0xff; + + if (max == 1) + uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; + else + uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; - uinfo->type = - mask == 1 ? SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 2; uinfo->value.integer.min = 0; - uinfo->value.integer.max = mask; + uinfo->value.integer.max = max; return 0; } EXPORT_SYMBOL_GPL(snd_soc_info_volsw_2r); @@ -1498,7 +1506,8 @@ int snd_soc_get_volsw_2r(struct snd_kcontrol *kcontrol, int reg = kcontrol->private_value & 0xff; int reg2 = (kcontrol->private_value >> 24) & 0xff; int shift = (kcontrol->private_value >> 8) & 0x0f; - int mask = (kcontrol->private_value >> 12) & 0xff; + int max = (kcontrol->private_value >> 12) & 0xff; + int mask = (1<private_value >> 20) & 0x01; ucontrol->value.integer.value[0] = @@ -1507,9 +1516,9 @@ int snd_soc_get_volsw_2r(struct snd_kcontrol *kcontrol, (snd_soc_read(codec, reg2) >> shift) & mask; if (invert) { ucontrol->value.integer.value[0] = - mask - ucontrol->value.integer.value[0]; + max - ucontrol->value.integer.value[0]; ucontrol->value.integer.value[1] = - mask - ucontrol->value.integer.value[1]; + max - ucontrol->value.integer.value[1]; } return 0; @@ -1532,7 +1541,8 @@ int snd_soc_put_volsw_2r(struct snd_kcontrol *kcontrol, int reg = kcontrol->private_value & 0xff; int reg2 = (kcontrol->private_value >> 24) & 0xff; int shift = (kcontrol->private_value >> 8) & 0x0f; - int mask = (kcontrol->private_value >> 12) & 0xff; + int max = (kcontrol->private_value >> 12) & 0xff; + int mask = (1 << fls(max)) - 1; int invert = (kcontrol->private_value >> 20) & 0x01; int err; unsigned short val, val2, val_mask; @@ -1542,8 +1552,8 @@ int snd_soc_put_volsw_2r(struct snd_kcontrol *kcontrol, val2 = (ucontrol->value.integer.value[1] & mask); if (invert) { - val = mask - val; - val2 = mask - val2; + val = max - val; + val2 = max - val2; } val = val << shift; diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 16ebb60ed3d4..7eb6c5c03775 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -1018,8 +1018,9 @@ int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol, int reg = kcontrol->private_value & 0xff; int shift = (kcontrol->private_value >> 8) & 0x0f; int rshift = (kcontrol->private_value >> 12) & 0x0f; - int mask = (kcontrol->private_value >> 16) & 0xff; + int max = (kcontrol->private_value >> 16) & 0xff; int invert = (kcontrol->private_value >> 24) & 0x01; + int mask = (1 << fls(max)) - 1; /* return the saved value if we are powered down */ if (widget->id == snd_soc_dapm_pga && !widget->power) { @@ -1034,10 +1035,10 @@ int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol, (snd_soc_read(widget->codec, reg) >> rshift) & mask; if (invert) { ucontrol->value.integer.value[0] = - mask - ucontrol->value.integer.value[0]; + max - ucontrol->value.integer.value[0]; if (shift != rshift) ucontrol->value.integer.value[1] = - mask - ucontrol->value.integer.value[1]; + max - ucontrol->value.integer.value[1]; } return 0; @@ -1060,7 +1061,8 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, int reg = kcontrol->private_value & 0xff; int shift = (kcontrol->private_value >> 8) & 0x0f; int rshift = (kcontrol->private_value >> 12) & 0x0f; - int mask = (kcontrol->private_value >> 16) & 0xff; + int max = (kcontrol->private_value >> 16) & 0xff; + int mask = (1 << fls(max)) - 1; int invert = (kcontrol->private_value >> 24) & 0x01; unsigned short val, val2, val_mask; int ret; @@ -1068,13 +1070,13 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, val = (ucontrol->value.integer.value[0] & mask); if (invert) - val = mask - val; + val = max - val; val_mask = mask << shift; val = val << shift; if (shift != rshift) { val2 = (ucontrol->value.integer.value[1] & mask); if (invert) - val2 = mask - val2; + val2 = max - val2; val_mask |= mask << rshift; val |= val2 << rshift; } -- cgit v1.2.3 From 4ccab3e72e211c40d868045c7d3216948999bcf7 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Thu, 10 Jan 2008 14:39:01 +0100 Subject: [ALSA] soc - Ensure PCMs are suspended This fixes a bug whereby PCMs were not being suspended when the rest of the audio subsystem was suspended. Signed-off-by: Liam Girdwood Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- include/sound/soc.h | 3 +++ sound/soc/soc-core.c | 5 +++++ 2 files changed, 8 insertions(+) (limited to 'include') diff --git a/include/sound/soc.h b/include/sound/soc.h index 0afcdfe42a46..6b51ff2269b4 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -447,6 +447,9 @@ struct snd_soc_dai_link { /* codec/machine specific init - e.g. add machine controls */ int (*init)(struct snd_soc_codec *codec); + + /* DAI pcm */ + struct snd_pcm *pcm; }; /* SoC machine */ diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 7d51be8ee069..5f86e033098f 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -645,6 +645,10 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state) dai->dai_ops.digital_mute(dai, 1); } + /* suspend all pcms */ + for (i = 0; i < machine->num_links; i++) + snd_pcm_suspend_all(machine->dai_link[i].pcm); + if (machine->suspend_pre) machine->suspend_pre(pdev, state); @@ -879,6 +883,7 @@ static int soc_new_pcm(struct snd_soc_device *socdev, return ret; } + dai_link->pcm = pcm; pcm->private_data = rtd; soc_pcm_ops.mmap = socdev->platform->pcm_ops->mmap; soc_pcm_ops.pointer = socdev->platform->pcm_ops->pointer; -- cgit v1.2.3 From 9af6d9562414568ecadf96aaef5b88e7e8b19821 Mon Sep 17 00:00:00 2001 From: Laim Girdwood Date: Thu, 10 Jan 2008 14:41:02 +0100 Subject: [ALSA] soc - Add support for passing kcontrols with events Signed-off-by: Laim Girdwood Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- include/sound/soc-dapm.h | 2 +- sound/soc/soc-dapm.c | 40 +++++++++++++++++++++++++++------------- 2 files changed, 28 insertions(+), 14 deletions(-) (limited to 'include') diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 491f81e89847..a105b01e06d5 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h @@ -289,7 +289,7 @@ struct snd_soc_dapm_widget { /* external events */ unsigned short event_flags; /* flags to specify event types */ - int (*event)(struct snd_soc_dapm_widget*, int); + int (*event)(struct snd_soc_dapm_widget*, struct snd_kcontrol *, int); /* kcontrols that relate to this widget */ int num_kcontrols; diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index d033e73103a8..8b61db2f6398 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -523,11 +523,13 @@ static int dapm_power_widgets(struct snd_soc_codec *codec, int event) continue; if (event == SND_SOC_DAPM_STREAM_START) { - ret = w->event(w, SND_SOC_DAPM_PRE_PMU); + ret = w->event(w, + NULL, SND_SOC_DAPM_PRE_PMU); if (ret < 0) return ret; } else if (event == SND_SOC_DAPM_STREAM_STOP) { - ret = w->event(w, SND_SOC_DAPM_PRE_PMD); + ret = w->event(w, + NULL, SND_SOC_DAPM_PRE_PMD); if (ret < 0) return ret; } @@ -538,11 +540,13 @@ static int dapm_power_widgets(struct snd_soc_codec *codec, int event) continue; if (event == SND_SOC_DAPM_STREAM_START) { - ret = w->event(w, SND_SOC_DAPM_POST_PMU); + ret = w->event(w, + NULL, SND_SOC_DAPM_POST_PMU); if (ret < 0) return ret; } else if (event == SND_SOC_DAPM_STREAM_STOP) { - ret = w->event(w, SND_SOC_DAPM_POST_PMD); + ret = w->event(w, + NULL, SND_SOC_DAPM_POST_PMD); if (ret < 0) return ret; } @@ -566,26 +570,30 @@ static int dapm_power_widgets(struct snd_soc_codec *codec, int event) if (power) { /* power up event */ if (w->event_flags & SND_SOC_DAPM_PRE_PMU) { - ret = w->event(w, SND_SOC_DAPM_PRE_PMU); + ret = w->event(w, + NULL, SND_SOC_DAPM_PRE_PMU); if (ret < 0) return ret; } dapm_update_bits(w); if (w->event_flags & SND_SOC_DAPM_POST_PMU){ - ret = w->event(w, SND_SOC_DAPM_POST_PMU); + ret = w->event(w, + NULL, SND_SOC_DAPM_POST_PMU); if (ret < 0) return ret; } } else { /* power down event */ if (w->event_flags & SND_SOC_DAPM_PRE_PMD) { - ret = w->event(w, SND_SOC_DAPM_PRE_PMD); + ret = w->event(w, + NULL, SND_SOC_DAPM_PRE_PMD); if (ret < 0) return ret; } dapm_update_bits(w); if (w->event_flags & SND_SOC_DAPM_POST_PMD) { - ret = w->event(w, SND_SOC_DAPM_POST_PMD); + ret = w->event(w, + NULL, SND_SOC_DAPM_POST_PMD); if (ret < 0) return ret; } @@ -1095,13 +1103,17 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, dapm_mixer_update_power(widget, kcontrol, reg, val_mask, val, invert); if (widget->event) { if (widget->event_flags & SND_SOC_DAPM_PRE_REG) { - ret = widget->event(widget, SND_SOC_DAPM_PRE_REG); - if (ret < 0) + ret = widget->event(widget, kcontrol, + SND_SOC_DAPM_PRE_REG); + if (ret < 0) { + ret = 1; goto out; + } } ret = snd_soc_update_bits(widget->codec, reg, val_mask, val); if (widget->event_flags & SND_SOC_DAPM_POST_REG) - ret = widget->event(widget, SND_SOC_DAPM_POST_REG); + ret = widget->event(widget, kcontrol, + SND_SOC_DAPM_POST_REG); } else ret = snd_soc_update_bits(widget->codec, reg, val_mask, val); @@ -1176,13 +1188,15 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, dapm_mux_update_power(widget, kcontrol, mask, mux, e); if (widget->event) { if (widget->event_flags & SND_SOC_DAPM_PRE_REG) { - ret = widget->event(widget, SND_SOC_DAPM_PRE_REG); + ret = widget->event(widget, + kcontrol, SND_SOC_DAPM_PRE_REG); if (ret < 0) goto out; } ret = snd_soc_update_bits(widget->codec, e->reg, mask, val); if (widget->event_flags & SND_SOC_DAPM_POST_REG) - ret = widget->event(widget, SND_SOC_DAPM_POST_REG); + ret = widget->event(widget, + kcontrol, SND_SOC_DAPM_POST_REG); } else ret = snd_soc_update_bits(widget->codec, e->reg, mask, val); -- cgit v1.2.3 From 0a22b87de0467bbc2ce863d54b55c3a7b649ba74 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 10 Jan 2008 14:53:48 +0100 Subject: [ALSA] Bump ASoC core version number Signed-off-by: Mark Brown Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- include/sound/soc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/sound/soc.h b/include/sound/soc.h index 6b51ff2269b4..e6ea6f750941 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -21,7 +21,7 @@ #include #include -#define SND_SOC_VERSION "0.13.1" +#define SND_SOC_VERSION "0.13.2" /* * Convenience kcontrol builders -- cgit v1.2.3 From 8c12158687fc78091730d5456336b7efbf6f2250 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 11 Jan 2008 08:45:08 +0100 Subject: [ALSA] PCM interface - rename SNDRV_PCM_TSTAMP_MMAP to SNDRV_PCM_TSTAMP_ENABLE Change semantics for SNDRV_PCM_TSTAMP_MMAP. Doing timestamping only in the interrupt handler might cause that hw_ptr is not related to actual timestamp. With this change, grab timestamp at every hw_ptr update to have always valid timestamp + ring buffer position pair. With this change, SNDRV_PCM_TSTAMP_MMAP was renamed to SNDRV_PCM_TSTAMP_ENABLE. It's no regression (I think). Signed-off-by: Jaroslav Kysela --- include/sound/asound.h | 4 ++-- sound/core/pcm.c | 2 +- sound/core/pcm_lib.c | 4 ++-- sound/core/pcm_native.c | 8 +++++++- 4 files changed, 12 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/sound/asound.h b/include/sound/asound.h index 069d9120e622..3eaf155b850d 100644 --- a/include/sound/asound.h +++ b/include/sound/asound.h @@ -354,8 +354,8 @@ struct snd_pcm_hw_params { enum { SNDRV_PCM_TSTAMP_NONE = 0, - SNDRV_PCM_TSTAMP_MMAP, - SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_MMAP, + SNDRV_PCM_TSTAMP_ENABLE, + SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_ENABLE, }; struct snd_pcm_sw_params { diff --git a/sound/core/pcm.c b/sound/core/pcm.c index 1502acd81a18..9dd9bc73fe1d 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c @@ -227,7 +227,7 @@ static char *snd_pcm_subformat_names[] = { static char *snd_pcm_tstamp_mode_names[] = { TSTAMP(NONE), - TSTAMP(MMAP), + TSTAMP(ENABLE), }; static const char *snd_pcm_stream_name(int stream) diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index ed0223ca5c55..1533f0379e9d 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -144,6 +144,8 @@ static inline snd_pcm_uframes_t snd_pcm_update_hw_ptr_pos(struct snd_pcm_substre { snd_pcm_uframes_t pos; + if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) + snd_pcm_gettime(runtime, (struct timespec *)&runtime->status->tstamp); pos = substream->ops->pointer(substream); if (pos == SNDRV_PCM_POS_XRUN) return pos; /* XRUN */ @@ -186,8 +188,6 @@ static inline int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *subs snd_pcm_uframes_t new_hw_ptr, hw_ptr_interrupt; snd_pcm_sframes_t delta; - if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_MMAP) - snd_pcm_gettime(runtime, (struct timespec *)&runtime->status->tstamp); pos = snd_pcm_update_hw_ptr_pos(substream, runtime); if (pos == SNDRV_PCM_POS_XRUN) { xrun(substream); diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index e6e4aa87e57e..62449117ee14 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -580,9 +580,15 @@ int snd_pcm_status(struct snd_pcm_substream *substream, if (status->state == SNDRV_PCM_STATE_OPEN) goto _end; status->trigger_tstamp = runtime->trigger_tstamp; - if (snd_pcm_running(substream)) + if (snd_pcm_running(substream)) { snd_pcm_update_hw_ptr(substream); + if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) { + status->tstamp = runtime->status->tstamp; + goto _tstamp_end; + } + } snd_pcm_gettime(runtime, &status->tstamp); + _tstamp_end: status->appl_ptr = runtime->control->appl_ptr; status->hw_ptr = runtime->status->hw_ptr; if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { -- cgit v1.2.3 From 69252128ec628e9d19739db0101e1826d993aecb Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Thu, 24 Jan 2008 18:11:53 +0100 Subject: [ALSA] fm801 - Add mute support for FM-only card with FM801 PCI to tuner bridge This is improvement of the early support of the FM-only cards where the fm801 chip represents the PCI to tuner bridge. The tuner initialization isn't included the mute on as well as mute support via V4L request. Proposed patch should fix this at least for 64-PCR model. Signed-off-by: Andy Shevchenko Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- include/sound/tea575x-tuner.h | 1 + sound/i2c/other/tea575x-tuner.c | 8 ++++++++ sound/pci/fm801.c | 22 ++++++++++++++++++++++ 3 files changed, 31 insertions(+) (limited to 'include') diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h index e8eeb3a1ed29..b62ce3e077f9 100644 --- a/include/sound/tea575x-tuner.h +++ b/include/sound/tea575x-tuner.h @@ -30,6 +30,7 @@ struct snd_tea575x; struct snd_tea575x_ops { void (*write)(struct snd_tea575x *tea, unsigned int val); unsigned int (*read)(struct snd_tea575x *tea); + void (*mute)(struct snd_tea575x *tea, unsigned int mute); }; struct snd_tea575x { diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c index 28a4af782f5e..87e3aefeddc3 100644 --- a/sound/i2c/other/tea575x-tuner.c +++ b/sound/i2c/other/tea575x-tuner.c @@ -158,6 +158,10 @@ static int snd_tea575x_ioctl(struct inode *inode, struct file *file, struct video_audio v; if(copy_from_user(&v, arg, sizeof(v))) return -EFAULT; + if (tea->ops->mute) + tea->ops->mute(tea, + (v.flags & + VIDEO_AUDIO_MUTE) ? 1 : 0); if(v.audio) return -EINVAL; return 0; @@ -205,6 +209,10 @@ void snd_tea575x_init(struct snd_tea575x *tea) tea->freq = 90500 * 16; /* 90.5Mhz default */ snd_tea575x_set_freq(tea); + + /* mute on init */ + if (tea->ops->mute) + tea->ops->mute(tea, 1); } void snd_tea575x_exit(struct snd_tea575x *tea) diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c index 25c1087d2c00..4c300e6149fc 100644 --- a/sound/pci/fm801.c +++ b/sound/pci/fm801.c @@ -978,6 +978,27 @@ static unsigned int snd_fm801_tea575x_64pcr_read(struct snd_tea575x *tea) return val; } +static void snd_fm801_tea575x_64pcr_mute(struct snd_tea575x *tea, + unsigned int mute) +{ + struct fm801 *chip = tea->private_data; + unsigned short reg; + + spin_lock_irq(&chip->reg_lock); + + reg = inw(FM801_REG(chip, GPIO_CTRL)); + if (mute) + /* 0xf800 (mute) */ + reg &= ~FM801_GPIO_GP(TEA_64PCR_WRITE_ENABLE); + else + /* 0xf802 (unmute) */ + reg |= FM801_GPIO_GP(TEA_64PCR_WRITE_ENABLE); + outw(reg, FM801_REG(chip, GPIO_CTRL)); + udelay(1); + + spin_unlock_irq(&chip->reg_lock); +} + static struct snd_tea575x_ops snd_fm801_tea_ops[3] = { { /* 1 = MediaForte 256-PCS */ @@ -993,6 +1014,7 @@ static struct snd_tea575x_ops snd_fm801_tea_ops[3] = { /* 3 = MediaForte 64-PCR */ .write = snd_fm801_tea575x_64pcr_write, .read = snd_fm801_tea575x_64pcr_read, + .mute = snd_fm801_tea575x_64pcr_mute, } }; #endif -- cgit v1.2.3 From 44893a36ba49349e0f9d4bc3b7bbf9b54469ae1a Mon Sep 17 00:00:00 2001 From: James Courtier-Dutton Date: Mon, 12 Nov 2007 12:11:53 +0000 Subject: [ALSA] emu10k1: Add comments regarding E-Mu ins and outs. Signed-off-by: James Courtier-Dutton Signed-off-by: Jaroslav Kysela --- include/sound/emu10k1.h | 189 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 189 insertions(+) (limited to 'include') diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h index 441aa06dcd6f..fb66a949c2fb 100644 --- a/include/sound/emu10k1.h +++ b/include/sound/emu10k1.h @@ -1120,6 +1120,99 @@ /************************************************************************************************/ /* EMU1010m HANA Destinations */ /************************************************************************************************/ +/* Hana, original 1010,1212,1820 using Alice2 + * Destiniations for SRATEX = 1X rates: 44.1 kHz or 48 kHz + * 0x00, 0x00-0x0f: 16 EMU32 channels to Alice2 + * 0x01, 0x10-0x1f: 32 Elink channels to Audio Dock + * 0x01, 0x00: Dock DAC 1 Left + * 0x01, 0x04: Dock DAC 1 Right + * 0x01, 0x08: Dock DAC 2 Left + * 0x01, 0x0c: Dock DAC 2 Right + * 0x01, 0x10: Dock DAC 3 Left + * 0x01, 0x12: PHONES Left + * 0x01, 0x14: Dock DAC 3 Right + * 0x01, 0x16: PHONES Right + * 0x01, 0x18: Dock DAC 4 Left + * 0x01, 0x1a: S/PDIF Left + * 0x01, 0x1c: Dock DAC 4 Right + * 0x01, 0x1e: S/PDIF Right + * 0x02, 0x00: Hana S/PDIF Left + * 0x02, 0x01: Hana S/PDIF Right + * 0x03, 0x00: Hanoa DAC Left + * 0x03, 0x01: Hanoa DAC Right + * 0x04, 0x00-0x07: Hana ADAT + * 0x05, 0x00: I2S0 Left to Alice2 + * 0x05, 0x01: I2S0 Right to Alice2 + * 0x06, 0x00: I2S0 Left to Alice2 + * 0x06, 0x01: I2S0 Right to Alice2 + * 0x07, 0x00: I2S0 Left to Alice2 + * 0x07, 0x01: I2S0 Right to Alice2 + * + * Hana2 never released, but used Tina + * Not needed. + * + * Hana3, rev2 1010,1212,1616 using Tina + * Destinations for SRATEX = 1X rates: 44.1 kHz or 48 kHz + * 0x00, 0x00-0x0f: 16 EMU32A channels to Tina + * 0x01, 0x10-0x1f: 32 EDI channels to Micro Dock + * 0x01, 0x00: Dock DAC 1 Left + * 0x01, 0x04: Dock DAC 1 Right + * 0x01, 0x08: Dock DAC 2 Left + * 0x01, 0x0c: Dock DAC 2 Right + * 0x01, 0x10: Dock DAC 3 Left + * 0x01, 0x12: Dock S/PDIF Left + * 0x01, 0x14: Dock DAC 3 Right + * 0x01, 0x16: Dock S/PDIF Right + * 0x01, 0x18-0x1f: Dock ADAT 0-7 + * 0x02, 0x00: Hana3 S/PDIF Left + * 0x02, 0x01: Hana3 S/PDIF Right + * 0x03, 0x00: Hanoa DAC Left + * 0x03, 0x01: Hanoa DAC Right + * 0x04, 0x00-0x07: Hana3 ADAT 0-7 + * 0x05, 0x00-0x0f: 16 EMU32B channels to Tina + * 0x06-0x07: Not used + * + * HanaLite, rev1 0404 using Alice2 + * Destiniations for SRATEX = 1X rates: 44.1 kHz or 48 kHz + * 0x00, 0x00-0x0f: 16 EMU32 channels to Alice2 + * 0x01: Not used + * 0x02, 0x00: S/PDIF Left + * 0x02, 0x01: S/PDIF Right + * 0x03, 0x00: DAC Left + * 0x03, 0x01: DAC Right + * 0x04-0x07: Not used + * + * HanaLiteLite, rev2 0404 using Alice2 + * Destiniations for SRATEX = 1X rates: 44.1 kHz or 48 kHz + * 0x00, 0x00-0x0f: 16 EMU32 channels to Alice2 + * 0x01: Not used + * 0x02, 0x00: S/PDIF Left + * 0x02, 0x01: S/PDIF Right + * 0x03, 0x00: DAC Left + * 0x03, 0x01: DAC Right + * 0x04-0x07: Not used + * + * Mana, Cardbus 1616 using Tina2 + * Destinations for SRATEX = 1X rates: 44.1 kHz or 48 kHz + * 0x00, 0x00-0x0f: 16 EMU32A channels to Tina2 + * 0x01, 0x10-0x1f: 32 EDI channels to Micro Dock + * 0x01, 0x00: Dock DAC 1 Left + * 0x01, 0x04: Dock DAC 1 Right + * 0x01, 0x08: Dock DAC 2 Left + * 0x01, 0x0c: Dock DAC 2 Right + * 0x01, 0x10: Dock DAC 3 Left + * 0x01, 0x12: Dock S/PDIF Left + * 0x01, 0x14: Dock DAC 3 Right + * 0x01, 0x16: Dock S/PDIF Right + * 0x01, 0x18-0x1f: Dock ADAT 0-7 + * 0x02: Not used + * 0x03, 0x00: Mana DAC Left + * 0x03, 0x01: Mana DAC Right + * 0x04, 0x00-0x0f: 16 EMU32B channels to Tina2 + * 0x05-0x07: Not used + * + * + */ /* 32-bit destinations of signal in the Hana FPGA. Destinations are either * physical outputs of Hana, or outputs going to Alice2 (audigy) for capture * - 16 x EMU_DST_ALICE2_EMU32_X. @@ -1209,6 +1302,102 @@ /************************************************************************************************/ /* EMU1010m HANA Sources */ /************************************************************************************************/ +/* Hana, original 1010,1212,1820 using Alice2 + * Sources SRATEX = 1X rates: 44.1 kHz or 48 kHz + * 0x00,0x00-0x1f: Silence + * 0x01, 0x10-0x1f: 32 Elink channels from Audio Dock + * 0x01, 0x00: Dock Mic A + * 0x01, 0x04: Dock Mic B + * 0x01, 0x08: Dock ADC 1 Left + * 0x01, 0x0c: Dock ADC 1 Right + * 0x01, 0x10: Dock ADC 2 Left + * 0x01, 0x14: Dock ADC 2 Right + * 0x01, 0x18: Dock ADC 3 Left + * 0x01, 0x1c: Dock ADC 3 Right + * 0x02, 0x00: Hana ADC Left + * 0x02, 0x01: Hana ADC Right + * 0x03, 0x00-0x0f: 16 inputs from Alice2 Emu32A output + * 0x03, 0x10-0x1f: 16 inputs from Alice2 Emu32B output + * 0x04, 0x00-0x07: Hana ADAT + * 0x05, 0x00: Hana S/PDIF Left + * 0x05, 0x01: Hana S/PDIF Right + * 0x06-0x07: Not used + * + * Hana2 never released, but used Tina + * Not needed. + * + * Hana3, rev2 1010,1212,1616 using Tina + * Sources SRATEX = 1X rates: 44.1 kHz or 48 kHz + * 0x00,0x00-0x1f: Silence + * 0x01, 0x10-0x1f: 32 Elink channels from Audio Dock + * 0x01, 0x00: Dock Mic A + * 0x01, 0x04: Dock Mic B + * 0x01, 0x08: Dock ADC 1 Left + * 0x01, 0x0c: Dock ADC 1 Right + * 0x01, 0x10: Dock ADC 2 Left + * 0x01, 0x12: Dock S/PDIF Left + * 0x01, 0x14: Dock ADC 2 Right + * 0x01, 0x16: Dock S/PDIF Right + * 0x01, 0x18-0x1f: Dock ADAT 0-7 + * 0x01, 0x18: Dock ADC 3 Left + * 0x01, 0x1c: Dock ADC 3 Right + * 0x02, 0x00: Hanoa ADC Left + * 0x02, 0x01: Hanoa ADC Right + * 0x03, 0x00-0x0f: 16 inputs from Tina Emu32A output + * 0x03, 0x10-0x1f: 16 inputs from Tina Emu32B output + * 0x04, 0x00-0x07: Hana3 ADAT + * 0x05, 0x00: Hana3 S/PDIF Left + * 0x05, 0x01: Hana3 S/PDIF Right + * 0x06-0x07: Not used + * + * HanaLite, rev1 0404 using Alice2 + * Sources SRATEX = 1X rates: 44.1 kHz or 48 kHz + * 0x00,0x00-0x1f: Silence + * 0x01: Not used + * 0x02, 0x00: ADC Left + * 0x02, 0x01: ADC Right + * 0x03, 0x00-0x0f: 16 inputs from Alice2 Emu32A output + * 0x03, 0x10-0x1f: 16 inputs from Alice2 Emu32B output + * 0x04: Not used + * 0x05, 0x00: S/PDIF Left + * 0x05, 0x01: S/PDIF Right + * 0x06-0x07: Not used + * + * HanaLiteLite, rev2 0404 using Alice2 + * Sources SRATEX = 1X rates: 44.1 kHz or 48 kHz + * 0x00,0x00-0x1f: Silence + * 0x01: Not used + * 0x02, 0x00: ADC Left + * 0x02, 0x01: ADC Right + * 0x03, 0x00-0x0f: 16 inputs from Alice2 Emu32A output + * 0x03, 0x10-0x1f: 16 inputs from Alice2 Emu32B output + * 0x04: Not used + * 0x05, 0x00: S/PDIF Left + * 0x05, 0x01: S/PDIF Right + * 0x06-0x07: Not used + * + * Mana, Cardbus 1616 using Tina2 + * Sources SRATEX = 1X rates: 44.1 kHz or 48 kHz + * 0x00,0x00-0x1f: Silence + * 0x01, 0x10-0x1f: 32 Elink channels from Audio Dock + * 0x01, 0x00: Dock Mic A + * 0x01, 0x04: Dock Mic B + * 0x01, 0x08: Dock ADC 1 Left + * 0x01, 0x0c: Dock ADC 1 Right + * 0x01, 0x10: Dock ADC 2 Left + * 0x01, 0x12: Dock S/PDIF Left + * 0x01, 0x14: Dock ADC 2 Right + * 0x01, 0x16: Dock S/PDIF Right + * 0x01, 0x18-0x1f: Dock ADAT 0-7 + * 0x01, 0x18: Dock ADC 3 Left + * 0x01, 0x1c: Dock ADC 3 Right + * 0x02: Not used + * 0x03, 0x00-0x0f: 16 inputs from Tina Emu32A output + * 0x03, 0x10-0x1f: 16 inputs from Tina Emu32B output + * 0x04-0x07: Not used + * + */ + /* 32-bit sources of signal in the Hana FPGA. The sources are routed to * destinations using mixer control for each destination - see emumixer.c * Sources are either physical inputs of FPGA, -- cgit v1.2.3 From 190d2c46e52592ba092e8bf8acd4427c920f2d69 Mon Sep 17 00:00:00 2001 From: James Courtier-Dutton Date: Sun, 4 Nov 2007 14:08:26 +0000 Subject: [ALSA] snd:emu10k1: E-Mu updates. Fixes to firmware loading and support for 0404. Signed-off-by: James Courtier-Dutton Signed-off-by: Jaroslav Kysela --- include/sound/emu10k1.h | 2 +- sound/pci/emu10k1/emu10k1_main.c | 130 +++++++++++++++++++++++---------------- sound/pci/emu10k1/emufx.c | 6 +- sound/pci/emu10k1/emumixer.c | 4 +- sound/pci/emu10k1/emupcm.c | 8 +-- sound/pci/emu10k1/emuproc.c | 4 +- sound/pci/emu10k1/io.c | 7 +++ 7 files changed, 97 insertions(+), 64 deletions(-) (limited to 'include') diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h index fb66a949c2fb..8a0c3c1ef80d 100644 --- a/include/sound/emu10k1.h +++ b/include/sound/emu10k1.h @@ -1628,7 +1628,7 @@ struct snd_emu_chip_details { unsigned char spdif_bug; /* Has Spdif phasing bug */ unsigned char ac97_chip; /* Has an AC97 chip: 1 = mandatory, 2 = optional */ unsigned char ecard; /* APS EEPROM */ - unsigned char emu1010; /* EMU 1010m card */ + unsigned char emu_model; /* EMU model type */ unsigned char spi_dac; /* SPI interface for DAC */ unsigned char i2c_adc; /* I2C interface for ADC */ unsigned char adc_1361t; /* Use Philips 1361T ADC */ diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index 69f342ce9b2a..da660676680e 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c @@ -54,12 +54,14 @@ #define DOCK_FILENAME "emu/audio_dock.fw" #define EMU1010B_FILENAME "emu/emu1010b.fw" #define MICRO_DOCK_FILENAME "emu/micro_dock.fw" +#define EMU0404_FILENAME "emu/emu0404.fw" #define EMU1010_NOTEBOOK_FILENAME "emu/emu1010_notebook.fw" MODULE_FIRMWARE(HANA_FILENAME); MODULE_FIRMWARE(DOCK_FILENAME); MODULE_FIRMWARE(EMU1010B_FILENAME); MODULE_FIRMWARE(MICRO_DOCK_FILENAME); +MODULE_FIRMWARE(EMU0404_FILENAME); MODULE_FIRMWARE(EMU1010_NOTEBOOK_FILENAME); @@ -287,7 +289,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) snd_emu10k1_ptr_write(emu, MAPB, ch, silent_page); } - if (emu->card_capabilities->emu1010) { + if (emu->card_capabilities->emu_model) { outl(HCFG_AUTOMUTE_ASYNC | HCFG_EMU32_SLAVE | HCFG_AUDIOENABLE, emu->port + HCFG); @@ -317,7 +319,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) outl(HCFG_LOCKTANKCACHE_MASK | HCFG_AUTOMUTE | HCFG_JOYENABLE, emu->port + HCFG); if (enable_ir) { /* enable IR for SB Live */ - if (emu->card_capabilities->emu1010) { + if (emu->card_capabilities->emu_model) { ; /* Disable all access to A_IOCFG for the emu1010 */ } else if (emu->card_capabilities->i2c_adc) { ; /* Disable A_IOCFG for Audigy 2 ZS Notebook */ @@ -338,7 +340,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) } } - if (emu->card_capabilities->emu1010) { + if (emu->card_capabilities->emu_model) { ; /* Disable all access to A_IOCFG for the emu1010 */ } else if (emu->card_capabilities->i2c_adc) { ; /* Disable A_IOCFG for Audigy 2 ZS Notebook */ @@ -358,7 +360,7 @@ static void snd_emu10k1_audio_enable(struct snd_emu10k1 *emu) outl(inl(emu->port + HCFG) | HCFG_AUDIOENABLE, emu->port + HCFG); /* Enable analog/digital outs on audigy */ - if (emu->card_capabilities->emu1010) { + if (emu->card_capabilities->emu_model) { ; /* Disable all access to A_IOCFG for the emu1010 */ } else if (emu->card_capabilities->i2c_adc) { ; /* Disable A_IOCFG for Audigy 2 ZS Notebook */ @@ -660,6 +662,8 @@ static int snd_emu1010_load_firmware(struct snd_emu10k1 * emu, const char * file int n, i; int reg; int value; + unsigned int write_post; + unsigned long flags; const struct firmware *fw_entry; if ((err = request_firmware(&fw_entry, filename, &emu->pci->dev)) != 0) { @@ -667,12 +671,6 @@ static int snd_emu1010_load_firmware(struct snd_emu10k1 * emu, const char * file return err; } snd_printk(KERN_INFO "firmware size=0x%zx\n", fw_entry->size); -#if 0 - if (fw_entry->size != 0x133a4) { - snd_printk(KERN_ERR "firmware: %s wrong size.\n",filename); - return -EINVAL; - } -#endif /* The FPGA is a Xilinx Spartan IIE XC2S50E */ /* GPIO7 -> FPGA PGMN @@ -680,9 +678,12 @@ static int snd_emu1010_load_firmware(struct snd_emu10k1 * emu, const char * file * GPIO5 -> FPGA DIN * FPGA CONFIG OFF -> FPGA PGMN */ + spin_lock_irqsave(&emu->emu_lock, flags); outl(0x00, emu->port + A_IOCFG); /* Set PGMN low for 1uS. */ - udelay(1); + write_post = inl(emu->port + A_IOCFG); + udelay(100); outl(0x80, emu->port + A_IOCFG); /* Leave bit 7 set during netlist setup. */ + write_post = inl(emu->port + A_IOCFG); udelay(100); /* Allow FPGA memory to clean */ for(n = 0; n < fw_entry->size; n++) { value=fw_entry->data[n]; @@ -692,12 +693,15 @@ static int snd_emu1010_load_firmware(struct snd_emu10k1 * emu, const char * file reg = reg | 0x20; value = value >> 1; outl(reg, emu->port + A_IOCFG); + write_post = inl(emu->port + A_IOCFG); outl(reg | 0x40, emu->port + A_IOCFG); + write_post = inl(emu->port + A_IOCFG); } } /* After programming, set GPIO bit 4 high again. */ outl(0x10, emu->port + A_IOCFG); - + write_post = inl(emu->port + A_IOCFG); + spin_unlock_irqrestore(&emu->emu_lock, flags); release_firmware(fw_entry); return 0; @@ -711,7 +715,7 @@ int emu1010_firmware_thread(void *data) { for (;;) { /* Delay to allow Audio Dock to settle */ - msleep(1000); + msleep_interruptible(1000); if (kthread_should_stop()) break; snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &tmp ); /* IRQ Status */ @@ -721,17 +725,17 @@ int emu1010_firmware_thread(void *data) { /* Return to Audio Dock programming mode */ snd_printk(KERN_INFO "emu1010: Loading Audio Dock Firmware\n"); snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, EMU_HANA_FPGA_CONFIG_AUDIODOCK ); - if (emu->card_capabilities->emu1010 == 1) { + if (emu->card_capabilities->emu_model == 1) { if ((err = snd_emu1010_load_firmware(emu, DOCK_FILENAME)) != 0) { - return err; + continue; } - } else if (emu->card_capabilities->emu1010 == 2) { + } else if (emu->card_capabilities->emu_model == 2) { if ((err = snd_emu1010_load_firmware(emu, MICRO_DOCK_FILENAME)) != 0) { - return err; + continue; } - } else if (emu->card_capabilities->emu1010 == 3) { + } else if (emu->card_capabilities->emu_model == 3) { if ((err = snd_emu1010_load_firmware(emu, MICRO_DOCK_FILENAME)) != 0) { - return err; + continue; } } @@ -744,8 +748,7 @@ int emu1010_firmware_thread(void *data) { if ((reg & 0x1f) != 0x15) { /* FPGA failed to be programmed */ snd_printk(KERN_INFO "emu1010: Loading Audio Dock Firmware file failed, reg=0x%x\n", reg); - return 0; - return -ENODEV; + continue; } snd_printk(KERN_INFO "emu1010: Audio Dock Firmware loaded\n"); snd_emu1010_fpga_read(emu, EMU_DOCK_MAJOR_REV, &tmp ); @@ -756,9 +759,9 @@ int emu1010_firmware_thread(void *data) { msleep(10); /* Unmute all. Default is muted after a firmware load */ snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE ); - break; } } + snd_printk(KERN_INFO "emu1010: firmware thread stopping\n"); return 0; } @@ -799,6 +802,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) int tmp,tmp2; int reg; int err; + const char *filename = NULL; snd_printk(KERN_INFO "emu1010: Special config.\n"); /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave, @@ -840,21 +844,31 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) return -ENODEV; } snd_printk(KERN_INFO "emu1010: EMU_HANA_ID=0x%x\n",reg); - if (emu->card_capabilities->emu1010 == 1) { - if ((err = snd_emu1010_load_firmware(emu, HANA_FILENAME)) != 0) { - snd_printk(KERN_INFO "emu1010: Loading Hana Firmware file %s failed\n", HANA_FILENAME); - return err; - } - } else if (emu->card_capabilities->emu1010 == 2) { - if ((err = snd_emu1010_load_firmware(emu, EMU1010B_FILENAME)) != 0) { - snd_printk(KERN_INFO "emu1010: Loading Firmware file %s failed\n", EMU1010B_FILENAME); - return err; - } - } else if (emu->card_capabilities->emu1010 == 3) { - if ((err = snd_emu1010_load_firmware(emu, EMU1010_NOTEBOOK_FILENAME)) != 0) { - snd_printk(KERN_INFO "emu1010: Loading Firmware file %s failed\n", EMU1010_NOTEBOOK_FILENAME); - return err; - } + switch (emu->card_capabilities->emu_model) { + case 1: + filename = HANA_FILENAME; + break; + case 2: + filename = EMU1010B_FILENAME; + break; + case 3: + filename = EMU1010_NOTEBOOK_FILENAME; + break; + case 4: + filename = EMU0404_FILENAME; + break; + default: + filename = NULL; + return -ENODEV; + break; + } + snd_printk(KERN_INFO "emu1010: filename %s testing\n", filename); + err = snd_emu1010_load_firmware(emu, filename); + if (err != 0) { + snd_printk( + KERN_INFO "emu1010: Loading Firmware file %s failed\n", + filename); + return err; } /* ID, should read & 0x7f = 0x55 when FPGA programmed. */ @@ -1201,11 +1215,12 @@ static int snd_emu10k1_free(struct snd_emu10k1 *emu) } snd_emu10k1_free_efx(emu); } - if (emu->card_capabilities->emu1010) { + if (emu->card_capabilities->emu_model == 1) { /* Disable 48Volt power to Audio Dock */ snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, 0 ); - kthread_stop(emu->emu1010.firmware_thread); } + if (emu->card_capabilities->emu_model) + kthread_stop(emu->emu1010.firmware_thread); if (emu->memhdr) snd_util_memhdr_free(emu->memhdr); if (emu->silent_page.area) @@ -1337,6 +1352,15 @@ static struct snd_emu_chip_details emu_chip_details[] = { .spi_dac = 1, .i2c_adc = 1, .spk71 = 1} , + /* Tested by James@superbug.co.uk 20-3-2007. */ + {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x40021102, + .driver = "Audigy2", .name = "E-mu 0404 [4002]", + .id = "EMU0404", + .emu10k2_chip = 1, + .ca0102_chip = 1, + .spk71 = 1, + .emu_model = 4} , /* EMU 0404 */ + /* Tested by James@superbug.co.uk 4th Nov 2007. */ {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x42011102, .driver = "Audigy2", .name = "E-mu 1010 Notebook [MAEM8950]", .id = "EMU1010", @@ -1344,28 +1368,30 @@ static struct snd_emu_chip_details emu_chip_details[] = { .ca0108_chip = 1, .ca_cardbus_chip = 1, .spk71 = 1 , - .emu1010 = 3} , + .emu_model = 3} , + /* Tested by James@superbug.co.uk 4th Nov 2007. */ {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x40041102, .driver = "Audigy2", .name = "E-mu 1010b PCI [MAEM????]", .id = "EMU1010", .emu10k2_chip = 1, .ca0108_chip = 1, - .spk71 = 1 , - .emu1010 = 2} , + .spk71 = 1, + .emu_model = 2} , + /* Tested by James@superbug.co.uk 8th July 2005. */ + {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x40011102, + .driver = "Audigy2", .name = "E-mu 1010 [4001]", + .id = "EMU1010", + .emu10k2_chip = 1, + .ca0102_chip = 1, + .spk71 = 1, + .emu_model = 1} , /* Emu 1010 */ + /* Audigy4 (Not PRO) SB0610 */ {.vendor = 0x1102, .device = 0x0008, .driver = "Audigy2", .name = "Audigy 2 Value [Unknown]", .id = "Audigy2", .emu10k2_chip = 1, .ca0108_chip = 1, .ac97_chip = 1} , - /* Tested by James@superbug.co.uk 8th July 2005. No sound available yet. */ - {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x40011102, - .driver = "Audigy2", .name = "E-mu 1010 [4001]", - .id = "EMU1010", - .emu10k2_chip = 1, - .ca0102_chip = 1, - .spk71 = 1, - .emu1010 = 1} , /* Tested by James@superbug.co.uk 3rd July 2005 */ {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20071102, .driver = "Audigy2", .name = "Audigy 4 PRO [SB0380]", @@ -1793,7 +1819,7 @@ int __devinit snd_emu10k1_create(struct snd_card *card, if (emu->card_capabilities->ecard) { if ((err = snd_emu10k1_ecard_init(emu)) < 0) goto error; - } else if (emu->card_capabilities->emu1010) { + } else if (emu->card_capabilities->emu_model) { if ((err = snd_emu10k1_emu1010_init(emu)) < 0) { snd_emu10k1_free(emu); return err; @@ -1942,7 +1968,7 @@ void snd_emu10k1_resume_init(struct snd_emu10k1 *emu) snd_emu10k1_cardbus_init(emu); if (emu->card_capabilities->ecard) snd_emu10k1_ecard_init(emu); - else if (emu->card_capabilities->emu1010) + else if (emu->card_capabilities->emu_model) snd_emu10k1_emu1010_init(emu); else snd_emu10k1_ptr_write(emu, AC97SLOT, 0, AC97SLOT_CNTR|AC97SLOT_LFE); diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c index 354a892adb40..71dc4c8865b8 100644 --- a/sound/pci/emu10k1/emufx.c +++ b/sound/pci/emu10k1/emufx.c @@ -1261,7 +1261,7 @@ static int __devinit _snd_emu10k1_audigy_init_efx(struct snd_emu10k1 *emu) A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input)) /* emu1212 DSP 0 and DSP 1 Capture */ - if (emu->card_capabilities->emu1010) { + if (emu->card_capabilities->emu_model) { if (emu->card_capabilities->ca0108_chip) { /* Note:JCD:No longer bit shift lower 16bits to upper 16bits of 32bit value. */ A_OP(icode, &ptr, iMACINT0, A_GPR(tmp), A_C_00000000, A3_EMU32IN(0x0), A_C_00000001); @@ -1515,7 +1515,7 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input)) /* digital outputs */ /* A_PUT_STEREO_OUTPUT(A_EXTOUT_FRONT_L, A_EXTOUT_FRONT_R, playback + SND_EMU10K1_PLAYBACK_CHANNELS); */ - if (emu->card_capabilities->emu1010) { + if (emu->card_capabilities->emu_model) { /* EMU1010 Outputs from PCM Front, Rear, Center, LFE, Side */ snd_printk("EMU outputs on\n"); for (z = 0; z < 8; z++) { @@ -1563,7 +1563,7 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input)) A_PUT_OUTPUT(A_EXTOUT_ADC_CAP_R, capture+1); #endif - if (emu->card_capabilities->emu1010) { + if (emu->card_capabilities->emu_model) { if (emu->card_capabilities->ca0108_chip) { snd_printk("EMU2 inputs on\n"); for (z = 0; z < 0x10; z++) { diff --git a/sound/pci/emu10k1/emumixer.c b/sound/pci/emu10k1/emumixer.c index 5a38fe71e52f..83acfa6e9317 100644 --- a/sound/pci/emu10k1/emumixer.c +++ b/sound/pci/emu10k1/emumixer.c @@ -1792,7 +1792,7 @@ int __devinit snd_emu10k1_mixer(struct snd_emu10k1 *emu, return err; } - if ( emu->card_capabilities->emu1010) { + if (emu->card_capabilities->emu_model) { ; /* Disable the snd_audigy_spdif_shared_spdif */ } else if (emu->audigy) { if ((kctl = snd_ctl_new1(&snd_audigy_shared_spdif, emu)) == NULL) @@ -1817,7 +1817,7 @@ int __devinit snd_emu10k1_mixer(struct snd_emu10k1 *emu, return err; } - if ( emu->card_capabilities->emu1010) { + if (emu->card_capabilities->emu_model) { int i; for (i = 0; i < ARRAY_SIZE(snd_emu1010_output_enum_ctls); i++) { diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c index cf4e3ec6530e..cf9276ddad42 100644 --- a/sound/pci/emu10k1/emupcm.c +++ b/sound/pci/emu10k1/emupcm.c @@ -357,7 +357,7 @@ static void snd_emu10k1_pcm_init_voice(struct snd_emu10k1 *emu, snd_emu10k1_ptr_write(emu, PTRX, voice, (send_amount[0] << 8) | send_amount[1]); snd_emu10k1_ptr_write(emu, DSL, voice, end_addr | (send_amount[3] << 24)); snd_emu10k1_ptr_write(emu, PSST, voice, start_addr | (send_amount[2] << 24)); - if (emu->card_capabilities->emu1010) + if (emu->card_capabilities->emu_model) pitch_target = PITCH_48000; /* Disable interpolators on emu1010 card */ else pitch_target = emu10k1_calc_pitch_target(runtime->rate); @@ -700,7 +700,7 @@ static void snd_emu10k1_playback_trigger_voice(struct snd_emu10k1 *emu, struct s voice = evoice->number; pitch = snd_emu10k1_rate_to_pitch(runtime->rate) >> 8; - if (emu->card_capabilities->emu1010) + if (emu->card_capabilities->emu_model) pitch_target = PITCH_48000; /* Disable interpolators on emu1010 card */ else pitch_target = emu10k1_calc_pitch_target(runtime->rate); @@ -1231,7 +1231,7 @@ static int snd_emu10k1_capture_efx_open(struct snd_pcm_substream *substream) runtime->hw.rates = SNDRV_PCM_RATE_48000; runtime->hw.rate_min = runtime->hw.rate_max = 48000; spin_lock_irq(&emu->reg_lock); - if (emu->card_capabilities->emu1010) { + if (emu->card_capabilities->emu_model) { /* Nb. of channels has been increased to 16 */ /* TODO * SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE @@ -1790,7 +1790,7 @@ int __devinit snd_emu10k1_pcm_efx(struct snd_emu10k1 * emu, int device, struct s /* emu->efx_voices_mask[0] = FXWC_DEFAULTROUTE_C | FXWC_DEFAULTROUTE_A; */ if (emu->audigy) { emu->efx_voices_mask[0] = 0; - if (emu->card_capabilities->emu1010) + if (emu->card_capabilities->emu_model) /* Pavel Hofman - 32 voices will be used for * capture (write mode) - * each bit = corresponding voice diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c index bd8a47116528..f3caa3f890c6 100644 --- a/sound/pci/emu10k1/emuproc.c +++ b/sound/pci/emu10k1/emuproc.c @@ -244,7 +244,7 @@ static void snd_emu10k1_proc_spdif_read(struct snd_info_entry *entry, unsigned long flags; u32 rate; - if (emu->card_capabilities->emu1010) { + if (emu->card_capabilities->emu_model) { spin_lock_irqsave(&emu->emu_lock, flags); snd_emu1010_fpga_read(emu, 0x38, &value); spin_unlock_irqrestore(&emu->emu_lock, flags); @@ -584,7 +584,7 @@ int __devinit snd_emu10k1_proc_init(struct snd_emu10k1 * emu) { struct snd_info_entry *entry; #ifdef CONFIG_SND_DEBUG - if (emu->card_capabilities->emu1010) { + if (emu->card_capabilities->emu_model) { if (! snd_card_proc_new(emu->card, "emu1010_regs", &entry)) snd_info_set_text_ops(entry, emu, snd_emu_proc_emu1010_reg_read); } diff --git a/sound/pci/emu10k1/io.c b/sound/pci/emu10k1/io.c index 2862e17446fe..a02638350a0a 100644 --- a/sound/pci/emu10k1/io.c +++ b/sound/pci/emu10k1/io.c @@ -227,11 +227,14 @@ int snd_emu10k1_i2c_write(struct snd_emu10k1 *emu, int snd_emu1010_fpga_write(struct snd_emu10k1 * emu, u32 reg, u32 value) { + unsigned long flags; + if (reg > 0x3f) return 1; reg += 0x40; /* 0x40 upwards are registers. */ if (value < 0 || value > 0x3f) /* 0 to 0x3f are values */ return 1; + spin_lock_irqsave(&emu->emu_lock, flags); outl(reg, emu->port + A_IOCFG); udelay(10); outl(reg | 0x80, emu->port + A_IOCFG); /* High bit clocks the value into the fpga. */ @@ -239,20 +242,24 @@ int snd_emu1010_fpga_write(struct snd_emu10k1 * emu, u32 reg, u32 value) outl(value, emu->port + A_IOCFG); udelay(10); outl(value | 0x80 , emu->port + A_IOCFG); /* High bit clocks the value into the fpga. */ + spin_unlock_irqrestore(&emu->emu_lock, flags); return 0; } int snd_emu1010_fpga_read(struct snd_emu10k1 * emu, u32 reg, u32 *value) { + unsigned long flags; if (reg > 0x3f) return 1; reg += 0x40; /* 0x40 upwards are registers. */ + spin_lock_irqsave(&emu->emu_lock, flags); outl(reg, emu->port + A_IOCFG); udelay(10); outl(reg | 0x80, emu->port + A_IOCFG); /* High bit clocks the value into the fpga. */ udelay(10); *value = ((inl(emu->port + A_IOCFG) >> 8) & 0x7f); + spin_unlock_irqrestore(&emu->emu_lock, flags); return 0; } -- cgit v1.2.3 From 1c02e36681ae20a796204e8d629d13fa9d5e20b5 Mon Sep 17 00:00:00 2001 From: Ctirad Fertr Date: Thu, 13 Dec 2007 16:27:13 +0100 Subject: [ALSA] emu10k1 - 1616(M) cardbus improvements This patch improves E-Mu 1616(M) cardbus support. It adds definitions of the new Microdock and 1010 cardbus registers (thanks again for descriptions James) and improves mixer for this card. Now you can use S/PDIF and ADAT on Mirodock and also use headpohone output on host cardbus card as another independent output. Signed-off-by: Ctirad Fertr Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- include/sound/emu10k1.h | 30 +++++ sound/pci/emu10k1/emu10k1_main.c | 181 +++++++++++++++----------- sound/pci/emu10k1/emumixer.c | 269 +++++++++++++++++++++++++++++++++++---- 3 files changed, 381 insertions(+), 99 deletions(-) (limited to 'include') diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h index 8a0c3c1ef80d..4474b4e15f7c 100644 --- a/include/sound/emu10k1.h +++ b/include/sound/emu10k1.h @@ -1299,6 +1299,23 @@ #define EMU_DST_ALICE_I2S2_LEFT 0x0700 /* Alice2 I2S2 Left */ #define EMU_DST_ALICE_I2S2_RIGHT 0x0701 /* Alice2 I2S2 Right */ +/* Additional destinations for 1616(M)/Microdock */ +/* Microdock S/PDIF OUT Left, 1st or 48kHz only */ +#define EMU_DST_MDOCK_SPDIF_LEFT1 0x0112 +/* Microdock S/PDIF OUT Left, 2nd or 96kHz */ +#define EMU_DST_MDOCK_SPDIF_LEFT2 0x0113 +/* Microdock S/PDIF OUT Right, 1st or 48kHz only */ +#define EMU_DST_MDOCK_SPDIF_RIGHT1 0x0116 +/* Microdock S/PDIF OUT Right, 2nd or 96kHz */ +#define EMU_DST_MDOCK_SPDIF_RIGHT2 0x0117 +/* Microdock S/PDIF ADAT 8 channel out +8 to +f */ +#define EMU_DST_MDOCK_ADAT 0x0118 + +/* Headphone jack on 1010 cardbus? 44.1/48kHz only? */ +#define EMU_DST_MANA_DAC_LEFT 0x0300 +/* Headphone jack on 1010 cardbus? 44.1/48kHz only? */ +#define EMU_DST_MANA_DAC_RIGHT 0x0301 + /************************************************************************************************/ /* EMU1010m HANA Sources */ /************************************************************************************************/ @@ -1452,6 +1469,19 @@ #define EMU_SRC_HANA_SPDIF_LEFT2 0x0502 /* Hana SPDIF Left, 2nd or 96kHz */ #define EMU_SRC_HANA_SPDIF_RIGHT1 0x0501 /* Hana SPDIF Right, 1st or 48kHz only */ #define EMU_SRC_HANA_SPDIF_RIGHT2 0x0503 /* Hana SPDIF Right, 2nd or 96kHz */ + +/* Additional inputs for 1616(M)/Microdock */ +/* Microdock S/PDIF Left, 1st or 48kHz only */ +#define EMU_SRC_MDOCK_SPDIF_LEFT1 0x0112 +/* Microdock S/PDIF Left, 2nd or 96kHz */ +#define EMU_SRC_MDOCK_SPDIF_LEFT2 0x0113 +/* Microdock S/PDIF Right, 1st or 48kHz only */ +#define EMU_SRC_MDOCK_SPDIF_RIGHT1 0x0116 +/* Microdock S/PDIF Right, 2nd or 96kHz */ +#define EMU_SRC_MDOCK_SPDIF_RIGHT2 0x0117 +/* Microdock ADAT 8 channel in +8 to +f */ +#define EMU_SRC_MDOCK_ADAT 0x0118 + /* 0x600 and 0x700 no used */ /* ------------------- STRUCTURES -------------------- */ diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index da660676680e..54b978e74f58 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c @@ -1103,79 +1103,114 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) EMU_DST_HANA_SPDIF_RIGHT1, EMU_SRC_ALICE_EMU32A + 3); /* ALICE2 bus 0xb3 */ #endif /* Default outputs */ - snd_emu1010_fpga_link_dst_src_write(emu, - EMU_DST_DOCK_DAC1_LEFT1, EMU_SRC_ALICE_EMU32A + 0); /* ALICE2 bus 0xa0 */ - emu->emu1010.output_source[0] = 21; - snd_emu1010_fpga_link_dst_src_write(emu, - EMU_DST_DOCK_DAC1_RIGHT1, EMU_SRC_ALICE_EMU32A + 1); - emu->emu1010.output_source[1] = 22; - snd_emu1010_fpga_link_dst_src_write(emu, - EMU_DST_DOCK_DAC2_LEFT1, EMU_SRC_ALICE_EMU32A + 2); - emu->emu1010.output_source[2] = 23; - snd_emu1010_fpga_link_dst_src_write(emu, - EMU_DST_DOCK_DAC2_RIGHT1, EMU_SRC_ALICE_EMU32A + 3); - emu->emu1010.output_source[3] = 24; - snd_emu1010_fpga_link_dst_src_write(emu, - EMU_DST_DOCK_DAC3_LEFT1, EMU_SRC_ALICE_EMU32A + 4); - emu->emu1010.output_source[4] = 25; - snd_emu1010_fpga_link_dst_src_write(emu, - EMU_DST_DOCK_DAC3_RIGHT1, EMU_SRC_ALICE_EMU32A + 5); - emu->emu1010.output_source[5] = 26; - snd_emu1010_fpga_link_dst_src_write(emu, - EMU_DST_DOCK_DAC4_LEFT1, EMU_SRC_ALICE_EMU32A + 6); - emu->emu1010.output_source[6] = 27; - snd_emu1010_fpga_link_dst_src_write(emu, - EMU_DST_DOCK_DAC4_RIGHT1, EMU_SRC_ALICE_EMU32A + 7); - emu->emu1010.output_source[7] = 28; - snd_emu1010_fpga_link_dst_src_write(emu, - EMU_DST_DOCK_PHONES_LEFT1, EMU_SRC_ALICE_EMU32A + 0); /* ALICE2 bus 0xa0 */ - emu->emu1010.output_source[8] = 21; - snd_emu1010_fpga_link_dst_src_write(emu, - EMU_DST_DOCK_PHONES_RIGHT1, EMU_SRC_ALICE_EMU32A + 1); - emu->emu1010.output_source[9] = 22; - snd_emu1010_fpga_link_dst_src_write(emu, - EMU_DST_DOCK_SPDIF_LEFT1, EMU_SRC_ALICE_EMU32A + 0); /* ALICE2 bus 0xa0 */ - emu->emu1010.output_source[10] = 21; - snd_emu1010_fpga_link_dst_src_write(emu, - EMU_DST_DOCK_SPDIF_RIGHT1, EMU_SRC_ALICE_EMU32A + 1); - emu->emu1010.output_source[11] = 22; - snd_emu1010_fpga_link_dst_src_write(emu, - EMU_DST_HANA_SPDIF_LEFT1, EMU_SRC_ALICE_EMU32A + 0); /* ALICE2 bus 0xa0 */ - emu->emu1010.output_source[12] = 21; - snd_emu1010_fpga_link_dst_src_write(emu, - EMU_DST_HANA_SPDIF_RIGHT1, EMU_SRC_ALICE_EMU32A + 1); - emu->emu1010.output_source[13] = 22; - snd_emu1010_fpga_link_dst_src_write(emu, - EMU_DST_HAMOA_DAC_LEFT1, EMU_SRC_ALICE_EMU32A + 0); /* ALICE2 bus 0xa0 */ - emu->emu1010.output_source[14] = 21; - snd_emu1010_fpga_link_dst_src_write(emu, - EMU_DST_HAMOA_DAC_RIGHT1, EMU_SRC_ALICE_EMU32A + 1); - emu->emu1010.output_source[15] = 22; - snd_emu1010_fpga_link_dst_src_write(emu, - EMU_DST_HANA_ADAT, EMU_SRC_ALICE_EMU32A + 0); /* ALICE2 bus 0xa0 */ - emu->emu1010.output_source[16] = 21; - snd_emu1010_fpga_link_dst_src_write(emu, - EMU_DST_HANA_ADAT + 1, EMU_SRC_ALICE_EMU32A + 1); - emu->emu1010.output_source[17] = 22; - snd_emu1010_fpga_link_dst_src_write(emu, - EMU_DST_HANA_ADAT + 2, EMU_SRC_ALICE_EMU32A + 2); - emu->emu1010.output_source[18] = 23; - snd_emu1010_fpga_link_dst_src_write(emu, - EMU_DST_HANA_ADAT + 3, EMU_SRC_ALICE_EMU32A + 3); - emu->emu1010.output_source[19] = 24; - snd_emu1010_fpga_link_dst_src_write(emu, - EMU_DST_HANA_ADAT + 4, EMU_SRC_ALICE_EMU32A + 4); - emu->emu1010.output_source[20] = 25; - snd_emu1010_fpga_link_dst_src_write(emu, - EMU_DST_HANA_ADAT + 5, EMU_SRC_ALICE_EMU32A + 5); - emu->emu1010.output_source[21] = 26; - snd_emu1010_fpga_link_dst_src_write(emu, - EMU_DST_HANA_ADAT + 6, EMU_SRC_ALICE_EMU32A + 6); - emu->emu1010.output_source[22] = 27; - snd_emu1010_fpga_link_dst_src_write(emu, - EMU_DST_HANA_ADAT + 7, EMU_SRC_ALICE_EMU32A + 7); - emu->emu1010.output_source[23] = 28; - + if (emu->card_capabilities->emu_model == 3) { + /* 1616(M) cardbus default outputs */ + /* ALICE2 bus 0xa0 */ + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_DOCK_DAC1_LEFT1, EMU_SRC_ALICE_EMU32A + 0); + emu->emu1010.output_source[0] = 17; + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_DOCK_DAC1_RIGHT1, EMU_SRC_ALICE_EMU32A + 1); + emu->emu1010.output_source[1] = 18; + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_DOCK_DAC2_LEFT1, EMU_SRC_ALICE_EMU32A + 2); + emu->emu1010.output_source[2] = 19; + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_DOCK_DAC2_RIGHT1, EMU_SRC_ALICE_EMU32A + 3); + emu->emu1010.output_source[3] = 20; + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_DOCK_DAC3_LEFT1, EMU_SRC_ALICE_EMU32A + 4); + emu->emu1010.output_source[4] = 21; + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_DOCK_DAC3_RIGHT1, EMU_SRC_ALICE_EMU32A + 5); + emu->emu1010.output_source[5] = 22; + /* ALICE2 bus 0xa0 */ + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_MANA_DAC_LEFT, EMU_SRC_ALICE_EMU32A + 0); + emu->emu1010.output_source[16] = 17; + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_MANA_DAC_RIGHT, EMU_SRC_ALICE_EMU32A + 1); + emu->emu1010.output_source[17] = 18; + } else { + /* ALICE2 bus 0xa0 */ + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_DOCK_DAC1_LEFT1, EMU_SRC_ALICE_EMU32A + 0); + emu->emu1010.output_source[0] = 21; + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_DOCK_DAC1_RIGHT1, EMU_SRC_ALICE_EMU32A + 1); + emu->emu1010.output_source[1] = 22; + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_DOCK_DAC2_LEFT1, EMU_SRC_ALICE_EMU32A + 2); + emu->emu1010.output_source[2] = 23; + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_DOCK_DAC2_RIGHT1, EMU_SRC_ALICE_EMU32A + 3); + emu->emu1010.output_source[3] = 24; + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_DOCK_DAC3_LEFT1, EMU_SRC_ALICE_EMU32A + 4); + emu->emu1010.output_source[4] = 25; + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_DOCK_DAC3_RIGHT1, EMU_SRC_ALICE_EMU32A + 5); + emu->emu1010.output_source[5] = 26; + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_DOCK_DAC4_LEFT1, EMU_SRC_ALICE_EMU32A + 6); + emu->emu1010.output_source[6] = 27; + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_DOCK_DAC4_RIGHT1, EMU_SRC_ALICE_EMU32A + 7); + emu->emu1010.output_source[7] = 28; + /* ALICE2 bus 0xa0 */ + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_DOCK_PHONES_LEFT1, EMU_SRC_ALICE_EMU32A + 0); + emu->emu1010.output_source[8] = 21; + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_DOCK_PHONES_RIGHT1, EMU_SRC_ALICE_EMU32A + 1); + emu->emu1010.output_source[9] = 22; + /* ALICE2 bus 0xa0 */ + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_DOCK_SPDIF_LEFT1, EMU_SRC_ALICE_EMU32A + 0); + emu->emu1010.output_source[10] = 21; + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_DOCK_SPDIF_RIGHT1, EMU_SRC_ALICE_EMU32A + 1); + emu->emu1010.output_source[11] = 22; + /* ALICE2 bus 0xa0 */ + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_HANA_SPDIF_LEFT1, EMU_SRC_ALICE_EMU32A + 0); + emu->emu1010.output_source[12] = 21; + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_HANA_SPDIF_RIGHT1, EMU_SRC_ALICE_EMU32A + 1); + emu->emu1010.output_source[13] = 22; + /* ALICE2 bus 0xa0 */ + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_HAMOA_DAC_LEFT1, EMU_SRC_ALICE_EMU32A + 0); + emu->emu1010.output_source[14] = 21; + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_HAMOA_DAC_RIGHT1, EMU_SRC_ALICE_EMU32A + 1); + emu->emu1010.output_source[15] = 22; + /* ALICE2 bus 0xa0 */ + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_HANA_ADAT, EMU_SRC_ALICE_EMU32A + 0); + emu->emu1010.output_source[16] = 21; + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_HANA_ADAT + 1, EMU_SRC_ALICE_EMU32A + 1); + emu->emu1010.output_source[17] = 22; + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_HANA_ADAT + 2, EMU_SRC_ALICE_EMU32A + 2); + emu->emu1010.output_source[18] = 23; + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_HANA_ADAT + 3, EMU_SRC_ALICE_EMU32A + 3); + emu->emu1010.output_source[19] = 24; + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_HANA_ADAT + 4, EMU_SRC_ALICE_EMU32A + 4); + emu->emu1010.output_source[20] = 25; + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_HANA_ADAT + 5, EMU_SRC_ALICE_EMU32A + 5); + emu->emu1010.output_source[21] = 26; + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_HANA_ADAT + 6, EMU_SRC_ALICE_EMU32A + 6); + emu->emu1010.output_source[22] = 27; + snd_emu1010_fpga_link_dst_src_write(emu, + EMU_DST_HANA_ADAT + 7, EMU_SRC_ALICE_EMU32A + 7); + emu->emu1010.output_source[23] = 28; + } /* TEMP: Select SPDIF in/out */ //snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, 0x0); /* Output spdif */ diff --git a/sound/pci/emu10k1/emumixer.c b/sound/pci/emu10k1/emumixer.c index 83acfa6e9317..9b5883b79578 100644 --- a/sound/pci/emu10k1/emumixer.c +++ b/sound/pci/emu10k1/emumixer.c @@ -139,6 +139,61 @@ static char *emu1010_src_texts[] = { "DSP 31", }; +/* 1616(m) cardbus */ + +static char *emu1616_src_texts[] = { + "Silence", + "Dock Mic A", + "Dock Mic B", + "Dock ADC1 Left", + "Dock ADC1 Right", + "Dock ADC2 Left", + "Dock ADC2 Right", + "Dock SPDIF Left", + "Dock SPDIF Right", + "ADAT 0", + "ADAT 1", + "ADAT 2", + "ADAT 3", + "ADAT 4", + "ADAT 5", + "ADAT 6", + "ADAT 7", + "DSP 0", + "DSP 1", + "DSP 2", + "DSP 3", + "DSP 4", + "DSP 5", + "DSP 6", + "DSP 7", + "DSP 8", + "DSP 9", + "DSP 10", + "DSP 11", + "DSP 12", + "DSP 13", + "DSP 14", + "DSP 15", + "DSP 16", + "DSP 17", + "DSP 18", + "DSP 19", + "DSP 20", + "DSP 21", + "DSP 22", + "DSP 23", + "DSP 24", + "DSP 25", + "DSP 26", + "DSP 27", + "DSP 28", + "DSP 29", + "DSP 30", + "DSP 31", +}; + + /* * List of data sources available for each destination */ @@ -198,6 +253,59 @@ static unsigned int emu1010_src_regs[] = { EMU_SRC_ALICE_EMU32B+0xf, /* 52 */ }; +/* 1616(m) cardbus */ +static unsigned int emu1616_src_regs[] = { + EMU_SRC_SILENCE, + EMU_SRC_DOCK_MIC_A1, + EMU_SRC_DOCK_MIC_B1, + EMU_SRC_DOCK_ADC1_LEFT1, + EMU_SRC_DOCK_ADC1_RIGHT1, + EMU_SRC_DOCK_ADC2_LEFT1, + EMU_SRC_DOCK_ADC2_RIGHT1, + EMU_SRC_MDOCK_SPDIF_LEFT1, + EMU_SRC_MDOCK_SPDIF_RIGHT1, + EMU_SRC_MDOCK_ADAT, + EMU_SRC_MDOCK_ADAT+1, + EMU_SRC_MDOCK_ADAT+2, + EMU_SRC_MDOCK_ADAT+3, + EMU_SRC_MDOCK_ADAT+4, + EMU_SRC_MDOCK_ADAT+5, + EMU_SRC_MDOCK_ADAT+6, + EMU_SRC_MDOCK_ADAT+7, + EMU_SRC_ALICE_EMU32A, + EMU_SRC_ALICE_EMU32A+1, + EMU_SRC_ALICE_EMU32A+2, + EMU_SRC_ALICE_EMU32A+3, + EMU_SRC_ALICE_EMU32A+4, + EMU_SRC_ALICE_EMU32A+5, + EMU_SRC_ALICE_EMU32A+6, + EMU_SRC_ALICE_EMU32A+7, + EMU_SRC_ALICE_EMU32A+8, + EMU_SRC_ALICE_EMU32A+9, + EMU_SRC_ALICE_EMU32A+0xa, + EMU_SRC_ALICE_EMU32A+0xb, + EMU_SRC_ALICE_EMU32A+0xc, + EMU_SRC_ALICE_EMU32A+0xd, + EMU_SRC_ALICE_EMU32A+0xe, + EMU_SRC_ALICE_EMU32A+0xf, + EMU_SRC_ALICE_EMU32B, + EMU_SRC_ALICE_EMU32B+1, + EMU_SRC_ALICE_EMU32B+2, + EMU_SRC_ALICE_EMU32B+3, + EMU_SRC_ALICE_EMU32B+4, + EMU_SRC_ALICE_EMU32B+5, + EMU_SRC_ALICE_EMU32B+6, + EMU_SRC_ALICE_EMU32B+7, + EMU_SRC_ALICE_EMU32B+8, + EMU_SRC_ALICE_EMU32B+9, + EMU_SRC_ALICE_EMU32B+0xa, + EMU_SRC_ALICE_EMU32B+0xb, + EMU_SRC_ALICE_EMU32B+0xc, + EMU_SRC_ALICE_EMU32B+0xd, + EMU_SRC_ALICE_EMU32B+0xe, + EMU_SRC_ALICE_EMU32B+0xf, +}; + /* * Data destinations - physical EMU outputs. * Each destination has an enum mixer control to choose a data source @@ -229,6 +337,28 @@ static unsigned int emu1010_output_dst[] = { EMU_DST_HANA_ADAT+7, /* 23 */ }; +/* 1616(m) cardbus */ +static unsigned int emu1616_output_dst[] = { + EMU_DST_DOCK_DAC1_LEFT1, + EMU_DST_DOCK_DAC1_RIGHT1, + EMU_DST_DOCK_DAC2_LEFT1, + EMU_DST_DOCK_DAC2_RIGHT1, + EMU_DST_DOCK_DAC3_LEFT1, + EMU_DST_DOCK_DAC3_RIGHT1, + EMU_DST_MDOCK_SPDIF_LEFT1, + EMU_DST_MDOCK_SPDIF_RIGHT1, + EMU_DST_MDOCK_ADAT, + EMU_DST_MDOCK_ADAT+1, + EMU_DST_MDOCK_ADAT+2, + EMU_DST_MDOCK_ADAT+3, + EMU_DST_MDOCK_ADAT+4, + EMU_DST_MDOCK_ADAT+5, + EMU_DST_MDOCK_ADAT+6, + EMU_DST_MDOCK_ADAT+7, + EMU_DST_MANA_DAC_LEFT, + EMU_DST_MANA_DAC_RIGHT, +}; + /* * Data destinations - HANA outputs going to Alice2 (audigy) for * capture (EMU32 + I2S links) @@ -259,14 +389,26 @@ static unsigned int emu1010_input_dst[] = { EMU_DST_ALICE_I2S2_RIGHT, }; -static int snd_emu1010_input_output_source_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) +static int snd_emu1010_input_output_source_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { + struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); + char **items; + uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; uinfo->count = 1; - uinfo->value.enumerated.items = 53; + if (emu->card_capabilities->emu_model == 3) { /* 1616(m) cardbus */ + uinfo->value.enumerated.items = 49; + items = emu1616_src_texts; + } else { + uinfo->value.enumerated.items = 53; + items = emu1010_src_texts; + } if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) - uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; - strcpy(uinfo->value.enumerated.name, emu1010_src_texts[uinfo->value.enumerated.item]); + uinfo->value.enumerated.item = + uinfo->value.enumerated.items - 1; + strcpy(uinfo->value.enumerated.name, + items[uinfo->value.enumerated.item]); return 0; } @@ -278,7 +420,8 @@ static int snd_emu1010_output_source_get(struct snd_kcontrol *kcontrol, channel = (kcontrol->private_value) & 0xff; /* Limit: emu1010_output_dst, emu->emu1010.output_source */ - if (channel >= 24) + if (channel >= 24 || + (emu->card_capabilities->emu_model == 3 && channel >= 18)) return -EINVAL; ucontrol->value.enumerated.item[0] = emu->emu1010.output_source[channel]; return 0; @@ -288,24 +431,28 @@ static int snd_emu1010_output_source_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); - int change = 0; unsigned int val; unsigned int channel; val = ucontrol->value.enumerated.item[0]; - if (val >= 53) + if (val >= 53 || + (emu->card_capabilities->emu_model == 3 && val >= 49)) return -EINVAL; channel = (kcontrol->private_value) & 0xff; /* Limit: emu1010_output_dst, emu->emu1010.output_source */ - if (channel >= 24) + if (channel >= 24 || + (emu->card_capabilities->emu_model == 3 && channel >= 18)) return -EINVAL; - if (emu->emu1010.output_source[channel] != val) { - emu->emu1010.output_source[channel] = val; - change = 1; + if (emu->emu1010.output_source[channel] == val) + return 0; + emu->emu1010.output_source[channel] = val; + if (emu->card_capabilities->emu_model == 3) /* 1616(m) cardbus */ + snd_emu1010_fpga_link_dst_src_write(emu, + emu1616_output_dst[channel], emu1616_src_regs[val]); + else snd_emu1010_fpga_link_dst_src_write(emu, emu1010_output_dst[channel], emu1010_src_regs[val]); - } - return change; + return 1; } static int snd_emu1010_input_source_get(struct snd_kcontrol *kcontrol, @@ -326,24 +473,27 @@ static int snd_emu1010_input_source_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); - int change = 0; unsigned int val; unsigned int channel; val = ucontrol->value.enumerated.item[0]; - if (val >= 53) + if (val >= 53 || + (emu->card_capabilities->emu_model == 3 && val >= 49)) return -EINVAL; channel = (kcontrol->private_value) & 0xff; /* Limit: emu1010_input_dst, emu->emu1010.input_source */ if (channel >= 22) return -EINVAL; - if (emu->emu1010.input_source[channel] != val) { - emu->emu1010.input_source[channel] = val; - change = 1; + if (emu->emu1010.input_source[channel] == val) + return 0; + emu->emu1010.input_source[channel] = val; + if (emu->card_capabilities->emu_model == 3) /* 1616(m) cardbus */ + snd_emu1010_fpga_link_dst_src_write(emu, + emu1010_input_dst[channel], emu1616_src_regs[val]); + else snd_emu1010_fpga_link_dst_src_write(emu, emu1010_input_dst[channel], emu1010_src_regs[val]); - } - return change; + return 1; } #define EMU1010_SOURCE_OUTPUT(xname,chid) \ @@ -383,6 +533,30 @@ static struct snd_kcontrol_new snd_emu1010_output_enum_ctls[] __devinitdata = { EMU1010_SOURCE_OUTPUT("1010 ADAT 7 Playback Enum", 0x17), }; + +/* 1616(m) cardbus */ +static struct snd_kcontrol_new snd_emu1616_output_enum_ctls[] __devinitdata = { + EMU1010_SOURCE_OUTPUT("Dock DAC1 Left Playback Enum", 0), + EMU1010_SOURCE_OUTPUT("Dock DAC1 Right Playback Enum", 1), + EMU1010_SOURCE_OUTPUT("Dock DAC2 Left Playback Enum", 2), + EMU1010_SOURCE_OUTPUT("Dock DAC2 Right Playback Enum", 3), + EMU1010_SOURCE_OUTPUT("Dock DAC3 Left Playback Enum", 4), + EMU1010_SOURCE_OUTPUT("Dock DAC3 Right Playback Enum", 5), + EMU1010_SOURCE_OUTPUT("Dock SPDIF Left Playback Enum", 6), + EMU1010_SOURCE_OUTPUT("Dock SPDIF Right Playback Enum", 7), + EMU1010_SOURCE_OUTPUT("Dock ADAT 0 Playback Enum", 8), + EMU1010_SOURCE_OUTPUT("Dock ADAT 1 Playback Enum", 9), + EMU1010_SOURCE_OUTPUT("Dock ADAT 2 Playback Enum", 0xa), + EMU1010_SOURCE_OUTPUT("Dock ADAT 3 Playback Enum", 0xb), + EMU1010_SOURCE_OUTPUT("Dock ADAT 4 Playback Enum", 0xc), + EMU1010_SOURCE_OUTPUT("Dock ADAT 5 Playback Enum", 0xd), + EMU1010_SOURCE_OUTPUT("Dock ADAT 6 Playback Enum", 0xe), + EMU1010_SOURCE_OUTPUT("Dock ADAT 7 Playback Enum", 0xf), + EMU1010_SOURCE_OUTPUT("Mana DAC Left Playback Enum", 0x10), + EMU1010_SOURCE_OUTPUT("Mana DAC Right Playback Enum", 0x11), +}; + + #define EMU1010_SOURCE_INPUT(xname,chid) \ { \ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ @@ -1817,30 +1991,73 @@ int __devinit snd_emu10k1_mixer(struct snd_emu10k1 *emu, return err; } - if (emu->card_capabilities->emu_model) { + if (emu->card_capabilities->emu_model == 3) { + /* 1616(m) cardbus */ + int i; + + for (i = 0; i < ARRAY_SIZE(snd_emu1616_output_enum_ctls); i++) { + err = snd_ctl_add(card, + snd_ctl_new1(&snd_emu1616_output_enum_ctls[i], + emu)); + if (err < 0) + return err; + } + for (i = 0; i < ARRAY_SIZE(snd_emu1010_input_enum_ctls); i++) { + err = snd_ctl_add(card, + snd_ctl_new1(&snd_emu1010_input_enum_ctls[i], + emu)); + if (err < 0) + return err; + } + for (i = 0; i < ARRAY_SIZE(snd_emu1010_adc_pads) - 2; i++) { + err = snd_ctl_add(card, + snd_ctl_new1(&snd_emu1010_adc_pads[i], emu)); + if (err < 0) + return err; + } + for (i = 0; i < ARRAY_SIZE(snd_emu1010_dac_pads) - 2; i++) { + err = snd_ctl_add(card, + snd_ctl_new1(&snd_emu1010_dac_pads[i], emu)); + if (err < 0) + return err; + } + err = snd_ctl_add(card, + snd_ctl_new1(&snd_emu1010_internal_clock, emu)); + if (err < 0) + return err; + + } else { + /* all other e-mu cards for now */ int i; for (i = 0; i < ARRAY_SIZE(snd_emu1010_output_enum_ctls); i++) { - err = snd_ctl_add(card, snd_ctl_new1(&snd_emu1010_output_enum_ctls[i], emu)); + err = snd_ctl_add(card, + snd_ctl_new1(&snd_emu1010_output_enum_ctls[i], + emu)); if (err < 0) return err; } for (i = 0; i < ARRAY_SIZE(snd_emu1010_input_enum_ctls); i++) { - err = snd_ctl_add(card, snd_ctl_new1(&snd_emu1010_input_enum_ctls[i], emu)); + err = snd_ctl_add(card, + snd_ctl_new1(&snd_emu1010_input_enum_ctls[i], + emu)); if (err < 0) return err; } for (i = 0; i < ARRAY_SIZE(snd_emu1010_adc_pads); i++) { - err = snd_ctl_add(card, snd_ctl_new1(&snd_emu1010_adc_pads[i], emu)); + err = snd_ctl_add(card, + snd_ctl_new1(&snd_emu1010_adc_pads[i], emu)); if (err < 0) return err; } for (i = 0; i < ARRAY_SIZE(snd_emu1010_dac_pads); i++) { - err = snd_ctl_add(card, snd_ctl_new1(&snd_emu1010_dac_pads[i], emu)); + err = snd_ctl_add(card, + snd_ctl_new1(&snd_emu1010_dac_pads[i], emu)); if (err < 0) return err; } - err = snd_ctl_add(card, snd_ctl_new1(&snd_emu1010_internal_clock, emu)); + err = snd_ctl_add(card, + snd_ctl_new1(&snd_emu1010_internal_clock, emu)); if (err < 0) return err; } -- cgit v1.2.3 From 3839e4f136d6da3dc85d237aa9569ee94bfea763 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 21 Dec 2007 16:33:32 +0100 Subject: [ALSA] emu10k1 - Use enum for emu_model types Use enum instead of digits for emu_model types. Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- include/sound/emu10k1.h | 8 ++++++++ sound/pci/emu10k1/emu10k1_main.c | 29 ++++++++++++++++------------- sound/pci/emu10k1/emumixer.c | 20 ++++++++++++-------- 3 files changed, 36 insertions(+), 21 deletions(-) (limited to 'include') diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h index 4474b4e15f7c..494648dd7073 100644 --- a/include/sound/emu10k1.h +++ b/include/sound/emu10k1.h @@ -1642,6 +1642,14 @@ struct snd_emu10k1_midi { void (*interrupt)(struct snd_emu10k1 *emu, unsigned int status); }; +enum { + EMU_MODEL_SB, + EMU_MODEL_EMU1010, + EMU_MODEL_EMU1010B, + EMU_MODEL_EMU1616, + EMU_MODEL_EMU0404, +}; + struct snd_emu_chip_details { u32 vendor; u32 device; diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index 54b978e74f58..7e46325974a5 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c @@ -725,15 +725,18 @@ int emu1010_firmware_thread(void *data) { /* Return to Audio Dock programming mode */ snd_printk(KERN_INFO "emu1010: Loading Audio Dock Firmware\n"); snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, EMU_HANA_FPGA_CONFIG_AUDIODOCK ); - if (emu->card_capabilities->emu_model == 1) { + if (emu->card_capabilities->emu_model == + EMU_MODEL_EMU1010) { if ((err = snd_emu1010_load_firmware(emu, DOCK_FILENAME)) != 0) { continue; } - } else if (emu->card_capabilities->emu_model == 2) { + } else if (emu->card_capabilities->emu_model == + EMU_MODEL_EMU1010B) { if ((err = snd_emu1010_load_firmware(emu, MICRO_DOCK_FILENAME)) != 0) { continue; } - } else if (emu->card_capabilities->emu_model == 3) { + } else if (emu->card_capabilities->emu_model == + EMU_MODEL_EMU1616) { if ((err = snd_emu1010_load_firmware(emu, MICRO_DOCK_FILENAME)) != 0) { continue; } @@ -845,16 +848,16 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) } snd_printk(KERN_INFO "emu1010: EMU_HANA_ID=0x%x\n",reg); switch (emu->card_capabilities->emu_model) { - case 1: + case EMU_MODEL_EMU1010: filename = HANA_FILENAME; break; - case 2: + case EMU_MODEL_EMU1010B: filename = EMU1010B_FILENAME; break; - case 3: + case EMU_MODEL_EMU1616: filename = EMU1010_NOTEBOOK_FILENAME; break; - case 4: + case EMU_MODEL_EMU0404: filename = EMU0404_FILENAME; break; default: @@ -1103,7 +1106,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) EMU_DST_HANA_SPDIF_RIGHT1, EMU_SRC_ALICE_EMU32A + 3); /* ALICE2 bus 0xb3 */ #endif /* Default outputs */ - if (emu->card_capabilities->emu_model == 3) { + if (emu->card_capabilities->emu_model == EMU_MODEL_EMU1616) { /* 1616(M) cardbus default outputs */ /* ALICE2 bus 0xa0 */ snd_emu1010_fpga_link_dst_src_write(emu, @@ -1250,7 +1253,7 @@ static int snd_emu10k1_free(struct snd_emu10k1 *emu) } snd_emu10k1_free_efx(emu); } - if (emu->card_capabilities->emu_model == 1) { + if (emu->card_capabilities->emu_model == EMU_MODEL_EMU1010) { /* Disable 48Volt power to Audio Dock */ snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, 0 ); } @@ -1394,7 +1397,7 @@ static struct snd_emu_chip_details emu_chip_details[] = { .emu10k2_chip = 1, .ca0102_chip = 1, .spk71 = 1, - .emu_model = 4} , /* EMU 0404 */ + .emu_model = EMU_MODEL_EMU0404} , /* EMU 0404 */ /* Tested by James@superbug.co.uk 4th Nov 2007. */ {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x42011102, .driver = "Audigy2", .name = "E-mu 1010 Notebook [MAEM8950]", @@ -1403,7 +1406,7 @@ static struct snd_emu_chip_details emu_chip_details[] = { .ca0108_chip = 1, .ca_cardbus_chip = 1, .spk71 = 1 , - .emu_model = 3} , + .emu_model = EMU_MODEL_EMU1616}, /* Tested by James@superbug.co.uk 4th Nov 2007. */ {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x40041102, .driver = "Audigy2", .name = "E-mu 1010b PCI [MAEM????]", @@ -1411,7 +1414,7 @@ static struct snd_emu_chip_details emu_chip_details[] = { .emu10k2_chip = 1, .ca0108_chip = 1, .spk71 = 1, - .emu_model = 2} , + .emu_model = EMU_MODEL_EMU1010B}, /* Tested by James@superbug.co.uk 8th July 2005. */ {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x40011102, .driver = "Audigy2", .name = "E-mu 1010 [4001]", @@ -1419,7 +1422,7 @@ static struct snd_emu_chip_details emu_chip_details[] = { .emu10k2_chip = 1, .ca0102_chip = 1, .spk71 = 1, - .emu_model = 1} , /* Emu 1010 */ + .emu_model = EMU_MODEL_EMU1010} , /* Emu 1010 */ /* Audigy4 (Not PRO) SB0610 */ {.vendor = 0x1102, .device = 0x0008, .driver = "Audigy2", .name = "Audigy 2 Value [Unknown]", diff --git a/sound/pci/emu10k1/emumixer.c b/sound/pci/emu10k1/emumixer.c index 7ebf035b6b08..fd221209abcb 100644 --- a/sound/pci/emu10k1/emumixer.c +++ b/sound/pci/emu10k1/emumixer.c @@ -397,7 +397,7 @@ static int snd_emu1010_input_output_source_info(struct snd_kcontrol *kcontrol, uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; uinfo->count = 1; - if (emu->card_capabilities->emu_model == 3) { /* 1616(m) cardbus */ + if (emu->card_capabilities->emu_model == EMU_MODEL_EMU1616) { uinfo->value.enumerated.items = 49; items = emu1616_src_texts; } else { @@ -421,7 +421,8 @@ static int snd_emu1010_output_source_get(struct snd_kcontrol *kcontrol, channel = (kcontrol->private_value) & 0xff; /* Limit: emu1010_output_dst, emu->emu1010.output_source */ if (channel >= 24 || - (emu->card_capabilities->emu_model == 3 && channel >= 18)) + (emu->card_capabilities->emu_model == EMU_MODEL_EMU1616 && + channel >= 18)) return -EINVAL; ucontrol->value.enumerated.item[0] = emu->emu1010.output_source[channel]; return 0; @@ -436,17 +437,19 @@ static int snd_emu1010_output_source_put(struct snd_kcontrol *kcontrol, val = ucontrol->value.enumerated.item[0]; if (val >= 53 || - (emu->card_capabilities->emu_model == 3 && val >= 49)) + (emu->card_capabilities->emu_model == EMU_MODEL_EMU1616 && + val >= 49)) return -EINVAL; channel = (kcontrol->private_value) & 0xff; /* Limit: emu1010_output_dst, emu->emu1010.output_source */ if (channel >= 24 || - (emu->card_capabilities->emu_model == 3 && channel >= 18)) + (emu->card_capabilities->emu_model == EMU_MODEL_EMU1616 && + channel >= 18)) return -EINVAL; if (emu->emu1010.output_source[channel] == val) return 0; emu->emu1010.output_source[channel] = val; - if (emu->card_capabilities->emu_model == 3) /* 1616(m) cardbus */ + if (emu->card_capabilities->emu_model == EMU_MODEL_EMU1616) snd_emu1010_fpga_link_dst_src_write(emu, emu1616_output_dst[channel], emu1616_src_regs[val]); else @@ -478,7 +481,8 @@ static int snd_emu1010_input_source_put(struct snd_kcontrol *kcontrol, val = ucontrol->value.enumerated.item[0]; if (val >= 53 || - (emu->card_capabilities->emu_model == 3 && val >= 49)) + (emu->card_capabilities->emu_model == EMU_MODEL_EMU1616 && + val >= 49)) return -EINVAL; channel = (kcontrol->private_value) & 0xff; /* Limit: emu1010_input_dst, emu->emu1010.input_source */ @@ -487,7 +491,7 @@ static int snd_emu1010_input_source_put(struct snd_kcontrol *kcontrol, if (emu->emu1010.input_source[channel] == val) return 0; emu->emu1010.input_source[channel] = val; - if (emu->card_capabilities->emu_model == 3) /* 1616(m) cardbus */ + if (emu->card_capabilities->emu_model == EMU_MODEL_EMU1616) snd_emu1010_fpga_link_dst_src_write(emu, emu1010_input_dst[channel], emu1616_src_regs[val]); else @@ -1991,7 +1995,7 @@ int __devinit snd_emu10k1_mixer(struct snd_emu10k1 *emu, return err; } - if (emu->card_capabilities->emu_model == 3) { + if (emu->card_capabilities->emu_model == EMU_MODEL_EMU1616) { /* 1616(m) cardbus */ int i; -- cgit v1.2.3 From c94fa4c9168e51a8dab8e72cb9f0d89673fc8d8c Mon Sep 17 00:00:00 2001 From: James Courtier-Dutton Date: Sat, 10 Nov 2007 17:55:14 +0000 Subject: [ALSA] emu10k1: General cleanup, add new locks, fix alsa bug#3501, kernel bug#9304. Signed-off-by: James Courtier-Dutton Signed-off-by: Jaroslav Kysela --- include/sound/emu10k1.h | 2 ++ sound/pci/emu10k1/emu10k1_callback.c | 15 ++++++----- sound/pci/emu10k1/emu10k1_main.c | 6 +++-- sound/pci/emu10k1/emu10k1_synth.c | 45 ++++++++++++++++--------------- sound/pci/emu10k1/io.c | 52 +++++++++++++++++++++++++----------- sound/pci/emu10k1/irq.c | 8 ++++-- 6 files changed, 82 insertions(+), 46 deletions(-) (limited to 'include') diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h index 494648dd7073..7b7b9b13b4dd 100644 --- a/include/sound/emu10k1.h +++ b/include/sound/emu10k1.h @@ -1742,6 +1742,8 @@ struct snd_emu10k1 { spinlock_t reg_lock; spinlock_t emu_lock; spinlock_t voice_lock; + spinlock_t spi_lock; /* serialises access to spi port */ + spinlock_t i2c_lock; /* serialises access to i2c port */ struct snd_emu10k1_voice voices[NUM_G]; struct snd_emu10k1_voice p16v_voices[4]; diff --git a/sound/pci/emu10k1/emu10k1_callback.c b/sound/pci/emu10k1/emu10k1_callback.c index 01965bd99966..45088ebcce50 100644 --- a/sound/pci/emu10k1/emu10k1_callback.c +++ b/sound/pci/emu10k1/emu10k1_callback.c @@ -35,9 +35,9 @@ struct best_voice { /* * prototypes */ -static void lookup_voices(struct snd_emux *emu, struct snd_emu10k1 *hw, +static void lookup_voices(struct snd_emux *emux, struct snd_emu10k1 *hw, struct best_voice *best, int active_only); -static struct snd_emux_voice *get_voice(struct snd_emux *emu, +static struct snd_emux_voice *get_voice(struct snd_emux *emux, struct snd_emux_port *port); static int start_voice(struct snd_emux_voice *vp); static void trigger_voice(struct snd_emux_voice *vp); @@ -45,7 +45,6 @@ static void release_voice(struct snd_emux_voice *vp); static void update_voice(struct snd_emux_voice *vp, int update); static void terminate_voice(struct snd_emux_voice *vp); static void free_voice(struct snd_emux_voice *vp); - static void set_fmmod(struct snd_emu10k1 *hw, struct snd_emux_voice *vp); static void set_fm2frq2(struct snd_emu10k1 *hw, struct snd_emux_voice *vp); static void set_filterQ(struct snd_emu10k1 *hw, struct snd_emux_voice *vp); @@ -75,9 +74,9 @@ static struct snd_emux_operators emu10k1_ops = { }; void -snd_emu10k1_ops_setup(struct snd_emux *emu) +snd_emu10k1_ops_setup(struct snd_emux *emux) { - emu->ops = emu10k1_ops; + emux->ops = emu10k1_ops; } @@ -166,7 +165,11 @@ free_voice(struct snd_emux_voice *vp) struct snd_emu10k1 *hw; hw = vp->hw; - if (vp->ch >= 0) { + /* FIXME: emu10k1_synth is broken. */ + /* This can get called with hw == 0 */ + /* Problem apparent on plug, unplug then plug */ + /* on the Audigy 2 ZS Notebook. */ + if (hw && (vp->ch >= 0)) { snd_emu10k1_ptr_write(hw, IFATN, vp->ch, 0xff00); snd_emu10k1_ptr_write(hw, DCYSUSV, vp->ch, 0x807f | DCYSUSV_CHANNELENABLE_MASK); // snd_emu10k1_ptr_write(hw, DCYSUSV, vp->ch, 0); diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index 7e46325974a5..f29caf1afe06 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c @@ -259,7 +259,6 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) * GPIO7: Unknown */ outl(0x76, emu->port + A_IOCFG); /* Windows uses 0x3f76 */ - } if (emu->card_capabilities->i2c_adc) { /* Audigy 2 ZS Notebook with ADC Wolfson WM8775 */ int size, n; @@ -275,7 +274,6 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) emu->i2c_capture_volume[n][0]= 0xcf; emu->i2c_capture_volume[n][1]= 0xcf; } - } @@ -653,6 +651,8 @@ static int snd_emu10k1_cardbus_init(struct snd_emu10k1 * emu) value = inl(special_port); snd_emu10k1_ptr20_write(emu, TINA2_VOLUME, 0, 0xfefefefe); /* Defaults to 0x30303030 */ + /* Delay to give time for ADC chip to switch on. It needs 113ms */ + msleep(200); return 0; } @@ -1717,6 +1717,8 @@ int __devinit snd_emu10k1_create(struct snd_card *card, emu->card = card; spin_lock_init(&emu->reg_lock); spin_lock_init(&emu->emu_lock); + spin_lock_init(&emu->spi_lock); + spin_lock_init(&emu->i2c_lock); spin_lock_init(&emu->voice_lock); spin_lock_init(&emu->synth_lock); spin_lock_init(&emu->memblk_lock); diff --git a/sound/pci/emu10k1/emu10k1_synth.c b/sound/pci/emu10k1/emu10k1_synth.c index 204995a1dfbd..ad7b71491fc4 100644 --- a/sound/pci/emu10k1/emu10k1_synth.c +++ b/sound/pci/emu10k1/emu10k1_synth.c @@ -30,7 +30,7 @@ MODULE_LICENSE("GPL"); */ static int snd_emu10k1_synth_new_device(struct snd_seq_device *dev) { - struct snd_emux *emu; + struct snd_emux *emux; struct snd_emu10k1 *hw; struct snd_emu10k1_synth_arg *arg; unsigned long flags; @@ -46,53 +46,56 @@ static int snd_emu10k1_synth_new_device(struct snd_seq_device *dev) else if (arg->max_voices > 64) arg->max_voices = 64; - if (snd_emux_new(&emu) < 0) + if (snd_emux_new(&emux) < 0) return -ENOMEM; - snd_emu10k1_ops_setup(emu); - emu->hw = hw = arg->hwptr; - emu->max_voices = arg->max_voices; - emu->num_ports = arg->seq_ports; - emu->pitch_shift = -501; - emu->memhdr = hw->memhdr; - emu->midi_ports = arg->seq_ports < 2 ? arg->seq_ports : 2; /* maximum two ports */ - emu->midi_devidx = hw->audigy ? 2 : 1; /* audigy has two external midis */ - emu->linear_panning = 0; - emu->hwdep_idx = 2; /* FIXED */ - - if (snd_emux_register(emu, dev->card, arg->index, "Emu10k1") < 0) { - snd_emux_free(emu); + snd_emu10k1_ops_setup(emux); + hw = arg->hwptr; + emux->hw = hw; + emux->max_voices = arg->max_voices; + emux->num_ports = arg->seq_ports; + emux->pitch_shift = -501; + emux->memhdr = hw->memhdr; + /* maximum two ports */ + emux->midi_ports = arg->seq_ports < 2 ? arg->seq_ports : 2; + /* audigy has two external midis */ + emux->midi_devidx = hw->audigy ? 2 : 1; + emux->linear_panning = 0; + emux->hwdep_idx = 2; /* FIXED */ + + if (snd_emux_register(emux, dev->card, arg->index, "Emu10k1") < 0) { + snd_emux_free(emux); return -ENOMEM; } spin_lock_irqsave(&hw->voice_lock, flags); - hw->synth = emu; + hw->synth = emux; hw->get_synth_voice = snd_emu10k1_synth_get_voice; spin_unlock_irqrestore(&hw->voice_lock, flags); - dev->driver_data = emu; + dev->driver_data = emux; return 0; } static int snd_emu10k1_synth_delete_device(struct snd_seq_device *dev) { - struct snd_emux *emu; + struct snd_emux *emux; struct snd_emu10k1 *hw; unsigned long flags; if (dev->driver_data == NULL) return 0; /* not registered actually */ - emu = dev->driver_data; + emux = dev->driver_data; - hw = emu->hw; + hw = emux->hw; spin_lock_irqsave(&hw->voice_lock, flags); hw->synth = NULL; hw->get_synth_voice = NULL; spin_unlock_irqrestore(&hw->voice_lock, flags); - snd_emux_free(emu); + snd_emux_free(emux); return 0; } diff --git a/sound/pci/emu10k1/io.c b/sound/pci/emu10k1/io.c index a02638350a0a..b5a802bdeb7c 100644 --- a/sound/pci/emu10k1/io.c +++ b/sound/pci/emu10k1/io.c @@ -70,6 +70,11 @@ void snd_emu10k1_ptr_write(struct snd_emu10k1 *emu, unsigned int reg, unsigned i unsigned long flags; unsigned int mask; + if (!emu) { + snd_printk(KERN_ERR "ptr_write: emu is null!\n"); + dump_stack(); + return; + } mask = emu->audigy ? A_PTR_ADDRESS_MASK : PTR_ADDRESS_MASK; regptr = ((reg << 16) & mask) | (chn & PTR_CHANNELNUM_MASK); @@ -134,15 +139,23 @@ int snd_emu10k1_spi_write(struct snd_emu10k1 * emu, unsigned int reset, set; unsigned int reg, tmp; int n, result; + int err = 0; + + /* This function is not re-entrant, so protect against it. */ + spin_lock(&emu->spi_lock); if (emu->card_capabilities->ca0108_chip) reg = 0x3c; /* PTR20, reg 0x3c */ else { /* For other chip types the SPI register * is currently unknown. */ - return 1; + err = 1; + goto spi_write_exit; + } + if (data > 0xffff) { + /* Only 16bit values allowed */ + err = 1; + goto spi_write_exit; } - if (data > 0xffff) /* Only 16bit values allowed */ - return 1; tmp = snd_emu10k1_ptr20_read(emu, reg, 0); reset = (tmp & ~0x3ffff) | 0x20000; /* Set xxx20000 */ @@ -160,11 +173,17 @@ int snd_emu10k1_spi_write(struct snd_emu10k1 * emu, break; } } - if (result) /* Timed out */ - return 1; + if (result) { + /* Timed out */ + err = 1; + goto spi_write_exit; + } snd_emu10k1_ptr20_write(emu, reg, 0, reset | data); tmp = snd_emu10k1_ptr20_read(emu, reg, 0); /* Write post */ - return 0; + err = 0; +spi_write_exit: + spin_unlock(&emu->spi_lock); + return err; } /* The ADC does not support i2c read, so only write is implemented */ @@ -176,15 +195,17 @@ int snd_emu10k1_i2c_write(struct snd_emu10k1 *emu, int timeout = 0; int status; int retry; + int err = 0; + if ((reg > 0x7f) || (value > 0x1ff)) { snd_printk(KERN_ERR "i2c_write: invalid values.\n"); return -EINVAL; } + /* This function is not re-entrant, so protect against it. */ + spin_lock(&emu->i2c_lock); + tmp = reg << 25 | value << 16; - // snd_printk("I2C-write:reg=0x%x, value=0x%x\n", reg, value); - /* Not sure what this I2C channel controls. */ - /* snd_emu10k1_ptr_write(emu, P17V_I2C_0, 0, tmp); */ /* This controls the I2C connected to the WM8775 ADC Codec */ snd_emu10k1_ptr20_write(emu, P17V_I2C_1, 0, tmp); @@ -192,17 +213,14 @@ int snd_emu10k1_i2c_write(struct snd_emu10k1 *emu, for (retry = 0; retry < 10; retry++) { /* Send the data to i2c */ - //tmp = snd_emu10k1_ptr_read(emu, P17V_I2C_ADDR, 0); - //tmp = tmp & ~(I2C_A_ADC_READ|I2C_A_ADC_LAST|I2C_A_ADC_START|I2C_A_ADC_ADD_MASK); tmp = 0; tmp = tmp | (I2C_A_ADC_LAST|I2C_A_ADC_START|I2C_A_ADC_ADD); snd_emu10k1_ptr20_write(emu, P17V_I2C_ADDR, 0, tmp); /* Wait till the transaction ends */ while (1) { - udelay(10); + mdelay(1); status = snd_emu10k1_ptr20_read(emu, P17V_I2C_ADDR, 0); - // snd_printk("I2C:status=0x%x\n", status); timeout++; if ((status & I2C_A_ADC_START) == 0) break; @@ -219,10 +237,14 @@ int snd_emu10k1_i2c_write(struct snd_emu10k1 *emu, if (retry == 10) { snd_printk(KERN_ERR "Writing to ADC failed!\n"); - return -EINVAL; + snd_printk(KERN_ERR "status=0x%x, reg=%d, value=%d\n", + status, reg, value); + /* dump_stack(); */ + err = -EINVAL; } - return 0; + spin_unlock(&emu->i2c_lock); + return err; } int snd_emu1010_fpga_write(struct snd_emu10k1 * emu, u32 reg, u32 value) diff --git a/sound/pci/emu10k1/irq.c b/sound/pci/emu10k1/irq.c index 276d08c88f91..30bfed6f8339 100644 --- a/sound/pci/emu10k1/irq.c +++ b/sound/pci/emu10k1/irq.c @@ -34,9 +34,10 @@ irqreturn_t snd_emu10k1_interrupt(int irq, void *dev_id) struct snd_emu10k1 *emu = dev_id; unsigned int status, status2, orig_status, orig_status2; int handled = 0; + int timeout = 0; - while ((status = inl(emu->port + IPR)) != 0) { - //snd_printk(KERN_INFO "emu10k1 irq - status = 0x%x\n", status); + while (((status = inl(emu->port + IPR)) != 0) && (timeout < 1000)) { + timeout++; orig_status = status; handled = 1; if ((status & 0xffffffff) == 0xffffffff) { @@ -200,5 +201,8 @@ irqreturn_t snd_emu10k1_interrupt(int irq, void *dev_id) } outl(orig_status, emu->port + IPR); /* ack all */ } + if (timeout == 1000) + snd_printk(KERN_INFO "emu10k1 irq routine failure\n"); + return IRQ_RETVAL(handled); } -- cgit v1.2.3 From 2ecba4ffbbc6c85fce8c3878514be415edace413 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 31 Jan 2008 17:40:18 +0100 Subject: [ALSA] version 1.0.16rc2 Signed-off-by: Jaroslav Kysela --- include/sound/version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/sound/version.h b/include/sound/version.h index a9781eb0da09..fac66c49445a 100644 --- a/include/sound/version.h +++ b/include/sound/version.h @@ -1,3 +1,3 @@ /* include/version.h. Generated by alsa/ksync script. */ -#define CONFIG_SND_VERSION "1.0.15" -#define CONFIG_SND_DATE " (Tue Nov 20 19:16:42 2007 UTC)" +#define CONFIG_SND_VERSION "1.0.16rc2" +#define CONFIG_SND_DATE " (Thu Jan 31 16:40:16 2008 UTC)" -- cgit v1.2.3