ASoC: msm: Enable msm8952 machine driver for msm8905

Enable machine_int_dlkm for msm8905 to use msm8952
machine driver.

Change-Id: I07e518b9815d034d2bb035be943e513767638631
diff --git a/asoc/Android.mk b/asoc/Android.mk
index ffbfc86..2eac43f 100644
--- a/asoc/Android.mk
+++ b/asoc/Android.mk
@@ -25,6 +25,11 @@
 AUDIO_SELECT  += CONFIG_SND_SOC_8909_DIG_CDC=m
 endif
 
+ifeq ($(strip $(TARGET_ROARING_LIONUS)),true)
+TARGET := msm8909
+AUDIO_SELECT  += CONFIG_MSM_8905=m
+endif
+
 AUDIO_CHIPSET := audio
 # Build/Package only in case of supported target
 ifeq ($(call is-board-platform-in-list,msm8909 msm8953 msm8937 sdm845 sdm710 qcs605),true)
@@ -108,6 +113,16 @@
 include $(DLKM_DIR)/AndroidKernelModule.mk
 endif
 ###########################################################
+ifeq ($(strip $(TARGET_ROARING_LIONUS)),true)
+include $(CLEAR_VARS)
+LOCAL_MODULE              := $(AUDIO_CHIPSET)_machine_int_$(TARGET).ko
+LOCAL_MODULE_KBUILD_NAME  := machine_int_dlkm.ko
+LOCAL_MODULE_TAGS         := optional
+LOCAL_MODULE_DEBUG_ENABLE := true
+LOCAL_MODULE_PATH         := $(KERNEL_MODULES_OUT)
+include $(DLKM_DIR)/AndroidKernelModule.mk
+endif
+###########################################################
 
 endif # DLKM check
 endif # supported target check
diff --git a/asoc/Kbuild b/asoc/Kbuild
index 8a3d78b..be1a8de 100644
--- a/asoc/Kbuild
+++ b/asoc/Kbuild
@@ -41,9 +41,16 @@
 		INCS    +=  -include $(AUDIO_ROOT)/config/sdxpoorwillsautoconf.h
 	endif
 	ifeq ($(CONFIG_ARCH_MSM8909), y)
-		include $(AUDIO_ROOT)/config/msm8909auto.conf
-		export
-		INCS    +=  -include $(AUDIO_ROOT)/config/msm8909autoconf.h
+		ifeq ($(CONFIG_MSM_BGCOM), y)
+			include $(AUDIO_ROOT)/config/msm8909auto.conf
+			export
+			INCS    +=  -include $(AUDIO_ROOT)/config/msm8909autoconf.h
+		endif
+		ifeq ($(CONFIG_MSM_8905), m)
+			include $(AUDIO_ROOT)/config/msm8905auto.conf
+			export
+			INCS    +=  -include $(AUDIO_ROOT)/config/msm8905autoconf.h
+		endif
 	endif
 	ifeq ($(CONFIG_ARCH_MSM8917), y)
 		include $(AUDIO_ROOT)/config/sdm450auto.conf
diff --git a/asoc/codecs/Android.mk b/asoc/codecs/Android.mk
index ae7c7fe..b284aaa 100644
--- a/asoc/codecs/Android.mk
+++ b/asoc/codecs/Android.mk
@@ -16,11 +16,15 @@
 AUDIO_SELECT  += CONFIG_SND_SOC_EXT_CODEC_SDM450=m
 endif
 
-ifeq ($(call is-board-platform-in-list,msm8909),true)
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_DLKM_8909W)),true)
 AUDIO_SELECT  += CONFIG_SND_SOC_BG_8909=m
 AUDIO_SELECT  += CONFIG_SND_SOC_8909_DIG_CDC=m
 endif
 
+ifeq ($(strip $(TARGET_ROARING_LIONUS)),true)
+AUDIO_SELECT  += CONFIG_MSM_8905=m
+endif
+
 AUDIO_CHIPSET := audio
 # Build/Package only in case of supported target
 ifeq ($(call is-board-platform-in-list,msm8909 msm8953 msm8937 sdm845 sdm710 qcs605),true)
diff --git a/asoc/codecs/Kbuild b/asoc/codecs/Kbuild
index d2984b9..548bab1 100644
--- a/asoc/codecs/Kbuild
+++ b/asoc/codecs/Kbuild
@@ -35,9 +35,16 @@
 		INCS    +=  -include $(AUDIO_ROOT)/config/sdm450autoconf.h
 	endif
 	ifeq ($(CONFIG_ARCH_MSM8909), y)
-		include $(AUDIO_ROOT)/config/msm8909auto.conf
-		export
-		INCS    +=  -include $(AUDIO_ROOT)/config/msm8909autoconf.h
+		ifeq ($(CONFIG_MSM_BGCOM), y)
+			include $(AUDIO_ROOT)/config/msm8909auto.conf
+			export
+			INCS    +=  -include $(AUDIO_ROOT)/config/msm8909autoconf.h
+		endif
+		ifeq ($(CONFIG_MSM_8905), m)
+			include $(AUDIO_ROOT)/config/msm8905auto.conf
+			export
+			INCS    +=  -include $(AUDIO_ROOT)/config/msm8905autoconf.h
+		endif
 	endif
 	ifeq ($(CONFIG_ARCH_MSM8917), y)
 		include $(AUDIO_ROOT)/config/sdm450auto.conf
diff --git a/asoc/codecs/sdm660_cdc/Kbuild b/asoc/codecs/sdm660_cdc/Kbuild
index 04bee2c..13a1361 100644
--- a/asoc/codecs/sdm660_cdc/Kbuild
+++ b/asoc/codecs/sdm660_cdc/Kbuild
@@ -41,9 +41,16 @@
 		INCS    +=  -include $(AUDIO_ROOT)/config/sdm450autoconf.h
 	endif
 	ifeq ($(CONFIG_ARCH_MSM8909), y)
-		include $(AUDIO_ROOT)/config/msm8909auto.conf
-		export
-		INCS    +=  -include $(AUDIO_ROOT)/config/msm8909autoconf.h
+		ifeq ($(CONFIG_MSM_BGCOM), y)
+			include $(AUDIO_ROOT)/config/msm8909auto.conf
+			export
+			INCS    +=  -include $(AUDIO_ROOT)/config/msm8909autoconf.h
+		endif
+		ifeq ($(CONFIG_MSM_8905), m)
+			include $(AUDIO_ROOT)/config/msm8905auto.conf
+			export
+			INCS    +=  -include $(AUDIO_ROOT)/config/msm8905autoconf.h
+		endif
 	endif
 endif
 
diff --git a/asoc/msm8952.c b/asoc/msm8952.c
index 44db613..27216ec 100644
--- a/asoc/msm8952.c
+++ b/asoc/msm8952.c
@@ -1,4 +1,5 @@
-/* Copyright (c) 2015-2016, 2018, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2016, 2018, 2020, 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
@@ -2968,17 +2969,19 @@
 	const char *ext_pa = "qcom,msm-ext-pa";
 	const char *mclk = "qcom,msm-mclk-freq";
 	const char *wsa = "asoc-wsa-codec-names";
-	const char *wsa_prefix = "asoc-wsa-codec-prefixes";
 	const char *type = NULL;
 	const char *ext_pa_str = NULL;
-	const char *wsa_str = NULL;
-	const char *wsa_prefix_str = NULL;
 	const char *spk_ext_pa = "qcom,msm-spk-ext-pa";
 	int num_strings;
 	int id, i, val;
 	int ret = 0;
 	struct resource *muxsel;
+#if IS_ENABLED(CONFIG_SND_SOC_WSA881X_ANALOG)
+	const char *wsa_prefix = "asoc-wsa-codec-prefixes";
+	const char *wsa_str = NULL;
+	const char *wsa_prefix_str = NULL;
 	char *temp_str = NULL;
+#endif
 
 	pdata = devm_kzalloc(&pdev->dev,
 				sizeof(struct msm_asoc_mach_data),
@@ -3060,6 +3063,7 @@
 	/*reading the gpio configurations from dtsi file*/
 	num_strings = of_property_count_strings(pdev->dev.of_node,
 			wsa);
+#if IS_ENABLED(CONFIG_SND_SOC_WSA881X_ANALOG)
 	if (num_strings > 0) {
 		if (wsa881x_get_probing_count() < 2) {
 			ret = -EPROBE_DEFER;
@@ -3125,6 +3129,7 @@
 			msm_anlg_cdc_update_int_spk_boost(false);
 		}
 	}
+#endif
 
 	card = msm8952_populate_sndcard_dailinks(&pdev->dev);
 	dev_dbg(&pdev->dev, "default codec configured\n");
diff --git a/config/msm8905auto.conf b/config/msm8905auto.conf
new file mode 100644
index 0000000..ebbe634
--- /dev/null
+++ b/config/msm8905auto.conf
@@ -0,0 +1,19 @@
+CONFIG_SND_SOC_MSM_QDSP6V2_INTF=m
+CONFIG_WCD9XXX_CODEC_CORE=m
+CONFIG_SND_SOC_QDSP6V2=m
+CONFIG_QTI_PP=m
+CONFIG_SND_SOC_MSM8909=m
+CONFIG_SND_SOC_ANALOG_CDC=m
+CONFIG_SND_SOC_DIGITAL_CDC_LEGACY=m
+CONFIG_SND_SOC_WCD9XXX_V2=m
+CONFIG_SND_SOC_WCD_MBHC=m
+CONFIG_SND_SOC_WCD_MBHC_LEGACY=m
+CONFIG_SND_SOC_MSM_STUB=m
+CONFIG_MSM_QDSP6_APRV3=m
+CONFIG_MSM_ADSP_LOADER=m
+CONFIG_MSM_QDSP6_NOTIFIER=m
+CONFIG_MSM_CDC_PINCTRL=m
+CONFIG_MSM_QDSP6_SSR=m
+CONFIG_SND_HWDEP_ROUTING=m
+CONFIG_SND_SOC_SDM660_CDC=m
+CONFIG_COMMON_CLK_MSM=m
diff --git a/config/msm8905autoconf.h b/config/msm8905autoconf.h
new file mode 100644
index 0000000..390baaa
--- /dev/null
+++ b/config/msm8905autoconf.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2020, 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
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#define CONFIG_SND_SOC_MSM_HOSTLESS_PCM 1
+#define CONFIG_WCD9XXX_CODEC_CORE 1
+#define CONFIG_SND_SOC_QDSP6V2 1
+#define CONFIG_QTI_PP 1
+#define CONFIG_SND_SOC_MSM8909 1
+#define CONFIG_SND_SOC_ANALOG_CDC 1
+#define CONFIG_SND_SOC_DIGITAL_CDC_LEGACY 1
+#define CONFIG_SND_SOC_WCD9XXX_V2 1
+#define CONFIG_SND_SOC_WCD_MBHC 1
+#define CONFIG_SND_SOC_WCD_MBHC_LEGACY 1
+#define CONFIG_SND_SOC_MSM_STUB 1
+#define CONFIG_MSM_QDSP6_APRV3 1
+#define CONFIG_MSM_QDSP6_NOTIFIER 1
+#define CONFIG_MSM_QDSP6_SSR 1
+#define CONFIG_MSM_ADSP_LOADER 1
+#define CONFIG_MSM_CDC_PINCTRL 1
+#define CONFIG_SND_HWDEP_ROUTING 1
+#define CONFIG_SND_SOC_SDM660_CDC 1
+#define CONFIG_COMMON_CLK_MSM 1
diff --git a/dsp/Android.mk b/dsp/Android.mk
index cdea019..14a8ef0 100644
--- a/dsp/Android.mk
+++ b/dsp/Android.mk
@@ -15,11 +15,15 @@
 AUDIO_SELECT  := CONFIG_SND_SOC_SDM450=m
 endif
 
-ifeq ($(call is-board-platform-in-list,msm8909),true)
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_DLKM_8909W)),true)
 AUDIO_SELECT  := CONFIG_SND_SOC_BG_8909=m
 AUDIO_SELECT  += CONFIG_SND_SOC_8909_DIG_CDC=m
 endif
 
+ifeq ($(strip $(TARGET_ROARING_LIONUS)),true)
+AUDIO_SELECT  += CONFIG_MSM_8905=m
+endif
+
 AUDIO_CHIPSET := audio
 # Build/Package only in case of supported target
 ifeq ($(call is-board-platform-in-list,msm8909 msm8953 msm8937 sdm845 sdm710 qcs605),true)
diff --git a/dsp/Kbuild b/dsp/Kbuild
index 1a810e1..8ff6c4e 100644
--- a/dsp/Kbuild
+++ b/dsp/Kbuild
@@ -35,9 +35,16 @@
 		INCS    +=  -include $(AUDIO_ROOT)/config/sdm450autoconf.h
 	endif
 	ifeq ($(CONFIG_ARCH_MSM8909), y)
-		include $(AUDIO_ROOT)/config/msm8909auto.conf
-		export
-		INCS    +=  -include $(AUDIO_ROOT)/config/msm8909autoconf.h
+		ifeq ($(CONFIG_MSM_BGCOM), y)
+			include $(AUDIO_ROOT)/config/msm8909auto.conf
+			export
+			INCS    +=  -include $(AUDIO_ROOT)/config/msm8909autoconf.h
+		endif
+		ifeq ($(CONFIG_MSM_8905), m)
+			include $(AUDIO_ROOT)/config/msm8905auto.conf
+			export
+			INCS    +=  -include $(AUDIO_ROOT)/config/msm8905autoconf.h
+		endif
 	endif
 	ifeq ($(CONFIG_ARCH_MSM8917), y)
 		include $(AUDIO_ROOT)/config/sdm450auto.conf
diff --git a/dsp/codecs/Android.mk b/dsp/codecs/Android.mk
index 86f3173..6802121 100644
--- a/dsp/codecs/Android.mk
+++ b/dsp/codecs/Android.mk
@@ -15,11 +15,15 @@
 AUDIO_SELECT  := CONFIG_SND_SOC_SDM450=m
 endif
 
-ifeq ($(call is-board-platform-in-list,msm8909),true)
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_DLKM_8909W)),true)
 AUDIO_SELECT  += CONFIG_SND_SOC_BG_8909=m
 AUDIO_SELECT  += CONFIG_SND_SOC_8909_DIG_CDC=m
 endif
 
+ifeq ($(strip $(TARGET_ROARING_LIONUS)),true)
+AUDIO_SELECT  += CONFIG_MSM_8905=m
+endif
+
 AUDIO_CHIPSET := audio
 # Build/Package only in case of supported target
 ifeq ($(call is-board-platform-in-list,msm8953 msm8937 sdm845 sdm710 qcs605),true)
diff --git a/dsp/codecs/Kbuild b/dsp/codecs/Kbuild
index 49d14d7..70ab624 100644
--- a/dsp/codecs/Kbuild
+++ b/dsp/codecs/Kbuild
@@ -36,9 +36,16 @@
 		INCS    +=  -include $(AUDIO_ROOT)/config/sdm450autoconf.h
 	endif
 	ifeq ($(CONFIG_ARCH_MSM8909), y)
-		include $(AUDIO_ROOT)/config/msm8909auto.conf
-		export
-		INCS    +=  -include $(AUDIO_ROOT)/config/msm8909autoconf.h
+		ifeq ($(CONFIG_MSM_BGCOM), y)
+			include $(AUDIO_ROOT)/config/msm8909auto.conf
+			export
+			INCS    +=  -include $(AUDIO_ROOT)/config/msm8909autoconf.h
+		endif
+		ifeq ($(CONFIG_MSM_8905), m)
+			include $(AUDIO_ROOT)/config/msm8905auto.conf
+			export
+			INCS    +=  -include $(AUDIO_ROOT)/config/msm8905autoconf.h
+		endif
 	endif
 	ifeq ($(CONFIG_ARCH_MSM8917), y)
 		include $(AUDIO_ROOT)/config/sdm450auto.conf
diff --git a/ipc/Android.mk b/ipc/Android.mk
index 132aedc..b053cfd 100644
--- a/ipc/Android.mk
+++ b/ipc/Android.mk
@@ -15,11 +15,15 @@
 AUDIO_SELECT  := CONFIG_SND_SOC_SDM450=m
 endif
 
-ifeq ($(call is-board-platform-in-list,msm8909),true)
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_DLKM_8909W)),true)
 AUDIO_SELECT  += CONFIG_SND_SOC_BG_8909=m
 AUDIO_SELECT  += CONFIG_MSM_BG_GLINK=m
 endif
 
+ifeq ($(strip $(TARGET_ROARING_LIONUS)),true)
+AUDIO_SELECT  += CONFIG_MSM_8905=m
+endif
+
 AUDIO_CHIPSET := audio
 # Build/Package only in case of supported target
 ifeq ($(call is-board-platform-in-list,msm8909 msm8953 msm8937 sdm845 sdm710 qcs605),true)
diff --git a/ipc/Kbuild b/ipc/Kbuild
index b2c2a72..2d0c915 100644
--- a/ipc/Kbuild
+++ b/ipc/Kbuild
@@ -57,9 +57,16 @@
 		INCS    +=  -include $(AUDIO_ROOT)/config/sdm450autoconf.h
 	endif
 	ifeq ($(CONFIG_ARCH_MSM8909), y)
-		include $(AUDIO_ROOT)/config/msm8909auto.conf
-		export
-		INCS    +=  -include $(AUDIO_ROOT)/config/msm8909autoconf.h
+		ifeq ($(CONFIG_MSM_BGCOM), y)
+			include $(AUDIO_ROOT)/config/msm8909auto.conf
+			export
+			INCS    +=  -include $(AUDIO_ROOT)/config/msm8909autoconf.h
+		endif
+		ifeq ($(CONFIG_MSM_8905), m)
+			include $(AUDIO_ROOT)/config/msm8905auto.conf
+			export
+			INCS    +=  -include $(AUDIO_ROOT)/config/msm8905autoconf.h
+		endif
 	endif
 	ifeq ($(CONFIG_ARCH_MSM8917), y)
 		include $(AUDIO_ROOT)/config/sdm450auto.conf
diff --git a/soc/Android.mk b/soc/Android.mk
index 0f893f9..e75cef2 100644
--- a/soc/Android.mk
+++ b/soc/Android.mk
@@ -15,11 +15,15 @@
 AUDIO_SELECT  := CONFIG_SND_SOC_SDM450=m
 endif
 
-ifeq ($(call is-board-platform-in-list,msm8909),true)
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_DLKM_8909W)),true)
 AUDIO_SELECT  += CONFIG_SND_SOC_BG_8909=m
 AUDIO_SELECT  += CONFIG_SND_SOC_8909_DIG_CDC=m
 endif
 
+ifeq ($(strip $(TARGET_ROARING_LIONUS)),true)
+AUDIO_SELECT  += CONFIG_MSM_8905=m
+endif
+
 AUDIO_CHIPSET := audio
 # Build/Package only in case of supported target
 ifeq ($(call is-board-platform-in-list,msm8909 msm8953 msm8937 sdm845 sdm710 qcs605),true)
diff --git a/soc/Kbuild b/soc/Kbuild
index 69dadc2..7a0ed04 100644
--- a/soc/Kbuild
+++ b/soc/Kbuild
@@ -35,9 +35,16 @@
 		INCS    +=  -include $(AUDIO_ROOT)/config/sdm450autoconf.h
 	endif
 	ifeq ($(CONFIG_ARCH_MSM8909), y)
-		include $(AUDIO_ROOT)/config/msm8909auto.conf
-		export
-		INCS    +=  -include $(AUDIO_ROOT)/config/msm8909autoconf.h
+		ifeq ($(CONFIG_MSM_BGCOM), y)
+			include $(AUDIO_ROOT)/config/msm8909auto.conf
+			export
+			INCS    +=  -include $(AUDIO_ROOT)/config/msm8909autoconf.h
+		endif
+		ifeq ($(CONFIG_MSM_8905), m)
+			include $(AUDIO_ROOT)/config/msm8905auto.conf
+			export
+			INCS    +=  -include $(AUDIO_ROOT)/config/msm8905autoconf.h
+		endif
 	endif
 	ifeq ($(CONFIG_ARCH_MSM8917), y)
 		include $(AUDIO_ROOT)/config/sdm450auto.conf