Skip to content

Commit 8d60d5c

Browse files
ossilatortiwai
authored andcommitted
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). Signed-off-by: Oswald Buddenhagen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 14a2956 commit 8d60d5c

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

include/sound/emu10k1.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -852,10 +852,11 @@
852852
#define A_SPDIF_MUTED 0x000000c0
853853

854854
#define A_I2S_CAPTURE_RATE_MASK 0x00000e00 /* This sets the capture PCM rate, but it is */
855-
#define A_I2S_CAPTURE_48000 0x00000000 /* unclear if this sets the ADC rate as well. */
856-
#define A_I2S_CAPTURE_192000 0x00000200
857-
#define A_I2S_CAPTURE_96000 0x00000400
858-
#define A_I2S_CAPTURE_44100 0x00000800
855+
#define A_I2S_CAPTURE_RATE 0x03090076 /* unclear if this sets the ADC rate as well. */
856+
#define A_I2S_CAPTURE_48000 0x0
857+
#define A_I2S_CAPTURE_192000 0x1
858+
#define A_I2S_CAPTURE_96000 0x2
859+
#define A_I2S_CAPTURE_44100 0x4
859860

860861
#define A_EHC_SRC48_MASK 0x0000e000 /* This sets the playback PCM rate on the P16V */
861862
#define A_EHC_SRC48_BYPASS 0x00000000

sound/pci/emu10k1/emu10k1_main.c

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir)
187187
} else if (emu->card_capabilities->ca0151_chip) { /* audigy2 */
188188
/* Hacks for Alice3 to work independent of haP16V driver */
189189
/* Setup SRCMulti_I2S SamplingRate */
190-
tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0);
191-
tmp &= 0xfffff1ff;
192-
tmp |= (0x2<<9);
193-
snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, 0, tmp);
190+
snd_emu10k1_ptr_write(emu, A_I2S_CAPTURE_RATE, 0, A_I2S_CAPTURE_96000);
194191

195192
/* Setup SRCSel (Enable Spdif,I2S SRCMulti) */
196193
snd_emu10k1_ptr20_write(emu, SRCSel, 0, 0x14);
@@ -206,25 +203,20 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir)
206203
/* Hacks for Alice3 to work independent of haP16V driver */
207204
dev_info(emu->card->dev, "Audigy2 value: Special config.\n");
208205
/* Setup SRCMulti_I2S SamplingRate */
209-
tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0);
210-
tmp &= 0xfffff1ff;
211-
tmp |= (0x2<<9);
212-
snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, 0, tmp);
206+
snd_emu10k1_ptr_write(emu, A_I2S_CAPTURE_RATE, 0, A_I2S_CAPTURE_96000);
213207

214208
/* Setup SRCSel (Enable Spdif,I2S SRCMulti) */
215-
outl(0x600000, emu->port + 0x20);
216-
outl(0x14, emu->port + 0x24);
209+
snd_emu10k1_ptr20_write(emu, P17V_SRCSel, 0, 0x14);
217210

218211
/* Setup SRCMulti Input Audio Enable */
219-
outl(0x7b0000, emu->port + 0x20);
220-
outl(0xFF000000, emu->port + 0x24);
212+
snd_emu10k1_ptr20_write(emu, P17V_MIXER_I2S_ENABLE, 0, 0xFF000000);
221213

222214
/* Setup SPDIF Out Audio Enable */
223215
/* The Audigy 2 Value has a separate SPDIF out,
224216
* so no need for a mixer switch
225217
*/
226-
outl(0x7a0000, emu->port + 0x20);
227-
outl(0xFF000000, emu->port + 0x24);
218+
snd_emu10k1_ptr20_write(emu, P17V_MIXER_SPDIF_ENABLE, 0, 0xFF000000);
219+
228220
tmp = inw(emu->port + A_IOCFG) & ~0x8; /* Clear bit 3 */
229221
outw(tmp, emu->port + A_IOCFG);
230222
}

0 commit comments

Comments
 (0)