summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorAlan Tull <alan.tull@freescale.com>2010-10-13 17:52:58 -0500
committerJustin Waters <justin.waters@timesys.com>2010-12-13 16:10:32 -0500
commit0e4073b1476d8e2df53de821f42945ec07a19df2 (patch)
tree40f8c5cc461d159824a1424854e273f93263bdf7 /sound
parent7fc29f8a14ac8c220e16aa1b2e2a87cc2f80ad5e (diff)
ENGR00132153 sgtl5000: do not enforce symmetry if rate is unknown
If a playback and a record stream are started together, the alsa userspace may not not do the necessary ioctl calls for the audio driver stack to know the sample rate and sample size of the first stream before starting the second stream, i.e.: arecord -D plughw:0 -d 10 -f S16_LE -r 44100 -c 2 -traw | aplay -D plughw:0 -f S16_LE -r 44100 -c 2 -traw Normally we want to the driver to make sure that the second stream does not request a different playback rate/bit size from the first stream. But at that point, the driver thinks that the sample rate and sample size are 0. So in that case do not enforce constraints. This still allows for usecases where play is started first and then record is started after a delay while playback continues. Signed-off-by: Alan Tull <alan.tull@freescale.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/sgtl5000.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index 6e4bf1e3cd63..bb94c65244f1 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -537,13 +537,23 @@ static int sgtl5000_pcm_startup(struct snd_pcm_substream *substream,
if (sgtl5000->master_substream) {
master_runtime = sgtl5000->master_substream->runtime;
- pr_debug("Constraining to %d bits\n",
- master_runtime->sample_bits);
+ if (master_runtime->rate != 0) {
+ pr_debug("Constraining to %dHz\n",
+ master_runtime->rate);
+ snd_pcm_hw_constraint_minmax(substream->runtime,
+ SNDRV_PCM_HW_PARAM_RATE,
+ master_runtime->rate,
+ master_runtime->rate);
+ }
- snd_pcm_hw_constraint_minmax(substream->runtime,
- SNDRV_PCM_HW_PARAM_SAMPLE_BITS,
- master_runtime->sample_bits,
- master_runtime->sample_bits);
+ if (master_runtime->sample_bits != 0) {
+ pr_debug("Constraining to %d bits\n",
+ master_runtime->sample_bits);
+ snd_pcm_hw_constraint_minmax(substream->runtime,
+ SNDRV_PCM_HW_PARAM_SAMPLE_BITS,
+ master_runtime->sample_bits,
+ master_runtime->sample_bits);
+ }
sgtl5000->slave_substream = substream;
} else
@@ -935,7 +945,6 @@ struct snd_soc_dai sgtl5000_dai = {
.formats = SGTL5000_FORMATS,
},
.ops = &sgtl5000_ops,
- .symmetric_rates = 1,
};
EXPORT_SYMBOL_GPL(sgtl5000_dai);