ASoC: msm: Fix for proxy port open failure in WFD session
When playback is paused and proxy device disabled, afe is
not closed. This results in failure of proxy port open in the second
iteration. Fix the same by closing and opening the proxy.
Change-Id: Idfa94e5756d87e59dc0101fd688d6accfe6287e7
CRs-Fixed: 447001
CRs-Fixed: 446504
Signed-off-by: Satya Krishna Pindiproli <satyak@codeaurora.org>
diff --git a/sound/soc/msm/qdsp6/q6afe.c b/sound/soc/msm/qdsp6/q6afe.c
index 0edcde0..dd6dfb6 100644
--- a/sound/soc/msm/qdsp6/q6afe.c
+++ b/sound/soc/msm/qdsp6/q6afe.c
@@ -40,6 +40,7 @@
static struct acdb_cal_block afe_cal_addr[MAX_AUDPROC_TYPES];
static int pcm_afe_instance[2];
static int proxy_afe_instance[2];
+bool afe_close_done[2] = {true, true};
#define TIMEOUT_MS 1000
#define Q6AFE_MAX_VOLUME 0x3FFF
@@ -451,7 +452,7 @@
if ((port_id == RT_PROXY_DAI_001_RX) ||
(port_id == RT_PROXY_DAI_002_TX)) {
pr_debug("%s: before incrementing pcm_afe_instance %d"\
- "port_id %d\n", __func__,
+ " port_id %d\n", __func__,
pcm_afe_instance[port_id & 0x1], port_id);
port_id = VIRTUAL_ID_TO_PORTID(port_id);
pcm_afe_instance[port_id & 0x1]++;
@@ -460,10 +461,17 @@
if ((port_id == RT_PROXY_DAI_002_RX) ||
(port_id == RT_PROXY_DAI_001_TX)) {
pr_debug("%s: before incrementing proxy_afe_instance %d"\
- "port_id %d\n", __func__,
+ " port_id %d\n", __func__,
proxy_afe_instance[port_id & 0x1], port_id);
- port_id = VIRTUAL_ID_TO_PORTID(port_id);
+ if (!afe_close_done[port_id & 0x1]) {
+ /*close pcm dai corresponding to the proxy dai*/
+ afe_close(port_id - 0x10);
+ pcm_afe_instance[port_id & 0x1]++;
+ pr_debug("%s: reconfigure afe port again\n", __func__);
+ }
proxy_afe_instance[port_id & 0x1]++;
+ afe_close_done[port_id & 0x1] = false;
+ port_id = VIRTUAL_ID_TO_PORTID(port_id);
}
ret = afe_q6_interface_prepare();
@@ -1723,6 +1731,8 @@
if (!(pcm_afe_instance[port_id & 0x1] == 0 &&
proxy_afe_instance[port_id & 0x1] == 0))
return 0;
+ else
+ afe_close_done[port_id & 0x1] = true;
}
if ((port_id == RT_PROXY_DAI_002_RX) ||
@@ -1734,6 +1744,8 @@
if (!(pcm_afe_instance[port_id & 0x1] == 0 &&
proxy_afe_instance[port_id & 0x1] == 0))
return 0;
+ else
+ afe_close_done[port_id & 0x1] = true;
}
port_id = afe_convert_virtual_to_portid(port_id);