Skip to content

Commit

Permalink
ASoC: bcm2835-i2s: Set the PERIOD_BYTES min to 256
Browse files Browse the repository at this point in the history
Commit [1] set the minimum PERIOD_BYTES value to the product of the DMA
burst size and 8. For the I2S interface on BCM2835 that equates to 16
where it used to be 256. ffmpeg uses the minimum value as its preferred
value, leading to many, many very small periods, which affects
performance and leads to complaints about DTS timestamps.

Restore the previous behaviour and performance by making the bcm2835-i2s
driver set a minimum PERIOD_BYTES value of 256.

Link: #5709

[1] 300689f ("ASoC: soc-generic-dmaengine-pcm: set
period_bytes_min based on maxburst")

Signed-off-by: Phil Elwell <[email protected]>
  • Loading branch information
pelwell authored and popcornmix committed Nov 18, 2024
1 parent 14eca0a commit 7e84b80
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sound/soc/bcm/bcm2835-i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,10 @@ static int bcm2835_i2s_prepare(struct snd_pcm_substream *substream,
struct bcm2835_i2s_dev *dev = snd_soc_dai_get_drvdata(dai);
uint32_t cs_reg;

snd_pcm_hw_constraint_minmax(substream->runtime,
SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 256,
~0);

/*
* Clear both FIFOs if the one that should be started
* is not empty at the moment. This should only happen
Expand Down Expand Up @@ -700,6 +704,10 @@ static int bcm2835_i2s_startup(struct snd_pcm_substream *substream,
/* Should this still be running stop it */
bcm2835_i2s_stop_clock(dev);

snd_pcm_hw_constraint_minmax(substream->runtime,
SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
256, ~0);

/* Enable PCM block */
regmap_update_bits(dev->i2s_regmap, BCM2835_I2S_CS_A_REG,
BCM2835_I2S_EN, BCM2835_I2S_EN);
Expand Down

0 comments on commit 7e84b80

Please sign in to comment.