Merge tag 'LA.UM.9.15.r1-07300-KAMORTA.QSSI13.0' of https://git.codelinaro.org/clo/la/platform/vendor/opensource/audio-kernel into android13-4.19-kona

"LA.UM.9.15.r1-07300-KAMORTA.QSSI13.0"

* tag 'LA.UM.9.15.r1-07300-KAMORTA.QSSI13.0' of https://git.codelinaro.org/clo/la/platform/vendor/opensource/audio-kernel:
  ASoC: msm-pcm-q6-v2: Add dsp buf check
  ASoC: rouleur-mbhc: Enhance impedance calculation logic
  ASoC: rouleur-mbhc: Fix pop noise heard when headset insertion
  asoc: wsa881x: Fix to set the correct volume level
  soc: swr-mstr-ctrl: remove FIFO_Flush for overflow
  asoc: Add routing control for qrb5165 BT HFP usecase
  soc: swr-mstr: Store and compare dev_addr along with dev_num
  Asoc: fix integer overflow for long duration offload playback
  asoc: Correct the range of dev_token for usb headset.
  asoc: pcm-noirq: set substream state to disconnect when ssr happens
  soc: pinctrl-lpi-legacy : Add nullptr check
  asoc: msm-pcm-routing: Assign default topology when app_type is zero
  asoc: notify dp driver after disp codec probe
  asoc: codecs: fix race condition of core vote and reg access
  ASoC: wcd937x: Add check for ULP irrespective of the Class
  asoc: codecs: Add nullptr check
  ASoC: wcd937x: Update QCRG sequence for wcd937x
  asoc: changes to fix KW errors.
  asoc: changes to fix KW errors.
  ASoC: pcm-routing: Add WSA VI sense macro to support capture
  ASoC: wcd937x: Update EAR PA CnP FSM sequence
  soc: swr-mstr: update component and interrupt enable sequence
  ASoC: wcd937x: Update EAR PA CnP FSM sequence
  soc: add check condition before enabling irq
  ASoC: wcd937x: Add change for LDOL VOUT accuracy calibration
  ASoC: dsp: Synchronise adm commands
  ASoC: wcd937x: Add change to micbias reg for new tanggu fab id
  ASoC: wcd937x: Update register value for new fab id for tanggu
  dsp:q6afe: Resolve crash in q6afe_get_avcs_modules
  ASoC: wcd937x: Change resistor divider output for hph if fab id is enabled
  dsp: adm: add to check output/input channel value
  asoc: Parse wcd-datalane-mismatch property to update rx frame config for khaje
  asoc: wcd-cpe: Set the dma_mask for cpe_device
  asoc: Parse wcd-datalane-mismatch property to update rx frame config for khaje
  ASoC: msm8952: Defer until pcm voice probe done
  q6afe: Fix out of bound access of clkinfo_per_port
  asoc: Register CDC_DMA interface only if enabled
  config: sdm450: Disable CDC_DMA interfaces
  asoc: codecs: add null check before access
  asoc: fix KW issue of using uninitialized variable
  audio-kernel: enable wsa883x compilation on qrb5165
  ASoC: Enable wsa881x-temp-sensor for bengal
  ASoC: msm8952: avoid static route between cpu and codec dai
  asoc: codecs: Fix LPASS register access during bootup
  ASoC: wcd: Add check to stop invalid memory access
  afe: release codec port when afe starts failed
  ASoC: Changes to enable codec clk for wcd9335
  Asoc: check for invalid voice session id
  SoC: codecs: Fix slim_tx port configuration for wcd9335
  ASoC: Get the component handle for cpe and tasha
  ASoC: wcd937x: Change vbg fine voltage to 0.5V for wcd937x second source
  audio-kernel: enable wsa883x compilation on sxr2130
  dsp: fix out of bound access for cal_data size
  dsp: update size check for set/get VI param function
  config: sdm450: Disable TDM and AUXPCM interfaces
  asoc: msm_sdw: Revert adsp ready check for read/write
  ASoC: SDM660: Avoid static route between cpu and codec dai
  asoc: bolero: Update PCM_RATE based delay for amic
  ASoC: SDM660: Avoid static route between cpu and codec dai
  ASoC: Fix for SSR issue on msm8953
  ASoC: error check for backend index and MCLK src
  Asoc: sdm450: Add capture support for Multimedia10 FE
  asoc: add proxy ports for call screening in machine driver
  asoc: msm: Fix compilation error when enable TDM and disable MI2S
  Makefile: Correct TARGET_SUPPORT entry for qrb5165
  dsp: update size check for get VI param function
  asoc: codecs: add child devices after completing initialization
  asoc: bolero: Add core_vote before gfmux access
  dsp: Disable q6_pdr build for msm8937 and msm8953
  asoc: Fixed wsa881x codec machine driver callback
  asoc: codec: enable the cpe on tasha
  Use proper TARGET_SUPPORT entry for sxr2130
  asoc: wsa881x: Fix to set the correct volume level
  ASoC: ep92: Add external mclk support
  ASoC: msm: Add WCD interrupt config for SDA660
  dsp: Unload the BT modules when APR handle is NULL
  asoc: Update copy_to_user to requested buffer size
  ASoC: Audio bringup changes for msm8937_32go.
  asoc: Add check to handle negative value passed for num_app_cfg_type
  ASoC: QCS405: Additional TDM samplerates and channels
  asoc: qcs405: Add support for TDM interface
  asoc: Add support for QUAT and SEN TDM interface
  asoc: qcs405: Update clk src string from dts
  dsp: Add support to update and store clk src values
  dsp: afe topology deregister
  ASoC: qcs405: Add external mclk support
  ASoC: Add external mclk mixer support
  dsp: Fix improper mutex unlock in afe close
  ASoC: wsa883x: Handle PA_ERR interrupt on WSA speaker
  ASoC: Add support to send voice UI port id to afe
  Revert "dsp: avtimer: Add adsp ready check before accessing avtimer registers"
  asoc: wsa881x: Fix crash while capturing swr_slv codec dump
  dsp: add change to enable preemption at cal_utils_dealloc_cal
  asoc: msm_sdw: Handle locking for mclk enable flag
  asoc: codecs: sdm660_cdc: Fix LPASS register access during PDR
  ASoC: lagoon: add support for CPS speaker protection
  dsp: add change to enable preemption at cal_utils_dealloc_cal
  ASoC: tx-macro: Allow regcache sync during clock enablement
  ASoC: wsa883x: add function to get swr device number
  dsp: add change to handle use-after-free in cal_utils_is_cal_stale
  soc: swr-mstr: Check if fifo available before bulk write
  asoc: bolero: control wakeup of swr_tx during clock setup
  soc: swr-mstr: Resolve swr overflow, underflow errors for wsa
  soc: swr-mstr: Update soundwire state to SSR during UP
  dsp: add change to fix use-after-free issue
  asoc: msm-pcm-q6-v2: Update memset for period size
  asoc: va-macro: Allow swr switch at powerup/shutdown
  ASoC: SDM660: Avoid static route between cpu and codec dai
  soc: Synchronize RESET event and lpi ops in legacy driver
  ASoC: codec: Enable wcd-spi driver compilation
  asoc: wcd-spi: Set the dma_mask for spi_device
  ASoC: audio-ext-clk: Add pmi clk support for tasha
  asoc: add null check for pcm pointer of snd_pcm_volume
  dsp: add afe function to send cps configuration
  asoc: Add 32bit support in meta i2s
  asoc: va-macro: Update widget order for VA_MCLK and VA_SWR_PWR
  dsp: Add param header size based on the instance id support
  dsp: q6core: Check q6core avs state to be modules ready
  ASoC: dsp: Synchronise adm and rtac commands
  asoc: codecs: Add support to dump rouleur swr slave regs
  asoc: sdm660: Correct the dev_id for hdmi backend.
  Revert "ASoC: codecs: handle device disconnect during SSR/PDR"
  ASoC: wsa883x: Update register sequence to reduce CnP
  asoc: sdm660: add proxy ports for call screening in machine driver
  soc: swr-mstr: Fix headset detect issue due to master.num_dev not updated
  soc: swr-mstr: Fix random headset detection issue on scuba
  dsp: Feedback path cfg to support 3rd party spkr protection algorithms.
  ASOC: SPV4 set correct number of speakers.
  ASoC: wsa883x: enable vbat adc filter
  config: kona: Disable MI2S, TDM and AUXPCM interfaces
  dsp: fix compilation issue in q6lsm_callback function
  asoc: Register widgets and intercons only when supported
  soc: swr-mstr: Fix random headset detection issue on scuba
  ASoC: codecs: handle device disconnect during SSR
  asoc: dsp: Fix possible invalid memory access due to race condition
  ASoC: rouleur-mbhc: Fix impedance detection issue on rouleur
  dsp: Add support for GET_PARAMS

 Conflicts:
	techpack/audio/asoc/kona.c
	techpack/audio/asoc/msm-pcm-routing-v2.c
	techpack/audio/dsp/q6core.c
	techpack/audio/dsp/q6lsm.c
	techpack/audio/include/dsp/audio_cal_utils.h
	techpack/audio/soc/swr-mstr-ctrl.c
	techpack/audio/soc/swr-mstr-ctrl.h

Change-Id: Id77d1c17f36618427f929d7830200733a0e8b460
This commit is contained in:
Michael Bestas
2023-04-01 01:07:23 +03:00
80 changed files with 15879 additions and 402 deletions

View File

@@ -3,7 +3,7 @@ MY_LOCAL_PATH := $(call my-dir)
UAPI_OUT := $(PRODUCT_OUT)/obj/vendor/qcom/opensource/audio-kernel/include
ifeq ($(call is-board-platform-in-list,msmnile $(MSMSTEPPE) $(TRINKET) kona lito bengal sdmshrike sdm660),true)
ifeq ($(call is-board-platform-in-list,msmnile $(MSMSTEPPE) $(TRINKET) kona lito bengal sdmshrike sdm660 msm8953 msm8937),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)
@@ -12,6 +12,9 @@ $(shell rm -rf $(PRODUCT_OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/codecs
$(shell rm -rf $(PRODUCT_OUT)/obj/vendor/qcom/opensource/audio-kernel/soc/Module.symvers)
$(shell rm -rf $(PRODUCT_OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/Module.symvers)
$(shell rm -rf $(PRODUCT_OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/Module.symvers)
ifeq ($(call is-board-platform-in-list, msm8953 msm8937),true)
$(shell rm -rf $(PRODUCT_OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/wcd934x/Module.symvers)
endif
include $(MY_LOCAL_PATH)/include/uapi/Android.mk
include $(MY_LOCAL_PATH)/ipc/Android.mk
@@ -66,12 +69,12 @@ $(shell rm -rf $(PRODUCT_OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codec
include $(MY_LOCAL_PATH)/asoc/codecs/wcd937x/Android.mk
endif
ifeq ($(call is-board-platform-in-list, lito),true)
ifeq ($(call is-board-platform-in-list, kona lito),true)
$(shell rm -rf $(PRODUCT_OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/wsa883x/Module.symvers)
include $(MY_LOCAL_PATH)/asoc/codecs/wsa883x/Android.mk
endif
ifeq ($(call is-board-platform-in-list, sdm660),true)
ifeq ($(call is-board-platform-in-list, sdm660 msm8953 msm8937),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

View File

@@ -20,6 +20,9 @@ endif
ifeq ($(TARGET_SUPPORT),sdm660)
KBUILD_OPTIONS += CONFIG_ARCH_SDM660=y
endif
ifeq ($(TARGET_SUPPORT),apq8053 msm8953 msm8937)
KBUILD_OPTIONS += CONFIG_ARCH_SDM450=y
endif
obj-m := ipc/
obj-m += dsp/
@@ -40,12 +43,13 @@ obj-m += asoc/codecs/bolero/
obj-m += asoc/codecs/wcd937x/
endif
ifeq ($(TARGET_SUPPORT), qrb5165)
ifeq ($(TARGET_SUPPORT), $(filter $(TARGET_SUPPORT), qrb5165 sxr2130))
obj-m += asoc/codecs/bolero/
obj-m += asoc/codecs/wcd938x/
obj-m += asoc/codecs/wsa883x/
endif
ifeq ($(TARGET_SUPPORT), $(filter $(TARGET_SUPPORT), sdm660))
ifeq ($(TARGET_SUPPORT), $(filter $(TARGET_SUPPORT), apq8053 sdm660 msm8953 msm8937))
obj-m += asoc/codecs/sdm660_cdc/
endif
@@ -61,7 +65,7 @@ endif
ifeq ($(TARGET_SUPPORT), $(filter $(TARGET_SUPPORT), sa6155))
KBUILD_OPTIONS += CONFIG_SND_SOC_SA6155=m
endif
ifeq ($(TARGET_SUPPORT), $(filter $(TARGET_SUPPORT), qrb5165))
ifeq ($(TARGET_SUPPORT), $(filter $(TARGET_SUPPORT), qrb5165 sxr2130))
KBUILD_OPTIONS += CONFIG_SND_SOC_KONA=m
endif
endif

View File

@@ -46,9 +46,15 @@ TARGET := sdm660
AUDIO_SELECT := CONFIG_SND_SOC_SDM660=m
endif
ifeq ($(call is-board-platform-in-list,msm8953 msm8937),true)
TARGET := sdm450
AUDIO_SELECT += CONFIG_SND_SOC_SDM450=m
AUDIO_SELECT += CONFIG_SND_SOC_EXT_CODEC_SDM450=m
endif
AUDIO_CHIPSET := audio
# Build/Package only in case of supported target
ifeq ($(call is-board-platform-in-list,msmnile $(MSMSTEPPE) $(TRINKET) kona lito bengal sdmshrike sdm660),true)
ifeq ($(call is-board-platform-in-list,msmnile $(MSMSTEPPE) $(TRINKET) kona lito bengal sdmshrike sdm660 msm8953 msm8937),true)
LOCAL_PATH := $(call my-dir)
@@ -83,7 +89,7 @@ LOCAL_MODULE_DEBUG_ENABLE := true
LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
include $(DLKM_DIR)/AndroidKernelModule.mk
###########################################################
ifeq ($(call is-board-platform-in-list, ),true)
ifeq ($(call is-board-platform-in-list, sdm660 msm8953 msm8937),true)
include $(CLEAR_VARS)
LOCAL_MODULE := $(AUDIO_CHIPSET)_cpe_lsm.ko
LOCAL_MODULE_KBUILD_NAME := cpe_lsm_dlkm.ko
@@ -101,6 +107,16 @@ LOCAL_MODULE_DEBUG_ENABLE := true
LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
include $(DLKM_DIR)/AndroidKernelModule.mk
###########################################################
ifeq ($(call is-board-platform-in-list,msm8953 msm8937),true)
include $(CLEAR_VARS)
LOCAL_MODULE := $(AUDIO_CHIPSET)_machine_ext_$(TARGET).ko
LOCAL_MODULE_KBUILD_NAME := machine_ext_dlkm.ko
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_DEBUG_ENABLE := true
LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
include $(DLKM_DIR)/AndroidKernelModule.mk
endif
###########################################################
endif # DLKM check
endif # supported target check

View File

@@ -81,6 +81,21 @@ ifeq ($(KERNEL_BUILD), 0)
export
INCS += -include $(AUDIO_ROOT)/config/sdm660autoconf.h
endif
ifeq ($(CONFIG_ARCH_SDM450), y)
include $(AUDIO_ROOT)/config/sdm450auto.conf
export
INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
endif
ifeq ($(CONFIG_ARCH_SDM439), y)
include $(AUDIO_ROOT)/config/sdm450auto.conf
export
INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
endif
ifeq ($(CONFIG_ARCH_MSM8917), y)
include $(AUDIO_ROOT)/config/sdm450auto.conf
export
INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
endif
endif
# As per target team, build is done as follows:
@@ -170,6 +185,17 @@ ifdef CONFIG_SND_SOC_CPE
CPE_LSM_OBJS += msm-cpe-lsm.o
endif
# for SDM450 internal codec sound card driver
ifdef CONFIG_SND_SOC_SDM450
MACHINE_OBJS += msm8952.o
endif
# for SDM450 external codec sound card driver
ifdef CONFIG_SND_SOC_EXT_CODEC_SDM450
MACHINE_EXT_OBJS += msm8952-slimbus.o
MACHINE_EXT_OBJS += msm8952-dai-links.o
endif
ifdef CONFIG_SND_SOC_QDSP6V2
PLATFORM_OBJS += msm-audio-effects-q6-v2.o
PLATFORM_OBJS += msm-compress-q6-v2.o
@@ -254,6 +280,12 @@ endif
obj-$(CONFIG_SND_SOC_QDSP6V2) += platform_dlkm.o
platform_dlkm-y := $(PLATFORM_OBJS)
obj-$(CONFIG_SND_SOC_SDM450) += machine_dlkm.o
machine_dlkm-y := $(MACHINE_OBJS)
obj-$(CONFIG_SND_SOC_EXT_CODEC_SDM450) += machine_ext_dlkm.o
machine_ext_dlkm-y := $(MACHINE_EXT_OBJS)
obj-$(CONFIG_SND_SOC_SM8150) += machine_dlkm.o
machine_dlkm-y := $(MACHINE_OBJS)

View File

@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
*/
#ifndef _BENGAL_PORT_CONFIG
@@ -38,6 +38,14 @@ static struct port_params rx_frame_params_dsd[SWR_MSTR_PORT_LEN] = {
{3, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 3, 0},
};
static struct port_params rx_frame_params_khaje[SWR_MSTR_PORT_LEN] = {
{3, 1, 0, 0xFF, 0xFF, 1, 0xFF, 0xFF, 0},
{31, 0, 0, 3, 6, 7, 0, 0xFF, 0},
{31, 11, 11, 0xFF, 0xFF, 4, 1, 0xFF, 0},
{7, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0},
{0, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0},
};
/* TX UC1: TX1: 1ch, TX2: 2chs, TX3: 1ch(MBHC) */
static struct port_params tx_frame_params_default[SWR_MSTR_PORT_LEN] = {
{3, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0}, /* TX1 */
@@ -56,4 +64,10 @@ static struct swr_mstr_port_map sm_port_map_rouleur[] = {
{RX_MACRO, SWR_UC0, rx_frame_params_rouleur},
{RX_MACRO, SWR_UC1, rx_frame_params_dsd},
};
static struct swr_mstr_port_map sm_port_map_khaje[] = {
{VA_MACRO, SWR_UC0, tx_frame_params_default},
{RX_MACRO, SWR_UC0, rx_frame_params_khaje},
{RX_MACRO, SWR_UC1, rx_frame_params_dsd},
};
#endif /* _BENGAL_PORT_CONFIG */

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/clk.h>
@@ -555,6 +555,7 @@ static struct snd_soc_codec_conf *msm_codec_conf;
static struct snd_soc_card snd_soc_card_bengal_msm;
static int dmic_0_1_gpio_cnt;
static int dmic_2_3_gpio_cnt;
static u32 wcd_datalane_mismatch;
static void *def_wcd_mbhc_cal(void);
static void *def_rouleur_mbhc_cal(void);
@@ -4330,7 +4331,11 @@ static int msm_int_audrx_init(struct snd_soc_pcm_runtime *rtd)
data = (char*) of_device_get_match_data(
&pdev->dev);
if (data != NULL) {
if (!strncmp(data, "wcd937x",
if (wcd_datalane_mismatch) {
bolero_set_port_map(component,
ARRAY_SIZE(sm_port_map_khaje),
sm_port_map_khaje);
} else if (!strncmp(data, "wcd937x",
sizeof("wcd937x"))) {
bolero_set_port_map(component,
ARRAY_SIZE(sm_port_map),
@@ -6735,6 +6740,10 @@ static int msm_asoc_machine_probe(struct platform_device *pdev)
if (ret)
goto err;
ret = of_property_read_u32(pdev->dev.of_node,
"qcom,wcd-datalane-mismatch",
&wcd_datalane_mismatch);
ret = devm_snd_soc_register_card(&pdev->dev, card);
if (ret == -EPROBE_DEFER) {
if (codec_reg_done)

View File

@@ -39,9 +39,14 @@ ifeq ($(call is-board-platform,sdm660),true)
AUDIO_SELECT := CONFIG_SND_SOC_SDM660=m
endif
ifeq ($(call is-board-platform-in-list,msm8953 msm8937),true)
AUDIO_SELECT += CONFIG_SND_SOC_SDM450=m
AUDIO_SELECT += CONFIG_SND_SOC_EXT_CODEC_SDM450=m
endif
AUDIO_CHIPSET := audio
# Build/Package only in case of supported target
ifeq ($(call is-board-platform-in-list,msmnile $(MSMSTEPPE) $(TRINKET) kona lito bengal sdmshrike sdm660),true)
ifeq ($(call is-board-platform-in-list,msmnile $(MSMSTEPPE) $(TRINKET) kona lito bengal sdmshrike sdm660 msm8953 msm8937),true)
LOCAL_PATH := $(call my-dir)
@@ -85,7 +90,7 @@ LOCAL_MODULE_DEBUG_ENABLE := true
LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
include $(DLKM_DIR)/AndroidKernelModule.mk
###########################################################
ifeq ($(call is-board-platform-in-list, ),true)
ifeq ($(call is-board-platform-in-list, sdm660 msm8953 msm8937),true)
include $(CLEAR_VARS)
LOCAL_MODULE := $(AUDIO_CHIPSET)_wcd_cpe.ko
LOCAL_MODULE_KBUILD_NAME := wcd_cpe_dlkm.ko
@@ -95,7 +100,7 @@ LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
include $(DLKM_DIR)/AndroidKernelModule.mk
endif
###########################################################
ifeq ($(call is-board-platform-in-list,msmnile $(MSMSTEPPE) $(TRINKET) sdmshrike),true)
ifeq ($(call is-board-platform-in-list,msmnile $(MSMSTEPPE) $(TRINKET) sdmshrike sdm660),true)
include $(CLEAR_VARS)
LOCAL_MODULE := $(AUDIO_CHIPSET)_wcd_spi.ko
LOCAL_MODULE_KBUILD_NAME := wcd_spi_dlkm.ko
@@ -105,7 +110,7 @@ LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
include $(DLKM_DIR)/AndroidKernelModule.mk
endif
###########################################################
ifeq ($(call is-board-platform-in-list, sdm660),true)
ifeq ($(call is-board-platform-in-list, sdm660 msm8953 msm8937),true)
include $(CLEAR_VARS)
LOCAL_MODULE := $(AUDIO_CHIPSET)_wcd9335.ko
LOCAL_MODULE_KBUILD_NAME := wcd9335_dlkm.ko
@@ -125,7 +130,7 @@ LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
include $(DLKM_DIR)/AndroidKernelModule.mk
endif
###########################################################
ifeq ($(call is-board-platform-in-list, bengal),true)
ifeq ($(call is-board-platform-in-list, bengal msm8953 msm8937),true)
include $(CLEAR_VARS)
LOCAL_MODULE := $(AUDIO_CHIPSET)_wsa881x_analog.ko
LOCAL_MODULE_KBUILD_NAME := wsa881x_analog_dlkm.ko

View File

@@ -75,6 +75,21 @@ ifeq ($(KERNEL_BUILD), 0)
export
INCS += -include $(AUDIO_ROOT)/config/sdm660autoconf.h
endif
ifeq ($(CONFIG_ARCH_SDM450), y)
include $(AUDIO_ROOT)/config/sdm450auto.conf
export
INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
endif
ifeq ($(CONFIG_ARCH_SDM439), y)
include $(AUDIO_ROOT)/config/sdm450auto.conf
export
INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
endif
ifeq ($(CONFIG_ARCH_MSM8917), y)
include $(AUDIO_ROOT)/config/sdm450auto.conf
export
INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
endif
endif
# As per target team, build is done as follows:
@@ -152,8 +167,10 @@ ifdef CONFIG_SND_SOC_WSA881X_ANALOG
WSA881X_ANALOG_OBJS += wsa881x-analog.o
WSA881X_ANALOG_OBJS += wsa881x-tables-analog.o
WSA881X_ANALOG_OBJS += wsa881x-regmap-analog.o
ifdef CONFIG_SND_SOC_BENGAL
WSA881X_ANALOG_OBJS += wsa881x-temp-sensor.o
endif
endif
ifdef CONFIG_SND_SOC_MSM_STUB
STUB_OBJS += msm_stub.o
endif

View File

@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
/*
* Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/kernel.h>
@@ -9,6 +10,8 @@
#include <linux/of.h>
#include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/gpio.h>
#include <linux/of_gpio.h>
#include "../../../drivers/clk/qcom/common.h"
#include <linux/pinctrl/consumer.h>
#include <linux/platform_device.h>
@@ -29,6 +32,8 @@ enum {
AUDIO_EXT_CLK_LPASS_CORE_HW_VOTE,
AUDIO_EXT_CLK_LPASS8,
AUDIO_EXT_CLK_LPASS_AUDIO_HW_VOTE,
AUDIO_EXT_CLK_PM660_PMI,
AUDIO_EXT_CLK_DIV_CLK2,
AUDIO_EXT_CLK_LPASS_MAX,
AUDIO_EXT_CLK_EXTERNAL_PLL = AUDIO_EXT_CLK_LPASS_MAX,
AUDIO_EXT_CLK_MAX,
@@ -44,6 +49,7 @@ struct pinctrl_info {
struct audio_ext_clk {
struct pinctrl_info pnctrl_info;
struct clk_fixed_factor fact;
int gpio;
};
struct audio_ext_clk_priv {
@@ -105,7 +111,7 @@ static void audio_ext_clk_unprepare(struct clk_hw *hw)
ret = pinctrl_select_state(pnctrl_info->pinctrl,
pnctrl_info->sleep);
if (ret) {
pr_err("%s: active state select failed with %d\n",
pr_err("%s: sleep state select failed with %d\n",
__func__, ret);
return;
}
@@ -387,6 +393,32 @@ static struct audio_ext_clk audio_clk_array[] = {
},
},
},
{
.gpio = -EINVAL,
.fact = {
.mult = 1,
.div = 1,
.hw.init = &(struct clk_init_data){
.name = "audio_ext_pm660_pmi_clk",
.parent_names = (const char *[]){ "div_clk1" },
.num_parents = 1,
.ops = &audio_ext_clk_dummy_ops,
},
},
},
{
.pnctrl_info = {NULL},
.fact = {
.mult = 1,
.div = 1,
.hw.init = &(struct clk_init_data){
.name = "audio_ext_div_clk2",
.parent_names = (const char *[]){ "div_clk2" },
.num_parents = 1,
.ops = &audio_ext_clk_ops,
},
},
},
};
static int audio_get_pinctrl(struct platform_device *pdev)
@@ -510,6 +542,7 @@ static int audio_ref_clk_probe(struct platform_device *pdev)
int ret;
struct audio_ext_clk_priv *clk_priv;
u32 clk_freq = 0, clk_id = 0, clk_src = 0, use_pinctrl = 0;
int clk_gpio;
clk_priv = devm_kzalloc(&pdev->dev, sizeof(*clk_priv), GFP_KERNEL);
if (!clk_priv)
@@ -581,11 +614,30 @@ static int audio_ref_clk_probe(struct platform_device *pdev)
}
}
clk_gpio = of_get_named_gpio(pdev->dev.of_node,
"qcom,audio-ref-clk-gpio", 0);
if (clk_gpio > 0) {
ret = gpio_request(clk_gpio, "EXT_CLK");
if (ret) {
dev_err(&pdev->dev,
"Request ext clk gpio failed %d, err:%d\n",
clk_gpio, ret);
return ret;
}
if (of_property_read_bool(pdev->dev.of_node,
"qcom,node_has_rpm_clock")) {
clk_priv->audio_clk.gpio = clk_gpio;
}
}
ret = audio_get_clk_data(pdev);
if (ret) {
dev_err(&pdev->dev, "%s: clk_init is failed\n",
__func__);
audio_put_pinctrl(pdev);
if (use_pinctrl)
audio_put_pinctrl(pdev);
if (clk_priv->audio_clk.gpio > 0)
gpio_free(clk_priv->audio_clk.gpio);
return ret;
}
return 0;
@@ -593,7 +645,11 @@ static int audio_ref_clk_probe(struct platform_device *pdev)
static int audio_ref_clk_remove(struct platform_device *pdev)
{
struct audio_ext_clk_priv *clk_priv = platform_get_drvdata(pdev);
audio_put_pinctrl(pdev);
if (clk_priv->audio_clk.gpio > 0)
gpio_free(clk_priv->audio_clk.gpio);
return 0;
}

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
/* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/module.h>
@@ -175,7 +175,7 @@ struct tx_macro_priv {
int dec_mode[NUM_DECIMATORS];
bool bcs_clk_en;
bool hs_slow_insert_complete;
int amic_sample_rate;
int pcm_rate[NUM_DECIMATORS];
};
static bool tx_macro_get_data(struct snd_soc_component *component,
@@ -501,23 +501,23 @@ static void tx_macro_tx_hpf_corner_freq_callback(struct work_struct *work)
snd_soc_component_update_bits(component, hpf_gate_reg,
0x03, 0x02);
/* Add delay between toggle hpf gate based on sample rate */
switch(tx_priv->amic_sample_rate) {
case 8000:
switch (tx_priv->pcm_rate[hpf_work->decimator]) {
case 0:
usleep_range(125, 130);
break;
case 16000:
case 1:
usleep_range(62, 65);
break;
case 32000:
case 3:
usleep_range(31, 32);
break;
case 48000:
case 4:
usleep_range(20, 21);
break;
case 96000:
case 5:
usleep_range(10, 11);
break;
case 192000:
case 6:
usleep_range(5, 6);
break;
default:
@@ -953,7 +953,7 @@ static int tx_macro_enable_dec(struct snd_soc_dapm_widget *w,
tx_fs_reg = BOLERO_CDC_TX0_TX_PATH_CTL +
TX_MACRO_TX_PATH_OFFSET * decimator;
tx_priv->amic_sample_rate = (snd_soc_component_read32(component,
tx_priv->pcm_rate[decimator] = (snd_soc_component_read32(component,
tx_fs_reg) & 0x0F);
switch (event) {

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
/* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/module.h>
@@ -173,6 +173,7 @@ struct va_macro_priv {
bool lpi_enable;
bool register_event_listener;
int dec_mode[VA_MACRO_NUM_DECIMATORS];
int pcm_rate[VA_MACRO_NUM_DECIMATORS];
};
static bool va_macro_get_data(struct snd_soc_component *component,
@@ -837,8 +838,29 @@ static void va_macro_tx_hpf_corner_freq_callback(struct work_struct *work)
hpf_cut_off_freq << 5);
snd_soc_component_update_bits(component, hpf_gate_reg,
0x03, 0x02);
/* Minimum 1 clk cycle delay is required as per HW spec */
usleep_range(1000, 1010);
/* Add delay between toggle hpf gate based on sample rate */
switch (va_priv->pcm_rate[hpf_work->decimator]) {
case 0:
usleep_range(125, 130);
break;
case 1:
usleep_range(62, 65);
break;
case 3:
usleep_range(31, 32);
break;
case 4:
usleep_range(20, 21);
break;
case 5:
usleep_range(10, 11);
break;
case 6:
usleep_range(5, 6);
break;
default:
usleep_range(125, 130);
}
snd_soc_component_update_bits(component, hpf_gate_reg,
0x03, 0x01);
} else {
@@ -1094,6 +1116,7 @@ static int va_macro_enable_dec(struct snd_soc_dapm_widget *w,
u16 tx_vol_ctl_reg, dec_cfg_reg, hpf_gate_reg;
u16 tx_gain_ctl_reg;
u8 hpf_cut_off_freq;
u16 tx_fs_reg = 0;
struct device *va_dev = NULL;
struct va_macro_priv *va_priv = NULL;
int hpf_delay = BOLERO_CDC_VA_TX_DMIC_HPF_DELAY_MS;
@@ -1115,6 +1138,10 @@ static int va_macro_enable_dec(struct snd_soc_dapm_widget *w,
VA_MACRO_TX_PATH_OFFSET * decimator;
tx_gain_ctl_reg = BOLERO_CDC_VA_TX0_TX_VOL_CTL +
VA_MACRO_TX_PATH_OFFSET * decimator;
tx_fs_reg = BOLERO_CDC_VA_TX0_TX_PATH_CTL +
VA_MACRO_TX_PATH_OFFSET * decimator;
va_priv->pcm_rate[decimator] = (snd_soc_component_read32(component,
tx_fs_reg) & 0x0F);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/init.h>
@@ -44,6 +44,61 @@ static const unsigned int ep92_dsd_freq_table[4] = {
64, 128, 256, 0
};
/* EP92 register default values */
static struct reg_default ep92_reg_defaults[] = {
{EP92_BI_VENDOR_ID_0, 0x17},
{EP92_BI_VENDOR_ID_1, 0x7A},
{EP92_BI_DEVICE_ID_0, 0x94},
{EP92_BI_DEVICE_ID_1, 0xA3},
{EP92_BI_VERSION_NUM, 0x10},
{EP92_BI_VERSION_YEAR, 0x09},
{EP92_BI_VERSION_MONTH, 0x07},
{EP92_BI_VERSION_DATE, 0x06},
{EP92_BI_GENERAL_INFO_0, 0x00},
{EP92_BI_GENERAL_INFO_1, 0x00},
{EP92_BI_GENERAL_INFO_2, 0x00},
{EP92_BI_GENERAL_INFO_3, 0x00},
{EP92_BI_GENERAL_INFO_4, 0x00},
{EP92_BI_GENERAL_INFO_5, 0x00},
{EP92_BI_GENERAL_INFO_6, 0x00},
{EP92_ISP_MODE_ENTER_ISP, 0x00},
{EP92_GENERAL_CONTROL_0, 0x20},
{EP92_GENERAL_CONTROL_1, 0x00},
{EP92_GENERAL_CONTROL_2, 0x00},
{EP92_GENERAL_CONTROL_3, 0x10},
{EP92_GENERAL_CONTROL_4, 0x00},
{EP92_CEC_EVENT_CODE, 0x00},
{EP92_CEC_EVENT_PARAM_1, 0x00},
{EP92_CEC_EVENT_PARAM_2, 0x00},
{EP92_CEC_EVENT_PARAM_3, 0x00},
{EP92_CEC_EVENT_PARAM_4, 0x00},
{EP92_AUDIO_INFO_SYSTEM_STATUS_0, 0x00},
{EP92_AUDIO_INFO_SYSTEM_STATUS_1, 0x00},
{EP92_AUDIO_INFO_AUDIO_STATUS, 0x00},
{EP92_AUDIO_INFO_CHANNEL_STATUS_0, 0x00},
{EP92_AUDIO_INFO_CHANNEL_STATUS_1, 0x00},
{EP92_AUDIO_INFO_CHANNEL_STATUS_2, 0x00},
{EP92_AUDIO_INFO_CHANNEL_STATUS_3, 0x00},
{EP92_AUDIO_INFO_CHANNEL_STATUS_4, 0x00},
{EP92_AUDIO_INFO_ADO_INFO_FRAME_0, 0x00},
{EP92_AUDIO_INFO_ADO_INFO_FRAME_1, 0x00},
{EP92_AUDIO_INFO_ADO_INFO_FRAME_2, 0x00},
{EP92_AUDIO_INFO_ADO_INFO_FRAME_3, 0x00},
{EP92_AUDIO_INFO_ADO_INFO_FRAME_4, 0x00},
{EP92_AUDIO_INFO_ADO_INFO_FRAME_5, 0x00},
{EP92_OTHER_PACKETS_HDMI_VS_0, 0x00},
{EP92_OTHER_PACKETS_HDMI_VS_1, 0x00},
{EP92_OTHER_PACKETS_ACP_PACKET, 0x00},
{EP92_OTHER_PACKETS_AVI_INFO_FRAME_0, 0x00},
{EP92_OTHER_PACKETS_AVI_INFO_FRAME_1, 0x00},
{EP92_OTHER_PACKETS_AVI_INFO_FRAME_2, 0x00},
{EP92_OTHER_PACKETS_AVI_INFO_FRAME_3, 0x00},
{EP92_OTHER_PACKETS_AVI_INFO_FRAME_4, 0x00},
{EP92_OTHER_PACKETS_GC_PACKET_0, 0x00},
{EP92_OTHER_PACKETS_GC_PACKET_1, 0x00},
{EP92_OTHER_PACKETS_GC_PACKET_2, 0x00},
};
static bool ep92_volatile_register(struct device *dev, unsigned int reg)
{
/* do not cache register state in regmap */
@@ -115,6 +170,77 @@ struct ep92_pdata {
#endif /* CONFIG_DEBUG_FS */
};
struct ep92_mclk_cfg_info {
uint32_t in_sample_rate;
uint32_t out_mclk_freq;
uint8_t mul_val;
};
#define EP92_MCLK_MUL_512 0x3
#define EP92_MCLK_MUL_384 0x2
#define EP92_MCLK_MUL_256 0x1
#define EP92_MCLK_MUL_128 0x0
#define EP92_MCLK_MUL_MASK 0x3
/**
* ep92_set_ext_mclk - Configure the mclk based on sample freq
*
* @codec: handle pointer to ep92 codec
* @mclk_freq: mclk frequency to be set
*
* Returns 0 for success or appropriate negative error code
*/
int ep92_set_ext_mclk(struct snd_soc_codec *codec, uint32_t mclk_freq)
{
unsigned int samp_freq = 0;
struct ep92_pdata *ep92 = NULL;
uint8_t value = 0;
int ret = 0;
if (!codec)
return -EINVAL;
ep92 = snd_soc_codec_get_drvdata(codec);
samp_freq = ep92_samp_freq_table[(ep92->ai.audio_status) &
EP92_AI_RATE_MASK];
if (!mclk_freq || (mclk_freq % samp_freq)) {
pr_err("%s incompatbile mclk:%u and sample freq:%u\n",
__func__, mclk_freq, samp_freq);
return -EINVAL;
}
switch (mclk_freq / samp_freq) {
case 512:
value = EP92_MCLK_MUL_512;
break;
case 384:
value = EP92_MCLK_MUL_384;
break;
case 256:
value = EP92_MCLK_MUL_256;
break;
case 128:
value = EP92_MCLK_MUL_128;
break;
default:
dev_err(codec->dev, "unsupported mclk:%u for sample freq:%u\n",
mclk_freq, samp_freq);
return -EINVAL;
}
pr_debug("%s mclk:%u, in sample freq:%u, write reg:0x%02x val:0x%02x\n",
__func__, mclk_freq, samp_freq,
EP92_GENERAL_CONTROL_2, EP92_MCLK_MUL_MASK & value);
ret = snd_soc_update_bits(codec, EP92_GENERAL_CONTROL_2,
EP92_MCLK_MUL_MASK, value);
return (((ret == 0) || (ret == 1)) ? 0 : ret);
}
EXPORT_SYMBOL(ep92_set_ext_mclk);
#if IS_ENABLED(CONFIG_DEBUG_FS)
static int debugfs_codec_open_op(struct inode *inode, struct file *file)
{

View File

@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
*/
#ifndef __EP92_H__
@@ -69,63 +69,6 @@
#define EP92_MAX_REGISTER_ADDR EP92_OTHER_PACKETS_GC_PACKET_2
/* EP92 register default values */
static struct reg_default ep92_reg_defaults[] = {
{EP92_BI_VENDOR_ID_0, 0x17},
{EP92_BI_VENDOR_ID_1, 0x7A},
{EP92_BI_DEVICE_ID_0, 0x94},
{EP92_BI_DEVICE_ID_1, 0xA3},
{EP92_BI_VERSION_NUM, 0x10},
{EP92_BI_VERSION_YEAR, 0x09},
{EP92_BI_VERSION_MONTH, 0x07},
{EP92_BI_VERSION_DATE, 0x06},
{EP92_BI_GENERAL_INFO_0, 0x00},
{EP92_BI_GENERAL_INFO_1, 0x00},
{EP92_BI_GENERAL_INFO_2, 0x00},
{EP92_BI_GENERAL_INFO_3, 0x00},
{EP92_BI_GENERAL_INFO_4, 0x00},
{EP92_BI_GENERAL_INFO_5, 0x00},
{EP92_BI_GENERAL_INFO_6, 0x00},
{EP92_ISP_MODE_ENTER_ISP, 0x00},
{EP92_GENERAL_CONTROL_0, 0x20},
{EP92_GENERAL_CONTROL_1, 0x00},
{EP92_GENERAL_CONTROL_2, 0x00},
{EP92_GENERAL_CONTROL_3, 0x10},
{EP92_GENERAL_CONTROL_4, 0x00},
{EP92_CEC_EVENT_CODE, 0x00},
{EP92_CEC_EVENT_PARAM_1, 0x00},
{EP92_CEC_EVENT_PARAM_2, 0x00},
{EP92_CEC_EVENT_PARAM_3, 0x00},
{EP92_CEC_EVENT_PARAM_4, 0x00},
{EP92_AUDIO_INFO_SYSTEM_STATUS_0, 0x00},
{EP92_AUDIO_INFO_SYSTEM_STATUS_1, 0x00},
{EP92_AUDIO_INFO_AUDIO_STATUS, 0x00},
{EP92_AUDIO_INFO_CHANNEL_STATUS_0, 0x00},
{EP92_AUDIO_INFO_CHANNEL_STATUS_1, 0x00},
{EP92_AUDIO_INFO_CHANNEL_STATUS_2, 0x00},
{EP92_AUDIO_INFO_CHANNEL_STATUS_3, 0x00},
{EP92_AUDIO_INFO_CHANNEL_STATUS_4, 0x00},
{EP92_AUDIO_INFO_ADO_INFO_FRAME_0, 0x00},
{EP92_AUDIO_INFO_ADO_INFO_FRAME_1, 0x00},
{EP92_AUDIO_INFO_ADO_INFO_FRAME_2, 0x00},
{EP92_AUDIO_INFO_ADO_INFO_FRAME_3, 0x00},
{EP92_AUDIO_INFO_ADO_INFO_FRAME_4, 0x00},
{EP92_AUDIO_INFO_ADO_INFO_FRAME_5, 0x00},
{EP92_OTHER_PACKETS_HDMI_VS_0, 0x00},
{EP92_OTHER_PACKETS_HDMI_VS_1, 0x00},
{EP92_OTHER_PACKETS_ACP_PACKET, 0x00},
{EP92_OTHER_PACKETS_AVI_INFO_FRAME_0, 0x00},
{EP92_OTHER_PACKETS_AVI_INFO_FRAME_1, 0x00},
{EP92_OTHER_PACKETS_AVI_INFO_FRAME_2, 0x00},
{EP92_OTHER_PACKETS_AVI_INFO_FRAME_3, 0x00},
{EP92_OTHER_PACKETS_AVI_INFO_FRAME_4, 0x00},
{EP92_OTHER_PACKETS_GC_PACKET_0, 0x00},
{EP92_OTHER_PACKETS_GC_PACKET_1, 0x00},
{EP92_OTHER_PACKETS_GC_PACKET_2, 0x00},
};
/* shift/masks for register bits
* GI = General Info
* GC = General Control
@@ -211,4 +154,6 @@ enum {
EP92_KCTL_MAX
};
int ep92_set_ext_mclk(struct snd_soc_codec *codec, uint32_t mclk_freq);
#endif /* __EP92_H__ */

35
techpack/audio/asoc/codecs/msm_hdmi_codec_rx.c Normal file → Executable file
View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/platform_device.h>
#include <linux/slab.h>
@@ -222,9 +222,9 @@ static int msm_ext_disp_audio_type_get(struct snd_kcontrol *kcontrol,
rc = msm_ext_disp_select_audio_codec(codec_data->ext_disp_core_pdev,
&codec_info);
if (!codec_data->ext_disp_ops.get_audio_edid_blk ||
if (!codec_data->ext_disp_ops.cable_status ||
!codec_data->ext_disp_ops.get_intf_id || rc) {
dev_err(component->dev, "%s: get_audio_edid_blk() or get_intf_id is NULL\n",
dev_err(component->dev, "%s: cable_status() or get_intf_id is NULL\n",
__func__);
rc = -EINVAL;
goto cable_err;
@@ -735,6 +735,10 @@ static int msm_ext_disp_audio_codec_rx_probe(
{
struct msm_ext_disp_audio_codec_rx_data *codec_data;
struct device_node *of_node_parent = NULL;
struct msm_ext_disp_codec_id codec_info;
int dai_id = DP_DAI1;
int type;
int rc = 0;
codec_data = kzalloc(sizeof(struct msm_ext_disp_audio_codec_rx_data),
GFP_KERNEL);
@@ -775,6 +779,31 @@ static int msm_ext_disp_audio_codec_rx_probe(
dev_dbg(component->dev, "%s(): registered %s with ext disp core\n",
__func__, component->name);
mutex_lock(&codec_data->dp_ops_lock);
/*Find a connected ext device to notify DisPlay*/
for (dai_id = DP_DAI1; dai_id < DP_DAI_MAX; dai_id++)
{
if (dai_id == HDMI_MS_DAI)
type = EXT_DISPLAY_TYPE_HDMI;
else
type = EXT_DISPLAY_TYPE_DP;
SWITCH_DP_CODEC(codec_info, codec_data, dai_id, type);
rc = msm_ext_disp_select_audio_codec(codec_data->ext_disp_core_pdev,
&codec_info);
if (!rc) {
if(codec_data->ext_disp_ops.ready) {
rc = codec_data->ext_disp_ops.ready(codec_data->ext_disp_core_pdev);
if(!rc)
break;
}
}
}
mutex_unlock(&codec_data->dp_ops_lock);
return 0;
}

View File

@@ -20,6 +20,21 @@ ifeq ($(KERNEL_BUILD), 0)
export
INCS += -include $(AUDIO_ROOT)/config/sdm660autoconf.h
endif
ifeq ($(CONFIG_ARCH_SDM450), y)
include $(AUDIO_ROOT)/config/sdm450auto.conf
export
INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
endif
ifeq ($(CONFIG_ARCH_SDM439), y)
include $(AUDIO_ROOT)/config/sdm450auto.conf
export
INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
endif
ifeq ($(CONFIG_ARCH_MSM8917), y)
include $(AUDIO_ROOT)/config/sdm450auto.conf
export
INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
endif
endif
# As per target team, build is done as follows:

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2016-2018, 2020, The Linux Foundation. All rights reserved.
/* Copyright (c) 2016-2018, 2020-2021, 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
@@ -1811,7 +1811,9 @@ static int msm_sdw_notifier_service_cb(struct notifier_block *nb,
initial_boot = false;
break;
}
mutex_lock(&msm_sdw->cdc_int_mclk1_mutex);
msm_sdw->int_mclk1_enabled = false;
mutex_unlock(&msm_sdw->cdc_int_mclk1_mutex);
msm_sdw->dev_up = false;
for (i = 0; i < msm_sdw->nr; i++)
swrm_wcd_notify(msm_sdw->sdw_ctrl_data[i].sdw_pdev,
@@ -2002,7 +2004,8 @@ static int msm_sdw_probe(struct platform_device *pdev)
int adsp_state;
adsp_state = apr_get_subsys_state();
if (adsp_state != APR_SUBSYS_LOADED) {
if (adsp_state != APR_SUBSYS_LOADED ||
!q6core_is_adsp_ready()) {
dev_err(&pdev->dev, "Adsp is not loaded yet %d\n",
adsp_state);
return -EPROBE_DEFER;

View File

@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/module.h>
#include <linux/init.h>
@@ -36,6 +37,8 @@
#define ROULEUR_HPHL_CROSS_CONN_THRESHOLD 350
#define ROULEUR_HPHR_CROSS_CONN_THRESHOLD 350
#define IMPED_NUM_RETRY 5
static struct wcd_mbhc_register
wcd_mbhc_registers[WCD_MBHC_REG_FUNC_MAX] = {
WCD_MBHC_REGISTER("WCD_MBHC_L_DET_EN",
@@ -457,6 +460,10 @@ static void rouleur_mbhc_get_result_params(struct rouleur_priv *rouleur,
__func__, *zdet);
/* Start discharge */
regmap_update_bits(rouleur->regmap, ROULEUR_ANA_MBHC_ZDET, 0x20, 0x00);
/* Discharge operation takes time for the HPH PA to ramp down to 0V.
* Add finite amunt of delay to complete ramp down.
*/
usleep_range(40000, 40010);
}
static void rouleur_mbhc_zdet_start(struct snd_soc_component *component,
@@ -471,9 +478,6 @@ static void rouleur_mbhc_zdet_start(struct snd_soc_component *component,
/* HPHL pull down switch to force OFF */
regmap_update_bits(rouleur->regmap,
ROULEUR_ANA_HPHPA_CNP_CTL_2, 0x30, 0x00);
/* Averaging enable for reliable results */
regmap_update_bits(rouleur->regmap,
ROULEUR_ANA_MBHC_ZDET_ANA_CTL, 0x80, 0x80);
/* ZDET left measurement enable */
regmap_update_bits(rouleur->regmap,
ROULEUR_ANA_MBHC_ZDET, 0x80, 0x80);
@@ -482,8 +486,6 @@ static void rouleur_mbhc_zdet_start(struct snd_soc_component *component,
regmap_update_bits(rouleur->regmap,
ROULEUR_ANA_MBHC_ZDET, 0x80, 0x00);
regmap_update_bits(rouleur->regmap,
ROULEUR_ANA_MBHC_ZDET_ANA_CTL, 0x80, 0x00);
regmap_update_bits(rouleur->regmap,
ROULEUR_ANA_HPHPA_CNP_CTL_2, 0x30, 0x20);
@@ -495,9 +497,6 @@ static void rouleur_mbhc_zdet_start(struct snd_soc_component *component,
/* HPHR pull down switch to force OFF */
regmap_update_bits(rouleur->regmap,
ROULEUR_ANA_HPHPA_CNP_CTL_2, 0x0C, 0x00);
/* Averaging enable for reliable results */
regmap_update_bits(rouleur->regmap,
ROULEUR_ANA_MBHC_ZDET_ANA_CTL, 0x80, 0x80);
/* ZDET right measurement enable */
regmap_update_bits(rouleur->regmap,
ROULEUR_ANA_MBHC_ZDET, 0x40, 0x40);
@@ -507,14 +506,58 @@ static void rouleur_mbhc_zdet_start(struct snd_soc_component *component,
regmap_update_bits(rouleur->regmap,
ROULEUR_ANA_MBHC_ZDET, 0x40, 0x00);
regmap_update_bits(rouleur->regmap,
ROULEUR_ANA_MBHC_ZDET_ANA_CTL, 0x80, 0x00);
regmap_update_bits(rouleur->regmap,
ROULEUR_ANA_HPHPA_CNP_CTL_2, 0x0C, 0x08);
*zr = zdet;
}
static void rouleur_mbhc_impedance_fn(struct snd_soc_component *component,
int32_t *z1L, int32_t *z1R,
int32_t *zl, int32_t *zr)
{
int i;
bool is_zl_calculted = false;
bool is_zr_calculted = false;
/*
* Calculate impedance for multiple times until IMPED_NUM_RETRY
* stop calculating if the result is within the threshold
*/
for (i = 0; i < IMPED_NUM_RETRY; i++) {
if (!is_zl_calculted) {
/* Start of left ch impedance calculation */
rouleur_mbhc_zdet_start(component, z1L, NULL);
if ((*z1L == ROULEUR_ZDET_FLOATING_IMPEDANCE) ||
(*z1L > ROULEUR_ZDET_VAL_100K))
*zl = ROULEUR_ZDET_FLOATING_IMPEDANCE;
else {
*zl = *z1L/1000;
is_zl_calculted = true;
}
}
if (!is_zr_calculted) {
/* Start of right ch impedance calculation */
rouleur_mbhc_zdet_start(component, NULL, z1R);
if ((*z1R == ROULEUR_ZDET_FLOATING_IMPEDANCE) ||
(*z1R > ROULEUR_ZDET_VAL_100K))
*zr = ROULEUR_ZDET_FLOATING_IMPEDANCE;
else {
*zr = *z1R/1000;
is_zr_calculted = true;
}
}
if (is_zl_calculted && is_zr_calculted)
break;
}
dev_dbg(component->dev, "%s: impedance on HPH_L = %d(ohms)\n",
__func__, *zl);
dev_dbg(component->dev, "%s: impedance on HPH_R = %d(ohms)\n",
__func__, *zr);
}
static void rouleur_wcd_mbhc_calc_impedance(struct wcd_mbhc *mbhc, uint32_t *zl,
uint32_t *zr)
{
@@ -564,27 +607,15 @@ static void rouleur_wcd_mbhc_calc_impedance(struct wcd_mbhc *mbhc, uint32_t *zl,
/* 1ms delay needed after disable surge protection */
usleep_range(1000, 1010);
/* Start of left ch impedance calculation */
rouleur_mbhc_zdet_start(component, &z1L, NULL);
if ((z1L == ROULEUR_ZDET_FLOATING_IMPEDANCE) ||
(z1L > ROULEUR_ZDET_VAL_100K))
*zl = ROULEUR_ZDET_FLOATING_IMPEDANCE;
else
*zl = z1L/1000;
/* Averaging enable for reliable impedance results */
regmap_update_bits(rouleur->regmap,
ROULEUR_ANA_MBHC_ZDET_ANA_CTL, 0x80, 0x80);
dev_dbg(component->dev, "%s: impedance on HPH_L = %d(ohms)\n",
__func__, *zl);
rouleur_mbhc_impedance_fn(component, &z1L, &z1R, zl, zr);
/* Start of right ch impedance calculation */
rouleur_mbhc_zdet_start(component, NULL, &z1R);
if ((z1R == ROULEUR_ZDET_FLOATING_IMPEDANCE) ||
(z1R > ROULEUR_ZDET_VAL_100K))
*zr = ROULEUR_ZDET_FLOATING_IMPEDANCE;
else
*zr = z1R/1000;
dev_dbg(component->dev, "%s: impedance on HPH_R = %d(ohms)\n",
__func__, *zr);
/* Disable averaging after impedance calculation */
regmap_update_bits(rouleur->regmap,
ROULEUR_ANA_MBHC_ZDET_ANA_CTL, 0x80, 0x00);
/* Mono/stereo detection */
if ((*zl == ROULEUR_ZDET_FLOATING_IMPEDANCE) &&

View File

@@ -11,15 +11,276 @@
#include <linux/component.h>
#include <soc/soundwire.h>
#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
#include <linux/uaccess.h>
#define SWR_SLV_MAX_REG_ADDR 0x2009
#define SWR_SLV_START_REG_ADDR 0x40
#define SWR_SLV_MAX_BUF_LEN 20
#define BYTES_PER_LINE 12
#define SWR_SLV_RD_BUF_LEN 8
#define SWR_SLV_WR_BUF_LEN 32
#define SWR_SLV_MAX_DEVICES 2
#endif /* CONFIG_DEBUG_FS */
struct rouleur_slave_priv {
struct swr_device *swr_slave;
#ifdef CONFIG_DEBUG_FS
struct dentry *debugfs_rouleur_dent;
struct dentry *debugfs_peek;
struct dentry *debugfs_poke;
struct dentry *debugfs_reg_dump;
unsigned int read_data;
#endif
};
#ifdef CONFIG_DEBUG_FS
static int codec_debug_open(struct inode *inode, struct file *file)
{
file->private_data = inode->i_private;
return 0;
}
static int get_parameters(char *buf, u32 *param1, int num_of_par)
{
char *token = NULL;
int base = 0, cnt = 0;
token = strsep(&buf, " ");
for (cnt = 0; cnt < num_of_par; cnt++) {
if (token) {
if ((token[1] == 'x') || (token[1] == 'X'))
base = 16;
else
base = 10;
if (kstrtou32(token, base, &param1[cnt]) != 0)
return -EINVAL;
token = strsep(&buf, " ");
} else {
return -EINVAL;
}
}
return 0;
}
static bool is_swr_slv_reg_readable(int reg)
{
int ret = true;
if (((reg > 0x46) && (reg < 0x4A)) ||
((reg > 0x4A) && (reg < 0x50)) ||
((reg > 0x55) && (reg < 0xD0)) ||
((reg > 0xD0) && (reg < 0xE0)) ||
((reg > 0xE0) && (reg < 0xF0)) ||
((reg > 0xF0) && (reg < 0x100)) ||
((reg > 0x105) && (reg < 0x120)) ||
((reg > 0x205) && (reg < 0x220)) ||
((reg > 0x305) && (reg < 0x320)) ||
((reg > 0x405) && (reg < 0x420)) ||
((reg > 0x128) && (reg < 0x130)) ||
((reg > 0x228) && (reg < 0x230)) ||
((reg > 0x328) && (reg < 0x330)) ||
((reg > 0x428) && (reg < 0x430)) ||
((reg > 0x138) && (reg < 0x205)) ||
((reg > 0x238) && (reg < 0x305)) ||
((reg > 0x338) && (reg < 0x405)) ||
((reg > 0x405) && (reg < 0xF00)) ||
((reg > 0xF05) && (reg < 0xF20)) ||
((reg > 0xF25) && (reg < 0xF30)) ||
((reg > 0xF35) && (reg < 0x2000)))
ret = false;
return ret;
}
static ssize_t rouleur_swrslave_reg_show(struct swr_device *pdev,
char __user *ubuf,
size_t count, loff_t *ppos)
{
int i, reg_val, len;
ssize_t total = 0;
char tmp_buf[SWR_SLV_MAX_BUF_LEN];
if (!ubuf || !ppos)
return 0;
for (i = (((int) *ppos/BYTES_PER_LINE) + SWR_SLV_START_REG_ADDR);
i <= SWR_SLV_MAX_REG_ADDR; i++) {
if (!is_swr_slv_reg_readable(i))
continue;
swr_read(pdev, pdev->dev_num, i, &reg_val, 1);
len = snprintf(tmp_buf, sizeof(tmp_buf), "0x%.3x: 0x%.2x\n", i,
(reg_val & 0xFF));
if (len < 0) {
pr_err("%s: fail to fill the buffer\n", __func__);
total = -EFAULT;
goto copy_err;
}
if (((total + len) >= count - 1) || (len < 0))
break;
if (copy_to_user((ubuf + total), tmp_buf, len)) {
pr_err("%s: fail to copy reg dump\n", __func__);
total = -EFAULT;
goto copy_err;
}
total += len;
*ppos += len;
}
copy_err:
*ppos = SWR_SLV_MAX_REG_ADDR * BYTES_PER_LINE;
return total;
}
static ssize_t codec_debug_dump(struct file *file, char __user *ubuf,
size_t count, loff_t *ppos)
{
struct swr_device *pdev;
if (!count || !file || !ppos || !ubuf)
return -EINVAL;
pdev = file->private_data;
if (!pdev)
return -EINVAL;
if (*ppos < 0)
return -EINVAL;
return rouleur_swrslave_reg_show(pdev, ubuf, count, ppos);
}
static ssize_t codec_debug_read(struct file *file, char __user *ubuf,
size_t count, loff_t *ppos)
{
char lbuf[SWR_SLV_RD_BUF_LEN];
struct swr_device *pdev = NULL;
struct rouleur_slave_priv *rouleur_slave = NULL;
if (!count || !file || !ppos || !ubuf)
return -EINVAL;
pdev = file->private_data;
if (!pdev)
return -EINVAL;
rouleur_slave = swr_get_dev_data(pdev);
if (!rouleur_slave)
return -EINVAL;
if (*ppos < 0)
return -EINVAL;
snprintf(lbuf, sizeof(lbuf), "0x%x\n",
(rouleur_slave->read_data & 0xFF));
return simple_read_from_buffer(ubuf, count, ppos, lbuf,
strnlen(lbuf, 7));
}
static ssize_t codec_debug_peek_write(struct file *file,
const char __user *ubuf, size_t cnt, loff_t *ppos)
{
char lbuf[SWR_SLV_WR_BUF_LEN];
int rc = 0;
u32 param[5];
struct swr_device *pdev = NULL;
struct rouleur_slave_priv *rouleur_slave = NULL;
if (!cnt || !file || !ppos || !ubuf)
return -EINVAL;
pdev = file->private_data;
if (!pdev)
return -EINVAL;
rouleur_slave = swr_get_dev_data(pdev);
if (!rouleur_slave)
return -EINVAL;
if (*ppos < 0)
return -EINVAL;
if (cnt > sizeof(lbuf) - 1)
return -EINVAL;
rc = copy_from_user(lbuf, ubuf, cnt);
if (rc)
return -EFAULT;
lbuf[cnt] = '\0';
rc = get_parameters(lbuf, param, 1);
if (!((param[0] <= SWR_SLV_MAX_REG_ADDR) && (rc == 0)))
return -EINVAL;
swr_read(pdev, pdev->dev_num, param[0], &rouleur_slave->read_data, 1);
if (rc == 0)
rc = cnt;
else
pr_err("%s: rc = %d\n", __func__, rc);
return rc;
}
static ssize_t codec_debug_write(struct file *file,
const char __user *ubuf, size_t cnt, loff_t *ppos)
{
char lbuf[SWR_SLV_WR_BUF_LEN];
int rc = 0;
u32 param[5];
struct swr_device *pdev;
if (!file || !ppos || !ubuf)
return -EINVAL;
pdev = file->private_data;
if (!pdev)
return -EINVAL;
if (cnt > sizeof(lbuf) - 1)
return -EINVAL;
rc = copy_from_user(lbuf, ubuf, cnt);
if (rc)
return -EFAULT;
lbuf[cnt] = '\0';
rc = get_parameters(lbuf, param, 2);
if (!((param[0] <= SWR_SLV_MAX_REG_ADDR) &&
(param[1] <= 0xFF) && (rc == 0)))
return -EINVAL;
swr_write(pdev, pdev->dev_num, param[0], &param[1]);
if (rc == 0)
rc = cnt;
else
pr_err("%s: rc = %d\n", __func__, rc);
return rc;
}
static const struct file_operations codec_debug_write_ops = {
.open = codec_debug_open,
.write = codec_debug_write,
};
static const struct file_operations codec_debug_read_ops = {
.open = codec_debug_open,
.read = codec_debug_read,
.write = codec_debug_peek_write,
};
static const struct file_operations codec_debug_dump_ops = {
.open = codec_debug_open,
.read = codec_debug_dump,
};
#endif
static int rouleur_slave_bind(struct device *dev,
struct device *master, void *data)
{
int ret = 0;
struct rouleur_slave_priv *rouleur_slave = NULL;
uint8_t devnum = 0;
struct swr_device *pdev = to_swr_device(dev);
@@ -28,15 +289,6 @@ static int rouleur_slave_bind(struct device *dev,
return -EINVAL;
}
rouleur_slave = devm_kzalloc(&pdev->dev,
sizeof(struct rouleur_slave_priv), GFP_KERNEL);
if (!rouleur_slave)
return -ENOMEM;
swr_set_dev_data(pdev, rouleur_slave);
rouleur_slave->swr_slave = pdev;
ret = swr_get_logical_dev_num(pdev, pdev->addr, &devnum);
if (ret) {
dev_dbg(&pdev->dev,
@@ -67,7 +319,6 @@ static void rouleur_slave_unbind(struct device *dev,
return;
}
swr_set_dev_data(pdev, NULL);
}
static const struct swr_device_id rouleur_swr_id[] = {
@@ -104,12 +355,61 @@ static int rouleur_swr_reset(struct swr_device *pdev)
static int rouleur_swr_probe(struct swr_device *pdev)
{
struct rouleur_slave_priv *rouleur_slave = NULL;
rouleur_slave = devm_kzalloc(&pdev->dev,
sizeof(struct rouleur_slave_priv), GFP_KERNEL);
if (!rouleur_slave)
return -ENOMEM;
swr_set_dev_data(pdev, rouleur_slave);
rouleur_slave->swr_slave = pdev;
#ifdef CONFIG_DEBUG_FS
if (!rouleur_slave->debugfs_rouleur_dent) {
rouleur_slave->debugfs_rouleur_dent = debugfs_create_dir(
dev_name(&pdev->dev), 0);
if (!IS_ERR(rouleur_slave->debugfs_rouleur_dent)) {
rouleur_slave->debugfs_peek =
debugfs_create_file("swrslave_peek",
S_IFREG | 0444,
rouleur_slave->debugfs_rouleur_dent,
(void *) pdev,
&codec_debug_read_ops);
rouleur_slave->debugfs_poke =
debugfs_create_file("swrslave_poke",
S_IFREG | 0444,
rouleur_slave->debugfs_rouleur_dent,
(void *) pdev,
&codec_debug_write_ops);
rouleur_slave->debugfs_reg_dump =
debugfs_create_file(
"swrslave_reg_dump",
S_IFREG | 0444,
rouleur_slave->debugfs_rouleur_dent,
(void *) pdev,
&codec_debug_dump_ops);
}
}
#endif
return component_add(&pdev->dev, &rouleur_slave_comp_ops);
}
static int rouleur_swr_remove(struct swr_device *pdev)
{
#ifdef CONFIG_DEBUG_FS
struct rouleur_slave_priv *rouleur_slave = swr_get_dev_data(pdev);
if (rouleur_slave) {
debugfs_remove_recursive(rouleur_slave->debugfs_rouleur_dent);
rouleur_slave->debugfs_rouleur_dent = NULL;
}
#endif
component_del(&pdev->dev, &rouleur_slave_comp_ops);
swr_set_dev_data(pdev, NULL);
swr_remove_device(pdev);
return 0;
}
@@ -140,5 +440,5 @@ static void __exit rouleur_slave_exit(void)
module_init(rouleur_slave_init);
module_exit(rouleur_slave_exit);
MODULE_DESCRIPTION("WCD937X Swr Slave driver");
MODULE_DESCRIPTION("Rouleur Swr Slave driver");
MODULE_LICENSE("GPL v2");

View File

@@ -4,7 +4,7 @@
AUDIO_CHIPSET := audio
# Build/Package only in case of supported target
ifeq ($(call is-board-platform-in-list, sdm660),true)
ifeq ($(call is-board-platform-in-list, sdm660 msm8953 msm8937),true)
LOCAL_PATH := $(call my-dir)

View File

@@ -20,6 +20,21 @@ ifeq ($(KERNEL_BUILD), 0)
export
INCS += -include $(AUDIO_ROOT)/config/sdm660autoconf.h
endif
ifeq ($(CONFIG_ARCH_SDM450), y)
include $(AUDIO_ROOT)/config/sdm450auto.conf
export
INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
endif
ifeq ($(CONFIG_ARCH_SDM439), y)
include $(AUDIO_ROOT)/config/sdm450auto.conf
export
INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
endif
ifeq ($(CONFIG_ARCH_MSM8917), y)
include $(AUDIO_ROOT)/config/sdm450auto.conf
export
INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
endif
endif
# As per target team, build is done as follows:
@@ -58,6 +73,10 @@ ifdef CONFIG_SND_SOC_DIGITAL_CDC
DIGITAL_CDC_OBJS += msm-digital-cdc.o
DIGITAL_CDC_OBJS += msm-digital-cdc-regmap.o
endif
ifdef CONFIG_SND_SOC_DIGITAL_CDC_LEGACY
DIGITAL_CDC_OBJS += msm-digital-cdc-legacy.o
DIGITAL_CDC_OBJS += msm-digital-cdc-legacy-regmap.o
endif
LINUX_INC += -Iinclude/linux
INCS += $(COMMON_INC) \
@@ -111,5 +130,8 @@ analog_cdc_dlkm-y := $(ANALOG_CDC_OBJS)
obj-$(CONFIG_SND_SOC_DIGITAL_CDC) += digital_cdc_dlkm.o
digital_cdc_dlkm-y := $(DIGITAL_CDC_OBJS)
obj-$(CONFIG_SND_SOC_DIGITAL_CDC_LEGACY) += 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')\"

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2015-2018, 2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2015-2018, 2020-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/module.h>
#include <linux/init.h>
@@ -3931,13 +3931,15 @@ static int sdm660_cdc_notifier_service_cb(struct notifier_block *nb,
bool timedout;
unsigned long timeout;
static bool initial_boot = true;
struct audio_notifier_cb_data *cb_data = ptr;
component = sdm660_cdc_priv->component;
dev_dbg(component->dev, "%s: Service opcode 0x%lx\n", __func__, opcode);
switch (opcode) {
case AUDIO_NOTIFIER_SERVICE_DOWN:
if (initial_boot) {
if (initial_boot &&
cb_data->service == AUDIO_NOTIFIER_PDR_SERVICE) {
initial_boot = false;
break;
}
@@ -3946,7 +3948,8 @@ static int sdm660_cdc_notifier_service_cb(struct notifier_block *nb,
msm_anlg_cdc_device_down(component);
break;
case AUDIO_NOTIFIER_SERVICE_UP:
if (initial_boot)
if (initial_boot &&
cb_data->service == AUDIO_NOTIFIER_PDR_SERVICE)
initial_boot = false;
dev_dbg(component->dev,
"ADSP is about to power up. bring up codec\n");
@@ -4653,7 +4656,8 @@ static int msm_anlg_cdc_probe(struct platform_device *pdev)
int adsp_state;
adsp_state = apr_get_subsys_state();
if (adsp_state != APR_SUBSYS_LOADED) {
if (adsp_state != APR_SUBSYS_LOADED ||
!q6core_is_adsp_ready()) {
dev_err(&pdev->dev, "Adsp is not loaded yet %d\n",
adsp_state);
return -EPROBE_DEFER;

View File

@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2015-2018, 2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2015-2018, 2020-2021, The Linux Foundation. All rights reserved.
*/
#ifndef MSM_ANALOG_CDC_H
#define MSM_ANALOG_CDC_H
@@ -227,7 +227,7 @@ extern int msm_anlg_cdc_mclk_enable(struct snd_soc_component *component,
extern int msm_anlg_cdc_hs_detect(struct snd_soc_component *component,
struct wcd_mbhc_config *mbhc_cfg);
extern void msm_anlg_cdc_hs_detect_exit(struct snd_soc_component *component);
extern void sdm660_cdc_update_int_spk_boost(bool enable);
extern void msm_anlg_cdc_update_int_spk_boost(bool enable);
extern void msm_anlg_cdc_spk_ext_pa_cb(
int (*codec_spk_ext_pa)(struct snd_soc_component *component,
int enable), struct snd_soc_component *component);
@@ -249,7 +249,7 @@ static inline void msm_anlg_cdc_hs_detect_exit(
{
}
static inline void sdm660_cdc_update_int_spk_boost(bool enable)
static inline void msm_anlg_cdc_update_int_spk_boost(bool enable)
{
}

View File

@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2016-2017, 2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2017, 2020-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/regmap.h>
@@ -56,5 +56,6 @@ enum dig_cdc_notify_event {
DIG_CDC_EVENT_POST_RX2_INT_OFF,
DIG_CDC_EVENT_SSR_DOWN,
DIG_CDC_EVENT_SSR_UP,
DIG_CDC_EVENT_CAP_CONFIGURE,
DIG_CDC_EVENT_LAST,
};

View File

@@ -0,0 +1,418 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2015-2018, 2021, The Linux Foundation. All rights reserved.
*/
#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_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_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_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_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_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_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_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_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_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;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -93,11 +93,12 @@ static int msm_digcdc_clock_control(bool flag)
__func__);
/*
* Avoid access to lpass register
* as clock enable failed during SSR.
* as clock enable failed during SSR/PDR.
*/
if (ret == -ENODEV)
msm_dig_cdc->regmap->cache_only = true;
msm_dig_cdc->regmap->cache_only = true;
return ret;
} else {
msm_dig_cdc->regmap->cache_only = false;
}
pr_debug("enabled digital codec core clk\n");
atomic_set(&pdata->int_mclk0_enabled, true);

View File

@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2016-2017, 2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2017, 2020-2021, The Linux Foundation. All rights reserved.
*/
#ifndef MSM_DIGITAL_CDC_H
#define MSM_DIGITAL_CDC_H
@@ -8,7 +8,7 @@
#define HPHL_PA_DISABLE (0x01 << 1)
#define HPHR_PA_DISABLE (0x01 << 2)
#define SPKR_PA_DISABLE (0x01 << 3)
#define MAX_REGULATOR 7
#define NUM_DECIMATORS 5
/* Codec supports 1 compander */
enum {
@@ -25,30 +25,62 @@ enum {
MSM89XX_RX_MAX,
};
enum {
ON_DEMAND_DIGITAL = 0,
ON_DEMAND_DIG_SUPPLIES_MAX,
};
struct on_demand_dig_supply {
struct regulator *supply;
atomic_t ref;
int min_uv;
int max_uv;
int optimum_ua;
};
struct dig_cdc_regulator {
const char *name;
int min_uv;
int max_uv;
int optimum_ua;
struct regulator *regulator;
};
struct tx_mute_work {
struct msm_dig_priv *dig_cdc;
u32 decimator;
struct delayed_work dwork;
};
struct msm_cap_mode {
u8 micbias1_cap_mode;
u8 micbias2_cap_mode;
};
struct msm_dig_priv {
struct snd_soc_component *component;
struct device *dev;
u32 comp_enabled[MSM89XX_RX_MAX];
int (*codec_hph_comp_gpio)(bool enable,
struct snd_soc_component *component);
struct snd_soc_component *component);
s32 dmic_1_2_clk_cnt;
s32 dmic_3_4_clk_cnt;
bool dec_active[NUM_DECIMATORS];
int version;
/* cal info for codec */
struct fw_info *fw_data;
bool no_analog_codec;
/* 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;
struct notifier_block service_nb;
u32 mute_mask;
int dapm_bias_off;
void *handle;
struct on_demand_dig_supply on_demand_list[ON_DEMAND_DIG_SUPPLIES_MAX];
void (*set_compander_mode)(void *handle, int val);
void (*update_clkdiv)(void *handle, int val);
int (*get_cdc_version)(void *handle);
@@ -56,6 +88,9 @@ struct msm_dig_priv {
struct notifier_block *nblock,
bool enable);
struct tx_mute_work tx_mute_dwork[NUM_DECIMATORS];
u32 num_of_supplies;
struct regulator_bulk_data *supplies;
struct dig_cdc_regulator regulator[MAX_REGULATOR];
};
struct dig_ctrl_platform_data {
@@ -85,13 +120,16 @@ enum {
BAND_MAX,
};
#if IS_ENABLED(CONFIG_SND_SOC_DIGITAL_CDC)
#if (IS_ENABLED(CONFIG_SND_SOC_DIGITAL_CDC) || \
IS_ENABLED(CONFIG_SND_SOC_DIGITAL_CDC_LEGACY))
extern void msm_dig_cdc_hph_comp_cb(
int (*codec_hph_comp_gpio)(
bool enable, struct snd_soc_component *component),
struct snd_soc_component *component);
int msm_dig_codec_info_create_codec_entry(struct snd_info_entry *codec_root,
struct snd_soc_component *component);
extern int msm_digcdc_mclk_enable(struct snd_soc_component *component,
int mclk_enable, bool dapm);
#else /* CONFIG_SND_SOC_DIGITAL_CDC */
static inline void msm_dig_cdc_hph_comp_cb(
int (*codec_hph_comp_gpio)(
@@ -106,5 +144,10 @@ static inline int msm_dig_codec_info_create_codec_entry(
{
return 0;
}
static inline int msm_digcdc_mclk_enable(struct snd_soc_component *component,
int mclk_enable, bool dapm)
{
return 0;
}
#endif /* CONFIG_SND_SOC_DIGITAL_CDC */
#endif

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
*/
#include <linux/init.h>
@@ -1531,6 +1531,17 @@ static const struct component_ops wcd_spi_component_ops = {
.unbind = wcd_spi_component_unbind,
};
#ifdef CONFIG_WCD_SPI_DMA_MASKING
static void arch_setup_spi_archdata(struct spi_device *spi)
{
if (spi->dev.coherent_dma_mask == DMA_MASK_NONE &&
spi->dev.dma_mask == NULL) {
spi->dev.coherent_dma_mask = DMA_BIT_MASK(sizeof(dma_addr_t) * 8);
spi->dev.dma_mask = &spi->dev.coherent_dma_mask;
}
}
#endif
static int wcd_spi_probe(struct spi_device *spi)
{
struct wcd_spi_priv *wcd_spi;
@@ -1557,8 +1568,11 @@ static int wcd_spi_probe(struct spi_device *spi)
mutex_init(&wcd_spi->xfer_mutex);
INIT_DELAYED_WORK(&wcd_spi->clk_dwork, wcd_spi_clk_work);
init_completion(&wcd_spi->resume_comp);
arch_setup_dma_ops(&spi->dev, 0, 0, NULL, true);
#ifdef CONFIG_WCD_SPI_DMA_MASKING
arch_setup_spi_archdata(spi);
#endif
arch_setup_dma_ops(&spi->dev, 0, 0, NULL, true);
wcd_spi->spi = spi;
spi_set_drvdata(spi, wcd_spi);

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2015-2019, 2021, The Linux Foundation. All rights reserved.
*/
#include <linux/module.h>
#include <linux/init.h>
@@ -2430,9 +2430,9 @@ static int slim_tx_mixer_put(struct snd_kcontrol *kcontrol,
mutex_lock(&tasha_p->codec_mutex);
if (tasha_p->intf_type == WCD9XXX_INTERFACE_TYPE_SLIMBUS) {
if (dai_id != AIF1_CAP) {
dev_err(component->dev, "%s: invalid AIF for I2C mode\n",
__func__);
if (dai_id >= ARRAY_SIZE(vport_slim_check_table)) {
dev_err(component->dev, "%s: dai_id: %d, out of bounds\n",
__func__, dai_id);
mutex_unlock(&tasha_p->codec_mutex);
return -EINVAL;
}
@@ -2441,6 +2441,7 @@ static int slim_tx_mixer_put(struct snd_kcontrol *kcontrol,
if (dai_id >= ARRAY_SIZE(vport_i2s_check_table)) {
dev_err(component->dev, "%s: dai_id: %d, out of bounds\n",
__func__, dai_id);
mutex_unlock(&tasha_p->codec_mutex);
return -EINVAL;
}
vtable = vport_i2s_check_table[dai_id];
@@ -13287,9 +13288,11 @@ static int tasha_handle_pdata(struct tasha_priv *tasha,
static struct wcd_cpe_core *tasha_codec_get_cpe_core(
struct snd_soc_component *component)
{
struct tasha_priv *priv = snd_soc_component_get_drvdata(component);
return priv->cpe_core;
struct tasha_priv *priv = NULL;
priv = dev_get_drvdata(component->dev);
if (priv)
return priv->cpe_core;
return NULL;
}
static int tasha_codec_cpe_fll_update_divider(

View File

@@ -113,8 +113,19 @@ static int wcd937x_handle_post_irq(void *data)
static int wcd937x_init_reg(struct snd_soc_component *component)
{
snd_soc_component_update_bits(component, WCD937X_SLEEP_CTL,
u32 val =0;
val = snd_soc_component_read32(component, WCD937X_DIGITAL_EFUSE_REG_29)
& 0x0F;
if (snd_soc_component_read32(component, WCD937X_DIGITAL_EFUSE_REG_16)
== 0x02 || snd_soc_component_read32(component,
WCD937X_DIGITAL_EFUSE_REG_17) > 0x09) {
snd_soc_component_update_bits(component, WCD937X_SLEEP_CTL,
0x0E, val);
} else {
snd_soc_component_update_bits(component, WCD937X_SLEEP_CTL,
0x0E, 0x0E);
}
snd_soc_component_update_bits(component, WCD937X_SLEEP_CTL,
0x80, 0x80);
usleep_range(1000, 1010);
@@ -141,6 +152,28 @@ static int wcd937x_init_reg(struct snd_soc_component *component)
0xFF, 0xFA);
snd_soc_component_update_bits(component, WCD937X_MICB3_TEST_CTL_1,
0xFF, 0xFA);
snd_soc_component_update_bits(component, WCD937X_MICB1_TEST_CTL_2,
0x38, 0x00);
snd_soc_component_update_bits(component, WCD937X_MICB2_TEST_CTL_2,
0x38, 0x00);
snd_soc_component_update_bits(component, WCD937X_MICB3_TEST_CTL_2,
0x38, 0x00);
/* Set Bandgap Fine Adjustment to +5mV for Tanggu SMIC part */
if (snd_soc_component_read32(component, WCD937X_DIGITAL_EFUSE_REG_16)
== 0x01) {
snd_soc_component_update_bits(component,
WCD937X_BIAS_VBG_FINE_ADJ, 0xF0, 0xB0);
} else if (snd_soc_component_read32(component,
WCD937X_DIGITAL_EFUSE_REG_16) == 0x02) {
snd_soc_component_update_bits(component,
WCD937X_HPH_NEW_INT_RDAC_HD2_CTL_L, 0x1F, 0x04);
snd_soc_component_update_bits(component,
WCD937X_HPH_NEW_INT_RDAC_HD2_CTL_R, 0x1F, 0x04);
snd_soc_component_update_bits(component,
WCD937X_BIAS_VBG_FINE_ADJ, 0xF0, 0xB0);
snd_soc_component_update_bits(component,
WCD937X_HPH_NEW_INT_RDAC_GAIN_CTL , 0xF0, 0x50);
}
return 0;
}
@@ -425,6 +458,12 @@ static int wcd937x_codec_hphl_dac_event(struct snd_soc_dapm_widget *w,
set_bit(HPH_COMP_DELAY, &wcd937x->status_mask);
break;
case SND_SOC_DAPM_POST_PMU:
if ((snd_soc_component_read32(component,
WCD937X_DIGITAL_EFUSE_REG_16) == 0x02) &&
((snd_soc_component_read32(component,
WCD937X_ANA_HPH) & 0x0C) == 0x0C))
snd_soc_component_update_bits(component,
WCD937X_RX_BIAS_HPH_LOWPOWER, 0xF0, 0x90);
if (hph_mode == CLS_AB_HIFI || hph_mode == CLS_H_HIFI)
snd_soc_component_update_bits(component,
WCD937X_HPH_NEW_INT_RDAC_HD2_CTL_L,
@@ -466,6 +505,12 @@ static int wcd937x_codec_hphl_dac_event(struct snd_soc_dapm_widget *w,
WCD937X_HPH_NEW_INT_HPH_TIMER1, 0x02, 0x00);
break;
case SND_SOC_DAPM_POST_PMD:
if ((snd_soc_component_read32(component,
WCD937X_DIGITAL_EFUSE_REG_16) == 0x02) &&
((snd_soc_component_read32(component,
WCD937X_ANA_HPH) & 0x0C) == 0x0C))
snd_soc_component_update_bits(component,
WCD937X_RX_BIAS_HPH_LOWPOWER, 0xF0, 0x80);
snd_soc_component_update_bits(component,
WCD937X_HPH_NEW_INT_RDAC_HD2_CTL_L,
0x0F, 0x01);
@@ -499,6 +544,12 @@ static int wcd937x_codec_hphr_dac_event(struct snd_soc_dapm_widget *w,
set_bit(HPH_COMP_DELAY, &wcd937x->status_mask);
break;
case SND_SOC_DAPM_POST_PMU:
if ((snd_soc_component_read32(component,
WCD937X_DIGITAL_EFUSE_REG_16) == 0x02) &&
((snd_soc_component_read32(component,
WCD937X_ANA_HPH) & 0x0C) == 0x0C))
snd_soc_component_update_bits(component,
WCD937X_RX_BIAS_HPH_LOWPOWER, 0xF0, 0x90);
if (hph_mode == CLS_AB_HIFI || hph_mode == CLS_H_HIFI)
snd_soc_component_update_bits(component,
WCD937X_HPH_NEW_INT_RDAC_HD2_CTL_R,
@@ -540,6 +591,12 @@ static int wcd937x_codec_hphr_dac_event(struct snd_soc_dapm_widget *w,
WCD937X_HPH_NEW_INT_HPH_TIMER1, 0x02, 0x00);
break;
case SND_SOC_DAPM_POST_PMD:
if ((snd_soc_component_read32(component,
WCD937X_DIGITAL_EFUSE_REG_16) == 0x02) &&
((snd_soc_component_read32(component,
WCD937X_ANA_HPH) & 0x0C) == 0x0C))
snd_soc_component_update_bits(component,
WCD937X_RX_BIAS_HPH_LOWPOWER, 0xF0, 0x80);
snd_soc_component_update_bits(component,
WCD937X_HPH_NEW_INT_RDAC_HD2_CTL_R,
0x0F, 0x01);

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2011-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/kernel.h>
@@ -1197,9 +1197,12 @@ static int wcd9xxx_i2c_probe(struct i2c_client *client,
wcd9xxx_set_intf_type(WCD9XXX_INTERFACE_TYPE_I2C);
return ret;
} else {
ret = -EINVAL;
pr_err("%s: I2C probe in wrong state, ret %d\n", __func__, ret);
goto fail;
}
pr_err("%s: I2C probe in wrong state\n", __func__);
err_device_init:

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2014-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2019, 2021, The Linux Foundation. All rights reserved.
*/
#include <linux/module.h>
@@ -18,7 +18,7 @@
#include <soc/qcom/pm.h>
#include <dsp/audio_cal_utils.h>
#include <asoc/core.h>
#include "cpe_core.h"
#include <asoc/cpe_core.h>
#include "cpe_err.h"
#include "cpe_cmi.h"
#include "wcd_cpe_core.h"
@@ -116,6 +116,8 @@ struct wcd_cpe_attribute {
ssize_t count);
};
static u64 wcd_cpe_dma_mask = DMA_BIT_MASK(32);
#define WCD_CPE_ATTR(_name, _mode, _show, _store) \
static struct wcd_cpe_attribute cpe_attr_##_name = { \
.attr = {.name = __stringify(_name), .mode = _mode}, \
@@ -639,7 +641,7 @@ void *wcd_cpe_get_core_handle(
goto done;
}
core = wcd_get_cpe_core(component);
core = wcd_get_cpe_core(core_d->component);
if (!core)
dev_err(component->dev,
@@ -2034,6 +2036,8 @@ struct wcd_cpe_core *wcd_cpe_init(const char *img_fname,
__func__);
goto schedule_dload_work;
}
core->dev->coherent_dma_mask = DMA_BIT_MASK(32);
core->dev->dma_mask = &wcd_cpe_dma_mask;
arch_setup_dma_ops(core->dev, 0, 0, NULL, 0);
core->cpe_dump_v_addr = dma_alloc_coherent(core->dev,

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2018, 2021, The Linux Foundation. All rights reserved.
*/
#include <linux/module.h>
@@ -283,7 +283,7 @@ static enum cpe_svc_result cpe_is_command_valid(
static int cpe_register_read(u32 reg, u8 *val)
{
*(val) = snd_soc_read(cpe_d.cdc_priv, reg);
*(val) = snd_soc_component_read32(cpe_d.cdc_priv, reg);
return 0;
}
@@ -292,7 +292,7 @@ static enum cpe_svc_result cpe_update_bits(u32 reg,
{
int ret = 0;
ret = snd_soc_update_bits(cpe_d.cdc_priv, reg,
ret = snd_soc_component_update_bits(cpe_d.cdc_priv, reg,
mask, value);
if (ret < 0)
return CPE_SVC_FAILED;
@@ -308,7 +308,7 @@ static int cpe_register_write(u32 reg, u32 val)
pr_debug("%s: reg = 0x%x, value = 0x%x\n",
__func__, reg, val);
ret = snd_soc_write(cpe_d.cdc_priv, reg, val);
ret = snd_soc_component_write(cpe_d.cdc_priv, reg, val);
if (ret < 0)
return CPE_SVC_FAILED;
@@ -317,8 +317,9 @@ static int cpe_register_write(u32 reg, u32 val)
static int cpe_register_write_repeat(u32 reg, u8 *ptr, u32 to_write)
{
struct snd_soc_codec *codec = cpe_d.cdc_priv;
struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
struct snd_soc_component *component = cpe_d.cdc_priv;
struct wcd9xxx *wcd9xxx =
dev_get_drvdata(component->dev->parent);
int ret = 0;
ret = wcd9xxx_slim_write_repeat(wcd9xxx, reg, to_write, ptr);

View File

@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2015-2016, 2018-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2015-2016, 2018-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/clk.h>
@@ -60,6 +61,7 @@ struct wsa881x_pdata {
int clk_cnt;
int enable_cnt;
int version;
int wsa881x_id;
struct mutex bg_lock;
struct mutex res_lock;
struct delayed_work ocp_ctl_work;
@@ -73,6 +75,10 @@ enum {
WSA881X_STATUS_I2C,
};
enum {
WSA8810,
WSA8815,
};
#define WSA881X_OCP_CTL_TIMER_SEC 2
#define WSA881X_OCP_CTL_TEMP_CELSIUS 25
#define WSA881X_OCP_CTL_POLL_TIMER_SEC 60
@@ -101,9 +107,14 @@ static int wsa881x_i2c_addr = -1;
static int wsa881x_probing_count;
static int wsa881x_presence_count;
/* Gain value "POS_12_DB", "POS_10P5_DB", and "POS_15_DB"
* only support on WSA8815
*/
static const char * const wsa881x_spk_pa_gain_text[] = {
"POS_13P5_DB", "POS_12_DB", "POS_10P5_DB", "POS_9_DB", "POS_7P5_DB",
"POS_6_DB", "POS_4P5_DB", "POS_3_DB", "POS_1P5_DB", "POS_0_DB"};
"POS_18_DB", "POS_16P5_DB", "POS_15_DB", "POS_13P5_DB",
"POS_12_DB", "POS_10P5_DB", "POS_9_DB", "POS_7P5_DB",
"POS_6_DB", "POS_4P5_DB", "POS_3_DB", "POS_1P5_DB",
"POS_0_DB"};
static const struct soc_enum wsa881x_spk_pa_gain_enum[] = {
SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(wsa881x_spk_pa_gain_text),
@@ -140,6 +151,12 @@ static int wsa881x_spk_pa_gain_put(struct snd_kcontrol *kcontrol,
__func__, ucontrol->value.integer.value[0]);
return -EINVAL;
}
if (ucontrol->value.integer.value[0] < 3 &&
wsa881x->wsa881x_id == WSA8810) {
dev_err(component->dev, "%s: Unsupported gain val %ld for WSA8810\n",
__func__, ucontrol->value.integer.value[0]);
return -EINVAL;
}
wsa881x->spk_pa_gain = ucontrol->value.integer.value[0];
dev_dbg(component->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
__func__, ucontrol->value.integer.value[0]);
@@ -1454,6 +1471,14 @@ static int wsa881x_i2c_probe(struct i2c_client *client,
pdata->regmap[WSA881X_DIGITAL_SLAVE],
WSA881X_DIGITAL_SLAVE);
}
pdata->wsa881x_id = wsa881x_i2c_read_device(pdata,
WSA881X_OTP_REG_0);
if (pdata->wsa881x_id & 0x01) {
pdata->wsa881x_id = WSA8815;
} else {
pdata->wsa881x_id = WSA8810;
}
pr_debug("%s: wsa881x_id : %d\n", __func__, pdata->wsa881x_id);
wsa881x_presence_count++;
wsa881x_probing_count++;
ret = snd_soc_register_component(&client->dev,

View File

@@ -6,10 +6,13 @@
ifeq ($(call is-board-platform,lahaina),true)
AUDIO_SELECT := CONFIG_SND_SOC_LAHAINA=m
endif
ifeq ($(call is-board-platform,kona),true)
AUDIO_SELECT := CONFIG_SND_SOC_KONA=m
endif
AUDIO_CHIPSET := audio
# Build/Package only in case of supported target
ifeq ($(call is-board-platform-in-list,lahaina lito),true)
ifeq ($(call is-board-platform-in-list, kona lahaina lito),true)
LOCAL_PATH := $(call my-dir)

View File

@@ -22,6 +22,10 @@ ifeq ($(KERNEL_BUILD), 0)
include $(AUDIO_ROOT)/config/litoauto.conf
INCS += -include $(AUDIO_ROOT)/config/litoautoconf.h
endif
ifeq ($(CONFIG_ARCH_KONA), y)
include $(AUDIO_ROOT)/config/konaauto.conf
INCS += -include $(AUDIO_ROOT)/config/konaautoconf.h
endif
endif
# As per target team, build is done as follows:

View File

@@ -1557,7 +1557,7 @@ static int wsa883x_swr_probe(struct swr_device *pdev)
ret = swr_get_logical_dev_num(pdev, pdev->addr, &devnum);
if (ret) {
dev_err(&pdev->dev,
"%s get devnum %d for dev addr %lx failed\n",
"%s get devnum %d for dev addr %llx failed\n",
__func__, devnum, pdev->addr);
goto dev_err;
}

View File

@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
@@ -2907,18 +2908,18 @@ static int msm_compr_pointer(struct snd_compr_stream *cstream,
spin_lock_irqsave(&prtd->lock, flags);
tstamp.sampling_rate = prtd->sample_rate;
tstamp.byte_offset = prtd->byte_offset;
if (cstream->direction == SND_COMPRESS_PLAYBACK)
if (cstream->direction == SND_COMPRESS_PLAYBACK) {
runtime->total_bytes_transferred = prtd->copied_total;
tstamp.copied_total = prtd->copied_total;
else if (cstream->direction == SND_COMPRESS_CAPTURE)
}
else if (cstream->direction == SND_COMPRESS_CAPTURE) {
runtime->total_bytes_available = prtd->received_total;
tstamp.copied_total = prtd->received_total;
}
first_buffer = prtd->first_buffer;
if (atomic_read(&prtd->error)) {
pr_err_ratelimited("%s Got RESET EVENTS notification, return error\n",
__func__);
if (cstream->direction == SND_COMPRESS_PLAYBACK)
runtime->total_bytes_transferred = tstamp.copied_total;
else
runtime->total_bytes_available = tstamp.copied_total;
tstamp.pcm_io_frames = 0;
memcpy(arg, &tstamp, sizeof(struct snd_compr_tstamp));
spin_unlock_irqrestore(&prtd->lock, flags);

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2013-2019, 2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2013-2019, 2020-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/init.h>
@@ -14,6 +14,7 @@
#include <linux/delay.h>
#include <linux/sched.h>
#include <linux/freezer.h>
#include <linux/signal.h>
#include <sound/soc.h>
#include <sound/lsm_params.h>
#include <sound/pcm_params.h>
@@ -129,7 +130,7 @@ struct cpe_lsm_lab {
struct cpe_priv {
void *core_handle;
struct snd_soc_codec *codec;
struct snd_soc_component *component;
struct wcd_cpe_lsm_ops lsm_ops;
struct wcd_cpe_afe_ops afe_ops;
bool afe_mad_ctl;
@@ -186,6 +187,7 @@ static struct cpe_priv *cpe_get_private_data(
struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd;
struct snd_soc_component *component = NULL;
if (!substream || !substream->private_data) {
pr_err("%s: %s is invalid\n",
@@ -196,14 +198,19 @@ static struct cpe_priv *cpe_get_private_data(
rtd = substream->private_data;
if (!rtd || !rtd->platform) {
if (!rtd) {
pr_err("%s: %s is invalid\n",
__func__,
(!rtd) ? "runtime" : "platform");
goto err_ret;
}
return snd_soc_platform_get_drvdata(rtd->platform);
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
if (!component) {
pr_err("%s: invalid component\n", __func__);
goto err_ret;
}
return snd_soc_component_get_drvdata(component);
err_ret:
return NULL;
@@ -756,7 +763,7 @@ static int msm_cpe_lsm_open(struct snd_pcm_substream *substream)
struct wcd_cpe_lsm_ops *lsm_ops;
int rc = 0;
if (!cpe || !cpe->codec) {
if (!cpe || !cpe->component) {
dev_err(rtd->dev,
"%s: Invalid private data\n",
__func__);
@@ -792,11 +799,11 @@ static int msm_cpe_lsm_open(struct snd_pcm_substream *substream)
return -EINVAL;
}
cpe->core_handle = wcd_cpe_get_core_handle(cpe->codec);
cpe->core_handle = wcd_cpe_get_core_handle(cpe->component);
if (!cpe->core_handle) {
dev_err(rtd->dev,
"%s: Invalid handle to codec core\n",
"%s: Invalid handle to component core\n",
__func__);
return -EINVAL;
}
@@ -3215,7 +3222,6 @@ static int msm_asoc_cpe_lsm_probe(struct snd_soc_component *component)
{
struct snd_soc_card *card;
struct snd_soc_pcm_runtime *rtd;
struct snd_soc_codec *codec;
struct cpe_priv *cpe_priv;
struct snd_soc_component *component_rtd = NULL;
const struct snd_kcontrol_new *kcontrol;
@@ -3259,14 +3265,12 @@ static int msm_asoc_cpe_lsm_probe(struct snd_soc_component *component)
port_id = 1;
}
codec = rtd->codec;
cpe_priv = kzalloc(sizeof(struct cpe_priv),
GFP_KERNEL);
if (!cpe_priv)
return -ENOMEM;
cpe_priv->codec = codec;
cpe_priv->component = component;
cpe_priv->input_port_id = port_id;
wcd_cpe_get_lsm_ops(&cpe_priv->lsm_ops);
wcd_cpe_get_afe_ops(&cpe_priv->afe_ops);
@@ -3317,7 +3321,7 @@ static int msm_cpe_lsm_probe(struct platform_device *pdev)
*/
static int msm_cpe_lsm_remove(struct platform_device *pdev)
{
snd_soc_unregister_commponent(&pdev->dev);
snd_soc_unregister_component(&pdev->dev);
return 0;
}

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/init.h>
@@ -3896,20 +3896,20 @@ static const struct snd_kcontrol_new rt_proxy_config_controls[] = {
};
static const struct snd_kcontrol_new usb_audio_cfg_controls[] = {
SOC_SINGLE_EXT("USB_AUDIO_RX dev_token", 0, 0, UINT_MAX, 0,
SOC_SINGLE_EXT("USB_AUDIO_RX dev_token", 0, 0, INT_MAX, 0,
msm_dai_q6_usb_audio_cfg_get,
msm_dai_q6_usb_audio_cfg_put),
SOC_SINGLE_EXT("USB_AUDIO_RX endian", 0, 0, 1, 0,
msm_dai_q6_usb_audio_endian_cfg_get,
msm_dai_q6_usb_audio_endian_cfg_put),
SOC_SINGLE_EXT("USB_AUDIO_TX dev_token", 0, 0, UINT_MAX, 0,
SOC_SINGLE_EXT("USB_AUDIO_TX dev_token", 0, 0, INT_MAX, 0,
msm_dai_q6_usb_audio_cfg_get,
msm_dai_q6_usb_audio_cfg_put),
SOC_SINGLE_EXT("USB_AUDIO_TX endian", 0, 0, 1, 0,
msm_dai_q6_usb_audio_endian_cfg_get,
msm_dai_q6_usb_audio_endian_cfg_put),
SOC_SINGLE_EXT("USB_AUDIO_RX service_interval", SND_SOC_NOPM, 0,
UINT_MAX, 0,
INT_MAX, 0,
msm_dai_q6_usb_audio_svc_interval_get,
msm_dai_q6_usb_audio_svc_interval_put),
};
@@ -6877,6 +6877,10 @@ static int msm_dai_q6_meta_mi2s_hw_params(struct snd_pcm_substream *substream,
port_cfg->bit_width = 24;
dai_data->bitwidth = 24;
break;
case SNDRV_PCM_FORMAT_S32_LE:
port_cfg->bit_width = 32;
dai_data->bitwidth = 32;
break;
default:
pr_err("%s: format %d\n",
__func__, params_format(params));
@@ -11649,7 +11653,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S32_LE,
.channels_min = 1,
.channels_max = 8,
.channels_max = 16,
.rate_min = 8000,
.rate_max = 352800,
},
@@ -11670,7 +11674,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S32_LE,
.channels_min = 1,
.channels_max = 8,
.channels_max = 16,
.rate_min = 8000,
.rate_max = 352800,
},
@@ -11691,7 +11695,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S32_LE,
.channels_min = 1,
.channels_max = 8,
.channels_max = 16,
.rate_min = 8000,
.rate_max = 352800,
},
@@ -11712,7 +11716,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S32_LE,
.channels_min = 1,
.channels_max = 8,
.channels_max = 16,
.rate_min = 8000,
.rate_max = 352800,
},
@@ -11733,7 +11737,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S32_LE,
.channels_min = 1,
.channels_max = 8,
.channels_max = 16,
.rate_min = 8000,
.rate_max = 352800,
},
@@ -11754,7 +11758,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S32_LE,
.channels_min = 1,
.channels_max = 8,
.channels_max = 16,
.rate_min = 8000,
.rate_max = 352800,
},
@@ -11775,7 +11779,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S32_LE,
.channels_min = 1,
.channels_max = 8,
.channels_max = 16,
.rate_min = 8000,
.rate_max = 352800,
},
@@ -11796,7 +11800,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S32_LE,
.channels_min = 1,
.channels_max = 8,
.channels_max = 16,
.rate_min = 8000,
.rate_max = 352800,
},
@@ -11817,7 +11821,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S32_LE,
.channels_min = 1,
.channels_max = 8,
.channels_max = 16,
.rate_min = 8000,
.rate_max = 352800,
},
@@ -11838,7 +11842,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S32_LE,
.channels_min = 1,
.channels_max = 8,
.channels_max = 16,
.rate_min = 8000,
.rate_max = 352800,
},
@@ -11859,7 +11863,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S32_LE,
.channels_min = 1,
.channels_max = 8,
.channels_max = 16,
.rate_min = 8000,
.rate_max = 352800,
},
@@ -11880,7 +11884,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S32_LE,
.channels_min = 1,
.channels_max = 8,
.channels_max = 16,
.rate_min = 8000,
.rate_max = 352800,
},
@@ -11901,7 +11905,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S32_LE,
.channels_min = 1,
.channels_max = 8,
.channels_max = 16,
.rate_min = 8000,
.rate_max = 352800,
},
@@ -11922,7 +11926,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S32_LE,
.channels_min = 1,
.channels_max = 8,
.channels_max = 16,
.rate_min = 8000,
.rate_max = 352800,
},
@@ -11943,7 +11947,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S32_LE,
.channels_min = 1,
.channels_max = 8,
.channels_max = 16,
.rate_min = 8000,
.rate_max = 352800,
},
@@ -11964,7 +11968,7 @@ static struct snd_soc_dai_driver msm_dai_q6_tdm_dai[] = {
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S32_LE,
.channels_min = 1,
.channels_max = 8,
.channels_max = 16,
.rate_min = 8000,
.rate_max = 352800,
},

View File

@@ -153,6 +153,8 @@ static const struct soc_enum msm_pcm_fe_topology_enum[] = {
static void event_handler(uint32_t opcode,
uint32_t token, uint32_t *payload, void *priv)
{
struct msm_audio *prtd = priv;
struct snd_pcm_substream *substream;
uint32_t *ptrmem = (uint32_t *)payload;
switch (opcode) {
@@ -171,6 +173,18 @@ static void event_handler(uint32_t opcode,
break;
}
break;
case RESET_EVENTS:
if (!prtd || !prtd->substream) {
pr_err("%s: prtd or substream is NULL\n", __func__);
return;
}
substream = prtd->substream;
if (!substream->runtime || !substream->runtime->status) {
pr_err("%s: runtime or runtime->status is NULL\n", __func__);
return;
}
substream->runtime->status->state = SNDRV_PCM_STATE_DISCONNECTED;
break;
default:
pr_debug("Not Supported Event opcode[0x%x]\n", opcode);
break;

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
*/
#ifndef _MSM_PCM_ROUTING_H
#define _MSM_PCM_ROUTING_H
@@ -212,6 +212,7 @@
#define LPASS_BE_WSA_CDC_DMA_RX_0 "WSA_CDC_DMA_RX_0"
#define LPASS_BE_WSA_CDC_DMA_TX_0 "WSA_CDC_DMA_TX_0"
#define LPASS_BE_WSA_CDC_DMA_TX_0_VI "WSA_CDC_DMA_TX_0_VI"
#define LPASS_BE_WSA_CDC_DMA_RX_1 "WSA_CDC_DMA_RX_1"
#define LPASS_BE_WSA_CDC_DMA_TX_1 "WSA_CDC_DMA_TX_1"
#define LPASS_BE_WSA_CDC_DMA_TX_2 "WSA_CDC_DMA_TX_2"

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2019, 2021, The Linux Foundation. All rights reserved.
*/
#include <linux/init.h>
@@ -29,6 +29,8 @@
static struct msm_voice voice_info[VOICE_SESSION_INDEX_MAX];
static int voice_probe_done;
static struct snd_pcm_hardware msm_pcm_hardware = {
.info = (SNDRV_PCM_INFO_INTERLEAVED |
@@ -778,6 +780,7 @@ static int msm_pcm_probe(struct platform_device *pdev)
bool destroy_cvd = false;
const char *is_destroy_cvd = "qcom,destroy-cvd";
voice_probe_done = 0;
if (!is_voc_initialized()) {
pr_debug("%s: voice module not initialized yet, deferring probe()\n",
__func__);
@@ -806,11 +809,31 @@ static int msm_pcm_probe(struct platform_device *pdev)
rc = snd_soc_register_component(&pdev->dev,
&msm_soc_component,
NULL, 0);
if (!rc) {
pr_debug("%s msm_pcm_voice probe success! \n", __func__);
voice_probe_done = 1;
}
done:
return rc;
}
/**
* msm_voice_get_probe_status - Returns the probe
* status of msm-pcm-voice.
*
* Function that returns the probe status of msm-pcm-voice
* driver.
*
* Returns: 1 on probe success, 0 otherwise.
*/
int msm_voice_get_probe_status(void)
{
return voice_probe_done;
}
EXPORT_SYMBOL(msm_voice_get_probe_status);
static int msm_pcm_remove(struct platform_device *pdev)
{
snd_soc_unregister_component(&pdev->dev);

View File

@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2015, 2021, The Linux Foundation. All rights reserved.
*/
#ifndef _MSM_PCM_VOICE_H
#define _MSM_PCM_VOICE_H
@@ -31,4 +31,6 @@ struct msm_voice {
int capture_start;
};
int msm_voice_get_probe_status(void);
#endif /*_MSM_PCM_VOICE_H*/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,111 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (c) 2015-2018, 2021, The Linux Foundation. All rights reserved.
*/
#ifndef __MSM8952_SLIMBUS_AUDIO
#define __MSM8952_SLIMBUS_AUDIO
#include <dsp/apr_audio-v2.h>
struct ext_intf_cfg {
atomic_t quat_mi2s_clk_ref;
atomic_t quin_mi2s_clk_ref;
atomic_t auxpcm_mi2s_clk_ref;
};
enum {
PRIM_MI2S = 0,
SEC_MI2S,
TERT_MI2S,
QUAT_MI2S,
QUIN_MI2S,
MI2S_MAX,
};
struct msm8952_codec {
void* (*get_afe_config_fn)(struct snd_soc_component *component,
enum afe_config_type config_type);
};
struct msm8952_asoc_mach_data {
int ext_pa;
int us_euro_gpio;
struct delayed_work hs_detect_dwork;
struct snd_soc_codec *codec;
struct msm8952_codec msm8952_codec_fn;
struct ext_intf_cfg clk_ref;
struct snd_info_entry *codec_root;
void __iomem *vaddr_gpio_mux_spkr_ctl;
void __iomem *vaddr_gpio_mux_mic_ctl;
void __iomem *vaddr_gpio_mux_pcm_ctl;
void __iomem *vaddr_gpio_mux_quin_ctl;
void __iomem *vaddr_gpio_mux_qui_pcm_sec_mode_ctl;
void __iomem *vaddr_gpio_mux_mic_ext_clk_ctl;
void __iomem *vaddr_gpio_mux_sec_tlmm_ctl;
struct device_node *us_euro_gpio_p;
struct device_node *mi2s_gpio_p[MI2S_MAX];
};
int msm_slim_0_rx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params);
int msm_slim_0_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params);
int msm_slim_1_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params);
int msm_slim_2_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params);
int msm_slim_4_rx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params);
int msm_slim_4_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params);
int msm_slim_5_rx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params);
int msm_slim_6_rx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params);
int msm_slim_5_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params);
int msm_snd_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params);
int msm8952_slimbus_2_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params);
int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params);
int msm_quin_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
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_tdm_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_mi2s_snd_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params);
int msm_snd_cpe_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params);
int msm_tdm_snd_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params);
int msm_quat_mi2s_snd_startup(struct snd_pcm_substream *substream);
void msm_quat_mi2s_snd_shutdown(struct snd_pcm_substream *substream);
int msm_quin_mi2s_snd_startup(struct snd_pcm_substream *substream);
void msm_quin_mi2s_snd_shutdown(struct snd_pcm_substream *substream);
int msm_auxpcm_be_params_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params);
int msm_prim_auxpcm_startup(struct snd_pcm_substream *substream);
void msm_prim_auxpcm_shutdown(struct snd_pcm_substream *substream);
int msm_tdm_startup(struct snd_pcm_substream *substream);
void msm_tdm_shutdown(struct snd_pcm_substream *substream);
struct snd_soc_card *populate_snd_card_dailinks(struct device *dev);
int msm_slim_4_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params);
int msm895x_wsa881x_init(struct snd_soc_component *component);
int msm8952_init_wsa_dev(struct platform_device *pdev,
struct snd_soc_card *card);
void msm895x_free_auxdev_mem(struct platform_device *pdev);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,94 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (c) 2018-2019, 2021, The Linux Foundation. All rights reserved.
*/
#ifndef __MSM8953_H
#define __MSM8953_H
#include <sound/soc.h>
#include <dsp/q6afe-v2.h>
#include <asoc/wcd-mbhc-v2.h>
#include "codecs/sdm660_cdc/msm-analog-cdc.h"
#include "codecs/sdm660_cdc/msm-digital-cdc.h"
#include "codecs/wsa881x-analog.h"
#include <linux/regulator/consumer.h>
#include <linux/regulator/driver.h>
#define BTSCO_RATE_8KHZ 8000
#define BTSCO_RATE_16KHZ 16000
#define SAMPLING_RATE_48KHZ 48000
#define SAMPLING_RATE_96KHZ 96000
#define SAMPLING_RATE_192KHZ 192000
#define PRI_MI2S_ID (1 << 0)
#define SEC_MI2S_ID (1 << 1)
#define TER_MI2S_ID (1 << 2)
#define QUAT_MI2S_ID (1 << 3)
#define QUIN_MI2S_ID (1 << 4)
#define DEFAULT_MCLK_RATE 9600000
#define WCD_MBHC_DEF_RLOADS 5
#define MAX_WSA_CODEC_NAME_LENGTH 80
#define MSM_DT_MAX_PROP_SIZE 80
enum {
DIG_CDC,
ANA_CDC,
CODECS_MAX,
};
enum {
PRIM_MI2S = 0,
SEC_MI2S,
TERT_MI2S,
QUAT_MI2S,
QUIN_MI2S,
MI2S_MAX,
};
enum {
INT_SND_CARD,
INT_DIG_SND_CARD,
INT_MAX_SND_CARD = INT_DIG_SND_CARD,
EXT_SND_CARD_TASHA,
EXT_SND_CARD_TAVIL,
};
struct msm_asoc_mach_data {
int codec_type;
int ext_pa;
int us_euro_gpio;
int spk_ext_pa_gpio;
int mclk_freq;
bool native_clk_set;
int lb_mode;
int afe_clk_ver;
int snd_card_val;
u8 micbias1_cap_mode;
u8 micbias2_cap_mode;
atomic_t int_mclk0_rsc_ref;
atomic_t int_mclk0_enabled;
atomic_t wsa_int_mclk0_rsc_ref;
struct mutex cdc_int_mclk0_mutex;
struct mutex wsa_mclk_mutex;
struct delayed_work disable_int_mclk0_work;
struct afe_digital_clk_cfg digital_cdc_clk;
struct afe_clk_set digital_cdc_core_clk;
void __iomem *vaddr_gpio_mux_spkr_ctl;
void __iomem *vaddr_gpio_mux_mic_ctl;
void __iomem *vaddr_gpio_mux_quin_ctl;
void __iomem *vaddr_gpio_mux_pcm_ctl;
struct on_demand_supply wsa_switch_supply;
struct device_node *spk_ext_pa_gpio_p;
struct device_node *us_euro_gpio_p;
struct device_node *comp_gpio_p;
struct device_node *mi2s_gpio_p[MI2S_MAX];
struct device_node *dmic_gpio_p; /* used by pinctrl API */
struct snd_soc_codec *codec;
struct snd_info_entry *codec_root;
};
#endif/*__MSM8953_H*/

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2015-2019, 2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2015-2019, 2021, The Linux Foundation. All rights reserved.
*/
#include <linux/of.h>
@@ -275,6 +275,7 @@ static struct snd_soc_dai_link msm_ext_tasha_be_dai[] = {
.platform_name = "msm-pcm-routing",
.codec_name = "tasha_codec",
.codec_dai_name = "tasha_mix_rx1",
.dynamic_be = 1,
.no_pcm = 1,
.dpcm_playback = 1,
.id = MSM_BACKEND_DAI_SLIMBUS_0_RX,
@@ -292,6 +293,7 @@ static struct snd_soc_dai_link msm_ext_tasha_be_dai[] = {
.platform_name = "msm-pcm-routing",
.codec_name = "tasha_codec",
.codec_dai_name = "tasha_tx1",
.dynamic_be = 1,
.no_pcm = 1,
.dpcm_capture = 1,
.id = MSM_BACKEND_DAI_SLIMBUS_0_TX,
@@ -306,6 +308,7 @@ static struct snd_soc_dai_link msm_ext_tasha_be_dai[] = {
.platform_name = "msm-pcm-routing",
.codec_name = "tasha_codec",
.codec_dai_name = "tasha_mix_rx1",
.dynamic_be = 1,
.no_pcm = 1,
.dpcm_playback = 1,
.id = MSM_BACKEND_DAI_SLIMBUS_1_RX,
@@ -322,6 +325,7 @@ static struct snd_soc_dai_link msm_ext_tasha_be_dai[] = {
.platform_name = "msm-pcm-routing",
.codec_name = "tasha_codec",
.codec_dai_name = "tasha_tx3",
.dynamic_be = 1,
.no_pcm = 1,
.dpcm_capture = 1,
.id = MSM_BACKEND_DAI_SLIMBUS_1_TX,
@@ -336,6 +340,7 @@ static struct snd_soc_dai_link msm_ext_tasha_be_dai[] = {
.platform_name = "msm-pcm-routing",
.codec_name = "tasha_codec",
.codec_dai_name = "tasha_mix_rx1",
.dynamic_be = 1,
.no_pcm = 1,
.dpcm_playback = 1,
.id = MSM_BACKEND_DAI_SLIMBUS_3_RX,
@@ -352,6 +357,7 @@ static struct snd_soc_dai_link msm_ext_tasha_be_dai[] = {
.platform_name = "msm-pcm-routing",
.codec_name = "tasha_codec",
.codec_dai_name = "tasha_tx1",
.dynamic_be = 1,
.no_pcm = 1,
.dpcm_capture = 1,
.dpcm_playback = 1,
@@ -367,6 +373,7 @@ static struct snd_soc_dai_link msm_ext_tasha_be_dai[] = {
.platform_name = "msm-pcm-routing",
.codec_name = "tasha_codec",
.codec_dai_name = "tasha_mix_rx1",
.dynamic_be = 1,
.no_pcm = 1,
.dpcm_playback = 1,
.id = MSM_BACKEND_DAI_SLIMBUS_4_RX,
@@ -383,6 +390,7 @@ static struct snd_soc_dai_link msm_ext_tasha_be_dai[] = {
.platform_name = "msm-pcm-routing",
.codec_name = "tasha_codec",
.codec_dai_name = "tasha_rx3",
.dynamic_be = 1,
.no_pcm = 1,
.dpcm_playback = 1,
.id = MSM_BACKEND_DAI_SLIMBUS_5_RX,
@@ -400,6 +408,7 @@ static struct snd_soc_dai_link msm_ext_tasha_be_dai[] = {
.platform_name = "msm-pcm-routing",
.codec_name = "tasha_codec",
.codec_dai_name = "tasha_mad1",
.dynamic_be = 1,
.no_pcm = 1,
.dpcm_capture = 1,
.id = MSM_BACKEND_DAI_SLIMBUS_5_TX,
@@ -414,6 +423,7 @@ static struct snd_soc_dai_link msm_ext_tasha_be_dai[] = {
.platform_name = "msm-pcm-routing",
.codec_name = "tasha_codec",
.codec_dai_name = "tasha_rx4",
.dynamic_be = 1,
.no_pcm = 1,
.dpcm_playback = 1,
.id = MSM_BACKEND_DAI_SLIMBUS_6_RX,
@@ -433,6 +443,7 @@ static struct snd_soc_dai_link msm_ext_tavil_be_dai[] = {
.platform_name = "msm-pcm-routing",
.codec_name = "tavil_codec",
.codec_dai_name = "tavil_rx1",
.dynamic_be = 1,
.no_pcm = 1,
.dpcm_playback = 1,
.id = MSM_BACKEND_DAI_SLIMBUS_0_RX,
@@ -450,6 +461,7 @@ static struct snd_soc_dai_link msm_ext_tavil_be_dai[] = {
.platform_name = "msm-pcm-routing",
.codec_name = "tavil_codec",
.codec_dai_name = "tavil_tx1",
.dynamic_be = 1,
.no_pcm = 1,
.dpcm_capture = 1,
.id = MSM_BACKEND_DAI_SLIMBUS_0_TX,
@@ -464,6 +476,7 @@ static struct snd_soc_dai_link msm_ext_tavil_be_dai[] = {
.platform_name = "msm-pcm-routing",
.codec_name = "tavil_codec",
.codec_dai_name = "tavil_rx1",
.dynamic_be = 1,
.no_pcm = 1,
.dpcm_playback = 1,
.id = MSM_BACKEND_DAI_SLIMBUS_1_RX,
@@ -480,6 +493,7 @@ static struct snd_soc_dai_link msm_ext_tavil_be_dai[] = {
.platform_name = "msm-pcm-routing",
.codec_name = "tavil_codec",
.codec_dai_name = "tavil_tx3",
.dynamic_be = 1,
.no_pcm = 1,
.dpcm_capture = 1,
.id = MSM_BACKEND_DAI_SLIMBUS_1_TX,
@@ -494,6 +508,7 @@ static struct snd_soc_dai_link msm_ext_tavil_be_dai[] = {
.platform_name = "msm-pcm-routing",
.codec_name = "tavil_codec",
.codec_dai_name = "tavil_rx2",
.dynamic_be = 1,
.no_pcm = 1,
.dpcm_playback = 1,
.id = MSM_BACKEND_DAI_SLIMBUS_2_RX,
@@ -509,6 +524,7 @@ static struct snd_soc_dai_link msm_ext_tavil_be_dai[] = {
.platform_name = "msm-pcm-routing",
.codec_name = "tavil_codec",
.codec_dai_name = "tavil_rx1",
.dynamic_be = 1,
.no_pcm = 1,
.dpcm_playback = 1,
.id = MSM_BACKEND_DAI_SLIMBUS_3_RX,
@@ -525,6 +541,7 @@ static struct snd_soc_dai_link msm_ext_tavil_be_dai[] = {
.platform_name = "msm-pcm-routing",
.codec_name = "tavil_codec",
.codec_dai_name = "tavil_tx1",
.dynamic_be = 1,
.no_pcm = 1,
.dpcm_capture = 1,
.id = MSM_BACKEND_DAI_SLIMBUS_3_TX,
@@ -539,6 +556,7 @@ static struct snd_soc_dai_link msm_ext_tavil_be_dai[] = {
.platform_name = "msm-pcm-routing",
.codec_name = "tavil_codec",
.codec_dai_name = "tavil_rx1",
.dynamic_be = 1,
.no_pcm = 1,
.dpcm_playback = 1,
.id = MSM_BACKEND_DAI_SLIMBUS_4_RX,
@@ -555,6 +573,7 @@ static struct snd_soc_dai_link msm_ext_tavil_be_dai[] = {
.platform_name = "msm-pcm-routing",
.codec_name = "tavil_codec",
.codec_dai_name = "tavil_rx3",
.dynamic_be = 1,
.no_pcm = 1,
.dpcm_playback = 1,
.id = MSM_BACKEND_DAI_SLIMBUS_5_RX,
@@ -572,6 +591,7 @@ static struct snd_soc_dai_link msm_ext_tavil_be_dai[] = {
.platform_name = "msm-pcm-routing",
.codec_name = "tavil_codec",
.codec_dai_name = "tavil_mad1",
.dynamic_be = 1,
.no_pcm = 1,
.dpcm_capture = 1,
.id = MSM_BACKEND_DAI_SLIMBUS_5_TX,
@@ -586,6 +606,7 @@ static struct snd_soc_dai_link msm_ext_tavil_be_dai[] = {
.platform_name = "msm-pcm-routing",
.codec_name = "tavil_codec",
.codec_dai_name = "tavil_rx4",
.dynamic_be = 1,
.no_pcm = 1,
.dpcm_playback = 1,
.id = MSM_BACKEND_DAI_SLIMBUS_6_RX,
@@ -1282,6 +1303,33 @@ static struct snd_soc_dai_link msm_ext_common_be_dai[] = {
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
},
/* Proxy Tx BACK END DAI Link */
{
.name = LPASS_BE_PROXY_TX,
.stream_name = "Proxy Capture",
.cpu_dai_name = "msm-dai-q6-dev.8195",
.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_PROXY_TX,
.ignore_suspend = 1,
},
/* Proxy Rx BACK END DAI Link */
{
.name = LPASS_BE_PROXY_RX,
.stream_name = "Proxy Playback",
.cpu_dai_name = "msm-dai-q6-dev.8194",
.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_PROXY_RX,
.ignore_pmdown_time = 1,
.ignore_suspend = 1,
},
{
.name = LPASS_BE_USB_AUDIO_RX,
.stream_name = "USB Audio Playback",
@@ -1289,6 +1337,7 @@ static struct snd_soc_dai_link msm_ext_common_be_dai[] = {
.platform_name = "msm-pcm-routing",
.codec_name = "msm-stub-codec.1",
.codec_dai_name = "msm-stub-rx",
.dynamic_be = 1,
.no_pcm = 1,
.dpcm_playback = 1,
.id = MSM_BACKEND_DAI_USB_RX,
@@ -1769,6 +1818,7 @@ static struct snd_soc_dai_link msm_wcn_be_dai_links[] = {
* supported usecase information
*/
.codec_dai_name = "btfm_bt_sco_a2dp_slim_rx",
.dynamic_be = 1,
.no_pcm = 1,
.dpcm_playback = 1,
.id = MSM_BACKEND_DAI_SLIMBUS_7_RX,
@@ -1785,6 +1835,7 @@ static struct snd_soc_dai_link msm_wcn_be_dai_links[] = {
.platform_name = "msm-pcm-routing",
.codec_name = "btfmslim_slave",
.codec_dai_name = "btfm_bt_sco_slim_tx",
.dynamic_be = 1,
.no_pcm = 1,
.dpcm_capture = 1,
.id = MSM_BACKEND_DAI_SLIMBUS_7_TX,
@@ -1799,6 +1850,7 @@ static struct snd_soc_dai_link msm_wcn_be_dai_links[] = {
.platform_name = "msm-pcm-routing",
.codec_name = "btfmslim_slave",
.codec_dai_name = "btfm_fm_slim_tx",
.dynamic_be = 1,
.no_pcm = 1,
.dpcm_capture = 1,
.id = MSM_BACKEND_DAI_SLIMBUS_8_TX,
@@ -1814,7 +1866,7 @@ static struct snd_soc_dai_link ext_disp_be_dai_link[] = {
{
.name = LPASS_BE_DISPLAY_PORT,
.stream_name = "Display Port Playback",
.cpu_dai_name = "msm-dai-q6-dp.24608",
.cpu_dai_name = "msm-dai-q6-dp.0",
.platform_name = "msm-pcm-routing",
.codec_name = "msm-ext-disp-audio-codec-rx",
.codec_dai_name = "msm_dp_audio_codec_rx_dai",

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2015-2018, 2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2015-2018, 2020-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/delay.h>
@@ -48,6 +48,8 @@
#define WSA8810_NAME_1 "wsa881x.20170211"
#define WSA8810_NAME_2 "wsa881x.20170212"
#define SDM660_SOC_MSM_ID 0x13D
#define SDM660_SOC_SDA_ID 0x144
static int msm_ext_spk_control = 1;
static struct wcd_mbhc_config *wcd_mbhc_cfg_ptr;
@@ -1294,9 +1296,10 @@ static int msm_adsp_power_up_config(struct snd_soc_component *component,
goto err_fail;
}
if (socinfo_get_id() == SDM660_SOC_MSM_ID)
if (socinfo_get_id() == SDM660_SOC_MSM_ID ||
socinfo_get_id() == SDM660_SOC_SDA_ID) {
msm_snd_interrupt_config(pdata);
}
ret = msm_afe_set_config(component);
if (ret)
pr_err("%s: Failed to set AFE config. err %d\n",

View File

@@ -2422,6 +2422,33 @@ static struct snd_soc_dai_link msm_int_be_dai[] = {
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
},
/* Proxy Tx BACK END DAI Link */
{
.name = LPASS_BE_PROXY_TX,
.stream_name = "Proxy Capture",
.cpu_dai_name = "msm-dai-q6-dev.8195",
.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_PROXY_TX,
.ignore_suspend = 1,
},
/* Proxy Rx BACK END DAI Link */
{
.name = LPASS_BE_PROXY_RX,
.stream_name = "Proxy Playback",
.cpu_dai_name = "msm-dai-q6-dev.8194",
.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_PROXY_RX,
.ignore_pmdown_time = 1,
.ignore_suspend = 1,
},
{
.name = LPASS_BE_USB_AUDIO_RX,
.stream_name = "USB Audio Playback",
@@ -2973,7 +3000,7 @@ static struct snd_soc_dai_link ext_disp_be_dai_link[] = {
{
.name = LPASS_BE_DISPLAY_PORT,
.stream_name = "Display Port Playback",
.cpu_dai_name = "msm-dai-q6-dp.24608",
.cpu_dai_name = "msm-dai-q6-dp.0",
.platform_name = "msm-pcm-routing",
.codec_name = "msm-ext-disp-audio-codec-rx",
.codec_dai_name = "msm_dp_audio_codec_rx_dai",

View File

@@ -4,6 +4,7 @@ export CONFIG_AUDIO_EXT_CLK=m
export CONFIG_SND_SOC_WCD9XXX_V2=m
export CONFIG_SND_SOC_WCD_MBHC=m
export CONFIG_SND_SOC_WSA881X=m
export CONFIG_SND_SOC_WSA883X=m
export CONFIG_WCD9XXX_CODEC_CORE_V2=m
export CONFIG_MSM_CDC_PINCTRL=m
export CONFIG_MSM_QDSP6V2_CODECS=m

View File

@@ -8,6 +8,7 @@
#define CONFIG_SND_SOC_WCD9XXX_V2 1
#define CONFIG_SND_SOC_WCD_MBHC 1
#define CONFIG_SND_SOC_WSA881X 1
#define CONFIG_SND_SOC_WSA883X 1
#define CONFIG_WCD9XXX_CODEC_CORE_V2 1
#define CONFIG_MSM_CDC_PINCTRL 1
#define CONFIG_MSM_QDSP6V2_CODECS 1

View File

@@ -0,0 +1,43 @@
CONFIG_PINCTRL_WCD=m
CONFIG_AUDIO_EXT_CLK=m
CONFIG_SND_SOC_WCD9XXX_V2=m
CONFIG_SND_SOC_WCD_MBHC=m
CONFIG_SND_SOC_WCD_CPE=m
CONFIG_SND_SOC_CPE=m
CONFIG_SND_SOC_WSA881X=m
CONFIG_SND_SOC_WSA881X_ANALOG=m
CONFIG_SND_SOC_WCD9335=m
CONFIG_MSM_QDSP6V2_CODECS=m
CONFIG_MSM_ULTRASOUND=m
CONFIG_MSM_QDSP6_APRV2_RPMSG=m
CONFIG_MSM_ADSP_LOADER=m
CONFIG_REGMAP_SWR=m
CONFIG_MSM_QDSP6_SSR=m
CONFIG_MSM_QDSP6_NOTIFIER=m
CONFIG_SND_SOC_MSM_HOSTLESS_PCM=m
CONFIG_SND_SOC_MSM_QDSP6V2_INTF=m
CONFIG_SND_SOC_SDM450=m
CONFIG_SND_SOC_EXT_CODEC_SDM450=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_LEGACY=m
CONFIG_QTI_PP=m
CONFIG_QTI_PP_AUDIOSPHERE=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_MSM_STUB=m
CONFIG_SND_SOC_SDM660_CDC=m
CONFIG_SND_SOC_ANALOG_CDC=m
CONFIG_SND_SOC_DIGITAL_CDC_LEGACY=m
CONFIG_SND_SOC_MSM_HDMI_CODEC_RX=m
CONFIG_WCD_DSP_GLINK=m
CONFIG_TDM_DISABLE=m
CONFIG_AUXPCM_DISABLE=m
CONFIG_CDC_DMA_DISABLE=m

View File

@@ -0,0 +1,49 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (c) 2018, 2020-2021, The Linux Foundation. All rights reserved.
*/
#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_CPE 1
#define CONFIG_SND_SOC_WCD_MBHC 1
#define CONFIG_SND_SOC_WSA881X 1
#define CONFIG_SND_SOC_WSA881X_ANALOG 1
#define CONFIG_SND_SOC_WCD9335 1
#define CONFIG_MSM_QDSP6V2_CODECS 1
#define CONFIG_MSM_ULTRASOUND 1
#define CONFIG_MSM_QDSP6_APRV2_RPMSG 1
#define CONFIG_MSM_ADSP_LOADER 1
#define CONFIG_REGMAP_SWR 1
#define CONFIG_MSM_QDSP6_SSR 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_SDM450 1
#define CONFIG_SND_SOC_EXT_CODEC_SDM450 1
#define CONFIG_SOUNDWIRE 1
#define CONFIG_SOUNDWIRE_WCD_CTRL 1
#define CONFIG_SND_SOC_WCD_MBHC_LEGACY 1
#define CONFIG_SND_SOC_QDSP6V2 1
#define CONFIG_QTI_PP 1
#define CONFIG_QTI_PP_AUDIOSPHERE 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_SND_SOC_EXT_CODEC 1
#define CONFIG_SND_SOC_INT_CODEC 1
#define CONFIG_SND_SOC_SDM660_CDC 1
#define CONFIG_SND_SOC_ANALOG_CDC 1
#define CONFIG_SND_SOC_DIGITAL_CDC_LEGACY 1
#define CONFIG_SND_SOC_MSM_HDMI_CODEC_RX 1
#define CONFIG_COMMON_CLK 1
#define CONFIG_WCD_DSP_GLINK 1
#define CONFIG_TDM_DISABLE 1
#define CONFIG_AUXPCM_DISABLE 1
#define CONFIG_CDC_DMA_DISABLE 1

View File

@@ -6,6 +6,8 @@ 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

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2021, 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
@@ -15,6 +15,7 @@
#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
@@ -54,8 +55,10 @@
#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
#define CONFIG_WCD_SPI_DMA_MASKING 1

View File

@@ -35,9 +35,13 @@ ifeq ($(call is-board-platform,sdm660),true)
AUDIO_SELECT := CONFIG_SND_SOC_SDM660=m
endif
ifeq ($(call is-board-platform-in-list,msm8953 msm8937),true)
AUDIO_SELECT := CONFIG_SND_SOC_SDM450=m
endif
AUDIO_CHIPSET := audio
# Build/Package only in case of supported target
ifeq ($(call is-board-platform-in-list,msmnile $(MSMSTEPPE) $(TRINKET) kona lito bengal sdmshrike sdm660),true)
ifeq ($(call is-board-platform-in-list,msmnile $(MSMSTEPPE) $(TRINKET) kona lito bengal sdmshrike sdm660 msm8953 msm8937),true)
LOCAL_PATH := $(call my-dir)
@@ -98,6 +102,7 @@ LOCAL_MODULE_DEBUG_ENABLE := true
LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
include $(DLKM_DIR)/AndroidKernelModule.mk
###########################################################
ifneq ($(call is-board-platform-in-list, msm8937 msm8953),true)
include $(CLEAR_VARS)
LOCAL_MODULE := $(AUDIO_CHIPSET)_q6_pdr.ko
LOCAL_MODULE_KBUILD_NAME := q6_pdr_dlkm.ko
@@ -105,6 +110,7 @@ LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_DEBUG_ENABLE := true
LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
include $(DLKM_DIR)/AndroidKernelModule.mk
endif
###########################################################
endif # target specific build
endif # DLKM check

View File

@@ -81,6 +81,21 @@ ifeq ($(KERNEL_BUILD), 0)
export
INCS += -include $(AUDIO_ROOT)/config/sdm660autoconf.h
endif
ifeq ($(CONFIG_ARCH_SDM450), y)
include $(AUDIO_ROOT)/config/sdm450auto.conf
export
INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
endif
ifeq ($(CONFIG_ARCH_SDM439), y)
include $(AUDIO_ROOT)/config/sdm450auto.conf
export
INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
endif
ifeq ($(CONFIG_ARCH_MSM8917), y)
include $(AUDIO_ROOT)/config/sdm450auto.conf
export
INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
endif
endif

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2017, 2021, The Linux Foundation. All rights reserved.
*/
#include <linux/module.h>
@@ -629,7 +629,7 @@ static int __init audio_notifier_init(void)
static int __init audio_notifier_init(void)
{
audio_notifier_subsys_init();
audio_notifier_disable_service(AUDIO_NOTIFIER_PDR_SERVICE);
audio_notifer_disable_service(AUDIO_NOTIFIER_PDR_SERVICE);
audio_notifier_late_init();

View File

@@ -336,11 +336,6 @@ int avcs_core_query_timer_offset(int64_t *av_offset, int32_t clock_id)
uint64_t avtimer_tick_temp, avtimer_tick, sys_time = 0;
struct timespec ts;
if (!atomic_read(&avtimer.adsp_ready)) {
pr_debug("%s:In SSR, return\n", __func__);
return -ENETRESET;
}
if ((avtimer.p_avtimer_lsw == NULL) ||
(avtimer.p_avtimer_msw == NULL)) {
return -EINVAL;

View File

@@ -27,9 +27,13 @@ ifeq ($(call is-board-platform,sdm660),true)
AUDIO_SELECT := CONFIG_SND_SOC_SDM660=m
endif
ifeq ($(call is-board-platform-in-list,msm8953 msm8937),true)
AUDIO_SELECT := CONFIG_SND_SOC_SDM450=m
endif
AUDIO_CHIPSET := audio
# Build/Package only in case of supported target
ifeq ($(call is-board-platform-in-list,msmnile $(MSMSTEPPE) $(TRINKET) kona lito bengal sdmshrike sdm660),true)
ifeq ($(call is-board-platform-in-list,msmnile $(MSMSTEPPE) $(TRINKET) kona lito bengal sdmshrike sdm660 msm8953 msm8937),true)
LOCAL_PATH := $(call my-dir)

View File

@@ -63,6 +63,21 @@ ifeq ($(KERNEL_BUILD), 0)
export
INCS += -include $(AUDIO_ROOT)/config/sdm660autoconf.h
endif
ifeq ($(CONFIG_ARCH_SDM450), y)
include $(AUDIO_ROOT)/config/sdm450auto.conf
export
INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
endif
ifeq ($(CONFIG_ARCH_SDM439), y)
include $(AUDIO_ROOT)/config/sdm450auto.conf
export
INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
endif
ifeq ($(CONFIG_ARCH_MSM8917), y)
include $(AUDIO_ROOT)/config/sdm450auto.conf
export
INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
endif
endif
# As per target team, build is done as follows:

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/module.h>
#include <linux/slab.h>

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/slab.h>
#include <linux/debugfs.h>
@@ -255,45 +255,74 @@ struct afe_ctl {
struct afe_clkinfo_per_port {
u16 port_id; /* AFE port ID */
uint32_t clk_id; /* Clock ID */
uint32_t mclk_src_id; /* MCLK SRC ID */
uint32_t mclk_freq; /* MCLK_FREQ */
char clk_src_name[CLK_SRC_NAME_MAX];
};
struct afe_clkinfo_per_port clkinfo_per_port[] = {
{ AFE_PORT_ID_PRIMARY_MI2S_RX, Q6AFE_LPASS_CLK_ID_PRI_MI2S_IBIT},
{ AFE_PORT_ID_SECONDARY_MI2S_RX, Q6AFE_LPASS_CLK_ID_SEC_MI2S_IBIT},
{ AFE_PORT_ID_TERTIARY_MI2S_RX, Q6AFE_LPASS_CLK_ID_TER_MI2S_IBIT},
{ AFE_PORT_ID_QUATERNARY_MI2S_RX, Q6AFE_LPASS_CLK_ID_QUAD_MI2S_IBIT},
{ AFE_PORT_ID_QUINARY_MI2S_RX, Q6AFE_LPASS_CLK_ID_QUI_MI2S_IBIT},
{ AFE_PORT_ID_SENARY_MI2S_RX, Q6AFE_LPASS_CLK_ID_SEN_MI2S_IBIT},
{ AFE_PORT_ID_PRIMARY_PCM_RX, Q6AFE_LPASS_CLK_ID_PRI_PCM_IBIT},
{ AFE_PORT_ID_SECONDARY_PCM_RX, Q6AFE_LPASS_CLK_ID_SEC_PCM_IBIT},
{ AFE_PORT_ID_TERTIARY_PCM_RX, Q6AFE_LPASS_CLK_ID_TER_PCM_IBIT},
{ AFE_PORT_ID_QUATERNARY_PCM_RX, Q6AFE_LPASS_CLK_ID_QUAD_PCM_IBIT},
{ AFE_PORT_ID_QUINARY_PCM_RX, Q6AFE_LPASS_CLK_ID_QUIN_PCM_IBIT},
{ AFE_PORT_ID_SENARY_PCM_RX, Q6AFE_LPASS_CLK_ID_SEN_PCM_IBIT},
{ AFE_PORT_ID_PRIMARY_TDM_RX, Q6AFE_LPASS_CLK_ID_PRI_TDM_IBIT},
{ AFE_PORT_ID_SECONDARY_TDM_RX, Q6AFE_LPASS_CLK_ID_SEC_TDM_IBIT},
{ AFE_PORT_ID_TERTIARY_TDM_RX, Q6AFE_LPASS_CLK_ID_TER_TDM_IBIT},
{ AFE_PORT_ID_QUATERNARY_TDM_RX, Q6AFE_LPASS_CLK_ID_QUAD_TDM_IBIT},
{ AFE_PORT_ID_QUINARY_TDM_RX, Q6AFE_LPASS_CLK_ID_QUIN_TDM_IBIT},
{ AFE_PORT_ID_PRIMARY_SPDIF_RX,
AFE_CLOCK_SET_CLOCK_ID_PRI_SPDIF_OUTPUT_CORE},
{ AFE_PORT_ID_PRIMARY_SPDIF_TX,
AFE_CLOCK_SET_CLOCK_ID_PRI_SPDIF_INPUT_CORE},
{ AFE_PORT_ID_SECONDARY_SPDIF_RX,
AFE_CLOCK_SET_CLOCK_ID_SEC_SPDIF_OUTPUT_CORE},
{ AFE_PORT_ID_SECONDARY_SPDIF_TX,
AFE_CLOCK_SET_CLOCK_ID_SEC_SPDIF_INPUT_CORE},
{ AFE_PORT_ID_PRIMARY_META_MI2S_RX,
Q6AFE_LPASS_CLK_ID_PRI_MI2S_IBIT},
{ AFE_PORT_ID_SECONDARY_META_MI2S_RX,
Q6AFE_LPASS_CLK_ID_PRI_MI2S_IBIT},
struct afe_ext_mclk_cb_info {
afe_enable_mclk_and_get_info_cb_func ext_mclk_cb;
void *private_data;
};
static struct afe_clkinfo_per_port clkinfo_per_port[] = {
{ AFE_PORT_ID_PRIMARY_MI2S_RX,
MCLK_SRC_INT, Q6AFE_EXT_MCLK_FREQ_DEFAULT, ""},
{ AFE_PORT_ID_SECONDARY_MI2S_RX,
MCLK_SRC_INT, Q6AFE_EXT_MCLK_FREQ_DEFAULT, ""},
{ AFE_PORT_ID_TERTIARY_MI2S_RX,
MCLK_SRC_INT, Q6AFE_EXT_MCLK_FREQ_DEFAULT, ""},
{ AFE_PORT_ID_QUATERNARY_MI2S_RX,
MCLK_SRC_INT, Q6AFE_EXT_MCLK_FREQ_DEFAULT, ""},
{ AFE_PORT_ID_QUINARY_MI2S_RX,
MCLK_SRC_INT, Q6AFE_EXT_MCLK_FREQ_DEFAULT, ""},
{ AFE_PORT_ID_SENARY_MI2S_RX,
MCLK_SRC_INT, Q6AFE_EXT_MCLK_FREQ_DEFAULT, ""},
{ AFE_PORT_ID_PRIMARY_PCM_RX,
MCLK_SRC_INT, Q6AFE_EXT_MCLK_FREQ_DEFAULT, ""},
{ AFE_PORT_ID_SECONDARY_PCM_RX,
MCLK_SRC_INT, Q6AFE_EXT_MCLK_FREQ_DEFAULT, ""},
{ AFE_PORT_ID_TERTIARY_PCM_RX,
MCLK_SRC_INT, Q6AFE_EXT_MCLK_FREQ_DEFAULT, ""},
{ AFE_PORT_ID_QUATERNARY_PCM_RX,
MCLK_SRC_INT, Q6AFE_EXT_MCLK_FREQ_DEFAULT, ""},
{ AFE_PORT_ID_QUINARY_PCM_RX,
MCLK_SRC_INT, Q6AFE_EXT_MCLK_FREQ_DEFAULT, ""},
{ AFE_PORT_ID_SENARY_PCM_RX,
MCLK_SRC_INT, Q6AFE_EXT_MCLK_FREQ_DEFAULT, ""},
{ AFE_PORT_ID_PRIMARY_TDM_RX,
MCLK_SRC_INT, Q6AFE_EXT_MCLK_FREQ_DEFAULT, ""},
{ AFE_PORT_ID_SECONDARY_TDM_RX,
MCLK_SRC_INT, Q6AFE_EXT_MCLK_FREQ_DEFAULT, ""},
{ AFE_PORT_ID_TERTIARY_TDM_RX,
MCLK_SRC_INT, Q6AFE_EXT_MCLK_FREQ_DEFAULT, ""},
{ AFE_PORT_ID_QUATERNARY_TDM_RX,
MCLK_SRC_INT, Q6AFE_EXT_MCLK_FREQ_DEFAULT, ""},
{ AFE_PORT_ID_QUINARY_TDM_RX,
MCLK_SRC_INT, Q6AFE_EXT_MCLK_FREQ_DEFAULT, ""},
{ AFE_PORT_ID_SENARY_TDM_RX,
MCLK_SRC_INT, Q6AFE_EXT_MCLK_FREQ_DEFAULT, ""},
{ AFE_PORT_ID_PRIMARY_SPDIF_RX,
MCLK_SRC_INT, Q6AFE_EXT_MCLK_FREQ_DEFAULT, ""},
{ AFE_PORT_ID_PRIMARY_SPDIF_TX,
MCLK_SRC_INT, Q6AFE_EXT_MCLK_FREQ_DEFAULT, ""},
{ AFE_PORT_ID_SECONDARY_SPDIF_RX,
MCLK_SRC_INT, Q6AFE_EXT_MCLK_FREQ_DEFAULT, ""},
{ AFE_PORT_ID_SECONDARY_SPDIF_TX,
MCLK_SRC_INT, Q6AFE_EXT_MCLK_FREQ_DEFAULT, ""},
{ AFE_PORT_ID_PRIMARY_META_MI2S_RX,
MCLK_SRC_INT, Q6AFE_EXT_MCLK_FREQ_DEFAULT, ""},
{ AFE_PORT_ID_SECONDARY_META_MI2S_RX,
MCLK_SRC_INT, Q6AFE_EXT_MCLK_FREQ_DEFAULT, ""},
};
static struct afe_ext_mclk_cb_info afe_ext_mclk;
static atomic_t afe_ports_mad_type[SLIMBUS_PORT_LAST - SLIMBUS_0_RX];
static unsigned long afe_configured_cmd;
static struct afe_ctl this_afe;
static char clk_src_name[CLK_SRC_MAX][CLK_SRC_NAME_MAX];
#define TIMEOUT_MS 1000
#define Q6AFE_MAX_VOLUME 0x3FFF
@@ -387,6 +416,12 @@ static int q6afe_load_avcs_modules(int num_modules, u16 port_id,
goto load_unload;
}
if (format_id == ASM_MEDIA_FMT_APTX_ADAPTIVE) {
pm[i]->payload->load_unload_info[0].id1 =
AVS_MODULE_ID_DEPACKETIZER_COP;
goto load_unload;
}
pm[i]->payload->load_unload_info[1].module_type =
AMDB_MODULE_TYPE_DECODER;
pm[i]->payload->load_unload_info[1].id1 =
@@ -429,6 +464,37 @@ static int afe_get_cal_hw_delay(int32_t path,
struct audio_cal_hw_delay_entry *entry);
static int remap_cal_data(struct cal_block_data *cal_block, int cal_index);
/**
* afe_register_ext_mclk_cb - register callback for external mclk
*
* @fn - external mclk callback function
* @private_data - external mclk callback specific data
*
* Returns 0 in case of success and -EINVAL for failure
*/
int afe_register_ext_mclk_cb(afe_enable_mclk_and_get_info_cb_func fn,
void *private_data)
{
if (fn && private_data) {
afe_ext_mclk.ext_mclk_cb = fn;
afe_ext_mclk.private_data = private_data;
return 0;
}
return -EINVAL;
}
EXPORT_SYMBOL(afe_register_ext_mclk_cb);
/**
* afe_unregister_ext_mclk_cb - unregister external mclk callback
*/
void afe_unregister_ext_mclk_cb(void)
{
afe_ext_mclk.ext_mclk_cb = NULL;
afe_ext_mclk.private_data = NULL;
}
EXPORT_SYMBOL(afe_unregister_ext_mclk_cb);
int afe_get_spk_initial_cal(void)
{
return this_afe.initial_cal;
@@ -887,6 +953,19 @@ static int32_t afe_callback(struct apr_client_data *data, void *priv)
mutex_lock(&this_afe.afe_cmd_lock);
for (i = 0; i < AFE_LPASS_CORE_HW_VOTE_MAX; i++)
this_afe.lpass_hw_core_client_hdl[i] = 0;
/*
* Free the port mapping structures used for AVCS module
* load/unload.
*/
for (i = 0; i < MAX_ALLOWED_USE_CASES; i++) {
if (pm[i]) {
kfree(pm[i]->payload);
pm[i]->payload = NULL;
kfree(pm[i]);
pm[i] = NULL;
}
}
mutex_unlock(&this_afe.afe_cmd_lock);
/*
@@ -2997,6 +3076,54 @@ static int afe_get_cal_topology_id(u16 port_id, u32 *topology_id,
return ret;
}
static int afe_port_topology_deregister(u16 port_id)
{
struct param_hdr_v3 param_info;
int ret = 0;
uint32_t build_major_version = 0;
uint32_t build_minor_version = 0;
uint32_t build_branch_version = 0;
uint32_t afe_api_version = 0;
ret = q6core_get_avcs_avs_build_version_info(
&build_major_version, &build_minor_version,
&build_branch_version);
if (ret < 0)
goto done;
ret = q6core_get_avcs_api_version_per_service(
APRV2_IDS_SERVICE_ID_ADSP_AFE_V);
if (ret < 0)
goto done;
afe_api_version = ret;
pr_debug("%s: mjor: %u, mnor: %u, brnch: %u, afe_api: %u\n",
__func__, build_major_version, build_minor_version,
build_branch_version, afe_api_version);
if ((build_major_version != AVS_BUILD_MAJOR_VERSION_V2) ||
(build_minor_version != AVS_BUILD_MINOR_VERSION_V9) ||
(build_branch_version !=
AVS_BUILD_BRANCH_VERSION_V3) ||
(afe_api_version < AFE_API_VERSION_V9)) {
ret = 0;
goto done;
}
memset(&param_info, 0, sizeof(param_info));
param_info.module_id = AFE_MODULE_AUDIO_DEV_INTERFACE;
param_info.instance_id = INSTANCE_ID_0;
param_info.param_id = AFE_PARAM_ID_DEREGISTER_TOPOLOGY;
param_info.param_size = 0;
ret = q6afe_pack_and_set_param_in_band(port_id,
q6audio_get_port_index(port_id),
param_info, NULL);
return ret;
done:
pr_debug("%s build ver mismatch - leaving function %d\n",
__func__, ret);
return ret;
}
static int afe_send_port_topology_id(u16 port_id)
{
struct afe_param_id_set_topology_cfg topology;
@@ -3005,6 +3132,13 @@ static int afe_send_port_topology_id(u16 port_id)
int index = 0;
int ret = 0;
ret = afe_port_topology_deregister(port_id);
if (ret < 0) {
pr_err("%s: AFE deregister topology for port 0x%x failed %d\n",
__func__, port_id, ret);
goto done;
}
memset(&topology, 0, sizeof(topology));
memset(&param_info, 0, sizeof(param_info));
index = q6audio_get_port_index(port_id);
@@ -5259,10 +5393,11 @@ static int __afe_port_start(u16 port_id, union afe_port_config *afe_config,
union afe_port_config port_cfg;
struct param_hdr_v3 param_hdr;
int ret = 0;
int cfg_type;
int cfg_type = 0;
int index = 0;
enum afe_mad_type mad_type;
uint16_t port_index;
u16 i;
memset(&param_hdr, 0, sizeof(param_hdr));
memset(&port_cfg, 0, sizeof(port_cfg));
@@ -5649,6 +5784,20 @@ static int __afe_port_start(u16 port_id, union afe_port_config *afe_config,
ret = afe_send_cmd_port_start(port_id);
fail_cmd:
if (ret) {
if ((codec_format != ASM_MEDIA_FMT_NONE) &&
(cfg_type == AFE_PARAM_ID_SLIMBUS_CONFIG)) {
if ((q6core_get_avcs_api_version_per_service(
APRV2_IDS_SERVICE_ID_ADSP_CORE_V) >= AVCS_API_VERSION_V5)) {
for (i = 0; i < MAX_ALLOWED_USE_CASES; i++) {
if (pm[i] && pm[i]->port_id == port_id) {
q6afe_unload_avcs_modules(port_id, i);
break;
}
}
}
}
}
mutex_unlock(&this_afe.afe_cmd_lock);
return ret;
}
@@ -8412,8 +8561,7 @@ int afe_close(int port_id)
(port_id == RT_PROXY_DAI_001_TX))
proxy_afe_instance[port_id & 0x1] = 0;
afe_close_done[port_id & 0x1] = true;
ret = -EINVAL;
goto fail_cmd;
return -EINVAL;
}
pr_info("%s: port_id = 0x%x\n", __func__, port_id);
if ((port_id == RT_PROXY_DAI_001_RX) ||
@@ -8667,53 +8815,73 @@ static int afe_get_port_idx(u16 port_id)
return -EINVAL;
}
static int afe_get_clk_id(u16 port_id)
static int afe_get_clk_src(u16 port_id, char *clk_src)
{
u16 afe_port = 0;
uint32_t clk_id = -EINVAL;
int idx = 0;
idx = afe_get_port_idx(port_id);
if (idx < 0) {
pr_err("%s: cannot get clock id for port id 0x%x\n", __func__,
afe_port);
idx);
return -EINVAL;
}
clk_id = clkinfo_per_port[idx].clk_id;
pr_debug("%s: clk id 0x%x port id 0x%x\n", __func__, clk_id,
afe_port);
if (clkinfo_per_port[idx].clk_src_name == NULL)
return -EINVAL;
strlcpy(clk_src, clkinfo_per_port[idx].clk_src_name,
CLK_SRC_NAME_MAX);
pr_debug("%s: clk src name %s port id 0x%x\n", __func__, clk_src,
idx);
return clk_id;
return 0;
}
/**
* afe_set_clk_id - Update clock id for AFE port
* afe_set_source_clk - Set audio interface PLL clock source
*
* @port_id: AFE port id
* @clk_id: CLock ID
* @clk_src: Clock source name for port id
*
* Returns 0 on success, appropriate error code otherwise
*/
int afe_set_clk_id(u16 port_id, uint32_t clk_id)
int afe_set_source_clk(u16 port_id, const char *clk_src)
{
u16 afe_port = 0;
int idx = 0;
idx = afe_get_port_idx(port_id);
if (idx < 0) {
pr_debug("%s: cannot set clock id for port id 0x%x\n", __func__,
afe_port);
idx);
return -EINVAL;
}
clkinfo_per_port[idx].clk_id = clk_id;
pr_debug("%s: updated clk id 0x%x port id 0x%x\n", __func__,
clkinfo_per_port[idx].clk_id, afe_port);
if (clk_src == NULL)
return -EINVAL;
strlcpy(clkinfo_per_port[idx].clk_src_name, clk_src, CLK_SRC_NAME_MAX);
pr_debug("%s: updated clk src name %s port id 0x%x\n", __func__,
clkinfo_per_port[idx].clk_src_name, idx);
return 0;
}
EXPORT_SYMBOL(afe_set_clk_id);
EXPORT_SYMBOL(afe_set_source_clk);
/**
* afe_set_clk_src_array - Set afe clk src array from machine driver
*
* @clk_src_array: clk src array for integral and fract clk src
*
*/
void afe_set_clk_src_array(const char *clk_src_array[CLK_SRC_MAX])
{
int i;
for (i = 0; i < CLK_SRC_MAX; i++) {
if (clk_src_array[i] != NULL)
strlcpy(clk_src_name[i], clk_src_array[i],
CLK_SRC_NAME_MAX);
}
}
EXPORT_SYMBOL(afe_set_clk_src_array);
/**
* afe_set_pll_clk_drift - Set audio interface PLL clock drift
@@ -8729,8 +8897,33 @@ int afe_set_pll_clk_drift(u16 port_id, int32_t set_clk_drift,
{
struct afe_set_clk_drift clk_drift;
struct param_hdr_v3 param_hdr;
uint32_t clk_id;
char clk_src_name[CLK_SRC_NAME_MAX];
int index = 0, ret = 0;
uint32_t build_major_version = 0;
uint32_t build_minor_version = 0;
uint32_t build_branch_version = 0;
int afe_api_version = 0;
ret = q6core_get_avcs_avs_build_version_info(
&build_major_version, &build_minor_version,
&build_branch_version);
if (ret < 0) {
pr_err("%s error in retrieving avs build version %d\n",
__func__, ret);
return ret;
}
afe_api_version = q6core_get_avcs_api_version_per_service(
APRV2_IDS_SERVICE_ID_ADSP_AFE_V);
if (afe_api_version < 0) {
pr_err("%s error in retrieving afe api version %d\n",
__func__, afe_api_version);
return afe_api_version;
}
pr_debug("%s: mjor: %u, mnor: %u, brnch: %u, afe_api: %u\n",
__func__, build_major_version, build_minor_version,
build_branch_version, afe_api_version);
memset(&param_hdr, 0, sizeof(param_hdr));
memset(&clk_drift, 0, sizeof(clk_drift));
@@ -8748,24 +8941,18 @@ int afe_set_pll_clk_drift(u16 port_id, int32_t set_clk_drift,
return ret;
}
clk_id = afe_get_clk_id(port_id);
if (clk_id < 0) {
pr_err("%s: cannot get clk id for port id 0x%x\n",
ret = afe_get_clk_src(port_id, clk_src_name);
if (ret) {
pr_err("%s: cannot get clk src name for port id 0x%x\n",
__func__, port_id);
return -EINVAL;
}
if (clk_id & 0x01) {
pr_err("%s: cannot adjust clock drift for external clock id 0x%x\n",
__func__, clk_id);
return -EINVAL;
}
clk_drift.clk_drift = set_clk_drift;
clk_drift.clk_reset = clk_reset;
clk_drift.clk_id = clk_id;
pr_debug("%s: clk id = 0x%x clk drift = %d clk reset = %d port id 0x%x\n",
__func__, clk_drift.clk_id, clk_drift.clk_drift,
strlcpy(clk_drift.clk_src_name, clk_src_name, CLK_SRC_NAME_MAX);
pr_debug("%s: clk src= %s clkdrft= %d clkrst= %d port id 0x%x\n",
__func__, clk_drift.clk_src_name, clk_drift.clk_drift,
clk_drift.clk_reset, port_id);
mutex_lock(&this_afe.afe_clk_lock);
@@ -8774,17 +8961,110 @@ int afe_set_pll_clk_drift(u16 port_id, int32_t set_clk_drift,
param_hdr.param_id = AFE_PARAM_ID_CLOCK_ADJUST;
param_hdr.param_size = sizeof(struct afe_set_clk_drift);
ret = q6afe_svc_pack_and_set_param_in_band(index, param_hdr,
(u8 *) &clk_drift);
if (ret < 0)
pr_err_ratelimited("%s: AFE PLL clk drift failed with ret %d\n",
__func__, ret);
if ((build_major_version == AVS_BUILD_MAJOR_VERSION_V2) &&
(build_minor_version == AVS_BUILD_MINOR_VERSION_V9) &&
(build_branch_version == AVS_BUILD_BRANCH_VERSION_V3) &&
(afe_api_version >= AFE_API_VERSION_V10)) {
param_hdr.param_size = sizeof(struct afe_set_clk_drift);
ret = q6afe_svc_pack_and_set_param_in_band(index, param_hdr,
(u8 *) &clk_drift);
if (ret < 0)
pr_err_ratelimited("%s: AFE PLL clk drift failed with ret %d\n",
__func__, ret);
} else {
ret = -EINVAL;
pr_err_ratelimited("%s: AFE PLL clk drift failed ver mismatch %d\n",
__func__, ret);
}
mutex_unlock(&this_afe.afe_clk_lock);
return ret;
}
EXPORT_SYMBOL(afe_set_pll_clk_drift);
static int afe_set_lpass_clk_cfg_ext_mclk(int index, struct afe_clk_set *cfg,
uint32_t mclk_freq)
{
struct param_hdr_v3 param_hdr;
struct afe_param_id_clock_set_v2_t dyn_mclk_cfg;
int ret = 0;
if (!cfg) {
pr_err("%s: clock cfg is NULL\n", __func__);
ret = -EINVAL;
return ret;
}
if (index < 0 || index >= AFE_MAX_PORTS) {
pr_err("%s: index[%d] invalid!\n", __func__, index);
return -EINVAL;
}
memset(&param_hdr, 0, sizeof(param_hdr));
param_hdr.module_id = AFE_MODULE_CLOCK_SET;
param_hdr.instance_id = INSTANCE_ID_0;
param_hdr.param_id = AFE_PARAM_ID_CLOCK_SET_V2;
param_hdr.param_size = sizeof(struct afe_param_id_clock_set_v2_t);
memset(&dyn_mclk_cfg, 0, sizeof(dyn_mclk_cfg));
dyn_mclk_cfg.clk_freq_in_hz = cfg->clk_freq_in_hz;
if (afe_ext_mclk.ext_mclk_cb) {
ret = afe_ext_mclk.ext_mclk_cb(afe_ext_mclk.private_data,
cfg->enable, mclk_freq, &dyn_mclk_cfg);
if (ret) {
pr_err_ratelimited("%s: get mclk cfg failed %d\n",
__func__, ret);
return ret;
}
} else {
pr_err_ratelimited("%s: mclk callback not registered\n",
__func__);
return -EINVAL;
}
dyn_mclk_cfg.clk_set_minor_version = 1;
dyn_mclk_cfg.clk_id = cfg->clk_id;
dyn_mclk_cfg.clk_attri = cfg->clk_attri;
dyn_mclk_cfg.enable = cfg->enable;
pr_debug("%s: Minor version =0x%x clk id = %d\n", __func__,
dyn_mclk_cfg.clk_set_minor_version, dyn_mclk_cfg.clk_id);
pr_debug("%s: clk freq (Hz) = %d, clk attri = 0x%x\n", __func__,
dyn_mclk_cfg.clk_freq_in_hz, dyn_mclk_cfg.clk_attri);
pr_debug("%s: clk root = 0x%x clk enable = 0x%x\n", __func__,
dyn_mclk_cfg.clk_root, dyn_mclk_cfg.enable);
pr_debug("%s: divider_2x =%d m = %d n = %d, d =%d\n", __func__,
dyn_mclk_cfg.divider_2x, dyn_mclk_cfg.m, dyn_mclk_cfg.n,
dyn_mclk_cfg.d);
ret = afe_q6_interface_prepare();
if (ret != 0) {
pr_err_ratelimited("%s: Q6 interface prepare failed %d\n",
__func__, ret);
goto stop_mclk;
}
mutex_lock(&this_afe.afe_cmd_lock);
ret = q6afe_svc_pack_and_set_param_in_band(index, param_hdr,
(u8 *) &dyn_mclk_cfg);
if (ret < 0)
pr_err_ratelimited("%s: ext MCLK clk cfg failed with ret %d\n",
__func__, ret);
mutex_unlock(&this_afe.afe_cmd_lock);
if (ret >= 0)
return ret;
stop_mclk:
if (afe_ext_mclk.ext_mclk_cb && cfg->enable) {
afe_ext_mclk.ext_mclk_cb(afe_ext_mclk.private_data,
cfg->enable, mclk_freq, &dyn_mclk_cfg);
}
return ret;
}
/**
* afe_set_lpass_clk_cfg - Set AFE clk config
*
@@ -8857,6 +9137,11 @@ int afe_set_lpass_clock_v2(u16 port_id, struct afe_clk_set *cfg)
{
int index = 0;
int ret = 0;
int idx = 0;
uint32_t build_major_version = 0;
uint32_t build_minor_version = 0;
uint32_t build_branch_version = 0;
int afe_api_version = 0;
index = q6audio_get_port_index(port_id);
if (index < 0 || index >= AFE_MAX_PORTS) {
@@ -8871,11 +9156,59 @@ int afe_set_lpass_clock_v2(u16 port_id, struct afe_clk_set *cfg)
return -EINVAL;
}
ret = afe_set_clk_id(port_id, cfg->clk_id);
if (ret < 0)
pr_debug("%s: afe_set_clk_id fail %d\n", __func__, ret);
if (clk_src_name != NULL) {
if (cfg->clk_freq_in_hz % AFE_SAMPLING_RATE_8KHZ) {
if (clk_src_name[CLK_SRC_FRACT] != NULL)
ret = afe_set_source_clk(port_id,
clk_src_name[CLK_SRC_FRACT]);
} else if (clk_src_name[CLK_SRC_INTEGRAL] != NULL) {
ret = afe_set_source_clk(port_id,
clk_src_name[CLK_SRC_INTEGRAL]);
}
if (ret < 0)
pr_err("%s: afe_set_source_clk fail %d\n",
__func__, ret);
}
idx = afe_get_port_idx(port_id);
if (idx < 0) {
pr_debug("%s: cannot get clock id for port id 0x%x\n", __func__,
port_id);
} else if (clkinfo_per_port[idx].mclk_src_id != MCLK_SRC_INT) {
pr_debug("%s: ext MCLK src %d\n",
__func__, clkinfo_per_port[idx].mclk_src_id);
ret = q6core_get_avcs_avs_build_version_info(
&build_major_version, &build_minor_version,
&build_branch_version);
if (ret < 0)
return ret;
ret = q6core_get_avcs_api_version_per_service(
APRV2_IDS_SERVICE_ID_ADSP_AFE_V);
if (ret < 0)
return ret;
afe_api_version = ret;
pr_debug("%s: mjor: %u, mnor: %u, brnch: %u, afe_api: %u\n",
__func__, build_major_version, build_minor_version,
build_branch_version, afe_api_version);
if ((build_major_version != AVS_BUILD_MAJOR_VERSION_V2) ||
(build_minor_version != AVS_BUILD_MINOR_VERSION_V9) ||
(build_branch_version != AVS_BUILD_BRANCH_VERSION_V3) ||
(afe_api_version < AFE_API_VERSION_V8)) {
pr_err("%s: ext mclk not supported by AVS\n", __func__);
return -EINVAL;
}
ret = afe_set_lpass_clk_cfg_ext_mclk(index, cfg,
clkinfo_per_port[idx].mclk_freq);
goto done;
}
ret = afe_set_lpass_clk_cfg(index, cfg);
done:
if (ret)
pr_err("%s: afe_set_lpass_clk_cfg_v2 failed %d\n",
__func__, ret);
@@ -8884,6 +9217,36 @@ int afe_set_lpass_clock_v2(u16 port_id, struct afe_clk_set *cfg)
}
EXPORT_SYMBOL(afe_set_lpass_clock_v2);
/**
* afe_set_mclk_src_cfg - Set audio interface MCLK source configuration
*
* @port_id: AFE port id
* @mclk_src_id: mclk id to represent internal or one of external MCLK
* @mclk_freq: frequency of the MCLK
*
* Returns 0 on success, appropriate error code otherwise
*/
int afe_set_mclk_src_cfg(u16 port_id, uint32_t mclk_src_id, uint32_t mclk_freq)
{
int idx = 0;
idx = afe_get_port_idx(port_id);
if (idx < 0) {
pr_err("%s: cannot get clock id for port id 0x%x\n",
__func__, port_id);
return -EINVAL;
}
clkinfo_per_port[idx].mclk_src_id = mclk_src_id;
clkinfo_per_port[idx].mclk_freq = mclk_freq;
pr_debug("%s: mclk src id 0x%x mclk_freq %d port id 0x%x\n",
__func__, mclk_src_id, mclk_freq, port_id);
return 0;
}
EXPORT_SYMBOL(afe_set_mclk_src_cfg);
int afe_set_lpass_internal_digital_codec_clock(u16 port_id,
struct afe_digital_clk_cfg *cfg)
{

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/kernel.h>
@@ -739,6 +739,44 @@ int q6core_get_avcs_api_version_per_service(uint32_t service_id)
}
EXPORT_SYMBOL(q6core_get_avcs_api_version_per_service);
/**
* q6core_get_avcs_avs_build_version_info - Get AVS build version information
*
* @build_major_version - pointer to build major version
* @build_minor_version - pointer to build minor version
* @build_branch_version - pointer to build branch version
*
* Returns 0 on success and error on failure
*/
int q6core_get_avcs_avs_build_version_info(
uint32_t *build_major_version, uint32_t *build_minor_version,
uint32_t *build_branch_version)
{
struct avcs_fwk_ver_info *cached_ver_info = NULL;
int ret = 0;
if (!build_major_version || !build_minor_version ||
!build_branch_version)
return -EINVAL;
ret = q6core_get_avcs_fwk_version();
if (ret < 0)
return ret;
cached_ver_info = q6core_lcl.q6core_avcs_ver_info.ver_info;
*build_major_version =
cached_ver_info->avcs_fwk_version.build_major_version;
*build_minor_version =
cached_ver_info->avcs_fwk_version.build_minor_version;
*build_branch_version =
cached_ver_info->avcs_fwk_version.build_branch_version;
return ret;
}
EXPORT_SYMBOL(q6core_get_avcs_avs_build_version_info);
/**
* core_set_license -
* command to set license for module

View File

@@ -229,7 +229,7 @@ static int q6lsm_callback(struct apr_client_data *data, void *priv)
}
if (client->param_size != param_size) {
pr_err("%s: response payload size %d mismatched with user requested %d\n",
pr_err("%s: response payload size %d mismatched with user requested %zu\n",
__func__, param_size, client->param_size);
ret = -EINVAL;
goto done;

View File

@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2015-2019, 2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2015-2019, 2020-2021, The Linux Foundation. All rights reserved.
*/
#ifndef __MSM_COMMON
@@ -86,6 +86,8 @@ struct sdm660_codec {
enum {
INT_SND_CARD,
INT_DIG_SND_CARD,
INT_MAX_SND_CARD = INT_DIG_SND_CARD,
EXT_SND_CARD_TASHA,
EXT_SND_CARD_TAVIL,
};

View File

@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
*/
@@ -3965,6 +3965,7 @@ struct afe_param_id_device_hw_delay_cfg {
} __packed;
#define AFE_PARAM_ID_SET_TOPOLOGY 0x0001025A
#define AFE_PARAM_ID_DEREGISTER_TOPOLOGY 0x000102E8
#define AFE_API_VERSION_TOPOLOGY_V1 0x1
struct afe_param_id_set_topology_cfg {
@@ -12166,6 +12167,27 @@ struct afe_clk_set {
uint32_t enable;
};
#define AVS_BUILD_MAJOR_VERSION_V2 2
#define AVS_BUILD_MINOR_VERSION_V9 9
#define AVS_BUILD_BRANCH_VERSION_V3 3
#define AFE_PARAM_ID_CLOCK_SET_V2 0x000102E6
#define AFE_API_VERSION_CLOCK_SET_V2 0x1
struct afe_param_id_clock_set_v2_t {
uint32_t clk_set_minor_version;
uint32_t clk_id;
uint32_t clk_freq_in_hz;
uint16_t clk_attri;
uint16_t clk_root;
uint32_t enable;
uint32_t divider_2x;
uint32_t m;
uint32_t n;
uint32_t d;
};
struct afe_clk_cfg {
/* Minor version used for tracking the version of the I2S
* configuration interface.
@@ -12206,16 +12228,15 @@ struct afe_clk_cfg {
#define AFE_MODULE_CLOCK_SET 0x0001028F
#define AFE_PARAM_ID_CLOCK_SET 0x00010290
struct afe_set_clk_drift {
/*
* Clock ID
* @values
* - 0x100 to 0x10E
* - 0x200 to 0x20C
* - 0x500 to 0x505
*/
uint32_t clk_id;
#define CLK_SRC_NAME_MAX 32
enum {
CLK_SRC_INTEGRAL,
CLK_SRC_FRACT,
CLK_SRC_MAX
};
struct afe_set_clk_drift {
/*
* Clock drift (in PPB) to be set.
* @values
@@ -12224,12 +12245,20 @@ struct afe_set_clk_drift {
int32_t clk_drift;
/*
* Clock rest.
* Clock reset.
* @values
* - 1 -- Reset PLL with the original frequency
* - 0 -- Adjust the clock with the clk drift value
*/
uint32_t clk_reset;
/*
* Clock src name.
* @values
* - values to be set from machine driver
* - LPAPLL0 -- integral clk src
* - LPAPLL2 -- fractional clk src
*/
char clk_src_name[CLK_SRC_NAME_MAX];
} __packed;
/* This param id is used to adjust audio interface PLL*/

View File

@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
*/
#ifndef __Q6AFE_V2_H__
#define __Q6AFE_V2_H__
@@ -45,8 +45,13 @@
#define AFE_API_VERSION_V4 4
/* for VAD enable */
#define AFE_API_VERSION_V6 6
/* for external mclk dynamic switch */
#define AFE_API_VERSION_V8 8
/* for Speaker Protection V4 */
#define AFE_API_VERSION_V9 9
#define AFE_API_VERSION_V10 10
#define AFE_SAMPLING_RATE_8KHZ 8000
typedef int (*routing_cb)(int port);
@@ -316,6 +321,24 @@ struct vad_config {
u32 pre_roll;
};
enum afe_mclk_src_id {
MCLK_SRC_INT = 0x00,
MCLK_SRC_EXT_0 = 0x01,
MCLK_SRC_MAX,
};
enum afe_mclk_freq {
MCLK_FREQ_MIN = 0,
MCLK_FREQ_11P2896_MHZ = MCLK_FREQ_MIN,
MCLK_FREQ_12P288_MHZ,
MCLK_FREQ_16P384_MHZ,
MCLK_FREQ_22P5792_MHZ,
MCLK_FREQ_24P576_MHZ,
MCLK_FREQ_MAX,
};
#define Q6AFE_EXT_MCLK_FREQ_DEFAULT 0
struct afe_audio_buffer {
dma_addr_t phys;
void *data;
@@ -510,6 +533,22 @@ enum {
AFE_LPASS_CORE_HW_VOTE_MAX
};
int afe_set_source_clk(u16 port_id, const char *clk_src);
void afe_set_clk_src_array(const char *clk_src[CLK_SRC_MAX]);
int afe_set_mclk_src_cfg(u16 port_id, uint32_t mclk_src_id, uint32_t mclk_freq);
typedef int (*afe_enable_mclk_and_get_info_cb_func) (void *private_data,
uint32_t enable, uint32_t mclk_freq,
struct afe_param_id_clock_set_v2_t *dyn_mclk_cfg);
int afe_register_ext_mclk_cb(afe_enable_mclk_and_get_info_cb_func fn1,
void *private_data);
void afe_unregister_ext_mclk_cb(void);
#define AFE_LPASS_CORE_HW_BLOCK_ID_NONE 0
#define AFE_LPASS_CORE_HW_BLOCK_ID_AVTIMER 2
#define AFE_LPASS_CORE_HW_MACRO_BLOCK 3
/* Handles audio-video timer (avtimer) and BTSC vote requests from clients.
*/
#define AFE_CMD_REMOTE_LPASS_CORE_HW_VOTE_REQUEST 0x000100f4

View File

@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
*/
#ifndef __Q6CORE_H__
@@ -428,4 +428,7 @@ int q6core_destroy_lpass_npa_client(uint32_t client_handle);
int q6core_request_island_transition(uint32_t client_handle,
uint32_t island_allow_mode);
int q6core_get_avcs_avs_build_version_info(
uint32_t *build_major_version, uint32_t *build_minor_version,
uint32_t *build_branch_version);
#endif /* __Q6CORE_H__ */

View File

@@ -35,9 +35,13 @@ ifeq ($(call is-board-platform,sdm660),true)
AUDIO_SELECT := CONFIG_SND_SOC_SDM660=m
endif
ifeq ($(call is-board-platform-in-list, msm8953 msm8937),true)
AUDIO_SELECT := CONFIG_SND_SOC_SDM450=m
endif
AUDIO_CHIPSET := audio
# Build/Package only in case of supported target
ifeq ($(call is-board-platform-in-list,msmnile $(MSMSTEPPE) $(TRINKET) kona lito bengal sdmshrike sdm660),true)
ifeq ($(call is-board-platform-in-list,msmnile $(MSMSTEPPE) $(TRINKET) kona lito bengal sdmshrike sdm660 msm8953 msm8937),true)
LOCAL_PATH := $(call my-dir)

View File

@@ -82,6 +82,21 @@ ifeq ($(KERNEL_BUILD), 0)
export
INCS += -include $(AUDIO_ROOT)/config/sdm660autoconf.h
endif
ifeq ($(CONFIG_ARCH_SDM450), y)
include $(AUDIO_ROOT)/config/sdm450auto.conf
export
INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
endif
ifeq ($(CONFIG_ARCH_SDM439), y)
include $(AUDIO_ROOT)/config/sdm450auto.conf
export
INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
endif
ifeq ($(CONFIG_ARCH_MSM8917), y)
include $(AUDIO_ROOT)/config/sdm450auto.conf
export
INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
endif
endif
# As per target team, build is done as follows:

View File

@@ -35,9 +35,13 @@ ifeq ($(call is-board-platform,sdm660),true)
AUDIO_SELECT := CONFIG_SND_SOC_SDM660=m
endif
ifeq ($(call is-board-platform-in-list,msm8953 msm8937),true)
AUDIO_SELECT := CONFIG_SND_SOC_SDM450=m
endif
AUDIO_CHIPSET := audio
# Build/Package only in case of supported target
ifeq ($(call is-board-platform-in-list,msmnile $(MSMSTEPPE) $(TRINKET) kona lito bengal sdmshrike sdm660),true)
ifeq ($(call is-board-platform-in-list,msmnile $(MSMSTEPPE) $(TRINKET) kona lito bengal sdmshrike sdm660 msm8953 msm8937),true)
LOCAL_PATH := $(call my-dir)
@@ -76,7 +80,7 @@ include $(DLKM_DIR)/AndroidKernelModule.mk
endif
endif
###########################################################
ifeq ($(call is-board-platform-in-list,$(MSMSTEPPE) $(TRINKET) kona sdm660), true)
ifeq ($(call is-board-platform-in-list,$(MSMSTEPPE) $(TRINKET) kona sdm660 msm8953 msm8937), true)
ifneq ($(TARGET_BOARD_AUTO),true)
include $(CLEAR_VARS)
LOCAL_MODULE := $(AUDIO_CHIPSET)_pinctrl_wcd.ko

View File

@@ -81,6 +81,21 @@ ifeq ($(KERNEL_BUILD), 0)
export
INCS += -include $(AUDIO_ROOT)/config/sdm660autoconf.h
endif
ifeq ($(CONFIG_ARCH_SDM450), y)
include $(AUDIO_ROOT)/config/sdm450auto.conf
export
INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
endif
ifeq ($(CONFIG_ARCH_SDM439), y)
include $(AUDIO_ROOT)/config/sdm450auto.conf
export
INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
endif
ifeq ($(CONFIG_ARCH_MSM8917), y)
include $(AUDIO_ROOT)/config/sdm450auto.conf
export
INCS += -include $(AUDIO_ROOT)/config/sdm450autoconf.h
endif
endif
# As per target team, build is done as follows:

View File

@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/gpio.h>
@@ -95,6 +96,7 @@ struct lpi_gpio_state {
char __iomem *base;
struct clk *lpass_core_hw_vote;
bool core_hw_vote_status;
struct mutex lpi_mutex;
};
static const char *const lpi_gpio_groups[] = {
@@ -120,12 +122,16 @@ static const char *const lpi_gpio_functions[] = {
static int lpi_gpio_read(struct lpi_gpio_pad *pad, unsigned int addr)
{
int ret;
struct lpi_gpio_state *state = dev_get_drvdata(lpi_dev);
mutex_lock(&state->lpi_mutex);
if (!lpi_dev_up) {
pr_err_ratelimited("%s: ADSP is down due to SSR, return\n",
__func__);
mutex_unlock(&state->lpi_mutex);
return 0;
}
pm_runtime_get_sync(lpi_dev);
ret = ioread32(pad->base + pad->offset + addr);
@@ -134,15 +140,20 @@ static int lpi_gpio_read(struct lpi_gpio_pad *pad, unsigned int addr)
pm_runtime_mark_last_busy(lpi_dev);
pm_runtime_put_autosuspend(lpi_dev);
mutex_unlock(&state->lpi_mutex);
return ret;
}
static int lpi_gpio_write(struct lpi_gpio_pad *pad, unsigned int addr,
unsigned int val)
{
struct lpi_gpio_state *state = dev_get_drvdata(lpi_dev);
mutex_lock(&state->lpi_mutex);
if (!lpi_dev_up) {
pr_err_ratelimited("%s: ADSP is down due to SSR, return\n",
__func__);
mutex_unlock(&state->lpi_mutex);
return 0;
}
pm_runtime_get_sync(lpi_dev);
@@ -151,6 +162,7 @@ static int lpi_gpio_write(struct lpi_gpio_pad *pad, unsigned int addr,
pm_runtime_mark_last_busy(lpi_dev);
pm_runtime_put_autosuspend(lpi_dev);
mutex_unlock(&state->lpi_mutex);
return 0;
}
@@ -213,12 +225,14 @@ static int lpi_gpio_set_mux(struct pinctrl_dev *pctldev, unsigned int function,
pad = pctldev->desc->pins[pin].drv_data;
pad->function = function;
if (pad != NULL) {
pad->function = function;
val = lpi_gpio_read(pad, LPI_GPIO_REG_VAL_CTL);
val &= ~(LPI_GPIO_REG_FUNCTION_MASK);
val |= pad->function << LPI_GPIO_REG_FUNCTION_SHIFT;
lpi_gpio_write(pad, LPI_GPIO_REG_VAL_CTL, val);
val = lpi_gpio_read(pad, LPI_GPIO_REG_VAL_CTL);
val &= ~(LPI_GPIO_REG_FUNCTION_MASK);
val |= pad->function << LPI_GPIO_REG_FUNCTION_SHIFT;
lpi_gpio_write(pad, LPI_GPIO_REG_VAL_CTL, val);
}
return 0;
}
@@ -382,8 +396,10 @@ static int lpi_notifier_service_cb(struct notifier_block *this,
unsigned long opcode, void *ptr)
{
static bool initial_boot = true;
struct lpi_gpio_state *state = dev_get_drvdata(lpi_dev);
pr_debug("%s: Service opcode 0x%lx\n", __func__, opcode);
mutex_lock(&state->lpi_mutex);
switch (opcode) {
case AUDIO_NOTIFIER_SERVICE_DOWN:
@@ -403,6 +419,7 @@ static int lpi_notifier_service_cb(struct notifier_block *this,
default:
break;
}
mutex_unlock(&state->lpi_mutex);
return NOTIFY_OK;
}
@@ -643,6 +660,7 @@ static int lpi_pinctrl_probe(struct platform_device *pdev)
pm_runtime_use_autosuspend(&pdev->dev);
pm_runtime_set_suspended(&pdev->dev);
pm_runtime_enable(&pdev->dev);
mutex_init(&state->lpi_mutex);
return 0;
@@ -658,6 +676,7 @@ static int lpi_pinctrl_remove(struct platform_device *pdev)
{
struct lpi_gpio_state *state = platform_get_drvdata(pdev);
mutex_destroy(&state->lpi_mutex);
pm_runtime_disable(&pdev->dev);
pm_runtime_set_suspended(&pdev->dev);

View File

@@ -828,6 +828,11 @@ static int swrm_cmd_fifo_rd_cmd(struct swr_mstr_ctrl *swrm, int *cmd_data,
u32 val;
u32 retry_attempt = 0;
if (!dev_addr) {
dev_err(swrm->dev, "%s: invalid slave dev num\n", __func__);
return -EINVAL;
}
mutex_lock(&swrm->iolock);
val = swrm_get_packed_reg_val(&swrm->rcmd_id, len, dev_addr, reg_addr);
if (swrm->read) {
@@ -857,7 +862,6 @@ static int swrm_cmd_fifo_rd_cmd(struct swr_mstr_ctrl *swrm, int *cmd_data,
/* wait 500 us before retry on fifo read failure */
usleep_range(500, 505);
if (retry_attempt == (MAX_FIFO_RD_FAIL_RETRY - 1)) {
swr_master_write(swrm, SWRM_CMD_FIFO_CMD, 0x1);
swr_master_write(swrm, SWRM_CMD_FIFO_RD_CMD, val);
}
retry_attempt++;
@@ -883,6 +887,11 @@ static int swrm_cmd_fifo_wr_cmd(struct swr_mstr_ctrl *swrm, u8 cmd_data,
u32 val;
int ret = 0;
if (!dev_addr) {
dev_err(swrm->dev, "%s: invalid slave dev num\n", __func__);
return -EINVAL;
}
mutex_lock(&swrm->iolock);
if (!cmd_id)
val = swrm_get_packed_reg_val(&swrm->wcmd_id, cmd_data,
@@ -2142,7 +2151,6 @@ static irqreturn_t swr_mstr_interrupt_v2(int irq, void *dev)
dev_err(swrm->dev,
"%s: SWR write FIFO overflow fifo status %x\n",
__func__, value);
swr_master_write(swrm, SWRM_CMD_FIFO_CMD, 0x1);
break;
case SWRM_INTERRUPT_STATUS_CMD_ERROR:
value = swr_master_read(swrm, SWRM_CMD_FIFO_STATUS);
@@ -2884,6 +2892,10 @@ static int swrm_probe(struct platform_device *pdev)
dev_info(&pdev->dev,
"%s: version specified in dtsi: 0x%x not match with HW read version 0x%x\n",
__func__, swrm->version, swrm_hw_ver);
swrm->rd_fifo_depth = ((swr_master_read(swrm, SWRM_COMP_PARAMS)
& SWRM_COMP_PARAMS_RD_FIFO_DEPTH) >> 15);
swrm->wr_fifo_depth = ((swr_master_read(swrm, SWRM_COMP_PARAMS)
& SWRM_COMP_PARAMS_WR_FIFO_DEPTH) >> 10);
ret = swrm_master_init(swrm);
if (ret < 0) {
dev_err(&pdev->dev,
@@ -2900,11 +2912,6 @@ static int swrm_probe(struct platform_device *pdev)
if (pdev->dev.of_node)
of_register_swr_devices(&swrm->master);
swrm->rd_fifo_depth = ((swr_master_read(swrm, SWRM_COMP_PARAMS)
& SWRM_COMP_PARAMS_RD_FIFO_DEPTH) >> 15);
swrm->wr_fifo_depth = ((swr_master_read(swrm, SWRM_COMP_PARAMS)
& SWRM_COMP_PARAMS_WR_FIFO_DEPTH) >> 10);
#ifdef CONFIG_DEBUG_FS
swrm->debugfs_swrm_dent = debugfs_create_dir(dev_name(&pdev->dev), 0);
if (!IS_ERR(swrm->debugfs_swrm_dent)) {
@@ -3161,6 +3168,7 @@ static int swrm_runtime_suspend(struct device *dev)
struct swr_master *mstr = &swrm->master;
struct swr_device *swr_dev;
int current_state = 0;
struct irq_data *irq_data = NULL;
trace_printk("%s: pm_runtime: suspend state: %d\n",
__func__, swrm->state);
@@ -3269,7 +3277,9 @@ static int swrm_runtime_suspend(struct device *dev)
if (swrm->clk_stop_mode0_supp) {
if (swrm->wake_irq > 0) {
enable_irq(swrm->wake_irq);
irq_data = irq_get_irq_data(swrm->wake_irq);
if (irq_data && irqd_irq_disabled(irq_data))
enable_irq(swrm->wake_irq);
} else if (swrm->ipc_wakeup) {
msm_aud_evt_blocking_notifier_call_chain(
SWR_WAKE_IRQ_REGISTER, (void *)swrm);