Browse Source

asoc: codecs: Increase timeout for session close during SSR/PDR

Userspace takes 10 seconds to close the session when
pcm_start fails due to concurrency with PDR/SSR.
Match the SSR timeout in va macro to user space
session tear down delay.

Change-Id: I1e0fb4bdb25a43cbe7c345a47c115410b964e6eb
Signed-off-by: Aditya Bavanari <[email protected]>
Aditya Bavanari 6 years ago
parent
commit
ce4f3d9b59
1 changed files with 9 additions and 6 deletions
  1. 9 6
      asoc/codecs/bolero/va-macro.c

+ 9 - 6
asoc/codecs/bolero/va-macro.c

@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0-only
-/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
  */
 
 #include <linux/module.h>
@@ -41,7 +41,7 @@
 #define VA_MACRO_TX_DMIC_CLK_DIV_SHFT 0x01
 
 #define BOLERO_CDC_VA_TX_UNMUTE_DELAY_MS	40
-#define MAX_RETRY_ATTEMPTS 250
+#define MAX_RETRY_ATTEMPTS 500
 
 static const DECLARE_TLV_DB_SCALE(digital_gain, 0, 1, 0);
 static int va_tx_unmute_delay = BOLERO_CDC_VA_TX_UNMUTE_DELAY_MS;
@@ -225,12 +225,15 @@ static int va_macro_event_handler(struct snd_soc_component *component,
 	switch (event) {
 	case BOLERO_MACRO_EVT_WAIT_VA_CLK_RESET:
 		while ((va_priv->va_mclk_users != 0) && (retry_cnt != 0)) {
-			dev_dbg(va_dev, "%s:retry_cnt: %d\n",
+			dev_dbg_ratelimited(va_dev, "%s:retry_cnt: %d\n",
 				__func__, retry_cnt);
 			/*
-			 * loop and check every 20ms for va_mclk user count
-			 * to get reset to 0 which ensures userspace teardown
-			 * is done and SSR powerup seq can proceed.
+			 * Userspace takes 10 seconds to close
+			 * the session when pcm_start fails due to concurrency
+			 * with PDR/SSR. Loop and check every 20ms till 10
+			 * seconds for va_mclk user count to get reset to 0
+			 * which ensures userspace teardown is done and SSR
+			 * powerup seq can proceed.
 			 */
 			msleep(20);
 			retry_cnt--;