浏览代码

Merge "asoc: codecs: Add delay to eliminate playback pause post SSR on hs"

qctecmdr 4 年之前
父节点
当前提交
51075bb60c
共有 4 个文件被更改,包括 32 次插入0 次删除
  1. 1 0
      asoc/codecs/wcd937x/internal.h
  2. 15 0
      asoc/codecs/wcd937x/wcd937x.c
  3. 1 0
      asoc/codecs/wcd938x/internal.h
  4. 15 0
      asoc/codecs/wcd938x/wcd938x.c

+ 1 - 0
asoc/codecs/wcd937x/internal.h

@@ -90,6 +90,7 @@ struct wcd937x_priv {
 	int ana_clk_count;
 	struct mutex ana_tx_clk_lock;
 	u8 tx_master_ch_map[WCD937X_MAX_SLAVE_CH_TYPES];
+	bool usbc_hs_status;
 };
 
 struct wcd937x_micbias_setting {

+ 15 - 0
asoc/codecs/wcd937x/wcd937x.c

@@ -1567,6 +1567,17 @@ static int wcd937x_get_logical_addr(struct swr_device *swr_dev)
 	return 0;
 }
 
+static bool get_usbc_hs_status(struct snd_soc_component *component,
+			struct wcd_mbhc_config *mbhc_cfg)
+{
+	if (mbhc_cfg->enable_usbc_analog) {
+		if (!(snd_soc_component_read32(component, WCD937X_ANA_MBHC_MECH)
+			& 0x20))
+			return true;
+	}
+	return false;
+}
+
 static int wcd937x_event_notify(struct notifier_block *block,
 				unsigned long val,
 				void *data)
@@ -1602,6 +1613,8 @@ static int wcd937x_event_notify(struct notifier_block *block,
 	case BOLERO_WCD_EVT_SSR_DOWN:
 		wcd937x->mbhc->wcd_mbhc.deinit_in_progress = true;
 		mbhc = &wcd937x->mbhc->wcd_mbhc;
+		wcd937x->usbc_hs_status = get_usbc_hs_status(component,
+						mbhc->mbhc_cfg);
 		wcd937x_mbhc_ssr_down(wcd937x->mbhc, component);
 		wcd937x_reset_low(wcd937x->dev);
 		break;
@@ -1622,6 +1635,8 @@ static int wcd937x_event_notify(struct notifier_block *block,
 				__func__);
 		} else {
 			wcd937x_mbhc_hs_detect(component, mbhc->mbhc_cfg);
+			if (wcd937x->usbc_hs_status)
+				mdelay(500);
 		}
 		wcd937x->mbhc->wcd_mbhc.deinit_in_progress = false;
 		break;

+ 1 - 0
asoc/codecs/wcd938x/internal.h

@@ -104,6 +104,7 @@ struct wcd938x_priv {
 	int ear_rx_path;
 	bool dev_up;
 	u8 tx_master_ch_map[WCD938X_MAX_SLAVE_CH_TYPES];
+	bool usbc_hs_status;
 };
 
 struct wcd938x_micbias_setting {

+ 15 - 0
asoc/codecs/wcd938x/wcd938x.c

@@ -1998,6 +1998,17 @@ static int wcd938x_get_logical_addr(struct swr_device *swr_dev)
 	return 0;
 }
 
+static bool get_usbc_hs_status(struct snd_soc_component *component,
+			struct wcd_mbhc_config *mbhc_cfg)
+{
+	if (mbhc_cfg->enable_usbc_analog) {
+		if (!(snd_soc_component_read32(component, WCD938X_ANA_MBHC_MECH)
+			& 0x20))
+			return true;
+	}
+	return false;
+}
+
 static int wcd938x_event_notify(struct notifier_block *block,
 				unsigned long val,
 				void *data)
@@ -2043,6 +2054,8 @@ static int wcd938x_event_notify(struct notifier_block *block,
 		wcd938x->dev_up = false;
 		wcd938x->mbhc->wcd_mbhc.deinit_in_progress = true;
 		mbhc = &wcd938x->mbhc->wcd_mbhc;
+		wcd938x->usbc_hs_status = get_usbc_hs_status(component,
+						mbhc->mbhc_cfg);
 		wcd938x_mbhc_ssr_down(wcd938x->mbhc, component);
 		wcd938x_reset_low(wcd938x->dev);
 		break;
@@ -2065,6 +2078,8 @@ static int wcd938x_event_notify(struct notifier_block *block,
 				__func__);
 		} else {
 			wcd938x_mbhc_hs_detect(component, mbhc->mbhc_cfg);
+			if (wcd938x->usbc_hs_status)
+				mdelay(500);
 		}
 		wcd938x->mbhc->wcd_mbhc.deinit_in_progress = false;
 		wcd938x->dev_up = true;