msm-pcm-lpa: 8960: Issue EOS to DSP after playback is complete

Issue an EOS command to ensure that dsp is completely flushed
before closing the stream. This command is only issued if the
the routing is still enabled.

Change-Id: Id36f2b1a2e5e3fef5dcde759277f3ca4417c17e7
CRs-Fixed: 331532
Signed-off-by: Tejas Shikhare <tshikhar@codeaurora.org>
diff --git a/sound/soc/msm/msm-pcm-routing.c b/sound/soc/msm/msm-pcm-routing.c
index 8b6b5f1..f99cf6e 100644
--- a/sound/soc/msm/msm-pcm-routing.c
+++ b/sound/soc/msm/msm-pcm-routing.c
@@ -1636,6 +1636,23 @@
 	.remove = __devexit_p(msm_routing_pcm_remove),
 };
 
+int msm_routing_check_backend_enabled(int fedai_id)
+{
+	int i;
+	if (fedai_id >= MSM_FRONTEND_DAI_MM_MAX_ID) {
+		/* bad ID assigned in machine driver */
+		pr_err("%s: bad MM ID\n", __func__);
+		return 0;
+	}
+	for (i = 0; i < MSM_BACKEND_DAI_MAX; i++) {
+		if ((test_bit(fedai_id,
+			&msm_bedais[i].fe_sessions))) {
+			return msm_bedais[i].active;
+		}
+	}
+	return 0;
+}
+
 static int __init msm_soc_routing_platform_init(void)
 {
 	mutex_init(&routing_lock);