aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-03-07 19:17:56 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-03-08 13:56:30 -0500
commitc4ef87867b42bd1fa7d6dacaa28bf07cf741a724 (patch)
tree74b3f9a3820ec11c7e77433ca26f3c355cb54b85 /sound
parent4f333b20aef4459a24590fa8545e974f8f137f62 (diff)
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>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/soc-core.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 65ff61211a85..db3075dd11fe 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -505,6 +505,16 @@ static int soc_pcm_apply_symmetry(struct snd_pcm_substream *substream)
505 !rtd->dai_link->symmetric_rates) 505 !rtd->dai_link->symmetric_rates)
506 return 0; 506 return 0;
507 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
508 dev_dbg(&rtd->dev, "Symmetry forces %dHz rate\n", rtd->rate); 518 dev_dbg(&rtd->dev, "Symmetry forces %dHz rate\n", rtd->rate);
509 519
510 ret = snd_pcm_hw_constraint_minmax(substream->runtime, 520 ret = snd_pcm_hw_constraint_minmax(substream->runtime,