ALSA: emu10k1: use high-level I/O functions also during init
PATCH v2 1/2 ALSA: emu10k1: use high-level I/O functions also during init
... and also use more pre-defined constants on the way (some of which required adjustment). This makes the code much shorter and more legible.
Signed-off-by Oswald Buddenhagen <[email protected]>
--- include/sound/emu10k1.h | 9 +++++---- sound/pci/emu10k1/emu10k1_main.c | 20 ++++++-------------- 2 files changed, 11 insertions(+), 18 deletions(-)
include/sound/emu10k1.h +5 -4
@@ -852,10 +852,11 @@#define A_SPDIF_MUTED 0x000000c0#define A_I2S_CAPTURE_RATE_MASK 0x00000e00/* This sets the capture PCM rate, but it is */ -#define A_I2S_CAPTURE_48000 0x00000000/* unclear if this sets the ADC rate as well. */ -#define A_I2S_CAPTURE_192000 0x00000200 -#define A_I2S_CAPTURE_96000 0x00000400 -#define A_I2S_CAPTURE_44100 0x00000800 +#define A_I2S_CAPTURE_RATE 0x03090076/* unclear if this sets the ADC rate as well. */ +#define A_I2S_CAPTURE_48000 0x0 +#define A_I2S_CAPTURE_192000 0x1 +#define A_I2S_CAPTURE_96000 0x2 +#define A_I2S_CAPTURE_44100 0x4#define A_EHC_SRC48_MASK 0x0000e000/* This sets the playback PCM rate on the P16V */ #define A_EHC_SRC48_BYPASS 0x00000000
sound/pci/emu10k1/emu10k1_main.c +6 -14
@@ -186,10 +186,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir)if (emu->card_capabilities->ca0151_chip) {/* audigy2 */ /* Hacks for Alice3 to work independent of haP16V driver */ /* Setup SRCMulti_I2S SamplingRate */ - tmp =snd_emu10k1_ptr_read (emu,A_SPDIF_SAMPLERATE ,0 ); - tmp &=0xfffff1ff ; - tmp |= (0x2 <<9 ); -snd_emu10k1_ptr_write (emu,A_SPDIF_SAMPLERATE ,0 , tmp); +snd_emu10k1_ptr_write (emu,A_I2S_CAPTURE_RATE ,0 ,A_I2S_CAPTURE_96000 );/* Setup SRCSel (Enable Spdif,I2S SRCMulti) */ snd_emu10k1_ptr20_write (emu, SRCSel,0 ,0x14 );
@@ -206,25 +203,20 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir)/* Hacks for Alice3 to work independent of haP16V driver */ dev_info (emu->card->dev,"Audigy2 value: Special config.\n" );/* Setup SRCMulti_I2S SamplingRate */ - tmp =snd_emu10k1_ptr_read (emu,A_SPDIF_SAMPLERATE ,0 ); - tmp &=0xfffff1ff ; - tmp |= (0x2 <<9 ); -snd_emu10k1_ptr_write (emu,A_SPDIF_SAMPLERATE ,0 , tmp); +snd_emu10k1_ptr_write (emu,A_I2S_CAPTURE_RATE ,0 ,A_I2S_CAPTURE_96000 );/* Setup SRCSel (Enable Spdif,I2S SRCMulti) */ -outl (0x600000 , emu->port +0x20 ); -outl (0x14 , emu->port +0x24 ); +snd_emu10k1_ptr20_write (emu, P17V_SRCSel,0 ,0x14 );/* Setup SRCMulti Input Audio Enable */ -outl (0x7b0000 , emu->port +0x20 ); -outl (0xFF000000 , emu->port +0x24 ); +snd_emu10k1_ptr20_write (emu,P17V_MIXER_I2S_ENABLE ,0 ,0xFF000000 );/* Setup SPDIF Out Audio Enable */ /* The Audigy 2 Value has a separate SPDIF out, * so no need for a mixer switch */ -outl (0x7a0000 , emu->port +0x20 ); -outl (0xFF000000 , emu->port +0x24 ); +snd_emu10k1_ptr20_write (emu,P17V_MIXER_SPDIF_ENABLE ,0 ,0xFF000000 ); + tmp =inw (emu->port +A_IOCFG ) & ~0x8 ;/* Clear bit 3 */ outw (tmp, emu->port +A_IOCFG ); }
Signature · 1 line
2.40.0.152.g15d061e6df
PATCH v2 2/2 ALSA: emu10k1: use high-level I/O in set_filterQ()
This makes the code shorter and more legible.
Signed-off-by Oswald Buddenhagen <[email protected]>
--- include/sound/emu10k1.h | 3 ++- sound/pci/emu10k1/emu10k1_callback.c | 5 +---- 2 files changed, 3 insertions(+), 5 deletions(-)
include/sound/emu10k1.h +2 -1
@@ -429,7 +429,8 @@#define DSL_LOOPENDADDR 0x18000007#define CCCA 0x08/* Filter Q, interp. ROM, byte size, cur. addr register */ -#define CCCA_RESONANCE 0xf0000000/* Lowpass filter resonance (Q) height */ +#define CCCA_RESONANCE_MASK 0xf0000000/* Lowpass filter resonance (Q) height */ +#define CCCA_RESONANCE 0x041c0008#define CCCA_INTERPROM_MASK 0x0e000000/* Selects passband of interpolation ROM */ /* 1 == full band, 7 == lowpass */ /* ROM 0 is used when pitch shifting downward or less */
sound/pci/emu10k1/emu10k1_callback.c +1 -4
@@ -532,8 +532,5 @@ set_fm2frq2(struct snd_emu10k1 *hw, struct snd_emux_voice *vp)static void set_filterQ (struct snd_emu10k1 *hw,struct snd_emux_voice *vp) { -unsigned int val; - val =snd_emu10k1_ptr_read (hw,CCCA , vp->ch) & ~CCCA_RESONANCE ; - val |= (vp->reg.parm.filterQ <<28 ); -snd_emu10k1_ptr_write (hw,CCCA , vp->ch, val); +snd_emu10k1_ptr_write (hw,CCCA_RESONANCE , vp->ch, vp->reg.parm.filterQ); }
Signature · 1 line
2.40.0.152.g15d061e6df
Takashi Iwai
AppliedQuoted 5 lines · Oswald Buddenhagen
... and also use more pre-defined constants on the way (some of which required adjustment). This makes the code much shorter and more legible.
Signed-off-by Oswald Buddenhagen <[email protected]>
Applied both patches now. Thanks.
Takashi