]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ALSA: aloop: Introduce a function to get if access is interleaved mode
authorChancel Liu <chancel.liu@nxp.com>
Thu, 11 Jan 2024 02:52:19 +0000 (11:52 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jan 2024 23:45:26 +0000 (15:45 -0800)
commit86778b7b9ffee8aa47eecb98cdaecf3cfdfac2f6
tree59674c2d54ae48f0e5b3c4bb0c6ba663e569a6d7
parentaec366faed8cb743efe0e233d9586d72e1443e46
ALSA: aloop: Introduce a function to get if access is interleaved mode

[ Upstream commit cdac6e1f716419ce307ad3e44a718557a5469c17 ]

There's a use case that playback stream of a loopback cable works on
RW_INTERLEAVED mode while capture stream works on MMAP_INTERLEAVED mode:

aplay -Dhw:Loopback,0,0 S32_48K_2ch.wav;
arecord -Dplughw:Loopback,1,0 -fS32_LE -r16000 -c2 cap.wav;

The plug plugin handles only slave PCM support MMAP mode. Not only plug
plugin but also other plugins like direct plugins(dmix/dsnoop/dshare)
work on MMAP access mode. In this case capture stream is the slave
PCM works on MMAP_INTERLEAVED mode. However loopback_check_format()
rejects this access setting and return:

arecord: pcm_read:2240: read error: Input/output error

To fix it a function called is_access_interleaved() is introduced to
get if access is interleaved mode. If both access of capture stream and
playback stream is interleaved mode loopback_check_format() will allow
this kind of access setting.

Fixes: 462494565c27 ("ALSA: aloop: Add support for the non-interleaved access mode")
Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
Link: https://lore.kernel.org/r/20240111025219.2678764-1-chancel.liu@nxp.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/drivers/aloop.c