From: Takashi Iwai <tiwai@suse.de>
To: Stian Halseth <stian@itx.no>
Cc: Takashi Iwai <tiwai@suse.com>, Jaroslav Kysela <perex@perex.cz>,
linux-sound@vger.kernel.org, sparclinux@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] ALSA: sparc: cs4231: Require an integer number of periods
Date: Wed, 02 Dec 2026 09:32:40 +0100 [thread overview]
Message-ID: <87v75cxetz.wl-tiwai@suse.de> (raw)
In-Reply-To: <20261201211514.1063429-1-stian@itx.no>
On Tue, 01 Dec 2026 22:15:14 +0100,
Stian Halseth wrote:
>
> The DMA engine is fed one period at a time. snd_cs4231_advance_dma()
> wraps after runtime->periods periods. Nothing requires the buffer to
> be a whole number of periods. When it is not, the DMA ring ends before
> the buffer does. The frames in the tail are never played. On capture,
> the tail is never filled.
>
> Any application that sets its own buffer and period sizes can hit
> this. Buffer and period times can also round to such sizes. A minimal
> case:
>
> aplay -D hw:0 -t raw -f S16_BE -c 2 -r 48000 \
> --buffer-size=8192 --period-size=2016 /dev/zero
>
> The DMA wraps after 8064 frames, but ALSA counts each wrap as a full
> pass of 8192 frames. On a Sun Ultra 5, hw_ptr in the substream's proc
> status advances 48781 frames/s, against 48020 with 2048-frame periods.
> With music the skipped frames are heard as distortion. This was found
> with Audacious, which picks such sizes by default on this card.
>
> Add the integer periods constraint, as other drivers that program DMA
> per period do.
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Closes: https://github.com/sparclinux/issues/issues/134
> Cc: stable@vger.kernel.org
> Signed-off-by: Stian Halseth <stian@itx.no>
Applied to for-next branch. Thanks.
Takashi
prev parent reply other threads:[~2026-12-02 8:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 21:15 [PATCH] ALSA: sparc: cs4231: Require an integer number of periods Stian Halseth
2026-12-02 8:32 ` Takashi Iwai [this message]
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=87v75cxetz.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=sparclinux@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=stian@itx.no \
--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