Message ID | 20250314143220.6215-5-srinivas.kandagatla@linaro.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | ASoC: q6apm: fix under runs and fragment sizes | expand |
On Fri, Mar 14, 2025 at 02:32:19PM +0000, Srinivas Kandagatla wrote: > From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> > > DSP expects the periods to be aligned to fragment sizes, currently > setting up to hw constriants on periods bytes is not going to work > correctly as we can endup with periods sizes aligned to 32 bytes however > not aligned to fragment size. > > Update the constriants to use fragment size, and also set at step of > 10ms for period size to accommodate DSP requirements of 10ms latency. > > Fixes: 9b4fe0f1cd79 ("ASoC: qdsp6: audioreach: add q6apm-dai support") For all of the patches, if the intention is that they should be backported to stable they should have a CC stable tag here. > Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> > --- > sound/soc/qcom/qdsp6/q6apm-dai.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/sound/soc/qcom/qdsp6/q6apm-dai.c b/sound/soc/qcom/qdsp6/q6apm-dai.c > index 90cb24947f31..a636f9280645 100644 > --- a/sound/soc/qcom/qdsp6/q6apm-dai.c > +++ b/sound/soc/qcom/qdsp6/q6apm-dai.c > @@ -231,7 +231,6 @@ static int q6apm_dai_prepare(struct snd_soc_component *component, > cfg.bit_width = prtd->bits_per_sample; > cfg.fmt = SND_AUDIOCODEC_PCM; > audioreach_set_default_channel_mapping(cfg.channel_map, runtime->channels); > - nit: unrelated change > if (prtd->state) { > /* clear the previous setup if any */ > q6apm_graph_stop(prtd->graph); Johan
On 14/03/2025 16:46, Johan Hovold wrote: > On Fri, Mar 14, 2025 at 02:32:19PM +0000, Srinivas Kandagatla wrote: >> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> >> >> DSP expects the periods to be aligned to fragment sizes, currently >> setting up to hw constriants on periods bytes is not going to work >> correctly as we can endup with periods sizes aligned to 32 bytes however >> not aligned to fragment size. >> >> Update the constriants to use fragment size, and also set at step of >> 10ms for period size to accommodate DSP requirements of 10ms latency. >> >> Fixes: 9b4fe0f1cd79 ("ASoC: qdsp6: audioreach: add q6apm-dai support") > > For all of the patches, if the intention is that they should be > backported to stable they should have a CC stable tag here. Ideally yes. It would nice to get these back ported to stable. > >> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> >> --- >> sound/soc/qcom/qdsp6/q6apm-dai.c | 6 +++--- >> 1 file changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/sound/soc/qcom/qdsp6/q6apm-dai.c b/sound/soc/qcom/qdsp6/q6apm-dai.c >> index 90cb24947f31..a636f9280645 100644 >> --- a/sound/soc/qcom/qdsp6/q6apm-dai.c >> +++ b/sound/soc/qcom/qdsp6/q6apm-dai.c >> @@ -231,7 +231,6 @@ static int q6apm_dai_prepare(struct snd_soc_component *component, >> cfg.bit_width = prtd->bits_per_sample; >> cfg.fmt = SND_AUDIOCODEC_PCM; >> audioreach_set_default_channel_mapping(cfg.channel_map, runtime->channels); >> - > > nit: unrelated change Fixed in v5. --srini > >> if (prtd->state) { >> /* clear the previous setup if any */ >> q6apm_graph_stop(prtd->graph); > > Johan
diff --git a/sound/soc/qcom/qdsp6/q6apm-dai.c b/sound/soc/qcom/qdsp6/q6apm-dai.c index 90cb24947f31..a636f9280645 100644 --- a/sound/soc/qcom/qdsp6/q6apm-dai.c +++ b/sound/soc/qcom/qdsp6/q6apm-dai.c @@ -231,7 +231,6 @@ static int q6apm_dai_prepare(struct snd_soc_component *component, cfg.bit_width = prtd->bits_per_sample; cfg.fmt = SND_AUDIOCODEC_PCM; audioreach_set_default_channel_mapping(cfg.channel_map, runtime->channels); - if (prtd->state) { /* clear the previous setup if any */ q6apm_graph_stop(prtd->graph); @@ -385,13 +384,14 @@ static int q6apm_dai_open(struct snd_soc_component *component, } } - ret = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 32); + /* setup 10ms latency to accommodate DSP restrictions */ + ret = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 480); if (ret < 0) { dev_err(dev, "constraint for period bytes step ret = %d\n", ret); goto err; } - ret = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 32); + ret = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, 480); if (ret < 0) { dev_err(dev, "constraint for buffer bytes step ret = %d\n", ret); goto err;