Skip to content

Commit ca53344

Browse files
ossilatortiwai
authored andcommitted
ALSA: emu10k1: fix timer for E-MU cards at 44.1 kHz word clock
The timer was presuming a fixed 48 kHz word clock, like the rest of the code. Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Link: https://lore.kernel.org/r/20230612191325.1315854-8-oswald.buddenhagen@gmx.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 6cc8445 commit ca53344

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

sound/pci/emu10k1/timer.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,36 @@ static int snd_emu10k1_timer_stop(struct snd_timer *timer)
3838
return 0;
3939
}
4040

41+
static unsigned long snd_emu10k1_timer_c_resolution(struct snd_timer *timer)
42+
{
43+
struct snd_emu10k1 *emu = snd_timer_chip(timer);
44+
45+
if (emu->card_capabilities->emu_model &&
46+
emu->emu1010.word_clock == 44100)
47+
return 22676; // 1 sample @ 44.1 kHz = 22.675736...us
48+
else
49+
return 20833; // 1 sample @ 48 kHz = 20.833...us
50+
}
51+
4152
static int snd_emu10k1_timer_precise_resolution(struct snd_timer *timer,
4253
unsigned long *num, unsigned long *den)
4354
{
55+
struct snd_emu10k1 *emu = snd_timer_chip(timer);
56+
4457
*num = 1;
45-
*den = 48000;
58+
if (emu->card_capabilities->emu_model)
59+
*den = emu->emu1010.word_clock;
60+
else
61+
*den = 48000;
4662
return 0;
4763
}
4864

4965
static const struct snd_timer_hardware snd_emu10k1_timer_hw = {
5066
.flags = SNDRV_TIMER_HW_AUTO,
51-
.resolution = 20833, /* 1 sample @ 48KHZ = 20.833...us */
5267
.ticks = 1024,
5368
.start = snd_emu10k1_timer_start,
5469
.stop = snd_emu10k1_timer_stop,
70+
.c_resolution = snd_emu10k1_timer_c_resolution,
5571
.precise_resolution = snd_emu10k1_timer_precise_resolution,
5672
};
5773

0 commit comments

Comments
 (0)