Message ID | 20220301113446.1053171-1-s.hauer@pengutronix.de (mailing list archive) |
---|---|
State | Accepted |
Commit | 300689fb04b3f23c1ac1abfe960b48ec414df597 |
Headers | show |
Series | ASoC: soc-generic-dmaengine-pcm: set period_bytes_min based on maxburst | expand |
On Tue, 1 Mar 2022 12:34:46 +0100, Sascha Hauer wrote: > In dmaengine_pcm_set_runtime_hwparams() period_bytes_min is hardcoded to > 256. For some applications that may be too big. This patch changes that > to calculate the value based on dma_data->maxburst. The correct value > would be maxburst multiplied by the address width of the hardware FIFO. > Unfortunately the address width is dynamically calculated based on the > stream parameters and is not known at open time, so the worst case > is chosen here which is 8 bytes, the maximum that is supported by > dmaengine drivers. > Not all drivers may set a maxburst value, so we fall back to the > previously used hardcoded value of 256 bytes. > > [...] Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next Thanks! [1/1] ASoC: soc-generic-dmaengine-pcm: set period_bytes_min based on maxburst commit: 300689fb04b3f23c1ac1abfe960b48ec414df597 All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark
diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c index 99253de29a74e..734d46b9783f7 100644 --- a/sound/soc/soc-generic-dmaengine-pcm.c +++ b/sound/soc/soc-generic-dmaengine-pcm.c @@ -122,7 +122,9 @@ dmaengine_pcm_set_runtime_hwparams(struct snd_soc_component *component, SNDRV_PCM_INFO_INTERLEAVED; hw.periods_min = 2; hw.periods_max = UINT_MAX; - hw.period_bytes_min = 256; + hw.period_bytes_min = dma_data->maxburst * DMA_SLAVE_BUSWIDTH_8_BYTES; + if (!hw.period_bytes_min) + hw.period_bytes_min = 256; hw.period_bytes_max = dma_get_max_seg_size(dma_dev); hw.buffer_bytes_max = SIZE_MAX; hw.fifo_size = dma_data->fifo_size;
In dmaengine_pcm_set_runtime_hwparams() period_bytes_min is hardcoded to 256. For some applications that may be too big. This patch changes that to calculate the value based on dma_data->maxburst. The correct value would be maxburst multiplied by the address width of the hardware FIFO. Unfortunately the address width is dynamically calculated based on the stream parameters and is not known at open time, so the worst case is chosen here which is 8 bytes, the maximum that is supported by dmaengine drivers. Not all drivers may set a maxburst value, so we fall back to the previously used hardcoded value of 256 bytes. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- sound/soc/soc-generic-dmaengine-pcm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)