Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: vc4_services: bcm2835-audio: Add SNDRV_PCM_INFO_BATCH flag

Playing audio with PulseAudio and the bcm2835-pcm driver results
in distorted sound. Timer-based scheduling does not properly work
with bcm2835-pcm since configuring PulseAudio with tsched=0
avoids this problem.

Setting the SNDRV_PCM_INFO_BATCH flag prevents PulseAudio to use
timer-based scheduling by default. Settings this flag makes audio
works out of the box.

Based on: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7f2430cda819a9ecb1df5a0f3ef4f1c20db3f811

Signed-off-by: Dylan Van Assche <me@dylanvanassche.be>
Link: https://lore.kernel.org/r/20210127174348.10192-1-me@dylanvanassche.be
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Dylan Van Assche and committed by
Greg Kroah-Hartman
684ceb81 d730b1e1

+2 -2
+2 -2
drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
··· 12 12 static const struct snd_pcm_hardware snd_bcm2835_playback_hw = { 13 13 .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | 14 14 SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | 15 - SNDRV_PCM_INFO_SYNC_APPLPTR), 15 + SNDRV_PCM_INFO_SYNC_APPLPTR | SNDRV_PCM_INFO_BATCH), 16 16 .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, 17 17 .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, 18 18 .rate_min = 8000, ··· 29 29 static const struct snd_pcm_hardware snd_bcm2835_playback_spdif_hw = { 30 30 .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | 31 31 SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | 32 - SNDRV_PCM_INFO_SYNC_APPLPTR), 32 + SNDRV_PCM_INFO_SYNC_APPLPTR | SNDRV_PCM_INFO_BATCH), 33 33 .formats = SNDRV_PCM_FMTBIT_S16_LE, 34 34 .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_44100 | 35 35 SNDRV_PCM_RATE_48000,