Merge "asoc: routing: update app type config get function"
diff --git a/Android.mk b/Android.mk
index d5be7c8..e3a9696 100644
--- a/Android.mk
+++ b/Android.mk
@@ -3,7 +3,7 @@
UAPI_OUT := $(PRODUCT_OUT)/obj/vendor/qcom/opensource/audio-kernel/include
-ifeq ($(call is-board-platform-in-list,msm8953 sdm845 sdm670 qcs605 msmnile $(MSMSTEPPE) $(TRINKET)),true)
+ifeq ($(call is-board-platform-in-list,msmnile $(MSMSTEPPE) $(TRINKET)),true)
$(shell mkdir -p $(UAPI_OUT)/linux;)
$(shell mkdir -p $(UAPI_OUT)/sound;)
$(shell rm -rf $(PRODUCT_OUT)/obj/vendor/qcom/opensource/audio-kernel/ipc/Module.symvers)
@@ -24,7 +24,7 @@
include $(MY_LOCAL_PATH)/asoc/codecs/wcd934x/Android.mk
endif
-ifeq ($(call is-board-platform-in-list,sdm670 msmnile),true)
+ifeq ($(call is-board-platform-in-list,msmnile),true)
$(shell rm -rf $(PRODUCT_OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/aqt1000/Module.symvers)
include $(MY_LOCAL_PATH)/asoc/codecs/aqt1000/Android.mk
endif
@@ -35,15 +35,3 @@
$(shell rm -rf $(PRODUCT_OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/wcd937x/Module.symvers)
include $(MY_LOCAL_PATH)/asoc/codecs/wcd937x/Android.mk
endif
-
-ifeq ($(call is-board-platform-in-list,msm8953 sdm670 qcs605),true)
-$(shell rm -rf $(PRODUCT_OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/sdm660_cdc/Module.symvers)
-$(shell rm -rf $(PRODUCT_OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/msm_sdw/Module.symvers)
-include $(MY_LOCAL_PATH)/asoc/codecs/sdm660_cdc/Android.mk
-include $(MY_LOCAL_PATH)/asoc/codecs/msm_sdw/Android.mk
-endif
-
-ifeq ($(call is-board-platform-in-list,msmnile),true)
-$(shell rm -rf $(PRODUCT_OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/wcd9360/Module.symvers)
-include $(MY_LOCAL_PATH)/asoc/codecs/wcd9360/Android.mk
-endif
diff --git a/Makefile b/Makefile
index 159b68c..d9d093b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,4 @@
# auto-detect subdirs
-ifeq ($(CONFIG_ARCH_SDM845), y)
-include $(srctree)/techpack/audio/config/sdm845auto.conf
-export
-endif
-ifeq ($(CONFIG_ARCH_SDM670), y)
-include $(srctree)/techpack/audio/config/sdm670auto_static.conf
-export
-endif
ifeq ($(CONFIG_ARCH_SDXPOORWILLS), y)
include $(srctree)/techpack/audio/config/sdxpoorwillsauto.conf
export
@@ -30,14 +22,6 @@
-I$(srctree)/techpack/audio/include/uapi \
-I$(srctree)/techpack/audio/include
-ifeq ($(CONFIG_ARCH_SDM845), y)
-LINUXINCLUDE += \
- -include $(srctree)/techpack/audio/config/sdm845autoconf.h
-endif
-ifeq ($(CONFIG_ARCH_SDM670), y)
-LINUXINCLUDE += \
- -include $(srctree)/techpack/audio/config/sdm670autoconf.h
-endif
ifeq ($(CONFIG_ARCH_SDXPOORWILLS), y)
LINUXINCLUDE += \
-include $(srctree)/techpack/audio/config/sdxpoorwillsautoconf.h
diff --git a/Makefile.am b/Makefile.am
index 4a9f96e..7ee55c0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -11,15 +11,6 @@
AUDIO_KERNEL_HEADERS_PATH2 = $(shell ls ./include/uapi/linux/mfd/wcd9xxx/*.h)
AUDIO_KERNEL_HEADERS_PATH3 = $(shell ls ./include/uapi/sound/*.h)
-ifeq ($(TARGET_SUPPORT), $(filter $(TARGET_SUPPORT), sdm670 qcs605))
-KBUILD_OPTIONS += CONFIG_ARCH_SDM670=y
-endif
-ifeq ($(TARGET_SUPPORT),sdm845)
-KBUILD_OPTIONS += CONFIG_ARCH_SDM845=y
-endif
-ifeq ($(TARGET_SUPPORT),apq8053)
-KBUILD_OPTIONS += CONFIG_ARCH_SDM450=y
-endif
ifeq ($(TARGET_SUPPORT),qcs40x)
KBUILD_OPTIONS += CONFIG_ARCH_QCS405=y
endif
@@ -33,15 +24,9 @@
obj-m += soc/
obj-m += asoc/
obj-m += asoc/codecs/
-ifeq ($(TARGET_SUPPORT), $(filter $(TARGET_SUPPORT), sdm670 qcs605 sdmsteppe))
+ifeq ($(TARGET_SUPPORT), $(filter $(TARGET_SUPPORT), sdmsteppe))
obj-m += asoc/codecs/wcd934x/
endif
-ifeq ($(TARGET_SUPPORT), $(filter $(TARGET_SUPPORT), apq8053 sdm670 qcs605))
-obj-m += asoc/codecs/sdm660_cdc/
-endif
-ifeq ($(TARGET_SUPPORT), $(filter $(TARGET_SUPPORT), sdm670 qcs605))
-obj-m += asoc/codecs/msm_sdw/
-endif
ifeq ($(TARGET_SUPPORT), $(filter $(TARGET_SUPPORT), qcs40x))
obj-m += asoc/codecs/bolero/
obj-m += asoc/codecs/csra66x0/
diff --git a/asoc/Android.mk b/asoc/Android.mk
index ae00ed7..7937120 100644
--- a/asoc/Android.mk
+++ b/asoc/Android.mk
@@ -3,16 +3,6 @@
# Assume no targets will be supported
# Check if this driver needs be built for current target
-ifeq ($(call is-board-platform,sdm845),true)
-TARGET := sdm845
-AUDIO_SELECT := CONFIG_SND_SOC_SDM845=m
-endif
-
-ifeq ($(call is-board-platform-in-list,msm8953 sdm670 qcs605),true)
-TARGET := sdm670
-AUDIO_SELECT := CONFIG_SND_SOC_SDM670=m
-endif
-
ifeq ($(call is-board-platform,msmnile),true)
TARGET := msmnile
AUDIO_SELECT := CONFIG_SND_SOC_SM8150=m
@@ -30,7 +20,7 @@
AUDIO_CHIPSET := audio
# Build/Package only in case of supported target
-ifeq ($(call is-board-platform-in-list,msm8953 sdm845 sdm670 qcs605 msmnile $(MSMSTEPPE) $(TRINKET)),true)
+ifeq ($(call is-board-platform-in-list,msmnile $(MSMSTEPPE) $(TRINKET)),true)
LOCAL_PATH := $(call my-dir)
@@ -65,7 +55,7 @@
LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
include $(DLKM_DIR)/AndroidKernelModule.mk
###########################################################
-ifeq ($(call is-board-platform-in-list,msm8953 sdm670 qcs605),true)
+ifeq ($(call is-board-platform-in-list, ),true)
include $(CLEAR_VARS)
LOCAL_MODULE := $(AUDIO_CHIPSET)_cpe_lsm.ko
LOCAL_MODULE_KBUILD_NAME := cpe_lsm_dlkm.ko
diff --git a/asoc/Kbuild b/asoc/Kbuild
index 2481e5b..17d4d21 100644
--- a/asoc/Kbuild
+++ b/asoc/Kbuild
@@ -14,21 +14,6 @@
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
- ifeq ($(CONFIG_ARCH_SDM450), y)
- include $(AUDIO_ROOT)/config/sdm670auto.conf
- export
- INCS += -include $(AUDIO_ROOT)/config/sdm670autoconf.h
- endif
ifeq ($(CONFIG_ARCH_SM8150), y)
include $(AUDIO_ROOT)/config/sm8150auto.conf
export
@@ -82,28 +67,6 @@
############ ASoC Drivers ############
-
-# for SDM6xx sound card driver
-ifdef CONFIG_SND_SOC_SDM670
- MACHINE_OBJS += sdm660-common.o
-endif
-
-# for SDM6xx sound card driver
-ifdef CONFIG_SND_SOC_INT_CODEC
- MACHINE_OBJS += sdm660-internal.o
-endif
-
-# for SDM6xx sound card driver
-ifdef CONFIG_SND_SOC_EXT_CODEC
- MACHINE_OBJS += sdm660-external.o
- MACHINE_OBJS += sdm660-ext-dai-links.o
-endif
-
-# for SDM845 sound card driver
-ifdef CONFIG_SND_SOC_MACHINE_SDM845
- MACHINE_OBJS += sdm845.o
-endif
-
# for SM8150 sound card driver
ifdef CONFIG_SND_SOC_SM8150
MACHINE_OBJS += sa8155.o
@@ -197,8 +160,6 @@
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/wcd937x/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/
@@ -207,9 +168,6 @@
obj-$(CONFIG_SND_SOC_QDSP6V2) += platform_dlkm.o
platform_dlkm-y := $(PLATFORM_OBJS)
-obj-$(CONFIG_SND_SOC_MACHINE_SDM845) += machine_dlkm.o
-machine_dlkm-y := $(MACHINE_OBJS)
-
obj-$(CONFIG_SND_SOC_SM8150) += machine_dlkm.o
machine_dlkm-y := $(MACHINE_OBJS)
@@ -219,12 +177,6 @@
obj-$(CONFIG_SND_SOC_QCS405) += machine_dlkm.o
machine_dlkm-y := $(MACHINE_OBJS)
-obj-$(CONFIG_SND_SOC_EXT_CODEC) += machine_dlkm.o
-machine_dlkm-y := $(MACHINE_OBJS)
-
-obj-$(CONFIG_SND_SOC_INT_CODEC) += machine_dlkm.o
-machine_dlkm-y := $(MACHINE_OBJS)
-
obj-$(CONFIG_SND_SOC_CPE) += cpe_lsm_dlkm.o
cpe_lsm_dlkm-y := $(CPE_LSM_OBJS)
diff --git a/asoc/codecs/Android.mk b/asoc/codecs/Android.mk
index c6c8a44..8eb61c1 100644
--- a/asoc/codecs/Android.mk
+++ b/asoc/codecs/Android.mk
@@ -3,14 +3,6 @@
# Assume no targets will be supported
# Check if this driver needs be built for current target
-ifeq ($(call is-board-platform,sdm845),true)
-AUDIO_SELECT := CONFIG_SND_SOC_SDM845=m
-endif
-
-ifeq ($(call is-board-platform-in-list,msm8953 sdm670 qcs605),true)
-AUDIO_SELECT := CONFIG_SND_SOC_SDM670=m
-endif
-
ifeq ($(call is-board-platform,msmnile),true)
AUDIO_SELECT := CONFIG_SND_SOC_SM8150=m
endif
@@ -25,7 +17,7 @@
AUDIO_CHIPSET := audio
# Build/Package only in case of supported target
-ifeq ($(call is-board-platform-in-list,msm8953 sdm845 sdm670 qcs605 msmnile $(MSMSTEPPE) $(TRINKET)),true)
+ifeq ($(call is-board-platform-in-list,msmnile $(MSMSTEPPE) $(TRINKET)),true)
LOCAL_PATH := $(call my-dir)
@@ -68,7 +60,7 @@
LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
include $(DLKM_DIR)/AndroidKernelModule.mk
###########################################################
-ifeq ($(call is-board-platform-in-list,sdm670 qcs605),true)
+ifeq ($(call is-board-platform-in-list, ),true)
include $(CLEAR_VARS)
LOCAL_MODULE := $(AUDIO_CHIPSET)_wcd_cpe.ko
LOCAL_MODULE_KBUILD_NAME := wcd_cpe_dlkm.ko
@@ -86,7 +78,7 @@
LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
include $(DLKM_DIR)/AndroidKernelModule.mk
###########################################################
-ifeq ($(call is-board-platform-in-list,msm8953 sdm670 qcs605),true)
+ifeq ($(call is-board-platform-in-list, ),true)
include $(CLEAR_VARS)
LOCAL_MODULE := $(AUDIO_CHIPSET)_wcd9335.ko
LOCAL_MODULE_KBUILD_NAME := wcd9335_dlkm.ko
diff --git a/asoc/codecs/Kbuild b/asoc/codecs/Kbuild
index 48e0431..6f04844 100644
--- a/asoc/codecs/Kbuild
+++ b/asoc/codecs/Kbuild
@@ -14,21 +14,6 @@
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
- ifeq ($(CONFIG_ARCH_SDM450), y)
- include $(AUDIO_ROOT)/config/sdm670auto.conf
- export
- INCS += -include $(AUDIO_ROOT)/config/sdm670autoconf.h
- endif
ifeq ($(CONFIG_ARCH_SM8150), y)
include $(AUDIO_ROOT)/config/sm8150auto.conf
export
@@ -94,7 +79,6 @@
CORE_OBJS += msm-cdc-supply.o
CORE_OBJS += wcd934x/wcd934x-regmap.o
CORE_OBJS += wcd934x/wcd934x-tables.o
- CORE_OBJS += wcd9360/wcd9360-regmap.o
endif
ifdef CONFIG_SND_SOC_WCD9XXX_V2
@@ -193,9 +177,6 @@
ifeq ($(KERNEL_BUILD), 1)
obj-y += wcd934x/
- obj-y += sdm660_cdc/
- obj-y += msm_sdw/
- obj-y += wcd9360/
obj-y += wcd937x/
endif
# Module information used by KBuild framework
diff --git a/asoc/codecs/core.h b/asoc/codecs/core.h
index 7d9fcd2..c102a55 100644
--- a/asoc/codecs/core.h
+++ b/asoc/codecs/core.h
@@ -105,8 +105,6 @@
#define IS_CODEC_VERSION(wcd, wcdversion) \
((wcd->version == wcdversion) ? true : false)
-#define PAHU_VERSION_1_0 0
-
enum {
CDC_V_1_0,
CDC_V_1_1,
@@ -119,7 +117,6 @@
WCD9335,
WCD9326,
WCD934X,
- WCD9360,
};
enum wcd9xxx_slim_slave_addr_type {
@@ -298,7 +295,6 @@
TASHA_MAJOR = cpu_to_le16(0x0),
TASHA2P0_MAJOR = cpu_to_le16(0x107),
TAVIL_MAJOR = cpu_to_le16(0x108),
- PAHU_MAJOR = cpu_to_le16(0x109),
};
enum codec_power_states {
diff --git a/asoc/codecs/msm_sdw/Android.mk b/asoc/codecs/msm_sdw/Android.mk
deleted file mode 100644
index 7ec6592..0000000
--- a/asoc/codecs/msm_sdw/Android.mk
+++ /dev/null
@@ -1,46 +0,0 @@
-# Android makefile for audio kernel modules
-
-# Assume no targets will be supported
-
-AUDIO_CHIPSET := audio
-# Build/Package only in case of supported target
-ifeq ($(call is-board-platform-in-list,msm8953 sdm670 qcs605),true)
-AUDIO_SELECT := CONFIG_SND_SOC_SDM670=m
-
-LOCAL_PATH := $(call my-dir)
-
-# This makefile is only for DLKM
-ifneq ($(findstring vendor,$(LOCAL_PATH)),)
-
-ifneq ($(findstring opensource,$(LOCAL_PATH)),)
- AUDIO_BLD_DIR := $(shell pwd)/vendor/qcom/opensource/audio-kernel
-endif # opensource
-
-DLKM_DIR := $(TOP)/device/qcom/common/dlkm
-
-# Build audio.ko as $(AUDIO_CHIPSET)_audio.ko
-###########################################################
-# This is set once per LOCAL_PATH, not per (kernel) module
-KBUILD_OPTIONS := AUDIO_ROOT=$(AUDIO_BLD_DIR)
-
-# We are actually building audio.ko here, as per the
-# requirement we are specifying <chipset>_audio.ko as LOCAL_MODULE.
-# This means we need to rename the module to <chipset>_audio.ko
-# after audio.ko is built.
-KBUILD_OPTIONS += MODNAME=msm_sdw_dlkm
-KBUILD_OPTIONS += BOARD_PLATFORM=$(TARGET_BOARD_PLATFORM)
-KBUILD_OPTIONS += $(AUDIO_SELECT)
-
-###########################################################
-include $(CLEAR_VARS)
-LOCAL_MODULE := $(AUDIO_CHIPSET)_msm_sdw.ko
-LOCAL_MODULE_KBUILD_NAME := msm_sdw_dlkm.ko
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_DEBUG_ENABLE := true
-LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
-include $(DLKM_DIR)/AndroidKernelModule.mk
-###########################################################
-###########################################################
-
-endif # DLKM check
-endif # supported target check
diff --git a/asoc/codecs/msm_sdw/Kbuild b/asoc/codecs/msm_sdw/Kbuild
deleted file mode 100644
index 46639d2..0000000
--- a/asoc/codecs/msm_sdw/Kbuild
+++ /dev/null
@@ -1,115 +0,0 @@
-# We can build either as part of a standalone Kernel build or as
-# an external module. Determine which mechanism is being used
-ifeq ($(MODNAME),)
- KERNEL_BUILD := 1
-else
- KERNEL_BUILD := 0
-endif
-
-
-ifeq ($(KERNEL_BUILD), 1)
- # These are configurable via Kconfig for kernel-based builds
- # Need to explicitly configure for Android-based builds
- AUDIO_BLD_DIR := $(shell pwd)/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
- ifeq ($(CONFIG_ARCH_SDM450), 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 +
-# CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
-# Perf : Using appropriate msmXXXX-perf_defconfig
-#
-# Shipment builds (user variants) should not have any debug feature
-# enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
-# are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
-# there is no other way to identify defconfig builds, QTI internal
-# representation of perf builds (identified using the string 'perf'),
-# is used to identify if the build is a slub or defconfig one. This
-# way no critical debug feature will be enabled for perf and shipment
-# builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
-# config.
-
-############ UAPI ############
-UAPI_DIR := uapi
-UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
-
-############ COMMON ############
-COMMON_DIR := include
-COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
-
-############ MSM Soundwire ############
-
-# for MSM Soundwire Codec
-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
- MSM_SDW_OBJS += msm_sdw_cdc_utils.o
-endif
-
-LINUX_INC += -Iinclude/linux
-
-INCS += $(COMMON_INC) \
- $(UAPI_INC)
-
-EXTRA_CFLAGS += $(INCS)
-
-
-CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
- -DANI_LITTLE_BIT_ENDIAN \
- -DDOT11F_LITTLE_ENDIAN_HOST \
- -DANI_COMPILER_TYPE_GCC \
- -DANI_OS_TYPE_ANDROID=6 \
- -DPTT_SOCK_SVC_ENABLE \
- -Wall\
- -Werror\
- -D__linux__
-
-KBUILD_CPPFLAGS += $(CDEFINES)
-
-# 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
-# will override the kernel settings.
-ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
-EXTRA_CFLAGS += -Wmaybe-uninitialized
-endif
-#EXTRA_CFLAGS += -Wmissing-prototypes
-
-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)
-
-# inject some build related information
-DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"
diff --git a/asoc/codecs/msm_sdw/msm-sdw-tables.c b/asoc/codecs/msm_sdw/msm-sdw-tables.c
deleted file mode 100644
index 1b51805..0000000
--- a/asoc/codecs/msm_sdw/msm-sdw-tables.c
+++ /dev/null
@@ -1,319 +0,0 @@
-/* Copyright (c) 2016-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
- * 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.
- */
-
-#include <linux/types.h>
-#include "msm_sdw.h"
-
-const u8 msm_sdw_page_map[MSM_SDW_MAX_REGISTER] = {
- [MSM_SDW_TX9_SPKR_PROT_PATH_CTL] = 0xa,
- [MSM_SDW_TX9_SPKR_PROT_PATH_CFG0] = 0xa,
- [MSM_SDW_TX10_SPKR_PROT_PATH_CTL] = 0xa,
- [MSM_SDW_TX10_SPKR_PROT_PATH_CFG0] = 0xa,
- [MSM_SDW_TX11_SPKR_PROT_PATH_CTL] = 0xa,
- [MSM_SDW_TX11_SPKR_PROT_PATH_CFG0] = 0xa,
- [MSM_SDW_TX12_SPKR_PROT_PATH_CTL] = 0xa,
- [MSM_SDW_TX12_SPKR_PROT_PATH_CFG0] = 0xa,
- [MSM_SDW_COMPANDER7_CTL0] = 0xb,
- [MSM_SDW_COMPANDER7_CTL1] = 0xb,
- [MSM_SDW_COMPANDER7_CTL2] = 0xb,
- [MSM_SDW_COMPANDER7_CTL3] = 0xb,
- [MSM_SDW_COMPANDER7_CTL4] = 0xb,
- [MSM_SDW_COMPANDER7_CTL5] = 0xb,
- [MSM_SDW_COMPANDER7_CTL6] = 0xb,
- [MSM_SDW_COMPANDER7_CTL7] = 0xb,
- [MSM_SDW_COMPANDER8_CTL0] = 0xb,
- [MSM_SDW_COMPANDER8_CTL1] = 0xb,
- [MSM_SDW_COMPANDER8_CTL2] = 0xb,
- [MSM_SDW_COMPANDER8_CTL3] = 0xb,
- [MSM_SDW_COMPANDER8_CTL4] = 0xb,
- [MSM_SDW_COMPANDER8_CTL5] = 0xb,
- [MSM_SDW_COMPANDER8_CTL6] = 0xb,
- [MSM_SDW_COMPANDER8_CTL7] = 0xb,
- [MSM_SDW_RX7_RX_PATH_CTL] = 0xb,
- [MSM_SDW_RX7_RX_PATH_CFG0] = 0xb,
- [MSM_SDW_RX7_RX_PATH_CFG1] = 0xb,
- [MSM_SDW_RX7_RX_PATH_CFG2] = 0xb,
- [MSM_SDW_RX7_RX_VOL_CTL] = 0xb,
- [MSM_SDW_RX7_RX_PATH_MIX_CTL] = 0xb,
- [MSM_SDW_RX7_RX_PATH_MIX_CFG] = 0xb,
- [MSM_SDW_RX7_RX_VOL_MIX_CTL] = 0xb,
- [MSM_SDW_RX7_RX_PATH_SEC0] = 0xb,
- [MSM_SDW_RX7_RX_PATH_SEC1] = 0xb,
- [MSM_SDW_RX7_RX_PATH_SEC2] = 0xb,
- [MSM_SDW_RX7_RX_PATH_SEC3] = 0xb,
- [MSM_SDW_RX7_RX_PATH_SEC5] = 0xb,
- [MSM_SDW_RX7_RX_PATH_SEC6] = 0xb,
- [MSM_SDW_RX7_RX_PATH_SEC7] = 0xb,
- [MSM_SDW_RX7_RX_PATH_MIX_SEC0] = 0xb,
- [MSM_SDW_RX7_RX_PATH_MIX_SEC1] = 0xb,
- [MSM_SDW_RX8_RX_PATH_CTL] = 0xb,
- [MSM_SDW_RX8_RX_PATH_CFG0] = 0xb,
- [MSM_SDW_RX8_RX_PATH_CFG1] = 0xb,
- [MSM_SDW_RX8_RX_PATH_CFG2] = 0xb,
- [MSM_SDW_RX8_RX_VOL_CTL] = 0xb,
- [MSM_SDW_RX8_RX_PATH_MIX_CTL] = 0xb,
- [MSM_SDW_RX8_RX_PATH_MIX_CFG] = 0xb,
- [MSM_SDW_RX8_RX_VOL_MIX_CTL] = 0xb,
- [MSM_SDW_RX8_RX_PATH_SEC0] = 0xb,
- [MSM_SDW_RX8_RX_PATH_SEC1] = 0xb,
- [MSM_SDW_RX8_RX_PATH_SEC2] = 0xb,
- [MSM_SDW_RX8_RX_PATH_SEC3] = 0xb,
- [MSM_SDW_RX8_RX_PATH_SEC5] = 0xb,
- [MSM_SDW_RX8_RX_PATH_SEC6] = 0xb,
- [MSM_SDW_RX8_RX_PATH_SEC7] = 0xb,
- [MSM_SDW_RX8_RX_PATH_MIX_SEC0] = 0xb,
- [MSM_SDW_RX8_RX_PATH_MIX_SEC1] = 0xb,
- [MSM_SDW_BOOST0_BOOST_PATH_CTL] = 0xc,
- [MSM_SDW_BOOST0_BOOST_CTL] = 0xc,
- [MSM_SDW_BOOST0_BOOST_CFG1] = 0xc,
- [MSM_SDW_BOOST0_BOOST_CFG2] = 0xc,
- [MSM_SDW_BOOST1_BOOST_PATH_CTL] = 0xc,
- [MSM_SDW_BOOST1_BOOST_CTL] = 0xc,
- [MSM_SDW_BOOST1_BOOST_CFG1] = 0xc,
- [MSM_SDW_BOOST1_BOOST_CFG2] = 0xc,
- [MSM_SDW_AHB_BRIDGE_WR_DATA_0] = 0xc,
- [MSM_SDW_AHB_BRIDGE_WR_DATA_1] = 0xc,
- [MSM_SDW_AHB_BRIDGE_WR_DATA_2] = 0xc,
- [MSM_SDW_AHB_BRIDGE_WR_DATA_3] = 0xc,
- [MSM_SDW_AHB_BRIDGE_WR_ADDR_0] = 0xc,
- [MSM_SDW_AHB_BRIDGE_WR_ADDR_1] = 0xc,
- [MSM_SDW_AHB_BRIDGE_WR_ADDR_2] = 0xc,
- [MSM_SDW_AHB_BRIDGE_WR_ADDR_3] = 0xc,
- [MSM_SDW_AHB_BRIDGE_RD_ADDR_0] = 0xc,
- [MSM_SDW_AHB_BRIDGE_RD_ADDR_1] = 0xc,
- [MSM_SDW_AHB_BRIDGE_RD_ADDR_2] = 0xc,
- [MSM_SDW_AHB_BRIDGE_RD_ADDR_3] = 0xc,
- [MSM_SDW_AHB_BRIDGE_RD_DATA_0] = 0xc,
- [MSM_SDW_AHB_BRIDGE_RD_DATA_1] = 0xc,
- [MSM_SDW_AHB_BRIDGE_RD_DATA_2] = 0xc,
- [MSM_SDW_AHB_BRIDGE_RD_DATA_3] = 0xc,
- [MSM_SDW_AHB_BRIDGE_ACCESS_CFG] = 0xc,
- [MSM_SDW_AHB_BRIDGE_ACCESS_STATUS] = 0xc,
- [MSM_SDW_CLK_RST_CTRL_MCLK_CONTROL] = 0xd,
- [MSM_SDW_CLK_RST_CTRL_FS_CNT_CONTROL] = 0xd,
- [MSM_SDW_CLK_RST_CTRL_SWR_CONTROL] = 0xd,
- [MSM_SDW_TOP_TOP_CFG0] = 0xd,
- [MSM_SDW_TOP_TOP_CFG1] = 0xd,
- [MSM_SDW_TOP_RX_I2S_CTL] = 0xd,
- [MSM_SDW_TOP_TX_I2S_CTL] = 0xd,
- [MSM_SDW_TOP_I2S_CLK] = 0xd,
- [MSM_SDW_TOP_RX7_PATH_INPUT0_MUX] = 0xd,
- [MSM_SDW_TOP_RX7_PATH_INPUT1_MUX] = 0xd,
- [MSM_SDW_TOP_RX8_PATH_INPUT0_MUX] = 0xd,
- [MSM_SDW_TOP_RX8_PATH_INPUT1_MUX] = 0xd,
- [MSM_SDW_TOP_FREQ_MCLK] = 0xd,
- [MSM_SDW_TOP_DEBUG_BUS_SEL] = 0xd,
- [MSM_SDW_TOP_DEBUG_EN] = 0xd,
- [MSM_SDW_TOP_I2S_RESET] = 0xd,
- [MSM_SDW_TOP_BLOCKS_RESET] = 0xd,
-};
-
-const u8 msm_sdw_reg_readable[MSM_SDW_MAX_REGISTER] = {
- [MSM_SDW_PAGE_REGISTER] = 1,
- [MSM_SDW_TX9_SPKR_PROT_PATH_CTL] = 1,
- [MSM_SDW_TX9_SPKR_PROT_PATH_CFG0] = 1,
- [MSM_SDW_TX10_SPKR_PROT_PATH_CTL] = 1,
- [MSM_SDW_TX10_SPKR_PROT_PATH_CFG0] = 1,
- [MSM_SDW_TX11_SPKR_PROT_PATH_CTL] = 1,
- [MSM_SDW_TX11_SPKR_PROT_PATH_CFG0] = 1,
- [MSM_SDW_TX12_SPKR_PROT_PATH_CTL] = 1,
- [MSM_SDW_TX12_SPKR_PROT_PATH_CFG0] = 1,
- [MSM_SDW_COMPANDER7_CTL0] = 1,
- [MSM_SDW_COMPANDER7_CTL1] = 1,
- [MSM_SDW_COMPANDER7_CTL2] = 1,
- [MSM_SDW_COMPANDER7_CTL3] = 1,
- [MSM_SDW_COMPANDER7_CTL4] = 1,
- [MSM_SDW_COMPANDER7_CTL5] = 1,
- [MSM_SDW_COMPANDER7_CTL6] = 1,
- [MSM_SDW_COMPANDER7_CTL7] = 1,
- [MSM_SDW_COMPANDER8_CTL0] = 1,
- [MSM_SDW_COMPANDER8_CTL1] = 1,
- [MSM_SDW_COMPANDER8_CTL2] = 1,
- [MSM_SDW_COMPANDER8_CTL3] = 1,
- [MSM_SDW_COMPANDER8_CTL4] = 1,
- [MSM_SDW_COMPANDER8_CTL5] = 1,
- [MSM_SDW_COMPANDER8_CTL6] = 1,
- [MSM_SDW_COMPANDER8_CTL7] = 1,
- [MSM_SDW_RX7_RX_PATH_CTL] = 1,
- [MSM_SDW_RX7_RX_PATH_CFG0] = 1,
- [MSM_SDW_RX7_RX_PATH_CFG1] = 1,
- [MSM_SDW_RX7_RX_PATH_CFG2] = 1,
- [MSM_SDW_RX7_RX_VOL_CTL] = 1,
- [MSM_SDW_RX7_RX_PATH_MIX_CTL] = 1,
- [MSM_SDW_RX7_RX_PATH_MIX_CFG] = 1,
- [MSM_SDW_RX7_RX_VOL_MIX_CTL] = 1,
- [MSM_SDW_RX7_RX_PATH_SEC0] = 1,
- [MSM_SDW_RX7_RX_PATH_SEC1] = 1,
- [MSM_SDW_RX7_RX_PATH_SEC2] = 1,
- [MSM_SDW_RX7_RX_PATH_SEC3] = 1,
- [MSM_SDW_RX7_RX_PATH_SEC5] = 1,
- [MSM_SDW_RX7_RX_PATH_SEC6] = 1,
- [MSM_SDW_RX7_RX_PATH_SEC7] = 1,
- [MSM_SDW_RX7_RX_PATH_MIX_SEC0] = 1,
- [MSM_SDW_RX7_RX_PATH_MIX_SEC1] = 1,
- [MSM_SDW_RX8_RX_PATH_CTL] = 1,
- [MSM_SDW_RX8_RX_PATH_CFG0] = 1,
- [MSM_SDW_RX8_RX_PATH_CFG1] = 1,
- [MSM_SDW_RX8_RX_PATH_CFG2] = 1,
- [MSM_SDW_RX8_RX_VOL_CTL] = 1,
- [MSM_SDW_RX8_RX_PATH_MIX_CTL] = 1,
- [MSM_SDW_RX8_RX_PATH_MIX_CFG] = 1,
- [MSM_SDW_RX8_RX_VOL_MIX_CTL] = 1,
- [MSM_SDW_RX8_RX_PATH_SEC0] = 1,
- [MSM_SDW_RX8_RX_PATH_SEC1] = 1,
- [MSM_SDW_RX8_RX_PATH_SEC2] = 1,
- [MSM_SDW_RX8_RX_PATH_SEC3] = 1,
- [MSM_SDW_RX8_RX_PATH_SEC5] = 1,
- [MSM_SDW_RX8_RX_PATH_SEC6] = 1,
- [MSM_SDW_RX8_RX_PATH_SEC7] = 1,
- [MSM_SDW_RX8_RX_PATH_MIX_SEC0] = 1,
- [MSM_SDW_RX8_RX_PATH_MIX_SEC1] = 1,
- [MSM_SDW_BOOST0_BOOST_PATH_CTL] = 1,
- [MSM_SDW_BOOST0_BOOST_CTL] = 1,
- [MSM_SDW_BOOST0_BOOST_CFG1] = 1,
- [MSM_SDW_BOOST0_BOOST_CFG2] = 1,
- [MSM_SDW_BOOST1_BOOST_PATH_CTL] = 1,
- [MSM_SDW_BOOST1_BOOST_CTL] = 1,
- [MSM_SDW_BOOST1_BOOST_CFG1] = 1,
- [MSM_SDW_BOOST1_BOOST_CFG2] = 1,
- [MSM_SDW_AHB_BRIDGE_WR_DATA_0] = 1,
- [MSM_SDW_AHB_BRIDGE_WR_DATA_1] = 1,
- [MSM_SDW_AHB_BRIDGE_WR_DATA_2] = 1,
- [MSM_SDW_AHB_BRIDGE_WR_DATA_3] = 1,
- [MSM_SDW_AHB_BRIDGE_WR_ADDR_0] = 1,
- [MSM_SDW_AHB_BRIDGE_WR_ADDR_1] = 1,
- [MSM_SDW_AHB_BRIDGE_WR_ADDR_2] = 1,
- [MSM_SDW_AHB_BRIDGE_WR_ADDR_3] = 1,
- [MSM_SDW_AHB_BRIDGE_RD_ADDR_0] = 1,
- [MSM_SDW_AHB_BRIDGE_RD_ADDR_1] = 1,
- [MSM_SDW_AHB_BRIDGE_RD_ADDR_2] = 1,
- [MSM_SDW_AHB_BRIDGE_RD_ADDR_3] = 1,
- [MSM_SDW_AHB_BRIDGE_RD_DATA_0] = 1,
- [MSM_SDW_AHB_BRIDGE_RD_DATA_1] = 1,
- [MSM_SDW_AHB_BRIDGE_RD_DATA_2] = 1,
- [MSM_SDW_AHB_BRIDGE_RD_DATA_3] = 1,
- [MSM_SDW_AHB_BRIDGE_ACCESS_CFG] = 1,
- [MSM_SDW_AHB_BRIDGE_ACCESS_STATUS] = 1,
- [MSM_SDW_CLK_RST_CTRL_MCLK_CONTROL] = 1,
- [MSM_SDW_CLK_RST_CTRL_FS_CNT_CONTROL] = 1,
- [MSM_SDW_CLK_RST_CTRL_SWR_CONTROL] = 1,
- [MSM_SDW_TOP_TOP_CFG0] = 1,
- [MSM_SDW_TOP_TOP_CFG1] = 1,
- [MSM_SDW_TOP_RX_I2S_CTL] = 1,
- [MSM_SDW_TOP_TX_I2S_CTL] = 1,
- [MSM_SDW_TOP_RX7_PATH_INPUT0_MUX] = 1,
- [MSM_SDW_TOP_RX7_PATH_INPUT1_MUX] = 1,
- [MSM_SDW_TOP_RX8_PATH_INPUT0_MUX] = 1,
- [MSM_SDW_TOP_RX8_PATH_INPUT1_MUX] = 1,
- [MSM_SDW_TOP_FREQ_MCLK] = 1,
- [MSM_SDW_TOP_DEBUG_BUS_SEL] = 1,
- [MSM_SDW_TOP_DEBUG_EN] = 1,
- [MSM_SDW_TOP_I2S_RESET] = 1,
- [MSM_SDW_TOP_BLOCKS_RESET] = 1,
-};
-
-const u8 msm_sdw_reg_writeable[MSM_SDW_MAX_REGISTER] = {
- [MSM_SDW_PAGE_REGISTER] = 1,
- [MSM_SDW_TX9_SPKR_PROT_PATH_CTL] = 1,
- [MSM_SDW_TX9_SPKR_PROT_PATH_CFG0] = 1,
- [MSM_SDW_TX10_SPKR_PROT_PATH_CTL] = 1,
- [MSM_SDW_TX10_SPKR_PROT_PATH_CFG0] = 1,
- [MSM_SDW_TX11_SPKR_PROT_PATH_CTL] = 1,
- [MSM_SDW_TX11_SPKR_PROT_PATH_CFG0] = 1,
- [MSM_SDW_TX12_SPKR_PROT_PATH_CTL] = 1,
- [MSM_SDW_TX12_SPKR_PROT_PATH_CFG0] = 1,
- [MSM_SDW_COMPANDER7_CTL0] = 1,
- [MSM_SDW_COMPANDER7_CTL1] = 1,
- [MSM_SDW_COMPANDER7_CTL2] = 1,
- [MSM_SDW_COMPANDER7_CTL3] = 1,
- [MSM_SDW_COMPANDER7_CTL4] = 1,
- [MSM_SDW_COMPANDER7_CTL5] = 1,
- [MSM_SDW_COMPANDER7_CTL7] = 1,
- [MSM_SDW_COMPANDER8_CTL0] = 1,
- [MSM_SDW_COMPANDER8_CTL1] = 1,
- [MSM_SDW_COMPANDER8_CTL2] = 1,
- [MSM_SDW_COMPANDER8_CTL3] = 1,
- [MSM_SDW_COMPANDER8_CTL4] = 1,
- [MSM_SDW_COMPANDER8_CTL5] = 1,
- [MSM_SDW_COMPANDER8_CTL7] = 1,
- [MSM_SDW_RX7_RX_PATH_CTL] = 1,
- [MSM_SDW_RX7_RX_PATH_CFG0] = 1,
- [MSM_SDW_RX7_RX_PATH_CFG1] = 1,
- [MSM_SDW_RX7_RX_PATH_CFG2] = 1,
- [MSM_SDW_RX7_RX_VOL_CTL] = 1,
- [MSM_SDW_RX7_RX_PATH_MIX_CTL] = 1,
- [MSM_SDW_RX7_RX_PATH_MIX_CFG] = 1,
- [MSM_SDW_RX7_RX_VOL_MIX_CTL] = 1,
- [MSM_SDW_RX7_RX_PATH_SEC0] = 1,
- [MSM_SDW_RX7_RX_PATH_SEC1] = 1,
- [MSM_SDW_RX7_RX_PATH_SEC2] = 1,
- [MSM_SDW_RX7_RX_PATH_SEC3] = 1,
- [MSM_SDW_RX7_RX_PATH_SEC5] = 1,
- [MSM_SDW_RX7_RX_PATH_SEC6] = 1,
- [MSM_SDW_RX7_RX_PATH_SEC7] = 1,
- [MSM_SDW_RX7_RX_PATH_MIX_SEC0] = 1,
- [MSM_SDW_RX7_RX_PATH_MIX_SEC1] = 1,
- [MSM_SDW_RX8_RX_PATH_CTL] = 1,
- [MSM_SDW_RX8_RX_PATH_CFG0] = 1,
- [MSM_SDW_RX8_RX_PATH_CFG1] = 1,
- [MSM_SDW_RX8_RX_PATH_CFG2] = 1,
- [MSM_SDW_RX8_RX_VOL_CTL] = 1,
- [MSM_SDW_RX8_RX_PATH_MIX_CTL] = 1,
- [MSM_SDW_RX8_RX_PATH_MIX_CFG] = 1,
- [MSM_SDW_RX8_RX_VOL_MIX_CTL] = 1,
- [MSM_SDW_RX8_RX_PATH_SEC0] = 1,
- [MSM_SDW_RX8_RX_PATH_SEC1] = 1,
- [MSM_SDW_RX8_RX_PATH_SEC2] = 1,
- [MSM_SDW_RX8_RX_PATH_SEC3] = 1,
- [MSM_SDW_RX8_RX_PATH_SEC5] = 1,
- [MSM_SDW_RX8_RX_PATH_SEC6] = 1,
- [MSM_SDW_RX8_RX_PATH_SEC7] = 1,
- [MSM_SDW_RX8_RX_PATH_MIX_SEC0] = 1,
- [MSM_SDW_RX8_RX_PATH_MIX_SEC1] = 1,
- [MSM_SDW_BOOST0_BOOST_PATH_CTL] = 1,
- [MSM_SDW_BOOST0_BOOST_CTL] = 1,
- [MSM_SDW_BOOST0_BOOST_CFG1] = 1,
- [MSM_SDW_BOOST0_BOOST_CFG2] = 1,
- [MSM_SDW_BOOST1_BOOST_PATH_CTL] = 1,
- [MSM_SDW_BOOST1_BOOST_CTL] = 1,
- [MSM_SDW_BOOST1_BOOST_CFG1] = 1,
- [MSM_SDW_BOOST1_BOOST_CFG2] = 1,
- [MSM_SDW_AHB_BRIDGE_WR_DATA_0] = 1,
- [MSM_SDW_AHB_BRIDGE_WR_DATA_1] = 1,
- [MSM_SDW_AHB_BRIDGE_WR_DATA_2] = 1,
- [MSM_SDW_AHB_BRIDGE_WR_DATA_3] = 1,
- [MSM_SDW_AHB_BRIDGE_WR_ADDR_0] = 1,
- [MSM_SDW_AHB_BRIDGE_WR_ADDR_1] = 1,
- [MSM_SDW_AHB_BRIDGE_WR_ADDR_2] = 1,
- [MSM_SDW_AHB_BRIDGE_WR_ADDR_3] = 1,
- [MSM_SDW_AHB_BRIDGE_RD_ADDR_0] = 1,
- [MSM_SDW_AHB_BRIDGE_RD_ADDR_1] = 1,
- [MSM_SDW_AHB_BRIDGE_RD_ADDR_2] = 1,
- [MSM_SDW_AHB_BRIDGE_RD_ADDR_3] = 1,
- [MSM_SDW_AHB_BRIDGE_ACCESS_CFG] = 1,
- [MSM_SDW_CLK_RST_CTRL_MCLK_CONTROL] = 1,
- [MSM_SDW_CLK_RST_CTRL_FS_CNT_CONTROL] = 1,
- [MSM_SDW_CLK_RST_CTRL_SWR_CONTROL] = 1,
- [MSM_SDW_TOP_TOP_CFG0] = 1,
- [MSM_SDW_TOP_TOP_CFG1] = 1,
- [MSM_SDW_TOP_RX_I2S_CTL] = 1,
- [MSM_SDW_TOP_TX_I2S_CTL] = 1,
- [MSM_SDW_TOP_RX7_PATH_INPUT0_MUX] = 1,
- [MSM_SDW_TOP_RX7_PATH_INPUT1_MUX] = 1,
- [MSM_SDW_TOP_RX8_PATH_INPUT0_MUX] = 1,
- [MSM_SDW_TOP_RX8_PATH_INPUT1_MUX] = 1,
- [MSM_SDW_TOP_FREQ_MCLK] = 1,
- [MSM_SDW_TOP_DEBUG_BUS_SEL] = 1,
- [MSM_SDW_TOP_DEBUG_EN] = 1,
- [MSM_SDW_TOP_I2S_RESET] = 1,
- [MSM_SDW_TOP_BLOCKS_RESET] = 1,
-};
diff --git a/asoc/codecs/msm_sdw/msm_sdw.h b/asoc/codecs/msm_sdw/msm_sdw.h
deleted file mode 100644
index 3c7a07d..0000000
--- a/asoc/codecs/msm_sdw/msm_sdw.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/* Copyright (c) 2016-2018, 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.
- */
-#ifndef MSM_SDW_H
-#define MSM_SDW_H
-
-#include <sound/soc.h>
-#include <dsp/q6afe-v2.h>
-#include "msm_sdw_registers.h"
-
-#define MSM_SDW_MAX_REGISTER 0x400
-#define MSM_SDW_CHILD_DEVICES_MAX 1
-
-extern const struct regmap_config msm_sdw_regmap_config;
-extern const u8 msm_sdw_page_map[MSM_SDW_MAX_REGISTER];
-extern const u8 msm_sdw_reg_readable[MSM_SDW_MAX_REGISTER];
-extern const u8 msm_sdw_reg_writeable[MSM_SDW_MAX_REGISTER];
-
-enum {
- MSM_SDW_RX4 = 0,
- MSM_SDW_RX5,
- MSM_SDW_RX_MAX,
-};
-
-enum {
- MSM_SDW_TX0 = 0,
- MSM_SDW_TX1,
- MSM_SDW_TX_MAX,
-};
-
-enum {
- COMP1, /* SPK_L */
- COMP2, /* SPK_R */
- COMP_MAX
-};
-
-/*
- * Structure used to update codec
- * register defaults after reset
- */
-struct msm_sdw_reg_mask_val {
- u16 reg;
- u8 mask;
- u8 val;
-};
-
-/*
- * Selects compander and smart boost settings
- * for a given speaker mode
- */
-enum {
- SPKR_MODE_DEFAULT,
- SPKR_MODE_1, /* COMP Gain = 12dB, Smartboost Max = 5.5V */
-};
-
-/* Rx path gain offsets */
-enum {
- RX_GAIN_OFFSET_M1P5_DB,
- RX_GAIN_OFFSET_0_DB,
-};
-
-struct msm_sdw_reg_val {
- unsigned short reg; /* register address */
- u8 *buf; /* buffer to be written to reg. addr */
- int bytes; /* number of bytes to be written */
-};
-
-/* Hold instance to soundwire platform device */
-struct msm_sdw_ctrl_data {
- struct platform_device *sdw_pdev;
-};
-
-struct wcd_sdw_ctrl_platform_data {
- void *handle; /* holds codec private data */
- int (*read)(void *handle, int reg);
- int (*write)(void *handle, int reg, int val);
- int (*bulk_write)(void *handle, u32 *reg, u32 *val, size_t len);
- int (*clk)(void *handle, bool enable);
- int (*handle_irq)(void *handle,
- irqreturn_t (*swrm_irq_handler)(int irq,
- void *data),
- void *swrm_handle,
- int action);
-};
-
-struct msm_sdw_priv {
- struct device *dev;
- struct mutex io_lock;
-
- int (*read_dev)(struct msm_sdw_priv *msm_sdw, unsigned short reg,
- int bytes, void *dest);
- int (*write_dev)(struct msm_sdw_priv *msm_sdw, unsigned short reg,
- int bytes, void *src);
- int (*multi_reg_write)(struct msm_sdw_priv *msm_sdw, const void *data,
- size_t count);
- struct snd_soc_codec *codec;
- struct device_node *sdw_gpio_p; /* used by pinctrl API */
- /* SoundWire data structure */
- struct msm_sdw_ctrl_data *sdw_ctrl_data;
- int nr;
-
- /* compander */
- int comp_enabled[COMP_MAX];
- int ear_spkr_gain;
-
- /* to track the status */
- unsigned long status_mask;
-
- struct work_struct msm_sdw_add_child_devices_work;
- struct wcd_sdw_ctrl_platform_data sdw_plat_data;
-
- unsigned int vi_feed_value;
-
- struct mutex sdw_read_lock;
- struct mutex sdw_write_lock;
- struct mutex sdw_clk_lock;
- int sdw_clk_users;
- int sdw_mclk_users;
-
- int sdw_irq;
- int int_mclk1_rsc_ref;
- bool int_mclk1_enabled;
- bool sdw_npl_clk_enabled;
- struct mutex cdc_int_mclk1_mutex;
- struct mutex sdw_npl_clk_mutex;
- struct delayed_work disable_int_mclk1_work;
- struct afe_clk_set sdw_cdc_core_clk;
- struct afe_clk_set sdw_npl_clk;
- struct notifier_block service_nb;
- int (*sdw_cdc_gpio_fn)(bool enable, struct snd_soc_codec *codec);
- bool dev_up;
-
- int spkr_gain_offset;
- int spkr_mode;
- struct mutex codec_mutex;
- int rx_4_count;
- int rx_5_count;
- u32 mclk_rate;
- struct regmap *regmap;
-
- bool prev_pg_valid;
- u8 prev_pg;
- u32 sdw_base_addr;
- char __iomem *sdw_base;
- u32 version;
-
- /* Entry for version info */
- struct snd_info_entry *entry;
- struct snd_info_entry *version_entry;
- struct platform_device *pdev_child_devices
- [MSM_SDW_CHILD_DEVICES_MAX];
- int child_count;
-};
-
-#if IS_ENABLED(CONFIG_SND_SOC_MSM_SDW)
-extern int msm_sdw_set_spkr_mode(struct snd_soc_codec *codec, int mode);
-extern int msm_sdw_set_spkr_gain_offset(struct snd_soc_codec *codec,
- int offset);
-extern void msm_sdw_gpio_cb(
- int (*sdw_cdc_gpio_fn)(bool enable, struct snd_soc_codec *codec),
- struct snd_soc_codec *codec);
-extern struct regmap *msm_sdw_regmap_init(struct device *dev,
- const struct regmap_config *config);
-extern int msm_sdw_codec_info_create_codec_entry(
- struct snd_info_entry *codec_root,
- struct snd_soc_codec *codec);
-#else /* CONFIG_SND_SOC_MSM_SDW */
-static inline int msm_sdw_set_spkr_mode(struct snd_soc_codec *codec, int mode)
-{
- return 0;
-}
-static inline int msm_sdw_set_spkr_gain_offset(struct snd_soc_codec *codec,
- int offset);
-{
- return 0;
-}
-static inline void msm_sdw_gpio_cb(
- int (*sdw_cdc_gpio_fn)(bool enable, struct snd_soc_codec *codec),
- struct snd_soc_codec *codec);
-{
-
-}
-static inline struct regmap *msm_sdw_regmap_init(struct device *dev,
- const struct regmap_config *config);
-{
- return NULL;
-}
-static inline int msm_sdw_codec_info_create_codec_entry(
- struct snd_info_entry *codec_root,
- struct snd_soc_codec *codec)
-{
- return 0;
-}
-#endif /* CONFIG_SND_SOC_MSM_SDW */
-#endif
diff --git a/asoc/codecs/msm_sdw/msm_sdw_cdc.c b/asoc/codecs/msm_sdw/msm_sdw_cdc.c
deleted file mode 100644
index 69e3407..0000000
--- a/asoc/codecs/msm_sdw/msm_sdw_cdc.c
+++ /dev/null
@@ -1,2097 +0,0 @@
-/* Copyright (c) 2016-2018, 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.
- */
-#include <linux/device.h>
-#include <linux/module.h>
-#include <linux/io.h>
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <linux/printk.h>
-#include <linux/debugfs.h>
-#include <linux/bitops.h>
-#include <linux/regmap.h>
-#include <linux/delay.h>
-#include <linux/kernel.h>
-#include <sound/pcm.h>
-#include <sound/pcm_params.h>
-#include <sound/soc.h>
-#include <sound/soc-dapm.h>
-#include <sound/tlv.h>
-#include <ipc/apr.h>
-#include <soc/swr-wcd.h>
-#include <dsp/audio_notifier.h>
-#include <dsp/apr_audio-v2.h>
-#include <dsp/q6core.h>
-#include "msm_sdw.h"
-#include "msm_sdw_registers.h"
-#include "../msm-cdc-pinctrl.h"
-
-#define MSM_SDW_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\
- SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000)
-#define MSM_SDW_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\
- SNDRV_PCM_FMTBIT_S24_LE |\
- SNDRV_PCM_FMTBIT_S24_3LE)
-
-#define MSM_SDW_STRING_LEN 80
-
-#define INT_MCLK1_FREQ 9600000
-#define SDW_NPL_FREQ 153600000
-
-#define MSM_SDW_VERSION_1_0 0x0001
-#define MSM_SDW_VERSION_ENTRY_SIZE 32
-
-/*
- * 200 Milliseconds sufficient for DSP bring up in the modem
- * after Sub System Restart
- */
-#define ADSP_STATE_READY_TIMEOUT_MS 200
-
-static const DECLARE_TLV_DB_SCALE(digital_gain, 0, 1, 0);
-static struct snd_soc_dai_driver msm_sdw_dai[];
-static bool skip_irq = true;
-
-static int msm_sdw_config_ear_spkr_gain(struct snd_soc_codec *codec,
- int event, int gain_reg);
-static int msm_sdw_config_compander(struct snd_soc_codec *, int, int);
-static int msm_sdw_mclk_enable(struct msm_sdw_priv *msm_sdw,
- int mclk_enable, bool dapm);
-static int msm_int_enable_sdw_cdc_clk(struct msm_sdw_priv *msm_sdw,
- int enable, bool dapm);
-
-enum {
- VI_SENSE_1,
- VI_SENSE_2,
-};
-
-enum {
- AIF1_SDW_PB = 0,
- AIF1_SDW_VIFEED,
- NUM_CODEC_DAIS,
-};
-
-static const struct msm_sdw_reg_mask_val msm_sdw_spkr_default[] = {
- {MSM_SDW_COMPANDER7_CTL3, 0x80, 0x80},
- {MSM_SDW_COMPANDER8_CTL3, 0x80, 0x80},
- {MSM_SDW_COMPANDER7_CTL7, 0x01, 0x01},
- {MSM_SDW_COMPANDER8_CTL7, 0x01, 0x01},
- {MSM_SDW_BOOST0_BOOST_CTL, 0x7C, 0x58},
- {MSM_SDW_BOOST1_BOOST_CTL, 0x7C, 0x58},
-};
-
-static const struct msm_sdw_reg_mask_val msm_sdw_spkr_mode1[] = {
- {MSM_SDW_COMPANDER7_CTL3, 0x80, 0x00},
- {MSM_SDW_COMPANDER8_CTL3, 0x80, 0x00},
- {MSM_SDW_COMPANDER7_CTL7, 0x01, 0x00},
- {MSM_SDW_COMPANDER8_CTL7, 0x01, 0x00},
- {MSM_SDW_BOOST0_BOOST_CTL, 0x7C, 0x44},
- {MSM_SDW_BOOST1_BOOST_CTL, 0x7C, 0x44},
-};
-
-/**
- * msm_sdw_set_spkr_gain_offset - offset the speaker path
- * gain with the given offset value.
- *
- * @codec: codec instance
- * @offset: Indicates speaker path gain offset value.
- *
- * Returns 0 on success or -EINVAL on error.
- */
-int msm_sdw_set_spkr_gain_offset(struct snd_soc_codec *codec, int offset)
-{
- struct msm_sdw_priv *priv;
-
- if (!codec) {
- pr_err("%s: NULL codec pointer!\n", __func__);
- return -EINVAL;
- }
-
- priv = snd_soc_codec_get_drvdata(codec);
- if (!priv)
- return -EINVAL;
-
- priv->spkr_gain_offset = offset;
- return 0;
-}
-EXPORT_SYMBOL(msm_sdw_set_spkr_gain_offset);
-
-/**
- * msm_sdw_set_spkr_mode - Configures speaker compander and smartboost
- * settings based on speaker mode.
- *
- * @codec: codec instance
- * @mode: Indicates speaker configuration mode.
- *
- * Returns 0 on success or -EINVAL on error.
- */
-int msm_sdw_set_spkr_mode(struct snd_soc_codec *codec, int mode)
-{
- struct msm_sdw_priv *priv;
- int i;
- const struct msm_sdw_reg_mask_val *regs;
- int size;
-
- if (!codec) {
- pr_err("%s: NULL codec pointer!\n", __func__);
- return -EINVAL;
- }
-
- priv = snd_soc_codec_get_drvdata(codec);
- if (!priv)
- return -EINVAL;
-
- switch (mode) {
- case SPKR_MODE_1:
- regs = msm_sdw_spkr_mode1;
- size = ARRAY_SIZE(msm_sdw_spkr_mode1);
- break;
- default:
- regs = msm_sdw_spkr_default;
- size = ARRAY_SIZE(msm_sdw_spkr_default);
- break;
- }
-
- priv->spkr_mode = mode;
- for (i = 0; i < size; i++)
- snd_soc_update_bits(codec, regs[i].reg,
- regs[i].mask, regs[i].val);
- return 0;
-}
-EXPORT_SYMBOL(msm_sdw_set_spkr_mode);
-
-static int msm_enable_sdw_npl_clk(struct msm_sdw_priv *msm_sdw, int enable)
-{
- int ret = 0;
-
- dev_dbg(msm_sdw->dev, "%s: enable %d\n", __func__, enable);
-
- mutex_lock(&msm_sdw->sdw_npl_clk_mutex);
- if (enable) {
- if (msm_sdw->sdw_npl_clk_enabled == false) {
- msm_sdw->sdw_npl_clk.enable = 1;
- ret = afe_set_lpass_clock_v2(
- AFE_PORT_ID_INT4_MI2S_RX,
- &msm_sdw->sdw_npl_clk);
- if (ret < 0) {
- dev_err(msm_sdw->dev,
- "%s: failed to enable SDW NPL CLK\n",
- __func__);
- mutex_unlock(&msm_sdw->sdw_npl_clk_mutex);
- return ret;
- }
- dev_dbg(msm_sdw->dev, "enabled sdw npl clk\n");
- msm_sdw->sdw_npl_clk_enabled = true;
- }
- } else {
- if (msm_sdw->sdw_npl_clk_enabled == true) {
- msm_sdw->sdw_npl_clk.enable = 0;
- ret = afe_set_lpass_clock_v2(
- AFE_PORT_ID_INT4_MI2S_RX,
- &msm_sdw->sdw_npl_clk);
- if (ret < 0)
- dev_err(msm_sdw->dev,
- "%s: failed to disable SDW NPL CLK\n",
- __func__);
- msm_sdw->sdw_npl_clk_enabled = false;
- }
- }
- mutex_unlock(&msm_sdw->sdw_npl_clk_mutex);
- return ret;
-}
-
-static int msm_int_enable_sdw_cdc_clk(struct msm_sdw_priv *msm_sdw,
- int enable, bool dapm)
-{
- int ret = 0;
-
- mutex_lock(&msm_sdw->cdc_int_mclk1_mutex);
- dev_dbg(msm_sdw->dev, "%s: enable %d mclk1 ref counter %d\n",
- __func__, enable, msm_sdw->int_mclk1_rsc_ref);
- if (enable) {
- if (msm_sdw->int_mclk1_rsc_ref == 0) {
- cancel_delayed_work_sync(
- &msm_sdw->disable_int_mclk1_work);
- if (msm_sdw->int_mclk1_enabled == false) {
- msm_sdw->sdw_cdc_core_clk.enable = 1;
- ret = afe_set_lpass_clock_v2(
- AFE_PORT_ID_INT4_MI2S_RX,
- &msm_sdw->sdw_cdc_core_clk);
- if (ret < 0) {
- dev_err(msm_sdw->dev,
- "%s: failed to enable SDW MCLK\n",
- __func__);
- goto rtn;
- }
- dev_dbg(msm_sdw->dev,
- "enabled sdw codec core mclk\n");
- msm_sdw->int_mclk1_enabled = true;
- }
- }
- msm_sdw->int_mclk1_rsc_ref++;
- } else {
- cancel_delayed_work_sync(&msm_sdw->disable_int_mclk1_work);
- if (msm_sdw->int_mclk1_rsc_ref > 0) {
- msm_sdw->int_mclk1_rsc_ref--;
- dev_dbg(msm_sdw->dev,
- "%s: decrementing mclk_res_ref %d\n",
- __func__, msm_sdw->int_mclk1_rsc_ref);
- }
- if (msm_sdw->int_mclk1_enabled == true &&
- msm_sdw->int_mclk1_rsc_ref == 0) {
- msm_sdw->sdw_cdc_core_clk.enable = 0;
- ret = afe_set_lpass_clock_v2(
- AFE_PORT_ID_INT4_MI2S_RX,
- &msm_sdw->sdw_cdc_core_clk);
- if (ret < 0)
- dev_err(msm_sdw->dev,
- "%s: failed to disable SDW MCLK\n",
- __func__);
- msm_sdw->int_mclk1_enabled = false;
- }
- }
-rtn:
- mutex_unlock(&msm_sdw->cdc_int_mclk1_mutex);
- return ret;
-}
-EXPORT_SYMBOL(msm_int_enable_sdw_cdc_clk);
-
-static void msm_disable_int_mclk1(struct work_struct *work)
-{
- struct msm_sdw_priv *msm_sdw = NULL;
- struct delayed_work *dwork;
- int ret = 0;
-
- dwork = to_delayed_work(work);
- msm_sdw = container_of(dwork, struct msm_sdw_priv,
- disable_int_mclk1_work);
- mutex_lock(&msm_sdw->cdc_int_mclk1_mutex);
- dev_dbg(msm_sdw->dev, "%s: mclk1_enabled %d mclk1_rsc_ref %d\n",
- __func__, msm_sdw->int_mclk1_enabled,
- msm_sdw->int_mclk1_rsc_ref);
- if (msm_sdw->int_mclk1_enabled == true
- && msm_sdw->int_mclk1_rsc_ref == 0) {
- dev_dbg(msm_sdw->dev, "Disable the mclk1\n");
- msm_sdw->sdw_cdc_core_clk.enable = 0;
- ret = afe_set_lpass_clock_v2(
- AFE_PORT_ID_INT4_MI2S_RX,
- &msm_sdw->sdw_cdc_core_clk);
- if (ret < 0)
- dev_err(msm_sdw->dev,
- "%s failed to disable the MCLK1\n",
- __func__);
- msm_sdw->int_mclk1_enabled = false;
- }
- mutex_unlock(&msm_sdw->cdc_int_mclk1_mutex);
-}
-
-static int msm_int_mclk1_event(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol, int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct msm_sdw_priv *msm_sdw = snd_soc_codec_get_drvdata(codec);
- int ret = 0;
-
- dev_dbg(msm_sdw->dev, "%s: event = %d\n", __func__, event);
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- /* enable the codec mclk config */
- msm_int_enable_sdw_cdc_clk(msm_sdw, 1, true);
- msm_sdw_mclk_enable(msm_sdw, 1, true);
- break;
- case SND_SOC_DAPM_POST_PMD:
- /* disable the codec mclk config */
- msm_sdw_mclk_enable(msm_sdw, 0, true);
- msm_int_enable_sdw_cdc_clk(msm_sdw, 0, true);
- break;
- default:
- dev_err(msm_sdw->dev,
- "%s: invalid DAPM event %d\n", __func__, event);
- ret = -EINVAL;
- }
- return ret;
-}
-
-static int msm_sdw_ahb_write_device(struct msm_sdw_priv *msm_sdw,
- u16 reg, u8 *value)
-{
- u32 temp = (u32)(*value) & 0x000000FF;
-
- if (!msm_sdw->dev_up) {
- dev_err_ratelimited(msm_sdw->dev, "%s: q6 not ready\n",
- __func__);
- return 0;
- }
-
- iowrite32(temp, msm_sdw->sdw_base + reg);
- return 0;
-}
-
-static int msm_sdw_ahb_read_device(struct msm_sdw_priv *msm_sdw,
- u16 reg, u8 *value)
-{
- u32 temp;
-
- if (!msm_sdw->dev_up) {
- dev_err_ratelimited(msm_sdw->dev, "%s: q6 not ready\n",
- __func__);
- return 0;
- }
-
- temp = ioread32(msm_sdw->sdw_base + reg);
- *value = (u8)temp;
- return 0;
-}
-
-static int __msm_sdw_reg_read(struct msm_sdw_priv *msm_sdw, unsigned short reg,
- int bytes, void *dest)
-{
- int ret = -EINVAL, i;
- u8 temp = 0;
-
- dev_dbg(msm_sdw->dev, "%s reg = %x\n", __func__, reg);
- mutex_lock(&msm_sdw->cdc_int_mclk1_mutex);
- if (msm_sdw->int_mclk1_enabled == false) {
- msm_sdw->sdw_cdc_core_clk.enable = 1;
- ret = afe_set_lpass_clock_v2(
- AFE_PORT_ID_INT4_MI2S_RX,
- &msm_sdw->sdw_cdc_core_clk);
- if (ret < 0) {
- dev_err(msm_sdw->dev,
- "%s:failed to enable the INT_MCLK1\n",
- __func__);
- goto unlock_exit;
- }
- dev_dbg(msm_sdw->dev, "%s:enabled sdw codec core clk\n",
- __func__);
- for (i = 0; i < bytes; i++) {
- ret = msm_sdw_ahb_read_device(
- msm_sdw, reg + (4 * i), &temp);
- ((u8 *)dest)[i] = temp;
- }
- msm_sdw->int_mclk1_enabled = true;
- schedule_delayed_work(&msm_sdw->disable_int_mclk1_work, 50);
- goto unlock_exit;
- }
- for (i = 0; i < bytes; i++) {
- ret = msm_sdw_ahb_read_device(
- msm_sdw, reg + (4 * i), &temp);
- ((u8 *)dest)[i] = temp;
- }
-unlock_exit:
- mutex_unlock(&msm_sdw->cdc_int_mclk1_mutex);
- if (ret < 0) {
- dev_err_ratelimited(msm_sdw->dev,
- "%s: codec read failed for reg 0x%x\n",
- __func__, reg);
- return ret;
- }
- dev_dbg(msm_sdw->dev, "Read 0x%02x from 0x%x\n", temp, reg);
-
- return 0;
-}
-
-static int __msm_sdw_reg_write(struct msm_sdw_priv *msm_sdw, unsigned short reg,
- int bytes, void *src)
-{
- int ret = -EINVAL, i;
-
- mutex_lock(&msm_sdw->cdc_int_mclk1_mutex);
- if (msm_sdw->int_mclk1_enabled == false) {
- msm_sdw->sdw_cdc_core_clk.enable = 1;
- ret = afe_set_lpass_clock_v2(AFE_PORT_ID_INT4_MI2S_RX,
- &msm_sdw->sdw_cdc_core_clk);
- if (ret < 0) {
- dev_err(msm_sdw->dev,
- "%s: failed to enable the INT_MCLK1\n",
- __func__);
- ret = 0;
- goto unlock_exit;
- }
- dev_dbg(msm_sdw->dev, "%s: enabled INT_MCLK1\n", __func__);
- for (i = 0; i < bytes; i++)
- ret = msm_sdw_ahb_write_device(msm_sdw, reg + (4 * i),
- &((u8 *)src)[i]);
- msm_sdw->int_mclk1_enabled = true;
- schedule_delayed_work(&msm_sdw->disable_int_mclk1_work, 50);
- goto unlock_exit;
- }
- for (i = 0; i < bytes; i++)
- ret = msm_sdw_ahb_write_device(msm_sdw, reg + (4 * i),
- &((u8 *)src)[i]);
-unlock_exit:
- mutex_unlock(&msm_sdw->cdc_int_mclk1_mutex);
- dev_dbg(msm_sdw->dev, "Write 0x%x val 0x%02x\n",
- reg, (u32)(*(u32 *)src));
-
- return ret;
-}
-
-static int msm_sdw_codec_enable_vi_feedback(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- struct snd_soc_codec *codec = NULL;
- struct msm_sdw_priv *msm_sdw_p = NULL;
- int ret = 0;
-
- if (!w) {
- pr_err("%s invalid params\n", __func__);
- return -EINVAL;
- }
- codec = snd_soc_dapm_to_codec(w->dapm);
- msm_sdw_p = snd_soc_codec_get_drvdata(codec);
-
- dev_dbg(codec->dev, "%s: num_dai %d stream name %s\n",
- __func__, codec->component.num_dai, w->sname);
-
- dev_dbg(codec->dev, "%s(): w->name %s event %d w->shift %d\n",
- __func__, w->name, event, w->shift);
- if (w->shift != AIF1_SDW_VIFEED) {
- dev_err(codec->dev,
- "%s:Error in enabling the vi feedback path\n",
- __func__);
- ret = -EINVAL;
- goto out_vi;
- }
- switch (event) {
- case SND_SOC_DAPM_POST_PMU:
- if (test_bit(VI_SENSE_1, &msm_sdw_p->status_mask)) {
- dev_dbg(codec->dev, "%s: spkr1 enabled\n", __func__);
- /* Enable V&I sensing */
- snd_soc_update_bits(codec,
- MSM_SDW_TX9_SPKR_PROT_PATH_CTL, 0x20, 0x20);
- snd_soc_update_bits(codec,
- MSM_SDW_TX10_SPKR_PROT_PATH_CTL, 0x20,
- 0x20);
- snd_soc_update_bits(codec,
- MSM_SDW_TX9_SPKR_PROT_PATH_CTL, 0x0F, 0x04);
- snd_soc_update_bits(codec,
- MSM_SDW_TX10_SPKR_PROT_PATH_CTL, 0x0F, 0x04);
- snd_soc_update_bits(codec,
- MSM_SDW_TX9_SPKR_PROT_PATH_CTL, 0x10, 0x10);
- snd_soc_update_bits(codec,
- MSM_SDW_TX10_SPKR_PROT_PATH_CTL, 0x10,
- 0x10);
- snd_soc_update_bits(codec,
- MSM_SDW_TX9_SPKR_PROT_PATH_CTL, 0x20, 0x00);
- snd_soc_update_bits(codec,
- MSM_SDW_TX10_SPKR_PROT_PATH_CTL, 0x20,
- 0x00);
- }
- if (test_bit(VI_SENSE_2, &msm_sdw_p->status_mask)) {
- dev_dbg(codec->dev, "%s: spkr2 enabled\n", __func__);
- /* Enable V&I sensing */
- snd_soc_update_bits(codec,
- MSM_SDW_TX11_SPKR_PROT_PATH_CTL, 0x20,
- 0x20);
- snd_soc_update_bits(codec,
- MSM_SDW_TX12_SPKR_PROT_PATH_CTL, 0x20,
- 0x20);
- snd_soc_update_bits(codec,
- MSM_SDW_TX11_SPKR_PROT_PATH_CTL, 0x0F,
- 0x04);
- snd_soc_update_bits(codec,
- MSM_SDW_TX12_SPKR_PROT_PATH_CTL, 0x0F,
- 0x04);
- snd_soc_update_bits(codec,
- MSM_SDW_TX11_SPKR_PROT_PATH_CTL, 0x10,
- 0x10);
- snd_soc_update_bits(codec,
- MSM_SDW_TX12_SPKR_PROT_PATH_CTL, 0x10,
- 0x10);
- snd_soc_update_bits(codec,
- MSM_SDW_TX11_SPKR_PROT_PATH_CTL, 0x20,
- 0x00);
- snd_soc_update_bits(codec,
- MSM_SDW_TX12_SPKR_PROT_PATH_CTL, 0x20,
- 0x00);
- }
- break;
- case SND_SOC_DAPM_POST_PMD:
- if (test_bit(VI_SENSE_1, &msm_sdw_p->status_mask)) {
- /* Disable V&I sensing */
- dev_dbg(codec->dev, "%s: spkr1 disabled\n", __func__);
- snd_soc_update_bits(codec,
- MSM_SDW_TX9_SPKR_PROT_PATH_CTL, 0x20, 0x20);
- snd_soc_update_bits(codec,
- MSM_SDW_TX10_SPKR_PROT_PATH_CTL, 0x20,
- 0x20);
- snd_soc_update_bits(codec,
- MSM_SDW_TX9_SPKR_PROT_PATH_CTL, 0x10, 0x00);
- snd_soc_update_bits(codec,
- MSM_SDW_TX10_SPKR_PROT_PATH_CTL, 0x10,
- 0x00);
- }
- if (test_bit(VI_SENSE_2, &msm_sdw_p->status_mask)) {
- /* Disable V&I sensing */
- dev_dbg(codec->dev, "%s: spkr2 disabled\n", __func__);
- snd_soc_update_bits(codec,
- MSM_SDW_TX11_SPKR_PROT_PATH_CTL, 0x20,
- 0x20);
- snd_soc_update_bits(codec,
- MSM_SDW_TX12_SPKR_PROT_PATH_CTL, 0x20,
- 0x20);
- snd_soc_update_bits(codec,
- MSM_SDW_TX11_SPKR_PROT_PATH_CTL, 0x10,
- 0x00);
- snd_soc_update_bits(codec,
- MSM_SDW_TX12_SPKR_PROT_PATH_CTL, 0x10,
- 0x00);
- }
- break;
- }
-out_vi:
- return ret;
-}
-
-static int msm_sdwm_handle_irq(void *handle,
- irqreturn_t (*swrm_irq_handler)(int irq,
- void *data),
- void *swrm_handle,
- int action)
-{
- struct msm_sdw_priv *msm_sdw;
- int ret = 0;
-
- if (!handle) {
- pr_err("%s: null handle received\n", __func__);
- return -EINVAL;
- }
- msm_sdw = (struct msm_sdw_priv *) handle;
-
- if (skip_irq)
- return ret;
-
- if (action) {
- ret = request_threaded_irq(msm_sdw->sdw_irq, NULL,
- swrm_irq_handler,
- IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
- "swr_master_irq", swrm_handle);
- if (ret)
- dev_err(msm_sdw->dev, "%s: Failed to request irq %d\n",
- __func__, ret);
- } else
- free_irq(msm_sdw->sdw_irq, swrm_handle);
-
- return ret;
-}
-
-static void msm_sdw_codec_hd2_control(struct snd_soc_codec *codec,
- u16 reg, int event)
-{
- u16 hd2_scale_reg;
- u16 hd2_enable_reg = 0;
-
- if (reg == MSM_SDW_RX7_RX_PATH_CTL) {
- hd2_scale_reg = MSM_SDW_RX7_RX_PATH_SEC3;
- hd2_enable_reg = MSM_SDW_RX7_RX_PATH_CFG0;
- }
- if (reg == MSM_SDW_RX8_RX_PATH_CTL) {
- hd2_scale_reg = MSM_SDW_RX8_RX_PATH_SEC3;
- hd2_enable_reg = MSM_SDW_RX8_RX_PATH_CFG0;
- }
-
- if (hd2_enable_reg && SND_SOC_DAPM_EVENT_ON(event)) {
- snd_soc_update_bits(codec, hd2_scale_reg, 0x3C, 0x10);
- snd_soc_update_bits(codec, hd2_scale_reg, 0x03, 0x01);
- snd_soc_update_bits(codec, hd2_enable_reg, 0x04, 0x04);
- }
-
- if (hd2_enable_reg && SND_SOC_DAPM_EVENT_OFF(event)) {
- snd_soc_update_bits(codec, hd2_enable_reg, 0x04, 0x00);
- snd_soc_update_bits(codec, hd2_scale_reg, 0x03, 0x00);
- snd_soc_update_bits(codec, hd2_scale_reg, 0x3C, 0x00);
- }
-}
-
-static int msm_sdw_enable_swr(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol, int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct msm_sdw_priv *msm_sdw;
- int i, ch_cnt;
-
- msm_sdw = snd_soc_codec_get_drvdata(codec);
-
- if (!msm_sdw->nr)
- return 0;
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- if (!(strnstr(w->name, "RX4", sizeof("RX4 MIX"))) &&
- !msm_sdw->rx_4_count)
- msm_sdw->rx_4_count++;
- if (!(strnstr(w->name, "RX5", sizeof("RX5 MIX"))) &&
- !msm_sdw->rx_5_count)
- msm_sdw->rx_5_count++;
- ch_cnt = msm_sdw->rx_4_count + msm_sdw->rx_5_count;
-
- for (i = 0; i < msm_sdw->nr; i++) {
- swrm_wcd_notify(msm_sdw->sdw_ctrl_data[i].sdw_pdev,
- SWR_DEVICE_UP, NULL);
- swrm_wcd_notify(msm_sdw->sdw_ctrl_data[i].sdw_pdev,
- SWR_SET_NUM_RX_CH, &ch_cnt);
- }
- break;
- case SND_SOC_DAPM_POST_PMD:
- if (!(strnstr(w->name, "RX4", sizeof("RX4 MIX"))) &&
- msm_sdw->rx_4_count)
- msm_sdw->rx_4_count--;
- if (!(strnstr(w->name, "RX5", sizeof("RX5 MIX"))) &&
- msm_sdw->rx_5_count)
- msm_sdw->rx_5_count--;
- ch_cnt = msm_sdw->rx_4_count + msm_sdw->rx_5_count;
-
- for (i = 0; i < msm_sdw->nr; i++)
- swrm_wcd_notify(msm_sdw->sdw_ctrl_data[i].sdw_pdev,
- SWR_SET_NUM_RX_CH, &ch_cnt);
- break;
- }
- dev_dbg(msm_sdw->dev, "%s: current swr ch cnt: %d\n",
- __func__, msm_sdw->rx_4_count + msm_sdw->rx_5_count);
-
- return 0;
-}
-
-static int msm_sdw_codec_enable_interpolator(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct msm_sdw_priv *msm_sdw = snd_soc_codec_get_drvdata(codec);
- u16 gain_reg;
- u16 reg;
- int val;
- int offset_val = 0;
-
- dev_dbg(codec->dev, "%s %d %s\n", __func__, event, w->name);
-
- if (!(strcmp(w->name, "RX INT4 INTERP"))) {
- reg = MSM_SDW_RX7_RX_PATH_CTL;
- gain_reg = MSM_SDW_RX7_RX_VOL_CTL;
- } else if (!(strcmp(w->name, "RX INT5 INTERP"))) {
- reg = MSM_SDW_RX8_RX_PATH_CTL;
- gain_reg = MSM_SDW_RX8_RX_VOL_CTL;
- } else {
- dev_err(codec->dev, "%s: Interpolator reg not found\n",
- __func__);
- return -EINVAL;
- }
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- snd_soc_update_bits(codec, reg, 0x10, 0x10);
- msm_sdw_codec_hd2_control(codec, reg, event);
- snd_soc_update_bits(codec, reg, 1 << 0x5, 1 << 0x5);
- break;
- case SND_SOC_DAPM_POST_PMU:
- msm_sdw_config_compander(codec, w->shift, event);
- /* apply gain after int clk is enabled */
- if ((msm_sdw->spkr_gain_offset == RX_GAIN_OFFSET_M1P5_DB) &&
- (msm_sdw->comp_enabled[COMP1] ||
- msm_sdw->comp_enabled[COMP2]) &&
- (gain_reg == MSM_SDW_RX7_RX_VOL_CTL ||
- gain_reg == MSM_SDW_RX8_RX_VOL_CTL)) {
- snd_soc_update_bits(codec, MSM_SDW_RX7_RX_PATH_SEC1,
- 0x01, 0x01);
- snd_soc_update_bits(codec,
- MSM_SDW_RX7_RX_PATH_MIX_SEC0,
- 0x01, 0x01);
- snd_soc_update_bits(codec, MSM_SDW_RX8_RX_PATH_SEC1,
- 0x01, 0x01);
- snd_soc_update_bits(codec,
- MSM_SDW_RX8_RX_PATH_MIX_SEC0,
- 0x01, 0x01);
- offset_val = -2;
- }
- val = snd_soc_read(codec, gain_reg);
- val += offset_val;
- snd_soc_write(codec, gain_reg, val);
- msm_sdw_config_ear_spkr_gain(codec, event, gain_reg);
- snd_soc_update_bits(codec, reg, 0x10, 0x00);
- break;
- case SND_SOC_DAPM_POST_PMD:
- snd_soc_update_bits(codec, reg, 1 << 0x5, 0 << 0x5);
- snd_soc_update_bits(codec, reg, 0x40, 0x40);
- snd_soc_update_bits(codec, reg, 0x40, 0x00);
- msm_sdw_codec_hd2_control(codec, reg, event);
- msm_sdw_config_compander(codec, w->shift, event);
- if ((msm_sdw->spkr_gain_offset == RX_GAIN_OFFSET_M1P5_DB) &&
- (msm_sdw->comp_enabled[COMP1] ||
- msm_sdw->comp_enabled[COMP2]) &&
- (gain_reg == MSM_SDW_RX7_RX_VOL_CTL ||
- gain_reg == MSM_SDW_RX8_RX_VOL_CTL)) {
- snd_soc_update_bits(codec, MSM_SDW_RX7_RX_PATH_SEC1,
- 0x01, 0x00);
- snd_soc_update_bits(codec,
- MSM_SDW_RX7_RX_PATH_MIX_SEC0,
- 0x01, 0x00);
- snd_soc_update_bits(codec, MSM_SDW_RX8_RX_PATH_SEC1,
- 0x01, 0x00);
- snd_soc_update_bits(codec,
- MSM_SDW_RX8_RX_PATH_MIX_SEC0,
- 0x01, 0x00);
- offset_val = 2;
- val = snd_soc_read(codec, gain_reg);
- val += offset_val;
- snd_soc_write(codec, gain_reg, val);
- }
- msm_sdw_config_ear_spkr_gain(codec, event, gain_reg);
- break;
- };
-
- return 0;
-}
-
-static int msm_sdw_config_ear_spkr_gain(struct snd_soc_codec *codec,
- int event, int gain_reg)
-{
- int comp_gain_offset, val;
- struct msm_sdw_priv *msm_sdw = snd_soc_codec_get_drvdata(codec);
-
- switch (msm_sdw->spkr_mode) {
- /* Compander gain in SPKR_MODE1 case is 12 dB */
- case SPKR_MODE_1:
- comp_gain_offset = -12;
- break;
- /* Default case compander gain is 15 dB */
- default:
- comp_gain_offset = -15;
- break;
- }
-
- switch (event) {
- case SND_SOC_DAPM_POST_PMU:
- /* Apply ear spkr gain only if compander is enabled */
- if (msm_sdw->comp_enabled[COMP1] &&
- (gain_reg == MSM_SDW_RX7_RX_VOL_CTL) &&
- (msm_sdw->ear_spkr_gain != 0)) {
- /* For example, val is -8(-12+5-1) for 4dB of gain */
- val = comp_gain_offset + msm_sdw->ear_spkr_gain - 1;
- snd_soc_write(codec, gain_reg, val);
-
- dev_dbg(codec->dev, "%s: RX4 Volume %d dB\n",
- __func__, val);
- }
- break;
- case SND_SOC_DAPM_POST_PMD:
- /*
- * Reset RX4 volume to 0 dB if compander is enabled and
- * ear_spkr_gain is non-zero.
- */
- if (msm_sdw->comp_enabled[COMP1] &&
- (gain_reg == MSM_SDW_RX7_RX_VOL_CTL) &&
- (msm_sdw->ear_spkr_gain != 0)) {
- snd_soc_write(codec, gain_reg, 0x0);
-
- dev_dbg(codec->dev, "%s: Reset RX4 Volume to 0 dB\n",
- __func__);
- }
- break;
- }
-
- return 0;
-}
-
-static int msm_sdw_codec_spk_boost_event(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- u16 boost_path_ctl, boost_path_cfg1;
- u16 reg;
-
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
-
- if (!strcmp(w->name, "RX INT4 CHAIN")) {
- boost_path_ctl = MSM_SDW_BOOST0_BOOST_PATH_CTL;
- boost_path_cfg1 = MSM_SDW_RX7_RX_PATH_CFG1;
- reg = MSM_SDW_RX7_RX_PATH_CTL;
- } else if (!strcmp(w->name, "RX INT5 CHAIN")) {
- boost_path_ctl = MSM_SDW_BOOST1_BOOST_PATH_CTL;
- boost_path_cfg1 = MSM_SDW_RX8_RX_PATH_CFG1;
- reg = MSM_SDW_RX8_RX_PATH_CTL;
- } else {
- dev_err(codec->dev, "%s: boost reg not found\n",
- __func__);
- return -EINVAL;
- }
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- snd_soc_update_bits(codec, boost_path_ctl, 0x10, 0x10);
- snd_soc_update_bits(codec, boost_path_cfg1, 0x01, 0x01);
- snd_soc_update_bits(codec, reg, 0x10, 0x00);
- break;
- case SND_SOC_DAPM_POST_PMD:
- snd_soc_update_bits(codec, boost_path_cfg1, 0x01, 0x00);
- snd_soc_update_bits(codec, boost_path_ctl, 0x10, 0x00);
- break;
- };
-
- return 0;
-}
-
-static int msm_sdw_config_compander(struct snd_soc_codec *codec, int comp,
- int event)
-{
- struct msm_sdw_priv *msm_sdw = snd_soc_codec_get_drvdata(codec);
- u16 comp_ctl0_reg, rx_path_cfg0_reg;
-
- if (comp < COMP1 || comp >= COMP_MAX)
- return 0;
-
- dev_dbg(codec->dev, "%s: event %d compander %d, enabled %d\n",
- __func__, event, comp + 1, msm_sdw->comp_enabled[comp]);
-
- if (!msm_sdw->comp_enabled[comp])
- return 0;
-
- comp_ctl0_reg = MSM_SDW_COMPANDER7_CTL0 + (comp * 0x20);
- rx_path_cfg0_reg = MSM_SDW_RX7_RX_PATH_CFG0 + (comp * 0x1E0);
-
- if (SND_SOC_DAPM_EVENT_ON(event)) {
- /* Enable Compander Clock */
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x01, 0x01);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x02, 0x02);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x02, 0x00);
- snd_soc_update_bits(codec, rx_path_cfg0_reg, 0x02, 0x02);
- }
-
- if (SND_SOC_DAPM_EVENT_OFF(event)) {
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x04, 0x04);
- snd_soc_update_bits(codec, rx_path_cfg0_reg, 0x02, 0x00);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x02, 0x02);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x02, 0x00);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x01, 0x00);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x04, 0x00);
- }
-
- return 0;
-}
-
-static int msm_sdw_get_compander(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
-
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- int comp = ((struct soc_multi_mixer_control *)
- kcontrol->private_value)->shift;
- struct msm_sdw_priv *msm_sdw = snd_soc_codec_get_drvdata(codec);
-
- ucontrol->value.integer.value[0] = msm_sdw->comp_enabled[comp];
- return 0;
-}
-
-static int msm_sdw_set_compander(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct msm_sdw_priv *msm_sdw = snd_soc_codec_get_drvdata(codec);
- int comp = ((struct soc_multi_mixer_control *)
- kcontrol->private_value)->shift;
- int value = ucontrol->value.integer.value[0];
-
- dev_dbg(codec->dev, "%s: Compander %d enable current %d, new %d\n",
- __func__, comp + 1, msm_sdw->comp_enabled[comp], value);
- msm_sdw->comp_enabled[comp] = value;
-
- return 0;
-}
-
-static int msm_sdw_ear_spkr_pa_gain_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct msm_sdw_priv *msm_sdw = snd_soc_codec_get_drvdata(codec);
-
- ucontrol->value.integer.value[0] = msm_sdw->ear_spkr_gain;
-
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
- __func__, ucontrol->value.integer.value[0]);
-
- return 0;
-}
-
-static int msm_sdw_ear_spkr_pa_gain_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct msm_sdw_priv *msm_sdw = snd_soc_codec_get_drvdata(codec);
-
- msm_sdw->ear_spkr_gain = ucontrol->value.integer.value[0];
-
- dev_dbg(codec->dev, "%s: gain = %d\n", __func__,
- msm_sdw->ear_spkr_gain);
-
- return 0;
-}
-
-static int msm_sdw_spkr_left_boost_stage_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- u8 bst_state_max = 0;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
-
- bst_state_max = snd_soc_read(codec, MSM_SDW_BOOST0_BOOST_CTL);
- bst_state_max = (bst_state_max & 0x0c) >> 2;
- ucontrol->value.integer.value[0] = bst_state_max;
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
- __func__, ucontrol->value.integer.value[0]);
-
- return 0;
-}
-
-static int msm_sdw_spkr_left_boost_stage_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- u8 bst_state_max;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
-
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
- __func__, ucontrol->value.integer.value[0]);
- bst_state_max = ucontrol->value.integer.value[0] << 2;
- snd_soc_update_bits(codec, MSM_SDW_BOOST0_BOOST_CTL,
- 0x0c, bst_state_max);
-
- return 0;
-}
-
-static int msm_sdw_spkr_right_boost_stage_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- u8 bst_state_max = 0;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
-
- bst_state_max = snd_soc_read(codec, MSM_SDW_BOOST1_BOOST_CTL);
- bst_state_max = (bst_state_max & 0x0c) >> 2;
- ucontrol->value.integer.value[0] = bst_state_max;
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
- __func__, ucontrol->value.integer.value[0]);
-
- return 0;
-}
-
-static int msm_sdw_spkr_right_boost_stage_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- u8 bst_state_max;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
-
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
- __func__, ucontrol->value.integer.value[0]);
- bst_state_max = ucontrol->value.integer.value[0] << 2;
- snd_soc_update_bits(codec, MSM_SDW_BOOST1_BOOST_CTL,
- 0x0c, bst_state_max);
-
- return 0;
-}
-
-static int msm_sdw_vi_feed_mixer_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_dapm_widget *widget =
- snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
- struct msm_sdw_priv *msm_sdw_p = snd_soc_codec_get_drvdata(codec);
-
- ucontrol->value.integer.value[0] = msm_sdw_p->vi_feed_value;
-
- return 0;
-}
-
-static int msm_sdw_vi_feed_mixer_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_dapm_widget *widget =
- snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
- struct msm_sdw_priv *msm_sdw_p = snd_soc_codec_get_drvdata(codec);
- struct soc_multi_mixer_control *mixer =
- ((struct soc_multi_mixer_control *)kcontrol->private_value);
- u32 dai_id = widget->shift;
- u32 port_id = mixer->shift;
- u32 enable = ucontrol->value.integer.value[0];
-
- dev_dbg(codec->dev, "%s: enable: %d, port_id:%d, dai_id: %d\n",
- __func__, enable, port_id, dai_id);
-
- msm_sdw_p->vi_feed_value = ucontrol->value.integer.value[0];
-
- mutex_lock(&msm_sdw_p->codec_mutex);
- if (enable) {
- if (port_id == MSM_SDW_TX0 && !test_bit(VI_SENSE_1,
- &msm_sdw_p->status_mask))
- set_bit(VI_SENSE_1, &msm_sdw_p->status_mask);
- if (port_id == MSM_SDW_TX1 && !test_bit(VI_SENSE_2,
- &msm_sdw_p->status_mask))
- set_bit(VI_SENSE_2, &msm_sdw_p->status_mask);
- } else {
- if (port_id == MSM_SDW_TX0 && test_bit(VI_SENSE_1,
- &msm_sdw_p->status_mask))
- clear_bit(VI_SENSE_1, &msm_sdw_p->status_mask);
- if (port_id == MSM_SDW_TX1 && test_bit(VI_SENSE_2,
- &msm_sdw_p->status_mask))
- clear_bit(VI_SENSE_2, &msm_sdw_p->status_mask);
- }
- mutex_unlock(&msm_sdw_p->codec_mutex);
- snd_soc_dapm_mixer_update_power(widget->dapm, kcontrol, enable, NULL);
-
- return 0;
-}
-
-static int msm_sdw_mclk_enable(struct msm_sdw_priv *msm_sdw,
- int mclk_enable, bool dapm)
-{
- dev_dbg(msm_sdw->dev, "%s: mclk_enable = %u, dapm = %d clk_users= %d\n",
- __func__, mclk_enable, dapm, msm_sdw->sdw_mclk_users);
- if (mclk_enable) {
- msm_sdw->sdw_mclk_users++;
- if (msm_sdw->sdw_mclk_users == 1) {
- regmap_update_bits(msm_sdw->regmap,
- MSM_SDW_CLK_RST_CTRL_FS_CNT_CONTROL,
- 0x01, 0x01);
- regmap_update_bits(msm_sdw->regmap,
- MSM_SDW_CLK_RST_CTRL_MCLK_CONTROL,
- 0x01, 0x01);
- /* 9.6MHz MCLK, set value 0x00 if other frequency */
- regmap_update_bits(msm_sdw->regmap,
- MSM_SDW_TOP_FREQ_MCLK, 0x01, 0x01);
- }
- } else {
- msm_sdw->sdw_mclk_users--;
- if (msm_sdw->sdw_mclk_users == 0) {
- regmap_update_bits(msm_sdw->regmap,
- MSM_SDW_CLK_RST_CTRL_FS_CNT_CONTROL,
- 0x01, 0x00);
- regmap_update_bits(msm_sdw->regmap,
- MSM_SDW_CLK_RST_CTRL_MCLK_CONTROL,
- 0x01, 0x00);
- }
- }
- return 0;
-}
-EXPORT_SYMBOL(msm_sdw_mclk_enable);
-
-static int msm_sdw_swrm_read(void *handle, int reg)
-{
- struct msm_sdw_priv *msm_sdw;
- unsigned short sdw_rd_addr_base;
- unsigned short sdw_rd_data_base;
- int val, ret;
-
- if (!handle) {
- pr_err("%s: NULL handle\n", __func__);
- return -EINVAL;
- }
- msm_sdw = (struct msm_sdw_priv *)handle;
-
- dev_dbg(msm_sdw->dev, "%s: Reading soundwire register, 0x%x\n",
- __func__, reg);
- sdw_rd_addr_base = MSM_SDW_AHB_BRIDGE_RD_ADDR_0;
- sdw_rd_data_base = MSM_SDW_AHB_BRIDGE_RD_DATA_0;
- /*
- * Add sleep as SWR slave access read takes time.
- * Allow for RD_DONE to complete for previous register if any.
- */
- usleep_range(100, 105);
-
- /* read_lock */
- mutex_lock(&msm_sdw->sdw_read_lock);
- ret = regmap_bulk_write(msm_sdw->regmap, sdw_rd_addr_base,
- (u8 *)®, 4);
- if (ret < 0) {
- dev_err(msm_sdw->dev, "%s: RD Addr Failure\n", __func__);
- goto err;
- }
- /* Add sleep for SWR register read value to get updated. */
- usleep_range(100, 105);
- /* Check for RD value */
- ret = regmap_bulk_read(msm_sdw->regmap, sdw_rd_data_base,
- (u8 *)&val, 4);
- if (ret < 0) {
- dev_err(msm_sdw->dev, "%s: RD Data Failure\n", __func__);
- goto err;
- }
- ret = val;
-err:
- /* read_unlock */
- mutex_unlock(&msm_sdw->sdw_read_lock);
- return ret;
-}
-
-static int msm_sdw_bulk_write(struct msm_sdw_priv *msm_sdw,
- struct msm_sdw_reg_val *bulk_reg,
- size_t len)
-{
- int i, ret = 0;
- unsigned short sdw_wr_addr_base;
- unsigned short sdw_wr_data_base;
-
- sdw_wr_addr_base = MSM_SDW_AHB_BRIDGE_WR_ADDR_0;
- sdw_wr_data_base = MSM_SDW_AHB_BRIDGE_WR_DATA_0;
-
- for (i = 0; i < len; i += 2) {
- /*
- * Add sleep as SWR slave write takes time.
- * Allow for any previous pending write to complete.
- */
- usleep_range(100, 105);
- /* First Write the Data to register */
- ret = regmap_bulk_write(msm_sdw->regmap,
- sdw_wr_data_base, bulk_reg[i].buf, 4);
- if (ret < 0) {
- dev_err(msm_sdw->dev, "%s: WR Data Failure\n",
- __func__);
- break;
- }
- /* Next Write Address */
- ret = regmap_bulk_write(msm_sdw->regmap,
- sdw_wr_addr_base, bulk_reg[i+1].buf, 4);
- if (ret < 0) {
- dev_err(msm_sdw->dev,
- "%s: WR Addr Failure: 0x%x\n",
- __func__, (u32)(bulk_reg[i+1].buf[0]));
- break;
- }
- }
- return ret;
-}
-
-static int msm_sdw_swrm_bulk_write(void *handle, u32 *reg, u32 *val, size_t len)
-{
- struct msm_sdw_priv *msm_sdw;
- struct msm_sdw_reg_val *bulk_reg;
- unsigned short sdw_wr_addr_base;
- unsigned short sdw_wr_data_base;
- int i, j, ret;
-
- if (!handle) {
- pr_err("%s: NULL handle\n", __func__);
- return -EINVAL;
- }
-
- msm_sdw = (struct msm_sdw_priv *)handle;
- if (len <= 0) {
- dev_err(msm_sdw->dev,
- "%s: Invalid size: %zu\n", __func__, len);
- return -EINVAL;
- }
-
- sdw_wr_addr_base = MSM_SDW_AHB_BRIDGE_WR_ADDR_0;
- sdw_wr_data_base = MSM_SDW_AHB_BRIDGE_WR_DATA_0;
-
- bulk_reg = kzalloc((2 * len * sizeof(struct msm_sdw_reg_val)),
- GFP_KERNEL);
- if (!bulk_reg)
- return -ENOMEM;
-
- for (i = 0, j = 0; i < (len * 2); i += 2, j++) {
- bulk_reg[i].reg = sdw_wr_data_base;
- bulk_reg[i].buf = (u8 *)(&val[j]);
- bulk_reg[i].bytes = 4;
- bulk_reg[i+1].reg = sdw_wr_addr_base;
- bulk_reg[i+1].buf = (u8 *)(®[j]);
- bulk_reg[i+1].bytes = 4;
- }
- mutex_lock(&msm_sdw->sdw_write_lock);
-
- ret = msm_sdw_bulk_write(msm_sdw, bulk_reg, (len * 2));
- if (ret)
- dev_err(msm_sdw->dev, "%s: swrm bulk write failed, ret: %d\n",
- __func__, ret);
-
- mutex_unlock(&msm_sdw->sdw_write_lock);
- kfree(bulk_reg);
-
- return ret;
-}
-
-static int msm_sdw_swrm_write(void *handle, int reg, int val)
-{
- struct msm_sdw_priv *msm_sdw;
- unsigned short sdw_wr_addr_base;
- unsigned short sdw_wr_data_base;
- struct msm_sdw_reg_val bulk_reg[2];
- int ret;
-
- if (!handle) {
- pr_err("%s: NULL handle\n", __func__);
- return -EINVAL;
- }
- msm_sdw = (struct msm_sdw_priv *)handle;
-
- sdw_wr_addr_base = MSM_SDW_AHB_BRIDGE_WR_ADDR_0;
- sdw_wr_data_base = MSM_SDW_AHB_BRIDGE_WR_DATA_0;
-
- /* First Write the Data to register */
- bulk_reg[0].reg = sdw_wr_data_base;
- bulk_reg[0].buf = (u8 *)(&val);
- bulk_reg[0].bytes = 4;
- bulk_reg[1].reg = sdw_wr_addr_base;
- bulk_reg[1].buf = (u8 *)(®);
- bulk_reg[1].bytes = 4;
-
- mutex_lock(&msm_sdw->sdw_write_lock);
-
- ret = msm_sdw_bulk_write(msm_sdw, bulk_reg, 2);
- if (ret < 0)
- dev_err(msm_sdw->dev, "%s: WR Data Failure\n", __func__);
-
- mutex_unlock(&msm_sdw->sdw_write_lock);
- return ret;
-}
-
-static int msm_sdw_swrm_clock(void *handle, bool enable)
-{
- struct msm_sdw_priv *msm_sdw;
-
- if (!handle) {
- pr_err("%s: NULL handle\n", __func__);
- return -EINVAL;
- }
- msm_sdw = (struct msm_sdw_priv *)handle;
-
- mutex_lock(&msm_sdw->sdw_clk_lock);
-
- dev_dbg(msm_sdw->dev, "%s: swrm clock %s\n",
- __func__, (enable ? "enable" : "disable"));
- if (enable) {
- msm_sdw->sdw_clk_users++;
- if (msm_sdw->sdw_clk_users == 1) {
- msm_int_enable_sdw_cdc_clk(msm_sdw, 1, true);
- msm_sdw_mclk_enable(msm_sdw, 1, true);
- regmap_update_bits(msm_sdw->regmap,
- MSM_SDW_CLK_RST_CTRL_SWR_CONTROL, 0x01, 0x01);
- msm_enable_sdw_npl_clk(msm_sdw, true);
- msm_cdc_pinctrl_select_active_state(
- msm_sdw->sdw_gpio_p);
- }
- } else {
- msm_sdw->sdw_clk_users--;
- if (msm_sdw->sdw_clk_users == 0) {
- regmap_update_bits(msm_sdw->regmap,
- MSM_SDW_CLK_RST_CTRL_SWR_CONTROL,
- 0x01, 0x00);
- msm_sdw_mclk_enable(msm_sdw, 0, true);
- msm_int_enable_sdw_cdc_clk(msm_sdw, 0, true);
- msm_enable_sdw_npl_clk(msm_sdw, false);
- msm_cdc_pinctrl_select_sleep_state(msm_sdw->sdw_gpio_p);
- }
- }
- dev_dbg(msm_sdw->dev, "%s: swrm clock users %d\n",
- __func__, msm_sdw->sdw_clk_users);
- mutex_unlock(&msm_sdw->sdw_clk_lock);
- return 0;
-}
-
-static int msm_sdw_startup(struct snd_pcm_substream *substream,
- struct snd_soc_dai *dai)
-{
- dev_dbg(dai->codec->dev, "%s(): substream = %s stream = %d\n",
- __func__,
- substream->name, substream->stream);
- return 0;
-}
-
-static int msm_sdw_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params,
- struct snd_soc_dai *dai)
-{
- u8 clk_fs_rate, fs_rate;
-
- dev_dbg(dai->codec->dev,
- "%s: dai_name = %s DAI-ID %x rate %d num_ch %d format %d\n",
- __func__, dai->name, dai->id, params_rate(params),
- params_channels(params), params_format(params));
-
- switch (params_rate(params)) {
- case 8000:
- clk_fs_rate = 0x00;
- fs_rate = 0x00;
- break;
- case 16000:
- clk_fs_rate = 0x01;
- fs_rate = 0x01;
- break;
- case 32000:
- clk_fs_rate = 0x02;
- fs_rate = 0x03;
- break;
- case 48000:
- clk_fs_rate = 0x03;
- fs_rate = 0x04;
- break;
- case 96000:
- clk_fs_rate = 0x04;
- fs_rate = 0x05;
- break;
- case 192000:
- clk_fs_rate = 0x05;
- fs_rate = 0x06;
- break;
- default:
- dev_err(dai->codec->dev,
- "%s: Invalid sampling rate %d\n", __func__,
- params_rate(params));
- return -EINVAL;
- }
-
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
- snd_soc_update_bits(dai->codec,
- MSM_SDW_TOP_TX_I2S_CTL, 0x1C,
- (clk_fs_rate << 2));
- } else {
- snd_soc_update_bits(dai->codec,
- MSM_SDW_TOP_RX_I2S_CTL, 0x1C,
- (clk_fs_rate << 2));
- snd_soc_update_bits(dai->codec,
- MSM_SDW_RX7_RX_PATH_CTL, 0x0F,
- fs_rate);
- snd_soc_update_bits(dai->codec,
- MSM_SDW_RX8_RX_PATH_CTL, 0x0F,
- fs_rate);
- }
-
- switch (params_format(params)) {
- case SNDRV_PCM_FORMAT_S16_LE:
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
- snd_soc_update_bits(dai->codec,
- MSM_SDW_TOP_TX_I2S_CTL, 0x20, 0x20);
- else
- snd_soc_update_bits(dai->codec,
- MSM_SDW_TOP_RX_I2S_CTL, 0x20, 0x20);
- break;
- case SNDRV_PCM_FORMAT_S24_LE:
- case SNDRV_PCM_FORMAT_S24_3LE:
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
- snd_soc_update_bits(dai->codec,
- MSM_SDW_TOP_TX_I2S_CTL, 0x20, 0x00);
- else
- snd_soc_update_bits(dai->codec,
- MSM_SDW_TOP_RX_I2S_CTL, 0x20, 0x00);
- break;
- default:
- dev_err(dai->codec->dev, "%s: wrong format selected\n",
- __func__);
- return -EINVAL;
- }
-
- return 0;
-}
-
-static void msm_sdw_shutdown(struct snd_pcm_substream *substream,
- struct snd_soc_dai *dai)
-{
- dev_dbg(dai->codec->dev,
- "%s(): substream = %s stream = %d\n", __func__,
- substream->name, substream->stream);
-}
-
-static ssize_t msm_sdw_codec_version_read(struct snd_info_entry *entry,
- void *file_private_data,
- struct file *file,
- char __user *buf, size_t count,
- loff_t pos)
-{
- struct msm_sdw_priv *msm_sdw;
- char buffer[MSM_SDW_VERSION_ENTRY_SIZE];
- int len = 0;
-
- msm_sdw = (struct msm_sdw_priv *) entry->private_data;
- if (!msm_sdw) {
- pr_err("%s: msm_sdw priv is null\n", __func__);
- return -EINVAL;
- }
-
- switch (msm_sdw->version) {
- case MSM_SDW_VERSION_1_0:
- len = snprintf(buffer, sizeof(buffer), "SDW-CDC_1_0\n");
- break;
- default:
- len = snprintf(buffer, sizeof(buffer), "VER_UNDEFINED\n");
- }
-
- return simple_read_from_buffer(buf, count, &pos, buffer, len);
-}
-
-static struct snd_info_entry_ops msm_sdw_codec_info_ops = {
- .read = msm_sdw_codec_version_read,
-};
-
-/*
- * msm_sdw_codec_info_create_codec_entry - creates msm_sdw module
- * @codec_root: The parent directory
- * @codec: Codec instance
- *
- * Creates msm_sdw module and version entry under the given
- * parent directory.
- *
- * Return: 0 on success or negative error code on failure.
- */
-int msm_sdw_codec_info_create_codec_entry(struct snd_info_entry *codec_root,
- struct snd_soc_codec *codec)
-{
- struct snd_info_entry *version_entry;
- struct msm_sdw_priv *msm_sdw;
- struct snd_soc_card *card;
- char name[80];
-
- if (!codec_root || !codec)
- return -EINVAL;
-
- msm_sdw = snd_soc_codec_get_drvdata(codec);
- card = codec->component.card;
-
- snprintf(name, sizeof(name), "%x.%s", (u32)msm_sdw->sdw_base_addr,
- "msm-sdw-codec");
- msm_sdw->entry = snd_info_create_subdir(codec_root->module,
- (const char *)name,
- codec_root);
- if (!msm_sdw->entry) {
- dev_err(codec->dev, "%s: failed to create msm_sdw entry\n",
- __func__);
- return -ENOMEM;
- }
-
- version_entry = snd_info_create_card_entry(card->snd_card,
- "version",
- msm_sdw->entry);
- if (!version_entry) {
- dev_err(codec->dev, "%s: failed to create msm_sdw version entry\n",
- __func__);
- return -ENOMEM;
- }
-
- version_entry->private_data = msm_sdw;
- version_entry->size = MSM_SDW_VERSION_ENTRY_SIZE;
- version_entry->content = SNDRV_INFO_CONTENT_DATA;
- version_entry->c.ops = &msm_sdw_codec_info_ops;
-
- if (snd_info_register(version_entry) < 0) {
- snd_info_free_entry(version_entry);
- return -ENOMEM;
- }
- msm_sdw->version_entry = version_entry;
-
- return 0;
-}
-EXPORT_SYMBOL(msm_sdw_codec_info_create_codec_entry);
-
-static struct snd_soc_dai_ops msm_sdw_dai_ops = {
- .startup = msm_sdw_startup,
- .shutdown = msm_sdw_shutdown,
- .hw_params = msm_sdw_hw_params,
-};
-
-static struct snd_soc_dai_driver msm_sdw_dai[] = {
- {
- .name = "msm_sdw_i2s_rx1",
- .id = AIF1_SDW_PB,
- .playback = {
- .stream_name = "AIF1_SDW Playback",
- .rates = MSM_SDW_RATES,
- .formats = MSM_SDW_FORMATS,
- .rate_max = 192000,
- .rate_min = 8000,
- .channels_min = 1,
- .channels_max = 4,
- },
- .ops = &msm_sdw_dai_ops,
- },
- {
- .name = "msm_sdw_vifeedback",
- .id = AIF1_SDW_VIFEED,
- .capture = {
- .stream_name = "VIfeed_SDW",
- .rates = MSM_SDW_RATES,
- .formats = SNDRV_PCM_FMTBIT_S16_LE,
- .rate_max = 48000,
- .rate_min = 8000,
- .channels_min = 2,
- .channels_max = 4,
- },
- .ops = &msm_sdw_dai_ops,
- },
-};
-
-static const char * const rx_mix1_text[] = {
- "ZERO", "RX4", "RX5"
-};
-
-static const char * const msm_sdw_ear_spkr_pa_gain_text[] = {
- "G_DEFAULT", "G_0_DB", "G_1_DB", "G_2_DB", "G_3_DB",
- "G_4_DB", "G_5_DB", "G_6_DB"
-};
-
-static const char * const msm_sdw_speaker_boost_stage_text[] = {
- "NO_MAX_STATE", "MAX_STATE_1", "MAX_STATE_2"
-};
-
-static SOC_ENUM_SINGLE_EXT_DECL(msm_sdw_ear_spkr_pa_gain_enum,
- msm_sdw_ear_spkr_pa_gain_text);
-static SOC_ENUM_SINGLE_EXT_DECL(msm_sdw_spkr_boost_stage_enum,
- msm_sdw_speaker_boost_stage_text);
-
-/* RX4 MIX1 */
-static const struct soc_enum rx4_mix1_inp1_chain_enum =
- SOC_ENUM_SINGLE(MSM_SDW_TOP_RX7_PATH_INPUT0_MUX,
- 0, 3, rx_mix1_text);
-
-static const struct soc_enum rx4_mix1_inp2_chain_enum =
- SOC_ENUM_SINGLE(MSM_SDW_TOP_RX7_PATH_INPUT1_MUX,
- 0, 3, rx_mix1_text);
-
-/* RX5 MIX1 */
-static const struct soc_enum rx5_mix1_inp1_chain_enum =
- SOC_ENUM_SINGLE(MSM_SDW_TOP_RX8_PATH_INPUT0_MUX,
- 0, 3, rx_mix1_text);
-
-static const struct soc_enum rx5_mix1_inp2_chain_enum =
- SOC_ENUM_SINGLE(MSM_SDW_TOP_RX8_PATH_INPUT1_MUX,
- 0, 3, rx_mix1_text);
-
-static const struct snd_kcontrol_new rx4_mix1_inp1_mux =
- SOC_DAPM_ENUM("RX4 MIX1 INP1 Mux", rx4_mix1_inp1_chain_enum);
-
-static const struct snd_kcontrol_new rx4_mix1_inp2_mux =
- SOC_DAPM_ENUM("RX4 MIX1 INP2 Mux", rx4_mix1_inp2_chain_enum);
-
-static const struct snd_kcontrol_new rx5_mix1_inp1_mux =
- SOC_DAPM_ENUM("RX5 MIX1 INP1 Mux", rx5_mix1_inp1_chain_enum);
-
-static const struct snd_kcontrol_new rx5_mix1_inp2_mux =
- SOC_DAPM_ENUM("RX5 MIX1 INP2 Mux", rx5_mix1_inp2_chain_enum);
-
-static const struct snd_kcontrol_new aif1_vi_mixer[] = {
- SOC_SINGLE_EXT("SPKR_VI_1", SND_SOC_NOPM, MSM_SDW_TX0, 1, 0,
- msm_sdw_vi_feed_mixer_get, msm_sdw_vi_feed_mixer_put),
- SOC_SINGLE_EXT("SPKR_VI_2", SND_SOC_NOPM, MSM_SDW_TX1, 1, 0,
- msm_sdw_vi_feed_mixer_get, msm_sdw_vi_feed_mixer_put),
-};
-
-static const struct snd_soc_dapm_widget msm_sdw_dapm_widgets[] = {
- SND_SOC_DAPM_AIF_IN("I2S RX4", "AIF1_SDW Playback", 0,
- SND_SOC_NOPM, 0, 0),
-
- SND_SOC_DAPM_AIF_IN("I2S RX5", "AIF1_SDW Playback", 0,
- SND_SOC_NOPM, 0, 0),
-
- SND_SOC_DAPM_AIF_OUT_E("AIF1_SDW VI", "VIfeed_SDW", 0, SND_SOC_NOPM,
- AIF1_SDW_VIFEED, 0, msm_sdw_codec_enable_vi_feedback,
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MIXER("AIF1_VI_SDW Mixer", SND_SOC_NOPM, AIF1_SDW_VIFEED,
- 0, aif1_vi_mixer, ARRAY_SIZE(aif1_vi_mixer)),
-
- SND_SOC_DAPM_MUX_E("RX4 MIX1 INP1", SND_SOC_NOPM, 0, 0,
- &rx4_mix1_inp1_mux, msm_sdw_enable_swr,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MUX_E("RX4 MIX1 INP2", SND_SOC_NOPM, 0, 0,
- &rx4_mix1_inp2_mux, msm_sdw_enable_swr,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MUX_E("RX5 MIX1 INP1", SND_SOC_NOPM, 0, 0,
- &rx5_mix1_inp1_mux, msm_sdw_enable_swr,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MUX_E("RX5 MIX1 INP2", SND_SOC_NOPM, 0, 0,
- &rx5_mix1_inp2_mux, msm_sdw_enable_swr,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MIXER("RX4 MIX1", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("RX5 MIX1", SND_SOC_NOPM, 0, 0, NULL, 0),
-
- SND_SOC_DAPM_MIXER_E("RX INT4 INTERP", SND_SOC_NOPM,
- COMP1, 0, NULL, 0, msm_sdw_codec_enable_interpolator,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MIXER_E("RX INT5 INTERP", SND_SOC_NOPM,
- COMP2, 0, NULL, 0, msm_sdw_codec_enable_interpolator,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_MIXER_E("RX INT4 CHAIN", SND_SOC_NOPM, 0, 0,
- NULL, 0, msm_sdw_codec_spk_boost_event,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MIXER_E("RX INT5 CHAIN", SND_SOC_NOPM, 0, 0,
- NULL, 0, msm_sdw_codec_spk_boost_event,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_INPUT("VIINPUT_SDW"),
-
- SND_SOC_DAPM_OUTPUT("SPK1 OUT"),
- SND_SOC_DAPM_OUTPUT("SPK2 OUT"),
-
- SND_SOC_DAPM_SUPPLY_S("SDW_CONN", -1, MSM_SDW_TOP_I2S_CLK,
- 0, 0, NULL, 0),
-
- SND_SOC_DAPM_SUPPLY_S("INT_MCLK1", -2, SND_SOC_NOPM, 0, 0,
- msm_int_mclk1_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_SUPPLY("SDW_RX_I2S_CLK",
- MSM_SDW_TOP_RX_I2S_CTL, 0, 0, NULL, 0),
- SND_SOC_DAPM_SUPPLY("SDW_TX_I2S_CLK",
- MSM_SDW_TOP_TX_I2S_CTL, 0, 0, NULL, 0),
-};
-
-static const struct snd_kcontrol_new msm_sdw_snd_controls[] = {
- SOC_ENUM_EXT("EAR SPKR PA Gain", msm_sdw_ear_spkr_pa_gain_enum,
- msm_sdw_ear_spkr_pa_gain_get,
- msm_sdw_ear_spkr_pa_gain_put),
- SOC_ENUM_EXT("SPKR Left Boost Max State",
- msm_sdw_spkr_boost_stage_enum,
- msm_sdw_spkr_left_boost_stage_get,
- msm_sdw_spkr_left_boost_stage_put),
- SOC_ENUM_EXT("SPKR Right Boost Max State",
- msm_sdw_spkr_boost_stage_enum,
- msm_sdw_spkr_right_boost_stage_get,
- msm_sdw_spkr_right_boost_stage_put),
- SOC_SINGLE_SX_TLV("RX4 Digital Volume", MSM_SDW_RX7_RX_VOL_CTL,
- 0, -84, 40, digital_gain),
- SOC_SINGLE_SX_TLV("RX5 Digital Volume", MSM_SDW_RX8_RX_VOL_CTL,
- 0, -84, 40, digital_gain),
- SOC_SINGLE_EXT("COMP1 Switch", SND_SOC_NOPM, COMP1, 1, 0,
- msm_sdw_get_compander, msm_sdw_set_compander),
- SOC_SINGLE_EXT("COMP2 Switch", SND_SOC_NOPM, COMP2, 1, 0,
- msm_sdw_get_compander, msm_sdw_set_compander),
-};
-
-static const struct snd_soc_dapm_route audio_map[] = {
-
- {"AIF1_SDW VI", NULL, "SDW_TX_I2S_CLK"},
- {"SDW_TX_I2S_CLK", NULL, "INT_MCLK1"},
- {"SDW_TX_I2S_CLK", NULL, "SDW_CONN"},
-
- /* VI Feedback */
- {"AIF1_VI_SDW Mixer", "SPKR_VI_1", "VIINPUT_SDW"},
- {"AIF1_VI_SDW Mixer", "SPKR_VI_2", "VIINPUT_SDW"},
- {"AIF1_SDW VI", NULL, "AIF1_VI_SDW Mixer"},
-
- {"SDW_RX_I2S_CLK", NULL, "INT_MCLK1"},
- {"SDW_RX_I2S_CLK", NULL, "SDW_CONN"},
- {"I2S RX4", NULL, "SDW_RX_I2S_CLK"},
- {"I2S RX5", NULL, "SDW_RX_I2S_CLK"},
-
- {"RX4 MIX1 INP1", "RX4", "I2S RX4"},
- {"RX4 MIX1 INP1", "RX5", "I2S RX5"},
- {"RX4 MIX1 INP2", "RX4", "I2S RX4"},
- {"RX4 MIX1 INP2", "RX5", "I2S RX5"},
- {"RX5 MIX1 INP1", "RX4", "I2S RX4"},
- {"RX5 MIX1 INP1", "RX5", "I2S RX5"},
- {"RX5 MIX1 INP2", "RX4", "I2S RX4"},
- {"RX5 MIX1 INP2", "RX5", "I2S RX5"},
-
- {"RX4 MIX1", NULL, "RX4 MIX1 INP1"},
- {"RX4 MIX1", NULL, "RX4 MIX1 INP2"},
- {"RX5 MIX1", NULL, "RX5 MIX1 INP1"},
- {"RX5 MIX1", NULL, "RX5 MIX1 INP2"},
-
- {"RX INT4 INTERP", NULL, "RX4 MIX1"},
- {"RX INT4 CHAIN", NULL, "RX INT4 INTERP"},
- {"SPK1 OUT", NULL, "RX INT4 CHAIN"},
-
- {"RX INT5 INTERP", NULL, "RX5 MIX1"},
- {"RX INT5 CHAIN", NULL, "RX INT5 INTERP"},
- {"SPK2 OUT", NULL, "RX INT5 CHAIN"},
-};
-
-static const struct msm_sdw_reg_mask_val msm_sdw_reg_init[] = {
- {MSM_SDW_BOOST0_BOOST_CFG1, 0x3F, 0x12},
- {MSM_SDW_BOOST0_BOOST_CFG2, 0x1C, 0x08},
- {MSM_SDW_COMPANDER7_CTL7, 0x1E, 0x18},
- {MSM_SDW_BOOST1_BOOST_CFG1, 0x3F, 0x12},
- {MSM_SDW_BOOST1_BOOST_CFG2, 0x1C, 0x08},
- {MSM_SDW_COMPANDER8_CTL7, 0x1E, 0x18},
- {MSM_SDW_BOOST0_BOOST_CTL, 0x7C, 0x58},
- {MSM_SDW_BOOST1_BOOST_CTL, 0x7C, 0x58},
- {MSM_SDW_RX7_RX_PATH_CFG1, 0x08, 0x08},
- {MSM_SDW_RX8_RX_PATH_CFG1, 0x08, 0x08},
- {MSM_SDW_TOP_TOP_CFG1, 0x02, 0x02},
- {MSM_SDW_TOP_TOP_CFG1, 0x01, 0x01},
- {MSM_SDW_TX9_SPKR_PROT_PATH_CFG0, 0x01, 0x01},
- {MSM_SDW_TX10_SPKR_PROT_PATH_CFG0, 0x01, 0x01},
- {MSM_SDW_TX11_SPKR_PROT_PATH_CFG0, 0x01, 0x01},
- {MSM_SDW_TX12_SPKR_PROT_PATH_CFG0, 0x01, 0x01},
- {MSM_SDW_COMPANDER7_CTL3, 0x80, 0x80},
- {MSM_SDW_COMPANDER8_CTL3, 0x80, 0x80},
- {MSM_SDW_COMPANDER7_CTL7, 0x01, 0x01},
- {MSM_SDW_COMPANDER8_CTL7, 0x01, 0x01},
- {MSM_SDW_RX7_RX_PATH_CFG0, 0x01, 0x01},
- {MSM_SDW_RX8_RX_PATH_CFG0, 0x01, 0x01},
- {MSM_SDW_RX7_RX_PATH_MIX_CFG, 0x01, 0x01},
- {MSM_SDW_RX8_RX_PATH_MIX_CFG, 0x01, 0x01},
-};
-
-static void msm_sdw_init_reg(struct snd_soc_codec *codec)
-{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(msm_sdw_reg_init); i++)
- snd_soc_update_bits(codec,
- msm_sdw_reg_init[i].reg,
- msm_sdw_reg_init[i].mask,
- msm_sdw_reg_init[i].val);
-}
-
-static int msm_sdw_notifier_service_cb(struct notifier_block *nb,
- unsigned long opcode, void *ptr)
-{
- int i;
- struct msm_sdw_priv *msm_sdw = container_of(nb,
- struct msm_sdw_priv,
- service_nb);
- bool adsp_ready = false;
- unsigned long timeout;
- static bool initial_boot = true;
-
- pr_debug("%s: Service opcode 0x%lx\n", __func__, opcode);
-
- mutex_lock(&msm_sdw->codec_mutex);
- switch (opcode) {
- case AUDIO_NOTIFIER_SERVICE_DOWN:
- if (initial_boot) {
- initial_boot = false;
- break;
- }
- msm_sdw->int_mclk1_enabled = false;
- msm_sdw->dev_up = false;
- for (i = 0; i < msm_sdw->nr; i++)
- swrm_wcd_notify(msm_sdw->sdw_ctrl_data[i].sdw_pdev,
- SWR_DEVICE_DOWN, NULL);
- break;
- case AUDIO_NOTIFIER_SERVICE_UP:
- if (initial_boot)
- initial_boot = false;
- if (!q6core_is_adsp_ready()) {
- dev_dbg(msm_sdw->dev, "ADSP isn't ready\n");
- timeout = jiffies +
- msecs_to_jiffies(ADSP_STATE_READY_TIMEOUT_MS);
- while (!time_after(jiffies, timeout)) {
- if (!q6core_is_adsp_ready()) {
- dev_dbg(msm_sdw->dev,
- "ADSP isn't ready\n");
- } else {
- dev_dbg(msm_sdw->dev,
- "ADSP is ready\n");
- adsp_ready = true;
- goto powerup;
- }
- }
- } else {
- adsp_ready = true;
- dev_dbg(msm_sdw->dev, "%s: DSP is ready\n", __func__);
- }
-powerup:
- if (adsp_ready) {
- msm_sdw->dev_up = true;
- msm_sdw_init_reg(msm_sdw->codec);
- regcache_mark_dirty(msm_sdw->regmap);
- regcache_sync(msm_sdw->regmap);
- msm_sdw_set_spkr_mode(msm_sdw->codec,
- msm_sdw->spkr_mode);
- }
- break;
- default:
- break;
- }
- mutex_unlock(&msm_sdw->codec_mutex);
- return NOTIFY_OK;
-}
-
-static int msm_sdw_codec_probe(struct snd_soc_codec *codec)
-{
- struct msm_sdw_priv *msm_sdw;
- int i, ret;
-
- msm_sdw = snd_soc_codec_get_drvdata(codec);
- if (!msm_sdw) {
- pr_err("%s:SDW priv data null\n", __func__);
- return -EINVAL;
- }
- msm_sdw->codec = codec;
- for (i = 0; i < COMP_MAX; i++)
- msm_sdw->comp_enabled[i] = 0;
-
- msm_sdw->spkr_gain_offset = RX_GAIN_OFFSET_0_DB;
- msm_sdw_init_reg(codec);
- msm_sdw->version = MSM_SDW_VERSION_1_0;
-
- msm_sdw->service_nb.notifier_call = msm_sdw_notifier_service_cb;
- ret = audio_notifier_register("msm_sdw",
- AUDIO_NOTIFIER_ADSP_DOMAIN,
- &msm_sdw->service_nb);
- if (ret < 0)
- dev_err(msm_sdw->dev,
- "%s: Audio notifier register failed ret = %d\n",
- __func__, ret);
- return 0;
-}
-
-static int msm_sdw_codec_remove(struct snd_soc_codec *codec)
-{
- return 0;
-}
-
-static struct regmap *msm_sdw_get_regmap(struct device *dev)
-{
- struct msm_sdw_priv *msm_sdw = dev_get_drvdata(dev);
-
- return msm_sdw->regmap;
-}
-
-static struct snd_soc_codec_driver soc_codec_dev_msm_sdw = {
- .probe = msm_sdw_codec_probe,
- .remove = msm_sdw_codec_remove,
- .get_regmap = msm_sdw_get_regmap,
- .component_driver = {
- .controls = msm_sdw_snd_controls,
- .num_controls = ARRAY_SIZE(msm_sdw_snd_controls),
- .dapm_widgets = msm_sdw_dapm_widgets,
- .num_dapm_widgets = ARRAY_SIZE(msm_sdw_dapm_widgets),
- .dapm_routes = audio_map,
- .num_dapm_routes = ARRAY_SIZE(audio_map),
- },
-};
-
-static void msm_sdw_add_child_devices(struct work_struct *work)
-{
- struct msm_sdw_priv *msm_sdw;
- struct platform_device *pdev;
- struct device_node *node;
- struct msm_sdw_ctrl_data *sdw_ctrl_data = NULL, *temp;
- int ret, ctrl_num = 0;
- struct wcd_sdw_ctrl_platform_data *platdata;
- char plat_dev_name[MSM_SDW_STRING_LEN];
-
- msm_sdw = container_of(work, struct msm_sdw_priv,
- msm_sdw_add_child_devices_work);
- if (!msm_sdw) {
- pr_err("%s: Memory for msm_sdw does not exist\n",
- __func__);
- return;
- }
- if (!msm_sdw->dev->of_node) {
- dev_err(msm_sdw->dev,
- "%s: DT node for msm_sdw does not exist\n", __func__);
- return;
- }
-
- platdata = &msm_sdw->sdw_plat_data;
-
- for_each_available_child_of_node(msm_sdw->dev->of_node, node) {
- if (!strcmp(node->name, "swr_master"))
- strlcpy(plat_dev_name, "msm_sdw_swr_ctrl",
- (MSM_SDW_STRING_LEN - 1));
- else if (strnstr(node->name, "msm_cdc_pinctrl",
- strlen("msm_cdc_pinctrl")) != NULL)
- strlcpy(plat_dev_name, node->name,
- (MSM_SDW_STRING_LEN - 1));
- else
- continue;
-
- pdev = platform_device_alloc(plat_dev_name, -1);
- if (!pdev) {
- dev_err(msm_sdw->dev, "%s: pdev memory alloc failed\n",
- __func__);
- ret = -ENOMEM;
- goto err;
- }
- pdev->dev.parent = msm_sdw->dev;
- pdev->dev.of_node = node;
-
- if (!strcmp(node->name, "swr_master")) {
- ret = platform_device_add_data(pdev, platdata,
- sizeof(*platdata));
- if (ret) {
- dev_err(&pdev->dev,
- "%s: cannot add plat data ctrl:%d\n",
- __func__, ctrl_num);
- goto fail_pdev_add;
- }
- }
-
- ret = platform_device_add(pdev);
- if (ret) {
- dev_err(&pdev->dev,
- "%s: Cannot add platform device\n",
- __func__);
- goto fail_pdev_add;
- }
-
- if (!strcmp(node->name, "swr_master")) {
- temp = krealloc(sdw_ctrl_data,
- (ctrl_num + 1) * sizeof(
- struct msm_sdw_ctrl_data),
- GFP_KERNEL);
- if (!temp) {
- dev_err(&pdev->dev, "out of memory\n");
- ret = -ENOMEM;
- goto err;
- }
- sdw_ctrl_data = temp;
- sdw_ctrl_data[ctrl_num].sdw_pdev = pdev;
- ctrl_num++;
- dev_dbg(&pdev->dev,
- "%s: Added soundwire ctrl device(s)\n",
- __func__);
- msm_sdw->nr = ctrl_num;
- msm_sdw->sdw_ctrl_data = sdw_ctrl_data;
- }
- msm_sdw->pdev_child_devices[msm_sdw->child_count++] = pdev;
- }
-
- return;
-fail_pdev_add:
- platform_device_put(pdev);
-err:
- return;
-}
-
-static int msm_sdw_probe(struct platform_device *pdev)
-{
- int ret = 0;
- struct msm_sdw_priv *msm_sdw;
- int adsp_state;
-
- adsp_state = apr_get_subsys_state();
- if (adsp_state != APR_SUBSYS_LOADED) {
- dev_err(&pdev->dev, "Adsp is not loaded yet %d\n",
- adsp_state);
- return -EPROBE_DEFER;
- }
-
- msm_sdw = devm_kzalloc(&pdev->dev, sizeof(struct msm_sdw_priv),
- GFP_KERNEL);
- if (!msm_sdw)
- return -ENOMEM;
- dev_set_drvdata(&pdev->dev, msm_sdw);
- msm_sdw->dev_up = true;
-
- msm_sdw->dev = &pdev->dev;
- INIT_WORK(&msm_sdw->msm_sdw_add_child_devices_work,
- msm_sdw_add_child_devices);
- msm_sdw->sdw_plat_data.handle = (void *) msm_sdw;
- msm_sdw->sdw_plat_data.read = msm_sdw_swrm_read;
- msm_sdw->sdw_plat_data.write = msm_sdw_swrm_write;
- msm_sdw->sdw_plat_data.bulk_write = msm_sdw_swrm_bulk_write;
- msm_sdw->sdw_plat_data.clk = msm_sdw_swrm_clock;
- msm_sdw->sdw_plat_data.handle_irq = msm_sdwm_handle_irq;
- ret = of_property_read_u32(pdev->dev.of_node, "reg",
- &msm_sdw->sdw_base_addr);
- if (ret) {
- dev_err(&pdev->dev, "%s: could not find %s entry in dt\n",
- __func__, "reg");
- goto err_sdw_cdc;
- }
-
- msm_sdw->sdw_gpio_p = of_parse_phandle(pdev->dev.of_node,
- "qcom,cdc-sdw-gpios", 0);
- msm_sdw->sdw_base = ioremap(msm_sdw->sdw_base_addr,
- MSM_SDW_MAX_REGISTER);
- msm_sdw->read_dev = __msm_sdw_reg_read;
- msm_sdw->write_dev = __msm_sdw_reg_write;
-
- msm_sdw->regmap = msm_sdw_regmap_init(msm_sdw->dev,
- &msm_sdw_regmap_config);
- msm_sdw->sdw_irq = platform_get_irq_byname(pdev, "swr_master_irq");
- if (msm_sdw->sdw_irq < 0) {
- dev_err(msm_sdw->dev, "%s() error getting irq handle: %d\n",
- __func__, msm_sdw->sdw_irq);
- ret = -ENODEV;
- goto err_sdw_cdc;
- }
- ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_msm_sdw,
- msm_sdw_dai, ARRAY_SIZE(msm_sdw_dai));
- if (ret) {
- dev_err(&pdev->dev, "%s: Codec registration failed, ret = %d\n",
- __func__, ret);
- goto err_sdw_cdc;
- }
- /* initialize the int_mclk1 */
- msm_sdw->sdw_cdc_core_clk.clk_set_minor_version =
- AFE_API_VERSION_I2S_CONFIG;
- msm_sdw->sdw_cdc_core_clk.clk_id =
- Q6AFE_LPASS_CLK_ID_INT_MCLK_1;
- msm_sdw->sdw_cdc_core_clk.clk_freq_in_hz =
- INT_MCLK1_FREQ;
- msm_sdw->sdw_cdc_core_clk.clk_attri =
- Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO;
- msm_sdw->sdw_cdc_core_clk.clk_root =
- Q6AFE_LPASS_CLK_ROOT_DEFAULT;
- msm_sdw->sdw_cdc_core_clk.enable = 0;
-
- /* initialize the sdw_npl_clk */
- msm_sdw->sdw_npl_clk.clk_set_minor_version =
- AFE_API_VERSION_I2S_CONFIG;
- msm_sdw->sdw_npl_clk.clk_id =
- AFE_CLOCK_SET_CLOCK_ID_SWR_NPL_CLK;
- msm_sdw->sdw_npl_clk.clk_freq_in_hz = SDW_NPL_FREQ;
- msm_sdw->sdw_npl_clk.clk_attri =
- Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO;
- msm_sdw->sdw_npl_clk.clk_root =
- Q6AFE_LPASS_CLK_ROOT_DEFAULT;
- msm_sdw->sdw_npl_clk.enable = 0;
-
- INIT_DELAYED_WORK(&msm_sdw->disable_int_mclk1_work,
- msm_disable_int_mclk1);
- mutex_init(&msm_sdw->cdc_int_mclk1_mutex);
- mutex_init(&msm_sdw->sdw_npl_clk_mutex);
- mutex_init(&msm_sdw->io_lock);
- mutex_init(&msm_sdw->sdw_read_lock);
- mutex_init(&msm_sdw->sdw_write_lock);
- mutex_init(&msm_sdw->sdw_clk_lock);
- mutex_init(&msm_sdw->codec_mutex);
- schedule_work(&msm_sdw->msm_sdw_add_child_devices_work);
-
- dev_dbg(&pdev->dev, "%s: msm_sdw driver probe done\n", __func__);
- return ret;
-
-err_sdw_cdc:
- devm_kfree(&pdev->dev, msm_sdw);
- return ret;
-}
-
-static int msm_sdw_remove(struct platform_device *pdev)
-{
- struct msm_sdw_priv *msm_sdw;
- int count;
-
- msm_sdw = dev_get_drvdata(&pdev->dev);
-
- for (count = 0; count < msm_sdw->child_count &&
- count < MSM_SDW_CHILD_DEVICES_MAX; count++)
- platform_device_unregister(msm_sdw->pdev_child_devices[count]);
-
- mutex_destroy(&msm_sdw->io_lock);
- mutex_destroy(&msm_sdw->sdw_read_lock);
- mutex_destroy(&msm_sdw->sdw_write_lock);
- mutex_destroy(&msm_sdw->sdw_clk_lock);
- mutex_destroy(&msm_sdw->codec_mutex);
- mutex_destroy(&msm_sdw->cdc_int_mclk1_mutex);
-
- devm_kfree(&pdev->dev, msm_sdw);
- snd_soc_unregister_codec(&pdev->dev);
- return 0;
-}
-
-static const struct of_device_id msm_sdw_codec_dt_match[] = {
- { .compatible = "qcom,msm-sdw-codec", },
- {}
-};
-
-static struct platform_driver msm_sdw_codec_driver = {
- .probe = msm_sdw_probe,
- .remove = msm_sdw_remove,
- .driver = {
- .name = "msm_sdw_codec",
- .owner = THIS_MODULE,
- .of_match_table = msm_sdw_codec_dt_match,
- },
-};
-module_platform_driver(msm_sdw_codec_driver);
-
-MODULE_DESCRIPTION("MSM Soundwire Codec driver");
-MODULE_LICENSE("GPL v2");
diff --git a/asoc/codecs/msm_sdw/msm_sdw_cdc_utils.c b/asoc/codecs/msm_sdw/msm_sdw_cdc_utils.c
deleted file mode 100644
index 9a5c85b..0000000
--- a/asoc/codecs/msm_sdw/msm_sdw_cdc_utils.c
+++ /dev/null
@@ -1,211 +0,0 @@
-/* Copyright (c) 2016-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
- * 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.
- */
-
-#include <linux/kernel.h>
-#include <linux/regmap.h>
-#include "msm_sdw.h"
-
-#define REG_BYTES 2
-#define VAL_BYTES 1
-/*
- * Page Register Address that APP Proc uses to
- * access WCD9335 Codec registers is identified
- * as 0x00
- */
-#define PAGE_REG_ADDR 0x00
-
-/*
- * msm_sdw_page_write:
- * Retrieve page number from register and
- * write that page number to the page address.
- * Called under io_lock acquisition.
- *
- * @msm_sdw: pointer to msm_sdw
- * @reg: Register address from which page number is retrieved
- *
- * Returns 0 for success and negative error code for failure.
- */
-int msm_sdw_page_write(struct msm_sdw_priv *msm_sdw, unsigned short reg)
-{
- int ret = 0;
- u8 pg_num, prev_pg_num;
-
- pg_num = msm_sdw_page_map[reg];
- if (msm_sdw->prev_pg_valid) {
- prev_pg_num = msm_sdw->prev_pg;
- if (prev_pg_num != pg_num) {
- ret = msm_sdw->write_dev(msm_sdw, PAGE_REG_ADDR, 1,
- (void *) &pg_num);
- if (ret < 0) {
- dev_err(msm_sdw->dev,
- "page write error, pg_num: 0x%x\n",
- pg_num);
- } else {
- msm_sdw->prev_pg = pg_num;
- dev_dbg(msm_sdw->dev,
- "%s: Page 0x%x Write to 0x00\n",
- __func__, pg_num);
- }
- }
- } else {
- ret = msm_sdw->write_dev(msm_sdw, PAGE_REG_ADDR, 1,
- (void *) &pg_num);
- if (ret < 0) {
- dev_err(msm_sdw->dev,
- "page write error, pg_num: 0x%x\n", pg_num);
- } else {
- msm_sdw->prev_pg = pg_num;
- msm_sdw->prev_pg_valid = true;
- dev_dbg(msm_sdw->dev, "%s: Page 0x%x Write to 0x00\n",
- __func__, pg_num);
- }
- }
- return ret;
-}
-EXPORT_SYMBOL(msm_sdw_page_write);
-
-static int regmap_bus_read(void *context, const void *reg, size_t reg_size,
- void *val, size_t val_size)
-{
- struct device *dev = context;
- struct msm_sdw_priv *msm_sdw = dev_get_drvdata(dev);
- unsigned short c_reg;
- int ret, i;
-
- if (!msm_sdw) {
- dev_err(dev, "%s: msm_sdw is NULL\n", __func__);
- return -EINVAL;
- }
- if (!reg || !val) {
- dev_err(dev, "%s: reg or val is NULL\n", __func__);
- return -EINVAL;
- }
- if (reg_size != REG_BYTES) {
- dev_err(dev, "%s: register size %zd bytes, not supported\n",
- __func__, reg_size);
- return -EINVAL;
- }
- if (!msm_sdw->dev_up) {
- dev_dbg_ratelimited(dev, "%s: No read allowed. dev_up = %d\n",
- __func__, msm_sdw->dev_up);
- return 0;
- }
-
- mutex_lock(&msm_sdw->io_lock);
- c_reg = *(u16 *)reg;
- ret = msm_sdw_page_write(msm_sdw, c_reg);
- if (ret)
- goto err;
- ret = msm_sdw->read_dev(msm_sdw, c_reg, val_size, val);
- if (ret < 0)
- dev_err(dev, "%s: Codec read failed (%d), reg: 0x%x, size:%zd\n",
- __func__, ret, c_reg, val_size);
- else {
- for (i = 0; i < val_size; i++)
- dev_dbg(dev, "%s: Read 0x%02x from 0x%x\n",
- __func__, ((u8 *)val)[i], c_reg + i);
- }
-err:
- mutex_unlock(&msm_sdw->io_lock);
-
- return ret;
-}
-
-static int regmap_bus_gather_write(void *context,
- const void *reg, size_t reg_size,
- const void *val, size_t val_size)
-{
- struct device *dev = context;
- struct msm_sdw_priv *msm_sdw = dev_get_drvdata(dev);
- unsigned short c_reg;
- int ret, i;
-
- if (!msm_sdw) {
- dev_err(dev, "%s: msm_sdw is NULL\n", __func__);
- return -EINVAL;
- }
- if (!reg || !val) {
- dev_err(dev, "%s: reg or val is NULL\n", __func__);
- return -EINVAL;
- }
- if (reg_size != REG_BYTES) {
- dev_err(dev, "%s: register size %zd bytes, not supported\n",
- __func__, reg_size);
- return -EINVAL;
- }
- if (!msm_sdw->dev_up) {
- dev_dbg_ratelimited(dev, "%s: No write allowed. dev_up = %d\n",
- __func__, msm_sdw->dev_up);
- return 0;
- }
-
- mutex_lock(&msm_sdw->io_lock);
- c_reg = *(u16 *)reg;
- ret = msm_sdw_page_write(msm_sdw, c_reg);
- if (ret)
- goto err;
-
- for (i = 0; i < val_size; i++)
- dev_dbg(dev, "Write %02x to 0x%x\n", ((u8 *)val)[i],
- c_reg + i*4);
-
- ret = msm_sdw->write_dev(msm_sdw, c_reg, val_size, (void *) val);
- if (ret < 0)
- dev_err(dev,
- "%s: Codec write failed (%d), reg:0x%x, size:%zd\n",
- __func__, ret, c_reg, val_size);
-
-err:
- mutex_unlock(&msm_sdw->io_lock);
- return ret;
-}
-
-static int regmap_bus_write(void *context, const void *data, size_t count)
-{
- struct device *dev = context;
- struct msm_sdw_priv *msm_sdw = dev_get_drvdata(dev);
-
- if (!msm_sdw)
- return -EINVAL;
-
- WARN_ON(count < REG_BYTES);
-
- return regmap_bus_gather_write(context, data, REG_BYTES,
- data + REG_BYTES,
- count - REG_BYTES);
-
-}
-
-static struct regmap_bus regmap_bus_config = {
- .write = regmap_bus_write,
- .gather_write = regmap_bus_gather_write,
- .read = regmap_bus_read,
- .reg_format_endian_default = REGMAP_ENDIAN_NATIVE,
- .val_format_endian_default = REGMAP_ENDIAN_NATIVE,
-};
-
-/*
- * msm_sdw_regmap_init:
- * Initialize msm_sdw register map
- *
- * @dev: pointer to wcd device
- * @config: pointer to register map config
- *
- * Returns pointer to regmap structure for success
- * or NULL in case of failure.
- */
-struct regmap *msm_sdw_regmap_init(struct device *dev,
- const struct regmap_config *config)
-{
- return devm_regmap_init(dev, ®map_bus_config, dev, config);
-}
-EXPORT_SYMBOL(msm_sdw_regmap_init);
diff --git a/asoc/codecs/msm_sdw/msm_sdw_registers.h b/asoc/codecs/msm_sdw/msm_sdw_registers.h
deleted file mode 100644
index 1b7b0b0..0000000
--- a/asoc/codecs/msm_sdw/msm_sdw_registers.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/* Copyright (c) 2016-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
- * 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.
- */
-#ifndef MSM_SDW_REGISTERS_H
-#define MSM_SDW_REGISTERS_H
-
-#define MSM_SDW_PAGE_REGISTER 0x0000
-
-/* Page-A Registers */
-#define MSM_SDW_TX9_SPKR_PROT_PATH_CTL 0x0308
-#define MSM_SDW_TX9_SPKR_PROT_PATH_CFG0 0x030c
-#define MSM_SDW_TX10_SPKR_PROT_PATH_CTL 0x0318
-#define MSM_SDW_TX10_SPKR_PROT_PATH_CFG0 0x031c
-#define MSM_SDW_TX11_SPKR_PROT_PATH_CTL 0x0328
-#define MSM_SDW_TX11_SPKR_PROT_PATH_CFG0 0x032c
-#define MSM_SDW_TX12_SPKR_PROT_PATH_CTL 0x0338
-#define MSM_SDW_TX12_SPKR_PROT_PATH_CFG0 0x033c
-
-/* Page-B Registers */
-#define MSM_SDW_COMPANDER7_CTL0 0x0024
-#define MSM_SDW_COMPANDER7_CTL1 0x0028
-#define MSM_SDW_COMPANDER7_CTL2 0x002c
-#define MSM_SDW_COMPANDER7_CTL3 0x0030
-#define MSM_SDW_COMPANDER7_CTL4 0x0034
-#define MSM_SDW_COMPANDER7_CTL5 0x0038
-#define MSM_SDW_COMPANDER7_CTL6 0x003c
-#define MSM_SDW_COMPANDER7_CTL7 0x0040
-#define MSM_SDW_COMPANDER8_CTL0 0x0044
-#define MSM_SDW_COMPANDER8_CTL1 0x0048
-#define MSM_SDW_COMPANDER8_CTL2 0x004c
-#define MSM_SDW_COMPANDER8_CTL3 0x0050
-#define MSM_SDW_COMPANDER8_CTL4 0x0054
-#define MSM_SDW_COMPANDER8_CTL5 0x0058
-#define MSM_SDW_COMPANDER8_CTL6 0x005c
-#define MSM_SDW_COMPANDER8_CTL7 0x0060
-#define MSM_SDW_RX7_RX_PATH_CTL 0x01a4
-#define MSM_SDW_RX7_RX_PATH_CFG0 0x01a8
-#define MSM_SDW_RX7_RX_PATH_CFG1 0x01ac
-#define MSM_SDW_RX7_RX_PATH_CFG2 0x01b0
-#define MSM_SDW_RX7_RX_VOL_CTL 0x01b4
-#define MSM_SDW_RX7_RX_PATH_MIX_CTL 0x01b8
-#define MSM_SDW_RX7_RX_PATH_MIX_CFG 0x01bc
-#define MSM_SDW_RX7_RX_VOL_MIX_CTL 0x01c0
-#define MSM_SDW_RX7_RX_PATH_SEC0 0x01c4
-#define MSM_SDW_RX7_RX_PATH_SEC1 0x01c8
-#define MSM_SDW_RX7_RX_PATH_SEC2 0x01cc
-#define MSM_SDW_RX7_RX_PATH_SEC3 0x01d0
-#define MSM_SDW_RX7_RX_PATH_SEC5 0x01d8
-#define MSM_SDW_RX7_RX_PATH_SEC6 0x01dc
-#define MSM_SDW_RX7_RX_PATH_SEC7 0x01e0
-#define MSM_SDW_RX7_RX_PATH_MIX_SEC0 0x01e4
-#define MSM_SDW_RX7_RX_PATH_MIX_SEC1 0x01e8
-#define MSM_SDW_RX8_RX_PATH_CTL 0x0384
-#define MSM_SDW_RX8_RX_PATH_CFG0 0x0388
-#define MSM_SDW_RX8_RX_PATH_CFG1 0x038c
-#define MSM_SDW_RX8_RX_PATH_CFG2 0x0390
-#define MSM_SDW_RX8_RX_VOL_CTL 0x0394
-#define MSM_SDW_RX8_RX_PATH_MIX_CTL 0x0398
-#define MSM_SDW_RX8_RX_PATH_MIX_CFG 0x039c
-#define MSM_SDW_RX8_RX_VOL_MIX_CTL 0x03a0
-#define MSM_SDW_RX8_RX_PATH_SEC0 0x03a4
-#define MSM_SDW_RX8_RX_PATH_SEC1 0x03a8
-#define MSM_SDW_RX8_RX_PATH_SEC2 0x03ac
-#define MSM_SDW_RX8_RX_PATH_SEC3 0x03b0
-#define MSM_SDW_RX8_RX_PATH_SEC5 0x03b8
-#define MSM_SDW_RX8_RX_PATH_SEC6 0x03bc
-#define MSM_SDW_RX8_RX_PATH_SEC7 0x03c0
-#define MSM_SDW_RX8_RX_PATH_MIX_SEC0 0x03c4
-#define MSM_SDW_RX8_RX_PATH_MIX_SEC1 0x03c8
-
-/* Page-C Registers */
-#define MSM_SDW_BOOST0_BOOST_PATH_CTL 0x0064
-#define MSM_SDW_BOOST0_BOOST_CTL 0x0068
-#define MSM_SDW_BOOST0_BOOST_CFG1 0x006c
-#define MSM_SDW_BOOST0_BOOST_CFG2 0x0070
-#define MSM_SDW_BOOST1_BOOST_PATH_CTL 0x0084
-#define MSM_SDW_BOOST1_BOOST_CTL 0x0088
-#define MSM_SDW_BOOST1_BOOST_CFG1 0x008c
-#define MSM_SDW_BOOST1_BOOST_CFG2 0x0090
-#define MSM_SDW_AHB_BRIDGE_WR_DATA_0 0x00a4
-#define MSM_SDW_AHB_BRIDGE_WR_DATA_1 0x00a8
-#define MSM_SDW_AHB_BRIDGE_WR_DATA_2 0x00ac
-#define MSM_SDW_AHB_BRIDGE_WR_DATA_3 0x00b0
-#define MSM_SDW_AHB_BRIDGE_WR_ADDR_0 0x00b4
-#define MSM_SDW_AHB_BRIDGE_WR_ADDR_1 0x00b8
-#define MSM_SDW_AHB_BRIDGE_WR_ADDR_2 0x00bc
-#define MSM_SDW_AHB_BRIDGE_WR_ADDR_3 0x00c0
-#define MSM_SDW_AHB_BRIDGE_RD_ADDR_0 0x00c4
-#define MSM_SDW_AHB_BRIDGE_RD_ADDR_1 0x00c8
-#define MSM_SDW_AHB_BRIDGE_RD_ADDR_2 0x00cc
-#define MSM_SDW_AHB_BRIDGE_RD_ADDR_3 0x00d0
-#define MSM_SDW_AHB_BRIDGE_RD_DATA_0 0x00d4
-#define MSM_SDW_AHB_BRIDGE_RD_DATA_1 0x00d8
-#define MSM_SDW_AHB_BRIDGE_RD_DATA_2 0x00dc
-#define MSM_SDW_AHB_BRIDGE_RD_DATA_3 0x00e0
-#define MSM_SDW_AHB_BRIDGE_ACCESS_CFG 0x00e4
-#define MSM_SDW_AHB_BRIDGE_ACCESS_STATUS 0x00e8
-
-/* Page-D Registers */
-#define MSM_SDW_CLK_RST_CTRL_MCLK_CONTROL 0x0104
-#define MSM_SDW_CLK_RST_CTRL_FS_CNT_CONTROL 0x0108
-#define MSM_SDW_CLK_RST_CTRL_SWR_CONTROL 0x010c
-#define MSM_SDW_TOP_TOP_CFG0 0x0204
-#define MSM_SDW_TOP_TOP_CFG1 0x0208
-#define MSM_SDW_TOP_RX_I2S_CTL 0x020c
-#define MSM_SDW_TOP_TX_I2S_CTL 0x0210
-#define MSM_SDW_TOP_I2S_CLK 0x0214
-#define MSM_SDW_TOP_RX7_PATH_INPUT0_MUX 0x0218
-#define MSM_SDW_TOP_RX7_PATH_INPUT1_MUX 0x021c
-#define MSM_SDW_TOP_RX8_PATH_INPUT0_MUX 0x0220
-#define MSM_SDW_TOP_RX8_PATH_INPUT1_MUX 0x0224
-#define MSM_SDW_TOP_FREQ_MCLK 0x0228
-#define MSM_SDW_TOP_DEBUG_BUS_SEL 0x022c
-#define MSM_SDW_TOP_DEBUG_EN 0x0230
-#define MSM_SDW_TOP_I2S_RESET 0x0234
-#define MSM_SDW_TOP_BLOCKS_RESET 0x0238
-
-#endif
diff --git a/asoc/codecs/msm_sdw/msm_sdw_regmap.c b/asoc/codecs/msm_sdw/msm_sdw_regmap.c
deleted file mode 100644
index 7613e65..0000000
--- a/asoc/codecs/msm_sdw/msm_sdw_regmap.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/* Copyright (c) 2016-2018, 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.
- */
-
-#include <linux/regmap.h>
-#include "msm_sdw.h"
-
-static const struct reg_default msm_sdw_defaults[] = {
- /* Page #10 registers */
- { MSM_SDW_PAGE_REGISTER, 0x00 },
- { MSM_SDW_TX9_SPKR_PROT_PATH_CTL, 0x02 },
- { MSM_SDW_TX9_SPKR_PROT_PATH_CFG0, 0x00 },
- { MSM_SDW_TX10_SPKR_PROT_PATH_CTL, 0x02 },
- { MSM_SDW_TX10_SPKR_PROT_PATH_CFG0, 0x00 },
- { MSM_SDW_TX11_SPKR_PROT_PATH_CTL, 0x02 },
- { MSM_SDW_TX11_SPKR_PROT_PATH_CFG0, 0x00 },
- { MSM_SDW_TX12_SPKR_PROT_PATH_CTL, 0x02 },
- { MSM_SDW_TX12_SPKR_PROT_PATH_CFG0, 0x00 },
- /* Page #11 registers */
- { MSM_SDW_COMPANDER7_CTL0, 0x60 },
- { MSM_SDW_COMPANDER7_CTL1, 0xdb },
- { MSM_SDW_COMPANDER7_CTL2, 0xff },
- { MSM_SDW_COMPANDER7_CTL3, 0x35 },
- { MSM_SDW_COMPANDER7_CTL4, 0xff },
- { MSM_SDW_COMPANDER7_CTL5, 0x00 },
- { MSM_SDW_COMPANDER7_CTL6, 0x01 },
- { MSM_SDW_COMPANDER8_CTL0, 0x60 },
- { MSM_SDW_COMPANDER8_CTL1, 0xdb },
- { MSM_SDW_COMPANDER8_CTL2, 0xff },
- { MSM_SDW_COMPANDER8_CTL3, 0x35 },
- { MSM_SDW_COMPANDER8_CTL4, 0xff },
- { MSM_SDW_COMPANDER8_CTL5, 0x00 },
- { MSM_SDW_COMPANDER8_CTL6, 0x01 },
- { MSM_SDW_RX7_RX_PATH_CTL, 0x04 },
- { MSM_SDW_RX7_RX_PATH_CFG0, 0x00 },
- { MSM_SDW_RX7_RX_PATH_CFG2, 0x8f },
- { MSM_SDW_RX7_RX_VOL_CTL, 0x00 },
- { MSM_SDW_RX7_RX_PATH_MIX_CTL, 0x04 },
- { MSM_SDW_RX7_RX_VOL_MIX_CTL, 0x00 },
- { MSM_SDW_RX7_RX_PATH_SEC2, 0x00 },
- { MSM_SDW_RX7_RX_PATH_SEC3, 0x00 },
- { MSM_SDW_RX7_RX_PATH_SEC5, 0x00 },
- { MSM_SDW_RX7_RX_PATH_SEC6, 0x00 },
- { MSM_SDW_RX7_RX_PATH_SEC7, 0x00 },
- { MSM_SDW_RX7_RX_PATH_MIX_SEC1, 0x00 },
- { MSM_SDW_RX8_RX_PATH_CTL, 0x04 },
- { MSM_SDW_RX8_RX_PATH_CFG0, 0x00 },
- { MSM_SDW_RX8_RX_PATH_CFG2, 0x8f },
- { MSM_SDW_RX8_RX_VOL_CTL, 0x00 },
- { MSM_SDW_RX8_RX_PATH_MIX_CTL, 0x04 },
- { MSM_SDW_RX8_RX_VOL_MIX_CTL, 0x00 },
- { MSM_SDW_RX8_RX_PATH_SEC2, 0x00 },
- { MSM_SDW_RX8_RX_PATH_SEC3, 0x00 },
- { MSM_SDW_RX8_RX_PATH_SEC5, 0x00 },
- { MSM_SDW_RX8_RX_PATH_SEC6, 0x00 },
- { MSM_SDW_RX8_RX_PATH_SEC7, 0x00 },
- { MSM_SDW_RX8_RX_PATH_MIX_SEC1, 0x00 },
- /* Page #12 registers */
- { MSM_SDW_BOOST0_BOOST_PATH_CTL, 0x00 },
- { MSM_SDW_BOOST0_BOOST_CTL, 0xb2 },
- { MSM_SDW_BOOST0_BOOST_CFG1, 0x00 },
- { MSM_SDW_BOOST0_BOOST_CFG2, 0x00 },
- { MSM_SDW_BOOST1_BOOST_PATH_CTL, 0x00 },
- { MSM_SDW_BOOST1_BOOST_CTL, 0xb2 },
- { MSM_SDW_BOOST1_BOOST_CFG1, 0x00 },
- { MSM_SDW_BOOST1_BOOST_CFG2, 0x00 },
- { MSM_SDW_AHB_BRIDGE_WR_DATA_0, 0x00 },
- { MSM_SDW_AHB_BRIDGE_WR_DATA_1, 0x00 },
- { MSM_SDW_AHB_BRIDGE_WR_DATA_2, 0x00 },
- { MSM_SDW_AHB_BRIDGE_WR_DATA_3, 0x00 },
- { MSM_SDW_AHB_BRIDGE_WR_ADDR_0, 0x00 },
- { MSM_SDW_AHB_BRIDGE_WR_ADDR_1, 0x00 },
- { MSM_SDW_AHB_BRIDGE_WR_ADDR_2, 0x00 },
- { MSM_SDW_AHB_BRIDGE_WR_ADDR_3, 0x00 },
- { MSM_SDW_AHB_BRIDGE_RD_ADDR_0, 0x00 },
- { MSM_SDW_AHB_BRIDGE_RD_ADDR_1, 0x00 },
- { MSM_SDW_AHB_BRIDGE_RD_ADDR_2, 0x00 },
- { MSM_SDW_AHB_BRIDGE_RD_ADDR_3, 0x00 },
- { MSM_SDW_AHB_BRIDGE_RD_DATA_0, 0x00 },
- { MSM_SDW_AHB_BRIDGE_RD_DATA_1, 0x00 },
- { MSM_SDW_AHB_BRIDGE_RD_DATA_2, 0x00 },
- { MSM_SDW_AHB_BRIDGE_RD_DATA_3, 0x00 },
- { MSM_SDW_AHB_BRIDGE_ACCESS_CFG, 0x0f },
- { MSM_SDW_AHB_BRIDGE_ACCESS_STATUS, 0x03 },
- /* Page #13 registers */
- { MSM_SDW_CLK_RST_CTRL_MCLK_CONTROL, 0x00 },
- { MSM_SDW_CLK_RST_CTRL_FS_CNT_CONTROL, 0x00 },
- { MSM_SDW_CLK_RST_CTRL_SWR_CONTROL, 0x00 },
- { MSM_SDW_TOP_TOP_CFG0, 0x00 },
- { MSM_SDW_TOP_TOP_CFG1, 0x00 },
- { MSM_SDW_TOP_RX_I2S_CTL, 0x0C },
- { MSM_SDW_TOP_TX_I2S_CTL, 0x00 },
- { MSM_SDW_TOP_I2S_CLK, 0x00 },
- { MSM_SDW_TOP_RX7_PATH_INPUT0_MUX, 0x00 },
- { MSM_SDW_TOP_RX7_PATH_INPUT1_MUX, 0x00 },
- { MSM_SDW_TOP_RX8_PATH_INPUT0_MUX, 0x00 },
- { MSM_SDW_TOP_RX8_PATH_INPUT1_MUX, 0x00 },
- { MSM_SDW_TOP_FREQ_MCLK, 0x00 },
- { MSM_SDW_TOP_DEBUG_BUS_SEL, 0x00 },
- { MSM_SDW_TOP_DEBUG_EN, 0x00 },
- { MSM_SDW_TOP_I2S_RESET, 0x00 },
- { MSM_SDW_TOP_BLOCKS_RESET, 0x00 },
-};
-
-static bool msm_sdw_is_readable_register(struct device *dev, unsigned int reg)
-{
- return msm_sdw_reg_readable[reg];
-}
-
-static bool msm_sdw_is_writeable_register(struct device *dev, unsigned int reg)
-{
- return msm_sdw_reg_writeable[reg];
-}
-
-static bool msm_sdw_is_volatile_register(struct device *dev, unsigned int reg)
-{
- switch (reg) {
- case MSM_SDW_AHB_BRIDGE_WR_DATA_0:
- case MSM_SDW_AHB_BRIDGE_WR_DATA_1:
- case MSM_SDW_AHB_BRIDGE_WR_DATA_2:
- case MSM_SDW_AHB_BRIDGE_WR_DATA_3:
- case MSM_SDW_AHB_BRIDGE_WR_ADDR_0:
- case MSM_SDW_AHB_BRIDGE_WR_ADDR_1:
- case MSM_SDW_AHB_BRIDGE_WR_ADDR_2:
- case MSM_SDW_AHB_BRIDGE_WR_ADDR_3:
- case MSM_SDW_AHB_BRIDGE_RD_DATA_0:
- case MSM_SDW_AHB_BRIDGE_RD_DATA_1:
- case MSM_SDW_AHB_BRIDGE_RD_DATA_2:
- case MSM_SDW_AHB_BRIDGE_RD_DATA_3:
- case MSM_SDW_AHB_BRIDGE_RD_ADDR_0:
- case MSM_SDW_AHB_BRIDGE_RD_ADDR_1:
- case MSM_SDW_AHB_BRIDGE_RD_ADDR_2:
- case MSM_SDW_AHB_BRIDGE_RD_ADDR_3:
- case MSM_SDW_CLK_RST_CTRL_MCLK_CONTROL:
- case MSM_SDW_CLK_RST_CTRL_FS_CNT_CONTROL:
- return true;
- default:
- return false;
- }
-}
-
-const struct regmap_config msm_sdw_regmap_config = {
- .reg_bits = 16,
- .val_bits = 8,
- .reg_stride = 4,
- .cache_type = REGCACHE_RBTREE,
- .reg_defaults = msm_sdw_defaults,
- .num_reg_defaults = ARRAY_SIZE(msm_sdw_defaults),
- .max_register = MSM_SDW_MAX_REGISTER,
- .writeable_reg = msm_sdw_is_writeable_register,
- .volatile_reg = msm_sdw_is_volatile_register,
- .readable_reg = msm_sdw_is_readable_register,
-};
diff --git a/asoc/codecs/sdm660_cdc/Android.mk b/asoc/codecs/sdm660_cdc/Android.mk
deleted file mode 100644
index 41f3cc7..0000000
--- a/asoc/codecs/sdm660_cdc/Android.mk
+++ /dev/null
@@ -1,53 +0,0 @@
-# Android makefile for audio kernel modules
-
-# Assume no targets will be supported
-
-AUDIO_CHIPSET := audio
-# Build/Package only in case of supported target
-ifeq ($(call is-board-platform-in-list,msm8953 sdm670 qcs605),true)
-
-LOCAL_PATH := $(call my-dir)
-
-# This makefile is only for DLKM
-ifneq ($(findstring vendor,$(LOCAL_PATH)),)
-
-ifneq ($(findstring opensource,$(LOCAL_PATH)),)
- AUDIO_BLD_DIR := $(shell pwd)/vendor/qcom/opensource/audio-kernel
-endif # opensource
-
-DLKM_DIR := $(TOP)/device/qcom/common/dlkm
-
-# Build audio.ko as $(AUDIO_CHIPSET)_audio.ko
-###########################################################
-# This is set once per LOCAL_PATH, not per (kernel) module
-KBUILD_OPTIONS := AUDIO_ROOT=$(AUDIO_BLD_DIR)
-
-# We are actually building audio.ko here, as per the
-# requirement we are specifying <chipset>_audio.ko as LOCAL_MODULE.
-# This means we need to rename the module to <chipset>_audio.ko
-# after audio.ko is built.
-KBUILD_OPTIONS += MODNAME=analog_cdc_dlkm
-KBUILD_OPTIONS += BOARD_PLATFORM=$(TARGET_BOARD_PLATFORM)
-KBUILD_OPTIONS += $(AUDIO_SELECT)
-
-###########################################################
-include $(CLEAR_VARS)
-LOCAL_MODULE := $(AUDIO_CHIPSET)_analog_cdc.ko
-LOCAL_MODULE_KBUILD_NAME := analog_cdc_dlkm.ko
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_DEBUG_ENABLE := true
-LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
-include $(DLKM_DIR)/AndroidKernelModule.mk
-###########################################################
-include $(CLEAR_VARS)
-LOCAL_MODULE := $(AUDIO_CHIPSET)_digital_cdc.ko
-LOCAL_MODULE_KBUILD_NAME := digital_cdc_dlkm.ko
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_DEBUG_ENABLE := true
-LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
-include $(DLKM_DIR)/AndroidKernelModule.mk
-###########################################################
-###########################################################
-
-endif # DLKM check
-endif # supported target check
diff --git a/asoc/codecs/sdm660_cdc/Kbuild b/asoc/codecs/sdm660_cdc/Kbuild
deleted file mode 100644
index cbbc0c7..0000000
--- a/asoc/codecs/sdm660_cdc/Kbuild
+++ /dev/null
@@ -1,121 +0,0 @@
-# We can build either as part of a standalone Kernel build or as
-# an external module. Determine which mechanism is being used
-ifeq ($(MODNAME),)
- KERNEL_BUILD := 1
-else
- KERNEL_BUILD := 0
-endif
-
-
-ifeq ($(KERNEL_BUILD), 1)
- # These are configurable via Kconfig for kernel-based builds
- # Need to explicitly configure for Android-based builds
- AUDIO_BLD_DIR := $(shell pwd)/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
- ifeq ($(CONFIG_ARCH_SDM450), 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 +
-# CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
-# Perf : Using appropriate msmXXXX-perf_defconfig
-#
-# Shipment builds (user variants) should not have any debug feature
-# enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
-# are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
-# there is no other way to identify defconfig builds, QTI internal
-# representation of perf builds (identified using the string 'perf'),
-# is used to identify if the build is a slub or defconfig one. This
-# way no critical debug feature will be enabled for perf and shipment
-# builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
-# config.
-
-############ UAPI ############
-UAPI_DIR := uapi
-UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
-
-############ COMMON ############
-COMMON_DIR := include
-COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
-
-############ SDM660_CDC ############
-
-# for SDM660_CDC Codec
-ifdef CONFIG_SND_SOC_ANALOG_CDC
- ANALOG_CDC_OBJS += msm-analog-cdc.o
- ANALOG_CDC_OBJS += sdm660-cdc-irq.o
-endif
-
-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) \
- $(UAPI_INC)
-
-EXTRA_CFLAGS += $(INCS)
-
-
-CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
- -DANI_LITTLE_BIT_ENDIAN \
- -DDOT11F_LITTLE_ENDIAN_HOST \
- -DANI_COMPILER_TYPE_GCC \
- -DANI_OS_TYPE_ANDROID=6 \
- -DPTT_SOCK_SVC_ENABLE \
- -Wall\
- -Werror\
- -D__linux__
-
-KBUILD_CPPFLAGS += $(CDEFINES)
-
-# 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
-# will override the kernel settings.
-ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
-EXTRA_CFLAGS += -Wmaybe-uninitialized
-endif
-#EXTRA_CFLAGS += -Wmissing-prototypes
-
-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_ANALOG_CDC) += analog_cdc_dlkm.o
-analog_cdc_dlkm-y := $(ANALOG_CDC_OBJS)
-
-obj-$(CONFIG_SND_SOC_DIGITAL_CDC) += digital_cdc_dlkm.o
-digital_cdc_dlkm-y := $(DIGITAL_CDC_OBJS)
-
-# inject some build related information
-DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"
diff --git a/asoc/codecs/sdm660_cdc/msm-analog-cdc-regmap.h b/asoc/codecs/sdm660_cdc/msm-analog-cdc-regmap.h
deleted file mode 100644
index 55846a1..0000000
--- a/asoc/codecs/sdm660_cdc/msm-analog-cdc-regmap.h
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Copyright (c) 2015-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
- * 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.
- */
-
-#ifndef ANALOG_CDC_REGMAP_H
-#define ANALOG_CDC_REGMAP_H
-
-#include <linux/regmap.h>
-#include "sdm660-cdc-registers.h"
-
-/*
- * Default register reset values that are common across different versions
- * are defined here. If a register reset value is changed based on version
- * then remove it from this structure and add it in version specific
- * structures.
- */
-
-struct reg_default
- msm89xx_pmic_cdc_defaults[MSM89XX_PMIC_CDC_CACHE_SIZE] = {
- {MSM89XX_PMIC_DIGITAL_REVISION1, 0x00},
- {MSM89XX_PMIC_DIGITAL_REVISION2, 0x00},
- {MSM89XX_PMIC_DIGITAL_PERPH_TYPE, 0x23},
- {MSM89XX_PMIC_DIGITAL_PERPH_SUBTYPE, 0x01},
- {MSM89XX_PMIC_DIGITAL_INT_RT_STS, 0x00},
- {MSM89XX_PMIC_DIGITAL_INT_SET_TYPE, 0xFF},
- {MSM89XX_PMIC_DIGITAL_INT_POLARITY_HIGH, 0xFF},
- {MSM89XX_PMIC_DIGITAL_INT_POLARITY_LOW, 0x00},
- {MSM89XX_PMIC_DIGITAL_INT_LATCHED_CLR, 0x00},
- {MSM89XX_PMIC_DIGITAL_INT_EN_SET, 0x00},
- {MSM89XX_PMIC_DIGITAL_INT_EN_CLR, 0x00},
- {MSM89XX_PMIC_DIGITAL_INT_LATCHED_STS, 0x00},
- {MSM89XX_PMIC_DIGITAL_INT_PENDING_STS, 0x00},
- {MSM89XX_PMIC_DIGITAL_INT_MID_SEL, 0x00},
- {MSM89XX_PMIC_DIGITAL_INT_PRIORITY, 0x00},
- {MSM89XX_PMIC_DIGITAL_GPIO_MODE, 0x00},
- {MSM89XX_PMIC_DIGITAL_PIN_CTL_OE, 0x01},
- {MSM89XX_PMIC_DIGITAL_PIN_CTL_DATA, 0x00},
- {MSM89XX_PMIC_DIGITAL_PIN_STATUS, 0x00},
- {MSM89XX_PMIC_DIGITAL_HDRIVE_CTL, 0x00},
- {MSM89XX_PMIC_DIGITAL_CDC_RST_CTL, 0x00},
- {MSM89XX_PMIC_DIGITAL_CDC_TOP_CLK_CTL, 0x00},
- {MSM89XX_PMIC_DIGITAL_CDC_ANA_CLK_CTL, 0x00},
- {MSM89XX_PMIC_DIGITAL_CDC_DIG_CLK_CTL, 0x00},
- {MSM89XX_PMIC_DIGITAL_CDC_CONN_TX1_CTL, 0x02},
- {MSM89XX_PMIC_DIGITAL_CDC_CONN_TX2_CTL, 0x02},
- {MSM89XX_PMIC_DIGITAL_CDC_CONN_HPHR_DAC_CTL, 0x00},
- {MSM89XX_PMIC_DIGITAL_CDC_CONN_RX1_CTL, 0x00},
- {MSM89XX_PMIC_DIGITAL_CDC_CONN_RX2_CTL, 0x00},
- {MSM89XX_PMIC_DIGITAL_CDC_CONN_RX3_CTL, 0x00},
- {MSM89XX_PMIC_DIGITAL_CDC_CONN_RX_LB_CTL, 0x00},
- {MSM89XX_PMIC_DIGITAL_CDC_RX_CTL1, 0x7C},
- {MSM89XX_PMIC_DIGITAL_CDC_RX_CTL2, 0x7C},
- {MSM89XX_PMIC_DIGITAL_CDC_RX_CTL3, 0x7C},
- {MSM89XX_PMIC_DIGITAL_DEM_BYPASS_DATA0, 0x00},
- {MSM89XX_PMIC_DIGITAL_DEM_BYPASS_DATA1, 0x00},
- {MSM89XX_PMIC_DIGITAL_DEM_BYPASS_DATA2, 0x00},
- {MSM89XX_PMIC_DIGITAL_DEM_BYPASS_DATA3, 0x00},
- {MSM89XX_PMIC_DIGITAL_DIG_DEBUG_CTL, 0x00},
- {MSM89XX_PMIC_DIGITAL_DIG_DEBUG_EN, 0x00},
- {MSM89XX_PMIC_DIGITAL_SPARE_0, 0x00},
- {MSM89XX_PMIC_DIGITAL_SPARE_1, 0x00},
- {MSM89XX_PMIC_DIGITAL_SPARE_2, 0x00},
- {MSM89XX_PMIC_DIGITAL_SEC_ACCESS, 0x00},
- {MSM89XX_PMIC_DIGITAL_PERPH_RESET_CTL1, 0x00},
- {MSM89XX_PMIC_DIGITAL_PERPH_RESET_CTL2, 0x02},
- {MSM89XX_PMIC_DIGITAL_PERPH_RESET_CTL3, 0x05},
- {MSM89XX_PMIC_DIGITAL_PERPH_RESET_CTL4, 0x00},
- {MSM89XX_PMIC_DIGITAL_INT_TEST1, 0x00},
- {MSM89XX_PMIC_DIGITAL_INT_TEST_VAL, 0x00},
- {MSM89XX_PMIC_DIGITAL_TRIM_NUM, 0x00},
- {MSM89XX_PMIC_DIGITAL_TRIM_CTRL, 0x00},
- {MSM89XX_PMIC_ANALOG_REVISION1, 0x00},
- {MSM89XX_PMIC_ANALOG_REVISION2, 0x00},
- {MSM89XX_PMIC_ANALOG_REVISION3, 0x00},
- {MSM89XX_PMIC_ANALOG_REVISION4, 0x00},
- {MSM89XX_PMIC_ANALOG_PERPH_TYPE, 0x23},
- {MSM89XX_PMIC_ANALOG_PERPH_SUBTYPE, 0x09},
- {MSM89XX_PMIC_ANALOG_INT_RT_STS, 0x00},
- {MSM89XX_PMIC_ANALOG_INT_SET_TYPE, 0x3F},
- {MSM89XX_PMIC_ANALOG_INT_POLARITY_HIGH, 0x3F},
- {MSM89XX_PMIC_ANALOG_INT_POLARITY_LOW, 0x00},
- {MSM89XX_PMIC_ANALOG_INT_LATCHED_CLR, 0x00},
- {MSM89XX_PMIC_ANALOG_INT_EN_SET, 0x00},
- {MSM89XX_PMIC_ANALOG_INT_EN_CLR, 0x00},
- {MSM89XX_PMIC_ANALOG_INT_LATCHED_STS, 0x00},
- {MSM89XX_PMIC_ANALOG_INT_PENDING_STS, 0x00},
- {MSM89XX_PMIC_ANALOG_INT_MID_SEL, 0x00},
- {MSM89XX_PMIC_ANALOG_INT_PRIORITY, 0x00},
- {MSM89XX_PMIC_ANALOG_MICB_1_EN, 0x00},
- {MSM89XX_PMIC_ANALOG_MICB_1_VAL, 0x20},
- {MSM89XX_PMIC_ANALOG_MICB_1_CTL, 0x00},
- {MSM89XX_PMIC_ANALOG_MICB_1_INT_RBIAS, 0x49},
- {MSM89XX_PMIC_ANALOG_MICB_2_EN, 0x20},
- {MSM89XX_PMIC_ANALOG_TX_1_2_ATEST_CTL_2, 0x00},
- {MSM89XX_PMIC_ANALOG_MASTER_BIAS_CTL, 0x00},
- {MSM89XX_PMIC_ANALOG_MBHC_DET_CTL_1, 0x35},
- {MSM89XX_PMIC_ANALOG_MBHC_DET_CTL_2, 0x08},
- {MSM89XX_PMIC_ANALOG_MBHC_FSM_CTL, 0x00},
- {MSM89XX_PMIC_ANALOG_MBHC_DBNC_TIMER, 0x98},
- {MSM89XX_PMIC_ANALOG_MBHC_BTN0_ZDETL_CTL, 0x00},
- {MSM89XX_PMIC_ANALOG_MBHC_BTN1_ZDETM_CTL, 0x20},
- {MSM89XX_PMIC_ANALOG_MBHC_BTN2_ZDETH_CTL, 0x40},
- {MSM89XX_PMIC_ANALOG_MBHC_BTN3_CTL, 0x61},
- {MSM89XX_PMIC_ANALOG_MBHC_BTN4_CTL, 0x80},
- {MSM89XX_PMIC_ANALOG_MBHC_BTN_RESULT, 0x00},
- {MSM89XX_PMIC_ANALOG_MBHC_ZDET_ELECT_RESULT, 0x00},
- {MSM89XX_PMIC_ANALOG_TX_1_EN, 0x03},
- {MSM89XX_PMIC_ANALOG_TX_2_EN, 0x03},
- {MSM89XX_PMIC_ANALOG_TX_1_2_TEST_CTL_1, 0xBF},
- {MSM89XX_PMIC_ANALOG_TX_1_2_TEST_CTL_2, 0x8C},
- {MSM89XX_PMIC_ANALOG_TX_1_2_ATEST_CTL, 0x00},
- {MSM89XX_PMIC_ANALOG_TX_1_2_OPAMP_BIAS, 0x6B},
- {MSM89XX_PMIC_ANALOG_TX_1_2_TXFE_CLKDIV, 0x51},
- {MSM89XX_PMIC_ANALOG_TX_3_EN, 0x02},
- {MSM89XX_PMIC_ANALOG_NCP_EN, 0x26},
- {MSM89XX_PMIC_ANALOG_NCP_CLK, 0x23},
- {MSM89XX_PMIC_ANALOG_NCP_DEGLITCH, 0x5B},
- {MSM89XX_PMIC_ANALOG_NCP_FBCTRL, 0x08},
- {MSM89XX_PMIC_ANALOG_NCP_BIAS, 0x29},
- {MSM89XX_PMIC_ANALOG_NCP_VCTRL, 0x24},
- {MSM89XX_PMIC_ANALOG_NCP_TEST, 0x00},
- {MSM89XX_PMIC_ANALOG_NCP_CLIM_ADDR, 0xD5},
- {MSM89XX_PMIC_ANALOG_RX_CLOCK_DIVIDER, 0xE8},
- {MSM89XX_PMIC_ANALOG_RX_COM_OCP_CTL, 0xCF},
- {MSM89XX_PMIC_ANALOG_RX_COM_OCP_COUNT, 0x6E},
- {MSM89XX_PMIC_ANALOG_RX_COM_BIAS_DAC, 0x18},
- {MSM89XX_PMIC_ANALOG_RX_HPH_BIAS_PA, 0x5A},
- {MSM89XX_PMIC_ANALOG_RX_HPH_BIAS_LDO_OCP, 0x69},
- {MSM89XX_PMIC_ANALOG_RX_HPH_BIAS_CNP, 0x29},
- {MSM89XX_PMIC_ANALOG_RX_HPH_CNP_EN, 0x80},
- {MSM89XX_PMIC_ANALOG_RX_HPH_CNP_WG_CTL, 0xDA},
- {MSM89XX_PMIC_ANALOG_RX_HPH_CNP_WG_TIME, 0x16},
- {MSM89XX_PMIC_ANALOG_RX_HPH_L_TEST, 0x00},
- {MSM89XX_PMIC_ANALOG_RX_HPH_L_PA_DAC_CTL, 0x20},
- {MSM89XX_PMIC_ANALOG_RX_HPH_R_TEST, 0x00},
- {MSM89XX_PMIC_ANALOG_RX_HPH_R_PA_DAC_CTL, 0x20},
- {MSM89XX_PMIC_ANALOG_RX_EAR_CTL, 0x12},
- {MSM89XX_PMIC_ANALOG_RX_ATEST, 0x00},
- {MSM89XX_PMIC_ANALOG_RX_HPH_STATUS, 0x0C},
- {MSM89XX_PMIC_ANALOG_RX_EAR_STATUS, 0x00},
- {MSM89XX_PMIC_ANALOG_RX_LO_DAC_CTL, 0x00},
- {MSM89XX_PMIC_ANALOG_RX_LO_EN_CTL, 0x00},
- {MSM89XX_PMIC_ANALOG_SPKR_DAC_CTL, 0x83},
- {MSM89XX_PMIC_ANALOG_SPKR_DRV_CLIP_DET, 0x91},
- {MSM89XX_PMIC_ANALOG_SPKR_DRV_CTL, 0x29},
- {MSM89XX_PMIC_ANALOG_SPKR_ANA_BIAS_SET, 0x4D},
- {MSM89XX_PMIC_ANALOG_SPKR_OCP_CTL, 0xE1},
- {MSM89XX_PMIC_ANALOG_SPKR_PWRSTG_CTL, 0x1E},
- {MSM89XX_PMIC_ANALOG_SPKR_DRV_MISC, 0xCB},
- {MSM89XX_PMIC_ANALOG_SPKR_DRV_DBG, 0x00},
- {MSM89XX_PMIC_ANALOG_CURRENT_LIMIT, 0x02},
- {MSM89XX_PMIC_ANALOG_OUTPUT_VOLTAGE, 0x14},
- {MSM89XX_PMIC_ANALOG_BYPASS_MODE, 0x00},
- {MSM89XX_PMIC_ANALOG_BOOST_EN_CTL, 0x1F},
- {MSM89XX_PMIC_ANALOG_SLOPE_COMP_IP_ZERO, 0x8C},
- {MSM89XX_PMIC_ANALOG_RDSON_MAX_DUTY_CYCLE, 0xC0},
- {MSM89XX_PMIC_ANALOG_BOOST_TEST1_1, 0x00},
- {MSM89XX_PMIC_ANALOG_BOOST_TEST_2, 0x00},
- {MSM89XX_PMIC_ANALOG_SPKR_SAR_STATUS, 0x00},
- {MSM89XX_PMIC_ANALOG_SPKR_DRV_STATUS, 0x00},
- {MSM89XX_PMIC_ANALOG_PBUS_ADD_CSR, 0x00},
- {MSM89XX_PMIC_ANALOG_PBUS_ADD_SEL, 0x00},
- {MSM89XX_PMIC_ANALOG_SEC_ACCESS, 0x00},
- {MSM89XX_PMIC_ANALOG_PERPH_RESET_CTL1, 0x00},
- {MSM89XX_PMIC_ANALOG_PERPH_RESET_CTL2, 0x01},
- {MSM89XX_PMIC_ANALOG_PERPH_RESET_CTL3, 0x05},
- {MSM89XX_PMIC_ANALOG_PERPH_RESET_CTL4, 0x00},
- {MSM89XX_PMIC_ANALOG_INT_TEST1, 0x00},
- {MSM89XX_PMIC_ANALOG_INT_TEST_VAL, 0x00},
- {MSM89XX_PMIC_ANALOG_TRIM_NUM, 0x04},
- {MSM89XX_PMIC_ANALOG_TRIM_CTRL1, 0x00},
- {MSM89XX_PMIC_ANALOG_TRIM_CTRL2, 0x00},
- {MSM89XX_PMIC_ANALOG_TRIM_CTRL3, 0x00},
- {MSM89XX_PMIC_ANALOG_TRIM_CTRL4, 0x00},
-};
-
-#endif
diff --git a/asoc/codecs/sdm660_cdc/msm-analog-cdc.c b/asoc/codecs/sdm660_cdc/msm-analog-cdc.c
deleted file mode 100644
index 64b9956..0000000
--- a/asoc/codecs/sdm660_cdc/msm-analog-cdc.c
+++ /dev/null
@@ -1,4665 +0,0 @@
-/* Copyright (c) 2015-2018, 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.
- */
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <linux/printk.h>
-#include <linux/debugfs.h>
-#include <linux/delay.h>
-#include <linux/regulator/consumer.h>
-#include <linux/workqueue.h>
-#include <linux/regmap.h>
-#include <sound/pcm.h>
-#include <sound/pcm_params.h>
-#include <sound/soc.h>
-#include <sound/soc-dapm.h>
-#include <sound/tlv.h>
-#include <dsp/audio_notifier.h>
-#include <dsp/q6afe-v2.h>
-#include <dsp/q6core.h>
-#include <ipc/apr.h>
-#include "msm-analog-cdc.h"
-#include "msm-cdc-common.h"
-#include "sdm660-cdc-irq.h"
-#include "msm-analog-cdc-regmap.h"
-#include "../../sdm660-common.h"
-#include "../wcd-mbhc-v2-api.h"
-
-#define DRV_NAME "pmic_analog_codec"
-#define SDM660_CDC_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\
- SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |\
- SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000 |\
- SNDRV_PCM_RATE_192000)
-#define SDM660_CDC_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\
- SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S24_3LE)
-#define MSM_DIG_CDC_STRING_LEN 80
-#define MSM_ANLG_CDC_VERSION_ENTRY_SIZE 32
-
-#define CODEC_DT_MAX_PROP_SIZE 40
-#define MAX_ON_DEMAND_SUPPLY_NAME_LENGTH 64
-#define BUS_DOWN 1
-
-/*
- * 200 Milliseconds sufficient for DSP bring up in the lpass
- * after Sub System Restart
- */
-#define ADSP_STATE_READY_TIMEOUT_MS 200
-
-#define EAR_PMD 0
-#define EAR_PMU 1
-#define SPK_PMD 2
-#define SPK_PMU 3
-
-#define MICBIAS_DEFAULT_VAL 1800000
-#define MICBIAS_MIN_VAL 1600000
-#define MICBIAS_STEP_SIZE 50000
-
-#define DEFAULT_BOOST_VOLTAGE 5000
-#define MIN_BOOST_VOLTAGE 4000
-#define MAX_BOOST_VOLTAGE 5550
-#define BOOST_VOLTAGE_STEP 50
-
-#define SDM660_CDC_MBHC_BTN_COARSE_ADJ 100 /* in mV */
-#define SDM660_CDC_MBHC_BTN_FINE_ADJ 12 /* in mV */
-
-#define VOLTAGE_CONVERTER(value, min_value, step_size)\
- ((value - min_value)/step_size)
-
-enum {
- BOOST_SWITCH = 0,
- BOOST_ALWAYS,
- BYPASS_ALWAYS,
- BOOST_ON_FOREVER,
-};
-
-static const DECLARE_TLV_DB_SCALE(analog_gain, 0, 25, 1);
-static struct snd_soc_dai_driver msm_anlg_cdc_i2s_dai[];
-/* By default enable the internal speaker boost */
-static bool spkr_boost_en = true;
-
-static char on_demand_supply_name[][MAX_ON_DEMAND_SUPPLY_NAME_LENGTH] = {
- "cdc-vdd-mic-bias",
-};
-
-static struct wcd_mbhc_register
- wcd_mbhc_registers[WCD_MBHC_REG_FUNC_MAX] = {
- WCD_MBHC_REGISTER("WCD_MBHC_L_DET_EN",
- MSM89XX_PMIC_ANALOG_MBHC_DET_CTL_1, 0x80, 7, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_GND_DET_EN",
- MSM89XX_PMIC_ANALOG_MBHC_DET_CTL_1, 0x40, 6, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_MECH_DETECTION_TYPE",
- MSM89XX_PMIC_ANALOG_MBHC_DET_CTL_1, 0x20, 5, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_MIC_CLAMP_CTL",
- MSM89XX_PMIC_ANALOG_MBHC_DET_CTL_1, 0x18, 3, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_ELECT_DETECTION_TYPE",
- MSM89XX_PMIC_ANALOG_MBHC_DET_CTL_2, 0x01, 0, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_HS_L_DET_PULL_UP_CTRL",
- MSM89XX_PMIC_ANALOG_MBHC_DET_CTL_2, 0xC0, 6, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_HS_L_DET_PULL_UP_COMP_CTRL",
- MSM89XX_PMIC_ANALOG_MBHC_DET_CTL_2, 0x20, 5, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_HPHL_PLUG_TYPE",
- MSM89XX_PMIC_ANALOG_MBHC_DET_CTL_2, 0x10, 4, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_GND_PLUG_TYPE",
- MSM89XX_PMIC_ANALOG_MBHC_DET_CTL_2, 0x08, 3, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_SW_HPH_LP_100K_TO_GND",
- MSM89XX_PMIC_ANALOG_MBHC_DET_CTL_2, 0x01, 0, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_ELECT_SCHMT_ISRC",
- MSM89XX_PMIC_ANALOG_MBHC_DET_CTL_2, 0x06, 1, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_FSM_EN",
- MSM89XX_PMIC_ANALOG_MBHC_FSM_CTL, 0x80, 7, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_INSREM_DBNC",
- MSM89XX_PMIC_ANALOG_MBHC_DBNC_TIMER, 0xF0, 4, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_BTN_DBNC",
- MSM89XX_PMIC_ANALOG_MBHC_DBNC_TIMER, 0x0C, 2, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_HS_VREF",
- MSM89XX_PMIC_ANALOG_MBHC_BTN3_CTL, 0x03, 0, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_HS_COMP_RESULT",
- MSM89XX_PMIC_ANALOG_MBHC_ZDET_ELECT_RESULT, 0x01,
- 0, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_MIC_SCHMT_RESULT",
- MSM89XX_PMIC_ANALOG_MBHC_ZDET_ELECT_RESULT, 0x02,
- 1, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_HPHL_SCHMT_RESULT",
- MSM89XX_PMIC_ANALOG_MBHC_ZDET_ELECT_RESULT, 0x08,
- 3, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_HPHR_SCHMT_RESULT",
- MSM89XX_PMIC_ANALOG_MBHC_ZDET_ELECT_RESULT, 0x04,
- 2, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_OCP_FSM_EN",
- MSM89XX_PMIC_ANALOG_RX_COM_OCP_CTL, 0x10, 4, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_BTN_RESULT",
- MSM89XX_PMIC_ANALOG_MBHC_BTN_RESULT, 0xFF, 0, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_BTN_ISRC_CTL",
- MSM89XX_PMIC_ANALOG_MBHC_FSM_CTL, 0x70, 4, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_ELECT_RESULT",
- MSM89XX_PMIC_ANALOG_MBHC_ZDET_ELECT_RESULT, 0xFF,
- 0, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_MICB_CTRL",
- MSM89XX_PMIC_ANALOG_MICB_2_EN, 0xC0, 6, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_HPH_CNP_WG_TIME",
- MSM89XX_PMIC_ANALOG_RX_HPH_CNP_WG_TIME, 0xFC, 2, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_HPHR_PA_EN",
- MSM89XX_PMIC_ANALOG_RX_HPH_CNP_EN, 0x10, 4, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_HPHL_PA_EN",
- MSM89XX_PMIC_ANALOG_RX_HPH_CNP_EN, 0x20, 5, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_HPH_PA_EN",
- MSM89XX_PMIC_ANALOG_RX_HPH_CNP_EN, 0x30, 4, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_SWCH_LEVEL_REMOVE",
- MSM89XX_PMIC_ANALOG_MBHC_ZDET_ELECT_RESULT,
- 0x10, 4, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_PULLDOWN_CTRL",
- MSM89XX_PMIC_ANALOG_MICB_2_EN, 0x20, 5, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_ANC_DET_EN", 0, 0, 0, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_FSM_STATUS", 0, 0, 0, 0),
- WCD_MBHC_REGISTER("WCD_MBHC_MUX_CTL", 0, 0, 0, 0),
-};
-
-/* Multiply gain_adj and offset by 1000 and 100 to avoid float arithmetic */
-static const struct wcd_imped_i_ref imped_i_ref[] = {
- {I_h4_UA, 8, 800, 9000, 10000},
- {I_pt5_UA, 10, 100, 990, 4600},
- {I_14_UA, 17, 14, 1050, 700},
- {I_l4_UA, 10, 4, 1165, 110},
- {I_1_UA, 0, 1, 1200, 65},
-};
-
-static const struct wcd_mbhc_intr intr_ids = {
- .mbhc_sw_intr = MSM89XX_IRQ_MBHC_HS_DET,
- .mbhc_btn_press_intr = MSM89XX_IRQ_MBHC_PRESS,
- .mbhc_btn_release_intr = MSM89XX_IRQ_MBHC_RELEASE,
- .mbhc_hs_ins_intr = MSM89XX_IRQ_MBHC_INSREM_DET1,
- .mbhc_hs_rem_intr = MSM89XX_IRQ_MBHC_INSREM_DET,
- .hph_left_ocp = MSM89XX_IRQ_HPHL_OCP,
- .hph_right_ocp = MSM89XX_IRQ_HPHR_OCP,
-};
-
-static int msm_anlg_cdc_dt_parse_vreg_info(struct device *dev,
- struct sdm660_cdc_regulator *vreg,
- const char *vreg_name,
- bool ondemand);
-static struct sdm660_cdc_pdata *msm_anlg_cdc_populate_dt_pdata(
- struct device *dev);
-static int msm_anlg_cdc_enable_ext_mb_source(struct wcd_mbhc *wcd_mbhc,
- bool turn_on);
-static void msm_anlg_cdc_trim_btn_reg(struct snd_soc_codec *codec);
-static void msm_anlg_cdc_set_micb_v(struct snd_soc_codec *codec);
-static void msm_anlg_cdc_set_boost_v(struct snd_soc_codec *codec);
-static void msm_anlg_cdc_set_auto_zeroing(struct snd_soc_codec *codec,
- bool enable);
-static void msm_anlg_cdc_configure_cap(struct snd_soc_codec *codec,
- bool micbias1, bool micbias2);
-static bool msm_anlg_cdc_use_mb(struct snd_soc_codec *codec);
-
-static int get_codec_version(struct sdm660_cdc_priv *sdm660_cdc)
-{
- if (sdm660_cdc->codec_version == DRAX_CDC)
- return DRAX_CDC;
- else if (sdm660_cdc->codec_version == DIANGU)
- return DIANGU;
- else if (sdm660_cdc->codec_version == CAJON_2_0)
- return CAJON_2_0;
- else if (sdm660_cdc->codec_version == CAJON)
- return CAJON;
- else if (sdm660_cdc->codec_version == CONGA)
- return CONGA;
- else if (sdm660_cdc->pmic_rev == TOMBAK_2_0)
- return TOMBAK_2_0;
- else if (sdm660_cdc->pmic_rev == TOMBAK_1_0)
- return TOMBAK_1_0;
-
- pr_err("%s: unsupported codec version\n", __func__);
- return UNSUPPORTED;
-}
-
-static void wcd_mbhc_meas_imped(struct snd_soc_codec *codec,
- s16 *impedance_l, s16 *impedance_r)
-{
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- if ((sdm660_cdc->imped_det_pin == WCD_MBHC_DET_BOTH) ||
- (sdm660_cdc->imped_det_pin == WCD_MBHC_DET_HPHL)) {
- /* Enable ZDET_L_MEAS_EN */
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MBHC_FSM_CTL,
- 0x08, 0x08);
- /* Wait for 2ms for measurement to complete */
- usleep_range(2000, 2100);
- /* Read Left impedance value from Result1 */
- *impedance_l = snd_soc_read(codec,
- MSM89XX_PMIC_ANALOG_MBHC_BTN_RESULT);
- /* Enable ZDET_R_MEAS_EN */
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MBHC_FSM_CTL,
- 0x08, 0x00);
- }
- if ((sdm660_cdc->imped_det_pin == WCD_MBHC_DET_BOTH) ||
- (sdm660_cdc->imped_det_pin == WCD_MBHC_DET_HPHR)) {
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MBHC_FSM_CTL,
- 0x04, 0x04);
- /* Wait for 2ms for measurement to complete */
- usleep_range(2000, 2100);
- /* Read Right impedance value from Result1 */
- *impedance_r = snd_soc_read(codec,
- MSM89XX_PMIC_ANALOG_MBHC_BTN_RESULT);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MBHC_FSM_CTL,
- 0x04, 0x00);
- }
-}
-
-static void msm_anlg_cdc_set_ref_current(struct snd_soc_codec *codec,
- enum wcd_curr_ref curr_ref)
-{
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- dev_dbg(codec->dev, "%s: curr_ref: %d\n", __func__, curr_ref);
-
- if (get_codec_version(sdm660_cdc) < CAJON)
- dev_dbg(codec->dev, "%s: Setting ref current not required\n",
- __func__);
-
- sdm660_cdc->imped_i_ref = imped_i_ref[curr_ref];
-
- switch (curr_ref) {
- case I_h4_UA:
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MICB_2_EN,
- 0x07, 0x01);
- break;
- case I_pt5_UA:
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MICB_2_EN,
- 0x07, 0x04);
- break;
- case I_14_UA:
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MICB_2_EN,
- 0x07, 0x03);
- break;
- case I_l4_UA:
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MICB_2_EN,
- 0x07, 0x01);
- break;
- case I_1_UA:
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MICB_2_EN,
- 0x07, 0x00);
- break;
- default:
- pr_debug("%s: No ref current set\n", __func__);
- break;
- }
-}
-
-static bool msm_anlg_cdc_adj_ref_current(struct snd_soc_codec *codec,
- s16 *impedance_l, s16 *impedance_r)
-{
- int i = 2;
- s16 compare_imp = 0;
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- if (sdm660_cdc->imped_det_pin == WCD_MBHC_DET_HPHR)
- compare_imp = *impedance_r;
- else
- compare_imp = *impedance_l;
-
- if (get_codec_version(sdm660_cdc) < CAJON) {
- dev_dbg(codec->dev,
- "%s: Reference current adjustment not required\n",
- __func__);
- return false;
- }
-
- while (compare_imp < imped_i_ref[i].min_val) {
- msm_anlg_cdc_set_ref_current(codec, imped_i_ref[++i].curr_ref);
- wcd_mbhc_meas_imped(codec, impedance_l, impedance_r);
- compare_imp = (sdm660_cdc->imped_det_pin ==
- WCD_MBHC_DET_HPHR) ? *impedance_r : *impedance_l;
- if (i >= I_1_UA)
- break;
- }
- return true;
-}
-
-void msm_anlg_cdc_spk_ext_pa_cb(
- int (*codec_spk_ext_pa)(struct snd_soc_codec *codec,
- int enable), struct snd_soc_codec *codec)
-{
- struct sdm660_cdc_priv *sdm660_cdc;
-
- if (!codec) {
- pr_err("%s: NULL codec pointer!\n", __func__);
- return;
- }
-
- sdm660_cdc = snd_soc_codec_get_drvdata(codec);
-
- dev_dbg(codec->dev, "%s: Enter\n", __func__);
- sdm660_cdc->codec_spk_ext_pa_cb = codec_spk_ext_pa;
-}
-EXPORT_SYMBOL(msm_anlg_cdc_spk_ext_pa_cb);
-
-static void msm_anlg_cdc_compute_impedance(struct snd_soc_codec *codec, s16 l,
- s16 r, uint32_t *zl, uint32_t *zr,
- bool high)
-{
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
- uint32_t rl = 0, rr = 0;
- struct wcd_imped_i_ref R = sdm660_cdc->imped_i_ref;
- int codec_ver = get_codec_version(sdm660_cdc);
-
- switch (codec_ver) {
- case TOMBAK_1_0:
- case TOMBAK_2_0:
- case CONGA:
- if (high) {
- dev_dbg(codec->dev,
- "%s: This plug has high range impedance\n",
- __func__);
- rl = (uint32_t)(((100 * (l * 400 - 200))/96) - 230);
- rr = (uint32_t)(((100 * (r * 400 - 200))/96) - 230);
- } else {
- dev_dbg(codec->dev,
- "%s: This plug has low range impedance\n",
- __func__);
- rl = (uint32_t)(((1000 * (l * 2 - 1))/1165) - (13/10));
- rr = (uint32_t)(((1000 * (r * 2 - 1))/1165) - (13/10));
- }
- break;
- case CAJON:
- case CAJON_2_0:
- case DIANGU:
- case DRAX_CDC:
- if (sdm660_cdc->imped_det_pin == WCD_MBHC_DET_HPHL) {
- rr = (uint32_t)(((DEFAULT_MULTIPLIER * (10 * r - 5)) -
- (DEFAULT_OFFSET * DEFAULT_GAIN))/DEFAULT_GAIN);
- rl = (uint32_t)(((10000 * (R.multiplier * (10 * l - 5)))
- - R.offset * R.gain_adj)/(R.gain_adj * 100));
- } else if (sdm660_cdc->imped_det_pin == WCD_MBHC_DET_HPHR) {
- rr = (uint32_t)(((10000 * (R.multiplier * (10 * r - 5)))
- - R.offset * R.gain_adj)/(R.gain_adj * 100));
- rl = (uint32_t)(((DEFAULT_MULTIPLIER * (10 * l - 5))-
- (DEFAULT_OFFSET * DEFAULT_GAIN))/DEFAULT_GAIN);
- } else if (sdm660_cdc->imped_det_pin == WCD_MBHC_DET_NONE) {
- rr = (uint32_t)(((DEFAULT_MULTIPLIER * (10 * r - 5)) -
- (DEFAULT_OFFSET * DEFAULT_GAIN))/DEFAULT_GAIN);
- rl = (uint32_t)(((DEFAULT_MULTIPLIER * (10 * l - 5))-
- (DEFAULT_OFFSET * DEFAULT_GAIN))/DEFAULT_GAIN);
- } else {
- rr = (uint32_t)(((10000 * (R.multiplier * (10 * r - 5)))
- - R.offset * R.gain_adj)/(R.gain_adj * 100));
- rl = (uint32_t)(((10000 * (R.multiplier * (10 * l - 5)))
- - R.offset * R.gain_adj)/(R.gain_adj * 100));
- }
- break;
- default:
- dev_dbg(codec->dev, "%s: No codec mentioned\n", __func__);
- break;
- }
- *zl = rl;
- *zr = rr;
-}
-
-static struct firmware_cal *msm_anlg_cdc_get_hwdep_fw_cal(
- struct wcd_mbhc *wcd_mbhc,
- enum wcd_cal_type type)
-{
- struct sdm660_cdc_priv *sdm660_cdc;
- struct firmware_cal *hwdep_cal;
- struct snd_soc_codec *codec = wcd_mbhc->codec;
-
- if (!codec) {
- pr_err("%s: NULL codec pointer\n", __func__);
- return NULL;
- }
- sdm660_cdc = snd_soc_codec_get_drvdata(codec);
- hwdep_cal = wcdcal_get_fw_cal(sdm660_cdc->fw_data, type);
- if (!hwdep_cal) {
- dev_err(codec->dev, "%s: cal not sent by %d\n",
- __func__, type);
- return NULL;
- }
- return hwdep_cal;
-}
-
-static void wcd9xxx_spmi_irq_control(struct snd_soc_codec *codec,
- int irq, bool enable)
-{
- if (enable)
- wcd9xxx_spmi_enable_irq(irq);
- else
- wcd9xxx_spmi_disable_irq(irq);
-}
-
-static void msm_anlg_cdc_mbhc_clk_setup(struct snd_soc_codec *codec,
- bool enable)
-{
- if (enable)
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_DIG_CLK_CTL,
- 0x08, 0x08);
- else
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_DIG_CLK_CTL,
- 0x08, 0x00);
-}
-
-static int msm_anlg_cdc_mbhc_map_btn_code_to_num(struct snd_soc_codec *codec)
-{
- int btn_code;
- int btn;
-
- btn_code = snd_soc_read(codec, MSM89XX_PMIC_ANALOG_MBHC_BTN_RESULT);
-
- switch (btn_code) {
- case 0:
- btn = 0;
- break;
- case 1:
- btn = 1;
- break;
- case 3:
- btn = 2;
- break;
- case 7:
- btn = 3;
- break;
- case 15:
- btn = 4;
- break;
- default:
- btn = -EINVAL;
- break;
- };
-
- return btn;
-}
-
-static bool msm_anlg_cdc_spmi_lock_sleep(struct wcd_mbhc *mbhc, bool lock)
-{
- if (lock)
- return wcd9xxx_spmi_lock_sleep();
- wcd9xxx_spmi_unlock_sleep();
- return 0;
-}
-
-static bool msm_anlg_cdc_micb_en_status(struct wcd_mbhc *mbhc, int micb_num)
-{
- if (micb_num == MIC_BIAS_1)
- return (snd_soc_read(mbhc->codec,
- MSM89XX_PMIC_ANALOG_MICB_1_EN) &
- 0x80);
- if (micb_num == MIC_BIAS_2)
- return (snd_soc_read(mbhc->codec,
- MSM89XX_PMIC_ANALOG_MICB_2_EN) &
- 0x80);
- return false;
-}
-
-static void msm_anlg_cdc_enable_master_bias(struct snd_soc_codec *codec,
- bool enable)
-{
- if (enable)
- snd_soc_update_bits(codec, MSM89XX_PMIC_ANALOG_MASTER_BIAS_CTL,
- 0x30, 0x30);
- else
- snd_soc_update_bits(codec, MSM89XX_PMIC_ANALOG_MASTER_BIAS_CTL,
- 0x30, 0x00);
-}
-
-static void msm_anlg_cdc_mbhc_common_micb_ctrl(struct snd_soc_codec *codec,
- int event, bool enable)
-{
- u16 reg;
- u8 mask;
- u8 val;
-
- switch (event) {
- case MBHC_COMMON_MICB_PRECHARGE:
- reg = MSM89XX_PMIC_ANALOG_MICB_1_CTL;
- mask = 0x60;
- val = (enable ? 0x60 : 0x00);
- break;
- case MBHC_COMMON_MICB_SET_VAL:
- reg = MSM89XX_PMIC_ANALOG_MICB_1_VAL;
- mask = 0xFF;
- val = (enable ? 0xC0 : 0x00);
- break;
- case MBHC_COMMON_MICB_TAIL_CURR:
- reg = MSM89XX_PMIC_ANALOG_MICB_1_EN;
- mask = 0x04;
- val = (enable ? 0x04 : 0x00);
- break;
- default:
- dev_err(codec->dev,
- "%s: Invalid event received\n", __func__);
- return;
- };
- snd_soc_update_bits(codec, reg, mask, val);
-}
-
-static void msm_anlg_cdc_mbhc_internal_micbias_ctrl(struct snd_soc_codec *codec,
- int micbias_num,
- bool enable)
-{
- if (micbias_num == 1) {
- if (enable)
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MICB_1_INT_RBIAS,
- 0x10, 0x10);
- else
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MICB_1_INT_RBIAS,
- 0x10, 0x00);
- }
-}
-
-static bool msm_anlg_cdc_mbhc_hph_pa_on_status(struct snd_soc_codec *codec)
-{
- return (snd_soc_read(codec, MSM89XX_PMIC_ANALOG_RX_HPH_CNP_EN) &
- 0x30) ? true : false;
-}
-
-static void msm_anlg_cdc_mbhc_program_btn_thr(struct snd_soc_codec *codec,
- s16 *btn_low, s16 *btn_high,
- int num_btn, bool is_micbias)
-{
- int i;
- u32 course, fine, reg_val;
- u16 reg_addr = MSM89XX_PMIC_ANALOG_MBHC_BTN0_ZDETL_CTL;
- s16 *btn_voltage;
-
- btn_voltage = ((is_micbias) ? btn_high : btn_low);
-
- for (i = 0; i < num_btn; i++) {
- course = (btn_voltage[i] / SDM660_CDC_MBHC_BTN_COARSE_ADJ);
- fine = ((btn_voltage[i] % SDM660_CDC_MBHC_BTN_COARSE_ADJ) /
- SDM660_CDC_MBHC_BTN_FINE_ADJ);
-
- reg_val = (course << 5) | (fine << 2);
- snd_soc_update_bits(codec, reg_addr, 0xFC, reg_val);
- dev_dbg(codec->dev,
- "%s: course: %d fine: %d reg_addr: %x reg_val: %x\n",
- __func__, course, fine, reg_addr, reg_val);
- reg_addr++;
- }
-}
-
-static void msm_anlg_cdc_mbhc_calc_impedance(struct wcd_mbhc *mbhc,
- uint32_t *zl, uint32_t *zr)
-{
- struct snd_soc_codec *codec = mbhc->codec;
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
- s16 impedance_l, impedance_r;
- s16 impedance_l_fixed;
- s16 reg0, reg1, reg2, reg3, reg4;
- bool high = false;
- bool min_range_used = false;
-
- WCD_MBHC_RSC_ASSERT_LOCKED(mbhc);
- reg0 = snd_soc_read(codec, MSM89XX_PMIC_ANALOG_MBHC_DBNC_TIMER);
- reg1 = snd_soc_read(codec, MSM89XX_PMIC_ANALOG_MBHC_BTN2_ZDETH_CTL);
- reg2 = snd_soc_read(codec, MSM89XX_PMIC_ANALOG_MBHC_DET_CTL_2);
- reg3 = snd_soc_read(codec, MSM89XX_PMIC_ANALOG_MICB_2_EN);
- reg4 = snd_soc_read(codec, MSM89XX_PMIC_ANALOG_MBHC_FSM_CTL);
-
- sdm660_cdc->imped_det_pin = WCD_MBHC_DET_BOTH;
- mbhc->hph_type = WCD_MBHC_HPH_NONE;
-
- /* disable FSM and micbias and enable pullup*/
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MBHC_FSM_CTL,
- 0x80, 0x00);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MICB_2_EN,
- 0xA5, 0x25);
- /*
- * Enable legacy electrical detection current sources
- * and disable fast ramp and enable manual switching
- * of extra capacitance
- */
- dev_dbg(codec->dev, "%s: Setup for impedance det\n", __func__);
-
- msm_anlg_cdc_set_ref_current(codec, I_h4_UA);
-
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MBHC_DET_CTL_2,
- 0x06, 0x02);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MBHC_DBNC_TIMER,
- 0x02, 0x02);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MBHC_BTN2_ZDETH_CTL,
- 0x02, 0x00);
-
- dev_dbg(codec->dev, "%s: Start performing impedance detection\n",
- __func__);
-
- wcd_mbhc_meas_imped(codec, &impedance_l, &impedance_r);
-
- if (impedance_l > 2 || impedance_r > 2) {
- high = true;
- if (!mbhc->mbhc_cfg->mono_stero_detection) {
- /* Set ZDET_CHG to 0 to discharge ramp */
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MBHC_FSM_CTL,
- 0x02, 0x00);
- /* wait 40ms for the discharge ramp to complete */
- usleep_range(40000, 40100);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MBHC_BTN0_ZDETL_CTL,
- 0x03, 0x00);
- sdm660_cdc->imped_det_pin = (impedance_l > 2 &&
- impedance_r > 2) ?
- WCD_MBHC_DET_NONE :
- ((impedance_l > 2) ?
- WCD_MBHC_DET_HPHR :
- WCD_MBHC_DET_HPHL);
- if (sdm660_cdc->imped_det_pin == WCD_MBHC_DET_NONE)
- goto exit;
- } else {
- if (get_codec_version(sdm660_cdc) >= CAJON) {
- if (impedance_l == 63 && impedance_r == 63) {
- dev_dbg(codec->dev,
- "%s: HPHL and HPHR are floating\n",
- __func__);
- sdm660_cdc->imped_det_pin =
- WCD_MBHC_DET_NONE;
- mbhc->hph_type = WCD_MBHC_HPH_NONE;
- } else if (impedance_l == 63
- && impedance_r < 63) {
- dev_dbg(codec->dev,
- "%s: Mono HS with HPHL floating\n",
- __func__);
- sdm660_cdc->imped_det_pin =
- WCD_MBHC_DET_HPHR;
- mbhc->hph_type = WCD_MBHC_HPH_MONO;
- } else if (impedance_r == 63 &&
- impedance_l < 63) {
- dev_dbg(codec->dev,
- "%s: Mono HS with HPHR floating\n",
- __func__);
- sdm660_cdc->imped_det_pin =
- WCD_MBHC_DET_HPHL;
- mbhc->hph_type = WCD_MBHC_HPH_MONO;
- } else if (impedance_l > 3 && impedance_r > 3 &&
- (impedance_l == impedance_r)) {
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MBHC_DET_CTL_2,
- 0x06, 0x06);
- wcd_mbhc_meas_imped(codec, &impedance_l,
- &impedance_r);
- if (impedance_r == impedance_l)
- dev_dbg(codec->dev,
- "%s: Mono Headset\n",
- __func__);
- sdm660_cdc->imped_det_pin =
- WCD_MBHC_DET_NONE;
- mbhc->hph_type =
- WCD_MBHC_HPH_MONO;
- } else {
- dev_dbg(codec->dev,
- "%s: STEREO headset is found\n",
- __func__);
- sdm660_cdc->imped_det_pin =
- WCD_MBHC_DET_BOTH;
- mbhc->hph_type = WCD_MBHC_HPH_STEREO;
- }
- }
- }
- }
-
- msm_anlg_cdc_set_ref_current(codec, I_pt5_UA);
- msm_anlg_cdc_set_ref_current(codec, I_14_UA);
-
- /* Enable RAMP_L , RAMP_R & ZDET_CHG*/
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MBHC_BTN0_ZDETL_CTL,
- 0x03, 0x03);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MBHC_FSM_CTL,
- 0x02, 0x02);
- /* wait for 50msec for the HW to apply ramp on HPHL and HPHR */
- usleep_range(50000, 50100);
- /* Enable ZDET_DISCHG_CAP_CTL to add extra capacitance */
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MBHC_FSM_CTL,
- 0x01, 0x01);
- /* wait for 5msec for the voltage to get stable */
- usleep_range(5000, 5100);
-
- wcd_mbhc_meas_imped(codec, &impedance_l, &impedance_r);
-
- min_range_used = msm_anlg_cdc_adj_ref_current(codec,
- &impedance_l, &impedance_r);
- if (!mbhc->mbhc_cfg->mono_stero_detection) {
- /* Set ZDET_CHG to 0 to discharge ramp */
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MBHC_FSM_CTL,
- 0x02, 0x00);
- /* wait for 40msec for the capacitor to discharge */
- usleep_range(40000, 40100);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MBHC_BTN0_ZDETL_CTL,
- 0x03, 0x00);
- goto exit;
- }
-
- /* we are setting ref current to the minimun range or the measured
- * value larger than the minimum value, so min_range_used is true.
- * If the headset is mono headset with either HPHL or HPHR floating
- * then we have already done the mono stereo detection and do not
- * need to continue further.
- */
-
- if (!min_range_used ||
- sdm660_cdc->imped_det_pin == WCD_MBHC_DET_HPHL ||
- sdm660_cdc->imped_det_pin == WCD_MBHC_DET_HPHR)
- goto exit;
-
-
- /* Disable Set ZDET_CONN_RAMP_L and enable ZDET_CONN_FIXED_L */
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MBHC_BTN0_ZDETL_CTL,
- 0x02, 0x00);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MBHC_BTN1_ZDETM_CTL,
- 0x02, 0x02);
- /* Set ZDET_CHG to 0 */
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MBHC_FSM_CTL,
- 0x02, 0x00);
- /* wait for 40msec for the capacitor to discharge */
- usleep_range(40000, 40100);
-
- /* Set ZDET_CONN_RAMP_R to 0 */
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MBHC_BTN0_ZDETL_CTL,
- 0x01, 0x00);
- /* Enable ZDET_L_MEAS_EN */
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MBHC_FSM_CTL,
- 0x08, 0x08);
- /* wait for 2msec for the HW to compute left inpedance value */
- usleep_range(2000, 2100);
- /* Read Left impedance value from Result1 */
- impedance_l_fixed = snd_soc_read(codec,
- MSM89XX_PMIC_ANALOG_MBHC_BTN_RESULT);
- /* Disable ZDET_L_MEAS_EN */
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MBHC_FSM_CTL,
- 0x08, 0x00);
- /*
- * Assume impedance_l is L1, impedance_l_fixed is L2.
- * If the following condition is met, we can take this
- * headset as mono one with impedance of L2.
- * Otherwise, take it as stereo with impedance of L1.
- * Condition:
- * abs[(L2-0.5L1)/(L2+0.5L1)] < abs [(L2-L1)/(L2+L1)]
- */
- if ((abs(impedance_l_fixed - impedance_l/2) *
- (impedance_l_fixed + impedance_l)) >=
- (abs(impedance_l_fixed - impedance_l) *
- (impedance_l_fixed + impedance_l/2))) {
- dev_dbg(codec->dev,
- "%s: STEREO plug type detected\n",
- __func__);
- mbhc->hph_type = WCD_MBHC_HPH_STEREO;
- } else {
- dev_dbg(codec->dev,
- "%s: MONO plug type detected\n",
- __func__);
- mbhc->hph_type = WCD_MBHC_HPH_MONO;
- impedance_l = impedance_l_fixed;
- }
- /* Enable ZDET_CHG */
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MBHC_FSM_CTL,
- 0x02, 0x02);
- /* wait for 10msec for the capacitor to charge */
- usleep_range(10000, 10100);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MBHC_BTN0_ZDETL_CTL,
- 0x02, 0x02);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MBHC_BTN1_ZDETM_CTL,
- 0x02, 0x00);
- /* Set ZDET_CHG to 0 to discharge HPHL */
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MBHC_FSM_CTL,
- 0x02, 0x00);
- /* wait for 40msec for the capacitor to discharge */
- usleep_range(40000, 40100);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MBHC_BTN0_ZDETL_CTL,
- 0x02, 0x00);
-
-exit:
- snd_soc_write(codec, MSM89XX_PMIC_ANALOG_MBHC_FSM_CTL, reg4);
- snd_soc_write(codec, MSM89XX_PMIC_ANALOG_MICB_2_EN, reg3);
- snd_soc_write(codec, MSM89XX_PMIC_ANALOG_MBHC_BTN2_ZDETH_CTL, reg1);
- snd_soc_write(codec, MSM89XX_PMIC_ANALOG_MBHC_DBNC_TIMER, reg0);
- snd_soc_write(codec, MSM89XX_PMIC_ANALOG_MBHC_DET_CTL_2, reg2);
- msm_anlg_cdc_compute_impedance(codec, impedance_l, impedance_r,
- zl, zr, high);
-
- dev_dbg(codec->dev, "%s: RL %d ohm, RR %d ohm\n", __func__, *zl, *zr);
- dev_dbg(codec->dev, "%s: Impedance detection completed\n", __func__);
-}
-
-static int msm_anlg_cdc_dig_register_notifier(void *handle,
- struct notifier_block *nblock,
- bool enable)
-{
- struct sdm660_cdc_priv *handle_cdc = handle;
-
- if (enable)
- return blocking_notifier_chain_register(&handle_cdc->notifier,
- nblock);
-
- return blocking_notifier_chain_unregister(&handle_cdc->notifier,
- nblock);
-}
-
-static int msm_anlg_cdc_mbhc_register_notifier(struct wcd_mbhc *wcd_mbhc,
- struct notifier_block *nblock,
- bool enable)
-{
- struct snd_soc_codec *codec = wcd_mbhc->codec;
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- if (enable)
- return blocking_notifier_chain_register(
- &sdm660_cdc->notifier_mbhc,
- nblock);
-
- return blocking_notifier_chain_unregister(&sdm660_cdc->notifier_mbhc,
- nblock);
-}
-
-static int msm_anlg_cdc_request_irq(struct snd_soc_codec *codec,
- int irq, irq_handler_t handler,
- const char *name, void *data)
-{
- return wcd9xxx_spmi_request_irq(irq, handler, name, data);
-}
-
-static int msm_anlg_cdc_free_irq(struct snd_soc_codec *codec,
- int irq, void *data)
-{
- return wcd9xxx_spmi_free_irq(irq, data);
-}
-
-static const struct wcd_mbhc_cb mbhc_cb = {
- .enable_mb_source = msm_anlg_cdc_enable_ext_mb_source,
- .trim_btn_reg = msm_anlg_cdc_trim_btn_reg,
- .compute_impedance = msm_anlg_cdc_mbhc_calc_impedance,
- .set_micbias_value = msm_anlg_cdc_set_micb_v,
- .set_auto_zeroing = msm_anlg_cdc_set_auto_zeroing,
- .get_hwdep_fw_cal = msm_anlg_cdc_get_hwdep_fw_cal,
- .set_cap_mode = msm_anlg_cdc_configure_cap,
- .register_notifier = msm_anlg_cdc_mbhc_register_notifier,
- .request_irq = msm_anlg_cdc_request_irq,
- .irq_control = wcd9xxx_spmi_irq_control,
- .free_irq = msm_anlg_cdc_free_irq,
- .clk_setup = msm_anlg_cdc_mbhc_clk_setup,
- .map_btn_code_to_num = msm_anlg_cdc_mbhc_map_btn_code_to_num,
- .lock_sleep = msm_anlg_cdc_spmi_lock_sleep,
- .micbias_enable_status = msm_anlg_cdc_micb_en_status,
- .mbhc_bias = msm_anlg_cdc_enable_master_bias,
- .mbhc_common_micb_ctrl = msm_anlg_cdc_mbhc_common_micb_ctrl,
- .micb_internal = msm_anlg_cdc_mbhc_internal_micbias_ctrl,
- .hph_pa_on_status = msm_anlg_cdc_mbhc_hph_pa_on_status,
- .set_btn_thr = msm_anlg_cdc_mbhc_program_btn_thr,
- .extn_use_mb = msm_anlg_cdc_use_mb,
-};
-
-static const uint32_t wcd_imped_val[] = {4, 8, 12, 13, 16,
- 20, 24, 28, 32,
- 36, 40, 44, 48};
-
-static void msm_anlg_cdc_dig_notifier_call(struct snd_soc_codec *codec,
- const enum dig_cdc_notify_event event)
-{
- struct sdm660_cdc_priv *sdm660_cdc = snd_soc_codec_get_drvdata(codec);
-
- pr_debug("%s: notifier call event %d\n", __func__, event);
- blocking_notifier_call_chain(&sdm660_cdc->notifier,
- event, NULL);
-}
-
-static void msm_anlg_cdc_notifier_call(struct snd_soc_codec *codec,
- const enum wcd_notify_event event)
-{
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- dev_dbg(codec->dev, "%s: notifier call event %d\n", __func__, event);
- blocking_notifier_call_chain(&sdm660_cdc->notifier_mbhc, event,
- &sdm660_cdc->mbhc);
-}
-
-static void msm_anlg_cdc_boost_on(struct snd_soc_codec *codec)
-{
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_PERPH_RESET_CTL3, 0x0F, 0x0F);
- snd_soc_write(codec, MSM89XX_PMIC_ANALOG_SEC_ACCESS, 0xA5);
- snd_soc_write(codec, MSM89XX_PMIC_ANALOG_PERPH_RESET_CTL3, 0x0F);
- snd_soc_write(codec, MSM89XX_PMIC_ANALOG_MASTER_BIAS_CTL, 0x30);
- if (get_codec_version(sdm660_cdc) < CAJON_2_0)
- snd_soc_write(codec, MSM89XX_PMIC_ANALOG_CURRENT_LIMIT, 0x82);
- else
- snd_soc_write(codec, MSM89XX_PMIC_ANALOG_CURRENT_LIMIT, 0xA2);
- snd_soc_update_bits(codec, MSM89XX_PMIC_ANALOG_SPKR_DRV_CTL,
- 0x69, 0x69);
- snd_soc_update_bits(codec, MSM89XX_PMIC_ANALOG_SPKR_DRV_DBG,
- 0x01, 0x01);
- snd_soc_update_bits(codec, MSM89XX_PMIC_ANALOG_SLOPE_COMP_IP_ZERO,
- 0x88, 0x88);
- snd_soc_update_bits(codec, MSM89XX_PMIC_ANALOG_SPKR_DAC_CTL,
- 0x03, 0x03);
- snd_soc_update_bits(codec, MSM89XX_PMIC_ANALOG_SPKR_OCP_CTL,
- 0xE1, 0xE1);
- if (get_codec_version(sdm660_cdc) < CAJON_2_0) {
- snd_soc_update_bits(codec, MSM89XX_PMIC_DIGITAL_CDC_DIG_CLK_CTL,
- 0x20, 0x20);
- /* Wait for 1ms after clock ctl enable */
- usleep_range(CODEC_DELAY_1_MS, CODEC_DELAY_1_1_MS);
- snd_soc_update_bits(codec, MSM89XX_PMIC_ANALOG_BOOST_EN_CTL,
- 0xDF, 0xDF);
- usleep_range(CODEC_DELAY_1_MS, CODEC_DELAY_1_1_MS);
- } else {
- snd_soc_update_bits(codec, MSM89XX_PMIC_ANALOG_BOOST_EN_CTL,
- 0x40, 0x00);
- snd_soc_update_bits(codec, MSM89XX_PMIC_DIGITAL_CDC_DIG_CLK_CTL,
- 0x20, 0x20);
- snd_soc_update_bits(codec, MSM89XX_PMIC_ANALOG_BOOST_EN_CTL,
- 0x80, 0x80);
- /* Wait for 500us after BOOST_EN to happen */
- usleep_range(500, 510);
- snd_soc_update_bits(codec, MSM89XX_PMIC_ANALOG_BOOST_EN_CTL,
- 0x40, 0x40);
- /* Wait for 500us after BOOST pulse_skip */
- usleep_range(500, 510);
- }
-}
-
-static void msm_anlg_cdc_boost_off(struct snd_soc_codec *codec)
-{
- snd_soc_update_bits(codec, MSM89XX_PMIC_ANALOG_BOOST_EN_CTL,
- 0xDF, 0x5F);
- snd_soc_update_bits(codec, MSM89XX_PMIC_DIGITAL_CDC_DIG_CLK_CTL,
- 0x20, 0x00);
-}
-
-static void msm_anlg_cdc_bypass_on(struct snd_soc_codec *codec)
-{
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- if (get_codec_version(sdm660_cdc) < CAJON_2_0) {
- snd_soc_write(codec,
- MSM89XX_PMIC_ANALOG_SEC_ACCESS,
- 0xA5);
- snd_soc_write(codec,
- MSM89XX_PMIC_ANALOG_PERPH_RESET_CTL3,
- 0x07);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_BYPASS_MODE,
- 0x02, 0x02);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_BYPASS_MODE,
- 0x01, 0x00);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_BYPASS_MODE,
- 0x40, 0x40);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_BYPASS_MODE,
- 0x80, 0x80);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_BOOST_EN_CTL,
- 0xDF, 0xDF);
- } else {
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_DIG_CLK_CTL,
- 0x20, 0x20);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_BYPASS_MODE,
- 0x20, 0x20);
- }
-}
-
-static void msm_anlg_cdc_bypass_off(struct snd_soc_codec *codec)
-{
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- if (get_codec_version(sdm660_cdc) < CAJON_2_0) {
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_BOOST_EN_CTL,
- 0x80, 0x00);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_BYPASS_MODE,
- 0x80, 0x00);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_BYPASS_MODE,
- 0x02, 0x00);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_BYPASS_MODE,
- 0x40, 0x00);
- } else {
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_BYPASS_MODE,
- 0x20, 0x00);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_DIG_CLK_CTL,
- 0x20, 0x00);
- }
-}
-
-static void msm_anlg_cdc_boost_mode_sequence(struct snd_soc_codec *codec,
- int flag)
-{
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- if (flag == EAR_PMU) {
- switch (sdm660_cdc->boost_option) {
- case BOOST_SWITCH:
- if (sdm660_cdc->ear_pa_boost_set) {
- msm_anlg_cdc_boost_off(codec);
- msm_anlg_cdc_bypass_on(codec);
- }
- break;
- case BOOST_ALWAYS:
- msm_anlg_cdc_boost_on(codec);
- break;
- case BYPASS_ALWAYS:
- msm_anlg_cdc_bypass_on(codec);
- break;
- case BOOST_ON_FOREVER:
- msm_anlg_cdc_boost_on(codec);
- break;
- default:
- dev_err(codec->dev,
- "%s: invalid boost option: %d\n", __func__,
- sdm660_cdc->boost_option);
- break;
- }
- } else if (flag == EAR_PMD) {
- switch (sdm660_cdc->boost_option) {
- case BOOST_SWITCH:
- if (sdm660_cdc->ear_pa_boost_set)
- msm_anlg_cdc_bypass_off(codec);
- break;
- case BOOST_ALWAYS:
- msm_anlg_cdc_boost_off(codec);
- /* 80ms for EAR boost to settle down */
- msleep(80);
- break;
- case BYPASS_ALWAYS:
- /* nothing to do as bypass on always */
- break;
- case BOOST_ON_FOREVER:
- /* nothing to do as boost on forever */
- break;
- default:
- dev_err(codec->dev,
- "%s: invalid boost option: %d\n", __func__,
- sdm660_cdc->boost_option);
- break;
- }
- } else if (flag == SPK_PMU) {
- switch (sdm660_cdc->boost_option) {
- case BOOST_SWITCH:
- if (sdm660_cdc->spk_boost_set) {
- msm_anlg_cdc_bypass_off(codec);
- msm_anlg_cdc_boost_on(codec);
- }
- break;
- case BOOST_ALWAYS:
- msm_anlg_cdc_boost_on(codec);
- break;
- case BYPASS_ALWAYS:
- msm_anlg_cdc_bypass_on(codec);
- break;
- case BOOST_ON_FOREVER:
- msm_anlg_cdc_boost_on(codec);
- break;
- default:
- dev_err(codec->dev,
- "%s: invalid boost option: %d\n", __func__,
- sdm660_cdc->boost_option);
- break;
- }
- } else if (flag == SPK_PMD) {
- switch (sdm660_cdc->boost_option) {
- case BOOST_SWITCH:
- if (sdm660_cdc->spk_boost_set) {
- msm_anlg_cdc_boost_off(codec);
- /*
- * Add 40 ms sleep for the spk
- * boost to settle down
- */
- msleep(40);
- }
- break;
- case BOOST_ALWAYS:
- msm_anlg_cdc_boost_off(codec);
- /*
- * Add 40 ms sleep for the spk
- * boost to settle down
- */
- msleep(40);
- break;
- case BYPASS_ALWAYS:
- /* nothing to do as bypass on always */
- break;
- case BOOST_ON_FOREVER:
- /* nothing to do as boost on forever */
- break;
- default:
- dev_err(codec->dev,
- "%s: invalid boost option: %d\n", __func__,
- sdm660_cdc->boost_option);
- break;
- }
- }
-}
-
-static int msm_anlg_cdc_dt_parse_vreg_info(struct device *dev,
- struct sdm660_cdc_regulator *vreg, const char *vreg_name,
- bool ondemand)
-{
- int len, ret = 0;
- const __be32 *prop;
- char prop_name[CODEC_DT_MAX_PROP_SIZE];
- struct device_node *regnode = NULL;
- u32 prop_val;
-
- snprintf(prop_name, CODEC_DT_MAX_PROP_SIZE, "%s-supply",
- vreg_name);
- regnode = of_parse_phandle(dev->of_node, prop_name, 0);
-
- if (!regnode) {
- dev_err(dev, "Looking up %s property in node %s failed\n",
- prop_name, dev->of_node->full_name);
- return -ENODEV;
- }
-
- dev_dbg(dev, "Looking up %s property in node %s\n",
- prop_name, dev->of_node->full_name);
-
- vreg->name = vreg_name;
- vreg->ondemand = ondemand;
-
- snprintf(prop_name, CODEC_DT_MAX_PROP_SIZE,
- "qcom,%s-voltage", vreg_name);
- prop = of_get_property(dev->of_node, prop_name, &len);
-
- if (!prop || (len != (2 * sizeof(__be32)))) {
- dev_err(dev, "%s %s property\n",
- prop ? "invalid format" : "no", prop_name);
- return -EINVAL;
- }
- vreg->min_uv = be32_to_cpup(&prop[0]);
- vreg->max_uv = be32_to_cpup(&prop[1]);
-
- snprintf(prop_name, CODEC_DT_MAX_PROP_SIZE,
- "qcom,%s-current", vreg_name);
-
- ret = of_property_read_u32(dev->of_node, prop_name, &prop_val);
- if (ret) {
- dev_err(dev, "Looking up %s property in node %s failed",
- prop_name, dev->of_node->full_name);
- return -EFAULT;
- }
- vreg->optimum_ua = prop_val;
-
- dev_dbg(dev, "%s: vol=[%d %d]uV, curr=[%d]uA, ond %d\n\n", vreg->name,
- vreg->min_uv, vreg->max_uv, vreg->optimum_ua, vreg->ondemand);
- return 0;
-}
-
-static void msm_anlg_cdc_dt_parse_boost_info(struct snd_soc_codec *codec)
-{
- struct sdm660_cdc_priv *sdm660_cdc_priv =
- snd_soc_codec_get_drvdata(codec);
- const char *prop_name = "qcom,cdc-boost-voltage";
- int boost_voltage, ret;
-
- ret = of_property_read_u32(codec->dev->of_node, prop_name,
- &boost_voltage);
- if (ret) {
- dev_dbg(codec->dev, "Looking up %s property in node %s failed\n",
- prop_name, codec->dev->of_node->full_name);
- boost_voltage = DEFAULT_BOOST_VOLTAGE;
- }
- if (boost_voltage < MIN_BOOST_VOLTAGE ||
- boost_voltage > MAX_BOOST_VOLTAGE) {
- dev_err(codec->dev,
- "Incorrect boost voltage. Reverting to default\n");
- boost_voltage = DEFAULT_BOOST_VOLTAGE;
- }
-
- sdm660_cdc_priv->boost_voltage =
- VOLTAGE_CONVERTER(boost_voltage, MIN_BOOST_VOLTAGE,
- BOOST_VOLTAGE_STEP);
- dev_dbg(codec->dev, "Boost voltage value is: %d\n",
- boost_voltage);
-}
-
-static void msm_anlg_cdc_dt_parse_micbias_info(struct device *dev,
- struct wcd_micbias_setting *micbias)
-{
- const char *prop_name = "qcom,cdc-micbias-cfilt-mv";
- int ret;
-
- ret = of_property_read_u32(dev->of_node, prop_name,
- &micbias->cfilt1_mv);
- if (ret) {
- dev_dbg(dev, "Looking up %s property in node %s failed",
- prop_name, dev->of_node->full_name);
- micbias->cfilt1_mv = MICBIAS_DEFAULT_VAL;
- }
-}
-
-static struct sdm660_cdc_pdata *msm_anlg_cdc_populate_dt_pdata(
- struct device *dev)
-{
- struct sdm660_cdc_pdata *pdata;
- int ret, static_cnt, ond_cnt, idx, i;
- const char *name = NULL;
- const char *static_prop_name = "qcom,cdc-static-supplies";
- const char *ond_prop_name = "qcom,cdc-on-demand-supplies";
-
- pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
- if (!pdata)
- return NULL;
-
- static_cnt = of_property_count_strings(dev->of_node, static_prop_name);
- if (static_cnt < 0) {
- dev_err(dev, "%s: Failed to get static supplies %d\n", __func__,
- static_cnt);
- ret = -EINVAL;
- goto err;
- }
-
- /* On-demand supply list is an optional property */
- ond_cnt = of_property_count_strings(dev->of_node, ond_prop_name);
- if (ond_cnt < 0)
- ond_cnt = 0;
-
- WARN_ON(static_cnt <= 0 || ond_cnt < 0);
- if ((static_cnt + ond_cnt) > ARRAY_SIZE(pdata->regulator)) {
- dev_err(dev, "%s: Num of supplies %u > max supported %zd\n",
- __func__, (static_cnt + ond_cnt),
- ARRAY_SIZE(pdata->regulator));
- ret = -EINVAL;
- goto err;
- }
-
- for (idx = 0; idx < static_cnt; idx++) {
- ret = of_property_read_string_index(dev->of_node,
- static_prop_name, idx,
- &name);
- if (ret) {
- dev_err(dev, "%s: of read string %s idx %d error %d\n",
- __func__, static_prop_name, idx, ret);
- goto err;
- }
-
- dev_dbg(dev, "%s: Found static cdc supply %s\n", __func__,
- name);
- ret = msm_anlg_cdc_dt_parse_vreg_info(dev,
- &pdata->regulator[idx],
- name, false);
- if (ret) {
- dev_err(dev, "%s:err parsing vreg for %s idx %d\n",
- __func__, name, idx);
- goto err;
- }
- }
-
- for (i = 0; i < ond_cnt; i++, idx++) {
- ret = of_property_read_string_index(dev->of_node, ond_prop_name,
- i, &name);
- if (ret) {
- dev_err(dev, "%s: err parsing on_demand for %s idx %d\n",
- __func__, ond_prop_name, i);
- goto err;
- }
-
- dev_dbg(dev, "%s: Found on-demand cdc supply %s\n", __func__,
- name);
- ret = msm_anlg_cdc_dt_parse_vreg_info(dev,
- &pdata->regulator[idx],
- name, true);
- if (ret) {
- dev_err(dev, "%s: err parsing vreg on_demand for %s idx %d\n",
- __func__, name, idx);
- goto err;
- }
- }
- msm_anlg_cdc_dt_parse_micbias_info(dev, &pdata->micbias);
-
- return pdata;
-err:
- devm_kfree(dev, pdata);
- dev_err(dev, "%s: Failed to populate DT data ret = %d\n",
- __func__, ret);
- return NULL;
-}
-
-static int msm_anlg_cdc_codec_enable_on_demand_supply(
- struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol, int event)
-{
- int ret = 0;
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
- struct on_demand_supply *supply;
-
- if (w->shift >= ON_DEMAND_SUPPLIES_MAX) {
- dev_err(codec->dev, "%s: error index > MAX Demand supplies",
- __func__);
- ret = -EINVAL;
- goto out;
- }
- dev_dbg(codec->dev, "%s: supply: %s event: %d ref: %d\n",
- __func__, on_demand_supply_name[w->shift], event,
- atomic_read(&sdm660_cdc->on_demand_list[w->shift].ref));
-
- supply = &sdm660_cdc->on_demand_list[w->shift];
- WARN_ONCE(!supply->supply, "%s isn't defined\n",
- on_demand_supply_name[w->shift]);
- if (!supply->supply) {
- dev_err(codec->dev, "%s: err supply not present ond for %d",
- __func__, w->shift);
- goto out;
- }
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- if (atomic_inc_return(&supply->ref) == 1) {
- ret = regulator_set_voltage(supply->supply,
- supply->min_uv,
- supply->max_uv);
- if (ret) {
- dev_err(codec->dev,
- "Setting regulator voltage(en) for micbias with err = %d\n",
- ret);
- goto out;
- }
- ret = regulator_set_load(supply->supply,
- supply->optimum_ua);
- if (ret < 0) {
- dev_err(codec->dev,
- "Setting regulator optimum mode(en) failed for micbias with err = %d\n",
- ret);
- goto out;
- }
- ret = regulator_enable(supply->supply);
- }
- if (ret)
- dev_err(codec->dev, "%s: Failed to enable %s\n",
- __func__,
- on_demand_supply_name[w->shift]);
- break;
- case SND_SOC_DAPM_POST_PMD:
- if (atomic_read(&supply->ref) == 0) {
- dev_dbg(codec->dev, "%s: %s supply has been disabled.\n",
- __func__, on_demand_supply_name[w->shift]);
- goto out;
- }
- if (atomic_dec_return(&supply->ref) == 0) {
- ret = regulator_disable(supply->supply);
- if (ret)
- dev_err(codec->dev, "%s: Failed to disable %s\n",
- __func__,
- on_demand_supply_name[w->shift]);
- ret = regulator_set_voltage(supply->supply,
- 0,
- supply->max_uv);
- if (ret) {
- dev_err(codec->dev,
- "Setting regulator voltage(dis) failed for micbias with err = %d\n",
- ret);
- goto out;
- }
- ret = regulator_set_load(supply->supply, 0);
- if (ret < 0)
- dev_err(codec->dev,
- "Setting regulator optimum mode(dis) failed for micbias with err = %d\n",
- ret);
- }
- break;
- default:
- break;
- }
-out:
- return ret;
-}
-
-static int msm_anlg_cdc_codec_enable_clock_block(struct snd_soc_codec *codec,
- int enable)
-{
- struct msm_asoc_mach_data *pdata = NULL;
-
- pdata = snd_soc_card_get_drvdata(codec->component.card);
- if (enable) {
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MASTER_BIAS_CTL, 0x30, 0x30);
- msm_anlg_cdc_dig_notifier_call(codec, DIG_CDC_EVENT_CLK_ON);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_RST_CTL, 0x80, 0x80);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_TOP_CLK_CTL, 0x0C, 0x0C);
- } else {
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_TOP_CLK_CTL, 0x0C, 0x00);
- }
- return 0;
-}
-
-static int msm_anlg_cdc_codec_enable_charge_pump(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- dev_dbg(codec->dev, "%s: event = %d\n", __func__, event);
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- msm_anlg_cdc_codec_enable_clock_block(codec, 1);
- if (!(strcmp(w->name, "EAR CP"))) {
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_DIG_CLK_CTL,
- 0x80, 0x80);
- msm_anlg_cdc_boost_mode_sequence(codec, EAR_PMU);
- } else if (get_codec_version(sdm660_cdc) >= DIANGU) {
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_DIG_CLK_CTL,
- 0x80, 0x80);
- } else {
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_DIG_CLK_CTL,
- 0xC0, 0xC0);
- }
- break;
- case SND_SOC_DAPM_POST_PMU:
- /* Wait for 1ms post powerup of chargepump */
- usleep_range(CODEC_DELAY_1_MS, CODEC_DELAY_1_1_MS);
- break;
- case SND_SOC_DAPM_POST_PMD:
- /* Wait for 1ms post powerdown of chargepump */
- usleep_range(CODEC_DELAY_1_MS, CODEC_DELAY_1_1_MS);
- if (!(strcmp(w->name, "EAR CP"))) {
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_DIG_CLK_CTL,
- 0x80, 0x00);
- if (sdm660_cdc->boost_option != BOOST_ALWAYS) {
- dev_dbg(codec->dev,
- "%s: boost_option:%d, tear down ear\n",
- __func__, sdm660_cdc->boost_option);
- msm_anlg_cdc_boost_mode_sequence(codec,
- EAR_PMD);
- }
- /*
- * Reset pa select bit from ear to hph after ear pa
- * is disabled and HPH DAC disable to reduce ear
- * turn off pop and avoid HPH pop in concurrency
- */
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_EAR_CTL, 0x80, 0x00);
- } else {
- if (get_codec_version(sdm660_cdc) < DIANGU)
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_DIG_CLK_CTL,
- 0x40, 0x00);
- if (sdm660_cdc->rx_bias_count == 0)
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_DIG_CLK_CTL,
- 0x80, 0x00);
- dev_dbg(codec->dev, "%s: rx_bias_count = %d\n",
- __func__, sdm660_cdc->rx_bias_count);
- }
- break;
- }
- return 0;
-}
-
-static int msm_anlg_cdc_ear_pa_boost_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- ucontrol->value.integer.value[0] =
- (sdm660_cdc->ear_pa_boost_set ? 1 : 0);
- dev_dbg(codec->dev, "%s: sdm660_cdc->ear_pa_boost_set = %d\n",
- __func__, sdm660_cdc->ear_pa_boost_set);
- return 0;
-}
-
-static int msm_anlg_cdc_ear_pa_boost_set(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
- __func__, ucontrol->value.integer.value[0]);
- sdm660_cdc->ear_pa_boost_set =
- (ucontrol->value.integer.value[0] ? true : false);
- return 0;
-}
-
-static int msm_anlg_cdc_pa_gain_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- u8 ear_pa_gain;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- if (get_codec_version(sdm660_cdc) >= DIANGU) {
- ear_pa_gain = snd_soc_read(codec,
- MSM89XX_PMIC_ANALOG_RX_COM_BIAS_DAC);
- ear_pa_gain = (ear_pa_gain >> 1) & 0x3;
-
- if (ear_pa_gain == 0x00) {
- ucontrol->value.integer.value[0] = 3;
- } else if (ear_pa_gain == 0x01) {
- ucontrol->value.integer.value[0] = 2;
- } else if (ear_pa_gain == 0x02) {
- ucontrol->value.integer.value[0] = 1;
- } else if (ear_pa_gain == 0x03) {
- ucontrol->value.integer.value[0] = 0;
- } else {
- dev_err(codec->dev,
- "%s: ERROR: Unsupported Ear Gain = 0x%x\n",
- __func__, ear_pa_gain);
- return -EINVAL;
- }
- } else {
- ear_pa_gain = snd_soc_read(codec,
- MSM89XX_PMIC_ANALOG_RX_EAR_CTL);
- ear_pa_gain = (ear_pa_gain >> 5) & 0x1;
- if (ear_pa_gain == 0x00) {
- ucontrol->value.integer.value[0] = 0;
- } else if (ear_pa_gain == 0x01) {
- ucontrol->value.integer.value[0] = 3;
- } else {
- dev_err(codec->dev,
- "%s: ERROR: Unsupported Ear Gain = 0x%x\n",
- __func__, ear_pa_gain);
- return -EINVAL;
- }
- }
- dev_dbg(codec->dev, "%s: ear_pa_gain = 0x%x\n", __func__, ear_pa_gain);
- return 0;
-}
-
-static int msm_anlg_cdc_pa_gain_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- u8 ear_pa_gain;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
- __func__, ucontrol->value.integer.value[0]);
-
- if (get_codec_version(sdm660_cdc) >= DIANGU) {
- switch (ucontrol->value.integer.value[0]) {
- case 0:
- ear_pa_gain = 0x06;
- break;
- case 1:
- ear_pa_gain = 0x04;
- break;
- case 2:
- ear_pa_gain = 0x02;
- break;
- case 3:
- ear_pa_gain = 0x00;
- break;
- default:
- return -EINVAL;
- }
- snd_soc_update_bits(codec, MSM89XX_PMIC_ANALOG_RX_COM_BIAS_DAC,
- 0x06, ear_pa_gain);
- } else {
- switch (ucontrol->value.integer.value[0]) {
- case 0:
- ear_pa_gain = 0x00;
- break;
- case 3:
- ear_pa_gain = 0x20;
- break;
- case 1:
- case 2:
- default:
- return -EINVAL;
- }
- snd_soc_update_bits(codec, MSM89XX_PMIC_ANALOG_RX_EAR_CTL,
- 0x20, ear_pa_gain);
- }
- return 0;
-}
-
-static int msm_anlg_cdc_hph_mode_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- if (sdm660_cdc->hph_mode == NORMAL_MODE) {
- ucontrol->value.integer.value[0] = 0;
- } else if (sdm660_cdc->hph_mode == HD2_MODE) {
- ucontrol->value.integer.value[0] = 1;
- } else {
- dev_err(codec->dev, "%s: ERROR: Default HPH Mode= %d\n",
- __func__, sdm660_cdc->hph_mode);
- }
-
- dev_dbg(codec->dev, "%s: sdm660_cdc->hph_mode = %d\n", __func__,
- sdm660_cdc->hph_mode);
- return 0;
-}
-
-static int msm_anlg_cdc_hph_mode_set(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
- __func__, ucontrol->value.integer.value[0]);
-
- switch (ucontrol->value.integer.value[0]) {
- case 0:
- sdm660_cdc->hph_mode = NORMAL_MODE;
- break;
- case 1:
- if (get_codec_version(sdm660_cdc) >= DIANGU)
- sdm660_cdc->hph_mode = HD2_MODE;
- break;
- default:
- sdm660_cdc->hph_mode = NORMAL_MODE;
- break;
- }
- dev_dbg(codec->dev, "%s: sdm660_cdc->hph_mode_set = %d\n",
- __func__, sdm660_cdc->hph_mode);
- return 0;
-}
-
-static int msm_anlg_cdc_boost_option_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- if (sdm660_cdc->boost_option == BOOST_SWITCH) {
- ucontrol->value.integer.value[0] = 0;
- } else if (sdm660_cdc->boost_option == BOOST_ALWAYS) {
- ucontrol->value.integer.value[0] = 1;
- } else if (sdm660_cdc->boost_option == BYPASS_ALWAYS) {
- ucontrol->value.integer.value[0] = 2;
- } else if (sdm660_cdc->boost_option == BOOST_ON_FOREVER) {
- ucontrol->value.integer.value[0] = 3;
- } else {
- dev_err(codec->dev, "%s: ERROR: Unsupported Boost option= %d\n",
- __func__, sdm660_cdc->boost_option);
- return -EINVAL;
- }
-
- dev_dbg(codec->dev, "%s: sdm660_cdc->boost_option = %d\n", __func__,
- sdm660_cdc->boost_option);
- return 0;
-}
-
-static int msm_anlg_cdc_boost_option_set(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
- __func__, ucontrol->value.integer.value[0]);
-
- switch (ucontrol->value.integer.value[0]) {
- case 0:
- sdm660_cdc->boost_option = BOOST_SWITCH;
- break;
- case 1:
- sdm660_cdc->boost_option = BOOST_ALWAYS;
- break;
- case 2:
- sdm660_cdc->boost_option = BYPASS_ALWAYS;
- msm_anlg_cdc_bypass_on(codec);
- break;
- case 3:
- sdm660_cdc->boost_option = BOOST_ON_FOREVER;
- msm_anlg_cdc_boost_on(codec);
- break;
- default:
- pr_err("%s: invalid boost option: %d\n", __func__,
- sdm660_cdc->boost_option);
- return -EINVAL;
- }
- dev_dbg(codec->dev, "%s: sdm660_cdc->boost_option_set = %d\n",
- __func__, sdm660_cdc->boost_option);
- return 0;
-}
-
-static int msm_anlg_cdc_spk_boost_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- if (sdm660_cdc->spk_boost_set == false) {
- ucontrol->value.integer.value[0] = 0;
- } else if (sdm660_cdc->spk_boost_set == true) {
- ucontrol->value.integer.value[0] = 1;
- } else {
- dev_err(codec->dev, "%s: ERROR: Unsupported Speaker Boost = %d\n",
- __func__, sdm660_cdc->spk_boost_set);
- return -EINVAL;
- }
-
- dev_dbg(codec->dev, "%s: sdm660_cdc->spk_boost_set = %d\n", __func__,
- sdm660_cdc->spk_boost_set);
- return 0;
-}
-
-static int msm_anlg_cdc_spk_boost_set(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
- __func__, ucontrol->value.integer.value[0]);
-
- switch (ucontrol->value.integer.value[0]) {
- case 0:
- sdm660_cdc->spk_boost_set = false;
- break;
- case 1:
- sdm660_cdc->spk_boost_set = true;
- break;
- default:
- return -EINVAL;
- }
- dev_dbg(codec->dev, "%s: sdm660_cdc->spk_boost_set = %d\n",
- __func__, sdm660_cdc->spk_boost_set);
- return 0;
-}
-
-static int msm_anlg_cdc_ext_spk_boost_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- if (sdm660_cdc->ext_spk_boost_set == false)
- ucontrol->value.integer.value[0] = 0;
- else
- ucontrol->value.integer.value[0] = 1;
-
- dev_dbg(codec->dev, "%s: sdm660_cdc->ext_spk_boost_set = %d\n",
- __func__, sdm660_cdc->ext_spk_boost_set);
- return 0;
-}
-
-static int msm_anlg_cdc_ext_spk_boost_set(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
- __func__, ucontrol->value.integer.value[0]);
-
- switch (ucontrol->value.integer.value[0]) {
- case 0:
- sdm660_cdc->ext_spk_boost_set = false;
- break;
- case 1:
- sdm660_cdc->ext_spk_boost_set = true;
- break;
- default:
- return -EINVAL;
- }
- dev_dbg(codec->dev, "%s: sdm660_cdc->spk_boost_set = %d\n",
- __func__, sdm660_cdc->spk_boost_set);
- return 0;
-}
-
-static const char * const msm_anlg_cdc_ear_pa_boost_ctrl_text[] = {
- "DISABLE", "ENABLE"};
-static const struct soc_enum msm_anlg_cdc_ear_pa_boost_ctl_enum[] = {
- SOC_ENUM_SINGLE_EXT(2, msm_anlg_cdc_ear_pa_boost_ctrl_text),
-};
-
-static const char * const msm_anlg_cdc_ear_pa_gain_text[] = {
- "POS_1P5_DB", "POS_3_DB", "POS_4P5_DB", "POS_6_DB"};
-static const struct soc_enum msm_anlg_cdc_ear_pa_gain_enum[] = {
- SOC_ENUM_SINGLE_EXT(4, msm_anlg_cdc_ear_pa_gain_text),
-};
-
-static const char * const msm_anlg_cdc_boost_option_ctrl_text[] = {
- "BOOST_SWITCH", "BOOST_ALWAYS", "BYPASS_ALWAYS",
- "BOOST_ON_FOREVER"};
-static const struct soc_enum msm_anlg_cdc_boost_option_ctl_enum[] = {
- SOC_ENUM_SINGLE_EXT(4, msm_anlg_cdc_boost_option_ctrl_text),
-};
-static const char * const msm_anlg_cdc_spk_boost_ctrl_text[] = {
- "DISABLE", "ENABLE"};
-static const struct soc_enum msm_anlg_cdc_spk_boost_ctl_enum[] = {
- SOC_ENUM_SINGLE_EXT(2, msm_anlg_cdc_spk_boost_ctrl_text),
-};
-
-static const char * const msm_anlg_cdc_ext_spk_boost_ctrl_text[] = {
- "DISABLE", "ENABLE"};
-static const struct soc_enum msm_anlg_cdc_ext_spk_boost_ctl_enum[] = {
- SOC_ENUM_SINGLE_EXT(2, msm_anlg_cdc_ext_spk_boost_ctrl_text),
-};
-
-static const char * const msm_anlg_cdc_hph_mode_ctrl_text[] = {
- "NORMAL", "HD2"};
-static const struct soc_enum msm_anlg_cdc_hph_mode_ctl_enum[] = {
- SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(msm_anlg_cdc_hph_mode_ctrl_text),
- msm_anlg_cdc_hph_mode_ctrl_text),
-};
-
-/*cut of frequency for high pass filter*/
-static const char * const cf_text[] = {
- "MIN_3DB_4Hz", "MIN_3DB_75Hz", "MIN_3DB_150Hz"
-};
-
-
-static const struct snd_kcontrol_new msm_anlg_cdc_snd_controls[] = {
-
- SOC_ENUM_EXT("RX HPH Mode", msm_anlg_cdc_hph_mode_ctl_enum[0],
- msm_anlg_cdc_hph_mode_get, msm_anlg_cdc_hph_mode_set),
-
- SOC_ENUM_EXT("Boost Option", msm_anlg_cdc_boost_option_ctl_enum[0],
- msm_anlg_cdc_boost_option_get, msm_anlg_cdc_boost_option_set),
-
- SOC_ENUM_EXT("EAR PA Boost", msm_anlg_cdc_ear_pa_boost_ctl_enum[0],
- msm_anlg_cdc_ear_pa_boost_get, msm_anlg_cdc_ear_pa_boost_set),
-
- SOC_ENUM_EXT("EAR PA Gain", msm_anlg_cdc_ear_pa_gain_enum[0],
- msm_anlg_cdc_pa_gain_get, msm_anlg_cdc_pa_gain_put),
-
- SOC_ENUM_EXT("Speaker Boost", msm_anlg_cdc_spk_boost_ctl_enum[0],
- msm_anlg_cdc_spk_boost_get, msm_anlg_cdc_spk_boost_set),
-
- SOC_ENUM_EXT("Ext Spk Boost", msm_anlg_cdc_ext_spk_boost_ctl_enum[0],
- msm_anlg_cdc_ext_spk_boost_get, msm_anlg_cdc_ext_spk_boost_set),
-
- SOC_SINGLE_TLV("ADC1 Volume", MSM89XX_PMIC_ANALOG_TX_1_EN, 3,
- 8, 0, analog_gain),
- SOC_SINGLE_TLV("ADC2 Volume", MSM89XX_PMIC_ANALOG_TX_2_EN, 3,
- 8, 0, analog_gain),
- SOC_SINGLE_TLV("ADC3 Volume", MSM89XX_PMIC_ANALOG_TX_3_EN, 3,
- 8, 0, analog_gain),
-
-
-};
-
-static int tombak_hph_impedance_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ret;
- uint32_t zl, zr;
- bool hphr;
- struct soc_multi_mixer_control *mc;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct sdm660_cdc_priv *priv = snd_soc_codec_get_drvdata(codec);
-
- mc = (struct soc_multi_mixer_control *)(kcontrol->private_value);
-
- hphr = mc->shift;
- ret = wcd_mbhc_get_impedance(&priv->mbhc, &zl, &zr);
- if (ret)
- dev_dbg(codec->dev, "%s: Failed to get mbhc imped", __func__);
- dev_dbg(codec->dev, "%s: zl %u, zr %u\n", __func__, zl, zr);
- ucontrol->value.integer.value[0] = hphr ? zr : zl;
-
- return 0;
-}
-
-static const struct snd_kcontrol_new impedance_detect_controls[] = {
- SOC_SINGLE_EXT("HPHL Impedance", 0, 0, UINT_MAX, 0,
- tombak_hph_impedance_get, NULL),
- SOC_SINGLE_EXT("HPHR Impedance", 0, 1, UINT_MAX, 0,
- tombak_hph_impedance_get, NULL),
-};
-
-static int tombak_get_hph_type(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct sdm660_cdc_priv *priv = snd_soc_codec_get_drvdata(codec);
- struct wcd_mbhc *mbhc;
-
- if (!priv) {
- dev_err(codec->dev,
- "%s: sdm660_cdc-wcd private data is NULL\n",
- __func__);
- return -EINVAL;
- }
-
- mbhc = &priv->mbhc;
- if (!mbhc) {
- dev_err(codec->dev, "%s: mbhc not initialized\n", __func__);
- return -EINVAL;
- }
-
- ucontrol->value.integer.value[0] = (u32) mbhc->hph_type;
- dev_dbg(codec->dev, "%s: hph_type = %u\n", __func__, mbhc->hph_type);
-
- return 0;
-}
-
-static const struct snd_kcontrol_new hph_type_detect_controls[] = {
- SOC_SINGLE_EXT("HPH Type", 0, 0, UINT_MAX, 0,
- tombak_get_hph_type, NULL),
-};
-
-static const char * const rdac2_mux_text[] = {
- "ZERO", "RX2", "RX1"
-};
-
-static const struct snd_kcontrol_new adc1_switch =
- SOC_DAPM_SINGLE("Switch", SND_SOC_NOPM, 0, 1, 0);
-
-static const struct soc_enum rdac2_mux_enum =
- SOC_ENUM_SINGLE(MSM89XX_PMIC_DIGITAL_CDC_CONN_HPHR_DAC_CTL,
- 0, 3, rdac2_mux_text);
-
-static const char * const adc2_mux_text[] = {
- "ZERO", "INP2", "INP3"
-};
-
-static const char * const ext_spk_text[] = {
- "Off", "On"
-};
-
-static const char * const wsa_spk_text[] = {
- "ZERO", "WSA"
-};
-
-static const struct soc_enum adc2_enum =
- SOC_ENUM_SINGLE(SND_SOC_NOPM, 0,
- ARRAY_SIZE(adc2_mux_text), adc2_mux_text);
-
-static const struct soc_enum ext_spk_enum =
- SOC_ENUM_SINGLE(SND_SOC_NOPM, 0,
- ARRAY_SIZE(ext_spk_text), ext_spk_text);
-
-static const struct soc_enum wsa_spk_enum =
- SOC_ENUM_SINGLE(SND_SOC_NOPM, 0,
- ARRAY_SIZE(wsa_spk_text), wsa_spk_text);
-
-
-
-static const struct snd_kcontrol_new ext_spk_mux =
- SOC_DAPM_ENUM("Ext Spk Switch Mux", ext_spk_enum);
-
-
-
-static const struct snd_kcontrol_new tx_adc2_mux =
- SOC_DAPM_ENUM("ADC2 MUX Mux", adc2_enum);
-
-
-static const struct snd_kcontrol_new rdac2_mux =
- SOC_DAPM_ENUM("RDAC2 MUX Mux", rdac2_mux_enum);
-
-static const char * const ear_text[] = {
- "ZERO", "Switch",
-};
-
-static const struct soc_enum ear_enum =
- SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, ARRAY_SIZE(ear_text), ear_text);
-
-static const struct snd_kcontrol_new ear_pa_mux[] = {
- SOC_DAPM_ENUM("EAR_S", ear_enum)
-};
-
-static const struct snd_kcontrol_new wsa_spk_mux[] = {
- SOC_DAPM_ENUM("WSA Spk Switch", wsa_spk_enum)
-};
-
-
-
-static const char * const hph_text[] = {
- "ZERO", "Switch",
-};
-
-static const struct soc_enum hph_enum =
- SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, ARRAY_SIZE(hph_text), hph_text);
-
-static const struct snd_kcontrol_new hphl_mux[] = {
- SOC_DAPM_ENUM("HPHL", hph_enum)
-};
-
-static const struct snd_kcontrol_new hphr_mux[] = {
- SOC_DAPM_ENUM("HPHR", hph_enum)
-};
-
-static const struct snd_kcontrol_new spkr_mux[] = {
- SOC_DAPM_ENUM("SPK", hph_enum)
-};
-
-static const char * const lo_text[] = {
- "ZERO", "Switch",
-};
-
-static const struct soc_enum lo_enum =
- SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, ARRAY_SIZE(hph_text), hph_text);
-
-static const struct snd_kcontrol_new lo_mux[] = {
- SOC_DAPM_ENUM("LINE_OUT", lo_enum)
-};
-
-static void msm_anlg_cdc_codec_enable_adc_block(struct snd_soc_codec *codec,
- int enable)
-{
- struct sdm660_cdc_priv *wcd8x16 = snd_soc_codec_get_drvdata(codec);
-
- dev_dbg(codec->dev, "%s %d\n", __func__, enable);
-
- if (enable) {
- wcd8x16->adc_count++;
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_ANA_CLK_CTL,
- 0x20, 0x20);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_DIG_CLK_CTL,
- 0x10, 0x10);
- } else {
- wcd8x16->adc_count--;
- if (!wcd8x16->adc_count) {
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_DIG_CLK_CTL,
- 0x10, 0x00);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_ANA_CLK_CTL,
- 0x20, 0x0);
- }
- }
-}
-
-static int msm_anlg_cdc_codec_enable_adc(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- u16 adc_reg;
- u8 init_bit_shift;
-
- dev_dbg(codec->dev, "%s %d\n", __func__, event);
-
- adc_reg = MSM89XX_PMIC_ANALOG_TX_1_2_TEST_CTL_2;
-
- if (w->reg == MSM89XX_PMIC_ANALOG_TX_1_EN)
- init_bit_shift = 5;
- else if ((w->reg == MSM89XX_PMIC_ANALOG_TX_2_EN) ||
- (w->reg == MSM89XX_PMIC_ANALOG_TX_3_EN))
- init_bit_shift = 4;
- else {
- dev_err(codec->dev, "%s: Error, invalid adc register\n",
- __func__);
- return -EINVAL;
- }
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- msm_anlg_cdc_codec_enable_adc_block(codec, 1);
- if (w->reg == MSM89XX_PMIC_ANALOG_TX_2_EN)
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MICB_1_CTL, 0x02, 0x02);
- /*
- * Add delay of 10 ms to give sufficient time for the voltage
- * to shoot up and settle so that the txfe init does not
- * happen when the input voltage is changing too much.
- */
- usleep_range(10000, 10010);
- snd_soc_update_bits(codec, adc_reg, 1 << init_bit_shift,
- 1 << init_bit_shift);
- if (w->reg == MSM89XX_PMIC_ANALOG_TX_1_EN)
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_CONN_TX1_CTL,
- 0x03, 0x00);
- else if ((w->reg == MSM89XX_PMIC_ANALOG_TX_2_EN) ||
- (w->reg == MSM89XX_PMIC_ANALOG_TX_3_EN))
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_CONN_TX2_CTL,
- 0x03, 0x00);
- /* Wait for 1ms to allow txfe settling time */
- usleep_range(CODEC_DELAY_1_MS, CODEC_DELAY_1_1_MS);
- break;
- case SND_SOC_DAPM_POST_PMU:
- /*
- * Add delay of 12 ms before deasserting the init
- * to reduce the tx pop
- */
- usleep_range(12000, 12010);
- snd_soc_update_bits(codec, adc_reg, 1 << init_bit_shift, 0x00);
- /* Wait for 1ms to allow txfe settling time post powerup */
- usleep_range(CODEC_DELAY_1_MS, CODEC_DELAY_1_1_MS);
- break;
- case SND_SOC_DAPM_POST_PMD:
- msm_anlg_cdc_codec_enable_adc_block(codec, 0);
- if (w->reg == MSM89XX_PMIC_ANALOG_TX_2_EN)
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MICB_1_CTL, 0x02, 0x00);
- if (w->reg == MSM89XX_PMIC_ANALOG_TX_1_EN)
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_CONN_TX1_CTL,
- 0x03, 0x02);
- else if ((w->reg == MSM89XX_PMIC_ANALOG_TX_2_EN) ||
- (w->reg == MSM89XX_PMIC_ANALOG_TX_3_EN))
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_CONN_TX2_CTL,
- 0x03, 0x02);
-
- break;
- }
- return 0;
-}
-
-static int msm_anlg_cdc_codec_enable_spk_pa(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- dev_dbg(codec->dev, "%s %d %s\n", __func__, event, w->name);
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_ANA_CLK_CTL, 0x10, 0x10);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_SPKR_PWRSTG_CTL, 0x01, 0x01);
- switch (sdm660_cdc->boost_option) {
- case BOOST_SWITCH:
- if (!sdm660_cdc->spk_boost_set)
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_SPKR_DAC_CTL,
- 0x10, 0x10);
- break;
- case BOOST_ALWAYS:
- case BOOST_ON_FOREVER:
- break;
- case BYPASS_ALWAYS:
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_SPKR_DAC_CTL,
- 0x10, 0x10);
- break;
- default:
- dev_err(codec->dev,
- "%s: invalid boost option: %d\n", __func__,
- sdm660_cdc->boost_option);
- break;
- }
- /* Wait for 1ms after SPK_DAC CTL setting */
- usleep_range(CODEC_DELAY_1_MS, CODEC_DELAY_1_1_MS);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_SPKR_PWRSTG_CTL, 0xE0, 0xE0);
- if (get_codec_version(sdm660_cdc) != TOMBAK_1_0)
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_EAR_CTL, 0x01, 0x01);
- break;
- case SND_SOC_DAPM_POST_PMU:
- /* Wait for 1ms after SPK_VBAT_LDO Enable */
- usleep_range(CODEC_DELAY_1_MS, CODEC_DELAY_1_1_MS);
- switch (sdm660_cdc->boost_option) {
- case BOOST_SWITCH:
- if (sdm660_cdc->spk_boost_set)
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_SPKR_DRV_CTL,
- 0xEF, 0xEF);
- else
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_SPKR_DAC_CTL,
- 0x10, 0x00);
- break;
- case BOOST_ALWAYS:
- case BOOST_ON_FOREVER:
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_SPKR_DRV_CTL,
- 0xEF, 0xEF);
- break;
- case BYPASS_ALWAYS:
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_SPKR_DAC_CTL, 0x10, 0x00);
- break;
- default:
- dev_err(codec->dev,
- "%s: invalid boost option: %d\n", __func__,
- sdm660_cdc->boost_option);
- break;
- }
- msm_anlg_cdc_dig_notifier_call(codec,
- DIG_CDC_EVENT_RX3_MUTE_OFF);
- snd_soc_update_bits(codec, w->reg, 0x80, 0x80);
- break;
- case SND_SOC_DAPM_PRE_PMD:
- msm_anlg_cdc_dig_notifier_call(codec,
- DIG_CDC_EVENT_RX3_MUTE_ON);
- /*
- * Add 1 ms sleep for the mute to take effect
- */
- usleep_range(CODEC_DELAY_1_MS, CODEC_DELAY_1_1_MS);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_SPKR_DAC_CTL, 0x10, 0x10);
- if (get_codec_version(sdm660_cdc) < CAJON_2_0)
- msm_anlg_cdc_boost_mode_sequence(codec, SPK_PMD);
- snd_soc_update_bits(codec, w->reg, 0x80, 0x00);
- switch (sdm660_cdc->boost_option) {
- case BOOST_SWITCH:
- if (sdm660_cdc->spk_boost_set)
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_SPKR_DRV_CTL,
- 0xEF, 0x69);
- break;
- case BOOST_ALWAYS:
- case BOOST_ON_FOREVER:
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_SPKR_DRV_CTL,
- 0xEF, 0x69);
- break;
- case BYPASS_ALWAYS:
- break;
- default:
- dev_err(codec->dev,
- "%s: invalid boost option: %d\n", __func__,
- sdm660_cdc->boost_option);
- break;
- }
- break;
- case SND_SOC_DAPM_POST_PMD:
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_SPKR_PWRSTG_CTL, 0xE0, 0x00);
- /* Wait for 1ms to allow setting time for spkr path disable */
- usleep_range(CODEC_DELAY_1_MS, CODEC_DELAY_1_1_MS);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_SPKR_PWRSTG_CTL, 0x01, 0x00);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_SPKR_DAC_CTL, 0x10, 0x00);
- if (get_codec_version(sdm660_cdc) != TOMBAK_1_0)
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_EAR_CTL, 0x01, 0x00);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_ANA_CLK_CTL, 0x10, 0x00);
- if (get_codec_version(sdm660_cdc) >= CAJON_2_0)
- msm_anlg_cdc_boost_mode_sequence(codec, SPK_PMD);
- break;
- }
- return 0;
-}
-
-static int msm_anlg_cdc_codec_enable_dig_clk(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
- struct msm_asoc_mach_data *pdata = NULL;
-
- pdata = snd_soc_card_get_drvdata(codec->component.card);
-
- dev_dbg(codec->dev, "%s event %d w->name %s\n", __func__,
- event, w->name);
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- msm_anlg_cdc_codec_enable_clock_block(codec, 1);
- snd_soc_update_bits(codec, w->reg, 0x80, 0x80);
- msm_anlg_cdc_boost_mode_sequence(codec, SPK_PMU);
- break;
- case SND_SOC_DAPM_POST_PMD:
- if (sdm660_cdc->rx_bias_count == 0)
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_DIG_CLK_CTL,
- 0x80, 0x00);
- }
- return 0;
-}
-
-
-
-static bool msm_anlg_cdc_use_mb(struct snd_soc_codec *codec)
-{
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- if (get_codec_version(sdm660_cdc) < CAJON)
- return true;
- else
- return false;
-}
-
-static void msm_anlg_cdc_set_auto_zeroing(struct snd_soc_codec *codec,
- bool enable)
-{
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- if (get_codec_version(sdm660_cdc) < CONGA) {
- if (enable)
- /*
- * Set autozeroing for special headset detection and
- * buttons to work.
- */
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MICB_2_EN,
- 0x18, 0x10);
- else
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MICB_2_EN,
- 0x18, 0x00);
-
- } else {
- dev_dbg(codec->dev,
- "%s: Auto Zeroing is not required from CONGA\n",
- __func__);
- }
-}
-
-static void msm_anlg_cdc_trim_btn_reg(struct snd_soc_codec *codec)
-{
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- if (get_codec_version(sdm660_cdc) == TOMBAK_1_0) {
- pr_debug("%s: This device needs to be trimmed\n", __func__);
- /*
- * Calculate the trim value for each device used
- * till is comes in production by hardware team
- */
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_SEC_ACCESS,
- 0xA5, 0xA5);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_TRIM_CTRL2,
- 0xFF, 0x30);
- } else {
- dev_dbg(codec->dev, "%s: This device is trimmed at ATE\n",
- __func__);
- }
-}
-
-static int msm_anlg_cdc_enable_ext_mb_source(struct wcd_mbhc *wcd_mbhc,
- bool turn_on)
-{
- int ret = 0;
- static int count;
- struct snd_soc_codec *codec = wcd_mbhc->codec;
- struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
-
- dev_dbg(codec->dev, "%s turn_on: %d count: %d\n", __func__, turn_on,
- count);
- if (turn_on) {
- if (!count) {
- ret = snd_soc_dapm_force_enable_pin(dapm,
- "MICBIAS_REGULATOR");
- snd_soc_dapm_sync(dapm);
- }
- count++;
- } else {
- if (count > 0)
- count--;
- if (!count) {
- ret = snd_soc_dapm_disable_pin(dapm,
- "MICBIAS_REGULATOR");
- snd_soc_dapm_sync(dapm);
- }
- }
-
- if (ret)
- dev_err(codec->dev, "%s: Failed to %s external micbias source\n",
- __func__, turn_on ? "enable" : "disabled");
- else
- dev_dbg(codec->dev, "%s: %s external micbias source\n",
- __func__, turn_on ? "Enabled" : "Disabled");
-
- return ret;
-}
-
-static int msm_anlg_cdc_codec_enable_micbias(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
- u16 micb_int_reg;
- char *internal1_text = "Internal1";
- char *internal2_text = "Internal2";
- char *internal3_text = "Internal3";
- char *external2_text = "External2";
- char *external_text = "External";
- bool micbias2;
-
- dev_dbg(codec->dev, "%s %d\n", __func__, event);
- switch (w->reg) {
- case MSM89XX_PMIC_ANALOG_MICB_1_EN:
- case MSM89XX_PMIC_ANALOG_MICB_2_EN:
- micb_int_reg = MSM89XX_PMIC_ANALOG_MICB_1_INT_RBIAS;
- break;
- default:
- dev_err(codec->dev,
- "%s: Error, invalid micbias register 0x%x\n",
- __func__, w->reg);
- return -EINVAL;
- }
-
- micbias2 = (snd_soc_read(codec, MSM89XX_PMIC_ANALOG_MICB_2_EN) & 0x80);
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- if (strnstr(w->name, internal1_text, strlen(w->name))) {
- if (get_codec_version(sdm660_cdc) >= CAJON)
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_TX_1_2_ATEST_CTL_2,
- 0x02, 0x02);
- snd_soc_update_bits(codec, micb_int_reg, 0x80, 0x80);
- } else if (strnstr(w->name, internal2_text, strlen(w->name))) {
- snd_soc_update_bits(codec, micb_int_reg, 0x10, 0x10);
- snd_soc_update_bits(codec, w->reg, 0x60, 0x00);
- } else if (strnstr(w->name, internal3_text, strlen(w->name))) {
- snd_soc_update_bits(codec, micb_int_reg, 0x2, 0x2);
- /*
- * update MSM89XX_PMIC_ANALOG_TX_1_2_ATEST_CTL_2
- * for external bias only, not for external2.
- */
- } else if (!strnstr(w->name, external2_text, strlen(w->name)) &&
- strnstr(w->name, external_text,
- strlen(w->name))) {
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_TX_1_2_ATEST_CTL_2,
- 0x02, 0x02);
- }
- if (!strnstr(w->name, external_text, strlen(w->name)))
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MICB_1_EN, 0x05, 0x04);
- if (w->reg == MSM89XX_PMIC_ANALOG_MICB_1_EN)
- msm_anlg_cdc_configure_cap(codec, true, micbias2);
-
- break;
- case SND_SOC_DAPM_POST_PMU:
- if (get_codec_version(sdm660_cdc) <= TOMBAK_2_0)
- /*
- * Wait for 20ms post micbias enable
- * for version < tombak 2.0.
- */
- usleep_range(20000, 20100);
- if (strnstr(w->name, internal1_text, strlen(w->name))) {
- snd_soc_update_bits(codec, micb_int_reg, 0x40, 0x40);
- } else if (strnstr(w->name, internal2_text, strlen(w->name))) {
- snd_soc_update_bits(codec, micb_int_reg, 0x08, 0x08);
- msm_anlg_cdc_notifier_call(codec,
- WCD_EVENT_POST_MICBIAS_2_ON);
- } else if (strnstr(w->name, internal3_text, 30)) {
- snd_soc_update_bits(codec, micb_int_reg, 0x01, 0x01);
- } else if (strnstr(w->name, external2_text, strlen(w->name))) {
- msm_anlg_cdc_notifier_call(codec,
- WCD_EVENT_POST_MICBIAS_2_ON);
- }
- break;
- case SND_SOC_DAPM_POST_PMD:
- if (strnstr(w->name, internal1_text, strlen(w->name))) {
- snd_soc_update_bits(codec, micb_int_reg, 0xC0, 0x40);
- } else if (strnstr(w->name, internal2_text, strlen(w->name))) {
- msm_anlg_cdc_notifier_call(codec,
- WCD_EVENT_POST_MICBIAS_2_OFF);
- } else if (strnstr(w->name, internal3_text, 30)) {
- snd_soc_update_bits(codec, micb_int_reg, 0x2, 0x0);
- } else if (strnstr(w->name, external2_text, strlen(w->name))) {
- /*
- * send micbias turn off event to mbhc driver and then
- * break, as no need to set MICB_1_EN register.
- */
- msm_anlg_cdc_notifier_call(codec,
- WCD_EVENT_POST_MICBIAS_2_OFF);
- break;
- }
- if (w->reg == MSM89XX_PMIC_ANALOG_MICB_1_EN)
- msm_anlg_cdc_configure_cap(codec, false, micbias2);
- break;
- }
- return 0;
-}
-
-static void set_compander_mode(void *handle, int val)
-{
- struct sdm660_cdc_priv *handle_cdc = handle;
- struct snd_soc_codec *codec = handle_cdc->codec;
-
- if (get_codec_version(handle_cdc) >= DIANGU) {
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_COM_BIAS_DAC,
- 0x08, val);
- };
-}
-
-static void update_clkdiv(void *handle, int val)
-{
- struct sdm660_cdc_priv *handle_cdc = handle;
- struct snd_soc_codec *codec = handle_cdc->codec;
-
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_TX_1_2_TXFE_CLKDIV,
- 0xFF, val);
-}
-
-static int get_cdc_version(void *handle)
-{
- struct sdm660_cdc_priv *sdm660_cdc = handle;
-
- return get_codec_version(sdm660_cdc);
-}
-
-static int sdm660_wcd_codec_enable_vdd_spkr(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
- int ret = 0;
-
- if (!sdm660_cdc->ext_spk_boost_set) {
- dev_dbg(codec->dev, "%s: ext_boost not supported/disabled\n",
- __func__);
- return 0;
- }
- dev_dbg(codec->dev, "%s: %s %d\n", __func__, w->name, event);
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- if (sdm660_cdc->spkdrv_reg) {
- ret = regulator_enable(sdm660_cdc->spkdrv_reg);
- if (ret)
- dev_err(codec->dev,
- "%s Failed to enable spkdrv reg %s\n",
- __func__, MSM89XX_VDD_SPKDRV_NAME);
- }
- break;
- case SND_SOC_DAPM_POST_PMD:
- if (sdm660_cdc->spkdrv_reg) {
- ret = regulator_disable(sdm660_cdc->spkdrv_reg);
- if (ret)
- dev_err(codec->dev,
- "%s: Failed to disable spkdrv_reg %s\n",
- __func__, MSM89XX_VDD_SPKDRV_NAME);
- }
- break;
- }
- return 0;
-}
-
-
-/* The register address is the same as other codec so it can use resmgr */
-static int msm_anlg_cdc_codec_enable_rx_bias(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- dev_dbg(codec->dev, "%s %d\n", __func__, event);
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- sdm660_cdc->rx_bias_count++;
- if (sdm660_cdc->rx_bias_count == 1) {
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_COM_BIAS_DAC,
- 0x80, 0x80);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_COM_BIAS_DAC,
- 0x01, 0x01);
- }
- break;
- case SND_SOC_DAPM_POST_PMD:
- sdm660_cdc->rx_bias_count--;
- if (sdm660_cdc->rx_bias_count == 0) {
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_COM_BIAS_DAC,
- 0x01, 0x00);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_COM_BIAS_DAC,
- 0x80, 0x00);
- }
- break;
- }
- dev_dbg(codec->dev, "%s rx_bias_count = %d\n",
- __func__, sdm660_cdc->rx_bias_count);
- return 0;
-}
-
-static uint32_t wcd_get_impedance_value(uint32_t imped)
-{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(wcd_imped_val) - 1; i++) {
- if (imped >= wcd_imped_val[i] &&
- imped < wcd_imped_val[i + 1])
- break;
- }
-
- pr_debug("%s: selected impedance value = %d\n",
- __func__, wcd_imped_val[i]);
- return wcd_imped_val[i];
-}
-
-static void wcd_imped_config(struct snd_soc_codec *codec,
- uint32_t imped, bool set_gain)
-{
- uint32_t value;
- int codec_version;
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- value = wcd_get_impedance_value(imped);
-
- if (value < wcd_imped_val[0]) {
- dev_dbg(codec->dev,
- "%s, detected impedance is less than 4 Ohm\n",
- __func__);
- return;
- }
-
- codec_version = get_codec_version(sdm660_cdc);
-
- if (set_gain) {
- switch (codec_version) {
- case TOMBAK_1_0:
- case TOMBAK_2_0:
- case CONGA:
- /*
- * For 32Ohm load and higher loads, Set 0x19E
- * bit 5 to 1 (POS_0_DB_DI). For loads lower
- * than 32Ohm (such as 16Ohm load), Set 0x19E
- * bit 5 to 0 (POS_M4P5_DB_DI)
- */
- if (value >= 32)
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_EAR_CTL,
- 0x20, 0x20);
- else
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_EAR_CTL,
- 0x20, 0x00);
- break;
- case CAJON:
- case CAJON_2_0:
- case DIANGU:
- case DRAX_CDC:
- if (value >= 13) {
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_EAR_CTL,
- 0x20, 0x20);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_NCP_VCTRL,
- 0x07, 0x07);
- } else {
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_EAR_CTL,
- 0x20, 0x00);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_NCP_VCTRL,
- 0x07, 0x04);
- }
- break;
- }
- } else {
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_EAR_CTL,
- 0x20, 0x00);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_NCP_VCTRL,
- 0x07, 0x04);
- }
-
- dev_dbg(codec->dev, "%s: Exit\n", __func__);
-}
-
-static int msm_anlg_cdc_hphl_dac_event(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- uint32_t impedl, impedr;
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
- int ret;
-
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
- ret = wcd_mbhc_get_impedance(&sdm660_cdc->mbhc,
- &impedl, &impedr);
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- if (get_codec_version(sdm660_cdc) > CAJON)
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_HPH_CNP_EN,
- 0x08, 0x08);
- if (get_codec_version(sdm660_cdc) == CAJON ||
- get_codec_version(sdm660_cdc) == CAJON_2_0) {
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_HPH_L_TEST,
- 0x80, 0x80);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_HPH_R_TEST,
- 0x80, 0x80);
- }
- if (get_codec_version(sdm660_cdc) > CAJON)
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_HPH_CNP_EN,
- 0x08, 0x00);
- if (sdm660_cdc->hph_mode == HD2_MODE)
- msm_anlg_cdc_dig_notifier_call(codec,
- DIG_CDC_EVENT_PRE_RX1_INT_ON);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_HPH_L_PA_DAC_CTL, 0x02, 0x02);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_DIG_CLK_CTL, 0x01, 0x01);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_ANA_CLK_CTL, 0x02, 0x02);
- if (!ret)
- wcd_imped_config(codec, impedl, true);
- else
- dev_dbg(codec->dev, "Failed to get mbhc impedance %d\n",
- ret);
- break;
- case SND_SOC_DAPM_POST_PMU:
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_HPH_L_PA_DAC_CTL, 0x02, 0x00);
- break;
- case SND_SOC_DAPM_POST_PMD:
- wcd_imped_config(codec, impedl, false);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_ANA_CLK_CTL, 0x02, 0x00);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_DIG_CLK_CTL, 0x01, 0x00);
- if (sdm660_cdc->hph_mode == HD2_MODE)
- msm_anlg_cdc_dig_notifier_call(codec,
- DIG_CDC_EVENT_POST_RX1_INT_OFF);
- break;
- }
- return 0;
-}
-
-static int msm_anlg_cdc_lo_dac_event(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
-
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_ANA_CLK_CTL, 0x10, 0x10);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_LO_EN_CTL, 0x20, 0x20);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_LO_EN_CTL, 0x80, 0x80);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_LO_DAC_CTL, 0x08, 0x08);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_LO_DAC_CTL, 0x40, 0x40);
- break;
- case SND_SOC_DAPM_POST_PMU:
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_LO_DAC_CTL, 0x80, 0x80);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_LO_DAC_CTL, 0x08, 0x00);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_LO_EN_CTL, 0x40, 0x40);
- break;
- case SND_SOC_DAPM_POST_PMD:
- /* Wait for 20ms before powerdown of lineout_dac */
- usleep_range(20000, 20100);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_LO_DAC_CTL, 0x80, 0x00);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_LO_DAC_CTL, 0x40, 0x00);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_LO_DAC_CTL, 0x08, 0x00);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_LO_EN_CTL, 0x80, 0x00);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_LO_EN_CTL, 0x40, 0x00);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_LO_EN_CTL, 0x20, 0x00);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_ANA_CLK_CTL, 0x10, 0x00);
- break;
- }
- return 0;
-}
-
-static int msm_anlg_cdc_hphr_dac_event(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- if (sdm660_cdc->hph_mode == HD2_MODE)
- msm_anlg_cdc_dig_notifier_call(codec,
- DIG_CDC_EVENT_PRE_RX2_INT_ON);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_HPH_R_PA_DAC_CTL, 0x02, 0x02);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_DIG_CLK_CTL, 0x02, 0x02);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_ANA_CLK_CTL, 0x01, 0x01);
- break;
- case SND_SOC_DAPM_POST_PMU:
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_HPH_R_PA_DAC_CTL, 0x02, 0x00);
- break;
- case SND_SOC_DAPM_POST_PMD:
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_ANA_CLK_CTL, 0x01, 0x00);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_DIG_CLK_CTL, 0x02, 0x00);
- if (sdm660_cdc->hph_mode == HD2_MODE)
- msm_anlg_cdc_dig_notifier_call(codec,
- DIG_CDC_EVENT_POST_RX2_INT_OFF);
- break;
- }
- return 0;
-}
-
-static int msm_anlg_cdc_hph_pa_event(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- dev_dbg(codec->dev, "%s: %s event = %d\n", __func__, w->name, event);
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- if (w->shift == 5)
- msm_anlg_cdc_notifier_call(codec,
- WCD_EVENT_PRE_HPHL_PA_ON);
- else if (w->shift == 4)
- msm_anlg_cdc_notifier_call(codec,
- WCD_EVENT_PRE_HPHR_PA_ON);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_NCP_FBCTRL, 0x20, 0x20);
- break;
-
- case SND_SOC_DAPM_POST_PMU:
- /* Wait for 7ms to allow setting time for HPH_PA Enable */
- usleep_range(7000, 7100);
- if (w->shift == 5) {
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_HPH_L_TEST, 0x04, 0x04);
- msm_anlg_cdc_dig_notifier_call(codec,
- DIG_CDC_EVENT_RX1_MUTE_OFF);
- } else if (w->shift == 4) {
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_HPH_R_TEST, 0x04, 0x04);
- msm_anlg_cdc_dig_notifier_call(codec,
- DIG_CDC_EVENT_RX2_MUTE_OFF);
- }
- break;
-
- case SND_SOC_DAPM_PRE_PMD:
- if (w->shift == 5) {
- msm_anlg_cdc_dig_notifier_call(codec,
- DIG_CDC_EVENT_RX1_MUTE_ON);
- /* Wait for 20ms after HPHL RX digital mute */
- msleep(20);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_HPH_L_TEST, 0x04, 0x00);
- msm_anlg_cdc_notifier_call(codec,
- WCD_EVENT_PRE_HPHL_PA_OFF);
- } else if (w->shift == 4) {
- msm_anlg_cdc_dig_notifier_call(codec,
- DIG_CDC_EVENT_RX2_MUTE_ON);
- /* Wait for 20ms after HPHR RX digital mute */
- msleep(20);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_HPH_R_TEST, 0x04, 0x00);
- msm_anlg_cdc_notifier_call(codec,
- WCD_EVENT_PRE_HPHR_PA_OFF);
- }
- if (get_codec_version(sdm660_cdc) >= CAJON) {
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_HPH_BIAS_CNP,
- 0xF0, 0x30);
- }
- break;
- case SND_SOC_DAPM_POST_PMD:
- if (w->shift == 5) {
- clear_bit(WCD_MBHC_HPHL_PA_OFF_ACK,
- &sdm660_cdc->mbhc.hph_pa_dac_state);
- msm_anlg_cdc_notifier_call(codec,
- WCD_EVENT_POST_HPHL_PA_OFF);
- } else if (w->shift == 4) {
- clear_bit(WCD_MBHC_HPHR_PA_OFF_ACK,
- &sdm660_cdc->mbhc.hph_pa_dac_state);
- msm_anlg_cdc_notifier_call(codec,
- WCD_EVENT_POST_HPHR_PA_OFF);
- }
- /* Wait for 15ms after HPH RX teardown */
- usleep_range(15000, 15100);
- break;
- }
- return 0;
-}
-
-static const struct snd_soc_dapm_route audio_map[] = {
- /* RDAC Connections */
- {"HPHR DAC", NULL, "RDAC2 MUX"},
- {"RDAC2 MUX", "RX1", "PDM_IN_RX1"},
- {"RDAC2 MUX", "RX2", "PDM_IN_RX2"},
-
- /* WSA */
- {"WSA_SPK OUT", NULL, "WSA Spk Switch"},
- {"WSA Spk Switch", "WSA", "EAR PA"},
-
- /* Earpiece (RX MIX1) */
- {"EAR", NULL, "EAR_S"},
- {"EAR_S", "Switch", "EAR PA"},
- {"EAR PA", NULL, "RX_BIAS"},
- {"EAR PA", NULL, "HPHL DAC"},
- {"EAR PA", NULL, "HPHR DAC"},
- {"EAR PA", NULL, "EAR CP"},
-
- /* Headset (RX MIX1 and RX MIX2) */
- {"HEADPHONE", NULL, "HPHL PA"},
- {"HEADPHONE", NULL, "HPHR PA"},
-
- {"Ext Spk", NULL, "Ext Spk Switch"},
- {"Ext Spk Switch", "On", "HPHL PA"},
- {"Ext Spk Switch", "On", "HPHR PA"},
-
- {"HPHL PA", NULL, "HPHL"},
- {"HPHR PA", NULL, "HPHR"},
- {"HPHL", "Switch", "HPHL DAC"},
- {"HPHR", "Switch", "HPHR DAC"},
- {"HPHL PA", NULL, "CP"},
- {"HPHL PA", NULL, "RX_BIAS"},
- {"HPHR PA", NULL, "CP"},
- {"HPHR PA", NULL, "RX_BIAS"},
- {"HPHL DAC", NULL, "PDM_IN_RX1"},
-
- {"SPK_OUT", NULL, "SPK PA"},
- {"SPK PA", NULL, "SPK_RX_BIAS"},
- {"SPK PA", NULL, "SPK"},
- {"SPK", "Switch", "SPK DAC"},
- {"SPK DAC", NULL, "PDM_IN_RX3"},
- {"SPK DAC", NULL, "VDD_SPKDRV"},
-
- /* lineout */
- {"LINEOUT", NULL, "LINEOUT PA"},
- {"LINEOUT PA", NULL, "SPK_RX_BIAS"},
- {"LINEOUT PA", NULL, "LINE_OUT"},
- {"LINE_OUT", "Switch", "LINEOUT DAC"},
- {"LINEOUT DAC", NULL, "PDM_IN_RX3"},
-
- /* lineout to WSA */
- {"WSA_SPK OUT", NULL, "LINEOUT PA"},
-
- {"PDM_IN_RX1", NULL, "RX1 CLK"},
- {"PDM_IN_RX2", NULL, "RX2 CLK"},
- {"PDM_IN_RX3", NULL, "RX3 CLK"},
-
- {"ADC1_OUT", NULL, "ADC1"},
- {"ADC2_OUT", NULL, "ADC2"},
- {"ADC3_OUT", NULL, "ADC3"},
-
- /* ADC Connections */
- {"ADC2", NULL, "ADC2 MUX"},
- {"ADC3", NULL, "ADC2 MUX"},
- {"ADC2 MUX", "INP2", "ADC2_INP2"},
- {"ADC2 MUX", "INP3", "ADC2_INP3"},
-
- {"ADC1", NULL, "ADC1_INP1"},
- {"ADC1_INP1", "Switch", "AMIC1"},
- {"ADC2_INP2", NULL, "AMIC2"},
- {"ADC2_INP3", NULL, "AMIC3"},
-
- {"MIC BIAS Internal1", NULL, "INT_LDO_H"},
- {"MIC BIAS Internal2", NULL, "INT_LDO_H"},
- {"MIC BIAS External", NULL, "INT_LDO_H"},
- {"MIC BIAS External2", NULL, "INT_LDO_H"},
- {"MIC BIAS Internal1", NULL, "MICBIAS_REGULATOR"},
- {"MIC BIAS Internal2", NULL, "MICBIAS_REGULATOR"},
- {"MIC BIAS External", NULL, "MICBIAS_REGULATOR"},
- {"MIC BIAS External2", NULL, "MICBIAS_REGULATOR"},
-};
-
-static int msm_anlg_cdc_startup(struct snd_pcm_substream *substream,
- struct snd_soc_dai *dai)
-{
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(dai->codec);
-
- dev_dbg(dai->codec->dev, "%s(): substream = %s stream = %d\n",
- __func__,
- substream->name, substream->stream);
- /*
- * If status_mask is BUS_DOWN it means SSR is not complete.
- * So return error.
- */
- if (test_bit(BUS_DOWN, &sdm660_cdc->status_mask)) {
- dev_err(dai->codec->dev, "Error, Device is not up post SSR\n");
- return -EINVAL;
- }
- return 0;
-}
-
-static void msm_anlg_cdc_shutdown(struct snd_pcm_substream *substream,
- struct snd_soc_dai *dai)
-{
- dev_dbg(dai->codec->dev,
- "%s(): substream = %s stream = %d\n", __func__,
- substream->name, substream->stream);
-}
-
-int msm_anlg_cdc_mclk_enable(struct snd_soc_codec *codec,
- int mclk_enable, bool dapm)
-{
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- dev_dbg(codec->dev, "%s: mclk_enable = %u, dapm = %d\n",
- __func__, mclk_enable, dapm);
- if (mclk_enable) {
- sdm660_cdc->int_mclk0_enabled = true;
- msm_anlg_cdc_codec_enable_clock_block(codec, 1);
- } else {
- if (!sdm660_cdc->int_mclk0_enabled) {
- dev_err(codec->dev, "Error, MCLK already diabled\n");
- return -EINVAL;
- }
- sdm660_cdc->int_mclk0_enabled = false;
- msm_anlg_cdc_codec_enable_clock_block(codec, 0);
- }
- return 0;
-}
-EXPORT_SYMBOL(msm_anlg_cdc_mclk_enable);
-
-static int msm_anlg_cdc_set_dai_sysclk(struct snd_soc_dai *dai,
- int clk_id, unsigned int freq, int dir)
-{
- dev_dbg(dai->codec->dev, "%s\n", __func__);
- return 0;
-}
-
-static int msm_anlg_cdc_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
-{
- dev_dbg(dai->codec->dev, "%s\n", __func__);
- return 0;
-}
-
-static int msm_anlg_cdc_set_channel_map(struct snd_soc_dai *dai,
- unsigned int tx_num, unsigned int *tx_slot,
- unsigned int rx_num, unsigned int *rx_slot)
-
-{
- dev_dbg(dai->codec->dev, "%s\n", __func__);
- return 0;
-}
-
-static int msm_anlg_cdc_get_channel_map(struct snd_soc_dai *dai,
- unsigned int *tx_num, unsigned int *tx_slot,
- unsigned int *rx_num, unsigned int *rx_slot)
-
-{
- dev_dbg(dai->codec->dev, "%s\n", __func__);
- return 0;
-}
-
-static struct snd_soc_dai_ops msm_anlg_cdc_dai_ops = {
- .startup = msm_anlg_cdc_startup,
- .shutdown = msm_anlg_cdc_shutdown,
- .set_sysclk = msm_anlg_cdc_set_dai_sysclk,
- .set_fmt = msm_anlg_cdc_set_dai_fmt,
- .set_channel_map = msm_anlg_cdc_set_channel_map,
- .get_channel_map = msm_anlg_cdc_get_channel_map,
-};
-
-static struct snd_soc_dai_driver msm_anlg_cdc_i2s_dai[] = {
- {
- .name = "msm_anlg_cdc_i2s_rx1",
- .id = AIF1_PB,
- .playback = {
- .stream_name = "PDM Playback",
- .rates = SDM660_CDC_RATES,
- .formats = SDM660_CDC_FORMATS,
- .rate_max = 192000,
- .rate_min = 8000,
- .channels_min = 1,
- .channels_max = 3,
- },
- .ops = &msm_anlg_cdc_dai_ops,
- },
- {
- .name = "msm_anlg_cdc_i2s_tx1",
- .id = AIF1_CAP,
- .capture = {
- .stream_name = "PDM Capture",
- .rates = SDM660_CDC_RATES,
- .formats = SDM660_CDC_FORMATS,
- .rate_max = 48000,
- .rate_min = 8000,
- .channels_min = 1,
- .channels_max = 4,
- },
- .ops = &msm_anlg_cdc_dai_ops,
- },
- {
- .name = "msm_anlg_cdc_i2s_tx2",
- .id = AIF3_SVA,
- .capture = {
- .stream_name = "RecordSVA",
- .rates = SDM660_CDC_RATES,
- .formats = SDM660_CDC_FORMATS,
- .rate_max = 48000,
- .rate_min = 8000,
- .channels_min = 1,
- .channels_max = 2,
- },
- .ops = &msm_anlg_cdc_dai_ops,
- },
- {
- .name = "msm_anlg_vifeedback",
- .id = AIF2_VIFEED,
- .capture = {
- .stream_name = "VIfeed",
- .rates = SDM660_CDC_RATES,
- .formats = SDM660_CDC_FORMATS,
- .rate_max = 48000,
- .rate_min = 48000,
- .channels_min = 2,
- .channels_max = 2,
- },
- .ops = &msm_anlg_cdc_dai_ops,
- },
-};
-
-
-static int msm_anlg_cdc_codec_enable_lo_pa(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
-
- dev_dbg(codec->dev, "%s: %d %s\n", __func__, event, w->name);
- switch (event) {
- case SND_SOC_DAPM_POST_PMU:
- msm_anlg_cdc_dig_notifier_call(codec,
- DIG_CDC_EVENT_RX3_MUTE_OFF);
- break;
- case SND_SOC_DAPM_POST_PMD:
- msm_anlg_cdc_dig_notifier_call(codec,
- DIG_CDC_EVENT_RX3_MUTE_ON);
- break;
- }
-
- return 0;
-}
-
-static int msm_anlg_cdc_codec_enable_spk_ext_pa(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- dev_dbg(codec->dev, "%s: %s event = %d\n", __func__, w->name, event);
- switch (event) {
- case SND_SOC_DAPM_POST_PMU:
- dev_dbg(codec->dev,
- "%s: enable external speaker PA\n", __func__);
- if (sdm660_cdc->codec_spk_ext_pa_cb)
- sdm660_cdc->codec_spk_ext_pa_cb(codec, 1);
- break;
- case SND_SOC_DAPM_PRE_PMD:
- dev_dbg(codec->dev,
- "%s: enable external speaker PA\n", __func__);
- if (sdm660_cdc->codec_spk_ext_pa_cb)
- sdm660_cdc->codec_spk_ext_pa_cb(codec, 0);
- break;
- }
- return 0;
-}
-
-static int msm_anlg_cdc_codec_enable_ear_pa(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- dev_dbg(codec->dev,
- "%s: Sleeping 20ms after select EAR PA\n",
- __func__);
- snd_soc_update_bits(codec, MSM89XX_PMIC_ANALOG_RX_EAR_CTL,
- 0x80, 0x80);
- if (get_codec_version(sdm660_cdc) < CONGA)
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_HPH_CNP_WG_TIME, 0xFF, 0x2A);
- if (get_codec_version(sdm660_cdc) >= DIANGU) {
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_COM_BIAS_DAC, 0x08, 0x00);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_HPH_L_TEST, 0x04, 0x04);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_HPH_R_TEST, 0x04, 0x04);
- }
- break;
- case SND_SOC_DAPM_POST_PMU:
- dev_dbg(codec->dev,
- "%s: Sleeping 20ms after enabling EAR PA\n",
- __func__);
- snd_soc_update_bits(codec, MSM89XX_PMIC_ANALOG_RX_EAR_CTL,
- 0x40, 0x40);
- /* Wait for 7ms after EAR PA enable */
- usleep_range(7000, 7100);
- msm_anlg_cdc_dig_notifier_call(codec,
- DIG_CDC_EVENT_RX1_MUTE_OFF);
- break;
- case SND_SOC_DAPM_PRE_PMD:
- msm_anlg_cdc_dig_notifier_call(codec,
- DIG_CDC_EVENT_RX1_MUTE_ON);
- /* Wait for 20ms for RX digital mute to take effect */
- msleep(20);
- if (sdm660_cdc->boost_option == BOOST_ALWAYS) {
- dev_dbg(codec->dev,
- "%s: boost_option:%d, tear down ear\n",
- __func__, sdm660_cdc->boost_option);
- msm_anlg_cdc_boost_mode_sequence(codec, EAR_PMD);
- }
- if (get_codec_version(sdm660_cdc) >= DIANGU) {
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_HPH_L_TEST, 0x04, 0x0);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_HPH_R_TEST, 0x04, 0x0);
- }
- break;
- case SND_SOC_DAPM_POST_PMD:
- dev_dbg(codec->dev,
- "%s: Sleeping 7ms after disabling EAR PA\n",
- __func__);
- snd_soc_update_bits(codec, MSM89XX_PMIC_ANALOG_RX_EAR_CTL,
- 0x40, 0x00);
- /* Wait for 7ms after EAR PA teardown */
- usleep_range(7000, 7100);
- if (get_codec_version(sdm660_cdc) < CONGA)
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_HPH_CNP_WG_TIME, 0xFF, 0x16);
- if (get_codec_version(sdm660_cdc) >= DIANGU)
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_COM_BIAS_DAC, 0x08, 0x08);
- break;
- }
- return 0;
-}
-
-static const struct snd_soc_dapm_widget msm_anlg_cdc_dapm_widgets[] = {
- SND_SOC_DAPM_PGA_E("EAR PA", SND_SOC_NOPM,
- 0, 0, NULL, 0, msm_anlg_cdc_codec_enable_ear_pa,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_PGA_E("HPHL PA", MSM89XX_PMIC_ANALOG_RX_HPH_CNP_EN,
- 5, 0, NULL, 0,
- msm_anlg_cdc_hph_pa_event, SND_SOC_DAPM_PRE_PMU |
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD |
- SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_PGA_E("HPHR PA", MSM89XX_PMIC_ANALOG_RX_HPH_CNP_EN,
- 4, 0, NULL, 0,
- msm_anlg_cdc_hph_pa_event, SND_SOC_DAPM_PRE_PMU |
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD |
- SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_PGA_E("SPK PA", SND_SOC_NOPM,
- 0, 0, NULL, 0, msm_anlg_cdc_codec_enable_spk_pa,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_PGA_E("LINEOUT PA", MSM89XX_PMIC_ANALOG_RX_LO_EN_CTL,
- 5, 0, NULL, 0, msm_anlg_cdc_codec_enable_lo_pa,
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_MUX("EAR_S", SND_SOC_NOPM, 0, 0, ear_pa_mux),
- SND_SOC_DAPM_MUX("SPK", SND_SOC_NOPM, 0, 0, spkr_mux),
- SND_SOC_DAPM_MUX("HPHL", SND_SOC_NOPM, 0, 0, hphl_mux),
- SND_SOC_DAPM_MUX("HPHR", SND_SOC_NOPM, 0, 0, hphr_mux),
- SND_SOC_DAPM_MUX("RDAC2 MUX", SND_SOC_NOPM, 0, 0, &rdac2_mux),
- SND_SOC_DAPM_MUX("WSA Spk Switch", SND_SOC_NOPM, 0, 0, wsa_spk_mux),
- SND_SOC_DAPM_MUX("Ext Spk Switch", SND_SOC_NOPM, 0, 0, &ext_spk_mux),
- SND_SOC_DAPM_MUX("LINE_OUT", SND_SOC_NOPM, 0, 0, lo_mux),
- SND_SOC_DAPM_MUX("ADC2 MUX", SND_SOC_NOPM, 0, 0, &tx_adc2_mux),
-
- SND_SOC_DAPM_MIXER_E("HPHL DAC",
- MSM89XX_PMIC_ANALOG_RX_HPH_L_PA_DAC_CTL, 3, 0, NULL,
- 0, msm_anlg_cdc_hphl_dac_event,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MIXER_E("HPHR DAC",
- MSM89XX_PMIC_ANALOG_RX_HPH_R_PA_DAC_CTL, 3, 0, NULL,
- 0, msm_anlg_cdc_hphr_dac_event,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MIXER("ADC2", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("ADC3", SND_SOC_NOPM, 0, 0, NULL, 0),
-
- SND_SOC_DAPM_DAC("SPK DAC", NULL, MSM89XX_PMIC_ANALOG_SPKR_DAC_CTL,
- 7, 0),
- SND_SOC_DAPM_DAC_E("LINEOUT DAC", NULL,
- SND_SOC_NOPM, 0, 0, msm_anlg_cdc_lo_dac_event,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_SPK("Ext Spk", msm_anlg_cdc_codec_enable_spk_ext_pa),
-
- SND_SOC_DAPM_SWITCH("ADC1_INP1", SND_SOC_NOPM, 0, 0,
- &adc1_switch),
- SND_SOC_DAPM_SUPPLY("RX1 CLK", MSM89XX_PMIC_DIGITAL_CDC_DIG_CLK_CTL,
- 0, 0, NULL, 0),
- SND_SOC_DAPM_SUPPLY("RX2 CLK", MSM89XX_PMIC_DIGITAL_CDC_DIG_CLK_CTL,
- 1, 0, NULL, 0),
- SND_SOC_DAPM_SUPPLY("RX3 CLK", MSM89XX_PMIC_DIGITAL_CDC_DIG_CLK_CTL,
- 2, 0, msm_anlg_cdc_codec_enable_dig_clk,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_SUPPLY("CP", MSM89XX_PMIC_ANALOG_NCP_EN, 0, 0,
- msm_anlg_cdc_codec_enable_charge_pump,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_SUPPLY("EAR CP", MSM89XX_PMIC_ANALOG_NCP_EN, 4, 0,
- msm_anlg_cdc_codec_enable_charge_pump,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_SUPPLY_S("RX_BIAS", 1, SND_SOC_NOPM,
- 0, 0, msm_anlg_cdc_codec_enable_rx_bias,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_SUPPLY_S("SPK_RX_BIAS", 1, SND_SOC_NOPM, 0, 0,
- msm_anlg_cdc_codec_enable_rx_bias, SND_SOC_DAPM_PRE_PMU |
- SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_SUPPLY("VDD_SPKDRV", SND_SOC_NOPM, 0, 0,
- sdm660_wcd_codec_enable_vdd_spkr,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_SUPPLY("INT_LDO_H", SND_SOC_NOPM, 1, 0, NULL, 0),
- SND_SOC_DAPM_SUPPLY("MICBIAS_REGULATOR", SND_SOC_NOPM,
- ON_DEMAND_MICBIAS, 0,
- msm_anlg_cdc_codec_enable_on_demand_supply,
- SND_SOC_DAPM_PRE_PMU |
- SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_MICBIAS_E("MIC BIAS Internal1",
- MSM89XX_PMIC_ANALOG_MICB_1_EN, 7, 0,
- msm_anlg_cdc_codec_enable_micbias, SND_SOC_DAPM_PRE_PMU |
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MICBIAS_E("MIC BIAS Internal2",
- MSM89XX_PMIC_ANALOG_MICB_2_EN, 7, 0,
- msm_anlg_cdc_codec_enable_micbias, SND_SOC_DAPM_PRE_PMU |
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MICBIAS_E("MIC BIAS Internal3",
- MSM89XX_PMIC_ANALOG_MICB_1_EN, 7, 0,
- msm_anlg_cdc_codec_enable_micbias, SND_SOC_DAPM_PRE_PMU |
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_ADC_E("ADC1", NULL, MSM89XX_PMIC_ANALOG_TX_1_EN, 7, 0,
- msm_anlg_cdc_codec_enable_adc, SND_SOC_DAPM_PRE_PMU |
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_ADC_E("ADC2_INP2",
- NULL, MSM89XX_PMIC_ANALOG_TX_2_EN, 7, 0,
- msm_anlg_cdc_codec_enable_adc, SND_SOC_DAPM_PRE_PMU |
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_ADC_E("ADC2_INP3",
- NULL, MSM89XX_PMIC_ANALOG_TX_3_EN, 7, 0,
- msm_anlg_cdc_codec_enable_adc, SND_SOC_DAPM_PRE_PMU |
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_MICBIAS_E("MIC BIAS External",
- MSM89XX_PMIC_ANALOG_MICB_1_EN, 7, 0,
- msm_anlg_cdc_codec_enable_micbias, SND_SOC_DAPM_PRE_PMU |
- SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MICBIAS_E("MIC BIAS External2",
- MSM89XX_PMIC_ANALOG_MICB_2_EN, 7, 0,
- msm_anlg_cdc_codec_enable_micbias, SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_INPUT("AMIC1"),
- SND_SOC_DAPM_INPUT("AMIC2"),
- SND_SOC_DAPM_INPUT("AMIC3"),
- SND_SOC_DAPM_AIF_IN("PDM_IN_RX1", "PDM Playback",
- 0, SND_SOC_NOPM, 0, 0),
- SND_SOC_DAPM_AIF_IN("PDM_IN_RX2", "PDM Playback",
- 0, SND_SOC_NOPM, 0, 0),
- SND_SOC_DAPM_AIF_IN("PDM_IN_RX3", "PDM Playback",
- 0, SND_SOC_NOPM, 0, 0),
-
- SND_SOC_DAPM_OUTPUT("EAR"),
- SND_SOC_DAPM_OUTPUT("WSA_SPK OUT"),
- SND_SOC_DAPM_OUTPUT("HEADPHONE"),
- SND_SOC_DAPM_OUTPUT("SPK_OUT"),
- SND_SOC_DAPM_OUTPUT("LINEOUT"),
- SND_SOC_DAPM_AIF_OUT("ADC1_OUT", "PDM Capture",
- 0, SND_SOC_NOPM, 0, 0),
- SND_SOC_DAPM_AIF_OUT("ADC2_OUT", "PDM Capture",
- 0, SND_SOC_NOPM, 0, 0),
- SND_SOC_DAPM_AIF_OUT("ADC3_OUT", "PDM Capture",
- 0, SND_SOC_NOPM, 0, 0),
-};
-
-static const struct sdm660_cdc_reg_mask_val msm_anlg_cdc_reg_defaults[] = {
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_SPKR_DAC_CTL, 0x03),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_CURRENT_LIMIT, 0x82),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_SPKR_OCP_CTL, 0xE1),
-};
-
-static const struct sdm660_cdc_reg_mask_val
- msm_anlg_cdc_reg_defaults_2_0[] = {
- MSM89XX_REG_VAL(MSM89XX_PMIC_DIGITAL_SEC_ACCESS, 0xA5),
- MSM89XX_REG_VAL(MSM89XX_PMIC_DIGITAL_PERPH_RESET_CTL3, 0x0F),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_TX_1_2_OPAMP_BIAS, 0x4F),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_NCP_FBCTRL, 0x28),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_SPKR_DRV_CTL, 0x69),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_SPKR_DRV_DBG, 0x01),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_BOOST_EN_CTL, 0x5F),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_SLOPE_COMP_IP_ZERO, 0x88),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_SEC_ACCESS, 0xA5),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_PERPH_RESET_CTL3, 0x0F),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_CURRENT_LIMIT, 0x82),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_SPKR_DAC_CTL, 0x03),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_SPKR_OCP_CTL, 0xE1),
- MSM89XX_REG_VAL(MSM89XX_PMIC_DIGITAL_CDC_RST_CTL, 0x80),
-};
-
-static const struct sdm660_cdc_reg_mask_val conga_wcd_reg_defaults[] = {
- MSM89XX_REG_VAL(MSM89XX_PMIC_DIGITAL_SEC_ACCESS, 0xA5),
- MSM89XX_REG_VAL(MSM89XX_PMIC_DIGITAL_PERPH_RESET_CTL3, 0x0F),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_SEC_ACCESS, 0xA5),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_PERPH_RESET_CTL3, 0x0F),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_TX_1_2_OPAMP_BIAS, 0x4C),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_NCP_FBCTRL, 0x28),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_SPKR_DRV_CTL, 0x69),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_SPKR_DRV_DBG, 0x01),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_PERPH_SUBTYPE, 0x0A),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_SPKR_DAC_CTL, 0x03),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_SPKR_OCP_CTL, 0xE1),
- MSM89XX_REG_VAL(MSM89XX_PMIC_DIGITAL_CDC_RST_CTL, 0x80),
-};
-
-static const struct sdm660_cdc_reg_mask_val cajon_wcd_reg_defaults[] = {
- MSM89XX_REG_VAL(MSM89XX_PMIC_DIGITAL_SEC_ACCESS, 0xA5),
- MSM89XX_REG_VAL(MSM89XX_PMIC_DIGITAL_PERPH_RESET_CTL3, 0x0F),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_SEC_ACCESS, 0xA5),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_PERPH_RESET_CTL3, 0x0F),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_TX_1_2_OPAMP_BIAS, 0x4C),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_CURRENT_LIMIT, 0x82),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_NCP_FBCTRL, 0xA8),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_NCP_VCTRL, 0xA4),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_SPKR_ANA_BIAS_SET, 0x41),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_SPKR_DRV_CTL, 0x69),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_SPKR_DRV_DBG, 0x01),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_SPKR_OCP_CTL, 0xE1),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_SPKR_DAC_CTL, 0x03),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_RX_HPH_BIAS_PA, 0xFA),
- MSM89XX_REG_VAL(MSM89XX_PMIC_DIGITAL_CDC_RST_CTL, 0x80),
-};
-
-static const struct sdm660_cdc_reg_mask_val cajon2p0_wcd_reg_defaults[] = {
- MSM89XX_REG_VAL(MSM89XX_PMIC_DIGITAL_SEC_ACCESS, 0xA5),
- MSM89XX_REG_VAL(MSM89XX_PMIC_DIGITAL_PERPH_RESET_CTL3, 0x0F),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_SEC_ACCESS, 0xA5),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_PERPH_RESET_CTL3, 0x0F),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_TX_1_2_OPAMP_BIAS, 0x4C),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_CURRENT_LIMIT, 0xA2),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_NCP_FBCTRL, 0xA8),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_NCP_VCTRL, 0xA4),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_SPKR_ANA_BIAS_SET, 0x41),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_SPKR_DRV_CTL, 0x69),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_SPKR_DRV_DBG, 0x01),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_SPKR_OCP_CTL, 0xE1),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_SPKR_DAC_CTL, 0x03),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_RX_EAR_STATUS, 0x10),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_BYPASS_MODE, 0x18),
- MSM89XX_REG_VAL(MSM89XX_PMIC_ANALOG_RX_HPH_BIAS_PA, 0xFA),
- MSM89XX_REG_VAL(MSM89XX_PMIC_DIGITAL_CDC_RST_CTL, 0x80),
-};
-
-static void msm_anlg_cdc_update_reg_defaults(struct snd_soc_codec *codec)
-{
- u32 i, version;
- struct sdm660_cdc_priv *sdm660_cdc =
- snd_soc_codec_get_drvdata(codec);
-
- version = get_codec_version(sdm660_cdc);
- if (version == TOMBAK_1_0) {
- for (i = 0; i < ARRAY_SIZE(msm_anlg_cdc_reg_defaults); i++)
- snd_soc_write(codec, msm_anlg_cdc_reg_defaults[i].reg,
- msm_anlg_cdc_reg_defaults[i].val);
- } else if (version == TOMBAK_2_0) {
- for (i = 0; i < ARRAY_SIZE(msm_anlg_cdc_reg_defaults_2_0); i++)
- snd_soc_write(codec,
- msm_anlg_cdc_reg_defaults_2_0[i].reg,
- msm_anlg_cdc_reg_defaults_2_0[i].val);
- } else if (version == CONGA) {
- for (i = 0; i < ARRAY_SIZE(conga_wcd_reg_defaults); i++)
- snd_soc_write(codec,
- conga_wcd_reg_defaults[i].reg,
- conga_wcd_reg_defaults[i].val);
- } else if (version == CAJON) {
- for (i = 0; i < ARRAY_SIZE(cajon_wcd_reg_defaults); i++)
- snd_soc_write(codec,
- cajon_wcd_reg_defaults[i].reg,
- cajon_wcd_reg_defaults[i].val);
- } else if (version == CAJON_2_0 || version == DIANGU
- || version == DRAX_CDC) {
- for (i = 0; i < ARRAY_SIZE(cajon2p0_wcd_reg_defaults); i++)
- snd_soc_write(codec,
- cajon2p0_wcd_reg_defaults[i].reg,
- cajon2p0_wcd_reg_defaults[i].val);
- }
-}
-
-static const struct sdm660_cdc_reg_mask_val
- msm_anlg_cdc_codec_reg_init_val[] = {
-
- /* Initialize current threshold to 350MA
- * number of wait and run cycles to 4096
- */
- {MSM89XX_PMIC_ANALOG_RX_COM_OCP_CTL, 0xFF, 0x12},
- {MSM89XX_PMIC_ANALOG_RX_COM_OCP_COUNT, 0xFF, 0xFF},
-};
-
-static void msm_anlg_cdc_codec_init_reg(struct snd_soc_codec *codec)
-{
- u32 i;
-
- for (i = 0; i < ARRAY_SIZE(msm_anlg_cdc_codec_reg_init_val); i++)
- snd_soc_update_bits(codec,
- msm_anlg_cdc_codec_reg_init_val[i].reg,
- msm_anlg_cdc_codec_reg_init_val[i].mask,
- msm_anlg_cdc_codec_reg_init_val[i].val);
-}
-
-static int msm_anlg_cdc_bringup(struct snd_soc_codec *codec)
-{
- snd_soc_write(codec,
- MSM89XX_PMIC_DIGITAL_SEC_ACCESS,
- 0xA5);
- snd_soc_write(codec, MSM89XX_PMIC_DIGITAL_PERPH_RESET_CTL4, 0x01);
- snd_soc_write(codec,
- MSM89XX_PMIC_ANALOG_SEC_ACCESS,
- 0xA5);
- snd_soc_write(codec, MSM89XX_PMIC_ANALOG_PERPH_RESET_CTL4, 0x01);
- snd_soc_write(codec,
- MSM89XX_PMIC_DIGITAL_SEC_ACCESS,
- 0xA5);
- snd_soc_write(codec, MSM89XX_PMIC_DIGITAL_PERPH_RESET_CTL4, 0x00);
- snd_soc_write(codec,
- MSM89XX_PMIC_ANALOG_SEC_ACCESS,
- 0xA5);
- snd_soc_write(codec, MSM89XX_PMIC_ANALOG_PERPH_RESET_CTL4, 0x00);
-
- return 0;
-}
-
-static struct regulator *msm_anlg_cdc_find_regulator(
- const struct sdm660_cdc_priv *sdm660_cdc,
- const char *name)
-{
- int i;
-
- for (i = 0; i < sdm660_cdc->num_of_supplies; i++) {
- if (sdm660_cdc->supplies[i].supply &&
- !strcmp(sdm660_cdc->supplies[i].supply, name))
- return sdm660_cdc->supplies[i].consumer;
- }
-
- dev_dbg(sdm660_cdc->dev, "Error: regulator not found:%s\n"
- , name);
- return NULL;
-}
-
-static void msm_anlg_cdc_update_micbias_regulator(
- const struct sdm660_cdc_priv *sdm660_cdc,
- const char *name,
- struct on_demand_supply *micbias_supply)
-{
- int i;
- struct sdm660_cdc_pdata *pdata = sdm660_cdc->dev->platform_data;
-
- for (i = 0; i < sdm660_cdc->num_of_supplies; i++) {
- if (sdm660_cdc->supplies[i].supply &&
- !strcmp(sdm660_cdc->supplies[i].supply, name)) {
- micbias_supply->supply =
- sdm660_cdc->supplies[i].consumer;
- micbias_supply->min_uv = pdata->regulator[i].min_uv;
- micbias_supply->max_uv = pdata->regulator[i].max_uv;
- micbias_supply->optimum_ua =
- pdata->regulator[i].optimum_ua;
- return;
- }
- }
-
- dev_err(sdm660_cdc->dev, "Error: regulator not found:%s\n", name);
-}
-
-static int msm_anlg_cdc_device_down(struct snd_soc_codec *codec)
-{
- struct msm_asoc_mach_data *pdata = NULL;
- struct sdm660_cdc_priv *sdm660_cdc_priv =
- snd_soc_codec_get_drvdata(codec);
- unsigned int tx_1_en;
- unsigned int tx_2_en;
-
- pdata = snd_soc_card_get_drvdata(codec->component.card);
- dev_dbg(codec->dev, "%s: device down!\n", __func__);
-
- tx_1_en = snd_soc_read(codec, MSM89XX_PMIC_ANALOG_TX_1_EN);
- tx_2_en = snd_soc_read(codec, MSM89XX_PMIC_ANALOG_TX_2_EN);
- tx_1_en = tx_1_en & 0x7f;
- tx_2_en = tx_2_en & 0x7f;
- snd_soc_write(codec,
- MSM89XX_PMIC_ANALOG_TX_1_EN, tx_1_en);
- snd_soc_write(codec,
- MSM89XX_PMIC_ANALOG_TX_2_EN, tx_2_en);
- if (sdm660_cdc_priv->boost_option == BOOST_ON_FOREVER) {
- if ((snd_soc_read(codec, MSM89XX_PMIC_ANALOG_SPKR_DRV_CTL)
- & 0x80) == 0) {
- msm_anlg_cdc_dig_notifier_call(codec,
- DIG_CDC_EVENT_CLK_ON);
- snd_soc_write(codec,
- MSM89XX_PMIC_ANALOG_MASTER_BIAS_CTL, 0x30);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_RST_CTL, 0x80, 0x80);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_TOP_CLK_CTL,
- 0x0C, 0x0C);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_DIG_CLK_CTL,
- 0x84, 0x84);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_DIGITAL_CDC_ANA_CLK_CTL,
- 0x10, 0x10);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_SPKR_PWRSTG_CTL,
- 0x1F, 0x1F);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_COM_BIAS_DAC,
- 0x90, 0x90);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_RX_EAR_CTL,
- 0xFF, 0xFF);
- /* Wait for 20us for boost settings to take effect */
- usleep_range(20, 21);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_SPKR_PWRSTG_CTL,
- 0xFF, 0xFF);
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_SPKR_DRV_CTL,
- 0xE9, 0xE9);
- }
- }
- msm_anlg_cdc_boost_off(codec);
- sdm660_cdc_priv->hph_mode = NORMAL_MODE;
-
- /* 40ms to allow boost to discharge */
- msleep(40);
- /* Disable PA to avoid pop during codec bring up */
- snd_soc_update_bits(codec, MSM89XX_PMIC_ANALOG_RX_HPH_CNP_EN,
- 0x30, 0x00);
- snd_soc_update_bits(codec, MSM89XX_PMIC_ANALOG_SPKR_DRV_CTL,
- 0x80, 0x00);
- snd_soc_write(codec,
- MSM89XX_PMIC_ANALOG_RX_HPH_L_PA_DAC_CTL, 0x20);
- snd_soc_write(codec,
- MSM89XX_PMIC_ANALOG_RX_HPH_R_PA_DAC_CTL, 0x20);
- snd_soc_write(codec,
- MSM89XX_PMIC_ANALOG_RX_EAR_CTL, 0x12);
- snd_soc_write(codec,
- MSM89XX_PMIC_ANALOG_SPKR_DAC_CTL, 0x93);
-
- msm_anlg_cdc_dig_notifier_call(codec, DIG_CDC_EVENT_SSR_DOWN);
- atomic_set(&pdata->int_mclk0_enabled, false);
- set_bit(BUS_DOWN, &sdm660_cdc_priv->status_mask);
- snd_soc_card_change_online_state(codec->component.card, 0);
-
- return 0;
-}
-
-static int msm_anlg_cdc_device_up(struct snd_soc_codec *codec)
-{
- struct sdm660_cdc_priv *sdm660_cdc_priv =
- snd_soc_codec_get_drvdata(codec);
-
- dev_dbg(codec->dev, "%s: device up!\n", __func__);
-
- msm_anlg_cdc_dig_notifier_call(codec, DIG_CDC_EVENT_SSR_UP);
- clear_bit(BUS_DOWN, &sdm660_cdc_priv->status_mask);
- snd_soc_card_change_online_state(codec->component.card, 1);
- /* delay is required to make sure sound card state updated */
- usleep_range(5000, 5100);
-
- snd_soc_write(codec, MSM89XX_PMIC_DIGITAL_INT_EN_SET,
- MSM89XX_PMIC_DIGITAL_INT_EN_SET__POR);
- snd_soc_write(codec, MSM89XX_PMIC_DIGITAL_INT_EN_CLR,
- MSM89XX_PMIC_DIGITAL_INT_EN_CLR__POR);
-
- msm_anlg_cdc_set_boost_v(codec);
- msm_anlg_cdc_set_micb_v(codec);
- if (sdm660_cdc_priv->boost_option == BOOST_ON_FOREVER)
- msm_anlg_cdc_boost_on(codec);
- else if (sdm660_cdc_priv->boost_option == BYPASS_ALWAYS)
- msm_anlg_cdc_bypass_on(codec);
-
- return 0;
-}
-
-static int sdm660_cdc_notifier_service_cb(struct notifier_block *nb,
- unsigned long opcode, void *ptr)
-{
- struct snd_soc_codec *codec;
- struct sdm660_cdc_priv *sdm660_cdc_priv =
- container_of(nb, struct sdm660_cdc_priv,
- audio_ssr_nb);
- bool adsp_ready = false;
- bool timedout;
- unsigned long timeout;
- static bool initial_boot = true;
-
- codec = sdm660_cdc_priv->codec;
- dev_dbg(codec->dev, "%s: Service opcode 0x%lx\n", __func__, opcode);
-
- switch (opcode) {
- case AUDIO_NOTIFIER_SERVICE_DOWN:
- if (initial_boot) {
- initial_boot = false;
- break;
- }
- dev_dbg(codec->dev,
- "ADSP is about to power down. teardown/reset codec\n");
- msm_anlg_cdc_device_down(codec);
- break;
- case AUDIO_NOTIFIER_SERVICE_UP:
- if (initial_boot)
- initial_boot = false;
- dev_dbg(codec->dev,
- "ADSP is about to power up. bring up codec\n");
-
- if (!q6core_is_adsp_ready()) {
- dev_dbg(codec->dev,
- "ADSP isn't ready\n");
- timeout = jiffies +
- msecs_to_jiffies(ADSP_STATE_READY_TIMEOUT_MS);
- while (!(timedout = time_after(jiffies, timeout))) {
- if (!q6core_is_adsp_ready()) {
- dev_dbg(codec->dev,
- "ADSP isn't ready\n");
- } else {
- dev_dbg(codec->dev,
- "ADSP is ready\n");
- adsp_ready = true;
- goto powerup;
- }
- }
- } else {
- adsp_ready = true;
- dev_dbg(codec->dev, "%s: DSP is ready\n", __func__);
- }
-powerup:
- if (adsp_ready)
- msm_anlg_cdc_device_up(codec);
- break;
- default:
- break;
- }
- return NOTIFY_OK;
-}
-
-int msm_anlg_cdc_hs_detect(struct snd_soc_codec *codec,
- struct wcd_mbhc_config *mbhc_cfg)
-{
- struct sdm660_cdc_priv *sdm660_cdc_priv =
- snd_soc_codec_get_drvdata(codec);
-
- return wcd_mbhc_start(&sdm660_cdc_priv->mbhc, mbhc_cfg);
-}
-EXPORT_SYMBOL(msm_anlg_cdc_hs_detect);
-
-void msm_anlg_cdc_hs_detect_exit(struct snd_soc_codec *codec)
-{
- struct sdm660_cdc_priv *sdm660_cdc_priv =
- snd_soc_codec_get_drvdata(codec);
-
- wcd_mbhc_stop(&sdm660_cdc_priv->mbhc);
-}
-EXPORT_SYMBOL(msm_anlg_cdc_hs_detect_exit);
-
-void msm_anlg_cdc_update_int_spk_boost(bool enable)
-{
- pr_debug("%s: enable = %d\n", __func__, enable);
- spkr_boost_en = enable;
-}
-EXPORT_SYMBOL(msm_anlg_cdc_update_int_spk_boost);
-
-static void msm_anlg_cdc_set_micb_v(struct snd_soc_codec *codec)
-{
-
- struct sdm660_cdc_priv *sdm660_cdc = snd_soc_codec_get_drvdata(codec);
- struct sdm660_cdc_pdata *pdata = sdm660_cdc->dev->platform_data;
- u8 reg_val;
-
- reg_val = VOLTAGE_CONVERTER(pdata->micbias.cfilt1_mv, MICBIAS_MIN_VAL,
- MICBIAS_STEP_SIZE);
- dev_dbg(codec->dev, "cfilt1_mv %d reg_val %x\n",
- (u32)pdata->micbias.cfilt1_mv, reg_val);
- snd_soc_update_bits(codec, MSM89XX_PMIC_ANALOG_MICB_1_VAL,
- 0xF8, (reg_val << 3));
-}
-
-static void msm_anlg_cdc_set_boost_v(struct snd_soc_codec *codec)
-{
- struct sdm660_cdc_priv *sdm660_cdc_priv =
- snd_soc_codec_get_drvdata(codec);
-
- snd_soc_update_bits(codec, MSM89XX_PMIC_ANALOG_OUTPUT_VOLTAGE,
- 0x1F, sdm660_cdc_priv->boost_voltage);
-}
-
-static void msm_anlg_cdc_configure_cap(struct snd_soc_codec *codec,
- bool micbias1, bool micbias2)
-{
-
- struct msm_asoc_mach_data *pdata = NULL;
-
- pdata = snd_soc_card_get_drvdata(codec->component.card);
-
- pr_debug("\n %s: micbias1 %x micbias2 = %d\n", __func__, micbias1,
- micbias2);
- if (micbias1 && micbias2) {
- if ((pdata->micbias1_cap_mode
- == MICBIAS_EXT_BYP_CAP) ||
- (pdata->micbias2_cap_mode
- == MICBIAS_EXT_BYP_CAP))
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MICB_1_EN,
- 0x40, (MICBIAS_EXT_BYP_CAP << 6));
- else
- snd_soc_update_bits(codec,
- MSM89XX_PMIC_ANALOG_MICB_1_EN,
- 0x40, (MICBIAS_NO_EXT_BYP_CAP << 6));
- } else if (micbias2) {
- snd_soc_update_bits(codec, MSM89XX_PMIC_ANALOG_MICB_1_EN,
- 0x40, (pdata->micbias2_cap_mode << 6));
- } else if (micbias1) {
- snd_soc_update_bits(codec, MSM89XX_PMIC_ANALOG_MICB_1_EN,
- 0x40, (pdata->micbias1_cap_mode << 6));
- } else {
- snd_soc_update_bits(codec, MSM89XX_PMIC_ANALOG_MICB_1_EN,
- 0x40, 0x00);
- }
-}
-
-static ssize_t msm_anlg_codec_version_read(struct snd_info_entry *entry,
- void *file_private_data,
- struct file *file,
- char __user *buf, size_t count,
- loff_t pos)
-{
- struct sdm660_cdc_priv *sdm660_cdc_priv;
- char buffer[MSM_ANLG_CDC_VERSION_ENTRY_SIZE];
- int len = 0;
-
- sdm660_cdc_priv = (struct sdm660_cdc_priv *) entry->private_data;
- if (!sdm660_cdc_priv) {
- pr_err("%s: sdm660_cdc_priv is null\n", __func__);
- return -EINVAL;
- }
-
- switch (get_codec_version(sdm660_cdc_priv)) {
- case DRAX_CDC:
- len = snprintf(buffer, sizeof(buffer), "DRAX-CDC_1_0\n");
- break;
- default:
- len = snprintf(buffer, sizeof(buffer), "VER_UNDEFINED\n");
- }
-
- return simple_read_from_buffer(buf, count, &pos, buffer, len);
-}
-
-static struct snd_info_entry_ops msm_anlg_codec_info_ops = {
- .read = msm_anlg_codec_version_read,
-};
-
-/*
- * msm_anlg_codec_info_create_codec_entry - creates pmic_analog module
- * @codec_root: The parent directory
- * @codec: Codec instance
- *
- * Creates pmic_analog module and version entry under the given
- * parent directory.
- *
- * Return: 0 on success or negative error code on failure.
- */
-int msm_anlg_codec_info_create_codec_entry(struct snd_info_entry *codec_root,
- struct snd_soc_codec *codec)
-{
- struct snd_info_entry *version_entry;
- struct sdm660_cdc_priv *sdm660_cdc_priv;
- struct snd_soc_card *card;
- int ret;
-
- if (!codec_root || !codec)
- return -EINVAL;
-
- sdm660_cdc_priv = snd_soc_codec_get_drvdata(codec);
- card = codec->component.card;
- sdm660_cdc_priv->entry = snd_info_create_subdir(codec_root->module,
- "spmi0-03",
- codec_root);
- if (!sdm660_cdc_priv->entry) {
- dev_dbg(codec->dev, "%s: failed to create pmic_analog entry\n",
- __func__);
- return -ENOMEM;
- }
-
- version_entry = snd_info_create_card_entry(card->snd_card,
- "version",
- sdm660_cdc_priv->entry);
- if (!version_entry) {
- dev_dbg(codec->dev, "%s: failed to create pmic_analog version entry\n",
- __func__);
- return -ENOMEM;
- }
-
- version_entry->private_data = sdm660_cdc_priv;
- version_entry->size = MSM_ANLG_CDC_VERSION_ENTRY_SIZE;
- version_entry->content = SNDRV_INFO_CONTENT_DATA;
- version_entry->c.ops = &msm_anlg_codec_info_ops;
-
- if (snd_info_register(version_entry) < 0) {
- snd_info_free_entry(version_entry);
- return -ENOMEM;
- }
- sdm660_cdc_priv->version_entry = version_entry;
-
- sdm660_cdc_priv->audio_ssr_nb.notifier_call =
- sdm660_cdc_notifier_service_cb;
- ret = audio_notifier_register("pmic_analog_cdc",
- AUDIO_NOTIFIER_ADSP_DOMAIN,
- &sdm660_cdc_priv->audio_ssr_nb);
- if (ret < 0) {
- pr_err("%s: Audio notifier register failed ret = %d\n",
- __func__, ret);
- return ret;
- }
- return 0;
-}
-EXPORT_SYMBOL(msm_anlg_codec_info_create_codec_entry);
-
-static int msm_anlg_cdc_soc_probe(struct snd_soc_codec *codec)
-{
- struct sdm660_cdc_priv *sdm660_cdc;
- struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
- int ret;
-
- sdm660_cdc = dev_get_drvdata(codec->dev);
- sdm660_cdc->codec = codec;
-
- /* codec resmgr module init */
- sdm660_cdc->spkdrv_reg =
- msm_anlg_cdc_find_regulator(sdm660_cdc,
- MSM89XX_VDD_SPKDRV_NAME);
- sdm660_cdc->pmic_rev =
- snd_soc_read(codec,
- MSM89XX_PMIC_DIGITAL_REVISION1);
- sdm660_cdc->codec_version =
- snd_soc_read(codec,
- MSM89XX_PMIC_DIGITAL_PERPH_SUBTYPE);
- sdm660_cdc->analog_major_rev =
- snd_soc_read(codec,
- MSM89XX_PMIC_ANALOG_REVISION4);
-
- if (sdm660_cdc->codec_version == CONGA) {
- dev_dbg(codec->dev, "%s :Conga REV: %d\n", __func__,
- sdm660_cdc->codec_version);
- sdm660_cdc->ext_spk_boost_set = true;
- } else {
- dev_dbg(codec->dev, "%s :PMIC REV: %d\n", __func__,
- sdm660_cdc->pmic_rev);
- if (sdm660_cdc->pmic_rev == TOMBAK_1_0 &&
- sdm660_cdc->codec_version == CAJON_2_0) {
- if (sdm660_cdc->analog_major_rev == 0x02) {
- sdm660_cdc->codec_version = DRAX_CDC;
- dev_dbg(codec->dev,
- "%s : Drax codec detected\n", __func__);
- } else {
- sdm660_cdc->codec_version = DIANGU;
- dev_dbg(codec->dev, "%s : Diangu detected\n",
- __func__);
- }
- } else if (sdm660_cdc->pmic_rev == TOMBAK_1_0 &&
- (snd_soc_read(codec, MSM89XX_PMIC_ANALOG_NCP_FBCTRL)
- & 0x80)) {
- sdm660_cdc->codec_version = CAJON;
- dev_dbg(codec->dev, "%s : Cajon detected\n", __func__);
- } else if (sdm660_cdc->pmic_rev == TOMBAK_2_0 &&
- (snd_soc_read(codec, MSM89XX_PMIC_ANALOG_NCP_FBCTRL)
- & 0x80)) {
- sdm660_cdc->codec_version = CAJON_2_0;
- dev_dbg(codec->dev, "%s : Cajon 2.0 detected\n",
- __func__);
- }
- }
- /*
- * set to default boost option BOOST_SWITCH, user mixer path can change
- * it to BOOST_ALWAYS or BOOST_BYPASS based on solution chosen.
- */
- sdm660_cdc->boost_option = BOOST_SWITCH;
- sdm660_cdc->hph_mode = NORMAL_MODE;
-
- msm_anlg_cdc_dt_parse_boost_info(codec);
- msm_anlg_cdc_set_boost_v(codec);
-
- snd_soc_add_codec_controls(codec, impedance_detect_controls,
- ARRAY_SIZE(impedance_detect_controls));
- snd_soc_add_codec_controls(codec, hph_type_detect_controls,
- ARRAY_SIZE(hph_type_detect_controls));
-
- msm_anlg_cdc_bringup(codec);
- msm_anlg_cdc_codec_init_reg(codec);
- msm_anlg_cdc_update_reg_defaults(codec);
-
- wcd9xxx_spmi_set_codec(codec);
-
- msm_anlg_cdc_update_micbias_regulator(
- sdm660_cdc,
- on_demand_supply_name[ON_DEMAND_MICBIAS],
- &sdm660_cdc->on_demand_list[ON_DEMAND_MICBIAS]);
- atomic_set(&sdm660_cdc->on_demand_list[ON_DEMAND_MICBIAS].ref,
- 0);
-
- sdm660_cdc->fw_data = devm_kzalloc(codec->dev,
- sizeof(*(sdm660_cdc->fw_data)),
- GFP_KERNEL);
- if (!sdm660_cdc->fw_data)
- return -ENOMEM;
-
- set_bit(WCD9XXX_MBHC_CAL, sdm660_cdc->fw_data->cal_bit);
- ret = wcd_cal_create_hwdep(sdm660_cdc->fw_data,
- WCD9XXX_CODEC_HWDEP_NODE, codec);
- if (ret < 0) {
- dev_err(codec->dev, "%s hwdep failed %d\n", __func__, ret);
- return ret;
- }
-
- wcd_mbhc_init(&sdm660_cdc->mbhc, codec, &mbhc_cb, &intr_ids,
- wcd_mbhc_registers, true);
-
- sdm660_cdc->int_mclk0_enabled = false;
- /*Update speaker boost configuration*/
- sdm660_cdc->spk_boost_set = spkr_boost_en;
- pr_debug("%s: speaker boost configured = %d\n",
- __func__, sdm660_cdc->spk_boost_set);
-
- /* Set initial MICBIAS voltage level */
- msm_anlg_cdc_set_micb_v(codec);
-
- /* Set initial cap mode */
- msm_anlg_cdc_configure_cap(codec, false, false);
-
- snd_soc_dapm_ignore_suspend(dapm, "PDM Playback");
- snd_soc_dapm_ignore_suspend(dapm, "PDM Capture");
-
- snd_soc_dapm_sync(dapm);
-
- return 0;
-}
-
-static int msm_anlg_cdc_soc_remove(struct snd_soc_codec *codec)
-{
- struct sdm660_cdc_priv *sdm660_cdc_priv =
- dev_get_drvdata(codec->dev);
-
- sdm660_cdc_priv->spkdrv_reg = NULL;
- sdm660_cdc_priv->on_demand_list[ON_DEMAND_MICBIAS].supply = NULL;
- atomic_set(&sdm660_cdc_priv->on_demand_list[ON_DEMAND_MICBIAS].ref,
- 0);
- wcd_mbhc_deinit(&sdm660_cdc_priv->mbhc);
-
- return 0;
-}
-
-static int msm_anlg_cdc_enable_static_supplies_to_optimum(
- struct sdm660_cdc_priv *sdm660_cdc,
- struct sdm660_cdc_pdata *pdata)
-{
- int i;
- int ret = 0, rc = 0;
-
- for (i = 0; i < sdm660_cdc->num_of_supplies; i++) {
- if (pdata->regulator[i].ondemand)
- continue;
- if (regulator_count_voltages(
- sdm660_cdc->supplies[i].consumer) <= 0)
- continue;
-
- rc = regulator_enable(sdm660_cdc->supplies[i].consumer);
- if (rc) {
- dev_err(sdm660_cdc->dev, "Failed to enable %s: %d\n",
- sdm660_cdc->supplies[i].supply, rc);
- break;
- }
- ret = regulator_set_voltage(
- sdm660_cdc->supplies[i].consumer,
- pdata->regulator[i].min_uv,
- pdata->regulator[i].max_uv);
- if (ret) {
- dev_err(sdm660_cdc->dev,
- "Setting volt failed for regulator %s err %d\n",
- sdm660_cdc->supplies[i].supply, ret);
- }
-
- ret = regulator_set_load(sdm660_cdc->supplies[i].consumer,
- pdata->regulator[i].optimum_ua);
- dev_dbg(sdm660_cdc->dev, "Regulator %s set optimum mode\n",
- sdm660_cdc->supplies[i].supply);
- }
-
- while (rc && i--)
- if (!pdata->regulator[i].ondemand)
- regulator_disable(sdm660_cdc->supplies[i].consumer);
- return rc;
-}
-
-static int msm_anlg_cdc_disable_static_supplies_to_optimum(
- struct sdm660_cdc_priv *sdm660_cdc,
- struct sdm660_cdc_pdata *pdata)
-{
- int i;
- int ret = 0;
-
- for (i = 0; i < sdm660_cdc->num_of_supplies; i++) {
- if (pdata->regulator[i].ondemand)
- continue;
- if (regulator_count_voltages(
- sdm660_cdc->supplies[i].consumer) <= 0)
- continue;
- regulator_set_voltage(sdm660_cdc->supplies[i].consumer, 0,
- pdata->regulator[i].max_uv);
- regulator_set_load(sdm660_cdc->supplies[i].consumer, 0);
- ret = regulator_disable(sdm660_cdc->supplies[i].consumer);
- if (ret)
- dev_err(sdm660_cdc->dev, "Failed to disable %s: %d\n",
- sdm660_cdc->supplies[i].supply, ret);
-
- dev_dbg(sdm660_cdc->dev, "Regulator %s disable\n",
- sdm660_cdc->supplies[i].supply);
- }
-
- return ret;
-}
-
-static int msm_anlg_cdc_suspend(struct snd_soc_codec *codec)
-{
- struct sdm660_cdc_priv *sdm660_cdc = snd_soc_codec_get_drvdata(codec);
- struct sdm660_cdc_pdata *sdm660_cdc_pdata =
- sdm660_cdc->dev->platform_data;
-
- msm_anlg_cdc_disable_static_supplies_to_optimum(sdm660_cdc,
- sdm660_cdc_pdata);
- return 0;
-}
-
-static int msm_anlg_cdc_resume(struct snd_soc_codec *codec)
-{
- struct msm_asoc_mach_data *pdata = NULL;
- struct sdm660_cdc_priv *sdm660_cdc = snd_soc_codec_get_drvdata(codec);
- struct sdm660_cdc_pdata *sdm660_cdc_pdata =
- sdm660_cdc->dev->platform_data;
-
- pdata = snd_soc_card_get_drvdata(codec->component.card);
- msm_anlg_cdc_enable_static_supplies_to_optimum(sdm660_cdc,
- sdm660_cdc_pdata);
- return 0;
-}
-
-static struct regmap *msm_anlg_get_regmap(struct device *dev)
-{
- return dev_get_regmap(dev->parent, NULL);
-}
-
-static struct snd_soc_codec_driver soc_codec_dev_sdm660_cdc = {
- .probe = msm_anlg_cdc_soc_probe,
- .remove = msm_anlg_cdc_soc_remove,
- .suspend = msm_anlg_cdc_suspend,
- .resume = msm_anlg_cdc_resume,
- .reg_word_size = 1,
- .get_regmap = msm_anlg_get_regmap,
- .component_driver = {
- .controls = msm_anlg_cdc_snd_controls,
- .num_controls = ARRAY_SIZE(msm_anlg_cdc_snd_controls),
- .dapm_widgets = msm_anlg_cdc_dapm_widgets,
- .num_dapm_widgets = ARRAY_SIZE(msm_anlg_cdc_dapm_widgets),
- .dapm_routes = audio_map,
- .num_dapm_routes = ARRAY_SIZE(audio_map),
- },
-};
-
-static int msm_anlg_cdc_init_supplies(struct sdm660_cdc_priv *sdm660_cdc,
- struct sdm660_cdc_pdata *pdata)
-{
- int ret;
- int i;
-
- sdm660_cdc->supplies = devm_kzalloc(sdm660_cdc->dev,
- sizeof(struct regulator_bulk_data) *
- ARRAY_SIZE(pdata->regulator),
- GFP_KERNEL);
- if (!sdm660_cdc->supplies) {
- ret = -ENOMEM;
- goto err;
- }
-
- sdm660_cdc->num_of_supplies = 0;
- if (ARRAY_SIZE(pdata->regulator) > MAX_REGULATOR) {
- dev_err(sdm660_cdc->dev, "%s: Array Size out of bound\n",
- __func__);
- ret = -EINVAL;
- goto err;
- }
-
- for (i = 0; i < ARRAY_SIZE(pdata->regulator); i++) {
- if (pdata->regulator[i].name) {
- sdm660_cdc->supplies[i].supply =
- pdata->regulator[i].name;
- sdm660_cdc->num_of_supplies++;
- }
- }
-
- ret = devm_regulator_bulk_get(sdm660_cdc->dev,
- sdm660_cdc->num_of_supplies,
- sdm660_cdc->supplies);
- if (ret != 0) {
- dev_err(sdm660_cdc->dev,
- "Failed to get supplies: err = %d\n",
- ret);
- goto err_supplies;
- }
-
- for (i = 0; i < sdm660_cdc->num_of_supplies; i++) {
- if (regulator_count_voltages(
- sdm660_cdc->supplies[i].consumer) <= 0)
- continue;
- if (pdata->regulator[i].ondemand) {
- ret = regulator_set_voltage(
- sdm660_cdc->supplies[i].consumer,
- 0, pdata->regulator[i].max_uv);
- if (ret) {
- dev_err(sdm660_cdc->dev,
- "Setting regulator voltage failed for regulator %s err = %d\n",
- sdm660_cdc->supplies[i].supply, ret);
- goto err_supplies;
- }
- ret = regulator_set_load(
- sdm660_cdc->supplies[i].consumer, 0);
- if (ret < 0) {
- dev_err(sdm660_cdc->dev,
- "Setting regulator optimum mode failed for regulator %s err = %d\n",
- sdm660_cdc->supplies[i].supply, ret);
- goto err_supplies;
- } else {
- ret = 0;
- continue;
- }
- }
- ret = regulator_set_voltage(sdm660_cdc->supplies[i].consumer,
- pdata->regulator[i].min_uv,
- pdata->regulator[i].max_uv);
- if (ret) {
- dev_err(sdm660_cdc->dev,
- "Setting regulator voltage failed for regulator %s err = %d\n",
- sdm660_cdc->supplies[i].supply, ret);
- goto err_supplies;
- }
- ret = regulator_set_load(sdm660_cdc->supplies[i].consumer,
- pdata->regulator[i].optimum_ua);
- if (ret < 0) {
- dev_err(sdm660_cdc->dev,
- "Setting regulator optimum mode failed for regulator %s err = %d\n",
- sdm660_cdc->supplies[i].supply, ret);
- goto err_supplies;
- } else {
- ret = 0;
- }
- }
-
- return ret;
-
-err_supplies:
- devm_kfree(sdm660_cdc->dev, sdm660_cdc->supplies);
-err:
- return ret;
-}
-
-static int msm_anlg_cdc_enable_static_supplies(
- struct sdm660_cdc_priv *sdm660_cdc,
- struct sdm660_cdc_pdata *pdata)
-{
- int i;
- int ret = 0;
-
- for (i = 0; i < sdm660_cdc->num_of_supplies; i++) {
- if (pdata->regulator[i].ondemand)
- continue;
- ret = regulator_enable(sdm660_cdc->supplies[i].consumer);
- if (ret) {
- dev_err(sdm660_cdc->dev, "Failed to enable %s\n",
- sdm660_cdc->supplies[i].supply);
- break;
- }
- dev_dbg(sdm660_cdc->dev, "Enabled regulator %s\n",
- sdm660_cdc->supplies[i].supply);
- }
-
- while (ret && i--)
- if (!pdata->regulator[i].ondemand)
- regulator_disable(sdm660_cdc->supplies[i].consumer);
- return ret;
-}
-
-static void msm_anlg_cdc_disable_supplies(struct sdm660_cdc_priv *sdm660_cdc,
- struct sdm660_cdc_pdata *pdata)
-{
- int i;
-
- regulator_bulk_disable(sdm660_cdc->num_of_supplies,
- sdm660_cdc->supplies);
- for (i = 0; i < sdm660_cdc->num_of_supplies; i++) {
- if (regulator_count_voltages(
- sdm660_cdc->supplies[i].consumer) <= 0)
- continue;
- regulator_set_voltage(sdm660_cdc->supplies[i].consumer, 0,
- pdata->regulator[i].max_uv);
- regulator_set_load(sdm660_cdc->supplies[i].consumer, 0);
- }
-}
-
-static const struct of_device_id sdm660_codec_of_match[] = {
- { .compatible = "qcom,pmic-analog-codec", },
- {},
-};
-
-static void msm_anlg_add_child_devices(struct work_struct *work)
-{
- struct sdm660_cdc_priv *pdata;
- struct platform_device *pdev;
- struct device_node *node;
- struct msm_dig_ctrl_data *dig_ctrl_data = NULL, *temp;
- int ret, ctrl_num = 0;
- struct msm_dig_ctrl_platform_data *platdata;
- char plat_dev_name[MSM_DIG_CDC_STRING_LEN];
-
- pdata = container_of(work, struct sdm660_cdc_priv,
- msm_anlg_add_child_devices_work);
- if (!pdata) {
- pr_err("%s: Memory for pdata does not exist\n",
- __func__);
- return;
- }
- if (!pdata->dev->of_node) {
- dev_err(pdata->dev,
- "%s: DT node for pdata does not exist\n", __func__);
- return;
- }
-
- platdata = &pdata->dig_plat_data;
-
- for_each_child_of_node(pdata->dev->of_node, node) {
- if (!strcmp(node->name, "msm-dig-codec"))
- strlcpy(plat_dev_name, "msm_digital_codec",
- (MSM_DIG_CDC_STRING_LEN - 1));
- else
- continue;
-
- pdev = platform_device_alloc(plat_dev_name, -1);
- if (!pdev) {
- dev_err(pdata->dev, "%s: pdev memory alloc failed\n",
- __func__);
- ret = -ENOMEM;
- goto err;
- }
- pdev->dev.parent = pdata->dev;
- pdev->dev.of_node = node;
-
- if (!strcmp(node->name, "msm-dig-codec")) {
- ret = platform_device_add_data(pdev, platdata,
- sizeof(*platdata));
- if (ret) {
- dev_err(&pdev->dev,
- "%s: cannot add plat data ctrl:%d\n",
- __func__, ctrl_num);
- goto fail_pdev_add;
- }
- }
-
- ret = platform_device_add(pdev);
- if (ret) {
- dev_err(&pdev->dev,
- "%s: Cannot add platform device\n",
- __func__);
- goto fail_pdev_add;
- }
-
- if (!strcmp(node->name, "msm-dig-codec")) {
- temp = krealloc(dig_ctrl_data,
- (ctrl_num + 1) * sizeof(
- struct msm_dig_ctrl_data),
- GFP_KERNEL);
- if (!temp) {
- dev_err(&pdev->dev, "out of memory\n");
- ret = -ENOMEM;
- goto err;
- }
- dig_ctrl_data = temp;
- dig_ctrl_data[ctrl_num].dig_pdev = pdev;
- ctrl_num++;
- dev_dbg(&pdev->dev,
- "%s: Added digital codec device(s)\n",
- __func__);
- pdata->dig_ctrl_data = dig_ctrl_data;
- }
- pdata->pdev_child_devices[pdata->child_count++] = pdev;
- }
-
- return;
-fail_pdev_add:
- platform_device_put(pdev);
-err:
- return;
-}
-
-static int msm_anlg_cdc_probe(struct platform_device *pdev)
-{
- int ret = 0;
- struct sdm660_cdc_priv *sdm660_cdc = NULL;
- struct sdm660_cdc_pdata *pdata;
- int adsp_state;
-
- adsp_state = apr_get_subsys_state();
- if (adsp_state != APR_SUBSYS_LOADED) {
- dev_err(&pdev->dev, "Adsp is not loaded yet %d\n",
- adsp_state);
- return -EPROBE_DEFER;
- }
- device_init_wakeup(&pdev->dev, true);
-
- if (pdev->dev.of_node) {
- dev_dbg(&pdev->dev, "%s:Platform data from device tree\n",
- __func__);
- pdata = msm_anlg_cdc_populate_dt_pdata(&pdev->dev);
- pdev->dev.platform_data = pdata;
- } else {
- dev_dbg(&pdev->dev, "%s:Platform data from board file\n",
- __func__);
- pdata = pdev->dev.platform_data;
- }
- if (pdata == NULL) {
- dev_err(&pdev->dev, "%s:Platform data failed to populate\n",
- __func__);
- goto rtn;
- }
- sdm660_cdc = devm_kzalloc(&pdev->dev, sizeof(struct sdm660_cdc_priv),
- GFP_KERNEL);
- if (sdm660_cdc == NULL) {
- ret = -ENOMEM;
- goto rtn;
- }
-
- sdm660_cdc->dev = &pdev->dev;
- ret = msm_anlg_cdc_init_supplies(sdm660_cdc, pdata);
- if (ret) {
- dev_err(&pdev->dev, "%s: Fail to enable Codec supplies\n",
- __func__);
- goto rtn;
- }
- ret = msm_anlg_cdc_enable_static_supplies(sdm660_cdc, pdata);
- if (ret) {
- dev_err(&pdev->dev,
- "%s: Fail to enable Codec pre-reset supplies\n",
- __func__);
- goto rtn;
- }
- /* Allow supplies to be ready */
- usleep_range(5, 6);
-
- wcd9xxx_spmi_set_dev(pdev, 0);
- wcd9xxx_spmi_set_dev(pdev, 1);
- if (wcd9xxx_spmi_irq_init()) {
- dev_err(&pdev->dev,
- "%s: irq initialization failed\n", __func__);
- } else {
- dev_dbg(&pdev->dev,
- "%s: irq initialization passed\n", __func__);
- }
- dev_set_drvdata(&pdev->dev, sdm660_cdc);
-
- ret = snd_soc_register_codec(&pdev->dev,
- &soc_codec_dev_sdm660_cdc,
- msm_anlg_cdc_i2s_dai,
- ARRAY_SIZE(msm_anlg_cdc_i2s_dai));
- if (ret) {
- dev_err(&pdev->dev,
- "%s:snd_soc_register_codec failed with error %d\n",
- __func__, ret);
- goto err_supplies;
- }
- BLOCKING_INIT_NOTIFIER_HEAD(&sdm660_cdc->notifier);
- BLOCKING_INIT_NOTIFIER_HEAD(&sdm660_cdc->notifier_mbhc);
-
- sdm660_cdc->dig_plat_data.handle = (void *) sdm660_cdc;
- sdm660_cdc->dig_plat_data.set_compander_mode = set_compander_mode;
- sdm660_cdc->dig_plat_data.update_clkdiv = update_clkdiv;
- sdm660_cdc->dig_plat_data.get_cdc_version = get_cdc_version;
- sdm660_cdc->dig_plat_data.register_notifier =
- msm_anlg_cdc_dig_register_notifier;
- INIT_WORK(&sdm660_cdc->msm_anlg_add_child_devices_work,
- msm_anlg_add_child_devices);
- schedule_work(&sdm660_cdc->msm_anlg_add_child_devices_work);
-
- return ret;
-err_supplies:
- msm_anlg_cdc_disable_supplies(sdm660_cdc, pdata);
-rtn:
- return ret;
-}
-
-static int msm_anlg_cdc_remove(struct platform_device *pdev)
-{
- struct sdm660_cdc_priv *sdm660_cdc = dev_get_drvdata(&pdev->dev);
- struct sdm660_cdc_pdata *pdata = sdm660_cdc->dev->platform_data;
- int count;
-
- for (count = 0; count < sdm660_cdc->child_count &&
- count < ANLG_CDC_CHILD_DEVICES_MAX; count++)
- platform_device_unregister(
- sdm660_cdc->pdev_child_devices[count]);
- snd_soc_unregister_codec(&pdev->dev);
- msm_anlg_cdc_disable_supplies(sdm660_cdc, pdata);
- wcd9xxx_spmi_irq_exit();
- devm_kfree(&pdev->dev, sdm660_cdc);
- return 0;
-}
-
-static struct platform_driver msm_anlg_codec_driver = {
- .driver = {
- .owner = THIS_MODULE,
- .name = DRV_NAME,
- .of_match_table = of_match_ptr(sdm660_codec_of_match)
- },
- .probe = msm_anlg_cdc_probe,
- .remove = msm_anlg_cdc_remove,
-};
-module_platform_driver(msm_anlg_codec_driver);
-
-MODULE_DESCRIPTION("MSM Audio Analog codec driver");
-MODULE_LICENSE("GPL v2");
diff --git a/asoc/codecs/sdm660_cdc/msm-analog-cdc.h b/asoc/codecs/sdm660_cdc/msm-analog-cdc.h
deleted file mode 100644
index 71d555f..0000000
--- a/asoc/codecs/sdm660_cdc/msm-analog-cdc.h
+++ /dev/null
@@ -1,273 +0,0 @@
-/* Copyright (c) 2015-2018, 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.
- */
-#ifndef MSM_ANALOG_CDC_H
-#define MSM_ANALOG_CDC_H
-
-#include <sound/soc.h>
-#include <sound/jack.h>
-#include <dsp/q6afe-v2.h>
-#include "../wcd-mbhc-v2.h"
-#include "../wcdcal-hwdep.h"
-#include "sdm660-cdc-registers.h"
-
-#define MICBIAS_EXT_BYP_CAP 0x00
-#define MICBIAS_NO_EXT_BYP_CAP 0x01
-#define ANLG_CDC_CHILD_DEVICES_MAX 1
-
-#define MSM89XX_NUM_IRQ_REGS 2
-#define MAX_REGULATOR 7
-#define MSM89XX_REG_VAL(reg, val) {reg, 0, val}
-
-#define MSM89XX_VDD_SPKDRV_NAME "cdc-vdd-spkdrv"
-
-#define DEFAULT_MULTIPLIER 800
-#define DEFAULT_GAIN 9
-#define DEFAULT_OFFSET 100
-
-extern const u8 msm89xx_pmic_cdc_reg_readable[MSM89XX_PMIC_CDC_CACHE_SIZE];
-extern const u8 msm89xx_cdc_core_reg_readable[MSM89XX_CDC_CORE_CACHE_SIZE];
-extern struct regmap_config msm89xx_cdc_core_regmap_config;
-extern struct regmap_config msm89xx_pmic_cdc_regmap_config;
-
-enum wcd_curr_ref {
- I_h4_UA = 0,
- I_pt5_UA,
- I_14_UA,
- I_l4_UA,
- I_1_UA,
-};
-
-enum wcd_mbhc_imp_det_pin {
- WCD_MBHC_DET_NONE = 0,
- WCD_MBHC_DET_HPHL,
- WCD_MBHC_DET_HPHR,
- WCD_MBHC_DET_BOTH,
-};
-
-
-/* Each micbias can be assigned to one of three cfilters
- * Vbatt_min >= .15V + ldoh_v
- * ldoh_v >= .15v + cfiltx_mv
- * If ldoh_v = 1.95 160 mv < cfiltx_mv < 1800 mv
- * If ldoh_v = 2.35 200 mv < cfiltx_mv < 2200 mv
- * If ldoh_v = 2.75 240 mv < cfiltx_mv < 2600 mv
- * If ldoh_v = 2.85 250 mv < cfiltx_mv < 2700 mv
- */
-
-struct wcd_micbias_setting {
- u8 ldoh_v;
- u32 cfilt1_mv; /* in mv */
- u32 cfilt2_mv; /* in mv */
- u32 cfilt3_mv; /* in mv */
- /* Different WCD9xxx series codecs may not
- * have 4 mic biases. If a codec has fewer
- * mic biases, some of these properties will
- * not be used.
- */
- u8 bias1_cfilt_sel;
- u8 bias2_cfilt_sel;
- u8 bias3_cfilt_sel;
- u8 bias4_cfilt_sel;
- u8 bias1_cap_mode;
- u8 bias2_cap_mode;
- u8 bias3_cap_mode;
- u8 bias4_cap_mode;
- bool bias2_is_headset_only;
-};
-
-enum sdm660_cdc_pid_current {
- MSM89XX_PID_MIC_2P5_UA,
- MSM89XX_PID_MIC_5_UA,
- MSM89XX_PID_MIC_10_UA,
- MSM89XX_PID_MIC_20_UA,
-};
-
-struct sdm660_cdc_reg_mask_val {
- u16 reg;
- u8 mask;
- u8 val;
-};
-
-enum {
- /* INTR_REG 0 - Digital Periph */
- MSM89XX_IRQ_SPKR_CNP = 0,
- MSM89XX_IRQ_SPKR_CLIP,
- MSM89XX_IRQ_SPKR_OCP,
- MSM89XX_IRQ_MBHC_INSREM_DET1,
- MSM89XX_IRQ_MBHC_RELEASE,
- MSM89XX_IRQ_MBHC_PRESS,
- MSM89XX_IRQ_MBHC_INSREM_DET,
- MSM89XX_IRQ_MBHC_HS_DET,
- /* INTR_REG 1 - Analog Periph */
- MSM89XX_IRQ_EAR_OCP,
- MSM89XX_IRQ_HPHR_OCP,
- MSM89XX_IRQ_HPHL_OCP,
- MSM89XX_IRQ_EAR_CNP,
- MSM89XX_IRQ_HPHR_CNP,
- MSM89XX_IRQ_HPHL_CNP,
- MSM89XX_NUM_IRQS,
-};
-
-enum {
- ON_DEMAND_MICBIAS = 0,
- ON_DEMAND_SPKDRV,
- ON_DEMAND_SUPPLIES_MAX,
-};
-
-/*
- * The delay list is per codec HW specification.
- * Please add delay in the list in the future instead
- * of magic number
- */
-enum {
- CODEC_DELAY_1_MS = 1000,
- CODEC_DELAY_1_1_MS = 1100,
-};
-
-struct sdm660_cdc_regulator {
- const char *name;
- int min_uv;
- int max_uv;
- int optimum_ua;
- bool ondemand;
- struct regulator *regulator;
-};
-
-struct on_demand_supply {
- struct regulator *supply;
- atomic_t ref;
- int min_uv;
- int max_uv;
- int optimum_ua;
-};
-
-struct wcd_imped_i_ref {
- enum wcd_curr_ref curr_ref;
- int min_val;
- int multiplier;
- int gain_adj;
- int offset;
-};
-
-enum sdm660_cdc_micbias_num {
- MSM89XX_MICBIAS1 = 0,
-};
-
-/* Hold instance to digital codec platform device */
-struct msm_dig_ctrl_data {
- struct platform_device *dig_pdev;
-};
-
-struct msm_dig_ctrl_platform_data {
- void *handle;
- void (*set_compander_mode)(void *handle, int val);
- void (*update_clkdiv)(void *handle, int val);
- int (*get_cdc_version)(void *handle);
- int (*register_notifier)(void *handle,
- struct notifier_block *nblock,
- bool enable);
-};
-
-struct sdm660_cdc_priv {
- struct device *dev;
- u32 num_of_supplies;
- struct regulator_bulk_data *supplies;
- struct snd_soc_codec *codec;
- struct work_struct msm_anlg_add_child_devices_work;
- struct msm_dig_ctrl_platform_data dig_plat_data;
- /* digital codec data structure */
- struct msm_dig_ctrl_data *dig_ctrl_data;
- struct blocking_notifier_head notifier;
- u16 pmic_rev;
- u16 codec_version;
- u16 analog_major_rev;
- u32 boost_voltage;
- u32 adc_count;
- u32 rx_bias_count;
- bool int_mclk0_enabled;
- u16 boost_option;
- /* mode to select hd2 */
- u32 hph_mode;
- /* compander used for each rx chain */
- bool spk_boost_set;
- bool ear_pa_boost_set;
- bool ext_spk_boost_set;
- struct on_demand_supply on_demand_list[ON_DEMAND_SUPPLIES_MAX];
- struct regulator *spkdrv_reg;
- struct blocking_notifier_head notifier_mbhc;
- /* mbhc module */
- struct wcd_mbhc mbhc;
- /* cal info for codec */
- struct fw_info *fw_data;
- struct notifier_block audio_ssr_nb;
- int (*codec_spk_ext_pa_cb)(struct snd_soc_codec *codec, int enable);
- unsigned long status_mask;
- struct wcd_imped_i_ref imped_i_ref;
- enum wcd_mbhc_imp_det_pin imped_det_pin;
- /* Entry for version info */
- struct snd_info_entry *entry;
- struct snd_info_entry *version_entry;
- struct platform_device *pdev_child_devices
- [ANLG_CDC_CHILD_DEVICES_MAX];
- int child_count;
-};
-
-struct sdm660_cdc_pdata {
- struct wcd_micbias_setting micbias;
- struct sdm660_cdc_regulator regulator[MAX_REGULATOR];
-};
-
-#if IS_ENABLED(CONFIG_SND_SOC_ANALOG_CDC)
-extern int msm_anlg_cdc_mclk_enable(struct snd_soc_codec *codec,
- int mclk_enable, bool dapm);
-extern int msm_anlg_cdc_hs_detect(struct snd_soc_codec *codec,
- struct wcd_mbhc_config *mbhc_cfg);
-extern void msm_anlg_cdc_hs_detect_exit(struct snd_soc_codec *codec);
-extern void sdm660_cdc_update_int_spk_boost(bool enable);
-extern void msm_anlg_cdc_spk_ext_pa_cb(
- int (*codec_spk_ext_pa)(struct snd_soc_codec *codec,
- int enable), struct snd_soc_codec *codec);
-int msm_anlg_codec_info_create_codec_entry(struct snd_info_entry *codec_root,
- struct snd_soc_codec *codec);
-#else /* CONFIG_SND_SOC_ANALOG_CDC */
-static inline int msm_anlg_cdc_mclk_enable(struct snd_soc_codec *codec,
- int mclk_enable, bool dapm)
-{
- return 0;
-}
-static inline int msm_anlg_cdc_hs_detect(struct snd_soc_codec *codec,
- struct wcd_mbhc_config *mbhc_cfg)
-{
- return 0;
-}
-static inline void msm_anlg_cdc_hs_detect_exit(struct snd_soc_codec *codec)
-{
-
-}
-static inline void sdm660_cdc_update_int_spk_boost(bool enable)
-{
-
-}
-static inline void msm_anlg_cdc_spk_ext_pa_cb(
- int (*codec_spk_ext_pa)(struct snd_soc_codec *codec,
- int enable), struct snd_soc_codec *codec)
-{
-
-}
-static inline int msm_anlg_codec_info_create_codec_entry(
- struct snd_info_entry *codec_root,
- struct snd_soc_codec *codec)
-{
- return 0;
-}
-#endif /* CONFIG_SND_SOC_ANALOG_CDC */
-#endif
diff --git a/asoc/codecs/sdm660_cdc/msm-cdc-common.h b/asoc/codecs/sdm660_cdc/msm-cdc-common.h
deleted file mode 100644
index 1a490a4..0000000
--- a/asoc/codecs/sdm660_cdc/msm-cdc-common.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Copyright (c) 2016-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
- * 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.
- */
-
-#include <linux/regmap.h>
-#include "sdm660-cdc-registers.h"
-
-extern struct reg_default
- msm89xx_cdc_core_defaults[MSM89XX_CDC_CORE_CACHE_SIZE];
-extern struct reg_default
- msm89xx_pmic_cdc_defaults[MSM89XX_PMIC_CDC_CACHE_SIZE];
-
-bool msm89xx_cdc_core_readable_reg(struct device *dev, unsigned int reg);
-bool msm89xx_cdc_core_writeable_reg(struct device *dev, unsigned int reg);
-bool msm89xx_cdc_core_volatile_reg(struct device *dev, unsigned int reg);
-
-enum {
- AIF1_PB = 0,
- AIF1_CAP,
- AIF2_VIFEED,
- AIF3_SVA,
- NUM_CODEC_DAIS,
-};
-
-enum codec_versions {
- TOMBAK_1_0,
- TOMBAK_2_0,
- CONGA,
- CAJON,
- CAJON_2_0,
- DIANGU,
- DRAX_CDC,
- UNSUPPORTED,
-};
-
-/* Support different hph modes */
-enum {
- NORMAL_MODE = 0,
- HD2_MODE,
-};
-
-enum dig_cdc_notify_event {
- DIG_CDC_EVENT_INVALID,
- DIG_CDC_EVENT_CLK_ON,
- DIG_CDC_EVENT_CLK_OFF,
- DIG_CDC_EVENT_RX1_MUTE_ON,
- DIG_CDC_EVENT_RX1_MUTE_OFF,
- DIG_CDC_EVENT_RX2_MUTE_ON,
- DIG_CDC_EVENT_RX2_MUTE_OFF,
- DIG_CDC_EVENT_RX3_MUTE_ON,
- DIG_CDC_EVENT_RX3_MUTE_OFF,
- DIG_CDC_EVENT_PRE_RX1_INT_ON,
- DIG_CDC_EVENT_PRE_RX2_INT_ON,
- DIG_CDC_EVENT_POST_RX1_INT_OFF,
- DIG_CDC_EVENT_POST_RX2_INT_OFF,
- DIG_CDC_EVENT_SSR_DOWN,
- DIG_CDC_EVENT_SSR_UP,
- DIG_CDC_EVENT_LAST,
-};
diff --git a/asoc/codecs/sdm660_cdc/msm-digital-cdc-regmap.c b/asoc/codecs/sdm660_cdc/msm-digital-cdc-regmap.c
deleted file mode 100644
index a626791..0000000
--- a/asoc/codecs/sdm660_cdc/msm-digital-cdc-regmap.c
+++ /dev/null
@@ -1,452 +0,0 @@
-/*
- * Copyright (c) 2015-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
- * 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.
- */
-
-#include <linux/regmap.h>
-#include "msm-cdc-common.h"
-#include "sdm660-cdc-registers.h"
-
-/*
- * Default register reset values that are common across different versions
- * are defined here. If a register reset value is changed based on version
- * then remove it from this structure and add it in version specific
- * structures.
- */
-struct reg_default
- msm89xx_cdc_core_defaults[MSM89XX_CDC_CORE_CACHE_SIZE] = {
- {MSM89XX_CDC_CORE_CLK_RX_RESET_CTL, 0x00},
- {MSM89XX_CDC_CORE_CLK_TX_RESET_B1_CTL, 0x00},
- {MSM89XX_CDC_CORE_CLK_DMIC_B1_CTL, 0x00},
- {MSM89XX_CDC_CORE_CLK_RX_I2S_CTL, 0x13},
- {MSM89XX_CDC_CORE_CLK_TX_I2S_CTL, 0x13},
- {MSM89XX_CDC_CORE_CLK_OTHR_RESET_B1_CTL, 0x00},
- {MSM89XX_CDC_CORE_CLK_TX_CLK_EN_B1_CTL, 0x00},
- {MSM89XX_CDC_CORE_CLK_OTHR_CTL, 0x04},
- {MSM89XX_CDC_CORE_CLK_RX_B1_CTL, 0x00},
- {MSM89XX_CDC_CORE_CLK_MCLK_CTL, 0x00},
- {MSM89XX_CDC_CORE_CLK_PDM_CTL, 0x00},
- {MSM89XX_CDC_CORE_CLK_SD_CTL, 0x00},
- {MSM89XX_CDC_CORE_CLK_DMIC_B2_CTL, 0x00},
- {MSM89XX_CDC_CORE_CLK_RX_B2_CTL, 0x00},
- {MSM89XX_CDC_CORE_CLK_TX2_I2S_CTL, 0x13},
- {MSM89XX_CDC_CORE_RX1_B1_CTL, 0x00},
- {MSM89XX_CDC_CORE_RX2_B1_CTL, 0x00},
- {MSM89XX_CDC_CORE_RX3_B1_CTL, 0x00},
- {MSM89XX_CDC_CORE_RX1_B2_CTL, 0x00},
- {MSM89XX_CDC_CORE_RX2_B2_CTL, 0x00},
- {MSM89XX_CDC_CORE_RX3_B2_CTL, 0x00},
- {MSM89XX_CDC_CORE_RX1_B3_CTL, 0x00},
- {MSM89XX_CDC_CORE_RX2_B3_CTL, 0x00},
- {MSM89XX_CDC_CORE_RX3_B3_CTL, 0x00},
- {MSM89XX_CDC_CORE_RX1_B4_CTL, 0x00},
- {MSM89XX_CDC_CORE_RX2_B4_CTL, 0x00},
- {MSM89XX_CDC_CORE_RX3_B4_CTL, 0x00},
- {MSM89XX_CDC_CORE_RX1_B5_CTL, 0x68},
- {MSM89XX_CDC_CORE_RX2_B5_CTL, 0x68},
- {MSM89XX_CDC_CORE_RX3_B5_CTL, 0x68},
- {MSM89XX_CDC_CORE_RX1_B6_CTL, 0x00},
- {MSM89XX_CDC_CORE_RX2_B6_CTL, 0x00},
- {MSM89XX_CDC_CORE_RX3_B6_CTL, 0x00},
- {MSM89XX_CDC_CORE_RX1_VOL_CTL_B1_CTL, 0x00},
- {MSM89XX_CDC_CORE_RX2_VOL_CTL_B1_CTL, 0x00},
- {MSM89XX_CDC_CORE_RX3_VOL_CTL_B1_CTL, 0x00},
- {MSM89XX_CDC_CORE_RX1_VOL_CTL_B2_CTL, 0x00},
- {MSM89XX_CDC_CORE_RX2_VOL_CTL_B2_CTL, 0x00},
- {MSM89XX_CDC_CORE_RX3_VOL_CTL_B2_CTL, 0x00},
- {MSM89XX_CDC_CORE_TOP_GAIN_UPDATE, 0x00},
- {MSM89XX_CDC_CORE_TOP_CTL, 0x01},
- {MSM89XX_CDC_CORE_COMP0_B1_CTL, 0x30},
- {MSM89XX_CDC_CORE_COMP0_B2_CTL, 0xB5},
- {MSM89XX_CDC_CORE_COMP0_B3_CTL, 0x28},
- {MSM89XX_CDC_CORE_COMP0_B4_CTL, 0x37},
- {MSM89XX_CDC_CORE_COMP0_B5_CTL, 0x7F},
- {MSM89XX_CDC_CORE_COMP0_B6_CTL, 0x00},
- {MSM89XX_CDC_CORE_COMP0_SHUT_DOWN_STATUS, 0x03},
- {MSM89XX_CDC_CORE_COMP0_FS_CFG, 0x03},
- {MSM89XX_CDC_CORE_COMP0_DELAY_BUF_CTL, 0x02},
- {MSM89XX_CDC_CORE_DEBUG_DESER1_CTL, 0x00},
- {MSM89XX_CDC_CORE_DEBUG_DESER2_CTL, 0x00},
- {MSM89XX_CDC_CORE_DEBUG_B1_CTL_CFG, 0x00},
- {MSM89XX_CDC_CORE_DEBUG_B2_CTL_CFG, 0x00},
- {MSM89XX_CDC_CORE_DEBUG_B3_CTL_CFG, 0x00},
- {MSM89XX_CDC_CORE_IIR1_GAIN_B1_CTL, 0x00},
- {MSM89XX_CDC_CORE_IIR2_GAIN_B1_CTL, 0x00},
- {MSM89XX_CDC_CORE_IIR1_GAIN_B2_CTL, 0x00},
- {MSM89XX_CDC_CORE_IIR2_GAIN_B2_CTL, 0x00},
- {MSM89XX_CDC_CORE_IIR1_GAIN_B3_CTL, 0x00},
- {MSM89XX_CDC_CORE_IIR2_GAIN_B3_CTL, 0x00},
- {MSM89XX_CDC_CORE_IIR1_GAIN_B4_CTL, 0x00},
- {MSM89XX_CDC_CORE_IIR2_GAIN_B4_CTL, 0x00},
- {MSM89XX_CDC_CORE_IIR1_GAIN_B5_CTL, 0x00},
- {MSM89XX_CDC_CORE_IIR2_GAIN_B5_CTL, 0x00},
- {MSM89XX_CDC_CORE_IIR1_GAIN_B6_CTL, 0x00},
- {MSM89XX_CDC_CORE_IIR2_GAIN_B6_CTL, 0x00},
- {MSM89XX_CDC_CORE_IIR1_GAIN_B7_CTL, 0x00},
- {MSM89XX_CDC_CORE_IIR2_GAIN_B7_CTL, 0x00},
- {MSM89XX_CDC_CORE_IIR1_GAIN_B8_CTL, 0x00},
- {MSM89XX_CDC_CORE_IIR2_GAIN_B8_CTL, 0x00},
- {MSM89XX_CDC_CORE_IIR1_CTL, 0x40},
- {MSM89XX_CDC_CORE_IIR2_CTL, 0x40},
- {MSM89XX_CDC_CORE_IIR1_GAIN_TIMER_CTL, 0x00},
- {MSM89XX_CDC_CORE_IIR2_GAIN_TIMER_CTL, 0x00},
- {MSM89XX_CDC_CORE_IIR1_COEF_B1_CTL, 0x00},
- {MSM89XX_CDC_CORE_IIR2_COEF_B1_CTL, 0x00},
- {MSM89XX_CDC_CORE_IIR1_COEF_B2_CTL, 0x00},
- {MSM89XX_CDC_CORE_IIR2_COEF_B2_CTL, 0x00},
- {MSM89XX_CDC_CORE_CONN_RX1_B1_CTL, 0x00},
- {MSM89XX_CDC_CORE_CONN_RX1_B2_CTL, 0x00},
- {MSM89XX_CDC_CORE_CONN_RX1_B3_CTL, 0x00},
- {MSM89XX_CDC_CORE_CONN_RX2_B1_CTL, 0x00},
- {MSM89XX_CDC_CORE_CONN_RX2_B2_CTL, 0x00},
- {MSM89XX_CDC_CORE_CONN_RX2_B3_CTL, 0x00},
- {MSM89XX_CDC_CORE_CONN_RX3_B1_CTL, 0x00},
- {MSM89XX_CDC_CORE_CONN_RX3_B2_CTL, 0x00},
- {MSM89XX_CDC_CORE_CONN_TX_B1_CTL, 0x00},
- {MSM89XX_CDC_CORE_CONN_TX_B2_CTL, 0x00},
- {MSM89XX_CDC_CORE_CONN_EQ1_B1_CTL, 0x00},
- {MSM89XX_CDC_CORE_CONN_EQ1_B2_CTL, 0x00},
- {MSM89XX_CDC_CORE_CONN_EQ1_B3_CTL, 0x00},
- {MSM89XX_CDC_CORE_CONN_EQ1_B4_CTL, 0x00},
- {MSM89XX_CDC_CORE_CONN_EQ2_B1_CTL, 0x00},
- {MSM89XX_CDC_CORE_CONN_EQ2_B2_CTL, 0x00},
- {MSM89XX_CDC_CORE_CONN_EQ2_B3_CTL, 0x00},
- {MSM89XX_CDC_CORE_CONN_EQ2_B4_CTL, 0x00},
- {MSM89XX_CDC_CORE_CONN_TX_I2S_SD1_CTL, 0x00},
- {MSM89XX_CDC_CORE_CONN_TX_B3_CTL, 0x00},
- {MSM89XX_CDC_CORE_TX5_VOL_CTL_TIMER, 0x00},
- {MSM89XX_CDC_CORE_TX5_VOL_CTL_GAIN, 0x00},
- {MSM89XX_CDC_CORE_TX5_VOL_CTL_CFG, 0x00},
- {MSM89XX_CDC_CORE_TX5_MUX_CTL, 0x00},
- {MSM89XX_CDC_CORE_TX5_CLK_FS_CTL, 0x03},
- {MSM89XX_CDC_CORE_TX5_DMIC_CTL, 0x00},
- {MSM89XX_CDC_CORE_TX1_VOL_CTL_TIMER, 0x00},
- {MSM89XX_CDC_CORE_TX2_VOL_CTL_TIMER, 0x00},
- {MSM89XX_CDC_CORE_TX3_VOL_CTL_TIMER, 0x00},
- {MSM89XX_CDC_CORE_TX4_VOL_CTL_TIMER, 0x00},
- {MSM89XX_CDC_CORE_TX1_VOL_CTL_GAIN, 0x00},
- {MSM89XX_CDC_CORE_TX2_VOL_CTL_GAIN, 0x00},
- {MSM89XX_CDC_CORE_TX3_VOL_CTL_GAIN, 0x00},
- {MSM89XX_CDC_CORE_TX4_VOL_CTL_GAIN, 0x00},
- {MSM89XX_CDC_CORE_TX1_VOL_CTL_CFG, 0x00},
- {MSM89XX_CDC_CORE_TX2_VOL_CTL_CFG, 0x00},
- {MSM89XX_CDC_CORE_TX3_VOL_CTL_CFG, 0x00},
- {MSM89XX_CDC_CORE_TX4_VOL_CTL_CFG, 0x00},
- {MSM89XX_CDC_CORE_TX1_MUX_CTL, 0x00},
- {MSM89XX_CDC_CORE_TX2_MUX_CTL, 0x00},
- {MSM89XX_CDC_CORE_TX3_MUX_CTL, 0x00},
- {MSM89XX_CDC_CORE_TX4_MUX_CTL, 0x00},
- {MSM89XX_CDC_CORE_TX1_CLK_FS_CTL, 0x03},
- {MSM89XX_CDC_CORE_TX2_CLK_FS_CTL, 0x03},
- {MSM89XX_CDC_CORE_TX3_CLK_FS_CTL, 0x03},
- {MSM89XX_CDC_CORE_TX4_CLK_FS_CTL, 0x03},
- {MSM89XX_CDC_CORE_TX1_DMIC_CTL, 0x00},
- {MSM89XX_CDC_CORE_TX2_DMIC_CTL, 0x00},
- {MSM89XX_CDC_CORE_TX3_DMIC_CTL, 0x00},
- {MSM89XX_CDC_CORE_TX4_DMIC_CTL, 0x00},
-};
-
-static const u8 msm89xx_cdc_core_reg_readable[MSM89XX_CDC_CORE_CACHE_SIZE] = {
- [MSM89XX_CDC_CORE_CLK_RX_RESET_CTL] = 1,
- [MSM89XX_CDC_CORE_CLK_TX_RESET_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_CLK_DMIC_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_CLK_RX_I2S_CTL] = 1,
- [MSM89XX_CDC_CORE_CLK_TX_I2S_CTL] = 1,
- [MSM89XX_CDC_CORE_CLK_OTHR_RESET_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_CLK_TX_CLK_EN_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_CLK_OTHR_CTL] = 1,
- [MSM89XX_CDC_CORE_CLK_RX_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_CLK_MCLK_CTL] = 1,
- [MSM89XX_CDC_CORE_CLK_PDM_CTL] = 1,
- [MSM89XX_CDC_CORE_CLK_SD_CTL] = 1,
- [MSM89XX_CDC_CORE_CLK_DMIC_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_CLK_RX_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_CLK_TX2_I2S_CTL] = 1,
- [MSM89XX_CDC_CORE_RX1_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_RX2_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_RX3_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_RX1_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_RX2_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_RX3_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_RX1_B3_CTL] = 1,
- [MSM89XX_CDC_CORE_RX2_B3_CTL] = 1,
- [MSM89XX_CDC_CORE_RX3_B3_CTL] = 1,
- [MSM89XX_CDC_CORE_RX1_B4_CTL] = 1,
- [MSM89XX_CDC_CORE_RX2_B4_CTL] = 1,
- [MSM89XX_CDC_CORE_RX3_B4_CTL] = 1,
- [MSM89XX_CDC_CORE_RX1_B5_CTL] = 1,
- [MSM89XX_CDC_CORE_RX2_B5_CTL] = 1,
- [MSM89XX_CDC_CORE_RX3_B5_CTL] = 1,
- [MSM89XX_CDC_CORE_RX1_B6_CTL] = 1,
- [MSM89XX_CDC_CORE_RX2_B6_CTL] = 1,
- [MSM89XX_CDC_CORE_RX3_B6_CTL] = 1,
- [MSM89XX_CDC_CORE_RX1_VOL_CTL_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_RX2_VOL_CTL_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_RX3_VOL_CTL_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_RX1_VOL_CTL_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_RX2_VOL_CTL_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_RX3_VOL_CTL_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_TOP_GAIN_UPDATE] = 1,
- [MSM89XX_CDC_CORE_TOP_CTL] = 1,
- [MSM89XX_CDC_CORE_COMP0_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_COMP0_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_COMP0_B3_CTL] = 1,
- [MSM89XX_CDC_CORE_COMP0_B4_CTL] = 1,
- [MSM89XX_CDC_CORE_COMP0_B5_CTL] = 1,
- [MSM89XX_CDC_CORE_COMP0_B6_CTL] = 1,
- [MSM89XX_CDC_CORE_COMP0_SHUT_DOWN_STATUS] = 1,
- [MSM89XX_CDC_CORE_COMP0_FS_CFG] = 1,
- [MSM89XX_CDC_CORE_COMP0_DELAY_BUF_CTL] = 1,
- [MSM89XX_CDC_CORE_DEBUG_DESER1_CTL] = 1,
- [MSM89XX_CDC_CORE_DEBUG_DESER2_CTL] = 1,
- [MSM89XX_CDC_CORE_DEBUG_B1_CTL_CFG] = 1,
- [MSM89XX_CDC_CORE_DEBUG_B2_CTL_CFG] = 1,
- [MSM89XX_CDC_CORE_DEBUG_B3_CTL_CFG] = 1,
- [MSM89XX_CDC_CORE_IIR1_GAIN_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR2_GAIN_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR1_GAIN_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR2_GAIN_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR1_GAIN_B3_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR2_GAIN_B3_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR1_GAIN_B4_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR2_GAIN_B4_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR1_GAIN_B5_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR2_GAIN_B5_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR1_GAIN_B6_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR2_GAIN_B6_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR1_GAIN_B7_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR2_GAIN_B7_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR1_GAIN_B8_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR2_GAIN_B8_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR1_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR2_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR1_GAIN_TIMER_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR2_GAIN_TIMER_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR1_COEF_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR2_COEF_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR1_COEF_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR2_COEF_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_RX1_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_RX1_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_RX1_B3_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_RX2_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_RX2_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_RX2_B3_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_RX3_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_RX3_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_TX_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_TX_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_EQ1_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_EQ1_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_EQ1_B3_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_EQ1_B4_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_EQ2_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_EQ2_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_EQ2_B3_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_EQ2_B4_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_TX_I2S_SD1_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_TX_B3_CTL] = 1,
- [MSM89XX_CDC_CORE_TX1_VOL_CTL_TIMER] = 1,
- [MSM89XX_CDC_CORE_TX2_VOL_CTL_TIMER] = 1,
- [MSM89XX_CDC_CORE_TX3_VOL_CTL_TIMER] = 1,
- [MSM89XX_CDC_CORE_TX4_VOL_CTL_TIMER] = 1,
- [MSM89XX_CDC_CORE_TX1_VOL_CTL_GAIN] = 1,
- [MSM89XX_CDC_CORE_TX2_VOL_CTL_GAIN] = 1,
- [MSM89XX_CDC_CORE_TX3_VOL_CTL_GAIN] = 1,
- [MSM89XX_CDC_CORE_TX4_VOL_CTL_GAIN] = 1,
- [MSM89XX_CDC_CORE_TX1_VOL_CTL_CFG] = 1,
- [MSM89XX_CDC_CORE_TX2_VOL_CTL_CFG] = 1,
- [MSM89XX_CDC_CORE_TX3_VOL_CTL_CFG] = 1,
- [MSM89XX_CDC_CORE_TX4_VOL_CTL_CFG] = 1,
- [MSM89XX_CDC_CORE_TX1_MUX_CTL] = 1,
- [MSM89XX_CDC_CORE_TX2_MUX_CTL] = 1,
- [MSM89XX_CDC_CORE_TX3_MUX_CTL] = 1,
- [MSM89XX_CDC_CORE_TX4_MUX_CTL] = 1,
- [MSM89XX_CDC_CORE_TX1_CLK_FS_CTL] = 1,
- [MSM89XX_CDC_CORE_TX2_CLK_FS_CTL] = 1,
- [MSM89XX_CDC_CORE_TX3_CLK_FS_CTL] = 1,
- [MSM89XX_CDC_CORE_TX4_CLK_FS_CTL] = 1,
- [MSM89XX_CDC_CORE_TX5_VOL_CTL_TIMER] = 1,
- [MSM89XX_CDC_CORE_TX5_VOL_CTL_GAIN] = 1,
- [MSM89XX_CDC_CORE_TX5_VOL_CTL_CFG] = 1,
- [MSM89XX_CDC_CORE_TX5_MUX_CTL] = 1,
- [MSM89XX_CDC_CORE_TX5_CLK_FS_CTL] = 1,
- [MSM89XX_CDC_CORE_TX5_DMIC_CTL] = 1,
- [MSM89XX_CDC_CORE_TX1_DMIC_CTL] = 1,
- [MSM89XX_CDC_CORE_TX2_DMIC_CTL] = 1,
- [MSM89XX_CDC_CORE_TX3_DMIC_CTL] = 1,
- [MSM89XX_CDC_CORE_TX4_DMIC_CTL] = 1,
-};
-
-static const u8 msm89xx_cdc_core_reg_writeable[MSM89XX_CDC_CORE_CACHE_SIZE] = {
- [MSM89XX_CDC_CORE_CLK_RX_RESET_CTL] = 1,
- [MSM89XX_CDC_CORE_CLK_TX_RESET_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_CLK_DMIC_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_CLK_RX_I2S_CTL] = 1,
- [MSM89XX_CDC_CORE_CLK_TX_I2S_CTL] = 1,
- [MSM89XX_CDC_CORE_CLK_OTHR_RESET_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_CLK_TX_CLK_EN_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_CLK_OTHR_CTL] = 1,
- [MSM89XX_CDC_CORE_CLK_RX_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_CLK_MCLK_CTL] = 1,
- [MSM89XX_CDC_CORE_CLK_PDM_CTL] = 1,
- [MSM89XX_CDC_CORE_CLK_SD_CTL] = 1,
- [MSM89XX_CDC_CORE_CLK_DMIC_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_CLK_RX_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_CLK_TX2_I2S_CTL] = 1,
- [MSM89XX_CDC_CORE_RX1_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_RX2_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_RX3_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_RX1_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_RX2_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_RX3_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_RX1_B3_CTL] = 1,
- [MSM89XX_CDC_CORE_RX2_B3_CTL] = 1,
- [MSM89XX_CDC_CORE_RX3_B3_CTL] = 1,
- [MSM89XX_CDC_CORE_RX1_B4_CTL] = 1,
- [MSM89XX_CDC_CORE_RX2_B4_CTL] = 1,
- [MSM89XX_CDC_CORE_RX3_B4_CTL] = 1,
- [MSM89XX_CDC_CORE_RX1_B5_CTL] = 1,
- [MSM89XX_CDC_CORE_RX2_B5_CTL] = 1,
- [MSM89XX_CDC_CORE_RX3_B5_CTL] = 1,
- [MSM89XX_CDC_CORE_RX1_B6_CTL] = 1,
- [MSM89XX_CDC_CORE_RX2_B6_CTL] = 1,
- [MSM89XX_CDC_CORE_RX3_B6_CTL] = 1,
- [MSM89XX_CDC_CORE_RX1_VOL_CTL_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_RX2_VOL_CTL_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_RX3_VOL_CTL_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_RX1_VOL_CTL_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_RX2_VOL_CTL_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_RX3_VOL_CTL_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_TOP_GAIN_UPDATE] = 1,
- [MSM89XX_CDC_CORE_TOP_CTL] = 1,
- [MSM89XX_CDC_CORE_COMP0_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_COMP0_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_COMP0_B3_CTL] = 1,
- [MSM89XX_CDC_CORE_COMP0_B4_CTL] = 1,
- [MSM89XX_CDC_CORE_COMP0_B5_CTL] = 1,
- [MSM89XX_CDC_CORE_COMP0_B6_CTL] = 1,
- [MSM89XX_CDC_CORE_COMP0_FS_CFG] = 1,
- [MSM89XX_CDC_CORE_COMP0_DELAY_BUF_CTL] = 1,
- [MSM89XX_CDC_CORE_DEBUG_DESER1_CTL] = 1,
- [MSM89XX_CDC_CORE_DEBUG_DESER2_CTL] = 1,
- [MSM89XX_CDC_CORE_DEBUG_B1_CTL_CFG] = 1,
- [MSM89XX_CDC_CORE_DEBUG_B2_CTL_CFG] = 1,
- [MSM89XX_CDC_CORE_DEBUG_B3_CTL_CFG] = 1,
- [MSM89XX_CDC_CORE_IIR1_GAIN_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR2_GAIN_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR1_GAIN_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR2_GAIN_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR1_GAIN_B3_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR2_GAIN_B3_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR1_GAIN_B4_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR2_GAIN_B4_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR1_GAIN_B5_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR2_GAIN_B5_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR1_GAIN_B6_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR2_GAIN_B6_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR1_GAIN_B7_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR2_GAIN_B7_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR1_GAIN_B8_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR2_GAIN_B8_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR1_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR2_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR1_GAIN_TIMER_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR2_GAIN_TIMER_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR1_COEF_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR2_COEF_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR1_COEF_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_IIR2_COEF_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_RX1_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_RX1_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_RX1_B3_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_RX2_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_RX2_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_RX2_B3_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_RX3_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_RX3_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_TX_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_TX_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_EQ1_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_EQ1_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_EQ1_B3_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_EQ1_B4_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_EQ2_B1_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_EQ2_B2_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_EQ2_B3_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_EQ2_B4_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_TX_I2S_SD1_CTL] = 1,
- [MSM89XX_CDC_CORE_CONN_TX_B3_CTL] = 1,
- [MSM89XX_CDC_CORE_TX1_VOL_CTL_TIMER] = 1,
- [MSM89XX_CDC_CORE_TX2_VOL_CTL_TIMER] = 1,
- [MSM89XX_CDC_CORE_TX3_VOL_CTL_TIMER] = 1,
- [MSM89XX_CDC_CORE_TX4_VOL_CTL_TIMER] = 1,
- [MSM89XX_CDC_CORE_TX1_VOL_CTL_GAIN] = 1,
- [MSM89XX_CDC_CORE_TX2_VOL_CTL_GAIN] = 1,
- [MSM89XX_CDC_CORE_TX3_VOL_CTL_GAIN] = 1,
- [MSM89XX_CDC_CORE_TX4_VOL_CTL_GAIN] = 1,
- [MSM89XX_CDC_CORE_TX1_VOL_CTL_CFG] = 1,
- [MSM89XX_CDC_CORE_TX2_VOL_CTL_CFG] = 1,
- [MSM89XX_CDC_CORE_TX3_VOL_CTL_CFG] = 1,
- [MSM89XX_CDC_CORE_TX4_VOL_CTL_CFG] = 1,
- [MSM89XX_CDC_CORE_TX1_MUX_CTL] = 1,
- [MSM89XX_CDC_CORE_TX2_MUX_CTL] = 1,
- [MSM89XX_CDC_CORE_TX3_MUX_CTL] = 1,
- [MSM89XX_CDC_CORE_TX4_MUX_CTL] = 1,
- [MSM89XX_CDC_CORE_TX1_CLK_FS_CTL] = 1,
- [MSM89XX_CDC_CORE_TX2_CLK_FS_CTL] = 1,
- [MSM89XX_CDC_CORE_TX3_CLK_FS_CTL] = 1,
- [MSM89XX_CDC_CORE_TX4_CLK_FS_CTL] = 1,
- [MSM89XX_CDC_CORE_TX5_VOL_CTL_TIMER] = 1,
- [MSM89XX_CDC_CORE_TX5_VOL_CTL_GAIN] = 1,
- [MSM89XX_CDC_CORE_TX5_VOL_CTL_CFG] = 1,
- [MSM89XX_CDC_CORE_TX5_MUX_CTL] = 1,
- [MSM89XX_CDC_CORE_TX5_CLK_FS_CTL] = 1,
- [MSM89XX_CDC_CORE_TX5_DMIC_CTL] = 1,
- [MSM89XX_CDC_CORE_TX1_DMIC_CTL] = 1,
- [MSM89XX_CDC_CORE_TX2_DMIC_CTL] = 1,
- [MSM89XX_CDC_CORE_TX3_DMIC_CTL] = 1,
- [MSM89XX_CDC_CORE_TX4_DMIC_CTL] = 1,
-};
-
-bool msm89xx_cdc_core_readable_reg(struct device *dev, unsigned int reg)
-{
- return msm89xx_cdc_core_reg_readable[reg];
-}
-
-bool msm89xx_cdc_core_writeable_reg(struct device *dev, unsigned int reg)
-{
- return msm89xx_cdc_core_reg_writeable[reg];
-}
-
-bool msm89xx_cdc_core_volatile_reg(struct device *dev, unsigned int reg)
-{
- switch (reg) {
- case MSM89XX_CDC_CORE_RX1_B1_CTL:
- case MSM89XX_CDC_CORE_RX2_B1_CTL:
- case MSM89XX_CDC_CORE_RX3_B1_CTL:
- case MSM89XX_CDC_CORE_RX1_B6_CTL:
- case MSM89XX_CDC_CORE_RX2_B6_CTL:
- case MSM89XX_CDC_CORE_RX3_B6_CTL:
- case MSM89XX_CDC_CORE_TX1_VOL_CTL_CFG:
- case MSM89XX_CDC_CORE_TX2_VOL_CTL_CFG:
- case MSM89XX_CDC_CORE_TX3_VOL_CTL_CFG:
- case MSM89XX_CDC_CORE_TX4_VOL_CTL_CFG:
- case MSM89XX_CDC_CORE_TX5_VOL_CTL_CFG:
- case MSM89XX_CDC_CORE_IIR1_COEF_B1_CTL:
- case MSM89XX_CDC_CORE_IIR2_COEF_B1_CTL:
- case MSM89XX_CDC_CORE_CLK_MCLK_CTL:
- case MSM89XX_CDC_CORE_CLK_PDM_CTL:
- return true;
- default:
- return false;
- }
-}
diff --git a/asoc/codecs/sdm660_cdc/msm-digital-cdc.c b/asoc/codecs/sdm660_cdc/msm-digital-cdc.c
deleted file mode 100644
index 2c3d0d6..0000000
--- a/asoc/codecs/sdm660_cdc/msm-digital-cdc.c
+++ /dev/null
@@ -1,2213 +0,0 @@
-/* Copyright (c) 2015-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
- * 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.
- */
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/io.h>
-#include <linux/platform_device.h>
-#include <linux/printk.h>
-#include <linux/debugfs.h>
-#include <linux/delay.h>
-#include <linux/workqueue.h>
-#include <linux/regmap.h>
-#include <sound/pcm.h>
-#include <sound/pcm_params.h>
-#include <sound/soc.h>
-#include <sound/soc-dapm.h>
-#include <sound/tlv.h>
-#include <dsp/q6afe-v2.h>
-#include <ipc/apr.h>
-#include <soc/internal.h>
-#include "sdm660-cdc-registers.h"
-#include "msm-digital-cdc.h"
-#include "msm-cdc-common.h"
-#include "../../sdm660-common.h"
-
-#define DRV_NAME "msm_digital_codec"
-#define MCLK_RATE_9P6MHZ 9600000
-#define MCLK_RATE_12P288MHZ 12288000
-#define TX_MUX_CTL_CUT_OFF_FREQ_MASK 0x30
-#define CF_MIN_3DB_4HZ 0x0
-#define CF_MIN_3DB_75HZ 0x1
-#define CF_MIN_3DB_150HZ 0x2
-
-#define MSM_DIG_CDC_VERSION_ENTRY_SIZE 32
-
-static unsigned long rx_digital_gain_reg[] = {
- MSM89XX_CDC_CORE_RX1_VOL_CTL_B2_CTL,
- MSM89XX_CDC_CORE_RX2_VOL_CTL_B2_CTL,
- MSM89XX_CDC_CORE_RX3_VOL_CTL_B2_CTL,
-};
-
-static unsigned long tx_digital_gain_reg[] = {
- MSM89XX_CDC_CORE_TX1_VOL_CTL_GAIN,
- MSM89XX_CDC_CORE_TX2_VOL_CTL_GAIN,
- MSM89XX_CDC_CORE_TX3_VOL_CTL_GAIN,
- MSM89XX_CDC_CORE_TX4_VOL_CTL_GAIN,
- MSM89XX_CDC_CORE_TX5_VOL_CTL_GAIN,
-};
-
-#define SDM660_TX_UNMUTE_DELAY_MS 40
-static int tx_unmute_delay = SDM660_TX_UNMUTE_DELAY_MS;
-module_param(tx_unmute_delay, int, 0664);
-MODULE_PARM_DESC(tx_unmute_delay, "delay to unmute the tx path");
-
-static const DECLARE_TLV_DB_SCALE(digital_gain, 0, 1, 0);
-
-struct snd_soc_codec *registered_digcodec;
-struct hpf_work tx_hpf_work[NUM_DECIMATORS];
-
-/* Codec supports 2 IIR filters */
-enum {
- IIR1 = 0,
- IIR2,
- IIR_MAX,
-};
-
-static int msm_digcdc_clock_control(bool flag)
-{
- int ret = -EINVAL;
- struct msm_asoc_mach_data *pdata = NULL;
- struct msm_dig_priv *msm_dig_cdc =
- snd_soc_codec_get_drvdata(registered_digcodec);
-
- pdata = snd_soc_card_get_drvdata(registered_digcodec->component.card);
-
- if (flag) {
- mutex_lock(&pdata->cdc_int_mclk0_mutex);
- if (atomic_read(&pdata->int_mclk0_enabled) == false) {
- if (pdata->native_clk_set)
- pdata->digital_cdc_core_clk.clk_freq_in_hz =
- NATIVE_MCLK_RATE;
- else
- pdata->digital_cdc_core_clk.clk_freq_in_hz =
- DEFAULT_MCLK_RATE;
- pdata->digital_cdc_core_clk.enable = 1;
- ret = afe_set_lpass_clock_v2(
- AFE_PORT_ID_INT0_MI2S_RX,
- &pdata->digital_cdc_core_clk);
- if (ret < 0) {
- pr_err("%s:failed to enable the MCLK\n",
- __func__);
- /*
- * Avoid access to lpass register
- * as clock enable failed during SSR.
- */
- if (ret == -ENODEV)
- msm_dig_cdc->regmap->cache_only = true;
- return ret;
- }
- pr_debug("enabled digital codec core clk\n");
- atomic_set(&pdata->int_mclk0_enabled, true);
- schedule_delayed_work(&pdata->disable_int_mclk0_work,
- 50);
- }
- } else {
- mutex_unlock(&pdata->cdc_int_mclk0_mutex);
- dev_dbg(registered_digcodec->dev,
- "disable MCLK, workq to disable set already\n");
- }
- return 0;
-}
-
-static void enable_digital_callback(void *flag)
-{
- msm_digcdc_clock_control(true);
-}
-
-static void disable_digital_callback(void *flag)
-{
- msm_digcdc_clock_control(false);
- pr_debug("disable mclk happens in workq\n");
-}
-
-static int msm_dig_cdc_put_dec_enum(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_dapm_widget *w = snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
- unsigned int dec_mux, decimator;
- char *dec_name = NULL;
- char *widget_name = NULL;
- char *temp;
- u16 tx_mux_ctl_reg;
- u8 adc_dmic_sel = 0x0;
- int ret = 0;
- char *dec_num;
-
- if (ucontrol->value.enumerated.item[0] > e->items) {
- dev_err(codec->dev, "%s: Invalid enum value: %d\n",
- __func__, ucontrol->value.enumerated.item[0]);
- return -EINVAL;
- }
- dec_mux = ucontrol->value.enumerated.item[0];
-
- widget_name = kstrndup(w->name, 15, GFP_KERNEL);
- if (!widget_name) {
- dev_err(codec->dev, "%s: failed to copy string\n",
- __func__);
- return -ENOMEM;
- }
- temp = widget_name;
-
- dec_name = strsep(&widget_name, " ");
- widget_name = temp;
- if (!dec_name) {
- dev_err(codec->dev, "%s: Invalid decimator = %s\n",
- __func__, w->name);
- ret = -EINVAL;
- goto out;
- }
-
- dec_num = strpbrk(dec_name, "12345");
- if (dec_num == NULL) {
- dev_err(codec->dev, "%s: Invalid DEC selected\n", __func__);
- ret = -EINVAL;
- goto out;
- }
-
- ret = kstrtouint(dec_num, 10, &decimator);
- if (ret < 0) {
- dev_err(codec->dev, "%s: Invalid decimator = %s\n",
- __func__, dec_name);
- ret = -EINVAL;
- goto out;
- }
-
- dev_dbg(w->dapm->dev, "%s(): widget = %s decimator = %u dec_mux = %u\n"
- , __func__, w->name, decimator, dec_mux);
-
- switch (decimator) {
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- if ((dec_mux == 4) || (dec_mux == 5) ||
- (dec_mux == 6) || (dec_mux == 7))
- adc_dmic_sel = 0x1;
- else
- adc_dmic_sel = 0x0;
- break;
- default:
- dev_err(codec->dev, "%s: Invalid Decimator = %u\n",
- __func__, decimator);
- ret = -EINVAL;
- goto out;
- }
-
- tx_mux_ctl_reg =
- MSM89XX_CDC_CORE_TX1_MUX_CTL + 32 * (decimator - 1);
-
- snd_soc_update_bits(codec, tx_mux_ctl_reg, 0x1, adc_dmic_sel);
-
- ret = snd_soc_dapm_put_enum_double(kcontrol, ucontrol);
-
-out:
- kfree(widget_name);
- return ret;
-}
-
-
-static int msm_dig_cdc_codec_config_compander(struct snd_soc_codec *codec,
- int interp_n, int event)
-{
- struct msm_dig_priv *dig_cdc = snd_soc_codec_get_drvdata(codec);
- int comp_ch_bits_set = 0x03;
- int comp_ch_value;
-
- dev_dbg(codec->dev, "%s: event %d shift %d, enabled %d\n",
- __func__, event, interp_n,
- dig_cdc->comp_enabled[interp_n]);
-
- /* compander is invalid */
- if (dig_cdc->comp_enabled[interp_n] != COMPANDER_1 &&
- dig_cdc->comp_enabled[interp_n]) {
- dev_dbg(codec->dev, "%s: Invalid compander %d\n", __func__,
- dig_cdc->comp_enabled[interp_n]);
- return 0;
- }
-
- if (SND_SOC_DAPM_EVENT_ON(event)) {
- /* compander is not enabled */
- if (!dig_cdc->comp_enabled[interp_n]) {
- dig_cdc->set_compander_mode(dig_cdc->handle, 0x00);
- return 0;
- };
- comp_ch_value = snd_soc_read(codec,
- MSM89XX_CDC_CORE_COMP0_B1_CTL);
- if (interp_n == 0) {
- if (comp_ch_value & 0x02) {
- dev_dbg(codec->dev,
- "%s comp ch 1 already enabled\n",
- __func__);
- return 0;
- }
- }
- if (interp_n == 1) {
- if (comp_ch_value & 0x01) {
- dev_dbg(codec->dev,
- "%s comp ch 0 already enabled\n",
- __func__);
- return 0;
- }
- }
- dig_cdc->set_compander_mode(dig_cdc->handle, 0x08);
- /* Enable Compander Clock */
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_COMP0_B2_CTL, 0x0F, 0x09);
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_CLK_RX_B2_CTL, 0x01, 0x01);
- if (dig_cdc->comp_enabled[MSM89XX_RX1]) {
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_COMP0_B1_CTL,
- 0x02, 0x02);
- }
- if (dig_cdc->comp_enabled[MSM89XX_RX2]) {
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_COMP0_B1_CTL,
- 0x01, 0x01);
- }
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_COMP0_B3_CTL, 0xFF, 0x01);
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_COMP0_B2_CTL, 0xF0, 0x50);
- /* add sleep for compander to settle */
- usleep_range(1000, 1100);
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_COMP0_B3_CTL, 0xFF, 0x28);
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_COMP0_B2_CTL, 0xF0, 0xB0);
-
- /* Enable Compander GPIO */
- if (dig_cdc->codec_hph_comp_gpio)
- dig_cdc->codec_hph_comp_gpio(1, codec);
- } else if (SND_SOC_DAPM_EVENT_OFF(event)) {
- /* Disable Compander GPIO */
- if (dig_cdc->codec_hph_comp_gpio)
- dig_cdc->codec_hph_comp_gpio(0, codec);
-
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_COMP0_B1_CTL,
- 1 << interp_n, 0);
- comp_ch_bits_set = snd_soc_read(codec,
- MSM89XX_CDC_CORE_COMP0_B1_CTL);
- if ((comp_ch_bits_set & 0x03) == 0x00) {
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_COMP0_B2_CTL, 0x0F, 0x05);
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_CLK_RX_B2_CTL, 0x01, 0x00);
- }
- }
- return 0;
-}
-
-/**
- * msm_dig_cdc_hph_comp_cb - registers callback to codec by machine driver.
- *
- * @codec_hph_comp_gpio: function pointer to set comp gpio at machine driver
- * @codec: codec pointer
- *
- */
-void msm_dig_cdc_hph_comp_cb(
- int (*codec_hph_comp_gpio)(bool enable, struct snd_soc_codec *codec),
- struct snd_soc_codec *codec)
-{
- struct msm_dig_priv *dig_cdc = snd_soc_codec_get_drvdata(codec);
-
- pr_debug("%s: Enter\n", __func__);
- dig_cdc->codec_hph_comp_gpio = codec_hph_comp_gpio;
-}
-EXPORT_SYMBOL(msm_dig_cdc_hph_comp_cb);
-
-static int msm_dig_cdc_codec_enable_interpolator(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct msm_dig_priv *msm_dig_cdc = snd_soc_codec_get_drvdata(codec);
-
- dev_dbg(codec->dev, "%s %d %s\n", __func__, event, w->name);
-
- if (w->shift >= MSM89XX_RX_MAX || w->shift < 0) {
- dev_err(codec->dev, "%s: wrong RX index: %d\n",
- __func__, w->shift);
- return -EINVAL;
- }
- switch (event) {
- case SND_SOC_DAPM_POST_PMU:
- msm_dig_cdc_codec_config_compander(codec, w->shift, event);
- /* apply the digital gain after the interpolator is enabled*/
- if ((w->shift) < ARRAY_SIZE(rx_digital_gain_reg))
- snd_soc_write(codec,
- rx_digital_gain_reg[w->shift],
- snd_soc_read(codec,
- rx_digital_gain_reg[w->shift])
- );
- break;
- case SND_SOC_DAPM_POST_PMD:
- msm_dig_cdc_codec_config_compander(codec, w->shift, event);
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_CLK_RX_RESET_CTL,
- 1 << w->shift, 1 << w->shift);
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_CLK_RX_RESET_CTL,
- 1 << w->shift, 0x0);
- /*
- * disable the mute enabled during the PMD of this device
- */
- if ((w->shift == 0) &&
- (msm_dig_cdc->mute_mask & HPHL_PA_DISABLE)) {
- pr_debug("disabling HPHL mute\n");
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_RX1_B6_CTL, 0x01, 0x00);
- msm_dig_cdc->mute_mask &= ~(HPHL_PA_DISABLE);
- } else if ((w->shift == 1) &&
- (msm_dig_cdc->mute_mask & HPHR_PA_DISABLE)) {
- pr_debug("disabling HPHR mute\n");
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_RX2_B6_CTL, 0x01, 0x00);
- msm_dig_cdc->mute_mask &= ~(HPHR_PA_DISABLE);
- } else if ((w->shift == 2) &&
- (msm_dig_cdc->mute_mask & SPKR_PA_DISABLE)) {
- pr_debug("disabling SPKR mute\n");
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_RX3_B6_CTL, 0x01, 0x00);
- msm_dig_cdc->mute_mask &= ~(SPKR_PA_DISABLE);
- }
- }
- return 0;
-}
-
-static int msm_dig_cdc_get_iir_enable_audio_mixer(
- struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- int iir_idx = ((struct soc_multi_mixer_control *)
- kcontrol->private_value)->reg;
- int band_idx = ((struct soc_multi_mixer_control *)
- kcontrol->private_value)->shift;
-
- ucontrol->value.integer.value[0] =
- (snd_soc_read(codec,
- (MSM89XX_CDC_CORE_IIR1_CTL + 64 * iir_idx)) &
- (1 << band_idx)) != 0;
-
- dev_dbg(codec->dev, "%s: IIR #%d band #%d enable %d\n", __func__,
- iir_idx, band_idx,
- (uint32_t)ucontrol->value.integer.value[0]);
- return 0;
-}
-
-static int msm_dig_cdc_put_iir_enable_audio_mixer(
- struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- int iir_idx = ((struct soc_multi_mixer_control *)
- kcontrol->private_value)->reg;
- int band_idx = ((struct soc_multi_mixer_control *)
- kcontrol->private_value)->shift;
- int value = ucontrol->value.integer.value[0];
-
- /* Mask first 5 bits, 6-8 are reserved */
- snd_soc_update_bits(codec,
- (MSM89XX_CDC_CORE_IIR1_CTL + 64 * iir_idx),
- (1 << band_idx), (value << band_idx));
-
- dev_dbg(codec->dev, "%s: IIR #%d band #%d enable %d\n", __func__,
- iir_idx, band_idx,
- ((snd_soc_read(codec,
- (MSM89XX_CDC_CORE_IIR1_CTL + 64 * iir_idx)) &
- (1 << band_idx)) != 0));
-
- return 0;
-}
-
-static uint32_t get_iir_band_coeff(struct snd_soc_codec *codec,
- int iir_idx, int band_idx,
- int coeff_idx)
-{
- uint32_t value = 0;
-
- /* Address does not automatically update if reading */
- snd_soc_write(codec,
- (MSM89XX_CDC_CORE_IIR1_COEF_B1_CTL + 64 * iir_idx),
- ((band_idx * BAND_MAX + coeff_idx)
- * sizeof(uint32_t)) & 0x7F);
-
- value |= snd_soc_read(codec,
- (MSM89XX_CDC_CORE_IIR1_COEF_B2_CTL + 64 * iir_idx));
-
- snd_soc_write(codec,
- (MSM89XX_CDC_CORE_IIR1_COEF_B1_CTL + 64 * iir_idx),
- ((band_idx * BAND_MAX + coeff_idx)
- * sizeof(uint32_t) + 1) & 0x7F);
-
- value |= (snd_soc_read(codec,
- (MSM89XX_CDC_CORE_IIR1_COEF_B2_CTL + 64 * iir_idx)) << 8);
-
- snd_soc_write(codec,
- (MSM89XX_CDC_CORE_IIR1_COEF_B1_CTL + 64 * iir_idx),
- ((band_idx * BAND_MAX + coeff_idx)
- * sizeof(uint32_t) + 2) & 0x7F);
-
- value |= (snd_soc_read(codec,
- (MSM89XX_CDC_CORE_IIR1_COEF_B2_CTL + 64 * iir_idx)) << 16);
-
- snd_soc_write(codec,
- (MSM89XX_CDC_CORE_IIR1_COEF_B1_CTL + 64 * iir_idx),
- ((band_idx * BAND_MAX + coeff_idx)
- * sizeof(uint32_t) + 3) & 0x7F);
-
- /* Mask bits top 2 bits since they are reserved */
- value |= ((snd_soc_read(codec, (MSM89XX_CDC_CORE_IIR1_COEF_B2_CTL
- + 64 * iir_idx)) & 0x3f) << 24);
-
- return value;
-
-}
-
-static void set_iir_band_coeff(struct snd_soc_codec *codec,
- int iir_idx, int band_idx,
- uint32_t value)
-{
- snd_soc_write(codec,
- (MSM89XX_CDC_CORE_IIR1_COEF_B2_CTL + 64 * iir_idx),
- (value & 0xFF));
-
- snd_soc_write(codec,
- (MSM89XX_CDC_CORE_IIR1_COEF_B2_CTL + 64 * iir_idx),
- (value >> 8) & 0xFF);
-
- snd_soc_write(codec,
- (MSM89XX_CDC_CORE_IIR1_COEF_B2_CTL + 64 * iir_idx),
- (value >> 16) & 0xFF);
-
- /* Mask top 2 bits, 7-8 are reserved */
- snd_soc_write(codec,
- (MSM89XX_CDC_CORE_IIR1_COEF_B2_CTL + 64 * iir_idx),
- (value >> 24) & 0x3F);
-
-}
-
-static int msm_dig_cdc_get_iir_band_audio_mixer(
- struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- int iir_idx = ((struct soc_multi_mixer_control *)
- kcontrol->private_value)->reg;
- int band_idx = ((struct soc_multi_mixer_control *)
- kcontrol->private_value)->shift;
-
- ucontrol->value.integer.value[0] =
- get_iir_band_coeff(codec, iir_idx, band_idx, 0);
- ucontrol->value.integer.value[1] =
- get_iir_band_coeff(codec, iir_idx, band_idx, 1);
- ucontrol->value.integer.value[2] =
- get_iir_band_coeff(codec, iir_idx, band_idx, 2);
- ucontrol->value.integer.value[3] =
- get_iir_band_coeff(codec, iir_idx, band_idx, 3);
- ucontrol->value.integer.value[4] =
- get_iir_band_coeff(codec, iir_idx, band_idx, 4);
-
- dev_dbg(codec->dev, "%s: IIR #%d band #%d b0 = 0x%x\n"
- "%s: IIR #%d band #%d b1 = 0x%x\n"
- "%s: IIR #%d band #%d b2 = 0x%x\n"
- "%s: IIR #%d band #%d a1 = 0x%x\n"
- "%s: IIR #%d band #%d a2 = 0x%x\n",
- __func__, iir_idx, band_idx,
- (uint32_t)ucontrol->value.integer.value[0],
- __func__, iir_idx, band_idx,
- (uint32_t)ucontrol->value.integer.value[1],
- __func__, iir_idx, band_idx,
- (uint32_t)ucontrol->value.integer.value[2],
- __func__, iir_idx, band_idx,
- (uint32_t)ucontrol->value.integer.value[3],
- __func__, iir_idx, band_idx,
- (uint32_t)ucontrol->value.integer.value[4]);
- return 0;
-}
-
-static int msm_dig_cdc_put_iir_band_audio_mixer(
- struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- int iir_idx = ((struct soc_multi_mixer_control *)
- kcontrol->private_value)->reg;
- int band_idx = ((struct soc_multi_mixer_control *)
- kcontrol->private_value)->shift;
-
- /* Mask top bit it is reserved */
- /* Updates addr automatically for each B2 write */
- snd_soc_write(codec,
- (MSM89XX_CDC_CORE_IIR1_COEF_B1_CTL + 64 * iir_idx),
- (band_idx * BAND_MAX * sizeof(uint32_t)) & 0x7F);
-
-
- set_iir_band_coeff(codec, iir_idx, band_idx,
- ucontrol->value.integer.value[0]);
- set_iir_band_coeff(codec, iir_idx, band_idx,
- ucontrol->value.integer.value[1]);
- set_iir_band_coeff(codec, iir_idx, band_idx,
- ucontrol->value.integer.value[2]);
- set_iir_band_coeff(codec, iir_idx, band_idx,
- ucontrol->value.integer.value[3]);
- set_iir_band_coeff(codec, iir_idx, band_idx,
- ucontrol->value.integer.value[4]);
-
- dev_dbg(codec->dev, "%s: IIR #%d band #%d b0 = 0x%x\n"
- "%s: IIR #%d band #%d b1 = 0x%x\n"
- "%s: IIR #%d band #%d b2 = 0x%x\n"
- "%s: IIR #%d band #%d a1 = 0x%x\n"
- "%s: IIR #%d band #%d a2 = 0x%x\n",
- __func__, iir_idx, band_idx,
- get_iir_band_coeff(codec, iir_idx, band_idx, 0),
- __func__, iir_idx, band_idx,
- get_iir_band_coeff(codec, iir_idx, band_idx, 1),
- __func__, iir_idx, band_idx,
- get_iir_band_coeff(codec, iir_idx, band_idx, 2),
- __func__, iir_idx, band_idx,
- get_iir_band_coeff(codec, iir_idx, band_idx, 3),
- __func__, iir_idx, band_idx,
- get_iir_band_coeff(codec, iir_idx, band_idx, 4));
- return 0;
-}
-
-static void tx_hpf_corner_freq_callback(struct work_struct *work)
-{
- struct delayed_work *hpf_delayed_work;
- struct hpf_work *hpf_work;
- struct snd_soc_codec *codec;
- struct msm_dig_priv *msm_dig_cdc;
- u16 tx_mux_ctl_reg;
- u8 hpf_cut_of_freq;
-
- hpf_delayed_work = to_delayed_work(work);
- hpf_work = container_of(hpf_delayed_work, struct hpf_work, dwork);
- codec = hpf_work->dig_cdc->codec;
- msm_dig_cdc = hpf_work->dig_cdc;
- hpf_cut_of_freq = hpf_work->tx_hpf_cut_of_freq;
-
- tx_mux_ctl_reg = MSM89XX_CDC_CORE_TX1_MUX_CTL +
- (hpf_work->decimator - 1) * 32;
-
- dev_dbg(codec->dev, "%s(): decimator %u hpf_cut_of_freq 0x%x\n",
- __func__, hpf_work->decimator, (unsigned int)hpf_cut_of_freq);
- msm_dig_cdc->update_clkdiv(msm_dig_cdc->handle, 0x51);
-
- snd_soc_update_bits(codec, tx_mux_ctl_reg, 0x30, hpf_cut_of_freq << 4);
-}
-
-static int msm_dig_cdc_codec_set_iir_gain(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol, int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- int value = 0, reg;
-
- switch (event) {
- case SND_SOC_DAPM_POST_PMU:
- if (w->shift == 0)
- reg = MSM89XX_CDC_CORE_IIR1_GAIN_B1_CTL;
- else if (w->shift == 1)
- reg = MSM89XX_CDC_CORE_IIR2_GAIN_B1_CTL;
- else
- goto ret;
- value = snd_soc_read(codec, reg);
- snd_soc_write(codec, reg, value);
- break;
- default:
- pr_err("%s: event = %d not expected\n", __func__, event);
- }
-ret:
- return 0;
-}
-
-static int msm_dig_cdc_compander_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct msm_dig_priv *dig_cdc = snd_soc_codec_get_drvdata(codec);
- int comp_idx = ((struct soc_multi_mixer_control *)
- kcontrol->private_value)->reg;
- int rx_idx = ((struct soc_multi_mixer_control *)
- kcontrol->private_value)->shift;
-
- dev_dbg(codec->dev, "%s: msm_dig_cdc->comp[%d]_enabled[%d] = %d\n",
- __func__, comp_idx, rx_idx,
- dig_cdc->comp_enabled[rx_idx]);
-
- ucontrol->value.integer.value[0] = dig_cdc->comp_enabled[rx_idx];
-
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
- __func__, ucontrol->value.integer.value[0]);
-
- return 0;
-}
-
-static int msm_dig_cdc_compander_set(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct msm_dig_priv *dig_cdc = snd_soc_codec_get_drvdata(codec);
- int comp_idx = ((struct soc_multi_mixer_control *)
- kcontrol->private_value)->reg;
- int rx_idx = ((struct soc_multi_mixer_control *)
- kcontrol->private_value)->shift;
- int value = ucontrol->value.integer.value[0];
-
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
- __func__, ucontrol->value.integer.value[0]);
-
- if (dig_cdc->version >= DIANGU) {
- if (!value)
- dig_cdc->comp_enabled[rx_idx] = 0;
- else
- dig_cdc->comp_enabled[rx_idx] = comp_idx;
- }
-
- dev_dbg(codec->dev, "%s: msm_dig_cdc->comp[%d]_enabled[%d] = %d\n",
- __func__, comp_idx, rx_idx,
- dig_cdc->comp_enabled[rx_idx]);
-
- return 0;
-}
-
-static const struct snd_kcontrol_new compander_kcontrols[] = {
- SOC_SINGLE_EXT("COMP0 RX1", COMPANDER_1, MSM89XX_RX1, 1, 0,
- msm_dig_cdc_compander_get, msm_dig_cdc_compander_set),
-
- SOC_SINGLE_EXT("COMP0 RX2", COMPANDER_1, MSM89XX_RX2, 1, 0,
- msm_dig_cdc_compander_get, msm_dig_cdc_compander_set),
-
-};
-
-static int msm_dig_cdc_set_interpolator_rate(struct snd_soc_dai *dai,
- u8 rx_fs_rate_reg_val,
- u32 sample_rate)
-{
- snd_soc_update_bits(dai->codec,
- MSM89XX_CDC_CORE_RX1_B5_CTL, 0xF0, rx_fs_rate_reg_val);
- snd_soc_update_bits(dai->codec,
- MSM89XX_CDC_CORE_RX2_B5_CTL, 0xF0, rx_fs_rate_reg_val);
- return 0;
-}
-
-static int msm_dig_cdc_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params,
- struct snd_soc_dai *dai)
-{
- u8 tx_fs_rate, rx_fs_rate, rx_clk_fs_rate;
- int ret;
-
- dev_dbg(dai->codec->dev,
- "%s: dai_name = %s DAI-ID %x rate %d num_ch %d format %d\n",
- __func__, dai->name, dai->id, params_rate(params),
- params_channels(params), params_format(params));
-
- switch (params_rate(params)) {
- case 8000:
- tx_fs_rate = 0x00;
- rx_fs_rate = 0x00;
- rx_clk_fs_rate = 0x00;
- break;
- case 16000:
- tx_fs_rate = 0x20;
- rx_fs_rate = 0x20;
- rx_clk_fs_rate = 0x01;
- break;
- case 32000:
- tx_fs_rate = 0x40;
- rx_fs_rate = 0x40;
- rx_clk_fs_rate = 0x02;
- break;
- case 44100:
- case 48000:
- tx_fs_rate = 0x60;
- rx_fs_rate = 0x60;
- rx_clk_fs_rate = 0x03;
- break;
- case 96000:
- tx_fs_rate = 0x80;
- rx_fs_rate = 0x80;
- rx_clk_fs_rate = 0x04;
- break;
- case 192000:
- tx_fs_rate = 0xA0;
- rx_fs_rate = 0xA0;
- rx_clk_fs_rate = 0x05;
- break;
- default:
- dev_err(dai->codec->dev,
- "%s: Invalid sampling rate %d\n", __func__,
- params_rate(params));
- return -EINVAL;
- }
-
- snd_soc_update_bits(dai->codec,
- MSM89XX_CDC_CORE_CLK_RX_I2S_CTL, 0x0F, rx_clk_fs_rate);
-
- switch (substream->stream) {
- case SNDRV_PCM_STREAM_CAPTURE:
- break;
- case SNDRV_PCM_STREAM_PLAYBACK:
- ret = msm_dig_cdc_set_interpolator_rate(dai, rx_fs_rate,
- params_rate(params));
- if (ret < 0) {
- dev_err(dai->codec->dev,
- "%s: set decimator rate failed %d\n", __func__,
- ret);
- return ret;
- }
- break;
- default:
- dev_err(dai->codec->dev,
- "%s: Invalid stream type %d\n", __func__,
- substream->stream);
- return -EINVAL;
- }
- switch (params_format(params)) {
- case SNDRV_PCM_FORMAT_S16_LE:
- snd_soc_update_bits(dai->codec,
- MSM89XX_CDC_CORE_CLK_RX_I2S_CTL, 0x20, 0x20);
- break;
- case SNDRV_PCM_FORMAT_S24_LE:
- case SNDRV_PCM_FORMAT_S24_3LE:
- snd_soc_update_bits(dai->codec,
- MSM89XX_CDC_CORE_CLK_RX_I2S_CTL, 0x20, 0x00);
- break;
- default:
- dev_err(dai->codec->dev, "%s: wrong format selected\n",
- __func__);
- return -EINVAL;
- }
- return 0;
-}
-
-static int msm_dig_cdc_codec_enable_dmic(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct msm_dig_priv *dig_cdc = snd_soc_codec_get_drvdata(codec);
- u8 dmic_clk_en;
- u16 dmic_clk_reg;
- s32 *dmic_clk_cnt;
- unsigned int dmic;
- int ret;
- char *dmic_num = strpbrk(w->name, "1234");
-
- if (dmic_num == NULL) {
- dev_err(codec->dev, "%s: Invalid DMIC\n", __func__);
- return -EINVAL;
- }
-
- ret = kstrtouint(dmic_num, 10, &dmic);
- if (ret < 0) {
- dev_err(codec->dev,
- "%s: Invalid DMIC line on the codec\n", __func__);
- return -EINVAL;
- }
-
- switch (dmic) {
- case 1:
- case 2:
- dmic_clk_en = 0x01;
- dmic_clk_cnt = &(dig_cdc->dmic_1_2_clk_cnt);
- dmic_clk_reg = MSM89XX_CDC_CORE_CLK_DMIC_B1_CTL;
- dev_dbg(codec->dev,
- "%s() event %d DMIC%d dmic_1_2_clk_cnt %d\n",
- __func__, event, dmic, *dmic_clk_cnt);
- break;
- case 3:
- case 4:
- dmic_clk_en = 0x01;
- dmic_clk_cnt = &(dig_cdc->dmic_3_4_clk_cnt);
- dmic_clk_reg = MSM89XX_CDC_CORE_CLK_DMIC_B2_CTL;
- dev_dbg(codec->dev,
- "%s() event %d DMIC%d dmic_3_4_clk_cnt %d\n",
- __func__, event, dmic, *dmic_clk_cnt);
- break;
- default:
- dev_err(codec->dev, "%s: Invalid DMIC Selection\n", __func__);
- return -EINVAL;
- }
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- (*dmic_clk_cnt)++;
- if (*dmic_clk_cnt == 1) {
- snd_soc_update_bits(codec, dmic_clk_reg,
- 0x0E, 0x04);
- snd_soc_update_bits(codec, dmic_clk_reg,
- dmic_clk_en, dmic_clk_en);
- }
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_TX1_DMIC_CTL + (dmic - 1) * 0x20,
- 0x07, 0x02);
- break;
- case SND_SOC_DAPM_POST_PMD:
- (*dmic_clk_cnt)--;
- if (*dmic_clk_cnt == 0)
- snd_soc_update_bits(codec, dmic_clk_reg,
- dmic_clk_en, 0);
- break;
- }
- return 0;
-}
-
-static int msm_dig_cdc_codec_enable_dec(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct msm_asoc_mach_data *pdata = NULL;
- unsigned int decimator;
- struct msm_dig_priv *msm_dig_cdc = snd_soc_codec_get_drvdata(codec);
- char *dec_name = NULL;
- char *widget_name = NULL;
- char *temp;
- int ret = 0, i;
- u16 dec_reset_reg, tx_vol_ctl_reg, tx_mux_ctl_reg;
- u8 dec_hpf_cut_of_freq;
- int offset;
- char *dec_num;
-
- pdata = snd_soc_card_get_drvdata(codec->component.card);
- dev_dbg(codec->dev, "%s %d\n", __func__, event);
-
- widget_name = kstrndup(w->name, 15, GFP_KERNEL);
- if (!widget_name)
- return -ENOMEM;
- temp = widget_name;
-
- dec_name = strsep(&widget_name, " ");
- widget_name = temp;
- if (!dec_name) {
- dev_err(codec->dev,
- "%s: Invalid decimator = %s\n", __func__, w->name);
- ret = -EINVAL;
- goto out;
- }
-
- dec_num = strpbrk(dec_name, "12345");
- if (dec_num == NULL) {
- dev_err(codec->dev, "%s: Invalid Decimator\n", __func__);
- ret = -EINVAL;
- goto out;
- }
-
- ret = kstrtouint(dec_num, 10, &decimator);
- if (ret < 0) {
- dev_err(codec->dev,
- "%s: Invalid decimator = %s\n", __func__, dec_name);
- ret = -EINVAL;
- goto out;
- }
-
- dev_dbg(codec->dev,
- "%s(): widget = %s dec_name = %s decimator = %u\n", __func__,
- w->name, dec_name, decimator);
-
- if (w->reg == MSM89XX_CDC_CORE_CLK_TX_CLK_EN_B1_CTL) {
- dec_reset_reg = MSM89XX_CDC_CORE_CLK_TX_RESET_B1_CTL;
- offset = 0;
- } else {
- dev_err(codec->dev, "%s: Error, incorrect dec\n", __func__);
- ret = -EINVAL;
- goto out;
- }
-
- tx_vol_ctl_reg = MSM89XX_CDC_CORE_TX1_VOL_CTL_CFG +
- 32 * (decimator - 1);
- tx_mux_ctl_reg = MSM89XX_CDC_CORE_TX1_MUX_CTL +
- 32 * (decimator - 1);
- if (decimator == 5) {
- tx_vol_ctl_reg = MSM89XX_CDC_CORE_TX5_VOL_CTL_CFG;
- tx_mux_ctl_reg = MSM89XX_CDC_CORE_TX5_MUX_CTL;
- }
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- /* Enableable TX digital mute */
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x01, 0x01);
- for (i = 0; i < NUM_DECIMATORS; i++) {
- if (decimator == i + 1)
- msm_dig_cdc->dec_active[i] = true;
- }
-
- dec_hpf_cut_of_freq = snd_soc_read(codec, tx_mux_ctl_reg);
-
- dec_hpf_cut_of_freq = (dec_hpf_cut_of_freq & 0x30) >> 4;
-
- tx_hpf_work[decimator - 1].tx_hpf_cut_of_freq =
- dec_hpf_cut_of_freq;
-
- if (dec_hpf_cut_of_freq != CF_MIN_3DB_150HZ) {
-
- /* set cut of freq to CF_MIN_3DB_150HZ (0x1); */
- snd_soc_update_bits(codec, tx_mux_ctl_reg, 0x30,
- CF_MIN_3DB_150HZ << 4);
- }
- msm_dig_cdc->update_clkdiv(msm_dig_cdc->handle, 0x42);
- break;
- case SND_SOC_DAPM_POST_PMU:
- /* enable HPF */
- snd_soc_update_bits(codec, tx_mux_ctl_reg, 0x08, 0x00);
-
- schedule_delayed_work(
- &msm_dig_cdc->tx_mute_dwork[decimator - 1].dwork,
- msecs_to_jiffies(tx_unmute_delay));
- if (tx_hpf_work[decimator - 1].tx_hpf_cut_of_freq !=
- CF_MIN_3DB_150HZ) {
-
- schedule_delayed_work(&tx_hpf_work[decimator - 1].dwork,
- msecs_to_jiffies(300));
- }
- /* apply the digital gain after the decimator is enabled*/
- if ((w->shift) < ARRAY_SIZE(tx_digital_gain_reg))
- snd_soc_write(codec,
- tx_digital_gain_reg[w->shift + offset],
- snd_soc_read(codec,
- tx_digital_gain_reg[w->shift + offset])
- );
- break;
- case SND_SOC_DAPM_PRE_PMD:
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x01, 0x01);
- msleep(20);
- snd_soc_update_bits(codec, tx_mux_ctl_reg, 0x08, 0x08);
- cancel_delayed_work_sync(&tx_hpf_work[decimator - 1].dwork);
- cancel_delayed_work_sync(
- &msm_dig_cdc->tx_mute_dwork[decimator - 1].dwork);
- break;
- case SND_SOC_DAPM_POST_PMD:
- snd_soc_update_bits(codec, dec_reset_reg, 1 << w->shift,
- 1 << w->shift);
- snd_soc_update_bits(codec, dec_reset_reg, 1 << w->shift, 0x0);
- snd_soc_update_bits(codec, tx_mux_ctl_reg, 0x08, 0x08);
- snd_soc_update_bits(codec, tx_mux_ctl_reg, 0x30,
- (tx_hpf_work[decimator - 1].tx_hpf_cut_of_freq) << 4);
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x01, 0x00);
- for (i = 0; i < NUM_DECIMATORS; i++) {
- if (decimator == i + 1)
- msm_dig_cdc->dec_active[i] = false;
- }
- break;
- }
-out:
- kfree(widget_name);
- return ret;
-}
-
-static int msm_dig_cdc_event_notify(struct notifier_block *block,
- unsigned long val,
- void *data)
-{
- enum dig_cdc_notify_event event = (enum dig_cdc_notify_event)val;
- struct snd_soc_codec *codec = registered_digcodec;
- struct msm_dig_priv *msm_dig_cdc = snd_soc_codec_get_drvdata(codec);
- struct msm_asoc_mach_data *pdata = NULL;
- int ret = -EINVAL;
-
- pdata = snd_soc_card_get_drvdata(codec->component.card);
-
- switch (event) {
- case DIG_CDC_EVENT_CLK_ON:
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_CLK_PDM_CTL, 0x03, 0x03);
- if (pdata->mclk_freq == MCLK_RATE_12P288MHZ ||
- pdata->native_clk_set)
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_TOP_CTL, 0x01, 0x00);
- else if (pdata->mclk_freq == MCLK_RATE_9P6MHZ)
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_TOP_CTL, 0x01, 0x01);
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_CLK_MCLK_CTL, 0x01, 0x01);
- break;
- case DIG_CDC_EVENT_CLK_OFF:
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_CLK_PDM_CTL, 0x03, 0x00);
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_CLK_MCLK_CTL, 0x01, 0x00);
- break;
- case DIG_CDC_EVENT_RX1_MUTE_ON:
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_RX1_B6_CTL, 0x01, 0x01);
- msm_dig_cdc->mute_mask |= HPHL_PA_DISABLE;
- break;
- case DIG_CDC_EVENT_RX1_MUTE_OFF:
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_RX1_B6_CTL, 0x01, 0x00);
- msm_dig_cdc->mute_mask &= (~HPHL_PA_DISABLE);
- break;
- case DIG_CDC_EVENT_RX2_MUTE_ON:
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_RX2_B6_CTL, 0x01, 0x01);
- msm_dig_cdc->mute_mask |= HPHR_PA_DISABLE;
- break;
- case DIG_CDC_EVENT_RX2_MUTE_OFF:
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_RX2_B6_CTL, 0x01, 0x00);
- msm_dig_cdc->mute_mask &= (~HPHR_PA_DISABLE);
- break;
- case DIG_CDC_EVENT_RX3_MUTE_ON:
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_RX3_B6_CTL, 0x01, 0x01);
- msm_dig_cdc->mute_mask |= SPKR_PA_DISABLE;
- break;
- case DIG_CDC_EVENT_RX3_MUTE_OFF:
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_RX3_B6_CTL, 0x01, 0x00);
- msm_dig_cdc->mute_mask &= (~SPKR_PA_DISABLE);
- break;
- case DIG_CDC_EVENT_PRE_RX1_INT_ON:
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_RX1_B3_CTL, 0x3C, 0x28);
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_RX1_B4_CTL, 0x18, 0x10);
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_RX1_B3_CTL, 0x80, 0x80);
- break;
- case DIG_CDC_EVENT_PRE_RX2_INT_ON:
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_RX2_B3_CTL, 0x3C, 0x28);
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_RX2_B4_CTL, 0x18, 0x10);
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_RX2_B3_CTL, 0x80, 0x80);
- break;
- case DIG_CDC_EVENT_POST_RX1_INT_OFF:
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_RX1_B3_CTL, 0x3C, 0x00);
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_RX1_B4_CTL, 0x18, 0xFF);
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_RX1_B3_CTL, 0x80, 0x00);
- break;
- case DIG_CDC_EVENT_POST_RX2_INT_OFF:
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_RX2_B3_CTL, 0x3C, 0x00);
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_RX2_B4_CTL, 0x18, 0xFF);
- snd_soc_update_bits(codec,
- MSM89XX_CDC_CORE_RX2_B3_CTL, 0x80, 0x00);
- break;
- case DIG_CDC_EVENT_SSR_DOWN:
- regcache_cache_only(msm_dig_cdc->regmap, true);
- break;
- case DIG_CDC_EVENT_SSR_UP:
- regcache_cache_only(msm_dig_cdc->regmap, false);
- regcache_mark_dirty(msm_dig_cdc->regmap);
-
- mutex_lock(&pdata->cdc_int_mclk0_mutex);
- pdata->digital_cdc_core_clk.enable = 1;
- ret = afe_set_lpass_clock_v2(
- AFE_PORT_ID_INT0_MI2S_RX,
- &pdata->digital_cdc_core_clk);
- if (ret < 0) {
- pr_err("%s:failed to enable the MCLK\n",
- __func__);
- mutex_unlock(&pdata->cdc_int_mclk0_mutex);
- break;
- }
- mutex_unlock(&pdata->cdc_int_mclk0_mutex);
-
- regcache_sync(msm_dig_cdc->regmap);
-
- mutex_lock(&pdata->cdc_int_mclk0_mutex);
- pdata->digital_cdc_core_clk.enable = 0;
- afe_set_lpass_clock_v2(
- AFE_PORT_ID_INT0_MI2S_RX,
- &pdata->digital_cdc_core_clk);
- mutex_unlock(&pdata->cdc_int_mclk0_mutex);
- break;
- case DIG_CDC_EVENT_INVALID:
- default:
- break;
- }
- return 0;
-}
-
-static ssize_t msm_dig_codec_version_read(struct snd_info_entry *entry,
- void *file_private_data,
- struct file *file,
- char __user *buf, size_t count,
- loff_t pos)
-{
- struct msm_dig_priv *msm_dig;
- char buffer[MSM_DIG_CDC_VERSION_ENTRY_SIZE];
- int len = 0;
-
- msm_dig = (struct msm_dig_priv *) entry->private_data;
- if (!msm_dig) {
- pr_err("%s: msm_dig priv is null\n", __func__);
- return -EINVAL;
- }
-
- switch (msm_dig->version) {
- case DRAX_CDC:
- len = snprintf(buffer, sizeof(buffer), "SDM660-CDC_1_0\n");
- break;
- default:
- len = snprintf(buffer, sizeof(buffer), "VER_UNDEFINED\n");
- }
-
- return simple_read_from_buffer(buf, count, &pos, buffer, len);
-}
-
-static struct snd_info_entry_ops msm_dig_codec_info_ops = {
- .read = msm_dig_codec_version_read,
-};
-
-/*
- * msm_dig_codec_info_create_codec_entry - creates msm_dig module
- * @codec_root: The parent directory
- * @codec: Codec instance
- *
- * Creates msm_dig module and version entry under the given
- * parent directory.
- *
- * Return: 0 on success or negative error code on failure.
- */
-int msm_dig_codec_info_create_codec_entry(struct snd_info_entry *codec_root,
- struct snd_soc_codec *codec)
-{
- struct snd_info_entry *version_entry;
- struct msm_dig_priv *msm_dig;
- struct snd_soc_card *card;
-
- if (!codec_root || !codec)
- return -EINVAL;
-
- msm_dig = snd_soc_codec_get_drvdata(codec);
- card = codec->component.card;
- msm_dig->entry = snd_info_create_subdir(codec_root->module,
- "msm_digital_codec",
- codec_root);
- if (!msm_dig->entry) {
- dev_dbg(codec->dev, "%s: failed to create msm_digital entry\n",
- __func__);
- return -ENOMEM;
- }
-
- version_entry = snd_info_create_card_entry(card->snd_card,
- "version",
- msm_dig->entry);
- if (!version_entry) {
- dev_dbg(codec->dev, "%s: failed to create msm_digital version entry\n",
- __func__);
- return -ENOMEM;
- }
-
- version_entry->private_data = msm_dig;
- version_entry->size = MSM_DIG_CDC_VERSION_ENTRY_SIZE;
- version_entry->content = SNDRV_INFO_CONTENT_DATA;
- version_entry->c.ops = &msm_dig_codec_info_ops;
-
- if (snd_info_register(version_entry) < 0) {
- snd_info_free_entry(version_entry);
- return -ENOMEM;
- }
- msm_dig->version_entry = version_entry;
- if (msm_dig->get_cdc_version)
- msm_dig->version = msm_dig->get_cdc_version(msm_dig->handle);
- else
- msm_dig->version = DRAX_CDC;
-
- return 0;
-}
-EXPORT_SYMBOL(msm_dig_codec_info_create_codec_entry);
-
-static void sdm660_tx_mute_update_callback(struct work_struct *work)
-{
- struct tx_mute_work *tx_mute_dwork;
- struct snd_soc_codec *codec = NULL;
- struct msm_dig_priv *dig_cdc;
- struct delayed_work *delayed_work;
- u16 tx_vol_ctl_reg = 0;
- u8 decimator = 0, i;
-
- delayed_work = to_delayed_work(work);
- tx_mute_dwork = container_of(delayed_work, struct tx_mute_work, dwork);
- dig_cdc = tx_mute_dwork->dig_cdc;
- codec = dig_cdc->codec;
-
- for (i = 0; i < (NUM_DECIMATORS - 1); i++) {
- if (dig_cdc->dec_active[i])
- decimator = i + 1;
- if (decimator && decimator < NUM_DECIMATORS) {
- /* unmute decimators corresponding to Tx DAI's*/
- tx_vol_ctl_reg =
- MSM89XX_CDC_CORE_TX1_VOL_CTL_CFG +
- 32 * (decimator - 1);
- snd_soc_update_bits(codec, tx_vol_ctl_reg,
- 0x01, 0x00);
- }
- decimator = 0;
- }
-}
-
-static int msm_dig_cdc_soc_probe(struct snd_soc_codec *codec)
-{
- struct msm_dig_priv *msm_dig_cdc = dev_get_drvdata(codec->dev);
- struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
- int i, ret;
-
- msm_dig_cdc->codec = codec;
-
- snd_soc_add_codec_controls(codec, compander_kcontrols,
- ARRAY_SIZE(compander_kcontrols));
-
- for (i = 0; i < NUM_DECIMATORS; i++) {
- tx_hpf_work[i].dig_cdc = msm_dig_cdc;
- tx_hpf_work[i].decimator = i + 1;
- INIT_DELAYED_WORK(&tx_hpf_work[i].dwork,
- tx_hpf_corner_freq_callback);
- msm_dig_cdc->tx_mute_dwork[i].dig_cdc = msm_dig_cdc;
- msm_dig_cdc->tx_mute_dwork[i].decimator = i + 1;
- INIT_DELAYED_WORK(&msm_dig_cdc->tx_mute_dwork[i].dwork,
- sdm660_tx_mute_update_callback);
- }
-
- for (i = 0; i < MSM89XX_RX_MAX; i++)
- msm_dig_cdc->comp_enabled[i] = COMPANDER_NONE;
-
- /* Register event notifier */
- msm_dig_cdc->nblock.notifier_call = msm_dig_cdc_event_notify;
- if (msm_dig_cdc->register_notifier) {
- ret = msm_dig_cdc->register_notifier(msm_dig_cdc->handle,
- &msm_dig_cdc->nblock,
- true);
- if (ret) {
- pr_err("%s: Failed to register notifier %d\n",
- __func__, ret);
- return ret;
- }
- }
- registered_digcodec = codec;
-
- snd_soc_dapm_ignore_suspend(dapm, "AIF1 Playback");
- snd_soc_dapm_ignore_suspend(dapm, "AIF1 Capture");
- snd_soc_dapm_ignore_suspend(dapm, "ADC1_IN");
- snd_soc_dapm_ignore_suspend(dapm, "ADC2_IN");
- snd_soc_dapm_ignore_suspend(dapm, "ADC3_IN");
- snd_soc_dapm_ignore_suspend(dapm, "PDM_OUT_RX1");
- snd_soc_dapm_ignore_suspend(dapm, "PDM_OUT_RX2");
- snd_soc_dapm_ignore_suspend(dapm, "PDM_OUT_RX3");
-
- snd_soc_dapm_sync(dapm);
-
- return 0;
-}
-
-static int msm_dig_cdc_soc_remove(struct snd_soc_codec *codec)
-{
- struct msm_dig_priv *msm_dig_cdc = dev_get_drvdata(codec->dev);
-
- if (msm_dig_cdc->register_notifier)
- msm_dig_cdc->register_notifier(msm_dig_cdc->handle,
- &msm_dig_cdc->nblock,
- false);
- iounmap(msm_dig_cdc->dig_base);
- return 0;
-}
-
-static const struct snd_soc_dapm_route audio_dig_map[] = {
- {"RX_I2S_CLK", NULL, "CDC_CONN"},
- {"I2S RX1", NULL, "RX_I2S_CLK"},
- {"I2S RX2", NULL, "RX_I2S_CLK"},
- {"I2S RX3", NULL, "RX_I2S_CLK"},
-
- {"I2S TX1", NULL, "TX_I2S_CLK"},
- {"I2S TX2", NULL, "TX_I2S_CLK"},
- {"I2S TX3", NULL, "TX_I2S_CLK"},
- {"I2S TX4", NULL, "TX_I2S_CLK"},
- {"I2S TX5", NULL, "TX_I2S_CLK"},
- {"I2S TX6", NULL, "TX_I2S_CLK"},
-
- {"I2S TX1", NULL, "DEC1 MUX"},
- {"I2S TX2", NULL, "DEC2 MUX"},
- {"I2S TX3", NULL, "I2S TX2 INP1"},
- {"I2S TX4", NULL, "I2S TX2 INP2"},
- {"I2S TX5", NULL, "DEC3 MUX"},
- {"I2S TX6", NULL, "I2S TX3 INP2"},
-
- {"I2S TX2 INP1", "RX_MIX1", "RX1 MIX2"},
- {"I2S TX2 INP1", "DEC3", "DEC3 MUX"},
- {"I2S TX2 INP2", "RX_MIX2", "RX2 MIX2"},
- {"I2S TX2 INP2", "RX_MIX3", "RX3 MIX1"},
- {"I2S TX2 INP2", "DEC4", "DEC4 MUX"},
- {"I2S TX3 INP2", "DEC4", "DEC4 MUX"},
- {"I2S TX3 INP2", "DEC5", "DEC5 MUX"},
-
- {"PDM_OUT_RX1", NULL, "RX1 CHAIN"},
- {"PDM_OUT_RX2", NULL, "RX2 CHAIN"},
- {"PDM_OUT_RX3", NULL, "RX3 CHAIN"},
-
- {"RX1 CHAIN", NULL, "RX1 MIX2"},
- {"RX2 CHAIN", NULL, "RX2 MIX2"},
- {"RX3 CHAIN", NULL, "RX3 MIX1"},
-
- {"RX1 MIX1", NULL, "RX1 MIX1 INP1"},
- {"RX1 MIX1", NULL, "RX1 MIX1 INP2"},
- {"RX1 MIX1", NULL, "RX1 MIX1 INP3"},
- {"RX2 MIX1", NULL, "RX2 MIX1 INP1"},
- {"RX2 MIX1", NULL, "RX2 MIX1 INP2"},
- {"RX3 MIX1", NULL, "RX3 MIX1 INP1"},
- {"RX3 MIX1", NULL, "RX3 MIX1 INP2"},
- {"RX1 MIX2", NULL, "RX1 MIX1"},
- {"RX1 MIX2", NULL, "RX1 MIX2 INP1"},
- {"RX2 MIX2", NULL, "RX2 MIX1"},
- {"RX2 MIX2", NULL, "RX2 MIX2 INP1"},
-
- {"RX1 MIX1 INP1", "RX1", "I2S RX1"},
- {"RX1 MIX1 INP1", "RX2", "I2S RX2"},
- {"RX1 MIX1 INP1", "RX3", "I2S RX3"},
- {"RX1 MIX1 INP1", "IIR1", "IIR1"},
- {"RX1 MIX1 INP1", "IIR2", "IIR2"},
- {"RX1 MIX1 INP2", "RX1", "I2S RX1"},
- {"RX1 MIX1 INP2", "RX2", "I2S RX2"},
- {"RX1 MIX1 INP2", "RX3", "I2S RX3"},
- {"RX1 MIX1 INP2", "IIR1", "IIR1"},
- {"RX1 MIX1 INP2", "IIR2", "IIR2"},
- {"RX1 MIX1 INP3", "RX1", "I2S RX1"},
- {"RX1 MIX1 INP3", "RX2", "I2S RX2"},
- {"RX1 MIX1 INP3", "RX3", "I2S RX3"},
-
- {"RX2 MIX1 INP1", "RX1", "I2S RX1"},
- {"RX2 MIX1 INP1", "RX2", "I2S RX2"},
- {"RX2 MIX1 INP1", "RX3", "I2S RX3"},
- {"RX2 MIX1 INP1", "IIR1", "IIR1"},
- {"RX2 MIX1 INP1", "IIR2", "IIR2"},
- {"RX2 MIX1 INP2", "RX1", "I2S RX1"},
- {"RX2 MIX1 INP2", "RX2", "I2S RX2"},
- {"RX2 MIX1 INP2", "RX3", "I2S RX3"},
- {"RX2 MIX1 INP2", "IIR1", "IIR1"},
- {"RX2 MIX1 INP2", "IIR2", "IIR2"},
- {"RX2 MIX1 INP3", "RX1", "I2S RX1"},
- {"RX2 MIX1 INP3", "RX2", "I2S RX2"},
- {"RX2 MIX1 INP3", "RX3", "I2S RX3"},
-
- {"RX3 MIX1 INP1", "RX1", "I2S RX1"},
- {"RX3 MIX1 INP1", "RX2", "I2S RX2"},
- {"RX3 MIX1 INP1", "RX3", "I2S RX3"},
- {"RX3 MIX1 INP1", "IIR1", "IIR1"},
- {"RX3 MIX1 INP1", "IIR2", "IIR2"},
- {"RX3 MIX1 INP2", "RX1", "I2S RX1"},
- {"RX3 MIX1 INP2", "RX2", "I2S RX2"},
- {"RX3 MIX1 INP2", "RX3", "I2S RX3"},
- {"RX3 MIX1 INP2", "IIR1", "IIR1"},
- {"RX3 MIX1 INP2", "IIR2", "IIR2"},
- {"RX3 MIX1 INP3", "RX1", "I2S RX1"},
- {"RX3 MIX1 INP3", "RX2", "I2S RX2"},
- {"RX3 MIX1 INP3", "RX3", "I2S RX3"},
-
- {"RX1 MIX2 INP1", "IIR1", "IIR1"},
- {"RX2 MIX2 INP1", "IIR1", "IIR1"},
- {"RX1 MIX2 INP1", "IIR2", "IIR2"},
- {"RX2 MIX2 INP1", "IIR2", "IIR2"},
-
- /* Decimator Inputs */
- {"DEC1 MUX", "DMIC1", "DMIC1"},
- {"DEC1 MUX", "DMIC2", "DMIC2"},
- {"DEC1 MUX", "DMIC3", "DMIC3"},
- {"DEC1 MUX", "DMIC4", "DMIC4"},
- {"DEC1 MUX", "ADC1", "ADC1_IN"},
- {"DEC1 MUX", "ADC2", "ADC2_IN"},
- {"DEC1 MUX", "ADC3", "ADC3_IN"},
- {"DEC1 MUX", NULL, "CDC_CONN"},
-
- {"DEC2 MUX", "DMIC1", "DMIC1"},
- {"DEC2 MUX", "DMIC2", "DMIC2"},
- {"DEC2 MUX", "DMIC3", "DMIC3"},
- {"DEC2 MUX", "DMIC4", "DMIC4"},
- {"DEC2 MUX", "ADC1", "ADC1_IN"},
- {"DEC2 MUX", "ADC2", "ADC2_IN"},
- {"DEC2 MUX", "ADC3", "ADC3_IN"},
- {"DEC2 MUX", NULL, "CDC_CONN"},
-
- {"DEC3 MUX", "DMIC1", "DMIC1"},
- {"DEC3 MUX", "DMIC2", "DMIC2"},
- {"DEC3 MUX", "DMIC3", "DMIC3"},
- {"DEC3 MUX", "DMIC4", "DMIC4"},
- {"DEC3 MUX", "ADC1", "ADC1_IN"},
- {"DEC3 MUX", "ADC2", "ADC2_IN"},
- {"DEC3 MUX", "ADC3", "ADC3_IN"},
- {"DEC3 MUX", NULL, "CDC_CONN"},
-
- {"DEC4 MUX", "DMIC1", "DMIC1"},
- {"DEC4 MUX", "DMIC2", "DMIC2"},
- {"DEC4 MUX", "DMIC3", "DMIC3"},
- {"DEC4 MUX", "DMIC4", "DMIC4"},
- {"DEC4 MUX", "ADC1", "ADC1_IN"},
- {"DEC4 MUX", "ADC2", "ADC2_IN"},
- {"DEC4 MUX", "ADC3", "ADC3_IN"},
- {"DEC4 MUX", NULL, "CDC_CONN"},
-
- {"DEC5 MUX", "DMIC1", "DMIC1"},
- {"DEC5 MUX", "DMIC2", "DMIC2"},
- {"DEC5 MUX", "DMIC3", "DMIC3"},
- {"DEC5 MUX", "DMIC4", "DMIC4"},
- {"DEC5 MUX", "ADC1", "ADC1_IN"},
- {"DEC5 MUX", "ADC2", "ADC2_IN"},
- {"DEC5 MUX", "ADC3", "ADC3_IN"},
- {"DEC5 MUX", NULL, "CDC_CONN"},
-
- {"IIR1", NULL, "IIR1 INP1 MUX"},
- {"IIR1 INP1 MUX", "DEC1", "DEC1 MUX"},
- {"IIR1 INP1 MUX", "DEC2", "DEC2 MUX"},
- {"IIR1 INP1 MUX", "DEC3", "DEC3 MUX"},
- {"IIR1 INP1 MUX", "DEC4", "DEC4 MUX"},
- {"IIR2", NULL, "IIR2 INP1 MUX"},
- {"IIR2 INP1 MUX", "DEC1", "DEC1 MUX"},
- {"IIR2 INP1 MUX", "DEC2", "DEC2 MUX"},
- {"IIR1 INP1 MUX", "DEC3", "DEC3 MUX"},
- {"IIR1 INP1 MUX", "DEC4", "DEC4 MUX"},
-};
-
-
-static const char * const i2s_tx2_inp1_text[] = {
- "ZERO", "RX_MIX1", "DEC3"
-};
-
-static const char * const i2s_tx2_inp2_text[] = {
- "ZERO", "RX_MIX2", "RX_MIX3", "DEC4"
-};
-
-static const char * const i2s_tx3_inp2_text[] = {
- "DEC4", "DEC5"
-};
-
-static const char * const rx_mix1_text[] = {
- "ZERO", "IIR1", "IIR2", "RX1", "RX2", "RX3"
-};
-
-static const char * const rx_mix2_text[] = {
- "ZERO", "IIR1", "IIR2"
-};
-
-static const char * const dec_mux_text[] = {
- "ZERO", "ADC1", "ADC2", "ADC3", "DMIC1", "DMIC2", "DMIC3", "DMIC4"
-};
-
-static const char * const iir_inp1_text[] = {
- "ZERO", "DEC1", "DEC2", "RX1", "RX2", "RX3", "DEC3", "DEC4"
-};
-
-/* I2S TX MUXes */
-static const struct soc_enum i2s_tx2_inp1_chain_enum =
- SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_CONN_TX_I2S_SD1_CTL,
- 2, 3, i2s_tx2_inp1_text);
-
-static const struct soc_enum i2s_tx2_inp2_chain_enum =
- SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_CONN_TX_I2S_SD1_CTL,
- 0, 4, i2s_tx2_inp2_text);
-
-static const struct soc_enum i2s_tx3_inp2_chain_enum =
- SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_CONN_TX_I2S_SD1_CTL,
- 4, 2, i2s_tx3_inp2_text);
-
-/* RX1 MIX1 */
-static const struct soc_enum rx_mix1_inp1_chain_enum =
- SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_CONN_RX1_B1_CTL,
- 0, 6, rx_mix1_text);
-
-static const struct soc_enum rx_mix1_inp2_chain_enum =
- SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_CONN_RX1_B1_CTL,
- 3, 6, rx_mix1_text);
-
-static const struct soc_enum rx_mix1_inp3_chain_enum =
- SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_CONN_RX1_B2_CTL,
- 0, 6, rx_mix1_text);
-
-/* RX1 MIX2 */
-static const struct soc_enum rx_mix2_inp1_chain_enum =
- SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_CONN_RX1_B3_CTL,
- 0, 3, rx_mix2_text);
-
-/* RX2 MIX1 */
-static const struct soc_enum rx2_mix1_inp1_chain_enum =
- SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_CONN_RX2_B1_CTL,
- 0, 6, rx_mix1_text);
-
-static const struct soc_enum rx2_mix1_inp2_chain_enum =
- SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_CONN_RX2_B1_CTL,
- 3, 6, rx_mix1_text);
-
-static const struct soc_enum rx2_mix1_inp3_chain_enum =
- SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_CONN_RX2_B1_CTL,
- 0, 6, rx_mix1_text);
-
-/* RX2 MIX2 */
-static const struct soc_enum rx2_mix2_inp1_chain_enum =
- SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_CONN_RX2_B3_CTL,
- 0, 3, rx_mix2_text);
-
-/* RX3 MIX1 */
-static const struct soc_enum rx3_mix1_inp1_chain_enum =
- SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_CONN_RX3_B1_CTL,
- 0, 6, rx_mix1_text);
-
-static const struct soc_enum rx3_mix1_inp2_chain_enum =
- SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_CONN_RX3_B1_CTL,
- 3, 6, rx_mix1_text);
-
-static const struct soc_enum rx3_mix1_inp3_chain_enum =
- SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_CONN_RX3_B1_CTL,
- 0, 6, rx_mix1_text);
-
-/* DEC */
-static const struct soc_enum dec1_mux_enum =
- SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_CONN_TX_B1_CTL,
- 0, 8, dec_mux_text);
-
-static const struct soc_enum dec2_mux_enum =
- SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_CONN_TX_B1_CTL,
- 3, 8, dec_mux_text);
-
-static const struct soc_enum dec3_mux_enum =
- SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_CONN_TX_B2_CTL,
- 0, 8, dec_mux_text);
-
-static const struct soc_enum dec4_mux_enum =
- SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_CONN_TX_B2_CTL,
- 3, 8, dec_mux_text);
-
-static const struct soc_enum decsva_mux_enum =
- SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_CONN_TX_B3_CTL,
- 0, 8, dec_mux_text);
-
-static const struct soc_enum iir1_inp1_mux_enum =
- SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_CONN_EQ1_B1_CTL,
- 0, 8, iir_inp1_text);
-
-static const struct soc_enum iir2_inp1_mux_enum =
- SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_CONN_EQ2_B1_CTL,
- 0, 8, iir_inp1_text);
-
-/*cut of frequency for high pass filter*/
-static const char * const cf_text[] = {
- "MIN_3DB_4Hz", "MIN_3DB_75Hz", "MIN_3DB_150Hz"
-};
-
-static const struct soc_enum cf_rxmix1_enum =
- SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_RX1_B4_CTL, 0, 3, cf_text);
-
-static const struct soc_enum cf_rxmix2_enum =
- SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_RX2_B4_CTL, 0, 3, cf_text);
-
-static const struct soc_enum cf_rxmix3_enum =
- SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_RX3_B4_CTL, 0, 3, cf_text);
-
-static const struct snd_kcontrol_new rx3_mix1_inp1_mux =
- SOC_DAPM_ENUM("RX3 MIX1 INP1 Mux", rx3_mix1_inp1_chain_enum);
-
-#define MSM89XX_DEC_ENUM(xname, xenum) \
-{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
- .info = snd_soc_info_enum_double, \
- .get = snd_soc_dapm_get_enum_double, \
- .put = msm_dig_cdc_put_dec_enum, \
- .private_value = (unsigned long)&xenum }
-
-static const struct snd_kcontrol_new dec1_mux =
- MSM89XX_DEC_ENUM("DEC1 MUX Mux", dec1_mux_enum);
-
-static const struct snd_kcontrol_new dec2_mux =
- MSM89XX_DEC_ENUM("DEC2 MUX Mux", dec2_mux_enum);
-
-static const struct snd_kcontrol_new dec3_mux =
- MSM89XX_DEC_ENUM("DEC3 MUX Mux", dec3_mux_enum);
-
-static const struct snd_kcontrol_new dec4_mux =
- MSM89XX_DEC_ENUM("DEC4 MUX Mux", dec4_mux_enum);
-
-static const struct snd_kcontrol_new decsva_mux =
- MSM89XX_DEC_ENUM("DEC5 MUX Mux", decsva_mux_enum);
-
-static const struct snd_kcontrol_new i2s_tx2_inp1_mux =
- SOC_DAPM_ENUM("I2S TX2 INP1 Mux", i2s_tx2_inp1_chain_enum);
-
-static const struct snd_kcontrol_new i2s_tx2_inp2_mux =
- SOC_DAPM_ENUM("I2S TX2 INP2 Mux", i2s_tx2_inp2_chain_enum);
-
-static const struct snd_kcontrol_new i2s_tx3_inp2_mux =
- SOC_DAPM_ENUM("I2S TX3 INP2 Mux", i2s_tx3_inp2_chain_enum);
-
-static const struct snd_kcontrol_new iir1_inp1_mux =
- SOC_DAPM_ENUM("IIR1 INP1 Mux", iir1_inp1_mux_enum);
-
-static const struct snd_kcontrol_new iir2_inp1_mux =
- SOC_DAPM_ENUM("IIR2 INP1 Mux", iir2_inp1_mux_enum);
-
-static const struct snd_kcontrol_new rx_mix1_inp1_mux =
- SOC_DAPM_ENUM("RX1 MIX1 INP1 Mux", rx_mix1_inp1_chain_enum);
-
-static const struct snd_kcontrol_new rx_mix1_inp2_mux =
- SOC_DAPM_ENUM("RX1 MIX1 INP2 Mux", rx_mix1_inp2_chain_enum);
-
-static const struct snd_kcontrol_new rx_mix1_inp3_mux =
- SOC_DAPM_ENUM("RX1 MIX1 INP3 Mux", rx_mix1_inp3_chain_enum);
-
-static const struct snd_kcontrol_new rx2_mix1_inp1_mux =
- SOC_DAPM_ENUM("RX2 MIX1 INP1 Mux", rx2_mix1_inp1_chain_enum);
-
-static const struct snd_kcontrol_new rx2_mix1_inp2_mux =
- SOC_DAPM_ENUM("RX2 MIX1 INP2 Mux", rx2_mix1_inp2_chain_enum);
-
-static const struct snd_kcontrol_new rx2_mix1_inp3_mux =
- SOC_DAPM_ENUM("RX2 MIX1 INP3 Mux", rx2_mix1_inp3_chain_enum);
-
-static const struct snd_kcontrol_new rx3_mix1_inp2_mux =
- SOC_DAPM_ENUM("RX3 MIX1 INP2 Mux", rx3_mix1_inp2_chain_enum);
-
-static const struct snd_kcontrol_new rx3_mix1_inp3_mux =
- SOC_DAPM_ENUM("RX3 MIX1 INP3 Mux", rx3_mix1_inp3_chain_enum);
-
-static const struct snd_kcontrol_new rx1_mix2_inp1_mux =
- SOC_DAPM_ENUM("RX1 MIX2 INP1 Mux", rx_mix2_inp1_chain_enum);
-
-static const struct snd_kcontrol_new rx2_mix2_inp1_mux =
- SOC_DAPM_ENUM("RX2 MIX2 INP1 Mux", rx2_mix2_inp1_chain_enum);
-
-static const struct snd_soc_dapm_widget msm_dig_dapm_widgets[] = {
- SND_SOC_DAPM_AIF_IN("I2S RX1", "AIF1 Playback", 0, SND_SOC_NOPM, 0, 0),
- SND_SOC_DAPM_AIF_IN("I2S RX2", "AIF1 Playback", 0, SND_SOC_NOPM, 0, 0),
- SND_SOC_DAPM_AIF_IN("I2S RX3", "AIF1 Playback", 0, SND_SOC_NOPM, 0, 0),
-
- SND_SOC_DAPM_AIF_OUT("I2S TX1", "AIF1 Capture", 0, SND_SOC_NOPM, 0, 0),
- SND_SOC_DAPM_AIF_OUT("I2S TX2", "AIF1 Capture", 0, SND_SOC_NOPM, 0, 0),
- SND_SOC_DAPM_AIF_OUT("I2S TX3", "AIF1 Capture", 0, SND_SOC_NOPM, 0, 0),
- SND_SOC_DAPM_AIF_OUT("I2S TX4", "AIF1 Capture", 0, SND_SOC_NOPM, 0, 0),
- SND_SOC_DAPM_AIF_OUT("I2S TX5", "AIF1 Capture", 0, SND_SOC_NOPM, 0, 0),
- SND_SOC_DAPM_AIF_OUT("I2S TX6", "AIF2 Capture", 0, SND_SOC_NOPM, 0, 0),
-
- SND_SOC_DAPM_MIXER_E("RX1 MIX2", MSM89XX_CDC_CORE_CLK_RX_B1_CTL,
- MSM89XX_RX1, 0, NULL, 0,
- msm_dig_cdc_codec_enable_interpolator,
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MIXER_E("RX2 MIX2", MSM89XX_CDC_CORE_CLK_RX_B1_CTL,
- MSM89XX_RX2, 0, NULL, 0,
- msm_dig_cdc_codec_enable_interpolator,
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MIXER_E("RX3 MIX1", MSM89XX_CDC_CORE_CLK_RX_B1_CTL,
- MSM89XX_RX3, 0, NULL, 0,
- msm_dig_cdc_codec_enable_interpolator,
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_MIXER("RX1 MIX1", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("RX2 MIX1", SND_SOC_NOPM, 0, 0, NULL, 0),
-
- SND_SOC_DAPM_MIXER("RX1 CHAIN", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("RX2 CHAIN", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("RX3 CHAIN", SND_SOC_NOPM, 0, 0, NULL, 0),
-
- SND_SOC_DAPM_MUX("RX1 MIX1 INP1", SND_SOC_NOPM, 0, 0,
- &rx_mix1_inp1_mux),
- SND_SOC_DAPM_MUX("RX1 MIX1 INP2", SND_SOC_NOPM, 0, 0,
- &rx_mix1_inp2_mux),
- SND_SOC_DAPM_MUX("RX1 MIX1 INP3", SND_SOC_NOPM, 0, 0,
- &rx_mix1_inp3_mux),
-
- SND_SOC_DAPM_MUX("RX2 MIX1 INP1", SND_SOC_NOPM, 0, 0,
- &rx2_mix1_inp1_mux),
- SND_SOC_DAPM_MUX("RX2 MIX1 INP2", SND_SOC_NOPM, 0, 0,
- &rx2_mix1_inp2_mux),
- SND_SOC_DAPM_MUX("RX2 MIX1 INP3", SND_SOC_NOPM, 0, 0,
- &rx2_mix1_inp3_mux),
-
- SND_SOC_DAPM_MUX("RX3 MIX1 INP1", SND_SOC_NOPM, 0, 0,
- &rx3_mix1_inp1_mux),
- SND_SOC_DAPM_MUX("RX3 MIX1 INP2", SND_SOC_NOPM, 0, 0,
- &rx3_mix1_inp2_mux),
- SND_SOC_DAPM_MUX("RX3 MIX1 INP3", SND_SOC_NOPM, 0, 0,
- &rx3_mix1_inp3_mux),
-
- SND_SOC_DAPM_MUX("RX1 MIX2 INP1", SND_SOC_NOPM, 0, 0,
- &rx1_mix2_inp1_mux),
- SND_SOC_DAPM_MUX("RX2 MIX2 INP1", SND_SOC_NOPM, 0, 0,
- &rx2_mix2_inp1_mux),
-
- SND_SOC_DAPM_SUPPLY_S("CDC_CONN", -2, MSM89XX_CDC_CORE_CLK_OTHR_CTL,
- 2, 0, NULL, 0),
-
- SND_SOC_DAPM_MUX_E("DEC1 MUX",
- MSM89XX_CDC_CORE_CLK_TX_CLK_EN_B1_CTL, 0, 0,
- &dec1_mux, msm_dig_cdc_codec_enable_dec,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_MUX_E("DEC2 MUX",
- MSM89XX_CDC_CORE_CLK_TX_CLK_EN_B1_CTL, 1, 0,
- &dec2_mux, msm_dig_cdc_codec_enable_dec,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_MUX_E("DEC3 MUX",
- MSM89XX_CDC_CORE_CLK_TX_CLK_EN_B1_CTL, 2, 0,
- &dec3_mux, msm_dig_cdc_codec_enable_dec,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_MUX_E("DEC4 MUX",
- MSM89XX_CDC_CORE_CLK_TX_CLK_EN_B1_CTL, 3, 0,
- &dec4_mux, msm_dig_cdc_codec_enable_dec,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_MUX_E("DEC5 MUX",
- MSM89XX_CDC_CORE_CLK_TX_CLK_EN_B1_CTL, 4, 0,
- &decsva_mux, msm_dig_cdc_codec_enable_dec,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
-
- /* Sidetone */
- SND_SOC_DAPM_MUX("IIR1 INP1 MUX", SND_SOC_NOPM, 0, 0, &iir1_inp1_mux),
- SND_SOC_DAPM_PGA_E("IIR1", MSM89XX_CDC_CORE_CLK_SD_CTL, 0, 0, NULL, 0,
- msm_dig_cdc_codec_set_iir_gain, SND_SOC_DAPM_POST_PMU),
-
- SND_SOC_DAPM_MUX("IIR2 INP1 MUX", SND_SOC_NOPM, 0, 0, &iir2_inp1_mux),
- SND_SOC_DAPM_PGA_E("IIR2", MSM89XX_CDC_CORE_CLK_SD_CTL, 1, 0, NULL, 0,
- msm_dig_cdc_codec_set_iir_gain, SND_SOC_DAPM_POST_PMU),
-
- SND_SOC_DAPM_SUPPLY("RX_I2S_CLK",
- MSM89XX_CDC_CORE_CLK_RX_I2S_CTL, 4, 0, NULL, 0),
- SND_SOC_DAPM_SUPPLY("TX_I2S_CLK",
- MSM89XX_CDC_CORE_CLK_TX_I2S_CTL, 4, 0, NULL, 0),
-
-
- SND_SOC_DAPM_MUX("I2S TX2 INP1", SND_SOC_NOPM, 0, 0,
- &i2s_tx2_inp1_mux),
- SND_SOC_DAPM_MUX("I2S TX2 INP2", SND_SOC_NOPM, 0, 0,
- &i2s_tx2_inp2_mux),
- SND_SOC_DAPM_MUX("I2S TX3 INP2", SND_SOC_NOPM, 0, 0,
- &i2s_tx3_inp2_mux),
-
- /* Digital Mic Inputs */
- SND_SOC_DAPM_ADC_E("DMIC1", NULL, SND_SOC_NOPM, 0, 0,
- msm_dig_cdc_codec_enable_dmic, SND_SOC_DAPM_PRE_PMU |
- SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_ADC_E("DMIC2", NULL, SND_SOC_NOPM, 0, 0,
- msm_dig_cdc_codec_enable_dmic, SND_SOC_DAPM_PRE_PMU |
- SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_ADC_E("DMIC3", NULL, SND_SOC_NOPM, 0, 0,
- msm_dig_cdc_codec_enable_dmic, SND_SOC_DAPM_PRE_PMU |
- SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_ADC_E("DMIC4", NULL, SND_SOC_NOPM, 0, 0,
- msm_dig_cdc_codec_enable_dmic, SND_SOC_DAPM_PRE_PMU |
- SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_INPUT("ADC1_IN"),
- SND_SOC_DAPM_INPUT("ADC2_IN"),
- SND_SOC_DAPM_INPUT("ADC3_IN"),
- SND_SOC_DAPM_OUTPUT("PDM_OUT_RX1"),
- SND_SOC_DAPM_OUTPUT("PDM_OUT_RX2"),
- SND_SOC_DAPM_OUTPUT("PDM_OUT_RX3"),
-};
-
-static const struct soc_enum cf_dec1_enum =
- SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_TX1_MUX_CTL, 4, 3, cf_text);
-
-static const struct soc_enum cf_dec2_enum =
- SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_TX2_MUX_CTL, 4, 3, cf_text);
-
-static const struct soc_enum cf_dec3_enum =
- SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_TX3_MUX_CTL, 4, 3, cf_text);
-
-static const struct soc_enum cf_dec4_enum =
- SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_TX4_MUX_CTL, 4, 3, cf_text);
-
-static const struct soc_enum cf_decsva_enum =
- SOC_ENUM_SINGLE(MSM89XX_CDC_CORE_TX5_MUX_CTL, 4, 3, cf_text);
-
-static const struct snd_kcontrol_new msm_dig_snd_controls[] = {
- SOC_SINGLE_SX_TLV("DEC1 Volume",
- MSM89XX_CDC_CORE_TX1_VOL_CTL_GAIN,
- 0, -84, 40, digital_gain),
- SOC_SINGLE_SX_TLV("DEC2 Volume",
- MSM89XX_CDC_CORE_TX2_VOL_CTL_GAIN,
- 0, -84, 40, digital_gain),
- SOC_SINGLE_SX_TLV("DEC3 Volume",
- MSM89XX_CDC_CORE_TX3_VOL_CTL_GAIN,
- 0, -84, 40, digital_gain),
- SOC_SINGLE_SX_TLV("DEC4 Volume",
- MSM89XX_CDC_CORE_TX4_VOL_CTL_GAIN,
- 0, -84, 40, digital_gain),
- SOC_SINGLE_SX_TLV("DEC5 Volume",
- MSM89XX_CDC_CORE_TX5_VOL_CTL_GAIN,
- 0, -84, 40, digital_gain),
-
- SOC_SINGLE_SX_TLV("IIR1 INP1 Volume",
- MSM89XX_CDC_CORE_IIR1_GAIN_B1_CTL,
- 0, -84, 40, digital_gain),
- SOC_SINGLE_SX_TLV("IIR1 INP2 Volume",
- MSM89XX_CDC_CORE_IIR1_GAIN_B2_CTL,
- 0, -84, 40, digital_gain),
- SOC_SINGLE_SX_TLV("IIR1 INP3 Volume",
- MSM89XX_CDC_CORE_IIR1_GAIN_B3_CTL,
- 0, -84, 40, digital_gain),
- SOC_SINGLE_SX_TLV("IIR1 INP4 Volume",
- MSM89XX_CDC_CORE_IIR1_GAIN_B4_CTL,
- 0, -84, 40, digital_gain),
- SOC_SINGLE_SX_TLV("IIR2 INP1 Volume",
- MSM89XX_CDC_CORE_IIR2_GAIN_B1_CTL,
- 0, -84, 40, digital_gain),
-
- SOC_SINGLE_SX_TLV("RX1 Digital Volume",
- MSM89XX_CDC_CORE_RX1_VOL_CTL_B2_CTL,
- 0, -84, 40, digital_gain),
- SOC_SINGLE_SX_TLV("RX2 Digital Volume",
- MSM89XX_CDC_CORE_RX2_VOL_CTL_B2_CTL,
- 0, -84, 40, digital_gain),
- SOC_SINGLE_SX_TLV("RX3 Digital Volume",
- MSM89XX_CDC_CORE_RX3_VOL_CTL_B2_CTL,
- 0, -84, 40, digital_gain),
-
- SOC_SINGLE_EXT("IIR1 Enable Band1", IIR1, BAND1, 1, 0,
- msm_dig_cdc_get_iir_enable_audio_mixer,
- msm_dig_cdc_put_iir_enable_audio_mixer),
- SOC_SINGLE_EXT("IIR1 Enable Band2", IIR1, BAND2, 1, 0,
- msm_dig_cdc_get_iir_enable_audio_mixer,
- msm_dig_cdc_put_iir_enable_audio_mixer),
- SOC_SINGLE_EXT("IIR1 Enable Band3", IIR1, BAND3, 1, 0,
- msm_dig_cdc_get_iir_enable_audio_mixer,
- msm_dig_cdc_put_iir_enable_audio_mixer),
- SOC_SINGLE_EXT("IIR1 Enable Band4", IIR1, BAND4, 1, 0,
- msm_dig_cdc_get_iir_enable_audio_mixer,
- msm_dig_cdc_put_iir_enable_audio_mixer),
- SOC_SINGLE_EXT("IIR1 Enable Band5", IIR1, BAND5, 1, 0,
- msm_dig_cdc_get_iir_enable_audio_mixer,
- msm_dig_cdc_put_iir_enable_audio_mixer),
-
- SOC_SINGLE_EXT("IIR2 Enable Band1", IIR2, BAND1, 1, 0,
- msm_dig_cdc_get_iir_enable_audio_mixer,
- msm_dig_cdc_put_iir_enable_audio_mixer),
- SOC_SINGLE_EXT("IIR2 Enable Band2", IIR2, BAND2, 1, 0,
- msm_dig_cdc_get_iir_enable_audio_mixer,
- msm_dig_cdc_put_iir_enable_audio_mixer),
- SOC_SINGLE_EXT("IIR2 Enable Band3", IIR2, BAND3, 1, 0,
- msm_dig_cdc_get_iir_enable_audio_mixer,
- msm_dig_cdc_put_iir_enable_audio_mixer),
- SOC_SINGLE_EXT("IIR2 Enable Band4", IIR2, BAND4, 1, 0,
- msm_dig_cdc_get_iir_enable_audio_mixer,
- msm_dig_cdc_put_iir_enable_audio_mixer),
- SOC_SINGLE_EXT("IIR2 Enable Band5", IIR2, BAND5, 1, 0,
- msm_dig_cdc_get_iir_enable_audio_mixer,
- msm_dig_cdc_put_iir_enable_audio_mixer),
-
- SOC_SINGLE_MULTI_EXT("IIR1 Band1", IIR1, BAND1, 255, 0, 5,
- msm_dig_cdc_get_iir_band_audio_mixer,
- msm_dig_cdc_put_iir_band_audio_mixer),
- SOC_SINGLE_MULTI_EXT("IIR1 Band2", IIR1, BAND2, 255, 0, 5,
- msm_dig_cdc_get_iir_band_audio_mixer,
- msm_dig_cdc_put_iir_band_audio_mixer),
- SOC_SINGLE_MULTI_EXT("IIR1 Band3", IIR1, BAND3, 255, 0, 5,
- msm_dig_cdc_get_iir_band_audio_mixer,
- msm_dig_cdc_put_iir_band_audio_mixer),
- SOC_SINGLE_MULTI_EXT("IIR1 Band4", IIR1, BAND4, 255, 0, 5,
- msm_dig_cdc_get_iir_band_audio_mixer,
- msm_dig_cdc_put_iir_band_audio_mixer),
- SOC_SINGLE_MULTI_EXT("IIR1 Band5", IIR1, BAND5, 255, 0, 5,
- msm_dig_cdc_get_iir_band_audio_mixer,
- msm_dig_cdc_put_iir_band_audio_mixer),
-
- SOC_SINGLE_MULTI_EXT("IIR2 Band1", IIR2, BAND1, 255, 0, 5,
- msm_dig_cdc_get_iir_band_audio_mixer,
- msm_dig_cdc_put_iir_band_audio_mixer),
- SOC_SINGLE_MULTI_EXT("IIR2 Band2", IIR2, BAND2, 255, 0, 5,
- msm_dig_cdc_get_iir_band_audio_mixer,
- msm_dig_cdc_put_iir_band_audio_mixer),
- SOC_SINGLE_MULTI_EXT("IIR2 Band3", IIR2, BAND3, 255, 0, 5,
- msm_dig_cdc_get_iir_band_audio_mixer,
- msm_dig_cdc_put_iir_band_audio_mixer),
- SOC_SINGLE_MULTI_EXT("IIR2 Band4", IIR2, BAND4, 255, 0, 5,
- msm_dig_cdc_get_iir_band_audio_mixer,
- msm_dig_cdc_put_iir_band_audio_mixer),
- SOC_SINGLE_MULTI_EXT("IIR2 Band5", IIR2, BAND5, 255, 0, 5,
- msm_dig_cdc_get_iir_band_audio_mixer,
- msm_dig_cdc_put_iir_band_audio_mixer),
-
- SOC_SINGLE("RX1 HPF Switch",
- MSM89XX_CDC_CORE_RX1_B5_CTL, 2, 1, 0),
- SOC_SINGLE("RX2 HPF Switch",
- MSM89XX_CDC_CORE_RX2_B5_CTL, 2, 1, 0),
- SOC_SINGLE("RX3 HPF Switch",
- MSM89XX_CDC_CORE_RX3_B5_CTL, 2, 1, 0),
-
- SOC_ENUM("RX1 HPF cut off", cf_rxmix1_enum),
- SOC_ENUM("RX2 HPF cut off", cf_rxmix2_enum),
- SOC_ENUM("RX3 HPF cut off", cf_rxmix3_enum),
-
- SOC_ENUM("TX1 HPF cut off", cf_dec1_enum),
- SOC_ENUM("TX2 HPF cut off", cf_dec2_enum),
- SOC_ENUM("TX3 HPF cut off", cf_dec3_enum),
- SOC_ENUM("TX4 HPF cut off", cf_dec4_enum),
- SOC_ENUM("TX5 HPF cut off", cf_decsva_enum),
- SOC_SINGLE("TX1 HPF Switch",
- MSM89XX_CDC_CORE_TX1_MUX_CTL, 3, 1, 0),
- SOC_SINGLE("TX2 HPF Switch",
- MSM89XX_CDC_CORE_TX2_MUX_CTL, 3, 1, 0),
- SOC_SINGLE("TX3 HPF Switch",
- MSM89XX_CDC_CORE_TX3_MUX_CTL, 3, 1, 0),
- SOC_SINGLE("TX4 HPF Switch",
- MSM89XX_CDC_CORE_TX4_MUX_CTL, 3, 1, 0),
- SOC_SINGLE("TX5 HPF Switch",
- MSM89XX_CDC_CORE_TX5_MUX_CTL, 3, 1, 0),
-};
-
-static struct snd_soc_dai_ops msm_dig_dai_ops = {
- .hw_params = msm_dig_cdc_hw_params,
-};
-
-
-static struct snd_soc_dai_driver msm_codec_dais[] = {
- {
- .name = "msm_dig_cdc_dai_rx1",
- .id = AIF1_PB,
- .playback = { /* Support maximum range */
- .stream_name = "AIF1 Playback",
- .channels_min = 1,
- .channels_max = 2,
- .rates = SNDRV_PCM_RATE_8000_192000,
- .rate_max = 192000,
- .rate_min = 8000,
- .formats = SNDRV_PCM_FMTBIT_S16_LE |
- SNDRV_PCM_FMTBIT_S24_LE |
- SNDRV_PCM_FMTBIT_S24_3LE,
- },
- .ops = &msm_dig_dai_ops,
- },
- {
- .name = "msm_dig_cdc_dai_tx1",
- .id = AIF1_CAP,
- .capture = { /* Support maximum range */
- .stream_name = "AIF1 Capture",
- .channels_min = 1,
- .channels_max = 4,
- .rates = SNDRV_PCM_RATE_8000_48000,
- .formats = SNDRV_PCM_FMTBIT_S16_LE,
- },
- .ops = &msm_dig_dai_ops,
- },
- {
- .name = "msm_dig_cdc_dai_tx2",
- .id = AIF3_SVA,
- .capture = { /* Support maximum range */
- .stream_name = "AIF2 Capture",
- .channels_min = 1,
- .channels_max = 2,
- .rates = SNDRV_PCM_RATE_8000_48000,
- .formats = SNDRV_PCM_FMTBIT_S16_LE,
- },
- .ops = &msm_dig_dai_ops,
- },
- {
- .name = "msm_dig_cdc_dai_vifeed",
- .id = AIF2_VIFEED,
- .capture = { /* Support maximum range */
- .stream_name = "AIF2 Capture",
- .channels_min = 1,
- .channels_max = 2,
- .rates = SNDRV_PCM_RATE_8000_48000,
- .formats = SNDRV_PCM_FMTBIT_S16_LE,
- },
- .ops = &msm_dig_dai_ops,
- },
-};
-
-static struct regmap *msm_digital_get_regmap(struct device *dev)
-{
- struct msm_dig_priv *msm_dig_cdc = dev_get_drvdata(dev);
-
- return msm_dig_cdc->regmap;
-}
-
-static int msm_dig_cdc_suspend(struct snd_soc_codec *codec)
-{
- struct msm_dig_priv *msm_dig_cdc = dev_get_drvdata(codec->dev);
-
- msm_dig_cdc->dapm_bias_off = 1;
- return 0;
-}
-
-static int msm_dig_cdc_resume(struct snd_soc_codec *codec)
-{
- struct msm_dig_priv *msm_dig_cdc = dev_get_drvdata(codec->dev);
-
- msm_dig_cdc->dapm_bias_off = 0;
- return 0;
-}
-
-static struct snd_soc_codec_driver soc_msm_dig_codec = {
- .probe = msm_dig_cdc_soc_probe,
- .remove = msm_dig_cdc_soc_remove,
- .suspend = msm_dig_cdc_suspend,
- .resume = msm_dig_cdc_resume,
- .get_regmap = msm_digital_get_regmap,
- .component_driver = {
- .controls = msm_dig_snd_controls,
- .num_controls = ARRAY_SIZE(msm_dig_snd_controls),
- .dapm_widgets = msm_dig_dapm_widgets,
- .num_dapm_widgets = ARRAY_SIZE(msm_dig_dapm_widgets),
- .dapm_routes = audio_dig_map,
- .num_dapm_routes = ARRAY_SIZE(audio_dig_map),
- },
-};
-
-const struct regmap_config msm_digital_regmap_config = {
- .reg_bits = 32,
- .reg_stride = 4,
- .val_bits = 8,
- .lock = enable_digital_callback,
- .unlock = disable_digital_callback,
- .cache_type = REGCACHE_FLAT,
- .reg_defaults = msm89xx_cdc_core_defaults,
- .num_reg_defaults = MSM89XX_CDC_CORE_MAX_REGISTER,
- .writeable_reg = msm89xx_cdc_core_writeable_reg,
- .readable_reg = msm89xx_cdc_core_readable_reg,
- .volatile_reg = msm89xx_cdc_core_volatile_reg,
- .reg_format_endian = REGMAP_ENDIAN_NATIVE,
- .val_format_endian = REGMAP_ENDIAN_NATIVE,
- .max_register = MSM89XX_CDC_CORE_MAX_REGISTER,
-};
-
-static int msm_dig_cdc_probe(struct platform_device *pdev)
-{
- int ret;
- u32 dig_cdc_addr;
- struct msm_dig_priv *msm_dig_cdc;
- struct dig_ctrl_platform_data *pdata;
-
- msm_dig_cdc = devm_kzalloc(&pdev->dev, sizeof(struct msm_dig_priv),
- GFP_KERNEL);
- if (!msm_dig_cdc)
- return -ENOMEM;
- pdata = dev_get_platdata(&pdev->dev);
- if (!pdata) {
- dev_err(&pdev->dev, "%s: pdata from parent is NULL\n",
- __func__);
- ret = -EINVAL;
- goto rtn;
- }
-
- ret = of_property_read_u32(pdev->dev.of_node, "reg",
- &dig_cdc_addr);
- if (ret) {
- dev_err(&pdev->dev, "%s: could not find %s entry in dt\n",
- __func__, "reg");
- return ret;
- }
-
- msm_dig_cdc->dig_base = ioremap(dig_cdc_addr,
- MSM89XX_CDC_CORE_MAX_REGISTER);
- if (msm_dig_cdc->dig_base == NULL) {
- dev_err(&pdev->dev, "%s ioremap failed\n", __func__);
- return -ENOMEM;
- }
- msm_dig_cdc->regmap =
- devm_regmap_init_mmio_clk(&pdev->dev, NULL,
- msm_dig_cdc->dig_base, &msm_digital_regmap_config);
-
- msm_dig_cdc->update_clkdiv = pdata->update_clkdiv;
- msm_dig_cdc->set_compander_mode = pdata->set_compander_mode;
- msm_dig_cdc->get_cdc_version = pdata->get_cdc_version;
- msm_dig_cdc->handle = pdata->handle;
- msm_dig_cdc->register_notifier = pdata->register_notifier;
-
- dev_set_drvdata(&pdev->dev, msm_dig_cdc);
- snd_soc_register_codec(&pdev->dev, &soc_msm_dig_codec,
- msm_codec_dais, ARRAY_SIZE(msm_codec_dais));
- dev_dbg(&pdev->dev, "%s: registered DIG CODEC 0x%x\n",
- __func__, dig_cdc_addr);
-rtn:
- return ret;
-}
-
-static int msm_dig_cdc_remove(struct platform_device *pdev)
-{
- snd_soc_unregister_codec(&pdev->dev);
- return 0;
-}
-
-#ifdef CONFIG_PM
-static int msm_dig_suspend(struct device *dev)
-{
- struct msm_asoc_mach_data *pdata;
- struct msm_dig_priv *msm_dig_cdc = dev_get_drvdata(dev);
-
- if (!registered_digcodec || !msm_dig_cdc) {
- pr_debug("%s:digcodec not initialized, return\n", __func__);
- return 0;
- }
- pdata = snd_soc_card_get_drvdata(registered_digcodec->component.card);
- if (!pdata) {
- pr_debug("%s:card not initialized, return\n", __func__);
- return 0;
- }
- if (msm_dig_cdc->dapm_bias_off) {
- pr_debug("%s: mclk cnt = %d, mclk_enabled = %d\n",
- __func__, atomic_read(&pdata->int_mclk0_rsc_ref),
- atomic_read(&pdata->int_mclk0_enabled));
-
- if (atomic_read(&pdata->int_mclk0_enabled) == true) {
- cancel_delayed_work_sync(
- &pdata->disable_int_mclk0_work);
- mutex_lock(&pdata->cdc_int_mclk0_mutex);
- pdata->digital_cdc_core_clk.enable = 0;
- afe_set_lpass_clock_v2(AFE_PORT_ID_INT0_MI2S_RX,
- &pdata->digital_cdc_core_clk);
- atomic_set(&pdata->int_mclk0_enabled, false);
- mutex_unlock(&pdata->cdc_int_mclk0_mutex);
- }
- }
-
- return 0;
-}
-
-static int msm_dig_resume(struct device *dev)
-{
- return 0;
-}
-
-static const struct dev_pm_ops msm_dig_pm_ops = {
- .suspend_late = msm_dig_suspend,
- .resume_early = msm_dig_resume,
-};
-#endif
-
-static const struct of_device_id msm_dig_cdc_of_match[] = {
- {.compatible = "qcom,msm-digital-codec"},
- {},
-};
-
-static struct platform_driver msm_digcodec_driver = {
- .driver = {
- .owner = THIS_MODULE,
- .name = DRV_NAME,
- .of_match_table = msm_dig_cdc_of_match,
-#ifdef CONFIG_PM
- .pm = &msm_dig_pm_ops,
-#endif
- },
- .probe = msm_dig_cdc_probe,
- .remove = msm_dig_cdc_remove,
-};
-module_platform_driver(msm_digcodec_driver);
-
-MODULE_DESCRIPTION("MSM Audio Digital codec driver");
-MODULE_LICENSE("GPL v2");
diff --git a/asoc/codecs/sdm660_cdc/msm-digital-cdc.h b/asoc/codecs/sdm660_cdc/msm-digital-cdc.h
deleted file mode 100644
index 7abb204..0000000
--- a/asoc/codecs/sdm660_cdc/msm-digital-cdc.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* Copyright (c) 2016-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
- * 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.
- */
-#ifndef MSM_DIGITAL_CDC_H
-#define MSM_DIGITAL_CDC_H
-
-#define HPHL_PA_DISABLE (0x01 << 1)
-#define HPHR_PA_DISABLE (0x01 << 2)
-#define SPKR_PA_DISABLE (0x01 << 3)
-
-#define NUM_DECIMATORS 5
-/* Codec supports 1 compander */
-enum {
- COMPANDER_NONE = 0,
- COMPANDER_1, /* HPHL/R */
- COMPANDER_MAX,
-};
-
-/* Number of output I2S port */
-enum {
- MSM89XX_RX1 = 0,
- MSM89XX_RX2,
- MSM89XX_RX3,
- MSM89XX_RX_MAX,
-};
-
-struct tx_mute_work {
- struct msm_dig_priv *dig_cdc;
- u32 decimator;
- struct delayed_work dwork;
-};
-
-struct msm_dig_priv {
- struct snd_soc_codec *codec;
- u32 comp_enabled[MSM89XX_RX_MAX];
- int (*codec_hph_comp_gpio)(bool enable, struct snd_soc_codec *codec);
- s32 dmic_1_2_clk_cnt;
- s32 dmic_3_4_clk_cnt;
- bool dec_active[NUM_DECIMATORS];
- int version;
- /* Entry for version info */
- struct snd_info_entry *entry;
- struct snd_info_entry *version_entry;
- char __iomem *dig_base;
- struct regmap *regmap;
- struct notifier_block nblock;
- u32 mute_mask;
- int dapm_bias_off;
- void *handle;
- void (*set_compander_mode)(void *handle, int val);
- void (*update_clkdiv)(void *handle, int val);
- int (*get_cdc_version)(void *handle);
- int (*register_notifier)(void *handle,
- struct notifier_block *nblock,
- bool enable);
- struct tx_mute_work tx_mute_dwork[NUM_DECIMATORS];
-};
-
-struct dig_ctrl_platform_data {
- void *handle;
- void (*set_compander_mode)(void *handle, int val);
- void (*update_clkdiv)(void *handle, int val);
- int (*get_cdc_version)(void *handle);
- int (*register_notifier)(void *handle,
- struct notifier_block *nblock,
- bool enable);
-};
-
-struct hpf_work {
- struct msm_dig_priv *dig_cdc;
- u32 decimator;
- u8 tx_hpf_cut_of_freq;
- struct delayed_work dwork;
-};
-
-/* Codec supports 5 bands */
-enum {
- BAND1 = 0,
- BAND2,
- BAND3,
- BAND4,
- BAND5,
- BAND_MAX,
-};
-
-#if IS_ENABLED(CONFIG_SND_SOC_DIGITAL_CDC)
-extern void msm_dig_cdc_hph_comp_cb(
- int (*codec_hph_comp_gpio)(
- bool enable, struct snd_soc_codec *codec),
- struct snd_soc_codec *codec);
-int msm_dig_codec_info_create_codec_entry(struct snd_info_entry *codec_root,
- struct snd_soc_codec *codec);
-#else /* CONFIG_SND_SOC_DIGITAL_CDC */
-static inline void msm_dig_cdc_hph_comp_cb(
- int (*codec_hph_comp_gpio)(
- bool enable, struct snd_soc_codec *codec),
- struct snd_soc_codec *codec)
-{
-
-}
-static inline int msm_dig_codec_info_create_codec_entry(
- struct snd_info_entry *codec_root,
- struct snd_soc_codec *codec)
-{
- return 0;
-}
-#endif /* CONFIG_SND_SOC_DIGITAL_CDC */
-#endif
diff --git a/asoc/codecs/sdm660_cdc/sdm660-cdc-irq.c b/asoc/codecs/sdm660_cdc/sdm660-cdc-irq.c
deleted file mode 100644
index 673b738..0000000
--- a/asoc/codecs/sdm660_cdc/sdm660-cdc-irq.c
+++ /dev/null
@@ -1,418 +0,0 @@
-/* Copyright (c) 2015-2018, 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.
- */
-
-#include <linux/bitops.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/of_irq.h>
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/slab.h>
-#include <linux/spmi.h>
-#include <linux/platform_device.h>
-#include <linux/delay.h>
-#include <linux/of.h>
-#include <linux/of_device.h>
-#include <linux/interrupt.h>
-#include <linux/pm_qos.h>
-#include <soc/qcom/pm.h>
-#include <sound/soc.h>
-#include "msm-analog-cdc.h"
-#include "sdm660-cdc-irq.h"
-#include "sdm660-cdc-registers.h"
-
-#define MAX_NUM_IRQS 14
-#define NUM_IRQ_REGS 2
-#define WCD9XXX_SYSTEM_RESUME_TIMEOUT_MS 700
-
-#define BYTE_BIT_MASK(nr) (1UL << ((nr) % BITS_PER_BYTE))
-#define BIT_BYTE(nr) ((nr) / BITS_PER_BYTE)
-
-static irqreturn_t wcd9xxx_spmi_irq_handler(int linux_irq, void *data);
-
-char *irq_names[MAX_NUM_IRQS] = {
- "spk_cnp_int",
- "spk_clip_int",
- "spk_ocp_int",
- "ins_rem_det1",
- "but_rel_det",
- "but_press_det",
- "ins_rem_det",
- "mbhc_int",
- "ear_ocp_int",
- "hphr_ocp_int",
- "hphl_ocp_det",
- "ear_cnp_int",
- "hphr_cnp_int",
- "hphl_cnp_int"
-};
-
-int order[MAX_NUM_IRQS] = {
- MSM89XX_IRQ_SPKR_CNP,
- MSM89XX_IRQ_SPKR_CLIP,
- MSM89XX_IRQ_SPKR_OCP,
- MSM89XX_IRQ_MBHC_INSREM_DET1,
- MSM89XX_IRQ_MBHC_RELEASE,
- MSM89XX_IRQ_MBHC_PRESS,
- MSM89XX_IRQ_MBHC_INSREM_DET,
- MSM89XX_IRQ_MBHC_HS_DET,
- MSM89XX_IRQ_EAR_OCP,
- MSM89XX_IRQ_HPHR_OCP,
- MSM89XX_IRQ_HPHL_OCP,
- MSM89XX_IRQ_EAR_CNP,
- MSM89XX_IRQ_HPHR_CNP,
- MSM89XX_IRQ_HPHL_CNP,
-};
-
-enum wcd9xxx_spmi_pm_state {
- WCD9XXX_PM_SLEEPABLE,
- WCD9XXX_PM_AWAKE,
- WCD9XXX_PM_ASLEEP,
-};
-
-struct wcd9xxx_spmi_map {
- uint8_t handled[NUM_IRQ_REGS];
- uint8_t mask[NUM_IRQ_REGS];
- int linuxirq[MAX_NUM_IRQS];
- irq_handler_t handler[MAX_NUM_IRQS];
- struct platform_device *spmi[NUM_IRQ_REGS];
- struct snd_soc_codec *codec;
-
- enum wcd9xxx_spmi_pm_state pm_state;
- struct mutex pm_lock;
- /* pm_wq notifies change of pm_state */
- wait_queue_head_t pm_wq;
- struct pm_qos_request pm_qos_req;
- int wlock_holders;
-};
-
-struct wcd9xxx_spmi_map map;
-
-void wcd9xxx_spmi_enable_irq(int irq)
-{
- pr_debug("%s: irqno =%d\n", __func__, irq);
-
- if (!(map.mask[BIT_BYTE(irq)] & (BYTE_BIT_MASK(irq))))
- return;
-
- map.mask[BIT_BYTE(irq)] &=
- ~(BYTE_BIT_MASK(irq));
-
- enable_irq(map.linuxirq[irq]);
-}
-
-void wcd9xxx_spmi_disable_irq(int irq)
-{
- pr_debug("%s: irqno =%d\n", __func__, irq);
-
- if (map.mask[BIT_BYTE(irq)] & (BYTE_BIT_MASK(irq)))
- return;
-
- map.mask[BIT_BYTE(irq)] |=
- (BYTE_BIT_MASK(irq));
-
- disable_irq_nosync(map.linuxirq[irq]);
-}
-
-int wcd9xxx_spmi_request_irq(int irq, irq_handler_t handler,
- const char *name, void *priv)
-{
- int rc;
- unsigned long irq_flags;
-
- map.linuxirq[irq] =
- platform_get_irq_byname(map.spmi[BIT_BYTE(irq)],
- irq_names[irq]);
-
- if (strcmp(name, "mbhc sw intr"))
- irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING |
- IRQF_ONESHOT;
- else
- irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING |
- IRQF_ONESHOT | IRQF_NO_SUSPEND;
- pr_debug("%s: name:%s irq_flags = %lx\n", __func__, name, irq_flags);
-
- rc = devm_request_threaded_irq(&map.spmi[BIT_BYTE(irq)]->dev,
- map.linuxirq[irq], NULL,
- wcd9xxx_spmi_irq_handler,
- irq_flags,
- name, priv);
- if (rc < 0) {
- dev_err(&map.spmi[BIT_BYTE(irq)]->dev,
- "Can't request %d IRQ\n", irq);
- return rc;
- }
-
- dev_dbg(&map.spmi[BIT_BYTE(irq)]->dev,
- "irq %d linuxIRQ: %d\n", irq, map.linuxirq[irq]);
- map.mask[BIT_BYTE(irq)] &= ~BYTE_BIT_MASK(irq);
- map.handler[irq] = handler;
- enable_irq_wake(map.linuxirq[irq]);
- return 0;
-}
-
-int wcd9xxx_spmi_free_irq(int irq, void *priv)
-{
- devm_free_irq(&map.spmi[BIT_BYTE(irq)]->dev, map.linuxirq[irq],
- priv);
- map.mask[BIT_BYTE(irq)] |= BYTE_BIT_MASK(irq);
- return 0;
-}
-
-static int get_irq_bit(int linux_irq)
-{
- int i = 0;
-
- for (; i < MAX_NUM_IRQS; i++)
- if (map.linuxirq[i] == linux_irq)
- return i;
-
- return i;
-}
-
-static int get_order_irq(int i)
-{
- return order[i];
-}
-
-static irqreturn_t wcd9xxx_spmi_irq_handler(int linux_irq, void *data)
-{
- int irq, i, j;
- unsigned long status[NUM_IRQ_REGS] = {0};
-
- if (unlikely(wcd9xxx_spmi_lock_sleep() == false)) {
- pr_err("Failed to hold suspend\n");
- return IRQ_NONE;
- }
-
- irq = get_irq_bit(linux_irq);
- if (irq == MAX_NUM_IRQS)
- return IRQ_HANDLED;
-
- status[BIT_BYTE(irq)] |= BYTE_BIT_MASK(irq);
- for (i = 0; i < NUM_IRQ_REGS; i++) {
- status[i] |= snd_soc_read(map.codec,
- BIT_BYTE(irq) * 0x100 +
- MSM89XX_PMIC_DIGITAL_INT_LATCHED_STS);
- status[i] &= ~map.mask[i];
- }
- for (i = 0; i < MAX_NUM_IRQS; i++) {
- j = get_order_irq(i);
- if ((status[BIT_BYTE(j)] & BYTE_BIT_MASK(j)) &&
- ((map.handled[BIT_BYTE(j)] &
- BYTE_BIT_MASK(j)) == 0)) {
- map.handler[j](irq, data);
- map.handled[BIT_BYTE(j)] |=
- BYTE_BIT_MASK(j);
- }
- }
- map.handled[BIT_BYTE(irq)] &= ~BYTE_BIT_MASK(irq);
- wcd9xxx_spmi_unlock_sleep();
-
- return IRQ_HANDLED;
-}
-
-enum wcd9xxx_spmi_pm_state wcd9xxx_spmi_pm_cmpxchg(
- enum wcd9xxx_spmi_pm_state o,
- enum wcd9xxx_spmi_pm_state n)
-{
- enum wcd9xxx_spmi_pm_state old;
-
- mutex_lock(&map.pm_lock);
- old = map.pm_state;
- if (old == o)
- map.pm_state = n;
- pr_debug("%s: map.pm_state = %d\n", __func__, map.pm_state);
- mutex_unlock(&map.pm_lock);
- return old;
-}
-EXPORT_SYMBOL(wcd9xxx_spmi_pm_cmpxchg);
-
-int wcd9xxx_spmi_suspend(pm_message_t pmesg)
-{
- int ret = 0;
-
- pr_debug("%s: enter\n", __func__);
- /*
- * pm_qos_update_request() can be called after this suspend chain call
- * started. thus suspend can be called while lock is being held
- */
- mutex_lock(&map.pm_lock);
- if (map.pm_state == WCD9XXX_PM_SLEEPABLE) {
- pr_debug("%s: suspending system, state %d, wlock %d\n",
- __func__, map.pm_state,
- map.wlock_holders);
- map.pm_state = WCD9XXX_PM_ASLEEP;
- } else if (map.pm_state == WCD9XXX_PM_AWAKE) {
- /*
- * unlock to wait for pm_state == WCD9XXX_PM_SLEEPABLE
- * then set to WCD9XXX_PM_ASLEEP
- */
- pr_debug("%s: waiting to suspend system, state %d, wlock %d\n",
- __func__, map.pm_state,
- map.wlock_holders);
- mutex_unlock(&map.pm_lock);
- if (!(wait_event_timeout(map.pm_wq,
- wcd9xxx_spmi_pm_cmpxchg(
- WCD9XXX_PM_SLEEPABLE,
- WCD9XXX_PM_ASLEEP) ==
- WCD9XXX_PM_SLEEPABLE,
- HZ))) {
- pr_debug("%s: suspend failed state %d, wlock %d\n",
- __func__, map.pm_state,
- map.wlock_holders);
- ret = -EBUSY;
- } else {
- pr_debug("%s: done, state %d, wlock %d\n", __func__,
- map.pm_state,
- map.wlock_holders);
- }
- mutex_lock(&map.pm_lock);
- } else if (map.pm_state == WCD9XXX_PM_ASLEEP) {
- pr_warn("%s: system is already suspended, state %d, wlock %dn",
- __func__, map.pm_state,
- map.wlock_holders);
- }
- mutex_unlock(&map.pm_lock);
-
- return ret;
-}
-EXPORT_SYMBOL(wcd9xxx_spmi_suspend);
-
-int wcd9xxx_spmi_resume(void)
-{
- int ret = 0;
-
- pr_debug("%s: enter\n", __func__);
- mutex_lock(&map.pm_lock);
- if (map.pm_state == WCD9XXX_PM_ASLEEP) {
- pr_debug("%s: resuming system, state %d, wlock %d\n", __func__,
- map.pm_state,
- map.wlock_holders);
- map.pm_state = WCD9XXX_PM_SLEEPABLE;
- } else {
- pr_warn("%s: system is already awake, state %d wlock %d\n",
- __func__, map.pm_state,
- map.wlock_holders);
- }
- mutex_unlock(&map.pm_lock);
- wake_up_all(&map.pm_wq);
-
- return ret;
-}
-EXPORT_SYMBOL(wcd9xxx_spmi_resume);
-
-bool wcd9xxx_spmi_lock_sleep(void)
-{
- /*
- * wcd9xxx_spmi_{lock/unlock}_sleep will be called by
- * wcd9xxx_spmi_irq_thread
- * and its subroutines only motly.
- * but btn0_lpress_fn is not wcd9xxx_spmi_irq_thread's subroutine and
- * It can race with wcd9xxx_spmi_irq_thread.
- * So need to embrace wlock_holders with mutex.
- */
- mutex_lock(&map.pm_lock);
- if (map.wlock_holders++ == 0) {
- pr_debug("%s: holding wake lock\n", __func__);
- pm_qos_update_request(&map.pm_qos_req,
- msm_cpuidle_get_deep_idle_latency());
- pm_stay_awake(&map.spmi[0]->dev);
- }
- mutex_unlock(&map.pm_lock);
- pr_debug("%s: wake lock counter %d\n", __func__,
- map.wlock_holders);
- pr_debug("%s: map.pm_state = %d\n", __func__, map.pm_state);
-
- if (!wait_event_timeout(map.pm_wq,
- ((wcd9xxx_spmi_pm_cmpxchg(
- WCD9XXX_PM_SLEEPABLE,
- WCD9XXX_PM_AWAKE)) ==
- WCD9XXX_PM_SLEEPABLE ||
- (wcd9xxx_spmi_pm_cmpxchg(
- WCD9XXX_PM_SLEEPABLE,
- WCD9XXX_PM_AWAKE) ==
- WCD9XXX_PM_AWAKE)),
- msecs_to_jiffies(
- WCD9XXX_SYSTEM_RESUME_TIMEOUT_MS))) {
- pr_warn("%s: system didn't resume within %dms, s %d, w %d\n",
- __func__,
- WCD9XXX_SYSTEM_RESUME_TIMEOUT_MS, map.pm_state,
- map.wlock_holders);
- wcd9xxx_spmi_unlock_sleep();
- return false;
- }
- wake_up_all(&map.pm_wq);
- pr_debug("%s: leaving pm_state = %d\n", __func__, map.pm_state);
- return true;
-}
-EXPORT_SYMBOL(wcd9xxx_spmi_lock_sleep);
-
-void wcd9xxx_spmi_unlock_sleep(void)
-{
- mutex_lock(&map.pm_lock);
- if (--map.wlock_holders == 0) {
- pr_debug("%s: releasing wake lock pm_state %d -> %d\n",
- __func__, map.pm_state, WCD9XXX_PM_SLEEPABLE);
- /*
- * if wcd9xxx_spmi_lock_sleep failed, pm_state would be still
- * WCD9XXX_PM_ASLEEP, don't overwrite
- */
- if (likely(map.pm_state == WCD9XXX_PM_AWAKE))
- map.pm_state = WCD9XXX_PM_SLEEPABLE;
- pm_qos_update_request(&map.pm_qos_req,
- PM_QOS_DEFAULT_VALUE);
- pm_relax(&map.spmi[0]->dev);
- }
- mutex_unlock(&map.pm_lock);
- pr_debug("%s: wake lock counter %d\n", __func__,
- map.wlock_holders);
- pr_debug("%s: map.pm_state = %d\n", __func__, map.pm_state);
- wake_up_all(&map.pm_wq);
-}
-EXPORT_SYMBOL(wcd9xxx_spmi_unlock_sleep);
-
-void wcd9xxx_spmi_set_codec(struct snd_soc_codec *codec)
-{
- map.codec = codec;
-}
-
-void wcd9xxx_spmi_set_dev(struct platform_device *spmi, int i)
-{
- if (i < NUM_IRQ_REGS)
- map.spmi[i] = spmi;
-}
-
-int wcd9xxx_spmi_irq_init(void)
-{
- int i = 0;
-
- for (; i < MAX_NUM_IRQS; i++)
- map.mask[BIT_BYTE(i)] |= BYTE_BIT_MASK(i);
- mutex_init(&map.pm_lock);
- map.wlock_holders = 0;
- map.pm_state = WCD9XXX_PM_SLEEPABLE;
- init_waitqueue_head(&map.pm_wq);
- pm_qos_add_request(&map.pm_qos_req,
- PM_QOS_CPU_DMA_LATENCY,
- PM_QOS_DEFAULT_VALUE);
-
- return 0;
-}
-
-void wcd9xxx_spmi_irq_exit(void)
-{
- pm_qos_remove_request(&map.pm_qos_req);
- mutex_destroy(&map.pm_lock);
-}
-MODULE_DESCRIPTION("MSM8x16 SPMI IRQ driver");
-MODULE_LICENSE("GPL v2");
diff --git a/asoc/codecs/sdm660_cdc/sdm660-cdc-irq.h b/asoc/codecs/sdm660_cdc/sdm660-cdc-irq.h
deleted file mode 100644
index 0b9b56e..0000000
--- a/asoc/codecs/sdm660_cdc/sdm660-cdc-irq.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (c) 2015-2018, 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.
- */
-#ifndef __WCD9XXX_SPMI_IRQ_H__
-#define __WCD9XXX_SPMI_IRQ_H__
-
-#include <sound/soc.h>
-#include <linux/spmi.h>
-#include <linux/platform_device.h>
-#include <linux/irq.h>
-#include <linux/pm_qos.h>
-
-extern void wcd9xxx_spmi_enable_irq(int irq);
-extern void wcd9xxx_spmi_disable_irq(int irq);
-extern int wcd9xxx_spmi_request_irq(int irq, irq_handler_t handler,
- const char *name, void *priv);
-extern int wcd9xxx_spmi_free_irq(int irq, void *priv);
-extern void wcd9xxx_spmi_set_codec(struct snd_soc_codec *codec);
-extern void wcd9xxx_spmi_set_dev(struct platform_device *spmi, int i);
-extern int wcd9xxx_spmi_irq_init(void);
-extern void wcd9xxx_spmi_irq_exit(void);
-extern int wcd9xxx_spmi_suspend(pm_message_t pmesg);
-extern int wcd9xxx_spmi_resume(void);
-bool wcd9xxx_spmi_lock_sleep(void);
-void wcd9xxx_spmi_unlock_sleep(void);
-
-#endif
diff --git a/asoc/codecs/sdm660_cdc/sdm660-cdc-registers.h b/asoc/codecs/sdm660_cdc/sdm660-cdc-registers.h
deleted file mode 100644
index 1317ce1..0000000
--- a/asoc/codecs/sdm660_cdc/sdm660-cdc-registers.h
+++ /dev/null
@@ -1,603 +0,0 @@
-/* Copyright (c) 2015-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
- * 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.
- */
-#ifndef SDM660_WCD_REGISTERS_H
-#define SDM660_WCD_REGISTERS_H
-
-#define CDC_DIG_BASE 0xF000
-#define CDC_ANA_BASE 0xF100
-
-#define MSM89XX_PMIC_DIGITAL_REVISION1 (CDC_DIG_BASE+0x000)
-#define MSM89XX_PMIC_DIGITAL_REVISION1__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_REVISION2 (CDC_DIG_BASE+0x001)
-#define MSM89XX_PMIC_DIGITAL_REVISION2__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_PERPH_TYPE (CDC_DIG_BASE+0x004)
-#define MSM89XX_PMIC_DIGITAL_PERPH_TYPE__POR (0x23)
-#define MSM89XX_PMIC_DIGITAL_PERPH_SUBTYPE (CDC_DIG_BASE+0x005)
-#define MSM89XX_PMIC_DIGITAL_PERPH_SUBTYPE__POR (0x01)
-#define MSM89XX_PMIC_DIGITAL_INT_RT_STS (CDC_DIG_BASE+0x010)
-#define MSM89XX_PMIC_DIGITAL_INT_RT_STS__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_INT_SET_TYPE (CDC_DIG_BASE+0x011)
-#define MSM89XX_PMIC_DIGITAL_INT_SET_TYPE__POR (0xFF)
-#define MSM89XX_PMIC_DIGITAL_INT_POLARITY_HIGH (CDC_DIG_BASE+0x012)
-#define MSM89XX_PMIC_DIGITAL_INT_POLARITY_HIGH__POR (0xFF)
-#define MSM89XX_PMIC_DIGITAL_INT_POLARITY_LOW (CDC_DIG_BASE+0x013)
-#define MSM89XX_PMIC_DIGITAL_INT_POLARITY_LOW__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_INT_LATCHED_CLR (CDC_DIG_BASE+0x014)
-#define MSM89XX_PMIC_DIGITAL_INT_LATCHED_CLR__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_INT_EN_SET (CDC_DIG_BASE+0x015)
-#define MSM89XX_PMIC_DIGITAL_INT_EN_SET__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_INT_EN_CLR (CDC_DIG_BASE+0x016)
-#define MSM89XX_PMIC_DIGITAL_INT_EN_CLR__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_INT_LATCHED_STS (CDC_DIG_BASE+0x018)
-#define MSM89XX_PMIC_DIGITAL_INT_LATCHED_STS__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_INT_PENDING_STS (CDC_DIG_BASE+0x019)
-#define MSM89XX_PMIC_DIGITAL_INT_PENDING_STS__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_INT_MID_SEL (CDC_DIG_BASE+0x01A)
-#define MSM89XX_PMIC_DIGITAL_INT_MID_SEL__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_INT_PRIORITY (CDC_DIG_BASE+0x01B)
-#define MSM89XX_PMIC_DIGITAL_INT_PRIORITY__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_GPIO_MODE (CDC_DIG_BASE+0x040)
-#define MSM89XX_PMIC_DIGITAL_GPIO_MODE__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_PIN_CTL_OE (CDC_DIG_BASE+0x041)
-#define MSM89XX_PMIC_DIGITAL_PIN_CTL_OE__POR (0x01)
-#define MSM89XX_PMIC_DIGITAL_PIN_CTL_DATA (CDC_DIG_BASE+0x042)
-#define MSM89XX_PMIC_DIGITAL_PIN_CTL_DATA__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_PIN_STATUS (CDC_DIG_BASE+0x043)
-#define MSM89XX_PMIC_DIGITAL_PIN_STATUS__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_HDRIVE_CTL (CDC_DIG_BASE+0x044)
-#define MSM89XX_PMIC_DIGITAL_HDRIVE_CTL__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_CDC_RST_CTL (CDC_DIG_BASE+0x046)
-#define MSM89XX_PMIC_DIGITAL_CDC_RST_CTL__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_CDC_TOP_CLK_CTL (CDC_DIG_BASE+0x048)
-#define MSM89XX_PMIC_DIGITAL_CDC_TOP_CLK_CTL__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_CDC_ANA_CLK_CTL (CDC_DIG_BASE+0x049)
-#define MSM89XX_PMIC_DIGITAL_CDC_ANA_CLK_CTL__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_CDC_DIG_CLK_CTL (CDC_DIG_BASE+0x04A)
-#define MSM89XX_PMIC_DIGITAL_CDC_DIG_CLK_CTL__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_CDC_CONN_TX1_CTL (CDC_DIG_BASE+0x050)
-#define MSM89XX_PMIC_DIGITAL_CDC_CONN_TX1_CTL__POR (0x02)
-#define MSM89XX_PMIC_DIGITAL_CDC_CONN_TX2_CTL (CDC_DIG_BASE+0x051)
-#define MSM89XX_PMIC_DIGITAL_CDC_CONN_TX2_CTL__POR (0x02)
-#define MSM89XX_PMIC_DIGITAL_CDC_CONN_HPHR_DAC_CTL (CDC_DIG_BASE+0x052)
-#define MSM89XX_PMIC_DIGITAL_CDC_CONN_HPHR_DAC_CTL__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_CDC_CONN_RX1_CTL (CDC_DIG_BASE+0x053)
-#define MSM89XX_PMIC_DIGITAL_CDC_CONN_RX1_CTL__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_CDC_CONN_RX2_CTL (CDC_DIG_BASE+0x054)
-#define MSM89XX_PMIC_DIGITAL_CDC_CONN_RX2_CTL__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_CDC_CONN_RX3_CTL (CDC_DIG_BASE+0x055)
-#define MSM89XX_PMIC_DIGITAL_CDC_CONN_RX3_CTL__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_CDC_CONN_RX_LB_CTL (CDC_DIG_BASE+0x056)
-#define MSM89XX_PMIC_DIGITAL_CDC_CONN_RX_LB_CTL__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_CDC_RX_CTL1 (CDC_DIG_BASE+0x058)
-#define MSM89XX_PMIC_DIGITAL_CDC_RX_CTL1__POR (0x7C)
-#define MSM89XX_PMIC_DIGITAL_CDC_RX_CTL2 (CDC_DIG_BASE+0x059)
-#define MSM89XX_PMIC_DIGITAL_CDC_RX_CTL2__POR (0x7C)
-#define MSM89XX_PMIC_DIGITAL_CDC_RX_CTL3 (CDC_DIG_BASE+0x05A)
-#define MSM89XX_PMIC_DIGITAL_CDC_RX_CTL3__POR (0x7C)
-#define MSM89XX_PMIC_DIGITAL_DEM_BYPASS_DATA0 (CDC_DIG_BASE+0x05B)
-#define MSM89XX_PMIC_DIGITAL_DEM_BYPASS_DATA0__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_DEM_BYPASS_DATA1 (CDC_DIG_BASE+0x05C)
-#define MSM89XX_PMIC_DIGITAL_DEM_BYPASS_DATA1__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_DEM_BYPASS_DATA2 (CDC_DIG_BASE+0x05D)
-#define MSM89XX_PMIC_DIGITAL_DEM_BYPASS_DATA2__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_DEM_BYPASS_DATA3 (CDC_DIG_BASE+0x05E)
-#define MSM89XX_PMIC_DIGITAL_DEM_BYPASS_DATA3__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_DIG_DEBUG_CTL (CDC_DIG_BASE+0x068)
-#define MSM89XX_PMIC_DIGITAL_DIG_DEBUG_CTL__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_DIG_DEBUG_EN (CDC_DIG_BASE+0x069)
-#define MSM89XX_PMIC_DIGITAL_DIG_DEBUG_EN__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_SPARE_0 (CDC_DIG_BASE+0x070)
-#define MSM89XX_PMIC_DIGITAL_SPARE_0__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_SPARE_1 (CDC_DIG_BASE+0x071)
-#define MSM89XX_PMIC_DIGITAL_SPARE_1__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_SPARE_2 (CDC_DIG_BASE+0x072)
-#define MSM89XX_PMIC_DIGITAL_SPARE_2__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_SEC_ACCESS (CDC_DIG_BASE+0x0D0)
-#define MSM89XX_PMIC_DIGITAL_SEC_ACCESS__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_PERPH_RESET_CTL1 (CDC_DIG_BASE+0x0D8)
-#define MSM89XX_PMIC_DIGITAL_PERPH_RESET_CTL1__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_PERPH_RESET_CTL2 (CDC_DIG_BASE+0x0D9)
-#define MSM89XX_PMIC_DIGITAL_PERPH_RESET_CTL2__POR (0x01)
-#define MSM89XX_PMIC_DIGITAL_PERPH_RESET_CTL3 (CDC_DIG_BASE+0x0DA)
-#define MSM89XX_PMIC_DIGITAL_PERPH_RESET_CTL3__POR (0x05)
-#define MSM89XX_PMIC_DIGITAL_PERPH_RESET_CTL4 (CDC_DIG_BASE+0x0DB)
-#define MSM89XX_PMIC_DIGITAL_PERPH_RESET_CTL4__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_INT_TEST1 (CDC_DIG_BASE+0x0E0)
-#define MSM89XX_PMIC_DIGITAL_INT_TEST1__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_INT_TEST_VAL (CDC_DIG_BASE+0x0E1)
-#define MSM89XX_PMIC_DIGITAL_INT_TEST_VAL__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_TRIM_NUM (CDC_DIG_BASE+0x0F0)
-#define MSM89XX_PMIC_DIGITAL_TRIM_NUM__POR (0x00)
-#define MSM89XX_PMIC_DIGITAL_TRIM_CTRL (CDC_DIG_BASE+0x0F1)
-#define MSM89XX_PMIC_DIGITAL_TRIM_CTRL__POR (0x00)
-
-#define MSM89XX_PMIC_ANALOG_REVISION1 (CDC_ANA_BASE+0x00)
-#define MSM89XX_PMIC_ANALOG_REVISION1__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_REVISION2 (CDC_ANA_BASE+0x01)
-#define MSM89XX_PMIC_ANALOG_REVISION2__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_REVISION3 (CDC_ANA_BASE+0x02)
-#define MSM89XX_PMIC_ANALOG_REVISION3__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_REVISION4 (CDC_ANA_BASE+0x03)
-#define MSM89XX_PMIC_ANALOG_REVISION4__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_PERPH_TYPE (CDC_ANA_BASE+0x04)
-#define MSM89XX_PMIC_ANALOG_PERPH_TYPE__POR (0x23)
-#define MSM89XX_PMIC_ANALOG_PERPH_SUBTYPE (CDC_ANA_BASE+0x05)
-#define MSM89XX_PMIC_ANALOG_PERPH_SUBTYPE__POR (0x09)
-#define MSM89XX_PMIC_ANALOG_INT_RT_STS (CDC_ANA_BASE+0x10)
-#define MSM89XX_PMIC_ANALOG_INT_RT_STS__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_INT_SET_TYPE (CDC_ANA_BASE+0x11)
-#define MSM89XX_PMIC_ANALOG_INT_SET_TYPE__POR (0x3F)
-#define MSM89XX_PMIC_ANALOG_INT_POLARITY_HIGH (CDC_ANA_BASE+0x12)
-#define MSM89XX_PMIC_ANALOG_INT_POLARITY_HIGH__POR (0x3F)
-#define MSM89XX_PMIC_ANALOG_INT_POLARITY_LOW (CDC_ANA_BASE+0x13)
-#define MSM89XX_PMIC_ANALOG_INT_POLARITY_LOW__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_INT_LATCHED_CLR (CDC_ANA_BASE+0x14)
-#define MSM89XX_PMIC_ANALOG_INT_LATCHED_CLR__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_INT_EN_SET (CDC_ANA_BASE+0x15)
-#define MSM89XX_PMIC_ANALOG_INT_EN_SET__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_INT_EN_CLR (CDC_ANA_BASE+0x16)
-#define MSM89XX_PMIC_ANALOG_INT_EN_CLR__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_INT_LATCHED_STS (CDC_ANA_BASE+0x18)
-#define MSM89XX_PMIC_ANALOG_INT_LATCHED_STS__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_INT_PENDING_STS (CDC_ANA_BASE+0x19)
-#define MSM89XX_PMIC_ANALOG_INT_PENDING_STS__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_INT_MID_SEL (CDC_ANA_BASE+0x1A)
-#define MSM89XX_PMIC_ANALOG_INT_MID_SEL__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_INT_PRIORITY (CDC_ANA_BASE+0x1B)
-#define MSM89XX_PMIC_ANALOG_INT_PRIORITY__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_MICB_1_EN (CDC_ANA_BASE+0x40)
-#define MSM89XX_PMIC_ANALOG_MICB_1_EN__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_MICB_1_VAL (CDC_ANA_BASE+0x41)
-#define MSM89XX_PMIC_ANALOG_MICB_1_VAL__POR (0x20)
-#define MSM89XX_PMIC_ANALOG_MICB_1_CTL (CDC_ANA_BASE+0x42)
-#define MSM89XX_PMIC_ANALOG_MICB_1_CTL__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_MICB_1_INT_RBIAS (CDC_ANA_BASE+0x43)
-#define MSM89XX_PMIC_ANALOG_MICB_1_INT_RBIAS__POR (0x49)
-#define MSM89XX_PMIC_ANALOG_MICB_2_EN (CDC_ANA_BASE+0x44)
-#define MSM89XX_PMIC_ANALOG_MICB_2_EN__POR (0x20)
-#define MSM89XX_PMIC_ANALOG_TX_1_2_ATEST_CTL_2 (CDC_ANA_BASE+0x45)
-#define MSM89XX_PMIC_ANALOG_TX_1_2_ATEST_CTL_2__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_MASTER_BIAS_CTL (CDC_ANA_BASE+0x46)
-#define MSM89XX_PMIC_ANALOG_MASTER_BIAS_CTL__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_MBHC_DET_CTL_1 (CDC_ANA_BASE+0x47)
-#define MSM89XX_PMIC_ANALOG_MBHC_DET_CTL_1__POR (0x35)
-#define MSM89XX_PMIC_ANALOG_MBHC_DET_CTL_2 (CDC_ANA_BASE+0x50)
-#define MSM89XX_PMIC_ANALOG_MBHC_DET_CTL_2__POR (0x08)
-#define MSM89XX_PMIC_ANALOG_MBHC_FSM_CTL (CDC_ANA_BASE+0x51)
-#define MSM89XX_PMIC_ANALOG_MBHC_FSM_CTL__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_MBHC_DBNC_TIMER (CDC_ANA_BASE+0x52)
-#define MSM89XX_PMIC_ANALOG_MBHC_DBNC_TIMER__POR (0x98)
-#define MSM89XX_PMIC_ANALOG_MBHC_BTN0_ZDETL_CTL (CDC_ANA_BASE+0x53)
-#define MSM89XX_PMIC_ANALOG_MBHC_BTN0_ZDETL_CTL__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_MBHC_BTN1_ZDETM_CTL (CDC_ANA_BASE+0x54)
-#define MSM89XX_PMIC_ANALOG_MBHC_BTN1_ZDETM_CTL__POR (0x20)
-#define MSM89XX_PMIC_ANALOG_MBHC_BTN2_ZDETH_CTL (CDC_ANA_BASE+0x55)
-#define MSM89XX_PMIC_ANALOG_MBHC_BTN2_ZDETH_CTL__POR (0x40)
-#define MSM89XX_PMIC_ANALOG_MBHC_BTN3_CTL (CDC_ANA_BASE+0x56)
-#define MSM89XX_PMIC_ANALOG_MBHC_BTN3_CTL__POR (0x61)
-#define MSM89XX_PMIC_ANALOG_MBHC_BTN4_CTL (CDC_ANA_BASE+0x57)
-#define MSM89XX_PMIC_ANALOG_MBHC_BTN4_CTL__POR (0x80)
-#define MSM89XX_PMIC_ANALOG_MBHC_BTN_RESULT (CDC_ANA_BASE+0x58)
-#define MSM89XX_PMIC_ANALOG_MBHC_BTN_RESULT__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_MBHC_ZDET_ELECT_RESULT (CDC_ANA_BASE+0x59)
-#define MSM89XX_PMIC_ANALOG_MBHC_ZDET_ELECT_RESULT__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_TX_1_EN (CDC_ANA_BASE+0x60)
-#define MSM89XX_PMIC_ANALOG_TX_1_EN__POR (0x03)
-#define MSM89XX_PMIC_ANALOG_TX_2_EN (CDC_ANA_BASE+0x61)
-#define MSM89XX_PMIC_ANALOG_TX_2_EN__POR (0x03)
-#define MSM89XX_PMIC_ANALOG_TX_1_2_TEST_CTL_1 (CDC_ANA_BASE+0x62)
-#define MSM89XX_PMIC_ANALOG_TX_1_2_TEST_CTL_1__POR (0xBF)
-#define MSM89XX_PMIC_ANALOG_TX_1_2_TEST_CTL_2 (CDC_ANA_BASE+0x63)
-#define MSM89XX_PMIC_ANALOG_TX_1_2_TEST_CTL_2__POR (0x8C)
-#define MSM89XX_PMIC_ANALOG_TX_1_2_ATEST_CTL (CDC_ANA_BASE+0x64)
-#define MSM89XX_PMIC_ANALOG_TX_1_2_ATEST_CTL__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_TX_1_2_OPAMP_BIAS (CDC_ANA_BASE+0x65)
-#define MSM89XX_PMIC_ANALOG_TX_1_2_OPAMP_BIAS__POR (0x6B)
-#define MSM89XX_PMIC_ANALOG_TX_1_2_TXFE_CLKDIV (CDC_ANA_BASE+0x66)
-#define MSM89XX_PMIC_ANALOG_TX_1_2_TXFE_CLKDIV__POR (0x51)
-#define MSM89XX_PMIC_ANALOG_TX_3_EN (CDC_ANA_BASE+0x67)
-#define MSM89XX_PMIC_ANALOG_TX_3_EN__POR (0x02)
-#define MSM89XX_PMIC_ANALOG_NCP_EN (CDC_ANA_BASE+0x80)
-#define MSM89XX_PMIC_ANALOG_NCP_EN__POR (0x26)
-#define MSM89XX_PMIC_ANALOG_NCP_CLK (CDC_ANA_BASE+0x81)
-#define MSM89XX_PMIC_ANALOG_NCP_CLK__POR (0x23)
-#define MSM89XX_PMIC_ANALOG_NCP_DEGLITCH (CDC_ANA_BASE+0x82)
-#define MSM89XX_PMIC_ANALOG_NCP_DEGLITCH__POR (0x5B)
-#define MSM89XX_PMIC_ANALOG_NCP_FBCTRL (CDC_ANA_BASE+0x83)
-#define MSM89XX_PMIC_ANALOG_NCP_FBCTRL__POR (0x08)
-#define MSM89XX_PMIC_ANALOG_NCP_BIAS (CDC_ANA_BASE+0x84)
-#define MSM89XX_PMIC_ANALOG_NCP_BIAS__POR (0x29)
-#define MSM89XX_PMIC_ANALOG_NCP_VCTRL (CDC_ANA_BASE+0x85)
-#define MSM89XX_PMIC_ANALOG_NCP_VCTRL__POR (0x24)
-#define MSM89XX_PMIC_ANALOG_NCP_TEST (CDC_ANA_BASE+0x86)
-#define MSM89XX_PMIC_ANALOG_NCP_TEST__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_NCP_CLIM_ADDR (CDC_ANA_BASE+0x87)
-#define MSM89XX_PMIC_ANALOG_NCP_CLIM_ADDR__POR (0xD5)
-#define MSM89XX_PMIC_ANALOG_RX_CLOCK_DIVIDER (CDC_ANA_BASE+0x90)
-#define MSM89XX_PMIC_ANALOG_RX_CLOCK_DIVIDER__POR (0xE8)
-#define MSM89XX_PMIC_ANALOG_RX_COM_OCP_CTL (CDC_ANA_BASE+0x91)
-#define MSM89XX_PMIC_ANALOG_RX_COM_OCP_CTL__POR (0xCF)
-#define MSM89XX_PMIC_ANALOG_RX_COM_OCP_COUNT (CDC_ANA_BASE+0x92)
-#define MSM89XX_PMIC_ANALOG_RX_COM_OCP_COUNT__POR (0x6E)
-#define MSM89XX_PMIC_ANALOG_RX_COM_BIAS_DAC (CDC_ANA_BASE+0x93)
-#define MSM89XX_PMIC_ANALOG_RX_COM_BIAS_DAC__POR (0x18)
-#define MSM89XX_PMIC_ANALOG_RX_HPH_BIAS_PA (CDC_ANA_BASE+0x94)
-#define MSM89XX_PMIC_ANALOG_RX_HPH_BIAS_PA__POR (0x5A)
-#define MSM89XX_PMIC_ANALOG_RX_HPH_BIAS_LDO_OCP (CDC_ANA_BASE+0x95)
-#define MSM89XX_PMIC_ANALOG_RX_HPH_BIAS_LDO_OCP__POR (0x69)
-#define MSM89XX_PMIC_ANALOG_RX_HPH_BIAS_CNP (CDC_ANA_BASE+0x96)
-#define MSM89XX_PMIC_ANALOG_RX_HPH_BIAS_CNP__POR (0x29)
-#define MSM89XX_PMIC_ANALOG_RX_HPH_CNP_EN (CDC_ANA_BASE+0x97)
-#define MSM89XX_PMIC_ANALOG_RX_HPH_CNP_EN__POR (0x80)
-#define MSM89XX_PMIC_ANALOG_RX_HPH_CNP_WG_CTL (CDC_ANA_BASE+0x98)
-#define MSM89XX_PMIC_ANALOG_RX_HPH_CNP_WG_CTL__POR (0xDA)
-#define MSM89XX_PMIC_ANALOG_RX_HPH_CNP_WG_TIME (CDC_ANA_BASE+0x99)
-#define MSM89XX_PMIC_ANALOG_RX_HPH_CNP_WG_TIME__POR (0x16)
-#define MSM89XX_PMIC_ANALOG_RX_HPH_L_TEST (CDC_ANA_BASE+0x9A)
-#define MSM89XX_PMIC_ANALOG_RX_HPH_L_TEST__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_RX_HPH_L_PA_DAC_CTL (CDC_ANA_BASE+0x9B)
-#define MSM89XX_PMIC_ANALOG_RX_HPH_L_PA_DAC_CTL__POR (0x20)
-#define MSM89XX_PMIC_ANALOG_RX_HPH_R_TEST (CDC_ANA_BASE+0x9C)
-#define MSM89XX_PMIC_ANALOG_RX_HPH_R_TEST__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_RX_HPH_R_PA_DAC_CTL (CDC_ANA_BASE+0x9D)
-#define MSM89XX_PMIC_ANALOG_RX_HPH_R_PA_DAC_CTL__POR (0x20)
-#define MSM89XX_PMIC_ANALOG_RX_EAR_CTL (CDC_ANA_BASE+0x9E)
-#define MSM89XX_PMIC_ANALOG_RX_EAR_CTL___POR (0x12)
-#define MSM89XX_PMIC_ANALOG_RX_ATEST (CDC_ANA_BASE+0x9F)
-#define MSM89XX_PMIC_ANALOG_RX_ATEST__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_RX_HPH_STATUS (CDC_ANA_BASE+0xA0)
-#define MSM89XX_PMIC_ANALOG_RX_HPH_STATUS__POR (0x0C)
-#define MSM89XX_PMIC_ANALOG_RX_EAR_STATUS (CDC_ANA_BASE+0xA1)
-#define MSM89XX_PMIC_ANALOG_RX_EAR_STATUS__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_RX_LO_DAC_CTL (CDC_ANA_BASE+0xAC)
-#define MSM89XX_PMIC_ANALOG_RX_LO_DAC_CTL__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_RX_LO_EN_CTL (CDC_ANA_BASE+0xAD)
-#define MSM89XX_PMIC_ANALOG_RX_RX_LO_EN_CTL__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_SPKR_DAC_CTL (CDC_ANA_BASE+0xB0)
-#define MSM89XX_PMIC_ANALOG_SPKR_DAC_CTL__POR (0x83)
-#define MSM89XX_PMIC_ANALOG_SPKR_DRV_CLIP_DET (CDC_ANA_BASE+0xB1)
-#define MSM89XX_PMIC_ANALOG_SPKR_DRV_CLIP_DET__POR (0x91)
-#define MSM89XX_PMIC_ANALOG_SPKR_DRV_CTL (CDC_ANA_BASE+0xB2)
-#define MSM89XX_PMIC_ANALOG_SPKR_DRV_CTL__POR (0x29)
-#define MSM89XX_PMIC_ANALOG_SPKR_ANA_BIAS_SET (CDC_ANA_BASE+0xB3)
-#define MSM89XX_PMIC_ANALOG_SPKR_ANA_BIAS_SET__POR (0x4D)
-#define MSM89XX_PMIC_ANALOG_SPKR_OCP_CTL (CDC_ANA_BASE+0xB4)
-#define MSM89XX_PMIC_ANALOG_SPKR_OCP_CTL__POR (0xE1)
-#define MSM89XX_PMIC_ANALOG_SPKR_PWRSTG_CTL (CDC_ANA_BASE+0xB5)
-#define MSM89XX_PMIC_ANALOG_SPKR_PWRSTG_CTL__POR (0x1E)
-#define MSM89XX_PMIC_ANALOG_SPKR_DRV_MISC (CDC_ANA_BASE+0xB6)
-#define MSM89XX_PMIC_ANALOG_SPKR_DRV_MISC__POR (0xCB)
-#define MSM89XX_PMIC_ANALOG_SPKR_DRV_DBG (CDC_ANA_BASE+0xB7)
-#define MSM89XX_PMIC_ANALOG_SPKR_DRV_DBG__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_CURRENT_LIMIT (CDC_ANA_BASE+0xC0)
-#define MSM89XX_PMIC_ANALOG_CURRENT_LIMIT__POR (0x02)
-#define MSM89XX_PMIC_ANALOG_OUTPUT_VOLTAGE (CDC_ANA_BASE+0xC1)
-#define MSM89XX_PMIC_ANALOG_OUTPUT_VOLTAGE__POR (0x14)
-#define MSM89XX_PMIC_ANALOG_BYPASS_MODE (CDC_ANA_BASE+0xC2)
-#define MSM89XX_PMIC_ANALOG_BYPASS_MODE__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_BOOST_EN_CTL (CDC_ANA_BASE+0xC3)
-#define MSM89XX_PMIC_ANALOG_BOOST_EN_CTL__POR (0x1F)
-#define MSM89XX_PMIC_ANALOG_SLOPE_COMP_IP_ZERO (CDC_ANA_BASE+0xC4)
-#define MSM89XX_PMIC_ANALOG_SLOPE_COMP_IP_ZERO__POR (0x8C)
-#define MSM89XX_PMIC_ANALOG_RDSON_MAX_DUTY_CYCLE (CDC_ANA_BASE+0xC5)
-#define MSM89XX_PMIC_ANALOG_RDSON_MAX_DUTY_CYCLE__POR (0xC0)
-#define MSM89XX_PMIC_ANALOG_BOOST_TEST1_1 (CDC_ANA_BASE+0xC6)
-#define MSM89XX_PMIC_ANALOG_BOOST_TEST1_1__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_BOOST_TEST_2 (CDC_ANA_BASE+0xC7)
-#define MSM89XX_PMIC_ANALOG_BOOST_TEST_2__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_SPKR_SAR_STATUS (CDC_ANA_BASE+0xC8)
-#define MSM89XX_PMIC_ANALOG_SPKR_SAR_STATUS__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_SPKR_DRV_STATUS (CDC_ANA_BASE+0xC9)
-#define MSM89XX_PMIC_ANALOG_SPKR_DRV_STATUS__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_PBUS_ADD_CSR (CDC_ANA_BASE+0xCE)
-#define MSM89XX_PMIC_ANALOG_PBUS_ADD_CSR__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_PBUS_ADD_SEL (CDC_ANA_BASE+0xCF)
-#define MSM89XX_PMIC_ANALOG_PBUS_ADD_SEL__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_SEC_ACCESS (CDC_ANA_BASE+0xD0)
-#define MSM89XX_PMIC_ANALOG_SEC_ACCESS__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_PERPH_RESET_CTL1 (CDC_ANA_BASE+0xD8)
-#define MSM89XX_PMIC_ANALOG_PERPH_RESET_CTL1__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_PERPH_RESET_CTL2 (CDC_ANA_BASE+0xD9)
-#define MSM89XX_PMIC_ANALOG_PERPH_RESET_CTL2__POR (0x01)
-#define MSM89XX_PMIC_ANALOG_PERPH_RESET_CTL3 (CDC_ANA_BASE+0xDA)
-#define MSM89XX_PMIC_ANALOG_PERPH_RESET_CTL3__POR (0x05)
-#define MSM89XX_PMIC_ANALOG_PERPH_RESET_CTL4 (CDC_ANA_BASE+0xDB)
-#define MSM89XX_PMIC_ANALOG_PERPH_RESET_CTL4__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_INT_TEST1 (CDC_ANA_BASE+0xE0)
-#define MSM89XX_PMIC_ANALOG_INT_TEST1__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_INT_TEST_VAL (CDC_ANA_BASE+0xE1)
-#define MSM89XX_PMIC_ANALOG_INT_TEST_VAL__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_TRIM_NUM (CDC_ANA_BASE+0xF0)
-#define MSM89XX_PMIC_ANALOG_TRIM_NUM__POR (0x04)
-#define MSM89XX_PMIC_ANALOG_TRIM_CTRL1 (CDC_ANA_BASE+0xF1)
-#define MSM89XX_PMIC_ANALOG_TRIM_CTRL1__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_TRIM_CTRL2 (CDC_ANA_BASE+0xF2)
-#define MSM89XX_PMIC_ANALOG_TRIM_CTRL2__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_TRIM_CTRL3 (CDC_ANA_BASE+0xF3)
-#define MSM89XX_PMIC_ANALOG_TRIM_CTRL3__POR (0x00)
-#define MSM89XX_PMIC_ANALOG_TRIM_CTRL4 (CDC_ANA_BASE+0xF4)
-#define MSM89XX_PMIC_ANALOG_TRIM_CTRL4__POR (0x00)
-
-#define MSM89XX_PMIC_CDC_NUM_REGISTERS \
- (MSM89XX_PMIC_ANALOG_TRIM_CTRL4+1)
-#define MSM89XX_PMIC_CDC_MAX_REGISTER \
- (MSM89XX_PMIC_CDC_NUM_REGISTERS-1)
-#define MSM89XX_PMIC_CDC_CACHE_SIZE \
- MSM89XX_PMIC_CDC_NUM_REGISTERS
-
-
-#define MSM89XX_CDC_CORE_CLK_RX_RESET_CTL (0x00)
-#define MSM89XX_CDC_CORE_CLK_RX_RESET_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CLK_TX_RESET_B1_CTL (0x04)
-#define MSM89XX_CDC_CORE_CLK_TX_RESET_B1_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CLK_DMIC_B1_CTL (0x08)
-#define MSM89XX_CDC_CORE_CLK_DMIC_B1_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CLK_RX_I2S_CTL (0x0C)
-#define MSM89XX_CDC_CORE_CLK_RX_I2S_CTL__POR (0x13)
-#define MSM89XX_CDC_CORE_CLK_TX_I2S_CTL (0x10)
-#define MSM89XX_CDC_CORE_CLK_TX_I2S_CTL__POR (0x13)
-#define MSM89XX_CDC_CORE_CLK_OTHR_RESET_B1_CTL (0x14)
-#define MSM89XX_CDC_CORE_CLK_OTHR_RESET_B1_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CLK_TX_CLK_EN_B1_CTL (0x18)
-#define MSM89XX_CDC_CORE_CLK_TX_CLK_EN_B1_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CLK_OTHR_CTL (0x1C)
-#define MSM89XX_CDC_CORE_CLK_OTHR_CTL__POR (0x04)
-#define MSM89XX_CDC_CORE_CLK_RX_B1_CTL (0x20)
-#define MSM89XX_CDC_CORE_CLK_RX_B1_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CLK_MCLK_CTL (0x24)
-#define MSM89XX_CDC_CORE_CLK_MCLK_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CLK_PDM_CTL (0x28)
-#define MSM89XX_CDC_CORE_CLK_PDM_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CLK_SD_CTL (0x2C)
-#define MSM89XX_CDC_CORE_CLK_SD_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CLK_DMIC_B2_CTL (0x30)
-#define MSM89XX_CDC_CORE_CLK_DMIC_B2_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CLK_RX_B2_CTL (0x34)
-#define MSM89XX_CDC_CORE_CLK_RX_B2_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CLK_TX2_I2S_CTL (0x38)
-#define MSM89XX_CDC_CORE_CLK_TX2_I2S_CTL__POR (0x13)
-#define MSM89XX_CDC_CORE_RX1_B1_CTL (0x40)
-#define MSM89XX_CDC_CORE_RX1_B1_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_RX2_B1_CTL (0x60)
-#define MSM89XX_CDC_CORE_RX2_B1_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_RX3_B1_CTL (0x80)
-#define MSM89XX_CDC_CORE_RX3_B1_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_RX1_B2_CTL (0x44)
-#define MSM89XX_CDC_CORE_RX1_B2_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_RX2_B2_CTL (0x64)
-#define MSM89XX_CDC_CORE_RX2_B2_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_RX3_B2_CTL (0x84)
-#define MSM89XX_CDC_CORE_RX3_B2_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_RX1_B3_CTL (0x48)
-#define MSM89XX_CDC_CORE_RX1_B3_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_RX2_B3_CTL (0x68)
-#define MSM89XX_CDC_CORE_RX2_B3_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_RX3_B3_CTL (0x88)
-#define MSM89XX_CDC_CORE_RX3_B3_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_RX1_B4_CTL (0x4C)
-#define MSM89XX_CDC_CORE_RX1_B4_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_RX2_B4_CTL (0x6C)
-#define MSM89XX_CDC_CORE_RX2_B4_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_RX3_B4_CTL (0x8C)
-#define MSM89XX_CDC_CORE_RX3_B4_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_RX1_B5_CTL (0x50)
-#define MSM89XX_CDC_CORE_RX1_B5_CTL__POR (0x68)
-#define MSM89XX_CDC_CORE_RX2_B5_CTL (0x70)
-#define MSM89XX_CDC_CORE_RX2_B5_CTL__POR (0x68)
-#define MSM89XX_CDC_CORE_RX3_B5_CTL (0x90)
-#define MSM89XX_CDC_CORE_RX3_B5_CTL__POR (0x68)
-#define MSM89XX_CDC_CORE_RX1_B6_CTL (0x54)
-#define MSM89XX_CDC_CORE_RX1_B6_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_RX2_B6_CTL (0x74)
-#define MSM89XX_CDC_CORE_RX2_B6_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_RX3_B6_CTL (0x94)
-#define MSM89XX_CDC_CORE_RX3_B6_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_RX1_VOL_CTL_B1_CTL (0x58)
-#define MSM89XX_CDC_CORE_RX1_VOL_CTL_B1_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_RX2_VOL_CTL_B1_CTL (0x78)
-#define MSM89XX_CDC_CORE_RX2_VOL_CTL_B1_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_RX3_VOL_CTL_B1_CTL (0x98)
-#define MSM89XX_CDC_CORE_RX3_VOL_CTL_B1_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_RX1_VOL_CTL_B2_CTL (0x5C)
-#define MSM89XX_CDC_CORE_RX1_VOL_CTL_B2_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_RX2_VOL_CTL_B2_CTL (0x7C)
-#define MSM89XX_CDC_CORE_RX2_VOL_CTL_B2_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_RX3_VOL_CTL_B2_CTL (0x9C)
-#define MSM89XX_CDC_CORE_RX3_VOL_CTL_B2_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_TOP_GAIN_UPDATE (0xA0)
-#define MSM89XX_CDC_CORE_TOP_GAIN_UPDATE__POR (0x00)
-#define MSM89XX_CDC_CORE_TOP_CTL (0xA4)
-#define MSM89XX_CDC_CORE_TOP_CTL__POR (0x01)
-#define MSM89XX_CDC_CORE_COMP0_B1_CTL (0xB0)
-#define MSM89XX_CDC_CORE_COMP0_B1_CTL__POR (0x30)
-#define MSM89XX_CDC_CORE_COMP0_B2_CTL (0xB4)
-#define MSM89XX_CDC_CORE_COMP0_B2_CTL__POR (0xB5)
-#define MSM89XX_CDC_CORE_COMP0_B3_CTL (0xB8)
-#define MSM89XX_CDC_CORE_COMP0_B3_CTL__POR (0x28)
-#define MSM89XX_CDC_CORE_COMP0_B4_CTL (0xBC)
-#define MSM89XX_CDC_CORE_COMP0_B4_CTL__POR (0x37)
-#define MSM89XX_CDC_CORE_COMP0_B5_CTL (0xC0)
-#define MSM89XX_CDC_CORE_COMP0_B5_CTL__POR (0x7F)
-#define MSM89XX_CDC_CORE_COMP0_B6_CTL (0xC4)
-#define MSM89XX_CDC_CORE_COMP0_B6_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_COMP0_SHUT_DOWN_STATUS (0xC8)
-#define MSM89XX_CDC_CORE_COMP0_SHUT_DOWN_STATUS__POR (0x03)
-#define MSM89XX_CDC_CORE_COMP0_FS_CFG (0xCC)
-#define MSM89XX_CDC_CORE_COMP0_FS_CFG__POR (0x03)
-#define MSM89XX_CDC_CORE_COMP0_DELAY_BUF_CTL (0xD0)
-#define MSM89XX_CDC_CORE_COMP0_DELAY_BUF_CTL__POR (0x02)
-#define MSM89XX_CDC_CORE_DEBUG_DESER1_CTL (0xE0)
-#define MSM89XX_CDC_CORE_DEBUG_DESER1_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_DEBUG_DESER2_CTL (0xE4)
-#define MSM89XX_CDC_CORE_DEBUG_DESER2_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_DEBUG_B1_CTL_CFG (0xE8)
-#define MSM89XX_CDC_CORE_DEBUG_B1_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_DEBUG_B2_CTL_CFG (0xEC)
-#define MSM89XX_CDC_CORE_DEBUG_B2_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_DEBUG_B3_CTL_CFG (0xF0)
-#define MSM89XX_CDC_CORE_DEBUG_B3_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_IIR1_GAIN_B1_CTL (0x100)
-#define MSM89XX_CDC_CORE_IIR1_GAIN_B1_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_IIR2_GAIN_B1_CTL (0x140)
-#define MSM89XX_CDC_CORE_IIR2_GAIN_B1_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_IIR1_GAIN_B2_CTL (0x104)
-#define MSM89XX_CDC_CORE_IIR1_GAIN_B2_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_IIR2_GAIN_B2_CTL (0x144)
-#define MSM89XX_CDC_CORE_IIR2_GAIN_B2_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_IIR1_GAIN_B3_CTL (0x108)
-#define MSM89XX_CDC_CORE_IIR1_GAIN_B3_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_IIR2_GAIN_B3_CTL (0x148)
-#define MSM89XX_CDC_CORE_IIR2_GAIN_B3_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_IIR1_GAIN_B4_CTL (0x10C)
-#define MSM89XX_CDC_CORE_IIR1_GAIN_B4_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_IIR2_GAIN_B4_CTL (0x14C)
-#define MSM89XX_CDC_CORE_IIR2_GAIN_B4_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_IIR1_GAIN_B5_CTL (0x110)
-#define MSM89XX_CDC_CORE_IIR1_GAIN_B5_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_IIR2_GAIN_B5_CTL (0x150)
-#define MSM89XX_CDC_CORE_IIR2_GAIN_B5_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_IIR1_GAIN_B6_CTL (0x114)
-#define MSM89XX_CDC_CORE_IIR1_GAIN_B6_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_IIR2_GAIN_B6_CTL (0x154)
-#define MSM89XX_CDC_CORE_IIR2_GAIN_B6_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_IIR1_GAIN_B7_CTL (0x118)
-#define MSM89XX_CDC_CORE_IIR1_GAIN_B7_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_IIR2_GAIN_B7_CTL (0x158)
-#define MSM89XX_CDC_CORE_IIR2_GAIN_B7_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_IIR1_GAIN_B8_CTL (0x11C)
-#define MSM89XX_CDC_CORE_IIR1_GAIN_B8_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_IIR2_GAIN_B8_CTL (0x15C)
-#define MSM89XX_CDC_CORE_IIR2_GAIN_B8_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_IIR1_CTL (0x120)
-#define MSM89XX_CDC_CORE_IIR1_CTL__POR (0x40)
-#define MSM89XX_CDC_CORE_IIR2_CTL (0x160)
-#define MSM89XX_CDC_CORE_IIR2_CTL__POR (0x40)
-#define MSM89XX_CDC_CORE_IIR1_GAIN_TIMER_CTL (0x124)
-#define MSM89XX_CDC_CORE_IIR1_GAIN_TIMER_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_IIR2_GAIN_TIMER_CTL (0x164)
-#define MSM89XX_CDC_CORE_IIR2_GAIN_TIMER_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_IIR1_COEF_B1_CTL (0x128)
-#define MSM89XX_CDC_CORE_IIR1_COEF_B1_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_IIR2_COEF_B1_CTL (0x168)
-#define MSM89XX_CDC_CORE_IIR2_COEF_B1_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_IIR1_COEF_B2_CTL (0x12C)
-#define MSM89XX_CDC_CORE_IIR1_COEF_B2_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_IIR2_COEF_B2_CTL (0x16C)
-#define MSM89XX_CDC_CORE_IIR2_COEF_B2_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CONN_RX1_B1_CTL (0x180)
-#define MSM89XX_CDC_CORE_CONN_RX1_B1_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CONN_RX1_B2_CTL (0x184)
-#define MSM89XX_CDC_CORE_CONN_RX1_B2_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CONN_RX1_B3_CTL (0x188)
-#define MSM89XX_CDC_CORE_CONN_RX1_B3_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CONN_RX2_B1_CTL (0x18C)
-#define MSM89XX_CDC_CORE_CONN_RX2_B1_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CONN_RX2_B2_CTL (0x190)
-#define MSM89XX_CDC_CORE_CONN_RX2_B2_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CONN_RX2_B3_CTL (0x194)
-#define MSM89XX_CDC_CORE_CONN_RX2_B3_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CONN_RX3_B1_CTL (0x198)
-#define MSM89XX_CDC_CORE_CONN_RX3_B1_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CONN_RX3_B2_CTL (0x19C)
-#define MSM89XX_CDC_CORE_CONN_RX3_B2_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CONN_TX_B1_CTL (0x1A0)
-#define MSM89XX_CDC_CORE_CONN_TX_B1_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CONN_TX_B2_CTL (0x1A4)
-#define MSM89XX_CDC_CORE_CONN_TX_B2_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CONN_EQ1_B1_CTL (0x1A8)
-#define MSM89XX_CDC_CORE_CONN_EQ1_B1_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CONN_EQ1_B2_CTL (0x1AC)
-#define MSM89XX_CDC_CORE_CONN_EQ1_B2_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CONN_EQ1_B3_CTL (0x1B0)
-#define MSM89XX_CDC_CORE_CONN_EQ1_B3_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CONN_EQ1_B4_CTL (0x1B4)
-#define MSM89XX_CDC_CORE_CONN_EQ1_B4_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CONN_EQ2_B1_CTL (0x1B8)
-#define MSM89XX_CDC_CORE_CONN_EQ2_B1_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CONN_EQ2_B2_CTL (0x1BC)
-#define MSM89XX_CDC_CORE_CONN_EQ2_B2_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CONN_EQ2_B3_CTL (0x1C0)
-#define MSM89XX_CDC_CORE_CONN_EQ2_B3_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CONN_EQ2_B4_CTL (0x1C4)
-#define MSM89XX_CDC_CORE_CONN_EQ2_B4_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CONN_TX_I2S_SD1_CTL (0x1C8)
-#define MSM89XX_CDC_CORE_CONN_TX_I2S_SD1_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_CONN_TX_B3_CTL (0x1CC)
-#define MSM89XX_CDC_CORE_CONN_TX_B3_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_TX5_VOL_CTL_TIMER (0x1E0)
-#define MSM89XX_CDC_CORE_TX5_VOL_CTL_TIMER__POR (0x00)
-#define MSM89XX_CDC_CORE_TX5_VOL_CTL_GAIN (0x1E4)
-#define MSM89XX_CDC_CORE_TX5_VOL_CTL_GAIN__POR (0x00)
-#define MSM89XX_CDC_CORE_TX5_VOL_CTL_CFG (0x1E8)
-#define MSM89XX_CDC_CORE_TX5_VOL_CTL_CFG__POR (0x00)
-#define MSM89XX_CDC_CORE_TX5_MUX_CTL (0x1EC)
-#define MSM89XX_CDC_CORE_TX5_MUX_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_TX5_CLK_FS_CTL (0x1F0)
-#define MSM89XX_CDC_CORE_TX5_CLK_FS_CTL__POR (0x03)
-#define MSM89XX_CDC_CORE_TX5_DMIC_CTL (0x1F4)
-#define MSM89XX_CDC_CORE_TX5_DMIC_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_TX1_VOL_CTL_TIMER (0x280)
-#define MSM89XX_CDC_CORE_TX1_VOL_CTL_TIMER__POR (0x00)
-#define MSM89XX_CDC_CORE_TX2_VOL_CTL_TIMER (0x2A0)
-#define MSM89XX_CDC_CORE_TX2_VOL_CTL_TIMER__POR (0x00)
-#define MSM89XX_CDC_CORE_TX3_VOL_CTL_TIMER (0x2C0)
-#define MSM89XX_CDC_CORE_TX3_VOL_CTL_TIMER__POR (0x00)
-#define MSM89XX_CDC_CORE_TX4_VOL_CTL_TIMER (0x2E0)
-#define MSM89XX_CDC_CORE_TX4_VOL_CTL_TIMER__POR (0x00)
-#define MSM89XX_CDC_CORE_TX1_VOL_CTL_GAIN (0x284)
-#define MSM89XX_CDC_CORE_TX1_VOL_CTL_GAIN__POR (0x00)
-#define MSM89XX_CDC_CORE_TX2_VOL_CTL_GAIN (0x2A4)
-#define MSM89XX_CDC_CORE_TX2_VOL_CTL_GAIN__POR (0x00)
-#define MSM89XX_CDC_CORE_TX3_VOL_CTL_GAIN (0x2C4)
-#define MSM89XX_CDC_CORE_TX3_VOL_CTL_GAIN__POR (0x00)
-#define MSM89XX_CDC_CORE_TX4_VOL_CTL_GAIN (0x2E4)
-#define MSM89XX_CDC_CORE_TX4_VOL_CTL_GAIN__POR (0x00)
-#define MSM89XX_CDC_CORE_TX1_VOL_CTL_CFG (0x288)
-#define MSM89XX_CDC_CORE_TX1_VOL_CTL_CFG__POR (0x00)
-#define MSM89XX_CDC_CORE_TX2_VOL_CTL_CFG (0x2A8)
-#define MSM89XX_CDC_CORE_TX2_VOL_CTL_CFG__POR (0x00)
-#define MSM89XX_CDC_CORE_TX3_VOL_CTL_CFG (0x2C8)
-#define MSM89XX_CDC_CORE_TX3_VOL_CTL_CFG__POR (0x00)
-#define MSM89XX_CDC_CORE_TX4_VOL_CTL_CFG (0x2E8)
-#define MSM89XX_CDC_CORE_TX4_VOL_CTL_CFG__POR (0x00)
-#define MSM89XX_CDC_CORE_TX1_MUX_CTL (0x28C)
-#define MSM89XX_CDC_CORE_TX1_MUX_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_TX2_MUX_CTL (0x2AC)
-#define MSM89XX_CDC_CORE_TX2_MUX_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_TX3_MUX_CTL (0x2CC)
-#define MSM89XX_CDC_CORE_TX3_MUX_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_TX4_MUX_CTL (0x2EC)
-#define MSM89XX_CDC_CORE_TX4_MUX_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_TX1_CLK_FS_CTL (0x290)
-#define MSM89XX_CDC_CORE_TX1_CLK_FS_CTL__POR (0x03)
-#define MSM89XX_CDC_CORE_TX2_CLK_FS_CTL (0x2B0)
-#define MSM89XX_CDC_CORE_TX2_CLK_FS_CTL__POR (0x03)
-#define MSM89XX_CDC_CORE_TX3_CLK_FS_CTL (0x2D0)
-#define MSM89XX_CDC_CORE_TX3_CLK_FS_CTL__POR (0x03)
-#define MSM89XX_CDC_CORE_TX4_CLK_FS_CTL (0x2F0)
-#define MSM89XX_CDC_CORE_TX4_CLK_FS_CTL__POR (0x03)
-#define MSM89XX_CDC_CORE_TX1_DMIC_CTL (0x294)
-#define MSM89XX_CDC_CORE_TX1_DMIC_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_TX2_DMIC_CTL (0x2B4)
-#define MSM89XX_CDC_CORE_TX2_DMIC_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_TX3_DMIC_CTL (0x2D4)
-#define MSM89XX_CDC_CORE_TX3_DMIC_CTL__POR (0x00)
-#define MSM89XX_CDC_CORE_TX4_DMIC_CTL (0x2F4)
-#define MSM89XX_CDC_CORE_TX4_DMIC_CTL__POR (0x00)
-
-#define MSM89XX_CDC_CORE_NUM_REGISTERS \
- (MSM89XX_CDC_CORE_TX4_DMIC_CTL+1)
-#define MSM89XX_CDC_CORE_MAX_REGISTER \
- (MSM89XX_CDC_CORE_NUM_REGISTERS-1)
-#define MSM89XX_CDC_CORE_CACHE_SIZE \
- MSM89XX_CDC_CORE_NUM_REGISTERS
-#endif
diff --git a/asoc/codecs/wcd934x/Android.mk b/asoc/codecs/wcd934x/Android.mk
index 3b5ef2f..f4fe33c 100644
--- a/asoc/codecs/wcd934x/Android.mk
+++ b/asoc/codecs/wcd934x/Android.mk
@@ -3,10 +3,6 @@
# Assume no targets will be supported
# Check if this driver needs be built for current target
-ifeq ($(call is-board-platform,sdm845),true)
-AUDIO_SELECT := CONFIG_SND_SOC_SDM845=m
-endif
-
ifeq ($(call is-board-platform,msmnile),true)
AUDIO_SELECT := CONFIG_SND_SOC_SM8150=m
endif
@@ -15,13 +11,9 @@
AUDIO_SELECT := CONFIG_SND_SOC_SM6150=m
endif
-ifeq ($(call is-board-platform-in-list,msm8953 sdm670 qcs605),true)
-AUDIO_SELECT := CONFIG_SND_SOC_SDM670=m
-endif
-
AUDIO_CHIPSET := audio
# Build/Package only in case of supported target
-ifeq ($(call is-board-platform-in-list,msm8953 sdm845 sdm670 qcs605 msmnile $(MSMSTEPPE) $(TRINKET)),true)
+ifeq ($(call is-board-platform-in-list,msmnile $(MSMSTEPPE) $(TRINKET)),true)
LOCAL_PATH := $(call my-dir)
diff --git a/asoc/codecs/wcd934x/Kbuild b/asoc/codecs/wcd934x/Kbuild
index e6427cf..d81618f 100644
--- a/asoc/codecs/wcd934x/Kbuild
+++ b/asoc/codecs/wcd934x/Kbuild
@@ -16,21 +16,6 @@
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
- ifeq ($(CONFIG_ARCH_SDM450), y)
- include $(AUDIO_ROOT)/config/sdm670auto.conf
- export
- INCS += -include $(AUDIO_ROOT)/config/sdm670autoconf.h
- endif
ifeq ($(CONFIG_ARCH_SM6150), y)
include $(AUDIO_ROOT)/config/sm6150auto.conf
export
diff --git a/asoc/codecs/wcd9360/Android.mk b/asoc/codecs/wcd9360/Android.mk
deleted file mode 100644
index 4920612..0000000
--- a/asoc/codecs/wcd9360/Android.mk
+++ /dev/null
@@ -1,50 +0,0 @@
-# Android makefile for audio kernel modules
-
-# Assume no targets will be supported
-
-# Check if this driver needs be built for current target
-ifeq ($(call is-board-platform,msmnile),true)
-AUDIO_SELECT := CONFIG_SND_SOC_SM8150=m
-endif
-
-AUDIO_CHIPSET := audio
-# Build/Package only in case of supported target
-ifeq ($(call is-board-platform-in-list,msmnile),true)
-
-LOCAL_PATH := $(call my-dir)
-
-# This makefile is only for DLKM
-ifneq ($(findstring vendor,$(LOCAL_PATH)),)
-
-ifneq ($(findstring opensource,$(LOCAL_PATH)),)
- AUDIO_BLD_DIR := $(shell pwd)/vendor/qcom/opensource/audio-kernel
-endif # opensource
-
-DLKM_DIR := $(TOP)/device/qcom/common/dlkm
-
-# Build audio.ko as $(AUDIO_CHIPSET)_audio.ko
-###########################################################
-# This is set once per LOCAL_PATH, not per (kernel) module
-KBUILD_OPTIONS := AUDIO_ROOT=$(AUDIO_BLD_DIR)
-
-# We are actually building audio.ko here, as per the
-# requirement we are specifying <chipset>_audio.ko as LOCAL_MODULE.
-# This means we need to rename the module to <chipset>_audio.ko
-# after audio.ko is built.
-KBUILD_OPTIONS += MODNAME=wcd9360_dlkm
-KBUILD_OPTIONS += BOARD_PLATFORM=$(TARGET_BOARD_PLATFORM)
-KBUILD_OPTIONS += $(AUDIO_SELECT)
-
-###########################################################
-include $(CLEAR_VARS)
-LOCAL_MODULE := $(AUDIO_CHIPSET)_wcd9360.ko
-LOCAL_MODULE_KBUILD_NAME := wcd9360_dlkm.ko
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_DEBUG_ENABLE := true
-LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
-include $(DLKM_DIR)/AndroidKernelModule.mk
-###########################################################
-###########################################################
-
-endif # DLKM check
-endif # supported target check
diff --git a/asoc/codecs/wcd9360/Kbuild b/asoc/codecs/wcd9360/Kbuild
deleted file mode 100644
index 5282b34..0000000
--- a/asoc/codecs/wcd9360/Kbuild
+++ /dev/null
@@ -1,110 +0,0 @@
-# We can build either as part of a standalone Kernel build or as
-# an external module. Determine which mechanism is being used
-ifeq ($(MODNAME),)
- KERNEL_BUILD := 1
-else
- KERNEL_BUILD := 0
-endif
-
-
-
-ifeq ($(KERNEL_BUILD), 1)
- # These are configurable via Kconfig for kernel-based builds
- # Need to explicitly configure for Android-based builds
- AUDIO_BLD_DIR := $(shell pwd)/kernel/msm-4.14
- AUDIO_ROOT := $(AUDIO_BLD_DIR)/techpack/audio
-endif
-
-ifeq ($(KERNEL_BUILD), 0)
- ifeq ($(CONFIG_ARCH_SM8150), y)
- include $(AUDIO_ROOT)/config/sm8150auto.conf
- export
- INCS += -include $(AUDIO_ROOT)/config/sm8150autoconf.h
- endif
-
- ifeq ($(CONFIG_ARCH_SDMSHRIKE), y)
- include $(AUDIO_ROOT)/config/sm8150auto.conf
- export
- INCS += -include $(AUDIO_ROOT)/config/sm8150autoconf.h
- endif
-endif
-
-# As per target team, build is done as follows:
-# Defconfig : build with default flags
-# Slub : defconfig + CONFIG_SLUB_DEBUG := y +
-# CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
-# Perf : Using appropriate msmXXXX-perf_defconfig
-#
-# Shipment builds (user variants) should not have any debug feature
-# enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
-# are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
-# there is no other way to identify defconfig builds, QTI internal
-# representation of perf builds (identified using the string 'perf'),
-# is used to identify if the build is a slub or defconfig one. This
-# way no critical debug feature will be enabled for perf and shipment
-# builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
-# config.
-
-############ UAPI ############
-UAPI_DIR := uapi
-UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
-
-############ COMMON ############
-COMMON_DIR := include
-COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
-
-############ WCD934X ############
-
-# for WCD9360 Codec
-ifdef CONFIG_SND_SOC_WCD9360
- WCD9360_OBJS += wcd9360.o
- WCD9360_OBJS += wcd9360-dsp-cntl.o
-endif
-
-LINUX_INC += -Iinclude/linux
-
-INCS += $(COMMON_INC) \
- $(UAPI_INC)
-
-EXTRA_CFLAGS += $(INCS)
-
-
-CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
- -DANI_LITTLE_BIT_ENDIAN \
- -DDOT11F_LITTLE_ENDIAN_HOST \
- -DANI_COMPILER_TYPE_GCC \
- -DANI_OS_TYPE_ANDROID=6 \
- -DPTT_SOCK_SVC_ENABLE \
- -Wall\
- -Werror\
- -D__linux__
-
-KBUILD_CPPFLAGS += $(CDEFINES)
-
-# 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
-# will override the kernel settings.
-ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
-EXTRA_CFLAGS += -Wmaybe-uninitialized
-endif
-#EXTRA_CFLAGS += -Wmissing-prototypes
-
-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_WCD9360) += wcd9360_dlkm.o
-wcd9360_dlkm-y := $(WCD9360_OBJS)
-
-# inject some build related information
-DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"
diff --git a/asoc/codecs/wcd9360/wcd9360-defaults.h b/asoc/codecs/wcd9360/wcd9360-defaults.h
deleted file mode 100644
index 5557dda..0000000
--- a/asoc/codecs/wcd9360/wcd9360-defaults.h
+++ /dev/null
@@ -1,2231 +0,0 @@
-/*
- * Copyright (c) 2018, 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.
- */
-
-#ifndef __WCD9360_DEFAULTS_H__
-#define __WCD9360_DEFAULTS_H__
-
-#include <linux/types.h>
-#include <asoc/wcd9360-registers.h>
-
-#define WCD9360_REG(reg) ((reg) & 0xFF)
-
-static const struct reg_default wcd9360_defaults[] = {
-{WCD9360_PAGE0_PAGE_REGISTER, 0x00},
-{WCD9360_CODEC_RPM_CLK_BYPASS, 0x00},
-{WCD9360_CODEC_RPM_CLK_GATE, 0x1F},
-{WCD9360_CODEC_RPM_CLK_MCLK_CFG, 0x00},
-{WCD9360_CODEC_RPM_CLK_MCLK2_CFG, 0x02},
-{WCD9360_CODEC_RPM_I2S_DSD_CLK_SEL, 0x00},
-{WCD9360_CODEC_RPM_RST_CTL, 0x00},
-{WCD9360_CODEC_RPM_PWR_CDC_DIG_HM_CTL, 0x04},
-{WCD9360_CHIP_TIER_CTRL_CHIP_ID_BYTE0, 0x10},
-{WCD9360_CHIP_TIER_CTRL_CHIP_ID_BYTE1, 0x60},
-{WCD9360_CHIP_TIER_CTRL_CHIP_ID_BYTE2, 0x93},
-{WCD9360_CHIP_TIER_CTRL_CHIP_ID_BYTE3, 0x01},
-{WCD9360_CHIP_TIER_CTRL_EFUSE_CTL, 0x10},
-{WCD9360_CHIP_TIER_CTRL_EFUSE_TEST0, 0x00},
-{WCD9360_CHIP_TIER_CTRL_EFUSE_TEST1, 0x00},
-{WCD9360_CHIP_TIER_CTRL_EFUSE_STATUS, 0x00},
-{WCD9360_CHIP_TIER_CTRL_I2C_SLAVE_ID_NONNEGO, 0x0D},
-{WCD9360_CHIP_TIER_CTRL_I2C_SLAVE_ID_1, 0x00},
-{WCD9360_CHIP_TIER_CTRL_I2C_SLAVE_ID_2, 0x00},
-{WCD9360_CHIP_TIER_CTRL_I2C_SLAVE_ID_3, 0x00},
-{WCD9360_CHIP_TIER_CTRL_ANA_WAIT_STATE_CTL, 0x44},
-{WCD9360_CHIP_TIER_CTRL_I2C_ACTIVE, 0x00},
-{WCD9360_CHIP_TIER_CTRL_ALT_FUNC_EN, 0x00},
-{WCD9360_CHIP_TIER_CTRL_GPIO_CTL_OE, 0x00},
-{WCD9360_CHIP_TIER_CTRL_GPIO_CTL_DATA, 0x00},
-{WCD9360_DATA_HUB_RX0_CFG, 0x00},
-{WCD9360_DATA_HUB_RX1_CFG, 0x00},
-{WCD9360_DATA_HUB_RX2_CFG, 0x00},
-{WCD9360_DATA_HUB_RX3_CFG, 0x00},
-{WCD9360_DATA_HUB_RX4_CFG, 0x00},
-{WCD9360_DATA_HUB_RX5_CFG, 0x00},
-{WCD9360_DATA_HUB_RX6_CFG, 0x00},
-{WCD9360_DATA_HUB_RX7_CFG, 0x00},
-{WCD9360_DATA_HUB_SB_TX0_INP_CFG, 0x00},
-{WCD9360_DATA_HUB_SB_TX1_INP_CFG, 0x00},
-{WCD9360_DATA_HUB_SB_TX2_INP_CFG, 0x00},
-{WCD9360_DATA_HUB_SB_TX3_INP_CFG, 0x00},
-{WCD9360_DATA_HUB_SB_TX4_INP_CFG, 0x00},
-{WCD9360_DATA_HUB_SB_TX5_INP_CFG, 0x00},
-{WCD9360_DATA_HUB_SB_TX6_INP_CFG, 0x00},
-{WCD9360_DATA_HUB_SB_TX7_INP_CFG, 0x00},
-{WCD9360_DATA_HUB_SB_TX8_INP_CFG, 0x00},
-{WCD9360_DATA_HUB_SB_TX9_INP_CFG, 0x00},
-{WCD9360_DATA_HUB_SB_TX10_INP_CFG, 0x00},
-{WCD9360_DATA_HUB_SB_TX11_INP_CFG, 0x00},
-{WCD9360_DATA_HUB_SB_TX12_INP_CFG, 0x00},
-{WCD9360_DATA_HUB_SB_TX13_INP_CFG, 0x00},
-{WCD9360_DATA_HUB_SB_TX14_INP_CFG, 0x00},
-{WCD9360_DATA_HUB_SB_TX15_INP_CFG, 0x00},
-{WCD9360_DATA_HUB_I2S_TX0_CFG, 0x00},
-{WCD9360_DATA_HUB_I2S_TX0_CFG2, 0x00},
-{WCD9360_DATA_HUB_I2S_TX1_0_CFG, 0x00},
-{WCD9360_DATA_HUB_I2S_TX1_1_CFG, 0x00},
-{WCD9360_DATA_HUB_DATA_HUB_CFG, 0x03},
-{WCD9360_DATA_HUB_I2S_0_CTL, 0x0C},
-{WCD9360_DATA_HUB_I2S_1_CTL, 0x0C},
-{WCD9360_DATA_HUB_I2S_0_CTL2, 0x01},
-{WCD9360_DATA_HUB_I2S_1_CTL2, 0x01},
-{WCD9360_DATA_HUB_I2S_CLKSRC_CTL, 0x00},
-{WCD9360_DATA_HUB_I2S_COMMON_CTL, 0x00},
-{WCD9360_DATA_HUB_I2S_0_TDM_CTL, 0x00},
-{WCD9360_DATA_HUB_I2S_0_TDM_CTL2, 0x05},
-{WCD9360_DATA_HUB_I2S_0_TDM_CH_RX, 0x00},
-{WCD9360_DATA_HUB_I2S_0_TDM_CH_TX, 0x00},
-{WCD9360_DATA_HUB_I2S_0_TDM_CFG, 0x00},
-{WCD9360_DATA_HUB_I2S_0_TDM_STRETCH, 0x00},
-{WCD9360_DATA_HUB_I2S_RESET_CTL, 0x00},
-{WCD9360_DMA_RDMA_CTL_0, 0x00},
-{WCD9360_DMA_RDMA_CTL_1, 0x00},
-{WCD9360_DMA_RDMA_CTL_2, 0x00},
-{WCD9360_DMA_RDMA_CTL_3, 0x00},
-{WCD9360_DMA_RDMA_CTL_4, 0x00},
-{WCD9360_DMA_CH_2_3_CFG_RDMA_0, 0xFF},
-{WCD9360_DMA_CH_2_3_CFG_RDMA_1, 0xFF},
-{WCD9360_DMA_CH_2_3_CFG_RDMA_2, 0xFF},
-{WCD9360_DMA_CH_2_3_CFG_RDMA_3, 0xFF},
-{WCD9360_DMA_CH_2_3_CFG_RDMA_4, 0xFF},
-{WCD9360_DMA_CH_0_1_CFG_RDMA_0, 0xFF},
-{WCD9360_DMA_CH_0_1_CFG_RDMA_1, 0xFF},
-{WCD9360_DMA_CH_0_1_CFG_RDMA_2, 0xFF},
-{WCD9360_DMA_CH_0_1_CFG_RDMA_3, 0xFF},
-{WCD9360_DMA_CH_0_1_CFG_RDMA_4, 0xFF},
-{WCD9360_DMA_RDMA4_PRT_CFG, 0x00},
-{WCD9360_DMA_RDMA_SBTX0_7_CFG, 0x00},
-{WCD9360_DMA_RDMA_SBTX8_10_CFG, 0x00},
-{WCD9360_DMA_WDMA_CTL_0, 0x00},
-{WCD9360_DMA_WDMA_CTL_1, 0x00},
-{WCD9360_DMA_WDMA_CTL_2, 0x00},
-{WCD9360_DMA_WDMA_CTL_3, 0x00},
-{WCD9360_DMA_WDMA_CTL_4, 0x00},
-{WCD9360_DMA_CH_4_5_CFG_WDMA_0, 0x00},
-{WCD9360_DMA_CH_4_5_CFG_WDMA_1, 0x00},
-{WCD9360_DMA_CH_4_5_CFG_WDMA_2, 0x00},
-{WCD9360_DMA_CH_4_5_CFG_WDMA_3, 0x00},
-{WCD9360_DMA_CH_4_5_CFG_WDMA_4, 0x00},
-{WCD9360_DMA_CH_2_3_CFG_WDMA_0, 0x00},
-{WCD9360_DMA_CH_2_3_CFG_WDMA_1, 0x00},
-{WCD9360_DMA_CH_2_3_CFG_WDMA_2, 0x00},
-{WCD9360_DMA_CH_2_3_CFG_WDMA_3, 0x00},
-{WCD9360_DMA_CH_2_3_CFG_WDMA_4, 0x00},
-{WCD9360_DMA_CH_0_1_CFG_WDMA_0, 0x00},
-{WCD9360_DMA_CH_0_1_CFG_WDMA_1, 0x00},
-{WCD9360_DMA_CH_0_1_CFG_WDMA_2, 0x00},
-{WCD9360_DMA_CH_0_1_CFG_WDMA_3, 0x00},
-{WCD9360_DMA_CH_0_1_CFG_WDMA_4, 0x00},
-{WCD9360_DMA_WDMA0_PRT_CFG, 0x00},
-{WCD9360_DMA_WDMA3_PRT_CFG, 0x00},
-{WCD9360_DMA_WDMA4_PRT0_3_CFG, 0x00},
-{WCD9360_DMA_WDMA4_PRT4_7_CFG, 0x00},
-{WCD9360_PAGE1_PAGE_REGISTER, 0x00},
-{WCD9360_CPE_FLL_USER_CTL_0, 0x71},
-{WCD9360_CPE_FLL_USER_CTL_1, 0x34},
-{WCD9360_CPE_FLL_USER_CTL_2, 0x0B},
-{WCD9360_CPE_FLL_USER_CTL_3, 0x02},
-{WCD9360_CPE_FLL_USER_CTL_4, 0x04},
-{WCD9360_CPE_FLL_USER_CTL_5, 0x02},
-{WCD9360_CPE_FLL_USER_CTL_6, 0x6E},
-{WCD9360_CPE_FLL_USER_CTL_7, 0x00},
-{WCD9360_CPE_FLL_USER_CTL_8, 0x94},
-{WCD9360_CPE_FLL_USER_CTL_9, 0x50},
-{WCD9360_CPE_FLL_L_VAL_CTL_0, 0x53},
-{WCD9360_CPE_FLL_L_VAL_CTL_1, 0x00},
-{WCD9360_CPE_FLL_DSM_FRAC_CTL_0, 0x00},
-{WCD9360_CPE_FLL_DSM_FRAC_CTL_1, 0xFF},
-{WCD9360_CPE_FLL_CONFIG_CTL_0, 0x6B},
-{WCD9360_CPE_FLL_CONFIG_CTL_1, 0x05},
-{WCD9360_CPE_FLL_CONFIG_CTL_2, 0x20},
-{WCD9360_CPE_FLL_CONFIG_CTL_3, 0x00},
-{WCD9360_CPE_FLL_CONFIG_CTL_4, 0x10},
-{WCD9360_CPE_FLL_TEST_CTL_0, 0x80},
-{WCD9360_CPE_FLL_TEST_CTL_1, 0x00},
-{WCD9360_CPE_FLL_TEST_CTL_2, 0x00},
-{WCD9360_CPE_FLL_TEST_CTL_3, 0x00},
-{WCD9360_CPE_FLL_TEST_CTL_4, 0x00},
-{WCD9360_CPE_FLL_TEST_CTL_5, 0x00},
-{WCD9360_CPE_FLL_TEST_CTL_6, 0x04},
-{WCD9360_CPE_FLL_TEST_CTL_7, 0x33},
-{WCD9360_CPE_FLL_FREQ_CTL_0, 0x00},
-{WCD9360_CPE_FLL_FREQ_CTL_1, 0x00},
-{WCD9360_CPE_FLL_FREQ_CTL_2, 0x00},
-{WCD9360_CPE_FLL_FREQ_CTL_3, 0x00},
-{WCD9360_CPE_FLL_SSC_CTL_0, 0x00},
-{WCD9360_CPE_FLL_SSC_CTL_1, 0x00},
-{WCD9360_CPE_FLL_SSC_CTL_2, 0x00},
-{WCD9360_CPE_FLL_SSC_CTL_3, 0x00},
-{WCD9360_CPE_FLL_FLL_MODE, 0x20},
-{WCD9360_CPE_FLL_STATUS_0, 0x00},
-{WCD9360_CPE_FLL_STATUS_1, 0x00},
-{WCD9360_CPE_FLL_STATUS_2, 0x00},
-{WCD9360_CPE_FLL_STATUS_3, 0x00},
-{WCD9360_I2S_FLL_USER_CTL_0, 0x41},
-{WCD9360_I2S_FLL_USER_CTL_1, 0x94},
-{WCD9360_I2S_FLL_USER_CTL_2, 0x08},
-{WCD9360_I2S_FLL_USER_CTL_3, 0x02},
-{WCD9360_I2S_FLL_USER_CTL_4, 0x04},
-{WCD9360_I2S_FLL_USER_CTL_5, 0x02},
-{WCD9360_I2S_FLL_USER_CTL_6, 0x40},
-{WCD9360_I2S_FLL_USER_CTL_7, 0x00},
-{WCD9360_I2S_FLL_USER_CTL_8, 0x5F},
-{WCD9360_I2S_FLL_USER_CTL_9, 0x02},
-{WCD9360_I2S_FLL_L_VAL_CTL_0, 0x40},
-{WCD9360_I2S_FLL_L_VAL_CTL_1, 0x00},
-{WCD9360_I2S_FLL_DSM_FRAC_CTL_0, 0x00},
-{WCD9360_I2S_FLL_DSM_FRAC_CTL_1, 0xFF},
-{WCD9360_I2S_FLL_CONFIG_CTL_0, 0x6B},
-{WCD9360_I2S_FLL_CONFIG_CTL_1, 0x05},
-{WCD9360_I2S_FLL_CONFIG_CTL_2, 0x20},
-{WCD9360_I2S_FLL_CONFIG_CTL_3, 0x00},
-{WCD9360_I2S_FLL_CONFIG_CTL_4, 0x30},
-{WCD9360_I2S_FLL_TEST_CTL_0, 0x80},
-{WCD9360_I2S_FLL_TEST_CTL_1, 0x00},
-{WCD9360_I2S_FLL_TEST_CTL_2, 0x00},
-{WCD9360_I2S_FLL_TEST_CTL_3, 0x00},
-{WCD9360_I2S_FLL_TEST_CTL_4, 0x00},
-{WCD9360_I2S_FLL_TEST_CTL_5, 0x00},
-{WCD9360_I2S_FLL_TEST_CTL_6, 0x04},
-{WCD9360_I2S_FLL_TEST_CTL_7, 0xFF},
-{WCD9360_I2S_FLL_FREQ_CTL_0, 0x00},
-{WCD9360_I2S_FLL_FREQ_CTL_1, 0x00},
-{WCD9360_I2S_FLL_FREQ_CTL_2, 0x00},
-{WCD9360_I2S_FLL_FREQ_CTL_3, 0x00},
-{WCD9360_I2S_FLL_SSC_CTL_0, 0x00},
-{WCD9360_I2S_FLL_SSC_CTL_1, 0x00},
-{WCD9360_I2S_FLL_SSC_CTL_2, 0x00},
-{WCD9360_I2S_FLL_SSC_CTL_3, 0x00},
-{WCD9360_I2S_FLL_FLL_MODE, 0x00},
-{WCD9360_I2S_FLL_STATUS_0, 0x00},
-{WCD9360_I2S_FLL_STATUS_1, 0x00},
-{WCD9360_I2S_FLL_STATUS_2, 0x00},
-{WCD9360_I2S_FLL_STATUS_3, 0x00},
-{WCD9360_PAGE2_PAGE_REGISTER, 0x00},
-{WCD9360_CPE_SS_CPE_CTL, 0x05},
-{WCD9360_CPE_SS_PWR_SYS_PSTATE_CTL_0, 0x01},
-{WCD9360_CPE_SS_PWR_SYS_PSTATE_CTL_1, 0x00},
-{WCD9360_CPE_SS_PWR_CPEFLL_CTL, 0x02},
-{WCD9360_CPE_SS_PWR_CPE_SYSMEM_DEEPSLP_0, 0xFF},
-{WCD9360_CPE_SS_PWR_CPE_SYSMEM_DEEPSLP_1, 0x03},
-{WCD9360_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_0, 0xFF},
-{WCD9360_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_1, 0xFF},
-{WCD9360_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_2, 0xFF},
-{WCD9360_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_3, 0xFF},
-{WCD9360_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_4, 0xFF},
-{WCD9360_CPE_SS_PWR_CPE_DRAM1_SHUTDOWN, 0x07},
-{WCD9360_CPE_SS_US_BUF_INT_PERIOD, 0x5F},
-{WCD9360_CPE_SS_CPARMAD_BUFRDY_INT_PERIOD, 0x13},
-{WCD9360_CPE_SS_SVA_CFG, 0x41},
-{WCD9360_CPE_SS_US_CFG, 0x00},
-{WCD9360_CPE_SS_MAD_CTL, 0x00},
-{WCD9360_CPE_SS_CPAR_CTL, 0x00},
-{WCD9360_CPE_SS_DMIC0_CTL, 0x00},
-{WCD9360_CPE_SS_DMIC1_CTL, 0x00},
-{WCD9360_CPE_SS_DMIC2_CTL, 0x00},
-{WCD9360_CPE_SS_DMIC_CFG, 0x80},
-{WCD9360_CPE_SS_CPAR_CFG, 0x00},
-{WCD9360_CPE_SS_WDOG_CFG, 0x01},
-{WCD9360_CPE_SS_BACKUP_INT, 0x00},
-{WCD9360_CPE_SS_STATUS, 0x00},
-{WCD9360_CPE_SS_CPE_OCD_CFG, 0x00},
-{WCD9360_CPE_SS_SS_ERROR_INT_MASK_0A, 0xFF},
-{WCD9360_CPE_SS_SS_ERROR_INT_MASK_0B, 0x3F},
-{WCD9360_CPE_SS_SS_ERROR_INT_MASK_1A, 0xFF},
-{WCD9360_CPE_SS_SS_ERROR_INT_MASK_1B, 0x3F},
-{WCD9360_CPE_SS_SS_ERROR_INT_STATUS_0A, 0x00},
-{WCD9360_CPE_SS_SS_ERROR_INT_STATUS_0B, 0x00},
-{WCD9360_CPE_SS_SS_ERROR_INT_STATUS_1A, 0x00},
-{WCD9360_CPE_SS_SS_ERROR_INT_STATUS_1B, 0x00},
-{WCD9360_CPE_SS_SS_ERROR_INT_CLEAR_0A, 0x00},
-{WCD9360_CPE_SS_SS_ERROR_INT_CLEAR_0B, 0x00},
-{WCD9360_CPE_SS_SS_ERROR_INT_CLEAR_1A, 0x00},
-{WCD9360_CPE_SS_SS_ERROR_INT_CLEAR_1B, 0x00},
-{WCD9360_CPE_SS_DMIC3_CTL, 0x00},
-{WCD9360_CPE_SS_WDOG_RESET, 0x00},
-{WCD9360_CPE_SS_LPASS_MCLK_PRG, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_IN_0, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_IN_1, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_IN_2, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_IN_3, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_IN_4, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_IN_5, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_IN_6, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_IN_7, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_IN_8, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_IN_9, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_IN_10, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_IN_11, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_IN_12, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_IN_13, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_IN_14, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_IN_15, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_OUT_0, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_OUT_1, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_OUT_2, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_OUT_3, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_OUT_4, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_OUT_5, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_OUT_6, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_OUT_7, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_OUT_8, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_OUT_9, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_OUT_10, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_OUT_11, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_OUT_12, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_OUT_13, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_OUT_14, 0x00},
-{WCD9360_CPE_SS_LPASS_IPC_OUT_15, 0x00},
-{WCD9360_CPE_SS_LPASS_ARB_CTL, 0x00},
-{WCD9360_CPE_SS_MEM_DEEPSLEEP_RD_0, 0x00},
-{WCD9360_CPE_SS_MEM_DEEPSLEEP_RD_1, 0x00},
-{WCD9360_CPE_SS_MEM_DEEPSLEEP_BYPASS_0, 0x00},
-{WCD9360_CPE_SS_MEM_DEEPSLEEP_BYPASS_1, 0x00},
-{WCD9360_SOC_MAD_MAIN_CTL_1, 0x00},
-{WCD9360_SOC_MAD_MAIN_CTL_2, 0x00},
-{WCD9360_SOC_MAD_AUDIO_CTL_1, 0x00},
-{WCD9360_SOC_MAD_AUDIO_CTL_2, 0x00},
-{WCD9360_SOC_MAD_AUDIO_CTL_3, 0x00},
-{WCD9360_SOC_MAD_AUDIO_CTL_4, 0x00},
-{WCD9360_SOC_MAD_AUDIO_CTL_5, 0x00},
-{WCD9360_SOC_MAD_AUDIO_CTL_6, 0x00},
-{WCD9360_SOC_MAD_AUDIO_CTL_7, 0x00},
-{WCD9360_SOC_MAD_AUDIO_CTL_8, 0x00},
-{WCD9360_SOC_MAD_AUDIO_IIR_CTL_PTR, 0x00},
-{WCD9360_SOC_MAD_AUDIO_IIR_CTL_VAL, 0x40},
-{WCD9360_SOC_MAD_ULTR_CTL_1, 0x00},
-{WCD9360_SOC_MAD_ULTR_CTL_2, 0x00},
-{WCD9360_SOC_MAD_ULTR_CTL_3, 0x00},
-{WCD9360_SOC_MAD_ULTR_CTL_4, 0x00},
-{WCD9360_SOC_MAD_ULTR_CTL_5, 0x00},
-{WCD9360_SOC_MAD_ULTR_CTL_6, 0x00},
-{WCD9360_SOC_MAD_ULTR_CTL_7, 0x00},
-{WCD9360_SOC_MAD_BEACON_CTL_1, 0x00},
-{WCD9360_SOC_MAD_BEACON_CTL_2, 0x00},
-{WCD9360_SOC_MAD_BEACON_CTL_3, 0x00},
-{WCD9360_SOC_MAD_BEACON_CTL_4, 0x00},
-{WCD9360_SOC_MAD_BEACON_CTL_5, 0x00},
-{WCD9360_SOC_MAD_BEACON_CTL_6, 0x00},
-{WCD9360_SOC_MAD_BEACON_CTL_7, 0x00},
-{WCD9360_SOC_MAD_BEACON_CTL_8, 0x00},
-{WCD9360_SOC_MAD_BEACON_IIR_CTL_PTR, 0x00},
-{WCD9360_SOC_MAD_BEACON_IIR_CTL_VAL, 0x00},
-{WCD9360_SOC_MAD_INP_SEL, 0x00},
-{WCD9360_SOC_MAD_MAD2_INP_SEL, 0x00},
-{WCD9360_SWR_SAMPLE_PACK_SWR_SAMPLE_PACK_CTRL, 0x00},
-{WCD9360_SWR_SAMPLE_PACK_SWR_SAMPLE_PACK_STATUS, 0x00},
-{WCD9360_SWR_SAMPLE_PACK_SWR_SAMPLE_PACK_FS, 0x00},
-{WCD9360_SWR_SAMPLE_PACK_SWR_SAMPLE_PACK_IN_SEL, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT0, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT1, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT2, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT3, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT4, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT5, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT6, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT7, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT8, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT9, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT10, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT11, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT12, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT13, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT14, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT15, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT0, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT1, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT2, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT3, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT4, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT5, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT6, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT7, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT8, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT9, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT10, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT11, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT12, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT13, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT14, 0x00},
-{WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT15, 0x00},
-{WCD9360_PAGE4_PAGE_REGISTER, 0x00},
-{WCD9360_INTR_CFG, 0x00},
-{WCD9360_INTR_CLR_COMMIT, 0x00},
-{WCD9360_INTR_PIN1_MASK0, 0xFF},
-{WCD9360_INTR_PIN1_MASK1, 0xFF},
-{WCD9360_INTR_PIN1_MASK2, 0xFF},
-{WCD9360_INTR_PIN1_MASK3, 0xFF},
-{WCD9360_INTR_PIN1_STATUS0, 0x00},
-{WCD9360_INTR_PIN1_STATUS1, 0x00},
-{WCD9360_INTR_PIN1_STATUS2, 0x00},
-{WCD9360_INTR_PIN1_STATUS3, 0x00},
-{WCD9360_INTR_PIN1_CLEAR0, 0x00},
-{WCD9360_INTR_PIN1_CLEAR1, 0x00},
-{WCD9360_INTR_PIN1_CLEAR2, 0x00},
-{WCD9360_INTR_PIN1_CLEAR3, 0x00},
-{WCD9360_INTR_PIN2_MASK3, 0xFF},
-{WCD9360_INTR_PIN2_STATUS3, 0x00},
-{WCD9360_INTR_PIN2_CLEAR3, 0x00},
-{WCD9360_INTR_CPESS_SUMRY_MASK2, 0xFF},
-{WCD9360_INTR_CPESS_SUMRY_MASK3, 0xFF},
-{WCD9360_INTR_CPESS_SUMRY_STATUS2, 0x00},
-{WCD9360_INTR_CPESS_SUMRY_STATUS3, 0x00},
-{WCD9360_INTR_CPESS_SUMRY_CLEAR2, 0x00},
-{WCD9360_INTR_CPESS_SUMRY_CLEAR3, 0x00},
-{WCD9360_INTR_LEVEL0, 0x3B},
-{WCD9360_INTR_LEVEL1, 0x00},
-{WCD9360_INTR_LEVEL2, 0xD0},
-{WCD9360_INTR_LEVEL3, 0x00},
-{WCD9360_INTR_BYPASS0, 0x00},
-{WCD9360_INTR_BYPASS1, 0x00},
-{WCD9360_INTR_BYPASS2, 0x00},
-{WCD9360_INTR_BYPASS3, 0x00},
-{WCD9360_INTR_SET0, 0x00},
-{WCD9360_INTR_SET1, 0x00},
-{WCD9360_INTR_SET2, 0x00},
-{WCD9360_INTR_SET3, 0x00},
-{WCD9360_INTR_CODEC_MISC_MASK, 0x73},
-{WCD9360_INTR_CODEC_MISC_STATUS, 0x00},
-{WCD9360_INTR_CODEC_MISC_CLEAR, 0x00},
-{WCD9360_ANA_PAGE_REGISTER, 0x00},
-{WCD9360_ANA_BIAS, 0x00},
-{WCD9360_ANA_RCO, 0x00},
-{WCD9360_ANA_BUCK_CTL, 0x00},
-{WCD9360_ANA_BUCK_STATUS, 0x00},
-{WCD9360_ANA_EAR, 0x00},
-{WCD9360_ANA_MAD_SETUP, 0x01},
-{WCD9360_ANA_AMIC1, 0x20},
-{WCD9360_ANA_AMIC2, 0x00},
-{WCD9360_ANA_AMIC3, 0x20},
-{WCD9360_ANA_AMIC4, 0x00},
-{WCD9360_ANA_MICB1, 0x10},
-{WCD9360_ANA_MICB2, 0x10},
-{WCD9360_ANA_MICB3, 0x10},
-{WCD9360_ANA_MICB4, 0x10},
-{WCD9360_BIAS_CTL, 0x2A},
-{WCD9360_BIAS_VBG_FINE_ADJ, 0x55},
-{WCD9360_RCO_CTRL_1, 0x44},
-{WCD9360_RCO_CTRL_2, 0x48},
-{WCD9360_RCO_CAL, 0x00},
-{WCD9360_RCO_CAL_1, 0x00},
-{WCD9360_RCO_CAL_2, 0x00},
-{WCD9360_RCO_TEST_CTRL, 0x00},
-{WCD9360_RCO_CAL_OUT_1, 0x00},
-{WCD9360_RCO_CAL_OUT_2, 0x00},
-{WCD9360_RCO_CAL_OUT_3, 0x00},
-{WCD9360_RCO_CAL_OUT_4, 0x00},
-{WCD9360_RCO_CAL_OUT_5, 0x00},
-{WCD9360_SIDO_MODE_1, 0x84},
-{WCD9360_SIDO_MODE_2, 0xFE},
-{WCD9360_SIDO_MODE_3, 0xF6},
-{WCD9360_SIDO_MODE_4, 0x56},
-{WCD9360_SIDO_VCL_1, 0x00},
-{WCD9360_SIDO_VCL_2, 0x6C},
-{WCD9360_SIDO_VCL_3, 0x44},
-{WCD9360_SIDO_CCL_1, 0x57},
-{WCD9360_SIDO_CCL_2, 0x92},
-{WCD9360_SIDO_CCL_3, 0x35},
-{WCD9360_SIDO_CCL_4, 0x61},
-{WCD9360_SIDO_CCL_5, 0x6D},
-{WCD9360_SIDO_CCL_6, 0x60},
-{WCD9360_SIDO_CCL_7, 0x6F},
-{WCD9360_SIDO_CCL_8, 0x6F},
-{WCD9360_SIDO_CCL_9, 0x6E},
-{WCD9360_SIDO_CCL_10, 0x26},
-{WCD9360_SIDO_FILTER_1, 0x92},
-{WCD9360_SIDO_FILTER_2, 0x54},
-{WCD9360_SIDO_DRIVER_1, 0x77},
-{WCD9360_SIDO_DRIVER_2, 0x55},
-{WCD9360_SIDO_DRIVER_3, 0x55},
-{WCD9360_SIDO_CAL_CODE_EXT_1, 0x9C},
-{WCD9360_SIDO_CAL_CODE_EXT_2, 0x82},
-{WCD9360_SIDO_CAL_CODE_OUT_1, 0x00},
-{WCD9360_SIDO_CAL_CODE_OUT_2, 0x00},
-{WCD9360_SIDO_TEST_1, 0x00},
-{WCD9360_SIDO_TEST_2, 0x00},
-{WCD9360_LDOH_MODE, 0x2B},
-{WCD9360_LDOH_BIAS, 0x68},
-{WCD9360_LDOH_STB_LOADS, 0x00},
-{WCD9360_LDOH_SLOWRAMP, 0x50},
-{WCD9360_MICB1_TEST_CTL_1, 0x1A},
-{WCD9360_MICB1_TEST_CTL_2, 0x18},
-{WCD9360_MICB1_TEST_CTL_3, 0xA4},
-{WCD9360_MICB2_TEST_CTL_1, 0x1A},
-{WCD9360_MICB2_TEST_CTL_2, 0x18},
-{WCD9360_MICB2_TEST_CTL_3, 0xA4},
-{WCD9360_MICB3_TEST_CTL_1, 0x1A},
-{WCD9360_MICB3_TEST_CTL_2, 0x18},
-{WCD9360_MICB3_TEST_CTL_3, 0xA4},
-{WCD9360_MICB4_TEST_CTL_1, 0x1A},
-{WCD9360_MICB4_TEST_CTL_2, 0x18},
-{WCD9360_MICB4_TEST_CTL_3, 0xA4},
-{WCD9360_TX_COM_ADC_VCM, 0x39},
-{WCD9360_TX_COM_BIAS_ATEST, 0xC0},
-{WCD9360_TX_COM_ADC_INT1_IB, 0x6F},
-{WCD9360_TX_COM_ADC_INT2_IB, 0x4F},
-{WCD9360_TX_COM_TXFE_DIV_CTL, 0x2E},
-{WCD9360_TX_COM_TXFE_DIV_START, 0x00},
-{WCD9360_TX_COM_TXFE_DIV_STOP_9P6M, 0xC7},
-{WCD9360_TX_COM_TXFE_DIV_STOP_12P288M, 0xFF},
-{WCD9360_TX_1_2_TEST_EN, 0xCC},
-{WCD9360_TX_1_2_ADC_IB, 0x09},
-{WCD9360_TX_1_2_ATEST_REFCTL, 0x0A},
-{WCD9360_TX_1_2_TEST_CTL, 0x38},
-{WCD9360_TX_1_2_TEST_BLK_EN, 0xFF},
-{WCD9360_TX_1_2_TXFE_CLKDIV, 0x00},
-{WCD9360_TX_1_2_SAR1_ERR, 0x00},
-{WCD9360_TX_1_2_SAR2_ERR, 0x00},
-{WCD9360_TX_3_4_TEST_EN, 0xCC},
-{WCD9360_TX_3_4_ADC_IB, 0x09},
-{WCD9360_TX_3_4_ATEST_REFCTL, 0x0A},
-{WCD9360_TX_3_4_TEST_CTL, 0x38},
-{WCD9360_TX_3_4_TEST_BLK_EN, 0xFF},
-{WCD9360_TX_3_4_TXFE_CLKDIV, 0x00},
-{WCD9360_TX_3_4_SAR1_ERR, 0x00},
-{WCD9360_TX_3_4_SAR2_ERR, 0x00},
-{WCD9360_RX_RX_EAR_BIAS_CON_1, 0x2A},
-{WCD9360_RX_RX_EAR_BIAS_CON_2, 0x8A},
-{WCD9360_RX_RX_AUX_BIAS_CON_1, 0x2A},
-{WCD9360_RX_RX_AUX_BIAS_CON_2, 0x8A},
-{WCD9360_RX_RX_BIAS_ATEST, 0x0C},
-{WCD9360_RX_RXTOP_RESERVED, 0x00},
-{WCD9360_EAR_EAR_EN_REG, 0x22},
-{WCD9360_EAR_EAR_PA_CON, 0x44},
-{WCD9360_EAR_EAR_SP_CON, 0xDB},
-{WCD9360_EAR_EAR_DAC_CON, 0x00},
-{WCD9360_EAR_EAR_CNP_FSM_CON, 0xB6},
-{WCD9360_EAR_DAC_CTL_TEST, 0x00},
-{WCD9360_EAR_STATUS_REG, 0x00},
-{WCD9360_EAR_EAR_COMPANDER_CON, 0x02},
-{WCD9360_ANA_NEW_PAGE_REGISTER, 0x00},
-{WCD9360_CLK_SYS_PLL_ENABLES, 0x00},
-{WCD9360_CLK_SYS_PLL_PRESET, 0x00},
-{WCD9360_CLK_SYS_PLL_STATUS, 0x00},
-{WCD9360_CLK_SYS_MCLK_PRG, 0x10},
-{WCD9360_CLK_SYS_MCLK2_PRG1, 0x00},
-{WCD9360_CLK_SYS_MCLK_MISC, 0x00},
-{WCD9360_SIDO_NEW_VOUT_A_STARTUP, 0x17},
-{WCD9360_SIDO_NEW_VOUT_D_STARTUP, 0x0D},
-{WCD9360_SIDO_NEW_VOUT_D_FREQ1, 0x07},
-{WCD9360_SIDO_NEW_VOUT_D_FREQ2, 0x00},
-{WCD9360_AUX_ANA_EAR, 0x00},
-{WCD9360_LDORXTX_LDORXTX, 0x10},
-{WCD9360_DIE_CRACK_CTL, 0x00},
-{WCD9360_DIE_CRACK_OUT, 0x00},
-{WCD9360_LOOP_BACK_EN, 0x00},
-{WCD9360_CLK_SYS_INT_POST_DIV_REG0, 0x00},
-{WCD9360_CLK_SYS_INT_POST_DIV_REG1, 0x00},
-{WCD9360_CLK_SYS_INT_REF_DIV_REG0, 0x00},
-{WCD9360_CLK_SYS_INT_REF_DIV_REG1, 0x00},
-{WCD9360_CLK_SYS_INT_FILTER_REG0, 0x00},
-{WCD9360_CLK_SYS_INT_FILTER_REG1, 0x00},
-{WCD9360_CLK_SYS_INT_PLL_L_VAL, 0x00},
-{WCD9360_CLK_SYS_INT_PLL_M_VAL, 0x00},
-{WCD9360_CLK_SYS_INT_PLL_N_VAL, 0x00},
-{WCD9360_CLK_SYS_INT_TEST_REG0, 0x00},
-{WCD9360_CLK_SYS_INT_PFD_CP_DSM_PROG, 0x00},
-{WCD9360_CLK_SYS_INT_VCO_PROG, 0x00},
-{WCD9360_CLK_SYS_INT_TEST_REG1, 0x00},
-{WCD9360_CLK_SYS_INT_LDO_LOCK_CFG, 0x00},
-{WCD9360_CLK_SYS_INT_DIG_LOCK_DET_CFG, 0x00},
-{WCD9360_CLK_SYS_INT_CLK_TEST1, 0x00},
-{WCD9360_CLK_SYS_INT_CLK_TEST2, 0x00},
-{WCD9360_CLK_SYS_INT_CLK_TEST3, 0x00},
-{WCD9360_SIDO_NEW_INT_RAMP_STATUS, 0x00},
-{WCD9360_SIDO_NEW_INT_SPARE_1, 0x00},
-{WCD9360_SIDO_NEW_INT_DEBUG_VOUT_SETTING_A, 0x64},
-{WCD9360_SIDO_NEW_INT_DEBUG_VOUT_SETTING_D, 0x40},
-{WCD9360_SIDO_NEW_INT_RAMP_INC_WAIT, 0x24},
-{WCD9360_SIDO_NEW_INT_DYNAMIC_IPEAK_CTL, 0x09},
-{WCD9360_SIDO_NEW_INT_RAMP_IBLEED_CTL, 0x7D},
-{WCD9360_SIDO_NEW_INT_DEBUG_CPROVR_TEST, 0x00},
-{WCD9360_SIDO_NEW_INT_RAMP_CTL_A, 0x14},
-{WCD9360_SIDO_NEW_INT_RAMP_CTL_D, 0x14},
-{WCD9360_SIDO_NEW_INT_RAMP_TIMEOUT_PERIOD, 0x33},
-{WCD9360_SIDO_NEW_INT_DYNAMIC_IPEAK_SETTING1, 0x3F},
-{WCD9360_SIDO_NEW_INT_DYNAMIC_IPEAK_SETTING2, 0x74},
-{WCD9360_SIDO_NEW_INT_DYNAMIC_IPEAK_SETTING3, 0x33},
-{WCD9360_SIDO_NEW_INT_HIGH_ACCU_MODE_SEL1, 0x1D},
-{WCD9360_SIDO_NEW_INT_HIGH_ACCU_MODE_SEL2, 0x0A},
-{WCD9360_EAR_INT_NEW_EAR_CHOPPER_CON, 0xA8},
-{WCD9360_EAR_INT_NEW_EAR_VCM_GEN_CON1, 0x42},
-{WCD9360_EAR_INT_NEW_EAR_VCM_GEN_CON2, 0x22},
-{WCD9360_EAR_INT_NEW_EAR_DYNAMIC_BIAS, 0x00},
-{WCD9360_AUX_INT_AUX_EN_REG, 0x22},
-{WCD9360_AUX_INT_AUX_PA_CON, 0x46},
-{WCD9360_AUX_INT_AUX_SP_CON, 0xD2},
-{WCD9360_AUX_INT_AUX_DAC_CON, 0x00},
-{WCD9360_AUX_INT_AUX_CNP_FSM_CON, 0xB6},
-{WCD9360_AUX_INT_AUX_TEST, 0x00},
-{WCD9360_AUX_INT_STATUS_REG, 0x00},
-{WCD9360_AUX_INT_AUX_MISC, 0x00},
-{WCD9360_LDORXTX_INT_ANA_LDORXTX_CTRL1, 0xFF},
-{WCD9360_LDORXTX_INT_ANA_LDORXTX_CTRL2, 0xD8},
-{WCD9360_LDORXTX_INT_ANA_LDORXTX_CTRL3, 0x80},
-{WCD9360_LDORXTX_INT_ANA_LDORXTX_CTRL4, 0xFF},
-{WCD9360_LDORXTX_INT_ANA_LDORXTX_CTRL5, 0x09},
-{WCD9360_LDORXTX_INT_ANA_LDORXTX_STATUS, 0x00},
-{WCD9360_DIE_CRACK_INT_INT1, 0x02},
-{WCD9360_DIE_CRACK_INT_INT2, 0x60},
-{WCD9360_LOOP_BACK_INT_SPARE, 0x00},
-{WCD9360_PAGE10_PAGE_REGISTER, 0x00},
-{WCD9360_CDC_ANC0_CLK_RESET_CTL, 0x00},
-{WCD9360_CDC_ANC0_MODE_1_CTL, 0x00},
-{WCD9360_CDC_ANC0_MODE_2_CTL, 0x00},
-{WCD9360_CDC_ANC0_FF_SHIFT, 0x00},
-{WCD9360_CDC_ANC0_FB_SHIFT, 0x00},
-{WCD9360_CDC_ANC0_LPF_FF_A_CTL, 0x00},
-{WCD9360_CDC_ANC0_LPF_FF_B_CTL, 0x00},
-{WCD9360_CDC_ANC0_LPF_FB_CTL, 0x00},
-{WCD9360_CDC_ANC0_SMLPF_CTL, 0x00},
-{WCD9360_CDC_ANC0_DCFLT_SHIFT_CTL, 0x00},
-{WCD9360_CDC_ANC0_IIR_ADAPT_CTL, 0x00},
-{WCD9360_CDC_ANC0_IIR_COEFF_1_CTL, 0x00},
-{WCD9360_CDC_ANC0_IIR_COEFF_2_CTL, 0x00},
-{WCD9360_CDC_ANC0_FF_A_GAIN_CTL, 0x00},
-{WCD9360_CDC_ANC0_FF_B_GAIN_CTL, 0x00},
-{WCD9360_CDC_ANC0_FB_GAIN_CTL, 0x00},
-{WCD9360_CDC_TX0_TX_PATH_CTL, 0x04},
-{WCD9360_CDC_TX0_TX_PATH_CFG0, 0x10},
-{WCD9360_CDC_TX0_TX_PATH_CFG1, 0x03},
-{WCD9360_CDC_TX0_TX_VOL_CTL, 0x00},
-{WCD9360_CDC_TX0_TX_PATH_192_CTL, 0x00},
-{WCD9360_CDC_TX0_TX_PATH_192_CFG, 0x00},
-{WCD9360_CDC_TX0_TX_PATH_SEC0, 0x00},
-{WCD9360_CDC_TX0_TX_PATH_SEC1, 0x00},
-{WCD9360_CDC_TX0_TX_PATH_SEC2, 0x01},
-{WCD9360_CDC_TX0_TX_PATH_SEC3, 0x3C},
-{WCD9360_CDC_TX0_TX_PATH_SEC4, 0x20},
-{WCD9360_CDC_TX0_TX_PATH_SEC5, 0x00},
-{WCD9360_CDC_TX0_TX_PATH_SEC6, 0x00},
-{WCD9360_CDC_TX1_TX_PATH_CTL, 0x04},
-{WCD9360_CDC_TX1_TX_PATH_CFG0, 0x10},
-{WCD9360_CDC_TX1_TX_PATH_CFG1, 0x03},
-{WCD9360_CDC_TX1_TX_VOL_CTL, 0x00},
-{WCD9360_CDC_TX1_TX_PATH_192_CTL, 0x00},
-{WCD9360_CDC_TX1_TX_PATH_192_CFG, 0x00},
-{WCD9360_CDC_TX1_TX_PATH_SEC0, 0x00},
-{WCD9360_CDC_TX1_TX_PATH_SEC1, 0x00},
-{WCD9360_CDC_TX1_TX_PATH_SEC2, 0x01},
-{WCD9360_CDC_TX1_TX_PATH_SEC3, 0x3C},
-{WCD9360_CDC_TX1_TX_PATH_SEC4, 0x20},
-{WCD9360_CDC_TX1_TX_PATH_SEC5, 0x00},
-{WCD9360_CDC_TX1_TX_PATH_SEC6, 0x00},
-{WCD9360_CDC_TX2_TX_PATH_CTL, 0x04},
-{WCD9360_CDC_TX2_TX_PATH_CFG0, 0x10},
-{WCD9360_CDC_TX2_TX_PATH_CFG1, 0x03},
-{WCD9360_CDC_TX2_TX_VOL_CTL, 0x00},
-{WCD9360_CDC_TX2_TX_PATH_192_CTL, 0x00},
-{WCD9360_CDC_TX2_TX_PATH_192_CFG, 0x00},
-{WCD9360_CDC_TX2_TX_PATH_SEC0, 0x00},
-{WCD9360_CDC_TX2_TX_PATH_SEC1, 0x00},
-{WCD9360_CDC_TX2_TX_PATH_SEC2, 0x01},
-{WCD9360_CDC_TX2_TX_PATH_SEC3, 0x3C},
-{WCD9360_CDC_TX2_TX_PATH_SEC4, 0x20},
-{WCD9360_CDC_TX2_TX_PATH_SEC5, 0x00},
-{WCD9360_CDC_TX2_TX_PATH_SEC6, 0x00},
-{WCD9360_CDC_TX3_TX_PATH_CTL, 0x04},
-{WCD9360_CDC_TX3_TX_PATH_CFG0, 0x10},
-{WCD9360_CDC_TX3_TX_PATH_CFG1, 0x03},
-{WCD9360_CDC_TX3_TX_VOL_CTL, 0x00},
-{WCD9360_CDC_TX3_TX_PATH_192_CTL, 0x00},
-{WCD9360_CDC_TX3_TX_PATH_192_CFG, 0x00},
-{WCD9360_CDC_TX3_TX_PATH_SEC0, 0x00},
-{WCD9360_CDC_TX3_TX_PATH_SEC1, 0x00},
-{WCD9360_CDC_TX3_TX_PATH_SEC2, 0x01},
-{WCD9360_CDC_TX3_TX_PATH_SEC3, 0x3C},
-{WCD9360_CDC_TX3_TX_PATH_SEC4, 0x20},
-{WCD9360_CDC_TX3_TX_PATH_SEC5, 0x00},
-{WCD9360_CDC_TX3_TX_PATH_SEC6, 0x00},
-{WCD9360_CDC_TX4_TX_PATH_CTL, 0x04},
-{WCD9360_CDC_TX4_TX_PATH_CFG0, 0x10},
-{WCD9360_CDC_TX4_TX_PATH_CFG1, 0x03},
-{WCD9360_CDC_TX4_TX_VOL_CTL, 0x00},
-{WCD9360_CDC_TX4_TX_PATH_192_CTL, 0x00},
-{WCD9360_CDC_TX4_TX_PATH_192_CFG, 0x00},
-{WCD9360_CDC_TX4_TX_PATH_SEC0, 0x00},
-{WCD9360_CDC_TX4_TX_PATH_SEC1, 0x00},
-{WCD9360_CDC_TX4_TX_PATH_SEC2, 0x01},
-{WCD9360_CDC_TX4_TX_PATH_SEC3, 0x3C},
-{WCD9360_CDC_TX4_TX_PATH_SEC4, 0x20},
-{WCD9360_CDC_TX4_TX_PATH_SEC5, 0x00},
-{WCD9360_CDC_TX4_TX_PATH_SEC6, 0x00},
-{WCD9360_CDC_TX5_TX_PATH_CTL, 0x04},
-{WCD9360_CDC_TX5_TX_PATH_CFG0, 0x10},
-{WCD9360_CDC_TX5_TX_PATH_CFG1, 0x03},
-{WCD9360_CDC_TX5_TX_VOL_CTL, 0x00},
-{WCD9360_CDC_TX5_TX_PATH_192_CTL, 0x00},
-{WCD9360_CDC_TX5_TX_PATH_192_CFG, 0x00},
-{WCD9360_CDC_TX5_TX_PATH_SEC0, 0x00},
-{WCD9360_CDC_TX5_TX_PATH_SEC1, 0x00},
-{WCD9360_CDC_TX5_TX_PATH_SEC2, 0x01},
-{WCD9360_CDC_TX5_TX_PATH_SEC3, 0x3C},
-{WCD9360_CDC_TX5_TX_PATH_SEC4, 0x20},
-{WCD9360_CDC_TX5_TX_PATH_SEC5, 0x00},
-{WCD9360_CDC_TX5_TX_PATH_SEC6, 0x00},
-{WCD9360_CDC_TX6_TX_PATH_CTL, 0x04},
-{WCD9360_CDC_TX6_TX_PATH_CFG0, 0x10},
-{WCD9360_CDC_TX6_TX_PATH_CFG1, 0x03},
-{WCD9360_CDC_TX6_TX_VOL_CTL, 0x00},
-{WCD9360_CDC_TX6_TX_PATH_192_CTL, 0x00},
-{WCD9360_CDC_TX6_TX_PATH_192_CFG, 0x00},
-{WCD9360_CDC_TX6_TX_PATH_SEC0, 0x00},
-{WCD9360_CDC_TX6_TX_PATH_SEC1, 0x00},
-{WCD9360_CDC_TX6_TX_PATH_SEC2, 0x01},
-{WCD9360_CDC_TX6_TX_PATH_SEC3, 0x3C},
-{WCD9360_CDC_TX6_TX_PATH_SEC4, 0x20},
-{WCD9360_CDC_TX6_TX_PATH_SEC5, 0x00},
-{WCD9360_CDC_TX6_TX_PATH_SEC6, 0x00},
-{WCD9360_CDC_TX7_TX_PATH_CTL, 0x04},
-{WCD9360_CDC_TX7_TX_PATH_CFG0, 0x10},
-{WCD9360_CDC_TX7_TX_PATH_CFG1, 0x03},
-{WCD9360_CDC_TX7_TX_VOL_CTL, 0x00},
-{WCD9360_CDC_TX7_TX_PATH_192_CTL, 0x00},
-{WCD9360_CDC_TX7_TX_PATH_192_CFG, 0x00},
-{WCD9360_CDC_TX7_TX_PATH_SEC0, 0x00},
-{WCD9360_CDC_TX7_TX_PATH_SEC1, 0x00},
-{WCD9360_CDC_TX7_TX_PATH_SEC2, 0x01},
-{WCD9360_CDC_TX7_TX_PATH_SEC3, 0x3C},
-{WCD9360_CDC_TX7_TX_PATH_SEC4, 0x20},
-{WCD9360_CDC_TX7_TX_PATH_SEC5, 0x00},
-{WCD9360_CDC_TX7_TX_PATH_SEC6, 0x00},
-{WCD9360_CDC_TX8_TX_PATH_CTL, 0x04},
-{WCD9360_CDC_TX8_TX_PATH_CFG0, 0x10},
-{WCD9360_CDC_TX8_TX_PATH_CFG1, 0x03},
-{WCD9360_CDC_TX8_TX_VOL_CTL, 0x00},
-{WCD9360_CDC_TX8_TX_PATH_192_CTL, 0x00},
-{WCD9360_CDC_TX8_TX_PATH_192_CFG, 0x00},
-{WCD9360_CDC_TX8_TX_PATH_SEC0, 0x00},
-{WCD9360_CDC_TX8_TX_PATH_SEC1, 0x00},
-{WCD9360_CDC_TX8_TX_PATH_SEC2, 0x01},
-{WCD9360_CDC_TX8_TX_PATH_SEC3, 0x3C},
-{WCD9360_CDC_TX8_TX_PATH_SEC4, 0x20},
-{WCD9360_CDC_TX8_TX_PATH_SEC5, 0x00},
-{WCD9360_CDC_TX8_TX_PATH_SEC6, 0x00},
-{WCD9360_CDC_TX9_SPKR_PROT_PATH_CTL, 0x02},
-{WCD9360_CDC_TX9_SPKR_PROT_PATH_CFG0, 0x00},
-{WCD9360_CDC_TX10_SPKR_PROT_PATH_CTL, 0x02},
-{WCD9360_CDC_TX10_SPKR_PROT_PATH_CFG0, 0x00},
-{WCD9360_CDC_TX11_SPKR_PROT_PATH_CTL, 0x02},
-{WCD9360_CDC_TX11_SPKR_PROT_PATH_CFG0, 0x00},
-{WCD9360_CDC_TX12_SPKR_PROT_PATH_CTL, 0x02},
-{WCD9360_CDC_TX12_SPKR_PROT_PATH_CFG0, 0x00},
-{WCD9360_PAGE11_PAGE_REGISTER, 0x00},
-{WCD9360_CDC_COMPANDER0_CTL0, 0x60},
-{WCD9360_CDC_COMPANDER0_CTL1, 0xDB},
-{WCD9360_CDC_COMPANDER0_CTL2, 0xFF},
-{WCD9360_CDC_COMPANDER0_CTL3, 0x35},
-{WCD9360_CDC_COMPANDER0_CTL4, 0xFF},
-{WCD9360_CDC_COMPANDER0_CTL5, 0x00},
-{WCD9360_CDC_COMPANDER0_CTL6, 0x01},
-{WCD9360_CDC_COMPANDER0_CTL7, 0x06},
-{WCD9360_CDC_COMPANDER7_CTL0, 0x60},
-{WCD9360_CDC_COMPANDER7_CTL1, 0xDB},
-{WCD9360_CDC_COMPANDER7_CTL2, 0xFF},
-{WCD9360_CDC_COMPANDER7_CTL3, 0x35},
-{WCD9360_CDC_COMPANDER7_CTL4, 0xFF},
-{WCD9360_CDC_COMPANDER7_CTL5, 0x00},
-{WCD9360_CDC_COMPANDER7_CTL6, 0x01},
-{WCD9360_CDC_COMPANDER7_CTL7, 0x06},
-{WCD9360_CDC_COMPANDER8_CTL0, 0x60},
-{WCD9360_CDC_COMPANDER8_CTL1, 0xDB},
-{WCD9360_CDC_COMPANDER8_CTL2, 0xFF},
-{WCD9360_CDC_COMPANDER8_CTL3, 0x35},
-{WCD9360_CDC_COMPANDER8_CTL4, 0xFF},
-{WCD9360_CDC_COMPANDER8_CTL5, 0x00},
-{WCD9360_CDC_COMPANDER8_CTL6, 0x01},
-{WCD9360_CDC_COMPANDER8_CTL7, 0x06},
-{WCD9360_CDC_RX0_RX_PATH_CTL, 0x04},
-{WCD9360_CDC_RX0_RX_PATH_CFG0, 0x00},
-{WCD9360_CDC_RX0_RX_PATH_CFG1, 0x64},
-{WCD9360_CDC_RX0_RX_PATH_CFG2, 0x80},
-{WCD9360_CDC_RX0_RX_VOL_CTL, 0x00},
-{WCD9360_CDC_RX0_RX_PATH_MIX_CTL, 0x04},
-{WCD9360_CDC_RX0_RX_PATH_MIX_CFG, 0x12},
-{WCD9360_CDC_RX0_RX_VOL_MIX_CTL, 0x00},
-{WCD9360_CDC_RX0_RX_PATH_SEC0, 0xFC},
-{WCD9360_CDC_RX0_RX_PATH_SEC1, 0x08},
-{WCD9360_CDC_RX0_RX_PATH_SEC2, 0x00},
-{WCD9360_CDC_RX0_RX_PATH_SEC3, 0x00},
-{WCD9360_CDC_RX0_RX_PATH_SEC5, 0x00},
-{WCD9360_CDC_RX0_RX_PATH_SEC6, 0x00},
-{WCD9360_CDC_RX0_RX_PATH_SEC7, 0x00},
-{WCD9360_CDC_RX0_RX_PATH_MIX_SEC0, 0x08},
-{WCD9360_CDC_RX0_RX_PATH_MIX_SEC1, 0x00},
-{WCD9360_CDC_RX0_RX_PATH_DSMDEM_CTL, 0x00},
-{WCD9360_CDC_RX9_RX_PATH_CTL, 0x04},
-{WCD9360_CDC_RX9_RX_PATH_CFG0, 0x00},
-{WCD9360_CDC_RX9_RX_PATH_CFG1, 0x64},
-{WCD9360_CDC_RX9_RX_PATH_CFG2, 0x80},
-{WCD9360_CDC_RX9_RX_VOL_CTL, 0x00},
-{WCD9360_CDC_RX9_RX_PATH_MIX_CTL, 0x04},
-{WCD9360_CDC_RX9_RX_PATH_MIX_CFG, 0x12},
-{WCD9360_CDC_RX9_RX_VOL_MIX_CTL, 0x00},
-{WCD9360_CDC_RX9_RX_PATH_SEC0, 0xFC},
-{WCD9360_CDC_RX9_RX_PATH_SEC1, 0x08},
-{WCD9360_CDC_RX9_RX_PATH_SEC2, 0x00},
-{WCD9360_CDC_RX9_RX_PATH_SEC3, 0x00},
-{WCD9360_CDC_RX9_RX_PATH_SEC5, 0x00},
-{WCD9360_CDC_RX9_RX_PATH_SEC6, 0x00},
-{WCD9360_CDC_RX9_RX_PATH_SEC7, 0x00},
-{WCD9360_CDC_RX9_RX_PATH_MIX_SEC0, 0x08},
-{WCD9360_CDC_RX9_RX_PATH_MIX_SEC1, 0x00},
-{WCD9360_CDC_RX9_RX_PATH_DSMDEM_CTL, 0x00},
-{WCD9360_CDC_RX7_RX_PATH_CTL, 0x04},
-{WCD9360_CDC_RX7_RX_PATH_CFG0, 0x00},
-{WCD9360_CDC_RX7_RX_PATH_CFG1, 0x64},
-{WCD9360_CDC_RX7_RX_PATH_CFG2, 0x80},
-{WCD9360_CDC_RX7_RX_VOL_CTL, 0x00},
-{WCD9360_CDC_RX7_RX_PATH_MIX_CTL, 0x04},
-{WCD9360_CDC_RX7_RX_PATH_MIX_CFG, 0x12},
-{WCD9360_CDC_RX7_RX_VOL_MIX_CTL, 0x00},
-{WCD9360_CDC_RX7_RX_PATH_SEC0, 0x04},
-{WCD9360_CDC_RX7_RX_PATH_SEC1, 0x08},
-{WCD9360_CDC_RX7_RX_PATH_SEC2, 0x00},
-{WCD9360_CDC_RX7_RX_PATH_SEC3, 0x00},
-{WCD9360_CDC_RX7_RX_PATH_SEC5, 0x00},
-{WCD9360_CDC_RX7_RX_PATH_SEC6, 0x00},
-{WCD9360_CDC_RX7_RX_PATH_SEC7, 0x00},
-{WCD9360_CDC_RX7_RX_PATH_MIX_SEC0, 0x08},
-{WCD9360_CDC_RX7_RX_PATH_MIX_SEC1, 0x00},
-{WCD9360_CDC_RX7_RX_PATH_DSMDEM_CTL, 0x00},
-{WCD9360_CDC_RX8_RX_PATH_CTL, 0x04},
-{WCD9360_CDC_RX8_RX_PATH_CFG0, 0x00},
-{WCD9360_CDC_RX8_RX_PATH_CFG1, 0x64},
-{WCD9360_CDC_RX8_RX_PATH_CFG2, 0x80},
-{WCD9360_CDC_RX8_RX_VOL_CTL, 0x00},
-{WCD9360_CDC_RX8_RX_PATH_MIX_CTL, 0x04},
-{WCD9360_CDC_RX8_RX_PATH_MIX_CFG, 0x12},
-{WCD9360_CDC_RX8_RX_VOL_MIX_CTL, 0x00},
-{WCD9360_CDC_RX8_RX_PATH_SEC0, 0x04},
-{WCD9360_CDC_RX8_RX_PATH_SEC1, 0x08},
-{WCD9360_CDC_RX8_RX_PATH_SEC2, 0x00},
-{WCD9360_CDC_RX8_RX_PATH_SEC3, 0x00},
-{WCD9360_CDC_RX8_RX_PATH_SEC5, 0x00},
-{WCD9360_CDC_RX8_RX_PATH_SEC6, 0x00},
-{WCD9360_CDC_RX8_RX_PATH_SEC7, 0x00},
-{WCD9360_CDC_RX8_RX_PATH_MIX_SEC0, 0x08},
-{WCD9360_CDC_RX8_RX_PATH_MIX_SEC1, 0x00},
-{WCD9360_CDC_RX8_RX_PATH_DSMDEM_CTL, 0x00},
-{WCD9360_PAGE12_PAGE_REGISTER, 0x00},
-{WCD9360_CDC_BOOST0_BOOST_PATH_CTL, 0x00},
-{WCD9360_CDC_BOOST0_BOOST_CTL, 0xD0},
-{WCD9360_CDC_BOOST0_BOOST_CFG1, 0x89},
-{WCD9360_CDC_BOOST0_BOOST_CFG2, 0x04},
-{WCD9360_CDC_BOOST1_BOOST_PATH_CTL, 0x00},
-{WCD9360_CDC_BOOST1_BOOST_CTL, 0xD0},
-{WCD9360_CDC_BOOST1_BOOST_CFG1, 0x89},
-{WCD9360_CDC_BOOST1_BOOST_CFG2, 0x04},
-{WCD9360_MIXING_ASRC2_CLK_RST_CTL, 0x00},
-{WCD9360_MIXING_ASRC2_CTL0, 0x00},
-{WCD9360_MIXING_ASRC2_CTL1, 0x00},
-{WCD9360_MIXING_ASRC2_FIFO_CTL, 0xA8},
-{WCD9360_MIXING_ASRC2_STATUS_FMIN_CNTR_LSB, 0x00},
-{WCD9360_MIXING_ASRC2_STATUS_FMIN_CNTR_MSB, 0x00},
-{WCD9360_MIXING_ASRC2_STATUS_FMAX_CNTR_LSB, 0x00},
-{WCD9360_MIXING_ASRC2_STATUS_FMAX_CNTR_MSB, 0x00},
-{WCD9360_MIXING_ASRC2_STATUS_FIFO, 0x00},
-{WCD9360_MIXING_ASRC3_CLK_RST_CTL, 0x00},
-{WCD9360_MIXING_ASRC3_CTL0, 0x00},
-{WCD9360_MIXING_ASRC3_CTL1, 0x00},
-{WCD9360_MIXING_ASRC3_FIFO_CTL, 0xA8},
-{WCD9360_MIXING_ASRC3_STATUS_FMIN_CNTR_LSB, 0x00},
-{WCD9360_MIXING_ASRC3_STATUS_FMIN_CNTR_MSB, 0x00},
-{WCD9360_MIXING_ASRC3_STATUS_FMAX_CNTR_LSB, 0x00},
-{WCD9360_MIXING_ASRC3_STATUS_FMAX_CNTR_MSB, 0x00},
-{WCD9360_MIXING_ASRC3_STATUS_FIFO, 0x00},
-{WCD9360_SWR_AHB_BRIDGE_WR_DATA_0, 0x00},
-{WCD9360_SWR_AHB_BRIDGE_WR_DATA_1, 0x00},
-{WCD9360_SWR_AHB_BRIDGE_WR_DATA_2, 0x00},
-{WCD9360_SWR_AHB_BRIDGE_WR_DATA_3, 0x00},
-{WCD9360_SWR_AHB_BRIDGE_WR_ADDR_0, 0x00},
-{WCD9360_SWR_AHB_BRIDGE_WR_ADDR_1, 0x00},
-{WCD9360_SWR_AHB_BRIDGE_WR_ADDR_2, 0x00},
-{WCD9360_SWR_AHB_BRIDGE_WR_ADDR_3, 0x00},
-{WCD9360_SWR_AHB_BRIDGE_RD_ADDR_0, 0x00},
-{WCD9360_SWR_AHB_BRIDGE_RD_ADDR_1, 0x00},
-{WCD9360_SWR_AHB_BRIDGE_RD_ADDR_2, 0x00},
-{WCD9360_SWR_AHB_BRIDGE_RD_ADDR_3, 0x00},
-{WCD9360_SWR_AHB_BRIDGE_RD_DATA_0, 0x00},
-{WCD9360_SWR_AHB_BRIDGE_RD_DATA_1, 0x00},
-{WCD9360_SWR_AHB_BRIDGE_RD_DATA_2, 0x00},
-{WCD9360_SWR_AHB_BRIDGE_RD_DATA_3, 0x00},
-{WCD9360_SWR_AHB_BRIDGE_ACCESS_CFG, 0x0F},
-{WCD9360_SWR_AHB_BRIDGE_ACCESS_STATUS, 0x03},
-{WCD9360_CDC_SIDETONE_SRC0_ST_SRC_PATH_CTL, 0x04},
-{WCD9360_CDC_SIDETONE_SRC0_ST_SRC_PATH_CFG1, 0x00},
-{WCD9360_SIDETONE_ASRC0_CLK_RST_CTL, 0x00},
-{WCD9360_SIDETONE_ASRC0_CTL0, 0x00},
-{WCD9360_SIDETONE_ASRC0_CTL1, 0x00},
-{WCD9360_SIDETONE_ASRC0_FIFO_CTL, 0xA8},
-{WCD9360_SIDETONE_ASRC0_STATUS_FMIN_CNTR_LSB, 0x00},
-{WCD9360_SIDETONE_ASRC0_STATUS_FMIN_CNTR_MSB, 0x00},
-{WCD9360_SIDETONE_ASRC0_STATUS_FMAX_CNTR_LSB, 0x00},
-{WCD9360_SIDETONE_ASRC0_STATUS_FMAX_CNTR_MSB, 0x00},
-{WCD9360_SIDETONE_ASRC0_STATUS_FIFO, 0x00},
-{WCD9360_EC_REF_HQ0_EC_REF_HQ_PATH_CTL, 0x00},
-{WCD9360_EC_REF_HQ0_EC_REF_HQ_CFG0, 0x01},
-{WCD9360_EC_REF_HQ1_EC_REF_HQ_PATH_CTL, 0x00},
-{WCD9360_EC_REF_HQ1_EC_REF_HQ_CFG0, 0x01},
-{WCD9360_EC_ASRC0_CLK_RST_CTL, 0x00},
-{WCD9360_EC_ASRC0_CTL0, 0x00},
-{WCD9360_EC_ASRC0_CTL1, 0x00},
-{WCD9360_EC_ASRC0_FIFO_CTL, 0xA8},
-{WCD9360_EC_ASRC0_STATUS_FMIN_CNTR_LSB, 0x00},
-{WCD9360_EC_ASRC0_STATUS_FMIN_CNTR_MSB, 0x00},
-{WCD9360_EC_ASRC0_STATUS_FMAX_CNTR_LSB, 0x00},
-{WCD9360_EC_ASRC0_STATUS_FMAX_CNTR_MSB, 0x00},
-{WCD9360_EC_ASRC0_STATUS_FIFO, 0x00},
-{WCD9360_EC_ASRC1_CLK_RST_CTL, 0x00},
-{WCD9360_EC_ASRC1_CTL0, 0x00},
-{WCD9360_EC_ASRC1_CTL1, 0x00},
-{WCD9360_EC_ASRC1_FIFO_CTL, 0xA8},
-{WCD9360_EC_ASRC1_STATUS_FMIN_CNTR_LSB, 0x00},
-{WCD9360_EC_ASRC1_STATUS_FMIN_CNTR_MSB, 0x00},
-{WCD9360_EC_ASRC1_STATUS_FMAX_CNTR_LSB, 0x00},
-{WCD9360_EC_ASRC1_STATUS_FMAX_CNTR_MSB, 0x00},
-{WCD9360_EC_ASRC1_STATUS_FIFO, 0x00},
-{WCD9360_PAGE13_PAGE_REGISTER, 0x00},
-{WCD9360_CDC_RX_INP_MUX_RX_INT0_CFG0, 0x00},
-{WCD9360_CDC_RX_INP_MUX_RX_INT0_CFG1, 0x00},
-{WCD9360_CDC_RX_INP_MUX_RX_INT9_CFG0, 0x00},
-{WCD9360_CDC_RX_INP_MUX_RX_INT9_CFG1, 0x00},
-{WCD9360_CDC_RX_INP_MUX_RX_INT7_CFG0, 0x00},
-{WCD9360_CDC_RX_INP_MUX_RX_INT7_CFG1, 0x00},
-{WCD9360_CDC_RX_INP_MUX_RX_INT8_CFG0, 0x00},
-{WCD9360_CDC_RX_INP_MUX_RX_INT8_CFG1, 0x00},
-{WCD9360_CDC_RX_INP_MUX_RX_MIX_CFG0, 0x00},
-{WCD9360_CDC_RX_INP_MUX_RX_MIX_CFG1, 0x00},
-{WCD9360_CDC_RX_INP_MUX_RX_MIX_CFG2, 0x00},
-{WCD9360_CDC_RX_INP_MUX_RX_MIX_CFG3, 0x00},
-{WCD9360_CDC_RX_INP_MUX_RX_MIX_CFG4, 0x00},
-{WCD9360_CDC_RX_INP_MUX_SIDETONE_SRC_CFG0, 0x00},
-{WCD9360_CDC_RX_INP_MUX_SIDETONE_SRC_CFG1, 0x00},
-{WCD9360_CDC_RX_INP_MUX_ANC_CFG0, 0x00},
-{WCD9360_CDC_RX_INP_MUX_SPLINE_ASRC_CFG0, 0x00},
-{WCD9360_CDC_RX_INP_MUX_EC_REF_HQ_CFG0, 0x00},
-{WCD9360_CDC_TX_INP_MUX_ADC_MUX0_CFG0, 0x00},
-{WCD9360_CDC_TX_INP_MUX_ADC_MUX0_CFG1, 0x00},
-{WCD9360_CDC_TX_INP_MUX_ADC_MUX1_CFG0, 0x00},
-{WCD9360_CDC_TX_INP_MUX_ADC_MUX1_CFG1, 0x00},
-{WCD9360_CDC_TX_INP_MUX_ADC_MUX2_CFG0, 0x00},
-{WCD9360_CDC_TX_INP_MUX_ADC_MUX2_CFG1, 0x00},
-{WCD9360_CDC_TX_INP_MUX_ADC_MUX3_CFG0, 0x00},
-{WCD9360_CDC_TX_INP_MUX_ADC_MUX3_CFG1, 0x00},
-{WCD9360_CDC_TX_INP_MUX_ADC_MUX4_CFG0, 0x00},
-{WCD9360_CDC_TX_INP_MUX_ADC_MUX5_CFG0, 0x00},
-{WCD9360_CDC_TX_INP_MUX_ADC_MUX6_CFG0, 0x00},
-{WCD9360_CDC_TX_INP_MUX_ADC_MUX7_CFG0, 0x00},
-{WCD9360_CDC_TX_INP_MUX_ADC_MUX8_CFG0, 0x00},
-{WCD9360_CDC_TX_INP_MUX_ADC_MUX10_CFG0, 0x00},
-{WCD9360_CDC_TX_INP_MUX_ADC_MUX11_CFG0, 0x00},
-{WCD9360_CDC_SIDETONE_IIR_INP_MUX_IIR0_MIX_CFG0, 0x00},
-{WCD9360_CDC_SIDETONE_IIR_INP_MUX_IIR0_MIX_CFG1, 0x00},
-{WCD9360_CDC_SIDETONE_IIR_INP_MUX_IIR0_MIX_CFG2, 0x00},
-{WCD9360_CDC_SIDETONE_IIR_INP_MUX_IIR0_MIX_CFG3, 0x00},
-{WCD9360_CDC_IF_ROUTER_TX_MUX_CFG0, 0x00},
-{WCD9360_CDC_IF_ROUTER_TX_MUX_CFG1, 0x00},
-{WCD9360_CDC_IF_ROUTER_TX_MUX_CFG2, 0x00},
-{WCD9360_CDC_IF_ROUTER_TX_MUX_CFG3, 0x00},
-{WCD9360_CDC_CLK_RST_CTRL_MCLK_CONTROL, 0x00},
-{WCD9360_CDC_CLK_RST_CTRL_FS_CNT_CONTROL, 0x00},
-{WCD9360_CDC_CLK_RST_CTRL_SWR_CONTROL, 0x00},
-{WCD9360_CDC_CLK_RST_CTRL_ASRC_SHARE_CONTROL, 0x0A},
-{WCD9360_CDC_PROX_DETECT_PROX_CTL, 0x08},
-{WCD9360_CDC_PROX_DETECT_PROX_POLL_PERIOD0, 0x00},
-{WCD9360_CDC_PROX_DETECT_PROX_POLL_PERIOD1, 0x4B},
-{WCD9360_CDC_PROX_DETECT_PROX_SIG_PATTERN_LSB, 0x00},
-{WCD9360_CDC_PROX_DETECT_PROX_SIG_PATTERN_MSB, 0x00},
-{WCD9360_CDC_PROX_DETECT_PROX_STATUS, 0x00},
-{WCD9360_CDC_PROX_DETECT_PROX_TEST_CTRL, 0x00},
-{WCD9360_CDC_PROX_DETECT_PROX_TEST_BUFF_LSB, 0x00},
-{WCD9360_CDC_PROX_DETECT_PROX_TEST_BUFF_MSB, 0x00},
-{WCD9360_CDC_PROX_DETECT_PROX_TEST_BUFF_LSB_RD, 0x00},
-{WCD9360_CDC_PROX_DETECT_PROX_TEST_BUFF_MSB_RD, 0x00},
-{WCD9360_CDC_PROX_DETECT_PROX_CTL_REPEAT_PAT, 0x00},
-{WCD9360_CDC_SIDETONE_IIR0_IIR_PATH_CTL, 0x00},
-{WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B1_CTL, 0x00},
-{WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B2_CTL, 0x00},
-{WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B3_CTL, 0x00},
-{WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B4_CTL, 0x00},
-{WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B5_CTL, 0x00},
-{WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B6_CTL, 0x00},
-{WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B7_CTL, 0x00},
-{WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B8_CTL, 0x00},
-{WCD9360_CDC_SIDETONE_IIR0_IIR_CTL, 0x40},
-{WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_TIMER_CTL, 0x00},
-{WCD9360_CDC_SIDETONE_IIR0_IIR_COEF_B1_CTL, 0x00},
-{WCD9360_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL, 0x00},
-{WCD9360_CDC_TOP_TOP_CFG0, 0x00},
-{WCD9360_CDC_TOP_TOP_CFG1, 0x00},
-{WCD9360_CDC_TOP_TOP_CFG7, 0x00},
-{WCD9360_CDC_TOP_EAR_COMP_WR_LSB, 0x00},
-{WCD9360_CDC_TOP_EAR_COMP_WR_MSB, 0x00},
-{WCD9360_CDC_TOP_EAR_COMP_LUT, 0x00},
-{WCD9360_CDC_TOP_EAR_COMP_RD_LSB, 0x00},
-{WCD9360_CDC_TOP_EAR_COMP_RD_MSB, 0x00},
-{WCD9360_CDC_TOP_TOP_DEBUG, 0x00},
-{WCD9360_PAGE80_PAGE_REGISTER, 0x00},
-{WCD9360_CODEC_CPR_WR_DATA_0, 0x00},
-{WCD9360_CODEC_CPR_WR_DATA_1, 0x00},
-{WCD9360_CODEC_CPR_WR_DATA_2, 0x00},
-{WCD9360_CODEC_CPR_WR_DATA_3, 0x00},
-{WCD9360_CODEC_CPR_WR_ADDR_0, 0x00},
-{WCD9360_CODEC_CPR_WR_ADDR_1, 0x00},
-{WCD9360_CODEC_CPR_WR_ADDR_2, 0x00},
-{WCD9360_CODEC_CPR_WR_ADDR_3, 0x00},
-{WCD9360_CODEC_CPR_RD_ADDR_0, 0x00},
-{WCD9360_CODEC_CPR_RD_ADDR_1, 0x00},
-{WCD9360_CODEC_CPR_RD_ADDR_2, 0x00},
-{WCD9360_CODEC_CPR_RD_ADDR_3, 0x00},
-{WCD9360_CODEC_CPR_RD_DATA_0, 0x00},
-{WCD9360_CODEC_CPR_RD_DATA_1, 0x00},
-{WCD9360_CODEC_CPR_RD_DATA_2, 0x00},
-{WCD9360_CODEC_CPR_RD_DATA_3, 0x00},
-{WCD9360_CODEC_CPR_ACCESS_CFG, 0x0F},
-{WCD9360_CODEC_CPR_ACCESS_STATUS, 0x03},
-{WCD9360_CODEC_CPR_NOM_CX_VDD, 0xB4},
-{WCD9360_CODEC_CPR_SVS_CX_VDD, 0x7C},
-{WCD9360_CODEC_CPR_SVS2_CX_VDD, 0x58},
-{WCD9360_CODEC_CPR_NOM_MX_VDD, 0xB4},
-{WCD9360_CODEC_CPR_SVS_MX_VDD, 0xB4},
-{WCD9360_CODEC_CPR_SVS2_MX_VDD, 0xA0},
-{WCD9360_CODEC_CPR_SVS2_MIN_CX_VDD, 0x2C},
-{WCD9360_CODEC_CPR_MAX_SVS2_STEP, 0x08},
-{WCD9360_CODEC_CPR_CTL, 0x00},
-{WCD9360_CODEC_CPR_SW_MODECHNG_STATUS, 0x00},
-{WCD9360_CODEC_CPR_SW_MODECHNG_START, 0x00},
-{WCD9360_CODEC_CPR_CPR_STATUS, 0x00},
-{WCD9360_PAGE128_PAGE_REGISTER, 0x00},
-{WCD9360_TLMM_JTCK_PINCFG, 0x00},
-{WCD9360_TLMM_INTR1_PINCFG, 0x00},
-{WCD9360_TLMM_INTR2_PINCFG, 0x00},
-{WCD9360_TLMM_SWR_DATA_PINCFG, 0x00},
-{WCD9360_TLMM_SWR_CLK_PINCFG, 0x00},
-{WCD9360_TLMM_SLIMBUS_DATA1_PINCFG, 0x00},
-{WCD9360_TLMM_SLIMBUS_DATA2_PINCFG, 0x00},
-{WCD9360_TLMM_SLIMBUS_CLK_PINCFG, 0x00},
-{WCD9360_TLMM_I2C_CLK_PINCFG, 0x00},
-{WCD9360_TLMM_I2C_DATA_PINCFG, 0x00},
-{WCD9360_TLMM_I2S_0_RX_PINCFG, 0x00},
-{WCD9360_TLMM_I2S_0_TX_PINCFG, 0x00},
-{WCD9360_TLMM_I2S_0_SCK_PINCFG, 0x00},
-{WCD9360_TLMM_I2S_0_WS_PINCFG, 0x00},
-{WCD9360_TLMM_I2S_1_RX_PINCFG, 0x00},
-{WCD9360_TLMM_I2S_1_TX_PINCFG, 0x00},
-{WCD9360_TLMM_I2S_1_SCK_PINCFG, 0x00},
-{WCD9360_TLMM_I2S_1_WS_PINCFG, 0x00},
-{WCD9360_TLMM_DMIC1_CLK_PINCFG, 0x00},
-{WCD9360_TLMM_DMIC1_DATA_PINCFG, 0x00},
-{WCD9360_TLMM_DMIC2_CLK_PINCFG, 0x00},
-{WCD9360_TLMM_DMIC2_DATA_PINCFG, 0x00},
-{WCD9360_TLMM_GPIO1_PINCFG, 0x00},
-{WCD9360_TLMM_GPIO2_PINCFG, 0x00},
-{WCD9360_TLMM_GPIO3_PINCFG, 0x00},
-{WCD9360_TLMM_GPIO4_PINCFG, 0x00},
-{WCD9360_TLMM_SPI_S_CSN_PINCFG, 0x00},
-{WCD9360_TLMM_SPI_S_CLK_PINCFG, 0x00},
-{WCD9360_TLMM_SPI_S_DOUT_PINCFG, 0x00},
-{WCD9360_TLMM_SPI_S_DIN_PINCFG, 0x00},
-{WCD9360_TLMM_GPIO0_PINCFG, 0x00},
-{WCD9360_TLMM_DMIC3_CLK_PINCFG, 0x00},
-{WCD9360_TLMM_DMIC3_DATA_PINCFG, 0x00},
-{WCD9360_TLMM_DMIC4_CLK_PINCFG, 0x00},
-{WCD9360_TLMM_DMIC4_DATA_PINCFG, 0x00},
-{WCD9360_TEST_DEBUG_PIN_CTL_OE_0, 0x00},
-{WCD9360_TEST_DEBUG_PIN_CTL_OE_1, 0x00},
-{WCD9360_TEST_DEBUG_PIN_CTL_OE_2, 0x00},
-{WCD9360_TEST_DEBUG_PIN_CTL_OE_3, 0x00},
-{WCD9360_TEST_DEBUG_PIN_CTL_OE_4, 0x00},
-{WCD9360_TEST_DEBUG_PIN_CTL_DATA_0, 0x00},
-{WCD9360_TEST_DEBUG_PIN_CTL_DATA_1, 0x00},
-{WCD9360_TEST_DEBUG_PIN_CTL_DATA_2, 0x00},
-{WCD9360_TEST_DEBUG_PIN_CTL_DATA_3, 0x00},
-{WCD9360_TEST_DEBUG_PIN_CTL_DATA_4, 0x00},
-{WCD9360_TEST_DEBUG_PAD_DRVCTL_0, 0x00},
-{WCD9360_TEST_DEBUG_PAD_DRVCTL_1, 0x00},
-{WCD9360_TEST_DEBUG_PIN_STATUS, 0x00},
-{WCD9360_TEST_DEBUG_NPL_DLY_TEST_1, 0x10},
-{WCD9360_TEST_DEBUG_NPL_DLY_TEST_2, 0x60},
-{WCD9360_TEST_DEBUG_MEM_CTRL, 0x00},
-{WCD9360_TEST_DEBUG_DEBUG_BUS_SEL, 0x00},
-{WCD9360_TEST_DEBUG_DEBUG_JTAG, 0x00},
-{WCD9360_TEST_DEBUG_DEBUG_EN_1, 0x00},
-{WCD9360_TEST_DEBUG_DEBUG_EN_2, 0x00},
-{WCD9360_TEST_DEBUG_DEBUG_EN_3, 0x00},
-{WCD9360_TEST_DEBUG_DEBUG_EN_4, 0x00},
-{WCD9360_TEST_DEBUG_DEBUG_EN_5, 0x00},
-{WCD9360_TEST_DEBUG_ANA_DTEST_DIR, 0x00},
-{WCD9360_TEST_DEBUG_PAD_INP_DISABLE_0, 0x00},
-{WCD9360_TEST_DEBUG_PAD_INP_DISABLE_1, 0x00},
-{WCD9360_TEST_DEBUG_PAD_INP_DISABLE_2, 0x00},
-{WCD9360_TEST_DEBUG_PAD_INP_DISABLE_3, 0x00},
-{WCD9360_TEST_DEBUG_PAD_INP_DISABLE_4, 0x00},
-{WCD9360_TEST_DEBUG_SYSMEM_CTRL, 0x00},
-{WCD9360_TEST_DEBUG_LVAL_NOM_LOW, 0x96},
-{WCD9360_TEST_DEBUG_LVAL_NOM_HIGH, 0x00},
-{WCD9360_TEST_DEBUG_LVAL_SVS_SVS2_LOW, 0x53},
-{WCD9360_TEST_DEBUG_LVAL_SVS_SVS2_HIGH, 0x00},
-{WCD9360_TEST_DEBUG_SPI_SLAVE_CHAR, 0x00},
-{WCD9360_TEST_DEBUG_CODEC_DIAGS, 0x00},
-};
-
-
-const u8 wcd9360_page0_reg_access[WCD9360_PAGE_SIZE] = {
-[WCD9360_REG(WCD9360_PAGE0_PAGE_REGISTER)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CODEC_RPM_CLK_BYPASS)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CODEC_RPM_CLK_GATE)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CODEC_RPM_CLK_MCLK_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CODEC_RPM_CLK_MCLK2_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CODEC_RPM_I2S_DSD_CLK_SEL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CODEC_RPM_RST_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CODEC_RPM_PWR_CDC_DIG_HM_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CHIP_TIER_CTRL_CHIP_ID_BYTE0)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CHIP_TIER_CTRL_CHIP_ID_BYTE1)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CHIP_TIER_CTRL_CHIP_ID_BYTE2)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CHIP_TIER_CTRL_CHIP_ID_BYTE3)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CHIP_TIER_CTRL_EFUSE_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CHIP_TIER_CTRL_EFUSE_TEST0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CHIP_TIER_CTRL_EFUSE_TEST1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CHIP_TIER_CTRL_EFUSE_STATUS)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CHIP_TIER_CTRL_I2C_SLAVE_ID_NONNEGO)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CHIP_TIER_CTRL_I2C_SLAVE_ID_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CHIP_TIER_CTRL_I2C_SLAVE_ID_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CHIP_TIER_CTRL_I2C_SLAVE_ID_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CHIP_TIER_CTRL_ANA_WAIT_STATE_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CHIP_TIER_CTRL_I2C_ACTIVE)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CHIP_TIER_CTRL_ALT_FUNC_EN)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CHIP_TIER_CTRL_GPIO_CTL_OE)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CHIP_TIER_CTRL_GPIO_CTL_DATA)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_RX0_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_RX1_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_RX2_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_RX3_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_RX4_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_RX5_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_RX6_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_RX7_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_SB_TX0_INP_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_SB_TX1_INP_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_SB_TX2_INP_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_SB_TX3_INP_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_SB_TX4_INP_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_SB_TX5_INP_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_SB_TX6_INP_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_SB_TX7_INP_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_SB_TX8_INP_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_SB_TX9_INP_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_SB_TX10_INP_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_SB_TX11_INP_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_SB_TX12_INP_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_SB_TX13_INP_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_SB_TX14_INP_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_SB_TX15_INP_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_I2S_TX0_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_I2S_TX0_CFG2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_I2S_TX1_0_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_I2S_TX1_1_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_DATA_HUB_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_I2S_0_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_I2S_1_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_I2S_0_CTL2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_I2S_1_CTL2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_I2S_CLKSRC_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_I2S_COMMON_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_I2S_0_TDM_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_I2S_0_TDM_CTL2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_I2S_0_TDM_CH_RX)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_I2S_0_TDM_CH_TX)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_I2S_0_TDM_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_I2S_0_TDM_STRETCH)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DATA_HUB_I2S_RESET_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_RDMA_CTL_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_RDMA_CTL_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_RDMA_CTL_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_RDMA_CTL_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_RDMA_CTL_4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_CH_2_3_CFG_RDMA_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_CH_2_3_CFG_RDMA_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_CH_2_3_CFG_RDMA_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_CH_2_3_CFG_RDMA_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_CH_2_3_CFG_RDMA_4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_CH_0_1_CFG_RDMA_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_CH_0_1_CFG_RDMA_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_CH_0_1_CFG_RDMA_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_CH_0_1_CFG_RDMA_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_CH_0_1_CFG_RDMA_4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_RDMA4_PRT_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_RDMA_SBTX0_7_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_RDMA_SBTX8_10_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_WDMA_CTL_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_WDMA_CTL_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_WDMA_CTL_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_WDMA_CTL_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_WDMA_CTL_4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_CH_4_5_CFG_WDMA_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_CH_4_5_CFG_WDMA_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_CH_4_5_CFG_WDMA_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_CH_4_5_CFG_WDMA_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_CH_4_5_CFG_WDMA_4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_CH_2_3_CFG_WDMA_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_CH_2_3_CFG_WDMA_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_CH_2_3_CFG_WDMA_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_CH_2_3_CFG_WDMA_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_CH_2_3_CFG_WDMA_4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_CH_0_1_CFG_WDMA_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_CH_0_1_CFG_WDMA_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_CH_0_1_CFG_WDMA_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_CH_0_1_CFG_WDMA_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_CH_0_1_CFG_WDMA_4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_WDMA0_PRT_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_WDMA3_PRT_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_WDMA4_PRT0_3_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DMA_WDMA4_PRT4_7_CFG)] = WCD9360_RW,
-};
-
-const u8 wcd9360_page1_reg_access[WCD9360_PAGE_SIZE] = {
-[WCD9360_REG(WCD9360_PAGE1_PAGE_REGISTER)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_USER_CTL_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_USER_CTL_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_USER_CTL_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_USER_CTL_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_USER_CTL_4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_USER_CTL_5)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_USER_CTL_6)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_USER_CTL_7)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_USER_CTL_8)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_USER_CTL_9)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_L_VAL_CTL_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_L_VAL_CTL_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_DSM_FRAC_CTL_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_DSM_FRAC_CTL_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_CONFIG_CTL_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_CONFIG_CTL_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_CONFIG_CTL_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_CONFIG_CTL_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_CONFIG_CTL_4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_TEST_CTL_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_TEST_CTL_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_TEST_CTL_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_TEST_CTL_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_TEST_CTL_4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_TEST_CTL_5)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_TEST_CTL_6)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_TEST_CTL_7)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_FREQ_CTL_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_FREQ_CTL_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_FREQ_CTL_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_FREQ_CTL_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_SSC_CTL_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_SSC_CTL_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_SSC_CTL_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_SSC_CTL_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_FLL_MODE)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_FLL_STATUS_0)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CPE_FLL_STATUS_1)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CPE_FLL_STATUS_2)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CPE_FLL_STATUS_3)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_I2S_FLL_USER_CTL_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_USER_CTL_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_USER_CTL_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_USER_CTL_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_USER_CTL_4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_USER_CTL_5)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_USER_CTL_6)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_USER_CTL_7)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_USER_CTL_8)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_USER_CTL_9)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_L_VAL_CTL_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_L_VAL_CTL_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_DSM_FRAC_CTL_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_DSM_FRAC_CTL_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_CONFIG_CTL_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_CONFIG_CTL_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_CONFIG_CTL_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_CONFIG_CTL_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_CONFIG_CTL_4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_TEST_CTL_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_TEST_CTL_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_TEST_CTL_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_TEST_CTL_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_TEST_CTL_4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_TEST_CTL_5)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_TEST_CTL_6)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_TEST_CTL_7)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_FREQ_CTL_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_FREQ_CTL_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_FREQ_CTL_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_FREQ_CTL_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_SSC_CTL_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_SSC_CTL_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_SSC_CTL_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_SSC_CTL_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_FLL_MODE)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_I2S_FLL_STATUS_0)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_I2S_FLL_STATUS_1)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_I2S_FLL_STATUS_2)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_I2S_FLL_STATUS_3)] = WCD9360_RO,
-};
-
-const u8 wcd9360_page2_reg_access[WCD9360_PAGE_SIZE] = {
-[WCD9360_REG(WCD9360_PAGE2_PAGE_REGISTER)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_CPE_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_PWR_SYS_PSTATE_CTL_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_PWR_SYS_PSTATE_CTL_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_PWR_CPEFLL_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_PWR_CPE_SYSMEM_DEEPSLP_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_PWR_CPE_SYSMEM_DEEPSLP_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_PWR_CPE_DRAM1_SHUTDOWN)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_US_BUF_INT_PERIOD)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_CPARMAD_BUFRDY_INT_PERIOD)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_SVA_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_US_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_MAD_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_CPAR_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_DMIC0_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_DMIC1_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_DMIC2_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_DMIC_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_CPAR_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_WDOG_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_BACKUP_INT)] = WCD9360_WO,
-[WCD9360_REG(WCD9360_CPE_SS_STATUS)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_CPE_OCD_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_SS_ERROR_INT_MASK_0A)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_SS_ERROR_INT_MASK_0B)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_SS_ERROR_INT_MASK_1A)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_SS_ERROR_INT_MASK_1B)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_SS_ERROR_INT_STATUS_0A)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CPE_SS_SS_ERROR_INT_STATUS_0B)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CPE_SS_SS_ERROR_INT_STATUS_1A)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CPE_SS_SS_ERROR_INT_STATUS_1B)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CPE_SS_SS_ERROR_INT_CLEAR_0A)] = WCD9360_WO,
-[WCD9360_REG(WCD9360_CPE_SS_SS_ERROR_INT_CLEAR_0B)] = WCD9360_WO,
-[WCD9360_REG(WCD9360_CPE_SS_SS_ERROR_INT_CLEAR_1A)] = WCD9360_WO,
-[WCD9360_REG(WCD9360_CPE_SS_SS_ERROR_INT_CLEAR_1B)] = WCD9360_WO,
-[WCD9360_REG(WCD9360_CPE_SS_DMIC3_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_WDOG_RESET)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_MCLK_PRG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_IN_0)] = WCD9360_WO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_IN_1)] = WCD9360_WO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_IN_2)] = WCD9360_WO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_IN_3)] = WCD9360_WO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_IN_4)] = WCD9360_WO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_IN_5)] = WCD9360_WO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_IN_6)] = WCD9360_WO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_IN_7)] = WCD9360_WO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_IN_8)] = WCD9360_WO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_IN_9)] = WCD9360_WO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_IN_10)] = WCD9360_WO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_IN_11)] = WCD9360_WO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_IN_12)] = WCD9360_WO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_IN_13)] = WCD9360_WO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_IN_14)] = WCD9360_WO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_IN_15)] = WCD9360_WO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_OUT_0)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_OUT_1)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_OUT_2)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_OUT_3)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_OUT_4)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_OUT_5)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_OUT_6)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_OUT_7)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_OUT_8)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_OUT_9)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_OUT_10)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_OUT_11)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_OUT_12)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_OUT_13)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_OUT_14)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_IPC_OUT_15)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CPE_SS_LPASS_ARB_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_MEM_DEEPSLEEP_RD_0)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CPE_SS_MEM_DEEPSLEEP_RD_1)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CPE_SS_MEM_DEEPSLEEP_BYPASS_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CPE_SS_MEM_DEEPSLEEP_BYPASS_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_MAIN_CTL_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_MAIN_CTL_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_AUDIO_CTL_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_AUDIO_CTL_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_AUDIO_CTL_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_AUDIO_CTL_4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_AUDIO_CTL_5)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_AUDIO_CTL_6)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_AUDIO_CTL_7)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_AUDIO_CTL_8)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_AUDIO_IIR_CTL_PTR)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_AUDIO_IIR_CTL_VAL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_ULTR_CTL_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_ULTR_CTL_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_ULTR_CTL_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_ULTR_CTL_4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_ULTR_CTL_5)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_ULTR_CTL_6)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_ULTR_CTL_7)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_BEACON_CTL_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_BEACON_CTL_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_BEACON_CTL_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_BEACON_CTL_4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_BEACON_CTL_5)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_BEACON_CTL_6)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_BEACON_CTL_7)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_BEACON_CTL_8)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_BEACON_IIR_CTL_PTR)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_BEACON_IIR_CTL_VAL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_INP_SEL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SOC_MAD_MAD2_INP_SEL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SWR_SAMPLE_PACK_SWR_SAMPLE_PACK_CTRL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SWR_SAMPLE_PACK_SWR_SAMPLE_PACK_STATUS)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SWR_SAMPLE_PACK_SWR_SAMPLE_PACK_FS)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SWR_SAMPLE_PACK_SWR_SAMPLE_PACK_IN_SEL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT0)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT1)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT2)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT3)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT4)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT5)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT6)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT7)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT8)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT9)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT10)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT11)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT12)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT13)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT14)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT15)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT0)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT1)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT2)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT3)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT4)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT5)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT6)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT7)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT8)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT9)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT10)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT11)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT12)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT13)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT14)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT15)] = WCD9360_RO,
-};
-
-const u8 wcd9360_page4_reg_access[WCD9360_PAGE_SIZE] = {
-[WCD9360_REG(WCD9360_PAGE4_PAGE_REGISTER)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_INTR_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_INTR_CLR_COMMIT)] = WCD9360_WO,
-[WCD9360_REG(WCD9360_INTR_PIN1_MASK0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_INTR_PIN1_MASK1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_INTR_PIN1_MASK2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_INTR_PIN1_MASK3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_INTR_PIN1_STATUS0)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_INTR_PIN1_STATUS1)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_INTR_PIN1_STATUS2)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_INTR_PIN1_STATUS3)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_INTR_PIN1_CLEAR0)] = WCD9360_WO,
-[WCD9360_REG(WCD9360_INTR_PIN1_CLEAR1)] = WCD9360_WO,
-[WCD9360_REG(WCD9360_INTR_PIN1_CLEAR2)] = WCD9360_WO,
-[WCD9360_REG(WCD9360_INTR_PIN1_CLEAR3)] = WCD9360_WO,
-[WCD9360_REG(WCD9360_INTR_PIN2_MASK3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_INTR_PIN2_STATUS3)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_INTR_PIN2_CLEAR3)] = WCD9360_WO,
-[WCD9360_REG(WCD9360_INTR_CPESS_SUMRY_MASK2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_INTR_CPESS_SUMRY_MASK3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_INTR_CPESS_SUMRY_STATUS2)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_INTR_CPESS_SUMRY_STATUS3)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_INTR_CPESS_SUMRY_CLEAR2)] = WCD9360_WO,
-[WCD9360_REG(WCD9360_INTR_CPESS_SUMRY_CLEAR3)] = WCD9360_WO,
-[WCD9360_REG(WCD9360_INTR_LEVEL0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_INTR_LEVEL1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_INTR_LEVEL2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_INTR_LEVEL3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_INTR_BYPASS0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_INTR_BYPASS1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_INTR_BYPASS2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_INTR_BYPASS3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_INTR_SET0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_INTR_SET1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_INTR_SET2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_INTR_SET3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_INTR_CODEC_MISC_MASK)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_INTR_CODEC_MISC_STATUS)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_INTR_CODEC_MISC_CLEAR)] = WCD9360_WO,
-};
-
-const u8 wcd9360_page6_reg_access[WCD9360_PAGE_SIZE] = {
-[WCD9360_REG(WCD9360_ANA_PAGE_REGISTER)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_ANA_BIAS)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_ANA_AMIC_INPUT_SWITCH_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_ANA_RCO)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_ANA_BUCK_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_ANA_BUCK_STATUS)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_ANA_EAR)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_ANA_MAD_SETUP)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_ANA_AMIC1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_ANA_AMIC2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_ANA_AMIC3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_ANA_AMIC4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_ANA_MICB1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_ANA_MICB2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_ANA_MICB3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_ANA_MICB4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_BIAS_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_BIAS_VBG_FINE_ADJ)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_RCO_CTRL_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_RCO_CTRL_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_RCO_CAL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_RCO_CAL_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_RCO_CAL_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_RCO_TEST_CTRL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_RCO_CAL_OUT_1)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_RCO_CAL_OUT_2)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_RCO_CAL_OUT_3)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_RCO_CAL_OUT_4)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_RCO_CAL_OUT_5)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_SIDO_MODE_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_MODE_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_MODE_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_MODE_4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_VCL_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_VCL_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_VCL_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_CCL_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_CCL_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_CCL_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_CCL_4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_CCL_5)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_CCL_6)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_CCL_7)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_CCL_8)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_CCL_9)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_CCL_10)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_FILTER_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_FILTER_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_DRIVER_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_DRIVER_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_DRIVER_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_CAL_CODE_EXT_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_CAL_CODE_EXT_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_CAL_CODE_OUT_1)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_SIDO_CAL_CODE_OUT_2)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_SIDO_TEST_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_TEST_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_LDOH_MODE)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_LDOH_BIAS)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_LDOH_STB_LOADS)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_LDOH_SLOWRAMP)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_MICB1_TEST_CTL_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_MICB1_TEST_CTL_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_MICB1_TEST_CTL_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_MICB2_TEST_CTL_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_MICB2_TEST_CTL_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_MICB2_TEST_CTL_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_MICB3_TEST_CTL_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_MICB3_TEST_CTL_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_MICB3_TEST_CTL_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_MICB4_TEST_CTL_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_MICB4_TEST_CTL_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_MICB4_TEST_CTL_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TX_COM_ADC_VCM)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TX_COM_BIAS_ATEST)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TX_COM_ADC_INT1_IB)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TX_COM_ADC_INT2_IB)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TX_COM_TXFE_DIV_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TX_COM_TXFE_DIV_START)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TX_COM_TXFE_DIV_STOP_9P6M)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TX_COM_TXFE_DIV_STOP_12P288M)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TX_1_2_TEST_EN)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TX_1_2_ADC_IB)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TX_1_2_ATEST_REFCTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TX_1_2_TEST_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TX_1_2_TEST_BLK_EN)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TX_1_2_TXFE_CLKDIV)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TX_1_2_SAR1_ERR)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_TX_1_2_SAR2_ERR)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_TX_3_4_TEST_EN)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TX_3_4_ADC_IB)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TX_3_4_ATEST_REFCTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TX_3_4_TEST_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TX_3_4_TEST_BLK_EN)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TX_3_4_TXFE_CLKDIV)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TX_3_4_SAR1_ERR)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_TX_3_4_SAR2_ERR)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_RX_RX_EAR_BIAS_CON_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_RX_RX_EAR_BIAS_CON_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_RX_RX_AUX_BIAS_CON_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_RX_RX_AUX_BIAS_CON_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_RX_RX_BIAS_ATEST)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_RX_RXTOP_RESERVED)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_EAR_EAR_EN_REG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_EAR_EAR_PA_CON)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_EAR_EAR_SP_CON)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_EAR_EAR_DAC_CON)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_EAR_EAR_CNP_FSM_CON)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_EAR_DAC_CTL_TEST)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_EAR_STATUS_REG)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EAR_EAR_COMPANDER_CON)] = WCD9360_RW,
-};
-
-const u8 wcd9360_page7_reg_access[WCD9360_PAGE_SIZE] = {
-[WCD9360_REG(WCD9360_ANA_NEW_PAGE_REGISTER)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CLK_SYS_PLL_ENABLES)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CLK_SYS_PLL_PRESET)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CLK_SYS_PLL_STATUS)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CLK_SYS_MCLK_PRG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CLK_SYS_MCLK2_PRG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CLK_SYS_MCLK_MISC)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_NEW_VOUT_A_STARTUP)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_NEW_VOUT_D_STARTUP)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_NEW_VOUT_D_FREQ1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_NEW_VOUT_D_FREQ2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_AUX_ANA_EAR)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_LDORXTX_LDORXTX)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DIE_CRACK_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DIE_CRACK_OUT)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_LOOP_BACK_EN)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CLK_SYS_INT_POST_DIV_REG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CLK_SYS_INT_POST_DIV_REG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CLK_SYS_INT_REF_DIV_REG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CLK_SYS_INT_REF_DIV_REG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CLK_SYS_INT_FILTER_REG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CLK_SYS_INT_FILTER_REG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CLK_SYS_INT_PLL_L_VAL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CLK_SYS_INT_PLL_M_VAL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CLK_SYS_INT_PLL_N_VAL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CLK_SYS_INT_TEST_REG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CLK_SYS_INT_PFD_CP_DSM_PROG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CLK_SYS_INT_VCO_PROG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CLK_SYS_INT_TEST_REG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CLK_SYS_INT_LDO_LOCK_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CLK_SYS_INT_DIG_LOCK_DET_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CLK_SYS_INT_CLK_TEST1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CLK_SYS_INT_CLK_TEST2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CLK_SYS_INT_CLK_TEST3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_NEW_INT_RAMP_STATUS)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_SIDO_NEW_INT_SPARE_1)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_SIDO_NEW_INT_DEBUG_VOUT_SETTING_A)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_NEW_INT_DEBUG_VOUT_SETTING_D)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_NEW_INT_RAMP_INC_WAIT)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_NEW_INT_DYNAMIC_IPEAK_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_NEW_INT_RAMP_IBLEED_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_NEW_INT_DEBUG_CPROVR_TEST)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_NEW_INT_RAMP_CTL_A)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_NEW_INT_RAMP_CTL_D)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_NEW_INT_RAMP_TIMEOUT_PERIOD)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_NEW_INT_DYNAMIC_IPEAK_SETTING1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_NEW_INT_DYNAMIC_IPEAK_SETTING2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_NEW_INT_DYNAMIC_IPEAK_SETTING3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_NEW_INT_HIGH_ACCU_MODE_SEL1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDO_NEW_INT_HIGH_ACCU_MODE_SEL2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_EAR_INT_NEW_EAR_CHOPPER_CON)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_EAR_INT_NEW_EAR_VCM_GEN_CON1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_EAR_INT_NEW_EAR_VCM_GEN_CON2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_EAR_INT_NEW_EAR_DYNAMIC_BIAS)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_AUX_INT_AUX_EN_REG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_AUX_INT_AUX_PA_CON)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_AUX_INT_AUX_SP_CON)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_AUX_INT_AUX_DAC_CON)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_AUX_INT_AUX_CNP_FSM_CON)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_AUX_INT_AUX_TEST)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_AUX_INT_STATUS_REG)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_AUX_INT_AUX_MISC)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_LDORXTX_INT_ANA_LDORXTX_CTRL1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_LDORXTX_INT_ANA_LDORXTX_CTRL2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_LDORXTX_INT_ANA_LDORXTX_CTRL3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_LDORXTX_INT_ANA_LDORXTX_CTRL4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_LDORXTX_INT_ANA_LDORXTX_CTRL5)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_LDORXTX_INT_ANA_LDORXTX_STATUS)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_DIE_CRACK_INT_INT1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_DIE_CRACK_INT_INT2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_LOOP_BACK_INT_SPARE)] = WCD9360_RW,
-};
-
-const u8 wcd9360_page10_reg_access[WCD9360_PAGE_SIZE] = {
-[WCD9360_REG(WCD9360_PAGE10_PAGE_REGISTER)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_ANC0_CLK_RESET_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_ANC0_MODE_1_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_ANC0_MODE_2_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_ANC0_FF_SHIFT)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_ANC0_FB_SHIFT)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_ANC0_LPF_FF_A_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_ANC0_LPF_FF_B_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_ANC0_LPF_FB_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_ANC0_SMLPF_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_ANC0_DCFLT_SHIFT_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_ANC0_IIR_ADAPT_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_ANC0_IIR_COEFF_1_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_ANC0_IIR_COEFF_2_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_ANC0_FF_A_GAIN_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_ANC0_FF_B_GAIN_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_ANC0_FB_GAIN_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX0_TX_PATH_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX0_TX_PATH_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX0_TX_PATH_CFG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX0_TX_VOL_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX0_TX_PATH_192_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX0_TX_PATH_192_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX0_TX_PATH_SEC0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX0_TX_PATH_SEC1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX0_TX_PATH_SEC2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX0_TX_PATH_SEC3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX0_TX_PATH_SEC4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX0_TX_PATH_SEC5)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX0_TX_PATH_SEC6)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX1_TX_PATH_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX1_TX_PATH_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX1_TX_PATH_CFG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX1_TX_VOL_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX1_TX_PATH_192_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX1_TX_PATH_192_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX1_TX_PATH_SEC0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX1_TX_PATH_SEC1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX1_TX_PATH_SEC2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX1_TX_PATH_SEC3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX1_TX_PATH_SEC4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX1_TX_PATH_SEC5)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX1_TX_PATH_SEC6)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX2_TX_PATH_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX2_TX_PATH_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX2_TX_PATH_CFG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX2_TX_VOL_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX2_TX_PATH_192_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX2_TX_PATH_192_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX2_TX_PATH_SEC0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX2_TX_PATH_SEC1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX2_TX_PATH_SEC2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX2_TX_PATH_SEC3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX2_TX_PATH_SEC4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX2_TX_PATH_SEC5)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX2_TX_PATH_SEC6)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX3_TX_PATH_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX3_TX_PATH_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX3_TX_PATH_CFG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX3_TX_VOL_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX3_TX_PATH_192_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX3_TX_PATH_192_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX3_TX_PATH_SEC0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX3_TX_PATH_SEC1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX3_TX_PATH_SEC2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX3_TX_PATH_SEC3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX3_TX_PATH_SEC4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX3_TX_PATH_SEC5)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX3_TX_PATH_SEC6)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX4_TX_PATH_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX4_TX_PATH_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX4_TX_PATH_CFG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX4_TX_VOL_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX4_TX_PATH_192_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX4_TX_PATH_192_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX4_TX_PATH_SEC0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX4_TX_PATH_SEC1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX4_TX_PATH_SEC2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX4_TX_PATH_SEC3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX4_TX_PATH_SEC4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX4_TX_PATH_SEC5)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX4_TX_PATH_SEC6)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX5_TX_PATH_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX5_TX_PATH_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX5_TX_PATH_CFG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX5_TX_VOL_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX5_TX_PATH_192_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX5_TX_PATH_192_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX5_TX_PATH_SEC0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX5_TX_PATH_SEC1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX5_TX_PATH_SEC2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX5_TX_PATH_SEC3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX5_TX_PATH_SEC4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX5_TX_PATH_SEC5)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX5_TX_PATH_SEC6)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX6_TX_PATH_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX6_TX_PATH_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX6_TX_PATH_CFG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX6_TX_VOL_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX6_TX_PATH_192_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX6_TX_PATH_192_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX6_TX_PATH_SEC0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX6_TX_PATH_SEC1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX6_TX_PATH_SEC2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX6_TX_PATH_SEC3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX6_TX_PATH_SEC4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX6_TX_PATH_SEC5)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX6_TX_PATH_SEC6)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX7_TX_PATH_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX7_TX_PATH_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX7_TX_PATH_CFG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX7_TX_VOL_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX7_TX_PATH_192_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX7_TX_PATH_192_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX7_TX_PATH_SEC0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX7_TX_PATH_SEC1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX7_TX_PATH_SEC2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX7_TX_PATH_SEC3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX7_TX_PATH_SEC4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX7_TX_PATH_SEC5)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX7_TX_PATH_SEC6)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX8_TX_PATH_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX8_TX_PATH_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX8_TX_PATH_CFG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX8_TX_VOL_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX8_TX_PATH_192_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX8_TX_PATH_192_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX8_TX_PATH_SEC0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX8_TX_PATH_SEC1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX8_TX_PATH_SEC2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX8_TX_PATH_SEC3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX8_TX_PATH_SEC4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX8_TX_PATH_SEC5)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX8_TX_PATH_SEC6)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX9_SPKR_PROT_PATH_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX9_SPKR_PROT_PATH_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX10_SPKR_PROT_PATH_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX10_SPKR_PROT_PATH_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX11_SPKR_PROT_PATH_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX11_SPKR_PROT_PATH_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX12_SPKR_PROT_PATH_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX12_SPKR_PROT_PATH_CFG0)] = WCD9360_RW,
-};
-
-const u8 wcd9360_page11_reg_access[WCD9360_PAGE_SIZE] = {
-[WCD9360_REG(WCD9360_PAGE11_PAGE_REGISTER)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_COMPANDER0_CTL0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_COMPANDER0_CTL1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_COMPANDER0_CTL2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_COMPANDER0_CTL3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_COMPANDER0_CTL4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_COMPANDER0_CTL5)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_COMPANDER0_CTL6)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CDC_COMPANDER0_CTL7)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_COMPANDER7_CTL0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_COMPANDER7_CTL1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_COMPANDER7_CTL2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_COMPANDER7_CTL3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_COMPANDER7_CTL4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_COMPANDER7_CTL5)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_COMPANDER7_CTL6)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CDC_COMPANDER7_CTL7)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_COMPANDER8_CTL0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_COMPANDER8_CTL1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_COMPANDER8_CTL2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_COMPANDER8_CTL3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_COMPANDER8_CTL4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_COMPANDER8_CTL5)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_COMPANDER8_CTL6)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CDC_COMPANDER8_CTL7)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX0_RX_PATH_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX0_RX_PATH_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX0_RX_PATH_CFG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX0_RX_PATH_CFG2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX0_RX_VOL_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX0_RX_PATH_MIX_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX0_RX_PATH_MIX_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX0_RX_VOL_MIX_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX0_RX_PATH_SEC0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX0_RX_PATH_SEC1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX0_RX_PATH_SEC2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX0_RX_PATH_SEC3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX0_RX_PATH_SEC5)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX0_RX_PATH_SEC6)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX0_RX_PATH_SEC7)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX0_RX_PATH_MIX_SEC0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX0_RX_PATH_MIX_SEC1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX0_RX_PATH_DSMDEM_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX9_RX_PATH_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX9_RX_PATH_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX9_RX_PATH_CFG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX9_RX_PATH_CFG2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX9_RX_VOL_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX9_RX_PATH_MIX_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX9_RX_PATH_MIX_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX9_RX_VOL_MIX_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX9_RX_PATH_SEC0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX9_RX_PATH_SEC1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX9_RX_PATH_SEC2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX9_RX_PATH_SEC3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX9_RX_PATH_SEC5)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX9_RX_PATH_SEC6)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX9_RX_PATH_SEC7)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX9_RX_PATH_MIX_SEC0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX9_RX_PATH_MIX_SEC1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX9_RX_PATH_DSMDEM_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX7_RX_PATH_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX7_RX_PATH_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX7_RX_PATH_CFG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX7_RX_PATH_CFG2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX7_RX_VOL_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX7_RX_PATH_MIX_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX7_RX_PATH_MIX_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX7_RX_VOL_MIX_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX7_RX_PATH_SEC0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX7_RX_PATH_SEC1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX7_RX_PATH_SEC2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX7_RX_PATH_SEC3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX7_RX_PATH_SEC5)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX7_RX_PATH_SEC6)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX7_RX_PATH_SEC7)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX7_RX_PATH_MIX_SEC0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX7_RX_PATH_MIX_SEC1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX7_RX_PATH_DSMDEM_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX8_RX_PATH_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX8_RX_PATH_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX8_RX_PATH_CFG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX8_RX_PATH_CFG2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX8_RX_VOL_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX8_RX_PATH_MIX_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX8_RX_PATH_MIX_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX8_RX_VOL_MIX_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX8_RX_PATH_SEC0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX8_RX_PATH_SEC1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX8_RX_PATH_SEC2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX8_RX_PATH_SEC3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX8_RX_PATH_SEC5)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX8_RX_PATH_SEC6)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX8_RX_PATH_SEC7)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX8_RX_PATH_MIX_SEC0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX8_RX_PATH_MIX_SEC1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX8_RX_PATH_DSMDEM_CTL)] = WCD9360_RW,
-};
-
-const u8 wcd9360_page12_reg_access[WCD9360_PAGE_SIZE] = {
-[WCD9360_REG(WCD9360_PAGE12_PAGE_REGISTER)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_BOOST0_BOOST_PATH_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_BOOST0_BOOST_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_BOOST0_BOOST_CFG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_BOOST0_BOOST_CFG2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_BOOST1_BOOST_PATH_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_BOOST1_BOOST_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_BOOST1_BOOST_CFG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_BOOST1_BOOST_CFG2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_MIXING_ASRC2_CLK_RST_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_MIXING_ASRC2_CTL0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_MIXING_ASRC2_CTL1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_MIXING_ASRC2_FIFO_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_MIXING_ASRC2_STATUS_FMIN_CNTR_LSB)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_MIXING_ASRC2_STATUS_FMIN_CNTR_MSB)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_MIXING_ASRC2_STATUS_FMAX_CNTR_LSB)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_MIXING_ASRC2_STATUS_FMAX_CNTR_MSB)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_MIXING_ASRC2_STATUS_FIFO)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_MIXING_ASRC3_CLK_RST_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_MIXING_ASRC3_CTL0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_MIXING_ASRC3_CTL1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_MIXING_ASRC3_FIFO_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_MIXING_ASRC3_STATUS_FMIN_CNTR_LSB)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_MIXING_ASRC3_STATUS_FMIN_CNTR_MSB)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_MIXING_ASRC3_STATUS_FMAX_CNTR_LSB)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_MIXING_ASRC3_STATUS_FMAX_CNTR_MSB)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_MIXING_ASRC3_STATUS_FIFO)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_SWR_AHB_BRIDGE_WR_DATA_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SWR_AHB_BRIDGE_WR_DATA_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SWR_AHB_BRIDGE_WR_DATA_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SWR_AHB_BRIDGE_WR_DATA_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SWR_AHB_BRIDGE_WR_ADDR_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SWR_AHB_BRIDGE_WR_ADDR_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SWR_AHB_BRIDGE_WR_ADDR_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SWR_AHB_BRIDGE_WR_ADDR_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SWR_AHB_BRIDGE_RD_ADDR_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SWR_AHB_BRIDGE_RD_ADDR_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SWR_AHB_BRIDGE_RD_ADDR_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SWR_AHB_BRIDGE_RD_ADDR_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SWR_AHB_BRIDGE_RD_DATA_0)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_SWR_AHB_BRIDGE_RD_DATA_1)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_SWR_AHB_BRIDGE_RD_DATA_2)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_SWR_AHB_BRIDGE_RD_DATA_3)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_SWR_AHB_BRIDGE_ACCESS_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SWR_AHB_BRIDGE_ACCESS_STATUS)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CDC_SIDETONE_SRC0_ST_SRC_PATH_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_SIDETONE_SRC0_ST_SRC_PATH_CFG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDETONE_ASRC0_CLK_RST_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDETONE_ASRC0_CTL0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDETONE_ASRC0_CTL1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDETONE_ASRC0_FIFO_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_SIDETONE_ASRC0_STATUS_FMIN_CNTR_LSB)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_SIDETONE_ASRC0_STATUS_FMIN_CNTR_MSB)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_SIDETONE_ASRC0_STATUS_FMAX_CNTR_LSB)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_SIDETONE_ASRC0_STATUS_FMAX_CNTR_MSB)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_SIDETONE_ASRC0_STATUS_FIFO)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EC_REF_HQ0_EC_REF_HQ_PATH_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_EC_REF_HQ0_EC_REF_HQ_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_EC_REF_HQ1_EC_REF_HQ_PATH_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_EC_REF_HQ1_EC_REF_HQ_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_EC_ASRC0_CLK_RST_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_EC_ASRC0_CTL0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_EC_ASRC0_CTL1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_EC_ASRC0_FIFO_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_EC_ASRC0_STATUS_FMIN_CNTR_LSB)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EC_ASRC0_STATUS_FMIN_CNTR_MSB)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EC_ASRC0_STATUS_FMAX_CNTR_LSB)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EC_ASRC0_STATUS_FMAX_CNTR_MSB)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EC_ASRC0_STATUS_FIFO)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EC_ASRC1_CLK_RST_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_EC_ASRC1_CTL0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_EC_ASRC1_CTL1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_EC_ASRC1_FIFO_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_EC_ASRC1_STATUS_FMIN_CNTR_LSB)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EC_ASRC1_STATUS_FMIN_CNTR_MSB)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EC_ASRC1_STATUS_FMAX_CNTR_LSB)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EC_ASRC1_STATUS_FMAX_CNTR_MSB)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_EC_ASRC1_STATUS_FIFO)] = WCD9360_RO,
-};
-
-const u8 wcd9360_page13_reg_access[WCD9360_PAGE_SIZE] = {
-[WCD9360_REG(WCD9360_PAGE13_PAGE_REGISTER)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX_INP_MUX_RX_INT0_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX_INP_MUX_RX_INT0_CFG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX_INP_MUX_RX_INT9_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX_INP_MUX_RX_INT9_CFG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX_INP_MUX_RX_INT7_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX_INP_MUX_RX_INT7_CFG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX_INP_MUX_RX_INT8_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX_INP_MUX_RX_INT8_CFG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX_INP_MUX_RX_MIX_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX_INP_MUX_RX_MIX_CFG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX_INP_MUX_RX_MIX_CFG2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX_INP_MUX_RX_MIX_CFG3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX_INP_MUX_RX_MIX_CFG4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX_INP_MUX_SIDETONE_SRC_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX_INP_MUX_SIDETONE_SRC_CFG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX_INP_MUX_ANC_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX_INP_MUX_SPLINE_ASRC_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_RX_INP_MUX_EC_REF_HQ_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX_INP_MUX_ADC_MUX0_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX_INP_MUX_ADC_MUX0_CFG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX_INP_MUX_ADC_MUX1_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX_INP_MUX_ADC_MUX1_CFG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX_INP_MUX_ADC_MUX2_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX_INP_MUX_ADC_MUX2_CFG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX_INP_MUX_ADC_MUX3_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX_INP_MUX_ADC_MUX3_CFG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX_INP_MUX_ADC_MUX4_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX_INP_MUX_ADC_MUX5_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX_INP_MUX_ADC_MUX6_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX_INP_MUX_ADC_MUX7_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX_INP_MUX_ADC_MUX8_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX_INP_MUX_ADC_MUX10_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TX_INP_MUX_ADC_MUX11_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_SIDETONE_IIR_INP_MUX_IIR0_MIX_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_SIDETONE_IIR_INP_MUX_IIR0_MIX_CFG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_SIDETONE_IIR_INP_MUX_IIR0_MIX_CFG2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_SIDETONE_IIR_INP_MUX_IIR0_MIX_CFG3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_IF_ROUTER_TX_MUX_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_IF_ROUTER_TX_MUX_CFG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_IF_ROUTER_TX_MUX_CFG2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_IF_ROUTER_TX_MUX_CFG3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_CLK_RST_CTRL_MCLK_CONTROL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_CLK_RST_CTRL_FS_CNT_CONTROL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_CLK_RST_CTRL_SWR_CONTROL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_CLK_RST_CTRL_ASRC_SHARE_CONTROL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_PROX_DETECT_PROX_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_PROX_DETECT_PROX_POLL_PERIOD0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_PROX_DETECT_PROX_POLL_PERIOD1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_PROX_DETECT_PROX_SIG_PATTERN_LSB)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_PROX_DETECT_PROX_SIG_PATTERN_MSB)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_PROX_DETECT_PROX_STATUS)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CDC_PROX_DETECT_PROX_TEST_CTRL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_PROX_DETECT_PROX_TEST_BUFF_LSB)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_PROX_DETECT_PROX_TEST_BUFF_MSB)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_PROX_DETECT_PROX_TEST_BUFF_LSB_RD)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CDC_PROX_DETECT_PROX_TEST_BUFF_MSB_RD)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CDC_PROX_DETECT_PROX_CTL_REPEAT_PAT)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_SIDETONE_IIR0_IIR_PATH_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B1_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B2_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B3_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B4_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B5_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B6_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B7_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B8_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_SIDETONE_IIR0_IIR_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_TIMER_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_SIDETONE_IIR0_IIR_COEF_B1_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TOP_TOP_CFG0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TOP_TOP_CFG1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TOP_TOP_CFG7)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TOP_EAR_COMP_WR_LSB)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TOP_EAR_COMP_WR_MSB)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TOP_EAR_COMP_LUT)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CDC_TOP_EAR_COMP_RD_LSB)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CDC_TOP_EAR_COMP_RD_MSB)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CDC_TOP_TOP_DEBUG)] = WCD9360_RW,
-};
-
-const u8 wcd9360_page80_reg_access[WCD9360_PAGE_SIZE] = {
-[WCD9360_REG(WCD9360_PAGE80_PAGE_REGISTER)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CODEC_CPR_WR_DATA_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CODEC_CPR_WR_DATA_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CODEC_CPR_WR_DATA_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CODEC_CPR_WR_DATA_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CODEC_CPR_WR_ADDR_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CODEC_CPR_WR_ADDR_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CODEC_CPR_WR_ADDR_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CODEC_CPR_WR_ADDR_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CODEC_CPR_RD_ADDR_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CODEC_CPR_RD_ADDR_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CODEC_CPR_RD_ADDR_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CODEC_CPR_RD_ADDR_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CODEC_CPR_RD_DATA_0)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CODEC_CPR_RD_DATA_1)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CODEC_CPR_RD_DATA_2)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CODEC_CPR_RD_DATA_3)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CODEC_CPR_ACCESS_CFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CODEC_CPR_ACCESS_STATUS)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CODEC_CPR_NOM_CX_VDD)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CODEC_CPR_SVS_CX_VDD)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CODEC_CPR_SVS2_CX_VDD)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CODEC_CPR_NOM_MX_VDD)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CODEC_CPR_SVS_MX_VDD)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CODEC_CPR_SVS2_MX_VDD)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CODEC_CPR_SVS2_MIN_CX_VDD)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CODEC_CPR_MAX_SVS2_STEP)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CODEC_CPR_CTL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_CODEC_CPR_SW_MODECHNG_STATUS)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_CODEC_CPR_SW_MODECHNG_START)] = WCD9360_WO,
-[WCD9360_REG(WCD9360_CODEC_CPR_CPR_STATUS)] = WCD9360_RW,
-};
-
-const u8 wcd9360_page128_reg_access[WCD9360_PAGE_SIZE] = {
-[WCD9360_REG(WCD9360_PAGE128_PAGE_REGISTER)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_JTCK_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_INTR1_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_INTR2_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_SWR_DATA_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_SWR_CLK_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_SLIMBUS_DATA1_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_SLIMBUS_DATA2_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_SLIMBUS_CLK_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_I2C_CLK_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_I2C_DATA_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_I2S_0_RX_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_I2S_0_TX_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_I2S_0_SCK_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_I2S_0_WS_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_I2S_1_RX_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_I2S_1_TX_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_I2S_1_SCK_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_I2S_1_WS_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_DMIC1_CLK_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_DMIC1_DATA_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_DMIC2_CLK_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_DMIC2_DATA_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_GPIO1_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_GPIO2_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_GPIO3_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_GPIO4_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_SPI_S_CSN_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_SPI_S_CLK_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_SPI_S_DOUT_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_SPI_S_DIN_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_GPIO0_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_DMIC3_CLK_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_DMIC3_DATA_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_DMIC4_CLK_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TLMM_DMIC4_DATA_PINCFG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_PIN_CTL_OE_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_PIN_CTL_OE_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_PIN_CTL_OE_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_PIN_CTL_OE_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_PIN_CTL_OE_4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_PIN_CTL_DATA_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_PIN_CTL_DATA_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_PIN_CTL_DATA_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_PIN_CTL_DATA_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_PIN_CTL_DATA_4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_PAD_DRVCTL_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_PAD_DRVCTL_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_PIN_STATUS)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_TEST_DEBUG_NPL_DLY_TEST_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_NPL_DLY_TEST_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_MEM_CTRL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_BUS_SEL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_JTAG)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_EN_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_EN_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_EN_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_EN_4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_EN_5)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_ANA_DTEST_DIR)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_PAD_INP_DISABLE_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_PAD_INP_DISABLE_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_PAD_INP_DISABLE_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_PAD_INP_DISABLE_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_PAD_INP_DISABLE_4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_SYSMEM_CTRL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_LVAL_NOM_LOW)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_LVAL_NOM_HIGH)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_LVAL_SVS_SVS2_LOW)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_LVAL_SVS_SVS2_HIGH)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_SPI_SLAVE_CHAR)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_CODEC_DIAGS)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_TEST_DEBUG_PAD_TEST)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_0)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_1)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_2)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_3)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_4)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_5)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_6)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_7)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_8)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_9)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_10)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_11)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_12)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_13)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_14)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_15)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_16)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_17)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_18)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_19)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_20)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_21)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_22)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_23)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_24)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_25)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_26)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_27)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_28)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_29)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_30)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_31)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_RD_CTRL)] = WCD9360_RW,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_RD_7_0)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_RD_15_8)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_RD_23_16)] = WCD9360_RO,
-[WCD9360_REG(WCD9360_TEST_DEBUG_DEBUG_MUX_RD_31_24)] = WCD9360_RO,
-
-};
-
-const u8 * const wcd9360_reg[WCD9360_PAGE_MAX] = {
-[WCD9360_PAGE_0] = wcd9360_page0_reg_access,
-[WCD9360_PAGE_1] = wcd9360_page1_reg_access,
-[WCD9360_PAGE_2] = wcd9360_page2_reg_access,
-[WCD9360_PAGE_4] = wcd9360_page4_reg_access,
-[WCD9360_PAGE_6] = wcd9360_page6_reg_access,
-[WCD9360_PAGE_7] = wcd9360_page7_reg_access,
-[WCD9360_PAGE_10] = wcd9360_page10_reg_access,
-[WCD9360_PAGE_11] = wcd9360_page11_reg_access,
-[WCD9360_PAGE_12] = wcd9360_page12_reg_access,
-[WCD9360_PAGE_13] = wcd9360_page13_reg_access,
-[WCD9360_PAGE_80] = wcd9360_page80_reg_access,
-[WCD9360_PAGE_128] = wcd9360_page128_reg_access,
-};
-
-#endif
diff --git a/asoc/codecs/wcd9360/wcd9360-dsp-cntl.c b/asoc/codecs/wcd9360/wcd9360-dsp-cntl.c
deleted file mode 100644
index 37536f8..0000000
--- a/asoc/codecs/wcd9360/wcd9360-dsp-cntl.c
+++ /dev/null
@@ -1,1357 +0,0 @@
-/*
- * Copyright (c) 2016-2018, 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.
- */
-
-#include <linux/slab.h>
-#include <linux/delay.h>
-#include <linux/component.h>
-#include <linux/debugfs.h>
-#include <sound/soc.h>
-#include <sound/wcd-dsp-mgr.h>
-#include <asoc/wcd9360-registers.h>
-#include "wcd9360.h"
-#include "wcd9360-dsp-cntl.h"
-#include "../wcd9xxx-irq.h"
-#include "../core.h"
-
-#define WCD_CNTL_DIR_NAME_LEN_MAX 32
-#define WCD_CPE_FLL_MAX_RETRIES 5
-#define WCD_MEM_ENABLE_MAX_RETRIES 20
-#define WCD_DSP_BOOT_TIMEOUT_MS 3000
-#define WCD_SYSFS_ENTRY_MAX_LEN 8
-#define WCD_PROCFS_ENTRY_MAX_LEN 16
-#define WCD_9360_RAMDUMP_START_ADDR 0x20100000
-#define WCD_9360_RAMDUMP_SIZE ((1024 * 1024) - 128)
-#define WCD_MISCDEV_CMD_MAX_LEN 2
-
-#define WCD_CNTL_MUTEX_LOCK(codec, lock) \
-{ \
- dev_dbg(codec->dev, "%s: mutex_lock(%s)\n", \
- __func__, __stringify_1(lock)); \
- mutex_lock(&lock); \
-}
-
-#define WCD_CNTL_MUTEX_UNLOCK(codec, lock) \
-{ \
- dev_dbg(codec->dev, "%s: mutex_unlock(%s)\n", \
- __func__, __stringify_1(lock)); \
- mutex_unlock(&lock); \
-}
-
-enum wcd_mem_type {
- WCD_MEM_TYPE_ALWAYS_ON,
- WCD_MEM_TYPE_SWITCHABLE,
-};
-
-struct wcd_cntl_attribute {
- struct attribute attr;
- ssize_t (*show)(struct wcd_dsp_cntl *cntl, char *buf);
- ssize_t (*store)(struct wcd_dsp_cntl *cntl, const char *buf,
- ssize_t count);
-};
-
-#define WCD_CNTL_ATTR(_name, _mode, _show, _store) \
-static struct wcd_cntl_attribute cntl_attr_##_name = { \
- .attr = {.name = __stringify(_name), .mode = _mode}, \
- .show = _show, \
- .store = _store, \
-}
-
-#define to_wcd_cntl_attr(a) \
- container_of((a), struct wcd_cntl_attribute, attr)
-
-#define to_wcd_cntl(kobj) \
- container_of((kobj), struct wcd_dsp_cntl, wcd_kobj)
-
-static u8 mem_enable_values[] = {
- 0xFE, 0xFC, 0xF8, 0xF0,
- 0xE0, 0xC0, 0x80, 0x00,
-};
-
-static ssize_t wdsp_boot_show(struct wcd_dsp_cntl *cntl, char *buf)
-{
- return snprintf(buf, WCD_SYSFS_ENTRY_MAX_LEN,
- "%u", cntl->boot_reqs);
-}
-
-static ssize_t wdsp_boot_store(struct wcd_dsp_cntl *cntl,
- const char *buf, ssize_t count)
-{
- u32 val;
- bool vote;
- int ret;
-
- ret = kstrtou32(buf, 10, &val);
- if (ret) {
- dev_err(cntl->codec->dev,
- "%s: Invalid entry, ret = %d\n", __func__, ret);
- return -EINVAL;
- }
-
- if (val > 0) {
- cntl->boot_reqs++;
- vote = true;
- } else {
- cntl->boot_reqs--;
- vote = false;
- }
-
- if (cntl->m_dev && cntl->m_ops &&
- cntl->m_ops->vote_for_dsp)
- ret = cntl->m_ops->vote_for_dsp(cntl->m_dev, vote);
- else
- ret = -EINVAL;
-
- if (ret < 0)
- dev_err(cntl->codec->dev,
- "%s: failed to %s dsp\n", __func__,
- vote ? "enable" : "disable");
- return count;
-}
-
-WCD_CNTL_ATTR(boot, 0660, wdsp_boot_show, wdsp_boot_store);
-
-static ssize_t wcd_cntl_sysfs_show(struct kobject *kobj,
- struct attribute *attr, char *buf)
-{
- struct wcd_cntl_attribute *wcd_attr = to_wcd_cntl_attr(attr);
- struct wcd_dsp_cntl *cntl = to_wcd_cntl(kobj);
- ssize_t ret = -EINVAL;
-
- if (cntl && wcd_attr->show)
- ret = wcd_attr->show(cntl, buf);
-
- return ret;
-}
-
-static ssize_t wcd_cntl_sysfs_store(struct kobject *kobj,
- struct attribute *attr, const char *buf,
- size_t count)
-{
- struct wcd_cntl_attribute *wcd_attr = to_wcd_cntl_attr(attr);
- struct wcd_dsp_cntl *cntl = to_wcd_cntl(kobj);
- ssize_t ret = -EINVAL;
-
- if (cntl && wcd_attr->store)
- ret = wcd_attr->store(cntl, buf, count);
-
- return ret;
-}
-
-static const struct sysfs_ops wcd_cntl_sysfs_ops = {
- .show = wcd_cntl_sysfs_show,
- .store = wcd_cntl_sysfs_store,
-};
-
-static struct kobj_type wcd_cntl_ktype = {
- .sysfs_ops = &wcd_cntl_sysfs_ops,
-};
-
-static void wcd_cntl_change_online_state(struct wcd_dsp_cntl *cntl,
- u8 online)
-{
- struct wdsp_ssr_entry *ssr_entry = &cntl->ssr_entry;
- unsigned long ret;
-
- WCD_CNTL_MUTEX_LOCK(cntl->codec, cntl->ssr_mutex);
- ssr_entry->offline = !online;
- /* Make sure the write is complete */
- wmb();
- ret = xchg(&ssr_entry->offline_change, 1);
- wake_up_interruptible(&ssr_entry->offline_poll_wait);
- dev_dbg(cntl->codec->dev,
- "%s: requested %u, offline %u offline_change %u, ret = %ldn",
- __func__, online, ssr_entry->offline,
- ssr_entry->offline_change, ret);
- WCD_CNTL_MUTEX_UNLOCK(cntl->codec, cntl->ssr_mutex);
-}
-
-static ssize_t wdsp_ssr_entry_read(struct snd_info_entry *entry,
- void *file_priv_data, struct file *file,
- char __user *buf, size_t count, loff_t pos)
-{
- int len = 0;
- char buffer[WCD_PROCFS_ENTRY_MAX_LEN];
- struct wcd_dsp_cntl *cntl;
- struct wdsp_ssr_entry *ssr_entry;
- ssize_t ret;
- u8 offline;
-
- cntl = (struct wcd_dsp_cntl *) entry->private_data;
- if (!cntl) {
- pr_err("%s: Invalid private data for SSR procfs entry\n",
- __func__);
- return -EINVAL;
- }
-
- ssr_entry = &cntl->ssr_entry;
-
- WCD_CNTL_MUTEX_LOCK(cntl->codec, cntl->ssr_mutex);
- offline = ssr_entry->offline;
- /* Make sure the read is complete */
- rmb();
- dev_dbg(cntl->codec->dev, "%s: offline = %s\n", __func__,
- offline ? "true" : "false");
- len = snprintf(buffer, sizeof(buffer), "%s\n",
- offline ? "OFFLINE" : "ONLINE");
- ret = simple_read_from_buffer(buf, count, &pos, buffer, len);
- WCD_CNTL_MUTEX_UNLOCK(cntl->codec, cntl->ssr_mutex);
-
- return ret;
-}
-
-static unsigned int wdsp_ssr_entry_poll(struct snd_info_entry *entry,
- void *private_data, struct file *file,
- poll_table *wait)
-{
- struct wcd_dsp_cntl *cntl;
- struct wdsp_ssr_entry *ssr_entry;
- unsigned int ret = 0;
-
- if (!entry || !entry->private_data) {
- pr_err("%s: %s is NULL\n", __func__,
- (!entry) ? "entry" : "private_data");
- return -EINVAL;
- }
-
- cntl = (struct wcd_dsp_cntl *) entry->private_data;
- ssr_entry = &cntl->ssr_entry;
-
- dev_dbg(cntl->codec->dev, "%s: Poll wait, offline = %u\n",
- __func__, ssr_entry->offline);
- poll_wait(file, &ssr_entry->offline_poll_wait, wait);
- dev_dbg(cntl->codec->dev, "%s: Woken up Poll wait, offline = %u\n",
- __func__, ssr_entry->offline);
-
- WCD_CNTL_MUTEX_LOCK(cntl->codec, cntl->ssr_mutex);
- if (xchg(&ssr_entry->offline_change, 0))
- ret = POLLIN | POLLPRI | POLLRDNORM;
- dev_dbg(cntl->codec->dev, "%s: ret (%d) from poll_wait\n",
- __func__, ret);
- WCD_CNTL_MUTEX_UNLOCK(cntl->codec, cntl->ssr_mutex);
-
- return ret;
-}
-
-static struct snd_info_entry_ops wdsp_ssr_entry_ops = {
- .read = wdsp_ssr_entry_read,
- .poll = wdsp_ssr_entry_poll,
-};
-
-static int wcd_cntl_cpe_fll_calibrate(struct wcd_dsp_cntl *cntl)
-{
- struct snd_soc_codec *codec = cntl->codec;
- int ret = 0, retry = 0;
- u8 cal_lsb, cal_msb;
- u8 lock_det;
-
- /* Make sure clocks are gated */
- snd_soc_update_bits(codec, WCD9360_CPE_SS_CPE_CTL,
- 0x05, 0x00);
-
- /* Enable CPE FLL reference clock */
- snd_soc_update_bits(codec, WCD9360_CLK_SYS_MCLK2_PRG1,
- 0x80, 0x80);
-
- snd_soc_update_bits(codec, WCD9360_CPE_FLL_USER_CTL_5,
- 0xF3, 0x13);
- snd_soc_write(codec, WCD9360_CPE_FLL_L_VAL_CTL_0, 0x50);
-
- /* Disable CPAR reset and Enable CPAR clk */
- snd_soc_update_bits(codec, WCD9360_CPE_SS_CPAR_CTL,
- 0x02, 0x02);
-
- /* Write calibration l-value based on cdc clk rate */
- if (cntl->clk_rate == 9600000) {
- cal_lsb = 0x6d;
- cal_msb = 0x00;
- } else {
- cal_lsb = 0x56;
- cal_msb = 0x00;
- }
- snd_soc_write(codec, WCD9360_CPE_FLL_USER_CTL_6, cal_lsb);
- snd_soc_write(codec, WCD9360_CPE_FLL_USER_CTL_7, cal_msb);
-
- /* FLL mode to follow power up sequence */
- snd_soc_update_bits(codec, WCD9360_CPE_FLL_FLL_MODE,
- 0x60, 0x00);
-
- /* HW controlled CPE FLL */
- snd_soc_update_bits(codec, WCD9360_CPE_FLL_FLL_MODE,
- 0x80, 0x80);
-
- /* Force on CPE FLL */
- snd_soc_update_bits(codec, WCD9360_CPE_SS_CPAR_CFG,
- 0x04, 0x04);
-
- do {
- /* Time for FLL calibration to complete */
- usleep_range(1000, 1100);
- lock_det = snd_soc_read(codec, WCD9360_CPE_FLL_STATUS_3);
- retry++;
- } while (!(lock_det & 0x01) &&
- retry <= WCD_CPE_FLL_MAX_RETRIES);
-
- if (!(lock_det & 0x01)) {
- dev_err(codec->dev, "%s: lock detect not set, 0x%02x\n",
- __func__, lock_det);
- ret = -EIO;
- goto err_lock_det;
- }
-
- snd_soc_update_bits(codec, WCD9360_CPE_FLL_FLL_MODE,
- 0x60, 0x20);
- snd_soc_update_bits(codec, WCD9360_CPE_SS_CPAR_CFG,
- 0x04, 0x00);
- return ret;
-
-err_lock_det:
- /* Undo the register settings */
- snd_soc_update_bits(codec, WCD9360_CPE_SS_CPAR_CFG,
- 0x04, 0x00);
- snd_soc_update_bits(codec, WCD9360_CPE_FLL_FLL_MODE,
- 0x80, 0x00);
- snd_soc_update_bits(codec, WCD9360_CPE_SS_CPAR_CTL,
- 0x02, 0x00);
- return ret;
-}
-
-static void wcd_cntl_config_cpar(struct wcd_dsp_cntl *cntl)
-{
- struct snd_soc_codec *codec = cntl->codec;
- u8 nom_lo, nom_hi, svs2_lo, svs2_hi;
-
- /* Configure CPAR */
- nom_hi = svs2_hi = 0;
- if (cntl->clk_rate == 9600000) {
- nom_lo = 0x90;
- svs2_lo = 0x50;
- } else {
- nom_lo = 0x70;
- svs2_lo = 0x3e;
- }
-
- snd_soc_write(codec, WCD9360_TEST_DEBUG_LVAL_NOM_LOW, nom_lo);
- snd_soc_write(codec, WCD9360_TEST_DEBUG_LVAL_NOM_HIGH, nom_hi);
- snd_soc_write(codec, WCD9360_TEST_DEBUG_LVAL_SVS_SVS2_LOW, svs2_lo);
- snd_soc_write(codec, WCD9360_TEST_DEBUG_LVAL_SVS_SVS2_HIGH, svs2_hi);
-
- snd_soc_update_bits(codec, WCD9360_CPE_SS_PWR_CPEFLL_CTL,
- 0x03, 0x03);
-}
-
-static int wcd_cntl_cpe_fll_ctrl(struct wcd_dsp_cntl *cntl,
- bool enable)
-{
- struct snd_soc_codec *codec = cntl->codec;
- int ret = 0;
-
- if (enable) {
- ret = wcd_cntl_cpe_fll_calibrate(cntl);
- if (ret < 0) {
- dev_err(codec->dev,
- "%s: cpe_fll_cal failed, err = %d\n",
- __func__, ret);
- goto done;
- }
-
- wcd_cntl_config_cpar(cntl);
-
- /* Enable AHB CLK and CPE CLK*/
- snd_soc_update_bits(codec, WCD9360_CPE_SS_CPE_CTL,
- 0x05, 0x05);
- } else {
- /* Disable AHB CLK and CPE CLK */
- snd_soc_update_bits(codec, WCD9360_CPE_SS_CPE_CTL,
- 0x05, 0x00);
- /* Reset the CPAR mode for CPE FLL */
- snd_soc_write(codec, WCD9360_CPE_FLL_FLL_MODE, 0x20);
- snd_soc_update_bits(codec, WCD9360_CPE_SS_CPAR_CFG,
- 0x04, 0x00);
- snd_soc_update_bits(codec, WCD9360_CPE_SS_CPAR_CTL,
- 0x02, 0x00);
- }
-done:
- return ret;
-}
-
-static int wcd_cntl_clocks_enable(struct wcd_dsp_cntl *cntl)
-{
- struct snd_soc_codec *codec = cntl->codec;
- int ret;
-
- WCD_CNTL_MUTEX_LOCK(codec, cntl->clk_mutex);
- /* Enable codec clock */
- if (cntl->cdc_cb && cntl->cdc_cb->cdc_clk_en)
- ret = cntl->cdc_cb->cdc_clk_en(codec, true);
- else
- ret = -EINVAL;
-
- if (ret < 0) {
- dev_err(codec->dev,
- "%s: Failed to enable cdc clk, err = %d\n",
- __func__, ret);
- goto done;
- }
- /* Pull CPAR out of reset */
- snd_soc_update_bits(codec, WCD9360_CPE_SS_CPAR_CTL, 0x04, 0x00);
-
- /* Configure and Enable CPE FLL clock */
- ret = wcd_cntl_cpe_fll_ctrl(cntl, true);
- if (ret < 0) {
- dev_err(codec->dev,
- "%s: Failed to enable cpe clk, err = %d\n",
- __func__, ret);
- goto err_cpe_clk;
- }
- cntl->is_clk_enabled = true;
-
- /* Ungate the CPR clock */
- snd_soc_update_bits(codec, WCD9360_CODEC_RPM_CLK_GATE, 0x10, 0x00);
-done:
- WCD_CNTL_MUTEX_UNLOCK(codec, cntl->clk_mutex);
- return ret;
-
-err_cpe_clk:
- if (cntl->cdc_cb && cntl->cdc_cb->cdc_clk_en)
- cntl->cdc_cb->cdc_clk_en(codec, false);
-
- snd_soc_update_bits(codec, WCD9360_CPE_SS_CPAR_CTL, 0x04, 0x04);
- WCD_CNTL_MUTEX_UNLOCK(codec, cntl->clk_mutex);
- return ret;
-}
-
-static int wcd_cntl_clocks_disable(struct wcd_dsp_cntl *cntl)
-{
- struct snd_soc_codec *codec = cntl->codec;
- int ret = 0;
-
- WCD_CNTL_MUTEX_LOCK(codec, cntl->clk_mutex);
- if (!cntl->is_clk_enabled) {
- dev_info(codec->dev, "%s: clocks already disabled\n",
- __func__);
- goto done;
- }
-
- /* Gate the CPR clock */
- snd_soc_update_bits(codec, WCD9360_CODEC_RPM_CLK_GATE, 0x10, 0x10);
-
- /* Disable CPE FLL clock */
- ret = wcd_cntl_cpe_fll_ctrl(cntl, false);
- if (ret < 0)
- dev_err(codec->dev,
- "%s: Failed to disable cpe clk, err = %d\n",
- __func__, ret);
-
- /*
- * Even if CPE FLL disable failed, go ahead and disable
- * the codec clock
- */
- if (cntl->cdc_cb && cntl->cdc_cb->cdc_clk_en)
- ret = cntl->cdc_cb->cdc_clk_en(codec, false);
- else
- ret = -EINVAL;
-
- cntl->is_clk_enabled = false;
-
- /* Put CPAR in reset */
- snd_soc_update_bits(codec, WCD9360_CPE_SS_CPAR_CTL, 0x04, 0x04);
-done:
- WCD_CNTL_MUTEX_UNLOCK(codec, cntl->clk_mutex);
- return ret;
-}
-
-static void wcd_cntl_cpar_ctrl(struct wcd_dsp_cntl *cntl,
- bool enable)
-{
- struct snd_soc_codec *codec = cntl->codec;
-
- if (enable)
- snd_soc_update_bits(codec, WCD9360_CPE_SS_CPAR_CTL, 0x03, 0x03);
- else
- snd_soc_update_bits(codec, WCD9360_CPE_SS_CPAR_CTL, 0x03, 0x00);
-}
-
-static int wcd_cntl_enable_memory(struct wcd_dsp_cntl *cntl,
- enum wcd_mem_type mem_type)
-{
- struct snd_soc_codec *codec = cntl->codec;
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
- int loop_cnt = 0;
- u8 status = 0;
- int ret = 0;
-
-
- switch (mem_type) {
-
- case WCD_MEM_TYPE_ALWAYS_ON:
-
- /* 512KB of always on region */
- wcd9xxx_slim_write_repeat(wcd9xxx,
- WCD9360_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_0,
- ARRAY_SIZE(mem_enable_values),
- mem_enable_values);
- wcd9xxx_slim_write_repeat(wcd9xxx,
- WCD9360_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_1,
- ARRAY_SIZE(mem_enable_values),
- mem_enable_values);
- break;
-
- case WCD_MEM_TYPE_SWITCHABLE:
-
- snd_soc_update_bits(codec, WCD9360_TEST_DEBUG_MEM_CTRL,
- 0x80, 0x80);
- do {
- loop_cnt++;
- /* Time to enable the power domain for memory */
- usleep_range(100, 150);
- } while ((status & 0x02) != 0x02 &&
- loop_cnt != WCD_MEM_ENABLE_MAX_RETRIES);
-
- if ((status & 0x02) != 0x02) {
- dev_err(cntl->codec->dev,
- "%s: power domain not enabled, status = 0x%02x\n",
- __func__, status);
- ret = -EIO;
- goto done;
- }
-
- /* Rest of the memory */
- wcd9xxx_slim_write_repeat(wcd9xxx,
- WCD9360_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_2,
- ARRAY_SIZE(mem_enable_values),
- mem_enable_values);
- wcd9xxx_slim_write_repeat(wcd9xxx,
- WCD9360_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_3,
- ARRAY_SIZE(mem_enable_values),
- mem_enable_values);
-
- snd_soc_write(codec, WCD9360_CPE_SS_PWR_CPE_DRAM1_SHUTDOWN,
- 0x05);
- break;
-
- default:
- dev_err(cntl->codec->dev, "%s: Invalid mem_type %d\n",
- __func__, mem_type);
- ret = -EINVAL;
- break;
- }
-done:
- /* Make sure Deep sleep of memories is enabled for all banks */
- snd_soc_write(codec, WCD9360_CPE_SS_PWR_CPE_SYSMEM_DEEPSLP_0, 0xFF);
- snd_soc_write(codec, WCD9360_CPE_SS_PWR_CPE_SYSMEM_DEEPSLP_1, 0x0F);
-
- return ret;
-}
-
-static void wcd_cntl_disable_memory(struct wcd_dsp_cntl *cntl,
- enum wcd_mem_type mem_type)
-{
- struct snd_soc_codec *codec = cntl->codec;
-
- switch (mem_type) {
- case WCD_MEM_TYPE_ALWAYS_ON:
- snd_soc_write(codec, WCD9360_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_1,
- 0xFF);
- snd_soc_write(codec, WCD9360_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_0,
- 0xFF);
- break;
- case WCD_MEM_TYPE_SWITCHABLE:
- snd_soc_write(codec, WCD9360_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_3,
- 0xFF);
- snd_soc_write(codec, WCD9360_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_2,
- 0xFF);
- snd_soc_write(codec, WCD9360_CPE_SS_PWR_CPE_DRAM1_SHUTDOWN,
- 0x07);
-
- snd_soc_update_bits(codec, WCD9360_TEST_DEBUG_MEM_CTRL,
- 0x80, 0x00);
- break;
- default:
- dev_err(cntl->codec->dev, "%s: Invalid mem_type %d\n",
- __func__, mem_type);
- break;
- }
-
- snd_soc_write(codec, WCD9360_CPE_SS_PWR_CPE_SYSMEM_DEEPSLP_0, 0xFF);
- snd_soc_write(codec, WCD9360_CPE_SS_PWR_CPE_SYSMEM_DEEPSLP_1, 0x0F);
-}
-
-static void wcd_cntl_do_shutdown(struct wcd_dsp_cntl *cntl)
-{
- struct snd_soc_codec *codec = cntl->codec;
-
- /* Disable WDOG */
- snd_soc_update_bits(codec, WCD9360_CPE_SS_WDOG_CFG,
- 0x3F, 0x01);
-
- /* Put WDSP in reset state */
- snd_soc_update_bits(codec, WCD9360_CPE_SS_CPE_CTL,
- 0x02, 0x00);
-
- /* If DSP transitions from boot to shutdown, then vote for SVS */
- if (cntl->is_wdsp_booted)
- cntl->cdc_cb->cdc_vote_svs(codec, true);
- cntl->is_wdsp_booted = false;
-}
-
-static int wcd_cntl_do_boot(struct wcd_dsp_cntl *cntl)
-{
- struct snd_soc_codec *codec = cntl->codec;
- int ret = 0;
-
- /*
- * Debug mode is set from debugfs file node. If debug_mode
- * is set, then do not configure the watchdog timer. This
- * will be required for debugging the DSP firmware.
- */
- if (cntl->debug_mode) {
- snd_soc_update_bits(codec, WCD9360_CPE_SS_WDOG_CFG,
- 0x3F, 0x01);
- } else {
- snd_soc_update_bits(codec, WCD9360_CPE_SS_WDOG_CFG,
- 0x3F, 0x21);
- }
-
- /* Make sure all the error interrupts are cleared */
- snd_soc_write(codec, WCD9360_CPE_SS_SS_ERROR_INT_CLEAR_0A, 0xFF);
- snd_soc_write(codec, WCD9360_CPE_SS_SS_ERROR_INT_CLEAR_0B, 0xFF);
-
- reinit_completion(&cntl->boot_complete);
-
- /* Remove WDSP out of reset */
- snd_soc_update_bits(codec, WCD9360_CPE_SS_CPE_CTL,
- 0x02, 0x02);
-
- /*
- * In debug mode, DSP may not boot up normally,
- * wait indefinitely for DSP to boot.
- */
- if (cntl->debug_mode) {
- wait_for_completion(&cntl->boot_complete);
- dev_dbg(codec->dev, "%s: WDSP booted in dbg mode\n", __func__);
- cntl->is_wdsp_booted = true;
- goto done;
- }
-
- /* Boot in normal mode */
- ret = wait_for_completion_timeout(&cntl->boot_complete,
- msecs_to_jiffies(WCD_DSP_BOOT_TIMEOUT_MS));
- if (!ret) {
- dev_err(codec->dev, "%s: WDSP boot timed out\n",
- __func__);
- ret = -ETIMEDOUT;
- goto err_boot;
- } else {
- /*
- * Re-initialize the return code to 0, as in success case,
- * it will hold the remaining time for completion timeout
- */
- ret = 0;
- }
-
- dev_dbg(codec->dev, "%s: WDSP booted in normal mode\n", __func__);
- cntl->is_wdsp_booted = true;
-
- /* Enable WDOG */
- snd_soc_update_bits(codec, WCD9360_CPE_SS_WDOG_CFG,
- 0x10, 0x10);
-done:
- /* If dsp booted up, then remove vote on SVS */
- if (cntl->is_wdsp_booted)
- cntl->cdc_cb->cdc_vote_svs(codec, false);
-
- return ret;
-err_boot:
- /* call shutdown to perform cleanup */
- wcd_cntl_do_shutdown(cntl);
- return ret;
-}
-
-static irqreturn_t wcd_cntl_ipc_irq(int irq, void *data)
-{
- struct wcd_dsp_cntl *cntl = data;
- int ret;
-
- complete(&cntl->boot_complete);
-
- if (cntl->m_dev && cntl->m_ops &&
- cntl->m_ops->signal_handler)
- ret = cntl->m_ops->signal_handler(cntl->m_dev, WDSP_IPC1_INTR,
- NULL);
- else
- ret = -EINVAL;
-
- if (ret < 0)
- dev_err(cntl->codec->dev,
- "%s: Failed to handle irq %d\n", __func__, irq);
-
- return IRQ_HANDLED;
-}
-
-static irqreturn_t wcd_cntl_err_irq(int irq, void *data)
-{
- struct wcd_dsp_cntl *cntl = data;
- struct snd_soc_codec *codec = cntl->codec;
- struct wdsp_err_signal_arg arg;
- u16 status = 0;
- u8 reg_val;
- int ret = 0;
-
- reg_val = snd_soc_read(codec, WCD9360_CPE_SS_SS_ERROR_INT_STATUS_0A);
- status = status | reg_val;
-
- reg_val = snd_soc_read(codec, WCD9360_CPE_SS_SS_ERROR_INT_STATUS_0B);
- status = status | (reg_val << 8);
-
- dev_info(codec->dev, "%s: error interrupt status = 0x%x\n",
- __func__, status);
-
- if ((status & cntl->irqs.fatal_irqs) &&
- (cntl->m_dev && cntl->m_ops && cntl->m_ops->signal_handler)) {
- arg.mem_dumps_enabled = cntl->ramdump_enable;
- arg.remote_start_addr = WCD_9360_RAMDUMP_START_ADDR;
- arg.dump_size = WCD_9360_RAMDUMP_SIZE;
- ret = cntl->m_ops->signal_handler(cntl->m_dev, WDSP_ERR_INTR,
- &arg);
- if (ret < 0)
- dev_err(cntl->codec->dev,
- "%s: Failed to handle fatal irq 0x%x\n",
- __func__, status & cntl->irqs.fatal_irqs);
- wcd_cntl_change_online_state(cntl, 0);
- } else {
- dev_err(cntl->codec->dev, "%s: Invalid signal_handler\n",
- __func__);
- }
-
- return IRQ_HANDLED;
-}
-
-static int wcd_control_handler(struct device *dev, void *priv_data,
- enum wdsp_event_type event, void *data)
-{
- struct wcd_dsp_cntl *cntl = priv_data;
- struct snd_soc_codec *codec = cntl->codec;
- int ret = 0;
-
- switch (event) {
- case WDSP_EVENT_POST_INIT:
- case WDSP_EVENT_POST_DLOAD_CODE:
- case WDSP_EVENT_DLOAD_FAILED:
- case WDSP_EVENT_POST_SHUTDOWN:
-
- /* Disable CPAR */
- wcd_cntl_cpar_ctrl(cntl, false);
- /* Disable all the clocks */
- ret = wcd_cntl_clocks_disable(cntl);
- if (ret < 0)
- dev_err(codec->dev,
- "%s: Failed to disable clocks, err = %d\n",
- __func__, ret);
-
- if (event == WDSP_EVENT_POST_DLOAD_CODE)
- /* Mark DSP online since code download is complete */
- wcd_cntl_change_online_state(cntl, 1);
- break;
-
- case WDSP_EVENT_PRE_DLOAD_DATA:
- case WDSP_EVENT_PRE_DLOAD_CODE:
-
- /* Enable all the clocks */
- ret = wcd_cntl_clocks_enable(cntl);
- if (ret < 0) {
- dev_err(codec->dev,
- "%s: Failed to enable clocks, err = %d\n",
- __func__, ret);
- goto done;
- }
-
- /* Enable CPAR */
- wcd_cntl_cpar_ctrl(cntl, true);
-
- if (event == WDSP_EVENT_PRE_DLOAD_CODE)
- wcd_cntl_enable_memory(cntl, WCD_MEM_TYPE_ALWAYS_ON);
- else if (event == WDSP_EVENT_PRE_DLOAD_DATA)
- wcd_cntl_enable_memory(cntl, WCD_MEM_TYPE_SWITCHABLE);
- break;
-
- case WDSP_EVENT_DO_BOOT:
-
- ret = wcd_cntl_do_boot(cntl);
- if (ret < 0)
- dev_err(codec->dev,
- "%s: WDSP boot failed, err = %d\n",
- __func__, ret);
- break;
-
- case WDSP_EVENT_DO_SHUTDOWN:
-
- wcd_cntl_do_shutdown(cntl);
- wcd_cntl_disable_memory(cntl, WCD_MEM_TYPE_SWITCHABLE);
- break;
-
- default:
- dev_dbg(codec->dev, "%s: unhandled event %d\n",
- __func__, event);
- }
-
-done:
- return ret;
-}
-
-static int wcd_cntl_sysfs_init(char *dir, struct wcd_dsp_cntl *cntl)
-{
- struct snd_soc_codec *codec = cntl->codec;
- int ret = 0;
-
- ret = kobject_init_and_add(&cntl->wcd_kobj, &wcd_cntl_ktype,
- kernel_kobj, dir);
- if (ret < 0) {
- dev_err(codec->dev,
- "%s: Failed to add kobject %s, err = %d\n",
- __func__, dir, ret);
- goto done;
- }
-
- ret = sysfs_create_file(&cntl->wcd_kobj, &cntl_attr_boot.attr);
- if (ret < 0) {
- dev_err(codec->dev,
- "%s: Failed to add wdsp_boot sysfs entry to %s\n",
- __func__, dir);
- goto fail_create_file;
- }
-
- return ret;
-
-fail_create_file:
- kobject_put(&cntl->wcd_kobj);
-done:
- return ret;
-}
-
-static void wcd_cntl_sysfs_remove(struct wcd_dsp_cntl *cntl)
-{
- sysfs_remove_file(&cntl->wcd_kobj, &cntl_attr_boot.attr);
- kobject_put(&cntl->wcd_kobj);
-}
-
-static void wcd_cntl_debugfs_init(char *dir, struct wcd_dsp_cntl *cntl)
-{
- struct snd_soc_codec *codec = cntl->codec;
-
- cntl->entry = debugfs_create_dir(dir, NULL);
- if (IS_ERR_OR_NULL(dir)) {
- dev_err(codec->dev, "%s debugfs_create_dir failed for %s\n",
- __func__, dir);
- goto done;
- }
-
- debugfs_create_u32("debug_mode", 0644,
- cntl->entry, &cntl->debug_mode);
- debugfs_create_bool("ramdump_enable", 0644,
- cntl->entry, &cntl->ramdump_enable);
-done:
- return;
-}
-
-static void wcd_cntl_debugfs_remove(struct wcd_dsp_cntl *cntl)
-{
- if (cntl)
- debugfs_remove(cntl->entry);
-}
-
-static int wcd_miscdev_release(struct inode *inode, struct file *filep)
-{
- struct wcd_dsp_cntl *cntl = container_of(filep->private_data,
- struct wcd_dsp_cntl, miscdev);
- if (!cntl->m_dev || !cntl->m_ops ||
- !cntl->m_ops->vote_for_dsp) {
- dev_err(cntl->codec->dev,
- "%s: DSP not ready to boot\n", __func__);
- return -EINVAL;
- }
-
- /* Make sure the DSP users goes to zero upon closing dev node */
- while (cntl->boot_reqs > 0) {
- cntl->m_ops->vote_for_dsp(cntl->m_dev, false);
- cntl->boot_reqs--;
- }
-
- return 0;
-}
-
-static ssize_t wcd_miscdev_write(struct file *filep, const char __user *ubuf,
- size_t count, loff_t *pos)
-{
- struct wcd_dsp_cntl *cntl = container_of(filep->private_data,
- struct wcd_dsp_cntl, miscdev);
- char val[WCD_MISCDEV_CMD_MAX_LEN + 1];
- bool vote;
- int ret = 0;
-
- memset(val, 0, WCD_MISCDEV_CMD_MAX_LEN + 1);
-
- if (count == 0 || count > WCD_MISCDEV_CMD_MAX_LEN) {
- pr_err("%s: Invalid count = %zd\n", __func__, count);
- ret = -EINVAL;
- goto done;
- }
-
- ret = copy_from_user(val, ubuf, count);
- if (ret < 0) {
- dev_err(cntl->codec->dev,
- "%s: copy_from_user failed, err = %d\n",
- __func__, ret);
- ret = -EFAULT;
- goto done;
- }
-
- if (val[0] == '1') {
- cntl->boot_reqs++;
- vote = true;
- } else if (val[0] == '0') {
- if (cntl->boot_reqs == 0) {
- dev_err(cntl->codec->dev,
- "%s: WDSP already disabled\n", __func__);
- ret = -EINVAL;
- goto done;
- }
- cntl->boot_reqs--;
- vote = false;
- } else {
- dev_err(cntl->codec->dev, "%s: Invalid value %s\n",
- __func__, val);
- ret = -EINVAL;
- goto done;
- }
-
- dev_dbg(cntl->codec->dev,
- "%s: booted = %s, ref_cnt = %d, vote = %s\n",
- __func__, cntl->is_wdsp_booted ? "true" : "false",
- cntl->boot_reqs, vote ? "true" : "false");
-
- if (cntl->m_dev && cntl->m_ops &&
- cntl->m_ops->vote_for_dsp)
- ret = cntl->m_ops->vote_for_dsp(cntl->m_dev, vote);
- else
- ret = -EINVAL;
-done:
- if (ret)
- return ret;
- else
- return count;
-}
-
-static const struct file_operations wcd_miscdev_fops = {
- .write = wcd_miscdev_write,
- .release = wcd_miscdev_release,
-};
-
-static int wcd_cntl_miscdev_create(struct wcd_dsp_cntl *cntl)
-{
- snprintf(cntl->miscdev_name, ARRAY_SIZE(cntl->miscdev_name),
- "wcd_dsp%u_control", cntl->dsp_instance);
- cntl->miscdev.minor = MISC_DYNAMIC_MINOR;
- cntl->miscdev.name = cntl->miscdev_name;
- cntl->miscdev.fops = &wcd_miscdev_fops;
- cntl->miscdev.parent = cntl->codec->dev;
-
- return misc_register(&cntl->miscdev);
-}
-
-static void wcd_cntl_miscdev_destroy(struct wcd_dsp_cntl *cntl)
-{
- misc_deregister(&cntl->miscdev);
-}
-
-static int wcd_control_init(struct device *dev, void *priv_data)
-{
- struct wcd_dsp_cntl *cntl = priv_data;
- struct snd_soc_codec *codec = cntl->codec;
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
- struct wcd9xxx_core_resource *core_res = &wcd9xxx->core_res;
- int ret;
- bool err_irq_requested = false;
-
- ret = wcd9xxx_request_irq(core_res,
- cntl->irqs.cpe_ipc1_irq,
- wcd_cntl_ipc_irq, "CPE IPC1",
- cntl);
- if (ret < 0) {
- dev_err(codec->dev,
- "%s: Failed to request cpe ipc irq, err = %d\n",
- __func__, ret);
- goto done;
- }
-
- /* Unmask the fatal irqs */
- snd_soc_write(codec, WCD9360_CPE_SS_SS_ERROR_INT_MASK_0A,
- ~(cntl->irqs.fatal_irqs & 0xFF));
- snd_soc_write(codec, WCD9360_CPE_SS_SS_ERROR_INT_MASK_0B,
- ~((cntl->irqs.fatal_irqs >> 8) & 0xFF));
-
- /*
- * CPE ERR irq is used only for error reporting from WCD DSP,
- * even if this request fails, DSP can be function normally.
- * Continuing with init even if the CPE ERR irq request fails.
- */
- if (wcd9xxx_request_irq(core_res, cntl->irqs.cpe_err_irq,
- wcd_cntl_err_irq, "CPE ERR", cntl))
- dev_info(codec->dev, "%s: Failed request_irq(cpe_err_irq)",
- __func__);
- else
- err_irq_requested = true;
-
-
- /* Enable all the clocks */
- ret = wcd_cntl_clocks_enable(cntl);
- if (ret < 0) {
- dev_err(codec->dev, "%s: Failed to enable clocks, err = %d\n",
- __func__, ret);
- goto err_clk_enable;
- }
- wcd_cntl_cpar_ctrl(cntl, true);
-
- return 0;
-
-err_clk_enable:
- /* Mask all error interrupts */
- snd_soc_write(codec, WCD9360_CPE_SS_SS_ERROR_INT_MASK_0A, 0xFF);
- snd_soc_write(codec, WCD9360_CPE_SS_SS_ERROR_INT_MASK_0B, 0xFF);
-
- /* Free the irq's requested */
- wcd9xxx_free_irq(core_res, cntl->irqs.cpe_ipc1_irq, cntl);
-
- if (err_irq_requested)
- wcd9xxx_free_irq(core_res, cntl->irqs.cpe_err_irq, cntl);
-done:
- return ret;
-}
-
-static int wcd_control_deinit(struct device *dev, void *priv_data)
-{
- struct wcd_dsp_cntl *cntl = priv_data;
- struct snd_soc_codec *codec = cntl->codec;
- struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
- struct wcd9xxx_core_resource *core_res = &wcd9xxx->core_res;
-
- wcd_cntl_clocks_disable(cntl);
- wcd_cntl_cpar_ctrl(cntl, false);
-
- /* Mask all error interrupts */
- snd_soc_write(codec, WCD9360_CPE_SS_SS_ERROR_INT_MASK_0A, 0xFF);
- snd_soc_write(codec, WCD9360_CPE_SS_SS_ERROR_INT_MASK_0B, 0xFF);
-
- /* Free the irq's requested */
- wcd9xxx_free_irq(core_res, cntl->irqs.cpe_err_irq, cntl);
- wcd9xxx_free_irq(core_res, cntl->irqs.cpe_ipc1_irq, cntl);
-
- return 0;
-}
-
-static struct wdsp_cmpnt_ops control_ops = {
- .init = wcd_control_init,
- .deinit = wcd_control_deinit,
- .event_handler = wcd_control_handler,
-};
-
-static int wcd_ctrl_component_bind(struct device *dev,
- struct device *master,
- void *data)
-{
- struct wcd_dsp_cntl *cntl;
- struct snd_soc_codec *codec;
- struct snd_card *card;
- struct snd_info_entry *entry;
- char proc_name[WCD_PROCFS_ENTRY_MAX_LEN];
- char wcd_cntl_dir_name[WCD_CNTL_DIR_NAME_LEN_MAX];
- int ret = 0;
-
- if (!dev || !master || !data) {
- pr_err("%s: Invalid parameters\n", __func__);
- return -EINVAL;
- }
-
- cntl = (struct wcd_dsp_cntl *) pahu_get_wcd_dsp_cntl(dev);
- if (!cntl) {
- dev_err(dev, "%s: Failed to get cntl reference\n",
- __func__);
- return -EINVAL;
- }
-
- cntl->m_dev = master;
- cntl->m_ops = data;
-
- if (!cntl->m_ops->register_cmpnt_ops) {
- dev_err(dev, "%s: invalid master callback register_cmpnt_ops\n",
- __func__);
- ret = -EINVAL;
- goto done;
- }
-
- ret = cntl->m_ops->register_cmpnt_ops(master, dev, cntl, &control_ops);
- if (ret) {
- dev_err(dev, "%s: register_cmpnt_ops failed, err = %d\n",
- __func__, ret);
- goto done;
- }
-
- ret = wcd_cntl_miscdev_create(cntl);
- if (ret < 0) {
- dev_err(dev, "%s: misc dev register failed, err = %d\n",
- __func__, ret);
- goto done;
- }
-
- snprintf(wcd_cntl_dir_name, WCD_CNTL_DIR_NAME_LEN_MAX,
- "%s%d", "wdsp", cntl->dsp_instance);
- ret = wcd_cntl_sysfs_init(wcd_cntl_dir_name, cntl);
- if (ret < 0) {
- dev_err(dev, "%s: sysfs_init failed, err = %d\n",
- __func__, ret);
- goto err_sysfs_init;
- }
-
- wcd_cntl_debugfs_init(wcd_cntl_dir_name, cntl);
-
- codec = cntl->codec;
- card = codec->component.card->snd_card;
- snprintf(proc_name, WCD_PROCFS_ENTRY_MAX_LEN, "%s%d%s", "cpe",
- cntl->dsp_instance, "_state");
- entry = snd_info_create_card_entry(card, proc_name, card->proc_root);
- if (!entry) {
- /* Do not treat this as Fatal error */
- dev_err(dev, "%s: Failed to create procfs entry %s\n",
- __func__, proc_name);
- goto err_sysfs_init;
- }
-
- cntl->ssr_entry.entry = entry;
- cntl->ssr_entry.offline = 1;
- entry->size = WCD_PROCFS_ENTRY_MAX_LEN;
- entry->content = SNDRV_INFO_CONTENT_DATA;
- entry->c.ops = &wdsp_ssr_entry_ops;
- entry->private_data = cntl;
- ret = snd_info_register(entry);
- if (ret < 0) {
- dev_err(dev, "%s: Failed to register entry %s, err = %d\n",
- __func__, proc_name, ret);
- snd_info_free_entry(entry);
- /* Let bind still happen even if creating the entry failed */
- ret = 0;
- }
-done:
- return ret;
-
-err_sysfs_init:
- wcd_cntl_miscdev_destroy(cntl);
- return ret;
-}
-
-static void wcd_ctrl_component_unbind(struct device *dev,
- struct device *master,
- void *data)
-{
- struct wcd_dsp_cntl *cntl;
-
- if (!dev) {
- pr_err("%s: Invalid device\n", __func__);
- return;
- }
-
- cntl = (struct wcd_dsp_cntl *) pahu_get_wcd_dsp_cntl(dev);
- if (!cntl) {
- dev_err(dev, "%s: Failed to get cntl reference\n",
- __func__);
- return;
- }
-
- cntl->m_dev = NULL;
- cntl->m_ops = NULL;
-
- /* Remove the sysfs entries */
- wcd_cntl_sysfs_remove(cntl);
-
- /* Remove the debugfs entries */
- wcd_cntl_debugfs_remove(cntl);
-
- /* Remove the misc device */
- wcd_cntl_miscdev_destroy(cntl);
-}
-
-static const struct component_ops wcd_ctrl_component_ops = {
- .bind = wcd_ctrl_component_bind,
- .unbind = wcd_ctrl_component_unbind,
-};
-
-/*
- * wcd9360_dsp_ssr_event: handle the SSR event raised by caller.
- * @cntl: Handle to the wcd_dsp_cntl structure
- * @event: The SSR event to be handled
- *
- * Notifies the manager driver about the SSR event.
- * Returns 0 on success and negative error code on error.
- */
-int wcd9360_dsp_ssr_event(struct wcd_dsp_cntl *cntl, enum cdc_ssr_event event)
-{
- int ret = 0;
-
- if (!cntl) {
- pr_err("%s: Invalid handle to control\n", __func__);
- return -EINVAL;
- }
-
- if (!cntl->m_dev || !cntl->m_ops || !cntl->m_ops->signal_handler) {
- dev_err(cntl->codec->dev,
- "%s: Invalid signal_handler callback\n", __func__);
- return -EINVAL;
- }
-
- switch (event) {
- case WCD_CDC_DOWN_EVENT:
- ret = cntl->m_ops->signal_handler(cntl->m_dev,
- WDSP_CDC_DOWN_SIGNAL,
- NULL);
- if (ret < 0)
- dev_err(cntl->codec->dev,
- "%s: WDSP_CDC_DOWN_SIGNAL failed, err = %d\n",
- __func__, ret);
- wcd_cntl_change_online_state(cntl, 0);
- break;
- case WCD_CDC_UP_EVENT:
- ret = cntl->m_ops->signal_handler(cntl->m_dev,
- WDSP_CDC_UP_SIGNAL,
- NULL);
- if (ret < 0)
- dev_err(cntl->codec->dev,
- "%s: WDSP_CDC_UP_SIGNAL failed, err = %d\n",
- __func__, ret);
- break;
- default:
- dev_err(cntl->codec->dev, "%s: Invalid event %d\n",
- __func__, event);
- ret = -EINVAL;
- break;
- }
-
- return ret;
-}
-EXPORT_SYMBOL(wcd9360_dsp_ssr_event);
-
-/*
- * wcd9360_dsp_cntl_init: Initialize the wcd-dsp control
- * @codec: pointer to the codec handle
- * @params: Parameters required to initialize wcd-dsp control
- *
- * This API is expected to be invoked by the codec driver and
- * provide information essential for the wcd dsp control to
- * configure and initialize the dsp
- */
-void wcd9360_dsp_cntl_init(struct snd_soc_codec *codec,
- struct wcd_dsp_params *params,
- struct wcd_dsp_cntl **cntl)
-{
- struct wcd_dsp_cntl *control;
- int ret;
-
- if (!codec || !params) {
- pr_err("%s: Invalid handle to %s\n", __func__,
- (!codec) ? "codec" : "params");
- *cntl = NULL;
- return;
- }
-
- if (*cntl) {
- pr_err("%s: cntl is non NULL, maybe already initialized ?\n",
- __func__);
- return;
- }
-
- if (!params->cb || !params->cb->cdc_clk_en ||
- !params->cb->cdc_vote_svs) {
- dev_err(codec->dev,
- "%s: clk_en and vote_svs callbacks must be provided\n",
- __func__);
- return;
- }
-
- control = kzalloc(sizeof(*control), GFP_KERNEL);
- if (!(control))
- return;
-
- control->codec = codec;
- control->clk_rate = params->clk_rate;
- control->cdc_cb = params->cb;
- control->dsp_instance = params->dsp_instance;
- memcpy(&control->irqs, ¶ms->irqs, sizeof(control->irqs));
- init_completion(&control->boot_complete);
- mutex_init(&control->clk_mutex);
- mutex_init(&control->ssr_mutex);
- init_waitqueue_head(&control->ssr_entry.offline_poll_wait);
-
- /*
- * The default state of WDSP is in SVS mode.
- * Vote for SVS now, the vote will be removed only
- * after DSP is booted up.
- */
- control->cdc_cb->cdc_vote_svs(codec, true);
-
- /*
- * If this is the last component needed by master to be ready,
- * then component_bind will be called within the component_add.
- * Hence, the data pointer should be assigned before component_add,
- * so that we can access it during this component's bind call.
- */
- *cntl = control;
- ret = component_add(codec->dev, &wcd_ctrl_component_ops);
- if (ret) {
- dev_err(codec->dev, "%s: component_add failed, err = %d\n",
- __func__, ret);
- kfree(*cntl);
- *cntl = NULL;
- }
-}
-EXPORT_SYMBOL(wcd9360_dsp_cntl_init);
-
-/*
- * wcd9360_dsp_cntl_deinit: De-initialize the wcd-dsp control
- * @cntl: The struct wcd_dsp_cntl to de-initialize
- *
- * This API is intended to be invoked by the codec driver
- * to de-initialize the wcd dsp control
- */
-void wcd9360_dsp_cntl_deinit(struct wcd_dsp_cntl **cntl)
-{
- struct wcd_dsp_cntl *control = *cntl;
- struct snd_soc_codec *codec;
-
- /* If control is NULL, there is nothing to de-initialize */
- if (!control)
- return;
- codec = control->codec;
-
- /*
- * Calling shutdown will cleanup all register states,
- * irrespective of DSP was booted up or not.
- */
- wcd_cntl_do_shutdown(control);
- wcd_cntl_disable_memory(control, WCD_MEM_TYPE_SWITCHABLE);
- wcd_cntl_disable_memory(control, WCD_MEM_TYPE_ALWAYS_ON);
-
- component_del(codec->dev, &wcd_ctrl_component_ops);
-
- mutex_destroy(&control->clk_mutex);
- mutex_destroy(&control->ssr_mutex);
- kfree(*cntl);
- *cntl = NULL;
-}
-EXPORT_SYMBOL(wcd9360_dsp_cntl_deinit);
diff --git a/asoc/codecs/wcd9360/wcd9360-dsp-cntl.h b/asoc/codecs/wcd9360/wcd9360-dsp-cntl.h
deleted file mode 100644
index db8b431..0000000
--- a/asoc/codecs/wcd9360/wcd9360-dsp-cntl.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2016-2018, 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.
- */
-
-#ifndef __WCD9360_DSP_CNTL_H__
-#define __WCD9360_DSP_CNTL_H__
-
-#include <linux/miscdevice.h>
-#include <sound/soc.h>
-#include <sound/wcd-dsp-mgr.h>
-
-enum cdc_ssr_event {
- WCD_CDC_DOWN_EVENT,
- WCD_CDC_UP_EVENT,
-};
-
-struct wcd_dsp_cdc_cb {
- /* Callback to enable codec clock */
- int (*cdc_clk_en)(struct snd_soc_codec *, bool);
- /* Callback to vote and unvote for SVS2 mode */
- void (*cdc_vote_svs)(struct snd_soc_codec *, bool);
-};
-
-struct wcd_dsp_irq_info {
- /* IPC interrupt */
- int cpe_ipc1_irq;
-
- /* CPE error summary interrupt */
- int cpe_err_irq;
-
- /*
- * Bit mask to indicate which of the
- * error interrupts are to be considered
- * as fatal.
- */
- u16 fatal_irqs;
-};
-
-struct wcd_dsp_params {
- struct wcd_dsp_cdc_cb *cb;
- struct wcd_dsp_irq_info irqs;
-
- /* Rate at which the codec clock operates */
- u32 clk_rate;
-
- /*
- * Represents the dsp instance, will be used
- * to create sysfs and debugfs entries with
- * directory wdsp<dsp-instance>
- */
- u32 dsp_instance;
-};
-
-struct wdsp_ssr_entry {
- u8 offline;
- u8 offline_change;
- wait_queue_head_t offline_poll_wait;
- struct snd_info_entry *entry;
-};
-
-struct wcd_dsp_cntl {
- /* Handle to codec */
- struct snd_soc_codec *codec;
-
- /* Clk rate of the codec clock */
- u32 clk_rate;
-
- /* Callbacks to codec driver */
- const struct wcd_dsp_cdc_cb *cdc_cb;
-
- /* Completion to indicate WDSP boot done */
- struct completion boot_complete;
-
- struct wcd_dsp_irq_info irqs;
- u32 dsp_instance;
-
- /* Sysfs entries related */
- int boot_reqs;
- struct kobject wcd_kobj;
-
- /* Debugfs related */
- struct dentry *entry;
- u32 debug_mode;
- bool ramdump_enable;
-
- /* WDSP manager drivers data */
- struct device *m_dev;
- struct wdsp_mgr_ops *m_ops;
-
- /* clk related */
- struct mutex clk_mutex;
- bool is_clk_enabled;
-
- /* Keep track of WDSP boot status */
- bool is_wdsp_booted;
-
- /* SSR related */
- struct wdsp_ssr_entry ssr_entry;
- struct mutex ssr_mutex;
-
- /* Misc device related */
- char miscdev_name[256];
- struct miscdevice miscdev;
-};
-
-void wcd9360_dsp_cntl_init(struct snd_soc_codec *codec,
- struct wcd_dsp_params *params,
- struct wcd_dsp_cntl **cntl);
-void wcd9360_dsp_cntl_deinit(struct wcd_dsp_cntl **cntl);
-int wcd9360_dsp_ssr_event(struct wcd_dsp_cntl *cntl, enum cdc_ssr_event event);
-#endif /* end __WCD_DSP_CONTROL_H__ */
diff --git a/asoc/codecs/wcd9360/wcd9360-irq.h b/asoc/codecs/wcd9360/wcd9360-irq.h
deleted file mode 100644
index fa79447..0000000
--- a/asoc/codecs/wcd9360/wcd9360-irq.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2018, 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.
- */
-
-#ifndef __WCD9360_IRQ_H_
-#define __WCD9360_IRQ_H_
-
-enum {
- /* INTR_REG 0 */
- WCD9360_IRQ_MISC = 1,
- WCD9360_IRQ_RESERVED_0,
- WCD9360_IRQ_LDO_RXTX_SCD,
- WCD9360_IRQ_EAR_PA_SCD,
- WCD9360_IRQ_AUX_PA_SCD,
- WCD9360_IRQ_AUX_PA_CNP_COMPLETE,
- WCD9360_IRQ_EAR_PA_CNP_COMPLETE,
- /* INTR_REG 1 */
- WCD9360_IRQ_RESERVED_1,
- WCD9360_IRQ_RESERVED_2,
- WCD9360_IRQ_RESERVED_3,
- WCD9360_IRQ_RESERVED_4,
- WCD9360_IRQ_RESERVED_5,
- WCD9360_IRQ_RESERVED_6,
- WCD9360_IRQ_RESERVED_7,
- WCD9360_IRQ_RESERVED_8,
- /* INTR_REG 2 */
- WCD9360_IRQ_RESERVED_9,
- WCD9360_IRQ_RESERVED_10,
- WCD9360_IRQ_RESERVED_11,
- WCD9360_IRQ_RESERVED_12,
- WCD9360_IRQ_SOUNDWIRE,
- WCD9360_IRQ_RESERVED_13,
- WCD9360_IRQ_RCO_ERROR,
- WCD9360_IRQ_CPE_ERROR,
- /* INTR_REG 3 */
- WCD9360_IRQ_MAD_AUDIO,
- WCD9360_IRQ_MAD_BEACON,
- WCD9360_IRQ_MAD_ULTRASOUND,
- WCD9360_IRQ_RESERVED_14,
- WCD9360_IRQ_RESERVED_15,
- WCD9360_IRQ_CPE1_INTR,
- WCD9360_IRQ_CPE2_INTR,
- WCD9360_IRQ_CPE_LPASS_ACK,
- WCD9360_NUM_IRQS,
-};
-
-#endif
diff --git a/asoc/codecs/wcd9360/wcd9360-regmap.c b/asoc/codecs/wcd9360/wcd9360-regmap.c
deleted file mode 100644
index b74c1fb..0000000
--- a/asoc/codecs/wcd9360/wcd9360-regmap.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2016-2018, 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.
- */
-
-#include <linux/regmap.h>
-#include <linux/device.h>
-#include <asoc/wcd9360-registers.h>
-#include "../core.h"
-#include "../wcd9xxx-regmap.h"
-#include "wcd9360-defaults.h"
-
-static bool wcd9360_is_readable_register(struct device *dev, unsigned int reg)
-{
- u8 pg_num, reg_offset;
- const u8 *reg_tbl = NULL;
-
- /*
- * Get the page number from MSB of codec register. If its 0x80, assign
- * the corresponding page index PAGE_0x80.
- */
- pg_num = reg >> 8;
- if (pg_num == 128)
- pg_num = WCD9360_PAGE_128;
- else if (pg_num == 80)
- pg_num = WCD9360_PAGE_80;
- else if (pg_num > 15)
- return false;
-
- reg_tbl = wcd9360_reg[pg_num];
- reg_offset = reg & 0xFF;
-
- if (reg_tbl && reg_tbl[reg_offset])
- return true;
- else
- return false;
-}
-
-static bool wcd9360_is_volatile_register(struct device *dev, unsigned int reg)
-{
- u8 pg_num, reg_offset;
- const u8 *reg_tbl = NULL;
-
- pg_num = reg >> 8;
-
- if (pg_num == 1 || pg_num == 2 ||
- pg_num == 6 || pg_num == 7)
- return true;
- else if (pg_num == 128)
- pg_num = WCD9360_PAGE_128;
- else if (pg_num == 80)
- pg_num = WCD9360_PAGE_80;
- else if (pg_num > 15)
- return false;
-
- reg_tbl = wcd9360_reg[pg_num];
- reg_offset = reg & 0xFF;
-
- if (reg_tbl && reg_tbl[reg_offset] == WCD9360_RO)
- return true;
-
- if ((reg >= WCD9360_CODEC_RPM_RST_CTL) &&
- (reg <= WCD9360_CHIP_TIER_CTRL_ALT_FUNC_EN))
- return true;
-
- if ((reg >= WCD9360_CDC_ANC0_IIR_COEFF_1_CTL) &&
- (reg <= WCD9360_CDC_ANC0_FB_GAIN_CTL))
- return true;
-
- if ((reg >= WCD9360_CODEC_CPR_WR_DATA_0) &&
- (reg <= WCD9360_CODEC_CPR_RD_DATA_3))
- return true;
-
- /*
- * Need to mark volatile for registers that are writable but
- * only few bits are read-only
- */
- switch (reg) {
- case WCD9360_CODEC_RPM_CLK_BYPASS:
- case WCD9360_CODEC_RPM_CLK_GATE:
- case WCD9360_CODEC_RPM_CLK_MCLK_CFG:
- case WCD9360_CODEC_CPR_SVS_CX_VDD:
- case WCD9360_CODEC_CPR_SVS2_CX_VDD:
- case WCD9360_CDC_SIDETONE_IIR0_IIR_COEF_B1_CTL:
- case WCD9360_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL:
- return true;
- }
-
- return false;
-}
-
-struct regmap_config wcd9360_regmap_config = {
- .reg_bits = 16,
- .val_bits = 8,
- .cache_type = REGCACHE_RBTREE,
- .reg_defaults = wcd9360_defaults,
- .num_reg_defaults = ARRAY_SIZE(wcd9360_defaults),
- .max_register = WCD9360_MAX_REGISTER,
- .volatile_reg = wcd9360_is_volatile_register,
- .readable_reg = wcd9360_is_readable_register,
- .can_multi_write = true,
-};
diff --git a/asoc/codecs/wcd9360/wcd9360-routing.h b/asoc/codecs/wcd9360/wcd9360-routing.h
deleted file mode 100644
index c305d2e..0000000
--- a/asoc/codecs/wcd9360/wcd9360-routing.h
+++ /dev/null
@@ -1,882 +0,0 @@
-/*
- * Copyright (c) 2015-2018, 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.
- */
-#ifndef __WCD9360_ROUTING_H__
-#define __WCD9360_ROUTING_H__
-
-#include <sound/soc-dapm.h>
-
-const struct snd_soc_dapm_route pahu_slim_audio_map[] = {
-
- {"AIF4 MAD", NULL, "AIF4_MAD Mixer"},
-
- /* Virtual input widget Mixer SLIMBUS */
- {"AIF1_CAP Mixer", "SLIM TX0", "SLIM TX0"},
- {"AIF1_CAP Mixer", "SLIM TX1", "SLIM TX1"},
- {"AIF1_CAP Mixer", "SLIM TX2", "SLIM TX2"},
- {"AIF1_CAP Mixer", "SLIM TX3", "SLIM TX3"},
- {"AIF1_CAP Mixer", "SLIM TX4", "SLIM TX4"},
- {"AIF1_CAP Mixer", "SLIM TX5", "SLIM TX5"},
- {"AIF1_CAP Mixer", "SLIM TX6", "SLIM TX6"},
- {"AIF1_CAP Mixer", "SLIM TX7", "SLIM TX7"},
- {"AIF1_CAP Mixer", "SLIM TX8", "SLIM TX8"},
- {"AIF1_CAP Mixer", "SLIM TX9", "SLIM TX9"},
- {"AIF1_CAP Mixer", "SLIM TX10", "SLIM TX10"},
- {"AIF1_CAP Mixer", "SLIM TX11", "SLIM TX11"},
- {"AIF1_CAP Mixer", "SLIM TX13", "SLIM TX13"},
-
- {"AIF2_CAP Mixer", "SLIM TX0", "SLIM TX0"},
- {"AIF2_CAP Mixer", "SLIM TX1", "SLIM TX1"},
- {"AIF2_CAP Mixer", "SLIM TX2", "SLIM TX2"},
- {"AIF2_CAP Mixer", "SLIM TX3", "SLIM TX3"},
- {"AIF2_CAP Mixer", "SLIM TX4", "SLIM TX4"},
- {"AIF2_CAP Mixer", "SLIM TX5", "SLIM TX5"},
- {"AIF2_CAP Mixer", "SLIM TX6", "SLIM TX6"},
- {"AIF2_CAP Mixer", "SLIM TX7", "SLIM TX7"},
- {"AIF2_CAP Mixer", "SLIM TX8", "SLIM TX8"},
- {"AIF2_CAP Mixer", "SLIM TX9", "SLIM TX9"},
- {"AIF2_CAP Mixer", "SLIM TX10", "SLIM TX10"},
- {"AIF2_CAP Mixer", "SLIM TX11", "SLIM TX11"},
- {"AIF2_CAP Mixer", "SLIM TX13", "SLIM TX13"},
-
- {"AIF3_CAP Mixer", "SLIM TX0", "SLIM TX0"},
- {"AIF3_CAP Mixer", "SLIM TX1", "SLIM TX1"},
- {"AIF3_CAP Mixer", "SLIM TX2", "SLIM TX2"},
- {"AIF3_CAP Mixer", "SLIM TX3", "SLIM TX3"},
- {"AIF3_CAP Mixer", "SLIM TX4", "SLIM TX4"},
- {"AIF3_CAP Mixer", "SLIM TX5", "SLIM TX5"},
- {"AIF3_CAP Mixer", "SLIM TX6", "SLIM TX6"},
- {"AIF3_CAP Mixer", "SLIM TX7", "SLIM TX7"},
- {"AIF3_CAP Mixer", "SLIM TX8", "SLIM TX8"},
- {"AIF3_CAP Mixer", "SLIM TX9", "SLIM TX9"},
- {"AIF3_CAP Mixer", "SLIM TX10", "SLIM TX10"},
- {"AIF3_CAP Mixer", "SLIM TX11", "SLIM TX11"},
- {"AIF3_CAP Mixer", "SLIM TX13", "SLIM TX13"},
-
- {"AIF4_MAD Mixer", "SLIM TX13", "SLIM TX13"},
-
- /* CDC Tx interface with SLIMBUS */
- {"SLIM TX0", NULL, "CDC_IF TX0 MUX"},
- {"SLIM TX1", NULL, "CDC_IF TX1 MUX"},
- {"SLIM TX2", NULL, "CDC_IF TX2 MUX"},
- {"SLIM TX3", NULL, "CDC_IF TX3 MUX"},
- {"SLIM TX4", NULL, "CDC_IF TX4 MUX"},
- {"SLIM TX5", NULL, "CDC_IF TX5 MUX"},
- {"SLIM TX6", NULL, "CDC_IF TX6 MUX"},
- {"SLIM TX7", NULL, "CDC_IF TX7 MUX"},
- {"SLIM TX8", NULL, "CDC_IF TX8 MUX"},
- {"SLIM TX9", NULL, "CDC_IF TX9 MUX"},
- {"SLIM TX10", NULL, "CDC_IF TX10 MUX2"},
- {"SLIM TX11", NULL, "CDC_IF TX11 MUX2"},
- {"SLIM TX13", NULL, "CDC_IF TX13 MUX"},
-
- {"SLIM RX0 MUX", "AIF1_PB", "AIF1 PB"},
- {"SLIM RX1 MUX", "AIF1_PB", "AIF1 PB"},
- {"SLIM RX2 MUX", "AIF1_PB", "AIF1 PB"},
- {"SLIM RX3 MUX", "AIF1_PB", "AIF1 PB"},
- {"SLIM RX4 MUX", "AIF1_PB", "AIF1 PB"},
- {"SLIM RX5 MUX", "AIF1_PB", "AIF1 PB"},
- {"SLIM RX6 MUX", "AIF1_PB", "AIF1 PB"},
- {"SLIM RX7 MUX", "AIF1_PB", "AIF1 PB"},
-
- {"SLIM RX0 MUX", "AIF2_PB", "AIF2 PB"},
- {"SLIM RX1 MUX", "AIF2_PB", "AIF2 PB"},
- {"SLIM RX2 MUX", "AIF2_PB", "AIF2 PB"},
- {"SLIM RX3 MUX", "AIF2_PB", "AIF2 PB"},
- {"SLIM RX4 MUX", "AIF2_PB", "AIF2 PB"},
- {"SLIM RX5 MUX", "AIF2_PB", "AIF2 PB"},
- {"SLIM RX6 MUX", "AIF2_PB", "AIF2 PB"},
- {"SLIM RX7 MUX", "AIF2_PB", "AIF2 PB"},
-
- {"SLIM RX0 MUX", "AIF3_PB", "AIF3 PB"},
- {"SLIM RX1 MUX", "AIF3_PB", "AIF3 PB"},
- {"SLIM RX2 MUX", "AIF3_PB", "AIF3 PB"},
- {"SLIM RX3 MUX", "AIF3_PB", "AIF3 PB"},
- {"SLIM RX4 MUX", "AIF3_PB", "AIF3 PB"},
- {"SLIM RX5 MUX", "AIF3_PB", "AIF3 PB"},
- {"SLIM RX6 MUX", "AIF3_PB", "AIF3 PB"},
- {"SLIM RX7 MUX", "AIF3_PB", "AIF3 PB"},
-
- {"SLIM RX0 MUX", "AIF4_PB", "AIF4 PB"},
- {"SLIM RX1 MUX", "AIF4_PB", "AIF4 PB"},
- {"SLIM RX2 MUX", "AIF4_PB", "AIF4 PB"},
- {"SLIM RX3 MUX", "AIF4_PB", "AIF4 PB"},
- {"SLIM RX4 MUX", "AIF4_PB", "AIF4 PB"},
- {"SLIM RX5 MUX", "AIF4_PB", "AIF4 PB"},
- {"SLIM RX6 MUX", "AIF4_PB", "AIF4 PB"},
- {"SLIM RX7 MUX", "AIF4_PB", "AIF4 PB"},
-
- {"SLIM RX0", NULL, "SLIM RX0 MUX"},
- {"SLIM RX1", NULL, "SLIM RX1 MUX"},
- {"SLIM RX2", NULL, "SLIM RX2 MUX"},
- {"SLIM RX3", NULL, "SLIM RX3 MUX"},
- {"SLIM RX4", NULL, "SLIM RX4 MUX"},
- {"SLIM RX5", NULL, "SLIM RX5 MUX"},
- {"SLIM RX6", NULL, "SLIM RX6 MUX"},
- {"SLIM RX7", NULL, "SLIM RX7 MUX"},
-
- /* CDC Rx interface with SLIMBUS */
- {"CDC_IF RX0 MUX", "SLIM RX0", "SLIM RX0"},
- {"CDC_IF RX1 MUX", "SLIM RX1", "SLIM RX1"},
- {"CDC_IF RX2 MUX", "SLIM RX2", "SLIM RX2"},
- {"CDC_IF RX3 MUX", "SLIM RX3", "SLIM RX3"},
- {"CDC_IF RX4 MUX", "SLIM RX4", "SLIM RX4"},
- {"CDC_IF RX5 MUX", "SLIM RX5", "SLIM RX5"},
- {"CDC_IF RX6 MUX", "SLIM RX6", "SLIM RX6"},
- {"CDC_IF RX7 MUX", "SLIM RX7", "SLIM RX7"},
-
- /* VI Feedback */
- {"AIF4_VI Mixer", "SPKR_VI_1", "VIINPUT"},
- {"AIF4_VI Mixer", "SPKR_VI_2", "VIINPUT"},
- {"AIF4 VI", NULL, "AIF4_VI Mixer"},
-};
-
-const struct snd_soc_dapm_route pahu_audio_map[] = {
-
- /* Virtual input widgets */
- {"AIF1 CAP", NULL, "AIF1_CAP Mixer"},
- {"AIF2 CAP", NULL, "AIF2_CAP Mixer"},
- {"AIF3 CAP", NULL, "AIF3_CAP Mixer"},
-
- /* WDMA3 */
- {"WDMA3 PORT0 MUX", "DEC0", "ADC MUX0"},
- {"WDMA3 PORT0 MUX", "RX_MIX_TX0", "RX MIX TX0 MUX"},
- {"WDMA3 PORT1 MUX", "DEC1", "ADC MUX1"},
- {"WDMA3 PORT1 MUX", "RX_MIX_TX1", "RX MIX TX1 MUX"},
- {"WDMA3 PORT2 MUX", "DEC2", "ADC MUX2"},
- {"WDMA3 PORT2 MUX", "RX_MIX_TX2", "RX MIX TX2 MUX"},
- {"WDMA3 PORT3 MUX", "DEC3", "ADC MUX3"},
- {"WDMA3 PORT3 MUX", "RX_MIX_TX3", "RX MIX TX3 MUX"},
- {"WDMA3 PORT4 MUX", "DEC4", "ADC MUX4"},
- {"WDMA3 PORT4 MUX", "RX_MIX_TX4", "RX MIX TX4 MUX"},
- {"WDMA3 PORT5 MUX", "DEC5", "ADC MUX5"},
- {"WDMA3 PORT5 MUX", "RX_MIX_TX5", "RX MIX TX5 MUX"},
- {"WDMA3 PORT6 MUX", "DEC6", "ADC MUX6"},
- {"WDMA3 PORT6 MUX", "RX_MIX_TX6", "RX MIX TX6 MUX"},
-
- {"WDMA3 CH0 MUX", "PORT_0", "WDMA3 PORT0 MUX"},
- {"WDMA3 CH0 MUX", "PORT_1", "WDMA3 PORT1 MUX"},
- {"WDMA3 CH0 MUX", "PORT_2", "WDMA3 PORT2 MUX"},
- {"WDMA3 CH0 MUX", "PORT_3", "WDMA3 PORT3 MUX"},
- {"WDMA3 CH0 MUX", "PORT_4", "WDMA3 PORT4 MUX"},
- {"WDMA3 CH0 MUX", "PORT_5", "WDMA3 PORT5 MUX"},
- {"WDMA3 CH0 MUX", "PORT_6", "WDMA3 PORT6 MUX"},
- {"WDMA3 CH0 MUX", "PORT_7", "ADC MUX7"},
- {"WDMA3 CH0 MUX", "PORT_8", "ADC MUX8"},
-
- {"WDMA3 CH1 MUX", "PORT_0", "WDMA3 PORT0 MUX"},
- {"WDMA3 CH1 MUX", "PORT_1", "WDMA3 PORT1 MUX"},
- {"WDMA3 CH1 MUX", "PORT_2", "WDMA3 PORT2 MUX"},
- {"WDMA3 CH1 MUX", "PORT_3", "WDMA3 PORT3 MUX"},
- {"WDMA3 CH1 MUX", "PORT_4", "WDMA3 PORT4 MUX"},
- {"WDMA3 CH1 MUX", "PORT_5", "WDMA3 PORT5 MUX"},
- {"WDMA3 CH1 MUX", "PORT_6", "WDMA3 PORT6 MUX"},
- {"WDMA3 CH1 MUX", "PORT_7", "ADC MUX7"},
- {"WDMA3 CH1 MUX", "PORT_8", "ADC MUX8"},
-
- {"WDMA3 CH2 MUX", "PORT_0", "WDMA3 PORT0 MUX"},
- {"WDMA3 CH2 MUX", "PORT_1", "WDMA3 PORT1 MUX"},
- {"WDMA3 CH2 MUX", "PORT_2", "WDMA3 PORT2 MUX"},
- {"WDMA3 CH2 MUX", "PORT_3", "WDMA3 PORT3 MUX"},
- {"WDMA3 CH2 MUX", "PORT_4", "WDMA3 PORT4 MUX"},
- {"WDMA3 CH2 MUX", "PORT_5", "WDMA3 PORT5 MUX"},
- {"WDMA3 CH2 MUX", "PORT_6", "WDMA3 PORT6 MUX"},
- {"WDMA3 CH2 MUX", "PORT_7", "ADC MUX7"},
- {"WDMA3 CH2 MUX", "PORT_8", "ADC MUX8"},
-
- {"WDMA3 CH3 MUX", "PORT_0", "WDMA3 PORT0 MUX"},
- {"WDMA3 CH3 MUX", "PORT_1", "WDMA3 PORT1 MUX"},
- {"WDMA3 CH3 MUX", "PORT_2", "WDMA3 PORT2 MUX"},
- {"WDMA3 CH3 MUX", "PORT_3", "WDMA3 PORT3 MUX"},
- {"WDMA3 CH3 MUX", "PORT_4", "WDMA3 PORT4 MUX"},
- {"WDMA3 CH3 MUX", "PORT_5", "WDMA3 PORT5 MUX"},
- {"WDMA3 CH3 MUX", "PORT_6", "WDMA3 PORT6 MUX"},
- {"WDMA3 CH3 MUX", "PORT_7", "ADC MUX7"},
- {"WDMA3 CH3 MUX", "PORT_8", "ADC MUX8"},
-
- {"WDMA3_CH_MIXER", NULL, "WDMA3 CH0 MUX"},
- {"WDMA3_CH_MIXER", NULL, "WDMA3 CH1 MUX"},
- {"WDMA3_CH_MIXER", NULL, "WDMA3 CH2 MUX"},
- {"WDMA3_CH_MIXER", NULL, "WDMA3 CH3 MUX"},
-
- {"WDMA3_ON_OFF", "Switch", "WDMA3_CH_MIXER"},
- {"WDMA3_OUT", NULL, "WDMA3_ON_OFF"},
-
- /* MAD */
- {"MAD_SEL MUX", "SPE", "MAD_CPE_INPUT"},
- {"MAD_SEL MUX", "MSM", "MADINPUT"},
-
- {"MAD_INP MUX", "MAD", "MAD_SEL MUX"},
- {"MAD_INP MUX", "DEC1", "ADC MUX1"},
-
- {"MAD_BROADCAST", "Switch", "MAD_INP MUX"},
- {"MAD_CPE1", "Switch", "MAD_INP MUX"},
- {"MAD_CPE2", "Switch", "MAD_INP MUX"},
-
- {"MAD_CPE_OUT1", NULL, "MAD_CPE1"},
- {"MAD_CPE_OUT2", NULL, "MAD_CPE2"},
-
- {"CDC_IF TX0 MUX", "DEC0", "ADC MUX0"},
- {"CDC_IF TX0 MUX", "RX_MIX_TX0", "RX MIX TX0 MUX"},
- {"CDC_IF TX0 MUX", "DEC0_192", "ADC US MUX0"},
-
- {"CDC_IF TX1 MUX", "DEC1", "ADC MUX1"},
- {"CDC_IF TX1 MUX", "RX_MIX_TX1", "RX MIX TX1 MUX"},
- {"CDC_IF TX1 MUX", "DEC1_192", "ADC US MUX1"},
-
- {"CDC_IF TX2 MUX", "DEC2", "ADC MUX2"},
- {"CDC_IF TX2 MUX", "RX_MIX_TX2", "RX MIX TX2 MUX"},
- {"CDC_IF TX2 MUX", "DEC2_192", "ADC US MUX2"},
-
- {"CDC_IF TX3 MUX", "DEC3", "ADC MUX3"},
- {"CDC_IF TX3 MUX", "RX_MIX_TX3", "RX MIX TX3 MUX"},
- {"CDC_IF TX3 MUX", "DEC3_192", "ADC US MUX3"},
-
- {"CDC_IF TX4 MUX", "DEC4", "ADC MUX4"},
- {"CDC_IF TX4 MUX", "RX_MIX_TX4", "RX MIX TX4 MUX"},
- {"CDC_IF TX4 MUX", "DEC4_192", "ADC US MUX4"},
-
- {"CDC_IF TX5 MUX", "DEC5", "ADC MUX5"},
- {"CDC_IF TX5 MUX", "RX_MIX_TX5", "RX MIX TX5 MUX"},
- {"CDC_IF TX5 MUX", "DEC5_192", "ADC US MUX5"},
-
- {"CDC_IF TX6 MUX", "DEC6", "ADC MUX6"},
- {"CDC_IF TX6 MUX", "RX_MIX_TX6", "RX MIX TX6 MUX"},
- {"CDC_IF TX6 MUX", "DEC6_192", "ADC US MUX6"},
-
- {"CDC_IF TX7 MUX", "DEC7", "ADC MUX7"},
- {"CDC_IF TX7 MUX", "RX_MIX_TX7", "RX MIX TX7 MUX"},
- {"CDC_IF TX7 MUX", "DEC7_192", "ADC US MUX7"},
-
- {"CDC_IF TX8 MUX", "DEC8", "ADC MUX8"},
- {"CDC_IF TX8 MUX", "RX_MIX_TX8", "RX MIX TX8 MUX"},
- {"CDC_IF TX8 MUX", "DEC8_192", "ADC US MUX8"},
-
- {"CDC_IF TX9 MUX", "DEC7", "ADC MUX7"},
- {"CDC_IF TX9 MUX", "DEC7_192", "ADC US MUX7"},
- {"CDC_IF TX10 MUX", "DEC6", "ADC MUX6"},
- {"CDC_IF TX10 MUX", "DEC6_192", "ADC US MUX6"},
- {"CDC_IF TX10 MUX2", "TX10_MUX1", "CDC_IF TX10 MUX"},
-
- {"CDC_IF TX11 MUX2", "TX11_MUX1", "CDC_IF TX11 MUX"},
- {"CDC_IF TX11 MUX", "DEC_0_5", "CDC_IF TX11 INP1 MUX"},
- {"CDC_IF TX11 MUX", "DEC_9_12", "CDC_IF TX11 INP1 MUX"},
- {"CDC_IF TX11 INP1 MUX", "DEC0", "ADC MUX0"},
- {"CDC_IF TX11 INP1 MUX", "DEC1", "ADC MUX1"},
- {"CDC_IF TX11 INP1 MUX", "DEC2", "ADC MUX2"},
- {"CDC_IF TX11 INP1 MUX", "DEC3", "ADC MUX3"},
- {"CDC_IF TX11 INP1 MUX", "DEC4", "ADC MUX4"},
- {"CDC_IF TX11 INP1 MUX", "DEC5", "ADC MUX5"},
- {"CDC_IF TX11 INP1 MUX", "RX_MIX_TX5", "RX MIX TX5 MUX"},
-
- {"CDC_IF TX13 MUX", "MAD_BRDCST", "MAD_BROADCAST"},
- {"CDC_IF TX13 MUX", "CDC_DEC_5", "CDC_IF TX13 INP1 MUX"},
- {"CDC_IF TX13 INP1 MUX", "DEC5", "ADC MUX5"},
- {"CDC_IF TX13 INP1 MUX", "DEC5_192", "ADC US MUX5"},
-
- {"RX MIX TX0 MUX", "RX_MIX0", "RX INT0 SEC MIX"},
- {"RX MIX TX0 MUX", "RX_MIX7", "RX INT7 SEC MIX"},
- {"RX MIX TX0 MUX", "RX_MIX8", "RX INT8 SEC MIX"},
- {"RX MIX TX0 MUX", "RX_MIX9", "RX INT9 SEC MIX"},
-
- {"RX MIX TX1 MUX", "RX_MIX0", "RX INT0 SEC MIX"},
- {"RX MIX TX1 MUX", "RX_MIX7", "RX INT7 SEC MIX"},
- {"RX MIX TX1 MUX", "RX_MIX8", "RX INT8 SEC MIX"},
- {"RX MIX TX1 MUX", "RX_MIX9", "RX INT9 SEC MIX"},
-
- {"RX MIX TX2 MUX", "RX_MIX0", "RX INT0 SEC MIX"},
- {"RX MIX TX2 MUX", "RX_MIX7", "RX INT7 SEC MIX"},
- {"RX MIX TX2 MUX", "RX_MIX8", "RX INT8 SEC MIX"},
- {"RX MIX TX2 MUX", "RX_MIX9", "RX INT9 SEC MIX"},
-
- {"RX MIX TX3 MUX", "RX_MIX0", "RX INT0 SEC MIX"},
- {"RX MIX TX3 MUX", "RX_MIX7", "RX INT7 SEC MIX"},
- {"RX MIX TX3 MUX", "RX_MIX8", "RX INT8 SEC MIX"},
- {"RX MIX TX3 MUX", "RX_MIX9", "RX INT9 SEC MIX"},
-
- {"RX MIX TX4 MUX", "RX_MIX0", "RX INT0 SEC MIX"},
- {"RX MIX TX4 MUX", "RX_MIX7", "RX INT7 SEC MIX"},
- {"RX MIX TX4 MUX", "RX_MIX8", "RX INT8 SEC MIX"},
- {"RX MIX TX4 MUX", "RX_MIX9", "RX INT9 SEC MIX"},
-
- {"RX MIX TX5 MUX", "RX_MIX0", "RX INT0 SEC MIX"},
- {"RX MIX TX5 MUX", "RX_MIX7", "RX INT7 SEC MIX"},
- {"RX MIX TX5 MUX", "RX_MIX8", "RX INT8 SEC MIX"},
- {"RX MIX TX5 MUX", "RX_MIX9", "RX INT9 SEC MIX"},
-
- {"RX MIX TX6 MUX", "RX_MIX0", "RX INT0 SEC MIX"},
- {"RX MIX TX6 MUX", "RX_MIX7", "RX INT7 SEC MIX"},
- {"RX MIX TX6 MUX", "RX_MIX8", "RX INT8 SEC MIX"},
- {"RX MIX TX6 MUX", "RX_MIX9", "RX INT9 SEC MIX"},
-
- {"RX MIX TX7 MUX", "RX_MIX0", "RX INT0 SEC MIX"},
- {"RX MIX TX7 MUX", "RX_MIX7", "RX INT7 SEC MIX"},
- {"RX MIX TX7 MUX", "RX_MIX8", "RX INT8 SEC MIX"},
- {"RX MIX TX7 MUX", "RX_MIX9", "RX INT9 SEC MIX"},
-
- {"RX MIX TX8 MUX", "RX_MIX0", "RX INT0 SEC MIX"},
- {"RX MIX TX8 MUX", "RX_MIX7", "RX INT7 SEC MIX"},
- {"RX MIX TX8 MUX", "RX_MIX8", "RX INT8 SEC MIX"},
- {"RX MIX TX8 MUX", "RX_MIX9", "RX INT9 SEC MIX"},
-
- {"ADC US MUX0", "US_Switch", "ADC MUX0"},
- {"ADC US MUX1", "US_Switch", "ADC MUX1"},
- {"ADC US MUX2", "US_Switch", "ADC MUX2"},
- {"ADC US MUX3", "US_Switch", "ADC MUX3"},
- {"ADC US MUX4", "US_Switch", "ADC MUX4"},
- {"ADC US MUX5", "US_Switch", "ADC MUX5"},
- {"ADC US MUX6", "US_Switch", "ADC MUX6"},
- {"ADC US MUX7", "US_Switch", "ADC MUX7"},
- {"ADC US MUX8", "US_Switch", "ADC MUX8"},
-
- {"ADC MUX0", "DMIC", "DMIC MUX0"},
- {"ADC MUX0", "AMIC", "AMIC MUX0"},
- {"ADC MUX1", "DMIC", "DMIC MUX1"},
- {"ADC MUX1", "AMIC", "AMIC MUX1"},
- {"ADC MUX2", "DMIC", "DMIC MUX2"},
- {"ADC MUX2", "AMIC", "AMIC MUX2"},
- {"ADC MUX3", "DMIC", "DMIC MUX3"},
- {"ADC MUX3", "AMIC", "AMIC MUX3"},
- {"ADC MUX4", "DMIC", "DMIC MUX4"},
- {"ADC MUX4", "AMIC", "AMIC MUX4"},
- {"ADC MUX5", "DMIC", "DMIC MUX5"},
- {"ADC MUX5", "AMIC", "AMIC MUX5"},
- {"ADC MUX6", "DMIC", "DMIC MUX6"},
- {"ADC MUX6", "AMIC", "AMIC MUX6"},
- {"ADC MUX7", "DMIC", "DMIC MUX7"},
- {"ADC MUX7", "AMIC", "AMIC MUX7"},
- {"ADC MUX8", "DMIC", "DMIC MUX8"},
- {"ADC MUX8", "AMIC", "AMIC MUX8"},
- {"ADC MUX10", "DMIC", "DMIC MUX10"},
- {"ADC MUX10", "AMIC", "AMIC MUX10"},
- {"ADC MUX11", "DMIC", "DMIC MUX11"},
- {"ADC MUX11", "AMIC", "AMIC MUX11"},
-
- {"ADC MUX0", "ANC_FB_TUNE1", "ADC MUX10"},
- {"ADC MUX0", "ANC_FB_TUNE1", "ADC MUX11"},
- {"ADC MUX1", "ANC_FB_TUNE1", "ADC MUX10"},
- {"ADC MUX1", "ANC_FB_TUNE1", "ADC MUX11"},
- {"ADC MUX2", "ANC_FB_TUNE1", "ADC MUX10"},
- {"ADC MUX2", "ANC_FB_TUNE1", "ADC MUX11"},
- {"ADC MUX3", "ANC_FB_TUNE1", "ADC MUX10"},
- {"ADC MUX3", "ANC_FB_TUNE1", "ADC MUX11"},
- {"ADC MUX4", "ANC_FB_TUNE1", "ADC MUX10"},
- {"ADC MUX4", "ANC_FB_TUNE1", "ADC MUX11"},
- {"ADC MUX5", "ANC_FB_TUNE1", "ADC MUX10"},
- {"ADC MUX5", "ANC_FB_TUNE1", "ADC MUX11"},
- {"ADC MUX6", "ANC_FB_TUNE1", "ADC MUX10"},
- {"ADC MUX6", "ANC_FB_TUNE1", "ADC MUX11"},
- {"ADC MUX7", "ANC_FB_TUNE1", "ADC MUX10"},
- {"ADC MUX7", "ANC_FB_TUNE1", "ADC MUX11"},
- {"ADC MUX8", "ANC_FB_TUNE1", "ADC MUX10"},
- {"ADC MUX8", "ANC_FB_TUNE1", "ADC MUX11"},
-
- {"DMIC MUX0", "DMIC0", "DMIC0"},
- {"DMIC MUX0", "DMIC1", "DMIC1"},
- {"DMIC MUX0", "DMIC2", "DMIC2"},
- {"DMIC MUX0", "DMIC3", "DMIC3"},
- {"DMIC MUX0", "DMIC4", "DMIC4"},
- {"DMIC MUX0", "DMIC5", "DMIC5"},
- {"DMIC MUX0", "DMIC6", "DMIC6"},
- {"DMIC MUX0", "DMIC7", "DMIC7"},
- {"AMIC MUX0", "ADC1", "ADC1"},
- {"AMIC MUX0", "ADC2", "ADC2"},
- {"AMIC MUX0", "ADC3", "ADC3"},
- {"AMIC MUX0", "ADC4", "ADC4"},
-
- {"DMIC MUX1", "DMIC0", "DMIC0"},
- {"DMIC MUX1", "DMIC1", "DMIC1"},
- {"DMIC MUX1", "DMIC2", "DMIC2"},
- {"DMIC MUX1", "DMIC3", "DMIC3"},
- {"DMIC MUX1", "DMIC4", "DMIC4"},
- {"DMIC MUX1", "DMIC5", "DMIC5"},
- {"DMIC MUX1", "DMIC6", "DMIC6"},
- {"DMIC MUX1", "DMIC7", "DMIC7"},
- {"AMIC MUX1", "ADC1", "ADC1"},
- {"AMIC MUX1", "ADC2", "ADC2"},
- {"AMIC MUX1", "ADC3", "ADC3"},
- {"AMIC MUX1", "ADC4", "ADC4"},
-
- {"DMIC MUX2", "DMIC0", "DMIC0"},
- {"DMIC MUX2", "DMIC1", "DMIC1"},
- {"DMIC MUX2", "DMIC2", "DMIC2"},
- {"DMIC MUX2", "DMIC3", "DMIC3"},
- {"DMIC MUX2", "DMIC4", "DMIC4"},
- {"DMIC MUX2", "DMIC5", "DMIC5"},
- {"DMIC MUX2", "DMIC6", "DMIC6"},
- {"DMIC MUX2", "DMIC7", "DMIC7"},
- {"AMIC MUX2", "ADC1", "ADC1"},
- {"AMIC MUX2", "ADC2", "ADC2"},
- {"AMIC MUX2", "ADC3", "ADC3"},
- {"AMIC MUX2", "ADC4", "ADC4"},
-
- {"DMIC MUX3", "DMIC0", "DMIC0"},
- {"DMIC MUX3", "DMIC1", "DMIC1"},
- {"DMIC MUX3", "DMIC2", "DMIC2"},
- {"DMIC MUX3", "DMIC3", "DMIC3"},
- {"DMIC MUX3", "DMIC4", "DMIC4"},
- {"DMIC MUX3", "DMIC5", "DMIC5"},
- {"DMIC MUX3", "DMIC6", "DMIC6"},
- {"DMIC MUX3", "DMIC7", "DMIC7"},
- {"AMIC MUX3", "ADC1", "ADC1"},
- {"AMIC MUX3", "ADC2", "ADC2"},
- {"AMIC MUX3", "ADC3", "ADC3"},
- {"AMIC MUX3", "ADC4", "ADC4"},
-
- {"DMIC MUX4", "DMIC0", "DMIC0"},
- {"DMIC MUX4", "DMIC1", "DMIC1"},
- {"DMIC MUX4", "DMIC2", "DMIC2"},
- {"DMIC MUX4", "DMIC3", "DMIC3"},
- {"DMIC MUX4", "DMIC4", "DMIC4"},
- {"DMIC MUX4", "DMIC5", "DMIC5"},
- {"DMIC MUX4", "DMIC6", "DMIC6"},
- {"DMIC MUX4", "DMIC7", "DMIC7"},
- {"AMIC MUX4", "ADC1", "ADC1"},
- {"AMIC MUX4", "ADC2", "ADC2"},
- {"AMIC MUX4", "ADC3", "ADC3"},
- {"AMIC MUX4", "ADC4", "ADC4"},
-
- {"DMIC MUX5", "DMIC0", "DMIC0"},
- {"DMIC MUX5", "DMIC1", "DMIC1"},
- {"DMIC MUX5", "DMIC2", "DMIC2"},
- {"DMIC MUX5", "DMIC3", "DMIC3"},
- {"DMIC MUX5", "DMIC4", "DMIC4"},
- {"DMIC MUX5", "DMIC5", "DMIC5"},
- {"DMIC MUX5", "DMIC6", "DMIC6"},
- {"DMIC MUX5", "DMIC7", "DMIC7"},
- {"AMIC MUX5", "ADC1", "ADC1"},
- {"AMIC MUX5", "ADC2", "ADC2"},
- {"AMIC MUX5", "ADC3", "ADC3"},
- {"AMIC MUX5", "ADC4", "ADC4"},
-
- {"DMIC MUX6", "DMIC0", "DMIC0"},
- {"DMIC MUX6", "DMIC1", "DMIC1"},
- {"DMIC MUX6", "DMIC2", "DMIC2"},
- {"DMIC MUX6", "DMIC3", "DMIC3"},
- {"DMIC MUX6", "DMIC4", "DMIC4"},
- {"DMIC MUX6", "DMIC5", "DMIC5"},
- {"DMIC MUX6", "DMIC6", "DMIC6"},
- {"DMIC MUX6", "DMIC7", "DMIC7"},
- {"AMIC MUX6", "ADC1", "ADC1"},
- {"AMIC MUX6", "ADC2", "ADC2"},
- {"AMIC MUX6", "ADC3", "ADC3"},
- {"AMIC MUX6", "ADC4", "ADC4"},
-
- {"DMIC MUX7", "DMIC0", "DMIC0"},
- {"DMIC MUX7", "DMIC1", "DMIC1"},
- {"DMIC MUX7", "DMIC2", "DMIC2"},
- {"DMIC MUX7", "DMIC3", "DMIC3"},
- {"DMIC MUX7", "DMIC4", "DMIC4"},
- {"DMIC MUX7", "DMIC5", "DMIC5"},
- {"DMIC MUX7", "DMIC6", "DMIC6"},
- {"DMIC MUX7", "DMIC7", "DMIC7"},
- {"AMIC MUX7", "ADC1", "ADC1"},
- {"AMIC MUX7", "ADC2", "ADC2"},
- {"AMIC MUX7", "ADC3", "ADC3"},
- {"AMIC MUX7", "ADC4", "ADC4"},
-
- {"DMIC MUX8", "DMIC0", "DMIC0"},
- {"DMIC MUX8", "DMIC1", "DMIC1"},
- {"DMIC MUX8", "DMIC2", "DMIC2"},
- {"DMIC MUX8", "DMIC3", "DMIC3"},
- {"DMIC MUX8", "DMIC4", "DMIC4"},
- {"DMIC MUX8", "DMIC5", "DMIC5"},
- {"DMIC MUX8", "DMIC6", "DMIC6"},
- {"DMIC MUX8", "DMIC7", "DMIC7"},
- {"AMIC MUX8", "ADC1", "ADC1"},
- {"AMIC MUX8", "ADC2", "ADC2"},
- {"AMIC MUX8", "ADC3", "ADC3"},
- {"AMIC MUX8", "ADC4", "ADC4"},
-
- {"DMIC MUX10", "DMIC0", "DMIC0"},
- {"DMIC MUX10", "DMIC1", "DMIC1"},
- {"DMIC MUX10", "DMIC2", "DMIC2"},
- {"DMIC MUX10", "DMIC3", "DMIC3"},
- {"DMIC MUX10", "DMIC4", "DMIC4"},
- {"DMIC MUX10", "DMIC5", "DMIC5"},
- {"DMIC MUX10", "DMIC6", "DMIC6"},
- {"DMIC MUX10", "DMIC7", "DMIC7"},
- {"AMIC MUX10", "ADC1", "ADC1"},
- {"AMIC MUX10", "ADC2", "ADC2"},
- {"AMIC MUX10", "ADC3", "ADC3"},
- {"AMIC MUX10", "ADC4", "ADC4"},
-
- {"DMIC MUX11", "DMIC0", "DMIC0"},
- {"DMIC MUX11", "DMIC1", "DMIC1"},
- {"DMIC MUX11", "DMIC2", "DMIC2"},
- {"DMIC MUX11", "DMIC3", "DMIC3"},
- {"DMIC MUX11", "DMIC4", "DMIC4"},
- {"DMIC MUX11", "DMIC5", "DMIC5"},
- {"DMIC MUX11", "DMIC6", "DMIC6"},
- {"DMIC MUX11", "DMIC7", "DMIC7"},
- {"AMIC MUX11", "ADC1", "ADC1"},
- {"AMIC MUX11", "ADC2", "ADC2"},
- {"AMIC MUX11", "ADC3", "ADC3"},
- {"AMIC MUX11", "ADC4", "ADC4"},
-
- {"ADC2_IN", "AMIC1", "AMIC1"},
- {"ADC2_IN", "AMIC2", "AMIC2"},
- {"ADC4_IN", "AMIC3", "AMIC3"},
- {"ADC4_IN", "AMIC4", "AMIC4"},
-
- {"ADC1", NULL, "AMIC1"},
- {"ADC2", NULL, "ADC2_IN"},
- {"ADC3", NULL, "AMIC3"},
- {"ADC4", NULL, "ADC4_IN"},
-
- {"ADC1", NULL, "LDO_RXTX"},
- {"ADC2", NULL, "LDO_RXTX"},
- {"ADC3", NULL, "LDO_RXTX"},
- {"ADC4", NULL, "LDO_RXTX"},
-
- {"RX INT0_1 MIX1 INP0", "RX0", "CDC_IF RX0 MUX"},
- {"RX INT0_1 MIX1 INP0", "RX1", "CDC_IF RX1 MUX"},
- {"RX INT0_1 MIX1 INP0", "RX2", "CDC_IF RX2 MUX"},
- {"RX INT0_1 MIX1 INP0", "RX3", "CDC_IF RX3 MUX"},
- {"RX INT0_1 MIX1 INP0", "RX4", "CDC_IF RX4 MUX"},
- {"RX INT0_1 MIX1 INP0", "RX5", "CDC_IF RX5 MUX"},
- {"RX INT0_1 MIX1 INP0", "RX6", "CDC_IF RX6 MUX"},
- {"RX INT0_1 MIX1 INP0", "RX7", "CDC_IF RX7 MUX"},
- {"RX INT0_1 MIX1 INP0", "IIR0", "IIR0"},
- {"RX INT0_1 MIX1 INP1", "RX0", "CDC_IF RX0 MUX"},
- {"RX INT0_1 MIX1 INP1", "RX1", "CDC_IF RX1 MUX"},
- {"RX INT0_1 MIX1 INP1", "RX2", "CDC_IF RX2 MUX"},
- {"RX INT0_1 MIX1 INP1", "RX3", "CDC_IF RX3 MUX"},
- {"RX INT0_1 MIX1 INP1", "RX4", "CDC_IF RX4 MUX"},
- {"RX INT0_1 MIX1 INP1", "RX5", "CDC_IF RX5 MUX"},
- {"RX INT0_1 MIX1 INP1", "RX6", "CDC_IF RX6 MUX"},
- {"RX INT0_1 MIX1 INP1", "RX7", "CDC_IF RX7 MUX"},
- {"RX INT0_1 MIX1 INP1", "IIR0", "IIR0"},
- {"RX INT0_1 MIX1 INP2", "RX0", "CDC_IF RX0 MUX"},
- {"RX INT0_1 MIX1 INP2", "RX1", "CDC_IF RX1 MUX"},
- {"RX INT0_1 MIX1 INP2", "RX2", "CDC_IF RX2 MUX"},
- {"RX INT0_1 MIX1 INP2", "RX3", "CDC_IF RX3 MUX"},
- {"RX INT0_1 MIX1 INP2", "RX4", "CDC_IF RX4 MUX"},
- {"RX INT0_1 MIX1 INP2", "RX5", "CDC_IF RX5 MUX"},
- {"RX INT0_1 MIX1 INP2", "RX6", "CDC_IF RX6 MUX"},
- {"RX INT0_1 MIX1 INP2", "RX7", "CDC_IF RX7 MUX"},
- {"RX INT0_1 MIX1 INP2", "IIR0", "IIR0"},
-
- {"RX INT7_1 MIX1 INP0", "RX0", "CDC_IF RX0 MUX"},
- {"RX INT7_1 MIX1 INP0", "RX1", "CDC_IF RX1 MUX"},
- {"RX INT7_1 MIX1 INP0", "RX2", "CDC_IF RX2 MUX"},
- {"RX INT7_1 MIX1 INP0", "RX3", "CDC_IF RX3 MUX"},
- {"RX INT7_1 MIX1 INP0", "RX4", "CDC_IF RX4 MUX"},
- {"RX INT7_1 MIX1 INP0", "RX5", "CDC_IF RX5 MUX"},
- {"RX INT7_1 MIX1 INP0", "RX6", "CDC_IF RX6 MUX"},
- {"RX INT7_1 MIX1 INP0", "RX7", "CDC_IF RX7 MUX"},
- {"RX INT7_1 MIX1 INP0", "IIR0", "IIR0"},
- {"RX INT7_1 MIX1 INP1", "RX0", "CDC_IF RX0 MUX"},
- {"RX INT7_1 MIX1 INP1", "RX1", "CDC_IF RX1 MUX"},
- {"RX INT7_1 MIX1 INP1", "RX2", "CDC_IF RX2 MUX"},
- {"RX INT7_1 MIX1 INP1", "RX3", "CDC_IF RX3 MUX"},
- {"RX INT7_1 MIX1 INP1", "RX4", "CDC_IF RX4 MUX"},
- {"RX INT7_1 MIX1 INP1", "RX5", "CDC_IF RX5 MUX"},
- {"RX INT7_1 MIX1 INP1", "RX6", "CDC_IF RX6 MUX"},
- {"RX INT7_1 MIX1 INP1", "RX7", "CDC_IF RX7 MUX"},
- {"RX INT7_1 MIX1 INP1", "IIR0", "IIR0"},
- {"RX INT7_1 MIX1 INP2", "RX0", "CDC_IF RX0 MUX"},
- {"RX INT7_1 MIX1 INP2", "RX1", "CDC_IF RX1 MUX"},
- {"RX INT7_1 MIX1 INP2", "RX2", "CDC_IF RX2 MUX"},
- {"RX INT7_1 MIX1 INP2", "RX3", "CDC_IF RX3 MUX"},
- {"RX INT7_1 MIX1 INP2", "RX4", "CDC_IF RX4 MUX"},
- {"RX INT7_1 MIX1 INP2", "RX5", "CDC_IF RX5 MUX"},
- {"RX INT7_1 MIX1 INP2", "RX6", "CDC_IF RX6 MUX"},
- {"RX INT7_1 MIX1 INP2", "RX7", "CDC_IF RX7 MUX"},
- {"RX INT7_1 MIX1 INP2", "IIR0", "IIR0"},
-
- {"RX INT8_1 MIX1 INP0", "RX0", "CDC_IF RX0 MUX"},
- {"RX INT8_1 MIX1 INP0", "RX1", "CDC_IF RX1 MUX"},
- {"RX INT8_1 MIX1 INP0", "RX2", "CDC_IF RX2 MUX"},
- {"RX INT8_1 MIX1 INP0", "RX3", "CDC_IF RX3 MUX"},
- {"RX INT8_1 MIX1 INP0", "RX4", "CDC_IF RX4 MUX"},
- {"RX INT8_1 MIX1 INP0", "RX5", "CDC_IF RX5 MUX"},
- {"RX INT8_1 MIX1 INP0", "RX6", "CDC_IF RX6 MUX"},
- {"RX INT8_1 MIX1 INP0", "RX7", "CDC_IF RX7 MUX"},
- {"RX INT8_1 MIX1 INP0", "IIR0", "IIR0"},
- {"RX INT8_1 MIX1 INP1", "RX0", "CDC_IF RX0 MUX"},
- {"RX INT8_1 MIX1 INP1", "RX1", "CDC_IF RX1 MUX"},
- {"RX INT8_1 MIX1 INP1", "RX2", "CDC_IF RX2 MUX"},
- {"RX INT8_1 MIX1 INP1", "RX3", "CDC_IF RX3 MUX"},
- {"RX INT8_1 MIX1 INP1", "RX4", "CDC_IF RX4 MUX"},
- {"RX INT8_1 MIX1 INP1", "RX5", "CDC_IF RX5 MUX"},
- {"RX INT8_1 MIX1 INP1", "RX6", "CDC_IF RX6 MUX"},
- {"RX INT8_1 MIX1 INP1", "RX7", "CDC_IF RX7 MUX"},
- {"RX INT8_1 MIX1 INP1", "IIR0", "IIR0"},
- {"RX INT8_1 MIX1 INP2", "RX0", "CDC_IF RX0 MUX"},
- {"RX INT8_1 MIX1 INP2", "RX1", "CDC_IF RX1 MUX"},
- {"RX INT8_1 MIX1 INP2", "RX2", "CDC_IF RX2 MUX"},
- {"RX INT8_1 MIX1 INP2", "RX3", "CDC_IF RX3 MUX"},
- {"RX INT8_1 MIX1 INP2", "RX4", "CDC_IF RX4 MUX"},
- {"RX INT8_1 MIX1 INP2", "RX5", "CDC_IF RX5 MUX"},
- {"RX INT8_1 MIX1 INP2", "RX6", "CDC_IF RX6 MUX"},
- {"RX INT8_1 MIX1 INP2", "RX7", "CDC_IF RX7 MUX"},
- {"RX INT8_1 MIX1 INP2", "IIR0", "IIR0"},
-
- {"RX INT9_1 MIX1 INP0", "RX0", "CDC_IF RX0 MUX"},
- {"RX INT9_1 MIX1 INP0", "RX1", "CDC_IF RX1 MUX"},
- {"RX INT9_1 MIX1 INP0", "RX2", "CDC_IF RX2 MUX"},
- {"RX INT9_1 MIX1 INP0", "RX3", "CDC_IF RX3 MUX"},
- {"RX INT9_1 MIX1 INP0", "RX4", "CDC_IF RX4 MUX"},
- {"RX INT9_1 MIX1 INP0", "RX5", "CDC_IF RX5 MUX"},
- {"RX INT9_1 MIX1 INP0", "RX6", "CDC_IF RX6 MUX"},
- {"RX INT9_1 MIX1 INP0", "RX7", "CDC_IF RX7 MUX"},
- {"RX INT9_1 MIX1 INP0", "IIR0", "IIR0"},
- {"RX INT9_1 MIX1 INP1", "RX0", "CDC_IF RX0 MUX"},
- {"RX INT9_1 MIX1 INP1", "RX1", "CDC_IF RX1 MUX"},
- {"RX INT9_1 MIX1 INP1", "RX2", "CDC_IF RX2 MUX"},
- {"RX INT9_1 MIX1 INP1", "RX3", "CDC_IF RX3 MUX"},
- {"RX INT9_1 MIX1 INP1", "RX4", "CDC_IF RX4 MUX"},
- {"RX INT9_1 MIX1 INP1", "RX5", "CDC_IF RX5 MUX"},
- {"RX INT9_1 MIX1 INP1", "RX6", "CDC_IF RX6 MUX"},
- {"RX INT9_1 MIX1 INP1", "RX7", "CDC_IF RX7 MUX"},
- {"RX INT9_1 MIX1 INP1", "IIR0", "IIR0"},
- {"RX INT9_1 MIX1 INP2", "RX0", "CDC_IF RX0 MUX"},
- {"RX INT9_1 MIX1 INP2", "RX1", "CDC_IF RX1 MUX"},
- {"RX INT9_1 MIX1 INP2", "RX2", "CDC_IF RX2 MUX"},
- {"RX INT9_1 MIX1 INP2", "RX3", "CDC_IF RX3 MUX"},
- {"RX INT9_1 MIX1 INP2", "RX4", "CDC_IF RX4 MUX"},
- {"RX INT9_1 MIX1 INP2", "RX5", "CDC_IF RX5 MUX"},
- {"RX INT9_1 MIX1 INP2", "RX6", "CDC_IF RX6 MUX"},
- {"RX INT9_1 MIX1 INP2", "RX7", "CDC_IF RX7 MUX"},
- {"RX INT9_1 MIX1 INP2", "IIR0", "IIR0"},
-
- {"RX INT0_1 MIX1", NULL, "RX INT0_1 MIX1 INP0"},
- {"RX INT0_1 MIX1", NULL, "RX INT0_1 MIX1 INP1"},
- {"RX INT0_1 MIX1", NULL, "RX INT0_1 MIX1 INP2"},
- {"RX INT7_1 MIX1", NULL, "RX INT7_1 MIX1 INP0"},
- {"RX INT7_1 MIX1", NULL, "RX INT7_1 MIX1 INP1"},
- {"RX INT7_1 MIX1", NULL, "RX INT7_1 MIX1 INP2"},
- {"RX INT8_1 MIX1", NULL, "RX INT8_1 MIX1 INP0"},
- {"RX INT8_1 MIX1", NULL, "RX INT8_1 MIX1 INP1"},
- {"RX INT8_1 MIX1", NULL, "RX INT8_1 MIX1 INP2"},
- {"RX INT9_1 MIX1", NULL, "RX INT9_1 MIX1 INP0"},
- {"RX INT9_1 MIX1", NULL, "RX INT9_1 MIX1 INP1"},
- {"RX INT9_1 MIX1", NULL, "RX INT9_1 MIX1 INP2"},
-
- /* Mixing path INT0 */
- {"RX INT0_2 MUX", "RX0", "CDC_IF RX0 MUX"},
- {"RX INT0_2 MUX", "RX1", "CDC_IF RX1 MUX"},
- {"RX INT0_2 MUX", "RX2", "CDC_IF RX2 MUX"},
- {"RX INT0_2 MUX", "RX3", "CDC_IF RX3 MUX"},
- {"RX INT0_2 MUX", "RX4", "CDC_IF RX4 MUX"},
- {"RX INT0_2 MUX", "RX5", "CDC_IF RX5 MUX"},
- {"RX INT0_2 MUX", "RX6", "CDC_IF RX6 MUX"},
- {"RX INT0_2 MUX", "RX7", "CDC_IF RX7 MUX"},
- {"RX INT0_2 INTERP", NULL, "RX INT0_2 MUX"},
- {"RX INT0 SEC MIX", NULL, "RX INT0_2 INTERP"},
-
- /* Mixing path INT7 */
- {"RX INT7_2 MUX", "RX0", "CDC_IF RX0 MUX"},
- {"RX INT7_2 MUX", "RX1", "CDC_IF RX1 MUX"},
- {"RX INT7_2 MUX", "RX2", "CDC_IF RX2 MUX"},
- {"RX INT7_2 MUX", "RX3", "CDC_IF RX3 MUX"},
- {"RX INT7_2 MUX", "RX4", "CDC_IF RX4 MUX"},
- {"RX INT7_2 MUX", "RX5", "CDC_IF RX5 MUX"},
- {"RX INT7_2 MUX", "RX6", "CDC_IF RX6 MUX"},
- {"RX INT7_2 MUX", "RX7", "CDC_IF RX7 MUX"},
- {"RX INT7_2 INTERP", NULL, "RX INT7_2 MUX"},
- {"RX INT7 SEC MIX", NULL, "RX INT7_2 INTERP"},
-
- /* Mixing path INT8 */
- {"RX INT8_2 MUX", "RX0", "CDC_IF RX0 MUX"},
- {"RX INT8_2 MUX", "RX1", "CDC_IF RX1 MUX"},
- {"RX INT8_2 MUX", "RX2", "CDC_IF RX2 MUX"},
- {"RX INT8_2 MUX", "RX3", "CDC_IF RX3 MUX"},
- {"RX INT8_2 MUX", "RX4", "CDC_IF RX4 MUX"},
- {"RX INT8_2 MUX", "RX5", "CDC_IF RX5 MUX"},
- {"RX INT8_2 MUX", "RX6", "CDC_IF RX6 MUX"},
- {"RX INT8_2 MUX", "RX7", "CDC_IF RX7 MUX"},
- {"RX INT8_2 INTERP", NULL, "RX INT8_2 MUX"},
- {"RX INT8 SEC MIX", NULL, "RX INT8_2 INTERP"},
-
- /* Mixing path INT9 */
- {"RX INT9_2 MUX", "RX0", "CDC_IF RX0 MUX"},
- {"RX INT9_2 MUX", "RX1", "CDC_IF RX1 MUX"},
- {"RX INT9_2 MUX", "RX2", "CDC_IF RX2 MUX"},
- {"RX INT9_2 MUX", "RX3", "CDC_IF RX3 MUX"},
- {"RX INT9_2 MUX", "RX4", "CDC_IF RX4 MUX"},
- {"RX INT9_2 MUX", "RX5", "CDC_IF RX5 MUX"},
- {"RX INT9_2 MUX", "RX6", "CDC_IF RX6 MUX"},
- {"RX INT9_2 MUX", "RX7", "CDC_IF RX7 MUX"},
- {"RX INT9_2 INTERP", NULL, "RX INT9_2 MUX"},
- {"RX INT9 SEC MIX", NULL, "RX INT9_2 INTERP"},
-
- {"RX INT0_1 INTERP", NULL, "RX INT0_1 MIX1"},
- {"RX INT0 SEC MIX", NULL, "RX INT0_1 INTERP"},
- {"RX INT0 MIX2", NULL, "RX INT0 SEC MIX"},
- {"RX INT0 MIX2", NULL, "RX INT0 MIX2 INP"},
- {"RX INT0 DEM MUX", NULL, "RX INT0 MIX2"},
- {"RX INT0 DAC", NULL, "RX INT0 DEM MUX"},
- {"RX INT0 DAC", NULL, "LDO_RXTX"},
- {"EAR PA", NULL, "RX INT0 DAC"},
- {"EAR", NULL, "EAR PA"},
-
- {"RX INT7_1 INTERP", NULL, "RX INT7_1 MIX1"},
- {"RX INT7 SEC MIX", NULL, "RX INT7_1 INTERP"},
- {"RX INT7 MIX2", NULL, "RX INT7 SEC MIX"},
- {"RX INT7 MIX2", NULL, "RX INT7 MIX2 INP"},
- {"RX INT7 CHAIN", NULL, "RX INT7 MIX2"},
- {"SPK1 OUT", NULL, "RX INT7 CHAIN"},
-
- {"RX INT8_1 INTERP", NULL, "RX INT8_1 MIX1"},
- {"RX INT8 SEC MIX", NULL, "RX INT8_1 INTERP"},
- {"RX INT8 SEC MIX", NULL, "RX INT8_1 MIX1"},
- {"RX INT8 CHAIN", NULL, "RX INT8 SEC MIX"},
- {"SPK2 OUT", NULL, "RX INT8 CHAIN"},
-
- {"RX INT9_1 INTERP", NULL, "RX INT9_1 MIX1"},
- {"RX INT9 SEC MIX", NULL, "RX INT9_1 INTERP"},
- {"RX INT9 MIX2", NULL, "RX INT9 SEC MIX"},
- {"RX INT9 MIX2", NULL, "RX INT9 MIX2 INP"},
- {"RX INT9 DEM MUX", NULL, "RX INT9 MIX2"},
- {"RX INT9 DAC", NULL, "RX INT9 DEM MUX"},
- {"RX INT9 DAC", NULL, "LDO_RXTX"},
- {"AUX PA", NULL, "RX INT9 DAC"},
- {"AUX", NULL, "AUX PA"},
-
- /* ANC Routing */
- {"ANC0 FB MUX", "ANC_IN_EAR", "RX INT0 MIX2"},
- {"ANC0 FB MUX", "ANC_IN_EAR_SPKR", "RX INT7 MIX2"},
-
- {"ANC OUT EAR Enable", "Switch", "ADC MUX10"},
- {"ANC OUT EAR Enable", "Switch", "ADC MUX11"},
- {"RX INT0 MIX2", NULL, "ANC OUT EAR Enable"},
-
- {"ANC EAR PA", NULL, "RX INT0 DAC"},
- {"ANC EAR", NULL, "ANC EAR PA"},
-
- {"ANC OUT EAR SPKR Enable", "Switch", "ADC MUX10"},
- {"ANC OUT EAR SPKR Enable", "Switch", "ADC MUX11"},
- {"RX INT7 MIX2", NULL, "ANC OUT EAR SPKR Enable"},
-
- {"ANC SPKR PA Enable", "Switch", "RX INT7 CHAIN"},
- {"ANC SPK1 PA", NULL, "ANC SPKR PA Enable"},
- {"SPK1 OUT", NULL, "ANC SPK1 PA"},
-
- /*
- * SRC0 input to Sidetone RX Mixer
- * on RX0, RX1, RX2, RX3, RX4 and RX7 chains
- */
- {"IIR0", NULL, "IIR0 INP0 MUX"},
- {"IIR0 INP0 MUX", "DEC0", "ADC MUX0"},
- {"IIR0 INP0 MUX", "DEC1", "ADC MUX1"},
- {"IIR0 INP0 MUX", "DEC2", "ADC MUX2"},
- {"IIR0 INP0 MUX", "DEC3", "ADC MUX3"},
- {"IIR0 INP0 MUX", "DEC4", "ADC MUX4"},
- {"IIR0 INP0 MUX", "DEC5", "ADC MUX5"},
- {"IIR0 INP0 MUX", "DEC6", "ADC MUX6"},
- {"IIR0 INP0 MUX", "DEC7", "ADC MUX7"},
- {"IIR0 INP0 MUX", "DEC8", "ADC MUX8"},
- {"IIR0 INP0 MUX", "RX0", "CDC_IF RX0 MUX"},
- {"IIR0 INP0 MUX", "RX1", "CDC_IF RX1 MUX"},
- {"IIR0 INP0 MUX", "RX2", "CDC_IF RX2 MUX"},
- {"IIR0 INP0 MUX", "RX3", "CDC_IF RX3 MUX"},
- {"IIR0 INP0 MUX", "RX4", "CDC_IF RX4 MUX"},
- {"IIR0 INP0 MUX", "RX5", "CDC_IF RX5 MUX"},
- {"IIR0 INP0 MUX", "RX6", "CDC_IF RX6 MUX"},
- {"IIR0 INP0 MUX", "RX7", "CDC_IF RX7 MUX"},
- {"IIR0", NULL, "IIR0 INP1 MUX"},
- {"IIR0 INP1 MUX", "DEC0", "ADC MUX0"},
- {"IIR0 INP1 MUX", "DEC1", "ADC MUX1"},
- {"IIR0 INP1 MUX", "DEC2", "ADC MUX2"},
- {"IIR0 INP1 MUX", "DEC3", "ADC MUX3"},
- {"IIR0 INP1 MUX", "DEC4", "ADC MUX4"},
- {"IIR0 INP1 MUX", "DEC5", "ADC MUX5"},
- {"IIR0 INP1 MUX", "DEC6", "ADC MUX6"},
- {"IIR0 INP1 MUX", "DEC7", "ADC MUX7"},
- {"IIR0 INP1 MUX", "DEC8", "ADC MUX8"},
- {"IIR0 INP1 MUX", "RX0", "CDC_IF RX0 MUX"},
- {"IIR0 INP1 MUX", "RX1", "CDC_IF RX1 MUX"},
- {"IIR0 INP1 MUX", "RX2", "CDC_IF RX2 MUX"},
- {"IIR0 INP1 MUX", "RX3", "CDC_IF RX3 MUX"},
- {"IIR0 INP1 MUX", "RX4", "CDC_IF RX4 MUX"},
- {"IIR0 INP1 MUX", "RX5", "CDC_IF RX5 MUX"},
- {"IIR0 INP1 MUX", "RX6", "CDC_IF RX6 MUX"},
- {"IIR0 INP1 MUX", "RX7", "CDC_IF RX7 MUX"},
- {"IIR0", NULL, "IIR0 INP2 MUX"},
- {"IIR0 INP2 MUX", "DEC0", "ADC MUX0"},
- {"IIR0 INP2 MUX", "DEC1", "ADC MUX1"},
- {"IIR0 INP2 MUX", "DEC2", "ADC MUX2"},
- {"IIR0 INP2 MUX", "DEC3", "ADC MUX3"},
- {"IIR0 INP2 MUX", "DEC4", "ADC MUX4"},
- {"IIR0 INP2 MUX", "DEC5", "ADC MUX5"},
- {"IIR0 INP2 MUX", "DEC6", "ADC MUX6"},
- {"IIR0 INP2 MUX", "DEC7", "ADC MUX7"},
- {"IIR0 INP2 MUX", "DEC8", "ADC MUX8"},
- {"IIR0 INP2 MUX", "RX0", "CDC_IF RX0 MUX"},
- {"IIR0 INP2 MUX", "RX1", "CDC_IF RX1 MUX"},
- {"IIR0 INP2 MUX", "RX2", "CDC_IF RX2 MUX"},
- {"IIR0 INP2 MUX", "RX3", "CDC_IF RX3 MUX"},
- {"IIR0 INP2 MUX", "RX4", "CDC_IF RX4 MUX"},
- {"IIR0 INP2 MUX", "RX5", "CDC_IF RX5 MUX"},
- {"IIR0 INP2 MUX", "RX6", "CDC_IF RX6 MUX"},
- {"IIR0 INP2 MUX", "RX7", "CDC_IF RX7 MUX"},
- {"IIR0", NULL, "IIR0 INP3 MUX"},
- {"IIR0 INP3 MUX", "DEC0", "ADC MUX0"},
- {"IIR0 INP3 MUX", "DEC1", "ADC MUX1"},
- {"IIR0 INP3 MUX", "DEC2", "ADC MUX2"},
- {"IIR0 INP3 MUX", "DEC3", "ADC MUX3"},
- {"IIR0 INP3 MUX", "DEC4", "ADC MUX4"},
- {"IIR0 INP3 MUX", "DEC5", "ADC MUX5"},
- {"IIR0 INP3 MUX", "DEC6", "ADC MUX6"},
- {"IIR0 INP3 MUX", "DEC7", "ADC MUX7"},
- {"IIR0 INP3 MUX", "DEC8", "ADC MUX8"},
- {"IIR0 INP3 MUX", "RX0", "CDC_IF RX0 MUX"},
- {"IIR0 INP3 MUX", "RX1", "CDC_IF RX1 MUX"},
- {"IIR0 INP3 MUX", "RX2", "CDC_IF RX2 MUX"},
- {"IIR0 INP3 MUX", "RX3", "CDC_IF RX3 MUX"},
- {"IIR0 INP3 MUX", "RX4", "CDC_IF RX4 MUX"},
- {"IIR0 INP3 MUX", "RX5", "CDC_IF RX5 MUX"},
- {"IIR0 INP3 MUX", "RX6", "CDC_IF RX6 MUX"},
- {"IIR0 INP3 MUX", "RX7", "CDC_IF RX7 MUX"},
-
- {"SRC0", NULL, "IIR0"},
- {"RX INT0 MIX2 INP", "SRC0", "SRC0"},
- {"RX INT7 MIX2 INP", "SRC0", "SRC0"},
- {"RX INT9 MIX2 INP", "SRC0", "SRC0"},
-
- /* Native clk mix path routing */
- {"RX INT7_2 NATIVE MUX", "ON", "RX INT7_2 MUX"},
- {"RX INT7_2 INTERP", NULL, "RX INT7_2 NATIVE MUX"},
- {"RX INT7_2 NATIVE MUX", NULL, "RX INT7 NATIVE SUPPLY"},
-
- {"RX INT8_2 NATIVE MUX", "ON", "RX INT8_2 MUX"},
- {"RX INT8_2 INTERP", NULL, "RX INT8_2 NATIVE MUX"},
- {"RX INT8_2 NATIVE MUX", NULL, "RX INT8 NATIVE SUPPLY"},
-
- /* ASRC Routing */
- {"ASRC2 MUX", "ASRC_IN_SPKR1", "RX INT7_2 INTERP"},
- {"RX INT7 SEC MIX", NULL, "ASRC2 MUX"},
-
- {"ASRC3 MUX", "ASRC_IN_SPKR2", "RX INT8_2 INTERP"},
- {"RX INT8 SEC MIX", NULL, "ASRC3 MUX"},
-
- /* SLIMBUS-I2S Bridge interface */
- {"I2S TX1_0 MUX", "SB_RX2", "SLIM RX2"},
-
- {"I2S TX1_1 MUX", "SB_RX0", "SLIM RX0"},
- {"I2S TX1_1 MUX", "SB_RX1", "SLIM RX1"},
- {"I2S TX1_1 MUX", "SB_RX2", "SLIM RX2"},
- {"I2S TX1_1 MUX", "SB_RX3", "SLIM RX3"},
-
- {"I2S TX1 MIXER", NULL, "I2S TX1_0 MUX"},
- {"I2S TX1 MIXER", NULL, "I2S TX1_1 MUX"},
- {"I2S1 CAP", NULL, "I2S TX1 MIXER"},
-
- {"CDC_IF TX10 MUX2", "I2SRX1_0_BRDG", "CDC_IF RX2 MUX"},
- {"CDC_IF TX11 MUX2", "I2SRX1_1_BRDG", "CDC_IF RX3 MUX"},
- {"CDC_IF RX2 MUX", "I2SRX1_0", "I2S1 PB"},
- {"CDC_IF RX3 MUX", "I2SRX1_1", "I2S1 PB"},
-};
-
-#endif
diff --git a/asoc/codecs/wcd9360/wcd9360.c b/asoc/codecs/wcd9360/wcd9360.c
deleted file mode 100644
index 075a77f..0000000
--- a/asoc/codecs/wcd9360/wcd9360.c
+++ /dev/null
@@ -1,8101 +0,0 @@
-/* Copyright (c) 2015-2018, 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.
- */
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/firmware.h>
-#include <linux/slab.h>
-#include <linux/platform_device.h>
-#include <linux/device.h>
-#include <linux/printk.h>
-#include <linux/ratelimit.h>
-#include <linux/wait.h>
-#include <linux/bitops.h>
-#include <linux/clk.h>
-#include <linux/delay.h>
-#include <linux/pm_runtime.h>
-#include <linux/kernel.h>
-#include <linux/gpio.h>
-#include <linux/regmap.h>
-#include <linux/spi/spi.h>
-#include <linux/regulator/consumer.h>
-#include <linux/mfd/wcd9xxx/wcd9xxx_registers.h>
-#include <soc/swr-wcd.h>
-#include <sound/pcm.h>
-#include <sound/pcm_params.h>
-#include <sound/soc.h>
-#include <sound/soc-dapm.h>
-#include <sound/tlv.h>
-#include <sound/info.h>
-#include <asoc/wcd9360-registers.h>
-#include "wcd9360.h"
-#include "wcd9360-routing.h"
-#include "wcd9360-dsp-cntl.h"
-#include "wcd9360-irq.h"
-#include "../core.h"
-#include "../pdata.h"
-#include "../wcd9xxx-irq.h"
-#include "../wcd9xxx-common-v2.h"
-#include "../wcd9xxx-resmgr-v2.h"
-#include "../wcdcal-hwdep.h"
-#include "../msm-cdc-supply.h"
-
-
-#define WCD9360_RATES_MASK (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\
- SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000 |\
- SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_192000 |\
- SNDRV_PCM_RATE_384000)
-/* Fractional Rates */
-#define WCD9360_FRAC_RATES_MASK (SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_88200 |\
- SNDRV_PCM_RATE_176400)
-
-#define WCD9360_FORMATS_S16_S24_LE (SNDRV_PCM_FMTBIT_S16_LE | \
- SNDRV_PCM_FMTBIT_S24_LE)
-
-#define WCD9360_FORMATS_S16_S24_S32_LE (SNDRV_PCM_FMTBIT_S16_LE | \
- SNDRV_PCM_FMTBIT_S24_LE | \
- SNDRV_PCM_FMTBIT_S32_LE)
-
-#define WCD9360_FORMATS_S16_LE (SNDRV_PCM_FMTBIT_S16_LE)
-
-/* Macros for packing register writes into a U32 */
-#define WCD9360_PACKED_REG_SIZE sizeof(u32)
-#define WCD9360_CODEC_UNPACK_ENTRY(packed, reg, mask, val) \
- do { \
- ((reg) = ((packed >> 16) & (0xffff))); \
- ((mask) = ((packed >> 8) & (0xff))); \
- ((val) = ((packed) & (0xff))); \
- } while (0)
-
-#define STRING(name) #name
-#define WCD_DAPM_ENUM(name, reg, offset, text) \
-static SOC_ENUM_SINGLE_DECL(name##_enum, reg, offset, text); \
-static const struct snd_kcontrol_new name##_mux = \
- SOC_DAPM_ENUM(STRING(name), name##_enum)
-
-#define WCD_DAPM_ENUM_EXT(name, reg, offset, text, getname, putname) \
-static SOC_ENUM_SINGLE_DECL(name##_enum, reg, offset, text); \
-static const struct snd_kcontrol_new name##_mux = \
- SOC_DAPM_ENUM_EXT(STRING(name), name##_enum, getname, putname)
-
-#define WCD_DAPM_MUX(name, shift, kctl) \
- SND_SOC_DAPM_MUX(name, SND_SOC_NOPM, shift, 0, &kctl##_mux)
-
-/*
- * Timeout in milli seconds and it is the wait time for
- * slim channel removal interrupt to receive.
- */
-#define WCD9360_SLIM_CLOSE_TIMEOUT 1000
-#define WCD9360_SLIM_IRQ_OVERFLOW (1 << 0)
-#define WCD9360_SLIM_IRQ_UNDERFLOW (1 << 1)
-#define WCD9360_SLIM_IRQ_PORT_CLOSED (1 << 2)
-
-#define WCD9360_MCLK_CLK_9P6MHZ 9600000
-
-#define WCD9360_INTERP_MUX_NUM_INPUTS 3
-#define WCD9360_NUM_INTERPOLATORS 10
-#define WCD9360_NUM_DECIMATORS 9
-#define WCD9360_RX_PATH_CTL_OFFSET 20
-#define WCD9360_TLMM_DMIC_PINCFG_OFFSET 15
-
-#define BYTE_BIT_MASK(nr) (1 << ((nr) % BITS_PER_BYTE))
-
-#define WCD9360_REG_BITS 8
-#define WCD9360_MAX_VALID_ADC_MUX 11
-#define WCD9360_INVALID_ADC_MUX 9
-
-#define WCD9360_AMIC_PWR_LEVEL_LP 0
-#define WCD9360_AMIC_PWR_LEVEL_DEFAULT 1
-#define WCD9360_AMIC_PWR_LEVEL_HP 2
-#define WCD9360_AMIC_PWR_LVL_MASK 0x60
-#define WCD9360_AMIC_PWR_LVL_SHIFT 0x5
-
-#define WCD9360_DEC_PWR_LVL_MASK 0x06
-#define WCD9360_DEC_PWR_LVL_LP 0x02
-#define WCD9360_DEC_PWR_LVL_HP 0x04
-#define WCD9360_DEC_PWR_LVL_DF 0x00
-#define WCD9360_STRING_LEN 100
-
-#define WCD9360_CDC_SIDETONE_IIR_COEFF_MAX 5
-#define WCD9360_CDC_REPEAT_WRITES_MAX 16
-#define WCD9360_DIG_CORE_REG_MIN WCD9360_CDC_ANC0_CLK_RESET_CTL
-#define WCD9360_DIG_CORE_REG_MAX 0xFFF
-
-#define WCD9360_CHILD_DEVICES_MAX 6
-
-#define WCD9360_MAX_MICBIAS 4
-#define DAPM_MICBIAS1_STANDALONE "MIC BIAS1 Standalone"
-#define DAPM_MICBIAS2_STANDALONE "MIC BIAS2 Standalone"
-#define DAPM_MICBIAS3_STANDALONE "MIC BIAS3 Standalone"
-#define DAPM_MICBIAS4_STANDALONE "MIC BIAS4 Standalone"
-
-#define WCD9360_LDO_RXTX_SUPPLY_NAME "cdc-vdd-ldo-rxtx"
-
-#define TX_HPF_CUT_OFF_FREQ_MASK 0x60
-#define CF_MIN_3DB_4HZ 0x0
-#define CF_MIN_3DB_75HZ 0x1
-#define CF_MIN_3DB_150HZ 0x2
-
-#define CPE_ERR_WDOG_BITE BIT(0)
-#define CPE_FATAL_IRQS CPE_ERR_WDOG_BITE
-
-#define WCD9360_MAD_AUDIO_FIRMWARE_PATH "wcd9360/wcd9360_mad_audio.bin"
-
-#define PAHU_VERSION_ENTRY_SIZE 17
-
-#define WCD9360_DIG_CORE_COLLAPSE_TIMER_MS (5 * 1000)
-
-enum {
- INTERP_EAR = 0,
- /* Headset and Lineout are not avalible in pahu */
- INTERP_HPHL_NA,
- INTERP_HPHR_NA,
- INTERP_LO1_NA,
- INTERP_LO2_NA,
- INTERP_LO3_NA,
- INTERP_LO4_NA,
- INTERP_SPKR1,
- INTERP_SPKR2,
- INTERP_AUX,
- INTERP_MAX,
-};
-
-enum {
- POWER_COLLAPSE,
- POWER_RESUME,
-};
-
-static int dig_core_collapse_enable = 1;
-module_param(dig_core_collapse_enable, int, 0664);
-MODULE_PARM_DESC(dig_core_collapse_enable, "enable/disable power gating");
-
-/* dig_core_collapse timer in seconds */
-static int dig_core_collapse_timer = (WCD9360_DIG_CORE_COLLAPSE_TIMER_MS/1000);
-module_param(dig_core_collapse_timer, int, 0664);
-MODULE_PARM_DESC(dig_core_collapse_timer, "timer for power gating");
-
-enum {
- VI_SENSE_1,
- VI_SENSE_2,
- CLK_INTERNAL,
- CLK_MODE,
-};
-
-enum {
- AIF1_PB = 0,
- AIF1_CAP,
- AIF2_PB,
- AIF2_CAP,
- AIF3_PB,
- AIF3_CAP,
- AIF4_PB,
- AIF4_VIFEED,
- AIF4_MAD_TX,
- I2S1_PB,
- I2S1_CAP,
- NUM_CODEC_DAIS,
-};
-
-enum {
- INTn_1_INP_SEL_ZERO = 0,
- INTn_1_INP_SEL_DEC0,
- INTn_1_INP_SEL_DEC1,
- INTn_1_INP_SEL_IIR0,
- INTn_1_INP_SEL_NA,
- INTn_1_INP_SEL_RX0,
- INTn_1_INP_SEL_RX1,
- INTn_1_INP_SEL_RX2,
- INTn_1_INP_SEL_RX3,
- INTn_1_INP_SEL_RX4,
- INTn_1_INP_SEL_RX5,
- INTn_1_INP_SEL_RX6,
- INTn_1_INP_SEL_RX7,
-};
-
-enum {
- INTn_2_INP_SEL_ZERO = 0,
- INTn_2_INP_SEL_RX0,
- INTn_2_INP_SEL_RX1,
- INTn_2_INP_SEL_RX2,
- INTn_2_INP_SEL_RX3,
- INTn_2_INP_SEL_RX4,
- INTn_2_INP_SEL_RX5,
- INTn_2_INP_SEL_RX6,
- INTn_2_INP_SEL_RX7,
- INTn_2_INP_SEL_PROXIMITY,
-};
-
-enum {
- INTERP_MAIN_PATH,
- INTERP_MIX_PATH,
-};
-
-struct pahu_cpr_reg_defaults {
- int wr_data;
- int wr_addr;
-};
-
-struct interp_sample_rate {
- int sample_rate;
- int rate_val;
-};
-
-static struct interp_sample_rate sr_val_tbl[] = {
- {8000, 0x0}, {16000, 0x1}, {32000, 0x3}, {48000, 0x4}, {96000, 0x5},
- {192000, 0x6}, {384000, 0x7}, {44100, 0x9}, {88200, 0xA},
- {176400, 0xB}, {352800, 0xC},
-};
-
-static const struct wcd9xxx_ch pahu_rx_chs[WCD9360_RX_MAX] = {
- WCD9XXX_CH(WCD9360_RX_PORT_START_NUMBER, 0),
- WCD9XXX_CH(WCD9360_RX_PORT_START_NUMBER + 1, 1),
- WCD9XXX_CH(WCD9360_RX_PORT_START_NUMBER + 2, 2),
- WCD9XXX_CH(WCD9360_RX_PORT_START_NUMBER + 3, 3),
- WCD9XXX_CH(WCD9360_RX_PORT_START_NUMBER + 4, 4),
- WCD9XXX_CH(WCD9360_RX_PORT_START_NUMBER + 5, 5),
- WCD9XXX_CH(WCD9360_RX_PORT_START_NUMBER + 6, 6),
- WCD9XXX_CH(WCD9360_RX_PORT_START_NUMBER + 7, 7),
-};
-
-static const struct wcd9xxx_ch pahu_tx_chs[WCD9360_TX_MAX] = {
- WCD9XXX_CH(0, 0),
- WCD9XXX_CH(1, 1),
- WCD9XXX_CH(2, 2),
- WCD9XXX_CH(3, 3),
- WCD9XXX_CH(4, 4),
- WCD9XXX_CH(5, 5),
- WCD9XXX_CH(6, 6),
- WCD9XXX_CH(7, 7),
- WCD9XXX_CH(8, 8),
- WCD9XXX_CH(9, 9),
- WCD9XXX_CH(10, 10),
- WCD9XXX_CH(11, 11),
- WCD9XXX_CH(12, 12),
- WCD9XXX_CH(13, 13),
- WCD9XXX_CH(14, 14),
- WCD9XXX_CH(15, 15),
-};
-
-static const u32 vport_slim_check_table[NUM_CODEC_DAIS] = {
- 0, /* AIF1_PB */
- BIT(AIF2_CAP) | BIT(AIF3_CAP) | BIT(AIF4_MAD_TX), /* AIF1_CAP */
- 0, /* AIF2_PB */
- BIT(AIF1_CAP) | BIT(AIF3_CAP) | BIT(AIF4_MAD_TX), /* AIF2_CAP */
- 0, /* AIF3_PB */
- BIT(AIF1_CAP) | BIT(AIF2_CAP) | BIT(AIF4_MAD_TX), /* AIF3_CAP */
- 0, /* AIF4_PB */
-};
-
-/* Codec supports 2 IIR filters */
-enum {
- IIR0 = 0,
- IIR_MAX,
-};
-
-/* Each IIR has 5 Filter Stages */
-enum {
- BAND1 = 0,
- BAND2,
- BAND3,
- BAND4,
- BAND5,
- BAND_MAX,
-};
-
-enum {
- COMPANDER_0, /* EAR */
- COMPANDER_1, /* HPH_L */
- COMPANDER_2, /* HPH_R */
- COMPANDER_3, /* LO1_DIFF */
- COMPANDER_4, /* LO2_DIFF */
- COMPANDER_5, /* LO3_SE */
- COMPANDER_6, /* LO4_SE */
- COMPANDER_7, /* SWR SPK CH1 */
- COMPANDER_8, /* SWR SPK CH2 */
- COMPANDER_9, /* AUX */
- COMPANDER_MAX,
-};
-
-enum {
- ASRC_IN_SPKR1,
- ASRC_IN_SPKR2,
- ASRC_INVALID,
-};
-
-enum {
- ASRC2,
- ASRC3,
- ASRC_MAX,
-};
-
-enum {
- CONV_88P2K_TO_384K,
- CONV_96K_TO_352P8K,
- CONV_352P8K_TO_384K,
- CONV_384K_TO_352P8K,
- CONV_384K_TO_384K,
- CONV_96K_TO_384K,
-};
-
-static struct afe_param_slimbus_slave_port_cfg pahu_slimbus_slave_port_cfg = {
- .minor_version = 1,
- .slimbus_dev_id = AFE_SLIMBUS_DEVICE_1,
- .slave_dev_pgd_la = 0,
- .slave_dev_intfdev_la = 0,
- .bit_width = 16,
- .data_format = 0,
- .num_channels = 1
-};
-
-static struct afe_param_cdc_reg_page_cfg pahu_cdc_reg_page_cfg = {
- .minor_version = AFE_API_VERSION_CDC_REG_PAGE_CFG,
- .enable = 1,
- .proc_id = AFE_CDC_REG_PAGE_ASSIGN_PROC_ID_1,
-};
-
-static struct afe_param_cdc_reg_cfg audio_reg_cfg[] = {
- {
- 1,
- (WCD9360_REGISTER_START_OFFSET + WCD9360_SOC_MAD_MAIN_CTL_1),
- HW_MAD_AUDIO_ENABLE, 0x1, WCD9360_REG_BITS, 0
- },
- {
- 1,
- (WCD9360_REGISTER_START_OFFSET + WCD9360_SOC_MAD_AUDIO_CTL_3),
- HW_MAD_AUDIO_SLEEP_TIME, 0xF, WCD9360_REG_BITS, 0
- },
- {
- 1,
- (WCD9360_REGISTER_START_OFFSET + WCD9360_SOC_MAD_AUDIO_CTL_4),
- HW_MAD_TX_AUDIO_SWITCH_OFF, 0x1, WCD9360_REG_BITS, 0
- },
- {
- 1,
- (WCD9360_REGISTER_START_OFFSET + WCD9360_INTR_CFG),
- MAD_AUDIO_INT_DEST_SELECT_REG, 0x2, WCD9360_REG_BITS, 0
- },
- {
- 1,
- (WCD9360_REGISTER_START_OFFSET + WCD9360_INTR_PIN2_MASK3),
- MAD_AUDIO_INT_MASK_REG, 0x1, WCD9360_REG_BITS, 0
- },
- {
- 1,
- (WCD9360_REGISTER_START_OFFSET + WCD9360_INTR_PIN2_STATUS3),
- MAD_AUDIO_INT_STATUS_REG, 0x1, WCD9360_REG_BITS, 0
- },
- {
- 1,
- (WCD9360_REGISTER_START_OFFSET + WCD9360_INTR_PIN2_CLEAR3),
- MAD_AUDIO_INT_CLEAR_REG, 0x1, WCD9360_REG_BITS, 0
- },
- {
- 1,
- (WCD9360_REGISTER_START_OFFSET + WCD9360_SB_PGD_PORT_TX_BASE),
- SB_PGD_PORT_TX_WATERMARK_N, 0x1E, WCD9360_REG_BITS, 0x1
- },
- {
- 1,
- (WCD9360_REGISTER_START_OFFSET + WCD9360_SB_PGD_PORT_TX_BASE),
- SB_PGD_PORT_TX_ENABLE_N, 0x1, WCD9360_REG_BITS, 0x1
- },
- {
- 1,
- (WCD9360_REGISTER_START_OFFSET + WCD9360_SB_PGD_PORT_RX_BASE),
- SB_PGD_PORT_RX_WATERMARK_N, 0x1E, WCD9360_REG_BITS, 0x1
- },
- {
- 1,
- (WCD9360_REGISTER_START_OFFSET + WCD9360_SB_PGD_PORT_RX_BASE),
- SB_PGD_PORT_RX_ENABLE_N, 0x1, WCD9360_REG_BITS, 0x1
- },
- {
- 1,
- (WCD9360_REGISTER_START_OFFSET +
- WCD9360_CDC_ANC0_IIR_ADAPT_CTL),
- AANC_FF_GAIN_ADAPTIVE, 0x4, WCD9360_REG_BITS, 0
- },
- {
- 1,
- (WCD9360_REGISTER_START_OFFSET +
- WCD9360_CDC_ANC0_IIR_ADAPT_CTL),
- AANC_FFGAIN_ADAPTIVE_EN, 0x8, WCD9360_REG_BITS, 0
- },
- {
- 1,
- (WCD9360_REGISTER_START_OFFSET +
- WCD9360_CDC_ANC0_FF_A_GAIN_CTL),
- AANC_GAIN_CONTROL, 0xFF, WCD9360_REG_BITS, 0
- },
- {
- 1,
- (WCD9360_REGISTER_START_OFFSET +
- SB_PGD_TX_PORT_MULTI_CHANNEL_0(0)),
- SB_PGD_TX_PORTn_MULTI_CHNL_0, 0xFF, WCD9360_REG_BITS, 0x4
- },
- {
- 1,
- (WCD9360_REGISTER_START_OFFSET +
- SB_PGD_TX_PORT_MULTI_CHANNEL_1(0)),
- SB_PGD_TX_PORTn_MULTI_CHNL_1, 0xFF, WCD9360_REG_BITS, 0x4
- },
- {
- 1,
- (WCD9360_REGISTER_START_OFFSET +
- SB_PGD_RX_PORT_MULTI_CHANNEL_0(0x180, 0)),
- SB_PGD_RX_PORTn_MULTI_CHNL_0, 0xFF, WCD9360_REG_BITS, 0x4
- },
- {
- 1,
- (WCD9360_REGISTER_START_OFFSET +
- SB_PGD_RX_PORT_MULTI_CHANNEL_0(0x181, 0)),
- SB_PGD_RX_PORTn_MULTI_CHNL_1, 0xFF, WCD9360_REG_BITS, 0x4
- },
-};
-
-static struct afe_param_cdc_reg_cfg_data pahu_audio_reg_cfg = {
- .num_registers = ARRAY_SIZE(audio_reg_cfg),
- .reg_data = audio_reg_cfg,
-};
-
-static struct afe_param_id_cdc_aanc_version pahu_cdc_aanc_version = {
- .cdc_aanc_minor_version = AFE_API_VERSION_CDC_AANC_VERSION,
- .aanc_hw_version = AANC_HW_BLOCK_VERSION_2,
-};
-
-static const DECLARE_TLV_DB_SCALE(digital_gain, 0, 1, 0);
-static const DECLARE_TLV_DB_SCALE(analog_gain, 0, 25, 1);
-
-#define WCD9360_TX_UNMUTE_DELAY_MS 40
-
-static int tx_unmute_delay = WCD9360_TX_UNMUTE_DELAY_MS;
-module_param(tx_unmute_delay, int, 0664);
-MODULE_PARM_DESC(tx_unmute_delay, "delay to unmute the tx path");
-
-static void pahu_codec_set_tx_hold(struct snd_soc_codec *, u16, bool);
-
-/* Hold instance to soundwire platform device */
-struct pahu_swr_ctrl_data {
- struct platform_device *swr_pdev;
-};
-
-struct wcd_swr_ctrl_platform_data {
- void *handle; /* holds codec private data */
- int (*read)(void *handle, int reg);
- int (*write)(void *handle, int reg, int val);
- int (*bulk_write)(void *handle, u32 *reg, u32 *val, size_t len);
- int (*clk)(void *handle, bool enable);
- int (*handle_irq)(void *handle,
- irqreturn_t (*swrm_irq_handler)(int irq, void *data),
- void *swrm_handle, int action);
-};
-
-/* Holds all Soundwire and speaker related information */
-struct wcd9360_swr {
- struct pahu_swr_ctrl_data *ctrl_data;
- struct wcd_swr_ctrl_platform_data plat_data;
- struct mutex read_mutex;
- struct mutex write_mutex;
- struct mutex clk_mutex;
- int spkr_gain_offset;
- int spkr_mode;
- int clk_users;
- int rx_7_count;
- int rx_8_count;
-};
-
-struct tx_mute_work {
- struct pahu_priv *pahu;
- u8 decimator;
- struct delayed_work dwork;
-};
-
-#define WCD9360_SPK_ANC_EN_DELAY_MS 550
-static int spk_anc_en_delay = WCD9360_SPK_ANC_EN_DELAY_MS;
-module_param(spk_anc_en_delay, int, 0664);
-MODULE_PARM_DESC(spk_anc_en_delay, "delay to enable anc in speaker path");
-
-struct spk_anc_work {
- struct pahu_priv *pahu;
- struct delayed_work dwork;
-};
-
-struct hpf_work {
- struct pahu_priv *pahu;
- u8 decimator;
- u8 hpf_cut_off_freq;
- struct delayed_work dwork;
-};
-
-struct pahu_priv {
- struct device *dev;
- struct wcd9xxx *wcd9xxx;
- struct snd_soc_codec *codec;
- s32 ldo_rxtx_cnt;
- s32 dmic_0_1_clk_cnt;
- s32 dmic_2_3_clk_cnt;
- s32 dmic_4_5_clk_cnt;
- s32 dmic_6_7_clk_cnt;
- s32 micb_ref[PAHU_MAX_MICBIAS];
- s32 pullup_ref[PAHU_MAX_MICBIAS];
-
- /* ANC related */
- u32 anc_slot;
- bool anc_func;
-
- /* compander */
- int comp_enabled[COMPANDER_MAX];
- int ear_spkr_gain;
-
- /* Mad switch reference count */
- int mad_switch_cnt;
-
- /* track pahu interface type */
- u8 intf_type;
-
- /* to track the status */
- unsigned long status_mask;
-
- struct afe_param_cdc_slimbus_slave_cfg slimbus_slave_cfg;
-
- /* num of slim ports required */
- struct wcd9xxx_codec_dai_data dai[NUM_CODEC_DAIS];
- /* Port values for Rx and Tx codec_dai */
- unsigned int rx_port_value[WCD9360_RX_MAX];
- unsigned int tx_port_value;
-
- struct wcd9xxx_resmgr_v2 *resmgr;
- struct wcd9360_swr swr;
- struct mutex micb_lock;
-
- struct delayed_work power_gate_work;
- struct mutex power_lock;
-
- struct clk *wcd_ext_clk;
-
- struct mutex codec_mutex;
- struct work_struct pahu_add_child_devices_work;
- struct hpf_work tx_hpf_work[WCD9360_NUM_DECIMATORS];
- struct tx_mute_work tx_mute_dwork[WCD9360_NUM_DECIMATORS];
- struct spk_anc_work spk_anc_dwork;
-
- unsigned int vi_feed_value;
-
- /* DSP control */
- struct wcd_dsp_cntl *wdsp_cntl;
-
- /* cal info for codec */
- struct fw_info *fw_data;
-
- /* Entry for version info */
- struct snd_info_entry *entry;
- struct snd_info_entry *version_entry;
-
- /* SVS voting related */
- struct mutex svs_mutex;
- int svs_ref_cnt;
-
- int native_clk_users;
- /* ASRC users count */
- int asrc_users[ASRC_MAX];
- int asrc_output_mode[ASRC_MAX];
- /* Main path clock users count */
- int main_clk_users[WCD9360_NUM_INTERPOLATORS];
-
- int power_active_ref;
- u8 sidetone_coeff_array[IIR_MAX][BAND_MAX]
- [WCD9360_CDC_SIDETONE_IIR_COEFF_MAX * 4];
-
- struct spi_device *spi;
- struct platform_device *pdev_child_devices
- [WCD9360_CHILD_DEVICES_MAX];
- int child_count;
- int i2s_ref_cnt;
-};
-
-static const struct pahu_reg_mask_val pahu_spkr_default[] = {
- {WCD9360_CDC_COMPANDER7_CTL3, 0x80, 0x80},
- {WCD9360_CDC_COMPANDER8_CTL3, 0x80, 0x80},
- {WCD9360_CDC_COMPANDER7_CTL7, 0x01, 0x01},
- {WCD9360_CDC_COMPANDER8_CTL7, 0x01, 0x01},
- {WCD9360_CDC_BOOST0_BOOST_CTL, 0x7C, 0x50},
- {WCD9360_CDC_BOOST1_BOOST_CTL, 0x7C, 0x50},
-};
-
-static const struct pahu_reg_mask_val pahu_spkr_mode1[] = {
- {WCD9360_CDC_COMPANDER7_CTL3, 0x80, 0x00},
- {WCD9360_CDC_COMPANDER8_CTL3, 0x80, 0x00},
- {WCD9360_CDC_COMPANDER7_CTL7, 0x01, 0x00},
- {WCD9360_CDC_COMPANDER8_CTL7, 0x01, 0x00},
- {WCD9360_CDC_BOOST0_BOOST_CTL, 0x7C, 0x44},
- {WCD9360_CDC_BOOST1_BOOST_CTL, 0x7C, 0x44},
-};
-
-static int __pahu_enable_efuse_sensing(struct pahu_priv *pahu);
-
-/**
- * pahu_set_spkr_gain_offset - offset the speaker path
- * gain with the given offset value.
- *
- * @codec: codec instance
- * @offset: Indicates speaker path gain offset value.
- *
- * Returns 0 on success or -EINVAL on error.
- */
-int pahu_set_spkr_gain_offset(struct snd_soc_codec *codec, int offset)
-{
- struct pahu_priv *priv = snd_soc_codec_get_drvdata(codec);
-
- if (!priv)
- return -EINVAL;
-
- priv->swr.spkr_gain_offset = offset;
- return 0;
-}
-EXPORT_SYMBOL(pahu_set_spkr_gain_offset);
-
-/**
- * pahu_set_spkr_mode - Configures speaker compander and smartboost
- * settings based on speaker mode.
- *
- * @codec: codec instance
- * @mode: Indicates speaker configuration mode.
- *
- * Returns 0 on success or -EINVAL on error.
- */
-int pahu_set_spkr_mode(struct snd_soc_codec *codec, int mode)
-{
- struct pahu_priv *priv = snd_soc_codec_get_drvdata(codec);
- int i;
- const struct pahu_reg_mask_val *regs;
- int size;
-
- if (!priv)
- return -EINVAL;
-
- switch (mode) {
- case WCD9360_SPKR_MODE_1:
- regs = pahu_spkr_mode1;
- size = ARRAY_SIZE(pahu_spkr_mode1);
- break;
- default:
- regs = pahu_spkr_default;
- size = ARRAY_SIZE(pahu_spkr_default);
- break;
- }
-
- priv->swr.spkr_mode = mode;
- for (i = 0; i < size; i++)
- snd_soc_update_bits(codec, regs[i].reg,
- regs[i].mask, regs[i].val);
- return 0;
-}
-EXPORT_SYMBOL(pahu_set_spkr_mode);
-
-/**
- * pahu_get_afe_config - returns specific codec configuration to afe to write
- *
- * @codec: codec instance
- * @config_type: Indicates type of configuration to write.
- */
-void *pahu_get_afe_config(struct snd_soc_codec *codec,
- enum afe_config_type config_type)
-{
- struct pahu_priv *priv = snd_soc_codec_get_drvdata(codec);
-
- switch (config_type) {
- case AFE_SLIMBUS_SLAVE_CONFIG:
- return &priv->slimbus_slave_cfg;
- case AFE_CDC_REGISTERS_CONFIG:
- return &pahu_audio_reg_cfg;
- case AFE_SLIMBUS_SLAVE_PORT_CONFIG:
- return &pahu_slimbus_slave_port_cfg;
- case AFE_AANC_VERSION:
- return &pahu_cdc_aanc_version;
- case AFE_CDC_REGISTER_PAGE_CONFIG:
- return &pahu_cdc_reg_page_cfg;
- default:
- dev_info(codec->dev, "%s: Unknown config_type 0x%x\n",
- __func__, config_type);
- return NULL;
- }
-}
-EXPORT_SYMBOL(pahu_get_afe_config);
-
-static void pahu_vote_svs(struct pahu_priv *pahu, bool vote)
-{
- struct wcd9xxx *wcd9xxx;
-
- wcd9xxx = pahu->wcd9xxx;
-
- mutex_lock(&pahu->svs_mutex);
- if (vote) {
- pahu->svs_ref_cnt++;
- if (pahu->svs_ref_cnt == 1)
- regmap_update_bits(wcd9xxx->regmap,
- WCD9360_CPE_SS_PWR_SYS_PSTATE_CTL_0,
- 0x01, 0x01);
- } else {
- /* Do not decrement ref count if it is already 0 */
- if (pahu->svs_ref_cnt == 0)
- goto done;
-
- pahu->svs_ref_cnt--;
- if (pahu->svs_ref_cnt == 0)
- regmap_update_bits(wcd9xxx->regmap,
- WCD9360_CPE_SS_PWR_SYS_PSTATE_CTL_0,
- 0x01, 0x00);
- }
-done:
- dev_dbg(pahu->dev, "%s: vote = %s, updated ref cnt = %u\n", __func__,
- vote ? "vote" : "Unvote", pahu->svs_ref_cnt);
- mutex_unlock(&pahu->svs_mutex);
-}
-
-static int pahu_get_anc_slot(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
-
- ucontrol->value.integer.value[0] = pahu->anc_slot;
- return 0;
-}
-
-static int pahu_put_anc_slot(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
-
- pahu->anc_slot = ucontrol->value.integer.value[0];
- return 0;
-}
-
-static int pahu_get_anc_func(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
-
- ucontrol->value.integer.value[0] = (pahu->anc_func == true ? 1 : 0);
- return 0;
-}
-
-static int pahu_put_anc_func(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
- struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
-
- mutex_lock(&pahu->codec_mutex);
- pahu->anc_func = (!ucontrol->value.integer.value[0] ? false : true);
- dev_dbg(codec->dev, "%s: anc_func %x", __func__, pahu->anc_func);
-
- if (pahu->anc_func == true) {
- snd_soc_dapm_enable_pin(dapm, "ANC EAR PA");
- snd_soc_dapm_enable_pin(dapm, "ANC EAR");
- snd_soc_dapm_enable_pin(dapm, "ANC SPK1 PA");
- snd_soc_dapm_disable_pin(dapm, "EAR PA");
- snd_soc_dapm_disable_pin(dapm, "EAR");
- } else {
- snd_soc_dapm_disable_pin(dapm, "ANC EAR PA");
- snd_soc_dapm_disable_pin(dapm, "ANC EAR");
- snd_soc_dapm_disable_pin(dapm, "ANC SPK1 PA");
- snd_soc_dapm_enable_pin(dapm, "EAR PA");
- snd_soc_dapm_enable_pin(dapm, "EAR");
- }
- mutex_unlock(&pahu->codec_mutex);
-
- snd_soc_dapm_sync(dapm);
- return 0;
-}
-
-static int pahu_codec_enable_anc(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol, int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
- const char *filename;
- const struct firmware *fw;
- int i;
- int ret = 0;
- int num_anc_slots;
- struct wcd9xxx_anc_header *anc_head;
- struct firmware_cal *hwdep_cal = NULL;
- u32 anc_writes_size = 0;
- int anc_size_remaining;
- u32 *anc_ptr;
- u16 reg;
- u8 mask, val;
- size_t cal_size;
- const void *data;
-
- if (!pahu->anc_func)
- return 0;
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- hwdep_cal = wcdcal_get_fw_cal(pahu->fw_data, WCD9XXX_ANC_CAL);
- if (hwdep_cal) {
- data = hwdep_cal->data;
- cal_size = hwdep_cal->size;
- dev_dbg(codec->dev, "%s: using hwdep calibration, cal_size %zd",
- __func__, cal_size);
- } else {
- filename = "wcd9360/WCD9360_anc.bin";
- ret = request_firmware(&fw, filename, codec->dev);
- if (ret < 0) {
- dev_err(codec->dev, "%s: Failed to acquire ANC data: %d\n",
- __func__, ret);
- return ret;
- }
- if (!fw) {
- dev_err(codec->dev, "%s: Failed to get anc fw\n",
- __func__);
- return -ENODEV;
- }
- data = fw->data;
- cal_size = fw->size;
- dev_dbg(codec->dev, "%s: using request_firmware calibration\n",
- __func__);
- }
- if (cal_size < sizeof(struct wcd9xxx_anc_header)) {
- dev_err(codec->dev, "%s: Invalid cal_size %zd\n",
- __func__, cal_size);
- ret = -EINVAL;
- goto err;
- }
- /* First number is the number of register writes */
- anc_head = (struct wcd9xxx_anc_header *)(data);
- anc_ptr = (u32 *)(data + sizeof(struct wcd9xxx_anc_header));
- anc_size_remaining = cal_size -
- sizeof(struct wcd9xxx_anc_header);
- num_anc_slots = anc_head->num_anc_slots;
-
- if (pahu->anc_slot >= num_anc_slots) {
- dev_err(codec->dev, "%s: Invalid ANC slot selected\n",
- __func__);
- ret = -EINVAL;
- goto err;
- }
- for (i = 0; i < num_anc_slots; i++) {
- if (anc_size_remaining < WCD9360_PACKED_REG_SIZE) {
- dev_err(codec->dev, "%s: Invalid register format\n",
- __func__);
- ret = -EINVAL;
- goto err;
- }
- anc_writes_size = (u32)(*anc_ptr);
- anc_size_remaining -= sizeof(u32);
- anc_ptr += 1;
-
- if ((anc_writes_size * WCD9360_PACKED_REG_SIZE) >
- anc_size_remaining) {
- dev_err(codec->dev, "%s: Invalid register format\n",
- __func__);
- ret = -EINVAL;
- goto err;
- }
-
- if (pahu->anc_slot == i)
- break;
-
- anc_size_remaining -= (anc_writes_size *
- WCD9360_PACKED_REG_SIZE);
- anc_ptr += anc_writes_size;
- }
- if (i == num_anc_slots) {
- dev_err(codec->dev, "%s: Selected ANC slot not present\n",
- __func__);
- ret = -EINVAL;
- goto err;
- }
-
- for (i = 0; i < anc_writes_size; i++) {
- WCD9360_CODEC_UNPACK_ENTRY(anc_ptr[i], reg, mask, val);
- snd_soc_write(codec, reg, (val & mask));
- }
-
- if (!hwdep_cal)
- release_firmware(fw);
- break;
-
- case SND_SOC_DAPM_POST_PMU:
- break;
-
- case SND_SOC_DAPM_POST_PMD:
- if (!strcmp(w->name, "ANC EAR PA") ||
- !strcmp(w->name, "ANC SPK1 PA")) {
- snd_soc_update_bits(codec, WCD9360_CDC_ANC0_MODE_1_CTL,
- 0x30, 0x00);
- msleep(50);
- snd_soc_update_bits(codec, WCD9360_CDC_ANC0_MODE_1_CTL,
- 0x01, 0x00);
- snd_soc_update_bits(codec,
- WCD9360_CDC_ANC0_CLK_RESET_CTL,
- 0x38, 0x38);
- snd_soc_update_bits(codec,
- WCD9360_CDC_ANC0_CLK_RESET_CTL,
- 0x07, 0x00);
- snd_soc_update_bits(codec,
- WCD9360_CDC_ANC0_CLK_RESET_CTL,
- 0x38, 0x00);
- }
- break;
- }
-
- return 0;
-err:
- if (!hwdep_cal)
- release_firmware(fw);
- return ret;
-}
-
-static int pahu_get_clkmode(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct pahu_priv *pahu_p = snd_soc_codec_get_drvdata(codec);
-
- if (test_bit(CLK_MODE, &pahu_p->status_mask))
- ucontrol->value.enumerated.item[0] = 1;
- else
- ucontrol->value.enumerated.item[0] = 0;
-
- dev_dbg(codec->dev, "%s: is_low_power_clock: %s\n", __func__,
- test_bit(CLK_MODE, &pahu_p->status_mask) ? "true" : "false");
-
- return 0;
-}
-
-static int pahu_put_clkmode(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct pahu_priv *pahu_p = snd_soc_codec_get_drvdata(codec);
-
- if (ucontrol->value.enumerated.item[0])
- set_bit(CLK_MODE, &pahu_p->status_mask);
- else
- clear_bit(CLK_MODE, &pahu_p->status_mask);
-
- dev_dbg(codec->dev, "%s: is_low_power_clock: %s\n", __func__,
- test_bit(CLK_MODE, &pahu_p->status_mask) ? "true" : "false");
-
- return 0;
-}
-
-static int pahu_vi_feed_mixer_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_dapm_widget *widget =
- snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
- struct pahu_priv *pahu_p = snd_soc_codec_get_drvdata(codec);
-
- ucontrol->value.integer.value[0] = pahu_p->vi_feed_value;
-
- return 0;
-}
-
-static int pahu_vi_feed_mixer_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_dapm_widget *widget =
- snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
- struct pahu_priv *pahu_p = snd_soc_codec_get_drvdata(codec);
- struct wcd9xxx *core = dev_get_drvdata(codec->dev->parent);
- struct soc_multi_mixer_control *mixer =
- ((struct soc_multi_mixer_control *)kcontrol->private_value);
- u32 dai_id = widget->shift;
- u32 port_id = mixer->shift;
- u32 enable = ucontrol->value.integer.value[0];
-
- dev_dbg(codec->dev, "%s: enable: %d, port_id:%d, dai_id: %d\n",
- __func__, enable, port_id, dai_id);
-
- pahu_p->vi_feed_value = ucontrol->value.integer.value[0];
-
- mutex_lock(&pahu_p->codec_mutex);
- if (enable) {
- if (port_id == WCD9360_TX14 && !test_bit(VI_SENSE_1,
- &pahu_p->status_mask)) {
- list_add_tail(&core->tx_chs[WCD9360_TX14].list,
- &pahu_p->dai[dai_id].wcd9xxx_ch_list);
- set_bit(VI_SENSE_1, &pahu_p->status_mask);
- }
- if (port_id == WCD9360_TX15 && !test_bit(VI_SENSE_2,
- &pahu_p->status_mask)) {
- list_add_tail(&core->tx_chs[WCD9360_TX15].list,
- &pahu_p->dai[dai_id].wcd9xxx_ch_list);
- set_bit(VI_SENSE_2, &pahu_p->status_mask);
- }
- } else {
- if (port_id == WCD9360_TX14 && test_bit(VI_SENSE_1,
- &pahu_p->status_mask)) {
- list_del_init(&core->tx_chs[WCD9360_TX14].list);
- clear_bit(VI_SENSE_1, &pahu_p->status_mask);
- }
- if (port_id == WCD9360_TX15 && test_bit(VI_SENSE_2,
- &pahu_p->status_mask)) {
- list_del_init(&core->tx_chs[WCD9360_TX15].list);
- clear_bit(VI_SENSE_2, &pahu_p->status_mask);
- }
- }
- mutex_unlock(&pahu_p->codec_mutex);
- snd_soc_dapm_mixer_update_power(widget->dapm, kcontrol, enable, NULL);
-
- return 0;
-}
-
-static int slim_tx_mixer_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_dapm_widget *widget =
- snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
- struct pahu_priv *pahu_p = snd_soc_codec_get_drvdata(codec);
-
- ucontrol->value.integer.value[0] = pahu_p->tx_port_value;
- return 0;
-}
-
-static int slim_tx_mixer_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_dapm_widget *widget =
- snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
- struct pahu_priv *pahu_p = snd_soc_codec_get_drvdata(codec);
- struct wcd9xxx *core = dev_get_drvdata(codec->dev->parent);
- struct snd_soc_dapm_update *update = NULL;
- struct soc_multi_mixer_control *mixer =
- ((struct soc_multi_mixer_control *)kcontrol->private_value);
- u32 dai_id = widget->shift;
- u32 port_id = mixer->shift;
- u32 enable = ucontrol->value.integer.value[0];
- u32 vtable;
-
- dev_dbg(codec->dev, "%s: wname %s cname %s value %u shift %d item %ld\n",
- __func__,
- widget->name, ucontrol->id.name, pahu_p->tx_port_value,
- widget->shift, ucontrol->value.integer.value[0]);
-
- mutex_lock(&pahu_p->codec_mutex);
- if (dai_id >= ARRAY_SIZE(vport_slim_check_table)) {
- dev_err(codec->dev, "%s: dai_id: %d, out of bounds\n",
- __func__, dai_id);
- mutex_unlock(&pahu_p->codec_mutex);
- return -EINVAL;
- }
- vtable = vport_slim_check_table[dai_id];
-
- switch (dai_id) {
- case AIF1_CAP:
- case AIF2_CAP:
- case AIF3_CAP:
- /* only add to the list if value not set */
- if (enable && !(pahu_p->tx_port_value & 1 << port_id)) {
- if (wcd9xxx_tx_vport_validation(vtable, port_id,
- pahu_p->dai, NUM_CODEC_DAIS)) {
- dev_dbg(codec->dev, "%s: TX%u is used by other virtual port\n",
- __func__, port_id);
- mutex_unlock(&pahu_p->codec_mutex);
- return 0;
- }
- pahu_p->tx_port_value |= 1 << port_id;
- list_add_tail(&core->tx_chs[port_id].list,
- &pahu_p->dai[dai_id].wcd9xxx_ch_list);
- } else if (!enable && (pahu_p->tx_port_value &
- 1 << port_id)) {
- pahu_p->tx_port_value &= ~(1 << port_id);
- list_del_init(&core->tx_chs[port_id].list);
- } else {
- if (enable)
- dev_dbg(codec->dev, "%s: TX%u port is used by\n"
- "this virtual port\n",
- __func__, port_id);
- else
- dev_dbg(codec->dev, "%s: TX%u port is not used by\n"
- "this virtual port\n",
- __func__, port_id);
- /* avoid update power function */
- mutex_unlock(&pahu_p->codec_mutex);
- return 0;
- }
- break;
- case AIF4_MAD_TX:
- break;
- default:
- dev_err(codec->dev, "Unknown AIF %d\n", dai_id);
- mutex_unlock(&pahu_p->codec_mutex);
- return -EINVAL;
- }
- dev_dbg(codec->dev, "%s: name %s sname %s updated value %u shift %d\n",
- __func__, widget->name, widget->sname, pahu_p->tx_port_value,
- widget->shift);
-
- mutex_unlock(&pahu_p->codec_mutex);
- snd_soc_dapm_mixer_update_power(widget->dapm, kcontrol, enable, update);
-
- return 0;
-}
-
-static int slim_rx_mux_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_dapm_widget *widget =
- snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
- struct pahu_priv *pahu_p = snd_soc_codec_get_drvdata(codec);
-
- ucontrol->value.enumerated.item[0] =
- pahu_p->rx_port_value[widget->shift];
- return 0;
-}
-
-static int slim_rx_mux_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_dapm_widget *widget =
- snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
- struct pahu_priv *pahu_p = snd_soc_codec_get_drvdata(codec);
- struct wcd9xxx *core = dev_get_drvdata(codec->dev->parent);
- struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
- struct snd_soc_dapm_update *update = NULL;
- unsigned int rx_port_value;
- u32 port_id = widget->shift;
-
- pahu_p->rx_port_value[port_id] = ucontrol->value.enumerated.item[0];
- rx_port_value = pahu_p->rx_port_value[port_id];
-
- mutex_lock(&pahu_p->codec_mutex);
- dev_dbg(codec->dev, "%s: wname %s cname %s value %u shift %d item %ld\n",
- __func__, widget->name, ucontrol->id.name,
- rx_port_value, widget->shift,
- ucontrol->value.integer.value[0]);
-
- /* value need to match the Virtual port and AIF number */
- switch (rx_port_value) {
- case 0:
- list_del_init(&core->rx_chs[port_id].list);
- break;
- case 1:
- if (wcd9xxx_rx_vport_validation(port_id +
- WCD9360_RX_PORT_START_NUMBER,
- &pahu_p->dai[AIF1_PB].wcd9xxx_ch_list)) {
- dev_dbg(codec->dev, "%s: RX%u is used by current requesting AIF_PB itself\n",
- __func__, port_id);
- goto rtn;
- }
- list_add_tail(&core->rx_chs[port_id].list,
- &pahu_p->dai[AIF1_PB].wcd9xxx_ch_list);
- break;
- case 2:
- if (wcd9xxx_rx_vport_validation(port_id +
- WCD9360_RX_PORT_START_NUMBER,
- &pahu_p->dai[AIF2_PB].wcd9xxx_ch_list)) {
- dev_dbg(codec->dev, "%s: RX%u is used by current requesting AIF_PB itself\n",
- __func__, port_id);
- goto rtn;
- }
- list_add_tail(&core->rx_chs[port_id].list,
- &pahu_p->dai[AIF2_PB].wcd9xxx_ch_list);
- break;
- case 3:
- if (wcd9xxx_rx_vport_validation(port_id +
- WCD9360_RX_PORT_START_NUMBER,
- &pahu_p->dai[AIF3_PB].wcd9xxx_ch_list)) {
- dev_dbg(codec->dev, "%s: RX%u is used by current requesting AIF_PB itself\n",
- __func__, port_id);
- goto rtn;
- }
- list_add_tail(&core->rx_chs[port_id].list,
- &pahu_p->dai[AIF3_PB].wcd9xxx_ch_list);
- break;
- case 4:
- if (wcd9xxx_rx_vport_validation(port_id +
- WCD9360_RX_PORT_START_NUMBER,
- &pahu_p->dai[AIF4_PB].wcd9xxx_ch_list)) {
- dev_dbg(codec->dev, "%s: RX%u is used by current requesting AIF_PB itself\n",
- __func__, port_id);
- goto rtn;
- }
- list_add_tail(&core->rx_chs[port_id].list,
- &pahu_p->dai[AIF4_PB].wcd9xxx_ch_list);
- break;
- default:
- dev_err(codec->dev, "Unknown AIF %d\n", rx_port_value);
- goto err;
- }
-rtn:
- mutex_unlock(&pahu_p->codec_mutex);
- snd_soc_dapm_mux_update_power(widget->dapm, kcontrol,
- rx_port_value, e, update);
-
- return 0;
-err:
- mutex_unlock(&pahu_p->codec_mutex);
- return -EINVAL;
-}
-
-static void pahu_codec_enable_slim_port_intr(
- struct wcd9xxx_codec_dai_data *dai,
- struct snd_soc_codec *codec)
-{
- struct wcd9xxx_ch *ch;
- int port_num = 0;
- unsigned short reg = 0;
- u8 val = 0;
- struct pahu_priv *pahu_p;
-
- if (!dai || !codec) {
- pr_err("%s: Invalid params\n", __func__);
- return;
- }
-
- pahu_p = snd_soc_codec_get_drvdata(codec);
- list_for_each_entry(ch, &dai->wcd9xxx_ch_list, list) {
- if (ch->port >= WCD9360_RX_PORT_START_NUMBER) {
- port_num = ch->port - WCD9360_RX_PORT_START_NUMBER;
- reg = WCD9360_SLIM_PGD_PORT_INT_RX_EN0 + (port_num / 8);
- val = wcd9xxx_interface_reg_read(pahu_p->wcd9xxx,
- reg);
- if (!(val & BYTE_BIT_MASK(port_num))) {
- val |= BYTE_BIT_MASK(port_num);
- wcd9xxx_interface_reg_write(
- pahu_p->wcd9xxx, reg, val);
- val = wcd9xxx_interface_reg_read(
- pahu_p->wcd9xxx, reg);
- }
- } else {
- port_num = ch->port;
- reg = WCD9360_SLIM_PGD_PORT_INT_TX_EN0 + (port_num / 8);
- val = wcd9xxx_interface_reg_read(pahu_p->wcd9xxx,
- reg);
- if (!(val & BYTE_BIT_MASK(port_num))) {
- val |= BYTE_BIT_MASK(port_num);
- wcd9xxx_interface_reg_write(pahu_p->wcd9xxx,
- reg, val);
- val = wcd9xxx_interface_reg_read(
- pahu_p->wcd9xxx, reg);
- }
- }
- }
-}
-
-static int pahu_codec_enable_slim_chmask(struct wcd9xxx_codec_dai_data *dai,
- bool up)
-{
- int ret = 0;
- struct wcd9xxx_ch *ch;
-
- if (up) {
- list_for_each_entry(ch, &dai->wcd9xxx_ch_list, list) {
- ret = wcd9xxx_get_slave_port(ch->ch_num);
- if (ret < 0) {
- pr_err("%s: Invalid slave port ID: %d\n",
- __func__, ret);
- ret = -EINVAL;
- } else {
- set_bit(ret, &dai->ch_mask);
- }
- }
- } else {
- ret = wait_event_timeout(dai->dai_wait, (dai->ch_mask == 0),
- msecs_to_jiffies(
- WCD9360_SLIM_CLOSE_TIMEOUT));
- if (!ret) {
- pr_err("%s: Slim close tx/rx wait timeout, ch_mask:0x%lx\n",
- __func__, dai->ch_mask);
- ret = -ETIMEDOUT;
- } else {
- ret = 0;
- }
- }
- return ret;
-}
-
-static int pahu_codec_enable_slimrx(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- struct wcd9xxx *core;
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct pahu_priv *pahu_p = snd_soc_codec_get_drvdata(codec);
- int ret = 0;
- struct wcd9xxx_codec_dai_data *dai;
-
- core = dev_get_drvdata(codec->dev->parent);
-
- dev_dbg(codec->dev, "%s: event called! codec name %s num_dai %d\n"
- "stream name %s event %d\n",
- __func__, codec->component.name,
- codec->component.num_dai, w->sname, event);
-
- dai = &pahu_p->dai[w->shift];
- dev_dbg(codec->dev, "%s: w->name %s w->shift %d event %d\n",
- __func__, w->name, w->shift, event);
-
- switch (event) {
- case SND_SOC_DAPM_POST_PMU:
- dai->bus_down_in_recovery = false;
- pahu_codec_enable_slim_port_intr(dai, codec);
- (void) pahu_codec_enable_slim_chmask(dai, true);
- ret = wcd9xxx_cfg_slim_sch_rx(core, &dai->wcd9xxx_ch_list,
- dai->rate, dai->bit_width,
- &dai->grph);
- break;
- case SND_SOC_DAPM_POST_PMD:
- ret = wcd9xxx_disconnect_port(core, &dai->wcd9xxx_ch_list,
- dai->grph);
- dev_dbg(codec->dev, "%s: Disconnect RX port, ret = %d\n",
- __func__, ret);
-
- if (!dai->bus_down_in_recovery)
- ret = pahu_codec_enable_slim_chmask(dai, false);
- else
- dev_dbg(codec->dev,
- "%s: bus in recovery skip enable slim_chmask",
- __func__);
- ret = wcd9xxx_close_slim_sch_rx(core, &dai->wcd9xxx_ch_list,
- dai->grph);
- break;
- }
- return ret;
-}
-
-static int pahu_codec_enable_slimtx(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct pahu_priv *pahu_p = snd_soc_codec_get_drvdata(codec);
- struct wcd9xxx_codec_dai_data *dai;
- struct wcd9xxx *core;
- int ret = 0;
-
- dev_dbg(codec->dev,
- "%s: w->name %s, w->shift = %d, num_dai %d stream name %s\n",
- __func__, w->name, w->shift,
- codec->component.num_dai, w->sname);
-
- dai = &pahu_p->dai[w->shift];
- core = dev_get_drvdata(codec->dev->parent);
-
- switch (event) {
- case SND_SOC_DAPM_POST_PMU:
- dai->bus_down_in_recovery = false;
- pahu_codec_enable_slim_port_intr(dai, codec);
- (void) pahu_codec_enable_slim_chmask(dai, true);
- ret = wcd9xxx_cfg_slim_sch_tx(core, &dai->wcd9xxx_ch_list,
- dai->rate, dai->bit_width,
- &dai->grph);
- break;
- case SND_SOC_DAPM_POST_PMD:
- ret = wcd9xxx_close_slim_sch_tx(core, &dai->wcd9xxx_ch_list,
- dai->grph);
- if (!dai->bus_down_in_recovery)
- ret = pahu_codec_enable_slim_chmask(dai, false);
- if (ret < 0) {
- ret = wcd9xxx_disconnect_port(core,
- &dai->wcd9xxx_ch_list,
- dai->grph);
- dev_dbg(codec->dev, "%s: Disconnect RX port, ret = %d\n",
- __func__, ret);
- }
- break;
- }
- return ret;
-}
-
-static int pahu_codec_enable_slimvi_feedback(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- struct wcd9xxx *core = NULL;
- struct snd_soc_codec *codec = NULL;
- struct pahu_priv *pahu_p = NULL;
- int ret = 0;
- struct wcd9xxx_codec_dai_data *dai = NULL;
-
- codec = snd_soc_dapm_to_codec(w->dapm);
- pahu_p = snd_soc_codec_get_drvdata(codec);
- core = dev_get_drvdata(codec->dev->parent);
-
- dev_dbg(codec->dev,
- "%s: num_dai %d stream name %s w->name %s event %d shift %d\n",
- __func__, codec->component.num_dai, w->sname,
- w->name, event, w->shift);
-
- if (w->shift != AIF4_VIFEED) {
- pr_err("%s Error in enabling the tx path\n", __func__);
- ret = -EINVAL;
- goto done;
- }
- dai = &pahu_p->dai[w->shift];
- switch (event) {
- case SND_SOC_DAPM_POST_PMU:
- if (test_bit(VI_SENSE_1, &pahu_p->status_mask)) {
- dev_dbg(codec->dev, "%s: spkr1 enabled\n", __func__);
- /* Enable V&I sensing */
- snd_soc_update_bits(codec,
- WCD9360_CDC_TX9_SPKR_PROT_PATH_CTL, 0x20, 0x20);
- snd_soc_update_bits(codec,
- WCD9360_CDC_TX10_SPKR_PROT_PATH_CTL, 0x20,
- 0x20);
- snd_soc_update_bits(codec,
- WCD9360_CDC_TX9_SPKR_PROT_PATH_CTL, 0x0F, 0x00);
- snd_soc_update_bits(codec,
- WCD9360_CDC_TX10_SPKR_PROT_PATH_CTL, 0x0F,
- 0x00);
- snd_soc_update_bits(codec,
- WCD9360_CDC_TX9_SPKR_PROT_PATH_CTL, 0x10, 0x10);
- snd_soc_update_bits(codec,
- WCD9360_CDC_TX10_SPKR_PROT_PATH_CTL, 0x10,
- 0x10);
- snd_soc_update_bits(codec,
- WCD9360_CDC_TX9_SPKR_PROT_PATH_CTL, 0x20, 0x00);
- snd_soc_update_bits(codec,
- WCD9360_CDC_TX10_SPKR_PROT_PATH_CTL, 0x20,
- 0x00);
- }
- if (test_bit(VI_SENSE_2, &pahu_p->status_mask)) {
- pr_debug("%s: spkr2 enabled\n", __func__);
- /* Enable V&I sensing */
- snd_soc_update_bits(codec,
- WCD9360_CDC_TX11_SPKR_PROT_PATH_CTL, 0x20,
- 0x20);
- snd_soc_update_bits(codec,
- WCD9360_CDC_TX12_SPKR_PROT_PATH_CTL, 0x20,
- 0x20);
- snd_soc_update_bits(codec,
- WCD9360_CDC_TX11_SPKR_PROT_PATH_CTL, 0x0F,
- 0x00);
- snd_soc_update_bits(codec,
- WCD9360_CDC_TX12_SPKR_PROT_PATH_CTL, 0x0F,
- 0x00);
- snd_soc_update_bits(codec,
- WCD9360_CDC_TX11_SPKR_PROT_PATH_CTL, 0x10,
- 0x10);
- snd_soc_update_bits(codec,
- WCD9360_CDC_TX12_SPKR_PROT_PATH_CTL, 0x10,
- 0x10);
- snd_soc_update_bits(codec,
- WCD9360_CDC_TX11_SPKR_PROT_PATH_CTL, 0x20,
- 0x00);
- snd_soc_update_bits(codec,
- WCD9360_CDC_TX12_SPKR_PROT_PATH_CTL, 0x20,
- 0x00);
- }
- dai->bus_down_in_recovery = false;
- pahu_codec_enable_slim_port_intr(dai, codec);
- (void) pahu_codec_enable_slim_chmask(dai, true);
- ret = wcd9xxx_cfg_slim_sch_tx(core, &dai->wcd9xxx_ch_list,
- dai->rate, dai->bit_width,
- &dai->grph);
- break;
- case SND_SOC_DAPM_POST_PMD:
- ret = wcd9xxx_close_slim_sch_tx(core, &dai->wcd9xxx_ch_list,
- dai->grph);
- if (ret)
- dev_err(codec->dev, "%s error in close_slim_sch_tx %d\n",
- __func__, ret);
- if (!dai->bus_down_in_recovery)
- ret = pahu_codec_enable_slim_chmask(dai, false);
- if (ret < 0) {
- ret = wcd9xxx_disconnect_port(core,
- &dai->wcd9xxx_ch_list,
- dai->grph);
- dev_dbg(codec->dev, "%s: Disconnect TX port, ret = %d\n",
- __func__, ret);
- }
- if (test_bit(VI_SENSE_1, &pahu_p->status_mask)) {
- /* Disable V&I sensing */
- dev_dbg(codec->dev, "%s: spkr1 disabled\n", __func__);
- snd_soc_update_bits(codec,
- WCD9360_CDC_TX9_SPKR_PROT_PATH_CTL, 0x20, 0x20);
- snd_soc_update_bits(codec,
- WCD9360_CDC_TX10_SPKR_PROT_PATH_CTL, 0x20,
- 0x20);
- snd_soc_update_bits(codec,
- WCD9360_CDC_TX9_SPKR_PROT_PATH_CTL, 0x10, 0x00);
- snd_soc_update_bits(codec,
- WCD9360_CDC_TX10_SPKR_PROT_PATH_CTL, 0x10,
- 0x00);
- }
- if (test_bit(VI_SENSE_2, &pahu_p->status_mask)) {
- /* Disable V&I sensing */
- dev_dbg(codec->dev, "%s: spkr2 disabled\n", __func__);
- snd_soc_update_bits(codec,
- WCD9360_CDC_TX11_SPKR_PROT_PATH_CTL, 0x20,
- 0x20);
- snd_soc_update_bits(codec,
- WCD9360_CDC_TX12_SPKR_PROT_PATH_CTL, 0x20,
- 0x20);
- snd_soc_update_bits(codec,
- WCD9360_CDC_TX11_SPKR_PROT_PATH_CTL, 0x10,
- 0x00);
- snd_soc_update_bits(codec,
- WCD9360_CDC_TX12_SPKR_PROT_PATH_CTL, 0x10,
- 0x00);
- }
- break;
- }
-done:
- return ret;
-}
-
-static void pahu_codec_enable_i2s(struct snd_soc_codec *codec, bool enable)
-{
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
-
- if (enable) {
- if (++pahu->i2s_ref_cnt == 1)
- snd_soc_update_bits(codec, WCD9360_DATA_HUB_I2S_1_CTL,
- 0x01, 0x01);
- } else {
- if (--pahu->i2s_ref_cnt == 0)
- snd_soc_update_bits(codec, WCD9360_DATA_HUB_I2S_1_CTL,
- 0x01, 0x00);
- }
-}
-
-static int pahu_i2s_aif_rx_event(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
-
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
- switch(event) {
- case SND_SOC_DAPM_PRE_PMU:
- pahu_cdc_mclk_enable(codec, true);
- break;
- case SND_SOC_DAPM_POST_PMU:
- pahu_codec_enable_i2s(codec, true);
- break;
- case SND_SOC_DAPM_PRE_PMD:
- pahu_codec_enable_i2s(codec, false);
- break;
- case SND_SOC_DAPM_POST_PMD:
- pahu_cdc_mclk_enable(codec, false);
- break;
- }
-
- return 0;
-}
-
-static int pahu_i2s_aif_tx_event(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
-
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
- switch(event) {
- case SND_SOC_DAPM_PRE_PMU:
- pahu_cdc_mclk_enable(codec, true);
- break;
- case SND_SOC_DAPM_POST_PMU:
- pahu_codec_enable_i2s(codec, true);
- break;
- case SND_SOC_DAPM_PRE_PMD:
- pahu_codec_enable_i2s(codec, false);
- break;
- case SND_SOC_DAPM_POST_PMD:
- pahu_cdc_mclk_enable(codec, false);
- break;
- }
-
- return 0;
-}
-
-static int pahu_codec_enable_ldo_rxtx(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol, int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
- struct wcd9xxx_pdata *pdata = dev_get_platdata(codec->dev->parent);
-
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- pahu->ldo_rxtx_cnt++;
- if (pahu->ldo_rxtx_cnt == 1) {
- /* Enable VDD_LDO_RxTx regulator */
- msm_cdc_enable_ondemand_supply(pahu->wcd9xxx->dev,
- pahu->wcd9xxx->supplies,
- pdata->regulator,
- pdata->num_supplies,
- WCD9360_LDO_RXTX_SUPPLY_NAME);
-
- snd_soc_update_bits(codec, WCD9360_LDORXTX_LDORXTX,
- 0x80, 0x80);
- /*
- * 200us sleep is required after LDO_RXTX is enabled as per
- * HW requirement
- */
- usleep_range(200, 250);
- }
- break;
- case SND_SOC_DAPM_POST_PMD:
- pahu->ldo_rxtx_cnt--;
- if (pahu->ldo_rxtx_cnt < 0)
- pahu->ldo_rxtx_cnt = 0;
-
- if (!pahu->ldo_rxtx_cnt) {
- snd_soc_update_bits(codec, WCD9360_LDORXTX_LDORXTX,
- 0x80, 0x00);
- /* Disable VDD_LDO_RxTx regulator */
- msm_cdc_disable_ondemand_supply(pahu->wcd9xxx->dev,
- pahu->wcd9xxx->supplies,
- pdata->regulator,
- pdata->num_supplies,
- WCD9360_LDO_RXTX_SUPPLY_NAME);
- }
- break;
- };
- dev_dbg(codec->dev, "%s: Current LDO RXTX user count: %d\n", __func__,
- pahu->ldo_rxtx_cnt);
-
- return 0;
-}
-
-static void pahu_spk_anc_update_callback(struct work_struct *work)
-{
- struct spk_anc_work *spk_anc_dwork;
- struct pahu_priv *pahu;
- struct delayed_work *delayed_work;
- struct snd_soc_codec *codec;
-
- delayed_work = to_delayed_work(work);
- spk_anc_dwork = container_of(delayed_work, struct spk_anc_work, dwork);
- pahu = spk_anc_dwork->pahu;
- codec = pahu->codec;
-
- snd_soc_update_bits(codec, WCD9360_CDC_RX7_RX_PATH_CFG0, 0x10, 0x10);
-}
-
-static int pahu_codec_enable_spkr_anc(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- int ret = 0;
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
-
- if (!pahu->anc_func)
- return 0;
-
- dev_dbg(codec->dev, "%s: w: %s event: %d anc: %d\n", __func__,
- w->name, event, pahu->anc_func);
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- ret = pahu_codec_enable_anc(w, kcontrol, event);
- schedule_delayed_work(&pahu->spk_anc_dwork.dwork,
- msecs_to_jiffies(spk_anc_en_delay));
- break;
- case SND_SOC_DAPM_POST_PMD:
- cancel_delayed_work_sync(&pahu->spk_anc_dwork.dwork);
- snd_soc_update_bits(codec, WCD9360_CDC_RX7_RX_PATH_CFG0,
- 0x10, 0x00);
- ret = pahu_codec_enable_anc(w, kcontrol, event);
- break;
- }
- return ret;
-}
-
-static int pahu_codec_enable_aux_pa(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- int ret = 0;
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
-
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
-
- switch (event) {
- case SND_SOC_DAPM_POST_PMU:
- /*
- * 5ms sleep is required after PA is enabled as per
- * HW requirement
- */
- usleep_range(5000, 5500);
- snd_soc_update_bits(codec, WCD9360_CDC_RX9_RX_PATH_CTL,
- 0x10, 0x00);
- /* Remove mix path mute if it is enabled */
- if ((snd_soc_read(codec, WCD9360_CDC_RX9_RX_PATH_MIX_CTL)) &
- 0x10)
- snd_soc_update_bits(codec,
- WCD9360_CDC_RX9_RX_PATH_MIX_CTL,
- 0x10, 0x00);
- break;
- default:
- break;
- };
-
- return ret;
-}
-
-static int pahu_codec_enable_ear_pa(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- int ret = 0;
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
-
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
-
- switch (event) {
- case SND_SOC_DAPM_POST_PMU:
- /*
- * 5ms sleep is required after PA is enabled as per
- * HW requirement
- */
- usleep_range(5000, 5500);
- snd_soc_update_bits(codec, WCD9360_CDC_RX0_RX_PATH_CTL,
- 0x10, 0x00);
- /* Remove mix path mute if it is enabled */
- if ((snd_soc_read(codec, WCD9360_CDC_RX0_RX_PATH_MIX_CTL)) &
- 0x10)
- snd_soc_update_bits(codec,
- WCD9360_CDC_RX0_RX_PATH_MIX_CTL,
- 0x10, 0x00);
- break;
- case SND_SOC_DAPM_POST_PMD:
- /*
- * 5ms sleep is required after PA is disabled as per
- * HW requirement
- */
- usleep_range(5000, 5500);
-
- if (!(strcmp(w->name, "ANC EAR PA"))) {
- ret = pahu_codec_enable_anc(w, kcontrol, event);
- snd_soc_update_bits(codec, WCD9360_CDC_RX0_RX_PATH_CFG0,
- 0x10, 0x00);
- }
- break;
- };
-
- return ret;
-}
-
-static int pahu_codec_ear_dac_event(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- int ret = 0;
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
-
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- if (pahu->anc_func) {
- ret = pahu_codec_enable_anc(w, kcontrol, event);
- snd_soc_update_bits(codec, WCD9360_CDC_RX0_RX_PATH_CFG0,
- 0x10, 0x10);
- }
- break;
- default:
- break;
- };
-
- return ret;
-}
-
-static int pahu_codec_spk_boost_event(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- u16 boost_path_ctl, boost_path_cfg1;
- u16 reg, reg_mix;
-
- dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
-
- if (!strcmp(w->name, "RX INT7 CHAIN")) {
- boost_path_ctl = WCD9360_CDC_BOOST0_BOOST_PATH_CTL;
- boost_path_cfg1 = WCD9360_CDC_RX7_RX_PATH_CFG1;
- reg = WCD9360_CDC_RX7_RX_PATH_CTL;
- reg_mix = WCD9360_CDC_RX7_RX_PATH_MIX_CTL;
- } else if (!strcmp(w->name, "RX INT8 CHAIN")) {
- boost_path_ctl = WCD9360_CDC_BOOST1_BOOST_PATH_CTL;
- boost_path_cfg1 = WCD9360_CDC_RX8_RX_PATH_CFG1;
- reg = WCD9360_CDC_RX8_RX_PATH_CTL;
- reg_mix = WCD9360_CDC_RX8_RX_PATH_MIX_CTL;
- } else {
- dev_err(codec->dev, "%s: unknown widget: %s\n",
- __func__, w->name);
- return -EINVAL;
- }
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- snd_soc_update_bits(codec, boost_path_cfg1, 0x01, 0x01);
- snd_soc_update_bits(codec, boost_path_ctl, 0x10, 0x10);
- snd_soc_update_bits(codec, reg, 0x10, 0x00);
- if ((snd_soc_read(codec, reg_mix)) & 0x10)
- snd_soc_update_bits(codec, reg_mix, 0x10, 0x00);
- break;
- case SND_SOC_DAPM_POST_PMD:
- snd_soc_update_bits(codec, boost_path_ctl, 0x10, 0x00);
- snd_soc_update_bits(codec, boost_path_cfg1, 0x01, 0x00);
- break;
- };
-
- return 0;
-}
-
-static int __pahu_codec_enable_swr(struct snd_soc_dapm_widget *w, int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct pahu_priv *pahu;
- int ch_cnt = 0;
-
- pahu = snd_soc_codec_get_drvdata(codec);
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- if (((strnstr(w->name, "INT7_", sizeof("RX INT7_"))) ||
- (strnstr(w->name, "INT7 MIX2",
- sizeof("RX INT7 MIX2")))))
- pahu->swr.rx_7_count++;
- if ((strnstr(w->name, "INT8_", sizeof("RX INT8_"))) &&
- !pahu->swr.rx_8_count)
- pahu->swr.rx_8_count++;
- ch_cnt = !!(pahu->swr.rx_7_count) + pahu->swr.rx_8_count;
-
- swrm_wcd_notify(pahu->swr.ctrl_data[0].swr_pdev,
- SWR_DEVICE_UP, NULL);
- swrm_wcd_notify(pahu->swr.ctrl_data[0].swr_pdev,
- SWR_SET_NUM_RX_CH, &ch_cnt);
- break;
- case SND_SOC_DAPM_POST_PMD:
- if ((strnstr(w->name, "INT7_", sizeof("RX INT7_"))) ||
- (strnstr(w->name, "INT7 MIX2",
- sizeof("RX INT7 MIX2"))))
- pahu->swr.rx_7_count--;
- if ((strnstr(w->name, "INT8_", sizeof("RX INT8_"))) &&
- pahu->swr.rx_8_count)
- pahu->swr.rx_8_count--;
- ch_cnt = !!(pahu->swr.rx_7_count) + pahu->swr.rx_8_count;
-
- swrm_wcd_notify(pahu->swr.ctrl_data[0].swr_pdev,
- SWR_SET_NUM_RX_CH, &ch_cnt);
-
- break;
- }
- dev_dbg(pahu->dev, "%s: %s: current swr ch cnt: %d\n",
- __func__, w->name, ch_cnt);
-
- return 0;
-}
-
-static int pahu_codec_enable_swr(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol, int event)
-{
- return __pahu_codec_enable_swr(w, event);
-}
-
-static int pahu_codec_config_mad(struct snd_soc_codec *codec)
-{
- int ret = 0;
- int idx;
- const struct firmware *fw;
- struct firmware_cal *hwdep_cal = NULL;
- struct wcd_mad_audio_cal *mad_cal = NULL;
- const void *data;
- const char *filename = WCD9360_MAD_AUDIO_FIRMWARE_PATH;
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
- size_t cal_size;
-
- hwdep_cal = wcdcal_get_fw_cal(pahu->fw_data, WCD9XXX_MAD_CAL);
- if (hwdep_cal) {
- data = hwdep_cal->data;
- cal_size = hwdep_cal->size;
- dev_dbg(codec->dev, "%s: using hwdep calibration\n",
- __func__);
- } else {
- ret = request_firmware(&fw, filename, codec->dev);
- if (ret || !fw) {
- dev_err(codec->dev,
- "%s: MAD firmware acquire failed, err = %d\n",
- __func__, ret);
- return -ENODEV;
- }
- data = fw->data;
- cal_size = fw->size;
- dev_dbg(codec->dev, "%s: using request_firmware calibration\n",
- __func__);
- }
-
- if (cal_size < sizeof(*mad_cal)) {
- dev_err(codec->dev,
- "%s: Incorrect size %zd for MAD Cal, expected %zd\n",
- __func__, cal_size, sizeof(*mad_cal));
- ret = -ENOMEM;
- goto done;
- }
-
- mad_cal = (struct wcd_mad_audio_cal *) (data);
- if (!mad_cal) {
- dev_err(codec->dev,
- "%s: Invalid calibration data\n",
- __func__);
- ret = -EINVAL;
- goto done;
- }
-
- snd_soc_write(codec, WCD9360_SOC_MAD_MAIN_CTL_2,
- mad_cal->microphone_info.cycle_time);
- snd_soc_update_bits(codec, WCD9360_SOC_MAD_MAIN_CTL_1, 0xFF << 3,
- ((uint16_t)mad_cal->microphone_info.settle_time)
- << 3);
-
- /* Audio */
- snd_soc_write(codec, WCD9360_SOC_MAD_AUDIO_CTL_8,
- mad_cal->audio_info.rms_omit_samples);
- snd_soc_update_bits(codec, WCD9360_SOC_MAD_AUDIO_CTL_1,
- 0x07 << 4, mad_cal->audio_info.rms_comp_time << 4);
- snd_soc_update_bits(codec, WCD9360_SOC_MAD_AUDIO_CTL_2, 0x03 << 2,
- mad_cal->audio_info.detection_mechanism << 2);
- snd_soc_write(codec, WCD9360_SOC_MAD_AUDIO_CTL_7,
- mad_cal->audio_info.rms_diff_threshold & 0x3F);
- snd_soc_write(codec, WCD9360_SOC_MAD_AUDIO_CTL_5,
- mad_cal->audio_info.rms_threshold_lsb);
- snd_soc_write(codec, WCD9360_SOC_MAD_AUDIO_CTL_6,
- mad_cal->audio_info.rms_threshold_msb);
-
- for (idx = 0; idx < ARRAY_SIZE(mad_cal->audio_info.iir_coefficients);
- idx++) {
- snd_soc_update_bits(codec, WCD9360_SOC_MAD_AUDIO_IIR_CTL_PTR,
- 0x3F, idx);
- snd_soc_write(codec, WCD9360_SOC_MAD_AUDIO_IIR_CTL_VAL,
- mad_cal->audio_info.iir_coefficients[idx]);
- dev_dbg(codec->dev, "%s:MAD Audio IIR Coef[%d] = 0X%x",
- __func__, idx,
- mad_cal->audio_info.iir_coefficients[idx]);
- }
-
- /* Beacon */
- snd_soc_write(codec, WCD9360_SOC_MAD_BEACON_CTL_8,
- mad_cal->beacon_info.rms_omit_samples);
- snd_soc_update_bits(codec, WCD9360_SOC_MAD_BEACON_CTL_1,
- 0x07 << 4, mad_cal->beacon_info.rms_comp_time << 4);
- snd_soc_update_bits(codec, WCD9360_SOC_MAD_BEACON_CTL_2, 0x03 << 2,
- mad_cal->beacon_info.detection_mechanism << 2);
- snd_soc_write(codec, WCD9360_SOC_MAD_BEACON_CTL_7,
- mad_cal->beacon_info.rms_diff_threshold & 0x1F);
- snd_soc_write(codec, WCD9360_SOC_MAD_BEACON_CTL_5,
- mad_cal->beacon_info.rms_threshold_lsb);
- snd_soc_write(codec, WCD9360_SOC_MAD_BEACON_CTL_6,
- mad_cal->beacon_info.rms_threshold_msb);
-
- for (idx = 0; idx < ARRAY_SIZE(mad_cal->beacon_info.iir_coefficients);
- idx++) {
- snd_soc_update_bits(codec, WCD9360_SOC_MAD_BEACON_IIR_CTL_PTR,
- 0x3F, idx);
- snd_soc_write(codec, WCD9360_SOC_MAD_BEACON_IIR_CTL_VAL,
- mad_cal->beacon_info.iir_coefficients[idx]);
- dev_dbg(codec->dev, "%s:MAD Beacon IIR Coef[%d] = 0X%x",
- __func__, idx,
- mad_cal->beacon_info.iir_coefficients[idx]);
- }
-
- /* Ultrasound */
- snd_soc_update_bits(codec, WCD9360_SOC_MAD_ULTR_CTL_1,
- 0x07 << 4,
- mad_cal->ultrasound_info.rms_comp_time << 4);
- snd_soc_update_bits(codec, WCD9360_SOC_MAD_ULTR_CTL_2, 0x03 << 2,
- mad_cal->ultrasound_info.detection_mechanism << 2);
- snd_soc_write(codec, WCD9360_SOC_MAD_ULTR_CTL_7,
- mad_cal->ultrasound_info.rms_diff_threshold & 0x1F);
- snd_soc_write(codec, WCD9360_SOC_MAD_ULTR_CTL_5,
- mad_cal->ultrasound_info.rms_threshold_lsb);
- snd_soc_write(codec, WCD9360_SOC_MAD_ULTR_CTL_6,
- mad_cal->ultrasound_info.rms_threshold_msb);
-
-done:
- if (!hwdep_cal)
- release_firmware(fw);
-
- return ret;
-}
-
-static int __pahu_codec_enable_mad(struct snd_soc_codec *codec, bool enable)
-{
- int rc = 0;
-
- /* Return if CPE INPUT is DEC1 */
- if (snd_soc_read(codec, WCD9360_CPE_SS_SVA_CFG) & 0x04) {
- dev_dbg(codec->dev, "%s: MAD is bypassed, skip mad %s\n",
- __func__, enable ? "enable" : "disable");
- return rc;
- }
-
- dev_dbg(codec->dev, "%s: enable = %s\n", __func__,
- enable ? "enable" : "disable");
-
- if (enable) {
- snd_soc_update_bits(codec, WCD9360_SOC_MAD_AUDIO_CTL_2,
- 0x03, 0x03);
- rc = pahu_codec_config_mad(codec);
- if (rc < 0) {
- snd_soc_update_bits(codec, WCD9360_SOC_MAD_AUDIO_CTL_2,
- 0x03, 0x00);
- goto done;
- }
-
- /* Turn on MAD clk */
- snd_soc_update_bits(codec, WCD9360_CPE_SS_MAD_CTL,
- 0x01, 0x01);
-
- /* Undo reset for MAD */
- snd_soc_update_bits(codec, WCD9360_CPE_SS_MAD_CTL,
- 0x02, 0x00);
- snd_soc_update_bits(codec, WCD9360_CODEC_RPM_CLK_MCLK_CFG,
- 0x04, 0x04);
- } else {
- snd_soc_update_bits(codec, WCD9360_SOC_MAD_AUDIO_CTL_2,
- 0x03, 0x00);
- /* Reset the MAD block */
- snd_soc_update_bits(codec, WCD9360_CPE_SS_MAD_CTL,
- 0x02, 0x02);
- /* Turn off MAD clk */
- snd_soc_update_bits(codec, WCD9360_CPE_SS_MAD_CTL,
- 0x01, 0x00);
- snd_soc_update_bits(codec, WCD9360_CODEC_RPM_CLK_MCLK_CFG,
- 0x04, 0x00);
- }
-done:
- return rc;
-}
-
-static int pahu_codec_ape_enable_mad(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
- int rc = 0;
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- snd_soc_update_bits(codec, WCD9360_CPE_SS_SVA_CFG, 0x40, 0x40);
- rc = __pahu_codec_enable_mad(codec, true);
- break;
- case SND_SOC_DAPM_PRE_PMD:
- snd_soc_update_bits(codec, WCD9360_CPE_SS_SVA_CFG, 0x40, 0x00);
- __pahu_codec_enable_mad(codec, false);
- break;
- }
-
- dev_dbg(pahu->dev, "%s: event = %d\n", __func__, event);
- return rc;
-}
-
-static int pahu_codec_cpe_mad_ctl(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol, int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
- int rc = 0;
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- pahu->mad_switch_cnt++;
- if (pahu->mad_switch_cnt != 1)
- goto done;
-
- snd_soc_update_bits(codec, WCD9360_CPE_SS_SVA_CFG, 0x20, 0x20);
- rc = __pahu_codec_enable_mad(codec, true);
- if (rc < 0) {
- pahu->mad_switch_cnt--;
- goto done;
- }
-
- break;
- case SND_SOC_DAPM_PRE_PMD:
- pahu->mad_switch_cnt--;
- if (pahu->mad_switch_cnt != 0)
- goto done;
-
- snd_soc_update_bits(codec, WCD9360_CPE_SS_SVA_CFG, 0x20, 0x00);
- __pahu_codec_enable_mad(codec, false);
- break;
- }
-done:
- dev_dbg(pahu->dev, "%s: event = %d, mad_switch_cnt = %d\n",
- __func__, event, pahu->mad_switch_cnt);
- return rc;
-}
-
-static int pahu_get_asrc_mode(struct pahu_priv *pahu, int asrc,
- u8 main_sr, u8 mix_sr)
-{
- u8 asrc_output_mode;
- int asrc_mode = CONV_88P2K_TO_384K;
-
- if ((asrc < 0) || (asrc >= ASRC_MAX))
- return 0;
-
- asrc_output_mode = pahu->asrc_output_mode[asrc];
-
- if (asrc_output_mode) {
- /*
- * If Mix sample rate is < 96KHz, use 96K to 352.8K
- * conversion, or else use 384K to 352.8K conversion
- */
- if (mix_sr < 5)
- asrc_mode = CONV_96K_TO_352P8K;
- else
- asrc_mode = CONV_384K_TO_352P8K;
- } else {
- /* Integer main and Fractional mix path */
- if (main_sr < 8 && mix_sr > 9) {
- asrc_mode = CONV_352P8K_TO_384K;
- } else if (main_sr > 8 && mix_sr < 8) {
- /* Fractional main and Integer mix path */
- if (mix_sr < 5)
- asrc_mode = CONV_96K_TO_352P8K;
- else
- asrc_mode = CONV_384K_TO_352P8K;
- } else if (main_sr < 8 && mix_sr < 8) {
- /* Integer main and Integer mix path */
- asrc_mode = CONV_96K_TO_384K;
- }
- }
-
- return asrc_mode;
-}
-
-static int pahu_codec_wdma3_ctl(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol, int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- /* Fix to 16KHz */
- snd_soc_update_bits(codec, WCD9360_DMA_WDMA_CTL_3,
- 0xF0, 0x10);
- /* Select mclk_1 */
- snd_soc_update_bits(codec, WCD9360_DMA_WDMA_CTL_3,
- 0x02, 0x00);
- /* Enable DMA */
- snd_soc_update_bits(codec, WCD9360_DMA_WDMA_CTL_3,
- 0x01, 0x01);
- break;
-
- case SND_SOC_DAPM_POST_PMD:
- /* Disable DMA */
- snd_soc_update_bits(codec, WCD9360_DMA_WDMA_CTL_3,
- 0x01, 0x00);
- break;
-
- };
-
- return 0;
-}
-static int pahu_codec_enable_asrc(struct snd_soc_codec *codec,
- int asrc_in, int event)
-{
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
- u16 cfg_reg, ctl_reg, clk_reg, asrc_ctl, mix_ctl_reg, paired_reg;
- int asrc, ret = 0;
- u8 main_sr, mix_sr, asrc_mode = 0;
-
- switch (asrc_in) {
- case ASRC_IN_SPKR1:
- cfg_reg = WCD9360_CDC_RX7_RX_PATH_CFG0;
- ctl_reg = WCD9360_CDC_RX7_RX_PATH_CTL;
- clk_reg = WCD9360_MIXING_ASRC2_CLK_RST_CTL;
- paired_reg = WCD9360_MIXING_ASRC2_CLK_RST_CTL;
- asrc_ctl = WCD9360_MIXING_ASRC2_CTL1;
- asrc = ASRC2;
- break;
- case ASRC_IN_SPKR2:
- cfg_reg = WCD9360_CDC_RX8_RX_PATH_CFG0;
- ctl_reg = WCD9360_CDC_RX8_RX_PATH_CTL;
- clk_reg = WCD9360_MIXING_ASRC3_CLK_RST_CTL;
- paired_reg = WCD9360_MIXING_ASRC3_CLK_RST_CTL;
- asrc_ctl = WCD9360_MIXING_ASRC3_CTL1;
- asrc = ASRC3;
- break;
- default:
- dev_err(codec->dev, "%s: Invalid asrc input :%d\n", __func__,
- asrc_in);
- ret = -EINVAL;
- goto done;
- };
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- if (pahu->asrc_users[asrc] == 0) {
- if ((snd_soc_read(codec, clk_reg) & 0x02) ||
- (snd_soc_read(codec, paired_reg) & 0x02)) {
- snd_soc_update_bits(codec, clk_reg,
- 0x02, 0x00);
- snd_soc_update_bits(codec, paired_reg,
- 0x02, 0x00);
- }
- snd_soc_update_bits(codec, cfg_reg, 0x80, 0x80);
- snd_soc_update_bits(codec, clk_reg, 0x01, 0x01);
- main_sr = snd_soc_read(codec, ctl_reg) & 0x0F;
- mix_ctl_reg = ctl_reg + 5;
- mix_sr = snd_soc_read(codec, mix_ctl_reg) & 0x0F;
- asrc_mode = pahu_get_asrc_mode(pahu, asrc,
- main_sr, mix_sr);
- dev_dbg(codec->dev, "%s: main_sr:%d mix_sr:%d asrc_mode %d\n",
- __func__, main_sr, mix_sr, asrc_mode);
- snd_soc_update_bits(codec, asrc_ctl, 0x07, asrc_mode);
- }
- pahu->asrc_users[asrc]++;
- break;
- case SND_SOC_DAPM_POST_PMD:
- pahu->asrc_users[asrc]--;
- if (pahu->asrc_users[asrc] <= 0) {
- pahu->asrc_users[asrc] = 0;
- snd_soc_update_bits(codec, asrc_ctl, 0x07, 0x00);
- snd_soc_update_bits(codec, cfg_reg, 0x80, 0x00);
- snd_soc_update_bits(codec, clk_reg, 0x03, 0x02);
- }
- break;
- };
-
- dev_dbg(codec->dev, "%s: ASRC%d, users: %d\n",
- __func__, asrc, pahu->asrc_users[asrc]);
-
-done:
- return ret;
-}
-
-static int pahu_codec_enable_asrc_resampler(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- int ret = 0;
- u8 cfg, asrc_in;
-
- cfg = snd_soc_read(codec, WCD9360_CDC_RX_INP_MUX_SPLINE_ASRC_CFG0);
- if (!(cfg & 0xFF)) {
- dev_err(codec->dev, "%s: ASRC%u input not selected\n",
- __func__, w->shift);
- return -EINVAL;
- }
-
- switch (w->shift) {
- case ASRC2:
- asrc_in = ((cfg & 0x30) == 0x20) ? ASRC_IN_SPKR1 : ASRC_INVALID;
- ret = pahu_codec_enable_asrc(codec, asrc_in, event);
- break;
- case ASRC3:
- asrc_in = ((cfg & 0xC0) == 0x80) ? ASRC_IN_SPKR2 : ASRC_INVALID;
- ret = pahu_codec_enable_asrc(codec, asrc_in, event);
- break;
- default:
- dev_err(codec->dev, "%s: Invalid asrc:%u\n", __func__,
- w->shift);
- ret = -EINVAL;
- break;
- };
-
- return ret;
-}
-
-static int pahu_enable_native_supply(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol, int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- if (++pahu->native_clk_users == 1) {
- snd_soc_update_bits(codec, WCD9360_CLK_SYS_PLL_ENABLES,
- 0x01, 0x01);
- usleep_range(100, 120);
- snd_soc_update_bits(codec, WCD9360_CLK_SYS_MCLK2_PRG1,
- 0x06, 0x02);
- snd_soc_update_bits(codec, WCD9360_CLK_SYS_MCLK2_PRG1,
- 0x01, 0x01);
- snd_soc_update_bits(codec, WCD9360_CODEC_RPM_CLK_GATE,
- 0x04, 0x00);
- /* Add sleep as per HW register sequence */
- usleep_range(30, 50);
- snd_soc_update_bits(codec,
- WCD9360_CDC_CLK_RST_CTRL_MCLK_CONTROL,
- 0x02, 0x02);
- snd_soc_update_bits(codec,
- WCD9360_CDC_CLK_RST_CTRL_FS_CNT_CONTROL,
- 0x10, 0x10);
- }
- break;
- case SND_SOC_DAPM_PRE_PMD:
- if (pahu->native_clk_users &&
- (--pahu->native_clk_users == 0)) {
- snd_soc_update_bits(codec,
- WCD9360_CDC_CLK_RST_CTRL_FS_CNT_CONTROL,
- 0x10, 0x00);
- snd_soc_update_bits(codec,
- WCD9360_CDC_CLK_RST_CTRL_MCLK_CONTROL,
- 0x02, 0x00);
- snd_soc_update_bits(codec, WCD9360_CODEC_RPM_CLK_GATE,
- 0x04, 0x04);
- snd_soc_update_bits(codec, WCD9360_CLK_SYS_MCLK2_PRG1,
- 0x01, 0x00);
- snd_soc_update_bits(codec, WCD9360_CLK_SYS_MCLK2_PRG1,
- 0x06, 0x00);
- snd_soc_update_bits(codec, WCD9360_CLK_SYS_PLL_ENABLES,
- 0x01, 0x00);
- }
- break;
- }
-
- dev_dbg(codec->dev, "%s: native_clk_users: %d, event: %d\n",
- __func__, pahu->native_clk_users, event);
-
- return 0;
-}
-
-static int pahu_codec_config_ear_spkr_gain(struct snd_soc_codec *codec,
- int event, int gain_reg)
-{
- int comp_gain_offset, val;
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
-
- switch (pahu->swr.spkr_mode) {
- /* Compander gain in SPKR_MODE1 case is 12 dB */
- case WCD9360_SPKR_MODE_1:
- comp_gain_offset = -12;
- break;
- /* Default case compander gain is 15 dB */
- default:
- comp_gain_offset = -15;
- break;
- }
-
- switch (event) {
- case SND_SOC_DAPM_POST_PMU:
- /* Apply ear spkr gain only if compander is enabled */
- if (pahu->comp_enabled[COMPANDER_7] &&
- (gain_reg == WCD9360_CDC_RX7_RX_VOL_CTL ||
- gain_reg == WCD9360_CDC_RX7_RX_VOL_MIX_CTL) &&
- (pahu->ear_spkr_gain != 0)) {
- /* For example, val is -8(-12+5-1) for 4dB of gain */
- val = comp_gain_offset + pahu->ear_spkr_gain - 1;
- snd_soc_write(codec, gain_reg, val);
-
- dev_dbg(codec->dev, "%s: RX7 Volume %d dB\n",
- __func__, val);
- }
- break;
- case SND_SOC_DAPM_POST_PMD:
- /*
- * Reset RX7 volume to 0 dB if compander is enabled and
- * ear_spkr_gain is non-zero.
- */
- if (pahu->comp_enabled[COMPANDER_7] &&
- (gain_reg == WCD9360_CDC_RX7_RX_VOL_CTL ||
- gain_reg == WCD9360_CDC_RX7_RX_VOL_MIX_CTL) &&
- (pahu->ear_spkr_gain != 0)) {
- snd_soc_write(codec, gain_reg, 0x0);
-
- dev_dbg(codec->dev, "%s: Reset RX7 Volume to 0 dB\n",
- __func__);
- }
- break;
- }
-
- return 0;
-}
-
-static int pahu_config_compander(struct snd_soc_codec *codec, int interp_n,
- int event)
-{
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
- int comp;
- u16 comp_ctl0_reg, rx_path_cfg0_reg;
-
- /* HPH, LO are not valid and AUX does not have compander */
- if (((interp_n >= INTERP_HPHL_NA) && (interp_n <= INTERP_LO4_NA)) ||
- (interp_n == INTERP_AUX))
- return 0;
-
- comp = interp_n;
- dev_dbg(codec->dev, "%s: event %d compander %d, enabled %d\n",
- __func__, event, comp, pahu->comp_enabled[comp]);
-
- if (!pahu->comp_enabled[comp])
- return 0;
-
- comp_ctl0_reg = WCD9360_CDC_COMPANDER0_CTL0 + (comp * 8);
- rx_path_cfg0_reg = WCD9360_CDC_RX0_RX_PATH_CFG0 + (comp * 20);
-
- if (SND_SOC_DAPM_EVENT_ON(event)) {
- /* Enable Compander Clock */
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x01, 0x01);
- /* Soft reset */
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x02, 0x02);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x02, 0x00);
- /* Compander enable */
- snd_soc_update_bits(codec, rx_path_cfg0_reg, 0x02, 0x02);
- }
-
- if (SND_SOC_DAPM_EVENT_OFF(event)) {
- snd_soc_update_bits(codec, rx_path_cfg0_reg, 0x02, 0x00);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x04, 0x04);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x02, 0x02);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x02, 0x00);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x01, 0x00);
- snd_soc_update_bits(codec, comp_ctl0_reg, 0x04, 0x00);
- }
-
- return 0;
-}
-
-/**
- * pahu_codec_enable_interp_clk - Enable main path Interpolator
- * clock.
- *
- * @codec: Codec instance
- * @event: Indicates speaker path gain offset value
- * @intp_idx: Interpolator index
- * Returns number of main clock users
- */
-int pahu_codec_enable_interp_clk(struct snd_soc_codec *codec,
- int event, int interp_idx)
-{
- struct pahu_priv *pahu;
- u16 main_reg;
-
- if (!codec) {
- pr_err("%s: codec is NULL\n", __func__);
- return -EINVAL;
- }
-
- pahu = snd_soc_codec_get_drvdata(codec);
-
- main_reg = WCD9360_CDC_RX0_RX_PATH_CTL +
- (interp_idx * WCD9360_RX_PATH_CTL_OFFSET);
-
- if (interp_idx == INTERP_AUX)
- main_reg = WCD9360_CDC_RX9_RX_PATH_CTL;
-
- if (SND_SOC_DAPM_EVENT_ON(event)) {
- if (pahu->main_clk_users[interp_idx] == 0) {
- /* Main path PGA mute enable */
- snd_soc_update_bits(codec, main_reg, 0x10, 0x10);
- /* Clk enable */
- snd_soc_update_bits(codec, main_reg, 0x20, 0x20);
- pahu_config_compander(codec, interp_idx, event);
- }
- pahu->main_clk_users[interp_idx]++;
- }
-
- if (SND_SOC_DAPM_EVENT_OFF(event)) {
- pahu->main_clk_users[interp_idx]--;
- if (pahu->main_clk_users[interp_idx] <= 0) {
- pahu->main_clk_users[interp_idx] = 0;
- pahu_config_compander(codec, interp_idx, event);
- /* Clk Disable */
- snd_soc_update_bits(codec, main_reg, 0x20, 0x00);
- /* Reset enable and disable */
- snd_soc_update_bits(codec, main_reg, 0x40, 0x40);
- snd_soc_update_bits(codec, main_reg, 0x40, 0x00);
- /* Reset rate to 48K*/
- snd_soc_update_bits(codec, main_reg, 0x0F, 0x04);
- }
- }
-
- dev_dbg(codec->dev, "%s event %d main_clk_users %d\n",
- __func__, event, pahu->main_clk_users[interp_idx]);
-
- return pahu->main_clk_users[interp_idx];
-}
-EXPORT_SYMBOL(pahu_codec_enable_interp_clk);
-
-static int pahu_codec_enable_mix_path(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
- u16 gain_reg, mix_reg;
- int offset_val = 0;
- int val = 0;
-
- if (w->shift >= WCD9360_NUM_INTERPOLATORS ||
- ((w->shift >= INTERP_HPHL_NA) && (w->shift <= INTERP_LO4_NA))) {
- dev_err(codec->dev, "%s: Invalid Interpolator value %d for name %s\n",
- __func__, w->shift, w->name);
- return -EINVAL;
- };
-
- gain_reg = WCD9360_CDC_RX0_RX_VOL_MIX_CTL +
- (w->shift * WCD9360_RX_PATH_CTL_OFFSET);
- mix_reg = WCD9360_CDC_RX0_RX_PATH_MIX_CTL +
- (w->shift * WCD9360_RX_PATH_CTL_OFFSET);
-
- if (w->shift == INTERP_AUX) {
- gain_reg = WCD9360_CDC_RX9_RX_VOL_MIX_CTL;
- mix_reg = WCD9360_CDC_RX9_RX_PATH_MIX_CTL;
- }
-
- if (w->shift == INTERP_SPKR1 || w->shift == INTERP_SPKR2)
- __pahu_codec_enable_swr(w, event);
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- pahu_codec_enable_interp_clk(codec, event, w->shift);
- /* Clk enable */
- snd_soc_update_bits(codec, mix_reg, 0x20, 0x20);
- break;
- case SND_SOC_DAPM_POST_PMU:
- if ((pahu->swr.spkr_gain_offset ==
- WCD9360_RX_GAIN_OFFSET_M1P5_DB) &&
- (pahu->comp_enabled[COMPANDER_7] ||
- pahu->comp_enabled[COMPANDER_8]) &&
- (gain_reg == WCD9360_CDC_RX7_RX_VOL_MIX_CTL ||
- gain_reg == WCD9360_CDC_RX8_RX_VOL_MIX_CTL)) {
- snd_soc_update_bits(codec, WCD9360_CDC_RX7_RX_PATH_SEC1,
- 0x01, 0x01);
- snd_soc_update_bits(codec,
- WCD9360_CDC_RX7_RX_PATH_MIX_SEC0,
- 0x01, 0x01);
- snd_soc_update_bits(codec, WCD9360_CDC_RX8_RX_PATH_SEC1,
- 0x01, 0x01);
- snd_soc_update_bits(codec,
- WCD9360_CDC_RX8_RX_PATH_MIX_SEC0,
- 0x01, 0x01);
- offset_val = -2;
- }
- val = snd_soc_read(codec, gain_reg);
- val += offset_val;
- snd_soc_write(codec, gain_reg, val);
- pahu_codec_config_ear_spkr_gain(codec, event, gain_reg);
- break;
- case SND_SOC_DAPM_POST_PMD:
- /* Clk Disable */
- snd_soc_update_bits(codec, mix_reg, 0x20, 0x00);
- pahu_codec_enable_interp_clk(codec, event, w->shift);
- /* Reset enable and disable */
- snd_soc_update_bits(codec, mix_reg, 0x40, 0x40);
- snd_soc_update_bits(codec, mix_reg, 0x40, 0x00);
-
- if ((pahu->swr.spkr_gain_offset ==
- WCD9360_RX_GAIN_OFFSET_M1P5_DB) &&
- (pahu->comp_enabled[COMPANDER_7] ||
- pahu->comp_enabled[COMPANDER_8]) &&
- (gain_reg == WCD9360_CDC_RX7_RX_VOL_MIX_CTL ||
- gain_reg == WCD9360_CDC_RX8_RX_VOL_MIX_CTL)) {
- snd_soc_update_bits(codec, WCD9360_CDC_RX7_RX_PATH_SEC1,
- 0x01, 0x00);
- snd_soc_update_bits(codec,
- WCD9360_CDC_RX7_RX_PATH_MIX_SEC0,
- 0x01, 0x00);
- snd_soc_update_bits(codec, WCD9360_CDC_RX8_RX_PATH_SEC1,
- 0x01, 0x00);
- snd_soc_update_bits(codec,
- WCD9360_CDC_RX8_RX_PATH_MIX_SEC0,
- 0x01, 0x00);
- offset_val = 2;
- val = snd_soc_read(codec, gain_reg);
- val += offset_val;
- snd_soc_write(codec, gain_reg, val);
- }
- pahu_codec_config_ear_spkr_gain(codec, event, gain_reg);
- break;
- };
- dev_dbg(codec->dev, "%s event %d name %s\n", __func__, event, w->name);
-
- return 0;
-}
-
-static int pahu_codec_enable_main_path(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
- u16 gain_reg;
- u16 reg;
- int val;
- int offset_val = 0;
-
- dev_dbg(codec->dev, "%s %d %s\n", __func__, event, w->name);
-
- if (w->shift >= WCD9360_NUM_INTERPOLATORS ||
- ((w->shift >= INTERP_HPHL_NA) && (w->shift <= INTERP_LO4_NA))) {
- dev_err(codec->dev, "%s: Invalid Interpolator value %d for name %s\n",
- __func__, w->shift, w->name);
- return -EINVAL;
- };
-
- reg = WCD9360_CDC_RX0_RX_PATH_CTL + (w->shift *
- WCD9360_RX_PATH_CTL_OFFSET);
- gain_reg = WCD9360_CDC_RX0_RX_VOL_CTL + (w->shift *
- WCD9360_RX_PATH_CTL_OFFSET);
-
- if (w->shift == INTERP_AUX) {
- reg = WCD9360_CDC_RX9_RX_PATH_CTL;
- gain_reg = WCD9360_CDC_RX9_RX_VOL_CTL;
- }
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- pahu_codec_enable_interp_clk(codec, event, w->shift);
- break;
- case SND_SOC_DAPM_POST_PMU:
- /* apply gain after int clk is enabled */
- if ((pahu->swr.spkr_gain_offset ==
- WCD9360_RX_GAIN_OFFSET_M1P5_DB) &&
- (pahu->comp_enabled[COMPANDER_7] ||
- pahu->comp_enabled[COMPANDER_8]) &&
- (gain_reg == WCD9360_CDC_RX7_RX_VOL_CTL ||
- gain_reg == WCD9360_CDC_RX8_RX_VOL_CTL)) {
- snd_soc_update_bits(codec, WCD9360_CDC_RX7_RX_PATH_SEC1,
- 0x01, 0x01);
- snd_soc_update_bits(codec,
- WCD9360_CDC_RX7_RX_PATH_MIX_SEC0,
- 0x01, 0x01);
- snd_soc_update_bits(codec, WCD9360_CDC_RX8_RX_PATH_SEC1,
- 0x01, 0x01);
- snd_soc_update_bits(codec,
- WCD9360_CDC_RX8_RX_PATH_MIX_SEC0,
- 0x01, 0x01);
- offset_val = -2;
- }
- val = snd_soc_read(codec, gain_reg);
- val += offset_val;
- snd_soc_write(codec, gain_reg, val);
- pahu_codec_config_ear_spkr_gain(codec, event, gain_reg);
- break;
- case SND_SOC_DAPM_POST_PMD:
- pahu_codec_enable_interp_clk(codec, event, w->shift);
-
- if ((pahu->swr.spkr_gain_offset ==
- WCD9360_RX_GAIN_OFFSET_M1P5_DB) &&
- (pahu->comp_enabled[COMPANDER_7] ||
- pahu->comp_enabled[COMPANDER_8]) &&
- (gain_reg == WCD9360_CDC_RX7_RX_VOL_CTL ||
- gain_reg == WCD9360_CDC_RX8_RX_VOL_CTL)) {
- snd_soc_update_bits(codec, WCD9360_CDC_RX7_RX_PATH_SEC1,
- 0x01, 0x00);
- snd_soc_update_bits(codec,
- WCD9360_CDC_RX7_RX_PATH_MIX_SEC0,
- 0x01, 0x00);
- snd_soc_update_bits(codec, WCD9360_CDC_RX8_RX_PATH_SEC1,
- 0x01, 0x00);
- snd_soc_update_bits(codec,
- WCD9360_CDC_RX8_RX_PATH_MIX_SEC0,
- 0x01, 0x00);
- offset_val = 2;
- val = snd_soc_read(codec, gain_reg);
- val += offset_val;
- snd_soc_write(codec, gain_reg, val);
- }
- pahu_codec_config_ear_spkr_gain(codec, event, gain_reg);
- break;
- };
-
- return 0;
-}
-
-static int pahu_codec_set_iir_gain(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol, int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
-
- dev_dbg(codec->dev, "%s: event = %d\n", __func__, event);
-
- switch (event) {
- case SND_SOC_DAPM_POST_PMU: /* fall through */
- case SND_SOC_DAPM_PRE_PMD:
- if (strnstr(w->name, "IIR0", sizeof("IIR0"))) {
- snd_soc_write(codec,
- WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B1_CTL,
- snd_soc_read(codec,
- WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B1_CTL));
- snd_soc_write(codec,
- WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B2_CTL,
- snd_soc_read(codec,
- WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B2_CTL));
- snd_soc_write(codec,
- WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B3_CTL,
- snd_soc_read(codec,
- WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B3_CTL));
- snd_soc_write(codec,
- WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B4_CTL,
- snd_soc_read(codec,
- WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B4_CTL));
- }
- break;
- }
- return 0;
-}
-
-static int pahu_codec_find_amic_input(struct snd_soc_codec *codec,
- int adc_mux_n)
-{
- u16 mask, shift, adc_mux_in_reg;
- u16 amic_mux_sel_reg;
- bool is_amic;
-
- if (adc_mux_n < 0 || adc_mux_n > WCD9360_MAX_VALID_ADC_MUX ||
- adc_mux_n == WCD9360_INVALID_ADC_MUX)
- return 0;
-
- if (adc_mux_n < 3) {
- adc_mux_in_reg = WCD9360_CDC_TX_INP_MUX_ADC_MUX0_CFG1 +
- 2 * adc_mux_n;
- mask = 0x03;
- shift = 0;
- amic_mux_sel_reg = WCD9360_CDC_TX_INP_MUX_ADC_MUX0_CFG0 +
- 2 * adc_mux_n;
- } else if (adc_mux_n < 4) {
- adc_mux_in_reg = WCD9360_CDC_TX_INP_MUX_ADC_MUX3_CFG1;
- mask = 0x03;
- shift = 0;
- amic_mux_sel_reg = WCD9360_CDC_TX_INP_MUX_ADC_MUX0_CFG0 +
- 2 * adc_mux_n;
- } else if (adc_mux_n < 7) {
- adc_mux_in_reg = WCD9360_CDC_TX_INP_MUX_ADC_MUX0_CFG1 +
- 2 * (adc_mux_n - 4);
- mask = 0x0C;
- shift = 2;
- amic_mux_sel_reg = WCD9360_CDC_TX_INP_MUX_ADC_MUX4_CFG0 +
- adc_mux_n - 4;
- } else if (adc_mux_n < 8) {
- adc_mux_in_reg = WCD9360_CDC_TX_INP_MUX_ADC_MUX3_CFG1;
- mask = 0x0C;
- shift = 2;
- amic_mux_sel_reg = WCD9360_CDC_TX_INP_MUX_ADC_MUX4_CFG0 +
- adc_mux_n - 4;
- } else if (adc_mux_n < 12) {
- adc_mux_in_reg = WCD9360_CDC_TX_INP_MUX_ADC_MUX0_CFG1 +
- 2 * (((adc_mux_n == 8) ? (adc_mux_n - 8) :
- (adc_mux_n - 9)));
- mask = 0x30;
- shift = 4;
- amic_mux_sel_reg = WCD9360_CDC_TX_INP_MUX_ADC_MUX8_CFG0 +
- ((adc_mux_n == 8) ? (adc_mux_n - 8) :
- (adc_mux_n - 9));
- }
-
- is_amic = (((snd_soc_read(codec, adc_mux_in_reg) & mask) >> shift)
- == 1);
- if (!is_amic)
- return 0;
-
- return snd_soc_read(codec, amic_mux_sel_reg) & 0x07;
-}
-
-static void pahu_codec_set_tx_hold(struct snd_soc_codec *codec,
- u16 amic_reg, bool set)
-{
- u8 mask = 0x20;
- u8 val;
-
- if (amic_reg == WCD9360_ANA_AMIC1 ||
- amic_reg == WCD9360_ANA_AMIC3)
- mask = 0x40;
-
- val = set ? mask : 0x00;
-
- switch (amic_reg) {
- case WCD9360_ANA_AMIC1:
- case WCD9360_ANA_AMIC2:
- snd_soc_update_bits(codec, WCD9360_ANA_AMIC2, mask, val);
- break;
- case WCD9360_ANA_AMIC3:
- case WCD9360_ANA_AMIC4:
- snd_soc_update_bits(codec, WCD9360_ANA_AMIC4, mask, val);
- break;
- default:
- dev_dbg(codec->dev, "%s: invalid amic: %d\n",
- __func__, amic_reg);
- break;
- }
-}
-
-static int pahu_codec_tx_adc_cfg(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol, int event)
-{
- int adc_mux_n = w->shift;
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- int amic_n;
-
- dev_dbg(codec->dev, "%s: event: %d\n", __func__, event);
-
- switch (event) {
- case SND_SOC_DAPM_POST_PMU:
- amic_n = pahu_codec_find_amic_input(codec, adc_mux_n);
- break;
- default:
- break;
- }
-
- return 0;
-}
-
-static u16 pahu_codec_get_amic_pwlvl_reg(struct snd_soc_codec *codec, int amic)
-{
- u16 pwr_level_reg = 0;
-
- switch (amic) {
- case 1:
- case 2:
- pwr_level_reg = WCD9360_ANA_AMIC1;
- break;
-
- case 3:
- case 4:
- pwr_level_reg = WCD9360_ANA_AMIC3;
- break;
- default:
- dev_dbg(codec->dev, "%s: invalid amic: %d\n",
- __func__, amic);
- break;
- }
-
- return pwr_level_reg;
-}
-
-#define TX_HPF_CUT_OFF_FREQ_MASK 0x60
-#define CF_MIN_3DB_4HZ 0x0
-#define CF_MIN_3DB_75HZ 0x1
-#define CF_MIN_3DB_150HZ 0x2
-
-static void pahu_tx_hpf_corner_freq_callback(struct work_struct *work)
-{
- struct delayed_work *hpf_delayed_work;
- struct hpf_work *hpf_work;
- struct pahu_priv *pahu;
- struct snd_soc_codec *codec;
- u16 dec_cfg_reg, amic_reg, go_bit_reg;
- u8 hpf_cut_off_freq;
- int amic_n;
-
- hpf_delayed_work = to_delayed_work(work);
- hpf_work = container_of(hpf_delayed_work, struct hpf_work, dwork);
- pahu = hpf_work->pahu;
- codec = pahu->codec;
- hpf_cut_off_freq = hpf_work->hpf_cut_off_freq;
-
- dec_cfg_reg = WCD9360_CDC_TX0_TX_PATH_CFG0 + 16 * hpf_work->decimator;
- go_bit_reg = dec_cfg_reg + 7;
-
- dev_dbg(codec->dev, "%s: decimator %u hpf_cut_of_freq 0x%x\n",
- __func__, hpf_work->decimator, hpf_cut_off_freq);
-
- amic_n = pahu_codec_find_amic_input(codec, hpf_work->decimator);
- if (amic_n) {
- amic_reg = WCD9360_ANA_AMIC1 + amic_n - 1;
- pahu_codec_set_tx_hold(codec, amic_reg, false);
- }
- snd_soc_update_bits(codec, dec_cfg_reg, TX_HPF_CUT_OFF_FREQ_MASK,
- hpf_cut_off_freq << 5);
- snd_soc_update_bits(codec, go_bit_reg, 0x02, 0x02);
- /* Minimum 1 clk cycle delay is required as per HW spec */
- usleep_range(1000, 1010);
- snd_soc_update_bits(codec, go_bit_reg, 0x02, 0x00);
-}
-
-static void pahu_tx_mute_update_callback(struct work_struct *work)
-{
- struct tx_mute_work *tx_mute_dwork;
- struct pahu_priv *pahu;
- struct delayed_work *delayed_work;
- struct snd_soc_codec *codec;
- u16 tx_vol_ctl_reg;
-
- delayed_work = to_delayed_work(work);
- tx_mute_dwork = container_of(delayed_work, struct tx_mute_work, dwork);
- pahu = tx_mute_dwork->pahu;
- codec = pahu->codec;
-
- tx_vol_ctl_reg = WCD9360_CDC_TX0_TX_PATH_CTL +
- 16 * tx_mute_dwork->decimator;
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x10, 0x00);
-}
-
-static int pahu_codec_enable_rx_path_clk(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol, int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- u16 sidetone_reg;
-
- dev_dbg(codec->dev, "%s %d %d\n", __func__, event, w->shift);
- sidetone_reg = WCD9360_CDC_RX0_RX_PATH_CFG1 + 0x14*(w->shift);
-
- if (w->shift == INTERP_AUX)
- sidetone_reg = WCD9360_CDC_RX9_RX_PATH_CFG1;
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- if (!strcmp(w->name, "RX INT7 MIX2 INP"))
- __pahu_codec_enable_swr(w, event);
- pahu_codec_enable_interp_clk(codec, event, w->shift);
- snd_soc_update_bits(codec, sidetone_reg, 0x10, 0x10);
- break;
- case SND_SOC_DAPM_POST_PMD:
- snd_soc_update_bits(codec, sidetone_reg, 0x10, 0x00);
- pahu_codec_enable_interp_clk(codec, event, w->shift);
- if (!strcmp(w->name, "RX INT7 MIX2 INP"))
- __pahu_codec_enable_swr(w, event);
- break;
- default:
- break;
- };
- return 0;
-}
-
-static int pahu_codec_enable_dec(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol, int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
- unsigned int decimator;
- char *dec_adc_mux_name = NULL;
- char *widget_name = NULL;
- char *wname;
- int ret = 0, amic_n;
- u16 tx_vol_ctl_reg, pwr_level_reg = 0, dec_cfg_reg, hpf_gate_reg;
- u16 tx_gain_ctl_reg;
- char *dec;
- u8 hpf_cut_off_freq;
-
- dev_dbg(codec->dev, "%s %d\n", __func__, event);
-
- widget_name = kstrndup(w->name, 15, GFP_KERNEL);
- if (!widget_name)
- return -ENOMEM;
-
- wname = widget_name;
- dec_adc_mux_name = strsep(&widget_name, " ");
- if (!dec_adc_mux_name) {
- dev_err(codec->dev, "%s: Invalid decimator = %s\n",
- __func__, w->name);
- ret = -EINVAL;
- goto out;
- }
- dec_adc_mux_name = widget_name;
-
- dec = strpbrk(dec_adc_mux_name, "012345678");
- if (!dec) {
- dev_err(codec->dev, "%s: decimator index not found\n",
- __func__);
- ret = -EINVAL;
- goto out;
- }
-
- ret = kstrtouint(dec, 10, &decimator);
- if (ret < 0) {
- dev_err(codec->dev, "%s: Invalid decimator = %s\n",
- __func__, wname);
- ret = -EINVAL;
- goto out;
- }
-
- dev_dbg(codec->dev, "%s(): widget = %s decimator = %u\n", __func__,
- w->name, decimator);
-
- tx_vol_ctl_reg = WCD9360_CDC_TX0_TX_PATH_CTL + 16 * decimator;
- hpf_gate_reg = WCD9360_CDC_TX0_TX_PATH_SEC2 + 16 * decimator;
- dec_cfg_reg = WCD9360_CDC_TX0_TX_PATH_CFG0 + 16 * decimator;
- tx_gain_ctl_reg = WCD9360_CDC_TX0_TX_VOL_CTL + 16 * decimator;
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- amic_n = pahu_codec_find_amic_input(codec, decimator);
- if (amic_n)
- pwr_level_reg = pahu_codec_get_amic_pwlvl_reg(codec,
- amic_n);
-
- if (pwr_level_reg) {
- switch ((snd_soc_read(codec, pwr_level_reg) &
- WCD9360_AMIC_PWR_LVL_MASK) >>
- WCD9360_AMIC_PWR_LVL_SHIFT) {
- case WCD9360_AMIC_PWR_LEVEL_LP:
- snd_soc_update_bits(codec, dec_cfg_reg,
- WCD9360_DEC_PWR_LVL_MASK,
- WCD9360_DEC_PWR_LVL_LP);
- break;
-
- case WCD9360_AMIC_PWR_LEVEL_HP:
- snd_soc_update_bits(codec, dec_cfg_reg,
- WCD9360_DEC_PWR_LVL_MASK,
- WCD9360_DEC_PWR_LVL_HP);
- break;
- case WCD9360_AMIC_PWR_LEVEL_DEFAULT:
- default:
- snd_soc_update_bits(codec, dec_cfg_reg,
- WCD9360_DEC_PWR_LVL_MASK,
- WCD9360_DEC_PWR_LVL_DF);
- break;
- }
- }
- /* Enable TX PGA Mute */
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x10, 0x10);
- break;
- case SND_SOC_DAPM_POST_PMU:
- hpf_cut_off_freq = (snd_soc_read(codec, dec_cfg_reg) &
- TX_HPF_CUT_OFF_FREQ_MASK) >> 5;
-
- pahu->tx_hpf_work[decimator].hpf_cut_off_freq =
- hpf_cut_off_freq;
- if (hpf_cut_off_freq != CF_MIN_3DB_150HZ) {
- snd_soc_update_bits(codec, dec_cfg_reg,
- TX_HPF_CUT_OFF_FREQ_MASK,
- CF_MIN_3DB_150HZ << 5);
- snd_soc_update_bits(codec, hpf_gate_reg, 0x02, 0x02);
- /*
- * Minimum 1 clk cycle delay is required as per
- * HW spec.
- */
- usleep_range(1000, 1010);
- snd_soc_update_bits(codec, hpf_gate_reg, 0x02, 0x00);
- }
- /* schedule work queue to Remove Mute */
- schedule_delayed_work(&pahu->tx_mute_dwork[decimator].dwork,
- msecs_to_jiffies(tx_unmute_delay));
- if (pahu->tx_hpf_work[decimator].hpf_cut_off_freq !=
- CF_MIN_3DB_150HZ)
- schedule_delayed_work(
- &pahu->tx_hpf_work[decimator].dwork,
- msecs_to_jiffies(300));
- /* apply gain after decimator is enabled */
- snd_soc_write(codec, tx_gain_ctl_reg,
- snd_soc_read(codec, tx_gain_ctl_reg));
- break;
- case SND_SOC_DAPM_PRE_PMD:
- hpf_cut_off_freq =
- pahu->tx_hpf_work[decimator].hpf_cut_off_freq;
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x10, 0x10);
- if (cancel_delayed_work_sync(
- &pahu->tx_hpf_work[decimator].dwork)) {
- if (hpf_cut_off_freq != CF_MIN_3DB_150HZ) {
- snd_soc_update_bits(codec, dec_cfg_reg,
- TX_HPF_CUT_OFF_FREQ_MASK,
- hpf_cut_off_freq << 5);
- snd_soc_update_bits(codec, hpf_gate_reg,
- 0x02, 0x02);
- /*
- * Minimum 1 clk cycle delay is required as per
- * HW spec.
- */
- usleep_range(1000, 1010);
- snd_soc_update_bits(codec, hpf_gate_reg,
- 0x02, 0x00);
- }
- }
- cancel_delayed_work_sync(
- &pahu->tx_mute_dwork[decimator].dwork);
- break;
- case SND_SOC_DAPM_POST_PMD:
- snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x10, 0x00);
- snd_soc_update_bits(codec, dec_cfg_reg,
- WCD9360_DEC_PWR_LVL_MASK,
- WCD9360_DEC_PWR_LVL_DF);
- break;
- };
-out:
- kfree(wname);
- return ret;
-}
-
-static u32 pahu_get_dmic_sample_rate(struct snd_soc_codec *codec,
- unsigned int dmic,
- struct wcd9xxx_pdata *pdata)
-{
- u8 tx_stream_fs;
- u8 adc_mux_index = 0, adc_mux_sel = 0;
- bool dec_found = false;
- u16 adc_mux_ctl_reg, tx_fs_reg;
- u32 dmic_fs;
-
- while (dec_found == 0 && adc_mux_index < WCD9360_MAX_VALID_ADC_MUX) {
- if (adc_mux_index < 4) {
- adc_mux_ctl_reg = WCD9360_CDC_TX_INP_MUX_ADC_MUX0_CFG0 +
- (adc_mux_index * 2);
- } else if (adc_mux_index < WCD9360_INVALID_ADC_MUX) {
- adc_mux_ctl_reg = WCD9360_CDC_TX_INP_MUX_ADC_MUX4_CFG0 +
- adc_mux_index - 4;
- } else if (adc_mux_index == WCD9360_INVALID_ADC_MUX) {
- ++adc_mux_index;
- continue;
- }
- adc_mux_sel = ((snd_soc_read(codec, adc_mux_ctl_reg) &
- 0xF8) >> 3) - 1;
-
- if (adc_mux_sel == dmic) {
- dec_found = true;
- break;
- }
-
- ++adc_mux_index;
- }
-
- if (dec_found && adc_mux_index <= 8) {
- tx_fs_reg = WCD9360_CDC_TX0_TX_PATH_CTL + (16 * adc_mux_index);
- tx_stream_fs = snd_soc_read(codec, tx_fs_reg) & 0x0F;
- if (tx_stream_fs <= 4) {
- if (pdata->dmic_sample_rate <=
- WCD9XXX_DMIC_SAMPLE_RATE_2P4MHZ)
- dmic_fs = pdata->dmic_sample_rate;
- else
- dmic_fs = WCD9XXX_DMIC_SAMPLE_RATE_2P4MHZ;
- } else
- dmic_fs = WCD9XXX_DMIC_SAMPLE_RATE_4P8MHZ;
- } else {
- dmic_fs = pdata->dmic_sample_rate;
- }
-
- return dmic_fs;
-}
-
-static u8 pahu_get_dmic_clk_val(struct snd_soc_codec *codec,
- u32 dmic_clk_rate)
-{
- u32 div_factor;
- u8 dmic_ctl_val = WCD9360_DMIC_CLK_DIV_2;
-
- dev_dbg(codec->dev, "%s: dmic_sample_rate = %d\n",
- __func__, dmic_clk_rate);
-
- if (dmic_clk_rate == 0) {
- dev_err(codec->dev, "%s: dmic_sample_rate cannot be 0\n",
- __func__);
- goto done;
- }
-
- div_factor = WCD9360_MCLK_CLK_9P6MHZ / dmic_clk_rate;
- switch (div_factor) {
- case 2:
- dmic_ctl_val = WCD9360_DMIC_CLK_DIV_2;
- break;
- case 3:
- dmic_ctl_val = WCD9360_DMIC_CLK_DIV_3;
- break;
- case 4:
- dmic_ctl_val = WCD9360_DMIC_CLK_DIV_4;
- break;
- case 6:
- dmic_ctl_val = WCD9360_DMIC_CLK_DIV_6;
- break;
- case 8:
- dmic_ctl_val = WCD9360_DMIC_CLK_DIV_8;
- break;
- case 16:
- dmic_ctl_val = WCD9360_DMIC_CLK_DIV_16;
- break;
- default:
- dev_err(codec->dev,
- "%s: Invalid div_factor %u, dmic_rate(%u)\n",
- __func__, div_factor, dmic_clk_rate);
- break;
- }
-
-done:
- return dmic_ctl_val;
-}
-
-static int pahu_codec_enable_adc(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol, int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
-
- dev_dbg(codec->dev, "%s: event:%d\n", __func__, event);
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- pahu_codec_set_tx_hold(codec, w->reg, true);
- break;
- default:
- break;
- }
-
- return 0;
-}
-
-static int pahu_codec_enable_dmic(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol, int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
- struct wcd9xxx_pdata *pdata = dev_get_platdata(codec->dev->parent);
- u8 dmic_clk_en = 0x01;
- u16 dmic_clk_reg;
- s32 *dmic_clk_cnt;
- u8 dmic_rate_val, dmic_rate_shift = 1;
- unsigned int dmic;
- u32 dmic_sample_rate;
-
- dmic = w->shift;
- switch (dmic) {
- case 0:
- case 1:
- dmic_clk_cnt = &(pahu->dmic_0_1_clk_cnt);
- dmic_clk_reg = WCD9360_CPE_SS_DMIC0_CTL;
- break;
- case 2:
- case 3:
- dmic_clk_cnt = &(pahu->dmic_2_3_clk_cnt);
- dmic_clk_reg = WCD9360_CPE_SS_DMIC1_CTL;
- break;
- case 4:
- case 5:
- dmic_clk_cnt = &(pahu->dmic_4_5_clk_cnt);
- dmic_clk_reg = WCD9360_CPE_SS_DMIC2_CTL;
- break;
- case 6:
- case 7:
- dmic_clk_cnt = &(pahu->dmic_6_7_clk_cnt);
- dmic_clk_reg = WCD9360_CPE_SS_DMIC3_CTL;
- break;
- default:
- dev_err(codec->dev, "%s: Invalid DMIC Selection\n",
- __func__);
- return -EINVAL;
- };
- dev_dbg(codec->dev, "%s: event %d DMIC%d dmic_clk_cnt %d\n",
- __func__, event, dmic, *dmic_clk_cnt);
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- dmic_sample_rate = pahu_get_dmic_sample_rate(codec, dmic,
- pdata);
- dmic_rate_val =
- pahu_get_dmic_clk_val(codec,
- dmic_sample_rate);
-
- (*dmic_clk_cnt)++;
- if (*dmic_clk_cnt == 1) {
- snd_soc_update_bits(codec, dmic_clk_reg,
- 0x07 << dmic_rate_shift,
- dmic_rate_val << dmic_rate_shift);
- snd_soc_update_bits(codec, dmic_clk_reg,
- dmic_clk_en, dmic_clk_en);
- }
-
- break;
- case SND_SOC_DAPM_POST_PMD:
- dmic_rate_val =
- pahu_get_dmic_clk_val(codec,
- pdata->mad_dmic_sample_rate);
- (*dmic_clk_cnt)--;
- if (*dmic_clk_cnt == 0) {
- snd_soc_update_bits(codec, dmic_clk_reg,
- dmic_clk_en, 0);
- snd_soc_update_bits(codec, dmic_clk_reg,
- 0x07 << dmic_rate_shift,
- dmic_rate_val << dmic_rate_shift);
- }
- break;
- };
-
- return 0;
-}
-
-/*
- * pahu_micbias_control: enable/disable micbias
- * @codec: handle to snd_soc_codec *
- * @micb_num: micbias to be enabled/disabled, e.g. micbias1 or micbias2
- * @req: control requested, enable/disable or pullup enable/disable
- * @is_dapm: triggered by dapm or not
- *
- * return 0 if control is success or error code in case of failure
- */
-int pahu_micbias_control(struct snd_soc_codec *codec,
- int micb_num, int req, bool is_dapm)
-{
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
- int micb_index = micb_num - 1;
- u16 micb_reg;
-
- if ((micb_index < 0) || (micb_index > PAHU_MAX_MICBIAS - 1)) {
- dev_err(codec->dev, "%s: Invalid micbias index, micb_ind:%d\n",
- __func__, micb_index);
- return -EINVAL;
- }
-
- switch (micb_num) {
- case WCD9360_MIC_BIAS_1:
- micb_reg = WCD9360_ANA_MICB1;
- break;
- case WCD9360_MIC_BIAS_2:
- micb_reg = WCD9360_ANA_MICB2;
- break;
- case WCD9360_MIC_BIAS_3:
- micb_reg = WCD9360_ANA_MICB3;
- break;
- case WCD9360_MIC_BIAS_4:
- micb_reg = WCD9360_ANA_MICB4;
- break;
- default:
- dev_err(codec->dev, "%s: Invalid micbias number: %d\n",
- __func__, micb_num);
- return -EINVAL;
- }
- mutex_lock(&pahu->micb_lock);
-
- switch (req) {
- case WCD9360_MICB_PULLUP_ENABLE:
- pahu->pullup_ref[micb_index]++;
- if ((pahu->pullup_ref[micb_index] == 1) &&
- (pahu->micb_ref[micb_index] == 0))
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x80);
- break;
- case WCD9360_MICB_PULLUP_DISABLE:
- if (pahu->pullup_ref[micb_index] > 0)
- pahu->pullup_ref[micb_index]--;
- if ((pahu->pullup_ref[micb_index] == 0) &&
- (pahu->micb_ref[micb_index] == 0))
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x00);
- break;
- case WCD9360_MICB_ENABLE:
- pahu->micb_ref[micb_index]++;
- if (pahu->micb_ref[micb_index] == 1)
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x40);
- break;
- case WCD9360_MICB_DISABLE:
- if (pahu->micb_ref[micb_index] > 0)
- pahu->micb_ref[micb_index]--;
- if ((pahu->micb_ref[micb_index] == 0) &&
- (pahu->pullup_ref[micb_index] > 0))
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x80);
- else if ((pahu->micb_ref[micb_index] == 0) &&
- (pahu->pullup_ref[micb_index] == 0))
- snd_soc_update_bits(codec, micb_reg, 0xC0, 0x00);
- break;
- }
-
- dev_dbg(codec->dev, "%s: micb_num:%d, micb_ref: %d\n",
- __func__, micb_num, pahu->micb_ref[micb_index]);
-
- mutex_unlock(&pahu->micb_lock);
-
- return 0;
-}
-EXPORT_SYMBOL(pahu_micbias_control);
-
-static int __pahu_codec_enable_micbias(struct snd_soc_dapm_widget *w,
- int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- int micb_num;
-
- dev_dbg(codec->dev, "%s: wname: %s, event: %d\n",
- __func__, w->name, event);
-
- if (strnstr(w->name, "MIC BIAS1", sizeof("MIC BIAS1")))
- micb_num = WCD9360_MIC_BIAS_1;
- else if (strnstr(w->name, "MIC BIAS2", sizeof("MIC BIAS2")))
- micb_num = WCD9360_MIC_BIAS_2;
- else if (strnstr(w->name, "MIC BIAS3", sizeof("MIC BIAS3")))
- micb_num = WCD9360_MIC_BIAS_3;
- else if (strnstr(w->name, "MIC BIAS4", sizeof("MIC BIAS4")))
- micb_num = WCD9360_MIC_BIAS_4;
- else
- return -EINVAL;
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- /*
- * Use ref count to handle micbias pullup
- * and enable requests
- */
- pahu_micbias_control(codec, micb_num, WCD9360_MICB_ENABLE,
- true);
- break;
- case SND_SOC_DAPM_POST_PMU:
- /* wait for cnp time */
- usleep_range(1000, 1100);
- break;
- case SND_SOC_DAPM_POST_PMD:
- pahu_micbias_control(codec, micb_num, WCD9360_MICB_DISABLE,
- true);
- break;
- };
-
- return 0;
-}
-
-/*
- * pahu_codec_enable_standalone_micbias - enable micbias standalone
- * @codec: pointer to codec instance
- * @micb_num: number of micbias to be enabled
- * @enable: true to enable micbias or false to disable
- *
- * This function is used to enable micbias (1, 2, 3 or 4) during
- * standalone independent of whether TX use-case is running or not
- *
- * Return: error code in case of failure or 0 for success
- */
-int pahu_codec_enable_standalone_micbias(struct snd_soc_codec *codec,
- int micb_num,
- bool enable)
-{
- const char * const micb_names[] = {
- DAPM_MICBIAS1_STANDALONE, DAPM_MICBIAS2_STANDALONE,
- DAPM_MICBIAS3_STANDALONE, DAPM_MICBIAS4_STANDALONE
- };
- int micb_index = micb_num - 1;
- int rc;
-
- if (!codec) {
- pr_err("%s: Codec memory is NULL\n", __func__);
- return -EINVAL;
- }
-
- if ((micb_index < 0) || (micb_index > PAHU_MAX_MICBIAS - 1)) {
- dev_err(codec->dev, "%s: Invalid micbias index, micb_ind:%d\n",
- __func__, micb_index);
- return -EINVAL;
- }
-
- if (enable)
- rc = snd_soc_dapm_force_enable_pin(
- snd_soc_codec_get_dapm(codec),
- micb_names[micb_index]);
- else
- rc = snd_soc_dapm_disable_pin(snd_soc_codec_get_dapm(codec),
- micb_names[micb_index]);
-
- if (!rc)
- snd_soc_dapm_sync(snd_soc_codec_get_dapm(codec));
- else
- dev_err(codec->dev, "%s: micbias%d force %s pin failed\n",
- __func__, micb_num, (enable ? "enable" : "disable"));
-
- return rc;
-}
-EXPORT_SYMBOL(pahu_codec_enable_standalone_micbias);
-
-static int pahu_codec_force_enable_micbias(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
-{
- int ret = 0;
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- wcd_resmgr_enable_master_bias(pahu->resmgr);
- pahu_cdc_mclk_enable(codec, true);
- ret = __pahu_codec_enable_micbias(w, SND_SOC_DAPM_PRE_PMU);
- /* Wait for 1ms for better cnp */
- usleep_range(1000, 1100);
- pahu_cdc_mclk_enable(codec, false);
- break;
- case SND_SOC_DAPM_POST_PMD:
- ret = __pahu_codec_enable_micbias(w, SND_SOC_DAPM_POST_PMD);
- wcd_resmgr_disable_master_bias(pahu->resmgr);
- break;
- }
-
- return ret;
-}
-
-static int pahu_codec_enable_micbias(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol, int event)
-{
- return __pahu_codec_enable_micbias(w, event);
-}
-
-static void pahu_restore_iir_coeff(struct pahu_priv *pahu, int iir_idx,
- int band_idx)
-{
- u16 reg_add;
- int no_of_reg = 0;
-
- regmap_write(pahu->wcd9xxx->regmap,
- (WCD9360_CDC_SIDETONE_IIR0_IIR_COEF_B1_CTL + 16 * iir_idx),
- (band_idx * BAND_MAX * sizeof(uint32_t)) & 0x7F);
- reg_add = WCD9360_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL + 16 * iir_idx;
-
- if (pahu->intf_type != WCD9XXX_INTERFACE_TYPE_SLIMBUS)
- return;
- /*
- * Since wcd9xxx_slim_write_repeat() supports only maximum of 16
- * registers at a time, split total 20 writes(5 coefficients per
- * band and 4 writes per coefficient) into 16 and 4.
- */
- no_of_reg = WCD9360_CDC_REPEAT_WRITES_MAX;
- wcd9xxx_slim_write_repeat(pahu->wcd9xxx, reg_add, no_of_reg,
- &pahu->sidetone_coeff_array[iir_idx][band_idx][0]);
-
- no_of_reg = (WCD9360_CDC_SIDETONE_IIR_COEFF_MAX * 4) -
- WCD9360_CDC_REPEAT_WRITES_MAX;
- wcd9xxx_slim_write_repeat(pahu->wcd9xxx, reg_add, no_of_reg,
- &pahu->sidetone_coeff_array[iir_idx][band_idx]
- [WCD9360_CDC_REPEAT_WRITES_MAX]);
-}
-
-static int pahu_iir_enable_audio_mixer_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- int iir_idx = ((struct soc_multi_mixer_control *)
- kcontrol->private_value)->reg;
- int band_idx = ((struct soc_multi_mixer_control *)
- kcontrol->private_value)->shift;
- /* IIR filter band registers are at integer multiples of 16 */
- u16 iir_reg = WCD9360_CDC_SIDETONE_IIR0_IIR_CTL + 16 * iir_idx;
-
- ucontrol->value.integer.value[0] = (snd_soc_read(codec, iir_reg) &
- (1 << band_idx)) != 0;
-
- dev_dbg(codec->dev, "%s: IIR #%d band #%d enable %d\n", __func__,
- iir_idx, band_idx,
- (uint32_t)ucontrol->value.integer.value[0]);
- return 0;
-}
-
-static int pahu_iir_enable_audio_mixer_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
- int iir_idx = ((struct soc_multi_mixer_control *)
- kcontrol->private_value)->reg;
- int band_idx = ((struct soc_multi_mixer_control *)
- kcontrol->private_value)->shift;
- bool iir_band_en_status;
- int value = ucontrol->value.integer.value[0];
- u16 iir_reg = WCD9360_CDC_SIDETONE_IIR0_IIR_CTL + 16 * iir_idx;
-
- pahu_restore_iir_coeff(pahu, iir_idx, band_idx);
-
- /* Mask first 5 bits, 6-8 are reserved */
- snd_soc_update_bits(codec, iir_reg, (1 << band_idx),
- (value << band_idx));
-
- iir_band_en_status = ((snd_soc_read(codec, iir_reg) &
- (1 << band_idx)) != 0);
- dev_dbg(codec->dev, "%s: IIR #%d band #%d enable %d\n", __func__,
- iir_idx, band_idx, iir_band_en_status);
- return 0;
-}
-
-static uint32_t get_iir_band_coeff(struct snd_soc_codec *codec,
- int iir_idx, int band_idx,
- int coeff_idx)
-{
- uint32_t value = 0;
-
- /* Address does not automatically update if reading */
- snd_soc_write(codec,
- (WCD9360_CDC_SIDETONE_IIR0_IIR_COEF_B1_CTL + 16 * iir_idx),
- ((band_idx * BAND_MAX + coeff_idx)
- * sizeof(uint32_t)) & 0x7F);
-
- value |= snd_soc_read(codec,
- (WCD9360_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL + 16 * iir_idx));
-
- snd_soc_write(codec,
- (WCD9360_CDC_SIDETONE_IIR0_IIR_COEF_B1_CTL + 16 * iir_idx),
- ((band_idx * BAND_MAX + coeff_idx)
- * sizeof(uint32_t) + 1) & 0x7F);
-
- value |= (snd_soc_read(codec,
- (WCD9360_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL +
- 16 * iir_idx)) << 8);
-
- snd_soc_write(codec,
- (WCD9360_CDC_SIDETONE_IIR0_IIR_COEF_B1_CTL + 16 * iir_idx),
- ((band_idx * BAND_MAX + coeff_idx)
- * sizeof(uint32_t) + 2) & 0x7F);
-
- value |= (snd_soc_read(codec,
- (WCD9360_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL +
- 16 * iir_idx)) << 16);
-
- snd_soc_write(codec,
- (WCD9360_CDC_SIDETONE_IIR0_IIR_COEF_B1_CTL + 16 * iir_idx),
- ((band_idx * BAND_MAX + coeff_idx)
- * sizeof(uint32_t) + 3) & 0x7F);
-
- /* Mask bits top 2 bits since they are reserved */
- value |= ((snd_soc_read(codec,
- (WCD9360_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL +
- 16 * iir_idx)) & 0x3F) << 24);
-
- return value;
-}
-
-static int pahu_iir_band_audio_mixer_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- int iir_idx = ((struct soc_multi_mixer_control *)
- kcontrol->private_value)->reg;
- int band_idx = ((struct soc_multi_mixer_control *)
- kcontrol->private_value)->shift;
-
- ucontrol->value.integer.value[0] =
- get_iir_band_coeff(codec, iir_idx, band_idx, 0);
- ucontrol->value.integer.value[1] =
- get_iir_band_coeff(codec, iir_idx, band_idx, 1);
- ucontrol->value.integer.value[2] =
- get_iir_band_coeff(codec, iir_idx, band_idx, 2);
- ucontrol->value.integer.value[3] =
- get_iir_band_coeff(codec, iir_idx, band_idx, 3);
- ucontrol->value.integer.value[4] =
- get_iir_band_coeff(codec, iir_idx, band_idx, 4);
-
- dev_dbg(codec->dev, "%s: IIR #%d band #%d b0 = 0x%x\n"
- "%s: IIR #%d band #%d b1 = 0x%x\n"
- "%s: IIR #%d band #%d b2 = 0x%x\n"
- "%s: IIR #%d band #%d a1 = 0x%x\n"
- "%s: IIR #%d band #%d a2 = 0x%x\n",
- __func__, iir_idx, band_idx,
- (uint32_t)ucontrol->value.integer.value[0],
- __func__, iir_idx, band_idx,
- (uint32_t)ucontrol->value.integer.value[1],
- __func__, iir_idx, band_idx,
- (uint32_t)ucontrol->value.integer.value[2],
- __func__, iir_idx, band_idx,
- (uint32_t)ucontrol->value.integer.value[3],
- __func__, iir_idx, band_idx,
- (uint32_t)ucontrol->value.integer.value[4]);
- return 0;
-}
-
-static void set_iir_band_coeff(struct snd_soc_codec *codec,
- int iir_idx, int band_idx,
- uint32_t value)
-{
- snd_soc_write(codec,
- (WCD9360_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL + 16 * iir_idx),
- (value & 0xFF));
-
- snd_soc_write(codec,
- (WCD9360_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL + 16 * iir_idx),
- (value >> 8) & 0xFF);
-
- snd_soc_write(codec,
- (WCD9360_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL + 16 * iir_idx),
- (value >> 16) & 0xFF);
-
- /* Mask top 2 bits, 7-8 are reserved */
- snd_soc_write(codec,
- (WCD9360_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL + 16 * iir_idx),
- (value >> 24) & 0x3F);
-}
-
-static int pahu_iir_band_audio_mixer_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
- int iir_idx = ((struct soc_multi_mixer_control *)
- kcontrol->private_value)->reg;
- int band_idx = ((struct soc_multi_mixer_control *)
- kcontrol->private_value)->shift;
- int coeff_idx, idx = 0;
-
- /*
- * Mask top bit it is reserved
- * Updates addr automatically for each B2 write
- */
- snd_soc_write(codec,
- (WCD9360_CDC_SIDETONE_IIR0_IIR_COEF_B1_CTL + 16 * iir_idx),
- (band_idx * BAND_MAX * sizeof(uint32_t)) & 0x7F);
-
- /* Store the coefficients in sidetone coeff array */
- for (coeff_idx = 0; coeff_idx < WCD9360_CDC_SIDETONE_IIR_COEFF_MAX;
- coeff_idx++) {
- uint32_t value = ucontrol->value.integer.value[coeff_idx];
-
- set_iir_band_coeff(codec, iir_idx, band_idx, value);
-
- /* Four 8 bit values(one 32 bit) per coefficient */
- pahu->sidetone_coeff_array[iir_idx][band_idx][idx++] =
- (value & 0xFF);
- pahu->sidetone_coeff_array[iir_idx][band_idx][idx++] =
- ((value >> 8) & 0xFF);
- pahu->sidetone_coeff_array[iir_idx][band_idx][idx++] =
- ((value >> 16) & 0xFF);
- pahu->sidetone_coeff_array[iir_idx][band_idx][idx++] =
- ((value >> 24) & 0xFF);
- }
-
- pr_debug("%s: IIR #%d band #%d b0 = 0x%x\n"
- "%s: IIR #%d band #%d b1 = 0x%x\n"
- "%s: IIR #%d band #%d b2 = 0x%x\n"
- "%s: IIR #%d band #%d a1 = 0x%x\n"
- "%s: IIR #%d band #%d a2 = 0x%x\n",
- __func__, iir_idx, band_idx,
- get_iir_band_coeff(codec, iir_idx, band_idx, 0),
- __func__, iir_idx, band_idx,
- get_iir_band_coeff(codec, iir_idx, band_idx, 1),
- __func__, iir_idx, band_idx,
- get_iir_band_coeff(codec, iir_idx, band_idx, 2),
- __func__, iir_idx, band_idx,
- get_iir_band_coeff(codec, iir_idx, band_idx, 3),
- __func__, iir_idx, band_idx,
- get_iir_band_coeff(codec, iir_idx, band_idx, 4));
- return 0;
-}
-
-static int pahu_compander_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
-
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- int comp = ((struct soc_multi_mixer_control *)
- kcontrol->private_value)->shift;
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
-
- ucontrol->value.integer.value[0] = pahu->comp_enabled[comp];
- return 0;
-}
-
-static int pahu_compander_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
- int comp = ((struct soc_multi_mixer_control *)
- kcontrol->private_value)->shift;
- int value = ucontrol->value.integer.value[0];
-
- dev_dbg(codec->dev, "%s: Compander %d enable current %d, new %d\n",
- __func__, comp + 1, pahu->comp_enabled[comp], value);
- pahu->comp_enabled[comp] = value;
-
- return 0;
-}
-
-static int pahu_dmic_pin_mode_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- u16 offset;
- u8 reg_val, pinctl_position;
-
- pinctl_position = ((struct soc_multi_mixer_control *)
- kcontrol->private_value)->shift;
-
- offset = pinctl_position - WCD9360_TLMM_DMIC_PINCFG_OFFSET;
- reg_val = snd_soc_read(codec,
- WCD9360_TLMM_DMIC1_CLK_PINCFG + offset);
-
- ucontrol->value.integer.value[0] = !!reg_val;
-
- return 0;
-}
-
-static int pahu_dmic_pin_mode_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
- u16 ctl_reg, cfg_reg, offset;
- u8 ctl_val, cfg_val, pinctl_position, pinctl_mode, mask;
-
- /* 0- high or low; 1- high Z */
- pinctl_mode = ucontrol->value.integer.value[0];
- pinctl_position = ((struct soc_multi_mixer_control *)
- kcontrol->private_value)->shift;
-
- switch (pinctl_position >> 3) {
- case 0:
- ctl_reg = WCD9360_TEST_DEBUG_PIN_CTL_OE_0;
- break;
- case 1:
- ctl_reg = WCD9360_TEST_DEBUG_PIN_CTL_OE_1;
- break;
- case 2:
- ctl_reg = WCD9360_TEST_DEBUG_PIN_CTL_OE_2;
- break;
- case 3:
- ctl_reg = WCD9360_TEST_DEBUG_PIN_CTL_OE_3;
- break;
- default:
- dev_err(codec->dev, "%s: Invalid pinctl position = %d\n",
- __func__, pinctl_position);
- return -EINVAL;
- }
-
- ctl_val = ~(pinctl_mode << (pinctl_position & 0x07));
- mask = 1 << (pinctl_position & 0x07);
- snd_soc_update_bits(codec, ctl_reg, mask, ctl_val);
-
- offset = pinctl_position - WCD9360_TLMM_DMIC_PINCFG_OFFSET;
- cfg_reg = WCD9360_TLMM_DMIC1_CLK_PINCFG + offset;
- if (pinctl_mode) {
- if (pahu->intf_type == WCD9XXX_INTERFACE_TYPE_SLIMBUS)
- cfg_val = 0x5;
- else
- cfg_val = 0xD;
- } else
- cfg_val = 0;
- snd_soc_update_bits(codec, cfg_reg, 0x1F, cfg_val);
-
- dev_dbg(codec->dev, "%s: reg=0x%x mask=0x%x val=%d reg=0x%x val=%d\n",
- __func__, ctl_reg, mask, ctl_val, cfg_reg, cfg_val);
-
- return 0;
-}
-
-static int pahu_amic_pwr_lvl_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- u16 amic_reg = 0;
-
- if (!strcmp(kcontrol->id.name, "AMIC_1_2 PWR MODE"))
- amic_reg = WCD9360_ANA_AMIC1;
- if (!strcmp(kcontrol->id.name, "AMIC_3_4 PWR MODE"))
- amic_reg = WCD9360_ANA_AMIC3;
-
- if (amic_reg)
- ucontrol->value.integer.value[0] =
- (snd_soc_read(codec, amic_reg) &
- WCD9360_AMIC_PWR_LVL_MASK) >>
- WCD9360_AMIC_PWR_LVL_SHIFT;
- return 0;
-}
-
-static int pahu_amic_pwr_lvl_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- u32 mode_val;
- u16 amic_reg = 0;
-
- mode_val = ucontrol->value.enumerated.item[0];
-
- dev_dbg(codec->dev, "%s: mode: %d\n", __func__, mode_val);
-
- if (!strcmp(kcontrol->id.name, "AMIC_1_2 PWR MODE"))
- amic_reg = WCD9360_ANA_AMIC1;
- if (!strcmp(kcontrol->id.name, "AMIC_3_4 PWR MODE"))
- amic_reg = WCD9360_ANA_AMIC3;
-
- if (amic_reg)
- snd_soc_update_bits(codec, amic_reg, WCD9360_AMIC_PWR_LVL_MASK,
- mode_val << WCD9360_AMIC_PWR_LVL_SHIFT);
- return 0;
-}
-
-static const char *const pahu_conn_mad_text[] = {
- "NOTUSED1", "ADC1", "ADC2", "ADC3", "ADC4", "NOTUSED5",
- "NOTUSED6", "NOTUSED2", "DMIC0", "DMIC1", "DMIC2", "DMIC3",
- "DMIC4", "DMIC5", "DMIC6", "DMIC7"
-};
-
-static const struct soc_enum pahu_conn_mad_enum =
- SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(pahu_conn_mad_text),
- pahu_conn_mad_text);
-
-static int pahu_mad_input_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- u8 pahu_mad_input;
-
- pahu_mad_input = snd_soc_read(codec, WCD9360_SOC_MAD_INP_SEL) & 0x0F;
- ucontrol->value.integer.value[0] = pahu_mad_input;
-
- dev_dbg(codec->dev, "%s: pahu_mad_input = %s\n", __func__,
- pahu_conn_mad_text[pahu_mad_input]);
-
- return 0;
-}
-
-static int pahu_mad_input_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct snd_soc_card *card = codec->component.card;
- u8 pahu_mad_input;
- char mad_amic_input_widget[6];
- const char *mad_input_widget;
- const char *source_widget = NULL;
- u32 adc, i, mic_bias_found = 0;
- int ret = 0;
- char *mad_input;
- bool is_adc_input = false;
-
- pahu_mad_input = ucontrol->value.integer.value[0];
-
- if (pahu_mad_input >= sizeof(pahu_conn_mad_text)/
- sizeof(pahu_conn_mad_text[0])) {
- dev_err(codec->dev,
- "%s: pahu_mad_input = %d out of bounds\n",
- __func__, pahu_mad_input);
- return -EINVAL;
- }
-
- if (strnstr(pahu_conn_mad_text[pahu_mad_input], "NOTUSED",
- sizeof("NOTUSED"))) {
- dev_dbg(codec->dev,
- "%s: Unsupported pahu_mad_input = %s\n",
- __func__, pahu_conn_mad_text[pahu_mad_input]);
- /* Make sure the MAD register is updated */
- snd_soc_update_bits(codec, WCD9360_ANA_MAD_SETUP,
- 0x88, 0x00);
- return -EINVAL;
- }
-
- if (strnstr(pahu_conn_mad_text[pahu_mad_input],
- "ADC", sizeof("ADC"))) {
- mad_input = strpbrk(pahu_conn_mad_text[pahu_mad_input],
- "1234");
- if (!mad_input) {
- dev_err(codec->dev, "%s: Invalid MAD input %s\n",
- __func__, pahu_conn_mad_text[pahu_mad_input]);
- return -EINVAL;
- }
-
- ret = kstrtouint(mad_input, 10, &adc);
- if ((ret < 0) || (adc > 4)) {
- dev_err(codec->dev, "%s: Invalid ADC = %s\n", __func__,
- pahu_conn_mad_text[pahu_mad_input]);
- return -EINVAL;
- }
-
- snprintf(mad_amic_input_widget, 6, "%s%u", "AMIC", adc);
-
- mad_input_widget = mad_amic_input_widget;
- is_adc_input = true;
- } else {
- /* DMIC type input widget*/
- mad_input_widget = pahu_conn_mad_text[pahu_mad_input];
- }
-
- dev_dbg(codec->dev,
- "%s: pahu input widget = %s, adc_input = %s\n", __func__,
- mad_input_widget, is_adc_input ? "true" : "false");
-
- for (i = 0; i < card->num_of_dapm_routes; i++) {
- if (!strcmp(card->of_dapm_routes[i].sink, mad_input_widget)) {
- source_widget = card->of_dapm_routes[i].source;
- if (!source_widget) {
- dev_err(codec->dev,
- "%s: invalid source widget\n",
- __func__);
- return -EINVAL;
- }
-
- if (strnstr(source_widget,
- "MIC BIAS1", sizeof("MIC BIAS1"))) {
- mic_bias_found = 1;
- break;
- } else if (strnstr(source_widget,
- "MIC BIAS2", sizeof("MIC BIAS2"))) {
- mic_bias_found = 2;
- break;
- } else if (strnstr(source_widget,
- "MIC BIAS3", sizeof("MIC BIAS3"))) {
- mic_bias_found = 3;
- break;
- } else if (strnstr(source_widget,
- "MIC BIAS4", sizeof("MIC BIAS4"))) {
- mic_bias_found = 4;
- break;
- }
- }
- }
-
- if (!mic_bias_found) {
- dev_err(codec->dev, "%s: mic bias not found for input %s\n",
- __func__, mad_input_widget);
- return -EINVAL;
- }
-
- dev_dbg(codec->dev, "%s: mic_bias found = %d\n", __func__,
- mic_bias_found);
-
- snd_soc_update_bits(codec, WCD9360_SOC_MAD_INP_SEL,
- 0x0F, pahu_mad_input);
- snd_soc_update_bits(codec, WCD9360_ANA_MAD_SETUP,
- 0x07, mic_bias_found);
- /* for all adc inputs, mad should be in micbias mode with BG enabled */
- if (is_adc_input)
- snd_soc_update_bits(codec, WCD9360_ANA_MAD_SETUP,
- 0x88, 0x88);
- else
- snd_soc_update_bits(codec, WCD9360_ANA_MAD_SETUP,
- 0x88, 0x00);
- return 0;
-}
-
-static int pahu_ear_spkr_pa_gain_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
-
- ucontrol->value.integer.value[0] = pahu->ear_spkr_gain;
-
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
- __func__, ucontrol->value.integer.value[0]);
-
- return 0;
-}
-
-static int pahu_ear_spkr_pa_gain_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
-
- pahu->ear_spkr_gain = ucontrol->value.integer.value[0];
-
- dev_dbg(codec->dev, "%s: gain = %d\n", __func__, pahu->ear_spkr_gain);
-
- return 0;
-}
-
-static int pahu_spkr_left_boost_stage_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- u8 bst_state_max = 0;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
-
- bst_state_max = snd_soc_read(codec, WCD9360_CDC_BOOST0_BOOST_CTL);
- bst_state_max = (bst_state_max & 0x0c) >> 2;
- ucontrol->value.integer.value[0] = bst_state_max;
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
- __func__, ucontrol->value.integer.value[0]);
-
- return 0;
-}
-
-static int pahu_spkr_left_boost_stage_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- u8 bst_state_max;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
-
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
- __func__, ucontrol->value.integer.value[0]);
- bst_state_max = ucontrol->value.integer.value[0] << 2;
- snd_soc_update_bits(codec, WCD9360_CDC_BOOST0_BOOST_CTL,
- 0x0c, bst_state_max);
-
- return 0;
-}
-
-static int pahu_spkr_right_boost_stage_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- u8 bst_state_max = 0;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
-
- bst_state_max = snd_soc_read(codec, WCD9360_CDC_BOOST1_BOOST_CTL);
- bst_state_max = (bst_state_max & 0x0c) >> 2;
- ucontrol->value.integer.value[0] = bst_state_max;
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
- __func__, ucontrol->value.integer.value[0]);
-
- return 0;
-}
-
-static int pahu_spkr_right_boost_stage_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- u8 bst_state_max;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
-
- dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
- __func__, ucontrol->value.integer.value[0]);
- bst_state_max = ucontrol->value.integer.value[0] << 2;
- snd_soc_update_bits(codec, WCD9360_CDC_BOOST1_BOOST_CTL,
- 0x0c, bst_state_max);
-
- return 0;
-}
-
-static const char *const pahu_anc_func_text[] = {"OFF", "ON"};
-static const struct soc_enum pahu_anc_func_enum =
- SOC_ENUM_SINGLE_EXT(2, pahu_anc_func_text);
-
-static const char *const pahu_clkmode_text[] = {"EXTERNAL", "INTERNAL"};
-static SOC_ENUM_SINGLE_EXT_DECL(pahu_clkmode_enum, pahu_clkmode_text);
-
-/* Cutoff frequency for high pass filter */
-static const char * const cf_text[] = {
- "CF_NEG_3DB_4HZ", "CF_NEG_3DB_75HZ", "CF_NEG_3DB_150HZ"
-};
-
-static const char * const rx_cf_text[] = {
- "CF_NEG_3DB_4HZ", "CF_NEG_3DB_75HZ", "CF_NEG_3DB_150HZ",
- "CF_NEG_3DB_0P48HZ"
-};
-
-static const char * const amic_pwr_lvl_text[] = {
- "LOW_PWR", "DEFAULT", "HIGH_PERF", "HYBRID"
-};
-
-static const char * const pahu_ear_pa_gain_text[] = {
- "G_6_DB", "G_4P5_DB", "G_3_DB", "G_1P5_DB",
- "G_0_DB", "G_M2P5_DB", "UNDEFINED", "G_M12_DB"
-};
-
-static const char * const pahu_ear_spkr_pa_gain_text[] = {
- "G_DEFAULT", "G_0_DB", "G_1_DB", "G_2_DB", "G_3_DB",
- "G_4_DB", "G_5_DB", "G_6_DB"
-};
-
-static const char * const pahu_speaker_boost_stage_text[] = {
- "NO_MAX_STATE", "MAX_STATE_1", "MAX_STATE_2"
-};
-
-static SOC_ENUM_SINGLE_EXT_DECL(pahu_ear_pa_gain_enum, pahu_ear_pa_gain_text);
-static SOC_ENUM_SINGLE_EXT_DECL(pahu_ear_spkr_pa_gain_enum,
- pahu_ear_spkr_pa_gain_text);
-static SOC_ENUM_SINGLE_EXT_DECL(pahu_spkr_boost_stage_enum,
- pahu_speaker_boost_stage_text);
-static SOC_ENUM_SINGLE_EXT_DECL(amic_pwr_lvl_enum, amic_pwr_lvl_text);
-static SOC_ENUM_SINGLE_DECL(cf_dec0_enum, WCD9360_CDC_TX0_TX_PATH_CFG0, 5,
- cf_text);
-static SOC_ENUM_SINGLE_DECL(cf_dec1_enum, WCD9360_CDC_TX1_TX_PATH_CFG0, 5,
- cf_text);
-static SOC_ENUM_SINGLE_DECL(cf_dec2_enum, WCD9360_CDC_TX2_TX_PATH_CFG0, 5,
- cf_text);
-static SOC_ENUM_SINGLE_DECL(cf_dec3_enum, WCD9360_CDC_TX3_TX_PATH_CFG0, 5,
- cf_text);
-static SOC_ENUM_SINGLE_DECL(cf_dec4_enum, WCD9360_CDC_TX4_TX_PATH_CFG0, 5,
- cf_text);
-static SOC_ENUM_SINGLE_DECL(cf_dec5_enum, WCD9360_CDC_TX5_TX_PATH_CFG0, 5,
- cf_text);
-static SOC_ENUM_SINGLE_DECL(cf_dec6_enum, WCD9360_CDC_TX6_TX_PATH_CFG0, 5,
- cf_text);
-static SOC_ENUM_SINGLE_DECL(cf_dec7_enum, WCD9360_CDC_TX7_TX_PATH_CFG0, 5,
- cf_text);
-static SOC_ENUM_SINGLE_DECL(cf_dec8_enum, WCD9360_CDC_TX8_TX_PATH_CFG0, 5,
- cf_text);
-static SOC_ENUM_SINGLE_DECL(cf_int0_1_enum, WCD9360_CDC_RX0_RX_PATH_CFG2, 0,
- rx_cf_text);
-static SOC_ENUM_SINGLE_DECL(cf_int0_2_enum, WCD9360_CDC_RX0_RX_PATH_MIX_CFG, 2,
- rx_cf_text);
-static SOC_ENUM_SINGLE_DECL(cf_int7_1_enum, WCD9360_CDC_RX7_RX_PATH_CFG2, 0,
- rx_cf_text);
-static SOC_ENUM_SINGLE_DECL(cf_int7_2_enum, WCD9360_CDC_RX7_RX_PATH_MIX_CFG, 2,
- rx_cf_text);
-static SOC_ENUM_SINGLE_DECL(cf_int8_1_enum, WCD9360_CDC_RX8_RX_PATH_CFG2, 0,
- rx_cf_text);
-static SOC_ENUM_SINGLE_DECL(cf_int8_2_enum, WCD9360_CDC_RX8_RX_PATH_MIX_CFG, 2,
- rx_cf_text);
-static SOC_ENUM_SINGLE_DECL(cf_int9_1_enum, WCD9360_CDC_RX9_RX_PATH_CFG2, 0,
- rx_cf_text);
-static SOC_ENUM_SINGLE_DECL(cf_int9_2_enum, WCD9360_CDC_RX9_RX_PATH_MIX_CFG, 2,
- rx_cf_text);
-
-static const struct snd_kcontrol_new pahu_snd_controls[] = {
- SOC_ENUM_EXT("EAR SPKR PA Gain", pahu_ear_spkr_pa_gain_enum,
- pahu_ear_spkr_pa_gain_get, pahu_ear_spkr_pa_gain_put),
- SOC_ENUM_EXT("SPKR Left Boost Max State", pahu_spkr_boost_stage_enum,
- pahu_spkr_left_boost_stage_get,
- pahu_spkr_left_boost_stage_put),
- SOC_ENUM_EXT("SPKR Right Boost Max State", pahu_spkr_boost_stage_enum,
- pahu_spkr_right_boost_stage_get,
- pahu_spkr_right_boost_stage_put),
- SOC_SINGLE_TLV("ADC1 Volume", WCD9360_ANA_AMIC1, 0, 20, 0, analog_gain),
- SOC_SINGLE_TLV("ADC2 Volume", WCD9360_ANA_AMIC2, 0, 20, 0, analog_gain),
- SOC_SINGLE_TLV("ADC3 Volume", WCD9360_ANA_AMIC3, 0, 20, 0, analog_gain),
- SOC_SINGLE_TLV("ADC4 Volume", WCD9360_ANA_AMIC4, 0, 20, 0, analog_gain),
-
- SOC_SINGLE_SX_TLV("RX0 Digital Volume", WCD9360_CDC_RX0_RX_VOL_CTL,
- 0, -84, 40, digital_gain), /* -84dB min - 40dB max */
- SOC_SINGLE_SX_TLV("RX7 Digital Volume", WCD9360_CDC_RX7_RX_VOL_CTL,
- 0, -84, 40, digital_gain),
- SOC_SINGLE_SX_TLV("RX8 Digital Volume", WCD9360_CDC_RX8_RX_VOL_CTL,
- 0, -84, 40, digital_gain),
- SOC_SINGLE_SX_TLV("RX9 Digital Volume", WCD9360_CDC_RX9_RX_VOL_CTL,
- 0, -84, 40, digital_gain),
- SOC_SINGLE_SX_TLV("RX0 Mix Digital Volume",
- WCD9360_CDC_RX0_RX_VOL_MIX_CTL, 0, -84, 40, digital_gain),
- SOC_SINGLE_SX_TLV("RX7 Mix Digital Volume",
- WCD9360_CDC_RX7_RX_VOL_MIX_CTL, 0, -84, 40, digital_gain),
- SOC_SINGLE_SX_TLV("RX8 Mix Digital Volume",
- WCD9360_CDC_RX8_RX_VOL_MIX_CTL, 0, -84, 40, digital_gain),
- SOC_SINGLE_SX_TLV("RX9 Mix Digital Volume",
- WCD9360_CDC_RX9_RX_VOL_MIX_CTL, 0, -84, 40, digital_gain),
-
- SOC_SINGLE_SX_TLV("DEC0 Volume", WCD9360_CDC_TX0_TX_VOL_CTL, 0,
- -84, 40, digital_gain),
- SOC_SINGLE_SX_TLV("DEC1 Volume", WCD9360_CDC_TX1_TX_VOL_CTL, 0,
- -84, 40, digital_gain),
- SOC_SINGLE_SX_TLV("DEC2 Volume", WCD9360_CDC_TX2_TX_VOL_CTL, 0,
- -84, 40, digital_gain),
- SOC_SINGLE_SX_TLV("DEC3 Volume", WCD9360_CDC_TX3_TX_VOL_CTL, 0,
- -84, 40, digital_gain),
- SOC_SINGLE_SX_TLV("DEC4 Volume", WCD9360_CDC_TX4_TX_VOL_CTL, 0,
- -84, 40, digital_gain),
- SOC_SINGLE_SX_TLV("DEC5 Volume", WCD9360_CDC_TX5_TX_VOL_CTL, 0,
- -84, 40, digital_gain),
- SOC_SINGLE_SX_TLV("DEC6 Volume", WCD9360_CDC_TX6_TX_VOL_CTL, 0,
- -84, 40, digital_gain),
- SOC_SINGLE_SX_TLV("DEC7 Volume", WCD9360_CDC_TX7_TX_VOL_CTL, 0,
- -84, 40, digital_gain),
- SOC_SINGLE_SX_TLV("DEC8 Volume", WCD9360_CDC_TX8_TX_VOL_CTL, 0,
- -84, 40, digital_gain),
-
- SOC_SINGLE_SX_TLV("IIR0 INP0 Volume",
- WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B1_CTL, 0, -84, 40,
- digital_gain),
- SOC_SINGLE_SX_TLV("IIR0 INP1 Volume",
- WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B2_CTL, 0, -84, 40,
- digital_gain),
- SOC_SINGLE_SX_TLV("IIR0 INP2 Volume",
- WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B3_CTL, 0, -84, 40,
- digital_gain),
- SOC_SINGLE_SX_TLV("IIR0 INP3 Volume",
- WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B4_CTL, 0, -84, 40,
- digital_gain),
-
- SOC_SINGLE_EXT("ANC Slot", SND_SOC_NOPM, 0, 100, 0, pahu_get_anc_slot,
- pahu_put_anc_slot),
- SOC_ENUM_EXT("ANC Function", pahu_anc_func_enum, pahu_get_anc_func,
- pahu_put_anc_func),
-
- SOC_ENUM_EXT("CLK MODE", pahu_clkmode_enum, pahu_get_clkmode,
- pahu_put_clkmode),
-
- SOC_ENUM("TX0 HPF cut off", cf_dec0_enum),
- SOC_ENUM("TX1 HPF cut off", cf_dec1_enum),
- SOC_ENUM("TX2 HPF cut off", cf_dec2_enum),
- SOC_ENUM("TX3 HPF cut off", cf_dec3_enum),
- SOC_ENUM("TX4 HPF cut off", cf_dec4_enum),
- SOC_ENUM("TX5 HPF cut off", cf_dec5_enum),
- SOC_ENUM("TX6 HPF cut off", cf_dec6_enum),
- SOC_ENUM("TX7 HPF cut off", cf_dec7_enum),
- SOC_ENUM("TX8 HPF cut off", cf_dec8_enum),
-
- SOC_ENUM("RX INT0_1 HPF cut off", cf_int0_1_enum),
- SOC_ENUM("RX INT0_2 HPF cut off", cf_int0_2_enum),
- SOC_ENUM("RX INT7_1 HPF cut off", cf_int7_1_enum),
- SOC_ENUM("RX INT7_2 HPF cut off", cf_int7_2_enum),
- SOC_ENUM("RX INT8_1 HPF cut off", cf_int8_1_enum),
- SOC_ENUM("RX INT8_2 HPF cut off", cf_int8_2_enum),
- SOC_ENUM("RX INT9_1 HPF cut off", cf_int9_1_enum),
- SOC_ENUM("RX INT9_2 HPF cut off", cf_int9_2_enum),
-
- SOC_SINGLE_EXT("IIR0 Enable Band1", IIR0, BAND1, 1, 0,
- pahu_iir_enable_audio_mixer_get,
- pahu_iir_enable_audio_mixer_put),
- SOC_SINGLE_EXT("IIR0 Enable Band2", IIR0, BAND2, 1, 0,
- pahu_iir_enable_audio_mixer_get,
- pahu_iir_enable_audio_mixer_put),
- SOC_SINGLE_EXT("IIR0 Enable Band3", IIR0, BAND3, 1, 0,
- pahu_iir_enable_audio_mixer_get,
- pahu_iir_enable_audio_mixer_put),
- SOC_SINGLE_EXT("IIR0 Enable Band4", IIR0, BAND4, 1, 0,
- pahu_iir_enable_audio_mixer_get,
- pahu_iir_enable_audio_mixer_put),
- SOC_SINGLE_EXT("IIR0 Enable Band5", IIR0, BAND5, 1, 0,
- pahu_iir_enable_audio_mixer_get,
- pahu_iir_enable_audio_mixer_put),
-
- SOC_SINGLE_MULTI_EXT("IIR0 Band1", IIR0, BAND1, 255, 0, 5,
- pahu_iir_band_audio_mixer_get, pahu_iir_band_audio_mixer_put),
- SOC_SINGLE_MULTI_EXT("IIR0 Band2", IIR0, BAND2, 255, 0, 5,
- pahu_iir_band_audio_mixer_get, pahu_iir_band_audio_mixer_put),
- SOC_SINGLE_MULTI_EXT("IIR0 Band3", IIR0, BAND3, 255, 0, 5,
- pahu_iir_band_audio_mixer_get, pahu_iir_band_audio_mixer_put),
- SOC_SINGLE_MULTI_EXT("IIR0 Band4", IIR0, BAND4, 255, 0, 5,
- pahu_iir_band_audio_mixer_get, pahu_iir_band_audio_mixer_put),
- SOC_SINGLE_MULTI_EXT("IIR0 Band5", IIR0, BAND5, 255, 0, 5,
- pahu_iir_band_audio_mixer_get, pahu_iir_band_audio_mixer_put),
-
- SOC_SINGLE_EXT("COMP0 Switch", SND_SOC_NOPM, COMPANDER_0, 1, 0,
- pahu_compander_get, pahu_compander_put),
- SOC_SINGLE_EXT("COMP7 Switch", SND_SOC_NOPM, COMPANDER_7, 1, 0,
- pahu_compander_get, pahu_compander_put),
- SOC_SINGLE_EXT("COMP8 Switch", SND_SOC_NOPM, COMPANDER_8, 1, 0,
- pahu_compander_get, pahu_compander_put),
-
- SOC_ENUM_EXT("MAD Input", pahu_conn_mad_enum,
- pahu_mad_input_get, pahu_mad_input_put),
-
- SOC_SINGLE_EXT("DMIC1_CLK_PIN_MODE", SND_SOC_NOPM, 15, 1, 0,
- pahu_dmic_pin_mode_get, pahu_dmic_pin_mode_put),
-
- SOC_SINGLE_EXT("DMIC1_DATA_PIN_MODE", SND_SOC_NOPM, 16, 1, 0,
- pahu_dmic_pin_mode_get, pahu_dmic_pin_mode_put),
-
- SOC_SINGLE_EXT("DMIC2_CLK_PIN_MODE", SND_SOC_NOPM, 17, 1, 0,
- pahu_dmic_pin_mode_get, pahu_dmic_pin_mode_put),
-
- SOC_SINGLE_EXT("DMIC2_DATA_PIN_MODE", SND_SOC_NOPM, 18, 1, 0,
- pahu_dmic_pin_mode_get, pahu_dmic_pin_mode_put),
-
- SOC_SINGLE_EXT("DMIC3_CLK_PIN_MODE", SND_SOC_NOPM, 28, 1, 0,
- pahu_dmic_pin_mode_get, pahu_dmic_pin_mode_put),
-
- SOC_SINGLE_EXT("DMIC3_DATA_PIN_MODE", SND_SOC_NOPM, 29, 1, 0,
- pahu_dmic_pin_mode_get, pahu_dmic_pin_mode_put),
-
- SOC_SINGLE_EXT("DMIC4_CLK_PIN_MODE", SND_SOC_NOPM, 30, 1, 0,
- pahu_dmic_pin_mode_get, pahu_dmic_pin_mode_put),
-
- SOC_SINGLE_EXT("DMIC4_DATA_PIN_MODE", SND_SOC_NOPM, 31, 1, 0,
- pahu_dmic_pin_mode_get, pahu_dmic_pin_mode_put),
-
- SOC_ENUM_EXT("AMIC_1_2 PWR MODE", amic_pwr_lvl_enum,
- pahu_amic_pwr_lvl_get, pahu_amic_pwr_lvl_put),
- SOC_ENUM_EXT("AMIC_3_4 PWR MODE", amic_pwr_lvl_enum,
- pahu_amic_pwr_lvl_get, pahu_amic_pwr_lvl_put),
-};
-
-static int pahu_dec_enum_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_dapm_widget *widget =
- snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
- struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
- unsigned int val;
- u16 mic_sel_reg = 0;
- u8 mic_sel;
-
- val = ucontrol->value.enumerated.item[0];
- if (val > e->items - 1)
- return -EINVAL;
-
- dev_dbg(codec->dev, "%s: wname: %s, val: 0x%x\n", __func__,
- widget->name, val);
-
- switch (e->reg) {
- case WCD9360_CDC_TX_INP_MUX_ADC_MUX0_CFG1:
- if (e->shift_l == 0)
- mic_sel_reg = WCD9360_CDC_TX0_TX_PATH_CFG0;
- else if (e->shift_l == 2)
- mic_sel_reg = WCD9360_CDC_TX4_TX_PATH_CFG0;
- else if (e->shift_l == 4)
- mic_sel_reg = WCD9360_CDC_TX8_TX_PATH_CFG0;
- break;
- case WCD9360_CDC_TX_INP_MUX_ADC_MUX1_CFG1:
- if (e->shift_l == 0)
- mic_sel_reg = WCD9360_CDC_TX1_TX_PATH_CFG0;
- else if (e->shift_l == 2)
- mic_sel_reg = WCD9360_CDC_TX5_TX_PATH_CFG0;
- break;
- case WCD9360_CDC_TX_INP_MUX_ADC_MUX2_CFG1:
- if (e->shift_l == 0)
- mic_sel_reg = WCD9360_CDC_TX2_TX_PATH_CFG0;
- else if (e->shift_l == 2)
- mic_sel_reg = WCD9360_CDC_TX6_TX_PATH_CFG0;
- break;
- case WCD9360_CDC_TX_INP_MUX_ADC_MUX3_CFG1:
- if (e->shift_l == 0)
- mic_sel_reg = WCD9360_CDC_TX3_TX_PATH_CFG0;
- else if (e->shift_l == 2)
- mic_sel_reg = WCD9360_CDC_TX7_TX_PATH_CFG0;
- break;
- default:
- dev_err(codec->dev, "%s: e->reg: 0x%x not expected\n",
- __func__, e->reg);
- return -EINVAL;
- }
-
- /* ADC: 0, DMIC: 1 */
- mic_sel = val ? 0x0 : 0x1;
- if (mic_sel_reg)
- snd_soc_update_bits(codec, mic_sel_reg, 1 << 7, mic_sel << 7);
-
- return snd_soc_dapm_put_enum_double(kcontrol, ucontrol);
-}
-
-static int pahu_int_dem_inp_mux_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_dapm_widget *widget =
- snd_soc_dapm_kcontrol_widget(kcontrol);
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(widget->dapm);
- struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
- unsigned int val;
- unsigned short look_ahead_dly_reg = WCD9360_CDC_RX0_RX_PATH_CFG0;
-
- val = ucontrol->value.enumerated.item[0];
- if (val >= e->items)
- return -EINVAL;
-
- dev_dbg(codec->dev, "%s: wname: %s, val: 0x%x\n", __func__,
- widget->name, val);
-
- if (e->reg == WCD9360_CDC_RX0_RX_PATH_SEC0)
- look_ahead_dly_reg = WCD9360_CDC_RX0_RX_PATH_CFG0;
- else if (e->reg == WCD9360_CDC_RX9_RX_PATH_SEC0)
- look_ahead_dly_reg = WCD9360_CDC_RX9_RX_PATH_CFG0;
-
- /* Set Look Ahead Delay */
- snd_soc_update_bits(codec, look_ahead_dly_reg,
- 0x08, (val ? 0x08 : 0x00));
- /* Set DEM INP Select */
- return snd_soc_dapm_put_enum_double(kcontrol, ucontrol);
-}
-
-static const char * const rx_int0_7_mix_mux_text[] = {
- "ZERO", "RX0", "RX1", "RX2", "RX3", "RX4", "RX5",
- "RX6", "RX7", "PROXIMITY", "IIR0"
-};
-
-static const char * const rx_int_mix_mux_text[] = {
- "ZERO", "RX0", "RX1", "RX2", "RX3", "RX4", "RX5",
- "RX6", "RX7", "NA", "IIR0"
-};
-
-static const char * const rx_prim_mix_text[] = {
- "ZERO", "DEC0", "DEC1", "IIR0", "INVALID", "RX0", "RX1", "RX2",
- "RX3", "RX4", "RX5", "RX6", "RX7"
-};
-
-static const char * const rx_sidetone_mix_text[] = {
- "ZERO", "SRC0"
-};
-
-static const char * const cdc_if_tx0_mux_text[] = {
- "ZERO", "RX_MIX_TX0", "DEC0", "DEC0_192"
-};
-static const char * const cdc_if_tx1_mux_text[] = {
- "ZERO", "RX_MIX_TX1", "DEC1", "DEC1_192"
-};
-static const char * const cdc_if_tx2_mux_text[] = {
- "ZERO", "RX_MIX_TX2", "DEC2", "DEC2_192"
-};
-static const char * const cdc_if_tx3_mux_text[] = {
- "ZERO", "RX_MIX_TX3", "DEC3", "DEC3_192"
-};
-static const char * const cdc_if_tx4_mux_text[] = {
- "ZERO", "RX_MIX_TX4", "DEC4", "DEC4_192"
-};
-static const char * const cdc_if_tx5_mux_text[] = {
- "ZERO", "RX_MIX_TX5", "DEC5", "DEC5_192"
-};
-static const char * const cdc_if_tx6_mux_text[] = {
- "ZERO", "RX_MIX_TX6", "DEC6", "DEC6_192"
-};
-static const char * const cdc_if_tx7_mux_text[] = {
- "ZERO", "RX_MIX_TX7", "DEC7", "DEC7_192"
-};
-static const char * const cdc_if_tx8_mux_text[] = {
- "ZERO", "RX_MIX_TX8", "DEC8", "DEC8_192"
-};
-static const char * const cdc_if_tx9_mux_text[] = {
- "ZERO", "DEC7", "DEC7_192"
-};
-static const char * const cdc_if_tx10_mux_text[] = {
- "ZERO", "DEC6", "DEC6_192"
-};
-static const char * const cdc_if_tx10_mux2_text[] = {
- "TX10_MUX1", "I2SRX1_0_BRDG"
-};
-static const char * const cdc_if_tx11_mux2_text[] = {
- "TX11_MUX1", "I2SRX1_1_BRDG", "SWR_PACKED_PDM"
-};
-static const char * const cdc_if_tx11_mux_text[] = {
- "RDMA_TX11", "DEC_0_5", "DEC_9_12", "MAD_AUDIO", "MAD_BRDCST"
-};
-static const char * const cdc_if_tx11_inp1_mux_text[] = {
- "ZERO", "DEC0", "DEC1", "DEC2", "DEC3", "DEC4",
- "DEC5", "RX_MIX_TX5", "DEC9_10", "DEC11_12"
-};
-static const char * const cdc_if_tx13_mux_text[] = {
- "CDC_DEC_5", "MAD_BRDCST"
-};
-static const char * const cdc_if_tx13_inp1_mux_text[] = {
- "ZERO", "DEC5", "DEC5_192"
-};
-
-static const char * const iir_inp_mux_text[] = {
- "ZERO", "DEC0", "DEC1", "DEC2", "DEC3", "DEC4", "DEC5", "DEC6",
- "DEC7", "DEC8", "RX0", "RX1", "RX2", "RX3", "RX4", "RX5", "RX6", "RX7"
-};
-
-static const char * const rx_int_dem_inp_mux_text[] = {
- "NORMAL_DSM_OUT", "NOT_VALID", "ADC_LOOPBACK"
-};
-
-static const char * const rx_int0_1_interp_mux_text[] = {
- "ZERO", "RX INT0_1 MIX1",
-};
-
-static const char * const rx_int7_1_interp_mux_text[] = {
- "ZERO", "RX INT7_1 MIX1",
-};
-
-static const char * const rx_int8_1_interp_mux_text[] = {
- "ZERO", "RX INT8_1 MIX1",
-};
-
-static const char * const rx_int9_1_interp_mux_text[] = {
- "ZERO", "RX INT9_1 MIX1",
-};
-
-static const char * const rx_int0_2_interp_mux_text[] = {
- "ZERO", "RX INT0_2 MUX",
-};
-
-static const char * const rx_int7_2_interp_mux_text[] = {
- "ZERO", "RX INT7_2 MUX",
-};
-
-static const char * const rx_int8_2_interp_mux_text[] = {
- "ZERO", "RX INT8_2 MUX",
-};
-
-static const char * const rx_int9_2_interp_mux_text[] = {
- "ZERO", "RX INT9_2 MUX",
-};
-
-static const char * const mad_sel_txt[] = {
- "SPE", "MSM"
-};
-
-static const char * const mad_inp_mux_txt[] = {
- "MAD", "DEC1"
-};
-
-static const char * const adc_mux_text[] = {
- "DMIC", "AMIC", "ANC_FB_TUNE1"
-};
-
-static const char * const dmic_mux_text[] = {
- "ZERO", "DMIC0", "DMIC1", "DMIC2", "DMIC3", "DMIC4", "DMIC5",
- "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "DMIC6",
- "DMIC7"
-};
-
-static const char * const amic_mux_text[] = {
- "ZERO", "ADC1", "ADC2", "ADC3", "ADC4"
-};
-
-static const char * const adc2_in_text[] = {
- "AMIC2", "AMIC1"
-};
-
-static const char * const adc4_in_text[] = {
- "AMIC4", "AMIC3"
-};
-
-static const char * const anc0_fb_mux_text[] = {
- "ZERO", "INVALID", "ANC_IN_EAR", "ANC_IN_EAR_SPKR",
-};
-
-static const char * const rx_echo_mux_text[] = {
- "ZERO", "RX_MIX0", "NA", "NA", "NA", "NA", "NA", "NA",
- "RX_MIX7", "RX_MIX8", "NA", "NA", "NA", "NA", "RX_MIX9"
-};
-
-static const char *const slim_rx_mux_text[] = {
- "ZERO", "AIF1_PB", "AIF2_PB", "AIF3_PB", "AIF4_PB"
-};
-
-static const char *const cdc_if_rx0_mux_text[] = {
- "SLIM RX0", "I2S RX0"
-};
-static const char *const cdc_if_rx1_mux_text[] = {
- "SLIM RX1", "I2S RX1"
-};
-static const char *const cdc_if_rx2_mux_text[] = {
- "SLIM RX2", "I2SRX1_0", "I2SRX0_2"
-};
-static const char *const cdc_if_rx3_mux_text[] = {
- "SLIM RX3", "I2SRX1_1", "I2SRX0_3"
-};
-static const char *const cdc_if_rx4_mux_text[] = {
- "SLIM RX4", "I2S RX4"
-};
-static const char *const cdc_if_rx5_mux_text[] = {
- "SLIM RX5", "I2S RX5"
-};
-static const char *const cdc_if_rx6_mux_text[] = {
- "SLIM RX6", "I2S RX6"
-};
-static const char *const cdc_if_rx7_mux_text[] = {
- "SLIM RX7", "I2S RX7"
-};
-
-static const char * const asrc2_mux_text[] = {
- "ZERO", "ASRC_IN_SPKR1",
-};
-
-static const char * const asrc3_mux_text[] = {
- "ZERO", "ASRC_IN_SPKR2",
-};
-
-static const char * const native_mux_text[] = {
- "OFF", "ON",
-};
-
-static const char *const wdma3_port0_text[] = {
- "RX_MIX_TX0", "DEC0"
-};
-
-static const char *const wdma3_port1_text[] = {
- "RX_MIX_TX1", "DEC1"
-};
-
-static const char *const wdma3_port2_text[] = {
- "RX_MIX_TX2", "DEC2"
-};
-
-static const char *const wdma3_port3_text[] = {
- "RX_MIX_TX3", "DEC3"
-};
-
-static const char *const wdma3_port4_text[] = {
- "RX_MIX_TX4", "DEC4"
-};
-
-static const char *const wdma3_port5_text[] = {
- "RX_MIX_TX5", "DEC5"
-};
-
-static const char *const wdma3_port6_text[] = {
- "RX_MIX_TX6", "DEC6"
-};
-
-static const char *const wdma3_ch_text[] = {
- "PORT_0", "PORT_1", "PORT_2", "PORT_3", "PORT_4",
- "PORT_5", "PORT_6", "PORT_7", "PORT_8",
-};
-
-static const struct snd_kcontrol_new aif4_vi_mixer[] = {
- SOC_SINGLE_EXT("SPKR_VI_1", SND_SOC_NOPM, WCD9360_TX14, 1, 0,
- pahu_vi_feed_mixer_get, pahu_vi_feed_mixer_put),
- SOC_SINGLE_EXT("SPKR_VI_2", SND_SOC_NOPM, WCD9360_TX15, 1, 0,
- pahu_vi_feed_mixer_get, pahu_vi_feed_mixer_put),
-};
-
-static const struct snd_kcontrol_new aif1_cap_mixer[] = {
- SOC_SINGLE_EXT("SLIM TX0", SND_SOC_NOPM, WCD9360_TX0, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX1", SND_SOC_NOPM, WCD9360_TX1, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX2", SND_SOC_NOPM, WCD9360_TX2, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX3", SND_SOC_NOPM, WCD9360_TX3, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX4", SND_SOC_NOPM, WCD9360_TX4, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX5", SND_SOC_NOPM, WCD9360_TX5, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX6", SND_SOC_NOPM, WCD9360_TX6, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX7", SND_SOC_NOPM, WCD9360_TX7, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX8", SND_SOC_NOPM, WCD9360_TX8, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX9", SND_SOC_NOPM, WCD9360_TX9, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX10", SND_SOC_NOPM, WCD9360_TX10, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX11", SND_SOC_NOPM, WCD9360_TX11, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX13", SND_SOC_NOPM, WCD9360_TX13, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
-};
-
-static const struct snd_kcontrol_new aif2_cap_mixer[] = {
- SOC_SINGLE_EXT("SLIM TX0", SND_SOC_NOPM, WCD9360_TX0, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX1", SND_SOC_NOPM, WCD9360_TX1, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX2", SND_SOC_NOPM, WCD9360_TX2, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX3", SND_SOC_NOPM, WCD9360_TX3, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX4", SND_SOC_NOPM, WCD9360_TX4, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX5", SND_SOC_NOPM, WCD9360_TX5, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX6", SND_SOC_NOPM, WCD9360_TX6, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX7", SND_SOC_NOPM, WCD9360_TX7, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX8", SND_SOC_NOPM, WCD9360_TX8, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX9", SND_SOC_NOPM, WCD9360_TX9, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX10", SND_SOC_NOPM, WCD9360_TX10, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX11", SND_SOC_NOPM, WCD9360_TX11, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX13", SND_SOC_NOPM, WCD9360_TX13, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
-};
-
-static const struct snd_kcontrol_new aif3_cap_mixer[] = {
- SOC_SINGLE_EXT("SLIM TX0", SND_SOC_NOPM, WCD9360_TX0, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX1", SND_SOC_NOPM, WCD9360_TX1, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX2", SND_SOC_NOPM, WCD9360_TX2, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX3", SND_SOC_NOPM, WCD9360_TX3, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX4", SND_SOC_NOPM, WCD9360_TX4, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX5", SND_SOC_NOPM, WCD9360_TX5, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX6", SND_SOC_NOPM, WCD9360_TX6, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX7", SND_SOC_NOPM, WCD9360_TX7, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX8", SND_SOC_NOPM, WCD9360_TX8, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX9", SND_SOC_NOPM, WCD9360_TX9, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX10", SND_SOC_NOPM, WCD9360_TX10, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX11", SND_SOC_NOPM, WCD9360_TX11, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
- SOC_SINGLE_EXT("SLIM TX13", SND_SOC_NOPM, WCD9360_TX13, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
-};
-
-static const struct snd_kcontrol_new aif4_mad_mixer[] = {
- SOC_SINGLE_EXT("SLIM TX13", SND_SOC_NOPM, WCD9360_TX13, 1, 0,
- slim_tx_mixer_get, slim_tx_mixer_put),
-};
-
-WCD_DAPM_ENUM_EXT(slim_rx0, SND_SOC_NOPM, 0, slim_rx_mux_text,
- slim_rx_mux_get, slim_rx_mux_put);
-WCD_DAPM_ENUM_EXT(slim_rx1, SND_SOC_NOPM, 0, slim_rx_mux_text,
- slim_rx_mux_get, slim_rx_mux_put);
-WCD_DAPM_ENUM_EXT(slim_rx2, SND_SOC_NOPM, 0, slim_rx_mux_text,
- slim_rx_mux_get, slim_rx_mux_put);
-WCD_DAPM_ENUM_EXT(slim_rx3, SND_SOC_NOPM, 0, slim_rx_mux_text,
- slim_rx_mux_get, slim_rx_mux_put);
-WCD_DAPM_ENUM_EXT(slim_rx4, SND_SOC_NOPM, 0, slim_rx_mux_text,
- slim_rx_mux_get, slim_rx_mux_put);
-WCD_DAPM_ENUM_EXT(slim_rx5, SND_SOC_NOPM, 0, slim_rx_mux_text,
- slim_rx_mux_get, slim_rx_mux_put);
-WCD_DAPM_ENUM_EXT(slim_rx6, SND_SOC_NOPM, 0, slim_rx_mux_text,
- slim_rx_mux_get, slim_rx_mux_put);
-WCD_DAPM_ENUM_EXT(slim_rx7, SND_SOC_NOPM, 0, slim_rx_mux_text,
- slim_rx_mux_get, slim_rx_mux_put);
-
-WCD_DAPM_ENUM(cdc_if_rx0, SND_SOC_NOPM, 0, cdc_if_rx0_mux_text);
-WCD_DAPM_ENUM(cdc_if_rx1, SND_SOC_NOPM, 0, cdc_if_rx1_mux_text);
-WCD_DAPM_ENUM(cdc_if_rx2, SND_SOC_NOPM, 0, cdc_if_rx2_mux_text);
-WCD_DAPM_ENUM(cdc_if_rx3, SND_SOC_NOPM, 0, cdc_if_rx3_mux_text);
-WCD_DAPM_ENUM(cdc_if_rx4, SND_SOC_NOPM, 0, cdc_if_rx4_mux_text);
-WCD_DAPM_ENUM(cdc_if_rx5, SND_SOC_NOPM, 0, cdc_if_rx5_mux_text);
-WCD_DAPM_ENUM(cdc_if_rx6, SND_SOC_NOPM, 0, cdc_if_rx6_mux_text);
-WCD_DAPM_ENUM(cdc_if_rx7, SND_SOC_NOPM, 0, cdc_if_rx7_mux_text);
-
-WCD_DAPM_ENUM(rx_int0_2, WCD9360_CDC_RX_INP_MUX_RX_INT0_CFG1, 0,
- rx_int0_7_mix_mux_text);
-WCD_DAPM_ENUM(rx_int7_2, WCD9360_CDC_RX_INP_MUX_RX_INT7_CFG1, 0,
- rx_int0_7_mix_mux_text);
-WCD_DAPM_ENUM(rx_int8_2, WCD9360_CDC_RX_INP_MUX_RX_INT8_CFG1, 0,
- rx_int_mix_mux_text);
-WCD_DAPM_ENUM(rx_int9_2, WCD9360_CDC_RX_INP_MUX_RX_INT9_CFG1, 0,
- rx_int0_7_mix_mux_text);
-
-WCD_DAPM_ENUM(rx_int0_1_mix_inp0, WCD9360_CDC_RX_INP_MUX_RX_INT0_CFG0, 0,
- rx_prim_mix_text);
-WCD_DAPM_ENUM(rx_int0_1_mix_inp1, WCD9360_CDC_RX_INP_MUX_RX_INT0_CFG0, 4,
- rx_prim_mix_text);
-WCD_DAPM_ENUM(rx_int0_1_mix_inp2, WCD9360_CDC_RX_INP_MUX_RX_INT0_CFG1, 4,
- rx_prim_mix_text);
-WCD_DAPM_ENUM(rx_int7_1_mix_inp0, WCD9360_CDC_RX_INP_MUX_RX_INT7_CFG0, 0,
- rx_prim_mix_text);
-WCD_DAPM_ENUM(rx_int7_1_mix_inp1, WCD9360_CDC_RX_INP_MUX_RX_INT7_CFG0, 4,
- rx_prim_mix_text);
-WCD_DAPM_ENUM(rx_int7_1_mix_inp2, WCD9360_CDC_RX_INP_MUX_RX_INT7_CFG1, 4,
- rx_prim_mix_text);
-WCD_DAPM_ENUM(rx_int8_1_mix_inp0, WCD9360_CDC_RX_INP_MUX_RX_INT8_CFG0, 0,
- rx_prim_mix_text);
-WCD_DAPM_ENUM(rx_int8_1_mix_inp1, WCD9360_CDC_RX_INP_MUX_RX_INT8_CFG0, 4,
- rx_prim_mix_text);
-WCD_DAPM_ENUM(rx_int8_1_mix_inp2, WCD9360_CDC_RX_INP_MUX_RX_INT8_CFG1, 4,
- rx_prim_mix_text);
-WCD_DAPM_ENUM(rx_int9_1_mix_inp0, WCD9360_CDC_RX_INP_MUX_RX_INT9_CFG0, 0,
- rx_prim_mix_text);
-WCD_DAPM_ENUM(rx_int9_1_mix_inp1, WCD9360_CDC_RX_INP_MUX_RX_INT9_CFG0, 4,
- rx_prim_mix_text);
-WCD_DAPM_ENUM(rx_int9_1_mix_inp2, WCD9360_CDC_RX_INP_MUX_RX_INT9_CFG1, 4,
- rx_prim_mix_text);
-
-WCD_DAPM_ENUM(rx_int0_mix2_inp, WCD9360_CDC_RX_INP_MUX_SIDETONE_SRC_CFG0, 0,
- rx_sidetone_mix_text);
-WCD_DAPM_ENUM(rx_int7_mix2_inp, WCD9360_CDC_RX_INP_MUX_SIDETONE_SRC_CFG1, 2,
- rx_sidetone_mix_text);
-WCD_DAPM_ENUM(rx_int9_mix2_inp, WCD9360_CDC_RX_INP_MUX_SIDETONE_SRC_CFG1, 4,
- rx_sidetone_mix_text);
-
-WCD_DAPM_ENUM(tx_adc_mux10, WCD9360_CDC_TX_INP_MUX_ADC_MUX1_CFG1, 4,
- adc_mux_text);
-WCD_DAPM_ENUM(tx_adc_mux11, WCD9360_CDC_TX_INP_MUX_ADC_MUX2_CFG1, 4,
- adc_mux_text);
-
-WCD_DAPM_ENUM(tx_dmic_mux0, WCD9360_CDC_TX_INP_MUX_ADC_MUX0_CFG0, 3,
- dmic_mux_text);
-WCD_DAPM_ENUM(tx_dmic_mux1, WCD9360_CDC_TX_INP_MUX_ADC_MUX1_CFG0, 3,
- dmic_mux_text);
-WCD_DAPM_ENUM(tx_dmic_mux2, WCD9360_CDC_TX_INP_MUX_ADC_MUX2_CFG0, 3,
- dmic_mux_text);
-WCD_DAPM_ENUM(tx_dmic_mux3, WCD9360_CDC_TX_INP_MUX_ADC_MUX3_CFG0, 3,
- dmic_mux_text);
-WCD_DAPM_ENUM(tx_dmic_mux4, WCD9360_CDC_TX_INP_MUX_ADC_MUX4_CFG0, 3,
- dmic_mux_text);
-WCD_DAPM_ENUM(tx_dmic_mux5, WCD9360_CDC_TX_INP_MUX_ADC_MUX5_CFG0, 3,
- dmic_mux_text);
-WCD_DAPM_ENUM(tx_dmic_mux6, WCD9360_CDC_TX_INP_MUX_ADC_MUX6_CFG0, 3,
- dmic_mux_text);
-WCD_DAPM_ENUM(tx_dmic_mux7, WCD9360_CDC_TX_INP_MUX_ADC_MUX7_CFG0, 3,
- dmic_mux_text);
-WCD_DAPM_ENUM(tx_dmic_mux8, WCD9360_CDC_TX_INP_MUX_ADC_MUX8_CFG0, 3,
- dmic_mux_text);
-WCD_DAPM_ENUM(tx_dmic_mux10, WCD9360_CDC_TX_INP_MUX_ADC_MUX10_CFG0, 3,
- dmic_mux_text);
-WCD_DAPM_ENUM(tx_dmic_mux11, WCD9360_CDC_TX_INP_MUX_ADC_MUX11_CFG0, 3,
- dmic_mux_text);
-
-WCD_DAPM_ENUM(tx_amic_mux0, WCD9360_CDC_TX_INP_MUX_ADC_MUX0_CFG0, 0,
- amic_mux_text);
-WCD_DAPM_ENUM(tx_amic_mux1, WCD9360_CDC_TX_INP_MUX_ADC_MUX1_CFG0, 0,
- amic_mux_text);
-WCD_DAPM_ENUM(tx_amic_mux2, WCD9360_CDC_TX_INP_MUX_ADC_MUX2_CFG0, 0,
- amic_mux_text);
-WCD_DAPM_ENUM(tx_amic_mux3, WCD9360_CDC_TX_INP_MUX_ADC_MUX3_CFG0, 0,
- amic_mux_text);
-WCD_DAPM_ENUM(tx_amic_mux4, WCD9360_CDC_TX_INP_MUX_ADC_MUX4_CFG0, 0,
- amic_mux_text);
-WCD_DAPM_ENUM(tx_amic_mux5, WCD9360_CDC_TX_INP_MUX_ADC_MUX5_CFG0, 0,
- amic_mux_text);
-WCD_DAPM_ENUM(tx_amic_mux6, WCD9360_CDC_TX_INP_MUX_ADC_MUX6_CFG0, 0,
- amic_mux_text);
-WCD_DAPM_ENUM(tx_amic_mux7, WCD9360_CDC_TX_INP_MUX_ADC_MUX7_CFG0, 0,
- amic_mux_text);
-WCD_DAPM_ENUM(tx_amic_mux8, WCD9360_CDC_TX_INP_MUX_ADC_MUX8_CFG0, 0,
- amic_mux_text);
-WCD_DAPM_ENUM(tx_amic_mux10, WCD9360_CDC_TX_INP_MUX_ADC_MUX10_CFG0, 0,
- amic_mux_text);
-WCD_DAPM_ENUM(tx_amic_mux11, WCD9360_CDC_TX_INP_MUX_ADC_MUX11_CFG0, 0,
- amic_mux_text);
-
-WCD_DAPM_ENUM(tx_adc2_in, WCD9360_ANA_AMIC_INPUT_SWITCH_CTL, 7, adc2_in_text);
-WCD_DAPM_ENUM(tx_adc4_in, WCD9360_ANA_AMIC_INPUT_SWITCH_CTL, 6, adc4_in_text);
-
-WCD_DAPM_ENUM(cdc_if_tx0, WCD9360_CDC_IF_ROUTER_TX_MUX_CFG0, 0,
- cdc_if_tx0_mux_text);
-WCD_DAPM_ENUM(cdc_if_tx1, WCD9360_CDC_IF_ROUTER_TX_MUX_CFG0, 2,
- cdc_if_tx1_mux_text);
-WCD_DAPM_ENUM(cdc_if_tx2, WCD9360_CDC_IF_ROUTER_TX_MUX_CFG0, 4,
- cdc_if_tx2_mux_text);
-WCD_DAPM_ENUM(cdc_if_tx3, WCD9360_CDC_IF_ROUTER_TX_MUX_CFG0, 6,
- cdc_if_tx3_mux_text);
-WCD_DAPM_ENUM(cdc_if_tx4, WCD9360_CDC_IF_ROUTER_TX_MUX_CFG1, 0,
- cdc_if_tx4_mux_text);
-WCD_DAPM_ENUM(cdc_if_tx5, WCD9360_CDC_IF_ROUTER_TX_MUX_CFG1, 2,
- cdc_if_tx5_mux_text);
-WCD_DAPM_ENUM(cdc_if_tx6, WCD9360_CDC_IF_ROUTER_TX_MUX_CFG1, 4,
- cdc_if_tx6_mux_text);
-WCD_DAPM_ENUM(cdc_if_tx7, WCD9360_CDC_IF_ROUTER_TX_MUX_CFG1, 6,
- cdc_if_tx7_mux_text);
-WCD_DAPM_ENUM(cdc_if_tx8, WCD9360_CDC_IF_ROUTER_TX_MUX_CFG2, 0,
- cdc_if_tx8_mux_text);
-WCD_DAPM_ENUM(cdc_if_tx9, WCD9360_CDC_IF_ROUTER_TX_MUX_CFG2, 2,
- cdc_if_tx9_mux_text);
-WCD_DAPM_ENUM(cdc_if_tx10, WCD9360_CDC_IF_ROUTER_TX_MUX_CFG2, 4,
- cdc_if_tx10_mux_text);
-WCD_DAPM_ENUM(cdc_if_tx10_inp2, WCD9360_DATA_HUB_SB_TX10_INP_CFG, 3,
- cdc_if_tx10_mux2_text);
-WCD_DAPM_ENUM(cdc_if_tx11_inp1, WCD9360_CDC_IF_ROUTER_TX_MUX_CFG3, 0,
- cdc_if_tx11_inp1_mux_text);
-WCD_DAPM_ENUM(cdc_if_tx11, WCD9360_DATA_HUB_SB_TX11_INP_CFG, 0,
- cdc_if_tx11_mux_text);
-WCD_DAPM_ENUM(cdc_if_tx11_inp2, WCD9360_DATA_HUB_SB_TX11_INP_CFG, 3,
- cdc_if_tx11_mux2_text);
-WCD_DAPM_ENUM(cdc_if_tx13_inp1, WCD9360_CDC_IF_ROUTER_TX_MUX_CFG3, 4,
- cdc_if_tx13_inp1_mux_text);
-WCD_DAPM_ENUM(cdc_if_tx13, WCD9360_DATA_HUB_SB_TX13_INP_CFG, 0,
- cdc_if_tx13_mux_text);
-
-WCD_DAPM_ENUM(rx_mix_tx0, WCD9360_CDC_RX_INP_MUX_RX_MIX_CFG0, 0,
- rx_echo_mux_text);
-WCD_DAPM_ENUM(rx_mix_tx1, WCD9360_CDC_RX_INP_MUX_RX_MIX_CFG0, 4,
- rx_echo_mux_text);
-WCD_DAPM_ENUM(rx_mix_tx2, WCD9360_CDC_RX_INP_MUX_RX_MIX_CFG1, 0,
- rx_echo_mux_text);
-WCD_DAPM_ENUM(rx_mix_tx3, WCD9360_CDC_RX_INP_MUX_RX_MIX_CFG1, 4,
- rx_echo_mux_text);
-WCD_DAPM_ENUM(rx_mix_tx4, WCD9360_CDC_RX_INP_MUX_RX_MIX_CFG2, 0,
- rx_echo_mux_text);
-WCD_DAPM_ENUM(rx_mix_tx5, WCD9360_CDC_RX_INP_MUX_RX_MIX_CFG2, 4,
- rx_echo_mux_text);
-WCD_DAPM_ENUM(rx_mix_tx6, WCD9360_CDC_RX_INP_MUX_RX_MIX_CFG3, 0,
- rx_echo_mux_text);
-WCD_DAPM_ENUM(rx_mix_tx7, WCD9360_CDC_RX_INP_MUX_RX_MIX_CFG3, 4,
- rx_echo_mux_text);
-WCD_DAPM_ENUM(rx_mix_tx8, WCD9360_CDC_RX_INP_MUX_RX_MIX_CFG4, 0,
- rx_echo_mux_text);
-
-WCD_DAPM_ENUM(iir0_inp0, WCD9360_CDC_SIDETONE_IIR_INP_MUX_IIR0_MIX_CFG0, 0,
- iir_inp_mux_text);
-WCD_DAPM_ENUM(iir0_inp1, WCD9360_CDC_SIDETONE_IIR_INP_MUX_IIR0_MIX_CFG1, 0,
- iir_inp_mux_text);
-WCD_DAPM_ENUM(iir0_inp2, WCD9360_CDC_SIDETONE_IIR_INP_MUX_IIR0_MIX_CFG2, 0,
- iir_inp_mux_text);
-WCD_DAPM_ENUM(iir0_inp3, WCD9360_CDC_SIDETONE_IIR_INP_MUX_IIR0_MIX_CFG3, 0,
- iir_inp_mux_text);
-
-WCD_DAPM_ENUM(rx_int0_1_interp, SND_SOC_NOPM, 0, rx_int0_1_interp_mux_text);
-WCD_DAPM_ENUM(rx_int7_1_interp, SND_SOC_NOPM, 0, rx_int7_1_interp_mux_text);
-WCD_DAPM_ENUM(rx_int8_1_interp, SND_SOC_NOPM, 0, rx_int8_1_interp_mux_text);
-WCD_DAPM_ENUM(rx_int9_1_interp, SND_SOC_NOPM, 0, rx_int9_1_interp_mux_text);
-
-WCD_DAPM_ENUM(rx_int0_2_interp, SND_SOC_NOPM, 0, rx_int0_2_interp_mux_text);
-WCD_DAPM_ENUM(rx_int7_2_interp, SND_SOC_NOPM, 0, rx_int7_2_interp_mux_text);
-WCD_DAPM_ENUM(rx_int8_2_interp, SND_SOC_NOPM, 0, rx_int8_2_interp_mux_text);
-WCD_DAPM_ENUM(rx_int9_2_interp, SND_SOC_NOPM, 0, rx_int9_2_interp_mux_text);
-
-WCD_DAPM_ENUM(mad_sel, WCD9360_CPE_SS_SVA_CFG, 0,
- mad_sel_txt);
-
-WCD_DAPM_ENUM(mad_inp_mux, WCD9360_CPE_SS_SVA_CFG, 2,
- mad_inp_mux_txt);
-
-WCD_DAPM_ENUM_EXT(rx_int0_dem_inp, WCD9360_CDC_RX0_RX_PATH_SEC0, 0,
- rx_int_dem_inp_mux_text, snd_soc_dapm_get_enum_double,
- pahu_int_dem_inp_mux_put);
-
-WCD_DAPM_ENUM_EXT(rx_int9_dem_inp, WCD9360_CDC_RX9_RX_PATH_SEC0, 0,
- rx_int_dem_inp_mux_text, snd_soc_dapm_get_enum_double,
- pahu_int_dem_inp_mux_put);
-
-WCD_DAPM_ENUM_EXT(tx_adc_mux0, WCD9360_CDC_TX_INP_MUX_ADC_MUX0_CFG1, 0,
- adc_mux_text, snd_soc_dapm_get_enum_double, pahu_dec_enum_put);
-WCD_DAPM_ENUM_EXT(tx_adc_mux1, WCD9360_CDC_TX_INP_MUX_ADC_MUX1_CFG1, 0,
- adc_mux_text, snd_soc_dapm_get_enum_double, pahu_dec_enum_put);
-WCD_DAPM_ENUM_EXT(tx_adc_mux2, WCD9360_CDC_TX_INP_MUX_ADC_MUX2_CFG1, 0,
- adc_mux_text, snd_soc_dapm_get_enum_double, pahu_dec_enum_put);
-WCD_DAPM_ENUM_EXT(tx_adc_mux3, WCD9360_CDC_TX_INP_MUX_ADC_MUX3_CFG1, 0,
- adc_mux_text, snd_soc_dapm_get_enum_double, pahu_dec_enum_put);
-WCD_DAPM_ENUM_EXT(tx_adc_mux4, WCD9360_CDC_TX_INP_MUX_ADC_MUX0_CFG1, 2,
- adc_mux_text, snd_soc_dapm_get_enum_double, pahu_dec_enum_put);
-WCD_DAPM_ENUM_EXT(tx_adc_mux5, WCD9360_CDC_TX_INP_MUX_ADC_MUX1_CFG1, 2,
- adc_mux_text, snd_soc_dapm_get_enum_double, pahu_dec_enum_put);
-WCD_DAPM_ENUM_EXT(tx_adc_mux6, WCD9360_CDC_TX_INP_MUX_ADC_MUX2_CFG1, 2,
- adc_mux_text, snd_soc_dapm_get_enum_double, pahu_dec_enum_put);
-WCD_DAPM_ENUM_EXT(tx_adc_mux7, WCD9360_CDC_TX_INP_MUX_ADC_MUX3_CFG1, 2,
- adc_mux_text, snd_soc_dapm_get_enum_double, pahu_dec_enum_put);
-WCD_DAPM_ENUM_EXT(tx_adc_mux8, WCD9360_CDC_TX_INP_MUX_ADC_MUX0_CFG1, 4,
- adc_mux_text, snd_soc_dapm_get_enum_double, pahu_dec_enum_put);
-
-WCD_DAPM_ENUM(asrc2, WCD9360_CDC_RX_INP_MUX_SPLINE_ASRC_CFG0, 4,
- asrc2_mux_text);
-WCD_DAPM_ENUM(asrc3, WCD9360_CDC_RX_INP_MUX_SPLINE_ASRC_CFG0, 6,
- asrc3_mux_text);
-
-WCD_DAPM_ENUM(int7_2_native, SND_SOC_NOPM, 0, native_mux_text);
-WCD_DAPM_ENUM(int8_2_native, SND_SOC_NOPM, 0, native_mux_text);
-
-WCD_DAPM_ENUM(anc0_fb, WCD9360_CDC_RX_INP_MUX_ANC_CFG0, 0, anc0_fb_mux_text);
-
-WCD_DAPM_ENUM(wdma3_port0, WCD9360_DMA_WDMA3_PRT_CFG, 0, wdma3_port0_text);
-WCD_DAPM_ENUM(wdma3_port1, WCD9360_DMA_WDMA3_PRT_CFG, 1, wdma3_port1_text);
-WCD_DAPM_ENUM(wdma3_port2, WCD9360_DMA_WDMA3_PRT_CFG, 2, wdma3_port2_text);
-WCD_DAPM_ENUM(wdma3_port3, WCD9360_DMA_WDMA3_PRT_CFG, 3, wdma3_port3_text);
-WCD_DAPM_ENUM(wdma3_port4, WCD9360_DMA_WDMA3_PRT_CFG, 4, wdma3_port4_text);
-WCD_DAPM_ENUM(wdma3_port5, WCD9360_DMA_WDMA3_PRT_CFG, 5, wdma3_port5_text);
-WCD_DAPM_ENUM(wdma3_port6, WCD9360_DMA_WDMA3_PRT_CFG, 6, wdma3_port6_text);
-
-WCD_DAPM_ENUM(wdma3_ch0, WCD9360_DMA_CH_0_1_CFG_WDMA_3, 0, wdma3_ch_text);
-WCD_DAPM_ENUM(wdma3_ch1, WCD9360_DMA_CH_0_1_CFG_WDMA_3, 4, wdma3_ch_text);
-WCD_DAPM_ENUM(wdma3_ch2, WCD9360_DMA_CH_2_3_CFG_WDMA_3, 0, wdma3_ch_text);
-WCD_DAPM_ENUM(wdma3_ch3, WCD9360_DMA_CH_2_3_CFG_WDMA_3, 4, wdma3_ch_text);
-
-static const struct snd_kcontrol_new anc_ear_switch =
- SOC_DAPM_SINGLE("Switch", SND_SOC_NOPM, 0, 1, 0);
-
-static const struct snd_kcontrol_new anc_ear_spkr_switch =
- SOC_DAPM_SINGLE("Switch", SND_SOC_NOPM, 0, 1, 0);
-
-static const struct snd_kcontrol_new anc_spkr_pa_switch =
- SOC_DAPM_SINGLE("Switch", SND_SOC_NOPM, 0, 1, 0);
-
-static const struct snd_kcontrol_new mad_cpe1_switch =
- SOC_DAPM_SINGLE("Switch", SND_SOC_NOPM, 0, 1, 0);
-
-static const struct snd_kcontrol_new mad_cpe2_switch =
- SOC_DAPM_SINGLE("Switch", SND_SOC_NOPM, 0, 1, 0);
-
-static const struct snd_kcontrol_new mad_brdcst_switch =
- SOC_DAPM_SINGLE("Switch", SND_SOC_NOPM, 0, 1, 0);
-
-static const struct snd_kcontrol_new adc_us_mux0_switch =
- SOC_DAPM_SINGLE("US_Switch", SND_SOC_NOPM, 0, 1, 0);
-
-static const struct snd_kcontrol_new adc_us_mux1_switch =
- SOC_DAPM_SINGLE("US_Switch", SND_SOC_NOPM, 0, 1, 0);
-
-static const struct snd_kcontrol_new adc_us_mux2_switch =
- SOC_DAPM_SINGLE("US_Switch", SND_SOC_NOPM, 0, 1, 0);
-
-static const struct snd_kcontrol_new adc_us_mux3_switch =
- SOC_DAPM_SINGLE("US_Switch", SND_SOC_NOPM, 0, 1, 0);
-
-static const struct snd_kcontrol_new adc_us_mux4_switch =
- SOC_DAPM_SINGLE("US_Switch", SND_SOC_NOPM, 0, 1, 0);
-
-static const struct snd_kcontrol_new adc_us_mux5_switch =
- SOC_DAPM_SINGLE("US_Switch", SND_SOC_NOPM, 0, 1, 0);
-
-static const struct snd_kcontrol_new adc_us_mux6_switch =
- SOC_DAPM_SINGLE("US_Switch", SND_SOC_NOPM, 0, 1, 0);
-
-static const struct snd_kcontrol_new adc_us_mux7_switch =
- SOC_DAPM_SINGLE("US_Switch", SND_SOC_NOPM, 0, 1, 0);
-
-static const struct snd_kcontrol_new adc_us_mux8_switch =
- SOC_DAPM_SINGLE("US_Switch", SND_SOC_NOPM, 0, 1, 0);
-
-static const struct snd_kcontrol_new wdma3_onoff_switch =
- SOC_DAPM_SINGLE("Switch", SND_SOC_NOPM, 0, 1, 0);
-
-static const char *const i2s_tx1_0_txt[] = {
- "ZERO", "SB_TX8", "SB_RX2", "SB_TX12"
-};
-
-static const char *const i2s_tx1_1_txt[] = {
- "ZERO", "SB_RX0", "SB_RX1", "SB_RX2", "SB_RX3", "SB_TX11"
-};
-
-WCD_DAPM_ENUM(i2s_tx1_0_inp, WCD9360_DATA_HUB_I2S_TX1_0_CFG, 0, i2s_tx1_0_txt);
-WCD_DAPM_ENUM(i2s_tx1_1_inp, WCD9360_DATA_HUB_I2S_TX1_1_CFG, 0, i2s_tx1_1_txt);
-
-static const struct snd_soc_dapm_widget pahu_dapm_widgets[] = {
- SND_SOC_DAPM_AIF_IN_E("AIF1 PB", "AIF1 Playback", 0, SND_SOC_NOPM,
- AIF1_PB, 0, pahu_codec_enable_slimrx,
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_AIF_IN_E("AIF2 PB", "AIF2 Playback", 0, SND_SOC_NOPM,
- AIF2_PB, 0, pahu_codec_enable_slimrx,
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_AIF_IN_E("AIF3 PB", "AIF3 Playback", 0, SND_SOC_NOPM,
- AIF3_PB, 0, pahu_codec_enable_slimrx,
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_AIF_IN_E("AIF4 PB", "AIF4 Playback", 0, SND_SOC_NOPM,
- AIF4_PB, 0, pahu_codec_enable_slimrx,
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_AIF_IN_E("I2S1 PB", "I2S1 Playback", 0, SND_SOC_NOPM,
- I2S1_PB, 0, pahu_i2s_aif_rx_event,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD |
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
-
- WCD_DAPM_MUX("SLIM RX0 MUX", WCD9360_RX0, slim_rx0),
- WCD_DAPM_MUX("SLIM RX1 MUX", WCD9360_RX1, slim_rx1),
- WCD_DAPM_MUX("SLIM RX2 MUX", WCD9360_RX2, slim_rx2),
- WCD_DAPM_MUX("SLIM RX3 MUX", WCD9360_RX3, slim_rx3),
- WCD_DAPM_MUX("SLIM RX4 MUX", WCD9360_RX4, slim_rx4),
- WCD_DAPM_MUX("SLIM RX5 MUX", WCD9360_RX5, slim_rx5),
- WCD_DAPM_MUX("SLIM RX6 MUX", WCD9360_RX6, slim_rx6),
- WCD_DAPM_MUX("SLIM RX7 MUX", WCD9360_RX7, slim_rx7),
-
- SND_SOC_DAPM_MIXER("SLIM RX0", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("SLIM RX1", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("SLIM RX2", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("SLIM RX3", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("SLIM RX4", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("SLIM RX5", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("SLIM RX6", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("SLIM RX7", SND_SOC_NOPM, 0, 0, NULL, 0),
-
- WCD_DAPM_MUX("CDC_IF RX0 MUX", WCD9360_RX0, cdc_if_rx0),
- WCD_DAPM_MUX("CDC_IF RX1 MUX", WCD9360_RX1, cdc_if_rx1),
- WCD_DAPM_MUX("CDC_IF RX2 MUX", WCD9360_RX2, cdc_if_rx2),
- WCD_DAPM_MUX("CDC_IF RX3 MUX", WCD9360_RX3, cdc_if_rx3),
- WCD_DAPM_MUX("CDC_IF RX4 MUX", WCD9360_RX4, cdc_if_rx4),
- WCD_DAPM_MUX("CDC_IF RX5 MUX", WCD9360_RX5, cdc_if_rx5),
- WCD_DAPM_MUX("CDC_IF RX6 MUX", WCD9360_RX6, cdc_if_rx6),
- WCD_DAPM_MUX("CDC_IF RX7 MUX", WCD9360_RX7, cdc_if_rx7),
-
- SND_SOC_DAPM_MUX_E("RX INT0_2 MUX", SND_SOC_NOPM, INTERP_EAR, 0,
- &rx_int0_2_mux, pahu_codec_enable_mix_path,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MUX_E("RX INT7_2 MUX", SND_SOC_NOPM, INTERP_SPKR1, 0,
- &rx_int7_2_mux, pahu_codec_enable_mix_path,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MUX_E("RX INT8_2 MUX", SND_SOC_NOPM, INTERP_SPKR2, 0,
- &rx_int8_2_mux, pahu_codec_enable_mix_path,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MUX_E("RX INT9_2 MUX", SND_SOC_NOPM, INTERP_AUX, 0,
- &rx_int9_2_mux, pahu_codec_enable_mix_path,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_POST_PMD),
-
- WCD_DAPM_MUX("RX INT0_1 MIX1 INP0", 0, rx_int0_1_mix_inp0),
- WCD_DAPM_MUX("RX INT0_1 MIX1 INP1", 0, rx_int0_1_mix_inp1),
- WCD_DAPM_MUX("RX INT0_1 MIX1 INP2", 0, rx_int0_1_mix_inp2),
-
- SND_SOC_DAPM_MUX_E("RX INT7_1 MIX1 INP0", SND_SOC_NOPM, 0, 0,
- &rx_int7_1_mix_inp0_mux, pahu_codec_enable_swr,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MUX_E("RX INT7_1 MIX1 INP1", SND_SOC_NOPM, 0, 0,
- &rx_int7_1_mix_inp1_mux, pahu_codec_enable_swr,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MUX_E("RX INT7_1 MIX1 INP2", SND_SOC_NOPM, 0, 0,
- &rx_int7_1_mix_inp2_mux, pahu_codec_enable_swr,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MUX_E("RX INT8_1 MIX1 INP0", SND_SOC_NOPM, 0, 0,
- &rx_int8_1_mix_inp0_mux, pahu_codec_enable_swr,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MUX_E("RX INT8_1 MIX1 INP1", SND_SOC_NOPM, 0, 0,
- &rx_int8_1_mix_inp1_mux, pahu_codec_enable_swr,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MUX_E("RX INT8_1 MIX1 INP2", SND_SOC_NOPM, 0, 0,
- &rx_int8_1_mix_inp2_mux, pahu_codec_enable_swr,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
-
- WCD_DAPM_MUX("RX INT9_1 MIX1 INP0", 0, rx_int9_1_mix_inp0),
- WCD_DAPM_MUX("RX INT9_1 MIX1 INP1", 0, rx_int9_1_mix_inp1),
- WCD_DAPM_MUX("RX INT9_1 MIX1 INP2", 0, rx_int9_1_mix_inp2),
-
- SND_SOC_DAPM_MIXER("RX INT0_1 MIX1", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("RX INT0 SEC MIX", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("RX INT7_1 MIX1", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("RX INT7 SEC MIX", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("RX INT8_1 MIX1", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("RX INT8 SEC MIX", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("RX INT9_1 MIX1", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("RX INT9 SEC MIX", SND_SOC_NOPM, 0, 0, NULL, 0),
-
- SND_SOC_DAPM_MIXER("RX INT0 MIX2", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("RX INT7 MIX2", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("RX INT9 MIX2", SND_SOC_NOPM, 0, 0, NULL, 0),
-
- SND_SOC_DAPM_MIXER_E("RX INT7 CHAIN", SND_SOC_NOPM, 0, 0,
- NULL, 0, pahu_codec_spk_boost_event,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MIXER_E("RX INT8 CHAIN", SND_SOC_NOPM, 0, 0,
- NULL, 0, pahu_codec_spk_boost_event,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_MUX_E("RX INT0 MIX2 INP", SND_SOC_NOPM, INTERP_EAR,
- 0, &rx_int0_mix2_inp_mux, pahu_codec_enable_rx_path_clk,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MUX_E("RX INT7 MIX2 INP", SND_SOC_NOPM, INTERP_SPKR1,
- 0, &rx_int7_mix2_inp_mux, pahu_codec_enable_rx_path_clk,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MUX_E("RX INT9 MIX2 INP", SND_SOC_NOPM, INTERP_AUX,
- 0, &rx_int9_mix2_inp_mux, pahu_codec_enable_rx_path_clk,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
-
- WCD_DAPM_MUX("CDC_IF TX0 MUX", WCD9360_TX0, cdc_if_tx0),
- WCD_DAPM_MUX("CDC_IF TX1 MUX", WCD9360_TX1, cdc_if_tx1),
- WCD_DAPM_MUX("CDC_IF TX2 MUX", WCD9360_TX2, cdc_if_tx2),
- WCD_DAPM_MUX("CDC_IF TX3 MUX", WCD9360_TX3, cdc_if_tx3),
- WCD_DAPM_MUX("CDC_IF TX4 MUX", WCD9360_TX4, cdc_if_tx4),
- WCD_DAPM_MUX("CDC_IF TX5 MUX", WCD9360_TX5, cdc_if_tx5),
- WCD_DAPM_MUX("CDC_IF TX6 MUX", WCD9360_TX6, cdc_if_tx6),
- WCD_DAPM_MUX("CDC_IF TX7 MUX", WCD9360_TX7, cdc_if_tx7),
- WCD_DAPM_MUX("CDC_IF TX8 MUX", WCD9360_TX8, cdc_if_tx8),
- WCD_DAPM_MUX("CDC_IF TX9 MUX", WCD9360_TX9, cdc_if_tx9),
- WCD_DAPM_MUX("CDC_IF TX10 MUX", WCD9360_TX10, cdc_if_tx10),
- WCD_DAPM_MUX("CDC_IF TX11 MUX", WCD9360_TX11, cdc_if_tx11),
- WCD_DAPM_MUX("CDC_IF TX11 INP1 MUX", WCD9360_TX11, cdc_if_tx11_inp1),
- WCD_DAPM_MUX("CDC_IF TX13 MUX", WCD9360_TX13, cdc_if_tx13),
- WCD_DAPM_MUX("CDC_IF TX13 INP1 MUX", WCD9360_TX13, cdc_if_tx13_inp1),
- WCD_DAPM_MUX("CDC_IF TX10 MUX2", WCD9360_TX10, cdc_if_tx10_inp2),
- WCD_DAPM_MUX("CDC_IF TX11 MUX2", WCD9360_TX11, cdc_if_tx11_inp2),
-
- SND_SOC_DAPM_MUX_E("ADC MUX0", WCD9360_CDC_TX0_TX_PATH_CTL, 5, 0,
- &tx_adc_mux0_mux, pahu_codec_enable_dec,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_MUX_E("ADC MUX1", WCD9360_CDC_TX1_TX_PATH_CTL, 5, 0,
- &tx_adc_mux1_mux, pahu_codec_enable_dec,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_MUX_E("ADC MUX2", WCD9360_CDC_TX2_TX_PATH_CTL, 5, 0,
- &tx_adc_mux2_mux, pahu_codec_enable_dec,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_MUX_E("ADC MUX3", WCD9360_CDC_TX3_TX_PATH_CTL, 5, 0,
- &tx_adc_mux3_mux, pahu_codec_enable_dec,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_MUX_E("ADC MUX4", WCD9360_CDC_TX4_TX_PATH_CTL, 5, 0,
- &tx_adc_mux4_mux, pahu_codec_enable_dec,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_MUX_E("ADC MUX5", WCD9360_CDC_TX5_TX_PATH_CTL, 5, 0,
- &tx_adc_mux5_mux, pahu_codec_enable_dec,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_MUX_E("ADC MUX6", WCD9360_CDC_TX6_TX_PATH_CTL, 5, 0,
- &tx_adc_mux6_mux, pahu_codec_enable_dec,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_MUX_E("ADC MUX7", WCD9360_CDC_TX7_TX_PATH_CTL, 5, 0,
- &tx_adc_mux7_mux, pahu_codec_enable_dec,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_MUX_E("ADC MUX8", WCD9360_CDC_TX8_TX_PATH_CTL, 5, 0,
- &tx_adc_mux8_mux, pahu_codec_enable_dec,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_MUX_E("ADC MUX10", SND_SOC_NOPM, 10, 0, &tx_adc_mux10_mux,
- pahu_codec_tx_adc_cfg, SND_SOC_DAPM_POST_PMU),
-
- SND_SOC_DAPM_MUX_E("ADC MUX11", SND_SOC_NOPM, 11, 0, &tx_adc_mux11_mux,
- pahu_codec_tx_adc_cfg, SND_SOC_DAPM_POST_PMU),
-
- WCD_DAPM_MUX("DMIC MUX0", 0, tx_dmic_mux0),
- WCD_DAPM_MUX("DMIC MUX1", 0, tx_dmic_mux1),
- WCD_DAPM_MUX("DMIC MUX2", 0, tx_dmic_mux2),
- WCD_DAPM_MUX("DMIC MUX3", 0, tx_dmic_mux3),
- WCD_DAPM_MUX("DMIC MUX4", 0, tx_dmic_mux4),
- WCD_DAPM_MUX("DMIC MUX5", 0, tx_dmic_mux5),
- WCD_DAPM_MUX("DMIC MUX6", 0, tx_dmic_mux6),
- WCD_DAPM_MUX("DMIC MUX7", 0, tx_dmic_mux7),
- WCD_DAPM_MUX("DMIC MUX8", 0, tx_dmic_mux8),
- WCD_DAPM_MUX("DMIC MUX10", 0, tx_dmic_mux10),
- WCD_DAPM_MUX("DMIC MUX11", 0, tx_dmic_mux11),
-
- WCD_DAPM_MUX("AMIC MUX0", 0, tx_amic_mux0),
- WCD_DAPM_MUX("AMIC MUX1", 0, tx_amic_mux1),
- WCD_DAPM_MUX("AMIC MUX2", 0, tx_amic_mux2),
- WCD_DAPM_MUX("AMIC MUX3", 0, tx_amic_mux3),
- WCD_DAPM_MUX("AMIC MUX4", 0, tx_amic_mux4),
- WCD_DAPM_MUX("AMIC MUX5", 0, tx_amic_mux5),
- WCD_DAPM_MUX("AMIC MUX6", 0, tx_amic_mux6),
- WCD_DAPM_MUX("AMIC MUX7", 0, tx_amic_mux7),
- WCD_DAPM_MUX("AMIC MUX8", 0, tx_amic_mux8),
- WCD_DAPM_MUX("AMIC MUX10", 0, tx_amic_mux10),
- WCD_DAPM_MUX("AMIC MUX11", 0, tx_amic_mux11),
-
- SND_SOC_DAPM_ADC_E("ADC1", NULL, WCD9360_ANA_AMIC1, 7, 0,
- pahu_codec_enable_adc, SND_SOC_DAPM_PRE_PMU),
- SND_SOC_DAPM_ADC_E("ADC2", NULL, WCD9360_ANA_AMIC2, 7, 0,
- pahu_codec_enable_adc, SND_SOC_DAPM_PRE_PMU),
- SND_SOC_DAPM_ADC_E("ADC3", NULL, WCD9360_ANA_AMIC3, 7, 0,
- pahu_codec_enable_adc, SND_SOC_DAPM_PRE_PMU),
- SND_SOC_DAPM_ADC_E("ADC4", NULL, WCD9360_ANA_AMIC4, 7, 0,
- pahu_codec_enable_adc, SND_SOC_DAPM_PRE_PMU),
-
- WCD_DAPM_MUX("ANC0 FB MUX", 0, anc0_fb),
-
- WCD_DAPM_MUX("ADC2_IN", 0, tx_adc2_in),
- WCD_DAPM_MUX("ADC4_IN", 0, tx_adc4_in),
-
- SND_SOC_DAPM_INPUT("AMIC1"),
- SND_SOC_DAPM_INPUT("AMIC2"),
- SND_SOC_DAPM_INPUT("AMIC3"),
- SND_SOC_DAPM_INPUT("AMIC4"),
-
- SND_SOC_DAPM_MICBIAS_E("MIC BIAS1", SND_SOC_NOPM, 0, 0,
- pahu_codec_enable_micbias, SND_SOC_DAPM_PRE_PMU |
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MICBIAS_E("MIC BIAS2", SND_SOC_NOPM, 0, 0,
- pahu_codec_enable_micbias, SND_SOC_DAPM_PRE_PMU |
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MICBIAS_E("MIC BIAS3", SND_SOC_NOPM, 0, 0,
- pahu_codec_enable_micbias, SND_SOC_DAPM_PRE_PMU |
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MICBIAS_E("MIC BIAS4", SND_SOC_NOPM, 0, 0,
- pahu_codec_enable_micbias, SND_SOC_DAPM_PRE_PMU |
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_MICBIAS_E(DAPM_MICBIAS1_STANDALONE, SND_SOC_NOPM, 0, 0,
- pahu_codec_force_enable_micbias,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MICBIAS_E(DAPM_MICBIAS2_STANDALONE, SND_SOC_NOPM, 0, 0,
- pahu_codec_force_enable_micbias,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MICBIAS_E(DAPM_MICBIAS3_STANDALONE, SND_SOC_NOPM, 0, 0,
- pahu_codec_force_enable_micbias,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MICBIAS_E(DAPM_MICBIAS4_STANDALONE, SND_SOC_NOPM, 0, 0,
- pahu_codec_force_enable_micbias,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_AIF_OUT_E("AIF1 CAP", "AIF1 Capture", 0, SND_SOC_NOPM,
- AIF1_CAP, 0, pahu_codec_enable_slimtx,
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_AIF_OUT_E("AIF2 CAP", "AIF2 Capture", 0, SND_SOC_NOPM,
- AIF2_CAP, 0, pahu_codec_enable_slimtx,
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_AIF_OUT_E("AIF3 CAP", "AIF3 Capture", 0, SND_SOC_NOPM,
- AIF3_CAP, 0, pahu_codec_enable_slimtx,
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
-
- WCD_DAPM_MUX("I2S TX1_0 MUX", 0, i2s_tx1_0_inp),
- WCD_DAPM_MUX("I2S TX1_1 MUX", 0, i2s_tx1_1_inp),
- SND_SOC_DAPM_MIXER("I2S TX1 MIXER", SND_SOC_NOPM, 0, 0, NULL, 0),
-
- SND_SOC_DAPM_AIF_OUT_E("I2S1 CAP", "I2S1 Capture", 0,
- SND_SOC_NOPM, I2S1_CAP, 0, pahu_i2s_aif_tx_event,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD |
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_MIXER("AIF1_CAP Mixer", SND_SOC_NOPM, AIF1_CAP, 0,
- aif1_cap_mixer, ARRAY_SIZE(aif1_cap_mixer)),
- SND_SOC_DAPM_MIXER("AIF2_CAP Mixer", SND_SOC_NOPM, AIF2_CAP, 0,
- aif2_cap_mixer, ARRAY_SIZE(aif2_cap_mixer)),
- SND_SOC_DAPM_MIXER("AIF3_CAP Mixer", SND_SOC_NOPM, AIF3_CAP, 0,
- aif3_cap_mixer, ARRAY_SIZE(aif3_cap_mixer)),
- SND_SOC_DAPM_MIXER("AIF4_MAD Mixer", SND_SOC_NOPM, AIF4_MAD_TX, 0,
- aif4_mad_mixer, ARRAY_SIZE(aif4_mad_mixer)),
-
- SND_SOC_DAPM_AIF_OUT_E("AIF4 VI", "VIfeed", 0, SND_SOC_NOPM,
- AIF4_VIFEED, 0, pahu_codec_enable_slimvi_feedback,
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_AIF_OUT("AIF4 MAD", "AIF4 MAD TX", 0,
- SND_SOC_NOPM, 0, 0),
-
- SND_SOC_DAPM_MIXER("AIF4_VI Mixer", SND_SOC_NOPM, AIF4_VIFEED, 0,
- aif4_vi_mixer, ARRAY_SIZE(aif4_vi_mixer)),
- SND_SOC_DAPM_INPUT("VIINPUT"),
-
- SND_SOC_DAPM_MIXER("SLIM TX0", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("SLIM TX1", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("SLIM TX2", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("SLIM TX3", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("SLIM TX4", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("SLIM TX5", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("SLIM TX6", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("SLIM TX7", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("SLIM TX8", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("SLIM TX9", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("SLIM TX10", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("SLIM TX11", SND_SOC_NOPM, 0, 0, NULL, 0),
- SND_SOC_DAPM_MIXER("SLIM TX13", SND_SOC_NOPM, 0, 0, NULL, 0),
-
- /* Digital Mic Inputs */
- SND_SOC_DAPM_ADC_E("DMIC0", NULL, SND_SOC_NOPM, 0, 0,
- pahu_codec_enable_dmic,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_ADC_E("DMIC1", NULL, SND_SOC_NOPM, 1, 0,
- pahu_codec_enable_dmic,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_ADC_E("DMIC2", NULL, SND_SOC_NOPM, 2, 0,
- pahu_codec_enable_dmic,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_ADC_E("DMIC3", NULL, SND_SOC_NOPM, 3, 0,
- pahu_codec_enable_dmic,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_ADC_E("DMIC4", NULL, SND_SOC_NOPM, 4, 0,
- pahu_codec_enable_dmic,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_ADC_E("DMIC5", NULL, SND_SOC_NOPM, 5, 0,
- pahu_codec_enable_dmic,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_ADC_E("DMIC6", NULL, SND_SOC_NOPM, 6, 0,
- pahu_codec_enable_dmic,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_ADC_E("DMIC7", NULL, SND_SOC_NOPM, 7, 0,
- pahu_codec_enable_dmic,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
-
- WCD_DAPM_MUX("IIR0 INP0 MUX", 0, iir0_inp0),
- WCD_DAPM_MUX("IIR0 INP1 MUX", 0, iir0_inp1),
- WCD_DAPM_MUX("IIR0 INP2 MUX", 0, iir0_inp2),
- WCD_DAPM_MUX("IIR0 INP3 MUX", 0, iir0_inp3),
-
- SND_SOC_DAPM_MIXER_E("IIR0", WCD9360_CDC_SIDETONE_IIR0_IIR_PATH_CTL,
- 4, 0, NULL, 0, pahu_codec_set_iir_gain,
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
- SND_SOC_DAPM_MIXER("SRC0", WCD9360_CDC_SIDETONE_SRC0_ST_SRC_PATH_CTL,
- 4, 0, NULL, 0),
-
- WCD_DAPM_MUX("RX MIX TX0 MUX", 0, rx_mix_tx0),
- WCD_DAPM_MUX("RX MIX TX1 MUX", 0, rx_mix_tx1),
- WCD_DAPM_MUX("RX MIX TX2 MUX", 0, rx_mix_tx2),
- WCD_DAPM_MUX("RX MIX TX3 MUX", 0, rx_mix_tx3),
- WCD_DAPM_MUX("RX MIX TX4 MUX", 0, rx_mix_tx4),
- WCD_DAPM_MUX("RX MIX TX5 MUX", 0, rx_mix_tx5),
- WCD_DAPM_MUX("RX MIX TX6 MUX", 0, rx_mix_tx6),
- WCD_DAPM_MUX("RX MIX TX7 MUX", 0, rx_mix_tx7),
- WCD_DAPM_MUX("RX MIX TX8 MUX", 0, rx_mix_tx8),
- WCD_DAPM_MUX("RX INT0 DEM MUX", 0, rx_int0_dem_inp),
- WCD_DAPM_MUX("RX INT9 DEM MUX", 0, rx_int9_dem_inp),
-
- SND_SOC_DAPM_MUX_E("RX INT0_1 INTERP", SND_SOC_NOPM, INTERP_EAR, 0,
- &rx_int0_1_interp_mux, pahu_codec_enable_main_path,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MUX_E("RX INT7_1 INTERP", SND_SOC_NOPM, INTERP_SPKR1, 0,
- &rx_int7_1_interp_mux, pahu_codec_enable_main_path,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MUX_E("RX INT8_1 INTERP", SND_SOC_NOPM, INTERP_SPKR2, 0,
- &rx_int8_1_interp_mux, pahu_codec_enable_main_path,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MUX_E("RX INT9_1 INTERP", SND_SOC_NOPM, INTERP_AUX, 0,
- &rx_int9_1_interp_mux, pahu_codec_enable_main_path,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_POST_PMD),
-
- WCD_DAPM_MUX("RX INT0_2 INTERP", 0, rx_int0_2_interp),
- WCD_DAPM_MUX("RX INT7_2 INTERP", 0, rx_int7_2_interp),
- WCD_DAPM_MUX("RX INT8_2 INTERP", 0, rx_int8_2_interp),
- WCD_DAPM_MUX("RX INT9_2 INTERP", 0, rx_int9_2_interp),
-
- SND_SOC_DAPM_SWITCH("ADC US MUX0", WCD9360_CDC_TX0_TX_PATH_192_CTL, 0,
- 0, &adc_us_mux0_switch),
- SND_SOC_DAPM_SWITCH("ADC US MUX1", WCD9360_CDC_TX1_TX_PATH_192_CTL, 0,
- 0, &adc_us_mux1_switch),
- SND_SOC_DAPM_SWITCH("ADC US MUX2", WCD9360_CDC_TX2_TX_PATH_192_CTL, 0,
- 0, &adc_us_mux2_switch),
- SND_SOC_DAPM_SWITCH("ADC US MUX3", WCD9360_CDC_TX3_TX_PATH_192_CTL, 0,
- 0, &adc_us_mux3_switch),
- SND_SOC_DAPM_SWITCH("ADC US MUX4", WCD9360_CDC_TX4_TX_PATH_192_CTL, 0,
- 0, &adc_us_mux4_switch),
- SND_SOC_DAPM_SWITCH("ADC US MUX5", WCD9360_CDC_TX5_TX_PATH_192_CTL, 0,
- 0, &adc_us_mux5_switch),
- SND_SOC_DAPM_SWITCH("ADC US MUX6", WCD9360_CDC_TX6_TX_PATH_192_CTL, 0,
- 0, &adc_us_mux6_switch),
- SND_SOC_DAPM_SWITCH("ADC US MUX7", WCD9360_CDC_TX7_TX_PATH_192_CTL, 0,
- 0, &adc_us_mux7_switch),
- SND_SOC_DAPM_SWITCH("ADC US MUX8", WCD9360_CDC_TX8_TX_PATH_192_CTL, 0,
- 0, &adc_us_mux8_switch),
-
- /* MAD related widgets */
- SND_SOC_DAPM_INPUT("MAD_CPE_INPUT"),
- SND_SOC_DAPM_INPUT("MADINPUT"),
-
- WCD_DAPM_MUX("MAD_SEL MUX", 0, mad_sel),
- WCD_DAPM_MUX("MAD_INP MUX", 0, mad_inp_mux),
-
- SND_SOC_DAPM_SWITCH_E("MAD_BROADCAST", SND_SOC_NOPM, 0, 0,
- &mad_brdcst_switch, pahu_codec_ape_enable_mad,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD),
-
- SND_SOC_DAPM_SWITCH_E("MAD_CPE1", SND_SOC_NOPM, 0, 0,
- &mad_cpe1_switch, pahu_codec_cpe_mad_ctl,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD),
- SND_SOC_DAPM_SWITCH_E("MAD_CPE2", SND_SOC_NOPM, 0, 0,
- &mad_cpe2_switch, pahu_codec_cpe_mad_ctl,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD),
-
- SND_SOC_DAPM_OUTPUT("MAD_CPE_OUT1"),
- SND_SOC_DAPM_OUTPUT("MAD_CPE_OUT2"),
-
- SND_SOC_DAPM_DAC_E("RX INT0 DAC", NULL, SND_SOC_NOPM,
- 0, 0, pahu_codec_ear_dac_event, SND_SOC_DAPM_PRE_PMU),
-
- SND_SOC_DAPM_PGA_E("EAR PA", WCD9360_ANA_EAR, 7, 0, NULL, 0,
- pahu_codec_enable_ear_pa,
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_PGA_E("ANC EAR PA", WCD9360_ANA_EAR, 7, 0, NULL, 0,
- pahu_codec_enable_ear_pa, SND_SOC_DAPM_POST_PMU |
- SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_PGA_E("ANC SPK1 PA", SND_SOC_NOPM, 0, 0, NULL, 0,
- pahu_codec_enable_spkr_anc,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_OUTPUT("EAR"),
- SND_SOC_DAPM_OUTPUT("SPK1 OUT"),
- SND_SOC_DAPM_OUTPUT("SPK2 OUT"),
- SND_SOC_DAPM_OUTPUT("ANC EAR"),
-
- SND_SOC_DAPM_SWITCH("ANC OUT EAR Enable", SND_SOC_NOPM, 0, 0,
- &anc_ear_switch),
- SND_SOC_DAPM_SWITCH("ANC OUT EAR SPKR Enable", SND_SOC_NOPM, 0, 0,
- &anc_ear_spkr_switch),
- SND_SOC_DAPM_SWITCH("ANC SPKR PA Enable", SND_SOC_NOPM, 0, 0,
- &anc_spkr_pa_switch),
-
- SND_SOC_DAPM_DAC("RX INT9 DAC", NULL, SND_SOC_NOPM, 0, 0),
- SND_SOC_DAPM_PGA_E("AUX PA", WCD9360_AUX_ANA_EAR, 7, 0, NULL, 0,
- pahu_codec_enable_aux_pa, SND_SOC_DAPM_POST_PMU),
- SND_SOC_DAPM_OUTPUT("AUX"),
-
-
- SND_SOC_DAPM_SUPPLY("LDO_RXTX", SND_SOC_NOPM, 0, 0,
- pahu_codec_enable_ldo_rxtx,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_SUPPLY("RX INT7 NATIVE SUPPLY", SND_SOC_NOPM,
- INTERP_SPKR1, 0, pahu_enable_native_supply,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD),
- SND_SOC_DAPM_SUPPLY("RX INT8 NATIVE SUPPLY", SND_SOC_NOPM,
- INTERP_SPKR2, 0, pahu_enable_native_supply,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD),
-
- WCD_DAPM_MUX("RX INT7_2 NATIVE MUX", 0, int7_2_native),
- WCD_DAPM_MUX("RX INT8_2 NATIVE MUX", 0, int8_2_native),
-
- SND_SOC_DAPM_MUX_E("ASRC2 MUX", SND_SOC_NOPM, ASRC2, 0,
- &asrc2_mux, pahu_codec_enable_asrc_resampler,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MUX_E("ASRC3 MUX", SND_SOC_NOPM, ASRC3, 0,
- &asrc3_mux, pahu_codec_enable_asrc_resampler,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
-
- /* WDMA3 widgets */
- WCD_DAPM_MUX("WDMA3 PORT0 MUX", 0, wdma3_port0),
- WCD_DAPM_MUX("WDMA3 PORT1 MUX", 1, wdma3_port1),
- WCD_DAPM_MUX("WDMA3 PORT2 MUX", 2, wdma3_port2),
- WCD_DAPM_MUX("WDMA3 PORT3 MUX", 3, wdma3_port3),
- WCD_DAPM_MUX("WDMA3 PORT4 MUX", 4, wdma3_port4),
- WCD_DAPM_MUX("WDMA3 PORT5 MUX", 5, wdma3_port5),
- WCD_DAPM_MUX("WDMA3 PORT6 MUX", 6, wdma3_port6),
-
- WCD_DAPM_MUX("WDMA3 CH0 MUX", 0, wdma3_ch0),
- WCD_DAPM_MUX("WDMA3 CH1 MUX", 4, wdma3_ch1),
- WCD_DAPM_MUX("WDMA3 CH2 MUX", 0, wdma3_ch2),
- WCD_DAPM_MUX("WDMA3 CH3 MUX", 4, wdma3_ch3),
-
- SND_SOC_DAPM_MIXER("WDMA3_CH_MIXER", SND_SOC_NOPM, 0, 0, NULL, 0),
-
- SND_SOC_DAPM_SWITCH_E("WDMA3_ON_OFF", SND_SOC_NOPM, 0, 0,
- &wdma3_onoff_switch, pahu_codec_wdma3_ctl,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_OUTPUT("WDMA3_OUT"),
-};
-
-static int pahu_get_channel_map(struct snd_soc_dai *dai,
- unsigned int *tx_num, unsigned int *tx_slot,
- unsigned int *rx_num, unsigned int *rx_slot)
-{
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(dai->codec);
- u32 i = 0;
- struct wcd9xxx_ch *ch;
- int ret = 0;
-
- switch (dai->id) {
- case AIF1_PB:
- case AIF2_PB:
- case AIF3_PB:
- case AIF4_PB:
- if (!rx_slot || !rx_num) {
- dev_err(pahu->dev, "%s: Invalid rx_slot 0x%pK or rx_num 0x%pK\n",
- __func__, rx_slot, rx_num);
- ret = -EINVAL;
- break;
- }
- list_for_each_entry(ch, &pahu->dai[dai->id].wcd9xxx_ch_list,
- list) {
- dev_dbg(pahu->dev, "%s: slot_num %u ch->ch_num %d\n",
- __func__, i, ch->ch_num);
- rx_slot[i++] = ch->ch_num;
- }
- *rx_num = i;
- dev_dbg(pahu->dev, "%s: dai_name = %s dai_id = %x rx_num = %d\n",
- __func__, dai->name, dai->id, i);
- if (*rx_num == 0) {
- dev_err(pahu->dev, "%s: Channel list empty for dai_name = %s dai_id = %x\n",
- __func__, dai->name, dai->id);
- ret = -EINVAL;
- }
- break;
- case AIF1_CAP:
- case AIF2_CAP:
- case AIF3_CAP:
- case AIF4_MAD_TX:
- case AIF4_VIFEED:
- if (!tx_slot || !tx_num) {
- dev_err(pahu->dev, "%s: Invalid tx_slot 0x%pK or tx_num 0x%pK\n",
- __func__, tx_slot, tx_num);
- ret = -EINVAL;
- break;
- }
- list_for_each_entry(ch, &pahu->dai[dai->id].wcd9xxx_ch_list,
- list) {
- dev_dbg(pahu->dev, "%s: slot_num %u ch->ch_num %d\n",
- __func__, i, ch->ch_num);
- tx_slot[i++] = ch->ch_num;
- }
- *tx_num = i;
- dev_dbg(pahu->dev, "%s: dai_name = %s dai_id = %x tx_num = %d\n",
- __func__, dai->name, dai->id, i);
- if (*tx_num == 0) {
- dev_err(pahu->dev, "%s: Channel list empty for dai_name = %s dai_id = %x\n",
- __func__, dai->name, dai->id);
- ret = -EINVAL;
- }
- break;
- default:
- dev_err(pahu->dev, "%s: Invalid DAI ID %x\n",
- __func__, dai->id);
- ret = -EINVAL;
- break;
- }
-
- return ret;
-}
-
-static int pahu_set_channel_map(struct snd_soc_dai *dai,
- unsigned int tx_num, unsigned int *tx_slot,
- unsigned int rx_num, unsigned int *rx_slot)
-{
- struct pahu_priv *pahu;
- struct wcd9xxx *core;
- struct wcd9xxx_codec_dai_data *dai_data = NULL;
-
- pahu = snd_soc_codec_get_drvdata(dai->codec);
- core = dev_get_drvdata(dai->codec->dev->parent);
-
- if (!tx_slot || !rx_slot) {
- dev_err(pahu->dev, "%s: Invalid tx_slot 0x%pK, rx_slot 0x%pK\n",
- __func__, tx_slot, rx_slot);
- return -EINVAL;
- }
- dev_dbg(pahu->dev, "%s(): dai_name = %s DAI-ID %x tx_ch %d rx_ch %d\n",
- __func__, dai->name, dai->id, tx_num, rx_num);
-
- wcd9xxx_init_slimslave(core, core->slim->laddr,
- tx_num, tx_slot, rx_num, rx_slot);
- /* Reserve TX13 for MAD data channel */
- dai_data = &pahu->dai[AIF4_MAD_TX];
- if (dai_data)
- list_add_tail(&core->tx_chs[WCD9360_TX13].list,
- &dai_data->wcd9xxx_ch_list);
-
- return 0;
-}
-
-static int pahu_startup(struct snd_pcm_substream *substream,
- struct snd_soc_dai *dai)
-{
- pr_debug("%s(): substream = %s stream = %d\n", __func__,
- substream->name, substream->stream);
-
- return 0;
-}
-
-static void pahu_shutdown(struct snd_pcm_substream *substream,
- struct snd_soc_dai *dai)
-{
- pr_debug("%s(): substream = %s stream = %d\n", __func__,
- substream->name, substream->stream);
-}
-
-static int pahu_set_decimator_rate(struct snd_soc_dai *dai,
- u32 sample_rate)
-{
- struct snd_soc_codec *codec = dai->codec;
- struct wcd9xxx_ch *ch;
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
- u32 tx_port = 0, tx_fs_rate = 0;
- u8 shift = 0, shift_val = 0, tx_mux_sel = 0;
- int decimator = -1;
- u16 tx_port_reg = 0, tx_fs_reg = 0;
-
- switch (sample_rate) {
- case 8000:
- tx_fs_rate = 0;
- break;
- case 16000:
- tx_fs_rate = 1;
- break;
- case 32000:
- tx_fs_rate = 3;
- break;
- case 48000:
- tx_fs_rate = 4;
- break;
- case 96000:
- tx_fs_rate = 5;
- break;
- case 192000:
- tx_fs_rate = 6;
- break;
- default:
- dev_err(pahu->dev, "%s: Invalid TX sample rate: %d\n",
- __func__, sample_rate);
- return -EINVAL;
-
- };
-
- list_for_each_entry(ch, &pahu->dai[dai->id].wcd9xxx_ch_list, list) {
- tx_port = ch->port;
- dev_dbg(codec->dev, "%s: dai->id = %d, tx_port = %d",
- __func__, dai->id, tx_port);
-
- if ((tx_port < 0) || (tx_port == 12) || (tx_port >= 14)) {
- dev_err(codec->dev, "%s: Invalid SLIM TX%u port. DAI ID: %d\n",
- __func__, tx_port, dai->id);
- return -EINVAL;
- }
- /* Find the SB TX MUX input - which decimator is connected */
- if (tx_port < 4) {
- tx_port_reg = WCD9360_CDC_IF_ROUTER_TX_MUX_CFG0;
- shift = (tx_port << 1);
- shift_val = 0x03;
- } else if ((tx_port >= 4) && (tx_port < 8)) {
- tx_port_reg = WCD9360_CDC_IF_ROUTER_TX_MUX_CFG1;
- shift = ((tx_port - 4) << 1);
- shift_val = 0x03;
- } else if ((tx_port >= 8) && (tx_port < 11)) {
- tx_port_reg = WCD9360_CDC_IF_ROUTER_TX_MUX_CFG2;
- shift = ((tx_port - 8) << 1);
- shift_val = 0x03;
- } else if (tx_port == 11) {
- tx_port_reg = WCD9360_CDC_IF_ROUTER_TX_MUX_CFG3;
- shift = 0;
- shift_val = 0x0F;
- } else if (tx_port == 13) {
- tx_port_reg = WCD9360_CDC_IF_ROUTER_TX_MUX_CFG3;
- shift = 4;
- shift_val = 0x03;
- }
- tx_mux_sel = snd_soc_read(codec, tx_port_reg) &
- (shift_val << shift);
- tx_mux_sel = tx_mux_sel >> shift;
-
- if (tx_port <= 8) {
- if ((tx_mux_sel == 0x2) || (tx_mux_sel == 0x3))
- decimator = tx_port;
- } else if (tx_port <= 10) {
- if ((tx_mux_sel == 0x1) || (tx_mux_sel == 0x2))
- decimator = ((tx_port == 9) ? 7 : 6);
- } else if (tx_port == 11) {
- if ((tx_mux_sel >= 1) && (tx_mux_sel < 7))
- decimator = tx_mux_sel - 1;
- } else if (tx_port == 13) {
- if ((tx_mux_sel == 0x1) || (tx_mux_sel == 0x2))
- decimator = 5;
- }
-
- if (decimator >= 0) {
- tx_fs_reg = WCD9360_CDC_TX0_TX_PATH_CTL +
- 16 * decimator;
- dev_dbg(codec->dev, "%s: set DEC%u (-> SLIM_TX%u) rate to %u\n",
- __func__, decimator, tx_port, sample_rate);
- snd_soc_update_bits(codec, tx_fs_reg, 0x0F, tx_fs_rate);
- } else if ((tx_port <= 8) && (tx_mux_sel == 0x01)) {
- /* Check if the TX Mux input is RX MIX TXn */
- dev_dbg(codec->dev, "%s: RX_MIX_TX%u going to CDC_IF TX%u\n",
- __func__, tx_port, tx_port);
- } else {
- dev_err(codec->dev, "%s: ERROR: Invalid decimator: %d\n",
- __func__, decimator);
- return -EINVAL;
- }
- }
- return 0;
-}
-
-static int pahu_set_mix_interpolator_rate(struct snd_soc_dai *dai,
- u8 rate_reg_val,
- u32 sample_rate)
-{
- u8 int_2_inp;
- u32 j;
- u16 int_mux_cfg1, int_fs_reg;
- u8 int_mux_cfg1_val;
- struct snd_soc_codec *codec = dai->codec;
- struct wcd9xxx_ch *ch;
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
-
- list_for_each_entry(ch, &pahu->dai[dai->id].wcd9xxx_ch_list, list) {
- int_2_inp = INTn_2_INP_SEL_RX0 + ch->port -
- WCD9360_RX_PORT_START_NUMBER;
- if ((int_2_inp < INTn_2_INP_SEL_RX0) ||
- (int_2_inp > INTn_2_INP_SEL_RX7)) {
- dev_err(codec->dev, "%s: Invalid RX%u port, Dai ID is %d\n",
- __func__,
- (ch->port - WCD9360_RX_PORT_START_NUMBER),
- dai->id);
- return -EINVAL;
- }
-
- for (j = 0; j < WCD9360_NUM_INTERPOLATORS; j++) {
- if (j == INTERP_EAR) {
- int_mux_cfg1 =
- WCD9360_CDC_RX_INP_MUX_RX_INT0_CFG1;
- int_fs_reg = WCD9360_CDC_RX0_RX_PATH_MIX_CTL;
- } else if (j == INTERP_SPKR1) {
- int_mux_cfg1 =
- WCD9360_CDC_RX_INP_MUX_RX_INT7_CFG1;
- int_fs_reg = WCD9360_CDC_RX7_RX_PATH_MIX_CTL;
- } else if (j == INTERP_SPKR2) {
- int_mux_cfg1 =
- WCD9360_CDC_RX_INP_MUX_RX_INT8_CFG1;
- int_fs_reg = WCD9360_CDC_RX8_RX_PATH_MIX_CTL;
- } else if (j == INTERP_AUX) {
- int_mux_cfg1 =
- WCD9360_CDC_RX_INP_MUX_RX_INT9_CFG1;
- int_fs_reg = WCD9360_CDC_RX9_RX_PATH_MIX_CTL;
- } else {
- continue;
- }
-
- int_mux_cfg1_val = snd_soc_read(codec, int_mux_cfg1) &
- 0x0F;
- if (int_mux_cfg1_val == int_2_inp) {
- /*
- * Ear mix path supports only 48, 96, 192,
- * 384KHz only
- */
- if ((j == INTERP_EAR || j == INTERP_AUX) &&
- (rate_reg_val < 0x4 || rate_reg_val > 0x7)) {
- dev_err_ratelimited(codec->dev,
- "%s: Invalid rate for AIF_PB DAI(%d)\n",
- __func__, dai->id);
- return -EINVAL;
- }
-
- dev_dbg(codec->dev, "%s: AIF_PB DAI(%d) connected to INT%u_2\n",
- __func__, dai->id, j);
- dev_dbg(codec->dev, "%s: set INT%u_2 sample rate to %u\n",
- __func__, j, sample_rate);
- snd_soc_update_bits(codec, int_fs_reg, 0x0F,
- rate_reg_val);
- }
- }
- }
- return 0;
-}
-
-static int pahu_set_prim_interpolator_rate(struct snd_soc_dai *dai,
- u8 rate_reg_val,
- u32 sample_rate)
-{
- u8 int_1_mix1_inp;
- u32 j;
- u16 int_mux_cfg0, int_mux_cfg1;
- u16 int_fs_reg;
- u8 int_mux_cfg0_val, int_mux_cfg1_val;
- u8 inp0_sel, inp1_sel, inp2_sel;
- struct snd_soc_codec *codec = dai->codec;
- struct wcd9xxx_ch *ch;
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
-
- list_for_each_entry(ch, &pahu->dai[dai->id].wcd9xxx_ch_list, list) {
- int_1_mix1_inp = INTn_1_INP_SEL_RX0 + ch->port -
- WCD9360_RX_PORT_START_NUMBER;
- if ((int_1_mix1_inp < INTn_1_INP_SEL_RX0) ||
- (int_1_mix1_inp > INTn_1_INP_SEL_RX7)) {
- dev_err(codec->dev, "%s: Invalid RX%u port, Dai ID is %d\n",
- __func__,
- (ch->port - WCD9360_RX_PORT_START_NUMBER),
- dai->id);
- return -EINVAL;
- }
-
- /*
- * Loop through all interpolator MUX inputs and find out
- * to which interpolator input, the slim rx port
- * is connected
- */
- for (j = 0; j < WCD9360_NUM_INTERPOLATORS; j++) {
- if (j == INTERP_EAR) {
- int_mux_cfg0 =
- WCD9360_CDC_RX_INP_MUX_RX_INT0_CFG0;
- int_fs_reg = WCD9360_CDC_RX0_RX_PATH_CTL;
- } else if (j == INTERP_SPKR1) {
- int_mux_cfg0 =
- WCD9360_CDC_RX_INP_MUX_RX_INT7_CFG0;
- int_fs_reg = WCD9360_CDC_RX7_RX_PATH_CTL;
- } else if (j == INTERP_SPKR2) {
- int_mux_cfg0 =
- WCD9360_CDC_RX_INP_MUX_RX_INT8_CFG0;
- int_fs_reg = WCD9360_CDC_RX8_RX_PATH_CTL;
- } else if (j == INTERP_AUX) {
- int_mux_cfg0 =
- WCD9360_CDC_RX_INP_MUX_RX_INT9_CFG0;
- int_fs_reg = WCD9360_CDC_RX9_RX_PATH_CTL;
- } else {
- continue;
- }
- int_mux_cfg1 = int_mux_cfg0 + 1;
-
- int_mux_cfg0_val = snd_soc_read(codec, int_mux_cfg0);
- int_mux_cfg1_val = snd_soc_read(codec, int_mux_cfg1);
- inp0_sel = int_mux_cfg0_val & 0x0F;
- inp1_sel = (int_mux_cfg0_val >> 4) & 0x0F;
- inp2_sel = (int_mux_cfg1_val >> 4) & 0x0F;
- if ((inp0_sel == int_1_mix1_inp) ||
- (inp1_sel == int_1_mix1_inp) ||
- (inp2_sel == int_1_mix1_inp)) {
- /*
- * Primary path does not support
- * native sample rates
- */
- if (rate_reg_val > 0x7) {
- dev_err_ratelimited(codec->dev,
- "%s: Invalid rate for AIF_PB DAI(%d)\n",
- __func__, dai->id);
- return -EINVAL;
- }
- dev_dbg(codec->dev,
- "%s: AIF_PB DAI(%d) connected to INT%u_1\n",
- __func__, dai->id, j);
- dev_dbg(codec->dev,
- "%s: set INT%u_1 sample rate to %u\n",
- __func__, j, sample_rate);
- snd_soc_update_bits(codec, int_fs_reg, 0x0F,
- rate_reg_val);
- }
- int_mux_cfg0 += 2;
- }
- }
-
- return 0;
-}
-
-
-static int pahu_set_interpolator_rate(struct snd_soc_dai *dai,
- u32 sample_rate)
-{
- struct snd_soc_codec *codec = dai->codec;
- int rate_val = 0;
- int i, ret;
-
- for (i = 0; i < ARRAY_SIZE(sr_val_tbl); i++) {
- if (sample_rate == sr_val_tbl[i].sample_rate) {
- rate_val = sr_val_tbl[i].rate_val;
- break;
- }
- }
- if ((i == ARRAY_SIZE(sr_val_tbl)) || (rate_val < 0)) {
- dev_err(codec->dev, "%s: Unsupported sample rate: %d\n",
- __func__, sample_rate);
- return -EINVAL;
- }
-
- ret = pahu_set_prim_interpolator_rate(dai, (u8)rate_val, sample_rate);
- if (ret)
- return ret;
- ret = pahu_set_mix_interpolator_rate(dai, (u8)rate_val, sample_rate);
- if (ret)
- return ret;
-
- return ret;
-}
-
-static int pahu_prepare(struct snd_pcm_substream *substream,
- struct snd_soc_dai *dai)
-{
- pr_debug("%s(): substream = %s stream = %d\n", __func__,
- substream->name, substream->stream);
- return 0;
-}
-
-static int pahu_vi_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params,
- struct snd_soc_dai *dai)
-{
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(dai->codec);
-
- dev_dbg(pahu->dev, "%s: dai_name = %s DAI-ID %x rate %d num_ch %d\n",
- __func__, dai->name, dai->id, params_rate(params),
- params_channels(params));
-
- pahu->dai[dai->id].rate = params_rate(params);
- pahu->dai[dai->id].bit_width = 32;
-
- return 0;
-}
-
-static int pahu_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params,
- struct snd_soc_dai *dai)
-{
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(dai->codec);
- int ret = 0;
-
- dev_dbg(pahu->dev, "%s: dai_name = %s DAI-ID %x rate %d num_ch %d\n",
- __func__, dai->name, dai->id, params_rate(params),
- params_channels(params));
-
- switch (substream->stream) {
- case SNDRV_PCM_STREAM_PLAYBACK:
- ret = pahu_set_interpolator_rate(dai, params_rate(params));
- if (ret) {
- dev_err(pahu->dev, "%s: cannot set sample rate: %u\n",
- __func__, params_rate(params));
- return ret;
- }
- switch (params_width(params)) {
- case 16:
- pahu->dai[dai->id].bit_width = 16;
- break;
- case 24:
- pahu->dai[dai->id].bit_width = 24;
- break;
- case 32:
- pahu->dai[dai->id].bit_width = 32;
- break;
- default:
- return -EINVAL;
- }
- pahu->dai[dai->id].rate = params_rate(params);
- break;
- case SNDRV_PCM_STREAM_CAPTURE:
- if (dai->id != AIF4_MAD_TX)
- ret = pahu_set_decimator_rate(dai,
- params_rate(params));
- if (ret) {
- dev_err(pahu->dev, "%s: cannot set TX Decimator rate: %d\n",
- __func__, ret);
- return ret;
- }
- switch (params_width(params)) {
- case 16:
- pahu->dai[dai->id].bit_width = 16;
- break;
- case 24:
- pahu->dai[dai->id].bit_width = 24;
- break;
- default:
- dev_err(pahu->dev, "%s: Invalid format 0x%x\n",
- __func__, params_width(params));
- return -EINVAL;
- };
- pahu->dai[dai->id].rate = params_rate(params);
- break;
- default:
- dev_err(pahu->dev, "%s: Invalid stream type %d\n", __func__,
- substream->stream);
- return -EINVAL;
- };
-
- return 0;
-}
-
-static int pahu_i2s_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params,
- struct snd_soc_dai *dai)
-{
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(dai->codec);
-
- dev_dbg(dai->dev, "%s: dai_name = %s DAI-ID %x rate %d num_ch %d\n",
- __func__, dai->name, dai->id, params_rate(params),
- params_channels(params));
-
- pahu->dai[dai->id].rate = params_rate(params);
- pahu->dai[dai->id].bit_width = params_width(params);
-
- return 0;
-}
-
-static struct snd_soc_dai_ops pahu_dai_ops = {
- .startup = pahu_startup,
- .shutdown = pahu_shutdown,
- .hw_params = pahu_hw_params,
- .prepare = pahu_prepare,
- .set_channel_map = pahu_set_channel_map,
- .get_channel_map = pahu_get_channel_map,
-};
-
-static struct snd_soc_dai_ops pahu_vi_dai_ops = {
- .hw_params = pahu_vi_hw_params,
- .set_channel_map = pahu_set_channel_map,
- .get_channel_map = pahu_get_channel_map,
-};
-
-static struct snd_soc_dai_ops pahu_i2s_dai_ops = {
- .hw_params = pahu_i2s_hw_params,
-};
-
-static struct snd_soc_dai_driver pahu_dai[] = {
- {
- .name = "pahu_rx1",
- .id = AIF1_PB,
- .playback = {
- .stream_name = "AIF1 Playback",
- .rates = WCD9360_RATES_MASK | WCD9360_FRAC_RATES_MASK,
- .formats = WCD9360_FORMATS_S16_S24_S32_LE,
- .rate_min = 8000,
- .rate_max = 384000,
- .channels_min = 1,
- .channels_max = 2,
- },
- .ops = &pahu_dai_ops,
- },
- {
- .name = "pahu_tx1",
- .id = AIF1_CAP,
- .capture = {
- .stream_name = "AIF1 Capture",
- .rates = WCD9360_RATES_MASK,
- .formats = WCD9360_FORMATS_S16_S24_LE,
- .rate_min = 8000,
- .rate_max = 192000,
- .channels_min = 1,
- .channels_max = 8,
- },
- .ops = &pahu_dai_ops,
- },
- {
- .name = "pahu_rx2",
- .id = AIF2_PB,
- .playback = {
- .stream_name = "AIF2 Playback",
- .rates = WCD9360_RATES_MASK | WCD9360_FRAC_RATES_MASK,
- .formats = WCD9360_FORMATS_S16_S24_S32_LE,
- .rate_min = 8000,
- .rate_max = 384000,
- .channels_min = 1,
- .channels_max = 2,
- },
- .ops = &pahu_dai_ops,
- },
- {
- .name = "pahu_tx2",
- .id = AIF2_CAP,
- .capture = {
- .stream_name = "AIF2 Capture",
- .rates = WCD9360_RATES_MASK,
- .formats = WCD9360_FORMATS_S16_S24_LE,
- .rate_min = 8000,
- .rate_max = 192000,
- .channels_min = 1,
- .channels_max = 8,
- },
- .ops = &pahu_dai_ops,
- },
- {
- .name = "pahu_rx3",
- .id = AIF3_PB,
- .playback = {
- .stream_name = "AIF3 Playback",
- .rates = WCD9360_RATES_MASK | WCD9360_FRAC_RATES_MASK,
- .formats = WCD9360_FORMATS_S16_S24_S32_LE,
- .rate_min = 8000,
- .rate_max = 384000,
- .channels_min = 1,
- .channels_max = 2,
- },
- .ops = &pahu_dai_ops,
- },
- {
- .name = "pahu_tx3",
- .id = AIF3_CAP,
- .capture = {
- .stream_name = "AIF3 Capture",
- .rates = WCD9360_RATES_MASK,
- .formats = WCD9360_FORMATS_S16_S24_LE,
- .rate_min = 8000,
- .rate_max = 192000,
- .channels_min = 1,
- .channels_max = 8,
- },
- .ops = &pahu_dai_ops,
- },
- {
- .name = "pahu_rx4",
- .id = AIF4_PB,
- .playback = {
- .stream_name = "AIF4 Playback",
- .rates = WCD9360_RATES_MASK | WCD9360_FRAC_RATES_MASK,
- .formats = WCD9360_FORMATS_S16_S24_S32_LE,
- .rate_min = 8000,
- .rate_max = 384000,
- .channels_min = 1,
- .channels_max = 2,
- },
- .ops = &pahu_dai_ops,
- },
- {
- .name = "pahu_vifeedback",
- .id = AIF4_VIFEED,
- .capture = {
- .stream_name = "VIfeed",
- .rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_48000,
- .formats = WCD9360_FORMATS_S16_S24_S32_LE,
- .rate_min = 8000,
- .rate_max = 48000,
- .channels_min = 1,
- .channels_max = 4,
- },
- .ops = &pahu_vi_dai_ops,
- },
- {
- .name = "pahu_mad1",
- .id = AIF4_MAD_TX,
- .capture = {
- .stream_name = "AIF4 MAD TX",
- .rates = SNDRV_PCM_RATE_16000,
- .formats = WCD9360_FORMATS_S16_LE,
- .rate_min = 16000,
- .rate_max = 16000,
- .channels_min = 1,
- .channels_max = 1,
- },
- .ops = &pahu_dai_ops,
- },
- {
- .name = "pahu_i2s1_rx",
- .id = I2S1_PB,
- .playback = {
- .stream_name = "I2S1 Playback",
- .rates = WCD9360_RATES_MASK | WCD9360_FRAC_RATES_MASK,
- .formats = WCD9360_FORMATS_S16_S24_S32_LE,
- .rate_min = 8000,
- .rate_max = 384000,
- .channels_min = 1,
- .channels_max = 2,
- },
- .ops = &pahu_i2s_dai_ops,
- },
- {
- .name = "pahu_i2s1_tx",
- .id = I2S1_CAP,
- .capture = {
- .stream_name = "I2S1 Capture",
- .rates = WCD9360_RATES_MASK | WCD9360_FRAC_RATES_MASK,
- .formats = WCD9360_FORMATS_S16_S24_S32_LE,
- .rate_min = 8000,
- .rate_max = 192000,
- .channels_min = 1,
- .channels_max = 2,
- },
- .ops = &pahu_i2s_dai_ops,
- },
-};
-
-static void pahu_codec_power_gate_digital_core(struct pahu_priv *pahu)
-{
- mutex_lock(&pahu->power_lock);
- dev_dbg(pahu->dev, "%s: Entering power gating function, %d\n",
- __func__, pahu->power_active_ref);
-
- if (pahu->power_active_ref > 0)
- goto exit;
-
- wcd9xxx_set_power_state(pahu->wcd9xxx,
- WCD_REGION_POWER_COLLAPSE_BEGIN,
- WCD9XXX_DIG_CORE_REGION_1);
- regmap_update_bits(pahu->wcd9xxx->regmap,
- WCD9360_CODEC_RPM_PWR_CDC_DIG_HM_CTL, 0x04, 0x04);
- regmap_update_bits(pahu->wcd9xxx->regmap,
- WCD9360_CODEC_RPM_PWR_CDC_DIG_HM_CTL, 0x01, 0x00);
- regmap_update_bits(pahu->wcd9xxx->regmap,
- WCD9360_CODEC_RPM_PWR_CDC_DIG_HM_CTL, 0x02, 0x00);
- wcd9xxx_set_power_state(pahu->wcd9xxx, WCD_REGION_POWER_DOWN,
- WCD9XXX_DIG_CORE_REGION_1);
-exit:
- dev_dbg(pahu->dev, "%s: Exiting power gating function, %d\n",
- __func__, pahu->power_active_ref);
- mutex_unlock(&pahu->power_lock);
-}
-
-static void pahu_codec_power_gate_work(struct work_struct *work)
-{
- struct pahu_priv *pahu;
- struct delayed_work *dwork;
-
- dwork = to_delayed_work(work);
- pahu = container_of(dwork, struct pahu_priv, power_gate_work);
-
- pahu_codec_power_gate_digital_core(pahu);
-}
-
-/* called under power_lock acquisition */
-static int pahu_dig_core_remove_power_collapse(struct pahu_priv *pahu)
-{
- regmap_write(pahu->wcd9xxx->regmap,
- WCD9360_CODEC_RPM_PWR_CDC_DIG_HM_CTL, 0x05);
- regmap_write(pahu->wcd9xxx->regmap,
- WCD9360_CODEC_RPM_PWR_CDC_DIG_HM_CTL, 0x07);
- regmap_update_bits(pahu->wcd9xxx->regmap,
- WCD9360_CODEC_RPM_RST_CTL, 0x02, 0x00);
- regmap_update_bits(pahu->wcd9xxx->regmap,
- WCD9360_CODEC_RPM_RST_CTL, 0x02, 0x02);
- regmap_write(pahu->wcd9xxx->regmap,
- WCD9360_CODEC_RPM_PWR_CDC_DIG_HM_CTL, 0x03);
-
- wcd9xxx_set_power_state(pahu->wcd9xxx,
- WCD_REGION_POWER_COLLAPSE_REMOVE,
- WCD9XXX_DIG_CORE_REGION_1);
- regcache_mark_dirty(pahu->wcd9xxx->regmap);
- regcache_sync_region(pahu->wcd9xxx->regmap,
- WCD9360_DIG_CORE_REG_MIN,
- WCD9360_DIG_CORE_REG_MAX);
- return 0;
-}
-
-static int pahu_dig_core_power_collapse(struct pahu_priv *pahu,
- int req_state)
-{
- int cur_state;
-
- /* Exit if feature is disabled */
- if (!dig_core_collapse_enable)
- return 0;
-
- mutex_lock(&pahu->power_lock);
- if (req_state == POWER_COLLAPSE)
- pahu->power_active_ref--;
- else if (req_state == POWER_RESUME)
- pahu->power_active_ref++;
- else
- goto unlock_mutex;
-
- if (pahu->power_active_ref < 0) {
- dev_dbg(pahu->dev, "%s: power_active_ref is negative\n",
- __func__);
- goto unlock_mutex;
- }
-
- if (req_state == POWER_COLLAPSE) {
- if (pahu->power_active_ref == 0) {
- schedule_delayed_work(&pahu->power_gate_work,
- msecs_to_jiffies(dig_core_collapse_timer * 1000));
- }
- } else if (req_state == POWER_RESUME) {
- if (pahu->power_active_ref == 1) {
- /*
- * At this point, there can be two cases:
- * 1. Core already in power collapse state
- * 2. Timer kicked in and still did not expire or
- * waiting for the power_lock
- */
- cur_state = wcd9xxx_get_current_power_state(
- pahu->wcd9xxx,
- WCD9XXX_DIG_CORE_REGION_1);
- if (cur_state == WCD_REGION_POWER_DOWN) {
- pahu_dig_core_remove_power_collapse(pahu);
- } else {
- mutex_unlock(&pahu->power_lock);
- cancel_delayed_work_sync(
- &pahu->power_gate_work);
- mutex_lock(&pahu->power_lock);
- }
- }
- }
-
-unlock_mutex:
- mutex_unlock(&pahu->power_lock);
-
- return 0;
-}
-
-static int pahu_cdc_req_mclk_enable(struct pahu_priv *pahu,
- bool enable)
-{
- int ret = 0;
-
- if (enable) {
- ret = clk_prepare_enable(pahu->wcd_ext_clk);
- if (ret) {
- dev_err(pahu->dev, "%s: ext clk enable failed\n",
- __func__);
- goto done;
- }
- /* get BG */
- wcd_resmgr_enable_master_bias(pahu->resmgr);
- /* get MCLK */
- wcd_resmgr_enable_clk_block(pahu->resmgr, WCD_CLK_MCLK);
- } else {
- /* put MCLK */
- wcd_resmgr_disable_clk_block(pahu->resmgr, WCD_CLK_MCLK);
- /* put BG */
- wcd_resmgr_disable_master_bias(pahu->resmgr);
- clk_disable_unprepare(pahu->wcd_ext_clk);
- }
-
-done:
- return ret;
-}
-
-static int __pahu_cdc_mclk_enable_locked(struct pahu_priv *pahu,
- bool enable)
-{
- int ret = 0;
-
- if (!pahu->wcd_ext_clk) {
- dev_err(pahu->dev, "%s: wcd ext clock is NULL\n", __func__);
- return -EINVAL;
- }
-
- dev_dbg(pahu->dev, "%s: mclk_enable = %u\n", __func__, enable);
-
- if (enable) {
- pahu_dig_core_power_collapse(pahu, POWER_RESUME);
- pahu_vote_svs(pahu, true);
- ret = pahu_cdc_req_mclk_enable(pahu, true);
- if (ret)
- goto done;
- } else {
- pahu_cdc_req_mclk_enable(pahu, false);
- pahu_vote_svs(pahu, false);
- pahu_dig_core_power_collapse(pahu, POWER_COLLAPSE);
- }
-
-done:
- return ret;
-}
-
-static int __pahu_cdc_mclk_enable(struct pahu_priv *pahu,
- bool enable)
-{
- int ret;
-
- WCD9XXX_V2_BG_CLK_LOCK(pahu->resmgr);
- ret = __pahu_cdc_mclk_enable_locked(pahu, enable);
- if (enable)
- wcd_resmgr_set_sido_input_src(pahu->resmgr,
- SIDO_SOURCE_RCO_BG);
- WCD9XXX_V2_BG_CLK_UNLOCK(pahu->resmgr);
-
- return ret;
-}
-
-static ssize_t pahu_codec_version_read(struct snd_info_entry *entry,
- void *file_private_data,
- struct file *file,
- char __user *buf, size_t count,
- loff_t pos)
-{
- struct pahu_priv *pahu;
- struct wcd9xxx *wcd9xxx;
- char buffer[PAHU_VERSION_ENTRY_SIZE];
- int len = 0;
-
- pahu = (struct pahu_priv *) entry->private_data;
- if (!pahu) {
- pr_err("%s: pahu priv is null\n", __func__);
- return -EINVAL;
- }
-
- wcd9xxx = pahu->wcd9xxx;
-
- switch (wcd9xxx->version) {
- case PAHU_VERSION_1_0:
- len = snprintf(buffer, sizeof(buffer), "WCD9360_1_0\n");
- break;
- default:
- len = snprintf(buffer, sizeof(buffer), "VER_UNDEFINED\n");
- }
-
- return simple_read_from_buffer(buf, count, &pos, buffer, len);
-}
-
-static struct snd_info_entry_ops pahu_codec_info_ops = {
- .read = pahu_codec_version_read,
-};
-
-/*
- * pahu_codec_info_create_codec_entry - creates wcd9360 module
- * @codec_root: The parent directory
- * @codec: Codec instance
- *
- * Creates wcd9360 module and version entry under the given
- * parent directory.
- *
- * Return: 0 on success or negative error code on failure.
- */
-int pahu_codec_info_create_codec_entry(struct snd_info_entry *codec_root,
- struct snd_soc_codec *codec)
-{
- struct snd_info_entry *version_entry;
- struct pahu_priv *pahu;
- struct snd_soc_card *card;
-
- if (!codec_root || !codec)
- return -EINVAL;
-
- pahu = snd_soc_codec_get_drvdata(codec);
- card = codec->component.card;
- pahu->entry = snd_info_create_subdir(codec_root->module,
- "pahu", codec_root);
- if (!pahu->entry) {
- dev_dbg(codec->dev, "%s: failed to create wcd9360 entry\n",
- __func__);
- return -ENOMEM;
- }
-
- version_entry = snd_info_create_card_entry(card->snd_card,
- "version",
- pahu->entry);
- if (!version_entry) {
- dev_dbg(codec->dev, "%s: failed to create wcd9360 version entry\n",
- __func__);
- return -ENOMEM;
- }
-
- version_entry->private_data = pahu;
- version_entry->size = PAHU_VERSION_ENTRY_SIZE;
- version_entry->content = SNDRV_INFO_CONTENT_DATA;
- version_entry->c.ops = &pahu_codec_info_ops;
-
- if (snd_info_register(version_entry) < 0) {
- snd_info_free_entry(version_entry);
- return -ENOMEM;
- }
- pahu->version_entry = version_entry;
-
- return 0;
-}
-EXPORT_SYMBOL(pahu_codec_info_create_codec_entry);
-
-/**
- * pahu_cdc_mclk_enable - Enable/disable codec mclk
- *
- * @codec: codec instance
- * @enable: Indicates clk enable or disable
- *
- * Returns 0 on Success and error on failure
- */
-int pahu_cdc_mclk_enable(struct snd_soc_codec *codec, bool enable)
-{
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
-
- return __pahu_cdc_mclk_enable(pahu, enable);
-}
-EXPORT_SYMBOL(pahu_cdc_mclk_enable);
-
-static int __pahu_codec_internal_rco_ctrl(struct snd_soc_codec *codec,
- bool enable)
-{
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
- int ret = 0;
-
- if (enable) {
- if (wcd_resmgr_get_clk_type(pahu->resmgr) ==
- WCD_CLK_RCO) {
- ret = wcd_resmgr_enable_clk_block(pahu->resmgr,
- WCD_CLK_RCO);
- } else {
- ret = pahu_cdc_req_mclk_enable(pahu, true);
- if (ret) {
- dev_err(codec->dev,
- "%s: mclk_enable failed, err = %d\n",
- __func__, ret);
- goto done;
- }
- wcd_resmgr_set_sido_input_src(pahu->resmgr,
- SIDO_SOURCE_RCO_BG);
- ret = wcd_resmgr_enable_clk_block(pahu->resmgr,
- WCD_CLK_RCO);
- ret |= pahu_cdc_req_mclk_enable(pahu, false);
- }
-
- } else {
- ret = wcd_resmgr_disable_clk_block(pahu->resmgr,
- WCD_CLK_RCO);
- }
-
- if (ret) {
- dev_err(codec->dev, "%s: Error in %s RCO\n",
- __func__, (enable ? "enabling" : "disabling"));
- ret = -EINVAL;
- }
-
-done:
- return ret;
-}
-
-/*
- * pahu_codec_internal_rco_ctrl: Enable/Disable codec's RCO clock
- * @codec: Handle to the codec
- * @enable: Indicates whether clock should be enabled or disabled
- */
-static int pahu_codec_internal_rco_ctrl(struct snd_soc_codec *codec,
- bool enable)
-{
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
- int ret = 0;
-
- WCD9XXX_V2_BG_CLK_LOCK(pahu->resmgr);
- ret = __pahu_codec_internal_rco_ctrl(codec, enable);
- WCD9XXX_V2_BG_CLK_UNLOCK(pahu->resmgr);
- return ret;
-}
-
-/*
- * pahu_cdc_mclk_tx_enable: Enable/Disable codec's clock for TX path
- * @codec: Handle to codec
- * @enable: Indicates whether clock should be enabled or disabled
- */
-int pahu_cdc_mclk_tx_enable(struct snd_soc_codec *codec, bool enable)
-{
- struct pahu_priv *pahu_p;
- int ret = 0;
- bool clk_mode;
- bool clk_internal;
-
- if (!codec)
- return -EINVAL;
-
- pahu_p = snd_soc_codec_get_drvdata(codec);
- clk_mode = test_bit(CLK_MODE, &pahu_p->status_mask);
- clk_internal = test_bit(CLK_INTERNAL, &pahu_p->status_mask);
-
- dev_dbg(codec->dev, "%s: clkmode: %d, enable: %d, clk_internal: %d\n",
- __func__, clk_mode, enable, clk_internal);
-
- if (clk_mode || clk_internal) {
- if (enable) {
- wcd_resmgr_enable_master_bias(pahu_p->resmgr);
- pahu_dig_core_power_collapse(pahu_p, POWER_RESUME);
- pahu_vote_svs(pahu_p, true);
- ret = pahu_codec_internal_rco_ctrl(codec, enable);
- set_bit(CLK_INTERNAL, &pahu_p->status_mask);
- } else {
- clear_bit(CLK_INTERNAL, &pahu_p->status_mask);
- pahu_codec_internal_rco_ctrl(codec, enable);
- pahu_vote_svs(pahu_p, false);
- pahu_dig_core_power_collapse(pahu_p, POWER_COLLAPSE);
- wcd_resmgr_disable_master_bias(pahu_p->resmgr);
- }
- } else {
- ret = __pahu_cdc_mclk_enable(pahu_p, enable);
- }
-
- return ret;
-}
-EXPORT_SYMBOL(pahu_cdc_mclk_tx_enable);
-
-static const struct wcd_resmgr_cb pahu_resmgr_cb = {
- .cdc_rco_ctrl = __pahu_codec_internal_rco_ctrl,
-};
-
-static const struct pahu_reg_mask_val pahu_codec_mclk2_1_0_defaults[] = {
- /*
- * PLL Settings:
- * Clock Root: MCLK2,
- * Clock Source: EXT_CLK,
- * Clock Destination: MCLK2
- * Clock Freq In: 19.2MHz,
- * Clock Freq Out: 11.2896MHz
- */
- {WCD9360_CLK_SYS_MCLK2_PRG1, 0x60, 0x20},
- {WCD9360_CLK_SYS_INT_POST_DIV_REG0, 0xFF, 0x5E},
- {WCD9360_CLK_SYS_INT_POST_DIV_REG1, 0x1F, 0x1F},
- {WCD9360_CLK_SYS_INT_REF_DIV_REG0, 0xFF, 0x54},
- {WCD9360_CLK_SYS_INT_REF_DIV_REG1, 0xFF, 0x01},
- {WCD9360_CLK_SYS_INT_FILTER_REG1, 0x07, 0x04},
- {WCD9360_CLK_SYS_INT_PLL_L_VAL, 0xFF, 0x93},
- {WCD9360_CLK_SYS_INT_PLL_N_VAL, 0xFF, 0xFA},
- {WCD9360_CLK_SYS_INT_TEST_REG0, 0xFF, 0x90},
- {WCD9360_CLK_SYS_INT_PFD_CP_DSM_PROG, 0xFF, 0x7E},
- {WCD9360_CLK_SYS_INT_VCO_PROG, 0xFF, 0xF8},
- {WCD9360_CLK_SYS_INT_TEST_REG1, 0xFF, 0x68},
- {WCD9360_CLK_SYS_INT_LDO_LOCK_CFG, 0xFF, 0x40},
- {WCD9360_CLK_SYS_INT_DIG_LOCK_DET_CFG, 0xFF, 0x32},
-};
-
-static const struct pahu_reg_mask_val pahu_codec_reg_defaults[] = {
- {WCD9360_BIAS_VBG_FINE_ADJ, 0xFF, 0x75},
- {WCD9360_CODEC_RPM_CLK_MCLK_CFG, 0x03, 0x01},
- {WCD9360_CODEC_CPR_SVS_CX_VDD, 0xFF, 0x7C}, /* value in svs mode */
- {WCD9360_CODEC_CPR_SVS2_CX_VDD, 0xFF, 0x58}, /* value in svs2 mode */
- {WCD9360_CDC_RX0_RX_PATH_DSMDEM_CTL, 0x01, 0x01},
- {WCD9360_CDC_RX7_RX_PATH_DSMDEM_CTL, 0x01, 0x01},
- {WCD9360_CDC_RX8_RX_PATH_DSMDEM_CTL, 0x01, 0x01},
- {WCD9360_CDC_RX9_RX_PATH_DSMDEM_CTL, 0x01, 0x01},
- {WCD9360_CDC_COMPANDER8_CTL7, 0x1E, 0x18},
- {WCD9360_CDC_COMPANDER7_CTL7, 0x1E, 0x18},
- {WCD9360_CDC_RX0_RX_PATH_SEC0, 0x08, 0x00},
- {WCD9360_CDC_RX9_RX_PATH_SEC0, 0x08, 0x00},
- {WCD9360_MICB1_TEST_CTL_2, 0x07, 0x01},
- {WCD9360_CDC_BOOST0_BOOST_CFG1, 0x3F, 0x12},
- {WCD9360_CDC_BOOST0_BOOST_CFG2, 0x1C, 0x08},
- {WCD9360_CDC_BOOST1_BOOST_CFG1, 0x3F, 0x12},
- {WCD9360_CDC_BOOST1_BOOST_CFG2, 0x1C, 0x08},
- {WCD9360_CPE_SS_CPARMAD_BUFRDY_INT_PERIOD, 0x1F, 0x09},
- {WCD9360_CDC_TX0_TX_PATH_CFG1, 0x01, 0x00},
- {WCD9360_CDC_TX1_TX_PATH_CFG1, 0x01, 0x00},
- {WCD9360_CDC_TX2_TX_PATH_CFG1, 0x01, 0x00},
- {WCD9360_CDC_TX3_TX_PATH_CFG1, 0x01, 0x00},
- {WCD9360_CDC_TX4_TX_PATH_CFG1, 0x01, 0x00},
- {WCD9360_CDC_TX5_TX_PATH_CFG1, 0x01, 0x00},
- {WCD9360_CDC_TX6_TX_PATH_CFG1, 0x01, 0x00},
- {WCD9360_CDC_TX7_TX_PATH_CFG1, 0x01, 0x00},
- {WCD9360_CDC_TX8_TX_PATH_CFG1, 0x01, 0x00},
- {WCD9360_CPE_FLL_CONFIG_CTL_2, 0xFF, 0x20},
- {WCD9360_CPE_SS_DMIC_CFG, 0x80, 0x00},
- {WCD9360_CDC_BOOST0_BOOST_CTL, 0x70, 0x50},
- {WCD9360_CDC_BOOST1_BOOST_CTL, 0x70, 0x50},
- {WCD9360_CDC_RX7_RX_PATH_CFG1, 0x08, 0x08},
- {WCD9360_CDC_RX8_RX_PATH_CFG1, 0x08, 0x08},
- {WCD9360_CDC_TOP_TOP_CFG1, 0x02, 0x02},
- {WCD9360_CDC_TOP_TOP_CFG1, 0x01, 0x01},
- {WCD9360_CDC_TOP_EAR_COMP_LUT, 0x80, 0x80},
- {WCD9360_EAR_EAR_DAC_CON, 0x06, 0x02},
- {WCD9360_AUX_INT_AUX_DAC_CON, 0x06, 0x02},
- {WCD9360_CDC_TX9_SPKR_PROT_PATH_CFG0, 0x01, 0x01},
- {WCD9360_CDC_TX10_SPKR_PROT_PATH_CFG0, 0x01, 0x01},
- {WCD9360_CDC_TX11_SPKR_PROT_PATH_CFG0, 0x01, 0x01},
- {WCD9360_CDC_TX12_SPKR_PROT_PATH_CFG0, 0x01, 0x01},
- {WCD9360_DATA_HUB_SB_TX11_INP_CFG, 0x01, 0x01},
- {WCD9360_CDC_CLK_RST_CTRL_FS_CNT_CONTROL, 0x01, 0x01},
- {WCD9360_CDC_COMPANDER7_CTL3, 0x80, 0x80},
- {WCD9360_CDC_COMPANDER8_CTL3, 0x80, 0x80},
- {WCD9360_CDC_COMPANDER7_CTL7, 0x01, 0x01},
- {WCD9360_CDC_COMPANDER8_CTL7, 0x01, 0x01},
- {WCD9360_CODEC_RPM_CLK_GATE, 0x08, 0x00},
- {WCD9360_CPE_SS_SVA_CFG, 0x60, 0x00},
- {WCD9360_CPE_SS_CPAR_CFG, 0x10, 0x10},
-};
-
-static const struct pahu_cpr_reg_defaults cpr_defaults[] = {
- { 0x00000820, 0x00000094 },
- { 0x00000fC0, 0x00000048 },
- { 0x0000f000, 0x00000044 },
- { 0x0000bb80, 0xC0000178 },
- { 0x00000000, 0x00000160 },
- { 0x10854522, 0x00000060 },
- { 0x10854509, 0x00000064 },
- { 0x108544dd, 0x00000068 },
- { 0x108544ad, 0x0000006C },
- { 0x0000077E, 0x00000070 },
- { 0x000007da, 0x00000074 },
- { 0x00000000, 0x00000078 },
- { 0x00000000, 0x0000007C },
- { 0x00042029, 0x00000080 },
- { 0x4002002A, 0x00000090 },
- { 0x4002002B, 0x00000090 },
-};
-
-static void pahu_update_reg_defaults(struct pahu_priv *pahu)
-{
- u32 i;
- struct wcd9xxx *wcd9xxx;
-
- wcd9xxx = pahu->wcd9xxx;
- for (i = 0; i < ARRAY_SIZE(pahu_codec_reg_defaults); i++)
- regmap_update_bits(wcd9xxx->regmap,
- pahu_codec_reg_defaults[i].reg,
- pahu_codec_reg_defaults[i].mask,
- pahu_codec_reg_defaults[i].val);
-}
-
-static void pahu_update_cpr_defaults(struct pahu_priv *pahu)
-{
- int i;
- struct wcd9xxx *wcd9xxx;
-
- wcd9xxx = pahu->wcd9xxx;
-
- __pahu_cdc_mclk_enable(pahu, true);
-
- regmap_update_bits(wcd9xxx->regmap, WCD9360_CODEC_RPM_CLK_GATE,
- 0x10, 0x00);
-
- for (i = 0; i < ARRAY_SIZE(cpr_defaults); i++) {
- regmap_bulk_write(wcd9xxx->regmap,
- WCD9360_CODEC_CPR_WR_DATA_0,
- (u8 *)&cpr_defaults[i].wr_data, 4);
- regmap_bulk_write(wcd9xxx->regmap,
- WCD9360_CODEC_CPR_WR_ADDR_0,
- (u8 *)&cpr_defaults[i].wr_addr, 4);
- }
-
- __pahu_cdc_mclk_enable(pahu, false);
-}
-
-static void pahu_slim_interface_init_reg(struct snd_soc_codec *codec)
-{
- int i;
- struct pahu_priv *priv = snd_soc_codec_get_drvdata(codec);
-
- for (i = 0; i < WCD9XXX_SLIM_NUM_PORT_REG; i++)
- wcd9xxx_interface_reg_write(priv->wcd9xxx,
- WCD9360_SLIM_PGD_PORT_INT_RX_EN0 + i,
- 0xFF);
-}
-
-static irqreturn_t pahu_misc_irq(int irq, void *data)
-{
- struct pahu_priv *pahu = data;
- int misc_val;
-
- /* Find source of interrupt */
- regmap_read(pahu->wcd9xxx->regmap, WCD9360_INTR_CODEC_MISC_STATUS,
- &misc_val);
-
- dev_dbg(pahu->dev, "%s: Codec misc irq: %d, val: 0x%x\n",
- __func__, irq, misc_val);
-
- /* Clear interrupt status */
- regmap_update_bits(pahu->wcd9xxx->regmap,
- WCD9360_INTR_CODEC_MISC_CLEAR, misc_val, 0x00);
-
- return IRQ_HANDLED;
-}
-
-static irqreturn_t pahu_slimbus_irq(int irq, void *data)
-{
- struct pahu_priv *pahu = data;
- unsigned long status = 0;
- int i, j, port_id, k;
- u32 bit;
- u8 val, int_val = 0;
- bool tx, cleared;
- unsigned short reg = 0;
-
- for (i = WCD9360_SLIM_PGD_PORT_INT_STATUS_RX_0, j = 0;
- i <= WCD9360_SLIM_PGD_PORT_INT_STATUS_TX_1; i++, j++) {
- val = wcd9xxx_interface_reg_read(pahu->wcd9xxx, i);
- status |= ((u32)val << (8 * j));
- }
-
- for_each_set_bit(j, &status, 32) {
- tx = (j >= 16 ? true : false);
- port_id = (tx ? j - 16 : j);
- val = wcd9xxx_interface_reg_read(pahu->wcd9xxx,
- WCD9360_SLIM_PGD_PORT_INT_RX_SOURCE0 + j);
- if (val) {
- if (!tx)
- reg = WCD9360_SLIM_PGD_PORT_INT_RX_EN0 +
- (port_id / 8);
- else
- reg = WCD9360_SLIM_PGD_PORT_INT_TX_EN0 +
- (port_id / 8);
- int_val = wcd9xxx_interface_reg_read(
- pahu->wcd9xxx, reg);
- /*
- * Ignore interrupts for ports for which the
- * interrupts are not specifically enabled.
- */
- if (!(int_val & (1 << (port_id % 8))))
- continue;
- }
- if (val & WCD9360_SLIM_IRQ_OVERFLOW)
- dev_err_ratelimited(pahu->dev, "%s: overflow error on %s port %d, value %x\n",
- __func__, (tx ? "TX" : "RX"), port_id, val);
- if (val & WCD9360_SLIM_IRQ_UNDERFLOW)
- dev_err_ratelimited(pahu->dev, "%s: underflow error on %s port %d, value %x\n",
- __func__, (tx ? "TX" : "RX"), port_id, val);
- if ((val & WCD9360_SLIM_IRQ_OVERFLOW) ||
- (val & WCD9360_SLIM_IRQ_UNDERFLOW)) {
- if (!tx)
- reg = WCD9360_SLIM_PGD_PORT_INT_RX_EN0 +
- (port_id / 8);
- else
- reg = WCD9360_SLIM_PGD_PORT_INT_TX_EN0 +
- (port_id / 8);
- int_val = wcd9xxx_interface_reg_read(
- pahu->wcd9xxx, reg);
- if (int_val & (1 << (port_id % 8))) {
- int_val = int_val ^ (1 << (port_id % 8));
- wcd9xxx_interface_reg_write(pahu->wcd9xxx,
- reg, int_val);
- }
- }
- if (val & WCD9360_SLIM_IRQ_PORT_CLOSED) {
- /*
- * INT SOURCE register starts from RX to TX
- * but port number in the ch_mask is in opposite way
- */
- bit = (tx ? j - 16 : j + 16);
- dev_dbg(pahu->dev, "%s: %s port %d closed value %x, bit %u\n",
- __func__, (tx ? "TX" : "RX"), port_id, val,
- bit);
- for (k = 0, cleared = false; k < NUM_CODEC_DAIS; k++) {
- dev_dbg(pahu->dev, "%s: pahu->dai[%d].ch_mask = 0x%lx\n",
- __func__, k, pahu->dai[k].ch_mask);
- if (test_and_clear_bit(bit,
- &pahu->dai[k].ch_mask)) {
- cleared = true;
- if (!pahu->dai[k].ch_mask)
- wake_up(
- &pahu->dai[k].dai_wait);
- /*
- * There are cases when multiple DAIs
- * might be using the same slimbus
- * channel. Hence don't break here.
- */
- }
- }
- }
- wcd9xxx_interface_reg_write(pahu->wcd9xxx,
- WCD9360_SLIM_PGD_PORT_INT_CLR_RX_0 +
- (j / 8),
- 1 << (j % 8));
- }
-
- return IRQ_HANDLED;
-}
-
-static int pahu_setup_irqs(struct pahu_priv *pahu)
-{
- int ret = 0;
- struct snd_soc_codec *codec = pahu->codec;
- struct wcd9xxx *wcd9xxx = pahu->wcd9xxx;
- struct wcd9xxx_core_resource *core_res =
- &wcd9xxx->core_res;
-
- ret = wcd9xxx_request_irq(core_res, WCD9XXX_IRQ_SLIMBUS,
- pahu_slimbus_irq, "SLIMBUS Slave", pahu);
- if (ret)
- dev_err(codec->dev, "%s: Failed to request irq %d\n", __func__,
- WCD9XXX_IRQ_SLIMBUS);
- else
- pahu_slim_interface_init_reg(codec);
-
- /* Register for misc interrupts as well */
- ret = wcd9xxx_request_irq(core_res, WCD9360_IRQ_MISC,
- pahu_misc_irq, "CDC MISC Irq", pahu);
- if (ret)
- dev_err(codec->dev, "%s: Failed to request cdc misc irq\n",
- __func__);
-
- return ret;
-}
-
-static void pahu_init_slim_slave_cfg(struct snd_soc_codec *codec)
-{
- struct pahu_priv *priv = snd_soc_codec_get_drvdata(codec);
- struct afe_param_cdc_slimbus_slave_cfg *cfg;
- struct wcd9xxx *wcd9xxx = priv->wcd9xxx;
- uint64_t eaddr = 0;
-
- cfg = &priv->slimbus_slave_cfg;
- cfg->minor_version = 1;
- cfg->tx_slave_port_offset = 0;
- cfg->rx_slave_port_offset = 16;
-
- memcpy(&eaddr, &wcd9xxx->slim->e_addr, sizeof(wcd9xxx->slim->e_addr));
- WARN_ON(sizeof(wcd9xxx->slim->e_addr) != 6);
- cfg->device_enum_addr_lsw = eaddr & 0xFFFFFFFF;
- cfg->device_enum_addr_msw = eaddr >> 32;
-
- dev_dbg(codec->dev, "%s: slimbus logical address 0x%llx\n",
- __func__, eaddr);
-}
-
-static void pahu_cleanup_irqs(struct pahu_priv *pahu)
-{
- struct wcd9xxx *wcd9xxx = pahu->wcd9xxx;
- struct wcd9xxx_core_resource *core_res =
- &wcd9xxx->core_res;
-
- wcd9xxx_free_irq(core_res, WCD9XXX_IRQ_SLIMBUS, pahu);
- wcd9xxx_free_irq(core_res, WCD9360_IRQ_MISC, pahu);
-}
-
-/*
- * wcd9360_get_micb_vout_ctl_val: converts micbias from volts to register value
- * @micb_mv: micbias in mv
- *
- * return register value converted
- */
-int wcd9360_get_micb_vout_ctl_val(u32 micb_mv)
-{
- /* min micbias voltage is 1V and maximum is 2.85V */
- if (micb_mv < 1000 || micb_mv > 2850) {
- pr_err("%s: unsupported micbias voltage\n", __func__);
- return -EINVAL;
- }
-
- return (micb_mv - 1000) / 50;
-}
-EXPORT_SYMBOL(wcd9360_get_micb_vout_ctl_val);
-
-static int pahu_handle_pdata(struct pahu_priv *pahu,
- struct wcd9xxx_pdata *pdata)
-{
- struct snd_soc_codec *codec = pahu->codec;
- u8 mad_dmic_ctl_val;
- u8 anc_ctl_value;
- u32 dmic_clk_drv;
- int vout_ctl_1, vout_ctl_2, vout_ctl_3, vout_ctl_4;
- int rc = 0;
-
- if (!pdata) {
- dev_err(codec->dev, "%s: NULL pdata\n", __func__);
- return -ENODEV;
- }
-
- /* set micbias voltage */
- vout_ctl_1 = wcd9360_get_micb_vout_ctl_val(pdata->micbias.micb1_mv);
- vout_ctl_2 = wcd9360_get_micb_vout_ctl_val(pdata->micbias.micb2_mv);
- vout_ctl_3 = wcd9360_get_micb_vout_ctl_val(pdata->micbias.micb3_mv);
- vout_ctl_4 = wcd9360_get_micb_vout_ctl_val(pdata->micbias.micb4_mv);
- if (vout_ctl_1 < 0 || vout_ctl_2 < 0 ||
- vout_ctl_3 < 0 || vout_ctl_4 < 0) {
- rc = -EINVAL;
- goto done;
- }
- snd_soc_update_bits(codec, WCD9360_ANA_MICB1, 0x3F, vout_ctl_1);
- snd_soc_update_bits(codec, WCD9360_ANA_MICB2, 0x3F, vout_ctl_2);
- snd_soc_update_bits(codec, WCD9360_ANA_MICB3, 0x3F, vout_ctl_3);
- snd_soc_update_bits(codec, WCD9360_ANA_MICB4, 0x3F, vout_ctl_4);
-
- if (pdata->dmic_sample_rate ==
- WCD9XXX_DMIC_SAMPLE_RATE_UNDEFINED) {
- dev_info(codec->dev, "%s: dmic_rate invalid default = %d\n",
- __func__, WCD9XXX_DMIC_SAMPLE_RATE_4P8MHZ);
- pdata->dmic_sample_rate = WCD9XXX_DMIC_SAMPLE_RATE_4P8MHZ;
- }
- if (pdata->mad_dmic_sample_rate ==
- WCD9XXX_DMIC_SAMPLE_RATE_UNDEFINED) {
- dev_info(codec->dev, "%s: mad_dmic_rate invalid default = %d\n",
- __func__, WCD9XXX_DMIC_SAMPLE_RATE_4P8MHZ);
- /*
- * use dmic_sample_rate as the default for MAD
- * if mad dmic sample rate is undefined
- */
- pdata->mad_dmic_sample_rate = pdata->dmic_sample_rate;
- }
-
- if (pdata->dmic_clk_drv ==
- WCD9XXX_DMIC_CLK_DRIVE_UNDEFINED) {
- pdata->dmic_clk_drv = WCD9360_DMIC_CLK_DRIVE_DEFAULT;
- dev_dbg(codec->dev,
- "%s: dmic_clk_strength invalid, default = %d\n",
- __func__, pdata->dmic_clk_drv);
- }
-
- switch (pdata->dmic_clk_drv) {
- case 2:
- dmic_clk_drv = 0;
- break;
- case 4:
- dmic_clk_drv = 1;
- break;
- case 8:
- dmic_clk_drv = 2;
- break;
- case 16:
- dmic_clk_drv = 3;
- break;
- default:
- dev_err(codec->dev,
- "%s: invalid dmic_clk_drv %d, using default\n",
- __func__, pdata->dmic_clk_drv);
- dmic_clk_drv = 0;
- break;
- }
-
- snd_soc_update_bits(codec, WCD9360_TEST_DEBUG_PAD_DRVCTL_0,
- 0x0C, dmic_clk_drv << 2);
-
- /*
- * Default the DMIC clk rates to mad_dmic_sample_rate,
- * whereas, the anc/txfe dmic rates to dmic_sample_rate
- * since the anc/txfe are independent of mad block.
- */
- mad_dmic_ctl_val = pahu_get_dmic_clk_val(pahu->codec,
- pdata->mad_dmic_sample_rate);
- snd_soc_update_bits(codec, WCD9360_CPE_SS_DMIC0_CTL,
- 0x0E, mad_dmic_ctl_val << 1);
- snd_soc_update_bits(codec, WCD9360_CPE_SS_DMIC1_CTL,
- 0x0E, mad_dmic_ctl_val << 1);
- snd_soc_update_bits(codec, WCD9360_CPE_SS_DMIC2_CTL,
- 0x0E, mad_dmic_ctl_val << 1);
-
- if (dmic_clk_drv == WCD9360_DMIC_CLK_DIV_2)
- anc_ctl_value = WCD9360_ANC_DMIC_X2_FULL_RATE;
- else
- anc_ctl_value = WCD9360_ANC_DMIC_X2_HALF_RATE;
-
- snd_soc_update_bits(codec, WCD9360_CDC_ANC0_MODE_2_CTL,
- 0x40, anc_ctl_value << 6);
- snd_soc_update_bits(codec, WCD9360_CDC_ANC0_MODE_2_CTL,
- 0x20, anc_ctl_value << 5);
-
-done:
- return rc;
-}
-
-static void pahu_cdc_vote_svs(struct snd_soc_codec *codec, bool vote)
-{
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
-
- return pahu_vote_svs(pahu, vote);
-}
-
-static struct wcd_dsp_cdc_cb cdc_cb = {
- .cdc_clk_en = pahu_codec_internal_rco_ctrl,
- .cdc_vote_svs = pahu_cdc_vote_svs,
-};
-
-static int pahu_wdsp_initialize(struct snd_soc_codec *codec)
-{
- struct wcd9xxx *control;
- struct pahu_priv *pahu;
- struct wcd_dsp_params params;
- int ret = 0;
-
- control = dev_get_drvdata(codec->dev->parent);
- pahu = snd_soc_codec_get_drvdata(codec);
-
- params.cb = &cdc_cb;
- params.irqs.cpe_ipc1_irq = WCD9360_IRQ_CPE1_INTR;
- params.irqs.cpe_err_irq = WCD9360_IRQ_CPE_ERROR;
- params.irqs.fatal_irqs = CPE_FATAL_IRQS;
- params.clk_rate = control->mclk_rate;
- params.dsp_instance = 0;
-
- wcd9360_dsp_cntl_init(codec, ¶ms, &pahu->wdsp_cntl);
- if (!pahu->wdsp_cntl) {
- dev_err(pahu->dev, "%s: wcd-dsp-control init failed\n",
- __func__);
- ret = -EINVAL;
- }
-
- return ret;
-}
-
-static void pahu_mclk2_reg_defaults(struct pahu_priv *pahu)
-{
- int i;
- struct snd_soc_codec *codec = pahu->codec;
-
- /* MCLK2 configuration */
- for (i = 0; i < ARRAY_SIZE(pahu_codec_mclk2_1_0_defaults); i++)
- snd_soc_update_bits(codec,
- pahu_codec_mclk2_1_0_defaults[i].reg,
- pahu_codec_mclk2_1_0_defaults[i].mask,
- pahu_codec_mclk2_1_0_defaults[i].val);
-}
-
-static int pahu_device_down(struct wcd9xxx *wcd9xxx)
-{
- struct snd_soc_codec *codec;
- struct pahu_priv *priv;
- int count;
-
- codec = (struct snd_soc_codec *)(wcd9xxx->ssr_priv);
- priv = snd_soc_codec_get_drvdata(codec);
- if (priv->swr.ctrl_data)
- swrm_wcd_notify(priv->swr.ctrl_data[0].swr_pdev,
- SWR_DEVICE_DOWN, NULL);
- snd_soc_card_change_online_state(codec->component.card, 0);
- for (count = 0; count < NUM_CODEC_DAIS; count++)
- priv->dai[count].bus_down_in_recovery = true;
- wcd9360_dsp_ssr_event(priv->wdsp_cntl, WCD_CDC_DOWN_EVENT);
- wcd_resmgr_set_sido_input_src_locked(priv->resmgr,
- SIDO_SOURCE_INTERNAL);
-
- return 0;
-}
-
-static int pahu_post_reset_cb(struct wcd9xxx *wcd9xxx)
-{
- int i, ret = 0;
- struct wcd9xxx *control;
- struct snd_soc_codec *codec;
- struct pahu_priv *pahu;
- struct wcd9xxx_pdata *pdata;
-
- codec = (struct snd_soc_codec *)(wcd9xxx->ssr_priv);
- pahu = snd_soc_codec_get_drvdata(codec);
- control = dev_get_drvdata(codec->dev->parent);
-
- wcd9xxx_set_power_state(pahu->wcd9xxx,
- WCD_REGION_POWER_COLLAPSE_REMOVE,
- WCD9XXX_DIG_CORE_REGION_1);
-
- mutex_lock(&pahu->codec_mutex);
-
- pahu_vote_svs(pahu, true);
- pahu_slimbus_slave_port_cfg.slave_dev_intfdev_la =
- control->slim_slave->laddr;
- pahu_slimbus_slave_port_cfg.slave_dev_pgd_la =
- control->slim->laddr;
- pahu_init_slim_slave_cfg(codec);
- snd_soc_card_change_online_state(codec->component.card, 1);
-
- for (i = 0; i < PAHU_MAX_MICBIAS; i++)
- pahu->micb_ref[i] = 0;
-
- dev_dbg(codec->dev, "%s: MCLK Rate = %x\n",
- __func__, control->mclk_rate);
-
- pahu_update_reg_defaults(pahu);
- wcd_resmgr_post_ssr_v2(pahu->resmgr);
- __pahu_enable_efuse_sensing(pahu);
- pahu_mclk2_reg_defaults(pahu);
-
- __pahu_cdc_mclk_enable(pahu, true);
- regcache_mark_dirty(codec->component.regmap);
- regcache_sync(codec->component.regmap);
- __pahu_cdc_mclk_enable(pahu, false);
-
- pahu_update_cpr_defaults(pahu);
-
- pdata = dev_get_platdata(codec->dev->parent);
- ret = pahu_handle_pdata(pahu, pdata);
- if (ret < 0)
- dev_err(codec->dev, "%s: invalid pdata\n", __func__);
-
- pahu_cleanup_irqs(pahu);
- ret = pahu_setup_irqs(pahu);
- if (ret) {
- dev_err(codec->dev, "%s: pahu irq setup failed %d\n",
- __func__, ret);
- goto done;
- }
-
- pahu_set_spkr_mode(codec, pahu->swr.spkr_mode);
- /*
- * Once the codec initialization is completed, the svs vote
- * can be released allowing the codec to go to SVS2.
- */
- pahu_vote_svs(pahu, false);
- wcd9360_dsp_ssr_event(pahu->wdsp_cntl, WCD_CDC_UP_EVENT);
-
-done:
- mutex_unlock(&pahu->codec_mutex);
- return ret;
-}
-
-static int pahu_soc_codec_probe(struct snd_soc_codec *codec)
-{
- struct wcd9xxx *control;
- struct pahu_priv *pahu;
- struct wcd9xxx_pdata *pdata;
- struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
- int i, ret;
- void *ptr = NULL;
-
- control = dev_get_drvdata(codec->dev->parent);
-
- dev_info(codec->dev, "%s()\n", __func__);
- pahu = snd_soc_codec_get_drvdata(codec);
- pahu->intf_type = wcd9xxx_get_intf_type();
-
- control->dev_down = pahu_device_down;
- control->post_reset = pahu_post_reset_cb;
- control->ssr_priv = (void *)codec;
-
- /* Resource Manager post Init */
- ret = wcd_resmgr_post_init(pahu->resmgr, &pahu_resmgr_cb, codec);
- if (ret) {
- dev_err(codec->dev, "%s: wcd resmgr post init failed\n",
- __func__);
- goto err;
- }
-
- pahu->fw_data = devm_kzalloc(codec->dev, sizeof(*(pahu->fw_data)),
- GFP_KERNEL);
- if (!pahu->fw_data)
- goto err;
-
- set_bit(WCD9XXX_ANC_CAL, pahu->fw_data->cal_bit);
- set_bit(WCD9XXX_MAD_CAL, pahu->fw_data->cal_bit);
-
- ret = wcd_cal_create_hwdep(pahu->fw_data,
- WCD9XXX_CODEC_HWDEP_NODE, codec);
- if (ret < 0) {
- dev_err(codec->dev, "%s hwdep failed %d\n", __func__, ret);
- goto err_hwdep;
- }
-
- pahu->codec = codec;
- for (i = 0; i < COMPANDER_MAX; i++)
- pahu->comp_enabled[i] = 0;
-
- pdata = dev_get_platdata(codec->dev->parent);
- ret = pahu_handle_pdata(pahu, pdata);
- if (ret < 0) {
- dev_err(codec->dev, "%s: bad pdata\n", __func__);
- goto err_hwdep;
- }
-
- ptr = devm_kzalloc(codec->dev, (sizeof(pahu_rx_chs) +
- sizeof(pahu_tx_chs)), GFP_KERNEL);
- if (!ptr) {
- ret = -ENOMEM;
- goto err_hwdep;
- }
-
- snd_soc_dapm_add_routes(dapm, pahu_slim_audio_map,
- ARRAY_SIZE(pahu_slim_audio_map));
- for (i = 0; i < NUM_CODEC_DAIS; i++) {
- INIT_LIST_HEAD(&pahu->dai[i].wcd9xxx_ch_list);
- init_waitqueue_head(&pahu->dai[i].dai_wait);
- }
- pahu_slimbus_slave_port_cfg.slave_dev_intfdev_la =
- control->slim_slave->laddr;
- pahu_slimbus_slave_port_cfg.slave_dev_pgd_la =
- control->slim->laddr;
- pahu_slimbus_slave_port_cfg.slave_port_mapping[0] =
- WCD9360_TX13;
- pahu_init_slim_slave_cfg(codec);
-
- control->num_rx_port = WCD9360_RX_MAX;
- control->rx_chs = ptr;
- memcpy(control->rx_chs, pahu_rx_chs, sizeof(pahu_rx_chs));
- control->num_tx_port = WCD9360_TX_MAX;
- control->tx_chs = ptr + sizeof(pahu_rx_chs);
- memcpy(control->tx_chs, pahu_tx_chs, sizeof(pahu_tx_chs));
-
- ret = pahu_setup_irqs(pahu);
- if (ret) {
- dev_err(pahu->dev, "%s: pahu irq setup failed %d\n",
- __func__, ret);
- goto err_pdata;
- }
-
- for (i = 0; i < WCD9360_NUM_DECIMATORS; i++) {
- pahu->tx_hpf_work[i].pahu = pahu;
- pahu->tx_hpf_work[i].decimator = i;
- INIT_DELAYED_WORK(&pahu->tx_hpf_work[i].dwork,
- pahu_tx_hpf_corner_freq_callback);
-
- pahu->tx_mute_dwork[i].pahu = pahu;
- pahu->tx_mute_dwork[i].decimator = i;
- INIT_DELAYED_WORK(&pahu->tx_mute_dwork[i].dwork,
- pahu_tx_mute_update_callback);
- }
-
- pahu->spk_anc_dwork.pahu = pahu;
- INIT_DELAYED_WORK(&pahu->spk_anc_dwork.dwork,
- pahu_spk_anc_update_callback);
-
- pahu_mclk2_reg_defaults(pahu);
-
- mutex_lock(&pahu->codec_mutex);
- snd_soc_dapm_disable_pin(dapm, "ANC EAR PA");
- snd_soc_dapm_disable_pin(dapm, "ANC EAR");
- snd_soc_dapm_enable_pin(dapm, "ANC SPK1 PA");
- mutex_unlock(&pahu->codec_mutex);
-
- snd_soc_dapm_ignore_suspend(dapm, "AIF1 Playback");
- snd_soc_dapm_ignore_suspend(dapm, "AIF1 Capture");
- snd_soc_dapm_ignore_suspend(dapm, "AIF2 Playback");
- snd_soc_dapm_ignore_suspend(dapm, "AIF2 Capture");
- snd_soc_dapm_ignore_suspend(dapm, "AIF3 Playback");
- snd_soc_dapm_ignore_suspend(dapm, "AIF3 Capture");
- snd_soc_dapm_ignore_suspend(dapm, "AIF4 Playback");
- snd_soc_dapm_ignore_suspend(dapm, "AIF4 MAD TX");
- snd_soc_dapm_ignore_suspend(dapm, "VIfeed");
- snd_soc_dapm_ignore_suspend(dapm, "I2S1 Playback");
- snd_soc_dapm_ignore_suspend(dapm, "I2S1 Capture");
-
- snd_soc_dapm_sync(dapm);
-
- pahu_wdsp_initialize(codec);
-
- /*
- * Once the codec initialization is completed, the svs vote
- * can be released allowing the codec to go to SVS2.
- */
- pahu_vote_svs(pahu, false);
-
- return ret;
-
-err_pdata:
- devm_kfree(codec->dev, ptr);
- control->rx_chs = NULL;
- control->tx_chs = NULL;
-err_hwdep:
- devm_kfree(codec->dev, pahu->fw_data);
- pahu->fw_data = NULL;
-err:
- return ret;
-}
-
-static int pahu_soc_codec_remove(struct snd_soc_codec *codec)
-{
- struct wcd9xxx *control;
- struct pahu_priv *pahu = snd_soc_codec_get_drvdata(codec);
-
- control = dev_get_drvdata(codec->dev->parent);
- devm_kfree(codec->dev, control->rx_chs);
- /* slimslave deinit in wcd core looks for this value */
- control->num_rx_port = 0;
- control->num_tx_port = 0;
- control->rx_chs = NULL;
- control->tx_chs = NULL;
- pahu_cleanup_irqs(pahu);
-
- if (pahu->wdsp_cntl)
- wcd9360_dsp_cntl_deinit(&pahu->wdsp_cntl);
-
- return 0;
-}
-
-static struct regmap *pahu_get_regmap(struct device *dev)
-{
- struct wcd9xxx *control = dev_get_drvdata(dev->parent);
-
- return control->regmap;
-}
-
-static struct snd_soc_codec_driver soc_codec_dev_pahu = {
- .probe = pahu_soc_codec_probe,
- .remove = pahu_soc_codec_remove,
- .get_regmap = pahu_get_regmap,
- .component_driver = {
- .controls = pahu_snd_controls,
- .num_controls = ARRAY_SIZE(pahu_snd_controls),
- .dapm_widgets = pahu_dapm_widgets,
- .num_dapm_widgets = ARRAY_SIZE(pahu_dapm_widgets),
- .dapm_routes = pahu_audio_map,
- .num_dapm_routes = ARRAY_SIZE(pahu_audio_map),
- },
-};
-
-#ifdef CONFIG_PM
-static int pahu_suspend(struct device *dev)
-{
- struct platform_device *pdev = to_platform_device(dev);
- struct pahu_priv *pahu = platform_get_drvdata(pdev);
-
- if (!pahu) {
- dev_err(dev, "%s: pahu private data is NULL\n", __func__);
- return -EINVAL;
- }
- dev_dbg(dev, "%s: system suspend\n", __func__);
- if (delayed_work_pending(&pahu->power_gate_work) &&
- cancel_delayed_work_sync(&pahu->power_gate_work))
- pahu_codec_power_gate_digital_core(pahu);
- return 0;
-}
-
-static int pahu_resume(struct device *dev)
-{
- struct platform_device *pdev = to_platform_device(dev);
- struct pahu_priv *pahu = platform_get_drvdata(pdev);
-
- if (!pahu) {
- dev_err(dev, "%s: pahu private data is NULL\n", __func__);
- return -EINVAL;
- }
- dev_dbg(dev, "%s: system resume\n", __func__);
- return 0;
-}
-
-static const struct dev_pm_ops pahu_pm_ops = {
- .suspend = pahu_suspend,
- .resume = pahu_resume,
-};
-#endif
-
-static int pahu_swrm_read(void *handle, int reg)
-{
- struct pahu_priv *pahu;
- struct wcd9xxx *wcd9xxx;
- unsigned short swr_rd_addr_base;
- unsigned short swr_rd_data_base;
- int val, ret;
-
- if (!handle) {
- pr_err("%s: NULL handle\n", __func__);
- return -EINVAL;
- }
- pahu = (struct pahu_priv *)handle;
- wcd9xxx = pahu->wcd9xxx;
-
- dev_dbg(pahu->dev, "%s: Reading soundwire register, 0x%x\n",
- __func__, reg);
- swr_rd_addr_base = WCD9360_SWR_AHB_BRIDGE_RD_ADDR_0;
- swr_rd_data_base = WCD9360_SWR_AHB_BRIDGE_RD_DATA_0;
-
- mutex_lock(&pahu->swr.read_mutex);
- ret = regmap_bulk_write(wcd9xxx->regmap, swr_rd_addr_base,
- (u8 *)®, 4);
- if (ret < 0) {
- dev_err(pahu->dev, "%s: RD Addr Failure\n", __func__);
- goto done;
- }
- ret = regmap_bulk_read(wcd9xxx->regmap, swr_rd_data_base,
- (u8 *)&val, 4);
- if (ret < 0) {
- dev_err(pahu->dev, "%s: RD Data Failure\n", __func__);
- goto done;
- }
- ret = val;
-done:
- mutex_unlock(&pahu->swr.read_mutex);
-
- return ret;
-}
-
-static int pahu_swrm_bulk_write(void *handle, u32 *reg, u32 *val, size_t len)
-{
- struct pahu_priv *pahu;
- struct wcd9xxx *wcd9xxx;
- struct wcd9xxx_reg_val *bulk_reg;
- unsigned short swr_wr_addr_base;
- unsigned short swr_wr_data_base;
- int i, j, ret;
-
- if (!handle || !reg || !val) {
- pr_err("%s: NULL parameter\n", __func__);
- return -EINVAL;
- }
- if (len <= 0) {
- pr_err("%s: Invalid size: %zu\n", __func__, len);
- return -EINVAL;
- }
- pahu = (struct pahu_priv *)handle;
- wcd9xxx = pahu->wcd9xxx;
-
- swr_wr_addr_base = WCD9360_SWR_AHB_BRIDGE_WR_ADDR_0;
- swr_wr_data_base = WCD9360_SWR_AHB_BRIDGE_WR_DATA_0;
-
- bulk_reg = kzalloc((2 * len * sizeof(struct wcd9xxx_reg_val)),
- GFP_KERNEL);
- if (!bulk_reg)
- return -ENOMEM;
-
- for (i = 0, j = 0; i < (len * 2); i += 2, j++) {
- bulk_reg[i].reg = swr_wr_data_base;
- bulk_reg[i].buf = (u8 *)(&val[j]);
- bulk_reg[i].bytes = 4;
- bulk_reg[i+1].reg = swr_wr_addr_base;
- bulk_reg[i+1].buf = (u8 *)(®[j]);
- bulk_reg[i+1].bytes = 4;
- }
-
- mutex_lock(&pahu->swr.write_mutex);
- ret = wcd9xxx_slim_bulk_write(wcd9xxx, bulk_reg,
- (len * 2), false);
- if (ret) {
- dev_err(pahu->dev, "%s: swrm bulk write failed, ret: %d\n",
- __func__, ret);
- }
- mutex_unlock(&pahu->swr.write_mutex);
-
- kfree(bulk_reg);
- return ret;
-}
-
-static int pahu_swrm_write(void *handle, int reg, int val)
-{
- struct pahu_priv *pahu;
- struct wcd9xxx *wcd9xxx;
- unsigned short swr_wr_addr_base;
- unsigned short swr_wr_data_base;
- struct wcd9xxx_reg_val bulk_reg[2];
- int ret;
-
- if (!handle) {
- pr_err("%s: NULL handle\n", __func__);
- return -EINVAL;
- }
- pahu = (struct pahu_priv *)handle;
- wcd9xxx = pahu->wcd9xxx;
-
- swr_wr_addr_base = WCD9360_SWR_AHB_BRIDGE_WR_ADDR_0;
- swr_wr_data_base = WCD9360_SWR_AHB_BRIDGE_WR_DATA_0;
-
- /* First Write the Data to register */
- bulk_reg[0].reg = swr_wr_data_base;
- bulk_reg[0].buf = (u8 *)(&val);
- bulk_reg[0].bytes = 4;
- bulk_reg[1].reg = swr_wr_addr_base;
- bulk_reg[1].buf = (u8 *)(®);
- bulk_reg[1].bytes = 4;
-
- mutex_lock(&pahu->swr.write_mutex);
- ret = wcd9xxx_slim_bulk_write(wcd9xxx, bulk_reg, 2, false);
- if (ret < 0)
- dev_err(pahu->dev, "%s: WR Data Failure\n", __func__);
- mutex_unlock(&pahu->swr.write_mutex);
-
- return ret;
-}
-
-static int pahu_swrm_clock(void *handle, bool enable)
-{
- struct pahu_priv *pahu;
-
- if (!handle) {
- pr_err("%s: NULL handle\n", __func__);
- return -EINVAL;
- }
- pahu = (struct pahu_priv *)handle;
-
- mutex_lock(&pahu->swr.clk_mutex);
- dev_dbg(pahu->dev, "%s: swrm clock %s\n",
- __func__, (enable?"enable" : "disable"));
- if (enable) {
- pahu->swr.clk_users++;
- if (pahu->swr.clk_users == 1) {
- regmap_update_bits(pahu->wcd9xxx->regmap,
- WCD9360_TEST_DEBUG_NPL_DLY_TEST_1,
- 0x10, 0x00);
- __pahu_cdc_mclk_enable(pahu, true);
- regmap_update_bits(pahu->wcd9xxx->regmap,
- WCD9360_CDC_CLK_RST_CTRL_SWR_CONTROL,
- 0x01, 0x01);
- }
- } else {
- pahu->swr.clk_users--;
- if (pahu->swr.clk_users == 0) {
- regmap_update_bits(pahu->wcd9xxx->regmap,
- WCD9360_CDC_CLK_RST_CTRL_SWR_CONTROL,
- 0x01, 0x00);
- __pahu_cdc_mclk_enable(pahu, false);
- regmap_update_bits(pahu->wcd9xxx->regmap,
- WCD9360_TEST_DEBUG_NPL_DLY_TEST_1,
- 0x10, 0x10);
- }
- }
- dev_dbg(pahu->dev, "%s: swrm clock users %d\n",
- __func__, pahu->swr.clk_users);
- mutex_unlock(&pahu->swr.clk_mutex);
-
- return 0;
-}
-
-static int pahu_swrm_handle_irq(void *handle,
- irqreturn_t (*swrm_irq_handler)(int irq,
- void *data),
- void *swrm_handle,
- int action)
-{
- struct pahu_priv *pahu;
- int ret = 0;
- struct wcd9xxx *wcd9xxx;
-
- if (!handle) {
- pr_err("%s: NULL handle\n", __func__);
- return -EINVAL;
- }
- pahu = (struct pahu_priv *) handle;
- wcd9xxx = pahu->wcd9xxx;
-
- if (action) {
- ret = wcd9xxx_request_irq(&wcd9xxx->core_res,
- WCD9360_IRQ_SOUNDWIRE,
- swrm_irq_handler,
- "Pahu SWR Master", swrm_handle);
- if (ret)
- dev_err(pahu->dev, "%s: Failed to request irq %d\n",
- __func__, WCD9360_IRQ_SOUNDWIRE);
- } else
- wcd9xxx_free_irq(&wcd9xxx->core_res, WCD9360_IRQ_SOUNDWIRE,
- swrm_handle);
-
- return ret;
-}
-
-static void pahu_codec_add_spi_device(struct pahu_priv *pahu,
- struct device_node *node)
-{
- struct spi_master *master;
- struct spi_device *spi;
- u32 prop_value;
- int rc;
-
- /* Read the master bus num from DT node */
- rc = of_property_read_u32(node, "qcom,master-bus-num",
- &prop_value);
- if (rc < 0) {
- dev_err(pahu->dev, "%s: prop %s not found in node %s",
- __func__, "qcom,master-bus-num", node->full_name);
- goto done;
- }
-
- /* Get the reference to SPI master */
- master = spi_busnum_to_master(prop_value);
- if (!master) {
- dev_err(pahu->dev, "%s: Invalid spi_master for bus_num %u\n",
- __func__, prop_value);
- goto done;
- }
-
- /* Allocate the spi device */
- spi = spi_alloc_device(master);
- if (!spi) {
- dev_err(pahu->dev, "%s: spi_alloc_device failed\n",
- __func__);
- goto err_spi_alloc_dev;
- }
-
- /* Initialize device properties */
- if (of_modalias_node(node, spi->modalias,
- sizeof(spi->modalias)) < 0) {
- dev_err(pahu->dev, "%s: cannot find modalias for %s\n",
- __func__, node->full_name);
- goto err_dt_parse;
- }
-
- rc = of_property_read_u32(node, "qcom,chip-select",
- &prop_value);
- if (rc < 0) {
- dev_err(pahu->dev, "%s: prop %s not found in node %s",
- __func__, "qcom,chip-select", node->full_name);
- goto err_dt_parse;
- }
- spi->chip_select = prop_value;
-
- rc = of_property_read_u32(node, "qcom,max-frequency",
- &prop_value);
- if (rc < 0) {
- dev_err(pahu->dev, "%s: prop %s not found in node %s",
- __func__, "qcom,max-frequency", node->full_name);
- goto err_dt_parse;
- }
- spi->max_speed_hz = prop_value;
-
- spi->dev.of_node = node;
-
- rc = spi_add_device(spi);
- if (rc < 0) {
- dev_err(pahu->dev, "%s: spi_add_device failed\n", __func__);
- goto err_dt_parse;
- }
-
- pahu->spi = spi;
- /* Put the reference to SPI master */
- put_device(&master->dev);
-
- return;
-
-err_dt_parse:
- spi_dev_put(spi);
-
-err_spi_alloc_dev:
- /* Put the reference to SPI master */
- put_device(&master->dev);
-done:
- return;
-}
-
-static void pahu_add_child_devices(struct work_struct *work)
-{
- struct pahu_priv *pahu;
- struct platform_device *pdev;
- struct device_node *node;
- struct wcd9xxx *wcd9xxx;
- struct pahu_swr_ctrl_data *swr_ctrl_data = NULL, *temp;
- int ret, ctrl_num = 0;
- struct wcd_swr_ctrl_platform_data *platdata;
- char plat_dev_name[WCD9360_STRING_LEN];
-
- pahu = container_of(work, struct pahu_priv,
- pahu_add_child_devices_work);
- if (!pahu) {
- pr_err("%s: Memory for wcd9360 does not exist\n",
- __func__);
- return;
- }
- wcd9xxx = pahu->wcd9xxx;
- if (!wcd9xxx) {
- pr_err("%s: Memory for WCD9XXX does not exist\n",
- __func__);
- return;
- }
- if (!wcd9xxx->dev->of_node) {
- dev_err(wcd9xxx->dev, "%s: DT node for wcd9xxx does not exist\n",
- __func__);
- return;
- }
-
- platdata = &pahu->swr.plat_data;
- pahu->child_count = 0;
-
- for_each_child_of_node(wcd9xxx->dev->of_node, node) {
-
- /* Parse and add the SPI device node */
- if (!strcmp(node->name, "wcd_spi")) {
- pahu_codec_add_spi_device(pahu, node);
- continue;
- }
-
- /* Parse other child device nodes and add platform device */
- if (!strcmp(node->name, "swr_master"))
- strlcpy(plat_dev_name, "pahu_swr_ctrl",
- (WCD9360_STRING_LEN - 1));
- else if (strnstr(node->name, "msm_cdc_pinctrl",
- strlen("msm_cdc_pinctrl")) != NULL)
- strlcpy(plat_dev_name, node->name,
- (WCD9360_STRING_LEN - 1));
- else
- continue;
-
- pdev = platform_device_alloc(plat_dev_name, -1);
- if (!pdev) {
- dev_err(wcd9xxx->dev, "%s: pdev memory alloc failed\n",
- __func__);
- ret = -ENOMEM;
- goto err_mem;
- }
- pdev->dev.parent = pahu->dev;
- pdev->dev.of_node = node;
-
- if (strcmp(node->name, "swr_master") == 0) {
- ret = platform_device_add_data(pdev, platdata,
- sizeof(*platdata));
- if (ret) {
- dev_err(&pdev->dev,
- "%s: cannot add plat data ctrl:%d\n",
- __func__, ctrl_num);
- goto err_pdev_add;
- }
- }
-
- ret = platform_device_add(pdev);
- if (ret) {
- dev_err(&pdev->dev,
- "%s: Cannot add platform device\n",
- __func__);
- goto err_pdev_add;
- }
-
- if (strcmp(node->name, "swr_master") == 0) {
- temp = krealloc(swr_ctrl_data,
- (ctrl_num + 1) * sizeof(
- struct pahu_swr_ctrl_data),
- GFP_KERNEL);
- if (!temp) {
- dev_err(wcd9xxx->dev, "out of memory\n");
- ret = -ENOMEM;
- goto err_pdev_add;
- }
- swr_ctrl_data = temp;
- swr_ctrl_data[ctrl_num].swr_pdev = pdev;
- ctrl_num++;
- dev_dbg(&pdev->dev,
- "%s: Added soundwire ctrl device(s)\n",
- __func__);
- pahu->swr.ctrl_data = swr_ctrl_data;
- }
- if (pahu->child_count < WCD9360_CHILD_DEVICES_MAX)
- pahu->pdev_child_devices[pahu->child_count++] = pdev;
- else
- goto err_mem;
- }
-
- return;
-
-err_pdev_add:
- platform_device_put(pdev);
-err_mem:
- return;
-}
-
-static int __pahu_enable_efuse_sensing(struct pahu_priv *pahu)
-{
- int val, rc;
-
- WCD9XXX_V2_BG_CLK_LOCK(pahu->resmgr);
- __pahu_cdc_mclk_enable_locked(pahu, true);
-
- regmap_update_bits(pahu->wcd9xxx->regmap,
- WCD9360_CHIP_TIER_CTRL_EFUSE_CTL, 0x1E, 0x10);
- regmap_update_bits(pahu->wcd9xxx->regmap,
- WCD9360_CHIP_TIER_CTRL_EFUSE_CTL, 0x01, 0x01);
- /*
- * 5ms sleep required after enabling efuse control
- * before checking the status.
- */
- usleep_range(5000, 5500);
- wcd_resmgr_set_sido_input_src(pahu->resmgr,
- SIDO_SOURCE_RCO_BG);
-
- WCD9XXX_V2_BG_CLK_UNLOCK(pahu->resmgr);
-
- rc = regmap_read(pahu->wcd9xxx->regmap,
- WCD9360_CHIP_TIER_CTRL_EFUSE_STATUS, &val);
- if (rc || (!(val & 0x01)))
- WARN(1, "%s: Efuse sense is not complete val=%x, ret=%d\n",
- __func__, val, rc);
-
- __pahu_cdc_mclk_enable(pahu, false);
-
- return rc;
-}
-
-/*
- * pahu_get_wcd_dsp_cntl: Get the reference to wcd_dsp_cntl
- * @dev: Device pointer for codec device
- *
- * This API gets the reference to codec's struct wcd_dsp_cntl
- */
-void *pahu_get_wcd_dsp_cntl(struct device *dev)
-{
- struct platform_device *pdev;
- struct pahu_priv *pahu;
-
- if (!dev) {
- pr_err("%s: Invalid device\n", __func__);
- return NULL;
- }
-
- pdev = to_platform_device(dev);
- pahu = platform_get_drvdata(pdev);
-
- return pahu->wdsp_cntl;
-}
-EXPORT_SYMBOL(pahu_get_wcd_dsp_cntl);
-
-static int pahu_probe(struct platform_device *pdev)
-{
- int ret = 0;
- struct pahu_priv *pahu;
- struct clk *wcd_ext_clk;
- struct wcd9xxx_resmgr_v2 *resmgr;
- struct wcd9xxx_power_region *cdc_pwr;
-
- pahu = devm_kzalloc(&pdev->dev, sizeof(struct pahu_priv),
- GFP_KERNEL);
- if (!pahu)
- return -ENOMEM;
-
- platform_set_drvdata(pdev, pahu);
-
- pahu->wcd9xxx = dev_get_drvdata(pdev->dev.parent);
- pahu->dev = &pdev->dev;
- INIT_DELAYED_WORK(&pahu->power_gate_work, pahu_codec_power_gate_work);
- mutex_init(&pahu->power_lock);
- INIT_WORK(&pahu->pahu_add_child_devices_work,
- pahu_add_child_devices);
- mutex_init(&pahu->micb_lock);
- mutex_init(&pahu->swr.read_mutex);
- mutex_init(&pahu->swr.write_mutex);
- mutex_init(&pahu->swr.clk_mutex);
- mutex_init(&pahu->codec_mutex);
- mutex_init(&pahu->svs_mutex);
-
- /*
- * Codec hardware by default comes up in SVS mode.
- * Initialize the svs_ref_cnt to 1 to reflect the hardware
- * state in the driver.
- */
- pahu->svs_ref_cnt = 1;
-
- cdc_pwr = devm_kzalloc(&pdev->dev, sizeof(struct wcd9xxx_power_region),
- GFP_KERNEL);
- if (!cdc_pwr) {
- ret = -ENOMEM;
- goto err_resmgr;
- }
- pahu->wcd9xxx->wcd9xxx_pwr[WCD9XXX_DIG_CORE_REGION_1] = cdc_pwr;
- cdc_pwr->pwr_collapse_reg_min = WCD9360_DIG_CORE_REG_MIN;
- cdc_pwr->pwr_collapse_reg_max = WCD9360_DIG_CORE_REG_MAX;
- wcd9xxx_set_power_state(pahu->wcd9xxx,
- WCD_REGION_POWER_COLLAPSE_REMOVE,
- WCD9XXX_DIG_CORE_REGION_1);
- /*
- * Init resource manager so that if child nodes such as SoundWire
- * requests for clock, resource manager can honor the request
- */
- resmgr = wcd_resmgr_init(&pahu->wcd9xxx->core_res, NULL);
- if (IS_ERR(resmgr)) {
- ret = PTR_ERR(resmgr);
- dev_err(&pdev->dev, "%s: Failed to initialize wcd resmgr\n",
- __func__);
- goto err_resmgr;
- }
- pahu->resmgr = resmgr;
- pahu->swr.plat_data.handle = (void *) pahu;
- pahu->swr.plat_data.read = pahu_swrm_read;
- pahu->swr.plat_data.write = pahu_swrm_write;
- pahu->swr.plat_data.bulk_write = pahu_swrm_bulk_write;
- pahu->swr.plat_data.clk = pahu_swrm_clock;
- pahu->swr.plat_data.handle_irq = pahu_swrm_handle_irq;
- pahu->swr.spkr_gain_offset = WCD9360_RX_GAIN_OFFSET_0_DB;
-
- /* Register for Clock */
- wcd_ext_clk = clk_get(pahu->wcd9xxx->dev, "wcd_clk");
- if (IS_ERR(wcd_ext_clk)) {
- dev_err(pahu->wcd9xxx->dev, "%s: clk get %s failed\n",
- __func__, "wcd_ext_clk");
- goto err_clk;
- }
- pahu->wcd_ext_clk = wcd_ext_clk;
- dev_dbg(&pdev->dev, "%s: MCLK Rate = %x\n", __func__,
- pahu->wcd9xxx->mclk_rate);
- /* Probe defer if mlck is failed */
- ret = clk_prepare_enable(pahu->wcd_ext_clk);
- if (ret) {
- dev_dbg(pahu->dev, "%s: ext clk enable failed\n",
- __func__);
- ret = -EPROBE_DEFER;
- goto err_cdc_reg;
- }
- clk_disable_unprepare(pahu->wcd_ext_clk);
-
- /* Update codec register default values */
- pahu_update_reg_defaults(pahu);
- __pahu_enable_efuse_sensing(pahu);
- pahu_update_cpr_defaults(pahu);
-
- /* Register with soc framework */
- ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_pahu,
- pahu_dai, ARRAY_SIZE(pahu_dai));
- if (ret) {
- dev_err(&pdev->dev, "%s: Codec registration failed\n",
- __func__);
- goto err_cdc_reg;
- }
- schedule_work(&pahu->pahu_add_child_devices_work);
-
- return ret;
-
-err_cdc_reg:
- clk_put(pahu->wcd_ext_clk);
-err_clk:
- wcd_resmgr_remove(pahu->resmgr);
-err_resmgr:
- mutex_destroy(&pahu->micb_lock);
- mutex_destroy(&pahu->svs_mutex);
- mutex_destroy(&pahu->codec_mutex);
- mutex_destroy(&pahu->swr.read_mutex);
- mutex_destroy(&pahu->swr.write_mutex);
- mutex_destroy(&pahu->swr.clk_mutex);
- devm_kfree(&pdev->dev, pahu);
-
- return ret;
-}
-
-static int pahu_remove(struct platform_device *pdev)
-{
- struct pahu_priv *pahu;
- int count = 0;
-
- pahu = platform_get_drvdata(pdev);
- if (!pahu)
- return -EINVAL;
-
- if (pahu->spi)
- spi_unregister_device(pahu->spi);
- for (count = 0; count < pahu->child_count &&
- count < WCD9360_CHILD_DEVICES_MAX; count++)
- platform_device_unregister(pahu->pdev_child_devices[count]);
-
- mutex_destroy(&pahu->micb_lock);
- mutex_destroy(&pahu->svs_mutex);
- mutex_destroy(&pahu->codec_mutex);
- mutex_destroy(&pahu->swr.read_mutex);
- mutex_destroy(&pahu->swr.write_mutex);
- mutex_destroy(&pahu->swr.clk_mutex);
-
- snd_soc_unregister_codec(&pdev->dev);
- clk_put(pahu->wcd_ext_clk);
- wcd_resmgr_remove(pahu->resmgr);
- devm_kfree(&pdev->dev, pahu);
- return 0;
-}
-
-static struct platform_driver pahu_codec_driver = {
- .probe = pahu_probe,
- .remove = pahu_remove,
- .driver = {
- .name = "pahu_codec",
- .owner = THIS_MODULE,
-#ifdef CONFIG_PM
- .pm = &pahu_pm_ops,
-#endif
- },
-};
-
-module_platform_driver(pahu_codec_driver);
-
-MODULE_DESCRIPTION("Pahu Codec driver");
-MODULE_LICENSE("GPL v2");
diff --git a/asoc/codecs/wcd9360/wcd9360.h b/asoc/codecs/wcd9360/wcd9360.h
deleted file mode 100644
index 04fb76d..0000000
--- a/asoc/codecs/wcd9360/wcd9360.h
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Copyright (c) 2015-2018, 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.
- */
-#ifndef __WCD9360_H__
-#define __WCD9360_H__
-
-#include <dsp/apr_audio-v2.h>
-#include "../wcd9xxx-slimslave.h"
-#include "../wcd9xxx-common-v2.h"
-
-#define WCD9360_REGISTER_START_OFFSET 0x800
-#define WCD9360_SB_PGD_PORT_RX_BASE 0x40
-#define WCD9360_SB_PGD_PORT_TX_BASE 0x50
-#define WCD9360_RX_PORT_START_NUMBER 16
-
-#define WCD9360_DMIC_CLK_DIV_2 0x0
-#define WCD9360_DMIC_CLK_DIV_3 0x1
-#define WCD9360_DMIC_CLK_DIV_4 0x2
-#define WCD9360_DMIC_CLK_DIV_6 0x3
-#define WCD9360_DMIC_CLK_DIV_8 0x4
-#define WCD9360_DMIC_CLK_DIV_16 0x5
-#define WCD9360_DMIC_CLK_DRIVE_DEFAULT 0x02
-
-#define WCD9360_ANC_DMIC_X2_FULL_RATE 1
-#define WCD9360_ANC_DMIC_X2_HALF_RATE 0
-
-#define PAHU_MAX_MICBIAS 4
-#define PAHU_NUM_INTERPOLATORS 10
-#define MAX_ON_DEMAND_SUPPLY_NAME_LENGTH 64
-
-/* Convert from vout ctl to micbias voltage in mV */
-#define WCD_VOUT_CTL_TO_MICB(v) (1000 + v * 50)
-
-
-/* Number of input and output Slimbus port */
-enum {
- WCD9360_RX0 = 0,
- WCD9360_RX1,
- WCD9360_RX2,
- WCD9360_RX3,
- WCD9360_RX4,
- WCD9360_RX5,
- WCD9360_RX6,
- WCD9360_RX7,
- WCD9360_RX_MAX,
-};
-
-enum {
- WCD9360_TX0 = 0,
- WCD9360_TX1,
- WCD9360_TX2,
- WCD9360_TX3,
- WCD9360_TX4,
- WCD9360_TX5,
- WCD9360_TX6,
- WCD9360_TX7,
- WCD9360_TX8,
- WCD9360_TX9,
- WCD9360_TX10,
- WCD9360_TX11,
- WCD9360_TX12,
- WCD9360_TX13,
- WCD9360_TX14,
- WCD9360_TX15,
- WCD9360_TX_MAX,
-};
-
-/*
- * Selects compander and smart boost settings
- * for a given speaker mode
- */
-enum {
- WCD9360_SPKR_MODE_DEFAULT,
- WCD9360_SPKR_MODE_1, /* COMP Gain = 12dB, Smartboost Max = 5.5V */
-};
-
-/*
- * Rx path gain offsets
- */
-enum {
- WCD9360_RX_GAIN_OFFSET_M1P5_DB,
- WCD9360_RX_GAIN_OFFSET_0_DB,
-};
-
-enum {
- WCD9360_MIC_BIAS_1 = 1,
- WCD9360_MIC_BIAS_2,
- WCD9360_MIC_BIAS_3,
- WCD9360_MIC_BIAS_4
-};
-
-enum {
- WCD9360_MICB_PULLUP_ENABLE,
- WCD9360_MICB_PULLUP_DISABLE,
- WCD9360_MICB_ENABLE,
- WCD9360_MICB_DISABLE,
-};
-
-/*
- * Dai data structure holds the
- * dai specific info like rate,
- * channel number etc.
- */
-struct pahu_codec_dai_data {
- u32 rate;
- u32 *ch_num;
- u32 ch_act;
- u32 ch_tot;
-};
-
-/*
- * Structure used to update codec
- * register defaults after reset
- */
-struct pahu_reg_mask_val {
- u16 reg;
- u8 mask;
- u8 val;
-};
-
-#if IS_ENABLED(CONFIG_SND_SOC_WCD9360)
-extern void *pahu_get_afe_config(struct snd_soc_codec *codec,
- enum afe_config_type config_type);
-extern int pahu_cdc_mclk_enable(struct snd_soc_codec *codec, bool enable);
-extern int pahu_cdc_mclk_tx_enable(struct snd_soc_codec *codec, bool enable);
-extern int pahu_set_spkr_mode(struct snd_soc_codec *codec, int mode);
-extern int pahu_set_spkr_gain_offset(struct snd_soc_codec *codec, int offset);
-extern void *pahu_get_wcd_dsp_cntl(struct device *dev);
-extern int wcd9360_get_micb_vout_ctl_val(u32 micb_mv);
-extern int pahu_codec_info_create_codec_entry(
- struct snd_info_entry *codec_root,
- struct snd_soc_codec *codec);
-#else
-extern void *pahu_get_afe_config(struct snd_soc_codec *codec,
- enum afe_config_type config_type)
-{
- return NULL;
-}
-extern int pahu_cdc_mclk_enable(struct snd_soc_codec *codec, bool enable)
-{
- return 0;
-}
-extern int pahu_cdc_mclk_tx_enable(struct snd_soc_codec *codec, bool enable)
-{
- return 0;
-}
-extern int pahu_set_spkr_mode(struct snd_soc_codec *codec, int mode)
-{
- return 0;
-}
-extern int pahu_set_spkr_gain_offset(struct snd_soc_codec *codec, int offset)
-{
- return 0;
-}
-extern void *pahu_get_wcd_dsp_cntl(struct device *dev)
-{
- return NULL;
-}
-extern int wcd9360_get_micb_vout_ctl_val(u32 micb_mv)
-{
- return 0;
-}
-extern int pahu_codec_info_create_codec_entry(
- struct snd_info_entry *codec_root,
- struct snd_soc_codec *codec)
-{
- return 0;
-}
-#endif
-
-#endif
diff --git a/asoc/codecs/wcd937x/Android.mk b/asoc/codecs/wcd937x/Android.mk
index fa54466..95d8058 100644
--- a/asoc/codecs/wcd937x/Android.mk
+++ b/asoc/codecs/wcd937x/Android.mk
@@ -9,7 +9,7 @@
AUDIO_CHIPSET := audio
# Build/Package only in case of supported target
-ifeq ($(call is-board-platform-in-list,msm8953 sdm845 sdm670 qcs605 msmnile $(MSMSTEPPE) $(TRINKET)),true)
+ifeq ($(call is-board-platform-in-list,$(MSMSTEPPE) $(TRINKET)),true)
LOCAL_PATH := $(call my-dir)
diff --git a/asoc/codecs/wcd9xxx-core.c b/asoc/codecs/wcd9xxx-core.c
index 76aea1a..4b7c580 100644
--- a/asoc/codecs/wcd9xxx-core.c
+++ b/asoc/codecs/wcd9xxx-core.c
@@ -88,7 +88,6 @@
[WCD9330] = WCD9330,
[WCD9335] = WCD9335,
[WCD934X] = WCD934X,
- [WCD9360] = WCD9360,
};
static const struct of_device_id wcd9xxx_of_match[] = {
@@ -330,8 +329,7 @@
struct slim_ele_access slim_msg;
mutex_lock(&wcd9xxx->io_lock);
- if (wcd9xxx->type == WCD9335 || wcd9xxx->type == WCD934X ||
- wcd9xxx->type == WCD9360) {
+ if (wcd9xxx->type == WCD9335 || wcd9xxx->type == WCD934X) {
ret = wcd9xxx_page_write(wcd9xxx, ®);
if (ret)
goto done;
@@ -1353,8 +1351,7 @@
* Vout_D to be ready after BUCK_SIDO is powered up.
* SYS_RST_N shouldn't be pulled high during this time
*/
- if (wcd9xxx->type == WCD9335 || wcd9xxx->type == WCD934X ||
- wcd9xxx->type == WCD9360)
+ if (wcd9xxx->type == WCD9335 || wcd9xxx->type == WCD934X)
usleep_range(600, 650);
else
usleep_range(5, 10);
@@ -1600,7 +1597,6 @@
{"tomtom-slim-pgd", WCD9330},
{"tasha-slim-pgd", WCD9335},
{"tavil-slim-pgd", WCD934X},
- {"pahu-slim-pgd", WCD9360},
{}
};
diff --git a/asoc/codecs/wcd9xxx-regmap.h b/asoc/codecs/wcd9xxx-regmap.h
index 18e0e58..1ac32bb 100644
--- a/asoc/codecs/wcd9xxx-regmap.h
+++ b/asoc/codecs/wcd9xxx-regmap.h
@@ -19,8 +19,6 @@
typedef int (*regmap_patch_fptr)(struct regmap *, int);
-extern struct regmap_config wcd9360_regmap_config;
-
extern struct regmap_config wcd934x_regmap_config;
extern int wcd934x_regmap_register_patch(struct regmap *regmap,
int version);
@@ -34,9 +32,6 @@
struct regmap_config *regmap_config;
switch (type) {
- case WCD9360:
- regmap_config = &wcd9360_regmap_config;
- break;
case WCD934X:
regmap_config = &wcd934x_regmap_config;
break;
diff --git a/asoc/codecs/wcd9xxx-rst.c b/asoc/codecs/wcd9xxx-rst.c
index 563dd78..c1f456c 100644
--- a/asoc/codecs/wcd9xxx-rst.c
+++ b/asoc/codecs/wcd9xxx-rst.c
@@ -22,8 +22,6 @@
#include "wcd9335_irq.h"
#include <asoc/wcd934x_registers.h>
#include "wcd934x/wcd934x_irq.h"
-#include <asoc/wcd9360-registers.h>
-#include "wcd9360/wcd9360-irq.h"
/* wcd9335 interrupt table */
static const struct intr_data wcd9335_intr_table[] = {
@@ -88,25 +86,6 @@
{WCD934X_IRQ_VBAT_RESTORE, false},
};
-static const struct intr_data wcd9360_intr_table[] = {
- {WCD9XXX_IRQ_SLIMBUS, false},
- {WCD9360_IRQ_MISC, false},
- {WCD9360_IRQ_LDO_RXTX_SCD, false},
- {WCD9360_IRQ_EAR_PA_SCD, false},
- {WCD9360_IRQ_AUX_PA_SCD, false},
- {WCD9360_IRQ_EAR_PA_CNP_COMPLETE, false},
- {WCD9360_IRQ_AUX_PA_CNP_COMPLETE, false},
- {WCD9360_IRQ_RESERVED_3, false},
- {WCD9360_IRQ_SOUNDWIRE, false},
- {WCD9360_IRQ_RCO_ERROR, false},
- {WCD9360_IRQ_CPE_ERROR, false},
- {WCD9360_IRQ_MAD_AUDIO, false},
- {WCD9360_IRQ_MAD_BEACON, false},
- {WCD9360_IRQ_CPE1_INTR, true},
- {WCD9360_IRQ_RESERVED_4, false},
- {WCD9360_IRQ_MAD_ULTRASOUND, false},
-};
-
/*
* wcd9335_bring_down: Bringdown WCD Codec
*
@@ -405,143 +384,11 @@
return rc;
}
-/*
- * wcd9360_bring_down: Bringdown WCD Codec
- *
- * @wcd9xxx: Pointer to wcd9xxx structure
- *
- * Returns 0 for success or negative error code for failure
- */
-static int wcd9360_bring_down(struct wcd9xxx *wcd9xxx)
-{
- if (!wcd9xxx || !wcd9xxx->regmap)
- return -EINVAL;
-
- regmap_write(wcd9xxx->regmap, WCD9360_CODEC_RPM_PWR_CDC_DIG_HM_CTL,
- 0x04);
-
- return 0;
-}
-
-/*
- * wcd9360_bring_up: Bringup WCD Codec
- *
- * @wcd9xxx: Pointer to the wcd9xxx structure
- *
- * Returns 0 for success or negative error code for failure
- */
-static int wcd9360_bring_up(struct wcd9xxx *wcd9xxx)
-{
- struct regmap *wcd_regmap;
-
- if (!wcd9xxx)
- return -EINVAL;
-
- if (!wcd9xxx->regmap) {
- dev_err(wcd9xxx->dev, "%s: wcd9xxx regmap is null!\n",
- __func__);
- return -EINVAL;
- }
- wcd_regmap = wcd9xxx->regmap;
-
- regmap_write(wcd_regmap, WCD9360_CODEC_RPM_RST_CTL, 0x01);
- regmap_write(wcd_regmap, WCD9360_SIDO_NEW_VOUT_A_STARTUP, 0x19);
- regmap_write(wcd_regmap, WCD9360_SIDO_NEW_VOUT_D_STARTUP, 0x15);
- /* Add 1msec delay for VOUT to settle */
- usleep_range(1000, 1100);
- regmap_write(wcd_regmap, WCD9360_CODEC_RPM_PWR_CDC_DIG_HM_CTL, 0x5);
- regmap_write(wcd_regmap, WCD9360_CODEC_RPM_PWR_CDC_DIG_HM_CTL, 0x7);
- regmap_write(wcd_regmap, WCD9360_CODEC_RPM_RST_CTL, 0x3);
- regmap_write(wcd_regmap, WCD9360_CODEC_RPM_RST_CTL, 0x7);
- regmap_write(wcd_regmap, WCD9360_CODEC_RPM_PWR_CDC_DIG_HM_CTL, 0x3);
-
- return 0;
-}
-
-/*
- * wcd9360_get_cdc_info: Get codec specific information
- *
- * @wcd9xxx: pointer to wcd9xxx structure
- * @wcd_type: pointer to wcd9xxx_codec_type structure
- *
- * Returns 0 for success or negative error code for failure
- */
-static int wcd9360_get_cdc_info(struct wcd9xxx *wcd9xxx,
- struct wcd9xxx_codec_type *wcd_type)
-{
- u16 id_minor, id_major;
- struct regmap *wcd_regmap;
- int rc, version = -1;
-
- if (!wcd9xxx || !wcd_type)
- return -EINVAL;
-
- if (!wcd9xxx->regmap) {
- dev_err(wcd9xxx->dev, "%s: wcd9xxx regmap is null\n", __func__);
- return -EINVAL;
- }
- wcd_regmap = wcd9xxx->regmap;
-
- rc = regmap_bulk_read(wcd_regmap, WCD9360_CHIP_TIER_CTRL_CHIP_ID_BYTE0,
- (u8 *)&id_minor, sizeof(u16));
- if (rc)
- return -EINVAL;
-
- rc = regmap_bulk_read(wcd_regmap, WCD9360_CHIP_TIER_CTRL_CHIP_ID_BYTE2,
- (u8 *)&id_major, sizeof(u16));
- if (rc)
- return -EINVAL;
-
- dev_info(wcd9xxx->dev, "%s: wcd9xxx chip id major 0x%x, minor 0x%x\n",
- __func__, id_major, id_minor);
-
- if (id_major != PAHU_MAJOR)
- goto version_unknown;
-
- /*
- * As fine version info cannot be retrieved before pahu probe.
- * Assign coarse versions for possible future use before Pahu probe.
- */
- if (id_minor == cpu_to_le16(0))
- version = PAHU_VERSION_1_0;
-
-version_unknown:
- if (version < 0)
- dev_err(wcd9xxx->dev, "%s: wcd934x version unknown\n",
- __func__);
-
- /* Fill codec type info */
- wcd_type->id_major = id_major;
- wcd_type->id_minor = id_minor;
- wcd_type->num_irqs = WCD9360_NUM_IRQS;
- wcd_type->version = version;
- wcd_type->slim_slave_type = WCD9XXX_SLIM_SLAVE_ADDR_TYPE_1;
- wcd_type->i2c_chip_status = 0x01;
- wcd_type->intr_tbl = wcd9360_intr_table;
- wcd_type->intr_tbl_size = ARRAY_SIZE(wcd9360_intr_table);
-
- wcd_type->intr_reg[WCD9XXX_INTR_STATUS_BASE] =
- WCD9360_INTR_PIN1_STATUS0;
- wcd_type->intr_reg[WCD9XXX_INTR_CLEAR_BASE] =
- WCD9360_INTR_PIN1_CLEAR0;
- wcd_type->intr_reg[WCD9XXX_INTR_MASK_BASE] =
- WCD9360_INTR_PIN1_MASK0;
- wcd_type->intr_reg[WCD9XXX_INTR_LEVEL_BASE] =
- WCD9360_INTR_LEVEL0;
- wcd_type->intr_reg[WCD9XXX_INTR_CLR_COMMIT] =
- WCD9360_INTR_CLR_COMMIT;
-
- return rc;
-}
-
codec_bringdown_fn wcd9xxx_bringdown_fn(int type)
{
codec_bringdown_fn cdc_bdown_fn;
switch (type) {
- case WCD9360:
- cdc_bdown_fn = wcd9360_bring_down;
- break;
case WCD934X:
cdc_bdown_fn = wcd934x_bring_down;
break;
@@ -561,9 +408,6 @@
codec_bringup_fn cdc_bup_fn;
switch (type) {
- case WCD9360:
- cdc_bup_fn = wcd9360_bring_up;
- break;
case WCD934X:
cdc_bup_fn = wcd934x_bring_up;
break;
@@ -583,9 +427,6 @@
codec_type_fn cdc_type_fn;
switch (type) {
- case WCD9360:
- cdc_type_fn = wcd9360_get_cdc_info;
- break;
case WCD934X:
cdc_type_fn = wcd934x_get_cdc_info;
break;
diff --git a/asoc/codecs/wcd9xxx-utils.c b/asoc/codecs/wcd9xxx-utils.c
index 7dc18f6..8ca55f8 100644
--- a/asoc/codecs/wcd9xxx-utils.c
+++ b/asoc/codecs/wcd9xxx-utils.c
@@ -38,16 +38,6 @@
static enum wcd9xxx_intf_status wcd9xxx_intf = -1;
-static struct mfd_cell pahu_devs[] = {
- {
- .name = "qcom-wcd-pinctrl",
- .of_compatible = "qcom,wcd-pinctrl",
- },
- {
- .name = "pahu_codec",
- },
-};
-
static struct mfd_cell tavil_devs[] = {
{
.name = "qcom-wcd-pinctrl",
@@ -490,8 +480,7 @@
unsigned short c_reg, reg_addr;
u8 pg_num, prev_pg_num;
- if (wcd9xxx->type != WCD9335 && wcd9xxx->type != WCD934X &&
- wcd9xxx->type != WCD9360)
+ if (wcd9xxx->type != WCD9335 && wcd9xxx->type != WCD934X)
return ret;
c_reg = *reg;
@@ -888,10 +877,6 @@
}
switch (wcd9xxx->type) {
- case WCD9360:
- cinfo->dev = pahu_devs;
- cinfo->size = ARRAY_SIZE(pahu_devs);
- break;
case WCD934X:
cinfo->dev = tavil_devs;
cinfo->size = ARRAY_SIZE(tavil_devs);
diff --git a/asoc/msm-compress-q6-v2.c b/asoc/msm-compress-q6-v2.c
index d35ed89..97cd85b 100644
--- a/asoc/msm-compress-q6-v2.c
+++ b/asoc/msm-compress-q6-v2.c
@@ -79,6 +79,8 @@
#define MAX_NUMBER_OF_STREAMS 2
+#define SND_DEC_DDP_MAX_PARAMS 18
+
struct msm_compr_gapless_state {
bool set_next_stream_id;
int32_t stream_opened[MAX_NUMBER_OF_STREAMS];
@@ -199,6 +201,12 @@
struct query_audio_effect query;
};
+struct snd_dec_ddp {
+ __u32 params_length;
+ __u32 params_id[SND_DEC_DDP_MAX_PARAMS];
+ __u32 params_value[SND_DEC_DDP_MAX_PARAMS];
+} __attribute__((packed, aligned(4)));
+
struct msm_compr_dec_params {
struct snd_dec_ddp ddp_params;
};
diff --git a/asoc/msm8998.c b/asoc/msm8998.c
deleted file mode 100644
index 1faa193..0000000
--- a/asoc/msm8998.c
+++ /dev/null
@@ -1,7483 +0,0 @@
-/*
- * Copyright (c) 2016-2018, 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.
- */
-
-#include <linux/clk.h>
-#include <linux/delay.h>
-#include <linux/gpio.h>
-#include <linux/of_gpio.h>
-#include <linux/platform_device.h>
-#include <linux/slab.h>
-#include <linux/regulator/consumer.h>
-#include <linux/io.h>
-#include <linux/module.h>
-#include <linux/switch.h>
-#include <linux/input.h>
-#include <linux/of_device.h>
-#include <sound/core.h>
-#include <sound/soc.h>
-#include <sound/soc-dapm.h>
-#include <sound/pcm.h>
-#include <sound/jack.h>
-#include <sound/pcm_params.h>
-#include <sound/info.h>
-#include <device_event.h>
-#include <dsp/audio_notifier.h>
-#include <dsp/q6afe-v2.h>
-#include <dsp/q6core.h>
-#include "msm-pcm-routing-v2.h"
-#include "codecs/msm-cdc-pinctrl.h"
-#include "codecs/wcd9335.h"
-#include "codecs/wcd934x/wcd934x.h"
-#include "codecs/wcd934x/wcd934x-mbhc.h"
-#include "codecs/wsa881x.h"
-
-#define DRV_NAME "msm8998-asoc-snd"
-
-#define __CHIPSET__ "MSM8998 "
-#define MSM_DAILINK_NAME(name) (__CHIPSET__#name)
-
-#define SAMPLING_RATE_8KHZ 8000
-#define SAMPLING_RATE_11P025KHZ 11025
-#define SAMPLING_RATE_16KHZ 16000
-#define SAMPLING_RATE_22P05KHZ 22050
-#define SAMPLING_RATE_32KHZ 32000
-#define SAMPLING_RATE_44P1KHZ 44100
-#define SAMPLING_RATE_48KHZ 48000
-#define SAMPLING_RATE_88P2KHZ 88200
-#define SAMPLING_RATE_96KHZ 96000
-#define SAMPLING_RATE_176P4KHZ 176400
-#define SAMPLING_RATE_192KHZ 192000
-#define SAMPLING_RATE_352P8KHZ 352800
-#define SAMPLING_RATE_384KHZ 384000
-
-#define WCD9XXX_MBHC_DEF_BUTTONS 8
-#define WCD9XXX_MBHC_DEF_RLOADS 5
-#define CODEC_EXT_CLK_RATE 9600000
-#define ADSP_STATE_READY_TIMEOUT_MS 3000
-#define DEV_NAME_STR_LEN 32
-
-#define WSA8810_NAME_1 "wsa881x.20170211"
-#define WSA8810_NAME_2 "wsa881x.20170212"
-
-#define WCN_CDC_SLIM_RX_CH_MAX 2
-#define WCN_CDC_SLIM_TX_CH_MAX 3
-
-#define TDM_CHANNEL_MAX 8
-#define TDM_SLOT_OFFSET_MAX 8
-
-#define MSM_HIFI_ON 1
-
-enum {
- SLIM_RX_0 = 0,
- SLIM_RX_1,
- SLIM_RX_2,
- SLIM_RX_3,
- SLIM_RX_4,
- SLIM_RX_5,
- SLIM_RX_6,
- SLIM_RX_7,
- SLIM_RX_MAX,
-};
-
-enum {
- SLIM_TX_0 = 0,
- SLIM_TX_1,
- SLIM_TX_2,
- SLIM_TX_3,
- SLIM_TX_4,
- SLIM_TX_5,
- SLIM_TX_6,
- SLIM_TX_7,
- SLIM_TX_8,
- SLIM_TX_MAX,
-};
-
-enum {
- PRIM_MI2S = 0,
- SEC_MI2S,
- TERT_MI2S,
- QUAT_MI2S,
- MI2S_MAX,
-};
-
-enum {
- PRIM_AUX_PCM = 0,
- SEC_AUX_PCM,
- TERT_AUX_PCM,
- QUAT_AUX_PCM,
- AUX_PCM_MAX,
-};
-
-enum {
- PCM_I2S_SEL_PRIM = 0,
- PCM_I2S_SEL_SEC,
- PCM_I2S_SEL_TERT,
- PCM_I2S_SEL_QUAT,
- PCM_I2S_SEL_MAX,
-};
-
-struct mi2s_aux_pcm_common_conf {
- struct mutex lock;
- void *pcm_i2s_sel_vt_addr;
-};
-
-struct mi2s_conf {
- struct mutex lock;
- u32 ref_cnt;
- u32 msm_is_mi2s_master;
-};
-
-struct auxpcm_conf {
- struct mutex lock;
- u32 ref_cnt;
-};
-
-struct dev_config {
- u32 sample_rate;
- u32 bit_format;
- u32 channels;
-};
-
-enum {
- HDMI_RX_IDX = 0,
- DP_RX_IDX,
- EXT_DISP_RX_IDX_MAX,
-};
-
-struct msm_wsa881x_dev_info {
- struct device_node *of_node;
- u32 index;
-};
-
-enum pinctrl_pin_state {
- STATE_DISABLE = 0, /* All pins are in sleep state */
- STATE_MI2S_ACTIVE, /* IS2 = active, TDM = sleep */
- STATE_TDM_ACTIVE, /* IS2 = sleep, TDM = active */
-};
-
-struct msm_pinctrl_info {
- struct pinctrl *pinctrl;
- struct pinctrl_state *mi2s_disable;
- struct pinctrl_state *tdm_disable;
- struct pinctrl_state *mi2s_active;
- struct pinctrl_state *tdm_active;
- enum pinctrl_pin_state curr_state;
-};
-
-struct msm_asoc_mach_data {
- u32 mclk_freq;
- int us_euro_gpio; /* used by gpio driver API */
- struct device_node *us_euro_gpio_p; /* used by pinctrl API */
- struct device_node *hph_en1_gpio_p; /* used by pinctrl API */
- struct device_node *hph_en0_gpio_p; /* used by pinctrl API */
- struct snd_info_entry *codec_root;
- struct msm_pinctrl_info pinctrl_info;
-};
-
-struct msm_asoc_wcd93xx_codec {
- void* (*get_afe_config_fn)(struct snd_soc_codec *codec,
- enum afe_config_type config_type);
- void (*mbhc_hs_detect_exit)(struct snd_soc_codec *codec);
-};
-
-static const char *const pin_states[] = {"sleep", "i2s-active",
- "tdm-active"};
-
-enum {
- TDM_0 = 0,
- TDM_1,
- TDM_2,
- TDM_3,
- TDM_4,
- TDM_5,
- TDM_6,
- TDM_7,
- TDM_PORT_MAX,
-};
-
-enum {
- TDM_PRI = 0,
- TDM_SEC,
- TDM_TERT,
- TDM_QUAT,
- TDM_INTERFACE_MAX,
-};
-
-struct tdm_port {
- u32 mode;
- u32 channel;
-};
-
-/* TDM default config */
-static struct dev_config tdm_rx_cfg[TDM_INTERFACE_MAX][TDM_PORT_MAX] = {
- { /* PRI TDM */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_0 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_1 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_2 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_3 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_4 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_5 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_6 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_7 */
- },
- { /* SEC TDM */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_0 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_1 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_2 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_3 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_4 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_5 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_6 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_7 */
- },
- { /* TERT TDM */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_0 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_1 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_2 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_3 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_4 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_5 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_6 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_7 */
- },
- { /* QUAT TDM */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_0 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_1 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_2 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_3 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_4 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_5 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_6 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_7 */
- }
-};
-
-/* TDM default config */
-static struct dev_config tdm_tx_cfg[TDM_INTERFACE_MAX][TDM_PORT_MAX] = {
- { /* PRI TDM */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_0 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_1 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_2 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_3 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_4 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_5 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_6 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_7 */
- },
- { /* SEC TDM */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_0 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_1 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_2 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_3 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_4 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_5 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_6 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_7 */
- },
- { /* TERT TDM */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_0 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_1 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_2 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_3 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_4 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_5 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_6 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_7 */
- },
- { /* QUAT TDM */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_0 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_1 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_2 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_3 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_4 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_5 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_6 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_7 */
- }
-};
-
-/*TDM default offset currently only supporting TDM_RX_0 and TDM_TX_0 */
-static unsigned int tdm_slot_offset[TDM_PORT_MAX][TDM_SLOT_OFFSET_MAX] = {
- {0, 4, 8, 12, 16, 20, 24, 28},/* TX_0 | RX_0 */
- {AFE_SLOT_MAPPING_OFFSET_INVALID},/* TX_1 | RX_1 */
- {AFE_SLOT_MAPPING_OFFSET_INVALID},/* TX_2 | RX_2 */
- {AFE_SLOT_MAPPING_OFFSET_INVALID},/* TX_3 | RX_3 */
- {AFE_SLOT_MAPPING_OFFSET_INVALID},/* TX_4 | RX_4 */
- {AFE_SLOT_MAPPING_OFFSET_INVALID},/* TX_5 | RX_5 */
- {AFE_SLOT_MAPPING_OFFSET_INVALID},/* TX_6 | RX_6 */
- {AFE_SLOT_MAPPING_OFFSET_INVALID},/* TX_7 | RX_7 */
-};
-
-/* Default configuration of slimbus channels */
-static struct dev_config slim_rx_cfg[] = {
- [SLIM_RX_0] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_RX_1] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_RX_2] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_RX_3] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_RX_4] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_RX_5] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_RX_6] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_RX_7] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
-};
-
-static struct dev_config slim_tx_cfg[] = {
- [SLIM_TX_0] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_TX_1] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_TX_2] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_TX_3] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_TX_4] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_TX_5] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_TX_6] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_TX_7] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_TX_8] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 2},
-};
-
-
-/* Default configuration of external display BE */
-static struct dev_config ext_disp_rx_cfg[] = {
- [HDMI_RX_IDX] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 2},
- [DP_RX_IDX] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 2},
-};
-
-static struct dev_config usb_rx_cfg = {
- .sample_rate = SAMPLING_RATE_48KHZ,
- .bit_format = SNDRV_PCM_FORMAT_S16_LE,
- .channels = 2,
-};
-
-static struct dev_config usb_tx_cfg = {
- .sample_rate = SAMPLING_RATE_48KHZ,
- .bit_format = SNDRV_PCM_FORMAT_S16_LE,
- .channels = 1,
-};
-
-static struct dev_config proxy_rx_cfg = {
- .sample_rate = SAMPLING_RATE_48KHZ,
- .bit_format = SNDRV_PCM_FORMAT_S16_LE,
- .channels = 2,
-};
-
-/* Default configuration of MI2S channels */
-static struct dev_config mi2s_rx_cfg[] = {
- [PRIM_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 2},
- [SEC_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 2},
- [TERT_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 2},
- [QUAT_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 2},
-};
-
-static struct dev_config mi2s_tx_cfg[] = {
- [PRIM_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SEC_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [TERT_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [QUAT_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
-};
-
-static struct dev_config aux_pcm_rx_cfg[] = {
- [PRIM_AUX_PCM] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SEC_AUX_PCM] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [TERT_AUX_PCM] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [QUAT_AUX_PCM] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
-};
-
-static struct dev_config aux_pcm_tx_cfg[] = {
- [PRIM_AUX_PCM] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SEC_AUX_PCM] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [TERT_AUX_PCM] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [QUAT_AUX_PCM] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
-};
-
-static int msm_vi_feed_tx_ch = 2;
-static const char *const slim_rx_ch_text[] = {"One", "Two"};
-static const char *const slim_tx_ch_text[] = {"One", "Two", "Three", "Four",
- "Five", "Six", "Seven",
- "Eight"};
-static const char *const vi_feed_ch_text[] = {"One", "Two"};
-static char const *bit_format_text[] = {"S16_LE", "S24_LE", "S24_3LE",
- "S32_LE"};
-static char const *ext_disp_bit_format_text[] = {"S16_LE", "S24_LE"};
-static char const *slim_sample_rate_text[] = {"KHZ_8", "KHZ_16",
- "KHZ_32", "KHZ_44P1", "KHZ_48",
- "KHZ_88P2", "KHZ_96", "KHZ_176P4",
- "KHZ_192", "KHZ_352P8", "KHZ_384"};
-static char const *bt_sample_rate_text[] = {"KHZ_8", "KHZ_16", "KHZ_48"};
-static const char *const usb_ch_text[] = {"One", "Two", "Three", "Four",
- "Five", "Six", "Seven",
- "Eight"};
-static char const *ch_text[] = {"Two", "Three", "Four", "Five",
- "Six", "Seven", "Eight"};
-static char const *usb_sample_rate_text[] = {"KHZ_8", "KHZ_11P025",
- "KHZ_16", "KHZ_22P05",
- "KHZ_32", "KHZ_44P1", "KHZ_48",
- "KHZ_88P2", "KHZ_96", "KHZ_176P4",
- "KHZ_192", "KHZ_352P8", "KHZ_384"};
-static char const *ext_disp_sample_rate_text[] = {"KHZ_48", "KHZ_96",
- "KHZ_192", "KHZ_32", "KHZ_44P1",
- "KHZ_88P2", "KHZ_176P4"};
-static char const *tdm_ch_text[] = {"One", "Two", "Three", "Four",
- "Five", "Six", "Seven", "Eight"};
-static char const *tdm_bit_format_text[] = {"S16_LE", "S24_LE", "S32_LE"};
-static char const *tdm_sample_rate_text[] = {"KHZ_8", "KHZ_16", "KHZ_32",
- "KHZ_44P1", "KHZ_48", "KHZ_96",
- "KHZ_192", "KHZ_352P8", "KHZ_384"};
-static const char *const auxpcm_rate_text[] = {"KHZ_8", "KHZ_16"};
-static char const *mi2s_rate_text[] = {"KHZ_8", "KHZ_16",
- "KHZ_32", "KHZ_44P1", "KHZ_48",
- "KHZ_96", "KHZ_192"};
-static const char *const mi2s_ch_text[] = {"One", "Two", "Three", "Four",
- "Five", "Six", "Seven",
- "Eight"};
-static const char *const hifi_text[] = {"Off", "On"};
-
-static SOC_ENUM_SINGLE_EXT_DECL(slim_0_rx_chs, slim_rx_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_2_rx_chs, slim_rx_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_0_tx_chs, slim_tx_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_1_tx_chs, slim_tx_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_5_rx_chs, slim_rx_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_6_rx_chs, slim_rx_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(usb_rx_chs, usb_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(usb_tx_chs, usb_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(vi_feed_tx_chs, vi_feed_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(ext_disp_rx_chs, ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(proxy_rx_chs, ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_0_rx_format, bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_5_rx_format, bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_6_rx_format, bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_0_tx_format, bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(usb_rx_format, bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(usb_tx_format, bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(ext_disp_rx_format, ext_disp_bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_0_rx_sample_rate, slim_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_2_rx_sample_rate, slim_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_0_tx_sample_rate, slim_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_5_rx_sample_rate, slim_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_6_rx_sample_rate, slim_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(bt_sample_rate, bt_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(usb_rx_sample_rate, usb_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(usb_tx_sample_rate, usb_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(ext_disp_rx_sample_rate,
- ext_disp_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tdm_tx_chs, tdm_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tdm_tx_format, tdm_bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tdm_tx_sample_rate, tdm_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tdm_rx_chs, tdm_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tdm_rx_format, tdm_bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tdm_rx_sample_rate, tdm_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(prim_aux_pcm_rx_sample_rate, auxpcm_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(sec_aux_pcm_rx_sample_rate, auxpcm_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tert_aux_pcm_rx_sample_rate, auxpcm_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(quat_aux_pcm_rx_sample_rate, auxpcm_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(prim_aux_pcm_tx_sample_rate, auxpcm_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(sec_aux_pcm_tx_sample_rate, auxpcm_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tert_aux_pcm_tx_sample_rate, auxpcm_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(quat_aux_pcm_tx_sample_rate, auxpcm_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(prim_mi2s_rx_sample_rate, mi2s_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(sec_mi2s_rx_sample_rate, mi2s_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tert_mi2s_rx_sample_rate, mi2s_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(quat_mi2s_rx_sample_rate, mi2s_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(prim_mi2s_tx_sample_rate, mi2s_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(sec_mi2s_tx_sample_rate, mi2s_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tert_mi2s_tx_sample_rate, mi2s_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(quat_mi2s_tx_sample_rate, mi2s_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(prim_mi2s_rx_chs, mi2s_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(prim_mi2s_tx_chs, mi2s_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(sec_mi2s_rx_chs, mi2s_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(sec_mi2s_tx_chs, mi2s_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tert_mi2s_rx_chs, mi2s_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tert_mi2s_tx_chs, mi2s_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(quat_mi2s_rx_chs, mi2s_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(quat_mi2s_tx_chs, mi2s_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(mi2s_rx_format, bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(mi2s_tx_format, bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(hifi_function, hifi_text);
-
-static struct platform_device *spdev;
-static int msm_hifi_control;
-
-static bool is_initial_boot;
-static bool codec_reg_done;
-static struct snd_soc_aux_dev *msm_aux_dev;
-static struct snd_soc_codec_conf *msm_codec_conf;
-static struct msm_asoc_wcd93xx_codec msm_codec_fn;
-
-static void *def_tasha_mbhc_cal(void);
-static void *def_tavil_mbhc_cal(void);
-static int msm_snd_enable_codec_ext_clk(struct snd_soc_codec *codec,
- int enable, bool dapm);
-static int msm_wsa881x_init(struct snd_soc_component *component);
-
-/*
- * Need to report LINEIN
- * if R/L channel impedance is larger than 5K ohm
- */
-static struct wcd_mbhc_config wcd_mbhc_cfg = {
- .read_fw_bin = false,
- .calibration = NULL,
- .detect_extn_cable = true,
- .mono_stero_detection = false,
- .swap_gnd_mic = NULL,
- .hs_ext_micbias = true,
- .key_code[0] = KEY_MEDIA,
- .key_code[1] = KEY_VOICECOMMAND,
- .key_code[2] = KEY_VOLUMEUP,
- .key_code[3] = KEY_VOLUMEDOWN,
- .key_code[4] = 0,
- .key_code[5] = 0,
- .key_code[6] = 0,
- .key_code[7] = 0,
- .linein_th = 5000,
- .moisture_en = true,
- .mbhc_micbias = MIC_BIAS_2,
- .anc_micbias = MIC_BIAS_2,
- .enable_anc_mic_detect = false,
-};
-
-static struct snd_soc_dapm_route wcd_audio_paths_tasha[] = {
- {"MIC BIAS1", NULL, "MCLK TX"},
- {"MIC BIAS2", NULL, "MCLK TX"},
- {"MIC BIAS3", NULL, "MCLK TX"},
- {"MIC BIAS4", NULL, "MCLK TX"},
-};
-
-static struct snd_soc_dapm_route wcd_audio_paths[] = {
- {"MIC BIAS1", NULL, "MCLK"},
- {"MIC BIAS2", NULL, "MCLK"},
- {"MIC BIAS3", NULL, "MCLK"},
- {"MIC BIAS4", NULL, "MCLK"},
-};
-
-static struct afe_clk_set mi2s_clk[MI2S_MAX] = {
- {
- AFE_API_VERSION_I2S_CONFIG,
- Q6AFE_LPASS_CLK_ID_PRI_MI2S_IBIT,
- Q6AFE_LPASS_IBIT_CLK_1_P536_MHZ,
- Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO,
- Q6AFE_LPASS_CLK_ROOT_DEFAULT,
- 0,
- },
- {
- AFE_API_VERSION_I2S_CONFIG,
- Q6AFE_LPASS_CLK_ID_SEC_MI2S_IBIT,
- Q6AFE_LPASS_IBIT_CLK_1_P536_MHZ,
- Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO,
- Q6AFE_LPASS_CLK_ROOT_DEFAULT,
- 0,
- },
- {
- AFE_API_VERSION_I2S_CONFIG,
- Q6AFE_LPASS_CLK_ID_TER_MI2S_IBIT,
- Q6AFE_LPASS_IBIT_CLK_1_P536_MHZ,
- Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO,
- Q6AFE_LPASS_CLK_ROOT_DEFAULT,
- 0,
- },
- {
- AFE_API_VERSION_I2S_CONFIG,
- Q6AFE_LPASS_CLK_ID_QUAD_MI2S_IBIT,
- Q6AFE_LPASS_IBIT_CLK_1_P536_MHZ,
- Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO,
- Q6AFE_LPASS_CLK_ROOT_DEFAULT,
- 0,
- }
-};
-
-static struct mi2s_aux_pcm_common_conf mi2s_auxpcm_conf[PCM_I2S_SEL_MAX];
-static struct mi2s_conf mi2s_intf_conf[MI2S_MAX];
-static struct auxpcm_conf auxpcm_intf_conf[AUX_PCM_MAX];
-
-static int slim_get_sample_rate_val(int sample_rate)
-{
- int sample_rate_val = 0;
-
- switch (sample_rate) {
- case SAMPLING_RATE_8KHZ:
- sample_rate_val = 0;
- break;
- case SAMPLING_RATE_16KHZ:
- sample_rate_val = 1;
- break;
- case SAMPLING_RATE_32KHZ:
- sample_rate_val = 2;
- break;
- case SAMPLING_RATE_44P1KHZ:
- sample_rate_val = 3;
- break;
- case SAMPLING_RATE_48KHZ:
- sample_rate_val = 4;
- break;
- case SAMPLING_RATE_88P2KHZ:
- sample_rate_val = 5;
- break;
- case SAMPLING_RATE_96KHZ:
- sample_rate_val = 6;
- break;
- case SAMPLING_RATE_176P4KHZ:
- sample_rate_val = 7;
- break;
- case SAMPLING_RATE_192KHZ:
- sample_rate_val = 8;
- break;
- case SAMPLING_RATE_352P8KHZ:
- sample_rate_val = 9;
- break;
- case SAMPLING_RATE_384KHZ:
- sample_rate_val = 10;
- break;
- default:
- sample_rate_val = 4;
- break;
- }
- return sample_rate_val;
-}
-
-static int slim_get_sample_rate(int value)
-{
- int sample_rate = 0;
-
- switch (value) {
- case 0:
- sample_rate = SAMPLING_RATE_8KHZ;
- break;
- case 1:
- sample_rate = SAMPLING_RATE_16KHZ;
- break;
- case 2:
- sample_rate = SAMPLING_RATE_32KHZ;
- break;
- case 3:
- sample_rate = SAMPLING_RATE_44P1KHZ;
- break;
- case 4:
- sample_rate = SAMPLING_RATE_48KHZ;
- break;
- case 5:
- sample_rate = SAMPLING_RATE_88P2KHZ;
- break;
- case 6:
- sample_rate = SAMPLING_RATE_96KHZ;
- break;
- case 7:
- sample_rate = SAMPLING_RATE_176P4KHZ;
- break;
- case 8:
- sample_rate = SAMPLING_RATE_192KHZ;
- break;
- case 9:
- sample_rate = SAMPLING_RATE_352P8KHZ;
- break;
- case 10:
- sample_rate = SAMPLING_RATE_384KHZ;
- break;
- default:
- sample_rate = SAMPLING_RATE_48KHZ;
- break;
- }
- return sample_rate;
-}
-
-static int slim_get_bit_format_val(int bit_format)
-{
- int val = 0;
-
- switch (bit_format) {
- case SNDRV_PCM_FORMAT_S32_LE:
- val = 3;
- break;
- case SNDRV_PCM_FORMAT_S24_3LE:
- val = 2;
- break;
- case SNDRV_PCM_FORMAT_S24_LE:
- val = 1;
- break;
- case SNDRV_PCM_FORMAT_S16_LE:
- default:
- val = 0;
- break;
- }
- return val;
-}
-
-static int slim_get_bit_format(int val)
-{
- int bit_fmt = SNDRV_PCM_FORMAT_S16_LE;
-
- switch (val) {
- case 0:
- bit_fmt = SNDRV_PCM_FORMAT_S16_LE;
- break;
- case 1:
- bit_fmt = SNDRV_PCM_FORMAT_S24_LE;
- break;
- case 2:
- bit_fmt = SNDRV_PCM_FORMAT_S24_3LE;
- break;
- case 3:
- bit_fmt = SNDRV_PCM_FORMAT_S32_LE;
- break;
- default:
- bit_fmt = SNDRV_PCM_FORMAT_S16_LE;
- break;
- }
- return bit_fmt;
-}
-
-static int slim_get_port_idx(struct snd_kcontrol *kcontrol)
-{
- int port_id = 0;
-
- if (strnstr(kcontrol->id.name, "SLIM_0_RX", sizeof("SLIM_0_RX")))
- port_id = SLIM_RX_0;
- else if (strnstr(kcontrol->id.name, "SLIM_2_RX", sizeof("SLIM_2_RX")))
- port_id = SLIM_RX_2;
- else if (strnstr(kcontrol->id.name, "SLIM_5_RX", sizeof("SLIM_5_RX")))
- port_id = SLIM_RX_5;
- else if (strnstr(kcontrol->id.name, "SLIM_6_RX", sizeof("SLIM_6_RX")))
- port_id = SLIM_RX_6;
- else if (strnstr(kcontrol->id.name, "SLIM_0_TX", sizeof("SLIM_0_TX")))
- port_id = SLIM_TX_0;
- else if (strnstr(kcontrol->id.name, "SLIM_1_TX", sizeof("SLIM_1_TX")))
- port_id = SLIM_TX_1;
- else {
- pr_err("%s: unsupported channel: %s",
- __func__, kcontrol->id.name);
- return -EINVAL;
- }
-
- return port_id;
-}
-
-static int slim_rx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- ucontrol->value.enumerated.item[0] =
- slim_get_sample_rate_val(slim_rx_cfg[ch_num].sample_rate);
-
- pr_debug("%s: slim[%d]_rx_sample_rate = %d, item = %d\n", __func__,
- ch_num, slim_rx_cfg[ch_num].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int slim_rx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- slim_rx_cfg[ch_num].sample_rate =
- slim_get_sample_rate(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: slim[%d]_rx_sample_rate = %d, item = %d\n", __func__,
- ch_num, slim_rx_cfg[ch_num].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int slim_tx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- ucontrol->value.enumerated.item[0] =
- slim_get_sample_rate_val(slim_tx_cfg[ch_num].sample_rate);
-
- pr_debug("%s: slim[%d]_tx_sample_rate = %d, item = %d\n", __func__,
- ch_num, slim_tx_cfg[ch_num].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int slim_tx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int sample_rate = 0;
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- sample_rate = slim_get_sample_rate(ucontrol->value.enumerated.item[0]);
- if (sample_rate == SAMPLING_RATE_44P1KHZ) {
- pr_err("%s: Unsupported sample rate %d: for Tx path\n",
- __func__, sample_rate);
- return -EINVAL;
- }
- slim_tx_cfg[ch_num].sample_rate = sample_rate;
-
- pr_debug("%s: slim[%d]_tx_sample_rate = %d, value = %d\n", __func__,
- ch_num, slim_tx_cfg[ch_num].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int slim_rx_bit_format_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- ucontrol->value.enumerated.item[0] =
- slim_get_bit_format_val(slim_rx_cfg[ch_num].bit_format);
-
- pr_debug("%s: slim[%d]_rx_bit_format = %d, ucontrol value = %d\n",
- __func__, ch_num, slim_rx_cfg[ch_num].bit_format,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int slim_rx_bit_format_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- slim_rx_cfg[ch_num].bit_format =
- slim_get_bit_format(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: slim[%d]_rx_bit_format = %d, ucontrol value = %d\n",
- __func__, ch_num, slim_rx_cfg[ch_num].bit_format,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int slim_tx_bit_format_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- ucontrol->value.enumerated.item[0] =
- slim_get_bit_format_val(slim_tx_cfg[ch_num].bit_format);
-
- pr_debug("%s: slim[%d]_tx_bit_format = %d, ucontrol value = %d\n",
- __func__, ch_num, slim_tx_cfg[ch_num].bit_format,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int slim_tx_bit_format_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- slim_tx_cfg[ch_num].bit_format =
- slim_get_bit_format(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: slim[%d]_tx_bit_format = %d, ucontrol value = %d\n",
- __func__, ch_num, slim_tx_cfg[ch_num].bit_format,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int msm_slim_rx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- pr_debug("%s: msm_slim_[%d]_rx_ch = %d\n", __func__,
- ch_num, slim_rx_cfg[ch_num].channels);
- ucontrol->value.enumerated.item[0] = slim_rx_cfg[ch_num].channels - 1;
-
- return 0;
-}
-
-static int msm_slim_rx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- slim_rx_cfg[ch_num].channels = ucontrol->value.enumerated.item[0] + 1;
- pr_debug("%s: msm_slim_[%d]_rx_ch = %d\n", __func__,
- ch_num, slim_rx_cfg[ch_num].channels);
-
- return 1;
-}
-
-static int msm_slim_tx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- pr_debug("%s: msm_slim_[%d]_tx_ch = %d\n", __func__,
- ch_num, slim_tx_cfg[ch_num].channels);
- ucontrol->value.enumerated.item[0] = slim_tx_cfg[ch_num].channels - 1;
-
- return 0;
-}
-
-static int msm_slim_tx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- slim_tx_cfg[ch_num].channels = ucontrol->value.enumerated.item[0] + 1;
- pr_debug("%s: msm_slim_[%d]_tx_ch = %d\n", __func__,
- ch_num, slim_tx_cfg[ch_num].channels);
-
- return 1;
-}
-
-static int msm_vi_feed_tx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- ucontrol->value.integer.value[0] = msm_vi_feed_tx_ch - 1;
- pr_debug("%s: msm_vi_feed_tx_ch = %ld\n", __func__,
- ucontrol->value.integer.value[0]);
- return 0;
-}
-
-static int msm_vi_feed_tx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- msm_vi_feed_tx_ch = ucontrol->value.integer.value[0] + 1;
-
- pr_debug("%s: msm_vi_feed_tx_ch = %d\n", __func__, msm_vi_feed_tx_ch);
- return 1;
-}
-
-static int msm_bt_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- /*
- * Slimbus_7_Rx/Tx sample rate values should always be in sync (same)
- * when used for BT_SCO use case. Return either Rx or Tx sample rate
- * value.
- */
- switch (slim_rx_cfg[SLIM_RX_7].sample_rate) {
- case SAMPLING_RATE_48KHZ:
- ucontrol->value.integer.value[0] = 2;
- break;
- case SAMPLING_RATE_16KHZ:
- ucontrol->value.integer.value[0] = 1;
- break;
- case SAMPLING_RATE_8KHZ:
- default:
- ucontrol->value.integer.value[0] = 0;
- break;
- }
- pr_debug("%s: sample rate = %d", __func__,
- slim_rx_cfg[SLIM_RX_7].sample_rate);
-
- return 0;
-}
-
-static int msm_bt_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- switch (ucontrol->value.integer.value[0]) {
- case 1:
- slim_rx_cfg[SLIM_RX_7].sample_rate = SAMPLING_RATE_16KHZ;
- slim_tx_cfg[SLIM_TX_7].sample_rate = SAMPLING_RATE_16KHZ;
- break;
- case 2:
- slim_rx_cfg[SLIM_RX_7].sample_rate = SAMPLING_RATE_48KHZ;
- slim_tx_cfg[SLIM_TX_7].sample_rate = SAMPLING_RATE_48KHZ;
- break;
- case 0:
- default:
- slim_rx_cfg[SLIM_RX_7].sample_rate = SAMPLING_RATE_8KHZ;
- slim_tx_cfg[SLIM_TX_7].sample_rate = SAMPLING_RATE_8KHZ;
- break;
- }
- pr_debug("%s: sample rates: slim7_rx = %d, slim7_tx = %d, value = %d\n",
- __func__,
- slim_rx_cfg[SLIM_RX_7].sample_rate,
- slim_tx_cfg[SLIM_TX_7].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int usb_audio_rx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- pr_debug("%s: usb_audio_rx_ch = %d\n", __func__,
- usb_rx_cfg.channels);
- ucontrol->value.integer.value[0] = usb_rx_cfg.channels - 1;
- return 0;
-}
-
-static int usb_audio_rx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- usb_rx_cfg.channels = ucontrol->value.integer.value[0] + 1;
-
- pr_debug("%s: usb_audio_rx_ch = %d\n", __func__, usb_rx_cfg.channels);
- return 1;
-}
-
-static int usb_audio_rx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int sample_rate_val;
-
- switch (usb_rx_cfg.sample_rate) {
- case SAMPLING_RATE_384KHZ:
- sample_rate_val = 12;
- break;
- case SAMPLING_RATE_352P8KHZ:
- sample_rate_val = 11;
- break;
- case SAMPLING_RATE_192KHZ:
- sample_rate_val = 10;
- break;
- case SAMPLING_RATE_176P4KHZ:
- sample_rate_val = 9;
- break;
- case SAMPLING_RATE_96KHZ:
- sample_rate_val = 8;
- break;
- case SAMPLING_RATE_88P2KHZ:
- sample_rate_val = 7;
- break;
- case SAMPLING_RATE_48KHZ:
- sample_rate_val = 6;
- break;
- case SAMPLING_RATE_44P1KHZ:
- sample_rate_val = 5;
- break;
- case SAMPLING_RATE_32KHZ:
- sample_rate_val = 4;
- break;
- case SAMPLING_RATE_22P05KHZ:
- sample_rate_val = 3;
- break;
- case SAMPLING_RATE_16KHZ:
- sample_rate_val = 2;
- break;
- case SAMPLING_RATE_11P025KHZ:
- sample_rate_val = 1;
- break;
- case SAMPLING_RATE_8KHZ:
- default:
- sample_rate_val = 0;
- break;
- }
-
- ucontrol->value.integer.value[0] = sample_rate_val;
- pr_debug("%s: usb_audio_rx_sample_rate = %d\n", __func__,
- usb_rx_cfg.sample_rate);
- return 0;
-}
-
-static int usb_audio_rx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- switch (ucontrol->value.integer.value[0]) {
- case 12:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_384KHZ;
- break;
- case 11:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_352P8KHZ;
- break;
- case 10:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_192KHZ;
- break;
- case 9:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_176P4KHZ;
- break;
- case 8:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_96KHZ;
- break;
- case 7:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_88P2KHZ;
- break;
- case 6:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_48KHZ;
- break;
- case 5:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_44P1KHZ;
- break;
- case 4:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_32KHZ;
- break;
- case 3:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_22P05KHZ;
- break;
- case 2:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_16KHZ;
- break;
- case 1:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_11P025KHZ;
- break;
- case 0:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_8KHZ;
- break;
- default:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_48KHZ;
- break;
- }
-
- pr_debug("%s: control value = %ld, usb_audio_rx_sample_rate = %d\n",
- __func__, ucontrol->value.integer.value[0],
- usb_rx_cfg.sample_rate);
- return 0;
-}
-
-static int usb_audio_rx_format_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- switch (usb_rx_cfg.bit_format) {
- case SNDRV_PCM_FORMAT_S32_LE:
- ucontrol->value.integer.value[0] = 3;
- break;
- case SNDRV_PCM_FORMAT_S24_3LE:
- ucontrol->value.integer.value[0] = 2;
- break;
- case SNDRV_PCM_FORMAT_S24_LE:
- ucontrol->value.integer.value[0] = 1;
- break;
- case SNDRV_PCM_FORMAT_S16_LE:
- default:
- ucontrol->value.integer.value[0] = 0;
- break;
- }
-
- pr_debug("%s: usb_audio_rx_format = %d, ucontrol value = %ld\n",
- __func__, usb_rx_cfg.bit_format,
- ucontrol->value.integer.value[0]);
- return 0;
-}
-
-static int usb_audio_rx_format_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int rc = 0;
-
- switch (ucontrol->value.integer.value[0]) {
- case 3:
- usb_rx_cfg.bit_format = SNDRV_PCM_FORMAT_S32_LE;
- break;
- case 2:
- usb_rx_cfg.bit_format = SNDRV_PCM_FORMAT_S24_3LE;
- break;
- case 1:
- usb_rx_cfg.bit_format = SNDRV_PCM_FORMAT_S24_LE;
- break;
- case 0:
- default:
- usb_rx_cfg.bit_format = SNDRV_PCM_FORMAT_S16_LE;
- break;
- }
- pr_debug("%s: usb_audio_rx_format = %d, ucontrol value = %ld\n",
- __func__, usb_rx_cfg.bit_format,
- ucontrol->value.integer.value[0]);
-
- return rc;
-}
-
-static int usb_audio_tx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- pr_debug("%s: usb_audio_tx_ch = %d\n", __func__,
- usb_tx_cfg.channels);
- ucontrol->value.integer.value[0] = usb_tx_cfg.channels - 1;
- return 0;
-}
-
-static int usb_audio_tx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- usb_tx_cfg.channels = ucontrol->value.integer.value[0] + 1;
-
- pr_debug("%s: usb_audio_tx_ch = %d\n", __func__, usb_tx_cfg.channels);
- return 1;
-}
-
-static int usb_audio_tx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int sample_rate_val;
-
- switch (usb_tx_cfg.sample_rate) {
- case SAMPLING_RATE_384KHZ:
- sample_rate_val = 12;
- break;
- case SAMPLING_RATE_352P8KHZ:
- sample_rate_val = 11;
- break;
- case SAMPLING_RATE_192KHZ:
- sample_rate_val = 10;
- break;
- case SAMPLING_RATE_176P4KHZ:
- sample_rate_val = 9;
- break;
- case SAMPLING_RATE_96KHZ:
- sample_rate_val = 8;
- break;
- case SAMPLING_RATE_88P2KHZ:
- sample_rate_val = 7;
- break;
- case SAMPLING_RATE_48KHZ:
- sample_rate_val = 6;
- break;
- case SAMPLING_RATE_44P1KHZ:
- sample_rate_val = 5;
- break;
- case SAMPLING_RATE_32KHZ:
- sample_rate_val = 4;
- break;
- case SAMPLING_RATE_22P05KHZ:
- sample_rate_val = 3;
- break;
- case SAMPLING_RATE_16KHZ:
- sample_rate_val = 2;
- break;
- case SAMPLING_RATE_11P025KHZ:
- sample_rate_val = 1;
- break;
- case SAMPLING_RATE_8KHZ:
- sample_rate_val = 0;
- break;
- default:
- sample_rate_val = 6;
- break;
- }
-
- ucontrol->value.integer.value[0] = sample_rate_val;
- pr_debug("%s: usb_audio_tx_sample_rate = %d\n", __func__,
- usb_tx_cfg.sample_rate);
- return 0;
-}
-
-static int usb_audio_tx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- switch (ucontrol->value.integer.value[0]) {
- case 12:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_384KHZ;
- break;
- case 11:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_352P8KHZ;
- break;
- case 10:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_192KHZ;
- break;
- case 9:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_176P4KHZ;
- break;
- case 8:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_96KHZ;
- break;
- case 7:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_88P2KHZ;
- break;
- case 6:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_48KHZ;
- break;
- case 5:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_44P1KHZ;
- break;
- case 4:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_32KHZ;
- break;
- case 3:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_22P05KHZ;
- break;
- case 2:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_16KHZ;
- break;
- case 1:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_11P025KHZ;
- break;
- case 0:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_8KHZ;
- break;
- default:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_48KHZ;
- break;
- }
-
- pr_debug("%s: control value = %ld, usb_audio_tx_sample_rate = %d\n",
- __func__, ucontrol->value.integer.value[0],
- usb_tx_cfg.sample_rate);
- return 0;
-}
-
-static int usb_audio_tx_format_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- switch (usb_tx_cfg.bit_format) {
- case SNDRV_PCM_FORMAT_S32_LE:
- ucontrol->value.integer.value[0] = 3;
- break;
- case SNDRV_PCM_FORMAT_S24_3LE:
- ucontrol->value.integer.value[0] = 2;
- break;
- case SNDRV_PCM_FORMAT_S24_LE:
- ucontrol->value.integer.value[0] = 1;
- break;
- case SNDRV_PCM_FORMAT_S16_LE:
- default:
- ucontrol->value.integer.value[0] = 0;
- break;
- }
-
- pr_debug("%s: usb_audio_tx_format = %d, ucontrol value = %ld\n",
- __func__, usb_tx_cfg.bit_format,
- ucontrol->value.integer.value[0]);
- return 0;
-}
-
-static int usb_audio_tx_format_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int rc = 0;
-
- switch (ucontrol->value.integer.value[0]) {
- case 3:
- usb_tx_cfg.bit_format = SNDRV_PCM_FORMAT_S32_LE;
- break;
- case 2:
- usb_tx_cfg.bit_format = SNDRV_PCM_FORMAT_S24_3LE;
- break;
- case 1:
- usb_tx_cfg.bit_format = SNDRV_PCM_FORMAT_S24_LE;
- break;
- case 0:
- default:
- usb_tx_cfg.bit_format = SNDRV_PCM_FORMAT_S16_LE;
- break;
- }
- pr_debug("%s: usb_audio_tx_format = %d, ucontrol value = %ld\n",
- __func__, usb_tx_cfg.bit_format,
- ucontrol->value.integer.value[0]);
-
- return rc;
-}
-
-static int ext_disp_get_port_idx(struct snd_kcontrol *kcontrol)
-{
- int idx;
-
- if (strnstr(kcontrol->id.name, "HDMI_RX", sizeof("HDMI_RX")))
- idx = HDMI_RX_IDX;
- else if (strnstr(kcontrol->id.name, "Display Port RX",
- sizeof("Display Port RX")))
- idx = DP_RX_IDX;
- else {
- pr_err("%s: unsupported BE: %s",
- __func__, kcontrol->id.name);
- idx = -EINVAL;
- }
-
- return idx;
-}
-
-static int ext_disp_rx_format_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = ext_disp_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- switch (ext_disp_rx_cfg[idx].bit_format) {
- case SNDRV_PCM_FORMAT_S24_LE:
- ucontrol->value.integer.value[0] = 1;
- break;
-
- case SNDRV_PCM_FORMAT_S16_LE:
- default:
- ucontrol->value.integer.value[0] = 0;
- break;
- }
-
- pr_debug("%s: ext_disp_rx[%d].format = %d, ucontrol value = %ld\n",
- __func__, idx, ext_disp_rx_cfg[idx].bit_format,
- ucontrol->value.integer.value[0]);
- return 0;
-}
-
-static int ext_disp_rx_format_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = ext_disp_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- switch (ucontrol->value.integer.value[0]) {
- case 1:
- ext_disp_rx_cfg[idx].bit_format = SNDRV_PCM_FORMAT_S24_LE;
- break;
- case 0:
- default:
- ext_disp_rx_cfg[idx].bit_format = SNDRV_PCM_FORMAT_S16_LE;
- break;
- }
- pr_debug("%s: ext_disp_rx[%d].format = %d, ucontrol value = %ld\n",
- __func__, idx, ext_disp_rx_cfg[idx].bit_format,
- ucontrol->value.integer.value[0]);
-
- return 0;
-}
-
-static int ext_disp_rx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = ext_disp_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- ucontrol->value.integer.value[0] =
- ext_disp_rx_cfg[idx].channels - 2;
-
- pr_debug("%s: ext_disp_rx[%d].ch = %d\n", __func__,
- idx, ext_disp_rx_cfg[idx].channels);
-
- return 0;
-}
-
-static int ext_disp_rx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = ext_disp_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- ext_disp_rx_cfg[idx].channels =
- ucontrol->value.integer.value[0] + 2;
-
- pr_debug("%s: ext_disp_rx[%d].ch = %d\n", __func__,
- idx, ext_disp_rx_cfg[idx].channels);
- return 1;
-}
-
-static int ext_disp_rx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int sample_rate_val;
- int idx = ext_disp_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- switch (ext_disp_rx_cfg[idx].sample_rate) {
- case SAMPLING_RATE_176P4KHZ:
- sample_rate_val = 6;
- break;
-
- case SAMPLING_RATE_88P2KHZ:
- sample_rate_val = 5;
- break;
-
- case SAMPLING_RATE_44P1KHZ:
- sample_rate_val = 4;
- break;
-
- case SAMPLING_RATE_32KHZ:
- sample_rate_val = 3;
- break;
-
- case SAMPLING_RATE_192KHZ:
- sample_rate_val = 2;
- break;
-
- case SAMPLING_RATE_96KHZ:
- sample_rate_val = 1;
- break;
-
- case SAMPLING_RATE_48KHZ:
- default:
- sample_rate_val = 0;
- break;
- }
-
- ucontrol->value.integer.value[0] = sample_rate_val;
- pr_debug("%s: ext_disp_rx[%d].sample_rate = %d\n", __func__,
- idx, ext_disp_rx_cfg[idx].sample_rate);
-
- return 0;
-}
-
-static int ext_disp_rx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = ext_disp_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- switch (ucontrol->value.integer.value[0]) {
- case 6:
- ext_disp_rx_cfg[idx].sample_rate = SAMPLING_RATE_176P4KHZ;
- break;
- case 5:
- ext_disp_rx_cfg[idx].sample_rate = SAMPLING_RATE_88P2KHZ;
- break;
- case 4:
- ext_disp_rx_cfg[idx].sample_rate = SAMPLING_RATE_44P1KHZ;
- break;
- case 3:
- ext_disp_rx_cfg[idx].sample_rate = SAMPLING_RATE_32KHZ;
- break;
- case 2:
- ext_disp_rx_cfg[idx].sample_rate = SAMPLING_RATE_192KHZ;
- break;
- case 1:
- ext_disp_rx_cfg[idx].sample_rate = SAMPLING_RATE_96KHZ;
- break;
- case 0:
- default:
- ext_disp_rx_cfg[idx].sample_rate = SAMPLING_RATE_48KHZ;
- break;
- }
-
- pr_debug("%s: control value = %ld, ext_disp_rx[%d].sample_rate = %d\n",
- __func__, ucontrol->value.integer.value[0], idx,
- ext_disp_rx_cfg[idx].sample_rate);
- return 0;
-}
-
-static int proxy_rx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- pr_debug("%s: proxy_rx channels = %d\n",
- __func__, proxy_rx_cfg.channels);
- ucontrol->value.integer.value[0] = proxy_rx_cfg.channels - 2;
-
- return 0;
-}
-
-static int proxy_rx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- proxy_rx_cfg.channels = ucontrol->value.integer.value[0] + 2;
- pr_debug("%s: proxy_rx channels = %d\n",
- __func__, proxy_rx_cfg.channels);
-
- return 1;
-}
-
-static int tdm_get_sample_rate(int value)
-{
- int sample_rate = 0;
-
- switch (value) {
- case 0:
- sample_rate = SAMPLING_RATE_8KHZ;
- break;
- case 1:
- sample_rate = SAMPLING_RATE_16KHZ;
- break;
- case 2:
- sample_rate = SAMPLING_RATE_32KHZ;
- break;
- case 3:
- sample_rate = SAMPLING_RATE_44P1KHZ;
- break;
- case 4:
- sample_rate = SAMPLING_RATE_48KHZ;
- break;
- case 5:
- sample_rate = SAMPLING_RATE_96KHZ;
- break;
- case 6:
- sample_rate = SAMPLING_RATE_192KHZ;
- break;
- case 7:
- sample_rate = SAMPLING_RATE_352P8KHZ;
- break;
- case 8:
- sample_rate = SAMPLING_RATE_384KHZ;
- break;
- default:
- sample_rate = SAMPLING_RATE_48KHZ;
- break;
- }
- return sample_rate;
-}
-
-static int aux_pcm_get_sample_rate(int value)
-{
- int sample_rate;
-
- switch (value) {
- case 1:
- sample_rate = SAMPLING_RATE_16KHZ;
- break;
- case 0:
- default:
- sample_rate = SAMPLING_RATE_8KHZ;
- break;
- }
- return sample_rate;
-}
-
-static int tdm_get_sample_rate_val(int sample_rate)
-{
- int sample_rate_val = 0;
-
- switch (sample_rate) {
- case SAMPLING_RATE_8KHZ:
- sample_rate_val = 0;
- break;
- case SAMPLING_RATE_16KHZ:
- sample_rate_val = 1;
- break;
- case SAMPLING_RATE_32KHZ:
- sample_rate_val = 2;
- break;
- case SAMPLING_RATE_44P1KHZ:
- sample_rate_val = 3;
- break;
- case SAMPLING_RATE_48KHZ:
- sample_rate_val = 4;
- break;
- case SAMPLING_RATE_96KHZ:
- sample_rate_val = 5;
- break;
- case SAMPLING_RATE_192KHZ:
- sample_rate_val = 6;
- break;
- case SAMPLING_RATE_352P8KHZ:
- sample_rate_val = 7;
- break;
- case SAMPLING_RATE_384KHZ:
- sample_rate_val = 8;
- break;
- default:
- sample_rate_val = 4;
- break;
- }
- return sample_rate_val;
-}
-
-static int aux_pcm_get_sample_rate_val(int sample_rate)
-{
- int sample_rate_val;
-
- switch (sample_rate) {
- case SAMPLING_RATE_16KHZ:
- sample_rate_val = 1;
- break;
- case SAMPLING_RATE_8KHZ:
- default:
- sample_rate_val = 0;
- break;
- }
- return sample_rate_val;
-}
-
-static int tdm_get_port_idx(struct snd_kcontrol *kcontrol,
- struct tdm_port *port)
-{
- if (port) {
- if (strnstr(kcontrol->id.name, "PRI",
- sizeof(kcontrol->id.name))) {
- port->mode = TDM_PRI;
- } else if (strnstr(kcontrol->id.name, "SEC",
- sizeof(kcontrol->id.name))) {
- port->mode = TDM_SEC;
- } else if (strnstr(kcontrol->id.name, "TERT",
- sizeof(kcontrol->id.name))) {
- port->mode = TDM_TERT;
- } else if (strnstr(kcontrol->id.name, "QUAT",
- sizeof(kcontrol->id.name))) {
- port->mode = TDM_QUAT;
- } else {
- pr_err("%s: unsupported mode in: %s",
- __func__, kcontrol->id.name);
- return -EINVAL;
- }
-
- if (strnstr(kcontrol->id.name, "RX_0",
- sizeof(kcontrol->id.name)) ||
- strnstr(kcontrol->id.name, "TX_0",
- sizeof(kcontrol->id.name))) {
- port->channel = TDM_0;
- } else if (strnstr(kcontrol->id.name, "RX_1",
- sizeof(kcontrol->id.name)) ||
- strnstr(kcontrol->id.name, "TX_1",
- sizeof(kcontrol->id.name))) {
- port->channel = TDM_1;
- } else if (strnstr(kcontrol->id.name, "RX_2",
- sizeof(kcontrol->id.name)) ||
- strnstr(kcontrol->id.name, "TX_2",
- sizeof(kcontrol->id.name))) {
- port->channel = TDM_2;
- } else if (strnstr(kcontrol->id.name, "RX_3",
- sizeof(kcontrol->id.name)) ||
- strnstr(kcontrol->id.name, "TX_3",
- sizeof(kcontrol->id.name))) {
- port->channel = TDM_3;
- } else if (strnstr(kcontrol->id.name, "RX_4",
- sizeof(kcontrol->id.name)) ||
- strnstr(kcontrol->id.name, "TX_4",
- sizeof(kcontrol->id.name))) {
- port->channel = TDM_4;
- } else if (strnstr(kcontrol->id.name, "RX_5",
- sizeof(kcontrol->id.name)) ||
- strnstr(kcontrol->id.name, "TX_5",
- sizeof(kcontrol->id.name))) {
- port->channel = TDM_5;
- } else if (strnstr(kcontrol->id.name, "RX_6",
- sizeof(kcontrol->id.name)) ||
- strnstr(kcontrol->id.name, "TX_6",
- sizeof(kcontrol->id.name))) {
- port->channel = TDM_6;
- } else if (strnstr(kcontrol->id.name, "RX_7",
- sizeof(kcontrol->id.name)) ||
- strnstr(kcontrol->id.name, "TX_7",
- sizeof(kcontrol->id.name))) {
- port->channel = TDM_7;
- } else {
- pr_err("%s: unsupported channel in: %s",
- __func__, kcontrol->id.name);
- return -EINVAL;
- }
- } else
- return -EINVAL;
- return 0;
-}
-
-static int tdm_rx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- ucontrol->value.enumerated.item[0] = tdm_get_sample_rate_val(
- tdm_rx_cfg[port.mode][port.channel].sample_rate);
-
- pr_debug("%s: tdm_rx_sample_rate = %d, item = %d\n", __func__,
- tdm_rx_cfg[port.mode][port.channel].sample_rate,
- ucontrol->value.enumerated.item[0]);
- }
- return ret;
-}
-
-static int tdm_rx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- tdm_rx_cfg[port.mode][port.channel].sample_rate =
- tdm_get_sample_rate(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: tdm_rx_sample_rate = %d, item = %d\n", __func__,
- tdm_rx_cfg[port.mode][port.channel].sample_rate,
- ucontrol->value.enumerated.item[0]);
- }
- return ret;
-}
-
-static int tdm_tx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- ucontrol->value.enumerated.item[0] = tdm_get_sample_rate_val(
- tdm_tx_cfg[port.mode][port.channel].sample_rate);
-
- pr_debug("%s: tdm_tx_sample_rate = %d, item = %d\n", __func__,
- tdm_tx_cfg[port.mode][port.channel].sample_rate,
- ucontrol->value.enumerated.item[0]);
- }
- return ret;
-}
-
-static int tdm_tx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- tdm_tx_cfg[port.mode][port.channel].sample_rate =
- tdm_get_sample_rate(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: tdm_tx_sample_rate = %d, item = %d\n", __func__,
- tdm_tx_cfg[port.mode][port.channel].sample_rate,
- ucontrol->value.enumerated.item[0]);
- }
- return ret;
-}
-
-static int tdm_get_format(int value)
-{
- int format = 0;
-
- switch (value) {
- case 0:
- format = SNDRV_PCM_FORMAT_S16_LE;
- break;
- case 1:
- format = SNDRV_PCM_FORMAT_S24_LE;
- break;
- case 2:
- format = SNDRV_PCM_FORMAT_S32_LE;
- break;
- default:
- format = SNDRV_PCM_FORMAT_S16_LE;
- break;
- }
- return format;
-}
-
-static int tdm_get_format_val(int format)
-{
- int value = 0;
-
- switch (format) {
- case SNDRV_PCM_FORMAT_S16_LE:
- value = 0;
- break;
- case SNDRV_PCM_FORMAT_S24_LE:
- value = 1;
- break;
- case SNDRV_PCM_FORMAT_S32_LE:
- value = 2;
- break;
- default:
- value = 0;
- break;
- }
- return value;
-}
-
-static int tdm_rx_format_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- ucontrol->value.enumerated.item[0] = tdm_get_format_val(
- tdm_rx_cfg[port.mode][port.channel].bit_format);
-
- pr_debug("%s: tdm_rx_bit_format = %d, item = %d\n", __func__,
- tdm_rx_cfg[port.mode][port.channel].bit_format,
- ucontrol->value.enumerated.item[0]);
- }
- return ret;
-}
-
-static int tdm_rx_format_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- tdm_rx_cfg[port.mode][port.channel].bit_format =
- tdm_get_format(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: tdm_rx_bit_format = %d, item = %d\n", __func__,
- tdm_rx_cfg[port.mode][port.channel].bit_format,
- ucontrol->value.enumerated.item[0]);
- }
- return ret;
-}
-
-static int tdm_tx_format_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- ucontrol->value.enumerated.item[0] = tdm_get_format_val(
- tdm_tx_cfg[port.mode][port.channel].bit_format);
-
- pr_debug("%s: tdm_tx_bit_format = %d, item = %d\n", __func__,
- tdm_tx_cfg[port.mode][port.channel].bit_format,
- ucontrol->value.enumerated.item[0]);
- }
- return ret;
-}
-
-static int tdm_tx_format_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- tdm_tx_cfg[port.mode][port.channel].bit_format =
- tdm_get_format(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: tdm_tx_bit_format = %d, item = %d\n", __func__,
- tdm_tx_cfg[port.mode][port.channel].bit_format,
- ucontrol->value.enumerated.item[0]);
- }
- return ret;
-}
-
-static int tdm_rx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
-
- ucontrol->value.enumerated.item[0] =
- tdm_rx_cfg[port.mode][port.channel].channels - 1;
-
- pr_debug("%s: tdm_rx_ch = %d, item = %d\n", __func__,
- tdm_rx_cfg[port.mode][port.channel].channels - 1,
- ucontrol->value.enumerated.item[0]);
- }
- return ret;
-}
-
-static int tdm_rx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- tdm_rx_cfg[port.mode][port.channel].channels =
- ucontrol->value.enumerated.item[0] + 1;
-
- pr_debug("%s: tdm_rx_ch = %d, item = %d\n", __func__,
- tdm_rx_cfg[port.mode][port.channel].channels,
- ucontrol->value.enumerated.item[0] + 1);
- }
- return ret;
-}
-
-static int tdm_tx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- ucontrol->value.enumerated.item[0] =
- tdm_tx_cfg[port.mode][port.channel].channels - 1;
-
- pr_debug("%s: tdm_tx_ch = %d, item = %d\n", __func__,
- tdm_tx_cfg[port.mode][port.channel].channels - 1,
- ucontrol->value.enumerated.item[0]);
- }
- return ret;
-}
-
-static int tdm_tx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- tdm_tx_cfg[port.mode][port.channel].channels =
- ucontrol->value.enumerated.item[0] + 1;
-
- pr_debug("%s: tdm_tx_ch = %d, item = %d\n", __func__,
- tdm_tx_cfg[port.mode][port.channel].channels,
- ucontrol->value.enumerated.item[0] + 1);
- }
- return ret;
-}
-
-static int aux_pcm_get_port_idx(struct snd_kcontrol *kcontrol)
-{
- int idx;
-
- if (strnstr(kcontrol->id.name, "PRIM_AUX_PCM",
- sizeof("PRIM_AUX_PCM")))
- idx = PRIM_AUX_PCM;
- else if (strnstr(kcontrol->id.name, "SEC_AUX_PCM",
- sizeof("SEC_AUX_PCM")))
- idx = SEC_AUX_PCM;
- else if (strnstr(kcontrol->id.name, "TERT_AUX_PCM",
- sizeof("TERT_AUX_PCM")))
- idx = TERT_AUX_PCM;
- else if (strnstr(kcontrol->id.name, "QUAT_AUX_PCM",
- sizeof("QUAT_AUX_PCM")))
- idx = QUAT_AUX_PCM;
- else {
- pr_err("%s: unsupported port: %s",
- __func__, kcontrol->id.name);
- idx = -EINVAL;
- }
-
- return idx;
-}
-
-static int aux_pcm_rx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = aux_pcm_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- aux_pcm_rx_cfg[idx].sample_rate =
- aux_pcm_get_sample_rate(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: idx[%d]_rx_sample_rate = %d, item = %d\n", __func__,
- idx, aux_pcm_rx_cfg[idx].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int aux_pcm_rx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = aux_pcm_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- ucontrol->value.enumerated.item[0] =
- aux_pcm_get_sample_rate_val(aux_pcm_rx_cfg[idx].sample_rate);
-
- pr_debug("%s: idx[%d]_rx_sample_rate = %d, item = %d\n", __func__,
- idx, aux_pcm_rx_cfg[idx].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int aux_pcm_tx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = aux_pcm_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- aux_pcm_tx_cfg[idx].sample_rate =
- aux_pcm_get_sample_rate(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: idx[%d]_tx_sample_rate = %d, item = %d\n", __func__,
- idx, aux_pcm_tx_cfg[idx].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int aux_pcm_tx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = aux_pcm_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- ucontrol->value.enumerated.item[0] =
- aux_pcm_get_sample_rate_val(aux_pcm_tx_cfg[idx].sample_rate);
-
- pr_debug("%s: idx[%d]_tx_sample_rate = %d, item = %d\n", __func__,
- idx, aux_pcm_tx_cfg[idx].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int mi2s_get_port_idx(struct snd_kcontrol *kcontrol)
-{
- int idx;
-
- if (strnstr(kcontrol->id.name, "PRIM_MI2S_RX",
- sizeof("PRIM_MI2S_RX")))
- idx = PRIM_MI2S;
- else if (strnstr(kcontrol->id.name, "SEC_MI2S_RX",
- sizeof("SEC_MI2S_RX")))
- idx = SEC_MI2S;
- else if (strnstr(kcontrol->id.name, "TERT_MI2S_RX",
- sizeof("TERT_MI2S_RX")))
- idx = TERT_MI2S;
- else if (strnstr(kcontrol->id.name, "QUAT_MI2S_RX",
- sizeof("QUAT_MI2S_RX")))
- idx = QUAT_MI2S;
- else if (strnstr(kcontrol->id.name, "PRIM_MI2S_TX",
- sizeof("PRIM_MI2S_TX")))
- idx = PRIM_MI2S;
- else if (strnstr(kcontrol->id.name, "SEC_MI2S_TX",
- sizeof("SEC_MI2S_TX")))
- idx = SEC_MI2S;
- else if (strnstr(kcontrol->id.name, "TERT_MI2S_TX",
- sizeof("TERT_MI2S_TX")))
- idx = TERT_MI2S;
- else if (strnstr(kcontrol->id.name, "QUAT_MI2S_TX",
- sizeof("QUAT_MI2S_TX")))
- idx = QUAT_MI2S;
- else {
- pr_err("%s: unsupported channel: %s",
- __func__, kcontrol->id.name);
- idx = -EINVAL;
- }
-
- return idx;
-}
-
-static int mi2s_get_sample_rate_val(int sample_rate)
-{
- int sample_rate_val;
-
- switch (sample_rate) {
- case SAMPLING_RATE_8KHZ:
- sample_rate_val = 0;
- break;
- case SAMPLING_RATE_16KHZ:
- sample_rate_val = 1;
- break;
- case SAMPLING_RATE_32KHZ:
- sample_rate_val = 2;
- break;
- case SAMPLING_RATE_44P1KHZ:
- sample_rate_val = 3;
- break;
- case SAMPLING_RATE_48KHZ:
- sample_rate_val = 4;
- break;
- case SAMPLING_RATE_96KHZ:
- sample_rate_val = 5;
- break;
- case SAMPLING_RATE_192KHZ:
- sample_rate_val = 6;
- break;
- default:
- sample_rate_val = 4;
- break;
- }
- return sample_rate_val;
-}
-
-static int mi2s_get_sample_rate(int value)
-{
- int sample_rate;
-
- switch (value) {
- case 0:
- sample_rate = SAMPLING_RATE_8KHZ;
- break;
- case 1:
- sample_rate = SAMPLING_RATE_16KHZ;
- break;
- case 2:
- sample_rate = SAMPLING_RATE_32KHZ;
- break;
- case 3:
- sample_rate = SAMPLING_RATE_44P1KHZ;
- break;
- case 4:
- sample_rate = SAMPLING_RATE_48KHZ;
- break;
- case 5:
- sample_rate = SAMPLING_RATE_96KHZ;
- break;
- case 6:
- sample_rate = SAMPLING_RATE_192KHZ;
- break;
- default:
- sample_rate = SAMPLING_RATE_48KHZ;
- break;
- }
- return sample_rate;
-}
-
-static int mi2s_get_format(int value)
-{
- int format;
-
- switch (value) {
- case 0:
- format = SNDRV_PCM_FORMAT_S16_LE;
- break;
- case 1:
- format = SNDRV_PCM_FORMAT_S24_LE;
- break;
- case 2:
- format = SNDRV_PCM_FORMAT_S24_3LE;
- break;
- case 3:
- format = SNDRV_PCM_FORMAT_S32_LE;
- break;
- default:
- format = SNDRV_PCM_FORMAT_S16_LE;
- break;
- }
- return format;
-}
-
-static int mi2s_get_format_value(int format)
-{
- int value;
-
- switch (format) {
- case SNDRV_PCM_FORMAT_S16_LE:
- value = 0;
- break;
- case SNDRV_PCM_FORMAT_S24_LE:
- value = 1;
- break;
- case SNDRV_PCM_FORMAT_S24_3LE:
- value = 2;
- break;
- case SNDRV_PCM_FORMAT_S32_LE:
- value = 3;
- break;
- default:
- value = 0;
- break;
- }
- return value;
-}
-
-static int mi2s_rx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- mi2s_rx_cfg[idx].sample_rate =
- mi2s_get_sample_rate(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: idx[%d]_rx_sample_rate = %d, item = %d\n", __func__,
- idx, mi2s_rx_cfg[idx].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int mi2s_rx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- ucontrol->value.enumerated.item[0] =
- mi2s_get_sample_rate_val(mi2s_rx_cfg[idx].sample_rate);
-
- pr_debug("%s: idx[%d]_rx_sample_rate = %d, item = %d\n", __func__,
- idx, mi2s_rx_cfg[idx].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int mi2s_tx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- mi2s_tx_cfg[idx].sample_rate =
- mi2s_get_sample_rate(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: idx[%d]_tx_sample_rate = %d, item = %d\n", __func__,
- idx, mi2s_tx_cfg[idx].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int mi2s_tx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- ucontrol->value.enumerated.item[0] =
- mi2s_get_sample_rate_val(mi2s_tx_cfg[idx].sample_rate);
-
- pr_debug("%s: idx[%d]_tx_sample_rate = %d, item = %d\n", __func__,
- idx, mi2s_tx_cfg[idx].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int msm_mi2s_rx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- pr_debug("%s: msm_mi2s_[%d]_rx_ch = %d\n", __func__,
- idx, mi2s_rx_cfg[idx].channels);
- ucontrol->value.enumerated.item[0] = mi2s_rx_cfg[idx].channels - 1;
-
- return 0;
-}
-
-static int msm_mi2s_rx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- mi2s_rx_cfg[idx].channels = ucontrol->value.enumerated.item[0] + 1;
- pr_debug("%s: msm_mi2s_[%d]_rx_ch = %d\n", __func__,
- idx, mi2s_rx_cfg[idx].channels);
-
- return 1;
-}
-
-static int msm_mi2s_tx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- pr_debug("%s: msm_mi2s_[%d]_tx_ch = %d\n", __func__,
- idx, mi2s_tx_cfg[idx].channels);
- ucontrol->value.enumerated.item[0] = mi2s_tx_cfg[idx].channels - 1;
-
- return 0;
-}
-
-static int msm_mi2s_tx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- mi2s_tx_cfg[idx].channels = ucontrol->value.enumerated.item[0] + 1;
- pr_debug("%s: msm_mi2s_[%d]_tx_ch = %d\n", __func__,
- idx, mi2s_tx_cfg[idx].channels);
-
- return 1;
-}
-
-static int msm_mi2s_rx_format_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- ucontrol->value.enumerated.item[0] =
- mi2s_get_format_value(mi2s_rx_cfg[idx].bit_format);
-
- pr_debug("%s: idx[%d]_rx_format = %d, item = %d\n", __func__,
- idx, mi2s_rx_cfg[idx].bit_format,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int msm_mi2s_rx_format_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- mi2s_rx_cfg[idx].bit_format =
- mi2s_get_format(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: idx[%d]_rx_format = %d, item = %d\n", __func__,
- idx, mi2s_rx_cfg[idx].bit_format,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int msm_mi2s_tx_format_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- ucontrol->value.enumerated.item[0] =
- mi2s_get_format_value(mi2s_tx_cfg[idx].bit_format);
-
- pr_debug("%s: idx[%d]_tx_format = %d, item = %d\n", __func__,
- idx, mi2s_tx_cfg[idx].bit_format,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int msm_mi2s_tx_format_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- mi2s_tx_cfg[idx].bit_format =
- mi2s_get_format(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: idx[%d]_tx_format = %d, item = %d\n", __func__,
- idx, mi2s_tx_cfg[idx].bit_format,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int msm_hifi_ctrl(struct snd_soc_codec *codec)
-{
- struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
- struct snd_soc_card *card = codec->component.card;
- struct msm_asoc_mach_data *pdata =
- snd_soc_card_get_drvdata(card);
-
- pr_debug("%s: msm_hifi_control = %d", __func__,
- msm_hifi_control);
-
- if (!pdata || !pdata->hph_en1_gpio_p) {
- pr_err("%s: hph_en1_gpio is invalid\n", __func__);
- return -EINVAL;
- }
- if (msm_hifi_control == MSM_HIFI_ON) {
- msm_cdc_pinctrl_select_active_state(pdata->hph_en1_gpio_p);
- /* 5msec delay needed as per HW requirement */
- usleep_range(5000, 5010);
- } else {
- msm_cdc_pinctrl_select_sleep_state(pdata->hph_en1_gpio_p);
- }
- snd_soc_dapm_sync(dapm);
-
- return 0;
-}
-
-static int msm_hifi_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- pr_debug("%s: msm_hifi_control = %d\n",
- __func__, msm_hifi_control);
- ucontrol->value.integer.value[0] = msm_hifi_control;
-
- return 0;
-}
-
-static int msm_hifi_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
-
- pr_debug("%s() ucontrol->value.integer.value[0] = %ld\n",
- __func__, ucontrol->value.integer.value[0]);
-
- msm_hifi_control = ucontrol->value.integer.value[0];
- msm_hifi_ctrl(codec);
-
- return 0;
-}
-
-static const struct snd_kcontrol_new msm_snd_controls[] = {
- SOC_ENUM_EXT("SLIM_0_RX Channels", slim_0_rx_chs,
- msm_slim_rx_ch_get, msm_slim_rx_ch_put),
- SOC_ENUM_EXT("SLIM_2_RX Channels", slim_2_rx_chs,
- msm_slim_rx_ch_get, msm_slim_rx_ch_put),
- SOC_ENUM_EXT("SLIM_0_TX Channels", slim_0_tx_chs,
- msm_slim_tx_ch_get, msm_slim_tx_ch_put),
- SOC_ENUM_EXT("SLIM_1_TX Channels", slim_1_tx_chs,
- msm_slim_tx_ch_get, msm_slim_tx_ch_put),
- SOC_ENUM_EXT("SLIM_5_RX Channels", slim_5_rx_chs,
- msm_slim_rx_ch_get, msm_slim_rx_ch_put),
- SOC_ENUM_EXT("SLIM_6_RX Channels", slim_6_rx_chs,
- msm_slim_rx_ch_get, msm_slim_rx_ch_put),
- SOC_ENUM_EXT("VI_FEED_TX Channels", vi_feed_tx_chs,
- msm_vi_feed_tx_ch_get, msm_vi_feed_tx_ch_put),
- SOC_ENUM_EXT("USB_AUDIO_RX Channels", usb_rx_chs,
- usb_audio_rx_ch_get, usb_audio_rx_ch_put),
- SOC_ENUM_EXT("USB_AUDIO_TX Channels", usb_tx_chs,
- usb_audio_tx_ch_get, usb_audio_tx_ch_put),
- SOC_ENUM_EXT("HDMI_RX Channels", ext_disp_rx_chs,
- ext_disp_rx_ch_get, ext_disp_rx_ch_put),
- SOC_ENUM_EXT("Display Port RX Channels", ext_disp_rx_chs,
- ext_disp_rx_ch_get, ext_disp_rx_ch_put),
- SOC_ENUM_EXT("PROXY_RX Channels", proxy_rx_chs,
- proxy_rx_ch_get, proxy_rx_ch_put),
- SOC_ENUM_EXT("SLIM_0_RX Format", slim_0_rx_format,
- slim_rx_bit_format_get, slim_rx_bit_format_put),
- SOC_ENUM_EXT("SLIM_5_RX Format", slim_5_rx_format,
- slim_rx_bit_format_get, slim_rx_bit_format_put),
- SOC_ENUM_EXT("SLIM_6_RX Format", slim_6_rx_format,
- slim_rx_bit_format_get, slim_rx_bit_format_put),
- SOC_ENUM_EXT("SLIM_0_TX Format", slim_0_tx_format,
- slim_tx_bit_format_get, slim_tx_bit_format_put),
- SOC_ENUM_EXT("USB_AUDIO_RX Format", usb_rx_format,
- usb_audio_rx_format_get, usb_audio_rx_format_put),
- SOC_ENUM_EXT("USB_AUDIO_TX Format", usb_tx_format,
- usb_audio_tx_format_get, usb_audio_tx_format_put),
- SOC_ENUM_EXT("HDMI_RX Bit Format", ext_disp_rx_format,
- ext_disp_rx_format_get, ext_disp_rx_format_put),
- SOC_ENUM_EXT("Display Port RX Bit Format", ext_disp_rx_format,
- ext_disp_rx_format_get, ext_disp_rx_format_put),
- SOC_ENUM_EXT("SLIM_0_RX SampleRate", slim_0_rx_sample_rate,
- slim_rx_sample_rate_get, slim_rx_sample_rate_put),
- SOC_ENUM_EXT("SLIM_2_RX SampleRate", slim_2_rx_sample_rate,
- slim_rx_sample_rate_get, slim_rx_sample_rate_put),
- SOC_ENUM_EXT("SLIM_0_TX SampleRate", slim_0_tx_sample_rate,
- slim_tx_sample_rate_get, slim_tx_sample_rate_put),
- SOC_ENUM_EXT("SLIM_5_RX SampleRate", slim_5_rx_sample_rate,
- slim_rx_sample_rate_get, slim_rx_sample_rate_put),
- SOC_ENUM_EXT("SLIM_6_RX SampleRate", slim_6_rx_sample_rate,
- slim_rx_sample_rate_get, slim_rx_sample_rate_put),
- SOC_ENUM_EXT("BT SampleRate", bt_sample_rate,
- msm_bt_sample_rate_get,
- msm_bt_sample_rate_put),
- SOC_ENUM_EXT("USB_AUDIO_RX SampleRate", usb_rx_sample_rate,
- usb_audio_rx_sample_rate_get,
- usb_audio_rx_sample_rate_put),
- SOC_ENUM_EXT("USB_AUDIO_TX SampleRate", usb_tx_sample_rate,
- usb_audio_tx_sample_rate_get,
- usb_audio_tx_sample_rate_put),
- SOC_ENUM_EXT("HDMI_RX SampleRate", ext_disp_rx_sample_rate,
- ext_disp_rx_sample_rate_get,
- ext_disp_rx_sample_rate_put),
- SOC_ENUM_EXT("Display Port RX SampleRate", ext_disp_rx_sample_rate,
- ext_disp_rx_sample_rate_get,
- ext_disp_rx_sample_rate_put),
- SOC_ENUM_EXT("PRI_TDM_RX_0 SampleRate", tdm_rx_sample_rate,
- tdm_rx_sample_rate_get,
- tdm_rx_sample_rate_put),
- SOC_ENUM_EXT("PRI_TDM_TX_0 SampleRate", tdm_tx_sample_rate,
- tdm_tx_sample_rate_get,
- tdm_tx_sample_rate_put),
- SOC_ENUM_EXT("PRI_TDM_RX_0 Format", tdm_rx_format,
- tdm_rx_format_get,
- tdm_rx_format_put),
- SOC_ENUM_EXT("PRI_TDM_TX_0 Format", tdm_tx_format,
- tdm_tx_format_get,
- tdm_tx_format_put),
- SOC_ENUM_EXT("PRI_TDM_RX_0 Channels", tdm_rx_chs,
- tdm_rx_ch_get,
- tdm_rx_ch_put),
- SOC_ENUM_EXT("PRI_TDM_TX_0 Channels", tdm_tx_chs,
- tdm_tx_ch_get,
- tdm_tx_ch_put),
- SOC_ENUM_EXT("SEC_TDM_RX_0 SampleRate", tdm_rx_sample_rate,
- tdm_rx_sample_rate_get,
- tdm_rx_sample_rate_put),
- SOC_ENUM_EXT("SEC_TDM_TX_0 SampleRate", tdm_tx_sample_rate,
- tdm_tx_sample_rate_get,
- tdm_tx_sample_rate_put),
- SOC_ENUM_EXT("SEC_TDM_RX_0 Format", tdm_rx_format,
- tdm_rx_format_get,
- tdm_rx_format_put),
- SOC_ENUM_EXT("SEC_TDM_TX_0 Format", tdm_tx_format,
- tdm_tx_format_get,
- tdm_tx_format_put),
- SOC_ENUM_EXT("SEC_TDM_RX_0 Channels", tdm_rx_chs,
- tdm_rx_ch_get,
- tdm_rx_ch_put),
- SOC_ENUM_EXT("SEC_TDM_TX_0 Channels", tdm_tx_chs,
- tdm_tx_ch_get,
- tdm_tx_ch_put),
- SOC_ENUM_EXT("TERT_TDM_RX_0 SampleRate", tdm_rx_sample_rate,
- tdm_rx_sample_rate_get,
- tdm_rx_sample_rate_put),
- SOC_ENUM_EXT("TERT_TDM_TX_0 SampleRate", tdm_tx_sample_rate,
- tdm_tx_sample_rate_get,
- tdm_tx_sample_rate_put),
- SOC_ENUM_EXT("TERT_TDM_RX_0 Format", tdm_rx_format,
- tdm_rx_format_get,
- tdm_rx_format_put),
- SOC_ENUM_EXT("TERT_TDM_TX_0 Format", tdm_tx_format,
- tdm_tx_format_get,
- tdm_tx_format_put),
- SOC_ENUM_EXT("TERT_TDM_RX_0 Channels", tdm_rx_chs,
- tdm_rx_ch_get,
- tdm_rx_ch_put),
- SOC_ENUM_EXT("TERT_TDM_TX_0 Channels", tdm_tx_chs,
- tdm_tx_ch_get,
- tdm_tx_ch_put),
- SOC_ENUM_EXT("QUAT_TDM_RX_0 SampleRate", tdm_rx_sample_rate,
- tdm_rx_sample_rate_get,
- tdm_rx_sample_rate_put),
- SOC_ENUM_EXT("QUAT_TDM_TX_0 SampleRate", tdm_tx_sample_rate,
- tdm_tx_sample_rate_get,
- tdm_tx_sample_rate_put),
- SOC_ENUM_EXT("QUAT_TDM_RX_0 Format", tdm_rx_format,
- tdm_rx_format_get,
- tdm_rx_format_put),
- SOC_ENUM_EXT("QUAT_TDM_TX_0 Format", tdm_tx_format,
- tdm_tx_format_get,
- tdm_tx_format_put),
- SOC_ENUM_EXT("QUAT_TDM_RX_0 Channels", tdm_rx_chs,
- tdm_rx_ch_get,
- tdm_rx_ch_put),
- SOC_ENUM_EXT("QUAT_TDM_TX_0 Channels", tdm_tx_chs,
- tdm_tx_ch_get,
- tdm_tx_ch_put),
- SOC_ENUM_EXT("PRIM_AUX_PCM_RX SampleRate", prim_aux_pcm_rx_sample_rate,
- aux_pcm_rx_sample_rate_get,
- aux_pcm_rx_sample_rate_put),
- SOC_ENUM_EXT("SEC_AUX_PCM_RX SampleRate", sec_aux_pcm_rx_sample_rate,
- aux_pcm_rx_sample_rate_get,
- aux_pcm_rx_sample_rate_put),
- SOC_ENUM_EXT("TERT_AUX_PCM_RX SampleRate", tert_aux_pcm_rx_sample_rate,
- aux_pcm_rx_sample_rate_get,
- aux_pcm_rx_sample_rate_put),
- SOC_ENUM_EXT("QUAT_AUX_PCM_RX SampleRate", quat_aux_pcm_rx_sample_rate,
- aux_pcm_rx_sample_rate_get,
- aux_pcm_rx_sample_rate_put),
- SOC_ENUM_EXT("PRIM_AUX_PCM_TX SampleRate", prim_aux_pcm_tx_sample_rate,
- aux_pcm_tx_sample_rate_get,
- aux_pcm_tx_sample_rate_put),
- SOC_ENUM_EXT("SEC_AUX_PCM_TX SampleRate", sec_aux_pcm_tx_sample_rate,
- aux_pcm_tx_sample_rate_get,
- aux_pcm_tx_sample_rate_put),
- SOC_ENUM_EXT("TERT_AUX_PCM_TX SampleRate", tert_aux_pcm_tx_sample_rate,
- aux_pcm_tx_sample_rate_get,
- aux_pcm_tx_sample_rate_put),
- SOC_ENUM_EXT("QUAT_AUX_PCM_TX SampleRate", quat_aux_pcm_tx_sample_rate,
- aux_pcm_tx_sample_rate_get,
- aux_pcm_tx_sample_rate_put),
- SOC_ENUM_EXT("PRIM_MI2S_RX SampleRate", prim_mi2s_rx_sample_rate,
- mi2s_rx_sample_rate_get,
- mi2s_rx_sample_rate_put),
- SOC_ENUM_EXT("SEC_MI2S_RX SampleRate", sec_mi2s_rx_sample_rate,
- mi2s_rx_sample_rate_get,
- mi2s_rx_sample_rate_put),
- SOC_ENUM_EXT("TERT_MI2S_RX SampleRate", tert_mi2s_rx_sample_rate,
- mi2s_rx_sample_rate_get,
- mi2s_rx_sample_rate_put),
- SOC_ENUM_EXT("QUAT_MI2S_RX SampleRate", quat_mi2s_rx_sample_rate,
- mi2s_rx_sample_rate_get,
- mi2s_rx_sample_rate_put),
- SOC_ENUM_EXT("PRIM_MI2S_TX SampleRate", prim_mi2s_tx_sample_rate,
- mi2s_tx_sample_rate_get,
- mi2s_tx_sample_rate_put),
- SOC_ENUM_EXT("SEC_MI2S_TX SampleRate", sec_mi2s_tx_sample_rate,
- mi2s_tx_sample_rate_get,
- mi2s_tx_sample_rate_put),
- SOC_ENUM_EXT("TERT_MI2S_TX SampleRate", tert_mi2s_tx_sample_rate,
- mi2s_tx_sample_rate_get,
- mi2s_tx_sample_rate_put),
- SOC_ENUM_EXT("QUAT_MI2S_TX SampleRate", quat_mi2s_tx_sample_rate,
- mi2s_tx_sample_rate_get,
- mi2s_tx_sample_rate_put),
- SOC_ENUM_EXT("PRIM_MI2S_RX Channels", prim_mi2s_rx_chs,
- msm_mi2s_rx_ch_get, msm_mi2s_rx_ch_put),
- SOC_ENUM_EXT("PRIM_MI2S_TX Channels", prim_mi2s_tx_chs,
- msm_mi2s_tx_ch_get, msm_mi2s_tx_ch_put),
- SOC_ENUM_EXT("SEC_MI2S_RX Channels", sec_mi2s_rx_chs,
- msm_mi2s_rx_ch_get, msm_mi2s_rx_ch_put),
- SOC_ENUM_EXT("SEC_MI2S_TX Channels", sec_mi2s_tx_chs,
- msm_mi2s_tx_ch_get, msm_mi2s_tx_ch_put),
- SOC_ENUM_EXT("TERT_MI2S_RX Channels", tert_mi2s_rx_chs,
- msm_mi2s_rx_ch_get, msm_mi2s_rx_ch_put),
- SOC_ENUM_EXT("TERT_MI2S_TX Channels", tert_mi2s_tx_chs,
- msm_mi2s_tx_ch_get, msm_mi2s_tx_ch_put),
- SOC_ENUM_EXT("QUAT_MI2S_RX Channels", quat_mi2s_rx_chs,
- msm_mi2s_rx_ch_get, msm_mi2s_rx_ch_put),
- SOC_ENUM_EXT("QUAT_MI2S_TX Channels", quat_mi2s_tx_chs,
- msm_mi2s_tx_ch_get, msm_mi2s_tx_ch_put),
- SOC_ENUM_EXT("PRIM_MI2S_RX Format", mi2s_rx_format,
- msm_mi2s_rx_format_get, msm_mi2s_rx_format_put),
- SOC_ENUM_EXT("PRIM_MI2S_TX Format", mi2s_tx_format,
- msm_mi2s_tx_format_get, msm_mi2s_tx_format_put),
- SOC_ENUM_EXT("SEC_MI2S_RX Format", mi2s_rx_format,
- msm_mi2s_rx_format_get, msm_mi2s_rx_format_put),
- SOC_ENUM_EXT("SEC_MI2S_TX Format", mi2s_tx_format,
- msm_mi2s_tx_format_get, msm_mi2s_tx_format_put),
- SOC_ENUM_EXT("TERT_MI2S_RX Format", mi2s_rx_format,
- msm_mi2s_rx_format_get, msm_mi2s_rx_format_put),
- SOC_ENUM_EXT("TERT_MI2S_TX Format", mi2s_tx_format,
- msm_mi2s_tx_format_get, msm_mi2s_tx_format_put),
- SOC_ENUM_EXT("QUAT_MI2S_RX Format", mi2s_rx_format,
- msm_mi2s_rx_format_get, msm_mi2s_rx_format_put),
- SOC_ENUM_EXT("QUAT_MI2S_TX Format", mi2s_tx_format,
- msm_mi2s_tx_format_get, msm_mi2s_tx_format_put),
- SOC_ENUM_EXT("HiFi Function", hifi_function, msm_hifi_get,
- msm_hifi_put),
-};
-
-static int msm_snd_enable_codec_ext_clk(struct snd_soc_codec *codec,
- int enable, bool dapm)
-{
- int ret = 0;
-
- if (!strcmp(dev_name(codec->dev), "tasha_codec"))
- ret = tasha_cdc_mclk_enable(codec, enable, dapm);
- else if (!strcmp(dev_name(codec->dev), "tavil_codec"))
- ret = tavil_cdc_mclk_enable(codec, enable);
- else {
- dev_err(codec->dev, "%s: unknown codec to enable ext clk\n",
- __func__);
- ret = -EINVAL;
- }
- return ret;
-}
-
-static int msm_snd_enable_codec_ext_tx_clk(struct snd_soc_codec *codec,
- int enable, bool dapm)
-{
- int ret = 0;
-
- if (!strcmp(dev_name(codec->dev), "tasha_codec"))
- ret = tasha_cdc_mclk_tx_enable(codec, enable, dapm);
- else {
- dev_err(codec->dev, "%s: unknown codec to enable ext clk\n",
- __func__);
- ret = -EINVAL;
- }
- return ret;
-}
-
-static int msm_mclk_tx_event(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol, int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
-
- pr_debug("%s: event = %d\n", __func__, event);
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- return msm_snd_enable_codec_ext_tx_clk(codec, 1, true);
- case SND_SOC_DAPM_POST_PMD:
- return msm_snd_enable_codec_ext_tx_clk(codec, 0, true);
- }
- return 0;
-}
-
-static int msm_mclk_event(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol, int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
-
- pr_debug("%s: event = %d\n", __func__, event);
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- return msm_snd_enable_codec_ext_clk(codec, 1, true);
- case SND_SOC_DAPM_POST_PMD:
- return msm_snd_enable_codec_ext_clk(codec, 0, true);
- }
- return 0;
-}
-
-static int msm_hifi_ctrl_event(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *k, int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct snd_soc_card *card = codec->component.card;
- struct msm_asoc_mach_data *pdata =
- snd_soc_card_get_drvdata(card);
-
- pr_debug("%s: msm_hifi_control = %d", __func__, msm_hifi_control);
-
- if (!pdata || !pdata->hph_en0_gpio_p) {
- pr_err("%s: hph_en0_gpio is invalid\n", __func__);
- return -EINVAL;
- }
-
- if (msm_hifi_control != MSM_HIFI_ON) {
- pr_debug("%s: HiFi mixer control is not set\n",
- __func__);
- return 0;
- }
-
- switch (event) {
- case SND_SOC_DAPM_POST_PMU:
- msm_cdc_pinctrl_select_active_state(pdata->hph_en0_gpio_p);
- break;
- case SND_SOC_DAPM_PRE_PMD:
- msm_cdc_pinctrl_select_sleep_state(pdata->hph_en0_gpio_p);
- break;
- }
-
- return 0;
-}
-
-static const struct snd_soc_dapm_widget msm_dapm_widgets[] = {
-
- SND_SOC_DAPM_SUPPLY("MCLK", SND_SOC_NOPM, 0, 0,
- msm_mclk_event,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_SUPPLY("MCLK TX", SND_SOC_NOPM, 0, 0,
- msm_mclk_tx_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_SPK("Lineout_1 amp", NULL),
- SND_SOC_DAPM_SPK("Lineout_3 amp", NULL),
- SND_SOC_DAPM_SPK("Lineout_2 amp", NULL),
- SND_SOC_DAPM_SPK("Lineout_4 amp", NULL),
- SND_SOC_DAPM_SPK("hifi amp", msm_hifi_ctrl_event),
- SND_SOC_DAPM_MIC("Handset Mic", NULL),
- SND_SOC_DAPM_MIC("Headset Mic", NULL),
- SND_SOC_DAPM_MIC("ANCRight Headset Mic", NULL),
- SND_SOC_DAPM_MIC("ANCLeft Headset Mic", NULL),
- SND_SOC_DAPM_MIC("Analog Mic5", NULL),
- SND_SOC_DAPM_MIC("Analog Mic6", NULL),
-
- SND_SOC_DAPM_MIC("Digital Mic0", NULL),
- SND_SOC_DAPM_MIC("Digital Mic1", NULL),
- SND_SOC_DAPM_MIC("Digital Mic2", NULL),
- SND_SOC_DAPM_MIC("Digital Mic3", NULL),
- SND_SOC_DAPM_MIC("Digital Mic4", NULL),
- SND_SOC_DAPM_MIC("Digital Mic5", NULL),
-};
-
-static inline int param_is_mask(int p)
-{
- return (p >= SNDRV_PCM_HW_PARAM_FIRST_MASK) &&
- (p <= SNDRV_PCM_HW_PARAM_LAST_MASK);
-}
-
-static inline struct snd_mask *param_to_mask(struct snd_pcm_hw_params *p,
- int n)
-{
- return &(p->masks[n - SNDRV_PCM_HW_PARAM_FIRST_MASK]);
-}
-
-static void param_set_mask(struct snd_pcm_hw_params *p, int n, unsigned int bit)
-{
- if (bit >= SNDRV_MASK_MAX)
- return;
- if (param_is_mask(n)) {
- struct snd_mask *m = param_to_mask(p, n);
-
- m->bits[0] = 0;
- m->bits[1] = 0;
- m->bits[bit >> 5] |= (1 << (bit & 31));
- }
-}
-
-static int msm_slim_get_ch_from_beid(int32_t be_id)
-{
- int ch_id = 0;
-
- switch (be_id) {
- case MSM_BACKEND_DAI_SLIMBUS_0_RX:
- ch_id = SLIM_RX_0;
- break;
- case MSM_BACKEND_DAI_SLIMBUS_1_RX:
- ch_id = SLIM_RX_1;
- break;
- case MSM_BACKEND_DAI_SLIMBUS_2_RX:
- ch_id = SLIM_RX_2;
- break;
- case MSM_BACKEND_DAI_SLIMBUS_3_RX:
- ch_id = SLIM_RX_3;
- break;
- case MSM_BACKEND_DAI_SLIMBUS_4_RX:
- ch_id = SLIM_RX_4;
- break;
- case MSM_BACKEND_DAI_SLIMBUS_6_RX:
- ch_id = SLIM_RX_6;
- break;
- case MSM_BACKEND_DAI_SLIMBUS_0_TX:
- ch_id = SLIM_TX_0;
- break;
- case MSM_BACKEND_DAI_SLIMBUS_3_TX:
- ch_id = SLIM_TX_3;
- break;
- default:
- ch_id = SLIM_RX_0;
- break;
- }
-
- return ch_id;
-}
-
-static int msm_ext_disp_get_idx_from_beid(int32_t be_id)
-{
- int idx;
-
- switch (be_id) {
- case MSM_BACKEND_DAI_HDMI_RX:
- idx = HDMI_RX_IDX;
- break;
- case MSM_BACKEND_DAI_DISPLAY_PORT_RX:
- idx = DP_RX_IDX;
- break;
- default:
- pr_err("%s: Incorrect ext_disp BE id %d\n", __func__, be_id);
- idx = -EINVAL;
- break;
- }
-
- return idx;
-}
-
-static int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
- struct snd_pcm_hw_params *params)
-{
- struct snd_soc_dai_link *dai_link = rtd->dai_link;
- struct snd_interval *rate = hw_param_interval(params,
- SNDRV_PCM_HW_PARAM_RATE);
- struct snd_interval *channels = hw_param_interval(params,
- SNDRV_PCM_HW_PARAM_CHANNELS);
- int rc = 0;
- int idx;
- void *config = NULL;
- struct snd_soc_codec *codec = NULL;
-
- pr_debug("%s: format = %d, rate = %d\n",
- __func__, params_format(params), params_rate(params));
-
- switch (dai_link->id) {
- case MSM_BACKEND_DAI_SLIMBUS_0_RX:
- case MSM_BACKEND_DAI_SLIMBUS_1_RX:
- case MSM_BACKEND_DAI_SLIMBUS_2_RX:
- case MSM_BACKEND_DAI_SLIMBUS_3_RX:
- case MSM_BACKEND_DAI_SLIMBUS_4_RX:
- case MSM_BACKEND_DAI_SLIMBUS_6_RX:
- idx = msm_slim_get_ch_from_beid(dai_link->id);
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- slim_rx_cfg[idx].bit_format);
- rate->min = rate->max = slim_rx_cfg[idx].sample_rate;
- channels->min = channels->max = slim_rx_cfg[idx].channels;
- break;
-
- case MSM_BACKEND_DAI_SLIMBUS_0_TX:
- case MSM_BACKEND_DAI_SLIMBUS_3_TX:
- idx = msm_slim_get_ch_from_beid(dai_link->id);
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- slim_tx_cfg[idx].bit_format);
- rate->min = rate->max = slim_tx_cfg[idx].sample_rate;
- channels->min = channels->max = slim_tx_cfg[idx].channels;
- break;
-
- case MSM_BACKEND_DAI_SLIMBUS_1_TX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- slim_tx_cfg[1].bit_format);
- rate->min = rate->max = slim_tx_cfg[1].sample_rate;
- channels->min = channels->max = slim_tx_cfg[1].channels;
- break;
-
- case MSM_BACKEND_DAI_SLIMBUS_4_TX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- SNDRV_PCM_FORMAT_S32_LE);
- rate->min = rate->max = SAMPLING_RATE_8KHZ;
- channels->min = channels->max = msm_vi_feed_tx_ch;
- break;
-
- case MSM_BACKEND_DAI_SLIMBUS_5_RX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- slim_rx_cfg[5].bit_format);
- rate->min = rate->max = slim_rx_cfg[5].sample_rate;
- channels->min = channels->max = slim_rx_cfg[5].channels;
- break;
-
- case MSM_BACKEND_DAI_SLIMBUS_5_TX:
- codec = rtd->codec;
- rate->min = rate->max = SAMPLING_RATE_16KHZ;
- channels->min = channels->max = 1;
-
- config = msm_codec_fn.get_afe_config_fn(codec,
- AFE_SLIMBUS_SLAVE_PORT_CONFIG);
- if (config) {
- rc = afe_set_config(AFE_SLIMBUS_SLAVE_PORT_CONFIG,
- config, SLIMBUS_5_TX);
- if (rc)
- pr_err("%s: Failed to set slimbus slave port config %d\n",
- __func__, rc);
- }
- break;
-
- case MSM_BACKEND_DAI_SLIMBUS_7_RX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- slim_rx_cfg[SLIM_RX_7].bit_format);
- rate->min = rate->max = slim_rx_cfg[SLIM_RX_7].sample_rate;
- channels->min = channels->max =
- slim_rx_cfg[SLIM_RX_7].channels;
- break;
-
- case MSM_BACKEND_DAI_SLIMBUS_7_TX:
- rate->min = rate->max = slim_tx_cfg[SLIM_TX_7].sample_rate;
- channels->min = channels->max =
- slim_tx_cfg[SLIM_TX_7].channels;
- break;
-
- case MSM_BACKEND_DAI_SLIMBUS_8_TX:
- rate->min = rate->max = slim_tx_cfg[SLIM_TX_8].sample_rate;
- channels->min = channels->max =
- slim_tx_cfg[SLIM_TX_8].channels;
- break;
-
- case MSM_BACKEND_DAI_USB_RX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- usb_rx_cfg.bit_format);
- rate->min = rate->max = usb_rx_cfg.sample_rate;
- channels->min = channels->max = usb_rx_cfg.channels;
- break;
-
- case MSM_BACKEND_DAI_USB_TX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- usb_tx_cfg.bit_format);
- rate->min = rate->max = usb_tx_cfg.sample_rate;
- channels->min = channels->max = usb_tx_cfg.channels;
- break;
-
- case MSM_BACKEND_DAI_HDMI_RX:
- case MSM_BACKEND_DAI_DISPLAY_PORT_RX:
- idx = msm_ext_disp_get_idx_from_beid(dai_link->id);
- if (idx < 0) {
- pr_err("%s: Incorrect ext disp idx %d\n",
- __func__, idx);
- rc = idx;
- goto done;
- }
-
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- ext_disp_rx_cfg[idx].bit_format);
- rate->min = rate->max = ext_disp_rx_cfg[idx].sample_rate;
- channels->min = channels->max = ext_disp_rx_cfg[idx].channels;
- break;
-
- case MSM_BACKEND_DAI_AFE_PCM_RX:
- channels->min = channels->max = proxy_rx_cfg.channels;
- rate->min = rate->max = SAMPLING_RATE_48KHZ;
- break;
-
- case MSM_BACKEND_DAI_PRI_TDM_RX_0:
- channels->min = channels->max =
- tdm_rx_cfg[TDM_PRI][TDM_0].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- tdm_rx_cfg[TDM_PRI][TDM_0].bit_format);
- rate->min = rate->max = tdm_rx_cfg[TDM_PRI][TDM_0].sample_rate;
- break;
-
- case MSM_BACKEND_DAI_PRI_TDM_TX_0:
- channels->min = channels->max =
- tdm_tx_cfg[TDM_PRI][TDM_0].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- tdm_tx_cfg[TDM_PRI][TDM_0].bit_format);
- rate->min = rate->max = tdm_tx_cfg[TDM_PRI][TDM_0].sample_rate;
- break;
-
- case MSM_BACKEND_DAI_SEC_TDM_RX_0:
- channels->min = channels->max =
- tdm_rx_cfg[TDM_SEC][TDM_0].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- tdm_rx_cfg[TDM_SEC][TDM_0].bit_format);
- rate->min = rate->max = tdm_rx_cfg[TDM_SEC][TDM_0].sample_rate;
- break;
-
- case MSM_BACKEND_DAI_SEC_TDM_TX_0:
- channels->min = channels->max =
- tdm_tx_cfg[TDM_SEC][TDM_0].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- tdm_tx_cfg[TDM_SEC][TDM_0].bit_format);
- rate->min = rate->max = tdm_tx_cfg[TDM_SEC][TDM_0].sample_rate;
- break;
-
- case MSM_BACKEND_DAI_TERT_TDM_RX_0:
- channels->min = channels->max =
- tdm_rx_cfg[TDM_TERT][TDM_0].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- tdm_rx_cfg[TDM_TERT][TDM_0].bit_format);
- rate->min = rate->max = tdm_rx_cfg[TDM_TERT][TDM_0].sample_rate;
- break;
-
- case MSM_BACKEND_DAI_TERT_TDM_TX_0:
- channels->min = channels->max =
- tdm_tx_cfg[TDM_TERT][TDM_0].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- tdm_tx_cfg[TDM_TERT][TDM_0].bit_format);
- rate->min = rate->max = tdm_tx_cfg[TDM_TERT][TDM_0].sample_rate;
- break;
-
- case MSM_BACKEND_DAI_QUAT_TDM_RX_0:
- channels->min = channels->max =
- tdm_rx_cfg[TDM_QUAT][TDM_0].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- tdm_rx_cfg[TDM_QUAT][TDM_0].bit_format);
- rate->min = rate->max = tdm_rx_cfg[TDM_QUAT][TDM_0].sample_rate;
- break;
-
- case MSM_BACKEND_DAI_QUAT_TDM_TX_0:
- channels->min = channels->max =
- tdm_tx_cfg[TDM_QUAT][TDM_0].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- tdm_tx_cfg[TDM_QUAT][TDM_0].bit_format);
- rate->min = rate->max = tdm_tx_cfg[TDM_QUAT][TDM_0].sample_rate;
- break;
-
- case MSM_BACKEND_DAI_AUXPCM_RX:
- rate->min = rate->max =
- aux_pcm_rx_cfg[PRIM_AUX_PCM].sample_rate;
- channels->min = channels->max =
- aux_pcm_rx_cfg[PRIM_AUX_PCM].channels;
- break;
-
- case MSM_BACKEND_DAI_AUXPCM_TX:
- rate->min = rate->max =
- aux_pcm_tx_cfg[PRIM_AUX_PCM].sample_rate;
- channels->min = channels->max =
- aux_pcm_tx_cfg[PRIM_AUX_PCM].channels;
- break;
-
- case MSM_BACKEND_DAI_SEC_AUXPCM_RX:
- rate->min = rate->max =
- aux_pcm_rx_cfg[SEC_AUX_PCM].sample_rate;
- channels->min = channels->max =
- aux_pcm_rx_cfg[SEC_AUX_PCM].channels;
- break;
-
- case MSM_BACKEND_DAI_SEC_AUXPCM_TX:
- rate->min = rate->max =
- aux_pcm_tx_cfg[SEC_AUX_PCM].sample_rate;
- channels->min = channels->max =
- aux_pcm_tx_cfg[SEC_AUX_PCM].channels;
- break;
-
- case MSM_BACKEND_DAI_TERT_AUXPCM_RX:
- rate->min = rate->max =
- aux_pcm_rx_cfg[TERT_AUX_PCM].sample_rate;
- channels->min = channels->max =
- aux_pcm_rx_cfg[TERT_AUX_PCM].channels;
- break;
-
- case MSM_BACKEND_DAI_TERT_AUXPCM_TX:
- rate->min = rate->max =
- aux_pcm_tx_cfg[TERT_AUX_PCM].sample_rate;
- channels->min = channels->max =
- aux_pcm_tx_cfg[TERT_AUX_PCM].channels;
- break;
-
- case MSM_BACKEND_DAI_QUAT_AUXPCM_RX:
- rate->min = rate->max =
- aux_pcm_rx_cfg[QUAT_AUX_PCM].sample_rate;
- channels->min = channels->max =
- aux_pcm_rx_cfg[QUAT_AUX_PCM].channels;
- break;
-
- case MSM_BACKEND_DAI_QUAT_AUXPCM_TX:
- rate->min = rate->max =
- aux_pcm_tx_cfg[QUAT_AUX_PCM].sample_rate;
- channels->min = channels->max =
- aux_pcm_tx_cfg[QUAT_AUX_PCM].channels;
- break;
-
- case MSM_BACKEND_DAI_PRI_MI2S_RX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- mi2s_rx_cfg[PRIM_MI2S].bit_format);
- rate->min = rate->max = mi2s_rx_cfg[PRIM_MI2S].sample_rate;
- channels->min = channels->max =
- mi2s_rx_cfg[PRIM_MI2S].channels;
- break;
-
- case MSM_BACKEND_DAI_PRI_MI2S_TX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- mi2s_tx_cfg[PRIM_MI2S].bit_format);
- rate->min = rate->max = mi2s_tx_cfg[PRIM_MI2S].sample_rate;
- channels->min = channels->max =
- mi2s_tx_cfg[PRIM_MI2S].channels;
- break;
-
- case MSM_BACKEND_DAI_SECONDARY_MI2S_RX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- mi2s_rx_cfg[SEC_MI2S].bit_format);
- rate->min = rate->max = mi2s_rx_cfg[SEC_MI2S].sample_rate;
- channels->min = channels->max =
- mi2s_rx_cfg[SEC_MI2S].channels;
- break;
-
- case MSM_BACKEND_DAI_SECONDARY_MI2S_TX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- mi2s_tx_cfg[SEC_MI2S].bit_format);
- rate->min = rate->max = mi2s_tx_cfg[SEC_MI2S].sample_rate;
- channels->min = channels->max =
- mi2s_tx_cfg[SEC_MI2S].channels;
- break;
-
- case MSM_BACKEND_DAI_TERTIARY_MI2S_RX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- mi2s_rx_cfg[TERT_MI2S].bit_format);
- rate->min = rate->max = mi2s_rx_cfg[TERT_MI2S].sample_rate;
- channels->min = channels->max =
- mi2s_rx_cfg[TERT_MI2S].channels;
- break;
-
- case MSM_BACKEND_DAI_TERTIARY_MI2S_TX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- mi2s_tx_cfg[TERT_MI2S].bit_format);
- rate->min = rate->max = mi2s_tx_cfg[TERT_MI2S].sample_rate;
- channels->min = channels->max =
- mi2s_tx_cfg[TERT_MI2S].channels;
- break;
-
- case MSM_BACKEND_DAI_QUATERNARY_MI2S_RX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- mi2s_rx_cfg[QUAT_MI2S].bit_format);
- rate->min = rate->max = mi2s_rx_cfg[QUAT_MI2S].sample_rate;
- channels->min = channels->max =
- mi2s_rx_cfg[QUAT_MI2S].channels;
- break;
-
- case MSM_BACKEND_DAI_QUATERNARY_MI2S_TX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- mi2s_tx_cfg[QUAT_MI2S].bit_format);
- rate->min = rate->max = mi2s_tx_cfg[QUAT_MI2S].sample_rate;
- channels->min = channels->max =
- mi2s_tx_cfg[QUAT_MI2S].channels;
- break;
-
- default:
- rate->min = rate->max = SAMPLING_RATE_48KHZ;
- break;
- }
-
-done:
- return rc;
-}
-
-static bool msm_swap_gnd_mic(struct snd_soc_codec *codec)
-{
- struct snd_soc_card *card = codec->component.card;
- struct msm_asoc_mach_data *pdata =
- snd_soc_card_get_drvdata(card);
- int value = 0;
-
- if (pdata->us_euro_gpio_p) {
- value = msm_cdc_pinctrl_get_state(pdata->us_euro_gpio_p);
- if (value)
- msm_cdc_pinctrl_select_sleep_state(
- pdata->us_euro_gpio_p);
- else
- msm_cdc_pinctrl_select_active_state(
- pdata->us_euro_gpio_p);
- } else if (pdata->us_euro_gpio >= 0) {
- value = gpio_get_value_cansleep(pdata->us_euro_gpio);
- gpio_set_value_cansleep(pdata->us_euro_gpio, !value);
- }
- pr_debug("%s: swap select switch %d to %d\n", __func__, value, !value);
- return true;
-}
-
-static int msm_afe_set_config(struct snd_soc_codec *codec)
-{
- int ret = 0;
- void *config_data = NULL;
-
- if (!msm_codec_fn.get_afe_config_fn) {
- dev_err(codec->dev, "%s: codec get afe config not init'ed\n",
- __func__);
- return -EINVAL;
- }
-
- config_data = msm_codec_fn.get_afe_config_fn(codec,
- AFE_CDC_REGISTERS_CONFIG);
- if (config_data) {
- ret = afe_set_config(AFE_CDC_REGISTERS_CONFIG, config_data, 0);
- if (ret) {
- dev_err(codec->dev,
- "%s: Failed to set codec registers config %d\n",
- __func__, ret);
- return ret;
- }
- }
-
- config_data = msm_codec_fn.get_afe_config_fn(codec,
- AFE_CDC_REGISTER_PAGE_CONFIG);
- if (config_data) {
- ret = afe_set_config(AFE_CDC_REGISTER_PAGE_CONFIG, config_data,
- 0);
- if (ret)
- dev_err(codec->dev,
- "%s: Failed to set cdc register page config\n",
- __func__);
- }
-
- config_data = msm_codec_fn.get_afe_config_fn(codec,
- AFE_SLIMBUS_SLAVE_CONFIG);
- if (config_data) {
- ret = afe_set_config(AFE_SLIMBUS_SLAVE_CONFIG, config_data, 0);
- if (ret) {
- dev_err(codec->dev,
- "%s: Failed to set slimbus slave config %d\n",
- __func__, ret);
- return ret;
- }
- }
-
- return 0;
-}
-
-static void msm_afe_clear_config(void)
-{
- afe_clear_config(AFE_CDC_REGISTERS_CONFIG);
- afe_clear_config(AFE_SLIMBUS_SLAVE_CONFIG);
-}
-
-static int msm_adsp_power_up_config(struct snd_soc_codec *codec)
-{
- int ret = 0;
- unsigned long timeout;
- int adsp_ready = 0;
-
- timeout = jiffies +
- msecs_to_jiffies(ADSP_STATE_READY_TIMEOUT_MS);
-
- do {
- if (q6core_is_adsp_ready()) {
- pr_debug("%s: ADSP Audio is ready\n", __func__);
- adsp_ready = 1;
- break;
- }
- /*
- * ADSP will be coming up after subsystem restart and
- * it might not be fully up when the control reaches
- * here. So, wait for 50msec before checking ADSP state
- */
- msleep(50);
- } while (time_after(timeout, jiffies));
-
- if (!adsp_ready) {
- pr_err("%s: timed out waiting for ADSP Audio\n", __func__);
- ret = -ETIMEDOUT;
- goto err_fail;
- }
-
- ret = msm_afe_set_config(codec);
- if (ret)
- pr_err("%s: Failed to set AFE config. err %d\n",
- __func__, ret);
-
- return 0;
-
-err_fail:
- return ret;
-}
-
-static int msm8998_notifier_service_cb(struct notifier_block *this,
- unsigned long opcode, void *ptr)
-{
- int ret;
- struct snd_soc_card *card = NULL;
- const char *be_dl_name = LPASS_BE_SLIMBUS_0_RX;
- struct snd_soc_pcm_runtime *rtd;
- struct snd_soc_codec *codec;
-
- pr_debug("%s: Service opcode 0x%lx\n", __func__, opcode);
-
- switch (opcode) {
- case AUDIO_NOTIFIER_SERVICE_DOWN:
- /*
- * Use flag to ignore initial boot notifications
- * On initial boot msm_adsp_power_up_config is
- * called on init. There is no need to clear
- * and set the config again on initial boot.
- */
- if (is_initial_boot)
- break;
- msm_afe_clear_config();
- break;
- case AUDIO_NOTIFIER_SERVICE_UP:
- if (is_initial_boot) {
- is_initial_boot = false;
- break;
- }
- if (!spdev)
- return -EINVAL;
-
- card = platform_get_drvdata(spdev);
- rtd = snd_soc_get_pcm_runtime(card, be_dl_name);
- if (!rtd) {
- dev_err(card->dev,
- "%s: snd_soc_get_pcm_runtime for %s failed!\n",
- __func__, be_dl_name);
- ret = -EINVAL;
- goto done;
- }
- codec = rtd->codec;
-
- ret = msm_adsp_power_up_config(codec);
- if (ret < 0) {
- dev_err(card->dev,
- "%s: msm_adsp_power_up_config failed ret = %d!\n",
- __func__, ret);
- goto done;
- }
- break;
- default:
- break;
- }
-done:
- return NOTIFY_OK;
-}
-
-static struct notifier_block service_nb = {
- .notifier_call = msm8998_notifier_service_cb,
- .priority = -INT_MAX,
-};
-
-static int msm_audrx_init(struct snd_soc_pcm_runtime *rtd)
-{
- int ret = 0;
- void *config_data;
- struct snd_soc_codec *codec = rtd->codec;
- struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
- struct snd_soc_component *aux_comp;
- struct snd_card *card;
- struct snd_info_entry *entry;
- struct msm_asoc_mach_data *pdata =
- snd_soc_card_get_drvdata(rtd->card);
-
- /* Codec SLIMBUS configuration
- * RX1, RX2, RX3, RX4, RX5, RX6, RX7, RX8, RX9, RX10, RX11, RX12, RX13
- * TX1, TX2, TX3, TX4, TX5, TX6, TX7, TX8, TX9, TX10, TX11, TX12, TX13
- * TX14, TX15, TX16
- */
- unsigned int rx_ch[TASHA_RX_MAX] = {144, 145, 146, 147, 148, 149, 150,
- 151, 152, 153, 154, 155, 156};
- unsigned int tx_ch[TASHA_TX_MAX] = {128, 129, 130, 131, 132, 133,
- 134, 135, 136, 137, 138, 139,
- 140, 141, 142, 143};
-
- /* Tavil Codec SLIMBUS configuration
- * RX1, RX2, RX3, RX4, RX5, RX6, RX7, RX8
- * TX1, TX2, TX3, TX4, TX5, TX6, TX7, TX8, TX9, TX10, TX11, TX12, TX13
- * TX14, TX15, TX16
- */
- unsigned int rx_ch_tavil[WCD934X_RX_MAX] = {144, 145, 146, 147, 148,
- 149, 150, 151};
- unsigned int tx_ch_tavil[WCD934X_TX_MAX] = {128, 129, 130, 131, 132,
- 133, 134, 135, 136, 137,
- 138, 139, 140, 141, 142,
- 143};
-
- pr_info("%s: dev_name%s\n", __func__, dev_name(cpu_dai->dev));
-
- rtd->pmdown_time = 0;
-
- ret = snd_soc_add_codec_controls(codec, msm_snd_controls,
- ARRAY_SIZE(msm_snd_controls));
- if (ret < 0) {
- pr_err("%s: add_codec_controls failed, err %d\n",
- __func__, ret);
- return ret;
- }
-
- snd_soc_dapm_new_controls(dapm, msm_dapm_widgets,
- ARRAY_SIZE(msm_dapm_widgets));
-
- if (!strcmp(dev_name(codec_dai->dev), "tasha_codec"))
- snd_soc_dapm_add_routes(dapm, wcd_audio_paths_tasha,
- ARRAY_SIZE(wcd_audio_paths_tasha));
- else
- snd_soc_dapm_add_routes(dapm, wcd_audio_paths,
- ARRAY_SIZE(wcd_audio_paths));
-
- snd_soc_dapm_ignore_suspend(dapm, "Handset Mic");
- snd_soc_dapm_ignore_suspend(dapm, "Headset Mic");
- snd_soc_dapm_ignore_suspend(dapm, "ANCRight Headset Mic");
- snd_soc_dapm_ignore_suspend(dapm, "ANCLeft Headset Mic");
- snd_soc_dapm_ignore_suspend(dapm, "Digital Mic0");
- snd_soc_dapm_ignore_suspend(dapm, "Digital Mic1");
- snd_soc_dapm_ignore_suspend(dapm, "Digital Mic2");
- snd_soc_dapm_ignore_suspend(dapm, "Digital Mic3");
- snd_soc_dapm_ignore_suspend(dapm, "Digital Mic4");
- snd_soc_dapm_ignore_suspend(dapm, "Digital Mic5");
- snd_soc_dapm_ignore_suspend(dapm, "Analog Mic5");
- snd_soc_dapm_ignore_suspend(dapm, "Analog Mic6");
- snd_soc_dapm_ignore_suspend(dapm, "MADINPUT");
- snd_soc_dapm_ignore_suspend(dapm, "MAD_CPE_INPUT");
- snd_soc_dapm_ignore_suspend(dapm, "MAD_CPE_OUT1");
- snd_soc_dapm_ignore_suspend(dapm, "MAD_CPE_OUT2");
- snd_soc_dapm_ignore_suspend(dapm, "EAR");
- snd_soc_dapm_ignore_suspend(dapm, "LINEOUT1");
- snd_soc_dapm_ignore_suspend(dapm, "LINEOUT2");
- snd_soc_dapm_ignore_suspend(dapm, "ANC EAR");
- snd_soc_dapm_ignore_suspend(dapm, "SPK1 OUT");
- snd_soc_dapm_ignore_suspend(dapm, "SPK2 OUT");
- snd_soc_dapm_ignore_suspend(dapm, "HPHL");
- snd_soc_dapm_ignore_suspend(dapm, "HPHR");
- snd_soc_dapm_ignore_suspend(dapm, "AIF4 VI");
- snd_soc_dapm_ignore_suspend(dapm, "VIINPUT");
- snd_soc_dapm_ignore_suspend(dapm, "ANC HPHL");
- snd_soc_dapm_ignore_suspend(dapm, "ANC HPHR");
-
- if (!strcmp(dev_name(codec_dai->dev), "tasha_codec")) {
- snd_soc_dapm_ignore_suspend(dapm, "LINEOUT3");
- snd_soc_dapm_ignore_suspend(dapm, "LINEOUT4");
- snd_soc_dapm_ignore_suspend(dapm, "ANC LINEOUT1");
- snd_soc_dapm_ignore_suspend(dapm, "ANC LINEOUT2");
- }
-
- snd_soc_dapm_sync(dapm);
-
- if (!strcmp(dev_name(codec_dai->dev), "tavil_codec")) {
- snd_soc_dai_set_channel_map(codec_dai, ARRAY_SIZE(tx_ch_tavil),
- tx_ch_tavil, ARRAY_SIZE(rx_ch_tavil),
- rx_ch_tavil);
- } else {
- snd_soc_dai_set_channel_map(codec_dai, ARRAY_SIZE(tx_ch),
- tx_ch, ARRAY_SIZE(rx_ch),
- rx_ch);
- }
-
- if (!strcmp(dev_name(codec_dai->dev), "tavil_codec")) {
- msm_codec_fn.get_afe_config_fn = tavil_get_afe_config;
- } else {
- msm_codec_fn.get_afe_config_fn = tasha_get_afe_config;
- msm_codec_fn.mbhc_hs_detect_exit = tasha_mbhc_hs_detect_exit;
- }
-
- ret = msm_adsp_power_up_config(codec);
- if (ret) {
- pr_err("%s: Failed to set AFE config %d\n", __func__, ret);
- goto err_afe_cfg;
- }
-
- config_data = msm_codec_fn.get_afe_config_fn(codec,
- AFE_AANC_VERSION);
- if (config_data) {
- ret = afe_set_config(AFE_AANC_VERSION, config_data, 0);
- if (ret) {
- pr_err("%s: Failed to set aanc version %d\n",
- __func__, ret);
- goto err_afe_cfg;
- }
- }
-
- if (!strcmp(dev_name(codec_dai->dev), "tasha_codec")) {
- config_data = msm_codec_fn.get_afe_config_fn(codec,
- AFE_CDC_CLIP_REGISTERS_CONFIG);
- if (config_data) {
- ret = afe_set_config(AFE_CDC_CLIP_REGISTERS_CONFIG,
- config_data, 0);
- if (ret) {
- pr_err("%s: Failed to set clip registers %d\n",
- __func__, ret);
- goto err_afe_cfg;
- }
- }
- config_data = msm_codec_fn.get_afe_config_fn(codec,
- AFE_CLIP_BANK_SEL);
- if (config_data) {
- ret = afe_set_config(AFE_CLIP_BANK_SEL, config_data, 0);
- if (ret) {
- pr_err("%s: Failed to set AFE bank selection %d\n",
- __func__, ret);
- goto err_afe_cfg;
- }
- }
- }
-
- /*
- * Send speaker configuration only for WSA8810.
- * Defalut configuration is for WSA8815.
- */
- pr_debug("%s: Number of aux devices: %d\n",
- __func__, rtd->card->num_aux_devs);
- if (!strcmp(dev_name(codec_dai->dev), "tavil_codec")) {
- if (rtd->card->num_aux_devs &&
- !list_empty(&rtd->card->aux_comp_list)) {
- aux_comp = list_first_entry(&rtd->card->aux_comp_list,
- struct snd_soc_component, list_aux);
- if (!strcmp(aux_comp->name, WSA8810_NAME_1) ||
- !strcmp(aux_comp->name, WSA8810_NAME_2)) {
- tavil_set_spkr_mode(rtd->codec,
- WCD934X_SPKR_MODE_1);
- tavil_set_spkr_gain_offset(rtd->codec,
- WCD934X_RX_GAIN_OFFSET_M1P5_DB);
- }
- }
- card = rtd->card->snd_card;
- entry = snd_info_create_subdir(card->module, "codecs",
- card->proc_root);
- if (!entry) {
- pr_debug("%s: Cannot create codecs module entry\n",
- __func__);
- pdata->codec_root = NULL;
- goto done;
- }
- pdata->codec_root = entry;
- tavil_codec_info_create_codec_entry(pdata->codec_root, codec);
- } else {
- if (rtd->card->num_aux_devs &&
- !list_empty(&rtd->card->aux_comp_list)) {
- aux_comp = list_first_entry(&rtd->card->aux_comp_list,
- struct snd_soc_component, list_aux);
- if (!strcmp(aux_comp->name, WSA8810_NAME_1) ||
- !strcmp(aux_comp->name, WSA8810_NAME_2)) {
- tasha_set_spkr_mode(rtd->codec, SPKR_MODE_1);
- tasha_set_spkr_gain_offset(rtd->codec,
- RX_GAIN_OFFSET_M1P5_DB);
- }
- }
- card = rtd->card->snd_card;
- entry = snd_info_create_subdir(card->module, "codecs",
- card->proc_root);
- if (!entry) {
- pr_debug("%s: Cannot create codecs module entry\n",
- __func__);
- ret = 0;
- goto err_snd_module;
- }
- pdata->codec_root = entry;
- tasha_codec_info_create_codec_entry(pdata->codec_root, codec);
- }
-done:
- codec_reg_done = true;
- return 0;
-
-err_snd_module:
-err_afe_cfg:
- return ret;
-}
-
-static int msm_wcn_init(struct snd_soc_pcm_runtime *rtd)
-{
- unsigned int rx_ch[WCN_CDC_SLIM_RX_CH_MAX] = {157, 158};
- unsigned int tx_ch[WCN_CDC_SLIM_TX_CH_MAX] = {159, 160, 161};
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
-
- return snd_soc_dai_set_channel_map(codec_dai, ARRAY_SIZE(tx_ch),
- tx_ch, ARRAY_SIZE(rx_ch), rx_ch);
-}
-
-static void *def_tasha_mbhc_cal(void)
-{
- void *tasha_wcd_cal;
- struct wcd_mbhc_btn_detect_cfg *btn_cfg;
- u16 *btn_high;
-
- tasha_wcd_cal = kzalloc(WCD_MBHC_CAL_SIZE(WCD_MBHC_DEF_BUTTONS,
- WCD9XXX_MBHC_DEF_RLOADS), GFP_KERNEL);
- if (!tasha_wcd_cal)
- return NULL;
-
-#define S(X, Y) ((WCD_MBHC_CAL_PLUG_TYPE_PTR(tasha_wcd_cal)->X) = (Y))
- S(v_hs_max, 1600);
-#undef S
-#define S(X, Y) ((WCD_MBHC_CAL_BTN_DET_PTR(tasha_wcd_cal)->X) = (Y))
- S(num_btn, WCD_MBHC_DEF_BUTTONS);
-#undef S
-
- btn_cfg = WCD_MBHC_CAL_BTN_DET_PTR(tasha_wcd_cal);
- btn_high = ((void *)&btn_cfg->_v_btn_low) +
- (sizeof(btn_cfg->_v_btn_low[0]) * btn_cfg->num_btn);
-
- btn_high[0] = 75;
- btn_high[1] = 150;
- btn_high[2] = 237;
- btn_high[3] = 500;
- btn_high[4] = 500;
- btn_high[5] = 500;
- btn_high[6] = 500;
- btn_high[7] = 500;
-
- return tasha_wcd_cal;
-}
-
-static void *def_tavil_mbhc_cal(void)
-{
- void *tavil_wcd_cal;
- struct wcd_mbhc_btn_detect_cfg *btn_cfg;
- u16 *btn_high;
-
- tavil_wcd_cal = kzalloc(WCD_MBHC_CAL_SIZE(WCD_MBHC_DEF_BUTTONS,
- WCD9XXX_MBHC_DEF_RLOADS), GFP_KERNEL);
- if (!tavil_wcd_cal)
- return NULL;
-
-#define S(X, Y) ((WCD_MBHC_CAL_PLUG_TYPE_PTR(tavil_wcd_cal)->X) = (Y))
- S(v_hs_max, 1600);
-#undef S
-#define S(X, Y) ((WCD_MBHC_CAL_BTN_DET_PTR(tavil_wcd_cal)->X) = (Y))
- S(num_btn, WCD_MBHC_DEF_BUTTONS);
-#undef S
-
- btn_cfg = WCD_MBHC_CAL_BTN_DET_PTR(tavil_wcd_cal);
- btn_high = ((void *)&btn_cfg->_v_btn_low) +
- (sizeof(btn_cfg->_v_btn_low[0]) * btn_cfg->num_btn);
-
- btn_high[0] = 75;
- btn_high[1] = 150;
- btn_high[2] = 237;
- btn_high[3] = 500;
- btn_high[4] = 500;
- btn_high[5] = 500;
- btn_high[6] = 500;
- btn_high[7] = 500;
-
- return tavil_wcd_cal;
-}
-
-static int msm_snd_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- struct snd_soc_dai_link *dai_link = rtd->dai_link;
-
- int ret = 0;
- u32 rx_ch[SLIM_MAX_RX_PORTS], tx_ch[SLIM_MAX_TX_PORTS];
- u32 rx_ch_cnt = 0, tx_ch_cnt = 0;
- u32 user_set_tx_ch = 0;
- u32 rx_ch_count;
-
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
- ret = snd_soc_dai_get_channel_map(codec_dai,
- &tx_ch_cnt, tx_ch, &rx_ch_cnt, rx_ch);
- if (ret < 0) {
- pr_err("%s: failed to get codec chan map, err:%d\n",
- __func__, ret);
- goto err_ch_map;
- }
- if (dai_link->id == MSM_BACKEND_DAI_SLIMBUS_5_RX) {
- pr_debug("%s: rx_5_ch=%d\n", __func__,
- slim_rx_cfg[5].channels);
- rx_ch_count = slim_rx_cfg[5].channels;
- } else if (dai_link->id == MSM_BACKEND_DAI_SLIMBUS_2_RX) {
- pr_debug("%s: rx_2_ch=%d\n", __func__,
- slim_rx_cfg[2].channels);
- rx_ch_count = slim_rx_cfg[2].channels;
- } else if (dai_link->id == MSM_BACKEND_DAI_SLIMBUS_6_RX) {
- pr_debug("%s: rx_6_ch=%d\n", __func__,
- slim_rx_cfg[6].channels);
- rx_ch_count = slim_rx_cfg[6].channels;
- } else {
- pr_debug("%s: rx_0_ch=%d\n", __func__,
- slim_rx_cfg[0].channels);
- rx_ch_count = slim_rx_cfg[0].channels;
- }
- ret = snd_soc_dai_set_channel_map(cpu_dai, 0, 0,
- rx_ch_count, rx_ch);
- if (ret < 0) {
- pr_err("%s: failed to set cpu chan map, err:%d\n",
- __func__, ret);
- goto err_ch_map;
- }
- } else {
-
- pr_debug("%s: %s_tx_dai_id_%d_ch=%d\n", __func__,
- codec_dai->name, codec_dai->id, user_set_tx_ch);
- ret = snd_soc_dai_get_channel_map(codec_dai,
- &tx_ch_cnt, tx_ch, &rx_ch_cnt, rx_ch);
- if (ret < 0) {
- pr_err("%s: failed to get codec chan map\n, err:%d\n",
- __func__, ret);
- goto err_ch_map;
- }
- /* For <codec>_tx1 case */
- if (dai_link->id == MSM_BACKEND_DAI_SLIMBUS_0_TX)
- user_set_tx_ch = slim_tx_cfg[0].channels;
- /* For <codec>_tx3 case */
- else if (dai_link->id == MSM_BACKEND_DAI_SLIMBUS_1_TX)
- user_set_tx_ch = slim_tx_cfg[1].channels;
- else if (dai_link->id == MSM_BACKEND_DAI_SLIMBUS_4_TX)
- user_set_tx_ch = msm_vi_feed_tx_ch;
- else
- user_set_tx_ch = tx_ch_cnt;
-
- pr_debug("%s: msm_slim_0_tx_ch(%d) user_set_tx_ch(%d) tx_ch_cnt(%d), BE id (%d)\n",
- __func__, slim_tx_cfg[0].channels, user_set_tx_ch,
- tx_ch_cnt, dai_link->id);
-
- ret = snd_soc_dai_set_channel_map(cpu_dai,
- user_set_tx_ch, tx_ch, 0, 0);
- if (ret < 0)
- pr_err("%s: failed to set cpu chan map, err:%d\n",
- __func__, ret);
- }
-
-err_ch_map:
- return ret;
-}
-
-static int msm_snd_cpe_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- struct snd_soc_dai_link *dai_link = rtd->dai_link;
-
- int ret = 0;
- u32 tx_ch[SLIM_MAX_TX_PORTS];
- u32 tx_ch_cnt = 0;
- u32 user_set_tx_ch = 0;
-
- if (substream->stream != SNDRV_PCM_STREAM_CAPTURE) {
- pr_err("%s: Invalid stream type %d\n",
- __func__, substream->stream);
- ret = -EINVAL;
- goto err_stream_type;
- }
-
- pr_debug("%s: %s_tx_dai_id_%d\n", __func__,
- codec_dai->name, codec_dai->id);
- ret = snd_soc_dai_get_channel_map(codec_dai,
- &tx_ch_cnt, tx_ch, NULL, NULL);
- if (ret < 0) {
- pr_err("%s: failed to get codec chan map\n, err:%d\n",
- __func__, ret);
- goto err_ch_map;
- }
-
- user_set_tx_ch = tx_ch_cnt;
-
- pr_debug("%s: tx_ch_cnt(%d) BE id %d\n",
- __func__, tx_ch_cnt, dai_link->id);
-
- ret = snd_soc_dai_set_channel_map(cpu_dai,
- user_set_tx_ch, tx_ch, 0, 0);
- if (ret < 0)
- pr_err("%s: failed to set cpu chan map, err:%d\n",
- __func__, ret);
-err_ch_map:
-err_stream_type:
- return ret;
-}
-
-static int msm_slimbus_2_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- unsigned int rx_ch[SLIM_MAX_RX_PORTS], tx_ch[SLIM_MAX_TX_PORTS];
- unsigned int rx_ch_cnt = 0, tx_ch_cnt = 0;
- unsigned int num_tx_ch = 0;
- unsigned int num_rx_ch = 0;
- int ret = 0;
-
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
- num_rx_ch = params_channels(params);
- pr_debug("%s: %s rx_dai_id = %d num_ch = %d\n", __func__,
- codec_dai->name, codec_dai->id, num_rx_ch);
- ret = snd_soc_dai_get_channel_map(codec_dai,
- &tx_ch_cnt, tx_ch, &rx_ch_cnt, rx_ch);
- if (ret < 0) {
- pr_err("%s: failed to get codec chan map, err:%d\n",
- __func__, ret);
- goto err_ch_map;
- }
- ret = snd_soc_dai_set_channel_map(cpu_dai, 0, 0,
- num_rx_ch, rx_ch);
- if (ret < 0) {
- pr_err("%s: failed to set cpu chan map, err:%d\n",
- __func__, ret);
- goto err_ch_map;
- }
- } else {
- num_tx_ch = params_channels(params);
- pr_debug("%s: %s tx_dai_id = %d num_ch = %d\n", __func__,
- codec_dai->name, codec_dai->id, num_tx_ch);
- ret = snd_soc_dai_get_channel_map(codec_dai,
- &tx_ch_cnt, tx_ch, &rx_ch_cnt, rx_ch);
- if (ret < 0) {
- pr_err("%s: failed to get codec chan map, err:%d\n",
- __func__, ret);
- goto err_ch_map;
- }
- ret = snd_soc_dai_set_channel_map(cpu_dai,
- num_tx_ch, tx_ch, 0, 0);
- if (ret < 0) {
- pr_err("%s: failed to set cpu chan map, err:%d\n",
- __func__, ret);
- goto err_ch_map;
- }
- }
-
-err_ch_map:
- return ret;
-}
-
-static int msm_wcn_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- struct snd_soc_dai_link *dai_link = rtd->dai_link;
- u32 rx_ch[WCN_CDC_SLIM_RX_CH_MAX], tx_ch[WCN_CDC_SLIM_TX_CH_MAX];
- u32 rx_ch_cnt = 0, tx_ch_cnt = 0;
- int ret;
-
- dev_dbg(rtd->dev, "%s: %s_tx_dai_id_%d\n", __func__,
- codec_dai->name, codec_dai->id);
- ret = snd_soc_dai_get_channel_map(codec_dai,
- &tx_ch_cnt, tx_ch, &rx_ch_cnt, rx_ch);
- if (ret) {
- dev_err(rtd->dev,
- "%s: failed to get BTFM codec chan map\n, err:%d\n",
- __func__, ret);
- goto exit;
- }
-
- dev_dbg(rtd->dev, "%s: tx_ch_cnt(%d) BE id %d\n",
- __func__, tx_ch_cnt, dai_link->id);
-
- ret = snd_soc_dai_set_channel_map(cpu_dai,
- tx_ch_cnt, tx_ch, rx_ch_cnt, rx_ch);
- if (ret)
- dev_err(rtd->dev, "%s: failed to set cpu chan map, err:%d\n",
- __func__, ret);
-
-exit:
- return ret;
-}
-
-static int msm_aux_pcm_snd_startup(struct snd_pcm_substream *substream)
-{
- int ret = 0;
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- int index = cpu_dai->id - 1;
-
- dev_dbg(rtd->card->dev,
- "%s: substream = %s stream = %d, dai name %s, dai ID %d\n",
- __func__, substream->name, substream->stream,
- cpu_dai->name, cpu_dai->id);
-
- if (index < PRIM_AUX_PCM || index > QUAT_AUX_PCM) {
- ret = -EINVAL;
- dev_err(rtd->card->dev,
- "%s: CPU DAI id (%d) out of range\n",
- __func__, cpu_dai->id);
- goto done;
- }
-
- mutex_lock(&auxpcm_intf_conf[index].lock);
- if (++auxpcm_intf_conf[index].ref_cnt == 1) {
- if (mi2s_auxpcm_conf[index].pcm_i2s_sel_vt_addr != NULL) {
- mutex_lock(&mi2s_auxpcm_conf[index].lock);
- iowrite32(1,
- mi2s_auxpcm_conf[index].pcm_i2s_sel_vt_addr);
- mutex_unlock(&mi2s_auxpcm_conf[index].lock);
- } else {
- dev_err(rtd->card->dev,
- "%s lpaif_tert_muxsel_virt_addr is NULL\n",
- __func__);
- ret = -EINVAL;
- }
- }
- if (ret < 0)
- auxpcm_intf_conf[index].ref_cnt--;
-
- mutex_unlock(&auxpcm_intf_conf[index].lock);
-
-done:
- return ret;
-}
-
-static void msm_aux_pcm_snd_shutdown(struct snd_pcm_substream *substream)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- int index = rtd->cpu_dai->id - 1;
-
- dev_dbg(rtd->card->dev,
- "%s: substream = %s stream = %d, dai name %s, dai ID %d\n",
- __func__,
- substream->name, substream->stream,
- rtd->cpu_dai->name, rtd->cpu_dai->id);
-
- if (index < PRIM_AUX_PCM || index > QUAT_AUX_PCM) {
- dev_err(rtd->card->dev,
- "%s: CPU DAI id (%d) out of range\n",
- __func__, rtd->cpu_dai->id);
- return;
- }
-
- mutex_lock(&auxpcm_intf_conf[index].lock);
- if (--auxpcm_intf_conf[index].ref_cnt == 0) {
- if (mi2s_auxpcm_conf[index].pcm_i2s_sel_vt_addr != NULL) {
- mutex_lock(&mi2s_auxpcm_conf[index].lock);
- iowrite32(0,
- mi2s_auxpcm_conf[index].pcm_i2s_sel_vt_addr);
- mutex_unlock(&mi2s_auxpcm_conf[index].lock);
- } else {
- dev_err(rtd->card->dev,
- "%s lpaif_tert_muxsel_virt_addr is NULL\n",
- __func__);
- }
- }
- mutex_unlock(&auxpcm_intf_conf[index].lock);
-}
-
-static int msm_get_port_id(int be_id)
-{
- int afe_port_id;
-
- switch (be_id) {
- case MSM_BACKEND_DAI_PRI_MI2S_RX:
- afe_port_id = AFE_PORT_ID_PRIMARY_MI2S_RX;
- break;
- case MSM_BACKEND_DAI_PRI_MI2S_TX:
- afe_port_id = AFE_PORT_ID_PRIMARY_MI2S_TX;
- break;
- case MSM_BACKEND_DAI_SECONDARY_MI2S_RX:
- afe_port_id = AFE_PORT_ID_SECONDARY_MI2S_RX;
- break;
- case MSM_BACKEND_DAI_SECONDARY_MI2S_TX:
- afe_port_id = AFE_PORT_ID_SECONDARY_MI2S_TX;
- break;
- case MSM_BACKEND_DAI_TERTIARY_MI2S_RX:
- afe_port_id = AFE_PORT_ID_TERTIARY_MI2S_RX;
- break;
- case MSM_BACKEND_DAI_TERTIARY_MI2S_TX:
- afe_port_id = AFE_PORT_ID_TERTIARY_MI2S_TX;
- break;
- case MSM_BACKEND_DAI_QUATERNARY_MI2S_RX:
- afe_port_id = AFE_PORT_ID_QUATERNARY_MI2S_RX;
- break;
- case MSM_BACKEND_DAI_QUATERNARY_MI2S_TX:
- afe_port_id = AFE_PORT_ID_QUATERNARY_MI2S_TX;
- break;
- default:
- pr_err("%s: Invalid BE id: %d\n", __func__, be_id);
- afe_port_id = -EINVAL;
- }
-
- return afe_port_id;
-}
-
-static u32 get_mi2s_bits_per_sample(u32 bit_format)
-{
- u32 bit_per_sample;
-
- switch (bit_format) {
- case SNDRV_PCM_FORMAT_S32_LE:
- case SNDRV_PCM_FORMAT_S24_3LE:
- case SNDRV_PCM_FORMAT_S24_LE:
- bit_per_sample = 32;
- break;
- case SNDRV_PCM_FORMAT_S16_LE:
- default:
- bit_per_sample = 16;
- break;
- }
-
- return bit_per_sample;
-}
-
-static void update_mi2s_clk_val(int dai_id, int stream)
-{
- u32 bit_per_sample;
-
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
- bit_per_sample =
- get_mi2s_bits_per_sample(mi2s_rx_cfg[dai_id].bit_format);
- mi2s_clk[dai_id].clk_freq_in_hz =
- mi2s_rx_cfg[dai_id].sample_rate * 2 * bit_per_sample;
- } else {
- bit_per_sample =
- get_mi2s_bits_per_sample(mi2s_tx_cfg[dai_id].bit_format);
- mi2s_clk[dai_id].clk_freq_in_hz =
- mi2s_tx_cfg[dai_id].sample_rate * 2 * bit_per_sample;
- }
-}
-
-static int msm_mi2s_set_sclk(struct snd_pcm_substream *substream, bool enable)
-{
- int ret = 0;
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- int port_id = 0;
- int index = cpu_dai->id;
-
- port_id = msm_get_port_id(rtd->dai_link->id);
- if (port_id < 0) {
- dev_err(rtd->card->dev, "%s: Invalid port_id\n", __func__);
- ret = port_id;
- goto done;
- }
-
- if (enable) {
- update_mi2s_clk_val(index, substream->stream);
- dev_dbg(rtd->card->dev, "%s: clock rate %ul\n", __func__,
- mi2s_clk[index].clk_freq_in_hz);
- }
-
- mi2s_clk[index].enable = enable;
- ret = afe_set_lpass_clock_v2(port_id,
- &mi2s_clk[index]);
- if (ret < 0) {
- dev_err(rtd->card->dev,
- "%s: afe lpass clock failed for port 0x%x , err:%d\n",
- __func__, port_id, ret);
- goto done;
- }
-
-done:
- return ret;
-}
-
-static int msm_set_pinctrl(struct msm_pinctrl_info *pinctrl_info,
- enum pinctrl_pin_state new_state)
-{
- int ret = 0;
- int curr_state = 0;
-
- if (pinctrl_info == NULL) {
- pr_err("%s: pinctrl_info is NULL\n", __func__);
- ret = -EINVAL;
- goto err;
- }
-
- if (pinctrl_info->pinctrl == NULL) {
- pr_err("%s: pinctrl_info->pinctrl is NULL\n", __func__);
- ret = -EINVAL;
- goto err;
- }
-
- curr_state = pinctrl_info->curr_state;
- pinctrl_info->curr_state = new_state;
- pr_debug("%s: curr_state = %s new_state = %s\n", __func__,
- pin_states[curr_state], pin_states[pinctrl_info->curr_state]);
-
- if (curr_state == pinctrl_info->curr_state) {
- pr_debug("%s: Already in same state\n", __func__);
- goto err;
- }
-
- if (curr_state != STATE_DISABLE &&
- pinctrl_info->curr_state != STATE_DISABLE) {
- pr_debug("%s: state already active cannot switch\n", __func__);
- ret = -EIO;
- goto err;
- }
-
- switch (pinctrl_info->curr_state) {
- case STATE_MI2S_ACTIVE:
- ret = pinctrl_select_state(pinctrl_info->pinctrl,
- pinctrl_info->mi2s_active);
- if (ret) {
- pr_err("%s: MI2S state select failed with %d\n",
- __func__, ret);
- ret = -EIO;
- goto err;
- }
- break;
- case STATE_TDM_ACTIVE:
- ret = pinctrl_select_state(pinctrl_info->pinctrl,
- pinctrl_info->tdm_active);
- if (ret) {
- pr_err("%s: TDM state select failed with %d\n",
- __func__, ret);
- ret = -EIO;
- goto err;
- }
- break;
- case STATE_DISABLE:
- if (curr_state == STATE_MI2S_ACTIVE) {
- ret = pinctrl_select_state(pinctrl_info->pinctrl,
- pinctrl_info->mi2s_disable);
- } else {
- ret = pinctrl_select_state(pinctrl_info->pinctrl,
- pinctrl_info->tdm_disable);
- }
- if (ret) {
- pr_err("%s: state disable failed with %d\n",
- __func__, ret);
- ret = -EIO;
- goto err;
- }
- break;
- default:
- pr_err("%s: TLMM pin state is invalid\n", __func__);
- return -EINVAL;
- }
-
-err:
- return ret;
-}
-
-static void msm_release_pinctrl(struct platform_device *pdev)
-{
- struct snd_soc_card *card = platform_get_drvdata(pdev);
- struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
- struct msm_pinctrl_info *pinctrl_info = &pdata->pinctrl_info;
-
- if (pinctrl_info->pinctrl) {
- devm_pinctrl_put(pinctrl_info->pinctrl);
- pinctrl_info->pinctrl = NULL;
- }
-}
-
-static int msm_get_pinctrl(struct platform_device *pdev)
-{
- struct snd_soc_card *card = platform_get_drvdata(pdev);
- struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
- struct msm_pinctrl_info *pinctrl_info = NULL;
- struct pinctrl *pinctrl;
- int ret;
-
- pinctrl_info = &pdata->pinctrl_info;
-
- if (pinctrl_info == NULL) {
- pr_err("%s: pinctrl_info is NULL\n", __func__);
- return -EINVAL;
- }
-
- pinctrl = devm_pinctrl_get(&pdev->dev);
- if (IS_ERR_OR_NULL(pinctrl)) {
- pr_err("%s: Unable to get pinctrl handle\n", __func__);
- return -EINVAL;
- }
- pinctrl_info->pinctrl = pinctrl;
-
- /* get all the states handles from Device Tree */
- pinctrl_info->mi2s_disable = pinctrl_lookup_state(pinctrl,
- "quat-mi2s-sleep");
- if (IS_ERR(pinctrl_info->mi2s_disable)) {
- pr_err("%s: could not get mi2s_disable pinstate\n", __func__);
- goto err;
- }
- pinctrl_info->mi2s_active = pinctrl_lookup_state(pinctrl,
- "quat-mi2s-active");
- if (IS_ERR(pinctrl_info->mi2s_active)) {
- pr_err("%s: could not get mi2s_active pinstate\n", __func__);
- goto err;
- }
- pinctrl_info->tdm_disable = pinctrl_lookup_state(pinctrl,
- "quat-tdm-sleep");
- if (IS_ERR(pinctrl_info->tdm_disable)) {
- pr_err("%s: could not get tdm_disable pinstate\n", __func__);
- goto err;
- }
- pinctrl_info->tdm_active = pinctrl_lookup_state(pinctrl,
- "quat-tdm-active");
- if (IS_ERR(pinctrl_info->tdm_active)) {
- pr_err("%s: could not get tdm_active pinstate\n",
- __func__);
- goto err;
- }
- /* Reset the TLMM pins to a default state */
- ret = pinctrl_select_state(pinctrl_info->pinctrl,
- pinctrl_info->mi2s_disable);
- if (ret != 0) {
- pr_err("%s: Disable TLMM pins failed with %d\n",
- __func__, ret);
- ret = -EIO;
- goto err;
- }
- pinctrl_info->curr_state = STATE_DISABLE;
-
- return 0;
-
-err:
- devm_pinctrl_put(pinctrl);
- pinctrl_info->pinctrl = NULL;
- return -EINVAL;
-}
-
-static int msm_tdm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
- struct snd_pcm_hw_params *params)
-{
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- struct snd_interval *rate = hw_param_interval(params,
- SNDRV_PCM_HW_PARAM_RATE);
- struct snd_interval *channels = hw_param_interval(params,
- SNDRV_PCM_HW_PARAM_CHANNELS);
-
- if (cpu_dai->id == AFE_PORT_ID_QUATERNARY_TDM_RX) {
- channels->min = channels->max =
- tdm_rx_cfg[TDM_QUAT][TDM_0].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- tdm_rx_cfg[TDM_QUAT][TDM_0].bit_format);
- rate->min = rate->max =
- tdm_rx_cfg[TDM_QUAT][TDM_0].sample_rate;
- } else if (cpu_dai->id == AFE_PORT_ID_SECONDARY_TDM_RX) {
- channels->min = channels->max =
- tdm_rx_cfg[TDM_SEC][TDM_0].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- tdm_rx_cfg[TDM_SEC][TDM_0].bit_format);
- rate->min = rate->max = tdm_rx_cfg[TDM_SEC][TDM_0].sample_rate;
- } else {
- pr_err("%s: dai id 0x%x not supported\n",
- __func__, cpu_dai->id);
- return -EINVAL;
- }
-
- pr_debug("%s: dai id = 0x%x channels = %d rate = %d format = 0x%x\n",
- __func__, cpu_dai->id, channels->max, rate->max,
- params_format(params));
-
- return 0;
-}
-
-static int msm8998_tdm_snd_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- int ret = 0;
- int channels, slot_width, slots;
- unsigned int slot_mask;
- unsigned int slot_offset[8] = {0, 4, 8, 12, 16, 20, 24, 28};
-
- pr_debug("%s: dai id = 0x%x\n", __func__, cpu_dai->id);
-
- slots = tdm_rx_cfg[TDM_QUAT][TDM_0].channels;
- /*2 slot config - bits 0 and 1 set for the first two slots */
- slot_mask = 0x0000FFFF >> (16-slots);
- slot_width = 32;
- channels = slots;
-
- pr_debug("%s: slot_width %d slots %d\n", __func__, slot_width, slots);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
- pr_debug("%s: slot_width %d\n", __func__, slot_width);
- ret = snd_soc_dai_set_tdm_slot(cpu_dai, 0, slot_mask,
- slots, slot_width);
- if (ret < 0) {
- pr_err("%s: failed to set tdm slot, err:%d\n",
- __func__, ret);
- goto end;
- }
-
- ret = snd_soc_dai_set_channel_map(cpu_dai,
- 0, NULL, channels, slot_offset);
- if (ret < 0) {
- pr_err("%s: failed to set channel map, err:%d\n",
- __func__, ret);
- goto end;
- }
- } else {
- pr_err("%s: invalid use case, err:%d\n",
- __func__, ret);
- }
-
-end:
- return ret;
-}
-
-static int msm8998_tdm_snd_startup(struct snd_pcm_substream *substream)
-{
- int ret = 0;
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_card *card = rtd->card;
- struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
- struct msm_pinctrl_info *pinctrl_info = &pdata->pinctrl_info;
-
- ret = msm_set_pinctrl(pinctrl_info, STATE_TDM_ACTIVE);
- if (ret)
- pr_err("%s: MI2S TLMM pinctrl set failed with %d\n",
- __func__, ret);
-
- return ret;
-}
-
-static void msm8998_tdm_snd_shutdown(struct snd_pcm_substream *substream)
-{
- int ret = 0;
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_card *card = rtd->card;
- struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
- struct msm_pinctrl_info *pinctrl_info = &pdata->pinctrl_info;
-
- ret = msm_set_pinctrl(pinctrl_info, STATE_DISABLE);
- if (ret)
- pr_err("%s: MI2S TLMM pinctrl set failed with %d\n",
- __func__, ret);
-
-}
-
-static struct snd_soc_ops msm8998_tdm_be_ops = {
- .hw_params = msm8998_tdm_snd_hw_params,
- .startup = msm8998_tdm_snd_startup,
- .shutdown = msm8998_tdm_snd_shutdown
-};
-
-static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
-{
- int ret = 0;
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- int index = cpu_dai->id;
- unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS;
- struct snd_soc_card *card = rtd->card;
- struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
- struct msm_pinctrl_info *pinctrl_info = &pdata->pinctrl_info;
- int ret_pinctrl = 0;
-
- dev_dbg(rtd->card->dev,
- "%s: substream = %s stream = %d, dai name %s, dai ID %d\n",
- __func__, substream->name, substream->stream,
- cpu_dai->name, cpu_dai->id);
-
- if (index < PRIM_MI2S || index > QUAT_MI2S) {
- ret = -EINVAL;
- dev_err(rtd->card->dev,
- "%s: CPU DAI id (%d) out of range\n",
- __func__, cpu_dai->id);
- goto done;
- }
- if (index == QUAT_MI2S) {
- ret_pinctrl = msm_set_pinctrl(pinctrl_info, STATE_MI2S_ACTIVE);
- if (ret_pinctrl) {
- pr_err("%s: MI2S TLMM pinctrl set failed with %d\n",
- __func__, ret_pinctrl);
- }
- }
-
- /*
- * Muxtex protection in case the same MI2S
- * interface using for both TX and RX so
- * that the same clock won't be enable twice.
- */
- mutex_lock(&mi2s_intf_conf[index].lock);
- if (++mi2s_intf_conf[index].ref_cnt == 1) {
- ret = msm_mi2s_set_sclk(substream, true);
- if (ret < 0) {
- dev_err(rtd->card->dev,
- "%s: afe lpass clock failed to enable MI2S clock, err:%d\n",
- __func__, ret);
- goto clean_up;
- }
- if (mi2s_auxpcm_conf[index].pcm_i2s_sel_vt_addr != NULL) {
- mutex_lock(&mi2s_auxpcm_conf[index].lock);
- iowrite32(0,
- mi2s_auxpcm_conf[index].pcm_i2s_sel_vt_addr);
- mutex_unlock(&mi2s_auxpcm_conf[index].lock);
- } else {
- dev_err(rtd->card->dev,
- "%s lpaif_muxsel_virt_addr is NULL for dai %d\n",
- __func__, index);
- ret = -EINVAL;
- goto clk_off;
- }
- /* Check if msm needs to provide the clock to the interface */
- if (!mi2s_intf_conf[index].msm_is_mi2s_master)
- fmt = SND_SOC_DAIFMT_CBM_CFM;
- ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
- if (ret < 0) {
- pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n",
- __func__, index, ret);
- goto clk_off;
- }
- }
-clk_off:
- if (ret < 0)
- msm_mi2s_set_sclk(substream, false);
-clean_up:
- if (ret < 0)
- mi2s_intf_conf[index].ref_cnt--;
- mutex_unlock(&mi2s_intf_conf[index].lock);
-done:
- return ret;
-}
-
-static void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream)
-{
- int ret;
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- int index = rtd->cpu_dai->id;
- struct snd_soc_card *card = rtd->card;
- struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
- struct msm_pinctrl_info *pinctrl_info = &pdata->pinctrl_info;
- int ret_pinctrl = 0;
-
- pr_debug("%s(): substream = %s stream = %d\n", __func__,
- substream->name, substream->stream);
- if (index < PRIM_MI2S || index > QUAT_MI2S) {
- pr_err("%s:invalid MI2S DAI(%d)\n", __func__, index);
- return;
- }
-
- mutex_lock(&mi2s_intf_conf[index].lock);
- if (--mi2s_intf_conf[index].ref_cnt == 0) {
- ret = msm_mi2s_set_sclk(substream, false);
- if (ret < 0)
- pr_err("%s:clock disable failed for MI2S (%d); ret=%d\n",
- __func__, index, ret);
- }
- mutex_unlock(&mi2s_intf_conf[index].lock);
-
- if (index == QUAT_MI2S) {
- ret_pinctrl = msm_set_pinctrl(pinctrl_info, STATE_DISABLE);
- if (ret_pinctrl)
- pr_err("%s: MI2S TLMM pinctrl set failed with %d\n",
- __func__, ret_pinctrl);
- }
-}
-
-static struct snd_soc_ops msm_mi2s_be_ops = {
- .startup = msm_mi2s_snd_startup,
- .shutdown = msm_mi2s_snd_shutdown,
-};
-
-static struct snd_soc_ops msm_aux_pcm_be_ops = {
- .startup = msm_aux_pcm_snd_startup,
- .shutdown = msm_aux_pcm_snd_shutdown,
-};
-
-static unsigned int tdm_param_set_slot_mask(u16 port_id, int slot_width,
- int slots)
-{
- unsigned int slot_mask = 0;
- int i, j;
- unsigned int *slot_offset;
-
- for (i = TDM_0; i < TDM_PORT_MAX; i++) {
- slot_offset = tdm_slot_offset[i];
-
- for (j = 0; j < TDM_SLOT_OFFSET_MAX; j++) {
- if (slot_offset[j] != AFE_SLOT_MAPPING_OFFSET_INVALID)
- slot_mask |=
- (1 << ((slot_offset[j] * 8) / slot_width));
- else
- break;
- }
- }
-
- return slot_mask;
-}
-
-static int msm_tdm_snd_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- int ret = 0;
- int channels, slot_width, slots;
- unsigned int slot_mask;
- unsigned int *slot_offset;
- int offset_channels = 0;
- int i;
-
- pr_debug("%s: dai id = 0x%x\n", __func__, cpu_dai->id);
-
- channels = params_channels(params);
- switch (channels) {
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- case 8:
- switch (params_format(params)) {
- case SNDRV_PCM_FORMAT_S32_LE:
- case SNDRV_PCM_FORMAT_S24_LE:
- case SNDRV_PCM_FORMAT_S16_LE:
- /*
- * up to 8 channels HW config should
- * use 32 bit slot width for max support of
- * stream bit width. (slot_width > bit_width)
- */
- slot_width = 32;
- break;
- default:
- pr_err("%s: invalid param format 0x%x\n",
- __func__, params_format(params));
- return -EINVAL;
- }
- slots = 8;
- slot_mask = tdm_param_set_slot_mask(cpu_dai->id,
- slot_width,
- slots);
- if (!slot_mask) {
- pr_err("%s: invalid slot_mask 0x%x\n",
- __func__, slot_mask);
- return -EINVAL;
- }
- break;
- default:
- pr_err("%s: invalid param channels %d\n",
- __func__, channels);
- return -EINVAL;
- }
- /* currently only supporting TDM_RX_0 and TDM_TX_0 */
- switch (cpu_dai->id) {
- case AFE_PORT_ID_PRIMARY_TDM_RX:
- case AFE_PORT_ID_SECONDARY_TDM_RX:
- case AFE_PORT_ID_TERTIARY_TDM_RX:
- case AFE_PORT_ID_QUATERNARY_TDM_RX:
- case AFE_PORT_ID_PRIMARY_TDM_TX:
- case AFE_PORT_ID_SECONDARY_TDM_TX:
- case AFE_PORT_ID_TERTIARY_TDM_TX:
- case AFE_PORT_ID_QUATERNARY_TDM_TX:
- slot_offset = tdm_slot_offset[TDM_0];
- break;
- default:
- pr_err("%s: dai id 0x%x not supported\n",
- __func__, cpu_dai->id);
- return -EINVAL;
- }
-
- for (i = 0; i < TDM_SLOT_OFFSET_MAX; i++) {
- if (slot_offset[i] != AFE_SLOT_MAPPING_OFFSET_INVALID)
- offset_channels++;
- else
- break;
- }
-
- if (offset_channels == 0) {
- pr_err("%s: slot offset not supported, offset_channels %d\n",
- __func__, offset_channels);
- return -EINVAL;
- }
-
- if (channels > offset_channels) {
- pr_err("%s: channels %d exceed offset_channels %d\n",
- __func__, channels, offset_channels);
- return -EINVAL;
- }
-
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
- ret = snd_soc_dai_set_tdm_slot(cpu_dai, 0, slot_mask,
- slots, slot_width);
- if (ret < 0) {
- pr_err("%s: failed to set tdm slot, err:%d\n",
- __func__, ret);
- goto end;
- }
-
- ret = snd_soc_dai_set_channel_map(cpu_dai, 0, NULL,
- channels, slot_offset);
- if (ret < 0) {
- pr_err("%s: failed to set channel map, err:%d\n",
- __func__, ret);
- goto end;
- }
- } else {
- ret = snd_soc_dai_set_tdm_slot(cpu_dai, slot_mask, 0,
- slots, slot_width);
- if (ret < 0) {
- pr_err("%s: failed to set tdm slot, err:%d\n",
- __func__, ret);
- goto end;
- }
-
- ret = snd_soc_dai_set_channel_map(cpu_dai, channels,
- slot_offset, 0, NULL);
- if (ret < 0) {
- pr_err("%s: failed to set channel map, err:%d\n",
- __func__, ret);
- goto end;
- }
- }
-end:
- return ret;
-}
-
-static struct snd_soc_ops msm_be_ops = {
- .hw_params = msm_snd_hw_params,
-};
-
-static struct snd_soc_ops msm_cpe_ops = {
- .hw_params = msm_snd_cpe_hw_params,
-};
-
-static struct snd_soc_ops msm_slimbus_2_be_ops = {
- .hw_params = msm_slimbus_2_hw_params,
-};
-
-static struct snd_soc_ops msm_wcn_ops = {
- .hw_params = msm_wcn_hw_params,
-};
-
-static struct snd_soc_ops msm_tdm_be_ops = {
- .hw_params = msm_tdm_snd_hw_params
-};
-
-/* Digital audio interface glue - connects codec <---> CPU */
-static struct snd_soc_dai_link msm_common_dai_links[] = {
- /* FrontEnd DAI Links */
- {
- .name = MSM_DAILINK_NAME(Media1),
- .stream_name = "MultiMedia1",
- .cpu_dai_name = "MultiMedia1",
- .platform_name = "msm-pcm-dsp.0",
- .dynamic = 1,
- .async_ops = ASYNC_DPCM_SND_SOC_PREPARE,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- /* this dainlink has playback support */
- .ignore_pmdown_time = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA1
- },
- {
- .name = MSM_DAILINK_NAME(Media2),
- .stream_name = "MultiMedia2",
- .cpu_dai_name = "MultiMedia2",
- .platform_name = "msm-pcm-dsp.0",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .ignore_suspend = 1,
- /* this dainlink has playback support */
- .ignore_pmdown_time = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA2,
- },
- {
- .name = "VoiceMMode1",
- .stream_name = "VoiceMMode1",
- .cpu_dai_name = "VoiceMMode1",
- .platform_name = "msm-pcm-voice",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_VOICEMMODE1,
- },
- {
- .name = "MSM VoIP",
- .stream_name = "VoIP",
- .cpu_dai_name = "VoIP",
- .platform_name = "msm-voip-dsp",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- /* this dainlink has playback support */
- .ignore_pmdown_time = 1,
- .id = MSM_FRONTEND_DAI_VOIP,
- },
- {
- .name = MSM_DAILINK_NAME(ULL),
- .stream_name = "MultiMedia3",
- .cpu_dai_name = "MultiMedia3",
- .platform_name = "msm-pcm-dsp.2",
- .dynamic = 1,
- .async_ops = ASYNC_DPCM_SND_SOC_PREPARE,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- /* this dainlink has playback support */
- .ignore_pmdown_time = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA3,
- },
- /* Hostless PCM purpose */
- {
- .name = "SLIMBUS_0 Hostless",
- .stream_name = "SLIMBUS_0 Hostless",
- .cpu_dai_name = "SLIMBUS0_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- /* this dailink has playback support */
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {
- .name = "MSM AFE-PCM RX",
- .stream_name = "AFE-PROXY RX",
- .cpu_dai_name = "msm-dai-q6-dev.241",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .platform_name = "msm-pcm-afe",
- .dpcm_playback = 1,
- .ignore_suspend = 1,
- /* this dainlink has playback support */
- .ignore_pmdown_time = 1,
- },
- {
- .name = "MSM AFE-PCM TX",
- .stream_name = "AFE-PROXY TX",
- .cpu_dai_name = "msm-dai-q6-dev.240",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .platform_name = "msm-pcm-afe",
- .dpcm_capture = 1,
- .ignore_suspend = 1,
- },
- {
- .name = MSM_DAILINK_NAME(Compress1),
- .stream_name = "Compress1",
- .cpu_dai_name = "MultiMedia4",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .async_ops = ASYNC_DPCM_SND_SOC_HW_PARAMS,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dainlink has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA4,
- },
- {
- .name = "AUXPCM Hostless",
- .stream_name = "AUXPCM Hostless",
- .cpu_dai_name = "AUXPCM_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- /* this dainlink has playback support */
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {
- .name = "SLIMBUS_1 Hostless",
- .stream_name = "SLIMBUS_1 Hostless",
- .cpu_dai_name = "SLIMBUS1_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- /* this dailink has playback support */
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {
- .name = "SLIMBUS_3 Hostless",
- .stream_name = "SLIMBUS_3 Hostless",
- .cpu_dai_name = "SLIMBUS3_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- /* this dailink has playback support */
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {
- .name = "SLIMBUS_4 Hostless",
- .stream_name = "SLIMBUS_4 Hostless",
- .cpu_dai_name = "SLIMBUS4_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- /* this dailink has playback support */
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {
- .name = MSM_DAILINK_NAME(LowLatency),
- .stream_name = "MultiMedia5",
- .cpu_dai_name = "MultiMedia5",
- .platform_name = "msm-pcm-dsp.1",
- .dynamic = 1,
- .async_ops = ASYNC_DPCM_SND_SOC_PREPARE,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .ignore_suspend = 1,
- /* this dainlink has playback support */
- .ignore_pmdown_time = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA5,
- },
- {
- .name = "Listen 1 Audio Service",
- .stream_name = "Listen 1 Audio Service",
- .cpu_dai_name = "LSM1",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = { SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM1,
- },
- /* Multiple Tunnel instances */
- {
- .name = MSM_DAILINK_NAME(Compress2),
- .stream_name = "Compress2",
- .cpu_dai_name = "MultiMedia7",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dainlink has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA7,
- },
- {
- .name = MSM_DAILINK_NAME(MultiMedia10),
- .stream_name = "MultiMedia10",
- .cpu_dai_name = "MultiMedia10",
- .platform_name = "msm-pcm-dsp.1",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dainlink has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA10,
- },
- {
- .name = MSM_DAILINK_NAME(ULL_NOIRQ),
- .stream_name = "MM_NOIRQ",
- .cpu_dai_name = "MultiMedia8",
- .platform_name = "msm-pcm-dsp-noirq",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dainlink has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA8,
- },
- /* HDMI Hostless */
- {
- .name = "HDMI_RX_HOSTLESS",
- .stream_name = "HDMI_RX_HOSTLESS",
- .cpu_dai_name = "HDMI_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {
- .name = "VoiceMMode2",
- .stream_name = "VoiceMMode2",
- .cpu_dai_name = "VoiceMMode2",
- .platform_name = "msm-pcm-voice",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_VOICEMMODE2,
- },
- /* LSM FE */
- {
- .name = "Listen 2 Audio Service",
- .stream_name = "Listen 2 Audio Service",
- .cpu_dai_name = "LSM2",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = { SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM2,
- },
- {
- .name = "Listen 3 Audio Service",
- .stream_name = "Listen 3 Audio Service",
- .cpu_dai_name = "LSM3",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = { SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM3,
- },
- {
- .name = "Listen 4 Audio Service",
- .stream_name = "Listen 4 Audio Service",
- .cpu_dai_name = "LSM4",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = { SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM4,
- },
- {
- .name = "Listen 5 Audio Service",
- .stream_name = "Listen 5 Audio Service",
- .cpu_dai_name = "LSM5",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = { SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM5,
- },
- {
- .name = "Listen 6 Audio Service",
- .stream_name = "Listen 6 Audio Service",
- .cpu_dai_name = "LSM6",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = { SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM6,
- },
- {
- .name = "Listen 7 Audio Service",
- .stream_name = "Listen 7 Audio Service",
- .cpu_dai_name = "LSM7",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = { SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM7,
- },
- {
- .name = "Listen 8 Audio Service",
- .stream_name = "Listen 8 Audio Service",
- .cpu_dai_name = "LSM8",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = { SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM8,
- },
- {
- .name = MSM_DAILINK_NAME(Media9),
- .stream_name = "MultiMedia9",
- .cpu_dai_name = "MultiMedia9",
- .platform_name = "msm-pcm-dsp.0",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- /* this dainlink has playback support */
- .ignore_pmdown_time = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA9,
- },
- {
- .name = MSM_DAILINK_NAME(Compress4),
- .stream_name = "Compress4",
- .cpu_dai_name = "MultiMedia11",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dainlink has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA11,
- },
- {
- .name = MSM_DAILINK_NAME(Compress5),
- .stream_name = "Compress5",
- .cpu_dai_name = "MultiMedia12",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dainlink has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA12,
- },
- {
- .name = MSM_DAILINK_NAME(Compress6),
- .stream_name = "Compress6",
- .cpu_dai_name = "MultiMedia13",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dainlink has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA13,
- },
- {
- .name = MSM_DAILINK_NAME(Compress7),
- .stream_name = "Compress7",
- .cpu_dai_name = "MultiMedia14",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dainlink has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA14,
- },
- {
- .name = MSM_DAILINK_NAME(Compress8),
- .stream_name = "Compress8",
- .cpu_dai_name = "MultiMedia15",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dainlink has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA15,
- },
- {
- .name = MSM_DAILINK_NAME(ULL_NOIRQ_2),
- .stream_name = "MM_NOIRQ_2",
- .cpu_dai_name = "MultiMedia16",
- .platform_name = "msm-pcm-dsp-noirq",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dainlink has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA16,
- },
- {
- .name = "SLIMBUS_8 Hostless",
- .stream_name = "SLIMBUS8_HOSTLESS Capture",
- .cpu_dai_name = "SLIMBUS8_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
-};
-
-static struct snd_soc_dai_link msm_tasha_fe_dai_links[] = {
- {
- .name = LPASS_BE_SLIMBUS_4_TX,
- .stream_name = "Slimbus4 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16393",
- .platform_name = "msm-pcm-hostless",
- .codec_name = "tasha_codec",
- .codec_dai_name = "tasha_vifeedback",
- .id = MSM_BACKEND_DAI_SLIMBUS_4_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- },
- /* Ultrasound RX DAI Link */
- {
- .name = "SLIMBUS_2 Hostless Playback",
- .stream_name = "SLIMBUS_2 Hostless Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16388",
- .platform_name = "msm-pcm-hostless",
- .codec_name = "tasha_codec",
- .codec_dai_name = "tasha_rx2",
- .ignore_suspend = 1,
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ops = &msm_slimbus_2_be_ops,
- },
- /* Ultrasound TX DAI Link */
- {
- .name = "SLIMBUS_2 Hostless Capture",
- .stream_name = "SLIMBUS_2 Hostless Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16389",
- .platform_name = "msm-pcm-hostless",
- .codec_name = "tasha_codec",
- .codec_dai_name = "tasha_tx2",
- .ignore_suspend = 1,
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ops = &msm_slimbus_2_be_ops,
- },
- /* CPE LSM direct dai-link */
- {
- .name = "CPE Listen service",
- .stream_name = "CPE Listen Audio Service",
- .cpu_dai_name = "msm-dai-slim",
- .platform_name = "msm-cpe-lsm",
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "tasha_mad1",
- .codec_name = "tasha_codec",
- .ops = &msm_cpe_ops,
- },
- {
- .name = "SLIMBUS_6 Hostless Playback",
- .stream_name = "SLIMBUS_6 Hostless",
- .cpu_dai_name = "SLIMBUS6_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- /* this dailink has playback support */
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- /* CPE LSM EC PP direct dai-link */
- {
- .name = "CPE Listen service ECPP",
- .stream_name = "CPE Listen Audio Service ECPP",
- .cpu_dai_name = "CPE_LSM_NOHOST",
- .platform_name = "msm-cpe-lsm.3",
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "tasha_cpe",
- .codec_name = "tasha_codec",
- },
-};
-
-static struct snd_soc_dai_link msm_tavil_fe_dai_links[] = {
- {
- .name = LPASS_BE_SLIMBUS_4_TX,
- .stream_name = "Slimbus4 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16393",
- .platform_name = "msm-pcm-hostless",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_vifeedback",
- .id = MSM_BACKEND_DAI_SLIMBUS_4_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- },
- /* Ultrasound RX DAI Link */
- {
- .name = "SLIMBUS_2 Hostless Playback",
- .stream_name = "SLIMBUS_2 Hostless Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16388",
- .platform_name = "msm-pcm-hostless",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_rx2",
- .ignore_suspend = 1,
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ops = &msm_slimbus_2_be_ops,
- },
- /* Ultrasound TX DAI Link */
- {
- .name = "SLIMBUS_2 Hostless Capture",
- .stream_name = "SLIMBUS_2 Hostless Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16389",
- .platform_name = "msm-pcm-hostless",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_tx2",
- .ignore_suspend = 1,
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ops = &msm_slimbus_2_be_ops,
- },
-};
-
-static struct snd_soc_dai_link msm_common_misc_fe_dai_links[] = {
- {
- .name = MSM_DAILINK_NAME(ASM Loopback),
- .stream_name = "MultiMedia6",
- .cpu_dai_name = "MultiMedia6",
- .platform_name = "msm-pcm-loopback",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .ignore_suspend = 1,
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_pmdown_time = 1,
- .be_id = MSM_FRONTEND_DAI_MULTIMEDIA6,
- },
- {
- .name = "USB Audio Hostless",
- .stream_name = "USB Audio Hostless",
- .cpu_dai_name = "USBAUDIO_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {
- .name = MSM_DAILINK_NAME(Transcode Loopback Playback),
- .stream_name = "Transcode Loopback Playback",
- .cpu_dai_name = "MultiMedia14",
- .platform_name = "msm-transcode-loopback",
- .dynamic = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dainlink has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA14,
- },
- {
- .name = MSM_DAILINK_NAME(Transcode Loopback Capture),
- .stream_name = "Transcode Loopback Capture",
- .cpu_dai_name = "MultiMedia18",
- .platform_name = "msm-transcode-loopback",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA18,
- },
-};
-
-static struct snd_soc_dai_link msm_common_be_dai_links[] = {
- /* Backend AFE DAI Links */
- {
- .name = LPASS_BE_AFE_PCM_RX,
- .stream_name = "AFE Playback",
- .cpu_dai_name = "msm-dai-q6-dev.224",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_AFE_PCM_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- /* this dainlink has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_AFE_PCM_TX,
- .stream_name = "AFE Capture",
- .cpu_dai_name = "msm-dai-q6-dev.225",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_AFE_PCM_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_suspend = 1,
- },
- /* Incall Record Uplink BACK END DAI Link */
- {
- .name = LPASS_BE_INCALL_RECORD_TX,
- .stream_name = "Voice Uplink Capture",
- .cpu_dai_name = "msm-dai-q6-dev.32772",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_INCALL_RECORD_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_suspend = 1,
- },
- /* Incall Record Downlink BACK END DAI Link */
- {
- .name = LPASS_BE_INCALL_RECORD_RX,
- .stream_name = "Voice Downlink Capture",
- .cpu_dai_name = "msm-dai-q6-dev.32771",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_INCALL_RECORD_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_suspend = 1,
- },
- /* Incall Music BACK END DAI Link */
- {
- .name = LPASS_BE_VOICE_PLAYBACK_TX,
- .stream_name = "Voice Farend Playback",
- .cpu_dai_name = "msm-dai-q6-dev.32773",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_VOICE_PLAYBACK_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_suspend = 1,
- },
- /* Incall Music 2 BACK END DAI Link */
- {
- .name = LPASS_BE_VOICE2_PLAYBACK_TX,
- .stream_name = "Voice2 Farend Playback",
- .cpu_dai_name = "msm-dai-q6-dev.32770",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_VOICE2_PLAYBACK_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_USB_AUDIO_RX,
- .stream_name = "USB Audio Playback",
- .cpu_dai_name = "msm-dai-q6-dev.28672",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_USB_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_USB_AUDIO_TX,
- .stream_name = "USB Audio Capture",
- .cpu_dai_name = "msm-dai-q6-dev.28673",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_USB_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_PRI_TDM_RX_0,
- .stream_name = "Primary TDM0 Playback",
- .cpu_dai_name = "msm-dai-q6-tdm.36864",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_PRI_TDM_RX_0,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_tdm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_PRI_TDM_TX_0,
- .stream_name = "Primary TDM0 Capture",
- .cpu_dai_name = "msm-dai-q6-tdm.36865",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_PRI_TDM_TX_0,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_tdm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SEC_TDM_RX_0,
- .stream_name = "Secondary TDM0 Playback",
- .cpu_dai_name = "msm-dai-q6-tdm.36880",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SEC_TDM_RX_0,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_tdm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SEC_TDM_TX_0,
- .stream_name = "Secondary TDM0 Capture",
- .cpu_dai_name = "msm-dai-q6-tdm.36881",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SEC_TDM_TX_0,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_tdm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_TERT_TDM_RX_0,
- .stream_name = "Tertiary TDM0 Playback",
- .cpu_dai_name = "msm-dai-q6-tdm.36896",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_TERT_TDM_RX_0,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_tdm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_TERT_TDM_TX_0,
- .stream_name = "Tertiary TDM0 Capture",
- .cpu_dai_name = "msm-dai-q6-tdm.36897",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_TERT_TDM_TX_0,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_tdm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_QUAT_TDM_RX_0,
- .stream_name = "Quaternary TDM0 Playback",
- .cpu_dai_name = "msm-dai-q6-tdm.36912",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_QUAT_TDM_RX_0,
- .be_hw_params_fixup = msm_tdm_be_hw_params_fixup,
- .ops = &msm8998_tdm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_QUAT_TDM_TX_0,
- .stream_name = "Quaternary TDM0 Capture",
- .cpu_dai_name = "msm-dai-q6-tdm.36913",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_QUAT_TDM_TX_0,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_tdm_be_ops,
- .ignore_suspend = 1,
- },
-};
-
-static struct snd_soc_dai_link msm_tasha_be_dai_links[] = {
- {
- .name = LPASS_BE_SLIMBUS_0_RX,
- .stream_name = "Slimbus Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16384",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tasha_codec",
- .codec_dai_name = "tasha_mix_rx1",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_0_RX,
- .init = &msm_audrx_init,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- /* this dainlink has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- .ops = &msm_be_ops,
- },
- {
- .name = LPASS_BE_SLIMBUS_0_TX,
- .stream_name = "Slimbus Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16385",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tasha_codec",
- .codec_dai_name = "tasha_tx1",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_0_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_suspend = 1,
- .ops = &msm_be_ops,
- },
- {
- .name = LPASS_BE_SLIMBUS_1_RX,
- .stream_name = "Slimbus1 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16386",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tasha_codec",
- .codec_dai_name = "tasha_mix_rx1",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_1_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- /* dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_1_TX,
- .stream_name = "Slimbus1 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16387",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tasha_codec",
- .codec_dai_name = "tasha_tx3",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_1_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_3_RX,
- .stream_name = "Slimbus3 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16390",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tasha_codec",
- .codec_dai_name = "tasha_mix_rx1",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_3_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- /* dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_3_TX,
- .stream_name = "Slimbus3 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16391",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tasha_codec",
- .codec_dai_name = "tasha_tx1",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_3_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_4_RX,
- .stream_name = "Slimbus4 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16392",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tasha_codec",
- .codec_dai_name = "tasha_mix_rx1",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_4_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- /* dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_5_RX,
- .stream_name = "Slimbus5 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16394",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tasha_codec",
- .codec_dai_name = "tasha_rx3",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_5_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- /* dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- /* MAD BE */
- {
- .name = LPASS_BE_SLIMBUS_5_TX,
- .stream_name = "Slimbus5 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16395",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tasha_codec",
- .codec_dai_name = "tasha_mad1",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_5_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_6_RX,
- .stream_name = "Slimbus6 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16396",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tasha_codec",
- .codec_dai_name = "tasha_rx4",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_6_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- /* dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- /* Slimbus VI Recording */
- {
- .name = LPASS_BE_SLIMBUS_TX_VI,
- .stream_name = "Slimbus4 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16393",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tasha_codec",
- .codec_dai_name = "tasha_vifeedback",
- .be_id = MSM_BACKEND_DAI_SLIMBUS_4_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- .ignore_suspend = 1,
- .no_pcm = 1,
- .dpcm_capture = 1,
- .ignore_pmdown_time = 1,
- },
-};
-
-static struct snd_soc_dai_link msm_tavil_be_dai_links[] = {
- {
- .name = LPASS_BE_SLIMBUS_0_RX,
- .stream_name = "Slimbus Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16384",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_rx1",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_0_RX,
- .init = &msm_audrx_init,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- /* this dainlink has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- .ops = &msm_be_ops,
- },
- {
- .name = LPASS_BE_SLIMBUS_0_TX,
- .stream_name = "Slimbus Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16385",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_tx1",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_0_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_suspend = 1,
- .ops = &msm_be_ops,
- },
- {
- .name = LPASS_BE_SLIMBUS_1_RX,
- .stream_name = "Slimbus1 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16386",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_rx1",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_1_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- /* dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_1_TX,
- .stream_name = "Slimbus1 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16387",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_tx3",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_1_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_2_RX,
- .stream_name = "Slimbus2 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16388",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_rx2",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_2_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_3_RX,
- .stream_name = "Slimbus3 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16390",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_rx1",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_3_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- /* dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_3_TX,
- .stream_name = "Slimbus3 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16391",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_tx1",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_3_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_4_RX,
- .stream_name = "Slimbus4 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16392",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_rx1",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_4_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- /* dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_5_RX,
- .stream_name = "Slimbus5 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16394",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_rx3",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_5_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- /* dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- /* MAD BE */
- {
- .name = LPASS_BE_SLIMBUS_5_TX,
- .stream_name = "Slimbus5 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16395",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_mad1",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_5_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_6_RX,
- .stream_name = "Slimbus6 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16396",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_rx4",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_6_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- /* dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- /* Slimbus VI Recording */
- {
- .name = LPASS_BE_SLIMBUS_TX_VI,
- .stream_name = "Slimbus4 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16393",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_vifeedback",
- .be_id = MSM_BACKEND_DAI_SLIMBUS_4_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- .ignore_suspend = 1,
- .no_pcm = 1,
- .dpcm_capture = 1,
- .ignore_pmdown_time = 1,
- },
-};
-
-static struct snd_soc_dai_link msm_wcn_be_dai_links[] = {
- {
- .name = LPASS_BE_SLIMBUS_7_RX,
- .stream_name = "Slimbus7 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16398",
- .platform_name = "msm-pcm-routing",
- .codec_name = "btfmslim_slave",
- /* BT codec driver determines capabilities based on
- * dai name, bt codecdai name should always contains
- * supported usecase information
- */
- .codec_dai_name = "btfm_bt_sco_a2dp_slim_rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_7_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_wcn_ops,
- /* dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_7_TX,
- .stream_name = "Slimbus7 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16399",
- .platform_name = "msm-pcm-routing",
- .codec_name = "btfmslim_slave",
- .codec_dai_name = "btfm_bt_sco_slim_tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_7_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_wcn_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_8_TX,
- .stream_name = "Slimbus8 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16401",
- .platform_name = "msm-pcm-routing",
- .codec_name = "btfmslim_slave",
- .codec_dai_name = "btfm_fm_slim_tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_8_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .init = &msm_wcn_init,
- .ops = &msm_wcn_ops,
- .ignore_suspend = 1,
- },
-};
-
-static struct snd_soc_dai_link ext_disp_be_dai_link[] = {
- /* HDMI BACK END DAI Link */
- {
- .name = LPASS_BE_HDMI,
- .stream_name = "HDMI Playback",
- .cpu_dai_name = "msm-dai-q6-hdmi.8",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-ext-disp-audio-codec-rx",
- .codec_dai_name = "msm_hdmi_audio_codec_rx_dai",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_HDMI_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- /* DISP PORT BACK END DAI Link */
- {
- .name = LPASS_BE_DISPLAY_PORT,
- .stream_name = "Display Port Playback",
- .cpu_dai_name = "msm-dai-q6-dp.24608",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-ext-disp-audio-codec-rx",
- .codec_dai_name = "msm_dp_audio_codec_rx_dai",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_DISPLAY_PORT_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
-};
-
-static struct snd_soc_dai_link msm_mi2s_be_dai_links[] = {
- {
- .name = LPASS_BE_PRI_MI2S_RX,
- .stream_name = "Primary MI2S Playback",
- .cpu_dai_name = "msm-dai-q6-mi2s.0",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_PRI_MI2S_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- {
- .name = LPASS_BE_PRI_MI2S_TX,
- .stream_name = "Primary MI2S Capture",
- .cpu_dai_name = "msm-dai-q6-mi2s.0",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_PRI_MI2S_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SEC_MI2S_RX,
- .stream_name = "Secondary MI2S Playback",
- .cpu_dai_name = "msm-dai-q6-mi2s.1",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SECONDARY_MI2S_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- {
- .name = LPASS_BE_SEC_MI2S_TX,
- .stream_name = "Secondary MI2S Capture",
- .cpu_dai_name = "msm-dai-q6-mi2s.1",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SECONDARY_MI2S_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_TERT_MI2S_RX,
- .stream_name = "Tertiary MI2S Playback",
- .cpu_dai_name = "msm-dai-q6-mi2s.2",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_TERTIARY_MI2S_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- {
- .name = LPASS_BE_TERT_MI2S_TX,
- .stream_name = "Tertiary MI2S Capture",
- .cpu_dai_name = "msm-dai-q6-mi2s.2",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_TERTIARY_MI2S_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_QUAT_MI2S_RX,
- .stream_name = "Quaternary MI2S Playback",
- .cpu_dai_name = "msm-dai-q6-mi2s.3",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_QUATERNARY_MI2S_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- {
- .name = LPASS_BE_QUAT_MI2S_TX,
- .stream_name = "Quaternary MI2S Capture",
- .cpu_dai_name = "msm-dai-q6-mi2s.3",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_QUATERNARY_MI2S_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- },
-};
-
-static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = {
- /* Primary AUX PCM Backend DAI Links */
- {
- .name = LPASS_BE_AUXPCM_RX,
- .stream_name = "AUX PCM Playback",
- .cpu_dai_name = "msm-dai-q6-auxpcm.1",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_AUXPCM_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- .ops = &msm_aux_pcm_be_ops,
- },
- {
- .name = LPASS_BE_AUXPCM_TX,
- .stream_name = "AUX PCM Capture",
- .cpu_dai_name = "msm-dai-q6-auxpcm.1",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_AUXPCM_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- .ops = &msm_aux_pcm_be_ops,
- },
- /* Secondary AUX PCM Backend DAI Links */
- {
- .name = LPASS_BE_SEC_AUXPCM_RX,
- .stream_name = "Sec AUX PCM Playback",
- .cpu_dai_name = "msm-dai-q6-auxpcm.2",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SEC_AUXPCM_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- .ops = &msm_aux_pcm_be_ops,
- },
- {
- .name = LPASS_BE_SEC_AUXPCM_TX,
- .stream_name = "Sec AUX PCM Capture",
- .cpu_dai_name = "msm-dai-q6-auxpcm.2",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SEC_AUXPCM_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .ops = &msm_aux_pcm_be_ops,
- },
- /* Tertiary AUX PCM Backend DAI Links */
- {
- .name = LPASS_BE_TERT_AUXPCM_RX,
- .stream_name = "Tert AUX PCM Playback",
- .cpu_dai_name = "msm-dai-q6-auxpcm.3",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_TERT_AUXPCM_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- .ops = &msm_aux_pcm_be_ops,
- },
- {
- .name = LPASS_BE_TERT_AUXPCM_TX,
- .stream_name = "Tert AUX PCM Capture",
- .cpu_dai_name = "msm-dai-q6-auxpcm.3",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_TERT_AUXPCM_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .ops = &msm_aux_pcm_be_ops,
- },
- /* Quaternary AUX PCM Backend DAI Links */
- {
- .name = LPASS_BE_QUAT_AUXPCM_RX,
- .stream_name = "Quat AUX PCM Playback",
- .cpu_dai_name = "msm-dai-q6-auxpcm.4",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_QUAT_AUXPCM_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- .ops = &msm_aux_pcm_be_ops,
- },
- {
- .name = LPASS_BE_QUAT_AUXPCM_TX,
- .stream_name = "Quat AUX PCM Capture",
- .cpu_dai_name = "msm-dai-q6-auxpcm.4",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_QUAT_AUXPCM_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .ops = &msm_aux_pcm_be_ops,
- },
-};
-
-static struct snd_soc_dai_link msm_tasha_dai_links[
- ARRAY_SIZE(msm_common_dai_links) +
- ARRAY_SIZE(msm_tasha_fe_dai_links) +
- ARRAY_SIZE(msm_common_misc_fe_dai_links) +
- ARRAY_SIZE(msm_common_be_dai_links) +
- ARRAY_SIZE(msm_tasha_be_dai_links) +
- ARRAY_SIZE(msm_wcn_be_dai_links) +
- ARRAY_SIZE(ext_disp_be_dai_link) +
- ARRAY_SIZE(msm_mi2s_be_dai_links) +
- ARRAY_SIZE(msm_auxpcm_be_dai_links)];
-
-static struct snd_soc_dai_link msm_tavil_dai_links[
- ARRAY_SIZE(msm_common_dai_links) +
- ARRAY_SIZE(msm_tavil_fe_dai_links) +
- ARRAY_SIZE(msm_common_misc_fe_dai_links) +
- ARRAY_SIZE(msm_common_be_dai_links) +
- ARRAY_SIZE(msm_tavil_be_dai_links) +
- ARRAY_SIZE(msm_wcn_be_dai_links) +
- ARRAY_SIZE(ext_disp_be_dai_link) +
- ARRAY_SIZE(msm_mi2s_be_dai_links) +
- ARRAY_SIZE(msm_auxpcm_be_dai_links)];
-
-static int msm_snd_card_late_probe(struct snd_soc_card *card)
-{
- const char *be_dl_name = LPASS_BE_SLIMBUS_0_RX;
- struct snd_soc_pcm_runtime *rtd;
- int ret = 0;
- void *mbhc_calibration;
-
- rtd = snd_soc_get_pcm_runtime(card, be_dl_name);
- if (!rtd) {
- dev_err(card->dev,
- "%s: snd_soc_get_pcm_runtime for %s failed!\n",
- __func__, be_dl_name);
- ret = -EINVAL;
- goto err_pcm_runtime;
- }
-
- mbhc_calibration = def_tasha_mbhc_cal();
- if (!mbhc_calibration) {
- ret = -ENOMEM;
- goto err_mbhc_cal;
- }
- wcd_mbhc_cfg.calibration = mbhc_calibration;
- ret = tasha_mbhc_hs_detect(rtd->codec, &wcd_mbhc_cfg);
- if (ret) {
- dev_err(card->dev, "%s: mbhc hs detect failed, err:%d\n",
- __func__, ret);
- goto err_hs_detect;
- }
- return 0;
-
-err_hs_detect:
- kfree(mbhc_calibration);
-err_mbhc_cal:
-err_pcm_runtime:
- return ret;
-}
-
-static int msm_snd_card_tavil_late_probe(struct snd_soc_card *card)
-{
- const char *be_dl_name = LPASS_BE_SLIMBUS_0_RX;
- struct snd_soc_pcm_runtime *rtd;
- int ret = 0;
- void *mbhc_calibration;
-
- rtd = snd_soc_get_pcm_runtime(card, be_dl_name);
- if (!rtd) {
- dev_err(card->dev,
- "%s: snd_soc_get_pcm_runtime for %s failed!\n",
- __func__, be_dl_name);
- ret = -EINVAL;
- goto err_pcm_runtime;
- }
-
- mbhc_calibration = def_tavil_mbhc_cal();
- if (!mbhc_calibration) {
- ret = -ENOMEM;
- goto err_mbhc_cal;
- }
- wcd_mbhc_cfg.calibration = mbhc_calibration;
- ret = tavil_mbhc_hs_detect(rtd->codec, &wcd_mbhc_cfg);
- if (ret) {
- dev_err(card->dev, "%s: mbhc hs detect failed, err:%d\n",
- __func__, ret);
- goto err_hs_detect;
- }
- return 0;
-
-err_hs_detect:
- kfree(mbhc_calibration);
-err_mbhc_cal:
-err_pcm_runtime:
- return ret;
-}
-
-struct snd_soc_card snd_soc_card_tasha_msm = {
- .name = "msm8998-tasha-snd-card",
- .late_probe = msm_snd_card_late_probe,
-};
-
-struct snd_soc_card snd_soc_card_tavil_msm = {
- .name = "msm8998-tavil-snd-card",
- .late_probe = msm_snd_card_tavil_late_probe,
-};
-
-static int msm_populate_dai_link_component_of_node(
- struct snd_soc_card *card)
-{
- int i, index, ret = 0;
- struct device *cdev = card->dev;
- struct snd_soc_dai_link *dai_link = card->dai_link;
- struct device_node *np;
-
- if (!cdev) {
- pr_err("%s: Sound card device memory NULL\n", __func__);
- return -ENODEV;
- }
-
- for (i = 0; i < card->num_links; i++) {
- if (dai_link[i].platform_of_node && dai_link[i].cpu_of_node)
- continue;
-
- /* populate platform_of_node for snd card dai links */
- if (dai_link[i].platform_name &&
- !dai_link[i].platform_of_node) {
- index = of_property_match_string(cdev->of_node,
- "asoc-platform-names",
- dai_link[i].platform_name);
- if (index < 0) {
- pr_err("%s: No match found for platform name: %s\n",
- __func__, dai_link[i].platform_name);
- ret = index;
- goto err;
- }
- np = of_parse_phandle(cdev->of_node, "asoc-platform",
- index);
- if (!np) {
- pr_err("%s: retrieving phandle for platform %s, index %d failed\n",
- __func__, dai_link[i].platform_name,
- index);
- ret = -ENODEV;
- goto err;
- }
- dai_link[i].platform_of_node = np;
- dai_link[i].platform_name = NULL;
- }
-
- /* populate cpu_of_node for snd card dai links */
- if (dai_link[i].cpu_dai_name && !dai_link[i].cpu_of_node) {
- index = of_property_match_string(cdev->of_node,
- "asoc-cpu-names",
- dai_link[i].cpu_dai_name);
- if (index >= 0) {
- np = of_parse_phandle(cdev->of_node, "asoc-cpu",
- index);
- if (!np) {
- pr_err("%s: retrieving phandle for cpu dai %s failed\n",
- __func__,
- dai_link[i].cpu_dai_name);
- ret = -ENODEV;
- goto err;
- }
- dai_link[i].cpu_of_node = np;
- dai_link[i].cpu_dai_name = NULL;
- }
- }
-
- /* populate codec_of_node for snd card dai links */
- if (dai_link[i].codec_name && !dai_link[i].codec_of_node) {
- index = of_property_match_string(cdev->of_node,
- "asoc-codec-names",
- dai_link[i].codec_name);
- if (index < 0)
- continue;
- np = of_parse_phandle(cdev->of_node, "asoc-codec",
- index);
- if (!np) {
- pr_err("%s: retrieving phandle for codec %s failed\n",
- __func__, dai_link[i].codec_name);
- ret = -ENODEV;
- goto err;
- }
- dai_link[i].codec_of_node = np;
- dai_link[i].codec_name = NULL;
- }
- }
-
-err:
- return ret;
-}
-
-static int msm_prepare_us_euro(struct snd_soc_card *card)
-{
- struct msm_asoc_mach_data *pdata =
- snd_soc_card_get_drvdata(card);
- int ret = 0;
-
- if (pdata->us_euro_gpio >= 0) {
- dev_dbg(card->dev, "%s: us_euro gpio request %d", __func__,
- pdata->us_euro_gpio);
- ret = gpio_request(pdata->us_euro_gpio, "TASHA_CODEC_US_EURO");
- if (ret) {
- dev_err(card->dev,
- "%s: Failed to request codec US/EURO gpio %d error %d\n",
- __func__, pdata->us_euro_gpio, ret);
- }
- }
-
- return ret;
-}
-
-static int msm_audrx_stub_init(struct snd_soc_pcm_runtime *rtd)
-{
- int ret = 0;
- struct snd_soc_codec *codec = rtd->codec;
- struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
-
- ret = snd_soc_add_codec_controls(codec, msm_snd_controls,
- ARRAY_SIZE(msm_snd_controls));
- if (ret < 0) {
- dev_err(codec->dev, "%s: add_codec_controls failed, err%d\n",
- __func__, ret);
- return ret;
- }
-
- snd_soc_dapm_new_controls(dapm, msm_dapm_widgets,
- ARRAY_SIZE(msm_dapm_widgets));
-
- return 0;
-}
-
-static int msm_snd_stub_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
-
- int ret = 0;
- unsigned int rx_ch[] = {144, 145, 146, 147, 148, 149, 150,
- 151, 152, 153, 154, 155, 156};
- unsigned int tx_ch[] = {128, 129, 130, 131, 132, 133,
- 134, 135, 136, 137, 138, 139,
- 140, 141, 142, 143};
-
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
- ret = snd_soc_dai_set_channel_map(cpu_dai, 0, 0,
- slim_rx_cfg[0].channels,
- rx_ch);
- if (ret < 0)
- pr_err("%s: RX failed to set cpu chan map error %d\n",
- __func__, ret);
- } else {
- ret = snd_soc_dai_set_channel_map(cpu_dai,
- slim_tx_cfg[0].channels,
- tx_ch, 0, 0);
- if (ret < 0)
- pr_err("%s: TX failed to set cpu chan map error %d\n",
- __func__, ret);
- }
-
- return ret;
-}
-
-static struct snd_soc_ops msm_stub_be_ops = {
- .hw_params = msm_snd_stub_hw_params,
-};
-
-static struct snd_soc_dai_link msm_stub_fe_dai_links[] = {
-
- /* FrontEnd DAI Links */
- {
- .name = "MSMSTUB Media1",
- .stream_name = "MultiMedia1",
- .cpu_dai_name = "MultiMedia1",
- .platform_name = "msm-pcm-dsp.0",
- .dynamic = 1,
- .async_ops = ASYNC_DPCM_SND_SOC_PREPARE,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- /* this dainlink has playback support */
- .ignore_pmdown_time = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA1
- },
-};
-
-static struct snd_soc_dai_link msm_stub_be_dai_links[] = {
-
- /* Backend DAI Links */
- {
- .name = LPASS_BE_SLIMBUS_0_RX,
- .stream_name = "Slimbus Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16384",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_0_RX,
- .init = &msm_audrx_stub_init,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_pmdown_time = 1, /* dai link has playback support */
- .ignore_suspend = 1,
- .ops = &msm_stub_be_ops,
- },
- {
- .name = LPASS_BE_SLIMBUS_0_TX,
- .stream_name = "Slimbus Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16385",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_0_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_suspend = 1,
- .ops = &msm_stub_be_ops,
- },
-};
-
-static struct snd_soc_dai_link msm_stub_dai_links[
- ARRAY_SIZE(msm_stub_fe_dai_links) +
- ARRAY_SIZE(msm_stub_be_dai_links)];
-
-struct snd_soc_card snd_soc_card_stub_msm = {
- .name = "msm8998-stub-snd-card",
-};
-
-static const struct of_device_id msm8998_asoc_machine_of_match[] = {
- { .compatible = "qcom,msm8998-asoc-snd-tasha",
- .data = "tasha_codec"},
- { .compatible = "qcom,msm8998-asoc-snd-tavil",
- .data = "tavil_codec"},
- { .compatible = "qcom,msm8998-asoc-snd-stub",
- .data = "stub_codec"},
- {},
-};
-
-static struct snd_soc_card *populate_snd_card_dailinks(struct device *dev)
-{
- struct snd_soc_card *card = NULL;
- struct snd_soc_dai_link *dailink;
- int len_1, len_2, len_3, len_4;
- int total_links;
- const struct of_device_id *match;
-
- match = of_match_node(msm8998_asoc_machine_of_match, dev->of_node);
- if (!match) {
- dev_err(dev, "%s: No DT match found for sound card\n",
- __func__);
- return NULL;
- }
-
- if (!strcmp(match->data, "tasha_codec")) {
- card = &snd_soc_card_tasha_msm;
- len_1 = ARRAY_SIZE(msm_common_dai_links);
- len_2 = len_1 + ARRAY_SIZE(msm_tasha_fe_dai_links);
- len_3 = len_2 + ARRAY_SIZE(msm_common_misc_fe_dai_links);
- len_4 = len_3 + ARRAY_SIZE(msm_common_be_dai_links);
- total_links = len_4 + ARRAY_SIZE(msm_tasha_be_dai_links);
- memcpy(msm_tasha_dai_links,
- msm_common_dai_links,
- sizeof(msm_common_dai_links));
- memcpy(msm_tasha_dai_links + len_1,
- msm_tasha_fe_dai_links,
- sizeof(msm_tasha_fe_dai_links));
- memcpy(msm_tasha_dai_links + len_2,
- msm_common_misc_fe_dai_links,
- sizeof(msm_common_misc_fe_dai_links));
- memcpy(msm_tasha_dai_links + len_3,
- msm_common_be_dai_links,
- sizeof(msm_common_be_dai_links));
- memcpy(msm_tasha_dai_links + len_4,
- msm_tasha_be_dai_links,
- sizeof(msm_tasha_be_dai_links));
-
- if (of_property_read_bool(dev->of_node, "qcom,wcn-btfm")) {
- dev_dbg(dev, "%s(): WCN BTFM support present\n",
- __func__);
- memcpy(msm_tasha_dai_links + total_links,
- msm_wcn_be_dai_links,
- sizeof(msm_wcn_be_dai_links));
- total_links += ARRAY_SIZE(msm_wcn_be_dai_links);
- }
-
- if (of_property_read_bool(dev->of_node,
- "qcom,ext-disp-audio-rx")) {
- dev_dbg(dev, "%s(): External display audio support present\n",
- __func__);
- memcpy(msm_tasha_dai_links + total_links,
- ext_disp_be_dai_link,
- sizeof(ext_disp_be_dai_link));
- total_links += ARRAY_SIZE(ext_disp_be_dai_link);
- }
- if (of_property_read_bool(dev->of_node,
- "qcom,mi2s-audio-intf")) {
- memcpy(msm_tasha_dai_links + total_links,
- msm_mi2s_be_dai_links,
- sizeof(msm_mi2s_be_dai_links));
- total_links += ARRAY_SIZE(msm_mi2s_be_dai_links);
- }
- if (of_property_read_bool(dev->of_node,
- "qcom,auxpcm-audio-intf")) {
- memcpy(msm_tasha_dai_links + total_links,
- msm_auxpcm_be_dai_links,
- sizeof(msm_auxpcm_be_dai_links));
- total_links += ARRAY_SIZE(msm_auxpcm_be_dai_links);
- }
- dailink = msm_tasha_dai_links;
- } else if (!strcmp(match->data, "tavil_codec")) {
- card = &snd_soc_card_tavil_msm;
- len_1 = ARRAY_SIZE(msm_common_dai_links);
- len_2 = len_1 + ARRAY_SIZE(msm_tavil_fe_dai_links);
- len_3 = len_2 + ARRAY_SIZE(msm_common_misc_fe_dai_links);
- len_4 = len_3 + ARRAY_SIZE(msm_common_be_dai_links);
- total_links = len_4 + ARRAY_SIZE(msm_tavil_be_dai_links);
- memcpy(msm_tavil_dai_links,
- msm_common_dai_links,
- sizeof(msm_common_dai_links));
- memcpy(msm_tavil_dai_links + len_1,
- msm_tavil_fe_dai_links,
- sizeof(msm_tavil_fe_dai_links));
- memcpy(msm_tavil_dai_links + len_2,
- msm_common_misc_fe_dai_links,
- sizeof(msm_common_misc_fe_dai_links));
- memcpy(msm_tavil_dai_links + len_3,
- msm_common_be_dai_links,
- sizeof(msm_common_be_dai_links));
- memcpy(msm_tavil_dai_links + len_4,
- msm_tavil_be_dai_links,
- sizeof(msm_tavil_be_dai_links));
-
- if (of_property_read_bool(dev->of_node, "qcom,wcn-btfm")) {
- dev_dbg(dev, "%s(): WCN BTFM support present\n",
- __func__);
- memcpy(msm_tavil_dai_links + total_links,
- msm_wcn_be_dai_links,
- sizeof(msm_wcn_be_dai_links));
- total_links += ARRAY_SIZE(msm_wcn_be_dai_links);
- }
-
- if (of_property_read_bool(dev->of_node,
- "qcom,ext-disp-audio-rx")) {
- dev_dbg(dev, "%s(): ext disp audio support present\n",
- __func__);
- memcpy(msm_tavil_dai_links + total_links,
- ext_disp_be_dai_link,
- sizeof(ext_disp_be_dai_link));
- total_links += ARRAY_SIZE(ext_disp_be_dai_link);
- }
- if (of_property_read_bool(dev->of_node,
- "qcom,mi2s-audio-intf")) {
- memcpy(msm_tavil_dai_links + total_links,
- msm_mi2s_be_dai_links,
- sizeof(msm_mi2s_be_dai_links));
- total_links += ARRAY_SIZE(msm_mi2s_be_dai_links);
- }
- if (of_property_read_bool(dev->of_node,
- "qcom,auxpcm-audio-intf")) {
- memcpy(msm_tavil_dai_links + total_links,
- msm_auxpcm_be_dai_links,
- sizeof(msm_auxpcm_be_dai_links));
- total_links += ARRAY_SIZE(msm_auxpcm_be_dai_links);
- }
- dailink = msm_tavil_dai_links;
- } else if (!strcmp(match->data, "stub_codec")) {
- card = &snd_soc_card_stub_msm;
- len_1 = ARRAY_SIZE(msm_stub_fe_dai_links);
- len_2 = len_1 + ARRAY_SIZE(msm_stub_be_dai_links);
-
- memcpy(msm_stub_dai_links,
- msm_stub_fe_dai_links,
- sizeof(msm_stub_fe_dai_links));
- memcpy(msm_stub_dai_links + len_1,
- msm_stub_be_dai_links,
- sizeof(msm_stub_be_dai_links));
-
- dailink = msm_stub_dai_links;
- total_links = len_2;
- }
-
- if (card) {
- card->dai_link = dailink;
- card->num_links = total_links;
- }
-
- return card;
-}
-
-static int msm_wsa881x_init(struct snd_soc_component *component)
-{
- u8 spkleft_ports[WSA881X_MAX_SWR_PORTS] = {100, 101, 102, 106};
- u8 spkright_ports[WSA881X_MAX_SWR_PORTS] = {103, 104, 105, 107};
- unsigned int ch_rate[WSA881X_MAX_SWR_PORTS] = {2400, 600, 300, 1200};
- unsigned int ch_mask[WSA881X_MAX_SWR_PORTS] = {0x1, 0xF, 0x3, 0x3};
- struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
- struct msm_asoc_mach_data *pdata;
- struct snd_soc_dapm_context *dapm;
- int ret = 0;
-
- if (!codec) {
- pr_err("%s codec is NULL\n", __func__);
- return -EINVAL;
- }
-
- dapm = snd_soc_codec_get_dapm(codec);
-
- if (!strcmp(component->name_prefix, "SpkrLeft")) {
- dev_dbg(codec->dev, "%s: setting left ch map to codec %s\n",
- __func__, codec->component.name);
- wsa881x_set_channel_map(codec, &spkleft_ports[0],
- WSA881X_MAX_SWR_PORTS, &ch_mask[0],
- &ch_rate[0], NULL);
- if (dapm->component) {
- snd_soc_dapm_ignore_suspend(dapm, "SpkrLeft IN");
- snd_soc_dapm_ignore_suspend(dapm, "SpkrLeft SPKR");
- }
- } else if (!strcmp(component->name_prefix, "SpkrRight")) {
- dev_dbg(codec->dev, "%s: setting right ch map to codec %s\n",
- __func__, codec->component.name);
- wsa881x_set_channel_map(codec, &spkright_ports[0],
- WSA881X_MAX_SWR_PORTS, &ch_mask[0],
- &ch_rate[0], NULL);
- if (dapm->component) {
- snd_soc_dapm_ignore_suspend(dapm, "SpkrRight IN");
- snd_soc_dapm_ignore_suspend(dapm, "SpkrRight SPKR");
- }
- } else {
- dev_err(codec->dev, "%s: wrong codec name %s\n", __func__,
- codec->component.name);
- ret = -EINVAL;
- goto err_codec;
- }
- pdata = snd_soc_card_get_drvdata(component->card);
- if (pdata && pdata->codec_root)
- wsa881x_codec_info_create_codec_entry(pdata->codec_root,
- codec);
-
-err_codec:
- return ret;
-}
-
-static int msm_init_wsa_dev(struct platform_device *pdev,
- struct snd_soc_card *card)
-{
- struct device_node *wsa_of_node;
- u32 wsa_max_devs;
- u32 wsa_dev_cnt;
- int i;
- struct msm_wsa881x_dev_info *wsa881x_dev_info;
- const char *wsa_auxdev_name_prefix[1];
- char *dev_name_str = NULL;
- int found = 0;
- int ret = 0;
-
- /* Get maximum WSA device count for this platform */
- ret = of_property_read_u32(pdev->dev.of_node,
- "qcom,wsa-max-devs", &wsa_max_devs);
- if (ret) {
- dev_dbg(&pdev->dev,
- "%s: wsa-max-devs property missing in DT %s, ret = %d\n",
- __func__, pdev->dev.of_node->full_name, ret);
- goto err_dt;
- }
- if (wsa_max_devs == 0) {
- dev_warn(&pdev->dev,
- "%s: Max WSA devices is 0 for this target?\n",
- __func__);
- goto err_dt;
- }
-
- /* Get count of WSA device phandles for this platform */
- wsa_dev_cnt = of_count_phandle_with_args(pdev->dev.of_node,
- "qcom,wsa-devs", NULL);
- if (wsa_dev_cnt == -ENOENT) {
- dev_warn(&pdev->dev, "%s: No wsa device defined in DT.\n",
- __func__);
- goto err_dt;
- } else if (wsa_dev_cnt <= 0) {
- dev_err(&pdev->dev,
- "%s: Error reading wsa device from DT. wsa_dev_cnt = %d\n",
- __func__, wsa_dev_cnt);
- ret = -EINVAL;
- goto err_dt;
- }
-
- /*
- * Expect total phandles count to be NOT less than maximum possible
- * WSA count. However, if it is less, then assign same value to
- * max count as well.
- */
- if (wsa_dev_cnt < wsa_max_devs) {
- dev_dbg(&pdev->dev,
- "%s: wsa_max_devs = %d cannot exceed wsa_dev_cnt = %d\n",
- __func__, wsa_max_devs, wsa_dev_cnt);
- wsa_max_devs = wsa_dev_cnt;
- }
-
- /* Make sure prefix string passed for each WSA device */
- ret = of_property_count_strings(pdev->dev.of_node,
- "qcom,wsa-aux-dev-prefix");
- if (ret != wsa_dev_cnt) {
- dev_err(&pdev->dev,
- "%s: expecting %d wsa prefix. Defined only %d in DT\n",
- __func__, wsa_dev_cnt, ret);
- ret = -EINVAL;
- goto err_dt;
- }
-
- /*
- * Alloc mem to store phandle and index info of WSA device, if already
- * registered with ALSA core
- */
- wsa881x_dev_info = devm_kcalloc(&pdev->dev, wsa_max_devs,
- sizeof(struct msm_wsa881x_dev_info),
- GFP_KERNEL);
- if (!wsa881x_dev_info) {
- ret = -ENOMEM;
- goto err_mem;
- }
-
- /*
- * search and check whether all WSA devices are already
- * registered with ALSA core or not. If found a node, store
- * the node and the index in a local array of struct for later
- * use.
- */
- for (i = 0; i < wsa_dev_cnt; i++) {
- wsa_of_node = of_parse_phandle(pdev->dev.of_node,
- "qcom,wsa-devs", i);
- if (unlikely(!wsa_of_node)) {
- /* we should not be here */
- dev_err(&pdev->dev,
- "%s: wsa dev node is not present\n",
- __func__);
- ret = -EINVAL;
- goto err_dev_node;
- }
- if (soc_find_component(wsa_of_node, NULL)) {
- /* WSA device registered with ALSA core */
- wsa881x_dev_info[found].of_node = wsa_of_node;
- wsa881x_dev_info[found].index = i;
- found++;
- if (found == wsa_max_devs)
- break;
- }
- }
-
- if (found < wsa_max_devs) {
- dev_dbg(&pdev->dev,
- "%s: failed to find %d components. Found only %d\n",
- __func__, wsa_max_devs, found);
- return -EPROBE_DEFER;
- }
- dev_info(&pdev->dev,
- "%s: found %d wsa881x devices registered with ALSA core\n",
- __func__, found);
-
- card->num_aux_devs = wsa_max_devs;
- card->num_configs = wsa_max_devs;
-
- /* Alloc array of AUX devs struct */
- msm_aux_dev = devm_kcalloc(&pdev->dev, card->num_aux_devs,
- sizeof(struct snd_soc_aux_dev),
- GFP_KERNEL);
- if (!msm_aux_dev) {
- ret = -ENOMEM;
- goto err_auxdev_mem;
- }
-
- /* Alloc array of codec conf struct */
- msm_codec_conf = devm_kcalloc(&pdev->dev, card->num_aux_devs,
- sizeof(struct snd_soc_codec_conf),
- GFP_KERNEL);
- if (!msm_codec_conf) {
- ret = -ENOMEM;
- goto err_codec_conf;
- }
-
- for (i = 0; i < card->num_aux_devs; i++) {
- dev_name_str = devm_kzalloc(&pdev->dev, DEV_NAME_STR_LEN,
- GFP_KERNEL);
- if (!dev_name_str) {
- ret = -ENOMEM;
- goto err_dev_str;
- }
-
- ret = of_property_read_string_index(pdev->dev.of_node,
- "qcom,wsa-aux-dev-prefix",
- wsa881x_dev_info[i].index,
- wsa_auxdev_name_prefix);
- if (ret) {
- dev_err(&pdev->dev,
- "%s: failed to read wsa aux dev prefix, ret = %d\n",
- __func__, ret);
- ret = -EINVAL;
- goto err_dt_prop;
- }
-
- snprintf(dev_name_str, strlen("wsa881x.%d"), "wsa881x.%d", i);
- msm_aux_dev[i].name = dev_name_str;
- msm_aux_dev[i].codec_name = NULL;
- msm_aux_dev[i].codec_of_node =
- wsa881x_dev_info[i].of_node;
- msm_aux_dev[i].init = msm_wsa881x_init;
- msm_codec_conf[i].dev_name = NULL;
- msm_codec_conf[i].name_prefix = wsa_auxdev_name_prefix[0];
- msm_codec_conf[i].of_node =
- wsa881x_dev_info[i].of_node;
- }
- card->codec_conf = msm_codec_conf;
- card->aux_dev = msm_aux_dev;
-
- return 0;
-
-err_dt_prop:
- devm_kfree(&pdev->dev, dev_name_str);
-err_dev_str:
- devm_kfree(&pdev->dev, msm_codec_conf);
-err_codec_conf:
- devm_kfree(&pdev->dev, msm_aux_dev);
-err_auxdev_mem:
-err_dev_node:
- devm_kfree(&pdev->dev, wsa881x_dev_info);
-err_mem:
-err_dt:
- return ret;
-}
-
-static void i2s_auxpcm_init(struct platform_device *pdev)
-{
- struct resource *muxsel;
- int count;
- u32 mi2s_master_slave[MI2S_MAX];
- int ret;
- char *str[PCM_I2S_SEL_MAX] = {
- "lpaif_pri_mode_muxsel",
- "lpaif_sec_mode_muxsel",
- "lpaif_tert_mode_muxsel",
- "lpaif_quat_mode_muxsel"
- };
-
- for (count = 0; count < MI2S_MAX; count++) {
- mutex_init(&mi2s_intf_conf[count].lock);
- mi2s_intf_conf[count].ref_cnt = 0;
- }
-
- for (count = 0; count < AUX_PCM_MAX; count++) {
- mutex_init(&auxpcm_intf_conf[count].lock);
- auxpcm_intf_conf[count].ref_cnt = 0;
- }
-
- for (count = 0; count < PCM_I2S_SEL_MAX; count++) {
- mutex_init(&mi2s_auxpcm_conf[count].lock);
- mi2s_auxpcm_conf[count].pcm_i2s_sel_vt_addr = NULL;
- }
-
- for (count = 0; count < PCM_I2S_SEL_MAX; count++) {
- muxsel = platform_get_resource_byname(pdev, IORESOURCE_MEM,
- str[count]);
- if (muxsel) {
- mi2s_auxpcm_conf[count].pcm_i2s_sel_vt_addr
- = ioremap(muxsel->start, resource_size(muxsel));
- }
- }
-
- ret = of_property_read_u32_array(pdev->dev.of_node,
- "qcom,msm-mi2s-master",
- mi2s_master_slave, MI2S_MAX);
- if (ret) {
- dev_dbg(&pdev->dev, "%s: no qcom,msm-mi2s-master in DT node\n",
- __func__);
- } else {
- for (count = 0; count < MI2S_MAX; count++) {
- mi2s_intf_conf[count].msm_is_mi2s_master =
- mi2s_master_slave[count];
- }
- }
-}
-
-static void i2s_auxpcm_deinit(void)
-{
- int count;
-
- for (count = 0; count < PCM_I2S_SEL_MAX; count++)
- if (mi2s_auxpcm_conf[count].pcm_i2s_sel_vt_addr !=
- NULL)
- iounmap(
- mi2s_auxpcm_conf[count].pcm_i2s_sel_vt_addr);
-}
-
-static int msm_asoc_machine_probe(struct platform_device *pdev)
-{
- struct snd_soc_card *card;
- struct msm_asoc_mach_data *pdata;
- const char *mbhc_audio_jack_type = NULL;
- char *mclk_freq_prop_name;
- const struct of_device_id *match;
- int ret;
-
- if (!pdev->dev.of_node) {
- dev_err(&pdev->dev, "No platform supplied from device tree\n");
- return -EINVAL;
- }
-
- pdata = devm_kzalloc(&pdev->dev,
- sizeof(struct msm_asoc_mach_data), GFP_KERNEL);
- if (!pdata)
- return -ENOMEM;
-
- card = populate_snd_card_dailinks(&pdev->dev);
- if (!card) {
- dev_err(&pdev->dev, "%s: Card uninitialized\n", __func__);
- ret = -EINVAL;
- goto err;
- }
- card->dev = &pdev->dev;
- platform_set_drvdata(pdev, card);
- snd_soc_card_set_drvdata(card, pdata);
-
- ret = snd_soc_of_parse_card_name(card, "qcom,model");
- if (ret) {
- dev_err(&pdev->dev, "parse card name failed, err:%d\n",
- ret);
- goto err;
- }
-
- ret = snd_soc_of_parse_audio_routing(card, "qcom,audio-routing");
- if (ret) {
- dev_err(&pdev->dev, "parse audio routing failed, err:%d\n",
- ret);
- goto err;
- }
-
- match = of_match_node(msm8998_asoc_machine_of_match,
- pdev->dev.of_node);
- if (!match) {
- dev_err(&pdev->dev, "%s: no matched codec is found.\n",
- __func__);
- goto err;
- }
-
- if (!strcmp(match->data, "tasha_codec"))
- mclk_freq_prop_name = "qcom,tasha-mclk-clk-freq";
- else
- mclk_freq_prop_name = "qcom,tavil-mclk-clk-freq";
-
- ret = of_property_read_u32(pdev->dev.of_node,
- mclk_freq_prop_name, &pdata->mclk_freq);
- if (ret) {
- dev_err(&pdev->dev,
- "Looking up %s property in node %s failed, err%d\n",
- mclk_freq_prop_name,
- pdev->dev.of_node->full_name, ret);
- goto err;
- }
-
- if (pdata->mclk_freq != CODEC_EXT_CLK_RATE) {
- dev_err(&pdev->dev, "unsupported mclk freq %u\n",
- pdata->mclk_freq);
- ret = -EINVAL;
- goto err;
- }
-
- ret = msm_populate_dai_link_component_of_node(card);
- if (ret) {
- ret = -EPROBE_DEFER;
- goto err;
- }
- ret = msm_init_wsa_dev(pdev, card);
- if (ret)
- goto err;
-
- ret = devm_snd_soc_register_card(&pdev->dev, card);
- if (ret == -EPROBE_DEFER) {
- if (codec_reg_done)
- ret = -EINVAL;
- goto err;
- } else if (ret) {
- dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
- ret);
- goto err;
- }
- dev_info(&pdev->dev, "Sound card %s registered\n", card->name);
- spdev = pdev;
-
- ret = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
- if (ret) {
- dev_dbg(&pdev->dev, "%s: failed to add child nodes, ret=%d\n",
- __func__, ret);
- } else {
- pdata->hph_en1_gpio_p = of_parse_phandle(pdev->dev.of_node,
- "qcom,hph-en1-gpio", 0);
- if (!pdata->hph_en1_gpio_p) {
- dev_dbg(&pdev->dev, "property %s not detected in node %s",
- "qcom,hph-en1-gpio",
- pdev->dev.of_node->full_name);
- }
-
- pdata->hph_en0_gpio_p = of_parse_phandle(pdev->dev.of_node,
- "qcom,hph-en0-gpio", 0);
- if (!pdata->hph_en0_gpio_p) {
- dev_dbg(&pdev->dev, "property %s not detected in node %s",
- "qcom,hph-en0-gpio",
- pdev->dev.of_node->full_name);
- }
- }
-
- ret = of_property_read_string(pdev->dev.of_node,
- "qcom,mbhc-audio-jack-type", &mbhc_audio_jack_type);
- if (ret) {
- dev_dbg(&pdev->dev, "Looking up %s property in node %s failed",
- "qcom,mbhc-audio-jack-type",
- pdev->dev.of_node->full_name);
- dev_dbg(&pdev->dev, "Jack type properties set to default");
- } else {
- if (!strcmp(mbhc_audio_jack_type, "4-pole-jack")) {
- wcd_mbhc_cfg.enable_anc_mic_detect = false;
- dev_dbg(&pdev->dev, "This hardware has 4 pole jack");
- } else if (!strcmp(mbhc_audio_jack_type, "5-pole-jack")) {
- wcd_mbhc_cfg.enable_anc_mic_detect = true;
- dev_dbg(&pdev->dev, "This hardware has 5 pole jack");
- } else if (!strcmp(mbhc_audio_jack_type, "6-pole-jack")) {
- wcd_mbhc_cfg.enable_anc_mic_detect = true;
- dev_dbg(&pdev->dev, "This hardware has 6 pole jack");
- } else {
- wcd_mbhc_cfg.enable_anc_mic_detect = false;
- dev_dbg(&pdev->dev, "Unknown value, set to default");
- }
- }
- /*
- * Parse US-Euro gpio info from DT. Report no error if us-euro
- * entry is not found in DT file as some targets do not support
- * US-Euro detection
- */
- pdata->us_euro_gpio = of_get_named_gpio(pdev->dev.of_node,
- "qcom,us-euro-gpios", 0);
- if (!gpio_is_valid(pdata->us_euro_gpio))
- pdata->us_euro_gpio_p = of_parse_phandle(pdev->dev.of_node,
- "qcom,us-euro-gpios", 0);
- if (!gpio_is_valid(pdata->us_euro_gpio) && (!pdata->us_euro_gpio_p)) {
- dev_dbg(&pdev->dev, "property %s not detected in node %s",
- "qcom,us-euro-gpios", pdev->dev.of_node->full_name);
- } else {
- dev_dbg(&pdev->dev, "%s detected",
- "qcom,us-euro-gpios");
- wcd_mbhc_cfg.swap_gnd_mic = msm_swap_gnd_mic;
- }
-
- ret = msm_prepare_us_euro(card);
- if (ret)
- dev_dbg(&pdev->dev, "msm_prepare_us_euro failed (%d)\n",
- ret);
-
- /* Parse pinctrl info from devicetree */
- ret = msm_get_pinctrl(pdev);
- if (!ret) {
- pr_debug("%s: pinctrl parsing successful\n", __func__);
- } else {
- dev_dbg(&pdev->dev,
- "%s: Parsing pinctrl failed with %d. Cannot use Ports\n",
- __func__, ret);
- ret = 0;
- }
-
- i2s_auxpcm_init(pdev);
-
- is_initial_boot = true;
- ret = audio_notifier_register("msm8998", AUDIO_NOTIFIER_ADSP_DOMAIN,
- &service_nb);
- if (ret < 0)
- pr_err("%s: Audio notifier register failed ret = %d\n",
- __func__, ret);
-
- return 0;
-err:
- if (pdata->us_euro_gpio > 0) {
- dev_dbg(&pdev->dev, "%s free us_euro gpio %d\n",
- __func__, pdata->us_euro_gpio);
- gpio_free(pdata->us_euro_gpio);
- pdata->us_euro_gpio = 0;
- }
- msm_release_pinctrl(pdev);
- devm_kfree(&pdev->dev, pdata);
- return ret;
-}
-
-static int msm_asoc_machine_remove(struct platform_device *pdev)
-{
- struct snd_soc_card *card = platform_get_drvdata(pdev);
- struct msm_asoc_mach_data *pdata =
- snd_soc_card_get_drvdata(card);
-
- if (gpio_is_valid(pdata->us_euro_gpio))
- gpio_free(pdata->us_euro_gpio);
- i2s_auxpcm_deinit();
-
- snd_soc_unregister_card(card);
- audio_notifier_deregister("msm8998");
- return 0;
-}
-
-static struct platform_driver msm8998_asoc_machine_driver = {
- .driver = {
- .name = DRV_NAME,
- .owner = THIS_MODULE,
- .pm = &snd_soc_pm_ops,
- .of_match_table = msm8998_asoc_machine_of_match,
- },
- .probe = msm_asoc_machine_probe,
- .remove = msm_asoc_machine_remove,
-};
-module_platform_driver(msm8998_asoc_machine_driver);
-
-MODULE_DESCRIPTION("ALSA SoC msm");
-MODULE_LICENSE("GPL v2");
-MODULE_ALIAS("platform:" DRV_NAME);
-MODULE_DEVICE_TABLE(of, msm8998_asoc_machine_of_match);
diff --git a/asoc/sdm660-common.c b/asoc/sdm660-common.c
deleted file mode 100644
index a33bbff..0000000
--- a/asoc/sdm660-common.c
+++ /dev/null
@@ -1,3551 +0,0 @@
-/* Copyright (c) 2015-2018, 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.
- */
-
-#include <linux/input.h>
-#include <linux/of_gpio.h>
-#include <linux/module.h>
-#include <linux/platform_device.h>
-#include <linux/of_device.h>
-#include <sound/pcm_params.h>
-#include <dsp/q6afe-v2.h>
-#include <dsp/audio_notifier.h>
-#include "msm-pcm-routing-v2.h"
-#include "sdm660-common.h"
-#include "sdm660-internal.h"
-#include "sdm660-external.h"
-#include "codecs/msm-cdc-pinctrl.h"
-#include "codecs/sdm660_cdc/msm-analog-cdc.h"
-#include "codecs/wsa881x.h"
-
-#define __CHIPSET__ "SDM660 "
-#define MSM_DAILINK_NAME(name) (__CHIPSET__#name)
-
-#define DRV_NAME "sdm660-asoc-snd"
-
-#define MSM_INT_DIGITAL_CODEC "msm-dig-codec"
-#define PMIC_INT_ANALOG_CODEC "analog-codec"
-
-#define DEV_NAME_STR_LEN 32
-#define DEFAULT_MCLK_RATE 9600000
-#define MSM_LL_QOS_VALUE 300 /* time in us to ensure LPM doesn't go in C3/C4 */
-
-struct dev_config {
- u32 sample_rate;
- u32 bit_format;
- u32 channels;
-};
-
-enum {
- DP_RX_IDX,
- EXT_DISP_RX_IDX_MAX,
-};
-
-bool codec_reg_done;
-
-/* TDM default config */
-static struct dev_config tdm_rx_cfg[TDM_INTERFACE_MAX][TDM_PORT_MAX] = {
- { /* PRI TDM */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_0 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_1 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_2 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_3 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_4 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_5 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_6 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_7 */
- },
- { /* SEC TDM */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_0 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_1 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_2 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_3 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_4 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_5 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_6 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_7 */
- },
- { /* TERT TDM */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_0 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_1 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_2 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_3 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_4 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_5 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_6 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_7 */
- },
- { /* QUAT TDM */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_0 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_1 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_2 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_3 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_4 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_5 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_6 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_7 */
- },
- { /* QUIN TDM */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_0 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_1 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_2 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_3 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_4 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_5 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_6 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_7 */
- }
-};
-
-/* TDM default config */
-static struct dev_config tdm_tx_cfg[TDM_INTERFACE_MAX][TDM_PORT_MAX] = {
- { /* PRI TDM */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_0 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_1 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_2 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_3 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_4 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_5 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_6 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_7 */
- },
- { /* SEC TDM */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_0 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_1 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_2 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_3 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_4 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_5 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_6 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_7 */
- },
- { /* TERT TDM */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_0 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_1 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_2 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_3 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_4 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_5 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_6 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_7 */
- },
- { /* QUAT TDM */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_0 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_1 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_2 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_3 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_4 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_5 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_6 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_7 */
- },
- { /* QUIN TDM */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_0 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_1 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_2 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_3 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_4 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_5 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_6 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_7 */
- }
-};
-
-/* Default configuration of external display BE */
-static struct dev_config ext_disp_rx_cfg[] = {
- [DP_RX_IDX] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 2},
-};
-static struct dev_config usb_rx_cfg = {
- .sample_rate = SAMPLING_RATE_48KHZ,
- .bit_format = SNDRV_PCM_FORMAT_S16_LE,
- .channels = 2,
-};
-
-static struct dev_config usb_tx_cfg = {
- .sample_rate = SAMPLING_RATE_48KHZ,
- .bit_format = SNDRV_PCM_FORMAT_S16_LE,
- .channels = 1,
-};
-
-enum {
- PRIM_AUX_PCM = 0,
- SEC_AUX_PCM,
- TERT_AUX_PCM,
- QUAT_AUX_PCM,
- QUIN_AUX_PCM,
- AUX_PCM_MAX,
-};
-
-enum {
- PCM_I2S_SEL_PRIM = 0,
- PCM_I2S_SEL_SEC,
- PCM_I2S_SEL_TERT,
- PCM_I2S_SEL_QUAT,
- PCM_I2S_SEL_QUIN,
- PCM_I2S_SEL_MAX,
-};
-
-struct mi2s_conf {
- struct mutex lock;
- u32 ref_cnt;
- u32 msm_is_mi2s_master;
- u32 msm_is_ext_mclk;
-};
-
-static u32 mi2s_ebit_clk[MI2S_MAX] = {
- Q6AFE_LPASS_CLK_ID_PRI_MI2S_EBIT,
- Q6AFE_LPASS_CLK_ID_SEC_MI2S_EBIT,
- Q6AFE_LPASS_CLK_ID_TER_MI2S_EBIT,
- Q6AFE_LPASS_CLK_ID_QUAD_MI2S_EBIT,
- Q6AFE_LPASS_CLK_ID_QUI_MI2S_EBIT
-};
-
-struct msm_wsa881x_dev_info {
- struct device_node *of_node;
- u32 index;
-};
-static struct snd_soc_aux_dev *msm_aux_dev;
-static struct snd_soc_codec_conf *msm_codec_conf;
-
-static bool msm_swap_gnd_mic(struct snd_soc_codec *codec, bool active);
-
-static struct wcd_mbhc_config mbhc_cfg = {
- .read_fw_bin = false,
- .calibration = NULL,
- .detect_extn_cable = true,
- .mono_stero_detection = false,
- .swap_gnd_mic = NULL,
- .hs_ext_micbias = true,
- .key_code[0] = KEY_MEDIA,
- .key_code[1] = KEY_VOICECOMMAND,
- .key_code[2] = KEY_VOLUMEUP,
- .key_code[3] = KEY_VOLUMEDOWN,
- .key_code[4] = 0,
- .key_code[5] = 0,
- .key_code[6] = 0,
- .key_code[7] = 0,
- .linein_th = 5000,
- .moisture_en = false,
- .mbhc_micbias = 0,
- .anc_micbias = 0,
- .enable_anc_mic_detect = false,
-};
-
-static struct dev_config proxy_rx_cfg = {
- .sample_rate = SAMPLING_RATE_48KHZ,
- .bit_format = SNDRV_PCM_FORMAT_S16_LE,
- .channels = 2,
-};
-
-/* Default configuration of MI2S channels */
-static struct dev_config mi2s_rx_cfg[] = {
- [PRIM_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 2},
- [SEC_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 2},
- [TERT_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 2},
- [QUAT_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 2},
- [QUIN_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 2},
-};
-
-static struct dev_config mi2s_tx_cfg[] = {
- [PRIM_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SEC_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [TERT_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [QUAT_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [QUIN_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
-};
-
-static struct dev_config aux_pcm_rx_cfg[] = {
- [PRIM_AUX_PCM] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SEC_AUX_PCM] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [TERT_AUX_PCM] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [QUAT_AUX_PCM] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [QUIN_AUX_PCM] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
-};
-
-static struct dev_config aux_pcm_tx_cfg[] = {
- [PRIM_AUX_PCM] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SEC_AUX_PCM] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [TERT_AUX_PCM] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [QUAT_AUX_PCM] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [QUIN_AUX_PCM] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
-};
-
-static char const *ch_text[] = {"Two", "Three", "Four", "Five",
- "Six", "Seven", "Eight"};
-static const char *const auxpcm_rate_text[] = {"KHZ_8", "KHZ_16"};
-static char const *mi2s_rate_text[] = {"KHZ_8", "KHZ_16",
- "KHZ_32", "KHZ_44P1", "KHZ_48",
- "KHZ_96", "KHZ_192"};
-static const char *const mi2s_ch_text[] = {"One", "Two", "Three", "Four",
- "Five", "Six", "Seven",
- "Eight"};
-static char const *bit_format_text[] = {"S16_LE", "S24_LE", "S24_3LE",
- "S32_LE"};
-static char const *mi2s_format_text[] = {"S16_LE", "S24_LE", "S24_3LE",
- "S32_LE"};
-static char const *tdm_ch_text[] = {"One", "Two", "Three", "Four",
- "Five", "Six", "Seven", "Eight"};
-static char const *tdm_bit_format_text[] = {"S16_LE", "S24_LE", "S32_LE"};
-static char const *tdm_sample_rate_text[] = {"KHZ_8", "KHZ_16", "KHZ_32",
- "KHZ_44P1", "KHZ_48", "KHZ_96",
- "KHZ_192", "KHZ_352P8", "KHZ_384"};
-static const char *const usb_ch_text[] = {"One", "Two", "Three", "Four",
- "Five", "Six", "Seven",
- "Eight"};
-static char const *usb_sample_rate_text[] = {"KHZ_8", "KHZ_11P025",
- "KHZ_16", "KHZ_22P05",
- "KHZ_32", "KHZ_44P1", "KHZ_48",
- "KHZ_96", "KHZ_192", "KHZ_384"};
-static char const *ext_disp_bit_format_text[] = {"S16_LE", "S24_LE"};
-static char const *ext_disp_sample_rate_text[] = {"KHZ_48", "KHZ_96",
- "KHZ_192"};
-static const char *const qos_text[] = {"Disable", "Enable"};
-
-static SOC_ENUM_SINGLE_EXT_DECL(ext_disp_rx_chs, ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(proxy_rx_chs, ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(prim_aux_pcm_rx_sample_rate, auxpcm_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(sec_aux_pcm_rx_sample_rate, auxpcm_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tert_aux_pcm_rx_sample_rate, auxpcm_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(quat_aux_pcm_rx_sample_rate, auxpcm_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(quin_aux_pcm_rx_sample_rate, auxpcm_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(prim_aux_pcm_tx_sample_rate, auxpcm_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(sec_aux_pcm_tx_sample_rate, auxpcm_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tert_aux_pcm_tx_sample_rate, auxpcm_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(quat_aux_pcm_tx_sample_rate, auxpcm_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(quin_aux_pcm_tx_sample_rate, auxpcm_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(prim_mi2s_rx_sample_rate, mi2s_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(sec_mi2s_rx_sample_rate, mi2s_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tert_mi2s_rx_sample_rate, mi2s_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(quat_mi2s_rx_sample_rate, mi2s_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(quin_mi2s_rx_sample_rate, mi2s_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(prim_mi2s_tx_sample_rate, mi2s_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(sec_mi2s_tx_sample_rate, mi2s_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tert_mi2s_tx_sample_rate, mi2s_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(quat_mi2s_tx_sample_rate, mi2s_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(quin_mi2s_tx_sample_rate, mi2s_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(prim_mi2s_rx_format, mi2s_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(sec_mi2s_rx_format, mi2s_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tert_mi2s_rx_format, mi2s_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(quat_mi2s_rx_format, mi2s_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(quin_mi2s_rx_format, mi2s_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(prim_mi2s_tx_format, mi2s_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(sec_mi2s_tx_format, mi2s_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tert_mi2s_tx_format, mi2s_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(quat_mi2s_tx_format, mi2s_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(quin_mi2s_tx_format, mi2s_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(prim_mi2s_rx_chs, mi2s_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(prim_mi2s_tx_chs, mi2s_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(sec_mi2s_rx_chs, mi2s_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(sec_mi2s_tx_chs, mi2s_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tert_mi2s_rx_chs, mi2s_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tert_mi2s_tx_chs, mi2s_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(quat_mi2s_rx_chs, mi2s_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(quat_mi2s_tx_chs, mi2s_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(quin_mi2s_rx_chs, mi2s_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(quin_mi2s_tx_chs, mi2s_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(usb_rx_chs, usb_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(usb_tx_chs, usb_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(usb_rx_format, bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(usb_tx_format, bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(ext_disp_rx_format, ext_disp_bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(usb_rx_sample_rate, usb_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(usb_tx_sample_rate, usb_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(ext_disp_rx_sample_rate,
- ext_disp_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tdm_tx_chs, tdm_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tdm_tx_format, tdm_bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tdm_tx_sample_rate, tdm_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tdm_rx_chs, tdm_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tdm_rx_format, tdm_bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tdm_rx_sample_rate, tdm_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(qos_vote, qos_text);
-
-static int qos_vote_status;
-
-static struct afe_clk_set mi2s_clk[MI2S_MAX] = {
- {
- AFE_API_VERSION_I2S_CONFIG,
- Q6AFE_LPASS_CLK_ID_PRI_MI2S_IBIT,
- Q6AFE_LPASS_IBIT_CLK_1_P536_MHZ,
- Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO,
- Q6AFE_LPASS_CLK_ROOT_DEFAULT,
- 0,
- },
- {
- AFE_API_VERSION_I2S_CONFIG,
- Q6AFE_LPASS_CLK_ID_SEC_MI2S_IBIT,
- Q6AFE_LPASS_IBIT_CLK_1_P536_MHZ,
- Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO,
- Q6AFE_LPASS_CLK_ROOT_DEFAULT,
- 0,
- },
- {
- AFE_API_VERSION_I2S_CONFIG,
- Q6AFE_LPASS_CLK_ID_TER_MI2S_IBIT,
- Q6AFE_LPASS_IBIT_CLK_1_P536_MHZ,
- Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO,
- Q6AFE_LPASS_CLK_ROOT_DEFAULT,
- 0,
- },
- {
- AFE_API_VERSION_I2S_CONFIG,
- Q6AFE_LPASS_CLK_ID_QUAD_MI2S_IBIT,
- Q6AFE_LPASS_IBIT_CLK_1_P536_MHZ,
- Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO,
- Q6AFE_LPASS_CLK_ROOT_DEFAULT,
- 0,
- },
- {
- AFE_API_VERSION_I2S_CONFIG,
- Q6AFE_LPASS_CLK_ID_QUI_MI2S_IBIT,
- Q6AFE_LPASS_IBIT_CLK_1_P536_MHZ,
- Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO,
- Q6AFE_LPASS_CLK_ROOT_DEFAULT,
- 0,
- }
-};
-
-static struct afe_clk_set mi2s_mclk[MI2S_MAX] = {
- {
- AFE_API_VERSION_I2S_CONFIG,
- Q6AFE_LPASS_CLK_ID_MCLK_3,
- Q6AFE_LPASS_OSR_CLK_9_P600_MHZ,
- Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO,
- Q6AFE_LPASS_CLK_ROOT_DEFAULT,
- 0,
- },
- {
- AFE_API_VERSION_I2S_CONFIG,
- Q6AFE_LPASS_CLK_ID_MCLK_2,
- Q6AFE_LPASS_OSR_CLK_9_P600_MHZ,
- Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO,
- Q6AFE_LPASS_CLK_ROOT_DEFAULT,
- 0,
- },
- {
- AFE_API_VERSION_I2S_CONFIG,
- Q6AFE_LPASS_CLK_ID_MCLK_1,
- Q6AFE_LPASS_OSR_CLK_9_P600_MHZ,
- Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO,
- Q6AFE_LPASS_CLK_ROOT_DEFAULT,
- 0,
- },
- {
- AFE_API_VERSION_I2S_CONFIG,
- Q6AFE_LPASS_CLK_ID_MCLK_1,
- Q6AFE_LPASS_OSR_CLK_9_P600_MHZ,
- Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO,
- Q6AFE_LPASS_CLK_ROOT_DEFAULT,
- 0,
- },
- {
- AFE_API_VERSION_I2S_CONFIG,
- Q6AFE_LPASS_CLK_ID_QUI_MI2S_OSR,
- Q6AFE_LPASS_OSR_CLK_9_P600_MHZ,
- Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO,
- Q6AFE_LPASS_CLK_ROOT_DEFAULT,
- 0,
- }
-};
-
-static struct mi2s_conf mi2s_intf_conf[MI2S_MAX];
-
-static int proxy_rx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- pr_debug("%s: proxy_rx channels = %d\n",
- __func__, proxy_rx_cfg.channels);
- ucontrol->value.integer.value[0] = proxy_rx_cfg.channels - 2;
-
- return 0;
-}
-
-static int proxy_rx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- proxy_rx_cfg.channels = ucontrol->value.integer.value[0] + 2;
- pr_debug("%s: proxy_rx channels = %d\n",
- __func__, proxy_rx_cfg.channels);
-
- return 1;
-}
-
-static int tdm_get_sample_rate(int value)
-{
- int sample_rate = 0;
-
- switch (value) {
- case 0:
- sample_rate = SAMPLING_RATE_8KHZ;
- break;
- case 1:
- sample_rate = SAMPLING_RATE_16KHZ;
- break;
- case 2:
- sample_rate = SAMPLING_RATE_32KHZ;
- break;
- case 3:
- sample_rate = SAMPLING_RATE_44P1KHZ;
- break;
- case 4:
- sample_rate = SAMPLING_RATE_48KHZ;
- break;
- case 5:
- sample_rate = SAMPLING_RATE_96KHZ;
- break;
- case 6:
- sample_rate = SAMPLING_RATE_192KHZ;
- break;
- case 7:
- sample_rate = SAMPLING_RATE_352P8KHZ;
- break;
- case 8:
- sample_rate = SAMPLING_RATE_384KHZ;
- break;
- default:
- sample_rate = SAMPLING_RATE_48KHZ;
- break;
- }
- return sample_rate;
-}
-
-static int tdm_get_sample_rate_val(int sample_rate)
-{
- int sample_rate_val = 0;
-
- switch (sample_rate) {
- case SAMPLING_RATE_8KHZ:
- sample_rate_val = 0;
- break;
- case SAMPLING_RATE_16KHZ:
- sample_rate_val = 1;
- break;
- case SAMPLING_RATE_32KHZ:
- sample_rate_val = 2;
- break;
- case SAMPLING_RATE_44P1KHZ:
- sample_rate_val = 3;
- break;
- case SAMPLING_RATE_48KHZ:
- sample_rate_val = 4;
- break;
- case SAMPLING_RATE_96KHZ:
- sample_rate_val = 5;
- break;
- case SAMPLING_RATE_192KHZ:
- sample_rate_val = 6;
- break;
- case SAMPLING_RATE_352P8KHZ:
- sample_rate_val = 7;
- break;
- case SAMPLING_RATE_384KHZ:
- sample_rate_val = 8;
- break;
- default:
- sample_rate_val = 4;
- break;
- }
- return sample_rate_val;
-}
-
-static int tdm_get_port_idx(struct snd_kcontrol *kcontrol,
- struct tdm_port *port)
-{
- if (port) {
- if (strnstr(kcontrol->id.name, "PRI",
- sizeof(kcontrol->id.name))) {
- port->mode = TDM_PRI;
- } else if (strnstr(kcontrol->id.name, "SEC",
- sizeof(kcontrol->id.name))) {
- port->mode = TDM_SEC;
- } else if (strnstr(kcontrol->id.name, "TERT",
- sizeof(kcontrol->id.name))) {
- port->mode = TDM_TERT;
- } else if (strnstr(kcontrol->id.name, "QUAT",
- sizeof(kcontrol->id.name))) {
- port->mode = TDM_QUAT;
- } else if (strnstr(kcontrol->id.name, "QUIN",
- sizeof(kcontrol->id.name))) {
- port->mode = TDM_QUIN;
- } else {
- pr_err("%s: unsupported mode in: %s",
- __func__, kcontrol->id.name);
- return -EINVAL;
- }
-
- if (strnstr(kcontrol->id.name, "RX_0",
- sizeof(kcontrol->id.name)) ||
- strnstr(kcontrol->id.name, "TX_0",
- sizeof(kcontrol->id.name))) {
- port->channel = TDM_0;
- } else if (strnstr(kcontrol->id.name, "RX_1",
- sizeof(kcontrol->id.name)) ||
- strnstr(kcontrol->id.name, "TX_1",
- sizeof(kcontrol->id.name))) {
- port->channel = TDM_1;
- } else if (strnstr(kcontrol->id.name, "RX_2",
- sizeof(kcontrol->id.name)) ||
- strnstr(kcontrol->id.name, "TX_2",
- sizeof(kcontrol->id.name))) {
- port->channel = TDM_2;
- } else if (strnstr(kcontrol->id.name, "RX_3",
- sizeof(kcontrol->id.name)) ||
- strnstr(kcontrol->id.name, "TX_3",
- sizeof(kcontrol->id.name))) {
- port->channel = TDM_3;
- } else if (strnstr(kcontrol->id.name, "RX_4",
- sizeof(kcontrol->id.name)) ||
- strnstr(kcontrol->id.name, "TX_4",
- sizeof(kcontrol->id.name))) {
- port->channel = TDM_4;
- } else if (strnstr(kcontrol->id.name, "RX_5",
- sizeof(kcontrol->id.name)) ||
- strnstr(kcontrol->id.name, "TX_5",
- sizeof(kcontrol->id.name))) {
- port->channel = TDM_5;
- } else if (strnstr(kcontrol->id.name, "RX_6",
- sizeof(kcontrol->id.name)) ||
- strnstr(kcontrol->id.name, "TX_6",
- sizeof(kcontrol->id.name))) {
- port->channel = TDM_6;
- } else if (strnstr(kcontrol->id.name, "RX_7",
- sizeof(kcontrol->id.name)) ||
- strnstr(kcontrol->id.name, "TX_7",
- sizeof(kcontrol->id.name))) {
- port->channel = TDM_7;
- } else {
- pr_err("%s: unsupported channel in: %s",
- __func__, kcontrol->id.name);
- return -EINVAL;
- }
- } else
- return -EINVAL;
- return 0;
-}
-
-static int tdm_rx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- ucontrol->value.enumerated.item[0] = tdm_get_sample_rate_val(
- tdm_rx_cfg[port.mode][port.channel].sample_rate);
-
- pr_debug("%s: tdm_rx_sample_rate = %d, item = %d\n", __func__,
- tdm_rx_cfg[port.mode][port.channel].sample_rate,
- ucontrol->value.enumerated.item[0]);
- }
- return ret;
-}
-
-static int tdm_rx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- tdm_rx_cfg[port.mode][port.channel].sample_rate =
- tdm_get_sample_rate(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: tdm_rx_sample_rate = %d, item = %d\n", __func__,
- tdm_rx_cfg[port.mode][port.channel].sample_rate,
- ucontrol->value.enumerated.item[0]);
- }
- return ret;
-}
-
-static int tdm_tx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- ucontrol->value.enumerated.item[0] = tdm_get_sample_rate_val(
- tdm_tx_cfg[port.mode][port.channel].sample_rate);
-
- pr_debug("%s: tdm_tx_sample_rate = %d, item = %d\n", __func__,
- tdm_tx_cfg[port.mode][port.channel].sample_rate,
- ucontrol->value.enumerated.item[0]);
- }
- return ret;
-}
-
-static int tdm_tx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- tdm_tx_cfg[port.mode][port.channel].sample_rate =
- tdm_get_sample_rate(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: tdm_tx_sample_rate = %d, item = %d\n", __func__,
- tdm_tx_cfg[port.mode][port.channel].sample_rate,
- ucontrol->value.enumerated.item[0]);
- }
- return ret;
-}
-
-static int tdm_get_format(int value)
-{
- int format = 0;
-
- switch (value) {
- case 0:
- format = SNDRV_PCM_FORMAT_S16_LE;
- break;
- case 1:
- format = SNDRV_PCM_FORMAT_S24_LE;
- break;
- case 2:
- format = SNDRV_PCM_FORMAT_S32_LE;
- break;
- default:
- format = SNDRV_PCM_FORMAT_S16_LE;
- break;
- }
- return format;
-}
-
-static int tdm_get_format_val(int format)
-{
- int value = 0;
-
- switch (format) {
- case SNDRV_PCM_FORMAT_S16_LE:
- value = 0;
- break;
- case SNDRV_PCM_FORMAT_S24_LE:
- value = 1;
- break;
- case SNDRV_PCM_FORMAT_S32_LE:
- value = 2;
- break;
- default:
- value = 0;
- break;
- }
- return value;
-}
-
-static int mi2s_get_format(int value)
-{
- int format = 0;
-
- switch (value) {
- case 0:
- format = SNDRV_PCM_FORMAT_S16_LE;
- break;
- case 1:
- format = SNDRV_PCM_FORMAT_S24_LE;
- break;
- case 2:
- format = SNDRV_PCM_FORMAT_S24_3LE;
- break;
- case 3:
- format = SNDRV_PCM_FORMAT_S32_LE;
- break;
- default:
- format = SNDRV_PCM_FORMAT_S16_LE;
- break;
- }
- return format;
-}
-
-static int mi2s_get_format_value(int format)
-{
- int value = 0;
-
- switch (format) {
- case SNDRV_PCM_FORMAT_S16_LE:
- value = 0;
- break;
- case SNDRV_PCM_FORMAT_S24_LE:
- value = 1;
- break;
- case SNDRV_PCM_FORMAT_S24_3LE:
- value = 2;
- break;
- case SNDRV_PCM_FORMAT_S32_LE:
- value = 3;
- break;
- default:
- value = 0;
- break;
- }
- return value;
-}
-
-static int tdm_rx_format_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- ucontrol->value.enumerated.item[0] = tdm_get_format_val(
- tdm_rx_cfg[port.mode][port.channel].bit_format);
-
- pr_debug("%s: tdm_rx_bit_format = %d, item = %d\n", __func__,
- tdm_rx_cfg[port.mode][port.channel].bit_format,
- ucontrol->value.enumerated.item[0]);
- }
- return ret;
-}
-
-static int tdm_rx_format_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- tdm_rx_cfg[port.mode][port.channel].bit_format =
- tdm_get_format(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: tdm_rx_bit_format = %d, item = %d\n", __func__,
- tdm_rx_cfg[port.mode][port.channel].bit_format,
- ucontrol->value.enumerated.item[0]);
- }
- return ret;
-}
-
-static int tdm_tx_format_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- ucontrol->value.enumerated.item[0] = tdm_get_format_val(
- tdm_tx_cfg[port.mode][port.channel].bit_format);
-
- pr_debug("%s: tdm_tx_bit_format = %d, item = %d\n", __func__,
- tdm_tx_cfg[port.mode][port.channel].bit_format,
- ucontrol->value.enumerated.item[0]);
- }
- return ret;
-}
-
-static int tdm_tx_format_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- tdm_tx_cfg[port.mode][port.channel].bit_format =
- tdm_get_format(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: tdm_tx_bit_format = %d, item = %d\n", __func__,
- tdm_tx_cfg[port.mode][port.channel].bit_format,
- ucontrol->value.enumerated.item[0]);
- }
- return ret;
-}
-
-static int tdm_rx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
-
- ucontrol->value.enumerated.item[0] =
- tdm_rx_cfg[port.mode][port.channel].channels - 1;
-
- pr_debug("%s: tdm_rx_ch = %d, item = %d\n", __func__,
- tdm_rx_cfg[port.mode][port.channel].channels - 1,
- ucontrol->value.enumerated.item[0]);
- }
- return ret;
-}
-
-static int tdm_rx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- tdm_rx_cfg[port.mode][port.channel].channels =
- ucontrol->value.enumerated.item[0] + 1;
-
- pr_debug("%s: tdm_rx_ch = %d, item = %d\n", __func__,
- tdm_rx_cfg[port.mode][port.channel].channels,
- ucontrol->value.enumerated.item[0] + 1);
- }
- return ret;
-}
-
-static int tdm_tx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- ucontrol->value.enumerated.item[0] =
- tdm_tx_cfg[port.mode][port.channel].channels - 1;
-
- pr_debug("%s: tdm_tx_ch = %d, item = %d\n", __func__,
- tdm_tx_cfg[port.mode][port.channel].channels - 1,
- ucontrol->value.enumerated.item[0]);
- }
- return ret;
-}
-
-static int tdm_tx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- tdm_tx_cfg[port.mode][port.channel].channels =
- ucontrol->value.enumerated.item[0] + 1;
-
- pr_debug("%s: tdm_tx_ch = %d, item = %d\n", __func__,
- tdm_tx_cfg[port.mode][port.channel].channels,
- ucontrol->value.enumerated.item[0] + 1);
- }
- return ret;
-}
-
-static int aux_pcm_get_sample_rate(int value)
-{
- int sample_rate;
-
- switch (value) {
- case 1:
- sample_rate = SAMPLING_RATE_16KHZ;
- break;
- case 0:
- default:
- sample_rate = SAMPLING_RATE_8KHZ;
- break;
- }
- return sample_rate;
-}
-
-static int aux_pcm_get_sample_rate_val(int sample_rate)
-{
- int sample_rate_val;
-
- switch (sample_rate) {
- case SAMPLING_RATE_16KHZ:
- sample_rate_val = 1;
- break;
- case SAMPLING_RATE_8KHZ:
- default:
- sample_rate_val = 0;
- break;
- }
- return sample_rate_val;
-}
-
-static int aux_pcm_get_port_idx(struct snd_kcontrol *kcontrol)
-{
- int idx;
-
- if (strnstr(kcontrol->id.name, "PRIM_AUX_PCM",
- sizeof("PRIM_AUX_PCM")))
- idx = PRIM_AUX_PCM;
- else if (strnstr(kcontrol->id.name, "SEC_AUX_PCM",
- sizeof("SEC_AUX_PCM")))
- idx = SEC_AUX_PCM;
- else if (strnstr(kcontrol->id.name, "TERT_AUX_PCM",
- sizeof("TERT_AUX_PCM")))
- idx = TERT_AUX_PCM;
- else if (strnstr(kcontrol->id.name, "QUAT_AUX_PCM",
- sizeof("QUAT_AUX_PCM")))
- idx = QUAT_AUX_PCM;
- else if (strnstr(kcontrol->id.name, "QUIN_AUX_PCM",
- sizeof("QUIN_AUX_PCM")))
- idx = QUIN_AUX_PCM;
- else {
- pr_err("%s: unsupported port: %s",
- __func__, kcontrol->id.name);
- idx = -EINVAL;
- }
-
- return idx;
-}
-
-static int aux_pcm_rx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = aux_pcm_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- aux_pcm_rx_cfg[idx].sample_rate =
- aux_pcm_get_sample_rate(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: idx[%d]_rx_sample_rate = %d, item = %d\n", __func__,
- idx, aux_pcm_rx_cfg[idx].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int aux_pcm_rx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = aux_pcm_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- ucontrol->value.enumerated.item[0] =
- aux_pcm_get_sample_rate_val(aux_pcm_rx_cfg[idx].sample_rate);
-
- pr_debug("%s: idx[%d]_rx_sample_rate = %d, item = %d\n", __func__,
- idx, aux_pcm_rx_cfg[idx].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int aux_pcm_tx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = aux_pcm_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- aux_pcm_tx_cfg[idx].sample_rate =
- aux_pcm_get_sample_rate(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: idx[%d]_tx_sample_rate = %d, item = %d\n", __func__,
- idx, aux_pcm_tx_cfg[idx].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int aux_pcm_tx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = aux_pcm_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- ucontrol->value.enumerated.item[0] =
- aux_pcm_get_sample_rate_val(aux_pcm_tx_cfg[idx].sample_rate);
-
- pr_debug("%s: idx[%d]_tx_sample_rate = %d, item = %d\n", __func__,
- idx, aux_pcm_tx_cfg[idx].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int mi2s_get_port_idx(struct snd_kcontrol *kcontrol)
-{
- int idx;
-
- if (strnstr(kcontrol->id.name, "PRIM_MI2S_RX",
- sizeof("PRIM_MI2S_RX")))
- idx = PRIM_MI2S;
- else if (strnstr(kcontrol->id.name, "SEC_MI2S_RX",
- sizeof("SEC_MI2S_RX")))
- idx = SEC_MI2S;
- else if (strnstr(kcontrol->id.name, "TERT_MI2S_RX",
- sizeof("TERT_MI2S_RX")))
- idx = TERT_MI2S;
- else if (strnstr(kcontrol->id.name, "QUAT_MI2S_RX",
- sizeof("QUAT_MI2S_RX")))
- idx = QUAT_MI2S;
- else if (strnstr(kcontrol->id.name, "QUIN_MI2S_RX",
- sizeof("QUIN_MI2S_RX")))
- idx = QUIN_MI2S;
- else if (strnstr(kcontrol->id.name, "PRIM_MI2S_TX",
- sizeof("PRIM_MI2S_TX")))
- idx = PRIM_MI2S;
- else if (strnstr(kcontrol->id.name, "SEC_MI2S_TX",
- sizeof("SEC_MI2S_TX")))
- idx = SEC_MI2S;
- else if (strnstr(kcontrol->id.name, "TERT_MI2S_TX",
- sizeof("TERT_MI2S_TX")))
- idx = TERT_MI2S;
- else if (strnstr(kcontrol->id.name, "QUAT_MI2S_TX",
- sizeof("QUAT_MI2S_TX")))
- idx = QUAT_MI2S;
- else if (strnstr(kcontrol->id.name, "QUIN_MI2S_TX",
- sizeof("QUIN_MI2S_TX")))
- idx = QUIN_MI2S;
- else {
- pr_err("%s: unsupported channel: %s",
- __func__, kcontrol->id.name);
- idx = -EINVAL;
- }
-
- return idx;
-}
-
-static int mi2s_get_sample_rate_val(int sample_rate)
-{
- int sample_rate_val;
-
- switch (sample_rate) {
- case SAMPLING_RATE_8KHZ:
- sample_rate_val = 0;
- break;
- case SAMPLING_RATE_16KHZ:
- sample_rate_val = 1;
- break;
- case SAMPLING_RATE_32KHZ:
- sample_rate_val = 2;
- break;
- case SAMPLING_RATE_44P1KHZ:
- sample_rate_val = 3;
- break;
- case SAMPLING_RATE_48KHZ:
- sample_rate_val = 4;
- break;
- case SAMPLING_RATE_96KHZ:
- sample_rate_val = 5;
- break;
- case SAMPLING_RATE_192KHZ:
- sample_rate_val = 6;
- break;
- default:
- sample_rate_val = 4;
- break;
- }
- return sample_rate_val;
-}
-
-static int mi2s_get_sample_rate(int value)
-{
- int sample_rate;
-
- switch (value) {
- case 0:
- sample_rate = SAMPLING_RATE_8KHZ;
- break;
- case 1:
- sample_rate = SAMPLING_RATE_16KHZ;
- break;
- case 2:
- sample_rate = SAMPLING_RATE_32KHZ;
- break;
- case 3:
- sample_rate = SAMPLING_RATE_44P1KHZ;
- break;
- case 4:
- sample_rate = SAMPLING_RATE_48KHZ;
- break;
- case 5:
- sample_rate = SAMPLING_RATE_96KHZ;
- break;
- case 6:
- sample_rate = SAMPLING_RATE_192KHZ;
- break;
- default:
- sample_rate = SAMPLING_RATE_48KHZ;
- break;
- }
- return sample_rate;
-}
-
-static int mi2s_rx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- mi2s_rx_cfg[idx].sample_rate =
- mi2s_get_sample_rate(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: idx[%d]_rx_sample_rate = %d, item = %d\n", __func__,
- idx, mi2s_rx_cfg[idx].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int mi2s_rx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- ucontrol->value.enumerated.item[0] =
- mi2s_get_sample_rate_val(mi2s_rx_cfg[idx].sample_rate);
-
- pr_debug("%s: idx[%d]_rx_sample_rate = %d, item = %d\n", __func__,
- idx, mi2s_rx_cfg[idx].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int mi2s_tx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- mi2s_tx_cfg[idx].sample_rate =
- mi2s_get_sample_rate(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: idx[%d]_tx_sample_rate = %d, item = %d\n", __func__,
- idx, mi2s_tx_cfg[idx].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int mi2s_tx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- ucontrol->value.enumerated.item[0] =
- mi2s_get_sample_rate_val(mi2s_tx_cfg[idx].sample_rate);
-
- pr_debug("%s: idx[%d]_tx_sample_rate = %d, item = %d\n", __func__,
- idx, mi2s_tx_cfg[idx].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int mi2s_tx_format_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- mi2s_tx_cfg[idx].bit_format =
- mi2s_get_format(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: idx[%d] _tx_format = %d, item = %d\n", __func__,
- idx, mi2s_tx_cfg[idx].bit_format,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int mi2s_tx_format_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- ucontrol->value.enumerated.item[0] =
- mi2s_get_format_value(mi2s_tx_cfg[idx].bit_format);
-
- pr_debug("%s: idx[%d]_tx_format = %d, item = %d\n", __func__,
- idx, mi2s_tx_cfg[idx].bit_format,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int mi2s_rx_format_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- mi2s_rx_cfg[idx].bit_format =
- mi2s_get_format(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: idx[%d] _rx_format = %d, item = %d\n", __func__,
- idx, mi2s_rx_cfg[idx].bit_format,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int mi2s_rx_format_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- ucontrol->value.enumerated.item[0] =
- mi2s_get_format_value(mi2s_rx_cfg[idx].bit_format);
-
- pr_debug("%s: idx[%d]_rx_format = %d, item = %d\n", __func__,
- idx, mi2s_rx_cfg[idx].bit_format,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int msm_mi2s_rx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- pr_debug("%s: msm_mi2s_[%d]_rx_ch = %d\n", __func__,
- idx, mi2s_rx_cfg[idx].channels);
- ucontrol->value.enumerated.item[0] = mi2s_rx_cfg[idx].channels - 1;
-
- return 0;
-}
-
-static int msm_mi2s_rx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- mi2s_rx_cfg[idx].channels = ucontrol->value.enumerated.item[0] + 1;
- pr_debug("%s: msm_mi2s_[%d]_rx_ch = %d\n", __func__,
- idx, mi2s_rx_cfg[idx].channels);
-
- return 1;
-}
-
-static int msm_mi2s_tx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- pr_debug("%s: msm_mi2s_[%d]_tx_ch = %d\n", __func__,
- idx, mi2s_tx_cfg[idx].channels);
- ucontrol->value.enumerated.item[0] = mi2s_tx_cfg[idx].channels - 1;
-
- return 0;
-}
-
-static int msm_mi2s_tx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- mi2s_tx_cfg[idx].channels = ucontrol->value.enumerated.item[0] + 1;
- pr_debug("%s: msm_mi2s_[%d]_tx_ch = %d\n", __func__,
- idx, mi2s_tx_cfg[idx].channels);
-
- return 1;
-}
-
-static int usb_audio_rx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- pr_debug("%s: usb_audio_rx_ch = %d\n", __func__,
- usb_rx_cfg.channels);
- ucontrol->value.integer.value[0] = usb_rx_cfg.channels - 1;
- return 0;
-}
-
-static int usb_audio_rx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- usb_rx_cfg.channels = ucontrol->value.integer.value[0] + 1;
-
- pr_debug("%s: usb_audio_rx_ch = %d\n", __func__, usb_rx_cfg.channels);
- return 1;
-}
-
-static int usb_audio_rx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int sample_rate_val;
-
- switch (usb_rx_cfg.sample_rate) {
- case SAMPLING_RATE_384KHZ:
- sample_rate_val = 9;
- break;
- case SAMPLING_RATE_192KHZ:
- sample_rate_val = 8;
- break;
- case SAMPLING_RATE_96KHZ:
- sample_rate_val = 7;
- break;
- case SAMPLING_RATE_48KHZ:
- sample_rate_val = 6;
- break;
- case SAMPLING_RATE_44P1KHZ:
- sample_rate_val = 5;
- break;
- case SAMPLING_RATE_32KHZ:
- sample_rate_val = 4;
- break;
- case SAMPLING_RATE_22P05KHZ:
- sample_rate_val = 3;
- break;
- case SAMPLING_RATE_16KHZ:
- sample_rate_val = 2;
- break;
- case SAMPLING_RATE_11P025KHZ:
- sample_rate_val = 1;
- break;
- case SAMPLING_RATE_8KHZ:
- default:
- sample_rate_val = 0;
- break;
- }
-
- ucontrol->value.integer.value[0] = sample_rate_val;
- pr_debug("%s: usb_audio_rx_sample_rate = %d\n", __func__,
- usb_rx_cfg.sample_rate);
- return 0;
-}
-
-static int usb_audio_rx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- switch (ucontrol->value.integer.value[0]) {
- case 9:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_384KHZ;
- break;
- case 8:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_192KHZ;
- break;
- case 7:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_96KHZ;
- break;
- case 6:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_48KHZ;
- break;
- case 5:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_44P1KHZ;
- break;
- case 4:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_32KHZ;
- break;
- case 3:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_22P05KHZ;
- break;
- case 2:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_16KHZ;
- break;
- case 1:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_11P025KHZ;
- break;
- case 0:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_8KHZ;
- break;
- default:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_48KHZ;
- break;
- }
-
- pr_debug("%s: control value = %ld, usb_audio_rx_sample_rate = %d\n",
- __func__, ucontrol->value.integer.value[0],
- usb_rx_cfg.sample_rate);
- return 0;
-}
-
-static int usb_audio_rx_format_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- switch (usb_rx_cfg.bit_format) {
- case SNDRV_PCM_FORMAT_S32_LE:
- ucontrol->value.integer.value[0] = 3;
- break;
- case SNDRV_PCM_FORMAT_S24_3LE:
- ucontrol->value.integer.value[0] = 2;
- break;
- case SNDRV_PCM_FORMAT_S24_LE:
- ucontrol->value.integer.value[0] = 1;
- break;
- case SNDRV_PCM_FORMAT_S16_LE:
- default:
- ucontrol->value.integer.value[0] = 0;
- break;
- }
-
- pr_debug("%s: usb_audio_rx_format = %d, ucontrol value = %ld\n",
- __func__, usb_rx_cfg.bit_format,
- ucontrol->value.integer.value[0]);
- return 0;
-}
-
-static int usb_audio_rx_format_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int rc = 0;
-
- switch (ucontrol->value.integer.value[0]) {
- case 3:
- usb_rx_cfg.bit_format = SNDRV_PCM_FORMAT_S32_LE;
- break;
- case 2:
- usb_rx_cfg.bit_format = SNDRV_PCM_FORMAT_S24_3LE;
- break;
- case 1:
- usb_rx_cfg.bit_format = SNDRV_PCM_FORMAT_S24_LE;
- break;
- case 0:
- default:
- usb_rx_cfg.bit_format = SNDRV_PCM_FORMAT_S16_LE;
- break;
- }
- pr_debug("%s: usb_audio_rx_format = %d, ucontrol value = %ld\n",
- __func__, usb_rx_cfg.bit_format,
- ucontrol->value.integer.value[0]);
-
- return rc;
-}
-
-static int usb_audio_tx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- pr_debug("%s: usb_audio_tx_ch = %d\n", __func__,
- usb_tx_cfg.channels);
- ucontrol->value.integer.value[0] = usb_tx_cfg.channels - 1;
- return 0;
-}
-
-static int usb_audio_tx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- usb_tx_cfg.channels = ucontrol->value.integer.value[0] + 1;
-
- pr_debug("%s: usb_audio_tx_ch = %d\n", __func__, usb_tx_cfg.channels);
- return 1;
-}
-
-static int usb_audio_tx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int sample_rate_val;
-
- switch (usb_tx_cfg.sample_rate) {
- case SAMPLING_RATE_384KHZ:
- sample_rate_val = 9;
- break;
- case SAMPLING_RATE_192KHZ:
- sample_rate_val = 8;
- break;
- case SAMPLING_RATE_96KHZ:
- sample_rate_val = 7;
- break;
- case SAMPLING_RATE_48KHZ:
- sample_rate_val = 6;
- break;
- case SAMPLING_RATE_44P1KHZ:
- sample_rate_val = 5;
- break;
- case SAMPLING_RATE_32KHZ:
- sample_rate_val = 4;
- break;
- case SAMPLING_RATE_22P05KHZ:
- sample_rate_val = 3;
- break;
- case SAMPLING_RATE_16KHZ:
- sample_rate_val = 2;
- break;
- case SAMPLING_RATE_11P025KHZ:
- sample_rate_val = 1;
- break;
- case SAMPLING_RATE_8KHZ:
- sample_rate_val = 0;
- break;
- default:
- sample_rate_val = 6;
- break;
- }
-
- ucontrol->value.integer.value[0] = sample_rate_val;
- pr_debug("%s: usb_audio_tx_sample_rate = %d\n", __func__,
- usb_tx_cfg.sample_rate);
- return 0;
-}
-
-static int usb_audio_tx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- switch (ucontrol->value.integer.value[0]) {
- case 9:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_384KHZ;
- break;
- case 8:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_192KHZ;
- break;
- case 7:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_96KHZ;
- break;
- case 6:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_48KHZ;
- break;
- case 5:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_44P1KHZ;
- break;
- case 4:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_32KHZ;
- break;
- case 3:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_22P05KHZ;
- break;
- case 2:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_16KHZ;
- break;
- case 1:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_11P025KHZ;
- break;
- case 0:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_8KHZ;
- break;
- default:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_48KHZ;
- break;
- }
-
- pr_debug("%s: control value = %ld, usb_audio_tx_sample_rate = %d\n",
- __func__, ucontrol->value.integer.value[0],
- usb_tx_cfg.sample_rate);
- return 0;
-}
-
-static int usb_audio_tx_format_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- switch (usb_tx_cfg.bit_format) {
- case SNDRV_PCM_FORMAT_S32_LE:
- ucontrol->value.integer.value[0] = 3;
- break;
- case SNDRV_PCM_FORMAT_S24_3LE:
- ucontrol->value.integer.value[0] = 2;
- break;
- case SNDRV_PCM_FORMAT_S24_LE:
- ucontrol->value.integer.value[0] = 1;
- break;
- case SNDRV_PCM_FORMAT_S16_LE:
- default:
- ucontrol->value.integer.value[0] = 0;
- break;
- }
-
- pr_debug("%s: usb_audio_tx_format = %d, ucontrol value = %ld\n",
- __func__, usb_tx_cfg.bit_format,
- ucontrol->value.integer.value[0]);
- return 0;
-}
-
-static int usb_audio_tx_format_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int rc = 0;
-
- switch (ucontrol->value.integer.value[0]) {
- case 3:
- usb_tx_cfg.bit_format = SNDRV_PCM_FORMAT_S32_LE;
- break;
- case 2:
- usb_tx_cfg.bit_format = SNDRV_PCM_FORMAT_S24_3LE;
- break;
- case 1:
- usb_tx_cfg.bit_format = SNDRV_PCM_FORMAT_S24_LE;
- break;
- case 0:
- default:
- usb_tx_cfg.bit_format = SNDRV_PCM_FORMAT_S16_LE;
- break;
- }
- pr_debug("%s: usb_audio_tx_format = %d, ucontrol value = %ld\n",
- __func__, usb_tx_cfg.bit_format,
- ucontrol->value.integer.value[0]);
-
- return rc;
-}
-
-static int ext_disp_get_port_idx(struct snd_kcontrol *kcontrol)
-{
- int idx;
-
- if (strnstr(kcontrol->id.name, "Display Port RX",
- sizeof("Display Port RX")))
- idx = DP_RX_IDX;
- else {
- pr_err("%s: unsupported BE: %s",
- __func__, kcontrol->id.name);
- idx = -EINVAL;
- }
-
- return idx;
-}
-
-static int ext_disp_rx_format_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = ext_disp_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- switch (ext_disp_rx_cfg[idx].bit_format) {
- case SNDRV_PCM_FORMAT_S24_LE:
- ucontrol->value.integer.value[0] = 1;
- break;
-
- case SNDRV_PCM_FORMAT_S16_LE:
- default:
- ucontrol->value.integer.value[0] = 0;
- break;
- }
-
- pr_debug("%s: ext_disp_rx[%d].format = %d, ucontrol value = %ld\n",
- __func__, idx, ext_disp_rx_cfg[idx].bit_format,
- ucontrol->value.integer.value[0]);
- return 0;
-}
-
-static int ext_disp_rx_format_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = ext_disp_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- switch (ucontrol->value.integer.value[0]) {
- case 1:
- ext_disp_rx_cfg[idx].bit_format = SNDRV_PCM_FORMAT_S24_LE;
- break;
- case 0:
- default:
- ext_disp_rx_cfg[idx].bit_format = SNDRV_PCM_FORMAT_S16_LE;
- break;
- }
- pr_debug("%s: ext_disp_rx[%d].format = %d, ucontrol value = %ld\n",
- __func__, idx, ext_disp_rx_cfg[idx].bit_format,
- ucontrol->value.integer.value[0]);
-
- return 0;
-}
-
-static int ext_disp_rx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = ext_disp_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- ucontrol->value.integer.value[0] =
- ext_disp_rx_cfg[idx].channels - 2;
-
- pr_debug("%s: ext_disp_rx[%d].ch = %d\n", __func__,
- idx, ext_disp_rx_cfg[idx].channels);
-
- return 0;
-}
-
-static int ext_disp_rx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = ext_disp_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- ext_disp_rx_cfg[idx].channels =
- ucontrol->value.integer.value[0] + 2;
-
- pr_debug("%s: ext_disp_rx[%d].ch = %d\n", __func__,
- idx, ext_disp_rx_cfg[idx].channels);
- return 1;
-}
-
-static int ext_disp_rx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int sample_rate_val;
- int idx = ext_disp_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- switch (ext_disp_rx_cfg[idx].sample_rate) {
- case SAMPLING_RATE_192KHZ:
- sample_rate_val = 2;
- break;
-
- case SAMPLING_RATE_96KHZ:
- sample_rate_val = 1;
- break;
-
- case SAMPLING_RATE_48KHZ:
- default:
- sample_rate_val = 0;
- break;
- }
-
- ucontrol->value.integer.value[0] = sample_rate_val;
- pr_debug("%s: ext_disp_rx[%d].sample_rate = %d\n", __func__,
- idx, ext_disp_rx_cfg[idx].sample_rate);
-
- return 0;
-}
-
-static int ext_disp_rx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = ext_disp_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- switch (ucontrol->value.integer.value[0]) {
- case 2:
- ext_disp_rx_cfg[idx].sample_rate = SAMPLING_RATE_192KHZ;
- break;
- case 1:
- ext_disp_rx_cfg[idx].sample_rate = SAMPLING_RATE_96KHZ;
- break;
- case 0:
- default:
- ext_disp_rx_cfg[idx].sample_rate = SAMPLING_RATE_48KHZ;
- break;
- }
-
- pr_debug("%s: control value = %ld, ext_disp_rx[%d].sample_rate = %d\n",
- __func__, ucontrol->value.integer.value[0], idx,
- ext_disp_rx_cfg[idx].sample_rate);
- return 0;
-}
-
-static int msm_qos_ctl_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- ucontrol->value.enumerated.item[0] = qos_vote_status;
-
- return 0;
-}
-
-static int msm_qos_ctl_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct snd_soc_card *card = codec->component.card;
- const char *fe_name = MSM_DAILINK_NAME(LowLatency);
- struct snd_soc_pcm_runtime *rtd;
- struct snd_pcm_substream *substream;
- s32 usecs;
-
- rtd = snd_soc_get_pcm_runtime(card, fe_name);
- if (!rtd) {
- pr_err("%s: fail to get pcm runtime for %s\n",
- __func__, fe_name);
- return -EINVAL;
- }
-
- substream = rtd->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream;
- if (!substream) {
- pr_err("%s: substream is null\n", __func__);
- return -EINVAL;
- }
-
- qos_vote_status = ucontrol->value.enumerated.item[0];
- if (qos_vote_status) {
- if (pm_qos_request_active(&substream->latency_pm_qos_req))
- pm_qos_remove_request(&substream->latency_pm_qos_req);
- if (!substream->runtime) {
- pr_err("%s: runtime is null\n", __func__);
- return -EINVAL;
- }
- usecs = MSM_LL_QOS_VALUE;
- if (usecs >= 0)
- pm_qos_add_request(&substream->latency_pm_qos_req,
- PM_QOS_CPU_DMA_LATENCY, usecs);
- } else {
- if (pm_qos_request_active(&substream->latency_pm_qos_req))
- pm_qos_remove_request(&substream->latency_pm_qos_req);
- }
-
- return 0;
-}
-
-const struct snd_kcontrol_new msm_common_snd_controls[] = {
- SOC_ENUM_EXT("PROXY_RX Channels", proxy_rx_chs,
- proxy_rx_ch_get, proxy_rx_ch_put),
- SOC_ENUM_EXT("PRIM_AUX_PCM_RX SampleRate", prim_aux_pcm_rx_sample_rate,
- aux_pcm_rx_sample_rate_get,
- aux_pcm_rx_sample_rate_put),
- SOC_ENUM_EXT("SEC_AUX_PCM_RX SampleRate", sec_aux_pcm_rx_sample_rate,
- aux_pcm_rx_sample_rate_get,
- aux_pcm_rx_sample_rate_put),
- SOC_ENUM_EXT("TERT_AUX_PCM_RX SampleRate", tert_aux_pcm_rx_sample_rate,
- aux_pcm_rx_sample_rate_get,
- aux_pcm_rx_sample_rate_put),
- SOC_ENUM_EXT("QUAT_AUX_PCM_RX SampleRate", quat_aux_pcm_rx_sample_rate,
- aux_pcm_rx_sample_rate_get,
- aux_pcm_rx_sample_rate_put),
- SOC_ENUM_EXT("QUIN_AUX_PCM_RX SampleRate", quin_aux_pcm_rx_sample_rate,
- aux_pcm_rx_sample_rate_get,
- aux_pcm_rx_sample_rate_put),
- SOC_ENUM_EXT("PRIM_AUX_PCM_TX SampleRate", prim_aux_pcm_tx_sample_rate,
- aux_pcm_tx_sample_rate_get,
- aux_pcm_tx_sample_rate_put),
- SOC_ENUM_EXT("SEC_AUX_PCM_TX SampleRate", sec_aux_pcm_tx_sample_rate,
- aux_pcm_tx_sample_rate_get,
- aux_pcm_tx_sample_rate_put),
- SOC_ENUM_EXT("TERT_AUX_PCM_TX SampleRate", tert_aux_pcm_tx_sample_rate,
- aux_pcm_tx_sample_rate_get,
- aux_pcm_tx_sample_rate_put),
- SOC_ENUM_EXT("QUAT_AUX_PCM_TX SampleRate", quat_aux_pcm_tx_sample_rate,
- aux_pcm_tx_sample_rate_get,
- aux_pcm_tx_sample_rate_put),
- SOC_ENUM_EXT("QUIN_AUX_PCM_TX SampleRate", quin_aux_pcm_tx_sample_rate,
- aux_pcm_tx_sample_rate_get,
- aux_pcm_tx_sample_rate_put),
- SOC_ENUM_EXT("PRIM_MI2S_RX SampleRate", prim_mi2s_rx_sample_rate,
- mi2s_rx_sample_rate_get,
- mi2s_rx_sample_rate_put),
- SOC_ENUM_EXT("SEC_MI2S_RX SampleRate", sec_mi2s_rx_sample_rate,
- mi2s_rx_sample_rate_get,
- mi2s_rx_sample_rate_put),
- SOC_ENUM_EXT("TERT_MI2S_RX SampleRate", tert_mi2s_rx_sample_rate,
- mi2s_rx_sample_rate_get,
- mi2s_rx_sample_rate_put),
- SOC_ENUM_EXT("QUAT_MI2S_RX SampleRate", quat_mi2s_rx_sample_rate,
- mi2s_rx_sample_rate_get,
- mi2s_rx_sample_rate_put),
- SOC_ENUM_EXT("QUIN_MI2S_RX SampleRate", quin_mi2s_rx_sample_rate,
- mi2s_rx_sample_rate_get,
- mi2s_rx_sample_rate_put),
- SOC_ENUM_EXT("PRIM_MI2S_TX SampleRate", prim_mi2s_tx_sample_rate,
- mi2s_tx_sample_rate_get,
- mi2s_tx_sample_rate_put),
- SOC_ENUM_EXT("SEC_MI2S_TX SampleRate", sec_mi2s_tx_sample_rate,
- mi2s_tx_sample_rate_get,
- mi2s_tx_sample_rate_put),
- SOC_ENUM_EXT("TERT_MI2S_TX SampleRate", tert_mi2s_tx_sample_rate,
- mi2s_tx_sample_rate_get,
- mi2s_tx_sample_rate_put),
- SOC_ENUM_EXT("QUAT_MI2S_TX SampleRate", quat_mi2s_tx_sample_rate,
- mi2s_tx_sample_rate_get,
- mi2s_tx_sample_rate_put),
- SOC_ENUM_EXT("QUIN_MI2S_TX SampleRate", quin_mi2s_tx_sample_rate,
- mi2s_tx_sample_rate_get,
- mi2s_tx_sample_rate_put),
- SOC_ENUM_EXT("PRIM_MI2S_RX Format", prim_mi2s_rx_format,
- mi2s_rx_format_get,
- mi2s_rx_format_put),
- SOC_ENUM_EXT("SEC_MI2S_RX Format", sec_mi2s_rx_format,
- mi2s_rx_format_get,
- mi2s_rx_format_put),
- SOC_ENUM_EXT("TERT_MI2S_RX Format", tert_mi2s_rx_format,
- mi2s_rx_format_get,
- mi2s_rx_format_put),
- SOC_ENUM_EXT("QUAT_MI2S_RX Format", quat_mi2s_rx_format,
- mi2s_rx_format_get,
- mi2s_rx_format_put),
- SOC_ENUM_EXT("QUIN_MI2S_RX Format", quin_mi2s_rx_format,
- mi2s_rx_format_get,
- mi2s_rx_format_put),
- SOC_ENUM_EXT("PRIM_MI2S_TX Format", prim_mi2s_tx_format,
- mi2s_tx_format_get,
- mi2s_tx_format_put),
- SOC_ENUM_EXT("SEC_MI2S_TX Format", sec_mi2s_tx_format,
- mi2s_tx_format_get,
- mi2s_tx_format_put),
- SOC_ENUM_EXT("TERT_MI2S_TX Format", tert_mi2s_tx_format,
- mi2s_tx_format_get,
- mi2s_tx_format_put),
- SOC_ENUM_EXT("QUAT_MI2S_TX Format", quat_mi2s_tx_format,
- mi2s_tx_format_get,
- mi2s_tx_format_put),
- SOC_ENUM_EXT("QUIN_MI2S_TX Format", quin_mi2s_tx_format,
- mi2s_tx_format_get,
- mi2s_tx_format_put),
- SOC_ENUM_EXT("PRIM_MI2S_RX Channels", prim_mi2s_rx_chs,
- msm_mi2s_rx_ch_get, msm_mi2s_rx_ch_put),
- SOC_ENUM_EXT("PRIM_MI2S_TX Channels", prim_mi2s_tx_chs,
- msm_mi2s_tx_ch_get, msm_mi2s_tx_ch_put),
- SOC_ENUM_EXT("SEC_MI2S_RX Channels", sec_mi2s_rx_chs,
- msm_mi2s_rx_ch_get, msm_mi2s_rx_ch_put),
- SOC_ENUM_EXT("SEC_MI2S_TX Channels", sec_mi2s_tx_chs,
- msm_mi2s_tx_ch_get, msm_mi2s_tx_ch_put),
- SOC_ENUM_EXT("TERT_MI2S_RX Channels", tert_mi2s_rx_chs,
- msm_mi2s_rx_ch_get, msm_mi2s_rx_ch_put),
- SOC_ENUM_EXT("TERT_MI2S_TX Channels", tert_mi2s_tx_chs,
- msm_mi2s_tx_ch_get, msm_mi2s_tx_ch_put),
- SOC_ENUM_EXT("QUAT_MI2S_RX Channels", quat_mi2s_rx_chs,
- msm_mi2s_rx_ch_get, msm_mi2s_rx_ch_put),
- SOC_ENUM_EXT("QUAT_MI2S_TX Channels", quat_mi2s_tx_chs,
- msm_mi2s_tx_ch_get, msm_mi2s_tx_ch_put),
- SOC_ENUM_EXT("QUIN_MI2S_RX Channels", quin_mi2s_rx_chs,
- msm_mi2s_rx_ch_get, msm_mi2s_rx_ch_put),
- SOC_ENUM_EXT("QUIN_MI2S_TX Channels", quin_mi2s_tx_chs,
- msm_mi2s_tx_ch_get, msm_mi2s_tx_ch_put),
- SOC_ENUM_EXT("USB_AUDIO_RX Channels", usb_rx_chs,
- usb_audio_rx_ch_get, usb_audio_rx_ch_put),
- SOC_ENUM_EXT("USB_AUDIO_TX Channels", usb_tx_chs,
- usb_audio_tx_ch_get, usb_audio_tx_ch_put),
- SOC_ENUM_EXT("Display Port RX Channels", ext_disp_rx_chs,
- ext_disp_rx_ch_get, ext_disp_rx_ch_put),
- SOC_ENUM_EXT("USB_AUDIO_RX Format", usb_rx_format,
- usb_audio_rx_format_get, usb_audio_rx_format_put),
- SOC_ENUM_EXT("USB_AUDIO_TX Format", usb_tx_format,
- usb_audio_tx_format_get, usb_audio_tx_format_put),
- SOC_ENUM_EXT("Display Port RX Bit Format", ext_disp_rx_format,
- ext_disp_rx_format_get, ext_disp_rx_format_put),
- SOC_ENUM_EXT("USB_AUDIO_RX SampleRate", usb_rx_sample_rate,
- usb_audio_rx_sample_rate_get,
- usb_audio_rx_sample_rate_put),
- SOC_ENUM_EXT("USB_AUDIO_TX SampleRate", usb_tx_sample_rate,
- usb_audio_tx_sample_rate_get,
- usb_audio_tx_sample_rate_put),
- SOC_ENUM_EXT("Display Port RX SampleRate", ext_disp_rx_sample_rate,
- ext_disp_rx_sample_rate_get,
- ext_disp_rx_sample_rate_put),
- SOC_ENUM_EXT("PRI_TDM_RX_0 SampleRate", tdm_rx_sample_rate,
- tdm_rx_sample_rate_get,
- tdm_rx_sample_rate_put),
- SOC_ENUM_EXT("PRI_TDM_TX_0 SampleRate", tdm_tx_sample_rate,
- tdm_tx_sample_rate_get,
- tdm_tx_sample_rate_put),
- SOC_ENUM_EXT("PRI_TDM_RX_0 Format", tdm_rx_format,
- tdm_rx_format_get,
- tdm_rx_format_put),
- SOC_ENUM_EXT("PRI_TDM_TX_0 Format", tdm_tx_format,
- tdm_tx_format_get,
- tdm_tx_format_put),
- SOC_ENUM_EXT("PRI_TDM_RX_0 Channels", tdm_rx_chs,
- tdm_rx_ch_get,
- tdm_rx_ch_put),
- SOC_ENUM_EXT("PRI_TDM_TX_0 Channels", tdm_tx_chs,
- tdm_tx_ch_get,
- tdm_tx_ch_put),
- SOC_ENUM_EXT("SEC_TDM_RX_0 SampleRate", tdm_rx_sample_rate,
- tdm_rx_sample_rate_get,
- tdm_rx_sample_rate_put),
- SOC_ENUM_EXT("SEC_TDM_TX_0 SampleRate", tdm_tx_sample_rate,
- tdm_tx_sample_rate_get,
- tdm_tx_sample_rate_put),
- SOC_ENUM_EXT("SEC_TDM_RX_0 Format", tdm_rx_format,
- tdm_rx_format_get,
- tdm_rx_format_put),
- SOC_ENUM_EXT("SEC_TDM_TX_0 Format", tdm_tx_format,
- tdm_tx_format_get,
- tdm_tx_format_put),
- SOC_ENUM_EXT("SEC_TDM_RX_0 Channels", tdm_rx_chs,
- tdm_rx_ch_get,
- tdm_rx_ch_put),
- SOC_ENUM_EXT("SEC_TDM_TX_0 Channels", tdm_tx_chs,
- tdm_tx_ch_get,
- tdm_tx_ch_put),
- SOC_ENUM_EXT("TERT_TDM_RX_0 SampleRate", tdm_rx_sample_rate,
- tdm_rx_sample_rate_get,
- tdm_rx_sample_rate_put),
- SOC_ENUM_EXT("TERT_TDM_TX_0 SampleRate", tdm_tx_sample_rate,
- tdm_tx_sample_rate_get,
- tdm_tx_sample_rate_put),
- SOC_ENUM_EXT("TERT_TDM_RX_0 Format", tdm_rx_format,
- tdm_rx_format_get,
- tdm_rx_format_put),
- SOC_ENUM_EXT("TERT_TDM_TX_0 Format", tdm_tx_format,
- tdm_tx_format_get,
- tdm_tx_format_put),
- SOC_ENUM_EXT("TERT_TDM_RX_0 Channels", tdm_rx_chs,
- tdm_rx_ch_get,
- tdm_rx_ch_put),
- SOC_ENUM_EXT("TERT_TDM_TX_0 Channels", tdm_tx_chs,
- tdm_tx_ch_get,
- tdm_tx_ch_put),
- SOC_ENUM_EXT("QUAT_TDM_RX_0 SampleRate", tdm_rx_sample_rate,
- tdm_rx_sample_rate_get,
- tdm_rx_sample_rate_put),
- SOC_ENUM_EXT("QUAT_TDM_TX_0 SampleRate", tdm_tx_sample_rate,
- tdm_tx_sample_rate_get,
- tdm_tx_sample_rate_put),
- SOC_ENUM_EXT("QUAT_TDM_RX_0 Format", tdm_rx_format,
- tdm_rx_format_get,
- tdm_rx_format_put),
- SOC_ENUM_EXT("QUAT_TDM_TX_0 Format", tdm_tx_format,
- tdm_tx_format_get,
- tdm_tx_format_put),
- SOC_ENUM_EXT("QUAT_TDM_RX_0 Channels", tdm_rx_chs,
- tdm_rx_ch_get,
- tdm_rx_ch_put),
- SOC_ENUM_EXT("QUAT_TDM_TX_0 Channels", tdm_tx_chs,
- tdm_tx_ch_get,
- tdm_tx_ch_put),
- SOC_ENUM_EXT("QUIN_TDM_RX_0 SampleRate", tdm_rx_sample_rate,
- tdm_rx_sample_rate_get,
- tdm_rx_sample_rate_put),
- SOC_ENUM_EXT("QUIN_TDM_TX_0 SampleRate", tdm_tx_sample_rate,
- tdm_tx_sample_rate_get,
- tdm_tx_sample_rate_put),
- SOC_ENUM_EXT("QUIN_TDM_RX_0 Format", tdm_rx_format,
- tdm_rx_format_get,
- tdm_rx_format_put),
- SOC_ENUM_EXT("QUIN_TDM_TX_0 Format", tdm_tx_format,
- tdm_tx_format_get,
- tdm_tx_format_put),
- SOC_ENUM_EXT("QUIN_TDM_RX_0 Channels", tdm_rx_chs,
- tdm_rx_ch_get,
- tdm_rx_ch_put),
- SOC_ENUM_EXT("QUIN_TDM_TX_0 Channels", tdm_tx_chs,
- tdm_tx_ch_get,
- tdm_tx_ch_put),
- SOC_ENUM_EXT("MultiMedia5_RX QOS Vote", qos_vote, msm_qos_ctl_get,
- msm_qos_ctl_put),
-};
-
-/**
- * msm_common_snd_controls_size - to return controls size
- *
- * Return: returns size of common controls array
- */
-int msm_common_snd_controls_size(void)
-{
- return ARRAY_SIZE(msm_common_snd_controls);
-}
-EXPORT_SYMBOL(msm_common_snd_controls_size);
-
-void msm_set_codec_reg_done(bool done)
-{
- codec_reg_done = done;
-}
-EXPORT_SYMBOL(msm_set_codec_reg_done);
-
-static inline int param_is_mask(int p)
-{
- return (p >= SNDRV_PCM_HW_PARAM_FIRST_MASK) &&
- (p <= SNDRV_PCM_HW_PARAM_LAST_MASK);
-}
-
-static inline struct snd_mask *param_to_mask(struct snd_pcm_hw_params *p,
- int n)
-{
- return &(p->masks[n - SNDRV_PCM_HW_PARAM_FIRST_MASK]);
-}
-
-static void param_set_mask(struct snd_pcm_hw_params *p, int n, unsigned int bit)
-{
- if (bit >= SNDRV_MASK_MAX)
- return;
- if (param_is_mask(n)) {
- struct snd_mask *m = param_to_mask(p, n);
-
- m->bits[0] = 0;
- m->bits[1] = 0;
- m->bits[bit >> 5] |= (1 << (bit & 31));
- }
-}
-
-static int msm_ext_disp_get_idx_from_beid(int32_t id)
-{
- int idx;
-
- switch (id) {
- case MSM_BACKEND_DAI_DISPLAY_PORT_RX:
- idx = DP_RX_IDX;
- break;
- default:
- pr_err("%s: Incorrect ext_disp id %d\n", __func__, id);
- idx = -EINVAL;
- break;
- }
-
- return idx;
-}
-
-/**
- * msm_common_be_hw_params_fixup - updates settings of ALSA BE hw params.
- *
- * @rtd: runtime dailink instance
- * @params: HW params of associated backend dailink.
- *
- * Returns 0.
- */
-int msm_common_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
- struct snd_pcm_hw_params *params)
-{
- struct snd_soc_dai_link *dai_link = rtd->dai_link;
- struct snd_interval *rate = hw_param_interval(params,
- SNDRV_PCM_HW_PARAM_RATE);
- struct snd_interval *channels = hw_param_interval(params,
- SNDRV_PCM_HW_PARAM_CHANNELS);
- int rc = 0;
- int idx;
-
- pr_debug("%s: format = %d, rate = %d\n",
- __func__, params_format(params), params_rate(params));
-
- switch (dai_link->id) {
- case MSM_BACKEND_DAI_USB_RX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- usb_rx_cfg.bit_format);
- rate->min = rate->max = usb_rx_cfg.sample_rate;
- channels->min = channels->max = usb_rx_cfg.channels;
- break;
-
- case MSM_BACKEND_DAI_USB_TX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- usb_tx_cfg.bit_format);
- rate->min = rate->max = usb_tx_cfg.sample_rate;
- channels->min = channels->max = usb_tx_cfg.channels;
- break;
-
- case MSM_BACKEND_DAI_DISPLAY_PORT_RX:
- idx = msm_ext_disp_get_idx_from_beid(dai_link->id);
- if (idx < 0) {
- pr_err("%s: Incorrect ext disp idx %d\n",
- __func__, idx);
- rc = idx;
- break;
- }
-
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- ext_disp_rx_cfg[idx].bit_format);
- rate->min = rate->max = ext_disp_rx_cfg[idx].sample_rate;
- channels->min = channels->max = ext_disp_rx_cfg[idx].channels;
- break;
-
- case MSM_BACKEND_DAI_AFE_PCM_RX:
- channels->min = channels->max = proxy_rx_cfg.channels;
- rate->min = rate->max = SAMPLING_RATE_48KHZ;
- break;
-
- case MSM_BACKEND_DAI_PRI_TDM_RX_0:
- channels->min = channels->max =
- tdm_rx_cfg[TDM_PRI][TDM_0].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- tdm_rx_cfg[TDM_PRI][TDM_0].bit_format);
- rate->min = rate->max = tdm_rx_cfg[TDM_PRI][TDM_0].sample_rate;
- break;
-
- case MSM_BACKEND_DAI_PRI_TDM_TX_0:
- channels->min = channels->max =
- tdm_tx_cfg[TDM_PRI][TDM_0].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- tdm_tx_cfg[TDM_PRI][TDM_0].bit_format);
- rate->min = rate->max = tdm_tx_cfg[TDM_PRI][TDM_0].sample_rate;
- break;
-
- case MSM_BACKEND_DAI_SEC_TDM_RX_0:
- channels->min = channels->max =
- tdm_rx_cfg[TDM_SEC][TDM_0].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- tdm_rx_cfg[TDM_SEC][TDM_0].bit_format);
- rate->min = rate->max = tdm_rx_cfg[TDM_SEC][TDM_0].sample_rate;
- break;
-
- case MSM_BACKEND_DAI_SEC_TDM_TX_0:
- channels->min = channels->max =
- tdm_tx_cfg[TDM_SEC][TDM_0].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- tdm_tx_cfg[TDM_SEC][TDM_0].bit_format);
- rate->min = rate->max = tdm_tx_cfg[TDM_SEC][TDM_0].sample_rate;
- break;
-
- case MSM_BACKEND_DAI_TERT_TDM_RX_0:
- channels->min = channels->max =
- tdm_rx_cfg[TDM_TERT][TDM_0].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- tdm_rx_cfg[TDM_TERT][TDM_0].bit_format);
- rate->min = rate->max = tdm_rx_cfg[TDM_TERT][TDM_0].sample_rate;
- break;
-
- case MSM_BACKEND_DAI_TERT_TDM_TX_0:
- channels->min = channels->max =
- tdm_tx_cfg[TDM_TERT][TDM_0].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- tdm_tx_cfg[TDM_TERT][TDM_0].bit_format);
- rate->min = rate->max = tdm_tx_cfg[TDM_TERT][TDM_0].sample_rate;
- break;
-
- case MSM_BACKEND_DAI_QUAT_TDM_RX_0:
- channels->min = channels->max =
- tdm_rx_cfg[TDM_QUAT][TDM_0].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- tdm_rx_cfg[TDM_QUAT][TDM_0].bit_format);
- rate->min = rate->max = tdm_rx_cfg[TDM_QUAT][TDM_0].sample_rate;
- break;
-
- case MSM_BACKEND_DAI_QUAT_TDM_TX_0:
- channels->min = channels->max =
- tdm_tx_cfg[TDM_QUAT][TDM_0].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- tdm_tx_cfg[TDM_QUAT][TDM_0].bit_format);
- rate->min = rate->max = tdm_tx_cfg[TDM_QUAT][TDM_0].sample_rate;
- break;
-
- case MSM_BACKEND_DAI_QUIN_TDM_RX_0:
- channels->min = channels->max =
- tdm_rx_cfg[TDM_QUIN][TDM_0].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- tdm_rx_cfg[TDM_QUIN][TDM_0].bit_format);
- rate->min = rate->max = tdm_rx_cfg[TDM_QUIN][TDM_0].sample_rate;
- break;
-
- case MSM_BACKEND_DAI_QUIN_TDM_TX_0:
- channels->min = channels->max =
- tdm_tx_cfg[TDM_QUIN][TDM_0].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- tdm_tx_cfg[TDM_QUIN][TDM_0].bit_format);
- rate->min = rate->max = tdm_tx_cfg[TDM_QUIN][TDM_0].sample_rate;
- break;
-
- case MSM_BACKEND_DAI_AUXPCM_RX:
- rate->min = rate->max =
- aux_pcm_rx_cfg[PRIM_AUX_PCM].sample_rate;
- channels->min = channels->max =
- aux_pcm_rx_cfg[PRIM_AUX_PCM].channels;
- break;
-
- case MSM_BACKEND_DAI_AUXPCM_TX:
- rate->min = rate->max =
- aux_pcm_tx_cfg[PRIM_AUX_PCM].sample_rate;
- channels->min = channels->max =
- aux_pcm_tx_cfg[PRIM_AUX_PCM].channels;
- break;
-
- case MSM_BACKEND_DAI_SEC_AUXPCM_RX:
- rate->min = rate->max =
- aux_pcm_rx_cfg[SEC_AUX_PCM].sample_rate;
- channels->min = channels->max =
- aux_pcm_rx_cfg[SEC_AUX_PCM].channels;
- break;
-
- case MSM_BACKEND_DAI_SEC_AUXPCM_TX:
- rate->min = rate->max =
- aux_pcm_tx_cfg[SEC_AUX_PCM].sample_rate;
- channels->min = channels->max =
- aux_pcm_tx_cfg[SEC_AUX_PCM].channels;
- break;
-
- case MSM_BACKEND_DAI_TERT_AUXPCM_RX:
- rate->min = rate->max =
- aux_pcm_rx_cfg[TERT_AUX_PCM].sample_rate;
- channels->min = channels->max =
- aux_pcm_rx_cfg[TERT_AUX_PCM].channels;
- break;
-
- case MSM_BACKEND_DAI_TERT_AUXPCM_TX:
- rate->min = rate->max =
- aux_pcm_tx_cfg[TERT_AUX_PCM].sample_rate;
- channels->min = channels->max =
- aux_pcm_tx_cfg[TERT_AUX_PCM].channels;
- break;
-
- case MSM_BACKEND_DAI_QUAT_AUXPCM_RX:
- rate->min = rate->max =
- aux_pcm_rx_cfg[QUAT_AUX_PCM].sample_rate;
- channels->min = channels->max =
- aux_pcm_rx_cfg[QUAT_AUX_PCM].channels;
- break;
-
- case MSM_BACKEND_DAI_QUAT_AUXPCM_TX:
- rate->min = rate->max =
- aux_pcm_tx_cfg[QUAT_AUX_PCM].sample_rate;
- channels->min = channels->max =
- aux_pcm_tx_cfg[QUAT_AUX_PCM].channels;
- break;
-
- case MSM_BACKEND_DAI_QUIN_AUXPCM_RX:
- rate->min = rate->max =
- aux_pcm_rx_cfg[QUIN_AUX_PCM].sample_rate;
- channels->min = channels->max =
- aux_pcm_rx_cfg[QUIN_AUX_PCM].channels;
- break;
-
- case MSM_BACKEND_DAI_QUIN_AUXPCM_TX:
- rate->min = rate->max =
- aux_pcm_tx_cfg[QUIN_AUX_PCM].sample_rate;
- channels->min = channels->max =
- aux_pcm_tx_cfg[QUIN_AUX_PCM].channels;
- break;
-
- case MSM_BACKEND_DAI_PRI_MI2S_RX:
- rate->min = rate->max = mi2s_rx_cfg[PRIM_MI2S].sample_rate;
- channels->min = channels->max =
- mi2s_rx_cfg[PRIM_MI2S].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- mi2s_rx_cfg[PRIM_MI2S].bit_format);
- break;
-
- case MSM_BACKEND_DAI_PRI_MI2S_TX:
- rate->min = rate->max = mi2s_tx_cfg[PRIM_MI2S].sample_rate;
- channels->min = channels->max =
- mi2s_tx_cfg[PRIM_MI2S].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- mi2s_tx_cfg[PRIM_MI2S].bit_format);
- break;
-
- case MSM_BACKEND_DAI_SECONDARY_MI2S_RX:
- rate->min = rate->max = mi2s_rx_cfg[SEC_MI2S].sample_rate;
- channels->min = channels->max =
- mi2s_rx_cfg[SEC_MI2S].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- mi2s_rx_cfg[SEC_MI2S].bit_format);
- break;
-
- case MSM_BACKEND_DAI_SECONDARY_MI2S_TX:
- rate->min = rate->max = mi2s_tx_cfg[SEC_MI2S].sample_rate;
- channels->min = channels->max =
- mi2s_tx_cfg[SEC_MI2S].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- mi2s_tx_cfg[SEC_MI2S].bit_format);
- break;
-
- case MSM_BACKEND_DAI_TERTIARY_MI2S_RX:
- rate->min = rate->max = mi2s_rx_cfg[TERT_MI2S].sample_rate;
- channels->min = channels->max =
- mi2s_rx_cfg[TERT_MI2S].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- mi2s_rx_cfg[TERT_MI2S].bit_format);
- break;
-
- case MSM_BACKEND_DAI_TERTIARY_MI2S_TX:
- rate->min = rate->max = mi2s_tx_cfg[TERT_MI2S].sample_rate;
- channels->min = channels->max =
- mi2s_tx_cfg[TERT_MI2S].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- mi2s_tx_cfg[TERT_MI2S].bit_format);
- break;
-
- case MSM_BACKEND_DAI_QUATERNARY_MI2S_RX:
- rate->min = rate->max = mi2s_rx_cfg[QUAT_MI2S].sample_rate;
- channels->min = channels->max =
- mi2s_rx_cfg[QUAT_MI2S].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- mi2s_rx_cfg[QUAT_MI2S].bit_format);
- break;
-
- case MSM_BACKEND_DAI_QUATERNARY_MI2S_TX:
- rate->min = rate->max = mi2s_tx_cfg[QUAT_MI2S].sample_rate;
- channels->min = channels->max =
- mi2s_tx_cfg[QUAT_MI2S].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- mi2s_tx_cfg[QUAT_MI2S].bit_format);
- break;
-
- case MSM_BACKEND_DAI_QUINARY_MI2S_RX:
- rate->min = rate->max = mi2s_rx_cfg[QUIN_MI2S].sample_rate;
- channels->min = channels->max =
- mi2s_rx_cfg[QUIN_MI2S].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- mi2s_rx_cfg[QUIN_MI2S].bit_format);
- break;
-
- case MSM_BACKEND_DAI_QUINARY_MI2S_TX:
- rate->min = rate->max = mi2s_tx_cfg[QUIN_MI2S].sample_rate;
- channels->min = channels->max =
- mi2s_tx_cfg[QUIN_MI2S].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- mi2s_tx_cfg[QUIN_MI2S].bit_format);
- break;
-
- default:
- rate->min = rate->max = SAMPLING_RATE_48KHZ;
- break;
- }
- return rc;
-}
-EXPORT_SYMBOL(msm_common_be_hw_params_fixup);
-
-/**
- * msm_aux_pcm_snd_startup - startup ops of auxpcm.
- *
- * @substream: PCM stream pointer of associated backend dailink
- *
- * Returns 0 on success or -EINVAL on error.
- */
-int msm_aux_pcm_snd_startup(struct snd_pcm_substream *substream)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
-
- dev_dbg(rtd->card->dev,
- "%s: substream = %s stream = %d, dai name %s, dai ID %d\n",
- __func__, substream->name, substream->stream,
- rtd->cpu_dai->name, rtd->cpu_dai->id);
-
- return 0;
-}
-EXPORT_SYMBOL(msm_aux_pcm_snd_startup);
-
-/**
- * msm_aux_pcm_snd_shutdown - shutdown ops of auxpcm.
- *
- * @substream: PCM stream pointer of associated backend dailink
- */
-void msm_aux_pcm_snd_shutdown(struct snd_pcm_substream *substream)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
-
- dev_dbg(rtd->card->dev,
- "%s: substream = %s stream = %d, dai name %s, dai ID %d\n",
- __func__,
- substream->name, substream->stream,
- rtd->cpu_dai->name, rtd->cpu_dai->id);
-}
-EXPORT_SYMBOL(msm_aux_pcm_snd_shutdown);
-
-static int msm_get_port_id(int id)
-{
- int afe_port_id;
-
- switch (id) {
- case MSM_BACKEND_DAI_PRI_MI2S_RX:
- afe_port_id = AFE_PORT_ID_PRIMARY_MI2S_RX;
- break;
- case MSM_BACKEND_DAI_PRI_MI2S_TX:
- afe_port_id = AFE_PORT_ID_PRIMARY_MI2S_TX;
- break;
- case MSM_BACKEND_DAI_SECONDARY_MI2S_RX:
- afe_port_id = AFE_PORT_ID_SECONDARY_MI2S_RX;
- break;
- case MSM_BACKEND_DAI_SECONDARY_MI2S_TX:
- afe_port_id = AFE_PORT_ID_SECONDARY_MI2S_TX;
- break;
- case MSM_BACKEND_DAI_TERTIARY_MI2S_RX:
- afe_port_id = AFE_PORT_ID_TERTIARY_MI2S_RX;
- break;
- case MSM_BACKEND_DAI_TERTIARY_MI2S_TX:
- afe_port_id = AFE_PORT_ID_TERTIARY_MI2S_TX;
- break;
- case MSM_BACKEND_DAI_QUATERNARY_MI2S_RX:
- afe_port_id = AFE_PORT_ID_QUATERNARY_MI2S_RX;
- break;
- case MSM_BACKEND_DAI_QUATERNARY_MI2S_TX:
- afe_port_id = AFE_PORT_ID_QUATERNARY_MI2S_TX;
- break;
- case MSM_BACKEND_DAI_QUINARY_MI2S_RX:
- afe_port_id = AFE_PORT_ID_QUINARY_MI2S_RX;
- break;
- case MSM_BACKEND_DAI_QUINARY_MI2S_TX:
- afe_port_id = AFE_PORT_ID_QUINARY_MI2S_TX;
- break;
- default:
- pr_err("%s: Invalid id: %d\n", __func__, id);
- afe_port_id = -EINVAL;
- }
-
- return afe_port_id;
-}
-
-static u32 get_mi2s_bits_per_sample(u32 bit_format)
-{
- u32 bit_per_sample;
-
- switch (bit_format) {
- case SNDRV_PCM_FORMAT_S32_LE:
- case SNDRV_PCM_FORMAT_S24_3LE:
- case SNDRV_PCM_FORMAT_S24_LE:
- bit_per_sample = 32;
- break;
- case SNDRV_PCM_FORMAT_S16_LE:
- default:
- bit_per_sample = 16;
- break;
- }
-
- return bit_per_sample;
-}
-
-static void update_mi2s_clk_val(int dai_id, int stream)
-{
- u32 bit_per_sample;
-
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
- bit_per_sample =
- get_mi2s_bits_per_sample(mi2s_rx_cfg[dai_id].bit_format);
- mi2s_clk[dai_id].clk_freq_in_hz =
- mi2s_rx_cfg[dai_id].sample_rate * 2 * bit_per_sample;
- } else {
- bit_per_sample =
- get_mi2s_bits_per_sample(mi2s_tx_cfg[dai_id].bit_format);
- mi2s_clk[dai_id].clk_freq_in_hz =
- mi2s_tx_cfg[dai_id].sample_rate * 2 * bit_per_sample;
- }
-}
-
-static int msm_mi2s_set_sclk(struct snd_pcm_substream *substream, bool enable)
-{
- int ret = 0;
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- int port_id = 0;
- int index = cpu_dai->id;
-
- port_id = msm_get_port_id(rtd->dai_link->id);
- if (port_id < 0) {
- dev_err(rtd->card->dev, "%s: Invalid port_id\n", __func__);
- ret = port_id;
- goto done;
- }
-
- if (enable) {
- update_mi2s_clk_val(index, substream->stream);
- dev_dbg(rtd->card->dev, "%s: clock rate %ul\n", __func__,
- mi2s_clk[index].clk_freq_in_hz);
- }
-
- mi2s_clk[index].enable = enable;
- ret = afe_set_lpass_clock_v2(port_id,
- &mi2s_clk[index]);
- if (ret < 0) {
- dev_err(rtd->card->dev,
- "%s: afe lpass clock failed for port 0x%x , err:%d\n",
- __func__, port_id, ret);
- goto done;
- }
-
-done:
- return ret;
-}
-
-/**
- * msm_mi2s_snd_startup - startup ops of mi2s.
- *
- * @substream: PCM stream pointer of associated backend dailink
- *
- * Returns 0 on success or -EINVAL on error.
- */
-int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
-{
- int ret = 0;
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- int port_id = msm_get_port_id(rtd->dai_link->id);
- int index = cpu_dai->id;
- unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS;
- struct msm_asoc_mach_data *pdata =
- snd_soc_card_get_drvdata(rtd->card);
-
- dev_dbg(rtd->card->dev,
- "%s: substream = %s stream = %d, dai name %s, dai ID %d\n",
- __func__, substream->name, substream->stream,
- cpu_dai->name, cpu_dai->id);
-
- if (index < PRIM_MI2S || index >= MI2S_MAX) {
- ret = -EINVAL;
- dev_err(rtd->card->dev,
- "%s: CPU DAI id (%d) out of range\n",
- __func__, cpu_dai->id);
- goto done;
- }
- /*
- * Muxtex protection in case the same MI2S
- * interface using for both TX and RX so
- * that the same clock won't be enable twice.
- */
- mutex_lock(&mi2s_intf_conf[index].lock);
- if (++mi2s_intf_conf[index].ref_cnt == 1) {
- /* Check if msm needs to provide the clock to the interface */
- if (!mi2s_intf_conf[index].msm_is_mi2s_master) {
- mi2s_clk[index].clk_id = mi2s_ebit_clk[index];
- fmt = SND_SOC_DAIFMT_CBM_CFM;
- }
- ret = msm_mi2s_set_sclk(substream, true);
- if (ret < 0) {
- dev_err(rtd->card->dev,
- "%s: afe lpass clock failed to enable MI2S clock, err:%d\n",
- __func__, ret);
- goto clean_up;
- }
- ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
- if (ret < 0) {
- dev_err(rtd->card->dev,
- "%s: set fmt cpu dai failed for MI2S (%d), err:%d\n",
- __func__, index, ret);
- goto clk_off;
- }
- if (mi2s_intf_conf[index].msm_is_ext_mclk) {
- mi2s_mclk[index].enable = 1;
- pr_debug("%s: Enabling mclk, clk_freq_in_hz = %u\n",
- __func__, mi2s_mclk[index].clk_freq_in_hz);
- ret = afe_set_lpass_clock_v2(port_id,
- &mi2s_mclk[index]);
- if (ret < 0) {
- pr_err("%s: afe lpass mclk failed, err:%d\n",
- __func__, ret);
- goto clk_off;
- }
- }
- if (pdata->mi2s_gpio_p[index])
- msm_cdc_pinctrl_select_active_state(
- pdata->mi2s_gpio_p[index]);
- }
- mutex_unlock(&mi2s_intf_conf[index].lock);
- return 0;
-clk_off:
- if (ret < 0)
- msm_mi2s_set_sclk(substream, false);
-clean_up:
- if (ret < 0)
- mi2s_intf_conf[index].ref_cnt--;
- mutex_unlock(&mi2s_intf_conf[index].lock);
-done:
- return ret;
-}
-EXPORT_SYMBOL(msm_mi2s_snd_startup);
-
-/**
- * msm_mi2s_snd_shutdown - shutdown ops of mi2s.
- *
- * @substream: PCM stream pointer of associated backend dailink
- */
-void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream)
-{
- int ret;
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- int port_id = msm_get_port_id(rtd->dai_link->id);
- int index = rtd->cpu_dai->id;
- struct msm_asoc_mach_data *pdata =
- snd_soc_card_get_drvdata(rtd->card);
-
- pr_debug("%s(): substream = %s stream = %d\n", __func__,
- substream->name, substream->stream);
- if (index < PRIM_MI2S || index >= MI2S_MAX) {
- pr_err("%s:invalid MI2S DAI(%d)\n", __func__, index);
- return;
- }
-
- mutex_lock(&mi2s_intf_conf[index].lock);
- if (--mi2s_intf_conf[index].ref_cnt == 0) {
- if (pdata->mi2s_gpio_p[index])
- msm_cdc_pinctrl_select_sleep_state(
- pdata->mi2s_gpio_p[index]);
-
- ret = msm_mi2s_set_sclk(substream, false);
- if (ret < 0)
- pr_err("%s:clock disable failed for MI2S (%d); ret=%d\n",
- __func__, index, ret);
-
- if (mi2s_intf_conf[index].msm_is_ext_mclk) {
- mi2s_mclk[index].enable = 0;
- pr_debug("%s: Disabling mclk, clk_freq_in_hz = %u\n",
- __func__, mi2s_mclk[index].clk_freq_in_hz);
- ret = afe_set_lpass_clock_v2(port_id,
- &mi2s_mclk[index]);
- if (ret < 0) {
- pr_err("%s: mclk disable failed for MCLK (%d); ret=%d\n",
- __func__, index, ret);
- }
- }
- }
- mutex_unlock(&mi2s_intf_conf[index].lock);
-}
-EXPORT_SYMBOL(msm_mi2s_snd_shutdown);
-
-/* Validate whether US EU switch is present or not */
-static int msm_prepare_us_euro(struct snd_soc_card *card)
-{
- struct msm_asoc_mach_data *pdata =
- snd_soc_card_get_drvdata(card);
- int ret = 0;
-
- if (pdata->us_euro_gpio >= 0) {
- dev_dbg(card->dev, "%s: us_euro gpio request %d", __func__,
- pdata->us_euro_gpio);
- ret = gpio_request(pdata->us_euro_gpio, "TASHA_CODEC_US_EURO");
- if (ret) {
- dev_err(card->dev,
- "%s: Failed to request codec US/EURO gpio %d error %d\n",
- __func__, pdata->us_euro_gpio, ret);
- }
- }
-
- return ret;
-}
-
-
-static bool msm_usbc_swap_gnd_mic(struct snd_soc_codec *codec, bool active)
-{
- int value = 0;
- bool ret = false;
- struct snd_soc_card *card = codec->component.card;
- struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
- struct pinctrl_state *en2_pinctrl_active;
- struct pinctrl_state *en2_pinctrl_sleep;
-
- if (!pdata->usbc_en2_gpio_p) {
- if (active) {
- /* if active and usbc_en2_gpio undefined, get pin */
- pdata->usbc_en2_gpio_p = devm_pinctrl_get(card->dev);
- if (IS_ERR_OR_NULL(pdata->usbc_en2_gpio_p)) {
- dev_err(card->dev,
- "%s: Can't get EN2 gpio pinctrl:%ld\n",
- __func__,
- PTR_ERR(pdata->usbc_en2_gpio_p));
- pdata->usbc_en2_gpio_p = NULL;
- return false;
- }
- } else {
- /* if not active and usbc_en2_gpio undefined, return */
- return false;
- }
- }
-
- pdata->usbc_en2_gpio = of_get_named_gpio(card->dev->of_node,
- "qcom,usbc-analog-en2-gpio", 0);
- if (!gpio_is_valid(pdata->usbc_en2_gpio)) {
- dev_err(card->dev, "%s, property %s not in node %s\n",
- __func__, "qcom,usbc-analog-en2-gpio",
- card->dev->of_node->full_name);
- return false;
- }
-
- en2_pinctrl_active = pinctrl_lookup_state(
- pdata->usbc_en2_gpio_p, "aud_active");
- if (IS_ERR_OR_NULL(en2_pinctrl_active)) {
- dev_err(card->dev,
- "%s: Cannot get aud_active pinctrl state:%ld\n",
- __func__, PTR_ERR(en2_pinctrl_active));
- ret = false;
- goto err_lookup_state;
- }
-
- en2_pinctrl_sleep = pinctrl_lookup_state(
- pdata->usbc_en2_gpio_p, "aud_sleep");
- if (IS_ERR_OR_NULL(en2_pinctrl_sleep)) {
- dev_err(card->dev,
- "%s: Cannot get aud_sleep pinctrl state:%ld\n",
- __func__, PTR_ERR(en2_pinctrl_sleep));
- ret = false;
- goto err_lookup_state;
- }
-
- /* if active and usbc_en2_gpio_p defined, swap using usbc_en2_gpio_p */
- if (active) {
- dev_dbg(codec->dev, "%s: enter\n", __func__);
- if (pdata->usbc_en2_gpio_p) {
- value = gpio_get_value_cansleep(pdata->usbc_en2_gpio);
- if (value)
- pinctrl_select_state(pdata->usbc_en2_gpio_p,
- en2_pinctrl_sleep);
- else
- pinctrl_select_state(pdata->usbc_en2_gpio_p,
- en2_pinctrl_active);
- } else if (pdata->usbc_en2_gpio >= 0) {
- value = gpio_get_value_cansleep(pdata->usbc_en2_gpio);
- gpio_set_value_cansleep(pdata->usbc_en2_gpio, !value);
- }
- pr_debug("%s: swap select switch %d to %d\n", __func__,
- value, !value);
- ret = true;
- } else {
- /* if not active, release usbc_en2_gpio_p pin */
- pinctrl_select_state(pdata->usbc_en2_gpio_p,
- en2_pinctrl_sleep);
- }
-
-err_lookup_state:
- devm_pinctrl_put(pdata->usbc_en2_gpio_p);
- pdata->usbc_en2_gpio_p = NULL;
- return ret;
-}
-
-static bool msm_swap_gnd_mic(struct snd_soc_codec *codec, bool active)
-{
- struct snd_soc_card *card = codec->component.card;
- struct msm_asoc_mach_data *pdata =
- snd_soc_card_get_drvdata(card);
- int value = 0;
- bool ret = 0;
-
- if (!mbhc_cfg.enable_usbc_analog) {
- if (pdata->us_euro_gpio_p) {
- value = msm_cdc_pinctrl_get_state(
- pdata->us_euro_gpio_p);
- if (value)
- msm_cdc_pinctrl_select_sleep_state(
- pdata->us_euro_gpio_p);
- else
- msm_cdc_pinctrl_select_active_state(
- pdata->us_euro_gpio_p);
- } else if (pdata->us_euro_gpio >= 0) {
- value = gpio_get_value_cansleep(pdata->us_euro_gpio);
- gpio_set_value_cansleep(pdata->us_euro_gpio, !value);
- }
- pr_debug("%s: swap select switch %d to %d\n",
- __func__, value, !value);
- ret = true;
- } else {
- /* if usbc is defined, swap using usbc_en2 */
- ret = msm_usbc_swap_gnd_mic(codec, active);
- }
- return ret;
-}
-
-static int msm_populate_dai_link_component_of_node(
- struct msm_asoc_mach_data *pdata,
- struct snd_soc_card *card)
-{
- int i, index, ret = 0;
- struct device *cdev = card->dev;
- struct snd_soc_dai_link *dai_link = card->dai_link;
- struct device_node *phandle;
-
- if (!cdev) {
- pr_err("%s: Sound card device memory NULL\n", __func__);
- return -ENODEV;
- }
-
- for (i = 0; i < card->num_links; i++) {
- if (dai_link[i].platform_of_node && dai_link[i].cpu_of_node)
- continue;
-
- /* populate platform_of_node for snd card dai links */
- if (dai_link[i].platform_name &&
- !dai_link[i].platform_of_node) {
- index = of_property_match_string(cdev->of_node,
- "asoc-platform-names",
- dai_link[i].platform_name);
- if (index < 0) {
- pr_err("%s: No match found for platform name: %s\n",
- __func__, dai_link[i].platform_name);
- ret = index;
- goto cpu_dai;
- }
- phandle = of_parse_phandle(cdev->of_node,
- "asoc-platform",
- index);
- if (!phandle) {
- pr_err("%s: retrieving phandle for platform %s, index %d failed\n",
- __func__, dai_link[i].platform_name,
- index);
- ret = -ENODEV;
- goto err;
- }
- dai_link[i].platform_of_node = phandle;
- dai_link[i].platform_name = NULL;
- }
-cpu_dai:
- /* populate cpu_of_node for snd card dai links */
- if (dai_link[i].cpu_dai_name && !dai_link[i].cpu_of_node) {
- index = of_property_match_string(cdev->of_node,
- "asoc-cpu-names",
- dai_link[i].cpu_dai_name);
- if (index < 0)
- goto codec_dai;
- phandle = of_parse_phandle(cdev->of_node, "asoc-cpu",
- index);
- if (!phandle) {
- pr_err("%s: retrieving phandle for cpu dai %s failed\n",
- __func__, dai_link[i].cpu_dai_name);
- ret = -ENODEV;
- goto err;
- }
- dai_link[i].cpu_of_node = phandle;
- dai_link[i].cpu_dai_name = NULL;
- }
-codec_dai:
- /* populate codec_of_node for snd card dai links */
- if (dai_link[i].codec_name && !dai_link[i].codec_of_node) {
- index = of_property_match_string(cdev->of_node,
- "asoc-codec-names",
- dai_link[i].codec_name);
- if (index < 0)
- continue;
- phandle = of_parse_phandle(cdev->of_node, "asoc-codec",
- index);
- if (!phandle) {
- pr_err("%s: retrieving phandle for codec dai %s failed\n",
- __func__, dai_link[i].codec_name);
- ret = -ENODEV;
- goto err;
- }
- dai_link[i].codec_of_node = phandle;
- dai_link[i].codec_name = NULL;
- }
- if (pdata->snd_card_val == INT_SND_CARD) {
- if ((dai_link[i].id ==
- MSM_BACKEND_DAI_INT0_MI2S_RX) ||
- (dai_link[i].id ==
- MSM_BACKEND_DAI_INT1_MI2S_RX) ||
- (dai_link[i].id ==
- MSM_BACKEND_DAI_INT2_MI2S_TX) ||
- (dai_link[i].id ==
- MSM_BACKEND_DAI_INT3_MI2S_TX)) {
- index = of_property_match_string(cdev->of_node,
- "asoc-codec-names",
- MSM_INT_DIGITAL_CODEC);
- phandle = of_parse_phandle(cdev->of_node,
- "asoc-codec",
- index);
- dai_link[i].codecs[DIG_CDC].of_node = phandle;
- index = of_property_match_string(cdev->of_node,
- "asoc-codec-names",
- PMIC_INT_ANALOG_CODEC);
- phandle = of_parse_phandle(cdev->of_node,
- "asoc-codec",
- index);
- dai_link[i].codecs[ANA_CDC].of_node = phandle;
- }
- }
- }
-err:
- return ret;
-}
-
-static int msm_wsa881x_init(struct snd_soc_component *component)
-{
- u8 spkleft_ports[WSA881X_MAX_SWR_PORTS] = {100, 101, 102, 106};
- u8 spkright_ports[WSA881X_MAX_SWR_PORTS] = {103, 104, 105, 107};
- unsigned int ch_rate[WSA881X_MAX_SWR_PORTS] = {2400, 600, 300, 1200};
- unsigned int ch_mask[WSA881X_MAX_SWR_PORTS] = {0x1, 0xF, 0x3, 0x3};
- struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
- struct msm_asoc_mach_data *pdata;
- struct snd_soc_dapm_context *dapm =
- snd_soc_codec_get_dapm(codec);
-
- if (!codec) {
- pr_err("%s codec is NULL\n", __func__);
- return -EINVAL;
- }
-
- if (!strcmp(component->name_prefix, "SpkrLeft")) {
- dev_dbg(codec->dev, "%s: setting left ch map to codec %s\n",
- __func__, codec->component.name);
- wsa881x_set_channel_map(codec, &spkleft_ports[0],
- WSA881X_MAX_SWR_PORTS, &ch_mask[0],
- &ch_rate[0], NULL);
- if (dapm->component) {
- snd_soc_dapm_ignore_suspend(dapm, "SpkrLeft IN");
- snd_soc_dapm_ignore_suspend(dapm, "SpkrLeft SPKR");
- }
- } else if (!strcmp(component->name_prefix, "SpkrRight")) {
- dev_dbg(codec->dev, "%s: setting right ch map to codec %s\n",
- __func__, codec->component.name);
- wsa881x_set_channel_map(codec, &spkright_ports[0],
- WSA881X_MAX_SWR_PORTS, &ch_mask[0],
- &ch_rate[0], NULL);
- if (dapm->component) {
- snd_soc_dapm_ignore_suspend(dapm, "SpkrRight IN");
- snd_soc_dapm_ignore_suspend(dapm, "SpkrRight SPKR");
- }
- } else {
- dev_err(codec->dev, "%s: wrong codec name %s\n", __func__,
- codec->component.name);
- return -EINVAL;
- }
-
-
- pdata = snd_soc_card_get_drvdata(component->card);
- if (pdata && pdata->codec_root)
- wsa881x_codec_info_create_codec_entry(pdata->codec_root,
- codec);
- return 0;
-}
-
-
-static int msm_init_wsa_dev(struct platform_device *pdev,
- struct snd_soc_card *card)
-{
- struct device_node *wsa_of_node;
- u32 wsa_max_devs;
- u32 wsa_dev_cnt;
- char *dev_name_str = NULL;
- struct msm_wsa881x_dev_info *wsa881x_dev_info;
- const char *wsa_auxdev_name_prefix[1];
- int found = 0;
- int i;
- int ret;
-
- /* Get maximum WSA device count for this platform */
- ret = of_property_read_u32(pdev->dev.of_node,
- "qcom,wsa-max-devs", &wsa_max_devs);
- if (ret) {
- dev_dbg(&pdev->dev,
- "%s: wsa-max-devs property missing in DT %s, ret = %d\n",
- __func__, pdev->dev.of_node->full_name, ret);
- goto err_dt;
- }
- if (wsa_max_devs == 0) {
- dev_warn(&pdev->dev,
- "%s: Max WSA devices is 0 for this target?\n",
- __func__);
- goto err_dt;
- }
-
- /* Get count of WSA device phandles for this platform */
- wsa_dev_cnt = of_count_phandle_with_args(pdev->dev.of_node,
- "qcom,wsa-devs", NULL);
- if (wsa_dev_cnt == -ENOENT) {
- dev_warn(&pdev->dev, "%s: No wsa device defined in DT.\n",
- __func__);
- goto err_dt;
- } else if (wsa_dev_cnt <= 0) {
- dev_err(&pdev->dev,
- "%s: Error reading wsa device from DT. wsa_dev_cnt = %d\n",
- __func__, wsa_dev_cnt);
- ret = -EINVAL;
- goto err_dt;
- }
-
- /*
- * Expect total phandles count to be NOT less than maximum possible
- * WSA count. However, if it is less, then assign same value to
- * max count as well.
- */
- if (wsa_dev_cnt < wsa_max_devs) {
- dev_dbg(&pdev->dev,
- "%s: wsa_max_devs = %d cannot exceed wsa_dev_cnt = %d\n",
- __func__, wsa_max_devs, wsa_dev_cnt);
- wsa_max_devs = wsa_dev_cnt;
- }
-
- /* Make sure prefix string passed for each WSA device */
- ret = of_property_count_strings(pdev->dev.of_node,
- "qcom,wsa-aux-dev-prefix");
- if (ret != wsa_dev_cnt) {
- dev_err(&pdev->dev,
- "%s: expecting %d wsa prefix. Defined only %d in DT\n",
- __func__, wsa_dev_cnt, ret);
- ret = -EINVAL;
- goto err_dt;
- }
-
- /*
- * Alloc mem to store phandle and index info of WSA device, if already
- * registered with ALSA core
- */
- wsa881x_dev_info = devm_kcalloc(&pdev->dev, wsa_max_devs,
- sizeof(struct msm_wsa881x_dev_info),
- GFP_KERNEL);
- if (!wsa881x_dev_info) {
- ret = -ENOMEM;
- goto err_mem;
- }
-
- /*
- * search and check whether all WSA devices are already
- * registered with ALSA core or not. If found a node, store
- * the node and the index in a local array of struct for later
- * use.
- */
- for (i = 0; i < wsa_dev_cnt; i++) {
- wsa_of_node = of_parse_phandle(pdev->dev.of_node,
- "qcom,wsa-devs", i);
- if (unlikely(!wsa_of_node)) {
- /* we should not be here */
- dev_err(&pdev->dev,
- "%s: wsa dev node is not present\n",
- __func__);
- ret = -EINVAL;
- goto err_dev_node;
- }
- if (soc_find_component(wsa_of_node, NULL)) {
- /* WSA device registered with ALSA core */
- wsa881x_dev_info[found].of_node = wsa_of_node;
- wsa881x_dev_info[found].index = i;
- found++;
- if (found == wsa_max_devs)
- break;
- }
- }
-
- if (found < wsa_max_devs) {
- dev_dbg(&pdev->dev,
- "%s: failed to find %d components. Found only %d\n",
- __func__, wsa_max_devs, found);
- return -EPROBE_DEFER;
- }
- dev_info(&pdev->dev,
- "%s: found %d wsa881x devices registered with ALSA core\n",
- __func__, found);
-
- card->num_aux_devs = wsa_max_devs;
- card->num_configs = wsa_max_devs;
-
- /* Alloc array of AUX devs struct */
- msm_aux_dev = devm_kcalloc(&pdev->dev, card->num_aux_devs,
- sizeof(struct snd_soc_aux_dev),
- GFP_KERNEL);
- if (!msm_aux_dev) {
- ret = -ENOMEM;
- goto err_auxdev_mem;
- }
-
- /* Alloc array of codec conf struct */
- msm_codec_conf = devm_kcalloc(&pdev->dev, card->num_aux_devs,
- sizeof(struct snd_soc_codec_conf),
- GFP_KERNEL);
- if (!msm_codec_conf) {
- ret = -ENOMEM;
- goto err_codec_conf;
- }
-
- for (i = 0; i < card->num_aux_devs; i++) {
- dev_name_str = devm_kzalloc(&pdev->dev, DEV_NAME_STR_LEN,
- GFP_KERNEL);
- if (!dev_name_str) {
- ret = -ENOMEM;
- goto err_dev_str;
- }
-
- ret = of_property_read_string_index(pdev->dev.of_node,
- "qcom,wsa-aux-dev-prefix",
- wsa881x_dev_info[i].index,
- wsa_auxdev_name_prefix);
- if (ret) {
- dev_err(&pdev->dev,
- "%s: failed to read wsa aux dev prefix, ret = %d\n",
- __func__, ret);
- ret = -EINVAL;
- goto err_dt_prop;
- }
-
- snprintf(dev_name_str, strlen("wsa881x.%d"), "wsa881x.%d", i);
- msm_aux_dev[i].name = dev_name_str;
- msm_aux_dev[i].codec_name = NULL;
- msm_aux_dev[i].codec_of_node =
- wsa881x_dev_info[i].of_node;
- msm_aux_dev[i].init = msm_wsa881x_init;
- msm_codec_conf[i].dev_name = NULL;
- msm_codec_conf[i].name_prefix = wsa_auxdev_name_prefix[0];
- msm_codec_conf[i].of_node = wsa881x_dev_info[i].of_node;
- }
- card->codec_conf = msm_codec_conf;
- card->aux_dev = msm_aux_dev;
-
- return 0;
-
-err_dt_prop:
- devm_kfree(&pdev->dev, dev_name_str);
-err_dev_str:
- devm_kfree(&pdev->dev, msm_codec_conf);
-err_codec_conf:
- devm_kfree(&pdev->dev, msm_aux_dev);
-err_auxdev_mem:
-err_dev_node:
- devm_kfree(&pdev->dev, wsa881x_dev_info);
-err_mem:
-err_dt:
- return ret;
-}
-
-static void i2s_auxpcm_init(struct platform_device *pdev)
-{
- int count;
- u32 mi2s_master_slave[MI2S_MAX];
- u32 mi2s_ext_mclk[MI2S_MAX];
- int ret;
-
- for (count = 0; count < MI2S_MAX; count++) {
- mutex_init(&mi2s_intf_conf[count].lock);
- mi2s_intf_conf[count].ref_cnt = 0;
- }
-
- ret = of_property_read_u32_array(pdev->dev.of_node,
- "qcom,msm-mi2s-master",
- mi2s_master_slave, MI2S_MAX);
- if (ret) {
- dev_dbg(&pdev->dev, "%s: no qcom,msm-mi2s-master in DT node\n",
- __func__);
- } else {
- for (count = 0; count < MI2S_MAX; count++) {
- mi2s_intf_conf[count].msm_is_mi2s_master =
- mi2s_master_slave[count];
- }
- }
-
- ret = of_property_read_u32_array(pdev->dev.of_node,
- "qcom,msm-mi2s-ext-mclk",
- mi2s_ext_mclk, MI2S_MAX);
- if (ret) {
- dev_dbg(&pdev->dev, "%s: no qcom,msm-mi2s-ext-mclk in DT node\n",
- __func__);
- } else {
- for (count = 0; count < MI2S_MAX; count++)
- mi2s_intf_conf[count].msm_is_ext_mclk =
- mi2s_ext_mclk[count];
- }
-}
-
-static const struct of_device_id sdm660_asoc_machine_of_match[] = {
- { .compatible = "qcom,sdm660-asoc-snd",
- .data = "internal_codec"},
- { .compatible = "qcom,sdm660-asoc-snd-tasha",
- .data = "tasha_codec"},
- { .compatible = "qcom,sdm660-asoc-snd-tavil",
- .data = "tavil_codec"},
- { .compatible = "qcom,sdm670-asoc-snd",
- .data = "internal_codec"},
- { .compatible = "qcom,sdm670-asoc-snd-tasha",
- .data = "tasha_codec"},
- { .compatible = "qcom,sdm670-asoc-snd-tavil",
- .data = "tavil_codec"},
- {},
-};
-
-static int msm_asoc_machine_probe(struct platform_device *pdev)
-{
- struct snd_soc_card *card = NULL;
- struct msm_asoc_mach_data *pdata = NULL;
- const char *mclk = "qcom,msm-mclk-freq";
- int ret = -EINVAL, id;
- const struct of_device_id *match;
- const char *usb_c_dt = "qcom,msm-mbhc-usbc-audio-supported";
-
- pdata = devm_kzalloc(&pdev->dev,
- sizeof(struct msm_asoc_mach_data),
- GFP_KERNEL);
- if (!pdata)
- return -ENOMEM;
-
- msm_set_codec_reg_done(false);
- match = of_match_node(sdm660_asoc_machine_of_match,
- pdev->dev.of_node);
- if (!match)
- goto err;
-
- ret = of_property_read_u32(pdev->dev.of_node, mclk, &id);
- if (ret) {
- dev_err(&pdev->dev,
- "%s: missing %s in dt node\n", __func__, mclk);
- id = DEFAULT_MCLK_RATE;
- }
- pdata->mclk_freq = id;
-
- if (!strcmp(match->data, "tasha_codec") ||
- !strcmp(match->data, "tavil_codec")) {
- if (!strcmp(match->data, "tasha_codec"))
- pdata->snd_card_val = EXT_SND_CARD_TASHA;
- else
- pdata->snd_card_val = EXT_SND_CARD_TAVIL;
- ret = msm_ext_cdc_init(pdev, pdata, &card, &mbhc_cfg);
- if (ret)
- goto err;
- } else if (!strcmp(match->data, "internal_codec")) {
- pdata->snd_card_val = INT_SND_CARD;
- ret = msm_int_cdc_init(pdev, pdata, &card, &mbhc_cfg);
- if (ret)
- goto err;
- } else {
- dev_err(&pdev->dev,
- "%s: Not a matching DT sound node\n", __func__);
- goto err;
- }
- if (!card)
- goto err;
-
- if (pdata->snd_card_val == INT_SND_CARD) {
- /*reading the gpio configurations from dtsi file*/
- pdata->pdm_gpio_p = of_parse_phandle(pdev->dev.of_node,
- "qcom,cdc-pdm-gpios", 0);
- pdata->comp_gpio_p = of_parse_phandle(pdev->dev.of_node,
- "qcom,cdc-comp-gpios", 0);
- pdata->dmic_gpio_p = of_parse_phandle(pdev->dev.of_node,
- "qcom,cdc-dmic-gpios", 0);
- pdata->ext_spk_gpio_p = of_parse_phandle(pdev->dev.of_node,
- "qcom,cdc-ext-spk-gpios", 0);
- }
-
- pdata->mi2s_gpio_p[PRIM_MI2S] = of_parse_phandle(pdev->dev.of_node,
- "qcom,pri-mi2s-gpios", 0);
- pdata->mi2s_gpio_p[SEC_MI2S] = of_parse_phandle(pdev->dev.of_node,
- "qcom,sec-mi2s-gpios", 0);
- pdata->mi2s_gpio_p[TERT_MI2S] = of_parse_phandle(pdev->dev.of_node,
- "qcom,tert-mi2s-gpios", 0);
- pdata->mi2s_gpio_p[QUAT_MI2S] = of_parse_phandle(pdev->dev.of_node,
- "qcom,quat-mi2s-gpios", 0);
- pdata->mi2s_gpio_p[QUIN_MI2S] = of_parse_phandle(pdev->dev.of_node,
- "qcom,quin-mi2s-gpios", 0);
- /*
- * Parse US-Euro gpio info from DT. Report no error if us-euro
- * entry is not found in DT file as some targets do not support
- * US-Euro detection
- */
- pdata->us_euro_gpio = of_get_named_gpio(pdev->dev.of_node,
- "qcom,us-euro-gpios", 0);
- if (!gpio_is_valid(pdata->us_euro_gpio))
- pdata->us_euro_gpio_p = of_parse_phandle(pdev->dev.of_node,
- "qcom,us-euro-gpios", 0);
- if (!gpio_is_valid(pdata->us_euro_gpio) && (!pdata->us_euro_gpio_p)) {
- dev_dbg(&pdev->dev, "property %s not detected in node %s",
- "qcom,us-euro-gpios", pdev->dev.of_node->full_name);
- } else {
- dev_dbg(&pdev->dev, "%s detected",
- "qcom,us-euro-gpios");
- mbhc_cfg.swap_gnd_mic = msm_swap_gnd_mic;
- }
-
- if (of_find_property(pdev->dev.of_node, usb_c_dt, NULL))
- mbhc_cfg.swap_gnd_mic = msm_swap_gnd_mic;
-
- ret = msm_prepare_us_euro(card);
- if (ret)
- dev_dbg(&pdev->dev, "msm_prepare_us_euro failed (%d)\n",
- ret);
-
- i2s_auxpcm_init(pdev);
-
- ret = snd_soc_of_parse_audio_routing(card, "qcom,audio-routing");
- if (ret)
- goto err;
-
- ret = msm_populate_dai_link_component_of_node(pdata, card);
- if (ret) {
- ret = -EPROBE_DEFER;
- goto err;
- }
-
- if (!of_property_read_bool(pdev->dev.of_node, "qcom,wsa-disable")) {
- ret = msm_init_wsa_dev(pdev, card);
- if (ret)
- goto err;
- }
-
- ret = devm_snd_soc_register_card(&pdev->dev, card);
- if (ret == -EPROBE_DEFER) {
- if (codec_reg_done) {
- /*
- * return failure as EINVAL since other codec
- * registered sound card successfully.
- * This avoids any further probe calls.
- */
- ret = -EINVAL;
- }
- goto err;
- } else if (ret) {
- dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
- ret);
- goto err;
- }
- if (pdata->snd_card_val != INT_SND_CARD)
- msm_ext_register_audio_notifier(pdev);
-
- return 0;
-err:
- if (pdata->us_euro_gpio > 0) {
- dev_dbg(&pdev->dev, "%s free us_euro gpio %d\n",
- __func__, pdata->us_euro_gpio);
- pdata->us_euro_gpio = 0;
- }
- if (pdata->hph_en1_gpio > 0) {
- dev_dbg(&pdev->dev, "%s free hph_en1_gpio %d\n",
- __func__, pdata->hph_en1_gpio);
- gpio_free(pdata->hph_en1_gpio);
- pdata->hph_en1_gpio = 0;
- }
- if (pdata->hph_en0_gpio > 0) {
- dev_dbg(&pdev->dev, "%s free hph_en0_gpio %d\n",
- __func__, pdata->hph_en0_gpio);
- gpio_free(pdata->hph_en0_gpio);
- pdata->hph_en0_gpio = 0;
- }
- devm_kfree(&pdev->dev, pdata);
- return ret;
-}
-
-static int msm_asoc_machine_remove(struct platform_device *pdev)
-{
- struct snd_soc_card *card = platform_get_drvdata(pdev);
- struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
-
- if (pdata->snd_card_val == INT_SND_CARD)
- mutex_destroy(&pdata->cdc_int_mclk0_mutex);
-
- if (gpio_is_valid(pdata->us_euro_gpio)) {
- gpio_free(pdata->us_euro_gpio);
- pdata->us_euro_gpio = 0;
- }
- if (gpio_is_valid(pdata->hph_en1_gpio)) {
- gpio_free(pdata->hph_en1_gpio);
- pdata->hph_en1_gpio = 0;
- }
- if (gpio_is_valid(pdata->hph_en0_gpio)) {
- gpio_free(pdata->hph_en0_gpio);
- pdata->hph_en0_gpio = 0;
- }
-
- if (pdata->snd_card_val != INT_SND_CARD)
- audio_notifier_deregister("sdm660");
-
- snd_soc_unregister_card(card);
- return 0;
-}
-
-static struct platform_driver sdm660_asoc_machine_driver = {
- .driver = {
- .name = DRV_NAME,
- .owner = THIS_MODULE,
- .pm = &snd_soc_pm_ops,
- .of_match_table = sdm660_asoc_machine_of_match,
- },
- .probe = msm_asoc_machine_probe,
- .remove = msm_asoc_machine_remove,
-};
-module_platform_driver(sdm660_asoc_machine_driver);
-
-MODULE_DESCRIPTION("ALSA SoC msm");
-MODULE_LICENSE("GPL v2");
-MODULE_ALIAS("platform:" DRV_NAME);
-MODULE_DEVICE_TABLE(of, sdm660_asoc_machine_of_match);
diff --git a/asoc/sdm660-common.h b/asoc/sdm660-common.h
deleted file mode 100644
index 6c3eefa..0000000
--- a/asoc/sdm660-common.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/* Copyright (c) 2015-2018, 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.
- */
-
-#ifndef __MSM_COMMON
-#define __MSM_COMMON
-
-#include <sound/soc.h>
-#include <dsp/q6afe-v2.h>
-#include "codecs/wcd-mbhc-v2.h"
-
-#define DEFAULT_MCLK_RATE 9600000
-#define NATIVE_MCLK_RATE 11289600
-
-#define SAMPLING_RATE_8KHZ 8000
-#define SAMPLING_RATE_11P025KHZ 11025
-#define SAMPLING_RATE_16KHZ 16000
-#define SAMPLING_RATE_22P05KHZ 22050
-#define SAMPLING_RATE_32KHZ 32000
-#define SAMPLING_RATE_44P1KHZ 44100
-#define SAMPLING_RATE_48KHZ 48000
-#define SAMPLING_RATE_88P2KHZ 88200
-#define SAMPLING_RATE_96KHZ 96000
-#define SAMPLING_RATE_176P4KHZ 176400
-#define SAMPLING_RATE_192KHZ 192000
-#define SAMPLING_RATE_352P8KHZ 352800
-#define SAMPLING_RATE_384KHZ 384000
-
-#define TDM_CHANNEL_MAX 8
-#define TDM_SLOT_OFFSET_MAX 8
-
-enum {
- TDM_0 = 0,
- TDM_1,
- TDM_2,
- TDM_3,
- TDM_4,
- TDM_5,
- TDM_6,
- TDM_7,
- TDM_PORT_MAX,
-};
-
-enum {
- TDM_PRI = 0,
- TDM_SEC,
- TDM_TERT,
- TDM_QUAT,
- TDM_QUIN,
- TDM_INTERFACE_MAX,
-};
-
-struct tdm_port {
- u32 mode;
- u32 channel;
-};
-
-enum {
- PRIM_MI2S = 0,
- SEC_MI2S,
- TERT_MI2S,
- QUAT_MI2S,
- QUIN_MI2S,
- MI2S_MAX,
-};
-
-enum {
- DIG_CDC,
- ANA_CDC,
- CODECS_MAX,
-};
-
-extern const struct snd_kcontrol_new msm_common_snd_controls[];
-extern bool codec_reg_done;
-struct sdm660_codec {
- void* (*get_afe_config_fn)(struct snd_soc_codec *codec,
- enum afe_config_type config_type);
-};
-
-enum {
- INT_SND_CARD,
- EXT_SND_CARD_TASHA,
- EXT_SND_CARD_TAVIL,
-};
-
-struct msm_asoc_mach_data {
- int us_euro_gpio; /* used by gpio driver API */
- int usbc_en2_gpio; /* used by gpio driver API */
- int hph_en1_gpio;
- int hph_en0_gpio;
- struct device_node *us_euro_gpio_p; /* used by pinctrl API */
- struct pinctrl *usbc_en2_gpio_p; /* used by pinctrl API */
- struct device_node *hph_en1_gpio_p; /* used by pinctrl API */
- struct device_node *hph_en0_gpio_p; /* used by pinctrl API */
- struct device_node *pdm_gpio_p; /* used by pinctrl API */
- struct device_node *comp_gpio_p; /* used by pinctrl API */
- struct device_node *dmic_gpio_p; /* used by pinctrl API */
- struct device_node *ext_spk_gpio_p; /* used by pinctrl API */
- struct device_node *mi2s_gpio_p[MI2S_MAX]; /* used by pinctrl API */
- struct snd_soc_codec *codec;
- struct sdm660_codec sdm660_codec_fn;
- struct snd_info_entry *codec_root;
- int spk_ext_pa_gpio;
- int mclk_freq;
- bool native_clk_set;
- int lb_mode;
- int snd_card_val;
- u8 micbias1_cap_mode;
- u8 micbias2_cap_mode;
- atomic_t int_mclk0_rsc_ref;
- atomic_t int_mclk0_enabled;
- struct mutex cdc_int_mclk0_mutex;
- struct delayed_work disable_int_mclk0_work;
- struct afe_clk_set digital_cdc_core_clk;
-};
-
-int msm_common_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
- struct snd_pcm_hw_params *params);
-int msm_aux_pcm_snd_startup(struct snd_pcm_substream *substream);
-void msm_aux_pcm_snd_shutdown(struct snd_pcm_substream *substream);
-int msm_mi2s_snd_startup(struct snd_pcm_substream *substream);
-void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream);
-int msm_common_snd_controls_size(void);
-void msm_set_codec_reg_done(bool done);
-#endif
diff --git a/asoc/sdm660-ext-dai-links.c b/asoc/sdm660-ext-dai-links.c
deleted file mode 100644
index 5f5a60e..0000000
--- a/asoc/sdm660-ext-dai-links.c
+++ /dev/null
@@ -1,2162 +0,0 @@
-/* Copyright (c) 2015-2018, 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.
- */
-
-#include <linux/of.h>
-#include <sound/core.h>
-#include <sound/soc.h>
-#include <sound/soc-dapm.h>
-#include <sound/pcm.h>
-#include <sound/pcm_params.h>
-#include "msm-pcm-routing-v2.h"
-#include "sdm660-common.h"
-#include "sdm660-external.h"
-#include "codecs/core.h"
-#include "codecs/wcd9335.h"
-#include <linux/pm_qos.h>
-
-#define DEV_NAME_STR_LEN 32
-#define __CHIPSET__ "SDM660 "
-#define MSM_DAILINK_NAME(name) (__CHIPSET__#name)
-
-#define WCN_CDC_SLIM_RX_CH_MAX 2
-#define WCN_CDC_SLIM_TX_CH_MAX 3
-#define MSM_LL_QOS_VALUE 300 /* time in us to ensure LPM doesn't go in C3/C4 */
-
-static struct snd_soc_card snd_soc_card_msm_card_tavil = {
- .name = "sdm670-tavil-snd-card",
- .late_probe = msm_snd_card_tavil_late_probe,
-};
-
-static struct snd_soc_card snd_soc_card_msm_card_tasha = {
- .name = "sdm670-tasha-snd-card",
- .late_probe = msm_snd_card_tasha_late_probe,
-};
-
-static struct snd_soc_ops msm_ext_slimbus_be_ops = {
- .hw_params = msm_snd_hw_params,
-};
-
-static struct snd_soc_ops msm_ext_cpe_ops = {
- .hw_params = msm_snd_cpe_hw_params,
-};
-
-static struct snd_soc_ops msm_ext_slimbus_2_be_ops = {
- .hw_params = msm_ext_slimbus_2_hw_params,
-};
-
-static struct snd_soc_ops msm_mi2s_be_ops = {
- .startup = msm_mi2s_snd_startup,
- .shutdown = msm_mi2s_snd_shutdown,
-};
-
-static struct snd_soc_ops msm_aux_pcm_be_ops = {
- .startup = msm_aux_pcm_snd_startup,
- .shutdown = msm_aux_pcm_snd_shutdown,
-};
-
-static int msm_wcn_init(struct snd_soc_pcm_runtime *rtd)
-{
- unsigned int rx_ch[WCN_CDC_SLIM_RX_CH_MAX] = {157, 158};
- unsigned int tx_ch[WCN_CDC_SLIM_TX_CH_MAX] = {159, 160, 161};
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
-
- return snd_soc_dai_set_channel_map(codec_dai, ARRAY_SIZE(tx_ch),
- tx_ch, ARRAY_SIZE(rx_ch), rx_ch);
-}
-
-static int msm_wcn_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- struct snd_soc_dai_link *dai_link = rtd->dai_link;
- u32 rx_ch[WCN_CDC_SLIM_RX_CH_MAX], tx_ch[WCN_CDC_SLIM_TX_CH_MAX];
- u32 rx_ch_cnt = 0, tx_ch_cnt = 0;
- int ret;
-
- dev_dbg(rtd->dev, "%s: %s_tx_dai_id_%d\n", __func__,
- codec_dai->name, codec_dai->id);
- ret = snd_soc_dai_get_channel_map(codec_dai,
- &tx_ch_cnt, tx_ch, &rx_ch_cnt, rx_ch);
- if (ret) {
- dev_err(rtd->dev,
- "%s: failed to get BTFM codec chan map\n, err:%d\n",
- __func__, ret);
- goto exit;
- }
-
- dev_dbg(rtd->dev, "%s: tx_ch_cnt(%d) id %d\n",
- __func__, tx_ch_cnt, dai_link->id);
-
- ret = snd_soc_dai_set_channel_map(cpu_dai,
- tx_ch_cnt, tx_ch, rx_ch_cnt, rx_ch);
- if (ret)
- dev_err(rtd->dev, "%s: failed to set cpu chan map, err:%d\n",
- __func__, ret);
-
-exit:
- return ret;
-}
-
-static struct snd_soc_ops msm_wcn_ops = {
- .hw_params = msm_wcn_hw_params,
-};
-
-/*TDM default offset currently only supporting TDM_RX_0 and TDM_TX_0 */
-static unsigned int tdm_slot_offset[TDM_PORT_MAX][TDM_SLOT_OFFSET_MAX] = {
- {0, 4, 8, 12, 16, 20, 24, 28},/* TX_0 | RX_0 */
- {AFE_SLOT_MAPPING_OFFSET_INVALID},/* TX_1 | RX_1 */
- {AFE_SLOT_MAPPING_OFFSET_INVALID},/* TX_2 | RX_2 */
- {AFE_SLOT_MAPPING_OFFSET_INVALID},/* TX_3 | RX_3 */
- {AFE_SLOT_MAPPING_OFFSET_INVALID},/* TX_4 | RX_4 */
- {AFE_SLOT_MAPPING_OFFSET_INVALID},/* TX_5 | RX_5 */
- {AFE_SLOT_MAPPING_OFFSET_INVALID},/* TX_6 | RX_6 */
- {AFE_SLOT_MAPPING_OFFSET_INVALID},/* TX_7 | RX_7 */
-};
-
-static unsigned int tdm_param_set_slot_mask(u16 port_id, int slot_width,
- int slots)
-{
- unsigned int slot_mask = 0;
- int i, j;
- unsigned int *slot_offset;
-
- for (i = TDM_0; i < TDM_PORT_MAX; i++) {
- slot_offset = tdm_slot_offset[i];
-
- for (j = 0; j < TDM_SLOT_OFFSET_MAX; j++) {
- if (slot_offset[j] != AFE_SLOT_MAPPING_OFFSET_INVALID)
- slot_mask |=
- (1 << ((slot_offset[j] * 8) / slot_width));
- else
- break;
- }
- }
-
- return slot_mask;
-}
-
-static int msm_tdm_snd_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- int ret = 0;
- int channels, slot_width, slots;
- unsigned int slot_mask;
- unsigned int *slot_offset;
- int offset_channels = 0;
- int i;
-
- pr_debug("%s: dai id = 0x%x\n", __func__, cpu_dai->id);
-
- channels = params_channels(params);
- switch (channels) {
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- case 8:
- switch (params_format(params)) {
- case SNDRV_PCM_FORMAT_S32_LE:
- case SNDRV_PCM_FORMAT_S24_LE:
- case SNDRV_PCM_FORMAT_S16_LE:
- /*
- * up to 8 channels HW config should
- * use 32 bit slot width for max support of
- * stream bit width. (slot_width > bit_width)
- */
- slot_width = 32;
- break;
- default:
- pr_err("%s: invalid param format 0x%x\n",
- __func__, params_format(params));
- return -EINVAL;
- }
- slots = 8;
- slot_mask = tdm_param_set_slot_mask(cpu_dai->id,
- slot_width,
- slots);
- if (!slot_mask) {
- pr_err("%s: invalid slot_mask 0x%x\n",
- __func__, slot_mask);
- return -EINVAL;
- }
- break;
- default:
- pr_err("%s: invalid param channels %d\n",
- __func__, channels);
- return -EINVAL;
- }
- /* currently only supporting TDM_RX_0 and TDM_TX_0 */
- switch (cpu_dai->id) {
- case AFE_PORT_ID_PRIMARY_TDM_RX:
- case AFE_PORT_ID_SECONDARY_TDM_RX:
- case AFE_PORT_ID_TERTIARY_TDM_RX:
- case AFE_PORT_ID_QUATERNARY_TDM_RX:
- case AFE_PORT_ID_QUINARY_TDM_RX:
- case AFE_PORT_ID_PRIMARY_TDM_TX:
- case AFE_PORT_ID_SECONDARY_TDM_TX:
- case AFE_PORT_ID_TERTIARY_TDM_TX:
- case AFE_PORT_ID_QUATERNARY_TDM_TX:
- case AFE_PORT_ID_QUINARY_TDM_TX:
- slot_offset = tdm_slot_offset[TDM_0];
- break;
- default:
- pr_err("%s: dai id 0x%x not supported\n",
- __func__, cpu_dai->id);
- return -EINVAL;
- }
-
- for (i = 0; i < TDM_SLOT_OFFSET_MAX; i++) {
- if (slot_offset[i] != AFE_SLOT_MAPPING_OFFSET_INVALID)
- offset_channels++;
- else
- break;
- }
-
- if (offset_channels == 0) {
- pr_err("%s: slot offset not supported, offset_channels %d\n",
- __func__, offset_channels);
- return -EINVAL;
- }
-
- if (channels > offset_channels) {
- pr_err("%s: channels %d exceed offset_channels %d\n",
- __func__, channels, offset_channels);
- return -EINVAL;
- }
-
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
- ret = snd_soc_dai_set_tdm_slot(cpu_dai, 0, slot_mask,
- slots, slot_width);
- if (ret < 0) {
- pr_err("%s: failed to set tdm slot, err:%d\n",
- __func__, ret);
- goto end;
- }
-
- ret = snd_soc_dai_set_channel_map(cpu_dai, 0, NULL,
- channels, slot_offset);
- if (ret < 0) {
- pr_err("%s: failed to set channel map, err:%d\n",
- __func__, ret);
- goto end;
- }
- } else {
- ret = snd_soc_dai_set_tdm_slot(cpu_dai, slot_mask, 0,
- slots, slot_width);
- if (ret < 0) {
- pr_err("%s: failed to set tdm slot, err:%d\n",
- __func__, ret);
- goto end;
- }
-
- ret = snd_soc_dai_set_channel_map(cpu_dai, channels,
- slot_offset, 0, NULL);
- if (ret < 0) {
- pr_err("%s: failed to set channel map, err:%d\n",
- __func__, ret);
- goto end;
- }
- }
-end:
- return ret;
-}
-
-static struct snd_soc_ops msm_tdm_be_ops = {
- .hw_params = msm_tdm_snd_hw_params
-};
-
-static int msm_fe_qos_prepare(struct snd_pcm_substream *substream)
-{
- cpumask_t mask;
-
- if (pm_qos_request_active(&substream->latency_pm_qos_req))
- pm_qos_remove_request(&substream->latency_pm_qos_req);
-
- cpumask_clear(&mask);
- cpumask_set_cpu(1, &mask); /* affine to core 1 */
- cpumask_set_cpu(2, &mask); /* affine to core 2 */
- cpumask_copy(&substream->latency_pm_qos_req.cpus_affine, &mask);
-
- substream->latency_pm_qos_req.type = PM_QOS_REQ_AFFINE_CORES;
-
- pm_qos_add_request(&substream->latency_pm_qos_req,
- PM_QOS_CPU_DMA_LATENCY,
- MSM_LL_QOS_VALUE);
- return 0;
-}
-
-static struct snd_soc_ops msm_fe_qos_ops = {
- .prepare = msm_fe_qos_prepare,
-};
-
-static struct snd_soc_dai_link msm_ext_tasha_fe_dai[] = {
- /* tasha_vifeedback for speaker protection */
- {
- .name = LPASS_BE_SLIMBUS_4_TX,
- .stream_name = "Slimbus4 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16393",
- .platform_name = "msm-pcm-hostless",
- .codec_name = "tasha_codec",
- .codec_dai_name = "tasha_vifeedback",
- .id = MSM_BACKEND_DAI_SLIMBUS_4_TX,
- .be_hw_params_fixup = msm_ext_be_hw_params_fixup,
- .ops = &msm_ext_slimbus_be_ops,
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- },
- /* Ultrasound RX DAI Link */
- {
- .name = "SLIMBUS_2 Hostless Playback",
- .stream_name = "SLIMBUS_2 Hostless Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16388",
- .platform_name = "msm-pcm-hostless",
- .codec_name = "tasha_codec",
- .codec_dai_name = "tasha_rx2",
- .ignore_suspend = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .ignore_pmdown_time = 1,
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ops = &msm_ext_slimbus_2_be_ops,
- },
- /* Ultrasound TX DAI Link */
- {
- .name = "SLIMBUS_2 Hostless Capture",
- .stream_name = "SLIMBUS_2 Hostless Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16389",
- .platform_name = "msm-pcm-hostless",
- .codec_name = "tasha_codec",
- .codec_dai_name = "tasha_tx2",
- .ignore_suspend = 1,
- .dpcm_capture = 1,
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ops = &msm_ext_slimbus_2_be_ops,
- },
- /* CPE LSM direct dai-link */
- {
- .name = "CPE Listen service",
- .stream_name = "CPE Listen Audio Service",
- .cpu_dai_name = "msm-dai-slim",
- .platform_name = "msm-cpe-lsm",
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .dpcm_capture = 1,
- .codec_dai_name = "tasha_mad1",
- .codec_name = "tasha_codec",
- .ops = &msm_ext_cpe_ops,
- },
- {
- .name = "SLIMBUS_6 Hostless Playback",
- .stream_name = "SLIMBUS_6 Hostless",
- .cpu_dai_name = "SLIMBUS6_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- /* this dailink has playback support */
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- /* CPE LSM EC PP direct dai-link */
- {
- .name = "CPE Listen service ECPP",
- .stream_name = "CPE Listen Audio Service ECPP",
- .cpu_dai_name = "CPE_LSM_NOHOST",
- .platform_name = "msm-cpe-lsm.3",
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "tasha_cpe",
- .codec_name = "tasha_codec",
- },
-};
-
-static struct snd_soc_dai_link msm_ext_tavil_fe_dai[] = {
- {
- .name = LPASS_BE_SLIMBUS_4_TX,
- .stream_name = "Slimbus4 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16393",
- .platform_name = "msm-pcm-hostless",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_vifeedback",
- .id = MSM_BACKEND_DAI_SLIMBUS_4_TX,
- .be_hw_params_fixup = msm_ext_be_hw_params_fixup,
- .ops = &msm_ext_slimbus_be_ops,
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- },
- /* Ultrasound RX DAI Link */
- {
- .name = "SLIMBUS_2 Hostless Playback",
- .stream_name = "SLIMBUS_2 Hostless Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16388",
- .platform_name = "msm-pcm-hostless",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_rx2",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ops = &msm_ext_slimbus_2_be_ops,
- },
- /* Ultrasound TX DAI Link */
- {
- .name = "SLIMBUS_2 Hostless Capture",
- .stream_name = "SLIMBUS_2 Hostless Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16389",
- .platform_name = "msm-pcm-hostless",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_tx2",
- .ignore_suspend = 1,
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ops = &msm_ext_slimbus_2_be_ops,
- },
-};
-
-static struct snd_soc_dai_link msm_ext_tasha_be_dai[] = {
- /* Backend DAI Links */
- {
- .name = LPASS_BE_SLIMBUS_0_RX,
- .stream_name = "Slimbus Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16384",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tasha_codec",
- .codec_dai_name = "tasha_mix_rx1",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_0_RX,
- .init = &msm_audrx_init,
- .be_hw_params_fixup = msm_ext_be_hw_params_fixup,
- /* this dainlink has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- .ops = &msm_ext_slimbus_be_ops,
- },
- {
- .name = LPASS_BE_SLIMBUS_0_TX,
- .stream_name = "Slimbus Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16385",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tasha_codec",
- .codec_dai_name = "tasha_tx1",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_0_TX,
- .be_hw_params_fixup = msm_ext_be_hw_params_fixup,
- .ignore_suspend = 1,
- .ops = &msm_ext_slimbus_be_ops,
- },
- {
- .name = LPASS_BE_SLIMBUS_1_RX,
- .stream_name = "Slimbus1 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16386",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tasha_codec",
- .codec_dai_name = "tasha_mix_rx1",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_1_RX,
- .be_hw_params_fixup = msm_ext_be_hw_params_fixup,
- .ops = &msm_ext_slimbus_be_ops,
- /* dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_1_TX,
- .stream_name = "Slimbus1 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16387",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tasha_codec",
- .codec_dai_name = "tasha_tx3",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_1_TX,
- .be_hw_params_fixup = msm_ext_be_hw_params_fixup,
- .ops = &msm_ext_slimbus_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_3_RX,
- .stream_name = "Slimbus3 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16390",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tasha_codec",
- .codec_dai_name = "tasha_mix_rx1",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_3_RX,
- .be_hw_params_fixup = msm_ext_be_hw_params_fixup,
- .ops = &msm_ext_slimbus_be_ops,
- /* dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_3_TX,
- .stream_name = "Slimbus3 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16391",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tasha_codec",
- .codec_dai_name = "tasha_tx1",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_3_TX,
- .be_hw_params_fixup = msm_ext_be_hw_params_fixup,
- .ops = &msm_ext_slimbus_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_4_RX,
- .stream_name = "Slimbus4 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16392",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tasha_codec",
- .codec_dai_name = "tasha_mix_rx1",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_4_RX,
- .be_hw_params_fixup = msm_ext_be_hw_params_fixup,
- .ops = &msm_ext_slimbus_be_ops,
- /* dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_5_RX,
- .stream_name = "Slimbus5 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16394",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tasha_codec",
- .codec_dai_name = "tasha_rx3",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_5_RX,
- .be_hw_params_fixup = msm_ext_be_hw_params_fixup,
- .ops = &msm_ext_slimbus_be_ops,
- /* dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- /* MAD BE */
- {
- .name = LPASS_BE_SLIMBUS_5_TX,
- .stream_name = "Slimbus5 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16395",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tasha_codec",
- .codec_dai_name = "tasha_mad1",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_5_TX,
- .be_hw_params_fixup = msm_ext_be_hw_params_fixup,
- .ops = &msm_ext_slimbus_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_6_RX,
- .stream_name = "Slimbus6 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16396",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tasha_codec",
- .codec_dai_name = "tasha_rx4",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_6_RX,
- .be_hw_params_fixup = msm_ext_be_hw_params_fixup,
- .ops = &msm_ext_slimbus_be_ops,
- /* dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
-};
-
-static struct snd_soc_dai_link msm_ext_tavil_be_dai[] = {
- {
- .name = LPASS_BE_SLIMBUS_0_RX,
- .stream_name = "Slimbus Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16384",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_rx1",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_0_RX,
- .init = &msm_audrx_init,
- .be_hw_params_fixup = msm_ext_be_hw_params_fixup,
- /* this dainlink has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- .ops = &msm_ext_slimbus_be_ops,
- },
- {
- .name = LPASS_BE_SLIMBUS_0_TX,
- .stream_name = "Slimbus Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16385",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_tx1",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_0_TX,
- .be_hw_params_fixup = msm_ext_be_hw_params_fixup,
- .ignore_suspend = 1,
- .ops = &msm_ext_slimbus_be_ops,
- },
- {
- .name = LPASS_BE_SLIMBUS_1_RX,
- .stream_name = "Slimbus1 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16386",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_rx1",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_1_RX,
- .be_hw_params_fixup = msm_ext_be_hw_params_fixup,
- .ops = &msm_ext_slimbus_be_ops,
- /* dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_1_TX,
- .stream_name = "Slimbus1 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16387",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_tx3",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_1_TX,
- .be_hw_params_fixup = msm_ext_be_hw_params_fixup,
- .ops = &msm_ext_slimbus_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_2_RX,
- .stream_name = "Slimbus2 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16388",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_rx2",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_2_RX,
- .be_hw_params_fixup = msm_ext_be_hw_params_fixup,
- .ops = &msm_ext_slimbus_be_ops,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_3_RX,
- .stream_name = "Slimbus3 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16390",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_rx1",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_3_RX,
- .be_hw_params_fixup = msm_ext_be_hw_params_fixup,
- .ops = &msm_ext_slimbus_be_ops,
- /* dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_3_TX,
- .stream_name = "Slimbus3 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16391",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_tx1",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_3_TX,
- .be_hw_params_fixup = msm_ext_be_hw_params_fixup,
- .ops = &msm_ext_slimbus_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_4_RX,
- .stream_name = "Slimbus4 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16392",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_rx1",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_4_RX,
- .be_hw_params_fixup = msm_ext_be_hw_params_fixup,
- .ops = &msm_ext_slimbus_be_ops,
- /* dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_5_RX,
- .stream_name = "Slimbus5 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16394",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_rx3",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_5_RX,
- .be_hw_params_fixup = msm_ext_be_hw_params_fixup,
- .ops = &msm_ext_slimbus_be_ops,
- /* dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- /* MAD BE */
- {
- .name = LPASS_BE_SLIMBUS_5_TX,
- .stream_name = "Slimbus5 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16395",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_mad1",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_5_TX,
- .be_hw_params_fixup = msm_ext_be_hw_params_fixup,
- .ops = &msm_ext_slimbus_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_6_RX,
- .stream_name = "Slimbus6 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16396",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_rx4",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_6_RX,
- .be_hw_params_fixup = msm_ext_be_hw_params_fixup,
- .ops = &msm_ext_slimbus_be_ops,
- /* dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
-};
-
-static struct snd_soc_dai_link msm_ext_common_fe_dai[] = {
- /* FrontEnd DAI Links */
- {/* hw:x,0 */
- .name = MSM_DAILINK_NAME(Media1),
- .stream_name = "MultiMedia1",
- .cpu_dai_name = "MultiMedia1",
- .platform_name = "msm-pcm-dsp.0",
- .dynamic = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- /* this dai link has playback support */
- .ignore_pmdown_time = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA1
- },
- {/* hw:x,1 */
- .name = MSM_DAILINK_NAME(Media2),
- .stream_name = "MultiMedia2",
- .cpu_dai_name = "MultiMedia2",
- .platform_name = "msm-pcm-dsp.0",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .ignore_suspend = 1,
- /* this dai link has playback support */
- .ignore_pmdown_time = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA2,
- },
- {/* hw:x,2 */
- .name = "VoiceMMode1",
- .stream_name = "VoiceMMode1",
- .cpu_dai_name = "VoiceMMode1",
- .platform_name = "msm-pcm-voice",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_VOICEMMODE1,
- },
- {/* hw:x,3 */
- .name = "MSM VoIP",
- .stream_name = "VoIP",
- .cpu_dai_name = "VoIP",
- .platform_name = "msm-voip-dsp",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- /* this dai link has playback support */
- .ignore_pmdown_time = 1,
- .id = MSM_FRONTEND_DAI_VOIP,
- },
- {/* hw:x,4 */
- .name = MSM_DAILINK_NAME(ULL),
- .stream_name = "ULL",
- .cpu_dai_name = "MultiMedia3",
- .platform_name = "msm-pcm-dsp.2",
- .dynamic = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- /* this dai link has playback support */
- .ignore_pmdown_time = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA3,
- },
- /* Hostless PCM purpose */
- {/* hw:x,5 */
- .name = "SLIMBUS_0 Hostless",
- .stream_name = "SLIMBUS_0 Hostless",
- .cpu_dai_name = "SLIMBUS0_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* This dai link has MI2S support */
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {/* hw:x,6 */
- .name = "MSM AFE-PCM RX",
- .stream_name = "AFE-PROXY RX",
- .cpu_dai_name = "msm-dai-q6-dev.241",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .platform_name = "msm-pcm-afe",
- .ignore_suspend = 1,
- /* this dai link has playback support */
- .ignore_pmdown_time = 1,
- },
- {/* hw:x,7 */
- .name = "MSM AFE-PCM TX",
- .stream_name = "AFE-PROXY TX",
- .cpu_dai_name = "msm-dai-q6-dev.240",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .platform_name = "msm-pcm-afe",
- .ignore_suspend = 1,
- },
- {/* hw:x,8 */
- .name = MSM_DAILINK_NAME(Compress1),
- .stream_name = "Compress1",
- .cpu_dai_name = "MultiMedia4",
- .platform_name = "msm-compress-dsp",
- .async_ops = ASYNC_DPCM_SND_SOC_HW_PARAMS,
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dai link has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA4,
- },
- {/* hw:x,9*/
- .name = "AUXPCM Hostless",
- .stream_name = "AUXPCM Hostless",
- .cpu_dai_name = "AUXPCM_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- /* this dai link has playback support */
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {/* hw:x,10 */
- .name = "SLIMBUS_1 Hostless",
- .stream_name = "SLIMBUS_1 Hostless",
- .cpu_dai_name = "SLIMBUS1_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1, /* dai link has playback support */
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {/* hw:x,11 */
- .name = "SLIMBUS_3 Hostless",
- .stream_name = "SLIMBUS_3 Hostless",
- .cpu_dai_name = "SLIMBUS3_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1, /* dai link has playback support */
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {/* hw:x,12 */
- .name = "SLIMBUS_4 Hostless",
- .stream_name = "SLIMBUS_4 Hostless",
- .cpu_dai_name = "SLIMBUS4_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1, /* dai link has playback support */
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {/* hw:x,13 */
- .name = MSM_DAILINK_NAME(LowLatency),
- .stream_name = "MultiMedia5",
- .cpu_dai_name = "MultiMedia5",
- .platform_name = "msm-pcm-dsp.1",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .ignore_suspend = 1,
- /* this dai link has playback support */
- .ignore_pmdown_time = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA5,
- .ops = &msm_fe_qos_ops,
- },
- /* LSM FE */
- {/* hw:x,14 */
- .name = "Listen 1 Audio Service",
- .stream_name = "Listen 1 Audio Service",
- .cpu_dai_name = "LSM1",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM1,
- },
- {/* hw:x,15 */
- .name = MSM_DAILINK_NAME(Compress2),
- .stream_name = "Compress2",
- .cpu_dai_name = "MultiMedia7",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .ignore_suspend = 1,
- /* this dai link has playback support */
- .ignore_pmdown_time = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA7,
- },
- {/* hw:x,16 */
- .name = MSM_DAILINK_NAME(MultiMedia10),
- .stream_name = "MultiMedia10",
- .cpu_dai_name = "MultiMedia10",
- .platform_name = "msm-pcm-dsp.1",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dai link has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA10,
- },
- {/* hw:x,17 */
- .name = MSM_DAILINK_NAME(ULL_NOIRQ),
- .stream_name = "MM_NOIRQ",
- .cpu_dai_name = "MultiMedia8",
- .platform_name = "msm-pcm-dsp-noirq",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dai link has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA8,
- .ops = &msm_fe_qos_ops,
- },
- {/* hw:x,18 */
- .name = "HDMI_RX_HOSTLESS",
- .stream_name = "HDMI_RX_HOSTLESS",
- .cpu_dai_name = "HDMI_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {/* hw:x,19 */
- .name = "VoiceMMode2",
- .stream_name = "VoiceMMode2",
- .cpu_dai_name = "VoiceMMode2",
- .platform_name = "msm-pcm-voice",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_VOICEMMODE2,
- },
- {/* hw:x,20 */
- .name = "Listen 2 Audio Service",
- .stream_name = "Listen 2 Audio Service",
- .cpu_dai_name = "LSM2",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM2,
- },
- {/* hw:x,21 */
- .name = "Listen 3 Audio Service",
- .stream_name = "Listen 3 Audio Service",
- .cpu_dai_name = "LSM3",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM3,
- },
- {/* hw:x,22 */
- .name = "Listen 4 Audio Service",
- .stream_name = "Listen 4 Audio Service",
- .cpu_dai_name = "LSM4",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM4,
- },
- {/* hw:x,23 */
- .name = "Listen 5 Audio Service",
- .stream_name = "Listen 5 Audio Service",
- .cpu_dai_name = "LSM5",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM5,
- },
- {/* hw:x,24 */
- .name = "Listen 6 Audio Service",
- .stream_name = "Listen 6 Audio Service",
- .cpu_dai_name = "LSM6",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM6
- },
- {/* hw:x,25 */
- .name = "Listen 7 Audio Service",
- .stream_name = "Listen 7 Audio Service",
- .cpu_dai_name = "LSM7",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM7,
- },
- {/* hw:x,26 */
- .name = "Listen 8 Audio Service",
- .stream_name = "Listen 8 Audio Service",
- .cpu_dai_name = "LSM8",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM8,
- },
- {/* hw:x,27 */
- .name = MSM_DAILINK_NAME(Media9),
- .stream_name = "MultiMedia9",
- .cpu_dai_name = "MultiMedia9",
- .platform_name = "msm-pcm-dsp.0",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dai link has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA9,
- },
- {/* hw:x,28 */
- .name = MSM_DAILINK_NAME(Compress4),
- .stream_name = "Compress4",
- .cpu_dai_name = "MultiMedia11",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dai link has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA11,
- },
- {/* hw:x,29 */
- .name = MSM_DAILINK_NAME(Compress5),
- .stream_name = "Compress5",
- .cpu_dai_name = "MultiMedia12",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dai link has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA12,
- },
- {/* hw:x,30 */
- .name = MSM_DAILINK_NAME(Compress6),
- .stream_name = "Compress6",
- .cpu_dai_name = "MultiMedia13",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dai link has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA13,
- },
- {/* hw:x,31 */
- .name = MSM_DAILINK_NAME(Compress7),
- .stream_name = "Compress7",
- .cpu_dai_name = "MultiMedia14",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dai link has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA14,
- },
- {/* hw:x,32 */
- .name = MSM_DAILINK_NAME(Compress8),
- .stream_name = "Compress8",
- .cpu_dai_name = "MultiMedia15",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dai link has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA15,
- },
- {/* hw:x,33 */
- .name = MSM_DAILINK_NAME(ULL_NOIRQ_2),
- .stream_name = "MM_NOIRQ_2",
- .cpu_dai_name = "MultiMedia16",
- .platform_name = "msm-pcm-dsp-noirq",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dai link has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA16,
- },
- {/* hw:x,34 */
- .name = "SLIMBUS_8 Hostless",
- .stream_name = "SLIMBUS8_HOSTLESS Capture",
- .cpu_dai_name = "SLIMBUS8_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {/* hw:x,35 */
- .name = "SLIMBUS7 Hostless",
- .stream_name = "SLIMBUS7 Hostless",
- .cpu_dai_name = "SLIMBUS7_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {/* hw:x,36 */
- .name = "SDM660 HFP TX",
- .stream_name = "MultiMedia6",
- .cpu_dai_name = "MultiMedia6",
- .platform_name = "msm-pcm-loopback",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .ignore_suspend = 1,
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_pmdown_time = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA6,
- },
-};
-
-static struct snd_soc_dai_link msm_ext_common_be_dai[] = {
- {
- .name = LPASS_BE_AFE_PCM_RX,
- .stream_name = "AFE Playback",
- .cpu_dai_name = "msm-dai-q6-dev.224",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_AFE_PCM_RX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- /* this dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_AFE_PCM_TX,
- .stream_name = "AFE Capture",
- .cpu_dai_name = "msm-dai-q6-dev.225",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_AFE_PCM_TX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ignore_suspend = 1,
- },
- /* Incall Record Uplink BACK END DAI Link */
- {
- .name = LPASS_BE_INCALL_RECORD_TX,
- .stream_name = "Voice Uplink Capture",
- .cpu_dai_name = "msm-dai-q6-dev.32772",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_INCALL_RECORD_TX,
- .be_hw_params_fixup = msm_ext_be_hw_params_fixup,
- .ignore_suspend = 1,
- },
- /* Incall Record Downlink BACK END DAI Link */
- {
- .name = LPASS_BE_INCALL_RECORD_RX,
- .stream_name = "Voice Downlink Capture",
- .cpu_dai_name = "msm-dai-q6-dev.32771",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_INCALL_RECORD_RX,
- .be_hw_params_fixup = msm_ext_be_hw_params_fixup,
- .ignore_suspend = 1,
- },
- /* Incall Music BACK END DAI Link */
- {
- .name = LPASS_BE_VOICE_PLAYBACK_TX,
- .stream_name = "Voice Farend Playback",
- .cpu_dai_name = "msm-dai-q6-dev.32773",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_VOICE_PLAYBACK_TX,
- .be_hw_params_fixup = msm_ext_be_hw_params_fixup,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- /* Incall Music 2 BACK END DAI Link */
- {
- .name = LPASS_BE_VOICE2_PLAYBACK_TX,
- .stream_name = "Voice2 Farend Playback",
- .cpu_dai_name = "msm-dai-q6-dev.32770",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_VOICE2_PLAYBACK_TX,
- .be_hw_params_fixup = msm_ext_be_hw_params_fixup,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- {
- .name = LPASS_BE_USB_AUDIO_RX,
- .stream_name = "USB Audio Playback",
- .cpu_dai_name = "msm-dai-q6-dev.28672",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_USB_RX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_USB_AUDIO_TX,
- .stream_name = "USB Audio Capture",
- .cpu_dai_name = "msm-dai-q6-dev.28673",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_USB_TX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_PRI_TDM_RX_0,
- .stream_name = "Primary TDM0 Playback",
- .cpu_dai_name = "msm-dai-q6-tdm.36864",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_PRI_TDM_RX_0,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_tdm_be_ops,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- {
- .name = LPASS_BE_PRI_TDM_TX_0,
- .stream_name = "Primary TDM0 Capture",
- .cpu_dai_name = "msm-dai-q6-tdm.36865",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_PRI_TDM_TX_0,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_tdm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SEC_TDM_RX_0,
- .stream_name = "Secondary TDM0 Playback",
- .cpu_dai_name = "msm-dai-q6-tdm.36880",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SEC_TDM_RX_0,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_tdm_be_ops,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- {
- .name = LPASS_BE_SEC_TDM_TX_0,
- .stream_name = "Secondary TDM0 Capture",
- .cpu_dai_name = "msm-dai-q6-tdm.36881",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SEC_TDM_TX_0,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_tdm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_TERT_TDM_RX_0,
- .stream_name = "Tertiary TDM0 Playback",
- .cpu_dai_name = "msm-dai-q6-tdm.36896",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_TERT_TDM_RX_0,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_tdm_be_ops,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- {
- .name = LPASS_BE_TERT_TDM_TX_0,
- .stream_name = "Tertiary TDM0 Capture",
- .cpu_dai_name = "msm-dai-q6-tdm.36897",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_TERT_TDM_TX_0,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_tdm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_QUAT_TDM_RX_0,
- .stream_name = "Quaternary TDM0 Playback",
- .cpu_dai_name = "msm-dai-q6-tdm.36912",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_QUAT_TDM_RX_0,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_tdm_be_ops,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- {
- .name = LPASS_BE_QUAT_TDM_TX_0,
- .stream_name = "Quaternary TDM0 Capture",
- .cpu_dai_name = "msm-dai-q6-tdm.36913",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_QUAT_TDM_TX_0,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_tdm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_QUIN_TDM_RX_0,
- .stream_name = "Quinary TDM0 Playback",
- .cpu_dai_name = "msm-dai-q6-tdm.36928",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_QUIN_TDM_RX_0,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_tdm_be_ops,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- {
- .name = LPASS_BE_QUIN_TDM_TX_0,
- .stream_name = "Quinary TDM0 Capture",
- .cpu_dai_name = "msm-dai-q6-tdm.36929",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_QUIN_TDM_TX_0,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_tdm_be_ops,
- .ignore_suspend = 1,
- },
-};
-
-static struct snd_soc_dai_link msm_mi2s_be_dai_links[] = {
- {
- .name = LPASS_BE_PRI_MI2S_RX,
- .stream_name = "Primary MI2S Playback",
- .cpu_dai_name = "msm-dai-q6-mi2s.0",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_PRI_MI2S_RX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- {
- .name = LPASS_BE_PRI_MI2S_TX,
- .stream_name = "Primary MI2S Capture",
- .cpu_dai_name = "msm-dai-q6-mi2s.0",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_PRI_MI2S_TX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SEC_MI2S_RX,
- .stream_name = "Secondary MI2S Playback",
- .cpu_dai_name = "msm-dai-q6-mi2s.1",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SECONDARY_MI2S_RX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- {
- .name = LPASS_BE_SEC_MI2S_TX,
- .stream_name = "Secondary MI2S Capture",
- .cpu_dai_name = "msm-dai-q6-mi2s.1",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SECONDARY_MI2S_TX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_TERT_MI2S_RX,
- .stream_name = "Tertiary MI2S Playback",
- .cpu_dai_name = "msm-dai-q6-mi2s.2",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_TERTIARY_MI2S_RX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- {
- .name = LPASS_BE_TERT_MI2S_TX,
- .stream_name = "Tertiary MI2S Capture",
- .cpu_dai_name = "msm-dai-q6-mi2s.2",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_TERTIARY_MI2S_TX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_QUAT_MI2S_RX,
- .stream_name = "Quaternary MI2S Playback",
- .cpu_dai_name = "msm-dai-q6-mi2s.3",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_QUATERNARY_MI2S_RX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- {
- .name = LPASS_BE_QUAT_MI2S_TX,
- .stream_name = "Quaternary MI2S Capture",
- .cpu_dai_name = "msm-dai-q6-mi2s.3",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_QUATERNARY_MI2S_TX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_QUIN_MI2S_RX,
- .stream_name = "Quinary MI2S Playback",
- .cpu_dai_name = "msm-dai-q6-mi2s.4",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_QUINARY_MI2S_RX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- {
- .name = LPASS_BE_QUIN_MI2S_TX,
- .stream_name = "Quinary MI2S Capture",
- .cpu_dai_name = "msm-dai-q6-mi2s.4",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_QUINARY_MI2S_TX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- },
-};
-
-static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = {
- /* Primary AUX PCM Backend DAI Links */
- {
- .name = LPASS_BE_AUXPCM_RX,
- .stream_name = "AUX PCM Playback",
- .cpu_dai_name = "msm-dai-q6-auxpcm.1",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_AUXPCM_RX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- .ops = &msm_aux_pcm_be_ops,
- },
- {
- .name = LPASS_BE_AUXPCM_TX,
- .stream_name = "AUX PCM Capture",
- .cpu_dai_name = "msm-dai-q6-auxpcm.1",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_AUXPCM_TX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ignore_suspend = 1,
- .ops = &msm_aux_pcm_be_ops,
- },
- /* Secondary AUX PCM Backend DAI Links */
- {
- .name = LPASS_BE_SEC_AUXPCM_RX,
- .stream_name = "Sec AUX PCM Playback",
- .cpu_dai_name = "msm-dai-q6-auxpcm.2",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SEC_AUXPCM_RX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- .ops = &msm_aux_pcm_be_ops,
- },
- {
- .name = LPASS_BE_SEC_AUXPCM_TX,
- .stream_name = "Sec AUX PCM Capture",
- .cpu_dai_name = "msm-dai-q6-auxpcm.2",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SEC_AUXPCM_TX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ignore_suspend = 1,
- .ops = &msm_aux_pcm_be_ops,
- },
- /* Tertiary AUX PCM Backend DAI Links */
- {
- .name = LPASS_BE_TERT_AUXPCM_RX,
- .stream_name = "Tert AUX PCM Playback",
- .cpu_dai_name = "msm-dai-q6-auxpcm.3",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_TERT_AUXPCM_RX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- .ops = &msm_aux_pcm_be_ops,
- },
- {
- .name = LPASS_BE_TERT_AUXPCM_TX,
- .stream_name = "Tert AUX PCM Capture",
- .cpu_dai_name = "msm-dai-q6-auxpcm.3",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_TERT_AUXPCM_TX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ignore_suspend = 1,
- .ops = &msm_aux_pcm_be_ops,
- },
- /* Quaternary AUX PCM Backend DAI Links */
- {
- .name = LPASS_BE_QUAT_AUXPCM_RX,
- .stream_name = "Quat AUX PCM Playback",
- .cpu_dai_name = "msm-dai-q6-auxpcm.4",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_QUAT_AUXPCM_RX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- .ops = &msm_aux_pcm_be_ops,
- },
- {
- .name = LPASS_BE_QUAT_AUXPCM_TX,
- .stream_name = "Quat AUX PCM Capture",
- .cpu_dai_name = "msm-dai-q6-auxpcm.4",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_QUAT_AUXPCM_TX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ignore_suspend = 1,
- .ops = &msm_aux_pcm_be_ops,
- },
- /* Quinary AUX PCM Backend DAI Links */
- {
- .name = LPASS_BE_QUIN_AUXPCM_RX,
- .stream_name = "Quin AUX PCM Playback",
- .cpu_dai_name = "msm-dai-q6-auxpcm.5",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_QUIN_AUXPCM_RX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- .ops = &msm_aux_pcm_be_ops,
- },
- {
- .name = LPASS_BE_QUIN_AUXPCM_TX,
- .stream_name = "Quin AUX PCM Capture",
- .cpu_dai_name = "msm-dai-q6-auxpcm.5",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_QUIN_AUXPCM_TX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ignore_suspend = 1,
- .ops = &msm_aux_pcm_be_ops,
- },
-};
-
-static struct snd_soc_dai_link msm_wcn_be_dai_links[] = {
- {
- .name = LPASS_BE_SLIMBUS_7_RX,
- .stream_name = "Slimbus7 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16398",
- .platform_name = "msm-pcm-routing",
- .codec_name = "btfmslim_slave",
- /* BT codec driver determines capabilities based on
- * dai name, bt codecdai name should always contains
- * supported usecase information
- */
- .codec_dai_name = "btfm_bt_sco_a2dp_slim_rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_7_RX,
- .be_hw_params_fixup = msm_ext_be_hw_params_fixup,
- .ops = &msm_wcn_ops,
- /* dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_7_TX,
- .stream_name = "Slimbus7 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16399",
- .platform_name = "msm-pcm-routing",
- .codec_name = "btfmslim_slave",
- .codec_dai_name = "btfm_bt_sco_slim_tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_7_TX,
- .be_hw_params_fixup = msm_ext_be_hw_params_fixup,
- .ops = &msm_wcn_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_8_TX,
- .stream_name = "Slimbus8 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16401",
- .platform_name = "msm-pcm-routing",
- .codec_name = "btfmslim_slave",
- .codec_dai_name = "btfm_fm_slim_tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_8_TX,
- .be_hw_params_fixup = msm_ext_be_hw_params_fixup,
- .init = &msm_wcn_init,
- .ops = &msm_wcn_ops,
- .ignore_suspend = 1,
- },
-};
-
-static struct snd_soc_dai_link ext_disp_be_dai_link[] = {
- /* DISP PORT BACK END DAI Link */
- {
- .name = LPASS_BE_DISPLAY_PORT,
- .stream_name = "Display Port Playback",
- .cpu_dai_name = "msm-dai-q6-dp.24608",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-ext-disp-audio-codec-rx",
- .codec_dai_name = "msm_dp_audio_codec_rx_dai",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_DISPLAY_PORT_RX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
-};
-
-static struct snd_soc_dai_link msm_ext_tasha_dai_links[
-ARRAY_SIZE(msm_ext_common_fe_dai) +
-ARRAY_SIZE(msm_ext_tasha_fe_dai) +
-ARRAY_SIZE(msm_ext_common_be_dai) +
-ARRAY_SIZE(msm_ext_tasha_be_dai) +
-ARRAY_SIZE(msm_mi2s_be_dai_links) +
-ARRAY_SIZE(msm_auxpcm_be_dai_links) +
-ARRAY_SIZE(msm_wcn_be_dai_links) +
-ARRAY_SIZE(ext_disp_be_dai_link)];
-
-static struct snd_soc_dai_link msm_ext_tavil_dai_links[
-ARRAY_SIZE(msm_ext_common_fe_dai) +
-ARRAY_SIZE(msm_ext_tavil_fe_dai) +
-ARRAY_SIZE(msm_ext_common_be_dai) +
-ARRAY_SIZE(msm_ext_tavil_be_dai) +
-ARRAY_SIZE(msm_mi2s_be_dai_links) +
-ARRAY_SIZE(msm_auxpcm_be_dai_links) +
-ARRAY_SIZE(msm_wcn_be_dai_links) +
-ARRAY_SIZE(ext_disp_be_dai_link)];
-
-/**
- * populate_snd_card_dailinks - prepares dailink array and initializes card.
- *
- * @dev: device handle
- *
- * Returns card on success or NULL on failure.
- */
-struct snd_soc_card *populate_snd_card_dailinks(struct device *dev,
- int snd_card_val)
-{
- struct snd_soc_card *card;
- struct snd_soc_dai_link *msm_ext_dai_links = NULL;
- int ret, len1, len2, len3, len4;
- enum codec_variant codec_ver = 0;
-
- if (snd_card_val == EXT_SND_CARD_TASHA) {
- card = &snd_soc_card_msm_card_tasha;
- } else if (snd_card_val == EXT_SND_CARD_TAVIL) {
- card = &snd_soc_card_msm_card_tavil;
- } else {
- dev_err(dev, "%s: failing as no matching card name\n",
- __func__);
- return NULL;
- }
-
- card->dev = dev;
- ret = snd_soc_of_parse_card_name(card, "qcom,model");
- if (ret) {
- dev_err(dev, "%s: parse card name failed, err:%d\n",
- __func__, ret);
- return NULL;
- }
-
- if (strnstr(card->name, "tasha", strlen(card->name))) {
- codec_ver = tasha_codec_ver();
- if (codec_ver == WCD9326) {
- card->name = "sdm670-tashalite-snd-card";
- } else if (codec_ver == WCD9XXX) {
- dev_err(dev, "%s: Invalid codec version %d\n",
- __func__, codec_ver);
- return NULL;
- }
-
- len1 = ARRAY_SIZE(msm_ext_common_fe_dai);
- len2 = len1 + ARRAY_SIZE(msm_ext_tasha_fe_dai);
- len3 = len2 + ARRAY_SIZE(msm_ext_common_be_dai);
- memcpy(msm_ext_tasha_dai_links, msm_ext_common_fe_dai,
- sizeof(msm_ext_common_fe_dai));
- memcpy(msm_ext_tasha_dai_links + len1,
- msm_ext_tasha_fe_dai, sizeof(msm_ext_tasha_fe_dai));
- memcpy(msm_ext_tasha_dai_links + len2,
- msm_ext_common_be_dai, sizeof(msm_ext_common_be_dai));
- memcpy(msm_ext_tasha_dai_links + len3,
- msm_ext_tasha_be_dai, sizeof(msm_ext_tasha_be_dai));
- len4 = len3 + ARRAY_SIZE(msm_ext_tasha_be_dai);
- if (of_property_read_bool(dev->of_node,
- "qcom,mi2s-audio-intf")) {
- memcpy(msm_ext_tasha_dai_links + len4,
- msm_mi2s_be_dai_links,
- sizeof(msm_mi2s_be_dai_links));
- len4 += ARRAY_SIZE(msm_mi2s_be_dai_links);
- }
- if (of_property_read_bool(dev->of_node,
- "qcom,auxpcm-audio-intf")) {
- memcpy(msm_ext_tasha_dai_links + len4,
- msm_auxpcm_be_dai_links,
- sizeof(msm_auxpcm_be_dai_links));
- len4 += ARRAY_SIZE(msm_auxpcm_be_dai_links);
- }
- if (of_property_read_bool(dev->of_node, "qcom,wcn-btfm")) {
- dev_dbg(dev, "%s(): WCN BTFM support present\n",
- __func__);
- memcpy(msm_ext_tasha_dai_links + len4,
- msm_wcn_be_dai_links,
- sizeof(msm_wcn_be_dai_links));
- len4 += ARRAY_SIZE(msm_wcn_be_dai_links);
- }
- if (of_property_read_bool(dev->of_node,
- "qcom,ext-disp-audio-rx")) {
- dev_dbg(dev, "%s(): ext disp audio support present\n",
- __func__);
- memcpy(msm_ext_tasha_dai_links + len4,
- ext_disp_be_dai_link,
- sizeof(ext_disp_be_dai_link));
- len4 += ARRAY_SIZE(ext_disp_be_dai_link);
- }
- msm_ext_dai_links = msm_ext_tasha_dai_links;
- } else if (strnstr(card->name, "tavil", strlen(card->name))) {
- len1 = ARRAY_SIZE(msm_ext_common_fe_dai);
- len2 = len1 + ARRAY_SIZE(msm_ext_tavil_fe_dai);
- len3 = len2 + ARRAY_SIZE(msm_ext_common_be_dai);
- memcpy(msm_ext_tavil_dai_links, msm_ext_common_fe_dai,
- sizeof(msm_ext_common_fe_dai));
- memcpy(msm_ext_tavil_dai_links + len1,
- msm_ext_tavil_fe_dai, sizeof(msm_ext_tavil_fe_dai));
- memcpy(msm_ext_tavil_dai_links + len2,
- msm_ext_common_be_dai, sizeof(msm_ext_common_be_dai));
- memcpy(msm_ext_tavil_dai_links + len3,
- msm_ext_tavil_be_dai, sizeof(msm_ext_tavil_be_dai));
- len4 = len3 + ARRAY_SIZE(msm_ext_tavil_be_dai);
- if (of_property_read_bool(dev->of_node,
- "qcom,mi2s-audio-intf")) {
- memcpy(msm_ext_tavil_dai_links + len4,
- msm_mi2s_be_dai_links,
- sizeof(msm_mi2s_be_dai_links));
- len4 += ARRAY_SIZE(msm_mi2s_be_dai_links);
- }
- if (of_property_read_bool(dev->of_node,
- "qcom,auxpcm-audio-intf")) {
- memcpy(msm_ext_tavil_dai_links + len4,
- msm_auxpcm_be_dai_links,
- sizeof(msm_auxpcm_be_dai_links));
- len4 += ARRAY_SIZE(msm_auxpcm_be_dai_links);
- }
- if (of_property_read_bool(dev->of_node, "qcom,wcn-btfm")) {
- dev_dbg(dev, "%s(): WCN BTFM support present\n",
- __func__);
- memcpy(msm_ext_tavil_dai_links + len4,
- msm_wcn_be_dai_links,
- sizeof(msm_wcn_be_dai_links));
- len4 += ARRAY_SIZE(msm_wcn_be_dai_links);
- }
- if (of_property_read_bool(dev->of_node,
- "qcom,ext-disp-audio-rx")) {
- dev_dbg(dev, "%s(): ext disp audio support present\n",
- __func__);
- memcpy(msm_ext_tavil_dai_links + len4,
- ext_disp_be_dai_link,
- sizeof(ext_disp_be_dai_link));
- len4 += ARRAY_SIZE(ext_disp_be_dai_link);
- }
- msm_ext_dai_links = msm_ext_tavil_dai_links;
- } else {
- dev_err(dev, "%s: failing as no matching card name\n",
- __func__);
- return NULL;
- }
- card->dai_link = msm_ext_dai_links;
- card->num_links = len4;
-
- return card;
-}
-EXPORT_SYMBOL(populate_snd_card_dailinks);
diff --git a/asoc/sdm660-external.c b/asoc/sdm660-external.c
deleted file mode 100644
index 8ff98ed..0000000
--- a/asoc/sdm660-external.c
+++ /dev/null
@@ -1,1882 +0,0 @@
-/* Copyright (c) 2015-2018, 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.
- */
-
-#include <linux/delay.h>
-#include <linux/of_gpio.h>
-#include <linux/platform_device.h>
-#include <linux/module.h>
-#include <sound/soc.h>
-#include <sound/pcm.h>
-#include <sound/pcm_params.h>
-#include <dsp/q6core.h>
-#include <dsp/audio_notifier.h>
-#include "msm-pcm-routing-v2.h"
-#include "sdm660-common.h"
-#include "sdm660-external.h"
-#include "codecs/wcd9335.h"
-#include "codecs/wcd934x/wcd934x.h"
-#include "codecs/wcd934x/wcd934x-mbhc.h"
-
-#define SDM660_SPK_ON 1
-#define SDM660_SPK_OFF 0
-
-#define WCD9XXX_MBHC_DEF_BUTTONS 8
-#define WCD9XXX_MBHC_DEF_RLOADS 5
-#define CODEC_EXT_CLK_RATE 9600000
-#define ADSP_STATE_READY_TIMEOUT_MS 3000
-
-#define WSA8810_NAME_1 "wsa881x.20170211"
-#define WSA8810_NAME_2 "wsa881x.20170212"
-
-static int msm_ext_spk_control = 1;
-static struct wcd_mbhc_config *wcd_mbhc_cfg_ptr;
-
-struct msm_asoc_wcd93xx_codec {
- void* (*get_afe_config_fn)(struct snd_soc_codec *codec,
- enum afe_config_type config_type);
- void (*mbhc_hs_detect_exit)(struct snd_soc_codec *codec);
-};
-
-static struct msm_asoc_wcd93xx_codec msm_codec_fn;
-static struct platform_device *spdev;
-
-static bool is_initial_boot;
-
-static void *def_ext_mbhc_cal(void);
-
-enum {
- SLIM_RX_0 = 0,
- SLIM_RX_1,
- SLIM_RX_2,
- SLIM_RX_3,
- SLIM_RX_4,
- SLIM_RX_5,
- SLIM_RX_6,
- SLIM_RX_7,
- SLIM_RX_MAX,
-};
-
-enum {
- SLIM_TX_0 = 0,
- SLIM_TX_1,
- SLIM_TX_2,
- SLIM_TX_3,
- SLIM_TX_4,
- SLIM_TX_5,
- SLIM_TX_6,
- SLIM_TX_7,
- SLIM_TX_8,
- SLIM_TX_MAX,
-};
-
-struct dev_config {
- u32 sample_rate;
- u32 bit_format;
- u32 channels;
-};
-
-/* Default configuration of slimbus channels */
-static struct dev_config slim_rx_cfg[] = {
- [SLIM_RX_0] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_RX_1] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_RX_2] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_RX_3] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_RX_4] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_RX_5] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_RX_6] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_RX_7] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
-};
-
-static struct dev_config slim_tx_cfg[] = {
- [SLIM_TX_0] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_TX_1] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_TX_2] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_TX_3] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_TX_4] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_TX_5] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_TX_6] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_TX_7] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_TX_8] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 2},
-};
-
-static int msm_vi_feed_tx_ch = 2;
-static const char *const slim_rx_ch_text[] = {"One", "Two"};
-static const char *const slim_tx_ch_text[] = {"One", "Two", "Three", "Four",
- "Five", "Six", "Seven",
- "Eight"};
-static const char *const vi_feed_ch_text[] = {"One", "Two"};
-static char const *bit_format_text[] = {"S16_LE", "S24_LE", "S24_3LE",
- "S32_LE"};
-static char const *slim_sample_rate_text[] = {"KHZ_8", "KHZ_16",
- "KHZ_32", "KHZ_44P1", "KHZ_48",
- "KHZ_88P2", "KHZ_96", "KHZ_176P4",
- "KHZ_192", "KHZ_352P8", "KHZ_384"};
-static const char *const spk_function_text[] = {"Off", "On"};
-static char const *bt_sample_rate_text[] = {"KHZ_8", "KHZ_16",
- "KHZ_44P1", "KHZ_48",
- "KHZ_88P2", "KHZ_96"};
-
-static SOC_ENUM_SINGLE_EXT_DECL(spk_func_en, spk_function_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_0_rx_chs, slim_rx_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_2_rx_chs, slim_rx_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_0_tx_chs, slim_tx_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_1_tx_chs, slim_tx_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_5_rx_chs, slim_rx_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_6_rx_chs, slim_rx_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(vi_feed_tx_chs, vi_feed_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_0_rx_format, bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_5_rx_format, bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_6_rx_format, bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_0_tx_format, bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_0_rx_sample_rate, slim_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_2_rx_sample_rate, slim_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_0_tx_sample_rate, slim_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_5_rx_sample_rate, slim_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_6_rx_sample_rate, slim_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(bt_sample_rate, bt_sample_rate_text);
-
-static int slim_get_sample_rate_val(int sample_rate)
-{
- int sample_rate_val = 0;
-
- switch (sample_rate) {
- case SAMPLING_RATE_8KHZ:
- sample_rate_val = 0;
- break;
- case SAMPLING_RATE_16KHZ:
- sample_rate_val = 1;
- break;
- case SAMPLING_RATE_32KHZ:
- sample_rate_val = 2;
- break;
- case SAMPLING_RATE_44P1KHZ:
- sample_rate_val = 3;
- break;
- case SAMPLING_RATE_48KHZ:
- sample_rate_val = 4;
- break;
- case SAMPLING_RATE_88P2KHZ:
- sample_rate_val = 5;
- break;
- case SAMPLING_RATE_96KHZ:
- sample_rate_val = 6;
- break;
- case SAMPLING_RATE_176P4KHZ:
- sample_rate_val = 7;
- break;
- case SAMPLING_RATE_192KHZ:
- sample_rate_val = 8;
- break;
- case SAMPLING_RATE_352P8KHZ:
- sample_rate_val = 9;
- break;
- case SAMPLING_RATE_384KHZ:
- sample_rate_val = 10;
- break;
- default:
- sample_rate_val = 4;
- break;
- }
- return sample_rate_val;
-}
-
-static int slim_get_sample_rate(int value)
-{
- int sample_rate = 0;
-
- switch (value) {
- case 0:
- sample_rate = SAMPLING_RATE_8KHZ;
- break;
- case 1:
- sample_rate = SAMPLING_RATE_16KHZ;
- break;
- case 2:
- sample_rate = SAMPLING_RATE_32KHZ;
- break;
- case 3:
- sample_rate = SAMPLING_RATE_44P1KHZ;
- break;
- case 4:
- sample_rate = SAMPLING_RATE_48KHZ;
- break;
- case 5:
- sample_rate = SAMPLING_RATE_88P2KHZ;
- break;
- case 6:
- sample_rate = SAMPLING_RATE_96KHZ;
- break;
- case 7:
- sample_rate = SAMPLING_RATE_176P4KHZ;
- break;
- case 8:
- sample_rate = SAMPLING_RATE_192KHZ;
- break;
- case 9:
- sample_rate = SAMPLING_RATE_352P8KHZ;
- break;
- case 10:
- sample_rate = SAMPLING_RATE_384KHZ;
- break;
- default:
- sample_rate = SAMPLING_RATE_48KHZ;
- break;
- }
- return sample_rate;
-}
-
-static int slim_get_bit_format_val(int bit_format)
-{
- int val = 0;
-
- switch (bit_format) {
- case SNDRV_PCM_FORMAT_S32_LE:
- val = 3;
- break;
- case SNDRV_PCM_FORMAT_S24_3LE:
- val = 2;
- break;
- case SNDRV_PCM_FORMAT_S24_LE:
- val = 1;
- break;
- case SNDRV_PCM_FORMAT_S16_LE:
- default:
- val = 0;
- break;
- }
- return val;
-}
-
-static int slim_get_bit_format(int val)
-{
- int bit_fmt = SNDRV_PCM_FORMAT_S16_LE;
-
- switch (val) {
- case 0:
- bit_fmt = SNDRV_PCM_FORMAT_S16_LE;
- break;
- case 1:
- bit_fmt = SNDRV_PCM_FORMAT_S24_LE;
- break;
- case 2:
- bit_fmt = SNDRV_PCM_FORMAT_S24_3LE;
- break;
- case 3:
- bit_fmt = SNDRV_PCM_FORMAT_S32_LE;
- break;
- default:
- bit_fmt = SNDRV_PCM_FORMAT_S16_LE;
- break;
- }
- return bit_fmt;
-}
-
-static int slim_get_port_idx(struct snd_kcontrol *kcontrol)
-{
- int port_id = 0;
-
- if (strnstr(kcontrol->id.name, "SLIM_0_RX", sizeof("SLIM_0_RX")))
- port_id = SLIM_RX_0;
- else if (strnstr(kcontrol->id.name, "SLIM_2_RX", sizeof("SLIM_2_RX")))
- port_id = SLIM_RX_2;
- else if (strnstr(kcontrol->id.name, "SLIM_5_RX", sizeof("SLIM_5_RX")))
- port_id = SLIM_RX_5;
- else if (strnstr(kcontrol->id.name, "SLIM_6_RX", sizeof("SLIM_6_RX")))
- port_id = SLIM_RX_6;
- else if (strnstr(kcontrol->id.name, "SLIM_0_TX", sizeof("SLIM_0_TX")))
- port_id = SLIM_TX_0;
- else if (strnstr(kcontrol->id.name, "SLIM_1_TX", sizeof("SLIM_1_TX")))
- port_id = SLIM_TX_1;
- else {
- pr_err("%s: unsupported channel: %s",
- __func__, kcontrol->id.name);
- return -EINVAL;
- }
-
- return port_id;
-}
-
-static int msm_bt_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- /*
- * Slimbus_7_Rx/Tx sample rate values should always be in sync (same)
- * when used for BT_SCO use case. Return either Rx or Tx sample rate
- * value.
- */
- switch (slim_rx_cfg[SLIM_RX_7].sample_rate) {
- case SAMPLING_RATE_96KHZ:
- ucontrol->value.integer.value[0] = 5;
- break;
- case SAMPLING_RATE_88P2KHZ:
- ucontrol->value.integer.value[0] = 4;
- break;
- case SAMPLING_RATE_48KHZ:
- ucontrol->value.integer.value[0] = 3;
- break;
- case SAMPLING_RATE_44P1KHZ:
- ucontrol->value.integer.value[0] = 2;
- break;
- case SAMPLING_RATE_16KHZ:
- ucontrol->value.integer.value[0] = 1;
- break;
- case SAMPLING_RATE_8KHZ:
- default:
- ucontrol->value.integer.value[0] = 0;
- break;
- }
- pr_debug("%s: sample rate = %d", __func__,
- slim_rx_cfg[SLIM_RX_7].sample_rate);
-
- return 0;
-}
-
-static int msm_bt_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- switch (ucontrol->value.integer.value[0]) {
- case 1:
- slim_rx_cfg[SLIM_RX_7].sample_rate = SAMPLING_RATE_16KHZ;
- slim_tx_cfg[SLIM_TX_7].sample_rate = SAMPLING_RATE_16KHZ;
- break;
- case 2:
- slim_rx_cfg[SLIM_RX_7].sample_rate = SAMPLING_RATE_44P1KHZ;
- slim_tx_cfg[SLIM_TX_7].sample_rate = SAMPLING_RATE_44P1KHZ;
- break;
- case 3:
- slim_rx_cfg[SLIM_RX_7].sample_rate = SAMPLING_RATE_48KHZ;
- slim_tx_cfg[SLIM_TX_7].sample_rate = SAMPLING_RATE_48KHZ;
- break;
- case 4:
- slim_rx_cfg[SLIM_RX_7].sample_rate = SAMPLING_RATE_88P2KHZ;
- slim_tx_cfg[SLIM_TX_7].sample_rate = SAMPLING_RATE_88P2KHZ;
- break;
- case 5:
- slim_rx_cfg[SLIM_RX_7].sample_rate = SAMPLING_RATE_96KHZ;
- slim_tx_cfg[SLIM_TX_7].sample_rate = SAMPLING_RATE_96KHZ;
- break;
- case 0:
- default:
- slim_rx_cfg[SLIM_RX_7].sample_rate = SAMPLING_RATE_8KHZ;
- slim_tx_cfg[SLIM_TX_7].sample_rate = SAMPLING_RATE_8KHZ;
- break;
- }
- pr_debug("%s: sample rates: slim7_rx = %d, slim7_tx = %d, value = %d\n",
- __func__,
- slim_rx_cfg[SLIM_RX_7].sample_rate,
- slim_tx_cfg[SLIM_TX_7].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int slim_rx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- ucontrol->value.enumerated.item[0] =
- slim_get_sample_rate_val(slim_rx_cfg[ch_num].sample_rate);
-
- pr_debug("%s: slim[%d]_rx_sample_rate = %d, item = %d\n", __func__,
- ch_num, slim_rx_cfg[ch_num].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int slim_rx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- slim_rx_cfg[ch_num].sample_rate =
- slim_get_sample_rate(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: slim[%d]_rx_sample_rate = %d, item = %d\n", __func__,
- ch_num, slim_rx_cfg[ch_num].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int slim_tx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- ucontrol->value.enumerated.item[0] =
- slim_get_sample_rate_val(slim_tx_cfg[ch_num].sample_rate);
-
- pr_debug("%s: slim[%d]_tx_sample_rate = %d, item = %d\n", __func__,
- ch_num, slim_tx_cfg[ch_num].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int slim_tx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int sample_rate = 0;
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- sample_rate = slim_get_sample_rate(ucontrol->value.enumerated.item[0]);
- if (sample_rate == SAMPLING_RATE_44P1KHZ) {
- pr_err("%s: Unsupported sample rate %d: for Tx path\n",
- __func__, sample_rate);
- return -EINVAL;
- }
- slim_tx_cfg[ch_num].sample_rate = sample_rate;
-
- pr_debug("%s: slim[%d]_tx_sample_rate = %d, value = %d\n", __func__,
- ch_num, slim_tx_cfg[ch_num].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int slim_rx_bit_format_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- ucontrol->value.enumerated.item[0] =
- slim_get_bit_format_val(slim_rx_cfg[ch_num].bit_format);
-
- pr_debug("%s: slim[%d]_rx_bit_format = %d, ucontrol value = %d\n",
- __func__, ch_num, slim_rx_cfg[ch_num].bit_format,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int slim_rx_bit_format_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- slim_rx_cfg[ch_num].bit_format =
- slim_get_bit_format(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: slim[%d]_rx_bit_format = %d, ucontrol value = %d\n",
- __func__, ch_num, slim_rx_cfg[ch_num].bit_format,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int slim_tx_bit_format_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- ucontrol->value.enumerated.item[0] =
- slim_get_bit_format_val(slim_tx_cfg[ch_num].bit_format);
-
- pr_debug("%s: slim[%d]_tx_bit_format = %d, ucontrol value = %d\n",
- __func__, ch_num, slim_tx_cfg[ch_num].bit_format,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int slim_tx_bit_format_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- slim_tx_cfg[ch_num].bit_format =
- slim_get_bit_format(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: slim[%d]_tx_bit_format = %d, ucontrol value = %d\n",
- __func__, ch_num, slim_tx_cfg[ch_num].bit_format,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int msm_slim_rx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- pr_debug("%s: msm_slim_[%d]_rx_ch = %d\n", __func__,
- ch_num, slim_rx_cfg[ch_num].channels);
- ucontrol->value.enumerated.item[0] = slim_rx_cfg[ch_num].channels - 1;
-
- return 0;
-}
-
-static int msm_slim_rx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- slim_rx_cfg[ch_num].channels = ucontrol->value.enumerated.item[0] + 1;
- pr_debug("%s: msm_slim_[%d]_rx_ch = %d\n", __func__,
- ch_num, slim_rx_cfg[ch_num].channels);
-
- return 1;
-}
-
-static int msm_slim_tx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- pr_debug("%s: msm_slim_[%d]_tx_ch = %d\n", __func__,
- ch_num, slim_tx_cfg[ch_num].channels);
- ucontrol->value.enumerated.item[0] = slim_tx_cfg[ch_num].channels - 1;
-
- return 0;
-}
-
-static int msm_slim_tx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- slim_tx_cfg[ch_num].channels = ucontrol->value.enumerated.item[0] + 1;
- pr_debug("%s: msm_slim_[%d]_tx_ch = %d\n", __func__,
- ch_num, slim_tx_cfg[ch_num].channels);
-
- return 1;
-}
-
-static int msm_vi_feed_tx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- ucontrol->value.integer.value[0] = msm_vi_feed_tx_ch - 1;
- pr_debug("%s: msm_vi_feed_tx_ch = %ld\n", __func__,
- ucontrol->value.integer.value[0]);
- return 0;
-}
-
-static int msm_vi_feed_tx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- msm_vi_feed_tx_ch = ucontrol->value.integer.value[0] + 1;
-
- pr_debug("%s: msm_vi_feed_tx_ch = %d\n", __func__, msm_vi_feed_tx_ch);
- return 1;
-}
-
-static void *def_ext_mbhc_cal(void)
-{
- void *wcd_mbhc_cal;
- struct wcd_mbhc_btn_detect_cfg *btn_cfg;
- u16 *btn_high;
-
- wcd_mbhc_cal = kzalloc(WCD_MBHC_CAL_SIZE(WCD_MBHC_DEF_BUTTONS,
- WCD9XXX_MBHC_DEF_RLOADS), GFP_KERNEL);
- if (!wcd_mbhc_cal)
- return NULL;
-
-#define S(X, Y) ((WCD_MBHC_CAL_PLUG_TYPE_PTR(wcd_mbhc_cal)->X) = (Y))
- S(v_hs_max, 1600);
-#undef S
-#define S(X, Y) ((WCD_MBHC_CAL_BTN_DET_PTR(wcd_mbhc_cal)->X) = (Y))
- S(num_btn, WCD_MBHC_DEF_BUTTONS);
-#undef S
-
- btn_cfg = WCD_MBHC_CAL_BTN_DET_PTR(wcd_mbhc_cal);
- btn_high = ((void *)&btn_cfg->_v_btn_low) +
- (sizeof(btn_cfg->_v_btn_low[0]) * btn_cfg->num_btn);
-
- btn_high[0] = 75;
- btn_high[1] = 150;
- btn_high[2] = 237;
- btn_high[3] = 500;
- btn_high[4] = 500;
- btn_high[5] = 500;
- btn_high[6] = 500;
- btn_high[7] = 500;
-
- return wcd_mbhc_cal;
-}
-
-static inline int param_is_mask(int p)
-{
- return (p >= SNDRV_PCM_HW_PARAM_FIRST_MASK) &&
- (p <= SNDRV_PCM_HW_PARAM_LAST_MASK);
-}
-
-static inline struct snd_mask *param_to_mask(struct snd_pcm_hw_params *p, int n)
-{
- return &(p->masks[n - SNDRV_PCM_HW_PARAM_FIRST_MASK]);
-}
-
-
-static void msm_ext_control(struct snd_soc_codec *codec)
-{
- struct snd_soc_dapm_context *dapm =
- snd_soc_codec_get_dapm(codec);
-
- pr_debug("%s: msm_ext_spk_control = %d", __func__, msm_ext_spk_control);
- if (msm_ext_spk_control == SDM660_SPK_ON) {
- snd_soc_dapm_enable_pin(dapm, "Lineout_1 amp");
- snd_soc_dapm_enable_pin(dapm, "Lineout_3 amp");
- } else {
- snd_soc_dapm_disable_pin(dapm, "Lineout_1 amp");
- snd_soc_dapm_disable_pin(dapm, "Lineout_3 amp");
- }
- snd_soc_dapm_sync(dapm);
-}
-
-static int msm_ext_get_spk(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- pr_debug("%s: msm_ext_spk_control = %d\n",
- __func__, msm_ext_spk_control);
- ucontrol->value.integer.value[0] = msm_ext_spk_control;
- return 0;
-}
-
-static int msm_ext_set_spk(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
-
- pr_debug("%s()\n", __func__);
- if (msm_ext_spk_control == ucontrol->value.integer.value[0])
- return 0;
-
- msm_ext_spk_control = ucontrol->value.integer.value[0];
- msm_ext_control(codec);
- return 1;
-}
-
-
-int msm_ext_enable_codec_mclk(struct snd_soc_codec *codec, int enable,
- bool dapm)
-{
- int ret;
-
- pr_debug("%s: enable = %d\n", __func__, enable);
-
- if (!strcmp(dev_name(codec->dev), "tasha_codec"))
- ret = tasha_cdc_mclk_enable(codec, enable, dapm);
- else if (!strcmp(dev_name(codec->dev), "tavil_codec"))
- ret = tavil_cdc_mclk_enable(codec, enable);
- else {
- dev_err(codec->dev, "%s: unknown codec to enable ext clk\n",
- __func__);
- ret = -EINVAL;
- }
- return ret;
-}
-
-static const struct snd_kcontrol_new msm_snd_controls[] = {
- SOC_ENUM_EXT("Speaker Function", spk_func_en, msm_ext_get_spk,
- msm_ext_set_spk),
- SOC_ENUM_EXT("SLIM_0_RX Channels", slim_0_rx_chs,
- msm_slim_rx_ch_get, msm_slim_rx_ch_put),
- SOC_ENUM_EXT("SLIM_2_RX Channels", slim_2_rx_chs,
- msm_slim_rx_ch_get, msm_slim_rx_ch_put),
- SOC_ENUM_EXT("SLIM_0_TX Channels", slim_0_tx_chs,
- msm_slim_tx_ch_get, msm_slim_tx_ch_put),
- SOC_ENUM_EXT("SLIM_1_TX Channels", slim_1_tx_chs,
- msm_slim_tx_ch_get, msm_slim_tx_ch_put),
- SOC_ENUM_EXT("SLIM_5_RX Channels", slim_5_rx_chs,
- msm_slim_rx_ch_get, msm_slim_rx_ch_put),
- SOC_ENUM_EXT("SLIM_6_RX Channels", slim_6_rx_chs,
- msm_slim_rx_ch_get, msm_slim_rx_ch_put),
- SOC_ENUM_EXT("VI_FEED_TX Channels", vi_feed_tx_chs,
- msm_vi_feed_tx_ch_get, msm_vi_feed_tx_ch_put),
- SOC_ENUM_EXT("SLIM_0_RX Format", slim_0_rx_format,
- slim_rx_bit_format_get, slim_rx_bit_format_put),
- SOC_ENUM_EXT("SLIM_5_RX Format", slim_5_rx_format,
- slim_rx_bit_format_get, slim_rx_bit_format_put),
- SOC_ENUM_EXT("SLIM_6_RX Format", slim_6_rx_format,
- slim_rx_bit_format_get, slim_rx_bit_format_put),
- SOC_ENUM_EXT("SLIM_0_TX Format", slim_0_tx_format,
- slim_tx_bit_format_get, slim_tx_bit_format_put),
- SOC_ENUM_EXT("SLIM_0_RX SampleRate", slim_0_rx_sample_rate,
- slim_rx_sample_rate_get, slim_rx_sample_rate_put),
- SOC_ENUM_EXT("SLIM_2_RX SampleRate", slim_2_rx_sample_rate,
- slim_rx_sample_rate_get, slim_rx_sample_rate_put),
- SOC_ENUM_EXT("SLIM_0_TX SampleRate", slim_0_tx_sample_rate,
- slim_tx_sample_rate_get, slim_tx_sample_rate_put),
- SOC_ENUM_EXT("SLIM_5_RX SampleRate", slim_5_rx_sample_rate,
- slim_rx_sample_rate_get, slim_rx_sample_rate_put),
- SOC_ENUM_EXT("SLIM_6_RX SampleRate", slim_6_rx_sample_rate,
- slim_rx_sample_rate_get, slim_rx_sample_rate_put),
- SOC_ENUM_EXT("BT SampleRate", bt_sample_rate,
- msm_bt_sample_rate_get,
- msm_bt_sample_rate_put),
-};
-
-static int msm_slim_get_ch_from_beid(int32_t id)
-{
- int ch_id = 0;
-
- switch (id) {
- case MSM_BACKEND_DAI_SLIMBUS_0_RX:
- ch_id = SLIM_RX_0;
- break;
- case MSM_BACKEND_DAI_SLIMBUS_1_RX:
- ch_id = SLIM_RX_1;
- break;
- case MSM_BACKEND_DAI_SLIMBUS_2_RX:
- ch_id = SLIM_RX_2;
- break;
- case MSM_BACKEND_DAI_SLIMBUS_3_RX:
- ch_id = SLIM_RX_3;
- break;
- case MSM_BACKEND_DAI_SLIMBUS_4_RX:
- ch_id = SLIM_RX_4;
- break;
- case MSM_BACKEND_DAI_SLIMBUS_6_RX:
- ch_id = SLIM_RX_6;
- break;
- case MSM_BACKEND_DAI_SLIMBUS_0_TX:
- ch_id = SLIM_TX_0;
- break;
- case MSM_BACKEND_DAI_SLIMBUS_3_TX:
- ch_id = SLIM_TX_3;
- break;
- default:
- ch_id = SLIM_RX_0;
- break;
- }
-
- return ch_id;
-}
-
-static void param_set_mask(struct snd_pcm_hw_params *p, int n, unsigned int bit)
-{
- if (bit >= SNDRV_MASK_MAX)
- return;
- if (param_is_mask(n)) {
- struct snd_mask *m = param_to_mask(p, n);
-
- m->bits[0] = 0;
- m->bits[1] = 0;
- m->bits[bit >> 5] |= (1 << (bit & 31));
- }
-}
-
-/**
- * msm_ext_be_hw_params_fixup - updates settings of ALSA BE hw params.
- *
- * @rtd: runtime dailink instance
- * @params: HW params of associated backend dailink.
- *
- * Returns 0 on success or rc on failure.
- */
-int msm_ext_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
- struct snd_pcm_hw_params *params)
-{
- struct snd_soc_dai_link *dai_link = rtd->dai_link;
- struct snd_interval *rate = hw_param_interval(params,
- SNDRV_PCM_HW_PARAM_RATE);
- struct snd_interval *channels = hw_param_interval(params,
- SNDRV_PCM_HW_PARAM_CHANNELS);
- int rc = 0;
- int idx;
- void *config = NULL;
- struct snd_soc_codec *codec = rtd->codec;
-
- pr_debug("%s: format = %d, rate = %d\n",
- __func__, params_format(params), params_rate(params));
-
- switch (dai_link->id) {
- case MSM_BACKEND_DAI_SLIMBUS_0_RX:
- case MSM_BACKEND_DAI_SLIMBUS_1_RX:
- case MSM_BACKEND_DAI_SLIMBUS_2_RX:
- case MSM_BACKEND_DAI_SLIMBUS_3_RX:
- case MSM_BACKEND_DAI_SLIMBUS_4_RX:
- case MSM_BACKEND_DAI_SLIMBUS_6_RX:
- idx = msm_slim_get_ch_from_beid(dai_link->id);
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- slim_rx_cfg[idx].bit_format);
- rate->min = rate->max = slim_rx_cfg[idx].sample_rate;
- channels->min = channels->max = slim_rx_cfg[idx].channels;
- break;
-
- case MSM_BACKEND_DAI_SLIMBUS_0_TX:
- case MSM_BACKEND_DAI_SLIMBUS_3_TX:
- idx = msm_slim_get_ch_from_beid(dai_link->id);
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- slim_tx_cfg[idx].bit_format);
- rate->min = rate->max = slim_tx_cfg[idx].sample_rate;
- channels->min = channels->max = slim_tx_cfg[idx].channels;
- break;
-
- case MSM_BACKEND_DAI_SLIMBUS_1_TX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- slim_tx_cfg[1].bit_format);
- rate->min = rate->max = slim_tx_cfg[1].sample_rate;
- channels->min = channels->max = slim_tx_cfg[1].channels;
- break;
-
- case MSM_BACKEND_DAI_SLIMBUS_4_TX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- SNDRV_PCM_FORMAT_S32_LE);
- rate->min = rate->max = SAMPLING_RATE_8KHZ;
- channels->min = channels->max = msm_vi_feed_tx_ch;
- break;
-
- case MSM_BACKEND_DAI_SLIMBUS_5_RX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- slim_rx_cfg[5].bit_format);
- rate->min = rate->max = slim_rx_cfg[5].sample_rate;
- channels->min = channels->max = slim_rx_cfg[5].channels;
- break;
-
- case MSM_BACKEND_DAI_SLIMBUS_5_TX:
- rate->min = rate->max = SAMPLING_RATE_16KHZ;
- channels->min = channels->max = 1;
-
- config = msm_codec_fn.get_afe_config_fn(codec,
- AFE_SLIMBUS_SLAVE_PORT_CONFIG);
- if (config) {
- rc = afe_set_config(AFE_SLIMBUS_SLAVE_PORT_CONFIG,
- config, SLIMBUS_5_TX);
- if (rc)
- pr_err("%s: Failed to set slimbus slave port config %d\n",
- __func__, rc);
- }
- break;
-
- case MSM_BACKEND_DAI_SLIMBUS_7_RX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- slim_rx_cfg[SLIM_RX_7].bit_format);
- rate->min = rate->max = slim_rx_cfg[SLIM_RX_7].sample_rate;
- channels->min = channels->max =
- slim_rx_cfg[SLIM_RX_7].channels;
- break;
-
- case MSM_BACKEND_DAI_SLIMBUS_7_TX:
- rate->min = rate->max = slim_tx_cfg[SLIM_TX_7].sample_rate;
- channels->min = channels->max =
- slim_tx_cfg[SLIM_TX_7].channels;
- break;
-
- case MSM_BACKEND_DAI_SLIMBUS_8_TX:
- rate->min = rate->max = slim_tx_cfg[SLIM_TX_8].sample_rate;
- channels->min = channels->max =
- slim_tx_cfg[SLIM_TX_8].channels;
- break;
-
- default:
- rate->min = rate->max = SAMPLING_RATE_48KHZ;
- break;
- }
- return rc;
-}
-EXPORT_SYMBOL(msm_ext_be_hw_params_fixup);
-
-/**
- * msm_snd_hw_params - hw params ops of backend dailink.
- *
- * @substream: PCM stream of associated backend dailink.
- * @params: HW params of associated backend dailink.
- *
- * Returns 0 on success or ret on failure.
- */
-int msm_snd_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- struct snd_soc_dai_link *dai_link = rtd->dai_link;
-
- int ret = 0;
- u32 rx_ch[SLIM_MAX_RX_PORTS], tx_ch[SLIM_MAX_TX_PORTS];
- u32 rx_ch_cnt = 0, tx_ch_cnt = 0;
- u32 user_set_tx_ch = 0;
- u32 rx_ch_count;
-
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
- ret = snd_soc_dai_get_channel_map(codec_dai,
- &tx_ch_cnt, tx_ch, &rx_ch_cnt, rx_ch);
- if (ret < 0) {
- pr_err("%s: failed to get codec chan map, err:%d\n",
- __func__, ret);
- goto err_ch_map;
- }
- if (dai_link->id == MSM_BACKEND_DAI_SLIMBUS_5_RX) {
- pr_debug("%s: rx_5_ch=%d\n", __func__,
- slim_rx_cfg[5].channels);
- rx_ch_count = slim_rx_cfg[5].channels;
- } else if (dai_link->id == MSM_BACKEND_DAI_SLIMBUS_2_RX) {
- pr_debug("%s: rx_2_ch=%d\n", __func__,
- slim_rx_cfg[2].channels);
- rx_ch_count = slim_rx_cfg[2].channels;
- } else if (dai_link->id == MSM_BACKEND_DAI_SLIMBUS_6_RX) {
- pr_debug("%s: rx_6_ch=%d\n", __func__,
- slim_rx_cfg[6].channels);
- rx_ch_count = slim_rx_cfg[6].channels;
- } else {
- pr_debug("%s: rx_0_ch=%d\n", __func__,
- slim_rx_cfg[0].channels);
- rx_ch_count = slim_rx_cfg[0].channels;
- }
- ret = snd_soc_dai_set_channel_map(cpu_dai, 0, 0,
- rx_ch_count, rx_ch);
- if (ret < 0) {
- pr_err("%s: failed to set cpu chan map, err:%d\n",
- __func__, ret);
- goto err_ch_map;
- }
- } else {
- pr_debug("%s: %s_tx_dai_id_%d_ch=%d\n", __func__,
- codec_dai->name, codec_dai->id, user_set_tx_ch);
- ret = snd_soc_dai_get_channel_map(codec_dai,
- &tx_ch_cnt, tx_ch, &rx_ch_cnt, rx_ch);
- if (ret < 0) {
- pr_err("%s: failed to get codec chan map\n, err:%d\n",
- __func__, ret);
- goto err_ch_map;
- }
- /* For <codec>_tx1 case */
- if (dai_link->id == MSM_BACKEND_DAI_SLIMBUS_0_TX)
- user_set_tx_ch = slim_tx_cfg[0].channels;
- /* For <codec>_tx3 case */
- else if (dai_link->id == MSM_BACKEND_DAI_SLIMBUS_1_TX)
- user_set_tx_ch = slim_tx_cfg[1].channels;
- else if (dai_link->id == MSM_BACKEND_DAI_SLIMBUS_4_TX)
- user_set_tx_ch = msm_vi_feed_tx_ch;
- else
- user_set_tx_ch = tx_ch_cnt;
-
- pr_debug("%s: msm_slim_0_tx_ch(%d) user_set_tx_ch(%d) tx_ch_cnt(%d), id (%d)\n",
- __func__, slim_tx_cfg[0].channels, user_set_tx_ch,
- tx_ch_cnt, dai_link->id);
-
- ret = snd_soc_dai_set_channel_map(cpu_dai,
- user_set_tx_ch, tx_ch, 0, 0);
- if (ret < 0)
- pr_err("%s: failed to set cpu chan map, err:%d\n",
- __func__, ret);
- }
-
-err_ch_map:
- return ret;
-}
-EXPORT_SYMBOL(msm_snd_hw_params);
-
-/**
- * msm_ext_slimbus_2_hw_params - hw params ops of slimbus_2 BE.
- *
- * @substream: PCM stream of associated backend dailink.
- * @params: HW params of associated backend dailink.
- *
- * Returns 0 on success or ret on failure.
- */
-int msm_ext_slimbus_2_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- int ret = 0;
- unsigned int rx_ch[SLIM_MAX_RX_PORTS], tx_ch[SLIM_MAX_TX_PORTS];
- unsigned int rx_ch_cnt = 0, tx_ch_cnt = 0;
- unsigned int num_tx_ch = 0;
- unsigned int num_rx_ch = 0;
-
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
- num_rx_ch = params_channels(params);
- pr_debug("%s: %s rx_dai_id = %d num_ch = %d\n", __func__,
- codec_dai->name, codec_dai->id, num_rx_ch);
- ret = snd_soc_dai_get_channel_map(codec_dai,
- &tx_ch_cnt, tx_ch, &rx_ch_cnt, rx_ch);
- if (ret < 0) {
- pr_err("%s: failed to get codec chan map, err:%d\n",
- __func__, ret);
- goto end;
- }
- ret = snd_soc_dai_set_channel_map(cpu_dai, 0, 0,
- num_rx_ch, rx_ch);
- if (ret < 0) {
- pr_err("%s: failed to set cpu chan map, err:%d\n",
- __func__, ret);
- goto end;
- }
- } else {
- num_tx_ch = params_channels(params);
- pr_debug("%s: %s tx_dai_id = %d num_ch = %d\n", __func__,
- codec_dai->name, codec_dai->id, num_tx_ch);
- ret = snd_soc_dai_get_channel_map(codec_dai,
- &tx_ch_cnt, tx_ch, &rx_ch_cnt, rx_ch);
- if (ret < 0) {
- pr_err("%s: failed to get codec chan map, err:%d\n",
- __func__, ret);
- goto end;
- }
- ret = snd_soc_dai_set_channel_map(cpu_dai,
- num_tx_ch, tx_ch, 0, 0);
- if (ret < 0) {
- pr_err("%s: failed to set cpu chan map, err:%d\n",
- __func__, ret);
- goto end;
- }
- }
-end:
- return ret;
-}
-EXPORT_SYMBOL(msm_ext_slimbus_2_hw_params);
-
-/**
- * msm_snd_cpe_hw_params - hw params ops of CPE backend.
- *
- * @substream: PCM stream of associated backend dailink.
- * @params: HW params of associated backend dailink.
- *
- * Returns 0 on success or ret on failure.
- */
-int msm_snd_cpe_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- struct snd_soc_dai_link *dai_link = rtd->dai_link;
- int ret = 0;
- u32 tx_ch[SLIM_MAX_TX_PORTS];
- u32 tx_ch_cnt = 0;
-
- if (substream->stream != SNDRV_PCM_STREAM_CAPTURE) {
- pr_err("%s: Invalid stream type %d\n",
- __func__, substream->stream);
- ret = -EINVAL;
- goto end;
- }
-
- pr_debug("%s: %s_tx_dai_id_%d\n", __func__,
- codec_dai->name, codec_dai->id);
- ret = snd_soc_dai_get_channel_map(codec_dai,
- &tx_ch_cnt, tx_ch, NULL, NULL);
- if (ret < 0) {
- pr_err("%s: failed to get codec chan map\n, err:%d\n",
- __func__, ret);
- goto end;
- }
-
- pr_debug("%s: tx_ch_cnt(%d) id %d\n",
- __func__, tx_ch_cnt, dai_link->id);
-
- ret = snd_soc_dai_set_channel_map(cpu_dai,
- tx_ch_cnt, tx_ch, 0, 0);
- if (ret < 0) {
- pr_err("%s: failed to set cpu chan map, err:%d\n",
- __func__, ret);
- goto end;
- }
-end:
- return ret;
-}
-EXPORT_SYMBOL(msm_snd_cpe_hw_params);
-
-static int msm_afe_set_config(struct snd_soc_codec *codec)
-{
- int rc;
- void *config_data;
-
- pr_debug("%s: enter\n", __func__);
-
- if (!msm_codec_fn.get_afe_config_fn) {
- dev_err(codec->dev, "%s: codec get afe config not init'ed\n",
- __func__);
- return -EINVAL;
- }
- config_data = msm_codec_fn.get_afe_config_fn(codec,
- AFE_CDC_REGISTERS_CONFIG);
- if (config_data) {
- rc = afe_set_config(AFE_CDC_REGISTERS_CONFIG, config_data, 0);
- if (rc) {
- pr_err("%s: Failed to set codec registers config %d\n",
- __func__, rc);
- return rc;
- }
- }
-
- config_data = msm_codec_fn.get_afe_config_fn(codec,
- AFE_CDC_REGISTER_PAGE_CONFIG);
- if (config_data) {
- rc = afe_set_config(AFE_CDC_REGISTER_PAGE_CONFIG, config_data,
- 0);
- if (rc)
- pr_err("%s: Failed to set cdc register page config\n",
- __func__);
- }
-
- config_data = msm_codec_fn.get_afe_config_fn(codec,
- AFE_SLIMBUS_SLAVE_CONFIG);
- if (config_data) {
- rc = afe_set_config(AFE_SLIMBUS_SLAVE_CONFIG, config_data, 0);
- if (rc) {
- pr_err("%s: Failed to set slimbus slave config %d\n",
- __func__, rc);
- return rc;
- }
- }
-
- config_data = msm_codec_fn.get_afe_config_fn(codec,
- AFE_AANC_VERSION);
- if (config_data) {
- rc = afe_set_config(AFE_AANC_VERSION, config_data, 0);
- if (rc) {
- pr_err("%s: Failed to set AANC version %d\n",
- __func__, rc);
- return rc;
- }
- }
-
- config_data = msm_codec_fn.get_afe_config_fn(codec,
- AFE_CDC_CLIP_REGISTERS_CONFIG);
- if (config_data) {
- rc = afe_set_config(AFE_CDC_CLIP_REGISTERS_CONFIG,
- config_data, 0);
- if (rc) {
- pr_err("%s: Failed to set clip registers %d\n",
- __func__, rc);
- return rc;
- }
- }
-
- config_data = msm_codec_fn.get_afe_config_fn(codec,
- AFE_CLIP_BANK_SEL);
- if (config_data) {
- rc = afe_set_config(AFE_CLIP_BANK_SEL,
- config_data, 0);
- if (rc) {
- pr_err("%s: Failed to set AFE bank selection %d\n",
- __func__, rc);
- return rc;
- }
- }
-
- config_data = msm_codec_fn.get_afe_config_fn(codec,
- AFE_CDC_REGISTER_PAGE_CONFIG);
- if (config_data) {
- rc = afe_set_config(AFE_CDC_REGISTER_PAGE_CONFIG, config_data,
- 0);
- if (rc)
- pr_err("%s: Failed to set cdc register page config\n",
- __func__);
- }
-
- return 0;
-}
-
-static void msm_afe_clear_config(void)
-{
- afe_clear_config(AFE_CDC_REGISTERS_CONFIG);
- afe_clear_config(AFE_SLIMBUS_SLAVE_CONFIG);
-}
-
-static int msm_adsp_power_up_config(struct snd_soc_codec *codec,
- struct snd_card *card)
-{
- int ret = 0;
- unsigned long timeout;
- int adsp_ready = 0;
- bool snd_card_online = 0;
-
- timeout = jiffies +
- msecs_to_jiffies(ADSP_STATE_READY_TIMEOUT_MS);
-
- do {
- if (!snd_card_online) {
- snd_card_online = snd_card_is_online_state(card);
- pr_debug("%s: Sound card is %s\n", __func__,
- snd_card_online ? "Online" : "Offline");
- }
- if (!adsp_ready) {
- adsp_ready = q6core_is_adsp_ready();
- pr_debug("%s: ADSP Audio is %s\n", __func__,
- adsp_ready ? "ready" : "not ready");
- }
- if (snd_card_online && adsp_ready)
- break;
-
- /*
- * Sound card/ADSP will be coming up after subsystem restart and
- * it might not be fully up when the control reaches
- * here. So, wait for 50msec before checking ADSP state
- */
- msleep(50);
- } while (time_after(timeout, jiffies));
-
- if (!snd_card_online || !adsp_ready) {
- pr_err("%s: Timeout. Sound card is %s, ADSP Audio is %s\n",
- __func__,
- snd_card_online ? "Online" : "Offline",
- adsp_ready ? "ready" : "not ready");
- ret = -ETIMEDOUT;
- goto err_fail;
- }
-
- ret = msm_afe_set_config(codec);
- if (ret)
- pr_err("%s: Failed to set AFE config. err %d\n",
- __func__, ret);
-
- return 0;
-
-err_fail:
- return ret;
-}
-
-static int sdm660_notifier_service_cb(struct notifier_block *this,
- unsigned long opcode, void *ptr)
-{
- int ret;
- struct snd_soc_card *card = NULL;
- const char *be_dl_name = LPASS_BE_SLIMBUS_0_RX;
- struct snd_soc_pcm_runtime *rtd;
- struct snd_soc_codec *codec;
-
- pr_debug("%s: Service opcode 0x%lx\n", __func__, opcode);
-
- switch (opcode) {
- case AUDIO_NOTIFIER_SERVICE_DOWN:
- /*
- * Use flag to ignore initial boot notifications
- * On initial boot msm_adsp_power_up_config is
- * called on init. There is no need to clear
- * and set the config again on initial boot.
- */
- if (is_initial_boot)
- break;
- msm_afe_clear_config();
- break;
- case AUDIO_NOTIFIER_SERVICE_UP:
- if (is_initial_boot) {
- is_initial_boot = false;
- break;
- }
- if (!spdev)
- return -EINVAL;
-
- card = platform_get_drvdata(spdev);
- rtd = snd_soc_get_pcm_runtime(card, be_dl_name);
- if (!rtd) {
- dev_err(card->dev,
- "%s: snd_soc_get_pcm_runtime for %s failed!\n",
- __func__, be_dl_name);
- ret = -EINVAL;
- goto done;
- }
- codec = rtd->codec;
-
- ret = msm_adsp_power_up_config(codec, card->snd_card);
- if (ret < 0) {
- dev_err(card->dev,
- "%s: msm_adsp_power_up_config failed ret = %d!\n",
- __func__, ret);
- goto done;
- }
- break;
- default:
- break;
- }
-done:
- return NOTIFY_OK;
-}
-
-static struct notifier_block service_nb = {
- .notifier_call = sdm660_notifier_service_cb,
- .priority = -INT_MAX,
-};
-
-static int msm_config_hph_en0_gpio(struct snd_soc_codec *codec, bool high)
-{
- struct snd_soc_card *card = codec->component.card;
- struct msm_asoc_mach_data *pdata;
- int val;
-
- if (!card)
- return 0;
-
- pdata = snd_soc_card_get_drvdata(card);
- if (!pdata || !gpio_is_valid(pdata->hph_en0_gpio))
- return 0;
-
- val = gpio_get_value_cansleep(pdata->hph_en0_gpio);
- if ((!!val) == high)
- return 0;
-
- gpio_direction_output(pdata->hph_en0_gpio, (int)high);
-
- return 1;
-}
-
-static int msm_snd_enable_codec_ext_tx_clk(struct snd_soc_codec *codec,
- int enable, bool dapm)
-{
- int ret = 0;
-
- if (!strcmp(dev_name(codec->dev), "tasha_codec"))
- ret = tasha_cdc_mclk_tx_enable(codec, enable, dapm);
- else {
- dev_err(codec->dev, "%s: unknown codec to enable ext clk\n",
- __func__);
- ret = -EINVAL;
- }
- return ret;
-}
-
-static int msm_ext_mclk_tx_event(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol, int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
-
- pr_debug("%s: event = %d\n", __func__, event);
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- return msm_snd_enable_codec_ext_tx_clk(codec, 1, true);
- case SND_SOC_DAPM_POST_PMD:
- return msm_snd_enable_codec_ext_tx_clk(codec, 0, true);
- }
- return 0;
-}
-
-static int msm_ext_mclk_event(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol, int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
-
- pr_debug("%s: event = %d\n", __func__, event);
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- return msm_ext_enable_codec_mclk(codec, 1, true);
- case SND_SOC_DAPM_POST_PMD:
- return msm_ext_enable_codec_mclk(codec, 0, true);
- }
- return 0;
-}
-
-static int msm_ext_prepare_hifi(struct msm_asoc_mach_data *pdata)
-{
- int ret = 0;
-
- if (gpio_is_valid(pdata->hph_en1_gpio)) {
- pr_debug("%s: hph_en1_gpio request %d\n", __func__,
- pdata->hph_en1_gpio);
- ret = gpio_request(pdata->hph_en1_gpio, "hph_en1_gpio");
- if (ret) {
- pr_err("%s: hph_en1_gpio request failed, ret:%d\n",
- __func__, ret);
- goto err;
- }
- }
- if (gpio_is_valid(pdata->hph_en0_gpio)) {
- pr_debug("%s: hph_en0_gpio request %d\n", __func__,
- pdata->hph_en0_gpio);
- ret = gpio_request(pdata->hph_en0_gpio, "hph_en0_gpio");
- if (ret)
- pr_err("%s: hph_en0_gpio request failed, ret:%d\n",
- __func__, ret);
- }
-
-err:
- return ret;
-}
-
-static const struct snd_soc_dapm_widget msm_dapm_widgets[] = {
-
- SND_SOC_DAPM_SUPPLY_S("MCLK", -1, SND_SOC_NOPM, 0, 0,
- msm_ext_mclk_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_SUPPLY_S("MCLK TX", -1, SND_SOC_NOPM, 0, 0,
- msm_ext_mclk_tx_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_SPK("Lineout_1 amp", NULL),
- SND_SOC_DAPM_SPK("Lineout_3 amp", NULL),
- SND_SOC_DAPM_SPK("Lineout_2 amp", NULL),
- SND_SOC_DAPM_SPK("Lineout_4 amp", NULL),
- SND_SOC_DAPM_MIC("Handset Mic", NULL),
- SND_SOC_DAPM_MIC("Headset Mic", NULL),
- SND_SOC_DAPM_MIC("Secondary Mic", NULL),
- SND_SOC_DAPM_MIC("ANCRight Headset Mic", NULL),
- SND_SOC_DAPM_MIC("ANCLeft Headset Mic", NULL),
- SND_SOC_DAPM_MIC("Analog Mic4", NULL),
- SND_SOC_DAPM_MIC("Analog Mic6", NULL),
- SND_SOC_DAPM_MIC("Analog Mic7", NULL),
- SND_SOC_DAPM_MIC("Analog Mic8", NULL),
-
- SND_SOC_DAPM_MIC("Digital Mic0", NULL),
- SND_SOC_DAPM_MIC("Digital Mic1", NULL),
- SND_SOC_DAPM_MIC("Digital Mic2", NULL),
- SND_SOC_DAPM_MIC("Digital Mic3", NULL),
- SND_SOC_DAPM_MIC("Digital Mic4", NULL),
- SND_SOC_DAPM_MIC("Digital Mic5", NULL),
- SND_SOC_DAPM_MIC("Digital Mic6", NULL),
-};
-
-static struct snd_soc_dapm_route wcd_audio_paths_tasha[] = {
- {"MIC BIAS1", NULL, "MCLK TX"},
- {"MIC BIAS2", NULL, "MCLK TX"},
- {"MIC BIAS3", NULL, "MCLK TX"},
- {"MIC BIAS4", NULL, "MCLK TX"},
-};
-
-static struct snd_soc_dapm_route wcd_audio_paths[] = {
- {"MIC BIAS1", NULL, "MCLK"},
- {"MIC BIAS2", NULL, "MCLK"},
- {"MIC BIAS3", NULL, "MCLK"},
- {"MIC BIAS4", NULL, "MCLK"},
-};
-
-int msm_snd_card_tasha_late_probe(struct snd_soc_card *card)
-{
- const char *be_dl_name = LPASS_BE_SLIMBUS_0_RX;
- struct snd_soc_pcm_runtime *rtd;
- int ret = 0;
- void *mbhc_calibration;
-
- rtd = snd_soc_get_pcm_runtime(card, be_dl_name);
- if (!rtd) {
- dev_err(card->dev,
- "%s: snd_soc_get_pcm_runtime for %s failed!\n",
- __func__, be_dl_name);
- ret = -EINVAL;
- goto err_pcm_runtime;
- }
-
- mbhc_calibration = def_ext_mbhc_cal();
- if (!mbhc_calibration) {
- ret = -ENOMEM;
- goto err_mbhc_cal;
- }
- wcd_mbhc_cfg_ptr->calibration = mbhc_calibration;
- ret = tasha_mbhc_hs_detect(rtd->codec, wcd_mbhc_cfg_ptr);
- if (ret) {
- dev_err(card->dev, "%s: mbhc hs detect failed, err:%d\n",
- __func__, ret);
- goto err_hs_detect;
- }
- return 0;
-
-err_hs_detect:
- kfree(mbhc_calibration);
-err_mbhc_cal:
-err_pcm_runtime:
- return ret;
-}
-
-int msm_snd_card_tavil_late_probe(struct snd_soc_card *card)
-{
- const char *be_dl_name = LPASS_BE_SLIMBUS_0_RX;
- struct snd_soc_pcm_runtime *rtd;
- int ret = 0;
- void *mbhc_calibration;
-
- rtd = snd_soc_get_pcm_runtime(card, be_dl_name);
- if (!rtd) {
- dev_err(card->dev,
- "%s: snd_soc_get_pcm_runtime for %s failed!\n",
- __func__, be_dl_name);
- ret = -EINVAL;
- goto err;
- }
-
- mbhc_calibration = def_ext_mbhc_cal();
- if (!mbhc_calibration) {
- ret = -ENOMEM;
- goto err;
- }
- wcd_mbhc_cfg_ptr->calibration = mbhc_calibration;
- ret = tavil_mbhc_hs_detect(rtd->codec, wcd_mbhc_cfg_ptr);
- if (ret) {
- dev_err(card->dev, "%s: mbhc hs detect failed, err:%d\n",
- __func__, ret);
- goto err_free_mbhc_cal;
- }
- return 0;
-
-err_free_mbhc_cal:
- kfree(mbhc_calibration);
-err:
- return ret;
-}
-
-/**
- * msm_audrx_init - Audio init function of sound card instantiate.
- *
- * @rtd: runtime dailink instance
- *
- * Returns 0 on success or ret on failure.
- */
-int msm_audrx_init(struct snd_soc_pcm_runtime *rtd)
-{
- int ret;
- void *config_data;
- struct snd_soc_codec *codec = rtd->codec;
- struct snd_soc_dapm_context *dapm =
- snd_soc_codec_get_dapm(codec);
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
- struct snd_soc_component *aux_comp;
- struct snd_card *card;
- struct snd_info_entry *entry;
- struct msm_asoc_mach_data *pdata =
- snd_soc_card_get_drvdata(rtd->card);
-
- /* Codec SLIMBUS configuration
- * RX1, RX2, RX3, RX4, RX5, RX6, RX7, RX8, RX9, RX10, RX11, RX12, RX13
- * TX1, TX2, TX3, TX4, TX5, TX6, TX7, TX8, TX9, TX10, TX11, TX12, TX13
- * TX14, TX15, TX16
- */
- unsigned int rx_ch[TASHA_RX_MAX] = {144, 145, 146, 147, 148, 149, 150,
- 151, 152, 153, 154, 155, 156};
- unsigned int tx_ch[TASHA_TX_MAX] = {128, 129, 130, 131, 132, 133,
- 134, 135, 136, 137, 138, 139,
- 140, 141, 142, 143};
-
- /* Tavil Codec SLIMBUS configuration
- * RX1, RX2, RX3, RX4, RX5, RX6, RX7, RX8
- * TX1, TX2, TX3, TX4, TX5, TX6, TX7, TX8, TX9, TX10, TX11, TX12, TX13
- * TX14, TX15, TX16
- */
- unsigned int rx_ch_tavil[WCD934X_RX_MAX] = {144, 145, 146, 147, 148,
- 149, 150, 151};
- unsigned int tx_ch_tavil[WCD934X_TX_MAX] = {128, 129, 130, 131, 132,
- 133, 134, 135, 136, 137, 138,
- 139, 140, 141, 142, 143};
-
- pr_debug("%s: dev_name%s\n", __func__, dev_name(cpu_dai->dev));
-
- rtd->pmdown_time = 0;
-
- ret = snd_soc_add_codec_controls(codec, msm_snd_controls,
- ARRAY_SIZE(msm_snd_controls));
- if (ret < 0) {
- pr_err("%s: add_codec_controls failed: %d\n",
- __func__, ret);
- return ret;
- }
-
- ret = snd_soc_add_codec_controls(codec, msm_common_snd_controls,
- msm_common_snd_controls_size());
- if (ret < 0) {
- pr_err("%s: add_common_snd_controls failed: %d\n",
- __func__, ret);
- return ret;
- }
-
- snd_soc_dapm_new_controls(dapm, msm_dapm_widgets,
- ARRAY_SIZE(msm_dapm_widgets));
-
- if (!strcmp(dev_name(codec_dai->dev), "tasha_codec"))
- snd_soc_dapm_add_routes(dapm, wcd_audio_paths_tasha,
- ARRAY_SIZE(wcd_audio_paths_tasha));
- else
- snd_soc_dapm_add_routes(dapm, wcd_audio_paths,
- ARRAY_SIZE(wcd_audio_paths));
-
- snd_soc_dapm_enable_pin(dapm, "Lineout_1 amp");
- snd_soc_dapm_enable_pin(dapm, "Lineout_3 amp");
- snd_soc_dapm_enable_pin(dapm, "Lineout_2 amp");
- snd_soc_dapm_enable_pin(dapm, "Lineout_4 amp");
-
- snd_soc_dapm_ignore_suspend(dapm, "MADINPUT");
- snd_soc_dapm_ignore_suspend(dapm, "MAD_CPE_INPUT");
- snd_soc_dapm_ignore_suspend(dapm, "Handset Mic");
- snd_soc_dapm_ignore_suspend(dapm, "Headset Mic");
- snd_soc_dapm_ignore_suspend(dapm, "Secondary Mic");
- snd_soc_dapm_ignore_suspend(dapm, "Lineout_1 amp");
- snd_soc_dapm_ignore_suspend(dapm, "Lineout_3 amp");
- snd_soc_dapm_ignore_suspend(dapm, "Lineout_2 amp");
- snd_soc_dapm_ignore_suspend(dapm, "Lineout_4 amp");
- snd_soc_dapm_ignore_suspend(dapm, "ANCRight Headset Mic");
- snd_soc_dapm_ignore_suspend(dapm, "ANCLeft Headset Mic");
- snd_soc_dapm_ignore_suspend(dapm, "Digital Mic0");
- snd_soc_dapm_ignore_suspend(dapm, "Digital Mic1");
- snd_soc_dapm_ignore_suspend(dapm, "Digital Mic2");
- snd_soc_dapm_ignore_suspend(dapm, "Digital Mic3");
- snd_soc_dapm_ignore_suspend(dapm, "Digital Mic4");
- snd_soc_dapm_ignore_suspend(dapm, "Digital Mic5");
- snd_soc_dapm_ignore_suspend(dapm, "Analog Mic4");
- snd_soc_dapm_ignore_suspend(dapm, "Analog Mic6");
- snd_soc_dapm_ignore_suspend(dapm, "Analog Mic7");
- snd_soc_dapm_ignore_suspend(dapm, "Analog Mic8");
-
- snd_soc_dapm_ignore_suspend(dapm, "EAR");
- snd_soc_dapm_ignore_suspend(dapm, "LINEOUT1");
- snd_soc_dapm_ignore_suspend(dapm, "LINEOUT2");
- snd_soc_dapm_ignore_suspend(dapm, "AMIC1");
- snd_soc_dapm_ignore_suspend(dapm, "AMIC2");
- snd_soc_dapm_ignore_suspend(dapm, "AMIC3");
- snd_soc_dapm_ignore_suspend(dapm, "AMIC4");
- snd_soc_dapm_ignore_suspend(dapm, "AMIC5");
- snd_soc_dapm_ignore_suspend(dapm, "DMIC0");
- snd_soc_dapm_ignore_suspend(dapm, "DMIC1");
- snd_soc_dapm_ignore_suspend(dapm, "DMIC2");
- snd_soc_dapm_ignore_suspend(dapm, "DMIC3");
- snd_soc_dapm_ignore_suspend(dapm, "DMIC4");
- snd_soc_dapm_ignore_suspend(dapm, "DMIC5");
- snd_soc_dapm_ignore_suspend(dapm, "ANC EAR");
- snd_soc_dapm_ignore_suspend(dapm, "SPK1 OUT");
- snd_soc_dapm_ignore_suspend(dapm, "SPK2 OUT");
- snd_soc_dapm_ignore_suspend(dapm, "HPHL");
- snd_soc_dapm_ignore_suspend(dapm, "HPHR");
- snd_soc_dapm_ignore_suspend(dapm, "AIF4 VI");
- snd_soc_dapm_ignore_suspend(dapm, "VIINPUT");
-
- if (!strcmp(dev_name(codec_dai->dev), "tasha_codec")) {
- snd_soc_dapm_ignore_suspend(dapm, "LINEOUT3");
- snd_soc_dapm_ignore_suspend(dapm, "LINEOUT4");
- snd_soc_dapm_ignore_suspend(dapm, "ANC HPHL");
- snd_soc_dapm_ignore_suspend(dapm, "ANC HPHR");
- snd_soc_dapm_ignore_suspend(dapm, "ANC LINEOUT1");
- snd_soc_dapm_ignore_suspend(dapm, "ANC LINEOUT2");
- } else {
- snd_soc_dapm_ignore_suspend(dapm, "MAD_CPE_OUT1");
- snd_soc_dapm_ignore_suspend(dapm, "MAD_CPE_OUT2");
- }
-
- snd_soc_dapm_sync(dapm);
-
- if (!strcmp(dev_name(codec_dai->dev), "tavil_codec")) {
- snd_soc_dai_set_channel_map(codec_dai, ARRAY_SIZE(tx_ch_tavil),
- tx_ch_tavil, ARRAY_SIZE(rx_ch_tavil),
- rx_ch_tavil);
- } else {
- snd_soc_dai_set_channel_map(codec_dai, ARRAY_SIZE(tx_ch),
- tx_ch, ARRAY_SIZE(rx_ch),
- rx_ch);
- }
-
- if (!strcmp(dev_name(codec_dai->dev), "tavil_codec")) {
- msm_codec_fn.get_afe_config_fn = tavil_get_afe_config;
- } else {
- msm_codec_fn.get_afe_config_fn = tasha_get_afe_config;
- msm_codec_fn.mbhc_hs_detect_exit = tasha_mbhc_hs_detect_exit;
- }
-
- ret = msm_adsp_power_up_config(codec, rtd->card->snd_card);
- if (ret) {
- pr_err("%s: Failed to set AFE config %d\n", __func__, ret);
- goto err_afe_cfg;
- }
-
- config_data = msm_codec_fn.get_afe_config_fn(codec,
- AFE_AANC_VERSION);
- if (config_data) {
- ret = afe_set_config(AFE_AANC_VERSION, config_data, 0);
- if (ret) {
- pr_err("%s: Failed to set aanc version %d\n",
- __func__, ret);
- goto err_afe_cfg;
- }
- }
-
- if (!strcmp(dev_name(codec_dai->dev), "tasha_codec")) {
- config_data = msm_codec_fn.get_afe_config_fn(codec,
- AFE_CDC_CLIP_REGISTERS_CONFIG);
- if (config_data) {
- ret = afe_set_config(AFE_CDC_CLIP_REGISTERS_CONFIG,
- config_data, 0);
- if (ret) {
- pr_err("%s: Failed to set clip registers %d\n",
- __func__, ret);
- goto err_afe_cfg;
- }
- }
- config_data = msm_codec_fn.get_afe_config_fn(codec,
- AFE_CLIP_BANK_SEL);
- if (config_data) {
- ret = afe_set_config(AFE_CLIP_BANK_SEL, config_data, 0);
- if (ret) {
- pr_err("%s: Failed to set AFE bank selection %d\n",
- __func__, ret);
- goto err_afe_cfg;
- }
- }
- }
-
- /*
- * Send speaker configuration only for WSA8810.
- * Defalut configuration is for WSA8815.
- */
- pr_debug("%s: Number of aux devices: %d\n",
- __func__, rtd->card->num_aux_devs);
-
- if (!strcmp(dev_name(codec_dai->dev), "tavil_codec")) {
- if (rtd->card->num_aux_devs &&
- !list_empty(&rtd->card->aux_comp_list)) {
- aux_comp = list_first_entry(&rtd->card->aux_comp_list,
- struct snd_soc_component, list_aux);
- if (!strcmp(aux_comp->name, WSA8810_NAME_1) ||
- !strcmp(aux_comp->name, WSA8810_NAME_2)) {
- tavil_set_spkr_mode(rtd->codec, SPKR_MODE_1);
- tavil_set_spkr_gain_offset(rtd->codec,
- RX_GAIN_OFFSET_M1P5_DB);
- }
- }
- card = rtd->card->snd_card;
- entry = snd_info_create_subdir(card->module, "codecs",
- card->proc_root);
- if (!entry) {
- pr_debug("%s: Cannot create codecs module entry\n",
- __func__);
- goto done;
- }
- pdata->codec_root = entry;
- tavil_codec_info_create_codec_entry(pdata->codec_root, codec);
- } else {
- if (rtd->card->num_aux_devs &&
- !list_empty(&rtd->card->aux_comp_list)) {
- aux_comp = list_first_entry(&rtd->card->aux_comp_list,
- struct snd_soc_component, list_aux);
- if (!strcmp(aux_comp->name, WSA8810_NAME_1) ||
- !strcmp(aux_comp->name, WSA8810_NAME_2)) {
- tasha_set_spkr_mode(rtd->codec, SPKR_MODE_1);
- tasha_set_spkr_gain_offset(rtd->codec,
- RX_GAIN_OFFSET_M1P5_DB);
- }
- }
- card = rtd->card->snd_card;
- entry = snd_info_create_subdir(card->module, "codecs",
- card->proc_root);
- if (!entry) {
- pr_debug("%s: Cannot create codecs module entry\n",
- __func__);
- goto done;
- }
- pdata->codec_root = entry;
- tasha_codec_info_create_codec_entry(pdata->codec_root, codec);
- tasha_mbhc_zdet_gpio_ctrl(msm_config_hph_en0_gpio, rtd->codec);
- }
-done:
- msm_set_codec_reg_done(true);
- return 0;
-
-err_afe_cfg:
- return ret;
-}
-EXPORT_SYMBOL(msm_audrx_init);
-
-/**
- * msm_ext_register_audio_notifier - register SSR notifier.
- */
-void msm_ext_register_audio_notifier(struct platform_device *pdev)
-{
- int ret;
-
- is_initial_boot = true;
- spdev = pdev;
- ret = audio_notifier_register("sdm660", AUDIO_NOTIFIER_ADSP_DOMAIN,
- &service_nb);
- if (ret < 0)
- pr_err("%s: Audio notifier register failed ret = %d\n",
- __func__, ret);
-}
-EXPORT_SYMBOL(msm_ext_register_audio_notifier);
-
-/**
- * msm_ext_cdc_init - external codec machine specific init.
- *
- * @pdev: platform device handle
- * @pdata: private data of machine driver
- * @card: sound card pointer reference
- * @mbhc_cfg: MBHC config reference
- *
- * Returns 0 on success or ret on failure.
- */
-int msm_ext_cdc_init(struct platform_device *pdev,
- struct msm_asoc_mach_data *pdata,
- struct snd_soc_card **card,
- struct wcd_mbhc_config *wcd_mbhc_cfg_ptr1)
-{
- int ret = 0;
-
- wcd_mbhc_cfg_ptr = wcd_mbhc_cfg_ptr1;
- pdev->id = 0;
- wcd_mbhc_cfg_ptr->moisture_en = true;
- wcd_mbhc_cfg_ptr->mbhc_micbias = MIC_BIAS_2;
- wcd_mbhc_cfg_ptr->anc_micbias = MIC_BIAS_2;
- wcd_mbhc_cfg_ptr->enable_anc_mic_detect = false;
-
- *card = populate_snd_card_dailinks(&pdev->dev, pdata->snd_card_val);
- if (!(*card)) {
- dev_err(&pdev->dev, "%s: Card uninitialized\n", __func__);
- ret = -EPROBE_DEFER;
- goto err;
- }
- platform_set_drvdata(pdev, *card);
- snd_soc_card_set_drvdata(*card, pdata);
- pdata->hph_en1_gpio = of_get_named_gpio(pdev->dev.of_node,
- "qcom,hph-en1-gpio", 0);
- if (!gpio_is_valid(pdata->hph_en1_gpio))
- pdata->hph_en1_gpio_p = of_parse_phandle(pdev->dev.of_node,
- "qcom,hph-en1-gpio", 0);
- if (!gpio_is_valid(pdata->hph_en1_gpio) && (!pdata->hph_en1_gpio_p)) {
- dev_dbg(&pdev->dev, "property %s not detected in node %s",
- "qcom,hph-en1-gpio", pdev->dev.of_node->full_name);
- }
-
- pdata->hph_en0_gpio = of_get_named_gpio(pdev->dev.of_node,
- "qcom,hph-en0-gpio", 0);
- if (!gpio_is_valid(pdata->hph_en0_gpio))
- pdata->hph_en0_gpio_p = of_parse_phandle(pdev->dev.of_node,
- "qcom,hph-en0-gpio", 0);
- if (!gpio_is_valid(pdata->hph_en0_gpio) && (!pdata->hph_en0_gpio_p)) {
- dev_dbg(&pdev->dev, "property %s not detected in node %s",
- "qcom,hph-en0-gpio", pdev->dev.of_node->full_name);
- }
-
- ret = msm_ext_prepare_hifi(pdata);
- if (ret) {
- dev_dbg(&pdev->dev, "msm_ext_prepare_hifi failed (%d)\n",
- ret);
- ret = 0;
- }
-err:
- return ret;
-}
-EXPORT_SYMBOL(msm_ext_cdc_init);
diff --git a/asoc/sdm660-external.h b/asoc/sdm660-external.h
deleted file mode 100644
index b81e158..0000000
--- a/asoc/sdm660-external.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Copyright (c) 2015-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
- * 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.
- */
-
-#ifndef __SDM660_EXTERNAL
-#define __SDM660_EXTERNAL
-
-int msm_snd_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params);
-int msm_ext_slimbus_2_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params);
-int msm_btsco_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
- struct snd_pcm_hw_params *params);
-int msm_proxy_rx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
- struct snd_pcm_hw_params *params);
-int msm_proxy_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
- struct snd_pcm_hw_params *params);
-int msm_audrx_init(struct snd_soc_pcm_runtime *rtd);
-int msm_snd_cpe_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params);
-struct snd_soc_card *populate_snd_card_dailinks(struct device *dev,
- int snd_card_val);
-int msm_ext_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
- struct snd_pcm_hw_params *params);
-int msm_snd_card_tavil_late_probe(struct snd_soc_card *card);
-int msm_snd_card_tasha_late_probe(struct snd_soc_card *card);
-#if IS_ENABLED(CONFIG_SND_SOC_EXT_CODEC)
-int msm_ext_cdc_init(struct platform_device *, struct msm_asoc_mach_data *,
- struct snd_soc_card **, struct wcd_mbhc_config *);
-void msm_ext_register_audio_notifier(struct platform_device *pdev);
-#else
-inline int msm_ext_cdc_init(struct platform_device *pdev,
- struct msm_asoc_mach_data *pdata,
- struct snd_soc_card **card,
- struct wcd_mbhc_config *wcd_mbhc_cfg_ptr1)
-{
- return 0;
-}
-
-inline void msm_ext_register_audio_notifier(struct platform_device *pdev)
-{
-}
-#endif
-#endif
diff --git a/asoc/sdm660-internal.c b/asoc/sdm660-internal.c
deleted file mode 100644
index fc141e3..0000000
--- a/asoc/sdm660-internal.c
+++ /dev/null
@@ -1,3354 +0,0 @@
-/* Copyright (c) 2015-2018, 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.
- */
-
-#include <linux/of_gpio.h>
-#include <linux/platform_device.h>
-#include <linux/module.h>
-#include <sound/pcm_params.h>
-#include "msm-pcm-routing-v2.h"
-#include "sdm660-common.h"
-#include "codecs/msm-cdc-pinctrl.h"
-#include "codecs/sdm660_cdc/msm-digital-cdc.h"
-#include "codecs/sdm660_cdc/msm-analog-cdc.h"
-#include "codecs/msm_sdw/msm_sdw.h"
-#include <linux/pm_qos.h>
-
-#define __CHIPSET__ "SDM660 "
-#define MSM_DAILINK_NAME(name) (__CHIPSET__#name)
-
-#define WCD_MBHC_DEF_RLOADS 5
-
-#define WCN_CDC_SLIM_RX_CH_MAX 2
-#define WCN_CDC_SLIM_TX_CH_MAX 3
-
-#define WSA8810_NAME_1 "wsa881x.20170211"
-#define WSA8810_NAME_2 "wsa881x.20170212"
-#define MSM_LL_QOS_VALUE 300 /* time in us to ensure LPM doesn't go in C3/C4 */
-enum {
- INT0_MI2S = 0,
- INT1_MI2S,
- INT2_MI2S,
- INT3_MI2S,
- INT4_MI2S,
- INT5_MI2S,
- INT6_MI2S,
- INT_MI2S_MAX,
-};
-
-enum {
- BT_SLIM7,
- FM_SLIM8,
- SLIM_MAX,
-};
-
-/*TDM default offset currently only supporting TDM_RX_0 and TDM_TX_0 */
-static unsigned int tdm_slot_offset[TDM_PORT_MAX][TDM_SLOT_OFFSET_MAX] = {
- {0, 4, 8, 12, 16, 20, 24, 28},/* TX_0 | RX_0 */
- {AFE_SLOT_MAPPING_OFFSET_INVALID},/* TX_1 | RX_1 */
- {AFE_SLOT_MAPPING_OFFSET_INVALID},/* TX_2 | RX_2 */
- {AFE_SLOT_MAPPING_OFFSET_INVALID},/* TX_3 | RX_3 */
- {AFE_SLOT_MAPPING_OFFSET_INVALID},/* TX_4 | RX_4 */
- {AFE_SLOT_MAPPING_OFFSET_INVALID},/* TX_5 | RX_5 */
- {AFE_SLOT_MAPPING_OFFSET_INVALID},/* TX_6 | RX_6 */
- {AFE_SLOT_MAPPING_OFFSET_INVALID},/* TX_7 | RX_7 */
-};
-
-static struct afe_clk_set int_mi2s_clk[INT_MI2S_MAX] = {
- {
- AFE_API_VERSION_I2S_CONFIG,
- Q6AFE_LPASS_CLK_ID_INT0_MI2S_IBIT,
- Q6AFE_LPASS_IBIT_CLK_1_P536_MHZ,
- Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO,
- Q6AFE_LPASS_CLK_ROOT_DEFAULT,
- 0,
- },
- {
- AFE_API_VERSION_I2S_CONFIG,
- Q6AFE_LPASS_CLK_ID_INT1_MI2S_IBIT,
- Q6AFE_LPASS_IBIT_CLK_1_P536_MHZ,
- Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO,
- Q6AFE_LPASS_CLK_ROOT_DEFAULT,
- 0,
- },
- {
- AFE_API_VERSION_I2S_CONFIG,
- Q6AFE_LPASS_CLK_ID_INT2_MI2S_IBIT,
- Q6AFE_LPASS_IBIT_CLK_1_P536_MHZ,
- Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO,
- Q6AFE_LPASS_CLK_ROOT_DEFAULT,
- 0,
- },
- {
- AFE_API_VERSION_I2S_CONFIG,
- Q6AFE_LPASS_CLK_ID_INT3_MI2S_IBIT,
- Q6AFE_LPASS_IBIT_CLK_1_P536_MHZ,
- Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO,
- Q6AFE_LPASS_CLK_ROOT_DEFAULT,
- 0,
- },
- {
- AFE_API_VERSION_I2S_CONFIG,
- Q6AFE_LPASS_CLK_ID_INT4_MI2S_IBIT,
- Q6AFE_LPASS_IBIT_CLK_1_P536_MHZ,
- Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO,
- Q6AFE_LPASS_CLK_ROOT_DEFAULT,
- 0,
- },
- {
- AFE_API_VERSION_I2S_CONFIG,
- Q6AFE_LPASS_CLK_ID_INT5_MI2S_IBIT,
- Q6AFE_LPASS_IBIT_CLK_1_P536_MHZ,
- Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO,
- Q6AFE_LPASS_CLK_ROOT_DEFAULT,
- 0,
- },
- {
- AFE_API_VERSION_I2S_CONFIG,
- Q6AFE_LPASS_CLK_ID_INT6_MI2S_IBIT,
- Q6AFE_LPASS_IBIT_CLK_1_P536_MHZ,
- Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO,
- Q6AFE_LPASS_CLK_ROOT_DEFAULT,
- 0,
- },
-};
-
-struct dev_config {
- u32 sample_rate;
- u32 bit_format;
- u32 channels;
-};
-
-/* Default configuration of MI2S channels */
-static struct dev_config int_mi2s_cfg[] = {
- [INT0_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 2},
- [INT1_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [INT2_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [INT3_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [INT4_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [INT5_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 2},
- [INT6_MI2S] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 2},
-};
-
-static struct dev_config bt_fm_cfg[] = {
- [BT_SLIM7] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [FM_SLIM8] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 2},
-};
-
-static char const *int_mi2s_rate_text[] = {"KHZ_8", "KHZ_16",
- "KHZ_32", "KHZ_44P1", "KHZ_48",
- "KHZ_96", "KHZ_192"};
-static const char *const int_mi2s_ch_text[] = {"One", "Two"};
-static const char *const int_mi2s_tx_ch_text[] = {"One", "Two",
- "Three", "Four"};
-static char const *bit_format_text[] = {"S16_LE", "S24_LE", "S24_3LE"};
-static const char *const loopback_mclk_text[] = {"DISABLE", "ENABLE"};
-static char const *bt_sample_rate_text[] = {"KHZ_8", "KHZ_16",
- "KHZ_44P1", "KHZ_48",
- "KHZ_88P2", "KHZ_96"};
-
-static SOC_ENUM_SINGLE_EXT_DECL(int0_mi2s_rx_sample_rate, int_mi2s_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(int0_mi2s_rx_chs, int_mi2s_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(int0_mi2s_rx_format, bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(int2_mi2s_tx_sample_rate, int_mi2s_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(int2_mi2s_tx_chs, int_mi2s_tx_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(int2_mi2s_tx_format, bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(int3_mi2s_tx_sample_rate, int_mi2s_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(int3_mi2s_tx_chs, int_mi2s_tx_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(int3_mi2s_tx_format, bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(int4_mi2s_rx_sample_rate, int_mi2s_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(int4_mi2s_rx_chs, int_mi2s_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(int4_mi2s_rx_format, bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(int5_mi2s_tx_chs, int_mi2s_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(loopback_mclk_en, loopback_mclk_text);
-static SOC_ENUM_SINGLE_EXT_DECL(bt_sample_rate, bt_sample_rate_text);
-
-static int msm_dmic_event(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol, int event);
-static int msm_int_enable_dig_cdc_clk(struct snd_soc_codec *codec, int enable,
- bool dapm);
-static int msm_int_mclk0_event(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol, int event);
-static int msm_int_mi2s_snd_startup(struct snd_pcm_substream *substream);
-static void msm_int_mi2s_snd_shutdown(struct snd_pcm_substream *substream);
-
-static struct wcd_mbhc_config *mbhc_cfg_ptr;
-static struct snd_info_entry *codec_root;
-
-static int int_mi2s_get_bit_format_val(int bit_format)
-{
- int val = 0;
-
- switch (bit_format) {
- case SNDRV_PCM_FORMAT_S24_3LE:
- val = 2;
- break;
- case SNDRV_PCM_FORMAT_S24_LE:
- val = 1;
- break;
- case SNDRV_PCM_FORMAT_S16_LE:
- default:
- val = 0;
- break;
- }
- return val;
-}
-
-static int int_mi2s_get_bit_format(int val)
-{
- int bit_fmt = SNDRV_PCM_FORMAT_S16_LE;
-
- switch (val) {
- case 0:
- bit_fmt = SNDRV_PCM_FORMAT_S16_LE;
- break;
- case 1:
- bit_fmt = SNDRV_PCM_FORMAT_S24_LE;
- break;
- case 2:
- bit_fmt = SNDRV_PCM_FORMAT_S24_3LE;
- break;
- default:
- bit_fmt = SNDRV_PCM_FORMAT_S16_LE;
- break;
- }
- return bit_fmt;
-}
-
-static int int_mi2s_get_port_idx(struct snd_kcontrol *kcontrol)
-{
- int port_id = 0;
-
- if (strnstr(kcontrol->id.name, "INT0_MI2S", sizeof("INT0_MI2S")))
- port_id = INT0_MI2S;
- else if (strnstr(kcontrol->id.name, "INT2_MI2S", sizeof("INT2_MI2S")))
- port_id = INT2_MI2S;
- else if (strnstr(kcontrol->id.name, "INT3_MI2S", sizeof("INT3_MI2S")))
- port_id = INT3_MI2S;
- else if (strnstr(kcontrol->id.name, "INT4_MI2S", sizeof("INT4_MI2S")))
- port_id = INT4_MI2S;
- else {
- pr_err("%s: unsupported channel: %s",
- __func__, kcontrol->id.name);
- return -EINVAL;
- }
-
- return port_id;
-}
-
-static int int_mi2s_bit_format_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = int_mi2s_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- ucontrol->value.enumerated.item[0] =
- int_mi2s_get_bit_format_val(int_mi2s_cfg[ch_num].bit_format);
-
- pr_debug("%s: int_mi2s[%d]_bit_format = %d, ucontrol value = %d\n",
- __func__, ch_num, int_mi2s_cfg[ch_num].bit_format,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int int_mi2s_bit_format_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = int_mi2s_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- int_mi2s_cfg[ch_num].bit_format =
- int_mi2s_get_bit_format(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: int_mi2s[%d]_rx_bit_format = %d, ucontrol value = %d\n",
- __func__, ch_num, int_mi2s_cfg[ch_num].bit_format,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static inline int param_is_mask(int p)
-{
- return (p >= SNDRV_PCM_HW_PARAM_FIRST_MASK) &&
- (p <= SNDRV_PCM_HW_PARAM_LAST_MASK);
-}
-
-static inline struct snd_mask *param_to_mask(struct snd_pcm_hw_params *p,
- int n)
-{
- return &(p->masks[n - SNDRV_PCM_HW_PARAM_FIRST_MASK]);
-}
-
-static void param_set_mask(struct snd_pcm_hw_params *p, int n, unsigned int bit)
-{
- if (bit >= SNDRV_MASK_MAX)
- return;
- if (param_is_mask(n)) {
- struct snd_mask *m = param_to_mask(p, n);
-
- m->bits[0] = 0;
- m->bits[1] = 0;
- m->bits[bit >> 5] |= (1 << (bit & 31));
- }
-}
-
-static int int_mi2s_get_sample_rate_val(int sample_rate)
-{
- int sample_rate_val;
-
- switch (sample_rate) {
- case SAMPLING_RATE_8KHZ:
- sample_rate_val = 0;
- break;
- case SAMPLING_RATE_16KHZ:
- sample_rate_val = 1;
- break;
- case SAMPLING_RATE_32KHZ:
- sample_rate_val = 2;
- break;
- case SAMPLING_RATE_44P1KHZ:
- sample_rate_val = 3;
- break;
- case SAMPLING_RATE_48KHZ:
- sample_rate_val = 4;
- break;
- case SAMPLING_RATE_96KHZ:
- sample_rate_val = 5;
- break;
- case SAMPLING_RATE_192KHZ:
- sample_rate_val = 6;
- break;
- default:
- sample_rate_val = 4;
- break;
- }
- return sample_rate_val;
-}
-
-static int int_mi2s_get_sample_rate(int value)
-{
- int sample_rate;
-
- switch (value) {
- case 0:
- sample_rate = SAMPLING_RATE_8KHZ;
- break;
- case 1:
- sample_rate = SAMPLING_RATE_16KHZ;
- break;
- case 2:
- sample_rate = SAMPLING_RATE_32KHZ;
- break;
- case 3:
- sample_rate = SAMPLING_RATE_44P1KHZ;
- break;
- case 4:
- sample_rate = SAMPLING_RATE_48KHZ;
- break;
- case 5:
- sample_rate = SAMPLING_RATE_96KHZ;
- break;
- case 6:
- sample_rate = SAMPLING_RATE_192KHZ;
- break;
- default:
- sample_rate = SAMPLING_RATE_48KHZ;
- break;
- }
- return sample_rate;
-}
-
-static int int_mi2s_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = int_mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- int_mi2s_cfg[idx].sample_rate =
- int_mi2s_get_sample_rate(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: idx[%d]_sample_rate = %d, item = %d\n", __func__,
- idx, int_mi2s_cfg[idx].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int int_mi2s_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = int_mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- ucontrol->value.enumerated.item[0] =
- int_mi2s_get_sample_rate_val(int_mi2s_cfg[idx].sample_rate);
-
- pr_debug("%s: idx[%d]_sample_rate = %d, item = %d\n", __func__,
- idx, int_mi2s_cfg[idx].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int int_mi2s_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = int_mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- pr_debug("%s: int_mi2s_[%d]_rx_ch = %d\n", __func__,
- idx, int_mi2s_cfg[idx].channels);
- ucontrol->value.enumerated.item[0] = int_mi2s_cfg[idx].channels - 1;
-
- return 0;
-}
-
-static int int_mi2s_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = int_mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- int_mi2s_cfg[idx].channels = ucontrol->value.enumerated.item[0] + 1;
- pr_debug("%s: int_mi2s_[%d]_ch = %d\n", __func__,
- idx, int_mi2s_cfg[idx].channels);
-
- return 1;
-}
-
-static const struct snd_soc_dapm_widget msm_int_dapm_widgets[] = {
- SND_SOC_DAPM_SUPPLY_S("INT_MCLK0", -1, SND_SOC_NOPM, 0, 0,
- msm_int_mclk0_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_MIC("Handset Mic", NULL),
- SND_SOC_DAPM_MIC("Headset Mic", NULL),
- SND_SOC_DAPM_MIC("Secondary Mic", NULL),
- SND_SOC_DAPM_MIC("Digital Mic1", msm_dmic_event),
- SND_SOC_DAPM_MIC("Digital Mic2", msm_dmic_event),
- SND_SOC_DAPM_MIC("Digital Mic3", msm_dmic_event),
- SND_SOC_DAPM_MIC("Digital Mic4", msm_dmic_event),
-};
-
-static int msm_config_hph_compander_gpio(bool enable,
- struct snd_soc_codec *codec)
-{
- struct snd_soc_card *card = codec->component.card;
- struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
- int ret = 0;
-
- pr_debug("%s: %s HPH Compander\n", __func__,
- enable ? "Enable" : "Disable");
-
- if (enable) {
- ret = msm_cdc_pinctrl_select_active_state(pdata->comp_gpio_p);
- if (ret) {
- pr_err("%s: gpio set cannot be activated %s\n",
- __func__, "comp_gpio");
- goto done;
- }
- } else {
- ret = msm_cdc_pinctrl_select_sleep_state(pdata->comp_gpio_p);
- if (ret) {
- pr_err("%s: gpio set cannot be de-activated %s\n",
- __func__, "comp_gpio");
- goto done;
- }
- }
-
-done:
- return ret;
-}
-
-static int is_ext_spk_gpio_support(struct platform_device *pdev,
- struct msm_asoc_mach_data *pdata)
-{
- const char *spk_ext_pa = "qcom,msm-spk-ext-pa";
-
- pr_debug("%s:Enter\n", __func__);
-
- pdata->spk_ext_pa_gpio = of_get_named_gpio(pdev->dev.of_node,
- spk_ext_pa, 0);
-
- if (pdata->spk_ext_pa_gpio < 0) {
- dev_dbg(&pdev->dev,
- "%s: missing %s in dt node\n", __func__, spk_ext_pa);
- } else {
- if (!gpio_is_valid(pdata->spk_ext_pa_gpio)) {
- pr_err("%s: Invalid external speaker gpio: %d",
- __func__, pdata->spk_ext_pa_gpio);
- return -EINVAL;
- }
- }
- return 0;
-}
-
-static int enable_spk_ext_pa(struct snd_soc_codec *codec, int enable)
-{
- struct snd_soc_card *card = codec->component.card;
- struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
- int ret;
-
- if (!gpio_is_valid(pdata->spk_ext_pa_gpio)) {
- pr_err("%s: Invalid gpio: %d\n", __func__,
- pdata->spk_ext_pa_gpio);
- return false;
- }
-
- pr_debug("%s: %s external speaker PA\n", __func__,
- enable ? "Enable" : "Disable");
-
- if (enable) {
- ret = msm_cdc_pinctrl_select_active_state(
- pdata->ext_spk_gpio_p);
- if (ret) {
- pr_err("%s: gpio set cannot be de-activated %s\n",
- __func__, "ext_spk_gpio");
- return ret;
- }
- gpio_set_value_cansleep(pdata->spk_ext_pa_gpio, enable);
- } else {
- gpio_set_value_cansleep(pdata->spk_ext_pa_gpio, enable);
- ret = msm_cdc_pinctrl_select_sleep_state(
- pdata->ext_spk_gpio_p);
- if (ret) {
- pr_err("%s: gpio set cannot be de-activated %s\n",
- __func__, "ext_spk_gpio");
- return ret;
- }
- }
- return 0;
-}
-
-static int int_mi2s_get_idx_from_beid(int32_t id)
-{
- int idx = 0;
-
- switch (id) {
- case MSM_BACKEND_DAI_INT0_MI2S_RX:
- idx = INT0_MI2S;
- break;
- case MSM_BACKEND_DAI_INT2_MI2S_TX:
- idx = INT2_MI2S;
- break;
- case MSM_BACKEND_DAI_INT3_MI2S_TX:
- idx = INT3_MI2S;
- break;
- case MSM_BACKEND_DAI_INT4_MI2S_RX:
- idx = INT4_MI2S;
- break;
- case MSM_BACKEND_DAI_INT5_MI2S_TX:
- idx = INT5_MI2S;
- break;
- default:
- idx = INT0_MI2S;
- break;
- }
-
- return idx;
-}
-
-static int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
- struct snd_pcm_hw_params *params)
-{
- struct snd_interval *rate = hw_param_interval(params,
- SNDRV_PCM_HW_PARAM_RATE);
-
- struct snd_interval *channels = hw_param_interval(params,
- SNDRV_PCM_HW_PARAM_CHANNELS);
-
- pr_debug("%s()\n", __func__);
- rate->min = rate->max = 48000;
- channels->min = channels->max = 2;
-
- return 0;
-}
-
-static int int_mi2s_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
- struct snd_pcm_hw_params *params)
-{
- struct snd_soc_dai_link *dai_link = rtd->dai_link;
- struct snd_interval *rate = hw_param_interval(params,
- SNDRV_PCM_HW_PARAM_RATE);
- struct snd_interval *channels = hw_param_interval(params,
- SNDRV_PCM_HW_PARAM_CHANNELS);
- int idx;
-
- pr_debug("%s: format = %d, rate = %d\n",
- __func__, params_format(params), params_rate(params));
-
- switch (dai_link->id) {
- case MSM_BACKEND_DAI_INT0_MI2S_RX:
- case MSM_BACKEND_DAI_INT2_MI2S_TX:
- case MSM_BACKEND_DAI_INT3_MI2S_TX:
- case MSM_BACKEND_DAI_INT4_MI2S_RX:
- case MSM_BACKEND_DAI_INT5_MI2S_TX:
- idx = int_mi2s_get_idx_from_beid(dai_link->id);
- rate->min = rate->max = int_mi2s_cfg[idx].sample_rate;
- channels->min = channels->max =
- int_mi2s_cfg[idx].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- int_mi2s_cfg[idx].bit_format);
- break;
- default:
- rate->min = rate->max = SAMPLING_RATE_48KHZ;
- break;
- }
- return 0;
-}
-
-static int msm_btfm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
- struct snd_pcm_hw_params *params)
-{
- struct snd_soc_dai_link *dai_link = rtd->dai_link;
- struct snd_interval *rate = hw_param_interval(params,
- SNDRV_PCM_HW_PARAM_RATE);
- struct snd_interval *channels = hw_param_interval(params,
- SNDRV_PCM_HW_PARAM_CHANNELS);
-
- switch (dai_link->id) {
- case MSM_BACKEND_DAI_SLIMBUS_7_RX:
- case MSM_BACKEND_DAI_SLIMBUS_7_TX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- bt_fm_cfg[BT_SLIM7].bit_format);
- rate->min = rate->max = bt_fm_cfg[BT_SLIM7].sample_rate;
- channels->min = channels->max =
- bt_fm_cfg[BT_SLIM7].channels;
- break;
-
- case MSM_BACKEND_DAI_SLIMBUS_8_TX:
- rate->min = rate->max = bt_fm_cfg[FM_SLIM8].sample_rate;
- channels->min = channels->max =
- bt_fm_cfg[FM_SLIM8].channels;
- break;
-
- default:
- rate->min = rate->max = SAMPLING_RATE_48KHZ;
- break;
- }
- return 0;
-}
-
-static int msm_vi_feed_tx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- ucontrol->value.integer.value[0] =
- (int_mi2s_cfg[INT5_MI2S].channels/2 - 1);
- pr_debug("%s: msm_vi_feed_tx_ch = %ld\n", __func__,
- ucontrol->value.integer.value[0]);
- return 0;
-}
-
-static int msm_vi_feed_tx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int_mi2s_cfg[INT5_MI2S].channels =
- roundup_pow_of_two(ucontrol->value.integer.value[0] + 2);
-
- pr_debug("%s: msm_vi_feed_tx_ch = %d\n",
- __func__, int_mi2s_cfg[INT5_MI2S].channels);
- return 1;
-}
-
-static int msm_int_enable_dig_cdc_clk(struct snd_soc_codec *codec,
- int enable, bool dapm)
-{
- int ret = 0;
- struct msm_asoc_mach_data *pdata = NULL;
- int clk_freq_in_hz;
- bool int_mclk0_freq_chg = false;
-
- pdata = snd_soc_card_get_drvdata(codec->component.card);
- pr_debug("%s: enable %d mclk ref counter %d\n",
- __func__, enable,
- atomic_read(&pdata->int_mclk0_rsc_ref));
- if (enable) {
- if (int_mi2s_cfg[INT0_MI2S].sample_rate ==
- SAMPLING_RATE_44P1KHZ) {
- clk_freq_in_hz = NATIVE_MCLK_RATE;
- pdata->native_clk_set = true;
- } else {
- clk_freq_in_hz = pdata->mclk_freq;
- pdata->native_clk_set = false;
- }
-
- if (pdata->digital_cdc_core_clk.clk_freq_in_hz
- != clk_freq_in_hz)
- int_mclk0_freq_chg = true;
- if (!atomic_read(&pdata->int_mclk0_rsc_ref) ||
- int_mclk0_freq_chg) {
- cancel_delayed_work_sync(
- &pdata->disable_int_mclk0_work);
- mutex_lock(&pdata->cdc_int_mclk0_mutex);
- if (atomic_read(&pdata->int_mclk0_enabled) == false ||
- int_mclk0_freq_chg) {
- if (atomic_read(&pdata->int_mclk0_enabled)) {
- pdata->digital_cdc_core_clk.enable = 0;
- afe_set_lpass_clock_v2(
- AFE_PORT_ID_INT0_MI2S_RX,
- &pdata->digital_cdc_core_clk);
- }
- pdata->digital_cdc_core_clk.clk_freq_in_hz =
- clk_freq_in_hz;
- pdata->digital_cdc_core_clk.enable = 1;
- ret = afe_set_lpass_clock_v2(
- AFE_PORT_ID_INT0_MI2S_RX,
- &pdata->digital_cdc_core_clk);
- if (ret < 0) {
- pr_err("%s: failed to enable CCLK\n",
- __func__);
- mutex_unlock(
- &pdata->cdc_int_mclk0_mutex);
- return ret;
- }
- pr_debug("enabled digital codec core clk\n");
- atomic_set(&pdata->int_mclk0_enabled, true);
- }
- mutex_unlock(&pdata->cdc_int_mclk0_mutex);
- }
- atomic_inc(&pdata->int_mclk0_rsc_ref);
- } else {
- cancel_delayed_work_sync(&pdata->disable_int_mclk0_work);
- mutex_lock(&pdata->cdc_int_mclk0_mutex);
- if (atomic_read(&pdata->int_mclk0_enabled) == true) {
- pdata->digital_cdc_core_clk.clk_freq_in_hz =
- DEFAULT_MCLK_RATE;
- pdata->digital_cdc_core_clk.enable = 0;
- ret = afe_set_lpass_clock_v2(
- AFE_PORT_ID_INT0_MI2S_RX,
- &pdata->digital_cdc_core_clk);
- if (ret < 0)
- pr_err("%s: failed to disable CCLK\n",
- __func__);
- atomic_set(&pdata->int_mclk0_enabled, false);
- atomic_set(&pdata->int_mclk0_rsc_ref, 0);
- }
- mutex_unlock(&pdata->cdc_int_mclk0_mutex);
- }
- return ret;
-}
-
-static int loopback_mclk_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- pr_debug("%s\n", __func__);
- return 0;
-}
-
-static int loopback_mclk_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ret = -EINVAL;
- struct msm_asoc_mach_data *pdata = NULL;
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
-
- pdata = snd_soc_card_get_drvdata(codec->component.card);
- pr_debug("%s: mclk_rsc_ref %d enable %ld\n",
- __func__, atomic_read(&pdata->int_mclk0_rsc_ref),
- ucontrol->value.integer.value[0]);
- switch (ucontrol->value.integer.value[0]) {
- case 1:
- ret = msm_cdc_pinctrl_select_active_state(pdata->pdm_gpio_p);
- if (ret) {
- pr_err("%s: failed to enable the pri gpios: %d\n",
- __func__, ret);
- break;
- }
- mutex_lock(&pdata->cdc_int_mclk0_mutex);
- if ((!atomic_read(&pdata->int_mclk0_rsc_ref)) &&
- (!atomic_read(&pdata->int_mclk0_enabled))) {
- pdata->digital_cdc_core_clk.enable = 1;
- ret = afe_set_lpass_clock_v2(
- AFE_PORT_ID_INT0_MI2S_RX,
- &pdata->digital_cdc_core_clk);
- if (ret < 0) {
- pr_err("%s: failed to enable the MCLK: %d\n",
- __func__, ret);
- mutex_unlock(&pdata->cdc_int_mclk0_mutex);
- ret = msm_cdc_pinctrl_select_sleep_state(
- pdata->pdm_gpio_p);
- if (ret)
- pr_err("%s: failed to disable the pri gpios: %d\n",
- __func__, ret);
- break;
- }
- atomic_set(&pdata->int_mclk0_enabled, true);
- }
- mutex_unlock(&pdata->cdc_int_mclk0_mutex);
- atomic_inc(&pdata->int_mclk0_rsc_ref);
- msm_anlg_cdc_mclk_enable(codec, 1, true);
- break;
- case 0:
- if (atomic_read(&pdata->int_mclk0_rsc_ref) <= 0)
- break;
- msm_anlg_cdc_mclk_enable(codec, 0, true);
- mutex_lock(&pdata->cdc_int_mclk0_mutex);
- if ((!atomic_dec_return(&pdata->int_mclk0_rsc_ref)) &&
- (atomic_read(&pdata->int_mclk0_enabled))) {
- pdata->digital_cdc_core_clk.enable = 0;
- ret = afe_set_lpass_clock_v2(
- AFE_PORT_ID_INT0_MI2S_RX,
- &pdata->digital_cdc_core_clk);
- if (ret < 0) {
- pr_err("%s: failed to disable the CCLK: %d\n",
- __func__, ret);
- mutex_unlock(&pdata->cdc_int_mclk0_mutex);
- break;
- }
- atomic_set(&pdata->int_mclk0_enabled, false);
- }
- mutex_unlock(&pdata->cdc_int_mclk0_mutex);
- ret = msm_cdc_pinctrl_select_sleep_state(pdata->pdm_gpio_p);
- if (ret)
- pr_err("%s: failed to disable the pri gpios: %d\n",
- __func__, ret);
- break;
- default:
- pr_err("%s: Unexpected input value\n", __func__);
- break;
- }
- return ret;
-}
-
-static int msm_bt_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- /*
- * Slimbus_7_Rx/Tx sample rate values should always be in sync (same)
- * when used for BT_SCO use case. Return either Rx or Tx sample rate
- * value.
- */
- switch (bt_fm_cfg[BT_SLIM7].sample_rate) {
- case SAMPLING_RATE_96KHZ:
- ucontrol->value.integer.value[0] = 5;
- break;
- case SAMPLING_RATE_88P2KHZ:
- ucontrol->value.integer.value[0] = 4;
- break;
- case SAMPLING_RATE_48KHZ:
- ucontrol->value.integer.value[0] = 3;
- break;
- case SAMPLING_RATE_44P1KHZ:
- ucontrol->value.integer.value[0] = 2;
- break;
- case SAMPLING_RATE_16KHZ:
- ucontrol->value.integer.value[0] = 1;
- break;
- case SAMPLING_RATE_8KHZ:
- default:
- ucontrol->value.integer.value[0] = 0;
- break;
- }
- pr_debug("%s: sample rate = %d", __func__,
- bt_fm_cfg[BT_SLIM7].sample_rate);
-
- return 0;
-}
-
-static int msm_bt_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- switch (ucontrol->value.integer.value[0]) {
- case 1:
- bt_fm_cfg[BT_SLIM7].sample_rate = SAMPLING_RATE_16KHZ;
- break;
- case 2:
- bt_fm_cfg[BT_SLIM7].sample_rate = SAMPLING_RATE_44P1KHZ;
- break;
- case 3:
- bt_fm_cfg[BT_SLIM7].sample_rate = SAMPLING_RATE_48KHZ;
- break;
- case 4:
- bt_fm_cfg[BT_SLIM7].sample_rate = SAMPLING_RATE_88P2KHZ;
- break;
- case 5:
- bt_fm_cfg[BT_SLIM7].sample_rate = SAMPLING_RATE_96KHZ;
- break;
- case 0:
- default:
- bt_fm_cfg[BT_SLIM7].sample_rate = SAMPLING_RATE_8KHZ;
- break;
- }
- pr_debug("%s: sample rates: slim7_rx = %d, value = %d\n",
- __func__,
- bt_fm_cfg[BT_SLIM7].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static const struct snd_kcontrol_new msm_snd_controls[] = {
- SOC_ENUM_EXT("INT0_MI2S_RX Format", int0_mi2s_rx_format,
- int_mi2s_bit_format_get, int_mi2s_bit_format_put),
- SOC_ENUM_EXT("INT2_MI2S_TX Format", int2_mi2s_tx_format,
- int_mi2s_bit_format_get, int_mi2s_bit_format_put),
- SOC_ENUM_EXT("INT3_MI2S_TX Format", int3_mi2s_tx_format,
- int_mi2s_bit_format_get, int_mi2s_bit_format_put),
- SOC_ENUM_EXT("INT0_MI2S_RX SampleRate", int0_mi2s_rx_sample_rate,
- int_mi2s_sample_rate_get,
- int_mi2s_sample_rate_put),
- SOC_ENUM_EXT("INT2_MI2S_TX SampleRate", int2_mi2s_tx_sample_rate,
- int_mi2s_sample_rate_get,
- int_mi2s_sample_rate_put),
- SOC_ENUM_EXT("INT3_MI2S_TX SampleRate", int3_mi2s_tx_sample_rate,
- int_mi2s_sample_rate_get,
- int_mi2s_sample_rate_put),
- SOC_ENUM_EXT("INT0_MI2S_RX Channels", int0_mi2s_rx_chs,
- int_mi2s_ch_get, int_mi2s_ch_put),
- SOC_ENUM_EXT("INT2_MI2S_TX Channels", int2_mi2s_tx_chs,
- int_mi2s_ch_get, int_mi2s_ch_put),
- SOC_ENUM_EXT("INT3_MI2S_TX Channels", int3_mi2s_tx_chs,
- int_mi2s_ch_get, int_mi2s_ch_put),
- SOC_ENUM_EXT("Loopback MCLK", loopback_mclk_en,
- loopback_mclk_get, loopback_mclk_put),
- SOC_ENUM_EXT("BT SampleRate", bt_sample_rate,
- msm_bt_sample_rate_get,
- msm_bt_sample_rate_put),
-};
-
-static const struct snd_kcontrol_new msm_sdw_controls[] = {
- SOC_ENUM_EXT("INT4_MI2S_RX Format", int4_mi2s_rx_format,
- int_mi2s_bit_format_get, int_mi2s_bit_format_put),
- SOC_ENUM_EXT("INT4_MI2S_RX SampleRate", int4_mi2s_rx_sample_rate,
- int_mi2s_sample_rate_get,
- int_mi2s_sample_rate_put),
- SOC_ENUM_EXT("INT4_MI2S_RX Channels", int4_mi2s_rx_chs,
- int_mi2s_ch_get, int_mi2s_ch_put),
- SOC_ENUM_EXT("VI_FEED_TX Channels", int5_mi2s_tx_chs,
- msm_vi_feed_tx_ch_get, msm_vi_feed_tx_ch_put),
-};
-
-static int msm_dmic_event(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol, int event)
-{
- struct msm_asoc_mach_data *pdata = NULL;
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- int ret = 0;
-
- pdata = snd_soc_card_get_drvdata(codec->component.card);
- pr_debug("%s: event = %d\n", __func__, event);
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- ret = msm_cdc_pinctrl_select_active_state(pdata->dmic_gpio_p);
- if (ret < 0) {
- pr_err("%s: gpio set cannot be activated %sd",
- __func__, "dmic_gpio");
- return ret;
- }
- break;
- case SND_SOC_DAPM_POST_PMD:
- ret = msm_cdc_pinctrl_select_sleep_state(pdata->dmic_gpio_p);
- if (ret < 0) {
- pr_err("%s: gpio set cannot be de-activated %sd",
- __func__, "dmic_gpio");
- return ret;
- }
- break;
- default:
- pr_err("%s: invalid DAPM event %d\n", __func__, event);
- return -EINVAL;
- }
- return 0;
-}
-
-static int msm_int_mclk0_event(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol, int event)
-{
- struct msm_asoc_mach_data *pdata = NULL;
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- int ret = 0;
-
- pdata = snd_soc_card_get_drvdata(codec->component.card);
- pr_debug("%s: event = %d\n", __func__, event);
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- ret = msm_cdc_pinctrl_select_active_state(pdata->pdm_gpio_p);
- if (ret < 0) {
- pr_err("%s: gpio set cannot be activated %s\n",
- __func__, "int_pdm");
- return ret;
- }
- msm_int_enable_dig_cdc_clk(codec, 1, true);
- msm_anlg_cdc_mclk_enable(codec, 1, true);
- break;
- case SND_SOC_DAPM_POST_PMD:
- pr_debug("%s: mclk_res_ref = %d\n",
- __func__, atomic_read(&pdata->int_mclk0_rsc_ref));
- ret = msm_cdc_pinctrl_select_sleep_state(pdata->pdm_gpio_p);
- if (ret < 0) {
- pr_err("%s: gpio set cannot be de-activated %sd",
- __func__, "int_pdm");
- return ret;
- }
- pr_debug("%s: disabling MCLK\n", __func__);
- /* disable the codec mclk config*/
- msm_anlg_cdc_mclk_enable(codec, 0, true);
- msm_int_enable_dig_cdc_clk(codec, 0, true);
- break;
- default:
- pr_err("%s: invalid DAPM event %d\n", __func__, event);
- return -EINVAL;
- }
- return 0;
-}
-
-static int int_mi2s_get_port_id(int id)
-{
- int afe_port_id;
-
- switch (id) {
- case MSM_BACKEND_DAI_INT0_MI2S_RX:
- afe_port_id = AFE_PORT_ID_INT0_MI2S_RX;
- break;
- case MSM_BACKEND_DAI_INT2_MI2S_TX:
- afe_port_id = AFE_PORT_ID_INT2_MI2S_TX;
- break;
- case MSM_BACKEND_DAI_INT3_MI2S_TX:
- afe_port_id = AFE_PORT_ID_INT3_MI2S_TX;
- break;
- case MSM_BACKEND_DAI_INT4_MI2S_RX:
- afe_port_id = AFE_PORT_ID_INT4_MI2S_RX;
- break;
- case MSM_BACKEND_DAI_INT5_MI2S_TX:
- afe_port_id = AFE_PORT_ID_INT5_MI2S_TX;
- break;
- default:
- pr_err("%s: Invalid id: %d\n", __func__, id);
- afe_port_id = -EINVAL;
- }
-
- return afe_port_id;
-}
-
-static int int_mi2s_get_index(int port_id)
-{
- int index;
-
- switch (port_id) {
- case AFE_PORT_ID_INT0_MI2S_RX:
- index = INT0_MI2S;
- break;
- case AFE_PORT_ID_INT2_MI2S_TX:
- index = INT2_MI2S;
- break;
- case AFE_PORT_ID_INT3_MI2S_TX:
- index = INT3_MI2S;
- break;
- case AFE_PORT_ID_INT4_MI2S_RX:
- index = INT4_MI2S;
- break;
- case AFE_PORT_ID_INT5_MI2S_TX:
- index = INT5_MI2S;
- break;
- default:
- pr_err("%s: Invalid port_id: %d\n", __func__, port_id);
- index = -EINVAL;
- }
-
- return index;
-}
-
-static u32 get_int_mi2s_bits_per_sample(u32 bit_format)
-{
- u32 bit_per_sample;
-
- switch (bit_format) {
- case SNDRV_PCM_FORMAT_S24_3LE:
- case SNDRV_PCM_FORMAT_S24_LE:
- bit_per_sample = 32;
- break;
- case SNDRV_PCM_FORMAT_S16_LE:
- default:
- bit_per_sample = 16;
- break;
- }
-
- return bit_per_sample;
-}
-
-static void update_int_mi2s_clk_val(int idx, int stream)
-{
- u32 bit_per_sample;
-
- bit_per_sample =
- get_int_mi2s_bits_per_sample(int_mi2s_cfg[idx].bit_format);
- int_mi2s_clk[idx].clk_freq_in_hz =
- (int_mi2s_cfg[idx].sample_rate * 2 * bit_per_sample);
-}
-
-static int int_mi2s_set_sclk(struct snd_pcm_substream *substream, bool enable)
-{
- int ret = 0;
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- int port_id = 0;
- int index;
-
- port_id = int_mi2s_get_port_id(rtd->dai_link->id);
- if (port_id < 0) {
- dev_err(rtd->card->dev, "%s: Invalid port_id\n", __func__);
- ret = port_id;
- goto done;
- }
- index = int_mi2s_get_index(port_id);
- if (index < 0) {
- dev_err(rtd->card->dev, "%s: Invalid port_id\n", __func__);
- ret = port_id;
- goto done;
- }
- if (enable) {
- update_int_mi2s_clk_val(index, substream->stream);
- dev_dbg(rtd->card->dev, "%s: clock rate %ul\n", __func__,
- int_mi2s_clk[index].clk_freq_in_hz);
- }
-
- int_mi2s_clk[index].enable = enable;
- ret = afe_set_lpass_clock_v2(port_id,
- &int_mi2s_clk[index]);
- if (ret < 0) {
- dev_err(rtd->card->dev,
- "%s: afe lpass clock failed for port 0x%x , err:%d\n",
- __func__, port_id, ret);
- goto done;
- }
-
-done:
- return ret;
-}
-
-static int msm_sdw_mi2s_snd_startup(struct snd_pcm_substream *substream)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- int ret = 0;
-
- pr_debug("%s(): substream = %s stream = %d\n", __func__,
- substream->name, substream->stream);
-
- ret = int_mi2s_set_sclk(substream, true);
- if (ret < 0) {
- pr_err("%s: failed to enable sclk %d\n",
- __func__, ret);
- return ret;
- }
- ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_CBS_CFS);
- if (ret < 0)
- pr_err("%s: set fmt cpu dai failed; ret=%d\n", __func__, ret);
-
- return ret;
-}
-
-static void msm_sdw_mi2s_snd_shutdown(struct snd_pcm_substream *substream)
-{
- int ret;
-
- pr_debug("%s(): substream = %s stream = %d\n", __func__,
- substream->name, substream->stream);
-
- ret = int_mi2s_set_sclk(substream, false);
- if (ret < 0)
- pr_err("%s:clock disable failed; ret=%d\n", __func__,
- ret);
-}
-
-static int msm_int_mi2s_snd_startup(struct snd_pcm_substream *substream)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- struct snd_soc_codec *codec = rtd->codec_dais[ANA_CDC]->codec;
- int ret = 0;
- struct msm_asoc_mach_data *pdata = NULL;
-
- pdata = snd_soc_card_get_drvdata(codec->component.card);
- pr_debug("%s(): substream = %s stream = %d\n", __func__,
- substream->name, substream->stream);
-
- ret = int_mi2s_set_sclk(substream, true);
- if (ret < 0) {
- pr_err("%s: failed to enable sclk %d\n",
- __func__, ret);
- return ret;
- }
- ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_CBS_CFS);
- if (ret < 0)
- pr_err("%s: set fmt cpu dai failed; ret=%d\n", __func__, ret);
-
- return ret;
-}
-
-static void msm_int_mi2s_snd_shutdown(struct snd_pcm_substream *substream)
-{
- int ret;
-
- pr_debug("%s(): substream = %s stream = %d\n", __func__,
- substream->name, substream->stream);
-
- ret = int_mi2s_set_sclk(substream, false);
- if (ret < 0)
- pr_err("%s:clock disable failed; ret=%d\n", __func__,
- ret);
-}
-
-static void *def_msm_int_wcd_mbhc_cal(void)
-{
- void *msm_int_wcd_cal;
- struct wcd_mbhc_btn_detect_cfg *btn_cfg;
- u16 *btn_low, *btn_high;
-
- msm_int_wcd_cal = kzalloc(WCD_MBHC_CAL_SIZE(WCD_MBHC_DEF_BUTTONS,
- WCD_MBHC_DEF_RLOADS), GFP_KERNEL);
- if (!msm_int_wcd_cal)
- return NULL;
-
-#define S(X, Y) ((WCD_MBHC_CAL_PLUG_TYPE_PTR(msm_int_wcd_cal)->X) = (Y))
- S(v_hs_max, 1500);
-#undef S
-#define S(X, Y) ((WCD_MBHC_CAL_BTN_DET_PTR(msm_int_wcd_cal)->X) = (Y))
- S(num_btn, WCD_MBHC_DEF_BUTTONS);
-#undef S
-
-
- btn_cfg = WCD_MBHC_CAL_BTN_DET_PTR(msm_int_wcd_cal);
- btn_low = btn_cfg->_v_btn_low;
- btn_high = ((void *)&btn_cfg->_v_btn_low) +
- (sizeof(btn_cfg->_v_btn_low[0]) * btn_cfg->num_btn);
-
- /*
- * In SW we are maintaining two sets of threshold register
- * one for current source and another for Micbias.
- * all btn_low corresponds to threshold for current source
- * all bt_high corresponds to threshold for Micbias
- * Below thresholds are based on following resistances
- * 0-70 == Button 0
- * 110-180 == Button 1
- * 210-290 == Button 2
- * 360-680 == Button 3
- */
- btn_low[0] = 75;
- btn_high[0] = 75;
- btn_low[1] = 150;
- btn_high[1] = 150;
- btn_low[2] = 225;
- btn_high[2] = 225;
- btn_low[3] = 450;
- btn_high[3] = 450;
- btn_low[4] = 500;
- btn_high[4] = 500;
-
- return msm_int_wcd_cal;
-}
-
-static int msm_audrx_init(struct snd_soc_pcm_runtime *rtd)
-{
- struct snd_soc_codec *dig_cdc = rtd->codec_dais[DIG_CDC]->codec;
- struct snd_soc_codec *ana_cdc = rtd->codec_dais[ANA_CDC]->codec;
- struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(ana_cdc);
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(rtd->card);
- struct snd_card *card;
- int ret = -ENOMEM;
-
- pr_debug("%s(),dev_name%s\n", __func__, dev_name(cpu_dai->dev));
-
- ret = snd_soc_add_codec_controls(ana_cdc, msm_snd_controls,
- ARRAY_SIZE(msm_snd_controls));
- if (ret < 0) {
- pr_err("%s: add_codec_controls failed: %d\n",
- __func__, ret);
- return ret;
- }
- ret = snd_soc_add_codec_controls(ana_cdc, msm_common_snd_controls,
- msm_common_snd_controls_size());
- if (ret < 0) {
- pr_err("%s: add common snd controls failed: %d\n",
- __func__, ret);
- return ret;
- }
-
- snd_soc_dapm_new_controls(dapm, msm_int_dapm_widgets,
- ARRAY_SIZE(msm_int_dapm_widgets));
-
- snd_soc_dapm_ignore_suspend(dapm, "Handset Mic");
- snd_soc_dapm_ignore_suspend(dapm, "Headset Mic");
- snd_soc_dapm_ignore_suspend(dapm, "Secondary Mic");
- snd_soc_dapm_ignore_suspend(dapm, "Digital Mic1");
- snd_soc_dapm_ignore_suspend(dapm, "Digital Mic2");
-
- snd_soc_dapm_ignore_suspend(dapm, "EAR");
- snd_soc_dapm_ignore_suspend(dapm, "HEADPHONE");
- snd_soc_dapm_ignore_suspend(dapm, "SPK_OUT");
- snd_soc_dapm_ignore_suspend(dapm, "AMIC1");
- snd_soc_dapm_ignore_suspend(dapm, "AMIC2");
- snd_soc_dapm_ignore_suspend(dapm, "AMIC3");
- snd_soc_dapm_sync(dapm);
-
- dapm = snd_soc_codec_get_dapm(dig_cdc);
- snd_soc_dapm_ignore_suspend(dapm, "DMIC1");
- snd_soc_dapm_ignore_suspend(dapm, "DMIC2");
- snd_soc_dapm_ignore_suspend(dapm, "DMIC3");
- snd_soc_dapm_ignore_suspend(dapm, "DMIC4");
-
- snd_soc_dapm_sync(dapm);
-
- msm_anlg_cdc_spk_ext_pa_cb(enable_spk_ext_pa, ana_cdc);
- msm_dig_cdc_hph_comp_cb(msm_config_hph_compander_gpio, dig_cdc);
-
- card = rtd->card->snd_card;
- if (!codec_root)
- codec_root = snd_info_create_subdir(card->module, "codecs",
- card->proc_root);
- if (!codec_root) {
- pr_debug("%s: Cannot create codecs module entry\n",
- __func__);
- goto done;
- }
- pdata->codec_root = codec_root;
- msm_dig_codec_info_create_codec_entry(codec_root, dig_cdc);
- msm_anlg_codec_info_create_codec_entry(codec_root, ana_cdc);
-done:
- msm_set_codec_reg_done(true);
- return 0;
-}
-
-static int msm_sdw_audrx_init(struct snd_soc_pcm_runtime *rtd)
-{
- struct snd_soc_codec *codec = rtd->codec;
- struct snd_soc_dapm_context *dapm =
- snd_soc_codec_get_dapm(codec);
- struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(rtd->card);
- struct snd_soc_component *aux_comp;
- struct snd_card *card;
-
- snd_soc_add_codec_controls(codec, msm_sdw_controls,
- ARRAY_SIZE(msm_sdw_controls));
-
- snd_soc_dapm_ignore_suspend(dapm, "AIF1_SDW Playback");
- snd_soc_dapm_ignore_suspend(dapm, "VIfeed_SDW");
- snd_soc_dapm_ignore_suspend(dapm, "SPK1 OUT");
- snd_soc_dapm_ignore_suspend(dapm, "SPK2 OUT");
- snd_soc_dapm_ignore_suspend(dapm, "AIF1_SDW VI");
- snd_soc_dapm_ignore_suspend(dapm, "VIINPUT_SDW");
-
- snd_soc_dapm_sync(dapm);
-
- /*
- * Send speaker configuration only for WSA8810.
- * Default configuration is for WSA8815.
- */
- pr_debug("%s: Number of aux devices: %d\n",
- __func__, rtd->card->num_aux_devs);
- if (rtd->card->num_aux_devs &&
- !list_empty(&rtd->card->aux_comp_list)) {
- aux_comp = list_first_entry(&rtd->card->aux_comp_list,
- struct snd_soc_component, list_aux);
- if (!strcmp(aux_comp->name, WSA8810_NAME_1) ||
- !strcmp(aux_comp->name, WSA8810_NAME_2)) {
- msm_sdw_set_spkr_mode(rtd->codec, SPKR_MODE_1);
- msm_sdw_set_spkr_gain_offset(rtd->codec,
- RX_GAIN_OFFSET_M1P5_DB);
- }
- }
- card = rtd->card->snd_card;
- if (!codec_root)
- codec_root = snd_info_create_subdir(card->module, "codecs",
- card->proc_root);
- if (!codec_root) {
- pr_debug("%s: Cannot create codecs module entry\n",
- __func__);
- goto done;
- }
- pdata->codec_root = codec_root;
- msm_sdw_codec_info_create_codec_entry(codec_root, codec);
-done:
- return 0;
-}
-
-static int msm_wcn_init(struct snd_soc_pcm_runtime *rtd)
-{
- unsigned int rx_ch[WCN_CDC_SLIM_RX_CH_MAX] = {157, 158};
- unsigned int tx_ch[WCN_CDC_SLIM_TX_CH_MAX] = {159, 160, 161};
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
-
- return snd_soc_dai_set_channel_map(codec_dai, ARRAY_SIZE(tx_ch),
- tx_ch, ARRAY_SIZE(rx_ch), rx_ch);
-}
-
-static int msm_wcn_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- struct snd_soc_dai_link *dai_link = rtd->dai_link;
- u32 rx_ch[WCN_CDC_SLIM_RX_CH_MAX], tx_ch[WCN_CDC_SLIM_TX_CH_MAX];
- u32 rx_ch_cnt = 0, tx_ch_cnt = 0;
- int ret;
-
- dev_dbg(rtd->dev, "%s: %s_tx_dai_id_%d\n", __func__,
- codec_dai->name, codec_dai->id);
- ret = snd_soc_dai_get_channel_map(codec_dai,
- &tx_ch_cnt, tx_ch, &rx_ch_cnt, rx_ch);
- if (ret) {
- dev_err(rtd->dev,
- "%s: failed to get BTFM codec chan map\n, err:%d\n",
- __func__, ret);
- goto exit;
- }
-
- dev_dbg(rtd->dev, "%s: tx_ch_cnt(%d) id %d\n",
- __func__, tx_ch_cnt, dai_link->id);
-
- ret = snd_soc_dai_set_channel_map(cpu_dai,
- tx_ch_cnt, tx_ch, rx_ch_cnt, rx_ch);
- if (ret)
- dev_err(rtd->dev, "%s: failed to set cpu chan map, err:%d\n",
- __func__, ret);
-
-exit:
- return ret;
-}
-
-static unsigned int tdm_param_set_slot_mask(u16 port_id, int slot_width,
- int slots)
-{
- unsigned int slot_mask = 0;
- int i, j;
- unsigned int *slot_offset;
-
- for (i = TDM_0; i < TDM_PORT_MAX; i++) {
- slot_offset = tdm_slot_offset[i];
-
- for (j = 0; j < TDM_SLOT_OFFSET_MAX; j++) {
- if (slot_offset[j] != AFE_SLOT_MAPPING_OFFSET_INVALID)
- slot_mask |=
- (1 << ((slot_offset[j] * 8) / slot_width));
- else
- break;
- }
- }
-
- return slot_mask;
-}
-
-static int msm_tdm_snd_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- int ret = 0;
- int channels, slot_width, slots;
- unsigned int slot_mask;
- unsigned int *slot_offset;
- int offset_channels = 0;
- int i;
-
- pr_debug("%s: dai id = 0x%x\n", __func__, cpu_dai->id);
-
- channels = params_channels(params);
- switch (channels) {
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- case 8:
- switch (params_format(params)) {
- case SNDRV_PCM_FORMAT_S32_LE:
- case SNDRV_PCM_FORMAT_S24_LE:
- case SNDRV_PCM_FORMAT_S16_LE:
- /*
- * up to 8 channels HW config should
- * use 32 bit slot width for max support of
- * stream bit width. (slot_width > bit_width)
- */
- slot_width = 32;
- break;
- default:
- pr_err("%s: invalid param format 0x%x\n",
- __func__, params_format(params));
- return -EINVAL;
- }
- slots = 8;
- slot_mask = tdm_param_set_slot_mask(cpu_dai->id,
- slot_width,
- slots);
- if (!slot_mask) {
- pr_err("%s: invalid slot_mask 0x%x\n",
- __func__, slot_mask);
- return -EINVAL;
- }
- break;
- default:
- pr_err("%s: invalid param channels %d\n",
- __func__, channels);
- return -EINVAL;
- }
- /* currently only supporting TDM_RX_0 and TDM_TX_0 */
- switch (cpu_dai->id) {
- case AFE_PORT_ID_PRIMARY_TDM_RX:
- case AFE_PORT_ID_SECONDARY_TDM_RX:
- case AFE_PORT_ID_TERTIARY_TDM_RX:
- case AFE_PORT_ID_QUATERNARY_TDM_RX:
- case AFE_PORT_ID_QUINARY_TDM_RX:
- case AFE_PORT_ID_PRIMARY_TDM_TX:
- case AFE_PORT_ID_SECONDARY_TDM_TX:
- case AFE_PORT_ID_TERTIARY_TDM_TX:
- case AFE_PORT_ID_QUATERNARY_TDM_TX:
- case AFE_PORT_ID_QUINARY_TDM_TX:
- slot_offset = tdm_slot_offset[TDM_0];
- break;
- default:
- pr_err("%s: dai id 0x%x not supported\n",
- __func__, cpu_dai->id);
- return -EINVAL;
- }
-
- for (i = 0; i < TDM_SLOT_OFFSET_MAX; i++) {
- if (slot_offset[i] != AFE_SLOT_MAPPING_OFFSET_INVALID)
- offset_channels++;
- else
- break;
- }
-
- if (offset_channels == 0) {
- pr_err("%s: slot offset not supported, offset_channels %d\n",
- __func__, offset_channels);
- return -EINVAL;
- }
-
- if (channels > offset_channels) {
- pr_err("%s: channels %d exceed offset_channels %d\n",
- __func__, channels, offset_channels);
- return -EINVAL;
- }
-
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
- ret = snd_soc_dai_set_tdm_slot(cpu_dai, 0, slot_mask,
- slots, slot_width);
- if (ret < 0) {
- pr_err("%s: failed to set tdm slot, err:%d\n",
- __func__, ret);
- goto end;
- }
-
- ret = snd_soc_dai_set_channel_map(cpu_dai, 0, NULL,
- channels, slot_offset);
- if (ret < 0) {
- pr_err("%s: failed to set channel map, err:%d\n",
- __func__, ret);
- goto end;
- }
- } else {
- ret = snd_soc_dai_set_tdm_slot(cpu_dai, slot_mask, 0,
- slots, slot_width);
- if (ret < 0) {
- pr_err("%s: failed to set tdm slot, err:%d\n",
- __func__, ret);
- goto end;
- }
-
- ret = snd_soc_dai_set_channel_map(cpu_dai, channels,
- slot_offset, 0, NULL);
- if (ret < 0) {
- pr_err("%s: failed to set channel map, err:%d\n",
- __func__, ret);
- goto end;
- }
- }
-end:
- return ret;
-}
-
-static int msm_snd_card_late_probe(struct snd_soc_card *card)
-{
- const char *be_dl_name = LPASS_BE_INT0_MI2S_RX;
- struct snd_soc_codec *ana_cdc;
- struct snd_soc_pcm_runtime *rtd;
- int ret = 0;
-
- rtd = snd_soc_get_pcm_runtime(card, be_dl_name);
- if (!rtd) {
- dev_err(card->dev,
- "%s: snd_soc_get_pcm_runtime for %s failed!\n",
- __func__, be_dl_name);
- return -EINVAL;
- }
-
- ana_cdc = rtd->codec_dais[ANA_CDC]->codec;
- mbhc_cfg_ptr->calibration = def_msm_int_wcd_mbhc_cal();
- if (!mbhc_cfg_ptr->calibration)
- return -ENOMEM;
-
- ret = msm_anlg_cdc_hs_detect(ana_cdc, mbhc_cfg_ptr);
- if (ret) {
- dev_err(card->dev,
- "%s: msm_anlg_cdc_hs_detect failed\n", __func__);
- kfree(mbhc_cfg_ptr->calibration);
- }
-
- return ret;
-}
-
-static struct snd_soc_ops msm_tdm_be_ops = {
- .hw_params = msm_tdm_snd_hw_params
-};
-
-static struct snd_soc_ops msm_wcn_ops = {
- .hw_params = msm_wcn_hw_params,
-};
-
-static struct snd_soc_ops msm_mi2s_be_ops = {
- .startup = msm_mi2s_snd_startup,
- .shutdown = msm_mi2s_snd_shutdown,
-};
-
-static struct snd_soc_ops msm_aux_pcm_be_ops = {
- .startup = msm_aux_pcm_snd_startup,
- .shutdown = msm_aux_pcm_snd_shutdown,
-};
-
-static struct snd_soc_ops msm_int_mi2s_be_ops = {
- .startup = msm_int_mi2s_snd_startup,
- .shutdown = msm_int_mi2s_snd_shutdown,
-};
-
-static struct snd_soc_ops msm_sdw_mi2s_be_ops = {
- .startup = msm_sdw_mi2s_snd_startup,
- .shutdown = msm_sdw_mi2s_snd_shutdown,
-};
-
-static int msm_fe_qos_prepare(struct snd_pcm_substream *substream)
-{
- cpumask_t mask;
-
- if (pm_qos_request_active(&substream->latency_pm_qos_req))
- pm_qos_remove_request(&substream->latency_pm_qos_req);
-
- cpumask_clear(&mask);
- cpumask_set_cpu(1, &mask); /* affine to core 1 */
- cpumask_set_cpu(2, &mask); /* affine to core 2 */
- cpumask_copy(&substream->latency_pm_qos_req.cpus_affine, &mask);
-
- substream->latency_pm_qos_req.type = PM_QOS_REQ_AFFINE_CORES;
-
- pm_qos_add_request(&substream->latency_pm_qos_req,
- PM_QOS_CPU_DMA_LATENCY,
- MSM_LL_QOS_VALUE);
- return 0;
-}
-
-static struct snd_soc_ops msm_fe_qos_ops = {
- .prepare = msm_fe_qos_prepare,
-};
-
-struct snd_soc_dai_link_component dlc_rx1[] = {
- {
- .of_node = NULL,
- .dai_name = "msm_dig_cdc_dai_rx1",
- },
- {
- .of_node = NULL,
- .dai_name = "msm_anlg_cdc_i2s_rx1",
- },
-};
-
-struct snd_soc_dai_link_component dlc_tx1[] = {
- {
- .of_node = NULL,
- .dai_name = "msm_dig_cdc_dai_tx1",
- },
- {
- .of_node = NULL,
- .dai_name = "msm_anlg_cdc_i2s_tx1",
- },
-};
-
-struct snd_soc_dai_link_component dlc_tx2[] = {
- {
- .of_node = NULL,
- .dai_name = "msm_dig_cdc_dai_tx2",
- },
- {
- .of_node = NULL,
- .dai_name = "msm_anlg_cdc_i2s_tx2",
- },
-};
-
-/* Digital audio interface glue - connects codec <---> CPU */
-static struct snd_soc_dai_link msm_int_dai[] = {
- /* FrontEnd DAI Links */
- {/* hw:x,0 */
- .name = MSM_DAILINK_NAME(Media1),
- .stream_name = "MultiMedia1",
- .cpu_dai_name = "MultiMedia1",
- .platform_name = "msm-pcm-dsp.0",
- .dynamic = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- /* this dai link has playback support */
- .ignore_pmdown_time = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA1
- },
- {/* hw:x,1 */
- .name = MSM_DAILINK_NAME(Media2),
- .stream_name = "MultiMedia2",
- .cpu_dai_name = "MultiMedia2",
- .platform_name = "msm-pcm-dsp.0",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .ignore_suspend = 1,
- /* this dai link has playback support */
- .ignore_pmdown_time = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA2,
- },
- {/* hw:x,2 */
- .name = "VoiceMMode1",
- .stream_name = "VoiceMMode1",
- .cpu_dai_name = "VoiceMMode1",
- .platform_name = "msm-pcm-voice",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_VOICEMMODE1,
- },
- {/* hw:x,3 */
- .name = "MSM VoIP",
- .stream_name = "VoIP",
- .cpu_dai_name = "VoIP",
- .platform_name = "msm-voip-dsp",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- /* this dai link has playback support */
- .ignore_pmdown_time = 1,
- .id = MSM_FRONTEND_DAI_VOIP,
- },
- {/* hw:x,4 */
- .name = MSM_DAILINK_NAME(ULL),
- .stream_name = "ULL",
- .cpu_dai_name = "MultiMedia3",
- .platform_name = "msm-pcm-dsp.2",
- .dynamic = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- /* this dai link has playback support */
- .ignore_pmdown_time = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA3,
- },
- /* Hostless PCM purpose */
- {/* hw:x,5 */
- .name = "INT4 MI2S_RX Hostless",
- .stream_name = "INT4 MI2S_RX Hostless",
- .cpu_dai_name = "INT4_MI2S_RX_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- /* this dailink has playback support */
- .ignore_pmdown_time = 1,
- /* This dainlink has MI2S support */
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {/* hw:x,6 */
- .name = "MSM AFE-PCM RX",
- .stream_name = "AFE-PROXY RX",
- .cpu_dai_name = "msm-dai-q6-dev.241",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .platform_name = "msm-pcm-afe",
- .ignore_suspend = 1,
- /* this dai link has playback support */
- .ignore_pmdown_time = 1,
- },
- {/* hw:x,7 */
- .name = "MSM AFE-PCM TX",
- .stream_name = "AFE-PROXY TX",
- .cpu_dai_name = "msm-dai-q6-dev.240",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .platform_name = "msm-pcm-afe",
- .ignore_suspend = 1,
- },
- {/* hw:x,8 */
- .name = MSM_DAILINK_NAME(Compress1),
- .stream_name = "Compress1",
- .cpu_dai_name = "MultiMedia4",
- .platform_name = "msm-compress-dsp",
- .async_ops = ASYNC_DPCM_SND_SOC_HW_PARAMS,
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dai link has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA4,
- },
- {/* hw:x,9*/
- .name = "AUXPCM Hostless",
- .stream_name = "AUXPCM Hostless",
- .cpu_dai_name = "AUXPCM_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- /* this dai link has playback support */
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {/* hw:x,10 */
- .name = "SLIMBUS_1 Hostless",
- .stream_name = "SLIMBUS_1 Hostless",
- .cpu_dai_name = "SLIMBUS1_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1, /* dai link has playback support */
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {/* hw:x,11 */
- .name = "INT3 MI2S_TX Hostless",
- .stream_name = "INT3 MI2S_TX Hostless",
- .cpu_dai_name = "INT3_MI2S_TX_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {/* hw:x,12 */
- .name = "SLIMBUS_7 Hostless",
- .stream_name = "SLIMBUS_7 Hostless",
- .cpu_dai_name = "SLIMBUS7_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1, /* dai link has playback support */
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {/* hw:x,13 */
- .name = MSM_DAILINK_NAME(LowLatency),
- .stream_name = "MultiMedia5",
- .cpu_dai_name = "MultiMedia5",
- .platform_name = "msm-pcm-dsp.1",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .ignore_suspend = 1,
- /* this dai link has playback support */
- .ignore_pmdown_time = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA5,
- .ops = &msm_fe_qos_ops,
- },
- /* LSM FE */
- {/* hw:x,14 */
- .name = "Listen 1 Audio Service",
- .stream_name = "Listen 1 Audio Service",
- .cpu_dai_name = "LSM1",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM1,
- },
- {/* hw:x,15 */
- .name = MSM_DAILINK_NAME(Compress2),
- .stream_name = "Compress2",
- .cpu_dai_name = "MultiMedia7",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .ignore_suspend = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA7,
- },
- {/* hw:x,16 */
- .name = MSM_DAILINK_NAME(MultiMedia10),
- .stream_name = "MultiMedia10",
- .cpu_dai_name = "MultiMedia10",
- .platform_name = "msm-pcm-dsp.1",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dai link has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA10,
- },
- {/* hw:x,17 */
- .name = MSM_DAILINK_NAME(ULL_NOIRQ),
- .stream_name = "MM_NOIRQ",
- .cpu_dai_name = "MultiMedia8",
- .platform_name = "msm-pcm-dsp-noirq",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dai link has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA8,
- .ops = &msm_fe_qos_ops,
- },
- {/* hw:x,18 */
- .name = "HDMI_RX_HOSTLESS",
- .stream_name = "HDMI_RX_HOSTLESS",
- .cpu_dai_name = "HDMI_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {/* hw:x,19 */
- .name = "VoiceMMode2",
- .stream_name = "VoiceMMode2",
- .cpu_dai_name = "VoiceMMode2",
- .platform_name = "msm-pcm-voice",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_VOICEMMODE2,
- },
- {/* hw:x,20 */
- .name = "Listen 2 Audio Service",
- .stream_name = "Listen 2 Audio Service",
- .cpu_dai_name = "LSM2",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM2,
- },
- {/* hw:x,21 */
- .name = "Listen 3 Audio Service",
- .stream_name = "Listen 3 Audio Service",
- .cpu_dai_name = "LSM3",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM3,
- },
- {/* hw:x,22 */
- .name = "Listen 4 Audio Service",
- .stream_name = "Listen 4 Audio Service",
- .cpu_dai_name = "LSM4",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM4,
- },
- {/* hw:x,23 */
- .name = "Listen 5 Audio Service",
- .stream_name = "Listen 5 Audio Service",
- .cpu_dai_name = "LSM5",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM5,
- },
- {/* hw:x,24 */
- .name = "Listen 6 Audio Service",
- .stream_name = "Listen 6 Audio Service",
- .cpu_dai_name = "LSM6",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM6
- },
- {/* hw:x,25 */
- .name = "Listen 7 Audio Service",
- .stream_name = "Listen 7 Audio Service",
- .cpu_dai_name = "LSM7",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM7,
- },
- {/* hw:x,26 */
- .name = "Listen 8 Audio Service",
- .stream_name = "Listen 8 Audio Service",
- .cpu_dai_name = "LSM8",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM8,
- },
- {/* hw:x,27 */
- .name = MSM_DAILINK_NAME(Media9),
- .stream_name = "MultiMedia9",
- .cpu_dai_name = "MultiMedia9",
- .platform_name = "msm-pcm-dsp.0",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dai link has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA9,
- },
- {/* hw:x,28 */
- .name = MSM_DAILINK_NAME(Compress4),
- .stream_name = "Compress4",
- .cpu_dai_name = "MultiMedia11",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dai link has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA11,
- },
- {/* hw:x,29 */
- .name = MSM_DAILINK_NAME(Compress5),
- .stream_name = "Compress5",
- .cpu_dai_name = "MultiMedia12",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dai link has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA12,
- },
- {/* hw:x,30 */
- .name = MSM_DAILINK_NAME(Compress6),
- .stream_name = "Compress6",
- .cpu_dai_name = "MultiMedia13",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dai link has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA13,
- },
- {/* hw:x,31 */
- .name = MSM_DAILINK_NAME(Compress7),
- .stream_name = "Compress7",
- .cpu_dai_name = "MultiMedia14",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dai link has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA14,
- },
- {/* hw:x,32 */
- .name = MSM_DAILINK_NAME(Compress8),
- .stream_name = "Compress8",
- .cpu_dai_name = "MultiMedia15",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dai link has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA15,
- },
- {/* hw:x,33 */
- .name = MSM_DAILINK_NAME(ULL_NOIRQ_2),
- .stream_name = "MM_NOIRQ_2",
- .cpu_dai_name = "MultiMedia16",
- .platform_name = "msm-pcm-dsp-noirq",
- .dynamic = 1,
- .dpcm_capture = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dai link has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA16,
- },
- {/* hw:x,34 */
- .name = "SLIMBUS_8 Hostless",
- .stream_name = "SLIMBUS8_HOSTLESS Capture",
- .cpu_dai_name = "SLIMBUS8_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {/* hw:x,35 */
- .name = "Primary MI2S_RX Hostless",
- .stream_name = "Primary MI2S_RX Hostless",
- .cpu_dai_name = "PRI_MI2S_RX_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- /* this dailink has playback support */
- .ignore_pmdown_time = 1,
- /* This dainlink has MI2S support */
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {/* hw:x,36 */
- .name = "Secondary MI2S_RX Hostless",
- .stream_name = "Secondary MI2S_RX Hostless",
- .cpu_dai_name = "SEC_MI2S_RX_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- /* this dailink has playback support */
- .ignore_pmdown_time = 1,
- /* This dainlink has MI2S support */
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {/* hw:x,37 */
- .name = "Tertiary MI2S_RX Hostless",
- .stream_name = "Tertiary MI2S_RX Hostless",
- .cpu_dai_name = "TERT_MI2S_RX_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- /* this dailink has playback support */
- .ignore_pmdown_time = 1,
- /* This dainlink has MI2S support */
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {/* hw:x,38 */
- .name = "INT0 MI2S_RX Hostless",
- .stream_name = "INT0 MI2S_RX Hostless",
- .cpu_dai_name = "INT0_MI2S_RX_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- /* this dailink has playback support */
- .ignore_pmdown_time = 1,
- /* This dainlink has MI2S support */
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {/* hw:x,39 */
- .name = "SDM660 HFP TX",
- .stream_name = "MultiMedia6",
- .cpu_dai_name = "MultiMedia6",
- .platform_name = "msm-pcm-loopback",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .ignore_suspend = 1,
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_pmdown_time = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA6,
- },
-};
-
-
-static struct snd_soc_dai_link msm_int_wsa_dai[] = {
- {/* hw:x,40 */
- .name = LPASS_BE_INT5_MI2S_TX,
- .stream_name = "INT5_mi2s Capture",
- .cpu_dai_name = "msm-dai-q6-mi2s.12",
- .platform_name = "msm-pcm-hostless",
- .codec_name = "msm_sdw_codec",
- .codec_dai_name = "msm_sdw_vifeedback",
- .id = MSM_BACKEND_DAI_INT5_MI2S_TX,
- .be_hw_params_fixup = int_mi2s_be_hw_params_fixup,
- .ops = &msm_sdw_mi2s_be_ops,
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .dpcm_capture = 1,
- },
-};
-
-static struct snd_soc_dai_link msm_int_compress_capture_dai[] = {
- {/* hw:x,41 */
- .name = "Compress9",
- .stream_name = "Compress9",
- .cpu_dai_name = "MultiMedia17",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA17,
- },
- {/* hw:x,42 */
- .name = "Compress10",
- .stream_name = "Compress10",
- .cpu_dai_name = "MultiMedia18",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA18,
- },
- {/* hw:x,43 */
- .name = "Compress11",
- .stream_name = "Compress11",
- .cpu_dai_name = "MultiMedia19",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA19,
- },
- {/* hw:x,44 */
- .name = "Compress12",
- .stream_name = "Compress12",
- .cpu_dai_name = "MultiMedia28",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA28,
- },
- {/* hw:x,45 */
- .name = "Compress13",
- .stream_name = "Compress13",
- .cpu_dai_name = "MultiMedia29",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA29,
- },
-};
-
-static struct snd_soc_dai_link msm_int_be_dai[] = {
- /* Backend I2S DAI Links */
- {
- .name = LPASS_BE_INT0_MI2S_RX,
- .stream_name = "INT0 MI2S Playback",
- .cpu_dai_name = "msm-dai-q6-mi2s.7",
- .platform_name = "msm-pcm-routing",
- .codecs = dlc_rx1,
- .num_codecs = CODECS_MAX,
- .no_pcm = 1,
- .dpcm_playback = 1,
- .async_ops = ASYNC_DPCM_SND_SOC_PREPARE |
- ASYNC_DPCM_SND_SOC_HW_PARAMS,
- .id = MSM_BACKEND_DAI_INT0_MI2S_RX,
- .init = &msm_audrx_init,
- .be_hw_params_fixup = int_mi2s_be_hw_params_fixup,
- .ops = &msm_int_mi2s_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_INT3_MI2S_TX,
- .stream_name = "INT3 MI2S Capture",
- .cpu_dai_name = "msm-dai-q6-mi2s.10",
- .platform_name = "msm-pcm-routing",
- .codecs = dlc_tx1,
- .num_codecs = CODECS_MAX,
- .no_pcm = 1,
- .dpcm_capture = 1,
- .async_ops = ASYNC_DPCM_SND_SOC_PREPARE |
- ASYNC_DPCM_SND_SOC_HW_PARAMS,
- .id = MSM_BACKEND_DAI_INT3_MI2S_TX,
- .be_hw_params_fixup = int_mi2s_be_hw_params_fixup,
- .ops = &msm_int_mi2s_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_INT2_MI2S_TX,
- .stream_name = "INT2 MI2S Capture",
- .cpu_dai_name = "msm-dai-q6-mi2s.9",
- .platform_name = "msm-pcm-routing",
- .codecs = dlc_tx2,
- .num_codecs = CODECS_MAX,
- .no_pcm = 1,
- .dpcm_capture = 1,
- .async_ops = ASYNC_DPCM_SND_SOC_PREPARE |
- ASYNC_DPCM_SND_SOC_HW_PARAMS,
- .id = MSM_BACKEND_DAI_INT2_MI2S_TX,
- .be_hw_params_fixup = int_mi2s_be_hw_params_fixup,
- .ops = &msm_int_mi2s_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_AFE_PCM_RX,
- .stream_name = "AFE Playback",
- .cpu_dai_name = "msm-dai-q6-dev.224",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_AFE_PCM_RX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- /* this dainlink has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_AFE_PCM_TX,
- .stream_name = "AFE Capture",
- .cpu_dai_name = "msm-dai-q6-dev.225",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_AFE_PCM_TX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ignore_suspend = 1,
- },
- /* Incall Record Uplink BACK END DAI Link */
- {
- .name = LPASS_BE_INCALL_RECORD_TX,
- .stream_name = "Voice Uplink Capture",
- .cpu_dai_name = "msm-dai-q6-dev.32772",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_INCALL_RECORD_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_suspend = 1,
- },
- /* Incall Record Downlink BACK END DAI Link */
- {
- .name = LPASS_BE_INCALL_RECORD_RX,
- .stream_name = "Voice Downlink Capture",
- .cpu_dai_name = "msm-dai-q6-dev.32771",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_INCALL_RECORD_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_suspend = 1,
- },
- /* Incall Music BACK END DAI Link */
- {
- .name = LPASS_BE_VOICE_PLAYBACK_TX,
- .stream_name = "Voice Farend Playback",
- .cpu_dai_name = "msm-dai-q6-dev.32773",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_VOICE_PLAYBACK_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- /* Incall Music 2 BACK END DAI Link */
- {
- .name = LPASS_BE_VOICE2_PLAYBACK_TX,
- .stream_name = "Voice2 Farend Playback",
- .cpu_dai_name = "msm-dai-q6-dev.32770",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_VOICE2_PLAYBACK_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- {
- .name = LPASS_BE_USB_AUDIO_RX,
- .stream_name = "USB Audio Playback",
- .cpu_dai_name = "msm-dai-q6-dev.28672",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_USB_RX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_USB_AUDIO_TX,
- .stream_name = "USB Audio Capture",
- .cpu_dai_name = "msm-dai-q6-dev.28673",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_USB_TX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_PRI_TDM_RX_0,
- .stream_name = "Primary TDM0 Playback",
- .cpu_dai_name = "msm-dai-q6-tdm.36864",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_PRI_TDM_RX_0,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_tdm_be_ops,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- {
- .name = LPASS_BE_PRI_TDM_TX_0,
- .stream_name = "Primary TDM0 Capture",
- .cpu_dai_name = "msm-dai-q6-tdm.36865",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_PRI_TDM_TX_0,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_tdm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SEC_TDM_RX_0,
- .stream_name = "Secondary TDM0 Playback",
- .cpu_dai_name = "msm-dai-q6-tdm.36880",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SEC_TDM_RX_0,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_tdm_be_ops,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- {
- .name = LPASS_BE_SEC_TDM_TX_0,
- .stream_name = "Secondary TDM0 Capture",
- .cpu_dai_name = "msm-dai-q6-tdm.36881",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SEC_TDM_TX_0,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_tdm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_TERT_TDM_RX_0,
- .stream_name = "Tertiary TDM0 Playback",
- .cpu_dai_name = "msm-dai-q6-tdm.36896",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_TERT_TDM_RX_0,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_tdm_be_ops,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- {
- .name = LPASS_BE_TERT_TDM_TX_0,
- .stream_name = "Tertiary TDM0 Capture",
- .cpu_dai_name = "msm-dai-q6-tdm.36897",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_TERT_TDM_TX_0,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_tdm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_QUAT_TDM_RX_0,
- .stream_name = "Quaternary TDM0 Playback",
- .cpu_dai_name = "msm-dai-q6-tdm.36912",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_QUAT_TDM_RX_0,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_tdm_be_ops,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- {
- .name = LPASS_BE_QUAT_TDM_TX_0,
- .stream_name = "Quaternary TDM0 Capture",
- .cpu_dai_name = "msm-dai-q6-tdm.36913",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_QUAT_TDM_TX_0,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_tdm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_QUIN_TDM_RX_0,
- .stream_name = "Quinary TDM0 Playback",
- .cpu_dai_name = "msm-dai-q6-tdm.36928",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_QUIN_TDM_RX_0,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_tdm_be_ops,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- {
- .name = LPASS_BE_QUIN_TDM_TX_0,
- .stream_name = "Quinary TDM0 Capture",
- .cpu_dai_name = "msm-dai-q6-tdm.36929",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_QUIN_TDM_TX_0,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_tdm_be_ops,
- .ignore_suspend = 1,
- },
-};
-
-static struct snd_soc_dai_link msm_mi2s_be_dai_links[] = {
- {
- .name = LPASS_BE_PRI_MI2S_RX,
- .stream_name = "Primary MI2S Playback",
- .cpu_dai_name = "msm-dai-q6-mi2s.0",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_PRI_MI2S_RX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- {
- .name = LPASS_BE_PRI_MI2S_TX,
- .stream_name = "Primary MI2S Capture",
- .cpu_dai_name = "msm-dai-q6-mi2s.0",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_PRI_MI2S_TX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SEC_MI2S_RX,
- .stream_name = "Secondary MI2S Playback",
- .cpu_dai_name = "msm-dai-q6-mi2s.1",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SECONDARY_MI2S_RX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- {
- .name = LPASS_BE_SEC_MI2S_TX,
- .stream_name = "Secondary MI2S Capture",
- .cpu_dai_name = "msm-dai-q6-mi2s.1",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SECONDARY_MI2S_TX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_TERT_MI2S_RX,
- .stream_name = "Tertiary MI2S Playback",
- .cpu_dai_name = "msm-dai-q6-mi2s.2",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_TERTIARY_MI2S_RX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- {
- .name = LPASS_BE_TERT_MI2S_TX,
- .stream_name = "Tertiary MI2S Capture",
- .cpu_dai_name = "msm-dai-q6-mi2s.2",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_TERTIARY_MI2S_TX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_QUAT_MI2S_RX,
- .stream_name = "Quaternary MI2S Playback",
- .cpu_dai_name = "msm-dai-q6-mi2s.3",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_QUATERNARY_MI2S_RX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- {
- .name = LPASS_BE_QUAT_MI2S_TX,
- .stream_name = "Quaternary MI2S Capture",
- .cpu_dai_name = "msm-dai-q6-mi2s.3",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_QUATERNARY_MI2S_TX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_QUIN_MI2S_RX,
- .stream_name = "Quinary MI2S Playback",
- .cpu_dai_name = "msm-dai-q6-mi2s.4",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_QUINARY_MI2S_RX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- {
- .name = LPASS_BE_QUIN_MI2S_TX,
- .stream_name = "Quinary MI2S Capture",
- .cpu_dai_name = "msm-dai-q6-mi2s.4",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_QUINARY_MI2S_TX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- },
-};
-
-static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = {
- /* Primary AUX PCM Backend DAI Links */
- {
- .name = LPASS_BE_AUXPCM_RX,
- .stream_name = "AUX PCM Playback",
- .cpu_dai_name = "msm-dai-q6-auxpcm.1",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_AUXPCM_RX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- .ops = &msm_aux_pcm_be_ops,
- },
- {
- .name = LPASS_BE_AUXPCM_TX,
- .stream_name = "AUX PCM Capture",
- .cpu_dai_name = "msm-dai-q6-auxpcm.1",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_AUXPCM_TX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ignore_suspend = 1,
- .ops = &msm_aux_pcm_be_ops,
- },
- /* Secondary AUX PCM Backend DAI Links */
- {
- .name = LPASS_BE_SEC_AUXPCM_RX,
- .stream_name = "Sec AUX PCM Playback",
- .cpu_dai_name = "msm-dai-q6-auxpcm.2",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SEC_AUXPCM_RX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- .ops = &msm_aux_pcm_be_ops,
- },
- {
- .name = LPASS_BE_SEC_AUXPCM_TX,
- .stream_name = "Sec AUX PCM Capture",
- .cpu_dai_name = "msm-dai-q6-auxpcm.2",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SEC_AUXPCM_TX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ignore_suspend = 1,
- .ops = &msm_aux_pcm_be_ops,
- },
- /* Tertiary AUX PCM Backend DAI Links */
- {
- .name = LPASS_BE_TERT_AUXPCM_RX,
- .stream_name = "Tert AUX PCM Playback",
- .cpu_dai_name = "msm-dai-q6-auxpcm.3",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_TERT_AUXPCM_RX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- .ops = &msm_aux_pcm_be_ops,
- },
- {
- .name = LPASS_BE_TERT_AUXPCM_TX,
- .stream_name = "Tert AUX PCM Capture",
- .cpu_dai_name = "msm-dai-q6-auxpcm.3",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_TERT_AUXPCM_TX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ignore_suspend = 1,
- .ops = &msm_aux_pcm_be_ops,
- },
- /* Quaternary AUX PCM Backend DAI Links */
- {
- .name = LPASS_BE_QUAT_AUXPCM_RX,
- .stream_name = "Quat AUX PCM Playback",
- .cpu_dai_name = "msm-dai-q6-auxpcm.4",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_QUAT_AUXPCM_RX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- .ops = &msm_aux_pcm_be_ops,
- },
- {
- .name = LPASS_BE_QUAT_AUXPCM_TX,
- .stream_name = "Quat AUX PCM Capture",
- .cpu_dai_name = "msm-dai-q6-auxpcm.4",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_QUAT_AUXPCM_TX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ignore_suspend = 1,
- .ops = &msm_aux_pcm_be_ops,
- },
- /* Quinary AUX PCM Backend DAI Links */
- {
- .name = LPASS_BE_QUIN_AUXPCM_RX,
- .stream_name = "Quin AUX PCM Playback",
- .cpu_dai_name = "msm-dai-q6-auxpcm.5",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_QUIN_AUXPCM_RX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- .ops = &msm_aux_pcm_be_ops,
- },
- {
- .name = LPASS_BE_QUIN_AUXPCM_TX,
- .stream_name = "Quin AUX PCM Capture",
- .cpu_dai_name = "msm-dai-q6-auxpcm.5",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_QUIN_AUXPCM_TX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ignore_suspend = 1,
- .ops = &msm_aux_pcm_be_ops,
- },
-};
-
-
-static struct snd_soc_dai_link msm_wcn_be_dai_links[] = {
- {
- .name = LPASS_BE_SLIMBUS_7_RX,
- .stream_name = "Slimbus7 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16398",
- .platform_name = "msm-pcm-routing",
- .codec_name = "btfmslim_slave",
- /* BT codec driver determines capabilities based on
- * dai name, bt codecdai name should always contains
- * supported usecase information
- */
- .codec_dai_name = "btfm_bt_sco_a2dp_slim_rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_7_RX,
- .be_hw_params_fixup = msm_btfm_be_hw_params_fixup,
- .ops = &msm_wcn_ops,
- /* dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_7_TX,
- .stream_name = "Slimbus7 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16399",
- .platform_name = "msm-pcm-routing",
- .codec_name = "btfmslim_slave",
- .codec_dai_name = "btfm_bt_sco_slim_tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_7_TX,
- .be_hw_params_fixup = msm_btfm_be_hw_params_fixup,
- .ops = &msm_wcn_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_8_TX,
- .stream_name = "Slimbus8 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16401",
- .platform_name = "msm-pcm-routing",
- .codec_name = "btfmslim_slave",
- .codec_dai_name = "btfm_fm_slim_tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_8_TX,
- .be_hw_params_fixup = msm_btfm_be_hw_params_fixup,
- .init = &msm_wcn_init,
- .ops = &msm_wcn_ops,
- .ignore_suspend = 1,
- },
-};
-
-static struct snd_soc_dai_link msm_wsa_be_dai_links[] = {
- {
- .name = LPASS_BE_INT4_MI2S_RX,
- .stream_name = "INT4 MI2S Playback",
- .cpu_dai_name = "msm-dai-q6-mi2s.11",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm_sdw_codec",
- .codec_dai_name = "msm_sdw_i2s_rx1",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_INT4_MI2S_RX,
- .init = &msm_sdw_audrx_init,
- .be_hw_params_fixup = int_mi2s_be_hw_params_fixup,
- .ops = &msm_sdw_mi2s_be_ops,
- .ignore_suspend = 1,
- },
-};
-
-static struct snd_soc_dai_link ext_disp_be_dai_link[] = {
- /* DISP PORT BACK END DAI Link */
- {
- .name = LPASS_BE_DISPLAY_PORT,
- .stream_name = "Display Port Playback",
- .cpu_dai_name = "msm-dai-q6-dp.24608",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-ext-disp-audio-codec-rx",
- .codec_dai_name = "msm_dp_audio_codec_rx_dai",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_DISPLAY_PORT_RX,
- .be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
-};
-
-static struct snd_soc_dai_link msm_int_dai_links[
-ARRAY_SIZE(msm_int_dai) +
-ARRAY_SIZE(msm_int_wsa_dai) +
-ARRAY_SIZE(msm_int_compress_capture_dai) +
-ARRAY_SIZE(msm_int_be_dai) +
-ARRAY_SIZE(msm_mi2s_be_dai_links) +
-ARRAY_SIZE(msm_auxpcm_be_dai_links)+
-ARRAY_SIZE(msm_wcn_be_dai_links) +
-ARRAY_SIZE(msm_wsa_be_dai_links) +
-ARRAY_SIZE(ext_disp_be_dai_link)];
-
-static struct snd_soc_card sdm660_card = {
- /* snd_soc_card_sdm660 */
- .name = "sdm660-snd-card",
- .dai_link = msm_int_dai,
- .num_links = ARRAY_SIZE(msm_int_dai),
- .late_probe = msm_snd_card_late_probe,
-};
-
-static void msm_disable_int_mclk0(struct work_struct *work)
-{
- struct msm_asoc_mach_data *pdata = NULL;
- struct delayed_work *dwork;
- int ret = 0;
-
- dwork = to_delayed_work(work);
- pdata = container_of(dwork, struct msm_asoc_mach_data,
- disable_int_mclk0_work);
- mutex_lock(&pdata->cdc_int_mclk0_mutex);
- pr_debug("%s: mclk_enabled %d mclk_rsc_ref %d\n", __func__,
- atomic_read(&pdata->int_mclk0_enabled),
- atomic_read(&pdata->int_mclk0_rsc_ref));
-
- if (atomic_read(&pdata->int_mclk0_enabled) == true
- && atomic_read(&pdata->int_mclk0_rsc_ref) == 0) {
- pr_debug("Disable the mclk\n");
- pdata->digital_cdc_core_clk.enable = 0;
- pdata->digital_cdc_core_clk.clk_freq_in_hz =
- DEFAULT_MCLK_RATE;
- ret = afe_set_lpass_clock_v2(
- AFE_PORT_ID_INT0_MI2S_RX,
- &pdata->digital_cdc_core_clk);
- if (ret < 0)
- pr_err("%s failed to disable the CCLK\n", __func__);
- atomic_set(&pdata->int_mclk0_enabled, false);
- }
- mutex_unlock(&pdata->cdc_int_mclk0_mutex);
-}
-
-static void msm_int_dt_parse_cap_info(struct platform_device *pdev,
- struct msm_asoc_mach_data *pdata)
-{
- const char *ext1_cap = "qcom,msm-micbias1-ext-cap";
- const char *ext2_cap = "qcom,msm-micbias2-ext-cap";
-
- pdata->micbias1_cap_mode =
- (of_property_read_bool(pdev->dev.of_node, ext1_cap) ?
- MICBIAS_EXT_BYP_CAP : MICBIAS_NO_EXT_BYP_CAP);
-
- pdata->micbias2_cap_mode =
- (of_property_read_bool(pdev->dev.of_node, ext2_cap) ?
- MICBIAS_EXT_BYP_CAP : MICBIAS_NO_EXT_BYP_CAP);
-}
-
-static struct snd_soc_card *msm_int_populate_sndcard_dailinks(
- struct device *dev)
-{
- struct snd_soc_card *card = &sdm660_card;
- struct snd_soc_dai_link *dailink;
- int len1;
-
- card->name = dev_name(dev);
- len1 = ARRAY_SIZE(msm_int_dai);
- memcpy(msm_int_dai_links, msm_int_dai, sizeof(msm_int_dai));
- dailink = msm_int_dai_links;
- if (!of_property_read_bool(dev->of_node,
- "qcom,wsa-disable")) {
- memcpy(dailink + len1,
- msm_int_wsa_dai,
- sizeof(msm_int_wsa_dai));
- len1 += ARRAY_SIZE(msm_int_wsa_dai);
- }
- memcpy(dailink + len1, msm_int_compress_capture_dai,
- sizeof(msm_int_compress_capture_dai));
- len1 += ARRAY_SIZE(msm_int_compress_capture_dai);
-
- memcpy(dailink + len1, msm_int_be_dai, sizeof(msm_int_be_dai));
- len1 += ARRAY_SIZE(msm_int_be_dai);
-
- if (of_property_read_bool(dev->of_node,
- "qcom,mi2s-audio-intf")) {
- memcpy(dailink + len1,
- msm_mi2s_be_dai_links,
- sizeof(msm_mi2s_be_dai_links));
- len1 += ARRAY_SIZE(msm_mi2s_be_dai_links);
- }
- if (of_property_read_bool(dev->of_node,
- "qcom,auxpcm-audio-intf")) {
- memcpy(dailink + len1,
- msm_auxpcm_be_dai_links,
- sizeof(msm_auxpcm_be_dai_links));
- len1 += ARRAY_SIZE(msm_auxpcm_be_dai_links);
- }
- if (of_property_read_bool(dev->of_node, "qcom,wcn-btfm")) {
- dev_dbg(dev, "%s(): WCN BTFM support present\n",
- __func__);
- memcpy(dailink + len1,
- msm_wcn_be_dai_links,
- sizeof(msm_wcn_be_dai_links));
- len1 += ARRAY_SIZE(msm_wcn_be_dai_links);
- }
- if (!of_property_read_bool(dev->of_node, "qcom,wsa-disable")) {
- memcpy(dailink + len1,
- msm_wsa_be_dai_links,
- sizeof(msm_wsa_be_dai_links));
- len1 += ARRAY_SIZE(msm_wsa_be_dai_links);
- }
- if (of_property_read_bool(dev->of_node, "qcom,ext-disp-audio-rx")) {
- dev_dbg(dev, "%s(): ext disp audio support present\n",
- __func__);
- memcpy(dailink + len1,
- ext_disp_be_dai_link,
- sizeof(ext_disp_be_dai_link));
- len1 += ARRAY_SIZE(ext_disp_be_dai_link);
- }
- card->dai_link = dailink;
- card->num_links = len1;
- return card;
-}
-
-static int msm_internal_init(struct platform_device *pdev,
- struct msm_asoc_mach_data *pdata,
- struct snd_soc_card *card)
-{
- const char *type = NULL;
- const char *hs_micbias_type = "qcom,msm-hs-micbias-type";
- int ret;
-
- ret = is_ext_spk_gpio_support(pdev, pdata);
- if (ret < 0)
- dev_dbg(&pdev->dev,
- "%s: doesn't support external speaker pa\n",
- __func__);
-
- ret = of_property_read_string(pdev->dev.of_node,
- hs_micbias_type, &type);
- if (ret) {
- dev_err(&pdev->dev, "%s: missing %s in dt node\n",
- __func__, hs_micbias_type);
- goto err;
- }
- if (!strcmp(type, "external")) {
- dev_dbg(&pdev->dev, "Headset is using external micbias\n");
- mbhc_cfg_ptr->hs_ext_micbias = true;
- } else {
- dev_dbg(&pdev->dev, "Headset is using internal micbias\n");
- mbhc_cfg_ptr->hs_ext_micbias = false;
- }
-
- /* initialize the int_mclk0 */
- pdata->digital_cdc_core_clk.clk_set_minor_version =
- AFE_API_VERSION_I2S_CONFIG;
- pdata->digital_cdc_core_clk.clk_id =
- Q6AFE_LPASS_CLK_ID_INT_MCLK_0;
- pdata->digital_cdc_core_clk.clk_freq_in_hz = pdata->mclk_freq;
- pdata->digital_cdc_core_clk.clk_attri =
- Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO;
- pdata->digital_cdc_core_clk.clk_root =
- Q6AFE_LPASS_CLK_ROOT_DEFAULT;
- pdata->digital_cdc_core_clk.enable = 1;
-
- /* Initialize loopback mode to false */
- pdata->lb_mode = false;
-
- msm_int_dt_parse_cap_info(pdev, pdata);
-
- card->dev = &pdev->dev;
- platform_set_drvdata(pdev, card);
- snd_soc_card_set_drvdata(card, pdata);
- ret = snd_soc_of_parse_card_name(card, "qcom,model");
- if (ret)
- goto err;
- /* initialize timer */
- INIT_DELAYED_WORK(&pdata->disable_int_mclk0_work,
- msm_disable_int_mclk0);
- mutex_init(&pdata->cdc_int_mclk0_mutex);
- atomic_set(&pdata->int_mclk0_rsc_ref, 0);
- atomic_set(&pdata->int_mclk0_enabled, false);
-
- dev_info(&pdev->dev, "%s: default codec configured\n", __func__);
-
- return 0;
-err:
- return ret;
-}
-
-/**
- * msm_int_cdc_init - internal codec machine specific init.
- *
- * @pdev: platform device handle
- * @pdata: private data of machine driver
- * @card: sound card pointer reference
- * @mbhc_cfg: MBHC config reference
- *
- * Returns 0.
- */
-int msm_int_cdc_init(struct platform_device *pdev,
- struct msm_asoc_mach_data *pdata,
- struct snd_soc_card **card,
- struct wcd_mbhc_config *mbhc_cfg)
-{
- mbhc_cfg_ptr = mbhc_cfg;
-
- *card = msm_int_populate_sndcard_dailinks(&pdev->dev);
- msm_internal_init(pdev, pdata, *card);
- return 0;
-}
-EXPORT_SYMBOL(msm_int_cdc_init);
diff --git a/asoc/sdm660-internal.h b/asoc/sdm660-internal.h
deleted file mode 100644
index 6918231..0000000
--- a/asoc/sdm660-internal.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (c) 2016-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
- * 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.
- */
-
-#ifndef __SDM660_INTERNAL
-#define __SDM660_INTERNAL
-
-#include <sound/soc.h>
-
-#if IS_ENABLED(CONFIG_SND_SOC_INT_CODEC)
-int msm_int_cdc_init(struct platform_device *pdev,
- struct msm_asoc_mach_data *pdata,
- struct snd_soc_card **card,
- struct wcd_mbhc_config *mbhc_cfg);
-#else
-int msm_int_cdc_init(struct platform_device *pdev,
- struct msm_asoc_mach_data *pdata,
- struct snd_soc_card **card,
- struct wcd_mbhc_config *mbhc_cfg)
-{
- return 0;
-}
-#endif
-#endif
diff --git a/asoc/sdm845.c b/asoc/sdm845.c
deleted file mode 100644
index 3fe4023..0000000
--- a/asoc/sdm845.c
+++ /dev/null
@@ -1,6963 +0,0 @@
-/*
- * Copyright (c) 2016-2018, 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.
- */
-
-#include <linux/clk.h>
-#include <linux/delay.h>
-#include <linux/gpio.h>
-#include <linux/of_gpio.h>
-#include <linux/platform_device.h>
-#include <linux/slab.h>
-#include <linux/io.h>
-#include <linux/module.h>
-#include <linux/input.h>
-#include <linux/of_device.h>
-#include <linux/pm_qos.h>
-#include <sound/core.h>
-#include <sound/soc.h>
-#include <sound/soc-dapm.h>
-#include <sound/pcm.h>
-#include <sound/jack.h>
-#include <sound/pcm_params.h>
-#include <sound/info.h>
-#include <device_event.h>
-#include <dsp/audio_notifier.h>
-#include <dsp/q6afe-v2.h>
-#include <dsp/q6core.h>
-#include "msm-pcm-routing-v2.h"
-#include "codecs/msm-cdc-pinctrl.h"
-#include "codecs/wcd934x/wcd934x.h"
-#include "codecs/wcd934x/wcd934x-mbhc.h"
-#include "codecs/wsa881x.h"
-
-#define DRV_NAME "sdm845-asoc-snd"
-
-#define __CHIPSET__ "SDM845 "
-#define MSM_DAILINK_NAME(name) (__CHIPSET__#name)
-
-#define SAMPLING_RATE_8KHZ 8000
-#define SAMPLING_RATE_11P025KHZ 11025
-#define SAMPLING_RATE_16KHZ 16000
-#define SAMPLING_RATE_22P05KHZ 22050
-#define SAMPLING_RATE_32KHZ 32000
-#define SAMPLING_RATE_44P1KHZ 44100
-#define SAMPLING_RATE_48KHZ 48000
-#define SAMPLING_RATE_88P2KHZ 88200
-#define SAMPLING_RATE_96KHZ 96000
-#define SAMPLING_RATE_176P4KHZ 176400
-#define SAMPLING_RATE_192KHZ 192000
-#define SAMPLING_RATE_352P8KHZ 352800
-#define SAMPLING_RATE_384KHZ 384000
-
-#define WCD9XXX_MBHC_DEF_BUTTONS 8
-#define WCD9XXX_MBHC_DEF_RLOADS 5
-#define CODEC_EXT_CLK_RATE 9600000
-#define ADSP_STATE_READY_TIMEOUT_MS 3000
-#define DEV_NAME_STR_LEN 32
-
-#define WSA8810_NAME_1 "wsa881x.20170211"
-#define WSA8810_NAME_2 "wsa881x.20170212"
-
-#define WCN_CDC_SLIM_RX_CH_MAX 2
-#define WCN_CDC_SLIM_TX_CH_MAX 3
-
-#define TDM_CHANNEL_MAX 8
-
-#define MSM_HIFI_ON 1
-#define MSM_LL_QOS_VALUE 300 /* time in us to ensure LPM doesn't go in C3/C4 */
-
-enum {
- SLIM_RX_0 = 0,
- SLIM_RX_1,
- SLIM_RX_2,
- SLIM_RX_3,
- SLIM_RX_4,
- SLIM_RX_5,
- SLIM_RX_6,
- SLIM_RX_7,
- SLIM_RX_MAX,
-};
-
-enum {
- SLIM_TX_0 = 0,
- SLIM_TX_1,
- SLIM_TX_2,
- SLIM_TX_3,
- SLIM_TX_4,
- SLIM_TX_5,
- SLIM_TX_6,
- SLIM_TX_7,
- SLIM_TX_8,
- SLIM_TX_MAX,
-};
-
-enum {
- PRIM_MI2S = 0,
- SEC_MI2S,
- TERT_MI2S,
- QUAT_MI2S,
- MI2S_MAX,
-};
-
-enum {
- PRIM_AUX_PCM = 0,
- SEC_AUX_PCM,
- TERT_AUX_PCM,
- QUAT_AUX_PCM,
- AUX_PCM_MAX,
-};
-
-struct mi2s_conf {
- struct mutex lock;
- u32 ref_cnt;
- u32 msm_is_mi2s_master;
-};
-
-static u32 mi2s_ebit_clk[MI2S_MAX] = {
- Q6AFE_LPASS_CLK_ID_PRI_MI2S_EBIT,
- Q6AFE_LPASS_CLK_ID_SEC_MI2S_EBIT,
- Q6AFE_LPASS_CLK_ID_TER_MI2S_EBIT,
- Q6AFE_LPASS_CLK_ID_QUAD_MI2S_EBIT
-};
-
-struct dev_config {
- u32 sample_rate;
- u32 bit_format;
- u32 channels;
-};
-
-enum {
- DP_RX_IDX = 0,
- EXT_DISP_RX_IDX_MAX,
-};
-
-struct msm_wsa881x_dev_info {
- struct device_node *of_node;
- u32 index;
-};
-
-enum pinctrl_pin_state {
- STATE_DISABLE = 0, /* All pins are in sleep state */
- STATE_MI2S_ACTIVE, /* IS2 = active, TDM = sleep */
- STATE_TDM_ACTIVE, /* IS2 = sleep, TDM = active */
-};
-
-struct msm_pinctrl_info {
- struct pinctrl *pinctrl;
- struct pinctrl_state *mi2s_disable;
- struct pinctrl_state *tdm_disable;
- struct pinctrl_state *mi2s_active;
- struct pinctrl_state *tdm_active;
- enum pinctrl_pin_state curr_state;
-};
-
-struct msm_asoc_mach_data {
- u32 mclk_freq;
- int us_euro_gpio; /* used by gpio driver API */
- int usbc_en2_gpio; /* used by gpio driver API */
- struct device_node *us_euro_gpio_p; /* used by pinctrl API */
- struct pinctrl *usbc_en2_gpio_p; /* used by pinctrl API */
- struct device_node *hph_en1_gpio_p; /* used by pinctrl API */
- struct device_node *hph_en0_gpio_p; /* used by pinctrl API */
- struct snd_info_entry *codec_root;
- struct msm_pinctrl_info pinctrl_info;
-};
-
-struct msm_asoc_wcd93xx_codec {
- void* (*get_afe_config_fn)(struct snd_soc_codec *codec,
- enum afe_config_type config_type);
- void (*mbhc_hs_detect_exit)(struct snd_soc_codec *codec);
-};
-
-static const char *const pin_states[] = {"sleep", "i2s-active",
- "tdm-active"};
-
-enum {
- TDM_0 = 0,
- TDM_1,
- TDM_2,
- TDM_3,
- TDM_4,
- TDM_5,
- TDM_6,
- TDM_7,
- TDM_PORT_MAX,
-};
-
-enum {
- TDM_PRI = 0,
- TDM_SEC,
- TDM_TERT,
- TDM_QUAT,
- TDM_INTERFACE_MAX,
-};
-
-struct tdm_port {
- u32 mode;
- u32 channel;
-};
-
-/* TDM default config */
-static struct dev_config tdm_rx_cfg[TDM_INTERFACE_MAX][TDM_PORT_MAX] = {
- { /* PRI TDM */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_0 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_1 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_2 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_3 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_4 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_5 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_6 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_7 */
- },
- { /* SEC TDM */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_0 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_1 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_2 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_3 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_4 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_5 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_6 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_7 */
- },
- { /* TERT TDM */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_0 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_1 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_2 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_3 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_4 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_5 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_6 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_7 */
- },
- { /* QUAT TDM */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_0 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_1 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_2 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_3 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_4 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_5 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_6 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* RX_7 */
- }
-};
-
-/* TDM default config */
-static struct dev_config tdm_tx_cfg[TDM_INTERFACE_MAX][TDM_PORT_MAX] = {
- { /* PRI TDM */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_0 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_1 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_2 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_3 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_4 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_5 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_6 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_7 */
- },
- { /* SEC TDM */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_0 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_1 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_2 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_3 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_4 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_5 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_6 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_7 */
- },
- { /* TERT TDM */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_0 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_1 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_2 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_3 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_4 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_5 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_6 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_7 */
- },
- { /* QUAT TDM */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_0 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_1 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_2 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_3 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_4 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_5 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_6 */
- {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1}, /* TX_7 */
- }
-};
-
-
-/* Default configuration of slimbus channels */
-static struct dev_config slim_rx_cfg[] = {
- [SLIM_RX_0] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_RX_1] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_RX_2] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_RX_3] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_RX_4] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_RX_5] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_RX_6] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_RX_7] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
-};
-
-static struct dev_config slim_tx_cfg[] = {
- [SLIM_TX_0] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_TX_1] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_TX_2] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_TX_3] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_TX_4] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_TX_5] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_TX_6] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_TX_7] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SLIM_TX_8] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 2},
-};
-
-
-/* Default configuration of external display BE */
-static struct dev_config ext_disp_rx_cfg[] = {
- [DP_RX_IDX] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 2},
-};
-
-static struct dev_config usb_rx_cfg = {
- .sample_rate = SAMPLING_RATE_48KHZ,
- .bit_format = SNDRV_PCM_FORMAT_S16_LE,
- .channels = 2,
-};
-
-static struct dev_config usb_tx_cfg = {
- .sample_rate = SAMPLING_RATE_48KHZ,
- .bit_format = SNDRV_PCM_FORMAT_S16_LE,
- .channels = 1,
-};
-
-static struct dev_config proxy_rx_cfg = {
- .sample_rate = SAMPLING_RATE_48KHZ,
- .bit_format = SNDRV_PCM_FORMAT_S16_LE,
- .channels = 2,
-};
-
-/* Default configuration of MI2S channels */
-static struct dev_config mi2s_rx_cfg[] = {
- [PRIM_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 2},
- [SEC_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 2},
- [TERT_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 2},
- [QUAT_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 2},
-};
-
-static struct dev_config mi2s_tx_cfg[] = {
- [PRIM_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SEC_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [TERT_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [QUAT_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
-};
-
-static struct dev_config aux_pcm_rx_cfg[] = {
- [PRIM_AUX_PCM] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SEC_AUX_PCM] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [TERT_AUX_PCM] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [QUAT_AUX_PCM] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
-};
-
-static struct dev_config aux_pcm_tx_cfg[] = {
- [PRIM_AUX_PCM] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [SEC_AUX_PCM] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [TERT_AUX_PCM] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
- [QUAT_AUX_PCM] = {SAMPLING_RATE_8KHZ, SNDRV_PCM_FORMAT_S16_LE, 1},
-};
-
-static int msm_vi_feed_tx_ch = 2;
-static const char *const slim_rx_ch_text[] = {"One", "Two"};
-static const char *const slim_tx_ch_text[] = {"One", "Two", "Three", "Four",
- "Five", "Six", "Seven",
- "Eight"};
-static const char *const vi_feed_ch_text[] = {"One", "Two"};
-static char const *bit_format_text[] = {"S16_LE", "S24_LE", "S24_3LE",
- "S32_LE"};
-static char const *ext_disp_bit_format_text[] = {"S16_LE", "S24_LE",
- "S24_3LE"};
-static char const *slim_sample_rate_text[] = {"KHZ_8", "KHZ_16",
- "KHZ_32", "KHZ_44P1", "KHZ_48",
- "KHZ_88P2", "KHZ_96", "KHZ_176P4",
- "KHZ_192", "KHZ_352P8", "KHZ_384"};
-static char const *bt_sample_rate_text[] = {"KHZ_8", "KHZ_16",
- "KHZ_44P1", "KHZ_48",
- "KHZ_88P2", "KHZ_96"};
-static const char *const usb_ch_text[] = {"One", "Two", "Three", "Four",
- "Five", "Six", "Seven",
- "Eight"};
-static char const *ch_text[] = {"Two", "Three", "Four", "Five",
- "Six", "Seven", "Eight"};
-static char const *usb_sample_rate_text[] = {"KHZ_8", "KHZ_11P025",
- "KHZ_16", "KHZ_22P05",
- "KHZ_32", "KHZ_44P1", "KHZ_48",
- "KHZ_88P2", "KHZ_96", "KHZ_176P4",
- "KHZ_192", "KHZ_352P8", "KHZ_384"};
-static char const *ext_disp_sample_rate_text[] = {"KHZ_48", "KHZ_96",
- "KHZ_192", "KHZ_32", "KHZ_44P1",
- "KHZ_88P2", "KHZ_176P4" };
-static char const *tdm_ch_text[] = {"One", "Two", "Three", "Four",
- "Five", "Six", "Seven", "Eight"};
-static char const *tdm_bit_format_text[] = {"S16_LE", "S24_LE", "S32_LE"};
-static char const *tdm_sample_rate_text[] = {"KHZ_8", "KHZ_16", "KHZ_32",
- "KHZ_48", "KHZ_176P4",
- "KHZ_352P8"};
-static const char *const auxpcm_rate_text[] = {"KHZ_8", "KHZ_16"};
-static char const *mi2s_rate_text[] = {"KHZ_8", "KHZ_11P025", "KHZ_16",
- "KHZ_22P05", "KHZ_32", "KHZ_44P1",
- "KHZ_48", "KHZ_96", "KHZ_192"};
-static const char *const mi2s_ch_text[] = {"One", "Two", "Three", "Four",
- "Five", "Six", "Seven",
- "Eight"};
-static const char *const hifi_text[] = {"Off", "On"};
-static const char *const qos_text[] = {"Disable", "Enable"};
-
-static SOC_ENUM_SINGLE_EXT_DECL(slim_0_rx_chs, slim_rx_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_2_rx_chs, slim_rx_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_0_tx_chs, slim_tx_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_1_tx_chs, slim_tx_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_5_rx_chs, slim_rx_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_6_rx_chs, slim_rx_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(usb_rx_chs, usb_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(usb_tx_chs, usb_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(vi_feed_tx_chs, vi_feed_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(ext_disp_rx_chs, ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(proxy_rx_chs, ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_0_rx_format, bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_5_rx_format, bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_6_rx_format, bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_0_tx_format, bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(usb_rx_format, bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(usb_tx_format, bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(ext_disp_rx_format, ext_disp_bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_0_rx_sample_rate, slim_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_2_rx_sample_rate, slim_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_0_tx_sample_rate, slim_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_5_rx_sample_rate, slim_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(slim_6_rx_sample_rate, slim_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(bt_sample_rate, bt_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(usb_rx_sample_rate, usb_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(usb_tx_sample_rate, usb_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(ext_disp_rx_sample_rate,
- ext_disp_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tdm_tx_chs, tdm_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tdm_tx_format, tdm_bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tdm_tx_sample_rate, tdm_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tdm_rx_chs, tdm_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tdm_rx_format, tdm_bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tdm_rx_sample_rate, tdm_sample_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(prim_aux_pcm_rx_sample_rate, auxpcm_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(sec_aux_pcm_rx_sample_rate, auxpcm_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tert_aux_pcm_rx_sample_rate, auxpcm_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(quat_aux_pcm_rx_sample_rate, auxpcm_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(prim_aux_pcm_tx_sample_rate, auxpcm_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(sec_aux_pcm_tx_sample_rate, auxpcm_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tert_aux_pcm_tx_sample_rate, auxpcm_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(quat_aux_pcm_tx_sample_rate, auxpcm_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(prim_mi2s_rx_sample_rate, mi2s_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(sec_mi2s_rx_sample_rate, mi2s_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tert_mi2s_rx_sample_rate, mi2s_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(quat_mi2s_rx_sample_rate, mi2s_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(prim_mi2s_tx_sample_rate, mi2s_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(sec_mi2s_tx_sample_rate, mi2s_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tert_mi2s_tx_sample_rate, mi2s_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(quat_mi2s_tx_sample_rate, mi2s_rate_text);
-static SOC_ENUM_SINGLE_EXT_DECL(prim_mi2s_rx_chs, mi2s_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(prim_mi2s_tx_chs, mi2s_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(sec_mi2s_rx_chs, mi2s_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(sec_mi2s_tx_chs, mi2s_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tert_mi2s_rx_chs, mi2s_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(tert_mi2s_tx_chs, mi2s_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(quat_mi2s_rx_chs, mi2s_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(quat_mi2s_tx_chs, mi2s_ch_text);
-static SOC_ENUM_SINGLE_EXT_DECL(mi2s_rx_format, bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(mi2s_tx_format, bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(aux_pcm_rx_format, bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(aux_pcm_tx_format, bit_format_text);
-static SOC_ENUM_SINGLE_EXT_DECL(hifi_function, hifi_text);
-static SOC_ENUM_SINGLE_EXT_DECL(qos_vote, qos_text);
-
-static struct platform_device *spdev;
-static int msm_hifi_control;
-static int qos_vote_status;
-
-static bool is_initial_boot;
-static bool codec_reg_done;
-static struct snd_soc_aux_dev *msm_aux_dev;
-static struct snd_soc_codec_conf *msm_codec_conf;
-static struct msm_asoc_wcd93xx_codec msm_codec_fn;
-
-static void *def_tavil_mbhc_cal(void);
-static int msm_snd_enable_codec_ext_clk(struct snd_soc_codec *codec,
- int enable, bool dapm);
-static int msm_wsa881x_init(struct snd_soc_component *component);
-
-/*
- * Need to report LINEIN
- * if R/L channel impedance is larger than 5K ohm
- */
-static struct wcd_mbhc_config wcd_mbhc_cfg = {
- .read_fw_bin = false,
- .calibration = NULL,
- .detect_extn_cable = true,
- .mono_stero_detection = false,
- .swap_gnd_mic = NULL,
- .hs_ext_micbias = true,
- .key_code[0] = KEY_MEDIA,
- .key_code[1] = KEY_VOICECOMMAND,
- .key_code[2] = KEY_VOLUMEUP,
- .key_code[3] = KEY_VOLUMEDOWN,
- .key_code[4] = 0,
- .key_code[5] = 0,
- .key_code[6] = 0,
- .key_code[7] = 0,
- .linein_th = 5000,
- .moisture_en = true,
- .mbhc_micbias = MIC_BIAS_2,
- .anc_micbias = MIC_BIAS_2,
- .enable_anc_mic_detect = false,
-};
-
-static struct snd_soc_dapm_route wcd_audio_paths[] = {
- {"MIC BIAS1", NULL, "MCLK TX"},
- {"MIC BIAS2", NULL, "MCLK TX"},
- {"MIC BIAS3", NULL, "MCLK TX"},
- {"MIC BIAS4", NULL, "MCLK TX"},
-};
-
-static struct afe_clk_set mi2s_clk[MI2S_MAX] = {
- {
- AFE_API_VERSION_I2S_CONFIG,
- Q6AFE_LPASS_CLK_ID_PRI_MI2S_IBIT,
- Q6AFE_LPASS_IBIT_CLK_1_P536_MHZ,
- Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO,
- Q6AFE_LPASS_CLK_ROOT_DEFAULT,
- 0,
- },
- {
- AFE_API_VERSION_I2S_CONFIG,
- Q6AFE_LPASS_CLK_ID_SEC_MI2S_IBIT,
- Q6AFE_LPASS_IBIT_CLK_1_P536_MHZ,
- Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO,
- Q6AFE_LPASS_CLK_ROOT_DEFAULT,
- 0,
- },
- {
- AFE_API_VERSION_I2S_CONFIG,
- Q6AFE_LPASS_CLK_ID_TER_MI2S_IBIT,
- Q6AFE_LPASS_IBIT_CLK_1_P536_MHZ,
- Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO,
- Q6AFE_LPASS_CLK_ROOT_DEFAULT,
- 0,
- },
- {
- AFE_API_VERSION_I2S_CONFIG,
- Q6AFE_LPASS_CLK_ID_QUAD_MI2S_IBIT,
- Q6AFE_LPASS_IBIT_CLK_1_P536_MHZ,
- Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO,
- Q6AFE_LPASS_CLK_ROOT_DEFAULT,
- 0,
- }
-};
-
-static struct mi2s_conf mi2s_intf_conf[MI2S_MAX];
-
-static int slim_get_sample_rate_val(int sample_rate)
-{
- int sample_rate_val = 0;
-
- switch (sample_rate) {
- case SAMPLING_RATE_8KHZ:
- sample_rate_val = 0;
- break;
- case SAMPLING_RATE_16KHZ:
- sample_rate_val = 1;
- break;
- case SAMPLING_RATE_32KHZ:
- sample_rate_val = 2;
- break;
- case SAMPLING_RATE_44P1KHZ:
- sample_rate_val = 3;
- break;
- case SAMPLING_RATE_48KHZ:
- sample_rate_val = 4;
- break;
- case SAMPLING_RATE_88P2KHZ:
- sample_rate_val = 5;
- break;
- case SAMPLING_RATE_96KHZ:
- sample_rate_val = 6;
- break;
- case SAMPLING_RATE_176P4KHZ:
- sample_rate_val = 7;
- break;
- case SAMPLING_RATE_192KHZ:
- sample_rate_val = 8;
- break;
- case SAMPLING_RATE_352P8KHZ:
- sample_rate_val = 9;
- break;
- case SAMPLING_RATE_384KHZ:
- sample_rate_val = 10;
- break;
- default:
- sample_rate_val = 4;
- break;
- }
- return sample_rate_val;
-}
-
-static int slim_get_sample_rate(int value)
-{
- int sample_rate = 0;
-
- switch (value) {
- case 0:
- sample_rate = SAMPLING_RATE_8KHZ;
- break;
- case 1:
- sample_rate = SAMPLING_RATE_16KHZ;
- break;
- case 2:
- sample_rate = SAMPLING_RATE_32KHZ;
- break;
- case 3:
- sample_rate = SAMPLING_RATE_44P1KHZ;
- break;
- case 4:
- sample_rate = SAMPLING_RATE_48KHZ;
- break;
- case 5:
- sample_rate = SAMPLING_RATE_88P2KHZ;
- break;
- case 6:
- sample_rate = SAMPLING_RATE_96KHZ;
- break;
- case 7:
- sample_rate = SAMPLING_RATE_176P4KHZ;
- break;
- case 8:
- sample_rate = SAMPLING_RATE_192KHZ;
- break;
- case 9:
- sample_rate = SAMPLING_RATE_352P8KHZ;
- break;
- case 10:
- sample_rate = SAMPLING_RATE_384KHZ;
- break;
- default:
- sample_rate = SAMPLING_RATE_48KHZ;
- break;
- }
- return sample_rate;
-}
-
-static int slim_get_bit_format_val(int bit_format)
-{
- int val = 0;
-
- switch (bit_format) {
- case SNDRV_PCM_FORMAT_S32_LE:
- val = 3;
- break;
- case SNDRV_PCM_FORMAT_S24_3LE:
- val = 2;
- break;
- case SNDRV_PCM_FORMAT_S24_LE:
- val = 1;
- break;
- case SNDRV_PCM_FORMAT_S16_LE:
- default:
- val = 0;
- break;
- }
- return val;
-}
-
-static int slim_get_bit_format(int val)
-{
- int bit_fmt = SNDRV_PCM_FORMAT_S16_LE;
-
- switch (val) {
- case 0:
- bit_fmt = SNDRV_PCM_FORMAT_S16_LE;
- break;
- case 1:
- bit_fmt = SNDRV_PCM_FORMAT_S24_LE;
- break;
- case 2:
- bit_fmt = SNDRV_PCM_FORMAT_S24_3LE;
- break;
- case 3:
- bit_fmt = SNDRV_PCM_FORMAT_S32_LE;
- break;
- default:
- bit_fmt = SNDRV_PCM_FORMAT_S16_LE;
- break;
- }
- return bit_fmt;
-}
-
-static int slim_get_port_idx(struct snd_kcontrol *kcontrol)
-{
- int port_id = 0;
-
- if (strnstr(kcontrol->id.name, "SLIM_0_RX", sizeof("SLIM_0_RX")))
- port_id = SLIM_RX_0;
- else if (strnstr(kcontrol->id.name, "SLIM_2_RX", sizeof("SLIM_2_RX")))
- port_id = SLIM_RX_2;
- else if (strnstr(kcontrol->id.name, "SLIM_5_RX", sizeof("SLIM_5_RX")))
- port_id = SLIM_RX_5;
- else if (strnstr(kcontrol->id.name, "SLIM_6_RX", sizeof("SLIM_6_RX")))
- port_id = SLIM_RX_6;
- else if (strnstr(kcontrol->id.name, "SLIM_0_TX", sizeof("SLIM_0_TX")))
- port_id = SLIM_TX_0;
- else if (strnstr(kcontrol->id.name, "SLIM_1_TX", sizeof("SLIM_1_TX")))
- port_id = SLIM_TX_1;
- else {
- pr_err("%s: unsupported channel: %s",
- __func__, kcontrol->id.name);
- return -EINVAL;
- }
-
- return port_id;
-}
-
-static int slim_rx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- ucontrol->value.enumerated.item[0] =
- slim_get_sample_rate_val(slim_rx_cfg[ch_num].sample_rate);
-
- pr_debug("%s: slim[%d]_rx_sample_rate = %d, item = %d\n", __func__,
- ch_num, slim_rx_cfg[ch_num].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int slim_rx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- slim_rx_cfg[ch_num].sample_rate =
- slim_get_sample_rate(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: slim[%d]_rx_sample_rate = %d, item = %d\n", __func__,
- ch_num, slim_rx_cfg[ch_num].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int slim_tx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- ucontrol->value.enumerated.item[0] =
- slim_get_sample_rate_val(slim_tx_cfg[ch_num].sample_rate);
-
- pr_debug("%s: slim[%d]_tx_sample_rate = %d, item = %d\n", __func__,
- ch_num, slim_tx_cfg[ch_num].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int slim_tx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int sample_rate = 0;
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- sample_rate = slim_get_sample_rate(ucontrol->value.enumerated.item[0]);
- if (sample_rate == SAMPLING_RATE_44P1KHZ) {
- pr_err("%s: Unsupported sample rate %d: for Tx path\n",
- __func__, sample_rate);
- return -EINVAL;
- }
- slim_tx_cfg[ch_num].sample_rate = sample_rate;
-
- pr_debug("%s: slim[%d]_tx_sample_rate = %d, value = %d\n", __func__,
- ch_num, slim_tx_cfg[ch_num].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int slim_rx_bit_format_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- ucontrol->value.enumerated.item[0] =
- slim_get_bit_format_val(slim_rx_cfg[ch_num].bit_format);
-
- pr_debug("%s: slim[%d]_rx_bit_format = %d, ucontrol value = %d\n",
- __func__, ch_num, slim_rx_cfg[ch_num].bit_format,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int slim_rx_bit_format_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- slim_rx_cfg[ch_num].bit_format =
- slim_get_bit_format(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: slim[%d]_rx_bit_format = %d, ucontrol value = %d\n",
- __func__, ch_num, slim_rx_cfg[ch_num].bit_format,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int slim_tx_bit_format_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- ucontrol->value.enumerated.item[0] =
- slim_get_bit_format_val(slim_tx_cfg[ch_num].bit_format);
-
- pr_debug("%s: slim[%d]_tx_bit_format = %d, ucontrol value = %d\n",
- __func__, ch_num, slim_tx_cfg[ch_num].bit_format,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int slim_tx_bit_format_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- slim_tx_cfg[ch_num].bit_format =
- slim_get_bit_format(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: slim[%d]_tx_bit_format = %d, ucontrol value = %d\n",
- __func__, ch_num, slim_tx_cfg[ch_num].bit_format,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int msm_slim_rx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- pr_debug("%s: msm_slim_[%d]_rx_ch = %d\n", __func__,
- ch_num, slim_rx_cfg[ch_num].channels);
- ucontrol->value.enumerated.item[0] = slim_rx_cfg[ch_num].channels - 1;
-
- return 0;
-}
-
-static int msm_slim_rx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- slim_rx_cfg[ch_num].channels = ucontrol->value.enumerated.item[0] + 1;
- pr_debug("%s: msm_slim_[%d]_rx_ch = %d\n", __func__,
- ch_num, slim_rx_cfg[ch_num].channels);
-
- return 1;
-}
-
-static int msm_slim_tx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- pr_debug("%s: msm_slim_[%d]_tx_ch = %d\n", __func__,
- ch_num, slim_tx_cfg[ch_num].channels);
- ucontrol->value.enumerated.item[0] = slim_tx_cfg[ch_num].channels - 1;
-
- return 0;
-}
-
-static int msm_slim_tx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int ch_num = slim_get_port_idx(kcontrol);
-
- if (ch_num < 0)
- return ch_num;
-
- slim_tx_cfg[ch_num].channels = ucontrol->value.enumerated.item[0] + 1;
- pr_debug("%s: msm_slim_[%d]_tx_ch = %d\n", __func__,
- ch_num, slim_tx_cfg[ch_num].channels);
-
- return 1;
-}
-
-static int msm_vi_feed_tx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- ucontrol->value.integer.value[0] = msm_vi_feed_tx_ch - 1;
- pr_debug("%s: msm_vi_feed_tx_ch = %ld\n", __func__,
- ucontrol->value.integer.value[0]);
- return 0;
-}
-
-static int msm_vi_feed_tx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- msm_vi_feed_tx_ch = ucontrol->value.integer.value[0] + 1;
-
- pr_debug("%s: msm_vi_feed_tx_ch = %d\n", __func__, msm_vi_feed_tx_ch);
- return 1;
-}
-
-static int msm_bt_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- /*
- * Slimbus_7_Rx/Tx sample rate values should always be in sync (same)
- * when used for BT_SCO use case. Return either Rx or Tx sample rate
- * value.
- */
- switch (slim_rx_cfg[SLIM_RX_7].sample_rate) {
- case SAMPLING_RATE_96KHZ:
- ucontrol->value.integer.value[0] = 5;
- break;
- case SAMPLING_RATE_88P2KHZ:
- ucontrol->value.integer.value[0] = 4;
- break;
- case SAMPLING_RATE_48KHZ:
- ucontrol->value.integer.value[0] = 3;
- break;
- case SAMPLING_RATE_44P1KHZ:
- ucontrol->value.integer.value[0] = 2;
- break;
- case SAMPLING_RATE_16KHZ:
- ucontrol->value.integer.value[0] = 1;
- break;
- case SAMPLING_RATE_8KHZ:
- default:
- ucontrol->value.integer.value[0] = 0;
- break;
- }
- pr_debug("%s: sample rate = %d", __func__,
- slim_rx_cfg[SLIM_RX_7].sample_rate);
-
- return 0;
-}
-
-static int msm_bt_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- switch (ucontrol->value.integer.value[0]) {
- case 1:
- slim_rx_cfg[SLIM_RX_7].sample_rate = SAMPLING_RATE_16KHZ;
- slim_tx_cfg[SLIM_TX_7].sample_rate = SAMPLING_RATE_16KHZ;
- break;
- case 2:
- slim_rx_cfg[SLIM_RX_7].sample_rate = SAMPLING_RATE_44P1KHZ;
- slim_tx_cfg[SLIM_TX_7].sample_rate = SAMPLING_RATE_44P1KHZ;
- break;
- case 3:
- slim_rx_cfg[SLIM_RX_7].sample_rate = SAMPLING_RATE_48KHZ;
- slim_tx_cfg[SLIM_TX_7].sample_rate = SAMPLING_RATE_48KHZ;
- break;
- case 4:
- slim_rx_cfg[SLIM_RX_7].sample_rate = SAMPLING_RATE_88P2KHZ;
- slim_tx_cfg[SLIM_TX_7].sample_rate = SAMPLING_RATE_88P2KHZ;
- break;
- case 5:
- slim_rx_cfg[SLIM_RX_7].sample_rate = SAMPLING_RATE_96KHZ;
- slim_tx_cfg[SLIM_TX_7].sample_rate = SAMPLING_RATE_96KHZ;
- break;
- case 0:
- default:
- slim_rx_cfg[SLIM_RX_7].sample_rate = SAMPLING_RATE_8KHZ;
- slim_tx_cfg[SLIM_TX_7].sample_rate = SAMPLING_RATE_8KHZ;
- break;
- }
- pr_debug("%s: sample rates: slim7_rx = %d, slim7_tx = %d, value = %d\n",
- __func__,
- slim_rx_cfg[SLIM_RX_7].sample_rate,
- slim_tx_cfg[SLIM_TX_7].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int usb_audio_rx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- pr_debug("%s: usb_audio_rx_ch = %d\n", __func__,
- usb_rx_cfg.channels);
- ucontrol->value.integer.value[0] = usb_rx_cfg.channels - 1;
- return 0;
-}
-
-static int usb_audio_rx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- usb_rx_cfg.channels = ucontrol->value.integer.value[0] + 1;
-
- pr_debug("%s: usb_audio_rx_ch = %d\n", __func__, usb_rx_cfg.channels);
- return 1;
-}
-
-static int usb_audio_rx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int sample_rate_val;
-
- switch (usb_rx_cfg.sample_rate) {
- case SAMPLING_RATE_384KHZ:
- sample_rate_val = 12;
- break;
- case SAMPLING_RATE_352P8KHZ:
- sample_rate_val = 11;
- break;
- case SAMPLING_RATE_192KHZ:
- sample_rate_val = 10;
- break;
- case SAMPLING_RATE_176P4KHZ:
- sample_rate_val = 9;
- break;
- case SAMPLING_RATE_96KHZ:
- sample_rate_val = 8;
- break;
- case SAMPLING_RATE_88P2KHZ:
- sample_rate_val = 7;
- break;
- case SAMPLING_RATE_48KHZ:
- sample_rate_val = 6;
- break;
- case SAMPLING_RATE_44P1KHZ:
- sample_rate_val = 5;
- break;
- case SAMPLING_RATE_32KHZ:
- sample_rate_val = 4;
- break;
- case SAMPLING_RATE_22P05KHZ:
- sample_rate_val = 3;
- break;
- case SAMPLING_RATE_16KHZ:
- sample_rate_val = 2;
- break;
- case SAMPLING_RATE_11P025KHZ:
- sample_rate_val = 1;
- break;
- case SAMPLING_RATE_8KHZ:
- default:
- sample_rate_val = 0;
- break;
- }
-
- ucontrol->value.integer.value[0] = sample_rate_val;
- pr_debug("%s: usb_audio_rx_sample_rate = %d\n", __func__,
- usb_rx_cfg.sample_rate);
- return 0;
-}
-
-static int usb_audio_rx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- switch (ucontrol->value.integer.value[0]) {
- case 12:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_384KHZ;
- break;
- case 11:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_352P8KHZ;
- break;
- case 10:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_192KHZ;
- break;
- case 9:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_176P4KHZ;
- break;
- case 8:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_96KHZ;
- break;
- case 7:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_88P2KHZ;
- break;
- case 6:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_48KHZ;
- break;
- case 5:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_44P1KHZ;
- break;
- case 4:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_32KHZ;
- break;
- case 3:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_22P05KHZ;
- break;
- case 2:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_16KHZ;
- break;
- case 1:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_11P025KHZ;
- break;
- case 0:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_8KHZ;
- break;
- default:
- usb_rx_cfg.sample_rate = SAMPLING_RATE_48KHZ;
- break;
- }
-
- pr_debug("%s: control value = %ld, usb_audio_rx_sample_rate = %d\n",
- __func__, ucontrol->value.integer.value[0],
- usb_rx_cfg.sample_rate);
- return 0;
-}
-
-static int usb_audio_rx_format_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- switch (usb_rx_cfg.bit_format) {
- case SNDRV_PCM_FORMAT_S32_LE:
- ucontrol->value.integer.value[0] = 3;
- break;
- case SNDRV_PCM_FORMAT_S24_3LE:
- ucontrol->value.integer.value[0] = 2;
- break;
- case SNDRV_PCM_FORMAT_S24_LE:
- ucontrol->value.integer.value[0] = 1;
- break;
- case SNDRV_PCM_FORMAT_S16_LE:
- default:
- ucontrol->value.integer.value[0] = 0;
- break;
- }
-
- pr_debug("%s: usb_audio_rx_format = %d, ucontrol value = %ld\n",
- __func__, usb_rx_cfg.bit_format,
- ucontrol->value.integer.value[0]);
- return 0;
-}
-
-static int usb_audio_rx_format_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int rc = 0;
-
- switch (ucontrol->value.integer.value[0]) {
- case 3:
- usb_rx_cfg.bit_format = SNDRV_PCM_FORMAT_S32_LE;
- break;
- case 2:
- usb_rx_cfg.bit_format = SNDRV_PCM_FORMAT_S24_3LE;
- break;
- case 1:
- usb_rx_cfg.bit_format = SNDRV_PCM_FORMAT_S24_LE;
- break;
- case 0:
- default:
- usb_rx_cfg.bit_format = SNDRV_PCM_FORMAT_S16_LE;
- break;
- }
- pr_debug("%s: usb_audio_rx_format = %d, ucontrol value = %ld\n",
- __func__, usb_rx_cfg.bit_format,
- ucontrol->value.integer.value[0]);
-
- return rc;
-}
-
-static int usb_audio_tx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- pr_debug("%s: usb_audio_tx_ch = %d\n", __func__,
- usb_tx_cfg.channels);
- ucontrol->value.integer.value[0] = usb_tx_cfg.channels - 1;
- return 0;
-}
-
-static int usb_audio_tx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- usb_tx_cfg.channels = ucontrol->value.integer.value[0] + 1;
-
- pr_debug("%s: usb_audio_tx_ch = %d\n", __func__, usb_tx_cfg.channels);
- return 1;
-}
-
-static int usb_audio_tx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int sample_rate_val;
-
- switch (usb_tx_cfg.sample_rate) {
- case SAMPLING_RATE_384KHZ:
- sample_rate_val = 12;
- break;
- case SAMPLING_RATE_352P8KHZ:
- sample_rate_val = 11;
- break;
- case SAMPLING_RATE_192KHZ:
- sample_rate_val = 10;
- break;
- case SAMPLING_RATE_176P4KHZ:
- sample_rate_val = 9;
- break;
- case SAMPLING_RATE_96KHZ:
- sample_rate_val = 8;
- break;
- case SAMPLING_RATE_88P2KHZ:
- sample_rate_val = 7;
- break;
- case SAMPLING_RATE_48KHZ:
- sample_rate_val = 6;
- break;
- case SAMPLING_RATE_44P1KHZ:
- sample_rate_val = 5;
- break;
- case SAMPLING_RATE_32KHZ:
- sample_rate_val = 4;
- break;
- case SAMPLING_RATE_22P05KHZ:
- sample_rate_val = 3;
- break;
- case SAMPLING_RATE_16KHZ:
- sample_rate_val = 2;
- break;
- case SAMPLING_RATE_11P025KHZ:
- sample_rate_val = 1;
- break;
- case SAMPLING_RATE_8KHZ:
- sample_rate_val = 0;
- break;
- default:
- sample_rate_val = 6;
- break;
- }
-
- ucontrol->value.integer.value[0] = sample_rate_val;
- pr_debug("%s: usb_audio_tx_sample_rate = %d\n", __func__,
- usb_tx_cfg.sample_rate);
- return 0;
-}
-
-static int usb_audio_tx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- switch (ucontrol->value.integer.value[0]) {
- case 12:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_384KHZ;
- break;
- case 11:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_352P8KHZ;
- break;
- case 10:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_192KHZ;
- break;
- case 9:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_176P4KHZ;
- break;
- case 8:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_96KHZ;
- break;
- case 7:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_88P2KHZ;
- break;
- case 6:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_48KHZ;
- break;
- case 5:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_44P1KHZ;
- break;
- case 4:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_32KHZ;
- break;
- case 3:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_22P05KHZ;
- break;
- case 2:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_16KHZ;
- break;
- case 1:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_11P025KHZ;
- break;
- case 0:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_8KHZ;
- break;
- default:
- usb_tx_cfg.sample_rate = SAMPLING_RATE_48KHZ;
- break;
- }
-
- pr_debug("%s: control value = %ld, usb_audio_tx_sample_rate = %d\n",
- __func__, ucontrol->value.integer.value[0],
- usb_tx_cfg.sample_rate);
- return 0;
-}
-
-static int usb_audio_tx_format_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- switch (usb_tx_cfg.bit_format) {
- case SNDRV_PCM_FORMAT_S32_LE:
- ucontrol->value.integer.value[0] = 3;
- break;
- case SNDRV_PCM_FORMAT_S24_3LE:
- ucontrol->value.integer.value[0] = 2;
- break;
- case SNDRV_PCM_FORMAT_S24_LE:
- ucontrol->value.integer.value[0] = 1;
- break;
- case SNDRV_PCM_FORMAT_S16_LE:
- default:
- ucontrol->value.integer.value[0] = 0;
- break;
- }
-
- pr_debug("%s: usb_audio_tx_format = %d, ucontrol value = %ld\n",
- __func__, usb_tx_cfg.bit_format,
- ucontrol->value.integer.value[0]);
- return 0;
-}
-
-static int usb_audio_tx_format_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int rc = 0;
-
- switch (ucontrol->value.integer.value[0]) {
- case 3:
- usb_tx_cfg.bit_format = SNDRV_PCM_FORMAT_S32_LE;
- break;
- case 2:
- usb_tx_cfg.bit_format = SNDRV_PCM_FORMAT_S24_3LE;
- break;
- case 1:
- usb_tx_cfg.bit_format = SNDRV_PCM_FORMAT_S24_LE;
- break;
- case 0:
- default:
- usb_tx_cfg.bit_format = SNDRV_PCM_FORMAT_S16_LE;
- break;
- }
- pr_debug("%s: usb_audio_tx_format = %d, ucontrol value = %ld\n",
- __func__, usb_tx_cfg.bit_format,
- ucontrol->value.integer.value[0]);
-
- return rc;
-}
-
-static int ext_disp_get_port_idx(struct snd_kcontrol *kcontrol)
-{
- int idx;
-
- if (strnstr(kcontrol->id.name, "Display Port RX",
- sizeof("Display Port RX"))) {
- idx = DP_RX_IDX;
- } else {
- pr_err("%s: unsupported BE: %s",
- __func__, kcontrol->id.name);
- idx = -EINVAL;
- }
-
- return idx;
-}
-
-static int ext_disp_rx_format_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = ext_disp_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- switch (ext_disp_rx_cfg[idx].bit_format) {
- case SNDRV_PCM_FORMAT_S24_3LE:
- ucontrol->value.integer.value[0] = 2;
- break;
- case SNDRV_PCM_FORMAT_S24_LE:
- ucontrol->value.integer.value[0] = 1;
- break;
- case SNDRV_PCM_FORMAT_S16_LE:
- default:
- ucontrol->value.integer.value[0] = 0;
- break;
- }
-
- pr_debug("%s: ext_disp_rx[%d].format = %d, ucontrol value = %ld\n",
- __func__, idx, ext_disp_rx_cfg[idx].bit_format,
- ucontrol->value.integer.value[0]);
- return 0;
-}
-
-static int ext_disp_rx_format_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = ext_disp_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- switch (ucontrol->value.integer.value[0]) {
- case 2:
- ext_disp_rx_cfg[idx].bit_format = SNDRV_PCM_FORMAT_S24_3LE;
- break;
- case 1:
- ext_disp_rx_cfg[idx].bit_format = SNDRV_PCM_FORMAT_S24_LE;
- break;
- case 0:
- default:
- ext_disp_rx_cfg[idx].bit_format = SNDRV_PCM_FORMAT_S16_LE;
- break;
- }
- pr_debug("%s: ext_disp_rx[%d].format = %d, ucontrol value = %ld\n",
- __func__, idx, ext_disp_rx_cfg[idx].bit_format,
- ucontrol->value.integer.value[0]);
-
- return 0;
-}
-
-static int ext_disp_rx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = ext_disp_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- ucontrol->value.integer.value[0] =
- ext_disp_rx_cfg[idx].channels - 2;
-
- pr_debug("%s: ext_disp_rx[%d].ch = %d\n", __func__,
- idx, ext_disp_rx_cfg[idx].channels);
-
- return 0;
-}
-
-static int ext_disp_rx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = ext_disp_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- ext_disp_rx_cfg[idx].channels =
- ucontrol->value.integer.value[0] + 2;
-
- pr_debug("%s: ext_disp_rx[%d].ch = %d\n", __func__,
- idx, ext_disp_rx_cfg[idx].channels);
- return 1;
-}
-
-static int ext_disp_rx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int sample_rate_val;
- int idx = ext_disp_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- switch (ext_disp_rx_cfg[idx].sample_rate) {
- case SAMPLING_RATE_176P4KHZ:
- sample_rate_val = 6;
- break;
-
- case SAMPLING_RATE_88P2KHZ:
- sample_rate_val = 5;
- break;
-
- case SAMPLING_RATE_44P1KHZ:
- sample_rate_val = 4;
- break;
-
- case SAMPLING_RATE_32KHZ:
- sample_rate_val = 3;
- break;
-
- case SAMPLING_RATE_192KHZ:
- sample_rate_val = 2;
- break;
-
- case SAMPLING_RATE_96KHZ:
- sample_rate_val = 1;
- break;
-
- case SAMPLING_RATE_48KHZ:
- default:
- sample_rate_val = 0;
- break;
- }
-
- ucontrol->value.integer.value[0] = sample_rate_val;
- pr_debug("%s: ext_disp_rx[%d].sample_rate = %d\n", __func__,
- idx, ext_disp_rx_cfg[idx].sample_rate);
-
- return 0;
-}
-
-static int ext_disp_rx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = ext_disp_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- switch (ucontrol->value.integer.value[0]) {
- case 6:
- ext_disp_rx_cfg[idx].sample_rate = SAMPLING_RATE_176P4KHZ;
- break;
- case 5:
- ext_disp_rx_cfg[idx].sample_rate = SAMPLING_RATE_88P2KHZ;
- break;
- case 4:
- ext_disp_rx_cfg[idx].sample_rate = SAMPLING_RATE_44P1KHZ;
- break;
- case 3:
- ext_disp_rx_cfg[idx].sample_rate = SAMPLING_RATE_32KHZ;
- break;
- case 2:
- ext_disp_rx_cfg[idx].sample_rate = SAMPLING_RATE_192KHZ;
- break;
- case 1:
- ext_disp_rx_cfg[idx].sample_rate = SAMPLING_RATE_96KHZ;
- break;
- case 0:
- default:
- ext_disp_rx_cfg[idx].sample_rate = SAMPLING_RATE_48KHZ;
- break;
- }
-
- pr_debug("%s: control value = %ld, ext_disp_rx[%d].sample_rate = %d\n",
- __func__, ucontrol->value.integer.value[0], idx,
- ext_disp_rx_cfg[idx].sample_rate);
- return 0;
-}
-
-static int proxy_rx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- pr_debug("%s: proxy_rx channels = %d\n",
- __func__, proxy_rx_cfg.channels);
- ucontrol->value.integer.value[0] = proxy_rx_cfg.channels - 2;
-
- return 0;
-}
-
-static int proxy_rx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- proxy_rx_cfg.channels = ucontrol->value.integer.value[0] + 2;
- pr_debug("%s: proxy_rx channels = %d\n",
- __func__, proxy_rx_cfg.channels);
-
- return 1;
-}
-
-static int tdm_get_sample_rate(int value)
-{
- int sample_rate = 0;
-
- switch (value) {
- case 0:
- sample_rate = SAMPLING_RATE_8KHZ;
- break;
- case 1:
- sample_rate = SAMPLING_RATE_16KHZ;
- break;
- case 2:
- sample_rate = SAMPLING_RATE_32KHZ;
- break;
- case 3:
- sample_rate = SAMPLING_RATE_48KHZ;
- break;
- case 4:
- sample_rate = SAMPLING_RATE_176P4KHZ;
- break;
- case 5:
- sample_rate = SAMPLING_RATE_352P8KHZ;
- break;
- default:
- sample_rate = SAMPLING_RATE_48KHZ;
- break;
- }
- return sample_rate;
-}
-
-static int aux_pcm_get_sample_rate(int value)
-{
- int sample_rate;
-
- switch (value) {
- case 1:
- sample_rate = SAMPLING_RATE_16KHZ;
- break;
- case 0:
- default:
- sample_rate = SAMPLING_RATE_8KHZ;
- break;
- }
- return sample_rate;
-}
-
-static int tdm_get_sample_rate_val(int sample_rate)
-{
- int sample_rate_val = 0;
-
- switch (sample_rate) {
- case SAMPLING_RATE_8KHZ:
- sample_rate_val = 0;
- break;
- case SAMPLING_RATE_16KHZ:
- sample_rate_val = 1;
- break;
- case SAMPLING_RATE_32KHZ:
- sample_rate_val = 2;
- break;
- case SAMPLING_RATE_48KHZ:
- sample_rate_val = 3;
- break;
- case SAMPLING_RATE_176P4KHZ:
- sample_rate_val = 4;
- break;
- case SAMPLING_RATE_352P8KHZ:
- sample_rate_val = 5;
- break;
- default:
- sample_rate_val = 3;
- break;
- }
- return sample_rate_val;
-}
-
-static int aux_pcm_get_sample_rate_val(int sample_rate)
-{
- int sample_rate_val;
-
- switch (sample_rate) {
- case SAMPLING_RATE_16KHZ:
- sample_rate_val = 1;
- break;
- case SAMPLING_RATE_8KHZ:
- default:
- sample_rate_val = 0;
- break;
- }
- return sample_rate_val;
-}
-
-static int tdm_get_port_idx(struct snd_kcontrol *kcontrol,
- struct tdm_port *port)
-{
- if (port) {
- if (strnstr(kcontrol->id.name, "PRI",
- sizeof(kcontrol->id.name))) {
- port->mode = TDM_PRI;
- } else if (strnstr(kcontrol->id.name, "SEC",
- sizeof(kcontrol->id.name))) {
- port->mode = TDM_SEC;
- } else if (strnstr(kcontrol->id.name, "TERT",
- sizeof(kcontrol->id.name))) {
- port->mode = TDM_TERT;
- } else if (strnstr(kcontrol->id.name, "QUAT",
- sizeof(kcontrol->id.name))) {
- port->mode = TDM_QUAT;
- } else {
- pr_err("%s: unsupported mode in: %s",
- __func__, kcontrol->id.name);
- return -EINVAL;
- }
-
- if (strnstr(kcontrol->id.name, "RX_0",
- sizeof(kcontrol->id.name)) ||
- strnstr(kcontrol->id.name, "TX_0",
- sizeof(kcontrol->id.name))) {
- port->channel = TDM_0;
- } else if (strnstr(kcontrol->id.name, "RX_1",
- sizeof(kcontrol->id.name)) ||
- strnstr(kcontrol->id.name, "TX_1",
- sizeof(kcontrol->id.name))) {
- port->channel = TDM_1;
- } else if (strnstr(kcontrol->id.name, "RX_2",
- sizeof(kcontrol->id.name)) ||
- strnstr(kcontrol->id.name, "TX_2",
- sizeof(kcontrol->id.name))) {
- port->channel = TDM_2;
- } else if (strnstr(kcontrol->id.name, "RX_3",
- sizeof(kcontrol->id.name)) ||
- strnstr(kcontrol->id.name, "TX_3",
- sizeof(kcontrol->id.name))) {
- port->channel = TDM_3;
- } else if (strnstr(kcontrol->id.name, "RX_4",
- sizeof(kcontrol->id.name)) ||
- strnstr(kcontrol->id.name, "TX_4",
- sizeof(kcontrol->id.name))) {
- port->channel = TDM_4;
- } else if (strnstr(kcontrol->id.name, "RX_5",
- sizeof(kcontrol->id.name)) ||
- strnstr(kcontrol->id.name, "TX_5",
- sizeof(kcontrol->id.name))) {
- port->channel = TDM_5;
- } else if (strnstr(kcontrol->id.name, "RX_6",
- sizeof(kcontrol->id.name)) ||
- strnstr(kcontrol->id.name, "TX_6",
- sizeof(kcontrol->id.name))) {
- port->channel = TDM_6;
- } else if (strnstr(kcontrol->id.name, "RX_7",
- sizeof(kcontrol->id.name)) ||
- strnstr(kcontrol->id.name, "TX_7",
- sizeof(kcontrol->id.name))) {
- port->channel = TDM_7;
- } else {
- pr_err("%s: unsupported channel in: %s",
- __func__, kcontrol->id.name);
- return -EINVAL;
- }
- } else
- return -EINVAL;
- return 0;
-}
-
-static int tdm_rx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- ucontrol->value.enumerated.item[0] = tdm_get_sample_rate_val(
- tdm_rx_cfg[port.mode][port.channel].sample_rate);
-
- pr_debug("%s: tdm_rx_sample_rate = %d, item = %d\n", __func__,
- tdm_rx_cfg[port.mode][port.channel].sample_rate,
- ucontrol->value.enumerated.item[0]);
- }
- return ret;
-}
-
-static int tdm_rx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- tdm_rx_cfg[port.mode][port.channel].sample_rate =
- tdm_get_sample_rate(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: tdm_rx_sample_rate = %d, item = %d\n", __func__,
- tdm_rx_cfg[port.mode][port.channel].sample_rate,
- ucontrol->value.enumerated.item[0]);
- }
- return ret;
-}
-
-static int tdm_tx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- ucontrol->value.enumerated.item[0] = tdm_get_sample_rate_val(
- tdm_tx_cfg[port.mode][port.channel].sample_rate);
-
- pr_debug("%s: tdm_tx_sample_rate = %d, item = %d\n", __func__,
- tdm_tx_cfg[port.mode][port.channel].sample_rate,
- ucontrol->value.enumerated.item[0]);
- }
- return ret;
-}
-
-static int tdm_tx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- tdm_tx_cfg[port.mode][port.channel].sample_rate =
- tdm_get_sample_rate(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: tdm_tx_sample_rate = %d, item = %d\n", __func__,
- tdm_tx_cfg[port.mode][port.channel].sample_rate,
- ucontrol->value.enumerated.item[0]);
- }
- return ret;
-}
-
-static int tdm_get_format(int value)
-{
- int format = 0;
-
- switch (value) {
- case 0:
- format = SNDRV_PCM_FORMAT_S16_LE;
- break;
- case 1:
- format = SNDRV_PCM_FORMAT_S24_LE;
- break;
- case 2:
- format = SNDRV_PCM_FORMAT_S32_LE;
- break;
- default:
- format = SNDRV_PCM_FORMAT_S16_LE;
- break;
- }
- return format;
-}
-
-static int tdm_get_format_val(int format)
-{
- int value = 0;
-
- switch (format) {
- case SNDRV_PCM_FORMAT_S16_LE:
- value = 0;
- break;
- case SNDRV_PCM_FORMAT_S24_LE:
- value = 1;
- break;
- case SNDRV_PCM_FORMAT_S32_LE:
- value = 2;
- break;
- default:
- value = 0;
- break;
- }
- return value;
-}
-
-static int tdm_rx_format_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- ucontrol->value.enumerated.item[0] = tdm_get_format_val(
- tdm_rx_cfg[port.mode][port.channel].bit_format);
-
- pr_debug("%s: tdm_rx_bit_format = %d, item = %d\n", __func__,
- tdm_rx_cfg[port.mode][port.channel].bit_format,
- ucontrol->value.enumerated.item[0]);
- }
- return ret;
-}
-
-static int tdm_rx_format_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- tdm_rx_cfg[port.mode][port.channel].bit_format =
- tdm_get_format(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: tdm_rx_bit_format = %d, item = %d\n", __func__,
- tdm_rx_cfg[port.mode][port.channel].bit_format,
- ucontrol->value.enumerated.item[0]);
- }
- return ret;
-}
-
-static int tdm_tx_format_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- ucontrol->value.enumerated.item[0] = tdm_get_format_val(
- tdm_tx_cfg[port.mode][port.channel].bit_format);
-
- pr_debug("%s: tdm_tx_bit_format = %d, item = %d\n", __func__,
- tdm_tx_cfg[port.mode][port.channel].bit_format,
- ucontrol->value.enumerated.item[0]);
- }
- return ret;
-}
-
-static int tdm_tx_format_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- tdm_tx_cfg[port.mode][port.channel].bit_format =
- tdm_get_format(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: tdm_tx_bit_format = %d, item = %d\n", __func__,
- tdm_tx_cfg[port.mode][port.channel].bit_format,
- ucontrol->value.enumerated.item[0]);
- }
- return ret;
-}
-
-static int tdm_rx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
-
- ucontrol->value.enumerated.item[0] =
- tdm_rx_cfg[port.mode][port.channel].channels - 1;
-
- pr_debug("%s: tdm_rx_ch = %d, item = %d\n", __func__,
- tdm_rx_cfg[port.mode][port.channel].channels - 1,
- ucontrol->value.enumerated.item[0]);
- }
- return ret;
-}
-
-static int tdm_rx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- tdm_rx_cfg[port.mode][port.channel].channels =
- ucontrol->value.enumerated.item[0] + 1;
-
- pr_debug("%s: tdm_rx_ch = %d, item = %d\n", __func__,
- tdm_rx_cfg[port.mode][port.channel].channels,
- ucontrol->value.enumerated.item[0] + 1);
- }
- return ret;
-}
-
-static int tdm_tx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- ucontrol->value.enumerated.item[0] =
- tdm_tx_cfg[port.mode][port.channel].channels - 1;
-
- pr_debug("%s: tdm_tx_ch = %d, item = %d\n", __func__,
- tdm_tx_cfg[port.mode][port.channel].channels - 1,
- ucontrol->value.enumerated.item[0]);
- }
- return ret;
-}
-
-static int tdm_tx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct tdm_port port;
- int ret = tdm_get_port_idx(kcontrol, &port);
-
- if (ret) {
- pr_err("%s: unsupported control: %s",
- __func__, kcontrol->id.name);
- } else {
- tdm_tx_cfg[port.mode][port.channel].channels =
- ucontrol->value.enumerated.item[0] + 1;
-
- pr_debug("%s: tdm_tx_ch = %d, item = %d\n", __func__,
- tdm_tx_cfg[port.mode][port.channel].channels,
- ucontrol->value.enumerated.item[0] + 1);
- }
- return ret;
-}
-
-static int aux_pcm_get_port_idx(struct snd_kcontrol *kcontrol)
-{
- int idx;
-
- if (strnstr(kcontrol->id.name, "PRIM_AUX_PCM",
- sizeof("PRIM_AUX_PCM")))
- idx = PRIM_AUX_PCM;
- else if (strnstr(kcontrol->id.name, "SEC_AUX_PCM",
- sizeof("SEC_AUX_PCM")))
- idx = SEC_AUX_PCM;
- else if (strnstr(kcontrol->id.name, "TERT_AUX_PCM",
- sizeof("TERT_AUX_PCM")))
- idx = TERT_AUX_PCM;
- else if (strnstr(kcontrol->id.name, "QUAT_AUX_PCM",
- sizeof("QUAT_AUX_PCM")))
- idx = QUAT_AUX_PCM;
- else {
- pr_err("%s: unsupported port: %s",
- __func__, kcontrol->id.name);
- idx = -EINVAL;
- }
-
- return idx;
-}
-
-static int aux_pcm_rx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = aux_pcm_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- aux_pcm_rx_cfg[idx].sample_rate =
- aux_pcm_get_sample_rate(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: idx[%d]_rx_sample_rate = %d, item = %d\n", __func__,
- idx, aux_pcm_rx_cfg[idx].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int aux_pcm_rx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = aux_pcm_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- ucontrol->value.enumerated.item[0] =
- aux_pcm_get_sample_rate_val(aux_pcm_rx_cfg[idx].sample_rate);
-
- pr_debug("%s: idx[%d]_rx_sample_rate = %d, item = %d\n", __func__,
- idx, aux_pcm_rx_cfg[idx].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int aux_pcm_tx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = aux_pcm_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- aux_pcm_tx_cfg[idx].sample_rate =
- aux_pcm_get_sample_rate(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: idx[%d]_tx_sample_rate = %d, item = %d\n", __func__,
- idx, aux_pcm_tx_cfg[idx].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int aux_pcm_tx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = aux_pcm_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- ucontrol->value.enumerated.item[0] =
- aux_pcm_get_sample_rate_val(aux_pcm_tx_cfg[idx].sample_rate);
-
- pr_debug("%s: idx[%d]_tx_sample_rate = %d, item = %d\n", __func__,
- idx, aux_pcm_tx_cfg[idx].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int mi2s_get_port_idx(struct snd_kcontrol *kcontrol)
-{
- int idx;
-
- if (strnstr(kcontrol->id.name, "PRIM_MI2S_RX",
- sizeof("PRIM_MI2S_RX")))
- idx = PRIM_MI2S;
- else if (strnstr(kcontrol->id.name, "SEC_MI2S_RX",
- sizeof("SEC_MI2S_RX")))
- idx = SEC_MI2S;
- else if (strnstr(kcontrol->id.name, "TERT_MI2S_RX",
- sizeof("TERT_MI2S_RX")))
- idx = TERT_MI2S;
- else if (strnstr(kcontrol->id.name, "QUAT_MI2S_RX",
- sizeof("QUAT_MI2S_RX")))
- idx = QUAT_MI2S;
- else if (strnstr(kcontrol->id.name, "PRIM_MI2S_TX",
- sizeof("PRIM_MI2S_TX")))
- idx = PRIM_MI2S;
- else if (strnstr(kcontrol->id.name, "SEC_MI2S_TX",
- sizeof("SEC_MI2S_TX")))
- idx = SEC_MI2S;
- else if (strnstr(kcontrol->id.name, "TERT_MI2S_TX",
- sizeof("TERT_MI2S_TX")))
- idx = TERT_MI2S;
- else if (strnstr(kcontrol->id.name, "QUAT_MI2S_TX",
- sizeof("QUAT_MI2S_TX")))
- idx = QUAT_MI2S;
- else {
- pr_err("%s: unsupported channel: %s",
- __func__, kcontrol->id.name);
- idx = -EINVAL;
- }
-
- return idx;
-}
-
-static int mi2s_get_sample_rate_val(int sample_rate)
-{
- int sample_rate_val;
-
- switch (sample_rate) {
- case SAMPLING_RATE_8KHZ:
- sample_rate_val = 0;
- break;
- case SAMPLING_RATE_11P025KHZ:
- sample_rate_val = 1;
- break;
- case SAMPLING_RATE_16KHZ:
- sample_rate_val = 2;
- break;
- case SAMPLING_RATE_22P05KHZ:
- sample_rate_val = 3;
- break;
- case SAMPLING_RATE_32KHZ:
- sample_rate_val = 4;
- break;
- case SAMPLING_RATE_44P1KHZ:
- sample_rate_val = 5;
- break;
- case SAMPLING_RATE_48KHZ:
- sample_rate_val = 6;
- break;
- case SAMPLING_RATE_96KHZ:
- sample_rate_val = 7;
- break;
- case SAMPLING_RATE_192KHZ:
- sample_rate_val = 8;
- break;
- default:
- sample_rate_val = 6;
- break;
- }
- return sample_rate_val;
-}
-
-static int mi2s_get_sample_rate(int value)
-{
- int sample_rate;
-
- switch (value) {
- case 0:
- sample_rate = SAMPLING_RATE_8KHZ;
- break;
- case 1:
- sample_rate = SAMPLING_RATE_11P025KHZ;
- break;
- case 2:
- sample_rate = SAMPLING_RATE_16KHZ;
- break;
- case 3:
- sample_rate = SAMPLING_RATE_22P05KHZ;
- break;
- case 4:
- sample_rate = SAMPLING_RATE_32KHZ;
- break;
- case 5:
- sample_rate = SAMPLING_RATE_44P1KHZ;
- break;
- case 6:
- sample_rate = SAMPLING_RATE_48KHZ;
- break;
- case 7:
- sample_rate = SAMPLING_RATE_96KHZ;
- break;
- case 8:
- sample_rate = SAMPLING_RATE_192KHZ;
- break;
- default:
- sample_rate = SAMPLING_RATE_48KHZ;
- break;
- }
- return sample_rate;
-}
-
-static int mi2s_auxpcm_get_format(int value)
-{
- int format;
-
- switch (value) {
- case 0:
- format = SNDRV_PCM_FORMAT_S16_LE;
- break;
- case 1:
- format = SNDRV_PCM_FORMAT_S24_LE;
- break;
- case 2:
- format = SNDRV_PCM_FORMAT_S24_3LE;
- break;
- case 3:
- format = SNDRV_PCM_FORMAT_S32_LE;
- break;
- default:
- format = SNDRV_PCM_FORMAT_S16_LE;
- break;
- }
- return format;
-}
-
-static int mi2s_auxpcm_get_format_value(int format)
-{
- int value;
-
- switch (format) {
- case SNDRV_PCM_FORMAT_S16_LE:
- value = 0;
- break;
- case SNDRV_PCM_FORMAT_S24_LE:
- value = 1;
- break;
- case SNDRV_PCM_FORMAT_S24_3LE:
- value = 2;
- break;
- case SNDRV_PCM_FORMAT_S32_LE:
- value = 3;
- break;
- default:
- value = 0;
- break;
- }
- return value;
-}
-
-static int mi2s_rx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- mi2s_rx_cfg[idx].sample_rate =
- mi2s_get_sample_rate(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: idx[%d]_rx_sample_rate = %d, item = %d\n", __func__,
- idx, mi2s_rx_cfg[idx].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int mi2s_rx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- ucontrol->value.enumerated.item[0] =
- mi2s_get_sample_rate_val(mi2s_rx_cfg[idx].sample_rate);
-
- pr_debug("%s: idx[%d]_rx_sample_rate = %d, item = %d\n", __func__,
- idx, mi2s_rx_cfg[idx].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int mi2s_tx_sample_rate_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- mi2s_tx_cfg[idx].sample_rate =
- mi2s_get_sample_rate(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: idx[%d]_tx_sample_rate = %d, item = %d\n", __func__,
- idx, mi2s_tx_cfg[idx].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int mi2s_tx_sample_rate_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- ucontrol->value.enumerated.item[0] =
- mi2s_get_sample_rate_val(mi2s_tx_cfg[idx].sample_rate);
-
- pr_debug("%s: idx[%d]_tx_sample_rate = %d, item = %d\n", __func__,
- idx, mi2s_tx_cfg[idx].sample_rate,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int msm_mi2s_rx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- pr_debug("%s: msm_mi2s_[%d]_rx_ch = %d\n", __func__,
- idx, mi2s_rx_cfg[idx].channels);
- ucontrol->value.enumerated.item[0] = mi2s_rx_cfg[idx].channels - 1;
-
- return 0;
-}
-
-static int msm_mi2s_rx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- mi2s_rx_cfg[idx].channels = ucontrol->value.enumerated.item[0] + 1;
- pr_debug("%s: msm_mi2s_[%d]_rx_ch = %d\n", __func__,
- idx, mi2s_rx_cfg[idx].channels);
-
- return 1;
-}
-
-static int msm_mi2s_tx_ch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- pr_debug("%s: msm_mi2s_[%d]_tx_ch = %d\n", __func__,
- idx, mi2s_tx_cfg[idx].channels);
- ucontrol->value.enumerated.item[0] = mi2s_tx_cfg[idx].channels - 1;
-
- return 0;
-}
-
-static int msm_mi2s_tx_ch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- mi2s_tx_cfg[idx].channels = ucontrol->value.enumerated.item[0] + 1;
- pr_debug("%s: msm_mi2s_[%d]_tx_ch = %d\n", __func__,
- idx, mi2s_tx_cfg[idx].channels);
-
- return 1;
-}
-
-static int msm_mi2s_rx_format_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- ucontrol->value.enumerated.item[0] =
- mi2s_auxpcm_get_format_value(mi2s_rx_cfg[idx].bit_format);
-
- pr_debug("%s: idx[%d]_rx_format = %d, item = %d\n", __func__,
- idx, mi2s_rx_cfg[idx].bit_format,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int msm_mi2s_rx_format_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- mi2s_rx_cfg[idx].bit_format =
- mi2s_auxpcm_get_format(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: idx[%d]_rx_format = %d, item = %d\n", __func__,
- idx, mi2s_rx_cfg[idx].bit_format,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int msm_mi2s_tx_format_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- ucontrol->value.enumerated.item[0] =
- mi2s_auxpcm_get_format_value(mi2s_tx_cfg[idx].bit_format);
-
- pr_debug("%s: idx[%d]_tx_format = %d, item = %d\n", __func__,
- idx, mi2s_tx_cfg[idx].bit_format,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int msm_mi2s_tx_format_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = mi2s_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- mi2s_tx_cfg[idx].bit_format =
- mi2s_auxpcm_get_format(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: idx[%d]_tx_format = %d, item = %d\n", __func__,
- idx, mi2s_tx_cfg[idx].bit_format,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int msm_aux_pcm_rx_format_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = aux_pcm_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- ucontrol->value.enumerated.item[0] =
- mi2s_auxpcm_get_format_value(aux_pcm_rx_cfg[idx].bit_format);
-
- pr_debug("%s: idx[%d]_rx_format = %d, item = %d\n", __func__,
- idx, aux_pcm_rx_cfg[idx].bit_format,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int msm_aux_pcm_rx_format_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = aux_pcm_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- aux_pcm_rx_cfg[idx].bit_format =
- mi2s_auxpcm_get_format(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: idx[%d]_rx_format = %d, item = %d\n", __func__,
- idx, aux_pcm_rx_cfg[idx].bit_format,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int msm_aux_pcm_tx_format_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = aux_pcm_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- ucontrol->value.enumerated.item[0] =
- mi2s_auxpcm_get_format_value(aux_pcm_tx_cfg[idx].bit_format);
-
- pr_debug("%s: idx[%d]_tx_format = %d, item = %d\n", __func__,
- idx, aux_pcm_tx_cfg[idx].bit_format,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int msm_aux_pcm_tx_format_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- int idx = aux_pcm_get_port_idx(kcontrol);
-
- if (idx < 0)
- return idx;
-
- aux_pcm_tx_cfg[idx].bit_format =
- mi2s_auxpcm_get_format(ucontrol->value.enumerated.item[0]);
-
- pr_debug("%s: idx[%d]_tx_format = %d, item = %d\n", __func__,
- idx, aux_pcm_tx_cfg[idx].bit_format,
- ucontrol->value.enumerated.item[0]);
-
- return 0;
-}
-
-static int msm_hifi_ctrl(struct snd_soc_codec *codec)
-{
- struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
- struct snd_soc_card *card = codec->component.card;
- struct msm_asoc_mach_data *pdata =
- snd_soc_card_get_drvdata(card);
-
- pr_debug("%s: msm_hifi_control = %d", __func__,
- msm_hifi_control);
-
- if (!pdata || !pdata->hph_en1_gpio_p) {
- pr_err("%s: hph_en1_gpio is invalid\n", __func__);
- return -EINVAL;
- }
- if (msm_hifi_control == MSM_HIFI_ON) {
- msm_cdc_pinctrl_select_active_state(pdata->hph_en1_gpio_p);
- /* 5msec delay needed as per HW requirement */
- usleep_range(5000, 5010);
- } else {
- msm_cdc_pinctrl_select_sleep_state(pdata->hph_en1_gpio_p);
- }
- snd_soc_dapm_sync(dapm);
-
- return 0;
-}
-
-static int msm_hifi_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- pr_debug("%s: msm_hifi_control = %d\n",
- __func__, msm_hifi_control);
- ucontrol->value.integer.value[0] = msm_hifi_control;
-
- return 0;
-}
-
-static int msm_hifi_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
-
- pr_debug("%s() ucontrol->value.integer.value[0] = %ld\n",
- __func__, ucontrol->value.integer.value[0]);
-
- msm_hifi_control = ucontrol->value.integer.value[0];
- msm_hifi_ctrl(codec);
-
- return 0;
-}
-
-static int msm_qos_ctl_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- ucontrol->value.enumerated.item[0] = qos_vote_status;
-
- return 0;
-}
-
-static int msm_qos_ctl_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct snd_soc_card *card = codec->component.card;
- const char *be_name = MSM_DAILINK_NAME(LowLatency);
- struct snd_soc_pcm_runtime *rtd;
- struct snd_pcm_substream *substream;
- s32 usecs;
-
- rtd = snd_soc_get_pcm_runtime(card, be_name);
- if (!rtd) {
- pr_err("%s: fail to get pcm runtime for %s\n",
- __func__, be_name);
- return -EINVAL;
- }
-
- substream = rtd->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream;
- if (!substream) {
- pr_err("%s: substream is null\n", __func__);
- return -EINVAL;
- }
-
- qos_vote_status = ucontrol->value.enumerated.item[0];
- if (qos_vote_status) {
- if (pm_qos_request_active(&substream->latency_pm_qos_req))
- pm_qos_remove_request(&substream->latency_pm_qos_req);
- if (!substream->runtime) {
- pr_err("%s: runtime is null\n", __func__);
- return -EINVAL;
- }
- usecs = MSM_LL_QOS_VALUE;
- if (usecs >= 0)
- pm_qos_add_request(&substream->latency_pm_qos_req,
- PM_QOS_CPU_DMA_LATENCY, usecs);
- } else {
- if (pm_qos_request_active(&substream->latency_pm_qos_req))
- pm_qos_remove_request(&substream->latency_pm_qos_req);
- }
-
- return 0;
-}
-
-static const struct snd_kcontrol_new msm_snd_controls[] = {
- SOC_ENUM_EXT("SLIM_0_RX Channels", slim_0_rx_chs,
- msm_slim_rx_ch_get, msm_slim_rx_ch_put),
- SOC_ENUM_EXT("SLIM_2_RX Channels", slim_2_rx_chs,
- msm_slim_rx_ch_get, msm_slim_rx_ch_put),
- SOC_ENUM_EXT("SLIM_0_TX Channels", slim_0_tx_chs,
- msm_slim_tx_ch_get, msm_slim_tx_ch_put),
- SOC_ENUM_EXT("SLIM_1_TX Channels", slim_1_tx_chs,
- msm_slim_tx_ch_get, msm_slim_tx_ch_put),
- SOC_ENUM_EXT("SLIM_5_RX Channels", slim_5_rx_chs,
- msm_slim_rx_ch_get, msm_slim_rx_ch_put),
- SOC_ENUM_EXT("SLIM_6_RX Channels", slim_6_rx_chs,
- msm_slim_rx_ch_get, msm_slim_rx_ch_put),
- SOC_ENUM_EXT("VI_FEED_TX Channels", vi_feed_tx_chs,
- msm_vi_feed_tx_ch_get, msm_vi_feed_tx_ch_put),
- SOC_ENUM_EXT("USB_AUDIO_RX Channels", usb_rx_chs,
- usb_audio_rx_ch_get, usb_audio_rx_ch_put),
- SOC_ENUM_EXT("USB_AUDIO_TX Channels", usb_tx_chs,
- usb_audio_tx_ch_get, usb_audio_tx_ch_put),
- SOC_ENUM_EXT("Display Port RX Channels", ext_disp_rx_chs,
- ext_disp_rx_ch_get, ext_disp_rx_ch_put),
- SOC_ENUM_EXT("PROXY_RX Channels", proxy_rx_chs,
- proxy_rx_ch_get, proxy_rx_ch_put),
- SOC_ENUM_EXT("SLIM_0_RX Format", slim_0_rx_format,
- slim_rx_bit_format_get, slim_rx_bit_format_put),
- SOC_ENUM_EXT("SLIM_5_RX Format", slim_5_rx_format,
- slim_rx_bit_format_get, slim_rx_bit_format_put),
- SOC_ENUM_EXT("SLIM_6_RX Format", slim_6_rx_format,
- slim_rx_bit_format_get, slim_rx_bit_format_put),
- SOC_ENUM_EXT("SLIM_0_TX Format", slim_0_tx_format,
- slim_tx_bit_format_get, slim_tx_bit_format_put),
- SOC_ENUM_EXT("USB_AUDIO_RX Format", usb_rx_format,
- usb_audio_rx_format_get, usb_audio_rx_format_put),
- SOC_ENUM_EXT("USB_AUDIO_TX Format", usb_tx_format,
- usb_audio_tx_format_get, usb_audio_tx_format_put),
- SOC_ENUM_EXT("Display Port RX Bit Format", ext_disp_rx_format,
- ext_disp_rx_format_get, ext_disp_rx_format_put),
- SOC_ENUM_EXT("SLIM_0_RX SampleRate", slim_0_rx_sample_rate,
- slim_rx_sample_rate_get, slim_rx_sample_rate_put),
- SOC_ENUM_EXT("SLIM_2_RX SampleRate", slim_2_rx_sample_rate,
- slim_rx_sample_rate_get, slim_rx_sample_rate_put),
- SOC_ENUM_EXT("SLIM_0_TX SampleRate", slim_0_tx_sample_rate,
- slim_tx_sample_rate_get, slim_tx_sample_rate_put),
- SOC_ENUM_EXT("SLIM_5_RX SampleRate", slim_5_rx_sample_rate,
- slim_rx_sample_rate_get, slim_rx_sample_rate_put),
- SOC_ENUM_EXT("SLIM_6_RX SampleRate", slim_6_rx_sample_rate,
- slim_rx_sample_rate_get, slim_rx_sample_rate_put),
- SOC_ENUM_EXT("BT SampleRate", bt_sample_rate,
- msm_bt_sample_rate_get,
- msm_bt_sample_rate_put),
- SOC_ENUM_EXT("USB_AUDIO_RX SampleRate", usb_rx_sample_rate,
- usb_audio_rx_sample_rate_get,
- usb_audio_rx_sample_rate_put),
- SOC_ENUM_EXT("USB_AUDIO_TX SampleRate", usb_tx_sample_rate,
- usb_audio_tx_sample_rate_get,
- usb_audio_tx_sample_rate_put),
- SOC_ENUM_EXT("Display Port RX SampleRate", ext_disp_rx_sample_rate,
- ext_disp_rx_sample_rate_get,
- ext_disp_rx_sample_rate_put),
- SOC_ENUM_EXT("PRI_TDM_RX_0 SampleRate", tdm_rx_sample_rate,
- tdm_rx_sample_rate_get,
- tdm_rx_sample_rate_put),
- SOC_ENUM_EXT("PRI_TDM_TX_0 SampleRate", tdm_tx_sample_rate,
- tdm_tx_sample_rate_get,
- tdm_tx_sample_rate_put),
- SOC_ENUM_EXT("PRI_TDM_RX_0 Format", tdm_rx_format,
- tdm_rx_format_get,
- tdm_rx_format_put),
- SOC_ENUM_EXT("PRI_TDM_TX_0 Format", tdm_tx_format,
- tdm_tx_format_get,
- tdm_tx_format_put),
- SOC_ENUM_EXT("PRI_TDM_RX_0 Channels", tdm_rx_chs,
- tdm_rx_ch_get,
- tdm_rx_ch_put),
- SOC_ENUM_EXT("PRI_TDM_TX_0 Channels", tdm_tx_chs,
- tdm_tx_ch_get,
- tdm_tx_ch_put),
- SOC_ENUM_EXT("SEC_TDM_RX_0 SampleRate", tdm_rx_sample_rate,
- tdm_rx_sample_rate_get,
- tdm_rx_sample_rate_put),
- SOC_ENUM_EXT("SEC_TDM_TX_0 SampleRate", tdm_tx_sample_rate,
- tdm_tx_sample_rate_get,
- tdm_tx_sample_rate_put),
- SOC_ENUM_EXT("SEC_TDM_RX_0 Format", tdm_rx_format,
- tdm_rx_format_get,
- tdm_rx_format_put),
- SOC_ENUM_EXT("SEC_TDM_TX_0 Format", tdm_tx_format,
- tdm_tx_format_get,
- tdm_tx_format_put),
- SOC_ENUM_EXT("SEC_TDM_RX_0 Channels", tdm_rx_chs,
- tdm_rx_ch_get,
- tdm_rx_ch_put),
- SOC_ENUM_EXT("SEC_TDM_TX_0 Channels", tdm_tx_chs,
- tdm_tx_ch_get,
- tdm_tx_ch_put),
- SOC_ENUM_EXT("TERT_TDM_RX_0 SampleRate", tdm_rx_sample_rate,
- tdm_rx_sample_rate_get,
- tdm_rx_sample_rate_put),
- SOC_ENUM_EXT("TERT_TDM_TX_0 SampleRate", tdm_tx_sample_rate,
- tdm_tx_sample_rate_get,
- tdm_tx_sample_rate_put),
- SOC_ENUM_EXT("TERT_TDM_RX_0 Format", tdm_rx_format,
- tdm_rx_format_get,
- tdm_rx_format_put),
- SOC_ENUM_EXT("TERT_TDM_TX_0 Format", tdm_tx_format,
- tdm_tx_format_get,
- tdm_tx_format_put),
- SOC_ENUM_EXT("TERT_TDM_RX_0 Channels", tdm_rx_chs,
- tdm_rx_ch_get,
- tdm_rx_ch_put),
- SOC_ENUM_EXT("TERT_TDM_TX_0 Channels", tdm_tx_chs,
- tdm_tx_ch_get,
- tdm_tx_ch_put),
- SOC_ENUM_EXT("QUAT_TDM_RX_0 SampleRate", tdm_rx_sample_rate,
- tdm_rx_sample_rate_get,
- tdm_rx_sample_rate_put),
- SOC_ENUM_EXT("QUAT_TDM_TX_0 SampleRate", tdm_tx_sample_rate,
- tdm_tx_sample_rate_get,
- tdm_tx_sample_rate_put),
- SOC_ENUM_EXT("QUAT_TDM_RX_0 Format", tdm_rx_format,
- tdm_rx_format_get,
- tdm_rx_format_put),
- SOC_ENUM_EXT("QUAT_TDM_TX_0 Format", tdm_tx_format,
- tdm_tx_format_get,
- tdm_tx_format_put),
- SOC_ENUM_EXT("QUAT_TDM_RX_0 Channels", tdm_rx_chs,
- tdm_rx_ch_get,
- tdm_rx_ch_put),
- SOC_ENUM_EXT("QUAT_TDM_TX_0 Channels", tdm_tx_chs,
- tdm_tx_ch_get,
- tdm_tx_ch_put),
- SOC_ENUM_EXT("PRIM_AUX_PCM_RX SampleRate", prim_aux_pcm_rx_sample_rate,
- aux_pcm_rx_sample_rate_get,
- aux_pcm_rx_sample_rate_put),
- SOC_ENUM_EXT("SEC_AUX_PCM_RX SampleRate", sec_aux_pcm_rx_sample_rate,
- aux_pcm_rx_sample_rate_get,
- aux_pcm_rx_sample_rate_put),
- SOC_ENUM_EXT("TERT_AUX_PCM_RX SampleRate", tert_aux_pcm_rx_sample_rate,
- aux_pcm_rx_sample_rate_get,
- aux_pcm_rx_sample_rate_put),
- SOC_ENUM_EXT("QUAT_AUX_PCM_RX SampleRate", quat_aux_pcm_rx_sample_rate,
- aux_pcm_rx_sample_rate_get,
- aux_pcm_rx_sample_rate_put),
- SOC_ENUM_EXT("PRIM_AUX_PCM_TX SampleRate", prim_aux_pcm_tx_sample_rate,
- aux_pcm_tx_sample_rate_get,
- aux_pcm_tx_sample_rate_put),
- SOC_ENUM_EXT("SEC_AUX_PCM_TX SampleRate", sec_aux_pcm_tx_sample_rate,
- aux_pcm_tx_sample_rate_get,
- aux_pcm_tx_sample_rate_put),
- SOC_ENUM_EXT("TERT_AUX_PCM_TX SampleRate", tert_aux_pcm_tx_sample_rate,
- aux_pcm_tx_sample_rate_get,
- aux_pcm_tx_sample_rate_put),
- SOC_ENUM_EXT("QUAT_AUX_PCM_TX SampleRate", quat_aux_pcm_tx_sample_rate,
- aux_pcm_tx_sample_rate_get,
- aux_pcm_tx_sample_rate_put),
- SOC_ENUM_EXT("PRIM_MI2S_RX SampleRate", prim_mi2s_rx_sample_rate,
- mi2s_rx_sample_rate_get,
- mi2s_rx_sample_rate_put),
- SOC_ENUM_EXT("SEC_MI2S_RX SampleRate", sec_mi2s_rx_sample_rate,
- mi2s_rx_sample_rate_get,
- mi2s_rx_sample_rate_put),
- SOC_ENUM_EXT("TERT_MI2S_RX SampleRate", tert_mi2s_rx_sample_rate,
- mi2s_rx_sample_rate_get,
- mi2s_rx_sample_rate_put),
- SOC_ENUM_EXT("QUAT_MI2S_RX SampleRate", quat_mi2s_rx_sample_rate,
- mi2s_rx_sample_rate_get,
- mi2s_rx_sample_rate_put),
- SOC_ENUM_EXT("PRIM_MI2S_TX SampleRate", prim_mi2s_tx_sample_rate,
- mi2s_tx_sample_rate_get,
- mi2s_tx_sample_rate_put),
- SOC_ENUM_EXT("SEC_MI2S_TX SampleRate", sec_mi2s_tx_sample_rate,
- mi2s_tx_sample_rate_get,
- mi2s_tx_sample_rate_put),
- SOC_ENUM_EXT("TERT_MI2S_TX SampleRate", tert_mi2s_tx_sample_rate,
- mi2s_tx_sample_rate_get,
- mi2s_tx_sample_rate_put),
- SOC_ENUM_EXT("QUAT_MI2S_TX SampleRate", quat_mi2s_tx_sample_rate,
- mi2s_tx_sample_rate_get,
- mi2s_tx_sample_rate_put),
- SOC_ENUM_EXT("PRIM_MI2S_RX Channels", prim_mi2s_rx_chs,
- msm_mi2s_rx_ch_get, msm_mi2s_rx_ch_put),
- SOC_ENUM_EXT("PRIM_MI2S_TX Channels", prim_mi2s_tx_chs,
- msm_mi2s_tx_ch_get, msm_mi2s_tx_ch_put),
- SOC_ENUM_EXT("SEC_MI2S_RX Channels", sec_mi2s_rx_chs,
- msm_mi2s_rx_ch_get, msm_mi2s_rx_ch_put),
- SOC_ENUM_EXT("SEC_MI2S_TX Channels", sec_mi2s_tx_chs,
- msm_mi2s_tx_ch_get, msm_mi2s_tx_ch_put),
- SOC_ENUM_EXT("TERT_MI2S_RX Channels", tert_mi2s_rx_chs,
- msm_mi2s_rx_ch_get, msm_mi2s_rx_ch_put),
- SOC_ENUM_EXT("TERT_MI2S_TX Channels", tert_mi2s_tx_chs,
- msm_mi2s_tx_ch_get, msm_mi2s_tx_ch_put),
- SOC_ENUM_EXT("QUAT_MI2S_RX Channels", quat_mi2s_rx_chs,
- msm_mi2s_rx_ch_get, msm_mi2s_rx_ch_put),
- SOC_ENUM_EXT("QUAT_MI2S_TX Channels", quat_mi2s_tx_chs,
- msm_mi2s_tx_ch_get, msm_mi2s_tx_ch_put),
- SOC_ENUM_EXT("PRIM_MI2S_RX Format", mi2s_rx_format,
- msm_mi2s_rx_format_get, msm_mi2s_rx_format_put),
- SOC_ENUM_EXT("PRIM_MI2S_TX Format", mi2s_tx_format,
- msm_mi2s_tx_format_get, msm_mi2s_tx_format_put),
- SOC_ENUM_EXT("SEC_MI2S_RX Format", mi2s_rx_format,
- msm_mi2s_rx_format_get, msm_mi2s_rx_format_put),
- SOC_ENUM_EXT("SEC_MI2S_TX Format", mi2s_tx_format,
- msm_mi2s_tx_format_get, msm_mi2s_tx_format_put),
- SOC_ENUM_EXT("TERT_MI2S_RX Format", mi2s_rx_format,
- msm_mi2s_rx_format_get, msm_mi2s_rx_format_put),
- SOC_ENUM_EXT("TERT_MI2S_TX Format", mi2s_tx_format,
- msm_mi2s_tx_format_get, msm_mi2s_tx_format_put),
- SOC_ENUM_EXT("QUAT_MI2S_RX Format", mi2s_rx_format,
- msm_mi2s_rx_format_get, msm_mi2s_rx_format_put),
- SOC_ENUM_EXT("QUAT_MI2S_TX Format", mi2s_tx_format,
- msm_mi2s_tx_format_get, msm_mi2s_tx_format_put),
- SOC_ENUM_EXT("PRIM_AUX_PCM_RX Format", aux_pcm_rx_format,
- msm_aux_pcm_rx_format_get, msm_aux_pcm_rx_format_put),
- SOC_ENUM_EXT("PRIM_AUX_PCM_TX Format", aux_pcm_tx_format,
- msm_aux_pcm_tx_format_get, msm_aux_pcm_tx_format_put),
- SOC_ENUM_EXT("SEC_AUX_PCM_RX Format", aux_pcm_rx_format,
- msm_aux_pcm_rx_format_get, msm_aux_pcm_rx_format_put),
- SOC_ENUM_EXT("SEC_AUX_PCM_TX Format", aux_pcm_tx_format,
- msm_aux_pcm_tx_format_get, msm_aux_pcm_tx_format_put),
- SOC_ENUM_EXT("TERT_AUX_PCM_RX Format", aux_pcm_rx_format,
- msm_aux_pcm_rx_format_get, msm_aux_pcm_rx_format_put),
- SOC_ENUM_EXT("TERT_AUX_PCM_TX Format", aux_pcm_tx_format,
- msm_aux_pcm_tx_format_get, msm_aux_pcm_tx_format_put),
- SOC_ENUM_EXT("QUAT_AUX_PCM_RX Format", aux_pcm_rx_format,
- msm_aux_pcm_rx_format_get, msm_aux_pcm_rx_format_put),
- SOC_ENUM_EXT("QUAT_AUX_PCM_TX Format", aux_pcm_tx_format,
- msm_aux_pcm_tx_format_get, msm_aux_pcm_tx_format_put),
- SOC_ENUM_EXT("HiFi Function", hifi_function, msm_hifi_get,
- msm_hifi_put),
- SOC_ENUM_EXT("MultiMedia5_RX QOS Vote", qos_vote, msm_qos_ctl_get,
- msm_qos_ctl_put),
-};
-
-static int msm_snd_enable_codec_ext_clk(struct snd_soc_codec *codec,
- int enable, bool dapm)
-{
- int ret = 0;
-
- if (!strcmp(dev_name(codec->dev), "tavil_codec")) {
- ret = tavil_cdc_mclk_enable(codec, enable);
- } else {
- dev_err(codec->dev, "%s: unknown codec to enable ext clk\n",
- __func__);
- ret = -EINVAL;
- }
- return ret;
-}
-
-static int msm_snd_enable_codec_ext_tx_clk(struct snd_soc_codec *codec,
- int enable, bool dapm)
-{
- int ret = 0;
-
- if (!strcmp(dev_name(codec->dev), "tavil_codec")) {
- ret = tavil_cdc_mclk_tx_enable(codec, enable);
- } else {
- dev_err(codec->dev, "%s: unknown codec to enable TX ext clk\n",
- __func__);
- ret = -EINVAL;
- }
-
- return ret;
-}
-
-static int msm_mclk_tx_event(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol, int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
-
- pr_debug("%s: event = %d\n", __func__, event);
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- return msm_snd_enable_codec_ext_tx_clk(codec, 1, true);
- case SND_SOC_DAPM_POST_PMD:
- return msm_snd_enable_codec_ext_tx_clk(codec, 0, true);
- }
- return 0;
-}
-
-static int msm_mclk_event(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol, int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
-
- pr_debug("%s: event = %d\n", __func__, event);
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- return msm_snd_enable_codec_ext_clk(codec, 1, true);
- case SND_SOC_DAPM_POST_PMD:
- return msm_snd_enable_codec_ext_clk(codec, 0, true);
- }
- return 0;
-}
-
-static int msm_hifi_ctrl_event(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *k, int event)
-{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct snd_soc_card *card = codec->component.card;
- struct msm_asoc_mach_data *pdata =
- snd_soc_card_get_drvdata(card);
-
- pr_debug("%s: msm_hifi_control = %d", __func__, msm_hifi_control);
-
- if (!pdata || !pdata->hph_en0_gpio_p) {
- pr_err("%s: hph_en0_gpio is invalid\n", __func__);
- return -EINVAL;
- }
-
- if (msm_hifi_control != MSM_HIFI_ON) {
- pr_debug("%s: HiFi mixer control is not set\n",
- __func__);
- return 0;
- }
-
- switch (event) {
- case SND_SOC_DAPM_POST_PMU:
- msm_cdc_pinctrl_select_active_state(pdata->hph_en0_gpio_p);
- break;
- case SND_SOC_DAPM_PRE_PMD:
- msm_cdc_pinctrl_select_sleep_state(pdata->hph_en0_gpio_p);
- break;
- }
-
- return 0;
-}
-
-static const struct snd_soc_dapm_widget msm_dapm_widgets[] = {
-
- SND_SOC_DAPM_SUPPLY("MCLK", SND_SOC_NOPM, 0, 0,
- msm_mclk_event,
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_SUPPLY("MCLK TX", SND_SOC_NOPM, 0, 0,
- msm_mclk_tx_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
-
- SND_SOC_DAPM_SPK("Lineout_1 amp", NULL),
- SND_SOC_DAPM_SPK("Lineout_2 amp", NULL),
- SND_SOC_DAPM_SPK("hifi amp", msm_hifi_ctrl_event),
- SND_SOC_DAPM_MIC("Handset Mic", NULL),
- SND_SOC_DAPM_MIC("Headset Mic", NULL),
- SND_SOC_DAPM_MIC("ANCRight Headset Mic", NULL),
- SND_SOC_DAPM_MIC("ANCLeft Headset Mic", NULL),
- SND_SOC_DAPM_MIC("Analog Mic5", NULL),
-
- SND_SOC_DAPM_MIC("Digital Mic0", NULL),
- SND_SOC_DAPM_MIC("Digital Mic1", NULL),
- SND_SOC_DAPM_MIC("Digital Mic2", NULL),
- SND_SOC_DAPM_MIC("Digital Mic3", NULL),
- SND_SOC_DAPM_MIC("Digital Mic4", NULL),
- SND_SOC_DAPM_MIC("Digital Mic5", NULL),
-};
-
-static inline int param_is_mask(int p)
-{
- return (p >= SNDRV_PCM_HW_PARAM_FIRST_MASK) &&
- (p <= SNDRV_PCM_HW_PARAM_LAST_MASK);
-}
-
-static inline struct snd_mask *param_to_mask(struct snd_pcm_hw_params *p,
- int n)
-{
- return &(p->masks[n - SNDRV_PCM_HW_PARAM_FIRST_MASK]);
-}
-
-static void param_set_mask(struct snd_pcm_hw_params *p, int n,
- unsigned int bit)
-{
- if (bit >= SNDRV_MASK_MAX)
- return;
- if (param_is_mask(n)) {
- struct snd_mask *m = param_to_mask(p, n);
-
- m->bits[0] = 0;
- m->bits[1] = 0;
- m->bits[bit >> 5] |= (1 << (bit & 31));
- }
-}
-
-static int msm_slim_get_ch_from_beid(int32_t be_id)
-{
- int ch_id = 0;
-
- switch (be_id) {
- case MSM_BACKEND_DAI_SLIMBUS_0_RX:
- ch_id = SLIM_RX_0;
- break;
- case MSM_BACKEND_DAI_SLIMBUS_1_RX:
- ch_id = SLIM_RX_1;
- break;
- case MSM_BACKEND_DAI_SLIMBUS_2_RX:
- ch_id = SLIM_RX_2;
- break;
- case MSM_BACKEND_DAI_SLIMBUS_3_RX:
- ch_id = SLIM_RX_3;
- break;
- case MSM_BACKEND_DAI_SLIMBUS_4_RX:
- ch_id = SLIM_RX_4;
- break;
- case MSM_BACKEND_DAI_SLIMBUS_6_RX:
- ch_id = SLIM_RX_6;
- break;
- case MSM_BACKEND_DAI_SLIMBUS_0_TX:
- ch_id = SLIM_TX_0;
- break;
- case MSM_BACKEND_DAI_SLIMBUS_3_TX:
- ch_id = SLIM_TX_3;
- break;
- default:
- ch_id = SLIM_RX_0;
- break;
- }
-
- return ch_id;
-}
-
-static int msm_ext_disp_get_idx_from_beid(int32_t be_id)
-{
- int idx;
-
- switch (be_id) {
- case MSM_BACKEND_DAI_DISPLAY_PORT_RX:
- idx = DP_RX_IDX;
- break;
- default:
- pr_err("%s: Incorrect ext_disp BE id %d\n", __func__, be_id);
- idx = -EINVAL;
- break;
- }
-
- return idx;
-}
-
-static int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
- struct snd_pcm_hw_params *params)
-{
- struct snd_soc_dai_link *dai_link = rtd->dai_link;
- struct snd_interval *rate = hw_param_interval(params,
- SNDRV_PCM_HW_PARAM_RATE);
- struct snd_interval *channels = hw_param_interval(params,
- SNDRV_PCM_HW_PARAM_CHANNELS);
- int rc = 0;
- int idx;
- void *config = NULL;
- struct snd_soc_codec *codec = NULL;
-
- pr_debug("%s: format = %d, rate = %d\n",
- __func__, params_format(params), params_rate(params));
-
- switch (dai_link->id) {
- case MSM_BACKEND_DAI_SLIMBUS_0_RX:
- case MSM_BACKEND_DAI_SLIMBUS_1_RX:
- case MSM_BACKEND_DAI_SLIMBUS_2_RX:
- case MSM_BACKEND_DAI_SLIMBUS_3_RX:
- case MSM_BACKEND_DAI_SLIMBUS_4_RX:
- case MSM_BACKEND_DAI_SLIMBUS_6_RX:
- idx = msm_slim_get_ch_from_beid(dai_link->id);
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- slim_rx_cfg[idx].bit_format);
- rate->min = rate->max = slim_rx_cfg[idx].sample_rate;
- channels->min = channels->max = slim_rx_cfg[idx].channels;
- break;
-
- case MSM_BACKEND_DAI_SLIMBUS_0_TX:
- case MSM_BACKEND_DAI_SLIMBUS_3_TX:
- idx = msm_slim_get_ch_from_beid(dai_link->id);
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- slim_tx_cfg[idx].bit_format);
- rate->min = rate->max = slim_tx_cfg[idx].sample_rate;
- channels->min = channels->max = slim_tx_cfg[idx].channels;
- break;
-
- case MSM_BACKEND_DAI_SLIMBUS_1_TX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- slim_tx_cfg[1].bit_format);
- rate->min = rate->max = slim_tx_cfg[1].sample_rate;
- channels->min = channels->max = slim_tx_cfg[1].channels;
- break;
-
- case MSM_BACKEND_DAI_SLIMBUS_4_TX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- SNDRV_PCM_FORMAT_S32_LE);
- rate->min = rate->max = SAMPLING_RATE_8KHZ;
- channels->min = channels->max = msm_vi_feed_tx_ch;
- break;
-
- case MSM_BACKEND_DAI_SLIMBUS_5_RX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- slim_rx_cfg[5].bit_format);
- rate->min = rate->max = slim_rx_cfg[5].sample_rate;
- channels->min = channels->max = slim_rx_cfg[5].channels;
- break;
-
- case MSM_BACKEND_DAI_SLIMBUS_5_TX:
- codec = rtd->codec;
- rate->min = rate->max = SAMPLING_RATE_16KHZ;
- channels->min = channels->max = 1;
-
- config = msm_codec_fn.get_afe_config_fn(codec,
- AFE_SLIMBUS_SLAVE_PORT_CONFIG);
- if (config) {
- rc = afe_set_config(AFE_SLIMBUS_SLAVE_PORT_CONFIG,
- config, SLIMBUS_5_TX);
- if (rc)
- pr_err("%s: Failed to set slimbus slave port config %d\n",
- __func__, rc);
- }
- break;
-
- case MSM_BACKEND_DAI_SLIMBUS_7_RX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- slim_rx_cfg[SLIM_RX_7].bit_format);
- rate->min = rate->max = slim_rx_cfg[SLIM_RX_7].sample_rate;
- channels->min = channels->max =
- slim_rx_cfg[SLIM_RX_7].channels;
- break;
-
- case MSM_BACKEND_DAI_SLIMBUS_7_TX:
- rate->min = rate->max = slim_tx_cfg[SLIM_TX_7].sample_rate;
- channels->min = channels->max =
- slim_tx_cfg[SLIM_TX_7].channels;
- break;
-
- case MSM_BACKEND_DAI_SLIMBUS_8_TX:
- rate->min = rate->max = slim_tx_cfg[SLIM_TX_8].sample_rate;
- channels->min = channels->max =
- slim_tx_cfg[SLIM_TX_8].channels;
- break;
-
- case MSM_BACKEND_DAI_USB_RX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- usb_rx_cfg.bit_format);
- rate->min = rate->max = usb_rx_cfg.sample_rate;
- channels->min = channels->max = usb_rx_cfg.channels;
- break;
-
- case MSM_BACKEND_DAI_USB_TX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- usb_tx_cfg.bit_format);
- rate->min = rate->max = usb_tx_cfg.sample_rate;
- channels->min = channels->max = usb_tx_cfg.channels;
- break;
-
- case MSM_BACKEND_DAI_DISPLAY_PORT_RX:
- idx = msm_ext_disp_get_idx_from_beid(dai_link->id);
- if (idx < 0) {
- pr_err("%s: Incorrect ext disp idx %d\n",
- __func__, idx);
- rc = idx;
- goto done;
- }
-
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- ext_disp_rx_cfg[idx].bit_format);
- rate->min = rate->max = ext_disp_rx_cfg[idx].sample_rate;
- channels->min = channels->max = ext_disp_rx_cfg[idx].channels;
- break;
-
- case MSM_BACKEND_DAI_AFE_PCM_RX:
- channels->min = channels->max = proxy_rx_cfg.channels;
- rate->min = rate->max = SAMPLING_RATE_48KHZ;
- break;
-
- case MSM_BACKEND_DAI_PRI_TDM_RX_0:
- channels->min = channels->max =
- tdm_rx_cfg[TDM_PRI][TDM_0].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- tdm_rx_cfg[TDM_PRI][TDM_0].bit_format);
- rate->min = rate->max = tdm_rx_cfg[TDM_PRI][TDM_0].sample_rate;
- break;
-
- case MSM_BACKEND_DAI_PRI_TDM_TX_0:
- channels->min = channels->max =
- tdm_tx_cfg[TDM_PRI][TDM_0].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- tdm_tx_cfg[TDM_PRI][TDM_0].bit_format);
- rate->min = rate->max = tdm_tx_cfg[TDM_PRI][TDM_0].sample_rate;
- break;
-
- case MSM_BACKEND_DAI_SEC_TDM_RX_0:
- channels->min = channels->max =
- tdm_rx_cfg[TDM_SEC][TDM_0].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- tdm_rx_cfg[TDM_SEC][TDM_0].bit_format);
- rate->min = rate->max = tdm_rx_cfg[TDM_SEC][TDM_0].sample_rate;
- break;
-
- case MSM_BACKEND_DAI_SEC_TDM_TX_0:
- channels->min = channels->max =
- tdm_tx_cfg[TDM_SEC][TDM_0].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- tdm_tx_cfg[TDM_SEC][TDM_0].bit_format);
- rate->min = rate->max = tdm_tx_cfg[TDM_SEC][TDM_0].sample_rate;
- break;
-
- case MSM_BACKEND_DAI_TERT_TDM_RX_0:
- channels->min = channels->max =
- tdm_rx_cfg[TDM_TERT][TDM_0].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- tdm_rx_cfg[TDM_TERT][TDM_0].bit_format);
- rate->min = rate->max = tdm_rx_cfg[TDM_TERT][TDM_0].sample_rate;
- break;
-
- case MSM_BACKEND_DAI_TERT_TDM_TX_0:
- channels->min = channels->max =
- tdm_tx_cfg[TDM_TERT][TDM_0].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- tdm_tx_cfg[TDM_TERT][TDM_0].bit_format);
- rate->min = rate->max = tdm_tx_cfg[TDM_TERT][TDM_0].sample_rate;
- break;
-
- case MSM_BACKEND_DAI_QUAT_TDM_RX_0:
- channels->min = channels->max =
- tdm_rx_cfg[TDM_QUAT][TDM_0].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- tdm_rx_cfg[TDM_QUAT][TDM_0].bit_format);
- rate->min = rate->max = tdm_rx_cfg[TDM_QUAT][TDM_0].sample_rate;
- break;
-
- case MSM_BACKEND_DAI_QUAT_TDM_TX_0:
- channels->min = channels->max =
- tdm_tx_cfg[TDM_QUAT][TDM_0].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- tdm_tx_cfg[TDM_QUAT][TDM_0].bit_format);
- rate->min = rate->max = tdm_tx_cfg[TDM_QUAT][TDM_0].sample_rate;
- break;
-
- case MSM_BACKEND_DAI_AUXPCM_RX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- aux_pcm_rx_cfg[PRIM_AUX_PCM].bit_format);
- rate->min = rate->max =
- aux_pcm_rx_cfg[PRIM_AUX_PCM].sample_rate;
- channels->min = channels->max =
- aux_pcm_rx_cfg[PRIM_AUX_PCM].channels;
- break;
-
- case MSM_BACKEND_DAI_AUXPCM_TX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- aux_pcm_tx_cfg[PRIM_AUX_PCM].bit_format);
- rate->min = rate->max =
- aux_pcm_tx_cfg[PRIM_AUX_PCM].sample_rate;
- channels->min = channels->max =
- aux_pcm_tx_cfg[PRIM_AUX_PCM].channels;
- break;
-
- case MSM_BACKEND_DAI_SEC_AUXPCM_RX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- aux_pcm_rx_cfg[SEC_AUX_PCM].bit_format);
- rate->min = rate->max =
- aux_pcm_rx_cfg[SEC_AUX_PCM].sample_rate;
- channels->min = channels->max =
- aux_pcm_rx_cfg[SEC_AUX_PCM].channels;
- break;
-
- case MSM_BACKEND_DAI_SEC_AUXPCM_TX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- aux_pcm_tx_cfg[SEC_AUX_PCM].bit_format);
- rate->min = rate->max =
- aux_pcm_tx_cfg[SEC_AUX_PCM].sample_rate;
- channels->min = channels->max =
- aux_pcm_tx_cfg[SEC_AUX_PCM].channels;
- break;
-
- case MSM_BACKEND_DAI_TERT_AUXPCM_RX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- aux_pcm_rx_cfg[TERT_AUX_PCM].bit_format);
- rate->min = rate->max =
- aux_pcm_rx_cfg[TERT_AUX_PCM].sample_rate;
- channels->min = channels->max =
- aux_pcm_rx_cfg[TERT_AUX_PCM].channels;
- break;
-
- case MSM_BACKEND_DAI_TERT_AUXPCM_TX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- aux_pcm_tx_cfg[TERT_AUX_PCM].bit_format);
- rate->min = rate->max =
- aux_pcm_tx_cfg[TERT_AUX_PCM].sample_rate;
- channels->min = channels->max =
- aux_pcm_tx_cfg[TERT_AUX_PCM].channels;
- break;
-
- case MSM_BACKEND_DAI_QUAT_AUXPCM_RX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- aux_pcm_rx_cfg[QUAT_AUX_PCM].bit_format);
- rate->min = rate->max =
- aux_pcm_rx_cfg[QUAT_AUX_PCM].sample_rate;
- channels->min = channels->max =
- aux_pcm_rx_cfg[QUAT_AUX_PCM].channels;
- break;
-
- case MSM_BACKEND_DAI_QUAT_AUXPCM_TX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- aux_pcm_tx_cfg[QUAT_AUX_PCM].bit_format);
- rate->min = rate->max =
- aux_pcm_tx_cfg[QUAT_AUX_PCM].sample_rate;
- channels->min = channels->max =
- aux_pcm_tx_cfg[QUAT_AUX_PCM].channels;
- break;
-
- case MSM_BACKEND_DAI_PRI_MI2S_RX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- mi2s_rx_cfg[PRIM_MI2S].bit_format);
- rate->min = rate->max = mi2s_rx_cfg[PRIM_MI2S].sample_rate;
- channels->min = channels->max =
- mi2s_rx_cfg[PRIM_MI2S].channels;
- break;
-
- case MSM_BACKEND_DAI_PRI_MI2S_TX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- mi2s_tx_cfg[PRIM_MI2S].bit_format);
- rate->min = rate->max = mi2s_tx_cfg[PRIM_MI2S].sample_rate;
- channels->min = channels->max =
- mi2s_tx_cfg[PRIM_MI2S].channels;
- break;
-
- case MSM_BACKEND_DAI_SECONDARY_MI2S_RX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- mi2s_rx_cfg[SEC_MI2S].bit_format);
- rate->min = rate->max = mi2s_rx_cfg[SEC_MI2S].sample_rate;
- channels->min = channels->max =
- mi2s_rx_cfg[SEC_MI2S].channels;
- break;
-
- case MSM_BACKEND_DAI_SECONDARY_MI2S_TX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- mi2s_tx_cfg[SEC_MI2S].bit_format);
- rate->min = rate->max = mi2s_tx_cfg[SEC_MI2S].sample_rate;
- channels->min = channels->max =
- mi2s_tx_cfg[SEC_MI2S].channels;
- break;
-
- case MSM_BACKEND_DAI_TERTIARY_MI2S_RX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- mi2s_rx_cfg[TERT_MI2S].bit_format);
- rate->min = rate->max = mi2s_rx_cfg[TERT_MI2S].sample_rate;
- channels->min = channels->max =
- mi2s_rx_cfg[TERT_MI2S].channels;
- break;
-
- case MSM_BACKEND_DAI_TERTIARY_MI2S_TX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- mi2s_tx_cfg[TERT_MI2S].bit_format);
- rate->min = rate->max = mi2s_tx_cfg[TERT_MI2S].sample_rate;
- channels->min = channels->max =
- mi2s_tx_cfg[TERT_MI2S].channels;
- break;
-
- case MSM_BACKEND_DAI_QUATERNARY_MI2S_RX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- mi2s_rx_cfg[QUAT_MI2S].bit_format);
- rate->min = rate->max = mi2s_rx_cfg[QUAT_MI2S].sample_rate;
- channels->min = channels->max =
- mi2s_rx_cfg[QUAT_MI2S].channels;
- break;
-
- case MSM_BACKEND_DAI_QUATERNARY_MI2S_TX:
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- mi2s_tx_cfg[QUAT_MI2S].bit_format);
- rate->min = rate->max = mi2s_tx_cfg[QUAT_MI2S].sample_rate;
- channels->min = channels->max =
- mi2s_tx_cfg[QUAT_MI2S].channels;
- break;
-
- default:
- rate->min = rate->max = SAMPLING_RATE_48KHZ;
- break;
- }
-
-done:
- return rc;
-}
-
-static bool msm_usbc_swap_gnd_mic(struct snd_soc_codec *codec, bool active)
-{
- int value = 0;
- bool ret = 0;
- struct snd_soc_card *card = codec->component.card;
- struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
- struct pinctrl_state *en2_pinctrl_active;
- struct pinctrl_state *en2_pinctrl_sleep;
-
- if (!pdata->usbc_en2_gpio_p) {
- if (active) {
- /* if active and usbc_en2_gpio undefined, get pin */
- pdata->usbc_en2_gpio_p = devm_pinctrl_get(card->dev);
- if (IS_ERR_OR_NULL(pdata->usbc_en2_gpio_p)) {
- dev_err(card->dev,
- "%s: Can't get EN2 gpio pinctrl:%ld\n",
- __func__,
- PTR_ERR(pdata->usbc_en2_gpio_p));
- pdata->usbc_en2_gpio_p = NULL;
- return false;
- }
- } else
- /* if not active and usbc_en2_gpio undefined, return */
- return false;
- }
-
- pdata->usbc_en2_gpio = of_get_named_gpio(card->dev->of_node,
- "qcom,usbc-analog-en2-gpio", 0);
- if (!gpio_is_valid(pdata->usbc_en2_gpio)) {
- dev_err(card->dev, "%s, property %s not in node %s",
- __func__, "qcom,usbc-analog-en2-gpio",
- card->dev->of_node->full_name);
- return false;
- }
-
- en2_pinctrl_active = pinctrl_lookup_state(
- pdata->usbc_en2_gpio_p, "aud_active");
- if (IS_ERR_OR_NULL(en2_pinctrl_active)) {
- dev_err(card->dev,
- "%s: Cannot get aud_active pinctrl state:%ld\n",
- __func__, PTR_ERR(en2_pinctrl_active));
- ret = false;
- goto err_lookup_state;
- }
-
- en2_pinctrl_sleep = pinctrl_lookup_state(
- pdata->usbc_en2_gpio_p, "aud_sleep");
- if (IS_ERR_OR_NULL(en2_pinctrl_sleep)) {
- dev_err(card->dev,
- "%s: Cannot get aud_sleep pinctrl state:%ld\n",
- __func__, PTR_ERR(en2_pinctrl_sleep));
- ret = false;
- goto err_lookup_state;
- }
-
- /* if active and usbc_en2_gpio_p defined, swap using usbc_en2_gpio_p */
- if (active) {
- dev_dbg(codec->dev, "%s: enter\n", __func__);
- if (pdata->usbc_en2_gpio_p) {
- value = gpio_get_value_cansleep(pdata->usbc_en2_gpio);
- if (value)
- pinctrl_select_state(pdata->usbc_en2_gpio_p,
- en2_pinctrl_sleep);
- else
- pinctrl_select_state(pdata->usbc_en2_gpio_p,
- en2_pinctrl_active);
- } else if (pdata->usbc_en2_gpio >= 0) {
- value = gpio_get_value_cansleep(pdata->usbc_en2_gpio);
- gpio_set_value_cansleep(pdata->usbc_en2_gpio, !value);
- }
- pr_debug("%s: swap select switch %d to %d\n", __func__,
- value, !value);
- ret = true;
- } else {
- /* if not active, release usbc_en2_gpio_p pin */
- pinctrl_select_state(pdata->usbc_en2_gpio_p,
- en2_pinctrl_sleep);
- }
-
-err_lookup_state:
- devm_pinctrl_put(pdata->usbc_en2_gpio_p);
- pdata->usbc_en2_gpio_p = NULL;
- return ret;
-}
-
-static bool msm_swap_gnd_mic(struct snd_soc_codec *codec, bool active)
-{
- int value = 0;
- int ret = 0;
- struct snd_soc_card *card = codec->component.card;
- struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
-
- if (!pdata)
- return false;
-
- if (!wcd_mbhc_cfg.enable_usbc_analog) {
- /* if usbc is not defined, swap using us_euro_gpio_p */
- if (pdata->us_euro_gpio_p) {
- value = msm_cdc_pinctrl_get_state(
- pdata->us_euro_gpio_p);
- if (value)
- msm_cdc_pinctrl_select_sleep_state(
- pdata->us_euro_gpio_p);
- else
- msm_cdc_pinctrl_select_active_state(
- pdata->us_euro_gpio_p);
- } else if (pdata->us_euro_gpio >= 0) {
- value = gpio_get_value_cansleep(
- pdata->us_euro_gpio);
- gpio_set_value_cansleep(
- pdata->us_euro_gpio, !value);
- }
- pr_debug("%s: swap select switch %d to %d\n", __func__,
- value, !value);
- ret = true;
- } else {
- /* if usbc is defined, swap using usbc_en2 */
- ret = msm_usbc_swap_gnd_mic(codec, active);
- }
- return ret;
-}
-
-static int msm_afe_set_config(struct snd_soc_codec *codec)
-{
- int ret = 0;
- void *config_data = NULL;
-
- if (!msm_codec_fn.get_afe_config_fn) {
- dev_err(codec->dev, "%s: codec get afe config not init'ed\n",
- __func__);
- return -EINVAL;
- }
-
- config_data = msm_codec_fn.get_afe_config_fn(codec,
- AFE_CDC_REGISTERS_CONFIG);
- if (config_data) {
- ret = afe_set_config(AFE_CDC_REGISTERS_CONFIG, config_data, 0);
- if (ret) {
- dev_err(codec->dev,
- "%s: Failed to set codec registers config %d\n",
- __func__, ret);
- return ret;
- }
- }
-
- config_data = msm_codec_fn.get_afe_config_fn(codec,
- AFE_CDC_REGISTER_PAGE_CONFIG);
- if (config_data) {
- ret = afe_set_config(AFE_CDC_REGISTER_PAGE_CONFIG, config_data,
- 0);
- if (ret)
- dev_err(codec->dev,
- "%s: Failed to set cdc register page config\n",
- __func__);
- }
-
- config_data = msm_codec_fn.get_afe_config_fn(codec,
- AFE_SLIMBUS_SLAVE_CONFIG);
- if (config_data) {
- ret = afe_set_config(AFE_SLIMBUS_SLAVE_CONFIG, config_data, 0);
- if (ret) {
- dev_err(codec->dev,
- "%s: Failed to set slimbus slave config %d\n",
- __func__, ret);
- return ret;
- }
- }
-
- return 0;
-}
-
-static void msm_afe_clear_config(void)
-{
- afe_clear_config(AFE_CDC_REGISTERS_CONFIG);
- afe_clear_config(AFE_SLIMBUS_SLAVE_CONFIG);
-}
-
-static int msm_adsp_power_up_config(struct snd_soc_codec *codec,
- struct snd_card *card)
-{
- int ret = 0;
- unsigned long timeout;
- int adsp_ready = 0;
- bool snd_card_online = 0;
-
- timeout = jiffies +
- msecs_to_jiffies(ADSP_STATE_READY_TIMEOUT_MS);
-
- do {
- if (!snd_card_online) {
- snd_card_online = snd_card_is_online_state(card);
- pr_debug("%s: Sound card is %s\n", __func__,
- snd_card_online ? "Online" : "Offline");
- }
- if (!adsp_ready) {
- adsp_ready = q6core_is_adsp_ready();
- pr_debug("%s: ADSP Audio is %s\n", __func__,
- adsp_ready ? "ready" : "not ready");
- }
- if (snd_card_online && adsp_ready)
- break;
-
- /*
- * Sound card/ADSP will be coming up after subsystem restart and
- * it might not be fully up when the control reaches
- * here. So, wait for 50msec before checking ADSP state
- */
- msleep(50);
- } while (time_after(timeout, jiffies));
-
- if (!snd_card_online || !adsp_ready) {
- pr_err("%s: Timeout. Sound card is %s, ADSP Audio is %s\n",
- __func__,
- snd_card_online ? "Online" : "Offline",
- adsp_ready ? "ready" : "not ready");
- ret = -ETIMEDOUT;
- goto err;
- }
-
- ret = msm_afe_set_config(codec);
- if (ret)
- pr_err("%s: Failed to set AFE config. err %d\n",
- __func__, ret);
-
- return 0;
-
-err:
- return ret;
-}
-
-static int sdm845_notifier_service_cb(struct notifier_block *this,
- unsigned long opcode, void *ptr)
-{
- int ret;
- struct snd_soc_card *card = NULL;
- const char *be_dl_name = LPASS_BE_SLIMBUS_0_RX;
- struct snd_soc_pcm_runtime *rtd;
- struct snd_soc_codec *codec;
-
- pr_debug("%s: Service opcode 0x%lx\n", __func__, opcode);
-
- switch (opcode) {
- case AUDIO_NOTIFIER_SERVICE_DOWN:
- /*
- * Use flag to ignore initial boot notifications
- * On initial boot msm_adsp_power_up_config is
- * called on init. There is no need to clear
- * and set the config again on initial boot.
- */
- if (is_initial_boot)
- break;
- msm_afe_clear_config();
- break;
- case AUDIO_NOTIFIER_SERVICE_UP:
- if (is_initial_boot) {
- is_initial_boot = false;
- break;
- }
- if (!spdev)
- return -EINVAL;
-
- card = platform_get_drvdata(spdev);
- rtd = snd_soc_get_pcm_runtime(card, be_dl_name);
- if (!rtd) {
- dev_err(card->dev,
- "%s: snd_soc_get_pcm_runtime for %s failed!\n",
- __func__, be_dl_name);
- ret = -EINVAL;
- goto err;
- }
- codec = rtd->codec;
-
- ret = msm_adsp_power_up_config(codec, card->snd_card);
- if (ret < 0) {
- dev_err(card->dev,
- "%s: msm_adsp_power_up_config failed ret = %d!\n",
- __func__, ret);
- goto err;
- }
- break;
- default:
- break;
- }
-err:
- return NOTIFY_OK;
-}
-
-static struct notifier_block service_nb = {
- .notifier_call = sdm845_notifier_service_cb,
- .priority = -INT_MAX,
-};
-
-static int msm_audrx_init(struct snd_soc_pcm_runtime *rtd)
-{
- int ret = 0;
- void *config_data;
- struct snd_soc_codec *codec = rtd->codec;
- struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
- struct snd_soc_component *aux_comp;
- struct snd_card *card;
- struct snd_info_entry *entry;
- struct msm_asoc_mach_data *pdata =
- snd_soc_card_get_drvdata(rtd->card);
-
- /* Codec SLIMBUS configuration
- * RX1, RX2, RX3, RX4, RX5, RX6, RX7, RX8
- * TX1, TX2, TX3, TX4, TX5, TX6, TX7, TX8, TX9, TX10, TX11, TX12, TX13
- * TX14, TX15, TX16
- */
- unsigned int rx_ch[WCD934X_RX_MAX] = {144, 145, 146, 147, 148, 149,
- 150, 151};
- unsigned int tx_ch[WCD934X_TX_MAX] = {128, 129, 130, 131, 132, 133,
- 134, 135, 136, 137, 138, 139,
- 140, 141, 142, 143};
-
- pr_info("%s: dev_name%s\n", __func__, dev_name(cpu_dai->dev));
-
- rtd->pmdown_time = 0;
-
- ret = snd_soc_add_codec_controls(codec, msm_snd_controls,
- ARRAY_SIZE(msm_snd_controls));
- if (ret < 0) {
- pr_err("%s: add_codec_controls failed, err %d\n",
- __func__, ret);
- return ret;
- }
-
- snd_soc_dapm_new_controls(dapm, msm_dapm_widgets,
- ARRAY_SIZE(msm_dapm_widgets));
-
- snd_soc_dapm_add_routes(dapm, wcd_audio_paths,
- ARRAY_SIZE(wcd_audio_paths));
-
- snd_soc_dapm_ignore_suspend(dapm, "Handset Mic");
- snd_soc_dapm_ignore_suspend(dapm, "Headset Mic");
- snd_soc_dapm_ignore_suspend(dapm, "ANCRight Headset Mic");
- snd_soc_dapm_ignore_suspend(dapm, "ANCLeft Headset Mic");
- snd_soc_dapm_ignore_suspend(dapm, "Digital Mic0");
- snd_soc_dapm_ignore_suspend(dapm, "Digital Mic1");
- snd_soc_dapm_ignore_suspend(dapm, "Digital Mic2");
- snd_soc_dapm_ignore_suspend(dapm, "Digital Mic3");
- snd_soc_dapm_ignore_suspend(dapm, "Digital Mic4");
- snd_soc_dapm_ignore_suspend(dapm, "Digital Mic5");
- snd_soc_dapm_ignore_suspend(dapm, "Analog Mic5");
- snd_soc_dapm_ignore_suspend(dapm, "MADINPUT");
- snd_soc_dapm_ignore_suspend(dapm, "MAD_CPE_INPUT");
- snd_soc_dapm_ignore_suspend(dapm, "MAD_CPE_OUT1");
- snd_soc_dapm_ignore_suspend(dapm, "MAD_CPE_OUT2");
- snd_soc_dapm_ignore_suspend(dapm, "EAR");
- snd_soc_dapm_ignore_suspend(dapm, "LINEOUT1");
- snd_soc_dapm_ignore_suspend(dapm, "LINEOUT2");
- snd_soc_dapm_ignore_suspend(dapm, "ANC EAR");
- snd_soc_dapm_ignore_suspend(dapm, "SPK1 OUT");
- snd_soc_dapm_ignore_suspend(dapm, "SPK2 OUT");
- snd_soc_dapm_ignore_suspend(dapm, "HPHL");
- snd_soc_dapm_ignore_suspend(dapm, "HPHR");
- snd_soc_dapm_ignore_suspend(dapm, "AIF4 VI");
- snd_soc_dapm_ignore_suspend(dapm, "VIINPUT");
- snd_soc_dapm_ignore_suspend(dapm, "ANC HPHL");
- snd_soc_dapm_ignore_suspend(dapm, "ANC HPHR");
-
- snd_soc_dapm_sync(dapm);
-
- snd_soc_dai_set_channel_map(codec_dai, ARRAY_SIZE(tx_ch),
- tx_ch, ARRAY_SIZE(rx_ch), rx_ch);
-
- msm_codec_fn.get_afe_config_fn = tavil_get_afe_config;
-
- ret = msm_adsp_power_up_config(codec, rtd->card->snd_card);
- if (ret) {
- pr_err("%s: Failed to set AFE config %d\n", __func__, ret);
- goto err;
- }
-
- config_data = msm_codec_fn.get_afe_config_fn(codec,
- AFE_AANC_VERSION);
- if (config_data) {
- ret = afe_set_config(AFE_AANC_VERSION, config_data, 0);
- if (ret) {
- pr_err("%s: Failed to set aanc version %d\n",
- __func__, ret);
- goto err;
- }
- }
-
- /*
- * Send speaker configuration only for WSA8810.
- * Default configuration is for WSA8815.
- */
- pr_debug("%s: Number of aux devices: %d\n",
- __func__, rtd->card->num_aux_devs);
- if (rtd->card->num_aux_devs &&
- !list_empty(&rtd->card->aux_comp_list)) {
- aux_comp = list_first_entry(&rtd->card->aux_comp_list,
- struct snd_soc_component, list_aux);
- if (!strcmp(aux_comp->name, WSA8810_NAME_1) ||
- !strcmp(aux_comp->name, WSA8810_NAME_2)) {
- tavil_set_spkr_mode(rtd->codec, WCD934X_SPKR_MODE_1);
- tavil_set_spkr_gain_offset(rtd->codec,
- WCD934X_RX_GAIN_OFFSET_M1P5_DB);
- }
- }
- card = rtd->card->snd_card;
- entry = snd_info_create_subdir(card->module, "codecs",
- card->proc_root);
- if (!entry) {
- pr_debug("%s: Cannot create codecs module entry\n",
- __func__);
- pdata->codec_root = NULL;
- goto done;
- }
- pdata->codec_root = entry;
- tavil_codec_info_create_codec_entry(pdata->codec_root, codec);
-
-done:
- codec_reg_done = true;
- return 0;
-
-err:
- return ret;
-}
-
-static int msm_wcn_init(struct snd_soc_pcm_runtime *rtd)
-{
- unsigned int rx_ch[WCN_CDC_SLIM_RX_CH_MAX] = {157, 158};
- unsigned int tx_ch[WCN_CDC_SLIM_TX_CH_MAX] = {159, 160, 161};
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
-
- return snd_soc_dai_set_channel_map(codec_dai, ARRAY_SIZE(tx_ch),
- tx_ch, ARRAY_SIZE(rx_ch), rx_ch);
-}
-
-static void *def_tavil_mbhc_cal(void)
-{
- void *tavil_wcd_cal;
- struct wcd_mbhc_btn_detect_cfg *btn_cfg;
- u16 *btn_high;
-
- tavil_wcd_cal = kzalloc(WCD_MBHC_CAL_SIZE(WCD_MBHC_DEF_BUTTONS,
- WCD9XXX_MBHC_DEF_RLOADS), GFP_KERNEL);
- if (!tavil_wcd_cal)
- return NULL;
-
-#define S(X, Y) ((WCD_MBHC_CAL_PLUG_TYPE_PTR(tavil_wcd_cal)->X) = (Y))
- S(v_hs_max, 1600);
-#undef S
-#define S(X, Y) ((WCD_MBHC_CAL_BTN_DET_PTR(tavil_wcd_cal)->X) = (Y))
- S(num_btn, WCD_MBHC_DEF_BUTTONS);
-#undef S
-
- btn_cfg = WCD_MBHC_CAL_BTN_DET_PTR(tavil_wcd_cal);
- btn_high = ((void *)&btn_cfg->_v_btn_low) +
- (sizeof(btn_cfg->_v_btn_low[0]) * btn_cfg->num_btn);
-
- btn_high[0] = 75;
- btn_high[1] = 150;
- btn_high[2] = 237;
- btn_high[3] = 500;
- btn_high[4] = 500;
- btn_high[5] = 500;
- btn_high[6] = 500;
- btn_high[7] = 500;
-
- return tavil_wcd_cal;
-}
-
-static int msm_snd_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- struct snd_soc_dai_link *dai_link = rtd->dai_link;
-
- int ret = 0;
- u32 rx_ch[SLIM_MAX_RX_PORTS], tx_ch[SLIM_MAX_TX_PORTS];
- u32 rx_ch_cnt = 0, tx_ch_cnt = 0;
- u32 user_set_tx_ch = 0;
- u32 rx_ch_count;
-
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
- ret = snd_soc_dai_get_channel_map(codec_dai,
- &tx_ch_cnt, tx_ch, &rx_ch_cnt, rx_ch);
- if (ret < 0) {
- pr_err("%s: failed to get codec chan map, err:%d\n",
- __func__, ret);
- goto err;
- }
- if (dai_link->id == MSM_BACKEND_DAI_SLIMBUS_5_RX) {
- pr_debug("%s: rx_5_ch=%d\n", __func__,
- slim_rx_cfg[5].channels);
- rx_ch_count = slim_rx_cfg[5].channels;
- } else if (dai_link->id == MSM_BACKEND_DAI_SLIMBUS_2_RX) {
- pr_debug("%s: rx_2_ch=%d\n", __func__,
- slim_rx_cfg[2].channels);
- rx_ch_count = slim_rx_cfg[2].channels;
- } else if (dai_link->id == MSM_BACKEND_DAI_SLIMBUS_6_RX) {
- pr_debug("%s: rx_6_ch=%d\n", __func__,
- slim_rx_cfg[6].channels);
- rx_ch_count = slim_rx_cfg[6].channels;
- } else {
- pr_debug("%s: rx_0_ch=%d\n", __func__,
- slim_rx_cfg[0].channels);
- rx_ch_count = slim_rx_cfg[0].channels;
- }
- ret = snd_soc_dai_set_channel_map(cpu_dai, 0, 0,
- rx_ch_count, rx_ch);
- if (ret < 0) {
- pr_err("%s: failed to set cpu chan map, err:%d\n",
- __func__, ret);
- goto err;
- }
- } else {
-
- pr_debug("%s: %s_tx_dai_id_%d_ch=%d\n", __func__,
- codec_dai->name, codec_dai->id, user_set_tx_ch);
- ret = snd_soc_dai_get_channel_map(codec_dai,
- &tx_ch_cnt, tx_ch, &rx_ch_cnt, rx_ch);
- if (ret < 0) {
- pr_err("%s: failed to get codec chan map\n, err:%d\n",
- __func__, ret);
- goto err;
- }
- /* For <codec>_tx1 case */
- if (dai_link->id == MSM_BACKEND_DAI_SLIMBUS_0_TX)
- user_set_tx_ch = slim_tx_cfg[0].channels;
- /* For <codec>_tx3 case */
- else if (dai_link->id == MSM_BACKEND_DAI_SLIMBUS_1_TX)
- user_set_tx_ch = slim_tx_cfg[1].channels;
- else if (dai_link->id == MSM_BACKEND_DAI_SLIMBUS_4_TX)
- user_set_tx_ch = msm_vi_feed_tx_ch;
- else
- user_set_tx_ch = tx_ch_cnt;
-
- pr_debug("%s: msm_slim_0_tx_ch(%d) user_set_tx_ch(%d) tx_ch_cnt(%d), BE id (%d)\n",
- __func__, slim_tx_cfg[0].channels, user_set_tx_ch,
- tx_ch_cnt, dai_link->id);
-
- ret = snd_soc_dai_set_channel_map(cpu_dai,
- user_set_tx_ch, tx_ch, 0, 0);
- if (ret < 0)
- pr_err("%s: failed to set cpu chan map, err:%d\n",
- __func__, ret);
- }
-
-err:
- return ret;
-}
-
-static int msm_slimbus_2_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- unsigned int rx_ch[SLIM_MAX_RX_PORTS], tx_ch[SLIM_MAX_TX_PORTS];
- unsigned int rx_ch_cnt = 0, tx_ch_cnt = 0;
- unsigned int num_tx_ch = 0;
- unsigned int num_rx_ch = 0;
- int ret = 0;
-
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
- num_rx_ch = params_channels(params);
- pr_debug("%s: %s rx_dai_id = %d num_ch = %d\n", __func__,
- codec_dai->name, codec_dai->id, num_rx_ch);
- ret = snd_soc_dai_get_channel_map(codec_dai,
- &tx_ch_cnt, tx_ch, &rx_ch_cnt, rx_ch);
- if (ret < 0) {
- pr_err("%s: failed to get codec chan map, err:%d\n",
- __func__, ret);
- goto err;
- }
- ret = snd_soc_dai_set_channel_map(cpu_dai, 0, 0,
- num_rx_ch, rx_ch);
- if (ret < 0) {
- pr_err("%s: failed to set cpu chan map, err:%d\n",
- __func__, ret);
- goto err;
- }
- } else {
- num_tx_ch = params_channels(params);
- pr_debug("%s: %s tx_dai_id = %d num_ch = %d\n", __func__,
- codec_dai->name, codec_dai->id, num_tx_ch);
- ret = snd_soc_dai_get_channel_map(codec_dai,
- &tx_ch_cnt, tx_ch, &rx_ch_cnt, rx_ch);
- if (ret < 0) {
- pr_err("%s: failed to get codec chan map, err:%d\n",
- __func__, ret);
- goto err;
- }
- ret = snd_soc_dai_set_channel_map(cpu_dai,
- num_tx_ch, tx_ch, 0, 0);
- if (ret < 0) {
- pr_err("%s: failed to set cpu chan map, err:%d\n",
- __func__, ret);
- goto err;
- }
- }
-
-err:
- return ret;
-}
-
-static int msm_wcn_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- struct snd_soc_dai_link *dai_link = rtd->dai_link;
- u32 rx_ch[WCN_CDC_SLIM_RX_CH_MAX], tx_ch[WCN_CDC_SLIM_TX_CH_MAX];
- u32 rx_ch_cnt = 0, tx_ch_cnt = 0;
- int ret;
-
- dev_dbg(rtd->dev, "%s: %s_tx_dai_id_%d\n", __func__,
- codec_dai->name, codec_dai->id);
- ret = snd_soc_dai_get_channel_map(codec_dai,
- &tx_ch_cnt, tx_ch, &rx_ch_cnt, rx_ch);
- if (ret) {
- dev_err(rtd->dev,
- "%s: failed to get BTFM codec chan map\n, err:%d\n",
- __func__, ret);
- goto err;
- }
-
- dev_dbg(rtd->dev, "%s: tx_ch_cnt(%d) BE id %d\n",
- __func__, tx_ch_cnt, dai_link->id);
-
- ret = snd_soc_dai_set_channel_map(cpu_dai,
- tx_ch_cnt, tx_ch, rx_ch_cnt, rx_ch);
- if (ret)
- dev_err(rtd->dev, "%s: failed to set cpu chan map, err:%d\n",
- __func__, ret);
-
-err:
- return ret;
-}
-
-static int msm_get_port_id(int be_id)
-{
- int afe_port_id;
-
- switch (be_id) {
- case MSM_BACKEND_DAI_PRI_MI2S_RX:
- afe_port_id = AFE_PORT_ID_PRIMARY_MI2S_RX;
- break;
- case MSM_BACKEND_DAI_PRI_MI2S_TX:
- afe_port_id = AFE_PORT_ID_PRIMARY_MI2S_TX;
- break;
- case MSM_BACKEND_DAI_SECONDARY_MI2S_RX:
- afe_port_id = AFE_PORT_ID_SECONDARY_MI2S_RX;
- break;
- case MSM_BACKEND_DAI_SECONDARY_MI2S_TX:
- afe_port_id = AFE_PORT_ID_SECONDARY_MI2S_TX;
- break;
- case MSM_BACKEND_DAI_TERTIARY_MI2S_RX:
- afe_port_id = AFE_PORT_ID_TERTIARY_MI2S_RX;
- break;
- case MSM_BACKEND_DAI_TERTIARY_MI2S_TX:
- afe_port_id = AFE_PORT_ID_TERTIARY_MI2S_TX;
- break;
- case MSM_BACKEND_DAI_QUATERNARY_MI2S_RX:
- afe_port_id = AFE_PORT_ID_QUATERNARY_MI2S_RX;
- break;
- case MSM_BACKEND_DAI_QUATERNARY_MI2S_TX:
- afe_port_id = AFE_PORT_ID_QUATERNARY_MI2S_TX;
- break;
- default:
- pr_err("%s: Invalid BE id: %d\n", __func__, be_id);
- afe_port_id = -EINVAL;
- }
-
- return afe_port_id;
-}
-
-static u32 get_mi2s_bits_per_sample(u32 bit_format)
-{
- u32 bit_per_sample;
-
- switch (bit_format) {
- case SNDRV_PCM_FORMAT_S32_LE:
- case SNDRV_PCM_FORMAT_S24_3LE:
- case SNDRV_PCM_FORMAT_S24_LE:
- bit_per_sample = 32;
- break;
- case SNDRV_PCM_FORMAT_S16_LE:
- default:
- bit_per_sample = 16;
- break;
- }
-
- return bit_per_sample;
-}
-
-static void update_mi2s_clk_val(int dai_id, int stream)
-{
- u32 bit_per_sample;
-
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
- bit_per_sample =
- get_mi2s_bits_per_sample(mi2s_rx_cfg[dai_id].bit_format);
- mi2s_clk[dai_id].clk_freq_in_hz =
- mi2s_rx_cfg[dai_id].sample_rate * 2 * bit_per_sample;
- } else {
- bit_per_sample =
- get_mi2s_bits_per_sample(mi2s_tx_cfg[dai_id].bit_format);
- mi2s_clk[dai_id].clk_freq_in_hz =
- mi2s_tx_cfg[dai_id].sample_rate * 2 * bit_per_sample;
- }
-}
-
-static int msm_mi2s_set_sclk(struct snd_pcm_substream *substream, bool enable)
-{
- int ret = 0;
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- int port_id = 0;
- int index = cpu_dai->id;
-
- port_id = msm_get_port_id(rtd->dai_link->id);
- if (port_id < 0) {
- dev_err(rtd->card->dev, "%s: Invalid port_id\n", __func__);
- ret = port_id;
- goto err;
- }
-
- if (enable) {
- update_mi2s_clk_val(index, substream->stream);
- dev_dbg(rtd->card->dev, "%s: clock rate %ul\n", __func__,
- mi2s_clk[index].clk_freq_in_hz);
- }
-
- mi2s_clk[index].enable = enable;
- ret = afe_set_lpass_clock_v2(port_id,
- &mi2s_clk[index]);
- if (ret < 0) {
- dev_err(rtd->card->dev,
- "%s: afe lpass clock failed for port 0x%x , err:%d\n",
- __func__, port_id, ret);
- goto err;
- }
-
-err:
- return ret;
-}
-
-static int msm_set_pinctrl(struct msm_pinctrl_info *pinctrl_info,
- enum pinctrl_pin_state new_state)
-{
- int ret = 0;
- int curr_state = 0;
-
- if (pinctrl_info == NULL) {
- pr_err("%s: pinctrl_info is NULL\n", __func__);
- ret = -EINVAL;
- goto err;
- }
-
- if (pinctrl_info->pinctrl == NULL) {
- pr_err("%s: pinctrl_info->pinctrl is NULL\n", __func__);
- ret = -EINVAL;
- goto err;
- }
-
- curr_state = pinctrl_info->curr_state;
- pinctrl_info->curr_state = new_state;
- pr_debug("%s: curr_state = %s new_state = %s\n", __func__,
- pin_states[curr_state], pin_states[pinctrl_info->curr_state]);
-
- if (curr_state == pinctrl_info->curr_state) {
- pr_debug("%s: Already in same state\n", __func__);
- goto err;
- }
-
- if (curr_state != STATE_DISABLE &&
- pinctrl_info->curr_state != STATE_DISABLE) {
- pr_debug("%s: state already active cannot switch\n", __func__);
- ret = -EIO;
- goto err;
- }
-
- switch (pinctrl_info->curr_state) {
- case STATE_MI2S_ACTIVE:
- ret = pinctrl_select_state(pinctrl_info->pinctrl,
- pinctrl_info->mi2s_active);
- if (ret) {
- pr_err("%s: MI2S state select failed with %d\n",
- __func__, ret);
- ret = -EIO;
- goto err;
- }
- break;
- case STATE_TDM_ACTIVE:
- ret = pinctrl_select_state(pinctrl_info->pinctrl,
- pinctrl_info->tdm_active);
- if (ret) {
- pr_err("%s: TDM state select failed with %d\n",
- __func__, ret);
- ret = -EIO;
- goto err;
- }
- break;
- case STATE_DISABLE:
- if (curr_state == STATE_MI2S_ACTIVE) {
- ret = pinctrl_select_state(pinctrl_info->pinctrl,
- pinctrl_info->mi2s_disable);
- } else {
- ret = pinctrl_select_state(pinctrl_info->pinctrl,
- pinctrl_info->tdm_disable);
- }
- if (ret) {
- pr_err("%s: state disable failed with %d\n",
- __func__, ret);
- ret = -EIO;
- goto err;
- }
- break;
- default:
- pr_err("%s: TLMM pin state is invalid\n", __func__);
- return -EINVAL;
- }
-
-err:
- return ret;
-}
-
-static void msm_release_pinctrl(struct platform_device *pdev)
-{
- struct snd_soc_card *card = platform_get_drvdata(pdev);
- struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
- struct msm_pinctrl_info *pinctrl_info = &pdata->pinctrl_info;
-
- if (pinctrl_info->pinctrl) {
- devm_pinctrl_put(pinctrl_info->pinctrl);
- pinctrl_info->pinctrl = NULL;
- }
-}
-
-static int msm_get_pinctrl(struct platform_device *pdev)
-{
- struct snd_soc_card *card = platform_get_drvdata(pdev);
- struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
- struct msm_pinctrl_info *pinctrl_info = NULL;
- struct pinctrl *pinctrl;
- int ret;
-
- pinctrl_info = &pdata->pinctrl_info;
-
- if (pinctrl_info == NULL) {
- pr_err("%s: pinctrl_info is NULL\n", __func__);
- return -EINVAL;
- }
-
- pinctrl = devm_pinctrl_get(&pdev->dev);
- if (IS_ERR_OR_NULL(pinctrl)) {
- pr_err("%s: Unable to get pinctrl handle\n", __func__);
- return -EINVAL;
- }
- pinctrl_info->pinctrl = pinctrl;
-
- /* get all the states handles from Device Tree */
- pinctrl_info->mi2s_disable = pinctrl_lookup_state(pinctrl,
- "quat-mi2s-sleep");
- if (IS_ERR(pinctrl_info->mi2s_disable)) {
- pr_err("%s: could not get mi2s_disable pinstate\n", __func__);
- goto err;
- }
- pinctrl_info->mi2s_active = pinctrl_lookup_state(pinctrl,
- "quat-mi2s-active");
- if (IS_ERR(pinctrl_info->mi2s_active)) {
- pr_err("%s: could not get mi2s_active pinstate\n", __func__);
- goto err;
- }
- pinctrl_info->tdm_disable = pinctrl_lookup_state(pinctrl,
- "quat-tdm-sleep");
- if (IS_ERR(pinctrl_info->tdm_disable)) {
- pr_err("%s: could not get tdm_disable pinstate\n", __func__);
- goto err;
- }
- pinctrl_info->tdm_active = pinctrl_lookup_state(pinctrl,
- "quat-tdm-active");
- if (IS_ERR(pinctrl_info->tdm_active)) {
- pr_err("%s: could not get tdm_active pinstate\n",
- __func__);
- goto err;
- }
- /* Reset the TLMM pins to a default state */
- ret = pinctrl_select_state(pinctrl_info->pinctrl,
- pinctrl_info->mi2s_disable);
- if (ret != 0) {
- pr_err("%s: Disable TLMM pins failed with %d\n",
- __func__, ret);
- ret = -EIO;
- goto err;
- }
- pinctrl_info->curr_state = STATE_DISABLE;
-
- return 0;
-
-err:
- devm_pinctrl_put(pinctrl);
- pinctrl_info->pinctrl = NULL;
- return -EINVAL;
-}
-
-static int msm_tdm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
- struct snd_pcm_hw_params *params)
-{
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- struct snd_interval *rate = hw_param_interval(params,
- SNDRV_PCM_HW_PARAM_RATE);
- struct snd_interval *channels = hw_param_interval(params,
- SNDRV_PCM_HW_PARAM_CHANNELS);
-
- if (cpu_dai->id == AFE_PORT_ID_QUATERNARY_TDM_RX) {
- channels->min = channels->max =
- tdm_rx_cfg[TDM_QUAT][TDM_0].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- tdm_rx_cfg[TDM_QUAT][TDM_0].bit_format);
- rate->min = rate->max =
- tdm_rx_cfg[TDM_QUAT][TDM_0].sample_rate;
- } else if (cpu_dai->id == AFE_PORT_ID_SECONDARY_TDM_RX) {
- channels->min = channels->max =
- tdm_rx_cfg[TDM_SEC][TDM_0].channels;
- param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
- tdm_rx_cfg[TDM_SEC][TDM_0].bit_format);
- rate->min = rate->max = tdm_rx_cfg[TDM_SEC][TDM_0].sample_rate;
- } else {
- pr_err("%s: dai id 0x%x not supported\n",
- __func__, cpu_dai->id);
- return -EINVAL;
- }
-
- pr_debug("%s: dai id = 0x%x channels = %d rate = %d format = 0x%x\n",
- __func__, cpu_dai->id, channels->max, rate->max,
- params_format(params));
-
- return 0;
-}
-
-static int sdm845_tdm_snd_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- int ret = 0;
- int slot_width = 32;
- int channels, slots;
- unsigned int slot_mask, rate, clk_freq;
- unsigned int slot_offset[8] = {0, 4, 8, 12, 16, 20, 24, 28};
-
- pr_debug("%s: dai id = 0x%x\n", __func__, cpu_dai->id);
-
- /* currently only supporting TDM_RX_0 and TDM_TX_0 */
- switch (cpu_dai->id) {
- case AFE_PORT_ID_PRIMARY_TDM_RX:
- slots = tdm_rx_cfg[TDM_PRI][TDM_0].channels;
- break;
- case AFE_PORT_ID_SECONDARY_TDM_RX:
- slots = tdm_rx_cfg[TDM_SEC][TDM_0].channels;
- break;
- case AFE_PORT_ID_TERTIARY_TDM_RX:
- slots = tdm_rx_cfg[TDM_TERT][TDM_0].channels;
- break;
- case AFE_PORT_ID_QUATERNARY_TDM_RX:
- slots = tdm_rx_cfg[TDM_QUAT][TDM_0].channels;
- break;
- case AFE_PORT_ID_PRIMARY_TDM_TX:
- slots = tdm_tx_cfg[TDM_PRI][TDM_0].channels;
- break;
- case AFE_PORT_ID_SECONDARY_TDM_TX:
- slots = tdm_tx_cfg[TDM_SEC][TDM_0].channels;
- break;
- case AFE_PORT_ID_TERTIARY_TDM_TX:
- slots = tdm_tx_cfg[TDM_TERT][TDM_0].channels;
- break;
- case AFE_PORT_ID_QUATERNARY_TDM_TX:
- slots = tdm_tx_cfg[TDM_QUAT][TDM_0].channels;
- break;
- default:
- pr_err("%s: dai id 0x%x not supported\n",
- __func__, cpu_dai->id);
- return -EINVAL;
- }
-
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
- /*2 slot config - bits 0 and 1 set for the first two slots */
- slot_mask = 0x0000FFFF >> (16-slots);
- channels = slots;
-
- pr_debug("%s: tdm rx slot_width %d slots %d\n",
- __func__, slot_width, slots);
-
- ret = snd_soc_dai_set_tdm_slot(cpu_dai, 0, slot_mask,
- slots, slot_width);
- if (ret < 0) {
- pr_err("%s: failed to set tdm rx slot, err:%d\n",
- __func__, ret);
- goto end;
- }
-
- ret = snd_soc_dai_set_channel_map(cpu_dai,
- 0, NULL, channels, slot_offset);
- if (ret < 0) {
- pr_err("%s: failed to set tdm rx channel map, err:%d\n",
- __func__, ret);
- goto end;
- }
- } else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
- /*2 slot config - bits 0 and 1 set for the first two slots */
- slot_mask = 0x0000FFFF >> (16-slots);
- channels = slots;
-
- pr_debug("%s: tdm tx slot_width %d slots %d\n",
- __func__, slot_width, slots);
-
- ret = snd_soc_dai_set_tdm_slot(cpu_dai, slot_mask, 0,
- slots, slot_width);
- if (ret < 0) {
- pr_err("%s: failed to set tdm tx slot, err:%d\n",
- __func__, ret);
- goto end;
- }
-
- ret = snd_soc_dai_set_channel_map(cpu_dai,
- channels, slot_offset, 0, NULL);
- if (ret < 0) {
- pr_err("%s: failed to set tdm tx channel map, err:%d\n",
- __func__, ret);
- goto end;
- }
- } else {
- ret = -EINVAL;
- pr_err("%s: invalid use case, err:%d\n",
- __func__, ret);
- goto end;
- }
-
- rate = params_rate(params);
- clk_freq = rate * slot_width * slots;
- ret = snd_soc_dai_set_sysclk(cpu_dai, 0, clk_freq, SND_SOC_CLOCK_OUT);
- if (ret < 0)
- pr_err("%s: failed to set tdm clk, err:%d\n",
- __func__, ret);
-
-end:
- return ret;
-}
-
-static int sdm845_tdm_snd_startup(struct snd_pcm_substream *substream)
-{
- int ret = 0;
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- struct snd_soc_card *card = rtd->card;
- struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
- struct msm_pinctrl_info *pinctrl_info = &pdata->pinctrl_info;
-
- /* currently only supporting TDM_RX_0 and TDM_TX_0 */
- if ((cpu_dai->id == AFE_PORT_ID_QUATERNARY_TDM_RX) ||
- (cpu_dai->id == AFE_PORT_ID_QUATERNARY_TDM_TX)) {
- ret = msm_set_pinctrl(pinctrl_info, STATE_TDM_ACTIVE);
- if (ret)
- pr_err("%s: TDM TLMM pinctrl set failed with %d\n",
- __func__, ret);
- }
-
- return ret;
-}
-
-static void sdm845_tdm_snd_shutdown(struct snd_pcm_substream *substream)
-{
- int ret = 0;
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- struct snd_soc_card *card = rtd->card;
- struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
- struct msm_pinctrl_info *pinctrl_info = &pdata->pinctrl_info;
-
- /* currently only supporting TDM_RX_0 and TDM_TX_0 */
- if ((cpu_dai->id == AFE_PORT_ID_QUATERNARY_TDM_RX) ||
- (cpu_dai->id == AFE_PORT_ID_QUATERNARY_TDM_TX)) {
- ret = msm_set_pinctrl(pinctrl_info, STATE_DISABLE);
- if (ret)
- pr_err("%s: TDM TLMM pinctrl set failed with %d\n",
- __func__, ret);
- }
-}
-
-static struct snd_soc_ops sdm845_tdm_be_ops = {
- .hw_params = sdm845_tdm_snd_hw_params,
- .startup = sdm845_tdm_snd_startup,
- .shutdown = sdm845_tdm_snd_shutdown
-};
-
-static int msm_fe_qos_prepare(struct snd_pcm_substream *substream)
-{
- cpumask_t mask;
-
- if (pm_qos_request_active(&substream->latency_pm_qos_req))
- pm_qos_remove_request(&substream->latency_pm_qos_req);
-
- cpumask_clear(&mask);
- cpumask_set_cpu(1, &mask); /* affine to core 1 */
- cpumask_set_cpu(2, &mask); /* affine to core 2 */
- cpumask_copy(&substream->latency_pm_qos_req.cpus_affine, &mask);
-
- substream->latency_pm_qos_req.type = PM_QOS_REQ_AFFINE_CORES;
-
- pm_qos_add_request(&substream->latency_pm_qos_req,
- PM_QOS_CPU_DMA_LATENCY,
- MSM_LL_QOS_VALUE);
- return 0;
-}
-
-static struct snd_soc_ops msm_fe_qos_ops = {
- .prepare = msm_fe_qos_prepare,
-};
-
-static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
-{
- int ret = 0;
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- int index = cpu_dai->id;
- unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS;
- struct snd_soc_card *card = rtd->card;
- struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
- struct msm_pinctrl_info *pinctrl_info = &pdata->pinctrl_info;
- int ret_pinctrl = 0;
-
- dev_dbg(rtd->card->dev,
- "%s: substream = %s stream = %d, dai name %s, dai ID %d\n",
- __func__, substream->name, substream->stream,
- cpu_dai->name, cpu_dai->id);
-
- if (index < PRIM_MI2S || index > QUAT_MI2S) {
- ret = -EINVAL;
- dev_err(rtd->card->dev,
- "%s: CPU DAI id (%d) out of range\n",
- __func__, cpu_dai->id);
- goto err;
- }
- if (index == QUAT_MI2S) {
- ret_pinctrl = msm_set_pinctrl(pinctrl_info, STATE_MI2S_ACTIVE);
- if (ret_pinctrl)
- pr_err("%s: MI2S TLMM pinctrl set failed with %d\n",
- __func__, ret_pinctrl);
- }
- /*
- * Muxtex protection in case the same MI2S
- * interface using for both TX and RX so
- * that the same clock won't be enable twice.
- */
- mutex_lock(&mi2s_intf_conf[index].lock);
- if (++mi2s_intf_conf[index].ref_cnt == 1) {
- /* Check if msm needs to provide the clock to the interface */
- if (!mi2s_intf_conf[index].msm_is_mi2s_master) {
- mi2s_clk[index].clk_id = mi2s_ebit_clk[index];
- fmt = SND_SOC_DAIFMT_CBM_CFM;
- }
- ret = msm_mi2s_set_sclk(substream, true);
- if (ret < 0) {
- dev_err(rtd->card->dev,
- "%s: afe lpass clock failed to enable MI2S clock, err:%d\n",
- __func__, ret);
- goto clean_up;
- }
-
- ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
- if (ret < 0) {
- pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n",
- __func__, index, ret);
- goto clk_off;
- }
- }
-clk_off:
- if (ret < 0)
- msm_mi2s_set_sclk(substream, false);
-clean_up:
- if (ret < 0)
- mi2s_intf_conf[index].ref_cnt--;
- mutex_unlock(&mi2s_intf_conf[index].lock);
-err:
- return ret;
-}
-
-static void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream)
-{
- int ret;
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- int index = rtd->cpu_dai->id;
- struct snd_soc_card *card = rtd->card;
- struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
- struct msm_pinctrl_info *pinctrl_info = &pdata->pinctrl_info;
- int ret_pinctrl = 0;
-
- pr_debug("%s(): substream = %s stream = %d\n", __func__,
- substream->name, substream->stream);
- if (index < PRIM_MI2S || index > QUAT_MI2S) {
- pr_err("%s:invalid MI2S DAI(%d)\n", __func__, index);
- return;
- }
-
- mutex_lock(&mi2s_intf_conf[index].lock);
- if (--mi2s_intf_conf[index].ref_cnt == 0) {
- ret = msm_mi2s_set_sclk(substream, false);
- if (ret < 0)
- pr_err("%s:clock disable failed for MI2S (%d); ret=%d\n",
- __func__, index, ret);
- }
- mutex_unlock(&mi2s_intf_conf[index].lock);
-
- if (index == QUAT_MI2S) {
- ret_pinctrl = msm_set_pinctrl(pinctrl_info, STATE_DISABLE);
- if (ret_pinctrl)
- pr_err("%s: MI2S TLMM pinctrl set failed with %d\n",
- __func__, ret_pinctrl);
- }
-}
-
-static struct snd_soc_ops msm_mi2s_be_ops = {
- .startup = msm_mi2s_snd_startup,
- .shutdown = msm_mi2s_snd_shutdown,
-};
-
-static struct snd_soc_ops msm_be_ops = {
- .hw_params = msm_snd_hw_params,
-};
-
-static struct snd_soc_ops msm_slimbus_2_be_ops = {
- .hw_params = msm_slimbus_2_hw_params,
-};
-
-static struct snd_soc_ops msm_wcn_ops = {
- .hw_params = msm_wcn_hw_params,
-};
-
-
-/* Digital audio interface glue - connects codec <---> CPU */
-static struct snd_soc_dai_link msm_common_dai_links[] = {
- /* FrontEnd DAI Links */
- {
- .name = MSM_DAILINK_NAME(Media1),
- .stream_name = "MultiMedia1",
- .cpu_dai_name = "MultiMedia1",
- .platform_name = "msm-pcm-dsp.0",
- .dynamic = 1,
- .async_ops = ASYNC_DPCM_SND_SOC_PREPARE,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- /* this dainlink has playback support */
- .ignore_pmdown_time = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA1
- },
- {
- .name = MSM_DAILINK_NAME(Media2),
- .stream_name = "MultiMedia2",
- .cpu_dai_name = "MultiMedia2",
- .platform_name = "msm-pcm-dsp.0",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .ignore_suspend = 1,
- /* this dainlink has playback support */
- .ignore_pmdown_time = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA2,
- },
- {
- .name = "VoiceMMode1",
- .stream_name = "VoiceMMode1",
- .cpu_dai_name = "VoiceMMode1",
- .platform_name = "msm-pcm-voice",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_VOICEMMODE1,
- },
- {
- .name = "MSM VoIP",
- .stream_name = "VoIP",
- .cpu_dai_name = "VoIP",
- .platform_name = "msm-voip-dsp",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- /* this dainlink has playback support */
- .ignore_pmdown_time = 1,
- .id = MSM_FRONTEND_DAI_VOIP,
- },
- {
- .name = MSM_DAILINK_NAME(ULL),
- .stream_name = "MultiMedia3",
- .cpu_dai_name = "MultiMedia3",
- .platform_name = "msm-pcm-dsp.2",
- .dynamic = 1,
- .async_ops = ASYNC_DPCM_SND_SOC_PREPARE,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- /* this dainlink has playback support */
- .ignore_pmdown_time = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA3,
- },
- /* Hostless PCM purpose */
- {
- .name = "SLIMBUS_0 Hostless",
- .stream_name = "SLIMBUS_0 Hostless",
- .cpu_dai_name = "SLIMBUS0_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- /* this dailink has playback support */
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {
- .name = "MSM AFE-PCM RX",
- .stream_name = "AFE-PROXY RX",
- .cpu_dai_name = "msm-dai-q6-dev.241",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .platform_name = "msm-pcm-afe",
- .dpcm_playback = 1,
- .ignore_suspend = 1,
- /* this dainlink has playback support */
- .ignore_pmdown_time = 1,
- },
- {
- .name = "MSM AFE-PCM TX",
- .stream_name = "AFE-PROXY TX",
- .cpu_dai_name = "msm-dai-q6-dev.240",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .platform_name = "msm-pcm-afe",
- .dpcm_capture = 1,
- .ignore_suspend = 1,
- },
- {
- .name = MSM_DAILINK_NAME(Compress1),
- .stream_name = "Compress1",
- .cpu_dai_name = "MultiMedia4",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .async_ops = ASYNC_DPCM_SND_SOC_HW_PARAMS,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dainlink has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA4,
- },
- {
- .name = "AUXPCM Hostless",
- .stream_name = "AUXPCM Hostless",
- .cpu_dai_name = "AUXPCM_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- /* this dainlink has playback support */
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {
- .name = "SLIMBUS_1 Hostless",
- .stream_name = "SLIMBUS_1 Hostless",
- .cpu_dai_name = "SLIMBUS1_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- /* this dailink has playback support */
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {
- .name = "SLIMBUS_3 Hostless",
- .stream_name = "SLIMBUS_3 Hostless",
- .cpu_dai_name = "SLIMBUS3_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- /* this dailink has playback support */
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {
- .name = "SLIMBUS_4 Hostless",
- .stream_name = "SLIMBUS_4 Hostless",
- .cpu_dai_name = "SLIMBUS4_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- /* this dailink has playback support */
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {
- .name = MSM_DAILINK_NAME(LowLatency),
- .stream_name = "MultiMedia5",
- .cpu_dai_name = "MultiMedia5",
- .platform_name = "msm-pcm-dsp.1",
- .dynamic = 1,
- .async_ops = ASYNC_DPCM_SND_SOC_PREPARE,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .ignore_suspend = 1,
- /* this dainlink has playback support */
- .ignore_pmdown_time = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA5,
- .ops = &msm_fe_qos_ops,
- },
- {
- .name = "Listen 1 Audio Service",
- .stream_name = "Listen 1 Audio Service",
- .cpu_dai_name = "LSM1",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = { SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM1,
- },
- /* Multiple Tunnel instances */
- {
- .name = MSM_DAILINK_NAME(Compress2),
- .stream_name = "Compress2",
- .cpu_dai_name = "MultiMedia7",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dainlink has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA7,
- },
- {
- .name = MSM_DAILINK_NAME(MultiMedia10),
- .stream_name = "MultiMedia10",
- .cpu_dai_name = "MultiMedia10",
- .platform_name = "msm-pcm-dsp.1",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dainlink has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA10,
- },
- {
- .name = MSM_DAILINK_NAME(ULL_NOIRQ),
- .stream_name = "MM_NOIRQ",
- .cpu_dai_name = "MultiMedia8",
- .platform_name = "msm-pcm-dsp-noirq",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dainlink has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA8,
- .ops = &msm_fe_qos_ops,
- },
- /* HDMI Hostless */
- {
- .name = "HDMI_RX_HOSTLESS",
- .stream_name = "HDMI_RX_HOSTLESS",
- .cpu_dai_name = "HDMI_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
- {
- .name = "VoiceMMode2",
- .stream_name = "VoiceMMode2",
- .cpu_dai_name = "VoiceMMode2",
- .platform_name = "msm-pcm-voice",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_VOICEMMODE2,
- },
- /* LSM FE */
- {
- .name = "Listen 2 Audio Service",
- .stream_name = "Listen 2 Audio Service",
- .cpu_dai_name = "LSM2",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = { SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM2,
- },
- {
- .name = "Listen 3 Audio Service",
- .stream_name = "Listen 3 Audio Service",
- .cpu_dai_name = "LSM3",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = { SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM3,
- },
- {
- .name = "Listen 4 Audio Service",
- .stream_name = "Listen 4 Audio Service",
- .cpu_dai_name = "LSM4",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = { SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM4,
- },
- {
- .name = "Listen 5 Audio Service",
- .stream_name = "Listen 5 Audio Service",
- .cpu_dai_name = "LSM5",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = { SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM5,
- },
- {
- .name = "Listen 6 Audio Service",
- .stream_name = "Listen 6 Audio Service",
- .cpu_dai_name = "LSM6",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = { SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM6,
- },
- {
- .name = "Listen 7 Audio Service",
- .stream_name = "Listen 7 Audio Service",
- .cpu_dai_name = "LSM7",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = { SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM7,
- },
- {
- .name = "Listen 8 Audio Service",
- .stream_name = "Listen 8 Audio Service",
- .cpu_dai_name = "LSM8",
- .platform_name = "msm-lsm-client",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = { SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST },
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .id = MSM_FRONTEND_DAI_LSM8,
- },
- {
- .name = MSM_DAILINK_NAME(Media9),
- .stream_name = "MultiMedia9",
- .cpu_dai_name = "MultiMedia9",
- .platform_name = "msm-pcm-dsp.0",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- /* this dainlink has playback support */
- .ignore_pmdown_time = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA9,
- },
- {
- .name = MSM_DAILINK_NAME(Compress4),
- .stream_name = "Compress4",
- .cpu_dai_name = "MultiMedia11",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dainlink has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA11,
- },
- {
- .name = MSM_DAILINK_NAME(Compress5),
- .stream_name = "Compress5",
- .cpu_dai_name = "MultiMedia12",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dainlink has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA12,
- },
- {
- .name = MSM_DAILINK_NAME(Compress6),
- .stream_name = "Compress6",
- .cpu_dai_name = "MultiMedia13",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dainlink has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA13,
- },
- {
- .name = MSM_DAILINK_NAME(Compress7),
- .stream_name = "Compress7",
- .cpu_dai_name = "MultiMedia14",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dainlink has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA14,
- },
- {
- .name = MSM_DAILINK_NAME(Compress8),
- .stream_name = "Compress8",
- .cpu_dai_name = "MultiMedia15",
- .platform_name = "msm-compress-dsp",
- .dynamic = 1,
- .dpcm_playback = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dainlink has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA15,
- },
- {
- .name = MSM_DAILINK_NAME(ULL_NOIRQ_2),
- .stream_name = "MM_NOIRQ_2",
- .cpu_dai_name = "MultiMedia16",
- .platform_name = "msm-pcm-dsp-noirq",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- /* this dainlink has playback support */
- .id = MSM_FRONTEND_DAI_MULTIMEDIA16,
- },
- {
- .name = "SLIMBUS_8 Hostless",
- .stream_name = "SLIMBUS8_HOSTLESS Capture",
- .cpu_dai_name = "SLIMBUS8_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
-};
-
-static struct snd_soc_dai_link msm_tavil_fe_dai_links[] = {
- {
- .name = LPASS_BE_SLIMBUS_4_TX,
- .stream_name = "Slimbus4 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16393",
- .platform_name = "msm-pcm-hostless",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_vifeedback",
- .id = MSM_BACKEND_DAI_SLIMBUS_4_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- },
- /* Ultrasound RX DAI Link */
- {
- .name = "SLIMBUS_2 Hostless Playback",
- .stream_name = "SLIMBUS_2 Hostless Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16388",
- .platform_name = "msm-pcm-hostless",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_rx2",
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ops = &msm_slimbus_2_be_ops,
- },
- /* Ultrasound TX DAI Link */
- {
- .name = "SLIMBUS_2 Hostless Capture",
- .stream_name = "SLIMBUS_2 Hostless Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16389",
- .platform_name = "msm-pcm-hostless",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_tx2",
- .ignore_suspend = 1,
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ops = &msm_slimbus_2_be_ops,
- },
-};
-
-static struct snd_soc_dai_link msm_common_misc_fe_dai_links[] = {
- {
- .name = MSM_DAILINK_NAME(ASM Loopback),
- .stream_name = "MultiMedia6",
- .cpu_dai_name = "MultiMedia6",
- .platform_name = "msm-pcm-loopback",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .ignore_suspend = 1,
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_pmdown_time = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA6,
- },
- {
- .name = "USB Audio Hostless",
- .stream_name = "USB Audio Hostless",
- .cpu_dai_name = "USBAUDIO_HOSTLESS",
- .platform_name = "msm-pcm-hostless",
- .dynamic = 1,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- },
-};
-
-static struct snd_soc_dai_link msm_common_be_dai_links[] = {
- /* Backend AFE DAI Links */
- {
- .name = LPASS_BE_AFE_PCM_RX,
- .stream_name = "AFE Playback",
- .cpu_dai_name = "msm-dai-q6-dev.224",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_AFE_PCM_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- /* this dainlink has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_AFE_PCM_TX,
- .stream_name = "AFE Capture",
- .cpu_dai_name = "msm-dai-q6-dev.225",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_AFE_PCM_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_suspend = 1,
- },
- /* Incall Record Uplink BACK END DAI Link */
- {
- .name = LPASS_BE_INCALL_RECORD_TX,
- .stream_name = "Voice Uplink Capture",
- .cpu_dai_name = "msm-dai-q6-dev.32772",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_INCALL_RECORD_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_suspend = 1,
- },
- /* Incall Record Downlink BACK END DAI Link */
- {
- .name = LPASS_BE_INCALL_RECORD_RX,
- .stream_name = "Voice Downlink Capture",
- .cpu_dai_name = "msm-dai-q6-dev.32771",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_INCALL_RECORD_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_suspend = 1,
- },
- /* Incall Music BACK END DAI Link */
- {
- .name = LPASS_BE_VOICE_PLAYBACK_TX,
- .stream_name = "Voice Farend Playback",
- .cpu_dai_name = "msm-dai-q6-dev.32773",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_VOICE_PLAYBACK_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_suspend = 1,
- },
- /* Incall Music 2 BACK END DAI Link */
- {
- .name = LPASS_BE_VOICE2_PLAYBACK_TX,
- .stream_name = "Voice2 Farend Playback",
- .cpu_dai_name = "msm-dai-q6-dev.32770",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_VOICE2_PLAYBACK_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_USB_AUDIO_RX,
- .stream_name = "USB Audio Playback",
- .cpu_dai_name = "msm-dai-q6-dev.28672",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_USB_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_USB_AUDIO_TX,
- .stream_name = "USB Audio Capture",
- .cpu_dai_name = "msm-dai-q6-dev.28673",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_USB_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_PRI_TDM_RX_0,
- .stream_name = "Primary TDM0 Playback",
- .cpu_dai_name = "msm-dai-q6-tdm.36864",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_PRI_TDM_RX_0,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &sdm845_tdm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_PRI_TDM_TX_0,
- .stream_name = "Primary TDM0 Capture",
- .cpu_dai_name = "msm-dai-q6-tdm.36865",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_PRI_TDM_TX_0,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &sdm845_tdm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SEC_TDM_RX_0,
- .stream_name = "Secondary TDM0 Playback",
- .cpu_dai_name = "msm-dai-q6-tdm.36880",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SEC_TDM_RX_0,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &sdm845_tdm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SEC_TDM_TX_0,
- .stream_name = "Secondary TDM0 Capture",
- .cpu_dai_name = "msm-dai-q6-tdm.36881",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SEC_TDM_TX_0,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &sdm845_tdm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_TERT_TDM_RX_0,
- .stream_name = "Tertiary TDM0 Playback",
- .cpu_dai_name = "msm-dai-q6-tdm.36896",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_TERT_TDM_RX_0,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &sdm845_tdm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_TERT_TDM_TX_0,
- .stream_name = "Tertiary TDM0 Capture",
- .cpu_dai_name = "msm-dai-q6-tdm.36897",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_TERT_TDM_TX_0,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &sdm845_tdm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_QUAT_TDM_RX_0,
- .stream_name = "Quaternary TDM0 Playback",
- .cpu_dai_name = "msm-dai-q6-tdm.36912",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_QUAT_TDM_RX_0,
- .be_hw_params_fixup = msm_tdm_be_hw_params_fixup,
- .ops = &sdm845_tdm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_QUAT_TDM_TX_0,
- .stream_name = "Quaternary TDM0 Capture",
- .cpu_dai_name = "msm-dai-q6-tdm.36913",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_QUAT_TDM_TX_0,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &sdm845_tdm_be_ops,
- .ignore_suspend = 1,
- },
-};
-
-static struct snd_soc_dai_link msm_tavil_be_dai_links[] = {
- {
- .name = LPASS_BE_SLIMBUS_0_RX,
- .stream_name = "Slimbus Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16384",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_rx1",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_0_RX,
- .init = &msm_audrx_init,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- /* this dainlink has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- .ops = &msm_be_ops,
- },
- {
- .name = LPASS_BE_SLIMBUS_0_TX,
- .stream_name = "Slimbus Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16385",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_tx1",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_0_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_suspend = 1,
- .ops = &msm_be_ops,
- },
- {
- .name = LPASS_BE_SLIMBUS_1_RX,
- .stream_name = "Slimbus1 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16386",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_rx1",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_1_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- /* dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_1_TX,
- .stream_name = "Slimbus1 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16387",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_tx3",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_1_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_2_RX,
- .stream_name = "Slimbus2 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16388",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_rx2",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_2_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_3_RX,
- .stream_name = "Slimbus3 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16390",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_rx1",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_3_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- /* dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_3_TX,
- .stream_name = "Slimbus3 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16391",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_tx1",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_3_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_4_RX,
- .stream_name = "Slimbus4 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16392",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_rx1",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_4_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- /* dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_5_RX,
- .stream_name = "Slimbus5 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16394",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_rx3",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_5_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- /* dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- /* MAD BE */
- {
- .name = LPASS_BE_SLIMBUS_5_TX,
- .stream_name = "Slimbus5 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16395",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_mad1",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_5_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_6_RX,
- .stream_name = "Slimbus6 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16396",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_rx4",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_6_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- /* dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- /* Slimbus VI Recording */
- {
- .name = LPASS_BE_SLIMBUS_TX_VI,
- .stream_name = "Slimbus4 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16393",
- .platform_name = "msm-pcm-routing",
- .codec_name = "tavil_codec",
- .codec_dai_name = "tavil_vifeedback",
- .id = MSM_BACKEND_DAI_SLIMBUS_4_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_be_ops,
- .ignore_suspend = 1,
- .no_pcm = 1,
- .dpcm_capture = 1,
- .ignore_pmdown_time = 1,
- },
-};
-
-static struct snd_soc_dai_link msm_wcn_be_dai_links[] = {
- {
- .name = LPASS_BE_SLIMBUS_7_RX,
- .stream_name = "Slimbus7 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16398",
- .platform_name = "msm-pcm-routing",
- .codec_name = "btfmslim_slave",
- /* BT codec driver determines capabilities based on
- * dai name, bt codecdai name should always contains
- * supported usecase information
- */
- .codec_dai_name = "btfm_bt_sco_a2dp_slim_rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_7_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_wcn_ops,
- /* dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_7_TX,
- .stream_name = "Slimbus7 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16399",
- .platform_name = "msm-pcm-routing",
- .codec_name = "btfmslim_slave",
- .codec_dai_name = "btfm_bt_sco_slim_tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_7_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_wcn_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_8_TX,
- .stream_name = "Slimbus8 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16401",
- .platform_name = "msm-pcm-routing",
- .codec_name = "btfmslim_slave",
- .codec_dai_name = "btfm_fm_slim_tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_8_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .init = &msm_wcn_init,
- .ops = &msm_wcn_ops,
- .ignore_suspend = 1,
- },
-};
-
-static struct snd_soc_dai_link ext_disp_be_dai_link[] = {
- /* DISP PORT BACK END DAI Link */
- {
- .name = LPASS_BE_DISPLAY_PORT,
- .stream_name = "Display Port Playback",
- .cpu_dai_name = "msm-dai-q6-dp.24608",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-ext-disp-audio-codec-rx",
- .codec_dai_name = "msm_dp_audio_codec_rx_dai",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_DISPLAY_PORT_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
-};
-
-static struct snd_soc_dai_link msm_mi2s_be_dai_links[] = {
- {
- .name = LPASS_BE_PRI_MI2S_RX,
- .stream_name = "Primary MI2S Playback",
- .cpu_dai_name = "msm-dai-q6-mi2s.0",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_PRI_MI2S_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- {
- .name = LPASS_BE_PRI_MI2S_TX,
- .stream_name = "Primary MI2S Capture",
- .cpu_dai_name = "msm-dai-q6-mi2s.0",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_PRI_MI2S_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SEC_MI2S_RX,
- .stream_name = "Secondary MI2S Playback",
- .cpu_dai_name = "msm-dai-q6-mi2s.1",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SECONDARY_MI2S_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- {
- .name = LPASS_BE_SEC_MI2S_TX,
- .stream_name = "Secondary MI2S Capture",
- .cpu_dai_name = "msm-dai-q6-mi2s.1",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SECONDARY_MI2S_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_TERT_MI2S_RX,
- .stream_name = "Tertiary MI2S Playback",
- .cpu_dai_name = "msm-dai-q6-mi2s.2",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_TERTIARY_MI2S_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- {
- .name = LPASS_BE_TERT_MI2S_TX,
- .stream_name = "Tertiary MI2S Capture",
- .cpu_dai_name = "msm-dai-q6-mi2s.2",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_TERTIARY_MI2S_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_QUAT_MI2S_RX,
- .stream_name = "Quaternary MI2S Playback",
- .cpu_dai_name = "msm-dai-q6-mi2s.3",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_QUATERNARY_MI2S_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- {
- .name = LPASS_BE_QUAT_MI2S_TX,
- .stream_name = "Quaternary MI2S Capture",
- .cpu_dai_name = "msm-dai-q6-mi2s.3",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_QUATERNARY_MI2S_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ops = &msm_mi2s_be_ops,
- .ignore_suspend = 1,
- },
-};
-
-static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = {
- /* Primary AUX PCM Backend DAI Links */
- {
- .name = LPASS_BE_AUXPCM_RX,
- .stream_name = "AUX PCM Playback",
- .cpu_dai_name = "msm-dai-q6-auxpcm.1",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_AUXPCM_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_AUXPCM_TX,
- .stream_name = "AUX PCM Capture",
- .cpu_dai_name = "msm-dai-q6-auxpcm.1",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_AUXPCM_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- /* Secondary AUX PCM Backend DAI Links */
- {
- .name = LPASS_BE_SEC_AUXPCM_RX,
- .stream_name = "Sec AUX PCM Playback",
- .cpu_dai_name = "msm-dai-q6-auxpcm.2",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SEC_AUXPCM_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SEC_AUXPCM_TX,
- .stream_name = "Sec AUX PCM Capture",
- .cpu_dai_name = "msm-dai-q6-auxpcm.2",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SEC_AUXPCM_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- /* Tertiary AUX PCM Backend DAI Links */
- {
- .name = LPASS_BE_TERT_AUXPCM_RX,
- .stream_name = "Tert AUX PCM Playback",
- .cpu_dai_name = "msm-dai-q6-auxpcm.3",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_TERT_AUXPCM_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_TERT_AUXPCM_TX,
- .stream_name = "Tert AUX PCM Capture",
- .cpu_dai_name = "msm-dai-q6-auxpcm.3",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_TERT_AUXPCM_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
- /* Quaternary AUX PCM Backend DAI Links */
- {
- .name = LPASS_BE_QUAT_AUXPCM_RX,
- .stream_name = "Quat AUX PCM Playback",
- .cpu_dai_name = "msm-dai-q6-auxpcm.4",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_QUAT_AUXPCM_RX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_QUAT_AUXPCM_TX,
- .stream_name = "Quat AUX PCM Capture",
- .cpu_dai_name = "msm-dai-q6-auxpcm.4",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_QUAT_AUXPCM_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_suspend = 1,
- .ignore_pmdown_time = 1,
- },
-};
-
-static struct snd_soc_dai_link msm_tavil_snd_card_dai_links[
- ARRAY_SIZE(msm_common_dai_links) +
- ARRAY_SIZE(msm_tavil_fe_dai_links) +
- ARRAY_SIZE(msm_common_misc_fe_dai_links) +
- ARRAY_SIZE(msm_common_be_dai_links) +
- ARRAY_SIZE(msm_tavil_be_dai_links) +
- ARRAY_SIZE(msm_wcn_be_dai_links) +
- ARRAY_SIZE(ext_disp_be_dai_link) +
- ARRAY_SIZE(msm_mi2s_be_dai_links) +
- ARRAY_SIZE(msm_auxpcm_be_dai_links)];
-
-static int msm_snd_card_tavil_late_probe(struct snd_soc_card *card)
-{
- const char *be_dl_name = LPASS_BE_SLIMBUS_0_RX;
- struct snd_soc_pcm_runtime *rtd;
- int ret = 0;
- void *mbhc_calibration;
-
- rtd = snd_soc_get_pcm_runtime(card, be_dl_name);
- if (!rtd) {
- dev_err(card->dev,
- "%s: snd_soc_get_pcm_runtime for %s failed!\n",
- __func__, be_dl_name);
- ret = -EINVAL;
- goto err;
- }
-
- mbhc_calibration = def_tavil_mbhc_cal();
- if (!mbhc_calibration) {
- ret = -ENOMEM;
- goto err;
- }
- wcd_mbhc_cfg.calibration = mbhc_calibration;
- ret = tavil_mbhc_hs_detect(rtd->codec, &wcd_mbhc_cfg);
- if (ret) {
- dev_err(card->dev, "%s: mbhc hs detect failed, err:%d\n",
- __func__, ret);
- goto err_free_mbhc_cal;
- }
- return 0;
-
-err_free_mbhc_cal:
- kfree(mbhc_calibration);
-err:
- return ret;
-}
-
-struct snd_soc_card snd_soc_card_tavil_msm = {
- .name = "sdm845-tavil-snd-card",
- .late_probe = msm_snd_card_tavil_late_probe,
-};
-
-static int msm_populate_dai_link_component_of_node(
- struct snd_soc_card *card)
-{
- int i, index, ret = 0;
- struct device *cdev = card->dev;
- struct snd_soc_dai_link *dai_link = card->dai_link;
- struct device_node *np;
-
- if (!cdev) {
- pr_err("%s: Sound card device memory NULL\n", __func__);
- return -ENODEV;
- }
-
- for (i = 0; i < card->num_links; i++) {
- if (dai_link[i].platform_of_node && dai_link[i].cpu_of_node)
- continue;
-
- /* populate platform_of_node for snd card dai links */
- if (dai_link[i].platform_name &&
- !dai_link[i].platform_of_node) {
- index = of_property_match_string(cdev->of_node,
- "asoc-platform-names",
- dai_link[i].platform_name);
- if (index < 0) {
- pr_err("%s: No match found for platform name: %s\n",
- __func__, dai_link[i].platform_name);
- ret = index;
- goto err;
- }
- np = of_parse_phandle(cdev->of_node, "asoc-platform",
- index);
- if (!np) {
- pr_err("%s: retrieving phandle for platform %s, index %d failed\n",
- __func__, dai_link[i].platform_name,
- index);
- ret = -ENODEV;
- goto err;
- }
- dai_link[i].platform_of_node = np;
- dai_link[i].platform_name = NULL;
- }
-
- /* populate cpu_of_node for snd card dai links */
- if (dai_link[i].cpu_dai_name && !dai_link[i].cpu_of_node) {
- index = of_property_match_string(cdev->of_node,
- "asoc-cpu-names",
- dai_link[i].cpu_dai_name);
- if (index >= 0) {
- np = of_parse_phandle(cdev->of_node, "asoc-cpu",
- index);
- if (!np) {
- pr_err("%s: retrieving phandle for cpu dai %s failed\n",
- __func__,
- dai_link[i].cpu_dai_name);
- ret = -ENODEV;
- goto err;
- }
- dai_link[i].cpu_of_node = np;
- dai_link[i].cpu_dai_name = NULL;
- }
- }
-
- /* populate codec_of_node for snd card dai links */
- if (dai_link[i].codec_name && !dai_link[i].codec_of_node) {
- index = of_property_match_string(cdev->of_node,
- "asoc-codec-names",
- dai_link[i].codec_name);
- if (index < 0)
- continue;
- np = of_parse_phandle(cdev->of_node, "asoc-codec",
- index);
- if (!np) {
- pr_err("%s: retrieving phandle for codec %s failed\n",
- __func__, dai_link[i].codec_name);
- ret = -ENODEV;
- goto err;
- }
- dai_link[i].codec_of_node = np;
- dai_link[i].codec_name = NULL;
- }
- }
-
-err:
- return ret;
-}
-
-static int msm_prepare_us_euro(struct snd_soc_card *card)
-{
- struct msm_asoc_mach_data *pdata =
- snd_soc_card_get_drvdata(card);
- int ret = 0;
-
- if (pdata->us_euro_gpio >= 0) {
- dev_dbg(card->dev, "%s: us_euro gpio request %d", __func__,
- pdata->us_euro_gpio);
- ret = gpio_request(pdata->us_euro_gpio, "TAVIL_CODEC_US_EURO");
- if (ret) {
- dev_err(card->dev,
- "%s: Failed to request codec US/EURO gpio %d error %d\n",
- __func__, pdata->us_euro_gpio, ret);
- }
- }
-
- return ret;
-}
-
-static int msm_audrx_stub_init(struct snd_soc_pcm_runtime *rtd)
-{
- int ret = 0;
- struct snd_soc_codec *codec = rtd->codec;
- struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
-
- ret = snd_soc_add_codec_controls(codec, msm_snd_controls,
- ARRAY_SIZE(msm_snd_controls));
- if (ret < 0) {
- dev_err(codec->dev,
- "%s: add_codec_controls failed, err = %d\n",
- __func__, ret);
- return ret;
- }
-
- snd_soc_dapm_new_controls(dapm, msm_dapm_widgets,
- ARRAY_SIZE(msm_dapm_widgets));
-
- return 0;
-}
-
-static int msm_snd_stub_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
-
- int ret = 0;
- unsigned int rx_ch[] = {144, 145, 146, 147, 148, 149, 150,
- 151};
- unsigned int tx_ch[] = {128, 129, 130, 131, 132, 133,
- 134, 135, 136, 137, 138, 139,
- 140, 141, 142, 143};
-
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
- ret = snd_soc_dai_set_channel_map(cpu_dai, 0, 0,
- slim_rx_cfg[0].channels,
- rx_ch);
- if (ret < 0)
- pr_err("%s: RX failed to set cpu chan map error %d\n",
- __func__, ret);
- } else {
- ret = snd_soc_dai_set_channel_map(cpu_dai,
- slim_tx_cfg[0].channels,
- tx_ch, 0, 0);
- if (ret < 0)
- pr_err("%s: TX failed to set cpu chan map error %d\n",
- __func__, ret);
- }
-
- return ret;
-}
-
-static struct snd_soc_ops msm_stub_be_ops = {
- .hw_params = msm_snd_stub_hw_params,
-};
-
-static struct snd_soc_dai_link msm_stub_fe_dai_links[] = {
-
- /* FrontEnd DAI Links */
- {
- .name = "MSMSTUB Media1",
- .stream_name = "MultiMedia1",
- .cpu_dai_name = "MultiMedia1",
- .platform_name = "msm-pcm-dsp.0",
- .dynamic = 1,
- .async_ops = ASYNC_DPCM_SND_SOC_PREPARE,
- .dpcm_playback = 1,
- .dpcm_capture = 1,
- .trigger = {SND_SOC_DPCM_TRIGGER_POST,
- SND_SOC_DPCM_TRIGGER_POST},
- .codec_dai_name = "snd-soc-dummy-dai",
- .codec_name = "snd-soc-dummy",
- .ignore_suspend = 1,
- /* this dainlink has playback support */
- .ignore_pmdown_time = 1,
- .id = MSM_FRONTEND_DAI_MULTIMEDIA1
- },
-};
-
-static struct snd_soc_dai_link msm_stub_be_dai_links[] = {
-
- /* Backend DAI Links */
- {
- .name = LPASS_BE_SLIMBUS_0_RX,
- .stream_name = "Slimbus Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16384",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .no_pcm = 1,
- .dpcm_playback = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_0_RX,
- .init = &msm_audrx_stub_init,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_pmdown_time = 1, /* dai link has playback support */
- .ignore_suspend = 1,
- .ops = &msm_stub_be_ops,
- },
- {
- .name = LPASS_BE_SLIMBUS_0_TX,
- .stream_name = "Slimbus Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16385",
- .platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
- .no_pcm = 1,
- .dpcm_capture = 1,
- .id = MSM_BACKEND_DAI_SLIMBUS_0_TX,
- .be_hw_params_fixup = msm_be_hw_params_fixup,
- .ignore_suspend = 1,
- .ops = &msm_stub_be_ops,
- },
-};
-
-static struct snd_soc_dai_link msm_stub_dai_links[
- ARRAY_SIZE(msm_stub_fe_dai_links) +
- ARRAY_SIZE(msm_stub_be_dai_links)];
-
-struct snd_soc_card snd_soc_card_stub_msm = {
- .name = "sdm845-stub-snd-card",
-};
-
-static const struct of_device_id sdm845_asoc_machine_of_match[] = {
- { .compatible = "qcom,sdm845-asoc-snd-tavil",
- .data = "tavil_codec"},
- { .compatible = "qcom,sdm845-asoc-snd-stub",
- .data = "stub_codec"},
- {},
-};
-
-static struct snd_soc_card *populate_snd_card_dailinks(struct device *dev)
-{
- struct snd_soc_card *card = NULL;
- struct snd_soc_dai_link *dailink;
- int len_1, len_2, len_3, len_4;
- int total_links;
- const struct of_device_id *match;
-
- match = of_match_node(sdm845_asoc_machine_of_match, dev->of_node);
- if (!match) {
- dev_err(dev, "%s: No DT match found for sound card\n",
- __func__);
- return NULL;
- }
-
- if (!strcmp(match->data, "tavil_codec")) {
- card = &snd_soc_card_tavil_msm;
- len_1 = ARRAY_SIZE(msm_common_dai_links);
- len_2 = len_1 + ARRAY_SIZE(msm_tavil_fe_dai_links);
- len_3 = len_2 + ARRAY_SIZE(msm_common_misc_fe_dai_links);
- len_4 = len_3 + ARRAY_SIZE(msm_common_be_dai_links);
- total_links = len_4 + ARRAY_SIZE(msm_tavil_be_dai_links);
- memcpy(msm_tavil_snd_card_dai_links,
- msm_common_dai_links,
- sizeof(msm_common_dai_links));
- memcpy(msm_tavil_snd_card_dai_links + len_1,
- msm_tavil_fe_dai_links,
- sizeof(msm_tavil_fe_dai_links));
- memcpy(msm_tavil_snd_card_dai_links + len_2,
- msm_common_misc_fe_dai_links,
- sizeof(msm_common_misc_fe_dai_links));
- memcpy(msm_tavil_snd_card_dai_links + len_3,
- msm_common_be_dai_links,
- sizeof(msm_common_be_dai_links));
- memcpy(msm_tavil_snd_card_dai_links + len_4,
- msm_tavil_be_dai_links,
- sizeof(msm_tavil_be_dai_links));
-
- if (of_property_read_bool(dev->of_node, "qcom,wcn-btfm")) {
- dev_dbg(dev, "%s(): WCN BTFM support present\n",
- __func__);
- memcpy(msm_tavil_snd_card_dai_links + total_links,
- msm_wcn_be_dai_links,
- sizeof(msm_wcn_be_dai_links));
- total_links += ARRAY_SIZE(msm_wcn_be_dai_links);
- }
-
- if (of_property_read_bool(dev->of_node,
- "qcom,ext-disp-audio-rx")) {
- dev_dbg(dev, "%s(): ext disp audio support present\n",
- __func__);
- memcpy(msm_tavil_snd_card_dai_links + total_links,
- ext_disp_be_dai_link,
- sizeof(ext_disp_be_dai_link));
- total_links += ARRAY_SIZE(ext_disp_be_dai_link);
- }
- if (of_property_read_bool(dev->of_node,
- "qcom,mi2s-audio-intf")) {
- memcpy(msm_tavil_snd_card_dai_links + total_links,
- msm_mi2s_be_dai_links,
- sizeof(msm_mi2s_be_dai_links));
- total_links += ARRAY_SIZE(msm_mi2s_be_dai_links);
- }
- if (of_property_read_bool(dev->of_node,
- "qcom,auxpcm-audio-intf")) {
- memcpy(msm_tavil_snd_card_dai_links + total_links,
- msm_auxpcm_be_dai_links,
- sizeof(msm_auxpcm_be_dai_links));
- total_links += ARRAY_SIZE(msm_auxpcm_be_dai_links);
- }
- dailink = msm_tavil_snd_card_dai_links;
- } else if (!strcmp(match->data, "stub_codec")) {
- card = &snd_soc_card_stub_msm;
- len_1 = ARRAY_SIZE(msm_stub_fe_dai_links);
- len_2 = len_1 + ARRAY_SIZE(msm_stub_be_dai_links);
-
- memcpy(msm_stub_dai_links,
- msm_stub_fe_dai_links,
- sizeof(msm_stub_fe_dai_links));
- memcpy(msm_stub_dai_links + len_1,
- msm_stub_be_dai_links,
- sizeof(msm_stub_be_dai_links));
-
- dailink = msm_stub_dai_links;
- total_links = len_2;
- }
-
- if (card) {
- card->dai_link = dailink;
- card->num_links = total_links;
- }
-
- return card;
-}
-
-static int msm_wsa881x_init(struct snd_soc_component *component)
-{
- u8 spkleft_ports[WSA881X_MAX_SWR_PORTS] = {100, 101, 102, 106};
- u8 spkright_ports[WSA881X_MAX_SWR_PORTS] = {103, 104, 105, 107};
- unsigned int ch_rate[WSA881X_MAX_SWR_PORTS] = {2400, 600, 300, 1200};
- unsigned int ch_mask[WSA881X_MAX_SWR_PORTS] = {0x1, 0xF, 0x3, 0x3};
- struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
- struct msm_asoc_mach_data *pdata;
- struct snd_soc_dapm_context *dapm;
- int ret = 0;
-
- if (!codec) {
- pr_err("%s codec is NULL\n", __func__);
- return -EINVAL;
- }
-
- dapm = snd_soc_codec_get_dapm(codec);
-
- if (!strcmp(component->name_prefix, "SpkrLeft")) {
- dev_dbg(codec->dev, "%s: setting left ch map to codec %s\n",
- __func__, codec->component.name);
- wsa881x_set_channel_map(codec, &spkleft_ports[0],
- WSA881X_MAX_SWR_PORTS, &ch_mask[0],
- &ch_rate[0], NULL);
- if (dapm->component) {
- snd_soc_dapm_ignore_suspend(dapm, "SpkrLeft IN");
- snd_soc_dapm_ignore_suspend(dapm, "SpkrLeft SPKR");
- }
- } else if (!strcmp(component->name_prefix, "SpkrRight")) {
- dev_dbg(codec->dev, "%s: setting right ch map to codec %s\n",
- __func__, codec->component.name);
- wsa881x_set_channel_map(codec, &spkright_ports[0],
- WSA881X_MAX_SWR_PORTS, &ch_mask[0],
- &ch_rate[0], NULL);
- if (dapm->component) {
- snd_soc_dapm_ignore_suspend(dapm, "SpkrRight IN");
- snd_soc_dapm_ignore_suspend(dapm, "SpkrRight SPKR");
- }
- } else {
- dev_err(codec->dev, "%s: wrong codec name %s\n", __func__,
- codec->component.name);
- ret = -EINVAL;
- goto err;
- }
- pdata = snd_soc_card_get_drvdata(component->card);
- if (pdata && pdata->codec_root)
- wsa881x_codec_info_create_codec_entry(pdata->codec_root,
- codec);
-
-err:
- return ret;
-}
-
-static int msm_init_wsa_dev(struct platform_device *pdev,
- struct snd_soc_card *card)
-{
- struct device_node *wsa_of_node;
- u32 wsa_max_devs;
- u32 wsa_dev_cnt;
- int i;
- struct msm_wsa881x_dev_info *wsa881x_dev_info;
- const char *wsa_auxdev_name_prefix[1];
- char *dev_name_str = NULL;
- int found = 0;
- int ret = 0;
-
- /* Get maximum WSA device count for this platform */
- ret = of_property_read_u32(pdev->dev.of_node,
- "qcom,wsa-max-devs", &wsa_max_devs);
- if (ret) {
- dev_info(&pdev->dev,
- "%s: wsa-max-devs property missing in DT %s, ret = %d\n",
- __func__, pdev->dev.of_node->full_name, ret);
- card->num_aux_devs = 0;
- return 0;
- }
- if (wsa_max_devs == 0) {
- dev_warn(&pdev->dev,
- "%s: Max WSA devices is 0 for this target?\n",
- __func__);
- card->num_aux_devs = 0;
- return 0;
- }
-
- /* Get count of WSA device phandles for this platform */
- wsa_dev_cnt = of_count_phandle_with_args(pdev->dev.of_node,
- "qcom,wsa-devs", NULL);
- if (wsa_dev_cnt == -ENOENT) {
- dev_warn(&pdev->dev, "%s: No wsa device defined in DT.\n",
- __func__);
- goto err;
- } else if (wsa_dev_cnt <= 0) {
- dev_err(&pdev->dev,
- "%s: Error reading wsa device from DT. wsa_dev_cnt = %d\n",
- __func__, wsa_dev_cnt);
- ret = -EINVAL;
- goto err;
- }
-
- /*
- * Expect total phandles count to be NOT less than maximum possible
- * WSA count. However, if it is less, then assign same value to
- * max count as well.
- */
- if (wsa_dev_cnt < wsa_max_devs) {
- dev_dbg(&pdev->dev,
- "%s: wsa_max_devs = %d cannot exceed wsa_dev_cnt = %d\n",
- __func__, wsa_max_devs, wsa_dev_cnt);
- wsa_max_devs = wsa_dev_cnt;
- }
-
- /* Make sure prefix string passed for each WSA device */
- ret = of_property_count_strings(pdev->dev.of_node,
- "qcom,wsa-aux-dev-prefix");
- if (ret != wsa_dev_cnt) {
- dev_err(&pdev->dev,
- "%s: expecting %d wsa prefix. Defined only %d in DT\n",
- __func__, wsa_dev_cnt, ret);
- ret = -EINVAL;
- goto err;
- }
-
- /*
- * Alloc mem to store phandle and index info of WSA device, if already
- * registered with ALSA core
- */
- wsa881x_dev_info = devm_kcalloc(&pdev->dev, wsa_max_devs,
- sizeof(struct msm_wsa881x_dev_info),
- GFP_KERNEL);
- if (!wsa881x_dev_info) {
- ret = -ENOMEM;
- goto err;
- }
-
- /*
- * search and check whether all WSA devices are already
- * registered with ALSA core or not. If found a node, store
- * the node and the index in a local array of struct for later
- * use.
- */
- for (i = 0; i < wsa_dev_cnt; i++) {
- wsa_of_node = of_parse_phandle(pdev->dev.of_node,
- "qcom,wsa-devs", i);
- if (unlikely(!wsa_of_node)) {
- /* we should not be here */
- dev_err(&pdev->dev,
- "%s: wsa dev node is not present\n",
- __func__);
- ret = -EINVAL;
- goto err_free_dev_info;
- }
- if (soc_find_component(wsa_of_node, NULL)) {
- /* WSA device registered with ALSA core */
- wsa881x_dev_info[found].of_node = wsa_of_node;
- wsa881x_dev_info[found].index = i;
- found++;
- if (found == wsa_max_devs)
- break;
- }
- }
-
- if (found < wsa_max_devs) {
- dev_dbg(&pdev->dev,
- "%s: failed to find %d components. Found only %d\n",
- __func__, wsa_max_devs, found);
- return -EPROBE_DEFER;
- }
- dev_info(&pdev->dev,
- "%s: found %d wsa881x devices registered with ALSA core\n",
- __func__, found);
-
- card->num_aux_devs = wsa_max_devs;
- card->num_configs = wsa_max_devs;
-
- /* Alloc array of AUX devs struct */
- msm_aux_dev = devm_kcalloc(&pdev->dev, card->num_aux_devs,
- sizeof(struct snd_soc_aux_dev),
- GFP_KERNEL);
- if (!msm_aux_dev) {
- ret = -ENOMEM;
- goto err_free_dev_info;
- }
-
- /* Alloc array of codec conf struct */
- msm_codec_conf = devm_kcalloc(&pdev->dev, card->num_aux_devs,
- sizeof(struct snd_soc_codec_conf),
- GFP_KERNEL);
- if (!msm_codec_conf) {
- ret = -ENOMEM;
- goto err_free_aux_dev;
- }
-
- for (i = 0; i < card->num_aux_devs; i++) {
- dev_name_str = devm_kzalloc(&pdev->dev, DEV_NAME_STR_LEN,
- GFP_KERNEL);
- if (!dev_name_str) {
- ret = -ENOMEM;
- goto err_free_cdc_conf;
- }
-
- ret = of_property_read_string_index(pdev->dev.of_node,
- "qcom,wsa-aux-dev-prefix",
- wsa881x_dev_info[i].index,
- wsa_auxdev_name_prefix);
- if (ret) {
- dev_err(&pdev->dev,
- "%s: failed to read wsa aux dev prefix, ret = %d\n",
- __func__, ret);
- ret = -EINVAL;
- goto err_free_dev_name_str;
- }
-
- snprintf(dev_name_str, strlen("wsa881x.%d"), "wsa881x.%d", i);
- msm_aux_dev[i].name = dev_name_str;
- msm_aux_dev[i].codec_name = NULL;
- msm_aux_dev[i].codec_of_node =
- wsa881x_dev_info[i].of_node;
- msm_aux_dev[i].init = msm_wsa881x_init;
- msm_codec_conf[i].dev_name = NULL;
- msm_codec_conf[i].name_prefix = wsa_auxdev_name_prefix[0];
- msm_codec_conf[i].of_node =
- wsa881x_dev_info[i].of_node;
- }
- card->codec_conf = msm_codec_conf;
- card->aux_dev = msm_aux_dev;
-
- return 0;
-
-err_free_dev_name_str:
- devm_kfree(&pdev->dev, dev_name_str);
-err_free_cdc_conf:
- devm_kfree(&pdev->dev, msm_codec_conf);
-err_free_aux_dev:
- devm_kfree(&pdev->dev, msm_aux_dev);
-err_free_dev_info:
- devm_kfree(&pdev->dev, wsa881x_dev_info);
-err:
- return ret;
-}
-
-static void msm_i2s_auxpcm_init(struct platform_device *pdev)
-{
- int count;
- u32 mi2s_master_slave[MI2S_MAX];
- int ret;
-
- for (count = 0; count < MI2S_MAX; count++) {
- mutex_init(&mi2s_intf_conf[count].lock);
- mi2s_intf_conf[count].ref_cnt = 0;
- }
-
- ret = of_property_read_u32_array(pdev->dev.of_node,
- "qcom,msm-mi2s-master",
- mi2s_master_slave, MI2S_MAX);
- if (ret) {
- dev_dbg(&pdev->dev, "%s: no qcom,msm-mi2s-master in DT node\n",
- __func__);
- } else {
- for (count = 0; count < MI2S_MAX; count++) {
- mi2s_intf_conf[count].msm_is_mi2s_master =
- mi2s_master_slave[count];
- }
- }
-}
-
-static void msm_i2s_auxpcm_deinit(void)
-{
- int count;
-
- for (count = 0; count < MI2S_MAX; count++) {
- mutex_destroy(&mi2s_intf_conf[count].lock);
- mi2s_intf_conf[count].ref_cnt = 0;
- mi2s_intf_conf[count].msm_is_mi2s_master = 0;
- }
-}
-
-static int msm_asoc_machine_probe(struct platform_device *pdev)
-{
- struct snd_soc_card *card;
- struct msm_asoc_mach_data *pdata;
- const char *mbhc_audio_jack_type = NULL;
- char *mclk_freq_prop_name;
- const struct of_device_id *match;
- int ret;
- const char *usb_c_dt = "qcom,msm-mbhc-usbc-audio-supported";
-
- if (!pdev->dev.of_node) {
- dev_err(&pdev->dev, "No platform supplied from device tree\n");
- return -EINVAL;
- }
-
- pdata = devm_kzalloc(&pdev->dev,
- sizeof(struct msm_asoc_mach_data), GFP_KERNEL);
- if (!pdata)
- return -ENOMEM;
-
- card = populate_snd_card_dailinks(&pdev->dev);
- if (!card) {
- dev_err(&pdev->dev, "%s: Card uninitialized\n", __func__);
- ret = -EINVAL;
- goto err;
- }
- card->dev = &pdev->dev;
- platform_set_drvdata(pdev, card);
- snd_soc_card_set_drvdata(card, pdata);
-
- ret = snd_soc_of_parse_card_name(card, "qcom,model");
- if (ret) {
- dev_err(&pdev->dev, "parse card name failed, err:%d\n",
- ret);
- goto err;
- }
-
- ret = snd_soc_of_parse_audio_routing(card, "qcom,audio-routing");
- if (ret) {
- dev_err(&pdev->dev, "parse audio routing failed, err:%d\n",
- ret);
- goto err;
- }
-
- match = of_match_node(sdm845_asoc_machine_of_match,
- pdev->dev.of_node);
- if (!match) {
- dev_err(&pdev->dev, "%s: no matched codec is found.\n",
- __func__);
- goto err;
- }
-
- mclk_freq_prop_name = "qcom,tavil-mclk-clk-freq";
-
- ret = of_property_read_u32(pdev->dev.of_node,
- mclk_freq_prop_name, &pdata->mclk_freq);
- if (ret) {
- dev_err(&pdev->dev,
- "Looking up %s property in node %s failed, err%d\n",
- mclk_freq_prop_name,
- pdev->dev.of_node->full_name, ret);
- goto err;
- }
-
- if (pdata->mclk_freq != CODEC_EXT_CLK_RATE) {
- dev_err(&pdev->dev, "unsupported mclk freq %u\n",
- pdata->mclk_freq);
- ret = -EINVAL;
- goto err;
- }
-
- ret = msm_populate_dai_link_component_of_node(card);
- if (ret) {
- ret = -EPROBE_DEFER;
- goto err;
- }
- ret = msm_init_wsa_dev(pdev, card);
- if (ret)
- goto err;
-
- ret = devm_snd_soc_register_card(&pdev->dev, card);
- if (ret == -EPROBE_DEFER) {
- if (codec_reg_done)
- ret = -EINVAL;
- goto err;
- } else if (ret) {
- dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
- ret);
- goto err;
- }
- dev_info(&pdev->dev, "Sound card %s registered\n", card->name);
- spdev = pdev;
-
- ret = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
- if (ret) {
- dev_dbg(&pdev->dev, "%s: failed to add child nodes, ret=%d\n",
- __func__, ret);
- } else {
- pdata->hph_en1_gpio_p = of_parse_phandle(pdev->dev.of_node,
- "qcom,hph-en1-gpio", 0);
- if (!pdata->hph_en1_gpio_p) {
- dev_dbg(&pdev->dev, "property %s not detected in node %s",
- "qcom,hph-en1-gpio",
- pdev->dev.of_node->full_name);
- }
-
- pdata->hph_en0_gpio_p = of_parse_phandle(pdev->dev.of_node,
- "qcom,hph-en0-gpio", 0);
- if (!pdata->hph_en0_gpio_p) {
- dev_dbg(&pdev->dev, "property %s not detected in node %s",
- "qcom,hph-en0-gpio",
- pdev->dev.of_node->full_name);
- }
- }
-
- ret = of_property_read_string(pdev->dev.of_node,
- "qcom,mbhc-audio-jack-type", &mbhc_audio_jack_type);
- if (ret) {
- dev_dbg(&pdev->dev, "Looking up %s property in node %s failed",
- "qcom,mbhc-audio-jack-type",
- pdev->dev.of_node->full_name);
- dev_dbg(&pdev->dev, "Jack type properties set to default");
- } else {
- if (!strcmp(mbhc_audio_jack_type, "4-pole-jack")) {
- wcd_mbhc_cfg.enable_anc_mic_detect = false;
- dev_dbg(&pdev->dev, "This hardware has 4 pole jack");
- } else if (!strcmp(mbhc_audio_jack_type, "5-pole-jack")) {
- wcd_mbhc_cfg.enable_anc_mic_detect = true;
- dev_dbg(&pdev->dev, "This hardware has 5 pole jack");
- } else if (!strcmp(mbhc_audio_jack_type, "6-pole-jack")) {
- wcd_mbhc_cfg.enable_anc_mic_detect = true;
- dev_dbg(&pdev->dev, "This hardware has 6 pole jack");
- } else {
- wcd_mbhc_cfg.enable_anc_mic_detect = false;
- dev_dbg(&pdev->dev, "Unknown value, set to default");
- }
- }
- /*
- * Parse US-Euro gpio info from DT. Report no error if us-euro
- * entry is not found in DT file as some targets do not support
- * US-Euro detection
- */
- pdata->us_euro_gpio = of_get_named_gpio(pdev->dev.of_node,
- "qcom,us-euro-gpios", 0);
- if (!gpio_is_valid(pdata->us_euro_gpio))
- pdata->us_euro_gpio_p = of_parse_phandle(pdev->dev.of_node,
- "qcom,us-euro-gpios", 0);
- if (!gpio_is_valid(pdata->us_euro_gpio) && (!pdata->us_euro_gpio_p)) {
- dev_dbg(&pdev->dev, "property %s not detected in node %s",
- "qcom,us-euro-gpios", pdev->dev.of_node->full_name);
- } else {
- dev_dbg(&pdev->dev, "%s detected",
- "qcom,us-euro-gpios");
- wcd_mbhc_cfg.swap_gnd_mic = msm_swap_gnd_mic;
- }
-
- if (of_find_property(pdev->dev.of_node, usb_c_dt, NULL))
- wcd_mbhc_cfg.swap_gnd_mic = msm_swap_gnd_mic;
-
- ret = msm_prepare_us_euro(card);
- if (ret)
- dev_dbg(&pdev->dev, "msm_prepare_us_euro failed (%d)\n",
- ret);
-
- /* Parse pinctrl info from devicetree */
- ret = msm_get_pinctrl(pdev);
- if (!ret) {
- pr_debug("%s: pinctrl parsing successful\n", __func__);
- } else {
- dev_dbg(&pdev->dev,
- "%s: Parsing pinctrl failed with %d. Cannot use Ports\n",
- __func__, ret);
- ret = 0;
- }
-
- msm_i2s_auxpcm_init(pdev);
-
- is_initial_boot = true;
- ret = audio_notifier_register("sdm845", AUDIO_NOTIFIER_ADSP_DOMAIN,
- &service_nb);
- if (ret < 0)
- pr_err("%s: Audio notifier register failed ret = %d\n",
- __func__, ret);
-
- return 0;
-err:
- msm_release_pinctrl(pdev);
- devm_kfree(&pdev->dev, pdata);
- return ret;
-}
-
-static int msm_asoc_machine_remove(struct platform_device *pdev)
-{
- struct snd_soc_card *card = platform_get_drvdata(pdev);
- struct msm_asoc_mach_data *pdata =
- snd_soc_card_get_drvdata(card);
-
- audio_notifier_deregister("sdm845");
- if (pdata->us_euro_gpio > 0) {
- gpio_free(pdata->us_euro_gpio);
- pdata->us_euro_gpio = 0;
- }
- msm_i2s_auxpcm_deinit();
-
- msm_release_pinctrl(pdev);
- snd_soc_unregister_card(card);
- return 0;
-}
-
-static struct platform_driver sdm845_asoc_machine_driver = {
- .driver = {
- .name = DRV_NAME,
- .owner = THIS_MODULE,
- .pm = &snd_soc_pm_ops,
- .of_match_table = sdm845_asoc_machine_of_match,
- },
- .probe = msm_asoc_machine_probe,
- .remove = msm_asoc_machine_remove,
-};
-module_platform_driver(sdm845_asoc_machine_driver);
-
-MODULE_DESCRIPTION("ALSA SoC msm");
-MODULE_LICENSE("GPL v2");
-MODULE_ALIAS("platform:" DRV_NAME);
-MODULE_DEVICE_TABLE(of, sdm845_asoc_machine_of_match);
diff --git a/config/sdm670auto.conf b/config/sdm670auto.conf
deleted file mode 100644
index 4c0b284..0000000
--- a/config/sdm670auto.conf
+++ /dev/null
@@ -1,50 +0,0 @@
-CONFIG_PINCTRL_LPI=m
-CONFIG_PINCTRL_WCD=m
-CONFIG_AUDIO_EXT_CLK=m
-CONFIG_SND_SOC_WCD9XXX_V2=m
-CONFIG_SND_SOC_WCD_MBHC=m
-CONFIG_SND_SOC_WSA881X=m
-CONFIG_SND_SOC_WCD_DSP_MGR=m
-CONFIG_SND_SOC_WCD_SPI=m
-CONFIG_SND_SOC_WCD_CPE=m
-CONFIG_SND_SOC_CPE=m
-CONFIG_SND_SOC_WCD9335=m
-CONFIG_SND_SOC_WCD934X=m
-CONFIG_SND_SOC_WCD934X_MBHC=m
-CONFIG_SND_SOC_WCD934X_DSD=m
-CONFIG_MSM_QDSP6V2_CODECS=m
-CONFIG_MSM_ULTRASOUND=m
-CONFIG_MSM_QDSP6_APRV2_GLINK=m
-CONFIG_MSM_ADSP_LOADER=m
-CONFIG_REGMAP_SWR=m
-CONFIG_MSM_QDSP6_SSR=m
-CONFIG_MSM_QDSP6_PDR=m
-CONFIG_MSM_QDSP6_NOTIFIER=m
-CONFIG_SND_SOC_MSM_HOSTLESS_PCM=m
-CONFIG_SND_SOC_MSM_QDSP6V2_INTF=m
-CONFIG_SND_SOC_SDM670=m
-CONFIG_MSM_GLINK_SPI_XPRT=m
-CONFIG_SOUNDWIRE=m
-CONFIG_SOUNDWIRE_WCD_CTRL=m
-CONFIG_SND_SOC_QDSP6V2=m
-CONFIG_SND_SOC_MSM_QDSP6V2_INTF=m
-CONFIG_WCD9XXX_CODEC_CORE=m
-CONFIG_MSM_CDC_PINCTRL=m
-CONFIG_SND_SOC_WCD_MBHC_ADC=m
-CONFIG_SND_SOC_WCD_MBHC_LEGACY=m
-CONFIG_QTI_PP=m
-CONFIG_SND_HWDEP_ROUTING=m
-CONFIG_DTS_EAGLE=m
-CONFIG_DOLBY_DS2=m
-CONFIG_DOLBY_LICENSE=m
-CONFIG_DTS_SRS_TM=m
-CONFIG_SND_SOC_EXT_CODEC=m
-CONFIG_SND_SOC_INT_CODEC=m
-CONFIG_SND_SOC_MSM_STUB=m
-CONFIG_WCD_DSP_GLINK=m
-CONFIG_MSM_AVTIMER=m
-CONFIG_SND_SOC_SDM660_CDC=m
-CONFIG_SND_SOC_ANALOG_CDC=m
-CONFIG_SND_SOC_DIGITAL_CDC=m
-CONFIG_SND_SOC_MSM_SDW=m
-CONFIG_SND_SOC_MSM_HDMI_CODEC_RX=m
diff --git a/config/sdm670auto_static.conf b/config/sdm670auto_static.conf
deleted file mode 100644
index 91a8464..0000000
--- a/config/sdm670auto_static.conf
+++ /dev/null
@@ -1,50 +0,0 @@
-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_ROUTING=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
diff --git a/config/sdm670autoconf.h b/config/sdm670autoconf.h
deleted file mode 100644
index 55f9548..0000000
--- a/config/sdm670autoconf.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2017-2018, 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_PINCTRL_LPI 1
-#define CONFIG_PINCTRL_WCD 1
-#define CONFIG_AUDIO_EXT_CLK 1
-#define CONFIG_SND_SOC_WCD9XXX_V2 1
-#define CONFIG_SND_SOC_WCD_CPE 1
-#define CONFIG_SND_SOC_WCD_MBHC 1
-#define CONFIG_SND_SOC_WSA881X 1
-#define CONFIG_SND_SOC_WCD_DSP_MGR 1
-#define CONFIG_SND_SOC_WCD_SPI 1
-#define CONFIG_SND_SOC_WCD9335 1
-#define CONFIG_SND_SOC_WCD934X 1
-#define CONFIG_SND_SOC_WCD934X_MBHC 1
-#define CONFIG_SND_SOC_WCD934X_DSD 1
-#define CONFIG_MSM_QDSP6V2_CODECS 1
-#define CONFIG_MSM_ULTRASOUND 1
-#define CONFIG_MSM_QDSP6_APRV2_GLINK 1
-#define CONFIG_MSM_ADSP_LOADER 1
-#define CONFIG_REGMAP_SWR 1
-#define CONFIG_MSM_QDSP6_SSR 1
-#define CONFIG_MSM_QDSP6_PDR 1
-#define CONFIG_MSM_QDSP6_NOTIFIER 1
-#define CONFIG_SND_SOC_MSM_HOSTLESS_PCM 1
-#define CONFIG_SND_SOC_MSM_QDSP6V2_INTF 1
-#define CONFIG_SND_SOC_SDM670 1
-#define CONFIG_MSM_GLINK_SPI_XPRT 1
-#define CONFIG_SOUNDWIRE 1
-#define CONFIG_SOUNDWIRE_WCD_CTRL 1
-#define CONFIG_SND_SOC_WCD_MBHC_ADC 1
-#define CONFIG_SND_SOC_WCD_MBHC_LEGACY 1
-#define CONFIG_SND_SOC_QDSP6V2 1
-#define CONFIG_SND_SOC_MSM_QDSP6V2_INTF 1
-#define CONFIG_QTI_PP 1
-#define CONFIG_SND_HWDEP_ROUTING 1
-#define CONFIG_DTS_EAGLE 1
-#define CONFIG_DOLBY_DS2 1
-#define CONFIG_DOLBY_LICENSE 1
-#define CONFIG_DTS_SRS_TM 1
-#define CONFIG_WCD9XXX_CODEC_CORE 1
-#define CONFIG_MSM_CDC_PINCTRL 1
-#define CONFIG_SND_SOC_MSM_STUB 1
-#define CONFIG_WCD_DSP_GLINK 1
-#define CONFIG_MSM_AVTIMER 1
-#define CONFIG_SND_SOC_EXT_CODEC 1
-#define CONFIG_SND_SOC_INT_CODEC 1
-#define CONFIG_SND_SOC_CPE 1
-#define CONFIG_SND_SOC_SDM660_CDC 1
-#define CONFIG_SND_SOC_ANALOG_CDC 1
-#define CONFIG_SND_SOC_DIGITAL_CDC 1
-#define CONFIG_SND_SOC_MSM_SDW 1
-#define CONFIG_SND_SOC_MSM_HDMI_CODEC_RX 1
diff --git a/config/sdm845auto.conf b/config/sdm845auto.conf
deleted file mode 100644
index 4c195b4..0000000
--- a/config/sdm845auto.conf
+++ /dev/null
@@ -1,37 +0,0 @@
-CONFIG_PINCTRL_WCD=m
-CONFIG_SND_SOC_WCD9XXX_V2=m
-CONFIG_SND_SOC_WCD_MBHC=m
-CONFIG_SND_SOC_WSA881X=m
-CONFIG_SND_SOC_WCD_SPI=m
-CONFIG_SND_SOC_WCD934X=m
-CONFIG_SOUNDWIRE_WCD_CTRL=m
-CONFIG_WCD9XXX_CODEC_CORE=m
-CONFIG_MSM_CDC_PINCTRL=m
-CONFIG_SND_SOC_WCD934X_MBHC=m
-CONFIG_SND_SOC_WCD934X_DSD=m
-CONFIG_SND_SOC_MACHINE_SDM845=m
-CONFIG_WCD_DSP_GLINK=m
-CONFIG_MSM_QDSP6V2_CODECS=y
-CONFIG_MSM_ULTRASOUND=y
-CONFIG_MSM_QDSP6_APRV2_GLINK=y
-CONFIG_SND_SOC_MSM_QDSP6V2_INTF=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_SDM845=y
-CONFIG_MSM_GLINK_SPI_XPRT=y
-CONFIG_SOUNDWIRE=y
-CONFIG_SND_SOC_QDSP6V2=y
-CONFIG_SND_SOC_WCD_MBHC_ADC=y
-CONFIG_QTI_PP=y
-CONFIG_SND_HWDEP_ROUTING=y
-CONFIG_DTS_EAGLE=y
-CONFIG_DOLBY_DS2=y
-CONFIG_DOLBY_LICENSE=y
-CONFIG_DTS_SRS_TM=y
-CONFIG_SND_SOC_MSM_STUB=y
-CONFIG_MSM_AVTIMER=y
-CONFIG_SND_SOC_MSM_HDMI_CODEC_RX=y
diff --git a/config/sdm845autoconf.h b/config/sdm845autoconf.h
deleted file mode 100644
index 6ef465a..0000000
--- a/config/sdm845autoconf.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2017-2018, 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_PINCTRL_WCD 1
-#define CONFIG_SND_SOC_WCD934X 1
-#define CONFIG_SND_SOC_WCD9XXX_V2 1
-#define CONFIG_SND_SOC_WCD_CPE 1
-#define CONFIG_SND_SOC_WCD_MBHC 1
-#define CONFIG_SND_SOC_WSA881X 1
-#define CONFIG_SND_SOC_WCD_SPI 1
-#define CONFIG_SND_SOC_WCD934X_MBHC 1
-#define CONFIG_SND_SOC_WCD934X_DSD 1
-#define CONFIG_MSM_QDSP6V2_CODECS 1
-#define CONFIG_MSM_ULTRASOUND 1
-#define CONFIG_MSM_QDSP6_APRV2_GLINK 1
-#define CONFIG_SND_SOC_MSM_QDSP6V2_INTF 1
-#define CONFIG_MSM_ADSP_LOADER 1
-#define CONFIG_REGMAP_SWR 1
-#define CONFIG_MSM_QDSP6_SSR 1
-#define CONFIG_MSM_QDSP6_PDR 1
-#define CONFIG_MSM_QDSP6_NOTIFIER 1
-#define CONFIG_SND_SOC_MSM_HOSTLESS_PCM 1
-#define CONFIG_SND_SOC_SDM845 1
-#define CONFIG_MSM_GLINK_SPI_XPRT 1
-#define CONFIG_SOUNDWIRE 1
-#define CONFIG_SOUNDWIRE_WCD_CTRL 1
-#define CONFIG_SND_SOC_WCD_MBHC_ADC 1
-#define CONFIG_SND_SOC_QDSP6V2 1
-#define CONFIG_MSM_CDC_PINCTRL 1
-#define CONFIG_QTI_PP 1
-#define CONFIG_SND_HWDEP_ROUTING 1
-#define CONFIG_DTS_EAGLE 1
-#define CONFIG_DOLBY_DS2 1
-#define CONFIG_DOLBY_LICENSE 1
-#define CONFIG_DTS_SRS_TM 1
-#define CONFIG_WCD9XXX_CODEC_CORE 1
-#define CONFIG_SND_SOC_MSM_STUB 1
-#define CONFIG_WCD_DSP_GLINK 1
-#define CONFIG_MSM_AVTIMER 1
-#define CONFIG_SND_SOC_MSM_HDMI_CODEC_RX 1
diff --git a/dsp/Android.mk b/dsp/Android.mk
index 310bd01..c81a1bd 100644
--- a/dsp/Android.mk
+++ b/dsp/Android.mk
@@ -3,14 +3,6 @@
# Assume no targets will be supported
# Check if this driver needs be built for current target
-ifeq ($(call is-board-platform,sdm845),true)
-AUDIO_SELECT := CONFIG_SND_SOC_SDM845=m
-endif
-
-ifeq ($(call is-board-platform-in-list,msm8953 sdm670 qcs605),true)
-AUDIO_SELECT := CONFIG_SND_SOC_SDM670=m
-endif
-
ifeq ($(call is-board-platform,msmnile),true)
AUDIO_SELECT := CONFIG_SND_SOC_SM8150=m
endif
@@ -21,7 +13,7 @@
AUDIO_CHIPSET := audio
# Build/Package only in case of supported target
-ifeq ($(call is-board-platform-in-list,msm8953 sdm845 sdm670 qcs605 msmnile $(MSMSTEPPE) $(TRINKET)),true)
+ifeq ($(call is-board-platform-in-list,msmnile $(MSMSTEPPE) $(TRINKET)),true)
LOCAL_PATH := $(call my-dir)
diff --git a/dsp/Kbuild b/dsp/Kbuild
index 11db9d5..6d9ea15 100644
--- a/dsp/Kbuild
+++ b/dsp/Kbuild
@@ -14,21 +14,6 @@
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
- ifeq ($(CONFIG_ARCH_SDM450), y)
- include $(AUDIO_ROOT)/config/sdm670auto.conf
- export
- INCS += -include $(AUDIO_ROOT)/config/sdm670autoconf.h
- endif
ifeq ($(CONFIG_ARCH_SM6150), y)
include $(AUDIO_ROOT)/config/sm6150auto.conf
export
diff --git a/dsp/codecs/Android.mk b/dsp/codecs/Android.mk
index 0e22e03..62f6db8 100644
--- a/dsp/codecs/Android.mk
+++ b/dsp/codecs/Android.mk
@@ -3,14 +3,6 @@
# Assume no targets will be supported
# Check if this driver needs be built for current target
-ifeq ($(call is-board-platform,sdm845),true)
-AUDIO_SELECT := CONFIG_SND_SOC_SDM845=m
-endif
-
-ifeq ($(call is-board-platform-in-list,msm8953 sdm670 qcs605),true)
-AUDIO_SELECT := CONFIG_SND_SOC_SDM670=m
-endif
-
ifeq ($(call is-board-platform,msmnile),true)
AUDIO_SELECT := CONFIG_SND_SOC_SM8150=m
endif
@@ -21,7 +13,7 @@
AUDIO_CHIPSET := audio
# Build/Package only in case of supported target
-ifeq ($(call is-board-platform-in-list,msm8953 sdm845 sdm670 qcs605 msmnile $(MSMSTEPPE) $(TRINKET)),true)
+ifeq ($(call is-board-platform-in-list,msmnile $(MSMSTEPPE) $(TRINKET)),true)
LOCAL_PATH := $(call my-dir)
diff --git a/dsp/codecs/Kbuild b/dsp/codecs/Kbuild
index 34e3b72..f6c9ea4 100644
--- a/dsp/codecs/Kbuild
+++ b/dsp/codecs/Kbuild
@@ -14,22 +14,6 @@
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
- ifeq ($(CONFIG_ARCH_SDM450), y)
- include $(AUDIO_ROOT)/config/sdm670auto.conf
- export
- INCS += -include $(AUDIO_ROOT)/config/sdm670autoconf.h
- endif
ifeq ($(CONFIG_ARCH_SM6150), y)
include $(AUDIO_ROOT)/config/sm6150auto.conf
export
diff --git a/include/asoc/wcd9360-registers.h b/include/asoc/wcd9360-registers.h
deleted file mode 100644
index bca9de3..0000000
--- a/include/asoc/wcd9360-registers.h
+++ /dev/null
@@ -1,1158 +0,0 @@
-/*
- * Copyright (c) 2018, 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.
- */
-
-#ifndef _WCD9360_REGISTERS_H
-#define _WCD9360_REGISTERS_H
-
-#define WCD9360_PAGE_SIZE 256
-#define WCD9360_NUM_PAGES 256
-
-enum {
- WCD9360_PAGE_0 = 0,
- WCD9360_PAGE_1,
- WCD9360_PAGE_2,
- WCD9360_PAGE_4 = 4,
- WCD9360_PAGE_6 = 6,
- WCD9360_PAGE_7,
- WCD9360_PAGE_10 = 10,
- WCD9360_PAGE_11,
- WCD9360_PAGE_12,
- WCD9360_PAGE_13,
- WCD9360_PAGE_14,
- WCD9360_PAGE_80,
- WCD9360_PAGE_128,
- WCD9360_PAGE_MAX,
-};
-
-enum {
- WCD9360_WO = 0,
- WCD9360_RO,
- WCD9360_RW,
-};
-
-extern const u8 * const wcd9360_reg[WCD9360_PAGE_MAX];
-
-/* Page-0 Registers */
-#define WCD9360_PAGE0_PAGE_REGISTER (0x00000000)
-#define WCD9360_CODEC_RPM_CLK_BYPASS (0x00000001)
-#define WCD9360_CODEC_RPM_CLK_GATE (0x00000002)
-#define WCD9360_CODEC_RPM_CLK_MCLK_CFG (0x00000003)
-#define WCD9360_CODEC_RPM_CLK_MCLK2_CFG (0x00000004)
-#define WCD9360_CODEC_RPM_I2S_DSD_CLK_SEL (0x00000005)
-#define WCD9360_CODEC_RPM_RST_CTL (0x00000009)
-#define WCD9360_CODEC_RPM_PWR_CDC_DIG_HM_CTL (0x00000011)
-#define WCD9360_CHIP_TIER_CTRL_CHIP_ID_BYTE0 (0x00000021)
-#define WCD9360_CHIP_TIER_CTRL_CHIP_ID_BYTE1 (0x00000022)
-#define WCD9360_CHIP_TIER_CTRL_CHIP_ID_BYTE2 (0x00000023)
-#define WCD9360_CHIP_TIER_CTRL_CHIP_ID_BYTE3 (0x00000024)
-#define WCD9360_CHIP_TIER_CTRL_EFUSE_CTL (0x00000025)
-#define WCD9360_CHIP_TIER_CTRL_EFUSE_TEST0 (0x00000026)
-#define WCD9360_CHIP_TIER_CTRL_EFUSE_TEST1 (0x00000027)
-#define WCD9360_CHIP_TIER_CTRL_EFUSE_STATUS (0x00000039)
-#define WCD9360_CHIP_TIER_CTRL_I2C_SLAVE_ID_NONNEGO (0x0000003A)
-#define WCD9360_CHIP_TIER_CTRL_I2C_SLAVE_ID_1 (0x0000003B)
-#define WCD9360_CHIP_TIER_CTRL_I2C_SLAVE_ID_2 (0x0000003C)
-#define WCD9360_CHIP_TIER_CTRL_I2C_SLAVE_ID_3 (0x0000003D)
-#define WCD9360_CHIP_TIER_CTRL_ANA_WAIT_STATE_CTL (0x0000003E)
-#define WCD9360_CHIP_TIER_CTRL_I2C_ACTIVE (0x00000040)
-#define WCD9360_CHIP_TIER_CTRL_ALT_FUNC_EN (0x00000041)
-#define WCD9360_CHIP_TIER_CTRL_GPIO_CTL_OE (0x00000042)
-#define WCD9360_CHIP_TIER_CTRL_GPIO_CTL_DATA (0x00000043)
-#define WCD9360_DATA_HUB_RX0_CFG (0x00000051)
-#define WCD9360_DATA_HUB_RX1_CFG (0x00000052)
-#define WCD9360_DATA_HUB_RX2_CFG (0x00000053)
-#define WCD9360_DATA_HUB_RX3_CFG (0x00000054)
-#define WCD9360_DATA_HUB_RX4_CFG (0x00000055)
-#define WCD9360_DATA_HUB_RX5_CFG (0x00000056)
-#define WCD9360_DATA_HUB_RX6_CFG (0x00000057)
-#define WCD9360_DATA_HUB_RX7_CFG (0x00000058)
-#define WCD9360_DATA_HUB_SB_TX0_INP_CFG (0x00000061)
-#define WCD9360_DATA_HUB_SB_TX1_INP_CFG (0x00000062)
-#define WCD9360_DATA_HUB_SB_TX2_INP_CFG (0x00000063)
-#define WCD9360_DATA_HUB_SB_TX3_INP_CFG (0x00000064)
-#define WCD9360_DATA_HUB_SB_TX4_INP_CFG (0x00000065)
-#define WCD9360_DATA_HUB_SB_TX5_INP_CFG (0x00000066)
-#define WCD9360_DATA_HUB_SB_TX6_INP_CFG (0x00000067)
-#define WCD9360_DATA_HUB_SB_TX7_INP_CFG (0x00000068)
-#define WCD9360_DATA_HUB_SB_TX8_INP_CFG (0x00000069)
-#define WCD9360_DATA_HUB_SB_TX9_INP_CFG (0x0000006A)
-#define WCD9360_DATA_HUB_SB_TX10_INP_CFG (0x0000006B)
-#define WCD9360_DATA_HUB_SB_TX11_INP_CFG (0x0000006C)
-#define WCD9360_DATA_HUB_SB_TX12_INP_CFG (0x0000006D)
-#define WCD9360_DATA_HUB_SB_TX13_INP_CFG (0x0000006E)
-#define WCD9360_DATA_HUB_SB_TX14_INP_CFG (0x0000006F)
-#define WCD9360_DATA_HUB_SB_TX15_INP_CFG (0x00000070)
-#define WCD9360_DATA_HUB_I2S_TX0_CFG (0x00000071)
-#define WCD9360_DATA_HUB_I2S_TX0_CFG2 (0x00000072)
-#define WCD9360_DATA_HUB_I2S_TX1_0_CFG (0x00000073)
-#define WCD9360_DATA_HUB_I2S_TX1_1_CFG (0x00000074)
-#define WCD9360_DATA_HUB_DATA_HUB_CFG (0x00000079)
-#define WCD9360_DATA_HUB_I2S_0_CTL (0x00000081)
-#define WCD9360_DATA_HUB_I2S_1_CTL (0x00000082)
-#define WCD9360_DATA_HUB_I2S_0_CTL2 (0x00000083)
-#define WCD9360_DATA_HUB_I2S_1_CTL2 (0x00000084)
-#define WCD9360_DATA_HUB_I2S_CLKSRC_CTL (0x00000085)
-#define WCD9360_DATA_HUB_I2S_COMMON_CTL (0x00000086)
-#define WCD9360_DATA_HUB_I2S_0_TDM_CTL (0x00000087)
-#define WCD9360_DATA_HUB_I2S_0_TDM_CTL2 (0x00000089)
-#define WCD9360_DATA_HUB_I2S_0_TDM_CH_RX (0x0000008A)
-#define WCD9360_DATA_HUB_I2S_0_TDM_CH_TX (0x0000008B)
-#define WCD9360_DATA_HUB_I2S_0_TDM_CFG (0x0000008C)
-#define WCD9360_DATA_HUB_I2S_0_TDM_STRETCH (0x0000008D)
-#define WCD9360_DATA_HUB_I2S_RESET_CTL (0x00000090)
-#define WCD9360_DMA_RDMA_CTL_0 (0x00000091)
-#define WCD9360_DMA_CH_2_3_CFG_RDMA_0 (0x00000092)
-#define WCD9360_DMA_CH_0_1_CFG_RDMA_0 (0x00000093)
-#define WCD9360_DMA_RDMA_CTL_1 (0x00000094)
-#define WCD9360_DMA_CH_2_3_CFG_RDMA_1 (0x00000095)
-#define WCD9360_DMA_CH_0_1_CFG_RDMA_1 (0x00000096)
-#define WCD9360_DMA_RDMA_CTL_2 (0x00000097)
-#define WCD9360_DMA_CH_2_3_CFG_RDMA_2 (0x00000098)
-#define WCD9360_DMA_CH_0_1_CFG_RDMA_2 (0x00000099)
-#define WCD9360_DMA_RDMA_CTL_3 (0x0000009A)
-#define WCD9360_DMA_CH_2_3_CFG_RDMA_3 (0x0000009B)
-#define WCD9360_DMA_CH_0_1_CFG_RDMA_3 (0x0000009C)
-#define WCD9360_DMA_RDMA_CTL_4 (0x0000009D)
-#define WCD9360_DMA_CH_2_3_CFG_RDMA_4 (0x0000009E)
-#define WCD9360_DMA_CH_0_1_CFG_RDMA_4 (0x0000009F)
-#define WCD9360_DMA_RDMA4_PRT_CFG (0x000000B1)
-#define WCD9360_DMA_RDMA_SBTX0_7_CFG (0x000000B9)
-#define WCD9360_DMA_RDMA_SBTX8_10_CFG (0x000000BA)
-#define WCD9360_DMA_WDMA_CTL_0 (0x000000C1)
-#define WCD9360_DMA_WDMA_CTL_1 (0x000000C6)
-#define WCD9360_DMA_WDMA_CTL_2 (0x000000CB)
-#define WCD9360_DMA_WDMA_CTL_3 (0x000000D0)
-#define WCD9360_DMA_WDMA_CTL_4 (0x000000D5)
-#define WCD9360_DMA_CH_4_5_CFG_WDMA_0 (0x000000C2)
-#define WCD9360_DMA_CH_4_5_CFG_WDMA_1 (0x000000C7)
-#define WCD9360_DMA_CH_4_5_CFG_WDMA_2 (0x000000CC)
-#define WCD9360_DMA_CH_4_5_CFG_WDMA_3 (0x000000D1)
-#define WCD9360_DMA_CH_4_5_CFG_WDMA_4 (0x000000D6)
-#define WCD9360_DMA_CH_2_3_CFG_WDMA_0 (0x000000C3)
-#define WCD9360_DMA_CH_2_3_CFG_WDMA_1 (0x000000C8)
-#define WCD9360_DMA_CH_2_3_CFG_WDMA_2 (0x000000CD)
-#define WCD9360_DMA_CH_2_3_CFG_WDMA_3 (0x000000D2)
-#define WCD9360_DMA_CH_2_3_CFG_WDMA_4 (0x000000D7)
-#define WCD9360_DMA_CH_0_1_CFG_WDMA_0 (0x000000C4)
-#define WCD9360_DMA_CH_0_1_CFG_WDMA_1 (0x000000C9)
-#define WCD9360_DMA_CH_0_1_CFG_WDMA_2 (0x000000CE)
-#define WCD9360_DMA_CH_0_1_CFG_WDMA_3 (0x000000D3)
-#define WCD9360_DMA_CH_0_1_CFG_WDMA_4 (0x000000D8)
-#define WCD9360_DMA_WDMA0_PRT_CFG (0x000000E1)
-#define WCD9360_DMA_WDMA3_PRT_CFG (0x000000E2)
-#define WCD9360_DMA_WDMA4_PRT0_3_CFG (0x000000E3)
-#define WCD9360_DMA_WDMA4_PRT4_7_CFG (0x000000E4)
-#define WCD9360_PAGE1_PAGE_REGISTER (0x00000100)
-#define WCD9360_CPE_FLL_USER_CTL_0 (0x00000101)
-#define WCD9360_CPE_FLL_USER_CTL_1 (0x00000102)
-#define WCD9360_CPE_FLL_USER_CTL_2 (0x00000103)
-#define WCD9360_CPE_FLL_USER_CTL_3 (0x00000104)
-#define WCD9360_CPE_FLL_USER_CTL_4 (0x00000105)
-#define WCD9360_CPE_FLL_USER_CTL_5 (0x00000106)
-#define WCD9360_CPE_FLL_USER_CTL_6 (0x00000107)
-#define WCD9360_CPE_FLL_USER_CTL_7 (0x00000108)
-#define WCD9360_CPE_FLL_USER_CTL_8 (0x00000109)
-#define WCD9360_CPE_FLL_USER_CTL_9 (0x0000010A)
-#define WCD9360_CPE_FLL_L_VAL_CTL_0 (0x0000010B)
-#define WCD9360_CPE_FLL_L_VAL_CTL_1 (0x0000010C)
-#define WCD9360_CPE_FLL_DSM_FRAC_CTL_0 (0x0000010D)
-#define WCD9360_CPE_FLL_DSM_FRAC_CTL_1 (0x0000010E)
-#define WCD9360_CPE_FLL_CONFIG_CTL_0 (0x0000010F)
-#define WCD9360_CPE_FLL_CONFIG_CTL_1 (0x00000110)
-#define WCD9360_CPE_FLL_CONFIG_CTL_2 (0x00000111)
-#define WCD9360_CPE_FLL_CONFIG_CTL_3 (0x00000112)
-#define WCD9360_CPE_FLL_CONFIG_CTL_4 (0x00000113)
-#define WCD9360_CPE_FLL_TEST_CTL_0 (0x00000114)
-#define WCD9360_CPE_FLL_TEST_CTL_1 (0x00000115)
-#define WCD9360_CPE_FLL_TEST_CTL_2 (0x00000116)
-#define WCD9360_CPE_FLL_TEST_CTL_3 (0x00000117)
-#define WCD9360_CPE_FLL_TEST_CTL_4 (0x00000118)
-#define WCD9360_CPE_FLL_TEST_CTL_5 (0x00000119)
-#define WCD9360_CPE_FLL_TEST_CTL_6 (0x0000011A)
-#define WCD9360_CPE_FLL_TEST_CTL_7 (0x0000011B)
-#define WCD9360_CPE_FLL_FREQ_CTL_0 (0x0000011C)
-#define WCD9360_CPE_FLL_FREQ_CTL_1 (0x0000011D)
-#define WCD9360_CPE_FLL_FREQ_CTL_2 (0x0000011E)
-#define WCD9360_CPE_FLL_FREQ_CTL_3 (0x0000011F)
-#define WCD9360_CPE_FLL_SSC_CTL_0 (0x00000120)
-#define WCD9360_CPE_FLL_SSC_CTL_1 (0x00000121)
-#define WCD9360_CPE_FLL_SSC_CTL_2 (0x00000122)
-#define WCD9360_CPE_FLL_SSC_CTL_3 (0x00000123)
-#define WCD9360_CPE_FLL_FLL_MODE (0x00000124)
-#define WCD9360_CPE_FLL_STATUS_0 (0x00000125)
-#define WCD9360_CPE_FLL_STATUS_1 (0x00000126)
-#define WCD9360_CPE_FLL_STATUS_2 (0x00000127)
-#define WCD9360_CPE_FLL_STATUS_3 (0x00000128)
-#define WCD9360_I2S_FLL_USER_CTL_0 (0x00000141)
-#define WCD9360_I2S_FLL_USER_CTL_1 (0x00000142)
-#define WCD9360_I2S_FLL_USER_CTL_2 (0x00000143)
-#define WCD9360_I2S_FLL_USER_CTL_3 (0x00000144)
-#define WCD9360_I2S_FLL_USER_CTL_4 (0x00000145)
-#define WCD9360_I2S_FLL_USER_CTL_5 (0x00000146)
-#define WCD9360_I2S_FLL_USER_CTL_6 (0x00000147)
-#define WCD9360_I2S_FLL_USER_CTL_7 (0x00000148)
-#define WCD9360_I2S_FLL_USER_CTL_8 (0x00000149)
-#define WCD9360_I2S_FLL_USER_CTL_9 (0x0000014A)
-#define WCD9360_I2S_FLL_L_VAL_CTL_0 (0x0000014B)
-#define WCD9360_I2S_FLL_L_VAL_CTL_1 (0x0000014C)
-#define WCD9360_I2S_FLL_DSM_FRAC_CTL_0 (0x0000014D)
-#define WCD9360_I2S_FLL_DSM_FRAC_CTL_1 (0x0000014E)
-#define WCD9360_I2S_FLL_CONFIG_CTL_0 (0x0000014F)
-#define WCD9360_I2S_FLL_CONFIG_CTL_1 (0x00000150)
-#define WCD9360_I2S_FLL_CONFIG_CTL_2 (0x00000151)
-#define WCD9360_I2S_FLL_CONFIG_CTL_3 (0x00000152)
-#define WCD9360_I2S_FLL_CONFIG_CTL_4 (0x00000153)
-#define WCD9360_I2S_FLL_TEST_CTL_0 (0x00000154)
-#define WCD9360_I2S_FLL_TEST_CTL_1 (0x00000155)
-#define WCD9360_I2S_FLL_TEST_CTL_2 (0x00000156)
-#define WCD9360_I2S_FLL_TEST_CTL_3 (0x00000157)
-#define WCD9360_I2S_FLL_TEST_CTL_4 (0x00000158)
-#define WCD9360_I2S_FLL_TEST_CTL_5 (0x00000159)
-#define WCD9360_I2S_FLL_TEST_CTL_6 (0x0000015A)
-#define WCD9360_I2S_FLL_TEST_CTL_7 (0x0000015B)
-#define WCD9360_I2S_FLL_FREQ_CTL_0 (0x0000015C)
-#define WCD9360_I2S_FLL_FREQ_CTL_1 (0x0000015D)
-#define WCD9360_I2S_FLL_FREQ_CTL_2 (0x0000015E)
-#define WCD9360_I2S_FLL_FREQ_CTL_3 (0x0000015F)
-#define WCD9360_I2S_FLL_SSC_CTL_0 (0x00000160)
-#define WCD9360_I2S_FLL_SSC_CTL_1 (0x00000161)
-#define WCD9360_I2S_FLL_SSC_CTL_2 (0x00000162)
-#define WCD9360_I2S_FLL_SSC_CTL_3 (0x00000163)
-#define WCD9360_I2S_FLL_FLL_MODE (0x00000164)
-#define WCD9360_I2S_FLL_STATUS_0 (0x00000165)
-#define WCD9360_I2S_FLL_STATUS_1 (0x00000166)
-#define WCD9360_I2S_FLL_STATUS_2 (0x00000167)
-#define WCD9360_I2S_FLL_STATUS_3 (0x00000168)
-#define WCD9360_PAGE2_PAGE_REGISTER (0x00000200)
-#define WCD9360_CPE_SS_CPE_CTL (0x00000201)
-#define WCD9360_CPE_SS_PWR_SYS_PSTATE_CTL_0 (0x00000202)
-#define WCD9360_CPE_SS_PWR_SYS_PSTATE_CTL_1 (0x00000203)
-#define WCD9360_CPE_SS_PWR_CPEFLL_CTL (0x00000204)
-#define WCD9360_CPE_SS_PWR_CPE_SYSMEM_DEEPSLP_0 (0x00000205)
-#define WCD9360_CPE_SS_PWR_CPE_SYSMEM_DEEPSLP_1 (0x00000206)
-#define WCD9360_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_0 (0x00000208)
-#define WCD9360_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_1 (0x00000209)
-#define WCD9360_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_2 (0x0000020A)
-#define WCD9360_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_3 (0x0000020B)
-#define WCD9360_CPE_SS_PWR_CPE_SYSMEM_SHUTDOWN_4 (0x0000020C)
-#define WCD9360_CPE_SS_PWR_CPE_DRAM1_SHUTDOWN (0x0000020E)
-#define WCD9360_CPE_SS_US_BUF_INT_PERIOD (0x00000212)
-#define WCD9360_CPE_SS_CPARMAD_BUFRDY_INT_PERIOD (0x00000213)
-#define WCD9360_CPE_SS_SVA_CFG (0x00000214)
-#define WCD9360_CPE_SS_US_CFG (0x00000215)
-#define WCD9360_CPE_SS_MAD_CTL (0x00000216)
-#define WCD9360_CPE_SS_CPAR_CTL (0x00000217)
-#define WCD9360_CPE_SS_DMIC0_CTL (0x00000218)
-#define WCD9360_CPE_SS_DMIC1_CTL (0x00000219)
-#define WCD9360_CPE_SS_DMIC2_CTL (0x0000021A)
-#define WCD9360_CPE_SS_DMIC_CFG (0x0000021B)
-#define WCD9360_CPE_SS_CPAR_CFG (0x0000021C)
-#define WCD9360_CPE_SS_WDOG_CFG (0x0000021D)
-#define WCD9360_CPE_SS_BACKUP_INT (0x0000021E)
-#define WCD9360_CPE_SS_STATUS (0x0000021F)
-#define WCD9360_CPE_SS_CPE_OCD_CFG (0x00000220)
-#define WCD9360_CPE_SS_SS_ERROR_INT_MASK_0A (0x00000221)
-#define WCD9360_CPE_SS_SS_ERROR_INT_MASK_0B (0x00000222)
-#define WCD9360_CPE_SS_SS_ERROR_INT_MASK_1A (0x00000223)
-#define WCD9360_CPE_SS_SS_ERROR_INT_MASK_1B (0x00000224)
-#define WCD9360_CPE_SS_SS_ERROR_INT_STATUS_0A (0x00000225)
-#define WCD9360_CPE_SS_SS_ERROR_INT_STATUS_0B (0x00000226)
-#define WCD9360_CPE_SS_SS_ERROR_INT_STATUS_1A (0x00000227)
-#define WCD9360_CPE_SS_SS_ERROR_INT_STATUS_1B (0x00000228)
-#define WCD9360_CPE_SS_SS_ERROR_INT_CLEAR_0A (0x00000229)
-#define WCD9360_CPE_SS_SS_ERROR_INT_CLEAR_0B (0x0000022A)
-#define WCD9360_CPE_SS_SS_ERROR_INT_CLEAR_1A (0x0000022B)
-#define WCD9360_CPE_SS_SS_ERROR_INT_CLEAR_1B (0x0000022C)
-#define WCD9360_CPE_SS_DMIC3_CTL (0x00000231)
-#define WCD9360_CPE_SS_WDOG_RESET (0x00000239)
-#define WCD9360_CPE_SS_LPASS_MCLK_PRG (0x00000240)
-#define WCD9360_CPE_SS_LPASS_IPC_IN_0 (0x00000241)
-#define WCD9360_CPE_SS_LPASS_IPC_IN_1 (0x00000242)
-#define WCD9360_CPE_SS_LPASS_IPC_IN_2 (0x00000243)
-#define WCD9360_CPE_SS_LPASS_IPC_IN_3 (0x00000244)
-#define WCD9360_CPE_SS_LPASS_IPC_IN_4 (0x00000245)
-#define WCD9360_CPE_SS_LPASS_IPC_IN_5 (0x00000246)
-#define WCD9360_CPE_SS_LPASS_IPC_IN_6 (0x00000247)
-#define WCD9360_CPE_SS_LPASS_IPC_IN_7 (0x00000248)
-#define WCD9360_CPE_SS_LPASS_IPC_IN_8 (0x00000249)
-#define WCD9360_CPE_SS_LPASS_IPC_IN_9 (0x0000024A)
-#define WCD9360_CPE_SS_LPASS_IPC_IN_10 (0x0000024B)
-#define WCD9360_CPE_SS_LPASS_IPC_IN_11 (0x0000024C)
-#define WCD9360_CPE_SS_LPASS_IPC_IN_12 (0x0000024D)
-#define WCD9360_CPE_SS_LPASS_IPC_IN_13 (0x0000024E)
-#define WCD9360_CPE_SS_LPASS_IPC_IN_14 (0x0000024F)
-#define WCD9360_CPE_SS_LPASS_IPC_IN_15 (0x00000250)
-#define WCD9360_CPE_SS_LPASS_IPC_OUT_0 (0x00000251)
-#define WCD9360_CPE_SS_LPASS_IPC_OUT_1 (0x00000252)
-#define WCD9360_CPE_SS_LPASS_IPC_OUT_2 (0x00000253)
-#define WCD9360_CPE_SS_LPASS_IPC_OUT_3 (0x00000254)
-#define WCD9360_CPE_SS_LPASS_IPC_OUT_4 (0x00000255)
-#define WCD9360_CPE_SS_LPASS_IPC_OUT_5 (0x00000256)
-#define WCD9360_CPE_SS_LPASS_IPC_OUT_6 (0x00000257)
-#define WCD9360_CPE_SS_LPASS_IPC_OUT_7 (0x00000258)
-#define WCD9360_CPE_SS_LPASS_IPC_OUT_8 (0x00000259)
-#define WCD9360_CPE_SS_LPASS_IPC_OUT_9 (0x0000025A)
-#define WCD9360_CPE_SS_LPASS_IPC_OUT_10 (0x0000025B)
-#define WCD9360_CPE_SS_LPASS_IPC_OUT_11 (0x0000025C)
-#define WCD9360_CPE_SS_LPASS_IPC_OUT_12 (0x0000025D)
-#define WCD9360_CPE_SS_LPASS_IPC_OUT_13 (0x0000025E)
-#define WCD9360_CPE_SS_LPASS_IPC_OUT_14 (0x0000025F)
-#define WCD9360_CPE_SS_LPASS_IPC_OUT_15 (0x00000260)
-#define WCD9360_CPE_SS_LPASS_ARB_CTL (0x00000261)
-#define WCD9360_CPE_SS_MEM_DEEPSLEEP_RD_0 (0x00000271)
-#define WCD9360_CPE_SS_MEM_DEEPSLEEP_RD_1 (0x00000272)
-#define WCD9360_CPE_SS_MEM_DEEPSLEEP_BYPASS_0 (0x00000273)
-#define WCD9360_CPE_SS_MEM_DEEPSLEEP_BYPASS_1 (0x00000274)
-#define WCD9360_SOC_MAD_MAIN_CTL_1 (0x00000281)
-#define WCD9360_SOC_MAD_MAIN_CTL_2 (0x00000282)
-#define WCD9360_SOC_MAD_AUDIO_CTL_1 (0x00000283)
-#define WCD9360_SOC_MAD_AUDIO_CTL_2 (0x00000284)
-#define WCD9360_SOC_MAD_AUDIO_CTL_3 (0x00000285)
-#define WCD9360_SOC_MAD_AUDIO_CTL_4 (0x00000286)
-#define WCD9360_SOC_MAD_AUDIO_CTL_5 (0x00000287)
-#define WCD9360_SOC_MAD_AUDIO_CTL_6 (0x00000288)
-#define WCD9360_SOC_MAD_AUDIO_CTL_7 (0x00000289)
-#define WCD9360_SOC_MAD_AUDIO_CTL_8 (0x0000028A)
-#define WCD9360_SOC_MAD_AUDIO_IIR_CTL_PTR (0x0000028B)
-#define WCD9360_SOC_MAD_AUDIO_IIR_CTL_VAL (0x0000028C)
-#define WCD9360_SOC_MAD_ULTR_CTL_1 (0x0000028D)
-#define WCD9360_SOC_MAD_ULTR_CTL_2 (0x0000028E)
-#define WCD9360_SOC_MAD_ULTR_CTL_3 (0x0000028F)
-#define WCD9360_SOC_MAD_ULTR_CTL_4 (0x00000290)
-#define WCD9360_SOC_MAD_ULTR_CTL_5 (0x00000291)
-#define WCD9360_SOC_MAD_ULTR_CTL_6 (0x00000292)
-#define WCD9360_SOC_MAD_ULTR_CTL_7 (0x00000293)
-#define WCD9360_SOC_MAD_BEACON_CTL_1 (0x00000294)
-#define WCD9360_SOC_MAD_BEACON_CTL_2 (0x00000295)
-#define WCD9360_SOC_MAD_BEACON_CTL_3 (0x00000296)
-#define WCD9360_SOC_MAD_BEACON_CTL_4 (0x00000297)
-#define WCD9360_SOC_MAD_BEACON_CTL_5 (0x00000298)
-#define WCD9360_SOC_MAD_BEACON_CTL_6 (0x00000299)
-#define WCD9360_SOC_MAD_BEACON_CTL_7 (0x0000029A)
-#define WCD9360_SOC_MAD_BEACON_CTL_8 (0x0000029B)
-#define WCD9360_SOC_MAD_BEACON_IIR_CTL_PTR (0x0000029C)
-#define WCD9360_SOC_MAD_BEACON_IIR_CTL_VAL (0x0000029D)
-#define WCD9360_SOC_MAD_INP_SEL (0x0000029E)
-#define WCD9360_SOC_MAD_MAD2_INP_SEL (0x0000029F)
-#define WCD9360_SWR_SAMPLE_PACK_SWR_SAMPLE_PACK_CTRL (0x000002B1)
-#define WCD9360_SWR_SAMPLE_PACK_SWR_SAMPLE_PACK_STATUS (0x000002B2)
-#define WCD9360_SWR_SAMPLE_PACK_SWR_SAMPLE_PACK_FS (0x000002B3)
-#define WCD9360_SWR_SAMPLE_PACK_SWR_SAMPLE_PACK_IN_SEL (0x000002B4)
-#define WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT0 (0x000002C1)
-#define WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT1 (0x000002C2)
-#define WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT2 (0x000002C3)
-#define WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT3 (0x000002C4)
-#define WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT4 (0x000002C5)
-#define WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT5 (0x000002C6)
-#define WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT6 (0x000002C7)
-#define WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT7 (0x000002C8)
-#define WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT8 (0x000002C9)
-#define WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT9 (0x000002CA)
-#define WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT10 (0x000002CB)
-#define WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT11 (0x000002CC)
-#define WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT12 (0x000002CD)
-#define WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT13 (0x000002CE)
-#define WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT14 (0x000002CF)
-#define WCD9360_EFUSE_VALUE_EFUSE_VAL_OUT15 (0x000002D0)
-#define WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT0 (0x000002D1)
-#define WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT1 (0x000002D2)
-#define WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT2 (0x000002D3)
-#define WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT3 (0x000002D4)
-#define WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT4 (0x000002D5)
-#define WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT5 (0x000002D6)
-#define WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT6 (0x000002D7)
-#define WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT7 (0x000002D8)
-#define WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT8 (0x000002D9)
-#define WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT9 (0x000002DA)
-#define WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT10 (0x000002DB)
-#define WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT11 (0x000002DC)
-#define WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT12 (0x000002DD)
-#define WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT13 (0x000002DE)
-#define WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT14 (0x000002DF)
-#define WCD9360_EFUSE_VALUE_EFUSE2_VAL_OUT15 (0x000002E0)
-#define WCD9360_PAGE4_PAGE_REGISTER (0x00000400)
-#define WCD9360_INTR_CFG (0x00000401)
-#define WCD9360_INTR_CLR_COMMIT (0x00000402)
-#define WCD9360_INTR_PIN1_MASK0 (0x00000409)
-#define WCD9360_INTR_PIN1_MASK1 (0x0000040A)
-#define WCD9360_INTR_PIN1_MASK2 (0x0000040B)
-#define WCD9360_INTR_PIN1_MASK3 (0x0000040C)
-#define WCD9360_INTR_PIN1_STATUS0 (0x00000411)
-#define WCD9360_INTR_PIN1_STATUS1 (0x00000412)
-#define WCD9360_INTR_PIN1_STATUS2 (0x00000413)
-#define WCD9360_INTR_PIN1_STATUS3 (0x00000414)
-#define WCD9360_INTR_PIN1_CLEAR0 (0x00000419)
-#define WCD9360_INTR_PIN1_CLEAR1 (0x0000041A)
-#define WCD9360_INTR_PIN1_CLEAR2 (0x0000041B)
-#define WCD9360_INTR_PIN1_CLEAR3 (0x0000041C)
-#define WCD9360_INTR_PIN2_MASK3 (0x00000424)
-#define WCD9360_INTR_PIN2_STATUS3 (0x0000042C)
-#define WCD9360_INTR_PIN2_CLEAR3 (0x00000434)
-#define WCD9360_INTR_CPESS_SUMRY_MASK2 (0x0000043B)
-#define WCD9360_INTR_CPESS_SUMRY_MASK3 (0x0000043C)
-#define WCD9360_INTR_CPESS_SUMRY_STATUS2 (0x00000443)
-#define WCD9360_INTR_CPESS_SUMRY_STATUS3 (0x00000444)
-#define WCD9360_INTR_CPESS_SUMRY_CLEAR2 (0x0000044B)
-#define WCD9360_INTR_CPESS_SUMRY_CLEAR3 (0x0000044C)
-#define WCD9360_INTR_LEVEL0 (0x00000461)
-#define WCD9360_INTR_LEVEL1 (0x00000462)
-#define WCD9360_INTR_LEVEL2 (0x00000463)
-#define WCD9360_INTR_LEVEL3 (0x00000464)
-#define WCD9360_INTR_BYPASS0 (0x00000469)
-#define WCD9360_INTR_BYPASS1 (0x0000046A)
-#define WCD9360_INTR_BYPASS2 (0x0000046B)
-#define WCD9360_INTR_BYPASS3 (0x0000046C)
-#define WCD9360_INTR_SET0 (0x00000471)
-#define WCD9360_INTR_SET1 (0x00000472)
-#define WCD9360_INTR_SET2 (0x00000473)
-#define WCD9360_INTR_SET3 (0x00000474)
-#define WCD9360_INTR_CODEC_MISC_MASK (0x000004B1)
-#define WCD9360_INTR_CODEC_MISC_STATUS (0x000004B2)
-#define WCD9360_INTR_CODEC_MISC_CLEAR (0x000004B3)
-#define WCD9360_ANA_PAGE_REGISTER (0x00000600)
-#define WCD9360_ANA_BIAS (0x00000601)
-#define WCD9360_ANA_AMIC_INPUT_SWITCH_CTL (0x00000602)
-#define WCD9360_ANA_RCO (0x00000603)
-#define WCD9360_ANA_BUCK_CTL (0x00000606)
-#define WCD9360_ANA_BUCK_STATUS (0x00000607)
-#define WCD9360_ANA_EAR (0x0000060A)
-#define WCD9360_ANA_MAD_SETUP (0x0000060D)
-#define WCD9360_ANA_AMIC1 (0x0000060E)
-#define WCD9360_ANA_AMIC2 (0x0000060F)
-#define WCD9360_ANA_AMIC3 (0x00000610)
-#define WCD9360_ANA_AMIC4 (0x00000611)
-#define WCD9360_ANA_MICB1 (0x00000622)
-#define WCD9360_ANA_MICB2 (0x00000623)
-#define WCD9360_ANA_MICB3 (0x00000625)
-#define WCD9360_ANA_MICB4 (0x00000626)
-#define WCD9360_BIAS_CTL (0x00000628)
-#define WCD9360_BIAS_VBG_FINE_ADJ (0x00000629)
-#define WCD9360_RCO_CTRL_1 (0x0000062E)
-#define WCD9360_RCO_CTRL_2 (0x0000062F)
-#define WCD9360_RCO_CAL (0x00000630)
-#define WCD9360_RCO_CAL_1 (0x00000631)
-#define WCD9360_RCO_CAL_2 (0x00000632)
-#define WCD9360_RCO_TEST_CTRL (0x00000633)
-#define WCD9360_RCO_CAL_OUT_1 (0x00000634)
-#define WCD9360_RCO_CAL_OUT_2 (0x00000635)
-#define WCD9360_RCO_CAL_OUT_3 (0x00000636)
-#define WCD9360_RCO_CAL_OUT_4 (0x00000637)
-#define WCD9360_RCO_CAL_OUT_5 (0x00000638)
-#define WCD9360_SIDO_MODE_1 (0x0000063A)
-#define WCD9360_SIDO_MODE_2 (0x0000063B)
-#define WCD9360_SIDO_MODE_3 (0x0000063C)
-#define WCD9360_SIDO_MODE_4 (0x0000063D)
-#define WCD9360_SIDO_VCL_1 (0x0000063E)
-#define WCD9360_SIDO_VCL_2 (0x0000063F)
-#define WCD9360_SIDO_VCL_3 (0x00000640)
-#define WCD9360_SIDO_CCL_1 (0x00000641)
-#define WCD9360_SIDO_CCL_2 (0x00000642)
-#define WCD9360_SIDO_CCL_3 (0x00000643)
-#define WCD9360_SIDO_CCL_4 (0x00000644)
-#define WCD9360_SIDO_CCL_5 (0x00000645)
-#define WCD9360_SIDO_CCL_6 (0x00000646)
-#define WCD9360_SIDO_CCL_7 (0x00000647)
-#define WCD9360_SIDO_CCL_8 (0x00000648)
-#define WCD9360_SIDO_CCL_9 (0x00000649)
-#define WCD9360_SIDO_CCL_10 (0x0000064A)
-#define WCD9360_SIDO_FILTER_1 (0x0000064B)
-#define WCD9360_SIDO_FILTER_2 (0x0000064C)
-#define WCD9360_SIDO_DRIVER_1 (0x0000064D)
-#define WCD9360_SIDO_DRIVER_2 (0x0000064E)
-#define WCD9360_SIDO_DRIVER_3 (0x0000064F)
-#define WCD9360_SIDO_CAL_CODE_EXT_1 (0x00000650)
-#define WCD9360_SIDO_CAL_CODE_EXT_2 (0x00000651)
-#define WCD9360_SIDO_CAL_CODE_OUT_1 (0x00000652)
-#define WCD9360_SIDO_CAL_CODE_OUT_2 (0x00000653)
-#define WCD9360_SIDO_TEST_1 (0x00000654)
-#define WCD9360_SIDO_TEST_2 (0x00000655)
-#define WCD9360_LDOH_MODE (0x00000667)
-#define WCD9360_LDOH_BIAS (0x00000668)
-#define WCD9360_LDOH_STB_LOADS (0x00000669)
-#define WCD9360_LDOH_SLOWRAMP (0x0000066A)
-#define WCD9360_MICB1_TEST_CTL_1 (0x0000066B)
-#define WCD9360_MICB1_TEST_CTL_2 (0x0000066C)
-#define WCD9360_MICB1_TEST_CTL_3 (0x0000066D)
-#define WCD9360_MICB2_TEST_CTL_1 (0x0000066E)
-#define WCD9360_MICB2_TEST_CTL_2 (0x0000066F)
-#define WCD9360_MICB2_TEST_CTL_3 (0x00000670)
-#define WCD9360_MICB3_TEST_CTL_1 (0x00000671)
-#define WCD9360_MICB3_TEST_CTL_2 (0x00000672)
-#define WCD9360_MICB3_TEST_CTL_3 (0x00000673)
-#define WCD9360_MICB4_TEST_CTL_1 (0x00000674)
-#define WCD9360_MICB4_TEST_CTL_2 (0x00000675)
-#define WCD9360_MICB4_TEST_CTL_3 (0x00000676)
-#define WCD9360_TX_COM_ADC_VCM (0x00000677)
-#define WCD9360_TX_COM_BIAS_ATEST (0x00000678)
-#define WCD9360_TX_COM_ADC_INT1_IB (0x00000679)
-#define WCD9360_TX_COM_ADC_INT2_IB (0x0000067A)
-#define WCD9360_TX_COM_TXFE_DIV_CTL (0x0000067B)
-#define WCD9360_TX_COM_TXFE_DIV_START (0x0000067C)
-#define WCD9360_TX_COM_TXFE_DIV_STOP_9P6M (0x0000067D)
-#define WCD9360_TX_COM_TXFE_DIV_STOP_12P288M (0x0000067E)
-#define WCD9360_TX_1_2_TEST_EN (0x0000067F)
-#define WCD9360_TX_1_2_ADC_IB (0x00000680)
-#define WCD9360_TX_1_2_ATEST_REFCTL (0x00000681)
-#define WCD9360_TX_1_2_TEST_CTL (0x00000682)
-#define WCD9360_TX_1_2_TEST_BLK_EN (0x00000683)
-#define WCD9360_TX_1_2_TXFE_CLKDIV (0x00000684)
-#define WCD9360_TX_1_2_SAR1_ERR (0x00000685)
-#define WCD9360_TX_1_2_SAR2_ERR (0x00000686)
-#define WCD9360_TX_3_4_TEST_EN (0x00000687)
-#define WCD9360_TX_3_4_ADC_IB (0x00000688)
-#define WCD9360_TX_3_4_ATEST_REFCTL (0x00000689)
-#define WCD9360_TX_3_4_TEST_CTL (0x0000068A)
-#define WCD9360_TX_3_4_TEST_BLK_EN (0x0000068B)
-#define WCD9360_TX_3_4_TXFE_CLKDIV (0x0000068C)
-#define WCD9360_TX_3_4_SAR1_ERR (0x0000068D)
-#define WCD9360_TX_3_4_SAR2_ERR (0x0000068E)
-#define WCD9360_RX_RX_EAR_BIAS_CON_1 (0x000006B3)
-#define WCD9360_RX_RX_EAR_BIAS_CON_2 (0x000006B4)
-#define WCD9360_RX_RX_AUX_BIAS_CON_1 (0x000006B5)
-#define WCD9360_RX_RX_AUX_BIAS_CON_2 (0x000006B6)
-#define WCD9360_RX_RX_BIAS_ATEST (0x000006B7)
-#define WCD9360_RX_RXTOP_RESERVED (0x000006B8)
-#define WCD9360_EAR_EAR_EN_REG (0x000006E1)
-#define WCD9360_EAR_EAR_PA_CON (0x000006E2)
-#define WCD9360_EAR_EAR_SP_CON (0x000006E3)
-#define WCD9360_EAR_EAR_DAC_CON (0x000006E4)
-#define WCD9360_EAR_EAR_CNP_FSM_CON (0x000006E5)
-#define WCD9360_EAR_DAC_CTL_TEST (0x000006E6)
-#define WCD9360_EAR_STATUS_REG (0x000006E7)
-#define WCD9360_EAR_EAR_COMPANDER_CON (0x000006E8)
-#define WCD9360_ANA_NEW_PAGE_REGISTER (0x00000700)
-#define WCD9360_CLK_SYS_PLL_ENABLES (0x0000070E)
-#define WCD9360_CLK_SYS_PLL_PRESET (0x0000070F)
-#define WCD9360_CLK_SYS_PLL_STATUS (0x00000710)
-#define WCD9360_CLK_SYS_MCLK_PRG (0x00000711)
-#define WCD9360_CLK_SYS_MCLK2_PRG1 (0x00000712)
-#define WCD9360_CLK_SYS_MCLK_MISC (0x00000713)
-#define WCD9360_SIDO_NEW_VOUT_A_STARTUP (0x0000071B)
-#define WCD9360_SIDO_NEW_VOUT_D_STARTUP (0x0000071C)
-#define WCD9360_SIDO_NEW_VOUT_D_FREQ1 (0x0000071D)
-#define WCD9360_SIDO_NEW_VOUT_D_FREQ2 (0x0000071E)
-#define WCD9360_AUX_ANA_EAR (0x00000728)
-#define WCD9360_LDORXTX_LDORXTX (0x00000729)
-#define WCD9360_DIE_CRACK_CTL (0x0000072A)
-#define WCD9360_DIE_CRACK_OUT (0x0000072B)
-#define WCD9360_LOOP_BACK_EN (0x0000072C)
-#define WCD9360_CLK_SYS_INT_POST_DIV_REG0 (0x0000076C)
-#define WCD9360_CLK_SYS_INT_POST_DIV_REG1 (0x0000076D)
-#define WCD9360_CLK_SYS_INT_REF_DIV_REG0 (0x0000076E)
-#define WCD9360_CLK_SYS_INT_REF_DIV_REG1 (0x0000076F)
-#define WCD9360_CLK_SYS_INT_FILTER_REG0 (0x00000770)
-#define WCD9360_CLK_SYS_INT_FILTER_REG1 (0x00000771)
-#define WCD9360_CLK_SYS_INT_PLL_L_VAL (0x00000772)
-#define WCD9360_CLK_SYS_INT_PLL_M_VAL (0x00000773)
-#define WCD9360_CLK_SYS_INT_PLL_N_VAL (0x00000774)
-#define WCD9360_CLK_SYS_INT_TEST_REG0 (0x00000775)
-#define WCD9360_CLK_SYS_INT_PFD_CP_DSM_PROG (0x00000776)
-#define WCD9360_CLK_SYS_INT_VCO_PROG (0x00000777)
-#define WCD9360_CLK_SYS_INT_TEST_REG1 (0x00000778)
-#define WCD9360_CLK_SYS_INT_LDO_LOCK_CFG (0x00000779)
-#define WCD9360_CLK_SYS_INT_DIG_LOCK_DET_CFG (0x0000077A)
-#define WCD9360_CLK_SYS_INT_CLK_TEST1 (0x0000077B)
-#define WCD9360_CLK_SYS_INT_CLK_TEST2 (0x0000077C)
-#define WCD9360_CLK_SYS_INT_CLK_TEST3 (0x0000077D)
-#define WCD9360_SIDO_NEW_INT_RAMP_STATUS (0x00000796)
-#define WCD9360_SIDO_NEW_INT_SPARE_1 (0x00000797)
-#define WCD9360_SIDO_NEW_INT_DEBUG_VOUT_SETTING_A (0x00000798)
-#define WCD9360_SIDO_NEW_INT_DEBUG_VOUT_SETTING_D (0x00000799)
-#define WCD9360_SIDO_NEW_INT_RAMP_INC_WAIT (0x0000079A)
-#define WCD9360_SIDO_NEW_INT_DYNAMIC_IPEAK_CTL (0x0000079B)
-#define WCD9360_SIDO_NEW_INT_RAMP_IBLEED_CTL (0x0000079C)
-#define WCD9360_SIDO_NEW_INT_DEBUG_CPROVR_TEST (0x0000079D)
-#define WCD9360_SIDO_NEW_INT_RAMP_CTL_A (0x0000079E)
-#define WCD9360_SIDO_NEW_INT_RAMP_CTL_D (0x0000079F)
-#define WCD9360_SIDO_NEW_INT_RAMP_TIMEOUT_PERIOD (0x000007A0)
-#define WCD9360_SIDO_NEW_INT_DYNAMIC_IPEAK_SETTING1 (0x000007A1)
-#define WCD9360_SIDO_NEW_INT_DYNAMIC_IPEAK_SETTING2 (0x000007A2)
-#define WCD9360_SIDO_NEW_INT_DYNAMIC_IPEAK_SETTING3 (0x000007A3)
-#define WCD9360_SIDO_NEW_INT_HIGH_ACCU_MODE_SEL1 (0x000007A4)
-#define WCD9360_SIDO_NEW_INT_HIGH_ACCU_MODE_SEL2 (0x000007A5)
-#define WCD9360_EAR_INT_NEW_EAR_CHOPPER_CON (0x000007B7)
-#define WCD9360_EAR_INT_NEW_EAR_VCM_GEN_CON1 (0x000007B8)
-#define WCD9360_EAR_INT_NEW_EAR_VCM_GEN_CON2 (0x000007B9)
-#define WCD9360_EAR_INT_NEW_EAR_DYNAMIC_BIAS (0x000007BA)
-#define WCD9360_AUX_INT_AUX_EN_REG (0x000007BD)
-#define WCD9360_AUX_INT_AUX_PA_CON (0x000007BE)
-#define WCD9360_AUX_INT_AUX_SP_CON (0x000007BF)
-#define WCD9360_AUX_INT_AUX_DAC_CON (0x000007C0)
-#define WCD9360_AUX_INT_AUX_CNP_FSM_CON (0x000007C1)
-#define WCD9360_AUX_INT_AUX_TEST (0x000007C2)
-#define WCD9360_AUX_INT_STATUS_REG (0x000007C3)
-#define WCD9360_AUX_INT_AUX_MISC (0x000007C4)
-#define WCD9360_LDORXTX_INT_ANA_LDORXTX_CTRL1 (0x000007C5)
-#define WCD9360_LDORXTX_INT_ANA_LDORXTX_CTRL2 (0x000007C6)
-#define WCD9360_LDORXTX_INT_ANA_LDORXTX_CTRL3 (0x000007C7)
-#define WCD9360_LDORXTX_INT_ANA_LDORXTX_CTRL4 (0x000007C8)
-#define WCD9360_LDORXTX_INT_ANA_LDORXTX_CTRL5 (0x000007C9)
-#define WCD9360_LDORXTX_INT_ANA_LDORXTX_STATUS (0x000007CA)
-#define WCD9360_DIE_CRACK_INT_INT1 (0x000007CC)
-#define WCD9360_DIE_CRACK_INT_INT2 (0x000007CD)
-#define WCD9360_LOOP_BACK_INT_SPARE (0x000007CE)
-#define WCD9360_PAGE10_PAGE_REGISTER (0x00000A00)
-#define WCD9360_CDC_ANC0_CLK_RESET_CTL (0x00000A01)
-#define WCD9360_CDC_ANC0_MODE_1_CTL (0x00000A02)
-#define WCD9360_CDC_ANC0_MODE_2_CTL (0x00000A03)
-#define WCD9360_CDC_ANC0_FF_SHIFT (0x00000A04)
-#define WCD9360_CDC_ANC0_FB_SHIFT (0x00000A05)
-#define WCD9360_CDC_ANC0_LPF_FF_A_CTL (0x00000A06)
-#define WCD9360_CDC_ANC0_LPF_FF_B_CTL (0x00000A07)
-#define WCD9360_CDC_ANC0_LPF_FB_CTL (0x00000A08)
-#define WCD9360_CDC_ANC0_SMLPF_CTL (0x00000A09)
-#define WCD9360_CDC_ANC0_DCFLT_SHIFT_CTL (0x00000A0A)
-#define WCD9360_CDC_ANC0_IIR_ADAPT_CTL (0x00000A0B)
-#define WCD9360_CDC_ANC0_IIR_COEFF_1_CTL (0x00000A0C)
-#define WCD9360_CDC_ANC0_IIR_COEFF_2_CTL (0x00000A0D)
-#define WCD9360_CDC_ANC0_FF_A_GAIN_CTL (0x00000A0E)
-#define WCD9360_CDC_ANC0_FF_B_GAIN_CTL (0x00000A0F)
-#define WCD9360_CDC_ANC0_FB_GAIN_CTL (0x00000A10)
-#define WCD9360_CDC_TX0_TX_PATH_CTL (0x00000A31)
-#define WCD9360_CDC_TX0_TX_PATH_CFG0 (0x00000A32)
-#define WCD9360_CDC_TX0_TX_PATH_CFG1 (0x00000A33)
-#define WCD9360_CDC_TX0_TX_VOL_CTL (0x00000A34)
-#define WCD9360_CDC_TX0_TX_PATH_192_CTL (0x00000A35)
-#define WCD9360_CDC_TX0_TX_PATH_192_CFG (0x00000A36)
-#define WCD9360_CDC_TX0_TX_PATH_SEC0 (0x00000A37)
-#define WCD9360_CDC_TX0_TX_PATH_SEC1 (0x00000A38)
-#define WCD9360_CDC_TX0_TX_PATH_SEC2 (0x00000A39)
-#define WCD9360_CDC_TX0_TX_PATH_SEC3 (0x00000A3A)
-#define WCD9360_CDC_TX0_TX_PATH_SEC4 (0x00000A3B)
-#define WCD9360_CDC_TX0_TX_PATH_SEC5 (0x00000A3C)
-#define WCD9360_CDC_TX0_TX_PATH_SEC6 (0x00000A3D)
-#define WCD9360_CDC_TX1_TX_PATH_CTL (0x00000A41)
-#define WCD9360_CDC_TX1_TX_PATH_CFG0 (0x00000A42)
-#define WCD9360_CDC_TX1_TX_PATH_CFG1 (0x00000A43)
-#define WCD9360_CDC_TX1_TX_VOL_CTL (0x00000A44)
-#define WCD9360_CDC_TX1_TX_PATH_192_CTL (0x00000A45)
-#define WCD9360_CDC_TX1_TX_PATH_192_CFG (0x00000A46)
-#define WCD9360_CDC_TX1_TX_PATH_SEC0 (0x00000A47)
-#define WCD9360_CDC_TX1_TX_PATH_SEC1 (0x00000A48)
-#define WCD9360_CDC_TX1_TX_PATH_SEC2 (0x00000A49)
-#define WCD9360_CDC_TX1_TX_PATH_SEC3 (0x00000A4A)
-#define WCD9360_CDC_TX1_TX_PATH_SEC4 (0x00000A4B)
-#define WCD9360_CDC_TX1_TX_PATH_SEC5 (0x00000A4C)
-#define WCD9360_CDC_TX1_TX_PATH_SEC6 (0x00000A4D)
-#define WCD9360_CDC_TX2_TX_PATH_CTL (0x00000A51)
-#define WCD9360_CDC_TX2_TX_PATH_CFG0 (0x00000A52)
-#define WCD9360_CDC_TX2_TX_PATH_CFG1 (0x00000A53)
-#define WCD9360_CDC_TX2_TX_VOL_CTL (0x00000A54)
-#define WCD9360_CDC_TX2_TX_PATH_192_CTL (0x00000A55)
-#define WCD9360_CDC_TX2_TX_PATH_192_CFG (0x00000A56)
-#define WCD9360_CDC_TX2_TX_PATH_SEC0 (0x00000A57)
-#define WCD9360_CDC_TX2_TX_PATH_SEC1 (0x00000A58)
-#define WCD9360_CDC_TX2_TX_PATH_SEC2 (0x00000A59)
-#define WCD9360_CDC_TX2_TX_PATH_SEC3 (0x00000A5A)
-#define WCD9360_CDC_TX2_TX_PATH_SEC4 (0x00000A5B)
-#define WCD9360_CDC_TX2_TX_PATH_SEC5 (0x00000A5C)
-#define WCD9360_CDC_TX2_TX_PATH_SEC6 (0x00000A5D)
-#define WCD9360_CDC_TX3_TX_PATH_CTL (0x00000A61)
-#define WCD9360_CDC_TX3_TX_PATH_CFG0 (0x00000A62)
-#define WCD9360_CDC_TX3_TX_PATH_CFG1 (0x00000A63)
-#define WCD9360_CDC_TX3_TX_VOL_CTL (0x00000A64)
-#define WCD9360_CDC_TX3_TX_PATH_192_CTL (0x00000A65)
-#define WCD9360_CDC_TX3_TX_PATH_192_CFG (0x00000A66)
-#define WCD9360_CDC_TX3_TX_PATH_SEC0 (0x00000A67)
-#define WCD9360_CDC_TX3_TX_PATH_SEC1 (0x00000A68)
-#define WCD9360_CDC_TX3_TX_PATH_SEC2 (0x00000A69)
-#define WCD9360_CDC_TX3_TX_PATH_SEC3 (0x00000A6A)
-#define WCD9360_CDC_TX3_TX_PATH_SEC4 (0x00000A6B)
-#define WCD9360_CDC_TX3_TX_PATH_SEC5 (0x00000A6C)
-#define WCD9360_CDC_TX3_TX_PATH_SEC6 (0x00000A6D)
-#define WCD9360_CDC_TX4_TX_PATH_CTL (0x00000A71)
-#define WCD9360_CDC_TX4_TX_PATH_CFG0 (0x00000A72)
-#define WCD9360_CDC_TX4_TX_PATH_CFG1 (0x00000A73)
-#define WCD9360_CDC_TX4_TX_VOL_CTL (0x00000A74)
-#define WCD9360_CDC_TX4_TX_PATH_192_CTL (0x00000A75)
-#define WCD9360_CDC_TX4_TX_PATH_192_CFG (0x00000A76)
-#define WCD9360_CDC_TX4_TX_PATH_SEC0 (0x00000A77)
-#define WCD9360_CDC_TX4_TX_PATH_SEC1 (0x00000A78)
-#define WCD9360_CDC_TX4_TX_PATH_SEC2 (0x00000A79)
-#define WCD9360_CDC_TX4_TX_PATH_SEC3 (0x00000A7A)
-#define WCD9360_CDC_TX4_TX_PATH_SEC4 (0x00000A7B)
-#define WCD9360_CDC_TX4_TX_PATH_SEC5 (0x00000A7C)
-#define WCD9360_CDC_TX4_TX_PATH_SEC6 (0x00000A7D)
-#define WCD9360_CDC_TX5_TX_PATH_CTL (0x00000A81)
-#define WCD9360_CDC_TX5_TX_PATH_CFG0 (0x00000A82)
-#define WCD9360_CDC_TX5_TX_PATH_CFG1 (0x00000A83)
-#define WCD9360_CDC_TX5_TX_VOL_CTL (0x00000A84)
-#define WCD9360_CDC_TX5_TX_PATH_192_CTL (0x00000A85)
-#define WCD9360_CDC_TX5_TX_PATH_192_CFG (0x00000A86)
-#define WCD9360_CDC_TX5_TX_PATH_SEC0 (0x00000A87)
-#define WCD9360_CDC_TX5_TX_PATH_SEC1 (0x00000A88)
-#define WCD9360_CDC_TX5_TX_PATH_SEC2 (0x00000A89)
-#define WCD9360_CDC_TX5_TX_PATH_SEC3 (0x00000A8A)
-#define WCD9360_CDC_TX5_TX_PATH_SEC4 (0x00000A8B)
-#define WCD9360_CDC_TX5_TX_PATH_SEC5 (0x00000A8C)
-#define WCD9360_CDC_TX5_TX_PATH_SEC6 (0x00000A8D)
-#define WCD9360_CDC_TX6_TX_PATH_CTL (0x00000A91)
-#define WCD9360_CDC_TX6_TX_PATH_CFG0 (0x00000A92)
-#define WCD9360_CDC_TX6_TX_PATH_CFG1 (0x00000A93)
-#define WCD9360_CDC_TX6_TX_VOL_CTL (0x00000A94)
-#define WCD9360_CDC_TX6_TX_PATH_192_CTL (0x00000A95)
-#define WCD9360_CDC_TX6_TX_PATH_192_CFG (0x00000A96)
-#define WCD9360_CDC_TX6_TX_PATH_SEC0 (0x00000A97)
-#define WCD9360_CDC_TX6_TX_PATH_SEC1 (0x00000A98)
-#define WCD9360_CDC_TX6_TX_PATH_SEC2 (0x00000A99)
-#define WCD9360_CDC_TX6_TX_PATH_SEC3 (0x00000A9A)
-#define WCD9360_CDC_TX6_TX_PATH_SEC4 (0x00000A9B)
-#define WCD9360_CDC_TX6_TX_PATH_SEC5 (0x00000A9C)
-#define WCD9360_CDC_TX6_TX_PATH_SEC6 (0x00000A9D)
-#define WCD9360_CDC_TX7_TX_PATH_CTL (0x00000AA1)
-#define WCD9360_CDC_TX7_TX_PATH_CFG0 (0x00000AA2)
-#define WCD9360_CDC_TX7_TX_PATH_CFG1 (0x00000AA3)
-#define WCD9360_CDC_TX7_TX_VOL_CTL (0x00000AA4)
-#define WCD9360_CDC_TX7_TX_PATH_192_CTL (0x00000AA5)
-#define WCD9360_CDC_TX7_TX_PATH_192_CFG (0x00000AA6)
-#define WCD9360_CDC_TX7_TX_PATH_SEC0 (0x00000AA7)
-#define WCD9360_CDC_TX7_TX_PATH_SEC1 (0x00000AA8)
-#define WCD9360_CDC_TX7_TX_PATH_SEC2 (0x00000AA9)
-#define WCD9360_CDC_TX7_TX_PATH_SEC3 (0x00000AAA)
-#define WCD9360_CDC_TX7_TX_PATH_SEC4 (0x00000AAB)
-#define WCD9360_CDC_TX7_TX_PATH_SEC5 (0x00000AAC)
-#define WCD9360_CDC_TX7_TX_PATH_SEC6 (0x00000AAD)
-#define WCD9360_CDC_TX8_TX_PATH_CTL (0x00000AB1)
-#define WCD9360_CDC_TX8_TX_PATH_CFG0 (0x00000AB2)
-#define WCD9360_CDC_TX8_TX_PATH_CFG1 (0x00000AB3)
-#define WCD9360_CDC_TX8_TX_VOL_CTL (0x00000AB4)
-#define WCD9360_CDC_TX8_TX_PATH_192_CTL (0x00000AB5)
-#define WCD9360_CDC_TX8_TX_PATH_192_CFG (0x00000AB6)
-#define WCD9360_CDC_TX8_TX_PATH_SEC0 (0x00000AB7)
-#define WCD9360_CDC_TX8_TX_PATH_SEC1 (0x00000AB8)
-#define WCD9360_CDC_TX8_TX_PATH_SEC2 (0x00000AB9)
-#define WCD9360_CDC_TX8_TX_PATH_SEC3 (0x00000ABA)
-#define WCD9360_CDC_TX8_TX_PATH_SEC4 (0x00000ABB)
-#define WCD9360_CDC_TX8_TX_PATH_SEC5 (0x00000ABC)
-#define WCD9360_CDC_TX8_TX_PATH_SEC6 (0x00000ABD)
-#define WCD9360_CDC_TX9_SPKR_PROT_PATH_CTL (0x00000AC2)
-#define WCD9360_CDC_TX9_SPKR_PROT_PATH_CFG0 (0x00000AC3)
-#define WCD9360_CDC_TX10_SPKR_PROT_PATH_CTL (0x00000AC6)
-#define WCD9360_CDC_TX10_SPKR_PROT_PATH_CFG0 (0x00000AC7)
-#define WCD9360_CDC_TX11_SPKR_PROT_PATH_CTL (0x00000ACA)
-#define WCD9360_CDC_TX11_SPKR_PROT_PATH_CFG0 (0x00000ACB)
-#define WCD9360_CDC_TX12_SPKR_PROT_PATH_CTL (0x00000ACE)
-#define WCD9360_CDC_TX12_SPKR_PROT_PATH_CFG0 (0x00000ACF)
-#define WCD9360_PAGE11_PAGE_REGISTER (0x00000B00)
-#define WCD9360_CDC_COMPANDER0_CTL0 (0x00000B21)
-#define WCD9360_CDC_COMPANDER0_CTL1 (0x00000B22)
-#define WCD9360_CDC_COMPANDER0_CTL2 (0x00000B23)
-#define WCD9360_CDC_COMPANDER0_CTL3 (0x00000B24)
-#define WCD9360_CDC_COMPANDER0_CTL4 (0x00000B25)
-#define WCD9360_CDC_COMPANDER0_CTL5 (0x00000B26)
-#define WCD9360_CDC_COMPANDER0_CTL6 (0x00000B27)
-#define WCD9360_CDC_COMPANDER0_CTL7 (0x00000B28)
-#define WCD9360_CDC_COMPANDER7_CTL0 (0x00000B31)
-#define WCD9360_CDC_COMPANDER7_CTL1 (0x00000B32)
-#define WCD9360_CDC_COMPANDER7_CTL2 (0x00000B33)
-#define WCD9360_CDC_COMPANDER7_CTL3 (0x00000B34)
-#define WCD9360_CDC_COMPANDER7_CTL4 (0x00000B35)
-#define WCD9360_CDC_COMPANDER7_CTL5 (0x00000B36)
-#define WCD9360_CDC_COMPANDER7_CTL6 (0x00000B37)
-#define WCD9360_CDC_COMPANDER7_CTL7 (0x00000B38)
-#define WCD9360_CDC_COMPANDER8_CTL0 (0x00000B39)
-#define WCD9360_CDC_COMPANDER8_CTL1 (0x00000B3A)
-#define WCD9360_CDC_COMPANDER8_CTL2 (0x00000B3B)
-#define WCD9360_CDC_COMPANDER8_CTL3 (0x00000B3C)
-#define WCD9360_CDC_COMPANDER8_CTL4 (0x00000B3D)
-#define WCD9360_CDC_COMPANDER8_CTL5 (0x00000B3E)
-#define WCD9360_CDC_COMPANDER8_CTL6 (0x00000B3F)
-#define WCD9360_CDC_COMPANDER8_CTL7 (0x00000B40)
-#define WCD9360_CDC_RX0_RX_PATH_CTL (0x00000B41)
-#define WCD9360_CDC_RX0_RX_PATH_CFG0 (0x00000B42)
-#define WCD9360_CDC_RX0_RX_PATH_CFG1 (0x00000B43)
-#define WCD9360_CDC_RX0_RX_PATH_CFG2 (0x00000B44)
-#define WCD9360_CDC_RX0_RX_VOL_CTL (0x00000B45)
-#define WCD9360_CDC_RX0_RX_PATH_MIX_CTL (0x00000B46)
-#define WCD9360_CDC_RX0_RX_PATH_MIX_CFG (0x00000B47)
-#define WCD9360_CDC_RX0_RX_VOL_MIX_CTL (0x00000B48)
-#define WCD9360_CDC_RX0_RX_PATH_SEC0 (0x00000B49)
-#define WCD9360_CDC_RX0_RX_PATH_SEC1 (0x00000B4A)
-#define WCD9360_CDC_RX0_RX_PATH_SEC2 (0x00000B4B)
-#define WCD9360_CDC_RX0_RX_PATH_SEC3 (0x00000B4C)
-#define WCD9360_CDC_RX0_RX_PATH_SEC5 (0x00000B4E)
-#define WCD9360_CDC_RX0_RX_PATH_SEC6 (0x00000B4F)
-#define WCD9360_CDC_RX0_RX_PATH_SEC7 (0x00000B50)
-#define WCD9360_CDC_RX0_RX_PATH_MIX_SEC0 (0x00000B51)
-#define WCD9360_CDC_RX0_RX_PATH_MIX_SEC1 (0x00000B52)
-#define WCD9360_CDC_RX0_RX_PATH_DSMDEM_CTL (0x00000B53)
-#define WCD9360_CDC_RX9_RX_PATH_CTL (0x00000BA5)
-#define WCD9360_CDC_RX9_RX_PATH_CFG0 (0x00000BA6)
-#define WCD9360_CDC_RX9_RX_PATH_CFG1 (0x00000BA7)
-#define WCD9360_CDC_RX9_RX_PATH_CFG2 (0x00000BA8)
-#define WCD9360_CDC_RX9_RX_VOL_CTL (0x00000BA9)
-#define WCD9360_CDC_RX9_RX_PATH_MIX_CTL (0x00000BAA)
-#define WCD9360_CDC_RX9_RX_PATH_MIX_CFG (0x00000BAB)
-#define WCD9360_CDC_RX9_RX_VOL_MIX_CTL (0x00000BAC)
-#define WCD9360_CDC_RX9_RX_PATH_SEC0 (0x00000BAD)
-#define WCD9360_CDC_RX9_RX_PATH_SEC1 (0x00000BAE)
-#define WCD9360_CDC_RX9_RX_PATH_SEC2 (0x00000BAF)
-#define WCD9360_CDC_RX9_RX_PATH_SEC3 (0x00000BB0)
-#define WCD9360_CDC_RX9_RX_PATH_SEC5 (0x00000BB2)
-#define WCD9360_CDC_RX9_RX_PATH_SEC6 (0x00000BB3)
-#define WCD9360_CDC_RX9_RX_PATH_SEC7 (0x00000BB4)
-#define WCD9360_CDC_RX9_RX_PATH_MIX_SEC0 (0x00000BB5)
-#define WCD9360_CDC_RX9_RX_PATH_MIX_SEC1 (0x00000BB6)
-#define WCD9360_CDC_RX9_RX_PATH_DSMDEM_CTL (0x00000BB7)
-#define WCD9360_CDC_RX7_RX_PATH_CTL (0x00000BCD)
-#define WCD9360_CDC_RX7_RX_PATH_CFG0 (0x00000BCE)
-#define WCD9360_CDC_RX7_RX_PATH_CFG1 (0x00000BCF)
-#define WCD9360_CDC_RX7_RX_PATH_CFG2 (0x00000BD0)
-#define WCD9360_CDC_RX7_RX_VOL_CTL (0x00000BD1)
-#define WCD9360_CDC_RX7_RX_PATH_MIX_CTL (0x00000BD2)
-#define WCD9360_CDC_RX7_RX_PATH_MIX_CFG (0x00000BD3)
-#define WCD9360_CDC_RX7_RX_VOL_MIX_CTL (0x00000BD4)
-#define WCD9360_CDC_RX7_RX_PATH_SEC0 (0x00000BD5)
-#define WCD9360_CDC_RX7_RX_PATH_SEC1 (0x00000BD6)
-#define WCD9360_CDC_RX7_RX_PATH_SEC2 (0x00000BD7)
-#define WCD9360_CDC_RX7_RX_PATH_SEC3 (0x00000BD8)
-#define WCD9360_CDC_RX7_RX_PATH_SEC5 (0x00000BDA)
-#define WCD9360_CDC_RX7_RX_PATH_SEC6 (0x00000BDB)
-#define WCD9360_CDC_RX7_RX_PATH_SEC7 (0x00000BDC)
-#define WCD9360_CDC_RX7_RX_PATH_MIX_SEC0 (0x00000BDD)
-#define WCD9360_CDC_RX7_RX_PATH_MIX_SEC1 (0x00000BDE)
-#define WCD9360_CDC_RX7_RX_PATH_DSMDEM_CTL (0x00000BDF)
-#define WCD9360_CDC_RX8_RX_PATH_CTL (0x00000BE1)
-#define WCD9360_CDC_RX8_RX_PATH_CFG0 (0x00000BE2)
-#define WCD9360_CDC_RX8_RX_PATH_CFG1 (0x00000BE3)
-#define WCD9360_CDC_RX8_RX_PATH_CFG2 (0x00000BE4)
-#define WCD9360_CDC_RX8_RX_VOL_CTL (0x00000BE5)
-#define WCD9360_CDC_RX8_RX_PATH_MIX_CTL (0x00000BE6)
-#define WCD9360_CDC_RX8_RX_PATH_MIX_CFG (0x00000BE7)
-#define WCD9360_CDC_RX8_RX_VOL_MIX_CTL (0x00000BE8)
-#define WCD9360_CDC_RX8_RX_PATH_SEC0 (0x00000BE9)
-#define WCD9360_CDC_RX8_RX_PATH_SEC1 (0x00000BEA)
-#define WCD9360_CDC_RX8_RX_PATH_SEC2 (0x00000BEB)
-#define WCD9360_CDC_RX8_RX_PATH_SEC3 (0x00000BEC)
-#define WCD9360_CDC_RX8_RX_PATH_SEC5 (0x00000BEE)
-#define WCD9360_CDC_RX8_RX_PATH_SEC6 (0x00000BEF)
-#define WCD9360_CDC_RX8_RX_PATH_SEC7 (0x00000BF0)
-#define WCD9360_CDC_RX8_RX_PATH_MIX_SEC0 (0x00000BF1)
-#define WCD9360_CDC_RX8_RX_PATH_MIX_SEC1 (0x00000BF2)
-#define WCD9360_CDC_RX8_RX_PATH_DSMDEM_CTL (0x00000BF3)
-#define WCD9360_PAGE12_PAGE_REGISTER (0x00000C00)
-#define WCD9360_CDC_BOOST0_BOOST_PATH_CTL (0x00000C19)
-#define WCD9360_CDC_BOOST0_BOOST_CTL (0x00000C1A)
-#define WCD9360_CDC_BOOST0_BOOST_CFG1 (0x00000C1B)
-#define WCD9360_CDC_BOOST0_BOOST_CFG2 (0x00000C1C)
-#define WCD9360_CDC_BOOST1_BOOST_PATH_CTL (0x00000C21)
-#define WCD9360_CDC_BOOST1_BOOST_CTL (0x00000C22)
-#define WCD9360_CDC_BOOST1_BOOST_CFG1 (0x00000C23)
-#define WCD9360_CDC_BOOST1_BOOST_CFG2 (0x00000C24)
-#define WCD9360_MIXING_ASRC2_CLK_RST_CTL (0x00000C6D)
-#define WCD9360_MIXING_ASRC2_CTL0 (0x00000C6E)
-#define WCD9360_MIXING_ASRC2_CTL1 (0x00000C6F)
-#define WCD9360_MIXING_ASRC2_FIFO_CTL (0x00000C70)
-#define WCD9360_MIXING_ASRC2_STATUS_FMIN_CNTR_LSB (0x00000C71)
-#define WCD9360_MIXING_ASRC2_STATUS_FMIN_CNTR_MSB (0x00000C72)
-#define WCD9360_MIXING_ASRC2_STATUS_FMAX_CNTR_LSB (0x00000C73)
-#define WCD9360_MIXING_ASRC2_STATUS_FMAX_CNTR_MSB (0x00000C74)
-#define WCD9360_MIXING_ASRC2_STATUS_FIFO (0x00000C75)
-#define WCD9360_MIXING_ASRC3_CLK_RST_CTL (0x00000C79)
-#define WCD9360_MIXING_ASRC3_CTL0 (0x00000C7A)
-#define WCD9360_MIXING_ASRC3_CTL1 (0x00000C7B)
-#define WCD9360_MIXING_ASRC3_FIFO_CTL (0x00000C7C)
-#define WCD9360_MIXING_ASRC3_STATUS_FMIN_CNTR_LSB (0x00000C7D)
-#define WCD9360_MIXING_ASRC3_STATUS_FMIN_CNTR_MSB (0x00000C7E)
-#define WCD9360_MIXING_ASRC3_STATUS_FMAX_CNTR_LSB (0x00000C7F)
-#define WCD9360_MIXING_ASRC3_STATUS_FMAX_CNTR_MSB (0x00000C80)
-#define WCD9360_MIXING_ASRC3_STATUS_FIFO (0x00000C81)
-#define WCD9360_SWR_AHB_BRIDGE_WR_DATA_0 (0x00000C85)
-#define WCD9360_SWR_AHB_BRIDGE_WR_DATA_1 (0x00000C86)
-#define WCD9360_SWR_AHB_BRIDGE_WR_DATA_2 (0x00000C87)
-#define WCD9360_SWR_AHB_BRIDGE_WR_DATA_3 (0x00000C88)
-#define WCD9360_SWR_AHB_BRIDGE_WR_ADDR_0 (0x00000C89)
-#define WCD9360_SWR_AHB_BRIDGE_WR_ADDR_1 (0x00000C8A)
-#define WCD9360_SWR_AHB_BRIDGE_WR_ADDR_2 (0x00000C8B)
-#define WCD9360_SWR_AHB_BRIDGE_WR_ADDR_3 (0x00000C8C)
-#define WCD9360_SWR_AHB_BRIDGE_RD_ADDR_0 (0x00000C8D)
-#define WCD9360_SWR_AHB_BRIDGE_RD_ADDR_1 (0x00000C8E)
-#define WCD9360_SWR_AHB_BRIDGE_RD_ADDR_2 (0x00000C8F)
-#define WCD9360_SWR_AHB_BRIDGE_RD_ADDR_3 (0x00000C90)
-#define WCD9360_SWR_AHB_BRIDGE_RD_DATA_0 (0x00000C91)
-#define WCD9360_SWR_AHB_BRIDGE_RD_DATA_1 (0x00000C92)
-#define WCD9360_SWR_AHB_BRIDGE_RD_DATA_2 (0x00000C93)
-#define WCD9360_SWR_AHB_BRIDGE_RD_DATA_3 (0x00000C94)
-#define WCD9360_SWR_AHB_BRIDGE_ACCESS_CFG (0x00000C95)
-#define WCD9360_SWR_AHB_BRIDGE_ACCESS_STATUS (0x00000C96)
-#define WCD9360_CDC_SIDETONE_SRC0_ST_SRC_PATH_CTL (0x00000CB5)
-#define WCD9360_CDC_SIDETONE_SRC0_ST_SRC_PATH_CFG1 (0x00000CB6)
-#define WCD9360_SIDETONE_ASRC0_CLK_RST_CTL (0x00000CBD)
-#define WCD9360_SIDETONE_ASRC0_CTL0 (0x00000CBE)
-#define WCD9360_SIDETONE_ASRC0_CTL1 (0x00000CBF)
-#define WCD9360_SIDETONE_ASRC0_FIFO_CTL (0x00000CC0)
-#define WCD9360_SIDETONE_ASRC0_STATUS_FMIN_CNTR_LSB (0x00000CC1)
-#define WCD9360_SIDETONE_ASRC0_STATUS_FMIN_CNTR_MSB (0x00000CC2)
-#define WCD9360_SIDETONE_ASRC0_STATUS_FMAX_CNTR_LSB (0x00000CC3)
-#define WCD9360_SIDETONE_ASRC0_STATUS_FMAX_CNTR_MSB (0x00000CC4)
-#define WCD9360_SIDETONE_ASRC0_STATUS_FIFO (0x00000CC5)
-#define WCD9360_EC_REF_HQ0_EC_REF_HQ_PATH_CTL (0x00000CD5)
-#define WCD9360_EC_REF_HQ0_EC_REF_HQ_CFG0 (0x00000CD6)
-#define WCD9360_EC_REF_HQ1_EC_REF_HQ_PATH_CTL (0x00000CDD)
-#define WCD9360_EC_REF_HQ1_EC_REF_HQ_CFG0 (0x00000CDE)
-#define WCD9360_EC_ASRC0_CLK_RST_CTL (0x00000CE5)
-#define WCD9360_EC_ASRC0_CTL0 (0x00000CE6)
-#define WCD9360_EC_ASRC0_CTL1 (0x00000CE7)
-#define WCD9360_EC_ASRC0_FIFO_CTL (0x00000CE8)
-#define WCD9360_EC_ASRC0_STATUS_FMIN_CNTR_LSB (0x00000CE9)
-#define WCD9360_EC_ASRC0_STATUS_FMIN_CNTR_MSB (0x00000CEA)
-#define WCD9360_EC_ASRC0_STATUS_FMAX_CNTR_LSB (0x00000CEB)
-#define WCD9360_EC_ASRC0_STATUS_FMAX_CNTR_MSB (0x00000CEC)
-#define WCD9360_EC_ASRC0_STATUS_FIFO (0x00000CED)
-#define WCD9360_EC_ASRC1_CLK_RST_CTL (0x00000CF1)
-#define WCD9360_EC_ASRC1_CTL0 (0x00000CF2)
-#define WCD9360_EC_ASRC1_CTL1 (0x00000CF3)
-#define WCD9360_EC_ASRC1_FIFO_CTL (0x00000CF4)
-#define WCD9360_EC_ASRC1_STATUS_FMIN_CNTR_LSB (0x00000CF5)
-#define WCD9360_EC_ASRC1_STATUS_FMIN_CNTR_MSB (0x00000CF6)
-#define WCD9360_EC_ASRC1_STATUS_FMAX_CNTR_LSB (0x00000CF7)
-#define WCD9360_EC_ASRC1_STATUS_FMAX_CNTR_MSB (0x00000CF8)
-#define WCD9360_EC_ASRC1_STATUS_FIFO (0x00000CF9)
-#define WCD9360_PAGE13_PAGE_REGISTER (0x00000D00)
-#define WCD9360_CDC_RX_INP_MUX_RX_INT0_CFG0 (0x00000D01)
-#define WCD9360_CDC_RX_INP_MUX_RX_INT0_CFG1 (0x00000D02)
-#define WCD9360_CDC_RX_INP_MUX_RX_INT9_CFG0 (0x00000D0B)
-#define WCD9360_CDC_RX_INP_MUX_RX_INT9_CFG1 (0x00000D0C)
-#define WCD9360_CDC_RX_INP_MUX_RX_INT7_CFG0 (0x00000D0F)
-#define WCD9360_CDC_RX_INP_MUX_RX_INT7_CFG1 (0x00000D10)
-#define WCD9360_CDC_RX_INP_MUX_RX_INT8_CFG0 (0x00000D11)
-#define WCD9360_CDC_RX_INP_MUX_RX_INT8_CFG1 (0x00000D12)
-#define WCD9360_CDC_RX_INP_MUX_RX_MIX_CFG0 (0x00000D13)
-#define WCD9360_CDC_RX_INP_MUX_RX_MIX_CFG1 (0x00000D14)
-#define WCD9360_CDC_RX_INP_MUX_RX_MIX_CFG2 (0x00000D15)
-#define WCD9360_CDC_RX_INP_MUX_RX_MIX_CFG3 (0x00000D16)
-#define WCD9360_CDC_RX_INP_MUX_RX_MIX_CFG4 (0x00000D17)
-#define WCD9360_CDC_RX_INP_MUX_SIDETONE_SRC_CFG0 (0x00000D18)
-#define WCD9360_CDC_RX_INP_MUX_SIDETONE_SRC_CFG1 (0x00000D19)
-#define WCD9360_CDC_RX_INP_MUX_ANC_CFG0 (0x00000D1A)
-#define WCD9360_CDC_RX_INP_MUX_SPLINE_ASRC_CFG0 (0x00000D1B)
-#define WCD9360_CDC_RX_INP_MUX_EC_REF_HQ_CFG0 (0x00000D1C)
-#define WCD9360_CDC_TX_INP_MUX_ADC_MUX0_CFG0 (0x00000D1D)
-#define WCD9360_CDC_TX_INP_MUX_ADC_MUX0_CFG1 (0x00000D1E)
-#define WCD9360_CDC_TX_INP_MUX_ADC_MUX1_CFG0 (0x00000D1F)
-#define WCD9360_CDC_TX_INP_MUX_ADC_MUX1_CFG1 (0x00000D20)
-#define WCD9360_CDC_TX_INP_MUX_ADC_MUX2_CFG0 (0x00000D21)
-#define WCD9360_CDC_TX_INP_MUX_ADC_MUX2_CFG1 (0x00000D22)
-#define WCD9360_CDC_TX_INP_MUX_ADC_MUX3_CFG0 (0x00000D23)
-#define WCD9360_CDC_TX_INP_MUX_ADC_MUX3_CFG1 (0x00000D25)
-#define WCD9360_CDC_TX_INP_MUX_ADC_MUX4_CFG0 (0x00000D26)
-#define WCD9360_CDC_TX_INP_MUX_ADC_MUX5_CFG0 (0x00000D27)
-#define WCD9360_CDC_TX_INP_MUX_ADC_MUX6_CFG0 (0x00000D28)
-#define WCD9360_CDC_TX_INP_MUX_ADC_MUX7_CFG0 (0x00000D29)
-#define WCD9360_CDC_TX_INP_MUX_ADC_MUX8_CFG0 (0x00000D2A)
-#define WCD9360_CDC_TX_INP_MUX_ADC_MUX10_CFG0 (0x00000D2B)
-#define WCD9360_CDC_TX_INP_MUX_ADC_MUX11_CFG0 (0x00000D2C)
-#define WCD9360_CDC_SIDETONE_IIR_INP_MUX_IIR0_MIX_CFG0 (0x00000D31)
-#define WCD9360_CDC_SIDETONE_IIR_INP_MUX_IIR0_MIX_CFG1 (0x00000D32)
-#define WCD9360_CDC_SIDETONE_IIR_INP_MUX_IIR0_MIX_CFG2 (0x00000D33)
-#define WCD9360_CDC_SIDETONE_IIR_INP_MUX_IIR0_MIX_CFG3 (0x00000D34)
-#define WCD9360_CDC_IF_ROUTER_TX_MUX_CFG0 (0x00000D3A)
-#define WCD9360_CDC_IF_ROUTER_TX_MUX_CFG1 (0x00000D3B)
-#define WCD9360_CDC_IF_ROUTER_TX_MUX_CFG2 (0x00000D3C)
-#define WCD9360_CDC_IF_ROUTER_TX_MUX_CFG3 (0x00000D3D)
-#define WCD9360_CDC_CLK_RST_CTRL_MCLK_CONTROL (0x00000D41)
-#define WCD9360_CDC_CLK_RST_CTRL_FS_CNT_CONTROL (0x00000D42)
-#define WCD9360_CDC_CLK_RST_CTRL_SWR_CONTROL (0x00000D43)
-#define WCD9360_CDC_CLK_RST_CTRL_ASRC_SHARE_CONTROL (0x00000D45)
-#define WCD9360_CDC_PROX_DETECT_PROX_CTL (0x00000D49)
-#define WCD9360_CDC_PROX_DETECT_PROX_POLL_PERIOD0 (0x00000D4A)
-#define WCD9360_CDC_PROX_DETECT_PROX_POLL_PERIOD1 (0x00000D4B)
-#define WCD9360_CDC_PROX_DETECT_PROX_SIG_PATTERN_LSB (0x00000D4C)
-#define WCD9360_CDC_PROX_DETECT_PROX_SIG_PATTERN_MSB (0x00000D4D)
-#define WCD9360_CDC_PROX_DETECT_PROX_STATUS (0x00000D4E)
-#define WCD9360_CDC_PROX_DETECT_PROX_TEST_CTRL (0x00000D4F)
-#define WCD9360_CDC_PROX_DETECT_PROX_TEST_BUFF_LSB (0x00000D50)
-#define WCD9360_CDC_PROX_DETECT_PROX_TEST_BUFF_MSB (0x00000D51)
-#define WCD9360_CDC_PROX_DETECT_PROX_TEST_BUFF_LSB_RD (0x00000D52)
-#define WCD9360_CDC_PROX_DETECT_PROX_TEST_BUFF_MSB_RD (0x00000D53)
-#define WCD9360_CDC_PROX_DETECT_PROX_CTL_REPEAT_PAT (0x00000D54)
-#define WCD9360_CDC_SIDETONE_IIR0_IIR_PATH_CTL (0x00000D55)
-#define WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B1_CTL (0x00000D56)
-#define WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B2_CTL (0x00000D57)
-#define WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B3_CTL (0x00000D58)
-#define WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B4_CTL (0x00000D59)
-#define WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B5_CTL (0x00000D5A)
-#define WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B6_CTL (0x00000D5B)
-#define WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B7_CTL (0x00000D5C)
-#define WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_B8_CTL (0x00000D5D)
-#define WCD9360_CDC_SIDETONE_IIR0_IIR_CTL (0x00000D5E)
-#define WCD9360_CDC_SIDETONE_IIR0_IIR_GAIN_TIMER_CTL (0x00000D5F)
-#define WCD9360_CDC_SIDETONE_IIR0_IIR_COEF_B1_CTL (0x00000D60)
-#define WCD9360_CDC_SIDETONE_IIR0_IIR_COEF_B2_CTL (0x00000D61)
-#define WCD9360_CDC_TOP_TOP_CFG0 (0x00000D81)
-#define WCD9360_CDC_TOP_TOP_CFG1 (0x00000D82)
-#define WCD9360_CDC_TOP_TOP_CFG7 (0x00000D88)
-#define WCD9360_CDC_TOP_EAR_COMP_WR_LSB (0x00000DA9)
-#define WCD9360_CDC_TOP_EAR_COMP_WR_MSB (0x00000DAA)
-#define WCD9360_CDC_TOP_EAR_COMP_LUT (0x00000DAB)
-#define WCD9360_CDC_TOP_EAR_COMP_RD_LSB (0x00000DAC)
-#define WCD9360_CDC_TOP_EAR_COMP_RD_MSB (0x00000DAD)
-#define WCD9360_CDC_TOP_TOP_DEBUG (0x00000DAE)
-#define WCD9360_PAGE80_PAGE_REGISTER (0x00005000)
-#define WCD9360_CODEC_CPR_WR_DATA_0 (0x00005001)
-#define WCD9360_CODEC_CPR_WR_DATA_1 (0x00005002)
-#define WCD9360_CODEC_CPR_WR_DATA_2 (0x00005003)
-#define WCD9360_CODEC_CPR_WR_DATA_3 (0x00005004)
-#define WCD9360_CODEC_CPR_WR_ADDR_0 (0x00005005)
-#define WCD9360_CODEC_CPR_WR_ADDR_1 (0x00005006)
-#define WCD9360_CODEC_CPR_WR_ADDR_2 (0x00005007)
-#define WCD9360_CODEC_CPR_WR_ADDR_3 (0x00005008)
-#define WCD9360_CODEC_CPR_RD_ADDR_0 (0x00005009)
-#define WCD9360_CODEC_CPR_RD_ADDR_1 (0x0000500A)
-#define WCD9360_CODEC_CPR_RD_ADDR_2 (0x0000500B)
-#define WCD9360_CODEC_CPR_RD_ADDR_3 (0x0000500C)
-#define WCD9360_CODEC_CPR_RD_DATA_0 (0x0000500D)
-#define WCD9360_CODEC_CPR_RD_DATA_1 (0x0000500E)
-#define WCD9360_CODEC_CPR_RD_DATA_2 (0x0000500F)
-#define WCD9360_CODEC_CPR_RD_DATA_3 (0x00005010)
-#define WCD9360_CODEC_CPR_ACCESS_CFG (0x00005011)
-#define WCD9360_CODEC_CPR_ACCESS_STATUS (0x00005012)
-#define WCD9360_CODEC_CPR_NOM_CX_VDD (0x00005021)
-#define WCD9360_CODEC_CPR_SVS_CX_VDD (0x00005022)
-#define WCD9360_CODEC_CPR_SVS2_CX_VDD (0x00005023)
-#define WCD9360_CODEC_CPR_NOM_MX_VDD (0x00005024)
-#define WCD9360_CODEC_CPR_SVS_MX_VDD (0x00005025)
-#define WCD9360_CODEC_CPR_SVS2_MX_VDD (0x00005026)
-#define WCD9360_CODEC_CPR_SVS2_MIN_CX_VDD (0x00005027)
-#define WCD9360_CODEC_CPR_MAX_SVS2_STEP (0x00005028)
-#define WCD9360_CODEC_CPR_CTL (0x00005029)
-#define WCD9360_CODEC_CPR_SW_MODECHNG_STATUS (0x0000502A)
-#define WCD9360_CODEC_CPR_SW_MODECHNG_START (0x0000502B)
-#define WCD9360_CODEC_CPR_CPR_STATUS (0x0000502C)
-#define WCD9360_PAGE128_PAGE_REGISTER (0x00008000)
-#define WCD9360_TLMM_JTCK_PINCFG (0x00008001)
-#define WCD9360_TLMM_INTR1_PINCFG (0x00008002)
-#define WCD9360_TLMM_INTR2_PINCFG (0x00008003)
-#define WCD9360_TLMM_SWR_DATA_PINCFG (0x00008004)
-#define WCD9360_TLMM_SWR_CLK_PINCFG (0x00008005)
-#define WCD9360_TLMM_SLIMBUS_DATA1_PINCFG (0x00008006)
-#define WCD9360_TLMM_SLIMBUS_DATA2_PINCFG (0x00008007)
-#define WCD9360_TLMM_SLIMBUS_CLK_PINCFG (0x00008008)
-#define WCD9360_TLMM_I2C_CLK_PINCFG (0x00008009)
-#define WCD9360_TLMM_I2C_DATA_PINCFG (0x0000800A)
-#define WCD9360_TLMM_I2S_0_RX_PINCFG (0x0000800B)
-#define WCD9360_TLMM_I2S_0_TX_PINCFG (0x0000800C)
-#define WCD9360_TLMM_I2S_0_SCK_PINCFG (0x0000800D)
-#define WCD9360_TLMM_I2S_0_WS_PINCFG (0x0000800E)
-#define WCD9360_TLMM_I2S_1_RX_PINCFG (0x0000800F)
-#define WCD9360_TLMM_I2S_1_TX_PINCFG (0x00008010)
-#define WCD9360_TLMM_I2S_1_SCK_PINCFG (0x00008011)
-#define WCD9360_TLMM_I2S_1_WS_PINCFG (0x00008012)
-#define WCD9360_TLMM_DMIC1_CLK_PINCFG (0x00008013)
-#define WCD9360_TLMM_DMIC1_DATA_PINCFG (0x00008014)
-#define WCD9360_TLMM_DMIC2_CLK_PINCFG (0x00008015)
-#define WCD9360_TLMM_DMIC2_DATA_PINCFG (0x00008016)
-#define WCD9360_TLMM_GPIO1_PINCFG (0x00008017)
-#define WCD9360_TLMM_GPIO2_PINCFG (0x00008018)
-#define WCD9360_TLMM_GPIO3_PINCFG (0x00008019)
-#define WCD9360_TLMM_GPIO4_PINCFG (0x0000801A)
-#define WCD9360_TLMM_SPI_S_CSN_PINCFG (0x0000801B)
-#define WCD9360_TLMM_SPI_S_CLK_PINCFG (0x0000801C)
-#define WCD9360_TLMM_SPI_S_DOUT_PINCFG (0x0000801D)
-#define WCD9360_TLMM_SPI_S_DIN_PINCFG (0x0000801E)
-#define WCD9360_TLMM_GPIO0_PINCFG (0x0000801F)
-#define WCD9360_TLMM_DMIC3_CLK_PINCFG (0x00008020)
-#define WCD9360_TLMM_DMIC3_DATA_PINCFG (0x00008021)
-#define WCD9360_TLMM_DMIC4_CLK_PINCFG (0x00008022)
-#define WCD9360_TLMM_DMIC4_DATA_PINCFG (0x00008023)
-#define WCD9360_TEST_DEBUG_PIN_CTL_OE_0 (0x00008031)
-#define WCD9360_TEST_DEBUG_PIN_CTL_OE_1 (0x00008032)
-#define WCD9360_TEST_DEBUG_PIN_CTL_OE_2 (0x00008033)
-#define WCD9360_TEST_DEBUG_PIN_CTL_OE_3 (0x00008034)
-#define WCD9360_TEST_DEBUG_PIN_CTL_OE_4 (0x00008035)
-#define WCD9360_TEST_DEBUG_PIN_CTL_DATA_0 (0x00008036)
-#define WCD9360_TEST_DEBUG_PIN_CTL_DATA_1 (0x00008037)
-#define WCD9360_TEST_DEBUG_PIN_CTL_DATA_2 (0x00008038)
-#define WCD9360_TEST_DEBUG_PIN_CTL_DATA_3 (0x00008039)
-#define WCD9360_TEST_DEBUG_PIN_CTL_DATA_4 (0x0000803A)
-#define WCD9360_TEST_DEBUG_PAD_DRVCTL_0 (0x0000803B)
-#define WCD9360_TEST_DEBUG_PAD_DRVCTL_1 (0x0000803C)
-#define WCD9360_TEST_DEBUG_PIN_STATUS (0x0000803D)
-#define WCD9360_TEST_DEBUG_NPL_DLY_TEST_1 (0x0000803E)
-#define WCD9360_TEST_DEBUG_NPL_DLY_TEST_2 (0x0000803F)
-#define WCD9360_TEST_DEBUG_MEM_CTRL (0x00008040)
-#define WCD9360_TEST_DEBUG_DEBUG_BUS_SEL (0x00008041)
-#define WCD9360_TEST_DEBUG_DEBUG_JTAG (0x00008042)
-#define WCD9360_TEST_DEBUG_DEBUG_EN_1 (0x00008043)
-#define WCD9360_TEST_DEBUG_DEBUG_EN_2 (0x00008044)
-#define WCD9360_TEST_DEBUG_DEBUG_EN_3 (0x00008045)
-#define WCD9360_TEST_DEBUG_DEBUG_EN_4 (0x00008046)
-#define WCD9360_TEST_DEBUG_DEBUG_EN_5 (0x00008047)
-#define WCD9360_TEST_DEBUG_ANA_DTEST_DIR (0x0000804A)
-#define WCD9360_TEST_DEBUG_PAD_INP_DISABLE_0 (0x0000804B)
-#define WCD9360_TEST_DEBUG_PAD_INP_DISABLE_1 (0x0000804C)
-#define WCD9360_TEST_DEBUG_PAD_INP_DISABLE_2 (0x0000804D)
-#define WCD9360_TEST_DEBUG_PAD_INP_DISABLE_3 (0x0000804E)
-#define WCD9360_TEST_DEBUG_PAD_INP_DISABLE_4 (0x0000804F)
-#define WCD9360_TEST_DEBUG_SYSMEM_CTRL (0x00008050)
-#define WCD9360_TEST_DEBUG_LVAL_NOM_LOW (0x00008052)
-#define WCD9360_TEST_DEBUG_LVAL_NOM_HIGH (0x00008053)
-#define WCD9360_TEST_DEBUG_LVAL_SVS_SVS2_LOW (0x00008054)
-#define WCD9360_TEST_DEBUG_LVAL_SVS_SVS2_HIGH (0x00008055)
-#define WCD9360_TEST_DEBUG_SPI_SLAVE_CHAR (0x00008056)
-#define WCD9360_TEST_DEBUG_CODEC_DIAGS (0x00008057)
-#define WCD9360_TEST_DEBUG_PAD_TEST (0x00008058)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_0 (0x00008061)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_1 (0x00008062)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_2 (0x00008063)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_3 (0x00008064)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_4 (0x00008065)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_5 (0x00008066)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_6 (0x00008067)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_7 (0x00008068)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_8 (0x00008069)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_9 (0x0000806A)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_10 (0x0000806B)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_11 (0x0000806C)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_12 (0x0000806D)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_13 (0x0000806E)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_14 (0x0000806F)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_15 (0x00008070)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_16 (0x00008071)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_17 (0x00008072)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_18 (0x00008073)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_19 (0x00008074)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_20 (0x00008075)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_21 (0x00008076)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_22 (0x00008077)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_23 (0x00008078)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_24 (0x00008079)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_25 (0x0000807A)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_26 (0x0000807B)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_27 (0x0000807C)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_28 (0x0000807D)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_29 (0x0000807E)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_30 (0x0000807F)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_BIT_31 (0x00008080)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_RD_CTRL (0x00008081)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_RD_7_0 (0x00008082)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_RD_15_8 (0x00008083)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_RD_23_16 (0x00008084)
-#define WCD9360_TEST_DEBUG_DEBUG_MUX_RD_31_24 (0x00008085)
-#define WCD9360_MAX_REGISTER 0x80FF
-
-/* SLIMBUS Slave Registers */
-#define WCD9360_SLIM_PGD_PORT_INT_RX_EN0 (0x30)
-#define WCD9360_SLIM_PGD_PORT_INT_TX_EN0 (0x32)
-#define WCD9360_SLIM_PGD_PORT_INT_STATUS_RX_0 (0x34)
-#define WCD9360_SLIM_PGD_PORT_INT_STATUS_RX_1 (0x35)
-#define WCD9360_SLIM_PGD_PORT_INT_STATUS_TX_0 (0x36)
-#define WCD9360_SLIM_PGD_PORT_INT_STATUS_TX_1 (0x37)
-#define WCD9360_SLIM_PGD_PORT_INT_CLR_RX_0 (0x38)
-#define WCD9360_SLIM_PGD_PORT_INT_CLR_RX_1 (0x39)
-#define WCD9360_SLIM_PGD_PORT_INT_CLR_TX_0 (0x3A)
-#define WCD9360_SLIM_PGD_PORT_INT_CLR_TX_1 (0x3B)
-#define WCD9360_SLIM_PGD_PORT_INT_RX_SOURCE0 (0x60)
-#define WCD9360_SLIM_PGD_PORT_INT_TX_SOURCE0 (0x70)
-
-#endif
diff --git a/ipc/Android.mk b/ipc/Android.mk
index 18dbedf..b54e522 100644
--- a/ipc/Android.mk
+++ b/ipc/Android.mk
@@ -3,14 +3,6 @@
# Assume no targets will be supported
# Check if this driver needs be built for current target
-ifeq ($(call is-board-platform,sdm845),true)
-AUDIO_SELECT := CONFIG_SND_SOC_SDM845=m
-endif
-
-ifeq ($(call is-board-platform-in-list,msm8953 sdm670 qcs605),true)
-AUDIO_SELECT := CONFIG_SND_SOC_SDM670=m
-endif
-
ifeq ($(call is-board-platform,msmnile),true)
AUDIO_SELECT := CONFIG_SND_SOC_SM8150=m
endif
@@ -21,7 +13,7 @@
AUDIO_CHIPSET := audio
# Build/Package only in case of supported target
-ifeq ($(call is-board-platform-in-list,msm8953 sdm845 sdm670 qcs605 msmnile $(MSMSTEPPE) $(TRINKET)),true)
+ifeq ($(call is-board-platform-in-list,msmnile $(MSMSTEPPE) $(TRINKET)),true)
LOCAL_PATH := $(call my-dir)
diff --git a/ipc/Kbuild b/ipc/Kbuild
index 4e2d54b..3ecf01d 100644
--- a/ipc/Kbuild
+++ b/ipc/Kbuild
@@ -15,21 +15,6 @@
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
- ifeq ($(CONFIG_ARCH_SDM450), y)
- include $(AUDIO_ROOT)/config/sdm670auto.conf
- export
- INCS += -include $(AUDIO_ROOT)/config/sdm670autoconf.h
- endif
ifeq ($(CONFIG_ARCH_SM6150), y)
include $(AUDIO_ROOT)/config/sm6150auto.conf
export
diff --git a/soc/Android.mk b/soc/Android.mk
index 65770ba..7a8bd0e 100644
--- a/soc/Android.mk
+++ b/soc/Android.mk
@@ -3,14 +3,6 @@
# Assume no targets will be supported
# Check if this driver needs be built for current target
-ifeq ($(call is-board-platform,sdm845),true)
-AUDIO_SELECT := CONFIG_SND_SOC_SDM845=m
-endif
-
-ifeq ($(call is-board-platform-in-list,msm8953 sdm670 qcs605),true)
-AUDIO_SELECT := CONFIG_SND_SOC_SDM670=m
-endif
-
ifeq ($(call is-board-platform,msmnile),true)
AUDIO_SELECT := CONFIG_SND_SOC_SM8150=m
endif
@@ -21,7 +13,7 @@
AUDIO_CHIPSET := audio
# Build/Package only in case of supported target
-ifeq ($(call is-board-platform-in-list,msm8953 sdm845 sdm670 qcs605 msmnile $(MSMSTEPPE) $(TRINKET)),true)
+ifeq ($(call is-board-platform-in-list,msmnile $(MSMSTEPPE) $(TRINKET)),true)
LOCAL_PATH := $(call my-dir)
@@ -48,7 +40,7 @@
KBUILD_OPTIONS += $(AUDIO_SELECT)
###########################################################
-ifeq ($(call is-board-platform-in-list,msm8953 sdm670 qcs605 $(MSMSTEPPE) $(TRINKET)),true)
+ifeq ($(call is-board-platform-in-list,$(MSMSTEPPE) $(TRINKET)),true)
include $(CLEAR_VARS)
LOCAL_MODULE := $(AUDIO_CHIPSET)_pinctrl_lpi.ko
LOCAL_MODULE_KBUILD_NAME := pinctrl_lpi_dlkm.ko
diff --git a/soc/Kbuild b/soc/Kbuild
index 29306ce..69eb0b9 100644
--- a/soc/Kbuild
+++ b/soc/Kbuild
@@ -14,21 +14,6 @@
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
- ifeq ($(CONFIG_ARCH_SDM450), y)
- include $(AUDIO_ROOT)/config/sdm670auto.conf
- export
- INCS += -include $(AUDIO_ROOT)/config/sdm670autoconf.h
- endif
ifeq ($(CONFIG_ARCH_SM8150), y)
include $(AUDIO_ROOT)/config/sm8150auto.conf
export