ASoC: DSP: Connect FE->BE links if FE is active

Connect FE->BE links only if the corresponding FE is active,
otherwise BEs associated to inactive FEs can startup with
invalid runtime data.

For example, FE-1 -> BE-1 playback link is running, in the
meantime FE-2 -> BE-2 capture link gets enabled through
muxs/mixers but no capture stream is actually opened,
BE-2 could be incorrectly started if FE-2 -> BE-2 link
is connected even though BE type is not even for the same
stream direction as active stream.

Change-Id: I3534914535d6ea2a39bdb26b0646b199b1e2742d
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
diff --git a/sound/soc/soc-dsp.c b/sound/soc/soc-dsp.c
index eeff293..9323b57 100644
--- a/sound/soc/soc-dsp.c
+++ b/sound/soc/soc-dsp.c
@@ -187,6 +187,10 @@
 				continue;
 			}
 
+			/* don't connect if FE is not running */
+			if (!fe->dsp[stream].runtime)
+				continue;
+
 			/* newly connected FE and BE */
 			err = be_connect(fe, be, stream);
 			if (err < 0) {
@@ -1483,6 +1487,8 @@
 
 	be_disconnect(fe, fe_substream->stream);
 
+	fe->dsp[fe_substream->stream].runtime = NULL;
+
 	return ret;
 }