diff mbox series

[1/3] ALSA: emu10k1: don't limit multi-channel playback to two periods

Message ID 20230523200709.236023-2-oswald.buddenhagen@gmx.de
State Accepted
Commit 6dbecb9b51321bfaf8e7f26fc163d547abcbee86
Headers show
Series ALSA: emu10k1: multi-channel playback related improvements | expand

Commit Message

Oswald Buddenhagen May 23, 2023, 8:07 p.m. UTC
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>
---
 sound/pci/emu10k1/emupcm.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c
index 0572dfb80943..2764e7867b33 100644
--- a/sound/pci/emu10k1/emupcm.c
+++ b/sound/pci/emu10k1/emupcm.c
@@ -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,
 };