ALSA: pcm: Add SNDRV_PCM_INFO_EXPLICIT_SYNC flag
authorTakashi Iwai <tiwai@suse.de>
Fri, 13 Aug 2021 08:21:42 +0000 (10:21 +0200)
committerTakashi Iwai <tiwai@suse.de>
Sat, 14 Aug 2021 06:38:25 +0000 (08:38 +0200)
commit81be10934949da8b12ca4db3de1511a4220fa9b4
tree282becbe725c64226c35fd947eaa9919f8a6b911
parent7ac2246f5670f42a3aac3eb05d23112f6ecfd4de
ALSA: pcm: Add SNDRV_PCM_INFO_EXPLICIT_SYNC flag

ALSA PCM core has an optimized way to communicate with user-space for
its control and status data via mmap on the supported architectures
like x86.  Depending on the situation, however, we'd rather want to
enforce user-space notifying the applptr or hwptr change explicitly
via ioctl.  For example, the upcoming non-contig and non-coherent
buffer handling would need an explicit sync, and this needs to catch
the applptr and hwptr changes.  Also, ASoC SOF driver will have the
SPIB support that has the similar requirement for the explicit control
of the applptr and hwptr.

This patch adds the new PCM hardware info flag,
SNDRV_PCM_INFO_EXPLICIT_SYNC.  When this flag is set, PCM core
disables both the control and the status mmap, which enforces
user-space to update via SYNC_PTR ioctl.  In that way, drivers can
catch the applptr and hwptr update and apply the sync operation if
needed.

Link: https://lore.kernel.org/r/20210812113818.6479-1-tiwai@suse.de
Link: https://lore.kernel.org/r/20210610205326.1176400-1-pierre-louis.bossart@linux.intel.com
Link: https://lore.kernel.org/r/20210813082142.5375-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
include/uapi/sound/asound.h
sound/core/pcm_native.c