diff --git a/Makefile.am b/Makefile.am index ccbb7a2c7aeb..5e3faccf5492 100755 --- a/Makefile.am +++ b/Makefile.am @@ -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/ diff --git a/asoc/Kbuild b/asoc/Kbuild index 8276d7df6000..8f105ae11d28 100644 --- a/asoc/Kbuild +++ b/asoc/Kbuild @@ -210,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 diff --git a/asoc/bengal.c b/asoc/bengal.c old mode 100644 new mode 100755 index 08517e07ae30..227a75ad2642 --- a/asoc/bengal.c +++ b/asoc/bengal.c @@ -4983,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[] = { diff --git a/asoc/codecs/wcd9335-regmap.c b/asoc/codecs/wcd9335-regmap.c index 418327245018..ac734f8c46e9 100644 --- a/asoc/codecs/wcd9335-regmap.c +++ b/asoc/codecs/wcd9335-regmap.c @@ -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 #include #include #include -#include +#include "wcd9335_registers.h" static const struct reg_sequence wcd9335_1_x_defaults[] = { { WCD9335_CODEC_RPM_CLK_GATE, 0x03, 0x00 }, diff --git a/asoc/codecs/wcd937x/wcd937x.c b/asoc/codecs/wcd937x/wcd937x.c index fcb0dd15c6a8..24de137ad11f 100644 --- a/asoc/codecs/wcd937x/wcd937x.c +++ b/asoc/codecs/wcd937x/wcd937x.c @@ -209,7 +209,7 @@ static int wcd937x_init_reg(struct snd_soc_component *component) snd_soc_component_update_bits(component, WCD937X_BIAS_VBG_FINE_ADJ, 0xF0, 0xB0); snd_soc_component_update_bits(component, - WCD937X_RX_BIAS_HPH_LOWPOWER, 0xF0, 0x90); + WCD937X_HPH_NEW_INT_RDAC_GAIN_CTL , 0xF0, 0x50); } return 0; } @@ -503,6 +503,12 @@ static int wcd937x_codec_hphl_dac_event(struct snd_soc_dapm_widget *w, set_bit(HPH_COMP_DELAY, &wcd937x->status_mask); break; case SND_SOC_DAPM_POST_PMU: + if ((snd_soc_component_read32(component, + WCD937X_DIGITAL_EFUSE_REG_16) == 0x02) && + ((snd_soc_component_read32(component, + WCD937X_ANA_HPH) & 0x0C) == 0x0C)) + snd_soc_component_update_bits(component, + WCD937X_RX_BIAS_HPH_LOWPOWER, 0xF0, 0x90); if (hph_mode == CLS_AB_HIFI || hph_mode == CLS_H_HIFI) snd_soc_component_update_bits(component, WCD937X_HPH_NEW_INT_RDAC_HD2_CTL_L, @@ -544,6 +550,12 @@ static int wcd937x_codec_hphl_dac_event(struct snd_soc_dapm_widget *w, WCD937X_HPH_NEW_INT_HPH_TIMER1, 0x02, 0x00); break; case SND_SOC_DAPM_POST_PMD: + if ((snd_soc_component_read32(component, + WCD937X_DIGITAL_EFUSE_REG_16) == 0x02) && + ((snd_soc_component_read32(component, + WCD937X_ANA_HPH) & 0x0C) == 0x0C)) + snd_soc_component_update_bits(component, + WCD937X_RX_BIAS_HPH_LOWPOWER, 0xF0, 0x80); snd_soc_component_update_bits(component, WCD937X_HPH_NEW_INT_RDAC_HD2_CTL_L, 0x0F, 0x01); @@ -577,6 +589,12 @@ static int wcd937x_codec_hphr_dac_event(struct snd_soc_dapm_widget *w, set_bit(HPH_COMP_DELAY, &wcd937x->status_mask); break; case SND_SOC_DAPM_POST_PMU: + if ((snd_soc_component_read32(component, + WCD937X_DIGITAL_EFUSE_REG_16) == 0x02) && + ((snd_soc_component_read32(component, + WCD937X_ANA_HPH) & 0x0C) == 0x0C)) + snd_soc_component_update_bits(component, + WCD937X_RX_BIAS_HPH_LOWPOWER, 0xF0, 0x90); if (hph_mode == CLS_AB_HIFI || hph_mode == CLS_H_HIFI) snd_soc_component_update_bits(component, WCD937X_HPH_NEW_INT_RDAC_HD2_CTL_R, @@ -618,6 +636,12 @@ static int wcd937x_codec_hphr_dac_event(struct snd_soc_dapm_widget *w, WCD937X_HPH_NEW_INT_HPH_TIMER1, 0x02, 0x00); break; case SND_SOC_DAPM_POST_PMD: + if ((snd_soc_component_read32(component, + WCD937X_DIGITAL_EFUSE_REG_16) == 0x02) && + ((snd_soc_component_read32(component, + WCD937X_ANA_HPH) & 0x0C) == 0x0C)) + snd_soc_component_update_bits(component, + WCD937X_RX_BIAS_HPH_LOWPOWER, 0xF0, 0x80); snd_soc_component_update_bits(component, WCD937X_HPH_NEW_INT_RDAC_HD2_CTL_R, 0x0F, 0x01); diff --git a/asoc/codecs/wsa881x-analog.c b/asoc/codecs/wsa881x-analog.c old mode 100644 new mode 100755 index 62247524f1cc..965fc56831ed --- a/asoc/codecs/wsa881x-analog.c +++ b/asoc/codecs/wsa881x-analog.c @@ -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 @@ -273,7 +274,8 @@ static int wsa881x_i2c_read_device(struct wsa881x_pdata *wsa881x, } pr_debug("read success reg = %x val = %x\n", reg, val); - } else { + } else if (wsa881x->client[wsa881x_index]) { + reg_addr = (u8)reg; msg = &wsa881x->xfer_msg[0]; msg->addr = wsa881x->client[wsa881x_index]->addr; @@ -301,6 +303,9 @@ static int wsa881x_i2c_read_device(struct wsa881x_pdata *wsa881x, } } val = dest[0]; + } else { + pr_err("failed for i2c client is not initilized\n"); + return -EINVAL; } return val; } @@ -805,7 +810,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), @@ -1168,15 +1206,16 @@ static int wsa881x_probe(struct snd_soc_component *component) wsa881x_temp_reg_read; snd_soc_component_set_drvdata(component, &wsa_pdata[wsa881x_index]); while (retry) { - if (wsa_pdata[wsa881x_index].regmap[WSA881X_ANALOG_SLAVE] - != NULL) + if (wsa_pdata[wsa881x_index].regmap_flag) break; msleep(100); retry--; } - if (!retry) + if (!retry) { dev_err(&client->dev, "%s: max retry expired and regmap of\n" "analog slave not initilized\n", __func__); + return -EPROBE_DEFER; + } wsa881x_init_thermal(&wsa_pdata[wsa881x_index].tz_pdata); INIT_DELAYED_WORK(&wsa_pdata[wsa881x_index].ocp_ctl_work, wsa881x_ocp_ctl_work); diff --git a/asoc/msm-dai-fe.c b/asoc/msm-dai-fe.c old mode 100644 new mode 100755 index abb77881adb3..b6b684740706 --- a/asoc/msm-dai-fe.c +++ b/asoc/msm-dai-fe.c @@ -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", diff --git a/asoc/msm-dai-q6-v2.c b/asoc/msm-dai-q6-v2.c index d39ef1e49b3f..1d641337c64f 100755 --- a/asoc/msm-dai-q6-v2.c +++ b/asoc/msm-dai-q6-v2.c @@ -481,6 +481,8 @@ static bool afe_port_logging_item[IDX_TDM_MAX]; static int afe_port_loggging_control_added; +static int afe_port_limiter_control_added; + static int afe_dyn_mclk_control_added; static DEFINE_MUTEX(tdm_mutex); @@ -10572,6 +10574,78 @@ int jitter_cleaner_afe_enable_mclk_and_get_info_cb_func(void *private_data, return 0; } +static int msm_pcm_afe_limiter_param_ctl_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info* ucontrol) +{ + ucontrol->type = SNDRV_CTL_ELEM_TYPE_INTEGER; + /* two int values: port_id and enable/disable */ + ucontrol->count = 2; + /* Valid range is all positive values to support above controls */ + ucontrol->value.integer.min = 0; + ucontrol->value.integer.max = INT_MAX; + return 0; +} + +static int msm_pcm_afe_limiter_param_ctl_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + return 0; +} + +static int msm_pcm_afe_limiter_param_ctl_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + u16 port_id; + struct afe_param_id_port_afe_limiter_disable_t afe_limiter_disable; + struct param_hdr_v3 param_hdr; + int ret = -EINVAL; + + pr_debug("%s: enter\n", __func__); + memset(¶m_hdr, 0, sizeof(param_hdr)); + + port_id = ucontrol->value.integer.value[0]; + afe_limiter_disable.disable_afe_limiter = ucontrol->value.integer.value[1]; + + ret = afe_port_send_afe_limiter_param(port_id, &afe_limiter_disable); + if (ret) + pr_err("%s: AFE port logging setting for port 0x%x failed %d\n", + __func__, port_id, ret); + + return ret; +} + +static int msm_pcm_add_afe_port_limiter_control(struct snd_soc_dai *dai) +{ + const char* afe_port_limiter_ctl_name = "AFE_port_limiter_disable"; + int rc = 0; + struct snd_kcontrol_new *knew = NULL; + struct snd_kcontrol* kctl = NULL; + + /* Add AFE port logging controls */ + knew = kzalloc(sizeof(struct snd_kcontrol_new), GFP_KERNEL); + if (!knew) { + return -ENOMEM; + } + knew->iface = SNDRV_CTL_ELEM_IFACE_MIXER; + knew->info = msm_pcm_afe_limiter_param_ctl_info; + knew->get = msm_pcm_afe_limiter_param_ctl_get; + knew->put = msm_pcm_afe_limiter_param_ctl_put; + knew->name = afe_port_limiter_ctl_name; + knew->private_value = dai->id; + kctl = snd_ctl_new1(knew, knew); + if (!kctl) { + kfree(knew); + return -ENOMEM; + } + + rc = snd_ctl_add(dai->component->card->snd_card, kctl); + if (rc < 0) + pr_err("%s: err add AFE port limiter disable control, DAI = %s\n", + __func__, dai->name); + + return rc; +} + static int msm_dai_q6_dai_tdm_probe(struct snd_soc_dai *dai) { int rc = 0; @@ -10680,6 +10754,17 @@ static int msm_dai_q6_dai_tdm_probe(struct snd_soc_dai *dai) } } + if (!afe_port_limiter_control_added) { + rc = msm_pcm_add_afe_port_limiter_control(dai); + if (rc < 0) { + dev_err(dai->dev, "%s: add AFE port logging control failed DAI: %s\n", + __func__, dai->name); + goto rtn; + } + + afe_port_limiter_control_added = 1; + } + if (tdm_dai_data->is_island_dai) rc = msm_dai_q6_add_island_mx_ctls( dai->component->card->snd_card, @@ -11263,7 +11348,7 @@ static int msm_dai_q6_tdm_set_channel_map(struct snd_soc_dai *dai, } static unsigned int tdm_param_set_slot_mask(u16 *slot_offset, int slot_width, - int slots_per_frame) + int slots_per_frame, int num_channels) { unsigned int i = 0; unsigned int slot_index = 0; @@ -11280,6 +11365,11 @@ static unsigned int tdm_param_set_slot_mask(u16 *slot_offset, int slot_width, return slot_mask; } + if (num_channels != slots_per_frame) { + pr_debug("%s: multi lane is enabled, use the slot mask of tdm group\n", __func__); + return slot_mask; + } + for (i = 0; i < channel_count; i++) { if (slot_offset[i] != AFE_SLOT_MAPPING_OFFSET_INVALID) { slot_index = slot_offset[i] / slot_width_bytes; @@ -11407,11 +11497,13 @@ static int msm_dai_q6_tdm_hw_params(struct snd_pcm_substream *substream, tdm->slot_mask = tdm_param_set_slot_mask( slot_mapping_v2->offset, tdm_group->slot_width, - tdm_group->nslots_per_frame); + tdm_group->nslots_per_frame, + tdm_group->num_channels); else tdm->slot_mask = tdm_param_set_slot_mask(slot_mapping->offset, tdm_group->slot_width, - tdm_group->nslots_per_frame); + tdm_group->nslots_per_frame, + tdm_group->num_channels); pr_debug("%s: TDM:\n" "num_channels=%d sample_rate=%d bit_width=%d\n" diff --git a/asoc/msm-pcm-routing-auto.c b/asoc/msm-pcm-routing-auto.c new file mode 100755 index 000000000000..8a98054e3d23 --- /dev/null +++ b/asoc/msm-pcm-routing-auto.c @@ -0,0 +1,33356 @@ +// 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include