mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-07 13:43:51 +00:00
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>
This commit is contained in:
parent
6cc8445046
commit
ca533448a0
@ -38,20 +38,36 @@ static int snd_emu10k1_timer_stop(struct snd_timer *timer)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned long snd_emu10k1_timer_c_resolution(struct snd_timer *timer)
|
||||
{
|
||||
struct snd_emu10k1 *emu = snd_timer_chip(timer);
|
||||
|
||||
if (emu->card_capabilities->emu_model &&
|
||||
emu->emu1010.word_clock == 44100)
|
||||
return 22676; // 1 sample @ 44.1 kHz = 22.675736...us
|
||||
else
|
||||
return 20833; // 1 sample @ 48 kHz = 20.833...us
|
||||
}
|
||||
|
||||
static int snd_emu10k1_timer_precise_resolution(struct snd_timer *timer,
|
||||
unsigned long *num, unsigned long *den)
|
||||
{
|
||||
struct snd_emu10k1 *emu = snd_timer_chip(timer);
|
||||
|
||||
*num = 1;
|
||||
*den = 48000;
|
||||
if (emu->card_capabilities->emu_model)
|
||||
*den = emu->emu1010.word_clock;
|
||||
else
|
||||
*den = 48000;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct snd_timer_hardware snd_emu10k1_timer_hw = {
|
||||
.flags = SNDRV_TIMER_HW_AUTO,
|
||||
.resolution = 20833, /* 1 sample @ 48KHZ = 20.833...us */
|
||||
.ticks = 1024,
|
||||
.start = snd_emu10k1_timer_start,
|
||||
.stop = snd_emu10k1_timer_stop,
|
||||
.c_resolution = snd_emu10k1_timer_c_resolution,
|
||||
.precise_resolution = snd_emu10k1_timer_precise_resolution,
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user