Przeglądaj źródła

ASoC: allow drivers to compile both static and dynamic

Based on where the code is synced the driver should allow
both static and dynamic linked compilation.
Also remove __exit for modules loaded from another common
init/exit functions.

Change-Id: Ib58f152002aba3af4446f9bbd9b82c279212bd0a
Signed-off-by: Asish Bhattacharya <[email protected]>
Asish Bhattacharya 7 lat temu
rodzic
commit
5faacb3a7e
72 zmienionych plików z 332 dodań i 327 usunięć
  1. 1 1
      Makefile
  2. 37 22
      asoc/Kbuild
  3. 0 41
      asoc/Makefile
  4. 33 22
      asoc/codecs/Kbuild
  5. 0 40
      asoc/codecs/Makefile
  6. 18 12
      asoc/codecs/msm_sdw/Kbuild
  7. 0 2
      asoc/codecs/msm_sdw/Makefile
  8. 19 13
      asoc/codecs/sdm660_cdc/Kbuild
  9. 0 4
      asoc/codecs/sdm660_cdc/Makefile
  10. 19 13
      asoc/codecs/wcd934x/Kbuild
  11. 0 6
      asoc/codecs/wcd934x/Makefile
  12. 1 1
      asoc/msm-compress-q6-v2.c
  13. 1 1
      asoc/msm-dai-fe.c
  14. 1 1
      asoc/msm-dai-q6-hdmi-v2.c
  15. 1 1
      asoc/msm-dai-q6-v2.c
  16. 1 1
      asoc/msm-dai-slim.c
  17. 1 1
      asoc/msm-dai-stub-v2.c
  18. 1 1
      asoc/msm-lsm-client.c
  19. 1 1
      asoc/msm-pcm-afe-v2.c
  20. 1 1
      asoc/msm-pcm-dtmf-v2.c
  21. 1 1
      asoc/msm-pcm-host-voice-v2.c
  22. 1 1
      asoc/msm-pcm-hostless.c
  23. 1 1
      asoc/msm-pcm-loopback-v2.c
  24. 1 1
      asoc/msm-pcm-q6-noirq.c
  25. 1 1
      asoc/msm-pcm-q6-v2.c
  26. 1 1
      asoc/msm-pcm-routing-v2.c
  27. 1 1
      asoc/msm-pcm-voice-v2.c
  28. 1 1
      asoc/msm-pcm-voip-v2.c
  29. 1 1
      asoc/msm-transcode-loopback-q6-v2.c
  30. 50 0
      config/sdm670auto_static.conf
  31. 30 17
      dsp/Kbuild
  32. 0 10
      dsp/Makefile
  33. 1 1
      dsp/adsp_err.c
  34. 1 1
      dsp/audio_calibration.c
  35. 2 2
      dsp/audio_slimslave.c
  36. 1 1
      dsp/avtimer.c
  37. 17 22
      dsp/codecs/Kbuild
  38. 0 5
      dsp/codecs/Makefile
  39. 1 1
      dsp/codecs/aac_in.c
  40. 1 1
      dsp/codecs/amrnb_in.c
  41. 1 1
      dsp/codecs/amrwb_in.c
  42. 1 1
      dsp/codecs/audio_aac.c
  43. 1 1
      dsp/codecs/audio_alac.c
  44. 1 1
      dsp/codecs/audio_amrnb.c
  45. 1 1
      dsp/codecs/audio_amrwb.c
  46. 1 1
      dsp/codecs/audio_amrwbplus.c
  47. 1 1
      dsp/codecs/audio_ape.c
  48. 1 1
      dsp/codecs/audio_evrc.c
  49. 1 1
      dsp/codecs/audio_g711alaw.c
  50. 1 1
      dsp/codecs/audio_g711mlaw.c
  51. 1 1
      dsp/codecs/audio_hwacc_effects.c
  52. 1 1
      dsp/codecs/audio_mp3.c
  53. 1 1
      dsp/codecs/audio_multi_aac.c
  54. 1 1
      dsp/codecs/audio_qcelp.c
  55. 1 1
      dsp/codecs/audio_wma.c
  56. 1 1
      dsp/codecs/audio_wmapro.c
  57. 1 1
      dsp/codecs/evrc_in.c
  58. 1 1
      dsp/codecs/g711alaw_in.c
  59. 1 1
      dsp/codecs/g711mlaw_in.c
  60. 1 1
      dsp/codecs/qcelp_in.c
  61. 1 1
      dsp/msm_audio_ion.c
  62. 1 1
      dsp/q6adm.c
  63. 1 1
      dsp/q6afe.c
  64. 1 1
      dsp/q6asm.c
  65. 1 1
      dsp/q6core.c
  66. 1 1
      dsp/q6lsm.c
  67. 1 1
      dsp/q6voice.c
  68. 1 1
      dsp/rtac.c
  69. 34 19
      ipc/Kbuild
  70. 0 3
      ipc/Makefile
  71. 21 16
      soc/Kbuild
  72. 0 6
      soc/Makefile

+ 1 - 1
Makefile

@@ -4,7 +4,7 @@ include $(srctree)/techpack/audio/config/sdm845auto.conf
 export
 endif
 ifeq ($(CONFIG_ARCH_SDM670), y)
-include $(srctree)/techpack/audio/config/sdm670auto.conf
+include $(srctree)/techpack/audio/config/sdm670auto_static.conf
 export
 endif
 ifeq ($(CONFIG_ARCH_SDXPOORWILLS), y)

+ 37 - 22
asoc/Kbuild

@@ -1,22 +1,32 @@
 # We can build either as part of a standalone Kernel build or as
 # an external module.  Determine which mechanism is being used
-KERNEL_BUILD := 0
+ifeq ($(MODNAME),)
+	KERNEL_BUILD := 1
+else
+	KERNEL_BUILD := 0
+endif
 
 
-ifeq ($(KERNEL_BUILD), 0)
+ifeq ($(KERNEL_BUILD), 1)
 	# These are configurable via Kconfig for kernel-based builds
 	# Need to explicitly configure for Android-based builds
+	AUDIO_BLD_DIR := $(ANDROID_BUILD_TOP)/kernel/msm-4.9
+	AUDIO_ROOT := $(AUDIO_BLD_DIR)/techpack/audio
+endif
+
+ifeq ($(KERNEL_BUILD), 0)
 	ifeq ($(CONFIG_ARCH_SDM845), y)
 		include $(AUDIO_ROOT)/config/sdm845auto.conf
 		export
+		INCS    +=  -include $(AUDIO_ROOT)/config/sdm845autoconf.h
 	endif
 	ifeq ($(CONFIG_ARCH_SDM670), y)
 		include $(AUDIO_ROOT)/config/sdm670auto.conf
 		export
+		INCS    +=  -include $(AUDIO_ROOT)/config/sdm670autoconf.h
 	endif
 endif
 
-
 # As per target team, build is done as follows:
 # Defconfig : build with default flags
 # Slub      : defconfig  + CONFIG_SLUB_DEBUG := y +
@@ -45,31 +55,31 @@ COMMON_INC :=	-I$(AUDIO_ROOT)/$(COMMON_DIR)
 
 
 # for SDM6xx sound card driver
-ifeq ($(CONFIG_SND_SOC_SDM670), m)
+ifdef CONFIG_SND_SOC_SDM670
 	MACHINE_OBJS += sdm660-common.o
 endif
 
 # for SDM6xx sound card driver
-ifeq ($(CONFIG_SND_SOC_INT_CODEC), m)
+ifdef CONFIG_SND_SOC_INT_CODEC
 	MACHINE_OBJS += sdm660-internal.o
 endif
 
 # for SDM6xx sound card driver
-ifeq ($(CONFIG_SND_SOC_EXT_CODEC), m)
+ifdef CONFIG_SND_SOC_EXT_CODEC
 	MACHINE_OBJS += sdm660-external.o
 	MACHINE_OBJS += sdm660-ext-dai-links.o
 endif
 
 # for SDM845 sound card driver
-ifeq ($(CONFIG_SND_SOC_MACHINE_SDM845), m)
+ifdef CONFIG_SND_SOC_MACHINE_SDM845
 	MACHINE_OBJS += sdm845.o
 endif
 
-ifeq ($(CONFIG_SND_SOC_CPE), m)
+ifdef CONFIG_SND_SOC_CPE
 	CPE_LSM_OBJS += msm-cpe-lsm.o
 endif
 
-ifeq ($(CONFIG_SND_SOC_QDSP6V2), m)
+ifdef CONFIG_SND_SOC_QDSP6V2
 	PLATFORM_OBJS += msm-audio-effects-q6-v2.o
 	PLATFORM_OBJS += msm-compress-q6-v2.o
 	PLATFORM_OBJS += msm-dai-fe.o
@@ -77,7 +87,6 @@ ifeq ($(CONFIG_SND_SOC_QDSP6V2), m)
 	PLATFORM_OBJS += msm-dai-q6-v2.o
 	PLATFORM_OBJS += msm-dai-slim.o
 	PLATFORM_OBJS += msm-dai-stub-v2.o
-	PLATFORM_OBJS += msm-ds2-dap-config.o
 	PLATFORM_OBJS += msm-lsm-client.o
 	PLATFORM_OBJS += msm-pcm-afe-v2.o
 	PLATFORM_OBJS += msm-pcm-dtmf-v2.o
@@ -86,30 +95,32 @@ ifeq ($(CONFIG_SND_SOC_QDSP6V2), m)
 	PLATFORM_OBJS += msm-pcm-loopback-v2.o
 	PLATFORM_OBJS += msm-pcm-q6-noirq.o
 	PLATFORM_OBJS += msm-pcm-q6-v2.o
-	PLATFORM_OBJS += msm-pcm-routing-devdep.o
 	PLATFORM_OBJS += msm-pcm-routing-v2.o
 	PLATFORM_OBJS += msm-pcm-voice-v2.o
 	PLATFORM_OBJS += msm-pcm-voip-v2.o
-	PLATFORM_OBJS += msm-qti-pp-config.o
 	PLATFORM_OBJS += msm-transcode-loopback-q6-v2.o
 	PLATFORM_OBJS += platform_init.o
 endif
+ifdef CONFIG_DOLBY_DS2
+	PLATFORM_OBJS += msm-ds2-dap-config.o
+endif
+ifdef CONFIG_DOLBY_LICENSE
+	PLATFORM_OBJS += msm-ds2-dap-config.o
+endif
+ifdef CONFIG_SND_HWDEP
+	PLATFORM_OBJS += msm-pcm-routing-devdep.o
+endif
+ifdef CONFIG_QTI_PP
+	PLATFORM_OBJS += msm-qti-pp-config.o
+endif
 
 LINUX_INC +=	-Iinclude/linux
 
-INCS :=		$(COMMON_INC) \
+INCS +=		$(COMMON_INC) \
 		$(UAPI_INC)
 
-ifeq ($(CONFIG_ARCH_SDM845), y)
-INCS    +=  -include $(AUDIO_ROOT)/config/sdm845autoconf.h
-endif
-ifeq ($(CONFIG_ARCH_SDM670), y)
-INCS    +=  -include $(AUDIO_ROOT)/config/sdm670autoconf.h
-endif
-
 EXTRA_CFLAGS += $(INCS)
 
-
 CDEFINES +=	-DANI_LITTLE_BYTE_ENDIAN \
 		-DANI_LITTLE_BIT_ENDIAN \
 		-DDOT11F_LITTLE_ENDIAN_HOST \
@@ -135,12 +146,16 @@ ifeq ($(call cc-option-yn, -Wheader-guard),y)
 EXTRA_CFLAGS += -Wheader-guard
 endif
 
-
+ifeq ($(KERNEL_BUILD), 0)
 KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
 KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/Module.symvers
 KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/wcd934x/Module.symvers
 KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/sdm660_cdc/Module.symvers
 KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/msm_sdw/Module.symvers
+endif
+ifeq ($(KERNEL_BUILD), 1)
+	obj-y += codecs/
+endif
 # Module information used by KBuild framework
 obj-$(CONFIG_SND_SOC_QDSP6V2) += platform_dlkm.o
 platform_dlkm-y := $(PLATFORM_OBJS)

+ 0 - 41
asoc/Makefile

@@ -1,41 +0,0 @@
-# MSM Machine Support
-
-snd-soc-hostless-pcm-objs := msm-pcm-hostless.o
-obj-$(CONFIG_SND_SOC_MSM_HOSTLESS_PCM) += snd-soc-hostless-pcm.o
-
-
-snd-soc-qdsp6v2-objs := msm-dai-fe.o
-obj-$(CONFIG_SND_SOC_QDSP6V2) += snd-soc-qdsp6v2.o
-
-#for CPE drivers
-snd-soc-cpe-objs := msm-cpe-lsm.o
-obj-$(CONFIG_SND_SOC_CPE) += snd-soc-cpe.o
-
-# for MSM8998 sound card driver
-snd-soc-msm8998-objs := msm8998.o
-obj-$(CONFIG_SND_SOC_MACHINE_MSM8998) += snd-soc-msm8998.o
-
-# for SDM670 sound card driver
-snd-soc-sdm670-objs := sdm660-common.o sdm660-internal.o sdm660-external.o sdm660-ext-dai-links.o
-obj-$(CONFIG_SND_SOC_SDM670) += snd-soc-sdm670.o
-
-# for SDM845 sound card driver
-snd-soc-sdm845-objs := sdm845.o
-obj-$(CONFIG_SND_SOC_MACHINE_SDM845) += snd-soc-sdm845.o
-
-snd-soc-qdsp6v2-objs += msm-dai-q6-v2.o msm-pcm-q6-v2.o \
-			msm-pcm-routing-v2.o msm-compress-q6-v2.o \
-			msm-pcm-afe-v2.o msm-pcm-voip-v2.o \
-			msm-pcm-voice-v2.o msm-dai-q6-hdmi-v2.o \
-			msm-lsm-client.o msm-pcm-host-voice-v2.o \
-			msm-audio-effects-q6-v2.o msm-pcm-loopback-v2.o \
-			msm-dai-slim.o msm-transcode-loopback-q6-v2.o msm-pcm-q6-noirq.o
-obj-$(CONFIG_SND_SOC_QDSP6V2) += snd-soc-qdsp6v2.o msm-pcm-dtmf-v2.o \
-				 msm-dai-stub-v2.o
-obj-$(CONFIG_SND_HWDEP) += msm-pcm-routing-devdep.o
-obj-$(CONFIG_DOLBY_DAP) += msm-dolby-dap-config.o
-obj-$(CONFIG_DOLBY_DS2) += msm-ds2-dap-config.o
-obj-$(CONFIG_DOLBY_LICENSE) += msm-ds2-dap-config.o
-obj-$(CONFIG_DTS_SRS_TM) += msm-dts-srs-tm-config.o
-obj-$(CONFIG_QTI_PP) += msm-qti-pp-config.o
-obj-y += codecs/

+ 33 - 22
asoc/codecs/Kbuild

@@ -1,22 +1,31 @@
 # We can build either as part of a standalone Kernel build or as
 # an external module.  Determine which mechanism is being used
-KERNEL_BUILD := 0
-
+ifeq ($(MODNAME),)
+	KERNEL_BUILD := 1
+else
+	KERNEL_BUILD := 0
+endif
 
-ifeq ($(KERNEL_BUILD), 0)
+ifeq ($(KERNEL_BUILD), 1)
 	# These are configurable via Kconfig for kernel-based builds
 	# Need to explicitly configure for Android-based builds
+	AUDIO_BLD_DIR := $(ANDROID_BUILD_TOP)/kernel/msm-4.9
+	AUDIO_ROOT := $(AUDIO_BLD_DIR)/techpack/audio
+endif
+
+ifeq ($(KERNEL_BUILD), 0)
 	ifeq ($(CONFIG_ARCH_SDM845), y)
 		include $(AUDIO_ROOT)/config/sdm845auto.conf
 		export
+		INCS    +=  -include $(AUDIO_ROOT)/config/sdm845autoconf.h
 	endif
 	ifeq ($(CONFIG_ARCH_SDM670), y)
 		include $(AUDIO_ROOT)/config/sdm670auto.conf
 		export
+		INCS    +=  -include $(AUDIO_ROOT)/config/sdm670autoconf.h
 	endif
 endif
 
-
 # As per target team, build is done as follows:
 # Defconfig : build with default flags
 # Slub      : defconfig  + CONFIG_SLUB_DEBUG := y +
@@ -42,7 +51,7 @@ COMMON_DIR :=	include
 COMMON_INC :=	-I$(AUDIO_ROOT)/$(COMMON_DIR)
 
 ############ ASoC Codecs ############
-ifeq ($(CONFIG_WCD9XXX_CODEC_CORE), m)
+ifdef CONFIG_WCD9XXX_CODEC_CORE
 	CORE_OBJS += wcd9xxx-rst.o
 	CORE_OBJS += wcd9xxx-core-init.o
 	CORE_OBJS += wcd9xxx-core.o
@@ -57,7 +66,7 @@ ifeq ($(CONFIG_WCD9XXX_CODEC_CORE), m)
 	CORE_OBJS += wcd934x/wcd934x-tables.o
 endif
 
-ifeq ($(CONFIG_SND_SOC_WCD9XXX_V2), m)
+ifdef CONFIG_SND_SOC_WCD9XXX_V2
 	WCD9XXX_OBJS += wcd9xxx-common-v2.o
 	WCD9XXX_OBJS += wcd9xxx-resmgr-v2.o
 	WCD9XXX_OBJS += wcdcal-hwdep.o
@@ -67,56 +76,50 @@ ifeq ($(CONFIG_SND_SOC_WCD9XXX_V2), m)
 	WCD9XXX_OBJS += audio-ext-clk-up.o
 endif
 
-ifeq ($(CONFIG_SND_SOC_WCD9335), m)
+ifdef CONFIG_SND_SOC_WCD9335
 	WCD9335_OBJS += wcd9335.o
 endif
 
-ifeq ($(CONFIG_SND_SOC_WSA881X), m)
+ifdef CONFIG_SND_SOC_WSA881X
 	WSA881X_OBJS += wsa881x.o
 	WSA881X_OBJS += wsa881x-tables.o
 	WSA881X_OBJS += wsa881x-regmap.o
 	WSA881X_OBJS += wsa881x-temp-sensor.o
 endif
 
-ifeq ($(CONFIG_SND_SOC_MSM_STUB), m)
+ifdef CONFIG_SND_SOC_MSM_STUB
 	STUB_OBJS += msm_stub.o
 endif
-ifeq ($(CONFIG_SND_SOC_WCD_SPI), m)
+ifdef CONFIG_SND_SOC_WCD_SPI
 	SPI_OBJS += wcd-spi.o
 endif
 
-ifeq ($(CONFIG_SND_SOC_WCD_CPE), m)
+ifdef CONFIG_SND_SOC_WCD_CPE
 	WCD_CPE_OBJS += wcd_cpe_core.o
 	WCD_CPE_OBJS += wcd_cpe_services.o
 endif
 
-ifeq ($(CONFIG_SND_SOC_WCD_MBHC), m)
+ifdef CONFIG_SND_SOC_WCD_MBHC
 	MBHC_OBJS += wcd-mbhc-v2.o
 endif
 
-ifeq ($(CONFIG_SND_SOC_WCD_MBHC_ADC), m)
+ifdef CONFIG_SND_SOC_WCD_MBHC_ADC
 	MBHC_OBJS += wcd-mbhc-adc.o
 endif
 
-ifeq ($(CONFIG_SND_SOC_WCD_MBHC_LEGACY), m)
+ifdef CONFIG_SND_SOC_WCD_MBHC_LEGACY
 	MBHC_OBJS += wcd-mbhc-legacy.o
 endif
 
-ifeq ($(CONFIG_SND_SOC_MSM_HDMI_CODEC_RX), m)
+ifdef CONFIG_SND_SOC_MSM_HDMI_CODEC_RX
 	HDMICODEC_OBJS += msm_hdmi_codec_rx.o
 endif
 
 LINUX_INC +=	-Iinclude/linux
 
-INCS :=		$(COMMON_INC) \
+INCS +=		$(COMMON_INC) \
 		$(UAPI_INC)
 
-ifeq ($(CONFIG_ARCH_SDM845), y)
-INCS    +=  -include $(AUDIO_ROOT)/config/sdm845autoconf.h
-endif
-ifeq ($(CONFIG_ARCH_SDM670), y)
-INCS    +=  -include $(AUDIO_ROOT)/config/sdm670autoconf.h
-endif
 
 EXTRA_CFLAGS += $(INCS)
 
@@ -147,8 +150,16 @@ EXTRA_CFLAGS += -Wheader-guard
 endif
 
 
+ifeq ($(KERNEL_BUILD), 0)
 KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
 KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/soc/Module.symvers
+endif
+
+ifeq ($(KERNEL_BUILD), 1)
+	obj-y	+= wcd934x/
+	obj-y	+= sdm660_cdc/
+	obj-y	+= msm_sdw/
+endif
 # Module information used by KBuild framework
 obj-$(CONFIG_WCD9XXX_CODEC_CORE) += wcd_core_dlkm.o
 wcd_core_dlkm-y := $(CORE_OBJS)

+ 0 - 40
asoc/codecs/Makefile

@@ -1,40 +0,0 @@
-snd-soc-wcd9xxx-objs := wcd9xxx-common-v2.o wcd9xxx-resmgr-v2.o \
-			wcdcal-hwdep.o wcd9xxx-soc-init.o wcd-dsp-utils.o \
-			wcd-dsp-mgr.o audio-ext-clk-up.o
-snd-soc-wcd-cpe-objs := wcd_cpe_services.o wcd_cpe_core.o
-snd-soc-wsa881x-objs := wsa881x.o wsa881x-tables.o wsa881x-regmap.o wsa881x-temp-sensor.o
-snd-soc-wcd-mbhc-objs := wcd-mbhc-v2.o
-ifneq (,$(filter $(CONFIG_SND_SOC_WCD_MBHC_LEGACY),y m))
-	snd-soc-wcd-mbhc-objs += wcd-mbhc-legacy.o
-endif
-ifneq (,$(filter $(CONFIG_SND_SOC_WCD_MBHC_ADC),y m))
-	snd-soc-wcd-mbhc-objs += wcd-mbhc-adc.o
-endif
-snd-soc-wcd-spi-objs := wcd-spi.o
-snd-soc-wcd9335-objs := wcd9335.o
-snd-soc-wcd-cpe-objs := wcd_cpe_services.o wcd_cpe_core.o
-
-obj-$(CONFIG_SND_SOC_WCD9335) += snd-soc-wcd9335.o
-obj-$(CONFIG_SND_SOC_WCD_CPE)   += snd-soc-wcd-cpe.o
-obj-$(CONFIG_SND_SOC_WCD934X)	+= wcd934x/
-obj-$(CONFIG_SND_SOC_SDM660_CDC) += sdm660_cdc/
-obj-$(CONFIG_SND_SOC_MSM_SDW) += msm_sdw/
-
-obj-$(CONFIG_SND_SOC_WCD9XXX_V2) += snd-soc-wcd9xxx.o
-obj-$(CONFIG_SND_SOC_WCD_MBHC)  += snd-soc-wcd-mbhc.o
-obj-$(CONFIG_SND_SOC_WSA881X)	+= snd-soc-wsa881x.o
-obj-$(CONFIG_SND_SOC_WCD_SPI)  += snd-soc-wcd-spi.o
-
-snd-soc-msm-stub-objs := msm_stub.o
-obj-$(CONFIG_SND_SOC_MSM_STUB)  += snd-soc-msm-stub.o
-
-wcd-core-objs                  := wcd9xxx-rst.o wcd9xxx-core-init.o \
-				wcd9xxx-core.o wcd9xxx-irq.o \
-				wcd9xxx-slimslave.o wcd9xxx-utils.o \
-				wcd9335-regmap.o wcd9335-tables.o \
-				msm-cdc-pinctrl.o msm-cdc-supply.o
-wcd-core-objs	+= wcd934x/wcd934x-regmap.o
-wcd-core-objs	+= wcd934x/wcd934x-tables.o
-
-obj-$(CONFIG_WCD9XXX_CODEC_CORE) += wcd-core.o
-obj-$(CONFIG_SND_SOC_MSM_HDMI_CODEC_RX) += msm_hdmi_codec_rx.o

+ 18 - 12
asoc/codecs/msm_sdw/Kbuild

@@ -1,22 +1,32 @@
 # We can build either as part of a standalone Kernel build or as
 # an external module.  Determine which mechanism is being used
-KERNEL_BUILD := 0
+ifeq ($(MODNAME),)
+	KERNEL_BUILD := 1
+else
+	KERNEL_BUILD := 0
+endif
 
 
-ifeq ($(KERNEL_BUILD), 0)
+ifeq ($(KERNEL_BUILD), 1)
 	# These are configurable via Kconfig for kernel-based builds
 	# Need to explicitly configure for Android-based builds
+	AUDIO_BLD_DIR := $(ANDROID_BUILD_TOP)/kernel/msm-4.9
+	AUDIO_ROOT := $(AUDIO_BLD_DIR)/techpack/audio
+endif
+
+ifeq ($(KERNEL_BUILD), 0)
 	ifeq ($(CONFIG_ARCH_SDM845), y)
 		include $(AUDIO_ROOT)/config/sdm845auto.conf
 		export
+		INCS    +=  -include $(AUDIO_ROOT)/config/sdm845autoconf.h
 	endif
 	ifeq ($(CONFIG_ARCH_SDM670), y)
 		include $(AUDIO_ROOT)/config/sdm670auto.conf
 		export
+		INCS    +=  -include $(AUDIO_ROOT)/config/sdm670autoconf.h
 	endif
 endif
 
-
 # As per target team, build is done as follows:
 # Defconfig : build with default flags
 # Slub      : defconfig  + CONFIG_SLUB_DEBUG := y +
@@ -44,7 +54,7 @@ COMMON_INC :=	-I$(AUDIO_ROOT)/$(COMMON_DIR)
 ############ MSM Soundwire ############
 
 # for MSM Soundwire Codec
-ifeq ($(CONFIG_SND_SOC_MSM_SDW), m)
+ifdef CONFIG_SND_SOC_MSM_SDW
 	MSM_SDW_OBJS += msm_sdw_cdc.o
 	MSM_SDW_OBJS += msm_sdw_regmap.o
 	MSM_SDW_OBJS += msm-sdw-tables.o
@@ -53,16 +63,9 @@ endif
 
 LINUX_INC +=	-Iinclude/linux
 
-INCS :=		$(COMMON_INC) \
+INCS +=		$(COMMON_INC) \
 		$(UAPI_INC)
 
-ifeq ($(CONFIG_ARCH_SDM845), y)
-INCS    +=  -include $(AUDIO_ROOT)/config/sdm845autoconf.h
-endif
-ifeq ($(CONFIG_ARCH_SDM670), y)
-INCS    +=  -include $(AUDIO_ROOT)/config/sdm670autoconf.h
-endif
-
 EXTRA_CFLAGS += $(INCS)
 
 
@@ -91,11 +94,14 @@ ifeq ($(call cc-option-yn, -Wheader-guard),y)
 EXTRA_CFLAGS += -Wheader-guard
 endif
 
+ifeq ($(KERNEL_BUILD), 0)
 KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/ipc/Module.symvers
 KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
 KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/Module.symvers
 KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/Module.symvers
 KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/soc/Module.symvers
+endif
+
 # Module information used by KBuild framework
 obj-$(CONFIG_SND_SOC_MSM_SDW) += msm_sdw_dlkm.o
 msm_sdw_dlkm-y := $(MSM_SDW_OBJS)

+ 0 - 2
asoc/codecs/msm_sdw/Makefile

@@ -1,2 +0,0 @@
-snd-soc-msm-sdw-objs := msm_sdw_cdc.o msm_sdw_regmap.o msm-sdw-tables.o msm_sdw_cdc_utils.o
-obj-$(CONFIG_SND_SOC_MSM_SDW)	+= snd-soc-msm-sdw.o

+ 19 - 13
asoc/codecs/sdm660_cdc/Kbuild

@@ -1,22 +1,32 @@
 # We can build either as part of a standalone Kernel build or as
 # an external module.  Determine which mechanism is being used
-KERNEL_BUILD := 0
+ifeq ($(MODNAME),)
+	KERNEL_BUILD := 1
+else
+	KERNEL_BUILD := 0
+endif
 
 
-ifeq ($(KERNEL_BUILD), 0)
+ifeq ($(KERNEL_BUILD), 1)
 	# These are configurable via Kconfig for kernel-based builds
 	# Need to explicitly configure for Android-based builds
+	AUDIO_BLD_DIR := $(ANDROID_BUILD_TOP)/kernel/msm-4.9
+	AUDIO_ROOT := $(AUDIO_BLD_DIR)/techpack/audio
+endif
+
+ifeq ($(KERNEL_BUILD), 0)
 	ifeq ($(CONFIG_ARCH_SDM845), y)
 		include $(AUDIO_ROOT)/config/sdm845auto.conf
 		export
+		INCS    +=  -include $(AUDIO_ROOT)/config/sdm845autoconf.h
 	endif
 	ifeq ($(CONFIG_ARCH_SDM670), y)
 		include $(AUDIO_ROOT)/config/sdm670auto.conf
 		export
+		INCS    +=  -include $(AUDIO_ROOT)/config/sdm670autoconf.h
 	endif
 endif
 
-
 # As per target team, build is done as follows:
 # Defconfig : build with default flags
 # Slub      : defconfig  + CONFIG_SLUB_DEBUG := y +
@@ -44,27 +54,20 @@ COMMON_INC :=	-I$(AUDIO_ROOT)/$(COMMON_DIR)
 ############ SDM660_CDC ############
 
 # for SDM660_CDC Codec
-ifeq ($(CONFIG_SND_SOC_ANALOG_CDC), m)
+ifdef CONFIG_SND_SOC_ANALOG_CDC
 	ANALOG_CDC_OBJS += msm-analog-cdc.o
 	ANALOG_CDC_OBJS += sdm660-cdc-irq.o
 endif
 
-ifeq ($(CONFIG_SND_SOC_DIGITAL_CDC), m)
+ifdef CONFIG_SND_SOC_DIGITAL_CDC
 	DIGITAL_CDC_OBJS += msm-digital-cdc.o
 	DIGITAL_CDC_OBJS += msm-digital-cdc-regmap.o
 endif
 LINUX_INC +=	-Iinclude/linux
 
-INCS :=		$(COMMON_INC) \
+INCS +=		$(COMMON_INC) \
 		$(UAPI_INC)
 
-ifeq ($(CONFIG_ARCH_SDM845), y)
-INCS    +=  -include $(AUDIO_ROOT)/config/sdm845autoconf.h
-endif
-ifeq ($(CONFIG_ARCH_SDM670), y)
-INCS    +=  -include $(AUDIO_ROOT)/config/sdm670autoconf.h
-endif
-
 EXTRA_CFLAGS += $(INCS)
 
 
@@ -94,11 +97,14 @@ EXTRA_CFLAGS += -Wheader-guard
 endif
 
 
+ifeq ($(KERNEL_BUILD), 0)
 KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/ipc/Module.symvers
 KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
 KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/Module.symvers
 KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/Module.symvers
 KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/soc/Module.symvers
+endif
+
 # Module information used by KBuild framework
 obj-$(CONFIG_SND_SOC_ANALOG_CDC) += analog_cdc_dlkm.o
 analog_cdc_dlkm-y := $(ANALOG_CDC_OBJS)

+ 0 - 4
asoc/codecs/sdm660_cdc/Makefile

@@ -1,4 +0,0 @@
-snd-soc-analog-cdc-objs := sdm660-cdc-irq.o msm-analog-cdc.o
-snd-soc-digital-cdc-objs := msm-digital-cdc.o msm-digital-cdc-regmap.o
-obj-$(CONFIG_SND_SOC_ANALOG_CDC) +=  snd-soc-analog-cdc.o
-obj-$(CONFIG_SND_SOC_DIGITAL_CDC) += snd-soc-digital-cdc.o

+ 19 - 13
asoc/codecs/wcd934x/Kbuild

@@ -1,22 +1,33 @@
 # We can build either as part of a standalone Kernel build or as
 # an external module.  Determine which mechanism is being used
-KERNEL_BUILD := 0
+ifeq ($(MODNAME),)
+	KERNEL_BUILD := 1
+else
+	KERNEL_BUILD := 0
+endif
 
 
-ifeq ($(KERNEL_BUILD), 0)
+
+ifeq ($(KERNEL_BUILD), 1)
 	# These are configurable via Kconfig for kernel-based builds
 	# Need to explicitly configure for Android-based builds
+	AUDIO_BLD_DIR := $(ANDROID_BUILD_TOP)/kernel/msm-4.9
+	AUDIO_ROOT := $(AUDIO_BLD_DIR)/techpack/audio
+endif
+
+ifeq ($(KERNEL_BUILD), 0)
 	ifeq ($(CONFIG_ARCH_SDM845), y)
 		include $(AUDIO_ROOT)/config/sdm845auto.conf
 		export
+		INCS    +=  -include $(AUDIO_ROOT)/config/sdm845autoconf.h
 	endif
 	ifeq ($(CONFIG_ARCH_SDM670), y)
 		include $(AUDIO_ROOT)/config/sdm670auto.conf
 		export
+		INCS    +=  -include $(AUDIO_ROOT)/config/sdm670autoconf.h
 	endif
 endif
 
-
 # As per target team, build is done as follows:
 # Defconfig : build with default flags
 # Slub      : defconfig  + CONFIG_SLUB_DEBUG := y +
@@ -44,7 +55,7 @@ COMMON_INC :=	-I$(AUDIO_ROOT)/$(COMMON_DIR)
 ############ WCD934X ############
 
 # for WCD934X Codec
-ifeq ($(CONFIG_SND_SOC_WCD934X), m)
+ifdef CONFIG_SND_SOC_WCD934X
 	WCD934X_OBJS += wcd934x.o
 	WCD934X_OBJS += wcd934x-dsp-cntl.o
 	WCD934X_OBJS += wcd934x-mbhc.o
@@ -53,16 +64,9 @@ endif
 
 LINUX_INC +=	-Iinclude/linux
 
-INCS :=		$(COMMON_INC) \
+INCS +=		$(COMMON_INC) \
 		$(UAPI_INC)
 
-ifeq ($(CONFIG_ARCH_SDM845), y)
-INCS    +=  -include $(AUDIO_ROOT)/config/sdm845autoconf.h
-endif
-ifeq ($(CONFIG_ARCH_SDM670), y)
-INCS    +=  -include $(AUDIO_ROOT)/config/sdm670autoconf.h
-endif
-
 EXTRA_CFLAGS += $(INCS)
 
 
@@ -91,12 +95,14 @@ ifeq ($(call cc-option-yn, -Wheader-guard),y)
 EXTRA_CFLAGS += -Wheader-guard
 endif
 
-
+ifeq ($(KERNEL_BUILD), 0)
 KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/ipc/Module.symvers
 KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
 KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/Module.symvers
 KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/Module.symvers
 KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/soc/Module.symvers
+endif
+
 # Module information used by KBuild framework
 obj-$(CONFIG_SND_SOC_WCD934X) += wcd934x_dlkm.o
 wcd934x_dlkm-y := $(WCD934X_OBJS)

+ 0 - 6
asoc/codecs/wcd934x/Makefile

@@ -1,6 +0,0 @@
-#
-# Makefile for wcd934x codec driver.
-#
-snd-soc-wcd934x-objs := wcd934x.o wcd934x-dsp-cntl.o \
-			wcd934x-mbhc.o wcd934x-dsd.o
-obj-$(CONFIG_SND_SOC_WCD934X) += snd-soc-wcd934x.o

+ 1 - 1
asoc/msm-compress-q6-v2.c

@@ -4546,7 +4546,7 @@ int __init msm_compress_dsp_init(void)
 	return platform_driver_register(&msm_compr_driver);
 }
 
-void __exit msm_compress_dsp_exit(void)
+void msm_compress_dsp_exit(void)
 {
 	platform_driver_unregister(&msm_compr_driver);
 }

+ 1 - 1
asoc/msm-dai-fe.c

@@ -2576,7 +2576,7 @@ int __init msm_fe_dai_init(void)
 	return platform_driver_register(&msm_fe_dai_driver);
 }
 
-void __exit msm_fe_dai_exit(void)
+void msm_fe_dai_exit(void)
 {
 	platform_driver_unregister(&msm_fe_dai_driver);
 }

+ 1 - 1
asoc/msm-dai-q6-hdmi-v2.c

@@ -543,7 +543,7 @@ int __init msm_dai_q6_hdmi_init(void)
 	return platform_driver_register(&msm_dai_q6_hdmi_driver);
 }
 
-void __exit msm_dai_q6_hdmi_exit(void)
+void msm_dai_q6_hdmi_exit(void)
 {
 	platform_driver_unregister(&msm_dai_q6_hdmi_driver);
 }

+ 1 - 1
asoc/msm-dai-q6-v2.c

@@ -8928,7 +8928,7 @@ fail:
 	return rc;
 }
 
-void __exit msm_dai_q6_exit(void)
+void msm_dai_q6_exit(void)
 {
 	platform_driver_unregister(&msm_dai_q6_tdm_driver);
 	platform_driver_unregister(&msm_dai_q6_spdif_driver);

+ 1 - 1
asoc/msm-dai-slim.c

@@ -653,7 +653,7 @@ int __init msm_dai_slim_init(void)
 	return rc;
 }
 
-void __exit msm_dai_slim_exit(void)
+void msm_dai_slim_exit(void)
 {
 	slim_driver_unregister(&msm_dai_slim_driver);
 }

+ 1 - 1
asoc/msm-dai-stub-v2.c

@@ -379,7 +379,7 @@ fail:
 	return rc;
 }
 
-void __exit msm_dai_stub_exit(void)
+void msm_dai_stub_exit(void)
 {
 	pr_debug("%s:\n", __func__);
 

+ 1 - 1
asoc/msm-lsm-client.c

@@ -2406,7 +2406,7 @@ int __init msm_lsm_client_init(void)
 	return platform_driver_register(&msm_lsm_driver);
 }
 
-void __exit msm_lsm_client_exit(void)
+void msm_lsm_client_exit(void)
 {
 	platform_driver_unregister(&msm_lsm_driver);
 }

+ 1 - 1
asoc/msm-pcm-afe-v2.c

@@ -910,7 +910,7 @@ int __init msm_pcm_afe_init(void)
 	return platform_driver_register(&msm_afe_driver);
 }
 
-void __exit msm_pcm_afe_exit(void)
+void msm_pcm_afe_exit(void)
 {
 	pr_debug("%s\n", __func__);
 	platform_driver_unregister(&msm_afe_driver);

+ 1 - 1
asoc/msm-pcm-dtmf-v2.c

@@ -585,7 +585,7 @@ int __init msm_pcm_dtmf_init(void)
 	return platform_driver_register(&msm_pcm_driver);
 }
 
-void __exit msm_pcm_dtmf_exit(void)
+void msm_pcm_dtmf_exit(void)
 {
 	platform_driver_unregister(&msm_pcm_driver);
 }

+ 1 - 1
asoc/msm-pcm-host-voice-v2.c

@@ -1542,7 +1542,7 @@ int __init msm_voice_host_init(void)
 	return platform_driver_register(&msm_pcm_driver);
 }
 
-void __exit msm_voice_host_exit(void)
+void msm_voice_host_exit(void)
 {
 	platform_driver_unregister(&msm_pcm_driver);
 }

+ 1 - 1
asoc/msm-pcm-hostless.c

@@ -71,7 +71,7 @@ int __init msm_pcm_hostless_init(void)
 	return platform_driver_register(&msm_pcm_hostless_driver);
 }
 
-void __exit msm_pcm_hostless_exit(void)
+void msm_pcm_hostless_exit(void)
 {
 	platform_driver_unregister(&msm_pcm_hostless_driver);
 }

+ 1 - 1
asoc/msm-pcm-loopback-v2.c

@@ -790,7 +790,7 @@ int __init msm_pcm_loopback_init(void)
 	return platform_driver_register(&msm_pcm_driver);
 }
 
-void __exit msm_pcm_loopback_exit(void)
+void msm_pcm_loopback_exit(void)
 {
 	platform_driver_unregister(&msm_pcm_driver);
 }

+ 1 - 1
asoc/msm-pcm-q6-noirq.c

@@ -1273,7 +1273,7 @@ int __init msm_pcm_noirq_init(void)
 	return platform_driver_register(&msm_pcm_driver_noirq);
 }
 
-void __exit msm_pcm_noirq_exit(void)
+void msm_pcm_noirq_exit(void)
 {
 	platform_driver_unregister(&msm_pcm_driver_noirq);
 }

+ 1 - 1
asoc/msm-pcm-q6-v2.c

@@ -1873,7 +1873,7 @@ int __init msm_pcm_dsp_init(void)
 	return platform_driver_register(&msm_pcm_driver);
 }
 
-void __exit msm_pcm_dsp_exit(void)
+void msm_pcm_dsp_exit(void)
 {
 	platform_driver_unregister(&msm_pcm_driver);
 }

+ 1 - 1
asoc/msm-pcm-routing-v2.c

@@ -17212,7 +17212,7 @@ int __init msm_soc_routing_platform_init(void)
 	return platform_driver_register(&msm_routing_pcm_driver);
 }
 
-void __exit msm_soc_routing_platform_exit(void)
+void msm_soc_routing_platform_exit(void)
 {
 	msm_routing_delete_cal_data();
 	memset(&be_dai_name_table, 0, sizeof(be_dai_name_table));

+ 1 - 1
asoc/msm-pcm-voice-v2.c

@@ -770,7 +770,7 @@ int __init msm_pcm_voice_init(void)
 	return platform_driver_register(&msm_pcm_driver);
 }
 
-void __exit msm_pcm_voice_exit(void)
+void msm_pcm_voice_exit(void)
 {
 	platform_driver_unregister(&msm_pcm_driver);
 }

+ 1 - 1
asoc/msm-pcm-voip-v2.c

@@ -1704,7 +1704,7 @@ int __init msm_pcm_voip_init(void)
 	return platform_driver_register(&msm_pcm_driver);
 }
 
-void __exit msm_pcm_voip_exit(void)
+void msm_pcm_voip_exit(void)
 {
 	platform_driver_unregister(&msm_pcm_driver);
 }

+ 1 - 1
asoc/msm-transcode-loopback-q6-v2.c

@@ -958,7 +958,7 @@ int __init msm_transcode_loopback_init(void)
 	return platform_driver_register(&msm_transcode_loopback_driver);
 }
 
-void __exit msm_transcode_loopback_exit(void)
+void msm_transcode_loopback_exit(void)
 {
 	mutex_destroy(&transcode_info.lock);
 	platform_driver_unregister(&msm_transcode_loopback_driver);

+ 50 - 0
config/sdm670auto_static.conf

@@ -0,0 +1,50 @@
+CONFIG_PINCTRL_LPI=y
+CONFIG_PINCTRL_WCD=y
+CONFIG_AUDIO_EXT_CLK=y
+CONFIG_SND_SOC_WCD9XXX_V2=y
+CONFIG_SND_SOC_WCD_MBHC=y
+CONFIG_SND_SOC_WSA881X=y
+CONFIG_SND_SOC_WCD_DSP_MGR=y
+CONFIG_SND_SOC_WCD_SPI=y
+CONFIG_SND_SOC_WCD_CPE=y
+CONFIG_SND_SOC_CPE=y
+CONFIG_SND_SOC_WCD9335=y
+CONFIG_SND_SOC_WCD934X=y
+CONFIG_SND_SOC_WCD934X_MBHC=y
+CONFIG_SND_SOC_WCD934X_DSD=y
+CONFIG_MSM_QDSP6V2_CODECS=y
+CONFIG_MSM_ULTRASOUND=y
+CONFIG_MSM_QDSP6_APRV2_GLINK=y
+CONFIG_MSM_ADSP_LOADER=y
+CONFIG_REGMAP_SWR=y
+CONFIG_MSM_QDSP6_SSR=y
+CONFIG_MSM_QDSP6_PDR=y
+CONFIG_MSM_QDSP6_NOTIFIER=y
+CONFIG_SND_SOC_MSM_HOSTLESS_PCM=y
+CONFIG_SND_SOC_MSM_QDSP6V2_INTF=y
+CONFIG_SND_SOC_SDM670=y
+CONFIG_MSM_GLINK_SPI_XPRT=y
+CONFIG_SOUNDWIRE=y
+CONFIG_SOUNDWIRE_WCD_CTRL=y
+CONFIG_SND_SOC_QDSP6V2=y
+CONFIG_SND_SOC_MSM_QDSP6V2_INTF=y
+CONFIG_WCD9XXX_CODEC_CORE=y
+CONFIG_MSM_CDC_PINCTRL=y
+CONFIG_SND_SOC_WCD_MBHC_ADC=y
+CONFIG_SND_SOC_WCD_MBHC_LEGACY=y
+CONFIG_QTI_PP=y
+CONFIG_SND_HWDEP=y
+CONFIG_DTS_EAGLE=y
+CONFIG_DOLBY_DS2=y
+CONFIG_DOLBY_LICENSE=y
+CONFIG_DTS_SRS_TM=y
+CONFIG_SND_SOC_EXT_CODEC=y
+CONFIG_SND_SOC_INT_CODEC=y
+CONFIG_SND_SOC_MSM_STUB=y
+CONFIG_WCD_DSP_GLINK=y
+CONFIG_MSM_AVTIMER=y
+CONFIG_SND_SOC_SDM660_CDC=y
+CONFIG_SND_SOC_ANALOG_CDC=y
+CONFIG_SND_SOC_DIGITAL_CDC=y
+CONFIG_SND_SOC_MSM_SDW=y
+CONFIG_SND_SOC_MSM_HDMI_CODEC_RX=y

+ 30 - 17
dsp/Kbuild

@@ -1,22 +1,33 @@
 # We can build either as part of a standalone Kernel build or as
 # an external module.  Determine which mechanism is being used
-KERNEL_BUILD := 0
-
+ifeq ($(MODNAME), )
+	KERNEL_BUILD := 1
+else
+	KERNEL_BUILD := 0
+endif
 
-ifeq ($(KERNEL_BUILD), 0)
+ifeq ($(KERNEL_BUILD), 1)
 	# These are configurable via Kconfig for kernel-based builds
 	# Need to explicitly configure for Android-based builds
+	AUDIO_BLD_DIR := $(ANDROID_BUILD_TOP)/kernel/msm-4.9
+	AUDIO_ROOT := $(AUDIO_BLD_DIR)/techpack/audio
+endif
+
+ifeq ($(KERNEL_BUILD), 0)
 	ifeq ($(CONFIG_ARCH_SDM845), y)
 		include $(AUDIO_ROOT)/config/sdm845auto.conf
 		export
+		INCS    +=  -include $(AUDIO_ROOT)/config/sdm845autoconf.h
 	endif
 	ifeq ($(CONFIG_ARCH_SDM670), y)
 		include $(AUDIO_ROOT)/config/sdm670auto.conf
 		export
+		INCS    +=  -include $(AUDIO_ROOT)/config/sdm670autoconf.h
 	endif
 endif
 
 
+
 # As per target team, build is done as follows:
 # Defconfig : build with default flags
 # Slub      : defconfig  + CONFIG_SLUB_DEBUG := y +
@@ -43,10 +54,9 @@ COMMON_INC :=	-I$(AUDIO_ROOT)/$(COMMON_DIR)
 
 ############ QDSP6V2 ############
 
-ifeq ($(CONFIG_SND_SOC_MSM_QDSP6V2_INTF), m)
+ifdef CONFIG_SND_SOC_MSM_QDSP6V2_INTF
 	Q6_OBJS += audio_calibration.o
 	Q6_OBJS += audio_cal_utils.o
-	Q6_OBJS += msm-dts-srs-tm-config.o
 	Q6_OBJS += q6adm.o
 	Q6_OBJS += q6afe.o
 	Q6_OBJS += q6asm.o
@@ -61,34 +71,31 @@ ifeq ($(CONFIG_SND_SOC_MSM_QDSP6V2_INTF), m)
 	Q6_OBJS += avtimer.o
 	Q6_OBJS += q6_init.o
 endif
-ifeq ($(CONFIG_MSM_ADSP_LOADER), m)
+ifdef CONFIG_DTS_SRS_TM
+	Q6_OBJS += msm-dts-srs-tm-config.o
+endif
+
+ifdef CONFIG_MSM_ADSP_LOADER
 ADSP_LOADER_OBJS += adsp-loader.o
 endif
 
-ifeq ($(CONFIG_MSM_QDSP6_NOTIFIER), m)
+ifdef CONFIG_MSM_QDSP6_NOTIFIER
 QDSP6_NOTIFIER_OBJS += audio_notifier.o audio_ssr.o
 endif
 
-ifeq ($(CONFIG_MSM_QDSP6_PDR), m)
+ifdef CONFIG_MSM_QDSP6_PDR
 QDSP6_PDR_OBJS += audio_pdr.o
 endif
 
-ifeq ($(CONFIG_MSM_ULTRASOUND), m)
+ifdef CONFIG_MSM_ULTRASOUND
 USF_OBJS += usf.o usfcdev.o q6usm.o
 endif
 
 LINUX_INC +=	-Iinclude/linux
 
-INCS :=		$(COMMON_INC) \
+INCS +=		$(COMMON_INC) \
 		$(UAPI_INC)
 
-ifeq ($(CONFIG_ARCH_SDM845), y)
-INCS    +=  -include $(AUDIO_ROOT)/config/sdm845autoconf.h
-endif
-ifeq ($(CONFIG_ARCH_SDM670), y)
-INCS    +=  -include $(AUDIO_ROOT)/config/sdm670autoconf.h
-endif
-
 EXTRA_CFLAGS += $(INCS)
 
 
@@ -128,7 +135,13 @@ CHIP_NAME ?= $(MODNAME)
 CDEFINES += -DMULTI_IF_NAME=\"$(CHIP_NAME)\"
 endif
 
+ifeq ($(KERNEL_BUILD), 0)
 KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/ipc/Module.symvers
+endif
+
+ifeq ($(KERNEL_BUILD), 1)
+	obj-y += codecs/
+endif
 
 obj-$(CONFIG_SND_SOC_MSM_QDSP6V2_INTF) += q6_dlkm.o
 q6_dlkm-y := $(Q6_OBJS)

+ 0 - 10
dsp/Makefile

@@ -1,10 +0,0 @@
-obj-$(CONFIG_SND_SOC_MSM_QDSP6V2_INTF) += audio_calibration.o audio_cal_utils.o \
-						q6adm.o q6afe.o q6asm.o q6audio-v2.o q6voice.o q6core.o \
-						rtac.o q6lsm.o audio_slimslave.o adsp_err.o msm_audio_ion.o
-obj-$(CONFIG_MSM_ADSP_LOADER) += adsp-loader.o
-obj-$(CONFIG_MSM_QDSP6_SSR) += audio_ssr.o
-obj-$(CONFIG_MSM_QDSP6_PDR) += audio_pdr.o
-obj-$(CONFIG_MSM_QDSP6_NOTIFIER) += audio_notifier.o
-obj-$(CONFIG_MSM_ULTRASOUND) += usf.o usfcdev.o q6usm.o
-obj-$(CONFIG_MSM_AVTIMER) += avtimer.o
-obj-$(CONFIG_MSM_QDSP6V2_CODECS)  += codecs/

+ 1 - 1
dsp/adsp_err.c

@@ -167,7 +167,7 @@ int __init adsp_err_init(void) { return 0; }
 
 #endif
 
-void __exit adsp_err_exit(void)
+void adsp_err_exit(void)
 {
 	return;
 }

+ 1 - 1
dsp/audio_calibration.c

@@ -609,7 +609,7 @@ int __init audio_cal_init(void)
 	return misc_register(&audio_cal_misc);
 }
 
-void __exit audio_cal_exit(void)
+void audio_cal_exit(void)
 {
 	int i = 0;
 	struct list_head *ptr, *next;

+ 2 - 2
dsp/audio_slimslave.c

@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013-2014, 2017 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
@@ -165,7 +165,7 @@ int __init audio_slimslave_init(void)
 	return slim_driver_register(&audio_slimslave_driver);
 }
 
-void __exit audio_slimslave_exit(void)
+void audio_slimslave_exit(void)
 {
 
 }

+ 1 - 1
dsp/avtimer.c

@@ -535,7 +535,7 @@ error_platform_driver:
 	return rc;
 }
 
-void __exit avtimer_exit(void)
+void avtimer_exit(void)
 {
 	platform_driver_unregister(&dev_avtimer_driver);
 }

+ 17 - 22
dsp/codecs/Kbuild

@@ -1,22 +1,32 @@
 # We can build either as part of a standalone Kernel build or as
 # an external module.  Determine which mechanism is being used
-KERNEL_BUILD := 0
-
+ifeq ($(MODNAME), )
+	KERNEL_BUILD := 1
+else
+	KERNEL_BUILD := 0
+endif
 
-ifeq ($(KERNEL_BUILD), 0)
+ifeq ($(KERNEL_BUILD), 1)
 	# These are configurable via Kconfig for kernel-based builds
 	# Need to explicitly configure for Android-based builds
+	AUDIO_BLD_DIR := $(ANDROID_BUILD_TOP)/kernel/msm-4.9
+	AUDIO_ROOT := $(AUDIO_BLD_DIR)/techpack/audio
+endif
+
+ifeq ($(KERNEL_BUILD), 0)
 	ifeq ($(CONFIG_ARCH_SDM845), y)
 		include $(AUDIO_ROOT)/config/sdm845auto.conf
 		export
+		INCS    +=  -include $(AUDIO_ROOT)/config/sdm845autoconf.h
+
 	endif
 	ifeq ($(CONFIG_ARCH_SDM670), y)
 		include $(AUDIO_ROOT)/config/sdm670auto.conf
 		export
+		INCS    +=  -include $(AUDIO_ROOT)/config/sdm670autoconf.h
 	endif
 endif
 
-
 # As per target team, build is done as follows:
 # Defconfig : build with default flags
 # Slub      : defconfig  + CONFIG_SLUB_DEBUG := y +
@@ -43,7 +53,7 @@ COMMON_INC :=	-I$(AUDIO_ROOT)/$(COMMON_DIR)
 
 ############ Native Enc/Dec ############
 
-ifeq ($(CONFIG_MSM_QDSP6V2_CODECS), m)
+ifdef CONFIG_MSM_QDSP6V2_CODECS
 	NATIVE_OBJS += q6audio_v2.o q6audio_v2_aio.o
 	NATIVE_OBJS += audio_utils_aio.o
 	NATIVE_OBJS += audio_utils.o
@@ -74,16 +84,9 @@ endif
 
 LINUX_INC +=	-Iinclude/linux
 
-INCS :=		$(COMMON_INC) \
+INCS +=		$(COMMON_INC) \
 		$(UAPI_INC)
 
-ifeq ($(CONFIG_ARCH_SDM845), y)
-INCS    +=  -include $(AUDIO_ROOT)/config/sdm845autoconf.h
-endif
-ifeq ($(CONFIG_ARCH_SDM670), y)
-INCS    +=  -include $(AUDIO_ROOT)/config/sdm670autoconf.h
-endif
-
 EXTRA_CFLAGS += $(INCS)
 
 
@@ -112,17 +115,9 @@ ifeq ($(call cc-option-yn, -Wheader-guard),y)
 EXTRA_CFLAGS += -Wheader-guard
 endif
 
+ifeq ($(KERNEL_BUILD), 0)
 KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
 KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/Module.symvers
-# If the module name is not "wlan", then the define MULTI_IF_NAME to be the
-# same a the QCA CHIP name. The host driver will then append MULTI_IF_NAME to
-# any string that must be unique for all instances of the driver on the system.
-# This allows multiple instances of the driver with different module names.
-# If the module name is wlan, leave MULTI_IF_NAME undefined and the code will
-# treat the driver as the primary driver.
-ifneq ($(MODNAME), qdsp6v2)
-CHIP_NAME ?= $(MODNAME)
-CDEFINES += -DMULTI_IF_NAME=\"$(CHIP_NAME)\"
 endif
 
 # Module information used by KBuild framework

+ 0 - 5
dsp/codecs/Makefile

@@ -1,5 +0,0 @@
-obj-$(CONFIG_MSM_QDSP6V2_CODECS) += aac_in.o qcelp_in.o evrc_in.o amrnb_in.o g711mlaw_in.o g711alaw_in.o audio_utils.o
-obj-$(CONFIG_MSM_QDSP6V2_CODECS) += audio_wma.o audio_wmapro.o audio_aac.o audio_multi_aac.o audio_alac.o audio_ape.o audio_utils_aio.o
-obj-$(CONFIG_MSM_QDSP6V2_CODECS) += q6audio_v2.o q6audio_v2_aio.o
-obj-$(CONFIG_MSM_QDSP6V2_CODECS) += audio_g711mlaw.o audio_g711alaw.o
-obj-$(CONFIG_MSM_QDSP6V2_CODECS)  += audio_mp3.o audio_amrnb.o audio_amrwb.o audio_amrwbplus.o audio_evrc.o audio_qcelp.o amrwb_in.o audio_hwacc_effects.o

+ 1 - 1
dsp/codecs/aac_in.c

@@ -707,7 +707,7 @@ int __init aac_in_init(void)
 	return misc_register(&audio_aac_in_misc);
 }
 
-void __exit aac_in_exit(void)
+void aac_in_exit(void)
 {
 	misc_deregister(&audio_aac_in_misc);
 }

+ 1 - 1
dsp/codecs/amrnb_in.c

@@ -399,7 +399,7 @@ int __init amrnb_in_init(void)
 	return misc_register(&audio_amrnb_in_misc);
 }
 
-void __exit amrnb_in_exit(void)
+void amrnb_in_exit(void)
 {
 	misc_deregister(&audio_amrnb_in_misc);
 }

+ 1 - 1
dsp/codecs/amrwb_in.c

@@ -397,7 +397,7 @@ int __init amrwb_in_init(void)
 	return misc_register(&audio_amrwb_in_misc);
 }
 
-void __exit amrwb_in_exit(void)
+void amrwb_in_exit(void)
 {
 	misc_deregister(&audio_amrwb_in_misc);
 }

+ 1 - 1
dsp/codecs/audio_aac.c

@@ -473,7 +473,7 @@ int __init audio_aac_init(void)
 	return ret;
 }
 
-void __exit audio_aac_exit(void)
+void audio_aac_exit(void)
 {
 	mutex_destroy(&audio_aac_ws_mgr.ws_lock);
 	misc_deregister(&audio_aac_misc);

+ 1 - 1
dsp/codecs/audio_alac.c

@@ -432,7 +432,7 @@ int __init audio_alac_init(void)
 	return ret;
 }
 
-void __exit audio_alac_exit(void)
+void audio_alac_exit(void)
 {
 	mutex_destroy(&audio_alac_ws_mgr.ws_lock);
 	misc_deregister(&audio_alac_misc);

+ 1 - 1
dsp/codecs/audio_amrnb.c

@@ -223,7 +223,7 @@ int __init audio_amrnb_init(void)
 	return ret;
 }
 
-void __exit audio_amrnb_exit(void)
+void audio_amrnb_exit(void)
 {
 	mutex_destroy(&audio_amrnb_ws_mgr.ws_lock);
 	misc_deregister(&audio_amrnb_misc);

+ 1 - 1
dsp/codecs/audio_amrwb.c

@@ -228,7 +228,7 @@ int __init audio_amrwb_init(void)
 	return ret;
 }
 
-void __exit audio_amrwb_exit(void)
+void audio_amrwb_exit(void)
 {
 	mutex_destroy(&audio_amrwb_ws_mgr.ws_lock);
 	misc_deregister(&audio_amrwb_misc);

+ 1 - 1
dsp/codecs/audio_amrwbplus.c

@@ -394,7 +394,7 @@ int __init audio_amrwbplus_init(void)
 	return ret;
 }
 
-void __exit audio_amrwbplus_exit(void)
+void audio_amrwbplus_exit(void)
 {
 	mutex_destroy(&audio_amrwbplus_ws_mgr.ws_lock);
 	misc_deregister(&audio_amrwbplus_misc);

+ 1 - 1
dsp/codecs/audio_ape.c

@@ -356,7 +356,7 @@ int __init audio_ape_init(void)
 	return ret;
 }
 
-void __exit audio_ape_exit(void)
+void audio_ape_exit(void)
 {
 	mutex_destroy(&audio_ape_ws_mgr.ws_lock);
 	misc_deregister(&audio_ape_misc);

+ 1 - 1
dsp/codecs/audio_evrc.c

@@ -181,7 +181,7 @@ int __init audio_evrc_init(void)
 	return ret;
 }
 
-void __exit audio_evrc_exit(void)
+void audio_evrc_exit(void)
 {
 	mutex_destroy(&audio_evrc_ws_mgr.ws_lock);
 	misc_deregister(&audio_evrc_misc);

+ 1 - 1
dsp/codecs/audio_g711alaw.c

@@ -387,7 +387,7 @@ int __init audio_g711alaw_init(void)
 	return ret;
 }
 
-void __exit audio_g711alaw_exit(void)
+void audio_g711alaw_exit(void)
 {
 	mutex_destroy(&audio_g711_ws_mgr.ws_lock);
 	misc_deregister(&audio_g711alaw_misc);

+ 1 - 1
dsp/codecs/audio_g711mlaw.c

@@ -386,7 +386,7 @@ int __init audio_g711mlaw_init(void)
 	return ret;
 }
 
-void __exit audio_g711mlaw_exit(void)
+void audio_g711mlaw_exit(void)
 {
 	mutex_destroy(&audio_g711_ws_mgr.ws_lock);
 	misc_deregister(&audio_g711mlaw_misc);

+ 1 - 1
dsp/codecs/audio_hwacc_effects.c

@@ -772,7 +772,7 @@ int __init audio_effects_init(void)
 	return misc_register(&audio_effects_misc);
 }
 
-void __exit audio_effects_exit(void)
+void audio_effects_exit(void)
 {
 	misc_deregister(&audio_effects_misc);
 }

+ 1 - 1
dsp/codecs/audio_mp3.c

@@ -185,7 +185,7 @@ int __init audio_mp3_init(void)
 	return ret;
 }
 
-void __exit audio_mp3_exit(void)
+void audio_mp3_exit(void)
 {
 	mutex_destroy(&audio_mp3_ws_mgr.ws_lock);
 	misc_deregister(&audio_mp3_misc);

+ 1 - 1
dsp/codecs/audio_multi_aac.c

@@ -520,7 +520,7 @@ int __init audio_multiaac_init(void)
 	return ret;
 }
 
-void __exit audio_multiaac_exit(void)
+void audio_multiaac_exit(void)
 {
 	mutex_destroy(&audio_multiaac_ws_mgr.ws_lock);
 	misc_deregister(&audio_multiaac_misc);

+ 1 - 1
dsp/codecs/audio_qcelp.c

@@ -188,7 +188,7 @@ int audio_qcelp_init(void)
 	return ret;
 }
 
-void __exit audio_qcelp_exit(void)
+void audio_qcelp_exit(void)
 {
 	mutex_destroy(&audio_qcelp_ws_mgr.ws_lock);
 	misc_deregister(&audio_qcelp_misc);

+ 1 - 1
dsp/codecs/audio_wma.c

@@ -342,7 +342,7 @@ int __init audio_wma_init(void)
 	return ret;
 }
 
-void __exit audio_wma_exit(void)
+void audio_wma_exit(void)
 {
 	mutex_destroy(&audio_wma_ws_mgr.ws_lock);
 	misc_deregister(&audio_wma_misc);

+ 1 - 1
dsp/codecs/audio_wmapro.c

@@ -415,7 +415,7 @@ int __init audio_wmapro_init(void)
 	return ret;
 }
 
-void __exit audio_wmapro_exit(void)
+void audio_wmapro_exit(void)
 {
 	mutex_destroy(&audio_wmapro_ws_mgr.ws_lock);
 	misc_deregister(&audio_wmapro_misc);

+ 1 - 1
dsp/codecs/evrc_in.c

@@ -407,7 +407,7 @@ int __init evrc_in_init(void)
 	return misc_register(&audio_evrc_in_misc);
 }
 
-void __exit evrc_in_exit(void)
+void evrc_in_exit(void)
 {
 	misc_deregister(&audio_evrc_in_misc);
 }

+ 1 - 1
dsp/codecs/g711alaw_in.c

@@ -379,7 +379,7 @@ int __init g711alaw_in_init(void)
 	return misc_register(&audio_g711alaw_in_misc);
 }
 
-void __exit g711alaw_in_exit(void)
+void g711alaw_in_exit(void)
 {
 	misc_deregister(&audio_g711alaw_in_misc);
 }

+ 1 - 1
dsp/codecs/g711mlaw_in.c

@@ -382,7 +382,7 @@ int __init g711mlaw_in_init(void)
 	return misc_register(&audio_g711mlaw_in_misc);
 }
 
-void __exit g711mlaw_in_exit(void)
+void g711mlaw_in_exit(void)
 {
 	misc_deregister(&audio_g711mlaw_in_misc);
 }

+ 1 - 1
dsp/codecs/qcelp_in.c

@@ -407,7 +407,7 @@ int __init qcelp_in_init(void)
 	return misc_register(&audio_qcelp_in_misc);
 }
 
-void __exit qcelp_in_exit(void)
+void qcelp_in_exit(void)
 {
 	misc_deregister(&audio_qcelp_in_misc);
 }

+ 1 - 1
dsp/msm_audio_ion.c

@@ -917,7 +917,7 @@ int __init msm_audio_ion_init(void)
 	return platform_driver_register(&msm_audio_ion_driver);
 }
 
-void __exit msm_audio_ion_exit(void)
+void msm_audio_ion_exit(void)
 {
 	platform_driver_unregister(&msm_audio_ion_driver);
 }

+ 1 - 1
dsp/q6adm.c

@@ -5246,7 +5246,7 @@ int __init adm_init(void)
 	return 0;
 }
 
-void __exit adm_exit(void)
+void adm_exit(void)
 {
 	mutex_destroy(&dts_srs_lock);
 	adm_delete_cal_data();

+ 1 - 1
dsp/q6afe.c

@@ -7576,7 +7576,7 @@ int __init afe_init(void)
 	return 0;
 }
 
-void __exit afe_exit(void)
+void afe_exit(void)
 {
 	afe_delete_cal_data();
 

+ 1 - 1
dsp/q6asm.c

@@ -10286,7 +10286,7 @@ int __init q6asm_init(void)
 	return 0;
 }
 
-void __exit q6asm_exit(void)
+void q6asm_exit(void)
 {
 	q6asm_delete_cal_data();
 }

+ 1 - 1
dsp/q6core.c

@@ -1105,7 +1105,7 @@ int __init core_init(void)
 	return 0;
 }
 
-void __exit core_exit(void)
+void core_exit(void)
 {
 	mutex_destroy(&q6core_lcl.cmd_lock);
 	mutex_destroy(&q6core_lcl.ver_lock);

+ 1 - 1
dsp/q6lsm.c

@@ -2376,7 +2376,7 @@ int __init q6lsm_init(void)
 	return 0;
 }
 
-void __exit q6lsm_exit(void)
+void q6lsm_exit(void)
 {
 	lsm_delete_cal_data();
 }

+ 1 - 1
dsp/q6voice.c

@@ -9606,7 +9606,7 @@ int __init voice_init(void)
 }
 
 
-void __exit voice_exit(void)
+void voice_exit(void)
 {
 	voice_delete_cal_data();
 	free_cal_map_table();

+ 1 - 1
dsp/rtac.c

@@ -1949,7 +1949,7 @@ nomem:
 	return -ENOMEM;
 }
 
-void __exit rtac_exit(void)
+void rtac_exit(void)
 {
 	kzfree(rtac_adm_buffer);
 	kzfree(rtac_asm_buffer);

+ 34 - 19
ipc/Kbuild

@@ -1,25 +1,41 @@
 # We can build either as part of a standalone Kernel build or as
 # an external module.  Determine which mechanism is being used
-KERNEL_BUILD := 0
+ifeq ($(MODNAME),)
+	KERNEL_BUILD := 1
+else
+	KERNEL_BUILD := 0
+endif
+
+TARGET_KERNEL_VERSION := 4.9
 
-TARGET_KERNEL_VERSION := 4.4
+# These are configurable via Kconfig for kernel-based builds
+# Need to explicitly configure for Android-based builds
+ifeq ($(CONFIG_ARCH_SDM845), y)
+	TARGET_KERNEL_VERSION := 4.9
+endif
+ifeq ($(CONFIG_ARCH_SDM670), y)
+	TARGET_KERNEL_VERSION := 4.9
+endif
+
+KDIR := $(TOP)/kernel/msm-$(TARGET_KERNEL_VERSION)
+
+ifeq ($(KERNEL_BUILD), 1)
+	AUDIO_ROOT := $(KDIR)/techpack/audio
+endif
 
 ifeq ($(KERNEL_BUILD), 0)
-	# These are configurable via Kconfig for kernel-based builds
-	# Need to explicitly configure for Android-based builds
 	ifeq ($(CONFIG_ARCH_SDM845), y)
 		include $(AUDIO_ROOT)/config/sdm845auto.conf
 		export
-		TARGET_KERNEL_VERSION := 4.9
+		INCS    +=  -include $(AUDIO_ROOT)/config/sdm845autoconf.h
 	endif
 	ifeq ($(CONFIG_ARCH_SDM670), y)
 		include $(AUDIO_ROOT)/config/sdm670auto.conf
 		export
-		TARGET_KERNEL_VERSION := 4.9
+		INCS    +=  -include $(AUDIO_ROOT)/config/sdm670autoconf.h
 	endif
 endif
 
-
 # As per target team, build is done as follows:
 # Defconfig : build with default flags
 # Slub      : defconfig  + CONFIG_SLUB_DEBUG := y +
@@ -46,34 +62,27 @@ COMMON_INC :=	-I$(AUDIO_ROOT)/$(COMMON_DIR)
 
 ############ IPC ############
 
-ifeq ($(CONFIG_MSM_QDSP6_APRV2_GLINK), m)
+ifdef CONFIG_MSM_QDSP6_APRV2_GLINK
 APRV_GLINK += apr.o
 APRV_GLINK += apr_v2.o
 APRV_GLINK += apr_tal_glink.o
 endif
 
-ifeq ($(CONFIG_MSM_QDSP6_APRV3_GLINK), m)
+ifdef CONFIG_MSM_QDSP6_APRV3_GLINK
 APRV_GLINK += apr.o
 APRV_GLINK += apr_v3.o
 APRV_GLINK += apr_tal_glink.o
 endif
 
-ifeq ($(CONFIG_WCD_DSP_GLINK), m)
+ifdef CONFIG_WCD_DSP_GLINK
 WDSP_GLINK += wcd-dsp-glink.o
 endif
 
 LINUX_INC +=	-Iinclude/linux
 
-INCS :=		$(COMMON_INC) \
+INCS +=		$(COMMON_INC) \
 		$(UAPI_INC)
 
-ifeq ($(CONFIG_ARCH_SDM845), y)
-INCS    +=  -include $(AUDIO_ROOT)/config/sdm845autoconf.h
-endif
-ifeq ($(CONFIG_ARCH_SDM670), y)
-INCS    +=  -include $(AUDIO_ROOT)/config/sdm670autoconf.h
-endif
-
 EXTRA_CFLAGS += $(INCS)
 
 
@@ -89,6 +98,8 @@ CDEFINES +=	-DANI_LITTLE_BYTE_ENDIAN \
 
 KBUILD_CPPFLAGS += $(CDEFINES)
 
+ifeq ($(KERNEL_BUILD), 0)
+
 HEADER_INSTALL_DIR := $(TOP)/kernel/msm-$(TARGET_KERNEL_VERSION)/scripts
 UAPI_OUT := $(OUT)/obj/vendor/qcom/opensource/audio-kernel/include
 $(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/linux/ $(AUDIO_ROOT)/include/uapi/linux/ avtimer.h;)
@@ -118,6 +129,10 @@ $(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT
 $(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ voice_params.h;)
 $(shell $(HEADER_INSTALL_DIR)/headers_install.sh $(UAPI_OUT)/sound/ $(AUDIO_ROOT)/include/uapi/sound/ wcd-dsp-glink.h;)
 
+KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
+
+endif
+
 # Currently, for versions of gcc which support it, the kernel Makefile
 # is disabling the maybe-uninitialized warning.  Re-enable it for the
 # AUDIO driver.  Note that we must use EXTRA_CFLAGS here so that it
@@ -141,9 +156,9 @@ CHIP_NAME ?= $(MODNAME)
 CDEFINES += -DMULTI_IF_NAME=\"$(CHIP_NAME)\"
 endif
 
-KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
 # Module information used by KBuild framework
 obj-$(CONFIG_MSM_QDSP6_APRV2_GLINK) += apr_dlkm.o
+obj-$(CONFIG_MSM_QDSP6_APRV3_GLINK) += apr_dlkm.o
 apr_dlkm-y := $(APRV_GLINK)
 
 obj-$(CONFIG_WCD_DSP_GLINK) += wglink_dlkm.o

+ 0 - 3
ipc/Makefile

@@ -1,3 +0,0 @@
-obj-$(CONFIG_MSM_QDSP6_APRV2_GLINK) += apr.o apr_v2.o apr_tal_glink.o
-obj-$(CONFIG_MSM_QDSP6_APRV3_GLINK) += apr.o apr_v3.o apr_tal_glink.o
-obj-$(CONFIG_WCD_DSP_GLINK) += wcd-dsp-glink.o

+ 21 - 16
soc/Kbuild

@@ -1,22 +1,31 @@
 # We can build either as part of a standalone Kernel build or as
 # an external module.  Determine which mechanism is being used
-KERNEL_BUILD := 0
-
+ifeq ($(MODNAME),)
+	KERNEL_BUILD := 1
+else
+	KERNEL_BUILD := 0
+endif
 
-ifeq ($(KERNEL_BUILD), 0)
+ifeq ($(KERNEL_BUILD), 1)
 	# These are configurable via Kconfig for kernel-based builds
 	# Need to explicitly configure for Android-based builds
+	AUDIO_BLD_DIR := $(ANDROID_BUILD_TOP)/kernel/msm-4.9
+	AUDIO_ROOT := $(AUDIO_BLD_DIR)/techpack/audio
+endif
+
+ifeq ($(KERNEL_BUILD), 0)
 	ifeq ($(CONFIG_ARCH_SDM845), y)
 		include $(AUDIO_ROOT)/config/sdm845auto.conf
 		export
+		INCS    +=  -include $(AUDIO_ROOT)/config/sdm845autoconf.h
 	endif
 	ifeq ($(CONFIG_ARCH_SDM670), y)
 		include $(AUDIO_ROOT)/config/sdm670auto.conf
 		export
+		INCS    +=  -include $(AUDIO_ROOT)/config/sdm670autoconf.h
 	endif
 endif
 
-
 # As per target team, build is done as follows:
 # Defconfig : build with default flags
 # Slub      : defconfig  + CONFIG_SLUB_DEBUG := y +
@@ -44,37 +53,30 @@ COMMON_INC :=	-I$(AUDIO_ROOT)/$(COMMON_DIR)
 ############ SoC Modules ############
 
 # for pinctrl WCD driver
-ifeq ($(CONFIG_PINCTRL_WCD), m)
+ifdef CONFIG_PINCTRL_WCD
 	PINCTRL_WCD_OBJS += pinctrl-wcd.o
 endif
 
 # for pinctrl LPI driver
-ifeq ($(CONFIG_PINCTRL_LPI), m)
+ifdef CONFIG_PINCTRL_LPI
 	PINCTRL_LPI_OBJS += pinctrl-lpi.o
 endif
 
 # for soundwire driver
-ifeq ($(CONFIG_SOUNDWIRE_WCD_CTRL), m)
+ifdef CONFIG_SOUNDWIRE_WCD_CTRL
 	SWR_CTRL_OBJS += swr-wcd-ctrl.o
 endif
 
-ifeq ($(CONFIG_SOUNDWIRE), m)
+ifdef CONFIG_SOUNDWIRE
 	SWR_OBJS += regmap-swr.o
 	SWR_OBJS += soundwire.o
 endif
 
 LINUX_INC +=	-Iinclude/linux
 
-INCS :=		$(COMMON_INC) \
+INCS +=		$(COMMON_INC) \
 		$(UAPI_INC)
 
-ifeq ($(CONFIG_ARCH_SDM845), y)
-INCS    +=  -include $(AUDIO_ROOT)/config/sdm845autoconf.h
-endif
-ifeq ($(CONFIG_ARCH_SDM670), y)
-INCS    +=  -include $(AUDIO_ROOT)/config/sdm670autoconf.h
-endif
-
 EXTRA_CFLAGS += $(INCS)
 
 
@@ -90,7 +92,10 @@ CDEFINES +=	-DANI_LITTLE_BYTE_ENDIAN \
 
 KBUILD_CPPFLAGS += $(CDEFINES)
 
+ifeq ($(KERNEL_BUILD), 0)
 KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
+endif
+
 # Currently, for versions of gcc which support it, the kernel Makefile
 # is disabling the maybe-uninitialized warning.  Re-enable it for the
 # AUDIO driver.  Note that we must use EXTRA_CFLAGS here so that it

+ 0 - 6
soc/Makefile

@@ -1,6 +0,0 @@
-
-obj-$(CONFIG_REGMAP_SWR) += regmap-swr.o
-obj-$(CONFIG_PINCTRL_WCD)	+= pinctrl-wcd.o
-obj-$(CONFIG_PINCTRL_LPI)	+= pinctrl-lpi.o
-obj-$(CONFIG_SOUNDWIRE)			+= soundwire.o
-obj-$(CONFIG_SOUNDWIRE_WCD_CTRL)	+= swr-wcd-ctrl.o