From 04a408ed3c9a9a7c3819f4b954e41aa3681d038b Mon Sep 17 00:00:00 2001
From: Ravi Kumar Alamanda <ralama@codeaurora.org>
Date: Fri, 6 Mar 2015 17:11:21 -0800
Subject: [PATCH] ASoC: msm: qdsp6v2: Restrict capture path to LL mode

ULL mode is not supported in capture path.

Bug: 19230391
Signed-off-by: Ravi Kumar Alamanda <ralama@codeaurora.org>
---
 sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c      | 15 ++++++++++-----
 sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c |  6 +++---
 sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.h |  6 +++---
 3 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c b/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c
index 5f18a1b4649b..1a1cc7977f53 100644
--- a/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c
+++ b/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -342,11 +342,16 @@ static int msm_pcm_capture_prepare(struct snd_pcm_substream *substream)
 	if (params_format(params) == SNDRV_PCM_FORMAT_S24_LE)
 		bits_per_sample = 24;
 
-	prtd->audio_client->perf_mode = pdata->perf_mode;
-	pr_debug("%s: perf_mode: 0x%x\n", __func__, pdata->perf_mode);
+	/* ULL mode is not supported in capture path */
+	if (pdata->perf_mode == LEGACY_PCM_MODE)
+		prtd->audio_client->perf_mode = LEGACY_PCM_MODE;
+	else
+		prtd->audio_client->perf_mode = LOW_LATENCY_PCM_MODE;
+
+	pr_debug("%s Opening %d-ch PCM read stream, perf_mode %d\n",
+			__func__, params_channels(params),
+			prtd->audio_client->perf_mode);
 
-	pr_debug("%s Opening %d-ch PCM read stream\n",
-			__func__, params_channels(params));
 	ret = q6asm_open_read_v2(prtd->audio_client, FORMAT_LINEAR_PCM,
 			bits_per_sample);
 	if (ret < 0) {
diff --git a/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c b/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c
index 288187de8780..bccb2a432418 100644
--- a/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c
+++ b/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -408,7 +408,7 @@ void msm_pcm_routing_reg_psthr_stream(int fedai_id, int dspst_id,
 	mutex_unlock(&routing_lock);
 }
 
-void msm_pcm_routing_reg_phy_compr_stream(int fedai_id, bool perf_mode,
+void msm_pcm_routing_reg_phy_compr_stream(int fedai_id, int perf_mode,
 					  int dspst_id, int stream_type,
 					  uint32_t compr_passthr_mode)
 {
@@ -581,7 +581,7 @@ void msm_pcm_routing_reg_phy_stream(int fedai_id, int perf_mode,
 	mutex_unlock(&routing_lock);
 }
 
-void msm_pcm_routing_reg_phy_stream_v2(int fedai_id, bool perf_mode,
+void msm_pcm_routing_reg_phy_stream_v2(int fedai_id, int perf_mode,
 				       int dspst_id, int stream_type,
 				       struct msm_pcm_routing_evt event_info)
 {
diff --git a/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.h b/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.h
index 5e7a8cc870ec..cc5bc016dc2e 100644
--- a/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.h
+++ b/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -207,11 +207,11 @@ void msm_pcm_routing_reg_phy_stream(int fedai_id, int perf_mode, int dspst_id,
 	int stream_type);
 void msm_pcm_routing_reg_psthr_stream(int fedai_id, int dspst_id,
 		int stream_type);
-void msm_pcm_routing_reg_phy_compr_stream(int fedai_id, bool perf_mode,
+void msm_pcm_routing_reg_phy_compr_stream(int fedai_id, int perf_mode,
 					  int dspst_id, int stream_type,
 					  uint32_t compr_passthr);
 
-void msm_pcm_routing_reg_phy_stream_v2(int fedai_id, bool perf_mode,
+void msm_pcm_routing_reg_phy_stream_v2(int fedai_id, int perf_mode,
 				       int dspst_id, int stream_type,
 				       struct msm_pcm_routing_evt event_info);
 
-- 
GitLab