Bläddra i källkod

asoc: codec: enable wcd938x in blair platform

Enable wcd938x codec for blair and holi platforms.

Change-Id: I43f8feaace951ad439fcbba86204113b2b95330b
Signed-off-by: Sairam Peri<[email protected]>
Sairam Peri 1 år sedan
förälder
incheckning
54c237d468
2 ändrade filer med 33 tillägg och 15 borttagningar
  1. 19 9
      asoc/holi.c
  2. 14 6
      asoc/msm_holi_dailink.h

+ 19 - 9
asoc/holi.c

@@ -1302,6 +1302,7 @@ static int msm_rx_tx_codec_init(struct snd_soc_pcm_runtime *rtd)
 	struct snd_soc_component *bolero_component = NULL;
 	struct snd_soc_component *bolero_component = NULL;
 	struct snd_soc_component *component = NULL;
 	struct snd_soc_component *component = NULL;
 	struct snd_soc_dapm_context *dapm = NULL;
 	struct snd_soc_dapm_context *dapm = NULL;
+	bool is_wcd937x = false;
 	int ret = 0;
 	int ret = 0;
 	void *mbhc_calibration;
 	void *mbhc_calibration;
 	struct snd_info_entry *entry;
 	struct snd_info_entry *entry;
@@ -1352,13 +1353,14 @@ static int msm_rx_tx_codec_init(struct snd_soc_pcm_runtime *rtd)
 	bolero_info_create_codec_entry(pdata->codec_root, bolero_component);
 	bolero_info_create_codec_entry(pdata->codec_root, bolero_component);
 	bolero_register_wake_irq(bolero_component, false);
 	bolero_register_wake_irq(bolero_component, false);
 
 
-	component = snd_soc_rtdcom_lookup(rtd, WCD937X_DRV_NAME);
-	if (!component)
-		component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
-
+	component = snd_soc_rtdcom_lookup(rtd, WCD938X_DRV_NAME);
 	if (!component) {
 	if (!component) {
-		pr_err("%s component is NULL\n", __func__);
-		return -EINVAL;
+		component = snd_soc_rtdcom_lookup(rtd, WCD937X_DRV_NAME);
+		if (!component) {
+			pr_err("%s component is NULL\n", __func__);
+			return -EINVAL;
+		}
+		is_wcd937x = true;
 	}
 	}
 
 
 	dapm = snd_soc_component_get_dapm(component);
 	dapm = snd_soc_component_get_dapm(component);
@@ -1385,6 +1387,11 @@ static int msm_rx_tx_codec_init(struct snd_soc_pcm_runtime *rtd)
 		bolero_set_port_map(bolero_component,
 		bolero_set_port_map(bolero_component,
 			ARRAY_SIZE(sm_port_map),
 			ARRAY_SIZE(sm_port_map),
 			sm_port_map);
 			sm_port_map);
+	} else {
+		wcd938x_info_create_codec_entry(pdata->codec_root, component);
+		bolero_set_port_map(bolero_component,
+			ARRAY_SIZE(sm_port_map),
+			sm_port_map);
 	}
 	}
 
 
 	snd_soc_dapm_ignore_suspend(dapm, "EAR");
 	snd_soc_dapm_ignore_suspend(dapm, "EAR");
@@ -1401,13 +1408,16 @@ static int msm_rx_tx_codec_init(struct snd_soc_pcm_runtime *rtd)
         codec_reg_done = true;
         codec_reg_done = true;
         msm_common_dai_link_init(rtd);
         msm_common_dai_link_init(rtd);
 mbhc_cfg_cal:
 mbhc_cfg_cal:
-	if (!strncmp(component->driver->name, WCD937X_DRV_NAME, 13)) {
+
 		mbhc_calibration = def_wcd_mbhc_cal();
 		mbhc_calibration = def_wcd_mbhc_cal();
 		if (!mbhc_calibration)
 		if (!mbhc_calibration)
 			return -ENOMEM;
 			return -ENOMEM;
 		wcd_mbhc_cfg.calibration = mbhc_calibration;
 		wcd_mbhc_cfg.calibration = mbhc_calibration;
-		ret = wcd937x_mbhc_hs_detect(component, &wcd_mbhc_cfg);
-	}
+
+		if (!is_wcd937x)
+			ret = wcd938x_mbhc_hs_detect(component, &wcd_mbhc_cfg);
+		else
+			ret = wcd937x_mbhc_hs_detect(component, &wcd_mbhc_cfg);
 
 
 	if (ret) {
 	if (ret) {
 		dev_err(component->dev, "%s: mbhc hs detect failed, err:%d\n",
 		dev_err(component->dev, "%s: mbhc hs detect failed, err:%d\n",

+ 14 - 6
asoc/msm_holi_dailink.h

@@ -97,6 +97,7 @@ SND_SOC_DAILINK_DEFS(rx_dma_rx0,
 	DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
 	DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
 	DAILINK_COMP_ARRAY(COMP_CODEC("bolero-codec", "rx_macro_rx1"),
 	DAILINK_COMP_ARRAY(COMP_CODEC("bolero-codec", "rx_macro_rx1"),
 			   COMP_CODEC("wcd937x_codec", "wcd937x_cdc"),
 			   COMP_CODEC("wcd937x_codec", "wcd937x_cdc"),
+			   COMP_CODEC("wcd938x_codec", "wcd938x_cdc"),
 			   COMP_CODEC("wsa-codec0", "wsa_rx0")),
 			   COMP_CODEC("wsa-codec0", "wsa_rx0")),
 	DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
 	DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
 
 
@@ -104,43 +105,50 @@ SND_SOC_DAILINK_DEFS(rx_dma_rx1,
 	DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
 	DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
 	DAILINK_COMP_ARRAY(COMP_CODEC("bolero-codec", "rx_macro_rx2"),
 	DAILINK_COMP_ARRAY(COMP_CODEC("bolero-codec", "rx_macro_rx2"),
 			   COMP_CODEC("wcd937x_codec", "wcd937x_cdc"),
 			   COMP_CODEC("wcd937x_codec", "wcd937x_cdc"),
+			   COMP_CODEC("wcd938x_codec", "wcd938x_cdc"),
 			   COMP_CODEC("wsa-codec0", "wsa_rx0")),
 			   COMP_CODEC("wsa-codec0", "wsa_rx0")),
 	DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
 	DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
 
 
 SND_SOC_DAILINK_DEFS(rx_dma_rx2,
 SND_SOC_DAILINK_DEFS(rx_dma_rx2,
 	DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
 	DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
 	DAILINK_COMP_ARRAY(COMP_CODEC("bolero-codec", "rx_macro_rx3"),
 	DAILINK_COMP_ARRAY(COMP_CODEC("bolero-codec", "rx_macro_rx3"),
-			   COMP_CODEC("wcd937x_codec", "wcd937x_cdc")),
+			   COMP_CODEC("wcd937x_codec", "wcd937x_cdc"),
+			   COMP_CODEC("wcd938x_codec", "wcd938x_cdc")),
 	DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
 	DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
 
 
 SND_SOC_DAILINK_DEFS(rx_dma_rx3,
 SND_SOC_DAILINK_DEFS(rx_dma_rx3,
 	DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
 	DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
 	DAILINK_COMP_ARRAY(COMP_CODEC("bolero-codec", "rx_macro_rx4"),
 	DAILINK_COMP_ARRAY(COMP_CODEC("bolero-codec", "rx_macro_rx4"),
-			   COMP_CODEC("wcd937x_codec", "wcd937x_cdc")),
+			   COMP_CODEC("wcd937x_codec", "wcd937x_cdc"),
+			   COMP_CODEC("wcd938x_codec", "wcd938x_cdc")),
 	DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
 	DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
 
 
 SND_SOC_DAILINK_DEFS(rx_dma_rx5,
 SND_SOC_DAILINK_DEFS(rx_dma_rx5,
 	DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
 	DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
 	DAILINK_COMP_ARRAY(COMP_CODEC("bolero-codec", "rx_macro_rx5"),
 	DAILINK_COMP_ARRAY(COMP_CODEC("bolero-codec", "rx_macro_rx5"),
-			   COMP_CODEC("wcd937x_codec", "wcd937x_cdc")),
+			   COMP_CODEC("wcd937x_codec", "wcd937x_cdc"),
+			   COMP_CODEC("wcd938x_codec", "wcd938x_cdc")),
 	DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
 	DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
 
 
 SND_SOC_DAILINK_DEFS(rx_dma_rx6,
 SND_SOC_DAILINK_DEFS(rx_dma_rx6,
 	DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
 	DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
 	DAILINK_COMP_ARRAY(COMP_CODEC("bolero-codec", "rx_macro_rx6"),
 	DAILINK_COMP_ARRAY(COMP_CODEC("bolero-codec", "rx_macro_rx6"),
-			   COMP_CODEC("wcd937x_codec", "wcd937x_cdc")),
+			   COMP_CODEC("wcd937x_codec", "wcd937x_cdc"),
+			   COMP_CODEC("wcd938x_codec", "wcd938x_cdc")),
 	DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
 	DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
 
 
 SND_SOC_DAILINK_DEFS(tx_dma_tx3,
 SND_SOC_DAILINK_DEFS(tx_dma_tx3,
 	DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
 	DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
 	DAILINK_COMP_ARRAY(COMP_CODEC("bolero-codec", "tx_macro_tx1"),
 	DAILINK_COMP_ARRAY(COMP_CODEC("bolero-codec", "tx_macro_tx1"),
-			   COMP_CODEC("wcd937x_codec", "wcd937x_cdc")),
+			   COMP_CODEC("wcd937x_codec", "wcd937x_cdc"),
+			   COMP_CODEC("wcd938x_codec", "wcd938x_cdc")),
 	DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
 	DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
 
 
 SND_SOC_DAILINK_DEFS(tx_dma_tx4,
 SND_SOC_DAILINK_DEFS(tx_dma_tx4,
 	DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
 	DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
 	DAILINK_COMP_ARRAY(COMP_CODEC("bolero-codec", "tx_macro_tx2"),
 	DAILINK_COMP_ARRAY(COMP_CODEC("bolero-codec", "tx_macro_tx2"),
-			   COMP_CODEC("wcd937x_codec", "wcd937x_cdc")),
+			   COMP_CODEC("wcd937x_codec", "wcd937x_cdc"),
+			   COMP_CODEC("wcd938x_codec", "wcd938x_cdc")),
 	DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
 	DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
 
 
 SND_SOC_DAILINK_DEFS(va_dma_tx0,
 SND_SOC_DAILINK_DEFS(va_dma_tx0,