mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Miles Ramage <miles.ramage@yahoo.com>
To: Nicholas Johnson <nicholas.johnson-opensource@outlook.com.au>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jamie Steele <steele.jamie1991@gmail.com>,
	Miles Ramage <miles.ramage@yahoo.com>
Subject: [RFC PATCH 4/5] ALSA: quantum: preallocate enough buffer for two full periods
Date: Tue,  1 Dec 2026 22:22:30 -0600	[thread overview]
Message-ID: <20261202042231.42930-5-miles.ramage@yahoo.com> (raw)
In-Reply-To: <20261202042231.42930-1-miles.ramage@yahoo.com>

ALSA limits the buffer to the preallocated size, 64 KiB. That is 630
frames at 26 channels and 910 at 18, so a client asking for 512-frame
periods cannot get two of them, and hw_params fails:

  speaker-test -D hw:Quantum2626 -c 18 -r 96000 -F S32_LE
  Buffer size range from 64 to 910
  ...
  Setting of hwparams failed: Invalid argument

Preallocate 2 MiB per substream. That covers the ~250 ms buffers the
vendor Windows driver uses in every speed band (12032 frames x 26
channels at 48 kHz, 24064 x 18 at 96 kHz, 48128 x 8 at 192 kHz).

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Miles Ramage <miles.ramage@yahoo.com>
---
 sound/pci/quantum/quantum_pcm.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/sound/pci/quantum/quantum_pcm.c b/sound/pci/quantum/quantum_pcm.c
index 5575072..2891974 100644
--- a/sound/pci/quantum/quantum_pcm.c
+++ b/sound/pci/quantum/quantum_pcm.c
@@ -644,8 +644,14 @@ int snd_quantum_pcm_new(struct quantum_chip *chip)
 	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
 			&quantum_ops);
 
+	/*
+	 * ALSA caps the buffer at the preallocated size. 64 KiB allowed only
+	 * 630 frames at 26 channels and 910 at 18, too few for two 512-frame
+	 * periods. 2 MiB covers the ~250 ms buffers the vendor driver uses in
+	 * every speed band.
+	 */
 	snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
-					      &chip->pci->dev, 64 * 1024,
+					      &chip->pci->dev, 2 * 1024 * 1024,
 					      16 * 1024 * 1024);
 
 	return 0;
-- 
2.56.1


  parent reply	other threads:[~2026-12-02  4:23 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-20  8:36 [RFC PATCH 0/1] ALSA: add PreSonus Quantum PCI driver Nicholas Johnson
2026-08-20  8:36 ` [RFC PATCH 1/1] ALSA: pci: " Nicholas Johnson
2026-08-21 12:44   ` [RFC PATCH] " Markus Elfring
2026-08-21 13:00   ` Markus Elfring
2026-08-21 13:34   ` [RFC PATCH 1/1] " Markus Elfring
2026-08-21 14:24   ` [RFC PATCH] " Markus Elfring
2026-08-21 18:10   ` Markus Elfring
2026-08-22 14:20   ` Markus Elfring
2026-08-22 15:21   ` [RFC PATCH 1/1] " Matthew Wilcox
2026-09-18 18:34     ` [RFC] " Markus Elfring
2026-10-24 16:13 ` [RFC PATCH 0/1] ALSA: " Jamie Steele
2026-12-02  4:22   ` [RFC PATCH 0/5] ALSA: quantum: fix high sample rates and duplex attach Miles Ramage
2026-12-02  4:22     ` [RFC PATCH 1/5] ALSA: quantum: send the sample-rate wire value when setting the rate Miles Ramage
2026-12-02  4:22     ` [RFC PATCH 2/5] ALSA: quantum: track the device sample rate correctly Miles Ramage
2026-12-02  4:22     ` [RFC PATCH 3/5] ALSA: quantum: tie the channel count to the sample rate Miles Ramage
2026-12-02  4:22     ` Miles Ramage [this message]
2026-12-02  4:22     ` [RFC PATCH 5/5] ALSA: quantum: let a second direction attach to a running stream Miles Ramage

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261202042231.42930-5-miles.ramage@yahoo.com \
    --to=miles.ramage@yahoo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=nicholas.johnson-opensource@outlook.com.au \
    --cc=perex@perex.cz \
    --cc=steele.jamie1991@gmail.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®