ALSA: pcm: rewrite snd_pcm_playback_silence()
authorOswald Buddenhagen <oswald.buddenhagen@gmx.de>
Thu, 20 Apr 2023 11:33:23 +0000 (13:33 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 21 Apr 2023 10:21:04 +0000 (12:21 +0200)
commit9f656705c5faa18afb26d922cfc64f9fd103c38d
treee3ded34bd862102da4bab1f1329e9a3f31e186a3
parent0d19bd4df75eee7df20377ffa2b62a4adedd19ff
ALSA: pcm: rewrite snd_pcm_playback_silence()

The auto-silencer supports two modes: "thresholded" to fill up "just
enough", and "top-up" to fill up "as much as possible". The two modes
used rather distinct code paths, which this patch unifies. The only
remaining distinction is how much we actually want to fill.

This fixes a bug in thresholded mode, where we failed to use new_hw_ptr,
resulting in under-fill.

Top-up mode is now more well-behaved and much easier to understand in
corner cases.

This also updates comments in the proximity of silencing-related data
structures.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20230420113324.877164-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Documentation/sound/kernel-api/writing-an-alsa-driver.rst
include/sound/pcm.h
include/uapi/sound/asound.h
sound/core/pcm_lib.c
sound/core/pcm_local.h
sound/core/pcm_native.c