ALSA: emu10k1: assorted playback-related cleanups
Subsystems (2)
cover ALSA: emu10k1: assorted playback-related cleanups
Oswald Buddenhagen (6):
ALSA: emu10k1: straighten out FX send init
ALSA: emu10k1: cleanup envelope register init
ALSA: emu10k1: remove useless resets of stop-on-loop-end bits
ALSA: emu10k1: rewire {en,dis}abling interrupts for PCM playback
ALSA: emu10k1: skip needless setting of some voice registers
ALSA: emu10k1: factor out snd_emu10k1_compose_audigy_sendamounts()
Documentation/sound/cards/audigy-mixer.rst | 36 ++--- include/sound/emu10k1.h | 14 +- sound/pci/emu10k1/emu10k1_main.c | 12 +- sound/pci/emu10k1/emumixer.c | 51 +------ sound/pci/emu10k1/emupcm.c | 168 ++++++++++----------- sound/pci/emu10k1/io.c | 63 +------- 6 files changed, 121 insertions(+), 223 deletions(-)
Signature · 1 line
2.40.0.152.g15d061e6df
PATCH 1/6 ALSA: emu10k1: straighten out FX send init
The mixer structures were filled in two places: on driver init, and when the devices are opened. The latter made the former pointless, so we remove the former. This implies that mixer dumps may now return all zeroes, which is OK, as restoring them is meaningless as well.
Things were even weirder for the (generally unused) secondary sends:
Some of the initialization loops were forgotten when support for Audigy was added, thus creating the technically illegal state of multiple sends being routed to the same FX accumulator (though it apparently doesn't matter when the amount is zero).
The global multi-channel init used some rather bizarre values for the secondary sends, and the init on open actually forgot to re-initialize them. We now use a not really more useful, but simpler formula.
The direct register init was also bogus. This doesn't really matter, as the value is overwritten when a voice comes into use, but still.
--- Documentation/sound/cards/audigy-mixer.rst | 36 +++++++++--------- sound/pci/emu10k1/emu10k1_main.c | 2 +- sound/pci/emu10k1/emumixer.c | 44 +--------------------- sound/pci/emu10k1/emupcm.c | 14 +++---- 4 files changed, 26 insertions(+), 70 deletions(-)
Documentation/sound/cards/audigy-mixer.rst +18 -18
@@ -240,30 +240,30 @@ name='EMU10K1 PCM Send Routing',index 0-31 This control specifies the destination - FX-bus accumulators. There are 24 values in this mapping: -* 0 - mono, A destination (FX-bus 0-63), default 0 -* 1 - mono, B destination (FX-bus 0-63), default 1 -* 2 - mono, C destination (FX-bus 0-63), default 2 -* 3 - mono, D destination (FX-bus 0-63), default 3 -* 4 - mono, E destination (FX-bus 0-63), default 0 -* 5 - mono, F destination (FX-bus 0-63), default 0 -* 6 - mono, G destination (FX-bus 0-63), default 0 -* 7 - mono, H destination (FX-bus 0-63), default 0 -* 8 - left, A destination (FX-bus 0-63), default 0 -* 9 - left, B destination (FX-bus 0-63), default 1 +* 0 - mono, A destination (FX-bus 0-63), default 0 +* 1 - mono, B destination (FX-bus 0-63), default 1 +* 2 - mono, C destination (FX-bus 0-63), default 2 +* 3 - mono, D destination (FX-bus 0-63), default 3 +* 4 - mono, E destination (FX-bus 0-63), default 4 +* 5 - mono, F destination (FX-bus 0-63), default 5 +* 6 - mono, G destination (FX-bus 0-63), default 6 +* 7 - mono, H destination (FX-bus 0-63), default 7 +* 8 - left, A destination (FX-bus 0-63), default 0 +* 9 - left, B destination (FX-bus 0-63), default 1 * 10 - left, C destination (FX-bus 0-63), default 2 * 11 - left, D destination (FX-bus 0-63), default 3 -* 12 - left, E destination (FX-bus 0-63), default 0 -* 13 - left, F destination (FX-bus 0-63), default 0 -* 14 - left, G destination (FX-bus 0-63), default 0 -* 15 - left, H destination (FX-bus 0-63), default 0 +* 12 - left, E destination (FX-bus 0-63), default 4 +* 13 - left, F destination (FX-bus 0-63), default 5 +* 14 - left, G destination (FX-bus 0-63), default 6 +* 15 - left, H destination (FX-bus 0-63), default 7 * 16 - right, A destination (FX-bus 0-63), default 0 * 17 - right, B destination (FX-bus 0-63), default 1 * 18 - right, C destination (FX-bus 0-63), default 2 * 19 - right, D destination (FX-bus 0-63), default 3 -* 20 - right, E destination (FX-bus 0-63), default 0 -* 21 - right, F destination (FX-bus 0-63), default 0 -* 22 - right, G destination (FX-bus 0-63), default 0 -* 23 - right, H destination (FX-bus 0-63), default 0 +* 20 - right, E destination (FX-bus 0-63), default 4 +* 21 - right, F destination (FX-bus 0-63), default 5 +* 22 - right, G destination (FX-bus 0-63), default 6 +* 23 - right, H destination (FX-bus 0-63), default 7 Don't forget that it's illegal to assign a channel to the same FX-bus accumulator more than once (it means 0=0 && 1=0 is an invalid combination).
sound/pci/emu10k1/emu10k1_main.c +1 -1
@@ -95,7 +95,7 @@ void snd_emu10k1_voice_init(struct snd_emu10k1 *emu, int ch)snd_emu10k1_ptr_write (emu,A_CSFE , ch,0 );snd_emu10k1_ptr_write (emu,A_CSHG , ch,0 );snd_emu10k1_ptr_write (emu,A_FXRT1 , ch,0x03020100 ); -snd_emu10k1_ptr_write (emu,A_FXRT2 , ch,0x3f3f3f3f ); +snd_emu10k1_ptr_write (emu,A_FXRT2 , ch,0x07060504 );snd_emu10k1_ptr_write (emu,A_SENDAMOUNTS , ch,0 ); } }
sound/pci/emu10k1/emumixer.c +1 -43
56 lines not on this page · raw message
sound/pci/emu10k1/emupcm.c +6 -8
@@ -283,11 +283,8 @@ static void snd_emu10k1_pcm_init_voice(struct snd_emu10k1 *emu,/* volume parameters */ if (extra) { -memset (send_routing,0 ,sizeof (send_routing)); - send_routing[0 ] =0 ; - send_routing[1 ] =1 ; - send_routing[2 ] =2 ; - send_routing[3 ] =3 ; +for (int i =0 ; i <8 ; i++) + send_routing[i] = i;memset (send_amount,0 ,sizeof (send_amount)); }else {/* mono, left, right (master voice = left) */
@@ -1031,7 +1028,7 @@ static int snd_emu10k1_efx_playback_open(struct snd_pcm_substream *substream)struct snd_emu10k1_pcm *epcm;struct snd_emu10k1_pcm_mixer *mix;struct snd_pcm_runtime *runtime = substream->runtime; -int i; +int i, j; epcm =kzalloc (sizeof (*epcm),GFP_KERNEL );if (epcm ==NULL )
@@ -1046,7 +1043,8 @@ static int snd_emu10k1_efx_playback_open(struct snd_pcm_substream *substream)for (i =0 ; i <NUM_EFX_PLAYBACK ; i++) { mix = &emu->efx_pcm_mixer[i]; - mix->send_routing[0 ][0 ] = i; +for (j =0 ; j <8 ; j++) + mix->send_routing[0 ][j] = i + j;memset (&mix->send_volume,0 ,sizeof (mix->send_volume)); mix->send_volume[0 ][0 ] =255 ; mix->attn[0 ] =0x8000 ;
@@ -1093,7 +1091,7 @@ static int snd_emu10k1_playback_open(struct snd_pcm_substream *substream)return err; } mix = &emu->pcm_mixer[substream->number]; -for (i =0 ; i <4 ; i++) +for (i =0 ; i <8 ; i++) mix->send_routing[0 ][i] = mix->send_routing[1 ][i] = mix->send_routing[2 ][i] = i;memset (&mix->send_volume,0 ,sizeof (mix->send_volume)); mix->send_volume[0][0] = mix->send_volume[0][1] =
Signature · 1 line
2.40.0.152.g15d061e6df
PATCH 2/6 ALSA: emu10k1: cleanup envelope register init
In reply to Oswald BuddenhagenWe (rightfully) don't enable the envelope engine for PCM voices, so any related setup is entirely pointless - the EMU8K documentation makes that very clear, and the fact that the various open drivers all use different values to no observable detriment pretty much confirms it.
The remaining initializations are regrouped for clarity.
--- include/sound/emu10k1.h | 1 - sound/pci/emu10k1/emu10k1_main.c | 10 +++--- sound/pci/emu10k1/emupcm.c | 42 ++++++---------------- sound/pci/emu10k1/io.c | 61 -------------------------------- 4 files changed, 14 insertions(+), 100 deletions(-)
include/sound/emu10k1.h +0 -1
@@ -1798,7 +1798,6 @@ void snd_emu10k1_wait(struct snd_emu10k1 *emu, unsigned int wait);static inline unsigned int snd_emu10k1_wc (struct snd_emu10k1 *emu) {return (inl (emu->port +WC ) >>6 ) &0xfffff ; }unsigned short snd_emu10k1_ac97_read (struct snd_ac97 *ac97,unsigned short reg);void snd_emu10k1_ac97_write (struct snd_ac97 *ac97,unsigned short reg,unsigned short data); -unsigned int snd_emu10k1_rate_to_pitch (unsigned int rate);#ifdef CONFIG_PM_SLEEP void snd_emu10k1_suspend_regs (struct snd_emu10k1 *emu);
sound/pci/emu10k1/emu10k1_main.c +4 -6
@@ -58,7 +58,6 @@ MODULE_FIRMWARE(EMU1010_NOTEBOOK_FILENAME);void snd_emu10k1_voice_init (struct snd_emu10k1 *emu,int ch) {snd_emu10k1_ptr_write (emu,DCYSUSV , ch,0 ); -snd_emu10k1_ptr_write (emu,IP , ch,0 );snd_emu10k1_ptr_write (emu,VTFT , ch,VTFT_FILTERTARGET_MASK );snd_emu10k1_ptr_write (emu,CVCF , ch,CVCF_CURRENTFILTER_MASK );snd_emu10k1_ptr_write (emu,PTRX , ch,0 );
@@ -72,19 +71,18 @@ void snd_emu10k1_voice_init(struct snd_emu10k1 *emu, int ch)snd_emu10k1_ptr_write (emu,Z2 , ch,0 );snd_emu10k1_ptr_write (emu,FXRT , ch,0x32100000 ); -snd_emu10k1_ptr_write (emu,ATKHLDM , ch,0 ); +// The rest is meaningless as long as DCYSUSV_CHANNELENABLE_MASK is zero snd_emu10k1_ptr_write (emu,DCYSUSM , ch,0 ); +snd_emu10k1_ptr_write (emu,ATKHLDV , ch,0 ); +snd_emu10k1_ptr_write (emu,ATKHLDM , ch,0 ); +snd_emu10k1_ptr_write (emu,IP , ch,0 );snd_emu10k1_ptr_write (emu,IFATN , ch,IFATN_FILTERCUTOFF_MASK |IFATN_ATTENUATION_MASK );snd_emu10k1_ptr_write (emu,PEFE , ch,0 );snd_emu10k1_ptr_write (emu,FMMOD , ch,0 );snd_emu10k1_ptr_write (emu,TREMFRQ , ch,24 );/* 1 Hz */ snd_emu10k1_ptr_write (emu,FM2FRQ2 , ch,24 );/* 1 Hz */ -snd_emu10k1_ptr_write (emu,TEMPENV , ch,0 ); - -/*** these are last so OFF prevents writing ***/ snd_emu10k1_ptr_write (emu,LFOVAL2 , ch,0 );snd_emu10k1_ptr_write (emu,LFOVAL1 , ch,0 ); -snd_emu10k1_ptr_write (emu,ATKHLDV , ch,0 );snd_emu10k1_ptr_write (emu,ENVVOL , ch,0 );snd_emu10k1_ptr_write (emu,ENVVAL , ch,0 );
sound/pci/emu10k1/emupcm.c +10 -32
115 lines not on this page · raw message
sound/pci/emu10k1/io.c +0 -61
64 lines not on this page · raw message
Signature · 1 line
2.40.0.152.g15d061e6df
PATCH 3/6 ALSA: emu10k1: remove useless resets of stop-on-loop-end bits
In reply to Oswald BuddenhagenWe initialize them at card init and don't touch them later, so there is no need to reset them again at voice start.
--- include/sound/emu10k1.h | 2 ++ sound/pci/emu10k1/emupcm.c | 1 - sound/pci/emu10k1/io.c | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-)
include/sound/emu10k1.h +2 -0
@@ -1792,8 +1792,10 @@ void snd_emu10k1_voice_intr_ack(struct snd_emu10k1 *emu, unsigned int voicenum);void snd_emu10k1_voice_half_loop_intr_enable (struct snd_emu10k1 *emu,unsigned int voicenum);void snd_emu10k1_voice_half_loop_intr_disable (struct snd_emu10k1 *emu,unsigned int voicenum);void snd_emu10k1_voice_half_loop_intr_ack (struct snd_emu10k1 *emu,unsigned int voicenum); +#if 0 void snd_emu10k1_voice_set_loop_stop (struct snd_emu10k1 *emu,unsigned int voicenum);void snd_emu10k1_voice_clear_loop_stop (struct snd_emu10k1 *emu,unsigned int voicenum); +#endif void snd_emu10k1_wait (struct snd_emu10k1 *emu,unsigned int wait);static inline unsigned int snd_emu10k1_wc (struct snd_emu10k1 *emu) {return (inl (emu->port +WC ) >>6 ) &0xfffff ; }unsigned short snd_emu10k1_ac97_read (struct snd_ac97 *ac97,unsigned short reg);
sound/pci/emu10k1/emupcm.c +0 -1
@@ -603,7 +603,6 @@ static void snd_emu10k1_playback_prepare_voice(struct snd_emu10k1 *emu, struct s vattn = mix !=NULL ? (mix->attn[tmp] <<16 ) :0 ;snd_emu10k1_ptr_write (emu,VTFT , voice, vattn |VTFT_FILTERTARGET_MASK );snd_emu10k1_ptr_write (emu,CVCF , voice, vattn |CVCF_CURRENTFILTER_MASK ); -snd_emu10k1_voice_clear_loop_stop (emu, voice); }static void snd_emu10k1_playback_trigger_voice (struct snd_emu10k1 *emu,struct snd_emu10k1_voice *evoice,int master,int extra)
sound/pci/emu10k1/io.c +2 -0
@@ -434,6 +434,7 @@ void snd_emu10k1_voice_half_loop_intr_ack(struct snd_emu10k1 *emu, unsigned intspin_unlock_irqrestore (&emu->emu_lock, flags); } +#if 0 void snd_emu10k1_voice_set_loop_stop (struct snd_emu10k1 *emu,unsigned int voicenum) {unsigned long flags;
@@ -471,6 +472,7 @@ void snd_emu10k1_voice_clear_loop_stop(struct snd_emu10k1 *emu, unsigned int voioutl (sol, emu->port +DATA ); spin_unlock_irqrestore(&emu->emu_lock, flags); } +#endif void snd_emu10k1_wait (struct snd_emu10k1 *emu,unsigned int wait) {
Signature · 1 line
2.40.0.152.g15d061e6df
PATCH 4/6 ALSA: emu10k1: rewire {en,dis}abling interrupts for PCM playback
In reply to Oswald BuddenhagenWe now enable ints even before triggering, and disable them only after stopping - otherwise there is a race condition we may plausibly run into when we pause/resume near the end of the buffer.
Updating the epcm->running flag is moved the same way, as it affects the *_pointer() functions, which are called by the interrupt handler.
Also, factor these out to own functions, for clarity.
For multi-channel, the extra voice is now triggered after all regular voices - we wouldn't want to receive an int before all channels have passed the period boundary.
--- sound/pci/emu10k1/emupcm.c | 45 ++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 16 deletions(-)
sound/pci/emu10k1/emupcm.c +29 -16
@@ -605,7 +605,9 @@ static void snd_emu10k1_playback_prepare_voice(struct snd_emu10k1 *emu, struct ssnd_emu10k1_ptr_write (emu,CVCF , voice, vattn |CVCF_CURRENTFILTER_MASK ); } -static void snd_emu10k1_playback_trigger_voice (struct snd_emu10k1 *emu,struct snd_emu10k1_voice *evoice,int master,int extra) +static void snd_emu10k1_playback_trigger_voice (struct snd_emu10k1 *emu, +struct snd_emu10k1_voice *evoice, +int master) {struct snd_pcm_substream *substream;struct snd_pcm_runtime *runtime;
@@ -624,24 +626,36 @@ static void snd_emu10k1_playback_trigger_voice(struct snd_emu10k1 *emu, struct ssnd_emu10k1_ptr_write (emu,PTRX_PITCHTARGET , voice, pitch_target);if (master || evoice->epcm->type ==PLAYBACK_EFX )snd_emu10k1_ptr_write (emu,CPF_CURRENTPITCH , voice, pitch_target); -if (extra) -snd_emu10k1_voice_intr_enable (emu, voice); } -static void snd_emu10k1_playback_stop_voice (struct snd_emu10k1 *emu,struct snd_emu10k1_voice *evoice) +static void snd_emu10k1_playback_stop_voice (struct snd_emu10k1 *emu, +struct snd_emu10k1_voice *evoice) {unsigned int voice;if (evoice ==NULL )return ; voice = evoice->number; -snd_emu10k1_voice_intr_disable (emu, voice);snd_emu10k1_ptr_write (emu,PTRX_PITCHTARGET , voice,0 );snd_emu10k1_ptr_write (emu,CPF_CURRENTPITCH , voice,0 );snd_emu10k1_ptr_write (emu,VTFT , voice,VTFT_FILTERTARGET_MASK );snd_emu10k1_ptr_write (emu,CVCF , voice,CVCF_CURRENTFILTER_MASK ); } +static void snd_emu10k1_playback_set_running (struct snd_emu10k1 *emu, +struct snd_emu10k1_pcm *epcm) +{ + epcm->running =1 ; +snd_emu10k1_voice_intr_enable (emu, epcm->extra->number); +} + +static void snd_emu10k1_playback_set_stopped (struct snd_emu10k1 *emu, +struct snd_emu10k1_pcm *epcm) +{ +snd_emu10k1_voice_intr_disable (emu, epcm->extra->number); + epcm->running =0 ; +} + static inline void snd_emu10k1_playback_mangle_extra(struct snd_emu10k1 *emu, struct snd_emu10k1_pcm *epcm, struct snd_pcm_substream *substream,
@@ -687,18 +701,18 @@ static int snd_emu10k1_playback_trigger(struct snd_pcm_substream *substream,snd_emu10k1_playback_prepare_voice (emu, epcm->voices[0 ],1 , mix);snd_emu10k1_playback_prepare_voice (emu, epcm->voices[1 ],0 , mix);snd_emu10k1_playback_prepare_voice (emu, epcm->extra,1 ,NULL ); -snd_emu10k1_playback_trigger_voice (emu, epcm->voices[0 ],1 ,0 ); -snd_emu10k1_playback_trigger_voice (emu, epcm->voices[1 ],0 ,0 ); -snd_emu10k1_playback_trigger_voice (emu, epcm->extra,1 ,1 ); - epcm->running =1 ; +snd_emu10k1_playback_set_running (emu, epcm); +snd_emu10k1_playback_trigger_voice (emu, epcm->voices[0 ],1 ); +snd_emu10k1_playback_trigger_voice (emu, epcm->voices[1 ],0 ); +snd_emu10k1_playback_trigger_voice (emu, epcm->extra,1 );break ;case SNDRV_PCM_TRIGGER_STOP :case SNDRV_PCM_TRIGGER_PAUSE_PUSH :case SNDRV_PCM_TRIGGER_SUSPEND : - epcm->running =0 ;snd_emu10k1_playback_stop_voice (emu, epcm->voices[0 ]);snd_emu10k1_playback_stop_voice (emu, epcm->voices[1 ]);snd_emu10k1_playback_stop_voice (emu, epcm->extra); +snd_emu10k1_playback_set_stopped (emu, epcm);break ;default : result = -EINVAL ;
@@ -836,20 +850,19 @@ static int snd_emu10k1_efx_playback_trigger(struct snd_pcm_substream *substream,for (i =1 ; i <NUM_EFX_PLAYBACK ; i++)snd_emu10k1_playback_prepare_voice (emu, epcm->voices[i],0 , &emu->efx_pcm_mixer[i]); -snd_emu10k1_playback_trigger_voice (emu, epcm->voices[0 ],0 ,0 ); -snd_emu10k1_playback_trigger_voice (emu, epcm->extra,1 ,1 ); -for (i =1 ; i <NUM_EFX_PLAYBACK ; i++) -snd_emu10k1_playback_trigger_voice (emu, epcm->voices[i],0 ,0 ); - epcm->running =1 ; +snd_emu10k1_playback_set_running (emu, epcm); +for (i =0 ; i <NUM_EFX_PLAYBACK ; i++) +snd_emu10k1_playback_trigger_voice (emu, epcm->voices[i],0 ); +snd_emu10k1_playback_trigger_voice (emu, epcm->extra,1 );break ;case SNDRV_PCM_TRIGGER_SUSPEND :case SNDRV_PCM_TRIGGER_STOP :case SNDRV_PCM_TRIGGER_PAUSE_PUSH : - epcm->running =0 ;for (i =0 ; i <NUM_EFX_PLAYBACK ; i++) {snd_emu10k1_playback_stop_voice (emu, epcm->voices[i]); }snd_emu10k1_playback_stop_voice (emu, epcm->extra); +snd_emu10k1_playback_set_stopped (emu, epcm);break ;default : result = -EINVAL ;
Signature · 1 line
2.40.0.152.g15d061e6df
PATCH 5/6 ALSA: emu10k1: skip needless setting of some voice registers
In reply to Oswald BuddenhagenMany registers are meaningless for stereo slaves and the extra voices. This patch cleans up these unnecessary register writes.
snd_emu10k1_playback_{trigger,stop}_voice() is not called for stereo slaves any more.
snd_emu10k1_playback_prepare_voice() is renamed to snd_emu10k1_playback_unmute_voice(), as this better reflects its remaining function. It's not called for the extra voices any more.
Accordingly, snd_emu10k1_playback_mute_voice() is factored out from snd_emu10k1_playback_stop_voice(), and is called selectively as well.
This doesn't add conditionals which would avoid initializing sub-registers, as that wouldn't pull its weight.
--- include/sound/emu10k1.h | 8 ++++ sound/pci/emu10k1/emupcm.c | 89 ++++++++++++++++++++------------------ 2 files changed, 56 insertions(+), 41 deletions(-)
include/sound/emu10k1.h +8 -0
@@ -404,6 +404,14 @@ SUB_REG(HCFG, LOCKTANKCACHE, 0x00000004) /* 1 = Cancel bustmaster accesses to ta// distortion), the modulation engine sets the target registers, towards // which the current registers "swerve" gradually. +// For the odd channel in a stereo pair, these registers are meaningless: +// CPF_STEREO, CPF_CURRENTPITCH, PTRX_PITCHTARGET, CCR_CACHEINVALIDSIZE, +// PSST_LOOPSTARTADDR, DSL_LOOPENDADDR, CCCA_CURRADDR +// The somewhat non-obviously still meaningful ones are: +// CPF_STOP, CPF_FRACADDRESS, CCR_READADDRESS (!), +// CCCA_INTERPROM, CCCA_8BITSELECT (!) +// (The envelope engine is ignored here, as stereo matters only for verbatim playback.) +#define CPF 0x00/* Current pitch and fraction register */ SUB_REG(CPF, CURRENTPITCH, 0xffff0000) /* Current pitch (linear, 0x4000 == unity pitch shift) */#define CPF_STEREO_MASK 0x00008000/* 1 = Even channel interleave, odd channel locked */
sound/pci/emu10k1/emupcm.c +48 -41
191 lines not on this page · raw message
Signature · 1 line
2.40.0.152.g15d061e6df
PATCH 6/6 ALSA: emu10k1: factor out snd_emu10k1_compose_audigy_sendamounts()
In reply to Oswald BuddenhagenSaves a bit of code duplication.
--- include/sound/emu10k1.h | 3 +++ sound/pci/emu10k1/emumixer.c | 7 ++----- sound/pci/emu10k1/emupcm.c | 5 +---- 3 files changed, 6 insertions(+), 9 deletions(-)
include/sound/emu10k1.h +3 -0
@@ -1501,6 +1501,9 @@ struct snd_emu10k1_pcm_mixer {#define snd_emu10k1_compose_audigy_fxrt2 (route) \ ((unsigned int)route[4] | ((unsigned int)route[5] << 8) | ((unsigned int)route[6] << 16) | ((unsigned int)route[7] << 24)) +#define snd_emu10k1_compose_audigy_sendamounts (vol) \ +(((unsigned int)vol[4] << 24) | ((unsigned int)vol[5] << 16) | ((unsigned int)vol[6] << 8) | (unsigned int)vol[7]) +struct snd_emu10k1_memblk {struct snd_util_memblk mem;/* private part */
sound/pci/emu10k1/emumixer.c +2 -5
@@ -1196,11 +1196,8 @@ static void update_emu10k1_send_volume(struct snd_emu10k1 *emu, int voice, unsigsnd_emu10k1_ptr_write (emu,PSST_FXSENDAMOUNT_C , voice, volume[2 ]);snd_emu10k1_ptr_write (emu,DSL_FXSENDAMOUNT_D , voice, volume[3 ]);if (emu->audigy) { -unsigned int val = ((unsigned int )volume[4 ] <<24 ) | - ((unsigned int )volume[5 ] <<16 ) | - ((unsigned int )volume[6 ] <<8 ) | - (unsigned int )volume[7 ]; -snd_emu10k1_ptr_write (emu,A_SENDAMOUNTS , voice, val); +snd_emu10k1_ptr_write (emu,A_SENDAMOUNTS , voice, +snd_emu10k1_compose_audigy_sendamounts (volume)); } }
sound/pci/emu10k1/emupcm.c +1 -4
@@ -316,10 +316,7 @@ static void snd_emu10k1_pcm_init_voice(struct snd_emu10k1 *emu,snd_emu10k1_ptr_write (emu,A_FXRT2 , voice,snd_emu10k1_compose_audigy_fxrt2 (send_routing));snd_emu10k1_ptr_write (emu,A_SENDAMOUNTS , voice, - ((unsigned int )send_amount[4 ] <<24 ) | - ((unsigned int )send_amount[5 ] <<16 ) | - ((unsigned int )send_amount[6 ] <<8 ) | - (unsigned int )send_amount[7 ]); +snd_emu10k1_compose_audigy_sendamounts (send_amount)); }else snd_emu10k1_ptr_write (emu,FXRT , voice,snd_emu10k1_compose_send_routing (send_routing));
Signature · 1 line
2.40.0.152.g15d061e6df
Takashi Iwai
AppliedQuoted 9 lines · Oswald Buddenhagen
Oswald Buddenhagen (6):
ALSA: emu10k1: straighten out FX send init
ALSA: emu10k1: cleanup envelope register init
ALSA: emu10k1: remove useless resets of stop-on-loop-end bits
ALSA: emu10k1: rewire {en,dis}abling interrupts for PCM playback
ALSA: emu10k1: skip needless setting of some voice registers
ALSA: emu10k1: factor outsnd_emu10k1_compose_audigy_sendamounts()
Applied all 6 patches now. Thanks.
Takashi