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

ASoC: Warn rather than set a silly constraint when we can't do symmetry

Symmetric rate configuration can fail if the second stream starting tries
to apply the symmetric constraint before the first stream has got far
enough to pick a rate. Rather than try to enforce a nonsensical rate of
0Hz log a warning and allow the application to carry on. Things might go
wrong later on but the user will know about it and there's unlikely to be
lasting damage.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>

+10
+10
sound/soc/soc-core.c
··· 505 !rtd->dai_link->symmetric_rates) 506 return 0; 507 508 dev_dbg(&rtd->dev, "Symmetry forces %dHz rate\n", rtd->rate); 509 510 ret = snd_pcm_hw_constraint_minmax(substream->runtime,
··· 505 !rtd->dai_link->symmetric_rates) 506 return 0; 507 508 + /* This can happen if multiple streams are starting simultaneously - 509 + * the second can need to get its constraints before the first has 510 + * picked a rate. Complain and allow the application to carry on. 511 + */ 512 + if (!rtd->rate) { 513 + dev_warn(&rtd->dev, 514 + "Not enforcing symmetric_rates due to race\n"); 515 + return 0; 516 + } 517 + 518 dev_dbg(&rtd->dev, "Symmetry forces %dHz rate\n", rtd->rate); 519 520 ret = snd_pcm_hw_constraint_minmax(substream->runtime,