Răsfoiți Sursa

ASoC: davinci-mcasp: Do not allow multiple streams in one direction

Make sure that the user can not start multiple streams with the same
direction.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Peter Ujfalusi 9 ani în urmă
părinte
comite
1935736663
1 a modificat fișierele cu 6 adăugiri și 2 ștergeri
  1. 6 2
      sound/soc/davinci/davinci-mcasp.c

+ 6 - 2
sound/soc/davinci/davinci-mcasp.c

@@ -1230,11 +1230,15 @@ static int davinci_mcasp_startup(struct snd_pcm_substream *substream,
 	int i, dir;
 	int i, dir;
 	int tdm_slots = mcasp->tdm_slots;
 	int tdm_slots = mcasp->tdm_slots;
 
 
-	if (mcasp->tdm_mask[substream->stream])
-		tdm_slots = hweight32(mcasp->tdm_mask[substream->stream]);
+	/* Do not allow more then one stream per direction */
+	if (mcasp->substreams[substream->stream])
+		return -EBUSY;
 
 
 	mcasp->substreams[substream->stream] = substream;
 	mcasp->substreams[substream->stream] = substream;
 
 
+	if (mcasp->tdm_mask[substream->stream])
+		tdm_slots = hweight32(mcasp->tdm_mask[substream->stream]);
+
 	if (mcasp->op_mode == DAVINCI_MCASP_DIT_MODE)
 	if (mcasp->op_mode == DAVINCI_MCASP_DIT_MODE)
 		return 0;
 		return 0;