Merge tag 'LA.UM.9.14.r1-19500-LAHAINA.QSSI12.0' of https://git.codelinaro.org/clo/la/platform/vendor/opensource/audio-kernel into android12-5.4-lahaina

"LA.UM.9.14.r1-19500-LAHAINA.QSSI12.0"

* tag 'LA.UM.9.14.r1-19500-LAHAINA.QSSI12.0' of https://git.codelinaro.org/clo/la/platform/vendor/opensource/audio-kernel:
  ASoC: optimize automotive routing drivers
  ASOC: automotive routing drivers base version
  Revert "ASOC: Disable Temperature sensor of WSA881x for bengal"
  asoc: add afe limiter disable kcontrol and fix ULLPP index mismatch
  asoc: codec: Fix error  makefile: Fix error and add version information
  ASOC: talos: update dai-link port-config for talos
  ASoC: wcd937x: Update QCRG sequence for wcd937x
  dsp: lower the log lever of ADSP_EALREADY
  dsp: Remove error log when there is no AFE cal data
  asoc: reduce HS TDM widget connection when it's disabled
  soc: remove tdm slot mask invalid err log in multi lane case
  asoc: Add VI feedback dai_link for bengal
  asoc: msm: Add VI feedback mixer
  asoc: wsa881x: Add mixer for speaker protection
  ASOC: update sm6150 machine driver
  asoc: wcd937x: update mic bias registers for new fab
  ASOC: talos: update dai-link port-config for talos
  asoc: codec: Fix CFI error caused by missing members
  ASOC: update wcd934x codec driver
  ASOC: update sm6150 machine driver
  ASoC: wcd-spi: Fix dma alloc compilation errors
  makefile: add config support for audio techpack for QCS610
  ASoC: codecs: wsa881x: add codec dai for each wsa881x
  soc: swr-mstr-ctrl: Fix SWR cmd FIFO overflow error
  ASOC: ext-clk: Fix hw init issue caused by CLK upgrade
  asoc: Set clock index correctly in mi2s slave mode
  asoc:msm-lsm-client: potential deadlock fix
  ASoC: msm: support multi group matrix mixer configure for SSMD mode
  msm-audio: adding mixer control for soft step volume params
  dsp: support ADM output map for less then 2 channels
  asoc: Enable all LPAIF interface
  asoc: afe: Add afe dyn mclk kcontrol
  ASOC: Disable Temperature sensor of WSA881x for bengal
  asoc: refine dummy machine driver for gen3
  ASoC: msm: extend app type cfg mixer command with copp mode
  ASoC: bitra: Add support for VI sense backend
  asoc: copyright fix
  ASoC : add support for MultiMedia17
  dsp: Update adsp packet timeout in voice drv
  ASoC: Unmap lab buffer during listen session close
  audio-kernel: change the maxnum for stream in QACT
  asoc: set default value for port_id of logging kcontrol
  ASoc: bolero: update logic to disable VA_MCLK
  ASoC: bolero: Disable va_swr gpio on clk failure
  dsp: add new boot cmd for early audio
  ARM: dts: msm: Change default state to sleep
  audio-kernel: lvgvm 8295 related file modify
  asoc: bengal: fix dailink init error
  asoc: msm_stub: increase the max ch to 32
  asoc: QUAT TDM support for dummy machine driver
  dsp: Make synchronous call to unmap afe cal data
  dsp:q6afe: Fix avcs load module failure for aptx
  ASoC: msm: Fix ASRC port type mismatch
  soc: add snd_event_init func for mark audio KPI
  ASoC: wcd937x: Update EAR PA CnP FSM sequence
  asoc: fix error for VA_CDC_DMA_TX_0 for bengal
  asoc: codec: enable use_single_read for wsa and wcd regmap
  config: sa8155/sa6155/gvmq: remove unused config vars
  asoc: fix compile warning of format-extra-args
  soc: swr-mstr-ctrl: Move to CPU-1 FIFO for swr register read/write
  ipc: apr_vm: change the priority of apr_vm_cb_threa
  asoc: get and put for TERT_TDM_TX_0 ADM channels
  dsp: Reslove audiodlkm code warning
  asoc: Reslove audiodlkm error & warn & issues
  asoc: add drift support for mi2s interface
  ASoC: add LXC audio config for auto sa8295 platform
  asoc: enable mclk1 for audio bring up
  ASoC: wsa883x: Enable all WSA interrupts
  asoc: wsa883x: add slave_irq for wsa883x
  asoc: wsa883x: update irq_drv_data per wsa device
  ASoC: mbhc-adc: Prevent lineout from being reported two times
  ASoC: Lahaina: correction to CPS payload
  ASoC: wcd937x: Add change for LDOL VOUT accuracy calibration
  ASoC: wcd937x: Update register value for new fab id for tanggu
  ASoC: wcd937x: Add change to micbias reg for new tanggu fab id
  Revert "ASoC: wsa883x: Add check before enable/disable PDM WD irq"
  ASoC: Add proper routing for vi ch and cdc dma format widgets
  asoc: set min period size of capture/playback to 120
  dsp: bugfix for memory leak in error handling path
  config: fix compile issue
  asoc: Update the dai link IDs for MI2S dai links
  ASoC: msm-dai-q6-v2: Add separate cpu dais for mi2s rx and tx

Change-Id: I0d9cf31f1ef60c754451ef86589cf91d29f8d682
This commit is contained in:
Michael Bestas 2022-05-19 00:36:17 +03:00
commit 83c681228b
No known key found for this signature in database
GPG key ID: CC95044519BE6669
75 changed files with 38500 additions and 1870 deletions

View file

@ -30,6 +30,9 @@ endif
ifeq ($(CONFIG_ARCH_SA6155), y)
include $(srctree)/techpack/audio/config/sa6155auto.conf
endif
ifeq ($(CONFIG_ARCH_SM6150), y)
include $(srctree)/techpack/audio/config/sm6150auto.conf
endif
endif
# Use USERINCLUDE when you must reference the UAPI directories only.
USERINCLUDE += \
@ -79,7 +82,10 @@ ifeq ($(CONFIG_ARCH_SA6155), y)
LINUXINCLUDE += \
-include $(srctree)/techpack/audio/config/sa6155autoconf.h
endif
ifeq ($(CONFIG_ARCH_SM6150), y)
LINUXINCLUDE += \
-include $(srctree)/techpack/audio/config/sm6150autoconf.h
endif
obj-y += soc/
obj-y += dsp/
obj-y += ipc/

View file

@ -26,6 +26,7 @@ obj-m += asoc/
obj-m += asoc/codecs/
ifeq ($(TARGET_SUPPORT), $(filter $(TARGET_SUPPORT), sdmsteppe))
obj-m += asoc/codecs/wcd934x/
KBUILD_CFLAGS += -Wno-error
endif
ifeq ($(TARGET_SUPPORT), $(filter $(TARGET_SUPPORT), qcs40x))
obj-m += asoc/codecs/bolero/
@ -43,20 +44,20 @@ obj-m += asoc/codecs/bolero/
obj-m += asoc/codecs/wcd937x/
endif
ifeq ($(TARGET_SUPPORT), $(filter $(TARGET_SUPPORT), sa8155 sa8155ivi sa6155 sa8195 qtiquingvm qtiquingvm8295))
ifeq ($(TARGET_SUPPORT), $(filter $(TARGET_SUPPORT), sa8155 sa8155ivi sa6155 sa8195 qtiquingvm qtiquingvm8295 sa8295 qtigvmi3))
KBUILD_OPTIONS += CONFIG_SND_SOC_AUTO=y
obj-m := ipc/
obj-m += dsp/
obj-m += asoc/
obj-m += asoc/codecs/
obj-m += soc/
ifeq ($(TARGET_SUPPORT), $(filter $(TARGET_SUPPORT), sa8155 sa8155ivi sa8195))
ifeq ($(TARGET_SUPPORT), $(filter $(TARGET_SUPPORT), sa8155 sa8155ivi sa8195 sa8295))
KBUILD_OPTIONS += CONFIG_SND_SOC_SA8155=m
endif
ifeq ($(TARGET_SUPPORT), $(filter $(TARGET_SUPPORT), sa6155))
KBUILD_OPTIONS += CONFIG_SND_SOC_SA6155=m
endif
ifeq ($(TARGET_SUPPORT), $(filter $(TARGET_SUPPORT), qtiquingvm))
ifeq ($(TARGET_SUPPORT), $(filter $(TARGET_SUPPORT), qtiquingvm qtigvmi3))
KBUILD_OPTIONS += CONFIG_SND_SOC_GVM=m
endif
ifeq ($(TARGET_SUPPORT), $(filter $(TARGET_SUPPORT), qtiquingvm8295))

View file

@ -136,7 +136,6 @@ endif
# for SM6150 sound card driver
ifdef CONFIG_SND_SOC_SM6150
MACHINE_OBJS += sm6150.o
MACHINE_OBJS += machine_615x_init.o
endif
# For sa6155 sound card driver
@ -211,11 +210,19 @@ ifdef CONFIG_SND_SOC_QDSP6V2
PLATFORM_OBJS += msm-pcm-loopback-v2.o
PLATFORM_OBJS += msm-pcm-q6-noirq.o
PLATFORM_OBJS += msm-pcm-q6-v2.o
PLATFORM_OBJS += msm-pcm-routing-v2.o
PLATFORM_OBJS += msm-pcm-voice-v2.o
PLATFORM_OBJS += msm-pcm-voip-v2.o
ifeq (y,$(findstring y,$(CONFIG_QTI_QUIN_GVM) $(CONFIG_PLATFORM_AUTO)))
PLATFORM_OBJS += msm-pcm-routing-auto.o
else
PLATFORM_OBJS += msm-pcm-routing-v2.o
PLATFORM_OBJS += msm-pcm-voice-v2.o
PLATFORM_OBJS += msm-pcm-voip-v2.o
endif
PLATFORM_OBJS += msm-transcode-loopback-q6-v2.o
PLATFORM_OBJS += platform_init.o
ifeq (y,$(findstring y,$(CONFIG_QTI_QUIN_GVM) $(CONFIG_PLATFORM_AUTO)))
PLATFORM_OBJS += platform_init_auto.o
else
PLATFORM_OBJS += platform_init.o
endif
endif
ifdef CONFIG_WCD9XXX_CODEC_CORE
PLATFORM_OBJS += msm-dai-slim.o

99
techpack/audio/asoc/bengal.c Normal file → Executable file
View file

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/clk.h>
@ -557,6 +558,7 @@ static void *def_wcd_mbhc_cal(void);
static void *def_rouleur_mbhc_cal(void);
static int msm_int_audrx_init(struct snd_soc_pcm_runtime*);
static int msm_aux_codec_init(struct snd_soc_pcm_runtime*);
/*
* Need to report LINEIN
@ -930,8 +932,6 @@ static int usb_audio_tx_format_get(struct snd_kcontrol *kcontrol,
static int usb_audio_tx_format_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
int rc = 0;
switch (ucontrol->value.integer.value[0]) {
case 3:
usb_tx_cfg.bit_format = SNDRV_PCM_FORMAT_S32_LE;
@ -951,7 +951,7 @@ static int usb_audio_tx_format_put(struct snd_kcontrol *kcontrol,
__func__, usb_tx_cfg.bit_format,
ucontrol->value.integer.value[0]);
return rc;
return 0;
}
static int usb_audio_rx_ch_get(struct snd_kcontrol *kcontrol,
@ -2098,7 +2098,8 @@ static int msm_mi2s_set_sclk(struct snd_pcm_substream *substream, bool enable)
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int port_id = 0;
int index = cpu_dai->id;
/* Rx and Tx DAIs should use same clk index */
int index = (cpu_dai->id) / 2;
port_id = msm_get_port_id(rtd->dai_link->id);
if (port_id < 0) {
@ -3931,7 +3932,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
int ret = 0;
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int index = cpu_dai->id;
/* Rx and Tx DAIs should use same clk index */
int index = (cpu_dai->id) / 2;
unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS;
struct snd_soc_card *card = rtd->card;
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
@ -3956,10 +3958,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
mutex_lock(&mi2s_intf_conf[index].lock);
if (++mi2s_intf_conf[index].ref_cnt == 1) {
/* Check if msm needs to provide the clock to the interface */
if (!mi2s_intf_conf[index].msm_is_mi2s_master) {
if (!mi2s_intf_conf[index].msm_is_mi2s_master)
mi2s_clk[index].clk_id = mi2s_ebit_clk[index];
fmt = SND_SOC_DAIFMT_CBM_CFM;
}
ret = msm_mi2s_set_sclk(substream, true);
if (ret < 0) {
dev_err(rtd->card->dev,
@ -3968,12 +3968,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
goto clean_up;
}
ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
if (ret < 0) {
pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n",
__func__, index, ret);
goto clk_off;
}
if (pdata->mi2s_gpio_p[index]) {
if (atomic_read(&(pdata->mi2s_gpio_ref_count[index]))
== 0) {
@ -3988,6 +3982,14 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
atomic_inc(&(pdata->mi2s_gpio_ref_count[index]));
}
}
if (!mi2s_intf_conf[index].msm_is_mi2s_master)
fmt = SND_SOC_DAIFMT_CBM_CFM;
ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
if (ret < 0) {
pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n",
__func__, index, ret);
goto clk_off;
}
clk_off:
if (ret < 0)
msm_mi2s_set_sclk(substream, false);
@ -4003,7 +4005,8 @@ static void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream)
{
int ret = 0;
struct snd_soc_pcm_runtime *rtd = substream->private_data;
int index = rtd->cpu_dai->id;
/* Rx and Tx DAIs should use same clk index */
int index = (rtd->cpu_dai->id) / 2;
struct snd_soc_card *card = rtd->card;
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
@ -4259,25 +4262,19 @@ static void msm_add_auxpcm_snd_controls(struct snd_soc_component *component)
static int msm_int_audrx_init(struct snd_soc_pcm_runtime *rtd)
{
int ret = -EINVAL;
struct snd_soc_component *component;
struct snd_soc_component *bolero_component = NULL;
struct snd_soc_dapm_context *dapm;
struct snd_card *card;
struct snd_info_entry *entry;
struct platform_device *pdev = NULL;
int i = 0;
char *data = NULL;
struct snd_soc_component *component = NULL;
struct snd_soc_dapm_context *dapm = NULL;
struct snd_card *card = NULL;
struct snd_info_entry *entry = NULL;
struct msm_asoc_mach_data *pdata =
snd_soc_card_get_drvdata(rtd->card);
int ret = -EINVAL;
component = snd_soc_rtdcom_lookup(rtd, "bolero_codec");
if (!component) {
pr_err("%s: could not find component for bolero_codec\n",
__func__);
return ret;
} else {
bolero_component = component;
}
dapm = snd_soc_component_get_dapm(component);
@ -4332,6 +4329,29 @@ static int msm_int_audrx_init(struct snd_soc_pcm_runtime *rtd)
bolero_info_create_codec_entry(pdata->codec_root, component);
bolero_register_wake_irq(component, false);
err:
return ret;
}
static int msm_aux_codec_init(struct snd_soc_pcm_runtime *rtd)
{
int ret = -EINVAL;
struct snd_soc_component *component = NULL;
struct snd_soc_component *bolero_component = NULL;
struct snd_soc_dapm_context *dapm = NULL;
struct snd_card *card = NULL;
struct snd_info_entry *entry;
char *data = NULL;
struct msm_asoc_mach_data *pdata =
snd_soc_card_get_drvdata(rtd->card);
bolero_component = snd_soc_rtdcom_lookup(rtd, "bolero_codec");
if (!bolero_component) {
pr_err("%s: could not find component for bolero_codec\n",
__func__);
return -EINVAL;
}
component = snd_soc_rtdcom_lookup(rtd, ROULEUR_DRV_NAME);
if (!component)
component = snd_soc_rtdcom_lookup(rtd, WCD937X_DRV_NAME);
@ -4355,6 +4375,18 @@ static int msm_int_audrx_init(struct snd_soc_pcm_runtime *rtd)
snd_soc_dapm_ignore_suspend(dapm, "AMIC4");
snd_soc_dapm_sync(dapm);
if (!pdata->codec_root) {
entry = msm_snd_info_create_subdir(card->module, "codecs",
card->proc_root);
if (!entry) {
dev_dbg(component->dev, "%s: Cannot create codecs module entry\n",
__func__);
ret = 0;
goto err;
}
pdata->codec_root = entry;
}
if (wcd_datalane_mismatch) {
bolero_set_port_map(component,
ARRAY_SIZE(sm_port_map_khaje),
@ -4951,6 +4983,17 @@ static struct snd_soc_dai_link msm_common_misc_fe_dai_links[] = {
.ops = &msm_cdc_dma_be_ops,
SND_SOC_DAILINK_REG(tx_cdcdma5_tx),
},
{/* hw:x,39 */
.name = "TX4_CDC_DMA Hostless",
.stream_name = "TX4_CDC_DMA Hostless",
.dynamic = 1,
.dpcm_capture = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
.ignore_suspend = 1,
SND_SOC_DAILINK_REG(tx4_cdcdma_hostless),
},
};
static struct snd_soc_dai_link msm_common_be_dai_links[] = {
@ -5391,7 +5434,7 @@ static struct snd_soc_dai_link msm_rx_tx_cdc_dma_be_dai_links[] = {
.ignore_suspend = 1,
.ops = &msm_cdc_dma_be_ops,
SND_SOC_DAILINK_REG(rx_dma_rx0),
.init = &msm_int_audrx_init,
.init = &msm_aux_codec_init,
},
{
.name = LPASS_BE_RX_CDC_DMA_RX_1,
@ -5469,12 +5512,12 @@ static struct snd_soc_dai_link msm_va_cdc_dma_be_dai_links[] = {
.stream_name = "VA CDC DMA0 Capture",
.no_pcm = 1,
.dpcm_capture = 1,
.init = &msm_int_audrx_init,
.id = MSM_BACKEND_DAI_VA_CDC_DMA_TX_0,
.be_hw_params_fixup = msm_be_hw_params_fixup,
.ignore_suspend = 1,
.ops = &msm_cdc_dma_be_ops,
SND_SOC_DAILINK_REG(va_dma_tx0),
.init = &msm_int_audrx_init,
},
{
.name = LPASS_BE_VA_CDC_DMA_TX_1,

View file

@ -147,6 +147,7 @@ ifdef CONFIG_WCD9XXX_CODEC_CORE
WCD9XXX_OBJS += wcd9xxx-resmgr-v2.o
WCD9XXX_OBJS += wcd-dsp-utils.o
WCD9XXX_OBJS += wcd-dsp-mgr.o
WCD9XXX_OBJS += wcd-clsh.o
else
WCD9XXX_OBJS += wcd-clsh.o
endif

View file

@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/kernel.h>
@ -58,6 +59,8 @@ struct audio_ext_clk_priv {
uint32_t lpass_audio_hwvote_client_handle;
};
static struct audio_ext_clk audio_clk_array[];
static inline struct audio_ext_clk_priv *to_audio_clk(struct clk_hw *hw)
{
return container_of(hw, struct audio_ext_clk_priv, audio_clk.fact.hw);
@ -137,8 +140,8 @@ static u8 audio_ext_clk_get_parent(struct clk_hw *hw)
{
struct audio_ext_clk_priv *clk_priv = to_audio_clk(hw);
int num_parents = clk_hw_get_num_parents(hw);
const char * const *parent_names = hw->init->parent_names;
u8 i = 0, ret = hw->init->num_parents + 1;
const char * const *parent_names = audio_clk_array[clk_priv->clk_src].fact.hw.init->parent_names;
u8 i = 0, ret = num_parents + 1;
if ((clk_priv->clk_src == AUDIO_EXT_CLK_PMI) && clk_priv->clk_name) {
for (i = 0; i < num_parents; i++) {

View file

@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/module.h>
@ -184,6 +185,7 @@ struct va_macro_priv {
int dec_mode[VA_MACRO_NUM_DECIMATORS];
u16 current_clk_id;
int pcm_rate[VA_MACRO_NUM_DECIMATORS];
bool dev_up;
};
static bool va_macro_get_data(struct snd_soc_component *component,
@ -329,6 +331,7 @@ static int va_macro_event_handler(struct snd_soc_component *component,
trace_printk("%s, enter SSR up\n", __func__);
/* reset swr after ssr/pdr */
va_priv->reset_swr = true;
va_priv->dev_up = true;
if (va_priv->swr_ctrl_data)
swrm_wcd_notify(
va_priv->swr_ctrl_data[0].va_swr_pdev,
@ -338,6 +341,8 @@ static int va_macro_event_handler(struct snd_soc_component *component,
bolero_rsc_clk_reset(va_dev, VA_CORE_CLK);
break;
case BOLERO_MACRO_EVT_SSR_DOWN:
trace_printk("%s: BOLERO_MACRO_EVT_SSR_DOWN\n", __func__);
va_priv->dev_up = false;
if (va_priv->swr_ctrl_data) {
swrm_wcd_notify(
va_priv->swr_ctrl_data[0].va_swr_pdev,
@ -441,9 +446,7 @@ static int va_macro_swr_pwr_event_v2(struct snd_soc_dapm_widget *w,
}
break;
case SND_SOC_DAPM_POST_PMD:
if (va_priv->current_clk_id == VA_CORE_CLK &&
va_priv->va_swr_clk_cnt != 0 &&
va_priv->tx_clk_status) {
if (va_priv->current_clk_id == VA_CORE_CLK) {
ret = bolero_clk_rsc_request_clock(va_priv->dev,
va_priv->default_clk_id,
TX_CORE_CLK,
@ -452,7 +455,8 @@ static int va_macro_swr_pwr_event_v2(struct snd_soc_dapm_widget *w,
dev_dbg(component->dev,
"%s: request clock TX_CLK disable failed\n",
__func__);
break;
if (va_priv->dev_up)
break;
}
ret = bolero_clk_rsc_request_clock(va_priv->dev,
va_priv->default_clk_id,
@ -462,10 +466,11 @@ static int va_macro_swr_pwr_event_v2(struct snd_soc_dapm_widget *w,
dev_dbg(component->dev,
"%s: request clock VA_CLK disable failed\n",
__func__);
bolero_clk_rsc_request_clock(va_priv->dev,
TX_CORE_CLK,
TX_CORE_CLK,
false);
if (va_priv->dev_up)
bolero_clk_rsc_request_clock(va_priv->dev,
TX_CORE_CLK,
TX_CORE_CLK,
false);
break;
}
va_priv->current_clk_id = TX_CORE_CLK;
@ -704,6 +709,10 @@ static int va_macro_tx_va_mclk_enable(struct va_macro_priv *va_priv,
TX_CORE_CLK,
false);
if (ret < 0) {
if (va_priv->swr_clk_users == 0) {
msm_cdc_pinctrl_select_sleep_state(
va_priv->va_swr_gpio_p);
}
dev_err_ratelimited(va_priv->dev,
"%s: swr request clk failed\n",
__func__);
@ -2839,6 +2848,8 @@ static int va_macro_init(struct snd_soc_component *component)
}
snd_soc_dapm_sync(dapm);
va_priv->dev_up = true;
for (i = 0; i < VA_MACRO_NUM_DECIMATORS; i++) {
va_priv->va_hpf_work[i].va_priv = va_priv;
va_priv->va_hpf_work[i].decimator = i;

View file

@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2011-2014, 2017-2019 The Linux Foundation. All rights reserved.
* Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/platform_device.h>
#include <linux/slab.h>
@ -18,7 +19,7 @@ static struct snd_soc_dai_driver msm_stub_dais[] = {
.playback = { /* Support maximum range */
.stream_name = "Playback",
.channels_min = 1,
.channels_max = 8,
.channels_max = 32,
.rates = SNDRV_PCM_RATE_8000_48000,
.formats = SNDRV_PCM_FMTBIT_S16_LE,
},
@ -28,7 +29,7 @@ static struct snd_soc_dai_driver msm_stub_dais[] = {
.capture = { /* Support maximum range */
.stream_name = "Record",
.channels_min = 1,
.channels_max = 8,
.channels_max = 32,
.rates = SNDRV_PCM_RATE_8000_48000,
.formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE),

View file

@ -453,7 +453,8 @@ static bool wcd_mbhc_adc_check_for_spl_headset(struct wcd_mbhc *mbhc,
adc_hph_threshold = wcd_mbhc_adc_get_hph_thres(mbhc);
if (output_mv > adc_threshold || output_mv < adc_hph_threshold) {
spl_hs = false;
if (mbhc->force_linein == true)
spl_hs = false;
} else {
spl_hs = true;
if (spl_hs_cnt)
@ -515,9 +516,12 @@ static bool wcd_is_special_headset(struct wcd_mbhc *mbhc)
msleep(50);
output_mv = wcd_measure_adc_once(mbhc, MUX_CTL_IN2P);
if (output_mv <= adc_threshold) {
pr_debug("%s: Special headset detected in %d msecs\n",
__func__, delay);
is_spl_hs = true;
if (mbhc->force_linein != true) {
pr_debug(
"%s: Special headset detected in %d msecs\n",
__func__, delay);
is_spl_hs = true;
}
}
if (delay == SPECIAL_HS_DETECT_TIME_MS) {
@ -831,7 +835,7 @@ correct_plug_type:
}
}
if (output_mv > hs_threshold) {
if (output_mv > hs_threshold || mbhc->force_linein == true) {
pr_debug("%s: cable is extension cable\n", __func__);
plug_type = MBHC_PLUG_TYPE_HIGH_HPH;
wrk_complete = true;

View file

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/init.h>
@ -1478,7 +1479,7 @@ static int wcd_spi_component_bind(struct device *dev,
spi_message_add_tail(&wcd_spi->xfer2[1], &wcd_spi->msg2);
/* Pre-allocate the buffers */
wcd_spi->tx_buf = dma_zalloc_coherent(&spi->dev,
wcd_spi->tx_buf = dma_alloc_coherent(&spi->dev,
WCD_SPI_RW_MAX_BUF_SIZE,
&wcd_spi->tx_dma, GFP_KERNEL);
if (!wcd_spi->tx_buf) {
@ -1486,7 +1487,7 @@ static int wcd_spi_component_bind(struct device *dev,
goto done;
}
wcd_spi->rx_buf = dma_zalloc_coherent(&spi->dev,
wcd_spi->rx_buf = dma_alloc_coherent(&spi->dev,
WCD_SPI_RW_MAX_BUF_SIZE,
&wcd_spi->rx_dma, GFP_KERNEL);
if (!wcd_spi->rx_buf) {

View file

@ -1,13 +1,14 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2015-2018, 2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/regmap.h>
#include <linux/device.h>
#include <asoc/core.h>
#include <asoc/wcd9xxx-regmap.h>
#include <wcd9335_registers.h>
#include "wcd9335_registers.h"
static const struct reg_sequence wcd9335_1_x_defaults[] = {
{ WCD9335_CODEC_RPM_CLK_GATE, 0x03, 0x00 },

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2018, 2021, The Linux Foundation. All rights reserved.
*/
#include <linux/regmap.h>
@ -1832,6 +1832,8 @@ int wcd934x_regmap_register_patch(struct regmap *regmap, int revision)
ARRAY_SIZE(wcd934x_1_1_defaults));
regcache_cache_only(regmap, false);
break;
default:
break;
}
return rc;

View file

@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/module.h>
#include <linux/init.h>
@ -21,6 +22,7 @@
#include <linux/spi/spi.h>
#include <linux/regulator/consumer.h>
#include <audio/linux/mfd/wcd9xxx/wcd9xxx_registers.h>
#include <soc/swr-common.h>
#include <soc/swr-wcd.h>
#include <soc/snd_event.h>
#include <sound/pcm.h>
@ -500,6 +502,7 @@ struct wcd_swr_ctrl_platform_data {
int (*write)(void *handle, int reg, int val);
int (*bulk_write)(void *handle, u32 *reg, u32 *val, size_t len);
int (*clk)(void *handle, bool enable);
int (*core_vote)(void *handle, bool enable);
int (*handle_irq)(void *handle,
irqreturn_t (*swrm_irq_handler)(int irq, void *data),
void *swrm_handle, int action);
@ -748,6 +751,34 @@ void *tavil_get_afe_config(struct snd_soc_component *component,
}
EXPORT_SYMBOL(tavil_get_afe_config);
int tavil_set_port_map(struct snd_soc_component *component,
u32 size, void *data)
{
struct swr_mstr_port_map *map = NULL;
struct swrm_port_config port_cfg;
struct tavil_priv *priv = NULL;
if (!component || (size == 0) || !data)
return -EINVAL;
priv = snd_soc_component_get_drvdata(component);
map = (struct swr_mstr_port_map *)data;
port_cfg.uc = map->uc;
port_cfg.size = SWR_MSTR_PORT_LEN;
port_cfg.params = map->swr_port_params;
swrm_wcd_notify(
priv->swr.ctrl_data[0].swr_pdev,
SWR_SET_PORT_MAP, &port_cfg);
return 0;
}
EXPORT_SYMBOL(tavil_set_port_map);
static bool is_tavil_playback_dai(int dai_id)
{
if ((dai_id == AIF1_PB) || (dai_id == AIF2_PB) ||
@ -11345,6 +11376,7 @@ static int tavil_probe(struct platform_device *pdev)
tavil->swr.plat_data.bulk_write = tavil_swrm_bulk_write;
tavil->swr.plat_data.clk = tavil_swrm_clock;
tavil->swr.plat_data.handle_irq = tavil_swrm_handle_irq;
tavil->swr.plat_data.core_vote = NULL;
tavil->swr.spkr_gain_offset = WCD934X_RX_GAIN_OFFSET_0_DB;
/* Register for Clock */

View file

@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef WCD934X_H
#define WCD934X_H
@ -129,6 +130,8 @@ struct tavil_reg_mask_val {
#if IS_ENABLED(CONFIG_SND_SOC_WCD934X)
extern void *tavil_get_afe_config(struct snd_soc_component *component,
enum afe_config_type config_type);
extern int tavil_set_port_map(struct snd_soc_component *component,
u32 size, void *data);
extern int tavil_cdc_mclk_enable(struct snd_soc_component *component,
bool enable);
extern int tavil_cdc_mclk_tx_enable(struct snd_soc_component *component,
@ -159,6 +162,11 @@ extern void *tavil_get_afe_config(struct snd_soc_component *component,
{
return NULL;
}
extern int tavil_set_port_map(struct snd_soc_component *component,
u32 size, void *data)
{
return 0;
}
extern int tavil_cdc_mclk_enable(struct snd_soc_component *component,
bool enable)
{

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2018-2019, 2021, The Linux Foundation. All rights reserved.
*/
#include <linux/regmap.h>
@ -461,4 +461,5 @@ struct regmap_config wcd937x_regmap_config = {
.writeable_reg = wcd937x_writeable_register,
.volatile_reg = wcd937x_volatile_register,
.can_multi_write = true,
.use_single_read = true,
};

View file

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/module.h>
@ -150,8 +151,18 @@ 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);
@ -178,6 +189,12 @@ 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) {
@ -189,6 +206,10 @@ static int wcd937x_init_reg(struct snd_soc_component *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;
}
@ -482,6 +503,11 @@ 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) &&
hph_mode == CLS_H_ULP)
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,
@ -523,6 +549,11 @@ 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) &&
hph_mode == CLS_H_ULP)
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);
@ -556,6 +587,11 @@ 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) &&
hph_mode == CLS_H_ULP)
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,
@ -597,6 +633,11 @@ 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) &&
hph_mode == CLS_H_ULP)
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);
@ -1041,6 +1082,22 @@ static int wcd937x_codec_enable_ear_pa(struct snd_soc_dapm_widget *w,
snd_soc_component_update_bits(component,
WCD937X_DIGITAL_PDM_WD_CTL0,
0x17, 0x00);
usleep_range(10000, 10010);
/* disable EAR CnP FSM */
snd_soc_component_update_bits(component,
WCD937X_EAR_EAR_EN_REG,
0x02, 0x00);
/* toggle EAR PA to let PA control registers take effect */
snd_soc_component_update_bits(component,
WCD937X_ANA_EAR,
0x80, 0x80);
snd_soc_component_update_bits(component,
WCD937X_ANA_EAR,
0x80, 0x00);
/* enable EAR CnP FSM */
snd_soc_component_update_bits(component,
WCD937X_EAR_EAR_EN_REG,
0x02, 0x02);
break;
};
return ret;

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2018-2019, 2021, The Linux Foundation. All rights reserved.
*/
#include <linux/regmap.h>
@ -512,4 +512,5 @@ struct regmap_config wcd938x_regmap_config = {
.writeable_reg = wcd938x_writeable_register,
.volatile_reg = wcd938x_volatile_register,
.can_multi_write = true,
.use_single_read = true,
};

View file

@ -638,9 +638,9 @@ err:
wcd9xxx_bringdown(wcd9xxx->dev);
wcd9xxx_core_res_deinit(&wcd9xxx->core_res);
err_bring_up:
mutex_destroy(&wcd9xxx->io_lock);
mutex_destroy(&wcd9xxx->xfer_lock);
mutex_destroy(&wcd9xxx->reset_lock);
mutex_destroy(&wcd9xxx->xfer_lock);
mutex_destroy(&wcd9xxx->io_lock);
return ret;
}

View file

@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2014-2020, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/module.h>
@ -756,7 +756,7 @@ static unsigned int wcd_cpe_state_poll(struct snd_info_entry *entry,
*/
static bool wcd_cpe_is_online_state(void *core_handle)
{
struct wcd_cpe_core *core = core_handle;
struct wcd_cpe_core *core = (struct wcd_cpe_core *)core_handle;
if (core_handle) {
return !core->ssr_entry.offline;
@ -1098,7 +1098,7 @@ err_ret:
int wcd_cpe_ssr_event(void *core_handle,
enum wcd_cpe_ssr_state_event event)
{
struct wcd_cpe_core *core = core_handle;
struct wcd_cpe_core *core = (struct wcd_cpe_core *)core_handle;
if (!core) {
pr_err("%s: Invalid handle to core\n",
@ -2169,7 +2169,7 @@ static int wcd_cpe_cmi_send_lsm_msg(
void *message)
{
int ret = 0;
struct cmi_hdr *hdr = message;
struct cmi_hdr *hdr = (struct cmi_hdr *)message;
pr_debug("%s: sending message with opcode 0x%x\n",
__func__, hdr->opcode);
@ -2413,7 +2413,7 @@ static int wcd_cpe_cmd_lsm_open_tx(void *core_handle,
u16 app_id, u16 sample_rate)
{
struct cpe_lsm_cmd_open_tx cmd_open_tx;
struct wcd_cpe_core *core = core_handle;
struct wcd_cpe_core *core = (struct wcd_cpe_core *)core_handle;
int ret = 0;
ret = wcd_cpe_is_valid_lsm_session(core, session,
@ -2462,7 +2462,7 @@ static int wcd_cpe_cmd_lsm_close_tx(void *core_handle,
struct cpe_lsm_session *session)
{
struct cmi_hdr cmd_close_tx;
struct wcd_cpe_core *core = core_handle;
struct wcd_cpe_core *core = (struct wcd_cpe_core *)core_handle;
int ret = 0;
ret = wcd_cpe_is_valid_lsm_session(core, session,
@ -2503,7 +2503,7 @@ static int wcd_cpe_cmd_lsm_shmem_alloc(void *core_handle,
u32 size)
{
struct cpe_cmd_shmem_alloc cmd_shmem_alloc;
struct wcd_cpe_core *core = core_handle;
struct wcd_cpe_core *core = (struct wcd_cpe_core *)core_handle;
int ret = 0;
ret = wcd_cpe_is_valid_lsm_session(core, session,
@ -2542,7 +2542,7 @@ static int wcd_cpe_cmd_lsm_shmem_dealloc(void *core_handle,
struct cpe_lsm_session *session)
{
struct cpe_cmd_shmem_dealloc cmd_dealloc;
struct wcd_cpe_core *core = core_handle;
struct wcd_cpe_core *core = (struct wcd_cpe_core *)core_handle;
int ret = 0;
ret = wcd_cpe_is_valid_lsm_session(core, session,
@ -3021,7 +3021,7 @@ static int wcd_cpe_set_one_param(void *core_handle,
struct cpe_lsm_session *session, struct lsm_params_info *p_info,
void *data, uint32_t param_type)
{
struct wcd_cpe_core *core = core_handle;
struct wcd_cpe_core *core = (struct wcd_cpe_core *)core_handle;
int rc = 0;
struct cpe_lsm_ids ids;
@ -3111,7 +3111,7 @@ static int wcd_cpe_lsm_set_data(void *core_handle,
enum lsm_detection_mode detect_mode,
bool detect_failure)
{
struct wcd_cpe_core *core = core_handle;
struct wcd_cpe_core *core = (struct wcd_cpe_core *)core_handle;
struct cpe_lsm_ids ids;
int ret = 0;
@ -3160,7 +3160,7 @@ static int wcd_cpe_lsm_reg_snd_model(void *core_handle,
{
int ret = 0;
struct cmi_obm_msg obm_msg;
struct wcd_cpe_core *core = core_handle;
struct wcd_cpe_core *core = (struct wcd_cpe_core *)core_handle;
ret = wcd_cpe_is_valid_lsm_session(core, session,
__func__);
@ -3213,7 +3213,7 @@ static int wcd_cpe_lsm_dereg_snd_model(void *core_handle,
struct cpe_lsm_session *session)
{
struct cmi_hdr cmd_dereg_snd_model;
struct wcd_cpe_core *core = core_handle;
struct wcd_cpe_core *core = (struct wcd_cpe_core *)core_handle;
int ret = 0;
ret = wcd_cpe_is_valid_lsm_session(core, session,
@ -3248,7 +3248,7 @@ end_ret:
static int wcd_cpe_lsm_get_afe_out_port_id(void *core_handle,
struct cpe_lsm_session *session)
{
struct wcd_cpe_core *core = core_handle;
struct wcd_cpe_core *core = (struct wcd_cpe_core *)core_handle;
struct snd_soc_component *component;
int rc = 0;
@ -3302,7 +3302,7 @@ static int wcd_cpe_cmd_lsm_start(void *core_handle,
struct cpe_lsm_session *session)
{
struct cmi_hdr cmd_lsm_start;
struct wcd_cpe_core *core = core_handle;
struct wcd_cpe_core *core = (struct wcd_cpe_core *)core_handle;
int ret = 0;
ret = wcd_cpe_is_valid_lsm_session(core, session,
@ -3337,7 +3337,7 @@ static int wcd_cpe_cmd_lsm_stop(void *core_handle,
struct cpe_lsm_session *session)
{
struct cmi_hdr cmd_lsm_stop;
struct wcd_cpe_core *core = core_handle;
struct wcd_cpe_core *core = (struct wcd_cpe_core *)core_handle;
int ret = 0;
ret = wcd_cpe_is_valid_lsm_session(core, session,
@ -3376,7 +3376,7 @@ static struct cpe_lsm_session *wcd_cpe_alloc_lsm_session(
{
struct cpe_lsm_session *session;
int i, session_id = -1;
struct wcd_cpe_core *core = core_handle;
struct wcd_cpe_core *core = (struct wcd_cpe_core *)core_handle;
bool afe_register_service = false;
int ret = 0;
@ -3537,7 +3537,7 @@ static int wcd_cpe_lsm_lab_control(
struct cpe_lsm_session *session,
bool enable)
{
struct wcd_cpe_core *core = core_handle;
struct wcd_cpe_core *core = (struct wcd_cpe_core *)core_handle;
int ret = 0, pld_size = CPE_PARAM_SIZE_LSM_LAB_CONTROL;
struct cpe_lsm_control_lab cpe_lab_enable;
struct cpe_lsm_lab_enable *lab_enable = &cpe_lab_enable.lab_enable;
@ -3620,7 +3620,7 @@ static int wcd_cpe_lsm_eob(
static int wcd_cpe_dealloc_lsm_session(void *core_handle,
struct cpe_lsm_session *session)
{
struct wcd_cpe_core *core = core_handle;
struct wcd_cpe_core *core = (struct wcd_cpe_core *)core_handle;
int ret = 0;
WCD_CPE_GRAB_LOCK(&core->session_lock, "session_lock");
@ -3667,7 +3667,7 @@ static int wcd_cpe_lab_ch_setup(void *core_handle,
struct cpe_lsm_session *session,
enum wcd_cpe_event event)
{
struct wcd_cpe_core *core = core_handle;
struct wcd_cpe_core *core = (struct wcd_cpe_core *)core_handle;
struct snd_soc_component *component;
int rc = 0;
u8 cpe_intr_bits;
@ -3791,7 +3791,7 @@ static int wcd_cpe_lsm_set_fmt_cfg(void *core_handle,
{
int ret;
struct cpe_lsm_output_format_cfg out_fmt_cfg;
struct wcd_cpe_core *core = core_handle;
struct wcd_cpe_core *core = (struct wcd_cpe_core *)core_handle;
ret = wcd_cpe_is_valid_lsm_session(core, session, __func__);
if (ret)
@ -3835,7 +3835,7 @@ static int wcd_cpe_lsm_set_media_fmt_params(void *core_handle,
{
struct cpe_lsm_media_fmt_param media_fmt;
struct cmi_hdr *msg_hdr = &media_fmt.hdr;
struct wcd_cpe_core *core = core_handle;
struct wcd_cpe_core *core = (struct wcd_cpe_core *)core_handle;
struct cpe_param_data *param_d = &media_fmt.param;
struct cpe_lsm_ids ids;
int ret;
@ -3878,7 +3878,7 @@ static int wcd_cpe_lsm_set_port(void *core_handle,
u32 port_id;
int ret;
struct cpe_lsm_ids ids;
struct wcd_cpe_core *core = core_handle;
struct wcd_cpe_core *core = (struct wcd_cpe_core *)core_handle;
ret = wcd_cpe_is_valid_lsm_session(core, session, __func__);
if (ret)
@ -3972,7 +3972,7 @@ static int wcd_cpe_cmi_send_afe_msg(
void *message)
{
int ret = 0;
struct cmi_hdr *hdr = message;
struct cmi_hdr *hdr = (struct cmi_hdr *)message;
pr_debug("%s: sending message with opcode 0x%x\n",
__func__, hdr->opcode);
@ -4116,7 +4116,7 @@ static int wcd_cpe_send_afe_cal(void *core_handle,
{
struct cal_block_data *afe_cal = NULL;
struct wcd_cpe_core *core = core_handle;
struct wcd_cpe_core *core = (struct wcd_cpe_core *)core_handle;
struct cmi_obm_msg obm_msg;
void *inb_msg = NULL;
void *msg;
@ -4270,7 +4270,7 @@ static int wcd_cpe_afe_svc_cmd_mode(void *core_handle,
u8 mode)
{
struct cpe_afe_svc_cmd_mode afe_mode;
struct wcd_cpe_core *core = core_handle;
struct wcd_cpe_core *core = (struct wcd_cpe_core *)core_handle;
struct wcd_cmi_afe_port_data *afe_port_d;
int ret;
@ -4309,7 +4309,7 @@ static int wcd_cpe_afe_cmd_port_cfg(void *core_handle,
struct wcd_cpe_afe_port_cfg *afe_cfg)
{
struct cpe_afe_cmd_port_cfg port_cfg_cmd;
struct wcd_cpe_core *core = core_handle;
struct wcd_cpe_core *core = (struct wcd_cpe_core *)core_handle;
struct wcd_cmi_afe_port_data *afe_port_d;
int ret;
@ -4364,7 +4364,7 @@ static int wcd_cpe_afe_set_params(void *core_handle,
struct cpe_afe_params afe_params;
struct cpe_afe_hw_mad_ctrl *hw_mad_ctrl = &afe_params.hw_mad_ctrl;
struct cpe_afe_port_cfg *port_cfg = &afe_params.port_cfg;
struct wcd_cpe_core *core = core_handle;
struct wcd_cpe_core *core = (struct wcd_cpe_core *)core_handle;
struct wcd_cmi_afe_port_data *afe_port_d;
int ret = 0, pld_size = 0;
@ -4434,7 +4434,7 @@ static int wcd_cpe_afe_port_start(void *core_handle,
{
struct cmi_hdr hdr;
struct wcd_cpe_core *core = core_handle;
struct wcd_cpe_core *core = (struct wcd_cpe_core *)core_handle;
struct wcd_cmi_afe_port_data *afe_port_d;
int ret = 0;
@ -4470,7 +4470,7 @@ static int wcd_cpe_afe_port_stop(void *core_handle,
struct wcd_cpe_afe_port_cfg *port_cfg)
{
struct cmi_hdr hdr;
struct wcd_cpe_core *core = core_handle;
struct wcd_cpe_core *core = (struct wcd_cpe_core *)core_handle;
struct wcd_cmi_afe_port_data *afe_port_d;
int ret = 0;
@ -4507,7 +4507,7 @@ static int wcd_cpe_afe_port_suspend(void *core_handle,
struct wcd_cpe_afe_port_cfg *port_cfg)
{
struct cmi_hdr hdr;
struct wcd_cpe_core *core = core_handle;
struct wcd_cpe_core *core = (struct wcd_cpe_core *)core_handle;
struct wcd_cmi_afe_port_data *afe_port_d;
int ret = 0;
@ -4543,7 +4543,7 @@ static int wcd_cpe_afe_port_resume(void *core_handle,
struct wcd_cpe_afe_port_cfg *port_cfg)
{
struct cmi_hdr hdr;
struct wcd_cpe_core *core = core_handle;
struct wcd_cpe_core *core = (struct wcd_cpe_core *)core_handle;
struct wcd_cmi_afe_port_data *afe_port_d;
int ret = 0;

34
techpack/audio/asoc/codecs/wsa881x-analog.c Normal file → Executable file
View file

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* 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>
@ -805,7 +806,40 @@ static int wsa881x_set_visense(struct snd_kcontrol *kcontrol,
return 0;
}
static int wsa881x_get_t0_init(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_component *component =
snd_soc_kcontrol_component(kcontrol);
struct wsa881x_pdata *wsa881x =
snd_soc_component_get_drvdata(component);
struct wsa881x_tz_priv *pdata = &wsa881x->tz_pdata;
ucontrol->value.integer.value[0] = pdata->t0_init;
dev_dbg(component->dev, "%s: t0 init %d\n", __func__, pdata->t0_init);
return 0;
}
static int wsa881x_set_t0_init(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_component *component =
snd_soc_kcontrol_component(kcontrol);
struct wsa881x_pdata *wsa881x =
snd_soc_component_get_drvdata(component);
struct wsa881x_tz_priv *pdata = &wsa881x->tz_pdata;
pdata->t0_init = ucontrol->value.integer.value[0];
dev_dbg(component->dev, "%s: t0 init %d\n", __func__, pdata->t0_init);
return 0;
}
static const struct snd_kcontrol_new wsa881x_snd_controls[] = {
SOC_SINGLE_EXT("WSA T0 Init", SND_SOC_NOPM, 0, 1, 0,
wsa881x_get_t0_init, wsa881x_set_t0_init),
SOC_SINGLE_EXT("BOOST Switch", SND_SOC_NOPM, 0, 1, 0,
wsa881x_get_boost, wsa881x_set_boost),

View file

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/module.h>
@ -30,9 +31,21 @@
#include "wsa881x-temp-sensor.h"
#include "asoc/bolero-slave-internal.h"
#define DRV_NAME "wsa-codec"
#define WSA881X_NUM_RETRY 5
#define MAX_NAME_LEN 30
#define WSA881X_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\
SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000 |\
SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_192000 |\
SNDRV_PCM_RATE_384000)
/* Fractional Rates */
#define WSA881X_FRAC_RATES (SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_88200 |\
SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_352800)
#define WSA881X_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\
SNDRV_PCM_FMTBIT_S24_LE |\
SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE)
enum {
G_18DB = 0,
G_16P5DB,
@ -115,6 +128,9 @@ struct wsa881x_priv {
struct dentry *debugfs_poke;
struct dentry *debugfs_reg_dump;
unsigned int read_data;
char *wsa881x_name_prefix;
struct snd_soc_dai_driver *dai_driver;
struct snd_soc_component_driver *driver;
};
struct wsa_ctrl_platform_data {
@ -1356,7 +1372,7 @@ static void wsa881x_remove(struct snd_soc_component *component)
}
static const struct snd_soc_component_driver soc_codec_dev_wsa881x = {
.name = DRV_NAME,
.name = "wsa-codec",
.probe = wsa881x_probe,
.remove = wsa881x_remove,
.controls = wsa881x_snd_controls,
@ -1367,6 +1383,21 @@ static const struct snd_soc_component_driver soc_codec_dev_wsa881x = {
.num_dapm_routes = ARRAY_SIZE(wsa881x_audio_map),
};
static struct snd_soc_dai_driver wsa_dai[] = {
{
.name = "wsa_rx",
.playback = {
.stream_name = "WSA881X_AIF Playback",
.rates = WSA881X_RATES | WSA881X_FRAC_RATES,
.formats = WSA881X_FORMATS,
.rate_max = 192000,
.rate_min = 8000,
.channels_min = 1,
.channels_max = 2,
},
},
};
static int wsa881x_gpio_ctrl(struct wsa881x_priv *wsa881x, bool enable)
{
int ret = 0;
@ -1461,9 +1492,13 @@ static int wsa881x_event_notify(struct notifier_block *nb,
static int wsa881x_swr_probe(struct swr_device *pdev)
{
int ret = 0;
struct wsa881x_priv *wsa881x;
struct wsa881x_priv *wsa881x = NULL;
struct snd_soc_component *component;
u8 devnum = 0;
int dev_index = 0;
bool pin_state_current = false;
char buffer[MAX_NAME_LEN];
const char *wsa881x_name_prefix_of = NULL;
struct wsa_ctrl_platform_data *plat_data = NULL;
wsa881x = devm_kzalloc(&pdev->dev, sizeof(struct wsa881x_priv),
@ -1553,14 +1588,74 @@ static int wsa881x_swr_probe(struct swr_device *pdev)
goto dev_err;
}
ret = snd_soc_register_component(&pdev->dev, &soc_codec_dev_wsa881x,
NULL, 0);
ret = of_property_read_string(pdev->dev.of_node,
"qcom,wsa-prefix", &wsa881x_name_prefix_of);
if (ret) {
dev_err(&pdev->dev,
"%s: Looking up %s property in node %s failed\n",
__func__, "qcom,wsa-prefix",
pdev->dev.of_node->full_name);
goto dev_err;
}
wsa881x->driver = devm_kzalloc(&pdev->dev,
sizeof(struct snd_soc_component_driver),
GFP_KERNEL);
if (!wsa881x->driver) {
ret = -ENOMEM;
goto err_mem;
}
memcpy(wsa881x->driver, &soc_codec_dev_wsa881x,
sizeof(struct snd_soc_component_driver));
wsa881x->dai_driver = devm_kzalloc(&pdev->dev,
sizeof(struct snd_soc_dai_driver),
GFP_KERNEL);
if (!wsa881x->dai_driver) {
ret = -ENOMEM;
goto err_mem;
}
memcpy(wsa881x->dai_driver, wsa_dai,
sizeof(struct snd_soc_dai_driver));
dev_index = (int)((char)(pdev->addr & 0xF));
snprintf(buffer, sizeof(buffer), "wsa-codec.%d", dev_index);
wsa881x->driver->name = kstrndup(buffer,
strlen(buffer), GFP_KERNEL);
snprintf(buffer, sizeof(buffer), "wsa_rx%d", dev_index);
wsa881x->dai_driver->name =
kstrndup(buffer, strlen(buffer), GFP_KERNEL);
snprintf(buffer, sizeof(buffer),
"WSA881X_AIF%d Playback", dev_index);
wsa881x->dai_driver->playback.stream_name =
kstrndup(buffer, strlen(buffer), GFP_KERNEL);
/* Number of DAI's used is 1 */
ret = snd_soc_register_component(&pdev->dev,
wsa881x->driver, wsa881x->dai_driver, 1);
if (ret) {
dev_err(&pdev->dev, "%s: Codec registration failed\n",
__func__);
goto dev_err;
goto err_mem;
}
wsa881x->wsa881x_name_prefix = kstrndup(wsa881x_name_prefix_of,
strlen(wsa881x_name_prefix_of), GFP_KERNEL);
component = snd_soc_lookup_component(&pdev->dev, wsa881x->driver->name);
if (!component) {
dev_err(&pdev->dev, "%s: component is NULL \n", __func__);
ret = -EINVAL;
goto err_mem;
}
component->name_prefix = wsa881x->wsa881x_name_prefix;
wsa881x->bolero_np = of_parse_phandle(pdev->dev.of_node,
"qcom,bolero-handle", 0);
if (wsa881x->bolero_np) {
@ -1596,6 +1691,17 @@ static int wsa881x_swr_probe(struct swr_device *pdev)
return 0;
err_mem:
kfree(wsa881x->wsa881x_name_prefix);
if (wsa881x->dai_driver) {
devm_kfree(&pdev->dev, wsa881x->dai_driver->name);
devm_kfree(&pdev->dev, wsa881x->dai_driver->playback.stream_name);
devm_kfree(&pdev->dev, wsa881x->dai_driver);
}
if (wsa881x->driver) {
devm_kfree(&pdev->dev, wsa881x->driver->name);
devm_kfree(&pdev->dev, wsa881x->driver);
}
dev_err:
if (pin_state_current == false)
wsa881x_gpio_ctrl(wsa881x, false);
@ -1625,6 +1731,16 @@ static int wsa881x_swr_remove(struct swr_device *pdev)
if (wsa881x->pd_gpio)
gpio_free(wsa881x->pd_gpio);
swr_set_dev_data(pdev, NULL);
kfree(wsa881x->wsa881x_name_prefix);
if (wsa881x->dai_driver) {
devm_kfree(&pdev->dev, wsa881x->dai_driver->name);
devm_kfree(&pdev->dev, wsa881x->dai_driver->playback.stream_name);
devm_kfree(&pdev->dev, wsa881x->dai_driver);
}
if (wsa881x->driver) {
devm_kfree(&pdev->dev, wsa881x->driver->name);
devm_kfree(&pdev->dev, wsa881x->driver);
}
return 0;
}

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2015-2016, 2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2015-2016, 2019, 2021, The Linux Foundation. All rights reserved.
*/
#include <linux/regmap.h>
@ -400,4 +400,5 @@ struct regmap_config wsa883x_regmap_config = {
.reg_format_endian = REGMAP_ENDIAN_NATIVE,
.val_format_endian = REGMAP_ENDIAN_NATIVE,
.can_multi_write = true,
.use_single_read = true,
};

View file

@ -1076,7 +1076,6 @@ static int wsa883x_spkr_event(struct snd_soc_dapm_widget *w,
struct snd_soc_component *component =
snd_soc_dapm_to_component(w->dapm);
struct wsa883x_priv *wsa883x = snd_soc_component_get_drvdata(component);
struct irq_data *irq_data = NULL;
dev_dbg(component->dev, "%s: %s %d\n", __func__, w->name, event);
switch (event) {
@ -1126,6 +1125,11 @@ static int wsa883x_spkr_event(struct snd_soc_dapm_widget *w,
usleep_range(250, 300);
wcd_enable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_PA_ON_ERR);
wcd_enable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_UVLO);
wcd_enable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_SAF2WAR);
wcd_enable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_WAR2SAF);
wcd_enable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_DISABLE);
wcd_enable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_OCP);
wcd_enable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_CLK_WD);
/* Force remove group */
swr_remove_from_group(wsa883x->swr_slave,
wsa883x->swr_slave->dev_num);
@ -1140,12 +1144,9 @@ static int wsa883x_spkr_event(struct snd_soc_dapm_widget *w,
WSA883X_PA_FSM_CTL, 0x01, 0x01);
break;
case SND_SOC_DAPM_PRE_PMD:
if (!test_bit(SPKR_ADIE_LB, &wsa883x->status_mask)) {
irq_data = irq_get_irq_data(WSA883X_IRQ_INT_PDM_WD);
if (irq_data && !irqd_irq_disabled(irq_data))
wcd_disable_irq(&wsa883x->irq_info,
WSA883X_IRQ_INT_PDM_WD);
}
if (!test_bit(SPKR_ADIE_LB, &wsa883x->status_mask))
wcd_disable_irq(&wsa883x->irq_info,
WSA883X_IRQ_INT_PDM_WD);
snd_soc_component_update_bits(component,
WSA883X_VBAT_ADC_FLT_CTL,
0x01, 0x00);
@ -1162,6 +1163,11 @@ static int wsa883x_spkr_event(struct snd_soc_dapm_widget *w,
0x10, 0x00);
snd_soc_component_update_bits(component, WSA883X_PDM_WD_CTL,
0x01, 0x00);
wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_CLK_WD);
wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_OCP);
wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_DISABLE);
wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_WAR2SAF);
wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_SAF2WAR);
wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_UVLO);
wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_PA_ON_ERR);
clear_bit(SPKR_STATUS, &wsa883x->status_mask);
@ -1517,7 +1523,6 @@ static int wsa883x_event_notify(struct notifier_block *nb,
u16 event = (val & 0xffff);
struct wsa883x_priv *wsa883x = container_of(nb, struct wsa883x_priv,
parent_nblock);
struct irq_data *irq_data = NULL;
if (!wsa883x)
return -EINVAL;
@ -1546,10 +1551,8 @@ static int wsa883x_event_notify(struct notifier_block *nb,
snd_soc_component_update_bits(wsa883x->component,
WSA883X_PA_FSM_CTL,
0x01, 0x01);
irq_data = irq_get_irq_data(WSA883X_IRQ_INT_PDM_WD);
if (irq_data && irqd_irq_disabled(irq_data))
wcd_enable_irq(&wsa883x->irq_info,
WSA883X_IRQ_INT_PDM_WD);
wcd_enable_irq(&wsa883x->irq_info,
WSA883X_IRQ_INT_PDM_WD);
/* Added delay as per HW sequence */
usleep_range(3000, 3100);
snd_soc_component_update_bits(wsa883x->component,
@ -1629,12 +1632,20 @@ static int wsa883x_swr_probe(struct swr_device *pdev)
const char *wsa883x_name_prefix_of = NULL;
char buffer[MAX_NAME_LEN];
int dev_index = 0;
struct regmap_irq_chip *wsa883x_sub_regmap_irq_chip = NULL;
wsa883x = devm_kzalloc(&pdev->dev, sizeof(struct wsa883x_priv),
GFP_KERNEL);
if (!wsa883x)
return -ENOMEM;
wsa883x_sub_regmap_irq_chip = devm_kzalloc(&pdev->dev, sizeof(struct regmap_irq_chip),
GFP_KERNEL);
if (!wsa883x_sub_regmap_irq_chip)
return -ENOMEM;
memcpy(wsa883x_sub_regmap_irq_chip, &wsa883x_regmap_irq_chip,
sizeof(struct regmap_irq_chip));
ret = wsa883x_enable_supplies(&pdev->dev, wsa883x);
if (ret) {
ret = -EPROBE_DEFER;
@ -1649,6 +1660,7 @@ static int wsa883x_swr_probe(struct swr_device *pdev)
}
swr_set_dev_data(pdev, wsa883x);
wsa883x->swr_slave = pdev;
wsa883x->dev = &pdev->dev;
pin_state_current = msm_cdc_pinctrl_get_state(wsa883x->wsa_rst_np);
wsa883x_gpio_ctrl(wsa883x, true);
/*
@ -1677,11 +1689,11 @@ static int wsa883x_swr_probe(struct swr_device *pdev)
}
/* Set all interrupts as edge triggered */
for (i = 0; i < wsa883x_regmap_irq_chip.num_regs; i++)
for (i = 0; i < wsa883x_sub_regmap_irq_chip->num_regs; i++)
regmap_write(wsa883x->regmap, (WSA883X_INTR_LEVEL0 + i), 0);
wsa883x_regmap_irq_chip.irq_drv_data = wsa883x;
wsa883x->irq_info.wcd_regmap_irq_chip = &wsa883x_regmap_irq_chip;
wsa883x_sub_regmap_irq_chip->irq_drv_data = wsa883x;
wsa883x->irq_info.wcd_regmap_irq_chip = wsa883x_sub_regmap_irq_chip;
wsa883x->irq_info.codec_name = "WSA883X";
wsa883x->irq_info.regmap = wsa883x->regmap;
wsa883x->irq_info.dev = &pdev->dev;
@ -1693,49 +1705,51 @@ static int wsa883x_swr_probe(struct swr_device *pdev)
goto dev_err;
}
wsa883x->swr_slave->slave_irq = wsa883x->virq;
wcd_request_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_SAF2WAR,
"WSA SAF2WAR", wsa883x_saf2war_handle_irq, NULL);
"WSA SAF2WAR", wsa883x_saf2war_handle_irq, wsa883x);
wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_SAF2WAR);
wcd_request_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_WAR2SAF,
"WSA WAR2SAF", wsa883x_war2saf_handle_irq, NULL);
"WSA WAR2SAF", wsa883x_war2saf_handle_irq, wsa883x);
wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_WAR2SAF);
wcd_request_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_DISABLE,
"WSA OTP", wsa883x_otp_handle_irq, NULL);
"WSA OTP", wsa883x_otp_handle_irq, wsa883x);
wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_DISABLE);
wcd_request_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_OCP,
"WSA OCP", wsa883x_ocp_handle_irq, NULL);
"WSA OCP", wsa883x_ocp_handle_irq, wsa883x);
wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_OCP);
wcd_request_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_CLIP,
"WSA CLIP", wsa883x_clip_handle_irq, NULL);
"WSA CLIP", wsa883x_clip_handle_irq, wsa883x);
wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_CLIP);
wcd_request_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_PDM_WD,
"WSA PDM WD", wsa883x_pdm_wd_handle_irq, NULL);
"WSA PDM WD", wsa883x_pdm_wd_handle_irq, wsa883x);
wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_PDM_WD);
wcd_request_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_CLK_WD,
"WSA CLK WD", wsa883x_clk_wd_handle_irq, NULL);
"WSA CLK WD", wsa883x_clk_wd_handle_irq, wsa883x);
wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_CLK_WD);
wcd_request_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_INTR_PIN,
"WSA EXT INT", wsa883x_ext_int_handle_irq, NULL);
"WSA EXT INT", wsa883x_ext_int_handle_irq, wsa883x);
wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_INTR_PIN);
/* Under Voltage Lock out (UVLO) interrupt handle */
wcd_request_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_UVLO,
"WSA UVLO", wsa883x_uvlo_handle_irq, NULL);
"WSA UVLO", wsa883x_uvlo_handle_irq, wsa883x);
wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_UVLO);

498
techpack/audio/asoc/gvm_auto_spf_dummy.c Normal file → Executable file
View file

@ -218,90 +218,414 @@ static const struct snd_soc_dapm_widget msm_dapm_widgets[] = {
/* Digital audio interface glue - connects codec <---> CPU */
static struct snd_soc_dai_link msm_common_dai_links[] = {
/* BackEnd DAI Links */
{
.name = "TERT_TDM_RX_0_DUMMY",
.stream_name = "TDM-LPAIF-RX-TERTIARY",
.dpcm_playback = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
{
.name = "LPASS_BE_AUXPCM_RX_DUMMY",
.stream_name = "AUXPCM-LPAIF-RX-PRIMARY",
.dpcm_playback = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(lpass_be_auxpcm_rx_dummy),
},
{
.name = "LPASS_BE_AUXPCM_TX_DUMMY",
.stream_name = "AUXPCM-LPAIF-TX-PRIMARY",
.dpcm_capture = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(lpass_be_auxpcm_tx_dummy),
},
{
.name = "SEC_TDM_RX_0_DUMMY",
.stream_name = "TDM-LPAIF-RX-SECONDARY",
.dpcm_playback = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(secondary_tdm_rx_0_dummy),
},
{
.name = "SEC_TDM_TX_0_DUMMY",
.stream_name = "TDM-LPAIF-TX-SECONDARY",
.dpcm_capture = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(secondary_tdm_tx_0_dummy),
},
{
.name = "TERT_TDM_RX_0_DUMMY",
.stream_name = "TDM-LPAIF-RX-TERTIARY",
.dpcm_playback = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(tert_tdm_rx_0_dummy),
},
{
.name = "TERT_TDM_TX_0_DUMMY",
.stream_name = "TDM-LPAIF-TX-TERTIARY",
.dpcm_capture = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(tert_tdm_tx_0_dummy),
},
{
.name = "QUAT_TDM_RX_0_DUMMY",
.stream_name = "TDM-LPAIF-RX-QUATERNARY",
.dpcm_playback = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(quat_tdm_rx_0_dummy),
},
{
.name = "QUAT_TDM_TX_0_DUMMY",
.stream_name = "TDM-LPAIF-TX-QUATERNARY",
.dpcm_capture = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(quat_tdm_tx_0_dummy),
},
{
.name = "QUIN_TDM_RX_0_DUMMY",
.stream_name = "TDM-LPAIF-RX-QUINARY",
.dpcm_playback = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(quin_tdm_rx_0_dummy),
},
{
.name = "QUIN_TDM_TX_0_DUMMY",
.stream_name = "TDM-LPAIF-TX-QUINARY",
.dpcm_capture = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(quin_tdm_tx_0_dummy),
},
};
static struct snd_soc_dai_link msm_gvm8295_dai_links[] = {
/* BackEnd DAI Links */
{
.name = "PRI_TDM_RX_0_DUMMY",
.stream_name = "TDM-LPAIF-RX-PRIMARY",
.dpcm_playback = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(primary_tdm_rx_0_dummy),
},
{
.name = "PRI_TDM_TX_0_DUMMY",
.stream_name = "TDM-LPAIF-TX-PRIMARY",
.dpcm_capture = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(primary_tdm_tx_0_dummy),
},
{
.name = "SEC_TDM_RX_0_DUMMY",
.stream_name = "TDM-LPAIF-RX-SECONDARY",
.dpcm_playback = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(secondary_tdm_rx_0_dummy),
},
{
.name = "SEC_TDM_TX_0_DUMMY",
.stream_name = "TDM-LPAIF-TX-SECONDARY",
.dpcm_capture = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(secondary_tdm_tx_0_dummy),
},
{
.name = "TERT_TDM_RX_0_DUMMY",
.stream_name = "TDM-LPAIF-RX-TERTIARY",
.dpcm_playback = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(tert_tdm_rx_0_dummy),
},
{
.name = "TERT_TDM_TX_0_DUMMY",
.stream_name = "TDM-LPAIF-TX-TERTIARY",
.dpcm_capture = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
},
{
.name = "TERT_TDM_TX_0_DUMMY",
.stream_name = "TDM-LPAIF-TX-TERTIARY",
.dpcm_capture = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(tert_tdm_tx_0_dummy),
},
{
.name = "LPASS_BE_AUXPCM_RX_DUMMY",
.stream_name = "AUXPCM-LPAIF-RX-PRIMARY",
.dpcm_playback = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
},
{
.name = "QUAT_TDM_RX_0_DUMMY",
.stream_name = "TDM-LPAIF_RXTX-RX-PRIMARY",
.dpcm_playback = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(lpass_be_auxpcm_rx_dummy),
},
{
.name = "LPASS_BE_AUXPCM_TX_DUMMY",
.stream_name = "AUXPCM-LPAIF-TX-PRIMARY",
.dpcm_capture = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
SND_SOC_DAILINK_REG(quat_tdm_rx_0_dummy),
},
{
.name = "QUAT_TDM_TX_0_DUMMY",
.stream_name = "TDM-LPAIF_RXTX-TX-PRIMARY",
.dpcm_capture = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(lpass_be_auxpcm_tx_dummy),
},
SND_SOC_DAILINK_REG(quat_tdm_tx_0_dummy),
},
{
.name = "QUIN_TDM_RX_0_DUMMY",
.stream_name = "TDM-LPAIF_VA-RX-PRIMARY",
.dpcm_playback = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(quin_tdm_rx_0_dummy),
},
{
.name = "QUIN_TDM_TX_0_DUMMY",
.stream_name = "TDM-LPAIF_VA-TX-PRIMARY",
.dpcm_capture = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(quin_tdm_tx_0_dummy),
},
{
.name = "SEN_TDM_RX_0_DUMMY",
.stream_name = "TDM-LPAIF_WSA-RX-PRIMARY",
.dpcm_playback = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(sen_tdm_rx_0_dummy),
},
{
.name = "SEN_TDM_TX_0_DUMMY",
.stream_name = "TDM-LPAIF_WSA-TX-PRIMARY",
.dpcm_capture = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(sen_tdm_tx_0_dummy),
},
{
.name = "SEP_TDM_RX_0_DUMMY",
.stream_name = "TDM-LPAIF_AUD-RX-PRIMARY",
.dpcm_playback = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(sep_tdm_rx_0_dummy),
},
{
.name = "SEP_TDM_TX_0_DUMMY",
.stream_name = "TDM-LPAIF_AUD-TX-PRIMARY",
.dpcm_capture = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(sep_tdm_tx_0_dummy),
},
{
.name = "HS_IF0_TDM_RX_0_DUMMY",
.stream_name = "TDM-LPAIF_SDR-RX-PRIMARY",
.dpcm_capture = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(hs_if0_tdm_rx_0_dummy),
},
{
.name = "HS_IF0_TDM_TX_0_DUMMY",
.stream_name = "TDM-LPAIF_SDR-TX-PRIMARY",
.dpcm_capture = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(hs_if0_tdm_tx_0_dummy),
},
{
.name = "HS_IF1_TDM_RX_0_DUMMY",
.stream_name = "TDM-LPAIF_SDR-RX-SECONDARY",
.dpcm_capture = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(hs_if1_tdm_rx_0_dummy),
},
{
.name = "HS_IF1_TDM_TX_0_DUMMY",
.stream_name = "TDM-LPAIF_SDR-TX-SECONDARY",
.dpcm_capture = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(hs_if1_tdm_tx_0_dummy),
},
{
.name = "HS_IF2_TDM_RX_0_DUMMY",
.stream_name = "TDM-LPAIF_SDR-RX-TERTIARY",
.dpcm_capture = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(hs_if2_tdm_rx_0_dummy),
},
{
.name = "HS_IF2_TDM_TX_0_DUMMY",
.stream_name = "TDM-LPAIF_SDR-TX-TERTIARY",
.dpcm_capture = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(hs_if2_tdm_tx_0_dummy),
},
};
static struct snd_soc_dai_link msm_talos_dai_links[] = {
/* BackEnd DAI Links */
{
.name = "PRIMARY_TDM_RX_0_DUMMY",
.stream_name = "TDM-LPAIF_WSA-RX-PRIMARY",
.dpcm_playback = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(primary_tdm_rx_0_dummy),
},
{
.name = "PRIMARY_TDM_TX_0_DUMMY",
.stream_name = "TDM-LPAIF_WSA-TX-PRIMARY",
.dpcm_capture = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(primary_tdm_tx_0_dummy),
},
{
.name = "LPASS_BE_AUXPCM_RX_DUMMY",
.stream_name = "AUXPCM-LPAIF-RX-PRIMARY",
.dpcm_playback = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(lpass_be_auxpcm_rx_dummy),
},
{
.name = "LPASS_BE_AUXPCM_TX_DUMMY",
.stream_name = "AUXPCM-LPAIF-TX-PRIMARY",
.dpcm_capture = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(lpass_be_auxpcm_tx_dummy),
},
{
.name = "LPASS_BE_AUXPCM_RX_DUMMY",
.stream_name = "AUXPCM-LPAIF-RX-PRIMARY",
.dpcm_playback = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(lpass_be_auxpcm_rx_dummy),
},
{
.name = "LPASS_BE_AUXPCM_TX_DUMMY",
.stream_name = "AUXPCM-LPAIF-TX-PRIMARY",
.dpcm_capture = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(lpass_be_auxpcm_tx_dummy),
},
{
.name = "SEC_TDM_RX_0_DUMMY",
.stream_name = "TDM-LPAIF-RX-SECONDARY",
.dpcm_playback = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(secondary_tdm_rx_0_dummy),
},
{
.name = "SEC_TDM_TX_0_DUMMY",
.stream_name = "TDM-LPAIF-TX-SECONDARY",
.dpcm_capture = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(secondary_tdm_tx_0_dummy),
},
{
.name = "TERT_TDM_RX_0_DUMMY",
.stream_name = "TDM-LPAIF_WSA-RX-PRIMARY",
.dpcm_playback = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(tert_tdm_rx_0_dummy),
},
{
.name = "TERT_TDM_TX_0_DUMMY",
.stream_name = "TDM-LPAIF_WSA-TX-PRIMARY",
.dpcm_capture = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(tert_tdm_tx_0_dummy),
},
{
.name = "QUAT_TDM_RX_0_DUMMY",
.stream_name = "TDM-LPAIF_RXTX-RX-PRIMARY",
.dpcm_playback = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(quat_tdm_rx_0_dummy),
},
{
.name = "QUAT_TDM_TX_0_DUMMY",
.stream_name = "TDM-LPAIF_RXTX-TX-PRIMARY",
.dpcm_capture = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(quat_tdm_tx_0_dummy),
},
{
.name = "QUIN_TDM_RX_0_DUMMY",
.stream_name = "TDM-LPAIF-RX-TERTIARY",
.dpcm_playback = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(quin_tdm_rx_0_dummy),
},
{
.name = "QUIN_TDM_TX_0_DUMMY",
.stream_name = "TDM-LPAIF-TX-TERTIARY",
.dpcm_capture = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(quin_tdm_tx_0_dummy),
},
};
struct snd_soc_card snd_soc_card_auto_hana_dummy_msm = {
@ -312,6 +636,10 @@ struct snd_soc_card snd_soc_card_auto_talos_dummy_msm = {
.name = "gvmauto-6155-snd-card",
};
struct snd_soc_card snd_soc_card_auto_makena_dummy_msm = {
.name = "gvmauto-8295-snd-card",
};
static int msm_populate_dai_link_component_of_node(
struct snd_soc_card *card)
{
@ -330,9 +658,9 @@ static int msm_populate_dai_link_component_of_node(
continue;
/* populate platform_of_node for snd card dai links Skip this part for dummy snd card*/
if(0) {
if (dai_link[i].platforms->name &&
!dai_link[i].platforms->of_node) {
if(0) {
if (dai_link[i].platforms->name &&
!dai_link[i].platforms->of_node) {
index = of_property_match_string(cdev->of_node,
"asoc-platform-names",
dai_link[i].platforms->name);
@ -353,7 +681,7 @@ static int msm_populate_dai_link_component_of_node(
}
dai_link[i].platforms->of_node = np;
dai_link[i].platforms->name = NULL;
}
}
}
/* populate cpu_of_node for snd card dai links */
@ -361,7 +689,7 @@ static int msm_populate_dai_link_component_of_node(
index = of_property_match_string(cdev->of_node,
"asoc-cpu-names",
dai_link[i].cpus->dai_name);
pr_err("%s: retrieving cpu_of_node for %s\n",
pr_err("%s: retrieving cpu_of_node for %s\n",
__func__,
dai_link[i].cpus->dai_name);
if (index >= 0) {
@ -412,10 +740,12 @@ err:
static const struct of_device_id gvm_asoc_machine_of_match[] = {
{ .compatible = "qcom,8155-spf-asoc-snd-adp-star",
.data = "adp_star_codec"},
.data = "adp_star_codec"},
{ .compatible = "qcom,6155-spf-asoc-snd-adp-star",
.data = "adp_star_codec"},
{},
.data = "adp_star_codec"},
{ .compatible = "qcom,gvm-auto-spf-asoc-snd-adp-star",
.data = "adp_star_codec"},
{},
};
static struct snd_soc_dai_link msm_auto_dai_links[
ARRAY_SIZE(msm_common_dai_links)];
@ -423,6 +753,9 @@ static struct snd_soc_dai_link msm_auto_dai_links[
static struct snd_soc_dai_link msm_auto_talos_dai_links[
ARRAY_SIZE(msm_talos_dai_links)];
static struct snd_soc_dai_link msm_auto_gvm8295_dai_links[
ARRAY_SIZE(msm_gvm8295_dai_links)];
static struct snd_soc_card *populate_snd_card_dailinks(struct device *dev)
{
struct snd_soc_card *card = NULL;
@ -451,8 +784,14 @@ static struct snd_soc_card *populate_snd_card_dailinks(struct device *dev)
memcpy(msm_auto_talos_dai_links,
msm_talos_dai_links,
sizeof(msm_talos_dai_links));
dailink = msm_auto_talos_dai_links;
} else if (!strcmp(match->compatible, "qcom,gvm-auto-spf-asoc-snd-adp-star")) {
card = &snd_soc_card_auto_makena_dummy_msm;
total_links = ARRAY_SIZE(msm_gvm8295_dai_links);
memcpy(msm_auto_gvm8295_dai_links,
msm_gvm8295_dai_links,
sizeof(msm_gvm8295_dai_links));
dailink = msm_auto_gvm8295_dai_links;
}
if (card) {
@ -518,7 +857,6 @@ static int msm_asoc_machine_probe(struct platform_device *pdev)
if (ret) {
dev_err(&pdev->dev, "parse card name failed, err:%d\n",
ret);
pr_err("parse card name failed, err:%d\n", __func__, ret);
goto err;
}

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) 2016-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/clk.h>
@ -2432,7 +2433,8 @@ static int msm_mi2s_set_sclk(struct snd_pcm_substream *substream, bool enable)
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int port_id = 0;
int index = cpu_dai->id;
/* Rx and Tx DAIs should use same clk index */
int index = (cpu_dai->id) / 2;
port_id = msm_get_port_id(rtd->dai_link->id);
if (port_id < 0) {
@ -4369,7 +4371,8 @@ void mi2s_disable_audio_vote(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int index = cpu_dai->id;
/* Rx and Tx DAIs should use same clk index */
int index = (cpu_dai->id) / 2;
struct snd_soc_card *card = rtd->card;
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
int sample_rate = 0;
@ -4403,7 +4406,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
int ret = 0;
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int index = cpu_dai->id;
/* Rx and Tx DAIs should use same clk index */
int index = (cpu_dai->id) / 2;
unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS;
struct snd_soc_card *card = rtd->card;
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
@ -4457,10 +4461,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
if (++mi2s_intf_conf[index].ref_cnt == 1) {
/* Check if msm needs to provide the clock to the interface */
if (!mi2s_intf_conf[index].msm_is_mi2s_master) {
if (!mi2s_intf_conf[index].msm_is_mi2s_master)
mi2s_clk[index].clk_id = mi2s_ebit_clk[index];
fmt = SND_SOC_DAIFMT_CBM_CFM;
}
ret = msm_mi2s_set_sclk(substream, true);
if (ret < 0) {
dev_err(rtd->card->dev,
@ -4469,12 +4471,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
goto clean_up;
}
ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
if (ret < 0) {
pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n",
__func__, index, ret);
goto clk_off;
}
if (pdata->mi2s_gpio_p[index]) {
if (atomic_read(&(pdata->mi2s_gpio_ref_count[index]))
== 0) {
@ -4489,6 +4485,14 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
atomic_inc(&(pdata->mi2s_gpio_ref_count[index]));
}
}
if (!mi2s_intf_conf[index].msm_is_mi2s_master)
fmt = SND_SOC_DAIFMT_CBM_CFM;
ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
if (ret < 0) {
pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n",
__func__, index, ret);
goto clk_off;
}
clk_off:
if (ret < 0)
msm_mi2s_set_sclk(substream, false);
@ -4507,7 +4511,8 @@ static void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream)
{
int ret = 0;
struct snd_soc_pcm_runtime *rtd = substream->private_data;
int index = rtd->cpu_dai->id;
/* Rx and Tx DAIs should use same clk index */
int index = (rtd->cpu_dai->id) / 2;
struct snd_soc_card *card = rtd->card;
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);

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) 2016-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/clk.h>
@ -2750,7 +2751,8 @@ static int msm_mi2s_set_sclk(struct snd_pcm_substream *substream, bool enable)
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int port_id = 0;
int index = cpu_dai->id;
/* Rx and Tx DAIs should use same clk index */
int index = (cpu_dai->id) / 2;
port_id = msm_get_port_id(rtd->dai_link->id);
if (port_id < 0) {
@ -5010,7 +5012,8 @@ void mi2s_disable_audio_vote(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int index = cpu_dai->id;
/* Rx and Tx DAIs should use same clk index */
int index = (cpu_dai->id) / 2;
struct snd_soc_card *card = rtd->card;
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
int sample_rate = 0;
@ -5044,7 +5047,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
int ret = 0;
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int index = cpu_dai->id;
/* Rx and Tx DAIs should use same clk index */
int index = (cpu_dai->id) / 2;
unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS;
struct snd_soc_card *card = rtd->card;
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
@ -5098,10 +5102,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
if (++mi2s_intf_conf[index].ref_cnt == 1) {
/* Check if msm needs to provide the clock to the interface */
if (!mi2s_intf_conf[index].msm_is_mi2s_master) {
if (!mi2s_intf_conf[index].msm_is_mi2s_master)
mi2s_clk[index].clk_id = mi2s_ebit_clk[index];
fmt = SND_SOC_DAIFMT_CBM_CFM;
}
ret = msm_mi2s_set_sclk(substream, true);
if (ret < 0) {
dev_err(rtd->card->dev,
@ -5110,12 +5112,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
goto clean_up;
}
ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
if (ret < 0) {
pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n",
__func__, index, ret);
goto clk_off;
}
if (pdata->mi2s_gpio_p[index]) {
if (atomic_read(&(pdata->mi2s_gpio_ref_count[index]))
== 0) {
@ -5130,6 +5126,14 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
atomic_inc(&(pdata->mi2s_gpio_ref_count[index]));
}
}
if (!mi2s_intf_conf[index].msm_is_mi2s_master)
fmt = SND_SOC_DAIFMT_CBM_CFM;
ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
if (ret < 0) {
pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n",
__func__, index, ret);
goto clk_off;
}
clk_off:
if (ret < 0)
msm_mi2s_set_sclk(substream, false);
@ -5148,7 +5152,8 @@ static void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream)
{
int ret = 0;
struct snd_soc_pcm_runtime *rtd = substream->private_data;
int index = rtd->cpu_dai->id;
/* Rx and Tx DAIs should use same clk index */
int index = (rtd->cpu_dai->id) / 2;
struct snd_soc_card *card = rtd->card;
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
@ -6837,6 +6842,17 @@ static struct snd_soc_dai_link msm_wsa_cdc_dma_be_dai_links[] = {
.ops = &msm_cdc_dma_be_ops,
SND_SOC_DAILINK_REG(wsa_dma_tx1),
},
{
.name = LPASS_BE_WSA_CDC_DMA_TX_0_VI,
.stream_name = "WSA CDC DMA0 Capture",
.no_pcm = 1,
.dpcm_capture = 1,
.id = MSM_BACKEND_DAI_WSA_CDC_DMA_TX_0,
.be_hw_params_fixup = msm_be_hw_params_fixup,
.ignore_suspend = 1,
.ops = &msm_cdc_dma_be_ops,
SND_SOC_DAILINK_REG(wsa_dma_tx0_vi),
},
};
static struct snd_soc_dai_link msm_rx_tx_cdc_dma_be_dai_links[] = {

View file

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/clk.h>
@ -2874,7 +2875,8 @@ static int msm_mi2s_set_sclk(struct snd_pcm_substream *substream, bool enable)
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int port_id = 0;
int index = cpu_dai->id;
/* Rx and Tx DAIs should use same clk index */
int index = (cpu_dai->id) / 2;
port_id = msm_get_port_id(rtd->dai_link->id);
if (port_id < 0) {
@ -5108,7 +5110,7 @@ static int msm_snd_cdc_dma_startup(struct snd_pcm_substream *substream)
static void set_cps_config(struct snd_soc_pcm_runtime *rtd,
u32 num_ch, u32 ch_mask)
{
int i = 0;
int i = 0, j = 0;
int val = 0;
u8 dev_num = 0;
int ch_configured = 0;
@ -5117,6 +5119,7 @@ static void set_cps_config(struct snd_soc_pcm_runtime *rtd,
struct snd_soc_dai_link *dai_link = rtd->dai_link;
struct msm_asoc_mach_data *pdata =
snd_soc_card_get_drvdata(rtd->card);
struct lpass_swr_spkr_dep_cfg_t *spkr_dep_cfg_ptr;
if (!pdata) {
pr_err("%s: pdata is NULL\n", __func__);
@ -5175,9 +5178,11 @@ static void set_cps_config(struct snd_soc_pcm_runtime *rtd,
return;
}
spkr_dep_cfg_ptr = &(pdata->cps_config.spkr_dep_cfg[i]);
/* Clear stale dev num info */
pdata->cps_config.spkr_dep_cfg[i].vbatt_pkd_reg_addr &= 0xFFFF;
pdata->cps_config.spkr_dep_cfg[i].temp_pkd_reg_addr &= 0xFFFF;
spkr_dep_cfg_ptr->vbatt_pkd_reg_addr &= 0xFFFF;
spkr_dep_cfg_ptr->temp_pkd_reg_addr &= 0xFFFF;
val = 0;
@ -5191,11 +5196,22 @@ static void set_cps_config(struct snd_soc_pcm_runtime *rtd,
val |= (i*2) << 16;
/* Update dev num in packed reg addr */
pdata->cps_config.spkr_dep_cfg[i].vbatt_pkd_reg_addr |= val;
spkr_dep_cfg_ptr->vbatt_pkd_reg_addr |= val;
val &= 0xFF0FFFF;
val |= ((i*2)+1) << 16;
pdata->cps_config.spkr_dep_cfg[i].temp_pkd_reg_addr |= val;
spkr_dep_cfg_ptr->temp_pkd_reg_addr |= val;
/* Retain dev_num from val */
val &= 0x00F00000;
for (j = 0; j < MAX_CPS_LEVELS; j++)
{
val &= 0xFFF0FFFF;
val |= ((i * 3) + j) << 16;
spkr_dep_cfg_ptr->value_normal_thrsd[j] |= val;
spkr_dep_cfg_ptr->value_low1_thrsd[j] |= val;
spkr_dep_cfg_ptr->value_low2_thrsd[j] |= val;
}
i++;
ch_configured++;
}
@ -5323,7 +5339,8 @@ void mi2s_disable_audio_vote(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int index = cpu_dai->id;
/* Rx and Tx DAIs should use same clk index */
int index = (cpu_dai->id) / 2;
struct snd_soc_card *card = rtd->card;
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
int sample_rate = 0;
@ -5359,7 +5376,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
int ret = 0;
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int index = cpu_dai->id;
/* Rx and Tx DAIs should use same clk index */
int index = (cpu_dai->id) / 2;
unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS;
struct snd_soc_card *card = rtd->card;
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
@ -5418,17 +5436,14 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
mi2s_intf_conf[index].audio_core_vote = true;
}
/* Check if msm needs to provide the clock to the interface */
if (!mi2s_intf_conf[index].msm_is_mi2s_master) {
mi2s_clk[index].clk_id = mi2s_ebit_clk[index];
fmt = SND_SOC_DAIFMT_CBM_CFM;
}
mi2s_clk[index].clk_freq_in_hz = (sample_rate *
MI2S_NUM_CHANNELS * bit_per_sample);
dev_dbg(rtd->card->dev, "%s: clock rate %ul\n", __func__,
mi2s_clk[index].clk_freq_in_hz);
/* Check if msm needs to provide the clock to the interface */
if (!mi2s_intf_conf[index].msm_is_mi2s_master)
mi2s_clk[index].clk_id = mi2s_ebit_clk[index];
ret = msm_mi2s_set_sclk(substream, true);
if (ret < 0) {
dev_err(rtd->card->dev,
@ -5437,12 +5452,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
goto clean_up;
}
ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
if (ret < 0) {
pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n",
__func__, index, ret);
goto clk_off;
}
if (pdata->mi2s_gpio_p[index]) {
if (atomic_read(&(pdata->mi2s_gpio_ref_count[index]))
== 0) {
@ -5457,6 +5466,15 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
atomic_inc(&(pdata->mi2s_gpio_ref_count[index]));
}
}
if (!mi2s_intf_conf[index].msm_is_mi2s_master)
fmt = SND_SOC_DAIFMT_CBM_CFM;
ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
if (ret < 0) {
pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n",
__func__, index, ret);
goto clk_off;
}
clk_off:
if (ret < 0)
msm_mi2s_set_sclk(substream, false);
@ -5475,7 +5493,8 @@ static void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream)
{
int ret = 0;
struct snd_soc_pcm_runtime *rtd = substream->private_data;
int index = rtd->cpu_dai->id;
/* Rx and Tx DAIs should use same clk index */
int index = (rtd->cpu_dai->id) / 2;
struct snd_soc_card *card = rtd->card;
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);

24
techpack/audio/asoc/msm-dai-fe.c Normal file → Executable file
View file

@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
@ -592,6 +593,29 @@ static struct snd_soc_dai_driver msm_fe_dais[] = {
.name = "TX3_CDC_DMA_HOSTLESS",
.probe = fe_dai_probe,
},
{
.capture = {
.stream_name = "TX4_CDC_DMA_HOSTLESS Capture",
.aif_name = "TX4_CDC_DMA_UL_HL",
.rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |
SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 |
SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |
SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 |
SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 |
SNDRV_PCM_RATE_192000 | SNDRV_PCM_RATE_352800 |
SNDRV_PCM_RATE_384000,
.formats = SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE,
.channels_min = 1,
.channels_max = 8,
.rate_min = 8000,
.rate_max = 384000,
},
.ops = &msm_fe_dai_ops,
.name = "TX4_CDC_DMA_HOSTLESS",
.probe = fe_dai_probe,
},
{
.playback = {
.stream_name = "INT_FM_HOSTLESS Playback",

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-2017, 2019 The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2017, 2019, 2021 The Linux Foundation. All rights reserved.
*/
#ifndef __MSM_DAI_Q6_PDATA_H__
@ -18,22 +18,35 @@
#define MSM_MI2S_CAP_RX 0
#define MSM_MI2S_CAP_TX 1
#define MSM_PRIM_MI2S 0
#define MSM_SEC_MI2S 1
#define MSM_TERT_MI2S 2
#define MSM_QUAT_MI2S 3
#define MSM_QUIN_MI2S 4
#define MSM_SENARY_MI2S 5
#define MSM_SEC_MI2S_SD1 6
#define MSM_INT0_MI2S 7
#define MSM_INT1_MI2S 8
#define MSM_INT2_MI2S 9
#define MSM_INT3_MI2S 10
#define MSM_INT4_MI2S 11
#define MSM_INT5_MI2S 12
#define MSM_INT6_MI2S 13
#define MSM_MI2S_MIN MSM_PRIM_MI2S
#define MSM_MI2S_MAX MSM_INT6_MI2S
#define MSM_PRIM_MI2S_RX 0
#define MSM_PRIM_MI2S_TX 1
#define MSM_SEC_MI2S_RX 2
#define MSM_SEC_MI2S_TX 3
#define MSM_TERT_MI2S_RX 4
#define MSM_TERT_MI2S_TX 5
#define MSM_QUAT_MI2S_RX 6
#define MSM_QUAT_MI2S_TX 7
#define MSM_QUIN_MI2S_RX 8
#define MSM_QUIN_MI2S_TX 9
#define MSM_SENARY_MI2S_RX 10
#define MSM_SENARY_MI2S_TX 11
#define MSM_SEC_MI2S_SD1 12
#define MSM_INT0_MI2S_RX 13
#define MSM_INT0_MI2S_TX 14
#define MSM_INT1_MI2S_RX 15
#define MSM_INT1_MI2S_TX 16
#define MSM_INT2_MI2S_RX 17
#define MSM_INT2_MI2S_TX 18
#define MSM_INT3_MI2S_RX 19
#define MSM_INT3_MI2S_TX 20
#define MSM_INT4_MI2S_RX 21
#define MSM_INT4_MI2S_TX 22
#define MSM_INT5_MI2S_RX 23
#define MSM_INT5_MI2S_TX 24
#define MSM_INT6_MI2S_RX 25
#define MSM_INT6_MI2S_TX 26
#define MSM_MI2S_MIN MSM_PRIM_MI2S_RX
#define MSM_MI2S_MAX MSM_INT6_MI2S_TX
#define MSM_DISPLAY_PORT 0
#define MSM_DISPLAY_PORT1 1
@ -60,8 +73,7 @@ struct msm_dai_auxpcm_pdata {
};
struct msm_mi2s_pdata {
u16 rx_sd_lines;
u16 tx_sd_lines;
u16 sd_lines;
u16 intf_id;
};

View file

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2013-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/init.h>
#include <linux/err.h>
@ -411,6 +412,7 @@ static void lsm_event_handler(uint32_t opcode, uint32_t token,
if (!temp) {
dev_err(rtd->dev, "%s: no memory for event status\n",
__func__);
spin_unlock_irqrestore(&prtd->event_lock, flags);
__pm_relax(prtd->ws);
return;
}
@ -3092,14 +3094,6 @@ static int msm_lsm_close(struct snd_pcm_substream *substream)
__func__, ret);
prtd->lsm_client->lab_started = false;
}
if (prtd->lsm_client->lab_buffer) {
ret = msm_lsm_lab_buffer_alloc(prtd,
LAB_BUFFER_DEALLOC);
if (ret)
dev_err(rtd->dev,
"%s: lab buffer dealloc failed ret %d\n",
__func__, ret);
}
}
if (!atomic_read(&prtd->read_abort)) {
@ -3120,6 +3114,15 @@ static int msm_lsm_close(struct snd_pcm_substream *substream)
prtd->lsm_client->started = false;
}
if (prtd->lsm_client->lab_enable && prtd->lsm_client->lab_buffer) {
ret = msm_lsm_lab_buffer_alloc(prtd,
LAB_BUFFER_DEALLOC);
if (ret)
dev_err(rtd->dev,
"%s: lab buffer dealloc failed ret %d\n",
__func__, ret);
}
/*
* De-register existing sound models
* to free SM and CAL buffer, even if

View file

@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2013-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/init.h>
@ -683,7 +684,7 @@ static int msm_pcm_playback_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol,
u64 fe_id = kcontrol->private_value;
int session_type = SESSION_TYPE_RX;
int be_id = ucontrol->value.integer.value[3];
struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0, 0};
struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0, 0, 0};
int ret = 0;
cfg_data.app_type = ucontrol->value.integer.value[0];
@ -694,10 +695,12 @@ static int msm_pcm_playback_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol,
cfg_data.copp_token = ucontrol->value.integer.value[4];
if (ucontrol->value.integer.value[5] != 0)
cfg_data.bit_width = ucontrol->value.integer.value[5];
if (ucontrol->value.integer.value[6] != 0)
cfg_data.copp_perf_mode = ucontrol->value.integer.value[6];
pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d"
"sample_rate- %d copp_token- %d bit_width- %d\n",
"sample_rate- %d copp_token- %d bit_width- %d copp_perf_mode- %d\n",
__func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id,
cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width);
cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width, cfg_data.copp_perf_mode);
ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type,
be_id, &cfg_data);
if (ret < 0)
@ -730,11 +733,12 @@ static int msm_pcm_playback_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol,
ucontrol->value.integer.value[3] = be_id;
ucontrol->value.integer.value[4] = cfg_data.copp_token;
ucontrol->value.integer.value[5] = cfg_data.bit_width;
ucontrol->value.integer.value[6] = cfg_data.copp_perf_mode;
pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d"
"sample_rate- %d copp_token- %d bit_width- %d\n",
"sample_rate- %d copp_token- %d bit_width- %d copp_perf_mode- %d\n",
__func__, fe_id, session_type, be_id,
cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate,
cfg_data.copp_token, cfg_data.bit_width);
cfg_data.copp_token, cfg_data.bit_width, cfg_data.copp_perf_mode);
done:
return ret;
@ -746,7 +750,7 @@ static int msm_pcm_capture_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol,
u64 fe_id = kcontrol->private_value;
int session_type = SESSION_TYPE_TX;
int be_id = ucontrol->value.integer.value[3];
struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0, 0};
struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0, 0, 0};
int ret = 0;
cfg_data.app_type = ucontrol->value.integer.value[0];
@ -757,10 +761,12 @@ static int msm_pcm_capture_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol,
cfg_data.copp_token = ucontrol->value.integer.value[4];
if (ucontrol->value.integer.value[5] != 0)
cfg_data.bit_width = ucontrol->value.integer.value[5];
if (ucontrol->value.integer.value[6] != 0)
cfg_data.copp_perf_mode = ucontrol->value.integer.value[6];
pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d"
"sample_rate- %d copp_token- %d bit_width- %d\n",
"sample_rate- %d copp_token- %d bit_width- %d copp_perf_mode- %d\n",
__func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id,
cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width);
cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width, cfg_data.copp_perf_mode);
ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type,
be_id, &cfg_data);
if (ret < 0)
@ -793,11 +799,12 @@ static int msm_pcm_capture_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol,
ucontrol->value.integer.value[3] = be_id;
ucontrol->value.integer.value[4] = cfg_data.copp_token;
ucontrol->value.integer.value[5] = cfg_data.bit_width;
ucontrol->value.integer.value[6] = cfg_data.copp_perf_mode;
pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d"
"sample_rate- %d copp_token- %d bit_width- %d\n",
"sample_rate- %d copp_token- %d bit_width- %d copp_perf_mode- %d\n",
__func__, fe_id, session_type, be_id,
cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate,
cfg_data.copp_token, cfg_data.bit_width);
cfg_data.copp_token, cfg_data.bit_width, cfg_data.copp_perf_mode);
done:
return ret;
}

214
techpack/audio/asoc/msm-pcm-q6-v2.c Normal file → Executable file
View file

@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
@ -128,6 +129,8 @@ static struct snd_pcm_hw_constraint_list constraints_sample_rates = {
.mask = 0,
};
static struct asm_softvolume_params soft_params = {0,0,0};
struct msm_pcm_channel_map *chmap_pspd[MSM_FRONTEND_DAI_MM_SIZE][2];
static void msm_pcm_route_event_handler(enum msm_pcm_routing_event event,
@ -150,6 +153,181 @@ static void msm_pcm_route_event_handler(enum msm_pcm_routing_event event,
}
}
static int msm_pcm_set_soft_volume_params(struct msm_audio *prtd,struct asm_softvolume_params *soft_vol_params)
{
int rc = 0;
switch (prtd->audio_client->topology) {
default:
rc = q6asm_set_softvolume_v2(prtd->audio_client, soft_vol_params,
SOFT_VOLUME_INSTANCE_1);
if (rc < 0)
pr_err("%s: Send SoftVolume Param failed ret=%d\n",
__func__, rc);
}
return rc;
}
static int msm_pcm_soft_volume_ctl_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_pcm_soft_volume *soft_vol = (struct snd_pcm_soft_volume *) snd_kcontrol_chip(kcontrol);
struct msm_plat_data *pdata = NULL;
struct snd_pcm_substream *substream = NULL;
struct snd_soc_pcm_runtime *soc_prtd = NULL;
struct snd_soc_component *component = NULL;
pr_debug("%s\n", __func__);
if (!soft_vol || !soft_vol->pcm) {
pr_err("%s: soft vol is NULL\n", __func__);
return -ENODEV;
}
substream = soft_vol->pcm->streams[soft_vol->stream].substream;
if (!substream) {
pr_err("%s substream not found\n", __func__);
return -ENODEV;
}
soc_prtd = substream->private_data;
if (!soc_prtd) {
pr_err("%s substream runtime or private_data not found\n",
__func__);
return -ENODEV;
}
component = snd_soc_rtdcom_lookup(soc_prtd, DRV_NAME);
if (!component || !component->dev) {
pr_err("%s: component is NULL\n", __func__);
return -ENODEV;
}
pdata = (struct msm_plat_data *) dev_get_drvdata(component->dev);
if (!pdata) {
pr_err("%s: pdata not found\n", __func__);
return -ENODEV;
}
mutex_lock(&pdata->lock);
ucontrol->value.integer.value[0] = soft_params.period;
ucontrol->value.integer.value[1] = soft_params.step;
ucontrol->value.integer.value[2] = soft_params.rampingcurve;
pr_debug("%s: period = %d, step = %d , ramping curve: %d",__func__,
ucontrol->value.integer.value[0],
ucontrol->value.integer.value[1],
ucontrol->value.integer.value[2]);
mutex_unlock(&pdata->lock);
return 0;
}
static int msm_pcm_soft_volume_ctl_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
int rc = 0;
struct snd_pcm_soft_volume *soft_vol = (struct snd_pcm_soft_volume *) snd_kcontrol_chip(kcontrol);
struct msm_plat_data *pdata = NULL;
struct snd_soc_pcm_runtime *soc_prtd = NULL;
struct snd_soc_component *component = NULL;
struct snd_pcm_substream *substream = NULL;
struct msm_audio *prtd;
if (!soft_vol || !soft_vol->pcm) {
pr_err("%s: soft vol is NULL\n", __func__);
return -ENODEV;
}
substream = soft_vol->pcm->streams[soft_vol->stream].substream;
if (!substream) {
pr_err("%s: substream not found\n", __func__);
return -ENODEV;
}
soc_prtd = substream->private_data;
if (!substream->runtime || !soc_prtd) {
pr_err("%s: substream runtime or private_data not found\n",
__func__);
return -ENODEV;
}
component = snd_soc_rtdcom_lookup(soc_prtd, DRV_NAME);
if (!component || !component->dev) {
pr_err("%s: component is NULL\n", __func__);
return -ENODEV;
}
pdata = (struct msm_plat_data *) dev_get_drvdata(component->dev);
if (!pdata) {
pr_err("%s: pdata not found\n", __func__);
return -ENODEV;
}
mutex_lock(&pdata->lock);
if (substream->ref_count > 0) {
prtd = substream->runtime->private_data;
if ( prtd) {
if ((ucontrol->value.integer.value[0] < 0) || (ucontrol->value.integer.value[0] > 15000)) {
pr_err("%s : Ramp period range (0 to 15000), input value is out of range: %d",__func__,soft_params.period);
goto exit;
} else {
soft_params.period = ucontrol->value.integer.value[0];
}
if ((ucontrol->value.integer.value[1] < 0) || (ucontrol->value.integer.value[1] > 15000000)) {
pr_err("%s : Ramp step range (0 to 15000000), input value is out of range: %d",__func__,soft_params.step);
goto exit;
} else {
soft_params.step = ucontrol->value.integer.value[1];
}
if ((ucontrol->value.integer.value[2] < 0) || (ucontrol->value.integer.value[2] >= SOFT_VOLUME_CURVE_ENUM_MAX)) {
pr_err("%s : Ramping curve range (0 to 2), input value is out of range: %d",__func__,soft_params.rampingcurve);
goto exit;
} else {
soft_params.rampingcurve = ucontrol->value.integer.value[2];
}
pr_debug("%s : soft vol params, period: %d, step: %d, ramp curve: %d",__func__,soft_params.period,
soft_params.step,soft_params.rampingcurve);
rc = msm_pcm_set_soft_volume_params(prtd, &soft_params);
} else {
pr_err("%s: prtd not found\n", __func__);
return -ENODEV;
}
} else {
pr_err("%s: substream ref count is invalid\n", __func__);
return -ENODEV;
}
exit:
mutex_unlock(&pdata->lock);
return rc;
}
static int msm_pcm_add_soft_volume_params_control(struct snd_soc_pcm_runtime *rtd, int stream)
{
int ret = 0;
struct snd_pcm *pcm = rtd->pcm;
struct snd_pcm_soft_volume *soft_vol = NULL;
struct snd_kcontrol *kctl = NULL;
dev_dbg(rtd->dev, "%s, volume control add\n", __func__);
ret = snd_pcm_add_soft_volume_ctls(pcm, stream,
NULL,/* 1,*/ rtd->dai_link->id,
&soft_vol);
if (ret < 0) {
pr_err("%s volume control failed ret %d\n", __func__, ret);
return ret;
}
kctl = soft_vol->kctl;
kctl->put = msm_pcm_soft_volume_ctl_put;
kctl->get = msm_pcm_soft_volume_ctl_get;
return 0;
}
static void event_handler(uint32_t opcode,
uint32_t token, uint32_t *payload, void *priv)
{
@ -2091,7 +2269,7 @@ static int msm_pcm_playback_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol,
u64 fe_id = kcontrol->private_value;
int session_type = SESSION_TYPE_RX;
int be_id = ucontrol->value.integer.value[3];
struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0, 0};
struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0, 0, 0};
int ret = 0;
cfg_data.app_type = ucontrol->value.integer.value[0];
@ -2102,10 +2280,12 @@ static int msm_pcm_playback_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol,
cfg_data.copp_token = ucontrol->value.integer.value[4];
if (ucontrol->value.integer.value[5] != 0)
cfg_data.bit_width = ucontrol->value.integer.value[5];
if (ucontrol->value.integer.value[6] != 0)
cfg_data.copp_perf_mode = ucontrol->value.integer.value[6];
pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d"
"sample_rate- %d copp_token- %d bit_width- %d\n",
"sample_rate- %d copp_token- %d bit_width- %d copp_perf_mode- %d\n",
__func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id,
cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width);
cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width, cfg_data.copp_perf_mode);
ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type,
be_id, &cfg_data);
if (ret < 0)
@ -2138,10 +2318,11 @@ static int msm_pcm_playback_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol,
ucontrol->value.integer.value[3] = be_id;
ucontrol->value.integer.value[4] = cfg_data.copp_token;
ucontrol->value.integer.value[5] = cfg_data.bit_width;
ucontrol->value.integer.value[6] = cfg_data.copp_perf_mode;
pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d"
"sample_rate- %d copp_token- %d bit_width- %d\n",
"sample_rate- %d copp_token- %d bit_width- %d copp_perf_mode- %d\n",
__func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id,
cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width);
cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width, cfg_data.copp_perf_mode);
done:
return ret;
}
@ -2152,7 +2333,7 @@ static int msm_pcm_capture_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol,
u64 fe_id = kcontrol->private_value;
int session_type = SESSION_TYPE_TX;
int be_id = ucontrol->value.integer.value[3];
struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0, 0};
struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0, 0, 0};
int ret = 0;
cfg_data.app_type = ucontrol->value.integer.value[0];
@ -2163,10 +2344,12 @@ static int msm_pcm_capture_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol,
cfg_data.copp_token = ucontrol->value.integer.value[4];
if (ucontrol->value.integer.value[5] != 0)
cfg_data.bit_width = ucontrol->value.integer.value[5];
if (ucontrol->value.integer.value[6] != 0)
cfg_data.copp_perf_mode = ucontrol->value.integer.value[6];
pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d"
"sample_rate- %d copp_token- %d bit_width- %d\n",
"sample_rate- %d copp_token- %d bit_width- %d copp_perf_mode- %d\n",
__func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id,
cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width);
cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width, cfg_data.copp_perf_mode);
ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type,
be_id, &cfg_data);
if (ret < 0)
@ -2199,10 +2382,11 @@ static int msm_pcm_capture_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol,
ucontrol->value.integer.value[3] = be_id;
ucontrol->value.integer.value[4] = cfg_data.copp_token;
ucontrol->value.integer.value[5] = cfg_data.bit_width;
ucontrol->value.integer.value[6] = cfg_data.copp_perf_mode;
pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d"
"sample_rate- %d copp_token- %d bit_width- %d\n",
"sample_rate- %d copp_token- %d bit_width- %d copp_perf_mode- %d\n",
__func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id,
cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width);
cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width, cfg_data.copp_perf_mode);
done:
return ret;
}
@ -3490,6 +3674,16 @@ static int msm_asoc_pcm_new(struct snd_soc_pcm_runtime *rtd)
pr_err("%s: Could not add pcm Volume Control %d\n",
__func__, ret);
ret = msm_pcm_add_volume_control(rtd, SNDRV_PCM_STREAM_CAPTURE);
if (ret)
pr_err("%s: Could not add pcm Volume Control %d\n",
__func__, ret);
/* adding soft vol module params mixer control command*/
ret = msm_pcm_add_soft_volume_params_control(rtd, SNDRV_PCM_STREAM_PLAYBACK);
if (ret)
pr_err("%s: Could not add pcm Volume Control %d\n",
__func__, ret);
ret = msm_pcm_add_soft_volume_params_control(rtd, SNDRV_PCM_STREAM_CAPTURE);
if (ret)
pr_err("%s: Could not add pcm Volume Control %d\n",
__func__, ret);

View file

@ -49,11 +49,11 @@ struct msm_audio_in_frame_info {
#define PLAYBACK_MIN_NUM_PERIODS 2
#define PLAYBACK_MAX_NUM_PERIODS 8
#define PLAYBACK_MAX_PERIOD_SIZE 122880
#define PLAYBACK_MIN_PERIOD_SIZE 128
#define PLAYBACK_MIN_PERIOD_SIZE 120
#define CAPTURE_MIN_NUM_PERIODS 2
#define CAPTURE_MAX_NUM_PERIODS 8
#define CAPTURE_MAX_PERIOD_SIZE 122880
#define CAPTURE_MIN_PERIOD_SIZE 320
#define CAPTURE_MIN_PERIOD_SIZE 120
struct msm_audio {
struct snd_pcm_substream *substream;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

32
techpack/audio/asoc/msm-pcm-routing-v2.h Normal file → Executable file
View file

@ -1,5 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef _MSM_PCM_ROUTING_H
#define _MSM_PCM_ROUTING_H
@ -687,7 +688,10 @@ enum {
#define STREAM_TYPE_ASM 0
#define STREAM_TYPE_LSM 1
#define MT_MX_MAX_PORTS 64
#define PP_PERF_MODE_FLAG_MASK 0x10000
#define PP_PERF_MODE_VALUE_MASK 0xF
enum {
ADM_TOPOLOGY_CAL_TYPE_IDX = 0,
ADM_LSM_TOPOLOGY_CAL_TYPE_IDX,
@ -743,8 +747,16 @@ struct msm_pcm_stream_app_type_cfg {
int sample_rate;
uint32_t copp_token;
int bit_width;
int copp_perf_mode;
};
struct msm_pcm_channel_mixer_v2 {
struct msm_pcm_channel_mixer mixer_cfg;
int fedai_id;
int session_type;
int be_id;
bool is_used;
};
/* dai_id: front-end ID,
* dspst_id: DSP audio stream ID
* stream_type: playback or capture
@ -796,6 +808,26 @@ int msm_pcm_routing_set_channel_mixer_runtime(
int msm_pcm_routing_set_stream_ec_ref_chmix_cfg(
int fedai_id, struct msm_pcm_channel_mixer *cfg_data);
/* array element of usr elem */
struct snd_pcm_soft_vol_usr_elem {
int val[3];
};
/* mixer control information; retrieved via snd_kcontrol_chip() */
struct snd_pcm_soft_volume {
struct snd_pcm *pcm; /* assigned PCM instance */
int stream; /* PLAYBACK or CAPTURE */
struct snd_kcontrol *kctl; /* contorl handle*/
const struct snd_pcm_soft_vol_usr_elem *usr_val;
int max_length;
void *private_data;
};
int snd_pcm_add_soft_volume_ctls(struct snd_pcm *pcm, int stream,
const struct snd_pcm_soft_vol_usr_elem *soft_vol_params,
unsigned long private_value,
struct snd_pcm_soft_volume **info_ret);
#ifndef SND_PCM_ADD_VOLUME_CTL
/* PCM Volume control API
*/

6
techpack/audio/asoc/msm_bengal_dailink.h Normal file → Executable file
View file

@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <sound/soc.h>
@ -166,6 +167,11 @@ SND_SOC_DAILINK_DEFS(tx3_cdcdma_hostless,
DAILINK_COMP_ARRAY(COMP_CODEC("snd-soc-dummy", "snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-hostless")));
SND_SOC_DAILINK_DEFS(tx4_cdcdma_hostless,
DAILINK_COMP_ARRAY(COMP_CPU("TX4_CDC_DMA_HOSTLESS")),
DAILINK_COMP_ARRAY(COMP_CODEC("snd-soc-dummy", "snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-hostless")));
SND_SOC_DAILINK_DEFS(tert_mi2s_tx_hostless,
DAILINK_COMP_ARRAY(COMP_CPU("TERT_MI2S_TX_HOSTLESS")),
DAILINK_COMP_ARRAY(COMP_CODEC("snd-soc-dummy", "snd-soc-dummy-dai")),

View file

@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <sound/soc.h>
@ -920,57 +921,57 @@ SND_SOC_DAILINK_DEFS(pri_mi2s_rx,
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
SND_SOC_DAILINK_DEFS(pri_mi2s_tx,
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.0")),
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.1")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
SND_SOC_DAILINK_DEFS(sec_mi2s_rx,
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.1")),
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.2")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
SND_SOC_DAILINK_DEFS(sec_mi2s_tx,
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.1")),
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.3")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
SND_SOC_DAILINK_DEFS(tert_mi2s_rx,
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.2")),
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.4")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
SND_SOC_DAILINK_DEFS(tert_mi2s_tx,
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.2")),
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.5")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
SND_SOC_DAILINK_DEFS(quat_mi2s_rx,
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.3")),
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.6")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
SND_SOC_DAILINK_DEFS(quat_mi2s_tx,
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.3")),
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.7")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
SND_SOC_DAILINK_DEFS(quin_mi2s_rx,
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.4")),
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.8")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
SND_SOC_DAILINK_DEFS(quin_mi2s_tx,
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.4")),
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.9")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
SND_SOC_DAILINK_DEFS(sen_mi2s_rx,
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.5")),
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.10")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
SND_SOC_DAILINK_DEFS(sen_mi2s_tx,
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.5")),
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.11")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
@ -1305,32 +1306,127 @@ SND_SOC_DAILINK_DEFS(ext_display_port,
"msm_dp_audio_codec_rx_dai")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
SND_SOC_DAILINK_DEFS(tert_tdm_rx_0_dummy,
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
SND_SOC_DAILINK_DEFS(tert_tdm_tx_0_dummy,
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
SND_SOC_DAILINK_DEFS(lpass_be_auxpcm_rx_dummy,
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
SND_SOC_DAILINK_DEFS(lpass_be_auxpcm_tx_dummy,
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
SND_SOC_DAILINK_DEFS(primary_tdm_rx_0_dummy,
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
SND_SOC_DAILINK_DEFS(primary_tdm_tx_0_dummy,
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
SND_SOC_DAILINK_DEFS(secondary_tdm_rx_0_dummy,
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
SND_SOC_DAILINK_DEFS(secondary_tdm_tx_0_dummy,
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
SND_SOC_DAILINK_DEFS(tert_tdm_rx_0_dummy,
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
SND_SOC_DAILINK_DEFS(tert_tdm_tx_0_dummy,
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
SND_SOC_DAILINK_DEFS(quat_tdm_rx_0_dummy,
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
SND_SOC_DAILINK_DEFS(quat_tdm_tx_0_dummy,
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
SND_SOC_DAILINK_DEFS(quin_tdm_rx_0_dummy,
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
SND_SOC_DAILINK_DEFS(quin_tdm_tx_0_dummy,
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
SND_SOC_DAILINK_DEFS(sen_tdm_rx_0_dummy,
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
SND_SOC_DAILINK_DEFS(sen_tdm_tx_0_dummy,
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
SND_SOC_DAILINK_DEFS(sep_tdm_rx_0_dummy,
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
SND_SOC_DAILINK_DEFS(sep_tdm_tx_0_dummy,
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
SND_SOC_DAILINK_DEFS(hs_if0_tdm_rx_0_dummy,
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
SND_SOC_DAILINK_DEFS(hs_if0_tdm_tx_0_dummy,
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
SND_SOC_DAILINK_DEFS(hs_if1_tdm_rx_0_dummy,
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
SND_SOC_DAILINK_DEFS(hs_if1_tdm_tx_0_dummy,
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
SND_SOC_DAILINK_DEFS(hs_if2_tdm_rx_0_dummy,
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
SND_SOC_DAILINK_DEFS(hs_if2_tdm_tx_0_dummy,
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
SND_SOC_DAILINK_DEFS(voicemmode1_hostless,
DAILINK_COMP_ARRAY(COMP_CPU("VoiceMMode1")),
DAILINK_COMP_ARRAY(COMP_CODEC("snd-soc-dummy", "snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-hostless")));
SND_SOC_DAILINK_DEFS(msmvoip_hostless,
DAILINK_COMP_ARRAY(COMP_CPU("VoIP")),
DAILINK_COMP_ARRAY(COMP_CODEC("snd-soc-dummy", "snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-hostless")));
SND_SOC_DAILINK_DEFS(voicemmode2_hostless,
DAILINK_COMP_ARRAY(COMP_CPU("VoiceMMode2")),
DAILINK_COMP_ARRAY(COMP_CODEC("snd-soc-dummy", "snd-soc-dummy-dai")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-hostless")));

View file

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
*/
#include <sound/soc.h>
@ -322,37 +322,37 @@ SND_SOC_DAILINK_DEFS(pri_mi2s_rx,
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
SND_SOC_DAILINK_DEFS(pri_mi2s_tx,
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.0")),
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.1")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
SND_SOC_DAILINK_DEFS(sec_mi2s_rx,
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.1")),
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.2")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
SND_SOC_DAILINK_DEFS(sec_mi2s_tx,
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.1")),
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.3")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
SND_SOC_DAILINK_DEFS(tert_mi2s_rx,
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.2")),
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.4")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
SND_SOC_DAILINK_DEFS(tert_mi2s_tx,
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.2")),
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.5")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
SND_SOC_DAILINK_DEFS(quat_mi2s_rx,
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.3")),
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.6")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
SND_SOC_DAILINK_DEFS(quat_mi2s_tx,
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.3")),
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.7")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,57 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2017 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include "platform_init.h"
static int __init audio_platform_init(void)
{
msm_compress_dsp_init();
msm_fe_dai_init();
msm_dai_q6_hdmi_init();
msm_dai_q6_init();
msm_dai_slim_init();
msm_dai_stub_init();
msm_lsm_client_init();
msm_pcm_afe_init();
msm_pcm_dtmf_init();
msm_pcm_hostless_init();
msm_voice_host_init();
msm_pcm_loopback_init();
msm_pcm_noirq_init();
msm_pcm_dsp_init();
msm_soc_routing_platform_init();
msm_transcode_loopback_init();
return 0;
}
static void audio_platform_exit(void)
{
msm_transcode_loopback_exit();
msm_soc_routing_platform_exit();
msm_pcm_dsp_exit();
msm_pcm_noirq_exit();
msm_pcm_loopback_exit();
msm_voice_host_exit();
msm_pcm_hostless_exit();
msm_pcm_dtmf_exit();
msm_pcm_afe_exit();
msm_lsm_client_exit();
msm_dai_stub_exit();
msm_dai_slim_exit();
msm_dai_q6_exit();
msm_dai_q6_hdmi_exit();
msm_fe_dai_exit();
msm_compress_dsp_exit();
}
module_init(audio_platform_init);
module_exit(audio_platform_exit);
MODULE_DESCRIPTION("Audio Platform driver");
MODULE_LICENSE("GPL v2");

View file

@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/clk.h>
#include <linux/delay.h>
@ -6607,7 +6608,8 @@ static int msm_mi2s_set_sclk(struct snd_pcm_substream *substream, bool enable)
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int port_id = 0;
int index = cpu_dai->id;
/* Rx and Tx DAIs should use same clk index */
int index = (cpu_dai->id) / 2;
port_id = msm_get_port_id(rtd->dai_link->id);
if (port_id < 0) {
@ -7031,7 +7033,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct snd_soc_dai_link *dai_link = rtd->dai_link;
int index = cpu_dai->id;
/* Rx and Tx DAIs should use same clk index */
int index = (cpu_dai->id) / 2;
unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS;
struct snd_soc_card *card = rtd->card;
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
@ -7061,14 +7064,11 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
*/
mutex_lock(&mi2s_intf_conf[index].lock);
if (++mi2s_intf_conf[index].ref_cnt == 1) {
/* Check if msm needs to provide the clock to the interface */
if (!mi2s_intf_conf[index].msm_is_mi2s_master) {
mi2s_clk[index].clk_id = mi2s_ebit_clk[index];
fmt = SND_SOC_DAIFMT_CBM_CFM;
}
if (data_format == AFE_DSD_DATA)
fmt = SND_SOC_DAIFMT_CBM_CFS;
/* Check if msm needs to provide the clock to the interface */
if (!mi2s_intf_conf[index].msm_is_mi2s_master)
mi2s_clk[index].clk_id = mi2s_ebit_clk[index];
ret = msm_mi2s_set_sclk(substream, true);
if (ret < 0) {
dev_err(rtd->card->dev,
@ -7077,13 +7077,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
goto clean_up;
}
ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
if (ret < 0) {
pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n",
__func__, index, ret);
goto clk_off;
}
if (pdata->mi2s_gpio_p[index]) {
if ((data_format == AFE_DSD_DATA) &&
((index == QUAT_MI2S) ||
@ -7112,7 +7105,14 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
}
}
}
if (!mi2s_intf_conf[index].msm_is_mi2s_master)
fmt = SND_SOC_DAIFMT_CBM_CFM;
ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
if (ret < 0) {
pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n",
__func__, index, ret);
goto clk_off;
}
ret = qcs405_send_island_vad_config(dai_link->id);
if (ret) {
pr_err("%s: send island/vad cfg failed, err = %d\n",
@ -7167,7 +7167,8 @@ static void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream)
int val;
int data_format;
struct snd_soc_pcm_runtime *rtd = substream->private_data;
int index = rtd->cpu_dai->id;
/* Rx and Tx DAIs should use same clk index */
int index = (rtd->cpu_dai->id) / 2;
struct snd_soc_card *card = rtd->card;
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);

51
techpack/audio/asoc/sa6155.c Executable file → Normal file
View file

@ -1,4 +1,5 @@
/* Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
/*
* Copyright 2011, The Android Open Source Project
@ -3769,7 +3770,8 @@ static int msm_mi2s_set_sclk(struct snd_pcm_substream *substream, bool enable)
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int port_id = 0;
int index = cpu_dai->id;
/* Rx and Tx DAIs should use same clk index */
int index = (cpu_dai->id) / 2;
port_id = msm_get_port_id(rtd->dai_link->id);
if (port_id < 0) {
@ -3945,14 +3947,22 @@ static int msm_pinctrl_init(struct platform_device *pdev, enum pinctrl_mode mode
pinctrl_info->pinctrl = pinctrl;
/* get all the states handles from Device Tree */
pinctrl_info->sleep = pinctrl_lookup_state(pinctrl,
"sleep");
if (mode == TDM_PINCTRL)
pinctrl_info->sleep = pinctrl_lookup_state(pinctrl,
"default");
else
pinctrl_info->sleep = pinctrl_lookup_state(pinctrl,
"sleep");
if (IS_ERR(pinctrl_info->sleep)) {
pr_err("%s: could not get sleep pin state\n", __func__);
goto err;
}
pinctrl_info->active = pinctrl_lookup_state(pinctrl,
"default");
if (mode == TDM_PINCTRL)
pinctrl_info->active = pinctrl_lookup_state(pinctrl,
"active");
else
pinctrl_info->active = pinctrl_lookup_state(pinctrl,
"default");
if (IS_ERR(pinctrl_info->active)) {
pr_err("%s: could not get active pin state\n",
__func__);
@ -4999,7 +5009,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
int ret = 0;
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int index = cpu_dai->id;
/* Rx and Tx DAIs should use same clk index */
int index = (cpu_dai->id) / 2;
unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS;
struct snd_soc_card *card = rtd->card;
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
@ -5028,10 +5039,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
mutex_lock(&intf_conf->lock);
if (++intf_conf->ref_cnt == 1) {
/* Check if msm needs to provide the clock to the interface */
if (!intf_conf->msm_is_mi2s_master) {
if (!intf_conf->msm_is_mi2s_master)
mi2s_clk[index].clk_id = mi2s_ebit_clk[index];
fmt = SND_SOC_DAIFMT_CBM_CFM;
}
ret = msm_mi2s_set_sclk(substream, true);
if (ret < 0) {
dev_err(rtd->card->dev,
@ -5040,13 +5049,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
goto clean_up;
}
ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
if (ret < 0) {
pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n",
__func__, index, ret);
goto clk_off;
}
pinctrl_info = &pdata->pinctrl_info[index];
if (pinctrl_info->pinctrl) {
ret_pinctrl = msm_set_pinctrl(pinctrl_info,
@ -5056,6 +5058,14 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
__func__, ret_pinctrl);
}
}
if (!intf_conf->msm_is_mi2s_master)
fmt = SND_SOC_DAIFMT_CBM_CFM;
ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
if (ret < 0) {
pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n",
__func__, index, ret);
goto clk_off;
}
clk_off:
if (ret < 0)
msm_mi2s_set_sclk(substream, false);
@ -5071,7 +5081,8 @@ static void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream)
{
int ret;
struct snd_soc_pcm_runtime *rtd = substream->private_data;
int index = rtd->cpu_dai->id;
/* Rx and Tx DAIs should use same clk index */
int index = (rtd->cpu_dai->id) / 2;
struct snd_soc_card *card = rtd->card;
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
struct msm_pinctrl_info *pinctrl_info = NULL;
@ -5157,7 +5168,7 @@ static struct snd_soc_dai_link msm_common_dai_links[] = {
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
.id = MSM_FRONTEND_DAI_VOICEMMODE1,
SND_SOC_DAILINK_REG(voicemmode1),
SND_SOC_DAILINK_REG(voicemmode1_hostless),
},
{
.name = "MSM VoIP",
@ -5171,7 +5182,7 @@ static struct snd_soc_dai_link msm_common_dai_links[] = {
/* this dainlink has playback support */
.ignore_pmdown_time = 1,
.id = MSM_FRONTEND_DAI_VOIP,
SND_SOC_DAILINK_REG(msmvoip),
SND_SOC_DAILINK_REG(msmvoip_hostless),
},
{
.name = MSM_DAILINK_NAME(ULL),
@ -5339,7 +5350,7 @@ static struct snd_soc_dai_link msm_common_dai_links[] = {
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
.id = MSM_FRONTEND_DAI_VOICEMMODE2,
SND_SOC_DAILINK_REG(voicemmode2),
SND_SOC_DAILINK_REG(voicemmode2_hostless),
},
/* LSM FE */
{

View file

@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
/*
* Copyright 2011, The Android Open Source Project
@ -148,6 +149,10 @@ static const char *const tdm_gpio_phandle[] = {"qcom,pri-tdm-gpios",
"qcom,hsif2-tdm-gpios",
};
static const char *const mclk_gpio_phandle[] = { "qcom,internal-mclk1-gpios" };
static bool mclk_enable_status = false;
enum {
TDM_0 = 0,
TDM_1,
@ -176,6 +181,11 @@ enum {
TDM_INTERFACE_MAX,
};
enum {
MCLK1 = 0,
MCLK_MAX,
};
struct tdm_port {
u32 mode;
u32 channel;
@ -937,6 +947,17 @@ static SOC_ENUM_SINGLE_EXT_DECL(mi2s_tx_format, bit_format_text);
static SOC_ENUM_SINGLE_EXT_DECL(aux_pcm_rx_format, bit_format_text);
static SOC_ENUM_SINGLE_EXT_DECL(aux_pcm_tx_format, bit_format_text);
static struct afe_clk_set internal_mclk[MCLK_MAX] = {
{
AFE_API_VERSION_CLOCK_SET_V2,
Q6AFE_LPASS_CLK_ID_MCLK_1,
Q6AFE_LPASS_IBIT_CLK_12_P288_MHZ,
Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO,
Q6AFE_LPASS_CLK_ROOT_DEFAULT,
1,
}
};
static struct afe_clk_set mi2s_clk[MI2S_MAX] = {
{
AFE_API_VERSION_I2S_CONFIG,
@ -983,6 +1004,7 @@ static struct afe_clk_set mi2s_clk[MI2S_MAX] = {
struct msm_asoc_mach_data {
struct msm_pinctrl_info pinctrl_info[TDM_INTERFACE_MAX];
struct msm_pinctrl_info mclk_pinctrl_info[MCLK_MAX];
struct mi2s_conf mi2s_intf_conf[MI2S_MAX];
struct tdm_conf tdm_intf_conf[TDM_INTERFACE_MAX];
};
@ -5008,7 +5030,8 @@ static int msm_mi2s_set_sclk(struct snd_pcm_substream *substream, bool enable)
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int port_id = 0;
int index = cpu_dai->id;
/* Rx and Tx DAIs should use same clk index */
int index = (cpu_dai->id) / 2;
port_id = msm_get_port_id(rtd->dai_link->id);
if (port_id < 0) {
@ -5161,13 +5184,13 @@ static int msm_get_pinctrl(struct platform_device *pdev)
/* get all the states handles from Device Tree */
pinctrl_info->sleep = pinctrl_lookup_state(pinctrl,
"sleep");
"default");
if (IS_ERR(pinctrl_info->sleep)) {
pr_err("%s: could not get sleep pin state\n", __func__);
goto err;
}
pinctrl_info->active = pinctrl_lookup_state(pinctrl,
"default");
"active");
if (IS_ERR(pinctrl_info->active)) {
pr_err("%s: could not get active pin state\n",
__func__);
@ -5200,6 +5223,92 @@ err:
return -EINVAL;
}
static int msm_pinctrl_mclk_enable(struct platform_device *pdev)
{
struct snd_soc_card *card = platform_get_drvdata(pdev);
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
struct msm_pinctrl_info *pinctrl_info = NULL;
struct pinctrl *pinctrl = NULL;
int pinctrl_num;
int i, j;
struct device_node *np = NULL;
struct platform_device *pdev_np = NULL;
int ret = 0;
pinctrl_num = MCLK_MAX;
for (i = 0; i < pinctrl_num; i++) {
np = of_parse_phandle(pdev->dev.of_node, mclk_gpio_phandle[i], 0);
if (!np) {
pr_err("%s: device node %s is null\n", __func__, mclk_gpio_phandle[i]);
continue;
}
pdev_np = of_find_device_by_node(np);
if (!pdev_np) {
pr_err("%s: platform device not found\n", __func__);
continue;
}
pinctrl_info = &pdata->mclk_pinctrl_info[i];
if (pinctrl_info == NULL) {
pr_err("%s: pinctrl info is null\n", __func__);
continue;
}
pinctrl = devm_pinctrl_get(&pdev_np->dev);
if (IS_ERR_OR_NULL(pinctrl)) {
pr_err("%s: fail to get pinctrl handle\n", __func__);
goto err;
}
pinctrl_info->pinctrl = pinctrl;
/* get all the states handles from Device Tree */
pinctrl_info->sleep = pinctrl_lookup_state(pinctrl,
"sleep");
if (IS_ERR(pinctrl_info->sleep)) {
pr_err("%s: could not get sleep pin state\n", __func__);
goto err;
}
pinctrl_info->active = pinctrl_lookup_state(pinctrl,
"default");
if (IS_ERR(pinctrl_info->active)) {
pr_err("%s: could not get active pin state\n", __func__);
goto err;
}
/* Reset the mclk pins to a active state */
ret = afe_set_lpass_clock_v2(AFE_PORT_ID_TDM_PORT_RANGE_START,
&internal_mclk[i]);
if (ret < 0) {
pr_err("%s: afe lpass clock failed to enable clock, err:%d\n",
__func__, ret);
ret = -EIO;
goto err;
}
mclk_enable_status = true;
ret = pinctrl_select_state(pinctrl_info->pinctrl, pinctrl_info->active);
if (ret != 0) {
pr_err("%s: set pin state to active failed with %d\n",
__func__, ret);
ret = -EIO;
goto err;
}
pinctrl_info->curr_state = STATE_ACTIVE;
}
return 0;
err:
for (j = i; j >= 0; j--) {
pinctrl_info = &pdata->mclk_pinctrl_info[i];
if (pinctrl_info == NULL)
continue;
if (pinctrl_info->pinctrl) {
devm_pinctrl_put(pinctrl_info->pinctrl);
pinctrl_info->pinctrl = NULL;
}
}
return -EINVAL;
}
static int msm_tdm_get_intf_idx(u16 id)
{
switch (id) {
@ -7290,7 +7399,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
int ret = 0;
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int index = cpu_dai->id;
/* Rx and Tx DAIs should use same clk index */
int index = (cpu_dai->id) / 2;
unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS;
struct snd_soc_card *card = rtd->card;
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
@ -7319,10 +7429,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
mutex_lock(&intf_conf->lock);
if (++intf_conf->ref_cnt == 1) {
/* Check if msm needs to provide the clock to the interface */
if (!intf_conf->msm_is_mi2s_master) {
if (!intf_conf->msm_is_mi2s_master)
mi2s_clk[index].clk_id = mi2s_ebit_clk[index];
fmt = SND_SOC_DAIFMT_CBM_CFM;
}
ret = msm_mi2s_set_sclk(substream, true);
if (ret < 0) {
dev_err(rtd->card->dev,
@ -7331,13 +7439,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
goto clean_up;
}
ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
if (ret < 0) {
pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n",
__func__, index, ret);
goto clk_off;
}
pinctrl_info = &pdata->pinctrl_info[index];
if (pinctrl_info->pinctrl) {
ret_pinctrl = msm_set_pinctrl(pinctrl_info,
@ -7347,6 +7448,14 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
__func__, ret_pinctrl);
}
}
if (!intf_conf->msm_is_mi2s_master)
fmt = SND_SOC_DAIFMT_CBM_CFM;
ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
if (ret < 0) {
pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n",
__func__, index, ret);
goto clk_off;
}
clk_off:
if (ret < 0)
msm_mi2s_set_sclk(substream, false);
@ -7362,7 +7471,8 @@ static void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream)
{
int ret;
struct snd_soc_pcm_runtime *rtd = substream->private_data;
int index = rtd->cpu_dai->id;
/* Rx and Tx DAIs should use same clk index */
int index = (rtd->cpu_dai->id) / 2;
struct snd_soc_card *card = rtd->card;
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
struct msm_pinctrl_info *pinctrl_info = NULL;
@ -7448,7 +7558,7 @@ static struct snd_soc_dai_link msm_common_dai_links[] = {
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
.id = MSM_FRONTEND_DAI_VOICEMMODE1,
SND_SOC_DAILINK_REG(voicemmode1),
SND_SOC_DAILINK_REG(voicemmode1_hostless),
},
{
.name = "MSM VoIP",
@ -7462,7 +7572,7 @@ static struct snd_soc_dai_link msm_common_dai_links[] = {
/* this dainlink has playback support */
.ignore_pmdown_time = 1,
.id = MSM_FRONTEND_DAI_VOIP,
SND_SOC_DAILINK_REG(msmvoip),
SND_SOC_DAILINK_REG(msmvoip_hostless),
},
{
.name = MSM_DAILINK_NAME(ULL),
@ -7630,7 +7740,7 @@ static struct snd_soc_dai_link msm_common_dai_links[] = {
.ignore_suspend = 1,
.ignore_pmdown_time = 1,
.id = MSM_FRONTEND_DAI_VOICEMMODE2,
SND_SOC_DAILINK_REG(voicemmode2),
SND_SOC_DAILINK_REG(voicemmode2_hostless),
},
/* LSM FE */
{
@ -10566,6 +10676,7 @@ static int sa8155_ssr_enable(struct device *dev, void *data)
struct platform_device *pdev = to_platform_device(dev);
struct snd_soc_card *card = platform_get_drvdata(pdev);
int ret = 0;
int i;
if (!card) {
dev_err(dev, "%s: card is NULL\n", __func__);
@ -10573,6 +10684,19 @@ static int sa8155_ssr_enable(struct device *dev, void *data)
goto err;
}
if (mclk_enable_status == true) {
for (i = 0; i < MCLK_MAX; i++) {
ret = afe_set_lpass_clock_v2(AFE_PORT_ID_TDM_PORT_RANGE_START,
&internal_mclk[i]);
if (ret < 0) {
pr_err("%s: afe lpass clock failed to enable clock, err:%d\n",
__func__, ret);
ret = -EIO;
goto err;
}
}
}
dev_info(dev, "%s: setting snd_card to ONLINE\n", __func__);
#if IS_ENABLED(CONFIG_AUDIO_QGKI)
snd_soc_card_change_online_state(card, 1);
@ -10642,6 +10766,7 @@ static int msm_asoc_machine_probe(struct platform_device *pdev)
int ret;
enum apr_subsys_state q6_state;
static int first_probe = 1;
const struct of_device_id *match;
if (first_probe) {
place_marker("M - DRIVER Audio Init");
@ -10723,6 +10848,24 @@ static int msm_asoc_machine_probe(struct platform_device *pdev)
ret = 0;
}
match = of_match_node(sa8155_asoc_machine_of_match, pdev->dev.of_node);
if (!match) {
dev_err(&pdev->dev, "%s: No DT match found for sound card\n", __func__);
return -EINVAL;
}
if (strstr(match->compatible, "sa8295")) {
/* enable mclk pinctrl info from devicetree */
ret = msm_pinctrl_mclk_enable(pdev);
if (!ret) {
pr_debug("%s: pinctrl mclk parsing successful\n", __func__);
} else {
dev_err(&pdev->dev,
"%s: pinctrl mclk parsing failed with %d\n",
__func__, ret);
ret = 0;
}
}
msm_i2s_auxpcm_init(pdev);
ret = msm_audio_ssr_register(&pdev->dev);

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2016-2019, 2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/clk.h>
@ -4404,7 +4405,8 @@ static int msm_mi2s_set_sclk(struct snd_pcm_substream *substream, bool enable)
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int port_id = 0;
int index = cpu_dai->id;
/* Rx and Tx DAIs should use same clk index */
int index = (cpu_dai->id) / 2;
port_id = msm_get_port_id(rtd->dai_link->id);
if (port_id < 0) {
@ -4824,7 +4826,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
int ret = 0;
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int index = cpu_dai->id;
/* Rx and Tx DAIs should use same clk index */
int index = (cpu_dai->id) / 2;
unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS;
struct snd_soc_card *card = rtd->card;
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
@ -4851,10 +4854,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
mutex_lock(&mi2s_intf_conf[index].lock);
if (++mi2s_intf_conf[index].ref_cnt == 1) {
/* Check if msm needs to provide the clock to the interface */
if (!mi2s_intf_conf[index].msm_is_mi2s_master) {
if (!mi2s_intf_conf[index].msm_is_mi2s_master)
mi2s_clk[index].clk_id = mi2s_ebit_clk[index];
fmt = SND_SOC_DAIFMT_CBM_CFM;
}
ret = msm_mi2s_set_sclk(substream, true);
if (ret < 0) {
dev_err(rtd->card->dev,
@ -4863,12 +4864,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
goto clean_up;
}
ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
if (ret < 0) {
pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n",
__func__, index, ret);
goto clk_off;
}
if (index == QUAT_MI2S) {
ret_pinctrl = msm_set_pinctrl(pinctrl_info,
STATE_MI2S_ACTIVE);
@ -4877,6 +4872,14 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
__func__, ret_pinctrl);
}
}
if (!mi2s_intf_conf[index].msm_is_mi2s_master)
fmt = SND_SOC_DAIFMT_CBM_CFM;
ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
if (ret < 0) {
pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n",
__func__, index, ret);
goto clk_off;
}
clk_off:
if (ret < 0)
msm_mi2s_set_sclk(substream, false);
@ -4892,7 +4895,8 @@ static void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream)
{
int ret;
struct snd_soc_pcm_runtime *rtd = substream->private_data;
int index = rtd->cpu_dai->id;
/* Rx and Tx DAIs should use same clk index */
int index = (rtd->cpu_dai->id) / 2;
struct snd_soc_card *card = rtd->card;
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
struct msm_pinctrl_info *pinctrl_info = &pdata->pinctrl_info;

View file

@ -0,0 +1,145 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef _TALOS_PORT_CONFIG
#define _TALOS_PORT_CONFIG
#include <soc/swr-common.h>
#define WSA_MSTR_PORT_MASK 0xFF
/*
* Add port configuration in the format
*{ si, off1, off2, hstart, hstop, wd_len, bp_mode, bgp_ctrl, lane_ctrl, dir,
* stream_type}
*/
static struct port_params wsa_frame_params_default[SWR_MSTR_PORT_LEN] = {
{7, 1, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00},
{31, 2, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00},
{63, 12, 31, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00},
{7, 6, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00},
{31, 18, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00},
{63, 13, 31, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00},
{15, 7, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00},
{15, 10, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00},
};
static struct port_params wsa_frame_params_receiver[SWR_MSTR_PORT_LEN] = {
{3, 1, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00},
{31, 2, 3, 0xFF, 0xFF, 0xFF, 0x1, 0xFF, 0xFF, 0x00, 0x00},
{63, 7, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00},
{3, 6, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00},
{31, 18, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00},
{63, 13, 31, 0xFF, 0xFF, 0xFF, 0x1, 0xFF, 0xFF, 0x00, 0x00},
{15, 3, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00},
{15, 10, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00},
};
static struct port_params rx_frame_params_dsd[SWR_MSTR_PORT_LEN] = {
{3, 0, 0, 0xFF, 0xFF, 1, 0xFF, 0xFF, 1, 0x00, 0x00},
{31, 0, 0, 3, 6, 7, 0, 0xFF, 0, 0x00, 0x00},
{31, 11, 11, 0xFF, 0xFF, 4, 1, 0xFF, 0, 0x00, 0x00},
{7, 9, 0, 0xFF, 0xFF, 0xFF, 0xFF, 1, 0, 0x00, 0x00},
{3, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 3, 0, 0x00, 0x00},
};
/* Headset + PCM Haptics */
static struct port_params rx_frame_params_default[SWR_MSTR_PORT_LEN] = {
{3, 0, 0, 0xFF, 0xFF, 1, 0xFF, 0xFF, 1, 0x00, 0x00}, /* HPH/EAR */
{31, 0, 0, 3, 6, 7, 0, 0xFF, 0, 0x00, 0x00}, /* HPH_CLH */
{31, 11, 11, 0xFF, 0xFF, 4, 1, 0xFF, 0, 0x00, 0x00}, /* HPH_CMP */
{7, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0x00, 0x00}, /* LO/AUX */
{0, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0, 0x00, 0x00}, /* DSD */
{0x18F, 0, 0, 0x8, 0x8, 0x0F, 0x00, 0, 0, 0x00, 0x01}, /* PCM_OUT */
};
/* Headset(44.1K) + PCM Haptics */
static struct port_params rx_frame_params_44p1KHz[SWR_MSTR_PORT_LEN] = {
{3, 0, 0, 0xFF, 0xFF, 1, 0xFF, 0xFF, 1, 0x00, 0x00}, /* HPH/EAR */
{63, 0, 0, 3, 6, 7, 0, 0xFF, 0, 0x00, 0x00}, /* HPH_CLH */
{31, 11, 11, 0xFF, 0xFF, 4, 1, 0xFF, 0, 0x00, 0x00}, /* HPH_CMP */
{3, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0, 0x00, 0x00}, /* LO/AUX */
{0, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0, 0x00, 0x00}, /* DSD */
{0x1FF, 0, 0, 0x8, 0x8, 0x0F, 0, 0, 0, 0x00, 0x01}, /* PCM_OUT */
};
/* TX UC1: TX1: 1ch, TX2: 2chs, TX3: 1ch(MBHC) */
static struct port_params tx_frame_params_default[SWR_MSTR_PORT_LEN] = {
{7, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0x00, 0x00}, /* TX1 */
{3, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 1, 0x00, 0x00}, /* TX2 */
{7, 5, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0x00, 0x00}, /* TX3 */
};
/* 4.8 MHz clock */
static struct port_params tx_frame_params_4p8MHz[SWR_MSTR_PORT_LEN] = {
{15, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0x00, 0x00}, /* TX1 */
{3, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 1, 0x00, 0x00}, /* TX2 */
{3, 2, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0x00, 0x00}, /* TX3 */
};
/* 0.6 MHz clock */
static struct port_params tx_frame_params_0p6MHz[SWR_MSTR_PORT_LEN] = {
{1, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0x00, 0x00}, /* TX1 */
{1, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0x00, 0x00}, /* TX2 */
{1, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0x00, 0x00}, /* TX3 */
};
static struct port_params tx_frame_params_wcd937x[SWR_MSTR_PORT_LEN] = {
{3, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 1, 0x00, 0x00}, /* TX1 */
{3, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0x00, 0x00}, /* TX2 */
{3, 2, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0x00, 0x00}, /* TX3 */
};
static struct swr_mstr_port_map sm_port_map[] = {
{TX_MACRO, SWR_UC0, tx_frame_params_default},
{TX_MACRO, SWR_UC1, tx_frame_params_4p8MHz},
{TX_MACRO, SWR_UC2, tx_frame_params_0p6MHz},
{RX_MACRO, SWR_UC0, rx_frame_params_default},
{RX_MACRO, SWR_UC1, rx_frame_params_dsd},
{RX_MACRO, SWR_UC2, rx_frame_params_44p1KHz},
{WSA_MACRO, SWR_UC0, wsa_frame_params_default},
{WSA_MACRO, SWR_UC1, wsa_frame_params_receiver},
};
static struct swr_mstr_port_map sm_port_map_tavil[] = {
{TX_MACRO, SWR_UC0, tx_frame_params_default},
{TX_MACRO, SWR_UC1, tx_frame_params_4p8MHz},
{TX_MACRO, SWR_UC2, tx_frame_params_0p6MHz},
{RX_MACRO, SWR_UC0, rx_frame_params_default},
{RX_MACRO, SWR_UC1, rx_frame_params_dsd},
{RX_MACRO, SWR_UC2, rx_frame_params_44p1KHz},
{WSA_MACRO, SWR_UC0, wsa_frame_params_default},
{WSA_MACRO, SWR_UC1, wsa_frame_params_receiver},
};
static struct swr_mstr_port_map sm_port_map_tasha[] = {
{TX_MACRO, SWR_UC0, tx_frame_params_default},
{TX_MACRO, SWR_UC1, tx_frame_params_4p8MHz},
{TX_MACRO, SWR_UC2, tx_frame_params_0p6MHz},
{RX_MACRO, SWR_UC0, rx_frame_params_default},
{RX_MACRO, SWR_UC1, rx_frame_params_dsd},
{RX_MACRO, SWR_UC2, rx_frame_params_44p1KHz},
{WSA_MACRO, SWR_UC0, wsa_frame_params_default},
{WSA_MACRO, SWR_UC1, wsa_frame_params_receiver},
};
static struct swr_mstr_port_map sm_port_map_tavil_wsa[] = {
{WSA_MACRO, SWR_UC0, wsa_frame_params_default},
{WSA_MACRO, SWR_UC1, wsa_frame_params_receiver},
};
static struct swr_mstr_port_map sm_port_map_wcd937x[] = {
{TX_MACRO, SWR_UC0, tx_frame_params_wcd937x},
{TX_MACRO, SWR_UC1, tx_frame_params_wcd937x},
{TX_MACRO, SWR_UC2, tx_frame_params_wcd937x},
{RX_MACRO, SWR_UC0, rx_frame_params_default},
{RX_MACRO, SWR_UC1, rx_frame_params_dsd},
{RX_MACRO, SWR_UC2, rx_frame_params_44p1KHz},
{WSA_MACRO, SWR_UC0, wsa_frame_params_default},
{WSA_MACRO, SWR_UC1, wsa_frame_params_receiver},
};
#endif /* _TALOS_PORT_CONFIG */

8
techpack/audio/config/gvmauto.conf Executable file → Normal file
View file

@ -1,3 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (c) 2021, The Linux Foundation. All rights reserved.
ifeq ($(CONFIG_QGKI), y)
export CONFIG_SND_SOC_GVM_AUTO_SPF=m
export CONFIG_MSM_QDSP6_APRV2_VM=m
export CONFIG_MSM_QDSP6_SSR=m
@ -7,11 +11,9 @@ export CONFIG_SND_SOC_MSM_QDSP6V2_VM=m
export CONFIG_SND_SOC_QDSP6V2=m
export CONFIG_QTI_PP=m
export CONFIG_SND_HWDEP_ROUTING=m
export CONFIG_DTS_EAGLE=m
export CONFIG_DOLBY_DS2=m
export CONFIG_DOLBY_LICENSE=m
export CONFIG_SND_SOC_MSM_STUB=m
export CONFIG_SND_SOC_MSM_HDMI_CODEC_RX=m
export CONFIG_MSM_QDSP6V2_CODECS=m
export CONFIG_SND_EVENT=m
export CONFIG_SND_SOC_SA8155=m
endif

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2018-2019, 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
@ -19,9 +19,6 @@
#define CONFIG_SND_SOC_QDSP6V2 1
#define CONFIG_QTI_PP 1
#define CONFIG_SND_HWDEP_ROUTING 1
#define CONFIG_DTS_EAGLE 1
#define CONFIG_DOLBY_DS2 1
#define CONFIG_DOLBY_LICENSE 1
#define CONFIG_SND_SOC_MSM_STUB 1
#define CONFIG_SND_SOC_MSM_HDMI_CODEC_RX 1
#define CONFIG_MSM_QDSP6V2_CODECS 1

View file

@ -1,5 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (c) 2020, The Linux Foundation. All rights reserved.
/* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
*/
#define CONFIG_PINCTRL_LPI 1
@ -43,3 +43,4 @@
#define CONFIG_SND_SWR_HAPTICS 1
#define CONFIG_DIGITAL_CDC_RSC_MGR 1
#define CONFIG_AUXPCM_DISABLE 1
#define CONFIG_SWRM_VER_1P6 1

View file

@ -5,9 +5,6 @@ export CONFIG_MSM_QDSP6_NOTIFIER=m
export CONFIG_SND_SOC_MSM_QDSP6V2_INTF=m
export CONFIG_QTI_PP=m
export CONFIG_SND_HWDEP_ROUTING=m
export CONFIG_DTS_EAGLE=m
export CONFIG_DOLBY_DS2=m
export CONFIG_DOLBY_LICENSE=m
export CONFIG_SND_SOC_MSM_STUB=m
export CONFIG_SND_SOC_MSM_HDMI_CODEC_RX=m
export CONFIG_MSM_QDSP6V2_CODECS=m

View file

@ -17,9 +17,6 @@
#define CONFIG_SND_SOC_MSM_QDSP6V2_INTF 1
#define CONFIG_QTI_PP 1
#define CONFIG_SND_HWDEP_ROUTING 1
#define CONFIG_DTS_EAGLE 1
#define CONFIG_DOLBY_DS2 1
#define CONFIG_DOLBY_LICENSE 1
#define CONFIG_SND_SOC_MSM_STUB 1
#define CONFIG_SND_SOC_MSM_HDMI_CODEC_RX 1
#define CONFIG_MSM_QDSP6V2_CODECS 1

View file

@ -6,9 +6,6 @@ export CONFIG_SND_SOC_MSM_QDSP6V2_INTF=m
export CONFIG_SND_SOC_QDSP6V2=m
export CONFIG_QTI_PP=m
export CONFIG_SND_HWDEP_ROUTING=m
export CONFIG_DTS_EAGLE=m
export CONFIG_DOLBY_DS2=m
export CONFIG_DOLBY_LICENSE=m
export CONFIG_SND_SOC_MSM_STUB=m
export CONFIG_SND_SOC_MSM_HDMI_CODEC_RX=m
export CONFIG_MSM_QDSP6V2_CODECS=m

View file

@ -1,5 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (c) 2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2019, 2021 The Linux Foundation. All rights reserved.
*/
#define CONFIG_MSM_QDSP6_APRV2_RPMSG 1
@ -10,9 +10,6 @@
#define CONFIG_SND_SOC_QDSP6V2 1
#define CONFIG_QTI_PP 1
#define CONFIG_SND_HWDEP_ROUTING 1
#define CONFIG_DTS_EAGLE 1
#define CONFIG_DOLBY_DS2 1
#define CONFIG_DOLBY_LICENSE 1
#define CONFIG_SND_SOC_MSM_STUB 1
#define CONFIG_SND_SOC_MSM_HDMI_CODEC_RX 1
#define CONFIG_MSM_QDSP6V2_CODECS 1

View file

@ -1,48 +1,49 @@
CONFIG_PINCTRL_WCD=m
CONFIG_PINCTRL_LPI=m
CONFIG_AUDIO_EXT_CLK=m
CONFIG_SND_SOC_WCD9XXX_V2=m
CONFIG_SND_SOC_WCD_MBHC=m
CONFIG_SND_SOC_WSA881X=m
CONFIG_SND_SOC_WCD_DSP_MGR=m
CONFIG_SND_SOC_WCD_SPI=m
CONFIG_SND_SOC_WCD934X=m
CONFIG_SND_SOC_WCD934X_MBHC=m
CONFIG_SND_SOC_WCD934X_DSD=m
CONFIG_WCD9XXX_CODEC_CORE=m
CONFIG_MSM_CDC_PINCTRL=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_PDR=m
CONFIG_MSM_QDSP6_NOTIFIER=m
CONFIG_SND_SOC_MSM_HOSTLESS_PCM=m
CONFIG_SND_SOC_MSM_QDSP6V2_INTF=m
CONFIG_SND_SOC_SM6150=m
CONFIG_MSM_GLINK_SPI_XPRT=m
CONFIG_WCD_DSP_GLINK=m
CONFIG_SOUNDWIRE=m
CONFIG_SOUNDWIRE_MSTR_CTRL=m
CONFIG_SND_SOC_QDSP6V2=m
CONFIG_SND_SOC_WCD_MBHC_ADC=m
CONFIG_QTI_PP=m
CONFIG_SND_HWDEP_ROUTING=m
CONFIG_DTS_EAGLE=m
CONFIG_DOLBY_DS2=m
CONFIG_DOLBY_LICENSE=m
CONFIG_DTS_SRS_TM=m
CONFIG_SND_SOC_MSM_STUB=m
CONFIG_MSM_AVTIMER=m
CONFIG_SND_SOC_MSM_HDMI_CODEC_RX=m
CONFIG_SND_SOC_BOLERO=m
CONFIG_WSA_MACRO=m
CONFIG_VA_MACRO=m
CONFIG_RX_MACRO=m
CONFIG_TX_MACRO=m
CONFIG_SND_SOC_WCD_IRQ=m
CONFIG_SND_SOC_WCD937X=m
CONFIG_SND_SOC_WCD937X_SLAVE=m
CONFIG_SND_EVENT=m
export CONFIG_PINCTRL_WCD=m
export CONFIG_PINCTRL_LPI=m
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_WCD_DSP_MGR=m
export CONFIG_SND_SOC_WCD_SPI=m
export CONFIG_SND_SOC_WCD934X=m
export CONFIG_SND_SOC_WCD934X_MBHC=m
export CONFIG_SND_SOC_WCD934X_DSD=m
export CONFIG_WCD9XXX_CODEC_CORE=m
export CONFIG_MSM_CDC_PINCTRL=m
export CONFIG_MSM_QDSP6V2_CODECS=m
export CONFIG_MSM_ULTRASOUND=m
export CONFIG_MSM_QDSP6_APRV2_RPMSG=m
export CONFIG_MSM_ADSP_LOADER=m
export CONFIG_REGMAP_SWR=m
export CONFIG_MSM_QDSP6_SSR=m
export CONFIG_MSM_QDSP6_PDR=m
export CONFIG_MSM_QDSP6_NOTIFIER=m
export CONFIG_SND_SOC_MSM_HOSTLESS_PCM=m
export CONFIG_SND_SOC_MSM_QDSP6V2_INTF=m
export CONFIG_SND_SOC_SM6150=m
export CONFIG_MSM_GLINK_SPI_XPRT=m
export CONFIG_WCD_DSP_GLINK=m
export CONFIG_SOUNDWIRE=m
export CONFIG_SOUNDWIRE_MSTR_CTRL=m
export CONFIG_SND_SOC_QDSP6V2=m
export CONFIG_SND_SOC_WCD_MBHC_ADC=m
export CONFIG_QTI_PP=m
export CONFIG_SND_HWDEP_ROUTING=m
export CONFIG_DTS_EAGLE=m
export CONFIG_DOLBY_DS2=m
export CONFIG_DOLBY_LICENSE=m
export CONFIG_DTS_SRS_TM=m
export CONFIG_SND_SOC_MSM_STUB=m
export CONFIG_MSM_AVTIMER=m
export CONFIG_SND_SOC_MSM_HDMI_CODEC_RX=m
export CONFIG_SND_SOC_BOLERO=m
export CONFIG_WSA_MACRO=m
export CONFIG_VA_MACRO=m
export CONFIG_RX_MACRO=m
export CONFIG_TX_MACRO=m
export CONFIG_SND_SOC_WCD_IRQ=m
export CONFIG_SND_SOC_WCD937X=m
export CONFIG_SND_SOC_WCD937X_SLAVE=m
export CONFIG_SND_EVENT=m
export CONFIG_HSIF_DISABLE=m

View file

@ -51,3 +51,4 @@
#define CONFIG_SND_SOC_WCD937X 1
#define CONFIG_SND_SOC_WCD937X_SLAVE 1
#define CONFIG_SND_EVENT 1
#define CONFIG_HSIF_DISABLE 1

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2012-2014, 2017-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2014, 2017-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/init.h>
@ -24,6 +24,7 @@
#define SSR_RESET_CMD 1
#define IMAGE_UNLOAD_CMD 0
#define MAX_FW_IMAGES 4
#define BOOT_FOR_EARLY_CHIME_CMD 2
static ssize_t adsp_boot_store(struct kobject *kobj,
struct kobj_attribute *attr,
@ -260,7 +261,11 @@ static ssize_t adsp_boot_store(struct kobject *kobj,
} else if (boot == IMAGE_UNLOAD_CMD) {
pr_debug("%s: going to call adsp_unloader\n", __func__);
adsp_loader_unload(adsp_private);
} else if (boot == BOOT_FOR_EARLY_CHIME_CMD) {
pr_debug("%s: going to call adsp_load_fw\n", __func__);
adsp_load_fw(NULL);
}
return count;
}

11
techpack/audio/dsp/audio_calibration.c Executable file → Normal file
View file

@ -148,7 +148,7 @@ int audio_cal_register(int num_cal_types,
GFP_KERNEL);
if (callback_node == NULL) {
ret = -ENOMEM;
goto err;
goto err_callback_node;
}
memcpy(callback_node, &reg_data[i].callbacks,
@ -160,10 +160,13 @@ int audio_cal_register(int num_cal_types,
&audio_cal.client_info[reg_data[i].cal_type]);
mutex_unlock(&audio_cal.cal_mutex[reg_data[i].cal_type]);
}
done:
return ret;
goto done;
err_callback_node:
kfree(client_info_node);
err:
audio_cal_deregister(num_cal_types, reg_data);
done:
return ret;
}
@ -619,7 +622,9 @@ void audio_cal_exit(void)
kfree(client_info_node);
client_info_node = NULL;
}
mutex_destroy(&audio_cal.cal_mutex[i]);
}
mutex_destroy(&audio_cal.common_lock);
misc_deregister(&audio_cal_misc);
}

19
techpack/audio/dsp/q6adm.c Executable file → Normal file
View file

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/module.h>
#include <linux/slab.h>
@ -2720,9 +2721,8 @@ static int adm_arrange_mch_map_v8(
goto non_mch_path;
};
if ((ep_payload->dev_num_channel > 2) &&
(port_channel_map[port_idx].set_channel_map ||
multi_ch_maps[idx].set_channel_map)) {
if (port_channel_map[port_idx].set_channel_map ||
multi_ch_maps[idx].set_channel_map) {
if (port_channel_map[port_idx].set_channel_map)
memcpy(ep_payload->dev_channel_mapping,
port_channel_map[port_idx].channel_mapping,
@ -3290,6 +3290,8 @@ int adm_open_v2(int port_id, int path, int rate, int channel_mode, int topology,
(topology == DS2_ADM_COPP_TOPOLOGY_ID) ||
(topology == SRS_TRUMEDIA_TOPOLOGY_ID))
topology = DEFAULT_COPP_TOPOLOGY;
} else if (perf_mode == LOW_LATENCY_PCM_NOPROC_MODE) {
flags = ADM_LOW_LATENCY_NPROC_DEVICE_SESSION;
} else {
if ((path == ADM_PATH_COMPRESSED_RX) ||
(path == ADM_PATH_COMPRESSED_TX))
@ -4312,7 +4314,6 @@ EXPORT_SYMBOL(adm_close);
int send_rtac_audvol_cal(void)
{
int ret = 0;
int ret2 = 0;
int i = 0;
int copp_idx, port_idx, acdb_id, app_id, path;
struct cal_block_data *cal_block = NULL;
@ -4358,7 +4359,7 @@ int send_rtac_audvol_cal(void)
continue;
}
ret2 = adm_remap_and_send_cal_block(ADM_RTAC_AUDVOL_CAL,
ret = adm_remap_and_send_cal_block(ADM_RTAC_AUDVOL_CAL,
rtac_adm_data.device[i].afe_port,
copp_idx, cal_block,
atomic_read(&this_adm.copp.
@ -4367,13 +4368,12 @@ int send_rtac_audvol_cal(void)
audvol_cal_info->acdb_id,
atomic_read(&this_adm.copp.
rate[port_idx][copp_idx]));
if (ret2 < 0) {
if (ret < 0) {
pr_debug("%s: remap and send failed for copp Id %d, acdb id %d, app type %d, path %d\n",
__func__, rtac_adm_data.device[i].copp,
audvol_cal_info->acdb_id,
audvol_cal_info->app_type,
audvol_cal_info->path);
ret = ret2;
}
}
}
@ -5215,6 +5215,7 @@ int adm_wait_timeout(int port_id, int copp_idx, int wait_time)
pr_debug("%s: return %d\n", __func__, ret);
if (ret != 0)
ret = -EINTR;
end:
pr_debug("%s: return %d--\n", __func__, ret);
return ret;
@ -5275,8 +5276,10 @@ int adm_store_cal_data(int port_id, int copp_idx, int path, int perf_mode,
mutex_lock(&this_adm.cal_data[cal_index]->lock);
cal_block = adm_find_cal(cal_index, get_cal_path(path), app_type,
acdb_id, sample_rate);
if (cal_block == NULL)
if (cal_block == NULL) {
pr_err("%s: can't find cal block!\n", __func__);
goto unlock;
}
if (cal_block->cal_data.size <= 0) {
pr_debug("%s: No ADM cal send for port_id = 0x%x!\n",

View file

@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/slab.h>
#include <linux/debugfs.h>
@ -443,12 +444,14 @@ static int q6afe_load_avcs_modules(int num_modules, u16 port_id,
AVS_MODULE_ID_DEPACKETIZER_COP;
goto load_unload;
}
if (format_id == ASM_MEDIA_FMT_LC3 ||
format_id == ASM_MEDIA_FMT_APTX_ADAPTIVE) {
if (format_id == ASM_MEDIA_FMT_LC3) {
pm[i]->payload->load_unload_info[0].id1 =
AVS_MODULE_ID_DEPACKETIZER_COP_V2;
goto load_unload;
}
if (format_id == ASM_MEDIA_FMT_APTX_ADAPTIVE) {
goto load_unload;
}
pm[i]->payload->load_unload_info[1].module_type =
AMDB_MODULE_TYPE_DECODER;
@ -2141,12 +2144,15 @@ static int afe_send_cal_block(u16 port_id, struct cal_block_data *cal_block)
result = -EINVAL;
goto done;
}
if (cal_block->cal_data.size <= 0) {
if (cal_block->cal_data.size < 0) {
pr_debug("%s: AFE cal has invalid size!\n", __func__);
result = -EINVAL;
goto done;
}
if (cal_block->cal_data.size == 0) {
pr_debug("%s: AFE cal size is zero!\n", __func__);
goto done;
}
payload_size = cal_block->cal_data.size;
mem_hdr.data_payload_addr_lsw =
lower_32_bits(cal_block->cal_data.paddr);
@ -3460,6 +3466,11 @@ int afe_send_port_vad_cfg_params(u16 port_id)
return 0;
}
ret = afe_validate_port(port_id);
if (ret < 0) {
pr_err("%s: Not a valid port id = 0x%x ret %d\n", __func__,
port_id, ret);
}
port_index = afe_get_port_index(port_id);
if (this_afe.vad_cfg[port_index].is_enable) {
@ -4686,9 +4697,16 @@ EXPORT_SYMBOL(afe_tdm_port_start);
void afe_set_cal_mode(u16 port_id, enum afe_cal_mode afe_cal_mode)
{
uint16_t port_index;
int ret = 0;
port_index = afe_get_port_index(port_id);
this_afe.afe_cal_mode[port_index] = afe_cal_mode;
ret = afe_validate_port(port_id);
if (ret < 0) {
pr_err("%s: Not a valid port id = 0x%x ret %d\n", __func__,
port_id, ret);
} else {
port_index = afe_get_port_index(port_id);
this_afe.afe_cal_mode[port_index] = afe_cal_mode;
}
}
EXPORT_SYMBOL(afe_set_cal_mode);
@ -4723,10 +4741,17 @@ EXPORT_SYMBOL(afe_set_vad_cfg);
void afe_get_island_mode_cfg(u16 port_id, u32 *enable_flag)
{
uint16_t port_index;
int ret = 0;
if (enable_flag) {
port_index = afe_get_port_index(port_id);
*enable_flag = this_afe.island_mode[port_index];
ret = afe_validate_port(port_id);
if (ret < 0) {
pr_err("%s: Not a valid port id = 0x%x ret %d\n", __func__,
port_id, ret);
} else {
if (enable_flag) {
port_index = afe_get_port_index(port_id);
*enable_flag = this_afe.island_mode[port_index];
}
}
}
EXPORT_SYMBOL(afe_get_island_mode_cfg);
@ -4742,12 +4767,19 @@ EXPORT_SYMBOL(afe_get_island_mode_cfg);
void afe_set_island_mode_cfg(u16 port_id, u32 enable_flag)
{
uint16_t port_index;
int ret = 0;
port_index = afe_get_port_index(port_id);
this_afe.island_mode[port_index] = enable_flag;
ret = afe_validate_port(port_id);
if (ret < 0) {
pr_err("%s: Not a valid port id = 0x%x ret %d\n", __func__,
port_id, ret);
} else {
port_index = afe_get_port_index(port_id);
this_afe.island_mode[port_index] = enable_flag;
trace_printk("%s: set island mode cfg 0x%x for port 0x%x\n",
__func__, this_afe.island_mode[port_index], port_id);
trace_printk("%s: set island mode cfg 0x%x for port 0x%x\n",
__func__, this_afe.island_mode[port_index], port_id);
}
}
EXPORT_SYMBOL(afe_set_island_mode_cfg);
@ -4847,6 +4879,31 @@ int afe_port_send_logging_cfg(u16 port_id,
}
EXPORT_SYMBOL(afe_port_send_logging_cfg);
int afe_port_send_afe_limiter_param(u16 port_id,
struct afe_param_id_port_afe_limiter_disable_t *disable_limiter)
{
struct param_hdr_v3 param_hdr;
int ret = -EINVAL;
pr_debug("%s: enter, port: 0x%x logging flag: %x\n", __func__, port_id,
disable_limiter->disable_afe_limiter);
memset(&param_hdr, 0, sizeof(param_hdr));
param_hdr.module_id = AFE_MODULE_LIMITER;
param_hdr.instance_id = INSTANCE_ID_0;
param_hdr.param_id = AFE_PARAM_ID_ENABLE;
param_hdr.param_size = sizeof(struct afe_param_id_port_afe_limiter_disable_t);
ret = q6afe_pack_and_set_param_in_band(port_id,
q6audio_get_port_index(port_id), param_hdr, (u8*)disable_limiter);
if (ret)
pr_err("%s: AFE port logging setting for port 0x%x failed %d\n",
__func__, port_id, ret);
return ret;
}
EXPORT_SYMBOL(afe_port_send_afe_limiter_param);
int afe_port_send_usb_dev_param(u16 port_id, union afe_port_config *afe_config)
{
struct afe_param_id_usb_audio_dev_params usb_dev;
@ -8031,6 +8088,8 @@ int afe_register_get_events(u16 port_id,
pr_debug("%s: port_id: 0x%x\n", __func__, port_id);
memset(&rtproxy, 0, sizeof(rtproxy));
if (this_afe.apr == NULL) {
this_afe.apr = apr_register("ADSP", "AFE", afe_callback,
0xFFFFFFFF, &this_afe);
@ -8094,6 +8153,8 @@ int afe_unregister_get_events(u16 port_id)
pr_debug("%s:\n", __func__);
memset(&rtproxy, 0, sizeof(rtproxy));
if (this_afe.apr == NULL) {
this_afe.apr = apr_register("ADSP", "AFE", afe_callback,
0xFFFFFFFF, &this_afe);
@ -8178,6 +8239,8 @@ int afe_rt_proxy_port_write(phys_addr_t buf_addr_p,
int ret = 0;
struct afe_port_data_cmd_rt_proxy_port_write_v2 afecmd_wr;
memset(&afecmd_wr, 0, sizeof(afecmd_wr));
if (this_afe.apr == NULL) {
pr_err("%s: register to AFE is not done\n", __func__);
ret = -ENODEV;
@ -8237,6 +8300,8 @@ int afe_rt_proxy_port_read(phys_addr_t buf_addr_p,
struct afe_port_data_cmd_rt_proxy_port_read_v2 afecmd_rd;
int port_id = VIRTUAL_ID_TO_PORTID(id);
memset(&afecmd_rd, 0, sizeof(afecmd_rd));
if (this_afe.apr == NULL) {
pr_err("%s: register to AFE is not done\n", __func__);
ret = -ENODEV;
@ -8477,6 +8542,8 @@ int afe_dtmf_generate_rx(int64_t duration_in_ms,
pr_debug("%s: DTMF AFE Gen\n", __func__);
memset(&cmd_dtmf, 0, sizeof(cmd_dtmf));
if (afe_validate_port(this_afe.dtmf_gen_rx_portid) < 0) {
pr_err("%s: Failed : Invalid Port id = 0x%x\n",
__func__, this_afe.dtmf_gen_rx_portid);
@ -9223,6 +9290,8 @@ int afe_port_stop_nowait(int port_id)
struct afe_port_cmd_device_stop stop;
int ret = 0;
memset(&stop, 0, sizeof(stop));
if (this_afe.apr == NULL) {
pr_err("%s: AFE is already closed\n", __func__);
ret = -EINVAL;
@ -9266,6 +9335,8 @@ int afe_close(int port_id)
int index = 0;
uint16_t port_index;
memset(&stop, 0, sizeof(stop));
if (this_afe.apr == NULL) {
pr_err("%s: AFE is already closed\n", __func__);
@ -9750,7 +9821,6 @@ static int afe_set_lpass_clk_cfg_ext_mclk(int index, struct afe_clk_set *cfg,
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__,
@ -9789,6 +9859,83 @@ stop_mclk:
return ret;
}
int afe_set_lpass_clk_cfg_ext_mclk_v2(int index, struct afe_param_id_clock_set_v2_t *dyn_mclk_cfg,
uint32_t mclk_freq)
{
struct param_hdr_v3 param_hdr;
int ret = 0;
if (!dyn_mclk_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);
if (afe_ext_mclk.ext_mclk_cb) {
ret = afe_ext_mclk.ext_mclk_cb(afe_ext_mclk.private_data,
dyn_mclk_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;
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 && dyn_mclk_cfg->enable) {
afe_ext_mclk.ext_mclk_cb(afe_ext_mclk.private_data,
dyn_mclk_cfg->enable, mclk_freq, dyn_mclk_cfg);
}
return ret;
}
EXPORT_SYMBOL(afe_set_lpass_clk_cfg_ext_mclk_v2);
/**
* afe_set_lpass_clk_cfg - Set AFE clk config
*
@ -11542,7 +11689,7 @@ static int afe_unmap_cal_data(int32_t cal_type,
atomic_set(&this_afe.mem_map_cal_handles[cal_index],
cal_block->map_data.q6map_handle);
atomic_set(&this_afe.mem_map_cal_index, cal_index);
ret = afe_cmd_memory_unmap_nowait(
ret = afe_cmd_memory_unmap(
cal_block->map_data.q6map_handle);
atomic_set(&this_afe.mem_map_cal_index, -1);
if (ret < 0) {

View file

@ -12,6 +12,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/fs.h>
#include <linux/mutex.h>
@ -2191,8 +2192,12 @@ static int32_t q6asm_callback(struct apr_client_data *data, void *priv)
payload[0], payload[1],
data->src_port, data->dest_port);
if (payload[1] != 0) {
pr_err("%s: cmd = 0x%x returned error = 0x%x\n",
__func__, payload[0], payload[1]);
if (adsp_err_get_lnx_err_code(payload[1]) != -EALREADY)
pr_err("%s: cmd = 0x%x returned error = 0x%x\n",
__func__, payload[0], payload[1]);
else
pr_debug("%s: cmd = 0x%x returned error = 0x%x\n",
__func__, payload[0], payload[1]);
if (wakeup_flag) {
if ((is_adsp_reg_event(payload[0]) >=
0) ||
@ -3431,11 +3436,12 @@ static int __q6asm_open_read(struct audio_client *ac,
goto fail_cmd;
}
if (atomic_read(&ac->cmd_state) > 0) {
pr_err("%s: DSP returned error[%s]\n",
__func__, adsp_err_get_err_str(
atomic_read(&ac->cmd_state)));
rc = adsp_err_get_lnx_err_code(
atomic_read(&ac->cmd_state));
if (rc != -EALREADY)
pr_err("%s: DSP returned error[%s]\n",
__func__, adsp_err_get_err_str(
atomic_read(&ac->cmd_state)));
goto fail_cmd;
}
@ -3734,6 +3740,8 @@ static int __q6asm_open_write(struct audio_client *ac, uint32_t format,
open.mode_flags |= ASM_ULTRA_LOW_LATENCY_STREAM_SESSION;
else if (ac->perf_mode == LOW_LATENCY_PCM_MODE)
open.mode_flags |= ASM_LOW_LATENCY_STREAM_SESSION;
else if (ac->perf_mode == LOW_LATENCY_PCM_NOPROC_MODE)
open.mode_flags |= ASM_ULTRA_LOW_LATENCY_NPROC_STREAM_SESSION;
else {
open.mode_flags |= ASM_LEGACY_STREAM_SESSION;
if (is_gapless_mode)
@ -3840,11 +3848,12 @@ static int __q6asm_open_write(struct audio_client *ac, uint32_t format,
goto fail_cmd;
}
if (atomic_read(&ac->cmd_state) > 0) {
pr_err("%s: DSP returned error[%s]\n",
__func__, adsp_err_get_err_str(
atomic_read(&ac->cmd_state)));
rc = adsp_err_get_lnx_err_code(
atomic_read(&ac->cmd_state));
if (rc != -EALREADY)
pr_err("%s: DSP returned error[%s]\n",
__func__, adsp_err_get_err_str(
atomic_read(&ac->cmd_state)));
goto fail_cmd;
}
ac->io_mode |= TUN_WRITE_IO_MODE;
@ -4190,11 +4199,12 @@ static int __q6asm_open_read_write(struct audio_client *ac, uint32_t rd_format,
goto fail_cmd;
}
if (atomic_read(&ac->cmd_state) > 0) {
pr_err("%s: DSP returned error[%s]\n",
__func__, adsp_err_get_err_str(
atomic_read(&ac->cmd_state)));
rc = adsp_err_get_lnx_err_code(
atomic_read(&ac->cmd_state));
if (rc != -EALREADY)
pr_err("%s: DSP returned error[%s]\n",
__func__, adsp_err_get_err_str(
atomic_read(&ac->cmd_state)));
goto fail_cmd;
}
@ -11691,5 +11701,13 @@ int __init q6asm_init(void)
void q6asm_exit(void)
{
int lcnt;
q6asm_delete_cal_data();
for (lcnt = 0; lcnt <= OUT; lcnt++)
mutex_destroy(&common_client.port[lcnt].lock);
mutex_destroy(&common_client.cmd_lock);
for (lcnt = 0; lcnt <= ASM_ACTIVE_STREAMS_ALLOWED; lcnt++)
mutex_destroy(&(session[lcnt].mutex_lock_per_session));
}

View file

@ -3100,8 +3100,12 @@ int __init q6lsm_init(void)
void q6lsm_exit(void)
{
int i = 0;
lsm_delete_cal_data();
for (; i <= LSM_MAX_SESSION_ID; i++)
mutex_destroy(&lsm_common.common_client[i].cmd_lock);
mutex_destroy(&lsm_common.apr_lock);
#ifdef CONFIG_DEBUG_FS
debugfs_remove_recursive(lsm_common.entry);
lsm_common.entry = NULL;

View file

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/slab.h>
#include <linux/kthread.h>
@ -25,7 +26,7 @@
#include <dsp/voice_mhi.h>
#include <soc/qcom/secure_buffer.h>
#define TIMEOUT_MS 300
#define TIMEOUT_MS 1000
#define CMD_STATUS_SUCCESS 0
@ -118,7 +119,7 @@ static int voice_send_cvp_ecns_enable_cmd(struct voice_data *v,
static int is_cal_memory_allocated(void);
static bool is_cvd_version_queried(void);
static int is_voip_memory_allocated(void);
static bool is_voip_memory_allocated(void);
static int voice_get_cvd_int_version(char *cvd_ver_string);
static int voice_alloc_cal_mem_map_table(void);
static int voice_alloc_rtac_mem_map_table(void);
@ -134,7 +135,7 @@ static int remap_cal_data(struct cal_block_data *cal_block,
static int voice_unmap_cal_memory(int32_t cal_type,
struct cal_block_data *cal_block);
static int is_source_tracking_shared_memomry_allocated(void);
static bool is_source_tracking_shared_memomry_allocated(void);
static int voice_alloc_source_tracking_shared_memory(void);
static int voice_alloc_and_map_source_tracking_shared_memory(
struct voice_data *v);
@ -2222,7 +2223,7 @@ done:
}
static int is_voip_memory_allocated(void)
static bool is_voip_memory_allocated(void)
{
bool ret;
struct voice_data *v = voice_get_session(
@ -9693,7 +9694,7 @@ int voc_get_sound_focus(struct sound_focus_param *soundFocusData)
}
EXPORT_SYMBOL(voc_get_sound_focus);
static int is_source_tracking_shared_memomry_allocated(void)
static bool is_source_tracking_shared_memomry_allocated(void)
{
bool ret;
@ -10351,7 +10352,11 @@ int __init voice_init(void)
void voice_exit(void)
{
int i;
q6core_destroy_uevent_data(common.uevent_data);
voice_delete_cal_data();
free_cal_map_table();
mutex_destroy(&common.common_lock);
for (i = 0; i < MAX_VOC_SESSIONS; i++)
mutex_destroy(&common.voice[i].lock);
}

View file

@ -2068,6 +2068,13 @@ void rtac_exit(void)
kzfree(rtac_asm_buffer);
kzfree(rtac_afe_buffer);
kzfree(rtac_voice_buffer);
mutex_destroy(&rtac_voice_apr_mutex);
mutex_destroy(&rtac_voice_mutex);
mutex_destroy(&rtac_afe_apr_mutex);
mutex_destroy(&rtac_asm_apr_mutex);
mutex_destroy(&rtac_adm_apr_mutex);
mutex_destroy(&rtac_adm_mutex);
mutex_destroy(&rtac_common.rtac_fops_mutex);
}
MODULE_DESCRIPTION("SoC QDSP6v2 Real-Time Audio Calibration driver");

28
techpack/audio/include/dsp/apr_audio-v2.h Normal file → Executable file
View file

@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
*/
@ -222,6 +223,8 @@ struct adm_cmd_matrix_map_routings_v5 {
/* Definition for a low latency stream session. */
#define ADM_LOW_LATENCY_DEVICE_SESSION 0x2000
#define ADM_LOW_LATENCY_NPROC_DEVICE_SESSION 0x6000
/* Definition for a ultra low latency stream session. */
#define ADM_ULTRA_LOW_LATENCY_DEVICE_SESSION 0x4000
@ -8099,6 +8102,8 @@ struct asm_session_cmdrsp_get_path_delay_v2 {
#define ASM_ULTRA_LOW_LATENCY_STREAM_SESSION 0x20000000
#define ASM_ULTRA_LOW_LATENCY_NPROC_STREAM_SESSION 0x30000000
#define ASM_ULL_POST_PROCESSING_STREAM_SESSION 0x40000000
#define ASM_LEGACY_STREAM_SESSION 0
@ -12209,6 +12214,9 @@ struct afe_param_id_clip_bank_sel {
/* Supported LPASS CLK root*/
#define Q6AFE_LPASS_CLK_ROOT_DEFAULT 0
#define Q6AFE_LPASS_MCLK_IN0 1
#define Q6AFE_LPASS_MCLK_IN1 2
enum afe_lpass_clk_mode {
Q6AFE_LPASS_MODE_BOTH_INVALID,
Q6AFE_LPASS_MODE_CLK1_VALID,
@ -12362,6 +12370,8 @@ enum afe_lpass_clk_mode {
/* Clock ID for AHB HDMI input */
#define Q6AFE_LPASS_CLK_ID_AHB_HDMI_INPUT 0x400
#define Q6AFE_LPASS_CLK_ID_SPDIF_CORE 0x000
/* Clock ID for the primary SPDIF output core. */
#define AFE_CLOCK_SET_CLOCK_ID_PRI_SPDIF_OUTPUT_CORE 0x500
/* Clock ID for the secondary SPDIF output core. */
@ -12448,6 +12458,12 @@ struct afe_clk_set {
#define AFE_PARAM_ID_CLOCK_SET_V2 0x000102E6
#define AFE_CLOCK_SET_CLOCK_ROOT_DEFAULT 0x2
#define AFE_CLOCK_DEFAULT_INTEGER_DIVIDER 0x0
#define AFE_CLOCK_DEFAULT_M_VALUE 0x1
#define AFE_CLOCK_DEFAULT_N_VALUE 0x2
#define AFE_CLOCK_DEFAULT_D_VALUE 0x1
#define AFE_API_VERSION_CLOCK_SET_V2 0x1
struct afe_param_id_clock_set_v2_t {
@ -13623,4 +13639,16 @@ struct afe_param_id_port_data_log_disable_t
*/
} __packed;
#define AFE_MODULE_LIMITER 0x000102A8
#define AFE_PARAM_ID_ENABLE 0x00010203
struct afe_param_id_port_afe_limiter_disable_t
{
uint16_t disable_afe_limiter;
/** Flag for enabling or disabling data logging.
* @values
* - AFE_PORT_DATA_LOGGING_ENABLE - enable data logging.
* - AFE_PORT_DATA_LOGGING_DISABLE - disable data logging.
*/
uint16_t reserved;
} __packed;
#endif /*_APR_AUDIO_V2_H_ */

View file

@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef __Q6AFE_V2_H__
#define __Q6AFE_V2_H__
@ -590,8 +591,12 @@ int afe_tdm_port_start(u16 port_id, struct afe_tdm_port_config *tdm_port,
void afe_set_routing_callback(routing_cb cb);
int afe_port_send_logging_cfg(u16 port_id,
struct afe_param_id_port_data_log_disable_t *log_disable);
int afe_port_send_afe_limiter_param(u16 port_id,
struct afe_param_id_port_afe_limiter_disable_t *disable_limiter);
int afe_get_av_dev_drift(struct afe_param_id_dev_timing_stats *timing_stats,
u16 port);
int afe_set_lpass_clk_cfg_ext_mclk_v2(int index,
struct afe_param_id_clock_set_v2_t *dyn_mclk_cfg, uint32_t mclk_freq);
int afe_get_sp_rx_tmax_xmax_logging_data(
struct afe_sp_rx_tmax_xmax_logging_param *xt_logging,
u16 port_id);

2
techpack/audio/include/dsp/q6asm-v2.h Normal file → Executable file
View file

@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2012-2019, 2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef __Q6_ASM_V2_H__
#define __Q6_ASM_V2_H__
@ -150,6 +151,7 @@ enum {
SOFT_VOLUME_CURVE_LINEAR = 0,
SOFT_VOLUME_CURVE_EXP,
SOFT_VOLUME_CURVE_LOG,
SOFT_VOLUME_CURVE_ENUM_MAX,
};
#define SOFT_VOLUME_INSTANCE_1 1

View file

@ -12,6 +12,7 @@ enum {
LEGACY_PCM_MODE = 0,
LOW_LATENCY_PCM_MODE,
ULTRA_LOW_LATENCY_PCM_MODE,
LOW_LATENCY_PCM_NOPROC_MODE,
ULL_POST_PROCESSING_PCM_MODE,
};

3
techpack/audio/include/dsp/rtac.h Normal file → Executable file
View file

@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2011, 2013-2015, 2017-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef __RTAC_H__
@ -13,7 +14,7 @@
#define RTAC_CVS 1
#define RTAC_VOICE_MODES 2
#define RTAC_MAX_ACTIVE_DEVICES 6
#define RTAC_MAX_ACTIVE_DEVICES 15
#define RTAC_MAX_ACTIVE_POPP 8
#define DEFAULT_APP_TYPE 0x00011130

View file

@ -1 +1 @@
../../../../../../kernel/msm-5.4/drivers/base/regmap/internal.h
../../../../drivers/base/regmap/internal.h

View file

@ -585,7 +585,7 @@ static int apr_vm_cb_thread(void *data)
unsigned long delay = jiffies + (HZ / 2);
int status = 0;
int ret = 0;
struct sched_param param = {.sched_priority = 1};
struct sched_param param = {.sched_priority = 3};
sched_setscheduler(current, SCHED_FIFO, &param);

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2018, The Linux Foundation. All rights reserved.
* Copyright (c) 2018, 2021 The Linux Foundation. All rights reserved.
*/
#include <linux/platform_device.h>
@ -8,6 +8,7 @@
#include <linux/module.h>
#include <linux/of_device.h>
#include <soc/snd_event.h>
#include <soc/qcom/boot_stats.h>
struct snd_event_client {
struct list_head node;
@ -490,5 +491,17 @@ exit:
}
EXPORT_SYMBOL(snd_event_notify);
static int __init snd_event_init(void)
{
place_marker("M - Driver Sound Event Init");
return 0;
}
module_init(snd_event_init);
static void __exit snd_event_exit(void)
{
}
module_exit(snd_event_exit);
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("SND event module");

View file

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/irq.h>
@ -54,7 +55,6 @@
#define ERR_AUTO_SUSPEND_TIMER_VAL 0x1
#define SWRM_INTERRUPT_STATUS_MASK 0x1FDFD
#define SWRM_LINK_STATUS_RETRY_CNT 100
#define SWRM_ROW_48 48
@ -1465,12 +1465,14 @@ static void swrm_copy_data_port_config(struct swr_master *master, u8 bank)
SWRS_DP_SAMPLE_CONTROL_1_BANK(slv_id,
bank));
reg[len] = SWRM_CMD_FIFO_WR_CMD;
val[len++] = SWR_REG_VAL_PACK(
if ((port_req->sinterval >> 8)& 0xFF) {
reg[len] = SWRM_CMD_FIFO_WR_CMD;
val[len++] = SWR_REG_VAL_PACK(
(port_req->sinterval >> 8)& 0xFF,
port_req->dev_num, 0x00,
SWRS_DP_SAMPLE_CONTROL_2_BANK(slv_id,
bank));
}
reg[len] = SWRM_CMD_FIFO_WR_CMD;
val[len++] = SWR_REG_VAL_PACK(port_req->offset1,

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-2021 The Linux Foundation. All rights reserved.
*/
#ifndef _SWRM_REGISTERS_H
@ -18,24 +18,46 @@
#define MM_SYNC_CONFIG (SWRM_BASE+0x0108)
#define SWRM_COMP_NPL_PARAMS (SWRM_BASE+0x0120)
#define SWRM_INTERRUPT_STATUS (SWRM_BASE+0x0200)
#define SWRM_INTERRUPT_EN (SWRM_BASE+0x0204)
#define SWRM_INTERRUPT_CLEAR (SWRM_BASE+0x0208)
#define SWRM_INTERRUPT_STATUS_1 (SWRM_BASE+0x0220)
#define SWRM_INTERRUPT_EN_1 (SWRM_BASE+0x0224)
#define SWRM_INTERRUPT_CLEAR_1 (SWRM_BASE+0x0228)
#define SWRM_CPU1_INTERRUPT_EN (SWRM_BASE+0x0210)
#define SWRM_CPU1_INTERRUPT_EN_1 (SWRM_BASE+0x0230)
#define SWRM_CPU0_CMD_RESPONSE (SWRM_BASE+0x0250)
#define SWRM_CMD_FIFO_WR_CMD (SWRM_BASE+0x0300)
#define SWRM_CMD_FIFO_RD_CMD (SWRM_BASE+0x0304)
#define SWRM_CMD_FIFO_CMD (SWRM_BASE+0x0308)
#define SWRM_CMD_FIFO_STATUS (SWRM_BASE+0x030C)
#define SWRM_CMD_FIFO_CFG (SWRM_BASE+0x0314)
#define SWRM_CMD_FIFO_RD_FIFO (SWRM_BASE+0x0318)
#define SWRM_CPU1_CMD_FIFO_WR_CMD (SWRM_BASE+0x031C)
#define SWRM_CPU1_CMD_FIFO_RD_CMD (SWRM_BASE+0x0320)
#define SWRM_CPU1_CMD_FIFO_STATUS (SWRM_BASE+0x0328)
#define SWRM_CPU1_CMD_FIFO_RD_FIFO (SWRM_BASE+0x0334)
#ifdef CONFIG_SWRM_VER_1P6
#define SWRM_INTERRUPT_EN SWRM_CPU1_INTERRUPT_EN
#define SWRM_INTERRUPT_EN_1 SWRM_CPU1_INTERRUPT_EN_1
#define SWRM_CMD_FIFO_WR_CMD SWRM_CPU1_CMD_FIFO_WR_CMD
#define SWRM_CMD_FIFO_RD_CMD SWRM_CPU1_CMD_FIFO_RD_CMD
#define SWRM_CMD_FIFO_STATUS SWRM_CPU1_CMD_FIFO_STATUS
#define SWRM_CMD_FIFO_RD_FIFO SWRM_CPU1_CMD_FIFO_RD_FIFO
#define SWRM_INTERRUPT_STATUS_MASK 0x1FFDFD
#define SWRM_INTERRUPT_STATUS_RD_FIFO_OVERFLOW 0x40000
#define SWRM_INTERRUPT_STATUS_RD_FIFO_UNDERFLOW 0x80000
#define SWRM_INTERRUPT_STATUS_SPECIAL_CMD_ID_FINISHED 0x100000
#define SWRM_INTERRUPT_MAX 0x20
#else
#define SWRM_INTERRUPT_EN (SWRM_BASE+0x0204)
#define SWRM_INTERRUPT_EN_1 (SWRM_BASE+0x0224)
#define SWRM_CMD_FIFO_WR_CMD (SWRM_BASE+0x0300)
#define SWRM_CMD_FIFO_RD_CMD (SWRM_BASE+0x0304)
#define SWRM_CMD_FIFO_STATUS (SWRM_BASE+0x030C)
#define SWRM_CMD_FIFO_RD_FIFO (SWRM_BASE+0x0318)
#define SWRM_INTERRUPT_STATUS_MASK 0x1FDFD
#define SWRM_INTERRUPT_STATUS_RD_FIFO_OVERFLOW 0x10
#define SWRM_INTERRUPT_STATUS_RD_FIFO_UNDERFLOW 0x20
#define SWRM_INTERRUPT_STATUS_SPECIAL_CMD_ID_FINISHED 0x400
#define SWRM_INTERRUPT_MAX 0x11
#endif /* CONFIG_SWRM_VER_1P6 */
#define SWRM_CMD_FIFO_CMD (SWRM_BASE+0x0308)
#define SWRM_CMD_FIFO_CFG (SWRM_BASE+0x0314)
#define SWRM_CPU_NUM_ENTRIES_WR_CMD_FIFO (SWRM_BASE+0x0370)
#define SWRM_CPU0_SW_INTERRUPT_SET (SWRM_BASE+0x0374)
#define SWRM_CPU0_SW_MESSAGE0 (SWRM_BASE+0x0384)
@ -82,13 +104,10 @@
#define SWRM_INTERRUPT_STATUS_NEW_SLAVE_ATTACHED 0x2
#define SWRM_INTERRUPT_STATUS_CHANGE_ENUM_SLAVE_STATUS 0x4
#define SWRM_INTERRUPT_STATUS_MASTER_CLASH_DET 0x8
#define SWRM_INTERRUPT_STATUS_RD_FIFO_OVERFLOW 0x10
#define SWRM_INTERRUPT_STATUS_RD_FIFO_UNDERFLOW 0x20
#define SWRM_INTERRUPT_STATUS_WR_CMD_FIFO_OVERFLOW 0x40
#define SWRM_INTERRUPT_STATUS_CMD_ERROR 0x80
#define SWRM_INTERRUPT_STATUS_DOUT_PORT_COLLISION 0x100
#define SWRM_INTERRUPT_STATUS_READ_EN_RD_VALID_MISMATCH 0x200
#define SWRM_INTERRUPT_STATUS_SPECIAL_CMD_ID_FINISHED 0x400
#ifdef CONFIG_SWRM_VER_1P1
#define SWRM_INTERRUPT_STATUS_NEW_SLAVE_AUTO_ENUM_FINISHED 0x800
@ -107,8 +126,6 @@
#define SWRM_INTERRUPT_STATUS_EXT_CLK_STOP_WAKEUP 0x10000
#define SWRM_INTERRUPT_MAX 0x11
#define SWRM_COMP_PARAMS_WR_FIFO_DEPTH 0x00007C00
#define SWRM_COMP_PARAMS_RD_FIFO_DEPTH 0x000F8000
#endif /* _SWRM_REGISTERS_H */