OSDN Git Service

ALSA: emu10k1: don't limit multi-channel playback to two periods
authorOswald Buddenhagen <oswald.buddenhagen@gmx.de>
Tue, 23 May 2023 20:07:07 +0000 (22:07 +0200)
committerTakashi Iwai <tiwai@suse.de>
Wed, 24 May 2023 10:10:28 +0000 (12:10 +0200)
For unclear reasons, the extra voice was set up with half the buffer
size instead of the period size. Commit 27ae958cf6 ("emu10k1 driver -
add multichannel device hw:x,3 [2-8/8]") mentions half-loop interrupts,
so maybe this was an artifact of an earlier iteration of the patch.

While at it, also fix periods_min of the regular playback - one period
makes just no sense.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230523200709.236023-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/emu10k1/emupcm.c

index 0572dfb..2764e78 100644 (file)
@@ -429,15 +429,16 @@ static int snd_emu10k1_efx_playback_prepare(struct snd_pcm_substream *substream)
        struct snd_pcm_runtime *runtime = substream->runtime;
        struct snd_emu10k1_pcm *epcm = runtime->private_data;
        unsigned int start_addr;
-       unsigned int channel_size;
+       unsigned int extra_size, channel_size;
        int i;
 
        start_addr = epcm->start_addr >> 1;  // 16-bit voices
 
+       extra_size = runtime->period_size;
        channel_size = runtime->buffer_size;
 
        snd_emu10k1_pcm_init_extra_voice(emu, epcm->extra, true,
-                                        start_addr, start_addr + (channel_size / 2));
+                                        start_addr, start_addr + extra_size);
 
        epcm->ccca_start_addr = start_addr;
        for (i = 0; i < NUM_EFX_PLAYBACK; i++) {
@@ -465,7 +466,7 @@ static const struct snd_pcm_hardware snd_emu10k1_efx_playback =
        .buffer_bytes_max =     (128*1024),
        .period_bytes_max =     (128*1024),
        .periods_min =          2,
-       .periods_max =          2,
+       .periods_max =          1024,
        .fifo_size =            0,
 };
 
@@ -925,7 +926,7 @@ static const struct snd_pcm_hardware snd_emu10k1_playback =
        .channels_max =         2,
        .buffer_bytes_max =     (128*1024),
        .period_bytes_max =     (128*1024),
-       .periods_min =          1,
+       .periods_min =          2,
        .periods_max =          1024,
        .fifo_size =            0,
 };